polymorph-ui-components 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/dist/Chat/Chat.svelte +144 -0
  2. package/dist/Chat/Chat.svelte.d.ts +4 -0
  3. package/dist/Chat/controller.svelte.d.ts +24 -0
  4. package/dist/Chat/controller.svelte.js +190 -0
  5. package/dist/Chat/properties.d.ts +50 -0
  6. package/dist/Chat/properties.js +1 -0
  7. package/dist/Chat/roles.d.ts +2 -0
  8. package/dist/Chat/roles.js +3 -0
  9. package/dist/Chat/types.d.ts +45 -0
  10. package/dist/Chat/types.js +1 -0
  11. package/dist/ChatBubble/ChatBubble.svelte +390 -0
  12. package/dist/ChatBubble/ChatBubble.svelte.d.ts +4 -0
  13. package/dist/ChatBubble/properties.d.ts +40 -0
  14. package/dist/ChatBubble/properties.js +1 -0
  15. package/dist/ChatComposer/ChatComposer.svelte +284 -0
  16. package/dist/ChatComposer/ChatComposer.svelte.d.ts +4 -0
  17. package/dist/ChatComposer/properties.d.ts +33 -0
  18. package/dist/ChatComposer/properties.js +1 -0
  19. package/dist/ChatHeader/ChatHeader.svelte +165 -0
  20. package/dist/ChatHeader/ChatHeader.svelte.d.ts +4 -0
  21. package/dist/ChatHeader/properties.d.ts +19 -0
  22. package/dist/ChatHeader/properties.js +1 -0
  23. package/dist/ChatMessage/ChatMessage.svelte +325 -0
  24. package/dist/ChatMessage/ChatMessage.svelte.d.ts +4 -0
  25. package/dist/ChatMessage/properties.d.ts +29 -0
  26. package/dist/ChatMessage/properties.js +1 -0
  27. package/dist/ChatMessageList/ChatMessageList.svelte +175 -0
  28. package/dist/ChatMessageList/ChatMessageList.svelte.d.ts +4 -0
  29. package/dist/ChatMessageList/properties.d.ts +21 -0
  30. package/dist/ChatMessageList/properties.js +1 -0
  31. package/dist/ChatSuggestions/ChatSuggestions.svelte +42 -0
  32. package/dist/ChatSuggestions/ChatSuggestions.svelte.d.ts +4 -0
  33. package/dist/ChatSuggestions/properties.d.ts +16 -0
  34. package/dist/ChatSuggestions/properties.js +1 -0
  35. package/dist/ChatToolStatus/ChatToolStatus.svelte +56 -0
  36. package/dist/ChatToolStatus/ChatToolStatus.svelte.d.ts +4 -0
  37. package/dist/ChatToolStatus/properties.d.ts +10 -0
  38. package/dist/ChatToolStatus/properties.js +1 -0
  39. package/dist/Draggable/Draggable.svelte +169 -0
  40. package/dist/Draggable/Draggable.svelte.d.ts +4 -0
  41. package/dist/Draggable/properties.d.ts +25 -0
  42. package/dist/Draggable/properties.js +1 -0
  43. package/dist/MediaPlayer/MediaPlayer.svelte +245 -0
  44. package/dist/MediaPlayer/MediaPlayer.svelte.d.ts +4 -0
  45. package/dist/MediaPlayer/properties.d.ts +27 -0
  46. package/dist/MediaPlayer/properties.js +1 -0
  47. package/dist/MediaUpload/MediaUpload.svelte +524 -0
  48. package/dist/MediaUpload/MediaUpload.svelte.d.ts +4 -0
  49. package/dist/MediaUpload/properties.d.ts +46 -0
  50. package/dist/MediaUpload/properties.js +1 -0
  51. package/dist/Resizable/Resizable.svelte +295 -0
  52. package/dist/Resizable/Resizable.svelte.d.ts +4 -0
  53. package/dist/Resizable/properties.d.ts +27 -0
  54. package/dist/Resizable/properties.js +1 -0
  55. package/dist/assets/add.svg +4 -0
  56. package/dist/assets/attach.svg +3 -0
  57. package/dist/assets/chat.svg +3 -0
  58. package/dist/assets/file.svg +4 -0
  59. package/dist/assets/mic.svg +5 -0
  60. package/dist/assets/mute.svg +5 -0
  61. package/dist/assets/pause.svg +4 -0
  62. package/dist/assets/play.svg +3 -0
  63. package/dist/assets/retry.svg +4 -0
  64. package/dist/assets/send.svg +4 -0
  65. package/dist/assets/stop.svg +3 -0
  66. package/dist/assets/thumb-down.svg +4 -0
  67. package/dist/assets/thumb-up.svg +4 -0
  68. package/dist/assets/volume.svg +5 -0
  69. package/dist/index.d.ts +27 -0
  70. package/dist/index.js +14 -0
  71. package/package.json +1 -1
