@aleph-alpha/ui-library 2.10.0 → 2.12.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 (171) hide show
  1. package/config.d.ts +8 -2
  2. package/config.js +85 -73
  3. package/dist/system/components/UiAutocomplete/UiAutocomplete.vue.d.ts +0 -1
  4. package/dist/system/components/UiAutocomplete/types.d.ts +0 -3
  5. package/dist/system/components/UiDialog/UiDialogDescription.vue.d.ts +2 -1
  6. package/dist/system/components/UiDialog/UiDialogFooter.vue.d.ts +1 -2
  7. package/dist/system/components/UiDialog/UiDialogHeader.vue.d.ts +1 -2
  8. package/dist/system/components/UiDialog/UiDialogTitle.vue.d.ts +2 -1
  9. package/dist/system/components/UiDialog/types.d.ts +10 -4
  10. package/dist/system/components/UiDropdownMenu/UiDropdownMenuSub.vue.d.ts +3 -1
  11. package/dist/system/components/UiField/UiFieldError.vue.d.ts +8 -1
  12. package/dist/system/components/UiInput/UiInput.vue.d.ts +16 -1
  13. package/dist/system/components/UiSelect/UiSelect.vue.d.ts +4 -5
  14. package/dist/system/components/UiSelect/UiSelectContent.vue.d.ts +0 -1
  15. package/dist/system/components/UiSelect/UiSelectItem.vue.d.ts +2 -9
  16. package/dist/system/components/UiSelect/UiSelectTrigger.vue.d.ts +0 -2
  17. package/dist/system/components/UiSelect/UiSelectValue.vue.d.ts +0 -3
  18. package/dist/system/components/UiSelect/types.d.ts +26 -6
  19. package/dist/system/components/UiStepper/UiStepperDescription.vue.d.ts +3 -1
  20. package/dist/system/components/UiStepper/UiStepperIndicator.vue.d.ts +3 -1
  21. package/dist/system/components/UiStepper/UiStepperItem.vue.d.ts +3 -1
  22. package/dist/system/components/UiTagsInput/types.d.ts +1 -2
  23. package/dist/system/components/core/accordion/AccordionItem.vue.d.ts +3 -1
  24. package/dist/system/components/core/calendar/CalendarHeading.vue.d.ts +2 -2
  25. package/dist/system/components/core/dropdown-menu/DropdownMenuSub.vue.d.ts +3 -1
  26. package/dist/system/components/core/range-calendar/RangeCalendarHeading.vue.d.ts +2 -2
  27. package/dist/system/components/core/stepper/StepperDescription.vue.d.ts +3 -1
  28. package/dist/system/components/core/stepper/StepperIndicator.vue.d.ts +3 -1
  29. package/dist/system/components/core/stepper/StepperItem.vue.d.ts +3 -1
  30. package/dist/system/index.d.ts +2 -1
  31. package/dist/system/lib/utils.d.ts +6 -0
  32. package/dist/system/lib.js +9685 -9895
  33. package/dist/system/patterns/UiSidebar/UiSidebarContent.vue.d.ts +1 -2
  34. package/dist/system/patterns/UiSidebar/UiSidebarFooter.vue.d.ts +1 -2
  35. package/dist/system/patterns/UiSidebar/UiSidebarGroupContent.vue.d.ts +1 -2
  36. package/dist/system/patterns/UiSidebar/UiSidebarInset.vue.d.ts +1 -2
  37. package/dist/system/patterns/UiSidebar/UiSidebarMenu.vue.d.ts +1 -2
  38. package/dist/system/patterns/UiSidebar/UiSidebarMenuItem.vue.d.ts +1 -2
  39. package/dist/system/patterns/UiSidebar/UiSidebarProvider.vue.d.ts +1 -2
  40. package/dist/system/patterns/UiSidebar/UiSidebarRail.vue.d.ts +1 -2
  41. package/dist/system/patterns/UiSidebar/__tests__/sidebar-test-helpers.d.ts +9 -9
  42. package/dist/system/patterns/UiSidebar/types.d.ts +8 -16
  43. package/dist/system/story-sidebar-icons.json +10 -0
  44. package/package.json +5 -2
  45. package/src/@types/shims-vue.d.ts +1 -1
  46. package/src/__tests__/test-utils.ts +1 -1
  47. package/src/components/UiAlertDialog/UiAlertDialogAction.vue +1 -1
  48. package/src/components/UiAlertDialog/UiAlertDialogCancel.vue +1 -1
  49. package/src/components/UiAlertDialog/UiAlertDialogContent.vue +4 -1
  50. package/src/components/UiAlertDialog/UiAlertDialogDescription.vue +1 -1
  51. package/src/components/UiAlertDialog/UiAlertDialogTitle.vue +1 -1
  52. package/src/components/UiAlertDialog/UiAlertDialogTrigger.vue +1 -1
  53. package/src/components/UiAutocomplete/UiAutocomplete.vue +9 -9
  54. package/src/components/UiAutocomplete/__tests__/UiAutocomplete.test.ts +76 -5
  55. package/src/components/UiAutocomplete/types.ts +0 -3
  56. package/src/components/UiBadge/UiBadge.vue +1 -1
  57. package/src/components/UiBadge/constants.ts +1 -1
  58. package/src/components/UiBadge/types.ts +1 -1
  59. package/src/components/UiButton/UiButton.stories.ts +286 -198
  60. package/src/components/UiButton/mcp-docs.json +49 -0
  61. package/src/components/UiCalendar/UiCalendar.vue +2 -5
  62. package/src/components/UiCalendar/__tests__/UiCalendar.test.ts +4 -2
  63. package/src/components/UiCheckbox/UiCheckbox.stories.ts +176 -2
  64. package/src/components/UiCheckbox/mcp-docs.json +36 -0
  65. package/src/components/UiChip/types.ts +1 -1
  66. package/src/components/UiDialog/UiDialogFooter.vue +0 -3
  67. package/src/components/UiDialog/UiDialogHeader.vue +0 -3
  68. package/src/components/UiDialog/types.ts +10 -4
  69. package/src/components/UiDropdownMenu/__tests__/UiDropdownMenu.test.ts +1 -1
  70. package/src/components/UiField/UiField.stories.ts +265 -3
  71. package/src/components/UiField/UiField.vue +9 -2
  72. package/src/components/UiField/UiFieldError.vue +3 -3
  73. package/src/components/UiField/mcp-docs.json +72 -0
  74. package/src/components/UiFileItem/UiFileItem.stories.ts +11 -11
  75. package/src/components/UiFileUploadBox/UiFileUploadBox.vue +1 -1
  76. package/src/components/UiIcon/UiIcon.vue +3 -2
  77. package/src/components/UiInput/UiInput.vue +19 -3
  78. package/src/components/UiInput/mcp-docs.json +51 -0
  79. package/src/components/UiItem/UiItem.stories.ts +118 -2
  80. package/src/components/UiItem/__tests__/UiItem.test.ts +3 -5
  81. package/src/components/UiItem/mcp-docs.json +25 -0
  82. package/src/components/UiLabel/UiLabel.vue +1 -1
  83. package/src/components/UiListbox/UiListbox.vue +3 -6
  84. package/src/components/UiListbox/UiListboxFilter.vue +1 -1
  85. package/src/components/UiListbox/UiListboxItem.vue +1 -1
  86. package/src/components/UiProgress/UiProgress.vue +1 -1
  87. package/src/components/UiRadioGroup/UiRadioGroup.vue +1 -1
  88. package/src/components/UiRadioGroup/UiRadioGroupItem.vue +2 -2
  89. package/src/components/UiRadioGroup/__tests__/UiRadioGroup.test.ts +2 -2
  90. package/src/components/UiRangeCalendar/UiRangeCalendar.vue +2 -5
  91. package/src/components/UiRangeCalendar/__tests__/UiRangeCalendar.test.ts +9 -6
  92. package/src/components/UiSelect/UiSelect.stories.ts +4 -90
  93. package/src/components/UiSelect/UiSelect.vue +66 -144
  94. package/src/components/UiSelect/UiSelectContent.vue +8 -21
  95. package/src/components/UiSelect/UiSelectItem.vue +0 -82
  96. package/src/components/UiSelect/UiSelectTrigger.vue +1 -62
  97. package/src/components/UiSelect/UiSelectValue.vue +1 -47
  98. package/src/components/UiSelect/__tests__/UiSelect.test.ts +47 -98
  99. package/src/components/UiSelect/__tests__/UiSelectContent.test.ts +36 -3
  100. package/src/components/UiSelect/__tests__/UiSelectItem.test.ts +1 -1
  101. package/src/components/UiSelect/__tests__/UiSelectTrigger.test.ts +2 -2
  102. package/src/components/UiSelect/types.ts +29 -6
  103. package/src/components/UiSwitch/UiSwitch.vue +1 -1
  104. package/src/components/UiTagsInput/UiTagsInput.vue +1 -1
  105. package/src/components/UiTagsInput/UiTagsInputInput.vue +1 -1
  106. package/src/components/UiTagsInput/UiTagsInputItem.vue +1 -1
  107. package/src/components/UiTagsInput/types.ts +1 -4
  108. package/src/components/UiTooltip/UiTooltip.stories.ts +0 -8
  109. package/src/components/core/accordion/AccordionItem.vue +1 -1
  110. package/src/components/core/alert-dialog/AlertDialogContent.vue +1 -1
  111. package/src/components/core/badge/Badge.vue +2 -5
  112. package/src/components/core/calendar/CalendarHeading.vue +1 -1
  113. package/src/components/core/dropdown-menu/DropdownMenuSub.vue +1 -1
  114. package/src/components/core/item/index.ts +1 -1
  115. package/src/components/core/listbox/Listbox.vue +2 -5
  116. package/src/components/core/listbox/ListboxContent.vue +2 -5
  117. package/src/components/core/listbox/ListboxFilter.vue +2 -5
  118. package/src/components/core/listbox/ListboxGroup.vue +2 -5
  119. package/src/components/core/listbox/ListboxGroupLabel.vue +2 -5
  120. package/src/components/core/listbox/ListboxItem.vue +2 -5
  121. package/src/components/core/listbox/ListboxItemIndicator.vue +2 -5
  122. package/src/components/core/range-calendar/RangeCalendarHeading.vue +1 -1
  123. package/src/components/core/sidebar/SidebarContent.vue +4 -5
  124. package/src/components/core/sidebar/SidebarFooter.vue +4 -5
  125. package/src/components/core/sidebar/SidebarGroup.vue +4 -5
  126. package/src/components/core/sidebar/SidebarHeader.vue +4 -5
  127. package/src/components/core/sidebar/SidebarMenu.vue +4 -5
  128. package/src/components/core/sidebar/SidebarMenuAction.vue +1 -1
  129. package/src/components/core/sidebar/SidebarMenuButtonChild.vue +1 -1
  130. package/src/components/core/sidebar/SidebarMenuSkeleton.vue +1 -1
  131. package/src/components/core/sidebar/SidebarMenuSubButton.vue +1 -1
  132. package/src/components/core/sidebar/SidebarSeparator.vue +4 -5
  133. package/src/components/core/stepper/StepperDescription.vue +1 -1
  134. package/src/components/core/stepper/StepperIndicator.vue +1 -1
  135. package/src/components/core/stepper/StepperItem.vue +1 -1
  136. package/src/components/core/tags-input/TagsInput.vue +2 -5
  137. package/src/components/core/tags-input/TagsInputInput.vue +2 -5
  138. package/src/components/core/tags-input/TagsInputItem.vue +2 -5
  139. package/src/components/core/tags-input/TagsInputItemDelete.vue +2 -5
  140. package/src/components/core/tags-input/TagsInputItemText.vue +2 -5
  141. package/src/components/core/toggle/Toggle.vue +1 -1
  142. package/src/index.ts +30 -5
  143. package/src/lib/useDrag.ts +1 -0
  144. package/src/lib/utils.ts +12 -0
  145. package/src/patterns/UiDataTable/UiDataTable.mock.ts +13 -4
  146. package/src/patterns/UiDataTable/UiDataTable.vue +1 -0
  147. package/src/patterns/UiDataTable/__tests__/UiDataTable.test.ts +11 -2
  148. package/src/patterns/UiDatePicker/__tests__/UiDatePicker.test.ts +28 -39
  149. package/src/patterns/UiSidebar/UiSidebarContent.vue +0 -3
  150. package/src/patterns/UiSidebar/UiSidebarFooter.vue +0 -3
  151. package/src/patterns/UiSidebar/UiSidebarGroup.vue +4 -5
  152. package/src/patterns/UiSidebar/UiSidebarGroupContent.vue +0 -3
  153. package/src/patterns/UiSidebar/UiSidebarHeader.vue +4 -5
  154. package/src/patterns/UiSidebar/UiSidebarInset.vue +0 -3
  155. package/src/patterns/UiSidebar/UiSidebarMenu.vue +0 -3
  156. package/src/patterns/UiSidebar/UiSidebarMenuButton.vue +4 -5
  157. package/src/patterns/UiSidebar/UiSidebarMenuItem.vue +0 -3
  158. package/src/patterns/UiSidebar/UiSidebarMenuSub.vue +4 -5
  159. package/src/patterns/UiSidebar/UiSidebarMenuSubItem.vue +4 -5
  160. package/src/patterns/UiSidebar/UiSidebarPopoverMenu.vue +4 -5
  161. package/src/patterns/UiSidebar/UiSidebarPopoverMenuItem.vue +4 -5
  162. package/src/patterns/UiSidebar/UiSidebarPopoverTrigger.vue +4 -5
  163. package/src/patterns/UiSidebar/UiSidebarProvider.vue +0 -3
  164. package/src/patterns/UiSidebar/UiSidebarRail.vue +0 -3
  165. package/src/patterns/UiSidebar/UiSidebarSub.vue +4 -5
  166. package/src/patterns/UiSidebar/__tests__/UiSidebar.test.ts +21 -17
  167. package/src/patterns/UiSidebar/__tests__/UiSidebarMenuButton.test.ts +12 -10
  168. package/src/patterns/UiSidebar/types.ts +8 -8
  169. package/src/theme/Typography.stories.ts +3 -2
  170. package/dist/system/components/UiSelect/context.d.ts +0 -28
  171. package/src/components/UiSelect/context.ts +0 -42
