@aleph-alpha/ui-library 1.20.0 → 1.22.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 (67) hide show
  1. package/dist/system/index.d.ts +1180 -486
  2. package/dist/system/lib.js +16242 -15201
  3. package/package.json +4 -3
  4. package/src/components/UiAlertDialog/UiAlertDialog.stories.ts +135 -13
  5. package/src/components/UiAlertDialog/UiAlertDialog.vue +8 -7
  6. package/src/components/UiAlertDialog/UiAlertDialogHeader.vue +1 -1
  7. package/src/components/UiAlertDialog/__tests__/UiAlertDialog.test.ts +16 -16
  8. package/src/components/UiAlertDialog/types.ts +18 -0
  9. package/src/components/UiCodeBlock/UiCodeBlock.stories.ts +352 -0
  10. package/src/components/UiCodeBlock/UiCodeBlock.vue +168 -0
  11. package/src/components/UiCodeBlock/__tests__/UiCodeBlock.test.ts +210 -0
  12. package/src/components/UiCodeBlock/index.ts +2 -0
  13. package/src/components/UiCodeBlock/types.ts +60 -0
  14. package/src/components/UiDialog/UiDialog.stories.ts +717 -0
  15. package/src/components/UiDialog/UiDialog.vue +19 -0
  16. package/src/components/UiDialog/UiDialogClose.vue +16 -0
  17. package/src/components/UiDialog/UiDialogContent.vue +108 -0
  18. package/src/components/UiDialog/UiDialogDescription.vue +16 -0
  19. package/src/components/UiDialog/UiDialogFooter.vue +16 -0
  20. package/src/components/UiDialog/UiDialogHeader.vue +16 -0
  21. package/src/components/UiDialog/UiDialogTitle.vue +16 -0
  22. package/src/components/UiDialog/UiDialogTrigger.vue +16 -0
  23. package/src/components/UiDialog/__tests__/UiDialog.test.ts +328 -0
  24. package/src/components/UiDialog/index.ts +13 -0
  25. package/src/components/UiDialog/types.ts +136 -0
  26. package/src/components/UiFileItem/UiFileItem.stories.ts +268 -0
  27. package/src/components/UiFileItem/UiFileItem.vue +119 -0
  28. package/src/components/UiFileItem/__tests__/UiFileItem.test.ts +66 -0
  29. package/src/components/UiFileItem/index.ts +2 -0
  30. package/src/components/UiFileItem/types.ts +27 -0
  31. package/src/components/UiFileUploadBox/UiFileUploadBox.stories.ts +117 -0
  32. package/src/components/UiFileUploadBox/UiFileUploadBox.vue +230 -0
  33. package/src/components/UiFileUploadBox/__tests__/file-validation.test.ts +46 -0
  34. package/src/components/UiFileUploadBox/file-validation.ts +73 -0
  35. package/src/components/UiFileUploadBox/index.ts +7 -0
  36. package/src/components/UiFileUploadBox/types.ts +96 -0
  37. package/src/components/UiItem/UiItem.vue +7 -1
  38. package/src/components/UiItem/types.ts +7 -0
  39. package/src/components/core/alert-dialog/AlertDialog.vue +1 -1
  40. package/src/components/core/alert-dialog/AlertDialogAction.vue +2 -6
  41. package/src/components/core/alert-dialog/AlertDialogCancel.vue +3 -7
  42. package/src/components/core/alert-dialog/AlertDialogContent.vue +15 -7
  43. package/src/components/core/alert-dialog/AlertDialogDescription.vue +3 -7
  44. package/src/components/core/alert-dialog/AlertDialogFooter.vue +1 -6
  45. package/src/components/core/alert-dialog/AlertDialogHeader.vue +1 -9
  46. package/src/components/core/alert-dialog/AlertDialogTitle.vue +3 -7
  47. package/src/components/core/dialog/Dialog.vue +15 -0
  48. package/src/components/core/dialog/DialogClose.vue +12 -0
  49. package/src/components/core/dialog/DialogContent.vue +48 -0
  50. package/src/components/core/dialog/DialogDescription.vue +17 -0
  51. package/src/components/core/dialog/DialogFooter.vue +12 -0
  52. package/src/components/core/dialog/DialogHeader.vue +9 -0
  53. package/src/components/core/dialog/DialogOverlay.vue +23 -0
  54. package/src/components/core/dialog/DialogTitle.vue +17 -0
  55. package/src/components/core/dialog/DialogTrigger.vue +12 -0
  56. package/src/components/core/dialog/index.ts +9 -0
  57. package/src/components/core/drawer/DrawerContent.vue +1 -1
  58. package/src/components/core/item/Item.vue +7 -4
  59. package/src/components/core/progress/Progress.vue +7 -2
  60. package/src/components/core/sheet/SheetOverlay.vue +1 -1
  61. package/src/components/index.ts +4 -0
  62. package/src/patterns/UiFileUpload/UiFileUpload.stories.ts +768 -0
  63. package/src/patterns/UiFileUpload/UiFileUpload.vue +46 -0
  64. package/src/patterns/UiFileUpload/__tests__/UiFileUpload.test.ts +123 -0
  65. package/src/patterns/UiFileUpload/index.ts +8 -0
  66. package/src/patterns/UiFileUpload/types.ts +12 -0
  67. package/src/patterns/index.ts +1 -0