@@ -0,0 +1,524 @@
1
+ <script lang="ts">
2
+ import Button from '../Button/Button.svelte';
3
+ import Img from '../Img/Img.svelte';
4
+ import Shimmer from '../Shimmer/Shimmer.svelte';
5
+ import addSvg from '../assets/add.svg?raw';
6
+ import closeSvg from '../assets/close.svg?raw';
7
+ import fileSvg from '../assets/file.svg?raw';
8
+ import type { MediaUploadItem, MediaUploadProperties, MediaUploadRejection } from './properties';
9
+
10
+ let {
11
+ label,
12
+ description,
13
+ addText,
14
+ hintText,
15
+ maxLength = 3,
16
+ accept = 'image/*',
17
+ maxFileSize = 0,
18
+ multiple = false,
19
+ dragAndDrop = true,
20
+ disabled = false,
21
+ showCounter = true,
22
+ showFileName = true,
23
+ showFileSize = true,
24
+ addIcon,
25
+ removeIcon,
26
+ fileIcon,
27
+ errorMessages,
28
+ files = $bindable([]),
29
+ onchange,
30
+ onremove,
31
+ onerror,
32
+ testId,
33
+ classes
34
+ }: MediaUploadProperties = $props();
35
+
36
+ let items: MediaUploadItem[] = $state([]);
37
+ let error: string = $state('');
38
+ let dragging: boolean = $state(false);
39
+ let inputId = $props.id();
40
+
41
+ let atCapacity = $derived(items.length >= maxLength);
42
+ let showDropTile = $derived(!atCapacity && !disabled);
43
+
44
+ function syncFiles(): void {
45
+ files = items.map((item) => item.file);
46
+ onchange?.(files);
47
+ }
48
+
49
+ function formatSize(bytes: number): string {
50
+ if (bytes < 1024) {
51
+ return `${bytes} B`;
52
+ }
53
+ const units = ['KB', 'MB', 'GB'];
54
+ let size = bytes / 1024;
55
+ let unit = 0;
56
+ while (size >= 1024 && unit < units.length - 1) {
57
+ size /= 1024;
58
+ unit += 1;
59
+ }
60
+ return `${size.toFixed(size >= 10 || unit === 0 ? 0 : 1)} ${units.at(unit) ?? ''}`;
61
+ }
62
+
63
+ function isAccepted(file: File): boolean {
64
+ if (accept.length === 0 || accept === '*' || accept === '*/*') {
65
+ return true;
66
+ }
67
+ const patterns = accept.split(',').map((pattern) => pattern.trim().toLowerCase());
68
+ const name = file.name.toLowerCase();
69
+ const mime = file.type.toLowerCase();
70
+ return patterns.some((pattern) => {
71
+ if (pattern.startsWith('.')) {
72
+ return name.endsWith(pattern);
73
+ }
74
+ if (pattern.endsWith('/*')) {
75
+ return mime.startsWith(pattern.slice(0, -1));
76
+ }
77
+ return mime === pattern;
78
+ });
79
+ }
80
+
81
+ function appendItem(file: File): void {
82
+ const isImage = file.type.startsWith('image/');
83
+ const item: MediaUploadItem = {
84
+ file,
85
+ src: '',
86
+ name: file.name,
87
+ size: file.size,
88
+ isImage
89
+ };
90
+ items = [...items, item];
91
+
92
+ if (isImage) {
93
+ const reader = new FileReader();
94
+ reader.onload = (event) => {
95
+ if (typeof event.target?.result === 'string') {
96
+ item.src = event.target.result;
97
+ items = [...items];
98
+ }
99
+ };
100
+ reader.readAsDataURL(file);
101
+ }
102
+ }
103
+
104
+ function buildError(rejections: MediaUploadRejection[]): string {
105
+ const reason = rejections.at(0)?.reason;
106
+ if (reason === 'type') {
107
+ return errorMessages?.type ?? 'Some files were skipped — unsupported file type.';
108
+ }
109
+ if (reason === 'size') {
110
+ const limit = maxFileSize > 0 ? ` (max ${formatSize(maxFileSize)})` : '';
111
+ return errorMessages?.size ?? `Some files were too large${limit}.`;
112
+ }
113
+ return errorMessages?.max ?? `You can attach up to ${maxLength} files.`;
114
+ }
115
+
116
+ function addFiles(selected: File[]): void {
117
+ if (disabled) {
118
+ return;
119
+ }
120
+ const rejections: MediaUploadRejection[] = [];
121
+
122
+ for (const file of selected) {
123
+ if (items.length >= maxLength) {
124
+ rejections.push({ file, reason: 'max' });
125
+ continue;
126
+ }
127
+ if (!isAccepted(file)) {
128
+ rejections.push({ file, reason: 'type' });
129
+ continue;
130
+ }
131
+ if (maxFileSize > 0 && file.size > maxFileSize) {
132
+ rejections.push({ file, reason: 'size' });
133
+ continue;
134
+ }
135
+ appendItem(file);
136
+ }
137
+
138
+ error = rejections.length > 0 ? buildError(rejections) : '';
139
+ if (rejections.length > 0) {
140
+ onerror?.(rejections);
141
+ }
142
+ syncFiles();
143
+ }
144
+
145
+ function handleInputChange(event: Event & { currentTarget: HTMLInputElement }): void {
146
+ const target = event.currentTarget;
147
+ addFiles(Array.from(target.files ?? []));
148
+ target.value = '';
149
+ }
150
+
151
+ function handleDrop(event: DragEvent): void {
152
+ event.preventDefault();
153
+ dragging = false;
154
+ if (disabled || !dragAndDrop) {
155
+ return;
156
+ }
157
+ addFiles(Array.from(event.dataTransfer?.files ?? []));
158
+ }
159
+
160
+ function handleDragOver(event: DragEvent): void {
161
+ if (disabled || !dragAndDrop) {
162
+ return;
163
+ }
164
+ event.preventDefault();
165
+ dragging = true;
166
+ }
167
+
168
+ function handleDragLeave(): void {
169
+ dragging = false;
170
+ }
171
+
172
+ function removeImage(index: number): void {
173
+ const removed = items.at(index);
174
+ items = items.filter((_, position) => position !== index);
175
+ error = '';
176
+ syncFiles();
177
+ if (typeof removed === 'object') {
178
+ onremove?.(removed.file);
179
+ }
180
+ }
181
+ </script>
182
+
183
+ <div class="media-upload {classes ?? ''}" class:disabled data-pw={testId}>
184
+ {#if (typeof label === 'string' && label.length > 0) || showCounter}
185
+ <div class="header">
186
+ {#if typeof label === 'string' && label.length > 0}
187
+ <div class="label">{label}</div>
188
+ {/if}
189
+ {#if showCounter}
190
+ <div class="counter">{items.length} / {maxLength}</div>
191
+ {/if}
192
+ </div>
193
+ {/if}
194
+ {#if typeof description === 'string' && description.length > 0}
195
+ <div class="description">{description}</div>
196
+ {/if}
197
+
198
+ <div class="grid">
199
+ {#each items as item, index (item.file.name + index)}
200
+ <div class="card" class:is-file={!item.isImage}>
201
+ {#if item.isImage}
202
+ {#if item.src.length > 0}
203
+ <span class="thumb">
204
+ <Img src={item.src} alt={item.name} />
205
+ </span>
206
+ {:else}
207
+ <span class="thumb-loading">
208
+ <Shimmer />
209
+ </span>
210
+ {/if}
211
+ {:else}
212
+ <div class="file-icon">
213
+ {#if typeof fileIcon === 'function'}
214
+ {@render fileIcon()}
215
+ {:else}
216
+ <!-- eslint-disable-next-line svelte/no-at-html-tags -->
217
+ {@html fileSvg}
218
+ {/if}
219
+ </div>
220
+ {/if}
221
+
222
+ {#if (showFileName || showFileSize) && (showFileName || item.size > 0)}
223
+ <div class="meta">
224
+ {#if showFileName}
225
+ <span class="meta-name">{item.name}</span>
226
+ {/if}
227
+ {#if showFileSize && item.size > 0}
228
+ <span class="meta-size">{formatSize(item.size)}</span>
229
+ {/if}
230
+ </div>
231
+ {/if}
232
+
233
+ {#if !disabled}
234
+ <div class="remove">
235
+ <Button onclick={() => removeImage(index)} ariaLabel="Remove {item.name}">
236
+ {#if typeof removeIcon === 'function'}
237
+ {@render removeIcon()}
238
+ {:else}
239
+ <!-- eslint-disable-next-line svelte/no-at-html-tags -->
240
+ {@html closeSvg}
241
+ {/if}
242
+ </Button>
243
+ </div>
244
+ {/if}
245
+ </div>
246
+ {/each}
247
+
248
+ {#if showDropTile}
249
+ <label
250
+ for={inputId}
251
+ class="drop-tile"
252
+ class:dragging
253
+ ondragover={handleDragOver}
254
+ ondragleave={handleDragLeave}
255
+ ondrop={handleDrop}
256
+ >
257
+ <span class="drop-icon">
258
+ {#if typeof addIcon === 'function'}
259
+ {@render addIcon()}
260
+ {:else}
261
+ <!-- eslint-disable-next-line svelte/no-at-html-tags -->
262
+ {@html addSvg}
263
+ {/if}
264
+ </span>
265
+ {#if typeof addText === 'string' && addText.length > 0}
266
+ <span class="drop-text">{addText}</span>
267
+ {/if}
268
+ {#if typeof hintText === 'string' && hintText.length > 0}
269
+ <span class="drop-hint">{hintText}</span>
270
+ {/if}
271
+ <input
272
+ id={inputId}
273
+ type="file"
274
+ {accept}
275
+ {multiple}
276
+ {disabled}
277
+ class="file-input"
278
+ onchange={handleInputChange}
279
+ hidden
280
+ />
281
+ </label>
282
+ {/if}
283
+ </div>
284
+
285
+ {#if error.length > 0}
286
+ <div class="error" role="alert">{error}</div>
287
+ {/if}
288
+ </div>
289
+
290
+ <style>
291
+ .media-upload {
292
+ box-sizing: border-box;
293
+ display: flex;
294
+ flex-direction: column;
295
+ width: var(--media-upload-width, fit-content);
296
+ font-family: var(--media-upload-font-family, inherit);
297
+ color: var(--media-upload-color, inherit);
298
+ }
299
+
300
+ .media-upload.disabled {
301
+ opacity: var(--media-upload-disabled-opacity, 0.55);
302
+ }
303
+
304
+ .header {
305
+ display: flex;
306
+ align-items: baseline;
307
+ justify-content: space-between;
308
+ gap: var(--media-upload-header-gap, 12px);
309
+ margin: var(--media-upload-label-margin, 0 0 4px 0);
310
+ }
311
+
312
+ .label {
313
+ font-size: var(--media-upload-label-font-size, 14px);
314
+ font-weight: var(--media-upload-label-font-weight, 600);
315
+ color: var(--media-upload-label-color, #242833);
316
+ }
317
+
318
+ .counter {
319
+ font-size: var(--media-upload-counter-font-size, 12px);
320
+ font-weight: var(--media-upload-counter-font-weight, 500);
321
+ color: var(--media-upload-counter-color, #8a8f98);
322
+ font-variant-numeric: tabular-nums;
323
+ }
324
+
325
+ .description {
326
+ font-size: var(--media-upload-description-font-size, 12px);
327
+ color: var(--media-upload-description-color, #656565);
328
+ margin: var(--media-upload-description-margin, 0);
329
+ }
330
+
331
+ .grid {
332
+ display: flex;
333
+ flex-wrap: wrap;
334
+ align-items: stretch;
335
+ gap: var(--media-upload-gap, 12px);
336
+ margin: var(--media-upload-content-margin, 12px 0 0 0);
337
+ }
338
+
339
+ .card,
340
+ .drop-tile {
341
+ box-sizing: border-box;
342
+ height: var(--media-upload-item-height, 110px);
343
+ width: var(--media-upload-item-width, 110px);
344
+ border-radius: var(--media-upload-item-border-radius, 14px);
345
+ }
346
+
347
+ .card {
348
+ position: relative;
349
+ overflow: hidden;
350
+ border: var(--media-upload-item-border, 1px solid #e4e4e7);
351
+ background-color: var(--media-upload-item-background-color, #fafafa);
352
+ box-shadow: var(--media-upload-item-box-shadow, 0 1px 2px rgba(0, 0, 0, 0.06));
353
+ transition: var(--media-upload-item-transition, box-shadow 0.2s ease, transform 0.2s ease);
354
+ }
355
+
356
+ .card:hover {
357
+ box-shadow: var(--media-upload-item-hover-box-shadow, 0 6px 18px rgba(0, 0, 0, 0.14));
358
+ transform: var(--media-upload-item-hover-transform, translateY(-2px));
359
+ }
360
+
361
+ .thumb {
362
+ display: contents;
363
+ --image-width: 100%;
364
+ --image-height: 100%;
365
+ --image-object-fit: var(--media-upload-item-object-fit, cover);
366
+ --image-border-radius: 0px;
367
+ --image-padding: 0px;
368
+ --image-margin: 0px;
369
+ }
370
+
371
+ .thumb-loading {
372
+ display: contents;
373
+ --shimmer-width: 100%;
374
+ --shimmer-height: 100%;
375
+ --shimmer-border-radius: 0px;
376
+ }
377
+
378
+ .file-icon {
379
+ display: flex;
380
+ height: 100%;
381
+ width: 100%;
382
+ justify-content: center;
383
+ align-items: center;
384
+ color: var(--media-upload-file-icon-color, #8a8f98);
385
+ }
386
+
387
+ .file-icon :global(svg),
388
+ .file-icon :global(img) {
389
+ height: var(--media-upload-file-icon-size, 36px);
390
+ width: var(--media-upload-file-icon-size, 36px);
391
+ object-fit: contain;
392
+ }
393
+
394
+ .meta {
395
+ position: absolute;
396
+ left: 0;
397
+ right: 0;
398
+ bottom: 0;
399
+ display: flex;
400
+ flex-direction: column;
401
+ gap: 2px;
402
+ box-sizing: border-box;
403
+ padding: var(--media-upload-meta-padding, 6px 8px);
404
+ background: var(
405
+ --media-upload-meta-background,
406
+ linear-gradient(to top, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0))
407
+ );
408
+ color: var(--media-upload-meta-color, #ffffff);
409
+ }
410
+
411
+ .is-file .meta {
412
+ background: var(--media-upload-file-meta-background, transparent);
413
+ color: var(--media-upload-file-meta-color, #52525b);
414
+ }
415
+
416
+ .meta-name {
417
+ font-size: var(--media-upload-meta-name-font-size, 11px);
418
+ font-weight: var(--media-upload-meta-name-font-weight, 500);
419
+ white-space: nowrap;
420
+ overflow: hidden;
421
+ text-overflow: ellipsis;
422
+ }
423
+
424
+ .meta-size {
425
+ font-size: var(--media-upload-meta-size-font-size, 10px);
426
+ opacity: var(--media-upload-meta-size-opacity, 0.85);
427
+ font-variant-numeric: tabular-nums;
428
+ }
429
+
430
+ .remove {
431
+ position: absolute;
432
+ top: var(--media-upload-remove-inset, 6px);
433
+ right: var(--media-upload-remove-inset, 6px);
434
+ opacity: var(--media-upload-remove-opacity, 0);
435
+ transition: var(--media-upload-remove-transition, opacity 0.18s ease);
436
+ --button-width: var(--media-upload-remove-size, 24px);
437
+ --button-height: var(--media-upload-remove-size, 24px);
438
+ --button-padding: var(--media-upload-remove-padding, 4px);
439
+ --button-border: var(--media-upload-remove-border, none);
440
+ --button-border-radius: var(--media-upload-remove-border-radius, 50%);
441
+ --button-color: var(--media-upload-remove-background-color, rgba(0, 0, 0, 0.55));
442
+ --button-text-color: var(--media-upload-remove-color, #ffffff);
443
+ --button-content-gap: 0px;
444
+ --button-hover-color: var(--media-upload-remove-hover-background-color, rgba(0, 0, 0, 0.78));
445
+ --button-hover-text-color: var(
446
+ --media-upload-remove-hover-color,
447
+ var(--media-upload-remove-color, #ffffff)
448
+ );
449
+ }
450
+
451
+ .card:hover .remove,
452
+ .remove:focus-within {
453
+ opacity: 1;
454
+ }
455
+
456
+ .remove :global(svg),
457
+ .remove :global(img) {
458
+ height: var(--media-upload-remove-icon-size, 100%);
459
+ width: var(--media-upload-remove-icon-size, 100%);
460
+ object-fit: contain;
461
+ }
462
+
463
+ .drop-tile {
464
+ display: flex;
465
+ flex-direction: column;
466
+ justify-content: center;
467
+ align-items: center;
468
+ gap: var(--media-upload-add-gap, 6px);
469
+ box-sizing: border-box;
470
+ padding: var(--media-upload-add-padding, 12px);
471
+ text-align: center;
472
+ background-color: var(--media-upload-add-background-color, #fafafa);
473
+ border: var(--media-upload-add-border, 1.5px dashed #c8ccd2);
474
+ color: var(--media-upload-add-color, #6b7280);
475
+ cursor: pointer;
476
+ transition: var(
477
+ --media-upload-add-transition,
478
+ border-color 0.18s ease,
479
+ background-color 0.18s ease,
480
+ color 0.18s ease
481
+ );
482
+ }
483
+
484
+ .drop-tile:hover {
485
+ background-color: var(--media-upload-add-hover-background-color, #f1f5ff);
486
+ border: var(--media-upload-add-hover-border, 1.5px dashed #6d8eff);
487
+ color: var(--media-upload-add-hover-color, #3b5bdb);
488
+ }
489
+
490
+ .drop-tile.dragging {
491
+ background-color: var(--media-upload-add-dragging-background-color, #e7efff);
492
+ border: var(--media-upload-add-dragging-border, 1.5px solid #3b5bdb);
493
+ color: var(--media-upload-add-dragging-color, #3b5bdb);
494
+ }
495
+
496
+ .drop-icon {
497
+ display: flex;
498
+ justify-content: center;
499
+ align-items: center;
500
+ }
501
+
502
+ .drop-icon :global(svg),
503
+ .drop-icon :global(img) {
504
+ height: var(--media-upload-add-icon-size, 22px);
505
+ width: var(--media-upload-add-icon-size, 22px);
506
+ object-fit: contain;
507
+ }
508
+
509
+ .drop-text {
510
+ font-size: var(--media-upload-add-text-font-size, 11px);
511
+ line-height: var(--media-upload-add-text-line-height, 1.3);
512
+ }
513
+
514
+ .drop-hint {
515
+ font-size: var(--media-upload-add-hint-font-size, 10px);
516
+ color: var(--media-upload-add-hint-color, #9aa0a8);
517
+ }
518
+
519
+ .error {
520
+ font-size: var(--media-upload-error-font-size, 12px);
521
+ color: var(--media-upload-error-color, #e0334b);
522
+ margin: var(--media-upload-error-margin, 8px 0 0 0);
523
+ }
524
+ </style>
@@ -0,0 +1,4 @@
1
+ import type { MediaUploadProperties } from './properties';
2
+ declare const MediaUpload: import("svelte").Component<MediaUploadProperties, {}, "files">;
3
+ type MediaUpload = ReturnType<typeof MediaUpload>;
4
+ export default MediaUpload;
@@ -0,0 +1,46 @@
1
+ import type { Snippet } from 'svelte';
2
+ export type MediaUploadProperties = OptionalMediaUploadProperties & MediaUploadEventProperties;
3
+ export type MediaUploadItem = {
4
+ file: File;
5
+ src: string;
6
+ name: string;
7
+ size: number;
8
+ isImage: boolean;
9
+ };
10
+ export type MediaUploadRejectionReason = 'type' | 'size' | 'max';
11
+ export type MediaUploadRejection = {
12
+ file: File;
13
+ reason: MediaUploadRejectionReason;
14
+ };
15
+ export type MediaUploadErrorMessages = {
16
+ type?: string;
17
+ size?: string;
18
+ max?: string;
19
+ };
20
+ export type OptionalMediaUploadProperties = {
21
+ label?: string;
22
+ description?: string;
23
+ addText?: string;
24
+ hintText?: string;
25
+ maxLength?: number;
26
+ accept?: string;
27
+ maxFileSize?: number;
28
+ multiple?: boolean;
29
+ dragAndDrop?: boolean;
30
+ disabled?: boolean;
31
+ showCounter?: boolean;
32
+ showFileName?: boolean;
33
+ showFileSize?: boolean;
34
+ addIcon?: Snippet;
35
+ removeIcon?: Snippet;
36
+ fileIcon?: Snippet;
37
+ errorMessages?: MediaUploadErrorMessages;
38
+ files?: File[];
39
+ testId?: string;
40
+ classes?: string;
41
+ };
42
+ export type MediaUploadEventProperties = {
43
+ onchange?: (files: File[]) => void;
44
+ onremove?: (file: File) => void;
45
+ onerror?: (rejections: MediaUploadRejection[]) => void;
46
+ };
@@ -0,0 +1 @@
1
+ export {};