@caribeng/ui 22.4.0 → 22.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. package/README.md +311 -313
  2. package/fesm2022/caribeng-ui-account-picker.mjs +533 -0
  3. package/fesm2022/caribeng-ui-aging.mjs +488 -0
  4. package/fesm2022/{caribeng-ui-caribe-alert.mjs → caribeng-ui-alert.mjs} +45 -45
  5. package/fesm2022/caribeng-ui-amount.mjs +249 -0
  6. package/fesm2022/caribeng-ui-anchor.mjs +2 -2
  7. package/fesm2022/{caribeng-ui-caribe-animation-lottie.mjs → caribeng-ui-animation-lottie.mjs} +41 -41
  8. package/fesm2022/caribeng-ui-audit-log.mjs +323 -0
  9. package/fesm2022/caribeng-ui-avatar.mjs +2 -2
  10. package/fesm2022/caribeng-ui-breadcrumb.mjs +13 -3
  11. package/fesm2022/{caribeng-ui-caribe-button-group.mjs → caribeng-ui-button-group.mjs} +15 -15
  12. package/fesm2022/caribeng-ui-button.mjs +2 -2
  13. package/fesm2022/{caribeng-ui-caribe-card-content.mjs → caribeng-ui-card-content.mjs} +39 -39
  14. package/fesm2022/{caribeng-ui-caribe-card-move.mjs → caribeng-ui-card-move.mjs} +65 -65
  15. package/fesm2022/{caribeng-ui-caribe-card-primary.mjs → caribeng-ui-card-primary.mjs} +31 -31
  16. package/fesm2022/{caribeng-ui-caribe-card-select.mjs → caribeng-ui-card-select.mjs} +67 -67
  17. package/fesm2022/caribeng-ui-carousel.mjs +2 -2
  18. package/fesm2022/caribeng-ui-cascadeselect.mjs +45 -9
  19. package/fesm2022/caribeng-ui-chat.mjs +2 -2
  20. package/fesm2022/{caribeng-ui-caribe-coachmark.mjs → caribeng-ui-coachmark.mjs} +85 -85
  21. package/fesm2022/caribeng-ui-command-palette.mjs +2 -2
  22. package/fesm2022/caribeng-ui-comments.mjs +864 -0
  23. package/fesm2022/caribeng-ui-datagrid.mjs +1635 -0
  24. package/fesm2022/caribeng-ui-dataview.mjs +2 -2
  25. package/fesm2022/caribeng-ui-datepicker.mjs +2 -2
  26. package/fesm2022/caribeng-ui-document.mjs +495 -0
  27. package/fesm2022/{caribeng-ui-caribe-dots-indicator.mjs → caribeng-ui-dots-indicator.mjs} +41 -41
  28. package/fesm2022/caribeng-ui-dynamic-form.mjs +1581 -0
  29. package/fesm2022/caribeng-ui-editor.mjs +2303 -1311
  30. package/fesm2022/{caribeng-ui-caribe-expansion-panel.mjs → caribeng-ui-expansion-panel.mjs} +39 -39
  31. package/fesm2022/{caribeng-ui-caribe-fab-menu.mjs → caribeng-ui-fab-menu.mjs} +75 -75
  32. package/fesm2022/caribeng-ui-file-card.mjs +2 -2
  33. package/fesm2022/{caribeng-ui-caribe-file-download.mjs → caribeng-ui-file-download.mjs} +63 -63
  34. package/fesm2022/caribeng-ui-financial-report.mjs +380 -0
  35. package/fesm2022/{caribeng-ui-caribe-float-menu.mjs → caribeng-ui-float-menu.mjs} +31 -31
  36. package/fesm2022/caribeng-ui-floatlabel.mjs +2 -2
  37. package/fesm2022/caribeng-ui-flow.mjs +1508 -0
  38. package/fesm2022/{caribeng-ui-caribe-footer.mjs → caribeng-ui-footer.mjs} +19 -19
  39. package/fesm2022/caribeng-ui-gantt.mjs +1094 -0
  40. package/fesm2022/{caribeng-ui-caribe-header.mjs → caribeng-ui-header.mjs} +49 -49
  41. package/fesm2022/{caribeng-ui-caribe-icon-button.mjs → caribeng-ui-icon-button.mjs} +23 -23
  42. package/fesm2022/caribeng-ui-image-cropper.mjs +671 -0
  43. package/fesm2022/caribeng-ui-import-wizard.mjs +746 -0
  44. package/fesm2022/caribeng-ui-infinite-scroll.mjs +226 -0
  45. package/fesm2022/caribeng-ui-input-number.mjs +22 -6
  46. package/fesm2022/{caribeng-ui-caribe-input-search.mjs → caribeng-ui-input-search.mjs} +65 -65
  47. package/fesm2022/{caribeng-ui-caribe-input-token.mjs → caribeng-ui-input-token.mjs} +59 -59
  48. package/fesm2022/caribeng-ui-inputotp.mjs +2 -2
  49. package/fesm2022/caribeng-ui-journal-entry.mjs +340 -0
  50. package/fesm2022/caribeng-ui-kanban.mjs +6 -6
  51. package/fesm2022/caribeng-ui-kpi.mjs +189 -0
  52. package/fesm2022/{caribeng-ui-caribe-link.mjs → caribeng-ui-link.mjs} +37 -37
  53. package/fesm2022/caribeng-ui-masonry.mjs +93 -0
  54. package/fesm2022/caribeng-ui-media-player.mjs +821 -0
  55. package/fesm2022/caribeng-ui-mentions.mjs +2 -2
  56. package/fesm2022/caribeng-ui-notification-center.mjs +636 -0
  57. package/fesm2022/{caribeng-ui-caribe-off-canvas.mjs → caribeng-ui-off-canvas.mjs} +55 -55
  58. package/fesm2022/{caribeng-ui-caribe-onboarding.mjs → caribeng-ui-onboarding.mjs} +105 -105
  59. package/fesm2022/caribeng-ui-orderlist.mjs +2 -2
  60. package/fesm2022/caribeng-ui-pdfviewer.mjs +1755 -25
  61. package/fesm2022/caribeng-ui-period-picker.mjs +637 -0
  62. package/fesm2022/caribeng-ui-phone-input.mjs +2 -2
  63. package/fesm2022/caribeng-ui-picklist.mjs +2 -2
  64. package/fesm2022/caribeng-ui-pivot.mjs +419 -0
  65. package/fesm2022/caribeng-ui-pricing.mjs +2 -2
  66. package/fesm2022/caribeng-ui-rating.mjs +14 -17
  67. package/fesm2022/caribeng-ui-reconciliation.mjs +386 -0
  68. package/fesm2022/caribeng-ui-scheduler.mjs +1027 -0
  69. package/fesm2022/caribeng-ui-select.mjs +2 -2
  70. package/fesm2022/{caribeng-ui-caribe-shortcut.mjs → caribeng-ui-shortcut.mjs} +29 -29
  71. package/fesm2022/caribeng-ui-sidebar.mjs +2 -2
  72. package/fesm2022/caribeng-ui-signature-pad.mjs +654 -0
  73. package/fesm2022/{caribeng-ui-caribe-status.mjs → caribeng-ui-status.mjs} +11 -11
  74. package/fesm2022/{caribeng-ui-caribe-step-indicator.mjs → caribeng-ui-step-indicator.mjs} +53 -53
  75. package/fesm2022/caribeng-ui-stepper.mjs +2 -2
  76. package/fesm2022/caribeng-ui-steps.mjs +2 -2
  77. package/fesm2022/caribeng-ui-table.mjs +323 -15
  78. package/fesm2022/caribeng-ui-tabmenu.mjs +2 -2
  79. package/fesm2022/caribeng-ui-tabs.mjs +2 -2
  80. package/fesm2022/{caribeng-ui-caribe-tag-button.mjs → caribeng-ui-tag-button.mjs} +25 -25
  81. package/fesm2022/caribeng-ui-tag.mjs +2 -2
  82. package/fesm2022/caribeng-ui-tieredmenu.mjs +6 -6
  83. package/fesm2022/{caribeng-ui-caribe-tracker.mjs → caribeng-ui-tracker.mjs} +29 -29
  84. package/fesm2022/{caribeng-ui-caribe-transaction-status.mjs → caribeng-ui-transaction-status.mjs} +11 -11
  85. package/fesm2022/caribeng-ui-treeselect.mjs +44 -9
  86. package/fesm2022/caribeng-ui-treetable.mjs +236 -17
  87. package/fesm2022/{caribeng-ui-caribe-voucher.mjs → caribeng-ui-voucher.mjs} +45 -45
  88. package/fesm2022/caribeng-ui-xlsx.mjs +486 -0
  89. package/fesm2022/caribeng-ui.mjs +1181 -1
  90. package/package.json +217 -177
  91. package/types/caribeng-ui-account-picker.d.ts +142 -0
  92. package/types/caribeng-ui-aging.d.ts +123 -0
  93. package/types/{caribeng-ui-caribe-alert.d.ts → caribeng-ui-alert.d.ts} +2 -2
  94. package/types/caribeng-ui-amount.d.ts +82 -0
  95. package/types/{caribeng-ui-caribe-animation-lottie.d.ts → caribeng-ui-animation-lottie.d.ts} +2 -2
  96. package/types/caribeng-ui-audit-log.d.ts +86 -0
  97. package/types/caribeng-ui-breadcrumb.d.ts +2 -2
  98. package/types/{caribeng-ui-caribe-button-group.d.ts → caribeng-ui-button-group.d.ts} +2 -2
  99. package/types/{caribeng-ui-caribe-card-content.d.ts → caribeng-ui-card-content.d.ts} +2 -2
  100. package/types/{caribeng-ui-caribe-card-move.d.ts → caribeng-ui-card-move.d.ts} +1 -1
  101. package/types/{caribeng-ui-caribe-card-primary.d.ts → caribeng-ui-card-primary.d.ts} +2 -2
  102. package/types/{caribeng-ui-caribe-card-select.d.ts → caribeng-ui-card-select.d.ts} +2 -2
  103. package/types/caribeng-ui-cascadeselect.d.ts +6 -0
  104. package/types/{caribeng-ui-caribe-coachmark.d.ts → caribeng-ui-coachmark.d.ts} +2 -2
  105. package/types/caribeng-ui-comments.d.ts +214 -0
  106. package/types/caribeng-ui-datagrid.d.ts +269 -0
  107. package/types/caribeng-ui-document.d.ts +138 -0
  108. package/types/{caribeng-ui-caribe-dots-indicator.d.ts → caribeng-ui-dots-indicator.d.ts} +2 -2
  109. package/types/caribeng-ui-dynamic-form.d.ts +409 -0
  110. package/types/caribeng-ui-editor.d.ts +110 -12
  111. package/types/{caribeng-ui-caribe-expansion-panel.d.ts → caribeng-ui-expansion-panel.d.ts} +1 -1
  112. package/types/{caribeng-ui-caribe-fab-menu.d.ts → caribeng-ui-fab-menu.d.ts} +2 -2
  113. package/types/{caribeng-ui-caribe-file-download.d.ts → caribeng-ui-file-download.d.ts} +1 -1
  114. package/types/caribeng-ui-financial-report.d.ts +102 -0
  115. package/types/{caribeng-ui-caribe-float-menu.d.ts → caribeng-ui-float-menu.d.ts} +2 -2
  116. package/types/caribeng-ui-flow.d.ts +228 -0
  117. package/types/{caribeng-ui-caribe-footer.d.ts → caribeng-ui-footer.d.ts} +2 -2
  118. package/types/caribeng-ui-gantt.d.ts +244 -0
  119. package/types/{caribeng-ui-caribe-header.d.ts → caribeng-ui-header.d.ts} +2 -2
  120. package/types/{caribeng-ui-caribe-icon-button.d.ts → caribeng-ui-icon-button.d.ts} +2 -2
  121. package/types/{caribeng-ui-caribe-illustration.d.ts → caribeng-ui-illustration.d.ts} +1 -1
  122. package/types/caribeng-ui-image-cropper.d.ts +169 -0
  123. package/types/caribeng-ui-import-wizard.d.ts +149 -0
  124. package/types/caribeng-ui-infinite-scroll.d.ts +75 -0
  125. package/types/caribeng-ui-input-number.d.ts +1 -1
  126. package/types/{caribeng-ui-caribe-input-search.d.ts → caribeng-ui-input-search.d.ts} +2 -2
  127. package/types/{caribeng-ui-caribe-input-token.d.ts → caribeng-ui-input-token.d.ts} +2 -2
  128. package/types/caribeng-ui-journal-entry.d.ts +110 -0
  129. package/types/caribeng-ui-kpi.d.ts +64 -0
  130. package/types/{caribeng-ui-caribe-link.d.ts → caribeng-ui-link.d.ts} +2 -2
  131. package/types/{caribeng-ui-caribe-logo.d.ts → caribeng-ui-logo.d.ts} +1 -1
  132. package/types/caribeng-ui-masonry.d.ts +32 -0
  133. package/types/caribeng-ui-media-player.d.ts +140 -0
  134. package/types/caribeng-ui-notification-center.d.ts +153 -0
  135. package/types/{caribeng-ui-caribe-off-canvas.d.ts → caribeng-ui-off-canvas.d.ts} +2 -2
  136. package/types/{caribeng-ui-caribe-onboarding.d.ts → caribeng-ui-onboarding.d.ts} +2 -2
  137. package/types/caribeng-ui-pdfviewer.d.ts +245 -5
  138. package/types/caribeng-ui-period-picker.d.ts +148 -0
  139. package/types/caribeng-ui-pivot.d.ts +116 -0
  140. package/types/caribeng-ui-reconciliation.d.ts +109 -0
  141. package/types/caribeng-ui-scheduler.d.ts +188 -0
  142. package/types/{caribeng-ui-caribe-shortcut.d.ts → caribeng-ui-shortcut.d.ts} +2 -2
  143. package/types/caribeng-ui-signature-pad.d.ts +151 -0
  144. package/types/{caribeng-ui-caribe-status.d.ts → caribeng-ui-status.d.ts} +2 -2
  145. package/types/{caribeng-ui-caribe-step-indicator.d.ts → caribeng-ui-step-indicator.d.ts} +2 -2
  146. package/types/caribeng-ui-table.d.ts +66 -2
  147. package/types/{caribeng-ui-caribe-tag-button.d.ts → caribeng-ui-tag-button.d.ts} +2 -2
  148. package/types/{caribeng-ui-caribe-tracker.d.ts → caribeng-ui-tracker.d.ts} +2 -2
  149. package/types/{caribeng-ui-caribe-transaction-status.d.ts → caribeng-ui-transaction-status.d.ts} +2 -2
  150. package/types/caribeng-ui-treeselect.d.ts +6 -0
  151. package/types/caribeng-ui-treetable.d.ts +67 -2
  152. package/types/{caribeng-ui-caribe-voucher.d.ts → caribeng-ui-voucher.d.ts} +2 -2
  153. package/types/caribeng-ui-xlsx.d.ts +79 -0
  154. package/types/caribeng-ui.d.ts +711 -2
  155. package/fesm2022/caribeng-ui-caribe-calendar.mjs +0 -92
  156. package/fesm2022/caribeng-ui-caribe-circle-loading.mjs +0 -130
  157. package/fesm2022/caribeng-ui-caribe-data-table.mjs +0 -94
  158. package/fesm2022/caribeng-ui-caribe-file-select.mjs +0 -88
  159. package/fesm2022/caribeng-ui-caribe-inline-alert.mjs +0 -100
  160. package/fesm2022/caribeng-ui-caribe-input-date.mjs +0 -138
  161. package/fesm2022/caribeng-ui-caribe-input-select.mjs +0 -154
  162. package/fesm2022/caribeng-ui-caribe-loader.mjs +0 -48
  163. package/fesm2022/caribeng-ui-caribe-modal.mjs +0 -119
  164. package/fesm2022/caribeng-ui-caribe-pictogram.mjs +0 -52
  165. package/fesm2022/caribeng-ui-caribe-pop-over.mjs +0 -104
  166. package/fesm2022/caribeng-ui-caribe-preloader.mjs +0 -57
  167. package/fesm2022/caribeng-ui-caribe-progress-bar.mjs +0 -84
  168. package/fesm2022/caribeng-ui-caribe-stroke.mjs +0 -69
  169. package/fesm2022/caribeng-ui-caribe-switch.mjs +0 -182
  170. package/types/caribeng-ui-caribe-calendar.d.ts +0 -27
  171. package/types/caribeng-ui-caribe-circle-loading.d.ts +0 -28
  172. package/types/caribeng-ui-caribe-data-table.d.ts +0 -26
  173. package/types/caribeng-ui-caribe-file-select.d.ts +0 -31
  174. package/types/caribeng-ui-caribe-inline-alert.d.ts +0 -28
  175. package/types/caribeng-ui-caribe-input-date.d.ts +0 -40
  176. package/types/caribeng-ui-caribe-input-select.d.ts +0 -47
  177. package/types/caribeng-ui-caribe-loader.d.ts +0 -22
  178. package/types/caribeng-ui-caribe-modal.d.ts +0 -21
  179. package/types/caribeng-ui-caribe-pictogram.d.ts +0 -15
  180. package/types/caribeng-ui-caribe-pop-over.d.ts +0 -17
  181. package/types/caribeng-ui-caribe-preloader.d.ts +0 -24
  182. package/types/caribeng-ui-caribe-progress-bar.d.ts +0 -28
  183. package/types/caribeng-ui-caribe-stroke.d.ts +0 -17
  184. package/types/caribeng-ui-caribe-switch.d.ts +0 -55
  185. /package/fesm2022/{caribeng-ui-caribe-illustration.mjs → caribeng-ui-illustration.mjs} +0 -0
  186. /package/fesm2022/{caribeng-ui-caribe-logo.mjs → caribeng-ui-logo.mjs} +0 -0