@@ -1,6 +1,5 @@
1
1
  <script setup lang="ts">
2
2
  import type { AlertDialogContentEmits, AlertDialogContentProps } from 'reka-ui';
3
- import type { HTMLAttributes } from 'vue';
4
3
  import { reactiveOmit } from '@vueuse/core';
5
4
  import {
6
5
  AlertDialogContent,
@@ -9,15 +8,24 @@
9
8
  useForwardPropsEmits,
10
9
  } from 'reka-ui';
11
10
  import { cn } from '@/lib/utils';
11
+ import { UiDialogContentMaxWidth } from '@/components/UiDialog';
12
12
 
13
13
  defineOptions({
14
14
  inheritAttrs: false,
15
15
  });
16
16
 
17
- const props = defineProps<AlertDialogContentProps & { class?: HTMLAttributes['class'] }>();
17
+ const props = defineProps<
18
+ AlertDialogContentProps & {
19
+ /**
20
+ * Tailwind max-width utility applied to the panel (e.g. `max-w-lg` for compact alerts).
21
+ * Omit for full-bleed width within the horizontal margin (`max-w-none`).
22
+ */
23
+ maxWidth?: UiDialogContentMaxWidth;
24
+ }
25
+ >();
18
26
  const emits = defineEmits<AlertDialogContentEmits>();
19
27
 
20
- const delegatedProps = reactiveOmit(props, 'class');
28
+ const delegatedProps = reactiveOmit(props, 'maxWidth');
21
29
 
22
30
  const forwarded = useForwardPropsEmits(delegatedProps, emits);
23
31
  </script>
@@ -26,15 +34,15 @@
26
34
  <AlertDialogPortal>
27
35
  <AlertDialogOverlay
28
36
  data-slot="alert-dialog-overlay"
29
- class="data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-modal-overlay"
37
+ class="data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-overlay-surface-modal-overlay"
30
38
  />
31
39
  <AlertDialogContent
32
40
  data-slot="alert-dialog-content"
33
- v-bind="{ ...$attrs, ...forwarded }"
41
+ v-bind="{ ...forwarded, ...$attrs }"
34
42
  :class="
35
43
  cn(
36
- 'bg-background-surface-modal data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border border-border-surface-default p-6 shadow-lg duration-200 sm:max-w-lg',
37
- props.class,
44
+ 'bg-background-surface-modal data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border border-border-surface-default p-6 shadow-lg duration-200',
45
+ props.maxWidth ?? 'max-w-none',
38
46
  )
39
47
  "
40
48
  >
@@ -1,20 +1,16 @@
1
1
  <script setup lang="ts">
2
2
  import type { AlertDialogDescriptionProps } from 'reka-ui';
3
- import type { HTMLAttributes } from 'vue';
4
- import { reactiveOmit } from '@vueuse/core';
5
3
  import { AlertDialogDescription } from 'reka-ui';
6
4
  import { cn } from '@/lib/utils';
7
5
 
8
- const props = defineProps<AlertDialogDescriptionProps & { class?: HTMLAttributes['class'] }>();
9
-
10
- const delegatedProps = reactiveOmit(props, 'class');
6
+ const props = defineProps<AlertDialogDescriptionProps>();
11
7
  </script>
12
8
 
13
9
  <template>
14
10
  <AlertDialogDescription
15
11
  data-slot="alert-dialog-description"
