@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
|
@@ -1,49 +1,106 @@
|
|
|
1
1
|
{
|
|
2
|
+
"components-uiaccordion--design-notes": "palette",
|
|
2
3
|
"components-uiaccordion--accessibility": "accessibility",
|
|
3
|
-
"components-
|
|
4
|
+
"components-uialert--design-notes": "palette",
|
|
5
|
+
"components-uialert--accessibility": "accessibility",
|
|
6
|
+
"components-uialertdialog--design-notes": "palette",
|
|
7
|
+
"components-uialertdialog--accessibility": "accessibility",
|
|
8
|
+
"components-uiautocomplete--design-notes": "palette",
|
|
9
|
+
"components-uiautocomplete--accessibility": "accessibility",
|
|
10
|
+
"components-uiavatar--design-notes": "palette",
|
|
11
|
+
"components-uiavatar--accessibility": "accessibility",
|
|
12
|
+
"components-uibadge--design-notes": "palette",
|
|
13
|
+
"components-uibadge--accessibility": "accessibility",
|
|
14
|
+
"components-uibreadcrumb--design-notes": "palette",
|
|
15
|
+
"components-uibreadcrumb--accessibility": "accessibility",
|
|
4
16
|
"components-uibutton--design-notes": "palette",
|
|
5
17
|
"components-uibutton--accessibility": "accessibility",
|
|
6
|
-
"components-
|
|
7
|
-
"components-uirangecalendar--accessibility": "accessibility",
|
|
8
|
-
"patterns-uidatepicker--accessibility": "accessibility",
|
|
18
|
+
"components-uibuttongroup--design-notes": "palette",
|
|
9
19
|
"components-uibuttongroup--accessibility": "accessibility",
|
|
20
|
+
"components-uicalendar--design-notes": "palette",
|
|
21
|
+
"components-uicalendar--accessibility": "accessibility",
|
|
22
|
+
"components-uicard--design-notes": "palette",
|
|
23
|
+
"components-uicard--accessibility": "accessibility",
|
|
10
24
|
"components-uicheckbox--design-notes": "palette",
|
|
11
25
|
"components-uicheckbox--accessibility": "accessibility",
|
|
26
|
+
"components-uichip--design-notes": "palette",
|
|
12
27
|
"components-uichip--accessibility": "accessibility",
|
|
13
|
-
"components-
|
|
28
|
+
"components-uidialog--design-notes": "palette",
|
|
14
29
|
"components-uidialog--accessibility": "accessibility",
|
|
30
|
+
"components-uidrawer--design-notes": "palette",
|
|
15
31
|
"components-uidrawer--accessibility": "accessibility",
|
|
16
|
-
"components-
|
|
32
|
+
"components-uidropdownmenu--design-notes": "palette",
|
|
17
33
|
"components-uidropdownmenu--accessibility": "accessibility",
|
|
18
|
-
"components-
|
|
19
|
-
"components-
|
|
34
|
+
"components-uiempty--design-notes": "palette",
|
|
35
|
+
"components-uiempty--accessibility": "accessibility",
|
|
20
36
|
"components-uifield--design-notes": "palette",
|
|
21
37
|
"components-uifield--accessibility": "accessibility",
|
|
38
|
+
"components-uifileuploadbox--accessibility": "accessibility",
|
|
39
|
+
"components-uiinput--design-notes": "palette",
|
|
40
|
+
"components-uiinput--accessibility": "accessibility",
|
|
41
|
+
"components-uiinputgroup--design-notes": "palette",
|
|
42
|
+
"components-uiinputgroup--accessibility": "accessibility",
|
|
22
43
|
"components-uiitem--design-notes": "palette",
|
|
23
44
|
"components-uiitem--accessibility": "accessibility",
|
|
45
|
+
"components-uikbd--design-notes": "palette",
|
|
46
|
+
"components-uikbd--accessibility": "accessibility",
|
|
47
|
+
"components-uilabel--design-notes": "palette",
|
|
24
48
|
"components-uilabel--accessibility": "accessibility",
|
|
25
|
-
"components-uiinput--design-notes": "palette",
|
|
26
|
-
"components-uiinput--accessibility": "accessibility",
|
|
27
|
-
"components-uitextarea--accessibility": "accessibility",
|
|
28
49
|
"components-uilistbox--accessibility": "accessibility",
|
|
50
|
+
"components-uinavigationmenu--design-notes": "palette",
|
|
51
|
+
"components-uinavigationmenu--accessibility": "accessibility",
|
|
52
|
+
"components-uipopover--design-notes": "palette",
|
|
53
|
+
"components-uipopover--accessibility": "accessibility",
|
|
54
|
+
"components-uiprogress--design-notes": "palette",
|
|
55
|
+
"components-uiprogress--accessibility": "accessibility",
|
|
56
|
+
"components-uiradiogroup--design-notes": "palette",
|
|
29
57
|
"components-uiradiogroup--accessibility": "accessibility",
|
|
58
|
+
"components-uirangecalendar--design-notes": "palette",
|
|
59
|
+
"components-uirangecalendar--accessibility": "accessibility",
|
|
60
|
+
"components-uiresizable--design-notes": "palette",
|
|
61
|
+
"components-uiresizable--accessibility": "accessibility",
|
|
62
|
+
"components-uiselect--design-notes": "palette",
|
|
30
63
|
"components-uiselect--accessibility": "accessibility",
|
|
64
|
+
"components-uiseparator--design-notes": "palette",
|
|
65
|
+
"components-uiseparator--accessibility": "accessibility",
|
|
66
|
+
"components-uisheet--design-notes": "palette",
|
|
31
67
|
"components-uisheet--accessibility": "accessibility",
|
|
32
|
-
"components-
|
|
68
|
+
"components-uiskeleton--design-notes": "palette",
|
|
69
|
+
"components-uiskeleton--accessibility": "accessibility",
|
|
70
|
+
"components-uislider--design-notes": "palette",
|
|
33
71
|
"components-uislider--accessibility": "accessibility",
|
|
72
|
+
"components-uisnackbar--design-notes": "palette",
|
|
73
|
+
"components-uisnackbar--accessibility": "accessibility",
|
|
74
|
+
"components-uispinner--design-notes": "palette",
|
|
75
|
+
"components-uispinner--accessibility": "accessibility",
|
|
76
|
+
"components-uistepper--design-notes": "palette",
|
|
34
77
|
"components-uistepper--accessibility": "accessibility",
|
|
78
|
+
"components-uiswitch--design-notes": "palette",
|
|
35
79
|
"components-uiswitch--accessibility": "accessibility",
|
|
80
|
+
"components-uitable--design-notes": "palette",
|
|
81
|
+
"components-uitable--accessibility": "accessibility",
|
|
82
|
+
"components-uitabs--design-notes": "palette",
|
|
83
|
+
"components-uitabs--accessibility": "accessibility",
|
|
36
84
|
"components-uitagsinput--accessibility": "accessibility",
|
|
85
|
+
"components-uitextarea--design-notes": "palette",
|
|
86
|
+
"components-uitextarea--accessibility": "accessibility",
|
|
87
|
+
"components-uitoggle--design-notes": "palette",
|
|
37
88
|
"components-uitoggle--accessibility": "accessibility",
|
|
89
|
+
"components-uitogglegroup--design-notes": "palette",
|
|
38
90
|
"components-uitogglegroup--accessibility": "accessibility",
|
|
39
|
-
"components-
|
|
40
|
-
"components-
|
|
41
|
-
"patterns-
|
|
42
|
-
"patterns-uilayout-content--accessibility": "accessibility",
|
|
91
|
+
"components-uitooltip--design-notes": "palette",
|
|
92
|
+
"components-uitooltip--accessibility": "accessibility",
|
|
93
|
+
"patterns-uidatatable--design-notes": "palette",
|
|
43
94
|
"patterns-uidatatable--accessibility": "accessibility",
|
|
44
|
-
"patterns-
|
|
95
|
+
"patterns-uidatepicker--design-notes": "palette",
|
|
96
|
+
"patterns-uidatepicker--accessibility": "accessibility",
|
|
45
97
|
"patterns-uifileupload-uifileitem--accessibility": "accessibility",
|
|
98
|
+
"patterns-uifileupload-uifileupload--design-notes": "palette",
|
|
46
99
|
"patterns-uifileupload-uifileupload--accessibility": "accessibility",
|
|
100
|
+
"patterns-uifloatactions--accessibility": "accessibility",
|
|
101
|
+
"patterns-uilayout-content--accessibility": "accessibility",
|
|
102
|
+
"patterns-uilayout-mobile--design-notes": "palette",
|
|
47
103
|
"patterns-uiprofilecard--accessibility": "accessibility",
|
|
104
|
+
"patterns-uitopbar--accessibility": "accessibility",
|
|
48
105
|
"css-utility-scrollbar--design-notes": "palette"
|
|
49
106
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aleph-alpha/ui-library",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.2",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/system/lib.js",
|
|
@@ -50,6 +50,8 @@
|
|
|
50
50
|
"chromatic": "Runs Chromatic visual regression against the Storybook build (requires CHROMATIC_PROJECT_TOKEN)",
|
|
51
51
|
"test:e2e": "Runs end-to-end integration tests with Playwright",
|
|
52
52
|
"tag-component": "Adds experimental/beta/deprecated lifecycle tags or removes them with stable for a component story and props JSDoc",
|
|
53
|
+
"sidebar-icons": "Regenerates public/story-sidebar-icons.json from the DesignNotes and Accessibility story exports",
|
|
54
|
+
"figma:sync-docs": "Syncs the *.guidance.md files listed in figma-guidance.json from Figma (needs FIGMA_TOKEN; --check to only report stale files)",
|
|
53
55
|
"report:scenarios-pdf": "Generates a PDF catalogue of the labelled step() test scenarios in every story, as a source of truth for ui-library",
|
|
54
56
|
"report:a11y-eval": "Generates a markdown accessibility evaluation report from stories and axe artefacts"
|
|
55
57
|
},
|
|
@@ -67,7 +69,8 @@
|
|
|
67
69
|
"@unocss/preset-wind3": "^66.5.10",
|
|
68
70
|
"@unocss/reset": "66.5.9",
|
|
69
71
|
"@unocss/vite": "^66.5.10",
|
|
70
|
-
"@vitest/browser": "
|
|
72
|
+
"@vitest/browser": "4.1.11",
|
|
73
|
+
"@vitest/browser-playwright": "4.1.11",
|
|
71
74
|
"chromatic": "16.5.0",
|
|
72
75
|
"concurrently": "9.2.1",
|
|
73
76
|
"eslint-plugin-jsdoc": "^61.0.0",
|
|
@@ -87,7 +90,7 @@
|
|
|
87
90
|
"vite-plugin-checker": "0.11.0",
|
|
88
91
|
"vite-plugin-css-injected-by-js": "^3.5.2",
|
|
89
92
|
"vite-plugin-dts": "^4.0.0",
|
|
90
|
-
"vitest": "^
|
|
93
|
+
"vitest": "^4.1.11",
|
|
91
94
|
"vue-router": "4.6.4",
|
|
92
95
|
"vue-tsc": "^2.2.12",
|
|
93
96
|
"wait-on": "9.0.3",
|
|
@@ -159,6 +162,8 @@
|
|
|
159
162
|
"chromatic": "npx chromatic --build-script-name=build-storybook --exit-zero-on-changes",
|
|
160
163
|
"test:e2e": "playwright test",
|
|
161
164
|
"tag-component": "node scripts/tag-component.mjs",
|
|
165
|
+
"sidebar-icons": "node scripts/generate-story-sidebar-icons.mjs",
|
|
166
|
+
"figma:sync-docs": "node scripts/sync-figma-docs.mjs",
|
|
162
167
|
"report:scenarios-pdf": "node scripts/storybook-scenarios-pdf.mjs",
|
|
163
168
|
"report:a11y-eval": "node scripts/storybook-a11y-eval-report.mjs",
|
|
164
169
|
"publish:local": "yalc publish && yalc push --sig"
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
figma: '28991:10214'
|
|
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 Accordion component collapses a set of related sections into a stack of headers, so a user can open the one they need and leave the rest closed. It shortens a long page without pushing content behind navigation.
|
|
10
|
+
|
|
11
|
+
Use it when the content divides cleanly into independent sections and most people need only a few of them. When users have to compare sections or read all of them, show the content directly instead.
|
|
12
|
+
|
|
13
|
+
### Scannable headers
|
|
14
|
+
|
|
15
|
+
The closed state is the whole interface, so the headers carry the work:
|
|
16
|
+
|
|
17
|
+
- Each trigger describes its content in a few plain words
|
|
18
|
+
- Headers stay parallel in wording and length, so the stack reads as one list
|
|
19
|
+
- Open and closed is obvious at a glance, not only on hover
|
|
20
|
+
- Nothing a user always needs lives inside a closed section
|
|
21
|
+
|
|
22
|
+
### One section at a time
|
|
23
|
+
|
|
24
|
+
Let the user open only what they came for:
|
|
25
|
+
|
|
26
|
+
1. Header states what the section contains
|
|
27
|
+
2. Opening reveals the content in place and pushes later items down
|
|
28
|
+
3. Sections above stay put, so the user keeps their place
|
|
29
|
+
4. Closing returns the stack to its scannable state
|
|
30
|
+
|
|
31
|
+
### Consistency
|
|
32
|
+
|
|
33
|
+
Every accordion is built from the same parts:
|
|
34
|
+
|
|
35
|
+
- Accordion container, holding two to eight items
|
|
36
|
+
- Accordion item, closed or open
|
|
37
|
+
- Trigger text, the header a user reads and clicks
|
|
38
|
+
- Content text, revealed when the item opens
|
|
39
|
+
- Item states: default, hover, focus and pressed
|
|
40
|
+
|
|
41
|
+
## Do
|
|
42
|
+
|
|
43
|
+
- Keep trigger text short, specific and parallel across items
|
|
44
|
+
- Show open and closed through the chevron and the header treatment together
|
|
45
|
+
- Order items the way users think about them, not alphabetically
|
|
46
|
+
- Open the most important item by default when there is an obvious starting point
|
|
47
|
+
- Keep each item short enough to read without losing sight of its header
|
|
48
|
+
- Give the whole header row a comfortable click target, not just the label
|
|
49
|
+
|
|
50
|
+
## Don't
|
|
51
|
+
|
|
52
|
+
- Hide content people always need behind a closed section
|
|
53
|
+
- Use an accordion for a single section — use Collapsible
|
|
54
|
+
- Nest an accordion inside another accordion
|
|
55
|
+
- Write headers as long sentences, or as questions that repeat each other
|
|
56
|
+
- Let more than eight items stack up without grouping them
|
|
57
|
+
- Rely on the chevron alone to show which item is open
|
|
58
|
+
|
|
59
|
+
## Accessibility
|
|
60
|
+
|
|
61
|
+
- Every header has a visible focus state that stands clear of the surface behind it
|
|
62
|
+
- Open and closed differ in shape and weight, never in colour alone
|
|
63
|
+
- Header text and chevron hold their contrast in all four states: default, hover, focus and pressed
|
|
64
|
+
- Header rows are a comfortable target for touch as well as pointer
|
|
65
|
+
- Reading order runs top to bottom, so open content sits directly beneath its own header
|
|
66
|
+
- Expand and collapse motion stays short and subtle, so the page does not jump under the reader
|
|
@@ -8,6 +8,16 @@ import {
|
|
|
8
8
|
UiAccordionContent,
|
|
9
9
|
} from './index';
|
|
10
10
|
import { UiButton } from '@/components/UiButton';
|
|
11
|
+
import {
|
|
12
|
+
accessibilityRequirementsTemplate,
|
|
13
|
+
designNotesStory,
|
|
14
|
+
guidanceLinks,
|
|
15
|
+
guidanceSectionClass,
|
|
16
|
+
parseGuidance,
|
|
17
|
+
} from '../../../.storybook/guidance';
|
|
18
|
+
import guidanceMarkdown from './UiAccordion.guidance.md?raw';
|
|
19
|
+
|
|
20
|
+
const guidance = parseGuidance(guidanceMarkdown);
|
|
11
21
|
|
|
12
22
|
/**
|
|
13
23
|
* UiAccordion is a vertically stacked set of collapsible sections that share a single visible region.
|
|
@@ -47,6 +57,9 @@ const meta: Meta<typeof UiAccordion> = {
|
|
|
47
57
|
disabled: false,
|
|
48
58
|
orientation: 'vertical',
|
|
49
59
|
},
|
|
60
|
+
parameters: {
|
|
61
|
+
docs: { links: guidanceLinks(guidance) },
|
|
62
|
+
},
|
|
50
63
|
};
|
|
51
64
|
|
|
52
65
|
export default meta;
|
|
@@ -241,6 +254,124 @@ export const Default: Story = {
|
|
|
241
254
|
},
|
|
242
255
|
};
|
|
243
256
|
|
|
257
|
+
/**
|
|
258
|
+
* Usage, guidelines, and do's and don'ts from the Figma documentation.
|
|
259
|
+
*/
|
|
260
|
+
export const DesignNotes: Story = {
|
|
261
|
+
...designNotesStory(guidance),
|
|
262
|
+
tags: ['!autodocs'],
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Accessibility guidance for accordions: visible focus states, state changes
|
|
267
|
+
* that survive without colour, contrast across all trigger states, comfortable
|
|
268
|
+
* touch targets, logical heading order, and subtle motion — shown side by side
|
|
269
|
+
* in the default and accessible themes.
|
|
270
|
+
*/
|
|
271
|
+
export const Accessibility: Story = {
|
|
272
|
+
tags: ['!autodocs'],
|
|
273
|
+
parameters: {
|
|
274
|
+
surface: 'primary',
|
|
275
|
+
a11y: { test: 'off' },
|
|
276
|
+
chromatic: { disableSnapshot: true },
|
|
277
|
+
docs: {
|
|
278
|
+
canvas: {
|
|
279
|
+
sourceState: 'none',
|
|
280
|
+
},
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
render: () => ({
|
|
284
|
+
components: {
|
|
285
|
+
UiAccordion,
|
|
286
|
+
UiAccordionItem,
|
|
287
|
+
UiAccordionTrigger,
|
|
288
|
+
UiAccordionContent,
|
|
289
|
+
},
|
|
290
|
+
template: `
|
|
291
|
+
<section class="${guidanceSectionClass}">
|
|
292
|
+
<div>
|
|
293
|
+
<h2 class="heading-m font-bold text-content-on-surface-primary">
|
|
294
|
+
Accessibility
|
|
295
|
+
</h2>
|
|
296
|
+
</div>
|
|
297
|
+
|
|
298
|
+
<div class="flex flex-col gap-6">
|
|
299
|
+
${accessibilityRequirementsTemplate(guidance.accessibility, 'Requirements')}
|
|
300
|
+
|
|
301
|
+
<div class="flex flex-col gap-2">
|
|
302
|
+
<h3 class="body-m-medium text-content-on-surface-primary">
|
|
303
|
+
Enable accessibility theme
|
|
304
|
+
</h3>
|
|
305
|
+
<p class="body-m-regular text-content-on-surface-primary">
|
|
306
|
+
When accessibility is required, enable our accessibility theme.
|
|
307
|
+
This increases contrast and ensures there are no color contrast
|
|
308
|
+
issues.
|
|
309
|
+
</p>
|
|
310
|
+
</div>
|
|
311
|
+
</div>
|
|
312
|
+
|
|
313
|
+
<div class="grid gap-4 md:grid-cols-2">
|
|
314
|
+
<div class="flex flex-col gap-3">
|
|
315
|
+
<h3 class="label-m-medium text-center text-content-on-surface-primary">
|
|
316
|
+
Default
|
|
317
|
+
</h3>
|
|
318
|
+
<div class="flex min-h-20 items-center justify-center border border-border-surface-default p-6">
|
|
319
|
+
<UiAccordion type="single" collapsible class="w-full">
|
|
320
|
+
<UiAccordionItem value="item-1">
|
|
321
|
+
<UiAccordionTrigger>Trigger Text</UiAccordionTrigger>
|
|
322
|
+
<UiAccordionContent>
|
|
323
|
+
<p>Section content.</p>
|
|
324
|
+
</UiAccordionContent>
|
|
325
|
+
</UiAccordionItem>
|
|
326
|
+
<UiAccordionItem value="item-2">
|
|
327
|
+
<UiAccordionTrigger>Trigger Text</UiAccordionTrigger>
|
|
328
|
+
<UiAccordionContent>
|
|
329
|
+
<p>Section content.</p>
|
|
330
|
+
</UiAccordionContent>
|
|
331
|
+
</UiAccordionItem>
|
|
332
|
+
<UiAccordionItem value="item-3">
|
|
333
|
+
<UiAccordionTrigger>Trigger Text</UiAccordionTrigger>
|
|
334
|
+
<UiAccordionContent>
|
|
335
|
+
<p>Section content.</p>
|
|
336
|
+
</UiAccordionContent>
|
|
337
|
+
</UiAccordionItem>
|
|
338
|
+
</UiAccordion>
|
|
339
|
+
</div>
|
|
340
|
+
</div>
|
|
341
|
+
|
|
342
|
+
<div class="accessible-theme flex flex-col gap-3">
|
|
343
|
+
<h3 class="label-m-medium text-center text-content-on-surface-primary">
|
|
344
|
+
Accessible
|
|
345
|
+
</h3>
|
|
346
|
+
<div class="flex min-h-20 items-center justify-center border border-border-surface-default p-6">
|
|
347
|
+
<UiAccordion type="single" collapsible class="w-full">
|
|
348
|
+
<UiAccordionItem value="item-1">
|
|
349
|
+
<UiAccordionTrigger>Trigger Text</UiAccordionTrigger>
|
|
350
|
+
<UiAccordionContent>
|
|
351
|
+
<p>Section content.</p>
|
|
352
|
+
</UiAccordionContent>
|
|
353
|
+
</UiAccordionItem>
|
|
354
|
+
<UiAccordionItem value="item-2">
|
|
355
|
+
<UiAccordionTrigger>Trigger Text</UiAccordionTrigger>
|
|
356
|
+
<UiAccordionContent>
|
|
357
|
+
<p>Section content.</p>
|
|
358
|
+
</UiAccordionContent>
|
|
359
|
+
</UiAccordionItem>
|
|
360
|
+
<UiAccordionItem value="item-3">
|
|
361
|
+
<UiAccordionTrigger>Trigger Text</UiAccordionTrigger>
|
|
362
|
+
<UiAccordionContent>
|
|
363
|
+
<p>Section content.</p>
|
|
364
|
+
</UiAccordionContent>
|
|
365
|
+
</UiAccordionItem>
|
|
366
|
+
</UiAccordion>
|
|
367
|
+
</div>
|
|
368
|
+
</div>
|
|
369
|
+
</div>
|
|
370
|
+
</section>
|
|
371
|
+
`,
|
|
372
|
+
}),
|
|
373
|
+
};
|
|
374
|
+
|
|
244
375
|
const multipleTemplateSource = `<script setup lang="ts">
|
|
245
376
|
import { ref } from 'vue'
|
|
246
377
|
import {
|
|
@@ -1013,145 +1144,6 @@ export const Controlled: Story = {
|
|
|
1013
1144
|
},
|
|
1014
1145
|
};
|
|
1015
1146
|
|
|
1016
|
-
/**
|
|
1017
|
-
* Accessibility guidance for accordions: visible focus states, state changes
|
|
1018
|
-
* that survive without colour, contrast across all trigger states, comfortable
|
|
1019
|
-
* touch targets, logical heading order, and subtle motion — shown side by side
|
|
1020
|
-
* in the default and accessible themes.
|
|
1021
|
-
*/
|
|
1022
|
-
export const Accessibility: Story = {
|
|
1023
|
-
tags: ['!autodocs'],
|
|
1024
|
-
parameters: {
|
|
1025
|
-
a11y: { test: 'off' },
|
|
1026
|
-
chromatic: { disableSnapshot: true },
|
|
1027
|
-
docs: {
|
|
1028
|
-
canvas: {
|
|
1029
|
-
sourceState: 'none',
|
|
1030
|
-
},
|
|
1031
|
-
},
|
|
1032
|
-
},
|
|
1033
|
-
render: () => ({
|
|
1034
|
-
components: {
|
|
1035
|
-
UiAccordion,
|
|
1036
|
-
UiAccordionItem,
|
|
1037
|
-
UiAccordionTrigger,
|
|
1038
|
-
UiAccordionContent,
|
|
1039
|
-
},
|
|
1040
|
-
template: `
|
|
1041
|
-
<section class="flex flex-col gap-6 p-4">
|
|
1042
|
-
<div>
|
|
1043
|
-
<h2 class="heading-m font-bold text-content-on-surface-primary">
|
|
1044
|
-
Accessibility
|
|
1045
|
-
</h2>
|
|
1046
|
-
</div>
|
|
1047
|
-
|
|
1048
|
-
<div class="flex flex-col gap-6">
|
|
1049
|
-
<div class="flex flex-col gap-2">
|
|
1050
|
-
<h3 class="body-m-medium text-content-on-surface-primary">
|
|
1051
|
-
Requirements
|
|
1052
|
-
</h3>
|
|
1053
|
-
<ul class="body-m-regular flex list-disc flex-col gap-1 pl-6 text-content-on-surface-primary">
|
|
1054
|
-
<li>
|
|
1055
|
-
Every header has a visible focus state that stands clear of the
|
|
1056
|
-
surface behind it
|
|
1057
|
-
</li>
|
|
1058
|
-
<li>
|
|
1059
|
-
Open and closed differ in shape and weight, never in colour
|
|
1060
|
-
alone
|
|
1061
|
-
</li>
|
|
1062
|
-
<li>
|
|
1063
|
-
Header text and chevron hold their contrast in all four states:
|
|
1064
|
-
default, hover, focus and pressed
|
|
1065
|
-
</li>
|
|
1066
|
-
<li>
|
|
1067
|
-
Header rows are a comfortable target for touch as well as
|
|
1068
|
-
pointer
|
|
1069
|
-
</li>
|
|
1070
|
-
<li>
|
|
1071
|
-
Heading order runs top to bottom, so open content sits directly
|
|
1072
|
-
beneath its own header
|
|
1073
|
-
</li>
|
|
1074
|
-
<li>
|
|
1075
|
-
Expand and collapse motion stays short and subtle, so the page
|
|
1076
|
-
does not jump under the reader
|
|
1077
|
-
</li>
|
|
1078
|
-
</ul>
|
|
1079
|
-
</div>
|
|
1080
|
-
|
|
1081
|
-
<div class="flex flex-col gap-2">
|
|
1082
|
-
<h3 class="body-m-medium text-content-on-surface-primary">
|
|
1083
|
-
Enable accessibility theme
|
|
1084
|
-
</h3>
|
|
1085
|
-
<p class="body-m-regular text-content-on-surface-primary">
|
|
1086
|
-
When accessibility is required, enable our accessibility theme.
|
|
1087
|
-
This increases contrast and ensures there are no color contrast
|
|
1088
|
-
issues.
|
|
1089
|
-
</p>
|
|
1090
|
-
</div>
|
|
1091
|
-
</div>
|
|
1092
|
-
|
|
1093
|
-
<div class="grid gap-4 md:grid-cols-2">
|
|
1094
|
-
<div class="flex flex-col gap-3">
|
|
1095
|
-
<h3 class="label-m-medium text-center text-content-on-surface-primary">
|
|
1096
|
-
Default
|
|
1097
|
-
</h3>
|
|
1098
|
-
<div class="flex min-h-20 items-center justify-center border border-border-surface-default p-6">
|
|
1099
|
-
<UiAccordion type="single" collapsible class="w-full">
|
|
1100
|
-
<UiAccordionItem value="item-1">
|
|
1101
|
-
<UiAccordionTrigger>Trigger Text</UiAccordionTrigger>
|
|
1102
|
-
<UiAccordionContent>
|
|
1103
|
-
<p>Section content.</p>
|
|
1104
|
-
</UiAccordionContent>
|
|
1105
|
-
</UiAccordionItem>
|
|
1106
|
-
<UiAccordionItem value="item-2">
|
|
1107
|
-
<UiAccordionTrigger>Trigger Text</UiAccordionTrigger>
|
|
1108
|
-
<UiAccordionContent>
|
|
1109
|
-
<p>Section content.</p>
|
|
1110
|
-
</UiAccordionContent>
|
|
1111
|
-
</UiAccordionItem>
|
|
1112
|
-
<UiAccordionItem value="item-3">
|
|
1113
|
-
<UiAccordionTrigger>Trigger Text</UiAccordionTrigger>
|
|
1114
|
-
<UiAccordionContent>
|
|
1115
|
-
<p>Section content.</p>
|
|
1116
|
-
</UiAccordionContent>
|
|
1117
|
-
</UiAccordionItem>
|
|
1118
|
-
</UiAccordion>
|
|
1119
|
-
</div>
|
|
1120
|
-
</div>
|
|
1121
|
-
|
|
1122
|
-
<div class="accessible-theme flex flex-col gap-3">
|
|
1123
|
-
<h3 class="label-m-medium text-center text-content-on-surface-primary">
|
|
1124
|
-
Accessible
|
|
1125
|
-
</h3>
|
|
1126
|
-
<div class="flex min-h-20 items-center justify-center border border-border-surface-default p-6">
|
|
1127
|
-
<UiAccordion type="single" collapsible class="w-full">
|
|
1128
|
-
<UiAccordionItem value="item-1">
|
|
1129
|
-
<UiAccordionTrigger>Trigger Text</UiAccordionTrigger>
|
|
1130
|
-
<UiAccordionContent>
|
|
1131
|
-
<p>Section content.</p>
|
|
1132
|
-
</UiAccordionContent>
|
|
1133
|
-
</UiAccordionItem>
|
|
1134
|
-
<UiAccordionItem value="item-2">
|
|
1135
|
-
<UiAccordionTrigger>Trigger Text</UiAccordionTrigger>
|
|
1136
|
-
<UiAccordionContent>
|
|
1137
|
-
<p>Section content.</p>
|
|
1138
|
-
</UiAccordionContent>
|
|
1139
|
-
</UiAccordionItem>
|
|
1140
|
-
<UiAccordionItem value="item-3">
|
|
1141
|
-
<UiAccordionTrigger>Trigger Text</UiAccordionTrigger>
|
|
1142
|
-
<UiAccordionContent>
|
|
1143
|
-
<p>Section content.</p>
|
|
1144
|
-
</UiAccordionContent>
|
|
1145
|
-
</UiAccordionItem>
|
|
1146
|
-
</UiAccordion>
|
|
1147
|
-
</div>
|
|
1148
|
-
</div>
|
|
1149
|
-
</div>
|
|
1150
|
-
</section>
|
|
1151
|
-
`,
|
|
1152
|
-
}),
|
|
1153
|
-
};
|
|
1154
|
-
|
|
1155
1147
|
// Test-only stories drive the test-runner (interactive/a11y checks) but are
|
|
1156
1148
|
// hidden from the Storybook sidebar and docs via the `!dev` / `!autodocs`
|
|
1157
1149
|
// tags. They keep the implicit `test` tag, so they still run in CI and appear
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
figma: '29184:211'
|
|
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 Alert component carries a short message about the state of the current view — a result, a warning, a condition worth noticing. It sits in the layout rather than over it, so the user reads it in place and keeps working.
|
|
10
|
+
|
|
11
|
+
Use it for status that belongs to the page. Use Snackbar for the outcome of an action that has already finished, and Alert Dialog when the user has to answer before continuing.
|
|
12
|
+
|
|
13
|
+
### One message, one job
|
|
14
|
+
|
|
15
|
+
An alert earns its space by being specific:
|
|
16
|
+
|
|
17
|
+
- The title names the condition in a few words
|
|
18
|
+
- The description says what it means, or what to do next
|
|
19
|
+
- Destructive is reserved for something that has failed or is at risk
|
|
20
|
+
- One alert per condition, placed next to what it refers to
|
|
21
|
+
|
|
22
|
+
### Build up only what is needed
|
|
23
|
+
|
|
24
|
+
Every part is optional, so add them in order of usefulness:
|
|
25
|
+
|
|
26
|
+
1. Description alone, for a plain statement
|
|
27
|
+
2. Icon added, when the kind of message should register before it is read
|
|
28
|
+
3. Title added, when the condition needs naming
|
|
29
|
+
4. Action added, when the user can do something about it
|
|
30
|
+
|
|
31
|
+
### Consistency
|
|
32
|
+
|
|
33
|
+
Every alert is built from the same parts:
|
|
34
|
+
|
|
35
|
+
- Alert surface, default or destructive
|
|
36
|
+
- Icon, signalling the kind of message
|
|
37
|
+
- Title, naming the condition
|
|
38
|
+
- Description, explaining it
|
|
39
|
+
- Action, when a response is possible
|
|
40
|
+
|
|
41
|
+
## Do
|
|
42
|
+
|
|
43
|
+
- Put the alert next to the content it describes
|
|
44
|
+
- Keep the title to a few words and the description to a sentence or two
|
|
45
|
+
- Reserve destructive for failure and risk, so it keeps its weight
|
|
46
|
+
- Include an icon when the kind of message matters at a glance
|
|
47
|
+
- Offer an action only when the user can actually resolve the condition
|
|
48
|
+
- Let a long title wrap rather than truncate
|
|
49
|
+
|
|
50
|
+
## Don't
|
|
51
|
+
|
|
52
|
+
- Stack several alerts to cover one condition
|
|
53
|
+
- Use destructive for ordinary information
|
|
54
|
+
- Rely on colour alone to separate a warning from a success
|
|
55
|
+
- Place an alert far from what it refers to
|
|
56
|
+
- Use an alert where the user must answer before continuing — use Alert Dialog
|
|
57
|
+
- Write a description that only repeats the title
|
|
58
|
+
|
|
59
|
+
## Accessibility
|
|
60
|
+
|
|
61
|
+
- Every alert reads as one without colour: icon, title and wording carry the meaning
|
|
62
|
+
- Destructive and default alerts differ in more than hue, so the distinction survives in greyscale
|
|
63
|
+
- Text holds its contrast against the alert's own surface, not just the page behind it
|
|
64
|
+
- Titles and descriptions stay legible when they wrap to several lines
|
|
65
|
+
- An alert's action is a comfortable target and keeps a visible focus state
|
|
66
|
+
- The alert sits in reading order directly beside the content it describes
|