@pie-qti/default-components 0.1.1

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 (146) hide show
  1. package/.turbo/turbo-build.log +1 -0
  2. package/CHANGELOG.md +9 -0
  3. package/STYLING.md +226 -0
  4. package/dist/index.d.ts +35 -0
  5. package/dist/index.d.ts.map +1 -0
  6. package/dist/index.js +190 -0
  7. package/dist/plugins/associate/index.d.ts +8 -0
  8. package/dist/plugins/associate/index.d.ts.map +1 -0
  9. package/dist/plugins/associate/index.js +8 -0
  10. package/dist/plugins/choice/index.d.ts +8 -0
  11. package/dist/plugins/choice/index.d.ts.map +1 -0
  12. package/dist/plugins/choice/index.js +8 -0
  13. package/dist/plugins/custom/index.d.ts +8 -0
  14. package/dist/plugins/custom/index.d.ts.map +1 -0
  15. package/dist/plugins/custom/index.js +8 -0
  16. package/dist/plugins/end-attempt/index.d.ts +8 -0
  17. package/dist/plugins/end-attempt/index.d.ts.map +1 -0
  18. package/dist/plugins/end-attempt/index.js +8 -0
  19. package/dist/plugins/extended-text/index.d.ts +8 -0
  20. package/dist/plugins/extended-text/index.d.ts.map +1 -0
  21. package/dist/plugins/extended-text/index.js +8 -0
  22. package/dist/plugins/gap-match/index.d.ts +8 -0
  23. package/dist/plugins/gap-match/index.d.ts.map +1 -0
  24. package/dist/plugins/gap-match/index.js +8 -0
  25. package/dist/plugins/graphic-associate/index.d.ts +8 -0
  26. package/dist/plugins/graphic-associate/index.d.ts.map +1 -0
  27. package/dist/plugins/graphic-associate/index.js +8 -0
  28. package/dist/plugins/graphic-gap-match/index.d.ts +8 -0
  29. package/dist/plugins/graphic-gap-match/index.d.ts.map +1 -0
  30. package/dist/plugins/graphic-gap-match/index.js +8 -0
  31. package/dist/plugins/graphic-order/index.d.ts +8 -0
  32. package/dist/plugins/graphic-order/index.d.ts.map +1 -0
  33. package/dist/plugins/graphic-order/index.js +8 -0
  34. package/dist/plugins/hotspot/index.d.ts +8 -0
  35. package/dist/plugins/hotspot/index.d.ts.map +1 -0
  36. package/dist/plugins/hotspot/index.js +8 -0
  37. package/dist/plugins/hottext/index.d.ts +8 -0
  38. package/dist/plugins/hottext/index.d.ts.map +1 -0
  39. package/dist/plugins/hottext/index.js +8 -0
  40. package/dist/plugins/index.d.ts +30 -0
  41. package/dist/plugins/index.d.ts.map +1 -0
  42. package/dist/plugins/index.js +30 -0
  43. package/dist/plugins/match/index.d.ts +8 -0
  44. package/dist/plugins/match/index.d.ts.map +1 -0
  45. package/dist/plugins/match/index.js +8 -0
  46. package/dist/plugins/media/index.d.ts +8 -0
  47. package/dist/plugins/media/index.d.ts.map +1 -0
  48. package/dist/plugins/media/index.js +8 -0
  49. package/dist/plugins/order/index.d.ts +8 -0
  50. package/dist/plugins/order/index.d.ts.map +1 -0
  51. package/dist/plugins/order/index.js +8 -0
  52. package/dist/plugins/position-object/index.d.ts +8 -0
  53. package/dist/plugins/position-object/index.d.ts.map +1 -0
  54. package/dist/plugins/position-object/index.js +8 -0
  55. package/dist/plugins/select-point/index.d.ts +8 -0
  56. package/dist/plugins/select-point/index.d.ts.map +1 -0
  57. package/dist/plugins/select-point/index.js +8 -0
  58. package/dist/plugins/slider/index.d.ts +8 -0
  59. package/dist/plugins/slider/index.d.ts.map +1 -0
  60. package/dist/plugins/slider/index.js +8 -0
  61. package/dist/shared/actions/typesetAction.d.ts +26 -0
  62. package/dist/shared/actions/typesetAction.d.ts.map +1 -0
  63. package/dist/shared/actions/typesetAction.js +70 -0
  64. package/dist/shared/extensions/MathLiveEditor.d.ts +19 -0
  65. package/dist/shared/extensions/MathLiveEditor.d.ts.map +1 -0
  66. package/dist/shared/extensions/MathLiveEditor.js +239 -0
  67. package/dist/shared/index.d.ts +11 -0
  68. package/dist/shared/index.d.ts.map +1 -0
  69. package/dist/shared/index.js +15 -0
  70. package/dist/shared/utils/eventHelpers.d.ts +18 -0
  71. package/dist/shared/utils/eventHelpers.d.ts.map +1 -0
  72. package/dist/shared/utils/eventHelpers.js +30 -0
  73. package/dist/shared/utils/pairHelpers.d.ts +55 -0
  74. package/dist/shared/utils/pairHelpers.d.ts.map +1 -0
  75. package/dist/shared/utils/pairHelpers.js +76 -0
  76. package/dist/shared/utils/touchDragHelper.d.ts +33 -0
  77. package/dist/shared/utils/touchDragHelper.d.ts.map +1 -0
  78. package/dist/shared/utils/touchDragHelper.js +168 -0
  79. package/dist/shared/utils/webComponentHelpers.d.ts +9 -0
  80. package/dist/shared/utils/webComponentHelpers.d.ts.map +1 -0
  81. package/dist/shared/utils/webComponentHelpers.js +26 -0
  82. package/package.json +93 -0
  83. package/src/index.ts +213 -0
  84. package/src/plugins/associate/AssociateInteraction.svelte +273 -0
  85. package/src/plugins/associate/index.ts +9 -0
  86. package/src/plugins/choice/ChoiceInteraction.svelte +212 -0
  87. package/src/plugins/choice/index.ts +9 -0
  88. package/src/plugins/custom/CustomInteraction.svelte +61 -0
  89. package/src/plugins/custom/index.ts +9 -0
  90. package/src/plugins/drawing/DrawingInteraction.svelte +90 -0
  91. package/src/plugins/end-attempt/EndAttemptInteraction.svelte +142 -0
  92. package/src/plugins/end-attempt/index.ts +9 -0
  93. package/src/plugins/extended-text/ExtendedTextInteraction.svelte +77 -0
  94. package/src/plugins/extended-text/index.ts +9 -0
  95. package/src/plugins/gap-match/GapMatchInteraction.svelte +379 -0
  96. package/src/plugins/gap-match/index.ts +9 -0
  97. package/src/plugins/graphic-associate/GraphicAssociateInteraction.svelte +427 -0
  98. package/src/plugins/graphic-associate/index.ts +9 -0
  99. package/src/plugins/graphic-gap-match/GraphicGapMatchInteraction.svelte +508 -0
  100. package/src/plugins/graphic-gap-match/index.ts +9 -0
  101. package/src/plugins/graphic-order/GraphicOrderInteraction.svelte +241 -0
  102. package/src/plugins/graphic-order/index.ts +9 -0
  103. package/src/plugins/hotspot/HotspotInteraction.svelte +244 -0
  104. package/src/plugins/hotspot/index.ts +9 -0
  105. package/src/plugins/hottext/HottextInteraction.svelte +296 -0
  106. package/src/plugins/hottext/index.ts +9 -0
  107. package/src/plugins/index.ts +31 -0
  108. package/src/plugins/match/MatchInteraction.svelte +70 -0
  109. package/src/plugins/match/index.ts +9 -0
  110. package/src/plugins/media/MediaInteraction.svelte +213 -0
  111. package/src/plugins/media/index.ts +9 -0
  112. package/src/plugins/order/OrderInteraction.svelte +159 -0
  113. package/src/plugins/order/index.ts +9 -0
  114. package/src/plugins/position-object/PositionObjectInteraction.svelte +671 -0
  115. package/src/plugins/position-object/README.md +130 -0
  116. package/src/plugins/position-object/index.ts +9 -0
  117. package/src/plugins/select-point/SelectPointInteraction.svelte +453 -0
  118. package/src/plugins/select-point/index.ts +9 -0
  119. package/src/plugins/slider/SliderInteraction.svelte +141 -0
  120. package/src/plugins/slider/index.ts +9 -0
  121. package/src/plugins/upload/UploadInteraction.svelte +59 -0
  122. package/src/shared/actions/typesetAction.ts +87 -0
  123. package/src/shared/components/CustomInteractionFallback.svelte +153 -0
  124. package/src/shared/components/DragHandle.svelte +44 -0
  125. package/src/shared/components/DrawingCanvas.svelte +243 -0
  126. package/src/shared/components/FileUpload.svelte +153 -0
  127. package/src/shared/components/GraphicGapMatch.svelte +316 -0
  128. package/src/shared/components/GraphicGapMatchAdapter.svelte +36 -0
  129. package/src/shared/components/InlineInteractionRenderer.svelte +124 -0
  130. package/src/shared/components/MatchDragDrop.svelte +434 -0
  131. package/src/shared/components/MathContent.svelte +18 -0
  132. package/src/shared/components/ModalFeedbackDisplay.svelte +81 -0
  133. package/src/shared/components/RichTextEditor.svelte +316 -0
  134. package/src/shared/components/ShadowBaseStyles.svelte +391 -0
  135. package/src/shared/components/SortableList.svelte +297 -0
  136. package/src/shared/extensions/MathLiveEditor.ts +304 -0
  137. package/src/shared/index.ts +17 -0
  138. package/src/shared/styles/shared.css +16 -0
  139. package/src/shared/utils/eventHelpers.ts +36 -0
  140. package/src/shared/utils/pairHelpers.ts +86 -0
  141. package/src/shared/utils/touchDragHelper.ts +211 -0
  142. package/src/shared/utils/webComponentHelpers.ts +27 -0
  143. package/src/svelte-shims.d.ts +9 -0
  144. package/svelte.config.js +9 -0
  145. package/tests/index.test.ts +8 -0
  146. package/tsconfig.json +20 -0
