mirror of
https://github.com/versia-pub/frontend.git
synced 2026-03-13 03:29:16 +01:00
chore: ⬆️ Upgrade to Nuxt 4
Some checks failed
Some checks failed
This commit is contained in:
parent
8debe97f63
commit
7f7cf20311
386 changed files with 2376 additions and 2332 deletions
42
app/components/ui/toggle/Toggle.vue
Normal file
42
app/components/ui/toggle/Toggle.vue
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<script setup lang="ts">
|
||||
import { reactiveOmit } from "@vueuse/core";
|
||||
import {
|
||||
Toggle,
|
||||
type ToggleEmits,
|
||||
type ToggleProps,
|
||||
useForwardPropsEmits,
|
||||
} from "reka-ui";
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { type ToggleVariants, toggleVariants } from ".";
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<
|
||||
ToggleProps & {
|
||||
class?: HTMLAttributes["class"];
|
||||
variant?: ToggleVariants["variant"];
|
||||
size?: ToggleVariants["size"];
|
||||
}
|
||||
>(),
|
||||
{
|
||||
variant: "default",
|
||||
size: "default",
|
||||
disabled: false,
|
||||
},
|
||||
);
|
||||
|
||||
const emits = defineEmits<ToggleEmits>();
|
||||
|
||||
const delegatedProps = reactiveOmit(props, "class", "size", "variant");
|
||||
const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Toggle
|
||||
data-slot="toggle"
|
||||
v-bind="forwarded"
|
||||
:class="cn(toggleVariants({ variant, size }), props.class)"
|
||||
>
|
||||
<slot />
|
||||
</Toggle>
|
||||
</template>
|
||||
27
app/components/ui/toggle/index.ts
Normal file
27
app/components/ui/toggle/index.ts
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import { cva, type VariantProps } from "class-variance-authority";
|
||||
|
||||
export { default as Toggle } from "./Toggle.vue";
|
||||
|
||||
export const toggleVariants = cva(
|
||||
"inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",
|
||||
{
|
||||
variants: {
|
||||
variant: {
|
||||
default: "bg-transparent",
|
||||
outline:
|
||||
"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground",
|
||||
},
|
||||
size: {
|
||||
default: "h-9 px-2 min-w-9",
|
||||
sm: "h-8 px-1.5 min-w-8",
|
||||
lg: "h-10 px-2.5 min-w-10",
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
variant: "default",
|
||||
size: "default",
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
export type ToggleVariants = VariantProps<typeof toggleVariants>;
|
||||
Loading…
Add table
Add a link
Reference in a new issue