@polymarbot/nuxt-layer-shadcn-ui 0.1.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/app/assets/styles/animate.css +71 -0
- package/app/assets/styles/colors.css +116 -0
- package/app/assets/styles/globals.css +43 -0
- package/app/assets/styles/index.stories.ts +211 -0
- package/app/assets/styles/transition.css +34 -0
- package/app/assets/styles/utilities.css +26 -0
- package/app/components/shadcn/accordion/Accordion.vue +18 -0
- package/app/components/shadcn/accordion/AccordionContent.vue +23 -0
- package/app/components/shadcn/accordion/AccordionItem.vue +24 -0
- package/app/components/shadcn/accordion/AccordionTrigger.vue +37 -0
- package/app/components/shadcn/accordion/index.ts +4 -0
- package/app/components/shadcn/alert/Alert.vue +21 -0
- package/app/components/shadcn/alert/AlertDescription.vue +17 -0
- package/app/components/shadcn/alert/AlertTitle.vue +17 -0
- package/app/components/shadcn/alert/index.ts +24 -0
- package/app/components/shadcn/avatar/Avatar.vue +18 -0
- package/app/components/shadcn/avatar/AvatarFallback.vue +21 -0
- package/app/components/shadcn/avatar/AvatarImage.vue +16 -0
- package/app/components/shadcn/avatar/index.ts +3 -0
- package/app/components/shadcn/badge/Badge.vue +26 -0
- package/app/components/shadcn/badge/index.ts +26 -0
- package/app/components/shadcn/breadcrumb/Breadcrumb.vue +17 -0
- package/app/components/shadcn/breadcrumb/BreadcrumbEllipsis.vue +23 -0
- package/app/components/shadcn/breadcrumb/BreadcrumbItem.vue +17 -0
- package/app/components/shadcn/breadcrumb/BreadcrumbLink.vue +21 -0
- package/app/components/shadcn/breadcrumb/BreadcrumbList.vue +17 -0
- package/app/components/shadcn/breadcrumb/BreadcrumbPage.vue +20 -0
- package/app/components/shadcn/breadcrumb/BreadcrumbSeparator.vue +22 -0
- package/app/components/shadcn/breadcrumb/index.ts +7 -0
- package/app/components/shadcn/button/Button.vue +31 -0
- package/app/components/shadcn/button/index.ts +38 -0
- package/app/components/shadcn/card/Card.vue +22 -0
- package/app/components/shadcn/card/CardAction.vue +17 -0
- package/app/components/shadcn/card/CardContent.vue +17 -0
- package/app/components/shadcn/card/CardDescription.vue +17 -0
- package/app/components/shadcn/card/CardFooter.vue +17 -0
- package/app/components/shadcn/card/CardHeader.vue +17 -0
- package/app/components/shadcn/card/CardTitle.vue +17 -0
- package/app/components/shadcn/card/index.ts +7 -0
- package/app/components/shadcn/checkbox/Checkbox.vue +35 -0
- package/app/components/shadcn/checkbox/index.ts +1 -0
- package/app/components/shadcn/collapsible/Collapsible.vue +19 -0
- package/app/components/shadcn/collapsible/CollapsibleContent.vue +15 -0
- package/app/components/shadcn/collapsible/CollapsibleTrigger.vue +15 -0
- package/app/components/shadcn/collapsible/index.ts +3 -0
- package/app/components/shadcn/command/Command.vue +87 -0
- package/app/components/shadcn/command/CommandDialog.vue +31 -0
- package/app/components/shadcn/command/CommandEmpty.vue +27 -0
- package/app/components/shadcn/command/CommandGroup.vue +45 -0
- package/app/components/shadcn/command/CommandInput.vue +39 -0
- package/app/components/shadcn/command/CommandItem.vue +76 -0
- package/app/components/shadcn/command/CommandList.vue +25 -0
- package/app/components/shadcn/command/CommandSeparator.vue +21 -0
- package/app/components/shadcn/command/CommandShortcut.vue +17 -0
- package/app/components/shadcn/command/index.ts +25 -0
- package/app/components/shadcn/dialog/Dialog.vue +19 -0
- package/app/components/shadcn/dialog/DialogClose.vue +15 -0
- package/app/components/shadcn/dialog/DialogContent.vue +53 -0
- package/app/components/shadcn/dialog/DialogDescription.vue +23 -0
- package/app/components/shadcn/dialog/DialogFooter.vue +27 -0
- package/app/components/shadcn/dialog/DialogHeader.vue +17 -0
- package/app/components/shadcn/dialog/DialogOverlay.vue +21 -0
- package/app/components/shadcn/dialog/DialogScrollContent.vue +59 -0
- package/app/components/shadcn/dialog/DialogTitle.vue +23 -0
- package/app/components/shadcn/dialog/DialogTrigger.vue +15 -0
- package/app/components/shadcn/dialog/index.ts +10 -0
- package/app/components/shadcn/dropdown-menu/DropdownMenu.vue +19 -0
- package/app/components/shadcn/dropdown-menu/DropdownMenuCheckboxItem.vue +39 -0
- package/app/components/shadcn/dropdown-menu/DropdownMenuContent.vue +39 -0
- package/app/components/shadcn/dropdown-menu/DropdownMenuGroup.vue +15 -0
- package/app/components/shadcn/dropdown-menu/DropdownMenuItem.vue +31 -0
- package/app/components/shadcn/dropdown-menu/DropdownMenuLabel.vue +23 -0
- package/app/components/shadcn/dropdown-menu/DropdownMenuRadioGroup.vue +21 -0
- package/app/components/shadcn/dropdown-menu/DropdownMenuRadioItem.vue +40 -0
- package/app/components/shadcn/dropdown-menu/DropdownMenuSeparator.vue +23 -0
- package/app/components/shadcn/dropdown-menu/DropdownMenuShortcut.vue +17 -0
- package/app/components/shadcn/dropdown-menu/DropdownMenuSub.vue +18 -0
- package/app/components/shadcn/dropdown-menu/DropdownMenuSubContent.vue +27 -0
- package/app/components/shadcn/dropdown-menu/DropdownMenuSubTrigger.vue +31 -0
- package/app/components/shadcn/dropdown-menu/DropdownMenuTrigger.vue +17 -0
- package/app/components/shadcn/dropdown-menu/index.ts +16 -0
- package/app/components/shadcn/field/Field.vue +25 -0
- package/app/components/shadcn/field/FieldContent.vue +20 -0
- package/app/components/shadcn/field/FieldDescription.vue +22 -0
- package/app/components/shadcn/field/FieldError.vue +53 -0
- package/app/components/shadcn/field/FieldGroup.vue +20 -0
- package/app/components/shadcn/field/FieldLabel.vue +23 -0
- package/app/components/shadcn/field/FieldLegend.vue +24 -0
- package/app/components/shadcn/field/FieldSeparator.vue +29 -0
- package/app/components/shadcn/field/FieldSet.vue +21 -0
- package/app/components/shadcn/field/FieldTitle.vue +20 -0
- package/app/components/shadcn/field/index.ts +39 -0
- package/app/components/shadcn/input/Input.vue +33 -0
- package/app/components/shadcn/input/index.ts +1 -0
- package/app/components/shadcn/input-group/InputGroup.vue +35 -0
- package/app/components/shadcn/input-group/InputGroupAddon.vue +36 -0
- package/app/components/shadcn/input-group/InputGroupButton.vue +29 -0
- package/app/components/shadcn/input-group/InputGroupInput.vue +19 -0
- package/app/components/shadcn/input-group/InputGroupText.vue +19 -0
- package/app/components/shadcn/input-group/InputGroupTextarea.vue +19 -0
- package/app/components/shadcn/input-group/index.ts +51 -0
- package/app/components/shadcn/label/Label.vue +26 -0
- package/app/components/shadcn/label/index.ts +1 -0
- package/app/components/shadcn/number-field/NumberField.vue +20 -0
- package/app/components/shadcn/number-field/NumberFieldContent.vue +14 -0
- package/app/components/shadcn/number-field/NumberFieldDecrement.vue +22 -0
- package/app/components/shadcn/number-field/NumberFieldIncrement.vue +22 -0
- package/app/components/shadcn/number-field/NumberFieldInput.vue +16 -0
- package/app/components/shadcn/number-field/index.ts +5 -0
- package/app/components/shadcn/pagination/Pagination.vue +26 -0
- package/app/components/shadcn/pagination/PaginationContent.vue +22 -0
- package/app/components/shadcn/pagination/PaginationEllipsis.vue +25 -0
- package/app/components/shadcn/pagination/PaginationFirst.vue +33 -0
- package/app/components/shadcn/pagination/PaginationItem.vue +34 -0
- package/app/components/shadcn/pagination/PaginationLast.vue +33 -0
- package/app/components/shadcn/pagination/PaginationNext.vue +33 -0
- package/app/components/shadcn/pagination/PaginationPrevious.vue +33 -0
- package/app/components/shadcn/pagination/index.ts +8 -0
- package/app/components/shadcn/pin-input/PinInput.vue +26 -0
- package/app/components/shadcn/pin-input/PinInputGroup.vue +21 -0
- package/app/components/shadcn/pin-input/PinInputSeparator.vue +19 -0
- package/app/components/shadcn/pin-input/PinInputSlot.vue +21 -0
- package/app/components/shadcn/pin-input/index.ts +4 -0
- package/app/components/shadcn/popover/Popover.vue +19 -0
- package/app/components/shadcn/popover/PopoverAnchor.vue +15 -0
- package/app/components/shadcn/popover/PopoverContent.vue +45 -0
- package/app/components/shadcn/popover/PopoverTrigger.vue +15 -0
- package/app/components/shadcn/popover/index.ts +4 -0
- package/app/components/shadcn/progress/Progress.vue +38 -0
- package/app/components/shadcn/progress/index.ts +1 -0
- package/app/components/shadcn/radio-group/RadioGroup.vue +25 -0
- package/app/components/shadcn/radio-group/RadioGroupItem.vue +40 -0
- package/app/components/shadcn/radio-group/index.ts +2 -0
- package/app/components/shadcn/scroll-area/ScrollArea.vue +33 -0
- package/app/components/shadcn/scroll-area/ScrollBar.vue +32 -0
- package/app/components/shadcn/scroll-area/index.ts +2 -0
- package/app/components/shadcn/select/Select.vue +19 -0
- package/app/components/shadcn/select/SelectContent.vue +51 -0
- package/app/components/shadcn/select/SelectGroup.vue +15 -0
- package/app/components/shadcn/select/SelectItem.vue +44 -0
- package/app/components/shadcn/select/SelectItemText.vue +15 -0
- package/app/components/shadcn/select/SelectLabel.vue +17 -0
- package/app/components/shadcn/select/SelectScrollDownButton.vue +26 -0
- package/app/components/shadcn/select/SelectScrollUpButton.vue +26 -0
- package/app/components/shadcn/select/SelectSeparator.vue +19 -0
- package/app/components/shadcn/select/SelectTrigger.vue +33 -0
- package/app/components/shadcn/select/SelectValue.vue +15 -0
- package/app/components/shadcn/select/index.ts +11 -0
- package/app/components/shadcn/separator/Separator.vue +29 -0
- package/app/components/shadcn/separator/index.ts +1 -0
- package/app/components/shadcn/sheet/Sheet.vue +19 -0
- package/app/components/shadcn/sheet/SheetClose.vue +15 -0
- package/app/components/shadcn/sheet/SheetContent.vue +62 -0
- package/app/components/shadcn/sheet/SheetDescription.vue +21 -0
- package/app/components/shadcn/sheet/SheetFooter.vue +16 -0
- package/app/components/shadcn/sheet/SheetHeader.vue +15 -0
- package/app/components/shadcn/sheet/SheetOverlay.vue +21 -0
- package/app/components/shadcn/sheet/SheetTitle.vue +21 -0
- package/app/components/shadcn/sheet/SheetTrigger.vue +15 -0
- package/app/components/shadcn/sheet/index.ts +8 -0
- package/app/components/shadcn/sidebar/Sidebar.vue +96 -0
- package/app/components/shadcn/sidebar/SidebarContent.vue +18 -0
- package/app/components/shadcn/sidebar/SidebarFooter.vue +18 -0
- package/app/components/shadcn/sidebar/SidebarGroup.vue +18 -0
- package/app/components/shadcn/sidebar/SidebarGroupAction.vue +27 -0
- package/app/components/shadcn/sidebar/SidebarGroupContent.vue +18 -0
- package/app/components/shadcn/sidebar/SidebarGroupLabel.vue +25 -0
- package/app/components/shadcn/sidebar/SidebarHeader.vue +18 -0
- package/app/components/shadcn/sidebar/SidebarInput.vue +22 -0
- package/app/components/shadcn/sidebar/SidebarInset.vue +21 -0
- package/app/components/shadcn/sidebar/SidebarMenu.vue +18 -0
- package/app/components/shadcn/sidebar/SidebarMenuAction.vue +35 -0
- package/app/components/shadcn/sidebar/SidebarMenuBadge.vue +26 -0
- package/app/components/shadcn/sidebar/SidebarMenuButton.vue +48 -0
- package/app/components/shadcn/sidebar/SidebarMenuButtonChild.vue +36 -0
- package/app/components/shadcn/sidebar/SidebarMenuItem.vue +18 -0
- package/app/components/shadcn/sidebar/SidebarMenuSkeleton.vue +35 -0
- package/app/components/shadcn/sidebar/SidebarMenuSub.vue +22 -0
- package/app/components/shadcn/sidebar/SidebarMenuSubButton.vue +36 -0
- package/app/components/shadcn/sidebar/SidebarMenuSubItem.vue +18 -0
- package/app/components/shadcn/sidebar/SidebarProvider.vue +82 -0
- package/app/components/shadcn/sidebar/SidebarRail.vue +33 -0
- package/app/components/shadcn/sidebar/SidebarSeparator.vue +19 -0
- package/app/components/shadcn/sidebar/SidebarTrigger.vue +27 -0
- package/app/components/shadcn/sidebar/index.ts +60 -0
- package/app/components/shadcn/sidebar/utils.ts +19 -0
- package/app/components/shadcn/skeleton/Skeleton.vue +17 -0
- package/app/components/shadcn/skeleton/index.ts +1 -0
- package/app/components/shadcn/slider/Slider.vue +43 -0
- package/app/components/shadcn/slider/index.ts +1 -0
- package/app/components/shadcn/sonner/Sonner.vue +42 -0
- package/app/components/shadcn/sonner/index.ts +1 -0
- package/app/components/shadcn/switch/Switch.vue +38 -0
- package/app/components/shadcn/switch/index.ts +1 -0
- package/app/components/shadcn/table/Table.vue +16 -0
- package/app/components/shadcn/table/TableBody.vue +17 -0
- package/app/components/shadcn/table/TableCaption.vue +17 -0
- package/app/components/shadcn/table/TableCell.vue +22 -0
- package/app/components/shadcn/table/TableEmpty.vue +34 -0
- package/app/components/shadcn/table/TableFooter.vue +17 -0
- package/app/components/shadcn/table/TableHead.vue +17 -0
- package/app/components/shadcn/table/TableHeader.vue +17 -0
- package/app/components/shadcn/table/TableRow.vue +17 -0
- package/app/components/shadcn/table/index.ts +9 -0
- package/app/components/shadcn/table/utils.ts +10 -0
- package/app/components/shadcn/tabs/Tabs.vue +24 -0
- package/app/components/shadcn/tabs/TabsContent.vue +21 -0
- package/app/components/shadcn/tabs/TabsList.vue +24 -0
- package/app/components/shadcn/tabs/TabsTrigger.vue +26 -0
- package/app/components/shadcn/tabs/index.ts +4 -0
- package/app/components/shadcn/textarea/Textarea.vue +28 -0
- package/app/components/shadcn/textarea/index.ts +1 -0
- package/app/components/shadcn/toggle/Toggle.vue +35 -0
- package/app/components/shadcn/toggle/index.ts +28 -0
- package/app/components/shadcn/toggle-group/ToggleGroup.vue +49 -0
- package/app/components/shadcn/toggle-group/ToggleGroupItem.vue +46 -0
- package/app/components/shadcn/toggle-group/index.ts +2 -0
- package/app/components/shadcn/tooltip/Tooltip.vue +19 -0
- package/app/components/shadcn/tooltip/TooltipContent.vue +34 -0
- package/app/components/shadcn/tooltip/TooltipProvider.vue +14 -0
- package/app/components/shadcn/tooltip/TooltipTrigger.vue +15 -0
- package/app/components/shadcn/tooltip/index.ts +4 -0
- package/app/components/ui/Accordion/index.stories.ts +108 -0
- package/app/components/ui/Accordion/index.vue +80 -0
- package/app/components/ui/Accordion/types.ts +27 -0
- package/app/components/ui/Alert/index.stories.ts +53 -0
- package/app/components/ui/Alert/index.vue +61 -0
- package/app/components/ui/Alert/types.ts +9 -0
- package/app/components/ui/AlertDialog/index.stories.ts +108 -0
- package/app/components/ui/AlertDialog/index.vue +25 -0
- package/app/components/ui/AsyncDataTable/en.json +3 -0
- package/app/components/ui/AsyncDataTable/index.stories.ts +141 -0
- package/app/components/ui/AsyncDataTable/index.vue +312 -0
- package/app/components/ui/AsyncDataTable/types.ts +53 -0
- package/app/components/ui/Avatar/index.stories.ts +84 -0
- package/app/components/ui/Avatar/index.vue +52 -0
- package/app/components/ui/Avatar/types.ts +8 -0
- package/app/components/ui/Badge/index.stories.ts +67 -0
- package/app/components/ui/Badge/index.vue +12 -0
- package/app/components/ui/Badge/types.ts +3 -0
- package/app/components/ui/Breadcrumb/index.stories.ts +52 -0
- package/app/components/ui/Breadcrumb/index.vue +61 -0
- package/app/components/ui/Breadcrumb/types.ts +11 -0
- package/app/components/ui/Button/index.stories.ts +145 -0
- package/app/components/ui/Button/index.vue +63 -0
- package/app/components/ui/Button/types.ts +14 -0
- package/app/components/ui/ButtonGroup/index.stories.ts +75 -0
- package/app/components/ui/ButtonGroup/index.vue +22 -0
- package/app/components/ui/ButtonGroup/types.ts +3 -0
- package/app/components/ui/Card/index.stories.ts +65 -0
- package/app/components/ui/Card/index.vue +28 -0
- package/app/components/ui/Card/types.ts +3 -0
- package/app/components/ui/Checkbox/index.stories.ts +68 -0
- package/app/components/ui/Checkbox/index.vue +23 -0
- package/app/components/ui/Checkbox/types.ts +3 -0
- package/app/components/ui/CopyButton/en.json +4 -0
- package/app/components/ui/CopyButton/index.stories.ts +55 -0
- package/app/components/ui/CopyButton/index.vue +98 -0
- package/app/components/ui/CopyButton/types.ts +10 -0
- package/app/components/ui/DataTable/en.json +3 -0
- package/app/components/ui/DataTable/index.stories.ts +231 -0
- package/app/components/ui/DataTable/index.vue +505 -0
- package/app/components/ui/DataTable/types.ts +42 -0
- package/app/components/ui/DatePicker/en.json +9 -0
- package/app/components/ui/DatePicker/index.stories.ts +70 -0
- package/app/components/ui/DatePicker/index.vue +127 -0
- package/app/components/ui/DatePicker/style.css +88 -0
- package/app/components/ui/DatePicker/types.ts +41 -0
- package/app/components/ui/DateRangePicker/en.json +5 -0
- package/app/components/ui/DateRangePicker/index.stories.ts +67 -0
- package/app/components/ui/DateRangePicker/index.vue +138 -0
- package/app/components/ui/DateRangePicker/types.ts +31 -0
- package/app/components/ui/Divider/index.stories.ts +42 -0
- package/app/components/ui/Divider/index.vue +16 -0
- package/app/components/ui/Divider/types.ts +3 -0
- package/app/components/ui/Drawer/index.stories.ts +124 -0
- package/app/components/ui/Drawer/index.vue +197 -0
- package/app/components/ui/Drawer/types.ts +22 -0
- package/app/components/ui/Dropdown/index.stories.ts +145 -0
- package/app/components/ui/Dropdown/index.vue +258 -0
- package/app/components/ui/Dropdown/types.ts +87 -0
- package/app/components/ui/FormItem/index.stories.ts +70 -0
- package/app/components/ui/FormItem/index.vue +56 -0
- package/app/components/ui/FormItem/types.ts +14 -0
- package/app/components/ui/Help/index.stories.ts +54 -0
- package/app/components/ui/Help/index.vue +35 -0
- package/app/components/ui/Help/types.ts +8 -0
- package/app/components/ui/Icon/index.stories.ts +68 -0
- package/app/components/ui/Icon/index.vue +30 -0
- package/app/components/ui/Icon/types.ts +5 -0
- package/app/components/ui/Input/index.stories.ts +73 -0
- package/app/components/ui/Input/index.vue +92 -0
- package/app/components/ui/Input/types.ts +9 -0
- package/app/components/ui/InputCurrency/index.stories.ts +75 -0
- package/app/components/ui/InputCurrency/index.vue +31 -0
- package/app/components/ui/InputCurrency/types.ts +4 -0
- package/app/components/ui/InputNumber/index.stories.ts +56 -0
- package/app/components/ui/InputNumber/index.vue +76 -0
- package/app/components/ui/InputNumber/types.ts +10 -0
- package/app/components/ui/InputOtp/index.stories.ts +39 -0
- package/app/components/ui/InputOtp/index.vue +45 -0
- package/app/components/ui/InputOtp/types.ts +5 -0
- package/app/components/ui/InputPercent/index.stories.ts +32 -0
- package/app/components/ui/InputPercent/index.vue +8 -0
- package/app/components/ui/InputRange/index.stories.ts +37 -0
- package/app/components/ui/InputRange/index.vue +49 -0
- package/app/components/ui/InputRange/types.ts +8 -0
- package/app/components/ui/Loading/index.stories.ts +36 -0
- package/app/components/ui/Loading/index.vue +15 -0
- package/app/components/ui/Loading/types.ts +3 -0
- package/app/components/ui/Markdown/index.stories.ts +52 -0
- package/app/components/ui/Markdown/index.vue +22 -0
- package/app/components/ui/Markdown/themes/github.css +1248 -0
- package/app/components/ui/Markdown/types.ts +3 -0
- package/app/components/ui/Modal/index.stories.ts +124 -0
- package/app/components/ui/Modal/index.vue +202 -0
- package/app/components/ui/Modal/types.ts +23 -0
- package/app/components/ui/ModalContent/index.stories.ts +47 -0
- package/app/components/ui/ModalContent/index.vue +79 -0
- package/app/components/ui/ModalContent/types.ts +9 -0
- package/app/components/ui/PageCard/index.stories.ts +106 -0
- package/app/components/ui/PageCard/index.vue +135 -0
- package/app/components/ui/PageCard/types.ts +16 -0
- package/app/components/ui/Pagination/en.json +3 -0
- package/app/components/ui/Pagination/index.stories.ts +82 -0
- package/app/components/ui/Pagination/index.vue +173 -0
- package/app/components/ui/Pagination/types.ts +18 -0
- package/app/components/ui/Popover/index.stories.ts +67 -0
- package/app/components/ui/Popover/index.vue +21 -0
- package/app/components/ui/Popover/types.ts +5 -0
- package/app/components/ui/Qrcode/index.stories.ts +57 -0
- package/app/components/ui/Qrcode/index.vue +40 -0
- package/app/components/ui/Qrcode/types.ts +3 -0
- package/app/components/ui/Radio/index.stories.ts +71 -0
- package/app/components/ui/Radio/index.vue +10 -0
- package/app/components/ui/Radio/types.ts +3 -0
- package/app/components/ui/RadioCardGroup/index.stories.ts +90 -0
- package/app/components/ui/RadioCardGroup/index.vue +64 -0
- package/app/components/ui/RadioCardGroup/types.ts +13 -0
- package/app/components/ui/ScrollArea/index.stories.ts +66 -0
- package/app/components/ui/ScrollArea/index.vue +64 -0
- package/app/components/ui/ScrollArea/types.ts +5 -0
- package/app/components/ui/SearchSelect/en.json +5 -0
- package/app/components/ui/SearchSelect/index.stories.ts +126 -0
- package/app/components/ui/SearchSelect/index.vue +259 -0
- package/app/components/ui/SearchSelect/types.ts +39 -0
- package/app/components/ui/Select/en.json +6 -0
- package/app/components/ui/Select/index.stories.ts +128 -0
- package/app/components/ui/Select/index.vue +267 -0
- package/app/components/ui/Select/types.ts +34 -0
- package/app/components/ui/Skeleton/index.stories.ts +56 -0
- package/app/components/ui/Skeleton/index.vue +12 -0
- package/app/components/ui/Skeleton/types.ts +4 -0
- package/app/components/ui/Slider/index.stories.ts +60 -0
- package/app/components/ui/Slider/index.vue +27 -0
- package/app/components/ui/Slider/types.ts +5 -0
- package/app/components/ui/Surface/index.stories.ts +50 -0
- package/app/components/ui/Surface/index.vue +108 -0
- package/app/components/ui/Surface/types.ts +8 -0
- package/app/components/ui/Switch/index.stories.ts +32 -0
- package/app/components/ui/Switch/index.vue +10 -0
- package/app/components/ui/Switch/types.ts +3 -0
- package/app/components/ui/Tabs/index.stories.ts +116 -0
- package/app/components/ui/Tabs/index.vue +94 -0
- package/app/components/ui/Tabs/types.ts +19 -0
- package/app/components/ui/Tag/index.stories.ts +51 -0
- package/app/components/ui/Tag/index.vue +108 -0
- package/app/components/ui/Tag/types.ts +8 -0
- package/app/components/ui/Textarea/index.stories.ts +35 -0
- package/app/components/ui/Textarea/index.vue +50 -0
- package/app/components/ui/Textarea/types.ts +8 -0
- package/app/components/ui/Toast/index.stories.ts +48 -0
- package/app/components/ui/Toast/index.vue +21 -0
- package/app/components/ui/Toast/types.ts +5 -0
- package/app/components/ui/Tooltip/index.stories.ts +62 -0
- package/app/components/ui/Tooltip/index.vue +72 -0
- package/app/components/ui/Tooltip/types.ts +7 -0
- package/app/components/ui/WebLink/index.stories.ts +59 -0
- package/app/components/ui/WebLink/index.vue +61 -0
- package/app/components/ui/WebLink/types.ts +11 -0
- package/app/composables/index.ts +9 -0
- package/app/composables/useDialog.ts +76 -0
- package/app/composables/useToast.ts +49 -0
- package/app/en.json +23 -0
- package/app/types/index.ts +7 -0
- package/app/utils/index.ts +6 -0
- package/i18n/messages/ar.json +65 -0
- package/i18n/messages/de.json +65 -0
- package/i18n/messages/en.json +65 -0
- package/i18n/messages/es.json +65 -0
- package/i18n/messages/fr.json +65 -0
- package/i18n/messages/hi.json +65 -0
- package/i18n/messages/id.json +65 -0
- package/i18n/messages/it.json +65 -0
- package/i18n/messages/ja.json +65 -0
- package/i18n/messages/ko.json +65 -0
- package/i18n/messages/nl.json +65 -0
- package/i18n/messages/pl.json +65 -0
- package/i18n/messages/pt.json +65 -0
- package/i18n/messages/ru.json +65 -0
- package/i18n/messages/th.json +65 -0
- package/i18n/messages/tr.json +65 -0
- package/i18n/messages/vi.json +65 -0
- package/i18n/messages/zh-CN.json +65 -0
- package/i18n/messages/zh-TW.json +65 -0
- package/i18n.config.ts +19 -0
- package/nuxt.config.ts +62 -0
- package/package.json +46 -0
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
<script setup lang="ts" generic="TData extends Record<string, any>">
|
|
2
|
+
import type {
|
|
3
|
+
AsyncDataTableFetchParams,
|
|
4
|
+
AsyncDataTableProps,
|
|
5
|
+
} from './types'
|
|
6
|
+
|
|
7
|
+
interface AsyncDataTablePagination {
|
|
8
|
+
page: number
|
|
9
|
+
size: number
|
|
10
|
+
total: number
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const props = withDefaults(defineProps<AsyncDataTableProps<TData>>(), {
|
|
14
|
+
columns: () => [],
|
|
15
|
+
fetchMethod: undefined,
|
|
16
|
+
autoFetch: true,
|
|
17
|
+
data: () => [],
|
|
18
|
+
filters: undefined,
|
|
19
|
+
showTopToolbar: undefined,
|
|
20
|
+
showBottomToolbar: true,
|
|
21
|
+
pageSizeOptions: () => [ 10, 20, 50, 100 ],
|
|
22
|
+
showPagination: true,
|
|
23
|
+
selectable: false,
|
|
24
|
+
batchActions: () => [],
|
|
25
|
+
selection: () => [],
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
const emit = defineEmits<{
|
|
29
|
+
'update:filters': [filters: Record<string, any>]
|
|
30
|
+
'update:selection': [value: TData[]]
|
|
31
|
+
}>()
|
|
32
|
+
|
|
33
|
+
const T = useTranslations('components.ui.AsyncDataTable')
|
|
34
|
+
const { isMobile } = useDevice()
|
|
35
|
+
|
|
36
|
+
// -- Selection --
|
|
37
|
+
|
|
38
|
+
const selectionValue = computed(() => props.selection ?? [])
|
|
39
|
+
|
|
40
|
+
function onSelectionChange (value: TData | TData[] | null) {
|
|
41
|
+
emit('update:selection', Array.isArray(value) ? value : value ? [ value ] : [])
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// -- Internal state --
|
|
45
|
+
|
|
46
|
+
const loading = ref(false)
|
|
47
|
+
const internalData = ref<TData[]>([]) as Ref<TData[]>
|
|
48
|
+
const requestVersion = ref(0)
|
|
49
|
+
|
|
50
|
+
const pagination = ref<AsyncDataTablePagination>({
|
|
51
|
+
page: Number(props.filters?.page) || 1,
|
|
52
|
+
size: Number(props.filters?.size) || props.pageSizeOptions[0] || 10,
|
|
53
|
+
total: 0,
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
const sortState = ref<{ sortBy: string | null, sortOrder: number | null }>({
|
|
57
|
+
sortBy: props.filters?.sortBy ? String(props.filters.sortBy) : null,
|
|
58
|
+
sortOrder: props.filters?.sortOrder ? Number(props.filters.sortOrder) : null,
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
// -- Computed --
|
|
62
|
+
|
|
63
|
+
const useFetchMode = computed(() => !!props.fetchMethod)
|
|
64
|
+
const tableData = computed(() => useFetchMode.value ? internalData.value : props.data)
|
|
65
|
+
|
|
66
|
+
const showSelectionColumn = computed(() => props.selectable || props.batchActions.length > 0)
|
|
67
|
+
const selectedCount = computed(() => props.selection?.length ?? 0)
|
|
68
|
+
const hasBatchActions = computed(() => props.batchActions.length > 0)
|
|
69
|
+
const batchActionsDisabled = computed(() => selectedCount.value === 0)
|
|
70
|
+
|
|
71
|
+
const hasPaginationData = computed(() => pagination.value.total > 0)
|
|
72
|
+
|
|
73
|
+
const shouldShowTopToolbar = computed(() => {
|
|
74
|
+
if (props.showTopToolbar !== undefined) return props.showTopToolbar
|
|
75
|
+
return pagination.value.size >= 50
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
const shouldShowBottomToolbar = computed(() => props.showBottomToolbar)
|
|
79
|
+
|
|
80
|
+
const batchMenuItems = computed<DropdownItem[]>(() =>
|
|
81
|
+
props.batchActions.map(action => ({
|
|
82
|
+
label: action.label,
|
|
83
|
+
icon: action.icon,
|
|
84
|
+
class: action.class,
|
|
85
|
+
disabled: action.disabled || batchActionsDisabled.value,
|
|
86
|
+
command: () => action.action(props.selection ?? []),
|
|
87
|
+
})),
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
// -- Data fetching --
|
|
91
|
+
|
|
92
|
+
async function fetchData (page?: number, forceRefresh = false) {
|
|
93
|
+
if (!props.fetchMethod) return
|
|
94
|
+
if (loading.value && !forceRefresh) return
|
|
95
|
+
|
|
96
|
+
const currentVersion = ++requestVersion.value
|
|
97
|
+
|
|
98
|
+
if (page !== undefined) {
|
|
99
|
+
pagination.value.page = page
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
loading.value = true
|
|
103
|
+
try {
|
|
104
|
+
const result = await props.fetchMethod(buildFetchParams())
|
|
105
|
+
if (currentVersion !== requestVersion.value) return
|
|
106
|
+
|
|
107
|
+
internalData.value = result.items as TData[]
|
|
108
|
+
pagination.value.total = result.total
|
|
109
|
+
} catch (error) {
|
|
110
|
+
if (currentVersion !== requestVersion.value) return
|
|
111
|
+
console.error('AsyncDataTable fetchData failed:', error)
|
|
112
|
+
} finally {
|
|
113
|
+
if (currentVersion === requestVersion.value) {
|
|
114
|
+
loading.value = false
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function resetPagination (overrides?: Record<string, any>) {
|
|
120
|
+
pagination.value.page = 1
|
|
121
|
+
pagination.value.total = 0
|
|
122
|
+
emit('update:filters', getFilters(overrides))
|
|
123
|
+
fetchData(undefined, true)
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// -- Internal helpers --
|
|
127
|
+
|
|
128
|
+
function getFilters (overrides?: Record<string, any>): Record<string, any> {
|
|
129
|
+
return {
|
|
130
|
+
...(props.filters ?? {}),
|
|
131
|
+
...overrides,
|
|
132
|
+
page: pagination.value.page,
|
|
133
|
+
size: pagination.value.size,
|
|
134
|
+
sortBy: sortState.value.sortBy,
|
|
135
|
+
sortOrder: sortState.value.sortOrder,
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function buildFetchParams (): AsyncDataTableFetchParams {
|
|
140
|
+
const filters = getFilters()
|
|
141
|
+
const { page, size, ...rest } = filters
|
|
142
|
+
return {
|
|
143
|
+
offset: (Number(page) - 1) * Number(size),
|
|
144
|
+
limit: Number(size),
|
|
145
|
+
...rest,
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// -- Event handlers --
|
|
150
|
+
|
|
151
|
+
function onPageChange (newPage: number) {
|
|
152
|
+
if (newPage === pagination.value.page) return
|
|
153
|
+
pagination.value.page = newPage
|
|
154
|
+
emit('update:filters', getFilters())
|
|
155
|
+
fetchData()
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function onPageSizeChange (newSize: number) {
|
|
159
|
+
if (newSize === pagination.value.size) return
|
|
160
|
+
pagination.value.size = newSize
|
|
161
|
+
pagination.value.page = 1
|
|
162
|
+
emit('update:filters', getFilters())
|
|
163
|
+
fetchData(undefined, true)
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// Batch sort updates: DataTable emits sortBy and sortOrder separately but synchronously
|
|
167
|
+
let sortUpdatePending = false
|
|
168
|
+
|
|
169
|
+
function onSortByUpdate (value: string | null) {
|
|
170
|
+
sortState.value.sortBy = value
|
|
171
|
+
scheduleAfterSort()
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
function onSortOrderUpdate (value: number | null) {
|
|
175
|
+
sortState.value.sortOrder = value
|
|
176
|
+
scheduleAfterSort()
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function scheduleAfterSort () {
|
|
180
|
+
if (sortUpdatePending) return
|
|
181
|
+
sortUpdatePending = true
|
|
182
|
+
nextTick(() => {
|
|
183
|
+
sortUpdatePending = false
|
|
184
|
+
pagination.value.page = 1
|
|
185
|
+
emit('update:filters', getFilters())
|
|
186
|
+
fetchData(1, true)
|
|
187
|
+
})
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// -- Expose --
|
|
191
|
+
|
|
192
|
+
defineExpose({
|
|
193
|
+
fetchData,
|
|
194
|
+
resetPagination,
|
|
195
|
+
})
|
|
196
|
+
|
|
197
|
+
// -- Lifecycle --
|
|
198
|
+
|
|
199
|
+
onMounted(() => {
|
|
200
|
+
emit('update:filters', getFilters())
|
|
201
|
+
if (props.autoFetch) {
|
|
202
|
+
fetchData()
|
|
203
|
+
}
|
|
204
|
+
})
|
|
205
|
+
</script>
|
|
206
|
+
|
|
207
|
+
<template>
|
|
208
|
+
<div>
|
|
209
|
+
<!-- Top toolbar -->
|
|
210
|
+
<div
|
|
211
|
+
v-if="shouldShowTopToolbar && (!!$slots.toolbar || hasBatchActions || (showPagination && hasPaginationData))"
|
|
212
|
+
class="mb-4 flex flex-wrap items-center justify-between gap-4"
|
|
213
|
+
>
|
|
214
|
+
<div class="flex items-center gap-2">
|
|
215
|
+
<Dropdown
|
|
216
|
+
v-if="hasBatchActions"
|
|
217
|
+
:menus="batchMenuItems"
|
|
218
|
+
trigger="click"
|
|
219
|
+
>
|
|
220
|
+
<Button
|
|
221
|
+
:variant="batchActionsDisabled ? 'outline' : 'default'"
|
|
222
|
+
:size="isMobile ? 'sm' : 'default'"
|
|
223
|
+
:disabled="batchActionsDisabled"
|
|
224
|
+
>
|
|
225
|
+
{{ T('actions') }} ({{ selectedCount }})
|
|
226
|
+
<Icon
|
|
227
|
+
name="chevron-down"
|
|
228
|
+
class="size-4"
|
|
229
|
+
/>
|
|
230
|
+
</Button>
|
|
231
|
+
</Dropdown>
|
|
232
|
+
<slot name="toolbar" />
|
|
233
|
+
</div>
|
|
234
|
+
|
|
235
|
+
<Pagination
|
|
236
|
+
v-if="showPagination"
|
|
237
|
+
:page="pagination.page"
|
|
238
|
+
:total="pagination.total"
|
|
239
|
+
:pageSize="pagination.size"
|
|
240
|
+
:pageSizeOptions="pageSizeOptions"
|
|
241
|
+
:simple="isMobile"
|
|
242
|
+
:size="isMobile ? 'sm' : 'default'"
|
|
243
|
+
@update:page="onPageChange"
|
|
244
|
+
@update:pageSize="onPageSizeChange"
|
|
245
|
+
/>
|
|
246
|
+
</div>
|
|
247
|
+
|
|
248
|
+
<!-- DataTable -->
|
|
249
|
+
<DataTable
|
|
250
|
+
:selection="selectionValue"
|
|
251
|
+
:data="tableData"
|
|
252
|
+
:columns="columns"
|
|
253
|
+
:loading="loading"
|
|
254
|
+
:selectionMode="showSelectionColumn ? 'multiple' : undefined"
|
|
255
|
+
:sortBy="sortState.sortBy"
|
|
256
|
+
:sortOrder="sortState.sortOrder"
|
|
257
|
+
@update:selection="onSelectionChange"
|
|
258
|
+
@update:sortBy="onSortByUpdate"
|
|
259
|
+
@update:sortOrder="onSortOrderUpdate"
|
|
260
|
+
>
|
|
261
|
+
<template
|
|
262
|
+
v-for="name in Object.keys($slots).filter(n => n !== 'toolbar')"
|
|
263
|
+
:key="name"
|
|
264
|
+
#[name]="slotData"
|
|
265
|
+
>
|
|
266
|
+
<slot
|
|
267
|
+
:name="name"
|
|
268
|
+
v-bind="slotData ?? {}"
|
|
269
|
+
/>
|
|
270
|
+
</template>
|
|
271
|
+
</DataTable>
|
|
272
|
+
|
|
273
|
+
<!-- Bottom toolbar -->
|
|
274
|
+
<div
|
|
275
|
+
v-if="shouldShowBottomToolbar && (!!$slots.toolbar || hasBatchActions || (showPagination && hasPaginationData))"
|
|
276
|
+
class="mt-4 flex flex-wrap items-center justify-between gap-4"
|
|
277
|
+
>
|
|
278
|
+
<div class="flex items-center gap-2">
|
|
279
|
+
<Dropdown
|
|
280
|
+
v-if="hasBatchActions"
|
|
281
|
+
:menus="batchMenuItems"
|
|
282
|
+
trigger="click"
|
|
283
|
+
>
|
|
284
|
+
<Button
|
|
285
|
+
:variant="batchActionsDisabled ? 'outline' : 'default'"
|
|
286
|
+
:size="isMobile ? 'sm' : 'default'"
|
|
287
|
+
:disabled="batchActionsDisabled"
|
|
288
|
+
>
|
|
289
|
+
{{ T('actions') }} ({{ selectedCount }})
|
|
290
|
+
<Icon
|
|
291
|
+
name="chevron-down"
|
|
292
|
+
class="size-4"
|
|
293
|
+
/>
|
|
294
|
+
</Button>
|
|
295
|
+
</Dropdown>
|
|
296
|
+
<slot name="toolbar" />
|
|
297
|
+
</div>
|
|
298
|
+
|
|
299
|
+
<Pagination
|
|
300
|
+
v-if="showPagination"
|
|
301
|
+
:page="pagination.page"
|
|
302
|
+
:total="pagination.total"
|
|
303
|
+
:pageSize="pagination.size"
|
|
304
|
+
:pageSizeOptions="pageSizeOptions"
|
|
305
|
+
:simple="isMobile"
|
|
306
|
+
:size="isMobile ? 'sm' : 'default'"
|
|
307
|
+
@update:page="onPageChange"
|
|
308
|
+
@update:pageSize="onPageSizeChange"
|
|
309
|
+
/>
|
|
310
|
+
</div>
|
|
311
|
+
</div>
|
|
312
|
+
</template>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { Component } from 'vue'
|
|
2
|
+
import type { DataTableColumn } from '../DataTable/types'
|
|
3
|
+
|
|
4
|
+
export interface AsyncDataTableBatchAction<T = Record<string, any>> {
|
|
5
|
+
/** Button/menu item label */
|
|
6
|
+
label: string
|
|
7
|
+
/** Icon name or component */
|
|
8
|
+
icon?: string | Component
|
|
9
|
+
/** Custom CSS class */
|
|
10
|
+
class?: ClassValue
|
|
11
|
+
/** Whether the action is disabled */
|
|
12
|
+
disabled?: boolean
|
|
13
|
+
/** Callback with selected items */
|
|
14
|
+
action: (selectedItems: T[]) => void
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface AsyncDataTableFetchParams {
|
|
18
|
+
offset: number
|
|
19
|
+
limit: number
|
|
20
|
+
[key: string]: any
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface AsyncDataTableFetchResult<T = Record<string, any>> {
|
|
24
|
+
items: T[]
|
|
25
|
+
total: number
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface AsyncDataTableProps<T = Record<string, any>> {
|
|
29
|
+
/** Column definitions */
|
|
30
|
+
columns?: DataTableColumn[]
|
|
31
|
+
/** Async function to fetch data. If not provided, uses static data mode */
|
|
32
|
+
fetchMethod?: (params: AsyncDataTableFetchParams) => Promise<AsyncDataTableFetchResult<T>>
|
|
33
|
+
/** Whether to auto fetch data on mount (default: true) */
|
|
34
|
+
autoFetch?: boolean
|
|
35
|
+
/** Static data array (used when fetchMethod is not provided) */
|
|
36
|
+
data?: T[]
|
|
37
|
+
/** External filter state */
|
|
38
|
+
filters?: Record<string, any>
|
|
39
|
+
/** Whether to show top toolbar (undefined = auto when page size >= 50) */
|
|
40
|
+
showTopToolbar?: boolean
|
|
41
|
+
/** Whether to show bottom toolbar (default: true) */
|
|
42
|
+
showBottomToolbar?: boolean
|
|
43
|
+
/** Available page size options */
|
|
44
|
+
pageSizeOptions?: number[]
|
|
45
|
+
/** Whether to show pagination controls (default: true) */
|
|
46
|
+
showPagination?: boolean
|
|
47
|
+
/** Whether rows are selectable */
|
|
48
|
+
selectable?: boolean
|
|
49
|
+
/** Batch action definitions for selected rows */
|
|
50
|
+
batchActions?: AsyncDataTableBatchAction<T>[]
|
|
51
|
+
/** Selected rows (v-model:selection) */
|
|
52
|
+
selection?: T[]
|
|
53
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
+
import Avatar from './index.vue'
|
|
3
|
+
|
|
4
|
+
type AvatarSize = 'small' | 'normal' | 'large' | 'xlarge'
|
|
5
|
+
type AvatarShape = 'circle' | 'square'
|
|
6
|
+
|
|
7
|
+
const sizes: AvatarSize[] = [ 'small', 'normal', 'large', 'xlarge' ]
|
|
8
|
+
const shapes: AvatarShape[] = [ 'circle', 'square' ]
|
|
9
|
+
|
|
10
|
+
const meta = {
|
|
11
|
+
title: 'UI/Avatar',
|
|
12
|
+
component: Avatar,
|
|
13
|
+
argTypes: {
|
|
14
|
+
size: { control: 'select', options: sizes },
|
|
15
|
+
shape: { control: 'select', options: shapes },
|
|
16
|
+
image: { control: 'text' },
|
|
17
|
+
label: { control: 'text' },
|
|
18
|
+
fallbackLabel: { control: 'text' },
|
|
19
|
+
},
|
|
20
|
+
args: {
|
|
21
|
+
size: 'normal',
|
|
22
|
+
shape: 'circle',
|
|
23
|
+
label: 'AB',
|
|
24
|
+
},
|
|
25
|
+
} satisfies Meta<typeof Avatar>
|
|
26
|
+
|
|
27
|
+
export default meta
|
|
28
|
+
type Story = StoryObj<typeof meta>
|
|
29
|
+
|
|
30
|
+
export const Default: Story = {
|
|
31
|
+
render: args => ({
|
|
32
|
+
components: { Avatar },
|
|
33
|
+
setup: () => ({ args, sizes, shapes }),
|
|
34
|
+
template: `
|
|
35
|
+
<div class="space-y-10">
|
|
36
|
+
<!-- Controlled -->
|
|
37
|
+
<section>
|
|
38
|
+
<h3 class="mb-4 text-lg font-medium">Controlled</h3>
|
|
39
|
+
<Avatar v-bind="args" />
|
|
40
|
+
</section>
|
|
41
|
+
|
|
42
|
+
<!-- Sizes -->
|
|
43
|
+
<section>
|
|
44
|
+
<h3 class="mb-4 text-lg font-medium">Sizes</h3>
|
|
45
|
+
<div class="flex items-end gap-4">
|
|
46
|
+
<div v-for="s in sizes" :key="s" class="flex flex-col items-center gap-2">
|
|
47
|
+
<Avatar :size="s" label="AB" />
|
|
48
|
+
<span class="text-xs text-muted-foreground">{{ s }}</span>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
</section>
|
|
52
|
+
|
|
53
|
+
<!-- Shapes -->
|
|
54
|
+
<section>
|
|
55
|
+
<h3 class="mb-4 text-lg font-medium">Shapes</h3>
|
|
56
|
+
<div class="flex items-center gap-4">
|
|
57
|
+
<div v-for="sh in shapes" :key="sh" class="flex flex-col items-center gap-2">
|
|
58
|
+
<Avatar :shape="sh" label="AB" size="large" />
|
|
59
|
+
<span class="text-xs text-muted-foreground">{{ sh }}</span>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
</section>
|
|
63
|
+
|
|
64
|
+
<!-- With Image -->
|
|
65
|
+
<section>
|
|
66
|
+
<h3 class="mb-4 text-lg font-medium">With Image</h3>
|
|
67
|
+
<div class="flex items-center gap-4">
|
|
68
|
+
<Avatar image="https://i.pravatar.cc/150?u=1" size="large" />
|
|
69
|
+
<Avatar image="https://i.pravatar.cc/150?u=2" size="large" shape="square" />
|
|
70
|
+
</div>
|
|
71
|
+
</section>
|
|
72
|
+
|
|
73
|
+
<!-- Fallback Label -->
|
|
74
|
+
<section>
|
|
75
|
+
<h3 class="mb-4 text-lg font-medium">Fallback Label</h3>
|
|
76
|
+
<div class="flex items-center gap-4">
|
|
77
|
+
<Avatar label="John Doe" fallback-label="JD" />
|
|
78
|
+
<Avatar fallback-label="??" />
|
|
79
|
+
</div>
|
|
80
|
+
</section>
|
|
81
|
+
</div>
|
|
82
|
+
`,
|
|
83
|
+
}),
|
|
84
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
Avatar as ShadcnAvatar,
|
|
4
|
+
AvatarFallback,
|
|
5
|
+
AvatarImage,
|
|
6
|
+
} from '@polymarbot/nuxt-layer-shadcn-ui/app/components/shadcn/avatar'
|
|
7
|
+
import type { AvatarProps } from './types'
|
|
8
|
+
|
|
9
|
+
const props = withDefaults(defineProps<AvatarProps>(), {
|
|
10
|
+
image: undefined,
|
|
11
|
+
label: undefined,
|
|
12
|
+
fallbackLabel: undefined,
|
|
13
|
+
size: 'normal',
|
|
14
|
+
shape: 'circle',
|
|
15
|
+
class: undefined,
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
// Map our size names to shadcn avatar variant sizes
|
|
19
|
+
const sizeClasses: Record<string, string> = {
|
|
20
|
+
small: 'size-8 text-xs',
|
|
21
|
+
normal: 'size-10 text-sm',
|
|
22
|
+
large: 'size-12 text-base',
|
|
23
|
+
xlarge: 'size-16 text-lg',
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const effectiveLabel = computed(() => props.fallbackLabel ?? props.label)
|
|
27
|
+
|
|
28
|
+
const mergedClass = computed(() =>
|
|
29
|
+
cn(
|
|
30
|
+
sizeClasses[props.size],
|
|
31
|
+
props.shape === 'square' && `
|
|
32
|
+
rounded-md!
|
|
33
|
+
**:rounded-md!
|
|
34
|
+
`,
|
|
35
|
+
props.class,
|
|
36
|
+
),
|
|
37
|
+
)
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<template>
|
|
41
|
+
<ShadcnAvatar
|
|
42
|
+
:class="mergedClass"
|
|
43
|
+
>
|
|
44
|
+
<AvatarImage
|
|
45
|
+
v-if="image"
|
|
46
|
+
:src="image"
|
|
47
|
+
/>
|
|
48
|
+
<AvatarFallback class="font-medium text-muted-foreground">
|
|
49
|
+
<slot>{{ effectiveLabel }}</slot>
|
|
50
|
+
</AvatarFallback>
|
|
51
|
+
</ShadcnAvatar>
|
|
52
|
+
</template>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
+
import Icon from '../Icon/index.vue'
|
|
3
|
+
import Badge from './index.vue'
|
|
4
|
+
|
|
5
|
+
type BadgeVariant = 'default' | 'secondary' | 'outline' | 'destructive'
|
|
6
|
+
|
|
7
|
+
const variants: BadgeVariant[] = [ 'default', 'secondary', 'outline', 'destructive' ]
|
|
8
|
+
|
|
9
|
+
const meta = {
|
|
10
|
+
title: 'UI/Badge',
|
|
11
|
+
component: Badge,
|
|
12
|
+
argTypes: {
|
|
13
|
+
variant: { control: 'select', options: variants },
|
|
14
|
+
},
|
|
15
|
+
args: {
|
|
16
|
+
variant: 'default',
|
|
17
|
+
},
|
|
18
|
+
} satisfies Meta<typeof Badge>
|
|
19
|
+
|
|
20
|
+
export default meta
|
|
21
|
+
type Story = StoryObj<typeof meta>
|
|
22
|
+
|
|
23
|
+
export const Default: Story = {
|
|
24
|
+
render: args => ({
|
|
25
|
+
components: { Badge, Icon },
|
|
26
|
+
setup: () => ({ args, variants }),
|
|
27
|
+
template: `
|
|
28
|
+
<div class="space-y-10">
|
|
29
|
+
<!-- Controlled -->
|
|
30
|
+
<section>
|
|
31
|
+
<h3 class="mb-4 text-lg font-medium">Controlled</h3>
|
|
32
|
+
<Badge v-bind="args">Badge</Badge>
|
|
33
|
+
</section>
|
|
34
|
+
|
|
35
|
+
<!-- Variants -->
|
|
36
|
+
<section>
|
|
37
|
+
<h3 class="mb-4 text-lg font-medium">Variants</h3>
|
|
38
|
+
<div class="flex flex-wrap items-center gap-3">
|
|
39
|
+
<Badge v-for="v in variants" :key="v" :variant="v">{{ v }}</Badge>
|
|
40
|
+
</div>
|
|
41
|
+
</section>
|
|
42
|
+
|
|
43
|
+
<!-- Numeric -->
|
|
44
|
+
<section>
|
|
45
|
+
<h3 class="mb-4 text-lg font-medium">Numeric</h3>
|
|
46
|
+
<div class="flex flex-wrap items-center gap-3">
|
|
47
|
+
<Badge>1</Badge>
|
|
48
|
+
<Badge variant="secondary">42</Badge>
|
|
49
|
+
<Badge variant="destructive">99+</Badge>
|
|
50
|
+
<Badge variant="outline">0</Badge>
|
|
51
|
+
</div>
|
|
52
|
+
</section>
|
|
53
|
+
|
|
54
|
+
<!-- With Icons -->
|
|
55
|
+
<section>
|
|
56
|
+
<h3 class="mb-4 text-lg font-medium">With Icons</h3>
|
|
57
|
+
<div class="flex flex-wrap items-center gap-3">
|
|
58
|
+
<Badge><Icon name="check" /> Approved</Badge>
|
|
59
|
+
<Badge variant="secondary"><Icon name="clock" /> Pending</Badge>
|
|
60
|
+
<Badge variant="destructive"><Icon name="x" /> Rejected</Badge>
|
|
61
|
+
<Badge variant="outline"><Icon name="star" /> Featured</Badge>
|
|
62
|
+
</div>
|
|
63
|
+
</section>
|
|
64
|
+
</div>
|
|
65
|
+
`,
|
|
66
|
+
}),
|
|
67
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { Badge as ShadcnBadge } from '@polymarbot/nuxt-layer-shadcn-ui/app/components/shadcn/badge'
|
|
3
|
+
import type { BadgeProps } from './types'
|
|
4
|
+
|
|
5
|
+
defineProps<BadgeProps>()
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<ShadcnBadge>
|
|
10
|
+
<slot />
|
|
11
|
+
</ShadcnBadge>
|
|
12
|
+
</template>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
+
import Breadcrumb from './index.vue'
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'UI/Breadcrumb',
|
|
6
|
+
component: Breadcrumb,
|
|
7
|
+
} satisfies Meta<typeof Breadcrumb>
|
|
8
|
+
|
|
9
|
+
export default meta
|
|
10
|
+
type Story = StoryObj<typeof meta>
|
|
11
|
+
|
|
12
|
+
export const Default: Story = {
|
|
13
|
+
render: () => ({
|
|
14
|
+
components: { Breadcrumb },
|
|
15
|
+
setup () {
|
|
16
|
+
const home = { label: 'Home', icon: 'house', href: '/' }
|
|
17
|
+
const basicItems = [
|
|
18
|
+
{ label: 'Products', href: '/products' },
|
|
19
|
+
{ label: 'Electronics', href: '/products/electronics' },
|
|
20
|
+
{ label: 'Laptops' },
|
|
21
|
+
]
|
|
22
|
+
const withIcons = [
|
|
23
|
+
{ label: 'Settings', icon: 'settings', href: '/settings' },
|
|
24
|
+
{ label: 'Profile' },
|
|
25
|
+
]
|
|
26
|
+
return { home, basicItems, withIcons }
|
|
27
|
+
},
|
|
28
|
+
template: `
|
|
29
|
+
<div class="space-y-10">
|
|
30
|
+
<section>
|
|
31
|
+
<h3 class="mb-4 text-lg font-medium">Basic</h3>
|
|
32
|
+
<Breadcrumb :model="basicItems" />
|
|
33
|
+
</section>
|
|
34
|
+
|
|
35
|
+
<section>
|
|
36
|
+
<h3 class="mb-4 text-lg font-medium">With Home</h3>
|
|
37
|
+
<Breadcrumb :home="home" :model="basicItems" />
|
|
38
|
+
</section>
|
|
39
|
+
|
|
40
|
+
<section>
|
|
41
|
+
<h3 class="mb-4 text-lg font-medium">With Icons</h3>
|
|
42
|
+
<Breadcrumb :home="home" :model="withIcons" />
|
|
43
|
+
</section>
|
|
44
|
+
|
|
45
|
+
<section>
|
|
46
|
+
<h3 class="mb-4 text-lg font-medium">Single Item</h3>
|
|
47
|
+
<Breadcrumb :home="home" />
|
|
48
|
+
</section>
|
|
49
|
+
</div>
|
|
50
|
+
`,
|
|
51
|
+
}),
|
|
52
|
+
}
|