@aleph-alpha/ui-library 7.0.1 → 7.1.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 (124) hide show
  1. package/dist/system/components/UiSlider/step-marks.d.ts +45 -0
  2. package/dist/system/components/UiSlider/types.d.ts +28 -0
  3. package/dist/system/components/core/slider/Slider.vue.d.ts +21 -1
  4. package/dist/system/icons/story-sidebar-icons.json +74 -17
  5. package/dist/system/lib.js +2026 -1912
  6. package/dist/system/patterns/UiPlaceholder/types.d.ts +1 -0
  7. package/dist/system/story-sidebar-icons.json +74 -17
  8. package/package.json +15 -10
  9. package/src/components/UiAccordion/UiAccordion.guidance.md +66 -0
  10. package/src/components/UiAccordion/UiAccordion.stories.ts +131 -139
  11. package/src/components/UiAlert/UiAlert.guidance.md +66 -0
  12. package/src/components/UiAlert/UiAlert.stories.ts +167 -143
  13. package/src/components/UiAlertDialog/UiAlertDialog.guidance.md +66 -0
  14. package/src/components/UiAlertDialog/UiAlertDialog.stories.ts +136 -112
  15. package/src/components/UiAutocomplete/UiAutocomplete.guidance.md +66 -0
  16. package/src/components/UiAutocomplete/UiAutocomplete.stories.ts +123 -99
  17. package/src/components/UiAvatar/UiAvatar.guidance.md +63 -0
  18. package/src/components/UiAvatar/UiAvatar.stories.ts +340 -0
  19. package/src/components/UiAvatar/UiAvatarImage.vue +5 -1
  20. package/src/components/UiAvatar/__tests__/UiAvatar.test.ts +14 -0
  21. package/src/components/UiBadge/UiBadge.guidance.md +65 -0
  22. package/src/components/UiBadge/UiBadge.stories.ts +325 -0
  23. package/src/components/UiBreadcrumb/UiBreadcrumb.guidance.md +67 -0
  24. package/src/components/UiBreadcrumb/UiBreadcrumb.stories.ts +165 -141
  25. package/src/components/UiButton/UiButton.stories.ts +5 -2
  26. package/src/components/UiButtonGroup/UiButtonGroup.guidance.md +63 -0
  27. package/src/components/UiButtonGroup/UiButtonGroup.stories.ts +91 -67
  28. package/src/components/UiCalendar/UiCalendar.guidance.md +65 -0
  29. package/src/components/UiCalendar/UiCalendar.stories.ts +103 -110
  30. package/src/components/UiCard/UiCard.guidance.md +65 -0
  31. package/src/components/UiCard/UiCard.stories.ts +393 -0
  32. package/src/components/UiCheckbox/UiCheckbox.guidance.md +62 -0
  33. package/src/components/UiCheckbox/UiCheckbox.stories.ts +18 -56
  34. package/src/components/UiChip/UiChip.guidance.md +64 -0
  35. package/src/components/UiChip/UiChip.stories.ts +162 -138
  36. package/src/components/UiCodeBlock/UiCodeBlock.stories.ts +291 -0
  37. package/src/components/UiCodeBlock/UiCodeBlock.vue +2 -1
  38. package/src/components/UiCodeBlock/__tests__/UiCodeBlock.test.ts +18 -0
  39. package/src/components/UiDialog/UiDialog.guidance.md +66 -0
  40. package/src/components/UiDialog/UiDialog.stories.ts +90 -66
  41. package/src/components/UiDrawer/UiDrawer.guidance.md +66 -0
  42. package/src/components/UiDrawer/UiDrawer.stories.ts +186 -162
  43. package/src/components/UiDropdownMenu/UiDropdownMenu.guidance.md +68 -0
  44. package/src/components/UiDropdownMenu/UiDropdownMenu.stories.ts +127 -86
  45. package/src/components/UiEmpty/UiEmpty.guidance.md +66 -0
  46. package/src/components/UiEmpty/UiEmpty.stories.ts +370 -15
  47. package/src/components/UiFadeMask/UiFadeMask.stories.ts +66 -0
  48. package/src/components/UiField/UiField.guidance.md +63 -0
  49. package/src/components/UiField/UiField.stories.ts +90 -113
  50. package/src/components/UiFileType/UiFileType.stories.ts +254 -0
  51. package/src/components/UiFileUploadBox/UiFileUploadBox.stories.ts +74 -72
  52. package/src/components/UiIcon/UiIcon.stories.ts +256 -1
  53. package/src/components/UiInput/UiInput.guidance.md +64 -0
  54. package/src/components/UiInput/UiInput.stories.ts +132 -80
  55. package/src/components/UiInputGroup/UiInputGroup.guidance.md +66 -0
  56. package/src/components/UiInputGroup/UiInputGroup.stories.ts +127 -103
  57. package/src/components/UiItem/UiItem.guidance.md +66 -0
  58. package/src/components/UiItem/UiItem.stories.ts +81 -28
  59. package/src/components/UiKbd/UiKbd.guidance.md +65 -0
  60. package/src/components/UiKbd/UiKbd.stories.ts +373 -3
  61. package/src/components/UiLabel/UiLabel.guidance.md +65 -0
  62. package/src/components/UiLabel/UiLabel.stories.ts +163 -139
  63. package/src/components/UiListbox/UiListbox.stories.ts +197 -195
  64. package/src/components/UiNavigationMenu/UiNavigationMenu.guidance.md +66 -0
  65. package/src/components/UiNavigationMenu/UiNavigationMenu.stories.ts +169 -169
  66. package/src/components/UiPopover/UiPopover.guidance.md +65 -0
  67. package/src/components/UiPopover/UiPopover.stories.ts +115 -91
  68. package/src/components/UiProgress/UiProgress.guidance.md +65 -0
  69. package/src/components/UiProgress/UiProgress.stories.ts +300 -0
  70. package/src/components/UiRadioGroup/UiRadioGroup.guidance.md +66 -0
  71. package/src/components/UiRadioGroup/UiRadioGroup.stories.ts +163 -139
  72. package/src/components/UiRangeCalendar/UiRangeCalendar.stories.ts +128 -127
  73. package/src/components/UiResizable/UiResizable.guidance.md +65 -0
  74. package/src/components/UiResizable/UiResizable.stories.ts +176 -152
  75. package/src/components/UiSelect/UiSelect.guidance.md +66 -0
  76. package/src/components/UiSelect/UiSelect.stories.ts +150 -126
  77. package/src/components/UiSeparator/UiSeparator.guidance.md +64 -0
  78. package/src/components/UiSeparator/UiSeparator.stories.ts +350 -0
  79. package/src/components/UiSheet/UiSheet.guidance.md +66 -0
  80. package/src/components/UiSheet/UiSheet.stories.ts +194 -170
  81. package/src/components/UiSkeleton/UiSkeleton.guidance.md +65 -0
  82. package/src/components/UiSkeleton/UiSkeleton.stories.ts +253 -0
  83. package/src/components/UiSlider/UiSlider.guidance.md +66 -0
  84. package/src/components/UiSlider/UiSlider.stories.ts +885 -153
  85. package/src/components/UiSlider/UiSlider.vue +109 -1
  86. package/src/components/UiSlider/__tests__/UiSliderValueAndSteps.test.ts +210 -0
  87. package/src/components/UiSlider/__tests__/step-marks.test.ts +94 -0
  88. package/src/components/UiSlider/step-marks.ts +96 -0
  89. package/src/components/UiSlider/types.ts +32 -0
  90. package/src/components/UiSnackbar/UiSnackbar.guidance.md +66 -0
  91. package/src/components/UiSnackbar/UiSnackbar.stories.ts +106 -96
  92. package/src/components/UiSpinner/UiSpinner.guidance.md +65 -0
  93. package/src/components/UiSpinner/UiSpinner.stories.ts +249 -0
  94. package/src/components/UiStepper/UiStepper.guidance.md +66 -0
  95. package/src/components/UiStepper/UiStepper.stories.ts +142 -124
  96. package/src/components/UiSwitch/UiSwitch.guidance.md +66 -0
  97. package/src/components/UiSwitch/UiSwitch.stories.ts +170 -146
  98. package/src/components/UiTable/UiTable.guidance.md +66 -0
  99. package/src/components/UiTable/UiTable.stories.ts +530 -12
  100. package/src/components/UiTabs/UiTabs.guidance.md +66 -0
  101. package/src/components/UiTabs/UiTabs.stories.ts +174 -150
  102. package/src/components/UiTagsInput/UiTagsInput.stories.ts +154 -152
  103. package/src/components/UiTextarea/UiTextarea.guidance.md +66 -0
  104. package/src/components/UiTextarea/UiTextarea.stories.ts +86 -62
  105. package/src/components/UiToggle/UiToggle.guidance.md +66 -0
  106. package/src/components/UiToggle/UiToggle.stories.ts +183 -159
  107. package/src/components/UiToggleGroup/UiToggleGroup.guidance.md +64 -0
  108. package/src/components/UiToggleGroup/UiToggleGroup.stories.ts +222 -200
  109. package/src/components/UiTooltip/UiTooltip.guidance.md +66 -0
  110. package/src/components/UiTooltip/UiTooltip.stories.ts +90 -66
  111. package/src/components/core/slider/Slider.vue +16 -6
  112. package/src/patterns/UiDataTable/UiDataTable.guidance.md +66 -0
  113. package/src/patterns/UiDataTable/UiDataTable.stories.ts +177 -155
  114. package/src/patterns/UiDatePicker/UiDatePicker.guidance.md +66 -0
  115. package/src/patterns/UiDatePicker/UiDatePicker.stories.ts +136 -112
  116. package/src/patterns/UiFileUpload/UiFileItem.stories.ts +77 -75
  117. package/src/patterns/UiFileUpload/UiFileUpload.guidance.md +68 -0
  118. package/src/patterns/UiFileUpload/UiFileUpload.stories.ts +169 -145
  119. package/src/patterns/UiFloatActions/UiFloatActions.stories.ts +103 -101
  120. package/src/patterns/UiLayout/UiLayoutContent.stories.ts +14 -13
  121. package/src/patterns/UiLayout/UiLayoutMobile.stories.ts +65 -65
  122. package/src/patterns/UiPlaceholder/types.ts +1 -0
  123. package/src/patterns/UiProfileCard/UiProfileCard.stories.ts +86 -84
  124. package/src/patterns/UiTopBar/UiTopBar.stories.ts +84 -82
