@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.
Files changed (118) hide show
  1. package/dist/system/components/UiDropdownMenu/useMobileSubmenuPlacement.d.ts +1 -1
  2. package/dist/system/icons/story-sidebar-icons.json +74 -17
  3. package/dist/system/lib.js +1167 -1162
  4. package/dist/system/patterns/UiPlaceholder/types.d.ts +1 -0
  5. package/dist/system/story-sidebar-icons.json +74 -17
  6. package/package.json +8 -3
  7. package/src/components/UiAccordion/UiAccordion.guidance.md +66 -0
  8. package/src/components/UiAccordion/UiAccordion.stories.ts +131 -139
  9. package/src/components/UiAlert/UiAlert.guidance.md +66 -0
  10. package/src/components/UiAlert/UiAlert.stories.ts +167 -143
  11. package/src/components/UiAlertDialog/UiAlertDialog.guidance.md +66 -0
  12. package/src/components/UiAlertDialog/UiAlertDialog.stories.ts +136 -112
  13. package/src/components/UiAutocomplete/UiAutocomplete.guidance.md +66 -0
  14. package/src/components/UiAutocomplete/UiAutocomplete.stories.ts +123 -99
  15. package/src/components/UiAvatar/UiAvatar.guidance.md +63 -0
  16. package/src/components/UiAvatar/UiAvatar.stories.ts +340 -0
  17. package/src/components/UiAvatar/UiAvatarImage.vue +5 -1
  18. package/src/components/UiAvatar/__tests__/UiAvatar.test.ts +14 -0
  19. package/src/components/UiBadge/UiBadge.guidance.md +65 -0
  20. package/src/components/UiBadge/UiBadge.stories.ts +325 -0
  21. package/src/components/UiBreadcrumb/UiBreadcrumb.guidance.md +67 -0
  22. package/src/components/UiBreadcrumb/UiBreadcrumb.stories.ts +165 -141
  23. package/src/components/UiButton/UiButton.stories.ts +5 -2
  24. package/src/components/UiButtonGroup/UiButtonGroup.guidance.md +63 -0
  25. package/src/components/UiButtonGroup/UiButtonGroup.stories.ts +91 -67
  26. package/src/components/UiCalendar/UiCalendar.guidance.md +65 -0
  27. package/src/components/UiCalendar/UiCalendar.stories.ts +103 -110
  28. package/src/components/UiCard/UiCard.guidance.md +65 -0
  29. package/src/components/UiCard/UiCard.stories.ts +393 -0
  30. package/src/components/UiCheckbox/UiCheckbox.guidance.md +62 -0
  31. package/src/components/UiCheckbox/UiCheckbox.stories.ts +18 -56
  32. package/src/components/UiChip/UiChip.guidance.md +64 -0
  33. package/src/components/UiChip/UiChip.stories.ts +162 -138
  34. package/src/components/UiCodeBlock/UiCodeBlock.stories.ts +291 -0
  35. package/src/components/UiCodeBlock/UiCodeBlock.vue +2 -1
  36. package/src/components/UiCodeBlock/__tests__/UiCodeBlock.test.ts +18 -0
  37. package/src/components/UiDialog/UiDialog.guidance.md +66 -0
  38. package/src/components/UiDialog/UiDialog.stories.ts +90 -66
  39. package/src/components/UiDrawer/UiDrawer.guidance.md +66 -0
  40. package/src/components/UiDrawer/UiDrawer.stories.ts +186 -162
  41. package/src/components/UiDropdownMenu/UiDropdownMenu.guidance.md +68 -0
  42. package/src/components/UiDropdownMenu/UiDropdownMenu.stories.ts +332 -85
  43. package/src/components/UiDropdownMenu/__tests__/UiDropdownMenu.test.ts +134 -0
  44. package/src/components/UiDropdownMenu/useMobileSubmenuPlacement.ts +23 -2
  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 +150 -126
  85. package/src/components/UiSnackbar/UiSnackbar.guidance.md +66 -0
  86. package/src/components/UiSnackbar/UiSnackbar.stories.ts +106 -96
  87. package/src/components/UiSpinner/UiSpinner.guidance.md +65 -0
  88. package/src/components/UiSpinner/UiSpinner.stories.ts +249 -0
  89. package/src/components/UiStepper/UiStepper.guidance.md +66 -0
  90. package/src/components/UiStepper/UiStepper.stories.ts +142 -124
  91. package/src/components/UiSwitch/UiSwitch.guidance.md +66 -0
  92. package/src/components/UiSwitch/UiSwitch.stories.ts +170 -146
  93. package/src/components/UiTable/UiTable.guidance.md +66 -0
  94. package/src/components/UiTable/UiTable.stories.ts +530 -12
  95. package/src/components/UiTabs/UiTabs.guidance.md +66 -0
  96. package/src/components/UiTabs/UiTabs.stories.ts +174 -150
  97. package/src/components/UiTagsInput/UiTagsInput.stories.ts +154 -152
  98. package/src/components/UiTextarea/UiTextarea.guidance.md +66 -0
  99. package/src/components/UiTextarea/UiTextarea.stories.ts +86 -62
  100. package/src/components/UiToggle/UiToggle.guidance.md +66 -0
  101. package/src/components/UiToggle/UiToggle.stories.ts +183 -159
  102. package/src/components/UiToggleGroup/UiToggleGroup.guidance.md +64 -0
  103. package/src/components/UiToggleGroup/UiToggleGroup.stories.ts +222 -200
  104. package/src/components/UiTooltip/UiTooltip.guidance.md +66 -0
  105. package/src/components/UiTooltip/UiTooltip.stories.ts +90 -66
  106. package/src/patterns/UiDataTable/UiDataTable.guidance.md +66 -0
  107. package/src/patterns/UiDataTable/UiDataTable.stories.ts +177 -155
  108. package/src/patterns/UiDatePicker/UiDatePicker.guidance.md +66 -0
  109. package/src/patterns/UiDatePicker/UiDatePicker.stories.ts +136 -112
  110. package/src/patterns/UiFileUpload/UiFileItem.stories.ts +77 -75
  111. package/src/patterns/UiFileUpload/UiFileUpload.guidance.md +68 -0
  112. package/src/patterns/UiFileUpload/UiFileUpload.stories.ts +169 -145
  113. package/src/patterns/UiFloatActions/UiFloatActions.stories.ts +103 -101
  114. package/src/patterns/UiLayout/UiLayoutContent.stories.ts +14 -13
  115. package/src/patterns/UiLayout/UiLayoutMobile.stories.ts +65 -65
  116. package/src/patterns/UiPlaceholder/types.ts +1 -0
  117. package/src/patterns/UiProfileCard/UiProfileCard.stories.ts +74 -72
  118. package/src/patterns/UiTopBar/UiTopBar.stories.ts +84 -82
