@aleph-alpha/ui-library 5.9.0 → 5.10.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.
Files changed (54) hide show
  1. package/config.js +157 -4
  2. package/dist/system/components/UiFileItem/UiFileItem.vue.d.ts +3 -1
  3. package/dist/system/components/UiFileType/types.d.ts +2 -1
  4. package/dist/system/components/UiSwitch/UiSwitch.vue.d.ts +1 -0
  5. package/dist/system/components/UiSwitch/types.d.ts +12 -0
  6. package/dist/system/components/core/switch/Switch.vue.d.ts +2 -0
  7. package/dist/system/components/core/switch/index.d.ts +8 -0
  8. package/dist/system/index.d.ts +1 -0
  9. package/dist/system/lib/scrollbar.d.ts +37 -0
  10. package/dist/system/lib/useAnchorFloat.d.ts +0 -2
  11. package/dist/system/lib/useIsTruncated.d.ts +15 -0
  12. package/dist/system/lib.js +15052 -14843
  13. package/dist/system/patterns/UiFloatActions/types.d.ts +0 -1
  14. package/dist/system/story-sidebar-icons.json +4 -1
  15. package/docs/public-docs/foundations.md +17 -15
  16. package/package.json +3 -3
  17. package/src/components/UiCodeBlock/UiCodeBlock.stories.ts +54 -0
  18. package/src/components/UiCodeBlock/UiCodeBlock.vue +84 -32
  19. package/src/components/UiCodeBlock/__tests__/UiCodeBlock.test.ts +65 -21
  20. package/src/components/UiFileItem/UiFileItem.vue +17 -4
  21. package/src/components/UiFileItem/__tests__/UiFileItem.test.ts +49 -90
  22. package/src/components/UiFileType/UiFileType.stories.ts +13 -2
  23. package/src/components/UiFileType/UiFileType.vue +8 -0
  24. package/src/components/UiFileType/__tests__/UiFileType.test.ts +10 -0
  25. package/src/components/UiFileType/types.ts +3 -1
  26. package/src/components/UiSnackbar/UiSnackbar.stories.ts +4 -5
  27. package/src/components/UiSwitch/UiSwitch.stories.ts +658 -7
  28. package/src/components/UiSwitch/UiSwitch.vue +1 -0
  29. package/src/components/UiSwitch/__tests__/UiSwitch.test.ts +48 -0
  30. package/src/components/UiSwitch/types.ts +13 -0
  31. package/src/components/UiToggleGroup/UiToggleGroup.vue +1 -1
  32. package/src/components/core/field/FieldLabel.vue +1 -1
  33. package/src/components/core/label/Label.vue +1 -1
  34. package/src/components/core/switch/Switch.vue +23 -17
  35. package/src/components/core/switch/index.ts +36 -0
  36. package/src/index.ts +3 -0
  37. package/src/lib/scrollbar.ts +295 -0
  38. package/src/lib/useAnchorFloat.ts +0 -2
  39. package/src/lib/useIsTruncated.test.ts +174 -0
  40. package/src/lib/useIsTruncated.ts +75 -0
  41. package/src/patterns/UiFileUpload/UiFileItem.stories.ts +1162 -0
  42. package/src/patterns/UiFileUpload/UiFileUpload.stories.ts +552 -1
  43. package/src/patterns/UiFileUpload/__tests__/UiFileUpload.test.ts +5 -21
  44. package/src/patterns/UiFloatActions/UiFloatActionItems.vue +0 -1
  45. package/src/patterns/UiFloatActions/UiFloatActions.stories.ts +0 -1
  46. package/src/patterns/UiFloatActions/UiFloatActions.vue +1 -2
  47. package/src/patterns/UiFloatActions/types.ts +0 -1
  48. package/src/patterns/UiProfileCard/UiProfileCard.stories.ts +132 -117
  49. package/src/theme/Background.stories.ts +27 -1
  50. package/src/theme/BorderRadius.stories.ts +5 -0
  51. package/src/theme/Overlay.stories.ts +12 -1
  52. package/src/theme/Scrollbar.stories.ts +260 -0
  53. package/tokens.json +224 -2
  54. package/src/components/UiFileItem/UiFileItem.stories.ts +0 -442
