@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
@@ -12,6 +12,16 @@ import {
12
12
  UiFieldTitle,
13
13
  } from '../UiField';
14
14
  import { ref, watch } from 'vue';
15
+ import {
16
+ accessibilityRequirementsTemplate,
17
+ designNotesStory,
18
+ guidanceLinks,
19
+ guidanceSectionClass,
20
+ parseGuidance,
21
+ } from '../../../.storybook/guidance';
22
+ import guidanceMarkdown from './UiRadioGroup.guidance.md?raw';
23
+
24
+ const guidance = parseGuidance(guidanceMarkdown);
15
25
 
16
26
  /**
17
27
  * UiRadioGroup is a set of mutually exclusive options where exactly one can be selected.
@@ -43,6 +53,9 @@ const meta: Meta<typeof UiRadioGroup> = {
43
53
  disabled: false,
44
54
  orientation: 'vertical',
45
55
  },
56
+ parameters: {
57
+ docs: { links: guidanceLinks(guidance) },
58
+ },
46
59
  };
47
60
 
48
61
  export default meta;
@@ -157,6 +170,156 @@ export const Default: Story = {
157
170
  },
158
171
  };
159
172
 
173
+ /**
174
+ * Usage, guidelines, and do's and don'ts from the Figma documentation.
175
+ */
176
+ export const DesignNotes: Story = {
177
+ ...designNotesStory(guidance),
178
+ tags: ['!autodocs'],
179
+ };
180
+
181
+ /**
182
+ * Accessibility guidance for radio groups: a named group, labels wired to every
183
+ * option, and disabled options that stay visible — shown side by side in the
184
+ * default and accessible themes.
185
+ */
186
+ export const Accessibility: Story = {
187
+ tags: ['!autodocs'],
188
+ parameters: {
189
+ surface: 'primary',
190
+ a11y: { test: 'off' },
191
+ chromatic: { disableSnapshot: true },
192
+ docs: {
193
+ canvas: {
194
+ sourceState: 'none',
195
+ },
196
+ },
197
+ },
198
+ render: () => ({
199
+ components: { UiRadioGroup, UiRadioGroupItem },
200
+ setup() {
201
+ const defaultValue = ref('comfortable');
202
+ const accessibleValue = ref('comfortable');
203
+ return { defaultValue, accessibleValue };
204
+ },
205
+ template: `
206
+ <section class="${guidanceSectionClass}">
207
+ <div>
208
+ <h2 class="heading-m font-bold text-content-on-surface-primary">
209
+ Accessibility
210
+ </h2>
211
+ </div>
212
+
213
+ ${accessibilityRequirementsTemplate(guidance.accessibility, 'Requirements')}
214
+
215
+ <div class="flex flex-col gap-6">
216
+ <div class="flex flex-col gap-2">
217
+ <h3 class="body-m-medium text-content-on-surface-primary">
218
+ Give the group a name
219
+ </h3>
220
+ <p class="body-m-regular text-content-on-surface-primary">
221
+ A radio group only makes sense as a set. Wrap it in a
222
+ <code>fieldset</code> with a <code>legend</code> (via
223
+ <code>as-child</code>), or set <code>aria-label</code>, so the
224
+ question is announced before the options.
225
+ </p>
226
+ </div>
227
+
228
+ <div class="flex flex-col gap-2">
229
+ <h3 class="body-m-medium text-content-on-surface-primary">
230
+ Label every option
231
+ </h3>
232
+ <p class="body-m-regular text-content-on-surface-primary">
233
+ Pair each <code>UiRadioGroupItem</code> with a
234
+ <code>label</code> whose <code>for</code> matches the item
235
+ <code>id</code>. The label becomes the option's accessible name
236
+ and makes the text itself clickable.
237
+ </p>
238
+ </div>
239
+
240
+ <div class="flex flex-col gap-2">
241
+ <h3 class="body-m-medium text-content-on-surface-primary">
242
+ Keep disabled options visible
243
+ </h3>
244
+ <p class="body-m-regular text-content-on-surface-primary">
245
+ A disabled option stays in the group so users see the full set of
246
+ choices. Arrow-key navigation skips it, and it announces its
247
+ disabled state rather than disappearing.
248
+ </p>
249
+ </div>
250
+
251
+ <div class="flex flex-col gap-2">
252
+ <h3 class="body-m-medium text-content-on-surface-primary">
253
+ Enable accessibility theme
254
+ </h3>
255
+ <p class="body-m-regular text-content-on-surface-primary">
256
+ When accessibility is required, enable our accessibility theme.
257
+ This increases contrast and makes sure there are no color
258
+ contrast issues.
259
+ </p>
260
+ </div>
261
+ </div>
262
+
263
+ <div class="grid gap-4 md:grid-cols-2">
264
+ <div class="flex flex-col gap-3">
265
+ <h3 class="label-m-medium text-center text-content-on-surface-primary">
266
+ Default
267
+ </h3>
268
+ <div class="flex min-h-20 items-center justify-center border border-border-surface-default p-6">
269
+ <UiRadioGroup v-model="defaultValue" name="spacing-default" as-child>
270
+ <fieldset>
271
+ <legend class="mb-3 label-s-medium">Spacing</legend>
272
+ <div class="grid gap-3">
273
+ <div class="flex items-center gap-x-2">
274
+ <UiRadioGroupItem id="a11y-default-1" value="default" />
275
+ <label for="a11y-default-1" class="label-s-medium">Default</label>
276
+ </div>
277
+ <div class="flex items-center gap-x-2">
278
+ <UiRadioGroupItem id="a11y-default-2" value="comfortable" />
279
+ <label for="a11y-default-2" class="label-s-medium">Comfortable</label>
280
+ </div>
281
+ <div class="flex items-center gap-x-2">
282
+ <UiRadioGroupItem id="a11y-default-3" value="compact" disabled />
283
+ <label for="a11y-default-3" class="label-s-medium text-content-on-surface-muted">Compact (unavailable)</label>
284
+ </div>
285
+ </div>
286
+ </fieldset>
287
+ </UiRadioGroup>
288
+ </div>
289
+ </div>
290
+
291
+ <div class="accessible-theme flex flex-col gap-3">
292
+ <h3 class="label-m-medium text-center text-content-on-surface-primary">
293
+ Accessible
294
+ </h3>
295
+ <div class="flex min-h-20 items-center justify-center border border-border-surface-default p-6">
296
+ <UiRadioGroup v-model="accessibleValue" name="spacing-accessible" as-child>
297
+ <fieldset>
298
+ <legend class="mb-3 label-s-medium">Spacing</legend>
299
+ <div class="grid gap-3">
300
+ <div class="flex items-center gap-x-2">
301
+ <UiRadioGroupItem id="a11y-accessible-1" value="default" />
302
+ <label for="a11y-accessible-1" class="label-s-medium">Default</label>
303
+ </div>
304
+ <div class="flex items-center gap-x-2">
305
+ <UiRadioGroupItem id="a11y-accessible-2" value="comfortable" />
306
+ <label for="a11y-accessible-2" class="label-s-medium">Comfortable</label>
307
+ </div>
308
+ <div class="flex items-center gap-x-2">
309
+ <UiRadioGroupItem id="a11y-accessible-3" value="compact" disabled />
310
+ <label for="a11y-accessible-3" class="label-s-medium text-content-on-surface-muted">Compact (unavailable)</label>
311
+ </div>
312
+ </div>
313
+ </fieldset>
314
+ </UiRadioGroup>
315
+ </div>
316
+ </div>
317
+ </div>
318
+ </section>
319
+ `,
320
+ }),
321
+ };
322
+
160
323
  const disabledTemplateSource = `<script setup lang="ts">
161
324
  import { ref } from 'vue'
162
325
  import { UiRadioGroup, UiRadioGroupItem } from '@aleph-alpha/ui-library'
@@ -671,145 +834,6 @@ export const WithField: Story = {
671
834
  },
672
835
  };
673
836
 
674
- /**
675
- * Accessibility guidance for radio groups: a named group, labels wired to every
676
- * option, and disabled options that stay visible — shown side by side in the
677
- * default and accessible themes.
678
- */
679
- export const Accessibility: Story = {
680
- tags: ['!autodocs'],
681
- parameters: {
682
- a11y: { test: 'off' },
683
- chromatic: { disableSnapshot: true },
684
- docs: {
685
- canvas: {
686
- sourceState: 'none',
687
- },
688
- },
689
- },
690
- render: () => ({
691
- components: { UiRadioGroup, UiRadioGroupItem },
692
- setup() {
693
- const defaultValue = ref('comfortable');
694
- const accessibleValue = ref('comfortable');
695
- return { defaultValue, accessibleValue };
696
- },
697
- template: `
698
- <section class="flex flex-col gap-6 p-4">
699
- <div>
700
- <h2 class="heading-m font-bold text-content-on-surface-primary">
701
- Accessibility
702
- </h2>
703
- </div>
704
-
705
- <div class="flex flex-col gap-6">
706
- <div class="flex flex-col gap-2">
707
- <h3 class="body-m-medium text-content-on-surface-primary">
708
- Give the group a name
709
- </h3>
710
- <p class="body-m-regular text-content-on-surface-primary">
711
- A radio group only makes sense as a set. Wrap it in a
712
- <code>fieldset</code> with a <code>legend</code> (via
713
- <code>as-child</code>), or set <code>aria-label</code>, so the
714
- question is announced before the options.
715
- </p>
716
- </div>
717
-
718
- <div class="flex flex-col gap-2">
719
- <h3 class="body-m-medium text-content-on-surface-primary">
720
- Label every option
721
- </h3>
722
- <p class="body-m-regular text-content-on-surface-primary">
723
- Pair each <code>UiRadioGroupItem</code> with a
724
- <code>label</code> whose <code>for</code> matches the item
725
- <code>id</code>. The label becomes the option's accessible name
726
- and makes the text itself clickable.
727
- </p>
728
- </div>
729
-
730
- <div class="flex flex-col gap-2">
731
- <h3 class="body-m-medium text-content-on-surface-primary">
732
- Keep disabled options visible
733
- </h3>
734
- <p class="body-m-regular text-content-on-surface-primary">
735
- A disabled option stays in the group so users see the full set of
736
- choices. Arrow-key navigation skips it, and it announces its
737
- disabled state rather than disappearing.
738
- </p>
739
- </div>
740
-
741
- <div class="flex flex-col gap-2">
742
- <h3 class="body-m-medium text-content-on-surface-primary">
743
- Enable accessibility theme
744
- </h3>
745
- <p class="body-m-regular text-content-on-surface-primary">
746
- When accessibility is required, enable our accessibility theme.
747
- This increases contrast and makes sure there are no color
748
- contrast issues.
749
- </p>
750
- </div>
751
- </div>
752
-
753
- <div class="grid gap-4 md:grid-cols-2">
754
- <div class="flex flex-col gap-3">
755
- <h3 class="label-m-medium text-center text-content-on-surface-primary">
756
- Default
757
- </h3>
758
- <div class="flex min-h-20 items-center justify-center border border-border-surface-default p-6">
759
- <UiRadioGroup v-model="defaultValue" name="spacing-default" as-child>
760
- <fieldset>
761
- <legend class="mb-3 label-s-medium">Spacing</legend>
762
- <div class="grid gap-3">
763
- <div class="flex items-center gap-x-2">
764
- <UiRadioGroupItem id="a11y-default-1" value="default" />
765
- <label for="a11y-default-1" class="label-s-medium">Default</label>
766
- </div>
767
- <div class="flex items-center gap-x-2">
768
- <UiRadioGroupItem id="a11y-default-2" value="comfortable" />
769
- <label for="a11y-default-2" class="label-s-medium">Comfortable</label>
770
- </div>
771
- <div class="flex items-center gap-x-2">
772
- <UiRadioGroupItem id="a11y-default-3" value="compact" disabled />
773
- <label for="a11y-default-3" class="label-s-medium text-content-on-surface-muted">Compact (unavailable)</label>
774
- </div>
775
- </div>
776
- </fieldset>
777
- </UiRadioGroup>
778
- </div>
779
- </div>
780
-
781
- <div class="accessible-theme flex flex-col gap-3">
782
- <h3 class="label-m-medium text-center text-content-on-surface-primary">
783
- Accessible
784
- </h3>
785
- <div class="flex min-h-20 items-center justify-center border border-border-surface-default p-6">
786
- <UiRadioGroup v-model="accessibleValue" name="spacing-accessible" as-child>
787
- <fieldset>
788
- <legend class="mb-3 label-s-medium">Spacing</legend>
789
- <div class="grid gap-3">
790
- <div class="flex items-center gap-x-2">
791
- <UiRadioGroupItem id="a11y-accessible-1" value="default" />
792
- <label for="a11y-accessible-1" class="label-s-medium">Default</label>
793
- </div>
794
- <div class="flex items-center gap-x-2">
795
- <UiRadioGroupItem id="a11y-accessible-2" value="comfortable" />
796
- <label for="a11y-accessible-2" class="label-s-medium">Comfortable</label>
797
- </div>
798
- <div class="flex items-center gap-x-2">
799
- <UiRadioGroupItem id="a11y-accessible-3" value="compact" disabled />
800
- <label for="a11y-accessible-3" class="label-s-medium text-content-on-surface-muted">Compact (unavailable)</label>
801
- </div>
802
- </div>
803
- </fieldset>
804
- </UiRadioGroup>
805
- </div>
806
- </div>
807
- </div>
808
- </section>
809
- `,
810
- }),
811
- };
812
-
813
837
  // Test-only stories drive the test-runner (interactive/a11y checks) but are
814
838
  // hidden from the Storybook sidebar and docs via the `!dev` / `!autodocs`
815
839
  // tags. They keep the implicit `test` tag, so they still run in CI and appear
@@ -4,6 +4,16 @@ import type { DateRange, DateValue } from 'reka-ui';
4
4
  import { expect, fn, userEvent, waitFor, within } from 'storybook/test';
5
5
  import { ref } from 'vue';
6
6
  import UiRangeCalendar from './UiRangeCalendar.vue';
7
+ import {
8
+ accessibilityRequirementsTemplate,
9
+ designNotesStory,
10
+ guidanceLinks,
11
+ guidanceSectionClass,
12
+ parseGuidance,
13
+ } from '../../../.storybook/guidance';
14
+ import guidanceMarkdown from '../UiCalendar/UiCalendar.guidance.md?raw';
15
+
16
+ const guidance = parseGuidance(guidanceMarkdown);
7
17
 
8
18
  // Module-level spy shared by every story with a play function; each play
9
19
  // clears it first so runs stay independent.
@@ -107,6 +117,9 @@ const meta: Meta<typeof UiRangeCalendar> = {
107
117
  preventDeselect: false,
108
118
  initialFocus: false,
109
119
  },
120
+ parameters: {
121
+ docs: { links: guidanceLinks(guidance) },
122
+ },
110
123
  };
111
124
 
112
125
  export default meta;
@@ -200,6 +213,121 @@ export const Default: Story = {
200
213
  },
201
214
  };
202
215
 
216
+ /**
217
+ * Usage, guidelines, and do's and don'ts from the Figma documentation.
218
+ */
219
+ export const DesignNotes: Story = {
220
+ ...designNotesStory(guidance),
221
+ tags: ['!autodocs'],
222
+ };
223
+
224
+ /**
225
+ * Accessibility guidance for the range calendar: selection, today, focus and
226
+ * unavailable treatments that survive without colour, comfortable day
227
+ * targets, and a stable grid — shown side by side in the default and
228
+ * accessible themes.
229
+ */
230
+ export const Accessibility: Story = {
231
+ tags: ['!autodocs'],
232
+ parameters: {
233
+ surface: 'primary',
234
+ a11y: { test: 'off' },
235
+ chromatic: { disableSnapshot: true },
236
+ docs: {
237
+ canvas: {
238
+ sourceState: 'none',
239
+ },
240
+ },
241
+ },
242
+ render: () => ({
243
+ components: { UiRangeCalendar },
244
+ setup() {
245
+ const range: DateRange = {
246
+ start: new CalendarDate(2025, 1, 10),
247
+ end: new CalendarDate(2025, 1, 14),
248
+ };
249
+ const placeholder = new CalendarDate(2025, 1, 1);
250
+ return { range, placeholder };
251
+ },
252
+ template: `
253
+ <section class="${guidanceSectionClass}">
254
+ <div>
255
+ <h2 class="heading-m font-bold text-content-on-surface-primary">
256
+ Accessibility
257
+ </h2>
258
+ </div>
259
+
260
+ <div class="flex flex-col gap-6">
261
+ ${accessibilityRequirementsTemplate(guidance.accessibility, 'Requirements')}
262
+
263
+ <div class="flex flex-col gap-2">
264
+ <h3 class="body-m-medium text-content-on-surface-primary">
265
+ In code
266
+ </h3>
267
+ <ul class="body-m-regular flex list-disc flex-col gap-1 pl-6 text-content-on-surface-primary">
268
+ <li>
269
+ Give the trigger a meaningful name with aria-label (for example,
270
+ "Choose departure date") and name its calendar with calendar-label.
271
+ </li>
272
+ <li>
273
+ Tab to the trigger and press Enter or Space to open the calendar.
274
+ Use arrow keys to navigate dates and Enter or Space to select.
275
+ In range mode, select the start and then the end date.
276
+ </li>
277
+ <li>
278
+ Escape dismisses the calendar and returns focus to the trigger.
279
+ By default, selecting a date or completing a range also closes
280
+ the popover; setting close-on-select to false keeps it open.
281
+ </li>
282
+ </ul>
283
+ </div>
284
+
285
+ <div class="flex flex-col gap-2">
286
+ <h3 class="body-m-medium text-content-on-surface-primary">
287
+ Enable accessibility theme
288
+ </h3>
289
+ <p class="body-m-regular text-content-on-surface-primary">
290
+ When accessibility is required, enable our accessibility theme.
291
+ This increases contrast and ensures there are no color contrast
292
+ issues.
293
+ </p>
294
+ </div>
295
+ </div>
296
+
297
+ <div class="grid gap-4 md:grid-cols-2">
298
+ <div class="flex flex-col gap-3">
299
+ <h3 class="label-m-medium text-center text-content-on-surface-primary">
300
+ Default
301
+ </h3>
302
+ <div class="flex min-h-20 items-center justify-center border border-border-surface-default p-6">
303
+ <UiRangeCalendar
304
+ :default-value="range"
305
+ :default-placeholder="placeholder"
306
+ fixed-weeks
307
+ calendar-label="Stay dates"
308
+ />
309
+ </div>
310
+ </div>
311
+
312
+ <div class="accessible-theme flex flex-col gap-3">
313
+ <h3 class="label-m-medium text-center text-content-on-surface-primary">
314
+ Accessible
315
+ </h3>
316
+ <div class="flex min-h-20 items-center justify-center border border-border-surface-default p-6">
317
+ <UiRangeCalendar
318
+ :default-value="range"
319
+ :default-placeholder="placeholder"
320
+ fixed-weeks
321
+ calendar-label="Stay dates"
322
+ />
323
+ </div>
324
+ </div>
325
+ </div>
326
+ </section>
327
+ `,
328
+ }),
329
+ };
330
+
203
331
  const multipleMonthsTemplateSource = `<script setup lang="ts">
