@aleph-alpha/ui-library 5.7.0 → 5.9.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.
- package/README.md +12 -7
- package/config.d.ts +5 -1
- package/config.js +18 -1
- package/dist/system/__tests__/test-utils.d.ts +24 -0
- package/dist/system/components/UiAutocomplete/UiAutocomplete.vue.d.ts +8 -4
- package/dist/system/components/UiAutocomplete/types.d.ts +11 -0
- package/dist/system/components/UiBreadcrumb/UiBreadcrumb.vue.d.ts +17 -0
- package/dist/system/components/UiBreadcrumb/UiBreadcrumbEllipsis.vue.d.ts +17 -0
- package/dist/system/components/UiBreadcrumb/UiBreadcrumbItem.vue.d.ts +17 -0
- package/dist/system/components/UiBreadcrumb/UiBreadcrumbLink.vue.d.ts +18 -0
- package/dist/system/components/UiBreadcrumb/UiBreadcrumbList.vue.d.ts +17 -0
- package/dist/system/components/UiBreadcrumb/UiBreadcrumbPage.vue.d.ts +17 -0
- package/dist/system/components/UiBreadcrumb/UiBreadcrumbSeparator.vue.d.ts +17 -0
- package/dist/system/components/UiBreadcrumb/index.d.ts +8 -0
- package/dist/system/components/UiBreadcrumb/types.d.ts +22 -0
- package/dist/system/components/UiFadeMask/UiFadeMask.vue.d.ts +21 -0
- package/dist/system/components/UiFadeMask/index.d.ts +2 -0
- package/dist/system/components/UiFadeMask/types.d.ts +33 -0
- package/dist/system/components/UiListbox/UiListboxVirtualizer.vue.d.ts +21 -0
- package/dist/system/components/UiListbox/index.d.ts +1 -0
- package/dist/system/components/UiListbox/types.d.ts +36 -0
- package/dist/system/components/UiSelect/UiSelectVirtualizer.vue.d.ts +21 -0
- package/dist/system/components/UiSelect/index.d.ts +1 -0
- package/dist/system/components/UiSelect/types.d.ts +36 -0
- package/dist/system/components/UiToggleGroup/types.d.ts +0 -5
- package/dist/system/components/core/breadcrumb/Breadcrumb.vue.d.ts +21 -0
- package/dist/system/components/core/breadcrumb/BreadcrumbEllipsis.vue.d.ts +21 -0
- package/dist/system/components/core/breadcrumb/BreadcrumbItem.vue.d.ts +21 -0
- package/dist/system/components/core/breadcrumb/BreadcrumbLink.vue.d.ts +24 -0
- package/dist/system/components/core/breadcrumb/BreadcrumbList.vue.d.ts +21 -0
- package/dist/system/components/core/breadcrumb/BreadcrumbPage.vue.d.ts +21 -0
- package/dist/system/components/core/breadcrumb/BreadcrumbSeparator.vue.d.ts +21 -0
- package/dist/system/components/core/breadcrumb/index.d.ts +7 -0
- package/dist/system/components/core/listbox/Listbox.vue.d.ts +28 -2
- package/dist/system/components/core/listbox/context.d.ts +21 -0
- package/dist/system/components/core/native-select/NativeSelectOptGroup.vue.d.ts +2 -2
- package/dist/system/components/core/native-select/NativeSelectOption.vue.d.ts +2 -2
- package/dist/system/components/index.d.ts +2 -0
- package/dist/system/lib.js +22570 -21061
- package/dist/system/mobile-device-frame.png +0 -0
- package/dist/system/patterns/UiDatePicker/UiDatePicker.vue.d.ts +1 -1
- package/dist/system/patterns/UiFloatActions/types.d.ts +2 -1
- package/dist/system/patterns/UiProfileCard/index.d.ts +7 -0
- package/dist/system/patterns/UiTopBar/UiTopBar.vue.d.ts +23 -0
- package/dist/system/patterns/UiTopBar/index.d.ts +2 -0
- package/dist/system/patterns/UiTopBar/types.d.ts +28 -0
- package/dist/system/patterns/index.d.ts +2 -0
- package/dist/system/story-sidebar-icons.json +10 -1
- package/package.json +3 -2
- package/src/__tests__/test-utils.ts +74 -0
- package/src/components/UiAutocomplete/UiAutocomplete.stories.ts +94 -0
- package/src/components/UiAutocomplete/UiAutocomplete.vue +164 -44
- package/src/components/UiAutocomplete/__tests__/UiAutocompleteVirtualized.test.ts +107 -0
- package/src/components/UiAutocomplete/types.ts +11 -0
- package/src/components/UiBreadcrumb/UiBreadcrumb.stories.ts +1419 -0
- package/src/components/UiBreadcrumb/UiBreadcrumb.vue +19 -0
- package/src/components/UiBreadcrumb/UiBreadcrumbEllipsis.vue +22 -0
- package/src/components/UiBreadcrumb/UiBreadcrumbItem.vue +19 -0
- package/src/components/UiBreadcrumb/UiBreadcrumbLink.vue +26 -0
- package/src/components/UiBreadcrumb/UiBreadcrumbList.vue +19 -0
- package/src/components/UiBreadcrumb/UiBreadcrumbPage.vue +19 -0
- package/src/components/UiBreadcrumb/UiBreadcrumbSeparator.vue +22 -0
- package/src/components/UiBreadcrumb/index.ts +8 -0
- package/src/components/UiBreadcrumb/types.ts +28 -0
- package/src/components/UiDropdownMenu/UiDropdownMenu.stories.ts +760 -0
- package/src/components/UiDropdownMenu/UiDropdownMenuTrigger.vue +2 -0
- package/src/components/UiFadeMask/UiFadeMask.stories.ts +563 -0
- package/src/components/UiFadeMask/UiFadeMask.vue +86 -0
- package/src/components/UiFadeMask/__tests__/UiFadeMask.test.ts +52 -0
- package/src/components/UiFadeMask/index.ts +6 -0
- package/src/components/UiFadeMask/types.ts +35 -0
- package/src/components/UiListbox/UiListbox.stories.ts +1404 -30
- package/src/components/UiListbox/UiListboxVirtualizer.vue +42 -0
- package/src/components/UiListbox/__tests__/UiListbox.test.ts +70 -35
- package/src/components/UiListbox/__tests__/UiListboxVirtualizer.test.ts +96 -0
- package/src/components/UiListbox/index.ts +1 -0
- package/src/components/UiListbox/types.ts +42 -0
- package/src/components/UiSelect/UiSelect.stories.ts +109 -1
- package/src/components/UiSelect/UiSelectVirtualizer.vue +373 -0
- package/src/components/UiSelect/__tests__/UiSelectVirtualizer.test.ts +185 -0
- package/src/components/UiSelect/index.ts +1 -0
- package/src/components/UiSelect/types.ts +38 -0
- package/src/components/UiSwitch/UiSwitch.stories.ts +706 -9
- package/src/components/UiSwitch/__tests__/UiSwitch.test.ts +2 -6
- package/src/components/UiToggle/UiToggle.stories.ts +961 -130
- package/src/components/UiToggle/UiToggle.vue +8 -1
- package/src/components/UiToggle/__tests__/UiToggle.test.ts +55 -65
- package/src/components/UiToggleGroup/UiToggleGroup.stories.ts +1060 -173
- package/src/components/UiToggleGroup/UiToggleGroup.vue +4 -2
- package/src/components/UiToggleGroup/__tests__/UiToggleGroup.test.ts +117 -325
- package/src/components/UiToggleGroup/types.ts +0 -5
- package/src/components/core/breadcrumb/Breadcrumb.vue +13 -0
- package/src/components/core/breadcrumb/BreadcrumbEllipsis.vue +23 -0
- package/src/components/core/breadcrumb/BreadcrumbItem.vue +17 -0
- package/src/components/core/breadcrumb/BreadcrumbLink.vue +29 -0
- package/src/components/core/breadcrumb/BreadcrumbList.vue +22 -0
- package/src/components/core/breadcrumb/BreadcrumbPage.vue +20 -0
- package/src/components/core/breadcrumb/BreadcrumbSeparator.vue +22 -0
- package/src/components/core/breadcrumb/index.ts +7 -0
- package/src/components/core/dropdown-menu/DropdownMenuCheckboxItem.vue +8 -2
- package/src/components/core/dropdown-menu/DropdownMenuItem.vue +1 -1
- package/src/components/core/dropdown-menu/DropdownMenuRadioItem.vue +8 -2
- package/src/components/core/dropdown-menu/DropdownMenuSubTrigger.vue +1 -1
- package/src/components/core/listbox/Listbox.vue +14 -2
- package/src/components/core/listbox/ListboxContent.vue +61 -3
- package/src/components/core/listbox/ListboxItem.vue +6 -1
- package/src/components/core/listbox/context.ts +34 -0
- package/src/components/core/toggle/Toggle.vue +15 -1
- package/src/components/core/toggle/index.ts +2 -2
- package/src/components/core/toggle-group/ToggleGroup.vue +1 -1
- package/src/components/core/toggle-group/index.ts +5 -2
- package/src/components/index.ts +2 -0
- package/src/patterns/UiFloatActions/UiFloatActions.stories.ts +4 -5
- package/src/patterns/UiFloatActions/UiFloatActions.vue +23 -11
- package/src/patterns/UiFloatActions/__tests__/UiFloatActions.test.ts +23 -0
- package/src/patterns/UiFloatActions/types.ts +2 -1
- package/src/patterns/UiProfileCard/UiProfileCard.stories.ts +1064 -0
- package/src/patterns/UiProfileCard/index.ts +7 -0
- package/src/patterns/UiTopBar/UiTopBar.stories.ts +1121 -0
- package/src/patterns/UiTopBar/UiTopBar.vue +166 -0
- package/src/patterns/UiTopBar/__tests__/UiTopBar.test.ts +245 -0
- package/src/patterns/UiTopBar/index.ts +2 -0
- package/src/patterns/UiTopBar/types.ts +29 -0
- package/src/patterns/index.ts +2 -0
|
@@ -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';
|
|
@@ -25,7 +25,7 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
|
|
25
25
|
v-bind="forwarded"
|
|
26
26
|
:class="
|
|
27
27
|
cn(
|
|
28
|
-
'group/dropdown-menu-checkbox-item hover:bg-background-surface-muted-subtle data-[highlighted]:bg-background-surface-muted-subtle focus:text-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 label-14-regular outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
|
|
28
|
+
'group/dropdown-menu-checkbox-item hover:bg-background-surface-muted-subtle data-[highlighted]:bg-background-surface-muted-subtle focus:text-foreground relative h-9 flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 label-14-regular outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
|
|
29
29
|
props.class,
|
|
30
30
|
)
|
|
31
31
|
"
|
|
@@ -36,11 +36,17 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
|
|
36
36
|
class="pointer-events-none absolute left-2 flex size-4 items-center justify-center"
|
|
37
37
|
>
|
|
38
38
|
<slot name="indicator-icon">
|
|
39
|
+
<!--
|
|
40
|
+
The checkbox is decoration: the menu item itself carries the checked
|
|
41
|
+
state. It has to be disabled, not just untabbable, or it is focusable
|
|
42
|
+
content inside an `aria-hidden` element (axe `aria-hidden-focus`).
|
|
43
|
+
-->
|
|
39
44
|
<UiCheckbox
|
|
40
45
|
name="dropdown-menu-checkbox-indicator"
|
|
41
46
|
:model-value="props.modelValue"
|
|
47
|
+
disabled
|
|
42
48
|
tabindex="-1"
|
|
43
|
-
class="pointer-events-none"
|
|
49
|
+
class="pointer-events-none disabled:opacity-100"
|
|
44
50
|
/>
|
|
45
51
|
</slot>
|
|
46
52
|
</span>
|
|
@@ -31,7 +31,7 @@ const forwardedProps = useForwardProps(delegatedProps);
|
|
|
31
31
|
v-bind="forwardedProps"
|
|
32
32
|
:class="
|
|
33
33
|
cn(
|
|
34
|
-
'hover:bg-background-surface-muted-subtle data-[highlighted]:bg-background-surface-muted-subtle focus:text-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*=\'text-\'])]:text-content-on-surface-muted relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5
|
|
34
|
+
'hover:bg-background-surface-muted-subtle data-[highlighted]:bg-background-surface-muted-subtle focus:text-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*=\'text-\'])]:text-content-on-surface-muted relative h-9 flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 body-14-regular outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=\'size-\'])]:size-4',
|
|
35
35
|
props.class,
|
|
36
36
|
)
|
|
37
37
|
"
|
|
@@ -29,7 +29,7 @@ const visualRadioValue = computed(() => String(props.value ?? ''));
|
|
|
29
29
|
v-bind="forwarded"
|
|
30
30
|
:class="
|
|
31
31
|
cn(
|
|
32
|
-
'group/dropdown-menu-radio-item hover:bg-background-surface-muted-subtle data-[highlighted]:bg-background-surface-muted-subtle focus:text-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 label-14-regular outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
|
|
32
|
+
'group/dropdown-menu-radio-item hover:bg-background-surface-muted-subtle data-[highlighted]:bg-background-surface-muted-subtle focus:text-foreground relative h-9 flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 label-14-regular outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
|
|
33
33
|
props.class,
|
|
34
34
|
)
|
|
35
35
|
"
|
|
@@ -40,6 +40,11 @@ const visualRadioValue = computed(() => String(props.value ?? ''));
|
|
|
40
40
|
class="pointer-events-none absolute left-2 flex size-4 items-center justify-center"
|
|
41
41
|
>
|
|
42
42
|
<slot name="indicator-icon">
|
|
43
|
+
<!--
|
|
44
|
+
The radio is decoration: the menu item itself carries the checked
|
|
45
|
+
state. It has to be disabled, not just untabbable, or it is focusable
|
|
46
|
+
content inside an `aria-hidden` element (axe `aria-hidden-focus`).
|
|
47
|
+
-->
|
|
43
48
|
<UiRadioGroup
|
|
44
49
|
name="dropdown-menu-radio-indicator"
|
|
45
50
|
:model-value="visualRadioValue"
|
|
@@ -48,8 +53,9 @@ const visualRadioValue = computed(() => String(props.value ?? ''));
|
|
|
48
53
|
<UiRadioGroupItem
|
|
49
54
|
:id="`dropdown-menu-radio-indicator-${visualRadioValue}`"
|
|
50
55
|
:value="visualRadioValue"
|
|
56
|
+
disabled
|
|
51
57
|
tabindex="-1"
|
|
52
|
-
class="pointer-events-none border-input group-data-[state=checked]/dropdown-menu-radio-item:border-accent-default [&_[data-slot=radio-group-indicator]]:opacity-0 group-data-[state=checked]/dropdown-menu-radio-item:[&_[data-slot=radio-group-indicator]]:opacity-100"
|
|
58
|
+
class="pointer-events-none border-input disabled:opacity-100 group-data-[state=checked]/dropdown-menu-radio-item:border-accent-default [&_[data-slot=radio-group-indicator]]:opacity-0 group-data-[state=checked]/dropdown-menu-radio-item:[&_[data-slot=radio-group-indicator]]:opacity-100"
|
|
53
59
|
/>
|
|
54
60
|
</UiRadioGroup>
|
|
55
61
|
</slot>
|
|
@@ -23,7 +23,7 @@ const forwardedProps = useForwardProps(delegatedProps);
|
|
|
23
23
|
v-bind="forwardedProps"
|
|
24
24
|
:class="
|
|
25
25
|
cn(
|
|
26
|
-
'hover:bg-background-surface-muted-subtle data-[highlighted]:bg-background-surface-muted-subtle data-[state=open]:bg-background-surface-muted-subtle focus:text-foreground data-[state=open]:text-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 label-14-regular outline-hidden select-none data-[inset]:pl-8',
|
|
26
|
+
'hover:bg-background-surface-muted-subtle data-[highlighted]:bg-background-surface-muted-subtle data-[state=open]:bg-background-surface-muted-subtle focus:text-foreground data-[state=open]:text-foreground h-9 flex cursor-default items-center rounded-sm px-2 py-1.5 label-14-regular outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8',
|
|
27
27
|
props.class,
|
|
28
28
|
)
|
|
29
29
|
"
|
|
@@ -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 {
|
|
5
|
-
|
|
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
|
|
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 body-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
|
-
|
|
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-
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
|
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: {
|
package/src/components/index.ts
CHANGED
|
@@ -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';
|
|
@@ -19,6 +20,7 @@ export * from './UiDialog';
|
|
|
19
20
|
export * from './UiDrawer';
|
|
20
21
|
export * from './UiDropdownMenu';
|
|
21
22
|
export * from './UiEmpty';
|
|
23
|
+
export * from './UiFadeMask';
|
|
22
24
|
export * from './UiField';
|
|
23
25
|
export * from './UiFileItem';
|
|
24
26
|
export * from './UiFileType';
|
|
@@ -1368,17 +1368,16 @@ export const HoverTriggerKeyboard: Story = {
|
|
|
1368
1368
|
// Tabbing to the anchor opens the teleported panel (queried on the body).
|
|
1369
1369
|
const canvas = within(canvasElement);
|
|
1370
1370
|
const body = within(document.body);
|
|
1371
|
-
const anchor =
|
|
1371
|
+
const anchor = canvasElement.querySelector(
|
|
1372
|
+
'[data-slot="float-anchor"]',
|
|
1373
|
+
) as HTMLElement;
|
|
1372
1374
|
|
|
1373
1375
|
await step(
|
|
1374
1376
|
'keyboard: focusing a hover trigger opens the panel for keyboard users (WCAG 2.1.1)',
|
|
1375
1377
|
async () => {
|
|
1376
|
-
|
|
1378
|
+
expect(anchor).toHaveAttribute('tabindex', '0');
|
|
1377
1379
|
await userEvent.tab();
|
|
1378
1380
|
await expect(anchor).toHaveFocus();
|
|
1379
|
-
await waitFor(() =>
|
|
1380
|
-
expect(anchor).toHaveAttribute('aria-expanded', 'true'),
|
|
1381
|
-
);
|
|
1382
1381
|
await expect(
|
|
1383
1382
|
await body.findByRole('button', { name: 'Copy' }),
|
|
1384
1383
|
).toBeInTheDocument();
|
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @component UiFloatActions
|
|
10
10
|
* @property {'hover' | 'focus' | 'click' | 'manual'} [trigger='hover'] -
|
|
11
|
-
* How the panel opens. `hover` opens on pointer hover and keyboard focus
|
|
12
|
-
*
|
|
11
|
+
* How the panel opens. `hover` opens on pointer hover and keyboard focus
|
|
12
|
+
* (focusable non-button so slotted text stays selectable); `focus` opens on
|
|
13
|
+
* keyboard focus; `click` toggles on pointer or Enter/Space.
|
|
13
14
|
* @property {Placement} [placement='top'] -
|
|
14
15
|
* Preferred placement relative to the anchor. Auto-flips when space is limited.
|
|
15
16
|
* @property {number | AnchorFloatOffset} [offset=8] -
|
|
@@ -115,22 +116,29 @@ const supportsPopover =
|
|
|
115
116
|
typeof HTMLElement.prototype.showPopover === 'function';
|
|
116
117
|
|
|
117
118
|
const isClickTrigger = computed(() => props.trigger === 'click');
|
|
119
|
+
const isHoverTrigger = computed(() => props.trigger === 'hover');
|
|
118
120
|
|
|
119
|
-
/**
|
|
121
|
+
/**
|
|
122
|
+
* Click and focus anchors are native `button`s (activation targets).
|
|
123
|
+
* Hover anchors stay a focusable non-button so slotted text (e.g. a user
|
|
124
|
+
* message) remains selectable/copyable and nested controls stay valid HTML.
|
|
125
|
+
*/
|
|
120
126
|
const usesButtonAnchor = computed(() =>
|
|
121
|
-
['
|
|
127
|
+
['click', 'focus'].includes(props.trigger),
|
|
122
128
|
);
|
|
123
129
|
|
|
130
|
+
/** Popup ARIA belongs on button anchors only — not on a generic `<span>`. */
|
|
124
131
|
const hasPopupA11y = computed(() => usesButtonAnchor.value);
|
|
125
132
|
|
|
126
133
|
/**
|
|
127
|
-
* Ghost
|
|
128
|
-
*
|
|
134
|
+
* Ghost reset so the anchor inherits slot layout while matching core
|
|
135
|
+
* keyboard focus: accent fill and blue focus ring.
|
|
129
136
|
*/
|
|
130
137
|
const anchorClass = computed(() =>
|
|
131
138
|
cn(
|
|
132
|
-
usesButtonAnchor.value &&
|
|
139
|
+
(usesButtonAnchor.value || isHoverTrigger.value) &&
|
|
133
140
|
'ui-focus-ring inline-flex max-w-full cursor-default rounded-md border border-transparent bg-transparent p-0 text-left font-inherit text-inherit',
|
|
141
|
+
isHoverTrigger.value && 'select-text',
|
|
134
142
|
isClickTrigger.value && 'cursor-pointer',
|
|
135
143
|
attrs.class ?? '',
|
|
136
144
|
),
|
|
@@ -157,10 +165,14 @@ const floatingAnimationClass = computed(() =>
|
|
|
157
165
|
|
|
158
166
|
<template>
|
|
159
167
|
<span class="inline-flex">
|
|
160
|
-
|
|
161
|
-
|
|
168
|
+
<!-- Button for click/focus; focusable span for hover (text stays selectable). -->
|
|
169
|
+
<!-- eslint-disable-next-line vuejs-accessibility/no-static-element-interactions -->
|
|
170
|
+
<component
|
|
171
|
+
v-if="usesButtonAnchor || isHoverTrigger"
|
|
172
|
+
:is="usesButtonAnchor ? 'button' : 'span'"
|
|
162
173
|
ref="referenceRef"
|
|
163
|
-
type="button"
|
|
174
|
+
:type="usesButtonAnchor ? 'button' : undefined"
|
|
175
|
+
:tabindex="isHoverTrigger ? 0 : undefined"
|
|
164
176
|
data-slot="float-anchor"
|
|
165
177
|
:aria-label="props.ariaLabel"
|
|
166
178
|
:aria-expanded="hasPopupA11y ? open : undefined"
|
|
@@ -176,7 +188,7 @@ const floatingAnimationClass = computed(() =>
|
|
|
176
188
|
@keydown="onReferenceKeydown"
|
|
177
189
|
>
|
|
178
190
|
<slot name="container" />
|
|
179
|
-
</
|
|
191
|
+
</component>
|
|
180
192
|
|
|
181
193
|
<!-- eslint-disable-next-line vuejs-accessibility/no-static-element-interactions -->
|
|
182
194
|
<span
|
|
@@ -4,6 +4,29 @@ import { nextTick } from 'vue';
|
|
|
4
4
|
import { UiFloatActions, UiFloatActionItems } from '../index';
|
|
5
5
|
|
|
6
6
|
describe('UiFloatActions', () => {
|
|
7
|
+
test('uses a focusable non-button anchor for hover so text stays selectable', () => {
|
|
8
|
+
const { container, getByText } = render({
|
|
9
|
+
components: { UiFloatActions, UiFloatActionItems },
|
|
10
|
+
template: `
|
|
11
|
+
<UiFloatActions trigger="hover" aria-label="Open actions">
|
|
12
|
+
<template #container>
|
|
13
|
+
<span>Select text</span>
|
|
14
|
+
</template>
|
|
15
|
+
<template #action>
|
|
16
|
+
<UiFloatActionItems aria-label="Actions">
|
|
17
|
+
<UiFloatActionItems type="button" aria-label="Edit">Edit</UiFloatActionItems>
|
|
18
|
+
</UiFloatActionItems>
|
|
19
|
+
</template>
|
|
20
|
+
</UiFloatActions>
|
|
21
|
+
`,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const anchor = container.querySelector('[data-slot="float-anchor"]');
|
|
25
|
+
expect(anchor?.tagName).toBe('SPAN');
|
|
26
|
+
expect(anchor).toHaveAttribute('tabindex', '0');
|
|
27
|
+
expect(getByText('Select text')).toBeInTheDocument();
|
|
28
|
+
});
|
|
29
|
+
|
|
7
30
|
test('shows action content on click trigger', async () => {
|
|
8
31
|
const { getByRole, queryByRole } = render({
|
|
9
32
|
components: { UiFloatActions, UiFloatActionItems },
|
|
@@ -24,7 +24,8 @@ export type UiFloatActionsOffset = number | AnchorFloatOffset;
|
|
|
24
24
|
export interface UiFloatActionsProps {
|
|
25
25
|
/**
|
|
26
26
|
* How the floating panel opens.
|
|
27
|
-
* - `hover` — pointer hover and keyboard focus on a focusable
|
|
27
|
+
* - `hover` — pointer hover and keyboard focus on a focusable non-button
|
|
28
|
+
* anchor (text inside remains selectable/copyable)
|
|
28
29
|
* - `focus` — keyboard focus on the `button` anchor
|
|
29
30
|
* - `click` — click or Enter/Space on the `button` anchor
|
|
30
31
|
* - `manual` — controlled via `v-model:open`
|