@aleph-alpha/ui-library 7.0.2 → 7.2.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 (64) hide show
  1. package/dist/system/components/UiPagination/UiPagination.vue.d.ts +19 -0
  2. package/dist/system/components/UiPagination/constants.d.ts +6 -0
  3. package/dist/system/components/UiPagination/index.d.ts +3 -0
  4. package/dist/system/components/UiPagination/types.d.ts +81 -0
  5. package/dist/system/components/UiSlider/step-marks.d.ts +45 -0
  6. package/dist/system/components/UiSlider/types.d.ts +28 -0
  7. package/dist/system/components/core/pagination/Pagination.vue.d.ts +29 -0
  8. package/dist/system/components/core/pagination/PaginationContent.vue.d.ts +29 -0
  9. package/dist/system/components/core/pagination/PaginationEllipsis.vue.d.ts +22 -0
  10. package/dist/system/components/core/pagination/PaginationFirst.vue.d.ts +22 -0
  11. package/dist/system/components/core/pagination/PaginationItem.vue.d.ts +26 -0
  12. package/dist/system/components/core/pagination/PaginationLast.vue.d.ts +22 -0
  13. package/dist/system/components/core/pagination/PaginationNext.vue.d.ts +22 -0
  14. package/dist/system/components/core/pagination/PaginationPrevious.vue.d.ts +22 -0
  15. package/dist/system/components/core/pagination/index.d.ts +8 -0
  16. package/dist/system/components/core/slider/Slider.vue.d.ts +21 -1
  17. package/dist/system/components/index.d.ts +1 -0
  18. package/dist/system/icons/story-sidebar-icons.json +4 -0
  19. package/dist/system/lib.js +11762 -10952
  20. package/dist/system/patterns/UiBulkAction/UiBulkAction.vue.d.ts +43 -0
  21. package/dist/system/patterns/UiBulkAction/index.d.ts +3 -0
  22. package/dist/system/patterns/UiBulkAction/types.d.ts +109 -0
  23. package/dist/system/patterns/UiBulkAction/useBulkAction.d.ts +7 -0
  24. package/dist/system/patterns/UiDataTable/constants.d.ts +10 -0
  25. package/dist/system/patterns/index.d.ts +1 -0
  26. package/dist/system/story-sidebar-icons.json +4 -0
  27. package/package.json +8 -8
  28. package/src/components/UiPagination/UiPagination.guidance.md +60 -0
  29. package/src/components/UiPagination/UiPagination.stories.ts +1070 -0
  30. package/src/components/UiPagination/UiPagination.vue +109 -0
  31. package/src/components/UiPagination/__tests__/UiPagination.test.ts +203 -0
  32. package/src/components/UiPagination/constants.ts +17 -0
  33. package/src/components/UiPagination/index.ts +3 -0
  34. package/src/components/UiPagination/types.ts +82 -0
  35. package/src/components/UiSlider/UiSlider.stories.ts +710 -2
  36. package/src/components/UiSlider/UiSlider.vue +109 -1
  37. package/src/components/UiSlider/__tests__/UiSliderValueAndSteps.test.ts +210 -0
  38. package/src/components/UiSlider/__tests__/step-marks.test.ts +94 -0
  39. package/src/components/UiSlider/step-marks.ts +96 -0
  40. package/src/components/UiSlider/types.ts +32 -0
  41. package/src/components/core/pagination/Pagination.vue +26 -0
  42. package/src/components/core/pagination/PaginationContent.vue +24 -0
  43. package/src/components/core/pagination/PaginationEllipsis.vue +30 -0
  44. package/src/components/core/pagination/PaginationFirst.vue +30 -0
  45. package/src/components/core/pagination/PaginationItem.vue +39 -0
  46. package/src/components/core/pagination/PaginationLast.vue +30 -0
  47. package/src/components/core/pagination/PaginationNext.vue +35 -0
  48. package/src/components/core/pagination/PaginationPrevious.vue +35 -0
  49. package/src/components/core/pagination/index.ts +8 -0
  50. package/src/components/core/slider/Slider.vue +16 -6
  51. package/src/components/index.ts +1 -0
  52. package/src/patterns/UiBulkAction/UiBulkAction.guidance.md +59 -0
  53. package/src/patterns/UiBulkAction/UiBulkAction.stories.ts +2238 -0
  54. package/src/patterns/UiBulkAction/UiBulkAction.vue +62 -0
  55. package/src/patterns/UiBulkAction/__tests__/useBulkAction.test.ts +78 -0
  56. package/src/patterns/UiBulkAction/index.ts +3 -0
  57. package/src/patterns/UiBulkAction/types.ts +126 -0
  58. package/src/patterns/UiBulkAction/useBulkAction.ts +50 -0
  59. package/src/patterns/UiDataTable/UiDataTable.stories.ts +375 -1
  60. package/src/patterns/UiDataTable/UiDataTablePagination.vue +43 -60
  61. package/src/patterns/UiDataTable/__tests__/UiDataTablePagination.test.ts +58 -29
  62. package/src/patterns/UiDataTable/constants.ts +10 -0
  63. package/src/patterns/UiProfileCard/UiProfileCard.stories.ts +12 -12
  64. package/src/patterns/index.ts +1 -0