@@ -119,6 +119,71 @@ export const Default: Story = {
119
119
  },
120
120
  };
121
121
 
122
+ /**
123
+ * The mobile grid: 4 columns, 16px margins, 24px gutter, why the padding
124
+ * belongs to the content area rather than the frame, and the top and bottom
125
+ * fades that hide text under the bar and the prompt.
126
+ */
127
+ export const DesignNotes: Story = {
128
+ render: () => ({
129
+ template: `
130
+ <section class="flex flex-col gap-8 p-4">
131
+ <div>
132
+ <h2 class="heading-m font-bold text-content-on-surface-primary">Usage</h2>
133
+ <p class="body-m-regular mt-2 text-content-on-surface-primary">
134
+ A phone gets one column, so the grid underneath it and the way the
135
+ shell spends its edges are what a screen has to work with. Use the
136
+ guidelines below when placing content in the mobile layout.
137
+ </p>
138
+ </div>
139
+
140
+ <div class="grid gap-x-12 gap-y-6 md:grid-cols-[320px_1fr]">
141
+ <div>${GRID_SPECIMEN}</div>
142
+ <p class="label-s-regular text-content-on-surface-primary !leading-[1.75]">
143
+ Our mobile grid consists of 4 columns, <code>16px</code> margins and a <code>24px</code>
144
+ gutter. On a <code>320px</code> screen the margins take 32px and the three
145
+ gutters <code>320px</code>, leaving four <code>320px</code> columns.
146
+ </p>
147
+
148
+ <div>${PADDING_SPECIMEN}</div>
149
+ <p class="label-s-regular text-content-on-surface-primary !leading-[1.75]">
150
+ Instead of applying padding to the main frame, we apply it to the
151
+ content area, which allows more flexible alignment options with
152
+ floating elements. The frame stays flush: the bar spans the full
153
+ width, and the page and the navigation under it both run edge to
154
+ edge, so neither shows a seam as one slides off the other.
155
+ </p>
156
+
157
+ <div>${FADE_SPECIMEN}</div>
158
+ <p class="label-s-regular text-content-on-surface-primary !leading-[1.75]">
159
+ Inside chat we utilize a fade mask on top and bottom to help hide
160
+ text underneath floating elements like top bar or prompt field.
161
+ Give the scroll area padding (or margin on the last block) at least
162
+ as tall as the band: <code>pb-16</code> (<code>4rem</code>) below
163
+ <code>md</code>, <code>pb-24</code> (<code>6rem</code>) from
164
+ <code>md</code> up, matching <code>UiFadeMask</code>.
165
+ </p>
166
+ </div>
167
+ </section>
168
+ `,
169
+ }),
170
+ tags: ['!autodocs'],
171
+ parameters: {
172
+ a11y: { test: 'off' },
173
+ chromatic: {
174
+ disableSnapshot: true,
175
+ },
176
+ docs: {
177
+ canvas: {
178
+ sourceState: 'none',
179
+ },
180
+ },
181
+ // Guidance rather than an app screen, so it reads on the sheet every other
182
+ // design notes page uses instead of the section's full-bleed preview.
183
+ surface: 'sheet',
184
+ },
185
+ };
186
+
122
187
  /*
123
188
  * ─────────────────────────────────────────────────────────────────────────────
124
189
  * Interaction & accessibility tests (play functions)
@@ -404,68 +469,3 @@ const FADE_SPECIMEN = `
404
469
  ></div>
405
470
  </div>
406
471
  `;
407
-
408
- /**
409
- * The mobile grid: 4 columns, 16px margins, 24px gutter, why the padding
410
- * belongs to the content area rather than the frame, and the top and bottom
411
- * fades that hide text under the bar and the prompt.
412
- */
413
- export const DesignNotes: Story = {
414
- render: () => ({
415
- template: `
416
- <section class="flex flex-col gap-8 p-4">
417
- <div>
418
- <h2 class="heading-m font-bold text-content-on-surface-primary">Usage</h2>
419
- <p class="body-m-regular mt-2 text-content-on-surface-primary">
420
- A phone gets one column, so the grid underneath it and the way the
421
- shell spends its edges are what a screen has to work with. Use the
422
- guidelines below when placing content in the mobile layout.
423
- </p>
424
- </div>
425
-
426
- <div class="grid gap-x-12 gap-y-6 md:grid-cols-[320px_1fr]">
427
- <div>${GRID_SPECIMEN}</div>
428
- <p class="label-s-regular text-content-on-surface-primary !leading-[1.75]">
429
- Our mobile grid consists of 4 columns, <code>16px</code> margins and a <code>24px</code>
430
- gutter. On a <code>320px</code> screen the margins take 32px and the three
431
- gutters <code>320px</code>, leaving four <code>320px</code> columns.
432
- </p>
433
-
434
- <div>${PADDING_SPECIMEN}</div>
435
- <p class="label-s-regular text-content-on-surface-primary !leading-[1.75]">
436
- Instead of applying padding to the main frame, we apply it to the
437
- content area, which allows more flexible alignment options with
438
- floating elements. The frame stays flush: the bar spans the full
439
- width, and the page and the navigation under it both run edge to
440
- edge, so neither shows a seam as one slides off the other.
441
- </p>
442
-
443
- <div>${FADE_SPECIMEN}</div>
444
- <p class="label-s-regular text-content-on-surface-primary !leading-[1.75]">
445
- Inside chat we utilize a fade mask on top and bottom to help hide
446
- text underneath floating elements like top bar or prompt field.
447
- Give the scroll area padding (or margin on the last block) at least
448
- as tall as the band: <code>pb-16</code> (<code>4rem</code>) below
449
- <code>md</code>, <code>pb-24</code> (<code>6rem</code>) from
450
- <code>md</code> up, matching <code>UiFadeMask</code>.
451
- </p>
452
- </div>
453
- </section>
454
- `,
455
- }),
456
- tags: ['!autodocs'],
457
- parameters: {
458
- a11y: { test: 'off' },
459
- chromatic: {
460
- disableSnapshot: true,
461
- },
462
- docs: {
463
- canvas: {
464
- sourceState: 'none',
465
- },
466
- },
467
- // Guidance rather than an app screen, so it reads on the sheet every other
468
- // design notes page uses instead of the section's full-bleed preview.
469
- surface: 'sheet',
470
- },
471
- };
@@ -3,5 +3,6 @@
3
3
  * @category Foundations