@@ -3,16 +3,13 @@ import type { ListboxContentProps } from 'reka-ui';
3
3
  import type { HTMLAttributes } from 'vue';
4
4
  import { ListboxContent, useForwardProps } from 'reka-ui';
5
5
  import { computed } from 'vue';
6
- import { cn } from '@/lib/utils';
6
+ import { cn, omitClass } from '@/lib/utils';
7
7
 
8
8
  const props = defineProps<
9
9
  ListboxContentProps & { class?: HTMLAttributes['class'] }
10
10
  >();
11
11
 
12
- const delegatedProps = computed(() => {
13
- const { class: _class, ...delegated } = props;
14
- return delegated;
15
- });
12
+ const delegatedProps = computed(() => omitClass(props));
16
13
 
17
14
  const forwardedProps = useForwardProps(delegatedProps);
18
15
  </script>
@@ -3,17 +3,14 @@ import type { ListboxFilterEmits, ListboxFilterProps } from 'reka-ui';
3
3
  import type { HTMLAttributes } from 'vue';
4
4
  import { ListboxFilter, useForwardPropsEmits } from 'reka-ui';
5
5
  import { computed } from 'vue';
6
- import { cn } from '@/lib/utils';
6
+ import { cn, omitClass } from '@/lib/utils';
7
7
 