@@ -0,0 +1,39 @@
1
+ <script setup lang="ts">
2
+ import type { PaginationListItemProps } from 'reka-ui';
3
+ import type { HTMLAttributes } from 'vue';
4
+ import { reactiveOmit } from '@vueuse/core';
5
+ import { PaginationListItem } from 'reka-ui';
6
+ import { buttonVariants } from '@/components/core/button';
7
+ import { cn } from '@/lib/utils';
8
+
9
+ const props = withDefaults(
10
+ defineProps<
11
+ PaginationListItemProps & {
12
+ isActive?: boolean;
13
+ class?: HTMLAttributes['class'];
14
+ }
15
+ >(),
16
+ {
17
+ isActive: false,
18
+ class: undefined,
19
+ },
20
+ );
21
+
22
+ const delegatedProps = reactiveOmit(props, 'class', 'isActive');
23
+ </script>
24
+
25
+ <template>
26
+ <PaginationListItem
27
+ data-slot="pagination-item"
28
+ v-bind="delegatedProps"
29
+ :class="
30
+ cn(
31
+ buttonVariants({ variant: props.isActive ? 'outline' : 'ghost' }),
32
+ 'min-w-9 px-2 tabular-nums',
33
+ props.class,
34
+ )
35
+ "
36
+ >
37
+ <slot />
38
+ </PaginationListItem>
39
+ </template>
@@ -0,0 +1,30 @@
1
+ <script setup lang="ts">
2
+ import type { PaginationLastProps } from 'reka-ui';
3
+ import type { HTMLAttributes } from 'vue';
4
+ import { reactiveOmit } from '@vueuse/core';
5
+ import { PaginationLast } from 'reka-ui';
6
+ import { buttonVariants } from '@/components/core/button';
7
+ import { UiIcon } from '@/components/UiIcon';
8
+ import { ChevronsRightIcon } from '@/icons/lucide';
9
+ import { cn } from '@/lib/utils';
10
+
11
+ const props = defineProps<
12
+ PaginationLastProps & { class?: HTMLAttributes['class'] }
13
+ >();
14
+
15
+ const delegatedProps = reactiveOmit(props, 'class');
16
+ </script>
17
+
18
+ <template>
19
+ <PaginationLast
20
+ data-slot="pagination-last"
21
+ v-bind="delegatedProps"
22
+ :class="
23
+ cn(buttonVariants({ variant: 'ghost' }), 'min-w-9 px-2', props.class)
24
+ "
25
+ >
26
+ <slot>
27
+ <UiIcon :name="ChevronsRightIcon" size="s" />
28
+ </slot>
29
+ </PaginationLast>
30
+ </template>
@@ -0,0 +1,35 @@
1
+ <script setup lang="ts">
2
+ import type { PaginationNextProps } from 'reka-ui';
3
+ import type { HTMLAttributes } from 'vue';
4
+ import { reactiveOmit } from '@vueuse/core';
5
+ import { PaginationNext } from 'reka-ui';
6
+ import { buttonVariants } from '@/components/core/button';
7
+ import { UiIcon } from '@/components/UiIcon';
8
+ import { ChevronRightIcon } from '@/icons/lucide';
9
+ import { cn } from '@/lib/utils';
10
+
11
+ const props = defineProps<
12
+ PaginationNextProps & { class?: HTMLAttributes['class'] }
13
+ >();
14
+
15
+ const delegatedProps = reactiveOmit(props, 'class');
16
+ </script>
17
+
18
+ <template>
19
+ <PaginationNext
20
+ data-slot="pagination-next"
21
+ v-bind="delegatedProps"
22
+ :class="
23
+ cn(
24
+ buttonVariants({ variant: 'ghost' }),
25
+ 'min-w-9 px-2 sm:pl-3',
26
+ props.class,
27
+ )
28
+ "
29
+ >
30
+ <slot>
31
+ <span class="hidden sm:inline">Next</span>
32
+ <UiIcon :name="ChevronRightIcon" size="s" />
33
+ </slot>
34
+ </PaginationNext>
35
+ </template>
@@ -0,0 +1,35 @@
1
+ <script setup lang="ts">
2
+ import type { PaginationPrevProps } from 'reka-ui';
3
+ import type { HTMLAttributes } from 'vue';
4
+ import { reactiveOmit } from '@vueuse/core';
5
+ import { PaginationPrev } from 'reka-ui';
6
+ import { buttonVariants } from '@/components/core/button';
7
+ import { UiIcon } from '@/components/UiIcon';
8
+ import { ChevronLeftIcon } from '@/icons/lucide';
9
+ import { cn } from '@/lib/utils';
10
+
11
+ const props = defineProps<
12
+ PaginationPrevProps & { class?: HTMLAttributes['class'] }
13
+ >();
14
+
15
+ const delegatedProps = reactiveOmit(props, 'class');
16
+ </script>
17
+
18
+ <template>
19
+ <PaginationPrev
20
+ data-slot="pagination-previous"
21
+ v-bind="delegatedProps"
22
+ :class="
23
+ cn(
24
+ buttonVariants({ variant: 'ghost' }),
25
+ 'min-w-9 px-2 sm:pr-3',
26
+ props.class,
27
+ )
28
+ "
29
+ >
30
+ <slot>
31
+ <UiIcon :name="ChevronLeftIcon" size="s" />
32
+ <span class="hidden sm:inline">Previous</span>
33
+ </slot>
34
+ </PaginationPrev>
35
+ </template>
@@ -0,0 +1,8 @@
1
+ export { default as Pagination } from './Pagination.vue';
2
+ export { default as PaginationContent } from './PaginationContent.vue';
3
+ export { default as PaginationEllipsis } from './PaginationEllipsis.vue';
4
+ export { default as PaginationFirst } from './PaginationFirst.vue';
5
+ export { default as PaginationItem } from './PaginationItem.vue';
6
+ export { default as PaginationLast } from './PaginationLast.vue';
7
+ export { default as PaginationNext } from './PaginationNext.vue';
8
+ export { default as PaginationPrevious } from './PaginationPrevious.vue';
@@ -12,11 +12,15 @@ import {
12
12
  import { cn } from '@/lib/utils';
13
13
 
14
14
  const props = defineProps<
15
- SliderRootProps & { class?: HTMLAttributes['class'] }
15
+ SliderRootProps & {
16
+ class?: HTMLAttributes['class'];
17
+ /** Text a screen reader announces for a handle's value, as `aria-valuetext`. */
18
+ thumbValueText?: (value: number) => string;
19
+ }
16
20
  >();
17
21
  const emits = defineEmits<SliderRootEmits>();
18
22
 
19
- const delegatedProps = reactiveOmit(props, 'class');
23
+ const delegatedProps = reactiveOmit(props, 'class', 'thumbValueText');
20
24
 
21
25
  const forwarded = useForwardPropsEmits(delegatedProps, emits);
22
26
  </script>
@@ -27,7 +31,7 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits);
27
31
  data-slot="slider"