@@ -13,6 +13,16 @@ import {
13
13
  UiSelectVirtualizer,
14
14
  } from './index';
15
15
  import { UiIcon } from '@/components/UiIcon';
16
+ import {
17
+ accessibilityRequirementsTemplate,
18
+ designNotesStory,
19
+ guidanceLinks,
20
+ guidanceSectionClass,
21
+ parseGuidance,
22
+ } from '../../../.storybook/guidance';
23
+ import guidanceMarkdown from './UiSelect.guidance.md?raw';
24
+
25
+ const guidance = parseGuidance(guidanceMarkdown);
16
26
 
17
27
  /**
18
28
  * UiSelect is a trigger-and-dropdown primitive for choosing one option from a list, with grouped options, separators, and labels.
@@ -40,6 +50,9 @@ const meta: Meta<typeof UiSelect> = {
40
50
  disabled: false,
41
51
  required: false,
42
52
  },
53
+ parameters: {
54
+ docs: { links: guidanceLinks(guidance) },
55
+ },
43
56
  };
44
57
 
45
58
  export default meta;
@@ -136,6 +149,143 @@ export const Default: Story = {
136
149
  },
137
150
  };
138
151
 
152
+ /**
153
+ * Usage, guidelines, and do's and don'ts from the Figma documentation.
154
+ */
155
+ export const DesignNotes: Story = {
156
+ ...designNotesStory(guidance),
157
+ tags: ['!autodocs'],
158
+ };
159
+
160
+ /**
161
+ * Accessibility guidance for selects: an accessible trigger name, labelled
162
+ * groups, and visible disabled options — shown side by side in the default
163
+ * and accessible themes.
164
+ */
165
+ export const Accessibility: Story = {
166
+ tags: ['!autodocs'],
167
+ parameters: {
168
+ surface: 'primary',
169
+ a11y: { test: 'off' },
170
+ chromatic: { disableSnapshot: true },
171
+ docs: {
172
+ canvas: {
173
+ sourceState: 'none',
174
+ },
175
+ },
176
+ },
177
+ render: () => ({
178
+ components: {
179
+ UiSelect,
180
+ UiSelectTrigger,
181
+ UiSelectContent,
182
+ UiSelectItem,
183
+ UiSelectValue,
184
+ },
185
+ setup() {
186
+ const defaultValue = ref('');
187
+ const accessibleValue = ref('');
188
+ return { defaultValue, accessibleValue };
189
+ },
190
+ template: `
191
+ <section class="${guidanceSectionClass}">
192
+ <div>
193
+ <h2 class="heading-m font-bold text-content-on-surface-primary">
194
+ Accessibility
195
+ </h2>
196
+ </div>
197
+
198
+ ${accessibilityRequirementsTemplate(guidance.accessibility, 'Requirements')}
199
+
200
+ <div class="flex flex-col gap-6">
201
+ <div class="flex flex-col gap-2">
202
+ <h3 class="body-m-medium text-content-on-surface-primary">
203
+ Give the trigger an accessible name
204
+ </h3>
205
+ <p class="body-m-regular text-content-on-surface-primary">
206
+ The placeholder disappears once a value is chosen, so it is not a
207
+ label. Pair the select with a visible label or set
208
+ <code>ariaLabel</code> on <code>UiSelectTrigger</code>.
209
+ </p>
210
+ </div>
211
+
212
+ <div class="flex flex-col gap-2">
213
+ <h3 class="body-m-medium text-content-on-surface-primary">
214
+ Group related options and label the groups
215
+ </h3>
216
+ <p class="body-m-regular text-content-on-surface-primary">
217
+ Long flat lists are hard to scan and listen to. Wrap related
218
+ options in <code>UiSelectGroup</code> with a
219
+ <code>UiSelectLabel</code> so the group is announced with its
220
+ name.
221
+ </p>
222
+ </div>
223
+
224
+ <div class="flex flex-col gap-2">
225
+ <h3 class="body-m-medium text-content-on-surface-primary">
226
+ Keep disabled options visible
227
+ </h3>
228
+ <p class="body-m-regular text-content-on-surface-primary">
229
+ A disabled option stays in the list so users see the full set of
230
+ choices. When possible, explain why it is unavailable in its
231
+ label (for example "Enterprise — contact sales").
232
+ </p>
233
+ </div>
234
+
235
+ <div class="flex flex-col gap-2">
236
+ <h3 class="body-m-medium text-content-on-surface-primary">
237
+ Enable accessibility theme
238
+ </h3>
239
+ <p class="body-m-regular text-content-on-surface-primary">
240
+ When accessibility is required, enable our accessibility theme.
241
+ This increases contrast and makes sure there are no color
242
+ contrast issues.
243
+ </p>
244
+ </div>
245
+ </div>
246
+
247
+ <div class="grid gap-4 md:grid-cols-2">
248
+ <div class="flex flex-col gap-3">
249
+ <h3 class="label-m-medium text-center text-content-on-surface-primary">
250
+ Default
251
+ </h3>
252
+ <div class="flex min-h-20 items-center justify-center border border-border-surface-default p-6">
253
+ <UiSelect v-model="defaultValue">
254
+ <UiSelectTrigger ariaLabel="Select a fruit">
255
+ <UiSelectValue placeholder="Select a fruit" />
256
+ </UiSelectTrigger>
257
+ <UiSelectContent>
258
+ <UiSelectItem value="apple">Apple</UiSelectItem>
259
+ <UiSelectItem value="banana">Banana</UiSelectItem>
260
+ <UiSelectItem value="orange">Orange</UiSelectItem>
261
+ </UiSelectContent>
262
+ </UiSelect>
263
+ </div>
264
+ </div>
265
+
266
+ <div class="accessible-theme flex flex-col gap-3">
267
+ <h3 class="label-m-medium text-center text-content-on-surface-primary">
268
+ Accessible
269
+ </h3>
270
+ <div class="flex min-h-20 items-center justify-center border border-border-surface-default p-6">
271
+ <UiSelect v-model="accessibleValue">
272
+ <UiSelectTrigger ariaLabel="Select a fruit">
273
+ <UiSelectValue placeholder="Select a fruit" />
274
+ </UiSelectTrigger>
275
+ <UiSelectContent>
276
+ <UiSelectItem value="apple">Apple</UiSelectItem>
277
+ <UiSelectItem value="banana">Banana</UiSelectItem>
278
+ <UiSelectItem value="orange">Orange</UiSelectItem>
279
+ </UiSelectContent>
280
+ </UiSelect>
281
+ </div>
282
+ </div>
283
+ </div>
284
+ </section>
285
+ `,
286
+ }),
287
+ };
288
+
139
289
  const withGroupsTemplateSource = `<script setup lang="ts">
140
290
  import { ref } from 'vue'
141
291
  import {
@@ -989,132 +1139,6 @@ export const Virtualized: Story = {
989
1139
  },
990
1140
  };
991
1141
 
992
- /**
993
- * Accessibility guidance for selects: an accessible trigger name, labelled
994
- * groups, and visible disabled options — shown side by side in the default
995
- * and accessible themes.
996
- */
997
- export const Accessibility: Story = {
998
- tags: ['!autodocs'],
999
- parameters: {
1000
- a11y: { test: 'off' },
1001
- chromatic: { disableSnapshot: true },
1002
- docs: {
1003
- canvas: {
1004
- sourceState: 'none',
1005
- },
1006
- },
1007
- },
1008
- render: () => ({
1009
- components: {
1010
- UiSelect,
1011
- UiSelectTrigger,
1012
- UiSelectContent,
1013
- UiSelectItem,
1014
- UiSelectValue,
1015
- },
1016
- setup() {
1017
- const defaultValue = ref('');
1018
- const accessibleValue = ref('');
1019
- return { defaultValue, accessibleValue };
1020
- },
1021
- template: `
1022
- <section class="flex flex-col gap-6 p-4">
1023
- <div>
1024
- <h2 class="heading-m font-bold text-content-on-surface-primary">
1025
- Accessibility
1026
- </h2>
1027
- </div>
1028
-
1029
- <div class="flex flex-col gap-6">
1030
- <div class="flex flex-col gap-2">
1031
- <h3 class="body-m-medium text-content-on-surface-primary">
1032
- Give the trigger an accessible name
1033
- </h3>
1034
- <p class="body-m-regular text-content-on-surface-primary">
1035
- The placeholder disappears once a value is chosen, so it is not a
1036
- label. Pair the select with a visible label or set
1037
- <code>ariaLabel</code> on <code>UiSelectTrigger</code>.
1038
- </p>
1039
- </div>
1040
-
1041
- <div class="flex flex-col gap-2">
1042
- <h3 class="body-m-medium text-content-on-surface-primary">
1043
- Group related options and label the groups
1044
- </h3>
1045
- <p class="body-m-regular text-content-on-surface-primary">
1046
- Long flat lists are hard to scan and listen to. Wrap related
1047
- options in <code>UiSelectGroup</code> with a
1048
- <code>UiSelectLabel</code> so the group is announced with its
1049
- name.
1050
- </p>
1051
- </div>
1052
-
1053
- <div class="flex flex-col gap-2">
1054
- <h3 class="body-m-medium text-content-on-surface-primary">
1055
- Keep disabled options visible
1056
- </h3>
1057
- <p class="body-m-regular text-content-on-surface-primary">
1058
- A disabled option stays in the list so users see the full set of
1059
- choices. When possible, explain why it is unavailable in its
1060
- label (for example "Enterprise — contact sales").
1061
- </p>
1062
- </div>
1063
-
1064
- <div class="flex flex-col gap-2">
1065
- <h3 class="body-m-medium text-content-on-surface-primary">
1066
- Enable accessibility theme
1067
- </h3>
1068
- <p class="body-m-regular text-content-on-surface-primary">
1069
- When accessibility is required, enable our accessibility theme.
1070
- This increases contrast and makes sure there are no color
1071
- contrast issues.
1072
- </p>
1073
- </div>
1074
- </div>
1075
-
1076
- <div class="grid gap-4 md:grid-cols-2">
1077
- <div class="flex flex-col gap-3">
1078
- <h3 class="label-m-medium text-center text-content-on-surface-primary">
1079
- Default
1080
- </h3>
1081
- <div class="flex min-h-20 items-center justify-center border border-border-surface-default p-6">
1082
- <UiSelect v-model="defaultValue">
1083
- <UiSelectTrigger ariaLabel="Select a fruit">
1084
- <UiSelectValue placeholder="Select a fruit" />
1085
- </UiSelectTrigger>
1086
- <UiSelectContent>
1087
- <UiSelectItem value="apple">Apple</UiSelectItem>
1088
- <UiSelectItem value="banana">Banana</UiSelectItem>
1089
- <UiSelectItem value="orange">Orange</UiSelectItem>
1090
- </UiSelectContent>
1091
- </UiSelect>
1092
- </div>
1093
- </div>
1094
-
1095
- <div class="accessible-theme flex flex-col gap-3">
1096
- <h3 class="label-m-medium text-center text-content-on-surface-primary">
1097
- Accessible
1098
- </h3>
1099
- <div class="flex min-h-20 items-center justify-center border border-border-surface-default p-6">
1100
- <UiSelect v-model="accessibleValue">
1101
- <UiSelectTrigger ariaLabel="Select a fruit">
1102
- <UiSelectValue placeholder="Select a fruit" />
1103
- </UiSelectTrigger>
1104
- <UiSelectContent>
1105
- <UiSelectItem value="apple">Apple</UiSelectItem>
1106
- <UiSelectItem value="banana">Banana</UiSelectItem>
1107
- <UiSelectItem value="orange">Orange</UiSelectItem>
1108
- </UiSelectContent>
1109
- </UiSelect>
1110
- </div>
1111
- </div>
1112
- </div>
1113
- </section>
1114
- `,
1115
- }),
1116
- };
1117
-
1118
1142
  /**
1119
1143
  * Full interaction flow: the dropdown opens on activation, a choice updates
1120
1144
  * the trigger and closes the panel, focus returns to the trigger, disabled
@@ -0,0 +1,64 @@
1
+ ---
2
+ figma: '29205:71308'
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 Separator component draws a line between groups of content. It is the loudest way to say that two things are different, which is why most groupings are better made with space alone.
10
+
11
+ Use it where a boundary must be unmistakable: between menu groups, between a header and its content, or between items in a dense list where spacing has run out.
12
+
13
+ ### Space first, line second
14
+
15
+ A separator is a last resort, not a default:
16
+
17
+ - Try spacing, then a change of surface, then a line
18
+ - A line inside a card that already has an edge usually adds nothing
19
+ - One separator per boundary, never two in a row
20
+ - No separator where the grouping is already obvious
21
+
22
+ ### Match the axis to the content
23
+
24
+ Orientation follows the flow it interrupts:
25
+
26
+ 1. Horizontal between stacked content
27
+ 2. Vertical between items in a row
28
+ 3. Full width or height of the region it divides, or inset consistently
29
+ 4. One inset rule per context, so lines align down a page
30
+
31
+ ### Consistency
32
+
33
+ Every separator follows the same rules:
34
+
35
+ - Separator, horizontal or vertical
36
+ - One weight and one colour across a product
37
+ - One inset rule per context
38
+ - Used only where spacing alone is not enough
39
+
40
+ ## Do
41
+
42
+ - Try spacing before reaching for a line
43
+ - Use one weight and colour throughout a product
44
+ - Keep the inset rule consistent, so lines align down a page
45
+ - Match the orientation to the flow it interrupts
46
+ - Use a separator between menu groups, where the grouping carries meaning
47
+
48
+ ## Don't
49
+
50
+ - Use a separator between every item in a list
51
+ - Put two separators in a row
52
+ - Add a line inside a container that already has an edge
53
+ - Vary the line's weight or colour between sections
54
+ - Use separators to make a layout look more structured than it is
55
+ - Rely on a separator to carry meaning that should be a label
56
+
57
+ ## Accessibility
58
+
59
+ - The line is decorative: any grouping it implies is also carried by a label or heading
60
+ - Its contrast is enough to be visible without competing with the content it divides
61
+ - Separators are not used so densely that they compete with text for attention
62
+ - One consistent weight keeps the line from reading as a border or an underline
63
+ - A vertical separator keeps enough space either side to read as a divider
64
+ - Nothing is conveyed by the presence of a line alone