@wirekyt/angular 0.0.29 → 0.0.30

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