@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.
Files changed (115) hide show
  1. package/dist/system/icons/story-sidebar-icons.json +74 -17
  2. package/dist/system/lib.js +8 -5
  3. package/dist/system/patterns/UiPlaceholder/types.d.ts +1 -0
  4. package/dist/system/story-sidebar-icons.json +74 -17
  5. package/package.json +8 -3
  6. package/src/components/UiAccordion/UiAccordion.guidance.md +66 -0
  7. package/src/components/UiAccordion/UiAccordion.stories.ts +131 -139
  8. package/src/components/UiAlert/UiAlert.guidance.md +66 -0
  9. package/src/components/UiAlert/UiAlert.stories.ts +167 -143
  10. package/src/components/UiAlertDialog/UiAlertDialog.guidance.md +66 -0
  11. package/src/components/UiAlertDialog/UiAlertDialog.stories.ts +136 -112
  12. package/src/components/UiAutocomplete/UiAutocomplete.guidance.md +66 -0
  13. package/src/components/UiAutocomplete/UiAutocomplete.stories.ts +123 -99
  14. package/src/components/UiAvatar/UiAvatar.guidance.md +63 -0
  15. package/src/components/UiAvatar/UiAvatar.stories.ts +340 -0
  16. package/src/components/UiAvatar/UiAvatarImage.vue +5 -1
  17. package/src/components/UiAvatar/__tests__/UiAvatar.test.ts +14 -0
  18. package/src/components/UiBadge/UiBadge.guidance.md +65 -0
  19. package/src/components/UiBadge/UiBadge.stories.ts +325 -0
  20. package/src/components/UiBreadcrumb/UiBreadcrumb.guidance.md +67 -0
  21. package/src/components/UiBreadcrumb/UiBreadcrumb.stories.ts +165 -141
  22. package/src/components/UiButton/UiButton.stories.ts +5 -2
  23. package/src/components/UiButtonGroup/UiButtonGroup.guidance.md +63 -0
  24. package/src/components/UiButtonGroup/UiButtonGroup.stories.ts +91 -67
  25. package/src/components/UiCalendar/UiCalendar.guidance.md +65 -0
  26. package/src/components/UiCalendar/UiCalendar.stories.ts +103 -110
  27. package/src/components/UiCard/UiCard.guidance.md +65 -0
  28. package/src/components/UiCard/UiCard.stories.ts +393 -0
  29. package/src/components/UiCheckbox/UiCheckbox.guidance.md +62 -0
  30. package/src/components/UiCheckbox/UiCheckbox.stories.ts +18 -56
  31. package/src/components/UiChip/UiChip.guidance.md +64 -0
  32. package/src/components/UiChip/UiChip.stories.ts +162 -138
  33. package/src/components/UiCodeBlock/UiCodeBlock.stories.ts +291 -0
  34. package/src/components/UiCodeBlock/UiCodeBlock.vue +2 -1
  35. package/src/components/UiCodeBlock/__tests__/UiCodeBlock.test.ts +18 -0
  36. package/src/components/UiDialog/UiDialog.guidance.md +66 -0
  37. package/src/components/UiDialog/UiDialog.stories.ts +90 -66
  38. package/src/components/UiDrawer/UiDrawer.guidance.md +66 -0
  39. package/src/components/UiDrawer/UiDrawer.stories.ts +186 -162
  40. package/src/components/UiDropdownMenu/UiDropdownMenu.guidance.md +68 -0
  41. package/src/components/UiDropdownMenu/UiDropdownMenu.stories.ts +127 -86
  42. package/src/components/UiEmpty/UiEmpty.guidance.md +66 -0
  43. package/src/components/UiEmpty/UiEmpty.stories.ts +370 -15
  44. package/src/components/UiFadeMask/UiFadeMask.stories.ts +66 -0
  45. package/src/components/UiField/UiField.guidance.md +63 -0
  46. package/src/components/UiField/UiField.stories.ts +90 -113
  47. package/src/components/UiFileType/UiFileType.stories.ts +254 -0
  48. package/src/components/UiFileUploadBox/UiFileUploadBox.stories.ts +74 -72
  49. package/src/components/UiIcon/UiIcon.stories.ts +256 -1
  50. package/src/components/UiInput/UiInput.guidance.md +64 -0
  51. package/src/components/UiInput/UiInput.stories.ts +132 -80
  52. package/src/components/UiInputGroup/UiInputGroup.guidance.md +66 -0
  53. package/src/components/UiInputGroup/UiInputGroup.stories.ts +127 -103
  54. package/src/components/UiItem/UiItem.guidance.md +66 -0
  55. package/src/components/UiItem/UiItem.stories.ts +81 -28
  56. package/src/components/UiKbd/UiKbd.guidance.md +65 -0
  57. package/src/components/UiKbd/UiKbd.stories.ts +373 -3
  58. package/src/components/UiLabel/UiLabel.guidance.md +65 -0
  59. package/src/components/UiLabel/UiLabel.stories.ts +163 -139
  60. package/src/components/UiListbox/UiListbox.stories.ts +197 -195
  61. package/src/components/UiNavigationMenu/UiNavigationMenu.guidance.md +66 -0
  62. package/src/components/UiNavigationMenu/UiNavigationMenu.stories.ts +169 -169
  63. package/src/components/UiPopover/UiPopover.guidance.md +65 -0
  64. package/src/components/UiPopover/UiPopover.stories.ts +115 -91
  65. package/src/components/UiProgress/UiProgress.guidance.md +65 -0
  66. package/src/components/UiProgress/UiProgress.stories.ts +300 -0
  67. package/src/components/UiRadioGroup/UiRadioGroup.guidance.md +66 -0
  68. package/src/components/UiRadioGroup/UiRadioGroup.stories.ts +163 -139
  69. package/src/components/UiRangeCalendar/UiRangeCalendar.stories.ts +128 -127
  70. package/src/components/UiResizable/UiResizable.guidance.md +65 -0
  71. package/src/components/UiResizable/UiResizable.stories.ts +176 -152
  72. package/src/components/UiSelect/UiSelect.guidance.md +66 -0
  73. package/src/components/UiSelect/UiSelect.stories.ts +150 -126
  74. package/src/components/UiSeparator/UiSeparator.guidance.md +64 -0
  75. package/src/components/UiSeparator/UiSeparator.stories.ts +350 -0
  76. package/src/components/UiSheet/UiSheet.guidance.md +66 -0
  77. package/src/components/UiSheet/UiSheet.stories.ts +194 -170
  78. package/src/components/UiSkeleton/UiSkeleton.guidance.md +65 -0
  79. package/src/components/UiSkeleton/UiSkeleton.stories.ts +253 -0
  80. package/src/components/UiSlider/UiSlider.guidance.md +66 -0
  81. package/src/components/UiSlider/UiSlider.stories.ts +150 -126
  82. package/src/components/UiSnackbar/UiSnackbar.guidance.md +66 -0
  83. package/src/components/UiSnackbar/UiSnackbar.stories.ts +106 -96
  84. package/src/components/UiSpinner/UiSpinner.guidance.md +65 -0
  85. package/src/components/UiSpinner/UiSpinner.stories.ts +249 -0
  86. package/src/components/UiStepper/UiStepper.guidance.md +66 -0
  87. package/src/components/UiStepper/UiStepper.stories.ts +142 -124
  88. package/src/components/UiSwitch/UiSwitch.guidance.md +66 -0
  89. package/src/components/UiSwitch/UiSwitch.stories.ts +170 -146
  90. package/src/components/UiTable/UiTable.guidance.md +66 -0
  91. package/src/components/UiTable/UiTable.stories.ts +530 -12
  92. package/src/components/UiTabs/UiTabs.guidance.md +66 -0
  93. package/src/components/UiTabs/UiTabs.stories.ts +174 -150
  94. package/src/components/UiTagsInput/UiTagsInput.stories.ts +154 -152
  95. package/src/components/UiTextarea/UiTextarea.guidance.md +66 -0
  96. package/src/components/UiTextarea/UiTextarea.stories.ts +86 -62
  97. package/src/components/UiToggle/UiToggle.guidance.md +66 -0
  98. package/src/components/UiToggle/UiToggle.stories.ts +183 -159
  99. package/src/components/UiToggleGroup/UiToggleGroup.guidance.md +64 -0
  100. package/src/components/UiToggleGroup/UiToggleGroup.stories.ts +222 -200
  101. package/src/components/UiTooltip/UiTooltip.guidance.md +66 -0
  102. package/src/components/UiTooltip/UiTooltip.stories.ts +90 -66
  103. package/src/patterns/UiDataTable/UiDataTable.guidance.md +66 -0
  104. package/src/patterns/UiDataTable/UiDataTable.stories.ts +177 -155
  105. package/src/patterns/UiDatePicker/UiDatePicker.guidance.md +66 -0
  106. package/src/patterns/UiDatePicker/UiDatePicker.stories.ts +136 -112
  107. package/src/patterns/UiFileUpload/UiFileItem.stories.ts +77 -75
  108. package/src/patterns/UiFileUpload/UiFileUpload.guidance.md +68 -0
  109. package/src/patterns/UiFileUpload/UiFileUpload.stories.ts +169 -145
  110. package/src/patterns/UiFloatActions/UiFloatActions.stories.ts +103 -101
  111. package/src/patterns/UiLayout/UiLayoutContent.stories.ts +14 -13
  112. package/src/patterns/UiLayout/UiLayoutMobile.stories.ts +65 -65
  113. package/src/patterns/UiPlaceholder/types.ts +1 -0
  114. package/src/patterns/UiProfileCard/UiProfileCard.stories.ts +74 -72
  115. package/src/patterns/UiTopBar/UiTopBar.stories.ts +84 -82
@@ -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