@geniusdynamics/ns8-ui-lib 1.0.0
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 +167 -0
- package/dist/index.d.ts +14 -0
- package/dist/ns8-ui-lib.es.js +4278 -0
- package/dist/ns8-ui-lib.es.js.map +1 -0
- package/dist/ns8-ui-lib.umd.js +7 -0
- package/dist/ns8-ui-lib.umd.js.map +1 -0
- package/dist/src/App.vue.d.ts +2 -0
- package/dist/src/components/HelloWorld.vue.d.ts +5 -0
- package/dist/src/components/NS/cards/NSBackupCard.vue.d.ts +51 -0
- package/dist/src/components/NS/cards/NSSystemInfoCard.vue.d.ts +58 -0
- package/dist/src/components/NS/cards/NSSystemdServiceCard.vue.d.ts +47 -0
- package/dist/src/components/NS/cards/index.d.ts +3 -0
- package/dist/src/components/NS/checkbox/NSCheckbox.vue.d.ts +37 -0
- package/dist/src/components/NS/checkbox/index.d.ts +1 -0
- package/dist/src/components/NS/data-table/NSDataTable.vue.d.ts +98 -0
- package/dist/src/components/NS/data-table/index.d.ts +1 -0
- package/dist/src/components/NS/empty-state/NSEmptyState.vue.d.ts +45 -0
- package/dist/src/components/NS/empty-state/index.d.ts +1 -0
- package/dist/src/components/NS/index.d.ts +35 -0
- package/dist/src/components/NS/inline-notification/NSInlineNotification.vue.d.ts +44 -0
- package/dist/src/components/NS/inline-notification/index.d.ts +1 -0
- package/dist/src/components/NS/lottie-animation/NSLottieAnimation.vue.d.ts +75 -0
- package/dist/src/components/NS/lottie-animation/index.d.ts +1 -0
- package/dist/src/components/NS/modal/NSModal.vue.d.ts +56 -0
- package/dist/src/components/NS/modal/NSModalTrigger.vue.d.ts +64 -0
- package/dist/src/components/NS/modal/index.d.ts +2 -0
- package/dist/src/components/NS/pagination/NSPagination.vue.d.ts +36 -0
- package/dist/src/components/NS/pagination/index.d.ts +1 -0
- package/dist/src/components/NS/progress/NSProgress.vue.d.ts +37 -0
- package/dist/src/components/NS/progress/NSProgressBar.vue.d.ts +39 -0
- package/dist/src/components/NS/progress/index.d.ts +2 -0
- package/dist/src/components/NS/slider/NSByteSlider.vue.d.ts +50 -0
- package/dist/src/components/NS/slider/NSSlider.vue.d.ts +49 -0
- package/dist/src/components/NS/slider/index.d.ts +2 -0
- package/dist/src/components/NS/tag/NSTag.vue.d.ts +41 -0
- package/dist/src/components/NS/tag/index.d.ts +1 -0
- package/dist/src/components/NS/text-input/NSTextInput.vue.d.ts +67 -0
- package/dist/src/components/NS/text-input/index.d.ts +1 -0
- package/dist/src/components/NS/toast-notification/NSToastNotification.vue.d.ts +44 -0
- package/dist/src/components/NS/toast-notification/index.d.ts +1 -0
- package/dist/src/components/NS/toggle/NSToggle.vue.d.ts +51 -0
- package/dist/src/components/NS/toggle/index.d.ts +1 -0
- package/dist/src/components/NS/wizard/NSWizard.vue.d.ts +86 -0
- package/dist/src/components/NS/wizard/index.d.ts +1 -0
- package/dist/src/components/ui/button/Button.vue.d.ts +27 -0
- package/dist/src/components/ui/button/index.d.ts +7 -0
- package/dist/src/components/ui/card/Card.vue.d.ts +21 -0
- package/dist/src/components/ui/card/CardAction.vue.d.ts +21 -0
- package/dist/src/components/ui/card/CardContent.vue.d.ts +21 -0
- package/dist/src/components/ui/card/CardDescription.vue.d.ts +21 -0
- package/dist/src/components/ui/card/CardFooter.vue.d.ts +21 -0
- package/dist/src/components/ui/card/CardHeader.vue.d.ts +21 -0
- package/dist/src/components/ui/card/CardTitle.vue.d.ts +21 -0
- package/dist/src/components/ui/card/index.d.ts +7 -0
- package/dist/src/components/ui/checkbox/NsCheckbox.vue.d.ts +49 -0
- package/dist/src/components/ui/checkbox/index.d.ts +11 -0
- package/dist/src/components/ui/dialog/Dialog.vue.d.ts +28 -0
- package/dist/src/components/ui/dialog/index.d.ts +1 -0
- package/dist/src/components/ui/empty-state/NsEmptyState.vue.d.ts +45 -0
- package/dist/src/components/ui/empty-state/index.d.ts +11 -0
- package/dist/src/components/ui/inline-notification/NsInlineNotification.vue.d.ts +45 -0
- package/dist/src/components/ui/inline-notification/index.d.ts +6 -0
- package/dist/src/components/ui/input/Input.vue.d.ts +12 -0
- package/dist/src/components/ui/input/index.d.ts +1 -0
- package/dist/src/components/ui/input-group/InputGroup.vue.d.ts +21 -0
- package/dist/src/components/ui/input-group/InputGroupAddon.vue.d.ts +25 -0
- package/dist/src/components/ui/input-group/InputGroupButton.vue.d.ts +22 -0
- package/dist/src/components/ui/input-group/InputGroupInput.vue.d.ts +6 -0
- package/dist/src/components/ui/input-group/InputGroupText.vue.d.ts +21 -0
- package/dist/src/components/ui/input-group/InputGroupTextarea.vue.d.ts +6 -0
- package/dist/src/components/ui/input-group/index.d.ts +22 -0
- package/dist/src/components/ui/item/Item.vue.d.ts +27 -0
- package/dist/src/components/ui/item/ItemActions.vue.d.ts +21 -0
- package/dist/src/components/ui/item/ItemContent.vue.d.ts +21 -0
- package/dist/src/components/ui/item/ItemDescription.vue.d.ts +21 -0
- package/dist/src/components/ui/item/ItemFooter.vue.d.ts +21 -0
- package/dist/src/components/ui/item/ItemGroup.vue.d.ts +21 -0
- package/dist/src/components/ui/item/ItemHeader.vue.d.ts +21 -0
- package/dist/src/components/ui/item/ItemMedia.vue.d.ts +23 -0
- package/dist/src/components/ui/item/ItemSeparator.vue.d.ts +7 -0
- package/dist/src/components/ui/item/ItemTitle.vue.d.ts +21 -0
- package/dist/src/components/ui/item/index.d.ts +20 -0
- package/dist/src/components/ui/label/Label.vue.d.ts +22 -0
- package/dist/src/components/ui/label/index.d.ts +1 -0
- package/dist/src/components/ui/scroll-area/ScrollArea.vue.d.ts +22 -0
- package/dist/src/components/ui/scroll-area/ScrollBar.vue.d.ts +9 -0
- package/dist/src/components/ui/scroll-area/index.d.ts +2 -0
- package/dist/src/components/ui/select/Select.vue.d.ts +28 -0
- package/dist/src/components/ui/select/SelectContent.vue.d.ts +32 -0
- package/dist/src/components/ui/select/SelectGroup.vue.d.ts +18 -0
- package/dist/src/components/ui/select/SelectItem.vue.d.ts +23 -0
- package/dist/src/components/ui/select/SelectItemText.vue.d.ts +18 -0
- package/dist/src/components/ui/select/SelectLabel.vue.d.ts +22 -0
- package/dist/src/components/ui/select/SelectScrollDownButton.vue.d.ts +22 -0
- package/dist/src/components/ui/select/SelectScrollUpButton.vue.d.ts +22 -0
- package/dist/src/components/ui/select/SelectSeparator.vue.d.ts +7 -0
- package/dist/src/components/ui/select/SelectTrigger.vue.d.ts +25 -0
- package/dist/src/components/ui/select/SelectValue.vue.d.ts +18 -0
- package/dist/src/components/ui/select/index.d.ts +11 -0
- package/dist/src/components/ui/separator/Separator.vue.d.ts +10 -0
- package/dist/src/components/ui/separator/index.d.ts +1 -0
- package/dist/src/components/ui/sheet/Sheet.vue.d.ts +25 -0
- package/dist/src/components/ui/sheet/SheetClose.vue.d.ts +18 -0
- package/dist/src/components/ui/sheet/SheetContent.vue.d.ts +39 -0
- package/dist/src/components/ui/sheet/SheetDescription.vue.d.ts +22 -0
- package/dist/src/components/ui/sheet/SheetFooter.vue.d.ts +21 -0
- package/dist/src/components/ui/sheet/SheetHeader.vue.d.ts +21 -0
- package/dist/src/components/ui/sheet/SheetOverlay.vue.d.ts +22 -0
- package/dist/src/components/ui/sheet/SheetTitle.vue.d.ts +22 -0
- package/dist/src/components/ui/sheet/SheetTrigger.vue.d.ts +18 -0
- package/dist/src/components/ui/sheet/index.d.ts +8 -0
- package/dist/src/components/ui/sidebar/Sidebar.vue.d.ts +24 -0
- package/dist/src/components/ui/sidebar/SidebarContent.vue.d.ts +21 -0
- package/dist/src/components/ui/sidebar/SidebarFooter.vue.d.ts +21 -0
- package/dist/src/components/ui/sidebar/SidebarGroup.vue.d.ts +21 -0
- package/dist/src/components/ui/sidebar/SidebarGroupAction.vue.d.ts +22 -0
- package/dist/src/components/ui/sidebar/SidebarGroupContent.vue.d.ts +21 -0
- package/dist/src/components/ui/sidebar/SidebarGroupLabel.vue.d.ts +22 -0
- package/dist/src/components/ui/sidebar/SidebarHeader.vue.d.ts +21 -0
- package/dist/src/components/ui/sidebar/SidebarInput.vue.d.ts +21 -0
- package/dist/src/components/ui/sidebar/SidebarInset.vue.d.ts +21 -0
- package/dist/src/components/ui/sidebar/SidebarMenu.vue.d.ts +21 -0
- package/dist/src/components/ui/sidebar/SidebarMenuAction.vue.d.ts +25 -0
- package/dist/src/components/ui/sidebar/SidebarMenuBadge.vue.d.ts +21 -0
- package/dist/src/components/ui/sidebar/SidebarMenuButton.vue.d.ts +27 -0
- package/dist/src/components/ui/sidebar/SidebarMenuButtonChild.vue.d.ts +30 -0
- package/dist/src/components/ui/sidebar/SidebarMenuItem.vue.d.ts +21 -0
- package/dist/src/components/ui/sidebar/SidebarMenuSkeleton.vue.d.ts +7 -0
- package/dist/src/components/ui/sidebar/SidebarMenuSub.vue.d.ts +21 -0
- package/dist/src/components/ui/sidebar/SidebarMenuSubButton.vue.d.ts +27 -0
- package/dist/src/components/ui/sidebar/SidebarMenuSubItem.vue.d.ts +21 -0
- package/dist/src/components/ui/sidebar/SidebarProvider.vue.d.ts +30 -0
- package/dist/src/components/ui/sidebar/SidebarRail.vue.d.ts +21 -0
- package/dist/src/components/ui/sidebar/SidebarSeparator.vue.d.ts +21 -0
- package/dist/src/components/ui/sidebar/SidebarTrigger.vue.d.ts +6 -0
- package/dist/src/components/ui/sidebar/index.d.ts +37 -0
- package/dist/src/components/ui/sidebar/utils.d.ts +56 -0
- package/dist/src/components/ui/skeleton/Skeleton.vue.d.ts +6 -0
- package/dist/src/components/ui/skeleton/index.d.ts +1 -0
- package/dist/src/components/ui/sonner/Sonner.vue.d.ts +3 -0
- package/dist/src/components/ui/sonner/index.d.ts +1 -0
- package/dist/src/components/ui/switch/Switch.vue.d.ts +28 -0
- package/dist/src/components/ui/switch/index.d.ts +1 -0
- package/dist/src/components/ui/table/Table.vue.d.ts +21 -0
- package/dist/src/components/ui/table/TableBody.vue.d.ts +21 -0
- package/dist/src/components/ui/table/TableCaption.vue.d.ts +21 -0
- package/dist/src/components/ui/table/TableCell.vue.d.ts +21 -0
- package/dist/src/components/ui/table/TableEmpty.vue.d.ts +24 -0
- package/dist/src/components/ui/table/TableFooter.vue.d.ts +21 -0
- package/dist/src/components/ui/table/TableHead.vue.d.ts +21 -0
- package/dist/src/components/ui/table/TableHeader.vue.d.ts +21 -0
- package/dist/src/components/ui/table/TableRow.vue.d.ts +21 -0
- package/dist/src/components/ui/table/index.d.ts +9 -0
- package/dist/src/components/ui/table/utils.d.ts +3 -0
- package/dist/src/components/ui/tabs/Tabs.vue.d.ts +28 -0
- package/dist/src/components/ui/tabs/TabsContent.vue.d.ts +22 -0
- package/dist/src/components/ui/tabs/TabsList.vue.d.ts +22 -0
- package/dist/src/components/ui/tabs/TabsTrigger.vue.d.ts +22 -0
- package/dist/src/components/ui/tabs/index.d.ts +4 -0
- package/dist/src/components/ui/tag/NsTag.vue.d.ts +42 -0
- package/dist/src/components/ui/tag/index.d.ts +8 -0
- package/dist/src/components/ui/text-input/NsTextInput.vue.d.ts +79 -0
- package/dist/src/components/ui/text-input/index.d.ts +15 -0
- package/dist/src/components/ui/textarea/Textarea.vue.d.ts +12 -0
- package/dist/src/components/ui/textarea/index.d.ts +1 -0
- package/dist/src/components/ui/toggle/NsToggle.vue.d.ts +54 -0
- package/dist/src/components/ui/toggle/index.d.ts +15 -0
- package/dist/src/components/ui/tooltip/Tooltip.vue.d.ts +24 -0
- package/dist/src/components/ui/tooltip/TooltipContent.vue.d.ts +30 -0
- package/dist/src/components/ui/tooltip/TooltipProvider.vue.d.ts +20 -0
- package/dist/src/components/ui/tooltip/TooltipTrigger.vue.d.ts +18 -0
- package/dist/src/components/ui/tooltip/index.d.ts +4 -0
- package/dist/src/composables/index.d.ts +8 -0
- package/dist/src/composables/useDateTimeService.d.ts +10 -0
- package/dist/src/composables/useFilterService.d.ts +8 -0
- package/dist/src/composables/useIconService.d.ts +153 -0
- package/dist/src/composables/usePageTitleService.d.ts +3 -0
- package/dist/src/composables/useQueryParamService.d.ts +13 -0
- package/dist/src/composables/useStorageService.d.ts +5 -0
- package/dist/src/composables/useTaskService.d.ts +18 -0
- package/dist/src/composables/useUtilService.d.ts +27 -0
- package/dist/src/lib/utils.d.ts +2 -0
- package/dist/src/main.d.ts +0 -0
- package/dist/vite.svg +1 -0
- package/package.json +80 -0
- package/src/App.vue +30 -0
- package/src/components/HelloWorld.vue +41 -0
- package/src/components/NS/CompleteDemo.vue +475 -0
- package/src/components/NS/Demo.vue +191 -0
- package/src/components/NS/cards/NSBackupCard.vue +272 -0
- package/src/components/NS/cards/NSSystemInfoCard.vue +252 -0
- package/src/components/NS/cards/NSSystemdServiceCard.vue +250 -0
- package/src/components/NS/checkbox/NSCheckbox.vue +104 -0
- package/src/components/NS/data-table/NSDataTable.vue +434 -0
- package/src/components/NS/empty-state/NSEmptyState.vue +188 -0
- package/src/components/NS/inline-notification/NSInlineNotification.vue +162 -0
- package/src/components/NS/lottie-animation/NSLottieAnimation.vue +255 -0
- package/src/components/NS/modal/NSModal.vue +193 -0
- package/src/components/NS/modal/NSModalTrigger.vue +109 -0
- package/src/components/NS/pagination/NSPagination.vue +247 -0
- package/src/components/NS/progress/NSProgress.vue +115 -0
- package/src/components/NS/progress/NSProgressBar.vue +137 -0
- package/src/components/NS/slider/NSByteSlider.vue +144 -0
- package/src/components/NS/slider/NSSlider.vue +142 -0
- package/src/components/NS/tag/NSTag.vue +139 -0
- package/src/components/NS/text-input/NSTextInput.vue +242 -0
- package/src/components/NS/toast-notification/NSToastNotification.vue +163 -0
- package/src/components/NS/toggle/NSToggle.vue +156 -0
- package/src/components/NS/wizard/NSWizard.vue +399 -0
- package/src/components/ui/button/Button.vue +29 -0
- package/src/components/ui/card/Card.vue +22 -0
- package/src/components/ui/card/CardAction.vue +17 -0
- package/src/components/ui/card/CardContent.vue +17 -0
- package/src/components/ui/card/CardDescription.vue +17 -0
- package/src/components/ui/card/CardFooter.vue +17 -0
- package/src/components/ui/card/CardHeader.vue +17 -0
- package/src/components/ui/card/CardTitle.vue +17 -0
- package/src/components/ui/checkbox/NsCheckbox.vue +123 -0
- package/src/components/ui/dialog/Dialog.vue +68 -0
- package/src/components/ui/empty-state/NsEmptyState.vue +149 -0
- package/src/components/ui/inline-notification/NsInlineNotification.vue +163 -0
- package/src/components/ui/input/Input.vue +33 -0
- package/src/components/ui/input-group/InputGroup.vue +35 -0
- package/src/components/ui/input-group/InputGroupAddon.vue +36 -0
- package/src/components/ui/input-group/InputGroupButton.vue +21 -0
- package/src/components/ui/input-group/InputGroupInput.vue +19 -0
- package/src/components/ui/input-group/InputGroupText.vue +19 -0
- package/src/components/ui/input-group/InputGroupTextarea.vue +19 -0
- package/src/components/ui/item/Item.vue +27 -0
- package/src/components/ui/item/ItemActions.vue +17 -0
- package/src/components/ui/item/ItemContent.vue +17 -0
- package/src/components/ui/item/ItemDescription.vue +21 -0
- package/src/components/ui/item/ItemFooter.vue +17 -0
- package/src/components/ui/item/ItemGroup.vue +18 -0
- package/src/components/ui/item/ItemHeader.vue +17 -0
- package/src/components/ui/item/ItemMedia.vue +21 -0
- package/src/components/ui/item/ItemSeparator.vue +18 -0
- package/src/components/ui/item/ItemTitle.vue +17 -0
- package/src/components/ui/label/Label.vue +26 -0
- package/src/components/ui/scroll-area/ScrollArea.vue +33 -0
- package/src/components/ui/scroll-area/ScrollBar.vue +32 -0
- package/src/components/ui/select/Select.vue +19 -0
- package/src/components/ui/select/SelectContent.vue +51 -0
- package/src/components/ui/select/SelectGroup.vue +15 -0
- package/src/components/ui/select/SelectItem.vue +44 -0
- package/src/components/ui/select/SelectItemText.vue +15 -0
- package/src/components/ui/select/SelectLabel.vue +17 -0
- package/src/components/ui/select/SelectScrollDownButton.vue +26 -0
- package/src/components/ui/select/SelectScrollUpButton.vue +26 -0
- package/src/components/ui/select/SelectSeparator.vue +19 -0
- package/src/components/ui/select/SelectTrigger.vue +33 -0
- package/src/components/ui/select/SelectValue.vue +15 -0
- package/src/components/ui/separator/Separator.vue +29 -0
- package/src/components/ui/sheet/Sheet.vue +19 -0
- package/src/components/ui/sheet/SheetClose.vue +15 -0
- package/src/components/ui/sheet/SheetContent.vue +62 -0
- package/src/components/ui/sheet/SheetDescription.vue +21 -0
- package/src/components/ui/sheet/SheetFooter.vue +16 -0
- package/src/components/ui/sheet/SheetHeader.vue +15 -0
- package/src/components/ui/sheet/SheetOverlay.vue +21 -0
- package/src/components/ui/sheet/SheetTitle.vue +21 -0
- package/src/components/ui/sheet/SheetTrigger.vue +15 -0
- package/src/components/ui/sidebar/Sidebar.vue +96 -0
- package/src/components/ui/sidebar/SidebarContent.vue +18 -0
- package/src/components/ui/sidebar/SidebarFooter.vue +18 -0
- package/src/components/ui/sidebar/SidebarGroup.vue +18 -0
- package/src/components/ui/sidebar/SidebarGroupAction.vue +27 -0
- package/src/components/ui/sidebar/SidebarGroupContent.vue +18 -0
- package/src/components/ui/sidebar/SidebarGroupLabel.vue +25 -0
- package/src/components/ui/sidebar/SidebarHeader.vue +18 -0
- package/src/components/ui/sidebar/SidebarInput.vue +22 -0
- package/src/components/ui/sidebar/SidebarInset.vue +21 -0
- package/src/components/ui/sidebar/SidebarMenu.vue +18 -0
- package/src/components/ui/sidebar/SidebarMenuAction.vue +35 -0
- package/src/components/ui/sidebar/SidebarMenuBadge.vue +26 -0
- package/src/components/ui/sidebar/SidebarMenuButton.vue +48 -0
- package/src/components/ui/sidebar/SidebarMenuButtonChild.vue +36 -0
- package/src/components/ui/sidebar/SidebarMenuItem.vue +18 -0
- package/src/components/ui/sidebar/SidebarMenuSkeleton.vue +35 -0
- package/src/components/ui/sidebar/SidebarMenuSub.vue +22 -0
- package/src/components/ui/sidebar/SidebarMenuSubButton.vue +36 -0
- package/src/components/ui/sidebar/SidebarMenuSubItem.vue +18 -0
- package/src/components/ui/sidebar/SidebarProvider.vue +82 -0
- package/src/components/ui/sidebar/SidebarRail.vue +33 -0
- package/src/components/ui/sidebar/SidebarSeparator.vue +19 -0
- package/src/components/ui/sidebar/SidebarTrigger.vue +27 -0
- package/src/components/ui/skeleton/Skeleton.vue +17 -0
- package/src/components/ui/sonner/Sonner.vue +42 -0
- package/src/components/ui/switch/Switch.vue +38 -0
- package/src/components/ui/table/Table.vue +16 -0
- package/src/components/ui/table/TableBody.vue +17 -0
- package/src/components/ui/table/TableCaption.vue +17 -0
- package/src/components/ui/table/TableCell.vue +22 -0
- package/src/components/ui/table/TableEmpty.vue +34 -0
- package/src/components/ui/table/TableFooter.vue +17 -0
- package/src/components/ui/table/TableHead.vue +17 -0
- package/src/components/ui/table/TableHeader.vue +17 -0
- package/src/components/ui/table/TableRow.vue +17 -0
- package/src/components/ui/tabs/Tabs.vue +24 -0
- package/src/components/ui/tabs/TabsContent.vue +21 -0
- package/src/components/ui/tabs/TabsList.vue +24 -0
- package/src/components/ui/tabs/TabsTrigger.vue +26 -0
- package/src/components/ui/tag/NsTag.vue +114 -0
- package/src/components/ui/text-input/NsTextInput.vue +269 -0
- package/src/components/ui/textarea/Textarea.vue +28 -0
- package/src/components/ui/toggle/NsToggle.vue +126 -0
- package/src/components/ui/tooltip/Tooltip.vue +19 -0
- package/src/components/ui/tooltip/TooltipContent.vue +34 -0
- package/src/components/ui/tooltip/TooltipProvider.vue +14 -0
- package/src/components/ui/tooltip/TooltipTrigger.vue +15 -0
|
@@ -0,0 +1,434 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref, computed, watch } from 'vue'
|
|
3
|
+
import { ChevronUp, ChevronDown, MoreHorizontal, Search, Filter } from 'lucide-vue-next'
|
|
4
|
+
import {
|
|
5
|
+
Table,
|
|
6
|
+
TableBody,
|
|
7
|
+
TableCell,
|
|
8
|
+
TableHead,
|
|
9
|
+
TableHeader,
|
|
10
|
+
TableRow
|
|
11
|
+
} from '@/components/ui/table'
|
|
12
|
+
import { Button } from '@/components/ui/button'
|
|
13
|
+
import { Input } from '@/components/ui/input'
|
|
14
|
+
import { cn } from '@/lib/utils'
|
|
15
|
+
|
|
16
|
+
interface Column {
|
|
17
|
+
key: string
|
|
18
|
+
label: string
|
|
19
|
+
sortable?: boolean
|
|
20
|
+
width?: string
|
|
21
|
+
align?: 'left' | 'center' | 'right'
|
|
22
|
+
filterable?: boolean
|
|
23
|
+
render?: (value: any, row: any, index: number) => any
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface Action {
|
|
27
|
+
key: string
|
|
28
|
+
label: string
|
|
29
|
+
icon?: any
|
|
30
|
+
onClick: (row: any, index: number) => void
|
|
31
|
+
disabled?: (row: any) => boolean
|
|
32
|
+
variant?: 'default' | 'destructive' | 'outline' | 'secondary' | 'ghost' | 'link'
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
interface Props {
|
|
36
|
+
data?: any[]
|
|
37
|
+
columns?: Column[]
|
|
38
|
+
actions?: Action[]
|
|
39
|
+
loading?: boolean
|
|
40
|
+
selectable?: boolean
|
|
41
|
+
searchable?: boolean
|
|
42
|
+
filterable?: boolean
|
|
43
|
+
pagination?: boolean
|
|
44
|
+
currentPage?: number
|
|
45
|
+
itemsPerPage?: number
|
|
46
|
+
totalItems?: number
|
|
47
|
+
showTotal?: boolean
|
|
48
|
+
emptyMessage?: string
|
|
49
|
+
loadingMessage?: string
|
|
50
|
+
maxHeight?: string
|
|
51
|
+
striped?: boolean
|
|
52
|
+
hover?: boolean
|
|
53
|
+
class?: string
|
|
54
|
+
tableClass?: string
|
|
55
|
+
headerClass?: string
|
|
56
|
+
bodyClass?: string
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
60
|
+
data: () => [],
|
|
61
|
+
columns: () => [],
|
|
62
|
+
actions: () => [],
|
|
63
|
+
loading: false,
|
|
64
|
+
selectable: false,
|
|
65
|
+
searchable: false,
|
|
66
|
+
filterable: false,
|
|
67
|
+
pagination: false,
|
|
68
|
+
currentPage: 1,
|
|
69
|
+
itemsPerPage: 10,
|
|
70
|
+
totalItems: 0,
|
|
71
|
+
showTotal: true,
|
|
72
|
+
emptyMessage: 'No data available',
|
|
73
|
+
loadingMessage: 'Loading...',
|
|
74
|
+
striped: true,
|
|
75
|
+
hover: true,
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
const emit = defineEmits<{
|
|
79
|
+
'update:currentPage': [page: number]
|
|
80
|
+
'update:itemsPerPage': [size: number]
|
|
81
|
+
'selection-change': [selectedRows: any[]]
|
|
82
|
+
'row-click': [row: any, index: number]
|
|
83
|
+
'sort-change': [column: string, direction: 'asc' | 'desc' | null]
|
|
84
|
+
'filter-change': [filters: Record<string, any>]
|
|
85
|
+
'search': [query: string]
|
|
86
|
+
}>()
|
|
87
|
+
|
|
88
|
+
const selectedRows = ref<any[]>([])
|
|
89
|
+
const searchQuery = ref('')
|
|
90
|
+
const sortColumn = ref<string>('')
|
|
91
|
+
const sortDirection = ref<'asc' | 'desc' | null>(null)
|
|
92
|
+
const filters = ref<Record<string, any>>({})
|
|
93
|
+
|
|
94
|
+
const processedData = computed(() => {
|
|
95
|
+
let result = [...(props.data || [])]
|
|
96
|
+
|
|
97
|
+
// Apply search
|
|
98
|
+
if (searchQuery.value && props.searchable) {
|
|
99
|
+
const query = searchQuery.value.toLowerCase()
|
|
100
|
+
result = result.filter(row => {
|
|
101
|
+
return props.columns.some(column => {
|
|
102
|
+
const value = row[column.key]
|
|
103
|
+
return value && value.toString().toLowerCase().includes(query)
|
|
104
|
+
})
|
|
105
|
+
})
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Apply filters
|
|
109
|
+
if (props.filterable) {
|
|
110
|
+
Object.entries(filters.value).forEach(([key, value]) => {
|
|
111
|
+
if (value) {
|
|
112
|
+
result = result.filter(row => {
|
|
113
|
+
const rowValue = row[key]
|
|
114
|
+
return rowValue && rowValue.toString().toLowerCase().includes(value.toString().toLowerCase())
|
|
115
|
+
})
|
|
116
|
+
}
|
|
117
|
+
})
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Apply sorting
|
|
121
|
+
if (sortColumn.value && sortDirection.value) {
|
|
122
|
+
result.sort((a, b) => {
|
|
123
|
+
const aValue = a[sortColumn.value]
|
|
124
|
+
const bValue = b[sortColumn.value]
|
|
125
|
+
|
|
126
|
+
if (aValue === bValue) return 0
|
|
127
|
+
|
|
128
|
+
let comparison = 0
|
|
129
|
+
if (aValue < bValue) comparison = -1
|
|
130
|
+
if (aValue > bValue) comparison = 1
|
|
131
|
+
|
|
132
|
+
return sortDirection.value === 'asc' ? comparison : -comparison
|
|
133
|
+
})
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return result
|
|
137
|
+
})
|
|
138
|
+
|
|
139
|
+
const currentPageData = computed(() => {
|
|
140
|
+
if (!props.pagination) return processedData.value
|
|
141
|
+
|
|
142
|
+
const start = (props.currentPage - 1) * props.itemsPerPage
|
|
143
|
+
const end = start + props.itemsPerPage
|
|
144
|
+
return processedData.value.slice(start, end)
|
|
145
|
+
})
|
|
146
|
+
|
|
147
|
+
const toggleSelection = (row: any) => {
|
|
148
|
+
const index = selectedRows.value.findIndex(r => r === row)
|
|
149
|
+
if (index > -1) {
|
|
150
|
+
selectedRows.value.splice(index, 1)
|
|
151
|
+
} else {
|
|
152
|
+
selectedRows.value.push(row)
|
|
153
|
+
}
|
|
154
|
+
emit('selection-change', selectedRows.value)
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const toggleAllSelection = () => {
|
|
158
|
+
if (selectedRows.value.length === currentPageData.value.length) {
|
|
159
|
+
selectedRows.value = []
|
|
160
|
+
} else {
|
|
161
|
+
selectedRows.value = [...currentPageData.value]
|
|
162
|
+
}
|
|
163
|
+
emit('selection-change', selectedRows.value)
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const handleSort = (column: Column) => {
|
|
167
|
+
if (!column.sortable) return
|
|
168
|
+
|
|
169
|
+
if (sortColumn.value === column.key) {
|
|
170
|
+
if (sortDirection.value === 'asc') {
|
|
171
|
+
sortDirection.value = 'desc'
|
|
172
|
+
} else {
|
|
173
|
+
sortDirection.value = null
|
|
174
|
+
sortColumn.value = ''
|
|
175
|
+
}
|
|
176
|
+
} else {
|
|
177
|
+
sortColumn.value = column.key
|
|
178
|
+
sortDirection.value = 'asc'
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
emit('sort-change', sortColumn.value, sortDirection.value)
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
const handleRowClick = (row: any, index: number) => {
|
|
185
|
+
emit('row-click', row, index)
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
const handleSearch = (query: string) => {
|
|
189
|
+
searchQuery.value = query
|
|
190
|
+
emit('search', query)
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
const handleFilterChange = (key: string, value: any) => {
|
|
194
|
+
filters.value[key] = value
|
|
195
|
+
emit('filter-change', filters.value)
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
const isAllSelected = computed(() =>
|
|
199
|
+
currentPageData.value.length > 0 && selectedRows.value.length === currentPageData.value.length
|
|
200
|
+
)
|
|
201
|
+
|
|
202
|
+
const isIndeterminate = computed(() =>
|
|
203
|
+
selectedRows.value.length > 0 && selectedRows.value.length < currentPageData.value.length
|
|
204
|
+
)
|
|
205
|
+
|
|
206
|
+
const containerClasses = computed(() => {
|
|
207
|
+
return cn('w-full space-y-4', props.class)
|
|
208
|
+
})
|
|
209
|
+
|
|
210
|
+
const tableClasses = computed(() => {
|
|
211
|
+
return cn('w-full', props.tableClass)
|
|
212
|
+
})
|
|
213
|
+
|
|
214
|
+
const headerClasses = computed(() => {
|
|
215
|
+
return cn('[&_tr]:border-b', props.headerClass)
|
|
216
|
+
})
|
|
217
|
+
|
|
218
|
+
const bodyClasses = computed(() => {
|
|
219
|
+
const baseClasses = '[&_tr:last-child]:border-0'
|
|
220
|
+
|
|
221
|
+
const styleClasses = {
|
|
222
|
+
'[&_tr]:border-b': props.striped,
|
|
223
|
+
'[&_tr:nth-child(even)]:bg-muted/50': props.striped,
|
|
224
|
+
'[&_tr:hover:bg-muted/50]:not(.selected)': props.hover,
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
return cn(baseClasses, styleClasses, props.bodyClass)
|
|
228
|
+
})
|
|
229
|
+
|
|
230
|
+
// Watch for selection changes
|
|
231
|
+
watch(() => props.currentPage, () => {
|
|
232
|
+
selectedRows.value = []
|
|
233
|
+
emit('selection-change', selectedRows.value)
|
|
234
|
+
})
|
|
235
|
+
</script>
|
|
236
|
+
|
|
237
|
+
<template>
|
|
238
|
+
<div :class="containerClasses">
|
|
239
|
+
<!-- Header with search and filters -->
|
|
240
|
+
<div class="flex items-center justify-between gap-4 mb-4">
|
|
241
|
+
<div class="flex items-center gap-2">
|
|
242
|
+
<!-- Search -->
|
|
243
|
+
<div v-if="searchable" class="relative">
|
|
244
|
+
<Search class="absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground" />
|
|
245
|
+
<Input
|
|
246
|
+
:model-value="searchQuery"
|
|
247
|
+
@update:model-value="handleSearch"
|
|
248
|
+
placeholder="Search..."
|
|
249
|
+
class="pl-9 w-64"
|
|
250
|
+
/>
|
|
251
|
+
</div>
|
|
252
|
+
|
|
253
|
+
<!-- Filters -->
|
|
254
|
+
<div v-if="filterable" class="flex items-center gap-2">
|
|
255
|
+
<Filter class="h-4 w-4 text-muted-foreground" />
|
|
256
|
+
<div v-for="column in columns.filter(c => c.filterable)" :key="column.key">
|
|
257
|
+
<Input
|
|
258
|
+
:model-value="filters[column.key]"
|
|
259
|
+
@update:model-value="(value) => handleFilterChange(column.key, value)"
|
|
260
|
+
:placeholder="`Filter ${column.label}...`"
|
|
261
|
+
class="w-32"
|
|
262
|
+
/>
|
|
263
|
+
</div>
|
|
264
|
+
</div>
|
|
265
|
+
</div>
|
|
266
|
+
|
|
267
|
+
<!-- Total count -->
|
|
268
|
+
<div v-if="showTotal" class="text-sm text-muted-foreground">
|
|
269
|
+
{{ processedData.length }} items total
|
|
270
|
+
</div>
|
|
271
|
+
</div>
|
|
272
|
+
|
|
273
|
+
<!-- Table -->
|
|
274
|
+
<div class="rounded-md border">
|
|
275
|
+
<Table :class="tableClasses">
|
|
276
|
+
<TableHeader :class="headerClasses">
|
|
277
|
+
<TableRow>
|
|
278
|
+
<!-- Select all checkbox -->
|
|
279
|
+
<TableHead v-if="selectable" class="w-12">
|
|
280
|
+
<input
|
|
281
|
+
type="checkbox"
|
|
282
|
+
:checked="isAllSelected"
|
|
283
|
+
:indeterminate="isIndeterminate"
|
|
284
|
+
@change="toggleAllSelection"
|
|
285
|
+
class="rounded border-gray-300"
|
|
286
|
+
/>
|
|
287
|
+
</TableHead>
|
|
288
|
+
|
|
289
|
+
<!-- Column headers -->
|
|
290
|
+
<TableHead
|
|
291
|
+
v-for="column in columns"
|
|
292
|
+
:key="column.key"
|
|
293
|
+
:class="cn(
|
|
294
|
+
'relative',
|
|
295
|
+
{
|
|
296
|
+
'text-left': column.align === 'left' || !column.align,
|
|
297
|
+
'text-center': column.align === 'center',
|
|
298
|
+
'text-right': column.align === 'right',
|
|
299
|
+
'cursor-pointer hover:bg-muted/50': column.sortable
|
|
300
|
+
}
|
|
301
|
+
)"
|
|
302
|
+
:style="{ width: column.width }"
|
|
303
|
+
@click="handleSort(column)"
|
|
304
|
+
>
|
|
305
|
+
<div class="flex items-center gap-1">
|
|
306
|
+
{{ column.label }}
|
|
307
|
+
<div v-if="column.sortable" class="flex flex-col">
|
|
308
|
+
<ChevronUp
|
|
309
|
+
:class="cn(
|
|
310
|
+
'h-3 w-3',
|
|
311
|
+
sortColumn === column.key && sortDirection === 'asc' ? 'text-primary' : 'text-muted-foreground'
|
|
312
|
+
)"
|
|
313
|
+
/>
|
|
314
|
+
<ChevronDown
|
|
315
|
+
:class="cn(
|
|
316
|
+
'h-3 w-3 -mt-1',
|
|
317
|
+
sortColumn === column.key && sortDirection === 'desc' ? 'text-primary' : 'text-muted-foreground'
|
|
318
|
+
)"
|
|
319
|
+
/>
|
|
320
|
+
</div>
|
|
321
|
+
</div>
|
|
322
|
+
</TableHead>
|
|
323
|
+
|
|
324
|
+
<!-- Actions column -->
|
|
325
|
+
<TableHead v-if="actions.length > 0" class="w-16">
|
|
326
|
+
<span class="sr-only">Actions</span>
|
|
327
|
+
</TableHead>
|
|
328
|
+
</TableRow>
|
|
329
|
+
</TableHeader>
|
|
330
|
+
|
|
331
|
+
<TableBody :class="bodyClasses">
|
|
332
|
+
<!-- Loading state -->
|
|
333
|
+
<TableRow v-if="loading">
|
|
334
|
+
<TableCell :colspan="columns.length + (selectable ? 1 : 0) + (actions.length > 0 ? 1 : 0)" class="text-center py-8">
|
|
335
|
+
<div class="flex items-center justify-center space-x-2">
|
|
336
|
+
<div class="animate-spin rounded-full h-4 w-4 border-b-2 border-primary"></div>
|
|
337
|
+
<span>{{ loadingMessage }}</span>
|
|
338
|
+
</div>
|
|
339
|
+
</TableCell>
|
|
340
|
+
</TableRow>
|
|
341
|
+
|
|
342
|
+
<!-- Empty state -->
|
|
343
|
+
<TableRow v-else-if="currentPageData.length === 0">
|
|
344
|
+
<TableCell :colspan="columns.length + (selectable ? 1 : 0) + (actions.length > 0 ? 1 : 0)" class="text-center py-8">
|
|
345
|
+
{{ emptyMessage }}
|
|
346
|
+
</TableCell>
|
|
347
|
+
</TableRow>
|
|
348
|
+
|
|
349
|
+
<!-- Data rows -->
|
|
350
|
+
<TableRow
|
|
351
|
+
v-else
|
|
352
|
+
v-for="(row, index) in currentPageData"
|
|
353
|
+
:key="`row-${index}`"
|
|
354
|
+
:class="{
|
|
355
|
+
'selected': selectedRows.includes(row)
|
|
356
|
+
}"
|
|
357
|
+
@click="handleRowClick(row, index)"
|
|
358
|
+
class="cursor-pointer"
|
|
359
|
+
>
|
|
360
|
+
<!-- Selection checkbox -->
|
|
361
|
+
<TableCell v-if="selectable" class="w-12">
|
|
362
|
+
<input
|
|
363
|
+
type="checkbox"
|
|
364
|
+
:checked="selectedRows.includes(row)"
|
|
365
|
+
@change="toggleSelection(row)"
|
|
366
|
+
class="rounded border-gray-300"
|
|
367
|
+
/>
|
|
368
|
+
</TableCell>
|
|
369
|
+
|
|
370
|
+
<!-- Data cells -->
|
|
371
|
+
<TableCell
|
|
372
|
+
v-for="column in columns"
|
|
373
|
+
:key="column.key"
|
|
374
|
+
:class="cn(
|
|
375
|
+
{
|
|
376
|
+
'text-left': column.align === 'left' || !column.align,
|
|
377
|
+
'text-center': column.align === 'center',
|
|
378
|
+
'text-right': column.align === 'right'
|
|
379
|
+
}
|
|
380
|
+
)"
|
|
381
|
+
>
|
|
382
|
+
<slot
|
|
383
|
+
:name="`cell-${column.key}`"
|
|
384
|
+
:row="row"
|
|
385
|
+
:value="row[column.key]"
|
|
386
|
+
:column="column"
|
|
387
|
+
:index="index"
|
|
388
|
+
>
|
|
389
|
+
<span v-if="column.render">
|
|
390
|
+
{{ column.render(row[column.key], row, index) }}
|
|
391
|
+
</span>
|
|
392
|
+
<span v-else>
|
|
393
|
+
{{ row[column.key] }}
|
|
394
|
+
</span>
|
|
395
|
+
</slot>
|
|
396
|
+
</TableCell>
|
|
397
|
+
|
|
398
|
+
<!-- Actions -->
|
|
399
|
+
<TableCell v-if="actions.length > 0">
|
|
400
|
+
<div class="flex items-center justify-end space-x-1">
|
|
401
|
+
<Button
|
|
402
|
+
v-for="action in actions"
|
|
403
|
+
:key="action.key"
|
|
404
|
+
:variant="action.variant || 'ghost'"
|
|
405
|
+
:size="sm"
|
|
406
|
+
:disabled="action.disabled ? action.disabled(row) : false"
|
|
407
|
+
@click.stop="action.onClick(row, index)"
|
|
408
|
+
>
|
|
409
|
+
<component v-if="action.icon" :is="action.icon" class="h-4 w-4" />
|
|
410
|
+
{{ action.label }}
|
|
411
|
+
</Button>
|
|
412
|
+
</div>
|
|
413
|
+
</TableCell>
|
|
414
|
+
</TableRow>
|
|
415
|
+
</TableBody>
|
|
416
|
+
</Table>
|
|
417
|
+
</div>
|
|
418
|
+
|
|
419
|
+
<!-- Pagination -->
|
|
420
|
+
<div v-if="pagination" class="mt-4">
|
|
421
|
+
<slot name="pagination" :current-page="currentPage" :total-items="processedData.length">
|
|
422
|
+
<!-- Built-in pagination placeholder -->
|
|
423
|
+
<div class="flex items-center justify-between">
|
|
424
|
+
<div class="text-sm text-muted-foreground">
|
|
425
|
+
Showing {{ (currentPage - 1) * itemsPerPage + 1 }} to {{ Math.min(currentPage * itemsPerPage, processedData.length) }} of {{ processedData.length }} items
|
|
426
|
+
</div>
|
|
427
|
+
<div class="text-sm text-muted-foreground">
|
|
428
|
+
Page {{ currentPage }} of {{ Math.ceil(processedData.length / itemsPerPage) }}
|
|
429
|
+
</div>
|
|
430
|
+
</div>
|
|
431
|
+
</slot>
|
|
432
|
+
</div>
|
|
433
|
+
</div>
|
|
434
|
+
</template>
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
import { FileX, Search, InBox, AlertCircle, Info } from 'lucide-vue-next'
|
|
4
|
+
import { NSLottieAnimation } from '@/components/NS/lottie-animation'
|
|
5
|
+
import { cn } from '@/lib/utils'
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
title?: string
|
|
9
|
+
description?: string
|
|
10
|
+
icon?: string | object
|
|
11
|
+
lottiePath?: string // Path to Lottie JSON file
|
|
12
|
+
lottieData?: any // Direct Lottie animation data
|
|
13
|
+
animationTitle?: string
|
|
14
|
+
size?: 'default' | 'sm' | 'lg'
|
|
15
|
+
variant?: 'default' | 'muted'
|
|
16
|
+
loop?: boolean | number
|
|
17
|
+
animateOnHover?: boolean
|
|
18
|
+
autoPlay?: boolean
|
|
19
|
+
class?: string
|
|
20
|
+
iconClass?: string
|
|
21
|
+
titleClass?: string
|
|
22
|
+
descriptionClass?: string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
26
|
+
title: 'No data available',
|
|
27
|
+
size: 'default',
|
|
28
|
+
variant: 'default',
|
|
29
|
+
loop: true,
|
|
30
|
+
animateOnHover: false,
|
|
31
|
+
autoPlay: true,
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
const DefaultIcon = computed(() => {
|
|
35
|
+
if (props.icon) {
|
|
36
|
+
return null // Use custom icon
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Choose appropriate default icon based on title content
|
|
40
|
+
const title = props.title?.toLowerCase() || ''
|
|
41
|
+
|
|
42
|
+
if (title.includes('search') || title.includes('find') || title.includes('result')) {
|
|
43
|
+
return Search
|
|
44
|
+
} else if (title.includes('empty') || title.includes('no') || title.includes('data')) {
|
|
45
|
+
return FileX
|
|
46
|
+
} else if (title.includes('message') || title.includes('notification') || title.includes('alert')) {
|
|
47
|
+
return InBox
|
|
48
|
+
} else if (title.includes('error') || title.includes('warning')) {
|
|
49
|
+
return AlertCircle
|
|
50
|
+
} else {
|
|
51
|
+
return Info
|
|
52
|
+
}
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
const iconComponent = computed(() => {
|
|
56
|
+
if (typeof props.icon === 'object') {
|
|
57
|
+
return props.icon // Vue component
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (typeof props.icon === 'string') {
|
|
61
|
+
// Map string to Lucide icons
|
|
62
|
+
const iconMap: Record<string, any> = {
|
|
63
|
+
'file-x': FileX,
|
|
64
|
+
'search': Search,
|
|
65
|
+
'inbox': InBox,
|
|
66
|
+
'alert-circle': AlertCircle,
|
|
67
|
+
'info': Info,
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return iconMap[props.icon] || DefaultIcon.value
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return DefaultIcon.value
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
const containerClasses = computed(() => {
|
|
77
|
+
const sizeClasses = {
|
|
78
|
+
default: 'p-8',
|
|
79
|
+
sm: 'p-4',
|
|
80
|
+
lg: 'p-12'
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const variantClasses = {
|
|
84
|
+
default: 'text-foreground',
|
|
85
|
+
muted: 'text-muted-foreground'
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return cn(
|
|
89
|
+
'flex flex-col items-center justify-center text-center',
|
|
90
|
+
sizeClasses[props.size],
|
|
91
|
+
variantClasses[props.variant],
|
|
92
|
+
props.class
|
|
93
|
+
)
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
const iconClasses = computed(() => {
|
|
97
|
+
const sizeClasses = {
|
|
98
|
+
default: 'h-16 w-16',
|
|
99
|
+
sm: 'h-12 w-12',
|
|
100
|
+
lg: 'h-20 w-20'
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return cn('text-muted-foreground', sizeClasses[props.size], props.iconClass)
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
const titleClasses = computed(() => {
|
|
107
|
+
return cn(
|
|
108
|
+
'text-lg font-semibold mb-2',
|
|
109
|
+
{
|
|
110
|
+
'text-foreground': props.variant === 'default',
|
|
111
|
+
'text-muted-foreground': props.variant === 'muted'
|
|
112
|
+
},
|
|
113
|
+
props.titleClass
|
|
114
|
+
)
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
const descriptionClasses = computed(() => {
|
|
118
|
+
return cn(
|
|
119
|
+
'text-sm max-w-md mb-6',
|
|
120
|
+
{
|
|
121
|
+
'text-muted-foreground': props.variant === 'default',
|
|
122
|
+
'text-muted-foreground/70': props.variant === 'muted'
|
|
123
|
+
},
|
|
124
|
+
props.descriptionClass
|
|
125
|
+
)
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
const hasIconSlot = computed(() => !!$slots.icon)
|
|
129
|
+
const hasDescriptionSlot = computed(() => !!$slots.description)
|
|
130
|
+
const hasActionsSlot = computed(() => !!$slots.actions)
|
|
131
|
+
</script>
|
|
132
|
+
|
|
133
|
+
<template>
|
|
134
|
+
<div :class="containerClasses">
|
|
135
|
+
<!-- Icon section -->
|
|
136
|
+
<div class="mb-4">
|
|
137
|
+
<slot name="icon">
|
|
138
|
+
<!-- Lottie animation if provided -->
|
|
139
|
+
<NSLottieAnimation
|
|
140
|
+
v-if="lottiePath || lottieData"
|
|
141
|
+
:path="lottiePath"
|
|
142
|
+
:animation-data="lottieData"
|
|
143
|
+
:width="48"
|
|
144
|
+
:height="48"
|
|
145
|
+
:class="iconClasses"
|
|
146
|
+
:title="animationTitle || title"
|
|
147
|
+
:play-on-hover="true"
|
|
148
|
+
:stop-on-hover-out="true"
|
|
149
|
+
/>
|
|
150
|
+
|
|
151
|
+
<!-- Custom icon or default Lucide icon -->
|
|
152
|
+
<component
|
|
153
|
+
v-else-if="iconComponent && !hasIconSlot"
|
|
154
|
+
:is="iconComponent"
|
|
155
|
+
:class="iconClasses"
|
|
156
|
+
/>
|
|
157
|
+
</slot>
|
|
158
|
+
</div>
|
|
159
|
+
|
|
160
|
+
<!-- Title section -->
|
|
161
|
+
<h3
|
|
162
|
+
v-if="title || $slots.title"
|
|
163
|
+
:class="titleClasses"
|
|
164
|
+
>
|
|
165
|
+
<slot name="title">{{ title }}</slot>
|
|
166
|
+
</h3>
|
|
167
|
+
|
|
168
|
+
<!-- Description section -->
|
|
169
|
+
<div
|
|
170
|
+
v-if="hasDescriptionSlot || description"
|
|
171
|
+
:class="descriptionClasses"
|
|
172
|
+
>
|
|
173
|
+
<slot name="description">
|
|
174
|
+
<p>{{ description }}</p>
|
|
175
|
+
</slot>
|
|
176
|
+
</div>
|
|
177
|
+
|
|
178
|
+
<!-- Actions section -->
|
|
179
|
+
<div v-if="hasActionsSlot" class="mt-4">
|
|
180
|
+
<slot name="actions" />
|
|
181
|
+
</div>
|
|
182
|
+
|
|
183
|
+
<!-- Extra content section -->
|
|
184
|
+
<div v-if="$slots.extra" class="mt-6">
|
|
185
|
+
<slot name="extra" />
|
|
186
|
+
</div>
|
|
187
|
+
</div>
|
|
188
|
+
</template>
|