@aleph-alpha/ui-library 6.5.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 (176) hide show
  1. package/dist/system/components/core/toggle/index.d.ts +1 -1
  2. package/dist/system/lib.js +14623 -14438
  3. package/dist/system/patterns/UiFloatActions/UiFloatActionItems.vue.d.ts +21 -174
  4. package/dist/system/patterns/UiFloatActions/core/FloatingButton.vue.d.ts +36 -0
  5. package/dist/system/patterns/UiFloatActions/core/FloatingInput.vue.d.ts +19 -0
  6. package/dist/system/patterns/UiFloatActions/floatActionItemContext.d.ts +3 -1
  7. package/dist/system/patterns/UiFloatActions/types.d.ts +93 -19
  8. package/dist/system/patterns/UiLayout/layout-shell.d.ts +117 -252
  9. package/package.json +2 -2
  10. package/src/components/UiAccordion/UiAccordion.stories.ts +8 -8
  11. package/src/components/UiAlert/UiAlert.stories.ts +13 -13
  12. package/src/components/UiAlertDialog/UiAlertDialog.stories.ts +4 -4
  13. package/src/components/UiAutocomplete/UiAutocomplete.stories.ts +13 -13
  14. package/src/components/UiAutocomplete/UiAutocomplete.vue +3 -3
  15. package/src/components/UiBadge/UiBadge.stories.ts +9 -9
  16. package/src/components/UiBreadcrumb/UiBreadcrumb.stories.ts +14 -14
  17. package/src/components/UiButton/UiButton.stories.ts +35 -35
  18. package/src/components/UiButtonGroup/UiButtonGroup.stories.ts +6 -6
  19. package/src/components/UiCalendar/UiCalendar.stories.ts +6 -6
  20. package/src/components/UiCard/UiCard.stories.ts +6 -6
  21. package/src/components/UiCheckbox/UiCheckbox.stories.ts +30 -30
  22. package/src/components/UiChip/UiChip.stories.ts +14 -14
  23. package/src/components/UiChip/UiChip.vue +1 -1
  24. package/src/components/UiDialog/UiDialog.stories.ts +20 -20
  25. package/src/components/UiDrawer/UiDrawer.stories.ts +29 -29
  26. package/src/components/UiDropdownMenu/UiDropdownMenu.stories.ts +13 -13
  27. package/src/components/UiEmpty/UiEmpty.vue +1 -1
  28. package/src/components/UiFadeMask/UiFadeMask.stories.ts +13 -13
  29. package/src/components/UiField/UiField.stories.ts +27 -27
  30. package/src/components/UiFileItem/UiFileItem.vue +4 -4
  31. package/src/components/UiFileItem/__tests__/UiFileItem.test.ts +2 -2
  32. package/src/components/UiFileType/UiFileType.stories.ts +10 -10
  33. package/src/components/UiFileUploadBox/UiFileUploadBox.stories.ts +10 -10
  34. package/src/components/UiFileUploadBox/UiFileUploadBox.vue +3 -3
  35. package/src/components/UiIcon/UiIcon.stories.ts +9 -9
  36. package/src/components/UiInput/UiInput.stories.ts +13 -13
  37. package/src/components/UiInput/UiInput.vue +1 -1
  38. package/src/components/UiInputGroup/UiInputGroup.stories.ts +10 -10
  39. package/src/components/UiItem/UiItem.stories.ts +12 -12
  40. package/src/components/UiItem/__tests__/UiItem.test.ts +2 -2
  41. package/src/components/UiKbd/UiKbd.stories.ts +18 -18
  42. package/src/components/UiKbd/UiKbd.vue +1 -1
  43. package/src/components/UiLabel/UiLabel.stories.ts +12 -12
  44. package/src/components/UiLabel/__tests__/UiLabel.test.ts +1 -1
  45. package/src/components/UiListbox/UiListbox.stories.ts +20 -20
  46. package/src/components/UiNavigationMenu/UiNavigationMenu.stories.ts +94 -94
  47. package/src/components/UiPopover/UiPopover.stories.ts +35 -35
  48. package/src/components/UiRadioGroup/UiRadioGroup.stories.ts +53 -53
  49. package/src/components/UiRangeCalendar/UiRangeCalendar.stories.ts +6 -6
  50. package/src/components/UiResizable/UiResizable.stories.ts +40 -40
  51. package/src/components/UiSelect/UiSelect.stories.ts +14 -14
  52. package/src/components/UiSeparator/UiSeparator.stories.ts +16 -16
  53. package/src/components/UiSheet/UiSheet.stories.ts +29 -29
  54. package/src/components/UiSlider/UiSlider.stories.ts +28 -28
  55. package/src/components/UiSnackbar/UiSnackbar.stories.ts +6 -6
  56. package/src/components/UiSnackbar/UiSnackbar.vue +2 -2
  57. package/src/components/UiSnackbar/UiSnackbarContent.vue +2 -2
  58. package/src/components/UiSpinner/UiSpinner.stories.ts +8 -8
  59. package/src/components/UiStepper/UiStepper.stories.ts +6 -6
  60. package/src/components/UiSwitch/UiSwitch.stories.ts +37 -37
  61. package/src/components/UiTable/UiTable.stories.ts +4 -4
  62. package/src/components/UiTabs/UiTabs.stories.ts +64 -64
  63. package/src/components/UiTagsInput/UiTagsInput.stories.ts +16 -16
  64. package/src/components/UiTextarea/UiTextarea.stories.ts +20 -20
  65. package/src/components/UiToggle/UiToggle.stories.ts +26 -26
  66. package/src/components/UiToggleGroup/UiToggleGroup.stories.ts +31 -31
  67. package/src/components/UiTooltip/UiTooltip.stories.ts +7 -7
  68. package/src/components/core/accordion/AccordionContent.vue +1 -1
  69. package/src/components/core/accordion/AccordionTrigger.vue +1 -1
  70. package/src/components/core/alert/AlertDescription.vue +1 -1
  71. package/src/components/core/alert/index.ts +1 -1
  72. package/src/components/core/alert-dialog/AlertDialogDescription.vue +1 -1
  73. package/src/components/core/badge/index.ts +2 -2
  74. package/src/components/core/button/index.ts +3 -3
  75. package/src/components/core/calendar/Calendar.vue +4 -4
  76. package/src/components/core/calendar/CalendarCell.vue +1 -1
  77. package/src/components/core/calendar/CalendarHeading.vue +1 -1
  78. package/src/components/core/card/CardDescription.vue +1 -1
  79. package/src/components/core/dialog/DialogDescription.vue +1 -1
  80. package/src/components/core/drawer/DrawerDescription.vue +1 -1
  81. package/src/components/core/dropdown-menu/DropdownMenuCheckboxItem.vue +1 -1
  82. package/src/components/core/dropdown-menu/DropdownMenuLabel.vue +1 -1
  83. package/src/components/core/dropdown-menu/DropdownMenuRadioItem.vue +1 -1
  84. package/src/components/core/dropdown-menu/DropdownMenuShortcut.vue +1 -1
  85. package/src/components/core/dropdown-menu/DropdownMenuSubTrigger.vue +1 -1
  86. package/src/components/core/field/FieldDescription.vue +1 -1
  87. package/src/components/core/field/FieldError.vue +1 -1
  88. package/src/components/core/field/FieldLabel.vue +1 -1
  89. package/src/components/core/field/FieldLegend.vue +2 -2
  90. package/src/components/core/field/FieldSeparator.vue +1 -1
  91. package/src/components/core/field/FieldTitle.vue +1 -1
  92. package/src/components/core/input/Input.vue +1 -1
  93. package/src/components/core/input-group/InputGroupText.vue +1 -1
  94. package/src/components/core/input-group/index.ts +1 -1
  95. package/src/components/core/item/ItemDescription.vue +1 -1
  96. package/src/components/core/item/ItemTitle.vue +1 -1
  97. package/src/components/core/item/index.ts +2 -2
  98. package/src/components/core/label/Label.vue +1 -1
  99. package/src/components/core/listbox/ListboxFilter.vue +1 -1
  100. package/src/components/core/listbox/ListboxGroupLabel.vue +1 -1
  101. package/src/components/core/listbox/ListboxItem.vue +1 -1
  102. package/src/components/core/native-select/NativeSelect.vue +1 -1
  103. package/src/components/core/navigation-menu/NavigationMenuLink.vue +1 -1
  104. package/src/components/core/navigation-menu/index.ts +1 -1
  105. package/src/components/core/range-calendar/RangeCalendarCell.vue +1 -1
  106. package/src/components/core/range-calendar/RangeCalendarHeading.vue +1 -1
  107. package/src/components/core/select/SelectItem.vue +1 -1
  108. package/src/components/core/select/SelectLabel.vue +1 -1
  109. package/src/components/core/select/SelectTrigger.vue +1 -1
  110. package/src/components/core/sheet/SheetDescription.vue +1 -1
  111. package/src/components/core/sidebar/SidebarGroupContent.vue +1 -1
  112. package/src/components/core/sidebar/SidebarGroupLabel.vue +1 -1
  113. package/src/components/core/sidebar/SidebarMenuBadge.vue +1 -1
  114. package/src/components/core/sidebar/SidebarMenuSubButton.vue +2 -2
  115. package/src/components/core/sidebar/index.ts +4 -4
  116. package/src/components/core/stepper/StepperDescription.vue +1 -1
  117. package/src/components/core/stepper/StepperTitle.vue +1 -1
  118. package/src/components/core/table/Table.vue +1 -1
  119. package/src/components/core/table/TableCaption.vue +1 -1
  120. package/src/components/core/table/TableEmpty.vue +1 -1
  121. package/src/components/core/tabs/TabsTrigger.vue +1 -1
  122. package/src/components/core/tags-input/TagsInput.vue +1 -1
  123. package/src/components/core/tags-input/TagsInputItem.vue +1 -1
  124. package/src/components/core/textarea/Textarea.vue +1 -1
  125. package/src/components/core/toggle/index.ts +1 -1
  126. package/src/components/core/tooltip/TooltipContent.vue +1 -1
  127. package/src/directives/vHover.stories.ts +17 -17
  128. package/src/lib/useDevice.stories.ts +29 -29
  129. package/src/lib/useDrag.stories.ts +14 -14
  130. package/src/patterns/UiDataTable/UiDataTable.stories.ts +27 -27
  131. package/src/patterns/UiDataTable/UiDataTableColumnFilter.vue +2 -2
  132. package/src/patterns/UiDataTable/UiDataTableFilterMenu.vue +2 -2
  133. package/src/patterns/UiDataTable/UiDataTablePagination.vue +3 -3
  134. package/src/patterns/UiDataTable/__tests__/UiDataTableColumnFilter.test.ts +2 -2
  135. package/src/patterns/UiDatePicker/UiDatePicker.stories.ts +14 -14
  136. package/src/patterns/UiFileUpload/UiFileItem.stories.ts +14 -14
  137. package/src/patterns/UiFileUpload/UiFileUpload.stories.ts +6 -6
  138. package/src/patterns/UiFloatActions/UiFloatActionItems.vue +226 -76
  139. package/src/patterns/UiFloatActions/UiFloatActions.stories.ts +1136 -116
  140. package/src/patterns/UiFloatActions/__tests__/UiFloatActionItems.test.ts +187 -1
  141. package/src/patterns/UiFloatActions/core/FloatingButton.vue +83 -0
  142. package/src/patterns/UiFloatActions/core/FloatingInput.vue +53 -0
  143. package/src/patterns/UiFloatActions/floatActionItemContext.ts +3 -1
  144. package/src/patterns/UiFloatActions/types.ts +106 -19
  145. package/src/patterns/UiLayout/UiLayoutContent.stories.ts +17 -17
  146. package/src/patterns/UiLayout/UiLayoutMobile.stories.ts +4 -4
  147. package/src/patterns/UiLayout/layout-shell.ts +6 -6
  148. package/src/patterns/UiProfileCard/UiProfileCard.stories.ts +8 -8
  149. package/src/patterns/UiProfileCard/profile-card.ts +2 -2
  150. package/src/patterns/UiSidebar/UiSidebar.stories.ts +6 -6
  151. package/src/patterns/UiSidebar/UiSidebarGroup.stories.ts +1 -1
  152. package/src/patterns/UiSidebar/UiSidebarGroupLabel.stories.ts +4 -4
  153. package/src/patterns/UiSidebar/UiSidebarGroupLabel.vue +1 -1
  154. package/src/patterns/UiSidebar/UiSidebarHeader.vue +1 -1
  155. package/src/patterns/UiSidebar/UiSidebarMenuButton.stories.ts +7 -7
  156. package/src/patterns/UiSidebar/UiSidebarMenuButton.vue +4 -4
  157. package/src/patterns/UiSidebar/UiSidebarMenuItem.stories.ts +4 -4
  158. package/src/patterns/UiSidebar/UiSidebarMenuSubItem.stories.ts +1 -1
  159. package/src/patterns/UiSidebar/UiSidebarMenuSubItem.vue +1 -1
  160. package/src/patterns/UiSidebar/UiSidebarPopoverMenu.vue +1 -1
  161. package/src/patterns/UiSidebar/UiSidebarPopoverMenuItem.vue +3 -3
  162. package/src/patterns/UiSidebar/UiSidebarPopoverTrigger.stories.ts +1 -1
  163. package/src/patterns/UiSidebar/UiSidebarPopoverTrigger.vue +1 -1
  164. package/src/patterns/UiSidebar/UiSidebarSub.stories.ts +1 -1
  165. package/src/patterns/UiTopBar/UiTopBar.stories.ts +24 -24
  166. package/src/theme/Background.stories.ts +62 -62
  167. package/src/theme/Border.stories.ts +19 -19
  168. package/src/theme/BorderRadius.stories.ts +14 -14
  169. package/src/theme/Extended.stories.ts +26 -26
  170. package/src/theme/Flex.stories.ts +21 -21
  171. package/src/theme/Grid.stories.ts +19 -19
  172. package/src/theme/HoverLayer.stories.ts +26 -26
  173. package/src/theme/Overlay.stories.ts +14 -14
  174. package/src/theme/Scrollbar.stories.ts +58 -58
  175. package/src/theme/Shadow.stories.ts +5 -5
  176. package/src/theme/Theme.stories.ts +38 -38