@@ -0,0 +1,533 @@
1
+ import * as i0 from '@angular/core';
2
+ import { model, input, booleanAttribute, output, signal, computed, viewChild, forwardRef, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
3
+ import { NG_VALUE_ACCESSOR } from '@angular/forms';
4
+ import * as i1 from '@angular/cdk/overlay';
5
+ import { OverlayModule } from '@angular/cdk/overlay';
6
+ import { injectCbTranslation, cbFormat, cbFieldState } from '@caribeng/ui';
7
+ import { CbIcon } from '@caribeng/ui/icon';
8
+
9
+ /** Resuelve padre, nivel, antepasados y si admite movimientos, en el orden del código. */
10
+ function resolveAccounts(accounts) {
11
+ const byCode = new Map(accounts.map((a) => [a.code, a]));
12
+ const parentOf = (a) => {
13
+ if (a.parent !== undefined)
14
+ return a.parent ? (byCode.get(a.parent) ?? null) : null;
15
+ for (let len = a.code.length - 1; len > 0; len--) {
16
+ const p = byCode.get(a.code.slice(0, len));
17
+ if (p)
18
+ return p;
19
+ }
20
+ return null;
21
+ };
22
+ const children = new Map();
23
+ const parents = new Map();
24
+ for (const a of accounts) {
25
+ const p = parentOf(a);
26
+ parents.set(a.code, p);
27
+ if (p)
28
+ children.set(p.code, (children.get(p.code) ?? 0) + 1);
29
+ }
30
+ const ancestorsOf = (a) => {
31
+ const out = [];
32
+ const seen = new Set([a.code]);
33
+ let p = parents.get(a.code) ?? null;
34
+ while (p && !seen.has(p.code)) {
35
+ out.unshift(p);
36
+ seen.add(p.code);
37
+ p = parents.get(p.code) ?? null;
38
+ }
39
+ return out;
40
+ };
41
+ return [...accounts]
42
+ .sort((a, b) => a.code.localeCompare(b.code, undefined, { numeric: false }))
43
+ .map((a) => {
44
+ const ancestors = ancestorsOf(a);
45
+ const childCount = children.get(a.code) ?? 0;
46
+ return { ...a, ancestors, level: ancestors.length + 1, childCount, postable: a.postable ?? childCount === 0 };
47
+ });
48
+ }
49
+ /** `110505 Caja general`. */
50
+ function accountLabel(account) {
51
+ return `${account.code} ${account.name}`;
52
+ }
53
+ /** Ruta de antepasados: `1 Activo › 11 Disponible › 1105 Caja`. */
54
+ function accountPath(account, separator = ' › ') {
55
+ return account.ancestors.map(accountLabel).join(separator);
56
+ }
57
+ function fold(text) {
58
+ return text.normalize('NFD').replace(/[̀-ͯ]/g, '').toLowerCase().trim();
59
+ }
60
+ /**
61
+ * Cuentas que coinciden con lo escrito: las que empiezan por el código primero
62
+ * (`1105` encuentra `1105` y `110505`), después las que contienen el texto en el
63
+ * nombre o la ruta; sin distinguir mayúsculas ni tildes.
64
+ */
65
+ function searchAccounts(accounts, text, limit = 50) {
66
+ const q = fold(text);
67
+ if (!q)
68
+ return accounts.slice(0, limit);
69
+ const byCode = [];
70
+ const byName = [];
71
+ const words = q.split(/\s+/);
72
+ for (const a of accounts) {
73
+ if (a.code.startsWith(q) || fold(accountLabel(a)).startsWith(q))
74
+ byCode.push(a);
75
+ else {
76
+ const haystack = fold(`${a.name} ${a.ancestors.map((x) => x.name).join(' ')}`);
77
+ if (words.every((w) => haystack.includes(w)))
78
+ byName.push(a);
79
+ }
80
+ }
81
+ return [...byCode, ...byName].slice(0, limit);
82
+ }
83
+ /**
84
+ * Opciones para una columna `autocomplete` del Data Grid (o un `select`):
85
+ * etiqueta `código nombre`, la ruta como descripción y, por defecto, solo las
86
+ * cuentas de movimiento.
87
+ */
88
+ function cbAccountOptions(accounts, options = {}) {
89
+ return resolveAccounts(accounts)
90
+ .filter((a) => !(options.postableOnly ?? true) || a.postable)
91
+ .map((a) => ({ label: accountLabel(a), value: a.code, description: accountPath(a), disabled: !!a.disabled || !a.postable }));
92
+ }
93
+
94
+ let nextUid = 0;
95
+ /**
96
+ * Selector de cuenta contable de CaribeNG: busca en el plan de cuentas (PUC) por
97
+ * código o por nombre y muestra la ruta de cada cuenta («1 Activo › 11 Disponible»).
98
+ *
99
+ * - Por defecto solo deja elegir cuentas de movimiento (las que no tienen hijas);
100
+ * las cuentas mayores aparecen como contexto, sin poder elegirse.
101
+ * - Escribir el código completo y salir del campo la elige; Enter elige la resaltada.
102
+ * - Funciona con Angular Forms (`formControlName`) o con `[(value)]`; el valor es el código.
103
+ *
104
+ * @example
105
+ * ```html
106
+ * <cb-account-picker label="Cuenta" [accounts]="puc" formControlName="cuenta" />
107
+ * ```
108
+ */
109
+ class CbAccountPicker {
110
+ constructor() {
111
+ this.t = injectCbTranslation();
112
+ this.fmt = cbFormat;
113
+ this.uid = `cb-account-picker-${++nextUid}`;
114
+ /** Código de la cuenta elegida. */
115
+ this.value = model(null, /* @ts-ignore */
116
+ ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
117
+ /** Plan de cuentas (lista plana; la jerarquía se deduce de `parent` o del código). */
118
+ this.accounts = input([], /* @ts-ignore */
119
+ ...(ngDevMode ? [{ debugName: "accounts" }] : /* istanbul ignore next */ []));
120
+ /** Deja elegir también cuentas mayores (con hijas). */
121
+ this.allowParents = input(false, { ...(ngDevMode ? { debugName: "allowParents" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
122
+ /** Muestra la ruta de la cuenta bajo el campo y en los resultados. */
123
+ this.showPath = input(true, { ...(ngDevMode ? { debugName: "showPath" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
124
+ this.label = input('', /* @ts-ignore */
125
+ ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
126
+ this.hint = input('', /* @ts-ignore */
127
+ ...(ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []));
128
+ this.error = input('', /* @ts-ignore */
129
+ ...(ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []));
130
+ this.placeholder = input(undefined, /* @ts-ignore */
131
+ ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
132
+ this.size = input('md', /* @ts-ignore */
133
+ ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
134
+ this.invalid = input(false, { ...(ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
135
+ this.required = input(false, { ...(ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
136
+ this.requiredIndicator = input(undefined, /* @ts-ignore */
137
+ ...(ngDevMode ? [{ debugName: "requiredIndicator" }] : /* istanbul ignore next */ []));
138
+ this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
139
+ this.inputId = input(`cb-account-picker-input-${nextUid}`, /* @ts-ignore */
140
+ ...(ngDevMode ? [{ debugName: "inputId" }] : /* istanbul ignore next */ []));
141
+ /** Máximo de resultados en la lista. */
142
+ this.limit = input(50, /* @ts-ignore */
143
+ ...(ngDevMode ? [{ debugName: "limit" }] : /* istanbul ignore next */ []));
144
+ /** La cuenta elegida (o `null` al limpiar). */
145
+ this.accountChange = output();
146
+ this.fieldState = cbFieldState({
147
+ invalid: () => this.invalid(),
148
+ required: () => this.required(),
149
+ requiredIndicator: () => this.requiredIndicator(),
150
+ });
151
+ this.positions = [
152
+ { originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top', offsetY: 4 },
153
+ { originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom', offsetY: -4 },
154
+ ];
155
+ this.open = signal(false, /* @ts-ignore */
156
+ ...(ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []));
157
+ /** Texto que se está buscando (`null`: el campo muestra la cuenta elegida). */
158
+ this.search = signal(null, /* @ts-ignore */
159
+ ...(ngDevMode ? [{ debugName: "search" }] : /* istanbul ignore next */ []));
160
+ this.active = signal(-1, /* @ts-ignore */
161
+ ...(ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []));
162
+ this.width = signal(0, /* @ts-ignore */
163
+ ...(ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []));
164
+ this.cvaDisabled = signal(false, /* @ts-ignore */
165
+ ...(ngDevMode ? [{ debugName: "cvaDisabled" }] : /* istanbul ignore next */ []));
166
+ this.isDisabled = computed(() => this.disabled() || this.cvaDisabled(), /* @ts-ignore */
167
+ ...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
168
+ this.trigger = viewChild.required('trigger');
169
+ this.field = viewChild.required('field');
170
+ this.resolved = computed(() => resolveAccounts(this.accounts()), /* @ts-ignore */
171
+ ...(ngDevMode ? [{ debugName: "resolved" }] : /* istanbul ignore next */ []));
172
+ this.byCode = computed(() => new Map(this.resolved().map((a) => [a.code, a])), /* @ts-ignore */
173
+ ...(ngDevMode ? [{ debugName: "byCode" }] : /* istanbul ignore next */ []));
174
+ this.selected = computed(() => {
175
+ const code = this.value();
176
+ return code ? (this.byCode().get(code) ?? null) : null;
177
+ }, /* @ts-ignore */
178
+ ...(ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []));
179
+ this.query = computed(() => {
180
+ const search = this.search();
181
+ if (search !== null)
182
+ return search;
183
+ const acc = this.selected();
184
+ return acc ? accountLabel(acc) : (this.value() ?? '');
185
+ }, /* @ts-ignore */
186
+ ...(ngDevMode ? [{ debugName: "query" }] : /* istanbul ignore next */ []));
187
+ this.results = computed(() => searchAccounts(this.resolved(), this.search() ?? '', this.limit()), /* @ts-ignore */
188
+ ...(ngDevMode ? [{ debugName: "results" }] : /* istanbul ignore next */ []));
189
+ this.isSearching = computed(() => !!this.search(), /* @ts-ignore */
190
+ ...(ngDevMode ? [{ debugName: "isSearching" }] : /* istanbul ignore next */ []));
191
+ this.describedBy = computed(() => {
192
+ if (this.fieldState.invalid() && this.error())
193
+ return `${this.inputId()}-error`;
194
+ return this.hint() ? `${this.inputId()}-hint` : null;
195
+ }, /* @ts-ignore */
196
+ ...(ngDevMode ? [{ debugName: "describedBy" }] : /* istanbul ignore next */ []));
197
+ this.onChange = () => { };
198
+ this.onTouched = () => { };
199
+ }
200
+ // --- ControlValueAccessor ----------------------------------------------------------------
201
+ writeValue(value) {
202
+ this.value.set(value ?? null);
203
+ this.search.set(null);
204
+ }
205
+ registerOnChange(fn) {
206
+ this.onChange = fn;
207
+ }
208
+ registerOnTouched(fn) {
209
+ this.onTouched = fn;
210
+ }
211
+ setDisabledState(disabled) {
212
+ this.cvaDisabled.set(disabled);
213
+ }
214
+ // --- Plantilla ---------------------------------------------------------------------------
215
+ path(acc) {
216
+ return accountPath(acc);
217
+ }
218
+ indent(acc) {
219
+ // Sin búsqueda se ve el árbol con sangría; al buscar, plano.
220
+ return this.search() ? 0 : acc.level - 1;
221
+ }
222
+ selectable(acc) {
223
+ return !acc.disabled && (acc.postable || this.allowParents());
224
+ }
225
+ onFocus(event) {
226
+ event.target.select();
227
+ }
228
+ onInput(event) {
229
+ this.search.set(event.target.value);
230
+ this.openList();
231
+ this.active.set(this.results().findIndex((a) => this.selectable(a)));
232
+ }
233
+ onBlur() {
234
+ const search = this.search();
235
+ if (search !== null) {
236
+ const q = search.trim();
237
+ if (!q)
238
+ this.setValue(null);
239
+ else {
240
+ // El código exacto (o la etiqueta completa) elige la cuenta; si no, se vuelve a la anterior.
241
+ const exact = this.resolved().find((a) => (a.code === q || accountLabel(a).toLowerCase() === q.toLowerCase()) && this.selectable(a));
242
+ if (exact)
243
+ this.setValue(exact.code);
244
+ }
245
+ }
246
+ this.search.set(null);
247
+ this.open.set(false);
248
+ this.onTouched();
249
+ }
250
+ onKeydown(event) {
251
+ switch (event.key) {
252
+ case 'ArrowDown':
253
+ case 'ArrowUp': {
254
+ event.preventDefault();
255
+ if (!this.open()) {
256
+ this.openList();
257
+ const current = this.results().findIndex((a) => a.code === this.value());
258
+ this.active.set(current >= 0 ? current : this.results().findIndex((a) => this.selectable(a)));
259
+ return;
260
+ }
261
+ this.move(event.key === 'ArrowDown' ? 1 : -1);
262
+ break;
263
+ }
264
+ case 'Enter': {
265
+ const acc = this.results()[this.active()];
266
+ if (this.open() && acc && this.selectable(acc)) {
267
+ event.preventDefault();
268
+ this.choose(acc);
269
+ }
270
+ break;
271
+ }
272
+ case 'Escape':
273
+ if (this.open()) {
274
+ event.preventDefault();
275
+ this.open.set(false);
276
+ this.search.set(null);
277
+ }
278
+ break;
279
+ case 'Tab': {
280
+ // Tab con la lista abierta y una búsqueda elige la resaltada (como en un comprobante).
281
+ const acc = this.results()[this.active()];
282
+ if (this.open() && this.search()?.trim() && acc && this.selectable(acc))
283
+ this.choose(acc, false);
284
+ break;
285
+ }
286
+ }
287
+ }
288
+ choose(acc, refocus = true) {
289
+ if (!this.selectable(acc))
290
+ return;
291
+ this.setValue(acc.code);
292
+ this.search.set(null);
293
+ this.open.set(false);
294
+ if (refocus)
295
+ queueMicrotask(() => this.field().nativeElement.focus());
296
+ }
297
+ /** Quita la cuenta elegida. */
298
+ clear() {
299
+ this.setValue(null);
300
+ this.search.set(null);
301
+ this.field().nativeElement.focus();
302
+ }
303
+ openList() {
304
+ this.width.set(this.trigger().nativeElement.offsetWidth);
305
+ this.open.set(true);
306
+ }
307
+ move(step) {
308
+ const list = this.results();
309
+ if (!list.length)
310
+ return;
311
+ let i = this.active();
312
+ for (let n = 0; n < list.length; n++) {
313
+ i = (i + step + list.length) % list.length;
314
+ if (this.selectable(list[i]))
315
+ break;
316
+ }
317
+ this.active.set(i);
318
+ this.trigger().nativeElement.ownerDocument.getElementById(`${this.uid}-opt-${i}`)?.scrollIntoView?.({ block: 'nearest' });
319
+ }
320
+ setValue(code) {
321
+ if (code === this.value())
322
+ return;
323
+ this.value.set(code);
324
+ this.onChange(code);
325
+ this.accountChange.emit(code ? (this.byCode().get(code) ?? null) : null);
326
+ }
327
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbAccountPicker, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
328
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbAccountPicker, isStandalone: true, selector: "cb-account-picker", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, accounts: { classPropertyName: "accounts", publicName: "accounts", isSignal: true, isRequired: false, transformFunction: null }, allowParents: { classPropertyName: "allowParents", publicName: "allowParents", isSignal: true, isRequired: false, transformFunction: null }, showPath: { classPropertyName: "showPath", publicName: "showPath", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, requiredIndicator: { classPropertyName: "requiredIndicator", publicName: "requiredIndicator", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, inputId: { classPropertyName: "inputId", publicName: "inputId", isSignal: true, isRequired: false, transformFunction: null }, limit: { classPropertyName: "limit", publicName: "limit", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", accountChange: "accountChange" }, host: { classAttribute: "cb-account-picker-host" }, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => CbAccountPicker), multi: true }], viewQueries: [{ propertyName: "trigger", first: true, predicate: ["trigger"], descendants: true, isSignal: true }, { propertyName: "field", first: true, predicate: ["field"], descendants: true, isSignal: true }], ngImport: i0, template: `
329
+ @if (label()) {
330
+ <label class="cb-ap__label" [attr.for]="inputId()">
331
+ {{ label() }}
332
+ @if (fieldState.indicator(); as mark) {
333
+ <span [class]="'cb-ap__required cb-ap__required--' + mark.kind" [attr.aria-hidden]="mark.kind === 'optional' ? null : 'true'">{{ mark.text }}</span>
334
+ }
335
+ </label>
336
+ }
337
+ <div
338
+ #trigger
339
+ class="cb-ap"
340
+ [class]="'cb-ap--' + size()"
341
+ [class.cb-is-open]="open()"
342
+ [class.cb-is-invalid]="fieldState.invalid()"
343
+ [class.cb-is-disabled]="isDisabled()"
344
+ >
345
+ <cb-icon class="cb-ap__icon" name="search" [size]="16" aria-hidden="true" />
346
+ <input
347
+ #field
348
+ class="cb-ap__field"
349
+ type="text"
350
+ role="combobox"
351
+ autocomplete="off"
352
+ aria-autocomplete="list"
353
+ [id]="inputId()"
354
+ [attr.aria-expanded]="open()"
355
+ [attr.aria-controls]="uid + '-list'"
356
+ [attr.aria-activedescendant]="open() && active() >= 0 ? uid + '-opt-' + active() : null"
357
+ [attr.aria-invalid]="fieldState.invalid() ? 'true' : null"
358
+ [attr.aria-describedby]="describedBy()"
359
+ [attr.aria-required]="fieldState.required() || null"
360
+ [value]="query()"
361
+ [placeholder]="placeholder() ?? t().accountPickerPlaceholder"
362
+ [disabled]="isDisabled()"
363
+ (input)="onInput($event)"
364
+ (focus)="onFocus($event)"
365
+ (blur)="onBlur()"
366
+ (keydown)="onKeydown($event)"
367
+ />
368
+ @if (value() && !isDisabled()) {
369
+ <button type="button" class="cb-ap__clear" tabindex="-1" [attr.aria-label]="t().clear" (mousedown)="$event.preventDefault()" (click)="clear()">
370
+ <cb-icon name="x" [size]="14" aria-hidden="true" />
371
+ </button>
372
+ }
373
+ </div>
374
+ @if (showPath() && selected(); as acc) {
375
+ @if (acc.ancestors.length) {
376
+ <p class="cb-ap__path">{{ path(acc) }}</p>
377
+ }
378
+ }
379
+
380
+ <ng-template
381
+ cdkConnectedOverlay
382
+ [cdkConnectedOverlayOrigin]="trigger"
383
+ [cdkConnectedOverlayOpen]="open()"
384
+ [cdkConnectedOverlayWidth]="width()"
385
+ [cdkConnectedOverlayPositions]="positions"
386
+ (overlayOutsideClick)="open.set(false)"
387
+ (detach)="open.set(false)"
388
+ >
389
+ <ul class="cb-ap__list" role="listbox" [id]="uid + '-list'" [attr.aria-label]="label() || t().accountPickerPlaceholder">
390
+ @for (acc of results(); track acc.code; let i = $index) {
391
+ <li
392
+ class="cb-ap__option"
393
+ role="option"
394
+ [id]="uid + '-opt-' + i"
395
+ [class.cb-ap__option--active]="i === active()"
396
+ [class.cb-ap__option--group]="!selectable(acc)"
397
+ [class.cb-ap__option--selected]="acc.code === value()"
398
+ [style.padding-inline-start]="'calc(0.6rem + ' + indent(acc) + ' * 0.75rem)'"
399
+ [attr.aria-selected]="acc.code === value()"
400
+ [attr.aria-disabled]="!selectable(acc) || null"
401
+ (mousedown)="$event.preventDefault()"
402
+ (mouseenter)="active.set(i)"
403
+ (click)="choose(acc)"
404
+ >
405
+ <span class="cb-ap__code">{{ acc.code }}</span>
406
+ <span class="cb-ap__name">{{ acc.name }}</span>
407
+ @if (showPath() && isSearching() && acc.ancestors.length) {
408
+ <span class="cb-ap__opt-path">{{ path(acc) }}</span>
409
+ }
410
+ </li>
411
+ } @empty {
412
+ <li class="cb-ap__option cb-ap__option--empty" role="option" aria-disabled="true">{{ t().noResults }}</li>
413
+ }
414
+ </ul>
415
+ </ng-template>
416
+
417
+ @if (fieldState.invalid() && error()) {
418
+ <p class="cb-ap__message cb-ap__message--error" [id]="inputId() + '-error'" role="alert">{{ error() }}</p>
419
+ } @else if (hint()) {
420
+ <p class="cb-ap__message" [id]="inputId() + '-hint'">{{ hint() }}</p>
421
+ }
422
+ <span class="cb-ap__sr" role="status">{{ open() ? fmt(t().accountPickerResults, results().length) : '' }}</span>
423
+ `, isInline: true, styles: [":host{display:block;min-width:0;font-family:var(--cb-font-sans)}.cb-ap__label{display:block;margin-bottom:var(--cb-space-1);color:var(--cb-color-text);font-size:var(--cb-text-sm);font-weight:var(--cb-font-weight-medium)}.cb-ap__required{margin-left:2px;color:var(--cb-color-danger)}.cb-ap{position:relative;display:flex;align-items:center;box-sizing:border-box;width:100%;border:var(--cb-border-width) solid var(--cb-color-border-strong);border-radius:var(--cb-radius-md);background-color:var(--cb-color-bg);transition:border-color var(--cb-duration-fast) var(--cb-ease),box-shadow var(--cb-duration-fast) var(--cb-ease)}.cb-ap:hover:not(.cb-is-disabled):not(:focus-within){border-color:var(--cb-color-text-muted)}.cb-ap:focus-within,.cb-ap.cb-is-open{border-color:var(--cb-color-primary-500);box-shadow:0 0 0 3px color-mix(in srgb,var(--cb-color-primary-500) 25%,transparent)}.cb-ap.cb-is-invalid{border-color:var(--cb-color-danger)}.cb-ap.cb-is-disabled{background-color:var(--cb-color-surface);opacity:.8}.cb-ap__icon{flex:none;margin-left:var(--cb-space-3);color:var(--cb-color-text-muted)}.cb-ap__field{flex:1 1 auto;min-width:0;box-sizing:border-box;border:none;background:transparent;color:var(--cb-color-text);font-family:var(--cb-font-sans);font-variant-numeric:tabular-nums}.cb-ap__field::placeholder{color:var(--cb-color-text-muted)}.cb-ap__field:focus{outline:none}.cb-ap--sm .cb-ap__field{min-height:2rem;padding:var(--cb-space-1) var(--cb-space-2);font-size:var(--cb-text-sm)}.cb-ap--md .cb-ap__field{min-height:2.5rem;padding:var(--cb-space-2) var(--cb-space-3) var(--cb-space-2) var(--cb-space-2);font-size:var(--cb-text-base)}.cb-ap--lg .cb-ap__field{min-height:3rem;padding:var(--cb-space-3) var(--cb-space-4) var(--cb-space-3) var(--cb-space-2);font-size:var(--cb-text-lg)}.cb-ap__clear{display:inline-flex;flex:none;align-items:center;justify-content:center;width:2rem;height:2rem;margin-right:.25rem;padding:0;border:0;border-radius:var(--cb-radius-sm, 4px);background:transparent;color:var(--cb-color-text-muted);cursor:pointer}.cb-ap__clear:hover{color:var(--cb-color-text);background:var(--cb-color-surface-hover)}.cb-ap__path{margin:var(--cb-space-1) 0 0;overflow:hidden;color:var(--cb-color-text-muted);font-size:var(--cb-text-xs);text-overflow:ellipsis;white-space:nowrap}.cb-ap__list{box-sizing:border-box;max-height:18rem;margin:0;padding:var(--cb-space-1);overflow-y:auto;border:1px solid var(--cb-color-border);border-radius:var(--cb-radius-md);background-color:var(--cb-color-surface-raised);box-shadow:var(--cb-shadow-md);list-style:none;font-family:var(--cb-font-sans);font-size:var(--cb-text-sm);color:var(--cb-color-text)}.cb-ap__option{display:grid;grid-template-columns:auto 1fr;column-gap:.6rem;align-items:baseline;padding:.4rem .6rem;border-radius:var(--cb-radius-sm, 4px);cursor:pointer}.cb-ap__option--active{background:color-mix(in srgb,var(--cb-color-primary-500) 12%,transparent)}.cb-ap__option--selected .cb-ap__name{font-weight:var(--cb-font-weight-semibold, 600)}.cb-ap__option--group{color:var(--cb-color-text-muted);cursor:default}.cb-ap__option--group.cb-ap__option--active{background:transparent}.cb-ap__option--empty{display:block;color:var(--cb-color-text-muted);cursor:default}.cb-ap__code{font-variant-numeric:tabular-nums;font-weight:var(--cb-font-weight-semibold, 600)}.cb-ap__opt-path{grid-column:2;color:var(--cb-color-text-muted);font-size:var(--cb-text-xs)}.cb-ap__message{margin:var(--cb-space-1) 0 0;color:var(--cb-color-text-muted);font-size:var(--cb-text-xs)}.cb-ap__message--error{color:var(--cb-color-danger)}.cb-ap__sr{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}\n"], dependencies: [{ kind: "ngmodule", type: OverlayModule }, { kind: "directive", type: i1.CdkConnectedOverlay, selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]", inputs: ["cdkConnectedOverlayOrigin", "cdkConnectedOverlayPositions", "cdkConnectedOverlayPositionStrategy", "cdkConnectedOverlayOffsetX", "cdkConnectedOverlayOffsetY", "cdkConnectedOverlayWidth", "cdkConnectedOverlayHeight", "cdkConnectedOverlayMinWidth", "cdkConnectedOverlayMinHeight", "cdkConnectedOverlayBackdropClass", "cdkConnectedOverlayPanelClass", "cdkConnectedOverlayViewportMargin", "cdkConnectedOverlayScrollStrategy", "cdkConnectedOverlayOpen", "cdkConnectedOverlayDisableClose", "cdkConnectedOverlayTransformOriginOn", "cdkConnectedOverlayHasBackdrop", "cdkConnectedOverlayLockPosition", "cdkConnectedOverlayFlexibleDimensions", "cdkConnectedOverlayGrowAfterOpen", "cdkConnectedOverlayPush", "cdkConnectedOverlayDisposeOnNavigation", "cdkConnectedOverlayUsePopover", "cdkConnectedOverlayMatchWidth", "cdkConnectedOverlay"], outputs: ["backdropClick", "positionChange", "attach", "detach", "overlayKeydown", "overlayOutsideClick"], exportAs: ["cdkConnectedOverlay"] }, { kind: "component", type: CbIcon, selector: "cb-icon", inputs: ["name", "size", "spin", "ariaLabel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
424
+ }
425
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbAccountPicker, decorators: [{
426
+ type: Component,
427
+ args: [{ selector: 'cb-account-picker', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, imports: [OverlayModule, CbIcon], host: { class: 'cb-account-picker-host' }, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => CbAccountPicker), multi: true }], template: `
428
+ @if (label()) {
429
+ <label class="cb-ap__label" [attr.for]="inputId()">
430
+ {{ label() }}
431
+ @if (fieldState.indicator(); as mark) {
432
+ <span [class]="'cb-ap__required cb-ap__required--' + mark.kind" [attr.aria-hidden]="mark.kind === 'optional' ? null : 'true'">{{ mark.text }}</span>
433
+ }
434
+ </label>
435
+ }
436
+ <div
437
+ #trigger
438
+ class="cb-ap"
439
+ [class]="'cb-ap--' + size()"
440
+ [class.cb-is-open]="open()"
441
+ [class.cb-is-invalid]="fieldState.invalid()"
442
+ [class.cb-is-disabled]="isDisabled()"
443
+ >
444
+ <cb-icon class="cb-ap__icon" name="search" [size]="16" aria-hidden="true" />
445
+ <input
446
+ #field
447
+ class="cb-ap__field"
448
+ type="text"
449
+ role="combobox"
450
+ autocomplete="off"
451
+ aria-autocomplete="list"
452
+ [id]="inputId()"
453
+ [attr.aria-expanded]="open()"
454
+ [attr.aria-controls]="uid + '-list'"
455
+ [attr.aria-activedescendant]="open() && active() >= 0 ? uid + '-opt-' + active() : null"
456
+ [attr.aria-invalid]="fieldState.invalid() ? 'true' : null"
457
+ [attr.aria-describedby]="describedBy()"
458
+ [attr.aria-required]="fieldState.required() || null"
459
+ [value]="query()"
460
+ [placeholder]="placeholder() ?? t().accountPickerPlaceholder"
461
+ [disabled]="isDisabled()"
462
+ (input)="onInput($event)"
463
+ (focus)="onFocus($event)"
464
+ (blur)="onBlur()"
465
+ (keydown)="onKeydown($event)"
466
+ />
467
+ @if (value() && !isDisabled()) {
468
+ <button type="button" class="cb-ap__clear" tabindex="-1" [attr.aria-label]="t().clear" (mousedown)="$event.preventDefault()" (click)="clear()">
469
+ <cb-icon name="x" [size]="14" aria-hidden="true" />
470
+ </button>
471
+ }
472
+ </div>
473
+ @if (showPath() && selected(); as acc) {
474
+ @if (acc.ancestors.length) {
475
+ <p class="cb-ap__path">{{ path(acc) }}</p>
476
+ }
477
+ }
478
+
479
+ <ng-template
480
+ cdkConnectedOverlay
481
+ [cdkConnectedOverlayOrigin]="trigger"
482
+ [cdkConnectedOverlayOpen]="open()"
483
+ [cdkConnectedOverlayWidth]="width()"
484
+ [cdkConnectedOverlayPositions]="positions"
485
+ (overlayOutsideClick)="open.set(false)"
486
+ (detach)="open.set(false)"
487
+ >
488
+ <ul class="cb-ap__list" role="listbox" [id]="uid + '-list'" [attr.aria-label]="label() || t().accountPickerPlaceholder">
489
+ @for (acc of results(); track acc.code; let i = $index) {
490
+ <li
491
+ class="cb-ap__option"
492
+ role="option"
493
+ [id]="uid + '-opt-' + i"
494
+ [class.cb-ap__option--active]="i === active()"
495
+ [class.cb-ap__option--group]="!selectable(acc)"
496
+ [class.cb-ap__option--selected]="acc.code === value()"
497
+ [style.padding-inline-start]="'calc(0.6rem + ' + indent(acc) + ' * 0.75rem)'"
498
+ [attr.aria-selected]="acc.code === value()"
499
+ [attr.aria-disabled]="!selectable(acc) || null"
500
+ (mousedown)="$event.preventDefault()"
501
+ (mouseenter)="active.set(i)"
502
+ (click)="choose(acc)"
503
+ >
504
+ <span class="cb-ap__code">{{ acc.code }}</span>
505
+ <span class="cb-ap__name">{{ acc.name }}</span>
506
+ @if (showPath() && isSearching() && acc.ancestors.length) {
507
+ <span class="cb-ap__opt-path">{{ path(acc) }}</span>
508
+ }
509
+ </li>
510
+ } @empty {
511
+ <li class="cb-ap__option cb-ap__option--empty" role="option" aria-disabled="true">{{ t().noResults }}</li>
512
+ }
513
+ </ul>
514
+ </ng-template>
515
+
516
+ @if (fieldState.invalid() && error()) {
517
+ <p class="cb-ap__message cb-ap__message--error" [id]="inputId() + '-error'" role="alert">{{ error() }}</p>
518
+ } @else if (hint()) {
519
+ <p class="cb-ap__message" [id]="inputId() + '-hint'">{{ hint() }}</p>
520
+ }
521
+ <span class="cb-ap__sr" role="status">{{ open() ? fmt(t().accountPickerResults, results().length) : '' }}</span>
522
+ `, styles: [":host{display:block;min-width:0;font-family:var(--cb-font-sans)}.cb-ap__label{display:block;margin-bottom:var(--cb-space-1);color:var(--cb-color-text);font-size:var(--cb-text-sm);font-weight:var(--cb-font-weight-medium)}.cb-ap__required{margin-left:2px;color:var(--cb-color-danger)}.cb-ap{position:relative;display:flex;align-items:center;box-sizing:border-box;width:100%;border:var(--cb-border-width) solid var(--cb-color-border-strong);border-radius:var(--cb-radius-md);background-color:var(--cb-color-bg);transition:border-color var(--cb-duration-fast) var(--cb-ease),box-shadow var(--cb-duration-fast) var(--cb-ease)}.cb-ap:hover:not(.cb-is-disabled):not(:focus-within){border-color:var(--cb-color-text-muted)}.cb-ap:focus-within,.cb-ap.cb-is-open{border-color:var(--cb-color-primary-500);box-shadow:0 0 0 3px color-mix(in srgb,var(--cb-color-primary-500) 25%,transparent)}.cb-ap.cb-is-invalid{border-color:var(--cb-color-danger)}.cb-ap.cb-is-disabled{background-color:var(--cb-color-surface);opacity:.8}.cb-ap__icon{flex:none;margin-left:var(--cb-space-3);color:var(--cb-color-text-muted)}.cb-ap__field{flex:1 1 auto;min-width:0;box-sizing:border-box;border:none;background:transparent;color:var(--cb-color-text);font-family:var(--cb-font-sans);font-variant-numeric:tabular-nums}.cb-ap__field::placeholder{color:var(--cb-color-text-muted)}.cb-ap__field:focus{outline:none}.cb-ap--sm .cb-ap__field{min-height:2rem;padding:var(--cb-space-1) var(--cb-space-2);font-size:var(--cb-text-sm)}.cb-ap--md .cb-ap__field{min-height:2.5rem;padding:var(--cb-space-2) var(--cb-space-3) var(--cb-space-2) var(--cb-space-2);font-size:var(--cb-text-base)}.cb-ap--lg .cb-ap__field{min-height:3rem;padding:var(--cb-space-3) var(--cb-space-4) var(--cb-space-3) var(--cb-space-2);font-size:var(--cb-text-lg)}.cb-ap__clear{display:inline-flex;flex:none;align-items:center;justify-content:center;width:2rem;height:2rem;margin-right:.25rem;padding:0;border:0;border-radius:var(--cb-radius-sm, 4px);background:transparent;color:var(--cb-color-text-muted);cursor:pointer}.cb-ap__clear:hover{color:var(--cb-color-text);background:var(--cb-color-surface-hover)}.cb-ap__path{margin:var(--cb-space-1) 0 0;overflow:hidden;color:var(--cb-color-text-muted);font-size:var(--cb-text-xs);text-overflow:ellipsis;white-space:nowrap}.cb-ap__list{box-sizing:border-box;max-height:18rem;margin:0;padding:var(--cb-space-1);overflow-y:auto;border:1px solid var(--cb-color-border);border-radius:var(--cb-radius-md);background-color:var(--cb-color-surface-raised);box-shadow:var(--cb-shadow-md);list-style:none;font-family:var(--cb-font-sans);font-size:var(--cb-text-sm);color:var(--cb-color-text)}.cb-ap__option{display:grid;grid-template-columns:auto 1fr;column-gap:.6rem;align-items:baseline;padding:.4rem .6rem;border-radius:var(--cb-radius-sm, 4px);cursor:pointer}.cb-ap__option--active{background:color-mix(in srgb,var(--cb-color-primary-500) 12%,transparent)}.cb-ap__option--selected .cb-ap__name{font-weight:var(--cb-font-weight-semibold, 600)}.cb-ap__option--group{color:var(--cb-color-text-muted);cursor:default}.cb-ap__option--group.cb-ap__option--active{background:transparent}.cb-ap__option--empty{display:block;color:var(--cb-color-text-muted);cursor:default}.cb-ap__code{font-variant-numeric:tabular-nums;font-weight:var(--cb-font-weight-semibold, 600)}.cb-ap__opt-path{grid-column:2;color:var(--cb-color-text-muted);font-size:var(--cb-text-xs)}.cb-ap__message{margin:var(--cb-space-1) 0 0;color:var(--cb-color-text-muted);font-size:var(--cb-text-xs)}.cb-ap__message--error{color:var(--cb-color-danger)}.cb-ap__sr{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}\n"] }]
523
+ }], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], accounts: [{ type: i0.Input, args: [{ isSignal: true, alias: "accounts", required: false }] }], allowParents: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowParents", required: false }] }], showPath: [{ type: i0.Input, args: [{ isSignal: true, alias: "showPath", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], requiredIndicator: [{ type: i0.Input, args: [{ isSignal: true, alias: "requiredIndicator", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], inputId: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputId", required: false }] }], limit: [{ type: i0.Input, args: [{ isSignal: true, alias: "limit", required: false }] }], accountChange: [{ type: i0.Output, args: ["accountChange"] }], trigger: [{ type: i0.ViewChild, args: ['trigger', { isSignal: true }] }], field: [{ type: i0.ViewChild, args: ['field', { isSignal: true }] }] } });
524
+
525
+ /*
526
+ * Public API Surface de @caribeng/ui/account-picker
527
+ */
528
+
529
+ /**
530
+ * Generated bundle index. Do not edit.
531
+ */
532
+
533
+ export { CbAccountPicker, accountLabel, accountPath, cbAccountOptions, resolveAccounts, searchAccounts };