@vestow/vue 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/README.md +233 -0
- package/index.ts +8 -0
- package/package.json +68 -0
- package/src/components/accordion/Accordion.vue +45 -0
- package/src/components/accordion/AccordionContent.vue +31 -0
- package/src/components/accordion/AccordionItem.vue +26 -0
- package/src/components/accordion/AccordionTrigger.vue +39 -0
- package/src/components/accordion/index.ts +18 -0
- package/src/components/alert/Alert.vue +17 -0
- package/src/components/alert/AlertDescription.vue +12 -0
- package/src/components/alert/AlertTitle.vue +12 -0
- package/src/components/alert/index.ts +5 -0
- package/src/components/avatar/Avatar.vue +32 -0
- package/src/components/avatar/AvatarFallback.vue +23 -0
- package/src/components/avatar/AvatarImage.vue +18 -0
- package/src/components/avatar/index.ts +3 -0
- package/src/components/badge/Badge.vue +25 -0
- package/src/components/badge/index.ts +3 -0
- package/src/components/breadcrumb/Breadcrumb.vue +14 -0
- package/src/components/breadcrumb/BreadcrumbItem.vue +12 -0
- package/src/components/breadcrumb/BreadcrumbLink.vue +19 -0
- package/src/components/breadcrumb/BreadcrumbPage.vue +12 -0
- package/src/components/breadcrumb/BreadcrumbSeparator.vue +15 -0
- package/src/components/breadcrumb/index.ts +5 -0
- package/src/components/button/Button.vue +55 -0
- package/src/components/button/index.ts +3 -0
- package/src/components/button-group/ButtonGroup.vue +29 -0
- package/src/components/button-group/ButtonGroupSeparator.vue +30 -0
- package/src/components/button-group/ButtonGroupText.vue +29 -0
- package/src/components/button-group/SplitButton.vue +103 -0
- package/src/components/button-group/SplitButtonItems.vue +50 -0
- package/src/components/button-group/index.ts +34 -0
- package/src/components/calendar/Calendar.vue +120 -0
- package/src/components/calendar/RangeCalendar.vue +127 -0
- package/src/components/calendar/index.ts +2 -0
- package/src/components/card/Card.vue +12 -0
- package/src/components/card/CardAction.vue +12 -0
- package/src/components/card/CardContent.vue +12 -0
- package/src/components/card/CardDescription.vue +12 -0
- package/src/components/card/CardFooter.vue +12 -0
- package/src/components/card/CardHeader.vue +15 -0
- package/src/components/card/CardTitle.vue +12 -0
- package/src/components/card/index.ts +7 -0
- package/src/components/carousel/Carousel.vue +164 -0
- package/src/components/carousel/CarouselContent.vue +43 -0
- package/src/components/carousel/CarouselDots.vue +42 -0
- package/src/components/carousel/CarouselItem.vue +58 -0
- package/src/components/carousel/CarouselNext.vue +45 -0
- package/src/components/carousel/CarouselPrevious.vue +45 -0
- package/src/components/carousel/index.ts +44 -0
- package/src/components/cascade-select/CascadeSelect.vue +314 -0
- package/src/components/cascade-select/index.ts +11 -0
- package/src/components/chart/AreaChart.vue +201 -0
- package/src/components/chart/BarChart.vue +389 -0
- package/src/components/chart/ChartContainer.vue +127 -0
- package/src/components/chart/ChartCrosshair.vue +92 -0
- package/src/components/chart/ChartLegend.vue +63 -0
- package/src/components/chart/ChartTooltipCard.vue +49 -0
- package/src/components/chart/LineChart.vue +214 -0
- package/src/components/chart/PieChart.vue +280 -0
- package/src/components/chart/RadarChart.vue +291 -0
- package/src/components/chart/RadialChart.vue +354 -0
- package/src/components/chart/index.ts +30 -0
- package/src/components/chart/polar.ts +5 -0
- package/src/components/chart/tooltip.ts +5 -0
- package/src/components/chart/types.ts +52 -0
- package/src/components/chart/useChartSeries.ts +138 -0
- package/src/components/chart/xy-label.ts +5 -0
- package/src/components/checkbox/Checkbox.vue +81 -0
- package/src/components/checkbox/CheckboxField.vue +129 -0
- package/src/components/checkbox/CheckboxGroup.vue +62 -0
- package/src/components/checkbox/index.ts +21 -0
- package/src/components/chip/Chip.vue +73 -0
- package/src/components/chip/index.ts +3 -0
- package/src/components/code-block/CodeBlock.vue +100 -0
- package/src/components/code-block/index.ts +4 -0
- package/src/components/collapsible/Collapsible.vue +15 -0
- package/src/components/collapsible/CollapsibleContent.vue +26 -0
- package/src/components/collapsible/CollapsibleTrigger.vue +12 -0
- package/src/components/collapsible/index.ts +3 -0
- package/src/components/combobox/Combobox.vue +23 -0
- package/src/components/combobox/ComboboxAnchor.vue +20 -0
- package/src/components/combobox/ComboboxEmpty.vue +21 -0
- package/src/components/combobox/ComboboxGroup.vue +23 -0
- package/src/components/combobox/ComboboxInput.vue +32 -0
- package/src/components/combobox/ComboboxItem.vue +38 -0
- package/src/components/combobox/ComboboxList.vue +43 -0
- package/src/components/combobox/ComboboxSeparator.vue +18 -0
- package/src/components/combobox/ComboboxTrigger.vue +12 -0
- package/src/components/combobox/index.ts +9 -0
- package/src/components/command/Command.vue +54 -0
- package/src/components/command/CommandDialog.vue +41 -0
- package/src/components/command/CommandEmpty.vue +19 -0
- package/src/components/command/CommandGroup.vue +28 -0
- package/src/components/command/CommandInput.vue +25 -0
- package/src/components/command/CommandItem.vue +40 -0
- package/src/components/command/CommandList.vue +13 -0
- package/src/components/command/CommandSeparator.vue +11 -0
- package/src/components/command/CommandShortcut.vue +13 -0
- package/src/components/command/index.ts +34 -0
- package/src/components/command-block/CommandBlock.vue +90 -0
- package/src/components/command-block/index.ts +2 -0
- package/src/components/confirm-dialog/ConfirmDialog.vue +37 -0
- package/src/components/confirm-dialog/index.ts +1 -0
- package/src/components/confirm-popup/ConfirmPopup.vue +123 -0
- package/src/components/confirm-popup/index.ts +1 -0
- package/src/components/context-menu/ContextMenu.vue +15 -0
- package/src/components/context-menu/ContextMenuCheckboxItem.vue +30 -0
- package/src/components/context-menu/ContextMenuContent.vue +36 -0
- package/src/components/context-menu/ContextMenuGroup.vue +12 -0
- package/src/components/context-menu/ContextMenuItem.vue +32 -0
- package/src/components/context-menu/ContextMenuLabel.vue +21 -0
- package/src/components/context-menu/ContextMenuRadioGroup.vue +15 -0
- package/src/components/context-menu/ContextMenuRadioItem.vue +30 -0
- package/src/components/context-menu/ContextMenuSeparator.vue +19 -0
- package/src/components/context-menu/ContextMenuShortcut.vue +13 -0
- package/src/components/context-menu/ContextMenuSub.vue +15 -0
- package/src/components/context-menu/ContextMenuSubContent.vue +26 -0
- package/src/components/context-menu/ContextMenuSubTrigger.vue +26 -0
- package/src/components/context-menu/ContextMenuTrigger.vue +12 -0
- package/src/components/context-menu/index.ts +14 -0
- package/src/components/data-table/DataTable.vue +458 -0
- package/src/components/data-table/DataTableFacetedFilter.vue +97 -0
- package/src/components/data-table/DataTablePagination.vue +103 -0
- package/src/components/data-table/DataTableViewOptions.vue +69 -0
- package/src/components/data-table/features.ts +87 -0
- package/src/components/data-table/index.ts +27 -0
- package/src/components/data-table/pagination-adapter.ts +67 -0
- package/src/components/data-table/selection-column.ts +48 -0
- package/src/components/data-table/types.ts +36 -0
- package/src/components/data-view/DataView.vue +136 -0
- package/src/components/data-view/index.ts +1 -0
- package/src/components/date-picker/DatePicker.vue +117 -0
- package/src/components/date-picker/DateRangePicker.vue +122 -0
- package/src/components/date-picker/index.ts +2 -0
- package/src/components/deferred/Deferred.vue +80 -0
- package/src/components/deferred/index.ts +1 -0
- package/src/components/dialog/Dialog.vue +15 -0
- package/src/components/dialog/DialogClose.vue +12 -0
- package/src/components/dialog/DialogContent.vue +46 -0
- package/src/components/dialog/DialogDescription.vue +19 -0
- package/src/components/dialog/DialogFooter.vue +12 -0
- package/src/components/dialog/DialogHeader.vue +12 -0
- package/src/components/dialog/DialogTitle.vue +19 -0
- package/src/components/dialog/DialogTrigger.vue +12 -0
- package/src/components/dialog/index.ts +10 -0
- package/src/components/doc-example/DocExample.vue +41 -0
- package/src/components/doc-example/index.ts +1 -0
- package/src/components/doc-text/DocText.vue +64 -0
- package/src/components/doc-text/index.ts +1 -0
- package/src/components/dropdown-menu/DropdownMenu.vue +15 -0
- package/src/components/dropdown-menu/DropdownMenuCheckboxItem.vue +33 -0
- package/src/components/dropdown-menu/DropdownMenuContent.vue +36 -0
- package/src/components/dropdown-menu/DropdownMenuGroup.vue +12 -0
- package/src/components/dropdown-menu/DropdownMenuItem.vue +32 -0
- package/src/components/dropdown-menu/DropdownMenuLabel.vue +24 -0
- package/src/components/dropdown-menu/DropdownMenuRadioGroup.vue +15 -0
- package/src/components/dropdown-menu/DropdownMenuRadioItem.vue +33 -0
- package/src/components/dropdown-menu/DropdownMenuSeparator.vue +19 -0
- package/src/components/dropdown-menu/DropdownMenuShortcut.vue +13 -0
- package/src/components/dropdown-menu/DropdownMenuSub.vue +15 -0
- package/src/components/dropdown-menu/DropdownMenuSubContent.vue +29 -0
- package/src/components/dropdown-menu/DropdownMenuSubTrigger.vue +26 -0
- package/src/components/dropdown-menu/DropdownMenuTrigger.vue +12 -0
- package/src/components/dropdown-menu/index.ts +14 -0
- package/src/components/editable/Editable.vue +41 -0
- package/src/components/editable/EditableArea.vue +22 -0
- package/src/components/editable/EditableCancelTrigger.vue +40 -0
- package/src/components/editable/EditableEditTrigger.vue +40 -0
- package/src/components/editable/EditableInput.vue +28 -0
- package/src/components/editable/EditablePreview.vue +34 -0
- package/src/components/editable/EditableSubmitTrigger.vue +40 -0
- package/src/components/editable/index.ts +17 -0
- package/src/components/empty/Empty.vue +17 -0
- package/src/components/empty/EmptyActions.vue +14 -0
- package/src/components/empty/EmptyDescription.vue +12 -0
- package/src/components/empty/EmptyMedia.vue +16 -0
- package/src/components/empty/EmptyTitle.vue +17 -0
- package/src/components/empty/index.ts +7 -0
- package/src/components/field/Field.vue +22 -0
- package/src/components/field/FieldDescription.vue +20 -0
- package/src/components/field/FieldGroup.vue +22 -0
- package/src/components/field/FieldLabel.vue +27 -0
- package/src/components/field/FieldSeparator.vue +28 -0
- package/src/components/field/index.ts +7 -0
- package/src/components/fieldset/Fieldset.vue +126 -0
- package/src/components/fieldset/index.ts +1 -0
- package/src/components/file-upload/FileUpload.vue +149 -0
- package/src/components/file-upload/index.ts +8 -0
- package/src/components/float-label/FloatLabel.vue +26 -0
- package/src/components/float-label/index.ts +3 -0
- package/src/components/form/Form.vue +126 -0
- package/src/components/form/FormDescription.vue +12 -0
- package/src/components/form/FormField.vue +127 -0
- package/src/components/form/FormItem.vue +12 -0
- package/src/components/form/FormLabel.vue +14 -0
- package/src/components/form/FormMessage.vue +31 -0
- package/src/components/form/context.ts +54 -0
- package/src/components/form/errors.ts +6 -0
- package/src/components/form/index.ts +7 -0
- package/src/components/form/types.ts +55 -0
- package/src/components/hover-card/HoverCard.vue +27 -0
- package/src/components/hover-card/HoverCardContent.vue +36 -0
- package/src/components/hover-card/HoverCardTrigger.vue +12 -0
- package/src/components/hover-card/index.ts +3 -0
- package/src/components/ifta-label/IftaLabel.vue +26 -0
- package/src/components/ifta-label/index.ts +1 -0
- package/src/components/index.ts +89 -0
- package/src/components/input/Input.vue +87 -0
- package/src/components/input/index.ts +1 -0
- package/src/components/input-color/ColorArea.vue +36 -0
- package/src/components/input-color/ColorField.vue +32 -0
- package/src/components/input-color/ColorSlider.vue +31 -0
- package/src/components/input-color/InputColor.vue +65 -0
- package/src/components/input-color/index.ts +16 -0
- package/src/components/input-group/InputGroup.vue +26 -0
- package/src/components/input-group/InputGroupAddon.vue +32 -0
- package/src/components/input-group/InputGroupInput.vue +33 -0
- package/src/components/input-group/index.ts +17 -0
- package/src/components/input-number/InputNumber.vue +82 -0
- package/src/components/input-number/index.ts +1 -0
- package/src/components/input-otp/InputOtp.vue +186 -0
- package/src/components/input-otp/index.ts +1 -0
- package/src/components/input-password/InputPassword.vue +116 -0
- package/src/components/input-password/index.ts +5 -0
- package/src/components/input-tags/InputTags.vue +38 -0
- package/src/components/input-tags/InputTagsClear.vue +39 -0
- package/src/components/input-tags/InputTagsInput.vue +27 -0
- package/src/components/input-tags/InputTagsItem.vue +40 -0
- package/src/components/input-tags/InputTagsItemDelete.vue +32 -0
- package/src/components/input-tags/InputTagsItemText.vue +18 -0
- package/src/components/input-tags/index.ts +16 -0
- package/src/components/kbd/Kbd.vue +17 -0
- package/src/components/kbd/KbdGroup.vue +15 -0
- package/src/components/kbd/index.ts +4 -0
- package/src/components/label/Label.vue +23 -0
- package/src/components/label/index.ts +1 -0
- package/src/components/listbox/Listbox.vue +42 -0
- package/src/components/listbox/ListboxContent.vue +22 -0
- package/src/components/listbox/ListboxFilter.vue +34 -0
- package/src/components/listbox/ListboxGroup.vue +31 -0
- package/src/components/listbox/ListboxItem.vue +46 -0
- package/src/components/listbox/index.ts +19 -0
- package/src/components/mask/Mask.vue +205 -0
- package/src/components/mask/index.ts +15 -0
- package/src/components/menubar/Menubar.vue +26 -0
- package/src/components/menubar/MenubarCheckboxItem.vue +30 -0
- package/src/components/menubar/MenubarContent.vue +52 -0
- package/src/components/menubar/MenubarGroup.vue +12 -0
- package/src/components/menubar/MenubarItem.vue +32 -0
- package/src/components/menubar/MenubarLabel.vue +21 -0
- package/src/components/menubar/MenubarMenu.vue +12 -0
- package/src/components/menubar/MenubarRadioGroup.vue +15 -0
- package/src/components/menubar/MenubarRadioItem.vue +30 -0
- package/src/components/menubar/MenubarSeparator.vue +12 -0
- package/src/components/menubar/MenubarShortcut.vue +13 -0
- package/src/components/menubar/MenubarSub.vue +15 -0
- package/src/components/menubar/MenubarSubContent.vue +26 -0
- package/src/components/menubar/MenubarSubTrigger.vue +26 -0
- package/src/components/menubar/MenubarTrigger.vue +30 -0
- package/src/components/menubar/index.ts +29 -0
- package/src/components/navigation-menu/NavigationMenu.vue +43 -0
- package/src/components/navigation-menu/NavigationMenuContent.vue +63 -0
- package/src/components/navigation-menu/NavigationMenuIndicator.vue +31 -0
- package/src/components/navigation-menu/NavigationMenuItem.vue +20 -0
- package/src/components/navigation-menu/NavigationMenuLink.vue +34 -0
- package/src/components/navigation-menu/NavigationMenuList.vue +23 -0
- package/src/components/navigation-menu/NavigationMenuTrigger.vue +38 -0
- package/src/components/navigation-menu/NavigationMenuViewport.vue +34 -0
- package/src/components/navigation-menu/index.ts +18 -0
- package/src/components/order-list/OrderList.vue +168 -0
- package/src/components/order-list/SelectableList.vue +200 -0
- package/src/components/order-list/index.ts +1 -0
- package/src/components/pagination/Pagination.vue +133 -0
- package/src/components/pagination/index.ts +1 -0
- package/src/components/panel/Panel.vue +69 -0
- package/src/components/panel/index.ts +1 -0
- package/src/components/pick-list/PickList.vue +211 -0
- package/src/components/pick-list/index.ts +1 -0
- package/src/components/popover/Popover.vue +15 -0
- package/src/components/popover/PopoverAnchor.vue +12 -0
- package/src/components/popover/PopoverContent.vue +39 -0
- package/src/components/popover/PopoverTrigger.vue +12 -0
- package/src/components/popover/index.ts +4 -0
- package/src/components/progress/Progress.vue +39 -0
- package/src/components/progress/index.ts +1 -0
- package/src/components/props-table/PropsTable.vue +62 -0
- package/src/components/props-table/index.ts +2 -0
- package/src/components/radio-group/RadioGroup.vue +52 -0
- package/src/components/radio-group/RadioGroupItem.vue +80 -0
- package/src/components/radio-group/RadioGroupItemField.vue +128 -0
- package/src/components/radio-group/index.ts +21 -0
- package/src/components/rating/Rating.vue +70 -0
- package/src/components/rating/RatingItem.vue +26 -0
- package/src/components/rating/RatingItemIndicator.vue +28 -0
- package/src/components/rating/RatingStar.vue +16 -0
- package/src/components/rating/index.ts +13 -0
- package/src/components/scroll-area/ScrollArea.vue +52 -0
- package/src/components/scroll-area/index.ts +1 -0
- package/src/components/search-input/SearchInput.vue +46 -0
- package/src/components/search-input/index.ts +1 -0
- package/src/components/select/Select.vue +15 -0
- package/src/components/select/SelectContent.vue +67 -0
- package/src/components/select/SelectGroup.vue +20 -0
- package/src/components/select/SelectItem.vue +59 -0
- package/src/components/select/SelectLabel.vue +20 -0
- package/src/components/select/SelectSeparator.vue +18 -0
- package/src/components/select/SelectTrigger.vue +101 -0
- package/src/components/select/SelectValue.vue +46 -0
- package/src/components/select/index.ts +8 -0
- package/src/components/separator/Separator.vue +25 -0
- package/src/components/separator/index.ts +1 -0
- package/src/components/sheet/Sheet.vue +15 -0
- package/src/components/sheet/SheetClose.vue +12 -0
- package/src/components/sheet/SheetContent.vue +45 -0
- package/src/components/sheet/SheetDescription.vue +19 -0
- package/src/components/sheet/SheetFooter.vue +12 -0
- package/src/components/sheet/SheetHeader.vue +12 -0
- package/src/components/sheet/SheetTitle.vue +19 -0
- package/src/components/sheet/SheetTrigger.vue +12 -0
- package/src/components/sheet/index.ts +10 -0
- package/src/components/sidebar/Sidebar.vue +108 -0
- package/src/components/sidebar/SidebarContent.vue +19 -0
- package/src/components/sidebar/SidebarFooter.vue +19 -0
- package/src/components/sidebar/SidebarGroup.vue +19 -0
- package/src/components/sidebar/SidebarGroupAction.vue +28 -0
- package/src/components/sidebar/SidebarGroupContent.vue +19 -0
- package/src/components/sidebar/SidebarGroupLabel.vue +25 -0
- package/src/components/sidebar/SidebarHeader.vue +19 -0
- package/src/components/sidebar/SidebarInput.vue +15 -0
- package/src/components/sidebar/SidebarInset.vue +22 -0
- package/src/components/sidebar/SidebarMenu.vue +19 -0
- package/src/components/sidebar/SidebarMenuAction.vue +41 -0
- package/src/components/sidebar/SidebarMenuBadge.vue +24 -0
- package/src/components/sidebar/SidebarMenuButton.vue +94 -0
- package/src/components/sidebar/SidebarMenuItem.vue +19 -0
- package/src/components/sidebar/SidebarMenuSkeleton.vue +36 -0
- package/src/components/sidebar/SidebarMenuSub.vue +22 -0
- package/src/components/sidebar/SidebarMenuSubButton.vue +39 -0
- package/src/components/sidebar/SidebarMenuSubItem.vue +19 -0
- package/src/components/sidebar/SidebarProvider.vue +114 -0
- package/src/components/sidebar/SidebarRail.vue +37 -0
- package/src/components/sidebar/SidebarSeparator.vue +15 -0
- package/src/components/sidebar/SidebarTrigger.vue +27 -0
- package/src/components/sidebar/context.ts +39 -0
- package/src/components/sidebar/index.ts +34 -0
- package/src/components/skeleton/Skeleton.vue +10 -0
- package/src/components/skeleton/index.ts +1 -0
- package/src/components/skip-link/SkipLink.vue +45 -0
- package/src/components/skip-link/index.ts +1 -0
- package/src/components/slider/Slider.vue +57 -0
- package/src/components/slider/index.ts +3 -0
- package/src/components/speed-dial/SpeedDial.vue +362 -0
- package/src/components/speed-dial/index.ts +28 -0
- package/src/components/spinner/Spinner.vue +20 -0
- package/src/components/spinner/index.ts +1 -0
- package/src/components/splitter/Splitter.vue +24 -0
- package/src/components/splitter/SplitterHandle.vue +51 -0
- package/src/components/splitter/SplitterPanel.vue +30 -0
- package/src/components/splitter/index.ts +14 -0
- package/src/components/stepper/Stepper.vue +34 -0
- package/src/components/stepper/StepperItem.vue +113 -0
- package/src/components/stepper/index.ts +2 -0
- package/src/components/switch/Switch.vue +35 -0
- package/src/components/switch/index.ts +1 -0
- package/src/components/table/Table.vue +24 -0
- package/src/components/table/TableBody.vue +12 -0
- package/src/components/table/TableCell.vue +12 -0
- package/src/components/table/TableEmpty.vue +20 -0
- package/src/components/table/TableHead.vue +17 -0
- package/src/components/table/TableHeader.vue +12 -0
- package/src/components/table/TableRow.vue +19 -0
- package/src/components/table/index.ts +7 -0
- package/src/components/tabs/Tabs.vue +23 -0
- package/src/components/tabs/TabsContent.vue +23 -0
- package/src/components/tabs/TabsList.vue +26 -0
- package/src/components/tabs/TabsTrigger.vue +30 -0
- package/src/components/tabs/index.ts +4 -0
- package/src/components/textarea/Textarea.vue +25 -0
- package/src/components/textarea/index.ts +1 -0
- package/src/components/theme-controls/LocaleMenu.vue +95 -0
- package/src/components/theme-controls/PaletteMenu.vue +155 -0
- package/src/components/theme-controls/ThemeToggle.vue +21 -0
- package/src/components/theme-controls/index.ts +15 -0
- package/src/components/timeline/Timeline.vue +20 -0
- package/src/components/timeline/TimelineItem.vue +68 -0
- package/src/components/timeline/index.ts +15 -0
- package/src/components/toast/Toaster.vue +62 -0
- package/src/components/toast/index.ts +4 -0
- package/src/components/toast/toast.ts +57 -0
- package/src/components/toggle/Toggle.vue +32 -0
- package/src/components/toggle/ToggleGroup.vue +56 -0
- package/src/components/toggle/ToggleGroupItem.vue +33 -0
- package/src/components/toggle/index.ts +18 -0
- package/src/components/token-table/TokenTable.vue +67 -0
- package/src/components/token-table/index.ts +2 -0
- package/src/components/toolbar/Toolbar.vue +34 -0
- package/src/components/toolbar/ToolbarButton.vue +33 -0
- package/src/components/toolbar/ToolbarSeparator.vue +21 -0
- package/src/components/toolbar/index.ts +3 -0
- package/src/components/tooltip/Tooltip.vue +15 -0
- package/src/components/tooltip/TooltipContent.vue +38 -0
- package/src/components/tooltip/TooltipProvider.vue +16 -0
- package/src/components/tooltip/TooltipTrigger.vue +12 -0
- package/src/components/tooltip/index.ts +4 -0
- package/src/components/tree/Tree.vue +53 -0
- package/src/components/tree/TreeItem.vue +59 -0
- package/src/components/tree/index.ts +21 -0
- package/src/components/tree-select/TreeSelect.vue +141 -0
- package/src/components/tree-select/index.ts +1 -0
- package/src/components/tree-table/TreeTable.vue +302 -0
- package/src/components/tree-table/features.ts +49 -0
- package/src/components/tree-table/index.ts +3 -0
- package/src/components/video-player/VideoPlayer.vue +472 -0
- package/src/components/video-player/index.ts +20 -0
- package/src/composables/index.ts +15 -0
- package/src/composables/useBase.ts +32 -0
- package/src/composables/useChartPalette.ts +33 -0
- package/src/composables/useColorMode.ts +29 -0
- package/src/composables/useConfirm.ts +81 -0
- package/src/composables/useDelayedFlag.ts +62 -0
- package/src/composables/useI18n.ts +107 -0
- package/src/composables/useIsMobile.ts +34 -0
- package/src/composables/useMenuAccent.ts +32 -0
- package/src/composables/useMenuAppearance.ts +31 -0
- package/src/composables/useMenuColor.ts +31 -0
- package/src/composables/usePalette.ts +30 -0
- package/src/composables/useStyle.ts +35 -0
- package/src/composables/useSurface.ts +30 -0
- package/src/composables/useTableQuery.ts +73 -0
- package/src/composables/useThemeController.ts +48 -0
- package/src/i18n/README.md +68 -0
- package/src/i18n/controller.ts +233 -0
- package/src/i18n/dictionary.ts +43 -0
- package/src/i18n/index.ts +34 -0
- package/src/i18n/registry.ts +64 -0
- package/src/i18n/ui/en/ui.json +114 -0
- package/src/i18n/ui/en/zod.json +16 -0
- package/src/i18n/ui/index.ts +48 -0
- package/src/i18n/ui/vi/ui.json +114 -0
- package/src/i18n/ui/vi/zod.json +16 -0
- package/src/lib/date.ts +24 -0
- package/src/lib/focus.ts +12 -0
- package/src/lib/icons.ts +345 -0
- package/src/lib/menu-styles.ts +16 -0
- package/src/lib/menu.ts +20 -0
- package/src/lib/platform.ts +5 -0
- package/src/lib/types.ts +6 -0
- package/src/lib/utils.ts +9 -0
- package/src/lib/zod-messages.ts +127 -0
- package/src/styles/chart.css +30 -0
- package/src/styles/index.css +18 -0
- package/src/variants/README.md +55 -0
- package/src/variants/components/accordion.ts +71 -0
- package/src/variants/components/alert.ts +20 -0
- package/src/variants/components/badge.ts +76 -0
- package/src/variants/components/button-group.ts +136 -0
- package/src/variants/components/button.ts +160 -0
- package/src/variants/components/checkbox.ts +67 -0
- package/src/variants/components/chip.ts +51 -0
- package/src/variants/components/code-block.ts +22 -0
- package/src/variants/components/dialog.ts +28 -0
- package/src/variants/components/empty.ts +60 -0
- package/src/variants/components/field.ts +35 -0
- package/src/variants/components/float-label.ts +95 -0
- package/src/variants/components/input-group.ts +73 -0
- package/src/variants/components/input-password.ts +68 -0
- package/src/variants/components/kbd.ts +47 -0
- package/src/variants/components/picker-trigger.ts +30 -0
- package/src/variants/components/radio-group.ts +63 -0
- package/src/variants/components/sheet.ts +23 -0
- package/src/variants/components/sidebar.ts +33 -0
- package/src/variants/components/slider.ts +49 -0
- package/src/variants/components/timeline.ts +45 -0
- package/src/variants/components/toggle.ts +58 -0
- package/src/variants/index.ts +35 -0
- package/src/variants/lib/chart/polar.ts +139 -0
- package/src/variants/lib/chart/tooltip.ts +101 -0
- package/src/variants/lib/chart/types.ts +172 -0
- package/src/variants/lib/chart/xy-label.ts +42 -0
- package/src/variants/lib/focus.ts +66 -0
- package/src/variants/lib/form-errors.ts +59 -0
- package/src/variants/lib/highlight.ts +548 -0
- package/src/variants/lib/list-move.ts +63 -0
- package/src/variants/lib/mask.ts +106 -0
- package/src/variants/lib/media.ts +56 -0
- package/src/variants/lib/menu-styles.ts +71 -0
- package/src/variants/lib/platform.ts +68 -0
- package/src/variants/lib/tree.ts +119 -0
- package/src/variants/lib/upload.ts +58 -0
- package/src/variants/lib/utils.ts +11 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { ClassProps } from '../../lib/types'
|
|
3
|
+
import { cn } from '../../lib/utils'
|
|
4
|
+
|
|
5
|
+
const props = defineProps<ClassProps>()
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<div :class="cn('flex shrink-0 items-center gap-2', props.class)">
|
|
10
|
+
<slot />
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { ClassProps } from '../../lib/types'
|
|
3
|
+
import { cn } from '../../lib/utils'
|
|
4
|
+
|
|
5
|
+
const props = defineProps<ClassProps>()
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<div :class="cn('px-6 py-4', props.class)">
|
|
10
|
+
<slot />
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { ClassProps } from '../../lib/types'
|
|
3
|
+
import { cn } from '../../lib/utils'
|
|
4
|
+
|
|
5
|
+
const props = defineProps<ClassProps>()
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<p :class="cn('text-sm text-muted-foreground', props.class)">
|
|
10
|
+
<slot />
|
|
11
|
+
</p>
|
|
12
|
+
</template>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { ClassProps } from '../../lib/types'
|
|
3
|
+
import { cn } from '../../lib/utils'
|
|
4
|
+
|
|
5
|
+
const props = defineProps<ClassProps>()
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<div :class="cn('flex items-center gap-2 border-t border-border px-6 py-4', props.class)">
|
|
10
|
+
<slot />
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { ClassProps } from '../../lib/types'
|
|
3
|
+
import { cn } from '../../lib/utils'
|
|
4
|
+
|
|
5
|
+
const props = defineProps<ClassProps>()
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<div :class="cn('flex items-start justify-between gap-4 border-b border-border px-6 py-4', props.class)">
|
|
10
|
+
<div class="flex flex-col gap-1">
|
|
11
|
+
<slot />
|
|
12
|
+
</div>
|
|
13
|
+
<slot name="action" />
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { ClassProps } from '../../lib/types'
|
|
3
|
+
import { cn } from '../../lib/utils'
|
|
4
|
+
|
|
5
|
+
const props = defineProps<ClassProps>()
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<h3 :class="cn('text-base leading-none font-semibold tracking-tight', props.class)">
|
|
10
|
+
<slot />
|
|
11
|
+
</h3>
|
|
12
|
+
</template>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { default as Card } from './Card.vue'
|
|
2
|
+
export { default as CardAction } from './CardAction.vue'
|
|
3
|
+
export { default as CardContent } from './CardContent.vue'
|
|
4
|
+
export { default as CardDescription } from './CardDescription.vue'
|
|
5
|
+
export { default as CardFooter } from './CardFooter.vue'
|
|
6
|
+
export { default as CardHeader } from './CardHeader.vue'
|
|
7
|
+
export { default as CardTitle } from './CardTitle.vue'
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { ClassProps } from '../../lib/types'
|
|
3
|
+
import type {
|
|
4
|
+
CarouselOrientation,
|
|
5
|
+
EmblaCarouselType,
|
|
6
|
+
EmblaOptionsType,
|
|
7
|
+
EmblaPluginType,
|
|
8
|
+
} from './index'
|
|
9
|
+
import emblaCarouselVue from 'embla-carousel-vue'
|
|
10
|
+
import { computed, ref, watch } from 'vue'
|
|
11
|
+
import { useI18n } from '../../composables/useI18n'
|
|
12
|
+
import { cn } from '../../lib/utils'
|
|
13
|
+
import { provideCarouselContext } from './index'
|
|
14
|
+
|
|
15
|
+
const props = withDefaults(
|
|
16
|
+
defineProps<ClassProps & {
|
|
17
|
+
opts?: EmblaOptionsType
|
|
18
|
+
plugins?: EmblaPluginType[]
|
|
19
|
+
orientation?: CarouselOrientation
|
|
20
|
+
/**
|
|
21
|
+
* Tên trợ năng của cả vùng. Bỏ trống thì lấy chuỗi của thư viện — đừng đặt
|
|
22
|
+
* default ở đây, chuỗi trong `withDefaults` đóng băng ở một ngôn ngữ.
|
|
23
|
+
*/
|
|
24
|
+
label?: string
|
|
25
|
+
}>(),
|
|
26
|
+
{ orientation: 'horizontal' },
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
const emits = defineEmits<{
|
|
30
|
+
/** Bắn một lần khi embla sẵn sàng, để bên gọi giữ lấy api nếu cần. */
|
|
31
|
+
'init-api': [api: EmblaCarouselType]
|
|
32
|
+
}>()
|
|
33
|
+
|
|
34
|
+
const { t } = useI18n()
|
|
35
|
+
|
|
36
|
+
const orientation = computed(() => props.orientation)
|
|
37
|
+
|
|
38
|
+
const [carouselRef, api] = emblaCarouselVue(
|
|
39
|
+
computed(() => ({ ...props.opts, axis: props.orientation === 'vertical' ? 'y' : 'x' })),
|
|
40
|
+
computed(() => props.plugins ?? []),
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
const canScrollPrev = ref(false)
|
|
44
|
+
const canScrollNext = ref(false)
|
|
45
|
+
const selectedIndex = ref(0)
|
|
46
|
+
const scrollSnaps = ref<number[]>([])
|
|
47
|
+
const version = ref(0)
|
|
48
|
+
|
|
49
|
+
function readState(embla: EmblaCarouselType): void {
|
|
50
|
+
canScrollPrev.value = embla.canScrollPrev()
|
|
51
|
+
canScrollNext.value = embla.canScrollNext()
|
|
52
|
+
selectedIndex.value = embla.selectedScrollSnap()
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function readLayout(embla: EmblaCarouselType): void {
|
|
56
|
+
scrollSnaps.value = embla.scrollSnapList()
|
|
57
|
+
version.value += 1
|
|
58
|
+
readState(embla)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
watch(api, (embla, _old, onCleanup) => {
|
|
62
|
+
if (embla === undefined)
|
|
63
|
+
return
|
|
64
|
+
|
|
65
|
+
readLayout(embla)
|
|
66
|
+
emits('init-api', embla)
|
|
67
|
+
|
|
68
|
+
const onSelect = (): void => readState(embla)
|
|
69
|
+
const onReInit = (): void => readLayout(embla)
|
|
70
|
+
embla.on('select', onSelect).on('reInit', onReInit)
|
|
71
|
+
|
|
72
|
+
onCleanup(() => {
|
|
73
|
+
embla.off('select', onSelect).off('reInit', onReInit)
|
|
74
|
+
})
|
|
75
|
+
}, { immediate: true })
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Vùng `overflow-hidden` VẪN cuộn được bằng chương trình.
|
|
79
|
+
*
|
|
80
|
+
* Đưa focus vào một link nằm trong slide đang khuất là trình duyệt tự cuộn vùng
|
|
81
|
+
* đó để lộ phần tử ra — nhưng embla đặt vị trí bằng `transform`, nó không biết
|
|
82
|
+
* gì về `scrollLeft`. Cả băng lệch đi một đoạn và không bao giờ trở lại, kể cả
|
|
83
|
+
* khi bấm nút mũi tên. Không lỗi, không cảnh báo.
|
|
84
|
+
*
|
|
85
|
+
* Trả nó về 0 ngay khi xảy ra. Đây là việc của mình chứ không phải của embla:
|
|
86
|
+
* `overflow-hidden` là do `CarouselContent` khai, và chính `carouselRef` là
|
|
87
|
+
* element mang nó.
|
|
88
|
+
*/
|
|
89
|
+
function resetNativeScroll(event: Event): void {
|
|
90
|
+
const el = event.currentTarget as HTMLElement
|
|
91
|
+
if (el.scrollLeft !== 0)
|
|
92
|
+
el.scrollLeft = 0
|
|
93
|
+
if (el.scrollTop !== 0)
|
|
94
|
+
el.scrollTop = 0
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
watch(carouselRef, (el, previous) => {
|
|
98
|
+
previous?.removeEventListener('scroll', resetNativeScroll)
|
|
99
|
+
el?.addEventListener('scroll', resetNativeScroll)
|
|
100
|
+
}, { immediate: true })
|
|
101
|
+
|
|
102
|
+
function scrollPrev(): void {
|
|
103
|
+
api.value?.scrollPrev()
|
|
104
|
+
}
|
|
105
|
+
function scrollNext(): void {
|
|
106
|
+
api.value?.scrollNext()
|
|
107
|
+
}
|
|
108
|
+
function scrollTo(index: number): void {
|
|
109
|
+
api.value?.scrollTo(index)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function onKeydown(event: KeyboardEvent): void {
|
|
113
|
+
const back = props.orientation === 'vertical' ? 'ArrowUp' : 'ArrowLeft'
|
|
114
|
+
const forward = props.orientation === 'vertical' ? 'ArrowDown' : 'ArrowRight'
|
|
115
|
+
|
|
116
|
+
if (event.key !== back && event.key !== forward)
|
|
117
|
+
return
|
|
118
|
+
|
|
119
|
+
// Chỉ nhận phím khi nó không thuộc về một control bên trong slide, nếu không
|
|
120
|
+
// mũi tên trong một ô nhập sẽ mất tác dụng.
|
|
121
|
+
const target = event.target as HTMLElement | null
|
|
122
|
+
if (target !== null && target.closest('input, textarea, select, [contenteditable]') !== null)
|
|
123
|
+
return
|
|
124
|
+
|
|
125
|
+
event.preventDefault()
|
|
126
|
+
if (event.key === back)
|
|
127
|
+
scrollPrev()
|
|
128
|
+
else
|
|
129
|
+
scrollNext()
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
provideCarouselContext({
|
|
133
|
+
carouselRef,
|
|
134
|
+
api,
|
|
135
|
+
orientation,
|
|
136
|
+
canScrollPrev,
|
|
137
|
+
canScrollNext,
|
|
138
|
+
selectedIndex,
|
|
139
|
+
scrollSnaps,
|
|
140
|
+
scrollPrev,
|
|
141
|
+
scrollNext,
|
|
142
|
+
scrollTo,
|
|
143
|
+
version,
|
|
144
|
+
})
|
|
145
|
+
|
|
146
|
+
defineExpose({ scrollPrev, scrollNext, scrollTo })
|
|
147
|
+
</script>
|
|
148
|
+
|
|
149
|
+
<template>
|
|
150
|
+
<!--
|
|
151
|
+
`aria-roledescription` được ĐỌC NGUYÊN VĂN cho người dùng, nên nó phải đi
|
|
152
|
+
qua i18n như mọi chuỗi nhìn thấy được — để nguyên "carousel" là một từ tiếng
|
|
153
|
+
Anh chen vào giữa một câu tiếng Việt.
|
|
154
|
+
-->
|
|
155
|
+
<section
|
|
156
|
+
role="region"
|
|
157
|
+
:aria-roledescription="t('ui.carousel.roleDescription')"
|
|
158
|
+
:aria-label="props.label ?? t('ui.carousel.label')"
|
|
159
|
+
:class="cn('relative', props.class)"
|
|
160
|
+
@keydown="onKeydown"
|
|
161
|
+
>
|
|
162
|
+
<slot />
|
|
163
|
+
</section>
|
|
164
|
+
</template>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { ComponentPublicInstance } from 'vue'
|
|
3
|
+
import type { ClassProps } from '../../lib/types'
|
|
4
|
+
import { cn } from '../../lib/utils'
|
|
5
|
+
import { injectCarouselContext } from './index'
|
|
6
|
+
|
|
7
|
+
const props = defineProps<ClassProps>()
|
|
8
|
+
|
|
9
|
+
const { carouselRef, orientation } = injectCarouselContext()
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Đặt element cho embla.
|
|
13
|
+
*
|
|
14
|
+
* Viết thẳng trong template thì dấu `|` của kiểu union bị eslint-plugin-vue
|
|
15
|
+
* đọc thành filter của Vue 2 và báo lỗi. Kiểu thuộc về script, không thuộc
|
|
16
|
+
* về template.
|
|
17
|
+
*/
|
|
18
|
+
function setViewport(el: Element | ComponentPublicInstance | null): void {
|
|
19
|
+
carouselRef.value = (el as HTMLElement | null) ?? undefined
|
|
20
|
+
}
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<template>
|
|
24
|
+
<!--
|
|
25
|
+
Hai lớp, và không gộp được: embla đo lớp NGOÀI làm khung nhìn rồi dịch lớp
|
|
26
|
+
TRONG bằng `transform`. Đưa `overflow-hidden` và `flex` vào cùng một thẻ là
|
|
27
|
+
khung nhìn tự dịch theo chính nó.
|
|
28
|
+
-->
|
|
29
|
+
<div :ref="setViewport" class="overflow-hidden">
|
|
30
|
+
<div
|
|
31
|
+
:class="cn(
|
|
32
|
+
'flex',
|
|
33
|
+
// Khoảng cách giữa các slide làm bằng padding của slide cộng margin âm
|
|
34
|
+
// ở đây, chứ không bằng `gap`: `gap` cộng vào bề rộng khung nhìn nên
|
|
35
|
+
// `basis-1/3` không còn ra đúng một phần ba, và mép cuối hụt một nhịp.
|
|
36
|
+
orientation === 'vertical' ? '-mt-4 flex-col' : '-ml-4',
|
|
37
|
+
props.class,
|
|
38
|
+
)"
|
|
39
|
+
>
|
|
40
|
+
<slot />
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
</template>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { ClassProps } from '../../lib/types'
|
|
3
|
+
import { useI18n } from '../../composables/useI18n'
|
|
4
|
+
import { focusRing } from '../../lib/focus'
|
|
5
|
+
import { cn } from '../../lib/utils'
|
|
6
|
+
import { injectCarouselContext } from './index'
|
|
7
|
+
|
|
8
|
+
const props = defineProps<ClassProps>()
|
|
9
|
+
|
|
10
|
+
const { scrollSnaps, selectedIndex, scrollTo } = injectCarouselContext()
|
|
11
|
+
const { t } = useI18n()
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<!--
|
|
16
|
+
Một chấm cho mỗi MỐC DỪNG, không phải cho mỗi slide.
|
|
17
|
+
|
|
18
|
+
Với `slidesToScroll` lớn hơn 1, hoặc khi mấy slide cuối vừa hết vào một
|
|
19
|
+
khung nhìn, số mốc dừng ÍT HƠN số slide. Đếm theo slide thì mấy chấm cuối
|
|
20
|
+
không bao giờ sáng lên được — bấm vào chúng đưa tới đúng cái mốc mà chấm
|
|
21
|
+
trước đó cũng trỏ tới.
|
|
22
|
+
-->
|
|
23
|
+
<div
|
|
24
|
+
:class="cn('flex items-center justify-center gap-2', props.class)"
|
|
25
|
+
:aria-label="t('ui.carousel.dots')"
|
|
26
|
+
role="group"
|
|
27
|
+
>
|
|
28
|
+
<button
|
|
29
|
+
v-for="(_snap, index) in scrollSnaps"
|
|
30
|
+
:key="index"
|
|
31
|
+
type="button"
|
|
32
|
+
:aria-label="t('ui.carousel.goTo', { index: index + 1 })"
|
|
33
|
+
:aria-current="index === selectedIndex ? 'true' : undefined"
|
|
34
|
+
:class="cn(
|
|
35
|
+
'size-2 rounded-full transition-colors',
|
|
36
|
+
focusRing,
|
|
37
|
+
index === selectedIndex ? 'bg-primary' : 'bg-muted-foreground/35 hover:bg-muted-foreground/60',
|
|
38
|
+
)"
|
|
39
|
+
@click="scrollTo(index)"
|
|
40
|
+
/>
|
|
41
|
+
</div>
|
|
42
|
+
</template>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { ClassProps } from '../../lib/types'
|
|
3
|
+
import { computed, ref } from 'vue'
|
|
4
|
+
import { useI18n } from '../../composables/useI18n'
|
|
5
|
+
import { cn } from '../../lib/utils'
|
|
6
|
+
import { injectCarouselContext } from './index'
|
|
7
|
+
|
|
8
|
+
const props = defineProps<ClassProps>()
|
|
9
|
+
|
|
10
|
+
const { api, orientation, version } = injectCarouselContext()
|
|
11
|
+
const { t } = useI18n()
|
|
12
|
+
|
|
13
|
+
const el = ref<HTMLElement>()
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Tự tra chỉ số của mình trong danh sách slide của embla.
|
|
17
|
+
*
|
|
18
|
+
* Không đếm bằng thứ tự mount: `v-for` đảo chỗ hay chèn giữa là số sai mà không
|
|
19
|
+
* có gì báo. `slideNodes()` chính là thứ tự embla đang dùng để cuộn, nên hỏi nó
|
|
20
|
+
* là hỏi đúng nguồn — chỉ cần một `version` để biết lúc nào phải hỏi lại, vì
|
|
21
|
+
* hàm đó không phải nguồn reactive.
|
|
22
|
+
*/
|
|
23
|
+
const position = computed(() => {
|
|
24
|
+
void version.value
|
|
25
|
+
const nodes = api.value?.slideNodes()
|
|
26
|
+
if (nodes === undefined || el.value === undefined)
|
|
27
|
+
return { index: -1, total: 0 }
|
|
28
|
+
return { index: nodes.indexOf(el.value), total: nodes.length }
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
const slideLabel = computed(() =>
|
|
32
|
+
position.value.index < 0
|
|
33
|
+
? undefined
|
|
34
|
+
: t('ui.carousel.slideLabel', {
|
|
35
|
+
index: position.value.index + 1,
|
|
36
|
+
total: position.value.total,
|
|
37
|
+
}),
|
|
38
|
+
)
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<template>
|
|
42
|
+
<div
|
|
43
|
+
ref="el"
|
|
44
|
+
role="group"
|
|
45
|
+
:aria-roledescription="t('ui.carousel.slideRoleDescription')"
|
|
46
|
+
:aria-label="slideLabel"
|
|
47
|
+
:class="cn(
|
|
48
|
+
// `min-w-0` là bắt buộc: mặc định flex item không co xuống dưới
|
|
49
|
+
// min-content, nên một slide có chữ dài sẽ tự nong ra rộng hơn phần
|
|
50
|
+
// `basis` được chia và cả băng lệch dần.
|
|
51
|
+
'min-w-0 shrink-0 grow-0 basis-full',
|
|
52
|
+
orientation === 'vertical' ? 'pt-4' : 'pl-4',
|
|
53
|
+
props.class,
|
|
54
|
+
)"
|
|
55
|
+
>
|
|
56
|
+
<slot />
|
|
57
|
+
</div>
|
|
58
|
+
</template>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { ClassProps } from '../../lib/types'
|
|
3
|
+
import type { ButtonVariants } from '../button'
|
|
4
|
+
import { computed } from 'vue'
|
|
5
|
+
import { useI18n } from '../../composables/useI18n'
|
|
6
|
+
import { ArrowDown, ArrowRight } from '../../lib/icons'
|
|
7
|
+
import { cn } from '../../lib/utils'
|
|
8
|
+
import Button from '../button/Button.vue'
|
|
9
|
+
import { injectCarouselContext } from './index'
|
|
10
|
+
|
|
11
|
+
const props = withDefaults(
|
|
12
|
+
defineProps<ClassProps & {
|
|
13
|
+
variant?: ButtonVariants['variant']
|
|
14
|
+
size?: ButtonVariants['size']
|
|
15
|
+
label?: string
|
|
16
|
+
}>(),
|
|
17
|
+
{ variant: 'outline', size: 'icon' },
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
const { orientation, canScrollNext, scrollNext } = injectCarouselContext()
|
|
21
|
+
const { t } = useI18n()
|
|
22
|
+
|
|
23
|
+
const buttonLabel = computed(() => props.label ?? t('ui.carousel.next'))
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<template>
|
|
27
|
+
<Button
|
|
28
|
+
type="button"
|
|
29
|
+
:variant="props.variant"
|
|
30
|
+
:size="props.size"
|
|
31
|
+
:disabled="!canScrollNext"
|
|
32
|
+
:aria-label="buttonLabel"
|
|
33
|
+
:class="cn(
|
|
34
|
+
'absolute rounded-full',
|
|
35
|
+
orientation === 'vertical'
|
|
36
|
+
? '-bottom-12 left-1/2 -translate-x-1/2'
|
|
37
|
+
: '-right-12 top-1/2 -translate-y-1/2',
|
|
38
|
+
props.class,
|
|
39
|
+
)"
|
|
40
|
+
@click="scrollNext"
|
|
41
|
+
>
|
|
42
|
+
<ArrowDown v-if="orientation === 'vertical'" aria-hidden="true" />
|
|
43
|
+
<ArrowRight v-else aria-hidden="true" />
|
|
44
|
+
</Button>
|
|
45
|
+
</template>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { ClassProps } from '../../lib/types'
|
|
3
|
+
import type { ButtonVariants } from '../button'
|
|
4
|
+
import { computed } from 'vue'
|
|
5
|
+
import { useI18n } from '../../composables/useI18n'
|
|
6
|
+
import { ArrowLeft, ArrowUp } from '../../lib/icons'
|
|
7
|
+
import { cn } from '../../lib/utils'
|
|
8
|
+
import Button from '../button/Button.vue'
|
|
9
|
+
import { injectCarouselContext } from './index'
|
|
10
|
+
|
|
11
|
+
const props = withDefaults(
|
|
12
|
+
defineProps<ClassProps & {
|
|
13
|
+
variant?: ButtonVariants['variant']
|
|
14
|
+
size?: ButtonVariants['size']
|
|
15
|
+
label?: string
|
|
16
|
+
}>(),
|
|
17
|
+
{ variant: 'outline', size: 'icon' },
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
const { orientation, canScrollPrev, scrollPrev } = injectCarouselContext()
|
|
21
|
+
const { t } = useI18n()
|
|
22
|
+
|
|
23
|
+
const buttonLabel = computed(() => props.label ?? t('ui.carousel.previous'))
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<template>
|
|
27
|
+
<Button
|
|
28
|
+
type="button"
|
|
29
|
+
:variant="props.variant"
|
|
30
|
+
:size="props.size"
|
|
31
|
+
:disabled="!canScrollPrev"
|
|
32
|
+
:aria-label="buttonLabel"
|
|
33
|
+
:class="cn(
|
|
34
|
+
'absolute rounded-full',
|
|
35
|
+
orientation === 'vertical'
|
|
36
|
+
? '-top-12 left-1/2 -translate-x-1/2'
|
|
37
|
+
: '-left-12 top-1/2 -translate-y-1/2',
|
|
38
|
+
props.class,
|
|
39
|
+
)"
|
|
40
|
+
@click="scrollPrev"
|
|
41
|
+
>
|
|
42
|
+
<ArrowUp v-if="orientation === 'vertical'" aria-hidden="true" />
|
|
43
|
+
<ArrowLeft v-else aria-hidden="true" />
|
|
44
|
+
</Button>
|
|
45
|
+
</template>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
EmblaCarouselType,
|
|
3
|
+
EmblaOptionsType,
|
|
4
|
+
EmblaPluginType,
|
|
5
|
+
} from 'embla-carousel'
|
|
6
|
+
import type { ComputedRef, Ref } from 'vue'
|
|
7
|
+
import { createContext } from 'reka-ui'
|
|
8
|
+
|
|
9
|
+
export { default as Carousel } from './Carousel.vue'
|
|
10
|
+
export { default as CarouselContent } from './CarouselContent.vue'
|
|
11
|
+
export { default as CarouselDots } from './CarouselDots.vue'
|
|
12
|
+
export { default as CarouselItem } from './CarouselItem.vue'
|
|
13
|
+
export { default as CarouselNext } from './CarouselNext.vue'
|
|
14
|
+
export { default as CarouselPrevious } from './CarouselPrevious.vue'
|
|
15
|
+
|
|
16
|
+
export type { EmblaCarouselType, EmblaOptionsType, EmblaPluginType }
|
|
17
|
+
|
|
18
|
+
export type CarouselOrientation = 'horizontal' | 'vertical'
|
|
19
|
+
|
|
20
|
+
export interface CarouselContext {
|
|
21
|
+
/** Gắn vào vùng `overflow-hidden`; embla đo và điều khiển từ đây. */
|
|
22
|
+
carouselRef: Ref<HTMLElement | undefined>
|
|
23
|
+
/** `undefined` cho tới khi embla khởi tạo xong — mọi chỗ đọc phải chịu được. */
|
|
24
|
+
api: Ref<EmblaCarouselType | undefined>
|
|
25
|
+
orientation: ComputedRef<CarouselOrientation>
|
|
26
|
+
canScrollPrev: Ref<boolean>
|
|
27
|
+
canScrollNext: Ref<boolean>
|
|
28
|
+
selectedIndex: Ref<number>
|
|
29
|
+
/** Một mốc dừng cho mỗi trang, không phải cho mỗi slide — xem `CarouselDots`. */
|
|
30
|
+
scrollSnaps: Ref<number[]>
|
|
31
|
+
scrollPrev: () => void
|
|
32
|
+
scrollNext: () => void
|
|
33
|
+
scrollTo: (index: number) => void
|
|
34
|
+
/**
|
|
35
|
+
* Tăng mỗi lần embla `init` hoặc `reInit`.
|
|
36
|
+
*
|
|
37
|
+
* `slideNodes()` là một hàm thường, không phải nguồn reactive, nên `CarouselItem`
|
|
38
|
+
* cần một thứ để phụ thuộc vào khi nó tự tra chỉ số của mình trong danh sách đó.
|
|
39
|
+
*/
|
|
40
|
+
version: Ref<number>
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const [injectCarouselContext, provideCarouselContext]
|
|
44
|
+
= createContext<CarouselContext>('Carousel')
|