@aleph-alpha/ui-library 6.4.0 → 6.6.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 (188) hide show
  1. package/dist/system/components/UiFileItem/UiFileItem.vue.d.ts +10 -1
  2. package/dist/system/components/UiFileItem/index.d.ts +1 -1
  3. package/dist/system/components/UiFileItem/types.d.ts +81 -5
  4. package/dist/system/components/UiPopover/UiPopoverContent.vue.d.ts +1 -0
  5. package/dist/system/components/UiPopover/types.d.ts +6 -0
  6. package/dist/system/components/core/popover/PopoverContent.vue.d.ts +1 -0
  7. package/dist/system/components/core/toggle/index.d.ts +1 -1
  8. package/dist/system/lib.js +12336 -12055
  9. package/dist/system/patterns/UiFloatActions/UiFloatActionItems.vue.d.ts +21 -174
  10. package/dist/system/patterns/UiFloatActions/core/FloatingButton.vue.d.ts +36 -0
  11. package/dist/system/patterns/UiFloatActions/core/FloatingInput.vue.d.ts +19 -0
  12. package/dist/system/patterns/UiFloatActions/floatActionItemContext.d.ts +3 -1
  13. package/dist/system/patterns/UiFloatActions/types.d.ts +93 -19
  14. package/dist/system/patterns/UiLayout/layout-shell.d.ts +117 -252
  15. package/package.json +2 -2
  16. package/src/components/UiAccordion/UiAccordion.stories.ts +8 -8
  17. package/src/components/UiAlert/UiAlert.stories.ts +13 -13
  18. package/src/components/UiAlertDialog/UiAlertDialog.stories.ts +4 -4
  19. package/src/components/UiAutocomplete/UiAutocomplete.stories.ts +13 -13
  20. package/src/components/UiAutocomplete/UiAutocomplete.vue +3 -3
  21. package/src/components/UiBadge/UiBadge.stories.ts +9 -9
  22. package/src/components/UiBreadcrumb/UiBreadcrumb.stories.ts +14 -14
  23. package/src/components/UiButton/UiButton.stories.ts +35 -35
  24. package/src/components/UiButtonGroup/UiButtonGroup.stories.ts +6 -6
  25. package/src/components/UiCalendar/UiCalendar.stories.ts +6 -6
  26. package/src/components/UiCard/UiCard.stories.ts +6 -6
  27. package/src/components/UiCheckbox/UiCheckbox.stories.ts +30 -30
  28. package/src/components/UiChip/UiChip.stories.ts +14 -14
  29. package/src/components/UiChip/UiChip.vue +1 -1
  30. package/src/components/UiDialog/UiDialog.stories.ts +20 -20
  31. package/src/components/UiDrawer/UiDrawer.stories.ts +29 -29
  32. package/src/components/UiDropdownMenu/UiDropdownMenu.stories.ts +13 -13
  33. package/src/components/UiEmpty/UiEmpty.vue +1 -1
  34. package/src/components/UiFadeMask/UiFadeMask.stories.ts +13 -13
  35. package/src/components/UiField/UiField.stories.ts +27 -27
  36. package/src/components/UiFileItem/UiFileItem.vue +114 -9
  37. package/src/components/UiFileItem/__tests__/UiFileItem.test.ts +54 -2
  38. package/src/components/UiFileItem/index.ts +1 -0
  39. package/src/components/UiFileItem/types.ts +82 -5
  40. package/src/components/UiFileType/UiFileType.stories.ts +10 -10
  41. package/src/components/UiFileUploadBox/UiFileUploadBox.stories.ts +10 -10
  42. package/src/components/UiFileUploadBox/UiFileUploadBox.vue +3 -3
  43. package/src/components/UiIcon/UiIcon.stories.ts +9 -9
  44. package/src/components/UiInput/UiInput.stories.ts +13 -13
  45. package/src/components/UiInput/UiInput.vue +1 -1
  46. package/src/components/UiInputGroup/UiInputGroup.stories.ts +10 -10
  47. package/src/components/UiItem/UiItem.stories.ts +12 -12
  48. package/src/components/UiItem/__tests__/UiItem.test.ts +2 -2
  49. package/src/components/UiKbd/UiKbd.stories.ts +18 -18
  50. package/src/components/UiKbd/UiKbd.vue +1 -1
  51. package/src/components/UiLabel/UiLabel.stories.ts +12 -12
  52. package/src/components/UiLabel/__tests__/UiLabel.test.ts +1 -1
  53. package/src/components/UiListbox/UiListbox.stories.ts +20 -20
  54. package/src/components/UiNavigationMenu/UiNavigationMenu.stories.ts +94 -94
  55. package/src/components/UiPopover/UiPopover.stories.ts +168 -27
  56. package/src/components/UiPopover/UiPopoverContent.vue +2 -0
  57. package/src/components/UiPopover/__tests__/UiPopover.test.ts +48 -0
  58. package/src/components/UiPopover/types.ts +7 -0
  59. package/src/components/UiRadioGroup/UiRadioGroup.stories.ts +53 -53
  60. package/src/components/UiRangeCalendar/UiRangeCalendar.stories.ts +6 -6
  61. package/src/components/UiResizable/UiResizable.stories.ts +40 -40
  62. package/src/components/UiSelect/UiSelect.stories.ts +14 -14
  63. package/src/components/UiSeparator/UiSeparator.stories.ts +16 -16
  64. package/src/components/UiSheet/UiSheet.stories.ts +29 -29
  65. package/src/components/UiSlider/UiSlider.stories.ts +28 -28
  66. package/src/components/UiSnackbar/UiSnackbar.stories.ts +6 -6
  67. package/src/components/UiSnackbar/UiSnackbar.vue +2 -2
  68. package/src/components/UiSnackbar/UiSnackbarContent.vue +2 -2
  69. package/src/components/UiSpinner/UiSpinner.stories.ts +8 -8
  70. package/src/components/UiStepper/UiStepper.stories.ts +6 -6
  71. package/src/components/UiSwitch/UiSwitch.stories.ts +37 -37
  72. package/src/components/UiTable/UiTable.stories.ts +4 -4
  73. package/src/components/UiTabs/UiTabs.stories.ts +64 -64
  74. package/src/components/UiTagsInput/UiTagsInput.stories.ts +16 -16
  75. package/src/components/UiTextarea/UiTextarea.stories.ts +20 -20
  76. package/src/components/UiToggle/UiToggle.stories.ts +26 -26
  77. package/src/components/UiToggleGroup/UiToggleGroup.stories.ts +31 -31
  78. package/src/components/UiTooltip/UiTooltip.stories.ts +7 -7
  79. package/src/components/core/accordion/AccordionContent.vue +1 -1
  80. package/src/components/core/accordion/AccordionTrigger.vue +1 -1
  81. package/src/components/core/alert/AlertDescription.vue +1 -1
  82. package/src/components/core/alert/index.ts +1 -1
  83. package/src/components/core/alert-dialog/AlertDialogDescription.vue +1 -1
  84. package/src/components/core/badge/index.ts +2 -2
  85. package/src/components/core/button/index.ts +3 -3
  86. package/src/components/core/calendar/Calendar.vue +4 -4
  87. package/src/components/core/calendar/CalendarCell.vue +1 -1
  88. package/src/components/core/calendar/CalendarHeading.vue +1 -1
  89. package/src/components/core/card/CardDescription.vue +1 -1
  90. package/src/components/core/dialog/DialogDescription.vue +1 -1
  91. package/src/components/core/drawer/DrawerDescription.vue +1 -1
  92. package/src/components/core/dropdown-menu/DropdownMenuCheckboxItem.vue +1 -1
  93. package/src/components/core/dropdown-menu/DropdownMenuLabel.vue +1 -1
  94. package/src/components/core/dropdown-menu/DropdownMenuRadioItem.vue +1 -1
  95. package/src/components/core/dropdown-menu/DropdownMenuShortcut.vue +1 -1
  96. package/src/components/core/dropdown-menu/DropdownMenuSubTrigger.vue +1 -1
  97. package/src/components/core/field/FieldDescription.vue +1 -1
  98. package/src/components/core/field/FieldError.vue +1 -1
  99. package/src/components/core/field/FieldLabel.vue +1 -1
  100. package/src/components/core/field/FieldLegend.vue +2 -2
  101. package/src/components/core/field/FieldSeparator.vue +1 -1
  102. package/src/components/core/field/FieldTitle.vue +1 -1
  103. package/src/components/core/input/Input.vue +1 -1
  104. package/src/components/core/input-group/InputGroupText.vue +1 -1
  105. package/src/components/core/input-group/index.ts +1 -1
  106. package/src/components/core/item/ItemDescription.vue +1 -1
  107. package/src/components/core/item/ItemTitle.vue +1 -1
  108. package/src/components/core/item/index.ts +2 -2
  109. package/src/components/core/label/Label.vue +1 -1
  110. package/src/components/core/listbox/ListboxFilter.vue +1 -1
  111. package/src/components/core/listbox/ListboxGroupLabel.vue +1 -1
  112. package/src/components/core/listbox/ListboxItem.vue +1 -1
  113. package/src/components/core/native-select/NativeSelect.vue +1 -1
  114. package/src/components/core/navigation-menu/NavigationMenuLink.vue +1 -1
  115. package/src/components/core/navigation-menu/index.ts +1 -1
  116. package/src/components/core/popover/PopoverContent.vue +9 -3
  117. package/src/components/core/range-calendar/RangeCalendarCell.vue +1 -1
  118. package/src/components/core/range-calendar/RangeCalendarHeading.vue +1 -1
  119. package/src/components/core/select/SelectItem.vue +1 -1
  120. package/src/components/core/select/SelectLabel.vue +1 -1
  121. package/src/components/core/select/SelectTrigger.vue +1 -1
  122. package/src/components/core/sheet/SheetDescription.vue +1 -1
  123. package/src/components/core/sidebar/SidebarGroupContent.vue +1 -1
  124. package/src/components/core/sidebar/SidebarGroupLabel.vue +1 -1
  125. package/src/components/core/sidebar/SidebarMenuBadge.vue +1 -1
  126. package/src/components/core/sidebar/SidebarMenuSubButton.vue +2 -2
  127. package/src/components/core/sidebar/index.ts +4 -4
  128. package/src/components/core/stepper/StepperDescription.vue +1 -1
  129. package/src/components/core/stepper/StepperTitle.vue +1 -1
  130. package/src/components/core/table/Table.vue +1 -1
  131. package/src/components/core/table/TableCaption.vue +1 -1
  132. package/src/components/core/table/TableEmpty.vue +1 -1
  133. package/src/components/core/tabs/TabsTrigger.vue +1 -1
  134. package/src/components/core/tags-input/TagsInput.vue +1 -1
  135. package/src/components/core/tags-input/TagsInputItem.vue +1 -1
  136. package/src/components/core/textarea/Textarea.vue +1 -1
  137. package/src/components/core/toggle/index.ts +1 -1
  138. package/src/components/core/tooltip/TooltipContent.vue +1 -1
  139. package/src/directives/vHover.stories.ts +17 -17
  140. package/src/lib/useDevice.stories.ts +29 -29
  141. package/src/lib/useDrag.stories.ts +14 -14
  142. package/src/patterns/UiDataTable/UiDataTable.stories.ts +27 -27
  143. package/src/patterns/UiDataTable/UiDataTableColumnFilter.vue +2 -2
  144. package/src/patterns/UiDataTable/UiDataTableFilterMenu.vue +2 -2
  145. package/src/patterns/UiDataTable/UiDataTablePagination.vue +3 -3
  146. package/src/patterns/UiDataTable/__tests__/UiDataTableColumnFilter.test.ts +2 -2
  147. package/src/patterns/UiDatePicker/UiDatePicker.stories.ts +14 -14
  148. package/src/patterns/UiFileUpload/UiFileItem.stories.ts +818 -32
  149. package/src/patterns/UiFileUpload/UiFileUpload.stories.ts +194 -12
  150. package/src/patterns/UiFloatActions/UiFloatActionItems.vue +226 -76
  151. package/src/patterns/UiFloatActions/UiFloatActions.stories.ts +1136 -116
  152. package/src/patterns/UiFloatActions/__tests__/UiFloatActionItems.test.ts +187 -1
  153. package/src/patterns/UiFloatActions/core/FloatingButton.vue +83 -0
  154. package/src/patterns/UiFloatActions/core/FloatingInput.vue +53 -0
  155. package/src/patterns/UiFloatActions/floatActionItemContext.ts +3 -1
  156. package/src/patterns/UiFloatActions/types.ts +106 -19
  157. package/src/patterns/UiLayout/UiLayoutContent.stories.ts +17 -17
  158. package/src/patterns/UiLayout/UiLayoutMobile.stories.ts +4 -4
  159. package/src/patterns/UiLayout/layout-shell.ts +6 -6
  160. package/src/patterns/UiProfileCard/UiProfileCard.stories.ts +8 -8
  161. package/src/patterns/UiProfileCard/profile-card.ts +2 -2
  162. package/src/patterns/UiSidebar/UiSidebar.stories.ts +6 -6
  163. package/src/patterns/UiSidebar/UiSidebarGroup.stories.ts +1 -1
  164. package/src/patterns/UiSidebar/UiSidebarGroupLabel.stories.ts +4 -4
  165. package/src/patterns/UiSidebar/UiSidebarGroupLabel.vue +1 -1
  166. package/src/patterns/UiSidebar/UiSidebarHeader.vue +1 -1
  167. package/src/patterns/UiSidebar/UiSidebarMenuButton.stories.ts +7 -7
  168. package/src/patterns/UiSidebar/UiSidebarMenuButton.vue +4 -4
  169. package/src/patterns/UiSidebar/UiSidebarMenuItem.stories.ts +4 -4
  170. package/src/patterns/UiSidebar/UiSidebarMenuSubItem.stories.ts +1 -1
  171. package/src/patterns/UiSidebar/UiSidebarMenuSubItem.vue +1 -1
  172. package/src/patterns/UiSidebar/UiSidebarPopoverMenu.vue +1 -1
  173. package/src/patterns/UiSidebar/UiSidebarPopoverMenuItem.vue +3 -3
  174. package/src/patterns/UiSidebar/UiSidebarPopoverTrigger.stories.ts +1 -1
  175. package/src/patterns/UiSidebar/UiSidebarPopoverTrigger.vue +1 -1
  176. package/src/patterns/UiSidebar/UiSidebarSub.stories.ts +1 -1
  177. package/src/patterns/UiTopBar/UiTopBar.stories.ts +24 -24
  178. package/src/theme/Background.stories.ts +62 -62
  179. package/src/theme/Border.stories.ts +19 -19
  180. package/src/theme/BorderRadius.stories.ts +14 -14
  181. package/src/theme/Extended.stories.ts +26 -26
  182. package/src/theme/Flex.stories.ts +21 -21
  183. package/src/theme/Grid.stories.ts +19 -19
  184. package/src/theme/HoverLayer.stories.ts +26 -26
  185. package/src/theme/Overlay.stories.ts +14 -14
  186. package/src/theme/Scrollbar.stories.ts +58 -58
  187. package/src/theme/Shadow.stories.ts +5 -5
  188. package/src/theme/Theme.stories.ts +38 -38
