@aleph-alpha/ui-library 7.0.0 → 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/components/UiDropdownMenu/useMobileSubmenuPlacement.d.ts +1 -1
- package/dist/system/icons/story-sidebar-icons.json +74 -17
- package/dist/system/lib.js +1167 -1162
- 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 +332 -85
- package/src/components/UiDropdownMenu/__tests__/UiDropdownMenu.test.ts +134 -0
- package/src/components/UiDropdownMenu/useMobileSubmenuPlacement.ts +23 -2
- 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
|
@@ -11,6 +11,16 @@ import {
|
|
|
11
11
|
UiNavigationMenuIndicator,
|
|
12
12
|
navigationMenuTriggerStyle,
|
|
13
13
|
} from './index';
|
|
14
|
+
import {
|
|
15
|
+
accessibilityRequirementsTemplate,
|
|
16
|
+
designNotesStory,
|
|
17
|
+
guidanceLinks,
|
|
18
|
+
guidanceSectionClass,
|
|
19
|
+
parseGuidance,
|
|
20
|
+
} from '../../../.storybook/guidance';
|
|
21
|
+
import guidanceMarkdown from './UiNavigationMenu.guidance.md?raw';
|
|
22
|
+
|
|
23
|
+
const guidance = parseGuidance(guidanceMarkdown);
|
|
14
24
|
|
|
15
25
|
// Module-level spies shared by the hidden test stories; each play function
|
|
16
26
|
// clears them first so runs stay independent.
|
|
@@ -92,6 +102,7 @@ const meta: Meta<typeof UiNavigationMenu> = {
|
|
|
92
102
|
parameters: {
|
|
93
103
|
layout: 'fullscreen',
|
|
94
104
|
docs: {
|
|
105
|
+
links: guidanceLinks(guidance),
|
|
95
106
|
story: {
|
|
96
107
|
height: '400px',
|
|
97
108
|
},
|
|
@@ -242,6 +253,164 @@ export const Default: Story = {
|
|
|
242
253
|
},
|
|
243
254
|
};
|
|
244
255
|
|
|
256
|
+
/**
|
|
257
|
+
* Usage, guidelines, and do's and don'ts from the Figma documentation.
|
|
258
|
+
*/
|
|
259
|
+
export const DesignNotes: Story = {
|
|
260
|
+
...designNotesStory(guidance),
|
|
261
|
+
tags: ['!autodocs'],
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* Accessibility guidance for top-level navigation: the current section marked
|
|
266
|
+
* without relying on colour, distinct hover and focus states, panels that
|
|
267
|
+
* open fully on screen, comfortable targets, and hover-free reachability —
|
|
268
|
+
* shown side by side in the default and accessible themes.
|
|
269
|
+
*/
|
|
270
|
+
export const Accessibility: Story = {
|
|
271
|
+
tags: ['!autodocs'],
|
|
272
|
+
parameters: {
|
|
273
|
+
surface: 'primary',
|
|
274
|
+
a11y: { test: 'off' },
|
|
275
|
+
chromatic: { disableSnapshot: true },
|
|
276
|
+
docs: {
|
|
277
|
+
canvas: {
|
|
278
|
+
sourceState: 'none',
|
|
279
|
+
},
|
|
280
|
+
},
|
|
281
|
+
},
|
|
282
|
+
render: () => ({
|
|
283
|
+
components: {
|
|
284
|
+
UiNavigationMenu,
|
|
285
|
+
UiNavigationMenuList,
|
|
286
|
+
UiNavigationMenuItem,
|
|
287
|
+
UiNavigationMenuTrigger,
|
|
288
|
+
UiNavigationMenuContent,
|
|
289
|
+
UiNavigationMenuLink,
|
|
290
|
+
},
|
|
291
|
+
setup() {
|
|
292
|
+
return { navigationMenuTriggerStyle };
|
|
293
|
+
},
|
|
294
|
+
template: `
|
|
295
|
+
<section class="${guidanceSectionClass}">
|
|
296
|
+
<div>
|
|
297
|
+
<h2 class="heading-m font-bold text-content-on-surface-primary">
|
|
298
|
+
Accessibility
|
|
299
|
+
</h2>
|
|
300
|
+
</div>
|
|
301
|
+
|
|
302
|
+
<div class="flex flex-col gap-6">
|
|
303
|
+
${accessibilityRequirementsTemplate(guidance.accessibility, 'Requirements')}
|
|
304
|
+
|
|
305
|
+
<div class="flex flex-col gap-2">
|
|
306
|
+
<h3 class="body-m-medium text-content-on-surface-primary">
|
|
307
|
+
In code
|
|
308
|
+
</h3>
|
|
309
|
+
<ul class="body-m-regular flex list-disc flex-col gap-1 pl-6 text-content-on-surface-primary">
|
|
310
|
+
<li>
|
|
311
|
+
Give every navigation landmark a unique accessible name with
|
|
312
|
+
<code>aria-label</code> or <code>aria-labelledby</code>
|
|
313
|
+
</li>
|
|
314
|
+
<li>
|
|
315
|
+
Preserve keyboard operation: Tab enters the navigation, arrow
|
|
316
|
+
keys move between items, Enter or Space opens a panel, and
|
|
317
|
+
Escape closes it
|
|
318
|
+
</li>
|
|
319
|
+
</ul>
|
|
320
|
+
</div>
|
|
321
|
+
|
|
322
|
+
<div class="flex flex-col gap-2">
|
|
323
|
+
<h3 class="body-m-medium text-content-on-surface-primary">
|
|
324
|
+
Enable accessibility theme
|
|
325
|
+
</h3>
|
|
326
|
+
<p class="body-m-regular text-content-on-surface-primary">
|
|
327
|
+
When accessibility is required, enable our accessibility theme.
|
|
328
|
+
This increases contrast and ensures there are no color contrast
|
|
329
|
+
issues.
|
|
330
|
+
</p>
|
|
331
|
+
</div>
|
|
332
|
+
</div>
|
|
333
|
+
|
|
334
|
+
<div class="grid gap-4 md:grid-cols-2">
|
|
335
|
+
<div class="flex flex-col gap-3">
|
|
336
|
+
<h3 class="label-m-medium text-center text-content-on-surface-primary">
|
|
337
|
+
Default
|
|
338
|
+
</h3>
|
|
339
|
+
<div class="flex min-h-20 items-center justify-start overflow-visible border border-border-surface-default p-6">
|
|
340
|
+
<UiNavigationMenu aria-label="Main navigation">
|
|
341
|
+
<UiNavigationMenuList>
|
|
342
|
+
<UiNavigationMenuItem>
|
|
343
|
+
<UiNavigationMenuTrigger>Menu Item</UiNavigationMenuTrigger>
|
|
344
|
+
<UiNavigationMenuContent>
|
|
345
|
+
<ul class="grid w-[200px]">
|
|
346
|
+
<li><UiNavigationMenuLink href="#">Menu Item</UiNavigationMenuLink></li>
|
|
347
|
+
</ul>
|
|
348
|
+
</UiNavigationMenuContent>
|
|
349
|
+
</UiNavigationMenuItem>
|
|
350
|
+
<UiNavigationMenuItem>
|
|
351
|
+
<UiNavigationMenuTrigger>Menu Item</UiNavigationMenuTrigger>
|
|
352
|
+
<UiNavigationMenuContent>
|
|
353
|
+
<ul class="grid w-[200px]">
|
|
354
|
+
<li><UiNavigationMenuLink href="#">Menu Item</UiNavigationMenuLink></li>
|
|
355
|
+
</ul>
|
|
356
|
+
</UiNavigationMenuContent>
|
|
357
|
+
</UiNavigationMenuItem>
|
|
358
|
+
<UiNavigationMenuItem>
|
|
359
|
+
<UiNavigationMenuLink href="#" :class="navigationMenuTriggerStyle()">Menu Item</UiNavigationMenuLink>
|
|
360
|
+
</UiNavigationMenuItem>
|
|
361
|
+
<UiNavigationMenuItem>
|
|
362
|
+
<UiNavigationMenuLink href="#" :class="navigationMenuTriggerStyle()">Menu Item</UiNavigationMenuLink>
|
|
363
|
+
</UiNavigationMenuItem>
|
|
364
|
+
<UiNavigationMenuItem>
|
|
365
|
+
<UiNavigationMenuLink href="#" :class="navigationMenuTriggerStyle()">Menu Item</UiNavigationMenuLink>
|
|
366
|
+
</UiNavigationMenuItem>
|
|
367
|
+
</UiNavigationMenuList>
|
|
368
|
+
</UiNavigationMenu>
|
|
369
|
+
</div>
|
|
370
|
+
</div>
|
|
371
|
+
|
|
372
|
+
<div class="accessible-theme flex flex-col gap-3">
|
|
373
|
+
<h3 class="label-m-medium text-center text-content-on-surface-primary">
|
|
374
|
+
Accessible
|
|
375
|
+
</h3>
|
|
376
|
+
<div class="flex min-h-20 items-center justify-start overflow-visible border border-border-surface-default p-6">
|
|
377
|
+
<UiNavigationMenu aria-label="Main navigation">
|
|
378
|
+
<UiNavigationMenuList>
|
|
379
|
+
<UiNavigationMenuItem>
|
|
380
|
+
<UiNavigationMenuTrigger>Menu Item</UiNavigationMenuTrigger>
|
|
381
|
+
<UiNavigationMenuContent>
|
|
382
|
+
<ul class="grid w-[200px]">
|
|
383
|
+
<li><UiNavigationMenuLink href="#">Menu Item</UiNavigationMenuLink></li>
|
|
384
|
+
</ul>
|
|
385
|
+
</UiNavigationMenuContent>
|
|
386
|
+
</UiNavigationMenuItem>
|
|
387
|
+
<UiNavigationMenuItem>
|
|
388
|
+
<UiNavigationMenuTrigger>Menu Item</UiNavigationMenuTrigger>
|
|
389
|
+
<UiNavigationMenuContent>
|
|
390
|
+
<ul class="grid w-[200px]">
|
|
391
|
+
<li><UiNavigationMenuLink href="#">Menu Item</UiNavigationMenuLink></li>
|
|
392
|
+
</ul>
|
|
393
|
+
</UiNavigationMenuContent>
|
|
394
|
+
</UiNavigationMenuItem>
|
|
395
|
+
<UiNavigationMenuItem>
|
|
396
|
+
<UiNavigationMenuLink href="#" :class="navigationMenuTriggerStyle()">Menu Item</UiNavigationMenuLink>
|
|
397
|
+
</UiNavigationMenuItem>
|
|
398
|
+
<UiNavigationMenuItem>
|
|
399
|
+
<UiNavigationMenuLink href="#" :class="navigationMenuTriggerStyle()">Menu Item</UiNavigationMenuLink>
|
|
400
|
+
</UiNavigationMenuItem>
|
|
401
|
+
<UiNavigationMenuItem>
|
|
402
|
+
<UiNavigationMenuLink href="#" :class="navigationMenuTriggerStyle()">Menu Item</UiNavigationMenuLink>
|
|
403
|
+
</UiNavigationMenuItem>
|
|
404
|
+
</UiNavigationMenuList>
|
|
405
|
+
</UiNavigationMenu>
|
|
406
|
+
</div>
|
|
407
|
+
</div>
|
|
408
|
+
</div>
|
|
409
|
+
</section>
|
|
410
|
+
`,
|
|
411
|
+
}),
|
|
412
|
+
};
|
|
413
|
+
|
|
245
414
|
const withLinksTemplateSource = `<script setup lang="ts">
|
|
246
415
|
import {
|
|
247
416
|
UiNavigationMenu,
|
|
@@ -1766,172 +1935,3 @@ export const MobileBreakpoint: Story = {
|
|
|
1766
1935
|
);
|
|
1767
1936
|
},
|
|
1768
1937
|
};
|
|
1769
|
-
|
|
1770
|
-
/**
|
|
1771
|
-
* Accessibility guidance for top-level navigation: the current section marked
|
|
1772
|
-
* without relying on colour, distinct hover and focus states, panels that
|
|
1773
|
-
* open fully on screen, comfortable targets, and hover-free reachability —
|
|
1774
|
-
* shown side by side in the default and accessible themes.
|
|
1775
|
-
*/
|
|
1776
|
-
export const Accessibility: Story = {
|
|
1777
|
-
tags: ['!autodocs'],
|
|
1778
|
-
parameters: {
|
|
1779
|
-
a11y: { test: 'off' },
|
|
1780
|
-
chromatic: { disableSnapshot: true },
|
|
1781
|
-
docs: {
|
|
1782
|
-
canvas: {
|
|
1783
|
-
sourceState: 'none',
|
|
1784
|
-
},
|
|
1785
|
-
},
|
|
1786
|
-
},
|
|
1787
|
-
render: () => ({
|
|
1788
|
-
components: {
|
|
1789
|
-
UiNavigationMenu,
|
|
1790
|
-
UiNavigationMenuList,
|
|
1791
|
-
UiNavigationMenuItem,
|
|
1792
|
-
UiNavigationMenuTrigger,
|
|
1793
|
-
UiNavigationMenuContent,
|
|
1794
|
-
UiNavigationMenuLink,
|
|
1795
|
-
},
|
|
1796
|
-
setup() {
|
|
1797
|
-
return { navigationMenuTriggerStyle };
|
|
1798
|
-
},
|
|
1799
|
-
template: `
|
|
1800
|
-
<section class="flex w-full flex-col gap-6 p-4">
|
|
1801
|
-
<div>
|
|
1802
|
-
<h2 class="heading-m font-bold text-content-on-surface-primary">
|
|
1803
|
-
Accessibility
|
|
1804
|
-
</h2>
|
|
1805
|
-
</div>
|
|
1806
|
-
|
|
1807
|
-
<div class="flex flex-col gap-6">
|
|
1808
|
-
<div class="flex flex-col gap-2">
|
|
1809
|
-
<h3 class="body-m-medium text-content-on-surface-primary">
|
|
1810
|
-
Requirements
|
|
1811
|
-
</h3>
|
|
1812
|
-
<ul class="body-m-regular flex list-disc flex-col gap-1 pl-6 text-content-on-surface-primary">
|
|
1813
|
-
<li>
|
|
1814
|
-
The current section is marked by weight or a rule, not by
|
|
1815
|
-
colour alone
|
|
1816
|
-
</li>
|
|
1817
|
-
<li>
|
|
1818
|
-
Triggers and links keep visible hover and focus states,
|
|
1819
|
-
distinct from each other
|
|
1820
|
-
</li>
|
|
1821
|
-
<li>
|
|
1822
|
-
Panels open fully on screen, so no destination is cut off
|
|
1823
|
-
</li>
|
|
1824
|
-
<li>
|
|
1825
|
-
Link descriptions hold contrast against the panel's own surface
|
|
1826
|
-
</li>
|
|
1827
|
-
<li>
|
|
1828
|
-
Triggers and links are comfortable targets, with space between
|
|
1829
|
-
adjacent items
|
|
1830
|
-
</li>
|
|
1831
|
-
<li>
|
|
1832
|
-
Give every navigation landmark a unique accessible name with
|
|
1833
|
-
<code>aria-label</code> or <code>aria-labelledby</code>
|
|
1834
|
-
</li>
|
|
1835
|
-
<li>
|
|
1836
|
-
Preserve keyboard operation: Tab enters the navigation, arrow
|
|
1837
|
-
keys move between items, Enter or Space opens a panel, and
|
|
1838
|
-
Escape closes it
|
|
1839
|
-
</li>
|
|
1840
|
-
<li>
|
|
1841
|
-
Navigation is reachable without hover, since pointing is not
|
|
1842
|
-
available to every user
|
|
1843
|
-
</li>
|
|
1844
|
-
</ul>
|
|
1845
|
-
</div>
|
|
1846
|
-
|
|
1847
|
-
<div class="flex flex-col gap-2">
|
|
1848
|
-
<h3 class="body-m-medium text-content-on-surface-primary">
|
|
1849
|
-
Enable accessibility theme
|
|
1850
|
-
</h3>
|
|
1851
|
-
<p class="body-m-regular text-content-on-surface-primary">
|
|
1852
|
-
When accessibility is required, enable our accessibility theme.
|
|
1853
|
-
This increases contrast and ensures there are no color contrast
|
|
1854
|
-
issues.
|
|
1855
|
-
</p>
|
|
1856
|
-
</div>
|
|
1857
|
-
</div>
|
|
1858
|
-
|
|
1859
|
-
<div class="grid gap-4 md:grid-cols-2">
|
|
1860
|
-
<div class="flex flex-col gap-3">
|
|
1861
|
-
<h3 class="label-m-medium text-center text-content-on-surface-primary">
|
|
1862
|
-
Default
|
|
1863
|
-
</h3>
|
|
1864
|
-
<div class="flex min-h-20 items-center justify-start overflow-visible border border-border-surface-default p-6">
|
|
1865
|
-
<UiNavigationMenu aria-label="Main navigation">
|
|
1866
|
-
<UiNavigationMenuList>
|
|
1867
|
-
<UiNavigationMenuItem>
|
|
1868
|
-
<UiNavigationMenuTrigger>Menu Item</UiNavigationMenuTrigger>
|
|
1869
|
-
<UiNavigationMenuContent>
|
|
1870
|
-
<ul class="grid w-[200px]">
|
|
1871
|
-
<li><UiNavigationMenuLink href="#">Menu Item</UiNavigationMenuLink></li>
|
|
1872
|
-
</ul>
|
|
1873
|
-
</UiNavigationMenuContent>
|
|
1874
|
-
</UiNavigationMenuItem>
|
|
1875
|
-
<UiNavigationMenuItem>
|
|
1876
|
-
<UiNavigationMenuTrigger>Menu Item</UiNavigationMenuTrigger>
|
|
1877
|
-
<UiNavigationMenuContent>
|
|
1878
|
-
<ul class="grid w-[200px]">
|
|
1879
|
-
<li><UiNavigationMenuLink href="#">Menu Item</UiNavigationMenuLink></li>
|
|
1880
|
-
</ul>
|
|
1881
|
-
</UiNavigationMenuContent>
|
|
1882
|
-
</UiNavigationMenuItem>
|
|
1883
|
-
<UiNavigationMenuItem>
|
|
1884
|
-
<UiNavigationMenuLink href="#" :class="navigationMenuTriggerStyle()">Menu Item</UiNavigationMenuLink>
|
|
1885
|
-
</UiNavigationMenuItem>
|
|
1886
|
-
<UiNavigationMenuItem>
|
|
1887
|
-
<UiNavigationMenuLink href="#" :class="navigationMenuTriggerStyle()">Menu Item</UiNavigationMenuLink>
|
|
1888
|
-
</UiNavigationMenuItem>
|
|
1889
|
-
<UiNavigationMenuItem>
|
|
1890
|
-
<UiNavigationMenuLink href="#" :class="navigationMenuTriggerStyle()">Menu Item</UiNavigationMenuLink>
|
|
1891
|
-
</UiNavigationMenuItem>
|
|
1892
|
-
</UiNavigationMenuList>
|
|
1893
|
-
</UiNavigationMenu>
|
|
1894
|
-
</div>
|
|
1895
|
-
</div>
|
|
1896
|
-
|
|
1897
|
-
<div class="accessible-theme flex flex-col gap-3">
|
|
1898
|
-
<h3 class="label-m-medium text-center text-content-on-surface-primary">
|
|
1899
|
-
Accessible
|
|
1900
|
-
</h3>
|
|
1901
|
-
<div class="flex min-h-20 items-center justify-start overflow-visible border border-border-surface-default p-6">
|
|
1902
|
-
<UiNavigationMenu aria-label="Main navigation">
|
|
1903
|
-
<UiNavigationMenuList>
|
|
1904
|
-
<UiNavigationMenuItem>
|
|
1905
|
-
<UiNavigationMenuTrigger>Menu Item</UiNavigationMenuTrigger>
|
|
1906
|
-
<UiNavigationMenuContent>
|
|
1907
|
-
<ul class="grid w-[200px]">
|
|
1908
|
-
<li><UiNavigationMenuLink href="#">Menu Item</UiNavigationMenuLink></li>
|
|
1909
|
-
</ul>
|
|
1910
|
-
</UiNavigationMenuContent>
|
|
1911
|
-
</UiNavigationMenuItem>
|
|
1912
|
-
<UiNavigationMenuItem>
|
|
1913
|
-
<UiNavigationMenuTrigger>Menu Item</UiNavigationMenuTrigger>
|
|
1914
|
-
<UiNavigationMenuContent>
|
|
1915
|
-
<ul class="grid w-[200px]">
|
|
1916
|
-
<li><UiNavigationMenuLink href="#">Menu Item</UiNavigationMenuLink></li>
|
|
1917
|
-
</ul>
|
|
1918
|
-
</UiNavigationMenuContent>
|
|
1919
|
-
</UiNavigationMenuItem>
|
|
1920
|
-
<UiNavigationMenuItem>
|
|
1921
|
-
<UiNavigationMenuLink href="#" :class="navigationMenuTriggerStyle()">Menu Item</UiNavigationMenuLink>
|
|
1922
|
-
</UiNavigationMenuItem>
|
|
1923
|
-
<UiNavigationMenuItem>
|
|
1924
|
-
<UiNavigationMenuLink href="#" :class="navigationMenuTriggerStyle()">Menu Item</UiNavigationMenuLink>
|
|
1925
|
-
</UiNavigationMenuItem>
|
|
1926
|
-
<UiNavigationMenuItem>
|
|
1927
|
-
<UiNavigationMenuLink href="#" :class="navigationMenuTriggerStyle()">Menu Item</UiNavigationMenuLink>
|
|
1928
|
-
</UiNavigationMenuItem>
|
|
1929
|
-
</UiNavigationMenuList>
|
|
1930
|
-
</UiNavigationMenu>
|
|
1931
|
-
</div>
|
|
1932
|
-
</div>
|
|
1933
|
-
</div>
|
|
1934
|
-
</section>
|
|
1935
|
-
`,
|
|
1936
|
-
}),
|
|
1937
|
-
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
---
|
|
2
|
+
figma: '29203:70948'
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
<!-- Synced from Figma by scripts/sync-figma-docs.mjs. Edit the copy in Figma: changes made here are overwritten. -->
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
The Popover component holds content beside the element that opened it and stays there until the user dismisses it. Because it is opened deliberately and persists, it can hold fields, controls and anything the user needs to work with.
|
|
10
|
+
|
|
11
|
+
Use it when the content needs interaction. Tooltip is for a short label, Hover Card is for a preview, and Dropdown Menu is for a list of actions.
|
|
12
|
+
|
|
13
|
+
### Opened on purpose, dismissed on purpose
|
|
14
|
+
|
|
15
|
+
A popover is a small workspace, not a hint:
|
|
16
|
+
|
|
17
|
+
- It opens on click, never on hover
|
|
18
|
+
- It stays until the user dismisses it or finishes the task
|
|
19
|
+
- It can hold fields, controls and text together
|
|
20
|
+
- The page behind it stays usable
|
|
21
|
+
|
|
22
|
+
### Anchored to its trigger
|
|
23
|
+
|
|
24
|
+
Position tells the user what the popover belongs to:
|
|
25
|
+
|
|
26
|
+
1. Opening next to the trigger, on the side with room
|
|
27
|
+
2. Never covering the trigger itself
|
|
28
|
+
3. Staying fully on screen, flipping side rather than clipping
|
|
29
|
+
4. Keeping the same side across a product wherever space allows
|
|
30
|
+
|
|
31
|
+
### Consistency
|
|
32
|
+
|
|
33
|
+
Every popover is built from the same parts:
|
|
34
|
+
|
|
35
|
+
- Popover surface, anchored to its trigger
|
|
36
|
+
- Content slot, holding fields, controls or text
|
|
37
|
+
- A dismissal route, always available
|
|
38
|
+
- One anchoring rule across a product
|
|
39
|
+
|
|
40
|
+
## Do
|
|
41
|
+
|
|
42
|
+
- Open on click, so the user has asked for it
|
|
43
|
+
- Anchor beside the trigger without covering it
|
|
44
|
+
- Keep the content to one small task
|
|
45
|
+
- Leave the page behind usable
|
|
46
|
+
- Flip to the other side rather than clipping off screen
|
|
47
|
+
- Give an explicit way to dismiss it
|
|
48
|
+
|
|
49
|
+
## Don't
|
|
50
|
+
|
|
51
|
+
- Open a popover on hover — use Hover Card
|
|
52
|
+
- Use a popover for a plain label — use Tooltip
|
|
53
|
+
- Put a list of actions in a popover — use Dropdown Menu
|
|
54
|
+
- Cover the trigger with the popover
|
|
55
|
+
- Nest a popover inside another popover
|
|
56
|
+
- Put a task large enough for a dialog in a popover
|
|
57
|
+
|
|
58
|
+
## Accessibility
|
|
59
|
+
|
|
60
|
+
- The popover separates from the page by surface and elevation, not by shadow alone
|
|
61
|
+
- It opens on an explicit action, so nothing depends on hover
|
|
62
|
+
- The trigger keeps a visible focus state, and the popover's own controls each keep theirs
|
|
63
|
+
- The popover does not cover its trigger, so the user keeps their reference point
|
|
64
|
+
- Content and fields hold their contrast against the popover's own surface
|
|
65
|
+
- A dismissal control is visible, not only implied by clicking outside
|
|
@@ -3,6 +3,16 @@ import { expect, fn, userEvent, waitFor, within } from 'storybook/test';
|
|
|
3
3
|
import { UiPopover, UiPopoverTrigger, UiPopoverContent } from '.';
|
|
4
4
|
import { UiButton } from '../UiButton';
|
|
5
5
|
import { ref, watch } from 'vue';
|
|
6
|
+
import {
|
|
7
|
+
accessibilityRequirementsTemplate,
|
|
8
|
+
designNotesStory,
|
|
9
|
+
guidanceLinks,
|
|
10
|
+
guidanceSectionClass,
|
|
11
|
+
parseGuidance,
|
|
12
|
+
} from '../../../.storybook/guidance';
|
|
13
|
+
import guidanceMarkdown from './UiPopover.guidance.md?raw';
|
|
14
|
+
|
|
15
|
+
const guidance = parseGuidance(guidanceMarkdown);
|
|
6
16
|
|
|
7
17
|
/**
|
|
8
18
|
* UiPopover is a floating container anchored to a trigger element, used to surface secondary content without leaving the current context.
|
|
@@ -26,6 +36,9 @@ const meta: Meta<typeof UiPopover> = {
|
|
|
26
36
|
open: false,
|
|
27
37
|
modal: false,
|
|
28
38
|
},
|
|
39
|
+
parameters: {
|
|
40
|
+
docs: { links: guidanceLinks(guidance) },
|
|
41
|
+
},
|
|
29
42
|
};
|
|
30
43
|
|
|
31
44
|
export default meta;
|
|
@@ -118,6 +131,108 @@ export const Default: Story = {
|
|
|
118
131
|
},
|
|
119
132
|
};
|
|
120
133
|
|
|
134
|
+
/**
|
|
135
|
+
* Usage, guidelines, and do's and don'ts from the Figma documentation.
|
|
136
|
+
*/
|
|
137
|
+
export const DesignNotes: Story = {
|
|
138
|
+
...designNotesStory(guidance),
|
|
139
|
+
tags: ['!autodocs'],
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Accessibility guidance for labelled triggers, popover naming, and contrast.
|
|
144
|
+
*/
|
|
145
|
+
export const Accessibility: Story = {
|
|
146
|
+
render: () => ({
|
|
147
|
+
components: { UiPopover, UiPopoverTrigger, UiPopoverContent, UiButton },
|
|
148
|
+
setup() {
|
|
149
|
+
const defaultOpen = ref(true);
|
|
150
|
+
const accessibleOpen = ref(true);
|
|
151
|
+
return { defaultOpen, accessibleOpen };
|
|
152
|
+
},
|
|
153
|
+
template: `
|
|
154
|
+
<section class="${guidanceSectionClass}">
|
|
155
|
+
<div>
|
|
156
|
+
<h2 class="heading-m font-bold text-content-on-surface-primary">
|
|
157
|
+
Accessibility
|
|
158
|
+
</h2>
|
|
159
|
+
</div>
|
|
160
|
+
|
|
161
|
+
${accessibilityRequirementsTemplate(guidance.accessibility, 'Requirements')}
|
|
162
|
+
|
|
163
|
+
<div class="flex flex-col gap-6">
|
|
164
|
+
<div class="flex flex-col gap-2">
|
|
165
|
+
<h3 class="body-m-medium text-content-on-surface-primary">
|
|
166
|
+
Enable accessibility theme
|
|
167
|
+
</h3>
|
|
168
|
+
<p class="body-m-regular text-content-on-surface-primary">
|
|
169
|
+
When accessibility is required, enable our accessibility theme. This
|
|
170
|
+
increases contrast and ensures there are no color contrast issues.
|
|
171
|
+
</p>
|
|
172
|
+
</div>
|
|
173
|
+
</div>
|
|
174
|
+
|
|
175
|
+
<div class="grid gap-4 md:grid-cols-2">
|
|
176
|
+
<div class="flex flex-col gap-3">
|
|
177
|
+
<h3 class="label-m-medium text-center text-content-on-surface-primary">
|
|
178
|
+
Default
|
|
179
|
+
</h3>
|
|
180
|
+
<div class="flex min-h-48 items-start justify-center border border-border-surface-default p-6">
|
|
181
|
+
<UiPopover v-model:open="defaultOpen">
|
|
182
|
+
<UiPopoverTrigger as-child>
|
|
183
|
+
<UiButton variant="outline">Open Popover</UiButton>
|
|
184
|
+
</UiPopoverTrigger>
|
|
185
|
+
<UiPopoverContent>
|
|
186
|
+
<div class="flex flex-col gap-2">
|
|
187
|
+
<h4 class="font-medium leading-none">Dimensions</h4>
|
|
188
|
+
<p class="body-s-regular text-content-on-surface-muted">
|
|
189
|
+
Set the dimensions for the layer.
|
|
190
|
+
</p>
|
|
191
|
+
</div>
|
|
192
|
+
</UiPopoverContent>
|
|
193
|
+
</UiPopover>
|
|
194
|
+
</div>
|
|
195
|
+
</div>
|
|
196
|
+
|
|
197
|
+
<div class="accessible-theme flex flex-col gap-3">
|
|
198
|
+
<h3 class="label-m-medium text-center text-content-on-surface-primary">
|
|
199
|
+
Accessible
|
|
200
|
+
</h3>
|
|
201
|
+
<div class="flex min-h-48 items-start justify-center border border-border-surface-default p-6">
|
|
202
|
+
<UiPopover v-model:open="accessibleOpen">
|
|
203
|
+
<UiPopoverTrigger as-child>
|
|
204
|
+
<UiButton variant="outline">Open Popover</UiButton>
|
|
205
|
+
</UiPopoverTrigger>
|
|
206
|
+
<UiPopoverContent>
|
|
207
|
+
<div class="flex flex-col gap-2">
|
|
208
|
+
<h4 class="font-medium leading-none">Dimensions</h4>
|
|
209
|
+
<p class="body-s-regular text-content-on-surface-muted">
|
|
210
|
+
Set the dimensions for the layer.
|
|
211
|
+
</p>
|
|
212
|
+
</div>
|
|
213
|
+
</UiPopoverContent>
|
|
214
|
+
</UiPopover>
|
|
215
|
+
</div>
|
|
216
|
+
</div>
|
|
217
|
+
</div>
|
|
218
|
+
</section>
|
|
219
|
+
`,
|
|
220
|
+
}),
|
|
221
|
+
tags: ['!autodocs'],
|
|
222
|
+
parameters: {
|
|
223
|
+
surface: 'primary',
|
|
224
|
+
a11y: { test: 'off' },
|
|
225
|
+
chromatic: {
|
|
226
|
+
disableSnapshot: true,
|
|
227
|
+
},
|
|
228
|
+
docs: {
|
|
229
|
+
canvas: {
|
|
230
|
+
sourceState: 'none',
|
|
231
|
+
},
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
};
|
|
235
|
+
|
|
121
236
|
const controlledTemplateSource = `<script setup lang="ts">
|
|
122
237
|
import { UiPopover, UiPopoverTrigger, UiPopoverContent, UiButton } from '@aleph-alpha/ui-library'
|
|
123
238
|
import { ref } from 'vue'
|
|
@@ -507,97 +622,6 @@ export const OpenByDefault: Story = {
|
|
|
507
622
|
},
|
|
508
623
|
};
|
|
509
624
|
|
|
510
|
-
/**
|
|
511
|
-
* Accessibility guidance for labelled triggers, popover naming, and contrast.
|
|
512
|
-
*/
|
|
513
|
-
export const Accessibility: Story = {
|
|
514
|
-
render: () => ({
|
|
515
|
-
components: { UiPopover, UiPopoverTrigger, UiPopoverContent, UiButton },
|
|
516
|
-
setup() {
|
|
517
|
-
const defaultOpen = ref(true);
|
|
518
|
-
const accessibleOpen = ref(true);
|
|
519
|
-
return { defaultOpen, accessibleOpen };
|
|
520
|
-
},
|
|
521
|
-
template: `
|
|
522
|
-
<section class="flex flex-col gap-6 p-4">
|
|
523
|
-
<div>
|
|
524
|
-
<h2 class="heading-m font-bold text-content-on-surface-primary">
|
|
525
|
-
Accessibility
|
|
526
|
-
</h2>
|
|
527
|
-
</div>
|
|
528
|
-
|
|
529
|
-
<div class="flex flex-col gap-6">
|
|
530
|
-
<div class="flex flex-col gap-2">
|
|
531
|
-
<h3 class="body-m-medium text-content-on-surface-primary">
|
|
532
|
-
Enable accessibility theme
|
|
533
|
-
</h3>
|
|
534
|
-
<p class="body-m-regular text-content-on-surface-primary">
|
|
535
|
-
When accessibility is required, enable our accessibility theme. This
|
|
536
|
-
increases contrast and ensures there are no color contrast issues.
|
|
537
|
-
</p>
|
|
538
|
-
</div>
|
|
539
|
-
</div>
|
|
540
|
-
|
|
541
|
-
<div class="grid gap-4 md:grid-cols-2">
|
|
542
|
-
<div class="flex flex-col gap-3">
|
|
543
|
-
<h3 class="label-m-medium text-center text-content-on-surface-primary">
|
|
544
|
-
Default
|
|
545
|
-
</h3>
|
|
546
|
-
<div class="flex min-h-48 items-start justify-center border border-border-surface-default p-6">
|
|
547
|
-
<UiPopover v-model:open="defaultOpen">
|
|
548
|
-
<UiPopoverTrigger as-child>
|
|
549
|
-
<UiButton variant="outline">Open Popover</UiButton>
|
|
550
|
-
</UiPopoverTrigger>
|
|
551
|
-
<UiPopoverContent>
|
|
552
|
-
<div class="flex flex-col gap-2">
|
|
553
|
-
<h4 class="font-medium leading-none">Dimensions</h4>
|
|
554
|
-
<p class="body-s-regular text-content-on-surface-muted">
|
|
555
|
-
Set the dimensions for the layer.
|
|
556
|
-
</p>
|
|
557
|
-
</div>
|
|
558
|
-
</UiPopoverContent>
|
|
559
|
-
</UiPopover>
|
|
560
|
-
</div>
|
|
561
|
-
</div>
|
|
562
|
-
|
|
563
|
-
<div class="accessible-theme flex flex-col gap-3">
|
|
564
|
-
<h3 class="label-m-medium text-center text-content-on-surface-primary">
|
|
565
|
-
Accessible
|
|
566
|
-
</h3>
|
|
567
|
-
<div class="flex min-h-48 items-start justify-center border border-border-surface-default p-6">
|
|
568
|
-
<UiPopover v-model:open="accessibleOpen">
|
|
569
|
-
<UiPopoverTrigger as-child>
|
|
570
|
-
<UiButton variant="outline">Open Popover</UiButton>
|
|
571
|
-
</UiPopoverTrigger>
|
|
572
|
-
<UiPopoverContent>
|
|
573
|
-
<div class="flex flex-col gap-2">
|
|
574
|
-
<h4 class="font-medium leading-none">Dimensions</h4>
|
|
575
|
-
<p class="body-s-regular text-content-on-surface-muted">
|
|
576
|
-
Set the dimensions for the layer.
|
|
577
|
-
</p>
|
|
578
|
-
</div>
|
|
579
|
-
</UiPopoverContent>
|
|
580
|
-
</UiPopover>
|
|
581
|
-
</div>
|
|
582
|
-
</div>
|
|
583
|
-
</div>
|
|
584
|
-
</section>
|
|
585
|
-
`,
|
|
586
|
-
}),
|
|
587
|
-
tags: ['!autodocs'],
|
|
588
|
-
parameters: {
|
|
589
|
-
a11y: { test: 'off' },
|
|
590
|
-
chromatic: {
|
|
591
|
-
disableSnapshot: true,
|
|
592
|
-
},
|
|
593
|
-
docs: {
|
|
594
|
-
canvas: {
|
|
595
|
-
sourceState: 'none',
|
|
596
|
-
},
|
|
597
|
-
},
|
|
598
|
-
},
|
|
599
|
-
};
|
|
600
|
-
|
|
601
625
|
/*
|
|
602
626
|
* ─────────────────────────────────────────────────────────────────────────────
|
|
603
627
|
* Interaction & accessibility tests (play functions)
|