@aleph-alpha/ui-library 7.0.1 → 7.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/system/components/UiSlider/step-marks.d.ts +45 -0
- package/dist/system/components/UiSlider/types.d.ts +28 -0
- package/dist/system/components/core/slider/Slider.vue.d.ts +21 -1
- package/dist/system/icons/story-sidebar-icons.json +74 -17
- package/dist/system/lib.js +2026 -1912
- package/dist/system/patterns/UiPlaceholder/types.d.ts +1 -0
- package/dist/system/story-sidebar-icons.json +74 -17
- package/package.json +15 -10
- 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 +885 -153
- package/src/components/UiSlider/UiSlider.vue +109 -1
- package/src/components/UiSlider/__tests__/UiSliderValueAndSteps.test.ts +210 -0
- package/src/components/UiSlider/__tests__/step-marks.test.ts +94 -0
- package/src/components/UiSlider/step-marks.ts +96 -0
- package/src/components/UiSlider/types.ts +32 -0
- 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/components/core/slider/Slider.vue +16 -6
- 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 +86 -84
- package/src/patterns/UiTopBar/UiTopBar.stories.ts +84 -82
|
@@ -21,17 +21,28 @@ import { UiFileItem } from '@/components/UiFileItem';
|
|
|
21
21
|
import { UiIcon } from '@/components/UiIcon';
|
|
22
22
|
import { formatFileSize } from '@/components/UiFileUploadBox/file-validation';
|
|
23
23
|
import UiFileUpload from './UiFileUpload.vue';
|
|
24
|
+
import {
|
|
25
|
+
designNotesStory,
|
|
26
|
+
guidanceLinks,
|
|
27
|
+
guidanceSectionClass,
|
|
28
|
+
parseGuidance,
|
|
29
|
+
} from '../../../.storybook/guidance';
|
|
30
|
+
import guidanceMarkdown from './UiFileUpload.guidance.md?raw';
|
|
31
|
+
|
|
32
|
+
const guidance = parseGuidance(guidanceMarkdown);
|
|
24
33
|
|
|
25
34
|
const meta: Meta<typeof UiFileUpload> = {
|
|
26
35
|
title: 'Patterns/UiFileUpload/UiFileUpload',
|
|
27
36
|
component: UiFileUpload,
|
|
28
37
|
tags: ['autodocs'],
|
|
29
38
|
decorators: [
|
|
30
|
-
// The
|
|
31
|
-
//
|
|
39
|
+
// The guidance stories render two columns side by side, so they need more
|
|
40
|
+
// room than the single-uploader stories.
|
|
32
41
|
(story, context) => ({
|
|
33
42
|
template: `<div class="w-full p-4 ${
|
|
34
|
-
|
|
43
|
+
['Accessibility', 'Design Notes'].includes(context.name)
|
|
44
|
+
? 'max-w-3xl'
|
|
45
|
+
: 'max-w-lg'
|
|
35
46
|
}"><story /></div>`,
|
|
36
47
|
}),
|
|
37
48
|
],
|
|
@@ -68,6 +79,9 @@ const meta: Meta<typeof UiFileUpload> = {
|
|
|
68
79
|
chooseLabel: { control: 'text' },
|
|
69
80
|
ariaLabel: { control: 'text' },
|
|
70
81
|
},
|
|
82
|
+
parameters: {
|
|
83
|
+
docs: { links: guidanceLinks(guidance) },
|
|
84
|
+
},
|
|
71
85
|
};
|
|
72
86
|
|
|
73
87
|
export default meta;
|
|
@@ -631,6 +645,158 @@ export const Default: Story = {
|
|
|
631
645
|
},
|
|
632
646
|
};
|
|
633
647
|
|
|
648
|
+
/**
|
|
649
|
+
* Design guidance for the upload surface: stating the rules up front and
|
|
650
|
+
* reporting the outcome of every file.
|
|
651
|
+
*/
|
|
652
|
+
export const DesignNotes: Story = {
|
|
653
|
+
...designNotesStory(guidance),
|
|
654
|
+
tags: ['!autodocs'],
|
|
655
|
+
};
|
|
656
|
+
|
|
657
|
+
/**
|
|
658
|
+
* Accessibility guidance for the uploader: an interactive drop zone at rest,
|
|
659
|
+
* drag-over shown beyond colour, progress/success/error distinguishable by
|
|
660
|
+
* icon and text, legible in-row error text, comfortable remove/menu targets,
|
|
661
|
+
* and visible focus — shown side by side in the default and accessible themes.
|
|
662
|
+
*/
|
|
663
|
+
export const Accessibility: Story = {
|
|
664
|
+
render: () => ({
|
|
665
|
+
components: { UiFileItem },
|
|
666
|
+
template: `
|
|
667
|
+
<section class="${guidanceSectionClass}">
|
|
668
|
+
<div>
|
|
669
|
+
<h2 class="heading-m font-bold text-content-on-surface-primary">
|
|
670
|
+
Accessibility
|
|
671
|
+
</h2>
|
|
672
|
+
</div>
|
|
673
|
+
|
|
674
|
+
<div class="flex flex-col gap-6">
|
|
675
|
+
<div class="flex flex-col gap-2">
|
|
676
|
+
<h3 class="body-m-medium text-content-on-surface-primary">
|
|
677
|
+
Requirements
|
|
678
|
+
</h3>
|
|
679
|
+
<ul class="body-m-regular flex list-disc flex-col gap-1 pl-6 text-content-on-surface-primary">
|
|
680
|
+
<li>
|
|
681
|
+
The drop zone reads as an interactive target at rest, not only
|
|
682
|
+
while a file is dragged over it
|
|
683
|
+
</li>
|
|
684
|
+
<li>
|
|
685
|
+
Drag over is shown by border and fill together, so the change
|
|
686
|
+
survives without colour
|
|
687
|
+
</li>
|
|
688
|
+
<li>
|
|
689
|
+
Progress, processing, success and error are each distinguishable
|
|
690
|
+
by icon and text, never by colour alone. Processing keeps the
|
|
691
|
+
neutral badge and says so in text
|
|
692
|
+
</li>
|
|
693
|
+
<li>
|
|
694
|
+
Error text sits in the row it belongs to and stays legible at
|
|
695
|
+
the small size
|
|
696
|
+
</li>
|
|
697
|
+
<li>
|
|
698
|
+
Remove and the multi-file chevron stay comfortable targets for
|
|
699
|
+
touch as well as pointer. The chevron opens a list where each
|
|
700
|
+
file keeps the icon for its type
|
|
701
|
+
</li>
|
|
702
|
+
<li>
|
|
703
|
+
Focus is clearly visible on the picker, on each file row and on
|
|
704
|
+
its controls
|
|
705
|
+
</li>
|
|
706
|
+
</ul>
|
|
707
|
+
</div>
|
|
708
|
+
|
|
709
|
+
<div class="flex flex-col gap-2">
|
|
710
|
+
<h3 class="body-m-medium text-content-on-surface-primary">
|
|
711
|
+
Enable accessibility theme
|
|
712
|
+
</h3>
|
|
713
|
+
<p class="body-m-regular text-content-on-surface-primary">
|
|
714
|
+
When accessibility is required, enable our accessibility theme.
|
|
715
|
+
This increases contrast and ensures there are no color contrast
|
|
716
|
+
issues.
|
|
717
|
+
</p>
|
|
718
|
+
</div>
|
|
719
|
+
</div>
|
|
720
|
+
|
|
721
|
+
<div class="grid gap-4 md:grid-cols-2">
|
|
722
|
+
<div class="flex flex-col gap-3">
|
|
723
|
+
<h3 class="label-m-medium text-center text-content-on-surface-primary">
|
|
724
|
+
Default
|
|
725
|
+
</h3>
|
|
726
|
+
<div class="flex min-h-20 flex-col justify-center gap-3 border border-border-surface-default p-6">
|
|
727
|
+
<UiFileItem
|
|
728
|
+
filename="Filename.pdf"
|
|
729
|
+
type-label="PDF"
|
|
730
|
+
processing
|
|
731
|
+
processing-label="Processing…"
|
|
732
|
+
remove-label="Remove Filename.pdf"
|
|
733
|
+
/>
|
|
734
|
+
<UiFileItem
|
|
735
|
+
filename="Filename"
|
|
736
|
+
error="Upload failed"
|
|
737
|
+
remove-label="Remove Filename"
|
|
738
|
+
/>
|
|
739
|
+
<UiFileItem
|
|
740
|
+
filename="Attached documents"
|
|
741
|
+
type-label="2 files"
|
|
742
|
+
expand-label="Show attached documents"
|
|
743
|
+
:removable="false"
|
|
744
|
+
:items="[
|
|
745
|
+
{ filename: 'Plan.pdf', typeLabel: 'PDF', sizeLabel: '12 MB' },
|
|
746
|
+
{ filename: 'Notes.md', typeLabel: 'MD', sizeLabel: '12 KB' },
|
|
747
|
+
]"
|
|
748
|
+
/>
|
|
749
|
+
</div>
|
|
750
|
+
</div>
|
|
751
|
+
|
|
752
|
+
<div class="accessible-theme flex flex-col gap-3">
|
|
753
|
+
<h3 class="label-m-medium text-center text-content-on-surface-primary">
|
|
754
|
+
Accessible
|
|
755
|
+
</h3>
|
|
756
|
+
<div class="flex min-h-20 flex-col justify-center gap-3 border border-border-surface-default p-6">
|
|
757
|
+
<UiFileItem
|
|
758
|
+
filename="Filename.pdf"
|
|
759
|
+
type-label="PDF"
|
|
760
|
+
processing
|
|
761
|
+
processing-label="Processing…"
|
|
762
|
+
remove-label="Remove Filename.pdf"
|
|
763
|
+
/>
|
|
764
|
+
<UiFileItem
|
|
765
|
+
filename="Filename"
|
|
766
|
+
error="Upload failed"
|
|
767
|
+
remove-label="Remove Filename"
|
|
768
|
+
/>
|
|
769
|
+
<UiFileItem
|
|
770
|
+
filename="Attached documents"
|
|
771
|
+
type-label="2 files"
|
|
772
|
+
expand-label="Show attached documents"
|
|
773
|
+
:removable="false"
|
|
774
|
+
:items="[
|
|
775
|
+
{ filename: 'Plan.pdf', typeLabel: 'PDF', sizeLabel: '12 MB' },
|
|
776
|
+
{ filename: 'Notes.md', typeLabel: 'MD', sizeLabel: '12 KB' },
|
|
777
|
+
]"
|
|
778
|
+
/>
|
|
779
|
+
</div>
|
|
780
|
+
</div>
|
|
781
|
+
</div>
|
|
782
|
+
</section>
|
|
783
|
+
`,
|
|
784
|
+
}),
|
|
785
|
+
tags: ['!autodocs'],
|
|
786
|
+
parameters: {
|
|
787
|
+
surface: 'primary',
|
|
788
|
+
a11y: { test: 'off' },
|
|
789
|
+
chromatic: {
|
|
790
|
+
disableSnapshot: true,
|
|
791
|
+
},
|
|
792
|
+
docs: {
|
|
793
|
+
canvas: {
|
|
794
|
+
sourceState: 'none',
|
|
795
|
+
},
|
|
796
|
+
},
|
|
797
|
+
},
|
|
798
|
+
};
|
|
799
|
+
|
|
634
800
|
/**
|
|
635
801
|
* Mock upload flow: each valid file shows a **progress** bar until 100%, then the bar **hides** (`progress` cleared) so the row reads as uploaded. Open the dialog and add files to watch it.
|
|
636
802
|
*/
|
|
@@ -812,148 +978,6 @@ export const DragOver: Story = {
|
|
|
812
978
|
},
|
|
813
979
|
};
|
|
814
980
|
|
|
815
|
-
/**
|
|
816
|
-
* Accessibility guidance for the uploader: an interactive drop zone at rest,
|
|
817
|
-
* drag-over shown beyond colour, progress/success/error distinguishable by
|
|
818
|
-
* icon and text, legible in-row error text, comfortable remove/menu targets,
|
|
819
|
-
* and visible focus — shown side by side in the default and accessible themes.
|
|
820
|
-
*/
|
|
821
|
-
export const Accessibility: Story = {
|
|
822
|
-
render: () => ({
|
|
823
|
-
components: { UiFileItem },
|
|
824
|
-
template: `
|
|
825
|
-
<section class="flex flex-col gap-6 p-4">
|
|
826
|
-
<div>
|
|
827
|
-
<h2 class="heading-m font-bold text-content-on-surface-primary">
|
|
828
|
-
Accessibility
|
|
829
|
-
</h2>
|
|
830
|
-
</div>
|
|
831
|
-
|
|
832
|
-
<div class="flex flex-col gap-6">
|
|
833
|
-
<div class="flex flex-col gap-2">
|
|
834
|
-
<h3 class="body-m-medium text-content-on-surface-primary">
|
|
835
|
-
Requirements
|
|
836
|
-
</h3>
|
|
837
|
-
<ul class="body-m-regular flex list-disc flex-col gap-1 pl-6 text-content-on-surface-primary">
|
|
838
|
-
<li>
|
|
839
|
-
The drop zone reads as an interactive target at rest, not only
|
|
840
|
-
while a file is dragged over it
|
|
841
|
-
</li>
|
|
842
|
-
<li>
|
|
843
|
-
Drag over is shown by border and fill together, so the change
|
|
844
|
-
survives without colour
|
|
845
|
-
</li>
|
|
846
|
-
<li>
|
|
847
|
-
Progress, processing, success and error are each distinguishable
|
|
848
|
-
by icon and text, never by colour alone. Processing keeps the
|
|
849
|
-
neutral badge and says so in text
|
|
850
|
-
</li>
|
|
851
|
-
<li>
|
|
852
|
-
Error text sits in the row it belongs to and stays legible at
|
|
853
|
-
the small size
|
|
854
|
-
</li>
|
|
855
|
-
<li>
|
|
856
|
-
Remove and the multi-file chevron stay comfortable targets for
|
|
857
|
-
touch as well as pointer. The chevron opens a list where each
|
|
858
|
-
file keeps the icon for its type
|
|
859
|
-
</li>
|
|
860
|
-
<li>
|
|
861
|
-
Focus is clearly visible on the picker, on each file row and on
|
|
862
|
-
its controls
|
|
863
|
-
</li>
|
|
864
|
-
</ul>
|
|
865
|
-
</div>
|
|
866
|
-
|
|
867
|
-
<div class="flex flex-col gap-2">
|
|
868
|
-
<h3 class="body-m-medium text-content-on-surface-primary">
|
|
869
|
-
Enable accessibility theme
|
|
870
|
-
</h3>
|
|
871
|
-
<p class="body-m-regular text-content-on-surface-primary">
|
|
872
|
-
When accessibility is required, enable our accessibility theme.
|
|
873
|
-
This increases contrast and ensures there are no color contrast
|
|
874
|
-
issues.
|
|
875
|
-
</p>
|
|
876
|
-
</div>
|
|
877
|
-
</div>
|
|
878
|
-
|
|
879
|
-
<div class="grid gap-4 md:grid-cols-2">
|
|
880
|
-
<div class="flex flex-col gap-3">
|
|
881
|
-
<h3 class="label-m-medium text-center text-content-on-surface-primary">
|
|
882
|
-
Default
|
|
883
|
-
</h3>
|
|
884
|
-
<div class="flex min-h-20 flex-col justify-center gap-3 border border-border-surface-default p-6">
|
|
885
|
-
<UiFileItem
|
|
886
|
-
filename="Filename.pdf"
|
|
887
|
-
type-label="PDF"
|
|
888
|
-
processing
|
|
889
|
-
processing-label="Processing…"
|
|
890
|
-
remove-label="Remove Filename.pdf"
|
|
891
|
-
/>
|
|
892
|
-
<UiFileItem
|
|
893
|
-
filename="Filename"
|
|
894
|
-
error="Upload failed"
|
|
895
|
-
remove-label="Remove Filename"
|
|
896
|
-
/>
|
|
897
|
-
<UiFileItem
|
|
898
|
-
filename="Attached documents"
|
|
899
|
-
type-label="2 files"
|
|
900
|
-
expand-label="Show attached documents"
|
|
901
|
-
:removable="false"
|
|
902
|
-
:items="[
|
|
903
|
-
{ filename: 'Plan.pdf', typeLabel: 'PDF', sizeLabel: '12 MB' },
|
|
904
|
-
{ filename: 'Notes.md', typeLabel: 'MD', sizeLabel: '12 KB' },
|
|
905
|
-
]"
|
|
906
|
-
/>
|
|
907
|
-
</div>
|
|
908
|
-
</div>
|
|
909
|
-
|
|
910
|
-
<div class="accessible-theme flex flex-col gap-3">
|
|
911
|
-
<h3 class="label-m-medium text-center text-content-on-surface-primary">
|
|
912
|
-
Accessible
|
|
913
|
-
</h3>
|
|
914
|
-
<div class="flex min-h-20 flex-col justify-center gap-3 border border-border-surface-default p-6">
|
|
915
|
-
<UiFileItem
|
|
916
|
-
filename="Filename.pdf"
|
|
917
|
-
type-label="PDF"
|
|
918
|
-
processing
|
|
919
|
-
processing-label="Processing…"
|
|
920
|
-
remove-label="Remove Filename.pdf"
|
|
921
|
-
/>
|
|
922
|
-
<UiFileItem
|
|
923
|
-
filename="Filename"
|
|
924
|
-
error="Upload failed"
|
|
925
|
-
remove-label="Remove Filename"
|
|
926
|
-
/>
|
|
927
|
-
<UiFileItem
|
|
928
|
-
filename="Attached documents"
|
|
929
|
-
type-label="2 files"
|
|
930
|
-
expand-label="Show attached documents"
|
|
931
|
-
:removable="false"
|
|
932
|
-
:items="[
|
|
933
|
-
{ filename: 'Plan.pdf', typeLabel: 'PDF', sizeLabel: '12 MB' },
|
|
934
|
-
{ filename: 'Notes.md', typeLabel: 'MD', sizeLabel: '12 KB' },
|
|
935
|
-
]"
|
|
936
|
-
/>
|
|
937
|
-
</div>
|
|
938
|
-
</div>
|
|
939
|
-
</div>
|
|
940
|
-
</section>
|
|
941
|
-
`,
|
|
942
|
-
}),
|
|
943
|
-
tags: ['!autodocs'],
|
|
944
|
-
parameters: {
|
|
945
|
-
a11y: { test: 'off' },
|
|
946
|
-
chromatic: {
|
|
947
|
-
disableSnapshot: true,
|
|
948
|
-
},
|
|
949
|
-
docs: {
|
|
950
|
-
canvas: {
|
|
951
|
-
sourceState: 'none',
|
|
952
|
-
},
|
|
953
|
-
},
|
|
954
|
-
},
|
|
955
|
-
};
|
|
956
|
-
|
|
957
981
|
/*
|
|
958
982
|
* ─────────────────────────────────────────────────────────────────────────────
|
|
959
983
|
* Interaction & accessibility tests (play functions)
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
MessageCircleIcon,
|
|
23
23
|
StarIcon,
|
|
24
24
|
} from '@/icons/lucide';
|
|
25
|
+
import { guidanceSectionClass } from '../../../.storybook/guidance';
|
|
25
26
|
|
|
26
27
|
const PLACEMENT_OPTIONS: UiFloatActionsPlacement[] = [
|
|
27
28
|
'top',
|
|
@@ -305,6 +306,108 @@ export const ShowModes: Story = {
|
|
|
305
306
|
},
|
|
306
307
|
};
|
|
307
308
|
|
|
309
|
+
/**
|
|
310
|
+
* Accessibility guidance for the floating trigger and its toolbar: popup
|
|
311
|
+
* semantics on the anchor, roving arrow-key focus in the toolbar, accessible
|
|
312
|
+
* names on every item, and the accessibility theme for contrast.
|
|
313
|
+
*/
|
|
314
|
+
export const Accessibility: Story = {
|
|
315
|
+
render: () => ({
|
|
316
|
+
components: { UiFloatActionItems, UiIcon },
|
|
317
|
+
template: `
|
|
318
|
+
<section class="${guidanceSectionClass}">
|
|
319
|
+
<div>
|
|
320
|
+
<h2 class="heading-m font-bold text-content-on-surface-primary">
|
|
321
|
+
Accessibility
|
|
322
|
+
</h2>
|
|
323
|
+
</div>
|
|
324
|
+
|
|
325
|
+
<div class="flex flex-col gap-6">
|
|
326
|
+
<div class="flex flex-col gap-2">
|
|
327
|
+
<h3 class="body-m-medium text-content-on-surface-primary">
|
|
328
|
+
Requirements
|
|
329
|
+
</h3>
|
|
330
|
+
<ul class="body-m-regular list-disc pl-5 text-content-on-surface-primary">
|
|
331
|
+
<li>The trigger is a focusable button exposing <code class="label-s-regular">aria-haspopup</code> and <code class="label-s-regular">aria-expanded</code>, pointing at the open panel via <code class="label-s-regular">aria-controls</code>.</li>
|
|
332
|
+
<li>Focus or hover opens the panel; <code class="label-s-regular">Escape</code> closes it and restores focus to the trigger.</li>
|
|
333
|
+
<li>The toolbar uses <code class="label-s-regular">role="toolbar"</code> with roving arrow-key focus — one Tab stop enters and leaves it, Arrow keys move between items.</li>
|
|
334
|
+
<li>Every icon-only button and input item has an accessible name via <code class="label-s-regular">aria-label</code>.</li>
|
|
335
|
+
<li>Predefined <code class="label-s-regular">label</code> items use their visible text as the name; their icons are decorative and hidden from assistive technology.</li>
|
|
336
|
+
<li>Predefined <code class="label-s-regular">icon</code> items need an <code class="label-s-regular">aria-label</code>. <code class="label-s-regular">input</code> items need an <code class="label-s-regular">aria-label</code> for the field and should set <code class="label-s-regular">previous-aria-label</code> / <code class="label-s-regular">next-aria-label</code> to describe what the buttons do (they default to "Previous" / "Next").</li>
|
|
337
|
+
<li>Predefined items meet the 24px minimum touch target at both sizes, on desktop and at the 320px mobile breakpoint.</li>
|
|
338
|
+
</ul>
|
|
339
|
+
</div>
|
|
340
|
+
|
|
341
|
+
<div class="flex flex-col gap-2">
|
|
342
|
+
<h3 class="body-m-medium text-content-on-surface-primary">
|
|
343
|
+
Enable accessibility theme
|
|
344
|
+
</h3>
|
|
345
|
+
<p class="body-m-regular text-content-on-surface-primary">
|
|
346
|
+
When accessibility is required, enable our accessibility theme. This
|
|
347
|
+
increases contrast and ensures there are no color contrast issues.
|
|
348
|
+
</p>
|
|
349
|
+
</div>
|
|
350
|
+
</div>
|
|
351
|
+
|
|
352
|
+
<div class="grid gap-4 md:grid-cols-2">
|
|
353
|
+
<div class="flex flex-col gap-3">
|
|
354
|
+
<h3 class="label-m-medium text-center text-content-on-surface-primary">
|
|
355
|
+
Default
|
|
356
|
+
</h3>
|
|
357
|
+
<div class="flex min-h-20 items-center justify-center border border-border-surface-default p-6">
|
|
358
|
+
<UiFloatActionItems aria-label="Default paragraph actions">
|
|
359
|
+
<UiFloatActionItems type="button" aria-label="Edit">
|
|
360
|
+
<UiIcon :name="EditIcon" size="s" />
|
|
361
|
+
</UiFloatActionItems>
|
|
362
|
+
<UiFloatActionItems type="button" aria-label="Copy">
|
|
363
|
+
<UiIcon :name="CopyIcon" size="s" />
|
|
364
|
+
</UiFloatActionItems>
|
|
365
|
+
<UiFloatActionItems type="separator" />
|
|
366
|
+
<UiFloatActionItems type="button" aria-label="Delete">
|
|
367
|
+
<UiIcon :name="TrashIcon" size="s" />
|
|
368
|
+
</UiFloatActionItems>
|
|
369
|
+
</UiFloatActionItems>
|
|
370
|
+
</div>
|
|
371
|
+
</div>
|
|
372
|
+
|
|
373
|
+
<div class="accessible-theme flex flex-col gap-3">
|
|
374
|
+
<h3 class="label-m-medium text-center text-content-on-surface-primary">
|
|
375
|
+
Accessible
|
|
376
|
+
</h3>
|
|
377
|
+
<div class="flex min-h-20 items-center justify-center border border-border-surface-default p-6">
|
|
378
|
+
<UiFloatActionItems aria-label="Accessible paragraph actions">
|
|
379
|
+
<UiFloatActionItems type="button" aria-label="Edit">
|
|
380
|
+
<UiIcon :name="EditIcon" size="s" />
|
|
381
|
+
</UiFloatActionItems>
|
|
382
|
+
<UiFloatActionItems type="button" aria-label="Copy">
|
|
383
|
+
<UiIcon :name="CopyIcon" size="s" />
|
|
384
|
+
</UiFloatActionItems>
|
|
385
|
+
<UiFloatActionItems type="separator" />
|
|
386
|
+
<UiFloatActionItems type="button" aria-label="Delete">
|
|
387
|
+
<UiIcon :name="TrashIcon" size="s" />
|
|
388
|
+
</UiFloatActionItems>
|
|
389
|
+
</UiFloatActionItems>
|
|
390
|
+
</div>
|
|
391
|
+
</div>
|
|
392
|
+
</div>
|
|
393
|
+
</section>
|
|
394
|
+
`,
|
|
395
|
+
}),
|
|
396
|
+
tags: ['!autodocs'],
|
|
397
|
+
parameters: {
|
|
398
|
+
surface: 'primary',
|
|
399
|
+
a11y: { test: 'off' },
|
|
400
|
+
chromatic: {
|
|
401
|
+
disableSnapshot: true,
|
|
402
|
+
},
|
|
403
|
+
docs: {
|
|
404
|
+
canvas: {
|
|
405
|
+
sourceState: 'none',
|
|
406
|
+
},
|
|
407
|
+
},
|
|
408
|
+
},
|
|
409
|
+
};
|
|
410
|
+
|
|
308
411
|
/**
|
|
309
412
|
* A gallery of common `UiFloatActionItems` toolbar compositions.
|
|
310
413
|
* These are **examples** only — mix and match the item types (`button`, `text`,
|
|
@@ -1862,107 +1965,6 @@ export const Composable: Story = {
|
|
|
1862
1965
|
},
|
|
1863
1966
|
};
|
|
1864
1967
|
|
|
1865
|
-
/**
|
|
1866
|
-
* Accessibility guidance for the floating trigger and its toolbar: popup
|
|
1867
|
-
* semantics on the anchor, roving arrow-key focus in the toolbar, accessible
|
|
1868
|
-
* names on every item, and the accessibility theme for contrast.
|
|
1869
|
-
*/
|
|
1870
|
-
export const Accessibility: Story = {
|
|
1871
|
-
render: () => ({
|
|
1872
|
-
components: { UiFloatActionItems, UiIcon },
|
|
1873
|
-
template: `
|
|
1874
|
-
<section class="flex flex-col gap-6 p-4">
|
|
1875
|
-
<div>
|
|
1876
|
-
<h2 class="heading-m font-bold text-content-on-surface-primary">
|
|
1877
|
-
Accessibility
|
|
1878
|
-
</h2>
|
|
1879
|
-
</div>
|
|
1880
|
-
|
|
1881
|
-
<div class="flex flex-col gap-6">
|
|
1882
|
-
<div class="flex flex-col gap-2">
|
|
1883
|
-
<h3 class="body-m-medium text-content-on-surface-primary">
|
|
1884
|
-
Requirements
|
|
1885
|
-
</h3>
|
|
1886
|
-
<ul class="body-m-regular list-disc pl-5 text-content-on-surface-primary">
|
|
1887
|
-
<li>The trigger is a focusable button exposing <code class="label-s-regular">aria-haspopup</code> and <code class="label-s-regular">aria-expanded</code>, pointing at the open panel via <code class="label-s-regular">aria-controls</code>.</li>
|
|
1888
|
-
<li>Focus or hover opens the panel; <code class="label-s-regular">Escape</code> closes it and restores focus to the trigger.</li>
|
|
1889
|
-
<li>The toolbar uses <code class="label-s-regular">role="toolbar"</code> with roving arrow-key focus — one Tab stop enters and leaves it, Arrow keys move between items.</li>
|
|
1890
|
-
<li>Every icon-only button and input item has an accessible name via <code class="label-s-regular">aria-label</code>.</li>
|
|
1891
|
-
<li>Predefined <code class="label-s-regular">label</code> items use their visible text as the name; their icons are decorative and hidden from assistive technology.</li>
|
|
1892
|
-
<li>Predefined <code class="label-s-regular">icon</code> items need an <code class="label-s-regular">aria-label</code>. <code class="label-s-regular">input</code> items need an <code class="label-s-regular">aria-label</code> for the field and should set <code class="label-s-regular">previous-aria-label</code> / <code class="label-s-regular">next-aria-label</code> to describe what the buttons do (they default to "Previous" / "Next").</li>
|
|
1893
|
-
<li>Predefined items meet the 24px minimum touch target at both sizes, on desktop and at the 320px mobile breakpoint.</li>
|
|
1894
|
-
</ul>
|
|
1895
|
-
</div>
|
|
1896
|
-
|
|
1897
|
-
<div class="flex flex-col gap-2">
|
|
1898
|
-
<h3 class="body-m-medium text-content-on-surface-primary">
|
|
1899
|
-
Enable accessibility theme
|
|
1900
|
-
</h3>
|
|
1901
|
-
<p class="body-m-regular text-content-on-surface-primary">
|
|
1902
|
-
When accessibility is required, enable our accessibility theme. This
|
|
1903
|
-
increases contrast and ensures there are no color contrast issues.
|
|
1904
|
-
</p>
|
|
1905
|
-
</div>
|
|
1906
|
-
</div>
|
|
1907
|
-
|
|
1908
|
-
<div class="grid gap-4 md:grid-cols-2">
|
|
1909
|
-
<div class="flex flex-col gap-3">
|
|
1910
|
-
<h3 class="label-m-medium text-center text-content-on-surface-primary">
|
|
1911
|
-
Default
|
|
1912
|
-
</h3>
|
|
1913
|
-
<div class="flex min-h-20 items-center justify-center border border-border-surface-default p-6">
|
|
1914
|
-
<UiFloatActionItems aria-label="Default paragraph actions">
|
|
1915
|
-
<UiFloatActionItems type="button" aria-label="Edit">
|
|
1916
|
-
<UiIcon :name="EditIcon" size="s" />
|
|
1917
|
-
</UiFloatActionItems>
|
|
1918
|
-
<UiFloatActionItems type="button" aria-label="Copy">
|
|
1919
|
-
<UiIcon :name="CopyIcon" size="s" />
|
|
1920
|
-
</UiFloatActionItems>
|
|
1921
|
-
<UiFloatActionItems type="separator" />
|
|
1922
|
-
<UiFloatActionItems type="button" aria-label="Delete">
|
|
1923
|
-
<UiIcon :name="TrashIcon" size="s" />
|
|
1924
|
-
</UiFloatActionItems>
|
|
1925
|
-
</UiFloatActionItems>
|
|
1926
|
-
</div>
|
|
1927
|
-
</div>
|
|
1928
|
-
|
|
1929
|
-
<div class="accessible-theme flex flex-col gap-3">
|
|
1930
|
-
<h3 class="label-m-medium text-center text-content-on-surface-primary">
|
|
1931
|
-
Accessible
|
|
1932
|
-
</h3>
|
|
1933
|
-
<div class="flex min-h-20 items-center justify-center border border-border-surface-default p-6">
|
|
1934
|
-
<UiFloatActionItems aria-label="Accessible paragraph actions">
|
|
1935
|
-
<UiFloatActionItems type="button" aria-label="Edit">
|
|
1936
|
-
<UiIcon :name="EditIcon" size="s" />
|
|
1937
|
-
</UiFloatActionItems>
|
|
1938
|
-
<UiFloatActionItems type="button" aria-label="Copy">
|
|
1939
|
-
<UiIcon :name="CopyIcon" size="s" />
|
|
1940
|
-
</UiFloatActionItems>
|
|
1941
|
-
<UiFloatActionItems type="separator" />
|
|
1942
|
-
<UiFloatActionItems type="button" aria-label="Delete">
|
|
1943
|
-
<UiIcon :name="TrashIcon" size="s" />
|
|
1944
|
-
</UiFloatActionItems>
|
|
1945
|
-
</UiFloatActionItems>
|
|
1946
|
-
</div>
|
|
1947
|
-
</div>
|
|
1948
|
-
</div>
|
|
1949
|
-
</section>
|
|
1950
|
-
`,
|
|
1951
|
-
}),
|
|
1952
|
-
tags: ['!autodocs'],
|
|
1953
|
-
parameters: {
|
|
1954
|
-
a11y: { test: 'off' },
|
|
1955
|
-
chromatic: {
|
|
1956
|
-
disableSnapshot: true,
|
|
1957
|
-
},
|
|
1958
|
-
docs: {
|
|
1959
|
-
canvas: {
|
|
1960
|
-
sourceState: 'none',
|
|
1961
|
-
},
|
|
1962
|
-
},
|
|
1963
|
-
},
|
|
1964
|
-
};
|
|
1965
|
-
|
|
1966
1968
|
/*
|
|
1967
1969
|
* ─────────────────────────────────────────────────────────────────────────────
|
|
1968
1970
|
* Interaction & accessibility tests (play functions)
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
import { UiRadioGroup, UiRadioGroupItem } from '../../components/UiRadioGroup';
|
|
11
11
|
import { renderShellWith } from './layout-shell';
|
|
12
12
|
import UiLayoutContent from './UiLayoutContent.vue';
|
|
13
|
+
import { guidanceSectionClass } from '../../../.storybook/guidance';
|
|
13
14
|
|
|
14
15
|
const meta: Meta<typeof UiLayoutContent> = {
|
|
15
16
|
title: 'Patterns/UiLayout/Content',
|
|
@@ -286,18 +287,6 @@ export const Default: Story = {
|
|
|
286
287
|
},
|
|
287
288
|
};
|
|
288
289
|
|
|
289
|
-
/**
|
|
290
|
-
* A page skeleton on the layout grid, used by the Accessibility guidance
|
|
291
|
-
* examples below. Decorative blocks only, so it stays `aria-hidden`.
|
|
292
|
-
*/
|
|
293
|
-
const accessibilityExampleContent = `
|
|
294
|
-
<div class="grid grid-cols-12 gap-6 py-8" aria-hidden="true">
|
|
295
|
-
<div class="col-span-3 h-4 rounded-md bg-background-surface-muted" />
|
|
296
|
-
<div class="col-span-6 h-8 rounded-md bg-background-surface-muted" />
|
|
297
|
-
<div class="col-span-9 mt-4 h-16 rounded-md bg-background-surface-muted" />
|
|
298
|
-
</div>
|
|
299
|
-
`;
|
|
300
|
-
|
|
301
290
|
/**
|
|
302
291
|
* Accessibility guidance for the content area: what the default `main` tag
|
|
303
292
|
* means as a landmark, when to change the `as` tag and what that costs, and
|
|
@@ -307,7 +296,7 @@ export const Accessibility: Story = {
|
|
|
307
296
|
render: () => ({
|
|
308
297
|
components: { UiLayoutContent },
|
|
309
298
|
template: `
|
|
310
|
-
<section class="
|
|
299
|
+
<section class="${guidanceSectionClass}">
|
|
311
300
|
<div>
|
|
312
301
|
<h2 class="heading-m font-bold text-content-on-surface-primary">
|
|
313
302
|
Accessibility
|
|
@@ -382,6 +371,18 @@ export const Accessibility: Story = {
|
|
|
382
371
|
},
|
|
383
372
|
};
|
|
384
373
|
|
|
374
|
+
/**
|
|
375
|
+
* A page skeleton on the layout grid, used by the Accessibility guidance
|
|
376
|
+
* examples below. Decorative blocks only, so it stays `aria-hidden`.
|
|
377
|
+
*/
|
|
378
|
+
const accessibilityExampleContent = `
|
|
379
|
+
<div class="grid grid-cols-12 gap-6 py-8" aria-hidden="true">
|
|
380
|
+
<div class="col-span-3 h-4 rounded-md bg-background-surface-muted" />
|
|
381
|
+
<div class="col-span-6 h-8 rounded-md bg-background-surface-muted" />
|
|
382
|
+
<div class="col-span-9 mt-4 h-16 rounded-md bg-background-surface-muted" />
|
|
383
|
+
</div>
|
|
384
|
+
`;
|
|
385
|
+
|
|
385
386
|
/**
|
|
386
387
|
* The split view: filling the `split` slot draws a border through the middle
|
|
387
388
|
* of the content box, and each part keeps a 28px margin from it. The 48px
|