@open-lakehouse/ui-kit 0.0.0-stage → 0.0.1
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/DESIGN.md +105 -0
- package/README.md +44 -2
- package/dist/ThemeProvider.d.ts +11 -0
- package/dist/ThemeProvider.d.ts.map +1 -0
- package/dist/ThemeProvider.js +40 -0
- package/dist/ThemeProvider.js.map +1 -0
- package/dist/badge.d.ts +10 -0
- package/dist/badge.d.ts.map +1 -0
- package/dist/badge.js +22 -0
- package/dist/badge.js.map +1 -0
- package/dist/button.d.ts +12 -0
- package/dist/button.d.ts.map +1 -0
- package/dist/button.js +34 -0
- package/dist/button.js.map +1 -0
- package/dist/card.d.ts +9 -0
- package/dist/card.d.ts.map +1 -0
- package/dist/card.js +20 -0
- package/dist/card.js.map +1 -0
- package/dist/dialog.d.ts +22 -0
- package/dist/dialog.d.ts.map +1 -0
- package/dist/dialog.js +27 -0
- package/dist/dialog.js.map +1 -0
- package/dist/dropdown-menu.d.ts +16 -0
- package/dist/dropdown-menu.d.ts.map +1 -0
- package/dist/dropdown-menu.js +23 -0
- package/dist/dropdown-menu.js.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/input.d.ts +4 -0
- package/dist/input.d.ts.map +1 -0
- package/dist/input.js +11 -0
- package/dist/input.js.map +1 -0
- package/dist/label.d.ts +5 -0
- package/dist/label.d.ts.map +1 -0
- package/dist/label.js +8 -0
- package/dist/label.js.map +1 -0
- package/dist/resizable.d.ts +29 -0
- package/dist/resizable.d.ts.map +1 -0
- package/dist/resizable.js +54 -0
- package/dist/resizable.js.map +1 -0
- package/dist/select.d.ts +10 -0
- package/dist/select.d.ts.map +1 -0
- package/dist/select.js +23 -0
- package/dist/select.js.map +1 -0
- package/dist/separator.d.ts +6 -0
- package/dist/separator.d.ts.map +1 -0
- package/dist/separator.js +7 -0
- package/dist/separator.js.map +1 -0
- package/dist/sheet.d.ts +23 -0
- package/dist/sheet.d.ts.map +1 -0
- package/dist/sheet.js +37 -0
- package/dist/sheet.js.map +1 -0
- package/dist/sonner.d.ts +3 -0
- package/dist/sonner.d.ts.map +1 -0
- package/dist/sonner.js +15 -0
- package/dist/sonner.js.map +1 -0
- package/dist/switch.d.ts +8 -0
- package/dist/switch.d.ts.map +1 -0
- package/dist/switch.js +9 -0
- package/dist/switch.js.map +1 -0
- package/dist/tabs.d.ts +8 -0
- package/dist/tabs.d.ts.map +1 -0
- package/dist/tabs.js +13 -0
- package/dist/tabs.js.map +1 -0
- package/dist/textarea.d.ts +4 -0
- package/dist/textarea.d.ts.map +1 -0
- package/dist/textarea.js +11 -0
- package/dist/textarea.js.map +1 -0
- package/dist/tooltip.d.ts +8 -0
- package/dist/tooltip.d.ts.map +1 -0
- package/dist/tooltip.js +11 -0
- package/dist/tooltip.js.map +1 -0
- package/dist/utils.d.ts +3 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +6 -0
- package/dist/utils.js.map +1 -0
- package/package.json +54 -4
- package/src/ThemeProvider.tsx +57 -0
- package/src/badge.tsx +34 -0
- package/src/button.tsx +56 -0
- package/src/card.tsx +87 -0
- package/src/dialog.tsx +119 -0
- package/src/dropdown-menu.tsx +99 -0
- package/src/index.ts +78 -0
- package/src/input.tsx +27 -0
- package/src/label.tsx +21 -0
- package/src/resizable.tsx +95 -0
- package/src/select.tsx +127 -0
- package/src/separator.tsx +25 -0
- package/src/sheet.tsx +131 -0
- package/src/sonner.tsx +26 -0
- package/src/switch.tsx +47 -0
- package/src/tabs.tsx +53 -0
- package/src/textarea.tsx +25 -0
- package/src/tooltip.tsx +28 -0
- package/src/utils.ts +6 -0
package/src/button.tsx
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
2
|
+
import { Slot as SlotPrimitive } from "radix-ui";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
|
|
5
|
+
import { cn } from "./utils.js";
|
|
6
|
+
|
|
7
|
+
const buttonVariants = cva(
|
|
8
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none 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
|
+
}
|
|
41
|
+
|
|
42
|
+
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
43
|
+
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
44
|
+
const Comp = asChild ? SlotPrimitive.Slot : "button";
|
|
45
|
+
return (
|
|
46
|
+
<Comp
|
|
47
|
+
className={cn(buttonVariants({ variant, size, className }))}
|
|
48
|
+
ref={ref}
|
|
49
|
+
{...props}
|
|
50
|
+
/>
|
|
51
|
+
);
|
|
52
|
+
},
|
|
53
|
+
);
|
|
54
|
+
Button.displayName = "Button";
|
|
55
|
+
|
|
56
|
+
export { Button, buttonVariants };
|
package/src/card.tsx
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import { cn } from "./utils.js";
|
|
4
|
+
|
|
5
|
+
// A raised surface for grouping content (the module/capability picker tiles, panels).
|
|
6
|
+
// Headless with respect to theme: it emits `bg-card`/`text-card-foreground`/`border`
|
|
7
|
+
// semantic utilities and owns no color values, per the ui-kit DESIGN.md contract.
|
|
8
|
+
|
|
9
|
+
const Card = React.forwardRef<
|
|
10
|
+
HTMLDivElement,
|
|
11
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
12
|
+
>(({ className, ...props }, ref) => (
|
|
13
|
+
<div
|
|
14
|
+
ref={ref}
|
|
15
|
+
className={cn(
|
|
16
|
+
"rounded-lg border bg-card text-card-foreground shadow-sm",
|
|
17
|
+
className,
|
|
18
|
+
)}
|
|
19
|
+
{...props}
|
|
20
|
+
/>
|
|
21
|
+
));
|
|
22
|
+
Card.displayName = "Card";
|
|
23
|
+
|
|
24
|
+
const CardHeader = React.forwardRef<
|
|
25
|
+
HTMLDivElement,
|
|
26
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
27
|
+
>(({ className, ...props }, ref) => (
|
|
28
|
+
<div
|
|
29
|
+
ref={ref}
|
|
30
|
+
className={cn("flex flex-col gap-1 p-4", className)}
|
|
31
|
+
{...props}
|
|
32
|
+
/>
|
|
33
|
+
));
|
|
34
|
+
CardHeader.displayName = "CardHeader";
|
|
35
|
+
|
|
36
|
+
const CardTitle = React.forwardRef<
|
|
37
|
+
HTMLDivElement,
|
|
38
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
39
|
+
>(({ className, ...props }, ref) => (
|
|
40
|
+
<div
|
|
41
|
+
ref={ref}
|
|
42
|
+
className={cn("text-sm font-semibold leading-none", className)}
|
|
43
|
+
{...props}
|
|
44
|
+
/>
|
|
45
|
+
));
|
|
46
|
+
CardTitle.displayName = "CardTitle";
|
|
47
|
+
|
|
48
|
+
const CardDescription = React.forwardRef<
|
|
49
|
+
HTMLDivElement,
|
|
50
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
51
|
+
>(({ className, ...props }, ref) => (
|
|
52
|
+
<div
|
|
53
|
+
ref={ref}
|
|
54
|
+
className={cn("text-xs text-muted-foreground", className)}
|
|
55
|
+
{...props}
|
|
56
|
+
/>
|
|
57
|
+
));
|
|
58
|
+
CardDescription.displayName = "CardDescription";
|
|
59
|
+
|
|
60
|
+
const CardContent = React.forwardRef<
|
|
61
|
+
HTMLDivElement,
|
|
62
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
63
|
+
>(({ className, ...props }, ref) => (
|
|
64
|
+
<div ref={ref} className={cn("p-4 pt-0", className)} {...props} />
|
|
65
|
+
));
|
|
66
|
+
CardContent.displayName = "CardContent";
|
|
67
|
+
|
|
68
|
+
const CardFooter = React.forwardRef<
|
|
69
|
+
HTMLDivElement,
|
|
70
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
71
|
+
>(({ className, ...props }, ref) => (
|
|
72
|
+
<div
|
|
73
|
+
ref={ref}
|
|
74
|
+
className={cn("flex items-center p-4 pt-0", className)}
|
|
75
|
+
{...props}
|
|
76
|
+
/>
|
|
77
|
+
));
|
|
78
|
+
CardFooter.displayName = "CardFooter";
|
|
79
|
+
|
|
80
|
+
export {
|
|
81
|
+
Card,
|
|
82
|
+
CardContent,
|
|
83
|
+
CardDescription,
|
|
84
|
+
CardFooter,
|
|
85
|
+
CardHeader,
|
|
86
|
+
CardTitle,
|
|
87
|
+
};
|
package/src/dialog.tsx
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { X } from "lucide-react";
|
|
2
|
+
import { Dialog as DialogPrimitive } from "radix-ui";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
|
|
5
|
+
import { cn } from "./utils.js";
|
|
6
|
+
|
|
7
|
+
const Dialog = DialogPrimitive.Root;
|
|
8
|
+
const DialogTrigger = DialogPrimitive.Trigger;
|
|
9
|
+
const DialogPortal = DialogPrimitive.Portal;
|
|
10
|
+
const DialogClose = DialogPrimitive.Close;
|
|
11
|
+
|
|
12
|
+
const DialogOverlay = React.forwardRef<
|
|
13
|
+
React.ComponentRef<typeof DialogPrimitive.Overlay>,
|
|
14
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
|
|
15
|
+
>(({ className, ...props }, ref) => (
|
|
16
|
+
<DialogPrimitive.Overlay
|
|
17
|
+
ref={ref}
|
|
18
|
+
className={cn(
|
|
19
|
+
"fixed inset-0 z-50 bg-black/50 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
20
|
+
className,
|
|
21
|
+
)}
|
|
22
|
+
{...props}
|
|
23
|
+
/>
|
|
24
|
+
));
|
|
25
|
+
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
26
|
+
|
|
27
|
+
const DialogContent = React.forwardRef<
|
|
28
|
+
React.ComponentRef<typeof DialogPrimitive.Content>,
|
|
29
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> & {
|
|
30
|
+
showClose?: boolean;
|
|
31
|
+
}
|
|
32
|
+
>(({ className, children, showClose = true, ...props }, ref) => (
|
|
33
|
+
<DialogPortal>
|
|
34
|
+
<DialogOverlay />
|
|
35
|
+
<DialogPrimitive.Content
|
|
36
|
+
ref={ref}
|
|
37
|
+
className={cn(
|
|
38
|
+
"fixed left-1/2 top-1/2 z-50 grid w-full max-w-md -translate-x-1/2 -translate-y-1/2 gap-4 border bg-card p-0 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 sm:rounded-lg",
|
|
39
|
+
className,
|
|
40
|
+
)}
|
|
41
|
+
{...props}
|
|
42
|
+
>
|
|
43
|
+
{children}
|
|
44
|
+
{showClose && (
|
|
45
|
+
<DialogPrimitive.Close className="absolute right-3 top-3 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none">
|
|
46
|
+
<X className="h-4 w-4" />
|
|
47
|
+
<span className="sr-only">Close</span>
|
|
48
|
+
</DialogPrimitive.Close>
|
|
49
|
+
)}
|
|
50
|
+
</DialogPrimitive.Content>
|
|
51
|
+
</DialogPortal>
|
|
52
|
+
));
|
|
53
|
+
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
54
|
+
|
|
55
|
+
function DialogHeader({
|
|
56
|
+
className,
|
|
57
|
+
...props
|
|
58
|
+
}: React.HTMLAttributes<HTMLDivElement>) {
|
|
59
|
+
return (
|
|
60
|
+
<div
|
|
61
|
+
className={cn(
|
|
62
|
+
"flex flex-col space-y-1.5 border-b px-5 py-3 text-left",
|
|
63
|
+
className,
|
|
64
|
+
)}
|
|
65
|
+
{...props}
|
|
66
|
+
/>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
DialogHeader.displayName = "DialogHeader";
|
|
70
|
+
|
|
71
|
+
function DialogFooter({
|
|
72
|
+
className,
|
|
73
|
+
...props
|
|
74
|
+
}: React.HTMLAttributes<HTMLDivElement>) {
|
|
75
|
+
return (
|
|
76
|
+
<div
|
|
77
|
+
className={cn("flex justify-end gap-2 border-t px-5 py-3", className)}
|
|
78
|
+
{...props}
|
|
79
|
+
/>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
DialogFooter.displayName = "DialogFooter";
|
|
83
|
+
|
|
84
|
+
const DialogTitle = React.forwardRef<
|
|
85
|
+
React.ComponentRef<typeof DialogPrimitive.Title>,
|
|
86
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
|
|
87
|
+
>(({ className, ...props }, ref) => (
|
|
88
|
+
<DialogPrimitive.Title
|
|
89
|
+
ref={ref}
|
|
90
|
+
className={cn("text-sm font-semibold leading-none", className)}
|
|
91
|
+
{...props}
|
|
92
|
+
/>
|
|
93
|
+
));
|
|
94
|
+
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
95
|
+
|
|
96
|
+
const DialogDescription = React.forwardRef<
|
|
97
|
+
React.ComponentRef<typeof DialogPrimitive.Description>,
|
|
98
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
|
|
99
|
+
>(({ className, ...props }, ref) => (
|
|
100
|
+
<DialogPrimitive.Description
|
|
101
|
+
ref={ref}
|
|
102
|
+
className={cn("text-xs text-muted-foreground", className)}
|
|
103
|
+
{...props}
|
|
104
|
+
/>
|
|
105
|
+
));
|
|
106
|
+
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
107
|
+
|
|
108
|
+
export {
|
|
109
|
+
Dialog,
|
|
110
|
+
DialogClose,
|
|
111
|
+
DialogContent,
|
|
112
|
+
DialogDescription,
|
|
113
|
+
DialogFooter,
|
|
114
|
+
DialogHeader,
|
|
115
|
+
DialogOverlay,
|
|
116
|
+
DialogPortal,
|
|
117
|
+
DialogTitle,
|
|
118
|
+
DialogTrigger,
|
|
119
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
import { cn } from "./utils.js";
|
|
5
|
+
|
|
6
|
+
const DropdownMenu = DropdownMenuPrimitive.Root;
|
|
7
|
+
const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
8
|
+
const DropdownMenuGroup = DropdownMenuPrimitive.Group;
|
|
9
|
+
const DropdownMenuPortal = DropdownMenuPrimitive.Portal;
|
|
10
|
+
|
|
11
|
+
const DropdownMenuContent = React.forwardRef<
|
|
12
|
+
React.ComponentRef<typeof DropdownMenuPrimitive.Content>,
|
|
13
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>
|
|
14
|
+
>(({ className, sideOffset = 4, ...props }, ref) => (
|
|
15
|
+
<DropdownMenuPrimitive.Portal>
|
|
16
|
+
<DropdownMenuPrimitive.Content
|
|
17
|
+
ref={ref}
|
|
18
|
+
sideOffset={sideOffset}
|
|
19
|
+
className={cn(
|
|
20
|
+
"z-50 min-w-[12rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
|
|
21
|
+
"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
|
+
/>
|
|
26
|
+
</DropdownMenuPrimitive.Portal>
|
|
27
|
+
));
|
|
28
|
+
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
29
|
+
|
|
30
|
+
const DropdownMenuItem = React.forwardRef<
|
|
31
|
+
React.ComponentRef<typeof DropdownMenuPrimitive.Item>,
|
|
32
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {
|
|
33
|
+
variant?: "default" | "destructive";
|
|
34
|
+
}
|
|
35
|
+
>(({ className, variant = "default", ...props }, ref) => (
|
|
36
|
+
<DropdownMenuPrimitive.Item
|
|
37
|
+
ref={ref}
|
|
38
|
+
className={cn(
|
|
39
|
+
"relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:size-4 [&_svg]:shrink-0",
|
|
40
|
+
variant === "destructive" &&
|
|
41
|
+
"text-destructive focus:bg-destructive/10 focus:text-destructive",
|
|
42
|
+
className,
|
|
43
|
+
)}
|
|
44
|
+
{...props}
|
|
45
|
+
/>
|
|
46
|
+
));
|
|
47
|
+
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
|
|
48
|
+
|
|
49
|
+
const DropdownMenuLabel = React.forwardRef<
|
|
50
|
+
React.ComponentRef<typeof DropdownMenuPrimitive.Label>,
|
|
51
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label>
|
|
52
|
+
>(({ className, ...props }, ref) => (
|
|
53
|
+
<DropdownMenuPrimitive.Label
|
|
54
|
+
ref={ref}
|
|
55
|
+
className={cn(
|
|
56
|
+
"px-2 py-1 text-[11px] font-medium uppercase tracking-wider text-muted-foreground",
|
|
57
|
+
className,
|
|
58
|
+
)}
|
|
59
|
+
{...props}
|
|
60
|
+
/>
|
|
61
|
+
));
|
|
62
|
+
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
|
|
63
|
+
|
|
64
|
+
const DropdownMenuSeparator = React.forwardRef<
|
|
65
|
+
React.ComponentRef<typeof DropdownMenuPrimitive.Separator>,
|
|
66
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>
|
|
67
|
+
>(({ className, ...props }, ref) => (
|
|
68
|
+
<DropdownMenuPrimitive.Separator
|
|
69
|
+
ref={ref}
|
|
70
|
+
className={cn("-mx-1 my-1 h-px bg-border", className)}
|
|
71
|
+
{...props}
|
|
72
|
+
/>
|
|
73
|
+
));
|
|
74
|
+
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
|
|
75
|
+
|
|
76
|
+
/** A hint at an item's end, e.g. a file extension. */
|
|
77
|
+
function DropdownMenuShortcut({
|
|
78
|
+
className,
|
|
79
|
+
...props
|
|
80
|
+
}: React.HTMLAttributes<HTMLSpanElement>) {
|
|
81
|
+
return (
|
|
82
|
+
<span
|
|
83
|
+
className={cn("ml-auto text-xs text-muted-foreground", className)}
|
|
84
|
+
{...props}
|
|
85
|
+
/>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export {
|
|
90
|
+
DropdownMenu,
|
|
91
|
+
DropdownMenuContent,
|
|
92
|
+
DropdownMenuGroup,
|
|
93
|
+
DropdownMenuItem,
|
|
94
|
+
DropdownMenuLabel,
|
|
95
|
+
DropdownMenuPortal,
|
|
96
|
+
DropdownMenuSeparator,
|
|
97
|
+
DropdownMenuShortcut,
|
|
98
|
+
DropdownMenuTrigger,
|
|
99
|
+
};
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// Public surface of the shared UI kit: the shadcn/Radix primitives, the `cn`
|
|
2
|
+
// class-merge helper, and the theme context. Every Open Lakehouse web UI
|
|
3
|
+
// (trestle's env-editor, mangrove's Unity Catalog UI, headwaters' lineage UI)
|
|
4
|
+
// depends on this package rather than carrying its own copy of the primitives.
|
|
5
|
+
// The token contract lives in ./DESIGN.md.
|
|
6
|
+
|
|
7
|
+
export { Badge, type BadgeProps, badgeVariants } from "./badge.js";
|
|
8
|
+
export { Button, type ButtonProps, buttonVariants } from "./button.js";
|
|
9
|
+
export {
|
|
10
|
+
Card,
|
|
11
|
+
CardContent,
|
|
12
|
+
CardDescription,
|
|
13
|
+
CardFooter,
|
|
14
|
+
CardHeader,
|
|
15
|
+
CardTitle,
|
|
16
|
+
} from "./card.js";
|
|
17
|
+
export {
|
|
18
|
+
Dialog,
|
|
19
|
+
DialogClose,
|
|
20
|
+
DialogContent,
|
|
21
|
+
DialogDescription,
|
|
22
|
+
DialogFooter,
|
|
23
|
+
DialogHeader,
|
|
24
|
+
DialogOverlay,
|
|
25
|
+
DialogPortal,
|
|
26
|
+
DialogTitle,
|
|
27
|
+
DialogTrigger,
|
|
28
|
+
} from "./dialog.js";
|
|
29
|
+
export {
|
|
30
|
+
DropdownMenu,
|
|
31
|
+
DropdownMenuContent,
|
|
32
|
+
DropdownMenuGroup,
|
|
33
|
+
DropdownMenuItem,
|
|
34
|
+
DropdownMenuLabel,
|
|
35
|
+
DropdownMenuPortal,
|
|
36
|
+
DropdownMenuSeparator,
|
|
37
|
+
DropdownMenuShortcut,
|
|
38
|
+
DropdownMenuTrigger,
|
|
39
|
+
} from "./dropdown-menu.js";
|
|
40
|
+
export { Input } from "./input.js";
|
|
41
|
+
export { Label } from "./label.js";
|
|
42
|
+
export {
|
|
43
|
+
ResizeHandle,
|
|
44
|
+
type ResizeHandleProps,
|
|
45
|
+
usePaneSize,
|
|
46
|
+
} from "./resizable.js";
|
|
47
|
+
export {
|
|
48
|
+
Select,
|
|
49
|
+
SelectContent,
|
|
50
|
+
SelectGroup,
|
|
51
|
+
SelectItem,
|
|
52
|
+
SelectTrigger,
|
|
53
|
+
SelectValue,
|
|
54
|
+
} from "./select.js";
|
|
55
|
+
export { Separator } from "./separator.js";
|
|
56
|
+
export {
|
|
57
|
+
Sheet,
|
|
58
|
+
SheetClose,
|
|
59
|
+
SheetContent,
|
|
60
|
+
SheetDescription,
|
|
61
|
+
SheetHeader,
|
|
62
|
+
SheetOverlay,
|
|
63
|
+
SheetPortal,
|
|
64
|
+
SheetTitle,
|
|
65
|
+
SheetTrigger,
|
|
66
|
+
} from "./sheet.js";
|
|
67
|
+
export { Toaster } from "./sonner.js";
|
|
68
|
+
export { Switch, type SwitchProps } from "./switch.js";
|
|
69
|
+
export { ThemeProvider, useTheme } from "./ThemeProvider.js";
|
|
70
|
+
export { Tabs, TabsContent, TabsList, TabsTrigger } from "./tabs.js";
|
|
71
|
+
export { Textarea } from "./textarea.js";
|
|
72
|
+
export {
|
|
73
|
+
Tooltip,
|
|
74
|
+
TooltipContent,
|
|
75
|
+
TooltipProvider,
|
|
76
|
+
TooltipTrigger,
|
|
77
|
+
} from "./tooltip.js";
|
|
78
|
+
export { cn } from "./utils.js";
|
package/src/input.tsx
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import { cn } from "./utils.js";
|
|
4
|
+
|
|
5
|
+
const Input = React.forwardRef<
|
|
6
|
+
HTMLInputElement,
|
|
7
|
+
React.InputHTMLAttributes<HTMLInputElement>
|
|
8
|
+
>(({ className, type, ...props }, ref) => (
|
|
9
|
+
<input
|
|
10
|
+
type={type}
|
|
11
|
+
ref={ref}
|
|
12
|
+
// Identifier/data fields: suppress the browser's text-correction so it
|
|
13
|
+
// doesn't capitalize or "fix" what the user typed. Listed before {...props}
|
|
14
|
+
// so a specific field can opt back in (e.g. a free-text comment).
|
|
15
|
+
autoCapitalize="off"
|
|
16
|
+
autoCorrect="off"
|
|
17
|
+
spellCheck={false}
|
|
18
|
+
className={cn(
|
|
19
|
+
"flex h-9 w-full rounded-md border border-input bg-background px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50",
|
|
20
|
+
className,
|
|
21
|
+
)}
|
|
22
|
+
{...props}
|
|
23
|
+
/>
|
|
24
|
+
));
|
|
25
|
+
Input.displayName = "Input";
|
|
26
|
+
|
|
27
|
+
export { Input };
|
package/src/label.tsx
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Label as LabelPrimitive } from "radix-ui";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
import { cn } from "./utils.js";
|
|
5
|
+
|
|
6
|
+
const Label = React.forwardRef<
|
|
7
|
+
React.ComponentRef<typeof LabelPrimitive.Root>,
|
|
8
|
+
React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>
|
|
9
|
+
>(({ className, ...props }, ref) => (
|
|
10
|
+
<LabelPrimitive.Root
|
|
11
|
+
ref={ref}
|
|
12
|
+
className={cn(
|
|
13
|
+
"text-xs font-medium text-muted-foreground peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
|
14
|
+
className,
|
|
15
|
+
)}
|
|
16
|
+
{...props}
|
|
17
|
+
/>
|
|
18
|
+
));
|
|
19
|
+
Label.displayName = LabelPrimitive.Root.displayName;
|
|
20
|
+
|
|
21
|
+
export { Label };
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import { cn } from "./utils.js";
|
|
4
|
+
|
|
5
|
+
export interface ResizeHandleProps
|
|
6
|
+
extends Omit<React.HTMLAttributes<HTMLDivElement>, "onResize"> {
|
|
7
|
+
/** `vertical` sits between side-by-side panes (drag left/right);
|
|
8
|
+
* `horizontal` between stacked ones (drag up/down). */
|
|
9
|
+
orientation: "vertical" | "horizontal";
|
|
10
|
+
/** Called with how far the pointer moved since the last call, in pixels:
|
|
11
|
+
* positive is right / down. */
|
|
12
|
+
onResize: (delta: number) => void;
|
|
13
|
+
/** The size of the pane it resizes, in pixels (its `aria-valuenow`). */
|
|
14
|
+
size: number;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* A draggable divider between two panes. It reports pointer movement; the
|
|
19
|
+
* owner keeps the pane's size (see {@link usePaneSize}). Arrow keys nudge it
|
|
20
|
+
* when focused.
|
|
21
|
+
*/
|
|
22
|
+
function ResizeHandle({
|
|
23
|
+
orientation,
|
|
24
|
+
onResize,
|
|
25
|
+
size,
|
|
26
|
+
className,
|
|
27
|
+
...props
|
|
28
|
+
}: ResizeHandleProps) {
|
|
29
|
+
const last = React.useRef<number | null>(null);
|
|
30
|
+
const vertical = orientation === "vertical";
|
|
31
|
+
return (
|
|
32
|
+
// biome-ignore lint/a11y/useSemanticElements: a draggable splitter, not a rule
|
|
33
|
+
<div
|
|
34
|
+
role="separator"
|
|
35
|
+
aria-orientation={vertical ? "vertical" : "horizontal"}
|
|
36
|
+
aria-valuenow={size}
|
|
37
|
+
tabIndex={0}
|
|
38
|
+
className={cn(
|
|
39
|
+
"relative shrink-0 bg-border transition-colors hover:bg-primary/60 focus-visible:bg-primary focus-visible:outline-none",
|
|
40
|
+
vertical ? "w-px cursor-col-resize" : "h-px cursor-row-resize",
|
|
41
|
+
// A wider invisible grab area around the 1px line.
|
|
42
|
+
vertical
|
|
43
|
+
? "after:absolute after:inset-y-0 after:-left-1 after:-right-1"
|
|
44
|
+
: "after:absolute after:inset-x-0 after:-top-1 after:-bottom-1",
|
|
45
|
+
className,
|
|
46
|
+
)}
|
|
47
|
+
onPointerDown={(e) => {
|
|
48
|
+
e.currentTarget.setPointerCapture(e.pointerId);
|
|
49
|
+
last.current = vertical ? e.clientX : e.clientY;
|
|
50
|
+
}}
|
|
51
|
+
onPointerMove={(e) => {
|
|
52
|
+
if (last.current === null) return;
|
|
53
|
+
const at = vertical ? e.clientX : e.clientY;
|
|
54
|
+
onResize(at - last.current);
|
|
55
|
+
last.current = at;
|
|
56
|
+
}}
|
|
57
|
+
onPointerUp={(e) => {
|
|
58
|
+
e.currentTarget.releasePointerCapture(e.pointerId);
|
|
59
|
+
last.current = null;
|
|
60
|
+
}}
|
|
61
|
+
onKeyDown={(e) => {
|
|
62
|
+
const step = e.shiftKey ? 48 : 12;
|
|
63
|
+
const back = vertical ? "ArrowLeft" : "ArrowUp";
|
|
64
|
+
const forward = vertical ? "ArrowRight" : "ArrowDown";
|
|
65
|
+
if (e.key === back) onResize(-step);
|
|
66
|
+
else if (e.key === forward) onResize(step);
|
|
67
|
+
else return;
|
|
68
|
+
e.preventDefault();
|
|
69
|
+
}}
|
|
70
|
+
{...props}
|
|
71
|
+
/>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* A pane size in pixels, clamped to `[min, max]`, with a `resize(delta)` for a
|
|
77
|
+
* {@link ResizeHandle}. `invert` flips the delta, for a pane on the far side of
|
|
78
|
+
* its handle (a right sidebar, a bottom panel).
|
|
79
|
+
*/
|
|
80
|
+
function usePaneSize(
|
|
81
|
+
initial: number,
|
|
82
|
+
{ min, max, invert = false }: { min: number; max: number; invert?: boolean },
|
|
83
|
+
): [number, (delta: number) => void] {
|
|
84
|
+
const [size, setSize] = React.useState(initial);
|
|
85
|
+
const resize = React.useCallback(
|
|
86
|
+
(delta: number) =>
|
|
87
|
+
setSize((s) =>
|
|
88
|
+
Math.min(max, Math.max(min, s + (invert ? -delta : delta))),
|
|
89
|
+
),
|
|
90
|
+
[min, max, invert],
|
|
91
|
+
);
|
|
92
|
+
return [size, resize];
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export { ResizeHandle, usePaneSize };
|