@wirekyt/angular 0.0.26 → 0.0.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/fesm2022/wirekyt-angular-date-input.mjs +0 -1
  2. package/dist/fesm2022/wirekyt-angular-date-input.mjs.map +1 -1
  3. package/dist/fesm2022/wirekyt-angular-drawer.mjs +0 -2
  4. package/dist/fesm2022/wirekyt-angular-drawer.mjs.map +1 -1
  5. package/dist/fesm2022/wirekyt-angular-editable.mjs +0 -28
  6. package/dist/fesm2022/wirekyt-angular-editable.mjs.map +1 -1
  7. package/dist/fesm2022/wirekyt-angular-file-upload.mjs +604 -0
  8. package/dist/fesm2022/wirekyt-angular-file-upload.mjs.map +1 -0
  9. package/dist/fesm2022/wirekyt-angular-floating-panel.mjs +0 -36
  10. package/dist/fesm2022/wirekyt-angular-floating-panel.mjs.map +1 -1
  11. package/dist/fesm2022/wirekyt-angular-hover-card.mjs +430 -0
  12. package/dist/fesm2022/wirekyt-angular-hover-card.mjs.map +1 -0
  13. package/dist/fesm2022/wirekyt-angular-popover.mjs +567 -0
  14. package/dist/fesm2022/wirekyt-angular-popover.mjs.map +1 -0
  15. package/dist/fesm2022/wirekyt-angular-tooltip.mjs +438 -0
  16. package/dist/fesm2022/wirekyt-angular-tooltip.mjs.map +1 -0
  17. package/dist/package.json +17 -1
  18. package/dist/types/wirekyt-angular-checkbox.d.ts +1 -1
  19. package/dist/types/wirekyt-angular-color-picker.d.ts +1 -1
  20. package/dist/types/wirekyt-angular-combobox.d.ts +1 -1
  21. package/dist/types/wirekyt-angular-date-input.d.ts +0 -1
  22. package/dist/types/wirekyt-angular-date-input.d.ts.map +1 -1
  23. package/dist/types/wirekyt-angular-date-picker.d.ts +1 -1
  24. package/dist/types/wirekyt-angular-drawer.d.ts +0 -2
  25. package/dist/types/wirekyt-angular-drawer.d.ts.map +1 -1
  26. package/dist/types/wirekyt-angular-editable.d.ts +0 -28
  27. package/dist/types/wirekyt-angular-editable.d.ts.map +1 -1
  28. package/dist/types/wirekyt-angular-file-upload.d.ts +182 -0
  29. package/dist/types/wirekyt-angular-file-upload.d.ts.map +1 -0
  30. package/dist/types/wirekyt-angular-floating-panel.d.ts +0 -36
  31. package/dist/types/wirekyt-angular-floating-panel.d.ts.map +1 -1
  32. package/dist/types/wirekyt-angular-hover-card.d.ts +122 -0
  33. package/dist/types/wirekyt-angular-hover-card.d.ts.map +1 -0
  34. package/dist/types/wirekyt-angular-popover.d.ts +166 -0
  35. package/dist/types/wirekyt-angular-popover.d.ts.map +1 -0
  36. package/dist/types/wirekyt-angular-tooltip.d.ts +126 -0
  37. package/dist/types/wirekyt-angular-tooltip.d.ts.map +1 -0
  38. package/package.json +18 -2
