@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
@@ -10,6 +10,7 @@ import UiListboxItemIndicator from './UiListboxItemIndicator.vue';
10
10
  import UiListboxGroup from './UiListboxGroup.vue';
11
11
  import UiListboxGroupLabel from './UiListboxGroupLabel.vue';
12
12
  import UiListboxVirtualizer from './UiListboxVirtualizer.vue';
13
+ import { guidanceSectionClass } from '../../../.storybook/guidance';
13
14
 
14
15
  /**
15
16
  * UiListbox is a scrollable, single- or multi-select option list with optional filtering and grouping.
@@ -131,6 +132,202 @@ export const Default: Story = {
131
132
  },
132
133
  };
133
134
 
135
+ /**
136
+ * Accessibility guidance for listboxes: a meaningful list name, labelled
137
+ * groups, an announced selection, and a spoken empty state — shown side by
138
+ * side in the default and accessible themes.
139
+ */
140
+ export const Accessibility: Story = {
141
+ tags: ['!autodocs'],
142
+ parameters: {
143
+ surface: 'primary',
144
+ a11y: { test: 'off' },
145
+ chromatic: { disableSnapshot: true },
146
+ docs: {
147
+ canvas: {
148
+ sourceState: 'none',
149
+ },
150
+ },
151
+ },
152
+ render: () => ({
153
+ components: {
154
+ UiListbox,
155
+ UiListboxContent,
156
+ UiListboxFilter,
157
+ UiListboxItem,
158
+ UiListboxItemIndicator,
159
+ UiListboxGroup,
160
+ UiListboxGroupLabel,
161
+ },
162
+ setup() {
163
+ const defaultValue = ref('apple');
164
+ const accessibleValue = ref('apple');
165
+ const defaultTerm = ref('');
166
+ const accessibleTerm = ref('');
167
+ return {
168
+ defaultValue,
169
+ accessibleValue,
170
+ defaultTerm,
171
+ accessibleTerm,
172
+ };
173
+ },
174
+ template: `
175
+ <section class="${guidanceSectionClass}">
176
+ <div>
177
+ <h2 class="heading-m font-bold text-content-on-surface-primary">
178
+ Accessibility
179
+ </h2>
180
+ </div>
181
+
182
+ <div class="flex flex-col gap-6">
183
+ <div class="flex flex-col gap-2">
184
+ <h3 class="body-m-medium text-content-on-surface-primary">
185
+ Give the list a meaningful name
186
+ </h3>
187
+ <p class="body-m-regular text-content-on-surface-primary">
188
+ <code>UiListboxContent</code> falls back to the generic name
189
+ "Options". Set <code>aria-label</code> (or point
190
+ <code>aria-labelledby</code> at a visible heading) so the list is
191
+ announced as what it actually contains.
192
+ </p>
193
+ </div>
194
+
195
+ <div class="flex flex-col gap-2">
196
+ <h3 class="body-m-medium text-content-on-surface-primary">
197
+ Label the filter input
198
+ </h3>
199
+ <p class="body-m-regular text-content-on-surface-primary">
200
+ The placeholder disappears as soon as the user types, so it is not
201
+ a label. Give <code>UiListboxFilter</code> its own
202
+ <code>aria-label</code>.
203
+ </p>
204
+ </div>
205
+
206
+ <div class="flex flex-col gap-2">
207
+ <h3 class="body-m-medium text-content-on-surface-primary">
208
+ Group related options and label the groups
209
+ </h3>
210
+ <p class="body-m-regular text-content-on-surface-primary">
211
+ Long flat lists are hard to scan and to listen to. Wrap related
212
+ options in <code>UiListboxGroup</code> with a
213
+ <code>UiListboxGroupLabel</code> so each group is announced with
214
+ its name.
215
+ </p>
216
+ </div>
217
+
218
+ <div class="flex flex-col gap-2">
219
+ <h3 class="body-m-medium text-content-on-surface-primary">
220
+ Do not rely on the indicator alone
221
+ </h3>
222
+ <p class="body-m-regular text-content-on-surface-primary">
223
+ <code>UiListboxItemIndicator</code> is decorative and hidden from
224
+ assistive technology. The selected state is carried by
225
+ <code>aria-selected</code> on the option, which the component sets
226
+ for you — keep the indicator as the visible counterpart.
227
+ </p>
228
+ </div>
229
+
230
+ <div class="flex flex-col gap-2">
231
+ <h3 class="body-m-medium text-content-on-surface-primary">
232
+ Announce the empty and no-results states
233
+ </h3>
234
+ <p class="body-m-regular text-content-on-surface-primary">
235
+ A list that filters down to nothing is silent. Render a short
236
+ message in a <code>role="status"</code> region so the outcome is
237
+ spoken instead of leaving a blank panel.
238
+ </p>
239
+ </div>
240
+
241
+ <div class="flex flex-col gap-2">
242
+ <h3 class="body-m-medium text-content-on-surface-primary">
243
+ Enable accessibility theme
244
+ </h3>
245
+ <p class="body-m-regular text-content-on-surface-primary">
246
+ When accessibility is required, enable our accessibility theme.
247
+ This increases contrast and makes sure there are no color
248
+ contrast issues.
249
+ </p>
250
+ </div>
251
+ </div>
252
+
253
+ <div class="grid gap-4 md:grid-cols-2">
254
+ <div class="flex flex-col gap-3">
255
+ <h3 class="label-m-medium text-center text-content-on-surface-primary">
256
+ Default
257
+ </h3>
258
+ <div class="flex min-h-20 items-center justify-center border border-border-surface-default p-6">
259
+ <UiListbox v-model="defaultValue" class="w-[200px]">
260
+ <UiListboxFilter
261
+ v-model="defaultTerm"
262
+ placeholder="Search food..."
263
+ aria-label="Search food"
264
+ class="border-b"
265
+ />
266
+ <UiListboxContent aria-label="Food" class="p-1">
267
+ <UiListboxGroup>
268
+ <UiListboxGroupLabel>Fruits</UiListboxGroupLabel>
269
+ <UiListboxItem value="apple">
270
+ <span>Apple</span>
271
+ <UiListboxItemIndicator />
272
+ </UiListboxItem>
273
+ <UiListboxItem value="mango" disabled>
274
+ <span>Mango (sold out)</span>
275
+ <UiListboxItemIndicator />
276
+ </UiListboxItem>
277
+ </UiListboxGroup>
278
+ <UiListboxGroup>
279
+ <UiListboxGroupLabel>Vegetables</UiListboxGroupLabel>
280
+ <UiListboxItem value="carrot">
281
+ <span>Carrot</span>
282
+ <UiListboxItemIndicator />
283
+ </UiListboxItem>
284
+ </UiListboxGroup>
285
+ </UiListboxContent>
286
+ </UiListbox>
287
+ </div>
288
+ </div>
289
+
290
+ <div class="accessible-theme flex flex-col gap-3">
291
+ <h3 class="label-m-medium text-center text-content-on-surface-primary">
292
+ Accessible
293
+ </h3>
294
+ <div class="flex min-h-20 items-center justify-center border border-border-surface-default p-6">
295
+ <UiListbox v-model="accessibleValue" class="w-[200px]">
296
+ <UiListboxFilter
297
+ v-model="accessibleTerm"
298
+ placeholder="Search food..."
299
+ aria-label="Search food"
300
+ class="border-b"
301
+ />
302
+ <UiListboxContent aria-label="Food" class="p-1">
303
+ <UiListboxGroup>
304
+ <UiListboxGroupLabel>Fruits</UiListboxGroupLabel>
305
+ <UiListboxItem value="apple">
306
+ <span>Apple</span>
307
+ <UiListboxItemIndicator />
308
+ </UiListboxItem>
309
+ <UiListboxItem value="mango" disabled>
310
+ <span>Mango (sold out)</span>
311
+ <UiListboxItemIndicator />
312
+ </UiListboxItem>
313
+ </UiListboxGroup>
314
+ <UiListboxGroup>
315
+ <UiListboxGroupLabel>Vegetables</UiListboxGroupLabel>
316
+ <UiListboxItem value="carrot">
317
+ <span>Carrot</span>
318
+ <UiListboxItemIndicator />
319
+ </UiListboxItem>
320
+ </UiListboxGroup>
321
+ </UiListboxContent>
322
+ </UiListbox>
323
+ </div>
324
+ </div>
325
+ </div>
326
+ </section>
327
+ `,
328
+ }),
329
+ };
330
+
134
331
  const multipleTemplateSource = `<script setup lang="ts">
135
332
  import { ref } from 'vue'
136
333
  import {
@@ -1036,201 +1233,6 @@ export const WithDisabledItems: Story = {
1036
1233
  },
1037
1234
  };
1038
1235
 
1039
- /**
1040
- * Accessibility guidance for listboxes: a meaningful list name, labelled
1041
- * groups, an announced selection, and a spoken empty state — shown side by
1042
- * side in the default and accessible themes.
1043
- */
1044
- export const Accessibility: Story = {
1045
- tags: ['!autodocs'],
1046
- parameters: {
1047
- a11y: { test: 'off' },
1048
- chromatic: { disableSnapshot: true },
1049
- docs: {
1050
- canvas: {
1051
- sourceState: 'none',
1052
- },
1053
- },
1054
- },
1055
- render: () => ({
1056
- components: {
1057
- UiListbox,
1058
- UiListboxContent,
1059
- UiListboxFilter,
1060
- UiListboxItem,
1061
- UiListboxItemIndicator,
1062
- UiListboxGroup,
1063
- UiListboxGroupLabel,
1064
- },
1065
- setup() {
1066
- const defaultValue = ref('apple');
1067
- const accessibleValue = ref('apple');
1068
- const defaultTerm = ref('');
1069
- const accessibleTerm = ref('');
1070
- return {
1071
- defaultValue,
1072
- accessibleValue,
1073
- defaultTerm,
1074
- accessibleTerm,
1075
- };
1076
- },
1077
- template: `
1078
- <section class="flex flex-col gap-6 p-4">
1079
- <div>
1080
- <h2 class="heading-m font-bold text-content-on-surface-primary">
1081
- Accessibility
1082
- </h2>
1083
- </div>
1084
-
1085
- <div class="flex flex-col gap-6">
1086
- <div class="flex flex-col gap-2">
1087
- <h3 class="body-m-medium text-content-on-surface-primary">
1088
- Give the list a meaningful name
1089
- </h3>
1090
- <p class="body-m-regular text-content-on-surface-primary">
1091
- <code>UiListboxContent</code> falls back to the generic name
1092
- "Options". Set <code>aria-label</code> (or point
1093
- <code>aria-labelledby</code> at a visible heading) so the list is
1094
- announced as what it actually contains.
1095
- </p>
1096
- </div>
1097
-
1098
- <div class="flex flex-col gap-2">
1099
- <h3 class="body-m-medium text-content-on-surface-primary">
1100
- Label the filter input
1101
- </h3>
1102
- <p class="body-m-regular text-content-on-surface-primary">
1103
- The placeholder disappears as soon as the user types, so it is not
1104
- a label. Give <code>UiListboxFilter</code> its own
1105
- <code>aria-label</code>.
1106
- </p>
1107
- </div>
1108
-
1109
- <div class="flex flex-col gap-2">
1110
- <h3 class="body-m-medium text-content-on-surface-primary">
1111
- Group related options and label the groups
1112
- </h3>
1113
- <p class="body-m-regular text-content-on-surface-primary">
1114
- Long flat lists are hard to scan and to listen to. Wrap related
1115
- options in <code>UiListboxGroup</code> with a
1116
- <code>UiListboxGroupLabel</code> so each group is announced with
1117
- its name.
1118
- </p>
1119
- </div>
1120
-
1121
- <div class="flex flex-col gap-2">
1122
- <h3 class="body-m-medium text-content-on-surface-primary">
1123
- Do not rely on the indicator alone
1124
- </h3>
1125
- <p class="body-m-regular text-content-on-surface-primary">
1126
- <code>UiListboxItemIndicator</code> is decorative and hidden from
1127
- assistive technology. The selected state is carried by
1128
- <code>aria-selected</code> on the option, which the component sets
1129
- for you — keep the indicator as the visible counterpart.
1130
- </p>
1131
- </div>
1132
-
1133
- <div class="flex flex-col gap-2">
1134
- <h3 class="body-m-medium text-content-on-surface-primary">
1135
- Announce the empty and no-results states
1136
- </h3>
1137
- <p class="body-m-regular text-content-on-surface-primary">
1138
- A list that filters down to nothing is silent. Render a short
1139
- message in a <code>role="status"</code> region so the outcome is
1140
- spoken instead of leaving a blank panel.
1141
- </p>
1142
- </div>
1143
-
1144
- <div class="flex flex-col gap-2">
1145
- <h3 class="body-m-medium text-content-on-surface-primary">
1146
- Enable accessibility theme
1147
- </h3>
1148
- <p class="body-m-regular text-content-on-surface-primary">
1149
- When accessibility is required, enable our accessibility theme.
1150
- This increases contrast and makes sure there are no color
1151
- contrast issues.
1152
- </p>
1153
- </div>
1154
- </div>
1155
-
1156
- <div class="grid gap-4 md:grid-cols-2">
1157
- <div class="flex flex-col gap-3">
1158
- <h3 class="label-m-medium text-center text-content-on-surface-primary">
1159
- Default
1160
- </h3>
1161
- <div class="flex min-h-20 items-center justify-center border border-border-surface-default p-6">
1162
- <UiListbox v-model="defaultValue" class="w-[200px]">
1163
- <UiListboxFilter
1164
- v-model="defaultTerm"
1165
- placeholder="Search food..."
1166
- aria-label="Search food"
1167
- class="border-b"
1168
- />
1169
- <UiListboxContent aria-label="Food" class="p-1">
1170
- <UiListboxGroup>
1171
- <UiListboxGroupLabel>Fruits</UiListboxGroupLabel>
1172
- <UiListboxItem value="apple">
1173
- <span>Apple</span>
1174
- <UiListboxItemIndicator />
1175
- </UiListboxItem>
1176
- <UiListboxItem value="mango" disabled>
1177
- <span>Mango (sold out)</span>
1178
- <UiListboxItemIndicator />
1179
- </UiListboxItem>
1180
- </UiListboxGroup>
1181
- <UiListboxGroup>
1182
- <UiListboxGroupLabel>Vegetables</UiListboxGroupLabel>
1183
- <UiListboxItem value="carrot">
1184
- <span>Carrot</span>
1185
- <UiListboxItemIndicator />
1186
- </UiListboxItem>
1187
- </UiListboxGroup>
1188
- </UiListboxContent>
1189
- </UiListbox>
1190
- </div>
1191
- </div>
1192
-
1193
- <div class="accessible-theme flex flex-col gap-3">
1194
- <h3 class="label-m-medium text-center text-content-on-surface-primary">
1195
- Accessible
1196
- </h3>
1197
- <div class="flex min-h-20 items-center justify-center border border-border-surface-default p-6">
1198
- <UiListbox v-model="accessibleValue" class="w-[200px]">
1199
- <UiListboxFilter
1200
- v-model="accessibleTerm"
1201
- placeholder="Search food..."
1202
- aria-label="Search food"
1203
- class="border-b"
1204
- />
1205
- <UiListboxContent aria-label="Food" class="p-1">
1206
- <UiListboxGroup>
1207
- <UiListboxGroupLabel>Fruits</UiListboxGroupLabel>
1208
- <UiListboxItem value="apple">
1209
- <span>Apple</span>
1210
- <UiListboxItemIndicator />
1211
- </UiListboxItem>
1212
- <UiListboxItem value="mango" disabled>
1213
- <span>Mango (sold out)</span>
1214
- <UiListboxItemIndicator />
1215
- </UiListboxItem>
1216
- </UiListboxGroup>
1217
- <UiListboxGroup>
1218
- <UiListboxGroupLabel>Vegetables</UiListboxGroupLabel>
1219
- <UiListboxItem value="carrot">
1220
- <span>Carrot</span>
1221
- <UiListboxItemIndicator />
1222
- </UiListboxItem>
1223
- </UiListboxGroup>
1224
- </UiListboxContent>
1225
- </UiListbox>
1226
- </div>
1227
- </div>
1228
- </div>
1229
- </section>
1230
- `,
1231
- }),
1232
- };
1233
-
1234
1236
  // Test-only stories drive the test-runner (interactive/a11y checks) but are
1235
1237
  // hidden from the Storybook sidebar and docs via the `!dev` / `!autodocs`
1236
1238
  // tags. They keep the implicit `test` tag, so they still run in CI and appear
@@ -0,0 +1,66 @@
1
+ ---
2
+ figma: '29203:694'
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 Navigation Menu component is the top-level route around a site. Some items are plain links; others open a panel because the section behind them needs describing before the user commits to it.
10
+
11
+ Use it for navigating between places. Menubar covers application commands and Dropdown Menu covers actions on an object — a navigation menu goes somewhere.
12
+
13
+ ### Destinations, not actions
14
+
15
+ Every item in a navigation menu takes the user somewhere:
16
+
17
+ - Top-level items name sections of the site
18
+ - A panel describes what is inside a section; it does not act on anything
19
+ - Plain links are used wherever a section needs no description
20
+ - The current section is identifiable from the menu
21
+
22
+ ### Describe what is behind the item
23
+
24
+ A panel earns itself by telling the user what they will find:
25
+
26
+ 1. Trigger names the section
27
+ 2. Panel lists the destinations inside it
28
+ 3. Each link carries a short description where its name is not enough
29
+ 4. A featured item goes first where one destination matters most
30
+
31
+ ### Consistency
32
+
33
+ Every navigation menu is built from the same parts:
34
+
35
+ - Navigation menu row, holding triggers and links
36
+ - Trigger and link buttons, with default, hover and focus states
37
+ - Panel layouts: list, two-column list, simple list, simple list with icon, custom
38
+ - Menu link, default or simple
39
+ - One panel layout per kind of section
40
+
41
+ ## Do
42
+
43
+ - Name top-level items after sections, in the words the site uses elsewhere
44
+ - Use a plain link where the section needs no description
45
+ - Add descriptions only where the link name is not enough
46
+ - Keep the same panel layout for the same kind of section
47
+ - Show the user which section they are currently in
48
+ - Keep panels shallow: one level of destinations
49
+
50
+ ## Don't
51
+
52
+ - Put actions in a navigation menu
53
+ - Open a panel where a single link would do
54
+ - Vary panel layout between sections of the same kind
55
+ - Bury the most-used destination inside a panel
56
+ - Rely on hover alone to reveal navigation
57
+ - Write descriptions that just repeat the link name
58
+
59
+ ## Accessibility
60
+
61
+ - The current section is marked by weight or a rule, not by colour alone
62
+ - Triggers and links keep visible hover and focus states, distinct from each other
63
+ - Panels open fully on screen, so no destination is cut off
64
+ - Link descriptions hold contrast against the panel's own surface
65
+ - Triggers and links are comfortable targets, with space between adjacent items
66
+ - Navigation is reachable without hover, since pointing is not available to every user