8
8
  const props = defineProps<
9
9
  ListboxFilterProps & { class?: HTMLAttributes['class'] }
10
10
  >();
11
11
  const emits = defineEmits<ListboxFilterEmits>();
12
12
 
13
- const delegatedProps = computed(() => {
14
- const { class: _class, ...delegated } = props;
15
- return delegated;
16
- });
13
+ const delegatedProps = computed(() => omitClass(props));
17
14
 
18
15
  const forwarded = useForwardPropsEmits(delegatedProps, emits);
19
16
  </script>
@@ -3,16 +3,13 @@ import type { ListboxGroupProps } from 'reka-ui';
3
3
  import type { HTMLAttributes } from 'vue';
4
4
  import { ListboxGroup, useForwardProps } from 'reka-ui';
5
5
  import { computed } from 'vue';
6
- import { cn } from '@/lib/utils';
6
+ import { cn, omitClass } from '@/lib/utils';
7
7
 
8
8
  const props = defineProps<
9
9
  ListboxGroupProps & { class?: HTMLAttributes['class'] }
10
10
  >();
11
11
 
12
- const delegatedProps = computed(() => {
13
- const { class: _class, ...delegated } = props;
14
- return delegated;
15
- });
12
+ const delegatedProps = computed(() => omitClass(props));
16
13
 
