@bl33dz/fa814698dcde12f86a37ac31dd3aedf9 1.0.6 → 1.0.7
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/README.md +80 -95
- package/dist/fa814698dcde12f86a37ac31dd3aedf9.css +1 -1
- package/dist/perisai-ui.es.js +97 -94
- package/dist/perisai-ui.umd.js +1 -1
- package/package.json +45 -45
- package/src/globals.css +575 -575
- package/src/index.ts +178 -177
- package/src/lib/utils.ts +6 -6
- package/src/shadcn/accordion/Accordion.vue +19 -19
- package/src/shadcn/accordion/AccordionContent.vue +23 -23
- package/src/shadcn/accordion/AccordionItem.vue +23 -23
- package/src/shadcn/accordion/AccordionTrigger.vue +38 -38
- package/src/shadcn/accordion/index.ts +4 -4
- package/src/shadcn/avatar/Avatar.vue +18 -18
- package/src/shadcn/avatar/AvatarFallback.vue +21 -21
- package/src/shadcn/avatar/AvatarImage.vue +16 -16
- package/src/shadcn/avatar/index.ts +3 -3
- package/src/shadcn/breadcrumb/Breadcrumb.vue +8 -8
- package/src/shadcn/breadcrumb/BreadcrumbEllipsis.vue +9 -9
- package/src/shadcn/breadcrumb/BreadcrumbItem.vue +8 -8
- package/src/shadcn/breadcrumb/BreadcrumbLink.vue +8 -8
- package/src/shadcn/breadcrumb/BreadcrumbList.vue +8 -8
- package/src/shadcn/breadcrumb/BreadcrumbPage.vue +8 -8
- package/src/shadcn/breadcrumb/BreadcrumbSeparator.vue +8 -8
- package/src/shadcn/breadcrumb/index.ts +7 -7
- package/src/shadcn/button/Button.vue +29 -29
- package/src/shadcn/button/index.ts +38 -38
- package/src/shadcn/calendar/Calendar.vue +64 -64
- package/src/shadcn/calendar/CalendarCell.vue +23 -23
- package/src/shadcn/calendar/CalendarCellTrigger.vue +39 -39
- package/src/shadcn/calendar/CalendarGrid.vue +23 -23
- package/src/shadcn/calendar/CalendarGridBody.vue +15 -15
- package/src/shadcn/calendar/CalendarGridHead.vue +16 -16
- package/src/shadcn/calendar/CalendarGridRow.vue +22 -22
- package/src/shadcn/calendar/CalendarHeadCell.vue +23 -23
- package/src/shadcn/calendar/CalendarHeader.vue +23 -23
- package/src/shadcn/calendar/CalendarHeading.vue +30 -30
- package/src/shadcn/calendar/CalendarNextButton.vue +32 -32
- package/src/shadcn/calendar/CalendarPrevButton.vue +32 -32
- package/src/shadcn/calendar/index.ts +12 -12
- package/src/shadcn/card/Card.vue +8 -8
- package/src/shadcn/card/CardContent.vue +8 -8
- package/src/shadcn/card/CardDescription.vue +8 -8
- package/src/shadcn/card/CardHeader.vue +8 -8
- package/src/shadcn/card/CardTitle.vue +8 -8
- package/src/shadcn/card/index.ts +5 -5
- package/src/shadcn/checkbox/Checkbox.vue +38 -38
- package/src/shadcn/checkbox/index.ts +1 -1
- package/src/shadcn/command/Command.vue +87 -87
- package/src/shadcn/command/CommandDialog.vue +31 -31
- package/src/shadcn/command/CommandEmpty.vue +27 -27
- package/src/shadcn/command/CommandGroup.vue +45 -45
- package/src/shadcn/command/CommandInput.vue +39 -39
- package/src/shadcn/command/CommandItem.vue +76 -76
- package/src/shadcn/command/CommandList.vue +25 -25
- package/src/shadcn/command/CommandSeparator.vue +21 -21
- package/src/shadcn/command/CommandShortcut.vue +17 -17
- package/src/shadcn/command/index.ts +25 -25
- package/src/shadcn/context-menu/ContextMenu.vue +18 -18
- package/src/shadcn/context-menu/ContextMenuCheckboxItem.vue +38 -38
- package/src/shadcn/context-menu/ContextMenuContent.vue +34 -34
- package/src/shadcn/context-menu/ContextMenuGroup.vue +15 -15
- package/src/shadcn/context-menu/ContextMenuItem.vue +39 -39
- package/src/shadcn/context-menu/ContextMenuLabel.vue +22 -22
- package/src/shadcn/context-menu/ContextMenuPortal.vue +15 -15
- package/src/shadcn/context-menu/ContextMenuRadioGroup.vue +22 -22
- package/src/shadcn/context-menu/ContextMenuRadioItem.vue +38 -38
- package/src/shadcn/context-menu/ContextMenuSeparator.vue +22 -22
- package/src/shadcn/context-menu/ContextMenuShortcut.vue +17 -17
- package/src/shadcn/context-menu/ContextMenuSub.vue +22 -22
- package/src/shadcn/context-menu/ContextMenuSubContent.vue +33 -33
- package/src/shadcn/context-menu/ContextMenuSubTrigger.vue +33 -33
- package/src/shadcn/context-menu/ContextMenuTrigger.vue +17 -17
- package/src/shadcn/context-menu/index.ts +15 -15
- package/src/shadcn/dialog/Dialog.vue +18 -18
- package/src/shadcn/dialog/DialogClose.vue +15 -15
- package/src/shadcn/dialog/DialogContent.vue +46 -46
- package/src/shadcn/dialog/DialogDescription.vue +23 -23
- package/src/shadcn/dialog/DialogFooter.vue +15 -15
- package/src/shadcn/dialog/DialogHeader.vue +17 -17
- package/src/shadcn/dialog/DialogOverlay.vue +21 -21
- package/src/shadcn/dialog/DialogScrollContent.vue +56 -56
- package/src/shadcn/dialog/DialogTitle.vue +23 -23
- package/src/shadcn/dialog/DialogTrigger.vue +15 -15
- package/src/shadcn/dialog/index.ts +10 -10
- package/src/shadcn/dropdown-menu/DropdownMenu.vue +18 -18
- package/src/shadcn/dropdown-menu/DropdownMenuCheckboxItem.vue +38 -38
- package/src/shadcn/dropdown-menu/DropdownMenuContent.vue +36 -36
- package/src/shadcn/dropdown-menu/DropdownMenuGroup.vue +15 -15
- package/src/shadcn/dropdown-menu/DropdownMenuItem.vue +31 -31
- package/src/shadcn/dropdown-menu/DropdownMenuLabel.vue +23 -23
- package/src/shadcn/dropdown-menu/DropdownMenuRadioGroup.vue +22 -22
- package/src/shadcn/dropdown-menu/DropdownMenuRadioItem.vue +39 -39
- package/src/shadcn/dropdown-menu/DropdownMenuSeparator.vue +24 -24
- package/src/shadcn/dropdown-menu/DropdownMenuShortcut.vue +17 -17
- package/src/shadcn/dropdown-menu/DropdownMenuSub.vue +19 -19
- package/src/shadcn/dropdown-menu/DropdownMenuSubContent.vue +28 -28
- package/src/shadcn/dropdown-menu/DropdownMenuSubTrigger.vue +31 -31
- package/src/shadcn/dropdown-menu/DropdownMenuTrigger.vue +17 -17
- package/src/shadcn/dropdown-menu/index.ts +16 -16
- package/src/shadcn/menubar/Menubar.vue +33 -33
- package/src/shadcn/menubar/MenubarCheckboxItem.vue +38 -38
- package/src/shadcn/menubar/MenubarContent.vue +42 -42
- package/src/shadcn/menubar/MenubarGroup.vue +15 -15
- package/src/shadcn/menubar/MenubarItem.vue +37 -37
- package/src/shadcn/menubar/MenubarLabel.vue +20 -20
- package/src/shadcn/menubar/MenubarMenu.vue +15 -15
- package/src/shadcn/menubar/MenubarPortal.vue +5 -5
- package/src/shadcn/menubar/MenubarRadioGroup.vue +22 -22
- package/src/shadcn/menubar/MenubarRadioItem.vue +38 -38
- package/src/shadcn/menubar/MenubarSeparator.vue +21 -21
- package/src/shadcn/menubar/MenubarShortcut.vue +17 -17
- package/src/shadcn/menubar/MenubarSub.vue +23 -23
- package/src/shadcn/menubar/MenubarSubContent.vue +36 -36
- package/src/shadcn/menubar/MenubarSubTrigger.vue +28 -28
- package/src/shadcn/menubar/MenubarTrigger.vue +28 -28
- package/src/shadcn/menubar/index.ts +15 -15
- package/src/shadcn/navigation-menu/NavigationMenu.vue +35 -35
- package/src/shadcn/navigation-menu/NavigationMenuContent.vue +31 -31
- package/src/shadcn/navigation-menu/NavigationMenuIndicator.vue +23 -23
- package/src/shadcn/navigation-menu/NavigationMenuItem.vue +21 -21
- package/src/shadcn/navigation-menu/NavigationMenuLink.vue +26 -26
- package/src/shadcn/navigation-menu/NavigationMenuList.vue +28 -28
- package/src/shadcn/navigation-menu/NavigationMenuTrigger.vue +24 -24
- package/src/shadcn/navigation-menu/NavigationMenuViewport.vue +31 -31
- package/src/shadcn/navigation-menu/index.ts +14 -14
- package/src/shadcn/pagination/Pagination.vue +151 -151
- package/src/shadcn/pagination/PaginationContent.vue +22 -22
- package/src/shadcn/pagination/PaginationEllipsis.vue +25 -25
- package/src/shadcn/pagination/PaginationFirst.vue +33 -33
- package/src/shadcn/pagination/PaginationItem.vue +31 -31
- package/src/shadcn/pagination/PaginationLast.vue +33 -33
- package/src/shadcn/pagination/PaginationLink.vue +13 -13
- package/src/shadcn/pagination/PaginationNext.vue +22 -22
- package/src/shadcn/pagination/PaginationPrevious.vue +33 -33
- package/src/shadcn/pagination/index.ts +9 -9
- package/src/shadcn/popover/Popover.vue +18 -18
- package/src/shadcn/popover/PopoverAnchor.vue +15 -15
- package/src/shadcn/popover/PopoverContent.vue +46 -46
- package/src/shadcn/popover/PopoverTrigger.vue +15 -15
- package/src/shadcn/popover/index.ts +4 -4
- package/src/shadcn/radio-group/RadioGroup.vue +24 -24
- package/src/shadcn/radio-group/RadioGroupItem.vue +39 -39
- package/src/shadcn/radio-group/index.ts +2 -2
- package/src/shadcn/range-calendar/RangeCalendar.vue +71 -71
- package/src/shadcn/range-calendar/RangeCalendarCell.vue +23 -23
- package/src/shadcn/range-calendar/RangeCalendarCellTrigger.vue +41 -41
- package/src/shadcn/range-calendar/RangeCalendarGrid.vue +23 -23
- package/src/shadcn/range-calendar/RangeCalendarGridBody.vue +15 -15
- package/src/shadcn/range-calendar/RangeCalendarGridHead.vue +15 -15
- package/src/shadcn/range-calendar/RangeCalendarGridRow.vue +22 -22
- package/src/shadcn/range-calendar/RangeCalendarHeadCell.vue +23 -23
- package/src/shadcn/range-calendar/RangeCalendarHeader.vue +23 -23
- package/src/shadcn/range-calendar/RangeCalendarHeading.vue +30 -30
- package/src/shadcn/range-calendar/RangeCalendarNextButton.vue +32 -32
- package/src/shadcn/range-calendar/RangeCalendarPrevButton.vue +32 -32
- package/src/shadcn/range-calendar/index.ts +12 -12
- package/src/shadcn/select/Select.vue +18 -18
- package/src/shadcn/select/SelectContent.vue +52 -52
- package/src/shadcn/select/SelectGroup.vue +15 -15
- package/src/shadcn/select/SelectItem.vue +43 -43
- package/src/shadcn/select/SelectItemText.vue +15 -15
- package/src/shadcn/select/SelectLabel.vue +17 -17
- package/src/shadcn/select/SelectScrollDownButton.vue +26 -26
- package/src/shadcn/select/SelectScrollUpButton.vue +26 -26
- package/src/shadcn/select/SelectSeparator.vue +19 -19
- package/src/shadcn/select/SelectTrigger.vue +33 -33
- package/src/shadcn/select/SelectValue.vue +15 -15
- package/src/shadcn/select/index.ts +11 -11
- package/src/shadcn/separator/Separator.vue +31 -31
- package/src/shadcn/separator/index.ts +1 -1
- package/src/shadcn/sidebar/MenuGroup.vue +28 -28
- package/src/shadcn/sidebar/MenuItemRenderer.vue +23 -23
- package/src/shadcn/sidebar/Sidebar.vue +14 -14
- package/src/shadcn/sidebar/SidebarDemoContent.vue +26 -26
- package/src/shadcn/sidebar/SidebarMenuGroupWithLabel.vue +29 -29
- package/src/shadcn/sidebar/SidebarMenuItemWithIcon.vue +103 -103
- package/src/shadcn/sidebar/SidebarMenuSub.vue +10 -10
- package/src/shadcn/sidebar/SidebarMenuSubItemStyled.vue +38 -38
- package/src/shadcn/sidebar/SidebarTrigger.vue +8 -8
- package/src/shadcn/sidebar/index.ts +5 -5
- package/src/shadcn/slider/Slider.vue +43 -43
- package/src/shadcn/slider/index.ts +1 -1
- package/src/shadcn/sonner/Sonner.vue +19 -19
- package/src/shadcn/sonner/index.ts +1 -1
- package/src/shadcn/spinner/Spinner.vue +17 -17
- package/src/shadcn/spinner/index.ts +1 -1
- package/src/shadcn/switch/Switch.vue +38 -38
- package/src/shadcn/switch/index.ts +1 -1
- package/src/shadcn/tabs/CardTabsContent.vue +16 -16
- package/src/shadcn/tabs/CornerCutTabsTrigger.vue +102 -102
- package/src/shadcn/tabs/GridTabsList.vue +30 -30
- package/src/shadcn/tabs/ScrollableTabsList.vue +8 -8
- package/src/shadcn/tabs/Tabs.vue +23 -23
- package/src/shadcn/tabs/TabsContent.vue +21 -21
- package/src/shadcn/tabs/TabsList.vue +24 -24
- package/src/shadcn/tabs/TabsTrigger.vue +30 -30
- package/src/shadcn/tabs/VerticalTabsList.vue +28 -28
- package/src/shadcn/tabs/VerticalTabsTrigger.vue +16 -16
- package/src/shadcn/tabs/index.ts +10 -10
- package/src/shadcn/toggle/Toggle.vue +35 -35
- package/src/shadcn/toggle/index.ts +28 -28
- package/src/shadcn/tooltip/Tooltip.vue +18 -18
- package/src/shadcn/tooltip/TooltipContent.vue +34 -34
- package/src/shadcn/tooltip/TooltipProvider.vue +14 -14
- package/src/shadcn/tooltip/TooltipTrigger.vue +15 -15
- package/src/shadcn/tooltip/index.ts +4 -4
- package/src/shadcn/tree/index.ts +2 -0
- package/src/ui/InputOTP.vue +69 -69
- package/src/ui/InputOTPContext.ts +9 -9
- package/src/ui/InputOTPGroup.vue +7 -7
- package/src/ui/InputOTPSeparator.vue +8 -8
- package/src/ui/InputOTPSlot.vue +61 -61
- package/src/ui/PopoverContent.vue +27 -27
- package/src/ui/PopoverTrigger.vue +9 -9
- package/src/ui/SelectContent.vue +23 -23
- package/src/ui/SelectGroup.vue +12 -12
- package/src/ui/SelectItem.vue +25 -25
- package/src/ui/SelectLabel.vue +16 -16
- package/src/ui/SelectSeparator.vue +17 -17
- package/src/ui/SelectTrigger.vue +22 -22
- package/src/ui/SelectValue.vue +9 -9
- package/src/ui/SheetContent.vue +34 -34
- package/src/ui/SheetDescription.vue +9 -9
- package/src/ui/SheetHeader.vue +11 -11
- package/src/ui/SheetTitle.vue +9 -9
- package/src/ui/accordion-content.vue +21 -21
- package/src/ui/accordion-item.vue +18 -18
- package/src/ui/accordion-trigger.vue +14 -14
- package/src/ui/accordion.vue +9 -9
- package/src/ui/alert-actions.vue +13 -13
- package/src/ui/alert-description.vue +13 -13
- package/src/ui/alert-title.vue +13 -13
- package/src/ui/alert.vue +63 -63
- package/src/ui/avatar-fallback.vue +38 -38
- package/src/ui/avatar-group.vue +32 -32
- package/src/ui/avatar-image.vue +19 -19
- package/src/ui/avatar.vue +32 -32
- package/src/ui/badge.vue +90 -90
- package/src/ui/breadcrumb-item.vue +11 -11
- package/src/ui/breadcrumb-separator.vue +9 -9
- package/src/ui/breadcrumb.vue +11 -11
- package/src/ui/button.vue +76 -76
- package/src/ui/card-content.vue +16 -16
- package/src/ui/card-description.vue +16 -16
- package/src/ui/card-footer.vue +13 -13
- package/src/ui/card-header.vue +19 -19
- package/src/ui/card-title.vue +16 -16
- package/src/ui/card.vue +73 -73
- package/src/ui/category-breakdown-metric.vue +205 -205
- package/src/ui/checkbox.vue +84 -84
- package/src/ui/cn.ts +6 -6
- package/src/ui/dialog-body.vue +13 -13
- package/src/ui/dialog-close.vue +9 -9
- package/src/ui/dialog-content.vue +36 -36
- package/src/ui/dialog-description.vue +13 -13
- package/src/ui/dialog-footer.vue +13 -13
- package/src/ui/dialog-header.vue +13 -13
- package/src/ui/dialog-overlay.vue +14 -14
- package/src/ui/dialog-portal.vue +9 -9
- package/src/ui/dialog-title.vue +13 -13
- package/src/ui/dialog-trigger.vue +9 -9
- package/src/ui/dialog.vue +9 -9
- package/src/ui/dismissible-badges-demo.vue +94 -94
- package/src/ui/drawer-content.vue +53 -53
- package/src/ui/drawer-description.vue +23 -23
- package/src/ui/drawer-footer.vue +22 -22
- package/src/ui/drawer-header.vue +22 -22
- package/src/ui/drawer-title.vue +23 -23
- package/src/ui/drawer-trigger.vue +23 -23
- package/src/ui/drawer.vue +34 -34
- package/src/ui/dropdown-menu-checkbox-item.vue +27 -27
- package/src/ui/dropdown-menu-content.vue +23 -23
- package/src/ui/dropdown-menu-group.vue +7 -7
- package/src/ui/dropdown-menu-item.vue +19 -19
- package/src/ui/dropdown-menu-label.vue +17 -17
- package/src/ui/dropdown-menu-portal.vue +8 -8
- package/src/ui/dropdown-menu-radio-group.vue +14 -14
- package/src/ui/dropdown-menu-radio-item.vue +30 -30
- package/src/ui/dropdown-menu-separator.vue +13 -13
- package/src/ui/dropdown-menu-shortcut.vue +15 -15
- package/src/ui/dropdown-menu-sub-content.vue +8 -8
- package/src/ui/dropdown-menu-sub-trigger.vue +8 -8
- package/src/ui/dropdown-menu-sub.vue +8 -8
- package/src/ui/dropdown-menu-trigger.vue +8 -8
- package/src/ui/dropdown-menu.vue +9 -9
- package/src/ui/grouped-avatar.vue +19 -19
- package/src/ui/icons/Accessibility.vue +7 -7
- package/src/ui/icons/AlignLeft.vue +6 -6
- package/src/ui/icons/ArrowDown.vue +7 -7
- package/src/ui/icons/ArrowUp.vue +7 -7
- package/src/ui/icons/ArrowUpDown.vue +8 -8
- package/src/ui/icons/BookOpen.vue +6 -6
- package/src/ui/icons/Calendar.vue +9 -9
- package/src/ui/icons/Check.vue +6 -6
- package/src/ui/icons/ChevronRight.vue +6 -6
- package/src/ui/icons/Circle.vue +6 -6
- package/src/ui/icons/Copy.vue +7 -7
- package/src/ui/icons/Dot.vue +6 -6
- package/src/ui/icons/Edit.vue +6 -6
- package/src/ui/icons/FileText.vue +9 -9
- package/src/ui/icons/Folder.vue +6 -6
- package/src/ui/icons/FolderOpen.vue +7 -7
- package/src/ui/icons/Hash.vue +6 -6
- package/src/ui/icons/Home.vue +6 -6
- package/src/ui/icons/Minus.vue +6 -6
- package/src/ui/icons/MoreHorizontal.vue +8 -8
- package/src/ui/icons/Settings.vue +7 -7
- package/src/ui/icons/Slash.vue +6 -6
- package/src/ui/icons/Trash2.vue +6 -6
- package/src/ui/icons/Type.vue +6 -6
- package/src/ui/icons/User.vue +7 -7
- package/src/ui/input-otp.vue +52 -52
- package/src/ui/input.vue +98 -98
- package/src/ui/label.vue +19 -19
- package/src/ui/pagination.vue +41 -41
- package/src/ui/popover.vue +9 -9
- package/src/ui/progress.vue +67 -67
- package/src/ui/radio-group-item.vue +53 -53
- package/src/ui/radio-group.vue +27 -27
- package/src/ui/scrollable-tabs-list.vue +148 -148
- package/src/ui/select-multiple.vue +135 -135
- package/src/ui/select.vue +77 -77
- package/src/ui/separator.vue +60 -60
- package/src/ui/sheet.vue +50 -50
- package/src/ui/sidebar/BaseSidebar.vue +97 -97
- package/src/ui/sidebar/BasicSearch.vue +27 -27
- package/src/ui/sidebar/ResponsiveSearch.vue +54 -54
- package/src/ui/sidebar/Sidebar.vue +227 -227
- package/src/ui/sidebar/SidebarCollapseButton.vue +10 -10
- package/src/ui/sidebar/SidebarContent.vue +31 -31
- package/src/ui/sidebar/SidebarDescription.vue +10 -10
- package/src/ui/sidebar/SidebarExpandButton.vue +10 -10
- package/src/ui/sidebar/SidebarFooter.vue +10 -10
- package/src/ui/sidebar/SidebarGroup.vue +11 -11
- package/src/ui/sidebar/SidebarGroupContent.vue +10 -10
- package/src/ui/sidebar/SidebarGroupLabel.vue +7 -7
- package/src/ui/sidebar/SidebarHeader.vue +10 -10
- package/src/ui/sidebar/SidebarInset.vue +19 -19
- package/src/ui/sidebar/SidebarMenu.vue +7 -7
- package/src/ui/sidebar/SidebarMenuBadge.vue +7 -7
- package/src/ui/sidebar/SidebarMenuButton.vue +17 -17
- package/src/ui/sidebar/SidebarMenuItem.vue +10 -10
- package/src/ui/sidebar/SidebarMenuSub.vue +18 -18
- package/src/ui/sidebar/SidebarMenuSubContent.vue +10 -10
- package/src/ui/sidebar/SidebarMenuSubItem.vue +10 -10
- package/src/ui/sidebar/SidebarMenuSubTrigger.vue +10 -10
- package/src/ui/sidebar/SidebarProvider.vue +108 -108
- package/src/ui/sidebar/SidebarScrollArea.vue +10 -10
- package/src/ui/sidebar/SidebarSection.vue +10 -10
- package/src/ui/sidebar/SidebarSeparator.vue +8 -8
- package/src/ui/sidebar/SidebarShortcut.vue +10 -10
- package/src/ui/sidebar/SidebarTitle.vue +10 -10
- package/src/ui/sidebar/SidebarTrigger.vue +27 -27
- package/src/ui/sidebar/Wrapper.vue +12 -12
- package/src/ui/sidebar/context.ts +8 -8
- package/src/ui/sidebar/index.ts +27 -27
- package/src/ui/sidebar/sidebarStore.ts +40 -40
- package/src/ui/sidebar/types.ts +30 -30
- package/src/ui/sidebar/useAutoCollapse.ts +81 -81
- package/src/ui/sidebar.vue +24 -24
- package/src/ui/skeleton.vue +15 -15
- package/src/ui/slider.vue +32 -32
- package/src/ui/sonner.vue +67 -67
- package/src/ui/switch.vue +33 -33
- package/src/ui/tab-content.vue +28 -28
- package/src/ui/tab-list.vue +31 -31
- package/src/ui/tab-panel.vue +19 -19
- package/src/ui/tab-trigger.vue +34 -34
- package/src/ui/tab.vue +30 -30
- package/src/ui/table-body.vue +16 -16
- package/src/ui/table-caption.vue +20 -20
- package/src/ui/table-cell.vue +16 -16
- package/src/ui/table-footer.vue +16 -16
- package/src/ui/table-header.vue +132 -132
- package/src/ui/table-row.vue +16 -16
- package/src/ui/table.vue +55 -55
- package/src/ui/tabs.vue +33 -33
- package/src/ui/textarea.vue +91 -91
- package/src/ui/threat-gauge.vue +137 -137
- package/src/ui/toggle.vue +69 -69
- package/src/ui/tooltip-content.vue +52 -52
- package/src/ui/tooltip-provider.vue +13 -13
- package/src/ui/tooltip-root.vue +9 -9
- package/src/ui/tooltip-trigger.vue +13 -13
- package/src/ui/tooltip.vue +22 -22
- package/src/ui/utils.ts +6 -6
- package/vite.config.ts +39 -39
|
@@ -1,148 +1,148 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
<script setup lang="ts">
|
|
5
|
-
import { ref, onMounted, onBeforeUnmount, nextTick, useAttrs, defineProps } from 'vue'
|
|
6
|
-
import { TabsList } from '@/shadcn/tabs'
|
|
7
|
-
|
|
8
|
-
const props = defineProps({
|
|
9
|
-
class: {
|
|
10
|
-
type: [String, Array, Object],
|
|
11
|
-
default: ''
|
|
12
|
-
}
|
|
13
|
-
})
|
|
14
|
-
const attrs = useAttrs()
|
|
15
|
-
|
|
16
|
-
const scrollContainerRef = ref<HTMLElement | null>(null)
|
|
17
|
-
const canScrollLeft = ref(false)
|
|
18
|
-
const canScrollRight = ref(false)
|
|
19
|
-
const showButtons = ref(false)
|
|
20
|
-
|
|
21
|
-
function checkScrollability() {
|
|
22
|
-
const container = scrollContainerRef.value
|
|
23
|
-
if (!container) return
|
|
24
|
-
const { scrollLeft, scrollWidth, clientWidth } = container
|
|
25
|
-
canScrollLeft.value = scrollLeft > 0
|
|
26
|
-
canScrollRight.value = scrollLeft < scrollWidth - clientWidth - 1
|
|
27
|
-
showButtons.value = scrollWidth > clientWidth
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function scrollLeftFn() {
|
|
31
|
-
const container = scrollContainerRef.value
|
|
32
|
-
if (!container) return
|
|
33
|
-
container.scrollBy({ left: -200, behavior: 'smooth' })
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function scrollRightFn() {
|
|
37
|
-
const container = scrollContainerRef.value
|
|
38
|
-
if (!container) return
|
|
39
|
-
container.scrollBy({ left: 200, behavior: 'smooth' })
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
let handleScroll: (() => void) | null = null;
|
|
43
|
-
let handleResize: (() => void) | null = null;
|
|
44
|
-
|
|
45
|
-
onMounted(() => {
|
|
46
|
-
nextTick(() => {
|
|
47
|
-
const container = scrollContainerRef.value
|
|
48
|
-
if (!container) return
|
|
49
|
-
handleScroll = () => checkScrollability()
|
|
50
|
-
handleResize = () => checkScrollability()
|
|
51
|
-
container.addEventListener('scroll', handleScroll)
|
|
52
|
-
window.addEventListener('resize', handleResize)
|
|
53
|
-
checkScrollability()
|
|
54
|
-
})
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
onBeforeUnmount(() => {
|
|
58
|
-
const container = scrollContainerRef.value
|
|
59
|
-
if (container && handleScroll) {
|
|
60
|
-
container.removeEventListener('scroll', handleScroll)
|
|
61
|
-
}
|
|
62
|
-
if (handleResize) {
|
|
63
|
-
window.removeEventListener('resize', handleResize)
|
|
64
|
-
}
|
|
65
|
-
})
|
|
66
|
-
</script>
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
<template>
|
|
70
|
-
<div class="group relative w-full">
|
|
71
|
-
<!-- Left scroll button -->
|
|
72
|
-
<button
|
|
73
|
-
v-if="showButtons && canScrollLeft"
|
|
74
|
-
@click="scrollLeftFn"
|
|
75
|
-
class="absolute left-0 top-0 z-10 h-full w-10 flex min-w-0 max-w-48 w-auto shrink-0 items-center justify-center bg-gradient-to-r from-background via-background/95 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-200 hover:from-background hover:via-background focus:outline-none focus:opacity-100 [&>span]:truncate [&>span]:block"
|
|
76
|
-
aria-label="Scroll tabs left"
|
|
77
|
-
type="button"
|
|
78
|
-
>
|
|
79
|
-
<svg
|
|
80
|
-
width="14"
|
|
81
|
-
height="14"
|
|
82
|
-
viewBox="0 0 24 24"
|
|
83
|
-
fill="none"
|
|
84
|
-
stroke="currentColor"
|
|
85
|
-
stroke-width="2"
|
|
86
|
-
stroke-linecap="round"
|
|
87
|
-
stroke-linejoin="round"
|
|
88
|
-
class="text-primary hover:text-primary/80 transition-colors duration-150"
|
|
89
|
-
>
|
|
90
|
-
<path d="m15 18-6-6 6-6" />
|
|
91
|
-
</svg>
|
|
92
|
-
</button>
|
|
93
|
-
|
|
94
|
-
<!-- Scrollable container -->
|
|
95
|
-
<div
|
|
96
|
-
ref="scrollContainerRef"
|
|
97
|
-
class="w-full overflow-x-auto scrollbar-hide"
|
|
98
|
-
>
|
|
99
|
-
<TabsList
|
|
100
|
-
v-bind="attrs"
|
|
101
|
-
:class="[
|
|
102
|
-
'inline-flex items-center justify-start border-b border-border bg-transparent w-max',
|
|
103
|
-
'[&:has(.corner-cut-trigger)]:border-primary',
|
|
104
|
-
'[&:has(.corner-cut-trigger)]:gap-0',
|
|
105
|
-
'[&:has(.corner-cut-trigger)]:-space-x-[1px]',
|
|
106
|
-
showButtons && canScrollLeft ? 'pl-3' : '',
|
|
107
|
-
showButtons && canScrollRight ? 'pr-3' : '',
|
|
108
|
-
props.class
|
|
109
|
-
]"
|
|
110
|
-
>
|
|
111
|
-
<slot />
|
|
112
|
-
</TabsList>
|
|
113
|
-
</div>
|
|
114
|
-
|
|
115
|
-
<!-- Right scroll button -->
|
|
116
|
-
<button
|
|
117
|
-
v-if="showButtons && canScrollRight"
|
|
118
|
-
@click="scrollRightFn"
|
|
119
|
-
class="absolute right-0 top-0 z-10 h-full w-10 flex items-center justify-center bg-gradient-to-l from-background via-background/95 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-200 hover:from-background hover:via-background focus:outline-none focus:opacity-100"
|
|
120
|
-
aria-label="Scroll tabs right"
|
|
121
|
-
type="button"
|
|
122
|
-
>
|
|
123
|
-
<svg
|
|
124
|
-
width="14"
|
|
125
|
-
height="14"
|
|
126
|
-
viewBox="0 0 24 24"
|
|
127
|
-
fill="none"
|
|
128
|
-
stroke="currentColor"
|
|
129
|
-
stroke-width="2"
|
|
130
|
-
stroke-linecap="round"
|
|
131
|
-
stroke-linejoin="round"
|
|
132
|
-
class="text-primary hover:text-primary/80 transition-colors duration-150"
|
|
133
|
-
>
|
|
134
|
-
<path d="m9 18 6-6-6-6" />
|
|
135
|
-
</svg>
|
|
136
|
-
</button>
|
|
137
|
-
</div>
|
|
138
|
-
</template>
|
|
139
|
-
|
|
140
|
-
<style scoped>
|
|
141
|
-
.scrollbar-hide::-webkit-scrollbar {
|
|
142
|
-
display: none;
|
|
143
|
-
}
|
|
144
|
-
.scrollbar-hide {
|
|
145
|
-
-ms-overflow-style: none;
|
|
146
|
-
scrollbar-width: none;
|
|
147
|
-
}
|
|
148
|
-
</style>
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
<script setup lang="ts">
|
|
5
|
+
import { ref, onMounted, onBeforeUnmount, nextTick, useAttrs, defineProps } from 'vue'
|
|
6
|
+
import { TabsList } from '@/shadcn/tabs'
|
|
7
|
+
|
|
8
|
+
const props = defineProps({
|
|
9
|
+
class: {
|
|
10
|
+
type: [String, Array, Object],
|
|
11
|
+
default: ''
|
|
12
|
+
}
|
|
13
|
+
})
|
|
14
|
+
const attrs = useAttrs()
|
|
15
|
+
|
|
16
|
+
const scrollContainerRef = ref<HTMLElement | null>(null)
|
|
17
|
+
const canScrollLeft = ref(false)
|
|
18
|
+
const canScrollRight = ref(false)
|
|
19
|
+
const showButtons = ref(false)
|
|
20
|
+
|
|
21
|
+
function checkScrollability() {
|
|
22
|
+
const container = scrollContainerRef.value
|
|
23
|
+
if (!container) return
|
|
24
|
+
const { scrollLeft, scrollWidth, clientWidth } = container
|
|
25
|
+
canScrollLeft.value = scrollLeft > 0
|
|
26
|
+
canScrollRight.value = scrollLeft < scrollWidth - clientWidth - 1
|
|
27
|
+
showButtons.value = scrollWidth > clientWidth
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function scrollLeftFn() {
|
|
31
|
+
const container = scrollContainerRef.value
|
|
32
|
+
if (!container) return
|
|
33
|
+
container.scrollBy({ left: -200, behavior: 'smooth' })
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function scrollRightFn() {
|
|
37
|
+
const container = scrollContainerRef.value
|
|
38
|
+
if (!container) return
|
|
39
|
+
container.scrollBy({ left: 200, behavior: 'smooth' })
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
let handleScroll: (() => void) | null = null;
|
|
43
|
+
let handleResize: (() => void) | null = null;
|
|
44
|
+
|
|
45
|
+
onMounted(() => {
|
|
46
|
+
nextTick(() => {
|
|
47
|
+
const container = scrollContainerRef.value
|
|
48
|
+
if (!container) return
|
|
49
|
+
handleScroll = () => checkScrollability()
|
|
50
|
+
handleResize = () => checkScrollability()
|
|
51
|
+
container.addEventListener('scroll', handleScroll)
|
|
52
|
+
window.addEventListener('resize', handleResize)
|
|
53
|
+
checkScrollability()
|
|
54
|
+
})
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
onBeforeUnmount(() => {
|
|
58
|
+
const container = scrollContainerRef.value
|
|
59
|
+
if (container && handleScroll) {
|
|
60
|
+
container.removeEventListener('scroll', handleScroll)
|
|
61
|
+
}
|
|
62
|
+
if (handleResize) {
|
|
63
|
+
window.removeEventListener('resize', handleResize)
|
|
64
|
+
}
|
|
65
|
+
})
|
|
66
|
+
</script>
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
<template>
|
|
70
|
+
<div class="group relative w-full">
|
|
71
|
+
<!-- Left scroll button -->
|
|
72
|
+
<button
|
|
73
|
+
v-if="showButtons && canScrollLeft"
|
|
74
|
+
@click="scrollLeftFn"
|
|
75
|
+
class="absolute left-0 top-0 z-10 h-full w-10 flex min-w-0 max-w-48 w-auto shrink-0 items-center justify-center bg-gradient-to-r from-background via-background/95 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-200 hover:from-background hover:via-background focus:outline-none focus:opacity-100 [&>span]:truncate [&>span]:block"
|
|
76
|
+
aria-label="Scroll tabs left"
|
|
77
|
+
type="button"
|
|
78
|
+
>
|
|
79
|
+
<svg
|
|
80
|
+
width="14"
|
|
81
|
+
height="14"
|
|
82
|
+
viewBox="0 0 24 24"
|
|
83
|
+
fill="none"
|
|
84
|
+
stroke="currentColor"
|
|
85
|
+
stroke-width="2"
|
|
86
|
+
stroke-linecap="round"
|
|
87
|
+
stroke-linejoin="round"
|
|
88
|
+
class="text-primary hover:text-primary/80 transition-colors duration-150"
|
|
89
|
+
>
|
|
90
|
+
<path d="m15 18-6-6 6-6" />
|
|
91
|
+
</svg>
|
|
92
|
+
</button>
|
|
93
|
+
|
|
94
|
+
<!-- Scrollable container -->
|
|
95
|
+
<div
|
|
96
|
+
ref="scrollContainerRef"
|
|
97
|
+
class="w-full overflow-x-auto scrollbar-hide"
|
|
98
|
+
>
|
|
99
|
+
<TabsList
|
|
100
|
+
v-bind="attrs"
|
|
101
|
+
:class="[
|
|
102
|
+
'inline-flex items-center justify-start border-b border-border bg-transparent w-max',
|
|
103
|
+
'[&:has(.corner-cut-trigger)]:border-primary',
|
|
104
|
+
'[&:has(.corner-cut-trigger)]:gap-0',
|
|
105
|
+
'[&:has(.corner-cut-trigger)]:-space-x-[1px]',
|
|
106
|
+
showButtons && canScrollLeft ? 'pl-3' : '',
|
|
107
|
+
showButtons && canScrollRight ? 'pr-3' : '',
|
|
108
|
+
props.class
|
|
109
|
+
]"
|
|
110
|
+
>
|
|
111
|
+
<slot />
|
|
112
|
+
</TabsList>
|
|
113
|
+
</div>
|
|
114
|
+
|
|
115
|
+
<!-- Right scroll button -->
|
|
116
|
+
<button
|
|
117
|
+
v-if="showButtons && canScrollRight"
|
|
118
|
+
@click="scrollRightFn"
|
|
119
|
+
class="absolute right-0 top-0 z-10 h-full w-10 flex items-center justify-center bg-gradient-to-l from-background via-background/95 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-200 hover:from-background hover:via-background focus:outline-none focus:opacity-100"
|
|
120
|
+
aria-label="Scroll tabs right"
|
|
121
|
+
type="button"
|
|
122
|
+
>
|
|
123
|
+
<svg
|
|
124
|
+
width="14"
|
|
125
|
+
height="14"
|
|
126
|
+
viewBox="0 0 24 24"
|
|
127
|
+
fill="none"
|
|
128
|
+
stroke="currentColor"
|
|
129
|
+
stroke-width="2"
|
|
130
|
+
stroke-linecap="round"
|
|
131
|
+
stroke-linejoin="round"
|
|
132
|
+
class="text-primary hover:text-primary/80 transition-colors duration-150"
|
|
133
|
+
>
|
|
134
|
+
<path d="m9 18 6-6-6-6" />
|
|
135
|
+
</svg>
|
|
136
|
+
</button>
|
|
137
|
+
</div>
|
|
138
|
+
</template>
|
|
139
|
+
|
|
140
|
+
<style scoped>
|
|
141
|
+
.scrollbar-hide::-webkit-scrollbar {
|
|
142
|
+
display: none;
|
|
143
|
+
}
|
|
144
|
+
.scrollbar-hide {
|
|
145
|
+
-ms-overflow-style: none;
|
|
146
|
+
scrollbar-width: none;
|
|
147
|
+
}
|
|
148
|
+
</style>
|
|
@@ -1,135 +1,135 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="space-y-4">
|
|
3
|
-
<Popover v-model:open="isOpen" :disabled="disabled">
|
|
4
|
-
<PopoverTrigger as="template">
|
|
5
|
-
<Button
|
|
6
|
-
variant="secondary"
|
|
7
|
-
:class="[
|
|
8
|
-
'justify-between border-input bg-input-background hover:bg-select-hover focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]',
|
|
9
|
-
size === 'sm' ? 'h-8' : 'h-9',
|
|
10
|
-
customClass
|
|
11
|
-
]"
|
|
12
|
-
role="combobox"
|
|
13
|
-
:aria-expanded="isOpen"
|
|
14
|
-
:disabled="disabled"
|
|
15
|
-
>
|
|
16
|
-
<div class="w-2/3 flex gap-1 flex-1">
|
|
17
|
-
<template v-if="modelValue.length === 0">
|
|
18
|
-
<span class="text-muted-foreground">{{ placeholder }}</span>
|
|
19
|
-
</template>
|
|
20
|
-
<template v-else-if="modelValue.length <= maxDisplay">
|
|
21
|
-
<Badge
|
|
22
|
-
v-for="(val, idx) in modelValue"
|
|
23
|
-
:key="val"
|
|
24
|
-
variant="soft-neutral"
|
|
25
|
-
class="text-xs shrink-0"
|
|
26
|
-
>
|
|
27
|
-
{{ getLabel(val) }}
|
|
28
|
-
</Badge>
|
|
29
|
-
</template>
|
|
30
|
-
<template v-else>
|
|
31
|
-
<Badge variant="soft-neutral" class="text-xs shrink-0">
|
|
32
|
-
{{ getLabel(modelValue[0]) }}
|
|
33
|
-
</Badge>
|
|
34
|
-
<Badge variant="soft-neutral" class="text-xs shrink-0">
|
|
35
|
-
+{{ modelValue.length - 1 }} more
|
|
36
|
-
</Badge>
|
|
37
|
-
</template>
|
|
38
|
-
</div>
|
|
39
|
-
<ChevronDownIcon class="h-4 w-4 shrink-0 opacity-50" />
|
|
40
|
-
</Button>
|
|
41
|
-
</PopoverTrigger>
|
|
42
|
-
<PopoverContent :class="['p-0', customClass]" align="start">
|
|
43
|
-
<div class="p-1">
|
|
44
|
-
<div class="p-3 pb-2">
|
|
45
|
-
<div class="text-sm font-medium">{{ title }}</div>
|
|
46
|
-
</div>
|
|
47
|
-
<div class="max-h-[200px] overflow-y-auto">
|
|
48
|
-
<div
|
|
49
|
-
v-for="option in options"
|
|
50
|
-
:key="option.id"
|
|
51
|
-
:class="[
|
|
52
|
-
'relative flex w-full cursor-pointer items-center gap-2 rounded-sm py-1.5 pr-2 pl-2 text-sm outline-hidden select-none transition-colors',
|
|
53
|
-
option.disabled ? 'opacity-50 cursor-not-allowed' : 'hover:bg-accent hover:text-accent-foreground'
|
|
54
|
-
]"
|
|
55
|
-
@click="!option.disabled && handleValueChange(option.id, !modelValue.includes(option.id))"
|
|
56
|
-
>
|
|
57
|
-
<Checkbox
|
|
58
|
-
:model-value="modelValue.includes(option.id)"
|
|
59
|
-
:disabled="option.disabled"
|
|
60
|
-
class="pointer-events-none"
|
|
61
|
-
/>
|
|
62
|
-
<span class="flex-1 font-medium leading-none">{{ option.label }}</span>
|
|
63
|
-
</div>
|
|
64
|
-
</div>
|
|
65
|
-
</div>
|
|
66
|
-
</PopoverContent>
|
|
67
|
-
</Popover>
|
|
68
|
-
</div>
|
|
69
|
-
</template>
|
|
70
|
-
|
|
71
|
-
<script setup>
|
|
72
|
-
import { ref, computed, defineProps, defineEmits, useAttrs } from 'vue';
|
|
73
|
-
import Popover from './popover.vue';
|
|
74
|
-
import PopoverTrigger from './PopoverTrigger.vue';
|
|
75
|
-
import PopoverContent from './PopoverContent.vue';
|
|
76
|
-
import Button from './button.vue';
|
|
77
|
-
import Badge from './badge.vue';
|
|
78
|
-
import Checkbox from './checkbox.vue';
|
|
79
|
-
import ChevronDownIcon from 'lucide-vue-next/dist/esm/icons/chevron-down';
|
|
80
|
-
|
|
81
|
-
const props = defineProps({
|
|
82
|
-
modelValue: {
|
|
83
|
-
type: Array,
|
|
84
|
-
default: () => [],
|
|
85
|
-
},
|
|
86
|
-
options: {
|
|
87
|
-
type: Array,
|
|
88
|
-
default: () => [],
|
|
89
|
-
},
|
|
90
|
-
placeholder: {
|
|
91
|
-
type: String,
|
|
92
|
-
default: 'Select options...',
|
|
93
|
-
},
|
|
94
|
-
title: {
|
|
95
|
-
type: String,
|
|
96
|
-
default: 'Select Options',
|
|
97
|
-
},
|
|
98
|
-
maxDisplay: {
|
|
99
|
-
type: Number,
|
|
100
|
-
default: 2,
|
|
101
|
-
},
|
|
102
|
-
disabled: {
|
|
103
|
-
type: Boolean,
|
|
104
|
-
default: false,
|
|
105
|
-
},
|
|
106
|
-
size: {
|
|
107
|
-
type: String,
|
|
108
|
-
default: 'default',
|
|
109
|
-
},
|
|
110
|
-
class: {
|
|
111
|
-
type: String,
|
|
112
|
-
default: '',
|
|
113
|
-
},
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
const emit = defineEmits(['update:modelValue']);
|
|
117
|
-
const $attrs = useAttrs();
|
|
118
|
-
const isOpen = ref(false);
|
|
119
|
-
const customClass = computed(() => props.class || $attrs.class || '');
|
|
120
|
-
|
|
121
|
-
function getLabel(val) {
|
|
122
|
-
const found = props.options.find((o) => o.id === val);
|
|
123
|
-
return found ? found.label : val;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
function handleValueChange(optionId, checked) {
|
|
127
|
-
let newValue = Array.isArray(props.modelValue) ? [...props.modelValue] : [];
|
|
128
|
-
if (checked) {
|
|
129
|
-
newValue.push(optionId);
|
|
130
|
-
} else {
|
|
131
|
-
newValue = newValue.filter((v) => v !== optionId);
|
|
132
|
-
}
|
|
133
|
-
emit('update:modelValue', newValue);
|
|
134
|
-
}
|
|
135
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="space-y-4">
|
|
3
|
+
<Popover v-model:open="isOpen" :disabled="disabled">
|
|
4
|
+
<PopoverTrigger as="template">
|
|
5
|
+
<Button
|
|
6
|
+
variant="secondary"
|
|
7
|
+
:class="[
|
|
8
|
+
'justify-between border-input bg-input-background hover:bg-select-hover focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]',
|
|
9
|
+
size === 'sm' ? 'h-8' : 'h-9',
|
|
10
|
+
customClass
|
|
11
|
+
]"
|
|
12
|
+
role="combobox"
|
|
13
|
+
:aria-expanded="isOpen"
|
|
14
|
+
:disabled="disabled"
|
|
15
|
+
>
|
|
16
|
+
<div class="w-2/3 flex gap-1 flex-1">
|
|
17
|
+
<template v-if="modelValue.length === 0">
|
|
18
|
+
<span class="text-muted-foreground">{{ placeholder }}</span>
|
|
19
|
+
</template>
|
|
20
|
+
<template v-else-if="modelValue.length <= maxDisplay">
|
|
21
|
+
<Badge
|
|
22
|
+
v-for="(val, idx) in modelValue"
|
|
23
|
+
:key="val"
|
|
24
|
+
variant="soft-neutral"
|
|
25
|
+
class="text-xs shrink-0"
|
|
26
|
+
>
|
|
27
|
+
{{ getLabel(val) }}
|
|
28
|
+
</Badge>
|
|
29
|
+
</template>
|
|
30
|
+
<template v-else>
|
|
31
|
+
<Badge variant="soft-neutral" class="text-xs shrink-0">
|
|
32
|
+
{{ getLabel(modelValue[0]) }}
|
|
33
|
+
</Badge>
|
|
34
|
+
<Badge variant="soft-neutral" class="text-xs shrink-0">
|
|
35
|
+
+{{ modelValue.length - 1 }} more
|
|
36
|
+
</Badge>
|
|
37
|
+
</template>
|
|
38
|
+
</div>
|
|
39
|
+
<ChevronDownIcon class="h-4 w-4 shrink-0 opacity-50" />
|
|
40
|
+
</Button>
|
|
41
|
+
</PopoverTrigger>
|
|
42
|
+
<PopoverContent :class="['p-0', customClass]" align="start">
|
|
43
|
+
<div class="p-1">
|
|
44
|
+
<div class="p-3 pb-2">
|
|
45
|
+
<div class="text-sm font-medium">{{ title }}</div>
|
|
46
|
+
</div>
|
|
47
|
+
<div class="max-h-[200px] overflow-y-auto">
|
|
48
|
+
<div
|
|
49
|
+
v-for="option in options"
|
|
50
|
+
:key="option.id"
|
|
51
|
+
:class="[
|
|
52
|
+
'relative flex w-full cursor-pointer items-center gap-2 rounded-sm py-1.5 pr-2 pl-2 text-sm outline-hidden select-none transition-colors',
|
|
53
|
+
option.disabled ? 'opacity-50 cursor-not-allowed' : 'hover:bg-accent hover:text-accent-foreground'
|
|
54
|
+
]"
|
|
55
|
+
@click="!option.disabled && handleValueChange(option.id, !modelValue.includes(option.id))"
|
|
56
|
+
>
|
|
57
|
+
<Checkbox
|
|
58
|
+
:model-value="modelValue.includes(option.id)"
|
|
59
|
+
:disabled="option.disabled"
|
|
60
|
+
class="pointer-events-none"
|
|
61
|
+
/>
|
|
62
|
+
<span class="flex-1 font-medium leading-none">{{ option.label }}</span>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
</PopoverContent>
|
|
67
|
+
</Popover>
|
|
68
|
+
</div>
|
|
69
|
+
</template>
|
|
70
|
+
|
|
71
|
+
<script setup>
|
|
72
|
+
import { ref, computed, defineProps, defineEmits, useAttrs } from 'vue';
|
|
73
|
+
import Popover from './popover.vue';
|
|
74
|
+
import PopoverTrigger from './PopoverTrigger.vue';
|
|
75
|
+
import PopoverContent from './PopoverContent.vue';
|
|
76
|
+
import Button from './button.vue';
|
|
77
|
+
import Badge from './badge.vue';
|
|
78
|
+
import Checkbox from './checkbox.vue';
|
|
79
|
+
import ChevronDownIcon from 'lucide-vue-next/dist/esm/icons/chevron-down';
|
|
80
|
+
|
|
81
|
+
const props = defineProps({
|
|
82
|
+
modelValue: {
|
|
83
|
+
type: Array,
|
|
84
|
+
default: () => [],
|
|
85
|
+
},
|
|
86
|
+
options: {
|
|
87
|
+
type: Array,
|
|
88
|
+
default: () => [],
|
|
89
|
+
},
|
|
90
|
+
placeholder: {
|
|
91
|
+
type: String,
|
|
92
|
+
default: 'Select options...',
|
|
93
|
+
},
|
|
94
|
+
title: {
|
|
95
|
+
type: String,
|
|
96
|
+
default: 'Select Options',
|
|
97
|
+
},
|
|
98
|
+
maxDisplay: {
|
|
99
|
+
type: Number,
|
|
100
|
+
default: 2,
|
|
101
|
+
},
|
|
102
|
+
disabled: {
|
|
103
|
+
type: Boolean,
|
|
104
|
+
default: false,
|
|
105
|
+
},
|
|
106
|
+
size: {
|
|
107
|
+
type: String,
|
|
108
|
+
default: 'default',
|
|
109
|
+
},
|
|
110
|
+
class: {
|
|
111
|
+
type: String,
|
|
112
|
+
default: '',
|
|
113
|
+
},
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
const emit = defineEmits(['update:modelValue']);
|
|
117
|
+
const $attrs = useAttrs();
|
|
118
|
+
const isOpen = ref(false);
|
|
119
|
+
const customClass = computed(() => props.class || $attrs.class || '');
|
|
120
|
+
|
|
121
|
+
function getLabel(val) {
|
|
122
|
+
const found = props.options.find((o) => o.id === val);
|
|
123
|
+
return found ? found.label : val;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function handleValueChange(optionId, checked) {
|
|
127
|
+
let newValue = Array.isArray(props.modelValue) ? [...props.modelValue] : [];
|
|
128
|
+
if (checked) {
|
|
129
|
+
newValue.push(optionId);
|
|
130
|
+
} else {
|
|
131
|
+
newValue = newValue.filter((v) => v !== optionId);
|
|
132
|
+
}
|
|
133
|
+
emit('update:modelValue', newValue);
|
|
134
|
+
}
|
|
135
|
+
</script>
|