4
4
  * @useCases development placeholder
5
5
  * @keywords placeholder, foundation, internal
6
+ * @internal
6
7
  */
7
8
  export type UiPlaceholderProps = Record<string, never>;
@@ -15,6 +15,7 @@ import {
15
15
  SIGN_OUT,
16
16
  STACK,
17
17
  } from './profile-card';
18
+ import { guidanceSectionClass } from '../../../.storybook/guidance';
18
19
 
19
20
  /*
20
21
  * The profile card ships no component of its own — it is a composition of
@@ -173,18 +174,18 @@ export const Default: Story = {
173
174
  await step(
174
175
  'screen-reader: every link is a named menu item (WCAG 4.1.2)',
175
176
  async () => {
176
- await expect(
177
- body.getByRole('menuitem', { name: 'Account settings' }),
178
- ).toBeVisible();
179
- await expect(
180
- body.getByRole('menuitem', { name: 'Privacy policy' }),
181
- ).toBeVisible();
182
- await expect(
183
- body.getByRole('menuitem', { name: 'Terms and conditions' }),
184
- ).toBeVisible();
185
- await expect(
186
- body.getByRole('menuitem', { name: 'Sign out' }),
187
- ).toBeVisible();
177
+ // Items can still be hidden for a frame after the menu itself is
178
+ // visible while the card opens.
179
+ for (const name of [
180
+ 'Account settings',
181
+ 'Privacy policy',
182
+ 'Terms and conditions',
183
+ 'Sign out',
184
+ ]) {
185
+ await waitFor(async () => {
186
+ await expect(body.getByRole('menuitem', { name })).toBeVisible();
187
+ });
188
+ }
188
189
  },
189
190
  );
190
191
 
@@ -204,6 +205,79 @@ export const Default: Story = {
204
205
  },
205
206
  };
206
207
 
208
+ /**
209
+ * How the card behaves for keyboard and screen-reader users.
210
+ */
211
+ export const Accessibility: Story = {
212
+ tags: ['!autodocs'],
213
+ parameters: {
214
+ surface: 'primary',
215
+ chromatic: { disableSnapshot: true },
216
+ docs: { canvas: { sourceState: 'none' } },
217
+ },
218
+ render: (args) => ({
219
+ components: PROFILE_CARD_COMPONENTS,
220
+ setup() {
221
+ return useOpenState(args);
222
+ },
223
+ template: `
224
+ <section class="${guidanceSectionClass}">
225
+ <h2 class="heading-m font-bold text-content-on-surface-primary">
226
+ Accessibility
227
+ </h2>
228
+
229
+ <div class="flex flex-col gap-2">
230
+ <h3 class="body-m-medium text-content-on-surface-primary">
231
+ Requirements
232
+ </h3>
233
+ <ul class="body-m-regular list-disc pl-5 text-content-on-surface-primary">
234
+ <li>The avatar is a button and needs a name of its own, since a picture of a person says nothing about what clicking it does.</li>
235
+ <li>The avatar tells assistive technology that it opens a menu, and whether that menu is currently open.</li>
236
+ <li>The card is announced as a menu and each row as one of its items, named by the text you can see.</li>
237
+ <li>The name and email at the top are a heading for the menu, not a choice — they cannot be focused or activated.</li>
238
+ <li>Enter or Space opens the card, the arrow keys walk it, and Escape closes it and puts focus back on the avatar.</li>
239
+ <li>Items that lead to a second level say so, and open with the right arrow key as well as on hover.</li>
240
+ <li>A list of options such as the languages is announced as a set of choices, with the current one marked as selected.</li>
241
+ <li>Icons are decoration: every item still reads the same with images off.</li>
242
+ <li>The avatar needs a touch target of at least 24px; the one below is 40px.</li>
243
+ </ul>
244
+ </div>
245
+
246
+ <div class="flex flex-col gap-2">
247
+ <h3 class="body-m-medium text-content-on-surface-primary">
248
+ Enable accessibility theme
249
+ </h3>
250
+ <p class="body-m-regular text-content-on-surface-primary">
251
+ When accessibility is required, enable our accessibility theme. This
252
+ increases contrast and ensures there are no color contrast issues.
253
+ </p>
254
+ </div>
255
+
256
+ <div class="flex flex-wrap gap-12">
257
+ <div class="flex w-80 flex-col gap-3">
258
+ <h3 class="label-m-medium text-content-on-surface-primary">
259
+ Default
260
+ </h3>
261
+ <!--
262
+ A block, not a flex column: the card is anchored to the hidden
263
+ trigger, and a flex container would park that trigger in its top
264
+ corner, behind the heading.
265
+ -->
266
+ <div class="min-h-72">${themedCard()}</div>
267
+ </div>
268
+
269
+ <div class="flex w-80 flex-col gap-3">
270
+ <h3 class="label-m-medium text-content-on-surface-primary">
271
+ Accessible
272
+ </h3>
273
+ <div class="min-h-72">${themedCard('accessible-theme')}</div>
274
+ </div>
275
+ </div>
276
+ </section>
277
+ `,
278
+ }),
279
+ };
280
+
207
281
  const withItemIconsTemplateSource = `<script setup lang="ts">
208
282
  import { EyeIcon, FileTextIcon, LockIcon, LogOutIcon, SettingsIcon } from '@aleph-alpha/ui-library/icons'
209
283
  </script>
@@ -515,78 +589,6 @@ const themedCard = (themeClass = '') => `
515
589
  </UiDropdownMenu>