28
32
  :class="
29
33
  cn(
30
- 'relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col',
34
+ 'relative flex w-full touch-none items-center select-none [--slider-thumb-size:1rem] data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col',
31
35
  props.class,
32
36
  )
33
37
  "
@@ -43,12 +47,18 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits);
43
47
  />
44
48
  </SliderTrack>
45
49
 
50
+ <!-- Outside the track, which clips what it holds. -->
51
+ <slot name="track-overlay" />
52
+
46
53
  <SliderThumb
47
- v-for="(_, key) in modelValue"
54
+ v-for="(thumbValue, key) in modelValue"
48
55
  :key="key"
49
56
  data-slot="slider-thumb"
50
57
  :aria-label="(modelValue?.length ?? 0) > 1 ? `Value ${key + 1}` : 'Value'"
51
- class="bg-white border-accent-default ring-ring/50 block size-4 shrink-0 rounded-full border shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"
52
- />
58
+ :aria-valuetext="props.thumbValueText?.(thumbValue)"
59
+ class="bg-white border-accent-default ring-ring/50 block size-[var(--slider-thumb-size)] shrink-0 rounded-full border shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"
60
+ >
61
+ <slot name="thumb" :value="thumbValue" />
62
+ </SliderThumb>
53
63
  </SliderRoot>
