@aleph-alpha/ui-library 7.0.1 → 7.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/dist/system/components/UiSlider/step-marks.d.ts +45 -0
  2. package/dist/system/components/UiSlider/types.d.ts +28 -0
  3. package/dist/system/components/core/slider/Slider.vue.d.ts +21 -1
  4. package/dist/system/icons/story-sidebar-icons.json +74 -17
  5. package/dist/system/lib.js +2026 -1912
  6. package/dist/system/patterns/UiPlaceholder/types.d.ts +1 -0
  7. package/dist/system/story-sidebar-icons.json +74 -17
  8. package/package.json +15 -10
  9. package/src/components/UiAccordion/UiAccordion.guidance.md +66 -0
  10. package/src/components/UiAccordion/UiAccordion.stories.ts +131 -139
  11. package/src/components/UiAlert/UiAlert.guidance.md +66 -0
  12. package/src/components/UiAlert/UiAlert.stories.ts +167 -143
  13. package/src/components/UiAlertDialog/UiAlertDialog.guidance.md +66 -0
  14. package/src/components/UiAlertDialog/UiAlertDialog.stories.ts +136 -112
  15. package/src/components/UiAutocomplete/UiAutocomplete.guidance.md +66 -0
  16. package/src/components/UiAutocomplete/UiAutocomplete.stories.ts +123 -99
  17. package/src/components/UiAvatar/UiAvatar.guidance.md +63 -0
  18. package/src/components/UiAvatar/UiAvatar.stories.ts +340 -0
  19. package/src/components/UiAvatar/UiAvatarImage.vue +5 -1
  20. package/src/components/UiAvatar/__tests__/UiAvatar.test.ts +14 -0
  21. package/src/components/UiBadge/UiBadge.guidance.md +65 -0
  22. package/src/components/UiBadge/UiBadge.stories.ts +325 -0
  23. package/src/components/UiBreadcrumb/UiBreadcrumb.guidance.md +67 -0
  24. package/src/components/UiBreadcrumb/UiBreadcrumb.stories.ts +165 -141
  25. package/src/components/UiButton/UiButton.stories.ts +5 -2
  26. package/src/components/UiButtonGroup/UiButtonGroup.guidance.md +63 -0
  27. package/src/components/UiButtonGroup/UiButtonGroup.stories.ts +91 -67
  28. package/src/components/UiCalendar/UiCalendar.guidance.md +65 -0
  29. package/src/components/UiCalendar/UiCalendar.stories.ts +103 -110
  30. package/src/components/UiCard/UiCard.guidance.md +65 -0
  31. package/src/components/UiCard/UiCard.stories.ts +393 -0
  32. package/src/components/UiCheckbox/UiCheckbox.guidance.md +62 -0
  33. package/src/components/UiCheckbox/UiCheckbox.stories.ts +18 -56
  34. package/src/components/UiChip/UiChip.guidance.md +64 -0
  35. package/src/components/UiChip/UiChip.stories.ts +162 -138
  36. package/src/components/UiCodeBlock/UiCodeBlock.stories.ts +291 -0
  37. package/src/components/UiCodeBlock/UiCodeBlock.vue +2 -1
  38. package/src/components/UiCodeBlock/__tests__/UiCodeBlock.test.ts +18 -0
  39. package/src/components/UiDialog/UiDialog.guidance.md +66 -0
  40. package/src/components/UiDialog/UiDialog.stories.ts +90 -66
  41. package/src/components/UiDrawer/UiDrawer.guidance.md +66 -0
  42. package/src/components/UiDrawer/UiDrawer.stories.ts +186 -162
  43. package/src/components/UiDropdownMenu/UiDropdownMenu.guidance.md +68 -0
  44. package/src/components/UiDropdownMenu/UiDropdownMenu.stories.ts +127 -86
  45. package/src/components/UiEmpty/UiEmpty.guidance.md +66 -0
  46. package/src/components/UiEmpty/UiEmpty.stories.ts +370 -15
  47. package/src/components/UiFadeMask/UiFadeMask.stories.ts +66 -0
  48. package/src/components/UiField/UiField.guidance.md +63 -0
  49. package/src/components/UiField/UiField.stories.ts +90 -113
  50. package/src/components/UiFileType/UiFileType.stories.ts +254 -0
  51. package/src/components/UiFileUploadBox/UiFileUploadBox.stories.ts +74 -72
  52. package/src/components/UiIcon/UiIcon.stories.ts +256 -1
  53. package/src/components/UiInput/UiInput.guidance.md +64 -0
  54. package/src/components/UiInput/UiInput.stories.ts +132 -80
  55. package/src/components/UiInputGroup/UiInputGroup.guidance.md +66 -0
  56. package/src/components/UiInputGroup/UiInputGroup.stories.ts +127 -103
  57. package/src/components/UiItem/UiItem.guidance.md +66 -0
  58. package/src/components/UiItem/UiItem.stories.ts +81 -28
  59. package/src/components/UiKbd/UiKbd.guidance.md +65 -0
  60. package/src/components/UiKbd/UiKbd.stories.ts +373 -3
  61. package/src/components/UiLabel/UiLabel.guidance.md +65 -0
  62. package/src/components/UiLabel/UiLabel.stories.ts +163 -139
  63. package/src/components/UiListbox/UiListbox.stories.ts +197 -195
  64. package/src/components/UiNavigationMenu/UiNavigationMenu.guidance.md +66 -0
  65. package/src/components/UiNavigationMenu/UiNavigationMenu.stories.ts +169 -169
  66. package/src/components/UiPopover/UiPopover.guidance.md +65 -0
  67. package/src/components/UiPopover/UiPopover.stories.ts +115 -91
  68. package/src/components/UiProgress/UiProgress.guidance.md +65 -0
  69. package/src/components/UiProgress/UiProgress.stories.ts +300 -0
  70. package/src/components/UiRadioGroup/UiRadioGroup.guidance.md +66 -0
  71. package/src/components/UiRadioGroup/UiRadioGroup.stories.ts +163 -139
  72. package/src/components/UiRangeCalendar/UiRangeCalendar.stories.ts +128 -127
  73. package/src/components/UiResizable/UiResizable.guidance.md +65 -0
  74. package/src/components/UiResizable/UiResizable.stories.ts +176 -152
  75. package/src/components/UiSelect/UiSelect.guidance.md +66 -0
  76. package/src/components/UiSelect/UiSelect.stories.ts +150 -126
  77. package/src/components/UiSeparator/UiSeparator.guidance.md +64 -0
  78. package/src/components/UiSeparator/UiSeparator.stories.ts +350 -0
  79. package/src/components/UiSheet/UiSheet.guidance.md +66 -0
  80. package/src/components/UiSheet/UiSheet.stories.ts +194 -170
  81. package/src/components/UiSkeleton/UiSkeleton.guidance.md +65 -0
  82. package/src/components/UiSkeleton/UiSkeleton.stories.ts +253 -0
  83. package/src/components/UiSlider/UiSlider.guidance.md +66 -0
  84. package/src/components/UiSlider/UiSlider.stories.ts +885 -153
  85. package/src/components/UiSlider/UiSlider.vue +109 -1
  86. package/src/components/UiSlider/__tests__/UiSliderValueAndSteps.test.ts +210 -0
  87. package/src/components/UiSlider/__tests__/step-marks.test.ts +94 -0
  88. package/src/components/UiSlider/step-marks.ts +96 -0
  89. package/src/components/UiSlider/types.ts +32 -0
  90. package/src/components/UiSnackbar/UiSnackbar.guidance.md +66 -0
  91. package/src/components/UiSnackbar/UiSnackbar.stories.ts +106 -96
  92. package/src/components/UiSpinner/UiSpinner.guidance.md +65 -0
  93. package/src/components/UiSpinner/UiSpinner.stories.ts +249 -0
  94. package/src/components/UiStepper/UiStepper.guidance.md +66 -0
  95. package/src/components/UiStepper/UiStepper.stories.ts +142 -124
  96. package/src/components/UiSwitch/UiSwitch.guidance.md +66 -0
  97. package/src/components/UiSwitch/UiSwitch.stories.ts +170 -146
  98. package/src/components/UiTable/UiTable.guidance.md +66 -0
  99. package/src/components/UiTable/UiTable.stories.ts +530 -12
  100. package/src/components/UiTabs/UiTabs.guidance.md +66 -0
  101. package/src/components/UiTabs/UiTabs.stories.ts +174 -150
  102. package/src/components/UiTagsInput/UiTagsInput.stories.ts +154 -152
  103. package/src/components/UiTextarea/UiTextarea.guidance.md +66 -0
  104. package/src/components/UiTextarea/UiTextarea.stories.ts +86 -62
  105. package/src/components/UiToggle/UiToggle.guidance.md +66 -0
  106. package/src/components/UiToggle/UiToggle.stories.ts +183 -159
  107. package/src/components/UiToggleGroup/UiToggleGroup.guidance.md +64 -0
  108. package/src/components/UiToggleGroup/UiToggleGroup.stories.ts +222 -200
  109. package/src/components/UiTooltip/UiTooltip.guidance.md +66 -0
  110. package/src/components/UiTooltip/UiTooltip.stories.ts +90 -66
  111. package/src/components/core/slider/Slider.vue +16 -6
  112. package/src/patterns/UiDataTable/UiDataTable.guidance.md +66 -0
  113. package/src/patterns/UiDataTable/UiDataTable.stories.ts +177 -155
  114. package/src/patterns/UiDatePicker/UiDatePicker.guidance.md +66 -0
  115. package/src/patterns/UiDatePicker/UiDatePicker.stories.ts +136 -112
  116. package/src/patterns/UiFileUpload/UiFileItem.stories.ts +77 -75
  117. package/src/patterns/UiFileUpload/UiFileUpload.guidance.md +68 -0
  118. package/src/patterns/UiFileUpload/UiFileUpload.stories.ts +169 -145
  119. package/src/patterns/UiFloatActions/UiFloatActions.stories.ts +103 -101
  120. package/src/patterns/UiLayout/UiLayoutContent.stories.ts +14 -13
  121. package/src/patterns/UiLayout/UiLayoutMobile.stories.ts +65 -65
  122. package/src/patterns/UiPlaceholder/types.ts +1 -0
  123. package/src/patterns/UiProfileCard/UiProfileCard.stories.ts +86 -84
  124. package/src/patterns/UiTopBar/UiTopBar.stories.ts +84 -82