516
590
  `;
517
591
 
518
- /**
519
- * How the card behaves for keyboard and screen-reader users.
520
- */
521
- export const Accessibility: Story = {
522
- tags: ['!autodocs'],
523
- parameters: {
524
- chromatic: { disableSnapshot: true },
525
- docs: { canvas: { sourceState: 'none' } },
526
- },
527
- render: (args) => ({
528
- components: PROFILE_CARD_COMPONENTS,
529
- setup() {
530
- return useOpenState(args);
531
- },
532
- template: `
533
- <section class="flex flex-col gap-6 p-4">
534
- <h2 class="heading-m font-bold text-content-on-surface-primary">
535
- Accessibility
536
- </h2>
537
-
538
- <div class="flex flex-col gap-2">
539
- <h3 class="body-m-medium text-content-on-surface-primary">
540
- Requirements
541
- </h3>
542
- <ul class="body-m-regular list-disc pl-5 text-content-on-surface-primary">
543
- <li>The avatar is a button and needs a name of its own, since a picture of a person says nothing about what clicking it does.</li>
544
- <li>The avatar tells assistive technology that it opens a menu, and whether that menu is currently open.</li>
545
- <li>The card is announced as a menu and each row as one of its items, named by the text you can see.</li>
546
- <li>The name and email at the top are a heading for the menu, not a choice — they cannot be focused or activated.</li>
547
- <li>Enter or Space opens the card, the arrow keys walk it, and Escape closes it and puts focus back on the avatar.</li>
548
- <li>Items that lead to a second level say so, and open with the right arrow key as well as on hover.</li>
549
- <li>A list of options such as the languages is announced as a set of choices, with the current one marked as selected.</li>
550
- <li>Icons are decoration: every item still reads the same with images off.</li>
551
- <li>The avatar needs a touch target of at least 24px; the one below is 40px.</li>
552
- </ul>
553
- </div>
554
-
555
- <div class="flex flex-col gap-2">
556
- <h3 class="body-m-medium text-content-on-surface-primary">
557
- Enable accessibility theme
558
- </h3>
559
- <p class="body-m-regular text-content-on-surface-primary">
560
- When accessibility is required, enable our accessibility theme. This
561
- increases contrast and ensures there are no color contrast issues.
562
- </p>
563
- </div>
564
-
565
- <div class="flex flex-wrap gap-12">
566
- <div class="flex w-80 flex-col gap-3">
567
- <h3 class="label-m-medium text-content-on-surface-primary">
568
- Default
569
- </h3>
570
- <!--
571
- A block, not a flex column: the card is anchored to the hidden
572
- trigger, and a flex container would park that trigger in its top
573
- corner, behind the heading.
574
- -->
575
- <div class="min-h-72">${themedCard()}</div>
576
- </div>
577
-
578
- <div class="flex w-80 flex-col gap-3">
579
- <h3 class="label-m-medium text-content-on-surface-primary">
580
- Accessible
581
- </h3>
582
- <div class="min-h-72">${themedCard('accessible-theme')}</div>
583
- </div>
584
- </div>
585
- </section>
586
- `,
587
- }),
588
- };
589
-
590
592
  const avatarTriggerTemplateSource = `<template>