@@ -1,5 +1,12 @@
1
1
  import type { Meta, StoryObj } from '@storybook/vue3-vite';
2
- import { expect, fn, userEvent, waitFor, within } from 'storybook/test';
2
+ import {
3
+ expect,
4
+ fireEvent,
5
+ fn,
6
+ userEvent,
7
+ waitFor,
8
+ within,
9
+ } from 'storybook/test';
3
10
  import { reactive, ref, useId } from 'vue';
4
11
  import UiFloatActions from './UiFloatActions.vue';
5
12
  import { UiFloatActionItems } from './index';
@@ -98,7 +105,9 @@ type Story = StoryObj<typeof meta>;
98
105
  const onItemClick = fn();
99
106
 
100
107
  /**
101
- * Trigger modes: `hover`, `click`, `focus`, and `manual`.
108
+ * Trigger modes: `hover`, `click`, `focus`, and `manual`, plus the default
109
+ * (always visible) mode: render `UiFloatActionItems` without `UiFloatActions`
110
+ * to show the actions without any trigger.
102
111
  * Each anchor renders as a focusable button, so keyboard users get the same
103
112
  * `ui-focus-ring` treatment (matching UiButton: focus-ring border + 3px ring) as
104
113
  * the rest of the library. Tab to any anchor to see the shared focus style.
@@ -148,7 +157,7 @@ export const ShowModes: Story = {
148
157
  :key="mode.trigger"
149
158
  class="flex flex-col items-center gap-3"
150
159
  >
151
- <span class="label-14-medium text-content-on-surface-secondary">{{ mode.label }}</span>
160
+ <span class="label-s-medium text-content-on-surface-secondary">{{ mode.label }}</span>
152
161
  <UiFloatActions
153
162
  :trigger="mode.trigger"
154
163
  :open="mode.trigger === 'manual' ? manualOpen : undefined"
@@ -157,7 +166,7 @@ export const ShowModes: Story = {
157
166
  :aria-label="mode.label + ' actions'"
158
167
  >
159
168
  <template #container>
160
- <span class="rounded-md border border-border-surface-default bg-background-surface-primary px-4 py-2 body-14-regular">
169
+ <span class="rounded-md border border-border-surface-default bg-background-surface-primary px-4 py-2 body-s-regular">
161
170
  {{ mode.hint }}
162
171
  </span>
163
172
  </template>
@@ -174,21 +183,40 @@ export const ShowModes: Story = {
174
183
  </UiFloatActions>
175
184
  <label
176
185
  v-if="mode.trigger === 'manual'"
177
- class="flex items-center gap-2 label-14-regular text-content-on-surface-secondary"
186
+ class="flex items-center gap-2 label-s-regular text-content-on-surface-secondary"
178
187
  >
179
188
  <UiSwitch v-model="manualOpen" name="manual-open" />
180
189
  {{ manualOpen ? 'Open' : 'Closed' }}
181
190
  </label>
182
191
  </div>
192
+
193
+ <!-- Default: no trigger — render UiFloatActionItems on its own so the
194
+ actions are always visible. -->
195
+ <div class="flex flex-col items-center gap-3">
196
+ <span class="label-s-medium text-content-on-surface-secondary">Default (always visible)</span>
197
+ <div class="flex flex-col items-center gap-2.5">
198
+ <UiFloatActionItems aria-label="Default actions">
199
+ <UiFloatActionItems type="button" aria-label="Edit">
200
+ <UiIcon name="edit" size="s" />
201
+ </UiFloatActionItems>
202
+ <UiFloatActionItems type="button" aria-label="More">
203
+ <UiIcon name="more-vertical" size="s" />
204
+ </UiFloatActionItems>
205
+ </UiFloatActionItems>
206
+ <span class="rounded-md border border-border-surface-default bg-background-surface-primary px-4 py-2 body-s-regular">
207
+ Actions are shown without a trigger
208
+ </span>
209
+ </div>
210
+ </div>
183
211
  </div>
184
212
 
185
213
  <div class="grid w-full grid-cols-1 place-items-center gap-10 md:grid-cols-2">
186
214
  <!-- Clickable: stateless action buttons revealed on hover -->
187
215
  <div class="flex flex-col items-center gap-3">
188
- <span class="label-14-medium text-content-on-surface-secondary">Clickable</span>
216
+ <span class="label-s-medium text-content-on-surface-secondary">Clickable</span>
189
217
  <UiFloatActions trigger="hover" placement="top" :offset="10" aria-label="Clickable actions">
190
218
  <template #container>
191
- <span class="rounded-md border border-border-surface-default bg-background-surface-primary px-4 py-2 body-14-regular">
219
+ <span class="rounded-md border border-border-surface-default bg-background-surface-primary px-4 py-2 body-s-regular">
192
220
  Hover to reveal actions
193
221
  </span>
194
222
  </template>
@@ -210,28 +238,28 @@ export const ShowModes: Story = {
210
238
 
211
239
  <!-- Selectable (v-model): single-select with the sliding indicator, revealed on hover -->
212
240
  <div class="flex flex-col items-center gap-3">
213
- <span class="label-14-medium text-content-on-surface-secondary">Selectable (v-model)</span>
241
+ <span class="label-s-medium text-content-on-surface-secondary">Selectable (v-model)</span>
214
242
  <UiFloatActions trigger="hover" placement="top" :offset="10" aria-label="Selectable view mode">
215
243
  <template #container>
216
- <span class="rounded-md border border-border-surface-default bg-background-surface-primary px-4 py-2 body-14-regular">
244
+ <span class="rounded-md border border-border-surface-default bg-background-surface-primary px-4 py-2 body-s-regular">
217
245
  Hover to reveal view modes
218
246
  </span>
219
247
  </template>
220
248
  <template #action>
221
249
  <UiFloatActionItems v-model="view" aria-label="View mode">
222
- <UiFloatActionItems type="button" value="grid" aria-label="Grid" class="w-auto gap-1.5 px-3 label-14-medium">
250
+ <UiFloatActionItems type="button" value="grid" aria-label="Grid" class="w-auto gap-1.5 px-3 label-s-medium">
223
251
  <UiIcon name="layout-grid" size="s" />Grid
224
252
  </UiFloatActionItems>
225
- <UiFloatActionItems type="button" value="list" aria-label="List" class="w-auto gap-1.5 px-3 label-14-medium">
253
+ <UiFloatActionItems type="button" value="list" aria-label="List" class="w-auto gap-1.5 px-3 label-s-medium">
226
254
  <UiIcon name="list" size="s" />List
227
255
  </UiFloatActionItems>
228
- <UiFloatActionItems type="button" value="table" aria-label="Table" class="w-auto gap-1.5 px-3 label-14-medium">
256
+ <UiFloatActionItems type="button" value="table" aria-label="Table" class="w-auto gap-1.5 px-3 label-s-medium">
229
257
  <UiIcon name="table" size="s" />Table
230
258
  </UiFloatActionItems>
231
259
  </UiFloatActionItems>
232
260
  </template>
233
261
  </UiFloatActions>
234
- <span class="label-12-regular text-content-on-surface-muted">Selected: {{ view }}</span>
262
+ <span class="label-xs-regular text-content-on-surface-muted">Selected: {{ view }}</span>
235
263
  </div>
236
264
  </div>
237
265
  </div>
@@ -241,6 +269,34 @@ export const ShowModes: Story = {
241
269
  controls: { disable: true },
242
270
  docs: { canvas: { sourceState: 'none' } },
243
271
  },
272
+ play: async ({ canvasElement, step }) => {
273
+ // Scenario (UiFloatActionItems): without UiFloatActions the toolbar is the
274
+ // default mode — rendered inline, always visible, and reachable without
275
+ // opening any popup trigger.
276
+ const canvas = within(canvasElement);
277
+ const toolbar = canvas.getByRole('toolbar', { name: 'Default actions' });
278
+
279
+ await step(
280
+ 'screen-reader: the always-visible toolbar is named and not hidden behind a popup trigger (WCAG 4.1.2)',
281
+ async () => {
282
+ await expect(toolbar).toBeVisible();
283
+ await expect(toolbar.closest('[aria-haspopup]')).toBeNull();
284
+ await expect(
285
+ within(toolbar).getByRole('button', { name: 'Edit' }),
286
+ ).toBeVisible();
287
+ },
288
+ );
289
+
290
+ await step(
291
+ 'interaction: the default mode renders inline in the page, not teleported',
292
+ async () => {
293
+ await expect(canvasElement).toContainElement(toolbar);
294
+ await expect(
295
+ within(toolbar).getByRole('button', { name: 'Edit' }),
296
+ ).toHaveAttribute('tabindex', '0');
297
+ },
298
+ );
299
+ },
244
300
  };
245
301
 
246
302
  /**
@@ -267,11 +323,11 @@ export const Examples: Story = {
267
323
  },
268
324
  template: `
269
325
  <div class="flex min-h-96 flex-col items-center gap-8 p-8">
270
- <p class="max-w-md text-center body-14-regular text-content-on-surface-secondary">
326
+ <p class="max-w-md text-center body-s-regular text-content-on-surface-secondary">
271
327
  These are examples — combine the item types and orientation to compose your own toolbars.
272
328
  </p>
273
329
 
274
- <label class="flex items-center gap-2 label-14-medium text-content-on-surface-secondary">
330
+ <label class="flex items-center gap-2 label-s-medium text-content-on-surface-secondary">
275
331
  <UiCheckbox name="examples-with-model" v-model="withModel" />
276
332
  Enable v-model (active indicator)
277
333
  </label>
@@ -285,17 +341,17 @@ export const Examples: Story = {
285
341
  :model-value="withModel ? selection.labels : undefined"
286
342
  @update:model-value="selection.labels = $event"
287
343
  >
288
- <UiFloatActionItems type="button" value="fullscreen" aria-label="Fullscreen" class="w-auto gap-1.5 px-3 label-14-medium">
344
+ <UiFloatActionItems type="button" value="fullscreen" aria-label="Fullscreen" class="w-auto gap-1.5 px-3 label-s-medium">
289
345
  <UiIcon name="maximize" size="s" />Fullscreen
290
346
  </UiFloatActionItems>
291
- <UiFloatActionItems type="button" value="sidebar" aria-label="Sidebar" class="w-auto gap-1.5 px-3 label-14-medium">
347
+ <UiFloatActionItems type="button" value="sidebar" aria-label="Sidebar" class="w-auto gap-1.5 px-3 label-s-medium">
292
348
  <UiIcon name="panel-left" size="s" />Sidebar
293
349
  </UiFloatActionItems>
294
- <UiFloatActionItems type="button" value="dashboard" aria-label="Dashboard" class="w-auto gap-1.5 px-3 label-14-medium">
350
+ <UiFloatActionItems type="button" value="dashboard" aria-label="Dashboard" class="w-auto gap-1.5 px-3 label-s-medium">
295
351
  <UiIcon name="layout-grid" size="s" />Dashboard
296
352
  </UiFloatActionItems>
297
353
  </UiFloatActionItems>
298
- <span class="label-14-regular text-content-on-surface-secondary">button (icon + text)</span>
354
+ <span class="label-s-regular text-content-on-surface-secondary">button (icon + text)</span>
299
355
 
300
356
  <!-- Text-only buttons -->
301
357
  <UiFloatActionItems
@@ -304,17 +360,17 @@ export const Examples: Story = {
304
360
  :model-value="withModel ? selection.text : undefined"
305
361
  @update:model-value="selection.text = $event"
306
362
  >
307
- <UiFloatActionItems type="button" value="fullscreen" aria-label="Fullscreen" class="w-auto px-3 label-14-medium">
363
+ <UiFloatActionItems type="button" value="fullscreen" aria-label="Fullscreen" class="w-auto px-3 label-s-medium">
308
364
  Fullscreen
309
365
  </UiFloatActionItems>
310
- <UiFloatActionItems type="button" value="sidebar" aria-label="Sidebar" class="w-auto px-3 label-14-medium">
366
+ <UiFloatActionItems type="button" value="sidebar" aria-label="Sidebar" class="w-auto px-3 label-s-medium">
311
367
  Sidebar
312
368
  </UiFloatActionItems>
313
- <UiFloatActionItems type="button" value="dashboard" aria-label="Dashboard" class="w-auto px-3 label-14-medium">
369
+ <UiFloatActionItems type="button" value="dashboard" aria-label="Dashboard" class="w-auto px-3 label-s-medium">
314
370
  Dashboard
315
371
  </UiFloatActionItems>
316
372
  </UiFloatActionItems>
317
- <span class="label-14-regular text-content-on-surface-secondary">button (text)</span>
373
+ <span class="label-s-regular text-content-on-surface-secondary">button (text)</span>
318
374
 
319
375
  <!-- Vertical with icon + text -->
320
376
  <UiFloatActionItems
@@ -324,17 +380,17 @@ export const Examples: Story = {
324
380
  :model-value="withModel ? selection.vLabels : undefined"
325
381
  @update:model-value="selection.vLabels = $event"
326
382
  >
327
- <UiFloatActionItems type="button" value="fullscreen" aria-label="Fullscreen" class="w-full justify-start gap-1.5 px-3 label-14-medium">
383
+ <UiFloatActionItems type="button" value="fullscreen" aria-label="Fullscreen" class="w-full justify-start gap-1.5 px-3 label-s-medium">
328
384
  <UiIcon name="maximize" size="s" />Fullscreen
329
385
  </UiFloatActionItems>
330
- <UiFloatActionItems type="button" value="sidebar" aria-label="Sidebar" class="w-full justify-start gap-1.5 px-3 label-14-medium">
386
+ <UiFloatActionItems type="button" value="sidebar" aria-label="Sidebar" class="w-full justify-start gap-1.5 px-3 label-s-medium">
331
387
  <UiIcon name="panel-left" size="s" />Sidebar
332
388
  </UiFloatActionItems>
333
- <UiFloatActionItems type="button" value="dashboard" aria-label="Dashboard" class="w-full justify-start gap-1.5 px-3 label-14-medium">
389
+ <UiFloatActionItems type="button" value="dashboard" aria-label="Dashboard" class="w-full justify-start gap-1.5 px-3 label-s-medium">
334
390
  <UiIcon name="layout-grid" size="s" />Dashboard
335
391
  </UiFloatActionItems>
336
392
  </UiFloatActionItems>
337
- <span class="label-14-regular text-content-on-surface-secondary">button (icon + text) · vertical</span>
393
+ <span class="label-s-regular text-content-on-surface-secondary">button (icon + text) · vertical</span>
338
394
 
339
395
  <!-- Vertical text only -->
340
396
  <UiFloatActionItems
@@ -344,17 +400,17 @@ export const Examples: Story = {
344
400
  :model-value="withModel ? selection.vText : undefined"
345
401
  @update:model-value="selection.vText = $event"
346
402
  >
347
- <UiFloatActionItems type="button" value="fullscreen" aria-label="Fullscreen" class="w-full justify-start px-3 label-14-medium">
403
+ <UiFloatActionItems type="button" value="fullscreen" aria-label="Fullscreen" class="w-full justify-start px-3 label-s-medium">
348
404
  Fullscreen
349
405
  </UiFloatActionItems>
350
- <UiFloatActionItems type="button" value="sidebar" aria-label="Sidebar" class="w-full justify-start px-3 label-14-medium">
406
+ <UiFloatActionItems type="button" value="sidebar" aria-label="Sidebar" class="w-full justify-start px-3 label-s-medium">
351
407
  Sidebar
352
408
  </UiFloatActionItems>
353
- <UiFloatActionItems type="button" value="dashboard" aria-label="Dashboard" class="w-full justify-start px-3 label-14-medium">
409
+ <UiFloatActionItems type="button" value="dashboard" aria-label="Dashboard" class="w-full justify-start px-3 label-s-medium">
354
410
  Dashboard
355
411
  </UiFloatActionItems>
356
412
  </UiFloatActionItems>
357
- <span class="label-14-regular text-content-on-surface-secondary">button (text) · vertical</span>
413
+ <span class="label-s-regular text-content-on-surface-secondary">button (text) · vertical</span>
358
414
 
359
415
  <!-- Stateless toolbars (icon-only and inputs) — no v-model -->
360
416
  <!-- Icon-only buttons -->
@@ -369,7 +425,7 @@ export const Examples: Story = {
369
425
  <UiIcon name="layout-grid" size="s" />
370
426
  </UiFloatActionItems>
371
427
  </UiFloatActionItems>
372
- <span class="label-14-regular text-content-on-surface-secondary">button (icon only)</span>
428
+ <span class="label-s-regular text-content-on-surface-secondary">button (icon only)</span>
373
429
 
374
430
  <!-- Icon-only buttons (edit actions) -->
375
431
  <UiFloatActionItems aria-label="Edit actions" class="justify-self-center">
@@ -380,31 +436,33 @@ export const Examples: Story = {
380
436
  <UiIcon name="trash" size="s" />
381
437
  </UiFloatActionItems>
382
438
  </UiFloatActionItems>
383
- <span class="label-14-regular text-content-on-surface-secondary">button (icon only)</span>
439
+ <span class="label-s-regular text-content-on-surface-secondary">button (icon only)</span>
384
440
 
385
441
  <!-- With input (pagination) -->
386
442
  <UiFloatActionItems aria-label="Pagination" class="justify-self-center">
387
- <UiFloatActionItems type="button" aria-label="Previous page">
388
- <UiIcon name="chevron-left" size="s" />
389
- </UiFloatActionItems>
390
- <UiFloatActionItems type="input" aria-label="Page number" placeholder="0/0" class="w-14 text-center" />
391
- <UiFloatActionItems type="button" aria-label="Next page">
392
- <UiIcon name="chevron-right" size="s" />
393
- </UiFloatActionItems>
443
+ <UiFloatActionItems
444
+ type="input"
445
+ aria-label="Page number"
446
+ placeholder="0/0"
447
+ previous-aria-label="Previous page"
448
+ next-aria-label="Next page"
449
+ />
394
450
  </UiFloatActionItems>
395
- <span class="label-14-regular text-content-on-surface-secondary">button + input + button</span>
451
+ <span class="label-s-regular text-content-on-surface-secondary">input (previous + field + next)</span>
396
452
 
397
453
  <!-- With input (zoom level) -->
398
454
  <UiFloatActionItems aria-label="Zoom" class="justify-self-center">
399
- <UiFloatActionItems type="button" aria-label="Zoom out">
400
- <UiIcon name="minus" size="s" />
401
- </UiFloatActionItems>
402
- <UiFloatActionItems type="input" aria-label="Zoom level" placeholder="100%" class="w-16 text-center" />
403
- <UiFloatActionItems type="button" aria-label="Zoom in">
404
- <UiIcon name="plus" size="s" />
405
- </UiFloatActionItems>
455
+ <UiFloatActionItems
456
+ type="input"
457
+ aria-label="Zoom level"
458
+ placeholder="100%"
459
+ previous-icon="minus"
460
+ next-icon="plus"
461
+ previous-aria-label="Zoom out"
462
+ next-aria-label="Zoom in"
463
+ />
406
464
  </UiFloatActionItems>
407
- <span class="label-14-regular text-content-on-surface-secondary">button + input + button</span>
465
+ <span class="label-s-regular text-content-on-surface-secondary">input with custom icons</span>
408
466
  </div>
409
467
  </div>
410
468
  `,
@@ -475,7 +533,7 @@ export const IconOnlyWithTooltip: Story = {
475
533
  },
476
534
  template: `
477
535
  <div class="flex min-h-64 flex-col items-center justify-center gap-4 p-8">
478
- <p class="max-w-sm text-center body-14-regular text-content-on-surface-secondary">
536
+ <p class="max-w-sm text-center body-s-regular text-content-on-surface-secondary">
479
537
  Hover or focus each icon to reveal its tooltip on a different side.
480
538
  </p>
481
539
  <UiFloatActions
@@ -486,7 +544,7 @@ export const IconOnlyWithTooltip: Story = {
486
544
  aria-label="Icon actions"
487
545
  >
488
546
  <template #container>
489
- <span class="rounded-md border border-border-surface-default bg-background-surface-primary px-4 py-2 body-14-regular">
547
+ <span class="rounded-md border border-border-surface-default bg-background-surface-primary px-4 py-2 body-s-regular">
490
548
  Icon toolbar
491
549
  </span>
492
550
  </template>
@@ -536,13 +594,13 @@ import { UiFloatActions, UiFloatActionItems, UiIcon } from '@aleph-alpha/ui-libr
536
594
  <template #action>
537
595
  <UiFloatActionItems aria-label="Text actions">
538
596
  <!-- Icon + visible text label: no tooltip needed. -->
539
- <UiFloatActionItems type="button" aria-label="Edit" class="w-auto gap-1.5 px-3 label-14-medium">
597
+ <UiFloatActionItems type="button" aria-label="Edit" class="w-auto gap-1.5 px-3 label-s-medium">
540
598
  <UiIcon name="edit" size="s" />Edit
541
599
  </UiFloatActionItems>
542
- <UiFloatActionItems type="button" aria-label="Copy" class="w-auto gap-1.5 px-3 label-14-medium">
600
+ <UiFloatActionItems type="button" aria-label="Copy" class="w-auto gap-1.5 px-3 label-s-medium">
543
601
  <UiIcon name="copy" size="s" />Copy
544
602
  </UiFloatActionItems>
545
- <UiFloatActionItems type="button" aria-label="Delete" class="w-auto gap-1.5 px-3 label-14-medium">
603
+ <UiFloatActionItems type="button" aria-label="Delete" class="w-auto gap-1.5 px-3 label-s-medium">
546
604
  <UiIcon name="trash" size="s" />Delete
547
605
  </UiFloatActionItems>
548
606
  </UiFloatActionItems>
@@ -573,19 +631,19 @@ export const ButtonWithText: Story = {
573
631
  aria-label="Text actions"
574
632
  >
575
633
  <template #container>
576
- <span class="rounded-md border border-border-surface-default bg-background-surface-primary px-4 py-2 body-14-regular">
634
+ <span class="rounded-md border border-border-surface-default bg-background-surface-primary px-4 py-2 body-s-regular">
577
635
  Labelled toolbar
578
636
  </span>
579
637
  </template>
580
638
  <template #action>
581
639
  <UiFloatActionItems aria-label="Text actions">
582
- <UiFloatActionItems type="button" aria-label="Edit" class="w-auto gap-1.5 px-3 label-14-medium">
640
+ <UiFloatActionItems type="button" aria-label="Edit" class="w-auto gap-1.5 px-3 label-s-medium">
583
641
  <UiIcon name="edit" size="s" />Edit
584
642
  </UiFloatActionItems>
585
- <UiFloatActionItems type="button" aria-label="Copy" class="w-auto gap-1.5 px-3 label-14-medium">
643
+ <UiFloatActionItems type="button" aria-label="Copy" class="w-auto gap-1.5 px-3 label-s-medium">
586
644
  <UiIcon name="copy" size="s" />Copy
587
645
  </UiFloatActionItems>
588
- <UiFloatActionItems type="button" aria-label="Delete" class="w-auto gap-1.5 px-3 label-14-medium">
646
+ <UiFloatActionItems type="button" aria-label="Delete" class="w-auto gap-1.5 px-3 label-s-medium">
589
647
  <UiIcon name="trash" size="s" />Delete
590
648
  </UiFloatActionItems>
591
649
  </UiFloatActionItems>
@@ -632,7 +690,7 @@ export const Orientation: Story = {
632
690
  template: `
633
691
  <div class="flex min-h-64 flex-wrap items-start justify-center gap-12 p-8">
634
692
  <div class="flex flex-col items-center gap-3">
635
- <span class="label-14-medium text-content-on-surface-secondary">Horizontal</span>
693
+ <span class="label-s-medium text-content-on-surface-secondary">Horizontal</span>
636
694
  <UiFloatActionItems aria-label="Horizontal actions" orientation="horizontal">
637
695
  <UiFloatActionItems type="button" aria-label="Edit">
638
696
  <UiIcon name="edit" size="s" />
@@ -646,7 +704,7 @@ export const Orientation: Story = {
646
704
  </UiFloatActionItems>
647
705
  </div>
648
706
  <div class="flex flex-col items-center gap-3">
649
- <span class="label-14-medium text-content-on-surface-secondary">Vertical</span>
707
+ <span class="label-s-medium text-content-on-surface-secondary">Vertical</span>
650
708
  <UiFloatActionItems aria-label="Vertical actions" orientation="vertical">
651
709
  <UiFloatActionItems type="button" aria-label="Edit">
652
710
  <UiIcon name="edit" size="s" />
@@ -709,23 +767,33 @@ import { UiFloatActionItems, UiIcon } from '@aleph-alpha/ui-library';
709
767
  </UiFloatActionItems>
710
768
  </UiFloatActionItems>
711
769
  <UiFloatActionItems type="separator" />
712
- <!-- input -->
713
- <UiFloatActionItems type="input" aria-label="Filter value" placeholder="Filter..." />
770
+ <!-- predefined: label, icon, input -->
771
+ <UiFloatActionItems type="label" prefix-icon="filter">Filter</UiFloatActionItems>
772
+ <UiFloatActionItems type="icon" icon="search" aria-label="Search" />
773
+ <UiFloatActionItems
774
+ type="input"
775
+ aria-label="Filter value"
776
+ placeholder="0/0"
777
+ previous-aria-label="Previous match"
778
+ next-aria-label="Next match"
779
+ />
714
780
  </UiFloatActionItems>
715
781
  </template>`;
716
782
 
717
783
  /**
718
- * All item types nested inside a root `toolbar` container:
719
- * `button`, `input`, `text`, `group`, and `separator`.
720
- * Icon-only `button` items require an `aria-label` because they have no visible text.
784
+ * All item types nested inside a root `toolbar` container. Use the predefined
785
+ * `label`, `icon`, and `input` types for the design-system look, or compose
786
+ * your own with `button`, `text`, `group`, and `separator`; both can be mixed.
787
+ * Icon-only `button` and `icon` items require an `aria-label` because they
788
+ * have no visible text.
721
789
  */