@@ -0,0 +1,243 @@
1
+ <script lang="ts">
2
+ /**
3
+ * Drawing canvas component for drawingInteraction
4
+ *
5
+ * Simple freehand drawing on a canvas, emitting a serializable QTIFileResponse (PNG dataUrl).
6
+ */
7
+
8
+ import type { QTIFileResponse } from '@pie-qti/item-player';
9
+ import type { I18nProvider } from '@pie-qti/i18n';
10
+
11
+ type ImageData =
12
+ | { type: 'svg'; content?: string; width: string; height: string }
13
+ | { type: 'image'; src?: string; width: string; height: string };
14
+
15
+ interface Props {
16
+ responseId: string;
17
+ label?: string;
18
+ imageData?: ImageData | null;
19
+ disabled?: boolean;
20
+ value?: QTIFileResponse | null;
21
+ i18n?: I18nProvider;
22
+ onChange: (value: QTIFileResponse | null) => void;
23
+ testIdCanvas?: string;
24
+ testIdClear?: string;
25
+ /** Stroke color (default: #111827) */
26
+ strokeColor?: string;
27
+ /** Line width in pixels (default: 3) */
28
+ lineWidth?: number;
29
+ /** Line cap style (default: round) */
30
+ lineCap?: 'butt' | 'round' | 'square';
31
+ /** Line join style (default: round) */
32
+ lineJoin?: 'bevel' | 'round' | 'miter';
33
+ }
34
+
35
+ const {
36
+ responseId,
37
+ label,
38
+ imageData = null,
39
+ disabled = false,
40
+ value = null,
41
+ i18n,
42
+ onChange,
43
+ testIdCanvas,
44
+ testIdClear,
45
+ strokeColor = '#111827',
46
+ lineWidth = 3,
47
+ lineCap = 'round',
48
+ lineJoin = 'round',
49
+ }: Props = $props();
50
+
51
+ let canvasEl = $state<HTMLCanvasElement | null>(null);
52
+ let ctx = $state<CanvasRenderingContext2D | null>(null);
53
+ let isDrawing = $state(false);
54
+ let lastX = $state(0);
55
+ let lastY = $state(0);
56
+ let announceText = $state('');
57
+
58
+ function toNumber(v: string | undefined, fallback: number) {
59
+ if (!v) return fallback;
60
+ const n = Number(v);
61
+ return Number.isFinite(n) ? n : fallback;
62
+ }
63
+
64
+ const canvasWidth = $derived(toNumber(imageData?.width, 600));
65
+ const canvasHeight = $derived(toNumber(imageData?.height, 400));
66
+
67
+ // Translations
68
+ const translations = $derived({
69
+ clear: i18n?.t('interactions.drawing.clear') ?? 'interactions.drawing.clear',
70
+ instructions: i18n?.t('interactions.drawing.instructions') ?? 'interactions.drawing.instructions',
71
+ canvas: i18n?.t('interactions.drawing.canvas') ?? 'interactions.drawing.canvas',
72
+ updated: i18n?.t('interactions.drawing.updated') ?? 'interactions.drawing.updated',
73
+ cleared: i18n?.t('interactions.drawing.cleared') ?? 'interactions.drawing.cleared',
74
+ generated: i18n?.t('interactions.drawing.generated') ?? 'interactions.drawing.generated',
75
+ });
76
+
77
+ function setupCanvas() {
78
+ if (!canvasEl) return;
79
+ const context = canvasEl.getContext('2d');
80
+ if (!context) return;
81
+ ctx = context;
82
+ ctx.lineJoin = lineJoin;
83
+ ctx.lineCap = lineCap;
84
+ ctx.strokeStyle = strokeColor;
85
+ ctx.lineWidth = lineWidth;
86
+ }
87
+
88
+ $effect(() => {
89
+ setupCanvas();
90
+ });
91
+
92
+ function getCanvasPoint(e: PointerEvent) {
93
+ if (!canvasEl) return { x: 0, y: 0 };
94
+ const rect = canvasEl.getBoundingClientRect();
95
+ // Get coordinates relative to canvas
96
+ let x = e.clientX - rect.left;
97
+ let y = e.clientY - rect.top;
98
+
99
+ // Scale from display size to canvas internal size
100
+ const scaleX = canvasWidth / rect.width;
101
+ const scaleY = canvasHeight / rect.height;
102
+ x = x * scaleX;
103
+ y = y * scaleY;
104
+
105
+ // Clamp to canvas bounds
106
+ x = Math.max(0, Math.min(x, canvasWidth));
107
+ y = Math.max(0, Math.min(y, canvasHeight));
108
+
109
+ return { x, y };
110
+ }
111
+
112
+ function pointerDown(e: PointerEvent) {
113
+ if (disabled || !ctx || !canvasEl) return;
114
+ canvasEl.setPointerCapture(e.pointerId);
115
+ isDrawing = true;
116
+ const { x, y } = getCanvasPoint(e);
117
+ lastX = x;
118
+ lastY = y;
119
+ }
120
+
121
+ function pointerMove(e: PointerEvent) {
122
+ if (disabled || !ctx || !isDrawing) return;
123
+ const { x, y } = getCanvasPoint(e);
124
+ ctx.beginPath();
125
+ ctx.moveTo(lastX, lastY);
126
+ ctx.lineTo(x, y);
127
+ ctx.stroke();
128
+ lastX = x;
129
+ lastY = y;
130
+ }
131
+
132
+ function dataUrlSize(dataUrl: string): number {
133
+ const comma = dataUrl.indexOf(',');
134
+ if (comma === -1) return dataUrl.length;
135
+ const b64 = dataUrl.slice(comma + 1);
136
+ // base64 size estimate
137
+ const padding = b64.endsWith('==') ? 2 : b64.endsWith('=') ? 1 : 0;
138
+ return Math.floor((b64.length * 3) / 4) - padding;
139
+ }
140
+
141
+ function commitValue() {
142
+ if (!canvasEl) return;
143
+ const dataUrl = canvasEl.toDataURL('image/png');
144
+ const size = dataUrlSize(dataUrl);
145
+ const response: QTIFileResponse = {
146
+ name: `drawing-${responseId}.png`,
147
+ type: 'image/png',
148
+ size,
149
+ lastModified: Date.now(),
150
+ dataUrl,
151
+ };
152
+ onChange(response);
153
+ announceText = translations.updated;
154
+ }
155
+
156
+ function pointerUp(e: PointerEvent) {
157
+ if (disabled || !isDrawing) return;
158
+ isDrawing = false;
159
+ commitValue();
160
+ try {
161
+ canvasEl?.releasePointerCapture(e.pointerId);
162
+ } catch {
163
+ // ignore
164
+ }
165
+ }
166
+
167
+ function clear() {
168
+ if (disabled || !ctx || !canvasEl) return;
169
+ ctx.clearRect(0, 0, canvasEl.width, canvasEl.height);
170
+ onChange(null);
171
+ announceText = translations.cleared;
172
+ }
173
+ </script>
174
+
175
+ <div class="space-y-3">
176
+ <div class="flex items-center justify-between gap-4">
177
+ {#if label}
178
+ <div class="font-semibold">{label}</div>
179
+ {/if}
180
+ <button
181
+ type="button"
182
+ class="btn btn-sm"
183
+ data-testid={testIdClear}
184
+ onclick={clear}
185
+ disabled={disabled}
186
+ >
187
+ {translations.clear}
188
+ </button>
189
+ </div>
190
+
191
+ <div class="text-xs text-base-content/70" id={`drawing-instructions-${responseId}`}>
192
+ {translations.instructions}
193
+ </div>
194
+
195
+ <div
196
+ class="relative inline-block"
197
+ style="width: {canvasWidth}px; height: {canvasHeight}px; user-select: none;"
198
+ >
199
+ {#if imageData}
200
+ {#if imageData.type === 'svg'}
201
+ <div class="absolute inset-0" style="pointer-events: none;" aria-hidden="true">
202
+ {@html imageData.content}
203
+ </div>
204
+ {:else}
205
+ <img
206
+ class="absolute inset-0 w-full h-full object-contain"
207
+ src={imageData.src}
208
+ alt=""
209
+ aria-hidden="true"
210
+ style="pointer-events: none;"
211
+ />
212
+ {/if}
213
+ {/if}
214
+
215
+ <canvas
216
+ bind:this={canvasEl}
217
+ data-testid={testIdCanvas}
218
+ width={canvasWidth}
219
+ height={canvasHeight}
220
+ class="absolute inset-0 touch-none"
221
+ aria-label={translations.canvas}
222
+ aria-describedby={`drawing-instructions-${responseId}`}
223
+ onpointerdown={pointerDown}
224
+ onpointermove={pointerMove}
225
+ onpointerup={pointerUp}
226
+ onpointercancel={pointerUp}
227
+ style="cursor: {disabled ? 'not-allowed' : 'crosshair'}; pointer-events: auto; border: 1px solid var(--color-base-300, #d1d5db); border-radius: 0.25rem;"
228
+ ></canvas>
229
+ </div>
230
+
231
+ <div aria-live="polite" class="sr-only">{announceText}</div>
232
+
233
+ {#if value}
234
+ <div class="text-sm">
235
+ <div><strong>{translations.generated}</strong> {value.name}</div>
236
+ <div class="text-xs text-base-content/70">
237
+ {i18n?.t('interactions.upload.fileSize', { size: value.size }) ?? `${value.size} bytes`}
238
+ </div>
239
+ </div>
240
+ {/if}
241
+ </div>
242
+
243
+
@@ -0,0 +1,153 @@
1
+ <script lang="ts">
2
+ /**
3
+ * File upload component for uploadInteraction
4
+ *
5
+ * Produces a serializable QTIFileResponse (dataUrl-based) so session state / exports work.
6
+ */
7
+
8
+ import type { QTIFileResponse } from '@pie-qti/item-player';
9
+ import type { I18nProvider } from '@pie-qti/i18n';
10
+
11
+ interface Props {
12
+ /** Optional label shown above the input */
13
+ label?: string;
14
+ /** Response id (used for stable ids/test selectors) */
15
+ responseId: string;
16
+ /** Allowed file types (MIME types and/or extensions); empty means accept any */
17
+ fileTypes?: string[];
18
+ disabled?: boolean;
19
+ value?: QTIFileResponse | null;
20
+ onChange: (value: QTIFileResponse | null) => void;
21
+ /** Optional test id for the input */
22
+ testId?: string;
23
+ /** Optional i18n provider for translations */
24
+ i18n?: I18nProvider;
25
+ }
26
+
27
+ const {
28
+ label,
29
+ responseId,
30
+ fileTypes = [],
31
+ disabled = false,
32
+ value = null,
33
+ onChange,
34
+ testId,
35
+ i18n,
36
+ }: Props = $props();
37
+
38
+ // Translations
39
+ const translations = $derived({
40
+ label: i18n?.t('interactions.upload.label') ?? 'interactions.upload.label',
41
+ allowedTypes: i18n?.t('interactions.upload.allowedTypes') ?? 'interactions.upload.allowedTypes',
42
+ selectedFile: i18n?.t('interactions.upload.selectedFile') ?? 'interactions.upload.selectedFile',
43
+ unknownType: i18n?.t('interactions.upload.unknownType') ?? 'interactions.upload.unknownType',
44
+ removeFile: i18n?.t('interactions.upload.removeFile') ?? 'interactions.upload.removeFile',
45
+ errorInvalidType: (types: string) => i18n?.t('interactions.upload.errorInvalidType', { types }) ?? `interactions.upload.errorInvalidType ${types}`,
46
+ });
47
+
48
+ // Use label prop or fallback to translated text
49
+ const displayLabel = $derived(label || translations.label);
50
+
51
+ let error = $state<string>('');
52
+
53
+ const acceptAttr = $derived(fileTypes.length > 0 ? fileTypes.join(',') : undefined);
54
+
55
+ async function fileToResponse(file: File): Promise<QTIFileResponse> {
56
+ const dataUrl = await new Promise<string>((resolve, reject) => {
57
+ const reader = new FileReader();
58
+ reader.onload = () => resolve(String(reader.result || ''));
59
+ reader.onerror = () => reject(new Error(i18n?.t('interactions.upload.errorReadFailed') ?? 'Failed to read file'));
60
+ reader.readAsDataURL(file);
61
+ });
62
+
63
+ return {
64
+ name: file.name,
65
+ type: file.type,
66
+ size: file.size,
67
+ lastModified: file.lastModified,
68
+ dataUrl,
69
+ };
70
+ }
71
+
72
+ async function handleFileChange(e: Event) {
73
+ error = '';
74
+ const input = e.currentTarget as HTMLInputElement;
75
+ const file = input.files?.[0];
76
+ if (!file) {
77
+ onChange(null);
78
+ return;
79
+ }
80
+
81
+ // Best-effort type check: fileTypes may contain mime types and/or extensions
82
+ if (fileTypes.length > 0) {
83
+ const allowed = fileTypes.some((t) => {
84
+ const trimmed = t.trim();
85
+ if (!trimmed) return false;
86
+ if (trimmed.startsWith('.')) return file.name.toLowerCase().endsWith(trimmed.toLowerCase());
87
+ if (trimmed.includes('/')) return file.type === trimmed;
88
+ return false;
89
+ });
90
+ if (!allowed) {
91
+ error = translations.errorInvalidType(fileTypes.join(', '));
92
+ input.value = '';
93
+ onChange(null);
94
+ return;
95
+ }
96
+ }
97
+
98
+ const response = await fileToResponse(file);
99
+ onChange(response);
100
+ }
101
+
102
+ function clear() {
103
+ error = '';
104
+ onChange(null);
105
+ const el = document.getElementById(`upload-${responseId}`) as HTMLInputElement | null;
106
+ if (el) el.value = '';
107
+ }
108
+ </script>
109
+
110
+ <div class="space-y-2" role="group" aria-label={displayLabel}>
111
+ <label class="label" for={`upload-${responseId}`}>
112
+ <span class="label-text font-semibold">{displayLabel}</span>
113
+ </label>
114
+
115
+ <input
116
+ id={`upload-${responseId}`}
117
+ data-testid={testId}
118
+ class="file-input file-input-bordered w-full"
119
+ type="file"
120
+ accept={acceptAttr}
121
+ disabled={disabled}
122
+ onchange={handleFileChange}
123
+ />
124
+
125
+ {#if fileTypes.length > 0}
126
+ <div class="text-xs text-base-content/70">
127
+ {translations.allowedTypes} {fileTypes.join(', ')}
128
+ </div>
129
+ {/if}
130
+
131
+ {#if error}
132
+ <div class="alert alert-error py-2">
133
+ <span class="text-sm">{error}</span>
134
+ </div>
135
+ {/if}
136
+
137
+ {#if value}
138
+ <div class="flex items-start justify-between gap-4">
139
+ <div class="text-sm">
140
+ <div><strong>{translations.selectedFile}</strong> {value.name}</div>
141
+ <div class="text-xs text-base-content/70">
142
+ {value.type || translations.unknownType} •
143
+ {i18n?.t('interactions.upload.fileSize', { size: value.size }) ?? `${value.size} bytes`}
144
+ </div>
145
+ </div>
146
+ <button type="button" class="btn btn-sm" onclick={clear} disabled={disabled}>
147
+ {translations.removeFile}
148
+ </button>
149
+ </div>
150
+ {/if}
151
+ </div>
152
+
153
+