feat: migrate ScrollShadow and Tabs with docs and keyboard support
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<script setup lang="ts">
|
||||
import { watch, onBeforeUnmount } from "vue";
|
||||
import { TabsList as RekaList, useForwardExpose } from "reka-ui";
|
||||
import { useTabs } from "./context";
|
||||
defineOptions({ inheritAttrs: false });
|
||||
withDefaults(defineProps<{ as?: string; loop?: boolean }>(), {
|
||||
as: "div",
|
||||
loop: true,
|
||||
});
|
||||
const ctx = useTabs();
|
||||
const { forwardRef, currentElement } = useForwardExpose();
|
||||
watch(
|
||||
currentElement,
|
||||
(el) => {
|
||||
ctx.list.value = el;
|
||||
ctx.measure();
|
||||
},
|
||||
{ flush: "post" },
|
||||
);
|
||||
onBeforeUnmount(() => {
|
||||
ctx.list.value = undefined;
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<RekaList
|
||||
:ref="forwardRef"
|
||||
v-bind="$attrs"
|
||||
:as="as"
|
||||
:loop="loop"
|
||||
class="hv-tabs__list"
|
||||
data-slot="tabs-list"
|
||||
:data-orientation="ctx.orientation.value"
|
||||
>
|
||||
<slot />
|
||||
</RekaList>
|
||||
</template>
|
||||
Reference in New Issue
Block a user