@@ -1,10 +1,11 @@
1
1
  import type { Meta, StoryObj } from '@storybook/vue3-vite';
2
- import { expect, fn, userEvent, within } from 'storybook/test';
2
+ import { expect, fn, userEvent, waitFor, within } from 'storybook/test';
3
3
  import { UiFileItem } from '@/components/UiFileItem';
4
4
 
5
5
  // `UiFileItem` emits `remove` with no payload and declares no handler prop, so
6
6
  // the plays bind a module-level spy via `@remove` and clear it per story.
7
7
  const onRemove = fn();
8
+ const onRemoveItem = fn();
8
9
 
9
10
  /**
10
11
  * `UiFileItem` is a single-row primitive that represents a file with
@@ -22,10 +23,16 @@ const meta: Meta<typeof UiFileItem> = {
22
23
  sizeLabel: '1.2 MB',
23
24
  progress: null,
24
25
  error: '',
26
+ processing: false,
27
+ processingLabel: 'Processing…',
25
28
  disabled: false,
26
29
  removable: true,
27
30
  removeLabel: 'Remove file',
28
31
  progressLabel: undefined,
32
+ expandLabel: 'Show files',
33
+ listLabel: 'Attached files',
34
+ popoverSide: 'bottom',
35
+ popoverAlign: 'center',
29
36
  size: 'default',
30
37
  mediaTone: undefined,
31
38
  mediaIcon: undefined,
@@ -37,6 +44,37 @@ const meta: Meta<typeof UiFileItem> = {
37
44
  description:
38
45
  'Error text. When non-empty the row enters the error state and replaces the type/size meta.',
39
46
  },
47
+ processing: {
48
+ control: 'boolean',
49
+ description:
50
+ 'Processing state. Shows `typeLabel | processingLabel` and a neutral file badge instead of a progress bar or the file size.',
51
+ },
52
+ processingLabel: {
53
+ control: 'text',
54
+ description:
55
+ 'Visible processing status. Also announced, with the filename, from the status region — pass a translated string.',
56
+ },
57
+ items: {
58
+ control: 'object',
59
+ description:
60
+ 'Files inside the multi variant. A non-empty list adds a chevron that opens them in a popover. Each entry uses the file-type icon for its extension.',
61
+ },
62
+ expandLabel: {
63
+ control: 'text',
64
+ description: 'Accessible name for the chevron that opens the file list.',
65
+ },
66
+ listLabel: {
67
+ control: 'text',
68
+ description: 'Accessible name for the list inside the popover.',
69
+ },
70
+ popoverSide: {
71
+ control: 'select',
72
+ options: ['top', 'right', 'bottom', 'left'],
73
+ },
74
+ popoverAlign: {
75
+ control: 'select',
76
+ options: ['start', 'center', 'end'],
77
+ },
40
78
  removable: {
41
79
  control: 'boolean',
42
80
  description:
@@ -68,11 +106,12 @@ const meta: Meta<typeof UiFileItem> = {
68
106
  },
69
107
  },
70
108
  decorators: [
71
- // The Accessibility story renders Default/Accessible panels side by side,
72
- // so it needs more room than the single-row stories.
109
+ // Side-by-side stories need more room than a single row.
73
110
  (story, context) => ({
74
111
  template: `<div class="p-4 ${
75
- context.name === 'Accessibility' ? 'max-w-3xl' : 'max-w-md'
112
+ context.name === 'Accessibility' || context.name === 'Multi'
113
+ ? 'max-w-3xl'
114
+ : 'max-w-md'
76
115
  }"><story /></div>`,
77
116
  }),
78
117
  ],
@@ -236,6 +275,108 @@ const onRemove = () => undefined;
236
275
  />
237
276
  </template>`;
238
277
 
278
+ const processingTemplateSource = `<script setup lang="ts">
279
+ import { UiFileItem } from '@aleph-alpha/ui-library'
280
+
281
+ const onRemove = () => undefined;
282
+ </script>
283
+
284
+ <template>
285
+ <UiFileItem
286
+ filename="Filename.pdf"
287
+ type-label="PDF"
288
+ processing
289
+ processing-label="Processing…"
290
+ @remove="onRemove"
291
+ />
292
+ </template>`;
293
+
294
+ /**
295
+ * Default size · processing. Neutral file badge plus `PDF | Processing…`.
296
+ * The status text is a prop so it can be translated, and it is exposed as a
297
+ * status region named with the file.
298
+ */
299
+ export const Processing: Story = {
300
+ args: {
301
+ filename: 'Filename.pdf',
302
+ typeLabel: 'PDF',
303
+ sizeLabel: '12 MB',
304
+ progress: 40,
305
+ error: '',
306
+ processing: true,
307
+ processingLabel: 'Processing…',
308
+ size: 'default',
309
+ },
310
+ render: renderArgs,
311
+ parameters: {
312
+ docs: { source: { code: processingTemplateSource } },
313
+ },
314
+ play: async ({ canvasElement, step }) => {
315
+ // Scenario (UiFileItem): a file has finished uploading and is being
316
+ // processed. The row must say so in text — the neutral badge is not enough —
317
+ // and must not keep showing a progress bar or a stale size.
318
+ const canvas = within(canvasElement);
319
+
320
+ await step(
321
+ 'interaction: processing replaces the progress bar and the file size',
322
+ async () => {
323
+ await expect(canvas.getByText('Filename')).toBeVisible();
324
+ await expect(canvas.getByText('PDF')).toBeVisible();
325
+ await expect(canvas.getByText('Processing…')).toBeVisible();
326
+ await expect(canvas.queryByText('12 MB')).not.toBeInTheDocument();
327
+ await expect(canvas.queryByRole('progressbar')).not.toBeInTheDocument();
328
+ await expect(
329
+ canvasElement.querySelector('[data-slot="file-type"]'),
330
+ ).toHaveAttribute('data-tone', 'default');
331
+ },
332
+ );
333
+
334
+ await step(
335
+ 'screen-reader: the processing status names the file and the translated label (WCAG 4.1.3)',
336
+ async () => {
337
+ await expect(canvas.getByRole('status')).toHaveAccessibleName(
338
+ 'Filename.pdf, PDF, Processing…',
339
+ );
340
+ },
341
+ );
342
+ },
343
+ };
344
+
345
+ const smallProcessingTemplateSource = `<script setup lang="ts">
346
+ import { UiFileItem } from '@aleph-alpha/ui-library'
347
+
348
+ const onRemove = () => undefined;
349
+ </script>
350
+
351
+ <template>
352
+ <UiFileItem
353
+ size="small"
354
+ filename="Filename.pdf"
355
+ type-label="PDF"
356
+ processing
357
+ processing-label="Processing…"
358
+ @remove="onRemove"
359
+ />
360
+ </template>`;
361
+
362
+ /** Small size · processing. Same status line, tighter row. */
363
+ export const SmallProcessing: Story = {
364
+ args: {
365
+ filename: 'Filename.pdf',
366
+ typeLabel: 'PDF',
367
+ sizeLabel: undefined,
368
+ progress: null,
369
+ error: '',
370
+ processing: true,
371
+ processingLabel: 'Processing…',
372
+ size: 'small',
373
+ },
374
+ render: renderArgs,
375
+ parameters: {
376
+ docs: { source: { code: smallProcessingTemplateSource } },
377
+ },
378
+ };
379
+
239
380
  /** Default size · error. CircleAlert media + destructive subtitle text. */
