@4sh/ui-kit 0.1.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 (202) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +7 -0
  3. package/README.md +229 -0
  4. package/fesm2022/4sh-ui-kit-forms.mjs +501 -0
  5. package/fesm2022/4sh-ui-kit-forms.mjs.map +1 -0
  6. package/fesm2022/4sh-ui-kit-motion.mjs +155 -0
  7. package/fesm2022/4sh-ui-kit-motion.mjs.map +1 -0
  8. package/fesm2022/4sh-ui-kit-overlay.mjs +61 -0
  9. package/fesm2022/4sh-ui-kit-overlay.mjs.map +1 -0
  10. package/fesm2022/4sh-ui-kit-theming.mjs +120 -0
  11. package/fesm2022/4sh-ui-kit-theming.mjs.map +1 -0
  12. package/fesm2022/4sh-ui-kit-types.mjs +12 -0
  13. package/fesm2022/4sh-ui-kit-types.mjs.map +1 -0
  14. package/fesm2022/4sh-ui-kit-ui-accordion.mjs +244 -0
  15. package/fesm2022/4sh-ui-kit-ui-accordion.mjs.map +1 -0
  16. package/fesm2022/4sh-ui-kit-ui-alert.mjs +160 -0
  17. package/fesm2022/4sh-ui-kit-ui-alert.mjs.map +1 -0
  18. package/fesm2022/4sh-ui-kit-ui-autocomplete.mjs +926 -0
  19. package/fesm2022/4sh-ui-kit-ui-autocomplete.mjs.map +1 -0
  20. package/fesm2022/4sh-ui-kit-ui-avatar-group.mjs +34 -0
  21. package/fesm2022/4sh-ui-kit-ui-avatar-group.mjs.map +1 -0
  22. package/fesm2022/4sh-ui-kit-ui-avatar.mjs +122 -0
  23. package/fesm2022/4sh-ui-kit-ui-avatar.mjs.map +1 -0
  24. package/fesm2022/4sh-ui-kit-ui-badge.mjs +95 -0
  25. package/fesm2022/4sh-ui-kit-ui-badge.mjs.map +1 -0
  26. package/fesm2022/4sh-ui-kit-ui-breadcrumb.mjs +190 -0
  27. package/fesm2022/4sh-ui-kit-ui-breadcrumb.mjs.map +1 -0
  28. package/fesm2022/4sh-ui-kit-ui-button-split.mjs +151 -0
  29. package/fesm2022/4sh-ui-kit-ui-button-split.mjs.map +1 -0
  30. package/fesm2022/4sh-ui-kit-ui-button.mjs +222 -0
  31. package/fesm2022/4sh-ui-kit-ui-button.mjs.map +1 -0
  32. package/fesm2022/4sh-ui-kit-ui-card.mjs +164 -0
  33. package/fesm2022/4sh-ui-kit-ui-card.mjs.map +1 -0
  34. package/fesm2022/4sh-ui-kit-ui-checkbox.mjs +118 -0
  35. package/fesm2022/4sh-ui-kit-ui-checkbox.mjs.map +1 -0
  36. package/fesm2022/4sh-ui-kit-ui-chip.mjs +205 -0
  37. package/fesm2022/4sh-ui-kit-ui-chip.mjs.map +1 -0
  38. package/fesm2022/4sh-ui-kit-ui-context-menu.mjs +219 -0
  39. package/fesm2022/4sh-ui-kit-ui-context-menu.mjs.map +1 -0
  40. package/fesm2022/4sh-ui-kit-ui-datepicker.mjs +1508 -0
  41. package/fesm2022/4sh-ui-kit-ui-datepicker.mjs.map +1 -0
  42. package/fesm2022/4sh-ui-kit-ui-drawer.mjs +300 -0
  43. package/fesm2022/4sh-ui-kit-ui-drawer.mjs.map +1 -0
  44. package/fesm2022/4sh-ui-kit-ui-empty-state.mjs +148 -0
  45. package/fesm2022/4sh-ui-kit-ui-empty-state.mjs.map +1 -0
  46. package/fesm2022/4sh-ui-kit-ui-field.mjs +102 -0
  47. package/fesm2022/4sh-ui-kit-ui-field.mjs.map +1 -0
  48. package/fesm2022/4sh-ui-kit-ui-file-upload.mjs +568 -0
  49. package/fesm2022/4sh-ui-kit-ui-file-upload.mjs.map +1 -0
  50. package/fesm2022/4sh-ui-kit-ui-helper.mjs +85 -0
  51. package/fesm2022/4sh-ui-kit-ui-helper.mjs.map +1 -0
  52. package/fesm2022/4sh-ui-kit-ui-icon.mjs +98 -0
  53. package/fesm2022/4sh-ui-kit-ui-icon.mjs.map +1 -0
  54. package/fesm2022/4sh-ui-kit-ui-image.mjs +201 -0
  55. package/fesm2022/4sh-ui-kit-ui-image.mjs.map +1 -0
  56. package/fesm2022/4sh-ui-kit-ui-input-group.mjs +119 -0
  57. package/fesm2022/4sh-ui-kit-ui-input-group.mjs.map +1 -0
  58. package/fesm2022/4sh-ui-kit-ui-input-mask.mjs +125 -0
  59. package/fesm2022/4sh-ui-kit-ui-input-mask.mjs.map +1 -0
  60. package/fesm2022/4sh-ui-kit-ui-input-number.mjs +234 -0
  61. package/fesm2022/4sh-ui-kit-ui-input-number.mjs.map +1 -0
  62. package/fesm2022/4sh-ui-kit-ui-input-otp.mjs +288 -0
  63. package/fesm2022/4sh-ui-kit-ui-input-otp.mjs.map +1 -0
  64. package/fesm2022/4sh-ui-kit-ui-input-tags.mjs +679 -0
  65. package/fesm2022/4sh-ui-kit-ui-input-tags.mjs.map +1 -0
  66. package/fesm2022/4sh-ui-kit-ui-input.mjs +121 -0
  67. package/fesm2022/4sh-ui-kit-ui-input.mjs.map +1 -0
  68. package/fesm2022/4sh-ui-kit-ui-label.mjs +61 -0
  69. package/fesm2022/4sh-ui-kit-ui-label.mjs.map +1 -0
  70. package/fesm2022/4sh-ui-kit-ui-link.mjs +147 -0
  71. package/fesm2022/4sh-ui-kit-ui-link.mjs.map +1 -0
  72. package/fesm2022/4sh-ui-kit-ui-menu.mjs +484 -0
  73. package/fesm2022/4sh-ui-kit-ui-menu.mjs.map +1 -0
  74. package/fesm2022/4sh-ui-kit-ui-modal.mjs +555 -0
  75. package/fesm2022/4sh-ui-kit-ui-modal.mjs.map +1 -0
  76. package/fesm2022/4sh-ui-kit-ui-nudger.mjs +168 -0
  77. package/fesm2022/4sh-ui-kit-ui-nudger.mjs.map +1 -0
  78. package/fesm2022/4sh-ui-kit-ui-paginator.mjs +245 -0
  79. package/fesm2022/4sh-ui-kit-ui-paginator.mjs.map +1 -0
  80. package/fesm2022/4sh-ui-kit-ui-popover.mjs +296 -0
  81. package/fesm2022/4sh-ui-kit-ui-popover.mjs.map +1 -0
  82. package/fesm2022/4sh-ui-kit-ui-progress-bar.mjs +124 -0
  83. package/fesm2022/4sh-ui-kit-ui-progress-bar.mjs.map +1 -0
  84. package/fesm2022/4sh-ui-kit-ui-radio.mjs +92 -0
  85. package/fesm2022/4sh-ui-kit-ui-radio.mjs.map +1 -0
  86. package/fesm2022/4sh-ui-kit-ui-rating.mjs +185 -0
  87. package/fesm2022/4sh-ui-kit-ui-rating.mjs.map +1 -0
  88. package/fesm2022/4sh-ui-kit-ui-read-only.mjs +146 -0
  89. package/fesm2022/4sh-ui-kit-ui-read-only.mjs.map +1 -0
  90. package/fesm2022/4sh-ui-kit-ui-segment-control.mjs +386 -0
  91. package/fesm2022/4sh-ui-kit-ui-segment-control.mjs.map +1 -0
  92. package/fesm2022/4sh-ui-kit-ui-select.mjs +868 -0
  93. package/fesm2022/4sh-ui-kit-ui-select.mjs.map +1 -0
  94. package/fesm2022/4sh-ui-kit-ui-separator.mjs +77 -0
  95. package/fesm2022/4sh-ui-kit-ui-separator.mjs.map +1 -0
  96. package/fesm2022/4sh-ui-kit-ui-sidebar.mjs +577 -0
  97. package/fesm2022/4sh-ui-kit-ui-sidebar.mjs.map +1 -0
  98. package/fesm2022/4sh-ui-kit-ui-skeleton.mjs +81 -0
  99. package/fesm2022/4sh-ui-kit-ui-skeleton.mjs.map +1 -0
  100. package/fesm2022/4sh-ui-kit-ui-slider.mjs +340 -0
  101. package/fesm2022/4sh-ui-kit-ui-slider.mjs.map +1 -0
  102. package/fesm2022/4sh-ui-kit-ui-spinner.mjs +132 -0
  103. package/fesm2022/4sh-ui-kit-ui-spinner.mjs.map +1 -0
  104. package/fesm2022/4sh-ui-kit-ui-stepper.mjs +389 -0
  105. package/fesm2022/4sh-ui-kit-ui-stepper.mjs.map +1 -0
  106. package/fesm2022/4sh-ui-kit-ui-table.mjs +1406 -0
  107. package/fesm2022/4sh-ui-kit-ui-table.mjs.map +1 -0
  108. package/fesm2022/4sh-ui-kit-ui-tabs.mjs +503 -0
  109. package/fesm2022/4sh-ui-kit-ui-tabs.mjs.map +1 -0
  110. package/fesm2022/4sh-ui-kit-ui-tag.mjs +84 -0
  111. package/fesm2022/4sh-ui-kit-ui-tag.mjs.map +1 -0
  112. package/fesm2022/4sh-ui-kit-ui-textarea.mjs +119 -0
  113. package/fesm2022/4sh-ui-kit-ui-textarea.mjs.map +1 -0
  114. package/fesm2022/4sh-ui-kit-ui-toast.mjs +424 -0
  115. package/fesm2022/4sh-ui-kit-ui-toast.mjs.map +1 -0
  116. package/fesm2022/4sh-ui-kit-ui-toggle.mjs +120 -0
  117. package/fesm2022/4sh-ui-kit-ui-toggle.mjs.map +1 -0
  118. package/fesm2022/4sh-ui-kit-ui-tooltip.mjs +445 -0
  119. package/fesm2022/4sh-ui-kit-ui-tooltip.mjs.map +1 -0
  120. package/fesm2022/4sh-ui-kit.mjs +16 -0
  121. package/fesm2022/4sh-ui-kit.mjs.map +1 -0
  122. package/package.json +287 -0
  123. package/styles/base/_base.scss +19 -0
  124. package/styles/base/_motion.scss +144 -0
  125. package/styles/base/_typography.scss +99 -0
  126. package/styles/generated/_tokens-breakpoint.scss +8 -0
  127. package/styles/generated/_tokens-metrics.scss +37 -0
  128. package/styles/generated/_tokens-primitives.scss +284 -0
  129. package/styles/generated/_tokens-responsive.scss +99 -0
  130. package/styles/generated/_tokens-semantics.scss +1274 -0
  131. package/styles/generated/_tokens-styles.scss +35 -0
  132. package/styles/generated/_tokens-transitions.scss +11 -0
  133. package/styles/generated/_tokens-typography.scss +14 -0
  134. package/styles/generated/_tokens.scss +10 -0
  135. package/styles/index.scss +25 -0
  136. package/styles/settings/_ui-config.scss +67 -0
  137. package/styles/utils/_functions.scss +67 -0
  138. package/styles/utils/_helpers.scss +129 -0
  139. package/styles/utils/_mixins.scss +186 -0
  140. package/styles/utils/_motion.scss +47 -0
  141. package/styles/utils/_overlay.scss +26 -0
  142. package/styles/utils.scss +15 -0
  143. package/styles.css +1 -0
  144. package/types/4sh-ui-kit-forms.d.ts +259 -0
  145. package/types/4sh-ui-kit-motion.d.ts +111 -0
  146. package/types/4sh-ui-kit-overlay.d.ts +31 -0
  147. package/types/4sh-ui-kit-theming.d.ts +54 -0
  148. package/types/4sh-ui-kit-types.d.ts +13 -0
  149. package/types/4sh-ui-kit-ui-accordion.d.ts +140 -0
  150. package/types/4sh-ui-kit-ui-alert.d.ts +89 -0
  151. package/types/4sh-ui-kit-ui-autocomplete.d.ts +411 -0
  152. package/types/4sh-ui-kit-ui-avatar-group.d.ts +17 -0
  153. package/types/4sh-ui-kit-ui-avatar.d.ts +55 -0
  154. package/types/4sh-ui-kit-ui-badge.d.ts +38 -0
  155. package/types/4sh-ui-kit-ui-breadcrumb.d.ts +131 -0
  156. package/types/4sh-ui-kit-ui-button-split.d.ts +102 -0
  157. package/types/4sh-ui-kit-ui-button.d.ts +91 -0
  158. package/types/4sh-ui-kit-ui-card.d.ts +102 -0
  159. package/types/4sh-ui-kit-ui-checkbox.d.ts +54 -0
  160. package/types/4sh-ui-kit-ui-chip.d.ts +114 -0
  161. package/types/4sh-ui-kit-ui-context-menu.d.ts +105 -0
  162. package/types/4sh-ui-kit-ui-datepicker.d.ts +539 -0
  163. package/types/4sh-ui-kit-ui-drawer.d.ts +147 -0
  164. package/types/4sh-ui-kit-ui-empty-state.d.ts +93 -0
  165. package/types/4sh-ui-kit-ui-field.d.ts +53 -0
  166. package/types/4sh-ui-kit-ui-file-upload.d.ts +268 -0
  167. package/types/4sh-ui-kit-ui-helper.d.ts +46 -0
  168. package/types/4sh-ui-kit-ui-icon.d.ts +69 -0
  169. package/types/4sh-ui-kit-ui-image.d.ts +88 -0
  170. package/types/4sh-ui-kit-ui-input-group.d.ts +54 -0
  171. package/types/4sh-ui-kit-ui-input-mask.d.ts +63 -0
  172. package/types/4sh-ui-kit-ui-input-number.d.ts +96 -0
  173. package/types/4sh-ui-kit-ui-input-otp.d.ts +130 -0
  174. package/types/4sh-ui-kit-ui-input-tags.d.ts +350 -0
  175. package/types/4sh-ui-kit-ui-input.d.ts +78 -0
  176. package/types/4sh-ui-kit-ui-label.d.ts +36 -0
  177. package/types/4sh-ui-kit-ui-link.d.ts +72 -0
  178. package/types/4sh-ui-kit-ui-menu.d.ts +235 -0
  179. package/types/4sh-ui-kit-ui-modal.d.ts +241 -0
  180. package/types/4sh-ui-kit-ui-nudger.d.ts +79 -0
  181. package/types/4sh-ui-kit-ui-paginator.d.ts +150 -0
  182. package/types/4sh-ui-kit-ui-popover.d.ts +125 -0
  183. package/types/4sh-ui-kit-ui-progress-bar.d.ts +82 -0
  184. package/types/4sh-ui-kit-ui-radio.d.ts +44 -0
  185. package/types/4sh-ui-kit-ui-rating.d.ts +90 -0
  186. package/types/4sh-ui-kit-ui-read-only.d.ts +70 -0
  187. package/types/4sh-ui-kit-ui-segment-control.d.ts +184 -0
  188. package/types/4sh-ui-kit-ui-select.d.ts +392 -0
  189. package/types/4sh-ui-kit-ui-separator.d.ts +43 -0
  190. package/types/4sh-ui-kit-ui-sidebar.d.ts +358 -0
  191. package/types/4sh-ui-kit-ui-skeleton.d.ts +52 -0
  192. package/types/4sh-ui-kit-ui-slider.d.ts +127 -0
  193. package/types/4sh-ui-kit-ui-spinner.d.ts +67 -0
  194. package/types/4sh-ui-kit-ui-stepper.d.ts +220 -0
  195. package/types/4sh-ui-kit-ui-table.d.ts +570 -0
  196. package/types/4sh-ui-kit-ui-tabs.d.ts +225 -0
  197. package/types/4sh-ui-kit-ui-tag.d.ts +46 -0
  198. package/types/4sh-ui-kit-ui-textarea.d.ts +61 -0
  199. package/types/4sh-ui-kit-ui-toast.d.ts +247 -0
  200. package/types/4sh-ui-kit-ui-toggle.d.ts +67 -0
  201. package/types/4sh-ui-kit-ui-tooltip.d.ts +167 -0
  202. package/types/4sh-ui-kit.d.ts +4 -0
