@rimelight/ui 0.0.5 → 0.0.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/LICENSE +21 -21
- package/package.json +22 -14
- package/src/components/BlogPost.astro +195 -0
- package/src/components/DynamicShowcase.astro +681 -0
- package/src/components/ExtendedCarousel.astro +107 -0
- package/src/components/FormattedDate.astro +6 -2
- package/src/components/Head.astro +153 -0
- package/src/components/ProjectPost.astro +197 -0
- package/src/components/RLHead.astro +3 -0
- package/src/components/ThemeToggle.astro +30 -42
- package/src/components/astro/RLAButton.astro +32 -42
- package/src/components/astro/RLAHeader.astro +75 -0
- package/src/components/nuxt/index.ts +1 -0
- package/src/components/vue/RLVButton.vue +50 -37
- package/src/components/vue/RLVHeader.vue +78 -0
- package/src/composables/index.ts +1 -1
- package/src/composables/{useComponentUI.ts → useUi.ts} +3 -3
- package/src/config/index.ts +0 -2
- package/src/config/site.config.ts +1 -1
- package/src/env.d.ts +13 -16
- package/src/integrations/ui.ts +106 -81
- package/src/integrations/vue-entrypoint.ts +6 -0
- package/src/middleware/sri.ts +2 -2
- package/src/styles/index.css +2 -0
- package/src/themes/button.theme.ts +350 -34
- package/src/themes/header.theme.ts +33 -0
- package/src/themes/index.ts +3 -1
- package/src/utils/index.ts +1 -2
- package/i18n-data.json +0 -186
- package/src/components/MissingTranslationBanner.astro +0 -39
- 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/deep-merge.ts +0 -36
- package/src/utils/shared/index.ts +0 -3
- package/src/utils/shared/parse-boolean.ts +0 -14
- /package/src/utils/{shared/embed.ts → embed.ts} +0 -0
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import type { HTMLAttributes } from "astro/types";
|
|
3
|
-
import { cv } from "css-variants";
|
|
4
|
-
|
|
5
|
-
import Sheet from "../sheet/Sheet.astro";
|
|
6
|
-
import SheetContent from "../sheet/SheetContent.astro";
|
|
7
|
-
import SheetDescription from "../sheet/SheetDescription.astro";
|
|
8
|
-
import SheetHeader from "../sheet/SheetHeader.astro";
|
|
9
|
-
import SheetTitle from "../sheet/SheetTitle.astro";
|
|
10
|
-
|
|
11
|
-
export interface SidebarProps extends HTMLAttributes<"div"> {
|
|
12
|
-
/**
|
|
13
|
-
* The side of the viewport the sidebar appears on
|
|
14
|
-
* @default "left"
|
|
15
|
-
*/
|
|
16
|
-
side?: "left" | "right";
|
|
17
|
-
/**
|
|
18
|
-
* The visual variant of the sidebar
|
|
19
|
-
* @default "sidebar"
|
|
20
|
-
*/
|
|
21
|
-
variant?: "sidebar" | "floating" | "inset";
|
|
22
|
-
/**
|
|
23
|
-
* How the sidebar collapses
|
|
24
|
-
* @default "offcanvas"
|
|
25
|
-
*/
|
|
26
|
-
collapsible?: "offcanvas" | "icon" | "none";
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
type Props = SidebarProps;
|
|
30
|
-
|
|
31
|
-
export const sidebar = cv({
|
|
32
|
-
base: "starwind-sidebar group peer text-sidebar-foreground hidden md:block",
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
export const sidebarGap = cv({
|
|
36
|
-
base: [
|
|
37
|
-
"relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear",
|
|
38
|
-
"group-data-[collapsible=offcanvas]:w-0",
|
|
39
|
-
"group-data-[side=right]:rotate-180",
|
|
40
|
-
],
|
|
41
|
-
variants: {
|
|
42
|
-
variant: {
|
|
43
|
-
sidebar: "group-data-[collapsible=icon]:w-(--sidebar-width-icon)",
|
|
44
|
-
floating: "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+1rem)]",
|
|
45
|
-
inset: "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+1rem)]",
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
defaultVariants: {
|
|
49
|
-
variant: "sidebar",
|
|
50
|
-
},
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
export const sidebarContainer = cv({
|
|
54
|
-
base: [
|
|
55
|
-
"fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex",
|
|
56
|
-
],
|
|
57
|
-
variants: {
|
|
58
|
-
side: {
|
|
59
|
-
left: "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]",
|
|
60
|
-
right: "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",
|
|
61
|
-
},
|
|
62
|
-
variant: {
|
|
63
|
-
sidebar: [
|
|
64
|
-
"group-data-[collapsible=icon]:w-(--sidebar-width-icon)",
|
|
65
|
-
"group-data-[side=left]:border-r group-data-[side=right]:border-l",
|
|
66
|
-
],
|
|
67
|
-
floating: "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+1rem+2px)]",
|
|
68
|
-
inset: "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+1rem+2px)]",
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
defaultVariants: {
|
|
72
|
-
side: "left",
|
|
73
|
-
variant: "sidebar",
|
|
74
|
-
},
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
export const sidebarInner = cv({
|
|
78
|
-
base: "bg-sidebar flex h-full w-full flex-col",
|
|
79
|
-
variants: {
|
|
80
|
-
variant: {
|
|
81
|
-
sidebar: "",
|
|
82
|
-
floating: "border-sidebar-border rounded-lg b shadow-sm",
|
|
83
|
-
inset: "border-sidebar-border rounded-lg b shadow-sm",
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
defaultVariants: {
|
|
87
|
-
variant: "sidebar",
|
|
88
|
-
},
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
export const sidebarMobileContent = cv({
|
|
92
|
-
base: "bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
const {
|
|
96
|
-
side = "left",
|
|
97
|
-
variant = "sidebar",
|
|
98
|
-
collapsible = "offcanvas",
|
|
99
|
-
class: className,
|
|
100
|
-
...rest
|
|
101
|
-
} = Astro.props;
|
|
102
|
-
|
|
103
|
-
const SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
104
|
-
---
|
|
105
|
-
|
|
106
|
-
{/* Non-collapsible sidebar */}
|
|
107
|
-
{
|
|
108
|
-
collapsible === "none" ? (
|
|
109
|
-
<div
|
|
110
|
-
class:list={[
|
|
111
|
-
"bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",
|
|
112
|
-
className,
|
|
113
|
-
]}
|
|
114
|
-
{...rest}
|
|
115
|
-
data-slot="sidebar"
|
|
116
|
-
>
|
|
117
|
-
<slot />
|
|
118
|
-
</div>
|
|
119
|
-
) : (
|
|
120
|
-
<>
|
|
121
|
-
{/* Desktop sidebar */}
|
|
122
|
-
<div
|
|
123
|
-
class:list={[sidebar(), className]}
|
|
124
|
-
data-state="expanded"
|
|
125
|
-
data-collapsible=""
|
|
126
|
-
data-collapsible-mode={collapsible}
|
|
127
|
-
data-variant={variant}
|
|
128
|
-
data-side={side}
|
|
129
|
-
data-slot="sidebar"
|
|
130
|
-
>
|
|
131
|
-
{/* Gap placeholder for layout */}
|
|
132
|
-
<div data-slot="sidebar-gap" class={sidebarGap({ variant })} />
|
|
133
|
-
|
|
134
|
-
{/* Fixed sidebar container */}
|
|
135
|
-
<div class={sidebarContainer({ side, variant })} {...rest} data-slot="sidebar-container">
|
|
136
|
-
<div data-slot="sidebar-inner" class={sidebarInner({ variant })}>
|
|
137
|
-
<slot />
|
|
138
|
-
</div>
|
|
139
|
-
</div>
|
|
140
|
-
</div>
|
|
141
|
-
|
|
142
|
-
{/* Mobile sidebar (Sheet) */}
|
|
143
|
-
<Sheet class="md:hidden" data-slot="sidebar-mobile">
|
|
144
|
-
<SheetContent
|
|
145
|
-
side={side}
|
|
146
|
-
class={sidebarMobileContent()}
|
|
147
|
-
style={{ "--sidebar-width": SIDEBAR_WIDTH_MOBILE }}
|
|
148
|
-
>
|
|
149
|
-
<SheetHeader class="sr-only">
|
|
150
|
-
<SheetTitle>Sidebar</SheetTitle>
|
|
151
|
-
<SheetDescription>Mobile navigation sidebar</SheetDescription>
|
|
152
|
-
</SheetHeader>
|
|
153
|
-
<div class="flex h-full w-full flex-col">
|
|
154
|
-
<slot />
|
|
155
|
-
</div>
|
|
156
|
-
</SheetContent>
|
|
157
|
-
</Sheet>
|
|
158
|
-
</>
|
|
159
|
-
)
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
<script>
|
|
163
|
-
class SidebarHandler {
|
|
164
|
-
private sidebar: HTMLElement;
|
|
165
|
-
private provider: HTMLElement;
|
|
166
|
-
private collapsibleMode: string;
|
|
167
|
-
private boundUpdateState: () => void;
|
|
168
|
-
|
|
169
|
-
constructor(sidebar: HTMLElement) {
|
|
170
|
-
this.sidebar = sidebar;
|
|
171
|
-
this.provider = sidebar.closest<HTMLElement>('[data-slot="sidebar-provider"]')!;
|
|
172
|
-
this.collapsibleMode =
|
|
173
|
-
sidebar.dataset.collapsibleMode ||
|
|
174
|
-
(sidebar.closest("[data-collapsible]") as HTMLElement)?.dataset.collapsible ||
|
|
175
|
-
"offcanvas";
|
|
176
|
-
sidebar.dataset.collapsibleMode = this.collapsibleMode;
|
|
177
|
-
|
|
178
|
-
this.boundUpdateState = this.updateState.bind(this);
|
|
179
|
-
this.init();
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
private init() {
|
|
183
|
-
this.updateState();
|
|
184
|
-
this.provider.addEventListener("sidebar:change", this.boundUpdateState);
|
|
185
|
-
this.provider.addEventListener("sidebar:mobile-change", this.boundUpdateState);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
private updateState() {
|
|
189
|
-
const state = this.provider.getAttribute("data-state") || "expanded";
|
|
190
|
-
this.sidebar.setAttribute("data-state", state);
|
|
191
|
-
|
|
192
|
-
if (state === "collapsed") {
|
|
193
|
-
this.sidebar.setAttribute("data-collapsible", this.collapsibleMode);
|
|
194
|
-
} else {
|
|
195
|
-
this.sidebar.setAttribute("data-collapsible", "");
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
this.syncSidebarMenuTooltips();
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
private syncSidebarMenuTooltips() {
|
|
202
|
-
const hasEnabledSidebar = Array.from(
|
|
203
|
-
document.querySelectorAll<HTMLElement>(
|
|
204
|
-
'[data-slot="sidebar"][data-collapsible-mode="icon"][data-state="collapsed"]',
|
|
205
|
-
),
|
|
206
|
-
).some((sidebar) => getComputedStyle(sidebar).display !== "none");
|
|
207
|
-
|
|
208
|
-
if (hasEnabledSidebar) {
|
|
209
|
-
document.documentElement.setAttribute("data-starwind-sidebar-tooltips", "enabled");
|
|
210
|
-
} else {
|
|
211
|
-
document.documentElement.removeAttribute("data-starwind-sidebar-tooltips");
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
const sidebarInstances = new WeakMap<HTMLElement, SidebarHandler>();
|
|
217
|
-
|
|
218
|
-
const setupSidebars = () => {
|
|
219
|
-
document.querySelectorAll<HTMLElement>('[data-slot="sidebar"]').forEach((sidebar) => {
|
|
220
|
-
if (sidebarInstances.has(sidebar)) return;
|
|
221
|
-
const provider = sidebar.closest<HTMLElement>('[data-slot="sidebar-provider"]');
|
|
222
|
-
if (!provider) return;
|
|
223
|
-
sidebarInstances.set(sidebar, new SidebarHandler(sidebar));
|
|
224
|
-
});
|
|
225
|
-
};
|
|
226
|
-
|
|
227
|
-
setupSidebars();
|
|
228
|
-
document.addEventListener("astro:after-swap", setupSidebars);
|
|
229
|
-
document.addEventListener("starwind:init", setupSidebars);
|
|
230
|
-
</script>
|
|
231
|
-
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import type { HTMLAttributes } from "astro/types";
|
|
3
|
-
import { cv } from "css-variants";
|
|
4
|
-
|
|
5
|
-
export interface SidebarContentProps extends HTMLAttributes<"div"> {}
|
|
6
|
-
type Props = SidebarContentProps;
|
|
7
|
-
|
|
8
|
-
export const sidebarContent = cv({
|
|
9
|
-
base: [
|
|
10
|
-
"flex min-h-0 flex-1 flex-col gap-5xs overflow-auto",
|
|
11
|
-
"group-data-[collapsible=icon]:overflow-hidden",
|
|
12
|
-
],
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
const { class: className, ...rest } = Astro.props;
|
|
16
|
-
---
|
|
17
|
-
|
|
18
|
-
<div
|
|
19
|
-
class:list={[sidebarContent(), className]}
|
|
20
|
-
data-sidebar="content"
|
|
21
|
-
{...rest}
|
|
22
|
-
data-slot="sidebar-content"
|
|
23
|
-
>
|
|
24
|
-
<slot />
|
|
25
|
-
</div>
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import type { HTMLAttributes } from "astro/types";
|
|
3
|
-
import { cv } from "css-variants";
|
|
4
|
-
|
|
5
|
-
export interface SidebarFooterProps extends HTMLAttributes<"div"> {}
|
|
6
|
-
type Props = SidebarFooterProps;
|
|
7
|
-
|
|
8
|
-
export const sidebarFooter = cv({
|
|
9
|
-
base: "flex flex-col gap-5xs p-5xs",
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
const { class: className, ...rest } = Astro.props;
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
<div
|
|
16
|
-
class:list={[sidebarFooter(), className]}
|
|
17
|
-
data-sidebar="footer"
|
|
18
|
-
{...rest}
|
|
19
|
-
data-slot="sidebar-footer"
|
|
20
|
-
>
|
|
21
|
-
<slot />
|
|
22
|
-
</div>
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import type { HTMLAttributes } from "astro/types";
|
|
3
|
-
import { cv } from "css-variants";
|
|
4
|
-
|
|
5
|
-
export interface SidebarGroupProps extends HTMLAttributes<"div"> {}
|
|
6
|
-
type Props = SidebarGroupProps;
|
|
7
|
-
|
|
8
|
-
export const sidebarGroup = cv({
|
|
9
|
-
base: "relative flex w-full min-w-0 flex-col p-5xs",
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
const { class: className, ...rest } = Astro.props;
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
<div
|
|
16
|
-
class:list={[sidebarGroup(), className]}
|
|
17
|
-
data-sidebar="group"
|
|
18
|
-
{...rest}
|
|
19
|
-
data-slot="sidebar-group"
|
|
20
|
-
>
|
|
21
|
-
<slot />
|
|
22
|
-
</div>
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import type { HTMLAttributes } from "astro/types";
|
|
3
|
-
import { cv } from "css-variants";
|
|
4
|
-
|
|
5
|
-
export interface SidebarGroupContentProps extends HTMLAttributes<"div"> {}
|
|
6
|
-
type Props = SidebarGroupContentProps;
|
|
7
|
-
|
|
8
|
-
export const sidebarGroupContent = cv({
|
|
9
|
-
base: "w-full text-sm",
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
const { class: className, ...rest } = Astro.props;
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
<div
|
|
16
|
-
class:list={[sidebarGroupContent(), className]}
|
|
17
|
-
data-sidebar="group-content"
|
|
18
|
-
{...rest}
|
|
19
|
-
data-slot="sidebar-group-content"
|
|
20
|
-
>
|
|
21
|
-
<slot />
|
|
22
|
-
</div>
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import type { HTMLAttributes } from "astro/types";
|
|
3
|
-
import { cv } from "css-variants";
|
|
4
|
-
|
|
5
|
-
export interface SidebarGroupLabelProps extends HTMLAttributes<"div"> {
|
|
6
|
-
/**
|
|
7
|
-
* Render as a child element wrapper instead of a div
|
|
8
|
-
*/
|
|
9
|
-
asChild?: boolean;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export const sidebarGroupLabel = cv({
|
|
14
|
-
base: [
|
|
15
|
-
"text-sidebar-foreground/70 ring-sidebar-outline",
|
|
16
|
-
"flex h-3xl shrink-0 items-center rounded-md px-2 text-sm font-medium",
|
|
17
|
-
"outline-hidden transition-[margin,opacity] duration-200 ease-linear",
|
|
18
|
-
"focus-visible:ring-2",
|
|
19
|
-
"[&>svg]:size-4.5 [&>svg]:shrink-0",
|
|
20
|
-
"group-data-[collapsible=icon]:-mt-10 group-data-[collapsible=icon]:op-0",
|
|
21
|
-
],
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
const { asChild = false, class: className, ...rest } = Astro.props;
|
|
25
|
-
|
|
26
|
-
let hasChildren = false;
|
|
27
|
-
if (Astro.slots.has("default")) {
|
|
28
|
-
hasChildren = true;
|
|
29
|
-
}
|
|
30
|
-
---
|
|
31
|
-
|
|
32
|
-
{
|
|
33
|
-
asChild && hasChildren ? (
|
|
34
|
-
<div
|
|
35
|
-
class:list={[sidebarGroupLabel(), className]}
|
|
36
|
-
data-sidebar="group-label"
|
|
37
|
-
data-as-child
|
|
38
|
-
{...rest}
|
|
39
|
-
data-slot="sidebar-group-label"
|
|
40
|
-
>
|
|
41
|
-
<slot />
|
|
42
|
-
</div>
|
|
43
|
-
) : (
|
|
44
|
-
<div
|
|
45
|
-
class:list={[sidebarGroupLabel(), className]}
|
|
46
|
-
data-sidebar="group-label"
|
|
47
|
-
{...rest}
|
|
48
|
-
data-slot="sidebar-group-label"
|
|
49
|
-
>
|
|
50
|
-
<slot />
|
|
51
|
-
</div>
|
|
52
|
-
)
|
|
53
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import type { HTMLAttributes } from "astro/types";
|
|
3
|
-
import { cv } from "css-variants";
|
|
4
|
-
|
|
5
|
-
export interface SidebarHeaderProps extends HTMLAttributes<"div"> {}
|
|
6
|
-
type Props = SidebarHeaderProps;
|
|
7
|
-
|
|
8
|
-
export const sidebarHeader = cv({
|
|
9
|
-
base: "flex flex-col gap-5xs p-5xs",
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
const { class: className, ...rest } = Astro.props;
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
<div
|
|
16
|
-
class:list={[sidebarHeader(), className]}
|
|
17
|
-
data-sidebar="header"
|
|
18
|
-
{...rest}
|
|
19
|
-
data-slot="sidebar-header"
|
|
20
|
-
>
|
|
21
|
-
<slot />
|
|
22
|
-
</div>
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import type { ComponentProps } from "astro/types";
|
|
3
|
-
import { cv } from "css-variants";
|
|
4
|
-
|
|
5
|
-
// eslint-disable-next-line typescript/consistent-type-imports
|
|
6
|
-
import Input from "../input/Input.astro";
|
|
7
|
-
|
|
8
|
-
const sidebarInput = cv({
|
|
9
|
-
base: "bg-background focus-visible:ring-sidebar-outline h-10 w-full shadow-none focus-visible:ring-2",
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
type Props = ComponentProps<typeof Input>;
|
|
13
|
-
|
|
14
|
-
const { size = "md", class: className, ...rest } = Astro.props;
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
<Input
|
|
18
|
-
size={size}
|
|
19
|
-
class:list={[sidebarInput(), className]}
|
|
20
|
-
data-sidebar="input"
|
|
21
|
-
{...rest}
|
|
22
|
-
data-slot="sidebar-input"
|
|
23
|
-
/>
|
|
24
|
-
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import type { HTMLAttributes } from "astro/types";
|
|
3
|
-
import { cv } from "css-variants";
|
|
4
|
-
|
|
5
|
-
export interface SidebarInsetProps extends HTMLAttributes<"main"> {}
|
|
6
|
-
type Props = SidebarInsetProps;
|
|
7
|
-
|
|
8
|
-
export const sidebarInset = cv({
|
|
9
|
-
base: [
|
|
10
|
-
"bg-background relative flex w-full flex-1 flex-col",
|
|
11
|
-
"md:peer-data-[variant=inset]:m-2xl md:peer-data-[variant=inset]:ml-0",
|
|
12
|
-
"md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm",
|
|
13
|
-
"md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2xl",
|
|
14
|
-
],
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
const { class: className, ...rest } = Astro.props;
|
|
18
|
-
---
|
|
19
|
-
|
|
20
|
-
<main class:list={[sidebarInset(), className]} {...rest} data-slot="sidebar-inset">
|
|
21
|
-
<slot />
|
|
22
|
-
</main>
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import type { HTMLAttributes } from "astro/types";
|
|
3
|
-
import { cv } from "css-variants";
|
|
4
|
-
|
|
5
|
-
export interface SidebarMenuProps extends HTMLAttributes<"ul"> {}
|
|
6
|
-
type Props = SidebarMenuProps;
|
|
7
|
-
|
|
8
|
-
export const sidebarMenu = cv({
|
|
9
|
-
base: "flex w-full min-w-0 flex-col gap-5xs",
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
const { class: className, ...rest } = Astro.props;
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
<ul
|
|
16
|
-
class:list={[sidebarMenu(), className]}
|
|
17
|
-
data-sidebar="menu"
|
|
18
|
-
{...rest}
|
|
19
|
-
data-slot="sidebar-menu"
|
|
20
|
-
>
|
|
21
|
-
<slot />
|
|
22
|
-
</ul>
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import type { ComponentProps } from "astro/types";
|
|
3
|
-
import { cv } from "css-variants";
|
|
4
|
-
|
|
5
|
-
// eslint-disable-next-line typescript/consistent-type-imports
|
|
6
|
-
import Button from "../button/Button.astro";
|
|
7
|
-
|
|
8
|
-
export interface SidebarMenuActionProps extends ComponentProps<typeof Button> {
|
|
9
|
-
/**
|
|
10
|
-
* When true, shows the action only when the menu item is hovered
|
|
11
|
-
* @default false
|
|
12
|
-
*/
|
|
13
|
-
showOnHover?: boolean;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
type Props = SidebarMenuActionProps;
|
|
17
|
-
|
|
18
|
-
export const sidebarMenuAction = cv({
|
|
19
|
-
base: [
|
|
20
|
-
"text-sidebar-foreground ring-sidebar-outline",
|
|
21
|
-
"absolute top-xs right-2xs flex aspect-square w-2xs items-center justify-center rounded-md p-0",
|
|
22
|
-
"outline-hidden transition-transform",
|
|
23
|
-
"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
24
|
-
"peer-hover/menu-button:text-sidebar-accent-foreground",
|
|
25
|
-
"[&>svg]:size-4 [&>svg]:shrink-0",
|
|
26
|
-
"after:absolute after:-inset-2 md:after:hidden",
|
|
27
|
-
"peer-data-[size=sm]/menu-button:top-2xs",
|
|
28
|
-
"peer-data-[size=default]/menu-button:top-xs",
|
|
29
|
-
"peer-data-[size=lg]/menu-button:top-sm",
|
|
30
|
-
"group-data-[collapsible=icon]:hidden",
|
|
31
|
-
],
|
|
32
|
-
variants: {
|
|
33
|
-
showOnHover: {
|
|
34
|
-
true: [
|
|
35
|
-
"peer-data-[active=true]/menu-button:text-sidebar-accent-foreground",
|
|
36
|
-
"group-focus-within/menu-item:op-100 group-hover/menu-item:op-100",
|
|
37
|
-
"data-[state=open]:op-100",
|
|
38
|
-
"md:op-0",
|
|
39
|
-
],
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
const {
|
|
45
|
-
showOnHover = false,
|
|
46
|
-
variant = "ghost",
|
|
47
|
-
size = "icon-sm",
|
|
48
|
-
class: className,
|
|
49
|
-
...rest
|
|
50
|
-
} = Astro.props;
|
|
51
|
-
---
|
|
52
|
-
|
|
53
|
-
<Button
|
|
54
|
-
variant={variant}
|
|
55
|
-
size={size}
|
|
56
|
-
class:list={[sidebarMenuAction({ showOnHover }), className]}
|
|
57
|
-
data-sidebar="menu-action"
|
|
58
|
-
{...rest}
|
|
59
|
-
data-slot="sidebar-menu-action"
|
|
60
|
-
>
|
|
61
|
-
<slot />
|
|
62
|
-
</Button>
|
|
63
|
-
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import type { HTMLAttributes } from "astro/types";
|
|
3
|
-
import { cv } from "css-variants";
|
|
4
|
-
|
|
5
|
-
export interface SidebarMenuBadgeProps extends HTMLAttributes<"div"> {}
|
|
6
|
-
type Props = SidebarMenuBadgeProps;
|
|
7
|
-
|
|
8
|
-
export const sidebarMenuBadge = cv({
|
|
9
|
-
base: [
|
|
10
|
-
"text-sidebar-foreground pointer-events-none absolute right-2xs flex h-2xs min-w-2xs",
|
|
11
|
-
"items-center justify-center rounded-md px-2xs text-xs font-medium tabular-nums select-none",
|
|
12
|
-
"peer-hover/menu-button:text-sidebar-accent-foreground",
|
|
13
|
-
"peer-data-[active=true]/menu-button:text-sidebar-accent-foreground",
|
|
14
|
-
"peer-data-[size=sm]/menu-button:top-2xs",
|
|
15
|
-
"peer-data-[size=default]/menu-button:top-xs",
|
|
16
|
-
"peer-data-[size=lg]/menu-button:top-sm",
|
|
17
|
-
"group-data-[collapsible=icon]:hidden",
|
|
18
|
-
],
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
const { class: className, ...rest } = Astro.props;
|
|
22
|
-
---
|
|
23
|
-
|
|
24
|
-
<div
|
|
25
|
-
class:list={[sidebarMenuBadge(), className]}
|
|
26
|
-
data-sidebar="menu-badge"
|
|
27
|
-
{...rest}
|
|
28
|
-
data-slot="sidebar-menu-badge"
|
|
29
|
-
>
|
|
30
|
-
<slot />
|
|
31
|
-
</div>
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import type { HTMLAttributes } from "astro/types";
|
|
3
|
-
import { cv } from "css-variants";
|
|
4
|
-
|
|
5
|
-
type VariantProps<T extends (...args: any) => any> = NonNullable<Parameters<T>[0]>;
|
|
6
|
-
|
|
7
|
-
import Tooltip from "../tooltip/Tooltip.astro";
|
|
8
|
-
import TooltipContent from "../tooltip/TooltipContent.astro";
|
|
9
|
-
import TooltipTrigger from "../tooltip/TooltipTrigger.astro";
|
|
10
|
-
|
|
11
|
-
export interface SidebarMenuButtonProps
|
|
12
|
-
extends HTMLAttributes<"button">,
|
|
13
|
-
Omit<HTMLAttributes<"a">, "type">,
|
|
14
|
-
VariantProps<typeof sidebarMenuButton> {
|
|
15
|
-
/**
|
|
16
|
-
* Render as a child element wrapper instead of a button
|
|
17
|
-
*/
|
|
18
|
-
asChild?: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* Whether the menu item is currently active
|
|
21
|
-
*/
|
|
22
|
-
isActive?: boolean;
|
|
23
|
-
/**
|
|
24
|
-
* Tooltip text to show when sidebar is collapsed
|
|
25
|
-
*/
|
|
26
|
-
tooltip?: string;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
export const sidebarMenuButton = cv({
|
|
31
|
-
base: [
|
|
32
|
-
"peer/menu-button flex w-full items-center gap-3 overflow-hidden rounded-md p-2xl text-left",
|
|
33
|
-
"ring-sidebar-outline outline-hidden transition-[width,height,padding]",
|
|
34
|
-
"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
35
|
-
"focus-visible:ring-2",
|
|
36
|
-
"active:bg-sidebar-accent active:text-sidebar-accent-foreground",
|
|
37
|
-
"disabled:pointer-events-none disabled:op-50",
|
|
38
|
-
"aria-disabled:pointer-events-none aria-disabled:op-50",
|
|
39
|
-
"group-has-data-[sidebar=menu-action]/menu-item:pr-8",
|
|
40
|
-
"data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground data-[active=true]:font-medium",
|
|
41
|
-
"data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground",
|
|
42
|
-
"group-data-[collapsible=icon]:size-10! group-data-[collapsible=icon]:p-2.5!",
|
|
43
|
-
"[&>span:last-child]:truncate [&>svg]:size-4.5 [&>svg]:shrink-0",
|
|
44
|
-
],
|
|
45
|
-
variants: {
|
|
46
|
-
variant: {
|
|
47
|
-
default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
48
|
-
outline: [
|
|
49
|
-
"bg-background shadow-sidebar-border shadow-xs",
|
|
50
|
-
"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-sidebar-accent",
|
|
51
|
-
],
|
|
52
|
-
},
|
|
53
|
-
size: {
|
|
54
|
-
default: "h-3xl text-base",
|
|
55
|
-
sm: "h-3xs text-sm",
|
|
56
|
-
lg: "h-3xl text-lg group-data-[collapsible=icon]:p-0!",
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
defaultVariants: {
|
|
60
|
-
variant: "default",
|
|
61
|
-
size: "default",
|
|
62
|
-
},
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
const {
|
|
66
|
-
asChild = false,
|
|
67
|
-
isActive = false,
|
|
68
|
-
tooltip,
|
|
69
|
-
variant,
|
|
70
|
-
size,
|
|
71
|
-
class: className,
|
|
72
|
-
...rest
|
|
73
|
-
} = Astro.props;
|
|
74
|
-
|
|
75
|
-
const Tag = Astro.props.href ? "a" : "button";
|
|
76
|
-
|
|
77
|
-
const buttonClasses = sidebarMenuButton({ variant, size });
|
|
78
|
-
const buttonDataAttrs = {
|
|
79
|
-
"data-slot": "sidebar-menu-button",
|
|
80
|
-
"data-sidebar": "menu-button",
|
|
81
|
-
"data-size": size || "default",
|
|
82
|
-
"data-active": isActive,
|
|
83
|
-
};
|
|
84
|
-
---
|
|
85
|
-
|
|
86
|
-
{
|
|
87
|
-
tooltip ? (
|
|
88
|
-
<Tooltip openDelay={0} closeDelay={0} class="starwind-sidebar-menu-button-tooltip w-full">
|
|
89
|
-
<TooltipTrigger>
|
|
90
|
-
{asChild ? (
|
|
91
|
-
<div class:list={[buttonClasses, className]} {...buttonDataAttrs} data-as-child>
|
|
92
|
-
<slot />
|
|
93
|
-
</div>
|
|
94
|
-
) : (
|
|
95
|
-
<Tag class:list={[buttonClasses, className]} {...buttonDataAttrs} {...rest}>
|
|
96
|
-
<slot />
|
|
97
|
-
</Tag>
|
|
98
|
-
)}
|
|
99
|
-
</TooltipTrigger>
|
|
100
|
-
<TooltipContent
|
|
101
|
-
side="right"
|
|
102
|
-
align="center"
|
|
103
|
-
class="starwind-sidebar-tooltip-content ws-nowrap"
|
|
104
|
-
>
|
|
105
|
-
{tooltip}
|
|
106
|
-
</TooltipContent>
|
|
107
|
-
</Tooltip>
|
|
108
|
-
) : asChild ? (
|
|
109
|
-
<div class:list={[buttonClasses, className]} {...buttonDataAttrs} data-as-child>
|
|
110
|
-
<slot />
|
|
111
|
-
</div>
|
|
112
|
-
) : (
|
|
113
|
-
<Tag class:list={[buttonClasses, className]} {...buttonDataAttrs} {...rest}>
|
|
114
|
-
<slot />
|
|
115
|
-
</Tag>
|
|
116
|
-
)
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
<style is:global>
|
|
120
|
-
:root:not([data-starwind-sidebar-tooltips="enabled"]) .starwind-sidebar-tooltip-content {
|
|
121
|
-
display: none !important;
|
|
122
|
-
}
|
|
123
|
-
</style>
|
|
124
|
-
|