16
- v-bind="delegatedProps"
17
- :class="cn('text-muted-foreground text-sm', props.class)"
12
+ v-bind="props"
13
+ :class="cn('body-14-normal font-normal text-content-on-surface-muted')"
18
14
  >
19
15
  <slot />
20
16
  </AlertDialogDescription>
@@ -1,16 +1,11 @@
1
1
  <script setup lang="ts">
2
- import type { HTMLAttributes } from 'vue';
3
2
  import { cn } from '@/lib/utils';
4
-
5
- const props = defineProps<{
6
- class?: HTMLAttributes['class'];
7
- }>();
8
3
  </script>
9
4
 
10
5
  <template>
11
6
  <div
12
7
  data-slot="alert-dialog-footer"
13
- :class="cn('flex flex-col-reverse gap-2 sm:flex-row sm:justify-end', props.class)"
8
+ :class="cn('flex flex-col-reverse gap-2 sm:flex-row sm:justify-end')"
14
9
  >
15
10
  <slot />
16
11
  </div>
@@ -1,17 +1,9 @@
1
1
  <script setup lang="ts">
2
- import type { HTMLAttributes } from 'vue';
3
2
  import { cn } from '@/lib/utils';
4
-
5
- const props = defineProps<{
6
- class?: HTMLAttributes['class'];
7
- }>();
8
3
  </script>
9
4
 
10
5
  <template>
11
- <div
12
- data-slot="alert-dialog-header"
13
- :class="cn('flex flex-col gap-2 text-center sm:text-left', props.class)"
14
- >
6
+ <div data-slot="alert-dialog-header" :class="cn('flex flex-col gap-2 text-center sm:text-left')">
15
7
  <slot />
16
8
  </div>
17
9
  </template>
@@ -1,20 +1,16 @@
1
1
  <script setup lang="ts">
2
2
  import type { AlertDialogTitleProps } from 'reka-ui';
3
- import type { HTMLAttributes } from 'vue';
4
- import { reactiveOmit } from '@vueuse/core';
5
3
  import { AlertDialogTitle } from 'reka-ui';
6
4
  import { cn } from '@/lib/utils';
7
5
 
8
- const props = defineProps<AlertDialogTitleProps & { class?: HTMLAttributes['class'] }>();
9
-
10
- const delegatedProps = reactiveOmit(props, 'class');
6
+ const props = defineProps<AlertDialogTitleProps>();
11
7
  </script>
12
8
 
13
9
  <template>
14
10
  <AlertDialogTitle
15
11
  data-slot="alert-dialog-title"
16
- v-bind="delegatedProps"
17
- :class="cn('text-lg font-semibold', props.class)"
12
+ v-bind="props"
13
+ :class="cn('text-lg font-semibold text-content-on-surface-primary')"
18
14
  >
19
15
  <slot />
20
16
  </AlertDialogTitle>
