diff --git a/apps/www/src/App.vue b/apps/www/src/App.vue index 7b0960d1..2d9135bf 100644 --- a/apps/www/src/App.vue +++ b/apps/www/src/App.vue @@ -4,6 +4,8 @@ import PopoverDemo from '@/registry/default/examples/PopoverDemo.vue' import DialogDemo from '@/registry/default/examples/DialogDemo.vue' import AlertDialogDemo from '@/registry/default/examples/AlertDialogDemo.vue' import SelectDemo from '@/registry/default/examples/SelectDemo.vue' +import AlertDemo from '@/registry/default/examples/AlertDemo.vue' +import AvatarDemo from '@/registry/default/examples/AvatarDemo.vue' diff --git a/apps/www/src/lib/registry/default/examples/AlertDemo.vue b/apps/www/src/lib/registry/default/examples/AlertDemo.vue new file mode 100644 index 00000000..cd9fe84f --- /dev/null +++ b/apps/www/src/lib/registry/default/examples/AlertDemo.vue @@ -0,0 +1,14 @@ + + + diff --git a/apps/www/src/lib/registry/default/examples/AvatarDemo.vue b/apps/www/src/lib/registry/default/examples/AvatarDemo.vue new file mode 100644 index 00000000..603a79cd --- /dev/null +++ b/apps/www/src/lib/registry/default/examples/AvatarDemo.vue @@ -0,0 +1,10 @@ + + + diff --git a/apps/www/src/lib/registry/default/ui/alert.tsx b/apps/www/src/lib/registry/default/ui/alert.tsx new file mode 100644 index 00000000..aad36b43 --- /dev/null +++ b/apps/www/src/lib/registry/default/ui/alert.tsx @@ -0,0 +1,53 @@ +import { type VariantProps, cva } from 'class-variance-authority' +import { HTMLAttributes, defineComponent } from 'vue' +import { cn } from '@/utils' + +const alertVariants = cva( + 'relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground', + { + variants: { + variant: { + default: 'bg-background text-foreground', + destructive: + 'border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive', + }, + }, + defaultVariants: { + variant: 'default', + }, + }, +) + +const Alert = defineComponent & HTMLAttributes>((props, { slots, attrs }) => { + const variant = props.variant ?? 'default' + return () => ( + + ) +}, {name: "Alert"}) + +const AlertTitle = defineComponent((props, {slots, attrs}) => { + return () =>( +
+ {slots.default?.()} +
+)}, {name: "AlertTitle"}) + +const AlertDescription = defineComponent((props, {slots, attrs}) => { return () => ( +
+ {slots.default?.()} +
+)}, {name: "AlertDescription"}) + +export { Alert, AlertTitle, AlertDescription } diff --git a/apps/www/src/lib/registry/default/ui/avatar.tsx b/apps/www/src/lib/registry/default/ui/avatar.tsx new file mode 100644 index 00000000..c2610ee6 --- /dev/null +++ b/apps/www/src/lib/registry/default/ui/avatar.tsx @@ -0,0 +1,56 @@ +import {AvatarRoot as AvatarRootPrimitive, + AvatarImage as AvatarImagePrimitive, + AvatarFallback as AvatarFallbackPrimitive, + type AvatarRootProps, + type AvatarImageProps, + type AvatarFallbackProps, + +} from 'radix-vue'; +import { cn, useEmitAsProps } from "@/utils" +import { defineComponent } from 'vue'; + +const Avatar = defineComponent((props, {attrs, slots}) => { + return () => ( + + {slots.default?.()} + +)}, {name: "Avatar"}) + +const AvatarImage = defineComponent((props, {attrs, slots, emit}) => { + const emitsAsProps = useEmitAsProps(emit) + return () => ( + + {slots.default?.()} + + ) +}, {name: "AvatarImage", emits: AvatarImagePrimitive.emits}); + +const AvatarFallback = defineComponent((props, {attrs, slots, emit}) => { + const emitsAsProps = useEmitAsProps(emit) + return () => ( + + {slots.default?.()} + + ) +}, { + name: "AvatarFallback", +}) + +export { Avatar, AvatarImage, AvatarFallback }