@open-dy/vibecoding-sdk-taro 0.0.1-beta.5 → 0.0.1-beta.7
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/dist/adapters/interest-card/eslint/eslint-plugin-custom-navigation.mjs +2 -290
- package/dist/adapters/interest-card/eslint/taro.mjs +8 -42
- package/dist/components/miniapp-open-card.d.ts +46 -1
- package/dist/components/miniapp-open-card.js +14 -1
- package/dist/components/miniapp-open-card.js.map +1 -1
- package/dist/eslint/eslint-plugin-custom-navigation.mjs +290 -0
- package/dist/eslint/taro.mjs +35 -1
- package/dist/reference/llms.txt +76 -34
- package/dist/reference/sdk-api/build/taro/BuildContext.md +7 -2
- package/dist/reference/sdk-api/build/taro/CreateMicroappTaroConfigOptions.md +1 -2
- package/dist/reference/sdk-api/build/taro/createMicroappTaroConfig.md +1 -2
- package/dist/reference/sdk-api/components/miniapp-open-card/MiniappOpenCard.md +109 -0
- package/dist/reference/sdk-api/components/miniapp-open-card/MiniappOpenCardEnvVersion.md +38 -0
- package/dist/reference/sdk-api/components/miniapp-open-card/MiniappOpenCardErrorDetail.md +52 -0
- package/dist/reference/sdk-api/components/miniapp-open-card/MiniappOpenCardProps.md +76 -0
- package/dist/reference/sdk-api/components/miniapp-open-card/index.md +12 -0
- package/dist/reference/sdk-api/libraries/lucide-taro.md +151 -0
- package/dist/reference/sdk-api/runtime/CreateMicroappClientOptions.md +7 -2
- package/dist/reference/sdk-api/runtime/createMicroappClient.md +8 -3
- package/dist/reference/sdk-api/ui/accordion/Accordion.md +114 -0
- package/dist/reference/sdk-api/ui/accordion/AccordionContent.md +100 -0
- package/dist/reference/sdk-api/ui/accordion/AccordionItem.md +107 -0
- package/dist/reference/sdk-api/ui/accordion/AccordionTrigger.md +100 -0
- package/dist/reference/sdk-api/ui/accordion/index.md +12 -0
- package/dist/reference/sdk-api/ui/alert/Alert.md +106 -0
- package/dist/reference/sdk-api/ui/alert/AlertAction.md +100 -0
- package/dist/reference/sdk-api/ui/alert/AlertDescription.md +100 -0
- package/dist/reference/sdk-api/ui/alert/AlertTitle.md +100 -0
- package/dist/reference/sdk-api/ui/alert/index.md +12 -0
- package/dist/reference/sdk-api/ui/alert-dialog/AlertDialog.md +58 -0
- package/dist/reference/sdk-api/ui/alert-dialog/AlertDialogAction.md +107 -0
- package/dist/reference/sdk-api/ui/alert-dialog/AlertDialogCancel.md +107 -0
- package/dist/reference/sdk-api/ui/alert-dialog/AlertDialogContent.md +106 -0
- package/dist/reference/sdk-api/ui/alert-dialog/AlertDialogDescription.md +100 -0
- package/dist/reference/sdk-api/ui/alert-dialog/AlertDialogFooter.md +100 -0
- package/dist/reference/sdk-api/ui/alert-dialog/AlertDialogHeader.md +100 -0
- package/dist/reference/sdk-api/ui/alert-dialog/AlertDialogOverlay.md +100 -0
- package/dist/reference/sdk-api/ui/alert-dialog/AlertDialogPortal.md +55 -0
- package/dist/reference/sdk-api/ui/alert-dialog/AlertDialogTitle.md +100 -0
- package/dist/reference/sdk-api/ui/alert-dialog/AlertDialogTrigger.md +118 -0
- package/dist/reference/sdk-api/ui/alert-dialog/index.md +19 -0
- package/dist/reference/sdk-api/ui/aspect-ratio/AspectRatio.md +106 -0
- package/dist/reference/sdk-api/ui/aspect-ratio/index.md +9 -0
- package/dist/reference/sdk-api/ui/avatar/Avatar.md +106 -0
- package/dist/reference/sdk-api/ui/avatar/AvatarBadge.md +100 -0
- package/dist/reference/sdk-api/ui/avatar/AvatarFallback.md +100 -0
- package/dist/reference/sdk-api/ui/avatar/AvatarGroup.md +100 -0
- package/dist/reference/sdk-api/ui/avatar/AvatarGroupCount.md +100 -0
- package/dist/reference/sdk-api/ui/avatar/AvatarImage.md +108 -0
- package/dist/reference/sdk-api/ui/avatar/index.md +14 -0
- package/dist/reference/sdk-api/ui/badge/Badge.md +114 -0
- package/dist/reference/sdk-api/ui/badge/badgeVariants.md +70 -0
- package/dist/reference/sdk-api/ui/badge/index.md +10 -0
- package/dist/reference/sdk-api/ui/button/Button.md +210 -0
- package/dist/reference/sdk-api/ui/button/ButtonProps.md +188 -0
- package/dist/reference/sdk-api/ui/button/buttonVariants.md +84 -0
- package/dist/reference/sdk-api/ui/button/index.md +11 -0
- package/dist/reference/sdk-api/ui/button-group/ButtonGroup.md +106 -0
- package/dist/reference/sdk-api/ui/button-group/ButtonGroupSeparator.md +106 -0
- package/dist/reference/sdk-api/ui/button-group/ButtonGroupText.md +106 -0
- package/dist/reference/sdk-api/ui/button-group/buttonGroupVariants.md +70 -0
- package/dist/reference/sdk-api/ui/button-group/index.md +12 -0
- package/dist/reference/sdk-api/ui/calendar/Calendar.md +144 -0
- package/dist/reference/sdk-api/ui/calendar/CalendarProps.md +118 -0
- package/dist/reference/sdk-api/ui/calendar/index.md +10 -0
- package/dist/reference/sdk-api/ui/card/Card.md +106 -0
- package/dist/reference/sdk-api/ui/card/CardAction.md +100 -0
- package/dist/reference/sdk-api/ui/card/CardContent.md +100 -0
- package/dist/reference/sdk-api/ui/card/CardDescription.md +100 -0
- package/dist/reference/sdk-api/ui/card/CardFooter.md +100 -0
- package/dist/reference/sdk-api/ui/card/CardHeader.md +100 -0
- package/dist/reference/sdk-api/ui/card/CardTitle.md +100 -0
- package/dist/reference/sdk-api/ui/card/index.md +15 -0
- package/dist/reference/sdk-api/ui/carousel/Carousel.md +108 -0
- package/dist/reference/sdk-api/ui/carousel/CarouselContent.md +100 -0
- package/dist/reference/sdk-api/ui/carousel/CarouselItem.md +100 -0
- package/dist/reference/sdk-api/ui/carousel/CarouselNext.md +219 -0
- package/dist/reference/sdk-api/ui/carousel/CarouselPrevious.md +219 -0
- package/dist/reference/sdk-api/ui/carousel/index.md +14 -0
- package/dist/reference/sdk-api/ui/carousel/useCarousel.md +46 -0
- package/dist/reference/sdk-api/ui/checkbox/Checkbox.md +109 -0
- package/dist/reference/sdk-api/ui/checkbox/index.md +9 -0
- package/dist/reference/sdk-api/ui/collapsible/Collapsible.md +108 -0
- package/dist/reference/sdk-api/ui/collapsible/CollapsibleContent.md +100 -0
- package/dist/reference/sdk-api/ui/collapsible/CollapsibleTrigger.md +119 -0
- package/dist/reference/sdk-api/ui/collapsible/index.md +11 -0
- package/dist/reference/sdk-api/ui/combobox/Combobox.md +124 -0
- package/dist/reference/sdk-api/ui/combobox/ComboboxChip.md +107 -0
- package/dist/reference/sdk-api/ui/combobox/ComboboxChips.md +100 -0
- package/dist/reference/sdk-api/ui/combobox/ComboboxChipsInput.md +107 -0
- package/dist/reference/sdk-api/ui/combobox/ComboboxCollection.md +100 -0
- package/dist/reference/sdk-api/ui/combobox/ComboboxContent.md +106 -0
- package/dist/reference/sdk-api/ui/combobox/ComboboxEmpty.md +100 -0
- package/dist/reference/sdk-api/ui/combobox/ComboboxGroup.md +100 -0
- package/dist/reference/sdk-api/ui/combobox/ComboboxInput.md +113 -0
- package/dist/reference/sdk-api/ui/combobox/ComboboxItem.md +106 -0
- package/dist/reference/sdk-api/ui/combobox/ComboboxLabel.md +100 -0
- package/dist/reference/sdk-api/ui/combobox/ComboboxList.md +105 -0
- package/dist/reference/sdk-api/ui/combobox/ComboboxSeparator.md +100 -0
- package/dist/reference/sdk-api/ui/combobox/ComboboxTrigger.md +100 -0
- package/dist/reference/sdk-api/ui/combobox/ComboboxValue.md +105 -0
- package/dist/reference/sdk-api/ui/combobox/index.md +24 -0
- package/dist/reference/sdk-api/ui/combobox/useComboboxAnchor.md +43 -0
- package/dist/reference/sdk-api/ui/dialog/Dialog.md +58 -0
- package/dist/reference/sdk-api/ui/dialog/DialogClose.md +100 -0
- package/dist/reference/sdk-api/ui/dialog/DialogContent.md +107 -0
- package/dist/reference/sdk-api/ui/dialog/DialogDescription.md +100 -0
- package/dist/reference/sdk-api/ui/dialog/DialogFooter.md +100 -0
- package/dist/reference/sdk-api/ui/dialog/DialogHeader.md +100 -0
- package/dist/reference/sdk-api/ui/dialog/DialogOverlay.md +100 -0
- package/dist/reference/sdk-api/ui/dialog/DialogPortal.md +55 -0
- package/dist/reference/sdk-api/ui/dialog/DialogTitle.md +100 -0
- package/dist/reference/sdk-api/ui/dialog/DialogTrigger.md +106 -0
- package/dist/reference/sdk-api/ui/dialog/index.md +18 -0
- package/dist/reference/sdk-api/ui/drawer/Drawer.md +59 -0
- package/dist/reference/sdk-api/ui/drawer/DrawerClose.md +100 -0
- package/dist/reference/sdk-api/ui/drawer/DrawerContent.md +100 -0
- package/dist/reference/sdk-api/ui/drawer/DrawerDescription.md +100 -0
- package/dist/reference/sdk-api/ui/drawer/DrawerFooter.md +100 -0
- package/dist/reference/sdk-api/ui/drawer/DrawerHeader.md +100 -0
- package/dist/reference/sdk-api/ui/drawer/DrawerOverlay.md +100 -0
- package/dist/reference/sdk-api/ui/drawer/DrawerPortal.md +55 -0
- package/dist/reference/sdk-api/ui/drawer/DrawerTitle.md +100 -0
- package/dist/reference/sdk-api/ui/drawer/DrawerTrigger.md +100 -0
- package/dist/reference/sdk-api/ui/drawer/index.md +18 -0
- package/dist/reference/sdk-api/ui/dropdown-menu/DropdownMenu.md +58 -0
- package/dist/reference/sdk-api/ui/dropdown-menu/DropdownMenuCheckboxItem.md +107 -0
- package/dist/reference/sdk-api/ui/dropdown-menu/DropdownMenuContent.md +106 -0
- package/dist/reference/sdk-api/ui/dropdown-menu/DropdownMenuGroup.md +100 -0
- package/dist/reference/sdk-api/ui/dropdown-menu/DropdownMenuItem.md +107 -0
- package/dist/reference/sdk-api/ui/dropdown-menu/DropdownMenuLabel.md +106 -0
- package/dist/reference/sdk-api/ui/dropdown-menu/DropdownMenuPortal.md +55 -0
- package/dist/reference/sdk-api/ui/dropdown-menu/DropdownMenuRadioGroup.md +100 -0
- package/dist/reference/sdk-api/ui/dropdown-menu/DropdownMenuRadioItem.md +106 -0
- package/dist/reference/sdk-api/ui/dropdown-menu/DropdownMenuSeparator.md +100 -0
- package/dist/reference/sdk-api/ui/dropdown-menu/DropdownMenuShortcut.md +100 -0
- package/dist/reference/sdk-api/ui/dropdown-menu/DropdownMenuSub.md +58 -0
- package/dist/reference/sdk-api/ui/dropdown-menu/DropdownMenuSubContent.md +100 -0
- package/dist/reference/sdk-api/ui/dropdown-menu/DropdownMenuSubTrigger.md +106 -0
- package/dist/reference/sdk-api/ui/dropdown-menu/DropdownMenuTrigger.md +119 -0
- package/dist/reference/sdk-api/ui/dropdown-menu/index.md +23 -0
- package/dist/reference/sdk-api/ui/empty/Empty.md +100 -0
- package/dist/reference/sdk-api/ui/empty/EmptyContent.md +100 -0
- package/dist/reference/sdk-api/ui/empty/EmptyDescription.md +100 -0
- package/dist/reference/sdk-api/ui/empty/EmptyHeader.md +100 -0
- package/dist/reference/sdk-api/ui/empty/EmptyMedia.md +106 -0
- package/dist/reference/sdk-api/ui/empty/EmptyTitle.md +100 -0
- package/dist/reference/sdk-api/ui/empty/index.md +14 -0
- package/dist/reference/sdk-api/ui/field/Field.md +106 -0
- package/dist/reference/sdk-api/ui/field/FieldContent.md +100 -0
- package/dist/reference/sdk-api/ui/field/FieldDescription.md +100 -0
- package/dist/reference/sdk-api/ui/field/FieldError.md +112 -0
- package/dist/reference/sdk-api/ui/field/FieldGroup.md +100 -0
- package/dist/reference/sdk-api/ui/field/FieldLabel.md +85 -0
- package/dist/reference/sdk-api/ui/field/FieldLegend.md +106 -0
- package/dist/reference/sdk-api/ui/field/FieldSeparator.md +105 -0
- package/dist/reference/sdk-api/ui/field/FieldSet.md +100 -0
- package/dist/reference/sdk-api/ui/field/FieldTitle.md +100 -0
- package/dist/reference/sdk-api/ui/field/index.md +18 -0
- package/dist/reference/sdk-api/ui/helpers/collectDataIconState.md +66 -0
- package/dist/reference/sdk-api/ui/helpers/index.md +9 -0
- package/dist/reference/sdk-api/ui/index.md +57 -0
- package/dist/reference/sdk-api/ui/input/Input.md +141 -0
- package/dist/reference/sdk-api/ui/input/index.md +9 -0
- package/dist/reference/sdk-api/ui/input-group/InputGroup.md +100 -0
- package/dist/reference/sdk-api/ui/input-group/InputGroupAddon.md +109 -0
- package/dist/reference/sdk-api/ui/input-group/InputGroupButton.md +220 -0
- package/dist/reference/sdk-api/ui/input-group/InputGroupInput.md +135 -0
- package/dist/reference/sdk-api/ui/input-group/InputGroupText.md +100 -0
- package/dist/reference/sdk-api/ui/input-group/InputGroupTextarea.md +126 -0
- package/dist/reference/sdk-api/ui/input-group/index.md +14 -0
- package/dist/reference/sdk-api/ui/input-otp/InputOTP.md +111 -0
- package/dist/reference/sdk-api/ui/input-otp/InputOTPGroup.md +100 -0
- package/dist/reference/sdk-api/ui/input-otp/InputOTPSeparator.md +100 -0
- package/dist/reference/sdk-api/ui/input-otp/InputOTPSlot.md +107 -0
- package/dist/reference/sdk-api/ui/input-otp/index.md +12 -0
- package/dist/reference/sdk-api/ui/item/Item.md +115 -0
- package/dist/reference/sdk-api/ui/item/ItemActions.md +100 -0
- package/dist/reference/sdk-api/ui/item/ItemContent.md +100 -0
- package/dist/reference/sdk-api/ui/item/ItemDescription.md +100 -0
- package/dist/reference/sdk-api/ui/item/ItemFooter.md +100 -0
- package/dist/reference/sdk-api/ui/item/ItemGroup.md +100 -0
- package/dist/reference/sdk-api/ui/item/ItemHeader.md +100 -0
- package/dist/reference/sdk-api/ui/item/ItemMedia.md +106 -0
- package/dist/reference/sdk-api/ui/item/ItemSeparator.md +106 -0
- package/dist/reference/sdk-api/ui/item/ItemTitle.md +100 -0
- package/dist/reference/sdk-api/ui/item/index.md +18 -0
- package/dist/reference/sdk-api/ui/label/Label.md +85 -0
- package/dist/reference/sdk-api/ui/label/index.md +9 -0
- package/dist/reference/sdk-api/ui/menubar/Menubar.md +100 -0
- package/dist/reference/sdk-api/ui/menubar/MenubarCheckboxItem.md +111 -0
- package/dist/reference/sdk-api/ui/menubar/MenubarContent.md +108 -0
- package/dist/reference/sdk-api/ui/menubar/MenubarGroup.md +100 -0
- package/dist/reference/sdk-api/ui/menubar/MenubarItem.md +109 -0
- package/dist/reference/sdk-api/ui/menubar/MenubarLabel.md +106 -0
- package/dist/reference/sdk-api/ui/menubar/MenubarMenu.md +55 -0
- package/dist/reference/sdk-api/ui/menubar/MenubarPortal.md +55 -0
- package/dist/reference/sdk-api/ui/menubar/MenubarRadioGroup.md +108 -0
- package/dist/reference/sdk-api/ui/menubar/MenubarRadioItem.md +110 -0
- package/dist/reference/sdk-api/ui/menubar/MenubarSeparator.md +100 -0
- package/dist/reference/sdk-api/ui/menubar/MenubarShortcut.md +100 -0
- package/dist/reference/sdk-api/ui/menubar/MenubarSub.md +58 -0
- package/dist/reference/sdk-api/ui/menubar/MenubarSubContent.md +108 -0
- package/dist/reference/sdk-api/ui/menubar/MenubarSubTrigger.md +107 -0
- package/dist/reference/sdk-api/ui/menubar/MenubarTrigger.md +100 -0
- package/dist/reference/sdk-api/ui/menubar/index.md +24 -0
- package/dist/reference/sdk-api/ui/navigation-menu/NavigationMenu.md +100 -0
- package/dist/reference/sdk-api/ui/navigation-menu/NavigationMenuContent.md +106 -0
- package/dist/reference/sdk-api/ui/navigation-menu/NavigationMenuIndicator.md +100 -0
- package/dist/reference/sdk-api/ui/navigation-menu/NavigationMenuItem.md +106 -0
- package/dist/reference/sdk-api/ui/navigation-menu/NavigationMenuLink.md +106 -0
- package/dist/reference/sdk-api/ui/navigation-menu/NavigationMenuList.md +100 -0
- package/dist/reference/sdk-api/ui/navigation-menu/NavigationMenuPositioner.md +100 -0
- package/dist/reference/sdk-api/ui/navigation-menu/NavigationMenuTrigger.md +120 -0
- package/dist/reference/sdk-api/ui/navigation-menu/index.md +17 -0
- package/dist/reference/sdk-api/ui/navigation-menu/navigationMenuTriggerStyle.md +64 -0
- package/dist/reference/sdk-api/ui/pagination/Pagination.md +100 -0
- package/dist/reference/sdk-api/ui/pagination/PaginationContent.md +100 -0
- package/dist/reference/sdk-api/ui/pagination/PaginationEllipsis.md +100 -0
- package/dist/reference/sdk-api/ui/pagination/PaginationItem.md +100 -0
- package/dist/reference/sdk-api/ui/pagination/PaginationLink.md +107 -0
- package/dist/reference/sdk-api/ui/pagination/PaginationNext.md +121 -0
- package/dist/reference/sdk-api/ui/pagination/PaginationPrevious.md +121 -0
- package/dist/reference/sdk-api/ui/pagination/index.md +15 -0
- package/dist/reference/sdk-api/ui/popover/Popover.md +58 -0
- package/dist/reference/sdk-api/ui/popover/PopoverAnchor.md +100 -0
- package/dist/reference/sdk-api/ui/popover/PopoverContent.md +108 -0
- package/dist/reference/sdk-api/ui/popover/PopoverDescription.md +100 -0
- package/dist/reference/sdk-api/ui/popover/PopoverHeader.md +100 -0
- package/dist/reference/sdk-api/ui/popover/PopoverTitle.md +100 -0
- package/dist/reference/sdk-api/ui/popover/PopoverTrigger.md +119 -0
- package/dist/reference/sdk-api/ui/popover/index.md +15 -0
- package/dist/reference/sdk-api/ui/portal/Portal.md +55 -0
- package/dist/reference/sdk-api/ui/portal/index.md +9 -0
- package/dist/reference/sdk-api/ui/progress/Progress.md +109 -0
- package/dist/reference/sdk-api/ui/progress/ProgressIndicator.md +107 -0
- package/dist/reference/sdk-api/ui/progress/ProgressLabel.md +100 -0
- package/dist/reference/sdk-api/ui/progress/ProgressTrack.md +100 -0
- package/dist/reference/sdk-api/ui/progress/ProgressValue.md +105 -0
- package/dist/reference/sdk-api/ui/progress/index.md +13 -0
- package/dist/reference/sdk-api/ui/radio-group/RadioGroup.md +108 -0
- package/dist/reference/sdk-api/ui/radio-group/RadioGroupItem.md +107 -0
- package/dist/reference/sdk-api/ui/radio-group/index.md +10 -0
- package/dist/reference/sdk-api/ui/resizable/ResizableHandle.md +107 -0
- package/dist/reference/sdk-api/ui/resizable/ResizablePanel.md +108 -0
- package/dist/reference/sdk-api/ui/resizable/ResizablePanelGroup.md +107 -0
- package/dist/reference/sdk-api/ui/resizable/index.md +11 -0
- package/dist/reference/sdk-api/ui/scroll-area/ScrollArea.md +159 -0
- package/dist/reference/sdk-api/ui/scroll-area/ScrollBar.md +106 -0
- package/dist/reference/sdk-api/ui/scroll-area/index.md +10 -0
- package/dist/reference/sdk-api/ui/select/Select.md +80 -0
- package/dist/reference/sdk-api/ui/select/SelectContent.md +106 -0
- package/dist/reference/sdk-api/ui/select/SelectGroup.md +100 -0
- package/dist/reference/sdk-api/ui/select/SelectItem.md +106 -0
- package/dist/reference/sdk-api/ui/select/SelectLabel.md +100 -0
- package/dist/reference/sdk-api/ui/select/SelectScrollDownButton.md +100 -0
- package/dist/reference/sdk-api/ui/select/SelectScrollUpButton.md +100 -0
- package/dist/reference/sdk-api/ui/select/SelectSeparator.md +100 -0
- package/dist/reference/sdk-api/ui/select/SelectTrigger.md +106 -0
- package/dist/reference/sdk-api/ui/select/SelectValue.md +106 -0
- package/dist/reference/sdk-api/ui/select/index.md +18 -0
- package/dist/reference/sdk-api/ui/separator/Separator.md +106 -0
- package/dist/reference/sdk-api/ui/separator/index.md +9 -0
- package/dist/reference/sdk-api/ui/sheet/Sheet.md +58 -0
- package/dist/reference/sdk-api/ui/sheet/SheetClose.md +100 -0
- package/dist/reference/sdk-api/ui/sheet/SheetContent.md +113 -0
- package/dist/reference/sdk-api/ui/sheet/SheetDescription.md +100 -0
- package/dist/reference/sdk-api/ui/sheet/SheetFooter.md +100 -0
- package/dist/reference/sdk-api/ui/sheet/SheetHeader.md +100 -0
- package/dist/reference/sdk-api/ui/sheet/SheetOverlay.md +100 -0
- package/dist/reference/sdk-api/ui/sheet/SheetPortal.md +55 -0
- package/dist/reference/sdk-api/ui/sheet/SheetTitle.md +100 -0
- package/dist/reference/sdk-api/ui/sheet/SheetTrigger.md +100 -0
- package/dist/reference/sdk-api/ui/sheet/index.md +18 -0
- package/dist/reference/sdk-api/ui/skeleton/Skeleton.md +100 -0
- package/dist/reference/sdk-api/ui/skeleton/index.md +9 -0
- package/dist/reference/sdk-api/ui/slider/Slider.md +116 -0
- package/dist/reference/sdk-api/ui/slider/index.md +9 -0
- package/dist/reference/sdk-api/ui/sonner/Toaster.md +43 -0
- package/dist/reference/sdk-api/ui/sonner/index.md +10 -0
- package/dist/reference/sdk-api/ui/sonner/toast.md +58 -0
- package/dist/reference/sdk-api/ui/spinner/Spinner.md +100 -0
- package/dist/reference/sdk-api/ui/spinner/index.md +9 -0
- package/dist/reference/sdk-api/ui/switch/Switch.md +110 -0
- package/dist/reference/sdk-api/ui/switch/index.md +9 -0
- package/dist/reference/sdk-api/ui/table/Table.md +100 -0
- package/dist/reference/sdk-api/ui/table/TableBody.md +100 -0
- package/dist/reference/sdk-api/ui/table/TableCaption.md +100 -0
- package/dist/reference/sdk-api/ui/table/TableCell.md +106 -0
- package/dist/reference/sdk-api/ui/table/TableFooter.md +100 -0
- package/dist/reference/sdk-api/ui/table/TableHead.md +106 -0
- package/dist/reference/sdk-api/ui/table/TableHeader.md +100 -0
- package/dist/reference/sdk-api/ui/table/TableRow.md +100 -0
- package/dist/reference/sdk-api/ui/table/index.md +16 -0
- package/dist/reference/sdk-api/ui/tabs/Tabs.md +109 -0
- package/dist/reference/sdk-api/ui/tabs/TabsContent.md +106 -0
- package/dist/reference/sdk-api/ui/tabs/TabsList.md +106 -0
- package/dist/reference/sdk-api/ui/tabs/TabsTrigger.md +107 -0
- package/dist/reference/sdk-api/ui/tabs/index.md +13 -0
- package/dist/reference/sdk-api/ui/tabs/tabsListVariants.md +70 -0
- package/dist/reference/sdk-api/ui/textarea/Textarea.md +126 -0
- package/dist/reference/sdk-api/ui/textarea/index.md +9 -0
- package/dist/reference/sdk-api/ui/toggle/Toggle.md +118 -0
- package/dist/reference/sdk-api/ui/toggle/index.md +10 -0
- package/dist/reference/sdk-api/ui/toggle/toggleVariants.md +71 -0
- package/dist/reference/sdk-api/ui/toggle-group/ToggleGroup.md +122 -0
- package/dist/reference/sdk-api/ui/toggle-group/ToggleGroupItem.md +116 -0
- package/dist/reference/sdk-api/ui/toggle-group/index.md +10 -0
- package/dist/reference/sdk-api.json +74470 -146
- package/dist/reference/sdk-api.md +62 -3
- package/dist/ui/accordion.d.ts +48 -0
- package/dist/ui/accordion.js +40 -0
- package/dist/ui/accordion.js.map +1 -1
- package/dist/ui/alert-dialog.d.ts +123 -0
- package/dist/ui/alert-dialog.js +114 -0
- package/dist/ui/alert-dialog.js.map +1 -1
- package/dist/ui/alert.d.ts +41 -0
- package/dist/ui/alert.js +41 -0
- package/dist/ui/alert.js.map +1 -1
- package/dist/ui/aspect-ratio.d.ts +11 -0
- package/dist/ui/aspect-ratio.js +10 -0
- package/dist/ui/aspect-ratio.js.map +1 -1
- package/dist/ui/avatar.d.ts +65 -0
- package/dist/ui/avatar.js +63 -0
- package/dist/ui/avatar.js.map +1 -1
- package/dist/ui/badge.d.ts +22 -0
- package/dist/ui/badge.js +22 -0
- package/dist/ui/badge.js.map +1 -1
- package/dist/ui/button-group.d.ts +45 -0
- package/dist/ui/button-group.js +43 -0
- package/dist/ui/button-group.js.map +1 -1
- package/dist/ui/button.d.ts +52 -0
- package/dist/ui/button.js +30 -0
- package/dist/ui/button.js.map +1 -1
- package/dist/ui/calendar.d.ts +44 -0
- package/dist/ui/calendar.js +19 -0
- package/dist/ui/calendar.js.map +1 -1
- package/dist/ui/card.d.ts +71 -0
- package/dist/ui/card.js +70 -0
- package/dist/ui/card.js.map +1 -1
- package/dist/ui/carousel.d.ts +71 -0
- package/dist/ui/carousel.js +66 -0
- package/dist/ui/carousel.js.map +1 -1
- package/dist/ui/checkbox.d.ts +14 -0
- package/dist/ui/checkbox.js +10 -0
- package/dist/ui/checkbox.js.map +1 -1
- package/dist/ui/collapsible.d.ts +37 -0
- package/dist/ui/collapsible.js +30 -0
- package/dist/ui/collapsible.js.map +1 -1
- package/dist/ui/combobox.d.ts +190 -0
- package/dist/ui/combobox.js +167 -0
- package/dist/ui/combobox.js.map +1 -1
- package/dist/ui/dialog.d.ts +109 -0
- package/dist/ui/dialog.js +100 -0
- package/dist/ui/dialog.js.map +1 -1
- package/dist/ui/drawer.d.ts +106 -0
- package/dist/ui/drawer.js +100 -0
- package/dist/ui/drawer.js.map +1 -1
- package/dist/ui/dropdown-menu.d.ts +171 -0
- package/dist/ui/dropdown-menu.js +150 -0
- package/dist/ui/dropdown-menu.js.map +1 -1
- package/dist/ui/empty.d.ts +61 -0
- package/dist/ui/empty.js +61 -0
- package/dist/ui/empty.js.map +1 -1
- package/dist/ui/field.d.ts +105 -0
- package/dist/ui/field.js +101 -0
- package/dist/ui/field.js.map +1 -1
- package/dist/ui/helpers.d.ts +11 -0
- package/dist/ui/helpers.js +11 -0
- package/dist/ui/helpers.js.map +1 -1
- package/dist/ui/input-group.d.ts +65 -0
- package/dist/ui/input-group.js +65 -0
- package/dist/ui/input-group.js.map +1 -1
- package/dist/ui/input-otp.d.ts +48 -0
- package/dist/ui/input-otp.js +40 -0
- package/dist/ui/input-otp.js.map +1 -1
- package/dist/ui/input.d.ts +24 -2
- package/dist/ui/input.js +20 -0
- package/dist/ui/input.js.map +1 -1
- package/dist/ui/item.d.ts +103 -0
- package/dist/ui/item.js +103 -0
- package/dist/ui/item.js.map +1 -1
- package/dist/ui/label.d.ts +10 -0
- package/dist/ui/label.js +10 -0
- package/dist/ui/label.js.map +1 -1
- package/dist/ui/menubar.d.ts +193 -0
- package/dist/ui/menubar.js +160 -0
- package/dist/ui/menubar.js.map +1 -1
- package/dist/ui/navigation-menu.d.ts +98 -0
- package/dist/ui/navigation-menu.js +90 -0
- package/dist/ui/navigation-menu.js.map +1 -1
- package/dist/ui/pagination.d.ts +76 -0
- package/dist/ui/pagination.js +73 -0
- package/dist/ui/pagination.js.map +1 -1
- package/dist/ui/popover.d.ts +81 -0
- package/dist/ui/popover.js +70 -0
- package/dist/ui/popover.js.map +1 -1
- package/dist/ui/portal.d.ts +11 -0
- package/dist/ui/portal.js +10 -0
- package/dist/ui/portal.js.map +1 -1
- package/dist/ui/progress.d.ts +53 -26
- package/dist/ui/progress.js +50 -26
- package/dist/ui/progress.js.map +1 -1
- package/dist/ui/radio-group.d.ts +25 -0
- package/dist/ui/radio-group.js +20 -0
- package/dist/ui/radio-group.js.map +1 -1
- package/dist/ui/resizable.d.ts +37 -0
- package/dist/ui/resizable.js +30 -0
- package/dist/ui/resizable.js.map +1 -1
- package/dist/ui/scroll-area.d.ts +22 -0
- package/dist/ui/scroll-area.js +21 -0
- package/dist/ui/scroll-area.js.map +1 -1
- package/dist/ui/select.d.ts +122 -0
- package/dist/ui/select.js +108 -0
- package/dist/ui/select.js.map +1 -1
- package/dist/ui/separator.d.ts +11 -0
- package/dist/ui/separator.js +10 -0
- package/dist/ui/separator.js.map +1 -1
- package/dist/ui/sheet.d.ts +107 -0
- package/dist/ui/sheet.js +101 -0
- package/dist/ui/sheet.js.map +1 -1
- package/dist/ui/skeleton.d.ts +10 -0
- package/dist/ui/skeleton.js +10 -0
- package/dist/ui/skeleton.js.map +1 -1
- package/dist/ui/slider.d.ts +21 -0
- package/dist/ui/slider.js +14 -0
- package/dist/ui/slider.js.map +1 -1
- package/dist/ui/sonner.d.ts +23 -0
- package/dist/ui/sonner.js +21 -0
- package/dist/ui/sonner.js.map +1 -1
- package/dist/ui/spinner.d.ts +10 -0
- package/dist/ui/spinner.js +10 -0
- package/dist/ui/spinner.js.map +1 -1
- package/dist/ui/switch.d.ts +15 -0
- package/dist/ui/switch.js +10 -0
- package/dist/ui/switch.js.map +1 -1
- package/dist/ui/table.d.ts +81 -0
- package/dist/ui/table.js +80 -0
- package/dist/ui/table.js.map +1 -1
- package/dist/ui/tabs.d.ts +59 -0
- package/dist/ui/tabs.js +51 -0
- package/dist/ui/tabs.js.map +1 -1
- package/dist/ui/textarea.d.ts +13 -0
- package/dist/ui/textarea.js +13 -0
- package/dist/ui/textarea.js.map +1 -1
- package/dist/ui/toggle-group.d.ts +34 -0
- package/dist/ui/toggle-group.js +24 -0
- package/dist/ui/toggle-group.js.map +1 -1
- package/dist/ui/toggle.d.ts +28 -0
- package/dist/ui/toggle.js +24 -0
- package/dist/ui/toggle.js.map +1 -1
- package/package.json +4 -2
- package/release-provenance.json +15 -0
- package/src/adapters/interest-card/eslint/eslint-plugin-custom-navigation.mjs +2 -0
- package/src/adapters/interest-card/eslint/taro.mjs +21 -0
- package/src/adapters/interest-card/runtime/microapp.ts +11 -0
- package/src/adapters/interest-card/types/taro.d.ts +28 -0
- package/src/build/config-overrides.ts +39 -0
- package/src/build/index.ts +5 -0
- package/src/build/plugins/app-config.ts +47 -0
- package/src/build/plugins/depend-card/analyze.ts +122 -0
- package/src/build/plugins/depend-card/source.ts +97 -0
- package/src/build/plugins/vite-depend-card.ts +168 -0
- package/src/build/plugins/vite-image-asset-import.ts +178 -0
- package/src/build/plugins/vite-inline-json.ts +149 -0
- package/src/build/plugins/vite-taro-source-location.ts +224 -0
- package/src/build/plugins/vite-tt-components-entry.ts +33 -0
- package/src/build/taro.ts +830 -0
- package/src/components/miniapp-open-card.ts +94 -0
- package/src/components/native-miniapp-open-card.ts +7 -0
- package/src/eslint/eslint-plugin-custom-navigation.mjs +290 -0
- package/src/eslint/eslint-plugin-microapp-pages.mjs +659 -0
- package/src/eslint/server.mjs +69 -0
- package/src/eslint/taro.mjs +587 -0
- package/src/index.ts +2 -0
- package/src/internal/runtime/douyin-open-button.d.ts +29 -0
- package/src/internal/runtime/iframe-auth/identity.ts +236 -0
- package/src/internal/runtime/iframe-auth/index.ts +2 -0
- package/src/internal/runtime/iframe-auth/sync.ts +37 -0
- package/src/internal/vendor-modules.d.ts +8 -0
- package/src/lib/measure.ts +115 -0
- package/src/lib/platform.ts +11 -0
- package/src/lib/utils.ts +6 -0
- package/src/runtime/client.ts +246 -0
- package/src/runtime/default-client.ts +26 -0
- package/src/runtime/default-iframe-auth.ts +13 -0
- package/src/runtime/douyin-container-request.ts +367 -0
- package/src/runtime/douyin-login-request.ts +514 -0
- package/src/runtime/globals.d.ts +342 -0
- package/src/runtime/index.ts +4 -0
- package/src/runtime/network-url.ts +63 -0
- package/src/ui/accordion.tsx +226 -0
- package/src/ui/alert-dialog.tsx +407 -0
- package/src/ui/alert.tsx +149 -0
- package/src/ui/aspect-ratio.tsx +37 -0
- package/src/ui/avatar.tsx +238 -0
- package/src/ui/badge.tsx +77 -0
- package/src/ui/button-group.tsx +173 -0
- package/src/ui/button.tsx +215 -0
- package/src/ui/calendar.tsx +353 -0
- package/src/ui/card.tsx +217 -0
- package/src/ui/carousel.tsx +259 -0
- package/src/ui/checkbox.tsx +62 -0
- package/src/ui/collapsible.tsx +148 -0
- package/src/ui/combobox.tsx +650 -0
- package/src/ui/dialog.tsx +290 -0
- package/src/ui/drawer.tsx +272 -0
- package/src/ui/dropdown-menu.tsx +547 -0
- package/src/ui/empty.tsx +166 -0
- package/src/ui/field.tsx +427 -0
- package/src/ui/helpers.tsx +39 -0
- package/src/ui/index.ts +47 -0
- package/src/ui/input-group.tsx +320 -0
- package/src/ui/input-otp.tsx +189 -0
- package/src/ui/input.tsx +60 -0
- package/src/ui/item.tsx +338 -0
- package/src/ui/label.tsx +31 -0
- package/src/ui/menubar.tsx +835 -0
- package/src/ui/navigation-menu.tsx +341 -0
- package/src/ui/pagination.tsx +195 -0
- package/src/ui/popover.tsx +363 -0
- package/src/ui/portal.tsx +31 -0
- package/src/ui/progress.tsx +182 -0
- package/src/ui/radio-group.tsx +111 -0
- package/src/ui/resizable.tsx +410 -0
- package/src/ui/scroll-area.tsx +102 -0
- package/src/ui/select.tsx +471 -0
- package/src/ui/separator.tsx +37 -0
- package/src/ui/sheet.tsx +289 -0
- package/src/ui/skeleton.tsx +25 -0
- package/src/ui/slider.tsx +176 -0
- package/src/ui/sonner.tsx +40 -0
- package/src/ui/spinner.tsx +23 -0
- package/src/ui/switch.tsx +94 -0
- package/src/ui/table.tsx +240 -0
- package/src/ui/tabs.tsx +233 -0
- package/src/ui/tailwind.css +2 -0
- package/src/ui/textarea.tsx +49 -0
- package/src/ui/theme.css +234 -0
- package/src/ui/toggle-group.tsx +215 -0
- package/src/ui/toggle.tsx +113 -0
package/src/ui/card.tsx
ADDED
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { View, type ViewProps } from "@tarojs/components"
|
|
3
|
+
|
|
4
|
+
import { cn } from "../lib/utils"
|
|
5
|
+
|
|
6
|
+
const CardContext = React.createContext<{
|
|
7
|
+
size: "default" | "sm"
|
|
8
|
+
}>({
|
|
9
|
+
size: "default",
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @desc 内容卡片组件。
|
|
14
|
+
* @param {Parameters<typeof Card>[0]} props 组件属性;自有字段的用途及默认行为见下表,继承属性另列。
|
|
15
|
+
* @return {ReturnType<typeof Card>} 组件渲染结果;类型见返回值契约。
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* import { Card } from '@open-dy/vibecoding-sdk-taro/ui/card'
|
|
19
|
+
* <Card />
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
function Card({
|
|
23
|
+
className,
|
|
24
|
+
size = "default",
|
|
25
|
+
children,
|
|
26
|
+
...props
|
|
27
|
+
}: ViewProps & {
|
|
28
|
+
/** @desc 卡片密度,默认 default(gap-4/py-4,内区 px-4);sm 使用 gap-3/py-3 和内区 px-3,影响标题及页脚。 */
|
|
29
|
+
size?: "default" | "sm" }) {
|
|
30
|
+
const hasFooter = React.useMemo(
|
|
31
|
+
() =>
|
|
32
|
+
React.Children.toArray(children).some(
|
|
33
|
+
(child) => React.isValidElement(child) && child.type === CardFooter
|
|
34
|
+
),
|
|
35
|
+
[children]
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<CardContext.Provider value={{ size }}>
|
|
40
|
+
<View
|
|
41
|
+
data-slot="card"
|
|
42
|
+
data-size={size}
|
|
43
|
+
className={cn(
|
|
44
|
+
"group/card flex flex-col overflow-hidden rounded-xl bg-card text-sm text-card-foreground ring-1 ring-foreground/10 has-[>img:first-child]:pt-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",
|
|
45
|
+
size === "sm" ? "gap-3 py-3" : "gap-4 py-4",
|
|
46
|
+
hasFooter && "pb-0",
|
|
47
|
+
className
|
|
48
|
+
)}
|
|
49
|
+
{...props}
|
|
50
|
+
>
|
|
51
|
+
{children}
|
|
52
|
+
</View>
|
|
53
|
+
</CardContext.Provider>
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @desc 内容卡片头部布局。
|
|
59
|
+
* @param {Parameters<typeof CardHeader>[0]} props 组件属性;自有字段的用途及默认行为见下表,继承属性另列。
|
|
60
|
+
* @return {ReturnType<typeof CardHeader>} 组件渲染结果;类型见返回值契约。
|
|
61
|
+
* @example
|
|
62
|
+
* ```tsx
|
|
63
|
+
* import { Card, CardHeader } from '@open-dy/vibecoding-sdk-taro/ui/card'
|
|
64
|
+
* <Card><CardHeader /></Card>
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
function CardHeader({ className, children, ...props }: ViewProps) {
|
|
68
|
+
const { size } = React.useContext(CardContext)
|
|
69
|
+
const childArray = React.Children.toArray(children)
|
|
70
|
+
const hasAction = childArray.some(
|
|
71
|
+
(child) => React.isValidElement(child) && child.type === CardAction
|
|
72
|
+
)
|
|
73
|
+
const hasDescription = childArray.some(
|
|
74
|
+
(child) => React.isValidElement(child) && child.type === CardDescription
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<View
|
|
79
|
+
data-slot="card-header"
|
|
80
|
+
className={cn(
|
|
81
|
+
"group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl",
|
|
82
|
+
size === "sm" ? "px-3" : "px-4",
|
|
83
|
+
hasAction && "grid-cols-[1fr_auto]",
|
|
84
|
+
hasDescription && "grid-rows-[auto_auto]",
|
|
85
|
+
size === "sm" ? "[.border-b]:pb-3" : "[.border-b]:pb-4",
|
|
86
|
+
className
|
|
87
|
+
)}
|
|
88
|
+
{...props}
|
|
89
|
+
>
|
|
90
|
+
{children}
|
|
91
|
+
</View>
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* @desc 内容卡片标题。
|
|
97
|
+
* @param {Parameters<typeof CardTitle>[0]} props 组件属性;自有字段的用途及默认行为见下表,继承属性另列。
|
|
98
|
+
* @return {ReturnType<typeof CardTitle>} 组件渲染结果;类型见返回值契约。
|
|
99
|
+
* @example
|
|
100
|
+
* ```tsx
|
|
101
|
+
* import { Card, CardTitle } from '@open-dy/vibecoding-sdk-taro/ui/card'
|
|
102
|
+
* <Card><CardTitle /></Card>
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
function CardTitle({ className, ...props }: ViewProps) {
|
|
106
|
+
const { size } = React.useContext(CardContext)
|
|
107
|
+
return (
|
|
108
|
+
<View
|
|
109
|
+
data-slot="card-title"
|
|
110
|
+
className={cn(
|
|
111
|
+
"font-heading text-base leading-snug font-medium",
|
|
112
|
+
size === "sm" && "text-sm",
|
|
113
|
+
className
|
|
114
|
+
)}
|
|
115
|
+
{...props}
|
|
116
|
+
/>
|
|
117
|
+
)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* @desc 内容卡片说明文本。
|
|
122
|
+
* @param {Parameters<typeof CardDescription>[0]} props 组件属性;自有字段的用途及默认行为见下表,继承属性另列。
|
|
123
|
+
* @return {ReturnType<typeof CardDescription>} 组件渲染结果;类型见返回值契约。
|
|
124
|
+
* @example
|
|
125
|
+
* ```tsx
|
|
126
|
+
* import { Card, CardDescription } from '@open-dy/vibecoding-sdk-taro/ui/card'
|
|
127
|
+
* <Card><CardDescription /></Card>
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
130
|
+
function CardDescription({ className, ...props }: ViewProps) {
|
|
131
|
+
return (
|
|
132
|
+
<View
|
|
133
|
+
data-slot="card-description"
|
|
134
|
+
className={cn("text-sm text-muted-foreground", className)}
|
|
135
|
+
{...props}
|
|
136
|
+
/>
|
|
137
|
+
)
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* @desc 内容卡片操作入口。
|
|
142
|
+
* @param {Parameters<typeof CardAction>[0]} props 组件属性;自有字段的用途及默认行为见下表,继承属性另列。
|
|
143
|
+
* @return {ReturnType<typeof CardAction>} 组件渲染结果;类型见返回值契约。
|
|
144
|
+
* @example
|
|
145
|
+
* ```tsx
|
|
146
|
+
* import { Card, CardAction } from '@open-dy/vibecoding-sdk-taro/ui/card'
|
|
147
|
+
* <Card><CardAction /></Card>
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
150
|
+
function CardAction({ className, ...props }: ViewProps) {
|
|
151
|
+
return (
|
|
152
|
+
<View
|
|
153
|
+
data-slot="card-action"
|
|
154
|
+
className={cn(
|
|
155
|
+
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
|
|
156
|
+
className
|
|
157
|
+
)}
|
|
158
|
+
{...props}
|
|
159
|
+
/>
|
|
160
|
+
)
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* @desc 内容卡片内容容器。
|
|
165
|
+
* @param {Parameters<typeof CardContent>[0]} props 组件属性;自有字段的用途及默认行为见下表,继承属性另列。
|
|
166
|
+
* @return {ReturnType<typeof CardContent>} 组件渲染结果;类型见返回值契约。
|
|
167
|
+
* @example
|
|
168
|
+
* ```tsx
|
|
169
|
+
* import { Card, CardContent } from '@open-dy/vibecoding-sdk-taro/ui/card'
|
|
170
|
+
* <Card><CardContent /></Card>
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
173
|
+
function CardContent({ className, ...props }: ViewProps) {
|
|
174
|
+
const { size } = React.useContext(CardContext)
|
|
175
|
+
return (
|
|
176
|
+
<View
|
|
177
|
+
data-slot="card-content"
|
|
178
|
+
className={cn(size === "sm" ? "px-3" : "px-4", className)}
|
|
179
|
+
{...props}
|
|
180
|
+
/>
|
|
181
|
+
)
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* @desc 内容卡片底部布局。
|
|
186
|
+
* @param {Parameters<typeof CardFooter>[0]} props 组件属性;自有字段的用途及默认行为见下表,继承属性另列。
|
|
187
|
+
* @return {ReturnType<typeof CardFooter>} 组件渲染结果;类型见返回值契约。
|
|
188
|
+
* @example
|
|
189
|
+
* ```tsx
|
|
190
|
+
* import { Card, CardFooter } from '@open-dy/vibecoding-sdk-taro/ui/card'
|
|
191
|
+
* <Card><CardFooter /></Card>
|
|
192
|
+
* ```
|
|
193
|
+
*/
|
|
194
|
+
function CardFooter({ className, ...props }: ViewProps) {
|
|
195
|
+
const { size } = React.useContext(CardContext)
|
|
196
|
+
return (
|
|
197
|
+
<View
|
|
198
|
+
data-slot="card-footer"
|
|
199
|
+
className={cn(
|
|
200
|
+
"flex items-center rounded-b-xl border-t bg-muted/50",
|
|
201
|
+
size === "sm" ? "p-3" : "p-4",
|
|
202
|
+
className
|
|
203
|
+
)}
|
|
204
|
+
{...props}
|
|
205
|
+
/>
|
|
206
|
+
)
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export {
|
|
210
|
+
Card,
|
|
211
|
+
CardHeader,
|
|
212
|
+
CardFooter,
|
|
213
|
+
CardTitle,
|
|
214
|
+
CardAction,
|
|
215
|
+
CardDescription,
|
|
216
|
+
CardContent,
|
|
217
|
+
}
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { View, Swiper, SwiperItem, type ViewProps } from "@tarojs/components"
|
|
3
|
+
|
|
4
|
+
import { cn } from "../lib/utils"
|
|
5
|
+
import { Button } from "./button"
|
|
6
|
+
import { ChevronLeft, ChevronRight } from "@open-dy/lucide-taro"
|
|
7
|
+
|
|
8
|
+
type CarouselProps = ViewProps & {
|
|
9
|
+
/** @desc 轮播方向,默认 horizontal;vertical 启用原生 Swiper 的纵向模式并调整前后按钮位置。 */
|
|
10
|
+
orientation?: "horizontal" | "vertical"
|
|
11
|
+
/** @desc 兼容属性;当前组件不读取该配置,也不把它作为 Swiper 配置,不能依赖它控制轮播。 */
|
|
12
|
+
opts?: Record<string, unknown>
|
|
13
|
+
/** @desc 兼容回调;当前组件不会调用它。需要内部轮播状态时应在 Carousel 内使用 useCarousel。 */
|
|
14
|
+
setApi?: (api: unknown) => void
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
type CarouselContextProps = {
|
|
18
|
+
orientation: "horizontal" | "vertical"
|
|
19
|
+
current: number
|
|
20
|
+
setCurrent: (n: number) => void
|
|
21
|
+
total: number
|
|
22
|
+
setTotal: (n: number) => void
|
|
23
|
+
scrollPrev: () => void
|
|
24
|
+
scrollNext: () => void
|
|
25
|
+
canScrollPrev: boolean
|
|
26
|
+
canScrollNext: boolean
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const CarouselContext = React.createContext<CarouselContextProps | null>(null)
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @desc 读取最近的 Carousel 上下文,包括当前位置、总数和前后翻页方法。
|
|
33
|
+
* @param 无参数
|
|
34
|
+
* @return {ReturnType<typeof useCarousel>} 当前上下文或锚点引用。
|
|
35
|
+
* @remarks 必须在 Carousel 的后代组件中调用;缺少上下文时会抛错。
|
|
36
|
+
* @example
|
|
37
|
+
* ```tsx
|
|
38
|
+
* import { useCarousel, CarouselNext } from '@open-dy/vibecoding-sdk-taro/ui/carousel'
|
|
39
|
+
* function Controls() { const carousel = useCarousel(); return <CarouselNext disabled={!carousel.canScrollNext} /> }
|
|
40
|
+
* // Controls 必须渲染在 Carousel 内。
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
function useCarousel() {
|
|
44
|
+
const context = React.useContext(CarouselContext)
|
|
45
|
+
if (!context) {
|
|
46
|
+
throw new Error("useCarousel must be used within a <Carousel />")
|
|
47
|
+
}
|
|
48
|
+
return context
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @desc 轮播组件。
|
|
53
|
+
* @param {Parameters<typeof Carousel>[0]} props 组件属性;自有字段的用途及默认行为见下表,继承属性另列。
|
|
54
|
+
* @return {ReturnType<typeof Carousel>} 组件渲染结果;类型见返回值契约。
|
|
55
|
+
* @example
|
|
56
|
+
* ```tsx
|
|
57
|
+
* import { Carousel } from '@open-dy/vibecoding-sdk-taro/ui/carousel'
|
|
58
|
+
* <Carousel />
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
function Carousel({
|
|
62
|
+
orientation = "horizontal",
|
|
63
|
+
className,
|
|
64
|
+
children,
|
|
65
|
+
...props
|
|
66
|
+
}: CarouselProps) {
|
|
67
|
+
const [current, setCurrent] = React.useState(0)
|
|
68
|
+
const [total, setTotal] = React.useState(0)
|
|
69
|
+
|
|
70
|
+
const scrollPrev = React.useCallback(() => {
|
|
71
|
+
setCurrent((prev) => Math.max(0, prev - 1))
|
|
72
|
+
}, [])
|
|
73
|
+
|
|
74
|
+
const scrollNext = React.useCallback(() => {
|
|
75
|
+
setCurrent((prev) => Math.min(total - 1, prev + 1))
|
|
76
|
+
}, [total])
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<CarouselContext.Provider
|
|
80
|
+
value={{
|
|
81
|
+
orientation,
|
|
82
|
+
current,
|
|
83
|
+
setCurrent,
|
|
84
|
+
total,
|
|
85
|
+
setTotal,
|
|
86
|
+
scrollPrev,
|
|
87
|
+
scrollNext,
|
|
88
|
+
canScrollPrev: current > 0,
|
|
89
|
+
canScrollNext: current < total - 1,
|
|
90
|
+
}}
|
|
91
|
+
>
|
|
92
|
+
<View
|
|
93
|
+
data-slot="carousel"
|
|
94
|
+
className={cn("relative overflow-visible", className)}
|
|
95
|
+
{...props}
|
|
96
|
+
>
|
|
97
|
+
{children}
|
|
98
|
+
</View>
|
|
99
|
+
</CarouselContext.Provider>
|
|
100
|
+
)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* @desc 轮播内容容器。
|
|
105
|
+
* @param {Parameters<typeof CarouselContent>[0]} props 组件属性;自有字段的用途及默认行为见下表,继承属性另列。
|
|
106
|
+
* @return {ReturnType<typeof CarouselContent>} 组件渲染结果;类型见返回值契约。
|
|
107
|
+
* @example
|
|
108
|
+
* ```tsx
|
|
109
|
+
* import { Carousel, CarouselContent } from '@open-dy/vibecoding-sdk-taro/ui/carousel'
|
|
110
|
+
* <Carousel><CarouselContent /></Carousel>
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
function CarouselContent({
|
|
114
|
+
className,
|
|
115
|
+
children,
|
|
116
|
+
...props
|
|
117
|
+
}: ViewProps) {
|
|
118
|
+
const { orientation, current, setCurrent, setTotal } = useCarousel()
|
|
119
|
+
const childArray = React.Children.toArray(children)
|
|
120
|
+
|
|
121
|
+
React.useEffect(() => {
|
|
122
|
+
setTotal(childArray.length)
|
|
123
|
+
}, [childArray.length, setTotal])
|
|
124
|
+
|
|
125
|
+
return (
|
|
126
|
+
<Swiper
|
|
127
|
+
data-slot="carousel-content"
|
|
128
|
+
className={cn("overflow-hidden", className)}
|
|
129
|
+
vertical={orientation === "vertical"}
|
|
130
|
+
current={current}
|
|
131
|
+
onChange={(e) => setCurrent(e.detail.current)}
|
|
132
|
+
{...props}
|
|
133
|
+
>
|
|
134
|
+
{childArray.map((child, index) => (
|
|
135
|
+
<SwiperItem key={index}>{child}</SwiperItem>
|
|
136
|
+
))}
|
|
137
|
+
</Swiper>
|
|
138
|
+
)
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* @desc 轮播条目。
|
|
143
|
+
* @param {Parameters<typeof CarouselItem>[0]} props 组件属性;自有字段的用途及默认行为见下表,继承属性另列。
|
|
144
|
+
* @return {ReturnType<typeof CarouselItem>} 组件渲染结果;类型见返回值契约。
|
|
145
|
+
* @example
|
|
146
|
+
* ```tsx
|
|
147
|
+
* import { Carousel, CarouselItem } from '@open-dy/vibecoding-sdk-taro/ui/carousel'
|
|
148
|
+
* <Carousel><CarouselItem /></Carousel>
|
|
149
|
+
* ```
|
|
150
|
+
*/
|
|
151
|
+
function CarouselItem({
|
|
152
|
+
className,
|
|
153
|
+
...props
|
|
154
|
+
}: ViewProps) {
|
|
155
|
+
return (
|
|
156
|
+
<View
|
|
157
|
+
data-slot="carousel-item"
|
|
158
|
+
className={cn("min-w-0 shrink-0 grow-0 basis-full", className)}
|
|
159
|
+
{...props}
|
|
160
|
+
/>
|
|
161
|
+
)
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* @desc 轮播上一项按钮。
|
|
166
|
+
* @param {Parameters<typeof CarouselPrevious>[0]} props 组件属性;自有字段的用途及默认行为见下表,继承属性另列。
|
|
167
|
+
* @param {Parameters<typeof CarouselPrevious>[0]["variant"]} props.variant 按钮外观,默认 outline;其余变体同 Button.variant。
|
|
168
|
+
* @param {Parameters<typeof CarouselPrevious>[0]["size"]} props.size 按钮尺寸,默认 icon-sm(size-7);可按 Button.size 选择其他尺寸。
|
|
169
|
+
* @return {ReturnType<typeof CarouselPrevious>} 组件渲染结果;类型见返回值契约。
|
|
170
|
+
* @example
|
|
171
|
+
* ```tsx
|
|
172
|
+
* import { Carousel, CarouselPrevious } from '@open-dy/vibecoding-sdk-taro/ui/carousel'
|
|
173
|
+
* <Carousel><CarouselPrevious /></Carousel>
|
|
174
|
+
* ```
|
|
175
|
+
*/
|
|
176
|
+
function CarouselPrevious({
|
|
177
|
+
className,
|
|
178
|
+
variant = "outline",
|
|
179
|
+
size = "icon-sm",
|
|
180
|
+
...props
|
|
181
|
+
}: React.ComponentProps<typeof Button> & {
|
|
182
|
+
/** @desc 沿用 Button 的原生属性;普通 View 分支不保证阻止点击。边界状态由轮播组件自身的 canScrollPrev/canScrollNext 样式控制。 */
|
|
183
|
+
disabled?: boolean }) {
|
|
184
|
+
const { orientation, scrollPrev, canScrollPrev } = useCarousel()
|
|
185
|
+
|
|
186
|
+
return (
|
|
187
|
+
<Button
|
|
188
|
+
data-slot="carousel-previous"
|
|
189
|
+
variant={variant}
|
|
190
|
+
size={size}
|
|
191
|
+
className={cn(
|
|
192
|
+
"absolute z-10 touch-manipulation rounded-full bg-background/80",
|
|
193
|
+
orientation === "horizontal"
|
|
194
|
+
? "top-1/2 -left-12 -translate-y-1/2"
|
|
195
|
+
: "-top-12 left-1/2 -translate-x-1/2 rotate-90",
|
|
196
|
+
!canScrollPrev && "pointer-events-none opacity-50",
|
|
197
|
+
className
|
|
198
|
+
)}
|
|
199
|
+
onTap={scrollPrev}
|
|
200
|
+
onClick={scrollPrev}
|
|
201
|
+
{...props}
|
|
202
|
+
>
|
|
203
|
+
<ChevronLeft />
|
|
204
|
+
</Button>
|
|
205
|
+
)
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* @desc 轮播下一项按钮。
|
|
210
|
+
* @param {Parameters<typeof CarouselNext>[0]} props 组件属性;自有字段的用途及默认行为见下表,继承属性另列。
|
|
211
|
+
* @param {Parameters<typeof CarouselNext>[0]["variant"]} props.variant 按钮外观,默认 outline;其余变体同 Button.variant。
|
|
212
|
+
* @param {Parameters<typeof CarouselNext>[0]["size"]} props.size 按钮尺寸,默认 icon-sm(size-7);可按 Button.size 选择其他尺寸。
|
|
213
|
+
* @return {ReturnType<typeof CarouselNext>} 组件渲染结果;类型见返回值契约。
|
|
214
|
+
* @example
|
|
215
|
+
* ```tsx
|
|
216
|
+
* import { Carousel, CarouselNext } from '@open-dy/vibecoding-sdk-taro/ui/carousel'
|
|
217
|
+
* <Carousel><CarouselNext /></Carousel>
|
|
218
|
+
* ```
|
|
219
|
+
*/
|
|
220
|
+
function CarouselNext({
|
|
221
|
+
className,
|
|
222
|
+
variant = "outline",
|
|
223
|
+
size = "icon-sm",
|
|
224
|
+
...props
|
|
225
|
+
}: React.ComponentProps<typeof Button> & {
|
|
226
|
+
/** @desc 沿用 Button 的原生属性;普通 View 分支不保证阻止点击。边界状态由轮播组件自身的 canScrollPrev/canScrollNext 样式控制。 */
|
|
227
|
+
disabled?: boolean }) {
|
|
228
|
+
const { orientation, scrollNext, canScrollNext } = useCarousel()
|
|
229
|
+
|
|
230
|
+
return (
|
|
231
|
+
<Button
|
|
232
|
+
data-slot="carousel-next"
|
|
233
|
+
variant={variant}
|
|
234
|
+
size={size}
|
|
235
|
+
className={cn(
|
|
236
|
+
"absolute z-10 touch-manipulation rounded-full bg-background/80",
|
|
237
|
+
orientation === "horizontal"
|
|
238
|
+
? "top-1/2 -right-12 -translate-y-1/2"
|
|
239
|
+
: "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
|
|
240
|
+
!canScrollNext && "pointer-events-none opacity-50",
|
|
241
|
+
className
|
|
242
|
+
)}
|
|
243
|
+
onTap={scrollNext}
|
|
244
|
+
onClick={scrollNext}
|
|
245
|
+
{...props}
|
|
246
|
+
>
|
|
247
|
+
<ChevronRight />
|
|
248
|
+
</Button>
|
|
249
|
+
)
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export {
|
|
253
|
+
Carousel,
|
|
254
|
+
CarouselContent,
|
|
255
|
+
CarouselItem,
|
|
256
|
+
CarouselPrevious,
|
|
257
|
+
CarouselNext,
|
|
258
|
+
useCarousel,
|
|
259
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { View, type ViewProps } from "@tarojs/components"
|
|
3
|
+
|
|
4
|
+
import { cn } from "../lib/utils"
|
|
5
|
+
import { Check } from "@open-dy/lucide-taro"
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @desc 复选框组件。
|
|
9
|
+
* @param {Parameters<typeof Checkbox>[0]} props 组件属性;自有字段的用途及默认行为见下表,继承属性另列。
|
|
10
|
+
* @return {ReturnType<typeof Checkbox>} 组件渲染结果;类型见返回值契约。
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* import { Checkbox } from '@open-dy/vibecoding-sdk-taro/ui/checkbox'
|
|
14
|
+
* <Checkbox />
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
function Checkbox({
|
|
18
|
+
className,
|
|
19
|
+
checked: checkedProp,
|
|
20
|
+
defaultChecked,
|
|
21
|
+
onCheckedChange,
|
|
22
|
+
disabled,
|
|
23
|
+
...props
|
|
24
|
+
}: ViewProps & {
|
|
25
|
+
/** @desc 受控选中状态;传入后以该值为准,需在 onCheckedChange 中更新。省略时由内部状态管理。 */
|
|
26
|
+
checked?: boolean
|
|
27
|
+
/** @desc 非受控模式的初始选中状态,默认 false;仅初始化时读取,传入 checked 后不生效。 */
|
|
28
|
+
defaultChecked?: boolean
|
|
29
|
+
/** @desc 用户点击切换时调用,参数为下一选中状态;禁用时不触发,受控模式需同步 checked。 */
|
|
30
|
+
onCheckedChange?: (checked: boolean) => void
|
|
31
|
+
/** @desc 是否禁止用户切换;省略或 false 时可操作,true 时不触发内部切换回调。 */
|
|
32
|
+
disabled?: boolean
|
|
33
|
+
}) {
|
|
34
|
+
const [internalChecked, setInternalChecked] = React.useState(defaultChecked ?? false)
|
|
35
|
+
const isControlled = checkedProp !== undefined
|
|
36
|
+
const checked = isControlled ? checkedProp : internalChecked
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<View
|
|
40
|
+
data-slot="checkbox"
|
|
41
|
+
data-checked={checked || undefined}
|
|
42
|
+
aria-checked={checked}
|
|
43
|
+
aria-disabled={disabled || undefined}
|
|
44
|
+
className={cn(
|
|
45
|
+
"peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
|
|
46
|
+
checked && "border-primary bg-primary text-primary-foreground dark:bg-primary",
|
|
47
|
+
className
|
|
48
|
+
)}
|
|
49
|
+
onClick={() => {
|
|
50
|
+
if (disabled) return
|
|
51
|
+
const next = !checked
|
|
52
|
+
if (!isControlled) setInternalChecked(next)
|
|
53
|
+
onCheckedChange?.(next)
|
|
54
|
+
}}
|
|
55
|
+
{...props}
|
|
56
|
+
>
|
|
57
|
+
{checked ? <Check color="#fff" size={12} strokeWidth={3} className="text-current" /> : null}
|
|
58
|
+
</View>
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export { Checkbox }
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { View, type ViewProps } from "@tarojs/components"
|
|
3
|
+
|
|
4
|
+
const CollapsibleContext = React.createContext<{
|
|
5
|
+
open: boolean
|
|
6
|
+
toggle: () => void
|
|
7
|
+
}>({ open: false, toggle: () => {} })
|
|
8
|
+
|
|
9
|
+
type CollapsibleTriggerRenderProps = Omit<ViewProps, "children"> & {
|
|
10
|
+
/** @desc 组件自动注入的触发器标识;自定义 render 应转发到触发节点,不手动修改。 */
|
|
11
|
+
"data-slot": "collapsible-trigger"
|
|
12
|
+
/** @desc 组件自动注入的展开状态:open 或 closed;自定义 render 应转发以供状态样式使用。 */
|
|
13
|
+
"data-state": "open" | "closed"
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
type CollapsibleTriggerClickEvent = Parameters<
|
|
17
|
+
NonNullable<ViewProps["onClick"]>
|
|
18
|
+
>[0]
|
|
19
|
+
|
|
20
|
+
type CollapsibleTriggerProps = Omit<ViewProps, "children"> & {
|
|
21
|
+
/** @desc 默认触发器内的内容;设置 render 时由自定义渲染结果取代。 */
|
|
22
|
+
children?: React.ReactNode
|
|
23
|
+
/** @desc 自定义触发器元素或渲染函数;省略时使用 View。元素会被克隆并合并点击处理;函数收到状态和事件 props,必须传给实际可点击节点。 */
|
|
24
|
+
render?:
|
|
25
|
+
| React.ReactElement
|
|
26
|
+
| ((props: CollapsibleTriggerRenderProps) => React.ReactNode)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @desc 可折叠区域组件。
|
|
31
|
+
* @param {Parameters<typeof Collapsible>[0]} props 组件属性;自有字段的用途及默认行为见下表,继承属性另列。
|
|
32
|
+
* @return {ReturnType<typeof Collapsible>} 组件渲染结果;类型见返回值契约。
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* import { Collapsible } from '@open-dy/vibecoding-sdk-taro/ui/collapsible'
|
|
36
|
+
* <Collapsible />
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
function Collapsible({
|
|
40
|
+
open: openProp,
|
|
41
|
+
defaultOpen,
|
|
42
|
+
onOpenChange,
|
|
43
|
+
children,
|
|
44
|
+
...props
|
|
45
|
+
}: ViewProps & {
|
|
46
|
+
/** @desc 受控展开状态;传入后以该值为准,需在 onOpenChange 中更新。省略时由组件内部管理。 */
|
|
47
|
+
open?: boolean
|
|
48
|
+
/** @desc 非受控模式的初始展开状态,默认 false;仅初始化时读取,传入 open 后不生效。 */
|
|
49
|
+
defaultOpen?: boolean
|
|
50
|
+
/** @desc 触发器或关闭操作请求改变展开状态时调用,参数为下一状态;受控模式需由调用方同步 open。 */
|
|
51
|
+
onOpenChange?: (open: boolean) => void
|
|
52
|
+
}) {
|
|
53
|
+
const [internal, setInternal] = React.useState(defaultOpen ?? false)
|
|
54
|
+
const controlled = openProp !== undefined
|
|
55
|
+
const open = controlled ? openProp : internal
|
|
56
|
+
|
|
57
|
+
const toggle = React.useCallback(() => {
|
|
58
|
+
const next = !open
|
|
59
|
+
if (!controlled) setInternal(next)
|
|
60
|
+
onOpenChange?.(next)
|
|
61
|
+
}, [open, controlled, onOpenChange])
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<CollapsibleContext.Provider value={{ open, toggle }}>
|
|
65
|
+
<View data-slot="collapsible" data-state={open ? "open" : "closed"} {...props}>
|
|
66
|
+
{children}
|
|
67
|
+
</View>
|
|
68
|
+
</CollapsibleContext.Provider>
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* @desc 可折叠区域触发器。
|
|
74
|
+
* @param {Parameters<typeof CollapsibleTrigger>[0]} props 组件属性;自有字段的用途及默认行为见下表,继承属性另列。
|
|
75
|
+
* @return {ReturnType<typeof CollapsibleTrigger>} 组件渲染结果;类型见返回值契约。
|
|
76
|
+
* @example
|
|
77
|
+
* ```tsx
|
|
78
|
+
* import { Collapsible, CollapsibleTrigger } from '@open-dy/vibecoding-sdk-taro/ui/collapsible'
|
|
79
|
+
* <Collapsible><CollapsibleTrigger /></Collapsible>
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
function CollapsibleTrigger({
|
|
83
|
+
children,
|
|
84
|
+
render,
|
|
85
|
+
onClick,
|
|
86
|
+
...props
|
|
87
|
+
}: CollapsibleTriggerProps) {
|
|
88
|
+
const { open, toggle } = React.useContext(CollapsibleContext)
|
|
89
|
+
const handleClick = (event: CollapsibleTriggerClickEvent) => {
|
|
90
|
+
onClick?.(event)
|
|
91
|
+
toggle()
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const triggerProps: CollapsibleTriggerRenderProps = {
|
|
95
|
+
"data-slot": "collapsible-trigger",
|
|
96
|
+
"data-state": open ? "open" : "closed",
|
|
97
|
+
onClick: handleClick,
|
|
98
|
+
...props,
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (render) {
|
|
102
|
+
if (typeof render === "function") {
|
|
103
|
+
return <>{render(triggerProps)}</>
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (React.isValidElement(render)) {
|
|
107
|
+
const element = render as React.ReactElement<{
|
|
108
|
+
onClick?: ViewProps["onClick"]
|
|
109
|
+
}>
|
|
110
|
+
|
|
111
|
+
return React.cloneElement(element, {
|
|
112
|
+
...triggerProps,
|
|
113
|
+
onClick: (event: CollapsibleTriggerClickEvent) => {
|
|
114
|
+
element.props.onClick?.(event)
|
|
115
|
+
handleClick(event)
|
|
116
|
+
},
|
|
117
|
+
})
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return (
|
|
122
|
+
<View {...triggerProps}>
|
|
123
|
+
{children}
|
|
124
|
+
</View>
|
|
125
|
+
)
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* @desc 可折叠区域内容容器。
|
|
130
|
+
* @param {Parameters<typeof CollapsibleContent>[0]} props 组件属性;自有字段的用途及默认行为见下表,继承属性另列。
|
|
131
|
+
* @return {ReturnType<typeof CollapsibleContent>} 组件渲染结果;类型见返回值契约。
|
|
132
|
+
* @example
|
|
133
|
+
* ```tsx
|
|
134
|
+
* import { Collapsible, CollapsibleContent } from '@open-dy/vibecoding-sdk-taro/ui/collapsible'
|
|
135
|
+
* <Collapsible><CollapsibleContent /></Collapsible>
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
function CollapsibleContent({ children, ...props }: ViewProps) {
|
|
139
|
+
const { open } = React.useContext(CollapsibleContext)
|
|
140
|
+
if (!open) return null
|
|
141
|
+
return (
|
|
142
|
+
<View data-slot="collapsible-content" {...props}>
|
|
143
|
+
{children}
|
|
144
|
+
</View>
|
|
145
|
+
)
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export { Collapsible, CollapsibleTrigger, CollapsibleContent }
|