@aleph-alpha/ui-library 5.6.0 → 5.8.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 (79) hide show
  1. package/README.md +4 -0
  2. package/config.d.ts +5 -1
  3. package/config.js +23 -1
  4. package/dist/system/components/UiBreadcrumb/UiBreadcrumb.vue.d.ts +17 -0
  5. package/dist/system/components/UiBreadcrumb/UiBreadcrumbEllipsis.vue.d.ts +17 -0
  6. package/dist/system/components/UiBreadcrumb/UiBreadcrumbItem.vue.d.ts +17 -0
  7. package/dist/system/components/UiBreadcrumb/UiBreadcrumbLink.vue.d.ts +18 -0
  8. package/dist/system/components/UiBreadcrumb/UiBreadcrumbList.vue.d.ts +17 -0
  9. package/dist/system/components/UiBreadcrumb/UiBreadcrumbPage.vue.d.ts +17 -0
  10. package/dist/system/components/UiBreadcrumb/UiBreadcrumbSeparator.vue.d.ts +17 -0
  11. package/dist/system/components/UiBreadcrumb/index.d.ts +8 -0
  12. package/dist/system/components/UiBreadcrumb/types.d.ts +22 -0
  13. package/dist/system/components/UiField/types.d.ts +2 -1
  14. package/dist/system/components/UiToggleGroup/types.d.ts +0 -5
  15. package/dist/system/components/core/breadcrumb/Breadcrumb.vue.d.ts +21 -0
  16. package/dist/system/components/core/breadcrumb/BreadcrumbEllipsis.vue.d.ts +21 -0
  17. package/dist/system/components/core/breadcrumb/BreadcrumbItem.vue.d.ts +21 -0
  18. package/dist/system/components/core/breadcrumb/BreadcrumbLink.vue.d.ts +24 -0
  19. package/dist/system/components/core/breadcrumb/BreadcrumbList.vue.d.ts +21 -0
  20. package/dist/system/components/core/breadcrumb/BreadcrumbPage.vue.d.ts +21 -0
  21. package/dist/system/components/core/breadcrumb/BreadcrumbSeparator.vue.d.ts +21 -0
  22. package/dist/system/components/core/breadcrumb/index.d.ts +7 -0
  23. package/dist/system/components/core/listbox/Listbox.vue.d.ts +28 -2
  24. package/dist/system/components/core/listbox/context.d.ts +21 -0
  25. package/dist/system/components/index.d.ts +1 -0
  26. package/dist/system/lib.js +10062 -9711
  27. package/dist/system/patterns/UiDatePicker/UiDatePicker.vue.d.ts +1 -1
  28. package/dist/system/story-sidebar-icons.json +6 -0
  29. package/package.json +5 -5
  30. package/src/components/UiAutocomplete/UiAutocomplete.stories.ts +1 -1
  31. package/src/components/UiBreadcrumb/UiBreadcrumb.stories.ts +1419 -0
  32. package/src/components/UiBreadcrumb/UiBreadcrumb.vue +19 -0
  33. package/src/components/UiBreadcrumb/UiBreadcrumbEllipsis.vue +22 -0
  34. package/src/components/UiBreadcrumb/UiBreadcrumbItem.vue +19 -0
  35. package/src/components/UiBreadcrumb/UiBreadcrumbLink.vue +26 -0
  36. package/src/components/UiBreadcrumb/UiBreadcrumbList.vue +19 -0
  37. package/src/components/UiBreadcrumb/UiBreadcrumbPage.vue +19 -0
  38. package/src/components/UiBreadcrumb/UiBreadcrumbSeparator.vue +22 -0
  39. package/src/components/UiBreadcrumb/index.ts +8 -0
  40. package/src/components/UiBreadcrumb/types.ts +28 -0
  41. package/src/components/UiCheckbox/UiCheckbox.stories.ts +625 -74
  42. package/src/components/UiDropdownMenu/UiDropdownMenuTrigger.vue +2 -0
  43. package/src/components/UiField/UiField.stories.ts +1 -1
  44. package/src/components/UiField/types.ts +2 -1
  45. package/src/components/UiListbox/UiListbox.stories.ts +1283 -30
  46. package/src/components/UiListbox/__tests__/UiListbox.test.ts +70 -35
  47. package/src/components/UiRadioGroup/UiRadioGroup.stories.ts +995 -0
  48. package/src/components/UiSelect/UiSelect.stories.ts +1 -1
  49. package/src/components/UiSwitch/UiSwitch.stories.ts +706 -9
  50. package/src/components/UiSwitch/__tests__/UiSwitch.test.ts +2 -6
  51. package/src/components/UiToggle/UiToggle.stories.ts +961 -130
  52. package/src/components/UiToggle/UiToggle.vue +8 -1
  53. package/src/components/UiToggle/__tests__/UiToggle.test.ts +55 -65
  54. package/src/components/UiToggleGroup/UiToggleGroup.stories.ts +1060 -173
  55. package/src/components/UiToggleGroup/UiToggleGroup.vue +4 -2
  56. package/src/components/UiToggleGroup/__tests__/UiToggleGroup.test.ts +117 -325
  57. package/src/components/UiToggleGroup/types.ts +0 -5
  58. package/src/components/core/breadcrumb/Breadcrumb.vue +13 -0
  59. package/src/components/core/breadcrumb/BreadcrumbEllipsis.vue +23 -0
  60. package/src/components/core/breadcrumb/BreadcrumbItem.vue +17 -0
  61. package/src/components/core/breadcrumb/BreadcrumbLink.vue +29 -0
  62. package/src/components/core/breadcrumb/BreadcrumbList.vue +22 -0
  63. package/src/components/core/breadcrumb/BreadcrumbPage.vue +20 -0
  64. package/src/components/core/breadcrumb/BreadcrumbSeparator.vue +22 -0
  65. package/src/components/core/breadcrumb/index.ts +7 -0
  66. package/src/components/core/field/FieldDescription.vue +1 -1
  67. package/src/components/core/field/FieldLabel.vue +3 -2
  68. package/src/components/core/field/FieldTitle.vue +1 -1
  69. package/src/components/core/listbox/Listbox.vue +14 -2
  70. package/src/components/core/listbox/ListboxContent.vue +61 -3
  71. package/src/components/core/listbox/ListboxItem.vue +6 -1
  72. package/src/components/core/listbox/context.ts +34 -0
  73. package/src/components/core/toggle/Toggle.vue +15 -1
  74. package/src/components/core/toggle/index.ts +2 -2
  75. package/src/components/core/toggle-group/ToggleGroup.vue +1 -1
  76. package/src/components/core/toggle-group/index.ts +5 -2
  77. package/src/components/index.ts +1 -0
  78. package/src/components/UiCheckbox/__tests__/UiCheckbox.test.ts +0 -14
  79. package/src/components/UiRadioGroup/__tests__/UiRadioGroup.test.ts +0 -412