@@ -5,6 +5,16 @@ import { expect, fn, userEvent, waitFor, within } from 'storybook/test';
5
5
  import { ref } from 'vue';
6
6
  import UiCalendar from './UiCalendar.vue';
7
7
  import { UiIcon } from '../UiIcon';
8
+ import {
9
+ accessibilityRequirementsTemplate,
10
+ designNotesStory,
11
+ guidanceLinks,
12
+ guidanceSectionClass,
13
+ parseGuidance,
14
+ } from '../../../.storybook/guidance';
15
+ import guidanceMarkdown from './UiCalendar.guidance.md?raw';
16
+
17
+ const guidance = parseGuidance(guidanceMarkdown);
8
18
 
9
19
  /**
10
20
  * UiCalendar is a month-grid date picker for selecting a single calendar day.
@@ -107,6 +117,9 @@ const meta: Meta<typeof UiCalendar> = {
107
117
  dir: 'ltr',
108
118
  disableDaysOutsideCurrentView: false,
109
119
  },
120
+ parameters: {
121
+ docs: { links: guidanceLinks(guidance) },
122
+ },
110
123
  };
111
124
 
112
125
  export default meta;
@@ -233,6 +246,96 @@ export const Default: Story = {
233
246
  },
234
247
  };
235
248
 
249
+ /**
250
+ * Usage, guidelines, and do's and don'ts from the Figma documentation.
251
+ */
252
+ export const DesignNotes: Story = {
253
+ ...designNotesStory(guidance),
254
+ tags: ['!autodocs'],
255
+ };
256
+
257
+ /**
258
+ * Accessibility guidance for calendars: today and selection distinguishable
259
+ * without colour, distinct selected/hover/focus treatments, visible focus on
260
+ * selected days, comfortable day targets, unavailable days marked beyond low
261
+ * contrast, and a stable grid size — shown side by side in the default and
262
+ * accessible themes.
263
+ */
264
+ export const Accessibility: Story = {
265
+ tags: ['!autodocs'],
266
+ parameters: {
267
+ surface: 'primary',
268
+ a11y: { test: 'off' },
269
+ chromatic: { disableSnapshot: true },
270
+ docs: {
271
+ canvas: {
272
+ sourceState: 'none',
273
+ },
274
+ },
275
+ },
276
+ render: () => ({
277
+ components: { UiCalendar },
278
+ setup() {
279
+ const defaultDate = ref<DateValue>(new CalendarDate(2026, 1, 10));
280
+ const accessibleDate = ref<DateValue>(new CalendarDate(2026, 1, 10));
281
+ const placeholder = new CalendarDate(2026, 1, 1);
282
+ return { defaultDate, accessibleDate, placeholder };
283
+ },
284
+ template: `
285
+ <section class="${guidanceSectionClass}">
286
+ <div>
287
+ <h2 class="heading-m font-bold text-content-on-surface-primary">
288
+ Accessibility
289
+ </h2>
290
+ </div>
291
+
292
+ <div class="flex flex-col gap-6">
293
+ ${accessibilityRequirementsTemplate(guidance.accessibility, 'Requirements')}
294
+
295
+ <div class="flex flex-col gap-2">
296
+ <h3 class="body-m-medium text-content-on-surface-primary">
297
+ Enable accessibility theme
298
+ </h3>
299
+ <p class="body-m-regular text-content-on-surface-primary">
300
+ When accessibility is required, enable our accessibility theme.
301
+ This increases contrast and ensures there are no color contrast
302
+ issues.
303
+ </p>
304
+ </div>
305
+ </div>
306
+
307
+ <div class="grid gap-4 md:grid-cols-2">
308
+ <div class="flex flex-col gap-3">
309
+ <h3 class="label-m-medium text-center text-content-on-surface-primary">
310
+ Default
311
+ </h3>
312
+ <div class="flex min-h-20 items-center justify-center border border-border-surface-default p-6">
313
+ <UiCalendar
314
+ v-model="defaultDate"
315
+ :default-placeholder="placeholder"
316
+ fixed-weeks
317
+ />
318
+ </div>
319
+ </div>
320
+
321
+ <div class="accessible-theme flex flex-col gap-3">
322
+ <h3 class="label-m-medium text-center text-content-on-surface-primary">
323
+ Accessible
324
+ </h3>
325
+ <div class="flex min-h-20 items-center justify-center border border-border-surface-default p-6">
326
+ <UiCalendar
327
+ v-model="accessibleDate"
328
+ :default-placeholder="placeholder"
329
+ fixed-weeks
330
+ />
331
+ </div>
332
+ </div>
333
+ </div>
334
+ </section>
335
+ `,
336
+ }),
337
+ };
338
+
236
339
  const withLayoutTemplateSource = `<script setup lang="ts">
237
340
  import type { DateValue } from '@aleph-alpha/ui-library'
238
341
  import { CalendarDate, UiCalendar } from '@aleph-alpha/ui-library'
@@ -910,116 +1013,6 @@ export const CustomHeadingAndCellSize: Story = {
910
1013
  },
911
1014
  };
912
1015
 
913
- /**
914
- * Accessibility guidance for calendars: today and selection distinguishable
915
- * without colour, distinct selected/hover/focus treatments, visible focus on
916
- * selected days, comfortable day targets, unavailable days marked beyond low
917
- * contrast, and a stable grid size — shown side by side in the default and
918
- * accessible themes.
919
- */
920
- export const Accessibility: Story = {
921
- tags: ['!autodocs'],
922
- parameters: {
923
- a11y: { test: 'off' },
924
- chromatic: { disableSnapshot: true },
925
- docs: {
926
- canvas: {
927
- sourceState: 'none',
928
- },
929
- },
930
- },
931
- render: () => ({
932
- components: { UiCalendar },
933
- setup() {
934
- const defaultDate = ref<DateValue>(new CalendarDate(2026, 1, 10));
935
- const accessibleDate = ref<DateValue>(new CalendarDate(2026, 1, 10));
936
- const placeholder = new CalendarDate(2026, 1, 1);
937
- return { defaultDate, accessibleDate, placeholder };
938
- },
939
- template: `
940
- <section class="flex flex-col gap-6 p-4">
941
- <div>
942
- <h2 class="heading-m font-bold text-content-on-surface-primary">
943
- Accessibility
944
- </h2>
945
- </div>
946
-
947
- <div class="flex flex-col gap-6">
948
- <div class="flex flex-col gap-2">
949
- <h3 class="body-m-medium text-content-on-surface-primary">
950
- Requirements
951
- </h3>
952
- <ul class="body-m-regular flex list-disc flex-col gap-1 pl-6 text-content-on-surface-primary">
953
- <li>
954
- Today and the selected day differ in shape as well as fill, so
955
- both survive without colour
956
- </li>
957
- <li>
958
- Selected, hover and focus use three distinguishable treatments,
959
- not variations of one
960
- </li>
961
- <li>
962
- Focus stays visible on a day even when that day is selected or
963
- inside a range
964
- </li>
965
- <li>
966
- Day buttons are a comfortable target at the size chosen,
967
- including the smallest one used
968
- </li>
969
- <li>
970
- Unavailable days carry a visible treatment beyond low contrast
971
- </li>
972
- <li>
973
- The grid keeps a stable size between months, so the page does
974
- not shift under the header
975
- </li>
976
- </ul>
977
- </div>
978
-
979
- <div class="flex flex-col gap-2">
980
- <h3 class="body-m-medium text-content-on-surface-primary">
981
- Enable accessibility theme
982
- </h3>
983
- <p class="body-m-regular text-content-on-surface-primary">
984
- When accessibility is required, enable our accessibility theme.
985
- This increases contrast and ensures there are no color contrast
986
- issues.
987
- </p>
988
- </div>
989
- </div>
990
-
991
- <div class="grid gap-4 md:grid-cols-2">
992
- <div class="flex flex-col gap-3">
993
- <h3 class="label-m-medium text-center text-content-on-surface-primary">
994
- Default
995
- </h3>
996
- <div class="flex min-h-20 items-center justify-center border border-border-surface-default p-6">
997
- <UiCalendar
998
- v-model="defaultDate"
999
- :default-placeholder="placeholder"
1000
- fixed-weeks
1001
- />
1002
- </div>
1003
- </div>
1004
-
1005
- <div class="accessible-theme flex flex-col gap-3">
1006
- <h3 class="label-m-medium text-center text-content-on-surface-primary">
1007
- Accessible
1008
- </h3>
1009
- <div class="flex min-h-20 items-center justify-center border border-border-surface-default p-6">
1010
- <UiCalendar
1011
- v-model="accessibleDate"
1012
- :default-placeholder="placeholder"
1013
- fixed-weeks
1014
- />
1015
- </div>
1016
- </div>
1017
- </div>
1018
- </section>
1019
- `,
1020
- }),
1021
- };
1022
-
1023
1016
  // Test-only stories drive the test-runner (interactive/a11y checks) but are
1024
1017
  // hidden from the Storybook sidebar and docs via the `!dev` / `!autodocs`
1025
1018
  // tags. They keep the implicit `test` tag, so they still run in CI and appear
@@ -0,0 +1,65 @@
1
+ ---
2
+ figma: '29187:69299'
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 Card component collects related content onto one surface so it can be read as a single unit. The boundary is what does the work: it says these things belong together, and these others do not.
10
+
11
+ Use it where items are scanned or compared as peers. A card drawn around everything on a page adds a boundary that separates nothing.
12
+
13
+ ### Earn the boundary
14
+
15
+ Every card has to justify its edge:
16
+
17
+ - Everything inside is about the same subject
18
+ - The card can be understood without the ones beside it
19
+ - The title names the subject, the description qualifies it
20
+ - Cards in a set carry the same kinds of content in the same order
21
+
22
+ ### Fill from the top down
23
+
24
+ A card is read in a fixed order, so build it in that order:
25
+
26
+ 1. Header, carrying title, description and an optional action
27
+ 2. Content, holding the substance of the card
28
+ 3. Footer, for the actions or metadata that close it out
29
+ 4. Any part may be left out, but never reordered
30
+
31
+ ### Consistency
32
+
33
+ Every card is built from the same parts:
34
+
35
+ - Card surface, with a default and a hover state
36
+ - Card header: title, description and header action
37
+ - Card slot, holding whatever the card is about
38
+ - Card footer: buttons, badges, or a login action
39
+ - One card shape and padding across a set
40
+
41
+ ## Do
42
+
43
+ - Give every card in a set the same structure and the same padding
44
+ - Name the subject in the title and use the description to qualify it
45
+ - Use the hover state only where the whole card is clickable
46
+ - Keep one primary action per card
47
+ - Let cards in a grid share a height, or align their content to the top
48
+
49
+ ## Don't
50
+
51
+ - Wrap a whole page in a card
52
+ - Nest a card inside another card
53
+ - Show a hover state on a card that cannot be clicked
54
+ - Put several competing actions in one card
55
+ - Vary padding or corner radius between cards in the same set
56
+ - Let the title truncate when the description could shorten instead
57
+
58
+ ## Accessibility
59
+
60
+ - The card's boundary is visible against the page by surface or border, not by shadow alone
61
+ - A clickable card carries a visible focus state around the whole surface, not just its title
62
+ - Where the card is clickable, its inner actions stay separately reachable and visibly distinct
63
+ - Title, description, content and footer follow one another in reading order
64
+ - Hover and focus are distinguishable from each other and from the resting state
65
+ - Text keeps its contrast against the card's own surface in every state