722
790
  export const ItemTypes: Story = {
723
791
  name: 'Action items types',
724
792
  render: () => ({
725
793
  components: { UiFloatActionItems, UiIcon },
726
794
  template: `
727
- <div class="flex min-h-64 flex-col items-center justify-center gap-6 p-8">
728
- <UiFloatActionItems aria-label="All item types">
795
+ <div class="flex min-h-64 flex-col items-center justify-center gap-6 p-8 max-sm:p-4">
796
+ <UiFloatActionItems aria-label="All item types" class="max-sm:max-w-full max-sm:flex-wrap max-sm:justify-center">
729
797
  <UiFloatActionItems type="button" aria-label="Edit">
730
798
  <UiIcon name="edit" size="s" />
731
799
  </UiFloatActionItems>
@@ -743,15 +811,25 @@ export const ItemTypes: Story = {
743
811
  </UiFloatActionItems>
744
812
  </UiFloatActionItems>
745
813
  <UiFloatActionItems type="separator" />
746
- <UiFloatActionItems type="input" aria-label="Filter value" placeholder="Filter..." />
814
+ <UiFloatActionItems type="label" prefix-icon="filter">Filter</UiFloatActionItems>
815
+ <UiFloatActionItems type="icon" icon="search" aria-label="Search" />
816
+ <UiFloatActionItems
817
+ type="input"
818
+ aria-label="Filter value"
819
+ placeholder="0/0"
820
+ previous-aria-label="Previous match"
821
+ next-aria-label="Next match"
822
+ />
747
823
  </UiFloatActionItems>
748
824
 
749
- <dl class="grid grid-cols-[auto_1fr] gap-x-4 gap-y-1 body-14-regular text-content-on-surface-secondary">
750
- <dt class="label-14-medium text-content-on-surface-primary">button</dt><dd>Icon or labelled action</dd>
751
- <dt class="label-14-medium text-content-on-surface-primary">separator</dt><dd>Vertical divider</dd>
752
- <dt class="label-14-medium text-content-on-surface-primary">group</dt><dd>Groups related items</dd>
753
- <dt class="label-14-medium text-content-on-surface-primary">text</dt><dd>Non-interactive label</dd>
754
- <dt class="label-14-medium text-content-on-surface-primary">input</dt><dd>Inline text field</dd>
825
+ <dl class="grid grid-cols-[auto_1fr] gap-x-4 gap-y-1 body-s-regular text-content-on-surface-secondary max-sm:grid-cols-1 max-sm:gap-y-0 max-sm:[&>dd]:mb-2">
826
+ <dt class="label-s-medium text-content-on-surface-primary">label</dt><dd>Predefined: text with optional prefix / suffix icons</dd>
827
+ <dt class="label-s-medium text-content-on-surface-primary">icon</dt><dd>Predefined: icon-only action</dd>
828
+ <dt class="label-s-medium text-content-on-surface-primary">input</dt><dd>Predefined: previous button, field, next button</dd>
829
+ <dt class="label-s-medium text-content-on-surface-primary">button</dt><dd>Composition: icon or labelled action from slot content</dd>
830
+ <dt class="label-s-medium text-content-on-surface-primary">separator</dt><dd>Composition: vertical divider</dd>
831
+ <dt class="label-s-medium text-content-on-surface-primary">group</dt><dd>Composition: groups related items</dd>
832
+ <dt class="label-s-medium text-content-on-surface-primary">text</dt><dd>Composition: non-interactive label</dd>
755
833
  </dl>
756
834
  </div>
757
835
  `,
@@ -782,9 +860,16 @@ export const ItemTypes: Story = {
782
860
  );
783
861
 
784
862
  await step(
785
- 'interaction: renders each supported item type (button, group, text, input, separator)',
863
+ 'interaction: renders each supported item type (label, icon, input, button, group, text, separator)',
786
864
  async () => {
787
- await expect(canvas.getAllByRole('button')).toHaveLength(4);
865
+ await expect(
866
+ canvas.getByRole('button', { name: 'Filter' }),
867
+ ).toBeInTheDocument();
868
+ await expect(
869
+ canvas.getByRole('button', { name: 'Previous match' }),
870
+ ).toBeInTheDocument();
871
+ // 4 composition buttons + label + icon + input's previous / next.
872
+ await expect(canvas.getAllByRole('button')).toHaveLength(8);
788
873
  await expect(canvas.getAllByRole('separator')).toHaveLength(2);
789
874
  await expect(within(toolbar).getByText('2/2')).toBeInTheDocument();
790
875
  },
@@ -792,6 +877,663 @@ export const ItemTypes: Story = {
792
877
  },
793
878
  };
794
879
 
880
+ const predefinedTypesSource = `<script setup lang="ts">
881
+ import { ref } from 'vue';
882
+ import { UiFloatActionItems } from '@aleph-alpha/ui-library';
883
+
884
+ const page = ref(1);
885
+ const total = 3;
886
+ </script>
887
+
888
+ <template>
889
+ <!-- size="md" is the default; set size="xs" on the toolbar for compact items -->
890
+ <UiFloatActionItems aria-label="Label actions">
891
+ <UiFloatActionItems type="label" prefix-icon="edit">Edit</UiFloatActionItems>
892
+ <UiFloatActionItems type="label" prefix-icon="copy">Copy</UiFloatActionItems>
893
+ <UiFloatActionItems type="label" prefix-icon="share" suffix-icon="chevron-down">Share</UiFloatActionItems>
894
+ </UiFloatActionItems>
895
+
896
+ <UiFloatActionItems aria-label="Icon actions">
897
+ <UiFloatActionItems type="icon" icon="edit" aria-label="Edit" />
898
+ <UiFloatActionItems type="icon" icon="copy" aria-label="Copy" />
899
+ <UiFloatActionItems type="icon" icon="trash" aria-label="Delete" />
900
+ </UiFloatActionItems>
901
+
902
+ <UiFloatActionItems aria-label="Pagination">
903
+ <UiFloatActionItems
904
+ type="input"
905
+ aria-label="Page"
906
+ :model-value="\`\${page}/\${total}\`"
907
+ previous-aria-label="Previous page"
908
+ next-aria-label="Next page"
909
+ @previous="page = Math.max(1, page - 1)"
910
+ @next="page = Math.min(total, page + 1)"
911
+ />
912
+ </UiFloatActionItems>
913
+
914
+ <!-- Vertical: input chevrons switch to up / down -->
915
+ <UiFloatActionItems aria-label="Vertical pagination" orientation="vertical">
916
+ <UiFloatActionItems type="input" aria-label="Page" :model-value="\`\${page}/\${total}\`" />
917
+ </UiFloatActionItems>
918
+ </template>`;
919
+
920
+ /**
921
+ * Predefined `label`, `icon`, and `input` types from the design system, at
922
+ * both sizes (`md` default, `xs`) and in both directions.
923
+ *
924
+ * Predefined types bring their own styles — including the mobile variant below
925
+ * the `sm` breakpoint (smaller paddings, primary text, translucent toolbar
926
+ * surface) — so you only pass text, icons, and labels. If you need a layout the
927
+ * predefined types don't cover, keep using the composition types (`button`,
928
+ * `text`, `group`, `separator`) with your own slot content; both can be mixed
929
+ * in one toolbar.
930
+ */
931
+ export const PredefinedTypes: Story = {
932
+ name: 'Predefined types (label, icon, input)',
933
+ render: () => ({
934
+ components: { UiFloatActionItems },
935
+ setup() {
936
+ const page = ref(1);
937
+ const total = 3;
938
+ const sizes = ['md', 'xs'] as const;
939
+ return { page, total, sizes };
940
+ },
941
+ template: `
942
+ <div class="flex flex-col items-center gap-4 sm:gap-10 sm:p-8">
943
+ <div
944
+ v-for="size in sizes"
945
+ :key="size"
946
+ class="grid grid-cols-1 sm:grid-cols-[auto_auto] items-center justify-items-start gap-2 sm:gap-x-8 sm:gap-y-6"
947
+ >
948
+ <span class="sm:col-span-2 label-s-medium text-content-on-surface-secondary">size="{{ size }}"</span>
949
+
950
+ <UiFloatActionItems :aria-label="'Label actions ' + size" :size="size">
951
+ <UiFloatActionItems type="label" prefix-icon="edit">Edit</UiFloatActionItems>
952
+ <UiFloatActionItems type="label" prefix-icon="copy">Copy</UiFloatActionItems>
953
+ <UiFloatActionItems type="label" prefix-icon="share" suffix-icon="chevron-down">Share</UiFloatActionItems>
954
+ </UiFloatActionItems>
955
+ <UiFloatActionItems :aria-label="'Vertical label actions ' + size" :size="size" orientation="vertical">
956
+ <UiFloatActionItems type="label" prefix-icon="edit">Edit</UiFloatActionItems>
957
+ <UiFloatActionItems type="label" prefix-icon="copy">Copy</UiFloatActionItems>
958
+ </UiFloatActionItems>
959
+
960
+ <UiFloatActionItems :aria-label="'Icon actions ' + size" :size="size">
961
+ <UiFloatActionItems type="icon" icon="edit" aria-label="Edit" />
962
+ <UiFloatActionItems type="icon" icon="copy" aria-label="Copy" />
963
+ <UiFloatActionItems type="icon" icon="trash" aria-label="Delete" />
964
+ </UiFloatActionItems>
965
+ <UiFloatActionItems :aria-label="'Vertical icon actions ' + size" :size="size" orientation="vertical">
966
+ <UiFloatActionItems type="icon" icon="edit" aria-label="Edit" />
967
+ <UiFloatActionItems type="icon" icon="copy" aria-label="Copy" />
968
+ <UiFloatActionItems type="icon" icon="trash" aria-label="Delete" />
969
+ </UiFloatActionItems>
970
+
971
+ <UiFloatActionItems :aria-label="'Pagination ' + size" :size="size">
972
+ <UiFloatActionItems
973
+ type="input"
974
+ aria-label="Page"
975
+ :model-value="page + '/' + total"
976
+ previous-aria-label="Previous page"
977
+ next-aria-label="Next page"
978
+ @previous="page = Math.max(1, page - 1)"
979
+ @next="page = Math.min(total, page + 1)"
980
+ />
981
+ </UiFloatActionItems>
982
+ <UiFloatActionItems :aria-label="'Vertical pagination ' + size" :size="size" orientation="vertical">
983
+ <UiFloatActionItems
984
+ type="input"
985
+ aria-label="Page"
986
+ :model-value="page + '/' + total"
987
+ @previous="page = Math.max(1, page - 1)"
988
+ @next="page = Math.min(total, page + 1)"
989
+ />
990
+ </UiFloatActionItems>
991
+ </div>
992
+ </div>
993
+ `,
994
+ }),
995
+ parameters: {
996
+ controls: { disable: true },
997
+ docs: { source: { code: predefinedTypesSource } },
998
+ },
999
+ play: async ({ canvasElement, step }) => {
1000
+ // Scenario (UiFloatActionItems): predefined types render the design-system
1001
+ // controls with accessible names and inherit the toolbar size. These checks
1002
+ // don't move focus or mutate state, so the gallery snapshot stays stable;
1003
+ // activation flows live in the focused variant stories and the keyboard
1004
+ // test story.
1005
+ const canvas = within(canvasElement);
1006
+ const pagination = canvas.getByRole('toolbar', { name: 'Pagination md' });
1007
+ const page = within(pagination).getByRole('textbox', { name: 'Page' });
1008
+ const next = within(pagination).getByRole('button', { name: 'Next page' });
1009
+
1010
+ await step(
1011
+ 'screen-reader: predefined items expose roles and accessible names (WCAG 4.1.2)',
1012
+ async () => {
1013
+ const labels = canvas.getByRole('toolbar', {
1014
+ name: 'Label actions md',
1015
+ });
1016
+ await expect(
1017
+ within(labels).getByRole('button', { name: 'Edit' }),
1018
+ ).toBeInTheDocument();
1019
+ await expect(
1020
+ within(
1021
+ canvas.getByRole('toolbar', { name: 'Icon actions xs' }),
1022
+ ).getByRole('button', { name: 'Delete' }),
1023
+ ).toBeInTheDocument();
1024
+ await expect(page).toHaveValue('1/3');
1025
+ },
1026
+ );
1027
+
1028
+ await step(
1029
+ 'interaction: items inherit the toolbar size (md default, xs)',
1030
+ async () => {
1031
+ await expect(next).toHaveAttribute('data-size', 'md');
1032
+ await expect(
1033
+ within(
1034
+ canvas.getByRole('toolbar', { name: 'Pagination xs' }),
1035
+ ).getByRole('button', { name: 'Next page' }),
1036
+ ).toHaveAttribute('data-size', 'xs');
1037
+ },
1038
+ );
1039
+ },
1040
+ };
1041
+
1042
+ // Focused variant and size stories give each predefined configuration its own
1043
+ // visual baseline. Their `interaction:` checks use `fireEvent`, which activates
1044
+ // controls without moving focus, and restore any state they change, so the
1045
+ // Chromatic snapshots stay stable.
1046
+
1047
+ const labelItemSource = `<template>
1048
+ <UiFloatActionItems aria-label="Document actions">
1049
+ <UiFloatActionItems type="label" prefix-icon="edit" @click="onEdit">Edit</UiFloatActionItems>
1050
+ <UiFloatActionItems type="label">Archive</UiFloatActionItems>
1051
+ <UiFloatActionItems type="label" prefix-icon="share" suffix-icon="chevron-down">Share</UiFloatActionItems>
1052
+ </UiFloatActionItems>
1053
+ </template>`;
1054
+
1055
+ /**
1056
+ * `type="label"`: the floating button with visible text and optional
1057
+ * `prefix-icon` / `suffix-icon`. The text is the accessible name.
1058
+ */
1059
+ export const LabelItem: Story = {
1060
+ name: 'Predefined label',
1061
+ render: () => ({
1062
+ components: { UiFloatActionItems },
1063
+ setup() {
1064
+ return { onItemClick };
1065
+ },
1066
+ template: `
1067
+ <div class="flex min-h-32 items-center justify-center p-8">
1068
+ <UiFloatActionItems aria-label="Document actions">
1069
+ <UiFloatActionItems type="label" prefix-icon="edit" @click="onItemClick">Edit</UiFloatActionItems>
1070
+ <UiFloatActionItems type="label">Archive</UiFloatActionItems>
1071
+ <UiFloatActionItems type="label" prefix-icon="share" suffix-icon="chevron-down">Share</UiFloatActionItems>
1072
+ </UiFloatActionItems>
1073
+ </div>
1074
+ `,
1075
+ }),
1076
+ parameters: {
1077
+ controls: { disable: true },
1078
+ docs: { source: { code: labelItemSource } },
1079
+ },
1080
+ play: async ({ canvasElement, step }) => {
1081
+ // Scenario (UiFloatActionItems): label items render text with optional
1082
+ // icons and emit `click` when activated.
1083
+ onItemClick.mockClear();
1084
+ const canvas = within(canvasElement);
1085
+ const edit = canvas.getByRole('button', { name: 'Edit' });
1086
+
1087
+ await step(
1088
+ 'interaction: label items render their prefix / suffix icons',
1089
+ async () => {
1090
+ await expect(edit.querySelectorAll('svg')).toHaveLength(1);
1091
+ await expect(
1092
+ canvas
1093
+ .getByRole('button', { name: 'Archive' })
1094
+ .querySelectorAll('svg'),
1095
+ ).toHaveLength(0);
1096
+ await expect(
1097
+ canvas.getByRole('button', { name: 'Share' }).querySelectorAll('svg'),
1098
+ ).toHaveLength(2);
1099
+ },
1100
+ );
1101
+
1102
+ await step('interaction: activating a label item emits click', async () => {
1103
+ await fireEvent.click(edit);
1104
+ await expect(onItemClick).toHaveBeenCalledTimes(1);
1105
+ });
1106
+ },
1107
+ };
1108
+
1109
+ const iconItemSource = `<template>
1110
+ <UiFloatActionItems aria-label="Paragraph actions">
1111
+ <UiFloatActionItems type="icon" icon="edit" aria-label="Edit" @click="onEdit" />
1112
+ <UiFloatActionItems type="icon" icon="copy" aria-label="Copy" />
1113
+ <UiFloatActionItems type="icon" icon="trash" aria-label="Delete" />
1114
+ </UiFloatActionItems>
1115
+ </template>`;
1116
+
1117
+ /**
1118
+ * `type="icon"`: an icon-only floating button. Always pass `aria-label`, since
1119
+ * the icon has no visible text.
1120
+ */
1121
+ export const IconItem: Story = {
1122
+ name: 'Predefined icon',
1123
+ render: () => ({
1124
+ components: { UiFloatActionItems },
1125
+ setup() {
1126
+ return { onItemClick };
1127
+ },
1128
+ template: `
1129
+ <div class="flex min-h-32 items-center justify-center p-8">
1130
+ <UiFloatActionItems aria-label="Paragraph actions">
1131
+ <UiFloatActionItems type="icon" icon="edit" aria-label="Edit" @click="onItemClick" />
1132
+ <UiFloatActionItems type="icon" icon="copy" aria-label="Copy" />
1133
+ <UiFloatActionItems type="icon" icon="trash" aria-label="Delete" />
1134
+ </UiFloatActionItems>
1135
+ </div>
1136
+ `,
1137
+ }),
1138
+ parameters: {
1139
+ controls: { disable: true },
1140
+ docs: { source: { code: iconItemSource } },
1141
+ },
1142
+ play: async ({ canvasElement, step }) => {
1143
+ // Scenario (UiFloatActionItems): icon items are named by `aria-label`,
1144
+ // render a single decorative icon, and emit `click` when activated.
1145
+ onItemClick.mockClear();
1146
+ const canvas = within(canvasElement);
1147
+ const edit = canvas.getByRole('button', { name: 'Edit' });
1148
+
1149
+ await step(
1150
+ 'interaction: icon items render one icon and take their name from aria-label',
1151
+ async () => {
1152
+ await expect(edit.querySelectorAll('svg')).toHaveLength(1);
1153
+ await expect(edit).toHaveTextContent('');
1154
+ },
1155
+ );
1156
+
1157
+ await step('interaction: activating an icon item emits click', async () => {
1158
+ await fireEvent.click(edit);
1159
+ await expect(onItemClick).toHaveBeenCalledTimes(1);
1160
+ });
1161
+ },
1162
+ };
1163
+
1164
+ const inputItemSource = `<script setup lang="ts">
1165
+ const page = ref(1);
1166
+ const total = 3;
1167
+ </script>
1168
+
1169
+ <template>
1170
+ <UiFloatActionItems aria-label="Pagination">
1171
+ <UiFloatActionItems
1172
+ type="input"
1173
+ aria-label="Page"
1174
+ :model-value="\`\${page}/\${total}\`"
1175
+ previous-aria-label="Previous page"
1176
+ next-aria-label="Next page"
1177
+ @previous="page = Math.max(1, page - 1)"
1178
+ @next="page = Math.min(total, page + 1)"
1179
+ />
1180
+ </UiFloatActionItems>
1181
+
1182
+ <!-- class sizes the text field; group-class styles the whole wrapper -->
1183
+ <UiFloatActionItems aria-label="Zoom">
1184
+ <UiFloatActionItems
1185
+ type="input"
1186
+ aria-label="Zoom level"
1187
+ placeholder="100%"
1188
+ previous-icon="minus"
1189
+ next-icon="plus"
1190
+ previous-aria-label="Zoom out"
1191
+ next-aria-label="Zoom in"
1192
+ class="w-16"
1193
+ />
1194
+ </UiFloatActionItems>
1195
+ </template>`;
1196
+
1197
+ /**
1198
+ * `type="input"`: previous button, text field, and next button in one item.
1199
+ * `class` sizes the text field; use `group-class` to style the wrapper.
1200
+ */
1201
+ export const InputItem: Story = {
1202
+ name: 'Predefined input',
1203
+ render: () => ({
1204
+ components: { UiFloatActionItems },
1205
+ setup() {
1206
+ const page = ref(1);
1207
+ const total = 3;
1208
+ return { page, total };
1209
+ },
1210
+ template: `
1211
+ <div class="flex min-h-32 flex-col items-center justify-center gap-4 p-8">
1212
+ <UiFloatActionItems aria-label="Pagination">
1213
+ <UiFloatActionItems
1214
+ type="input"
1215
+ aria-label="Page"
1216
+ :model-value="page + '/' + total"
1217
+ previous-aria-label="Previous page"
1218
+ next-aria-label="Next page"
1219
+ @previous="page = Math.max(1, page - 1)"
1220
+ @next="page = Math.min(total, page + 1)"
1221
+ />
1222
+ </UiFloatActionItems>
1223
+ <UiFloatActionItems aria-label="Zoom">
1224
+ <UiFloatActionItems
1225
+ type="input"
1226
+ aria-label="Zoom level"
1227
+ placeholder="100%"
1228
+ previous-icon="minus"
1229
+ next-icon="plus"
1230
+ previous-aria-label="Zoom out"
1231
+ next-aria-label="Zoom in"
1232
+ class="w-16"
1233
+ />
1234
+ </UiFloatActionItems>
1235
+ </div>
1236
+ `,
1237
+ }),
1238
+ parameters: {
1239
+ controls: { disable: true },
1240
+ docs: { source: { code: inputItemSource } },
1241
+ },
1242
+ play: async ({ canvasElement, step }) => {
1243
+ // Scenario (UiFloatActionItems): the input item's previous / next buttons
1244
+ // drive the field value, and `class` targets the text field.
1245
+ const canvas = within(canvasElement);
1246
+ const page = canvas.getByRole('textbox', { name: 'Page' });
1247
+
1248
+ await step(
1249
+ 'interaction: previous / next buttons update the field value',
1250
+ async () => {
1251
+ await expect(page).toHaveValue('1/3');
1252
+ await fireEvent.click(
1253
+ canvas.getByRole('button', { name: 'Next page' }),
1254
+ );
1255
+ await expect(page).toHaveValue('2/3');
1256
+ await fireEvent.click(
1257
+ canvas.getByRole('button', { name: 'Previous page' }),
1258
+ );
1259
+ await expect(page).toHaveValue('1/3');
1260
+ },
1261
+ );
1262
+
1263
+ await step(
1264
+ 'interaction: class styles the text field, not the previous / next group',
1265
+ async () => {
1266
+ const zoom = canvas.getByRole('textbox', { name: 'Zoom level' });
1267
+ await expect(zoom).toHaveClass('w-16');
1268
+ await expect(
1269
+ zoom.closest('[data-slot="float-item-input"]'),
1270
+ ).not.toHaveClass('w-16');
1271
+ },
1272
+ );
1273
+ },
1274
+ };
1275
+
1276
+ const sizeTemplate = (size: 'md' | 'xs') => `
1277
+ <UiFloatActionItems aria-label="Document actions" size="${size}">
1278
+ <UiFloatActionItems type="label" prefix-icon="edit">Edit</UiFloatActionItems>
1279
+ <UiFloatActionItems type="icon" icon="copy" aria-label="Copy" />
1280
+ <UiFloatActionItems type="separator" />
1281
+ <UiFloatActionItems type="input" aria-label="Page" model-value="1/3" />
1282
+ </UiFloatActionItems>`;
1283
+
1284
+ /**
1285
+ * `size="md"` (default): 36px label and icon buttons and a 40px-tall field.
1286
+ */
1287
+ export const SizeMd: Story = {
1288
+ name: 'Predefined size md',
1289
+ render: () => ({
1290
+ components: { UiFloatActionItems },
1291
+ template: `<div class="flex min-h-32 items-center justify-center p-8">${sizeTemplate('md')}</div>`,
1292
+ }),
1293
+ parameters: {
1294
+ controls: { disable: true },
1295
+ docs: { source: { code: `<template>${sizeTemplate('md')}\n</template>` } },
1296
+ },
1297
+ play: async ({ canvasElement, step }) => {
1298
+ // Scenario (UiFloatActionItems): every predefined item in an `md` toolbar
1299
+ // renders at the md size.
1300
+ const canvas = within(canvasElement);
1301
+
1302
+ await step('interaction: every item renders at the md size', async () => {
1303
+ await expect(canvas.getByRole('toolbar')).toHaveAttribute(
1304
+ 'data-size',
1305
+ 'md',
1306
+ );
1307
+ for (const control of [
1308
+ ...canvas.getAllByRole('button'),
1309
+ canvas.getByRole('textbox', { name: 'Page' }),
1310
+ ]) {
1311
+ await expect(control).toHaveAttribute('data-size', 'md');
1312
+ }
1313
+ });
1314
+ },
1315
+ };
1316
+
1317
+ /**
1318
+ * `size="xs"`: 24px label and icon buttons and a 24px-tall field, for dense
1319
+ * toolbars.
1320
+ */
1321
+ export const SizeXs: Story = {
1322
+ name: 'Predefined size xs',
1323
+ render: () => ({
1324
+ components: { UiFloatActionItems },
1325
+ template: `<div class="flex min-h-32 items-center justify-center p-8">${sizeTemplate('xs')}</div>`,
1326
+ }),
1327
+ parameters: {
1328
+ controls: { disable: true },
1329
+ docs: { source: { code: `<template>${sizeTemplate('xs')}\n</template>` } },
1330
+ },
1331
+ play: async ({ canvasElement, step }) => {
1332
+ // Scenario (UiFloatActionItems): setting `size="xs"` on the toolbar sizes
1333
+ // every nested predefined item.
1334
+ const canvas = within(canvasElement);
1335
+
1336
+ await step(
1337
+ 'interaction: the toolbar size cascades to every item',
1338
+ async () => {
1339
+ await expect(canvas.getByRole('toolbar')).toHaveAttribute(
1340
+ 'data-size',
1341
+ 'xs',
1342
+ );
1343
+ for (const control of [
1344
+ ...canvas.getAllByRole('button'),
1345
+ canvas.getByRole('textbox', { name: 'Page' }),
1346
+ ]) {
1347
+ await expect(control).toHaveAttribute('data-size', 'xs');
1348
+ }
1349
+ },
1350
+ );
1351
+ },
1352
+ };
1353
+
1354
+ const predefinedTypesDisabledSource = `<template>
1355
+ <UiFloatActionItems aria-label="Document actions">
1356
+ <UiFloatActionItems type="label" prefix-icon="edit" disabled>Edit</UiFloatActionItems>
1357
+ <UiFloatActionItems type="icon" icon="trash" aria-label="Delete" disabled />
1358
+ <UiFloatActionItems type="input" aria-label="Page" model-value="1/3" disabled />
1359
+ </UiFloatActionItems>
1360
+ </template>`;
1361
+
1362
+ /**
1363
+ * `disabled` on a predefined item dims it, removes it from roving arrow-key
1364
+ * focus, and blocks its `click`, `previous`, and `next` events. On an `input`
1365
+ * item it disables the field and both buttons.
1366
+ */
1367
+ export const PredefinedTypesDisabled: Story = {
1368
+ name: 'Predefined types disabled',
1369
+ render: () => ({
1370
+ components: { UiFloatActionItems },
1371
+ setup() {
1372
+ return { onItemClick };
1373
+ },
1374
+ template: `
1375
+ <div class="flex min-h-32 items-center justify-center p-8">
1376
+ <UiFloatActionItems aria-label="Document actions">
1377
+ <UiFloatActionItems type="label" prefix-icon="share" @click="onItemClick">Share</UiFloatActionItems>
1378
+ <UiFloatActionItems type="label" prefix-icon="edit" disabled @click="onItemClick">Edit</UiFloatActionItems>
1379
+ <UiFloatActionItems type="icon" icon="trash" aria-label="Delete" disabled @click="onItemClick" />
1380
+ <UiFloatActionItems
1381
+ type="input"
1382
+ aria-label="Page"
1383
+ model-value="1/3"
1384
+ disabled
1385
+ @previous="onItemClick"
1386
+ @next="onItemClick"
1387
+ />
1388
+ </UiFloatActionItems>
1389
+ </div>
1390
+ `,
1391
+ }),
1392
+ parameters: {
1393
+ controls: { disable: true },
1394
+ docs: { source: { code: predefinedTypesDisabledSource } },
1395
+ },
1396
+ play: async ({ canvasElement, step }) => {
1397
+ // Scenario (UiFloatActionItems): disabled predefined items announce their
1398
+ // state and ignore activation, while enabled siblings keep working.
1399
+ onItemClick.mockClear();
1400
+ const canvas = within(canvasElement);
1401
+ const disabledControls = [
1402
+ canvas.getByRole('button', { name: 'Edit' }),
1403
+ canvas.getByRole('button', { name: 'Delete' }),
1404
+ canvas.getByRole('button', { name: 'Previous' }),
1405
+ canvas.getByRole('button', { name: 'Next' }),
1406
+ ];
1407
+
1408
+ await step(
1409
+ 'screen-reader: disabled label, icon, and input controls expose the disabled state (WCAG 4.1.2)',
1410
+ async () => {
1411
+ for (const control of disabledControls) {
1412
+ await expect(control).toBeDisabled();
1413
+ }
1414
+ await expect(
1415
+ canvas.getByRole('textbox', { name: 'Page' }),
1416
+ ).toBeDisabled();
1417
+ },
1418
+ );
1419
+
1420
+ await step(
1421
+ 'interaction: forced clicks on disabled items emit no click / previous / next',
1422
+ async () => {
1423
+ for (const control of disabledControls) {
1424
+ await userEvent.click(control, { pointerEventsCheck: 0 });
1425
+ }
1426
+ await expect(onItemClick).not.toHaveBeenCalled();
1427
+ await fireEvent.click(canvas.getByRole('button', { name: 'Share' }));
1428
+ await expect(onItemClick).toHaveBeenCalledTimes(1);
1429
+ },
1430
+ );
1431
+ },
1432
+ };
1433
+
1434
+ /**
1435
+ * Predefined types at the 320px mobile reflow breakpoint: the grid stacks into
1436
+ * a single column, the toolbar switches to the translucent floating surface,
1437
+ * and items use the mobile paddings and primary text color. Hidden test-only
1438
+ * story.
1439
+ */
1440
+ export const PredefinedTypesMobile: Story = {
1441
+ name: 'test - Predefined types mobile',
1442
+ tags: ['!dev', '!autodocs'],
1443
+ globals: { mediaBreakpoint: 'reflow' },
1444
+ render: PredefinedTypes.render,
1445
+ parameters: {
1446
+ // Reflow snapshots are covered by the accessible-reflow Chromatic mode,
1447
+ // and the play moves focus, so skip this snapshot.
1448
+ chromatic: { disableSnapshot: true },
1449
+ docs: {
1450
+ description: {
1451
+ story:
1452
+ 'Switch the Media breakpoint toolbar to Mobile to preview the 320px layout.',
1453
+ },
1454
+ },
1455
+ },
1456
+ play: async ({ canvasElement, step }) => {
1457
+ // Scenario (UiFloatActionItems): at 320px the predefined types keep their
1458
+ // names, stack in one column, meet the touch-target size, stay keyboard
1459
+ // operable, use the mobile surface, and fit without horizontal scrolling.
1460
+ const canvas = within(canvasElement);
1461
+ const labels = canvas.getByRole('toolbar', { name: 'Label actions md' });
1462
+ const edit = within(labels).getByRole('button', { name: 'Edit' });
1463
+ const copy = within(labels).getByRole('button', { name: 'Copy' });
1464
+
1465
+ await step(
1466
+ 'mobile: predefined items keep their accessible names at the 320px breakpoint (WCAG 4.1.2)',
1467
+ async () => {
1468
+ await expect(labels).toBeVisible();
1469
+ await expect(edit).toHaveAccessibleName('Edit');
1470
+ await expect(
1471
+ within(
1472
+ canvas.getByRole('toolbar', { name: 'Pagination xs' }),
1473
+ ).getByRole('textbox', { name: 'Page' }),
1474
+ ).toBeVisible();
1475
+ },
1476
+ );
1477
+
1478
+ await step(
1479
+ 'mobile: toolbars stack in a single left-aligned column (WCAG 1.4.10)',
1480
+ async () => {
1481
+ const toolbars = canvas
1482
+ .getAllByRole('toolbar')
1483
+ .map((toolbar) => toolbar.getBoundingClientRect());
1484
+ for (let i = 1; i < toolbars.length; i++) {
1485
+ await expect(toolbars[i].left).toBe(toolbars[0].left);
1486
+ await expect(toolbars[i].top).toBeGreaterThanOrEqual(
1487
+ toolbars[i - 1].bottom,
1488
+ );
1489
+ }
1490
+ },
1491
+ );
1492
+
1493
+ await step(
1494
+ 'mobile: every button and field meets the 24px minimum touch target (WCAG 2.5.8)',
1495
+ async () => {
1496
+ const targets = [
1497
+ ...canvas.getAllByRole('button'),
1498
+ ...canvas.getAllByRole('textbox'),
1499
+ ];
1500
+ for (const target of targets) {
1501
+ const { width, height } = target.getBoundingClientRect();
1502
+ await expect(width).toBeGreaterThanOrEqual(24);
1503
+ await expect(height).toBeGreaterThanOrEqual(24);
1504
+ }
1505
+ },
1506
+ );
1507
+
1508
+ await step(
1509
+ 'mobile: the toolbar uses the translucent floating-alpha surface',
1510
+ async () => {
1511
+ await expect(labels).toHaveClass(
1512
+ 'max-sm:bg-background-surface-floating-alpha',
1513
+ );
1514
+ },
1515
+ );
1516
+
1517
+ await step(
1518
+ 'mobile: stays keyboard operable — Arrow keys move roving focus (WCAG 2.1.1)',
1519
+ async () => {
1520
+ edit.focus();
1521
+ await userEvent.keyboard('{ArrowRight}');
1522
+ await expect(copy).toHaveFocus();
1523
+ },
1524
+ );
1525
+
1526
+ await step(
1527
+ 'mobile: content reflows without horizontal scrolling (WCAG 1.4.10)',
1528
+ async () => {
1529
+ await expect(document.documentElement.scrollWidth).toBeLessThanOrEqual(
1530
+ window.innerWidth,
1531
+ );
1532
+ },
1533
+ );
1534
+ },
1535
+ };
1536
+
795
1537
  /**
796
1538
  * All button states side by side for visual QA: default, hover, focus (shared
797
1539
  * `ui-focus-ring`), disabled, plus toolbar-level triggers and open / closed panels.
@@ -810,8 +1552,8 @@ export const AllStates: Story = {
810
1552
  <div class="mx-auto flex max-w-4xl flex-col gap-12 p-8">
811
1553
  <section class="flex flex-col gap-5">
812
1554
  <div class="flex flex-col gap-1">
813
- <h3 class="body-16-medium text-content-on-surface-primary">Button states</h3>
814
- <p class="body-14-regular text-content-on-surface-secondary">
1555
+ <h3 class="body-m-medium text-content-on-surface-primary">Button states</h3>
1556
+ <p class="body-s-regular text-content-on-surface-secondary">
815
1557
  Tab to a button to reveal the focus ring; hover to see the hover surface.
816
1558
  </p>
817
1559
  </div>
@@ -822,7 +1564,7 @@ export const AllStates: Story = {
822
1564
  <UiIcon name="edit" size="s" />
823
1565
  </UiFloatActionItems>
824
1566
  </UiFloatActionItems>
825
- <span class="label-12-medium text-content-on-surface-secondary">Default</span>
1567
+ <span class="label-xs-medium text-content-on-surface-secondary">Default</span>
826
1568
  </div>
827
1569
  <div class="flex flex-col items-center justify-center gap-4 rounded-lg border border-border-surface-default bg-background-surface-primary p-6">
828
1570
  <UiFloatActionItems aria-label="Hover state">
@@ -830,7 +1572,7 @@ export const AllStates: Story = {
830
1572
  <UiIcon name="edit" size="s" />
831
1573
  </UiFloatActionItems>
832
1574
  </UiFloatActionItems>
833
- <span class="label-12-medium text-content-on-surface-secondary">Hover</span>
1575
+ <span class="label-xs-medium text-content-on-surface-secondary">Hover</span>
834
1576
  </div>
835
1577
  <div class="flex flex-col items-center justify-center gap-4 rounded-lg border border-border-surface-default bg-background-surface-primary p-6">
836
1578
  <UiFloatActionItems aria-label="Focus state">
@@ -838,7 +1580,7 @@ export const AllStates: Story = {
838
1580
  <UiIcon name="edit" size="s" />
839
1581
  </UiFloatActionItems>
840
1582
  </UiFloatActionItems>
841
- <span class="label-12-medium text-content-on-surface-secondary">Focus (Tab)</span>
1583
+ <span class="label-xs-medium text-content-on-surface-secondary">Focus (Tab)</span>
842
1584
  </div>
843
1585
  <div class="flex flex-col items-center justify-center gap-4 rounded-lg border border-border-surface-default bg-background-surface-primary p-6">
844
1586
  <UiFloatActionItems aria-label="Disabled state">
@@ -846,15 +1588,15 @@ export const AllStates: Story = {
846
1588
  <UiIcon name="edit" size="s" />
847
1589
  </UiFloatActionItems>
848
1590
  </UiFloatActionItems>
849
- <span class="label-12-medium text-content-on-surface-secondary">Disabled</span>
1591
+ <span class="label-xs-medium text-content-on-surface-secondary">Disabled</span>
850
1592
  </div>
851
1593
  </div>
852
1594
  </section>
853
1595
 
854
1596
  <section class="flex flex-col gap-5">
855
1597
  <div class="flex flex-col gap-1">
856
- <h3 class="body-16-medium text-content-on-surface-primary">Triggers</h3>
857
- <p class="body-14-regular text-content-on-surface-secondary">
1598
+ <h3 class="body-m-medium text-content-on-surface-primary">Triggers</h3>
1599
+ <p class="body-s-regular text-content-on-surface-secondary">
858
1600
  How the floating panel opens for each interaction mode.
859
1601
  </p>
860
1602
  </div>
@@ -862,7 +1604,7 @@ export const AllStates: Story = {
862
1604
  <div class="flex min-h-44 flex-col items-center justify-end gap-4 rounded-lg border border-border-surface-default bg-background-surface-primary p-6">
863
1605
  <UiFloatActions trigger="hover" placement="top" :offset="10" aria-label="Hover actions">
864
1606
  <template #container>
865
- <span class="rounded-md border border-border-surface-default px-4 py-2 body-14-regular">Hover or Tab</span>
1607
+ <span class="rounded-md border border-border-surface-default px-4 py-2 body-s-regular">Hover or Tab</span>
866
1608
  </template>
867
1609
  <template #action>
868
1610
  <UiFloatActionItems aria-label="Hover actions">
@@ -872,12 +1614,12 @@ export const AllStates: Story = {
872
1614
  </UiFloatActionItems>
873
1615
  </template>
874
1616
  </UiFloatActions>
875
- <span class="label-12-medium text-content-on-surface-secondary">Hover</span>
1617
+ <span class="label-xs-medium text-content-on-surface-secondary">Hover</span>
876
1618
  </div>
877
1619
  <div class="flex min-h-44 flex-col items-center justify-end gap-4 rounded-lg border border-border-surface-default bg-background-surface-primary p-6">
878
1620
  <UiFloatActions trigger="click" placement="top" :offset="10" aria-label="Click actions">
879
1621
  <template #container>
880
- <span class="rounded-md border border-border-surface-default px-4 py-2 body-14-regular">Click or Enter</span>
1622
+ <span class="rounded-md border border-border-surface-default px-4 py-2 body-s-regular">Click or Enter</span>
881
1623
  </template>
882
1624
  <template #action>
883
1625
  <UiFloatActionItems aria-label="Click actions">
@@ -887,12 +1629,12 @@ export const AllStates: Story = {
887
1629
  </UiFloatActionItems>
888
1630
  </template>
889
1631
  </UiFloatActions>
890
- <span class="label-12-medium text-content-on-surface-secondary">Click</span>
1632
+ <span class="label-xs-medium text-content-on-surface-secondary">Click</span>
891
1633
  </div>
892
1634
  <div class="flex min-h-44 flex-col items-center justify-end gap-4 rounded-lg border border-border-surface-default bg-background-surface-primary p-6">
893
1635
  <UiFloatActions trigger="focus" placement="top" :offset="10" aria-label="Focus actions">
894
1636
  <template #container>
895
- <span class="rounded-md border border-border-surface-default px-4 py-2 body-14-regular">Tab to focus</span>
1637
+ <span class="rounded-md border border-border-surface-default px-4 py-2 body-s-regular">Tab to focus</span>
896
1638
  </template>
897
1639
  <template #action>
898
1640
  <UiFloatActionItems aria-label="Focus actions">
@@ -902,23 +1644,23 @@ export const AllStates: Story = {
902
1644
  </UiFloatActionItems>
903
1645
  </template>
904
1646
  </UiFloatActions>
905
- <span class="label-12-medium text-content-on-surface-secondary">Focus</span>
1647
+ <span class="label-xs-medium text-content-on-surface-secondary">Focus</span>
906
1648
  </div>
907
1649
  </div>
908
1650
  </section>
909
1651
 
910
1652
  <section class="flex flex-col gap-5">
911
1653
  <div class="flex flex-col gap-1">
912
- <h3 class="body-16-medium text-content-on-surface-primary">Open vs closed</h3>
913
- <p class="body-14-regular text-content-on-surface-secondary">
914
- Controlled panels via <code class="label-14-regular">v-model:open</code>.
1654
+ <h3 class="body-m-medium text-content-on-surface-primary">Open vs closed</h3>
1655
+ <p class="body-s-regular text-content-on-surface-secondary">
1656
+ Controlled panels via <code class="label-s-regular">v-model:open</code>.
915
1657
  </p>
916
1658
  </div>
917
1659
  <div class="grid gap-4 sm:grid-cols-2">
918
1660
  <div class="flex min-h-44 flex-col items-center justify-end gap-4 rounded-lg border border-border-surface-default bg-background-surface-primary p-6">
919
1661
  <UiFloatActions trigger="manual" v-model:open="openPanel" placement="top" :offset="10" aria-label="Open panel">
920
1662
  <template #container>
921
- <span class="rounded-md border border-border-surface-default px-4 py-2 body-14-regular">Panel open</span>
1663
+ <span class="rounded-md border border-border-surface-default px-4 py-2 body-s-regular">Panel open</span>
922
1664
  </template>
923
1665
  <template #action>
924
1666
  <UiFloatActionItems aria-label="Open panel actions">
@@ -931,12 +1673,12 @@ export const AllStates: Story = {
931
1673
  </UiFloatActionItems>
932
1674
  </template>
933
1675
  </UiFloatActions>
934
- <span class="label-12-medium text-content-on-surface-secondary">Open</span>
1676
+ <span class="label-xs-medium text-content-on-surface-secondary">Open</span>
935
1677
  </div>
936
1678
  <div class="flex min-h-44 flex-col items-center justify-end gap-4 rounded-lg border border-border-surface-default bg-background-surface-primary p-6">
937
1679
  <UiFloatActions trigger="manual" v-model:open="closedPanel" placement="top" :offset="10" aria-label="Closed panel">
938
1680
  <template #container>
939
- <span class="rounded-md border border-border-surface-default px-4 py-2 body-14-regular">Panel closed</span>
1681
+ <span class="rounded-md border border-border-surface-default px-4 py-2 body-s-regular">Panel closed</span>
940
1682
  </template>
941
1683
  <template #action>
942
1684
  <UiFloatActionItems aria-label="Closed panel actions">
@@ -946,7 +1688,7 @@ export const AllStates: Story = {
946
1688
  </UiFloatActionItems>
947
1689
  </template>
948
1690
  </UiFloatActions>
949
- <span class="label-12-medium text-content-on-surface-secondary">Closed</span>
1691
+ <span class="label-xs-medium text-content-on-surface-secondary">Closed</span>
950
1692
  </div>
951
1693
  </div>
952
1694
  </section>
@@ -1053,7 +1795,7 @@ export const Composable: Story = {
1053
1795
  :aria-expanded="open"
1054
1796
  aria-haspopup="true"
1055
1797
  :aria-controls="open ? contentId : undefined"
1056
- class="ui-focus-ring rounded-md border border-transparent bg-background-surface-primary px-6 py-10 body-14-regular"
1798
+ class="ui-focus-ring rounded-md border border-transparent bg-background-surface-primary px-6 py-10 body-s-regular"
1057
1799
  @mouseenter="onReferenceMouseEnter"
1058
1800
  @mouseleave="onReferenceMouseLeave"
1059
1801
  @focus="onReferenceFocus"
@@ -1114,22 +1856,25 @@ export const Accessibility: Story = {
1114
1856
 
1115
1857
  <div class="flex flex-col gap-6">
1116
1858
  <div class="flex flex-col gap-2">
1117
- <h3 class="body-16-medium text-content-on-surface-primary">
1859
+ <h3 class="body-m-medium text-content-on-surface-primary">
1118
1860
  Requirements
1119
1861
  </h3>
1120
- <ul class="body-16-regular list-disc pl-5 text-content-on-surface-primary">
1121
- <li>The trigger is a focusable button exposing <code class="label-14-regular">aria-haspopup</code> and <code class="label-14-regular">aria-expanded</code>, pointing at the open panel via <code class="label-14-regular">aria-controls</code>.</li>
1122
- <li>Focus or hover opens the panel; <code class="label-14-regular">Escape</code> closes it and restores focus to the trigger.</li>
1123
- <li>The toolbar uses <code class="label-14-regular">role="toolbar"</code> with roving arrow-key focus — one Tab stop enters and leaves it, Arrow keys move between items.</li>
1124
- <li>Every icon-only button and input item has an accessible name via <code class="label-14-regular">aria-label</code>.</li>
1862
+ <ul class="body-m-regular list-disc pl-5 text-content-on-surface-primary">
1863
+ <li>The trigger is a focusable button exposing <code class="label-s-regular">aria-haspopup</code> and <code class="label-s-regular">aria-expanded</code>, pointing at the open panel via <code class="label-s-regular">aria-controls</code>.</li>
1864
+ <li>Focus or hover opens the panel; <code class="label-s-regular">Escape</code> closes it and restores focus to the trigger.</li>
1865
+ <li>The toolbar uses <code class="label-s-regular">role="toolbar"</code> with roving arrow-key focus — one Tab stop enters and leaves it, Arrow keys move between items.</li>
1866
+ <li>Every icon-only button and input item has an accessible name via <code class="label-s-regular">aria-label</code>.</li>
1867
+ <li>Predefined <code class="label-s-regular">label</code> items use their visible text as the name; their icons are decorative and hidden from assistive technology.</li>
1868
+ <li>Predefined <code class="label-s-regular">icon</code> items need an <code class="label-s-regular">aria-label</code>. <code class="label-s-regular">input</code> items need an <code class="label-s-regular">aria-label</code> for the field and should set <code class="label-s-regular">previous-aria-label</code> / <code class="label-s-regular">next-aria-label</code> to describe what the buttons do (they default to "Previous" / "Next").</li>
1869
+ <li>Predefined items meet the 24px minimum touch target at both sizes, on desktop and at the 320px mobile breakpoint.</li>
1125
1870
  </ul>
1126
1871
  </div>
1127
1872
 
1128
1873
  <div class="flex flex-col gap-2">
1129
- <h3 class="body-16-medium text-content-on-surface-primary">
1874
+ <h3 class="body-m-medium text-content-on-surface-primary">
1130
1875
  Enable accessibility theme
1131
1876
  </h3>
1132
- <p class="body-16-regular text-content-on-surface-primary">
1877
+ <p class="body-m-regular text-content-on-surface-primary">
1133
1878
  When accessibility is required, enable our accessibility theme. This
1134
1879
  increases contrast and ensures there are no color contrast issues.
1135
1880
  </p>
@@ -1138,7 +1883,7 @@ export const Accessibility: Story = {
1138
1883
 
1139
1884
  <div class="grid gap-4 md:grid-cols-2">
1140
1885
  <div class="flex flex-col gap-3">
1141
- <h3 class="label-16-medium text-center text-content-on-surface-primary">
1886
+ <h3 class="label-m-medium text-center text-content-on-surface-primary">
1142
1887
  Default
1143
1888
  </h3>
1144
1889
  <div class="flex min-h-20 items-center justify-center border border-border-surface-default p-6">
@@ -1158,7 +1903,7 @@ export const Accessibility: Story = {
1158
1903
  </div>
1159
1904
 
1160
1905
  <div class="accessible-theme flex flex-col gap-3">
1161
- <h3 class="label-16-medium text-center text-content-on-surface-primary">
1906
+ <h3 class="label-m-medium text-center text-content-on-surface-primary">
1162
1907
  Accessible
1163
1908
  </h3>
1164
1909
  <div class="flex min-h-20 items-center justify-center border border-border-surface-default p-6">
@@ -1219,10 +1964,13 @@ export const Accessibility: Story = {
1219
1964
  * The Accessibility column is filled automatically by the axe audit that runs
1220
1965
  * on every story — never add an `a11y:` prefix.
1221
1966
  * - Coverage is split across stories: non-mutating `screen-reader`/`interaction`
1222
- * checks are co-located on the visible `Orientation` and `ItemTypes` stories
1223
- * (so their Chromatic snapshots stay valid), while focus-moving flows live in
1224
- * the dedicated `test - …` stories below (Focus / Hover / Click / Toolbar /
1225
- * Zoom / Mobile).
1967
+ * checks are co-located on the visible `ShowModes`, `Orientation`,
1968
+ * `ItemTypes`, `PredefinedTypes`, `LabelItem`, `IconItem`, `InputItem`,
1969
+ * `SizeMd`, `SizeXs`, and `PredefinedTypesDisabled` stories. They activate
1970
+ * controls with `fireEvent` (no focus change) so their Chromatic snapshots
1971
+ * stay valid, while focus-moving flows live in the
1972
+ * dedicated `test - …` stories (Focus / Hover / Click / Toolbar / Predefined
1973
+ * types keyboard, zoom, and mobile / Zoom / Mobile).
1226
1974
  * - The floating panel is teleported to `document.body`, so panel content is
1227
1975
  * queried with `within(document.body)` rather than the story canvas.
1228
1976
  * - Stories whose play moves focus, opens the panel, or rescales the layout
@@ -1245,7 +1993,7 @@ export const FocusTriggerKeyboard: Story = {
1245
1993
  <div class="flex min-h-64 items-center justify-center p-8">
1246
1994
  <UiFloatActions trigger="focus" placement="top" :offset="10" aria-label="Paragraph actions">
1247
1995
  <template #container>
1248
- <span class="rounded-md border border-border-surface-default bg-background-surface-primary px-4 py-2 body-14-regular">
1996
+ <span class="rounded-md border border-border-surface-default bg-background-surface-primary px-4 py-2 body-s-regular">
1249
1997
  Tab to reveal actions
1250
1998
  </span>
1251
1999
  </template>
@@ -1338,7 +2086,7 @@ export const HoverTriggerKeyboard: Story = {
1338
2086
  <div class="flex min-h-64 items-center justify-center p-8">
1339
2087
  <UiFloatActions trigger="hover" placement="top" :offset="10" aria-label="Text actions">
1340
2088
  <template #container>
1341
- <span class="rounded-md border border-border-surface-default bg-background-surface-primary px-4 py-2 body-14-regular">
2089
+ <span class="rounded-md border border-border-surface-default bg-background-surface-primary px-4 py-2 body-s-regular">
1342
2090
  Hover or Tab to reveal actions
1343
2091
  </span>
1344
2092
  </template>
@@ -1398,7 +2146,7 @@ export const ClickTriggerKeyboard: Story = {
1398
2146
  <div class="flex min-h-64 items-center justify-center p-8">
1399
2147
  <UiFloatActions trigger="click" placement="top" :offset="10" aria-label="Open actions">
1400
2148
  <template #container>
1401
- <span class="rounded-md border border-border-surface-default bg-background-surface-primary px-4 py-2 body-14-regular">
2149
+ <span class="rounded-md border border-border-surface-default bg-background-surface-primary px-4 py-2 body-s-regular">
1402
2150
  Click or press Enter / Space
1403
2151
  </span>
1404
2152
  </template>
@@ -1487,7 +2235,13 @@ export const ToolbarKeyboard: Story = {
1487
2235
  <UiIcon name="copy" size="s" />
1488
2236
  </UiFloatActionItems>
1489
2237
  <UiFloatActionItems type="separator" />
1490
- <UiFloatActionItems type="input" aria-label="Filter value" placeholder="Filter..." />
2238
+ <UiFloatActionItems
2239
+ type="input"
2240
+ aria-label="Filter value"
2241
+ placeholder="Filter..."
2242
+ previous-aria-label="Previous match"
2243
+ next-aria-label="Next match"
2244
+ />
1491
2245
  </UiFloatActionItems>
1492
2246
  </div>
1493
2247
  `,
@@ -1511,6 +2265,9 @@ export const ToolbarKeyboard: Story = {
1511
2265
  const toolbar = canvas.getByRole('toolbar', { name: 'Paragraph actions' });
1512
2266
  const edit = canvas.getByRole('button', { name: 'Edit' });
1513
2267
  const copy = canvas.getByRole('button', { name: 'Copy' });
2268
+ const previousMatch = canvas.getByRole('button', {
2269
+ name: 'Previous match',
2270
+ });
1514
2271
  const filter = canvas.getByRole('textbox', { name: 'Filter value' });
1515
2272
 
1516
2273
  await step(
@@ -1530,6 +2287,8 @@ export const ToolbarKeyboard: Story = {
1530
2287
  await userEvent.keyboard('{ArrowRight}');
1531
2288
  await expect(copy).toHaveFocus();
1532
2289
  await userEvent.keyboard('{ArrowRight}');
2290
+ await expect(previousMatch).toHaveFocus();
2291
+ await userEvent.keyboard('{ArrowRight}');
1533
2292
  await expect(filter).toHaveFocus();
1534
2293
  },
1535
2294
  );
@@ -1544,6 +2303,262 @@ export const ToolbarKeyboard: Story = {
1544
2303
  },
1545
2304
  };
1546
2305
 
2306
+ /**
2307
+ * Keyboard support for the predefined `label`, `icon`, and `input` types:
2308
+ * roving focus skips disabled items, Enter / Space activate and select items,
2309
+ * and a vertical `input` item navigates with the Up / Down arrows.
2310
+ * Hidden test-only story.
2311
+ */
2312
+ export const PredefinedTypesKeyboard: Story = {
2313
+ name: 'test - Predefined types keyboard',
2314
+ tags: ['!dev', '!autodocs'],
2315
+ render: () => ({
2316
+ components: { UiFloatActionItems },
2317
+ setup() {
2318
+ const view = ref('grid');
2319
+ const page = ref(1);
2320
+ const total = 3;
2321
+ return { view, page, total, onItemClick };
2322
+ },
2323
+ template: `
2324
+ <div class="flex min-h-64 items-center justify-center gap-8 p-8">
2325
+ <UiFloatActionItems v-model="view" aria-label="View mode">
2326
+ <UiFloatActionItems type="label" value="grid" prefix-icon="layout-grid">Grid</UiFloatActionItems>
2327
+ <UiFloatActionItems type="icon" value="list" icon="list" aria-label="List" />
2328
+ <UiFloatActionItems type="icon" icon="trash" aria-label="Delete" disabled />
2329
+ <UiFloatActionItems type="label" prefix-icon="share" @click="onItemClick">Share</UiFloatActionItems>
2330
+ </UiFloatActionItems>
2331
+ <UiFloatActionItems aria-label="Pagination">
2332
+ <UiFloatActionItems
2333
+ type="input"
2334
+ aria-label="Page"
2335
+ model-value="1/3"
2336
+ previous-aria-label="Previous page"
2337
+ next-aria-label="Next page"
2338
+ />
2339
+ </UiFloatActionItems>
2340
+ <UiFloatActionItems aria-label="Vertical pagination" orientation="vertical">
2341
+ <UiFloatActionItems
2342
+ type="input"
2343
+ aria-label="Page"
2344
+ :model-value="page + '/' + total"
2345
+ @previous="page = Math.max(1, page - 1)"
2346
+ @next="page = Math.min(total, page + 1)"
2347
+ />
2348
+ </UiFloatActionItems>
2349
+ </div>
2350
+ `,
2351
+ }),
2352
+ parameters: {
2353
+ chromatic: { disableSnapshot: true },
2354
+ docs: {
2355
+ description: {
2356
+ story:
2357
+ 'Tab into each toolbar, move with the Arrow keys, and activate items with Enter or Space.',
2358
+ },
2359
+ },
2360
+ },
2361
+ play: async ({ canvasElement, step }) => {
2362
+ // Scenario (UiFloatActionItems): a keyboard user operates the predefined
2363
+ // types — roving focus skips disabled items, Space selects in a v-model
2364
+ // toolbar, Enter activates a label, and the vertical input item uses the
2365
+ // Up / Down arrows with the toolbar as a single Tab stop.
2366
+ onItemClick.mockClear();
2367
+ const canvas = within(canvasElement);
2368
+ const grid = canvas.getByRole('button', { name: 'Grid' });
2369
+ const list = canvas.getByRole('button', { name: 'List' });
2370
+ const share = canvas.getByRole('button', { name: 'Share' });
2371
+ const pagination = canvas.getByRole('toolbar', {
2372
+ name: 'Vertical pagination',
2373
+ });
2374
+ const previous = within(pagination).getByRole('button', {
2375
+ name: 'Previous',
2376
+ });
2377
+ const next = within(pagination).getByRole('button', { name: 'Next' });
2378
+ const page = within(pagination).getByRole('textbox', { name: 'Page' });
2379
+
2380
+ await step(
2381
+ 'screen-reader: selectable items expose aria-pressed and icons stay decorative (WCAG 4.1.2 / 1.1.1)',
2382
+ async () => {
2383
+ await expect(grid).toHaveAttribute('aria-pressed', 'true');
2384
+ await expect(list).toHaveAttribute('aria-pressed', 'false');
2385
+ await expect(share).not.toHaveAttribute('aria-pressed');
2386
+ for (const icon of grid.querySelectorAll('svg')) {
2387
+ await expect(icon).toHaveAttribute('aria-hidden', 'true');
2388
+ }
2389
+ },
2390
+ );
2391
+
2392
+ await step(
2393
+ 'screen-reader: the input item falls back to "Previous" / "Next" names in a vertical toolbar',
2394
+ async () => {
2395
+ await expect(pagination).toHaveAttribute(
2396
+ 'aria-orientation',
2397
+ 'vertical',
2398
+ );
2399
+ await expect(previous).toBeInTheDocument();
2400
+ await expect(next).toBeInTheDocument();
2401
+ await expect(page).toHaveValue('1/3');
2402
+ },
2403
+ );
2404
+
2405
+ await step(
2406
+ 'keyboard: Tab enters at the first item and Arrow / Home / End skip the disabled item (WCAG 2.1.1)',
2407
+ async () => {
2408
+ await userEvent.tab();
2409
+ await expect(grid).toHaveFocus();
2410
+ await userEvent.keyboard('{ArrowRight}');
2411
+ await expect(list).toHaveFocus();
2412
+ await userEvent.keyboard('{ArrowRight}');
2413
+ await expect(share).toHaveFocus();
2414
+ await userEvent.keyboard('{Home}');
2415
+ await expect(grid).toHaveFocus();
2416
+ await userEvent.keyboard('{End}');
2417
+ await expect(share).toHaveFocus();
2418
+ },
2419
+ );
2420
+
2421
+ await step(
2422
+ 'keyboard: Space selects an icon item and Enter activates a label item (WCAG 2.1.1)',
2423
+ async () => {
2424
+ await userEvent.keyboard('{ArrowLeft}');
2425
+ await expect(list).toHaveFocus();
2426
+ await userEvent.keyboard(' ');
2427
+ await expect(list).toHaveAttribute('aria-pressed', 'true');
2428
+ await expect(grid).toHaveAttribute('aria-pressed', 'false');
2429
+ await userEvent.keyboard('{ArrowRight}');
2430
+ await userEvent.keyboard('{Enter}');
2431
+ await expect(onItemClick).toHaveBeenCalledTimes(1);
2432
+ },
2433
+ );
2434
+
2435
+ await step(
2436
+ 'keyboard: the horizontal input item is one Tab stop and Arrow / Home move roving focus (WCAG 2.1.1)',
2437
+ async () => {
2438
+ const horizontal = within(
2439
+ canvas.getByRole('toolbar', { name: 'Pagination' }),
2440
+ );
2441
+ await userEvent.tab();
2442
+ await expect(
2443
+ horizontal.getByRole('button', { name: 'Previous page' }),
2444
+ ).toHaveFocus();
2445
+ await userEvent.keyboard('{ArrowRight}');
2446
+ await expect(
2447
+ horizontal.getByRole('textbox', { name: 'Page' }),
2448
+ ).toHaveFocus();
2449
+ await userEvent.keyboard('{ArrowRight}');
2450
+ await expect(
2451
+ horizontal.getByRole('button', { name: 'Next page' }),
2452
+ ).toHaveFocus();
2453
+ await userEvent.keyboard('{Home}');
2454
+ await expect(
2455
+ horizontal.getByRole('button', { name: 'Previous page' }),
2456
+ ).toHaveFocus();
2457
+ },
2458
+ );
2459
+
2460
+ await step(
2461
+ 'keyboard: the vertical input item is one Tab stop and moves with Up / Down arrows (WCAG 2.1.1 / 2.4.3)',
2462
+ async () => {
2463
+ await userEvent.tab();
2464
+ await expect(previous).toHaveFocus();
2465
+ await userEvent.keyboard('{ArrowDown}');
2466
+ await expect(page).toHaveFocus();
2467
+ await userEvent.keyboard('{ArrowDown}');
2468
+ await expect(next).toHaveFocus();
2469
+ await userEvent.keyboard('{ArrowRight}');
2470
+ await expect(next).toHaveFocus();
2471
+ await userEvent.keyboard('{Enter}');
2472
+ await expect(page).toHaveValue('2/3');
2473
+ await userEvent.keyboard('{ArrowUp}{ArrowUp}');
2474
+ await expect(previous).toHaveFocus();
2475
+ },
2476
+ );
2477
+ },
2478
+ };
2479
+
2480
+ /**
2481
+ * Predefined types at 200% page zoom (WCAG 1.4.4 Resize Text): labels, icons,
2482
+ * and the input item stay visible, named, and operable, and the input value
2483
+ * isn't clipped. Hidden test-only story.
2484
+ */
2485
+ export const PredefinedTypesZoom: Story = {
2486
+ name: 'test - Predefined types zoom',
2487
+ tags: ['!dev', '!autodocs'],
2488
+ globals: { zoom: '200' },
2489
+ render: () => ({
2490
+ components: { UiFloatActionItems },
2491
+ setup() {
2492
+ const page = ref(1);
2493
+ const total = 3;
2494
+ return { page, total, onItemClick };
2495
+ },
2496
+ template: `
2497
+ <div class="flex min-h-48 flex-col items-center justify-center gap-4 p-8">
2498
+ <UiFloatActionItems aria-label="Document actions">
2499
+ <UiFloatActionItems type="label" prefix-icon="edit" @click="onItemClick">Edit</UiFloatActionItems>
2500
+ <UiFloatActionItems type="icon" icon="copy" aria-label="Copy" />
2501
+ </UiFloatActionItems>
2502
+ <UiFloatActionItems aria-label="Pagination" size="xs">
2503
+ <UiFloatActionItems
2504
+ type="input"
2505
+ aria-label="Page"
2506
+ :model-value="page + '/' + total"
2507
+ @next="page = Math.min(total, page + 1)"
2508
+ />
2509
+ </UiFloatActionItems>
2510
+ </div>
2511
+ `,
2512
+ }),
2513
+ parameters: {
2514
+ chromatic: { disableSnapshot: true },
2515
+ docs: {
2516
+ description: {
2517
+ story:
2518
+ 'Use the Zoom toolbar (200% resize text, 400% reflow) to magnify the preview.',
2519
+ },
2520
+ },
2521
+ },
2522
+ play: async ({ canvasElement, step }) => {
2523
+ // Scenario (UiFloatActionItems): at 200% page zoom the predefined types
2524
+ // stay visible with their names, the xs input shows its full value, and
2525
+ // every control remains operable.
2526
+ onItemClick.mockClear();
2527
+ const canvas = within(canvasElement);
2528
+ const edit = canvas.getByRole('button', { name: 'Edit' });
2529
+ const page = canvas.getByRole('textbox', { name: 'Page' });
2530
+
2531
+ await step(
2532
+ 'zoom: preview is magnified to 200% (WCAG 1.4.4 Resize Text)',
2533
+ async () => {
2534
+ await expect(document.documentElement.style.zoom).toBe('200%');
2535
+ },
2536
+ );
2537
+
2538
+ await step(
2539
+ 'zoom: label, icon, and input controls stay visible with their accessible names',
2540
+ async () => {
2541
+ await expect(edit).toBeVisible();
2542
+ await expect(
2543
+ canvas.getByRole('button', { name: 'Copy' }),
2544
+ ).toBeVisible();
2545
+ await expect(page).toBeVisible();
2546
+ await expect(page.scrollWidth).toBeLessThanOrEqual(page.clientWidth);
2547
+ },
2548
+ );
2549
+
2550
+ await step(
2551
+ 'zoom: predefined items remain operable when magnified',
2552
+ async () => {
2553
+ await userEvent.click(edit);
2554
+ await expect(onItemClick).toHaveBeenCalledTimes(1);
2555
+ await userEvent.click(canvas.getByRole('button', { name: 'Next' }));
2556
+ await expect(page).toHaveValue('2/3');
2557
+ },
2558
+ );
2559
+ },
2560
+ };
2561
+
1547
2562
  /**
1548
2563
  * Rendered at 200% page zoom (WCAG 1.4.4 Resize Text). Use the Zoom toolbar to
1549
2564
  * try 400% reflow (WCAG 1.4.10); the toolbar must stay visible and operable.
@@ -1570,6 +2585,8 @@ export const ZoomMagnification: Story = {
1570
2585
  <UiFloatActionItems type="button" aria-label="Delete">
1571
2586
  <UiIcon name="trash" size="s" />
1572
2587
  </UiFloatActionItems>
2588
+ <UiFloatActionItems type="separator" />
2589
+ <UiFloatActionItems type="label" prefix-icon="share">Share</UiFloatActionItems>
1573
2590
  </UiFloatActionItems>
1574
2591
  </div>
1575
2592
  `,
@@ -1607,6 +2624,9 @@ export const ZoomMagnification: Story = {
1607
2624
  ).toBeVisible();
1608
2625
  await expect(edit).toBeVisible();
1609
2626
  await expect(edit).toHaveAccessibleName('Edit');
2627
+ await expect(
2628
+ canvas.getByRole('button', { name: 'Share' }),
2629
+ ).toBeVisible();
1610
2630
  },
1611
2631
  );
1612
2632