@@ -0,0 +1,15 @@
1
+ <script setup lang="ts">
2
+ import type { DialogRootEmits, DialogRootProps } from 'reka-ui';
3
+ import { DialogRoot, useForwardPropsEmits } from 'reka-ui';
4
+
5
+ const props = defineProps<DialogRootProps>();
6
+ const emits = defineEmits<DialogRootEmits>();
7
+
8
+ const forwarded = useForwardPropsEmits(props, emits);
9
+ </script>
10
+
11
+ <template>
12
+ <DialogRoot v-slot="slotProps" data-slot="dialog" v-bind="forwarded">
13
+ <slot v-bind="slotProps" />
14
+ </DialogRoot>
15
+ </template>
@@ -0,0 +1,12 @@
1
+ <script setup lang="ts">
2
+ import type { DialogCloseProps } from 'reka-ui';
3
+ import { DialogClose } from 'reka-ui';
4
+
5
+ const props = defineProps<DialogCloseProps>();
6
+ </script>
7
+
8
+ <template>
9
+ <DialogClose data-slot="dialog-close" v-bind="props">
10
+ <slot />
11
+ </DialogClose>
12
+ </template>
@@ -0,0 +1,48 @@
1
+ <script setup lang="ts">
2
+ import type { DialogContentEmits, DialogContentProps } from 'reka-ui';
3
+ import { reactiveOmit } from '@vueuse/core';
4
+ import {
5
+ DialogContent as DialogContentPrimitive,
6
+ DialogPortal,
7
+ useForwardPropsEmits,
8
+ } from 'reka-ui';
9
+ import { cn } from '@/lib/utils';
10
+ import DialogOverlay from './DialogOverlay.vue';
11
+
12
+ defineOptions({
13
+ inheritAttrs: false,
14
+ });
15
+
16
+ const props = defineProps<
17
+ DialogContentProps & {
18
+ /**
19
+ * Tailwind max-width utility applied to the panel (e.g. `max-w-lg`).
20
+ * @default 'max-w-[50vw]' when omitted (see `UiDialogContent` for the typed preset list).
21
+ */
22
+ maxWidth?: string;
23
+ }
24
+ >();
25
+ const emits = defineEmits<DialogContentEmits>();
26
+
27
+ const delegatedProps = reactiveOmit(props, 'maxWidth');
28
+
29
+ const forwarded = useForwardPropsEmits(delegatedProps, emits);
30
+ </script>
31
+
32
+ <template>
33
+ <DialogPortal>
34
+ <DialogOverlay />
35
+ <DialogContentPrimitive
36
+ data-slot="dialog-content"
37
+ v-bind="{ ...forwarded, ...$attrs }"
38
+ :class="
39
+ cn(
40
+ 'bg-background-surface-modal data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 flex w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] flex-col rounded-lg border border-border-surface-default p-6 shadow-lg duration-200',
41
+ props.maxWidth ?? 'max-w-[50vw]',
42
+ )
43
+ "
44
+ >
45
+ <slot />
46
+ </DialogContentPrimitive>
47
+ </DialogPortal>
48
+ </template>
@@ -0,0 +1,17 @@
1
+ <script setup lang="ts">
2
+ import type { DialogDescriptionProps } from 'reka-ui';
3
+ import { DialogDescription as DialogDescriptionPrimitive } from 'reka-ui';
4
+ import { cn } from '@/lib/utils';
5
+
6
+ const props = defineProps<DialogDescriptionProps>();
7
+ </script>
8
+
9
+ <template>
10
+ <DialogDescriptionPrimitive
11
+ data-slot="dialog-description"
12
+ v-bind="props"
13
+ :class="cn('body-14-normal font-normal text-content-on-surface-muted')"
14
+ >
15
+ <slot />
16
+ </DialogDescriptionPrimitive>
17
+ </template>
@@ -0,0 +1,12 @@
1
+ <script setup lang="ts">
2
+ import { cn } from '@/lib/utils';
3
+ </script>
4
+
5
+ <template>
6
+ <div
7
+ data-slot="dialog-footer"
8
+ :class="cn('flex flex-col-reverse gap-2 sm:flex-row sm:justify-end')"
9
+ >
10
+ <slot />
11
+ </div>
12
+ </template>
@@ -0,0 +1,9 @@
1
+ <script setup lang="ts">
2
+ import { cn } from '@/lib/utils';
3
+ </script>
4
+
5
+ <template>
6
+ <div data-slot="dialog-header" :class="cn('flex flex-col gap-2 text-left')">
7
+ <slot />
8
+ </div>
9
+ </template>
@@ -0,0 +1,23 @@
1
+ <script setup lang="ts">
2
+ import type { DialogOverlayProps } from 'reka-ui';
3
+ import { DialogOverlay, useForwardProps } from 'reka-ui';
4
+ import { cn } from '@/lib/utils';
5
+
6
+ const props = defineProps<DialogOverlayProps>();
7
+
8
+ const forwarded = useForwardProps(props);
9
+ </script>
10
+
11
+ <template>
12
+ <DialogOverlay
13
+ data-slot="dialog-overlay"
14
+ v-bind="forwarded"
15
+ :class="
16
+ cn(
17
+ 'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-overlay-surface-modal-overlay',
18
+ )
19
+ "
20
+ >
21
+ <slot />
22
+ </DialogOverlay>
23
+ </template>
@@ -0,0 +1,17 @@
1
+ <script setup lang="ts">
2
+ import type { DialogTitleProps } from 'reka-ui';
3
+ import { DialogTitle as DialogTitlePrimitive } from 'reka-ui';
4
+ import { cn } from '@/lib/utils';
5
+
6
+ const props = defineProps<DialogTitleProps>();
7
+ </script>
8
+
9
+ <template>
10
+ <DialogTitlePrimitive
11
+ data-slot="dialog-title"
12
+ v-bind="props"
13
+ :class="cn('text-lg font-semibold text-content-on-surface-primary')"
14
+ >
15
+ <slot />
16
+ </DialogTitlePrimitive>
17
+ </template>
@@ -0,0 +1,12 @@
1
+ <script setup lang="ts">
2
+ import type { DialogTriggerProps } from 'reka-ui';
3
+ import { DialogTrigger } from 'reka-ui';
4
+
5
+ const props = defineProps<DialogTriggerProps>();
6
+ </script>
7
+
8
+ <template>
9
+ <DialogTrigger data-slot="dialog-trigger" v-bind="props">
10
+ <slot />
11
+ </DialogTrigger>
12
+ </template>
@@ -0,0 +1,9 @@
1
+ export { default as Dialog } from './Dialog.vue';
2
+ export { default as DialogClose } from './DialogClose.vue';
3
+ export { default as DialogContent } from './DialogContent.vue';
4
+ export { default as DialogDescription } from './DialogDescription.vue';
5
+ export { default as DialogFooter } from './DialogFooter.vue';
6
+ export { default as DialogHeader } from './DialogHeader.vue';
7
+ export { default as DialogOverlay } from './DialogOverlay.vue';
8
+ export { default as DialogTitle } from './DialogTitle.vue';
9
+ export { default as DialogTrigger } from './DialogTrigger.vue';
@@ -29,7 +29,7 @@
29
29
  <DialogPortal>