17
14
  const forwardedProps = useForwardProps(delegatedProps);
18
15
  </script>
@@ -3,16 +3,13 @@ import type { ListboxGroupLabelProps } from 'reka-ui';
3
3
  import type { HTMLAttributes } from 'vue';
4
4
  import { ListboxGroupLabel, useForwardProps } from 'reka-ui';
5
5
  import { computed } from 'vue';
6
- import { cn } from '@/lib/utils';
6
+ import { cn, omitClass } from '@/lib/utils';
7
7
 
8
8
  const props = defineProps<
9
9
  ListboxGroupLabelProps & { class?: HTMLAttributes['class'] }
10
10
  >();
11
11
 
12
- const delegatedProps = computed(() => {
13
- const { class: _class, ...delegated } = props;
14
- return delegated;
15
- });
12
+ const delegatedProps = computed(() => omitClass(props));
16
13
 
17
14
  const forwardedProps = useForwardProps(delegatedProps);
18
15
  </script>
@@ -3,17 +3,14 @@ import type { ListboxItemEmits, ListboxItemProps } from 'reka-ui';
3
3
  import type { HTMLAttributes } from 'vue';
4
4
  import { ListboxItem, useForwardPropsEmits } from 'reka-ui';
5
5
  import { computed } from 'vue';
6
- import { cn } from '@/lib/utils';
6
+ import { cn, omitClass } from '@/lib/utils';
7
7
 
8
8
  const props = defineProps<
9
9
  ListboxItemProps & { class?: HTMLAttributes['class'] }
10
10
  >();
11
11
  const emits = defineEmits<ListboxItemEmits>();
12
12
 
13
- const delegatedProps = computed(() => {
14
- const { class: _class, ...delegated } = props;
15
- return delegated;
16
- });
13
+ const delegatedProps = computed(() => omitClass(props));
17
14
 
18
15
  const forwarded = useForwardPropsEmits(delegatedProps, emits);
19
16
  </script>
@@ -3,16 +3,13 @@ import type { ListboxItemIndicatorProps } from 'reka-ui';
3
3
  import type { HTMLAttributes } from 'vue';
4
4
  import { ListboxItemIndicator, useForwardProps } from 'reka-ui';
5
5
  import { computed } from 'vue';
