@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
@@ -0,0 +1,66 @@
1
+ ---
2
+ figma: '29190:69711'
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 Combobox component pairs a value with a searchable list. The user types to narrow the options instead of scrolling through them, so it holds lists a Select cannot.
10
+
11
+ Use it when the list is long enough that filtering beats scanning — countries, users, frameworks, tags. When the options fit on screen and can all be read, Select is simpler.
12
+
13
+ ### Search is the point
14
+
15
+ The field exists to shorten the list, so it has to behave:
16
+
17
+ - The search field is focused as soon as the list opens
18
+ - Results narrow as the user types, with no submit step
19
+ - An empty result says so, and offers the next step
20
+ - The current value stays visible while the user searches
21
+
22
+ ### Structure long lists
23
+
24
+ Once a list needs search, it usually needs structure too:
25
+
26
+ 1. Group options under labels the user recognises
27
+ 2. Put the most likely options in the first group
28
+ 3. Show selection with a checkmark or a checkbox, not with colour
29
+ 4. Offer a create action when the user's value may not exist yet
30
+
31
+ ### Consistency
32
+
33
+ Every combobox is built from the same parts:
34
+
35
+ - Combobox trigger, with or without a group label
36
+ - Search field, opening the list
37
+ - Menu item: simple, with icon, with avatar, or with checkbox
38
+ - Command menu layouts: simple, multiselect, avatars and groups
39
+ - Trigger states: default, hover, focus, pressed and disabled
40
+
41
+ ## Do
42
+
43
+ - Focus the search field as soon as the list opens
44
+ - Narrow results as the user types, with no submit step
45
+ - Group long lists under labels the user will recognise
46
+ - Show the selected option with a mark, and keep it visible in the list
47
+ - Say what to do next when nothing matches
48
+ - Use the checkbox item type when several options can be chosen
49
+
50
+ ## Don't
51
+
52
+ - Use a combobox for a short list that fits on screen
53
+ - Clear the user's typing when the list reopens
54
+ - Hide the current value while the user searches
55
+ - Show an empty list with no explanation
56
+ - Rely on colour alone to mark the selected option
57
+ - Use a combobox where the user is typing free text rather than choosing
58
+
59
+ ## Accessibility
60
+
61
+ - Selection is marked by a checkmark or a checkbox, so it never rests on colour alone
62
+ - The hovered option and the focused option are distinguishable from each other
63
+ - The trigger keeps a visible focus state, distinct from its hover and pressed states
64
+ - Menu items stay comfortable targets at every item type, including the dense simple one
65
+ - The empty-result message is as legible as the options it replaces
66
+ - Group labels read as labels rather than as selectable options
@@ -5,6 +5,16 @@ import { UiBadge } from '@/components/UiBadge';
5
5
  import { UiCheckbox } from '@/components/UiCheckbox';
6
6
  import UiAutocomplete from './UiAutocomplete.vue';
7
7
  import UiAutocompleteItem from './UiAutocompleteItem.vue';
8
+ import {
9
+ accessibilityRequirementsTemplate,
10
+ designNotesStory,
11
+ guidanceLinks,
12
+ guidanceSectionClass,
13
+ parseGuidance,
14
+ } from '../../../.storybook/guidance';
15
+ import guidanceMarkdown from './UiAutocomplete.guidance.md?raw';
16
+
17
+ const guidance = parseGuidance(guidanceMarkdown);
8
18
 
9
19
  const fruits = [
10
20
  { value: 'apple', label: 'Apple' },
@@ -47,6 +57,9 @@ const meta: Meta<typeof UiAutocomplete> = {
47
57
  multiple: false,
48
58
  disabled: false,
49
59
  },
60
+ parameters: {
61
+ docs: { links: guidanceLinks(guidance) },
62
+ },
50
63
  };
51
64
 
52
65
  export default meta;
@@ -123,6 +136,116 @@ export const Default: Story = {
123
136
  },
124
137
  };
125
138
 