240
381
  export const DefaultError: Story = {
241
382
  args: {
@@ -470,8 +611,15 @@ const onRemove = () => undefined;
470
611
  <template>
471
612
  <div class="flex flex-wrap gap-8">
472
613
  <div class="flex max-w-md flex-1 flex-col gap-3">
473
- <p class="label-12-medium text-content-on-surface-muted">Default size</p>
614
+ <p class="label-xs-medium text-content-on-surface-muted">Default size</p>
474
615
  <UiFileItem filename="Filename.pdf" :progress="30" @remove="onRemove" />
616
+ <UiFileItem
617
+ filename="Filename.pdf"
618
+ type-label="PDF"
619
+ processing
620
+ processing-label="Processing…"
621
+ @remove="onRemove"
622
+ />
475
623
  <UiFileItem
476
624
  filename="Filename.pdf"
477
625
  type-label="PDF"
@@ -481,8 +629,16 @@ const onRemove = () => undefined;
481
629
  <UiFileItem filename="Filename.pdf" error="Upload failed" @remove="onRemove" />
482
630
  </div>
483
631
  <div class="flex max-w-64 flex-1 flex-col gap-3">
484
- <p class="label-12-medium text-content-on-surface-muted">Small size</p>
632
+ <p class="label-xs-medium text-content-on-surface-muted">Small size</p>
485
633
  <UiFileItem size="small" filename="Filename.pdf" :progress="30" @remove="onRemove" />
634
+ <UiFileItem
635
+ size="small"
636
+ filename="Filename.pdf"
637
+ type-label="PDF"
638
+ processing
639
+ processing-label="Processing…"
640
+ @remove="onRemove"
641
+ />
486
642
  <UiFileItem
487
643
  size="small"
488
644
  filename="Filename.pdf"
@@ -593,6 +749,405 @@ export const AllFileTypes: Story = {
593
749
  },
594
750
  };
595
751
 
752
+ const multiItems = [
753
+ {
754
+ id: 'plan',
755
+ filename: '26_Business_Plan_2026.pdf',
756
+ typeLabel: 'PDF',
757
+ sizeLabel: '12 MB',
758
+ removeLabel: 'Remove 26_Business_Plan_2026.pdf',
759
+ },
760
+ {
761
+ id: 'notes',
762
+ filename: 'Last_weeks_memory.md',
763
+ typeLabel: 'MD',
764
+ sizeLabel: '12 KB',
765
+ removeLabel: 'Remove Last_weeks_memory.md',
766
+ },
767
+ {
768
+ id: 'sheet',
769
+ filename: 'Tabular_analysis.csv',
770
+ typeLabel: 'CSV',
771
+ sizeLabel: '12 MB',
772
+ removeLabel: 'Remove Tabular_analysis.csv',
773
+ },
774
+ {
775
+ id: 'clip',
776
+ filename: 'Product_tour.mp4',
777
+ typeLabel: 'MP4',
778
+ sizeLabel: '18 MB',
779
+ removeLabel: 'Remove Product_tour.mp4',
780
+ },
781
+ ];
782
+
783
+ const multiTemplateSource = `<script setup lang="ts">
784
+ import { UiFileItem } from '@aleph-alpha/ui-library'
785
+
786
+ const onRemove = () => undefined;
787
+ const onRemoveItem = () => undefined;
788
+
789
+ const items = [
790
+ { filename: '26_Business_Plan_2026.pdf', typeLabel: 'PDF', sizeLabel: '12 MB' },
791
+ { filename: 'Last_weeks_memory.md', typeLabel: 'MD', sizeLabel: '12 KB' },
792
+ { filename: 'Tabular_analysis.csv', typeLabel: 'CSV', sizeLabel: '12 MB' },
793
+ { filename: 'Product_tour.mp4', typeLabel: 'MP4', sizeLabel: '18 MB' },
794
+ ];
795
+ </script>
796
+
797
+ <template>
798
+ <div class="flex flex-wrap gap-8">
799
+ <div class="flex max-w-md flex-1 flex-col gap-3">
800
+ <p class="label-xs-medium text-content-on-surface-muted">Default size</p>
801
+ <UiFileItem
802
+ filename="Attached documents"
803
+ type-label="4 files"
804
+ size-label="42 MB"
805
+ expand-label="Show attached documents"
806
+ list-label="Attached files"
807
+ :items="items"
808
+ @remove="onRemove"
809
+ @remove-item="onRemoveItem"
810
+ />
811
+ </div>
812
+ <div class="flex max-w-64 flex-1 flex-col gap-3">
813
+ <p class="label-xs-medium text-content-on-surface-muted">Small size</p>
814
+ <UiFileItem
815
+ size="small"
816
+ filename="Attached documents"
817
+ type-label="4 files"
818
+ size-label="42 MB"
819
+ expand-label="Show attached documents"
820
+ list-label="Attached files"
821
+ :items="items"
822
+ @remove="onRemove"
823
+ @remove-item="onRemoveItem"
824
+ />
825
+ </div>
826
+ </div>
827
+ </template>`;
828
+
829
+ /**
830
+ * Multi variant at both sizes. The row summarises the group and a chevron
831
+ * opens a popover of the files inside. Each file keeps the icon for its type:
832
+ * PDF, Markdown, CSV, and video.
833
+ */
834
+ export const Multi: Story = {
835
+ parameters: {
836
+ docs: { source: { code: multiTemplateSource } },
837
+ },
838
+ render: () => ({
839
+ components: { UiFileItem },
840
+ setup() {
841
+ return { items: multiItems, onRemove, onRemoveItem };
842
+ },
843
+ template: `
844
+ <div class="flex flex-wrap gap-8">
845
+ <div class="flex max-w-md flex-1 flex-col gap-3">
846
+ <p class="label-xs-medium text-content-on-surface-muted">Default size</p>
847
+ <UiFileItem
848
+ filename="Attached documents"
849
+ type-label="4 files"
850
+ size-label="42 MB"
851
+ expand-label="Show attached documents"
852
+ list-label="Attached files"
853
+ :items="items"
854
+ @remove="onRemove"
855
+ @remove-item="onRemoveItem"
856
+ />
857
+ </div>
858
+ <div class="flex max-w-64 flex-1 flex-col gap-3">
859
+ <p class="label-xs-medium text-content-on-surface-muted">Small size</p>
860
+ <UiFileItem
861
+ size="small"
862
+ filename="Attached documents"
863
+ type-label="4 files"
864
+ size-label="42 MB"
865
+ expand-label="Show attached documents"
866
+ list-label="Attached files"
867
+ :items="items"
868
+ @remove="onRemove"
869
+ @remove-item="onRemoveItem"
870
+ />
871
+ </div>
872
+ </div>
873
+ `,
874
+ }),
875
+ play: async ({ canvasElement, step }) => {
876
+ // Scenario (UiFileItem): several attachments are collapsed into one row,
877
+ // at the default size and the compact size. The chevron is the disclosure;
878
+ // until it is opened the individual files stay out of the way.
879
+ const canvas = within(canvasElement);
880
+
881
+ await step(
882
+ 'interaction: both sizes show a collapsed chevron and hide the files',
883
+ async () => {
884
+ const chevrons = canvas.getAllByRole('button', {
885
+ name: 'Show attached documents',
886
+ });
887
+ await expect(chevrons).toHaveLength(2);
888
+ for (const chevron of chevrons) {
889
+ await expect(chevron).toHaveAttribute('aria-expanded', 'false');
890
+ }
891
+ await expect(canvas.getAllByText('Attached documents')).toHaveLength(2);
892
+ await expect(canvas.getAllByText('4 files')).toHaveLength(2);
893
+ await expect(
894
+ canvas.queryByText('26_Business_Plan_2026'),
895
+ ).not.toBeInTheDocument();
896
+ },
897
+ );
898
+ },
899
+ };
900
+
901
+ const multiAllFileTypesTemplateSource = `<script setup lang="ts">
902
+ import { UiFileItem } from '@aleph-alpha/ui-library'
903
+
904
+ const onRemove = () => undefined;
905
+
906
+ const files = [
907
+ { filename: 'Filename.pdf', typeLabel: 'PDF' },
908
+ { filename: 'Filename.md', typeLabel: 'MD' },
909
+ { filename: 'Filename.csv', typeLabel: 'CSV' },
910
+ { filename: 'Filename.mp4', typeLabel: 'MP4' },
911
+ { filename: 'Filename.zip', typeLabel: 'ZIP' },
912
+ ];
913
+ </script>
914
+
915
+ <template>
916
+ <div class="flex max-w-md flex-col gap-3">
917
+ <UiFileItem
918
+ v-for="file in files"
919
+ :key="file.filename"
920
+ :filename="file.filename"
921
+ :type-label="file.typeLabel"
922
+ size-label="12 MB"
923
+ :expand-label="'Show ' + file.filename"
924
+ :items="[{ filename: file.filename, typeLabel: file.typeLabel, sizeLabel: '12 MB' }]"
925
+ @remove="onRemove"
926
+ />
927
+ </div>
928
+ </template>`;
929
+
930
+ /**
931
+ * One multi row per file-type group. The summary badge follows the filename:
932
+ * pink, soft, yellow, orange, and the neutral fallback for an unknown extension.
933
+ */
934
+ export const MultiAllFileTypes: Story = {
935
+ parameters: {
936
+ controls: { disable: true },
937
+ docs: { source: { code: multiAllFileTypesTemplateSource } },
938
+ },
939
+ render: () => ({
940
+ components: { UiFileItem },
941
+ setup() {
942
+ const files = [
943
+ { filename: 'Filename.pdf', typeLabel: 'PDF' },
944
+ { filename: 'Filename.md', typeLabel: 'MD' },
945
+ { filename: 'Filename.csv', typeLabel: 'CSV' },
946
+ { filename: 'Filename.mp4', typeLabel: 'MP4' },
947
+ { filename: 'Filename.zip', typeLabel: 'ZIP' },
948
+ ];
949
+ return { files, onRemove };
950
+ },
951
+ template: `
952
+ <div class="flex max-w-md flex-col gap-3">
953
+ <UiFileItem
954
+ v-for="file in files"
955
+ :key="file.filename"
956
+ :filename="file.filename"
957
+ :type-label="file.typeLabel"
958
+ size-label="12 MB"
959
+ :expand-label="'Show ' + file.filename"
960
+ :items="[{ filename: file.filename, typeLabel: file.typeLabel, sizeLabel: '12 MB' }]"
961
+ @remove="onRemove"
962
+ />
963
+ </div>
964
+ `,
965
+ }),
966
+ play: async ({ canvasElement, step }) => {
967
+ // Scenario (UiFileItem): each multi summary takes its icon from the
968
+ // filename alone, and the type is also written out because the badge is
969
+ // decorative.
970
+ const canvas = within(canvasElement);
971
+
972
+ await step(
973
+ 'interaction: each multi row takes the icon group for its file type',
974
+ async () => {
975
+ const tones = Array.from(
976
+ canvasElement.querySelectorAll('[data-slot="file-type"]'),
977
+ ).map((badge) => badge.getAttribute('data-tone'));
978
+ await expect(tones).toEqual([
979
+ 'accent-pink',
980
+ 'accent-soft',
981
+ 'accent-yellow',
982
+ 'accent-orange',
983
+ 'default',
984
+ ]);
985
+ },
986
+ );
987
+
988
+ await step(
989
+ 'screen-reader: the type label carries the file family (WCAG 1.4.1)',
990
+ async () => {
991
+ for (const badge of canvasElement.querySelectorAll(
992
+ '[data-slot="file-type"]',
993
+ )) {
994
+ await expect(badge).toHaveAttribute('aria-hidden', 'true');
995
+ }
996
+ for (const label of ['PDF', 'MD', 'CSV', 'MP4', 'ZIP']) {
997
+ await expect(canvas.getByText(label)).toBeVisible();
998
+ }
999
+ },
1000
+ );
1001
+ },
1002
+ };
1003
+
1004
+ const multiDisabledTemplateSource = `<script setup lang="ts">
1005
+ import { UiFileItem } from '@aleph-alpha/ui-library'
1006
+
1007
+ const onRemove = () => undefined;
1008
+ </script>
1009
+
1010
+ <template>
1011
+ <UiFileItem
1012
+ filename="locked.pdf"
1013
+ type-label="PDF"
1014
+ size-label="2 MB"
1015
+ expand-label="Show locked.pdf"
1016
+ disabled
1017
+ :items="[{ filename: 'locked.pdf', typeLabel: 'PDF', sizeLabel: '2 MB' }]"
1018
+ @remove="onRemove"
1019
+ />
1020
+ </template>`;
1021
+
1022
+ /**
1023
+ * Disabled multi row. The chevron and the remove control are both inert, so
1024
+ * the file list cannot be opened and the group cannot be detached.
1025
+ */
1026
+ export const MultiDisabled: Story = {
1027
+ render: () => ({
1028
+ components: { UiFileItem },
1029
+ setup() {
1030
+ return { onRemove };
1031
+ },
1032
+ template: `
1033
+ <UiFileItem
1034
+ filename="locked.pdf"
1035
+ type-label="PDF"
1036
+ size-label="2 MB"
1037
+ expand-label="Show locked.pdf"
1038
+ disabled
1039
+ :items="[{ filename: 'locked.pdf', typeLabel: 'PDF', sizeLabel: '2 MB' }]"
1040
+ @remove="onRemove"
1041
+ />
1042
+ `,
1043
+ }),
1044
+ parameters: {
1045
+ docs: { source: { code: multiDisabledTemplateSource } },
1046
+ },
1047
+ play: async ({ canvasElement, step }) => {
1048
+ // Scenario (UiFileItem): a locked group must refuse both disclosure and
1049
+ // removal. The single-file Disabled story never renders the chevron.
1050
+ onRemove.mockClear();
1051
+ const canvas = within(canvasElement);
1052
+
1053
+ await step(
1054
+ 'interaction: a disabled multi row refuses the chevron and remove (WCAG 4.1.2)',
1055
+ async () => {
1056
+ const chevron = canvas.getByRole('button', {
1057
+ name: 'Show locked.pdf',
1058
+ });
1059
+ const remove = canvas.getByRole('button', { name: 'Remove file' });
1060
+ await expect(chevron).toBeDisabled();
1061
+ await expect(remove).toBeDisabled();
1062
+ // A disabled UiButton sets `pointer-events: none`, which makes
1063
+ // `userEvent.click` throw instead of no-op; bypass the check so the
1064
+ // guard itself is what gets asserted.
1065
+ await userEvent.click(chevron, { pointerEventsCheck: 0 });
1066
+ await userEvent.click(remove, { pointerEventsCheck: 0 });
1067
+ await expect(chevron).toHaveAttribute('aria-expanded', 'false');
1068
+ await expect(onRemove).not.toHaveBeenCalled();
1069
+ },
1070
+ );
1071
+ },
1072
+ };
1073
+
1074
+ const multiErrorTemplateSource = `<script setup lang="ts">
1075
+ import { UiFileItem } from '@aleph-alpha/ui-library'
1076
+
1077
+ const onRemove = () => undefined;
1078
+
1079
+ const items = [
1080
+ { filename: 'Filename.pdf', typeLabel: 'PDF', sizeLabel: '12 MB' },
1081
+ { filename: 'Filename.md', typeLabel: 'MD', sizeLabel: '12 KB' },
1082
+ ];
1083
+ </script>
1084
+
1085
+ <template>
1086
+ <UiFileItem
1087
+ filename="Attached documents"
1088
+ error="2 uploads failed"
1089
+ expand-label="Show attached documents"
1090
+ :items="items"
1091
+ @remove="onRemove"
1092
+ />
1093
+ </template>`;
1094
+
1095
+ /**
1096
+ * Error multi row. The failure replaces the type and size line, and the
1097
+ * chevron stays available so the failed files can still be opened.
1098
+ */
1099
+ export const MultiError: Story = {
1100
+ render: () => ({
1101
+ components: { UiFileItem },
1102
+ setup() {
1103
+ const items = [
1104
+ { filename: 'Filename.pdf', typeLabel: 'PDF', sizeLabel: '12 MB' },
1105
+ { filename: 'Filename.md', typeLabel: 'MD', sizeLabel: '12 KB' },
1106
+ ];
1107
+ return { items, onRemove };
1108
+ },
1109
+ template: `
1110
+ <UiFileItem
1111
+ filename="Attached documents"
1112
+ error="2 uploads failed"
1113
+ expand-label="Show attached documents"
1114
+ :items="items"
1115
+ @remove="onRemove"
1116
+ />
1117
+ `,
1118
+ }),
1119
+ parameters: {
1120
+ docs: { source: { code: multiErrorTemplateSource } },
1121
+ },
1122
+ play: async ({ canvasElement, step }) => {
1123
+ // Scenario (UiFileItem): a failed group says why in the row itself. The
1124
+ // single-file error story has no chevron, so this one checks the
1125
+ // disclosure stays collapsed until the user opens it.
1126
+ const canvas = within(canvasElement);
1127
+
1128
+ await step(
1129
+ 'interaction: the error row keeps a collapsed chevron and hides the file list',
1130
+ async () => {
1131
+ const chevron = canvas.getByRole('button', {
1132
+ name: 'Show attached documents',
1133
+ });
1134
+ await expect(chevron).toHaveAttribute('aria-expanded', 'false');
1135
+ await expect(canvas.queryByText('Filename')).not.toBeInTheDocument();
1136
+ await expect(canvas.queryByText('PDF')).not.toBeInTheDocument();
1137
+ },
1138
+ );
1139
+
1140
+ await step(
1141
+ 'screen-reader: the failure reason is announced via an alert region (WCAG 4.1.3)',
1142
+ async () => {
1143
+ await expect(canvas.getByRole('alert')).toHaveTextContent(
1144
+ '2 uploads failed',
1145
+ );
1146
+ },
1147
+ );
1148
+ },
1149
+ };
1150
+
596
1151
  /** All variants in one column for quick visual comparison. */
597
1152
  export const AllVariants: Story = {
598
1153
  parameters: {
@@ -612,8 +1167,15 @@ export const AllVariants: Story = {
612
1167
  template: `
613
1168
  <div class="flex flex-wrap gap-8">
614
1169
  <div class="flex max-w-md flex-1 flex-col gap-3">
615
- <p class="label-12-medium text-content-on-surface-muted">Default size</p>
1170
+ <p class="label-xs-medium text-content-on-surface-muted">Default size</p>
616
1171
  <UiFileItem filename="Filename.pdf" :progress="30" @remove="onRemove" />
1172
+ <UiFileItem
1173
+ filename="Filename.pdf"
1174
+ type-label="PDF"
1175
+ processing
1176
+ processing-label="Processing…"
1177
+ @remove="onRemove"
1178
+ />
617
1179
  <UiFileItem
618
1180
  filename="Filename.pdf"
619
1181
  type-label="PDF"
@@ -623,8 +1185,16 @@ export const AllVariants: Story = {
623
1185
  <UiFileItem filename="Filename.pdf" error="Upload failed" @remove="onRemove" />
624
1186
  </div>
625
1187
  <div class="flex max-w-64 flex-1 flex-col gap-3">
626
- <p class="label-12-medium text-content-on-surface-muted">Small size</p>
1188
+ <p class="label-xs-medium text-content-on-surface-muted">Small size</p>
627
1189
  <UiFileItem size="small" filename="Filename.pdf" :progress="30" @remove="onRemove" />
1190
+ <UiFileItem
1191
+ size="small"
1192
+ filename="Filename.pdf"
1193
+ type-label="PDF"
1194
+ processing
1195
+ processing-label="Processing…"
1196
+ @remove="onRemove"
1197
+ />
628
1198
  <UiFileItem
629
1199
  size="small"
630
1200
  filename="Filename.pdf"
@@ -658,27 +1228,27 @@ export const Accessibility: Story = {
658
1228
 
659
1229
  <div class="flex flex-col gap-6">
660
1230
  <div class="flex flex-col gap-2">
661
- <h3 class="body-16-medium text-content-on-surface-primary">
1231
+ <h3 class="body-m-medium text-content-on-surface-primary">
662
1232
  Enable accessibility theme
663
1233
  </h3>
664
- <p class="body-16-regular text-content-on-surface-primary">
1234
+ <p class="body-m-regular text-content-on-surface-primary">
665
1235
  When accessibility is required, enable our accessibility theme. This increases contrast and makes sure there are no color contrast issues.
666
1236
  </p>
667
1237
  </div>
668
1238
 
669
1239
  <div class="flex flex-col gap-2">
670
- <h3 class="body-16-medium text-content-on-surface-primary">
1240
+ <h3 class="body-m-medium text-content-on-surface-primary">
671
1241
  Never rely on the media badge alone
672
1242
  </h3>
673
- <p class="body-16-regular text-content-on-surface-primary">
674
- The round media badge is decorative and hidden from assistive tech, so the file family must also be stated in text. In the accessibility theme the media badge for video resolves to the same yellow as tabular files, which is why every row keeps its type label and its own icon.
1243
+ <p class="body-m-regular text-content-on-surface-primary">
1244
+ The round media badge is decorative and hidden from assistive tech, so the file family must also be stated in text. In the accessibility theme the media badge for video resolves to the same yellow as tabular files, which is why every row keeps its type label and its own icon. Processing uses the same neutral badge as an upload in progress, so the status has to be the text “Processing…”, not the badge.
675
1245
  </p>
676
1246
  </div>
677
1247
  </div>
678
1248
 
679
1249
  <div class="grid gap-4 md:grid-cols-2">
680
1250
  <div class="flex flex-col gap-3">
681
- <h3 class="label-16-medium text-center text-content-on-surface-primary">
1251
+ <h3 class="label-m-medium text-center text-content-on-surface-primary">
682
1252
  Default
683
1253
  </h3>
684
1254
  <div class="flex flex-col gap-3 border border-border-surface-default p-4">
@@ -688,7 +1258,7 @@ export const Accessibility: Story = {
688
1258
  </div>
689
1259
 
690
1260
  <div class="accessible-theme flex flex-col gap-3">
691
- <h3 class="label-16-medium text-center text-content-on-surface-primary">
1261
+ <h3 class="label-m-medium text-center text-content-on-surface-primary">
692
1262
  Accessible
693
1263
  </h3>
694
1264
  <div class="flex flex-col gap-3 border border-border-surface-default p-4">
@@ -786,6 +1356,16 @@ export const StatePrecedence: Story = {
786
1356
  remove-label="Remove Notes.md"
787
1357
  @remove="onRemove"
788
1358
  />
1359
+ <UiFileItem
1360
+ filename="Brief.docx"
1361
+ type-label="DOCX"
1362
+ size-label="9 MB"
1363
+ :progress="40"
1364
+ processing
1365
+ processing-label="Processing…"
1366
+ remove-label="Remove Brief.docx"
1367
+ @remove="onRemove"
1368
+ />
789
1369
  </div>
790
1370
  `,
791
1371
  }),
@@ -824,6 +1404,18 @@ export const StatePrecedence: Story = {
824
1404
  await expect(canvas.getByText('4 KB')).toBeVisible();
825
1405
  },
826
1406
  );
1407
+
1408
+ await step(
1409
+ 'interaction: a processing row replaces its progress bar and size with the status text',
1410
+ async () => {
1411
+ await expect(canvas.getByText('DOCX')).toBeVisible();
1412
+ await expect(canvas.getByText('Processing…')).toBeVisible();
1413
+ await expect(canvas.queryByText('9 MB')).not.toBeInTheDocument();
1414
+ await expect(
1415
+ canvas.queryByRole('progressbar', { name: 'Brief.docx' }),
1416
+ ).not.toBeInTheDocument();
1417
+ },
1418
+ );
827
1419
  },