6
- import { cn } from '@/lib/utils';
6
+ import { cn, omitClass } from '@/lib/utils';
7
7
 
8
8
  const props = defineProps<
9
9
  ListboxItemIndicatorProps & { class?: HTMLAttributes['class'] }
10
10
  >();
11
11
 
12
- const delegatedProps = computed(() => {
13
- const { class: _class, ...delegated } = props;
14
- return delegated;
15
- });
12
+ const delegatedProps = computed(() => omitClass(props));
16
13
 
17
14
  const forwardedProps = useForwardProps(delegatedProps);
18
15
  </script>
@@ -10,7 +10,7 @@ const props = defineProps<
10
10
  >();
11
11
 
12
12
  defineSlots<{
13
- default: (props: { headingValue: string }) => any;
13
+ default: (props: { headingValue: string }) => unknown;
14
14
  }>();
15
15
 
16
16
  const delegatedProps = reactiveOmit(props, 'class');
@@ -1,14 +1,13 @@
1
1
  <script setup lang="ts">
2
2
  import { computed, useAttrs } from 'vue';
3
- import { cn } from '@/lib/utils';
3
+ import { cn, omitClass } from '@/lib/utils';
4
4
 
5
5
  defineOptions({ inheritAttrs: false });
6
6
 
7
7
  const attrs = useAttrs();
8
- const passthroughAttrs = computed(() => {
9
- const { class: _c, ...rest } = attrs as Record<string, unknown>;
10
- return rest;
11
- });
8
+ const passthroughAttrs = computed(() =>
9
+ omitClass(attrs as Record<string, unknown>),
10
+ );
12
11
  const attrClass = computed(() => (attrs.class as string | undefined) ?? '');
13
12
  </script>
14
13
 
@@ -1,14 +1,13 @@
1
1
  <script setup lang="ts">
2
2
  import { computed, useAttrs } from 'vue';
3
- import { cn } from '@/lib/utils';
3
+ import { cn, omitClass } from '@/lib/utils';
4
4
 
5
5
  defineOptions({ inheritAttrs: false });
6
6
 
7
7
  const attrs = useAttrs();
8
- const passthroughAttrs = computed(() => {
9
- const { class: _c, ...rest } = attrs as Record<string, unknown>;
10
- return rest;
11
- });
8
+ const passthroughAttrs = computed(() =>
9
+ omitClass(attrs as Record<string, unknown>),
10
+ );
12
11
  const attrClass = computed(() => (attrs.class as string | undefined) ?? '');
13
12
  </script>
14
13
 
@@ -1,14 +1,13 @@
1
1
  <script setup lang="ts">
2
2
  import { computed, useAttrs } from 'vue';
3
- import { cn } from '@/lib/utils';
3
+ import { cn, omitClass } from '@/lib/utils';
4
4
 
5
5
  defineOptions({ inheritAttrs: false });
6
6
 
7
7
  const attrs = useAttrs();
8
- const passthroughAttrs = computed(() => {
9
- const { class: _c, ...rest } = attrs as Record<string, unknown>;
10
- return rest;
11
- });
8
+ const passthroughAttrs = computed(() =>
9
+ omitClass(attrs as Record<string, unknown>),
10
+ );
12
11
  const attrClass = computed(() => (attrs.class as string | undefined) ?? '');
13
12
  </script>
14
13
 
@@ -1,14 +1,13 @@
1
1
  <script setup lang="ts">
2
2
  import { computed, useAttrs } from 'vue';
3
- import { cn } from '@/lib/utils';
3
+ import { cn, omitClass } from '@/lib/utils';
4
4
 
5
5
  defineOptions({ inheritAttrs: false });
6
6
 
7
7
  const attrs = useAttrs();
8
- const passthroughAttrs = computed(() => {
9
- const { class: _c, ...rest } = attrs as Record<string, unknown>;
10
- return rest;
11
- });
8
+ const passthroughAttrs = computed(() =>
9
+ omitClass(attrs as Record<string, unknown>),
10
+ );
12
11
  const attrClass = computed(() => (attrs.class as string | undefined) ?? '');
13
12
  </script>
14
13
 
@@ -1,14 +1,13 @@
1
1
  <script setup lang="ts">
2
2
  import { computed, useAttrs } from 'vue';
3
- import { cn } from '@/lib/utils';
3
+ import { cn, omitClass } from '@/lib/utils';
4
4
 
5
5
  defineOptions({ inheritAttrs: false });
6
6
 
7
7
  const attrs = useAttrs();
8
- const passthroughAttrs = computed(() => {
9
- const { class: _c, ...rest } = attrs as Record<string, unknown>;
10
- return rest;
11
- });
8
+ const passthroughAttrs = computed(() =>
9
+ omitClass(attrs as Record<string, unknown>),
10
+ );
12
11
  const attrClass = computed(() => (attrs.class as string | undefined) ?? '');
13
12
  </script>
14
13
 