@@ -0,0 +1,926 @@
1
+ import * as i0 from '@angular/core';
2
+ import { input, booleanAttribute, numberAttribute, output, contentChild, viewChild, viewChildren, ElementRef, signal, computed, effect, untracked, isDevMode, forwardRef, Component } from '@angular/core';
3
+ import { NgTemplateOutlet } from '@angular/common';
4
+ import { NG_VALUE_ACCESSOR } from '@angular/forms';
5
+ import * as i1 from '@angular/cdk/overlay';
6
+ import { OverlayModule } from '@angular/cdk/overlay';
7
+ import { CdkVirtualScrollViewport, ScrollingModule } from '@angular/cdk/scrolling';
8
+ import { BaseFormField, formatLabel, dropdownOverlayPositions, createOptionResolver } from '@4sh/ui-kit/forms';
9
+ import { UiField } from '@4sh/ui-kit/ui-field';
10
+ import { UiIcon } from '@4sh/ui-kit/ui-icon';
11
+ import { UiSpinner } from '@4sh/ui-kit/ui-spinner';
12
+ import { UiChip } from '@4sh/ui-kit/ui-chip';
13
+ import { UiMotion } from '@4sh/ui-kit/motion';
14
+ import { closeOnNavigation } from '@4sh/ui-kit/overlay';
15
+
16
+ /**
17
+ * ui-autocomplete — headless suggestion field built on the `ui-field` shell
18
+ * (label + box + helper) with a token-styled suggestions panel in a CDK overlay.
19
+ *
20
+ * Two-way bound via `[(ngModel)]` (or reactive forms) through
21
+ * {@link BaseFormField}. Typing emits `completeMethod` (debounced by `delay`,
22
+ * gated by `minLength`); the parent answers by updating `suggestions`. Supports
23
+ * primitive or object suggestions (`optionLabel` / `optionValue` /
24
+ * `optionDisabled`), grouped suggestions, a `dropdown` trigger
25
+ * (`dropdownMode`), a `multiple` mode (array model, removable chips in the
26
+ * field, `unique`, `maxSelectedLabels`), `forceSelection`, `showClear`,
27
+ * `loading`, configurable
28
+ * focus behaviour (`autoOptionFocus` / `selectOnFocus` / `focusOnHover`) and
29
+ * CDK virtual scrolling (plus lazy loading).
30
+ *
31
+ * The trigger is a real `<input>` following the WAI-ARIA combobox pattern
32
+ * (`role="combobox"` + `aria-activedescendant`: focus never leaves the input,
33
+ * suggestions are only visually focused).
34
+ *
35
+ * Customisation: the `#item`, `#selectedItem`, `#group`, `#header`, `#footer`
36
+ * and `#empty` templates, `panelStyleClass`, and the local SCSS variables.
37
+ *
38
+ * @example
39
+ * ```html
40
+ * <ui-autocomplete label="Pays" [(ngModel)]="country"
41
+ * [suggestions]="results()" optionLabel="name"
42
+ * (completeMethod)="search($event)" />
43
+ * ```
44
+ */
45
+ class UiAutocomplete extends BaseFormField {
46
+ constructor() {
47
+ super();
48
+ /** Suggestions to display — set by the parent in response to `completeMethod`. */
49
+ this.suggestions = input([], /* @ts-ignore */
50
+ ...(ngDevMode ? [{ debugName: "suggestions" }] : /* istanbul ignore next */ []));
51
+ /** Field name (dot-path) to read a label from, when suggestions are objects. */
52
+ this.optionLabel = input(/* @ts-ignore */
53
+ ...(ngDevMode ? [undefined, { debugName: "optionLabel" }] : /* istanbul ignore next */ []));
54
+ /** Field name (dot-path) to read the value from, when suggestions are objects. */
55
+ this.optionValue = input(/* @ts-ignore */
56
+ ...(ngDevMode ? [undefined, { debugName: "optionValue" }] : /* istanbul ignore next */ []));
57
+ /** Field name (dot-path) to read the disabled flag from, when suggestions are objects. */
58
+ this.optionDisabled = input(/* @ts-ignore */
59
+ ...(ngDevMode ? [undefined, { debugName: "optionDisabled" }] : /* istanbul ignore next */ []));
60
+ /** Property used to compare object values for equality (highlighting the current value). */
61
+ this.dataKey = input(/* @ts-ignore */
62
+ ...(ngDevMode ? [undefined, { debugName: "dataKey" }] : /* istanbul ignore next */ []));
63
+ /** Treat `suggestions` as groups (`optionGroupLabel` + `optionGroupChildren`). */
64
+ this.group = input(false, { ...(ngDevMode ? { debugName: "group" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
65
+ /** Field name of a group's label. */
66
+ this.optionGroupLabel = input('label', /* @ts-ignore */
67
+ ...(ngDevMode ? [{ debugName: "optionGroupLabel" }] : /* istanbul ignore next */ []));
68
+ /** Field name of a group's children array. */
69
+ this.optionGroupChildren = input('items', /* @ts-ignore */
70
+ ...(ngDevMode ? [{ debugName: "optionGroupChildren" }] : /* istanbul ignore next */ []));
71
+ /** Native placeholder shown when the input is empty. */
72
+ this.placeholder = input(/* @ts-ignore */
73
+ ...(ngDevMode ? [undefined, { debugName: "placeholder" }] : /* istanbul ignore next */ []));
74
+ /** Minimum number of characters before `completeMethod` is emitted while typing. */
75
+ this.minLength = input(1, { ...(ngDevMode ? { debugName: "minLength" } : /* istanbul ignore next */ {}), transform: numberAttribute });
76
+ /** Debounce (ms) between the last keystroke and `completeMethod`. */
77
+ this.delay = input(300, { ...(ngDevMode ? { debugName: "delay" } : /* istanbul ignore next */ {}), transform: numberAttribute });
78
+ /** Emit a query as soon as the input is focused (before any typing). */
79
+ this.completeOnFocus = input(false, { ...(ngDevMode ? { debugName: "completeOnFocus" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
80
+ /** Show a trigger button that queries suggestions on click. */
81
+ this.dropdown = input(false, { ...(ngDevMode ? { debugName: "dropdown" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
82
+ /** `blank` queries with an empty string, `current` with the input's current text. */
83
+ this.dropdownMode = input('blank', /* @ts-ignore */
84
+ ...(ngDevMode ? [{ debugName: "dropdownMode" }] : /* istanbul ignore next */ []));
85
+ /** Accessible name of the dropdown trigger. */
86
+ this.dropdownAriaLabel = input('Afficher les suggestions', /* @ts-ignore */
87
+ ...(ngDevMode ? [{ debugName: "dropdownAriaLabel" }] : /* istanbul ignore next */ []));
88
+ /** FontAwesome icon of the dropdown trigger. */
89
+ this.dropdownIcon = input('angle-down', /* @ts-ignore */
90
+ ...(ngDevMode ? [{ debugName: "dropdownIcon" }] : /* istanbul ignore next */ []));
91
+ /**
92
+ * Validate the typed text against the suggestions on blur: if it matches
93
+ * none, the input is cleared so the model always holds a real suggestion.
94
+ */
95
+ this.forceSelection = input(false, { ...(ngDevMode ? { debugName: "forceSelection" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
96
+ /** Multi-selection: the model is an array, each pick renders as a removable chip in the field. */
97
+ this.multiple = input(false, { ...(ngDevMode ? { debugName: "multiple" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
98
+ /** With `multiple`: ignore picks whose value is already selected (no duplicates). */
99
+ this.unique = input(true, { ...(ngDevMode ? { debugName: "unique" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
100
+ /** With `multiple`: max number of chips rendered; the rest collapses behind `overflowLabel`. */
101
+ this.maxSelectedLabels = input(/* @ts-ignore */
102
+ ...(ngDevMode ? [undefined, { debugName: "maxSelectedLabels" }] : /* istanbul ignore next */ []));
103
+ /** With `multiple`: format of the collapsed-count chip (`{0}` = hidden count). */
104
+ this.overflowLabel = input('(+{0} autres)', /* @ts-ignore */
105
+ ...(ngDevMode ? [{ debugName: "overflowLabel" }] : /* istanbul ignore next */ []));
106
+ /** With `multiple`: accessible label of each chip's remove action — `{0}` is the chip label. */
107
+ this.removeTagLabel = input('Supprimer {0}', /* @ts-ignore */
108
+ ...(ngDevMode ? [{ debugName: "removeTagLabel" }] : /* istanbul ignore next */ []));
109
+ /** Show a clear (×) action when the input holds text. */
110
+ this.showClear = input(false, { ...(ngDevMode ? { debugName: "showClear" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
111
+ /** Accessible name of the clear action. */
112
+ this.clearAriaLabel = input('Effacer la saisie', /* @ts-ignore */
113
+ ...(ngDevMode ? [{ debugName: "clearAriaLabel" }] : /* istanbul ignore next */ []));
114
+ /** Loading state: a spinner replaces the dropdown trigger while a query runs. */
115
+ this.loading = input(false, { ...(ngDevMode ? { debugName: "loading" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
116
+ /** Message shown when a query returns no suggestion. */
117
+ this.emptyMessage = input('Aucun résultat', /* @ts-ignore */
118
+ ...(ngDevMode ? [{ debugName: "emptyMessage" }] : /* istanbul ignore next */ []));
119
+ /** Render the empty-state row when there is no suggestion. */
120
+ this.showEmptyMessage = input(true, { ...(ngDevMode ? { debugName: "showEmptyMessage" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
121
+ /** Visually focus the first suggestion when the panel opens. */
122
+ this.autoOptionFocus = input(false, { ...(ngDevMode ? { debugName: "autoOptionFocus" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
123
+ /** Set the value as soon as a suggestion is visually focused with the keyboard. */
124
+ this.selectOnFocus = input(false, { ...(ngDevMode ? { debugName: "selectOnFocus" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
125
+ /** Visually focus the suggestion under the mouse pointer. */
126
+ this.focusOnHover = input(true, { ...(ngDevMode ? { debugName: "focusOnHover" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
127
+ /** Render the suggestions through a CDK virtual-scroll viewport. */
128
+ this.virtualScroll = input(false, { ...(ngDevMode ? { debugName: "virtualScroll" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
129
+ /** Fixed height (px) of one row — required by the virtual scroller. */
130
+ this.virtualScrollItemSize = input(40, { ...(ngDevMode ? { debugName: "virtualScrollItemSize" } : /* istanbul ignore next */ {}), transform: numberAttribute });
131
+ /** With `virtualScroll`: emit `lazyLoad` with the rendered range (lazy loading). */
132
+ this.lazy = input(false, { ...(ngDevMode ? { debugName: "lazy" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
133
+ /** Max height of the suggestions list (CSS size, e.g. `'320px'`). Defaults from the SCSS. */
134
+ this.scrollHeight = input(/* @ts-ignore */
135
+ ...(ngDevMode ? [undefined, { debugName: "scrollHeight" }] : /* istanbul ignore next */ []));
136
+ /**
137
+ * Auto-flip the panel above the input when there isn't enough room below
138
+ * (default). Set `false` to lock it below the input regardless of space.
139
+ */
140
+ this.autoFlip = input(true, { ...(ngDevMode ? { debugName: "autoFlip" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
141
+ /** Extra class(es) applied to the panel (scoped custom styling). */
142
+ this.panelStyleClass = input(/* @ts-ignore */
143
+ ...(ngDevMode ? [undefined, { debugName: "panelStyleClass" }] : /* istanbul ignore next */ []));
144
+ /** Emitted (debounced) when a query should be run — fill `suggestions` from it. */
145
+ this.completeMethod = output();
146
+ /** Emitted whenever the value changes (selection, typing, clear). */
147
+ this.valueChange = output();
148
+ /** Emitted when a suggestion is picked (payload is the original suggestion). */
149
+ this.optionSelect = output();
150
+ /** With `multiple`: emitted when a selected value is removed (payload is the removed suggestion). */
151
+ this.optionUnselect = output();
152
+ /** Emitted when the panel opens. */
153
+ this.opened = output();
154
+ /** Emitted when the panel closes. */
155
+ this.closed = output();
156
+ /** Emitted when the value is cleared. */
157
+ this.cleared = output();
158
+ /** Emitted when the dropdown trigger is clicked. */
159
+ this.dropdownClick = output();
160
+ /** Emitted when the virtual viewport's rendered range changes (`virtualScroll` + `lazy`). */
161
+ this.lazyLoad = output();
162
+ /** Emitted when the input receives focus. */
163
+ this.inputFocus = output();
164
+ /** Emitted when the input loses focus. */
165
+ this.inputBlur = output();
166
+ /** Custom suggestion template: `<ng-template #item let-option let-selected="selected">`. */
167
+ this.itemTemplate = contentChild('item', /* @ts-ignore */
168
+ ...(ngDevMode ? [{ debugName: "itemTemplate" }] : /* istanbul ignore next */ []));
169
+ /** Custom selected-value template (per selected value, `multiple`): `<ng-template #selectedItem let-option let-remove="remove">`. */
170
+ this.selectedItemTemplate = contentChild('selectedItem', /* @ts-ignore */
171
+ ...(ngDevMode ? [{ debugName: "selectedItemTemplate" }] : /* istanbul ignore next */ []));
172
+ /** Custom group-header template: `<ng-template #group let-group>`. */
173
+ this.groupTemplate = contentChild('group', /* @ts-ignore */
174
+ ...(ngDevMode ? [{ debugName: "groupTemplate" }] : /* istanbul ignore next */ []));
175
+ /** Free content pinned above the list. */
176
+ this.headerTemplate = contentChild('header', /* @ts-ignore */
177
+ ...(ngDevMode ? [{ debugName: "headerTemplate" }] : /* istanbul ignore next */ []));
178
+ /** Free content pinned under the list. */
179
+ this.footerTemplate = contentChild('footer', /* @ts-ignore */
180
+ ...(ngDevMode ? [{ debugName: "footerTemplate" }] : /* istanbul ignore next */ []));
181
+ /** Custom empty-state template. */
182
+ this.emptyTemplate = contentChild('empty', /* @ts-ignore */
183
+ ...(ngDevMode ? [{ debugName: "emptyTemplate" }] : /* istanbul ignore next */ []));
184
+ /** @ignore Component root (overlay origin + outside-focus detection). */
185
+ this.containerEl = viewChild.required('container', /* @ts-ignore */
186
+ ...(ngDevMode ? [{ debugName: "containerEl" }] : /* istanbul ignore next */ []));
187
+ /** @ignore Focusable input (combobox). */
188
+ this.inputEl = viewChild('inputEl', /* @ts-ignore */
189
+ ...(ngDevMode ? [{ debugName: "inputEl" }] : /* istanbul ignore next */ []));
190
+ /** @ignore Panel root element (for scrolling the focused option into view). */
191
+ this.panelEl = viewChild('panel', /* @ts-ignore */
192
+ ...(ngDevMode ? [{ debugName: "panelEl" }] : /* istanbul ignore next */ []));
193
+ /** @ignore Virtual-scroll viewport (lazy range + scrollToIndex). */
194
+ this.viewport = viewChild(CdkVirtualScrollViewport, /* @ts-ignore */
195
+ ...(ngDevMode ? [{ debugName: "viewport" }] : /* istanbul ignore next */ []));
196
+ /** @ignore Rendered chips (`multiple` mode, roving focus). */
197
+ this.tagEls = viewChildren('tagEl', { ...(ngDevMode ? { debugName: "tagEls" } : /* istanbul ignore next */ {}), read: ElementRef });
198
+ /** @ignore */
199
+ this.panelOpen = signal(false, /* @ts-ignore */
200
+ ...(ngDevMode ? [{ debugName: "panelOpen" }] : /* istanbul ignore next */ []));
201
+ /** @ignore Element the overlay is anchored to (the field box). */
202
+ this.overlayOrigin = signal(null, /* @ts-ignore */
203
+ ...(ngDevMode ? [{ debugName: "overlayOrigin" }] : /* istanbul ignore next */ []));
204
+ /** @ignore Panel width, locked to the field box width on open. */
205
+ this.overlayWidth = signal(null, /* @ts-ignore */
206
+ ...(ngDevMode ? [{ debugName: "overlayWidth" }] : /* istanbul ignore next */ []));
207
+ /** @ignore Text currently shown in the `<input>`. */
208
+ this.inputText = signal('', /* @ts-ignore */
209
+ ...(ngDevMode ? [{ debugName: "inputText" }] : /* istanbul ignore next */ []));
210
+ /** @ignore Index of the visually focused option among the visible options (-1 = none). */
211
+ this.focusedIndex = signal(-1, /* @ts-ignore */
212
+ ...(ngDevMode ? [{ debugName: "focusedIndex" }] : /* istanbul ignore next */ []));
213
+ /** @ignore Index of the chip holding the roving focus (-1 = the input, `multiple` mode). */
214
+ this.focusedTag = signal(-1, /* @ts-ignore */
215
+ ...(ngDevMode ? [{ debugName: "focusedTag" }] : /* istanbul ignore next */ []));
216
+ /** @ignore Entries recorded at pick time so chip labels survive suggestion churn (`multiple`). */
217
+ this.selectionCache = signal([], /* @ts-ignore */
218
+ ...(ngDevMode ? [{ debugName: "selectionCache" }] : /* istanbul ignore next */ []));
219
+ /** @ignore A query has been emitted and is awaiting fresh suggestions (feeds `completeOnFocus`). */
220
+ this.queryDirty = false;
221
+ /** @ignore A written value whose label could not be resolved yet (see `writeValue`). */
222
+ this.pendingLabelSync = signal(false, /* @ts-ignore */
223
+ ...(ngDevMode ? [{ debugName: "pendingLabelSync" }] : /* istanbul ignore next */ []));
224
+ // --- Derived state -----------------------------------------------------
225
+ /** @ignore */
226
+ this.listboxId = computed(() => `${this.resolvedId()}-list`, /* @ts-ignore */
227
+ ...(ngDevMode ? [{ debugName: "listboxId" }] : /* istanbul ignore next */ []));
228
+ /** @ignore Icon size aligned with the field size. */
229
+ this.iconSize = computed(() => (this.size() === 'small' ? 'sm' : 'md'), /* @ts-ignore */
230
+ ...(ngDevMode ? [{ debugName: "iconSize" }] : /* istanbul ignore next */ []));
231
+ /** @ignore Flat entries (no groups). */
232
+ this.flatEntries = computed(() => {
233
+ if (this.group())
234
+ return this.groupEntries().flatMap((g) => g.entries);
235
+ return (this.suggestions() ?? []).map((option) => this.toEntry(option));
236
+ }, /* @ts-ignore */
237
+ ...(ngDevMode ? [{ debugName: "flatEntries" }] : /* istanbul ignore next */ []));
238
+ /** @ignore Groups of entries (when `group` is enabled). */
239
+ this.groupEntries = computed(() => {
240
+ if (!this.group())
241
+ return [];
242
+ return (this.suggestions() ?? []).map((groupOption) => {
243
+ const children = this.getField(groupOption, this.optionGroupChildren());
244
+ return {
245
+ label: this.asText(this.getField(groupOption, this.optionGroupLabel())) ?? '',
246
+ original: groupOption,
247
+ entries: (Array.isArray(children) ? children : []).map((option) => this.toEntry(option)),
248
+ };
249
+ });
250
+ }, /* @ts-ignore */
251
+ ...(ngDevMode ? [{ debugName: "groupEntries" }] : /* istanbul ignore next */ []));
252
+ /** @ignore Rendered rows: suggestions + their group headers, with stable ids. */
253
+ this.visibleRows = computed(() => {
254
+ const rows = [];
255
+ let index = 0;
256
+ const pushOption = (entry) => {
257
+ rows.push({
258
+ kind: 'option',
259
+ key: `${this.listboxId()}-${index}`,
260
+ id: `${this.resolvedId()}-option-${index}`,
261
+ index,
262
+ entry,
263
+ selected: this.isValueSelected(entry.value),
264
+ });
265
+ index++;
266
+ };
267
+ if (this.group()) {
268
+ this.groupEntries().forEach((g, gi) => {
269
+ if (!g.entries.length)
270
+ return;
271
+ rows.push({ kind: 'group', key: `${this.listboxId()}-group-${gi}`, label: g.label, original: g.original });
272
+ g.entries.forEach(pushOption);
273
+ });
274
+ }
275
+ else {
276
+ this.flatEntries().forEach(pushOption);
277
+ }
278
+ return rows;
279
+ }, /* @ts-ignore */
280
+ ...(ngDevMode ? [{ debugName: "visibleRows" }] : /* istanbul ignore next */ []));
281
+ /** @ignore Visible option rows only (visual-focus space). */
282
+ this.visibleOptions = computed(() => this.visibleRows().filter((r) => r.kind === 'option'), /* @ts-ignore */
283
+ ...(ngDevMode ? [{ debugName: "visibleOptions" }] : /* istanbul ignore next */ []));
284
+ /** @ignore aria-setsize of the visible listbox. */
285
+ this.optionCount = computed(() => this.visibleOptions().length, /* @ts-ignore */
286
+ ...(ngDevMode ? [{ debugName: "optionCount" }] : /* istanbul ignore next */ []));
287
+ /** @ignore trackBy of the virtual list. */
288
+ this.trackRow = (_, row) => row.key;
289
+ /** @ignore The input holds text. */
290
+ this.hasText = computed(() => this.inputText().length > 0, /* @ts-ignore */
291
+ ...(ngDevMode ? [{ debugName: "hasText" }] : /* istanbul ignore next */ []));
292
+ /** @ignore The clear action is shown. */
293
+ this.showClearButton = computed(() => this.showClear() &&
294
+ (this.hasText() || (this.multiple() && this.selectedValues().length > 0)) &&
295
+ !this.isDisabled() &&
296
+ !this.readonly(), /* @ts-ignore */
297
+ ...(ngDevMode ? [{ debugName: "showClearButton" }] : /* istanbul ignore next */ []));
298
+ /** @ignore Selected values in `multiple` mode (always an array). */
299
+ this.selectedValues = computed(() => {
300
+ if (!this.multiple())
301
+ return [];
302
+ const v = this.modelValue();
303
+ return Array.isArray(v) ? v : [];
304
+ }, /* @ts-ignore */
305
+ ...(ngDevMode ? [{ debugName: "selectedValues" }] : /* istanbul ignore next */ []));
306
+ /** @ignore One row per selected value (label resolved from the pick-time cache first). */
307
+ this.tagRows = computed(() => this.selectedValues().map((value, index) => {
308
+ const label = this.labelOfSelected(value);
309
+ return { value, index, label, removeAriaLabel: formatLabel(this.removeTagLabel(), label) };
310
+ }), /* @ts-ignore */
311
+ ...(ngDevMode ? [{ debugName: "tagRows" }] : /* istanbul ignore next */ []));
312
+ /** @ignore Rows actually rendered as chips (`maxSelectedLabels` cap). */
313
+ this.visibleTagRows = computed(() => {
314
+ const all = this.tagRows();
315
+ const max = this.maxSelectedLabels();
316
+ return max != null && max > 0 && all.length > max ? all.slice(0, max) : all;
317
+ }, /* @ts-ignore */
318
+ ...(ngDevMode ? [{ debugName: "visibleTagRows" }] : /* istanbul ignore next */ []));
319
+ /** @ignore Number of selected values collapsed behind the overflow chip. */
320
+ this.overflowCount = computed(() => this.tagRows().length - this.visibleTagRows().length, /* @ts-ignore */
321
+ ...(ngDevMode ? [{ debugName: "overflowCount" }] : /* istanbul ignore next */ []));
322
+ /** @ignore Rendered overflow chip label (e.g. `(+2 autres)`). */
323
+ this.overflowText = computed(() => formatLabel(this.overflowLabel(), this.overflowCount()), /* @ts-ignore */
324
+ ...(ngDevMode ? [{ debugName: "overflowText" }] : /* istanbul ignore next */ []));
325
+ /** @ignore Contexts handed to the `#selectedItem` template (one per displayed value). */
326
+ this.selectedItemContexts = computed(() => this.visibleTagRows().map((tag) => ({
327
+ $implicit: this.originalOfSelected(tag.value),
328
+ option: this.originalOfSelected(tag.value),
329
+ index: tag.index,
330
+ remove: () => this.removeAt(tag.index),
331
+ })), /* @ts-ignore */
332
+ ...(ngDevMode ? [{ debugName: "selectedItemContexts" }] : /* istanbul ignore next */ []));
333
+ /** @ignore Placeholder hidden as soon as values are selected (`multiple`). */
334
+ this.effectivePlaceholder = computed(() => this.multiple() && this.selectedValues().length ? '' : (this.placeholder() ?? ''), /* @ts-ignore */
335
+ ...(ngDevMode ? [{ debugName: "effectivePlaceholder" }] : /* istanbul ignore next */ []));
336
+ /** @ignore Chips are removable unless the field is disabled/readonly. */
337
+ this.canRemove = computed(() => !this.isDisabled() && !this.readonly(), /* @ts-ignore */
338
+ ...(ngDevMode ? [{ debugName: "canRemove" }] : /* istanbul ignore next */ []));
339
+ /** @ignore The empty-state row is rendered. */
340
+ this.showEmpty = computed(() => this.showEmptyMessage() && !this.loading() && !this.visibleRows().length, /* @ts-ignore */
341
+ ...(ngDevMode ? [{ debugName: "showEmpty" }] : /* istanbul ignore next */ []));
342
+ /** @ignore id of the visually focused option (for aria-activedescendant). */
343
+ this.activeDescendant = computed(() => {
344
+ if (!this.panelOpen())
345
+ return null;
346
+ return this.visibleOptions()[this.focusedIndex()]?.id ?? null;
347
+ }, /* @ts-ignore */
348
+ ...(ngDevMode ? [{ debugName: "activeDescendant" }] : /* istanbul ignore next */ []));
349
+ /** @ignore Below the input, flipping above when `autoFlip` and space is lacking. */
350
+ this.overlayPositions = computed(() => dropdownOverlayPositions(this.autoFlip()), /* @ts-ignore */
351
+ ...(ngDevMode ? [{ debugName: "overlayPositions" }] : /* istanbul ignore next */ []));
352
+ /** @ignore Concrete viewport height (px) for the virtual scroller. */
353
+ this.viewportHeight = computed(() => {
354
+ const rows = this.visibleRows().length || 1;
355
+ const max = this.scrollHeightPx();
356
+ return `${Math.min(rows * this.virtualScrollItemSize(), max)}px`;
357
+ }, /* @ts-ignore */
358
+ ...(ngDevMode ? [{ debugName: "viewportHeight" }] : /* istanbul ignore next */ []));
359
+ /** @ignore `scrollHeight` parsed to px, with size-based defaults (matches the SCSS). */
360
+ this.scrollHeightPx = computed(() => {
361
+ const parsed = Number.parseFloat(this.scrollHeight() ?? '');
362
+ if (!Number.isNaN(parsed) && parsed > 0)
363
+ return parsed;
364
+ return this.size() === 'small' ? 256 : 312;
365
+ }, /* @ts-ignore */
366
+ ...(ngDevMode ? [{ debugName: "scrollHeightPx" }] : /* istanbul ignore next */ []));
367
+ /** @ignore Shared option resolution (see `option-resolver.ts`). */
368
+ this.resolver = createOptionResolver({
369
+ optionValue: this.optionValue,
370
+ optionLabel: this.optionLabel,
371
+ optionDisabled: this.optionDisabled,
372
+ dataKey: this.dataKey,
373
+ });
374
+ // Never carry an open panel over to the next page (the field can live in
375
+ // an app shell that survives the navigation).
376
+ closeOnNavigation(() => this.close(false));
377
+ // Late label resolution: a value written before suggestions exist (e.g. a
378
+ // pre-filled form using `optionValue`) displays the raw value; swap in the
379
+ // real label once a matching suggestion arrives.
380
+ effect(() => {
381
+ const entry = this.pendingLabelSync() ? this.entryOfValue(untracked(this.modelValue) ?? null) : undefined;
382
+ if (!entry)
383
+ return;
384
+ untracked(() => {
385
+ this.pendingLabelSync.set(false);
386
+ this.inputText.set(entry.label);
387
+ });
388
+ });
389
+ // Forward the rendered range of the virtual viewport (lazy loading).
390
+ effect((onCleanup) => {
391
+ const vp = this.viewport();
392
+ if (!vp || !this.lazy())
393
+ return;
394
+ const sub = vp.renderedRangeStream.subscribe((range) => this.lazyLoad.emit({ first: range.start, last: range.end }));
395
+ onCleanup(() => sub.unsubscribe());
396
+ });
397
+ // Re-measure the virtual viewport once it exists: it initialises while the
398
+ // overlay panel is still laying out and can capture a 0 viewport size,
399
+ // which freezes the rendered range on the first rows.
400
+ effect(() => {
401
+ const vp = this.viewport();
402
+ if (!vp)
403
+ return;
404
+ setTimeout(() => {
405
+ vp.checkViewportSize();
406
+ this.scrollFocusedIntoView();
407
+ });
408
+ });
409
+ // A11y / API safeguards (dev only).
410
+ if (isDevMode()) {
411
+ effect(() => {
412
+ if (!this.label() && !this.ariaLabel() && !this.ariaLabelledBy()) {
413
+ console.warn('[ui-autocomplete] Field has no accessible name: provide `label`, `ariaLabel` or `ariaLabelledBy`.');
414
+ }
415
+ });
416
+ }
417
+ }
418
+ // --- CVA -----------------------------------------------------------------
419
+ writeValue(value) {
420
+ if (this.multiple()) {
421
+ const values = Array.isArray(value) ? value : [];
422
+ this.modelValue.set(values);
423
+ this.inputText.set('');
424
+ this.seedSelectionCache(values);
425
+ return;
426
+ }
427
+ this.modelValue.set(value);
428
+ this.inputText.set(this.labelOfValue(value));
429
+ // With `optionValue`, the label may be unresolvable until the parent
430
+ // provides suggestions — remember to re-resolve it later.
431
+ this.pendingLabelSync.set(value !== null && value !== undefined && this.entryOfValue(value) === undefined);
432
+ }
433
+ /** @ignore Best-effort label seed for values written from the form, from the current suggestions. */
434
+ seedSelectionCache(values) {
435
+ const cache = this.selectionCache();
436
+ const entries = this.flatEntries();
437
+ const found = values
438
+ .filter((v) => !cache.some((e) => this.equals(e.value, v)))
439
+ .map((v) => entries.find((e) => this.equals(e.value, v)))
440
+ .filter((e) => !!e);
441
+ if (found.length)
442
+ this.selectionCache.set([...cache, ...found]);
443
+ }
444
+ /** Moves focus to the input. */
445
+ focus(options) {
446
+ this.inputEl()?.nativeElement.focus(options);
447
+ }
448
+ // --- Panel open/close ----------------------------------------------------
449
+ /** @ignore */
450
+ open() {
451
+ if (this.isDisabled() || this.readonly() || this.panelOpen())
452
+ return;
453
+ const origin = this.containerEl().nativeElement.querySelector('.ui-field-box') ?? this.containerEl().nativeElement;
454
+ this.overlayOrigin.set(origin);
455
+ this.overlayWidth.set(origin.getBoundingClientRect().width);
456
+ this.focusedIndex.set(this.initialFocusIndex());
457
+ this.panelOpen.set(true);
458
+ this.opened.emit();
459
+ // Scroll the focused option into view once the overlay is attached.
460
+ // `setTimeout` (not rAF) so it also runs in throttled/background tabs.
461
+ setTimeout(() => this.scrollFocusedIntoView());
462
+ }
463
+ /** @ignore */
464
+ close(focusInput = true) {
465
+ if (!this.panelOpen())
466
+ return;
467
+ this.panelOpen.set(false);
468
+ this.focusedIndex.set(-1);
469
+ this.queryDirty = false;
470
+ this.closed.emit();
471
+ if (focusInput)
472
+ this.focus();
473
+ }
474
+ /** @ignore First visually focused option when the panel opens. */
475
+ initialFocusIndex() {
476
+ if (!this.autoOptionFocus())
477
+ return -1;
478
+ return this.visibleOptions().findIndex((o) => !o.entry.disabled);
479
+ }
480
+ // --- Input interactions --------------------------------------------------
481
+ /** @ignore Typing: view → form (free text unless `forceSelection`) + debounced query. */
482
+ onInput(event) {
483
+ const query = event.target.value;
484
+ this.inputText.set(query);
485
+ // The user took over the text: stop any pending label re-resolution.
486
+ this.pendingLabelSync.set(false);
487
+ // Free-text value while typing; `forceSelection` waits for a real suggestion,
488
+ // `multiple` never lets the query mutate the selection, and an emptied input
489
+ // commits `null` (same normalization as `clear()`).
490
+ if (!this.forceSelection() && !this.multiple())
491
+ this.commit(query === '' ? null : query);
492
+ if (this.searchTimeout)
493
+ clearTimeout(this.searchTimeout);
494
+ if (query.length === 0) {
495
+ if (!this.multiple())
496
+ this.cleared.emit();
497
+ this.close(false);
498
+ return;
499
+ }
500
+ if (query.length < this.minLength()) {
501
+ this.close(false);
502
+ return;
503
+ }
504
+ this.focusedIndex.set(-1);
505
+ this.searchTimeout = setTimeout(() => this.runSearch(event, query), this.delay());
506
+ }
507
+ /** @ignore Emit a query and open the panel. */
508
+ runSearch(event, query) {
509
+ this.queryDirty = true;
510
+ this.completeMethod.emit({ originalEvent: event, query });
511
+ this.open();
512
+ }
513
+ /** @ignore */
514
+ onDropdownClick(event) {
515
+ if (this.isDisabled() || this.readonly())
516
+ return;
517
+ if (this.panelOpen()) {
518
+ this.close();
519
+ return;
520
+ }
521
+ // Mark the query as already handled *before* focusing: `focus()` fires a
522
+ // synchronous `focus` event on the input, and `completeOnFocus` would
523
+ // otherwise run its own `completeMethod` in addition to the one below —
524
+ // a single dropdown click must only ever emit one query.
525
+ this.queryDirty = true;
526
+ this.focus();
527
+ const query = this.inputText();
528
+ this.runSearch(event, this.dropdownMode() === 'current' ? query : '');
529
+ this.dropdownClick.emit({ originalEvent: event, query });
530
+ }
531
+ /** @ignore */
532
+ onInputFocus(event) {
533
+ if (this.isDisabled())
534
+ return;
535
+ if (!this.queryDirty && this.completeOnFocus())
536
+ this.runSearch(event, this.inputText());
537
+ this.inputFocus.emit(event);
538
+ }
539
+ /** @ignore Mark touched + `forceSelection` validation when focus leaves the component. */
540
+ onInputBlur(event) {
541
+ const next = event.relatedTarget;
542
+ const insideComponent = !!next && this.containerEl().nativeElement.contains(next);
543
+ const insidePanel = !!next && this.panelEl()?.nativeElement.contains(next);
544
+ if (!insideComponent && !insidePanel) {
545
+ this.emitTouch();
546
+ if (this.forceSelection())
547
+ this.validateForceSelection(event);
548
+ }
549
+ this.inputBlur.emit(event);
550
+ }
551
+ /**
552
+ * @ignore `forceSelection`: keep the model in sync with a real suggestion.
553
+ * The text is matched (case/diacritics-insensitive) against a known label;
554
+ * on no match the field is reset so the model never holds free text.
555
+ */
556
+ validateForceSelection(event) {
557
+ const text = this.inputText().trim();
558
+ if (!text)
559
+ return;
560
+ const match = this.flatEntries().find((e) => !e.disabled && this.normalize(e.label) === this.normalize(text));
561
+ if (match) {
562
+ this.selectEntry(match, event, false);
563
+ }
564
+ else if (this.multiple()) {
565
+ // Never commit over the selection: just drop the invalid query.
566
+ this.inputText.set('');
567
+ }
568
+ else {
569
+ this.commit(null);
570
+ this.inputText.set('');
571
+ this.cleared.emit();
572
+ }
573
+ }
574
+ /** @ignore Clear action (does not bubble to the input). */
575
+ onClearClick(event) {
576
+ event.stopPropagation();
577
+ this.clear();
578
+ }
579
+ /** Clears the value. */
580
+ clear() {
581
+ if (this.multiple()) {
582
+ this.commit([]);
583
+ this.selectionCache.set([]);
584
+ }
585
+ else {
586
+ this.commit(null);
587
+ }
588
+ this.inputText.set('');
589
+ this.cleared.emit();
590
+ this.close(false);
591
+ this.focus();
592
+ }
593
+ // --- Keyboard --------------------------------------------------------------
594
+ /** @ignore Keyboard on the input (combobox pattern). */
595
+ onInputKeydown(event) {
596
+ if (this.isDisabled() || this.readonly())
597
+ return;
598
+ if (this.multiple() && this.selectedValues().length) {
599
+ const input = event.target;
600
+ if (event.key === 'Backspace' && !this.inputText()) {
601
+ this.removeAt(this.selectedValues().length - 1);
602
+ return;
603
+ }
604
+ if (event.key === 'ArrowLeft' &&
605
+ !this.selectedItemTemplate() &&
606
+ input.selectionStart === 0 &&
607
+ input.selectionEnd === 0) {
608
+ event.preventDefault();
609
+ this.focusTag(this.visibleTagRows().length - 1);
610
+ return;
611
+ }
612
+ }
613
+ switch (event.key) {
614
+ case 'ArrowDown':
615
+ event.preventDefault();
616
+ this.panelOpen() ? this.moveFocus(1) : this.reopen();
617
+ return;
618
+ case 'ArrowUp':
619
+ event.preventDefault();
620
+ if (event.altKey)
621
+ this.close();
622
+ else if (this.panelOpen())
623
+ this.moveFocus(-1);
624
+ else
625
+ this.reopen();
626
+ return;
627
+ case 'Home':
628
+ if (!this.panelOpen())
629
+ return;
630
+ event.preventDefault();
631
+ this.focusEdge(1);
632
+ return;
633
+ case 'End':
634
+ if (!this.panelOpen())
635
+ return;
636
+ event.preventDefault();
637
+ this.focusEdge(-1);
638
+ return;
639
+ case 'Enter':
640
+ if (!this.panelOpen())
641
+ return; // closed: native form submit
642
+ event.preventDefault();
643
+ this.selectFocused(event);
644
+ return;
645
+ case 'Escape':
646
+ if (!this.panelOpen())
647
+ return;
648
+ event.preventDefault();
649
+ event.stopPropagation();
650
+ this.close();
651
+ return;
652
+ case 'Tab':
653
+ if (this.panelOpen())
654
+ this.close(false);
655
+ return; // let the focus move on
656
+ default:
657
+ return;
658
+ }
659
+ }
660
+ /** @ignore Re-open the panel with the current suggestions (no re-query). */
661
+ reopen() {
662
+ if (!this.visibleRows().length)
663
+ return;
664
+ this.open();
665
+ if (this.focusedIndex() === -1)
666
+ this.moveFocus(1);
667
+ }
668
+ // --- Options interactions --------------------------------------------------
669
+ /** @ignore */
670
+ onOptionClick(row, event) {
671
+ event.preventDefault();
672
+ this.selectEntry(row.entry, event);
673
+ }
674
+ /** @ignore Keep the focus on the input when clicking an option. */
675
+ onOptionMousedown(event) {
676
+ event.preventDefault();
677
+ }
678
+ /** @ignore */
679
+ onOptionMouseEnter(row) {
680
+ if (this.focusOnHover() && !row.entry.disabled)
681
+ this.focusedIndex.set(row.index);
682
+ }
683
+ /** @ignore Pick a suggestion: set the value + display its label. */
684
+ selectEntry(entry, event, closePanel = true) {
685
+ if (entry.disabled || this.readonly())
686
+ return;
687
+ if (this.multiple()) {
688
+ const alreadySelected = this.selectedValues().some((v) => this.equals(v, entry.value));
689
+ if (!(this.unique() && alreadySelected)) {
690
+ this.selectionCache.update((cache) => [...cache, entry]);
691
+ this.commit([...this.selectedValues(), entry.value]);
692
+ this.optionSelect.emit(entry.original);
693
+ }
694
+ // The query was just consumed: an open panel would show results for a
695
+ // text the input no longer displays.
696
+ this.inputText.set('');
697
+ if (closePanel)
698
+ this.close();
699
+ return;
700
+ }
701
+ this.commit(entry.value);
702
+ this.inputText.set(entry.label);
703
+ this.optionSelect.emit(entry.original);
704
+ if (closePanel)
705
+ this.close();
706
+ }
707
+ /** @ignore */
708
+ selectFocused(event) {
709
+ const row = this.visibleOptions()[this.focusedIndex()];
710
+ if (row)
711
+ this.selectEntry(row.entry, event);
712
+ else
713
+ this.close();
714
+ }
715
+ /** @ignore Propagate a user-driven value change (view → form). */
716
+ commit(value) {
717
+ this.pendingLabelSync.set(false);
718
+ this.modelValue.set(value);
719
+ this.emitChange(value);
720
+ this.valueChange.emit(value);
721
+ }
722
+ // --- Visual focus ------------------------------------------------------------
723
+ /** @ignore Move the visual focus, skipping disabled options (no wrap). */
724
+ moveFocus(delta) {
725
+ const options = this.visibleOptions();
726
+ if (!options.length)
727
+ return;
728
+ let i = this.focusedIndex();
729
+ if (i === -1)
730
+ i = delta === 1 ? -1 : options.length;
731
+ for (i += delta; i >= 0 && i < options.length; i += delta) {
732
+ if (!options[i].entry.disabled) {
733
+ this.setFocusedIndex(i, null);
734
+ return;
735
+ }
736
+ }
737
+ }
738
+ /** @ignore Focus the first (`1`) or last (`-1`) enabled option. */
739
+ focusEdge(direction) {
740
+ const options = this.visibleOptions();
741
+ const from = direction === 1 ? 0 : options.length - 1;
742
+ for (let i = from; i >= 0 && i < options.length; i += direction) {
743
+ if (!options[i].entry.disabled) {
744
+ this.setFocusedIndex(i, null);
745
+ return;
746
+ }
747
+ }
748
+ }
749
+ /** @ignore Apply a visual-focus move (+ select-on-focus, + scroll into view). */
750
+ setFocusedIndex(index, event) {
751
+ this.focusedIndex.set(index);
752
+ if (this.selectOnFocus()) {
753
+ const row = this.visibleOptions()[index];
754
+ if (row)
755
+ this.selectEntry(row.entry, event ?? new Event('keydown'), false);
756
+ }
757
+ this.scrollFocusedIntoView();
758
+ }
759
+ /** @ignore Keep the visually focused option visible ('auto' — smooth is unreliable in throttled tabs). */
760
+ scrollFocusedIntoView() {
761
+ const row = this.visibleOptions()[this.focusedIndex()];
762
+ if (!row)
763
+ return;
764
+ const vp = this.viewport();
765
+ if (vp) {
766
+ const rowIndex = this.visibleRows().findIndex((r) => r.kind === 'option' && r.index === row.index);
767
+ if (rowIndex !== -1)
768
+ vp.scrollToIndex(Math.max(0, rowIndex - 1), 'auto');
769
+ return;
770
+ }
771
+ this.panelEl()
772
+ ?.nativeElement.querySelector(`[id="${row.id}"]`)
773
+ ?.scrollIntoView({ block: 'nearest' });
774
+ }
775
+ // --- Option resolution ----------------------------------------------------------
776
+ /** @ignore Label displayed for a model value (best-effort against the suggestions). */
777
+ /** Remove the selected value at `index` (`multiple` mode). */
778
+ removeAt(index) {
779
+ if (this.isDisabled() || this.readonly())
780
+ return;
781
+ const values = this.selectedValues();
782
+ if (index < 0 || index >= values.length)
783
+ return;
784
+ const value = values[index];
785
+ const cached = this.selectionCache().find((e) => this.equals(e.value, value));
786
+ this.commit(values.filter((_, i) => i !== index));
787
+ this.selectionCache.update((cache) => cache.filter((e) => !this.equals(e.value, value)));
788
+ this.optionUnselect.emit((cached?.original ?? value));
789
+ // Keep the roving focus coherent after removal.
790
+ const remaining = this.visibleTagRows().length;
791
+ if (remaining === 0)
792
+ this.focusInput();
793
+ else
794
+ this.focusTag(Math.min(index, remaining - 1));
795
+ }
796
+ /** @ignore Roving keyboard on a chip (`multiple` mode). */
797
+ onTagKeydown(event, index) {
798
+ if (this.isDisabled() || this.readonly())
799
+ return;
800
+ switch (event.key) {
801
+ case 'ArrowLeft':
802
+ event.preventDefault();
803
+ if (index > 0)
804
+ this.focusTag(index - 1);
805
+ return;
806
+ case 'ArrowRight':
807
+ event.preventDefault();
808
+ if (index < this.visibleTagRows().length - 1)
809
+ this.focusTag(index + 1);
810
+ else
811
+ this.focusInput();
812
+ return;
813
+ case 'Backspace':
814
+ case 'Delete':
815
+ event.preventDefault();
816
+ this.removeAt(index);
817
+ return;
818
+ case 'Home':
819
+ event.preventDefault();
820
+ this.focusTag(0);
821
+ return;
822
+ case 'End':
823
+ event.preventDefault();
824
+ this.focusTag(this.visibleTagRows().length - 1);
825
+ return;
826
+ default:
827
+ return;
828
+ }
829
+ }
830
+ /** @ignore Clicking the box's empty area focuses the input. */
831
+ onBoxMousedown(event) {
832
+ const target = event.target;
833
+ if (target.closest('button') || target.closest('.ui-autocomplete-tag') || target.closest('input'))
834
+ return;
835
+ event.preventDefault();
836
+ this.focusInput();
837
+ }
838
+ /** @ignore Move the roving focus onto a chip. */
839
+ focusTag(index) {
840
+ this.focusedTag.set(index);
841
+ setTimeout(() => this.tagEls()[index]?.nativeElement.focus());
842
+ }
843
+ /** @ignore Return the roving focus to the input. */
844
+ focusInput() {
845
+ this.focusedTag.set(-1);
846
+ this.focus();
847
+ }
848
+ /** @ignore Label of a selected value: pick-time cache first, then the current suggestions. */
849
+ labelOfSelected(value) {
850
+ const cached = this.selectionCache().find((e) => this.equals(e.value, value));
851
+ return cached ? cached.label : this.labelOfValue(value);
852
+ }
853
+ /** @ignore Original suggestion of a selected value (pick-time cache first, else the raw value). */
854
+ originalOfSelected(value) {
855
+ return this.selectionCache().find((e) => this.equals(e.value, value))?.original ?? value;
856
+ }
857
+ labelOfValue(value) {
858
+ if (value === null || value === undefined)
859
+ return '';
860
+ const entry = this.entryOfValue(value);
861
+ if (entry)
862
+ return entry.label;
863
+ return this.resolveLabel(value) ?? this.asText(value) ?? '';
864
+ }
865
+ /** @ignore Suggestion entry matching a model value, if currently known. */
866
+ entryOfValue(value) {
867
+ if (value === null || value === undefined)
868
+ return undefined;
869
+ return this.flatEntries().find((e) => this.equals(e.value, value));
870
+ }
871
+ /** @ignore */
872
+ toEntry(option) {
873
+ return this.resolver.toEntry(option);
874
+ }
875
+ /** @ignore Read a (dot-path) field from an object. */
876
+ getField(target, path) {
877
+ return this.resolver.getField(target, path);
878
+ }
879
+ /** @ignore */
880
+ resolveValue(option) {
881
+ return this.resolver.resolveValue(option);
882
+ }
883
+ /** @ignore */
884
+ resolveLabel(option) {
885
+ return this.resolver.resolveLabel(option);
886
+ }
887
+ /** @ignore */
888
+ asText(value) {
889
+ return this.resolver.asText(value);
890
+ }
891
+ /** @ignore Whether a resolved value is the current model value. */
892
+ isValueSelected(value) {
893
+ if (this.multiple())
894
+ return this.selectedValues().some((v) => this.equals(v, value));
895
+ const current = this.modelValue();
896
+ return current !== null && current !== undefined && this.equals(current, value);
897
+ }
898
+ /** @ignore Value equality — by `dataKey` for objects, strict otherwise. */
899
+ equals(a, b) {
900
+ return this.resolver.equals(a, b);
901
+ }
902
+ /** @ignore Case- and diacritics-insensitive comparison text. */
903
+ normalize(text) {
904
+ return text
905
+ .toLowerCase()
906
+ .normalize('NFD')
907
+ .replace(/[̀-ͯ]/g, '');
908
+ }
909
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: UiAutocomplete, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
910
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: UiAutocomplete, isStandalone: true, selector: "ui-autocomplete", inputs: { suggestions: { classPropertyName: "suggestions", publicName: "suggestions", isSignal: true, isRequired: false, transformFunction: null }, optionLabel: { classPropertyName: "optionLabel", publicName: "optionLabel", isSignal: true, isRequired: false, transformFunction: null }, optionValue: { classPropertyName: "optionValue", publicName: "optionValue", isSignal: true, isRequired: false, transformFunction: null }, optionDisabled: { classPropertyName: "optionDisabled", publicName: "optionDisabled", isSignal: true, isRequired: false, transformFunction: null }, dataKey: { classPropertyName: "dataKey", publicName: "dataKey", isSignal: true, isRequired: false, transformFunction: null }, group: { classPropertyName: "group", publicName: "group", isSignal: true, isRequired: false, transformFunction: null }, optionGroupLabel: { classPropertyName: "optionGroupLabel", publicName: "optionGroupLabel", isSignal: true, isRequired: false, transformFunction: null }, optionGroupChildren: { classPropertyName: "optionGroupChildren", publicName: "optionGroupChildren", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, minLength: { classPropertyName: "minLength", publicName: "minLength", isSignal: true, isRequired: false, transformFunction: null }, delay: { classPropertyName: "delay", publicName: "delay", isSignal: true, isRequired: false, transformFunction: null }, completeOnFocus: { classPropertyName: "completeOnFocus", publicName: "completeOnFocus", isSignal: true, isRequired: false, transformFunction: null }, dropdown: { classPropertyName: "dropdown", publicName: "dropdown", isSignal: true, isRequired: false, transformFunction: null }, dropdownMode: { classPropertyName: "dropdownMode", publicName: "dropdownMode", isSignal: true, isRequired: false, transformFunction: null }, dropdownAriaLabel: { classPropertyName: "dropdownAriaLabel", publicName: "dropdownAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, dropdownIcon: { classPropertyName: "dropdownIcon", publicName: "dropdownIcon", isSignal: true, isRequired: false, transformFunction: null }, forceSelection: { classPropertyName: "forceSelection", publicName: "forceSelection", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, unique: { classPropertyName: "unique", publicName: "unique", isSignal: true, isRequired: false, transformFunction: null }, maxSelectedLabels: { classPropertyName: "maxSelectedLabels", publicName: "maxSelectedLabels", isSignal: true, isRequired: false, transformFunction: null }, overflowLabel: { classPropertyName: "overflowLabel", publicName: "overflowLabel", isSignal: true, isRequired: false, transformFunction: null }, removeTagLabel: { classPropertyName: "removeTagLabel", publicName: "removeTagLabel", isSignal: true, isRequired: false, transformFunction: null }, showClear: { classPropertyName: "showClear", publicName: "showClear", isSignal: true, isRequired: false, transformFunction: null }, clearAriaLabel: { classPropertyName: "clearAriaLabel", publicName: "clearAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, emptyMessage: { classPropertyName: "emptyMessage", publicName: "emptyMessage", isSignal: true, isRequired: false, transformFunction: null }, showEmptyMessage: { classPropertyName: "showEmptyMessage", publicName: "showEmptyMessage", isSignal: true, isRequired: false, transformFunction: null }, autoOptionFocus: { classPropertyName: "autoOptionFocus", publicName: "autoOptionFocus", isSignal: true, isRequired: false, transformFunction: null }, selectOnFocus: { classPropertyName: "selectOnFocus", publicName: "selectOnFocus", isSignal: true, isRequired: false, transformFunction: null }, focusOnHover: { classPropertyName: "focusOnHover", publicName: "focusOnHover", isSignal: true, isRequired: false, transformFunction: null }, virtualScroll: { classPropertyName: "virtualScroll", publicName: "virtualScroll", isSignal: true, isRequired: false, transformFunction: null }, virtualScrollItemSize: { classPropertyName: "virtualScrollItemSize", publicName: "virtualScrollItemSize", isSignal: true, isRequired: false, transformFunction: null }, lazy: { classPropertyName: "lazy", publicName: "lazy", isSignal: true, isRequired: false, transformFunction: null }, scrollHeight: { classPropertyName: "scrollHeight", publicName: "scrollHeight", isSignal: true, isRequired: false, transformFunction: null }, autoFlip: { classPropertyName: "autoFlip", publicName: "autoFlip", isSignal: true, isRequired: false, transformFunction: null }, panelStyleClass: { classPropertyName: "panelStyleClass", publicName: "panelStyleClass", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { completeMethod: "completeMethod", valueChange: "valueChange", optionSelect: "optionSelect", optionUnselect: "optionUnselect", opened: "opened", closed: "closed", cleared: "cleared", dropdownClick: "dropdownClick", lazyLoad: "lazyLoad", inputFocus: "inputFocus", inputBlur: "inputBlur" }, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => UiAutocomplete), multi: true }], queries: [{ propertyName: "itemTemplate", first: true, predicate: ["item"], descendants: true, isSignal: true }, { propertyName: "selectedItemTemplate", first: true, predicate: ["selectedItem"], descendants: true, isSignal: true }, { propertyName: "groupTemplate", first: true, predicate: ["group"], descendants: true, isSignal: true }, { propertyName: "headerTemplate", first: true, predicate: ["header"], descendants: true, isSignal: true }, { propertyName: "footerTemplate", first: true, predicate: ["footer"], descendants: true, isSignal: true }, { propertyName: "emptyTemplate", first: true, predicate: ["empty"], descendants: true, isSignal: true }], viewQueries: [{ propertyName: "containerEl", first: true, predicate: ["container"], descendants: true, isSignal: true }, { propertyName: "inputEl", first: true, predicate: ["inputEl"], descendants: true, isSignal: true }, { propertyName: "panelEl", first: true, predicate: ["panel"], descendants: true, isSignal: true }, { propertyName: "viewport", first: true, predicate: CdkVirtualScrollViewport, descendants: true, isSignal: true }, { propertyName: "tagEls", predicate: ["tagEl"], descendants: true, read: ElementRef, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<!-- One rendered row: group header or suggestion (shared by the plain and virtual lists). -->\n<ng-template #rowTpl let-row>\n @if (row.kind === 'group') {\n <li class=\"ui-autocomplete-group\" role=\"presentation\" [class._small]=\"size() === 'small'\">\n @if (groupTemplate(); as tpl) {\n <ng-container [ngTemplateOutlet]=\"tpl\" [ngTemplateOutletContext]=\"{ $implicit: row.original, group: row.original }\" />\n } @else {\n {{ row.label }}\n }\n </li>\n } @else {\n <!-- ARIA combobox/listbox pattern: keyboard and focus are handled by\n the input role=\"combobox\" (roving via aria-activedescendant). -->\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\n <li\n class=\"ui-autocomplete-option\"\n role=\"option\"\n [attr.id]=\"row.id\"\n [class._small]=\"size() === 'small'\"\n [class._selected]=\"row.selected\"\n [class._focused]=\"row.index === focusedIndex()\"\n [class._disabled]=\"row.entry.disabled\"\n [attr.aria-selected]=\"row.selected\"\n [attr.aria-disabled]=\"row.entry.disabled || null\"\n [attr.aria-setsize]=\"optionCount()\"\n [attr.aria-posinset]=\"row.index + 1\"\n (mousedown)=\"onOptionMousedown($event)\"\n (click)=\"onOptionClick(row, $event)\"\n (mouseenter)=\"onOptionMouseEnter(row)\"\n >\n @if (itemTemplate(); as tpl) {\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"{ $implicit: row.entry.original, option: row.entry.original, selected: row.selected, index: row.index }\"\n />\n } @else {\n <span class=\"ui-autocomplete-option-label\">{{ row.entry.label }}</span>\n }\n </li>\n }\n</ng-template>\n\n<!-- Suggestions panel (CDK overlay). -->\n<ng-template #panelTpl>\n <div\n #panel\n class=\"ui-autocomplete-panel\"\n [class]=\"panelStyleClass()\"\n [class._small]=\"size() === 'small'\"\n [style.width.px]=\"overlayWidth()\"\n [uiMotion]=\"'slide-down'\"\n #panelMotion=\"uiMotion\"\n motionOnInsert\n >\n @if (headerTemplate(); as tpl) {\n <div class=\"ui-autocomplete-header\">\n <ng-container [ngTemplateOutlet]=\"tpl\" />\n </div>\n }\n\n @if (virtualScroll()) {\n <cdk-virtual-scroll-viewport\n class=\"ui-autocomplete-viewport\"\n [itemSize]=\"virtualScrollItemSize()\"\n [style.height]=\"viewportHeight()\"\n >\n <ul\n class=\"ui-autocomplete-list\"\n role=\"listbox\"\n [attr.aria-multiselectable]=\"multiple() ? 'true' : null\"\n [attr.id]=\"listboxId()\"\n [attr.aria-label]=\"label() || ariaLabel() || null\"\n >\n <ng-container *cdkVirtualFor=\"let row of visibleRows(); trackBy: trackRow\">\n <ng-container [ngTemplateOutlet]=\"rowTpl\" [ngTemplateOutletContext]=\"{ $implicit: row }\" />\n </ng-container>\n @if (showEmpty()) {\n <ng-container [ngTemplateOutlet]=\"emptyTpl\" />\n }\n </ul>\n </cdk-virtual-scroll-viewport>\n } @else {\n <div class=\"ui-autocomplete-scroller\" [class._small]=\"size() === 'small'\" [style.max-height]=\"scrollHeight() || null\">\n <ul\n class=\"ui-autocomplete-list\"\n role=\"listbox\"\n [attr.aria-multiselectable]=\"multiple() ? 'true' : null\"\n [attr.id]=\"listboxId()\"\n [attr.aria-label]=\"label() || ariaLabel() || null\"\n >\n @for (row of visibleRows(); track row.key) {\n <ng-container [ngTemplateOutlet]=\"rowTpl\" [ngTemplateOutletContext]=\"{ $implicit: row }\" />\n }\n @if (showEmpty()) {\n <ng-container [ngTemplateOutlet]=\"emptyTpl\" />\n }\n </ul>\n </div>\n }\n\n @if (footerTemplate(); as tpl) {\n <div class=\"ui-autocomplete-footer\">\n <ng-container [ngTemplateOutlet]=\"tpl\" />\n </div>\n }\n </div>\n</ng-template>\n\n<!-- Empty state row. -->\n<ng-template #emptyTpl>\n <li class=\"ui-autocomplete-empty\" role=\"presentation\">\n @if (emptyTemplate(); as tpl) {\n <ng-container [ngTemplateOutlet]=\"tpl\" />\n } @else {\n {{ emptyMessage() }}\n }\n </li>\n</ng-template>\n\n<!-- Trigger: composed field around a native combobox input. -->\n<div #container class=\"ui-autocomplete\">\n <ui-field\n [label]=\"label()\"\n [for]=\"resolvedId()\"\n [required]=\"required()\"\n [size]=\"size()\"\n [level]=\"effectiveLevel()\"\n [disabled]=\"isDisabled()\"\n [readonly]=\"readonly()\"\n [message]=\"displayMessage()\"\n [messageId]=\"messageId()\"\n [autoHeight]=\"multiple()\"\n >\n <div\n class=\"ui-autocomplete-control\"\n [attr.role]=\"multiple() && !selectedItemTemplate() ? 'listbox' : null\"\n [attr.aria-orientation]=\"multiple() && !selectedItemTemplate() ? 'horizontal' : null\"\n [attr.aria-label]=\"multiple() && !selectedItemTemplate() && !label() ? ariaLabel() || null : null\"\n [attr.aria-labelledby]=\"multiple() && !selectedItemTemplate() ? ariaLabelledBy() || null : null\"\n (mousedown)=\"onBoxMousedown($event)\"\n >\n @if (multiple()) {\n @if (selectedItemTemplate(); as tpl) {\n @for (ctx of selectedItemContexts(); track $index) {\n <ng-container [ngTemplateOutlet]=\"tpl\" [ngTemplateOutletContext]=\"ctx\" />\n }\n } @else {\n @for (tag of visibleTagRows(); track $index) {\n <ui-chip\n #tagEl\n class=\"ui-autocomplete-tag\"\n role=\"option\"\n aria-selected=\"true\"\n [attr.aria-label]=\"tag.label\"\n [label]=\"tag.label\"\n size=\"small\"\n [disabled]=\"isDisabled()\"\n [removable]=\"canRemove()\"\n [removeTabindex]=\"-1\"\n [removeAriaLabel]=\"tag.removeAriaLabel\"\n [attr.aria-setsize]=\"tagRows().length\"\n [attr.aria-posinset]=\"tag.index + 1\"\n [attr.tabindex]=\"isDisabled() ? null : (focusedTag() === tag.index ? 0 : -1)\"\n (keydown)=\"onTagKeydown($event, tag.index)\"\n (focus)=\"focusedTag.set(tag.index)\"\n (remove)=\"removeAt(tag.index)\"\n />\n }\n }\n @if (overflowCount() > 0) {\n <!-- Collapsed remainder (`maxSelectedLabels`): informative only, not removable. -->\n <ui-chip\n class=\"ui-autocomplete-tag _overflow\"\n role=\"presentation\"\n [label]=\"overflowText()\"\n size=\"small\"\n [disabled]=\"isDisabled()\"\n />\n }\n }\n\n <input\n #inputEl\n type=\"text\"\n class=\"ui-autocomplete-input\"\n [class._small]=\"size() === 'small'\"\n role=\"combobox\"\n autocomplete=\"off\"\n aria-haspopup=\"listbox\"\n aria-autocomplete=\"list\"\n [id]=\"resolvedId()\"\n [value]=\"inputText()\"\n [placeholder]=\"effectivePlaceholder()\"\n [disabled]=\"isDisabled()\"\n [readOnly]=\"readonly()\"\n [required]=\"required()\"\n [attr.name]=\"name() || null\"\n [attr.tabindex]=\"tabindex()\"\n [attr.aria-expanded]=\"panelOpen()\"\n [attr.aria-controls]=\"panelOpen() ? listboxId() : null\"\n [attr.aria-activedescendant]=\"activeDescendant()\"\n [attr.aria-label]=\"label() ? null : ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.aria-describedby]=\"displayMessage() ? messageId() : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-invalid]=\"effectiveLevel() === 'error' ? 'true' : null\"\n (input)=\"onInput($event)\"\n (keydown)=\"onInputKeydown($event)\"\n (focus)=\"onInputFocus($event)\"\n (blur)=\"onInputBlur($event)\"\n />\n </div>\n\n @if (showClearButton()) {\n <button\n uiFieldSuffix\n type=\"button\"\n class=\"ui-autocomplete-clear\"\n [attr.aria-label]=\"clearAriaLabel()\"\n (click)=\"onClearClick($event)\"\n >\n <ui-icon name=\"xmark\" [size]=\"iconSize()\" />\n </button>\n }\n\n @if (loading()) {\n <ui-spinner\n uiFieldSuffix\n class=\"ui-autocomplete-loading\"\n size=\"small\"\n orientation=\"horizontal\"\n ariaLabel=\"Recherche en cours\"\n />\n } @else if (dropdown()) {\n <button\n uiFieldSuffix\n type=\"button\"\n class=\"ui-autocomplete-dropdown\"\n [class._open]=\"panelOpen()\"\n [disabled]=\"isDisabled()\"\n tabindex=\"-1\"\n aria-haspopup=\"listbox\"\n [attr.aria-expanded]=\"panelOpen()\"\n [attr.aria-controls]=\"panelOpen() ? listboxId() : null\"\n [attr.aria-label]=\"dropdownAriaLabel()\"\n (click)=\"onDropdownClick($event)\"\n >\n <ui-icon [name]=\"dropdownIcon()\" [size]=\"iconSize()\" />\n </button>\n }\n </ui-field>\n</div>\n\n<ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"overlayOrigin()!\"\n [cdkConnectedOverlayOpen]=\"panelOpen()\"\n [cdkConnectedOverlayPositions]=\"overlayPositions()\"\n [cdkConnectedOverlayHasBackdrop]=\"true\"\n cdkConnectedOverlayBackdropClass=\"cdk-overlay-transparent-backdrop\"\n (backdropClick)=\"close(false)\"\n (overlayOutsideClick)=\"close(false)\"\n (detach)=\"close(false)\"\n>\n <ng-container [ngTemplateOutlet]=\"panelTpl\" />\n</ng-template>\n", styles: [".ui-autocomplete{display:block;--ui-field-box-cursor: text}.ui-autocomplete-control{display:flex;align-items:center;align-self:stretch;flex:1 1 auto;flex-wrap:wrap;gap:var(--units-xs);min-width:0}.ui-autocomplete-control:first-child{padding-inline-start:var(--units-md)}.ui-autocomplete-control:last-child{padding-inline-end:var(--units-md)}.ui-autocomplete-tag{display:inline-flex;align-items:center;max-width:100%;border-radius:var(--radius-full);transition:box-shadow var(--transition-default) var(--transition-easeinout)}.ui-autocomplete-tag:focus-visible{outline:none;box-shadow:0 0 0 var(--units-2xs) rgb(from var(--form-high-stroke-focused) r g b/50%)}.ui-autocomplete-input{flex:1 1 auto;align-self:stretch;min-width:0;margin:0;padding:0;border:none;border-radius:inherit;background:transparent;outline:none;font-family:var(--fontfamily-base);font-size:var(--size-typography-text-default);color:var(--form-high-content-default)}.ui-autocomplete-input::placeholder{color:var(--form-low-content-default);opacity:1}.ui-autocomplete-input:disabled{cursor:not-allowed;color:var(--form-high-content-disabled)}.ui-autocomplete-input{flex:1 1 5rem;min-width:5rem;width:auto}.ui-autocomplete-input._small{font-size:var(--size-typography-text-md)}.ui-autocomplete-clear{display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:var(--size-components-2xs);height:var(--size-components-2xs);flex-shrink:0;margin:0;padding:0;border:none;border-radius:var(--radius-full);background:none;color:var(--form-low-content-default);cursor:pointer;transition:color var(--transition-default) var(--transition-easeinout),box-shadow var(--transition-default) var(--transition-easeinout)}.ui-autocomplete-clear:first-child{margin-inline-start:var(--units-md)}.ui-autocomplete-clear:last-child{margin-inline-end:var(--units-md)}.ui-autocomplete-clear:hover:not(:disabled){color:var(--form-high-content-hover)}.ui-autocomplete-clear:focus-visible{outline:none;color:var(--form-high-content-focused);box-shadow:0 0 0 var(--units-2xs) rgb(from var(--form-high-stroke-focused) r g b/50%)}.ui-autocomplete-clear:disabled{cursor:not-allowed;color:var(--form-high-content-disabled)}.ui-autocomplete-dropdown{flex-shrink:0;color:var(--form-low-content-default)}.ui-autocomplete-dropdown:first-child{margin-inline-start:var(--units-md)}.ui-autocomplete-dropdown:last-child{margin-inline-end:var(--units-md)}.ui-autocomplete-dropdown._disabled{color:var(--form-high-content-disabled)}.ui-autocomplete-dropdown{transition:rotate var(--ui-motion-duration, var(--transition-default)) var(--ui-motion-easing, var(--transition-easeinout)) var(--ui-motion-delay, 0ms);margin:0;padding:0;border:none;background:none;color:var(--form-low-content-default);cursor:pointer}.ui-autocomplete-dropdown:hover:not(:disabled){color:var(--form-high-content-hover)}.ui-autocomplete-dropdown._open{rotate:180deg}.ui-autocomplete-dropdown:disabled{cursor:not-allowed;color:var(--form-high-content-disabled)}.ui-autocomplete-loading{flex-shrink:0}.ui-autocomplete-loading:first-child{margin-inline-start:var(--units-md)}.ui-autocomplete-loading:last-child{margin-inline-end:var(--units-md)}.ui-autocomplete-panel{border:var(--stroke-default) solid var(--ui-overlay-stroke, var(--form-high-stroke-default));border-radius:var(--ui-overlay-radius, var(--radius-default));background-color:var(--ui-overlay-surface, var(--form-high-surface-default));box-shadow:var(--ui-overlay-shadow, var(--shadow-default-md));font-family:var(--fontfamily-base);display:flex;flex-direction:column;gap:var(--units-xs);box-sizing:border-box;max-width:calc(100vw - var(--units-lg));padding:var(--units-xs)}.ui-autocomplete-panel .ui-autocomplete-header,.ui-autocomplete-panel .ui-autocomplete-footer{padding:var(--units-xs) var(--units-sm);font-family:var(--fontfamily-base);font-size:var(--size-typography-text-md);color:var(--form-high-content-default)}.ui-autocomplete-panel .ui-autocomplete-scroller{overflow:auto;max-height:19.5rem}.ui-autocomplete-panel .ui-autocomplete-scroller._small{max-height:16rem}.ui-autocomplete-panel .ui-autocomplete-viewport{width:100%}.ui-autocomplete-panel .ui-autocomplete-list{display:flex;flex-direction:column;gap:var(--units-xs);margin:0;padding:0;list-style:none}.ui-autocomplete-panel .ui-autocomplete-viewport .ui-autocomplete-list{gap:0}.ui-autocomplete-panel .ui-autocomplete-viewport .ui-autocomplete-group{height:2.5rem}.ui-autocomplete-panel .ui-autocomplete-viewport .ui-autocomplete-group._small{height:2rem}.ui-autocomplete-panel .ui-autocomplete-option{display:flex;align-items:center;gap:var(--units-sm);box-sizing:border-box;height:2.5rem;flex-shrink:0;padding:0 var(--units-default);border-radius:var(--radius-sm);font-family:var(--fontfamily-base);font-size:var(--size-typography-text-default);color:var(--form-high-content-default);cursor:pointer;-webkit-user-select:none;user-select:none;transition:background-color var(--transition-default) var(--transition-easeinout),color var(--transition-default) var(--transition-easeinout)}.ui-autocomplete-panel .ui-autocomplete-option._small{height:2rem;padding:0 var(--units-md);font-size:var(--size-typography-text-md)}.ui-autocomplete-panel .ui-autocomplete-option._focused,.ui-autocomplete-panel .ui-autocomplete-option:hover:not(._disabled){background-color:var(--global-background-default-hover)}.ui-autocomplete-panel .ui-autocomplete-option._selected{background-color:var(--form-high-surface-hover);color:var(--form-high-content-checked)}.ui-autocomplete-panel .ui-autocomplete-option._disabled{color:var(--form-high-content-disabled);cursor:not-allowed}.ui-autocomplete-panel .ui-autocomplete-option-label{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ui-autocomplete-panel .ui-autocomplete-group{display:flex;align-items:center;box-sizing:border-box;height:2rem;flex-shrink:0;padding:0 var(--units-default);font-family:var(--fontfamily-base);font-size:var(--size-typography-text-md);font-weight:var(--weight-bold);color:var(--form-low-content-default)}.ui-autocomplete-panel .ui-autocomplete-group._small{height:1.5rem;padding:0 var(--units-md);font-size:var(--size-typography-text-sm)}.ui-autocomplete-panel .ui-autocomplete-empty{display:flex;align-items:center;box-sizing:border-box;min-height:2.5rem;padding:0 var(--units-default);font-family:var(--fontfamily-base);font-size:var(--size-typography-text-default);color:var(--form-low-content-default)}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { 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: "directive", type: i1.ɵɵCdkFixedSizeVirtualScroll, selector: "cdk-virtual-scroll-viewport[itemSize]", inputs: ["itemSize", "minBufferPx", "maxBufferPx"] }, { kind: "directive", type: i1.ɵɵCdkVirtualForOf, selector: "[cdkVirtualFor][cdkVirtualForOf]", inputs: ["cdkVirtualForOf", "cdkVirtualForTrackBy", "cdkVirtualForTemplate", "cdkVirtualForTemplateCacheSize"] }, { kind: "component", type: i1.ɵɵCdkVirtualScrollViewport, selector: "cdk-virtual-scroll-viewport", inputs: ["orientation", "appendOnly"], outputs: ["scrolledIndexChange"] }, { kind: "ngmodule", type: ScrollingModule }, { kind: "component", type: UiField, selector: "ui-field", inputs: ["label", "for", "required", "size", "level", "disabled", "readonly", "multiline", "autoHeight", "message", "messageId", "hasFooter"] }, { kind: "component", type: UiIcon, selector: "ui-icon", inputs: ["name", "size", "type", "family", "decorative", "ariaLabel"] }, { kind: "component", type: UiSpinner, selector: "ui-spinner", inputs: ["size", "orientation", "label", "ariaLabel", "spinnerTemplate", "image", "imageAlt", "icon", "strokeWidth", "fill", "animationDuration", "delay"] }, { kind: "component", type: UiChip, selector: "ui-chip", inputs: ["label", "level", "subLevel", "size", "icon", "image", "alt", "rounded", "removable", "removeIcon", "disabled", "selectable", "selected", "selectedIcon", "ariaLabel", "ariaLabelledBy", "removeAriaLabel", "removeTabindex"], outputs: ["selectedChange", "remove", "chipClick", "imageError"] }, { kind: "directive", type: UiMotion, selector: "[uiMotion]", inputs: ["uiMotion", "motionDuration", "motionDelay", "motionEasing", "motionEnterEasing", "motionLeaveEasing", "motionDistance", "motionScale", "motionDisabled", "motionOnInsert"], exportAs: ["uiMotion"] }] }); }
911
+ }
912
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: UiAutocomplete, decorators: [{
913
+ type: Component,
914
+ args: [{ selector: 'ui-autocomplete', imports: [NgTemplateOutlet, OverlayModule, ScrollingModule, UiField, UiIcon, UiSpinner, UiChip, UiMotion], providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => UiAutocomplete), multi: true }], template: "<!-- One rendered row: group header or suggestion (shared by the plain and virtual lists). -->\n<ng-template #rowTpl let-row>\n @if (row.kind === 'group') {\n <li class=\"ui-autocomplete-group\" role=\"presentation\" [class._small]=\"size() === 'small'\">\n @if (groupTemplate(); as tpl) {\n <ng-container [ngTemplateOutlet]=\"tpl\" [ngTemplateOutletContext]=\"{ $implicit: row.original, group: row.original }\" />\n } @else {\n {{ row.label }}\n }\n </li>\n } @else {\n <!-- ARIA combobox/listbox pattern: keyboard and focus are handled by\n the input role=\"combobox\" (roving via aria-activedescendant). -->\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\n <li\n class=\"ui-autocomplete-option\"\n role=\"option\"\n [attr.id]=\"row.id\"\n [class._small]=\"size() === 'small'\"\n [class._selected]=\"row.selected\"\n [class._focused]=\"row.index === focusedIndex()\"\n [class._disabled]=\"row.entry.disabled\"\n [attr.aria-selected]=\"row.selected\"\n [attr.aria-disabled]=\"row.entry.disabled || null\"\n [attr.aria-setsize]=\"optionCount()\"\n [attr.aria-posinset]=\"row.index + 1\"\n (mousedown)=\"onOptionMousedown($event)\"\n (click)=\"onOptionClick(row, $event)\"\n (mouseenter)=\"onOptionMouseEnter(row)\"\n >\n @if (itemTemplate(); as tpl) {\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"{ $implicit: row.entry.original, option: row.entry.original, selected: row.selected, index: row.index }\"\n />\n } @else {\n <span class=\"ui-autocomplete-option-label\">{{ row.entry.label }}</span>\n }\n </li>\n }\n</ng-template>\n\n<!-- Suggestions panel (CDK overlay). -->\n<ng-template #panelTpl>\n <div\n #panel\n class=\"ui-autocomplete-panel\"\n [class]=\"panelStyleClass()\"\n [class._small]=\"size() === 'small'\"\n [style.width.px]=\"overlayWidth()\"\n [uiMotion]=\"'slide-down'\"\n #panelMotion=\"uiMotion\"\n motionOnInsert\n >\n @if (headerTemplate(); as tpl) {\n <div class=\"ui-autocomplete-header\">\n <ng-container [ngTemplateOutlet]=\"tpl\" />\n </div>\n }\n\n @if (virtualScroll()) {\n <cdk-virtual-scroll-viewport\n class=\"ui-autocomplete-viewport\"\n [itemSize]=\"virtualScrollItemSize()\"\n [style.height]=\"viewportHeight()\"\n >\n <ul\n class=\"ui-autocomplete-list\"\n role=\"listbox\"\n [attr.aria-multiselectable]=\"multiple() ? 'true' : null\"\n [attr.id]=\"listboxId()\"\n [attr.aria-label]=\"label() || ariaLabel() || null\"\n >\n <ng-container *cdkVirtualFor=\"let row of visibleRows(); trackBy: trackRow\">\n <ng-container [ngTemplateOutlet]=\"rowTpl\" [ngTemplateOutletContext]=\"{ $implicit: row }\" />\n </ng-container>\n @if (showEmpty()) {\n <ng-container [ngTemplateOutlet]=\"emptyTpl\" />\n }\n </ul>\n </cdk-virtual-scroll-viewport>\n } @else {\n <div class=\"ui-autocomplete-scroller\" [class._small]=\"size() === 'small'\" [style.max-height]=\"scrollHeight() || null\">\n <ul\n class=\"ui-autocomplete-list\"\n role=\"listbox\"\n [attr.aria-multiselectable]=\"multiple() ? 'true' : null\"\n [attr.id]=\"listboxId()\"\n [attr.aria-label]=\"label() || ariaLabel() || null\"\n >\n @for (row of visibleRows(); track row.key) {\n <ng-container [ngTemplateOutlet]=\"rowTpl\" [ngTemplateOutletContext]=\"{ $implicit: row }\" />\n }\n @if (showEmpty()) {\n <ng-container [ngTemplateOutlet]=\"emptyTpl\" />\n }\n </ul>\n </div>\n }\n\n @if (footerTemplate(); as tpl) {\n <div class=\"ui-autocomplete-footer\">\n <ng-container [ngTemplateOutlet]=\"tpl\" />\n </div>\n }\n </div>\n</ng-template>\n\n<!-- Empty state row. -->\n<ng-template #emptyTpl>\n <li class=\"ui-autocomplete-empty\" role=\"presentation\">\n @if (emptyTemplate(); as tpl) {\n <ng-container [ngTemplateOutlet]=\"tpl\" />\n } @else {\n {{ emptyMessage() }}\n }\n </li>\n</ng-template>\n\n<!-- Trigger: composed field around a native combobox input. -->\n<div #container class=\"ui-autocomplete\">\n <ui-field\n [label]=\"label()\"\n [for]=\"resolvedId()\"\n [required]=\"required()\"\n [size]=\"size()\"\n [level]=\"effectiveLevel()\"\n [disabled]=\"isDisabled()\"\n [readonly]=\"readonly()\"\n [message]=\"displayMessage()\"\n [messageId]=\"messageId()\"\n [autoHeight]=\"multiple()\"\n >\n <div\n class=\"ui-autocomplete-control\"\n [attr.role]=\"multiple() && !selectedItemTemplate() ? 'listbox' : null\"\n [attr.aria-orientation]=\"multiple() && !selectedItemTemplate() ? 'horizontal' : null\"\n [attr.aria-label]=\"multiple() && !selectedItemTemplate() && !label() ? ariaLabel() || null : null\"\n [attr.aria-labelledby]=\"multiple() && !selectedItemTemplate() ? ariaLabelledBy() || null : null\"\n (mousedown)=\"onBoxMousedown($event)\"\n >\n @if (multiple()) {\n @if (selectedItemTemplate(); as tpl) {\n @for (ctx of selectedItemContexts(); track $index) {\n <ng-container [ngTemplateOutlet]=\"tpl\" [ngTemplateOutletContext]=\"ctx\" />\n }\n } @else {\n @for (tag of visibleTagRows(); track $index) {\n <ui-chip\n #tagEl\n class=\"ui-autocomplete-tag\"\n role=\"option\"\n aria-selected=\"true\"\n [attr.aria-label]=\"tag.label\"\n [label]=\"tag.label\"\n size=\"small\"\n [disabled]=\"isDisabled()\"\n [removable]=\"canRemove()\"\n [removeTabindex]=\"-1\"\n [removeAriaLabel]=\"tag.removeAriaLabel\"\n [attr.aria-setsize]=\"tagRows().length\"\n [attr.aria-posinset]=\"tag.index + 1\"\n [attr.tabindex]=\"isDisabled() ? null : (focusedTag() === tag.index ? 0 : -1)\"\n (keydown)=\"onTagKeydown($event, tag.index)\"\n (focus)=\"focusedTag.set(tag.index)\"\n (remove)=\"removeAt(tag.index)\"\n />\n }\n }\n @if (overflowCount() > 0) {\n <!-- Collapsed remainder (`maxSelectedLabels`): informative only, not removable. -->\n <ui-chip\n class=\"ui-autocomplete-tag _overflow\"\n role=\"presentation\"\n [label]=\"overflowText()\"\n size=\"small\"\n [disabled]=\"isDisabled()\"\n />\n }\n }\n\n <input\n #inputEl\n type=\"text\"\n class=\"ui-autocomplete-input\"\n [class._small]=\"size() === 'small'\"\n role=\"combobox\"\n autocomplete=\"off\"\n aria-haspopup=\"listbox\"\n aria-autocomplete=\"list\"\n [id]=\"resolvedId()\"\n [value]=\"inputText()\"\n [placeholder]=\"effectivePlaceholder()\"\n [disabled]=\"isDisabled()\"\n [readOnly]=\"readonly()\"\n [required]=\"required()\"\n [attr.name]=\"name() || null\"\n [attr.tabindex]=\"tabindex()\"\n [attr.aria-expanded]=\"panelOpen()\"\n [attr.aria-controls]=\"panelOpen() ? listboxId() : null\"\n [attr.aria-activedescendant]=\"activeDescendant()\"\n [attr.aria-label]=\"label() ? null : ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.aria-describedby]=\"displayMessage() ? messageId() : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-invalid]=\"effectiveLevel() === 'error' ? 'true' : null\"\n (input)=\"onInput($event)\"\n (keydown)=\"onInputKeydown($event)\"\n (focus)=\"onInputFocus($event)\"\n (blur)=\"onInputBlur($event)\"\n />\n </div>\n\n @if (showClearButton()) {\n <button\n uiFieldSuffix\n type=\"button\"\n class=\"ui-autocomplete-clear\"\n [attr.aria-label]=\"clearAriaLabel()\"\n (click)=\"onClearClick($event)\"\n >\n <ui-icon name=\"xmark\" [size]=\"iconSize()\" />\n </button>\n }\n\n @if (loading()) {\n <ui-spinner\n uiFieldSuffix\n class=\"ui-autocomplete-loading\"\n size=\"small\"\n orientation=\"horizontal\"\n ariaLabel=\"Recherche en cours\"\n />\n } @else if (dropdown()) {\n <button\n uiFieldSuffix\n type=\"button\"\n class=\"ui-autocomplete-dropdown\"\n [class._open]=\"panelOpen()\"\n [disabled]=\"isDisabled()\"\n tabindex=\"-1\"\n aria-haspopup=\"listbox\"\n [attr.aria-expanded]=\"panelOpen()\"\n [attr.aria-controls]=\"panelOpen() ? listboxId() : null\"\n [attr.aria-label]=\"dropdownAriaLabel()\"\n (click)=\"onDropdownClick($event)\"\n >\n <ui-icon [name]=\"dropdownIcon()\" [size]=\"iconSize()\" />\n </button>\n }\n </ui-field>\n</div>\n\n<ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"overlayOrigin()!\"\n [cdkConnectedOverlayOpen]=\"panelOpen()\"\n [cdkConnectedOverlayPositions]=\"overlayPositions()\"\n [cdkConnectedOverlayHasBackdrop]=\"true\"\n cdkConnectedOverlayBackdropClass=\"cdk-overlay-transparent-backdrop\"\n (backdropClick)=\"close(false)\"\n (overlayOutsideClick)=\"close(false)\"\n (detach)=\"close(false)\"\n>\n <ng-container [ngTemplateOutlet]=\"panelTpl\" />\n</ng-template>\n", styles: [".ui-autocomplete{display:block;--ui-field-box-cursor: text}.ui-autocomplete-control{display:flex;align-items:center;align-self:stretch;flex:1 1 auto;flex-wrap:wrap;gap:var(--units-xs);min-width:0}.ui-autocomplete-control:first-child{padding-inline-start:var(--units-md)}.ui-autocomplete-control:last-child{padding-inline-end:var(--units-md)}.ui-autocomplete-tag{display:inline-flex;align-items:center;max-width:100%;border-radius:var(--radius-full);transition:box-shadow var(--transition-default) var(--transition-easeinout)}.ui-autocomplete-tag:focus-visible{outline:none;box-shadow:0 0 0 var(--units-2xs) rgb(from var(--form-high-stroke-focused) r g b/50%)}.ui-autocomplete-input{flex:1 1 auto;align-self:stretch;min-width:0;margin:0;padding:0;border:none;border-radius:inherit;background:transparent;outline:none;font-family:var(--fontfamily-base);font-size:var(--size-typography-text-default);color:var(--form-high-content-default)}.ui-autocomplete-input::placeholder{color:var(--form-low-content-default);opacity:1}.ui-autocomplete-input:disabled{cursor:not-allowed;color:var(--form-high-content-disabled)}.ui-autocomplete-input{flex:1 1 5rem;min-width:5rem;width:auto}.ui-autocomplete-input._small{font-size:var(--size-typography-text-md)}.ui-autocomplete-clear{display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:var(--size-components-2xs);height:var(--size-components-2xs);flex-shrink:0;margin:0;padding:0;border:none;border-radius:var(--radius-full);background:none;color:var(--form-low-content-default);cursor:pointer;transition:color var(--transition-default) var(--transition-easeinout),box-shadow var(--transition-default) var(--transition-easeinout)}.ui-autocomplete-clear:first-child{margin-inline-start:var(--units-md)}.ui-autocomplete-clear:last-child{margin-inline-end:var(--units-md)}.ui-autocomplete-clear:hover:not(:disabled){color:var(--form-high-content-hover)}.ui-autocomplete-clear:focus-visible{outline:none;color:var(--form-high-content-focused);box-shadow:0 0 0 var(--units-2xs) rgb(from var(--form-high-stroke-focused) r g b/50%)}.ui-autocomplete-clear:disabled{cursor:not-allowed;color:var(--form-high-content-disabled)}.ui-autocomplete-dropdown{flex-shrink:0;color:var(--form-low-content-default)}.ui-autocomplete-dropdown:first-child{margin-inline-start:var(--units-md)}.ui-autocomplete-dropdown:last-child{margin-inline-end:var(--units-md)}.ui-autocomplete-dropdown._disabled{color:var(--form-high-content-disabled)}.ui-autocomplete-dropdown{transition:rotate var(--ui-motion-duration, var(--transition-default)) var(--ui-motion-easing, var(--transition-easeinout)) var(--ui-motion-delay, 0ms);margin:0;padding:0;border:none;background:none;color:var(--form-low-content-default);cursor:pointer}.ui-autocomplete-dropdown:hover:not(:disabled){color:var(--form-high-content-hover)}.ui-autocomplete-dropdown._open{rotate:180deg}.ui-autocomplete-dropdown:disabled{cursor:not-allowed;color:var(--form-high-content-disabled)}.ui-autocomplete-loading{flex-shrink:0}.ui-autocomplete-loading:first-child{margin-inline-start:var(--units-md)}.ui-autocomplete-loading:last-child{margin-inline-end:var(--units-md)}.ui-autocomplete-panel{border:var(--stroke-default) solid var(--ui-overlay-stroke, var(--form-high-stroke-default));border-radius:var(--ui-overlay-radius, var(--radius-default));background-color:var(--ui-overlay-surface, var(--form-high-surface-default));box-shadow:var(--ui-overlay-shadow, var(--shadow-default-md));font-family:var(--fontfamily-base);display:flex;flex-direction:column;gap:var(--units-xs);box-sizing:border-box;max-width:calc(100vw - var(--units-lg));padding:var(--units-xs)}.ui-autocomplete-panel .ui-autocomplete-header,.ui-autocomplete-panel .ui-autocomplete-footer{padding:var(--units-xs) var(--units-sm);font-family:var(--fontfamily-base);font-size:var(--size-typography-text-md);color:var(--form-high-content-default)}.ui-autocomplete-panel .ui-autocomplete-scroller{overflow:auto;max-height:19.5rem}.ui-autocomplete-panel .ui-autocomplete-scroller._small{max-height:16rem}.ui-autocomplete-panel .ui-autocomplete-viewport{width:100%}.ui-autocomplete-panel .ui-autocomplete-list{display:flex;flex-direction:column;gap:var(--units-xs);margin:0;padding:0;list-style:none}.ui-autocomplete-panel .ui-autocomplete-viewport .ui-autocomplete-list{gap:0}.ui-autocomplete-panel .ui-autocomplete-viewport .ui-autocomplete-group{height:2.5rem}.ui-autocomplete-panel .ui-autocomplete-viewport .ui-autocomplete-group._small{height:2rem}.ui-autocomplete-panel .ui-autocomplete-option{display:flex;align-items:center;gap:var(--units-sm);box-sizing:border-box;height:2.5rem;flex-shrink:0;padding:0 var(--units-default);border-radius:var(--radius-sm);font-family:var(--fontfamily-base);font-size:var(--size-typography-text-default);color:var(--form-high-content-default);cursor:pointer;-webkit-user-select:none;user-select:none;transition:background-color var(--transition-default) var(--transition-easeinout),color var(--transition-default) var(--transition-easeinout)}.ui-autocomplete-panel .ui-autocomplete-option._small{height:2rem;padding:0 var(--units-md);font-size:var(--size-typography-text-md)}.ui-autocomplete-panel .ui-autocomplete-option._focused,.ui-autocomplete-panel .ui-autocomplete-option:hover:not(._disabled){background-color:var(--global-background-default-hover)}.ui-autocomplete-panel .ui-autocomplete-option._selected{background-color:var(--form-high-surface-hover);color:var(--form-high-content-checked)}.ui-autocomplete-panel .ui-autocomplete-option._disabled{color:var(--form-high-content-disabled);cursor:not-allowed}.ui-autocomplete-panel .ui-autocomplete-option-label{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ui-autocomplete-panel .ui-autocomplete-group{display:flex;align-items:center;box-sizing:border-box;height:2rem;flex-shrink:0;padding:0 var(--units-default);font-family:var(--fontfamily-base);font-size:var(--size-typography-text-md);font-weight:var(--weight-bold);color:var(--form-low-content-default)}.ui-autocomplete-panel .ui-autocomplete-group._small{height:1.5rem;padding:0 var(--units-md);font-size:var(--size-typography-text-sm)}.ui-autocomplete-panel .ui-autocomplete-empty{display:flex;align-items:center;box-sizing:border-box;min-height:2.5rem;padding:0 var(--units-default);font-family:var(--fontfamily-base);font-size:var(--size-typography-text-default);color:var(--form-low-content-default)}\n"] }]
915
+ }], ctorParameters: () => [], propDecorators: { suggestions: [{ type: i0.Input, args: [{ isSignal: true, alias: "suggestions", required: false }] }], optionLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionLabel", required: false }] }], optionValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionValue", required: false }] }], optionDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionDisabled", required: false }] }], dataKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "dataKey", required: false }] }], group: [{ type: i0.Input, args: [{ isSignal: true, alias: "group", required: false }] }], optionGroupLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionGroupLabel", required: false }] }], optionGroupChildren: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionGroupChildren", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], minLength: [{ type: i0.Input, args: [{ isSignal: true, alias: "minLength", required: false }] }], delay: [{ type: i0.Input, args: [{ isSignal: true, alias: "delay", required: false }] }], completeOnFocus: [{ type: i0.Input, args: [{ isSignal: true, alias: "completeOnFocus", required: false }] }], dropdown: [{ type: i0.Input, args: [{ isSignal: true, alias: "dropdown", required: false }] }], dropdownMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "dropdownMode", required: false }] }], dropdownAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "dropdownAriaLabel", required: false }] }], dropdownIcon: [{ type: i0.Input, args: [{ isSignal: true, alias: "dropdownIcon", required: false }] }], forceSelection: [{ type: i0.Input, args: [{ isSignal: true, alias: "forceSelection", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], unique: [{ type: i0.Input, args: [{ isSignal: true, alias: "unique", required: false }] }], maxSelectedLabels: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxSelectedLabels", required: false }] }], overflowLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "overflowLabel", required: false }] }], removeTagLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "removeTagLabel", required: false }] }], showClear: [{ type: i0.Input, args: [{ isSignal: true, alias: "showClear", required: false }] }], clearAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearAriaLabel", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], emptyMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyMessage", required: false }] }], showEmptyMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "showEmptyMessage", required: false }] }], autoOptionFocus: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoOptionFocus", required: false }] }], selectOnFocus: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectOnFocus", required: false }] }], focusOnHover: [{ type: i0.Input, args: [{ isSignal: true, alias: "focusOnHover", required: false }] }], virtualScroll: [{ type: i0.Input, args: [{ isSignal: true, alias: "virtualScroll", required: false }] }], virtualScrollItemSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "virtualScrollItemSize", required: false }] }], lazy: [{ type: i0.Input, args: [{ isSignal: true, alias: "lazy", required: false }] }], scrollHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "scrollHeight", required: false }] }], autoFlip: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoFlip", required: false }] }], panelStyleClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "panelStyleClass", required: false }] }], completeMethod: [{ type: i0.Output, args: ["completeMethod"] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }], optionSelect: [{ type: i0.Output, args: ["optionSelect"] }], optionUnselect: [{ type: i0.Output, args: ["optionUnselect"] }], opened: [{ type: i0.Output, args: ["opened"] }], closed: [{ type: i0.Output, args: ["closed"] }], cleared: [{ type: i0.Output, args: ["cleared"] }], dropdownClick: [{ type: i0.Output, args: ["dropdownClick"] }], lazyLoad: [{ type: i0.Output, args: ["lazyLoad"] }], inputFocus: [{ type: i0.Output, args: ["inputFocus"] }], inputBlur: [{ type: i0.Output, args: ["inputBlur"] }], itemTemplate: [{ type: i0.ContentChild, args: ['item', { isSignal: true }] }], selectedItemTemplate: [{ type: i0.ContentChild, args: ['selectedItem', { isSignal: true }] }], groupTemplate: [{ type: i0.ContentChild, args: ['group', { isSignal: true }] }], headerTemplate: [{ type: i0.ContentChild, args: ['header', { isSignal: true }] }], footerTemplate: [{ type: i0.ContentChild, args: ['footer', { isSignal: true }] }], emptyTemplate: [{ type: i0.ContentChild, args: ['empty', { isSignal: true }] }], containerEl: [{ type: i0.ViewChild, args: ['container', { isSignal: true }] }], inputEl: [{ type: i0.ViewChild, args: ['inputEl', { isSignal: true }] }], panelEl: [{ type: i0.ViewChild, args: ['panel', { isSignal: true }] }], viewport: [{ type: i0.ViewChild, args: [i0.forwardRef(() => CdkVirtualScrollViewport), { isSignal: true }] }], tagEls: [{ type: i0.ViewChildren, args: ['tagEl', { ...{ read: ElementRef }, isSignal: true }] }] } });
916
+
917
+ /*
918
+ * Public API Surface of ui-kit/ui-autocomplete
919
+ */
920
+
921
+ /**
922
+ * Generated bundle index. Do not edit.
923
+ */
924
+
925
+ export { UiAutocomplete };
926
+ //# sourceMappingURL=4sh-ui-kit-ui-autocomplete.mjs.map