53 lines
1.4 KiB
TypeScript
53 lines
1.4 KiB
TypeScript
import { ref } from "vue";
|
|
import {
|
|
useScrollShadow,
|
|
type ScrollShadowProps,
|
|
type TabsProps,
|
|
type TabsTabProps,
|
|
type TabsPanelProps,
|
|
} from "../../packages/vue/src";
|
|
const shadow: ScrollShadowProps = {
|
|
orientation: "horizontal",
|
|
visibility: "both",
|
|
onVisibilityChange: (_value) => {},
|
|
};
|
|
const tabs: TabsProps = {
|
|
modelValue: 1,
|
|
keyboardActivation: "manual",
|
|
variant: "secondary",
|
|
disabledKeys: [1, "1"],
|
|
};
|
|
const tab: TabsTabProps = { value: "a", href: "/guide", isDisabled: true };
|
|
const panel: TabsPanelProps = { value: 1, shouldForceMount: true };
|
|
// @ts-expect-error variant is a fixed union
|
|
const badShadow: ScrollShadowProps = { variant: "shadow" };
|
|
// @ts-expect-error unsupported orientation
|
|
const badTabs: TabsProps = { orientation: "diagonal" };
|
|
// @ts-expect-error keys are not objects
|
|
const badTab: TabsTabProps = { value: { id: 1 } };
|
|
const badCallback: TabsProps = {
|
|
// @ts-expect-error controlled callback key remains string | number
|
|
"onUpdate:modelValue": (_value: boolean) => {},
|
|
};
|
|
function hookContract() {
|
|
const el = ref<HTMLElement>();
|
|
const state = useScrollShadow({
|
|
containerRef: el,
|
|
orientation: () => "horizontal",
|
|
});
|
|
// @ts-expect-error detection is readonly
|
|
state.visibility.value = "both";
|
|
return state;
|
|
}
|
|
void [
|
|
shadow,
|
|
tabs,
|
|
tab,
|
|
panel,
|
|
badShadow,
|
|
badTabs,
|
|
badTab,
|
|
badCallback,
|
|
hookContract,
|
|
];
|