30
30
  <DialogOverlay
31
31
  data-slot="drawer-overlay"
32
- class="data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-modal-overlay"
32
+ class="data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-overlay-surface-modal-overlay"
33
33
  />
34
34
  <DialogContent
35
35
  data-slot="drawer-content"
@@ -12,10 +12,13 @@
12
12
  class?: HTMLAttributes['class'];
13
13
  variant?: ItemVariants['variant'];
14
14
  size?: ItemVariants['size'];
15
+ /** When false, omits `role="listitem"` (e.g. item is already inside an `<li>`). */
16
+ withListSemantics?: boolean;
15
17
  }
16
18
  >(),
17
19
  {
18
20
  as: 'div',
21
+ withListSemantics: true,
19
22
  },
20
23
  );
21
24
  </script>
@@ -23,10 +26,10 @@
23
26
  <template>
24
27
  <Primitive
25
28
  data-slot="item"
26
- :as="as"
27
- :as-child="asChild"
28
- :class="cn(itemVariants({ variant, size }), props.class)"
29
- role="listitem"
29
+ :as="props.as"
30
+ :as-child="props.asChild"
31
+ :class="cn(itemVariants({ variant: props.variant, size: props.size }), props.class)"
32
+ :role="props.withListSemantics ? 'listitem' : undefined"
30
33
  >
31
34
  <slot />
32
35
  </Primitive>
@@ -19,11 +19,16 @@
19
19
  <ProgressRoot
20
20
  data-slot="progress"
21
21
  v-bind="delegatedProps"
22
- :class="cn('bg-primary/20 relative h-2 w-full overflow-hidden rounded-full', props.class)"
22
+ :class="
23
+ cn(
24
+ 'bg-background-surface-muted relative h-2 w-full overflow-hidden rounded-full',
25
+ props.class,
26
+ )
27
+ "
23
28
  >
24
29
  <ProgressIndicator
25
30
  data-slot="progress-indicator"
26
- class="bg-primary h-full w-full flex-1 transition-all"
31
+ class="bg-background-accent-default h-full w-full flex-1 transition-all"
27
32
  :style="`transform: translateX(-${100 - (props.modelValue ?? 0)}%);`"
28
33
  />
29
34
  </ProgressRoot>
@@ -13,7 +13,7 @@
13
13
  data-slot="sheet-overlay"
14
14
  :class="
15
15
  cn(
16
- 'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-modal-overlay',
16
+ 'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-overlay-surface-modal-overlay',
17
17
  $attrs.class ?? '',
18
18
  )
19
19
  "
@@ -12,10 +12,14 @@ export * from './UiCalendar';
12
12
  export * from './UiCard';
13
13
  export * from './UiCheckbox';
14
14
  export * from './UiChip';
15
+ export * from './UiCodeBlock';
16
+ export * from './UiDialog';
15
17
  export * from './UiDrawer';
16
18
  export * from './UiDropdownMenu';
17
19
  export * from './UiEmpty';
18
20
  export * from './UiField';
21
+ export * from './UiFileItem';
22
+ export * from './UiFileUploadBox';
19
23
  export * from './UiIcon';
20
24
  export * from './UiIconButton';
21
25
  export * from './UiInput';