139
+ /**
140
+ * Usage, guidelines, and do's and don'ts from the Figma documentation.
141
+ */
142
+ export const DesignNotes: Story = {
143
+ ...designNotesStory(guidance),
144
+ tags: ['!autodocs'],
145
+ };
146
+
147
+ /**
148
+ * Accessibility guidance for the autocomplete: a labelled input and visible
149
+ * disabled options — shown side by side in the default and accessible themes.
150
+ */
151
+ export const Accessibility: Story = {
152
+ tags: ['!autodocs'],
153
+ parameters: {
154
+ surface: 'primary',
155
+ a11y: { test: 'off' },
156
+ chromatic: { disableSnapshot: true },
157
+ docs: {
158
+ canvas: {
159
+ sourceState: 'none',
160
+ },
161
+ },
162
+ },
163
+ render: () => ({
164
+ components: { UiAutocomplete },
165
+ setup() {
166
+ const defaultValue = ref('');
167
+ const accessibleValue = ref('');
168
+ return { defaultValue, accessibleValue, fruits };
169
+ },
170
+ template: `
171
+ <section class="${guidanceSectionClass}">
172
+ <div>
173
+ <h2 class="heading-m font-bold text-content-on-surface-primary">
174
+ Accessibility
175
+ </h2>
176
+ </div>
177
+
178
+ ${accessibilityRequirementsTemplate(guidance.accessibility, 'Requirements')}
179
+
180
+ <div class="flex flex-col gap-6">
181
+ <div class="flex flex-col gap-2">
182
+ <h3 class="body-m-medium text-content-on-surface-primary">
183
+ Give the input an accessible name
184
+ </h3>
185
+ <p class="body-m-regular text-content-on-surface-primary">
186
+ Placeholders disappear while typing, so they are not labels.
187
+ Pair the field with a visible label or set the
188
+ <code>ariaLabel</code> prop.
189
+ </p>
190
+ </div>
191
+
192
+ <div class="flex flex-col gap-2">
193
+ <h3 class="body-m-medium text-content-on-surface-primary">
194
+ Keep disabled options visible
195
+ </h3>
196
+ <p class="body-m-regular text-content-on-surface-primary">
197
+ A disabled option stays in the results so users see the full set
198
+ of choices. When possible, explain why it is unavailable in its
199
+ label.
200
+ </p>
201
+ </div>
202
+
203
+ <div class="flex flex-col gap-2">
204
+ <h3 class="body-m-medium text-content-on-surface-primary">
205
+ Enable accessibility theme
206
+ </h3>
207
+ <p class="body-m-regular text-content-on-surface-primary">
208
+ When accessibility is required, enable our accessibility theme.
209
+ This increases contrast and makes sure there are no color
210
+ contrast issues.
211
+ </p>
212
+ </div>
213
+ </div>
214
+
215
+ <div class="grid gap-4 md:grid-cols-2">
216
+ <div class="flex flex-col gap-3">
217
+ <h3 class="label-m-medium text-center text-content-on-surface-primary">
218
+ Default
219
+ </h3>
220
+ <div class="flex min-h-20 items-center justify-center border border-border-surface-default p-6">
221
+ <UiAutocomplete
222
+ v-model="defaultValue"
223
+ :options="fruits"
224
+ placeholder="Search fruit"
225
+ class="w-[220px]"
226
+ />
227
+ </div>
228
+ </div>
229
+
230
+ <div class="accessible-theme flex flex-col gap-3">
231
+ <h3 class="label-m-medium text-center text-content-on-surface-primary">
232
+ Accessible
233
+ </h3>
234
+ <div class="flex min-h-20 items-center justify-center border border-border-surface-default p-6">
235
+ <UiAutocomplete
236
+ v-model="accessibleValue"
237
+ :options="fruits"
238
+ placeholder="Search fruit"
239
+ class="w-[220px]"
240
+ />
241
+ </div>
242
+ </div>
243
+ </div>
244
+ </section>
245
+ `,
246
+ }),
247
+ };
248
+
126
249
  const multipleTemplateSource = `<script setup lang="ts">
127
250
  import { ref } from 'vue'
128
251
  import { UiAutocomplete } from '@aleph-alpha/ui-library'
@@ -540,105 +663,6 @@ export const Virtualized: Story = {
540
663
  },
541
664
  };
542
665
 
543
- /**
544
- * Accessibility guidance for the autocomplete: a labelled input and visible
545
- * disabled options — shown side by side in the default and accessible themes.
546
- */
547
- export const Accessibility: Story = {
548
- tags: ['!autodocs'],
549
- parameters: {
550
- a11y: { test: 'off' },
551
- chromatic: { disableSnapshot: true },
552
- docs: {
553
- canvas: {
554
- sourceState: 'none',
555
- },
556
- },
557
- },
558
- render: () => ({
559
- components: { UiAutocomplete },
560
- setup() {
561
- const defaultValue = ref('');
562
- const accessibleValue = ref('');
563
- return { defaultValue, accessibleValue, fruits };
564
- },
565
- template: `
566
- <section class="flex flex-col gap-6 p-4">
567
- <div>
568
- <h2 class="heading-m font-bold text-content-on-surface-primary">
569
- Accessibility
570
- </h2>
571
- </div>
572
-
573
- <div class="flex flex-col gap-6">
574
- <div class="flex flex-col gap-2">
575
- <h3 class="body-m-medium text-content-on-surface-primary">
576
- Give the input an accessible name
577
- </h3>
578
- <p class="body-m-regular text-content-on-surface-primary">
579
- Placeholders disappear while typing, so they are not labels.
580
- Pair the field with a visible label or set the
581
- <code>ariaLabel</code> prop.
582
- </p>
583
- </div>
584
-
585
- <div class="flex flex-col gap-2">
586
- <h3 class="body-m-medium text-content-on-surface-primary">
587
- Keep disabled options visible
588
- </h3>
589
- <p class="body-m-regular text-content-on-surface-primary">
590
- A disabled option stays in the results so users see the full set
591
- of choices. When possible, explain why it is unavailable in its
592
- label.
593
- </p>
594
- </div>
595
-
596
- <div class="flex flex-col gap-2">
597
- <h3 class="body-m-medium text-content-on-surface-primary">
598
- Enable accessibility theme
599
- </h3>
600
- <p class="body-m-regular text-content-on-surface-primary">
601
- When accessibility is required, enable our accessibility theme.
602
- This increases contrast and makes sure there are no color
603
- contrast issues.
604
- </p>
605
- </div>
606
- </div>
607
-
608
- <div class="grid gap-4 md:grid-cols-2">
609
- <div class="flex flex-col gap-3">
610
- <h3 class="label-m-medium text-center text-content-on-surface-primary">
611
- Default
612
- </h3>
613
- <div class="flex min-h-20 items-center justify-center border border-border-surface-default p-6">
614
- <UiAutocomplete
615
- v-model="defaultValue"
616
- :options="fruits"
617
- placeholder="Search fruit"
618
- class="w-[220px]"
619
- />
620
- </div>
621
- </div>
622
-
623
- <div class="accessible-theme flex flex-col gap-3">
624
- <h3 class="label-m-medium text-center text-content-on-surface-primary">
625
- Accessible
626
- </h3>
627
- <div class="flex min-h-20 items-center justify-center border border-border-surface-default p-6">
628
- <UiAutocomplete
629
- v-model="accessibleValue"
630
- :options="fruits"
631
- placeholder="Search fruit"
632
- class="w-[220px]"
633
- />
634
- </div>
635
- </div>
636
- </div>
637
- </section>
638
- `,
639
- }),
640
- };
641
-
642
666
  /**
643
667
  * Full interaction flow: focusing the input opens the suggestions, typing
644
668
  * filters them, choosing an option fills the field and closes the list, and
@@ -0,0 +1,63 @@
1
+ ---
2
+ figma: '29184:69167'
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 Avatar component identifies a person or account. It shows an image when one exists and falls back to initials when it does not, so the shape and size of the slot never change.
10
+
11
+ Use it to answer who. It identifies rather than informs: the name, role or status always lives in the text beside it.
12
+
13
+ ### Always have a fallback
14
+
15
+ An avatar has to look finished without an image:
16
+
17
+ - Fallback initials come from the person's name, not from a placeholder
18
+ - The fallback occupies exactly the same slot as the image
19
+ - Fallback colour is derived consistently, so a person looks the same everywhere
20
+ - A missing image never shows as a broken or empty slot
21
+
22
+ ### Size follows the context
23
+
24
+ Pick the size from how much work the avatar has to do:
25
+
26
+ 1. Sizes 5 and 6 for dense lists, tables and inline mentions
27
+ 2. Size 8 for rows, comments and menu items
28
+ 3. Size 10 for headers and cards
29
+ 4. Size 12 for profiles, where the avatar is the subject
30
+
31
+ ### Consistency
32
+
33
+ Every use is built from the same parts:
34
+
35
+ - Avatar, image or fallback, in five sizes
36
+ - Avatar group, for a handful of people at once
37
+ - Avatar form field, when a user sets their own picture
38
+ - A name in text, wherever the avatar identifies someone
39
+
40
+ ## Do
41
+
42
+ - Pair the avatar with the person's name in text wherever space allows
43
+ - Use initials from the real name as the fallback
44
+ - Keep one size per context, so rows and lists stay even
45
+ - Use an avatar group for a small set, and a count for the rest
46
+ - Crop faces to the centre of the slot
47
+
48
+ ## Don't
49
+
50
+ - Use an avatar as the only way to tell people apart
51
+ - Put status, role or a count inside the avatar itself
52
+ - Mix sizes within one list
53
+ - Show more than a handful of avatars in a group before collapsing to a count
54
+ - Use a generic placeholder image where initials would identify the person
55
+
56
+ ## Accessibility
57
+
58
+ - The person's name appears in text wherever the avatar identifies them, not only on hover
59
+ - Fallback initials hold their contrast against every fallback background used
60
+ - The slot keeps identical shape and size between image and fallback, so rows do not shift
61
+ - Avatars in a group overlap without hiding what distinguishes each person
62
+ - Interactive avatars are a comfortable target at every size and keep a visible focus state
63
+ - Nothing is communicated by an avatar's colour alone