@@ -223,29 +223,32 @@ const meta = {
223
223
  export default meta;
224
224
  type Story = StoryObj<typeof meta>;
225
225
 
226
- const defaultTemplateSource = `<!-- the trigger this card hangs off is in WithAvatarTrigger -->
227
- <UiDropdownMenuContent class="${CARD}" align="start">
228
- <UiDropdownMenuLabel class="flex items-center gap-3 py-2">
229
- <UiAvatar :size="10">
230
- <UiAvatarFallback class="bg-background-accent-pink">CN</UiAvatarFallback>
231
- </UiAvatar>
232
- <span class="flex min-w-0 flex-col">
233
- <span class="truncate label-14-medium">Christina Neumann</span>
234
- <span class="truncate label-12-regular text-content-on-surface-muted">christina.neumann@example.com</span>
235
- </span>
236
- </UiDropdownMenuLabel>
237
- <UiDropdownMenuSeparator />
238
-
239
- <UiDropdownMenuItem>Account settings</UiDropdownMenuItem>
240
- <UiDropdownMenuItem>Privacy policy</UiDropdownMenuItem>
241
- <UiDropdownMenuItem>Terms and conditions</UiDropdownMenuItem>
242
-
243
- <UiDropdownMenuSeparator />
244
- <UiDropdownMenuItem>
245
- <UiIcon name="log-out" size="s" />
246
- Sign out
247
- </UiDropdownMenuItem>
248
- </UiDropdownMenuContent>`;
226
+ const defaultTemplateSource = `<template>
227
+ <!-- UiProfileCard: a composition of UiDropdownMenu parts, not a component. -->
228
+ <!-- the trigger this card hangs off is in WithAvatarTrigger -->
229
+ <UiDropdownMenuContent class="${CARD}" align="start">
230
+ <UiDropdownMenuLabel class="flex items-center gap-3 py-2">
231
+ <UiAvatar :size="10">
232
+ <UiAvatarFallback class="bg-background-accent-pink">CN</UiAvatarFallback>
233
+ </UiAvatar>
234
+ <span class="flex min-w-0 flex-col">
235
+ <span class="truncate label-14-medium">Christina Neumann</span>
236
+ <span class="truncate label-12-regular text-content-on-surface-muted">christina.neumann@example.com</span>
237
+ </span>
238
+ </UiDropdownMenuLabel>
239
+ <UiDropdownMenuSeparator />
240
+
241
+ <UiDropdownMenuItem>Account settings</UiDropdownMenuItem>
242
+ <UiDropdownMenuItem>Privacy policy</UiDropdownMenuItem>
243
+ <UiDropdownMenuItem>Terms and conditions</UiDropdownMenuItem>
244
+
245
+ <UiDropdownMenuSeparator />
246
+ <UiDropdownMenuItem>
247
+ <UiIcon name="log-out" size="s" />
248
+ Sign out
249
+ </UiDropdownMenuItem>
250
+ </UiDropdownMenuContent>
251
+ </template>`;
249
252
 
250
253
  /**
251
254
  * The card with plain text links.
@@ -325,32 +328,35 @@ export const Default: Story = {
325
328
  },
326
329
  };
327
330
 
328
- const withItemIconsTemplateSource = `<UiDropdownMenuContent class="${CARD}" align="start">
329
- <!-- identity header + separator, as in the Default story -->
330
-
331
- <UiDropdownMenuItem>
332
- <UiIcon name="lock" size="s" />
333
- Your organization settings
334
- </UiDropdownMenuItem>
335
- <UiDropdownMenuItem>
336
- <UiIcon name="settings" size="s" />
337
- Your account settings
338
- </UiDropdownMenuItem>
339
- <UiDropdownMenuItem>
340
- <UiIcon name="eye" size="s" />
341
- Privacy policy
342
- </UiDropdownMenuItem>
343
- <UiDropdownMenuItem>
344
- <UiIcon name="file-text" size="s" />
345
- Terms and conditions
346
- </UiDropdownMenuItem>
347
-
348
- <UiDropdownMenuSeparator />
349
- <UiDropdownMenuItem>
350
- <UiIcon name="log-out" size="s" />
351
- Sign out
352
- </UiDropdownMenuItem>
353
- </UiDropdownMenuContent>`;
331
+ const withItemIconsTemplateSource = `<template>
332
+ <!-- UiProfileCard: a composition of UiDropdownMenu parts, not a component. -->
333
+ <UiDropdownMenuContent class="${CARD}" align="start">
334
+ <!-- identity header + separator, as in the Default story -->
335
+
336
+ <UiDropdownMenuItem>
337
+ <UiIcon name="lock" size="s" />
338
+ Your organization settings
339
+ </UiDropdownMenuItem>
340
+ <UiDropdownMenuItem>
341
+ <UiIcon name="settings" size="s" />
342
+ Your account settings
343
+ </UiDropdownMenuItem>
344
+ <UiDropdownMenuItem>
345
+ <UiIcon name="eye" size="s" />
346
+ Privacy policy
347
+ </UiDropdownMenuItem>
348
+ <UiDropdownMenuItem>
349
+ <UiIcon name="file-text" size="s" />
350
+ Terms and conditions
351
+ </UiDropdownMenuItem>
352
+
353
+ <UiDropdownMenuSeparator />
354
+ <UiDropdownMenuItem>
355
+ <UiIcon name="log-out" size="s" />
356
+ Sign out
357
+ </UiDropdownMenuItem>
358
+ </UiDropdownMenuContent>
359
+ </template>`;
354
360
 
355
361
  /**
356
362
  * The card with an icon on every item.
@@ -408,44 +414,47 @@ export const WithItemIcons: Story = {
408
414
  },
409
415
  };
410
416
 
411
- const withSubmenusTemplateSource = `<UiDropdownMenuContent class="${CARD}" align="start">
412
- <!-- identity header + separator, as in the Default story -->
417
+ const withSubmenusTemplateSource = `<template>
418
+ <!-- UiProfileCard: a composition of UiDropdownMenu parts, not a component. -->
419
+ <UiDropdownMenuContent class="${CARD}" align="start">
420
+ <!-- identity header + separator, as in the Default story -->
413
421
 
414
- <UiDropdownMenuItem>
415
- <UiIcon name="lock" size="s" />
416
- Your organization settings
417
- <UiIcon name="external-link" size="s" class="ml-auto" />
418
- </UiDropdownMenuItem>
422
+ <UiDropdownMenuItem>
423
+ <UiIcon name="lock" size="s" />
424
+ Your organization settings
425
+ <UiIcon name="external-link" size="s" class="ml-auto" />
426
+ </UiDropdownMenuItem>
419
427
 
420
- <UiDropdownMenuSub>
421
- <UiDropdownMenuSubTrigger>
422
- <UiIcon name="languages" size="s" class="mr-2" />
423
- Languages
424
- </UiDropdownMenuSubTrigger>
425
- <UiDropdownMenuSubContent class="w-40 ${STACK}">
426
- <UiDropdownMenuRadioGroup v-model="language" class="${STACK}">
427
- <UiDropdownMenuRadioItem value="en" class="pl-2">
428
- <template #indicator-icon><span class="hidden" /></template>
429
- English
430
- <UiIcon v-if="language === 'en'" name="check" size="s" class="ml-auto" />
431
- </UiDropdownMenuRadioItem>
432
- <UiDropdownMenuRadioItem value="de" class="pl-2">
433
- <template #indicator-icon><span class="hidden" /></template>
434
- German
435
- <UiIcon v-if="language === 'de'" name="check" size="s" class="ml-auto" />
436
- </UiDropdownMenuRadioItem>
437
- </UiDropdownMenuRadioGroup>
438
- </UiDropdownMenuSubContent>
439
- </UiDropdownMenuSub>
428
+ <UiDropdownMenuSub>
429
+ <UiDropdownMenuSubTrigger>
430
+ <UiIcon name="languages" size="s" class="mr-2" />
431
+ Languages
432
+ </UiDropdownMenuSubTrigger>
433
+ <UiDropdownMenuSubContent class="w-40 ${STACK}">
434
+ <UiDropdownMenuRadioGroup v-model="language" class="${STACK}">
435
+ <UiDropdownMenuRadioItem value="en" class="pl-2">
436
+ <template #indicator-icon><span class="hidden" /></template>
437
+ English
438
+ <UiIcon v-if="language === 'en'" name="check" size="s" class="ml-auto" />
439
+ </UiDropdownMenuRadioItem>
440
+ <UiDropdownMenuRadioItem value="de" class="pl-2">
441
+ <template #indicator-icon><span class="hidden" /></template>
442
+ German
443
+ <UiIcon v-if="language === 'de'" name="check" size="s" class="ml-auto" />
444
+ </UiDropdownMenuRadioItem>
445
+ </UiDropdownMenuRadioGroup>
446
+ </UiDropdownMenuSubContent>
447
+ </UiDropdownMenuSub>
440
448
 
441
- <!-- Help and Learn more follow the same UiDropdownMenuSub shape -->
449
+ <!-- Help and Learn more follow the same UiDropdownMenuSub shape -->
442
450
 
443
- <UiDropdownMenuSeparator />
444
- <UiDropdownMenuItem>
445
- <UiIcon name="log-out" size="s" />
446
- Sign out
447
- </UiDropdownMenuItem>
448
- </UiDropdownMenuContent>`;
451
+ <UiDropdownMenuSeparator />
452
+ <UiDropdownMenuItem>
453
+ <UiIcon name="log-out" size="s" />
454
+ Sign out
455
+ </UiDropdownMenuItem>
456
+ </UiDropdownMenuContent>
457
+ </template>`;
449
458
 
450
459
  /**
451
460
  * The card with items that open a second level.
@@ -525,27 +534,30 @@ export const WithSubmenus: Story = {
525
534
  },
526
535
  };
527
536
 
528
- const languagePickerTemplateSource = `<UiDropdownMenuSub>
529
- <UiDropdownMenuSubTrigger>
530
- <UiIcon name="languages" size="s" class="mr-2" />
531
- Languages
532
- </UiDropdownMenuSubTrigger>
533
- <UiDropdownMenuSubContent class="w-40 ${STACK}">
534
- <UiDropdownMenuRadioGroup v-model="language" class="${STACK}">
535
- <!-- An empty indicator drops the radio dot; the trailing check marks the choice -->
536
- <UiDropdownMenuRadioItem value="en" class="pl-2">
537
- <template #indicator-icon><span class="hidden" /></template>
538
- English
539
- <UiIcon v-if="language === 'en'" name="check" size="s" class="ml-auto" />
540
- </UiDropdownMenuRadioItem>
541
- <UiDropdownMenuRadioItem value="de" class="pl-2">
542
- <template #indicator-icon><span class="hidden" /></template>
543
- German
544
- <UiIcon v-if="language === 'de'" name="check" size="s" class="ml-auto" />
545
- </UiDropdownMenuRadioItem>
546
- </UiDropdownMenuRadioGroup>
547
- </UiDropdownMenuSubContent>
548
- </UiDropdownMenuSub>`;
537
+ const languagePickerTemplateSource = `<template>
538
+ <!-- UiProfileCard: a composition of UiDropdownMenu parts, not a component. -->
539
+ <UiDropdownMenuSub>
540
+ <UiDropdownMenuSubTrigger>
541
+ <UiIcon name="languages" size="s" class="mr-2" />
542
+ Languages
543
+ </UiDropdownMenuSubTrigger>
544
+ <UiDropdownMenuSubContent class="w-40 ${STACK}">
545
+ <UiDropdownMenuRadioGroup v-model="language" class="${STACK}">
546
+ <!-- An empty indicator drops the radio dot; the trailing check marks the choice -->
547
+ <UiDropdownMenuRadioItem value="en" class="pl-2">
548
+ <template #indicator-icon><span class="hidden" /></template>
549
+ English
550
+ <UiIcon v-if="language === 'en'" name="check" size="s" class="ml-auto" />
551
+ </UiDropdownMenuRadioItem>
552
+ <UiDropdownMenuRadioItem value="de" class="pl-2">
553
+ <template #indicator-icon><span class="hidden" /></template>
554
+ German
555
+ <UiIcon v-if="language === 'de'" name="check" size="s" class="ml-auto" />
556
+ </UiDropdownMenuRadioItem>
557
+ </UiDropdownMenuRadioGroup>
558
+ </UiDropdownMenuSubContent>
559
+ </UiDropdownMenuSub>
560
+ </template>`;
549
561
 
550
562
  /**
551
563
  * The card with a submenu for picking one language.
@@ -705,19 +717,22 @@ export const Accessibility: Story = {
705
717
  }),
706
718
  };
707
719
 
708
- const avatarTriggerTemplateSource = `<UiDropdownMenu v-model:open="open" :modal="false">
709
- <UiDropdownMenuTrigger as-child>
710
- <button type="button" aria-label="Open profile menu" class="ui-focus-ring rounded-full">
711
- <UiAvatar :size="10">
712
- <UiAvatarFallback class="bg-background-accent-pink">CN</UiAvatarFallback>
713
- </UiAvatar>
714
- </button>
715
- </UiDropdownMenuTrigger>
716
-
717
- <UiDropdownMenuContent class="${CARD}" align="start">
718
- <!-- any of the cards above -->
719
- </UiDropdownMenuContent>
720
- </UiDropdownMenu>`;
720
+ const avatarTriggerTemplateSource = `<template>
721
+ <!-- UiProfileCard: a composition of UiDropdownMenu parts, not a component. -->
722
+ <UiDropdownMenu v-model:open="open" :modal="false">
723
+ <UiDropdownMenuTrigger as-child>
724
+ <button type="button" aria-label="Open profile menu" class="ui-focus-ring rounded-full">
725
+ <UiAvatar :size="10">
726
+ <UiAvatarFallback class="bg-background-accent-pink">CN</UiAvatarFallback>
727
+ </UiAvatar>
728
+ </button>
729
+ </UiDropdownMenuTrigger>
730
+
731
+ <UiDropdownMenuContent class="${CARD}" align="start">
732
+ <!-- any of the cards above -->
733
+ </UiDropdownMenuContent>
734
+ </UiDropdownMenu>
735
+ </template>`;
721
736
 
722
737
  /**
723
738
  * The card together with the avatar that opens it.
@@ -96,12 +96,20 @@ export const Surface: Story = {
96
96
  </div>
97
97
  </div>
98
98
 
99
+ <div class="flex flex-col items-center gap-1.5">
100
+ <div class="w-16 h-16 rounded-md bg-background-surface-citation border border-border-surface-default"></div>
101
+ <div class="text-center">
102
+ <span class="label-12-medium text-content-on-surface-primary block">citation</span>
103
+ <code class="copy-btn label-12-regular text-content-on-surface-muted block mt-0.5 px-1 py-0.5 rounded" onclick="copyToClipboard('bg-background-surface-citation', this)">bg-background-surface-citation</code>
104
+ </div>
105
+ </div>
106
+
99
107
  </div>
100
108
  </div>
101
109
 
102
110
  <div>
103
111
  <h3 class="body-14-bold text-content-on-surface-primary mb-1">Overlay Surfaces</h3>
104
- <p class="label-12-regular text-content-on-surface-muted mb-3">Backdrop layers for transparent overlays and modal dimming. Token group: <code class="label-12-medium">overlay.surface</code></p>
112
+ <p class="label-12-regular text-content-on-surface-muted mb-3">Backdrop layers for transparent overlays and modal dimming. The inverse variant lightens instead of dims, so it is shown here over an inverse surface. Token group: <code class="label-12-medium">overlay.surface</code></p>
105
113
  <div class="flex flex-wrap gap-6">
106
114
  <div class="flex flex-col items-center gap-1.5">
107
115
  <div class="w-16 h-16 rounded-md bg-overlay-surface-transparent border border-border-surface-default"></div>
@@ -118,6 +126,16 @@ export const Surface: Story = {
118
126
  <code class="copy-btn label-12-regular text-content-on-surface-muted block mt-0.5 px-1 py-0.5 rounded" onclick="copyToClipboard('bg-overlay-surface-modal-overlay', this)">bg-overlay-surface-modal-overlay</code>
119
127
  </div>
120
128
  </div>
129
+
130
+ <div class="flex flex-col items-center gap-1.5">
131
+ <div class="w-16 h-16 rounded-md bg-background-surface-inverse border border-border-surface-default">
132
+ <div class="w-full h-full rounded-md bg-overlay-surface-modal-overlay-inverse"></div>
133
+ </div>
134
+ <div class="text-center">
135
+ <span class="label-12-medium text-content-on-surface-primary block">modal overlay inverse</span>
136
+ <code class="copy-btn label-12-regular text-content-on-surface-muted block mt-0.5 px-1 py-0.5 rounded" onclick="copyToClipboard('bg-overlay-surface-modal-overlay-inverse', this)">bg-overlay-surface-modal-overlay-inverse</code>
137
+ </div>
138
+ </div>
121
139
  </div>
122
140
  </div>
123
141
 
@@ -285,6 +303,14 @@ export const Accent: Story = {
285
303
  <code class="copy-btn label-12-regular text-content-on-surface-muted block mt-0.5 px-1 py-0.5 rounded" onclick="copyToClipboard('bg-background-accent-yellow', this)">bg-background-accent-yellow</code>
286
304
  </div>
287
305
  </div>
306
+
307
+ <div class="flex flex-col items-center gap-1.5">
308
+ <div class="w-16 h-16 rounded-md bg-background-accent-orange border border-border-surface-default"></div>
309
+ <div class="text-center">
310
+ <span class="label-12-medium text-content-on-surface-primary block">orange</span>
311
+ <code class="copy-btn label-12-regular text-content-on-surface-muted block mt-0.5 px-1 py-0.5 rounded" onclick="copyToClipboard('bg-background-accent-orange', this)">bg-background-accent-orange</code>
312
+ </div>
313
+ </div>
288
314
  </div>
289
315
  </div>
290
316
  `,
@@ -91,6 +91,11 @@ export const RadiusScale: Story = {
91
91
  <code class="copy-btn label-12-regular text-content-on-surface-muted block mt-3" onclick="copyToClipboard('rounded-xl', this)">rounded-xl</code>
92
92
  </div>
93
93
 
94
+ <div class="text-center">
95
+ <div class="mx-auto h-40 w-32 bg-background-accent-soft border border-border-surface-default rounded-xl-2xl"></div>
96
+ <code class="copy-btn label-12-regular text-content-on-surface-muted block mt-3" onclick="copyToClipboard('rounded-xl-2xl', this)">rounded-xl-2xl</code>
97
+ </div>
98
+
94
99
  <div class="text-center">
95
100
  <div class="mx-auto h-40 w-32 bg-background-accent-soft border border-border-surface-default rounded-2xl"></div>
96
101
  <code class="copy-btn label-12-regular text-content-on-surface-muted block mt-3" onclick="copyToClipboard('rounded-2xl', this)">rounded-2xl</code>
@@ -33,7 +33,8 @@ const copyScript = `
33
33
 
34
34
  /**
35
35
  * Surface overlay colors for modal backdrops and scrim layers.
36
- * Modal-overlay dims content behind dialogs, transparent is for invisible overlay areas.
36
+ * Modal-overlay dims content behind dialogs, modal-overlay-inverse lightens it instead
37
+ * (for dark or media backdrops), transparent is for invisible overlay areas.
37
38
  */
38
39
  export const Surface: Story = {
39
40
  render: () => ({
@@ -61,6 +62,16 @@ export const Surface: Story = {
61
62
  </div>
62
63
  </div>
63
64
 
65
+ <div class="flex flex-col items-center gap-1.5">
66
+ <div class="w-16 h-16 rounded-md bg-background-surface-inverse border border-border-surface-default">
67
+ <div class="w-full h-full rounded-md bg-overlay-surface-modal-overlay-inverse"></div>
68
+ </div>
69
+ <div class="text-center">
70
+ <span class="label-12-medium text-content-on-surface-primary block">modal-overlay-inverse</span>
71
+ <code class="copy-btn label-12-regular text-content-on-surface-muted block mt-0.5 px-1 py-0.5 rounded" onclick="copyToClipboard('bg-overlay-surface-modal-overlay-inverse', this)">bg-overlay-surface-modal-overlay-inverse</code>
72
+ </div>
73
+ </div>
74
+
64
75
  <div class="flex flex-col items-center gap-1.5">
65
76
  <div class="w-16 h-16 rounded-md bg-overlay-surface-transparent border border-border-surface-default"></div>
66
77
  <div class="text-center">