@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,622 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, useSlots } from "vue"
|
|
3
|
+
import type { Component, HTMLAttributes } from "vue"
|
|
4
|
+
import { ArrowDownRightIcon, ArrowUpRightIcon, MinusIcon } from "@lucide/vue"
|
|
5
|
+
import { cn } from "@/lib/utils"
|
|
6
|
+
|
|
7
|
+
export type KpiLineCardSize = "sm" | "default" | "lg"
|
|
8
|
+
export type KpiLineCardChartPosition = "bottom" | "right"
|
|
9
|
+
export type KpiLineCardTone = "default" | "success" | "warning" | "danger" | "info"
|
|
10
|
+
export type KpiLineCardTrend = "up" | "down" | "neutral"
|
|
11
|
+
export type KpiLineCardValue = number | string | null | undefined
|
|
12
|
+
export type KpiLineCardValueFormatter = (value: number | string) => number | string
|
|
13
|
+
|
|
14
|
+
export interface KpiLineCardDataPoint extends Record<string, unknown> {
|
|
15
|
+
id?: number | string
|
|
16
|
+
label?: number | string
|
|
17
|
+
value?: KpiLineCardValue
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface KpiLineCardProps {
|
|
21
|
+
chartLabel?: string
|
|
22
|
+
chartPosition?: KpiLineCardChartPosition
|
|
23
|
+
class?: HTMLAttributes["class"]
|
|
24
|
+
data?: KpiLineCardDataPoint[]
|
|
25
|
+
description?: string
|
|
26
|
+
emptyLabel?: string
|
|
27
|
+
loading?: boolean
|
|
28
|
+
showArea?: boolean
|
|
29
|
+
showPoints?: boolean
|
|
30
|
+
size?: KpiLineCardSize
|
|
31
|
+
summary?: string
|
|
32
|
+
title?: string
|
|
33
|
+
tone?: KpiLineCardTone
|
|
34
|
+
trend?: KpiLineCardTrend
|
|
35
|
+
trendLabel?: string
|
|
36
|
+
trendValue?: number | string | null
|
|
37
|
+
value?: KpiLineCardValue
|
|
38
|
+
valueFormatter?: KpiLineCardValueFormatter
|
|
39
|
+
xKey?: string
|
|
40
|
+
yKey?: string
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
interface NormalizedPoint {
|
|
44
|
+
id: string
|
|
45
|
+
label: string
|
|
46
|
+
value: number
|
|
47
|
+
x: number
|
|
48
|
+
y: number
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const props = withDefaults(defineProps<KpiLineCardProps>(), {
|
|
52
|
+
chartPosition: "bottom",
|
|
53
|
+
data: () => [],
|
|
54
|
+
emptyLabel: "No data",
|
|
55
|
+
showArea: true,
|
|
56
|
+
showPoints: false,
|
|
57
|
+
size: "default",
|
|
58
|
+
tone: "default",
|
|
59
|
+
xKey: "label",
|
|
60
|
+
yKey: "value",
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
const slots = useSlots()
|
|
64
|
+
|
|
65
|
+
const chartWidth = 240
|
|
66
|
+
const chartHeight = 72
|
|
67
|
+
const chartPadding = {
|
|
68
|
+
bottom: 8,
|
|
69
|
+
left: 6,
|
|
70
|
+
right: 6,
|
|
71
|
+
top: 8,
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const isChartRight = computed(() => props.chartPosition === "right")
|
|
75
|
+
|
|
76
|
+
const numberFormatter = computed(() =>
|
|
77
|
+
new Intl.NumberFormat(undefined, {
|
|
78
|
+
maximumFractionDigits: 2,
|
|
79
|
+
}),
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
const sizeClasses = computed(() => {
|
|
83
|
+
if (props.size === "sm") {
|
|
84
|
+
return {
|
|
85
|
+
chart: "h-12",
|
|
86
|
+
chartBottom: "h-14",
|
|
87
|
+
description: "text-xs",
|
|
88
|
+
gap: "gap-2.5",
|
|
89
|
+
icon: "size-7",
|
|
90
|
+
root: "min-h-40 p-3",
|
|
91
|
+
title: "text-xs",
|
|
92
|
+
trend: "text-[11px]",
|
|
93
|
+
value: "text-xl",
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (props.size === "lg") {
|
|
98
|
+
return {
|
|
99
|
+
chart: "h-16",
|
|
100
|
+
chartBottom: "h-20",
|
|
101
|
+
description: "text-sm",
|
|
102
|
+
gap: "gap-4",
|
|
103
|
+
icon: "size-10",
|
|
104
|
+
root: "min-h-56 p-5",
|
|
105
|
+
title: "text-sm",
|
|
106
|
+
trend: "text-xs",
|
|
107
|
+
value: "text-3xl",
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return {
|
|
112
|
+
chart: "h-14",
|
|
113
|
+
chartBottom: "h-16",
|
|
114
|
+
description: "text-sm",
|
|
115
|
+
gap: "gap-3",
|
|
116
|
+
icon: "size-8",
|
|
117
|
+
root: "min-h-48 p-4",
|
|
118
|
+
title: "text-sm",
|
|
119
|
+
trend: "text-xs",
|
|
120
|
+
value: "text-2xl",
|
|
121
|
+
}
|
|
122
|
+
})
|
|
123
|
+
|
|
124
|
+
const rootClass = computed(() =>
|
|
125
|
+
cn(
|
|
126
|
+
"relative flex min-w-0 flex-col rounded-lg border bg-card text-card-foreground shadow-xs transition-colors",
|
|
127
|
+
sizeClasses.value.root,
|
|
128
|
+
props.class,
|
|
129
|
+
),
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
const contentClass = computed(() =>
|
|
133
|
+
cn(
|
|
134
|
+
"flex min-w-0 flex-1 flex-col",
|
|
135
|
+
sizeClasses.value.gap,
|
|
136
|
+
isChartRight.value && "sm:flex-row sm:items-stretch",
|
|
137
|
+
),
|
|
138
|
+
)
|
|
139
|
+
|
|
140
|
+
const mainClass = computed(() =>
|
|
141
|
+
cn(
|
|
142
|
+
"flex min-w-0 flex-col",
|
|
143
|
+
sizeClasses.value.gap,
|
|
144
|
+
isChartRight.value && "sm:min-w-0 sm:flex-1 sm:justify-between",
|
|
145
|
+
),
|
|
146
|
+
)
|
|
147
|
+
|
|
148
|
+
const chartSlotClass = computed(() =>
|
|
149
|
+
cn(
|
|
150
|
+
"min-w-0",
|
|
151
|
+
isChartRight.value
|
|
152
|
+
? [sizeClasses.value.chart, "sm:h-auto sm:w-2/5 sm:min-w-32 sm:self-stretch"]
|
|
153
|
+
: [sizeClasses.value.chartBottom, "mt-auto"],
|
|
154
|
+
),
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
const chartClass = computed(() =>
|
|
158
|
+
cn(
|
|
159
|
+
"block h-full w-full overflow-visible",
|
|
160
|
+
toneTextClass(effectiveTrendTone.value),
|
|
161
|
+
),
|
|
162
|
+
)
|
|
163
|
+
|
|
164
|
+
const hasHeader = computed(() =>
|
|
165
|
+
Boolean(slots.icon || slots.title || props.title),
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
const rawPoints = computed(() =>
|
|
169
|
+
props.data
|
|
170
|
+
.map((point, index) => {
|
|
171
|
+
const rawValue = getDataValue(point, props.yKey)
|
|
172
|
+
const value = toFiniteNumber(rawValue)
|
|
173
|
+
|
|
174
|
+
if (value === null) return null
|
|
175
|
+
|
|
176
|
+
const rawLabel = getDataValue(point, props.xKey)
|
|
177
|
+
const label = rawLabel === undefined || rawLabel === null || rawLabel === ""
|
|
178
|
+
? `Item ${index + 1}`
|
|
179
|
+
: String(rawLabel)
|
|
180
|
+
const id = point.id === undefined || point.id === null
|
|
181
|
+
? `${index}-${label}`
|
|
182
|
+
: String(point.id)
|
|
183
|
+
|
|
184
|
+
return {
|
|
185
|
+
id,
|
|
186
|
+
label,
|
|
187
|
+
value,
|
|
188
|
+
}
|
|
189
|
+
})
|
|
190
|
+
.filter((point): point is Omit<NormalizedPoint, "x" | "y"> => point !== null),
|
|
191
|
+
)
|
|
192
|
+
|
|
193
|
+
const domain = computed(() => {
|
|
194
|
+
const values = rawPoints.value.map((point) => point.value)
|
|
195
|
+
|
|
196
|
+
if (!values.length) {
|
|
197
|
+
return {
|
|
198
|
+
max: 1,
|
|
199
|
+
min: 0,
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
let min = Math.min(...values)
|
|
204
|
+
let max = Math.max(...values)
|
|
205
|
+
|
|
206
|
+
if (min === max) {
|
|
207
|
+
const delta = min === 0 ? 1 : Math.abs(min * 0.1)
|
|
208
|
+
min -= delta
|
|
209
|
+
max += delta
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
return {
|
|
213
|
+
max,
|
|
214
|
+
min,
|
|
215
|
+
}
|
|
216
|
+
})
|
|
217
|
+
|
|
218
|
+
const chartPoints = computed<NormalizedPoint[]>(() => {
|
|
219
|
+
const points = rawPoints.value
|
|
220
|
+
const plotWidth = chartWidth - chartPadding.left - chartPadding.right
|
|
221
|
+
const plotHeight = chartHeight - chartPadding.top - chartPadding.bottom
|
|
222
|
+
const denominator = Math.max(1, points.length - 1)
|
|
223
|
+
|
|
224
|
+
return points.map((point, index) => {
|
|
225
|
+
const valueRange = domain.value.max - domain.value.min || 1
|
|
226
|
+
const x = chartPadding.left + ((index / denominator) * plotWidth)
|
|
227
|
+
const y = chartPadding.top + (((domain.value.max - point.value) / valueRange) * plotHeight)
|
|
228
|
+
|
|
229
|
+
return {
|
|
230
|
+
...point,
|
|
231
|
+
x,
|
|
232
|
+
y,
|
|
233
|
+
}
|
|
234
|
+
})
|
|
235
|
+
})
|
|
236
|
+
|
|
237
|
+
const hasChart = computed(() => chartPoints.value.length > 1)
|
|
238
|
+
|
|
239
|
+
const linePath = computed(() => buildSmoothLinePath(chartPoints.value))
|
|
240
|
+
|
|
241
|
+
const areaPath = computed(() => {
|
|
242
|
+
const points = chartPoints.value
|
|
243
|
+
|
|
244
|
+
if (!props.showArea || !linePath.value || points.length < 2) return ""
|
|
245
|
+
|
|
246
|
+
const first = points[0]
|
|
247
|
+
const last = points[points.length - 1]
|
|
248
|
+
const baseline = chartHeight - chartPadding.bottom
|
|
249
|
+
|
|
250
|
+
if (!first || !last) return ""
|
|
251
|
+
|
|
252
|
+
return `${linePath.value} L ${roundCoordinate(last.x)} ${baseline} L ${roundCoordinate(first.x)} ${baseline} Z`
|
|
253
|
+
})
|
|
254
|
+
|
|
255
|
+
const inferredTrend = computed<KpiLineCardTrend>(() => {
|
|
256
|
+
const points = rawPoints.value
|
|
257
|
+
const first = points[0]
|
|
258
|
+
const last = points[points.length - 1]
|
|
259
|
+
|
|
260
|
+
if (!first || !last) return "neutral"
|
|
261
|
+
if (last.value > first.value) return "up"
|
|
262
|
+
if (last.value < first.value) return "down"
|
|
263
|
+
|
|
264
|
+
return "neutral"
|
|
265
|
+
})
|
|
266
|
+
|
|
267
|
+
const trendDirection = computed<KpiLineCardTrend>(() => props.trend ?? inferredTrend.value)
|
|
268
|
+
|
|
269
|
+
const trendIcon = computed<Component>(() => {
|
|
270
|
+
if (trendDirection.value === "up") return ArrowUpRightIcon
|
|
271
|
+
if (trendDirection.value === "down") return ArrowDownRightIcon
|
|
272
|
+
|
|
273
|
+
return MinusIcon
|
|
274
|
+
})
|
|
275
|
+
|
|
276
|
+
const hasTrendValue = computed(() => hasDisplayValue(props.trendValue))
|
|
277
|
+
|
|
278
|
+
const hasTrend = computed(() =>
|
|
279
|
+
Boolean(props.trend || props.trendLabel || hasTrendValue.value),
|
|
280
|
+
)
|
|
281
|
+
|
|
282
|
+
const hasFooter = computed(() =>
|
|
283
|
+
Boolean(slots.footer || props.summary || hasTrend.value),
|
|
284
|
+
)
|
|
285
|
+
|
|
286
|
+
const formattedValue = computed(() => {
|
|
287
|
+
const value = props.value
|
|
288
|
+
|
|
289
|
+
if (!hasDisplayValue(value)) return props.emptyLabel
|
|
290
|
+
if (props.valueFormatter) return props.valueFormatter(value)
|
|
291
|
+
if (typeof value === "number") return numberFormatter.value.format(value)
|
|
292
|
+
|
|
293
|
+
return value
|
|
294
|
+
})
|
|
295
|
+
|
|
296
|
+
const formattedTrendValue = computed(() => {
|
|
297
|
+
const value = props.trendValue
|
|
298
|
+
|
|
299
|
+
if (!hasDisplayValue(value)) return ""
|
|
300
|
+
if (typeof value === "number") return numberFormatter.value.format(value)
|
|
301
|
+
|
|
302
|
+
return value
|
|
303
|
+
})
|
|
304
|
+
|
|
305
|
+
const trendAccessibleLabel = computed(() =>
|
|
306
|
+
[formattedTrendValue.value, props.trendLabel]
|
|
307
|
+
.filter((part) => Boolean(part))
|
|
308
|
+
.join(" "),
|
|
309
|
+
)
|
|
310
|
+
|
|
311
|
+
const chartAccessibleLabel = computed(() => {
|
|
312
|
+
if (props.chartLabel) return props.chartLabel
|
|
313
|
+
|
|
314
|
+
const title = props.title ?? "KPI"
|
|
315
|
+
const first = rawPoints.value[0]
|
|
316
|
+
const last = rawPoints.value[rawPoints.value.length - 1]
|
|
317
|
+
|
|
318
|
+
if (!first || !last) return `${title} trend`
|
|
319
|
+
|
|
320
|
+
return `${title} trend from ${formatNumber(first.value)} to ${formatNumber(last.value)}`
|
|
321
|
+
})
|
|
322
|
+
|
|
323
|
+
const effectiveTrendTone = computed<KpiLineCardTone>(() => {
|
|
324
|
+
if (props.tone !== "default") return props.tone
|
|
325
|
+
if (trendDirection.value === "up") return "success"
|
|
326
|
+
if (trendDirection.value === "down") return "danger"
|
|
327
|
+
|
|
328
|
+
return "default"
|
|
329
|
+
})
|
|
330
|
+
|
|
331
|
+
const iconClass = computed(() =>
|
|
332
|
+
cn(
|
|
333
|
+
"inline-flex shrink-0 items-center justify-center rounded-md border bg-muted/60",
|
|
334
|
+
sizeClasses.value.icon,
|
|
335
|
+
toneTextClass(props.tone),
|
|
336
|
+
),
|
|
337
|
+
)
|
|
338
|
+
|
|
339
|
+
const trendClass = computed(() =>
|
|
340
|
+
cn(
|
|
341
|
+
"inline-flex min-h-6 w-fit max-w-full items-center gap-1 rounded-md border px-1.5 font-medium leading-none tabular-nums",
|
|
342
|
+
sizeClasses.value.trend,
|
|
343
|
+
tonePillClass(effectiveTrendTone.value),
|
|
344
|
+
),
|
|
345
|
+
)
|
|
346
|
+
|
|
347
|
+
function getDataValue(data: KpiLineCardDataPoint, key: string) {
|
|
348
|
+
return (data as Record<string, unknown>)[key]
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
function toFiniteNumber(value: unknown) {
|
|
352
|
+
if (typeof value === "number") {
|
|
353
|
+
return Number.isFinite(value) ? value : null
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
if (typeof value === "string" && value.trim().length > 0) {
|
|
357
|
+
const parsed = Number(value)
|
|
358
|
+
|
|
359
|
+
return Number.isFinite(parsed) ? parsed : null
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
return null
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
function hasDisplayValue(value: KpiLineCardValue): value is number | string {
|
|
366
|
+
return value !== null && value !== undefined && value !== ""
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
function buildSmoothLinePath(points: NormalizedPoint[]) {
|
|
370
|
+
if (points.length < 2) return ""
|
|
371
|
+
if (points.length < 3) return buildLinearLinePath(points)
|
|
372
|
+
|
|
373
|
+
const commands = [`M ${roundCoordinate(points[0].x)} ${roundCoordinate(points[0].y)}`]
|
|
374
|
+
|
|
375
|
+
for (let index = 0; index < points.length - 1; index += 1) {
|
|
376
|
+
const previous = points[index - 1] ?? points[index]
|
|
377
|
+
const current = points[index]
|
|
378
|
+
const next = points[index + 1]
|
|
379
|
+
const following = points[index + 2] ?? next
|
|
380
|
+
|
|
381
|
+
if (!previous || !current || !next || !following) continue
|
|
382
|
+
|
|
383
|
+
const controlPoint1X = current.x + ((next.x - previous.x) / 6)
|
|
384
|
+
const controlPoint1Y = current.y + ((next.y - previous.y) / 6)
|
|
385
|
+
const controlPoint2X = next.x - ((following.x - current.x) / 6)
|
|
386
|
+
const controlPoint2Y = next.y - ((following.y - current.y) / 6)
|
|
387
|
+
|
|
388
|
+
commands.push([
|
|
389
|
+
"C",
|
|
390
|
+
roundCoordinate(controlPoint1X),
|
|
391
|
+
roundCoordinate(controlPoint1Y),
|
|
392
|
+
roundCoordinate(controlPoint2X),
|
|
393
|
+
roundCoordinate(controlPoint2Y),
|
|
394
|
+
roundCoordinate(next.x),
|
|
395
|
+
roundCoordinate(next.y),
|
|
396
|
+
].join(" "))
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
return commands.join(" ")
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
function buildLinearLinePath(points: NormalizedPoint[]) {
|
|
403
|
+
return points
|
|
404
|
+
.map((point, index) => `${index === 0 ? "M" : "L"} ${roundCoordinate(point.x)} ${roundCoordinate(point.y)}`)
|
|
405
|
+
.join(" ")
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
function roundCoordinate(value: number) {
|
|
409
|
+
return Math.round(value * 100) / 100
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
function formatNumber(value: number) {
|
|
413
|
+
return numberFormatter.value.format(value)
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
function toneTextClass(tone: KpiLineCardTone) {
|
|
417
|
+
const classes: Record<KpiLineCardTone, string> = {
|
|
418
|
+
danger: "text-red-600 dark:text-red-400",
|
|
419
|
+
default: "text-muted-foreground",
|
|
420
|
+
info: "text-sky-600 dark:text-sky-400",
|
|
421
|
+
success: "text-emerald-600 dark:text-emerald-400",
|
|
422
|
+
warning: "text-amber-600 dark:text-amber-400",
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
return classes[tone]
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
function tonePillClass(tone: KpiLineCardTone) {
|
|
429
|
+
const classes: Record<KpiLineCardTone, string> = {
|
|
430
|
+
danger: "border-red-500/20 bg-red-500/10 text-red-700 dark:text-red-300",
|
|
431
|
+
default: "border-border bg-muted/50 text-muted-foreground",
|
|
432
|
+
info: "border-sky-500/20 bg-sky-500/10 text-sky-700 dark:text-sky-300",
|
|
433
|
+
success: "border-emerald-500/20 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300",
|
|
434
|
+
warning: "border-amber-500/25 bg-amber-500/10 text-amber-700 dark:text-amber-300",
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
return classes[tone]
|
|
438
|
+
}
|
|
439
|
+
</script>
|
|
440
|
+
|
|
441
|
+
<template>
|
|
442
|
+
<article
|
|
443
|
+
data-slot="kpi-line-card"
|
|
444
|
+
:data-size="props.size"
|
|
445
|
+
:data-tone="props.tone"
|
|
446
|
+
:data-chart-position="props.chartPosition"
|
|
447
|
+
:aria-busy="props.loading ? 'true' : undefined"
|
|
448
|
+
:class="rootClass"
|
|
449
|
+
>
|
|
450
|
+
<div
|
|
451
|
+
v-if="props.loading"
|
|
452
|
+
data-slot="kpi-line-card-loading"
|
|
453
|
+
:class="contentClass"
|
|
454
|
+
>
|
|
455
|
+
<div :class="mainClass">
|
|
456
|
+
<div class="flex min-w-0 items-start justify-between gap-3">
|
|
457
|
+
<div class="min-w-0 flex-1">
|
|
458
|
+
<div class="h-3.5 w-24 rounded-sm bg-muted" />
|
|
459
|
+
<div class="mt-2 h-8 w-32 rounded-sm bg-muted" />
|
|
460
|
+
</div>
|
|
461
|
+
<div :class="cn('rounded-md border bg-muted/60', sizeClasses.icon)" />
|
|
462
|
+
</div>
|
|
463
|
+
<div class="h-3 w-40 max-w-full rounded-sm bg-muted" />
|
|
464
|
+
<div class="h-6 w-36 max-w-full rounded-md bg-muted" />
|
|
465
|
+
</div>
|
|
466
|
+
<div :class="cn('rounded-md bg-muted', chartSlotClass)" />
|
|
467
|
+
</div>
|
|
468
|
+
|
|
469
|
+
<template v-else>
|
|
470
|
+
<div
|
|
471
|
+
data-slot="kpi-line-card-content"
|
|
472
|
+
:class="contentClass"
|
|
473
|
+
>
|
|
474
|
+
<div
|
|
475
|
+
data-slot="kpi-line-card-main"
|
|
476
|
+
:class="mainClass"
|
|
477
|
+
>
|
|
478
|
+
<div
|
|
479
|
+
v-if="hasHeader"
|
|
480
|
+
data-slot="kpi-line-card-header"
|
|
481
|
+
class="flex min-w-0 items-start justify-between gap-3"
|
|
482
|
+
>
|
|
483
|
+
<div class="min-w-0">
|
|
484
|
+
<p
|
|
485
|
+
v-if="$slots.title || props.title"
|
|
486
|
+
data-slot="kpi-line-card-title"
|
|
487
|
+
:class="cn('truncate font-medium text-muted-foreground', sizeClasses.title)"
|
|
488
|
+
>
|
|
489
|
+
<slot name="title">{{ props.title }}</slot>
|
|
490
|
+
</p>
|
|
491
|
+
<div
|
|
492
|
+
data-slot="kpi-line-card-value"
|
|
493
|
+
:class="cn(($slots.title || props.title) ? 'mt-2' : '', 'truncate font-semibold leading-none tabular-nums', sizeClasses.value)"
|
|
494
|
+
>
|
|
495
|
+
<slot name="value">{{ formattedValue }}</slot>
|
|
496
|
+
</div>
|
|
497
|
+
</div>
|
|
498
|
+
|
|
499
|
+
<div
|
|
500
|
+
v-if="$slots.icon"
|
|
501
|
+
data-slot="kpi-line-card-icon"
|
|
502
|
+
:class="iconClass"
|
|
503
|
+
>
|
|
504
|
+
<slot name="icon" />
|
|
505
|
+
</div>
|
|
506
|
+
</div>
|
|
507
|
+
|
|
508
|
+
<div
|
|
509
|
+
v-else
|
|
510
|
+
data-slot="kpi-line-card-value"
|
|
511
|
+
:class="cn('truncate font-semibold leading-none tabular-nums', sizeClasses.value)"
|
|
512
|
+
>
|
|
513
|
+
<slot name="value">{{ formattedValue }}</slot>
|
|
514
|
+
</div>
|
|
515
|
+
|
|
516
|
+
<p
|
|
517
|
+
v-if="$slots.description || props.description"
|
|
518
|
+
data-slot="kpi-line-card-description"
|
|
519
|
+
:class="cn('leading-relaxed text-muted-foreground', sizeClasses.description)"
|
|
520
|
+
>
|
|
521
|
+
<slot name="description">{{ props.description }}</slot>
|
|
522
|
+
</p>
|
|
523
|
+
|
|
524
|
+
<div
|
|
525
|
+
v-if="hasFooter"
|
|
526
|
+
data-slot="kpi-line-card-footer"
|
|
527
|
+
class="flex min-w-0 flex-wrap items-center gap-2"
|
|
528
|
+
>
|
|
529
|
+
<slot name="footer">
|
|
530
|
+
<div
|
|
531
|
+
v-if="hasTrend"
|
|
532
|
+
data-slot="kpi-line-card-trend"
|
|
533
|
+
:aria-label="trendAccessibleLabel || undefined"
|
|
534
|
+
:class="trendClass"
|
|
535
|
+
>
|
|
536
|
+
<component
|
|
537
|
+
:is="trendIcon"
|
|
538
|
+
class="size-3.5 shrink-0"
|
|
539
|
+
aria-hidden="true"
|
|
540
|
+
/>
|
|
541
|
+
<span v-if="hasTrendValue">{{ formattedTrendValue }}</span>
|
|
542
|
+
<span v-if="props.trendLabel" class="text-current/75">{{ props.trendLabel }}</span>
|
|
543
|
+
</div>
|
|
544
|
+
<p
|
|
545
|
+
v-if="props.summary"
|
|
546
|
+
data-slot="kpi-line-card-summary"
|
|
547
|
+
class="min-w-0 truncate text-xs text-muted-foreground"
|
|
548
|
+
>
|
|
549
|
+
{{ props.summary }}
|
|
550
|
+
</p>
|
|
551
|
+
</slot>
|
|
552
|
+
</div>
|
|
553
|
+
</div>
|
|
554
|
+
|
|
555
|
+
<div
|
|
556
|
+
data-slot="kpi-line-card-chart"
|
|
557
|
+
:class="chartSlotClass"
|
|
558
|
+
>
|
|
559
|
+
<svg
|
|
560
|
+
v-if="hasChart"
|
|
561
|
+
role="img"
|
|
562
|
+
:aria-label="chartAccessibleLabel"
|
|
563
|
+
:viewBox="`0 0 ${chartWidth} ${chartHeight}`"
|
|
564
|
+
preserveAspectRatio="none"
|
|
565
|
+
:class="chartClass"
|
|
566
|
+
>
|
|
567
|
+
<line
|
|
568
|
+
x1="0"
|
|
569
|
+
:y1="chartPadding.top"
|
|
570
|
+
:x2="chartWidth"
|
|
571
|
+
:y2="chartPadding.top"
|
|
572
|
+
stroke="currentColor"
|
|
573
|
+
stroke-width="1"
|
|
574
|
+
opacity="0.08"
|
|
575
|
+
/>
|
|
576
|
+
<line
|
|
577
|
+
x1="0"
|
|
578
|
+
:y1="chartHeight - chartPadding.bottom"
|
|
579
|
+
:x2="chartWidth"
|
|
580
|
+
:y2="chartHeight - chartPadding.bottom"
|
|
581
|
+
stroke="currentColor"
|
|
582
|
+
stroke-width="1"
|
|
583
|
+
opacity="0.08"
|
|
584
|
+
/>
|
|
585
|
+
<path
|
|
586
|
+
v-if="areaPath"
|
|
587
|
+
:d="areaPath"
|
|
588
|
+
fill="currentColor"
|
|
589
|
+
opacity="0.1"
|
|
590
|
+
/>
|
|
591
|
+
<path
|
|
592
|
+
:d="linePath"
|
|
593
|
+
fill="none"
|
|
594
|
+
stroke="currentColor"
|
|
595
|
+
stroke-linecap="round"
|
|
596
|
+
stroke-linejoin="round"
|
|
597
|
+
stroke-width="3.5"
|
|
598
|
+
vector-effect="non-scaling-stroke"
|
|
599
|
+
/>
|
|
600
|
+
<circle
|
|
601
|
+
v-for="point in props.showPoints ? chartPoints : []"
|
|
602
|
+
:key="point.id"
|
|
603
|
+
:cx="point.x"
|
|
604
|
+
:cy="point.y"
|
|
605
|
+
r="3"
|
|
606
|
+
fill="currentColor"
|
|
607
|
+
>
|
|
608
|
+
<title>{{ point.label }}: {{ formatNumber(point.value) }}</title>
|
|
609
|
+
</circle>
|
|
610
|
+
</svg>
|
|
611
|
+
<div
|
|
612
|
+
v-else
|
|
613
|
+
data-slot="kpi-line-card-empty-chart"
|
|
614
|
+
class="flex h-full items-center rounded-md bg-muted/40 px-3 text-xs text-muted-foreground"
|
|
615
|
+
>
|
|
616
|
+
{{ props.emptyLabel }}
|
|
617
|
+
</div>
|
|
618
|
+
</div>
|
|
619
|
+
</div>
|
|
620
|
+
</template>
|
|
621
|
+
</article>
|
|
622
|
+
</template>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { default as KpiLineCard } from "./KpiLineCard.vue"
|
|
2
|
+
export type {
|
|
3
|
+
KpiLineCardChartPosition,
|
|
4
|
+
KpiLineCardDataPoint,
|
|
5
|
+
KpiLineCardProps,
|
|
6
|
+
KpiLineCardSize,
|
|
7
|
+
KpiLineCardTone,
|
|
8
|
+
KpiLineCardTrend,
|
|
9
|
+
KpiLineCardValue,
|
|
10
|
+
KpiLineCardValueFormatter,
|
|
11
|
+
} from "./KpiLineCard.vue"
|