@aleph-alpha/ui-library 7.0.1 → 7.0.2
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.
- package/dist/system/icons/story-sidebar-icons.json +74 -17
- package/dist/system/lib.js +8 -5
- package/dist/system/patterns/UiPlaceholder/types.d.ts +1 -0
- package/dist/system/story-sidebar-icons.json +74 -17
- package/package.json +8 -3
- package/src/components/UiAccordion/UiAccordion.guidance.md +66 -0
- package/src/components/UiAccordion/UiAccordion.stories.ts +131 -139
- package/src/components/UiAlert/UiAlert.guidance.md +66 -0
- package/src/components/UiAlert/UiAlert.stories.ts +167 -143
- package/src/components/UiAlertDialog/UiAlertDialog.guidance.md +66 -0
- package/src/components/UiAlertDialog/UiAlertDialog.stories.ts +136 -112
- package/src/components/UiAutocomplete/UiAutocomplete.guidance.md +66 -0
- package/src/components/UiAutocomplete/UiAutocomplete.stories.ts +123 -99
- package/src/components/UiAvatar/UiAvatar.guidance.md +63 -0
- package/src/components/UiAvatar/UiAvatar.stories.ts +340 -0
- package/src/components/UiAvatar/UiAvatarImage.vue +5 -1
- package/src/components/UiAvatar/__tests__/UiAvatar.test.ts +14 -0
- package/src/components/UiBadge/UiBadge.guidance.md +65 -0
- package/src/components/UiBadge/UiBadge.stories.ts +325 -0
- package/src/components/UiBreadcrumb/UiBreadcrumb.guidance.md +67 -0
- package/src/components/UiBreadcrumb/UiBreadcrumb.stories.ts +165 -141
- package/src/components/UiButton/UiButton.stories.ts +5 -2
- package/src/components/UiButtonGroup/UiButtonGroup.guidance.md +63 -0
- package/src/components/UiButtonGroup/UiButtonGroup.stories.ts +91 -67
- package/src/components/UiCalendar/UiCalendar.guidance.md +65 -0
- package/src/components/UiCalendar/UiCalendar.stories.ts +103 -110
- package/src/components/UiCard/UiCard.guidance.md +65 -0
- package/src/components/UiCard/UiCard.stories.ts +393 -0
- package/src/components/UiCheckbox/UiCheckbox.guidance.md +62 -0
- package/src/components/UiCheckbox/UiCheckbox.stories.ts +18 -56
- package/src/components/UiChip/UiChip.guidance.md +64 -0
- package/src/components/UiChip/UiChip.stories.ts +162 -138
- package/src/components/UiCodeBlock/UiCodeBlock.stories.ts +291 -0
- package/src/components/UiCodeBlock/UiCodeBlock.vue +2 -1
- package/src/components/UiCodeBlock/__tests__/UiCodeBlock.test.ts +18 -0
- package/src/components/UiDialog/UiDialog.guidance.md +66 -0
- package/src/components/UiDialog/UiDialog.stories.ts +90 -66
- package/src/components/UiDrawer/UiDrawer.guidance.md +66 -0
- package/src/components/UiDrawer/UiDrawer.stories.ts +186 -162
- package/src/components/UiDropdownMenu/UiDropdownMenu.guidance.md +68 -0
- package/src/components/UiDropdownMenu/UiDropdownMenu.stories.ts +127 -86
- package/src/components/UiEmpty/UiEmpty.guidance.md +66 -0
- package/src/components/UiEmpty/UiEmpty.stories.ts +370 -15
- package/src/components/UiFadeMask/UiFadeMask.stories.ts +66 -0
- package/src/components/UiField/UiField.guidance.md +63 -0
- package/src/components/UiField/UiField.stories.ts +90 -113
- package/src/components/UiFileType/UiFileType.stories.ts +254 -0
- package/src/components/UiFileUploadBox/UiFileUploadBox.stories.ts +74 -72
- package/src/components/UiIcon/UiIcon.stories.ts +256 -1
- package/src/components/UiInput/UiInput.guidance.md +64 -0
- package/src/components/UiInput/UiInput.stories.ts +132 -80
- package/src/components/UiInputGroup/UiInputGroup.guidance.md +66 -0
- package/src/components/UiInputGroup/UiInputGroup.stories.ts +127 -103
- package/src/components/UiItem/UiItem.guidance.md +66 -0
- package/src/components/UiItem/UiItem.stories.ts +81 -28
- package/src/components/UiKbd/UiKbd.guidance.md +65 -0
- package/src/components/UiKbd/UiKbd.stories.ts +373 -3
- package/src/components/UiLabel/UiLabel.guidance.md +65 -0
- package/src/components/UiLabel/UiLabel.stories.ts +163 -139
- package/src/components/UiListbox/UiListbox.stories.ts +197 -195
- package/src/components/UiNavigationMenu/UiNavigationMenu.guidance.md +66 -0
- package/src/components/UiNavigationMenu/UiNavigationMenu.stories.ts +169 -169
- package/src/components/UiPopover/UiPopover.guidance.md +65 -0
- package/src/components/UiPopover/UiPopover.stories.ts +115 -91
- package/src/components/UiProgress/UiProgress.guidance.md +65 -0
- package/src/components/UiProgress/UiProgress.stories.ts +300 -0
- package/src/components/UiRadioGroup/UiRadioGroup.guidance.md +66 -0
- package/src/components/UiRadioGroup/UiRadioGroup.stories.ts +163 -139
- package/src/components/UiRangeCalendar/UiRangeCalendar.stories.ts +128 -127
- package/src/components/UiResizable/UiResizable.guidance.md +65 -0
- package/src/components/UiResizable/UiResizable.stories.ts +176 -152
- package/src/components/UiSelect/UiSelect.guidance.md +66 -0
- package/src/components/UiSelect/UiSelect.stories.ts +150 -126
- package/src/components/UiSeparator/UiSeparator.guidance.md +64 -0
- package/src/components/UiSeparator/UiSeparator.stories.ts +350 -0
- package/src/components/UiSheet/UiSheet.guidance.md +66 -0
- package/src/components/UiSheet/UiSheet.stories.ts +194 -170
- package/src/components/UiSkeleton/UiSkeleton.guidance.md +65 -0
- package/src/components/UiSkeleton/UiSkeleton.stories.ts +253 -0
- package/src/components/UiSlider/UiSlider.guidance.md +66 -0
- package/src/components/UiSlider/UiSlider.stories.ts +150 -126
- package/src/components/UiSnackbar/UiSnackbar.guidance.md +66 -0
- package/src/components/UiSnackbar/UiSnackbar.stories.ts +106 -96
- package/src/components/UiSpinner/UiSpinner.guidance.md +65 -0
- package/src/components/UiSpinner/UiSpinner.stories.ts +249 -0
- package/src/components/UiStepper/UiStepper.guidance.md +66 -0
- package/src/components/UiStepper/UiStepper.stories.ts +142 -124
- package/src/components/UiSwitch/UiSwitch.guidance.md +66 -0
- package/src/components/UiSwitch/UiSwitch.stories.ts +170 -146
- package/src/components/UiTable/UiTable.guidance.md +66 -0
- package/src/components/UiTable/UiTable.stories.ts +530 -12
- package/src/components/UiTabs/UiTabs.guidance.md +66 -0
- package/src/components/UiTabs/UiTabs.stories.ts +174 -150
- package/src/components/UiTagsInput/UiTagsInput.stories.ts +154 -152
- package/src/components/UiTextarea/UiTextarea.guidance.md +66 -0
- package/src/components/UiTextarea/UiTextarea.stories.ts +86 -62
- package/src/components/UiToggle/UiToggle.guidance.md +66 -0
- package/src/components/UiToggle/UiToggle.stories.ts +183 -159
- package/src/components/UiToggleGroup/UiToggleGroup.guidance.md +64 -0
- package/src/components/UiToggleGroup/UiToggleGroup.stories.ts +222 -200
- package/src/components/UiTooltip/UiTooltip.guidance.md +66 -0
- package/src/components/UiTooltip/UiTooltip.stories.ts +90 -66
- package/src/patterns/UiDataTable/UiDataTable.guidance.md +66 -0
- package/src/patterns/UiDataTable/UiDataTable.stories.ts +177 -155
- package/src/patterns/UiDatePicker/UiDatePicker.guidance.md +66 -0
- package/src/patterns/UiDatePicker/UiDatePicker.stories.ts +136 -112
- package/src/patterns/UiFileUpload/UiFileItem.stories.ts +77 -75
- package/src/patterns/UiFileUpload/UiFileUpload.guidance.md +68 -0
- package/src/patterns/UiFileUpload/UiFileUpload.stories.ts +169 -145
- package/src/patterns/UiFloatActions/UiFloatActions.stories.ts +103 -101
- package/src/patterns/UiLayout/UiLayoutContent.stories.ts +14 -13
- package/src/patterns/UiLayout/UiLayoutMobile.stories.ts +65 -65
- package/src/patterns/UiPlaceholder/types.ts +1 -0
- package/src/patterns/UiProfileCard/UiProfileCard.stories.ts +74 -72
- 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
|
-
};
|
|
@@ -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
|
|
@@ -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)
|