204
332
  import type { DateRange } from '@aleph-alpha/ui-library'
205
333
  import { ref } from 'vue'
@@ -1286,130 +1414,3 @@ export const MobileBreakpoint: Story = {
1286
1414
  );
1287
1415
  },
1288
1416
  };
1289
-
1290
- /**
1291
- * Accessibility guidance for the range calendar: selection, today, focus and
1292
- * unavailable treatments that survive without colour, comfortable day
1293
- * targets, and a stable grid — shown side by side in the default and
1294
- * accessible themes.
1295
- */
1296
- export const Accessibility: Story = {
1297
- tags: ['!autodocs'],
1298
- parameters: {
1299
- a11y: { test: 'off' },
1300
- chromatic: { disableSnapshot: true },
1301
- docs: {
1302
- canvas: {
1303
- sourceState: 'none',
1304
- },
1305
- },
1306
- },
1307
- render: () => ({
1308
- components: { UiRangeCalendar },
1309
- setup() {
1310
- const range: DateRange = {
1311
- start: new CalendarDate(2025, 1, 10),
1312
- end: new CalendarDate(2025, 1, 14),
1313
- };
1314
- const placeholder = new CalendarDate(2025, 1, 1);
1315
- return { range, placeholder };
1316
- },
1317
- template: `
1318
- <section class="flex w-full flex-col gap-6 p-4">
1319
- <div>
1320
- <h2 class="heading-m font-bold text-content-on-surface-primary">
1321
- Accessibility
1322
- </h2>
1323
- </div>
1324
-
1325
- <div class="flex flex-col gap-6">
1326
- <div class="flex flex-col gap-2">
1327
- <h3 class="body-m-medium text-content-on-surface-primary">
1328
- Requirements
1329
- </h3>
1330
- <ul class="body-m-regular flex list-disc flex-col gap-1 pl-6 text-content-on-surface-primary">
1331
- <li>
1332
- Today and the selected day differ in shape as well as fill, so
1333
- both survive without colour
1334
- </li>
1335
- <li>
1336
- Selected, hover and focus are three distinguishable treatments,
1337
- not variations of one
1338
- </li>
1339
- <li>
1340
- Focus stays visible on a day even when that day is selected or
1341
- inside a range
1342
- </li>
1343
- <li>
1344
- Day buttons are a comfortable target at the size chosen,
1345
- including the smallest one used
1346
- </li>
1347
- <li>
1348
- Unavailable days carry a visible treatment beyond low contrast
1349
- </li>
1350
- <li>
1351
- The grid keeps a stable size between months, so the page does
1352
- not shift under the reader
1353
- </li>
1354
- <li>
1355
- Give the trigger a meaningful name with aria-label (for example,
1356
- "Choose departure date") and name its calendar with calendar-label.
1357
- </li>
1358
- <li>
1359
- Tab to the trigger and press Enter or Space to open the calendar.
1360
- Use arrow keys to navigate dates and Enter or Space to select.
1361
- In range mode, select the start and then the end date.
1362
- </li>
1363
- <li>
1364
- Escape dismisses the calendar and returns focus to the trigger.
1365
- By default, selecting a date or completing a range also closes
1366
- the popover; setting close-on-select to false keeps it open.
1367
- </li>
1368
- </ul>
1369
- </div>
1370
-
1371
- <div class="flex flex-col gap-2">
1372
- <h3 class="body-m-medium text-content-on-surface-primary">
1373
- Enable accessibility theme
1374
- </h3>
1375
- <p class="body-m-regular text-content-on-surface-primary">
1376
- When accessibility is required, enable our accessibility theme.
1377
- This increases contrast and ensures there are no color contrast
1378
- issues.
1379
- </p>
1380
- </div>
1381
- </div>
1382
-
1383
- <div class="grid gap-4 md:grid-cols-2">
1384
- <div class="flex flex-col gap-3">
1385
- <h3 class="label-m-medium text-center text-content-on-surface-primary">
1386
- Default
1387
- </h3>
1388
- <div class="flex min-h-20 items-center justify-center border border-border-surface-default p-6">
1389
- <UiRangeCalendar
1390
- :default-value="range"
1391
- :default-placeholder="placeholder"
1392
- fixed-weeks
1393
- calendar-label="Stay dates"
1394
- />
1395
- </div>
1396
- </div>
1397
-
1398
- <div class="accessible-theme flex flex-col gap-3">
1399
- <h3 class="label-m-medium text-center text-content-on-surface-primary">
1400
- Accessible
1401
- </h3>
1402
- <div class="flex min-h-20 items-center justify-center border border-border-surface-default p-6">
1403
- <UiRangeCalendar
1404
- :default-value="range"
1405
- :default-placeholder="placeholder"
1406
- fixed-weeks
1407
- calendar-label="Stay dates"
1408
- />
1409
- </div>
1410
- </div>
1411
- </div>
1412
- </section>
1413
- `,
1414
- }),
1415
- };
@@ -0,0 +1,65 @@
1
+ ---
2
+ figma: '29205:70927'
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 Resizable component lets the user divide the available space between panels and keeps that division. It hands a layout decision to the person using the product, which is right when there is no single correct proportion.
10
+
11
+ Use it where different users genuinely need different proportions — a list beside a detail view, a preview beside an editor. When one proportion is correct for everyone, set it and move on.
12
+
13
+ ### The handle has to be findable
14
+
15
+ A resize the user cannot discover is not a feature:
16
+
17
+ - The handle is visible at rest, not only on hover
18
+ - It sits on the boundary it moves, along its whole length
19
+ - Its resting, hover and focus states are distinguishable
20
+ - The cursor over it indicates the direction of movement
21
+
22
+ ### Constrain the extremes
23
+
24
+ Freedom needs limits, or a panel becomes unusable:
25
+
26
+ 1. Each panel has a minimum size that keeps its content readable
27
+ 2. Dragging stops at that minimum rather than collapsing silently
28
+ 3. A panel that may be collapsed does so deliberately, and can be restored
29
+ 4. The division persists, so the user sets it once
30
+
31
+ ### Consistency
32
+
33
+ Every resizable layout is built from the same parts:
34
+
35
+ - Resizable panel group, splitting the available space
36
+ - Handle, at rest and focused
37
+ - A minimum size per panel
38
+ - One handle treatment across a product
39
+
40
+ ## Do
41
+
42
+ - Keep the handle visible at rest
43
+ - Give every panel a minimum size that keeps its content readable
44
+ - Stop the drag at the minimum rather than collapsing without warning
45
+ - Remember the division the user set
46
+ - Use the same handle treatment everywhere in a product
47
+ - Let a collapsed panel be restored the way it was collapsed
48
+
49
+ ## Don't
50
+
51
+ - Hide the handle until the user hovers near it
52
+ - Let a panel shrink until its content is unreadable
53
+ - Reset the user's division on reload or navigation
54
+ - Make the handle thinner than it can comfortably be grabbed
55
+ - Use resizable panels where one proportion is right for everyone
56
+ - Collapse a panel with no way back
57
+
58
+ ## Accessibility
59
+
60
+ - The handle is visible at rest, so the resize is discoverable without hovering
61
+ - The handle carries a visible focus state, distinct from hover
62
+ - The handle's grab area is comfortable, wider than the visible line if need be
63
+ - Panels keep a minimum size that keeps text legible at the reader's own zoom
64
+ - The handle is distinguishable from the ordinary separators in the layout
65
+ - Nothing depends on drag alone: a resized or collapsed state is reachable another way