@spavn/ui 0.0.1
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/cli/commands/add.d.ts +5 -0
- package/cli/commands/add.d.ts.map +1 -0
- package/cli/commands/add.js +104 -0
- package/cli/commands/add.js.map +1 -0
- package/cli/commands/init.d.ts +5 -0
- package/cli/commands/init.d.ts.map +1 -0
- package/cli/commands/init.js +129 -0
- package/cli/commands/init.js.map +1 -0
- package/cli/index.d.ts +3 -0
- package/cli/index.d.ts.map +1 -0
- package/cli/index.js +27 -0
- package/cli/index.js.map +1 -0
- package/cli/registry.d.ts +12 -0
- package/cli/registry.d.ts.map +1 -0
- package/cli/registry.js +1112 -0
- package/cli/registry.js.map +1 -0
- package/dist/index.js +7492 -0
- package/dist/index.umd.cjs +122 -0
- package/dist/style.css +1 -0
- package/mcp-server/index.d.ts +3 -0
- package/mcp-server/index.d.ts.map +1 -0
- package/mcp-server/index.js +1266 -0
- package/mcp-server/index.js.map +1 -0
- package/package.json +91 -0
- package/src/index.ts +432 -0
- package/src/lib/accordion/Accordion.test.ts +109 -0
- package/src/lib/accordion/Accordion.vue +11 -0
- package/src/lib/accordion/AccordionContent.vue +23 -0
- package/src/lib/accordion/AccordionItem.vue +16 -0
- package/src/lib/accordion/AccordionTrigger.vue +37 -0
- package/src/lib/accordion/index.ts +4 -0
- package/src/lib/alert/Alert.test.ts +144 -0
- package/src/lib/alert/Alert.vue +17 -0
- package/src/lib/alert/AlertDescription.vue +15 -0
- package/src/lib/alert/AlertTitle.vue +15 -0
- package/src/lib/alert/variants.test.ts +47 -0
- package/src/lib/alert/variants.ts +19 -0
- package/src/lib/alert-dialog/AlertDialog.vue +11 -0
- package/src/lib/alert-dialog/AlertDialogAction.vue +23 -0
- package/src/lib/alert-dialog/AlertDialogCancel.vue +24 -0
- package/src/lib/alert-dialog/AlertDialogContent.vue +33 -0
- package/src/lib/alert-dialog/AlertDialogDescription.vue +16 -0
- package/src/lib/alert-dialog/AlertDialogFooter.vue +17 -0
- package/src/lib/alert-dialog/AlertDialogHeader.vue +17 -0
- package/src/lib/alert-dialog/AlertDialogOverlay.vue +21 -0
- package/src/lib/alert-dialog/AlertDialogPortal.vue +11 -0
- package/src/lib/alert-dialog/AlertDialogTitle.vue +16 -0
- package/src/lib/alert-dialog/AlertDialogTrigger.vue +11 -0
- package/src/lib/alert-dialog/index.ts +11 -0
- package/src/lib/aspect-ratio/AspectRatio.vue +11 -0
- package/src/lib/aspect-ratio/index.ts +1 -0
- package/src/lib/avatar/Avatar.test.ts +58 -0
- package/src/lib/avatar/Avatar.vue +20 -0
- package/src/lib/avatar/AvatarFallback.vue +20 -0
- package/src/lib/avatar/AvatarImage.vue +10 -0
- package/src/lib/avatar/index.ts +3 -0
- package/src/lib/badge/Badge.test.ts +77 -0
- package/src/lib/badge/Badge.vue +20 -0
- package/src/lib/badge/index.ts +2 -0
- package/src/lib/badge/variants.test.ts +73 -0
- package/src/lib/badge/variants.ts +26 -0
- package/src/lib/breadcrumb/Breadcrumb.vue +13 -0
- package/src/lib/breadcrumb/BreadcrumbEllipsis.vue +35 -0
- package/src/lib/breadcrumb/BreadcrumbItem.vue +15 -0
- package/src/lib/breadcrumb/BreadcrumbLink.vue +21 -0
- package/src/lib/breadcrumb/BreadcrumbList.vue +22 -0
- package/src/lib/breadcrumb/BreadcrumbPage.vue +20 -0
- package/src/lib/breadcrumb/BreadcrumbSeparator.vue +34 -0
- package/src/lib/breadcrumb/index.ts +7 -0
- package/src/lib/button/Button.test.ts +84 -0
- package/src/lib/button/Button.vue +63 -0
- package/src/lib/button/index.ts +2 -0
- package/src/lib/button/variants.test.ts +128 -0
- package/src/lib/button/variants.ts +66 -0
- package/src/lib/button-group/ButtonGroup.vue +25 -0
- package/src/lib/button-group/index.ts +1 -0
- package/src/lib/calendar/Calendar.vue +58 -0
- package/src/lib/calendar/CalendarCell.vue +22 -0
- package/src/lib/calendar/CalendarCellTrigger.vue +28 -0
- package/src/lib/calendar/CalendarGrid.vue +16 -0
- package/src/lib/calendar/CalendarGridBody.vue +11 -0
- package/src/lib/calendar/CalendarGridHead.vue +11 -0
- package/src/lib/calendar/CalendarGridRow.vue +16 -0
- package/src/lib/calendar/CalendarHeadCell.vue +16 -0
- package/src/lib/calendar/CalendarHeader.vue +16 -0
- package/src/lib/calendar/CalendarHeading.vue +16 -0
- package/src/lib/calendar/CalendarNext.vue +37 -0
- package/src/lib/calendar/CalendarPrev.vue +37 -0
- package/src/lib/calendar/index.ts +12 -0
- package/src/lib/card/Card.test.ts +202 -0
- package/src/lib/card/Card.vue +36 -0
- package/src/lib/card/CardContent.vue +15 -0
- package/src/lib/card/CardDescription.vue +15 -0
- package/src/lib/card/CardFooter.vue +16 -0
- package/src/lib/card/CardHeader.vue +15 -0
- package/src/lib/card/CardTitle.vue +15 -0
- package/src/lib/card/index.ts +6 -0
- package/src/lib/carousel/Carousel.vue +73 -0
- package/src/lib/carousel/CarouselContent.vue +55 -0
- package/src/lib/carousel/CarouselItem.vue +25 -0
- package/src/lib/carousel/CarouselNext.vue +40 -0
- package/src/lib/carousel/CarouselPrevious.vue +40 -0
- package/src/lib/carousel/index.ts +6 -0
- package/src/lib/carousel/useCarousel.ts +24 -0
- package/src/lib/checkbox/Checkbox.test.ts +45 -0
- package/src/lib/checkbox/Checkbox.vue +39 -0
- package/src/lib/code-preview/CodePreview.vue +95 -0
- package/src/lib/collapsible/Collapsible.test.ts +95 -0
- package/src/lib/collapsible/Collapsible.vue +11 -0
- package/src/lib/collapsible/CollapsibleContent.vue +21 -0
- package/src/lib/collapsible/CollapsibleTrigger.vue +11 -0
- package/src/lib/collapsible/index.ts +3 -0
- package/src/lib/command/Command.vue +21 -0
- package/src/lib/command/CommandDialog.vue +25 -0
- package/src/lib/command/CommandEmpty.vue +16 -0
- package/src/lib/command/CommandGroup.vue +21 -0
- package/src/lib/command/CommandInput.vue +35 -0
- package/src/lib/command/CommandItem.vue +23 -0
- package/src/lib/command/CommandLabel.vue +16 -0
- package/src/lib/command/CommandList.vue +16 -0
- package/src/lib/command/CommandSeparator.vue +14 -0
- package/src/lib/command/index.ts +9 -0
- package/src/lib/context-menu/ContextMenu.vue +11 -0
- package/src/lib/context-menu/ContextMenuCheckboxItem.vue +45 -0
- package/src/lib/context-menu/ContextMenuContent.vue +31 -0
- package/src/lib/context-menu/ContextMenuGroup.vue +11 -0
- package/src/lib/context-menu/ContextMenuItem.vue +24 -0
- package/src/lib/context-menu/ContextMenuLabel.vue +16 -0
- package/src/lib/context-menu/ContextMenuRadioGroup.vue +11 -0
- package/src/lib/context-menu/ContextMenuRadioItem.vue +44 -0
- package/src/lib/context-menu/ContextMenuSeparator.vue +14 -0
- package/src/lib/context-menu/ContextMenuShortcut.vue +11 -0
- package/src/lib/context-menu/ContextMenuSub.vue +11 -0
- package/src/lib/context-menu/ContextMenuSubContent.vue +28 -0
- package/src/lib/context-menu/ContextMenuSubTrigger.vue +36 -0
- package/src/lib/context-menu/ContextMenuTrigger.vue +11 -0
- package/src/lib/context-menu/index.ts +14 -0
- package/src/lib/data-table/DataTable.vue +226 -0
- package/src/lib/date-range-picker/DateRangePicker.vue +201 -0
- package/src/lib/date-time-picker/DateTimePicker.vue +159 -0
- package/src/lib/dialog/Dialog.test.ts +87 -0
- package/src/lib/dialog/Dialog.vue +14 -0
- package/src/lib/dialog/DialogClose.vue +11 -0
- package/src/lib/dialog/DialogContent.vue +56 -0
- package/src/lib/dialog/DialogDescription.vue +15 -0
- package/src/lib/dialog/DialogFooter.vue +17 -0
- package/src/lib/dialog/DialogHeader.vue +17 -0
- package/src/lib/dialog/DialogOverlay.vue +20 -0
- package/src/lib/dialog/DialogPortal.vue +11 -0
- package/src/lib/dialog/DialogTitle.vue +15 -0
- package/src/lib/dialog/DialogTrigger.vue +11 -0
- package/src/lib/dialog/index.ts +10 -0
- package/src/lib/direction/Direction.vue +13 -0
- package/src/lib/drawer/Drawer.vue +11 -0
- package/src/lib/drawer/DrawerClose.vue +11 -0
- package/src/lib/drawer/DrawerContent.vue +31 -0
- package/src/lib/drawer/DrawerDescription.vue +16 -0
- package/src/lib/drawer/DrawerFooter.vue +15 -0
- package/src/lib/drawer/DrawerHeader.vue +15 -0
- package/src/lib/drawer/DrawerOverlay.vue +21 -0
- package/src/lib/drawer/DrawerTitle.vue +16 -0
- package/src/lib/drawer/DrawerTrigger.vue +11 -0
- package/src/lib/drawer/index.ts +9 -0
- package/src/lib/dropdown-menu/DropdownMenu.test.ts +146 -0
- package/src/lib/dropdown-menu/DropdownMenu.vue +11 -0
- package/src/lib/dropdown-menu/DropdownMenuCheckboxItem.vue +45 -0
- package/src/lib/dropdown-menu/DropdownMenuContent.vue +31 -0
- package/src/lib/dropdown-menu/DropdownMenuGroup.vue +11 -0
- package/src/lib/dropdown-menu/DropdownMenuItem.vue +24 -0
- package/src/lib/dropdown-menu/DropdownMenuLabel.vue +16 -0
- package/src/lib/dropdown-menu/DropdownMenuRadioGroup.vue +11 -0
- package/src/lib/dropdown-menu/DropdownMenuRadioItem.vue +44 -0
- package/src/lib/dropdown-menu/DropdownMenuSeparator.vue +14 -0
- package/src/lib/dropdown-menu/DropdownMenuShortcut.vue +11 -0
- package/src/lib/dropdown-menu/DropdownMenuSub.vue +11 -0
- package/src/lib/dropdown-menu/DropdownMenuSubContent.vue +27 -0
- package/src/lib/dropdown-menu/DropdownMenuSubTrigger.vue +36 -0
- package/src/lib/dropdown-menu/DropdownMenuTrigger.vue +11 -0
- package/src/lib/dropdown-menu/index.ts +14 -0
- package/src/lib/empty/Empty.vue +11 -0
- package/src/lib/empty/EmptyDescription.vue +11 -0
- package/src/lib/empty/EmptyIcon.vue +8 -0
- package/src/lib/empty/EmptyTitle.vue +11 -0
- package/src/lib/empty/index.ts +4 -0
- package/src/lib/feature-card/FeatureCard.vue +177 -0
- package/src/lib/feature-card/README.md +139 -0
- package/src/lib/feature-card/index.ts +1 -0
- package/src/lib/field/Field.vue +15 -0
- package/src/lib/field/FieldDescription.vue +15 -0
- package/src/lib/field/FieldError.vue +15 -0
- package/src/lib/field/FieldLabel.vue +24 -0
- package/src/lib/field/index.ts +4 -0
- package/src/lib/hover-card/HoverCard.vue +11 -0
- package/src/lib/hover-card/HoverCardContent.vue +31 -0
- package/src/lib/hover-card/HoverCardTrigger.vue +11 -0
- package/src/lib/hover-card/index.ts +3 -0
- package/src/lib/icon/Icon.vue +33 -0
- package/src/lib/input/Input.test.ts +71 -0
- package/src/lib/input/Input.vue +85 -0
- package/src/lib/input/index.ts +1 -0
- package/src/lib/input-group/InputGroup.vue +24 -0
- package/src/lib/input-group/InputGroupAddon.vue +25 -0
- package/src/lib/input-group/InputGroupInput.vue +38 -0
- package/src/lib/input-group/index.ts +3 -0
- package/src/lib/input-otp/InputOTP.vue +16 -0
- package/src/lib/input-otp/InputOTPGroup.vue +11 -0
- package/src/lib/input-otp/InputOTPSeparator.vue +8 -0
- package/src/lib/input-otp/InputOTPSlot.vue +20 -0
- package/src/lib/input-otp/index.ts +4 -0
- package/src/lib/kbd/Kbd.vue +11 -0
- package/src/lib/kbd/index.ts +1 -0
- package/src/lib/label/Label.test.ts +38 -0
- package/src/lib/label/Label.vue +20 -0
- package/src/lib/label/index.ts +1 -0
- package/src/lib/layout/AppFooter.vue +18 -0
- package/src/lib/layout/AppHeader.vue +22 -0
- package/src/lib/layout/AppLayout.vue +13 -0
- package/src/lib/layout/AppMain.vue +22 -0
- package/src/lib/layout/AppSidebar.vue +50 -0
- package/src/lib/menubar/Menubar.vue +21 -0
- package/src/lib/menubar/MenubarCheckboxItem.vue +45 -0
- package/src/lib/menubar/MenubarContent.vue +30 -0
- package/src/lib/menubar/MenubarGroup.vue +11 -0
- package/src/lib/menubar/MenubarItem.vue +24 -0
- package/src/lib/menubar/MenubarLabel.vue +16 -0
- package/src/lib/menubar/MenubarMenu.vue +11 -0
- package/src/lib/menubar/MenubarRadioGroup.vue +11 -0
- package/src/lib/menubar/MenubarRadioItem.vue +44 -0
- package/src/lib/menubar/MenubarSeparator.vue +14 -0
- package/src/lib/menubar/MenubarShortcut.vue +11 -0
- package/src/lib/menubar/MenubarSub.vue +11 -0
- package/src/lib/menubar/MenubarSubContent.vue +26 -0
- package/src/lib/menubar/MenubarSubTrigger.vue +36 -0
- package/src/lib/menubar/MenubarTrigger.vue +21 -0
- package/src/lib/menubar/index.ts +15 -0
- package/src/lib/modal/Modal.test.ts +81 -0
- package/src/lib/modal/Modal.vue +12 -0
- package/src/lib/modal/ModalClose.vue +9 -0
- package/src/lib/modal/ModalContent.vue +32 -0
- package/src/lib/modal/ModalTrigger.vue +11 -0
- package/src/lib/multi-select/MultiSelect.vue +186 -0
- package/src/lib/multi-select/MultiSelectItem.vue +47 -0
- package/src/lib/native-select/NativeSelect.vue +41 -0
- package/src/lib/native-select/index.ts +1 -0
- package/src/lib/navigation-menu/NavigationMenu.vue +23 -0
- package/src/lib/navigation-menu/NavigationMenuContent.vue +21 -0
- package/src/lib/navigation-menu/NavigationMenuIndicator.vue +21 -0
- package/src/lib/navigation-menu/NavigationMenuItem.vue +11 -0
- package/src/lib/navigation-menu/NavigationMenuLink.vue +23 -0
- package/src/lib/navigation-menu/NavigationMenuList.vue +21 -0
- package/src/lib/navigation-menu/NavigationMenuTrigger.vue +36 -0
- package/src/lib/navigation-menu/NavigationMenuViewport.vue +24 -0
- package/src/lib/navigation-menu/index.ts +8 -0
- package/src/lib/pagination/Pagination.vue +16 -0
- package/src/lib/pagination/PaginationContent.vue +16 -0
- package/src/lib/pagination/PaginationEllipsis.vue +27 -0
- package/src/lib/pagination/PaginationFirst.vue +25 -0
- package/src/lib/pagination/PaginationItem.vue +11 -0
- package/src/lib/pagination/PaginationLast.vue +25 -0
- package/src/lib/pagination/PaginationLink.vue +31 -0
- package/src/lib/pagination/PaginationNext.vue +24 -0
- package/src/lib/pagination/PaginationPrev.vue +24 -0
- package/src/lib/pagination/index.ts +9 -0
- package/src/lib/popover/Popover.test.ts +97 -0
- package/src/lib/popover/Popover.vue +11 -0
- package/src/lib/popover/PopoverContent.vue +31 -0
- package/src/lib/popover/PopoverTrigger.vue +11 -0
- package/src/lib/popover/index.ts +3 -0
- package/src/lib/progress/Progress.test.ts +59 -0
- package/src/lib/progress/Progress.vue +41 -0
- package/src/lib/progress/index.ts +1 -0
- package/src/lib/radio-group/RadioGroup.test.ts +45 -0
- package/src/lib/radio-group/RadioGroup.vue +16 -0
- package/src/lib/radio-group/RadioGroupItem.vue +35 -0
- package/src/lib/radio-group/index.ts +2 -0
- package/src/lib/resizable/ResizableHandle.vue +38 -0
- package/src/lib/resizable/ResizablePanel.vue +11 -0
- package/src/lib/resizable/ResizablePanelGroup.vue +16 -0
- package/src/lib/resizable/index.ts +3 -0
- package/src/lib/scroll-area/ScrollArea.vue +29 -0
- package/src/lib/scroll-area/ScrollBar.vue +26 -0
- package/src/lib/scroll-area/index.ts +2 -0
- package/src/lib/select/Select.vue +11 -0
- package/src/lib/select/SelectContent.vue +48 -0
- package/src/lib/select/SelectGroup.vue +11 -0
- package/src/lib/select/SelectItem.vue +41 -0
- package/src/lib/select/SelectLabel.vue +16 -0
- package/src/lib/select/SelectScrollDownButton.vue +29 -0
- package/src/lib/select/SelectScrollUpButton.vue +29 -0
- package/src/lib/select/SelectSeparator.vue +14 -0
- package/src/lib/select/SelectTrigger.vue +37 -0
- package/src/lib/select/SelectValue.vue +11 -0
- package/src/lib/select/index.ts +10 -0
- package/src/lib/separator/Separator.test.ts +47 -0
- package/src/lib/separator/Separator.vue +23 -0
- package/src/lib/separator/index.ts +1 -0
- package/src/lib/sheet/Sheet.test.ts +118 -0
- package/src/lib/sheet/Sheet.vue +11 -0
- package/src/lib/sheet/SheetClose.vue +11 -0
- package/src/lib/sheet/SheetContent.vue +68 -0
- package/src/lib/sheet/SheetDescription.vue +16 -0
- package/src/lib/sheet/SheetFooter.vue +15 -0
- package/src/lib/sheet/SheetHeader.vue +15 -0
- package/src/lib/sheet/SheetOverlay.vue +21 -0
- package/src/lib/sheet/SheetTitle.vue +16 -0
- package/src/lib/sheet/SheetTrigger.vue +11 -0
- package/src/lib/sheet/index.ts +9 -0
- package/src/lib/sidebar/Sidebar.vue +19 -0
- package/src/lib/sidebar/SidebarContent.vue +11 -0
- package/src/lib/sidebar/SidebarFooter.vue +11 -0
- package/src/lib/sidebar/SidebarGroup.vue +11 -0
- package/src/lib/sidebar/SidebarGroupLabel.vue +11 -0
- package/src/lib/sidebar/SidebarHeader.vue +11 -0
- package/src/lib/sidebar/SidebarInset.vue +11 -0
- package/src/lib/sidebar/SidebarMenu.vue +11 -0
- package/src/lib/sidebar/SidebarMenuButton.vue +20 -0
- package/src/lib/sidebar/SidebarMenuItem.vue +9 -0
- package/src/lib/sidebar/SidebarProvider.vue +23 -0
- package/src/lib/sidebar/SidebarSeparator.vue +9 -0
- package/src/lib/sidebar/SidebarTrigger.vue +24 -0
- package/src/lib/sidebar/context.ts +8 -0
- package/src/lib/sidebar/useSidebar.ts +10 -0
- package/src/lib/skeleton/Skeleton.test.ts +36 -0
- package/src/lib/skeleton/Skeleton.vue +9 -0
- package/src/lib/skeleton/index.ts +1 -0
- package/src/lib/slider/Slider.test.ts +63 -0
- package/src/lib/slider/Slider.vue +67 -0
- package/src/lib/slider/index.ts +1 -0
- package/src/lib/sonner/Toaster.vue +29 -0
- package/src/lib/spinner/Spinner.vue +34 -0
- package/src/lib/spinner/index.ts +1 -0
- package/src/lib/stats-card/StatsCard.vue +179 -0
- package/src/lib/stats-card/index.ts +2 -0
- package/src/lib/styles.ts +133 -0
- package/src/lib/switch/Switch.test.ts +52 -0
- package/src/lib/switch/Switch.vue +43 -0
- package/src/lib/table/Table.test.ts +150 -0
- package/src/lib/table/Table.vue +13 -0
- package/src/lib/table/TableBody.vue +11 -0
- package/src/lib/table/TableCaption.vue +11 -0
- package/src/lib/table/TableCell.vue +11 -0
- package/src/lib/table/TableFooter.vue +11 -0
- package/src/lib/table/TableHead.vue +11 -0
- package/src/lib/table/TableHeader.vue +11 -0
- package/src/lib/table/TableRow.vue +11 -0
- package/src/lib/table/index.ts +8 -0
- package/src/lib/tabs/Tabs.test.ts +150 -0
- package/src/lib/tabs/Tabs.vue +11 -0
- package/src/lib/tabs/TabsContent.vue +21 -0
- package/src/lib/tabs/TabsList.vue +21 -0
- package/src/lib/tabs/TabsTrigger.vue +21 -0
- package/src/lib/tabs/index.ts +4 -0
- package/src/lib/textarea/Textarea.test.ts +41 -0
- package/src/lib/textarea/Textarea.vue +36 -0
- package/src/lib/theme-selector/README.md +154 -0
- package/src/lib/theme-selector/ThemeSelector.vue +279 -0
- package/src/lib/theme-selector/index.ts +2 -0
- package/src/lib/time-picker/TimePicker.vue +162 -0
- package/src/lib/time-picker/TimePickerSegment.vue +176 -0
- package/src/lib/toast/Toast.test.ts +80 -0
- package/src/lib/toast/Toast.vue +56 -0
- package/src/lib/toast/ToastAction.vue +23 -0
- package/src/lib/toast/ToastClose.vue +38 -0
- package/src/lib/toast/ToastDescription.vue +12 -0
- package/src/lib/toast/ToastProvider.ts +65 -0
- package/src/lib/toast/ToastTitle.vue +12 -0
- package/src/lib/toast/ToastViewport.vue +18 -0
- package/src/lib/toast/Toaster.vue +50 -0
- package/src/lib/toast/index.ts +7 -0
- package/src/lib/toggle/Toggle.vue +21 -0
- package/src/lib/toggle/index.ts +2 -0
- package/src/lib/toggle/variants.test.ts +87 -0
- package/src/lib/toggle/variants.ts +21 -0
- package/src/lib/toggle-group/ToggleGroup.vue +24 -0
- package/src/lib/toggle-group/ToggleGroupItem.vue +33 -0
- package/src/lib/toggle-group/index.ts +2 -0
- package/src/lib/tooltip/Tooltip.test.ts +87 -0
- package/src/lib/tooltip/Tooltip.vue +11 -0
- package/src/lib/tooltip/TooltipContent.vue +30 -0
- package/src/lib/tooltip/TooltipProvider.vue +11 -0
- package/src/lib/tooltip/TooltipTrigger.vue +11 -0
- package/src/lib/tooltip/index.ts +4 -0
- package/src/lib/typography/TypographyBlockquote.vue +11 -0
- package/src/lib/typography/TypographyH1.vue +11 -0
- package/src/lib/typography/TypographyH2.vue +11 -0
- package/src/lib/typography/TypographyH3.vue +11 -0
- package/src/lib/typography/TypographyH4.vue +11 -0
- package/src/lib/typography/TypographyInlineCode.vue +11 -0
- package/src/lib/typography/TypographyLarge.vue +11 -0
- package/src/lib/typography/TypographyLead.vue +11 -0
- package/src/lib/typography/TypographyMuted.vue +11 -0
- package/src/lib/typography/TypographyP.vue +11 -0
- package/src/lib/typography/TypographySmall.vue +11 -0
- package/src/lib/typography/index.ts +11 -0
- package/src/lib/utils.test.ts +45 -0
- package/src/lib/utils.ts +14 -0
- package/src/lib/variants.ts +45 -0
- package/src/theme.css +203 -0
- package/src/vite-env.d.ts +6 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest'
|
|
2
|
+
import { mount } from '@vue/test-utils'
|
|
3
|
+
import Card from './Card.vue'
|
|
4
|
+
import CardHeader from './CardHeader.vue'
|
|
5
|
+
import CardTitle from './CardTitle.vue'
|
|
6
|
+
import CardDescription from './CardDescription.vue'
|
|
7
|
+
import CardContent from './CardContent.vue'
|
|
8
|
+
import CardFooter from './CardFooter.vue'
|
|
9
|
+
|
|
10
|
+
describe('Card', () => {
|
|
11
|
+
it('renders correctly', () => {
|
|
12
|
+
const wrapper = mount(Card)
|
|
13
|
+
expect(wrapper.exists()).toBe(true)
|
|
14
|
+
expect(wrapper.element.tagName).toBe('DIV')
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
it('renders slot content', () => {
|
|
18
|
+
const wrapper = mount(Card, {
|
|
19
|
+
slots: { default: '<p>Card body</p>' },
|
|
20
|
+
})
|
|
21
|
+
expect(wrapper.text()).toContain('Card body')
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
it('applies custom class', () => {
|
|
25
|
+
const wrapper = mount(Card, {
|
|
26
|
+
props: { class: 'my-custom-class' },
|
|
27
|
+
})
|
|
28
|
+
expect(wrapper.classes()).toContain('my-custom-class')
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
it('applies default elevation class', () => {
|
|
32
|
+
const wrapper = mount(Card)
|
|
33
|
+
expect(wrapper.classes().join(' ')).toContain('shadow-depth-1')
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
it('applies elevation 0 class', () => {
|
|
37
|
+
const wrapper = mount(Card, {
|
|
38
|
+
props: { elevation: 0 },
|
|
39
|
+
})
|
|
40
|
+
expect(wrapper.classes().join(' ')).toContain('shadow-none')
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
it('applies elevation 2 class', () => {
|
|
44
|
+
const wrapper = mount(Card, {
|
|
45
|
+
props: { elevation: 2 },
|
|
46
|
+
})
|
|
47
|
+
expect(wrapper.classes().join(' ')).toContain('shadow-depth-2')
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
it('applies elevation 3 class', () => {
|
|
51
|
+
const wrapper = mount(Card, {
|
|
52
|
+
props: { elevation: 3 },
|
|
53
|
+
})
|
|
54
|
+
expect(wrapper.classes().join(' ')).toContain('shadow-depth-3')
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
it('applies interactive classes when interactive is true', () => {
|
|
58
|
+
const wrapper = mount(Card, {
|
|
59
|
+
props: { interactive: true },
|
|
60
|
+
})
|
|
61
|
+
expect(wrapper.classes().join(' ')).toContain('cursor-pointer')
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
it('does not apply interactive classes by default', () => {
|
|
65
|
+
const wrapper = mount(Card)
|
|
66
|
+
expect(wrapper.classes().join(' ')).not.toContain('cursor-pointer')
|
|
67
|
+
})
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
describe('CardHeader', () => {
|
|
71
|
+
it('renders correctly', () => {
|
|
72
|
+
const wrapper = mount(CardHeader)
|
|
73
|
+
expect(wrapper.exists()).toBe(true)
|
|
74
|
+
expect(wrapper.element.tagName).toBe('DIV')
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
it('renders slot content', () => {
|
|
78
|
+
const wrapper = mount(CardHeader, {
|
|
79
|
+
slots: { default: '<span>Header content</span>' },
|
|
80
|
+
})
|
|
81
|
+
expect(wrapper.text()).toContain('Header content')
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
it('applies custom class', () => {
|
|
85
|
+
const wrapper = mount(CardHeader, {
|
|
86
|
+
props: { class: 'extra-header' },
|
|
87
|
+
})
|
|
88
|
+
expect(wrapper.classes()).toContain('extra-header')
|
|
89
|
+
})
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
describe('CardTitle', () => {
|
|
93
|
+
it('renders correctly', () => {
|
|
94
|
+
const wrapper = mount(CardTitle)
|
|
95
|
+
expect(wrapper.exists()).toBe(true)
|
|
96
|
+
expect(wrapper.element.tagName).toBe('DIV')
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
it('renders slot content', () => {
|
|
100
|
+
const wrapper = mount(CardTitle, {
|
|
101
|
+
slots: { default: 'My Title' },
|
|
102
|
+
})
|
|
103
|
+
expect(wrapper.text()).toContain('My Title')
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
it('applies custom class', () => {
|
|
107
|
+
const wrapper = mount(CardTitle, {
|
|
108
|
+
props: { class: 'title-class' },
|
|
109
|
+
})
|
|
110
|
+
expect(wrapper.classes()).toContain('title-class')
|
|
111
|
+
})
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
describe('CardDescription', () => {
|
|
115
|
+
it('renders correctly', () => {
|
|
116
|
+
const wrapper = mount(CardDescription)
|
|
117
|
+
expect(wrapper.exists()).toBe(true)
|
|
118
|
+
expect(wrapper.element.tagName).toBe('DIV')
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
it('renders slot content', () => {
|
|
122
|
+
const wrapper = mount(CardDescription, {
|
|
123
|
+
slots: { default: 'A description' },
|
|
124
|
+
})
|
|
125
|
+
expect(wrapper.text()).toContain('A description')
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
it('applies custom class', () => {
|
|
129
|
+
const wrapper = mount(CardDescription, {
|
|
130
|
+
props: { class: 'desc-class' },
|
|
131
|
+
})
|
|
132
|
+
expect(wrapper.classes()).toContain('desc-class')
|
|
133
|
+
})
|
|
134
|
+
})
|
|
135
|
+
|
|
136
|
+
describe('CardContent', () => {
|
|
137
|
+
it('renders correctly', () => {
|
|
138
|
+
const wrapper = mount(CardContent)
|
|
139
|
+
expect(wrapper.exists()).toBe(true)
|
|
140
|
+
expect(wrapper.element.tagName).toBe('DIV')
|
|
141
|
+
})
|
|
142
|
+
|
|
143
|
+
it('renders slot content', () => {
|
|
144
|
+
const wrapper = mount(CardContent, {
|
|
145
|
+
slots: { default: '<p>Content here</p>' },
|
|
146
|
+
})
|
|
147
|
+
expect(wrapper.text()).toContain('Content here')
|
|
148
|
+
})
|
|
149
|
+
|
|
150
|
+
it('applies custom class', () => {
|
|
151
|
+
const wrapper = mount(CardContent, {
|
|
152
|
+
props: { class: 'content-class' },
|
|
153
|
+
})
|
|
154
|
+
expect(wrapper.classes()).toContain('content-class')
|
|
155
|
+
})
|
|
156
|
+
})
|
|
157
|
+
|
|
158
|
+
describe('CardFooter', () => {
|
|
159
|
+
it('renders correctly', () => {
|
|
160
|
+
const wrapper = mount(CardFooter)
|
|
161
|
+
expect(wrapper.exists()).toBe(true)
|
|
162
|
+
expect(wrapper.element.tagName).toBe('DIV')
|
|
163
|
+
})
|
|
164
|
+
|
|
165
|
+
it('renders slot content', () => {
|
|
166
|
+
const wrapper = mount(CardFooter, {
|
|
167
|
+
slots: { default: '<button>Save</button>' },
|
|
168
|
+
})
|
|
169
|
+
expect(wrapper.text()).toContain('Save')
|
|
170
|
+
})
|
|
171
|
+
|
|
172
|
+
it('applies custom class', () => {
|
|
173
|
+
const wrapper = mount(CardFooter, {
|
|
174
|
+
props: { class: 'footer-class' },
|
|
175
|
+
})
|
|
176
|
+
expect(wrapper.classes()).toContain('footer-class')
|
|
177
|
+
})
|
|
178
|
+
})
|
|
179
|
+
|
|
180
|
+
describe('Card composed', () => {
|
|
181
|
+
it('renders a full card with all sub-components', () => {
|
|
182
|
+
const wrapper = mount(Card, {
|
|
183
|
+
slots: {
|
|
184
|
+
default: {
|
|
185
|
+
template: `
|
|
186
|
+
<CardHeader>
|
|
187
|
+
<CardTitle>Title</CardTitle>
|
|
188
|
+
<CardDescription>Description</CardDescription>
|
|
189
|
+
</CardHeader>
|
|
190
|
+
<CardContent>Body</CardContent>
|
|
191
|
+
<CardFooter>Footer</CardFooter>
|
|
192
|
+
`,
|
|
193
|
+
components: { CardHeader, CardTitle, CardDescription, CardContent, CardFooter },
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
})
|
|
197
|
+
expect(wrapper.text()).toContain('Title')
|
|
198
|
+
expect(wrapper.text()).toContain('Description')
|
|
199
|
+
expect(wrapper.text()).toContain('Body')
|
|
200
|
+
expect(wrapper.text()).toContain('Footer')
|
|
201
|
+
})
|
|
202
|
+
})
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { cn } from '@/lib/utils'
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
class?: string
|
|
6
|
+
elevation?: 0 | 1 | 2 | 3
|
|
7
|
+
interactive?: boolean
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
11
|
+
elevation: 1,
|
|
12
|
+
interactive: false,
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
const elevationClasses = {
|
|
16
|
+
0: 'shadow-none',
|
|
17
|
+
1: 'shadow-depth-1',
|
|
18
|
+
2: 'shadow-depth-2',
|
|
19
|
+
3: 'shadow-depth-3',
|
|
20
|
+
}
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<template>
|
|
24
|
+
<div
|
|
25
|
+
:class="
|
|
26
|
+
cn(
|
|
27
|
+
'rounded-lg border bg-card text-card-foreground',
|
|
28
|
+
elevationClasses[elevation],
|
|
29
|
+
interactive && 'transition-elevation hover:shadow-depth-2 cursor-pointer',
|
|
30
|
+
props.class
|
|
31
|
+
)
|
|
32
|
+
"
|
|
33
|
+
>
|
|
34
|
+
<slot />
|
|
35
|
+
</div>
|
|
36
|
+
</template>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { cn } from '@/lib/utils'
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
class?: string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const props = defineProps<Props>()
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<div :class="cn('p-6 pt-0', props.class)">
|
|
13
|
+
<slot />
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { cn } from '@/lib/utils'
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
class?: string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const props = defineProps<Props>()
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<div :class="cn('text-sm text-muted-foreground', props.class)">
|
|
13
|
+
<slot />
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { cn } from '@/lib/utils'
|
|
3
|
+
import Button from '../button/Button.vue'
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
class?: string
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const props = defineProps<Props>()
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<div :class="cn('flex items-center p-6 pt-0 gap-2', props.class)">
|
|
14
|
+
<slot />
|
|
15
|
+
</div>
|
|
16
|
+
</template>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { cn } from '@/lib/utils'
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
class?: string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const props = defineProps<Props>()
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<div :class="cn('flex flex-col gap-1.5 p-6', props.class)">
|
|
13
|
+
<slot />
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { cn } from '@/lib/utils'
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
class?: string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const props = defineProps<Props>()
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<div :class="cn('text-lg font-semibold leading-none tracking-tight', props.class)">
|
|
13
|
+
<slot />
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as Card } from './Card.vue'
|
|
2
|
+
export { default as CardHeader } from './CardHeader.vue'
|
|
3
|
+
export { default as CardTitle } from './CardTitle.vue'
|
|
4
|
+
export { default as CardDescription } from './CardDescription.vue'
|
|
5
|
+
export { default as CardContent } from './CardContent.vue'
|
|
6
|
+
export { default as CardFooter } from './CardFooter.vue'
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, ref, toRef } from 'vue'
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
import { useProvideCarousel, type CarouselApi } from './useCarousel'
|
|
5
|
+
|
|
6
|
+
const props = withDefaults(
|
|
7
|
+
defineProps<{
|
|
8
|
+
orientation?: 'horizontal' | 'vertical'
|
|
9
|
+
class?: string
|
|
10
|
+
}>(),
|
|
11
|
+
{
|
|
12
|
+
orientation: 'horizontal',
|
|
13
|
+
}
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
const containerRef = ref<HTMLElement>()
|
|
17
|
+
const canScrollPrev = ref(false)
|
|
18
|
+
const canScrollNext = ref(true)
|
|
19
|
+
|
|
20
|
+
function updateScrollState() {
|
|
21
|
+
const el = containerRef.value
|
|
22
|
+
if (!el) return
|
|
23
|
+
|
|
24
|
+
if (props.orientation === 'horizontal') {
|
|
25
|
+
canScrollPrev.value = el.scrollLeft > 0
|
|
26
|
+
canScrollNext.value = el.scrollLeft < el.scrollWidth - el.clientWidth - 1
|
|
27
|
+
} else {
|
|
28
|
+
canScrollPrev.value = el.scrollTop > 0
|
|
29
|
+
canScrollNext.value = el.scrollTop < el.scrollHeight - el.clientHeight - 1
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function scrollPrev() {
|
|
34
|
+
const el = containerRef.value
|
|
35
|
+
if (!el) return
|
|
36
|
+
|
|
37
|
+
if (props.orientation === 'horizontal') {
|
|
38
|
+
el.scrollBy({ left: -el.clientWidth, behavior: 'smooth' })
|
|
39
|
+
} else {
|
|
40
|
+
el.scrollBy({ top: -el.clientHeight, behavior: 'smooth' })
|
|
41
|
+
}
|
|
42
|
+
setTimeout(updateScrollState, 350)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function scrollNext() {
|
|
46
|
+
const el = containerRef.value
|
|
47
|
+
if (!el) return
|
|
48
|
+
|
|
49
|
+
if (props.orientation === 'horizontal') {
|
|
50
|
+
el.scrollBy({ left: el.clientWidth, behavior: 'smooth' })
|
|
51
|
+
} else {
|
|
52
|
+
el.scrollBy({ top: el.clientHeight, behavior: 'smooth' })
|
|
53
|
+
}
|
|
54
|
+
setTimeout(updateScrollState, 350)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const api: CarouselApi = {
|
|
58
|
+
canScrollPrev,
|
|
59
|
+
canScrollNext,
|
|
60
|
+
scrollPrev,
|
|
61
|
+
scrollNext,
|
|
62
|
+
orientation: toRef(props, 'orientation'),
|
|
63
|
+
containerRef,
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
useProvideCarousel(api)
|
|
67
|
+
</script>
|
|
68
|
+
|
|
69
|
+
<template>
|
|
70
|
+
<div :class="cn('relative', props.class)" role="region" aria-roledescription="carousel">
|
|
71
|
+
<slot />
|
|
72
|
+
</div>
|
|
73
|
+
</template>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { onMounted, onUnmounted } from 'vue'
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
import { useCarousel } from './useCarousel'
|
|
5
|
+
|
|
6
|
+
const props = defineProps<{ class?: string }>()
|
|
7
|
+
|
|
8
|
+
const { orientation, containerRef } = useCarousel()
|
|
9
|
+
|
|
10
|
+
function onScroll() {
|
|
11
|
+
const { canScrollPrev, canScrollNext } = useCarousel()
|
|
12
|
+
const el = containerRef.value
|
|
13
|
+
if (!el) return
|
|
14
|
+
|
|
15
|
+
if (orientation.value === 'horizontal') {
|
|
16
|
+
canScrollPrev.value = el.scrollLeft > 0
|
|
17
|
+
canScrollNext.value = el.scrollLeft < el.scrollWidth - el.clientWidth - 1
|
|
18
|
+
} else {
|
|
19
|
+
canScrollPrev.value = el.scrollTop > 0
|
|
20
|
+
canScrollNext.value = el.scrollTop < el.scrollHeight - el.clientHeight - 1
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
onMounted(() => {
|
|
25
|
+
containerRef.value?.addEventListener('scroll', onScroll, { passive: true })
|
|
26
|
+
onScroll()
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
onUnmounted(() => {
|
|
30
|
+
containerRef.value?.removeEventListener('scroll', onScroll)
|
|
31
|
+
})
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<template>
|
|
35
|
+
<div class="overflow-hidden">
|
|
36
|
+
<div
|
|
37
|
+
:ref="(el: any) => { containerRef = el }"
|
|
38
|
+
:class="
|
|
39
|
+
cn(
|
|
40
|
+
'flex',
|
|
41
|
+
orientation === 'vertical' && '-mt-4 flex-col',
|
|
42
|
+
orientation !== 'vertical' && '-ml-4',
|
|
43
|
+
props.class
|
|
44
|
+
)
|
|
45
|
+
"
|
|
46
|
+
:style="{
|
|
47
|
+
scrollSnapType: orientation === 'vertical' ? 'y mandatory' : 'x mandatory',
|
|
48
|
+
overflow: 'auto',
|
|
49
|
+
scrollbarWidth: 'none',
|
|
50
|
+
}"
|
|
51
|
+
>
|
|
52
|
+
<slot />
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
</template>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { cn } from '@/lib/utils'
|
|
3
|
+
import { useCarousel } from './useCarousel'
|
|
4
|
+
|
|
5
|
+
const props = defineProps<{ class?: string }>()
|
|
6
|
+
|
|
7
|
+
const { orientation } = useCarousel()
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<div
|
|
12
|
+
role="group"
|
|
13
|
+
aria-roledescription="slide"
|
|
14
|
+
:class="
|
|
15
|
+
cn(
|
|
16
|
+
'min-w-0 shrink-0 grow-0 basis-full',
|
|
17
|
+
orientation === 'vertical' ? 'pt-4' : 'pl-4',
|
|
18
|
+
props.class
|
|
19
|
+
)
|
|
20
|
+
"
|
|
21
|
+
style="scroll-snap-align: start"
|
|
22
|
+
>
|
|
23
|
+
<slot />
|
|
24
|
+
</div>
|
|
25
|
+
</template>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { cn } from '@/lib/utils'
|
|
3
|
+
import { useCarousel } from './useCarousel'
|
|
4
|
+
|
|
5
|
+
const props = defineProps<{ class?: string }>()
|
|
6
|
+
|
|
7
|
+
const { orientation, scrollNext, canScrollNext } = useCarousel()
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<button
|
|
12
|
+
:disabled="!canScrollNext"
|
|
13
|
+
:class="
|
|
14
|
+
cn(
|
|
15
|
+
'absolute h-8 w-8 rounded-full inline-flex items-center justify-center border bg-background shadow-depth-1 hover:shadow-depth-2 transition-elevation disabled:opacity-50',
|
|
16
|
+
orientation === 'vertical'
|
|
17
|
+
? '-bottom-12 left-1/2 -translate-x-1/2 rotate-90'
|
|
18
|
+
: '-right-12 top-1/2 -translate-y-1/2',
|
|
19
|
+
props.class
|
|
20
|
+
)
|
|
21
|
+
"
|
|
22
|
+
@click="scrollNext"
|
|
23
|
+
>
|
|
24
|
+
<svg
|
|
25
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
26
|
+
width="24"
|
|
27
|
+
height="24"
|
|
28
|
+
viewBox="0 0 24 24"
|
|
29
|
+
fill="none"
|
|
30
|
+
stroke="currentColor"
|
|
31
|
+
stroke-width="2"
|
|
32
|
+
stroke-linecap="round"
|
|
33
|
+
stroke-linejoin="round"
|
|
34
|
+
class="h-4 w-4"
|
|
35
|
+
>
|
|
36
|
+
<path d="m9 18 6-6-6-6" />
|
|
37
|
+
</svg>
|
|
38
|
+
<span class="sr-only">Next slide</span>
|
|
39
|
+
</button>
|
|
40
|
+
</template>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { cn } from '@/lib/utils'
|
|
3
|
+
import { useCarousel } from './useCarousel'
|
|
4
|
+
|
|
5
|
+
const props = defineProps<{ class?: string }>()
|
|
6
|
+
|
|
7
|
+
const { orientation, scrollPrev, canScrollPrev } = useCarousel()
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<button
|
|
12
|
+
:disabled="!canScrollPrev"
|
|
13
|
+
:class="
|
|
14
|
+
cn(
|
|
15
|
+
'absolute h-8 w-8 rounded-full inline-flex items-center justify-center border bg-background shadow-depth-1 hover:shadow-depth-2 transition-elevation disabled:opacity-50',
|
|
16
|
+
orientation === 'vertical'
|
|
17
|
+
? '-top-12 left-1/2 -translate-x-1/2 rotate-90'
|
|
18
|
+
: '-left-12 top-1/2 -translate-y-1/2',
|
|
19
|
+
props.class
|
|
20
|
+
)
|
|
21
|
+
"
|
|
22
|
+
@click="scrollPrev"
|
|
23
|
+
>
|
|
24
|
+
<svg
|
|
25
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
26
|
+
width="24"
|
|
27
|
+
height="24"
|
|
28
|
+
viewBox="0 0 24 24"
|
|
29
|
+
fill="none"
|
|
30
|
+
stroke="currentColor"
|
|
31
|
+
stroke-width="2"
|
|
32
|
+
stroke-linecap="round"
|
|
33
|
+
stroke-linejoin="round"
|
|
34
|
+
class="h-4 w-4"
|
|
35
|
+
>
|
|
36
|
+
<path d="m15 18-6-6 6-6" />
|
|
37
|
+
</svg>
|
|
38
|
+
<span class="sr-only">Previous slide</span>
|
|
39
|
+
</button>
|
|
40
|
+
</template>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as Carousel } from './Carousel.vue'
|
|
2
|
+
export { default as CarouselContent } from './CarouselContent.vue'
|
|
3
|
+
export { default as CarouselItem } from './CarouselItem.vue'
|
|
4
|
+
export { default as CarouselPrevious } from './CarouselPrevious.vue'
|
|
5
|
+
export { default as CarouselNext } from './CarouselNext.vue'
|
|
6
|
+
export { useCarousel } from './useCarousel'
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type InjectionKey, type Ref, inject, provide } from 'vue'
|
|
2
|
+
|
|
3
|
+
export interface CarouselApi {
|
|
4
|
+
canScrollPrev: Ref<boolean>
|
|
5
|
+
canScrollNext: Ref<boolean>
|
|
6
|
+
scrollPrev: () => void
|
|
7
|
+
scrollNext: () => void
|
|
8
|
+
orientation: Ref<'horizontal' | 'vertical'>
|
|
9
|
+
containerRef: Ref<HTMLElement | undefined>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const CAROUSEL_KEY: InjectionKey<CarouselApi> = Symbol('carousel')
|
|
13
|
+
|
|
14
|
+
export function useCarousel() {
|
|
15
|
+
const context = inject(CAROUSEL_KEY)
|
|
16
|
+
if (!context) {
|
|
17
|
+
throw new Error('useCarousel must be used within a <Carousel /> component')
|
|
18
|
+
}
|
|
19
|
+
return context
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function useProvideCarousel(api: CarouselApi) {
|
|
23
|
+
provide(CAROUSEL_KEY, api)
|
|
24
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest'
|
|
2
|
+
import { mount } from '@vue/test-utils'
|
|
3
|
+
import Checkbox from './Checkbox.vue'
|
|
4
|
+
|
|
5
|
+
describe('Checkbox', () => {
|
|
6
|
+
it('renders correctly', () => {
|
|
7
|
+
const wrapper = mount(Checkbox)
|
|
8
|
+
expect(wrapper.exists()).toBe(true)
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
it('passes checked prop to radix CheckboxRoot', () => {
|
|
12
|
+
const wrapper = mount(Checkbox, {
|
|
13
|
+
attrs: { checked: true },
|
|
14
|
+
})
|
|
15
|
+
expect(wrapper.exists()).toBe(true)
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
it('passes disabled attribute', () => {
|
|
19
|
+
const wrapper = mount(Checkbox, {
|
|
20
|
+
attrs: { disabled: true },
|
|
21
|
+
})
|
|
22
|
+
expect(wrapper.exists()).toBe(true)
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
it('has correct data-state when checked', () => {
|
|
26
|
+
const wrapper = mount(Checkbox, {
|
|
27
|
+
attrs: { checked: true },
|
|
28
|
+
})
|
|
29
|
+
expect(wrapper.html()).toContain('data-state="checked"')
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
it('has correct data-state when unchecked', () => {
|
|
33
|
+
const wrapper = mount(Checkbox, {
|
|
34
|
+
attrs: { checked: false },
|
|
35
|
+
})
|
|
36
|
+
expect(wrapper.html()).toContain('data-state="unchecked"')
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
it('applies custom class', () => {
|
|
40
|
+
const wrapper = mount(Checkbox, {
|
|
41
|
+
props: { class: 'custom-class' },
|
|
42
|
+
})
|
|
43
|
+
expect(wrapper.html()).toContain('custom-class')
|
|
44
|
+
})
|
|
45
|
+
})
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
defineOptions({ inheritAttrs: false })
|
|
3
|
+
import {
|
|
4
|
+
CheckboxIndicator,
|
|
5
|
+
CheckboxRoot,
|
|
6
|
+
} from 'radix-vue'
|
|
7
|
+
import { cn } from '@/lib/utils'
|
|
8
|
+
|
|
9
|
+
const props = defineProps<{ class?: string }>()
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<CheckboxRoot
|
|
14
|
+
v-bind="$attrs"
|
|
15
|
+
:class="
|
|
16
|
+
cn(
|
|
17
|
+
'peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow-depth-1 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground',
|
|
18
|
+
props.class
|
|
19
|
+
)
|
|
20
|
+
"
|
|
21
|
+
>
|
|
22
|
+
<CheckboxIndicator class="flex items-center justify-center text-current">
|
|
23
|
+
<svg
|
|
24
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
25
|
+
width="24"
|
|
26
|
+
height="24"
|
|
27
|
+
viewBox="0 0 24 24"
|
|
28
|
+
fill="none"
|
|
29
|
+
stroke="currentColor"
|
|
30
|
+
stroke-width="2"
|
|
31
|
+
stroke-linecap="round"
|
|
32
|
+
stroke-linejoin="round"
|
|
33
|
+
class="h-4 w-4"
|
|
34
|
+
>
|
|
35
|
+
<path d="M20 6 9 17l-5-5" />
|
|
36
|
+
</svg>
|
|
37
|
+
</CheckboxIndicator>
|
|
38
|
+
</CheckboxRoot>
|
|
39
|
+
</template>
|