@@ -0,0 +1,29 @@
1
+ <script lang="ts" setup>
2
+ import type { PrimitiveProps } from 'reka-ui';
3
+ import type { HTMLAttributes } from 'vue';
4
+ import { Primitive } from 'reka-ui';
5
+ import { cn } from '@/lib/utils';
6
+
7
+ const props = withDefaults(
8
+ defineProps<PrimitiveProps & { class?: HTMLAttributes['class'] }>(),
9
+ {
10
+ as: 'a',
11
+ },
12
+ );
13
+ </script>
14
+
15
+ <template>
16
+ <Primitive
17
+ data-slot="breadcrumb-link"
18
+ :as="as"
19
+ :as-child="asChild"
20
+ :class="
21
+ cn(
22
+ 'hover:text-foreground transition-colors ui-focus-ring rounded-sm',
23
+ props.class,
24
+ )
25
+ "
26
+ >
27
+ <slot />
28
+ </Primitive>
29
+ </template>
@@ -0,0 +1,22 @@
1
+ <script lang="ts" setup>
2
+ import type { HTMLAttributes } from 'vue';
3
+ import { cn } from '@/lib/utils';
4
+
5
+ const props = defineProps<{
6
+ class?: HTMLAttributes['class'];
7
+ }>();
8
+ </script>
9
+
10
+ <template>
11
+ <ol
12
+ data-slot="breadcrumb-list"
13
+ :class="
14
+ cn(
15
+ 'text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5',
16
+ props.class,
17
+ )
18
+ "
19
+ >
20
+ <slot />
21
+ </ol>
22
+ </template>
@@ -0,0 +1,20 @@
1
+ <script lang="ts" setup>
2
+ import type { HTMLAttributes } from 'vue';
3
+ import { cn } from '@/lib/utils';
4
+
5
+ const props = defineProps<{
6
+ class?: HTMLAttributes['class'];
7
+ }>();
8
+ </script>
9
+
10
+ <template>
11
+ <span
12
+ data-slot="breadcrumb-page"
13
+ role="link"
14
+ aria-disabled="true"
15
+ aria-current="page"
16
+ :class="cn('text-foreground font-normal', props.class)"
17
+ >
18
+ <slot />
19
+ </span>
20
+ </template>
@@ -0,0 +1,22 @@
1
+ <script lang="ts" setup>
2
+ import type { HTMLAttributes } from 'vue';
3
+ import { ChevronRight } from 'lucide-vue-next';
4
+ import { cn } from '@/lib/utils';
5
+
6
+ const props = defineProps<{
7
+ class?: HTMLAttributes['class'];
8
+ }>();
9
+ </script>
10
+
11
+ <template>
12
+ <li
13
+ data-slot="breadcrumb-separator"
14
+ role="presentation"
15
+ aria-hidden="true"
16
+ :class="cn('[&>svg]:size-3.5', props.class)"
17
+ >
18
+ <slot>
19
+ <ChevronRight />
20
+ </slot>
21
+ </li>
22
+ </template>
@@ -0,0 +1,7 @@
1
+ export { default as Breadcrumb } from './Breadcrumb.vue';
2
+ export { default as BreadcrumbEllipsis } from './BreadcrumbEllipsis.vue';
3
+ export { default as BreadcrumbItem } from './BreadcrumbItem.vue';
4
+ export { default as BreadcrumbLink } from './BreadcrumbLink.vue';
5
+ export { default as BreadcrumbList } from './BreadcrumbList.vue';
6
+ export { default as BreadcrumbPage } from './BreadcrumbPage.vue';
7
+ export { default as BreadcrumbSeparator } from './BreadcrumbSeparator.vue';
@@ -12,7 +12,7 @@ const props = defineProps<{
12
12
  data-slot="field-description"
13
13
  :class="
14
14
  cn(
15
- 'text-content-on-surface-muted body-14-regular group-has-[[data-orientation=horizontal]]/field:text-balance',
15
+ 'text-content-on-surface-muted label-14-regular group-has-[[data-orientation=horizontal]]/field:text-balance',
16
16
  'last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5',
17
17
  '[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4',
18
18
  props.class,
@@ -17,8 +17,9 @@ const props = defineProps<{
17
17
  :class="
18
18
  cn(
19
19
  'group/field-label peer/field-label flex w-fit items-center gap-2 leading-snug text-content-on-surface-muted body-14-medium group-data-[disabled=true]/field:opacity-50',
20
- 'has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border [&>*]:data-[slot=field]:p-4',
21
- 'has-data-[state=checked]:bg-primary/5 has-data-[state=checked]:border-primary dark:has-data-[state=checked]:bg-primary/10',
20
+ 'has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border has-[>[data-slot=field]]:border-border-input-default',
21
+ 'has-data-[state=checked]:bg-background-surface-selected has-data-[state=checked]:border-transparent',
22
+ '[&>[data-slot=field]]:p-4',
22
23
  props.class,
23
24
  )
24
25
  "
@@ -12,7 +12,7 @@ const props = defineProps<{
12
12
  data-slot="field-label"
13
13
  :class="
14
14
  cn(
15
- 'body-14-medium flex w-fit items-center gap-2 leading-snug group-data-[disabled=true]/field:opacity-50',
15
+ 'label-14-regular text-content-on-surface-primary flex w-fit items-center gap-2 leading-snug group-data-[disabled=true]/field:opacity-50',
16
16
  props.class,
17
17
  )
18
18
  "
@@ -1,9 +1,10 @@
1
1
  <script setup lang="ts">
2
2
  import type { ListboxRootEmits, ListboxRootProps } from 'reka-ui';
3
- import type { HTMLAttributes } from 'vue';
3
+ import type { ComponentPublicInstance, HTMLAttributes } from 'vue';
4
4
  import { ListboxRoot, useForwardPropsEmits } from 'reka-ui';
5
- import { computed } from 'vue';
5
+ import { computed, ref } from 'vue';
6
6
  import { cn, omitClass } from '@/lib/utils';
7
+ import { provideListboxContext } from './context';
7
8
 
8
9
  const props = defineProps<
9
10
  ListboxRootProps & { class?: HTMLAttributes['class'] }
@@ -13,10 +14,21 @@ const emits = defineEmits<ListboxRootEmits>();
13
14
  const delegatedProps = computed(() => omitClass(props));
14
15
 
15
16
  const forwarded = useForwardPropsEmits(delegatedProps, emits);
17
+
18
+ const rootRef = ref<ComponentPublicInstance | null>(null);
19
+
20
+ provideListboxContext({
21
+ disabled: computed(() => props.disabled ?? false),
22
+ rootElement: computed(() => {
23
+ const el = rootRef.value?.$el as unknown;
24
+ return el instanceof HTMLElement ? el : undefined;
25
+ }),
26
+ });
16
27
  </script>
17
28
 
18
29
  <template>
19
30
  <ListboxRoot
31
+ ref="rootRef"
20
32
  data-slot="listbox"
21
33
  :class="cn('flex flex-col', props.class)"
22
34
  v-bind="forwarded"
@@ -1,9 +1,14 @@
1
1
  <script setup lang="ts">
2
2
  import type { ListboxContentProps } from 'reka-ui';
3
3
  import type { HTMLAttributes } from 'vue';
4
- import { ListboxContent, useForwardProps } from 'reka-ui';
5
- import { computed } from 'vue';
4
+ import {
5
+ ListboxContent,
6
+ injectListboxRootContext,
7
+ useForwardProps,
8
+ } from 'reka-ui';
9
+ import { computed, onMounted, onUpdated, watch } from 'vue';
6
10
  import { cn, omitClass } from '@/lib/utils';
11
+ import { useListboxContext } from './context';
7
12
 
8
13
  const props = defineProps<
9
14
  ListboxContentProps & { class?: HTMLAttributes['class'] }
@@ -12,15 +17,68 @@ const props = defineProps<
12
17
  const delegatedProps = computed(() => omitClass(props));
13
18
 
14
19
  const forwardedProps = useForwardProps(delegatedProps);
20
+
21
+ const { disabled, rootElement } = useListboxContext();
22
+
23
+ const rootContext = injectListboxRootContext();
24
+
25
+ /**
26
+ * reka-ui derives the container tabindex, arrow navigation and typeahead from
27
+ * `focusable` alone and never looks at `disabled`, so a disabled listbox stays
28
+ * reachable with Tab. Clearing the same flag ListboxFilter uses to hand over the
29
+ * tab stop takes the list out of the tab order. Runs on mount so a filter, which
30
+ * mounts first, has already claimed the flag, and restores what it found so
31
+ * re-enabling the list does not steal the tab stop back from that filter.
32
+ */
33
+ onMounted(() => {
34
+ watch(
35
+ disabled,
36
+ (isDisabled, _wasDisabled, onCleanup) => {
37
+ if (!isDisabled) {
38
+ return;
39
+ }
40
+ const restore = rootContext.focusable.value;
41
+ rootContext.focusable.value = false;
42
+ onCleanup(() => {
43
+ rootContext.focusable.value = restore;
44
+ });
45
+ },
46
+ { immediate: true },
47
+ );
48
+ });
49
+
50
+ /**
51
+ * reka-ui keeps `aria-activedescendant` pointing at the last highlighted
52
+ * option, so filtering that option out of the list leaves a dangling
53
+ * reference: axe reports `aria-valid-attr-value` and screen readers announce
54
+ * an option that is no longer there. Drop it once the target is gone.
55
+ */
56
+ onUpdated(() => {
57
+ const root = rootElement.value;
58
+ if (!root) {
59
+ return;
60
+ }
61
+ for (const el of root.querySelectorAll('[aria-activedescendant]')) {
62
+ const id = el.getAttribute('aria-activedescendant');
63
+ if (id && !root.ownerDocument.getElementById(id)) {
64
+ el.removeAttribute('aria-activedescendant');
65
+ }
66
+ }
67
+ });
15
68
  </script>
16
69
 
17
70
  <template>
18
71
  <ListboxContent
19
72
  data-slot="listbox-content"
20
73
  aria-label="Options"
74
+ :aria-disabled="disabled ? 'true' : undefined"
21
75
  :class="
22
76
  cn(
23
- 'max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto',
77
+ 'max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto rounded-md',
78
+ // A disabled list is out of the tab order but still takes focus from a
79
+ // click landing on its pointer-events-none options, so it has to stay
80
+ // silent rather than fall back to the browser's default ring.
81
+ disabled ? 'outline-hidden' : 'ui-focus-ring',
24
82
  props.class,
25
83
  )
26
84
  "
@@ -4,6 +4,7 @@ import type { HTMLAttributes } from 'vue';
4
4
  import { ListboxItem, useForwardPropsEmits } from 'reka-ui';
5
5
  import { computed } from 'vue';
6
6
  import { cn, omitClass } from '@/lib/utils';
7
+ import { useListboxContext } from './context';
7
8
 
8
9
  const props = defineProps<
9
10
  ListboxItemProps & { class?: HTMLAttributes['class'] }
@@ -13,14 +14,18 @@ const emits = defineEmits<ListboxItemEmits>();
13
14
  const delegatedProps = computed(() => omitClass(props));
14
15
 
15
16
  const forwarded = useForwardPropsEmits(delegatedProps, emits);
17
+
18
+ const { disabled: isListboxDisabled } = useListboxContext();
19
+ const isDisabled = computed(() => props.disabled || isListboxDisabled.value);
16
20
  </script>
17
21
 
18
22
  <template>
19
23
  <ListboxItem
20
24
  data-slot="listbox-item"
25
+ :aria-disabled="isDisabled ? 'true' : undefined"
21
26
  :class="
22
27
  cn(
23
- 'hover-layer hover-layer-default data-[highlighted]:text-foreground [&_svg:not([class*=\'text-\'])]:text-content-on-surface-muted relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 label-14-regular outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=\'size-\'])]:size-4',
28
+ 'hover-layer hover-layer-default data-[highlighted]:text-foreground [&_svg:not([class*=\'text-\'])]:text-content-on-surface-muted ui-focus-ring-inset relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 label-14-regular select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=\'size-\'])]:size-4',
24
29
  props.class,
25
30
  )
26
31
  "
@@ -0,0 +1,34 @@
1
+ import { inject, provide, shallowRef, type InjectionKey, type Ref } from 'vue';
2
+
3
+ interface ListboxContext {
4
+ /** Whether the whole listbox is disabled. */
5
+ disabled: Readonly<Ref<boolean>>;
6
+ /** The listbox root element, used to scope DOM lookups to this listbox. */
7
+ rootElement: Readonly<Ref<HTMLElement | undefined>>;
8
+ }
9
+
10
+ const LISTBOX_CONTEXT: InjectionKey<ListboxContext> = Symbol('ListboxContext');
11
+
12
+ const FALLBACK: ListboxContext = {
13
+ disabled: shallowRef(false),
14
+ rootElement: shallowRef(undefined),
15
+ };
16
+
17
+ /**
18
+ * Shares the listbox root state with the content, items and filter.
19
+ *
20
+ * reka-ui only renders `data-disabled` for styling, so the disabled state has
21
+ * to be mirrored to `aria-disabled` for assistive technology (WCAG 4.1.2).
22
+ * @param context The root state to share with the descendant parts.
23
+ */
24
+ export function provideListboxContext(context: ListboxContext): void {
25
+ provide(LISTBOX_CONTEXT, context);
26
+ }
27
+
28
+ /**
29
+ * Reads the listbox root state, with inert defaults outside a listbox.
30
+ * @returns The surrounding listbox state.
31
+ */
32
+ export function useListboxContext(): ListboxContext {
33
+ return inject(LISTBOX_CONTEXT, FALLBACK);
34
+ }
@@ -1,6 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import type { ToggleEmits, ToggleProps } from 'reka-ui';
3
3
  import { Toggle, useForwardPropsEmits } from 'reka-ui';
4
+ import { computed } from 'vue';
4
5
  import { cn } from '@/lib/utils';
5
6
  import { type ToggleVariants, toggleVariants } from '.';
6
7
 
@@ -20,7 +21,20 @@ const props = withDefaults(
20
21
 
21
22
  const emits = defineEmits<ToggleEmits>();
22
23
 
23
- const forwarded = useForwardPropsEmits(props, emits);
24
+ /**
25
+ * `variant` and `size` only feed `toggleVariants`. reka's Toggle does not
26
+ * declare them, so forwarding them would land them on the rendered `button` as
27
+ * invalid HTML attributes.
28
+ */
29
+ const delegatedProps = computed(() => {
30
+ const rest = { ...props } as ToggleProps &
31
+ Partial<Record<'variant' | 'size', unknown>>;
32
+ delete rest.variant;
33
+ delete rest.size;
34
+ return rest as ToggleProps;
35
+ });
36
+
37
+ const forwarded = useForwardPropsEmits(delegatedProps, emits);
24
38
  </script>
25
39
 
26
40
  <template>
@@ -8,9 +8,9 @@ export const toggleVariants = cva(
8
8
  variants: {
9
9
  variant: {
10
10
  default:
11
- 'border border-border-button-outlined bg-transparent data-[state=on]:bg-accent-default data-[state=on]:text-accent-default-foreground data-[state=on]:hover:bg-accent-default data-[state=on]:hover:text-accent-default-foreground data-[state=open]:bg-accent-default data-[state=open]:text-accent-default-foreground data-[state=open]:hover:bg-accent-default data-[state=open]:hover:text-accent-default-foreground aria-pressed:bg-accent-default aria-pressed:text-accent-default-foreground aria-pressed:hover:bg-accent-default aria-pressed:hover:text-accent-default-foreground',
11
+ 'border border-transparent bg-transparent data-[state=on]:bg-accent-default data-[state=on]:text-accent-default-foreground data-[state=on]:hover:bg-accent-default data-[state=on]:hover:text-accent-default-foreground data-[state=open]:bg-accent-default data-[state=open]:text-accent-default-foreground data-[state=open]:hover:bg-accent-default data-[state=open]:hover:text-accent-default-foreground aria-pressed:bg-accent-default aria-pressed:text-accent-default-foreground aria-pressed:hover:bg-accent-default aria-pressed:hover:text-accent-default-foreground',
12
12
  outline:
13
- 'border border-input bg-transparent shadow-sm data-[state=on]:bg-accent-default data-[state=on]:text-accent-default-foreground data-[state=on]:hover:bg-accent-default data-[state=on]:hover:text-accent-default-foreground data-[state=open]:bg-accent-default data-[state=open]:text-accent-default-foreground data-[state=open]:hover:bg-accent-default data-[state=open]:hover:text-accent-default-foreground aria-pressed:bg-accent-default aria-pressed:text-accent-default-foreground aria-pressed:hover:bg-accent-default aria-pressed:hover:text-accent-default-foreground',
13
+ 'border border-input bg-transparent data-[state=on]:bg-accent-default data-[state=on]:text-accent-default-foreground data-[state=on]:hover:bg-accent-default data-[state=on]:hover:text-accent-default-foreground data-[state=open]:bg-accent-default data-[state=open]:text-accent-default-foreground data-[state=open]:hover:bg-accent-default data-[state=open]:hover:text-accent-default-foreground aria-pressed:bg-accent-default aria-pressed:text-accent-default-foreground aria-pressed:hover:bg-accent-default aria-pressed:hover:text-accent-default-foreground',
14
14
  soft: 'border border-border-button-outlined bg-transparent data-[state=on]:border-background-accent-soft data-[state=on]:bg-background-accent-soft data-[state=on]:text-content-on-accent-soft data-[state=on]:hover:bg-background-accent-soft data-[state=on]:hover:text-content-on-accent-soft data-[state=open]:border-background-accent-soft data-[state=open]:bg-background-accent-soft data-[state=open]:text-content-on-accent-soft data-[state=open]:hover:bg-background-accent-soft data-[state=open]:hover:text-content-on-accent-soft aria-pressed:border-background-accent-soft aria-pressed:bg-background-accent-soft aria-pressed:text-content-on-accent-soft aria-pressed:hover:bg-background-accent-soft aria-pressed:hover:text-content-on-accent-soft',
15
15
  },
16
16
  size: {
@@ -31,7 +31,7 @@ provide(toggleGroupContextKey, { variant, size });
31
31
  <ToggleGroupRoot
32
32
  data-slot="toggle-group"
33
33
  v-bind="forwarded"
34
- :class="cn('flex items-center justify-center gap-1', $attrs.class ?? '')"
34
+ :class="cn('flex items-center justify-center', $attrs.class ?? '')"
35
35
  >
36
36
  <slot />
37
37
  </ToggleGroupRoot>
@@ -5,14 +5,17 @@ export { default as ToggleGroupItem } from './ToggleGroupItem.vue';
5
5
  export { toggleGroupContextKey, type ToggleGroupContext } from './context';
6
6
 
7
7
  export const toggleGroupVariants = cva(
8
- 'inline-flex items-center justify-center gap-2 rounded-md label-14-medium transition-colors hover:bg-background-surface-muted-subtle ui-focus-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',
8
+ // Items sit flush against each other, so only the outer edges of the group
9
+ // are rounded. Because the radius lives on the item itself, the pressed fill,
10
+ // the hover fill and the focus ring are all clipped to the same shape.
11
+ 'inline-flex items-center justify-center gap-2 rounded-none first:rounded-l-md last:rounded-r-md label-14-medium transition-colors hover:bg-background-surface-muted-subtle ui-focus-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',
9
12
  {
10
13
  variants: {
11
14
  variant: {
12
15
  default:
13
16
  'bg-transparent data-[state=on]:bg-accent-default data-[state=on]:text-accent-default-foreground data-[state=on]:hover:bg-accent-default data-[state=on]:hover:text-accent-default-foreground data-[state=open]:bg-accent-default data-[state=open]:text-accent-default-foreground data-[state=open]:hover:bg-accent-default data-[state=open]:hover:text-accent-default-foreground aria-pressed:bg-accent-default aria-pressed:text-accent-default-foreground aria-pressed:hover:bg-accent-default aria-pressed:hover:text-accent-default-foreground',
14
17
  outline:
15
- 'border border-input bg-transparent shadow-sm data-[state=on]:bg-accent-default data-[state=on]:text-accent-default-foreground data-[state=on]:hover:bg-accent-default data-[state=on]:hover:text-accent-default-foreground data-[state=open]:bg-accent-default data-[state=open]:text-accent-default-foreground data-[state=open]:hover:bg-accent-default data-[state=open]:hover:text-accent-default-foreground aria-pressed:bg-accent-default aria-pressed:text-accent-default-foreground aria-pressed:hover:bg-accent-default aria-pressed:hover:text-accent-default-foreground',
18
+ 'border border-input bg-transparent data-[state=on]:bg-accent-default data-[state=on]:text-accent-default-foreground data-[state=on]:hover:bg-accent-default data-[state=on]:hover:text-accent-default-foreground data-[state=open]:bg-accent-default data-[state=open]:text-accent-default-foreground data-[state=open]:hover:bg-accent-default data-[state=open]:hover:text-accent-default-foreground aria-pressed:bg-accent-default aria-pressed:text-accent-default-foreground aria-pressed:hover:bg-accent-default aria-pressed:hover:text-accent-default-foreground',
16
19
  soft: 'bg-transparent data-[state=on]:bg-accent data-[state=on]:text-accent-foreground data-[state=on]:border data-[state=on]:border-accent-default data-[state=on]:hover:bg-accent data-[state=on]:hover:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground data-[state=open]:border data-[state=open]:border-accent-default data-[state=open]:hover:bg-accent data-[state=open]:hover:text-accent-foreground aria-pressed:bg-accent aria-pressed:text-accent-foreground aria-pressed:border aria-pressed:border-accent-default aria-pressed:hover:bg-accent aria-pressed:hover:text-accent-foreground',
17
20
  },
18
21
  size: {
@@ -8,6 +8,7 @@ export * from './UiAlertDialog';
8
8
  export * from './UiAutocomplete';
9
9
  export * from './UiAvatar';
10
10
  export * from './UiBadge';
11
+ export * from './UiBreadcrumb';
11
12
  export * from './UiButton';
12
13
  export * from './UiButtonGroup';
13
14
  export * from './UiCalendar';
@@ -1,14 +0,0 @@
1
- import { render } from '@testing-library/vue';
2
- import userEvent from '@testing-library/user-event';
3
- import { describe, expect, test } from 'vitest';
4
- import UiCheckbox from '../UiCheckbox.vue';
5
-
6
- describe('UiCheckbox', () => {
7
- // v-model wiring (the wrapper's own integration work) is unit-tested here.
8
- test('emits update:modelValue on click', async () => {
9
- const { getByRole, emitted } = render(UiCheckbox);
10
-
11
- await userEvent.click(getByRole('checkbox'));
12
- expect(emitted('update:modelValue')?.[0][0]).toBe(true);
13
- });
14
- });