@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,135 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { PageCardProps } from './types'
|
|
3
|
+
|
|
4
|
+
const props = withDefaults(defineProps<PageCardProps>(), {
|
|
5
|
+
title: undefined,
|
|
6
|
+
subtitle: undefined,
|
|
7
|
+
back: undefined,
|
|
8
|
+
ready: true,
|
|
9
|
+
variant: 'paper',
|
|
10
|
+
class: undefined,
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
const route = useRoute()
|
|
14
|
+
const router = useRouter()
|
|
15
|
+
const { isMobile } = useDevice()
|
|
16
|
+
|
|
17
|
+
const hasBack = computed(() => {
|
|
18
|
+
if (!isMobile.value && route.query.back !== undefined) {
|
|
19
|
+
return route.query.back !== 'false'
|
|
20
|
+
}
|
|
21
|
+
if (!props.back) return false
|
|
22
|
+
if (isMobile.value && !(typeof props.back === 'object' && props.back.action)) return false
|
|
23
|
+
return true
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
function handleBack () {
|
|
27
|
+
if (typeof props.back === 'object' && props.back.action) {
|
|
28
|
+
props.back.action()
|
|
29
|
+
} else {
|
|
30
|
+
router.back()
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const hasTitle = computed(() => !!props.title)
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<template>
|
|
38
|
+
<Card
|
|
39
|
+
:class="cn('min-h-full', variant === 'paper' && `rounded-none border-none`, props.class)"
|
|
40
|
+
>
|
|
41
|
+
<template
|
|
42
|
+
v-if="!ready || hasTitle || !!$slots.title || !!$slots.subtitle || !!subtitle || hasBack || !!$slots.actions"
|
|
43
|
+
#header
|
|
44
|
+
>
|
|
45
|
+
<!-- Skeleton title -->
|
|
46
|
+
<Skeleton
|
|
47
|
+
v-if="!ready"
|
|
48
|
+
height="1.5rem"
|
|
49
|
+
width="40%"
|
|
50
|
+
/>
|
|
51
|
+
<!-- Real title -->
|
|
52
|
+
<div
|
|
53
|
+
v-else
|
|
54
|
+
class="
|
|
55
|
+
flex items-center gap-2
|
|
56
|
+
sm:gap-3
|
|
57
|
+
"
|
|
58
|
+
>
|
|
59
|
+
<Button
|
|
60
|
+
v-if="hasBack"
|
|
61
|
+
variant="ghost"
|
|
62
|
+
size="icon"
|
|
63
|
+
icon="arrow-left"
|
|
64
|
+
@click="handleBack"
|
|
65
|
+
/>
|
|
66
|
+
<div class="flex-1">
|
|
67
|
+
<h3
|
|
68
|
+
v-if="!!$slots.title || !!title"
|
|
69
|
+
class="text-lg leading-none font-semibold tracking-tight"
|
|
70
|
+
>
|
|
71
|
+
<slot name="title">
|
|
72
|
+
{{ title }}
|
|
73
|
+
</slot>
|
|
74
|
+
</h3>
|
|
75
|
+
<div
|
|
76
|
+
v-if="!!$slots.subtitle || !!subtitle"
|
|
77
|
+
class="mt-1 text-base text-muted-foreground"
|
|
78
|
+
>
|
|
79
|
+
<slot name="subtitle">
|
|
80
|
+
{{ subtitle }}
|
|
81
|
+
</slot>
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
<div
|
|
85
|
+
v-if="!!$slots.actions"
|
|
86
|
+
class="
|
|
87
|
+
flex items-center gap-2
|
|
88
|
+
sm:gap-3
|
|
89
|
+
"
|
|
90
|
+
>
|
|
91
|
+
<slot name="actions" />
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
94
|
+
</template>
|
|
95
|
+
|
|
96
|
+
<!-- Skeleton content -->
|
|
97
|
+
<div
|
|
98
|
+
v-if="!ready"
|
|
99
|
+
class="flex flex-col gap-2"
|
|
100
|
+
>
|
|
101
|
+
<Skeleton height="1rem" />
|
|
102
|
+
<Skeleton
|
|
103
|
+
height="1rem"
|
|
104
|
+
width="85%"
|
|
105
|
+
/>
|
|
106
|
+
<Skeleton
|
|
107
|
+
height="1rem"
|
|
108
|
+
width="60%"
|
|
109
|
+
/>
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
<!-- Real content with loading overlay -->
|
|
113
|
+
<div
|
|
114
|
+
v-else
|
|
115
|
+
class="relative"
|
|
116
|
+
>
|
|
117
|
+
<div
|
|
118
|
+
v-if="loading"
|
|
119
|
+
class="absolute inset-0 z-50 flex items-center justify-center"
|
|
120
|
+
>
|
|
121
|
+
<Loading class="size-8" />
|
|
122
|
+
</div>
|
|
123
|
+
<div :class="disabled || loading ? 'pointer-events-none opacity-50' : undefined">
|
|
124
|
+
<slot />
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
|
|
128
|
+
<template
|
|
129
|
+
v-if="ready && !!$slots.footer"
|
|
130
|
+
#footer
|
|
131
|
+
>
|
|
132
|
+
<slot name="footer" />
|
|
133
|
+
</template>
|
|
134
|
+
</Card>
|
|
135
|
+
</template>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface PageCardBackConfig {
|
|
2
|
+
action: () => void
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export type PageCardVariant = 'paper' | 'card'
|
|
6
|
+
|
|
7
|
+
export interface PageCardProps {
|
|
8
|
+
title?: string
|
|
9
|
+
subtitle?: string
|
|
10
|
+
back?: boolean | PageCardBackConfig
|
|
11
|
+
ready?: boolean
|
|
12
|
+
loading?: boolean
|
|
13
|
+
disabled?: boolean
|
|
14
|
+
variant?: PageCardVariant
|
|
15
|
+
class?: ClassValue
|
|
16
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
+
import Pagination from './index.vue'
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'UI/Pagination',
|
|
6
|
+
component: Pagination,
|
|
7
|
+
argTypes: {
|
|
8
|
+
simple: { control: 'boolean' },
|
|
9
|
+
size: { control: 'select', options: [ 'default', 'sm' ]},
|
|
10
|
+
siblingCount: { control: { type: 'number', min: 0 }},
|
|
11
|
+
},
|
|
12
|
+
args: {
|
|
13
|
+
simple: false,
|
|
14
|
+
size: 'default',
|
|
15
|
+
siblingCount: 1,
|
|
16
|
+
},
|
|
17
|
+
} satisfies Meta<typeof Pagination>
|
|
18
|
+
|
|
19
|
+
export default meta
|
|
20
|
+
type Story = StoryObj<typeof meta>
|
|
21
|
+
|
|
22
|
+
export const Default: Story = {
|
|
23
|
+
render: args => ({
|
|
24
|
+
components: { Pagination },
|
|
25
|
+
setup () {
|
|
26
|
+
const page = ref(1)
|
|
27
|
+
const pageSize = ref(10)
|
|
28
|
+
|
|
29
|
+
return { args, page, pageSize }
|
|
30
|
+
},
|
|
31
|
+
template: `
|
|
32
|
+
<div class="space-y-10">
|
|
33
|
+
<!-- Controlled -->
|
|
34
|
+
<section>
|
|
35
|
+
<h3 class="mb-4 text-lg font-medium">Controlled</h3>
|
|
36
|
+
<Pagination
|
|
37
|
+
v-bind="args"
|
|
38
|
+
:page="page"
|
|
39
|
+
:total="85"
|
|
40
|
+
:pageSize="pageSize"
|
|
41
|
+
:pageSizeOptions="[10, 20, 50]"
|
|
42
|
+
@update:page="page = $event"
|
|
43
|
+
@update:pageSize="v => { pageSize = v; page = 1 }"
|
|
44
|
+
/>
|
|
45
|
+
<div class="mt-2 text-sm text-muted-foreground">
|
|
46
|
+
Page: {{ page }}, Size: {{ pageSize }}
|
|
47
|
+
</div>
|
|
48
|
+
</section>
|
|
49
|
+
|
|
50
|
+
<!-- Size comparison -->
|
|
51
|
+
<section>
|
|
52
|
+
<h3 class="mb-4 text-lg font-medium">Size</h3>
|
|
53
|
+
<div class="space-y-4">
|
|
54
|
+
<div>
|
|
55
|
+
<span class="mb-2 block text-sm font-medium">default</span>
|
|
56
|
+
<Pagination :page="3" :total="85" :pageSize="10" />
|
|
57
|
+
</div>
|
|
58
|
+
<div>
|
|
59
|
+
<span class="mb-2 block text-sm font-medium">sm</span>
|
|
60
|
+
<Pagination :page="3" :total="85" :pageSize="10" size="sm" />
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
</section>
|
|
64
|
+
|
|
65
|
+
<!-- Simple mode -->
|
|
66
|
+
<section>
|
|
67
|
+
<h3 class="mb-4 text-lg font-medium">Simple Mode</h3>
|
|
68
|
+
<div class="space-y-4">
|
|
69
|
+
<div>
|
|
70
|
+
<span class="mb-2 block text-sm font-medium">default</span>
|
|
71
|
+
<Pagination :page="3" :total="85" :pageSize="10" simple />
|
|
72
|
+
</div>
|
|
73
|
+
<div>
|
|
74
|
+
<span class="mb-2 block text-sm font-medium">sm</span>
|
|
75
|
+
<Pagination :page="3" :total="85" :pageSize="10" simple size="sm" />
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
</section>
|
|
79
|
+
</div>
|
|
80
|
+
`,
|
|
81
|
+
}),
|
|
82
|
+
}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { DropdownItem } from '@polymarbot/nuxt-layer-shadcn-ui/app/components/ui/Dropdown/types'
|
|
3
|
+
import { buttonVariants } from '@polymarbot/nuxt-layer-shadcn-ui/app/components/shadcn/button'
|
|
4
|
+
import {
|
|
5
|
+
Pagination as ShadcnPagination,
|
|
6
|
+
PaginationContent,
|
|
7
|
+
PaginationEllipsis,
|
|
8
|
+
PaginationFirst,
|
|
9
|
+
PaginationItem,
|
|
10
|
+
PaginationLast,
|
|
11
|
+
PaginationNext,
|
|
12
|
+
PaginationPrevious,
|
|
13
|
+
} from '@polymarbot/nuxt-layer-shadcn-ui/app/components/shadcn/pagination'
|
|
14
|
+
import type { PaginationProps } from './types'
|
|
15
|
+
|
|
16
|
+
const props = withDefaults(defineProps<PaginationProps>(), {
|
|
17
|
+
page: 1,
|
|
18
|
+
total: 0,
|
|
19
|
+
pageSize: 10,
|
|
20
|
+
pageSizeOptions: () => [],
|
|
21
|
+
simple: false,
|
|
22
|
+
siblingCount: 1,
|
|
23
|
+
size: 'default',
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
const emit = defineEmits<{
|
|
27
|
+
'update:page': [value: number]
|
|
28
|
+
'update:pageSize': [value: number]
|
|
29
|
+
}>()
|
|
30
|
+
|
|
31
|
+
const T = useTranslations('components.ui.Pagination')
|
|
32
|
+
|
|
33
|
+
const totalPages = computed(() => Math.ceil(props.total / props.pageSize) || 0)
|
|
34
|
+
const hasData = computed(() => props.total > 0)
|
|
35
|
+
|
|
36
|
+
const iconButtonSize = computed(() => props.size === 'sm' ? 'icon-sm' as const : 'icon' as const)
|
|
37
|
+
const buttonSize = computed(() => props.size === 'sm' ? 'sm' as const : 'default' as const)
|
|
38
|
+
|
|
39
|
+
const pageReport = computed(() => {
|
|
40
|
+
if (!hasData.value) return ''
|
|
41
|
+
const first = (props.page - 1) * props.pageSize + 1
|
|
42
|
+
const last = Math.min(props.page * props.pageSize, props.total)
|
|
43
|
+
return T('pageReport', { first, last, total: props.total })
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
const activePageClass = computed(() => cn(
|
|
47
|
+
buttonVariants({ variant: 'default', size: iconButtonSize.value }),
|
|
48
|
+
`
|
|
49
|
+
hover:text-primary-foreground
|
|
50
|
+
dark:hover:bg-primary/90
|
|
51
|
+
`,
|
|
52
|
+
))
|
|
53
|
+
|
|
54
|
+
const showPageSizeDropdown = computed(() => props.pageSizeOptions.length > 1)
|
|
55
|
+
|
|
56
|
+
const pageSizeMenuItems = computed<DropdownItem[]>(() =>
|
|
57
|
+
props.pageSizeOptions.map(size => ({
|
|
58
|
+
label: String(size),
|
|
59
|
+
active: size === props.pageSize,
|
|
60
|
+
command: () => emit('update:pageSize', size),
|
|
61
|
+
})),
|
|
62
|
+
)
|
|
63
|
+
</script>
|
|
64
|
+
|
|
65
|
+
<template>
|
|
66
|
+
<div
|
|
67
|
+
v-if="hasData"
|
|
68
|
+
class="flex items-center gap-2"
|
|
69
|
+
>
|
|
70
|
+
<!-- Simple mode: ‹ 1/9 › -->
|
|
71
|
+
<template v-if="simple">
|
|
72
|
+
<Button
|
|
73
|
+
variant="ghost"
|
|
74
|
+
:size="iconButtonSize"
|
|
75
|
+
:disabled="page <= 1"
|
|
76
|
+
@click="emit('update:page', 1)"
|
|
77
|
+
>
|
|
78
|
+
<Icon name="chevrons-left" />
|
|
79
|
+
</Button>
|
|
80
|
+
<Button
|
|
81
|
+
variant="ghost"
|
|
82
|
+
:size="iconButtonSize"
|
|
83
|
+
:disabled="page <= 1"
|
|
84
|
+
@click="emit('update:page', page - 1)"
|
|
85
|
+
>
|
|
86
|
+
<Icon name="chevron-left" />
|
|
87
|
+
</Button>
|
|
88
|
+
<span
|
|
89
|
+
class="min-w-12 text-center text-sm text-muted-foreground tabular-nums"
|
|
90
|
+
>
|
|
91
|
+
{{ page }} / {{ totalPages }}
|
|
92
|
+
</span>
|
|
93
|
+
<Button
|
|
94
|
+
variant="ghost"
|
|
95
|
+
:size="iconButtonSize"
|
|
96
|
+
:disabled="page >= totalPages"
|
|
97
|
+
@click="emit('update:page', page + 1)"
|
|
98
|
+
>
|
|
99
|
+
<Icon name="chevron-right" />
|
|
100
|
+
</Button>
|
|
101
|
+
<Button
|
|
102
|
+
variant="ghost"
|
|
103
|
+
:size="iconButtonSize"
|
|
104
|
+
:disabled="page >= totalPages"
|
|
105
|
+
@click="emit('update:page', totalPages)"
|
|
106
|
+
>
|
|
107
|
+
<Icon name="chevrons-right" />
|
|
108
|
+
</Button>
|
|
109
|
+
</template>
|
|
110
|
+
|
|
111
|
+
<!-- Full mode -->
|
|
112
|
+
<template v-else>
|
|
113
|
+
<span class="text-sm whitespace-nowrap text-muted-foreground">
|
|
114
|
+
{{ pageReport }}
|
|
115
|
+
</span>
|
|
116
|
+
<ShadcnPagination
|
|
117
|
+
:total="total"
|
|
118
|
+
:itemsPerPage="pageSize"
|
|
119
|
+
:page="page"
|
|
120
|
+
:siblingCount="siblingCount"
|
|
121
|
+
showEdges
|
|
122
|
+
class="mx-0 w-auto"
|
|
123
|
+
@update:page="emit('update:page', $event)"
|
|
124
|
+
>
|
|
125
|
+
<PaginationContent v-slot="{ items }">
|
|
126
|
+
<PaginationFirst :size="iconButtonSize">
|
|
127
|
+
<Icon name="chevrons-left" />
|
|
128
|
+
</PaginationFirst>
|
|
129
|
+
<PaginationPrevious :size="iconButtonSize">
|
|
130
|
+
<Icon name="chevron-left" />
|
|
131
|
+
</PaginationPrevious>
|
|
132
|
+
<template v-for="(item, index) in items">
|
|
133
|
+
<PaginationItem
|
|
134
|
+
v-if="item.type === 'page'"
|
|
135
|
+
:key="index"
|
|
136
|
+
:value="item.value"
|
|
137
|
+
:size="iconButtonSize"
|
|
138
|
+
:class="item.value === page ? activePageClass : ''"
|
|
139
|
+
>
|
|
140
|
+
{{ item.value }}
|
|
141
|
+
</PaginationItem>
|
|
142
|
+
<PaginationEllipsis
|
|
143
|
+
v-else
|
|
144
|
+
:key="`e${index}`"
|
|
145
|
+
/>
|
|
146
|
+
</template>
|
|
147
|
+
<PaginationNext :size="iconButtonSize">
|
|
148
|
+
<Icon name="chevron-right" />
|
|
149
|
+
</PaginationNext>
|
|
150
|
+
<PaginationLast :size="iconButtonSize">
|
|
151
|
+
<Icon name="chevrons-right" />
|
|
152
|
+
</PaginationLast>
|
|
153
|
+
</PaginationContent>
|
|
154
|
+
</ShadcnPagination>
|
|
155
|
+
<Dropdown
|
|
156
|
+
v-if="showPageSizeDropdown"
|
|
157
|
+
:menus="pageSizeMenuItems"
|
|
158
|
+
trigger="click"
|
|
159
|
+
>
|
|
160
|
+
<Button
|
|
161
|
+
variant="outline"
|
|
162
|
+
:size="buttonSize"
|
|
163
|
+
>
|
|
164
|
+
{{ pageSize }}
|
|
165
|
+
<Icon
|
|
166
|
+
name="chevron-down"
|
|
167
|
+
class="size-3"
|
|
168
|
+
/>
|
|
169
|
+
</Button>
|
|
170
|
+
</Dropdown>
|
|
171
|
+
</template>
|
|
172
|
+
</div>
|
|
173
|
+
</template>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type PaginationSize = 'default' | 'sm'
|
|
2
|
+
|
|
3
|
+
export interface PaginationProps {
|
|
4
|
+
/** Current page number (1-based) */
|
|
5
|
+
page?: number
|
|
6
|
+
/** Total number of items */
|
|
7
|
+
total?: number
|
|
8
|
+
/** Items per page */
|
|
9
|
+
pageSize?: number
|
|
10
|
+
/** Available page size options (shows dropdown when length > 1) */
|
|
11
|
+
pageSizeOptions?: number[]
|
|
12
|
+
/** Compact mode: only prev/next + page indicator */
|
|
13
|
+
simple?: boolean
|
|
14
|
+
/** Number of sibling pages to show in full mode */
|
|
15
|
+
siblingCount?: number
|
|
16
|
+
/** Button size */
|
|
17
|
+
size?: PaginationSize
|
|
18
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
+
import Button from '../Button/index.vue'
|
|
3
|
+
import Input from '../Input/index.vue'
|
|
4
|
+
import Popover from './index.vue'
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'UI/Popover',
|
|
8
|
+
component: Popover,
|
|
9
|
+
} satisfies Meta<typeof Popover>
|
|
10
|
+
|
|
11
|
+
export default meta
|
|
12
|
+
type Story = StoryObj<typeof meta>
|
|
13
|
+
|
|
14
|
+
export const Default: Story = {
|
|
15
|
+
render: () => ({
|
|
16
|
+
components: { Popover, Button, Input },
|
|
17
|
+
setup () {
|
|
18
|
+
const controlled = ref(false)
|
|
19
|
+
return { controlled }
|
|
20
|
+
},
|
|
21
|
+
template: `
|
|
22
|
+
<div class="space-y-10">
|
|
23
|
+
<section>
|
|
24
|
+
<h3 class="mb-4 text-lg font-medium">Basic</h3>
|
|
25
|
+
<Popover>
|
|
26
|
+
<template #trigger>
|
|
27
|
+
<Button variant="outline">Open Popover</Button>
|
|
28
|
+
</template>
|
|
29
|
+
<div class="space-y-2">
|
|
30
|
+
<h4 class="font-medium">Popover Content</h4>
|
|
31
|
+
<p class="text-sm text-muted-foreground">This is the popover body with some informational content.</p>
|
|
32
|
+
</div>
|
|
33
|
+
</Popover>
|
|
34
|
+
</section>
|
|
35
|
+
|
|
36
|
+
<section>
|
|
37
|
+
<h3 class="mb-4 text-lg font-medium">With Form</h3>
|
|
38
|
+
<Popover>
|
|
39
|
+
<template #trigger>
|
|
40
|
+
<Button variant="outline">Edit Name</Button>
|
|
41
|
+
</template>
|
|
42
|
+
<div class="space-y-3">
|
|
43
|
+
<h4 class="font-medium">Update Name</h4>
|
|
44
|
+
<Input placeholder="Enter new name" />
|
|
45
|
+
<Button size="sm" class="w-full">Save</Button>
|
|
46
|
+
</div>
|
|
47
|
+
</Popover>
|
|
48
|
+
</section>
|
|
49
|
+
|
|
50
|
+
<section>
|
|
51
|
+
<h3 class="mb-4 text-lg font-medium">Controlled</h3>
|
|
52
|
+
<div class="flex items-center gap-2">
|
|
53
|
+
<Popover v-model:open="controlled">
|
|
54
|
+
<template #trigger>
|
|
55
|
+
<Button variant="outline">Controlled Popover</Button>
|
|
56
|
+
</template>
|
|
57
|
+
<p class="text-sm">This popover is controlled externally.</p>
|
|
58
|
+
</Popover>
|
|
59
|
+
<Button variant="ghost" size="sm" @click="controlled = !controlled">
|
|
60
|
+
Toggle ({{ controlled ? 'Open' : 'Closed' }})
|
|
61
|
+
</Button>
|
|
62
|
+
</div>
|
|
63
|
+
</section>
|
|
64
|
+
</div>
|
|
65
|
+
`,
|
|
66
|
+
}),
|
|
67
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
Popover as ShadcnPopover,
|
|
4
|
+
PopoverContent,
|
|
5
|
+
PopoverTrigger,
|
|
6
|
+
} from '@polymarbot/nuxt-layer-shadcn-ui/app/components/shadcn/popover'
|
|
7
|
+
import type { PopoverProps } from './types'
|
|
8
|
+
|
|
9
|
+
const props = defineProps<PopoverProps>()
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<ShadcnPopover>
|
|
14
|
+
<PopoverTrigger asChild>
|
|
15
|
+
<slot name="trigger" />
|
|
16
|
+
</PopoverTrigger>
|
|
17
|
+
<PopoverContent :class="props.class">
|
|
18
|
+
<slot />
|
|
19
|
+
</PopoverContent>
|
|
20
|
+
</ShadcnPopover>
|
|
21
|
+
</template>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
+
import Qrcode from './index.vue'
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'UI/Qrcode',
|
|
6
|
+
component: Qrcode,
|
|
7
|
+
} satisfies Meta<typeof Qrcode>
|
|
8
|
+
|
|
9
|
+
export default meta
|
|
10
|
+
type Story = StoryObj<typeof meta>
|
|
11
|
+
|
|
12
|
+
export const Default: Story = {
|
|
13
|
+
args: { content: 'https://example.com' },
|
|
14
|
+
render: () => ({
|
|
15
|
+
components: { Qrcode },
|
|
16
|
+
setup () {
|
|
17
|
+
const url = ref('https://example.com')
|
|
18
|
+
return { url }
|
|
19
|
+
},
|
|
20
|
+
template: `
|
|
21
|
+
<div class="space-y-10">
|
|
22
|
+
<section>
|
|
23
|
+
<h3 class="mb-4 text-lg font-medium">Basic QR Code</h3>
|
|
24
|
+
<div class="size-48">
|
|
25
|
+
<Qrcode content="https://example.com" />
|
|
26
|
+
</div>
|
|
27
|
+
</section>
|
|
28
|
+
|
|
29
|
+
<section>
|
|
30
|
+
<h3 class="mb-4 text-lg font-medium">Dynamic Content</h3>
|
|
31
|
+
<div class="space-y-3 max-w-sm">
|
|
32
|
+
<input
|
|
33
|
+
v-model="url"
|
|
34
|
+
class="w-full rounded border border-input px-3 py-2 text-sm"
|
|
35
|
+
placeholder="Enter URL or text"
|
|
36
|
+
/>
|
|
37
|
+
<div class="size-48">
|
|
38
|
+
<Qrcode :content="url" />
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
</section>
|
|
42
|
+
|
|
43
|
+
<section>
|
|
44
|
+
<h3 class="mb-4 text-lg font-medium">Different Sizes</h3>
|
|
45
|
+
<div class="flex items-end gap-6">
|
|
46
|
+
<div class="size-24">
|
|
47
|
+
<Qrcode content="https://example.com/small" />
|
|
48
|
+
</div>
|
|
49
|
+
<div class="size-48">
|
|
50
|
+
<Qrcode content="https://example.com/medium" />
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</section>
|
|
54
|
+
</div>
|
|
55
|
+
`,
|
|
56
|
+
}),
|
|
57
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import QRCode from 'qrcode'
|
|
3
|
+
import type { QrcodeProps } from './types'
|
|
4
|
+
|
|
5
|
+
const props = defineProps<QrcodeProps>()
|
|
6
|
+
|
|
7
|
+
const qrcode = ref<string | null>(null)
|
|
8
|
+
watch(() => props.content, createQrCode, { immediate: true })
|
|
9
|
+
async function createQrCode (content: string): Promise<string | null> {
|
|
10
|
+
if (!content) {
|
|
11
|
+
qrcode.value = null
|
|
12
|
+
return null
|
|
13
|
+
}
|
|
14
|
+
return new Promise((resolve, reject) => {
|
|
15
|
+
QRCode.toDataURL(content, {
|
|
16
|
+
errorCorrectionLevel: 'Q',
|
|
17
|
+
type: 'image/jpeg',
|
|
18
|
+
margin: 0,
|
|
19
|
+
scale: 8,
|
|
20
|
+
}, (err: Error | null | undefined, url: string) => {
|
|
21
|
+
if (err) return reject(err)
|
|
22
|
+
qrcode.value = url
|
|
23
|
+
resolve(url)
|
|
24
|
+
})
|
|
25
|
+
})
|
|
26
|
+
}
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<template>
|
|
30
|
+
<img
|
|
31
|
+
v-if="qrcode"
|
|
32
|
+
:src="qrcode"
|
|
33
|
+
alt="qrcode"
|
|
34
|
+
class="mx-auto block size-full bg-white object-contain"
|
|
35
|
+
>
|
|
36
|
+
<Skeleton
|
|
37
|
+
v-else
|
|
38
|
+
class="mx-auto block size-full"
|
|
39
|
+
/>
|
|
40
|
+
</template>
|