828
1420
  };
829
1421
 
@@ -931,6 +1523,14 @@ export const ScreenReader: Story = {
931
1523
  remove-label="Dismiss Archive.zip"
932
1524
  @remove="onRemove"
933
1525
  />
1526
+ <UiFileItem
1527
+ filename="Notes.docx"
1528
+ type-label="DOCX"
1529
+ processing
1530
+ processing-label="Processing document"
1531
+ remove-label="Remove Notes.docx"
1532
+ @remove="onRemove"
1533
+ />
934
1534
  </div>
935
1535
  `,
936
1536
  }),
@@ -992,6 +1592,15 @@ export const ScreenReader: Story = {
992
1592
  );
993
1593
  },
994
1594
  );
1595
+
1596
+ await step(
1597
+ 'screen-reader: processing is a status named with the file and the translated label (WCAG 4.1.3)',
1598
+ async () => {
1599
+ await expect(canvas.getByRole('status')).toHaveAccessibleName(
1600
+ 'Notes.docx, DOCX, Processing document',
1601
+ );
1602
+ },
1603
+ );
995
1604
  },
996
1605
  };
997
1606
 
@@ -1018,21 +1627,38 @@ export const ZoomMagnification: Story = {
1018
1627
  render: () => ({
1019
1628
  components: { UiFileItem },
1020
1629
  setup() {
1021
- return { onRemove };
1630
+ return { onRemove, onRemoveItem, items: multiItems };
1022
1631
  },
1023
1632
  template: `
1024
- <UiFileItem
1025
- filename="Filename.pdf"
1026
- type-label="PDF"
1027
- size-label="12 MB"
1028
- @remove="onRemove"
1029
- />
1633
+ <div class="flex flex-col gap-3">
1634
+ <UiFileItem
1635
+ filename="Filename.pdf"
1636
+ type-label="PDF"
1637
+ size-label="12 MB"
1638
+ @remove="onRemove"
1639
+ />
1640
+ <UiFileItem
1641
+ filename="Brief.docx"
1642
+ type-label="DOCX"
1643
+ processing
1644
+ processing-label="Processing…"
1645
+ remove-label="Remove Brief.docx"
1646
+ @remove="onRemove"
1647
+ />
1648
+ <UiFileItem
1649
+ filename="Attached documents"
1650
+ type-label="4 files"
1651
+ expand-label="Show attached documents"
1652
+ :items="items"
1653
+ :removable="false"
1654
+ @remove-item="onRemoveItem"
1655
+ />
1656
+ </div>
1030
1657
  `,
1031
1658
  }),
1032
1659
  play: async ({ canvasElement, step }) => {
1033
- // Scenario (UiFileItem): at 200% page zoom the row keeps its filename and
1034
- // meta readable and the remove control still works, so a low-vision user can
1035
- // manage attachments without horizontal scrolling.
1660
+ // Scenario (UiFileItem): at 200% page zoom a finished row, a processing
1661
+ // status, and the group chevron stay readable and operable.
1036
1662
  onRemove.mockClear();
1037
1663
  const canvas = within(canvasElement);
1038
1664
  const remove = canvas.getByRole('button', { name: 'Remove file' });
@@ -1054,6 +1680,20 @@ export const ZoomMagnification: Story = {
1054
1680
  await userEvent.click(remove);
1055
1681
  await expect(onRemove).toHaveBeenCalledTimes(1);
1056
1682
  });
1683
+
1684
+ await step('zoom: the processing status stays readable', async () => {
1685
+ await expect(canvas.getByRole('status')).toHaveAccessibleName(
1686
+ 'Brief.docx, DOCX, Processing…',
1687
+ );
1688
+ });
1689
+
1690
+ await step('zoom: the group chevron remains operable', async () => {
1691
+ const chevron = canvas.getByRole('button', {
1692
+ name: 'Show attached documents',
1693
+ });
1694
+ await userEvent.click(chevron);
1695
+ await expect(chevron).toHaveAttribute('aria-expanded', 'true');
1696
+ });
1057
1697
  },
1058
1698
  };
1059
1699
 
@@ -1081,15 +1721,24 @@ export const MobileBreakpoint: Story = {
1081
1721
  render: () => ({
1082
1722
  components: { UiFileItem },
1083
1723
  setup() {
1084
- return { onRemove };
1724
+ return { onRemove, items: multiItems };
1085
1725
  },
1086
1726
  template: `
1087
- <UiFileItem
1088
- filename="A rather long quarterly report filename.pdf"
1089
- type-label="PDF"
1090
- size-label="12 MB"
1091
- @remove="onRemove"
1092
- />
1727
+ <div class="flex flex-col gap-3">
1728
+ <UiFileItem
1729
+ filename="A rather long quarterly report filename.pdf"
1730
+ type-label="PDF"
1731
+ size-label="12 MB"
1732
+ @remove="onRemove"
1733
+ />
1734
+ <UiFileItem
1735
+ filename="Attached documents"
1736
+ type-label="4 files"
1737
+ expand-label="Show attached documents"
1738
+ :items="items"
1739
+ :removable="false"
1740
+ />
1741
+ </div>
1093
1742
  `,
1094
1743
  }),
1095
1744
  play: async ({ canvasElement, step }) => {
@@ -1133,6 +1782,143 @@ export const MobileBreakpoint: Story = {
1133
1782
  await expect(onRemove).toHaveBeenCalledTimes(1);
1134
1783
  },
1135
1784
  );
1785
+
1786
+ await step(
1787
+ 'mobile: the group chevron meets the minimum touch-target size (WCAG 2.5.8)',
1788
+ async () => {
1789
+ const chevron = canvas.getByRole('button', {
1790
+ name: 'Show attached documents',
1791
+ });
1792
+ const { width, height, right } = chevron.getBoundingClientRect();
1793
+ await expect(width).toBeGreaterThanOrEqual(24);
1794
+ await expect(height).toBeGreaterThanOrEqual(24);
1795
+ await expect(right).toBeLessThanOrEqual(window.innerWidth);
1796
+ },
1797
+ );
1798
+ },
1799
+ };
1800
+
1801
+ /**
1802
+ * The multi row's chevron opens a popover list. Each file keeps the icon for
1803
+ * its type, keyboard opens and closes the list, and removing a row names that
1804
+ * file. Hidden test-only story.
1805
+ */
1806
+ export const MultiDisclosure: Story = {
1807
+ name: 'test - Multi Disclosure',
1808
+ tags: ['!dev', '!autodocs'],
1809
+ parameters: {
1810
+ chromatic: { disableSnapshot: true },
1811
+ controls: { disable: true },
1812
+ docs: {
1813
+ description: {
1814
+ story:
1815
+ 'Open the chevron to list the grouped files, then remove one from the popover.',
1816
+ },
1817
+ },
1818
+ },
1819
+ render: () => ({
1820
+ components: { UiFileItem },
1821
+ setup() {
1822
+ return { items: multiItems, onRemove, onRemoveItem };
1823
+ },
1824
+ template: `
1825
+ <UiFileItem
1826
+ filename="Attached documents"
1827
+ type-label="4 files"
1828
+ size-label="42 MB"
1829
+ expand-label="Show attached documents"
1830
+ list-label="Attached files"
1831
+ :items="items"
1832
+ @remove="onRemove"
1833
+ @remove-item="onRemoveItem"
1834
+ />
1835
+ `,
1836
+ }),
1837
+ play: async ({ canvasElement, step }) => {
1838
+ // Scenario (UiFileItem): a keyboard user expands a group of mixed file
1839
+ // types, hears each file, and removes one without collapsing the summary.
1840
+ onRemoveItem.mockClear();
1841
+ const canvas = within(canvasElement);
1842
+ const body = within(document.body);
1843
+ const chevron = canvas.getByRole('button', {
1844
+ name: 'Show attached documents',
1845
+ });
1846
+
1847
+ await step(
1848
+ 'keyboard: the chevron follows the remove control and opens with Enter (WCAG 2.1.1)',
1849
+ async () => {
1850
+ await userEvent.tab();
1851
+ await userEvent.tab();
1852
+ await expect(chevron).toHaveFocus();
1853
+ await userEvent.keyboard('{Enter}');
1854
+ await expect(chevron).toHaveAttribute('aria-expanded', 'true');
1855
+ },
1856
+ );
1857
+
1858
+ await step(
1859
+ 'interaction: the popover lists each file with the icon for its type',
1860
+ async () => {
1861
+ const list = await body.findByRole('list', { name: 'Attached files' });
1862
+ // The panel fades and zooms in, so it is in the DOM a frame before it
1863
+ // is visible.
1864
+ await waitFor(async () => {
1865
+ await expect(list).toBeVisible();
1866
+ });
1867
+ const tones = Array.from(
1868
+ list.querySelectorAll('[data-slot="file-type"]'),
1869
+ ).map((badge) => badge.getAttribute('data-tone'));
1870
+ await expect(tones).toEqual([
1871
+ 'accent-pink',
1872
+ 'accent-soft',
1873
+ 'accent-yellow',
1874
+ 'accent-orange',
1875
+ ]);
1876
+ for (const label of ['PDF', 'MD', 'CSV', 'MP4']) {
1877
+ await waitFor(async () => {
1878
+ await expect(within(list).getByText(label)).toBeVisible();
1879
+ });
1880
+ }
1881
+ },
1882
+ );
1883
+
1884
+ await step(
1885
+ 'screen-reader: each file in the list exposes its full filename (WCAG 4.1.2)',
1886
+ async () => {
1887
+ const list = body.getByRole('list', { name: 'Attached files' });
1888
+ await expect(
1889
+ within(list).getByLabelText('26_Business_Plan_2026.pdf'),
1890
+ ).toHaveTextContent('26_Business_Plan_2026');
1891
+ await expect(
1892
+ within(list).getByRole('button', {
1893
+ name: 'Remove Last_weeks_memory.md',
1894
+ }),
1895
+ ).toHaveAccessibleName('Remove Last_weeks_memory.md');
1896
+ },
1897
+ );
1898
+
1899
+ await step(
1900
+ 'interaction: removing a file inside the list emits that file',
1901
+ async () => {
1902
+ await userEvent.click(
1903
+ body.getByRole('button', { name: 'Remove Tabular_analysis.csv' }),
1904
+ );
1905
+ await expect(onRemoveItem).toHaveBeenCalledTimes(1);
1906
+ await expect(onRemoveItem.mock.calls[0]?.[0]).toMatchObject({
1907
+ id: 'sheet',
1908
+ filename: 'Tabular_analysis.csv',
1909
+ });
1910
+ },
1911
+ );
1912
+
1913
+ await step('keyboard: Escape closes the file list', async () => {
1914
+ await userEvent.keyboard('{Escape}');
1915
+ await expect(chevron).toHaveAttribute('aria-expanded', 'false');
1916
+ await waitFor(async () => {
1917
+ await expect(
1918
+ body.queryByRole('list', { name: 'Attached files' }),
1919
+ ).not.toBeInTheDocument();
1920
+ });
1921
+ });
1136
1922
  },
1137
1923
  };
1138
1924