54
64
  </template>
@@ -33,6 +33,7 @@ export * from './UiKbd';
33
33
  export * from './UiLabel';
34
34
  export * from './UiListbox';
35
35
  export * from './UiNavigationMenu';
36
+ export * from './UiPagination';
36
37
  export * from './UiPopover';
37
38
  export * from './UiProgress';
38
39
  export * from './UiRadioGroup';
@@ -0,0 +1,59 @@
1
+ ## Usage
2
+
3
+ Bulk actions let the user apply one action to many rows at once — export, assign, change a status, delete. They are not a component of their own: the Floating Action carries them, placed above the Data Table.
4
+
5
+ Each product decides which actions it offers. This page describes how they behave, not which ones they are.
6
+
7
+ ### Selection comes first
8
+
9
+ The Floating Action follows the selection:
10
+
11
+ - With nothing selected, it shows the checkbox and table-wide actions only
12
+ - Once rows are selected, it shows the count and the bulk actions
13
+ - The header checkbox selects the current page; “Select all results” is a separate step
14
+ - Clearing the selection returns it to its default state
15
+
16
+ ### One band, in a fixed order
17
+
18
+ The Floating Action keeps the same order in every product:
19
+
20
+ 1. Selection checkbox, with the count of selected rows
21
+ 2. Primary actions, as labelled buttons
22
+ 3. Further actions, collected in an overflow menu
23
+ 4. Destructive actions last, set apart by a separator
24
+
25
+ ### What each product decides
26
+
27
+ The behaviour is shared; the content is not. Each product sets:
28
+
29
+ - Which actions are offered, and how many show before the overflow
30
+ - Whether an action asks for confirmation or can be undone
31
+ - The Floating Action type — Label, Icon or Input — per breakpoint
32
+ - Whether the selection survives a change of scope tab
33
+
34
+ ## Do
35
+
36
+ - Show how many rows are selected, in the Floating Action itself
37
+ - Keep the same order of actions in every product
38
+ - Label actions with a verb — Export, Assign, Delete
39
+ - Disable an action that does not apply to the selection, and say why
40
+ - Keep the selection while the user filters, and say when selected rows are hidden
41
+ - Report the result — how many rows succeeded, and which failed
42
+
43
+ ## Don't
44
+
45
+ - Build a separate bulk-action bar next to the Floating Action
46
+ - Show bulk actions before anything is selected
47
+ - Name the same action differently on the row and in the Floating Action
48
+ - Run a destructive bulk action without confirmation or undo
49
+ - Clear the selection silently when the user filters or pages
50
+ - Use icons alone where there is room for labels
51
+
52
+ ## Accessibility
53
+
54
+ - The selected count is announced when it changes (role="status")
55
+ - Every action in the Floating Action is reachable by keyboard, in visual order
56
+ - Icon-only actions carry an accessible name and a tooltip
57
+ - Disabled actions stay focusable and explain why they are unavailable
58
+ - The header checkbox reports a mixed state when only some rows are selected
59
+ - The result of a bulk action is announced, not only shown