@wirekyt/angular 0.0.10 → 0.0.11

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.
@@ -0,0 +1,955 @@
1
+ import * as combobox from '@wirekyt/dom/machines/combobox';
2
+ import { anatomy } from '@wirekyt/dom/machines/combobox';
3
+ import { injectLocale, injectEnvironment, createId, useMachine, bindProps, createCvaController, buildRootCarrier } from '@wirekyt/angular';
4
+ import { injectFieldContextOptional } from '@wirekyt/angular/field';
5
+ import * as i0 from '@angular/core';
6
+ import { input, booleanAttribute, output, signal, effect, computed, Directive, InjectionToken, inject, TemplateRef, ViewContainerRef, ElementRef, untracked, DestroyRef, Renderer2, model, EnvironmentInjector, Injector, forwardRef } from '@angular/core';
7
+ import * as presence from '@wirekyt/dom/machines/presence';
8
+ import { NG_VALUE_ACCESSOR } from '@angular/forms';
9
+ import { ListCollection } from '@wirekyt/dom/collection';
10
+
11
+ const comboboxAnatomy = anatomy.extendWith("empty");
12
+
13
+ function useCombobox(options) {
14
+ const locale = injectLocale();
15
+ const environment = injectEnvironment();
16
+ const field = injectFieldContextOptional();
17
+ const fallbackId = createId();
18
+ return useMachine({
19
+ machine: combobox.machine,
20
+ context: () => {
21
+ const props = options.context();
22
+ const id = props.id ?? fallbackId;
23
+ const merged = {
24
+ dir: locale.dir,
25
+ locale: locale.locale,
26
+ getRootNode: environment.getRootNode,
27
+ ...props,
28
+ id,
29
+ };
30
+ if (field) {
31
+ const fieldIds = field.ids;
32
+ const baseIds = (props.ids ??
33
+ {});
34
+ merged["ids"] = {
35
+ label: fieldIds.label,
36
+ input: fieldIds.control,
37
+ ...baseIds,
38
+ };
39
+ const p = props;
40
+ const disabled = Boolean(p.disabled) || field.disabled();
41
+ const invalid = Boolean(p.invalid) || field.invalid();
42
+ const required = Boolean(p.required) || field.required();
43
+ const readOnly = Boolean(p.readOnly) || field.readOnly();
44
+ merged["disabled"] = disabled || undefined;
45
+ merged["invalid"] = invalid || undefined;
46
+ merged["required"] = required || undefined;
47
+ merged["readOnly"] = readOnly || undefined;
48
+ }
49
+ return merged;
50
+ },
51
+ connect: (service, normalize) => combobox.connect(service, normalize),
52
+ });
53
+ }
54
+
55
+ class ComboboxPresence {
56
+ lazyMount = input(false, { ...(ngDevMode ? { debugName: "lazyMount" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
57
+ unmountOnExit = input(false, { ...(ngDevMode ? { debugName: "unmountOnExit" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
58
+ skipAnimationOnMount = input(false, { ...(ngDevMode ? { debugName: "skipAnimationOnMount" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
59
+ immediate = input(false, { ...(ngDevMode ? { debugName: "immediate" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
60
+ present = input(undefined, /* @ts-ignore */
61
+ ...(ngDevMode ? [{ debugName: "present" }] : /* istanbul ignore next */ []));
62
+ exitComplete = output();
63
+ createPresence(open) {
64
+ const machine = useMachine({
65
+ machine: presence.machine,
66
+ context: () => ({
67
+ present: this.present() ?? open(),
68
+ immediate: this.immediate(),
69
+ onExitComplete: () => this.exitComplete.emit(),
70
+ }),
71
+ connect: presence.connect,
72
+ });
73
+ const wasPresent = signal(false, /* @ts-ignore */
74
+ ...(ngDevMode ? [{ debugName: "wasPresent" }] : /* istanbul ignore next */ []));
75
+ effect(() => {
76
+ if (machine.api().present)
77
+ wasPresent.set(true);
78
+ });
79
+ return {
80
+ api: machine.api,
81
+ isUnmounted: computed(() => !machine.api().present &&
82
+ ((!wasPresent() && this.lazyMount()) || (wasPresent() && this.unmountOnExit()))),
83
+ props: () => ({
84
+ hidden: !machine.api().present,
85
+ "data-state": machine.api().skip && this.skipAnimationOnMount()
86
+ ? undefined
87
+ : (this.present() ?? open())
88
+ ? "open"
89
+ : "closed",
90
+ }),
91
+ };
92
+ }
93
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ComboboxPresence, deps: [], target: i0.ɵɵFactoryTarget.Directive });
94
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: ComboboxPresence, isStandalone: true, inputs: { lazyMount: { classPropertyName: "lazyMount", publicName: "lazyMount", isSignal: true, isRequired: false, transformFunction: null }, unmountOnExit: { classPropertyName: "unmountOnExit", publicName: "unmountOnExit", isSignal: true, isRequired: false, transformFunction: null }, skipAnimationOnMount: { classPropertyName: "skipAnimationOnMount", publicName: "skipAnimationOnMount", isSignal: true, isRequired: false, transformFunction: null }, immediate: { classPropertyName: "immediate", publicName: "immediate", isSignal: true, isRequired: false, transformFunction: null }, present: { classPropertyName: "present", publicName: "present", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { exitComplete: "exitComplete" }, ngImport: i0 });
95
+ }
96
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ComboboxPresence, decorators: [{
97
+ type: Directive
98
+ }], propDecorators: { lazyMount: [{ type: i0.Input, args: [{ isSignal: true, alias: "lazyMount", required: false }] }], unmountOnExit: [{ type: i0.Input, args: [{ isSignal: true, alias: "unmountOnExit", required: false }] }], skipAnimationOnMount: [{ type: i0.Input, args: [{ isSignal: true, alias: "skipAnimationOnMount", required: false }] }], immediate: [{ type: i0.Input, args: [{ isSignal: true, alias: "immediate", required: false }] }], present: [{ type: i0.Input, args: [{ isSignal: true, alias: "present", required: false }] }], exitComplete: [{ type: i0.Output, args: ["exitComplete"] }] } });
99
+ const COMBOBOX_PRESENCE = new InjectionToken("WIREKYT.COMBOBOX_PRESENCE");
100
+
101
+ const COMBOBOX_CONTEXT = new InjectionToken("WIREKYT.COMBOBOX_CONTEXT");
102
+ function injectComboboxContext() {
103
+ return inject(COMBOBOX_CONTEXT);
104
+ }
105
+ const COMBOBOX_CONTEXT_CARRIER = new InjectionToken("WIREKYT.COMBOBOX_CONTEXT_CARRIER");
106
+ function injectComboboxContextCarrier() {
107
+ return inject(COMBOBOX_CONTEXT_CARRIER);
108
+ }
109
+
110
+ class ComboboxContent {
111
+ constructor() {
112
+ const context = injectComboboxContext();
113
+ const { presence } = inject(COMBOBOX_PRESENCE);
114
+ const template = inject((TemplateRef), { optional: true });
115
+ const container = inject(ViewContainerRef);
116
+ const host = inject(ElementRef);
117
+ const elementRef = template ? { nativeElement: null } : host;
118
+ let view;
119
+ effect(() => {
120
+ const unmounted = presence.isUnmounted();
121
+ if (template) {
122
+ if (unmounted) {
123
+ elementRef.nativeElement = null;
124
+ container.clear();
125
+ view = undefined;
126
+ }
127
+ else if (!view) {
128
+ view = container.createEmbeddedView(template);
129
+ elementRef.nativeElement =
130
+ view.rootNodes.find((node) => node.nodeType === 1) ?? null;
131
+ }
132
+ }
133
+ untracked(() => presence.api().setNode(elementRef.nativeElement));
134
+ });
135
+ bindProps({
136
+ elementRef,
137
+ renderer: inject(Renderer2),
138
+ destroyRef: inject(DestroyRef),
139
+ props: () => {
140
+ presence.isUnmounted();
141
+ return { ...context.api().getContentProps(), ...presence.props() };
142
+ },
143
+ });
144
+ }
145
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ComboboxContent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
146
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: ComboboxContent, isStandalone: true, selector: "[comboboxContent]", exportAs: ["comboboxContent"], ngImport: i0 });
147
+ }
148
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ComboboxContent, decorators: [{
149
+ type: Directive,
150
+ args: [{ selector: "[comboboxContent]", standalone: true, exportAs: "comboboxContent" }]
151
+ }], ctorParameters: () => [] });
152
+
153
+ class ComboboxRoot extends ComboboxPresence {
154
+ id = input(undefined, /* @ts-ignore */
155
+ ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
156
+ elementIds = input(undefined, { ...(ngDevMode ? { debugName: "elementIds" } : /* istanbul ignore next */ {}), alias: "ids" });
157
+ collection = input.required(/* @ts-ignore */
158
+ ...(ngDevMode ? [{ debugName: "collection" }] : /* istanbul ignore next */ []));
159
+ value = model(undefined, /* @ts-ignore */
160
+ ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
161
+ defaultValue = input(undefined, /* @ts-ignore */
162
+ ...(ngDevMode ? [{ debugName: "defaultValue" }] : /* istanbul ignore next */ []));
163
+ inputValue = model(undefined, /* @ts-ignore */
164
+ ...(ngDevMode ? [{ debugName: "inputValue" }] : /* istanbul ignore next */ []));
165
+ defaultInputValue = input(undefined, /* @ts-ignore */
166
+ ...(ngDevMode ? [{ debugName: "defaultInputValue" }] : /* istanbul ignore next */ []));
167
+ open = model(undefined, /* @ts-ignore */
168
+ ...(ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []));
169
+ defaultOpen = input(false, { ...(ngDevMode ? { debugName: "defaultOpen" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
170
+ highlightedValue = model(undefined, /* @ts-ignore */
171
+ ...(ngDevMode ? [{ debugName: "highlightedValue" }] : /* istanbul ignore next */ []));
172
+ defaultHighlightedValue = input(undefined, /* @ts-ignore */
173
+ ...(ngDevMode ? [{ debugName: "defaultHighlightedValue" }] : /* istanbul ignore next */ []));
174
+ disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
175
+ invalid = input(false, { ...(ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
176
+ readOnly = input(false, { ...(ngDevMode ? { debugName: "readOnly" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
177
+ required = input(false, { ...(ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
178
+ multiple = input(false, { ...(ngDevMode ? { debugName: "multiple" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
179
+ allowCustomValue = input(false, { ...(ngDevMode ? { debugName: "allowCustomValue" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
180
+ autoFocus = input(false, { ...(ngDevMode ? { debugName: "autoFocus" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
181
+ openOnClick = input(false, { ...(ngDevMode ? { debugName: "openOnClick" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
182
+ openOnKeyPress = input(undefined, { ...(ngDevMode ? { debugName: "openOnKeyPress" } : /* istanbul ignore next */ {}), transform: (value) => value === undefined || value === null ? undefined : booleanAttribute(value) });
183
+ alwaysSubmitOnEnter = input(false, { ...(ngDevMode ? { debugName: "alwaysSubmitOnEnter" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
184
+ closeOnSelect = input(undefined, { ...(ngDevMode ? { debugName: "closeOnSelect" } : /* istanbul ignore next */ {}), transform: (value) => value === undefined || value === null ? undefined : booleanAttribute(value) });
185
+ loopFocus = input(undefined, { ...(ngDevMode ? { debugName: "loopFocus" } : /* istanbul ignore next */ {}), transform: (value) => value === undefined || value === null ? undefined : booleanAttribute(value) });
186
+ composite = input(undefined, { ...(ngDevMode ? { debugName: "composite" } : /* istanbul ignore next */ {}), transform: (value) => value === undefined || value === null ? undefined : booleanAttribute(value) });
187
+ disableLayer = input(undefined, { ...(ngDevMode ? { debugName: "disableLayer" } : /* istanbul ignore next */ {}), transform: (value) => value === undefined || value === null ? undefined : booleanAttribute(value) });
188
+ inputBehavior = input(undefined, /* @ts-ignore */
189
+ ...(ngDevMode ? [{ debugName: "inputBehavior" }] : /* istanbul ignore next */ []));
190
+ selectionBehavior = input(undefined, /* @ts-ignore */
191
+ ...(ngDevMode ? [{ debugName: "selectionBehavior" }] : /* istanbul ignore next */ []));
192
+ openOnChange = input(undefined, /* @ts-ignore */
193
+ ...(ngDevMode ? [{ debugName: "openOnChange" }] : /* istanbul ignore next */ []));
194
+ placeholder = input(undefined, /* @ts-ignore */
195
+ ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
196
+ name = input(undefined, /* @ts-ignore */
197
+ ...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
198
+ form = input(undefined, /* @ts-ignore */
199
+ ...(ngDevMode ? [{ debugName: "form" }] : /* istanbul ignore next */ []));
200
+ positioning = input(undefined, /* @ts-ignore */
201
+ ...(ngDevMode ? [{ debugName: "positioning" }] : /* istanbul ignore next */ []));
202
+ scrollToIndexFn = input(undefined, /* @ts-ignore */
203
+ ...(ngDevMode ? [{ debugName: "scrollToIndexFn" }] : /* istanbul ignore next */ []));
204
+ navigate = input(undefined, /* @ts-ignore */
205
+ ...(ngDevMode ? [{ debugName: "navigate" }] : /* istanbul ignore next */ []));
206
+ translations = input(undefined, /* @ts-ignore */
207
+ ...(ngDevMode ? [{ debugName: "translations" }] : /* istanbul ignore next */ []));
208
+ valueChangeDetails = output();
209
+ inputValueChangeDetails = output();
210
+ highlightChange = output();
211
+ openChangeDetails = output();
212
+ select = output();
213
+ focusOutside = output();
214
+ pointerDownOutside = output();
215
+ interactOutside = output();
216
+ _disabledFromForm = signal(false, /* @ts-ignore */
217
+ ...(ngDevMode ? [{ debugName: "_disabledFromForm" }] : /* istanbul ignore next */ []));
218
+ _fallbackCollection = new ListCollection({ items: [] });
219
+ _pendingInternalWrites = 0;
220
+ _hasExternalBinding = false;
221
+ _hasReceivedFormWrite = false;
222
+ readCollection() {
223
+ try {
224
+ return this.collection();
225
+ }
226
+ catch {
227
+ return this._fallbackCollection;
228
+ }
229
+ }
230
+ cva = createCvaController({
231
+ value: this.value,
232
+ setDisabled: (disabled) => this._disabledFromForm.set(disabled),
233
+ componentName: "ComboboxRoot",
234
+ hasExternalModelBinding: () => this._hasExternalBinding,
235
+ });
236
+ machine = useCombobox({
237
+ context: () => ({
238
+ id: this.id(),
239
+ ids: this.elementIds(),
240
+ collection: this.readCollection(),
241
+ value: this.value(),
242
+ defaultValue: this.defaultValue() ?? [],
243
+ inputValue: this.inputValue(),
244
+ defaultInputValue: this.defaultInputValue() ?? "",
245
+ open: this.open(),
246
+ defaultOpen: this.defaultOpen() || undefined,
247
+ highlightedValue: this.highlightedValue(),
248
+ defaultHighlightedValue: this.defaultHighlightedValue(),
249
+ disabled: this.disabled() || this._disabledFromForm() || undefined,
250
+ invalid: this.invalid() || undefined,
251
+ readOnly: this.readOnly() || undefined,
252
+ required: this.required() || undefined,
253
+ multiple: this.multiple() || undefined,
254
+ allowCustomValue: this.allowCustomValue() || undefined,
255
+ autoFocus: this.autoFocus() || undefined,
256
+ openOnClick: this.openOnClick() || undefined,
257
+ openOnKeyPress: this.openOnKeyPress(),
258
+ alwaysSubmitOnEnter: this.alwaysSubmitOnEnter() || undefined,
259
+ closeOnSelect: this.closeOnSelect(),
260
+ loopFocus: this.loopFocus(),
261
+ composite: this.composite(),
262
+ disableLayer: this.disableLayer(),
263
+ inputBehavior: this.inputBehavior(),
264
+ selectionBehavior: this.selectionBehavior(),
265
+ openOnChange: this.openOnChange(),
266
+ placeholder: this.placeholder(),
267
+ name: this.name(),
268
+ form: this.form(),
269
+ positioning: this.positioning(),
270
+ scrollToIndexFn: this.scrollToIndexFn(),
271
+ navigate: this.navigate(),
272
+ translations: this.translations(),
273
+ onValueChange: (details) => {
274
+ const current = this.value();
275
+ if (!arraysShallowEqual(current, details.value)) {
276
+ this._pendingInternalWrites++;
277
+ this.value.set([...details.value]);
278
+ }
279
+ this.cva.notifyValueChange(details.value);
280
+ this.cva.markTouched();
281
+ this.valueChangeDetails.emit(details);
282
+ },
283
+ onInputValueChange: (details) => {
284
+ if (this.inputValue() !== details.inputValue) {
285
+ this.inputValue.set(details.inputValue);
286
+ }
287
+ this.inputValueChangeDetails.emit(details);
288
+ },
289
+ onHighlightChange: (details) => {
290
+ const next = details.highlightedValue;
291
+ if (this.highlightedValue() !== next) {
292
+ this.highlightedValue.set(next);
293
+ }
294
+ this.highlightChange.emit(details);
295
+ },
296
+ onOpenChange: (details) => {
297
+ if (this.open() !== details.open) {
298
+ this.open.set(details.open);
299
+ }
300
+ this.openChangeDetails.emit(details);
301
+ },
302
+ onSelect: (details) => {
303
+ this.select.emit(details);
304
+ },
305
+ onFocusOutside: (event) => {
306
+ this.cva.markTouched();
307
+ this.focusOutside.emit(event);
308
+ },
309
+ onPointerDownOutside: (event) => {
310
+ this.pointerDownOutside.emit(event);
311
+ },
312
+ onInteractOutside: (event) => {
313
+ this.interactOutside.emit(event);
314
+ },
315
+ }),
316
+ });
317
+ state = this.machine.state;
318
+ api = this.machine.api;
319
+ service = this.machine.service;
320
+ send = this.machine.send;
321
+ contextCarrier = buildRootCarrier({
322
+ providers: [{ provide: COMBOBOX_PRESENCE, useValue: this }],
323
+ root: this,
324
+ rootToken: COMBOBOX_CONTEXT,
325
+ originInjector: inject(Injector),
326
+ environmentInjector: inject(EnvironmentInjector),
327
+ });
328
+ getContextCarrier() {
329
+ return this.contextCarrier;
330
+ }
331
+ presence = this.createPresence(() => this.api().open);
332
+ constructor() {
333
+ super();
334
+ let firstRunValue = true;
335
+ effect(() => {
336
+ void this.value();
337
+ if (firstRunValue) {
338
+ firstRunValue = false;
339
+ this._pendingInternalWrites = 0;
340
+ return;
341
+ }
342
+ if (this._pendingInternalWrites > 0) {
343
+ this._pendingInternalWrites--;
344
+ return;
345
+ }
346
+ this._hasExternalBinding = true;
347
+ });
348
+ bindProps({
349
+ elementRef: inject(ElementRef),
350
+ renderer: inject(Renderer2),
351
+ destroyRef: inject(DestroyRef),
352
+ props: () => this.api().getRootProps(),
353
+ });
354
+ }
355
+ writeValue(value) {
356
+ const next = value ?? [];
357
+ const current = this.value();
358
+ if (!this._hasReceivedFormWrite && current !== undefined) {
359
+ this._hasExternalBinding = true;
360
+ }
361
+ this._hasReceivedFormWrite = true;
362
+ if (!arraysShallowEqual(current, next)) {
363
+ this._pendingInternalWrites++;
364
+ }
365
+ this.cva.writeValue(next);
366
+ }
367
+ registerOnChange(fn) {
368
+ this.cva.registerOnChange(fn);
369
+ }
370
+ registerOnTouched(fn) {
371
+ this.cva.registerOnTouched(fn);
372
+ }
373
+ setDisabledState(disabled) {
374
+ this.cva.setDisabledState(disabled);
375
+ }
376
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ComboboxRoot, deps: [], target: i0.ɵɵFactoryTarget.Directive });
377
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: ComboboxRoot, isStandalone: true, selector: "[comboboxRoot]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, elementIds: { classPropertyName: "elementIds", publicName: "ids", isSignal: true, isRequired: false, transformFunction: null }, collection: { classPropertyName: "collection", publicName: "collection", isSignal: true, isRequired: true, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, defaultValue: { classPropertyName: "defaultValue", publicName: "defaultValue", isSignal: true, isRequired: false, transformFunction: null }, inputValue: { classPropertyName: "inputValue", publicName: "inputValue", isSignal: true, isRequired: false, transformFunction: null }, defaultInputValue: { classPropertyName: "defaultInputValue", publicName: "defaultInputValue", isSignal: true, isRequired: false, transformFunction: null }, open: { classPropertyName: "open", publicName: "open", isSignal: true, isRequired: false, transformFunction: null }, defaultOpen: { classPropertyName: "defaultOpen", publicName: "defaultOpen", isSignal: true, isRequired: false, transformFunction: null }, highlightedValue: { classPropertyName: "highlightedValue", publicName: "highlightedValue", isSignal: true, isRequired: false, transformFunction: null }, defaultHighlightedValue: { classPropertyName: "defaultHighlightedValue", publicName: "defaultHighlightedValue", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, readOnly: { classPropertyName: "readOnly", publicName: "readOnly", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, allowCustomValue: { classPropertyName: "allowCustomValue", publicName: "allowCustomValue", isSignal: true, isRequired: false, transformFunction: null }, autoFocus: { classPropertyName: "autoFocus", publicName: "autoFocus", isSignal: true, isRequired: false, transformFunction: null }, openOnClick: { classPropertyName: "openOnClick", publicName: "openOnClick", isSignal: true, isRequired: false, transformFunction: null }, openOnKeyPress: { classPropertyName: "openOnKeyPress", publicName: "openOnKeyPress", isSignal: true, isRequired: false, transformFunction: null }, alwaysSubmitOnEnter: { classPropertyName: "alwaysSubmitOnEnter", publicName: "alwaysSubmitOnEnter", isSignal: true, isRequired: false, transformFunction: null }, closeOnSelect: { classPropertyName: "closeOnSelect", publicName: "closeOnSelect", isSignal: true, isRequired: false, transformFunction: null }, loopFocus: { classPropertyName: "loopFocus", publicName: "loopFocus", isSignal: true, isRequired: false, transformFunction: null }, composite: { classPropertyName: "composite", publicName: "composite", isSignal: true, isRequired: false, transformFunction: null }, disableLayer: { classPropertyName: "disableLayer", publicName: "disableLayer", isSignal: true, isRequired: false, transformFunction: null }, inputBehavior: { classPropertyName: "inputBehavior", publicName: "inputBehavior", isSignal: true, isRequired: false, transformFunction: null }, selectionBehavior: { classPropertyName: "selectionBehavior", publicName: "selectionBehavior", isSignal: true, isRequired: false, transformFunction: null }, openOnChange: { classPropertyName: "openOnChange", publicName: "openOnChange", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: false, transformFunction: null }, positioning: { classPropertyName: "positioning", publicName: "positioning", isSignal: true, isRequired: false, transformFunction: null }, scrollToIndexFn: { classPropertyName: "scrollToIndexFn", publicName: "scrollToIndexFn", isSignal: true, isRequired: false, transformFunction: null }, navigate: { classPropertyName: "navigate", publicName: "navigate", isSignal: true, isRequired: false, transformFunction: null }, translations: { classPropertyName: "translations", publicName: "translations", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", inputValue: "inputValueChange", open: "openChange", highlightedValue: "highlightedValueChange", valueChangeDetails: "valueChangeDetails", inputValueChangeDetails: "inputValueChangeDetails", highlightChange: "highlightChange", openChangeDetails: "openChangeDetails", select: "select", focusOutside: "focusOutside", pointerDownOutside: "pointerDownOutside", interactOutside: "interactOutside" }, providers: [
378
+ { provide: COMBOBOX_PRESENCE, useExisting: forwardRef(() => ComboboxRoot) },
379
+ { provide: COMBOBOX_CONTEXT, useExisting: forwardRef(() => ComboboxRoot) },
380
+ {
381
+ provide: COMBOBOX_CONTEXT_CARRIER,
382
+ useFactory: (root) => root.getContextCarrier(),
383
+ deps: [forwardRef(() => ComboboxRoot)],
384
+ },
385
+ { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => ComboboxRoot), multi: true },
386
+ ], exportAs: ["comboboxRoot"], usesInheritance: true, ngImport: i0 });
387
+ }
388
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ComboboxRoot, decorators: [{
389
+ type: Directive,
390
+ args: [{
391
+ selector: "[comboboxRoot]",
392
+ standalone: true,
393
+ exportAs: "comboboxRoot",
394
+ providers: [
395
+ { provide: COMBOBOX_PRESENCE, useExisting: forwardRef(() => ComboboxRoot) },
396
+ { provide: COMBOBOX_CONTEXT, useExisting: forwardRef(() => ComboboxRoot) },
397
+ {
398
+ provide: COMBOBOX_CONTEXT_CARRIER,
399
+ useFactory: (root) => root.getContextCarrier(),
400
+ deps: [forwardRef(() => ComboboxRoot)],
401
+ },
402
+ { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => ComboboxRoot), multi: true },
403
+ ],
404
+ }]
405
+ }], ctorParameters: () => [], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], elementIds: [{ type: i0.Input, args: [{ isSignal: true, alias: "ids", required: false }] }], collection: [{ type: i0.Input, args: [{ isSignal: true, alias: "collection", required: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], defaultValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultValue", required: false }] }], inputValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputValue", required: false }] }, { type: i0.Output, args: ["inputValueChange"] }], defaultInputValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultInputValue", required: false }] }], open: [{ type: i0.Input, args: [{ isSignal: true, alias: "open", required: false }] }, { type: i0.Output, args: ["openChange"] }], defaultOpen: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultOpen", required: false }] }], highlightedValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "highlightedValue", required: false }] }, { type: i0.Output, args: ["highlightedValueChange"] }], defaultHighlightedValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultHighlightedValue", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], readOnly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readOnly", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], allowCustomValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowCustomValue", required: false }] }], autoFocus: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoFocus", required: false }] }], openOnClick: [{ type: i0.Input, args: [{ isSignal: true, alias: "openOnClick", required: false }] }], openOnKeyPress: [{ type: i0.Input, args: [{ isSignal: true, alias: "openOnKeyPress", required: false }] }], alwaysSubmitOnEnter: [{ type: i0.Input, args: [{ isSignal: true, alias: "alwaysSubmitOnEnter", required: false }] }], closeOnSelect: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOnSelect", required: false }] }], loopFocus: [{ type: i0.Input, args: [{ isSignal: true, alias: "loopFocus", required: false }] }], composite: [{ type: i0.Input, args: [{ isSignal: true, alias: "composite", required: false }] }], disableLayer: [{ type: i0.Input, args: [{ isSignal: true, alias: "disableLayer", required: false }] }], inputBehavior: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputBehavior", required: false }] }], selectionBehavior: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectionBehavior", required: false }] }], openOnChange: [{ type: i0.Input, args: [{ isSignal: true, alias: "openOnChange", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], form: [{ type: i0.Input, args: [{ isSignal: true, alias: "form", required: false }] }], positioning: [{ type: i0.Input, args: [{ isSignal: true, alias: "positioning", required: false }] }], scrollToIndexFn: [{ type: i0.Input, args: [{ isSignal: true, alias: "scrollToIndexFn", required: false }] }], navigate: [{ type: i0.Input, args: [{ isSignal: true, alias: "navigate", required: false }] }], translations: [{ type: i0.Input, args: [{ isSignal: true, alias: "translations", required: false }] }], valueChangeDetails: [{ type: i0.Output, args: ["valueChangeDetails"] }], inputValueChangeDetails: [{ type: i0.Output, args: ["inputValueChangeDetails"] }], highlightChange: [{ type: i0.Output, args: ["highlightChange"] }], openChangeDetails: [{ type: i0.Output, args: ["openChangeDetails"] }], select: [{ type: i0.Output, args: ["select"] }], focusOutside: [{ type: i0.Output, args: ["focusOutside"] }], pointerDownOutside: [{ type: i0.Output, args: ["pointerDownOutside"] }], interactOutside: [{ type: i0.Output, args: ["interactOutside"] }] } });
406
+ function arraysShallowEqual(a, b) {
407
+ if (a === b)
408
+ return true;
409
+ if (!a || !b)
410
+ return false;
411
+ if (a.length !== b.length)
412
+ return false;
413
+ for (let i = 0; i < a.length; i++) {
414
+ if (a[i] !== b[i])
415
+ return false;
416
+ }
417
+ return true;
418
+ }
419
+
420
+ class ComboboxRootProvider extends ComboboxPresence {
421
+ value = input.required(/* @ts-ignore */
422
+ ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
423
+ get state() {
424
+ return this.value().state;
425
+ }
426
+ get api() {
427
+ return this.value().api;
428
+ }
429
+ get service() {
430
+ return this.value().service;
431
+ }
432
+ get send() {
433
+ return this.value().send;
434
+ }
435
+ resolveValue() {
436
+ return this.value();
437
+ }
438
+ contextCarrier = buildRootCarrier({
439
+ providers: [{ provide: COMBOBOX_PRESENCE, useValue: this }],
440
+ root: this,
441
+ rootToken: COMBOBOX_CONTEXT,
442
+ originInjector: inject(Injector),
443
+ environmentInjector: inject(EnvironmentInjector),
444
+ });
445
+ getContextCarrier() {
446
+ return this.contextCarrier;
447
+ }
448
+ presence = this.createPresence(() => {
449
+ try {
450
+ return this.api().open;
451
+ }
452
+ catch {
453
+ return false;
454
+ }
455
+ });
456
+ constructor() {
457
+ super();
458
+ bindProps({
459
+ elementRef: inject(ElementRef),
460
+ renderer: inject(Renderer2),
461
+ destroyRef: inject(DestroyRef),
462
+ props: () => this.value().api().getRootProps(),
463
+ });
464
+ }
465
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ComboboxRootProvider, deps: [], target: i0.ɵɵFactoryTarget.Directive });
466
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: ComboboxRootProvider, isStandalone: true, selector: "[comboboxRootProvider]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null } }, providers: [
467
+ { provide: COMBOBOX_PRESENCE, useExisting: forwardRef(() => ComboboxRootProvider) },
468
+ { provide: COMBOBOX_CONTEXT, useExisting: forwardRef(() => ComboboxRootProvider) },
469
+ {
470
+ provide: COMBOBOX_CONTEXT_CARRIER,
471
+ useFactory: (provider) => provider.getContextCarrier(),
472
+ deps: [forwardRef(() => ComboboxRootProvider)],
473
+ },
474
+ ], exportAs: ["comboboxRootProvider"], usesInheritance: true, ngImport: i0 });
475
+ }
476
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ComboboxRootProvider, decorators: [{
477
+ type: Directive,
478
+ args: [{
479
+ selector: "[comboboxRootProvider]",
480
+ standalone: true,
481
+ exportAs: "comboboxRootProvider",
482
+ providers: [
483
+ { provide: COMBOBOX_PRESENCE, useExisting: forwardRef(() => ComboboxRootProvider) },
484
+ { provide: COMBOBOX_CONTEXT, useExisting: forwardRef(() => ComboboxRootProvider) },
485
+ {
486
+ provide: COMBOBOX_CONTEXT_CARRIER,
487
+ useFactory: (provider) => provider.getContextCarrier(),
488
+ deps: [forwardRef(() => ComboboxRootProvider)],
489
+ },
490
+ ],
491
+ }]
492
+ }], ctorParameters: () => [], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }] } });
493
+
494
+ class ComboboxLabel {
495
+ constructor() {
496
+ const context = injectComboboxContext();
497
+ bindProps({
498
+ elementRef: inject(ElementRef),
499
+ renderer: inject(Renderer2),
500
+ destroyRef: inject(DestroyRef),
501
+ props: () => context.api().getLabelProps(),
502
+ });
503
+ }
504
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ComboboxLabel, deps: [], target: i0.ɵɵFactoryTarget.Directive });
505
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: ComboboxLabel, isStandalone: true, selector: "[comboboxLabel]", exportAs: ["comboboxLabel"], ngImport: i0 });
506
+ }
507
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ComboboxLabel, decorators: [{
508
+ type: Directive,
509
+ args: [{
510
+ selector: "[comboboxLabel]",
511
+ standalone: true,
512
+ exportAs: "comboboxLabel",
513
+ }]
514
+ }], ctorParameters: () => [] });
515
+
516
+ class ComboboxControl {
517
+ constructor() {
518
+ const context = injectComboboxContext();
519
+ bindProps({
520
+ elementRef: inject(ElementRef),
521
+ renderer: inject(Renderer2),
522
+ destroyRef: inject(DestroyRef),
523
+ props: () => context.api().getControlProps(),
524
+ });
525
+ }
526
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ComboboxControl, deps: [], target: i0.ɵɵFactoryTarget.Directive });
527
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: ComboboxControl, isStandalone: true, selector: "[comboboxControl]", exportAs: ["comboboxControl"], ngImport: i0 });
528
+ }
529
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ComboboxControl, decorators: [{
530
+ type: Directive,
531
+ args: [{
532
+ selector: "[comboboxControl]",
533
+ standalone: true,
534
+ exportAs: "comboboxControl",
535
+ }]
536
+ }], ctorParameters: () => [] });
537
+
538
+ class ComboboxInput {
539
+ constructor() {
540
+ const context = injectComboboxContext();
541
+ const field = injectFieldContextOptional();
542
+ const elementRef = inject(ElementRef);
543
+ const renderer = inject(Renderer2);
544
+ const destroyRef = inject(DestroyRef);
545
+ const inputValue = computed(() => context.api().inputValue, /* @ts-ignore */
546
+ ...(ngDevMode ? [{ debugName: "inputValue" }] : /* istanbul ignore next */ []));
547
+ const composing = signal(false, /* @ts-ignore */
548
+ ...(ngDevMode ? [{ debugName: "composing" }] : /* istanbul ignore next */ []));
549
+ let upstreamCompositionStart;
550
+ let upstreamCompositionEnd;
551
+ const onCompositionStart = (event) => {
552
+ composing.set(true);
553
+ if (typeof upstreamCompositionStart === "function") {
554
+ upstreamCompositionStart(event);
555
+ }
556
+ };
557
+ const onCompositionEnd = (event) => {
558
+ composing.set(false);
559
+ if (typeof upstreamCompositionEnd === "function") {
560
+ upstreamCompositionEnd(event);
561
+ }
562
+ };
563
+ bindProps({
564
+ elementRef,
565
+ renderer,
566
+ destroyRef,
567
+ props: () => {
568
+ const props = context.api().getInputProps();
569
+ const { defaultValue: _defaultValue, ...rest } = props;
570
+ const describedBy = field?.ariaDescribedby();
571
+ if (describedBy) {
572
+ rest["aria-describedby"] = describedBy;
573
+ }
574
+ upstreamCompositionStart = rest["onCompositionStart"];
575
+ upstreamCompositionEnd = rest["onCompositionEnd"];
576
+ rest["onCompositionStart"] = onCompositionStart;
577
+ rest["onCompositionEnd"] = onCompositionEnd;
578
+ return rest;
579
+ },
580
+ });
581
+ effect(() => {
582
+ const el = elementRef.nativeElement;
583
+ if (!el || composing())
584
+ return;
585
+ const next = inputValue();
586
+ if (el.value !== next)
587
+ el.value = next;
588
+ });
589
+ }
590
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ComboboxInput, deps: [], target: i0.ɵɵFactoryTarget.Directive });
591
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: ComboboxInput, isStandalone: true, selector: "[comboboxInput]", exportAs: ["comboboxInput"], ngImport: i0 });
592
+ }
593
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ComboboxInput, decorators: [{
594
+ type: Directive,
595
+ args: [{
596
+ selector: "[comboboxInput]",
597
+ standalone: true,
598
+ exportAs: "comboboxInput",
599
+ }]
600
+ }], ctorParameters: () => [] });
601
+
602
+ class ComboboxTrigger {
603
+ focusable = input(undefined, { ...(ngDevMode ? { debugName: "focusable" } : /* istanbul ignore next */ {}), transform: (value) => value === undefined || value === null ? undefined : booleanAttribute(value) });
604
+ constructor() {
605
+ const context = injectComboboxContext();
606
+ bindProps({
607
+ elementRef: inject(ElementRef),
608
+ renderer: inject(Renderer2),
609
+ destroyRef: inject(DestroyRef),
610
+ props: () => context.api().getTriggerProps({ focusable: this.focusable() }),
611
+ });
612
+ }
613
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ComboboxTrigger, deps: [], target: i0.ɵɵFactoryTarget.Directive });
614
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: ComboboxTrigger, isStandalone: true, selector: "[comboboxTrigger]", inputs: { focusable: { classPropertyName: "focusable", publicName: "focusable", isSignal: true, isRequired: false, transformFunction: null } }, exportAs: ["comboboxTrigger"], ngImport: i0 });
615
+ }
616
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ComboboxTrigger, decorators: [{
617
+ type: Directive,
618
+ args: [{
619
+ selector: "[comboboxTrigger]",
620
+ standalone: true,
621
+ exportAs: "comboboxTrigger",
622
+ }]
623
+ }], ctorParameters: () => [], propDecorators: { focusable: [{ type: i0.Input, args: [{ isSignal: true, alias: "focusable", required: false }] }] } });
624
+
625
+ class ComboboxClearTrigger {
626
+ constructor() {
627
+ const context = injectComboboxContext();
628
+ bindProps({
629
+ elementRef: inject(ElementRef),
630
+ renderer: inject(Renderer2),
631
+ destroyRef: inject(DestroyRef),
632
+ props: () => context.api().getClearTriggerProps(),
633
+ });
634
+ }
635
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ComboboxClearTrigger, deps: [], target: i0.ɵɵFactoryTarget.Directive });
636
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: ComboboxClearTrigger, isStandalone: true, selector: "[comboboxClearTrigger]", exportAs: ["comboboxClearTrigger"], ngImport: i0 });
637
+ }
638
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ComboboxClearTrigger, decorators: [{
639
+ type: Directive,
640
+ args: [{
641
+ selector: "[comboboxClearTrigger]",
642
+ standalone: true,
643
+ exportAs: "comboboxClearTrigger",
644
+ }]
645
+ }], ctorParameters: () => [] });
646
+
647
+ class ComboboxPositioner {
648
+ constructor() {
649
+ const context = injectComboboxContext();
650
+ const { presence } = inject(COMBOBOX_PRESENCE);
651
+ const template = inject((TemplateRef), { optional: true });
652
+ const container = inject(ViewContainerRef);
653
+ const host = inject(ElementRef);
654
+ const elementRef = template ? { nativeElement: null } : host;
655
+ let view;
656
+ effect(() => {
657
+ const unmounted = presence.isUnmounted();
658
+ if (template) {
659
+ if (unmounted) {
660
+ elementRef.nativeElement = null;
661
+ container.clear();
662
+ view = undefined;
663
+ }
664
+ else if (!view) {
665
+ view = container.createEmbeddedView(template);
666
+ elementRef.nativeElement =
667
+ view.rootNodes.find((node) => node.nodeType === 1) ?? null;
668
+ }
669
+ }
670
+ });
671
+ bindProps({
672
+ elementRef,
673
+ renderer: inject(Renderer2),
674
+ destroyRef: inject(DestroyRef),
675
+ props: () => {
676
+ presence.isUnmounted();
677
+ return { ...context.api().getPositionerProps(), hidden: presence.isUnmounted() };
678
+ },
679
+ });
680
+ }
681
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ComboboxPositioner, deps: [], target: i0.ɵɵFactoryTarget.Directive });
682
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: ComboboxPositioner, isStandalone: true, selector: "[comboboxPositioner]", exportAs: ["comboboxPositioner"], ngImport: i0 });
683
+ }
684
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ComboboxPositioner, decorators: [{
685
+ type: Directive,
686
+ args: [{ selector: "[comboboxPositioner]", standalone: true, exportAs: "comboboxPositioner" }]
687
+ }], ctorParameters: () => [] });
688
+
689
+ class ComboboxList {
690
+ constructor() {
691
+ const context = injectComboboxContext();
692
+ bindProps({
693
+ elementRef: inject(ElementRef),
694
+ renderer: inject(Renderer2),
695
+ destroyRef: inject(DestroyRef),
696
+ props: () => context.api().getListProps(),
697
+ });
698
+ }
699
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ComboboxList, deps: [], target: i0.ɵɵFactoryTarget.Directive });
700
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: ComboboxList, isStandalone: true, selector: "[comboboxList]", exportAs: ["comboboxList"], ngImport: i0 });
701
+ }
702
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ComboboxList, decorators: [{
703
+ type: Directive,
704
+ args: [{
705
+ selector: "[comboboxList]",
706
+ standalone: true,
707
+ exportAs: "comboboxList",
708
+ }]
709
+ }], ctorParameters: () => [] });
710
+
711
+ const parts = comboboxAnatomy.build();
712
+ class ComboboxEmpty {
713
+ constructor() {
714
+ const context = injectComboboxContext();
715
+ const elementRef = inject(ElementRef);
716
+ const renderer = inject(Renderer2);
717
+ const destroyRef = inject(DestroyRef);
718
+ bindProps({
719
+ elementRef,
720
+ renderer,
721
+ destroyRef,
722
+ props: () => ({
723
+ ...parts.empty.attrs,
724
+ role: "presentation",
725
+ style: { display: context.api().collection.size === 0 ? undefined : "none" },
726
+ }),
727
+ });
728
+ }
729
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ComboboxEmpty, deps: [], target: i0.ɵɵFactoryTarget.Directive });
730
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: ComboboxEmpty, isStandalone: true, selector: "[comboboxEmpty]", exportAs: ["comboboxEmpty"], ngImport: i0 });
731
+ }
732
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ComboboxEmpty, decorators: [{
733
+ type: Directive,
734
+ args: [{
735
+ selector: "[comboboxEmpty]",
736
+ standalone: true,
737
+ exportAs: "comboboxEmpty",
738
+ }]
739
+ }], ctorParameters: () => [] });
740
+
741
+ const COMBOBOX_ITEM_GROUP_CONTEXT = new InjectionToken("WIREKYT.COMBOBOX_ITEM_GROUP_CONTEXT");
742
+ function injectComboboxItemGroupContext() {
743
+ const context = inject(COMBOBOX_ITEM_GROUP_CONTEXT, { optional: true });
744
+ if (!context) {
745
+ throw new Error("COMBOBOX_ITEM_GROUP_CONTEXT not found: an item-group-label directive must be used inside an [comboboxItemGroup] directive.");
746
+ }
747
+ return context;
748
+ }
749
+ class ComboboxItemGroup {
750
+ groupId = input(undefined, { ...(ngDevMode ? { debugName: "groupId" } : /* istanbul ignore next */ {}), alias: "id" });
751
+ fallbackId = createId();
752
+ id = computed(() => this.groupId() ?? this.fallbackId, /* @ts-ignore */
753
+ ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
754
+ constructor() {
755
+ const context = injectComboboxContext();
756
+ bindProps({
757
+ elementRef: inject(ElementRef),
758
+ renderer: inject(Renderer2),
759
+ destroyRef: inject(DestroyRef),
760
+ props: () => context.api().getItemGroupProps({ id: this.id() }),
761
+ });
762
+ }
763
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ComboboxItemGroup, deps: [], target: i0.ɵɵFactoryTarget.Directive });
764
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: ComboboxItemGroup, isStandalone: true, selector: "[comboboxItemGroup]", inputs: { groupId: { classPropertyName: "groupId", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
765
+ { provide: COMBOBOX_ITEM_GROUP_CONTEXT, useExisting: forwardRef(() => ComboboxItemGroup) },
766
+ ], exportAs: ["comboboxItemGroup"], ngImport: i0 });
767
+ }
768
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ComboboxItemGroup, decorators: [{
769
+ type: Directive,
770
+ args: [{
771
+ selector: "[comboboxItemGroup]",
772
+ standalone: true,
773
+ exportAs: "comboboxItemGroup",
774
+ providers: [
775
+ { provide: COMBOBOX_ITEM_GROUP_CONTEXT, useExisting: forwardRef(() => ComboboxItemGroup) },
776
+ ],
777
+ }]
778
+ }], ctorParameters: () => [], propDecorators: { groupId: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }] } });
779
+
780
+ class ComboboxItemGroupLabel {
781
+ constructor() {
782
+ const context = injectComboboxContext();
783
+ const group = injectComboboxItemGroupContext();
784
+ bindProps({
785
+ elementRef: inject(ElementRef),
786
+ renderer: inject(Renderer2),
787
+ destroyRef: inject(DestroyRef),
788
+ props: () => context.api().getItemGroupLabelProps({ htmlFor: group.id() }),
789
+ });
790
+ }
791
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ComboboxItemGroupLabel, deps: [], target: i0.ɵɵFactoryTarget.Directive });
792
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: ComboboxItemGroupLabel, isStandalone: true, selector: "[comboboxItemGroupLabel]", exportAs: ["comboboxItemGroupLabel"], ngImport: i0 });
793
+ }
794
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ComboboxItemGroupLabel, decorators: [{
795
+ type: Directive,
796
+ args: [{
797
+ selector: "[comboboxItemGroupLabel]",
798
+ standalone: true,
799
+ exportAs: "comboboxItemGroupLabel",
800
+ }]
801
+ }], ctorParameters: () => [] });
802
+
803
+ const COMBOBOX_ITEM_CONTEXT = new InjectionToken("WIREKYT.COMBOBOX_ITEM_CONTEXT");
804
+ function injectComboboxItemContext() {
805
+ const context = inject(COMBOBOX_ITEM_CONTEXT, { optional: true });
806
+ if (!context) {
807
+ throw new Error("COMBOBOX_ITEM_CONTEXT not found: a combobox item part directive must be used inside an [comboboxItem] directive.");
808
+ }
809
+ return context;
810
+ }
811
+
812
+ class ComboboxItem {
813
+ item = input.required(/* @ts-ignore */
814
+ ...(ngDevMode ? [{ debugName: "item" }] : /* istanbul ignore next */ []));
815
+ persistFocus = input(undefined, { ...(ngDevMode ? { debugName: "persistFocus" } : /* istanbul ignore next */ {}), transform: (value) => value === undefined || value === null ? undefined : booleanAttribute(value) });
816
+ context = injectComboboxContext();
817
+ state = computed(() => this.context.api().getItemState({ item: this.item(), persistFocus: this.persistFocus() }), /* @ts-ignore */
818
+ ...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
819
+ constructor() {
820
+ const context = this.context;
821
+ bindProps({
822
+ elementRef: inject(ElementRef),
823
+ renderer: inject(Renderer2),
824
+ destroyRef: inject(DestroyRef),
825
+ props: () => context.api().getItemProps({ item: this.item(), persistFocus: this.persistFocus() }),
826
+ });
827
+ }
828
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ComboboxItem, deps: [], target: i0.ɵɵFactoryTarget.Directive });
829
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: ComboboxItem, isStandalone: true, selector: "[comboboxItem]", inputs: { item: { classPropertyName: "item", publicName: "item", isSignal: true, isRequired: true, transformFunction: null }, persistFocus: { classPropertyName: "persistFocus", publicName: "persistFocus", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: COMBOBOX_ITEM_CONTEXT, useExisting: forwardRef(() => ComboboxItem) }], exportAs: ["comboboxItem"], ngImport: i0 });
830
+ }
831
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ComboboxItem, decorators: [{
832
+ type: Directive,
833
+ args: [{
834
+ selector: "[comboboxItem]",
835
+ standalone: true,
836
+ exportAs: "comboboxItem",
837
+ providers: [{ provide: COMBOBOX_ITEM_CONTEXT, useExisting: forwardRef(() => ComboboxItem) }],
838
+ }]
839
+ }], ctorParameters: () => [], propDecorators: { item: [{ type: i0.Input, args: [{ isSignal: true, alias: "item", required: true }] }], persistFocus: [{ type: i0.Input, args: [{ isSignal: true, alias: "persistFocus", required: false }] }] } });
840
+
841
+ class ComboboxItemText {
842
+ constructor() {
843
+ const context = injectComboboxContext();
844
+ const item = injectComboboxItemContext();
845
+ bindProps({
846
+ elementRef: inject(ElementRef),
847
+ renderer: inject(Renderer2),
848
+ destroyRef: inject(DestroyRef),
849
+ props: () => context.api().getItemTextProps({ item: item.item(), persistFocus: item.persistFocus() }),
850
+ });
851
+ }
852
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ComboboxItemText, deps: [], target: i0.ɵɵFactoryTarget.Directive });
853
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: ComboboxItemText, isStandalone: true, selector: "[comboboxItemText]", exportAs: ["comboboxItemText"], ngImport: i0 });
854
+ }
855
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ComboboxItemText, decorators: [{
856
+ type: Directive,
857
+ args: [{
858
+ selector: "[comboboxItemText]",
859
+ standalone: true,
860
+ exportAs: "comboboxItemText",
861
+ }]
862
+ }], ctorParameters: () => [] });
863
+
864
+ class ComboboxItemIndicator {
865
+ constructor() {
866
+ const context = injectComboboxContext();
867
+ const item = injectComboboxItemContext();
868
+ bindProps({
869
+ elementRef: inject(ElementRef),
870
+ renderer: inject(Renderer2),
871
+ destroyRef: inject(DestroyRef),
872
+ props: () => context
873
+ .api()
874
+ .getItemIndicatorProps({ item: item.item(), persistFocus: item.persistFocus() }),
875
+ });
876
+ }
877
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ComboboxItemIndicator, deps: [], target: i0.ɵɵFactoryTarget.Directive });
878
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: ComboboxItemIndicator, isStandalone: true, selector: "[comboboxItemIndicator]", exportAs: ["comboboxItemIndicator"], ngImport: i0 });
879
+ }
880
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ComboboxItemIndicator, decorators: [{
881
+ type: Directive,
882
+ args: [{
883
+ selector: "[comboboxItemIndicator]",
884
+ standalone: true,
885
+ exportAs: "comboboxItemIndicator",
886
+ }]
887
+ }], ctorParameters: () => [] });
888
+
889
+ class ComboboxContext {
890
+ static ngTemplateContextGuard(_directive, context) {
891
+ void context;
892
+ return true;
893
+ }
894
+ combobox = injectComboboxContext();
895
+ templateRef = inject(TemplateRef);
896
+ viewContainer = inject(ViewContainerRef);
897
+ constructor() {
898
+ const view = this.viewContainer.createEmbeddedView(this.templateRef, {
899
+ $implicit: this.combobox.api,
900
+ api: this.combobox.api,
901
+ });
902
+ effect(() => {
903
+ this.combobox.api();
904
+ view.detectChanges();
905
+ });
906
+ }
907
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ComboboxContext, deps: [], target: i0.ɵɵFactoryTarget.Directive });
908
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: ComboboxContext, isStandalone: true, selector: "[comboboxContext]", exportAs: ["comboboxContext"], ngImport: i0 });
909
+ }
910
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ComboboxContext, decorators: [{
911
+ type: Directive,
912
+ args: [{
913
+ selector: "[comboboxContext]",
914
+ standalone: true,
915
+ exportAs: "comboboxContext",
916
+ }]
917
+ }], ctorParameters: () => [] });
918
+
919
+ class ComboboxItemContextDirective {
920
+ static ngTemplateContextGuard(_directive, context) {
921
+ void context;
922
+ return true;
923
+ }
924
+ item = injectComboboxItemContext();
925
+ templateRef = inject(TemplateRef);
926
+ viewContainer = inject(ViewContainerRef);
927
+ constructor() {
928
+ const view = this.viewContainer.createEmbeddedView(this.templateRef, {
929
+ $implicit: this.item,
930
+ item: this.item,
931
+ });
932
+ effect(() => {
933
+ this.item.state();
934
+ view.detectChanges();
935
+ });
936
+ inject(DestroyRef).onDestroy(() => view.destroy());
937
+ }
938
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ComboboxItemContextDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
939
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: ComboboxItemContextDirective, isStandalone: true, selector: "[comboboxItemContext]", exportAs: ["comboboxItemContext"], ngImport: i0 });
940
+ }
941
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ComboboxItemContextDirective, decorators: [{
942
+ type: Directive,
943
+ args: [{
944
+ selector: "[comboboxItemContext]",
945
+ standalone: true,
946
+ exportAs: "comboboxItemContext",
947
+ }]
948
+ }], ctorParameters: () => [] });
949
+
950
+ /**
951
+ * Generated bundle index. Do not edit.
952
+ */
953
+
954
+ export { COMBOBOX_CONTEXT, COMBOBOX_CONTEXT_CARRIER, COMBOBOX_ITEM_CONTEXT, COMBOBOX_ITEM_GROUP_CONTEXT, ComboboxClearTrigger, ComboboxContent, ComboboxContext, ComboboxControl, ComboboxEmpty, ComboboxInput, ComboboxItem, ComboboxItemContextDirective, ComboboxItemGroup, ComboboxItemGroupLabel, ComboboxItemIndicator, ComboboxItemText, ComboboxLabel, ComboboxList, ComboboxPositioner, ComboboxRoot, ComboboxRootProvider, ComboboxTrigger, comboboxAnatomy, injectComboboxContext, injectComboboxContextCarrier, injectComboboxItemContext, injectComboboxItemGroupContext, useCombobox };
955
+ //# sourceMappingURL=wirekyt-angular-combobox.mjs.map