@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,14 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { TooltipProviderProps } from "reka-ui"
|
|
3
|
+
import { TooltipProvider } from "reka-ui"
|
|
4
|
+
|
|
5
|
+
const props = withDefaults(defineProps<TooltipProviderProps>(), {
|
|
6
|
+
delayDuration: 0,
|
|
7
|
+
})
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<TooltipProvider v-bind="props">
|
|
12
|
+
<slot />
|
|
13
|
+
</TooltipProvider>
|
|
14
|
+
</template>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { TooltipTriggerProps } from "reka-ui"
|
|
3
|
+
import { TooltipTrigger } from "reka-ui"
|
|
4
|
+
|
|
5
|
+
const props = defineProps<TooltipTriggerProps>()
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<TooltipTrigger
|
|
10
|
+
data-slot="tooltip-trigger"
|
|
11
|
+
v-bind="props"
|
|
12
|
+
>
|
|
13
|
+
<slot />
|
|
14
|
+
</TooltipTrigger>
|
|
15
|
+
</template>
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
+
import Icon from '../Icon/index.vue'
|
|
3
|
+
import Surface from '../Surface/index.vue'
|
|
4
|
+
import type { AccordionItem } from './types'
|
|
5
|
+
import Accordion from './index.vue'
|
|
6
|
+
|
|
7
|
+
const items: AccordionItem[] = [
|
|
8
|
+
{
|
|
9
|
+
value: 'shipping',
|
|
10
|
+
title: 'Shipping & delivery',
|
|
11
|
+
content:
|
|
12
|
+
'Orders are processed within 1-2 business days. Standard shipping takes 3-5 business days within the continental US.',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
value: 'returns',
|
|
16
|
+
title: 'Returns policy',
|
|
17
|
+
content:
|
|
18
|
+
'We accept returns within 30 days of purchase. Items must be unworn with original tags attached.',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
value: 'support',
|
|
22
|
+
title: 'Customer support',
|
|
23
|
+
content:
|
|
24
|
+
'Our support team is available Monday through Friday, 9am-6pm EST. Reach out via chat or email for assistance.',
|
|
25
|
+
},
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
const meta = {
|
|
29
|
+
title: 'UI/Accordion',
|
|
30
|
+
component: Accordion as any,
|
|
31
|
+
argTypes: {
|
|
32
|
+
type: { control: 'select', options: [ 'single', 'multiple' ]},
|
|
33
|
+
collapsible: { control: 'boolean' },
|
|
34
|
+
disabled: { control: 'boolean' },
|
|
35
|
+
},
|
|
36
|
+
args: {
|
|
37
|
+
type: 'single',
|
|
38
|
+
collapsible: true,
|
|
39
|
+
disabled: false,
|
|
40
|
+
},
|
|
41
|
+
} satisfies Meta
|
|
42
|
+
|
|
43
|
+
export default meta
|
|
44
|
+
type Story = StoryObj<typeof meta>
|
|
45
|
+
|
|
46
|
+
export const Default: Story = {
|
|
47
|
+
render: args => ({
|
|
48
|
+
components: { Accordion, Surface, Icon },
|
|
49
|
+
setup () {
|
|
50
|
+
const singleValue = ref<string>('shipping')
|
|
51
|
+
const multipleValue = ref<string[]>([ 'shipping', 'returns' ])
|
|
52
|
+
const slotValue = ref<string>('shipping')
|
|
53
|
+
return { args, items, singleValue, multipleValue, slotValue }
|
|
54
|
+
},
|
|
55
|
+
template: `
|
|
56
|
+
<div class="max-w-md space-y-10">
|
|
57
|
+
<!-- Controlled -->
|
|
58
|
+
<section>
|
|
59
|
+
<h3 class="mb-4 text-lg font-medium">Controlled</h3>
|
|
60
|
+
<Surface variant="bordered" class="px-4">
|
|
61
|
+
<Accordion
|
|
62
|
+
v-model="singleValue"
|
|
63
|
+
v-bind="args"
|
|
64
|
+
:items="items"
|
|
65
|
+
/>
|
|
66
|
+
</Surface>
|
|
67
|
+
<div class="mt-3 text-sm text-muted-foreground">Open: {{ singleValue || '(none)' }}</div>
|
|
68
|
+
</section>
|
|
69
|
+
|
|
70
|
+
<!-- Multiple -->
|
|
71
|
+
<section>
|
|
72
|
+
<h3 class="mb-4 text-lg font-medium">Multiple</h3>
|
|
73
|
+
<Surface variant="bordered" class="px-4">
|
|
74
|
+
<Accordion
|
|
75
|
+
v-model="multipleValue"
|
|
76
|
+
type="multiple"
|
|
77
|
+
:items="items"
|
|
78
|
+
/>
|
|
79
|
+
</Surface>
|
|
80
|
+
<div class="mt-3 text-sm text-muted-foreground">Open: {{ multipleValue.join(', ') || '(none)' }}</div>
|
|
81
|
+
</section>
|
|
82
|
+
|
|
83
|
+
<!-- Custom Slots -->
|
|
84
|
+
<section>
|
|
85
|
+
<h3 class="mb-4 text-lg font-medium">Custom Slots</h3>
|
|
86
|
+
<Surface variant="bordered" class="px-4">
|
|
87
|
+
<Accordion
|
|
88
|
+
v-model="slotValue"
|
|
89
|
+
:items="items"
|
|
90
|
+
>
|
|
91
|
+
<template #title="{ item, open }">
|
|
92
|
+
<span class="flex items-center gap-2">
|
|
93
|
+
<span class="inline-flex size-5 items-center justify-center rounded-full bg-primary/15 text-primary">
|
|
94
|
+
<Icon :name="open ? 'minus' : 'plus'" class="size-3" />
|
|
95
|
+
</span>
|
|
96
|
+
{{ item.title }}
|
|
97
|
+
</span>
|
|
98
|
+
</template>
|
|
99
|
+
<template #content="{ item }">
|
|
100
|
+
<p class="text-muted-foreground">{{ item.content }}</p>
|
|
101
|
+
</template>
|
|
102
|
+
</Accordion>
|
|
103
|
+
</Surface>
|
|
104
|
+
</section>
|
|
105
|
+
</div>
|
|
106
|
+
`,
|
|
107
|
+
}),
|
|
108
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
Accordion as ShadcnAccordion,
|
|
4
|
+
AccordionContent,
|
|
5
|
+
AccordionItem as ShadcnAccordionItem,
|
|
6
|
+
AccordionTrigger,
|
|
7
|
+
} from '@polymarbot/nuxt-layer-shadcn-ui/app/components/shadcn/accordion'
|
|
8
|
+
import type { AccordionRootProps } from 'reka-ui'
|
|
9
|
+
import type { AccordionItem, AccordionProps } from './types'
|
|
10
|
+
|
|
11
|
+
const props = withDefaults(defineProps<AccordionProps>(), {
|
|
12
|
+
items: () => [],
|
|
13
|
+
type: 'single',
|
|
14
|
+
modelValue: undefined,
|
|
15
|
+
defaultValue: undefined,
|
|
16
|
+
collapsible: true,
|
|
17
|
+
disabled: false,
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
const emit = defineEmits<{
|
|
21
|
+
'update:modelValue': [value: string | string[] | undefined]
|
|
22
|
+
}>()
|
|
23
|
+
|
|
24
|
+
defineSlots<{
|
|
25
|
+
title?: (props: { item: AccordionItem, open: boolean }) => unknown
|
|
26
|
+
content?: (props: { item: AccordionItem, open: boolean }) => unknown
|
|
27
|
+
}>()
|
|
28
|
+
|
|
29
|
+
const rootProps = computed<AccordionRootProps>(() => {
|
|
30
|
+
if (props.type === 'multiple') {
|
|
31
|
+
return {
|
|
32
|
+
type: 'multiple',
|
|
33
|
+
modelValue: props.modelValue as string[] | undefined,
|
|
34
|
+
defaultValue: props.defaultValue as string[] | undefined,
|
|
35
|
+
disabled: props.disabled,
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
type: 'single',
|
|
40
|
+
modelValue: props.modelValue as string | undefined,
|
|
41
|
+
defaultValue: props.defaultValue as string | undefined,
|
|
42
|
+
collapsible: props.collapsible,
|
|
43
|
+
disabled: props.disabled,
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
</script>
|
|
47
|
+
|
|
48
|
+
<template>
|
|
49
|
+
<ShadcnAccordion
|
|
50
|
+
v-bind="rootProps"
|
|
51
|
+
@update:modelValue="value => emit('update:modelValue', value)"
|
|
52
|
+
>
|
|
53
|
+
<ShadcnAccordionItem
|
|
54
|
+
v-for="item in items"
|
|
55
|
+
:key="item.value"
|
|
56
|
+
v-slot="{ open }"
|
|
57
|
+
:value="item.value"
|
|
58
|
+
:disabled="item.disabled"
|
|
59
|
+
>
|
|
60
|
+
<AccordionTrigger>
|
|
61
|
+
<slot
|
|
62
|
+
name="title"
|
|
63
|
+
:item="item"
|
|
64
|
+
:open="open"
|
|
65
|
+
>
|
|
66
|
+
{{ item.title }}
|
|
67
|
+
</slot>
|
|
68
|
+
</AccordionTrigger>
|
|
69
|
+
<AccordionContent>
|
|
70
|
+
<slot
|
|
71
|
+
name="content"
|
|
72
|
+
:item="item"
|
|
73
|
+
:open="open"
|
|
74
|
+
>
|
|
75
|
+
{{ item.content }}
|
|
76
|
+
</slot>
|
|
77
|
+
</AccordionContent>
|
|
78
|
+
</ShadcnAccordionItem>
|
|
79
|
+
</ShadcnAccordion>
|
|
80
|
+
</template>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface AccordionItem {
|
|
2
|
+
value: string
|
|
3
|
+
title?: string
|
|
4
|
+
content?: string
|
|
5
|
+
disabled?: boolean
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export type AccordionBaseProps = {
|
|
9
|
+
items?: AccordionItem[]
|
|
10
|
+
disabled?: boolean
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type AccordionSingleProps = AccordionBaseProps & {
|
|
14
|
+
type?: 'single'
|
|
15
|
+
modelValue?: string
|
|
16
|
+
defaultValue?: string
|
|
17
|
+
/** Only applies to single type: whether the open item can be toggled closed. */
|
|
18
|
+
collapsible?: boolean
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type AccordionMultipleProps = AccordionBaseProps & {
|
|
22
|
+
type?: 'multiple'
|
|
23
|
+
modelValue?: string[]
|
|
24
|
+
defaultValue?: string[]
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type AccordionProps = AccordionSingleProps | AccordionMultipleProps
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
+
import Alert from './index.vue'
|
|
3
|
+
|
|
4
|
+
type AlertType = 'default' | 'success' | 'info' | 'help' | 'warn' | 'danger'
|
|
5
|
+
|
|
6
|
+
const types: AlertType[] = [ 'default', 'success', 'info', 'help', 'warn', 'danger' ]
|
|
7
|
+
|
|
8
|
+
const meta = {
|
|
9
|
+
title: 'UI/Alert',
|
|
10
|
+
component: Alert,
|
|
11
|
+
argTypes: {
|
|
12
|
+
type: { control: 'select', options: types },
|
|
13
|
+
icon: { control: 'text' },
|
|
14
|
+
},
|
|
15
|
+
args: {
|
|
16
|
+
type: 'default',
|
|
17
|
+
},
|
|
18
|
+
} satisfies Meta<typeof Alert>
|
|
19
|
+
|
|
20
|
+
export default meta
|
|
21
|
+
type Story = StoryObj<typeof meta>
|
|
22
|
+
|
|
23
|
+
export const Default: Story = {
|
|
24
|
+
render: args => ({
|
|
25
|
+
components: { Alert },
|
|
26
|
+
setup: () => ({ args, types }),
|
|
27
|
+
template: `
|
|
28
|
+
<div class="space-y-10">
|
|
29
|
+
<!-- Controlled -->
|
|
30
|
+
<section>
|
|
31
|
+
<h3 class="mb-4 text-lg font-medium">Controlled</h3>
|
|
32
|
+
<Alert v-bind="args">This is a controlled alert message.</Alert>
|
|
33
|
+
</section>
|
|
34
|
+
|
|
35
|
+
<!-- All Types -->
|
|
36
|
+
<section>
|
|
37
|
+
<h3 class="mb-4 text-lg font-medium">All Types</h3>
|
|
38
|
+
<div class="space-y-3">
|
|
39
|
+
<Alert v-for="t in types" :key="t" :type="t">
|
|
40
|
+
This is a <strong>{{ t }}</strong> alert message.
|
|
41
|
+
</Alert>
|
|
42
|
+
</div>
|
|
43
|
+
</section>
|
|
44
|
+
|
|
45
|
+
<!-- Custom Icon -->
|
|
46
|
+
<section>
|
|
47
|
+
<h3 class="mb-4 text-lg font-medium">Custom Icon</h3>
|
|
48
|
+
<Alert type="info" icon="bell">Alert with a custom bell icon.</Alert>
|
|
49
|
+
</section>
|
|
50
|
+
</div>
|
|
51
|
+
`,
|
|
52
|
+
}),
|
|
53
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { Alert as ShadcnAlert } from '@polymarbot/nuxt-layer-shadcn-ui/app/components/shadcn/alert'
|
|
3
|
+
import type { AlertProps, AlertType } from './types'
|
|
4
|
+
|
|
5
|
+
const typeIconNameMap: Record<AlertType, string> = {
|
|
6
|
+
default: 'info',
|
|
7
|
+
success: 'circle-check',
|
|
8
|
+
info: 'info',
|
|
9
|
+
help: 'circle-question-mark',
|
|
10
|
+
warn: 'triangle-alert',
|
|
11
|
+
danger: 'circle-x',
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const typeClasses: Record<AlertType, string> = {
|
|
15
|
+
default: 'border-border! bg-secondary text-secondary-foreground [&>svg]:text-secondary-foreground',
|
|
16
|
+
success: 'border-success/50! bg-success/10 text-success [&>svg]:text-success',
|
|
17
|
+
info: 'border-info/50! bg-info/10 text-info [&>svg]:text-info',
|
|
18
|
+
help: 'border-help/50! bg-help/10 text-help [&>svg]:text-help',
|
|
19
|
+
warn: 'border-warn/50! bg-warn/10 text-warn [&>svg]:text-warn',
|
|
20
|
+
danger: 'border-danger/50! bg-danger/10 text-danger [&>svg]:text-danger',
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const props = withDefaults(defineProps<AlertProps>(), {
|
|
24
|
+
type: 'default',
|
|
25
|
+
icon: undefined,
|
|
26
|
+
class: undefined,
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
const defaultIconName = computed(() => {
|
|
30
|
+
if (props.icon) return undefined
|
|
31
|
+
return typeIconNameMap[props.type]
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
const mergedClass = computed(() =>
|
|
35
|
+
cn(
|
|
36
|
+
typeClasses[props.type],
|
|
37
|
+
props.class,
|
|
38
|
+
),
|
|
39
|
+
)
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<template>
|
|
43
|
+
<ShadcnAlert :class="mergedClass">
|
|
44
|
+
<Icon
|
|
45
|
+
v-if="typeof icon === 'string'"
|
|
46
|
+
:name="icon"
|
|
47
|
+
/>
|
|
48
|
+
<component
|
|
49
|
+
:is="icon"
|
|
50
|
+
v-else-if="icon"
|
|
51
|
+
class="size-4"
|
|
52
|
+
/>
|
|
53
|
+
<Icon
|
|
54
|
+
v-else-if="defaultIconName"
|
|
55
|
+
:name="defaultIconName"
|
|
56
|
+
/>
|
|
57
|
+
<div>
|
|
58
|
+
<slot />
|
|
59
|
+
</div>
|
|
60
|
+
</ShadcnAlert>
|
|
61
|
+
</template>
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
+
import { useDialog } from '../../../composables/useDialog'
|
|
3
|
+
import Button from '../Button/index.vue'
|
|
4
|
+
import AlertDialog from './index.vue'
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'UI/AlertDialog',
|
|
8
|
+
component: AlertDialog,
|
|
9
|
+
decorators: [
|
|
10
|
+
() => ({
|
|
11
|
+
components: { AlertDialog },
|
|
12
|
+
template: '<div><story /><AlertDialog /></div>',
|
|
13
|
+
}),
|
|
14
|
+
],
|
|
15
|
+
} satisfies Meta<typeof AlertDialog>
|
|
16
|
+
|
|
17
|
+
export default meta
|
|
18
|
+
type Story = StoryObj<typeof meta>
|
|
19
|
+
|
|
20
|
+
export const Default: Story = {
|
|
21
|
+
render: () => ({
|
|
22
|
+
components: { Button },
|
|
23
|
+
setup () {
|
|
24
|
+
const { confirm, alert, destroy } = useDialog()
|
|
25
|
+
const result = ref('')
|
|
26
|
+
|
|
27
|
+
async function handleConfirm () {
|
|
28
|
+
const ok = await confirm({ title: 'Confirm', message: 'Do you want to proceed?' })
|
|
29
|
+
result.value = `confirm → ${ok}`
|
|
30
|
+
}
|
|
31
|
+
async function handleAlert () {
|
|
32
|
+
await alert({ title: 'Error', type: 'error', message: 'Something went wrong.' })
|
|
33
|
+
result.value = 'alert → closed'
|
|
34
|
+
}
|
|
35
|
+
async function handleDestroy () {
|
|
36
|
+
const ok = await destroy({ title: 'Delete Item', message: 'This action cannot be undone.' })
|
|
37
|
+
result.value = `destroy → ${ok}`
|
|
38
|
+
}
|
|
39
|
+
async function handleMulti () {
|
|
40
|
+
result.value = 'waiting...'
|
|
41
|
+
const r1 = confirm({ title: 'Dialog 1', message: 'First confirm dialog' })
|
|
42
|
+
const r2 = alert({ title: 'Dialog 2', message: 'Second alert dialog' })
|
|
43
|
+
const r3 = destroy({ title: 'Dialog 3', message: 'Third destroy dialog' })
|
|
44
|
+
const [ v1, , v3 ] = await Promise.all([ r1, r2, r3 ])
|
|
45
|
+
result.value = `multi → confirm: ${v1}, alert: done, destroy: ${v3}`
|
|
46
|
+
}
|
|
47
|
+
async function handleWithType () {
|
|
48
|
+
const ok = await confirm({ title: 'Warning', type: 'warn', message: 'This operation may affect your data. Do you want to continue?' })
|
|
49
|
+
result.value = `typed confirm → ${ok}`
|
|
50
|
+
}
|
|
51
|
+
async function handleAlertInfo () {
|
|
52
|
+
await alert({ title: 'Information', type: 'info', message: 'Your changes have been saved successfully.' })
|
|
53
|
+
result.value = 'typed alert → closed'
|
|
54
|
+
}
|
|
55
|
+
async function handleDestroyDanger () {
|
|
56
|
+
const ok = await destroy({ title: 'Delete Account', message: 'All data will be permanently removed. This action cannot be undone.' })
|
|
57
|
+
result.value = `typed destroy → ${ok}`
|
|
58
|
+
}
|
|
59
|
+
async function handleSuccess () {
|
|
60
|
+
await alert({ title: 'Success', type: 'success', message: 'Payment completed successfully.' })
|
|
61
|
+
result.value = 'success alert → closed'
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return { handleConfirm, handleAlert, handleDestroy, handleMulti, handleWithType, handleAlertInfo, handleDestroyDanger, handleSuccess, result }
|
|
65
|
+
},
|
|
66
|
+
template: `
|
|
67
|
+
<div class="space-y-10">
|
|
68
|
+
<!-- Confirm -->
|
|
69
|
+
<section>
|
|
70
|
+
<h3 class="mb-4 text-lg font-medium">Confirm</h3>
|
|
71
|
+
<Button @click="handleConfirm">Confirm</Button>
|
|
72
|
+
</section>
|
|
73
|
+
|
|
74
|
+
<!-- Alert -->
|
|
75
|
+
<section>
|
|
76
|
+
<h3 class="mb-4 text-lg font-medium">Alert</h3>
|
|
77
|
+
<Button variant="outline" @click="handleAlert">Alert</Button>
|
|
78
|
+
</section>
|
|
79
|
+
|
|
80
|
+
<!-- Destroy -->
|
|
81
|
+
<section>
|
|
82
|
+
<h3 class="mb-4 text-lg font-medium">Destroy</h3>
|
|
83
|
+
<Button variant="destructive" @click="handleDestroy">Destroy</Button>
|
|
84
|
+
</section>
|
|
85
|
+
|
|
86
|
+
<!-- Multi Dialog -->
|
|
87
|
+
<section>
|
|
88
|
+
<h3 class="mb-4 text-lg font-medium">Multi Dialog</h3>
|
|
89
|
+
<Button variant="secondary" @click="handleMulti">Multi Dialog</Button>
|
|
90
|
+
</section>
|
|
91
|
+
|
|
92
|
+
<!-- With Type (ModalContent) -->
|
|
93
|
+
<section>
|
|
94
|
+
<h3 class="mb-4 text-lg font-medium">With Type (ModalContent)</h3>
|
|
95
|
+
<div class="flex gap-2">
|
|
96
|
+
<Button variant="outline" @click="handleWithType">Warn Confirm</Button>
|
|
97
|
+
<Button variant="outline" @click="handleAlertInfo">Info Alert</Button>
|
|
98
|
+
<Button variant="outline" @click="handleSuccess">Success Alert</Button>
|
|
99
|
+
<Button variant="destructive" @click="handleDestroyDanger">Danger Destroy</Button>
|
|
100
|
+
</div>
|
|
101
|
+
</section>
|
|
102
|
+
|
|
103
|
+
<!-- Result -->
|
|
104
|
+
<div v-if="result" class="rounded-md bg-muted p-4 text-sm">Result: {{ result }}</div>
|
|
105
|
+
</div>
|
|
106
|
+
`,
|
|
107
|
+
}),
|
|
108
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const { current, isOpen, close, onClosed } = useDialogState()
|
|
3
|
+
|
|
4
|
+
const isAlert = computed(() => current.value?.options.rejectLabel === '')
|
|
5
|
+
const isDestructive = computed(() => {
|
|
6
|
+
const type = current.value?.options.type
|
|
7
|
+
return type === 'danger' || type === 'error'
|
|
8
|
+
})
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<Modal
|
|
13
|
+
:visible="isOpen"
|
|
14
|
+
:title="current?.options.title"
|
|
15
|
+
:type="current?.options.type"
|
|
16
|
+
:content="current?.options.message"
|
|
17
|
+
:showCancel="!isAlert"
|
|
18
|
+
:cancelText="current?.options.rejectLabel || undefined"
|
|
19
|
+
:confirmText="current?.options.acceptLabel || undefined"
|
|
20
|
+
:confirmVariant="isDestructive ? 'destructive' : 'default'"
|
|
21
|
+
@confirm="close(true)"
|
|
22
|
+
@cancel="close(false)"
|
|
23
|
+
@closed="onClosed"
|
|
24
|
+
/>
|
|
25
|
+
</template>
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
+
import type { AsyncDataTableBatchAction, AsyncDataTableFetchParams, AsyncDataTableFetchResult } from './types'
|
|
3
|
+
import type { DataTableColumn } from '../DataTable/types'
|
|
4
|
+
import AsyncDataTableRaw from './index.vue'
|
|
5
|
+
|
|
6
|
+
// Cast generic component for Storybook compatibility
|
|
7
|
+
const AsyncDataTable = AsyncDataTableRaw as any
|
|
8
|
+
|
|
9
|
+
interface User {
|
|
10
|
+
id: number
|
|
11
|
+
name: string
|
|
12
|
+
email: string
|
|
13
|
+
role: string
|
|
14
|
+
status: string
|
|
15
|
+
amount: number
|
|
16
|
+
createdAt: string
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Generate 85 mock users for pagination demo
|
|
20
|
+
const allUsers: User[] = Array.from({ length: 85 }, (_, i) => ({
|
|
21
|
+
id: i + 1,
|
|
22
|
+
name: `User ${i + 1}`,
|
|
23
|
+
email: `user${i + 1}@example.com`,
|
|
24
|
+
role: [ 'Admin', 'Editor', 'User' ][i % 3]!,
|
|
25
|
+
status: i % 4 === 0 ? 'inactive' : 'active',
|
|
26
|
+
amount: Math.round(Math.random() * 10000) / 100,
|
|
27
|
+
createdAt: new Date(2024, 0, 1 + i).toISOString(),
|
|
28
|
+
}))
|
|
29
|
+
|
|
30
|
+
const columns: DataTableColumn[] = [
|
|
31
|
+
{ field: 'name', title: 'Name', width: '120px', sortable: true },
|
|
32
|
+
{ field: 'email', title: 'Email', minWidth: '200px' },
|
|
33
|
+
{ field: 'role', title: 'Role', width: '100px', sortable: true },
|
|
34
|
+
{ field: 'status', title: 'Status', width: '100px' },
|
|
35
|
+
{ field: 'amount', title: 'Amount', width: '120px', type: 'currency', sortable: true },
|
|
36
|
+
{ field: 'createdAt', title: 'Created', width: '140px', type: 'date' },
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
/** Simulated async fetch with sorting support */
|
|
40
|
+
function mockFetch (params: AsyncDataTableFetchParams): Promise<AsyncDataTableFetchResult<User>> {
|
|
41
|
+
return new Promise(resolve => {
|
|
42
|
+
setTimeout(() => {
|
|
43
|
+
const data = [ ...allUsers ]
|
|
44
|
+
|
|
45
|
+
if (params.sortBy) {
|
|
46
|
+
const order = params.sortOrder ?? 1
|
|
47
|
+
data.sort((a, b) => {
|
|
48
|
+
const av = a[params.sortBy as keyof User]
|
|
49
|
+
const bv = b[params.sortBy as keyof User]
|
|
50
|
+
if (av! < bv!) return -1 * order
|
|
51
|
+
if (av! > bv!) return 1 * order
|
|
52
|
+
return 0
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const items = data.slice(params.offset, params.offset + params.limit)
|
|
57
|
+
resolve({ items, total: data.length })
|
|
58
|
+
}, 500)
|
|
59
|
+
})
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const meta = {
|
|
63
|
+
title: 'UI/AsyncDataTable',
|
|
64
|
+
component: AsyncDataTable,
|
|
65
|
+
} satisfies Meta
|
|
66
|
+
|
|
67
|
+
export default meta
|
|
68
|
+
type Story = StoryObj<typeof meta>
|
|
69
|
+
|
|
70
|
+
/** Async fetch with pagination, sorting, page size selector */
|
|
71
|
+
export const Default: Story = {
|
|
72
|
+
render: () => ({
|
|
73
|
+
components: { AsyncDataTable },
|
|
74
|
+
setup: () => ({ columns, mockFetch }),
|
|
75
|
+
template: `
|
|
76
|
+
<AsyncDataTable
|
|
77
|
+
:columns="columns"
|
|
78
|
+
:fetchMethod="mockFetch"
|
|
79
|
+
:pageSizeOptions="[10, 20, 50]"
|
|
80
|
+
/>
|
|
81
|
+
`,
|
|
82
|
+
}),
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** Batch actions with row selection and dual toolbars */
|
|
86
|
+
export const BatchActions: Story = {
|
|
87
|
+
render: () => ({
|
|
88
|
+
components: { AsyncDataTable },
|
|
89
|
+
setup () {
|
|
90
|
+
const selection = ref<User[]>([])
|
|
91
|
+
|
|
92
|
+
const batchActions: AsyncDataTableBatchAction<User>[] = [
|
|
93
|
+
{
|
|
94
|
+
label: 'Delete',
|
|
95
|
+
icon: 'trash-2',
|
|
96
|
+
action: items => console.debug(`Delete ${items.length} items`),
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
label: 'Export',
|
|
100
|
+
icon: 'download',
|
|
101
|
+
action: items => console.debug(`Export ${items.length} items`),
|
|
102
|
+
},
|
|
103
|
+
]
|
|
104
|
+
|
|
105
|
+
return { columns, mockFetch, selection, batchActions }
|
|
106
|
+
},
|
|
107
|
+
template: `
|
|
108
|
+
<AsyncDataTable
|
|
109
|
+
:columns="columns"
|
|
110
|
+
:fetchMethod="mockFetch"
|
|
111
|
+
:batchActions="batchActions"
|
|
112
|
+
v-model:selection="selection"
|
|
113
|
+
showTopToolbar
|
|
114
|
+
/>
|
|
115
|
+
<div class="mt-2 text-sm text-muted-foreground">
|
|
116
|
+
Selected: {{ selection.length > 0 ? selection.map(r => r.name).join(', ') : 'none' }}
|
|
117
|
+
</div>
|
|
118
|
+
`,
|
|
119
|
+
}),
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** Custom toolbar slot with action button */
|
|
123
|
+
export const CustomToolbar: Story = {
|
|
124
|
+
render: () => ({
|
|
125
|
+
components: { AsyncDataTable },
|
|
126
|
+
setup: () => ({ columns, mockFetch }),
|
|
127
|
+
template: `
|
|
128
|
+
<AsyncDataTable
|
|
129
|
+
:columns="columns"
|
|
130
|
+
:fetchMethod="mockFetch"
|
|
131
|
+
showTopToolbar
|
|
132
|
+
>
|
|
133
|
+
<template #toolbar>
|
|
134
|
+
<button class="rounded-md bg-primary px-3 py-1.5 text-sm text-primary-foreground">
|
|
135
|
+
+ Add User
|
|
136
|
+
</button>
|
|
137
|
+
</template>
|
|
138
|
+
</AsyncDataTable>
|
|
139
|
+
`,
|
|
140
|
+
}),
|
|
141
|
+
}
|