@@ -0,0 +1,604 @@
1
+ import * as fileUpload from '@wirekyt/dom/machines/file-upload';
2
+ export { anatomy as fileUploadAnatomy } from '@wirekyt/dom/machines/file-upload';
3
+ import * as i0 from '@angular/core';
4
+ import { InjectionToken, inject, TemplateRef, ViewContainerRef, effect, DestroyRef, Directive, numberAttribute, input, booleanAttribute, model, output, Renderer2, ElementRef, forwardRef, computed, signal, untracked } from '@angular/core';
5
+ import { injectLocale, injectEnvironment, createId, useMachine, bindProps } from '@wirekyt/angular';
6
+ import { injectFieldContextOptional } from '@wirekyt/angular/field';
7
+
8
+ const FILE_UPLOAD_CONTEXT = new InjectionToken("WIREKYT.FILE_UPLOAD_CONTEXT");
9
+ function injectFileUploadContext() {
10
+ return inject(FILE_UPLOAD_CONTEXT);
11
+ }
12
+
13
+ class FileUploadContext {
14
+ static ngTemplateContextGuard(_directive, context) {
15
+ void context;
16
+ return true;
17
+ }
18
+ fileUpload = injectFileUploadContext();
19
+ templateRef = inject(TemplateRef);
20
+ viewContainer = inject(ViewContainerRef);
21
+ constructor() {
22
+ const view = this.viewContainer.createEmbeddedView(this.templateRef, {
23
+ $implicit: this.fileUpload.api,
24
+ api: this.fileUpload.api,
25
+ });
26
+ effect(() => {
27
+ this.fileUpload.api();
28
+ view.detectChanges();
29
+ });
30
+ inject(DestroyRef).onDestroy(() => view.destroy());
31
+ }
32
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: FileUploadContext, deps: [], target: i0.ɵɵFactoryTarget.Directive });
33
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: FileUploadContext, isStandalone: true, selector: "[file-upload-context]", exportAs: ["fileUploadContext"], ngImport: i0 });
34
+ }
35
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: FileUploadContext, decorators: [{
36
+ type: Directive,
37
+ args: [{
38
+ selector: "[file-upload-context]",
39
+ standalone: true,
40
+ exportAs: "fileUploadContext",
41
+ }]
42
+ }], ctorParameters: () => [] });
43
+
44
+ const FILE_UPLOAD_ITEM_CONTEXT = new InjectionToken("WIREKYT.FILE_UPLOAD_ITEM_CONTEXT");
45
+ function injectFileUploadItemContext() {
46
+ const context = inject(FILE_UPLOAD_ITEM_CONTEXT, { optional: true });
47
+ if (!context) {
48
+ throw new Error("FILE_UPLOAD_ITEM_CONTEXT not found: a file-upload item part directive must be used inside a [file-upload-item] directive.");
49
+ }
50
+ return context;
51
+ }
52
+
53
+ function useFileUpload(options) {
54
+ const locale = injectLocale();
55
+ const environment = injectEnvironment();
56
+ const field = injectFieldContextOptional();
57
+ const fallbackId = createId();
58
+ return useMachine({
59
+ machine: fileUpload.machine,
60
+ context: () => {
61
+ const props = options.context();
62
+ const id = props.id ?? fallbackId;
63
+ const merged = {
64
+ dir: locale.dir,
65
+ locale: locale.locale,
66
+ getRootNode: environment.getRootNode,
67
+ ...props,
68
+ id,
69
+ };
70
+ if (field) {
71
+ const fieldIds = field.ids;
72
+ const baseIds = (props.ids ?? {});
73
+ merged.ids = {
74
+ label: fieldIds.label,
75
+ hiddenInput: fieldIds.control,
76
+ ...baseIds,
77
+ };
78
+ const disabled = Boolean(props.disabled) || field.disabled();
79
+ const invalid = Boolean(props.invalid) || field.invalid();
80
+ const readOnly = Boolean(props.readOnly) || field.readOnly();
81
+ const required = Boolean(props.required) || field.required();
82
+ merged.disabled = disabled || undefined;
83
+ merged.invalid = invalid || undefined;
84
+ merged.readOnly = readOnly || undefined;
85
+ merged.required = required || undefined;
86
+ }
87
+ return merged;
88
+ },
89
+ connect: (service, normalize) => fileUpload.connect(service, normalize),
90
+ });
91
+ }
92
+
93
+ const optionalNumberAttribute = (value) => {
94
+ if (value === null || value === undefined || value === "")
95
+ return undefined;
96
+ const next = numberAttribute(value);
97
+ return Number.isFinite(next) ? next : undefined;
98
+ };
99
+ class FileUploadRoot {
100
+ id = input(undefined, /* @ts-ignore */
101
+ ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
102
+ elementIds = input(undefined, { ...(ngDevMode ? { debugName: "elementIds" } : /* istanbul ignore next */ {}), alias: "ids" });
103
+ translations = input(undefined, /* @ts-ignore */
104
+ ...(ngDevMode ? [{ debugName: "translations" }] : /* istanbul ignore next */ []));
105
+ name = input(undefined, /* @ts-ignore */
106
+ ...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
107
+ accept = input(undefined, /* @ts-ignore */
108
+ ...(ngDevMode ? [{ debugName: "accept" }] : /* istanbul ignore next */ []));
109
+ disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
110
+ required = input(false, { ...(ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
111
+ invalid = input(false, { ...(ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
112
+ readOnly = input(false, { ...(ngDevMode ? { debugName: "readOnly" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
113
+ allowDrop = input(undefined, { ...(ngDevMode ? { debugName: "allowDrop" } : /* istanbul ignore next */ {}), transform: (value) => value === undefined || value === null ? undefined : booleanAttribute(value) });
114
+ maxFileSize = input(undefined, { ...(ngDevMode ? { debugName: "maxFileSize" } : /* istanbul ignore next */ {}), transform: optionalNumberAttribute });
115
+ minFileSize = input(undefined, { ...(ngDevMode ? { debugName: "minFileSize" } : /* istanbul ignore next */ {}), transform: optionalNumberAttribute });
116
+ maxFiles = input(undefined, { ...(ngDevMode ? { debugName: "maxFiles" } : /* istanbul ignore next */ {}), transform: optionalNumberAttribute });
117
+ preventDocumentDrop = input(undefined, { ...(ngDevMode ? { debugName: "preventDocumentDrop" } : /* istanbul ignore next */ {}), transform: (value) => value === undefined || value === null ? undefined : booleanAttribute(value) });
118
+ validate = input(undefined, /* @ts-ignore */
119
+ ...(ngDevMode ? [{ debugName: "validate" }] : /* istanbul ignore next */ []));
120
+ defaultAcceptedFiles = input(undefined, /* @ts-ignore */
121
+ ...(ngDevMode ? [{ debugName: "defaultAcceptedFiles" }] : /* istanbul ignore next */ []));
122
+ acceptedFiles = model(undefined, /* @ts-ignore */
123
+ ...(ngDevMode ? [{ debugName: "acceptedFiles" }] : /* istanbul ignore next */ []));
124
+ capture = input(undefined, /* @ts-ignore */
125
+ ...(ngDevMode ? [{ debugName: "capture" }] : /* istanbul ignore next */ []));
126
+ directory = input(undefined, { ...(ngDevMode ? { debugName: "directory" } : /* istanbul ignore next */ {}), transform: (value) => value === undefined || value === null ? undefined : booleanAttribute(value) });
127
+ transformFiles = input(undefined, /* @ts-ignore */
128
+ ...(ngDevMode ? [{ debugName: "transformFiles" }] : /* istanbul ignore next */ []));
129
+ locale = input(undefined, /* @ts-ignore */
130
+ ...(ngDevMode ? [{ debugName: "locale" }] : /* istanbul ignore next */ []));
131
+ fileChange = output();
132
+ fileAccept = output();
133
+ fileReject = output();
134
+ machine = useFileUpload({
135
+ context: () => ({
136
+ id: this.id(),
137
+ ids: this.elementIds(),
138
+ translations: this.translations(),
139
+ name: this.name(),
140
+ accept: this.accept(),
141
+ disabled: this.disabled() || undefined,
142
+ required: this.required() || undefined,
143
+ invalid: this.invalid() || undefined,
144
+ readOnly: this.readOnly() || undefined,
145
+ allowDrop: this.allowDrop(),
146
+ maxFileSize: this.maxFileSize(),
147
+ minFileSize: this.minFileSize(),
148
+ maxFiles: this.maxFiles(),
149
+ preventDocumentDrop: this.preventDocumentDrop(),
150
+ validate: this.validate(),
151
+ defaultAcceptedFiles: this.defaultAcceptedFiles(),
152
+ acceptedFiles: this.acceptedFiles(),
153
+ capture: this.capture(),
154
+ directory: this.directory(),
155
+ transformFiles: this.transformFiles(),
156
+ locale: this.locale(),
157
+ onFileChange: (details) => {
158
+ if (!filesShallowEqual(this.acceptedFiles(), details.acceptedFiles)) {
159
+ this.acceptedFiles.set([...details.acceptedFiles]);
160
+ }
161
+ this.fileChange.emit(details);
162
+ },
163
+ onFileAccept: (details) => this.fileAccept.emit(details),
164
+ onFileReject: (details) => this.fileReject.emit(details),
165
+ }),
166
+ });
167
+ state = this.machine.state;
168
+ api = this.machine.api;
169
+ service = this.machine.service;
170
+ send = this.machine.send;
171
+ constructor() {
172
+ bindProps({
173
+ elementRef: inject(ElementRef),
174
+ renderer: inject(Renderer2),
175
+ destroyRef: inject(DestroyRef),
176
+ props: () => this.api().getRootProps(),
177
+ });
178
+ }
179
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: FileUploadRoot, deps: [], target: i0.ɵɵFactoryTarget.Directive });
180
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: FileUploadRoot, isStandalone: true, selector: "[file-upload-root]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, elementIds: { classPropertyName: "elementIds", publicName: "ids", isSignal: true, isRequired: false, transformFunction: null }, translations: { classPropertyName: "translations", publicName: "translations", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, accept: { classPropertyName: "accept", publicName: "accept", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", 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 }, allowDrop: { classPropertyName: "allowDrop", publicName: "allowDrop", isSignal: true, isRequired: false, transformFunction: null }, maxFileSize: { classPropertyName: "maxFileSize", publicName: "maxFileSize", isSignal: true, isRequired: false, transformFunction: null }, minFileSize: { classPropertyName: "minFileSize", publicName: "minFileSize", isSignal: true, isRequired: false, transformFunction: null }, maxFiles: { classPropertyName: "maxFiles", publicName: "maxFiles", isSignal: true, isRequired: false, transformFunction: null }, preventDocumentDrop: { classPropertyName: "preventDocumentDrop", publicName: "preventDocumentDrop", isSignal: true, isRequired: false, transformFunction: null }, validate: { classPropertyName: "validate", publicName: "validate", isSignal: true, isRequired: false, transformFunction: null }, defaultAcceptedFiles: { classPropertyName: "defaultAcceptedFiles", publicName: "defaultAcceptedFiles", isSignal: true, isRequired: false, transformFunction: null }, acceptedFiles: { classPropertyName: "acceptedFiles", publicName: "acceptedFiles", isSignal: true, isRequired: false, transformFunction: null }, capture: { classPropertyName: "capture", publicName: "capture", isSignal: true, isRequired: false, transformFunction: null }, directory: { classPropertyName: "directory", publicName: "directory", isSignal: true, isRequired: false, transformFunction: null }, transformFiles: { classPropertyName: "transformFiles", publicName: "transformFiles", isSignal: true, isRequired: false, transformFunction: null }, locale: { classPropertyName: "locale", publicName: "locale", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { acceptedFiles: "acceptedFilesChange", fileChange: "fileChange", fileAccept: "fileAccept", fileReject: "fileReject" }, providers: [{ provide: FILE_UPLOAD_CONTEXT, useExisting: forwardRef(() => FileUploadRoot) }], exportAs: ["fileUploadRoot"], ngImport: i0 });
181
+ }
182
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: FileUploadRoot, decorators: [{
183
+ type: Directive,
184
+ args: [{
185
+ selector: "[file-upload-root]",
186
+ standalone: true,
187
+ exportAs: "fileUploadRoot",
188
+ providers: [{ provide: FILE_UPLOAD_CONTEXT, useExisting: forwardRef(() => FileUploadRoot) }],
189
+ }]
190
+ }], ctorParameters: () => [], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], elementIds: [{ type: i0.Input, args: [{ isSignal: true, alias: "ids", required: false }] }], translations: [{ type: i0.Input, args: [{ isSignal: true, alias: "translations", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], accept: [{ type: i0.Input, args: [{ isSignal: true, alias: "accept", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], readOnly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readOnly", required: false }] }], allowDrop: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowDrop", required: false }] }], maxFileSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxFileSize", required: false }] }], minFileSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "minFileSize", required: false }] }], maxFiles: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxFiles", required: false }] }], preventDocumentDrop: [{ type: i0.Input, args: [{ isSignal: true, alias: "preventDocumentDrop", required: false }] }], validate: [{ type: i0.Input, args: [{ isSignal: true, alias: "validate", required: false }] }], defaultAcceptedFiles: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultAcceptedFiles", required: false }] }], acceptedFiles: [{ type: i0.Input, args: [{ isSignal: true, alias: "acceptedFiles", required: false }] }, { type: i0.Output, args: ["acceptedFilesChange"] }], capture: [{ type: i0.Input, args: [{ isSignal: true, alias: "capture", required: false }] }], directory: [{ type: i0.Input, args: [{ isSignal: true, alias: "directory", required: false }] }], transformFiles: [{ type: i0.Input, args: [{ isSignal: true, alias: "transformFiles", required: false }] }], locale: [{ type: i0.Input, args: [{ isSignal: true, alias: "locale", required: false }] }], fileChange: [{ type: i0.Output, args: ["fileChange"] }], fileAccept: [{ type: i0.Output, args: ["fileAccept"] }], fileReject: [{ type: i0.Output, args: ["fileReject"] }] } });
191
+ const filesShallowEqual = (a, b) => Array.isArray(a) && a.length === b.length && a.every((file, index) => file === b[index]);
192
+
193
+ class FileUploadRootProvider {
194
+ value = input.required(/* @ts-ignore */
195
+ ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
196
+ state = computed(() => this.value().state(), /* @ts-ignore */
197
+ ...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
198
+ api = computed(() => this.value().api(), /* @ts-ignore */
199
+ ...(ngDevMode ? [{ debugName: "api" }] : /* istanbul ignore next */ []));
200
+ send = (event) => this.value().send(event);
201
+ get service() {
202
+ return this.value().service;
203
+ }
204
+ resolveValue() {
205
+ return this.value();
206
+ }
207
+ constructor() {
208
+ bindProps({
209
+ elementRef: inject(ElementRef),
210
+ renderer: inject(Renderer2),
211
+ destroyRef: inject(DestroyRef),
212
+ props: () => this.api().getRootProps(),
213
+ });
214
+ }
215
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: FileUploadRootProvider, deps: [], target: i0.ɵɵFactoryTarget.Directive });
216
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: FileUploadRootProvider, isStandalone: true, selector: "[file-upload-root-provider]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null } }, providers: [
217
+ { provide: FILE_UPLOAD_CONTEXT, useExisting: forwardRef(() => FileUploadRootProvider) },
218
+ ], exportAs: ["fileUploadRootProvider"], ngImport: i0 });
219
+ }
220
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: FileUploadRootProvider, decorators: [{
221
+ type: Directive,
222
+ args: [{
223
+ selector: "[file-upload-root-provider]",
224
+ standalone: true,
225
+ exportAs: "fileUploadRootProvider",
226
+ providers: [
227
+ { provide: FILE_UPLOAD_CONTEXT, useExisting: forwardRef(() => FileUploadRootProvider) },
228
+ ],
229
+ }]
230
+ }], ctorParameters: () => [], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }] } });
231
+
232
+ class FileUploadLabel {
233
+ constructor() {
234
+ const context = injectFileUploadContext();
235
+ bindProps({
236
+ elementRef: inject(ElementRef),
237
+ renderer: inject(Renderer2),
238
+ destroyRef: inject(DestroyRef),
239
+ props: () => context.api().getLabelProps(),
240
+ });
241
+ }
242
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: FileUploadLabel, deps: [], target: i0.ɵɵFactoryTarget.Directive });
243
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: FileUploadLabel, isStandalone: true, selector: "[file-upload-label]", exportAs: ["fileUploadLabel"], ngImport: i0 });
244
+ }
245
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: FileUploadLabel, decorators: [{
246
+ type: Directive,
247
+ args: [{
248
+ selector: "[file-upload-label]",
249
+ standalone: true,
250
+ exportAs: "fileUploadLabel",
251
+ }]
252
+ }], ctorParameters: () => [] });
253
+
254
+ class FileUploadTrigger {
255
+ constructor() {
256
+ const context = injectFileUploadContext();
257
+ bindProps({
258
+ elementRef: inject(ElementRef),
259
+ renderer: inject(Renderer2),
260
+ destroyRef: inject(DestroyRef),
261
+ props: () => context.api().getTriggerProps(),
262
+ });
263
+ }
264
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: FileUploadTrigger, deps: [], target: i0.ɵɵFactoryTarget.Directive });
265
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: FileUploadTrigger, isStandalone: true, selector: "[file-upload-trigger]", exportAs: ["fileUploadTrigger"], ngImport: i0 });
266
+ }
267
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: FileUploadTrigger, decorators: [{
268
+ type: Directive,
269
+ args: [{
270
+ selector: "[file-upload-trigger]",
271
+ standalone: true,
272
+ exportAs: "fileUploadTrigger",
273
+ }]
274
+ }], ctorParameters: () => [] });
275
+
276
+ class FileUploadDropzone {
277
+ disableClick = input(undefined, { ...(ngDevMode ? { debugName: "disableClick" } : /* istanbul ignore next */ {}), transform: (value) => value === undefined || value === null ? undefined : booleanAttribute(value) });
278
+ constructor() {
279
+ const context = injectFileUploadContext();
280
+ bindProps({
281
+ elementRef: inject(ElementRef),
282
+ renderer: inject(Renderer2),
283
+ destroyRef: inject(DestroyRef),
284
+ props: () => context.api().getDropzoneProps({ disableClick: this.disableClick() }),
285
+ });
286
+ }
287
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: FileUploadDropzone, deps: [], target: i0.ɵɵFactoryTarget.Directive });
288
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: FileUploadDropzone, isStandalone: true, selector: "[file-upload-dropzone]", inputs: { disableClick: { classPropertyName: "disableClick", publicName: "disableClick", isSignal: true, isRequired: false, transformFunction: null } }, exportAs: ["fileUploadDropzone"], ngImport: i0 });
289
+ }
290
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: FileUploadDropzone, decorators: [{
291
+ type: Directive,
292
+ args: [{
293
+ selector: "[file-upload-dropzone]",
294
+ standalone: true,
295
+ exportAs: "fileUploadDropzone",
296
+ }]
297
+ }], ctorParameters: () => [], propDecorators: { disableClick: [{ type: i0.Input, args: [{ isSignal: true, alias: "disableClick", required: false }] }] } });
298
+
299
+ class FileUploadHiddenInput {
300
+ constructor() {
301
+ const context = injectFileUploadContext();
302
+ const field = injectFieldContextOptional();
303
+ bindProps({
304
+ elementRef: inject(ElementRef),
305
+ renderer: inject(Renderer2),
306
+ destroyRef: inject(DestroyRef),
307
+ props: () => ({
308
+ ...context.api().getHiddenInputProps(),
309
+ "aria-describedby": field?.ariaDescribedby(),
310
+ }),
311
+ });
312
+ }
313
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: FileUploadHiddenInput, deps: [], target: i0.ɵɵFactoryTarget.Directive });
314
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: FileUploadHiddenInput, isStandalone: true, selector: "input[file-upload-hidden-input]", exportAs: ["fileUploadHiddenInput"], ngImport: i0 });
315
+ }
316
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: FileUploadHiddenInput, decorators: [{
317
+ type: Directive,
318
+ args: [{
319
+ selector: "input[file-upload-hidden-input]",
320
+ standalone: true,
321
+ exportAs: "fileUploadHiddenInput",
322
+ }]
323
+ }], ctorParameters: () => [] });
324
+
325
+ class FileUploadClearTrigger {
326
+ constructor() {
327
+ const context = injectFileUploadContext();
328
+ bindProps({
329
+ elementRef: inject(ElementRef),
330
+ renderer: inject(Renderer2),
331
+ destroyRef: inject(DestroyRef),
332
+ props: () => context.api().getClearTriggerProps(),
333
+ });
334
+ }
335
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: FileUploadClearTrigger, deps: [], target: i0.ɵɵFactoryTarget.Directive });
336
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: FileUploadClearTrigger, isStandalone: true, selector: "[file-upload-clear-trigger]", exportAs: ["fileUploadClearTrigger"], ngImport: i0 });
337
+ }
338
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: FileUploadClearTrigger, decorators: [{
339
+ type: Directive,
340
+ args: [{
341
+ selector: "[file-upload-clear-trigger]",
342
+ standalone: true,
343
+ exportAs: "fileUploadClearTrigger",
344
+ }]
345
+ }], ctorParameters: () => [] });
346
+
347
+ const FILE_UPLOAD_ITEM_GROUP_CONTEXT = new InjectionToken("WIREKYT.FILE_UPLOAD_ITEM_GROUP_CONTEXT");
348
+ function injectFileUploadItemGroupContextOptional() {
349
+ return inject(FILE_UPLOAD_ITEM_GROUP_CONTEXT, { optional: true });
350
+ }
351
+ class FileUploadItemGroup {
352
+ type = input(undefined, /* @ts-ignore */
353
+ ...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
354
+ constructor() {
355
+ const context = injectFileUploadContext();
356
+ const typeSignal = computed(() => this.type(), /* @ts-ignore */
357
+ ...(ngDevMode ? [{ debugName: "typeSignal" }] : /* istanbul ignore next */ []));
358
+ bindProps({
359
+ elementRef: inject(ElementRef),
360
+ renderer: inject(Renderer2),
361
+ destroyRef: inject(DestroyRef),
362
+ props: () => context.api().getItemGroupProps({ type: typeSignal() }),
363
+ });
364
+ }
365
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: FileUploadItemGroup, deps: [], target: i0.ɵɵFactoryTarget.Directive });
366
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: FileUploadItemGroup, isStandalone: true, selector: "[file-upload-item-group]", inputs: { type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
367
+ { provide: FILE_UPLOAD_ITEM_GROUP_CONTEXT, useExisting: forwardRef(() => FileUploadItemGroup) },
368
+ ], exportAs: ["fileUploadItemGroup"], ngImport: i0 });
369
+ }
370
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: FileUploadItemGroup, decorators: [{
371
+ type: Directive,
372
+ args: [{
373
+ selector: "[file-upload-item-group]",
374
+ standalone: true,
375
+ exportAs: "fileUploadItemGroup",
376
+ providers: [
377
+ { provide: FILE_UPLOAD_ITEM_GROUP_CONTEXT, useExisting: forwardRef(() => FileUploadItemGroup) },
378
+ ],
379
+ }]
380
+ }], ctorParameters: () => [], propDecorators: { type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }] } });
381
+
382
+ class FileUploadItem {
383
+ file = input.required(/* @ts-ignore */
384
+ ...(ngDevMode ? [{ debugName: "file" }] : /* istanbul ignore next */ []));
385
+ group = injectFileUploadItemGroupContextOptional();
386
+ type = computed(() => this.group?.type(), /* @ts-ignore */
387
+ ...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
388
+ constructor() {
389
+ const context = injectFileUploadContext();
390
+ bindProps({
391
+ elementRef: inject(ElementRef),
392
+ renderer: inject(Renderer2),
393
+ destroyRef: inject(DestroyRef),
394
+ props: () => context.api().getItemProps({ file: this.file(), type: this.type() }),
395
+ });
396
+ }
397
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: FileUploadItem, deps: [], target: i0.ɵɵFactoryTarget.Directive });
398
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: FileUploadItem, isStandalone: true, selector: "[file-upload-item]", inputs: { file: { classPropertyName: "file", publicName: "file", isSignal: true, isRequired: true, transformFunction: null } }, providers: [{ provide: FILE_UPLOAD_ITEM_CONTEXT, useExisting: forwardRef(() => FileUploadItem) }], exportAs: ["fileUploadItem"], ngImport: i0 });
399
+ }
400
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: FileUploadItem, decorators: [{
401
+ type: Directive,
402
+ args: [{
403
+ selector: "[file-upload-item]",
404
+ standalone: true,
405
+ exportAs: "fileUploadItem",
406
+ providers: [{ provide: FILE_UPLOAD_ITEM_CONTEXT, useExisting: forwardRef(() => FileUploadItem) }],
407
+ }]
408
+ }], ctorParameters: () => [], propDecorators: { file: [{ type: i0.Input, args: [{ isSignal: true, alias: "file", required: true }] }] } });
409
+
410
+ class FileUploadItemName {
411
+ constructor() {
412
+ const context = injectFileUploadContext();
413
+ const item = injectFileUploadItemContext();
414
+ const elementRef = inject(ElementRef);
415
+ const renderer = inject(Renderer2);
416
+ const destroyRef = inject(DestroyRef);
417
+ let ownsTextContent = false;
418
+ effect(() => {
419
+ const fileName = item.file().name;
420
+ queueMicrotask(() => {
421
+ if (!ownsTextContent && elementRef.nativeElement.textContent?.trim().length !== 0)
422
+ return;
423
+ ownsTextContent = true;
424
+ renderer.setProperty(elementRef.nativeElement, "textContent", fileName);
425
+ });
426
+ });
427
+ bindProps({
428
+ elementRef,
429
+ renderer,
430
+ destroyRef,
431
+ props: () => context.api().getItemNameProps({ file: item.file(), type: item.type() }),
432
+ });
433
+ }
434
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: FileUploadItemName, deps: [], target: i0.ɵɵFactoryTarget.Directive });
435
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: FileUploadItemName, isStandalone: true, selector: "[file-upload-item-name]", exportAs: ["fileUploadItemName"], ngImport: i0 });
436
+ }
437
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: FileUploadItemName, decorators: [{
438
+ type: Directive,
439
+ args: [{
440
+ selector: "[file-upload-item-name]",
441
+ standalone: true,
442
+ exportAs: "fileUploadItemName",
443
+ }]
444
+ }], ctorParameters: () => [] });
445
+
446
+ class FileUploadItemSizeText {
447
+ constructor() {
448
+ const context = injectFileUploadContext();
449
+ const item = injectFileUploadItemContext();
450
+ const elementRef = inject(ElementRef);
451
+ const renderer = inject(Renderer2);
452
+ const destroyRef = inject(DestroyRef);
453
+ let ownsTextContent = false;
454
+ effect(() => {
455
+ const sizeText = context.api().getFileSize(item.file());
456
+ queueMicrotask(() => {
457
+ if (!ownsTextContent && elementRef.nativeElement.textContent?.trim().length !== 0)
458
+ return;
459
+ ownsTextContent = true;
460
+ renderer.setProperty(elementRef.nativeElement, "textContent", sizeText);
461
+ });
462
+ });
463
+ bindProps({
464
+ elementRef,
465
+ renderer,
466
+ destroyRef,
467
+ props: () => context.api().getItemSizeTextProps({ file: item.file(), type: item.type() }),
468
+ });
469
+ }
470
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: FileUploadItemSizeText, deps: [], target: i0.ɵɵFactoryTarget.Directive });
471
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: FileUploadItemSizeText, isStandalone: true, selector: "[file-upload-item-size-text]", exportAs: ["fileUploadItemSizeText"], ngImport: i0 });
472
+ }
473
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: FileUploadItemSizeText, decorators: [{
474
+ type: Directive,
475
+ args: [{
476
+ selector: "[file-upload-item-size-text]",
477
+ standalone: true,
478
+ exportAs: "fileUploadItemSizeText",
479
+ }]
480
+ }], ctorParameters: () => [] });
481
+
482
+ class FileUploadItemPreview {
483
+ type = input(undefined, /* @ts-ignore */
484
+ ...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
485
+ context = injectFileUploadContext();
486
+ item = injectFileUploadItemContext();
487
+ matches = computed(() => {
488
+ const pattern = this.type();
489
+ if (!pattern || pattern === "*/*")
490
+ return true;
491
+ const mimeType = this.item.file().type;
492
+ if (pattern.endsWith("/*")) {
493
+ return mimeType.startsWith(pattern.slice(0, -1));
494
+ }
495
+ if (/[\^$*?()[\]{}|\\]/.test(pattern)) {
496
+ try {
497
+ return new RegExp(pattern).test(mimeType);
498
+ }
499
+ catch {
500
+ return false;
501
+ }
502
+ }
503
+ return mimeType === pattern;
504
+ }, /* @ts-ignore */
505
+ ...(ngDevMode ? [{ debugName: "matches" }] : /* istanbul ignore next */ []));
506
+ constructor() {
507
+ bindProps({
508
+ elementRef: inject(ElementRef),
509
+ renderer: inject(Renderer2),
510
+ destroyRef: inject(DestroyRef),
511
+ props: () => ({
512
+ ...this.context
513
+ .api()
514
+ .getItemPreviewProps({ file: this.item.file(), type: this.item.type() }),
515
+ hidden: this.matches() ? undefined : true,
516
+ }),
517
+ });
518
+ }
519
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: FileUploadItemPreview, deps: [], target: i0.ɵɵFactoryTarget.Directive });
520
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: FileUploadItemPreview, isStandalone: true, selector: "[file-upload-item-preview]", inputs: { type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null } }, exportAs: ["fileUploadItemPreview"], ngImport: i0 });
521
+ }
522
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: FileUploadItemPreview, decorators: [{
523
+ type: Directive,
524
+ args: [{
525
+ selector: "[file-upload-item-preview]",
526
+ standalone: true,
527
+ exportAs: "fileUploadItemPreview",
528
+ }]
529
+ }], ctorParameters: () => [], propDecorators: { type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }] } });
530
+
531
+ class FileUploadItemPreviewImage {
532
+ urlSignal = signal(undefined, /* @ts-ignore */
533
+ ...(ngDevMode ? [{ debugName: "urlSignal" }] : /* istanbul ignore next */ []));
534
+ url = this.urlSignal.asReadonly();
535
+ constructor() {
536
+ const context = injectFileUploadContext();
537
+ const item = injectFileUploadItemContext();
538
+ effect((onCleanup) => {
539
+ const file = item.file();
540
+ if (!file.type.startsWith("image/")) {
541
+ this.urlSignal.set(undefined);
542
+ return;
543
+ }
544
+ const revoke = untracked(() => context.api().createFileUrl(file, (url) => untracked(() => this.urlSignal.set(url))));
545
+ onCleanup(() => {
546
+ this.urlSignal.set(undefined);
547
+ revoke();
548
+ });
549
+ });
550
+ bindProps({
551
+ elementRef: inject(ElementRef),
552
+ renderer: inject(Renderer2),
553
+ destroyRef: inject(DestroyRef),
554
+ props: () => {
555
+ const url = this.urlSignal();
556
+ if (!url)
557
+ return { hidden: true };
558
+ return context
559
+ .api()
560
+ .getItemPreviewImageProps({ file: item.file(), type: item.type(), url });
561
+ },
562
+ });
563
+ }
564
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: FileUploadItemPreviewImage, deps: [], target: i0.ɵɵFactoryTarget.Directive });
565
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: FileUploadItemPreviewImage, isStandalone: true, selector: "img[file-upload-item-preview-image]", exportAs: ["fileUploadItemPreviewImage"], ngImport: i0 });
566
+ }
567
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: FileUploadItemPreviewImage, decorators: [{
568
+ type: Directive,
569
+ args: [{
570
+ selector: "img[file-upload-item-preview-image]",
571
+ standalone: true,
572
+ exportAs: "fileUploadItemPreviewImage",
573
+ }]
574
+ }], ctorParameters: () => [] });
575
+
576
+ class FileUploadItemDeleteTrigger {
577
+ constructor() {
578
+ const context = injectFileUploadContext();
579
+ const item = injectFileUploadItemContext();
580
+ bindProps({
581
+ elementRef: inject(ElementRef),
582
+ renderer: inject(Renderer2),
583
+ destroyRef: inject(DestroyRef),
584
+ props: () => context.api().getItemDeleteTriggerProps({ file: item.file(), type: item.type() }),
585
+ });
586
+ }
587
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: FileUploadItemDeleteTrigger, deps: [], target: i0.ɵɵFactoryTarget.Directive });
588
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: FileUploadItemDeleteTrigger, isStandalone: true, selector: "[file-upload-item-delete-trigger]", exportAs: ["fileUploadItemDeleteTrigger"], ngImport: i0 });
589
+ }
590
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: FileUploadItemDeleteTrigger, decorators: [{
591
+ type: Directive,
592
+ args: [{
593
+ selector: "[file-upload-item-delete-trigger]",
594
+ standalone: true,
595
+ exportAs: "fileUploadItemDeleteTrigger",
596
+ }]
597
+ }], ctorParameters: () => [] });
598
+
599
+ /**
600
+ * Generated bundle index. Do not edit.
601
+ */
602
+
603
+ export { FILE_UPLOAD_CONTEXT, FILE_UPLOAD_ITEM_CONTEXT, FILE_UPLOAD_ITEM_GROUP_CONTEXT, FileUploadClearTrigger, FileUploadContext, FileUploadDropzone, FileUploadHiddenInput, FileUploadItem, FileUploadItemDeleteTrigger, FileUploadItemGroup, FileUploadItemName, FileUploadItemPreview, FileUploadItemPreviewImage, FileUploadItemSizeText, FileUploadLabel, FileUploadRoot, FileUploadRootProvider, FileUploadTrigger, injectFileUploadContext, injectFileUploadItemContext, injectFileUploadItemGroupContextOptional, useFileUpload };
604
+ //# sourceMappingURL=wirekyt-angular-file-upload.mjs.map