@slexn/codecenter-ui 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/LICENSE +34 -0
- package/README.md +148 -0
- package/components.json +20 -0
- package/dist/codecenter-ui.cjs +10 -0
- package/dist/codecenter-ui.js +17995 -0
- package/dist/components/ui/accordion/Accordion.vue.d.ts +28 -0
- package/dist/components/ui/accordion/AccordionContent.vue.d.ts +22 -0
- package/dist/components/ui/accordion/AccordionItem.vue.d.ts +24 -0
- package/dist/components/ui/accordion/AccordionTrigger.vue.d.ts +22 -0
- package/dist/components/ui/accordion/index.d.ts +4 -0
- package/dist/components/ui/alert/Alert.vue.d.ts +32 -0
- package/dist/components/ui/alert/AlertDescription.vue.d.ts +24 -0
- package/dist/components/ui/alert/AlertTitle.vue.d.ts +24 -0
- package/dist/components/ui/alert/index.d.ts +4 -0
- package/dist/components/ui/alert/variants.d.ts +5 -0
- package/dist/components/ui/button/Button.vue.d.ts +27 -0
- package/dist/components/ui/button/index.d.ts +2 -0
- package/dist/components/ui/button/variants.d.ts +6 -0
- package/dist/components/ui/button-group/ButtonGroup.vue.d.ts +25 -0
- package/dist/components/ui/button-group/index.d.ts +2 -0
- package/dist/components/ui/card/Card.vue.d.ts +21 -0
- package/dist/components/ui/card/CardContent.vue.d.ts +21 -0
- package/dist/components/ui/card/CardDescription.vue.d.ts +21 -0
- package/dist/components/ui/card/CardFooter.vue.d.ts +21 -0
- package/dist/components/ui/card/CardHeader.vue.d.ts +21 -0
- package/dist/components/ui/card/CardTitle.vue.d.ts +21 -0
- package/dist/components/ui/card/index.d.ts +6 -0
- package/dist/components/ui/chart/Chart.vue.d.ts +92 -0
- package/dist/components/ui/chart/index.d.ts +2 -0
- package/dist/components/ui/chat/Chat.vue.d.ts +190 -0
- package/dist/components/ui/chat/ChatAttachments.vue.d.ts +11 -0
- package/dist/components/ui/chat/ChatCodeBlock.vue.d.ts +16 -0
- package/dist/components/ui/chat/code-block.d.ts +27 -0
- package/dist/components/ui/chat/index.d.ts +6 -0
- package/dist/components/ui/chat/types.d.ts +15 -0
- package/dist/components/ui/checkbox/Checkbox.vue.d.ts +29 -0
- package/dist/components/ui/checkbox/index.d.ts +1 -0
- package/dist/components/ui/commit/Commit.vue.d.ts +62 -0
- package/dist/components/ui/commit/index.d.ts +2 -0
- package/dist/components/ui/contribution-graph/ContributionGraph.vue.d.ts +87 -0
- package/dist/components/ui/contribution-graph/index.d.ts +2 -0
- package/dist/components/ui/data-table/DataTable.vue.d.ts +109 -0
- package/dist/components/ui/data-table/index.d.ts +2 -0
- package/dist/components/ui/date-picker/DatePicker.vue.d.ts +37 -0
- package/dist/components/ui/date-picker/index.d.ts +2 -0
- package/dist/components/ui/dialog/Dialog.vue.d.ts +25 -0
- package/dist/components/ui/dialog/DialogClose.vue.d.ts +18 -0
- package/dist/components/ui/dialog/DialogContent.vue.d.ts +39 -0
- package/dist/components/ui/dialog/DialogDescription.vue.d.ts +22 -0
- package/dist/components/ui/dialog/DialogFooter.vue.d.ts +21 -0
- package/dist/components/ui/dialog/DialogHeader.vue.d.ts +21 -0
- package/dist/components/ui/dialog/DialogOverlay.vue.d.ts +22 -0
- package/dist/components/ui/dialog/DialogScrollContent.vue.d.ts +36 -0
- package/dist/components/ui/dialog/DialogTitle.vue.d.ts +22 -0
- package/dist/components/ui/dialog/DialogTrigger.vue.d.ts +18 -0
- package/dist/components/ui/dialog/index.d.ts +10 -0
- package/dist/components/ui/diff/DiffTool.vue.d.ts +21 -0
- package/dist/components/ui/diff/diff-parser.d.ts +30 -0
- package/dist/components/ui/diff/diff-tool.d.ts +36 -0
- package/dist/components/ui/diff/index.d.ts +2 -0
- package/dist/components/ui/dropdown-menu/DropdownMenu.vue.d.ts +24 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuCheckboxItem.vue.d.ts +29 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuContent.vue.d.ts +36 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuGroup.vue.d.ts +18 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuItem.vue.d.ts +26 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuLabel.vue.d.ts +23 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuRadioGroup.vue.d.ts +22 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuRadioItem.vue.d.ts +27 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuSeparator.vue.d.ts +7 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuShortcut.vue.d.ts +21 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuSub.vue.d.ts +22 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuSubContent.vue.d.ts +38 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuSubTrigger.vue.d.ts +23 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuTrigger.vue.d.ts +18 -0
- package/dist/components/ui/dropdown-menu/index.d.ts +15 -0
- package/dist/components/ui/gauge/Gauge.vue.d.ts +62 -0
- package/dist/components/ui/gauge/index.d.ts +2 -0
- package/dist/components/ui/git-graph/GitGraph.vue.d.ts +59 -0
- package/dist/components/ui/git-graph/index.d.ts +2 -0
- package/dist/components/ui/incident-timeline/IncidentTimeline.vue.d.ts +50 -0
- package/dist/components/ui/incident-timeline/index.d.ts +2 -0
- package/dist/components/ui/input/Input.vue.d.ts +14 -0
- package/dist/components/ui/input/InputControl.vue.d.ts +14 -0
- package/dist/components/ui/input/InputFieldGroup.vue.d.ts +21 -0
- package/dist/components/ui/input/index.d.ts +4 -0
- package/dist/components/ui/input/types.d.ts +31 -0
- package/dist/components/ui/kpi-card/KpiCard.vue.d.ts +46 -0
- package/dist/components/ui/kpi-card/index.d.ts +2 -0
- package/dist/components/ui/kpi-line-card/KpiLineCard.vue.d.ts +66 -0
- package/dist/components/ui/kpi-line-card/index.d.ts +2 -0
- package/dist/components/ui/model-selector/ModelSelector.vue.d.ts +41 -0
- package/dist/components/ui/model-selector/index.d.ts +2 -0
- package/dist/components/ui/model-selector/types.d.ts +12 -0
- package/dist/components/ui/network-graph/NetworkGraph.vue.d.ts +75 -0
- package/dist/components/ui/network-graph/index.d.ts +2 -0
- package/dist/components/ui/pagination/Pagination.vue.d.ts +29 -0
- package/dist/components/ui/pagination/PaginationContent.vue.d.ts +29 -0
- package/dist/components/ui/pagination/PaginationEllipsis.vue.d.ts +22 -0
- package/dist/components/ui/pagination/PaginationFirst.vue.d.ts +26 -0
- package/dist/components/ui/pagination/PaginationItem.vue.d.ts +28 -0
- package/dist/components/ui/pagination/PaginationLast.vue.d.ts +26 -0
- package/dist/components/ui/pagination/PaginationNext.vue.d.ts +26 -0
- package/dist/components/ui/pagination/PaginationPrevious.vue.d.ts +26 -0
- package/dist/components/ui/pagination/index.d.ts +8 -0
- package/dist/components/ui/profile/Profile.vue.d.ts +30 -0
- package/dist/components/ui/profile/ProfileGroup.vue.d.ts +37 -0
- package/dist/components/ui/profile/index.d.ts +4 -0
- package/dist/components/ui/progress/Progress.vue.d.ts +36 -0
- package/dist/components/ui/progress/index.d.ts +2 -0
- package/dist/components/ui/prompt-input/PromptInput.vue.d.ts +150 -0
- package/dist/components/ui/prompt-input/index.d.ts +2 -0
- package/dist/components/ui/prompt-input/types.d.ts +61 -0
- package/dist/components/ui/radio-group/RadioGroup.vue.d.ts +30 -0
- package/dist/components/ui/radio-group/RadioGroupItem.vue.d.ts +12 -0
- package/dist/components/ui/radio-group/RadioGroupOption.vue.d.ts +28 -0
- package/dist/components/ui/radio-group/index.d.ts +3 -0
- package/dist/components/ui/reasoning/Reasoning.vue.d.ts +40 -0
- package/dist/components/ui/reasoning/index.d.ts +2 -0
- package/dist/components/ui/reasoning/types.d.ts +26 -0
- package/dist/components/ui/select/Select.vue.d.ts +28 -0
- package/dist/components/ui/select/SelectContent.vue.d.ts +46 -0
- package/dist/components/ui/select/SelectGroup.vue.d.ts +18 -0
- package/dist/components/ui/select/SelectItem.vue.d.ts +26 -0
- package/dist/components/ui/select/SelectItemText.vue.d.ts +18 -0
- package/dist/components/ui/select/SelectLabel.vue.d.ts +22 -0
- package/dist/components/ui/select/SelectScrollDownButton.vue.d.ts +22 -0
- package/dist/components/ui/select/SelectScrollUpButton.vue.d.ts +22 -0
- package/dist/components/ui/select/SelectSeparator.vue.d.ts +7 -0
- package/dist/components/ui/select/SelectTrigger.vue.d.ts +25 -0
- package/dist/components/ui/select/SelectValue.vue.d.ts +18 -0
- package/dist/components/ui/select/index.d.ts +11 -0
- package/dist/components/ui/select/search.d.ts +18 -0
- package/dist/components/ui/separator/Separator.vue.d.ts +6 -0
- package/dist/components/ui/separator/index.d.ts +2 -0
- package/dist/components/ui/separator/types.d.ts +7 -0
- package/dist/components/ui/shimmer/Shimmer.vue.d.ts +37 -0
- package/dist/components/ui/shimmer/index.d.ts +2 -0
- package/dist/components/ui/sidebar/Sidebar.vue.d.ts +24 -0
- package/dist/components/ui/sidebar/SidebarContent.vue.d.ts +21 -0
- package/dist/components/ui/sidebar/SidebarFooter.vue.d.ts +21 -0
- package/dist/components/ui/sidebar/SidebarGroup.vue.d.ts +21 -0
- package/dist/components/ui/sidebar/SidebarGroupAction.vue.d.ts +24 -0
- package/dist/components/ui/sidebar/SidebarGroupContent.vue.d.ts +21 -0
- package/dist/components/ui/sidebar/SidebarGroupLabel.vue.d.ts +24 -0
- package/dist/components/ui/sidebar/SidebarHeader.vue.d.ts +21 -0
- package/dist/components/ui/sidebar/SidebarInput.vue.d.ts +6 -0
- package/dist/components/ui/sidebar/SidebarInset.vue.d.ts +21 -0
- package/dist/components/ui/sidebar/SidebarMenu.vue.d.ts +21 -0
- package/dist/components/ui/sidebar/SidebarMenuAction.vue.d.ts +25 -0
- package/dist/components/ui/sidebar/SidebarMenuBadge.vue.d.ts +21 -0
- package/dist/components/ui/sidebar/SidebarMenuButton.vue.d.ts +25 -0
- package/dist/components/ui/sidebar/SidebarMenuButtonChild.vue.d.ts +30 -0
- package/dist/components/ui/sidebar/SidebarMenuItem.vue.d.ts +21 -0
- package/dist/components/ui/sidebar/SidebarMenuSub.vue.d.ts +21 -0
- package/dist/components/ui/sidebar/SidebarMenuSubButton.vue.d.ts +27 -0
- package/dist/components/ui/sidebar/SidebarMenuSubItem.vue.d.ts +21 -0
- package/dist/components/ui/sidebar/SidebarProvider.vue.d.ts +36 -0
- package/dist/components/ui/sidebar/SidebarRail.vue.d.ts +21 -0
- package/dist/components/ui/sidebar/SidebarSeparator.vue.d.ts +6 -0
- package/dist/components/ui/sidebar/SidebarTrigger.vue.d.ts +6 -0
- package/dist/components/ui/sidebar/context.d.ts +19 -0
- package/dist/components/ui/sidebar/index.d.ts +26 -0
- package/dist/components/ui/sidebar/types.d.ts +11 -0
- package/dist/components/ui/sidebar/variants.d.ts +6 -0
- package/dist/components/ui/skeleton/Skeleton.vue.d.ts +18 -0
- package/dist/components/ui/skeleton/index.d.ts +2 -0
- package/dist/components/ui/sonner/Sonner.vue.d.ts +5 -0
- package/dist/components/ui/sonner/index.d.ts +2 -0
- package/dist/components/ui/spinner/Spinner.vue.d.ts +11 -0
- package/dist/components/ui/spinner/index.d.ts +1 -0
- package/dist/components/ui/stepper/Stepper.vue.d.ts +38 -0
- package/dist/components/ui/stepper/StepperDescription.vue.d.ts +22 -0
- package/dist/components/ui/stepper/StepperIndicator.vue.d.ts +30 -0
- package/dist/components/ui/stepper/StepperItem.vue.d.ts +24 -0
- package/dist/components/ui/stepper/StepperSeparator.vue.d.ts +7 -0
- package/dist/components/ui/stepper/StepperTitle.vue.d.ts +22 -0
- package/dist/components/ui/stepper/StepperTrigger.vue.d.ts +22 -0
- package/dist/components/ui/stepper/index.d.ts +7 -0
- package/dist/components/ui/switch/Switch.vue.d.ts +12 -0
- package/dist/components/ui/switch/index.d.ts +1 -0
- package/dist/components/ui/table/Table.vue.d.ts +22 -0
- package/dist/components/ui/table/TableBody.vue.d.ts +21 -0
- package/dist/components/ui/table/TableCaption.vue.d.ts +21 -0
- package/dist/components/ui/table/TableCell.vue.d.ts +22 -0
- package/dist/components/ui/table/TableEmpty.vue.d.ts +24 -0
- package/dist/components/ui/table/TableFooter.vue.d.ts +21 -0
- package/dist/components/ui/table/TableHead.vue.d.ts +21 -0
- package/dist/components/ui/table/TableHeader.vue.d.ts +21 -0
- package/dist/components/ui/table/TableRow.vue.d.ts +21 -0
- package/dist/components/ui/table/index.d.ts +9 -0
- package/dist/components/ui/tabs/Tabs.vue.d.ts +28 -0
- package/dist/components/ui/tabs/TabsContent.vue.d.ts +22 -0
- package/dist/components/ui/tabs/TabsList.vue.d.ts +22 -0
- package/dist/components/ui/tabs/TabsTrigger.vue.d.ts +22 -0
- package/dist/components/ui/tabs/index.d.ts +4 -0
- package/dist/components/ui/tag/Tag.vue.d.ts +35 -0
- package/dist/components/ui/tag/index.d.ts +2 -0
- package/dist/components/ui/tag/variants.d.ts +6 -0
- package/dist/components/ui/textarea/Textarea.vue.d.ts +14 -0
- package/dist/components/ui/textarea/TextareaControl.vue.d.ts +14 -0
- package/dist/components/ui/textarea/TextareaFieldGroup.vue.d.ts +21 -0
- package/dist/components/ui/textarea/index.d.ts +4 -0
- package/dist/components/ui/textarea/types.d.ts +32 -0
- package/dist/components/ui/tool/Tool.vue.d.ts +61 -0
- package/dist/components/ui/tool/index.d.ts +2 -0
- package/dist/components/ui/tooltip/Tooltip.vue.d.ts +24 -0
- package/dist/components/ui/tooltip/TooltipContent.vue.d.ts +32 -0
- package/dist/components/ui/tooltip/TooltipProvider.vue.d.ts +20 -0
- package/dist/components/ui/tooltip/TooltipTrigger.vue.d.ts +18 -0
- package/dist/components/ui/tooltip/index.d.ts +4 -0
- package/dist/docs/component-docs.d.ts +18 -0
- package/dist/docs/markdown.d.ts +27 -0
- package/dist/index.d.ts +45 -0
- package/dist/lib/code-highlight.d.ts +11 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/styles.css +3 -0
- package/package.json +76 -0
- package/public/r/accordion.json +52 -0
- package/public/r/alert.json +51 -0
- package/public/r/button-group.json +31 -0
- package/public/r/button.json +39 -0
- package/public/r/card.json +61 -0
- package/public/r/chart.json +31 -0
- package/public/r/chat.json +186 -0
- package/public/r/checkbox.json +34 -0
- package/public/r/commit.json +32 -0
- package/public/r/contribution-graph.json +63 -0
- package/public/r/data-table.json +197 -0
- package/public/r/date-picker.json +33 -0
- package/public/r/dialog.json +88 -0
- package/public/r/diff.json +71 -0
- package/public/r/dropdown-menu.json +112 -0
- package/public/r/gauge.json +31 -0
- package/public/r/git-graph.json +32 -0
- package/public/r/incident-timeline.json +64 -0
- package/public/r/input.json +49 -0
- package/public/r/kpi-card.json +32 -0
- package/public/r/kpi-line-card.json +32 -0
- package/public/r/model-selector.json +148 -0
- package/public/r/network-graph.json +33 -0
- package/public/r/pagination.json +95 -0
- package/public/r/profile.json +37 -0
- package/public/r/progress.json +31 -0
- package/public/r/prompt-input.json +293 -0
- package/public/r/radio-group.json +45 -0
- package/public/r/reasoning.json +38 -0
- package/public/r/registry.json +2512 -0
- package/public/r/select.json +100 -0
- package/public/r/separator.json +37 -0
- package/public/r/shimmer.json +31 -0
- package/public/r/sidebar.json +221 -0
- package/public/r/skeleton.json +31 -0
- package/public/r/sonner.json +33 -0
- package/public/r/spinner.json +31 -0
- package/public/r/stepper.json +70 -0
- package/public/r/switch.json +33 -0
- package/public/r/table.json +79 -0
- package/public/r/tabs.json +51 -0
- package/public/r/tag.json +39 -0
- package/public/r/textarea.json +49 -0
- package/public/r/tool.json +32 -0
- package/public/r/tooltip.json +51 -0
- package/registry.json +2512 -0
- package/src/components/docs/MarkdownContent.vue +106 -0
- package/src/components/ui/accordion/Accordion.vue +24 -0
- package/src/components/ui/accordion/AccordionContent.vue +62 -0
- package/src/components/ui/accordion/AccordionItem.vue +23 -0
- package/src/components/ui/accordion/AccordionTrigger.vue +38 -0
- package/src/components/ui/accordion/index.ts +4 -0
- package/src/components/ui/alert/Alert.vue +40 -0
- package/src/components/ui/alert/AlertDescription.vue +24 -0
- package/src/components/ui/alert/AlertTitle.vue +24 -0
- package/src/components/ui/alert/index.ts +4 -0
- package/src/components/ui/alert/variants.ts +19 -0
- package/src/components/ui/button/Button.vue +27 -0
- package/src/components/ui/button/index.ts +2 -0
- package/src/components/ui/button/variants.ts +32 -0
- package/src/components/ui/button-group/ButtonGroup.vue +31 -0
- package/src/components/ui/button-group/index.ts +2 -0
- package/src/components/ui/card/Card.vue +17 -0
- package/src/components/ui/card/CardContent.vue +14 -0
- package/src/components/ui/card/CardDescription.vue +14 -0
- package/src/components/ui/card/CardFooter.vue +14 -0
- package/src/components/ui/card/CardHeader.vue +17 -0
- package/src/components/ui/card/CardTitle.vue +14 -0
- package/src/components/ui/card/index.ts +6 -0
- package/src/components/ui/chart/Chart.vue +1042 -0
- package/src/components/ui/chart/index.ts +13 -0
- package/src/components/ui/chat/Chat.vue +1297 -0
- package/src/components/ui/chat/ChatAttachments.vue +278 -0
- package/src/components/ui/chat/ChatCodeBlock.vue +283 -0
- package/src/components/ui/chat/code-block.ts +30 -0
- package/src/components/ui/chat/index.ts +24 -0
- package/src/components/ui/chat/types.ts +23 -0
- package/src/components/ui/checkbox/Checkbox.vue +38 -0
- package/src/components/ui/checkbox/index.ts +1 -0
- package/src/components/ui/commit/Commit.vue +423 -0
- package/src/components/ui/commit/index.ts +9 -0
- package/src/components/ui/contribution-graph/ContributionGraph.vue +719 -0
- package/src/components/ui/contribution-graph/index.ts +9 -0
- package/src/components/ui/data-table/DataTable.vue +534 -0
- package/src/components/ui/data-table/index.ts +9 -0
- package/src/components/ui/date-picker/DatePicker.vue +649 -0
- package/src/components/ui/date-picker/index.ts +7 -0
- package/src/components/ui/dialog/Dialog.vue +19 -0
- package/src/components/ui/dialog/DialogClose.vue +17 -0
- package/src/components/ui/dialog/DialogContent.vue +60 -0
- package/src/components/ui/dialog/DialogDescription.vue +23 -0
- package/src/components/ui/dialog/DialogFooter.vue +17 -0
- package/src/components/ui/dialog/DialogHeader.vue +17 -0
- package/src/components/ui/dialog/DialogOverlay.vue +23 -0
- package/src/components/ui/dialog/DialogScrollContent.vue +69 -0
- package/src/components/ui/dialog/DialogTitle.vue +23 -0
- package/src/components/ui/dialog/DialogTrigger.vue +17 -0
- package/src/components/ui/dialog/index.ts +10 -0
- package/src/components/ui/diff/DiffTool.vue +513 -0
- package/src/components/ui/diff/diff-parser.ts +423 -0
- package/src/components/ui/diff/diff-tool.ts +39 -0
- package/src/components/ui/diff/index.ts +5 -0
- package/src/components/ui/dropdown-menu/DropdownMenu.vue +19 -0
- package/src/components/ui/dropdown-menu/DropdownMenuCheckboxItem.vue +39 -0
- package/src/components/ui/dropdown-menu/DropdownMenuContent.vue +39 -0
- package/src/components/ui/dropdown-menu/DropdownMenuGroup.vue +15 -0
- package/src/components/ui/dropdown-menu/DropdownMenuItem.vue +31 -0
- package/src/components/ui/dropdown-menu/DropdownMenuLabel.vue +23 -0
- package/src/components/ui/dropdown-menu/DropdownMenuRadioGroup.vue +21 -0
- package/src/components/ui/dropdown-menu/DropdownMenuRadioItem.vue +40 -0
- package/src/components/ui/dropdown-menu/DropdownMenuSeparator.vue +23 -0
- package/src/components/ui/dropdown-menu/DropdownMenuShortcut.vue +17 -0
- package/src/components/ui/dropdown-menu/DropdownMenuSub.vue +18 -0
- package/src/components/ui/dropdown-menu/DropdownMenuSubContent.vue +27 -0
- package/src/components/ui/dropdown-menu/DropdownMenuSubTrigger.vue +31 -0
- package/src/components/ui/dropdown-menu/DropdownMenuTrigger.vue +17 -0
- package/src/components/ui/dropdown-menu/index.ts +16 -0
- package/src/components/ui/gauge/Gauge.vue +725 -0
- package/src/components/ui/gauge/index.ts +9 -0
- package/src/components/ui/git-graph/GitGraph.vue +715 -0
- package/src/components/ui/git-graph/index.ts +9 -0
- package/src/components/ui/incident-timeline/IncidentTimeline.vue +360 -0
- package/src/components/ui/incident-timeline/index.ts +7 -0
- package/src/components/ui/input/Input.vue +159 -0
- package/src/components/ui/input/InputControl.vue +135 -0
- package/src/components/ui/input/InputFieldGroup.vue +14 -0
- package/src/components/ui/input/index.ts +9 -0
- package/src/components/ui/input/types.ts +34 -0
- package/src/components/ui/kpi-card/KpiCard.vue +268 -0
- package/src/components/ui/kpi-card/index.ts +9 -0
- package/src/components/ui/kpi-line-card/KpiLineCard.vue +622 -0
- package/src/components/ui/kpi-line-card/index.ts +11 -0
- package/src/components/ui/model-selector/ModelSelector.vue +328 -0
- package/src/components/ui/model-selector/index.ts +6 -0
- package/src/components/ui/model-selector/types.ts +15 -0
- package/src/components/ui/network-graph/NetworkGraph.vue +902 -0
- package/src/components/ui/network-graph/index.ts +7 -0
- package/src/components/ui/pagination/Pagination.vue +26 -0
- package/src/components/ui/pagination/PaginationContent.vue +24 -0
- package/src/components/ui/pagination/PaginationEllipsis.vue +27 -0
- package/src/components/ui/pagination/PaginationFirst.vue +33 -0
- package/src/components/ui/pagination/PaginationItem.vue +39 -0
- package/src/components/ui/pagination/PaginationLast.vue +33 -0
- package/src/components/ui/pagination/PaginationNext.vue +33 -0
- package/src/components/ui/pagination/PaginationPrevious.vue +33 -0
- package/src/components/ui/pagination/index.ts +8 -0
- package/src/components/ui/profile/Profile.vue +226 -0
- package/src/components/ui/profile/ProfileGroup.vue +96 -0
- package/src/components/ui/profile/index.ts +8 -0
- package/src/components/ui/progress/Progress.vue +271 -0
- package/src/components/ui/progress/index.ts +9 -0
- package/src/components/ui/prompt-input/PromptInput.vue +1094 -0
- package/src/components/ui/prompt-input/index.ts +14 -0
- package/src/components/ui/prompt-input/types.ts +78 -0
- package/src/components/ui/radio-group/RadioGroup.vue +36 -0
- package/src/components/ui/radio-group/RadioGroupItem.vue +45 -0
- package/src/components/ui/radio-group/RadioGroupOption.vue +80 -0
- package/src/components/ui/radio-group/index.ts +3 -0
- package/src/components/ui/reasoning/Reasoning.vue +278 -0
- package/src/components/ui/reasoning/index.ts +8 -0
- package/src/components/ui/reasoning/types.ts +29 -0
- package/src/components/ui/select/Select.vue +19 -0
- package/src/components/ui/select/SelectContent.vue +166 -0
- package/src/components/ui/select/SelectGroup.vue +23 -0
- package/src/components/ui/select/SelectItem.vue +97 -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/select/index.ts +11 -0
- package/src/components/ui/select/search.ts +26 -0
- package/src/components/ui/separator/Separator.vue +30 -0
- package/src/components/ui/separator/index.ts +5 -0
- package/src/components/ui/separator/types.ts +9 -0
- package/src/components/ui/shimmer/Shimmer.vue +110 -0
- package/src/components/ui/shimmer/index.ts +5 -0
- package/src/components/ui/sidebar/Sidebar.vue +142 -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 +31 -0
- package/src/components/ui/sidebar/SidebarGroupContent.vue +18 -0
- package/src/components/ui/sidebar/SidebarGroupLabel.vue +30 -0
- package/src/components/ui/sidebar/SidebarHeader.vue +18 -0
- package/src/components/ui/sidebar/SidebarInput.vue +26 -0
- package/src/components/ui/sidebar/SidebarInset.vue +23 -0
- package/src/components/ui/sidebar/SidebarMenu.vue +18 -0
- package/src/components/ui/sidebar/SidebarMenuAction.vue +34 -0
- package/src/components/ui/sidebar/SidebarMenuBadge.vue +25 -0
- package/src/components/ui/sidebar/SidebarMenuButton.vue +37 -0
- package/src/components/ui/sidebar/SidebarMenuButtonChild.vue +38 -0
- package/src/components/ui/sidebar/SidebarMenuItem.vue +18 -0
- package/src/components/ui/sidebar/SidebarMenuSub.vue +18 -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 +119 -0
- package/src/components/ui/sidebar/SidebarRail.vue +35 -0
- package/src/components/ui/sidebar/SidebarSeparator.vue +18 -0
- package/src/components/ui/sidebar/SidebarTrigger.vue +28 -0
- package/src/components/ui/sidebar/context.ts +39 -0
- package/src/components/ui/sidebar/index.ts +43 -0
- package/src/components/ui/sidebar/types.ts +13 -0
- package/src/components/ui/sidebar/variants.ts +25 -0
- package/src/components/ui/skeleton/Skeleton.vue +53 -0
- package/src/components/ui/skeleton/index.ts +5 -0
- package/src/components/ui/sonner/Sonner.vue +69 -0
- package/src/components/ui/sonner/index.ts +12 -0
- package/src/components/ui/spinner/Spinner.vue +33 -0
- package/src/components/ui/spinner/index.ts +1 -0
- package/src/components/ui/stepper/Stepper.vue +29 -0
- package/src/components/ui/stepper/StepperDescription.vue +30 -0
- package/src/components/ui/stepper/StepperIndicator.vue +50 -0
- package/src/components/ui/stepper/StepperItem.vue +28 -0
- package/src/components/ui/stepper/StepperSeparator.vue +25 -0
- package/src/components/ui/stepper/StepperTitle.vue +27 -0
- package/src/components/ui/stepper/StepperTrigger.vue +27 -0
- package/src/components/ui/stepper/index.ts +7 -0
- package/src/components/ui/switch/Switch.vue +41 -0
- package/src/components/ui/switch/index.ts +1 -0
- package/src/components/ui/table/Table.vue +23 -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 +24 -0
- package/src/components/ui/table/TableEmpty.vue +31 -0
- package/src/components/ui/table/TableFooter.vue +17 -0
- package/src/components/ui/table/TableHead.vue +22 -0
- package/src/components/ui/table/TableHeader.vue +17 -0
- package/src/components/ui/table/TableRow.vue +22 -0
- package/src/components/ui/table/index.ts +9 -0
- package/src/components/ui/tabs/Tabs.vue +24 -0
- package/src/components/ui/tabs/TabsContent.vue +22 -0
- package/src/components/ui/tabs/TabsList.vue +27 -0
- package/src/components/ui/tabs/TabsTrigger.vue +27 -0
- package/src/components/ui/tabs/index.ts +4 -0
- package/src/components/ui/tag/Tag.vue +55 -0
- package/src/components/ui/tag/index.ts +2 -0
- package/src/components/ui/tag/variants.ts +29 -0
- package/src/components/ui/textarea/Textarea.vue +159 -0
- package/src/components/ui/textarea/TextareaControl.vue +120 -0
- package/src/components/ui/textarea/TextareaFieldGroup.vue +14 -0
- package/src/components/ui/textarea/index.ts +10 -0
- package/src/components/ui/textarea/types.ts +35 -0
- package/src/components/ui/tool/Tool.vue +304 -0
- package/src/components/ui/tool/index.ts +7 -0
- package/src/components/ui/tooltip/Tooltip.vue +19 -0
- package/src/components/ui/tooltip/TooltipContent.vue +44 -0
- package/src/components/ui/tooltip/TooltipProvider.vue +14 -0
- package/src/components/ui/tooltip/TooltipTrigger.vue +15 -0
- package/src/components/ui/tooltip/index.ts +4 -0
- package/src/lib/code-highlight.ts +220 -0
- package/src/lib/utils.ts +6 -0
- package/src/styles.css +684 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { default as ContributionGraph } from "./ContributionGraph.vue"
|
|
2
|
+
export type {
|
|
3
|
+
ContributionGraphDay,
|
|
4
|
+
ContributionGraphItem,
|
|
5
|
+
ContributionGraphSelectPayload,
|
|
6
|
+
ContributionGraphSize,
|
|
7
|
+
ContributionGraphWeekStart,
|
|
8
|
+
ContributionGraphYearSelectPayload,
|
|
9
|
+
} from "./ContributionGraph.vue"
|
|
@@ -0,0 +1,534 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from "vue"
|
|
3
|
+
import { computed, ref, useSlots, watch } from "vue"
|
|
4
|
+
import {
|
|
5
|
+
ArrowDownIcon,
|
|
6
|
+
ArrowUpDownIcon,
|
|
7
|
+
ArrowUpIcon,
|
|
8
|
+
CheckIcon,
|
|
9
|
+
MinusIcon,
|
|
10
|
+
SearchIcon,
|
|
11
|
+
} from "@lucide/vue"
|
|
12
|
+
import { Button } from "@/components/ui/button"
|
|
13
|
+
import { Checkbox } from "@/components/ui/checkbox"
|
|
14
|
+
import { Input } from "@/components/ui/input"
|
|
15
|
+
import {
|
|
16
|
+
Pagination,
|
|
17
|
+
PaginationContent,
|
|
18
|
+
PaginationEllipsis,
|
|
19
|
+
PaginationFirst,
|
|
20
|
+
PaginationItem,
|
|
21
|
+
PaginationLast,
|
|
22
|
+
PaginationNext,
|
|
23
|
+
PaginationPrevious,
|
|
24
|
+
} from "@/components/ui/pagination"
|
|
25
|
+
import {
|
|
26
|
+
Table,
|
|
27
|
+
TableBody,
|
|
28
|
+
TableCell,
|
|
29
|
+
TableEmpty,
|
|
30
|
+
TableHead,
|
|
31
|
+
TableHeader,
|
|
32
|
+
TableRow,
|
|
33
|
+
} from "@/components/ui/table"
|
|
34
|
+
import { cn } from "@/lib/utils"
|
|
35
|
+
|
|
36
|
+
export type DataTableRow = Record<string, unknown>
|
|
37
|
+
export type DataTableRowKey = number | string
|
|
38
|
+
export type DataTableSortDirection = "asc" | "desc" | null
|
|
39
|
+
|
|
40
|
+
export interface DataTableColumn {
|
|
41
|
+
accessor?: (row: DataTableRow) => unknown
|
|
42
|
+
align?: "center" | "left" | "right"
|
|
43
|
+
cellClass?: HTMLAttributes["class"]
|
|
44
|
+
class?: HTMLAttributes["class"]
|
|
45
|
+
format?: (value: unknown, row: DataTableRow) => number | string
|
|
46
|
+
headerClass?: HTMLAttributes["class"]
|
|
47
|
+
key: string
|
|
48
|
+
label: string
|
|
49
|
+
searchable?: boolean
|
|
50
|
+
sortable?: boolean
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface DataTableSortPayload {
|
|
54
|
+
direction: DataTableSortDirection
|
|
55
|
+
key: string
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface DataTableSelectionPayload {
|
|
59
|
+
keys: DataTableRowKey[]
|
|
60
|
+
rows: DataTableRow[]
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
interface IndexedRow {
|
|
64
|
+
index: number
|
|
65
|
+
key: DataTableRowKey
|
|
66
|
+
row: DataTableRow
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const props = withDefaults(
|
|
70
|
+
defineProps<{
|
|
71
|
+
caption?: string
|
|
72
|
+
class?: HTMLAttributes["class"]
|
|
73
|
+
columns?: DataTableColumn[]
|
|
74
|
+
containerClass?: HTMLAttributes["class"]
|
|
75
|
+
emptyText?: string
|
|
76
|
+
loading?: boolean
|
|
77
|
+
loadingText?: string
|
|
78
|
+
modelValue?: DataTableRowKey[]
|
|
79
|
+
noResultsText?: string
|
|
80
|
+
page?: number
|
|
81
|
+
pageSize?: number
|
|
82
|
+
paginationClass?: HTMLAttributes["class"]
|
|
83
|
+
rowKey?: ((row: DataTableRow, index: number) => DataTableRowKey) | string
|
|
84
|
+
rows?: DataTableRow[]
|
|
85
|
+
searchPlaceholder?: string
|
|
86
|
+
searchValue?: string
|
|
87
|
+
searchable?: boolean
|
|
88
|
+
selectable?: boolean
|
|
89
|
+
showPagination?: boolean
|
|
90
|
+
showRowCount?: boolean
|
|
91
|
+
sortDirection?: DataTableSortDirection
|
|
92
|
+
sortKey?: string
|
|
93
|
+
tableClass?: HTMLAttributes["class"]
|
|
94
|
+
toolbarClass?: HTMLAttributes["class"]
|
|
95
|
+
}>(),
|
|
96
|
+
{
|
|
97
|
+
columns: () => [],
|
|
98
|
+
emptyText: "No rows found.",
|
|
99
|
+
loading: false,
|
|
100
|
+
loadingText: "Loading rows...",
|
|
101
|
+
noResultsText: "No results found.",
|
|
102
|
+
page: undefined,
|
|
103
|
+
pageSize: 10,
|
|
104
|
+
rowKey: "id",
|
|
105
|
+
rows: () => [],
|
|
106
|
+
searchPlaceholder: "Search rows",
|
|
107
|
+
searchValue: undefined,
|
|
108
|
+
searchable: true,
|
|
109
|
+
selectable: false,
|
|
110
|
+
showPagination: true,
|
|
111
|
+
showRowCount: true,
|
|
112
|
+
sortDirection: null,
|
|
113
|
+
sortKey: "",
|
|
114
|
+
},
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
const emit = defineEmits<{
|
|
118
|
+
"select": [payload: DataTableSelectionPayload]
|
|
119
|
+
"sort": [payload: DataTableSortPayload]
|
|
120
|
+
"update:modelValue": [keys: DataTableRowKey[]]
|
|
121
|
+
"update:page": [page: number]
|
|
122
|
+
"update:searchValue": [value: string]
|
|
123
|
+
"update:sortDirection": [direction: DataTableSortDirection]
|
|
124
|
+
"update:sortKey": [key: string]
|
|
125
|
+
}>()
|
|
126
|
+
|
|
127
|
+
const slots = useSlots()
|
|
128
|
+
const internalPage = ref(1)
|
|
129
|
+
const internalSearchValue = ref("")
|
|
130
|
+
const internalSelectedKeys = ref<DataTableRowKey[]>([])
|
|
131
|
+
const internalSortDirection = ref<DataTableSortDirection>(props.sortDirection)
|
|
132
|
+
const internalSortKey = ref(props.sortKey)
|
|
133
|
+
|
|
134
|
+
const pageSize = computed(() => Math.max(1, Math.trunc(props.pageSize)))
|
|
135
|
+
const columnCount = computed(() => props.columns.length + (props.selectable ? 1 : 0))
|
|
136
|
+
const hasToolbar = computed(() => props.searchable || Boolean(slots.toolbar))
|
|
137
|
+
const searchValue = computed({
|
|
138
|
+
get: () => props.searchValue ?? internalSearchValue.value,
|
|
139
|
+
set: (value: string) => {
|
|
140
|
+
internalSearchValue.value = value
|
|
141
|
+
emit("update:searchValue", value)
|
|
142
|
+
},
|
|
143
|
+
})
|
|
144
|
+
const currentPage = computed({
|
|
145
|
+
get: () => props.page ?? internalPage.value,
|
|
146
|
+
set: (value: number) => {
|
|
147
|
+
internalPage.value = value
|
|
148
|
+
emit("update:page", value)
|
|
149
|
+
},
|
|
150
|
+
})
|
|
151
|
+
const selectedKeys = computed({
|
|
152
|
+
get: () => props.modelValue ?? internalSelectedKeys.value,
|
|
153
|
+
set: (keys: DataTableRowKey[]) => {
|
|
154
|
+
internalSelectedKeys.value = keys
|
|
155
|
+
emit("update:modelValue", keys)
|
|
156
|
+
emit("select", {
|
|
157
|
+
keys,
|
|
158
|
+
rows: indexedRows.value
|
|
159
|
+
.filter((item) => keys.includes(item.key))
|
|
160
|
+
.map((item) => item.row),
|
|
161
|
+
})
|
|
162
|
+
},
|
|
163
|
+
})
|
|
164
|
+
const activeSortKey = computed({
|
|
165
|
+
get: () => props.sortKey || internalSortKey.value,
|
|
166
|
+
set: (key: string) => {
|
|
167
|
+
internalSortKey.value = key
|
|
168
|
+
emit("update:sortKey", key)
|
|
169
|
+
},
|
|
170
|
+
})
|
|
171
|
+
const activeSortDirection = computed({
|
|
172
|
+
get: () => props.sortDirection ?? internalSortDirection.value,
|
|
173
|
+
set: (direction: DataTableSortDirection) => {
|
|
174
|
+
internalSortDirection.value = direction
|
|
175
|
+
emit("update:sortDirection", direction)
|
|
176
|
+
},
|
|
177
|
+
})
|
|
178
|
+
|
|
179
|
+
const indexedRows = computed<IndexedRow[]>(() =>
|
|
180
|
+
props.rows.map((row, index) => ({
|
|
181
|
+
index,
|
|
182
|
+
key: getRowKey(row, index),
|
|
183
|
+
row,
|
|
184
|
+
})),
|
|
185
|
+
)
|
|
186
|
+
const filteredRows = computed(() => {
|
|
187
|
+
const query = normalizeSearchText(searchValue.value)
|
|
188
|
+
|
|
189
|
+
if (!query) return indexedRows.value
|
|
190
|
+
|
|
191
|
+
const searchableColumns = props.columns.filter((column) => column.searchable !== false)
|
|
192
|
+
|
|
193
|
+
return indexedRows.value.filter((item) =>
|
|
194
|
+
searchableColumns.some((column) =>
|
|
195
|
+
normalizeSearchText(String(getCellValue(item.row, column) ?? "")).includes(query),
|
|
196
|
+
),
|
|
197
|
+
)
|
|
198
|
+
})
|
|
199
|
+
const sortedRows = computed(() => {
|
|
200
|
+
if (!activeSortKey.value || !activeSortDirection.value) return filteredRows.value
|
|
201
|
+
|
|
202
|
+
const column = props.columns.find((item) => item.key === activeSortKey.value)
|
|
203
|
+
|
|
204
|
+
if (!column) return filteredRows.value
|
|
205
|
+
|
|
206
|
+
const direction = activeSortDirection.value === "asc" ? 1 : -1
|
|
207
|
+
|
|
208
|
+
return [...filteredRows.value].sort((first, second) =>
|
|
209
|
+
compareCellValues(
|
|
210
|
+
getCellValue(first.row, column),
|
|
211
|
+
getCellValue(second.row, column),
|
|
212
|
+
) * direction,
|
|
213
|
+
)
|
|
214
|
+
})
|
|
215
|
+
const pageCount = computed(() =>
|
|
216
|
+
Math.max(1, Math.ceil(sortedRows.value.length / pageSize.value)),
|
|
217
|
+
)
|
|
218
|
+
const visibleRows = computed(() => {
|
|
219
|
+
if (!props.showPagination) return sortedRows.value
|
|
220
|
+
|
|
221
|
+
const start = (currentPage.value - 1) * pageSize.value
|
|
222
|
+
|
|
223
|
+
return sortedRows.value.slice(start, start + pageSize.value)
|
|
224
|
+
})
|
|
225
|
+
const rowCountLabel = computed(() => {
|
|
226
|
+
if (sortedRows.value.length === 0) return "0 rows"
|
|
227
|
+
|
|
228
|
+
if (!props.showPagination) return `${sortedRows.value.length} rows`
|
|
229
|
+
|
|
230
|
+
const start = (currentPage.value - 1) * pageSize.value + 1
|
|
231
|
+
const end = Math.min(currentPage.value * pageSize.value, sortedRows.value.length)
|
|
232
|
+
|
|
233
|
+
return `${start}-${end} of ${sortedRows.value.length} rows`
|
|
234
|
+
})
|
|
235
|
+
const hasRows = computed(() => visibleRows.value.length > 0)
|
|
236
|
+
const emptyStateText = computed(() =>
|
|
237
|
+
props.loading
|
|
238
|
+
? props.loadingText
|
|
239
|
+
: searchValue.value
|
|
240
|
+
? props.noResultsText
|
|
241
|
+
: props.emptyText,
|
|
242
|
+
)
|
|
243
|
+
const headerSelectionState = computed(() => {
|
|
244
|
+
const keys = visibleRows.value.map((item) => item.key)
|
|
245
|
+
|
|
246
|
+
if (keys.length === 0) return false
|
|
247
|
+
|
|
248
|
+
const selectedCount = keys.filter((key) => selectedKeys.value.includes(key)).length
|
|
249
|
+
|
|
250
|
+
if (selectedCount === 0) return false
|
|
251
|
+
if (selectedCount === keys.length) return true
|
|
252
|
+
|
|
253
|
+
return "indeterminate"
|
|
254
|
+
})
|
|
255
|
+
|
|
256
|
+
watch([pageSize, () => sortedRows.value.length], () => {
|
|
257
|
+
if (currentPage.value > pageCount.value) currentPage.value = pageCount.value
|
|
258
|
+
if (currentPage.value < 1) currentPage.value = 1
|
|
259
|
+
})
|
|
260
|
+
|
|
261
|
+
watch(searchValue, () => {
|
|
262
|
+
currentPage.value = 1
|
|
263
|
+
})
|
|
264
|
+
|
|
265
|
+
function getRowKey(row: DataTableRow, index: number) {
|
|
266
|
+
if (typeof props.rowKey === "function") return props.rowKey(row, index)
|
|
267
|
+
|
|
268
|
+
const value = row[props.rowKey]
|
|
269
|
+
|
|
270
|
+
return typeof value === "number" || typeof value === "string" ? value : index
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
function getCellValue(row: DataTableRow, column: DataTableColumn) {
|
|
274
|
+
return column.accessor ? column.accessor(row) : row[column.key]
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
function getCellText(row: DataTableRow, column: DataTableColumn) {
|
|
278
|
+
const value = getCellValue(row, column)
|
|
279
|
+
|
|
280
|
+
if (column.format) return column.format(value, row)
|
|
281
|
+
if (value === null || value === undefined) return ""
|
|
282
|
+
|
|
283
|
+
return String(value)
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
function normalizeSearchText(value: string) {
|
|
287
|
+
return value.trim().toLowerCase().replace(/\s+/g, " ")
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
function compareCellValues(first: unknown, second: unknown) {
|
|
291
|
+
if (first === second) return 0
|
|
292
|
+
if (first === null || first === undefined) return 1
|
|
293
|
+
if (second === null || second === undefined) return -1
|
|
294
|
+
|
|
295
|
+
if (typeof first === "number" && typeof second === "number") {
|
|
296
|
+
return first - second
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
return String(first).localeCompare(String(second), undefined, {
|
|
300
|
+
numeric: true,
|
|
301
|
+
sensitivity: "base",
|
|
302
|
+
})
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
function isColumnSortable(column: DataTableColumn) {
|
|
306
|
+
return column.sortable !== false
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
function getSortIcon(column: DataTableColumn) {
|
|
310
|
+
if (activeSortKey.value !== column.key) return ArrowUpDownIcon
|
|
311
|
+
if (activeSortDirection.value === "asc") return ArrowUpIcon
|
|
312
|
+
if (activeSortDirection.value === "desc") return ArrowDownIcon
|
|
313
|
+
|
|
314
|
+
return ArrowUpDownIcon
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
function toggleSort(column: DataTableColumn) {
|
|
318
|
+
if (!isColumnSortable(column)) return
|
|
319
|
+
|
|
320
|
+
let nextDirection: DataTableSortDirection = "asc"
|
|
321
|
+
|
|
322
|
+
if (activeSortKey.value === column.key) {
|
|
323
|
+
nextDirection =
|
|
324
|
+
activeSortDirection.value === "asc"
|
|
325
|
+
? "desc"
|
|
326
|
+
: activeSortDirection.value === "desc"
|
|
327
|
+
? null
|
|
328
|
+
: "asc"
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
activeSortKey.value = nextDirection ? column.key : ""
|
|
332
|
+
activeSortDirection.value = nextDirection
|
|
333
|
+
emit("sort", {
|
|
334
|
+
direction: nextDirection,
|
|
335
|
+
key: nextDirection ? column.key : "",
|
|
336
|
+
})
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
function alignClass(align?: DataTableColumn["align"]) {
|
|
340
|
+
if (align === "right") return "text-right"
|
|
341
|
+
if (align === "center") return "text-center"
|
|
342
|
+
|
|
343
|
+
return "text-left"
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
function isRowSelected(key: DataTableRowKey) {
|
|
347
|
+
return selectedKeys.value.includes(key)
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
function toggleRowSelection(item: IndexedRow, value: boolean | "indeterminate") {
|
|
351
|
+
const keys = new Set(selectedKeys.value)
|
|
352
|
+
|
|
353
|
+
if (value === true) keys.add(item.key)
|
|
354
|
+
else keys.delete(item.key)
|
|
355
|
+
|
|
356
|
+
selectedKeys.value = Array.from(keys)
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
function toggleVisibleSelection(value: boolean | "indeterminate") {
|
|
360
|
+
const keys = new Set(selectedKeys.value)
|
|
361
|
+
const visibleKeys = visibleRows.value.map((item) => item.key)
|
|
362
|
+
|
|
363
|
+
if (value === true) {
|
|
364
|
+
visibleKeys.forEach((key) => keys.add(key))
|
|
365
|
+
} else {
|
|
366
|
+
visibleKeys.forEach((key) => keys.delete(key))
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
selectedKeys.value = Array.from(keys)
|
|
370
|
+
}
|
|
371
|
+
</script>
|
|
372
|
+
|
|
373
|
+
<template>
|
|
374
|
+
<div data-slot="data-table" :class="cn('flex min-w-0 flex-col gap-4', props.class)">
|
|
375
|
+
<div
|
|
376
|
+
v-if="hasToolbar"
|
|
377
|
+
data-slot="data-table-toolbar"
|
|
378
|
+
:class="cn('flex flex-wrap items-center justify-between gap-3', props.toolbarClass)"
|
|
379
|
+
>
|
|
380
|
+
<slot name="toolbar">
|
|
381
|
+
<Input
|
|
382
|
+
v-if="props.searchable"
|
|
383
|
+
v-model="searchValue"
|
|
384
|
+
:icon="SearchIcon"
|
|
385
|
+
class="w-full sm:w-72"
|
|
386
|
+
:placeholder="props.searchPlaceholder"
|
|
387
|
+
/>
|
|
388
|
+
</slot>
|
|
389
|
+
|
|
390
|
+
<p
|
|
391
|
+
v-if="props.showRowCount"
|
|
392
|
+
data-slot="data-table-row-count"
|
|
393
|
+
class="shrink-0 text-sm text-muted-foreground"
|
|
394
|
+
>
|
|
395
|
+
{{ rowCountLabel }}
|
|
396
|
+
</p>
|
|
397
|
+
</div>
|
|
398
|
+
|
|
399
|
+
<Table
|
|
400
|
+
:class="cn('min-w-[640px]', props.tableClass)"
|
|
401
|
+
:container-class="cn('rounded-md border', props.containerClass)"
|
|
402
|
+
>
|
|
403
|
+
<caption v-if="props.caption" class="sr-only">
|
|
404
|
+
{{ props.caption }}
|
|
405
|
+
</caption>
|
|
406
|
+
|
|
407
|
+
<TableHeader>
|
|
408
|
+
<TableRow>
|
|
409
|
+
<TableHead v-if="props.selectable" class="w-10">
|
|
410
|
+
<Checkbox
|
|
411
|
+
:model-value="headerSelectionState"
|
|
412
|
+
aria-label="Select visible rows"
|
|
413
|
+
@update:model-value="toggleVisibleSelection"
|
|
414
|
+
>
|
|
415
|
+
<MinusIcon v-if="headerSelectionState === 'indeterminate'" class="size-3.5" />
|
|
416
|
+
<CheckIcon v-else class="size-3.5" />
|
|
417
|
+
</Checkbox>
|
|
418
|
+
</TableHead>
|
|
419
|
+
|
|
420
|
+
<TableHead
|
|
421
|
+
v-for="column in props.columns"
|
|
422
|
+
:key="column.key"
|
|
423
|
+
:class="cn(alignClass(column.align), column.headerClass, column.class)"
|
|
424
|
+
>
|
|
425
|
+
<Button
|
|
426
|
+
v-if="isColumnSortable(column)"
|
|
427
|
+
type="button"
|
|
428
|
+
variant="ghost"
|
|
429
|
+
size="sm"
|
|
430
|
+
:aria-label="`Sort by ${column.label}`"
|
|
431
|
+
:class="
|
|
432
|
+
cn(
|
|
433
|
+
'-mx-2 h-8 px-2',
|
|
434
|
+
column.align === 'right' && 'ml-auto',
|
|
435
|
+
column.align === 'center' && 'mx-auto',
|
|
436
|
+
)
|
|
437
|
+
"
|
|
438
|
+
@click="toggleSort(column)"
|
|
439
|
+
>
|
|
440
|
+
<span class="truncate">{{ column.label }}</span>
|
|
441
|
+
<component :is="getSortIcon(column)" data-icon="inline-end" />
|
|
442
|
+
</Button>
|
|
443
|
+
|
|
444
|
+
<span v-else class="truncate">
|
|
445
|
+
{{ column.label }}
|
|
446
|
+
</span>
|
|
447
|
+
</TableHead>
|
|
448
|
+
</TableRow>
|
|
449
|
+
</TableHeader>
|
|
450
|
+
|
|
451
|
+
<TableBody>
|
|
452
|
+
<TableRow
|
|
453
|
+
v-for="item in visibleRows"
|
|
454
|
+
:key="item.key"
|
|
455
|
+
:data-state="isRowSelected(item.key) ? 'selected' : undefined"
|
|
456
|
+
>
|
|
457
|
+
<TableCell v-if="props.selectable" class="w-10">
|
|
458
|
+
<Checkbox
|
|
459
|
+
:model-value="isRowSelected(item.key)"
|
|
460
|
+
:aria-label="`Select row ${item.index + 1}`"
|
|
461
|
+
@update:model-value="toggleRowSelection(item, $event)"
|
|
462
|
+
/>
|
|
463
|
+
</TableCell>
|
|
464
|
+
|
|
465
|
+
<TableCell
|
|
466
|
+
v-for="column in props.columns"
|
|
467
|
+
:key="column.key"
|
|
468
|
+
:class="cn(alignClass(column.align), column.cellClass, column.class)"
|
|
469
|
+
>
|
|
470
|
+
<slot
|
|
471
|
+
:name="`cell-${column.key}`"
|
|
472
|
+
:column="column"
|
|
473
|
+
:index="item.index"
|
|
474
|
+
:row="item.row"
|
|
475
|
+
:value="getCellValue(item.row, column)"
|
|
476
|
+
>
|
|
477
|
+
{{ getCellText(item.row, column) }}
|
|
478
|
+
</slot>
|
|
479
|
+
</TableCell>
|
|
480
|
+
</TableRow>
|
|
481
|
+
|
|
482
|
+
<TableEmpty v-if="!hasRows" :colspan="Math.max(columnCount, 1)">
|
|
483
|
+
<slot name="empty" :search="searchValue">
|
|
484
|
+
{{ emptyStateText }}
|
|
485
|
+
</slot>
|
|
486
|
+
</TableEmpty>
|
|
487
|
+
</TableBody>
|
|
488
|
+
</Table>
|
|
489
|
+
|
|
490
|
+
<div
|
|
491
|
+
v-if="props.showPagination && sortedRows.length > pageSize"
|
|
492
|
+
data-slot="data-table-pagination"
|
|
493
|
+
:class="cn('flex flex-wrap items-center justify-between gap-3', props.paginationClass)"
|
|
494
|
+
>
|
|
495
|
+
<p
|
|
496
|
+
v-if="props.showRowCount && !hasToolbar"
|
|
497
|
+
class="text-sm text-muted-foreground"
|
|
498
|
+
>
|
|
499
|
+
{{ rowCountLabel }}
|
|
500
|
+
</p>
|
|
501
|
+
|
|
502
|
+
<Pagination
|
|
503
|
+
v-slot="{ page }"
|
|
504
|
+
v-model:page="currentPage"
|
|
505
|
+
:items-per-page="pageSize"
|
|
506
|
+
:total="sortedRows.length"
|
|
507
|
+
:sibling-count="1"
|
|
508
|
+
show-edges
|
|
509
|
+
class="mx-0 justify-end"
|
|
510
|
+
>
|
|
511
|
+
<PaginationContent v-slot="{ items }">
|
|
512
|
+
<PaginationFirst size="sm" />
|
|
513
|
+
<PaginationPrevious size="sm" />
|
|
514
|
+
<template
|
|
515
|
+
v-for="(paginationItem, index) in items"
|
|
516
|
+
:key="`${paginationItem.type}-${index}`"
|
|
517
|
+
>
|
|
518
|
+
<PaginationItem
|
|
519
|
+
v-if="paginationItem.type === 'page'"
|
|
520
|
+
:value="paginationItem.value"
|
|
521
|
+
:is-active="paginationItem.value === page"
|
|
522
|
+
size="icon-sm"
|
|
523
|
+
>
|
|
524
|
+
{{ paginationItem.value }}
|
|
525
|
+
</PaginationItem>
|
|
526
|
+
<PaginationEllipsis v-else class="size-8" />
|
|
527
|
+
</template>
|
|
528
|
+
<PaginationNext size="sm" />
|
|
529
|
+
<PaginationLast size="sm" />
|
|
530
|
+
</PaginationContent>
|
|
531
|
+
</Pagination>
|
|
532
|
+
</div>
|
|
533
|
+
</div>
|
|
534
|
+
</template>
|