591
593
  <!-- UiProfileCard: a composition of UiDropdownMenu parts, not a component. -->
592
594
  <UiDropdownMenu v-model:open="open" :modal="false">
@@ -23,6 +23,7 @@ import {
23
23
  accessoryDropdownSource,
24
24
  accessoryDropdownState,
25
25
  } from './accessory-dropdown';
26
+ import { guidanceSectionClass } from '../../../.storybook/guidance';
26
27
 
27
28
  /*
28
29
  * The bar itself ships no controls — these are the pieces of the reference
@@ -413,6 +414,89 @@ export const Desktop: Story = {
413
414
  },
414
415
  };
415
416
 
417
+ /**
418
+ * Accessibility guidance for the top bar: the banner landmark, naming the
419
+ * controls you pass in, focus order, and the accessibility theme for contrast.
420
+ */
421
+ export const Accessibility: Story = {
422
+ render: () => ({
423
+ components: DESKTOP_COMPONENTS,
424
+ setup: desktopSetup,
425
+ template: `
426
+ <section class="${guidanceSectionClass}">
427
+ <div>
428
+ <h2 class="heading-m font-bold text-content-on-surface-primary">
429
+ Accessibility
430
+ </h2>
431
+ </div>
432
+
433
+ <div class="flex flex-col gap-6">
434
+ <div class="flex flex-col gap-2">
435
+ <h3 class="body-m-medium text-content-on-surface-primary">
436
+ Requirements
437
+ </h3>
438
+ <ul class="body-m-regular list-disc pl-5 text-content-on-surface-primary">
439
+ <li>The bar renders a <code class="label-s-regular">header</code> element, so it is a <code class="label-s-regular">banner</code> landmark. Name it with <code class="label-s-regular">aria-label</code> when a page has more than one.</li>
440
+ <li>Only one bar per page may be a banner — nest the rest inside a landmark, or drop the label.</li>
441
+ <li>The bar ships no controls, so naming them is on you: every icon-only control you pass in needs an <code class="label-s-regular">aria-label</code>.</li>
442
+ <li>A control that toggles something (a menu button, the sidebar trigger) must carry <code class="label-s-regular">aria-expanded</code>, so a swapped icon is never the only signal.</li>
443
+ <li>Use <code class="label-s-regular">aria-pressed</code> on a layout switch so the selection is not conveyed by colour alone.</li>
444
+ <li>A labelled control that opens a menu — the accessibility toggle below — needs both <code class="label-s-regular">aria-haspopup</code> and <code class="label-s-regular">aria-expanded</code>, so a chevron that flips direction is never the only sign the menu is open (WCAG 1.4.1).</li>
445
+ <li>The <code class="label-s-regular">layout-actions</code> region takes as many controls as the design calls for, and each is its own Tab stop in the order you write them. Mind that order: it is what a keyboard user walks through.</li>
446
+ <li>Focus order follows DOM order: leading gutter, then trailing actions, then profile. Keep that order in the default slot too.</li>
447
+ <li>Mobile controls need a 24px minimum target; the reference pills are 40px.</li>
448
+ <li>Wrap each icon-only action in <code class="label-s-regular">UiTooltip</code> on a focusable trigger, so the tip is reachable by keyboard and not only by hover. A tooltip supplements the accessible name, it never replaces it.</li>
449
+ </ul>
450
+ </div>
451
+
452
+ <div class="flex flex-col gap-2">
453
+ <h3 class="body-m-medium text-content-on-surface-primary">
454
+ Enable accessibility theme
455
+ </h3>
456
+ <p class="body-m-regular text-content-on-surface-primary">
457
+ When accessibility is required, enable our accessibility theme. This
458
+ increases contrast and ensures there are no color contrast issues.
459
+ </p>
460
+ </div>
461
+ </div>
462
+
463
+ <div class="flex flex-col gap-4">
464
+ <div class="flex flex-col gap-3">
465
+ <h3 class="label-m-medium text-content-on-surface-primary">
466
+ Default
467
+ </h3>
468
+ <UiTopBar aria-label="Default top bar">
469
+ <template #logo>${LOGO}</template>
470
+ <template #sidebar-toggle>${SIDEBAR_TOGGLE}</template>
471
+ <template #layout-actions>${LAYOUT_ACTIONS}</template>
472
+ <template #profile>${PROFILE}</template>
473
+ </UiTopBar>
474
+ </div>
475
+
476
+ <div class="accessible-theme flex flex-col gap-3">
477
+ <h3 class="label-m-medium text-content-on-surface-primary">
478
+ Accessible
479
+ </h3>
480
+ <UiTopBar aria-label="Accessible top bar">
481
+ <template #logo>${LOGO}</template>
482
+ <template #sidebar-toggle>${SIDEBAR_TOGGLE}</template>
483
+ <template #layout-actions>${LAYOUT_ACTIONS}</template>
484
+ <template #profile>${PROFILE}</template>
485
+ </UiTopBar>
486
+ </div>
487
+ </div>
488
+ </section>
489
+ `,
490
+ }),
491
+ tags: ['!autodocs'],
492
+ parameters: {
493
+ surface: 'primary',
494
+ a11y: { test: 'off' },
495
+ chromatic: { disableSnapshot: true },
496
+ docs: { canvas: { sourceState: 'none' } },
497
+ },
498
+ };
499
+
416
500
  const mobileTemplateSource = `<script setup lang="ts">
417
501
  import { ChevronDownIcon, MenuIcon, XIcon } from '@aleph-alpha/ui-library/icons'
418
502
  </script>
@@ -609,88 +693,6 @@ export const SlotVisibility: Story = {
609
693
  },
610
694
  };
611
695
 
612
- /**
613
- * Accessibility guidance for the top bar: the banner landmark, naming the
614
- * controls you pass in, focus order, and the accessibility theme for contrast.
615
- */
616
- export const Accessibility: Story = {
617
- render: () => ({
618
- components: DESKTOP_COMPONENTS,
619
- setup: desktopSetup,
620
- template: `
621
- <section class="flex flex-col gap-6 p-4">
622
- <div>
623
- <h2 class="heading-m font-bold text-content-on-surface-primary">
624
- Accessibility
625
- </h2>
626
- </div>
627
-
628
- <div class="flex flex-col gap-6">
629
- <div class="flex flex-col gap-2">
630
- <h3 class="body-m-medium text-content-on-surface-primary">
631
- Requirements
632
- </h3>
633
- <ul class="body-m-regular list-disc pl-5 text-content-on-surface-primary">
634
- <li>The bar renders a <code class="label-s-regular">header</code> element, so it is a <code class="label-s-regular">banner</code> landmark. Name it with <code class="label-s-regular">aria-label</code> when a page has more than one.</li>
635
- <li>Only one bar per page may be a banner — nest the rest inside a landmark, or drop the label.</li>
636
- <li>The bar ships no controls, so naming them is on you: every icon-only control you pass in needs an <code class="label-s-regular">aria-label</code>.</li>
637
- <li>A control that toggles something (a menu button, the sidebar trigger) must carry <code class="label-s-regular">aria-expanded</code>, so a swapped icon is never the only signal.</li>
638
- <li>Use <code class="label-s-regular">aria-pressed</code> on a layout switch so the selection is not conveyed by colour alone.</li>
639
- <li>A labelled control that opens a menu — the accessibility toggle below — needs both <code class="label-s-regular">aria-haspopup</code> and <code class="label-s-regular">aria-expanded</code>, so a chevron that flips direction is never the only sign the menu is open (WCAG 1.4.1).</li>
640
- <li>The <code class="label-s-regular">layout-actions</code> region takes as many controls as the design calls for, and each is its own Tab stop in the order you write them. Mind that order: it is what a keyboard user walks through.</li>
641
- <li>Focus order follows DOM order: leading gutter, then trailing actions, then profile. Keep that order in the default slot too.</li>
642
- <li>Mobile controls need a 24px minimum target; the reference pills are 40px.</li>
643
- <li>Wrap each icon-only action in <code class="label-s-regular">UiTooltip</code> on a focusable trigger, so the tip is reachable by keyboard and not only by hover. A tooltip supplements the accessible name, it never replaces it.</li>
644
- </ul>
645
- </div>
646
-
647
- <div class="flex flex-col gap-2">
648
- <h3 class="body-m-medium text-content-on-surface-primary">
649
- Enable accessibility theme
650
- </h3>
651
- <p class="body-m-regular text-content-on-surface-primary">
652
- When accessibility is required, enable our accessibility theme. This
653
- increases contrast and ensures there are no color contrast issues.
654
- </p>
655
- </div>
656
- </div>
657
-
658
- <div class="flex flex-col gap-4">
659
- <div class="flex flex-col gap-3">
660
- <h3 class="label-m-medium text-content-on-surface-primary">
661
- Default
662
- </h3>
663
- <UiTopBar aria-label="Default top bar">
664
- <template #logo>${LOGO}</template>
665
- <template #sidebar-toggle>${SIDEBAR_TOGGLE}</template>
666
- <template #layout-actions>${LAYOUT_ACTIONS}</template>
667
- <template #profile>${PROFILE}</template>
668
- </UiTopBar>
669
- </div>
670
-
671
- <div class="accessible-theme flex flex-col gap-3">
672
- <h3 class="label-m-medium text-content-on-surface-primary">
673
- Accessible
674
- </h3>
675
- <UiTopBar aria-label="Accessible top bar">
676
- <template #logo>${LOGO}</template>
677
- <template #sidebar-toggle>${SIDEBAR_TOGGLE}</template>
678
- <template #layout-actions>${LAYOUT_ACTIONS}</template>
679
- <template #profile>${PROFILE}</template>
680
- </UiTopBar>
681
- </div>
682
- </div>
683
- </section>
684
- `,
685
- }),
686
- tags: ['!autodocs'],
687
- parameters: {
688
- a11y: { test: 'off' },
689
- chromatic: { disableSnapshot: true },
690
- docs: { canvas: { sourceState: 'none' } },
691
- },
692
- };
693
-
694
696
  /*
695
697
  * ─────────────────────────────────────────────────────────────────────────────
696
698
  * Interaction & accessibility tests (play functions)