@windrun-huaiin/base-ui 3.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/LICENSE +21 -0
- package/README.md +190 -0
- package/dist/base-ui.css +3 -0
- package/dist/components/index.d.mts +144 -0
- package/dist/components/index.d.ts +144 -0
- package/dist/components/index.js +1699 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/index.mjs +1741 -0
- package/dist/components/index.mjs.map +1 -0
- package/dist/index.d.mts +47 -0
- package/dist/index.d.ts +47 -0
- package/dist/index.js +6055 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +5842 -0
- package/dist/index.mjs.map +1 -0
- package/dist/lib/index.d.mts +24 -0
- package/dist/lib/index.d.ts +24 -0
- package/dist/lib/index.js +1324 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/index.mjs +1372 -0
- package/dist/lib/index.mjs.map +1 -0
- package/dist/ui/index.d.mts +754 -0
- package/dist/ui/index.d.ts +754 -0
- package/dist/ui/index.js +5796 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/index.mjs +5593 -0
- package/dist/ui/index.mjs.map +1 -0
- package/package.json +120 -0
- package/src/assets/bitcoin.tsx +23 -0
- package/src/assets/clerk.tsx +23 -0
- package/src/assets/css.tsx +21 -0
- package/src/assets/csv.tsx +35 -0
- package/src/assets/d8.tsx +25 -0
- package/src/assets/diff.tsx +23 -0
- package/src/assets/dpa.tsx +22 -0
- package/src/assets/github.tsx +23 -0
- package/src/assets/html.tsx +22 -0
- package/src/assets/http.tsx +23 -0
- package/src/assets/index.ts +61 -0
- package/src/assets/iterm.tsx +23 -0
- package/src/assets/java.tsx +23 -0
- package/src/assets/json.tsx +23 -0
- package/src/assets/last-updated.tsx +23 -0
- package/src/assets/log.tsx +28 -0
- package/src/assets/mac.tsx +23 -0
- package/src/assets/markdown.tsx +24 -0
- package/src/assets/mdx.tsx +98 -0
- package/src/assets/mermaid.tsx +24 -0
- package/src/assets/scheme.tsx +22 -0
- package/src/assets/snippets.tsx +23 -0
- package/src/assets/sql.tsx +31 -0
- package/src/assets/subp.tsx +22 -0
- package/src/assets/t3p.tsx +23 -0
- package/src/assets/test.tsx +23 -0
- package/src/assets/txt.tsx +23 -0
- package/src/assets/xml.tsx +23 -0
- package/src/assets/yaml.tsx +23 -0
- package/src/components/404-page.tsx +106 -0
- package/src/components/global-icon.tsx +193 -0
- package/src/components/go-to-top.tsx +43 -0
- package/src/components/index.ts +10 -0
- package/src/components/language-detector.tsx +175 -0
- package/src/components/language-switcher.tsx +77 -0
- package/src/components/script/google-analytics-script.tsx +56 -0
- package/src/components/script/microsoft-clarity-script.tsx +24 -0
- package/src/index.ts +4 -0
- package/src/lib/icon-context.tsx +57 -0
- package/src/lib/index.ts +3 -0
- package/src/lib/site-icon.tsx +46 -0
- package/src/lib/theme-util.ts +7 -0
- package/src/styles/base-ui.css +2 -0
- package/src/ui/accordion.tsx +58 -0
- package/src/ui/alert-dialog.tsx +141 -0
- package/src/ui/alert.tsx +59 -0
- package/src/ui/aspect-ratio.tsx +7 -0
- package/src/ui/avatar.tsx +50 -0
- package/src/ui/badge.tsx +36 -0
- package/src/ui/breadcrumb.tsx +115 -0
- package/src/ui/button.tsx +76 -0
- package/src/ui/calendar.tsx +66 -0
- package/src/ui/card.tsx +79 -0
- package/src/ui/carousel.tsx +262 -0
- package/src/ui/chart.tsx +365 -0
- package/src/ui/checkbox.tsx +30 -0
- package/src/ui/collapsible.tsx +11 -0
- package/src/ui/command.tsx +153 -0
- package/src/ui/context-menu.tsx +200 -0
- package/src/ui/dialog.tsx +122 -0
- package/src/ui/drawer.tsx +118 -0
- package/src/ui/dropdown-menu.tsx +200 -0
- package/src/ui/form.tsx +178 -0
- package/src/ui/hover-card.tsx +29 -0
- package/src/ui/index.ts +52 -0
- package/src/ui/input-otp.tsx +71 -0
- package/src/ui/input.tsx +22 -0
- package/src/ui/label.tsx +26 -0
- package/src/ui/language-button.tsx +43 -0
- package/src/ui/menubar.tsx +236 -0
- package/src/ui/navigation-menu.tsx +128 -0
- package/src/ui/pagination.tsx +117 -0
- package/src/ui/popover.tsx +31 -0
- package/src/ui/progress.tsx +28 -0
- package/src/ui/radio-group.tsx +44 -0
- package/src/ui/resizable.tsx +45 -0
- package/src/ui/scroll-area.tsx +48 -0
- package/src/ui/select.tsx +160 -0
- package/src/ui/separator.tsx +31 -0
- package/src/ui/sheet.tsx +140 -0
- package/src/ui/sidebar.tsx +763 -0
- package/src/ui/skeleton.tsx +15 -0
- package/src/ui/slider.tsx +28 -0
- package/src/ui/sonner.tsx +31 -0
- package/src/ui/switch.tsx +29 -0
- package/src/ui/table.tsx +117 -0
- package/src/ui/tabs.tsx +55 -0
- package/src/ui/textarea.tsx +22 -0
- package/src/ui/toast.tsx +129 -0
- package/src/ui/toaster.tsx +35 -0
- package/src/ui/toggle-group.tsx +61 -0
- package/src/ui/toggle.tsx +45 -0
- package/src/ui/tooltip.tsx +30 -0
- package/src/ui/use-mobile.tsx +19 -0
- package/src/ui/use-toast.ts +194 -0
@@ -0,0 +1,141 @@
|
|
1
|
+
"use client"
|
2
|
+
|
3
|
+
import * as React from "react"
|
4
|
+
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog"
|
5
|
+
|
6
|
+
import { cn } from "@lib/utils"
|
7
|
+
import { buttonVariants } from "@base-ui/ui/button"
|
8
|
+
|
9
|
+
const AlertDialog = AlertDialogPrimitive.Root
|
10
|
+
|
11
|
+
const AlertDialogTrigger = AlertDialogPrimitive.Trigger
|
12
|
+
|
13
|
+
const AlertDialogPortal = AlertDialogPrimitive.Portal
|
14
|
+
|
15
|
+
const AlertDialogOverlay = React.forwardRef<
|
16
|
+
React.ElementRef<typeof AlertDialogPrimitive.Overlay>,
|
17
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>
|
18
|
+
>(({ className, ...props }, ref) => (
|
19
|
+
<AlertDialogPrimitive.Overlay
|
20
|
+
className={cn(
|
21
|
+
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
22
|
+
className
|
23
|
+
)}
|
24
|
+
{...props}
|
25
|
+
ref={ref}
|
26
|
+
/>
|
27
|
+
))
|
28
|
+
AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName
|
29
|
+
|
30
|
+
const AlertDialogContent = React.forwardRef<
|
31
|
+
React.ElementRef<typeof AlertDialogPrimitive.Content>,
|
32
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content>
|
33
|
+
>(({ className, ...props }, ref) => (
|
34
|
+
<AlertDialogPortal>
|
35
|
+
<AlertDialogOverlay />
|
36
|
+
<AlertDialogPrimitive.Content
|
37
|
+
ref={ref}
|
38
|
+
className={cn(
|
39
|
+
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
|
40
|
+
className
|
41
|
+
)}
|
42
|
+
{...props}
|
43
|
+
/>
|
44
|
+
</AlertDialogPortal>
|
45
|
+
))
|
46
|
+
AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName
|
47
|
+
|
48
|
+
const AlertDialogHeader = ({
|
49
|
+
className,
|
50
|
+
...props
|
51
|
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
52
|
+
<div
|
53
|
+
className={cn(
|
54
|
+
"flex flex-col space-y-2 text-center sm:text-left",
|
55
|
+
className
|
56
|
+
)}
|
57
|
+
{...props}
|
58
|
+
/>
|
59
|
+
)
|
60
|
+
AlertDialogHeader.displayName = "AlertDialogHeader"
|
61
|
+
|
62
|
+
const AlertDialogFooter = ({
|
63
|
+
className,
|
64
|
+
...props
|
65
|
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
66
|
+
<div
|
67
|
+
className={cn(
|
68
|
+
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
|
69
|
+
className
|
70
|
+
)}
|
71
|
+
{...props}
|
72
|
+
/>
|
73
|
+
)
|
74
|
+
AlertDialogFooter.displayName = "AlertDialogFooter"
|
75
|
+
|
76
|
+
const AlertDialogTitle = React.forwardRef<
|
77
|
+
React.ElementRef<typeof AlertDialogPrimitive.Title>,
|
78
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>
|
79
|
+
>(({ className, ...props }, ref) => (
|
80
|
+
<AlertDialogPrimitive.Title
|
81
|
+
ref={ref}
|
82
|
+
className={cn("text-lg font-semibold", className)}
|
83
|
+
{...props}
|
84
|
+
/>
|
85
|
+
))
|
86
|
+
AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName
|
87
|
+
|
88
|
+
const AlertDialogDescription = React.forwardRef<
|
89
|
+
React.ElementRef<typeof AlertDialogPrimitive.Description>,
|
90
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>
|
91
|
+
>(({ className, ...props }, ref) => (
|
92
|
+
<AlertDialogPrimitive.Description
|
93
|
+
ref={ref}
|
94
|
+
className={cn("text-sm text-muted-foreground", className)}
|
95
|
+
{...props}
|
96
|
+
/>
|
97
|
+
))
|
98
|
+
AlertDialogDescription.displayName =
|
99
|
+
AlertDialogPrimitive.Description.displayName
|
100
|
+
|
101
|
+
const AlertDialogAction = React.forwardRef<
|
102
|
+
React.ElementRef<typeof AlertDialogPrimitive.Action>,
|
103
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action>
|
104
|
+
>(({ className, ...props }, ref) => (
|
105
|
+
<AlertDialogPrimitive.Action
|
106
|
+
ref={ref}
|
107
|
+
className={cn(buttonVariants(), className)}
|
108
|
+
{...props}
|
109
|
+
/>
|
110
|
+
))
|
111
|
+
AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName
|
112
|
+
|
113
|
+
const AlertDialogCancel = React.forwardRef<
|
114
|
+
React.ElementRef<typeof AlertDialogPrimitive.Cancel>,
|
115
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel>
|
116
|
+
>(({ className, ...props }, ref) => (
|
117
|
+
<AlertDialogPrimitive.Cancel
|
118
|
+
ref={ref}
|
119
|
+
className={cn(
|
120
|
+
buttonVariants({ variant: "outline" }),
|
121
|
+
"mt-2 sm:mt-0",
|
122
|
+
className
|
123
|
+
)}
|
124
|
+
{...props}
|
125
|
+
/>
|
126
|
+
))
|
127
|
+
AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName
|
128
|
+
|
129
|
+
export {
|
130
|
+
AlertDialog,
|
131
|
+
AlertDialogPortal,
|
132
|
+
AlertDialogOverlay,
|
133
|
+
AlertDialogTrigger,
|
134
|
+
AlertDialogContent,
|
135
|
+
AlertDialogHeader,
|
136
|
+
AlertDialogFooter,
|
137
|
+
AlertDialogTitle,
|
138
|
+
AlertDialogDescription,
|
139
|
+
AlertDialogAction,
|
140
|
+
AlertDialogCancel,
|
141
|
+
}
|
package/src/ui/alert.tsx
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
import * as React from "react"
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
3
|
+
|
4
|
+
import { cn } from "@lib/utils"
|
5
|
+
|
6
|
+
const alertVariants = cva(
|
7
|
+
"relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",
|
8
|
+
{
|
9
|
+
variants: {
|
10
|
+
variant: {
|
11
|
+
default: "bg-background text-foreground",
|
12
|
+
destructive:
|
13
|
+
"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",
|
14
|
+
},
|
15
|
+
},
|
16
|
+
defaultVariants: {
|
17
|
+
variant: "default",
|
18
|
+
},
|
19
|
+
}
|
20
|
+
)
|
21
|
+
|
22
|
+
const Alert = React.forwardRef<
|
23
|
+
HTMLDivElement,
|
24
|
+
React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>
|
25
|
+
>(({ className, variant, ...props }, ref) => (
|
26
|
+
<div
|
27
|
+
ref={ref}
|
28
|
+
role="alert"
|
29
|
+
className={cn(alertVariants({ variant }), className)}
|
30
|
+
{...props}
|
31
|
+
/>
|
32
|
+
))
|
33
|
+
Alert.displayName = "Alert"
|
34
|
+
|
35
|
+
const AlertTitle = React.forwardRef<
|
36
|
+
HTMLParagraphElement,
|
37
|
+
React.HTMLAttributes<HTMLHeadingElement>
|
38
|
+
>(({ className, ...props }, ref) => (
|
39
|
+
<h5
|
40
|
+
ref={ref}
|
41
|
+
className={cn("mb-1 font-medium leading-none tracking-tight", className)}
|
42
|
+
{...props}
|
43
|
+
/>
|
44
|
+
))
|
45
|
+
AlertTitle.displayName = "AlertTitle"
|
46
|
+
|
47
|
+
const AlertDescription = React.forwardRef<
|
48
|
+
HTMLParagraphElement,
|
49
|
+
React.HTMLAttributes<HTMLParagraphElement>
|
50
|
+
>(({ className, ...props }, ref) => (
|
51
|
+
<div
|
52
|
+
ref={ref}
|
53
|
+
className={cn("text-sm [&_p]:leading-relaxed", className)}
|
54
|
+
{...props}
|
55
|
+
/>
|
56
|
+
))
|
57
|
+
AlertDescription.displayName = "AlertDescription"
|
58
|
+
|
59
|
+
export { Alert, AlertTitle, AlertDescription }
|
@@ -0,0 +1,50 @@
|
|
1
|
+
"use client"
|
2
|
+
|
3
|
+
import * as React from "react"
|
4
|
+
import * as AvatarPrimitive from "@radix-ui/react-avatar"
|
5
|
+
|
6
|
+
import { cn } from "@lib/utils"
|
7
|
+
|
8
|
+
const Avatar = React.forwardRef<
|
9
|
+
React.ElementRef<typeof AvatarPrimitive.Root>,
|
10
|
+
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>
|
11
|
+
>(({ className, ...props }, ref) => (
|
12
|
+
<AvatarPrimitive.Root
|
13
|
+
ref={ref}
|
14
|
+
className={cn(
|
15
|
+
"relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",
|
16
|
+
className
|
17
|
+
)}
|
18
|
+
{...props}
|
19
|
+
/>
|
20
|
+
))
|
21
|
+
Avatar.displayName = AvatarPrimitive.Root.displayName
|
22
|
+
|
23
|
+
const AvatarImage = React.forwardRef<
|
24
|
+
React.ElementRef<typeof AvatarPrimitive.Image>,
|
25
|
+
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>
|
26
|
+
>(({ className, ...props }, ref) => (
|
27
|
+
<AvatarPrimitive.Image
|
28
|
+
ref={ref}
|
29
|
+
className={cn("aspect-square h-full w-full", className)}
|
30
|
+
{...props}
|
31
|
+
/>
|
32
|
+
))
|
33
|
+
AvatarImage.displayName = AvatarPrimitive.Image.displayName
|
34
|
+
|
35
|
+
const AvatarFallback = React.forwardRef<
|
36
|
+
React.ElementRef<typeof AvatarPrimitive.Fallback>,
|
37
|
+
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>
|
38
|
+
>(({ className, ...props }, ref) => (
|
39
|
+
<AvatarPrimitive.Fallback
|
40
|
+
ref={ref}
|
41
|
+
className={cn(
|
42
|
+
"flex h-full w-full items-center justify-center rounded-full bg-muted",
|
43
|
+
className
|
44
|
+
)}
|
45
|
+
{...props}
|
46
|
+
/>
|
47
|
+
))
|
48
|
+
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName
|
49
|
+
|
50
|
+
export { Avatar, AvatarImage, AvatarFallback }
|
package/src/ui/badge.tsx
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
import * as React from "react"
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
3
|
+
|
4
|
+
import { cn } from "@lib/utils"
|
5
|
+
|
6
|
+
const badgeVariants = cva(
|
7
|
+
"inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
8
|
+
{
|
9
|
+
variants: {
|
10
|
+
variant: {
|
11
|
+
default:
|
12
|
+
"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",
|
13
|
+
secondary:
|
14
|
+
"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
15
|
+
destructive:
|
16
|
+
"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",
|
17
|
+
outline: "text-foreground",
|
18
|
+
},
|
19
|
+
},
|
20
|
+
defaultVariants: {
|
21
|
+
variant: "default",
|
22
|
+
},
|
23
|
+
}
|
24
|
+
)
|
25
|
+
|
26
|
+
export interface BadgeProps
|
27
|
+
extends React.HTMLAttributes<HTMLDivElement>,
|
28
|
+
VariantProps<typeof badgeVariants> { }
|
29
|
+
|
30
|
+
function Badge({ className, variant, ...props }: BadgeProps) {
|
31
|
+
return (
|
32
|
+
<div className={cn(badgeVariants({ variant }), className)} {...props} />
|
33
|
+
)
|
34
|
+
}
|
35
|
+
|
36
|
+
export { Badge, badgeVariants }
|
@@ -0,0 +1,115 @@
|
|
1
|
+
import * as React from "react"
|
2
|
+
import { Slot } from "@radix-ui/react-slot"
|
3
|
+
import { globalLucideIcons as icons } from "@base-ui/components/global-icon"
|
4
|
+
|
5
|
+
import { cn } from "@lib/utils"
|
6
|
+
|
7
|
+
const Breadcrumb = React.forwardRef<
|
8
|
+
HTMLElement,
|
9
|
+
React.ComponentPropsWithoutRef<"nav"> & {
|
10
|
+
separator?: React.ReactNode
|
11
|
+
}
|
12
|
+
>(({ ...props }, ref) => <nav ref={ref} aria-label="breadcrumb" {...props} />)
|
13
|
+
Breadcrumb.displayName = "Breadcrumb"
|
14
|
+
|
15
|
+
const BreadcrumbList = React.forwardRef<
|
16
|
+
HTMLOListElement,
|
17
|
+
React.ComponentPropsWithoutRef<"ol">
|
18
|
+
>(({ className, ...props }, ref) => (
|
19
|
+
<ol
|
20
|
+
ref={ref}
|
21
|
+
className={cn(
|
22
|
+
"flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",
|
23
|
+
className
|
24
|
+
)}
|
25
|
+
{...props}
|
26
|
+
/>
|
27
|
+
))
|
28
|
+
BreadcrumbList.displayName = "BreadcrumbList"
|
29
|
+
|
30
|
+
const BreadcrumbItem = React.forwardRef<
|
31
|
+
HTMLLIElement,
|
32
|
+
React.ComponentPropsWithoutRef<"li">
|
33
|
+
>(({ className, ...props }, ref) => (
|
34
|
+
<li
|
35
|
+
ref={ref}
|
36
|
+
className={cn("inline-flex items-center gap-1.5", className)}
|
37
|
+
{...props}
|
38
|
+
/>
|
39
|
+
))
|
40
|
+
BreadcrumbItem.displayName = "BreadcrumbItem"
|
41
|
+
|
42
|
+
const BreadcrumbLink = React.forwardRef<
|
43
|
+
HTMLAnchorElement,
|
44
|
+
React.ComponentPropsWithoutRef<"a"> & {
|
45
|
+
asChild?: boolean
|
46
|
+
}
|
47
|
+
>(({ asChild, className, ...props }, ref) => {
|
48
|
+
const Comp = asChild ? Slot : "a"
|
49
|
+
|
50
|
+
return (
|
51
|
+
<Comp
|
52
|
+
ref={ref}
|
53
|
+
className={cn("transition-colors hover:text-foreground", className)}
|
54
|
+
{...props}
|
55
|
+
/>
|
56
|
+
)
|
57
|
+
})
|
58
|
+
BreadcrumbLink.displayName = "BreadcrumbLink"
|
59
|
+
|
60
|
+
const BreadcrumbPage = React.forwardRef<
|
61
|
+
HTMLSpanElement,
|
62
|
+
React.ComponentPropsWithoutRef<"span">
|
63
|
+
>(({ className, ...props }, ref) => (
|
64
|
+
<span
|
65
|
+
ref={ref}
|
66
|
+
role="link"
|
67
|
+
aria-disabled="true"
|
68
|
+
aria-current="page"
|
69
|
+
className={cn("font-normal text-foreground", className)}
|
70
|
+
{...props}
|
71
|
+
/>
|
72
|
+
))
|
73
|
+
BreadcrumbPage.displayName = "BreadcrumbPage"
|
74
|
+
|
75
|
+
const BreadcrumbSeparator = ({
|
76
|
+
children,
|
77
|
+
className,
|
78
|
+
...props
|
79
|
+
}: React.ComponentProps<"li">) => (
|
80
|
+
<li
|
81
|
+
role="presentation"
|
82
|
+
aria-hidden="true"
|
83
|
+
className={cn("[&>svg]:w-3.5 [&>svg]:h-3.5", className)}
|
84
|
+
{...props}
|
85
|
+
>
|
86
|
+
{children ?? <icons.ChevronRight />}
|
87
|
+
</li>
|
88
|
+
)
|
89
|
+
BreadcrumbSeparator.displayName = "BreadcrumbSeparator"
|
90
|
+
|
91
|
+
const BreadcrumbEllipsis = ({
|
92
|
+
className,
|
93
|
+
...props
|
94
|
+
}: React.ComponentProps<"span">) => (
|
95
|
+
<span
|
96
|
+
role="presentation"
|
97
|
+
aria-hidden="true"
|
98
|
+
className={cn("flex h-9 w-9 items-center justify-center", className)}
|
99
|
+
{...props}
|
100
|
+
>
|
101
|
+
<icons.MoreHorizontal className="h-4 w-4" />
|
102
|
+
<span className="sr-only">More</span>
|
103
|
+
</span>
|
104
|
+
)
|
105
|
+
BreadcrumbEllipsis.displayName = "BreadcrumbElipssis"
|
106
|
+
|
107
|
+
export {
|
108
|
+
Breadcrumb,
|
109
|
+
BreadcrumbList,
|
110
|
+
BreadcrumbItem,
|
111
|
+
BreadcrumbLink,
|
112
|
+
BreadcrumbPage,
|
113
|
+
BreadcrumbSeparator,
|
114
|
+
BreadcrumbEllipsis,
|
115
|
+
}
|
@@ -0,0 +1,76 @@
|
|
1
|
+
import * as React from "react"
|
2
|
+
import { Slot } from "@radix-ui/react-slot"
|
3
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
4
|
+
import { globalLucideIcons as icons } from "@base-ui/components/global-icon"
|
5
|
+
import { cn } from "@lib/utils"
|
6
|
+
|
7
|
+
const buttonVariants = cva(
|
8
|
+
"inline-flex items-center gap-2 whitespace-nowrap rounded-md text-sm ring-offset-background transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
9
|
+
{
|
10
|
+
variants: {
|
11
|
+
variant: {
|
12
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
13
|
+
destructive:
|
14
|
+
"bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
15
|
+
outline:
|
16
|
+
"border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
17
|
+
secondary:
|
18
|
+
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
19
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
20
|
+
link: "text-primary underline-offset-4 hover:underline",
|
21
|
+
},
|
22
|
+
size: {
|
23
|
+
default: "h-10 px-4 py-2",
|
24
|
+
sm: "h-9 rounded-md px-3",
|
25
|
+
lg: "h-11 rounded-md px-8",
|
26
|
+
icon: "h-10 w-10",
|
27
|
+
},
|
28
|
+
},
|
29
|
+
defaultVariants: {
|
30
|
+
variant: "default",
|
31
|
+
size: "default",
|
32
|
+
},
|
33
|
+
}
|
34
|
+
)
|
35
|
+
|
36
|
+
export interface ButtonProps
|
37
|
+
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
|
38
|
+
VariantProps<typeof buttonVariants> {
|
39
|
+
asChild?: boolean
|
40
|
+
loading?: boolean
|
41
|
+
align?: 'left' | 'center' | 'right'
|
42
|
+
}
|
43
|
+
|
44
|
+
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
45
|
+
({ className, variant, size, asChild = false, loading = false, children, ...props }, ref) => {
|
46
|
+
const Comp = asChild ? Slot : "button"
|
47
|
+
|
48
|
+
if (asChild) {
|
49
|
+
return (
|
50
|
+
<Comp
|
51
|
+
className={cn(buttonVariants({ variant, size, className }))}
|
52
|
+
ref={ref}
|
53
|
+
disabled={loading || props.disabled}
|
54
|
+
{...props}
|
55
|
+
>
|
56
|
+
{children}
|
57
|
+
</Comp>
|
58
|
+
)
|
59
|
+
}
|
60
|
+
|
61
|
+
return (
|
62
|
+
<Comp
|
63
|
+
className={cn(buttonVariants({ variant, size, className }))}
|
64
|
+
ref={ref}
|
65
|
+
disabled={loading || props.disabled}
|
66
|
+
{...props}
|
67
|
+
>
|
68
|
+
{children}
|
69
|
+
{loading && <icons.Loader2 className="ml-2 h-4 w-4 animate-spin" />}
|
70
|
+
</Comp>
|
71
|
+
)
|
72
|
+
}
|
73
|
+
)
|
74
|
+
Button.displayName = "Button"
|
75
|
+
|
76
|
+
export { Button, buttonVariants }
|
@@ -0,0 +1,66 @@
|
|
1
|
+
"use client"
|
2
|
+
|
3
|
+
import * as React from "react"
|
4
|
+
import { globalLucideIcons as icons } from "@base-ui/components/global-icon"
|
5
|
+
import { DayPicker } from "react-day-picker"
|
6
|
+
|
7
|
+
import { cn } from "@lib/utils"
|
8
|
+
import { buttonVariants } from "@base-ui/ui/button"
|
9
|
+
|
10
|
+
export type CalendarProps = React.ComponentProps<typeof DayPicker>
|
11
|
+
|
12
|
+
function Calendar({
|
13
|
+
className,
|
14
|
+
classNames,
|
15
|
+
showOutsideDays = true,
|
16
|
+
...props
|
17
|
+
}: CalendarProps) {
|
18
|
+
return (
|
19
|
+
<DayPicker
|
20
|
+
showOutsideDays={showOutsideDays}
|
21
|
+
className={cn("p-3", className)}
|
22
|
+
classNames={{
|
23
|
+
months: "flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",
|
24
|
+
month: "space-y-4",
|
25
|
+
caption: "flex justify-center pt-1 relative items-center",
|
26
|
+
caption_label: "text-sm font-medium",
|
27
|
+
nav: "space-x-1 flex items-center",
|
28
|
+
nav_button: cn(
|
29
|
+
buttonVariants({ variant: "outline" }),
|
30
|
+
"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"
|
31
|
+
),
|
32
|
+
nav_button_previous: "absolute left-1",
|
33
|
+
nav_button_next: "absolute right-1",
|
34
|
+
table: "w-full border-collapse space-y-1",
|
35
|
+
head_row: "flex",
|
36
|
+
head_cell:
|
37
|
+
"text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",
|
38
|
+
row: "flex w-full mt-2",
|
39
|
+
cell: "h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",
|
40
|
+
day: cn(
|
41
|
+
buttonVariants({ variant: "ghost" }),
|
42
|
+
"h-9 w-9 p-0 font-normal aria-selected:opacity-100"
|
43
|
+
),
|
44
|
+
day_range_end: "day-range-end",
|
45
|
+
day_selected:
|
46
|
+
"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",
|
47
|
+
day_today: "bg-accent text-accent-foreground",
|
48
|
+
day_outside:
|
49
|
+
"day-outside text-muted-foreground aria-selected:bg-accent/50 aria-selected:text-muted-foreground",
|
50
|
+
day_disabled: "text-muted-foreground opacity-50",
|
51
|
+
day_range_middle:
|
52
|
+
"aria-selected:bg-accent aria-selected:text-accent-foreground",
|
53
|
+
day_hidden: "invisible",
|
54
|
+
...classNames,
|
55
|
+
}}
|
56
|
+
components={{
|
57
|
+
IconLeft: ({ ..._props }) => <icons.ChevronLeft className="h-4 w-4" />,
|
58
|
+
IconRight: ({ ..._props }) => <icons.ChevronRight className="h-4 w-4" />,
|
59
|
+
}}
|
60
|
+
{...props}
|
61
|
+
/>
|
62
|
+
)
|
63
|
+
}
|
64
|
+
Calendar.displayName = "Calendar"
|
65
|
+
|
66
|
+
export { Calendar }
|
package/src/ui/card.tsx
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
import * as React from "react"
|
2
|
+
|
3
|
+
import { cn } from "@lib/utils"
|
4
|
+
|
5
|
+
const Card = React.forwardRef<
|
6
|
+
HTMLDivElement,
|
7
|
+
React.HTMLAttributes<HTMLDivElement>
|
8
|
+
>(({ className, ...props }, ref) => (
|
9
|
+
<div
|
10
|
+
ref={ref}
|
11
|
+
className={cn(
|
12
|
+
"rounded-lg border bg-card text-card-foreground shadow-xs",
|
13
|
+
className
|
14
|
+
)}
|
15
|
+
{...props}
|
16
|
+
/>
|
17
|
+
))
|
18
|
+
Card.displayName = "Card"
|
19
|
+
|
20
|
+
const CardHeader = React.forwardRef<
|
21
|
+
HTMLDivElement,
|
22
|
+
React.HTMLAttributes<HTMLDivElement>
|
23
|
+
>(({ className, ...props }, ref) => (
|
24
|
+
<div
|
25
|
+
ref={ref}
|
26
|
+
className={cn("flex flex-col space-y-1.5 p-6", className)}
|
27
|
+
{...props}
|
28
|
+
/>
|
29
|
+
))
|
30
|
+
CardHeader.displayName = "CardHeader"
|
31
|
+
|
32
|
+
const CardTitle = React.forwardRef<
|
33
|
+
HTMLDivElement,
|
34
|
+
React.HTMLAttributes<HTMLDivElement>
|
35
|
+
>(({ className, ...props }, ref) => (
|
36
|
+
<div
|
37
|
+
ref={ref}
|
38
|
+
className={cn(
|
39
|
+
"text-2xl font-semibold leading-none tracking-tight",
|
40
|
+
className
|
41
|
+
)}
|
42
|
+
{...props}
|
43
|
+
/>
|
44
|
+
))
|
45
|
+
CardTitle.displayName = "CardTitle"
|
46
|
+
|
47
|
+
const CardDescription = React.forwardRef<
|
48
|
+
HTMLDivElement,
|
49
|
+
React.HTMLAttributes<HTMLDivElement>
|
50
|
+
>(({ className, ...props }, ref) => (
|
51
|
+
<div
|
52
|
+
ref={ref}
|
53
|
+
className={cn("text-sm text-muted-foreground", className)}
|
54
|
+
{...props}
|
55
|
+
/>
|
56
|
+
))
|
57
|
+
CardDescription.displayName = "CardDescription"
|
58
|
+
|
59
|
+
const CardContent = React.forwardRef<
|
60
|
+
HTMLDivElement,
|
61
|
+
React.HTMLAttributes<HTMLDivElement>
|
62
|
+
>(({ className, ...props }, ref) => (
|
63
|
+
<div ref={ref} className={cn("p-6 pt-0", className)} {...props} />
|
64
|
+
))
|
65
|
+
CardContent.displayName = "CardContent"
|
66
|
+
|
67
|
+
const CardFooter = React.forwardRef<
|
68
|
+
HTMLDivElement,
|
69
|
+
React.HTMLAttributes<HTMLDivElement>
|
70
|
+
>(({ className, ...props }, ref) => (
|
71
|
+
<div
|
72
|
+
ref={ref}
|
73
|
+
className={cn("flex items-center p-6 pt-0", className)}
|
74
|
+
{...props}
|
75
|
+
/>
|
76
|
+
))
|
77
|
+
CardFooter.displayName = "CardFooter"
|
78
|
+
|
79
|
+
export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent }
|