@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.
- package/dist/system/icons/story-sidebar-icons.json +74 -17
- package/dist/system/lib.js +8 -5
- package/dist/system/patterns/UiPlaceholder/types.d.ts +1 -0
- package/dist/system/story-sidebar-icons.json +74 -17
- package/package.json +8 -3
- package/src/components/UiAccordion/UiAccordion.guidance.md +66 -0
- package/src/components/UiAccordion/UiAccordion.stories.ts +131 -139
- package/src/components/UiAlert/UiAlert.guidance.md +66 -0
- package/src/components/UiAlert/UiAlert.stories.ts +167 -143
- package/src/components/UiAlertDialog/UiAlertDialog.guidance.md +66 -0
- package/src/components/UiAlertDialog/UiAlertDialog.stories.ts +136 -112
- package/src/components/UiAutocomplete/UiAutocomplete.guidance.md +66 -0
- package/src/components/UiAutocomplete/UiAutocomplete.stories.ts +123 -99
- package/src/components/UiAvatar/UiAvatar.guidance.md +63 -0
- package/src/components/UiAvatar/UiAvatar.stories.ts +340 -0
- package/src/components/UiAvatar/UiAvatarImage.vue +5 -1
- package/src/components/UiAvatar/__tests__/UiAvatar.test.ts +14 -0
- package/src/components/UiBadge/UiBadge.guidance.md +65 -0
- package/src/components/UiBadge/UiBadge.stories.ts +325 -0
- package/src/components/UiBreadcrumb/UiBreadcrumb.guidance.md +67 -0
- package/src/components/UiBreadcrumb/UiBreadcrumb.stories.ts +165 -141
- package/src/components/UiButton/UiButton.stories.ts +5 -2
- package/src/components/UiButtonGroup/UiButtonGroup.guidance.md +63 -0
- package/src/components/UiButtonGroup/UiButtonGroup.stories.ts +91 -67
- package/src/components/UiCalendar/UiCalendar.guidance.md +65 -0
- package/src/components/UiCalendar/UiCalendar.stories.ts +103 -110
- package/src/components/UiCard/UiCard.guidance.md +65 -0
- package/src/components/UiCard/UiCard.stories.ts +393 -0
- package/src/components/UiCheckbox/UiCheckbox.guidance.md +62 -0
- package/src/components/UiCheckbox/UiCheckbox.stories.ts +18 -56
- package/src/components/UiChip/UiChip.guidance.md +64 -0
- package/src/components/UiChip/UiChip.stories.ts +162 -138
- package/src/components/UiCodeBlock/UiCodeBlock.stories.ts +291 -0
- package/src/components/UiCodeBlock/UiCodeBlock.vue +2 -1
- package/src/components/UiCodeBlock/__tests__/UiCodeBlock.test.ts +18 -0
- package/src/components/UiDialog/UiDialog.guidance.md +66 -0
- package/src/components/UiDialog/UiDialog.stories.ts +90 -66
- package/src/components/UiDrawer/UiDrawer.guidance.md +66 -0
- package/src/components/UiDrawer/UiDrawer.stories.ts +186 -162
- package/src/components/UiDropdownMenu/UiDropdownMenu.guidance.md +68 -0
- package/src/components/UiDropdownMenu/UiDropdownMenu.stories.ts +127 -86
- package/src/components/UiEmpty/UiEmpty.guidance.md +66 -0
- package/src/components/UiEmpty/UiEmpty.stories.ts +370 -15
- package/src/components/UiFadeMask/UiFadeMask.stories.ts +66 -0
- package/src/components/UiField/UiField.guidance.md +63 -0
- package/src/components/UiField/UiField.stories.ts +90 -113
- package/src/components/UiFileType/UiFileType.stories.ts +254 -0
- package/src/components/UiFileUploadBox/UiFileUploadBox.stories.ts +74 -72
- package/src/components/UiIcon/UiIcon.stories.ts +256 -1
- package/src/components/UiInput/UiInput.guidance.md +64 -0
- package/src/components/UiInput/UiInput.stories.ts +132 -80
- package/src/components/UiInputGroup/UiInputGroup.guidance.md +66 -0
- package/src/components/UiInputGroup/UiInputGroup.stories.ts +127 -103
- package/src/components/UiItem/UiItem.guidance.md +66 -0
- package/src/components/UiItem/UiItem.stories.ts +81 -28
- package/src/components/UiKbd/UiKbd.guidance.md +65 -0
- package/src/components/UiKbd/UiKbd.stories.ts +373 -3
- package/src/components/UiLabel/UiLabel.guidance.md +65 -0
- package/src/components/UiLabel/UiLabel.stories.ts +163 -139
- package/src/components/UiListbox/UiListbox.stories.ts +197 -195
- package/src/components/UiNavigationMenu/UiNavigationMenu.guidance.md +66 -0
- package/src/components/UiNavigationMenu/UiNavigationMenu.stories.ts +169 -169
- package/src/components/UiPopover/UiPopover.guidance.md +65 -0
- package/src/components/UiPopover/UiPopover.stories.ts +115 -91
- package/src/components/UiProgress/UiProgress.guidance.md +65 -0
- package/src/components/UiProgress/UiProgress.stories.ts +300 -0
- package/src/components/UiRadioGroup/UiRadioGroup.guidance.md +66 -0
- package/src/components/UiRadioGroup/UiRadioGroup.stories.ts +163 -139
- package/src/components/UiRangeCalendar/UiRangeCalendar.stories.ts +128 -127
- package/src/components/UiResizable/UiResizable.guidance.md +65 -0
- package/src/components/UiResizable/UiResizable.stories.ts +176 -152
- package/src/components/UiSelect/UiSelect.guidance.md +66 -0
- package/src/components/UiSelect/UiSelect.stories.ts +150 -126
- package/src/components/UiSeparator/UiSeparator.guidance.md +64 -0
- package/src/components/UiSeparator/UiSeparator.stories.ts +350 -0
- package/src/components/UiSheet/UiSheet.guidance.md +66 -0
- package/src/components/UiSheet/UiSheet.stories.ts +194 -170
- package/src/components/UiSkeleton/UiSkeleton.guidance.md +65 -0
- package/src/components/UiSkeleton/UiSkeleton.stories.ts +253 -0
- package/src/components/UiSlider/UiSlider.guidance.md +66 -0
- package/src/components/UiSlider/UiSlider.stories.ts +150 -126
- package/src/components/UiSnackbar/UiSnackbar.guidance.md +66 -0
- package/src/components/UiSnackbar/UiSnackbar.stories.ts +106 -96
- package/src/components/UiSpinner/UiSpinner.guidance.md +65 -0
- package/src/components/UiSpinner/UiSpinner.stories.ts +249 -0
- package/src/components/UiStepper/UiStepper.guidance.md +66 -0
- package/src/components/UiStepper/UiStepper.stories.ts +142 -124
- package/src/components/UiSwitch/UiSwitch.guidance.md +66 -0
- package/src/components/UiSwitch/UiSwitch.stories.ts +170 -146
- package/src/components/UiTable/UiTable.guidance.md +66 -0
- package/src/components/UiTable/UiTable.stories.ts +530 -12
- package/src/components/UiTabs/UiTabs.guidance.md +66 -0
- package/src/components/UiTabs/UiTabs.stories.ts +174 -150
- package/src/components/UiTagsInput/UiTagsInput.stories.ts +154 -152
- package/src/components/UiTextarea/UiTextarea.guidance.md +66 -0
- package/src/components/UiTextarea/UiTextarea.stories.ts +86 -62
- package/src/components/UiToggle/UiToggle.guidance.md +66 -0
- package/src/components/UiToggle/UiToggle.stories.ts +183 -159
- package/src/components/UiToggleGroup/UiToggleGroup.guidance.md +64 -0
- package/src/components/UiToggleGroup/UiToggleGroup.stories.ts +222 -200
- package/src/components/UiTooltip/UiTooltip.guidance.md +66 -0
- package/src/components/UiTooltip/UiTooltip.stories.ts +90 -66
- package/src/patterns/UiDataTable/UiDataTable.guidance.md +66 -0
- package/src/patterns/UiDataTable/UiDataTable.stories.ts +177 -155
- package/src/patterns/UiDatePicker/UiDatePicker.guidance.md +66 -0
- package/src/patterns/UiDatePicker/UiDatePicker.stories.ts +136 -112
- package/src/patterns/UiFileUpload/UiFileItem.stories.ts +77 -75
- package/src/patterns/UiFileUpload/UiFileUpload.guidance.md +68 -0
- package/src/patterns/UiFileUpload/UiFileUpload.stories.ts +169 -145
- package/src/patterns/UiFloatActions/UiFloatActions.stories.ts +103 -101
- package/src/patterns/UiLayout/UiLayoutContent.stories.ts +14 -13
- package/src/patterns/UiLayout/UiLayoutMobile.stories.ts +65 -65
- package/src/patterns/UiPlaceholder/types.ts +1 -0
- package/src/patterns/UiProfileCard/UiProfileCard.stories.ts +74 -72
- package/src/patterns/UiTopBar/UiTopBar.stories.ts +84 -82
|
@@ -6,6 +6,16 @@ import {
|
|
|
6
6
|
UiResizablePanel,
|
|
7
7
|
UiResizablePanelGroup,
|
|
8
8
|
} from './index';
|
|
9
|
+
import {
|
|
10
|
+
accessibilityRequirementsTemplate,
|
|
11
|
+
designNotesStory,
|
|
12
|
+
guidanceLinks,
|
|
13
|
+
guidanceSectionClass,
|
|
14
|
+
parseGuidance,
|
|
15
|
+
} from '../../../.storybook/guidance';
|
|
16
|
+
import guidanceMarkdown from './UiResizable.guidance.md?raw';
|
|
17
|
+
|
|
18
|
+
const guidance = parseGuidance(guidanceMarkdown);
|
|
9
19
|
|
|
10
20
|
// The group emits `layout` with no handler prop, so the plays bind a
|
|
11
21
|
// module-level spy via `@layout` rather than passing a handler through `args`.
|
|
@@ -39,6 +49,9 @@ const meta: Meta<typeof UiResizablePanelGroup> = {
|
|
|
39
49
|
direction: 'horizontal',
|
|
40
50
|
keyboardResizeBy: 10,
|
|
41
51
|
},
|
|
52
|
+
parameters: {
|
|
53
|
+
docs: { links: guidanceLinks(guidance) },
|
|
54
|
+
},
|
|
42
55
|
};
|
|
43
56
|
|
|
44
57
|
export default meta;
|
|
@@ -252,6 +265,169 @@ export const Default: Story = {
|
|
|
252
265
|
},
|
|
253
266
|
};
|
|
254
267
|
|
|
268
|
+
/**
|
|
269
|
+
* Usage, guidelines, and do's and don'ts from the Figma documentation.
|
|
270
|
+
*/
|
|
271
|
+
export const DesignNotes: Story = {
|
|
272
|
+
...designNotesStory(guidance),
|
|
273
|
+
tags: ['!autodocs'],
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Accessibility guidance for naming, operating, and announcing resizable splits.
|
|
278
|
+
*/
|
|
279
|
+
export const Accessibility: Story = {
|
|
280
|
+
render: () => ({
|
|
281
|
+
components: {
|
|
282
|
+
UiResizableHandle,
|
|
283
|
+
UiResizablePanel,
|
|
284
|
+
UiResizablePanelGroup,
|
|
285
|
+
},
|
|
286
|
+
setup() {
|
|
287
|
+
return { panelClasses };
|
|
288
|
+
},
|
|
289
|
+
template: `
|
|
290
|
+
<section class="${guidanceSectionClass}">
|
|
291
|
+
<div>
|
|
292
|
+
<h2 class="heading-m font-bold text-content-on-surface-primary">
|
|
293
|
+
Accessibility
|
|
294
|
+
</h2>
|
|
295
|
+
</div>
|
|
296
|
+
|
|
297
|
+
${accessibilityRequirementsTemplate(guidance.accessibility, 'Requirements')}
|
|
298
|
+
|
|
299
|
+
<div class="flex flex-col gap-6">
|
|
300
|
+
<div class="flex flex-col gap-2">
|
|
301
|
+
<h3 class="body-m-medium text-content-on-surface-primary">
|
|
302
|
+
Name every handle
|
|
303
|
+
</h3>
|
|
304
|
+
<p class="body-m-regular text-content-on-surface-primary">
|
|
305
|
+
A handle renders as a focusable <code>separator</code>. Nothing inside it
|
|
306
|
+
is read out, because a separator makes its children presentational, so
|
|
307
|
+
without an <code>aria-label</code> a screen reader announces a bare
|
|
308
|
+
"separator" with a number attached. Name it after the panel it sizes
|
|
309
|
+
("Resize sidebar"), and give each seam in a multi-panel layout its own
|
|
310
|
+
name so the two can be told apart in an element list or by voice control.
|
|
311
|
+
<br />
|
|
312
|
+
WCAG 2.2:
|
|
313
|
+
<a
|
|
314
|
+
href="https://www.w3.org/WAI/WCAG22/Understanding/name-role-value.html"
|
|
315
|
+
target="_blank"
|
|
316
|
+
rel="noopener noreferrer"
|
|
317
|
+
class="text-content-link-default underline"
|
|
318
|
+
>
|
|
319
|
+
4.1.2 Name, Role, Value
|
|
320
|
+
</a>
|
|
321
|
+
</p>
|
|
322
|
+
</div>
|
|
323
|
+
|
|
324
|
+
<div class="flex flex-col gap-2">
|
|
325
|
+
<h3 class="body-m-medium text-content-on-surface-primary">
|
|
326
|
+
Resizing must never require a pointer
|
|
327
|
+
</h3>
|
|
328
|
+
<p class="body-m-regular text-content-on-surface-primary">
|
|
329
|
+
Tab moves focus onto the handle. Arrow keys along the group's axis then
|
|
330
|
+
resize by <code>keyboardResizeBy</code> percent per press (hold Shift to
|
|
331
|
+
jump the full range), Home and End drive the split to either extreme, and
|
|
332
|
+
F6 cycles between the handles of the same group. On a
|
|
333
|
+
<code>collapsible</code> panel, Enter toggles collapsed and expanded. Keep
|
|
334
|
+
<code>keyboardResizeBy</code> coarse enough that a user is not asked to
|
|
335
|
+
press an arrow thirty times to get anywhere.
|
|
336
|
+
<br />
|
|
337
|
+
WCAG 2.2:
|
|
338
|
+
<a
|
|
339
|
+
href="https://www.w3.org/WAI/WCAG22/Understanding/keyboard.html"
|
|
340
|
+
target="_blank"
|
|
341
|
+
rel="noopener noreferrer"
|
|
342
|
+
class="text-content-link-default underline"
|
|
343
|
+
>
|
|
344
|
+
2.1.1 Keyboard
|
|
345
|
+
</a>
|
|
346
|
+
</p>
|
|
347
|
+
</div>
|
|
348
|
+
|
|
349
|
+
<div class="flex flex-col gap-2">
|
|
350
|
+
<h3 class="body-m-medium text-content-on-surface-primary">
|
|
351
|
+
Let the split announce its own state
|
|
352
|
+
</h3>
|
|
353
|
+
<p class="body-m-regular text-content-on-surface-primary">
|
|
354
|
+
The group keeps <code>aria-valuenow</code>, <code>aria-valuemin</code> and
|
|
355
|
+
<code>aria-valuemax</code> on each handle in sync with the layout, and points
|
|
356
|
+
<code>aria-controls</code> at the panel being sized, so every resize is
|
|
357
|
+
announced without a live region of your own. Two things are worth adding
|
|
358
|
+
by hand: <code>aria-orientation="vertical"</code> on the handles of a
|
|
359
|
+
horizontal group (a separator is assumed horizontal otherwise), and
|
|
360
|
+
<code>:tabindex="-1"</code> alongside <code>disabled</code>, since a disabled
|
|
361
|
+
handle otherwise stays a focusable stop that does nothing.
|
|
362
|
+
</p>
|
|
363
|
+
</div>
|
|
364
|
+
|
|
365
|
+
<div class="flex flex-col gap-2">
|
|
366
|
+
<h3 class="body-m-medium text-content-on-surface-primary">
|
|
367
|
+
Enable accessibility theme
|
|
368
|
+
</h3>
|
|
369
|
+
<p class="body-m-regular text-content-on-surface-primary">
|
|
370
|
+
A hairline divider is the thinnest thing in any layout, so it is the first
|
|
371
|
+
to disappear against a low-contrast surface and the first place a focus
|
|
372
|
+
ring gets lost. When accessibility is required, enable our accessibility
|
|
373
|
+
theme: it raises the contrast of both the divider and its focus ring.
|
|
374
|
+
</p>
|
|
375
|
+
</div>
|
|
376
|
+
</div>
|
|
377
|
+
|
|
378
|
+
<div class="grid gap-4 md:grid-cols-2">
|
|
379
|
+
<div class="flex flex-col gap-3">
|
|
380
|
+
<h3 class="label-m-medium text-center text-content-on-surface-primary">
|
|
381
|
+
Default
|
|
382
|
+
</h3>
|
|
383
|
+
<div class="border border-border-surface-default p-4">
|
|
384
|
+
<UiResizablePanelGroup direction="horizontal" class="min-h-40">
|
|
385
|
+
<UiResizablePanel :default-size="40">
|
|
386
|
+
<div :class="[panelClasses, 'h-full']">Sidebar</div>
|
|
387
|
+
</UiResizablePanel>
|
|
388
|
+
<UiResizableHandle with-handle aria-label="Resize sidebar" />
|
|
389
|
+
<UiResizablePanel :default-size="60">
|
|
390
|
+
<div :class="[panelClasses, 'h-full']">Content</div>
|
|
391
|
+
</UiResizablePanel>
|
|
392
|
+
</UiResizablePanelGroup>
|
|
393
|
+
</div>
|
|
394
|
+
</div>
|
|
395
|
+
|
|
396
|
+
<div class="accessible-theme flex flex-col gap-3">
|
|
397
|
+
<h3 class="label-m-medium text-center text-content-on-surface-primary">
|
|
398
|
+
Accessible
|
|
399
|
+
</h3>
|
|
400
|
+
<div class="border border-border-surface-default p-4">
|
|
401
|
+
<UiResizablePanelGroup direction="horizontal" class="min-h-40">
|
|
402
|
+
<UiResizablePanel :default-size="40">
|
|
403
|
+
<div :class="[panelClasses, 'h-full']">Sidebar</div>
|
|
404
|
+
</UiResizablePanel>
|
|
405
|
+
<UiResizableHandle with-handle aria-label="Resize sidebar" />
|
|
406
|
+
<UiResizablePanel :default-size="60">
|
|
407
|
+
<div :class="[panelClasses, 'h-full']">Content</div>
|
|
408
|
+
</UiResizablePanel>
|
|
409
|
+
</UiResizablePanelGroup>
|
|
410
|
+
</div>
|
|
411
|
+
</div>
|
|
412
|
+
</div>
|
|
413
|
+
</section>
|
|
414
|
+
`,
|
|
415
|
+
}),
|
|
416
|
+
tags: ['!autodocs'],
|
|
417
|
+
parameters: {
|
|
418
|
+
surface: 'primary',
|
|
419
|
+
a11y: { test: 'off' },
|
|
420
|
+
chromatic: {
|
|
421
|
+
disableSnapshot: true,
|
|
422
|
+
},
|
|
423
|
+
docs: {
|
|
424
|
+
canvas: {
|
|
425
|
+
sourceState: 'none',
|
|
426
|
+
},
|
|
427
|
+
},
|
|
428
|
+
},
|
|
429
|
+
};
|
|
430
|
+
|
|
255
431
|
const verticalTemplateSource = `<script setup lang="ts">
|
|
256
432
|
import { ref } from 'vue'
|
|
257
433
|
import {
|
|
@@ -951,158 +1127,6 @@ export const ThreePanels: Story = {
|
|
|
951
1127
|
},
|
|
952
1128
|
};
|
|
953
1129
|
|
|
954
|
-
/**
|
|
955
|
-
* Accessibility guidance for naming, operating, and announcing resizable splits.
|
|
956
|
-
*/
|
|
957
|
-
export const Accessibility: Story = {
|
|
958
|
-
render: () => ({
|
|
959
|
-
components: {
|
|
960
|
-
UiResizableHandle,
|
|
961
|
-
UiResizablePanel,
|
|
962
|
-
UiResizablePanelGroup,
|
|
963
|
-
},
|
|
964
|
-
setup() {
|
|
965
|
-
return { panelClasses };
|
|
966
|
-
},
|
|
967
|
-
template: `
|
|
968
|
-
<section class="flex flex-col gap-6 p-4">
|
|
969
|
-
<div>
|
|
970
|
-
<h2 class="heading-m font-bold text-content-on-surface-primary">
|
|
971
|
-
Accessibility
|
|
972
|
-
</h2>
|
|
973
|
-
</div>
|
|
974
|
-
|
|
975
|
-
<div class="flex flex-col gap-6">
|
|
976
|
-
<div class="flex flex-col gap-2">
|
|
977
|
-
<h3 class="body-m-medium text-content-on-surface-primary">
|
|
978
|
-
Name every handle
|
|
979
|
-
</h3>
|
|
980
|
-
<p class="body-m-regular text-content-on-surface-primary">
|
|
981
|
-
A handle renders as a focusable <code>separator</code>. Nothing inside it
|
|
982
|
-
is read out, because a separator makes its children presentational, so
|
|
983
|
-
without an <code>aria-label</code> a screen reader announces a bare
|
|
984
|
-
"separator" with a number attached. Name it after the panel it sizes
|
|
985
|
-
("Resize sidebar"), and give each seam in a multi-panel layout its own
|
|
986
|
-
name so the two can be told apart in an element list or by voice control.
|
|
987
|
-
<br />
|
|
988
|
-
WCAG 2.2:
|
|
989
|
-
<a
|
|
990
|
-
href="https://www.w3.org/WAI/WCAG22/Understanding/name-role-value.html"
|
|
991
|
-
target="_blank"
|
|
992
|
-
rel="noopener noreferrer"
|
|
993
|
-
class="text-content-link-default underline"
|
|
994
|
-
>
|
|
995
|
-
4.1.2 Name, Role, Value
|
|
996
|
-
</a>
|
|
997
|
-
</p>
|
|
998
|
-
</div>
|
|
999
|
-
|
|
1000
|
-
<div class="flex flex-col gap-2">
|
|
1001
|
-
<h3 class="body-m-medium text-content-on-surface-primary">
|
|
1002
|
-
Resizing must never require a pointer
|
|
1003
|
-
</h3>
|
|
1004
|
-
<p class="body-m-regular text-content-on-surface-primary">
|
|
1005
|
-
Tab moves focus onto the handle. Arrow keys along the group's axis then
|
|
1006
|
-
resize by <code>keyboardResizeBy</code> percent per press (hold Shift to
|
|
1007
|
-
jump the full range), Home and End drive the split to either extreme, and
|
|
1008
|
-
F6 cycles between the handles of the same group. On a
|
|
1009
|
-
<code>collapsible</code> panel, Enter toggles collapsed and expanded. Keep
|
|
1010
|
-
<code>keyboardResizeBy</code> coarse enough that a user is not asked to
|
|
1011
|
-
press an arrow thirty times to get anywhere.
|
|
1012
|
-
<br />
|
|
1013
|
-
WCAG 2.2:
|
|
1014
|
-
<a
|
|
1015
|
-
href="https://www.w3.org/WAI/WCAG22/Understanding/keyboard.html"
|
|
1016
|
-
target="_blank"
|
|
1017
|
-
rel="noopener noreferrer"
|
|
1018
|
-
class="text-content-link-default underline"
|
|
1019
|
-
>
|
|
1020
|
-
2.1.1 Keyboard
|
|
1021
|
-
</a>
|
|
1022
|
-
</p>
|
|
1023
|
-
</div>
|
|
1024
|
-
|
|
1025
|
-
<div class="flex flex-col gap-2">
|
|
1026
|
-
<h3 class="body-m-medium text-content-on-surface-primary">
|
|
1027
|
-
Let the split announce its own state
|
|
1028
|
-
</h3>
|
|
1029
|
-
<p class="body-m-regular text-content-on-surface-primary">
|
|
1030
|
-
The group keeps <code>aria-valuenow</code>, <code>aria-valuemin</code> and
|
|
1031
|
-
<code>aria-valuemax</code> on each handle in sync with the layout, and points
|
|
1032
|
-
<code>aria-controls</code> at the panel being sized, so every resize is
|
|
1033
|
-
announced without a live region of your own. Two things are worth adding
|
|
1034
|
-
by hand: <code>aria-orientation="vertical"</code> on the handles of a
|
|
1035
|
-
horizontal group (a separator is assumed horizontal otherwise), and
|
|
1036
|
-
<code>:tabindex="-1"</code> alongside <code>disabled</code>, since a disabled
|
|
1037
|
-
handle otherwise stays a focusable stop that does nothing.
|
|
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
|
-
Enable accessibility theme
|
|
1044
|
-
</h3>
|
|
1045
|
-
<p class="body-m-regular text-content-on-surface-primary">
|
|
1046
|
-
A hairline divider is the thinnest thing in any layout, so it is the first
|
|
1047
|
-
to disappear against a low-contrast surface and the first place a focus
|
|
1048
|
-
ring gets lost. When accessibility is required, enable our accessibility
|
|
1049
|
-
theme: it raises the contrast of both the divider and its focus ring.
|
|
1050
|
-
</p>
|
|
1051
|
-
</div>
|
|
1052
|
-
</div>
|
|
1053
|
-
|
|
1054
|
-
<div class="grid gap-4 md:grid-cols-2">
|
|
1055
|
-
<div class="flex flex-col gap-3">
|
|
1056
|
-
<h3 class="label-m-medium text-center text-content-on-surface-primary">
|
|
1057
|
-
Default
|
|
1058
|
-
</h3>
|
|
1059
|
-
<div class="border border-border-surface-default p-4">
|
|
1060
|
-
<UiResizablePanelGroup direction="horizontal" class="min-h-40">
|
|
1061
|
-
<UiResizablePanel :default-size="40">
|
|
1062
|
-
<div :class="[panelClasses, 'h-full']">Sidebar</div>
|
|
1063
|
-
</UiResizablePanel>
|
|
1064
|
-
<UiResizableHandle with-handle aria-label="Resize sidebar" />
|
|
1065
|
-
<UiResizablePanel :default-size="60">
|
|
1066
|
-
<div :class="[panelClasses, 'h-full']">Content</div>
|
|
1067
|
-
</UiResizablePanel>
|
|
1068
|
-
</UiResizablePanelGroup>
|
|
1069
|
-
</div>
|
|
1070
|
-
</div>
|
|
1071
|
-
|
|
1072
|
-
<div class="accessible-theme flex flex-col gap-3">
|
|
1073
|
-
<h3 class="label-m-medium text-center text-content-on-surface-primary">
|
|
1074
|
-
Accessible
|
|
1075
|
-
</h3>
|
|
1076
|
-
<div class="border border-border-surface-default p-4">
|
|
1077
|
-
<UiResizablePanelGroup direction="horizontal" class="min-h-40">
|
|
1078
|
-
<UiResizablePanel :default-size="40">
|
|
1079
|
-
<div :class="[panelClasses, 'h-full']">Sidebar</div>
|
|
1080
|
-
</UiResizablePanel>
|
|
1081
|
-
<UiResizableHandle with-handle aria-label="Resize sidebar" />
|
|
1082
|
-
<UiResizablePanel :default-size="60">
|
|
1083
|
-
<div :class="[panelClasses, 'h-full']">Content</div>
|
|
1084
|
-
</UiResizablePanel>
|
|
1085
|
-
</UiResizablePanelGroup>
|
|
1086
|
-
</div>
|
|
1087
|
-
</div>
|
|
1088
|
-
</div>
|
|
1089
|
-
</section>
|
|
1090
|
-
`,
|
|
1091
|
-
}),
|
|
1092
|
-
tags: ['!autodocs'],
|
|
1093
|
-
parameters: {
|
|
1094
|
-
a11y: { test: 'off' },
|
|
1095
|
-
chromatic: {
|
|
1096
|
-
disableSnapshot: true,
|
|
1097
|
-
},
|
|
1098
|
-
docs: {
|
|
1099
|
-
canvas: {
|
|
1100
|
-
sourceState: 'none',
|
|
1101
|
-
},
|
|
1102
|
-
},
|
|
1103
|
-
},
|
|
1104
|
-
};
|
|
1105
|
-
|
|
1106
1130
|
const keyboardNavigationTemplateSource = `<script setup lang="ts">
|
|
1107
1131
|
import {
|
|
1108
1132
|
UiResizableHandle,
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
figma: '29205:71181'
|
|
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 Select component holds a list of options behind a trigger and shows the chosen value in that trigger. It trades visibility for space: the user sees their answer rather than the alternatives.
|
|
10
|
+
|
|
11
|
+
Use it for choosing one value in a form. Radio Group is better when the options should be compared side by side, and Combobox is better once the list is long enough to need search.
|
|
12
|
+
|
|
13
|
+
### The trigger carries the answer
|
|
14
|
+
|
|
15
|
+
What the user sees when the menu is closed is most of the design:
|
|
16
|
+
|
|
17
|
+
- The trigger shows the chosen value, not a generic label
|
|
18
|
+
- The placeholder describes what to choose, and is clearly not a value
|
|
19
|
+
- The trigger is wide enough for the longest option it can hold
|
|
20
|
+
- Its state shows whether the menu is open, filled, focused or disabled
|
|
21
|
+
|
|
22
|
+
### Order and group the options
|
|
23
|
+
|
|
24
|
+
A closed list is only browsable once opened, so make that moment count:
|
|
25
|
+
|
|
26
|
+
1. Group labels where the options fall into kinds
|
|
27
|
+
2. The most likely options first within a group
|
|
28
|
+
3. The chosen option marked, and scrolled into view on opening
|
|
29
|
+
4. Scroll affordances at top and bottom when the list runs past the menu
|
|
30
|
+
|
|
31
|
+
### Consistency
|
|
32
|
+
|
|
33
|
+
Every select is built from the same parts:
|
|
34
|
+
|
|
35
|
+
- Select trigger, in seven states
|
|
36
|
+
- Select menu, holding the options
|
|
37
|
+
- Menu item, default or with a checkbox
|
|
38
|
+
- Menu label, grouping the options
|
|
39
|
+
- Scroll affordances at the top and bottom of a long menu
|
|
40
|
+
|
|
41
|
+
## Do
|
|
42
|
+
|
|
43
|
+
- Show the chosen value in the trigger
|
|
44
|
+
- Size the trigger for the longest option it can hold
|
|
45
|
+
- Group options under labels once there are kinds of them
|
|
46
|
+
- Mark the chosen option and scroll it into view when the menu opens
|
|
47
|
+
- Use a placeholder that says what to choose
|
|
48
|
+
- Use Radio Group instead when there are only a few options to compare
|
|
49
|
+
|
|
50
|
+
## Don't
|
|
51
|
+
|
|
52
|
+
- Leave the trigger showing a generic label after a choice is made
|
|
53
|
+
- Use a placeholder that could be mistaken for a value
|
|
54
|
+
- Let the trigger resize as the chosen value changes
|
|
55
|
+
- Offer a long unstructured list — group it, or use Combobox
|
|
56
|
+
- Rely on colour alone to mark the chosen option
|
|
57
|
+
- Use Select for actions — use Dropdown Menu
|
|
58
|
+
|
|
59
|
+
## Accessibility
|
|
60
|
+
|
|
61
|
+
- The chosen option is marked by a check or a checkbox, not by colour alone
|
|
62
|
+
- Hovered and chosen options are distinguishable from each other
|
|
63
|
+
- The trigger's focus state is distinct from its open, filled and disabled states
|
|
64
|
+
- The trigger keeps a stable width, so the layout does not shift when a value changes
|
|
65
|
+
- Placeholder text is visually distinct from a real value, and is not the field's only label
|
|
66
|
+
- Menu items stay comfortable targets, and the scroll affordances are visible on a long list
|