@@ -4,7 +4,7 @@ import { cn } from '@/lib/utils';
4
4
 
5
5
  defineOptions({ inheritAttrs: false });
6
6
 
7
- const props = defineProps<{
7
+ defineProps<{
8
8
  showOnHover?: boolean;
9
9
  }>();
10
10
  </script>
@@ -13,7 +13,7 @@ export interface SidebarMenuButtonProps extends PrimitiveProps {
13
13
  isActive?: boolean;
14
14
  }
15
15
 
16
- const props = withDefaults(defineProps<SidebarMenuButtonProps>(), {
16
+ withDefaults(defineProps<SidebarMenuButtonProps>(), {
17
17
  as: 'button',
18
18
  variant: 'default',
19
19
  size: 'default',
@@ -5,7 +5,7 @@ import { Skeleton } from '@/components/core/skeleton';
5
5
 
6
6
  defineOptions({ inheritAttrs: false });
7
7
 
8
- const props = defineProps<{
8
+ defineProps<{
9
9
  showIcon?: boolean;
10
10
  }>();
11
11
 
@@ -4,7 +4,7 @@ import { cn } from '@/lib/utils';
4
4
 
5
5
  defineOptions({ inheritAttrs: false });
6
6
 
7
- const props = withDefaults(
7
+ withDefaults(
8
8
  defineProps<{
9
9
  size?: 'sm' | 'md';
10
10
  isActive?: boolean;
@@ -1,15 +1,14 @@
1
1
  <script setup lang="ts">
2
2
  import { computed, useAttrs } from 'vue';
3
- import { cn } from '@/lib/utils';
3
+ import { cn, omitClass } from '@/lib/utils';
4
4
  import { Separator } from '@/components/core/separator';
5
5
 
6
6
  defineOptions({ inheritAttrs: false });
7
7
 
8
8
  const attrs = useAttrs();
9
- const passthroughAttrs = computed(() => {
10
- const { class: _c, ...rest } = attrs as Record<string, unknown>;
11
- return rest;
12
- });
9
+ const passthroughAttrs = computed(() =>
10
+ omitClass(attrs as Record<string, unknown>),
11
+ );
13
12
  const attrClass = computed(() => (attrs.class as string | undefined) ?? '');
14
13
  </script>
15
14
 
@@ -16,7 +16,7 @@ const forwarded = useForwardProps(delegatedProps);
16
16
 
17
17
  <template>
18
18
  <StepperDescription
19
- v-slot="slotProps"
19
+ v-slot="slotProps: Record<string, unknown>"
20
20
  v-bind="forwarded"
21
21
  :class="cn('text-xs text-content-on-surface-muted', props.class)"
22
22
  >
@@ -16,7 +16,7 @@ const forwarded = useForwardProps(delegatedProps);
16
16
 
17
17
  <template>
18
18
  <StepperIndicator
19
- v-slot="slotProps"
19
+ v-slot="slotProps: Record<string, unknown>"
20
20
  v-bind="forwarded"
21
21
  :class="
22
22
  cn(
@@ -16,7 +16,7 @@ const forwarded = useForwardProps(delegatedProps);
16
16
 
17
17
  <template>
18
18
  <StepperItem
19
- v-slot="slotProps"
19
+ v-slot="slotProps: Record<string, unknown>"
20
20
  v-bind="forwarded"
21
21
  :class="
22
22
  cn(
@@ -3,17 +3,14 @@ import type { TagsInputRootEmits, TagsInputRootProps } from 'reka-ui';
3
3
  import type { HTMLAttributes } from 'vue';
4
4
  import { TagsInputRoot, useForwardPropsEmits } from 'reka-ui';
5
5
  import { computed } from 'vue';
6
- import { cn } from '@/lib/utils';
6
+ import { cn, omitClass } from '@/lib/utils';
7
7
 
8
8
  const props = defineProps<
9
9
  TagsInputRootProps & { class?: HTMLAttributes['class'] }
10
10
  >();
11
11
  const emits = defineEmits<TagsInputRootEmits>();
12
12
 
13
- const delegatedProps = computed(() => {
14
- const { class: _class, ...delegated } = props;
15
- return delegated;
16
- });
13
+ const delegatedProps = computed(() => omitClass(props));
17
14
 
18
15
  const forwarded = useForwardPropsEmits(delegatedProps, emits);
19
16
  </script>
@@ -3,16 +3,13 @@ import type { TagsInputInputProps } from 'reka-ui';
3
3
  import type { HTMLAttributes } from 'vue';
4
4
  import { TagsInputInput, useForwardProps } from 'reka-ui';
5
5
  import { computed } from 'vue';
6
- import { cn } from '@/lib/utils';
6
+ import { cn, omitClass } from '@/lib/utils';
7
7
 
8
8
  const props = defineProps<
9
9
  TagsInputInputProps & { class?: HTMLAttributes['class'] }
10
10
  >();
11
11
 
12
- const delegatedProps = computed(() => {
13
- const { class: _class, ...delegated } = props;
14
- return delegated;
15
- });
12
+ const delegatedProps = computed(() => omitClass(props));
16
13
 
17
14
  const forwardedProps = useForwardProps(delegatedProps);
18
15
  </script>
@@ -3,16 +3,13 @@ import type { TagsInputItemProps } from 'reka-ui';
3
3
  import type { HTMLAttributes } from 'vue';
4
4
  import { TagsInputItem, useForwardProps } from 'reka-ui';
5
5
  import { computed } from 'vue';
6
- import { cn } from '@/lib/utils';
6
+ import { cn, omitClass } from '@/lib/utils';
7
7
 
8
8
  const props = defineProps<
9
9
  TagsInputItemProps & { class?: HTMLAttributes['class'] }
10
10
  >();
11
11
 
12
- const delegatedProps = computed(() => {
13
- const { class: _class, ...delegated } = props;
14
- return delegated;
15
- });
12
+ const delegatedProps = computed(() => omitClass(props));
16
13
 
17
14
  const forwardedProps = useForwardProps(delegatedProps);
18
15
  </script>
@@ -3,16 +3,13 @@ import type { TagsInputItemDeleteProps } from 'reka-ui';
3
3
  import type { HTMLAttributes } from 'vue';
4
4
  import { TagsInputItemDelete, useForwardProps } from 'reka-ui';
5
5
  import { computed } from 'vue';
6
- import { cn } from '@/lib/utils';
6
+ import { cn, omitClass } from '@/lib/utils';
7
7
 
8
8
  const props = defineProps<
9
9
  TagsInputItemDeleteProps & { class?: HTMLAttributes['class'] }
10
10
  >();
11
11
 
12
- const delegatedProps = computed(() => {
13
- const { class: _class, ...delegated } = props;
14
- return delegated;
15
- });
12
+ const delegatedProps = computed(() => omitClass(props));
16
13
 
17
14
  const forwardedProps = useForwardProps(delegatedProps);
18
15
  </script>
@@ -3,16 +3,13 @@ import type { TagsInputItemTextProps } from 'reka-ui';
3
3
  import type { HTMLAttributes } from 'vue';
4
4
  import { TagsInputItemText, useForwardProps } from 'reka-ui';
5
5
  import { computed } from 'vue';
6
- import { cn } from '@/lib/utils';
6
+ import { cn, omitClass } from '@/lib/utils';
7
7
 
8
8
  const props = defineProps<
9
9
  TagsInputItemTextProps & { class?: HTMLAttributes['class'] }
10
10
  >();
11
11
 
12
- const delegatedProps = computed(() => {
13
- const { class: _class, ...delegated } = props;
14
- return delegated;
15
- });
12
+ const delegatedProps = computed(() => omitClass(props));
16
13
 
17
14
  const forwardedProps = useForwardProps(delegatedProps);
18
15
  </script>
@@ -2,7 +2,7 @@
2
2
  import type { ToggleEmits, ToggleProps } from 'reka-ui';
3
3
  import { Toggle, useForwardPropsEmits } from 'reka-ui';
4
4
  import { cn } from '@/lib/utils';
5
- import { ToggleVariants, toggleVariants } from '.';
5
+ import { type ToggleVariants, toggleVariants } from '.';
6
6
 
7
7
  const props = withDefaults(
8
8
  defineProps<
package/src/index.ts CHANGED
@@ -2,6 +2,7 @@
2
2
  * This file is auto-generated by prepare-build.js script
3
3
  * Do not edit this file manually
4
4
  */
5
+ import type { App, Component, DefineComponent } from 'vue';
5
6
  import type { PrimitiveProps as RekaPrimitiveProps } from 'reka-ui';
6
7
  export * from './components';
7
8
  export * from './patterns';
@@ -12,18 +13,42 @@ export type PrimitiveProps = RekaPrimitiveProps;
12
13
 
13
14
  import { vHover } from './directives/vHover';
14
15
 
15
- const components = import.meta.glob(
16
+ /**
17
+ * Vue SFC module shape used by the library installer.
18
+ */
19
+ type InstallableComponent = DefineComponent & {
20
+ /** Compiler-generated component name. */
21
+ __name?: string;
22
+ /** Explicit component name fallback. */
23
+ name?: string;
24
+ };
25
+
26
+ /**
27
+ * Module shape returned for eagerly imported Vue components.
28
+ */
29
+ type ComponentModule = {
30
+ /** Default Vue component export. */
31
+ default: InstallableComponent;
32
+ };
33
+
34
+ /**
35
+ * Eagerly loaded Vue components registered by the plugin installer.
36
+ */
37
+ const components = import.meta.glob<ComponentModule>(
16
38
  ['@/components/**/*.vue', '@/patterns/**/*.vue', '@/templates/**/*.vue'],
17
39
  {
18
40
  eager: true,
19
- }
41
+ },
20
42
  );
21
43
 
22
44
  export default {
23
- install(app, options) {
45
+ install(app: App) {
24
46
  app.directive('hover', vHover);
25
- Object.values(components).forEach((component: any) => {
26
- app.component(component.default.__name, component.default);
47
+ Object.values(components).forEach((component) => {
48
+ const componentName = component.default.__name ?? component.default.name;
49
+ if (componentName) {
50
+ app.component(componentName, component.default as Component);
51
+ }
27
52
  });
28
53
  },
29
54
  };
@@ -51,6 +51,7 @@ export function reorderItems<T>(
51
51
 
52
52
  const nextItems = [...items];
53
53
  const [removedItem] = nextItems.splice(draggedIndex, 1);
54
+ if (removedItem === undefined) return items;
54
55
  nextItems.splice(targetIndex, 0, removedItem);
55
56
 
56
57
  return nextItems;
package/src/lib/utils.ts CHANGED
@@ -4,3 +4,15 @@ import { twMerge } from 'tailwind-merge';
4
4
  export function cn(...inputs: ClassValue[]) {
5
5
  return twMerge(clsx(inputs));
6
6
  }
7
+
8
+ /**
9
+ * Returns a shallow copy without the Vue `class` attr/prop.
10
+ * @param source Object that may contain a `class` key.
11
+ * @returns A shallow copy without `class`.
12
+ */
13
+ export function omitClass<T extends object>(source: T): Omit<T, 'class'> {
14
+ const rest = { ...source } as Omit<T, 'class'> &
15
+ Partial<Record<'class', unknown>>;
16
+ delete rest.class;
17
+ return rest;
18
+ }
@@ -14,6 +14,15 @@ export interface Payment {
14
14
  email: string;
15
15
  }
16
16
 
17
+ function pickCyclic<T>(items: T[], index: number): T {
18
+ const item = items[index % items.length];
19
+ if (item === undefined) {
20
+ throw new Error('Expected mock data source to contain at least one item');
21
+ }
22
+
23
+ return item;
24
+ }
25
+
17
26
  // Utility to generate deterministic mock data
18
27
  function generatePayments(count: number): Payment[] {
19
28
  const statuses: Payment['status'][] = [
@@ -65,14 +74,14 @@ function generatePayments(count: number): Payment[] {
65
74
  ];
66
75
 
67
76
  return Array.from({ length: count }, (_, i) => {
68
- const firstName = firstNames[i % firstNames.length];
69
- const lastName = lastNames[i % lastNames.length];
70
- const domain = domains[i % domains.length];
77
+ const firstName = pickCyclic(firstNames, i);
78
+ const lastName = pickCyclic(lastNames, i);
79
+ const domain = pickCyclic(domains, i);
71
80
 
72
81
  return {
73
82
  id: `payment-${String(i + 1).padStart(4, '0')}`,
74
83
  amount: Math.floor(100 + ((i * 73) % 900)), // Deterministic "random" amounts 100-999
75
- status: statuses[i % statuses.length],
84
+ status: pickCyclic(statuses, i),
76
85
  email: `${firstName.toLowerCase()}.${lastName.toLowerCase()}${i > 19 ? i : ''}@${domain}`,
77
86
  };
78
87
  });
@@ -336,6 +336,7 @@ function reorderColumn(
336
336
 
337
337
  const nextColumnOrder = [...columnIds];
338
338
  const [draggedColumn] = nextColumnOrder.splice(draggedIndex, 1);
339
+ if (draggedColumn === undefined) return false;
339
340
  nextColumnOrder.splice(insertionIndex, 0, draggedColumn);
340
341
 
341
342
  if (nextColumnOrder === columnIds) return false;
@@ -519,7 +519,11 @@ describe('UiDataTable', () => {
519
519
 
520
520
  test('adds cursor-pointer class when onRowClick is provided', () => {
521
521
  const { container } = render(UiDataTable, {
522
- props: { columns: basicColumns, data: testData, onRowClick: () => {} },
522
+ props: {
523
+ columns: basicColumns,
524
+ data: testData,
525
+ onRowClick: () => undefined,
526
+ },
523
527
  });
524
528
 
525
529
  const dataRows = container.querySelectorAll('tbody tr');
@@ -560,7 +564,12 @@ describe('UiDataTable', () => {
560
564
  props: { columns: basicColumns, data: testData, onRowClick },
561
565
  });
562
566
 
563
- await fireEvent.keyDown(getByText('Alice').closest('td')!, {
567
+ const aliceCell = getByText('Alice').closest('td');
568
+ if (!aliceCell) {
569
+ throw new Error('Expected Alice cell to be rendered');
570
+ }
571
+
572
+ await fireEvent.keyDown(aliceCell, {
564
573
  key: 'Enter',
565
574
  });
566
575