@rimelight/ui 0.0.4 → 0.0.6
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/package.json +36 -6
- package/src/components/BlogPost.astro +181 -0
- package/src/components/DynamicShowcase.astro +681 -0
- package/src/components/ExtendedCarousel.astro +107 -0
- package/src/components/Head.astro +150 -0
- package/src/components/LanguageSwitcher.astro +128 -0
- package/src/components/ProjectPost.astro +183 -0
- package/src/components/RLHead.astro +3 -0
- package/src/components/ThemeToggle.astro +30 -42
- package/src/components/astro/RLAButton.astro +85 -0
- package/src/components/astro/RLAHeader.astro +75 -0
- package/src/components/vue/RLVButton.vue +90 -0
- package/src/components/vue/RLVHeader.vue +78 -0
- package/src/composables/index.ts +1 -0
- package/src/composables/useUi.ts +27 -0
- package/src/config/index.ts +0 -2
- package/src/config/site.config.ts +1 -1
- package/src/env.d.ts +9 -42
- package/src/integrations/index.ts +2 -0
- package/src/integrations/ui.ts +87 -0
- package/src/themes/button.theme.ts +361 -0
- package/src/themes/header.theme.ts +33 -0
- package/src/themes/index.ts +13 -0
- package/src/utils/index.ts +3 -2
- package/i18n-data.json +0 -186
- package/src/components/accordion/Accordion.astro +0 -257
- package/src/components/accordion/AccordionContent.astro +0 -34
- package/src/components/accordion/AccordionItem.astro +0 -29
- package/src/components/accordion/AccordionTrigger.astro +0 -33
- package/src/components/alert/Alert.astro +0 -34
- package/src/components/alert/AlertDescription.astro +0 -15
- package/src/components/alert/AlertTitle.astro +0 -17
- package/src/components/alert-dialog/AlertDialog.astro +0 -275
- package/src/components/alert-dialog/AlertDialogAction.astro +0 -46
- package/src/components/alert-dialog/AlertDialogCancel.astro +0 -46
- package/src/components/alert-dialog/AlertDialogContent.astro +0 -52
- package/src/components/alert-dialog/AlertDialogDescription.astro +0 -18
- package/src/components/alert-dialog/AlertDialogFooter.astro +0 -16
- package/src/components/alert-dialog/AlertDialogHeader.astro +0 -14
- package/src/components/alert-dialog/AlertDialogTitle.astro +0 -20
- package/src/components/alert-dialog/AlertDialogTrigger.astro +0 -47
- package/src/components/aspect-ratio/AspectRatio.astro +0 -32
- package/src/components/avatar/Avatar.astro +0 -29
- package/src/components/avatar/AvatarFallback.astro +0 -18
- package/src/components/avatar/AvatarImage.astro +0 -66
- package/src/components/badge/Badge.astro +0 -57
- package/src/components/breadcrumb/Breadcrumb.astro +0 -12
- package/src/components/breadcrumb/BreadcrumbEllipsis.astro +0 -29
- package/src/components/breadcrumb/BreadcrumbItem.astro +0 -15
- package/src/components/breadcrumb/BreadcrumbLink.astro +0 -24
- package/src/components/breadcrumb/BreadcrumbList.astro +0 -17
- package/src/components/breadcrumb/BreadcrumbPage.astro +0 -22
- package/src/components/breadcrumb/BreadcrumbSeparator.astro +0 -24
- package/src/components/button/Button.astro +0 -58
- package/src/components/button-group/ButtonGroup.astro +0 -64
- package/src/components/button-group/ButtonGroupSeparator.astro +0 -20
- package/src/components/button-group/ButtonGroupText.astro +0 -19
- package/src/components/card/Card.astro +0 -36
- package/src/components/card/CardAction.astro +0 -16
- package/src/components/card/CardContent.astro +0 -16
- package/src/components/card/CardDescription.astro +0 -16
- package/src/components/card/CardFooter.astro +0 -16
- package/src/components/card/CardHeader.astro +0 -19
- package/src/components/card/CardTitle.astro +0 -16
- package/src/components/carousel/Carousel.astro +0 -55
- package/src/components/carousel/CarouselContent.astro +0 -26
- package/src/components/carousel/CarouselItem.astro +0 -26
- package/src/components/carousel/CarouselNext.astro +0 -39
- package/src/components/carousel/CarouselPrevious.astro +0 -41
- package/src/components/carousel/carousel-script.ts +0 -188
- package/src/components/carousel/index.ts +0 -1
- package/src/components/checkbox/Checkbox.astro +0 -133
- package/src/components/collapsible/Collapsible.astro +0 -161
- package/src/components/collapsible/CollapsibleContent.astro +0 -22
- package/src/components/collapsible/CollapsibleTrigger.astro +0 -44
- package/src/components/dialog/Dialog.astro +0 -389
- package/src/components/dialog/DialogClose.astro +0 -35
- package/src/components/dialog/DialogContent.astro +0 -78
- package/src/components/dialog/DialogDescription.astro +0 -14
- package/src/components/dialog/DialogFooter.astro +0 -14
- package/src/components/dialog/DialogHeader.astro +0 -14
- package/src/components/dialog/DialogTitle.astro +0 -18
- package/src/components/dialog/DialogTrigger.astro +0 -47
- package/src/components/dropdown/Dropdown.astro +0 -604
- package/src/components/dropdown/DropdownContent.astro +0 -118
- package/src/components/dropdown/DropdownItem.astro +0 -48
- package/src/components/dropdown/DropdownLabel.astro +0 -29
- package/src/components/dropdown/DropdownSeparator.astro +0 -21
- package/src/components/dropdown/DropdownShortcut.astro +0 -17
- package/src/components/dropdown/DropdownSub.astro +0 -15
- package/src/components/dropdown/DropdownSubContent.astro +0 -39
- package/src/components/dropdown/DropdownSubTrigger.astro +0 -34
- package/src/components/dropdown/DropdownTrigger.astro +0 -52
- package/src/components/dropzone/Dropzone.astro +0 -236
- package/src/components/dropzone/DropzoneFilesList.astro +0 -26
- package/src/components/dropzone/DropzoneLoadingIndicator.astro +0 -10
- package/src/components/dropzone/DropzoneUploadIndicator.astro +0 -10
- package/src/components/embeds/YoutubeEmbed.astro +0 -94
- package/src/components/hero/Hero.astro +0 -166
- package/src/components/icons/Flag.astro +0 -62
- package/src/components/image/ExtendedImage.astro +0 -46
- package/src/components/image/Image.astro +0 -25
- package/src/components/input/Input.astro +0 -27
- package/src/components/input-group/InputGroup.astro +0 -28
- package/src/components/input-group/InputGroupAddon.astro +0 -76
- package/src/components/input-group/InputGroupButton.astro +0 -36
- package/src/components/input-group/InputGroupInput.astro +0 -18
- package/src/components/input-group/InputGroupText.astro +0 -17
- package/src/components/input-group/InputGroupTextarea.astro +0 -22
- package/src/components/input-otp/InputOtp.astro +0 -352
- package/src/components/input-otp/InputOtpGroup.astro +0 -16
- package/src/components/input-otp/InputOtpSeparator.astro +0 -25
- package/src/components/input-otp/InputOtpSlot.astro +0 -50
- package/src/components/input-otp/InputOtpTypes.ts +0 -6
- package/src/components/item/Item.astro +0 -52
- package/src/components/item/ItemActions.astro +0 -16
- package/src/components/item/ItemContent.astro +0 -16
- package/src/components/item/ItemDescription.astro +0 -19
- package/src/components/item/ItemFooter.astro +0 -16
- package/src/components/item/ItemGroup.astro +0 -16
- package/src/components/item/ItemHeader.astro +0 -16
- package/src/components/item/ItemMedia.astro +0 -40
- package/src/components/item/ItemSeparator.astro +0 -23
- package/src/components/item/ItemTitle.astro +0 -16
- package/src/components/kbd/Kbd.astro +0 -21
- package/src/components/kbd/KbdGroup.astro +0 -16
- package/src/components/label/Label.astro +0 -24
- package/src/components/marquee/Marquee.astro +0 -73
- package/src/components/native-select/NativeSelect.astro +0 -68
- package/src/components/native-select/NativeSelectOptGroup.astro +0 -15
- package/src/components/native-select/NativeSelectOption.astro +0 -15
- package/src/components/pagination/Pagination.astro +0 -20
- package/src/components/pagination/PaginationContent.astro +0 -16
- package/src/components/pagination/PaginationEllipsis.astro +0 -37
- package/src/components/pagination/PaginationItem.astro +0 -16
- package/src/components/pagination/PaginationLink.astro +0 -27
- package/src/components/pagination/PaginationNext.astro +0 -33
- package/src/components/pagination/PaginationPrevious.astro +0 -33
- package/src/components/popover/Popover.astro +0 -717
- package/src/components/popover/PopoverContent.astro +0 -102
- package/src/components/popover/PopoverDescription.astro +0 -14
- package/src/components/popover/PopoverHeader.astro +0 -14
- package/src/components/popover/PopoverTitle.astro +0 -14
- package/src/components/popover/PopoverTrigger.astro +0 -51
- package/src/components/progress/Progress.astro +0 -154
- package/src/components/prose/Prose.astro +0 -619
- package/src/components/radio-group/RadioGroup.astro +0 -162
- package/src/components/radio-group/RadioGroupItem.astro +0 -133
- package/src/components/radio-group/RadioGroupTypes.ts +0 -6
- package/src/components/section/Section.astro +0 -167
- package/src/components/select/Select.astro +0 -752
- package/src/components/select/SelectContent.astro +0 -94
- package/src/components/select/SelectGroup.astro +0 -9
- package/src/components/select/SelectItem.astro +0 -51
- package/src/components/select/SelectLabel.astro +0 -14
- package/src/components/select/SelectSearch.astro +0 -49
- package/src/components/select/SelectSeparator.astro +0 -12
- package/src/components/select/SelectTrigger.astro +0 -56
- package/src/components/select/SelectTypes.ts +0 -13
- package/src/components/select/SelectValue.astro +0 -19
- package/src/components/separator/Separator.astro +0 -36
- package/src/components/sheet/Sheet.astro +0 -15
- package/src/components/sheet/SheetClose.astro +0 -15
- package/src/components/sheet/SheetContent.astro +0 -89
- package/src/components/sheet/SheetDescription.astro +0 -16
- package/src/components/sheet/SheetFooter.astro +0 -16
- package/src/components/sheet/SheetHeader.astro +0 -16
- package/src/components/sheet/SheetTitle.astro +0 -16
- package/src/components/sheet/SheetTrigger.astro +0 -15
- package/src/components/sidebar/Sidebar.astro +0 -231
- package/src/components/sidebar/SidebarContent.astro +0 -25
- package/src/components/sidebar/SidebarFooter.astro +0 -22
- package/src/components/sidebar/SidebarGroup.astro +0 -22
- package/src/components/sidebar/SidebarGroupContent.astro +0 -22
- package/src/components/sidebar/SidebarGroupLabel.astro +0 -53
- package/src/components/sidebar/SidebarHeader.astro +0 -22
- package/src/components/sidebar/SidebarInput.astro +0 -24
- package/src/components/sidebar/SidebarInset.astro +0 -22
- package/src/components/sidebar/SidebarMenu.astro +0 -22
- package/src/components/sidebar/SidebarMenuAction.astro +0 -63
- package/src/components/sidebar/SidebarMenuBadge.astro +0 -31
- package/src/components/sidebar/SidebarMenuButton.astro +0 -124
- package/src/components/sidebar/SidebarMenuItem.astro +0 -22
- package/src/components/sidebar/SidebarMenuSkeleton.astro +0 -43
- package/src/components/sidebar/SidebarMenuSub.astro +0 -25
- package/src/components/sidebar/SidebarMenuSubButton.astro +0 -52
- package/src/components/sidebar/SidebarMenuSubItem.astro +0 -17
- package/src/components/sidebar/SidebarProvider.astro +0 -215
- package/src/components/sidebar/SidebarRail.astro +0 -72
- package/src/components/sidebar/SidebarSeparator.astro +0 -25
- package/src/components/sidebar/SidebarTrigger.astro +0 -69
- package/src/components/skeleton/Skeleton.astro +0 -14
- package/src/components/slider/Slider.astro +0 -425
- package/src/components/spinner/Spinner.astro +0 -23
- package/src/components/switch/Switch.astro +0 -192
- package/src/components/switch/SwitchTypes.ts +0 -6
- package/src/components/table/Table.astro +0 -20
- package/src/components/table/TableBody.astro +0 -18
- package/src/components/table/TableCaption.astro +0 -18
- package/src/components/table/TableCell.astro +0 -18
- package/src/components/table/TableFoot.astro +0 -18
- package/src/components/table/TableHead.astro +0 -18
- package/src/components/table/TableHeader.astro +0 -18
- package/src/components/table/TableRow.astro +0 -17
- package/src/components/tabs/Tabs.astro +0 -270
- package/src/components/tabs/TabsContent.astro +0 -28
- package/src/components/tabs/TabsList.astro +0 -23
- package/src/components/tabs/TabsTrigger.astro +0 -34
- package/src/components/textarea/Textarea.astro +0 -31
- package/src/components/toast/ToastDescription.astro +0 -22
- package/src/components/toast/ToastItem.astro +0 -56
- package/src/components/toast/ToastTemplate.astro +0 -27
- package/src/components/toast/ToastTitle.astro +0 -59
- package/src/components/toast/Toaster.astro +0 -981
- package/src/components/toast/index.ts +0 -1
- package/src/components/toast/toast-manager.ts +0 -234
- package/src/components/toggle/Toggle.astro +0 -174
- package/src/components/toggle/ToggleTypes.ts +0 -14
- package/src/components/tooltip/Tooltip.astro +0 -422
- package/src/components/tooltip/TooltipContent.astro +0 -83
- package/src/components/tooltip/TooltipTrigger.astro +0 -13
- package/src/components/video/Video.astro +0 -121
- package/src/config/cookies.ts +0 -5
- package/src/config/links.ts +0 -4
- package/src/domain/cms/index.ts +0 -1
- package/src/domain/cms/types.ts +0 -20
- package/src/domain/i18n/constants.ts +0 -21
- package/src/domain/i18n/cookie-storage.ts +0 -13
- package/src/domain/i18n/country-to-locale-map.ts +0 -67
- package/src/domain/i18n/fallbacks.generated.ts +0 -230
- package/src/domain/i18n/fetcher.ts +0 -278
- package/src/domain/i18n/flags.ts +0 -16
- package/src/domain/i18n/format.ts +0 -90
- package/src/domain/i18n/index.ts +0 -10
- package/src/domain/i18n/middleware/i18n.ts +0 -161
- package/src/domain/i18n/resolve-locale.ts +0 -55
- package/src/domain/i18n/runtime-constants.ts +0 -14
- package/src/domain/i18n/schema.ts +0 -29
- package/src/domain/index.ts +0 -4
- package/src/domain/seo/constants.ts +0 -6
- package/src/domain/seo/index.ts +0 -3
- package/src/domain/seo/services/index.ts +0 -3
- package/src/domain/seo/services/llms.ts +0 -56
- package/src/domain/seo/services/robots.ts +0 -12
- package/src/domain/seo/services/sitemap.ts +0 -56
- package/src/domain/seo/utils.ts +0 -36
- package/src/domain/theme/constants.ts +0 -6
- package/src/domain/theme/index.ts +0 -2
- package/src/domain/theme/schema.ts +0 -10
- package/src/i18n.generated.d.ts +0 -202
- package/src/lib/component-preview.ts +0 -73
- package/src/lib/index.ts +0 -6
- package/src/lib/remark/remark-modified-time.ts +0 -13
- package/src/lib/showcase-preview-elements.ts +0 -408
- package/src/lib/showcase-renderer.ts +0 -218
- package/src/lib/showcase-utils.ts +0 -189
- package/src/lib/turnstile.ts +0 -35
- package/src/lib/utils/starwind/positioning.ts +0 -318
- package/src/locales/de/blog.json +0 -9
- package/src/locales/de/common.json +0 -19
- package/src/locales/de/errors.json +0 -6
- package/src/locales/de/home.json +0 -20
- package/src/locales/de/messages.json +0 -8
- package/src/locales/de/nav.json +0 -13
- package/src/locales/de/projects.json +0 -9
- package/src/locales/de/services.json +0 -43
- package/src/locales/en/blog.json +0 -9
- package/src/locales/en/chat.json +0 -29
- package/src/locales/en/common.json +0 -19
- package/src/locales/en/cookie_notice.json +0 -11
- package/src/locales/en/editor.json +0 -24
- package/src/locales/en/errors.json +0 -6
- package/src/locales/en/home.json +0 -20
- package/src/locales/en/messages.json +0 -8
- package/src/locales/en/nav.json +0 -13
- package/src/locales/en/projects.json +0 -9
- package/src/locales/en/services.json +0 -43
- package/src/locales/es/blog.json +0 -9
- package/src/locales/es/common.json +0 -19
- package/src/locales/es/errors.json +0 -6
- package/src/locales/es/home.json +0 -20
- package/src/locales/es/messages.json +0 -8
- package/src/locales/es/nav.json +0 -13
- package/src/locales/es/projects.json +0 -9
- package/src/locales/es/services.json +0 -43
- package/src/locales/ja/blog.json +0 -9
- package/src/locales/ja/common.json +0 -19
- package/src/locales/ja/errors.json +0 -6
- package/src/locales/ja/home.json +0 -20
- package/src/locales/ja/messages.json +0 -8
- package/src/locales/ja/nav.json +0 -13
- package/src/locales/ja/projects.json +0 -9
- package/src/locales/ja/services.json +0 -43
- package/src/locales/pt/blog.json +0 -9
- package/src/locales/pt/chat.json +0 -29
- package/src/locales/pt/common.json +0 -19
- package/src/locales/pt/cookie_notice.json +0 -11
- package/src/locales/pt/editor.json +0 -24
- package/src/locales/pt/errors.json +0 -6
- package/src/locales/pt/home.json +0 -20
- package/src/locales/pt/messages.json +0 -8
- package/src/locales/pt/nav.json +0 -13
- package/src/locales/pt/projects.json +0 -9
- package/src/locales/pt/services.json +0 -43
- package/src/utils/server/cookies.ts +0 -98
- package/src/utils/server/index.ts +0 -1
- package/src/utils/shared/index.ts +0 -3
- /package/src/utils/{shared/deep-merge.ts → deep-merge.ts} +0 -0
- /package/src/utils/{shared/embed.ts → embed.ts} +0 -0
- /package/src/utils/{shared/parse-boolean.ts → parse-boolean.ts} +0 -0
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import type { HTMLAttributes } from "astro/types";
|
|
3
|
-
import { cv } from "css-variants";
|
|
4
|
-
|
|
5
|
-
type Props = HTMLAttributes<"div"> & {
|
|
6
|
-
/**
|
|
7
|
-
* Side of the dropdown
|
|
8
|
-
* @default bottom
|
|
9
|
-
*/
|
|
10
|
-
side?: "top" | "bottom" | "left" | "right";
|
|
11
|
-
/**
|
|
12
|
-
* Alignment of the dropdown
|
|
13
|
-
* @default start
|
|
14
|
-
*/
|
|
15
|
-
align?: "start" | "center" | "end";
|
|
16
|
-
/**
|
|
17
|
-
* Offset distance in pixels
|
|
18
|
-
* @default 4
|
|
19
|
-
*/
|
|
20
|
-
sideOffset?: number;
|
|
21
|
-
/**
|
|
22
|
-
* Open and close animation duration in milliseconds
|
|
23
|
-
* @default 150
|
|
24
|
-
*/
|
|
25
|
-
animationDuration?: number;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export const dropdownContent = cv({
|
|
29
|
-
base: [
|
|
30
|
-
"starwind-dropdown-content",
|
|
31
|
-
"bg-popover text-popover-foreground z-50 min-w-5xl max-w-4xl overflow-x-hidden overflow-y-auto rounded-md b p-5xs shadow-md",
|
|
32
|
-
"data-[state=open]:animate-in fade-in zoom-in-95",
|
|
33
|
-
"data-[state=closed]:animate-out data-[state=closed]:fill-mode-forwards fade-out zoom-out-95",
|
|
34
|
-
"absolute will-change-transform",
|
|
35
|
-
],
|
|
36
|
-
variants: {
|
|
37
|
-
side: {
|
|
38
|
-
bottom: "slide-in-from-top-2 slide-out-to-top-2 top-full",
|
|
39
|
-
top: "slide-in-from-bottom-2 slide-out-to-bottom-2 bottom-full",
|
|
40
|
-
right: "slide-in-from-left-2 slide-out-to-left-2 top-0 left-full",
|
|
41
|
-
left: "slide-in-from-right-2 slide-out-to-right-2 top-0 right-full",
|
|
42
|
-
},
|
|
43
|
-
align: {
|
|
44
|
-
start: "",
|
|
45
|
-
center: "",
|
|
46
|
-
end: "",
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
compoundVariants: [
|
|
50
|
-
{
|
|
51
|
-
side: ["top", "bottom"],
|
|
52
|
-
align: "start",
|
|
53
|
-
className: "slide-in-from-left-1 slide-out-to-left-1 left-0",
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
side: ["top", "bottom"],
|
|
57
|
-
align: "center",
|
|
58
|
-
className: "left-1/2 -translate-x-1/2",
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
side: ["top", "bottom"],
|
|
62
|
-
align: "end",
|
|
63
|
-
className: "slide-in-from-right-1 slide-out-to-right-1 right-0",
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
side: ["left", "right"],
|
|
67
|
-
align: "start",
|
|
68
|
-
className: "top-0",
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
side: ["left", "right"],
|
|
72
|
-
align: "center",
|
|
73
|
-
className: "top-1/2 -translate-y-1/2",
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
side: ["left", "right"],
|
|
77
|
-
align: "end",
|
|
78
|
-
className: "bottom-0",
|
|
79
|
-
},
|
|
80
|
-
],
|
|
81
|
-
defaultVariants: {
|
|
82
|
-
side: "bottom",
|
|
83
|
-
align: "start",
|
|
84
|
-
},
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
const {
|
|
88
|
-
class: className,
|
|
89
|
-
side = "bottom",
|
|
90
|
-
align = "start",
|
|
91
|
-
sideOffset = 4,
|
|
92
|
-
animationDuration = 150,
|
|
93
|
-
...rest
|
|
94
|
-
} = Astro.props;
|
|
95
|
-
---
|
|
96
|
-
|
|
97
|
-
<div
|
|
98
|
-
class:list={[dropdownContent({ side, align }), className]}
|
|
99
|
-
role="menu"
|
|
100
|
-
data-side={side}
|
|
101
|
-
data-align={align}
|
|
102
|
-
data-state="closed"
|
|
103
|
-
tabindex="-1"
|
|
104
|
-
aria-orientation="vertical"
|
|
105
|
-
style={{
|
|
106
|
-
display: "none",
|
|
107
|
-
animationDuration: `${animationDuration}ms`,
|
|
108
|
-
maxWidth: "min(256px, 100vw - 1rem)",
|
|
109
|
-
marginTop: side === "bottom" ? `${sideOffset}px` : undefined,
|
|
110
|
-
marginBottom: side === "top" ? `${sideOffset}px` : undefined,
|
|
111
|
-
marginLeft: side === "right" ? `${sideOffset}px` : undefined,
|
|
112
|
-
marginRight: side === "left" ? `${sideOffset}px` : undefined,
|
|
113
|
-
}}
|
|
114
|
-
{...rest}
|
|
115
|
-
data-slot="dropdown-content"
|
|
116
|
-
>
|
|
117
|
-
<slot />
|
|
118
|
-
</div>
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import type { HTMLTag, Polymorphic } from "astro/types";
|
|
3
|
-
import { cv } from "css-variants";
|
|
4
|
-
|
|
5
|
-
type Props<Tag extends HTMLTag> = Polymorphic<{ as: Tag }> & {
|
|
6
|
-
/**
|
|
7
|
-
* Whether the item is inset (has left padding)
|
|
8
|
-
*/
|
|
9
|
-
inset?: boolean;
|
|
10
|
-
/**
|
|
11
|
-
* Whether the item is disabled
|
|
12
|
-
*/
|
|
13
|
-
disabled?: boolean;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export const dropdownItem = cv({
|
|
17
|
-
base: [
|
|
18
|
-
"focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-3xs rounded-sm px-3xs py-5xs transition-colors outline-none select-none",
|
|
19
|
-
"data-[disabled]:pointer-events-none data-[disabled]:op-50",
|
|
20
|
-
"group/dropdown-item [&>svg]:size-4 [&>svg]:shrink-0",
|
|
21
|
-
],
|
|
22
|
-
variants: {
|
|
23
|
-
inset: {
|
|
24
|
-
true: "pl-3xl",
|
|
25
|
-
},
|
|
26
|
-
disabled: {
|
|
27
|
-
true: "pointer-events-none op-50",
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
defaultVariants: {
|
|
31
|
-
inset: false,
|
|
32
|
-
disabled: false,
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
const { class: className, inset = false, disabled = false, as: Tag = "div", ...rest } = Astro.props;
|
|
37
|
-
---
|
|
38
|
-
|
|
39
|
-
<Tag
|
|
40
|
-
class:list={[dropdownItem({ inset, disabled }), className]}
|
|
41
|
-
role="menuitem"
|
|
42
|
-
tabindex={disabled ? "-1" : "0"}
|
|
43
|
-
data-disabled={disabled ? "true" : undefined}
|
|
44
|
-
data-slot="dropdown-item"
|
|
45
|
-
{...rest}
|
|
46
|
-
>
|
|
47
|
-
<slot />
|
|
48
|
-
</Tag>
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import type { HTMLAttributes } from "astro/types";
|
|
3
|
-
import { cv } from "css-variants";
|
|
4
|
-
|
|
5
|
-
type Props = HTMLAttributes<"div"> & {
|
|
6
|
-
/**
|
|
7
|
-
* Whether the label is inset (has left padding)
|
|
8
|
-
*/
|
|
9
|
-
inset?: boolean;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export const dropdownLabel = cv({
|
|
13
|
-
base: ["text-muted-foreground px-3xs py-5xs text-sm font-medium"],
|
|
14
|
-
variants: {
|
|
15
|
-
inset: {
|
|
16
|
-
true: "pl-3xl",
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
defaultVariants: {
|
|
20
|
-
inset: false,
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
const { class: className, inset = false, ...rest } = Astro.props;
|
|
25
|
-
---
|
|
26
|
-
|
|
27
|
-
<div class:list={[dropdownLabel({ inset }), className]} {...rest} data-slot="dropdown-label">
|
|
28
|
-
<slot />
|
|
29
|
-
</div>
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import type { HTMLAttributes } from "astro/types";
|
|
3
|
-
import { cv } from "css-variants";
|
|
4
|
-
|
|
5
|
-
type Props = HTMLAttributes<"div">;
|
|
6
|
-
|
|
7
|
-
export const dropdownSeparator = cv({
|
|
8
|
-
base: "bg-border -mx-5xs my-5xs h-6xs",
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
const { class: className, ...rest } = Astro.props;
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
<div
|
|
15
|
-
class:list={[dropdownSeparator(), className]}
|
|
16
|
-
role="separator"
|
|
17
|
-
aria-orientation="horizontal"
|
|
18
|
-
{...rest}
|
|
19
|
-
data-slot="dropdown-separator"
|
|
20
|
-
>
|
|
21
|
-
</div>
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import type { HTMLAttributes } from "astro/types";
|
|
3
|
-
|
|
4
|
-
type Props = HTMLAttributes<"span">;
|
|
5
|
-
|
|
6
|
-
const { class: className, ...rest } = Astro.props;
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
<span
|
|
10
|
-
class:list={[
|
|
11
|
-
"group-focus/dropdown-item:text-accent-foreground text-muted-foreground ml-auto text-sm tracking-widest transition-colors",
|
|
12
|
-
className,
|
|
13
|
-
]}
|
|
14
|
-
{...rest}
|
|
15
|
-
>
|
|
16
|
-
<slot />
|
|
17
|
-
</span>
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import type { HTMLAttributes } from "astro/types";
|
|
3
|
-
|
|
4
|
-
type Props = HTMLAttributes<"div">;
|
|
5
|
-
|
|
6
|
-
const { class: className, ...rest } = Astro.props;
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
<div
|
|
10
|
-
class:list={["starwind-dropdown-sub", "relative", className]}
|
|
11
|
-
{...rest}
|
|
12
|
-
data-slot="dropdown-sub"
|
|
13
|
-
>
|
|
14
|
-
<slot />
|
|
15
|
-
</div>
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import type { HTMLAttributes } from "astro/types";
|
|
3
|
-
|
|
4
|
-
import { dropdownContent } from "./DropdownContent.astro";
|
|
5
|
-
|
|
6
|
-
type Props = HTMLAttributes<"div"> & {
|
|
7
|
-
/**
|
|
8
|
-
* Open and close animation duration in milliseconds
|
|
9
|
-
* @default 150
|
|
10
|
-
*/
|
|
11
|
-
animationDuration?: number;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const { class: className, animationDuration = 150, ...rest } = Astro.props;
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
<div
|
|
18
|
-
class:list={[
|
|
19
|
-
dropdownContent({
|
|
20
|
-
side: "right",
|
|
21
|
-
align: "start",
|
|
22
|
-
}),
|
|
23
|
-
"starwind-dropdown-sub-content",
|
|
24
|
-
className,
|
|
25
|
-
]}
|
|
26
|
-
data-sub-content
|
|
27
|
-
role="menu"
|
|
28
|
-
data-state="closed"
|
|
29
|
-
tabindex="-1"
|
|
30
|
-
aria-orientation="vertical"
|
|
31
|
-
style={{
|
|
32
|
-
display: "none",
|
|
33
|
-
animationDuration: `${animationDuration}ms`,
|
|
34
|
-
}}
|
|
35
|
-
{...rest}
|
|
36
|
-
data-slot="dropdown-content"
|
|
37
|
-
>
|
|
38
|
-
<slot />
|
|
39
|
-
</div>
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import type { HTMLAttributes } from "astro/types";
|
|
3
|
-
import IconChevronRight from "~icons/lucide/chevron-right";
|
|
4
|
-
|
|
5
|
-
import { dropdownItem } from "./DropdownItem.astro";
|
|
6
|
-
|
|
7
|
-
type Props = HTMLAttributes<"div"> & {
|
|
8
|
-
/**
|
|
9
|
-
* Whether the item is inset (has left padding)
|
|
10
|
-
*/
|
|
11
|
-
inset?: boolean;
|
|
12
|
-
/**
|
|
13
|
-
* Whether the item is disabled
|
|
14
|
-
*/
|
|
15
|
-
disabled?: boolean;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const { class: className, inset = false, disabled = false, ...rest } = Astro.props;
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
<div
|
|
22
|
-
class:list={[dropdownItem({ inset, disabled }), "starwind-dropdown-sub-trigger", className]}
|
|
23
|
-
role="menuitem"
|
|
24
|
-
aria-haspopup="true"
|
|
25
|
-
aria-expanded="false"
|
|
26
|
-
tabindex={disabled ? "-1" : "0"}
|
|
27
|
-
data-disabled={disabled ? "true" : undefined}
|
|
28
|
-
data-sub-trigger
|
|
29
|
-
{...rest}
|
|
30
|
-
data-slot="dropdown-item"
|
|
31
|
-
>
|
|
32
|
-
<slot />
|
|
33
|
-
<IconChevronRight class="ml-auto size-4" />
|
|
34
|
-
</div>
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import type { HTMLAttributes } from "astro/types";
|
|
3
|
-
import { cv } from "css-variants";
|
|
4
|
-
|
|
5
|
-
type Props = Omit<HTMLAttributes<"button">, "role" | "type"> & {
|
|
6
|
-
/**
|
|
7
|
-
* When true, the component will render its child element with a simple wrapper instead of a button component
|
|
8
|
-
*/
|
|
9
|
-
asChild?: boolean;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export const dropdownTrigger = cv({
|
|
13
|
-
base: [
|
|
14
|
-
"starwind-dropdown-trigger",
|
|
15
|
-
"inline-flex items-center justify-center",
|
|
16
|
-
"focus-visible:ring-outline/50 transition-[color,box-shadow] outline-none focus-visible:ring-3",
|
|
17
|
-
"disabled:pointer-events-none",
|
|
18
|
-
],
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
const { class: className, asChild = false, ...rest } = Astro.props;
|
|
22
|
-
|
|
23
|
-
// Get the first child element if asChild is true
|
|
24
|
-
let hasChildren = false;
|
|
25
|
-
if (Astro.slots.has("default")) {
|
|
26
|
-
hasChildren = true;
|
|
27
|
-
}
|
|
28
|
-
---
|
|
29
|
-
|
|
30
|
-
{
|
|
31
|
-
asChild && hasChildren ? (
|
|
32
|
-
<div
|
|
33
|
-
class:list={["starwind-dropdown-trigger", className]}
|
|
34
|
-
data-slot="dropdown-trigger"
|
|
35
|
-
data-as-child
|
|
36
|
-
>
|
|
37
|
-
<slot />
|
|
38
|
-
</div>
|
|
39
|
-
) : (
|
|
40
|
-
<button
|
|
41
|
-
class:list={[dropdownTrigger(), className]}
|
|
42
|
-
type="button"
|
|
43
|
-
aria-haspopup="true"
|
|
44
|
-
aria-expanded="false"
|
|
45
|
-
data-state="closed"
|
|
46
|
-
{...rest}
|
|
47
|
-
data-slot="dropdown-trigger"
|
|
48
|
-
>
|
|
49
|
-
<slot />
|
|
50
|
-
</button>
|
|
51
|
-
)
|
|
52
|
-
}
|
|
@@ -1,236 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import type { HTMLAttributes } from "astro/types";
|
|
3
|
-
import { cv } from "css-variants";
|
|
4
|
-
|
|
5
|
-
import DropzoneFilesList from "./DropzoneFilesList.astro";
|
|
6
|
-
import DropzoneLoadingIndicator from "./DropzoneLoadingIndicator.astro";
|
|
7
|
-
import DropzoneUploadIndicator from "./DropzoneUploadIndicator.astro";
|
|
8
|
-
|
|
9
|
-
type Props = HTMLAttributes<"input"> & {
|
|
10
|
-
/**
|
|
11
|
-
* Whether to show the loading indicator initially
|
|
12
|
-
*/
|
|
13
|
-
isUploading?: boolean;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
// extract id separately so it can be used in the label. The input will get the same id with "-input" suffix.
|
|
17
|
-
const { class: className, id, isUploading = false, ...rest } = Astro.props as Props;
|
|
18
|
-
|
|
19
|
-
export const dropzone = cv({
|
|
20
|
-
base: [
|
|
21
|
-
"starwind-dropzone",
|
|
22
|
-
"relative flex w-full flex-col items-center justify-center gap-1 rounded-lg px-6 py-12 shadow-xs",
|
|
23
|
-
"bg-background dark:bg-input/30 text-muted-foreground b-input cursor-pointer b b-dashed text-center text-sm",
|
|
24
|
-
"data-[is-uploading=false]:hover:bg-muted data-[drag-active=true]:bg-muted transition",
|
|
25
|
-
"focus-visible:border-outline focus-visible:ring-outline/50 outline-none focus-visible:ring-3",
|
|
26
|
-
"aria-invalid:border-error aria-invalid:focus-visible:ring-error/40",
|
|
27
|
-
"disabled:cursor-not-allowed disabled:op-50",
|
|
28
|
-
],
|
|
29
|
-
});
|
|
30
|
-
---
|
|
31
|
-
|
|
32
|
-
<label
|
|
33
|
-
id={id}
|
|
34
|
-
tabindex="0"
|
|
35
|
-
class:list={[dropzone(), className]}
|
|
36
|
-
data-slot="dropzone"
|
|
37
|
-
data-drag-active="false"
|
|
38
|
-
data-has-files="false"
|
|
39
|
-
data-is-uploading={String(isUploading)}
|
|
40
|
-
>
|
|
41
|
-
<slot>
|
|
42
|
-
<DropzoneUploadIndicator />
|
|
43
|
-
<DropzoneLoadingIndicator />
|
|
44
|
-
<DropzoneFilesList />
|
|
45
|
-
</slot>
|
|
46
|
-
|
|
47
|
-
<input tabindex="-1" type="file" class="sr-only" {...rest} />
|
|
48
|
-
</label>
|
|
49
|
-
|
|
50
|
-
<script>
|
|
51
|
-
const fileSvg = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-file"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M14 3v4a1 1 0 0 0 1 1h4" /><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z" /></svg>`;
|
|
52
|
-
class FileInputHandler {
|
|
53
|
-
private label: HTMLLabelElement;
|
|
54
|
-
private input: HTMLInputElement;
|
|
55
|
-
private uploadIndicator: HTMLElement | null;
|
|
56
|
-
private loadingIndicator: HTMLElement | null;
|
|
57
|
-
private filesList: HTMLElement | null;
|
|
58
|
-
private files: File[] = [];
|
|
59
|
-
private isUploading: boolean = false;
|
|
60
|
-
private observer: MutationObserver | null = null;
|
|
61
|
-
|
|
62
|
-
constructor(label: HTMLLabelElement, idx: number) {
|
|
63
|
-
this.label = label;
|
|
64
|
-
const maybeInput = label.querySelector<HTMLInputElement>('input[type="file"]');
|
|
65
|
-
if (!maybeInput) {
|
|
66
|
-
throw new Error("No file input found inside starwind-dropzone");
|
|
67
|
-
}
|
|
68
|
-
this.input = maybeInput;
|
|
69
|
-
this.uploadIndicator = label.querySelector(".starwind-upload-indicator");
|
|
70
|
-
this.loadingIndicator = label.querySelector(".starwind-loading-indicator");
|
|
71
|
-
this.filesList = label.querySelector(".starwind-files-list");
|
|
72
|
-
|
|
73
|
-
// generate ID
|
|
74
|
-
if (this.label.id) {
|
|
75
|
-
const inputId = this.label.id + "-input";
|
|
76
|
-
this.input.id = inputId;
|
|
77
|
-
this.label.htmlFor = inputId;
|
|
78
|
-
} else {
|
|
79
|
-
const generatedId = `starwind-dropzone-${idx}`;
|
|
80
|
-
this.input.id = generatedId;
|
|
81
|
-
this.label.htmlFor = generatedId;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// Setup event handlers
|
|
85
|
-
this.setupEvents();
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
private setActive(active: boolean) {
|
|
89
|
-
this.label.dataset.dragActive = String(active);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// Set up mutation observer to watch for external attribute changes
|
|
93
|
-
private observeAttributeChanges() {
|
|
94
|
-
this.observer = new MutationObserver((mutations) => {
|
|
95
|
-
mutations.forEach((mutation) => {
|
|
96
|
-
if (mutation.type === "attributes" && mutation.attributeName === "data-is-uploading") {
|
|
97
|
-
this.handleAttributeChange();
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
this.observer.observe(this.label, {
|
|
103
|
-
attributes: true,
|
|
104
|
-
attributeFilter: ["data-is-uploading"],
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// Handle attribute changes from external sources
|
|
109
|
-
private handleAttributeChange() {
|
|
110
|
-
const isUploading = this.label.dataset.isUploading === "true";
|
|
111
|
-
|
|
112
|
-
// Only update internal state if it's different
|
|
113
|
-
if (isUploading !== this.isUploading) {
|
|
114
|
-
this.isUploading = isUploading;
|
|
115
|
-
|
|
116
|
-
// Update UI
|
|
117
|
-
if (this.uploadIndicator && this.loadingIndicator) {
|
|
118
|
-
if (isUploading) {
|
|
119
|
-
this.uploadIndicator.classList.add("hidden");
|
|
120
|
-
this.loadingIndicator.classList.remove("hidden");
|
|
121
|
-
} else {
|
|
122
|
-
this.loadingIndicator.classList.add("hidden");
|
|
123
|
-
this.uploadIndicator.classList.remove("hidden");
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
private updateFilesList() {
|
|
130
|
-
if (!this.filesList) return;
|
|
131
|
-
|
|
132
|
-
const hasFiles = this.files.length > 0;
|
|
133
|
-
this.label.dataset.hasFiles = String(hasFiles);
|
|
134
|
-
|
|
135
|
-
if (hasFiles) {
|
|
136
|
-
this.filesList.classList.remove("invisible");
|
|
137
|
-
|
|
138
|
-
// Clear previous files
|
|
139
|
-
this.filesList.innerHTML = "";
|
|
140
|
-
|
|
141
|
-
// Create file list
|
|
142
|
-
this.files.forEach((file) => {
|
|
143
|
-
const fileItem = document.createElement("div");
|
|
144
|
-
|
|
145
|
-
// Insert SVG directly
|
|
146
|
-
fileItem.innerHTML = fileSvg;
|
|
147
|
-
|
|
148
|
-
const fileText = document.createElement("span");
|
|
149
|
-
fileText.textContent = file.name;
|
|
150
|
-
|
|
151
|
-
// Append text after the SVG
|
|
152
|
-
fileItem.appendChild(fileText);
|
|
153
|
-
|
|
154
|
-
// Use non-null assertion since we already checked at the beginning of the method
|
|
155
|
-
this.filesList!.appendChild(fileItem);
|
|
156
|
-
});
|
|
157
|
-
} else {
|
|
158
|
-
this.filesList.classList.add("invisible");
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
private handleFiles(files: FileList | null) {
|
|
163
|
-
if (!files || files.length === 0) return;
|
|
164
|
-
|
|
165
|
-
this.files = Array.from(files);
|
|
166
|
-
this.updateFilesList();
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
private setupEvents() {
|
|
170
|
-
this.label.addEventListener("dragover", (e) => {
|
|
171
|
-
e.preventDefault();
|
|
172
|
-
this.setActive(true);
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
this.label.addEventListener("dragleave", () => {
|
|
176
|
-
this.setActive(false);
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
this.label.addEventListener("drop", (e) => {
|
|
180
|
-
e.preventDefault();
|
|
181
|
-
this.setActive(false);
|
|
182
|
-
|
|
183
|
-
const { files } = e.dataTransfer || {};
|
|
184
|
-
if (files && files.length) {
|
|
185
|
-
const dt = new DataTransfer();
|
|
186
|
-
Array.from(files).forEach((file) => dt.items.add(file));
|
|
187
|
-
this.input.files = dt.files;
|
|
188
|
-
this.input.dispatchEvent(new Event("change", { bubbles: true }));
|
|
189
|
-
|
|
190
|
-
this.handleFiles(files);
|
|
191
|
-
}
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
// Handle file selection from dialog
|
|
195
|
-
this.input.addEventListener("change", () => {
|
|
196
|
-
this.handleFiles(this.input.files);
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
// Add keyboard accessibility for Enter and Space keys
|
|
200
|
-
this.label.addEventListener("keydown", (e) => {
|
|
201
|
-
// Handle Enter (13) and Space (32) keys
|
|
202
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
203
|
-
e.preventDefault();
|
|
204
|
-
this.input.click(); // Trigger the native file dialog
|
|
205
|
-
}
|
|
206
|
-
});
|
|
207
|
-
|
|
208
|
-
if (this.loadingIndicator) {
|
|
209
|
-
// Watch for external changes to data-is-uploading attribute
|
|
210
|
-
this.observeAttributeChanges();
|
|
211
|
-
// Initialize based on current attribute values
|
|
212
|
-
this.handleAttributeChange();
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
// Store instances in a WeakMap to avoid memory leaks
|
|
218
|
-
const fileInputInstances = new WeakMap<HTMLElement, FileInputHandler>();
|
|
219
|
-
let dropzoneCounter = 0;
|
|
220
|
-
|
|
221
|
-
const setupFileInputs = () => {
|
|
222
|
-
document.querySelectorAll<HTMLLabelElement>(".starwind-dropzone").forEach((label) => {
|
|
223
|
-
if (!fileInputInstances.has(label)) {
|
|
224
|
-
try {
|
|
225
|
-
fileInputInstances.set(label, new FileInputHandler(label, dropzoneCounter++));
|
|
226
|
-
} catch {
|
|
227
|
-
/* ignore labels without inputs */
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
});
|
|
231
|
-
};
|
|
232
|
-
|
|
233
|
-
setupFileInputs();
|
|
234
|
-
document.addEventListener("astro:after-swap", setupFileInputs);
|
|
235
|
-
document.addEventListener("starwind:init", setupFileInputs);
|
|
236
|
-
</script>
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import type { HTMLAttributes } from "astro/types";
|
|
3
|
-
import { cv } from "css-variants";
|
|
4
|
-
|
|
5
|
-
type Props = HTMLAttributes<"div">;
|
|
6
|
-
|
|
7
|
-
const { class: className, ...rest } = Astro.props;
|
|
8
|
-
|
|
9
|
-
export const dropzoneFilesList = cv({
|
|
10
|
-
base: [
|
|
11
|
-
"starwind-files-list",
|
|
12
|
-
"mt-2xs -mb-3xs min-h-3xs",
|
|
13
|
-
"bg-muted invisible flex flex-col items-center justify-center gap-2xs rounded-md px-2 py-1 text-sm",
|
|
14
|
-
"[&_div]:flex [&_div]:items-center [&_div]:gap-1 [&_svg]:size-3.5",
|
|
15
|
-
],
|
|
16
|
-
});
|
|
17
|
-
---
|
|
18
|
-
|
|
19
|
-
<div
|
|
20
|
-
class:list={[dropzoneFilesList(), className]}
|
|
21
|
-
aria-live="polite"
|
|
22
|
-
aria-label="Uploaded files"
|
|
23
|
-
{...rest}
|
|
24
|
-
data-slot="dropzone-files-list"
|
|
25
|
-
>
|
|
26
|
-
</div>
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import IconLoader from "~icons/lucide/loader";
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
<div class="starwind-loading-indicator hidden" data-slot="dropzone-loading-indicator">
|
|
6
|
-
<slot>
|
|
7
|
-
<IconLoader class="mx-auto size-10 animate-spin" aria-hidden="true" />
|
|
8
|
-
<p class="mt-1 text-sm">Uploading file(s)...</p>
|
|
9
|
-
</slot>
|
|
10
|
-
</div>
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import IconCloudUpload from "~icons/lucide/cloud-upload";
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
<div class="starwind-upload-indicator" data-slot="dropzone-upload-indicator">
|
|
6
|
-
<slot>
|
|
7
|
-
<IconCloudUpload class="mx-auto size-10" aria-hidden="true" />
|
|
8
|
-
<p class="mt-1 text-sm">Click to upload or drag and drop</p>
|
|
9
|
-
</slot>
|
|
10
|
-
</div>
|