@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
|
@@ -12,6 +12,16 @@ import {
|
|
|
12
12
|
UiFieldTitle,
|
|
13
13
|
} from '../UiField';
|
|
14
14
|
import { reactive, ref, watch } from 'vue';
|
|
15
|
+
import {
|
|
16
|
+
accessibilityRequirementsTemplate,
|
|
17
|
+
designNotesStory,
|
|
18
|
+
guidanceLinks,
|
|
19
|
+
guidanceSectionClass,
|
|
20
|
+
parseGuidance,
|
|
21
|
+
} from '../../../.storybook/guidance';
|
|
22
|
+
import guidanceMarkdown from './UiSwitch.guidance.md?raw';
|
|
23
|
+
|
|
24
|
+
const guidance = parseGuidance(guidanceMarkdown);
|
|
15
25
|
|
|
16
26
|
/**
|
|
17
27
|
* UiSwitch is a toggle control that flips a single setting between on and off.
|
|
@@ -43,6 +53,9 @@ const meta: Meta<typeof UiSwitch> = {
|
|
|
43
53
|
modelValue: false,
|
|
44
54
|
size: 'default',
|
|
45
55
|
},
|
|
56
|
+
parameters: {
|
|
57
|
+
docs: { links: guidanceLinks(guidance) },
|
|
58
|
+
},
|
|
46
59
|
};
|
|
47
60
|
|
|
48
61
|
export default meta;
|
|
@@ -127,6 +140,163 @@ export const Default: Story = {
|
|
|
127
140
|
},
|
|
128
141
|
};
|
|
129
142
|
|
|
143
|
+
/**
|
|
144
|
+
* Usage, guidelines, and do's and don'ts from the Figma documentation.
|
|
145
|
+
*/
|
|
146
|
+
export const DesignNotes: Story = {
|
|
147
|
+
...designNotesStory(guidance),
|
|
148
|
+
tags: ['!autodocs'],
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Accessibility guidance for switches: a visible label that also enlarges the
|
|
153
|
+
* tap target, state that survives without colour, and an explicit name when the
|
|
154
|
+
* label text is dynamic — shown side by side in the default and accessible
|
|
155
|
+
* themes.
|
|
156
|
+
*/
|
|
157
|
+
export const Accessibility: Story = {
|
|
158
|
+
tags: ['!autodocs'],
|
|
159
|
+
parameters: {
|
|
160
|
+
surface: 'primary',
|
|
161
|
+
a11y: { test: 'off' },
|
|
162
|
+
chromatic: { disableSnapshot: true },
|
|
163
|
+
controls: { disable: true },
|
|
164
|
+
docs: {
|
|
165
|
+
canvas: {
|
|
166
|
+
sourceState: 'none',
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
render: () => ({
|
|
171
|
+
components: { UiSwitch },
|
|
172
|
+
setup() {
|
|
173
|
+
const defaultEnabled = ref(true);
|
|
174
|
+
const accessibleEnabled = ref(true);
|
|
175
|
+
return { defaultEnabled, accessibleEnabled };
|
|
176
|
+
},
|
|
177
|
+
template: `
|
|
178
|
+
<section class="${guidanceSectionClass}">
|
|
179
|
+
<div>
|
|
180
|
+
<h2 class="heading-m font-bold text-content-on-surface-primary">
|
|
181
|
+
Accessibility
|
|
182
|
+
</h2>
|
|
183
|
+
</div>
|
|
184
|
+
|
|
185
|
+
${accessibilityRequirementsTemplate(guidance.accessibility, 'Requirements')}
|
|
186
|
+
|
|
187
|
+
<div class="flex flex-col gap-6">
|
|
188
|
+
<div class="flex flex-col gap-2">
|
|
189
|
+
<h3 class="body-m-medium text-content-on-surface-primary">
|
|
190
|
+
Always pair the switch with a visible label
|
|
191
|
+
</h3>
|
|
192
|
+
<p class="body-m-regular text-content-on-surface-primary">
|
|
193
|
+
Give <code>UiSwitch</code> an <code>id</code> and point a
|
|
194
|
+
<code><label for="…"></code> at it. The label becomes the
|
|
195
|
+
accessible name and makes the text part of the activation target.
|
|
196
|
+
</p>
|
|
197
|
+
</div>
|
|
198
|
+
|
|
199
|
+
<div class="flex flex-col gap-2">
|
|
200
|
+
<h3 class="body-m-medium text-content-on-surface-primary">
|
|
201
|
+
Give the switch a big enough target
|
|
202
|
+
</h3>
|
|
203
|
+
<p class="body-m-regular text-content-on-surface-primary">
|
|
204
|
+
The track alone is 36×20px, which is under the 24px minimum height
|
|
205
|
+
in WCAG 2.5.8. Rely on the label to extend the target, and give the
|
|
206
|
+
row some vertical padding so the whole row is comfortably tappable.
|
|
207
|
+
</p>
|
|
208
|
+
</div>
|
|
209
|
+
|
|
210
|
+
<div class="flex flex-col gap-2">
|
|
211
|
+
<h3 class="body-m-medium text-content-on-surface-primary">
|
|
212
|
+
Name the state in the label, not in the track colour
|
|
213
|
+
</h3>
|
|
214
|
+
<p class="body-m-regular text-content-on-surface-primary">
|
|
215
|
+
On and off are announced through <code>aria-checked</code>, which
|
|
216
|
+
the component sets for you. Keep the label describing what the
|
|
217
|
+
setting does ("Airplane Mode"), not its current value ("On"), so it
|
|
218
|
+
stays correct in both states (WCAG 1.4.1).
|
|
219
|
+
</p>
|
|
220
|
+
</div>
|
|
221
|
+
|
|
222
|
+
<div class="flex flex-col gap-2">
|
|
223
|
+
<h3 class="body-m-medium text-content-on-surface-primary">
|
|
224
|
+
Set an explicit name when the label text changes
|
|
225
|
+
</h3>
|
|
226
|
+
<p class="body-m-regular text-content-on-surface-primary">
|
|
227
|
+
The name is read from the associated label once, when the switch
|
|
228
|
+
mounts. If the label text can change at runtime, pass your own
|
|
229
|
+
<code>aria-label</code> or <code>aria-labelledby</code> so the name
|
|
230
|
+
stays in sync.
|
|
231
|
+
</p>
|
|
232
|
+
</div>
|
|
233
|
+
|
|
234
|
+
<div class="flex flex-col gap-2">
|
|
235
|
+
<h3 class="body-m-medium text-content-on-surface-primary">
|
|
236
|
+
Use a switch only for instant changes
|
|
237
|
+
</h3>
|
|
238
|
+
<p class="body-m-regular text-content-on-surface-primary">
|
|
239
|
+
A switch applies immediately and has no "off" value to submit. For
|
|
240
|
+
a value that is saved with a form, use <code>UiCheckbox</code>.
|
|
241
|
+
</p>
|
|
242
|
+
</div>
|
|
243
|
+
|
|
244
|
+
<div class="flex flex-col gap-2">
|
|
245
|
+
<h3 class="body-m-medium text-content-on-surface-primary">
|
|
246
|
+
Enable accessibility theme
|
|
247
|
+
</h3>
|
|
248
|
+
<p class="body-m-regular text-content-on-surface-primary">
|
|
249
|
+
When accessibility is required, enable our accessibility theme.
|
|
250
|
+
This increases contrast and makes sure there are no color contrast
|
|
251
|
+
issues.
|
|
252
|
+
</p>
|
|
253
|
+
</div>
|
|
254
|
+
</div>
|
|
255
|
+
|
|
256
|
+
<div class="grid gap-4 md:grid-cols-2">
|
|
257
|
+
<div class="flex flex-col gap-3">
|
|
258
|
+
<h3 class="label-m-medium text-center text-content-on-surface-primary">
|
|
259
|
+
Default
|
|
260
|
+
</h3>
|
|
261
|
+
<div class="flex min-h-20 items-center justify-center border border-border-surface-default p-6">
|
|
262
|
+
<label
|
|
263
|
+
for="switch-accessibility-default"
|
|
264
|
+
class="flex min-h-6 cursor-pointer items-center gap-x-3 py-1 label-s-medium text-content-on-surface-primary"
|
|
265
|
+
>
|
|
266
|
+
<UiSwitch
|
|
267
|
+
id="switch-accessibility-default"
|
|
268
|
+
v-model="defaultEnabled"
|
|
269
|
+
name="switch-accessibility-default"
|
|
270
|
+
/>
|
|
271
|
+
<span>Airplane Mode</span>
|
|
272
|
+
</label>
|
|
273
|
+
</div>
|
|
274
|
+
</div>
|
|
275
|
+
|
|
276
|
+
<div class="accessible-theme flex flex-col gap-3">
|
|
277
|
+
<h3 class="label-m-medium text-center text-content-on-surface-primary">
|
|
278
|
+
Accessible
|
|
279
|
+
</h3>
|
|
280
|
+
<div class="flex min-h-20 items-center justify-center border border-border-surface-default p-6">
|
|
281
|
+
<label
|
|
282
|
+
for="switch-accessibility-accessible"
|
|
283
|
+
class="flex min-h-6 cursor-pointer items-center gap-x-3 py-1 label-s-medium text-content-on-surface-primary"
|
|
284
|
+
>
|
|
285
|
+
<UiSwitch
|
|
286
|
+
id="switch-accessibility-accessible"
|
|
287
|
+
v-model="accessibleEnabled"
|
|
288
|
+
name="switch-accessibility-accessible"
|
|
289
|
+
/>
|
|
290
|
+
<span>Airplane Mode</span>
|
|
291
|
+
</label>
|
|
292
|
+
</div>
|
|
293
|
+
</div>
|
|
294
|
+
</div>
|
|
295
|
+
</section>
|
|
296
|
+
`,
|
|
297
|
+
}),
|
|
298
|
+
};
|
|
299
|
+
|
|
130
300
|
const checkedTemplateSource = `<script setup lang="ts">
|
|
131
301
|
import { ref } from 'vue'
|
|
132
302
|
import { UiSwitch } from '@aleph-alpha/ui-library'
|
|
@@ -856,152 +1026,6 @@ export const WithField: Story = {
|
|
|
856
1026
|
);
|
|
857
1027
|
},
|
|
858
1028
|
};
|
|
859
|
-
/**
|
|
860
|
-
* Accessibility guidance for switches: a visible label that also enlarges the
|
|
861
|
-
* tap target, state that survives without colour, and an explicit name when the
|
|
862
|
-
* label text is dynamic — shown side by side in the default and accessible
|
|
863
|
-
* themes.
|
|
864
|
-
*/
|
|
865
|
-
export const Accessibility: Story = {
|
|
866
|
-
tags: ['!autodocs'],
|
|
867
|
-
parameters: {
|
|
868
|
-
a11y: { test: 'off' },
|
|
869
|
-
chromatic: { disableSnapshot: true },
|
|
870
|
-
controls: { disable: true },
|
|
871
|
-
docs: {
|
|
872
|
-
canvas: {
|
|
873
|
-
sourceState: 'none',
|
|
874
|
-
},
|
|
875
|
-
},
|
|
876
|
-
},
|
|
877
|
-
render: () => ({
|
|
878
|
-
components: { UiSwitch },
|
|
879
|
-
setup() {
|
|
880
|
-
const defaultEnabled = ref(true);
|
|
881
|
-
const accessibleEnabled = ref(true);
|
|
882
|
-
return { defaultEnabled, accessibleEnabled };
|
|
883
|
-
},
|
|
884
|
-
template: `
|
|
885
|
-
<section class="flex flex-col gap-6 p-4">
|
|
886
|
-
<div>
|
|
887
|
-
<h2 class="heading-m font-bold text-content-on-surface-primary">
|
|
888
|
-
Accessibility
|
|
889
|
-
</h2>
|
|
890
|
-
</div>
|
|
891
|
-
|
|
892
|
-
<div class="flex flex-col gap-6">
|
|
893
|
-
<div class="flex flex-col gap-2">
|
|
894
|
-
<h3 class="body-m-medium text-content-on-surface-primary">
|
|
895
|
-
Always pair the switch with a visible label
|
|
896
|
-
</h3>
|
|
897
|
-
<p class="body-m-regular text-content-on-surface-primary">
|
|
898
|
-
Give <code>UiSwitch</code> an <code>id</code> and point a
|
|
899
|
-
<code><label for="…"></code> at it. The label becomes the
|
|
900
|
-
accessible name and makes the text part of the activation target.
|
|
901
|
-
</p>
|
|
902
|
-
</div>
|
|
903
|
-
|
|
904
|
-
<div class="flex flex-col gap-2">
|
|
905
|
-
<h3 class="body-m-medium text-content-on-surface-primary">
|
|
906
|
-
Give the switch a big enough target
|
|
907
|
-
</h3>
|
|
908
|
-
<p class="body-m-regular text-content-on-surface-primary">
|
|
909
|
-
The track alone is 36×20px, which is under the 24px minimum height
|
|
910
|
-
in WCAG 2.5.8. Rely on the label to extend the target, and give the
|
|
911
|
-
row some vertical padding so the whole row is comfortably tappable.
|
|
912
|
-
</p>
|
|
913
|
-
</div>
|
|
914
|
-
|
|
915
|
-
<div class="flex flex-col gap-2">
|
|
916
|
-
<h3 class="body-m-medium text-content-on-surface-primary">
|
|
917
|
-
Name the state in the label, not in the track colour
|
|
918
|
-
</h3>
|
|
919
|
-
<p class="body-m-regular text-content-on-surface-primary">
|
|
920
|
-
On and off are announced through <code>aria-checked</code>, which
|
|
921
|
-
the component sets for you. Keep the label describing what the
|
|
922
|
-
setting does ("Airplane Mode"), not its current value ("On"), so it
|
|
923
|
-
stays correct in both states (WCAG 1.4.1).
|
|
924
|
-
</p>
|
|
925
|
-
</div>
|
|
926
|
-
|
|
927
|
-
<div class="flex flex-col gap-2">
|
|
928
|
-
<h3 class="body-m-medium text-content-on-surface-primary">
|
|
929
|
-
Set an explicit name when the label text changes
|
|
930
|
-
</h3>
|
|
931
|
-
<p class="body-m-regular text-content-on-surface-primary">
|
|
932
|
-
The name is read from the associated label once, when the switch
|
|
933
|
-
mounts. If the label text can change at runtime, pass your own
|
|
934
|
-
<code>aria-label</code> or <code>aria-labelledby</code> so the name
|
|
935
|
-
stays in sync.
|
|
936
|
-
</p>
|
|
937
|
-
</div>
|
|
938
|
-
|
|
939
|
-
<div class="flex flex-col gap-2">
|
|
940
|
-
<h3 class="body-m-medium text-content-on-surface-primary">
|
|
941
|
-
Use a switch only for instant changes
|
|
942
|
-
</h3>
|
|
943
|
-
<p class="body-m-regular text-content-on-surface-primary">
|
|
944
|
-
A switch applies immediately and has no "off" value to submit. For
|
|
945
|
-
a value that is saved with a form, use <code>UiCheckbox</code>.
|
|
946
|
-
</p>
|
|
947
|
-
</div>
|
|
948
|
-
|
|
949
|
-
<div class="flex flex-col gap-2">
|
|
950
|
-
<h3 class="body-m-medium text-content-on-surface-primary">
|
|
951
|
-
Enable accessibility theme
|
|
952
|
-
</h3>
|
|
953
|
-
<p class="body-m-regular text-content-on-surface-primary">
|
|
954
|
-
When accessibility is required, enable our accessibility theme.
|
|
955
|
-
This increases contrast and makes sure there are no color contrast
|
|
956
|
-
issues.
|
|
957
|
-
</p>
|
|
958
|
-
</div>
|
|
959
|
-
</div>
|
|
960
|
-
|
|
961
|
-
<div class="grid gap-4 md:grid-cols-2">
|
|
962
|
-
<div class="flex flex-col gap-3">
|
|
963
|
-
<h3 class="label-m-medium text-center text-content-on-surface-primary">
|
|
964
|
-
Default
|
|
965
|
-
</h3>
|
|
966
|
-
<div class="flex min-h-20 items-center justify-center border border-border-surface-default p-6">
|
|
967
|
-
<label
|
|
968
|
-
for="switch-accessibility-default"
|
|
969
|
-
class="flex min-h-6 cursor-pointer items-center gap-x-3 py-1 label-s-medium text-content-on-surface-primary"
|
|
970
|
-
>
|
|
971
|
-
<UiSwitch
|
|
972
|
-
id="switch-accessibility-default"
|
|
973
|
-
v-model="defaultEnabled"
|
|
974
|
-
name="switch-accessibility-default"
|
|
975
|
-
/>
|
|
976
|
-
<span>Airplane Mode</span>
|
|
977
|
-
</label>
|
|
978
|
-
</div>
|
|
979
|
-
</div>
|
|
980
|
-
|
|
981
|
-
<div class="accessible-theme flex flex-col gap-3">
|
|
982
|
-
<h3 class="label-m-medium text-center text-content-on-surface-primary">
|
|
983
|
-
Accessible
|
|
984
|
-
</h3>
|
|
985
|
-
<div class="flex min-h-20 items-center justify-center border border-border-surface-default p-6">
|
|
986
|
-
<label
|
|
987
|
-
for="switch-accessibility-accessible"
|
|
988
|
-
class="flex min-h-6 cursor-pointer items-center gap-x-3 py-1 label-s-medium text-content-on-surface-primary"
|
|
989
|
-
>
|
|
990
|
-
<UiSwitch
|
|
991
|
-
id="switch-accessibility-accessible"
|
|
992
|
-
v-model="accessibleEnabled"
|
|
993
|
-
name="switch-accessibility-accessible"
|
|
994
|
-
/>
|
|
995
|
-
<span>Airplane Mode</span>
|
|
996
|
-
</label>
|
|
997
|
-
</div>
|
|
998
|
-
</div>
|
|
999
|
-
</div>
|
|
1000
|
-
</section>
|
|
1001
|
-
`,
|
|
1002
|
-
}),
|
|
1003
|
-
};
|
|
1004
|
-
|
|
1005
1029
|
// Test-only stories drive the test-runner (interactive/a11y checks) but are
|
|
1006
1030
|
// hidden from the Storybook sidebar and docs via the `!dev` / `!autodocs`
|
|
1007
1031
|
// tags. They keep the implicit `test` tag, so they still run in CI and appear
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
figma: '29209:71540'
|
|
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 Table component presents rows so they can be read and compared. It is a way of laying out information, not a workspace: nothing in it filters, sorts or acts.
|
|
10
|
+
|
|
11
|
+
Use it where the rows are read. When people come to interrogate the data — filtering, sorting, selecting, acting — Data Table is the right component.
|
|
12
|
+
|
|
13
|
+
### Columns are the contract
|
|
14
|
+
|
|
15
|
+
A table is only comparable if the columns hold:
|
|
16
|
+
|
|
17
|
+
- One kind of value per column, all the way down
|
|
18
|
+
- Numbers right-aligned, text left-aligned, with consistent precision
|
|
19
|
+
- Headers naming the value, not the field
|
|
20
|
+
- Column order following the order the reader thinks in
|
|
21
|
+
|
|
22
|
+
### Let cells carry their own type
|
|
23
|
+
|
|
24
|
+
Cells hold more than text, so use the type that reads fastest:
|
|
25
|
+
|
|
26
|
+
1. Default text for plain values
|
|
27
|
+
2. Badge where the value is a status
|
|
28
|
+
3. Avatar where the value is a person
|
|
29
|
+
4. Checkbox or switch where a row carries a setting
|
|
30
|
+
|
|
31
|
+
### Consistency
|
|
32
|
+
|
|
33
|
+
Every table is built from the same parts:
|
|
34
|
+
|
|
35
|
+
- Table, with a header row and body rows
|
|
36
|
+
- Table head, with default and hover states
|
|
37
|
+
- Table cell: default, badge, checkbox, switch or avatar
|
|
38
|
+
- Last-cell treatment, closing the row
|
|
39
|
+
- One row height per table
|
|
40
|
+
|
|
41
|
+
## Do
|
|
42
|
+
|
|
43
|
+
- Keep one kind of value per column
|
|
44
|
+
- Right-align numbers and keep their precision consistent down a column
|
|
45
|
+
- Name the value in the header, in the reader's words
|
|
46
|
+
- Use the badge cell for status, so it reads without the column header
|
|
47
|
+
- Keep one row height throughout a table
|
|
48
|
+
- Let long text wrap or truncate the same way in every row
|
|
49
|
+
|
|
50
|
+
## Don't
|
|
51
|
+
|
|
52
|
+
- Mix two kinds of value in one column
|
|
53
|
+
- Centre-align numbers
|
|
54
|
+
- Use a table for layout rather than for data
|
|
55
|
+
- Vary row height within one table
|
|
56
|
+
- Use a table where filtering and sorting are needed — use Data Table
|
|
57
|
+
- Rely on row colour alone to convey status
|
|
58
|
+
|
|
59
|
+
## Accessibility
|
|
60
|
+
|
|
61
|
+
- The header row is clearly distinguishable from the body, by weight and surface
|
|
62
|
+
- Status is carried by a badge with a word, never by row or cell colour alone
|
|
63
|
+
- Row hover is distinguishable from any selected or highlighted state
|
|
64
|
+
- Column alignment is consistent, so a column can be scanned without drifting
|
|
65
|
+
- Row height leaves text comfortably legible and cell controls comfortably hittable
|
|
66
|
+
- Long values truncate consistently, never in the part that identifies the row
|