@open-lakehouse/ui-kit 0.0.0-stage → 0.0.2
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/CHANGELOG.md +14 -0
- package/DESIGN.md +105 -0
- package/README.md +48 -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/commit-history.d.ts +76 -0
- package/dist/commit-history.d.ts.map +1 -0
- package/dist/commit-history.js +121 -0
- package/dist/commit-history.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 +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -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/commit-history.tsx +339 -0
- package/src/dialog.tsx +119 -0
- package/src/dropdown-menu.tsx +99 -0
- package/src/index.ts +87 -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/sheet.tsx
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
2
|
+
import { X } from "lucide-react";
|
|
3
|
+
import { Dialog as SheetPrimitive } from "radix-ui";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
|
|
6
|
+
import { cn } from "./utils.js";
|
|
7
|
+
|
|
8
|
+
const Sheet = SheetPrimitive.Root;
|
|
9
|
+
const SheetTrigger = SheetPrimitive.Trigger;
|
|
10
|
+
const SheetClose = SheetPrimitive.Close;
|
|
11
|
+
const SheetPortal = SheetPrimitive.Portal;
|
|
12
|
+
|
|
13
|
+
const SheetOverlay = React.forwardRef<
|
|
14
|
+
React.ComponentRef<typeof SheetPrimitive.Overlay>,
|
|
15
|
+
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Overlay>
|
|
16
|
+
>(({ className, ...props }, ref) => (
|
|
17
|
+
<SheetPrimitive.Overlay
|
|
18
|
+
ref={ref}
|
|
19
|
+
className={cn(
|
|
20
|
+
"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",
|
|
21
|
+
className,
|
|
22
|
+
)}
|
|
23
|
+
{...props}
|
|
24
|
+
/>
|
|
25
|
+
));
|
|
26
|
+
SheetOverlay.displayName = SheetPrimitive.Overlay.displayName;
|
|
27
|
+
|
|
28
|
+
const sheetVariants = cva(
|
|
29
|
+
"fixed z-50 gap-4 border bg-card shadow-lg transition ease-in-out data-[state=closed]:duration-200 data-[state=open]:duration-300 data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
30
|
+
{
|
|
31
|
+
variants: {
|
|
32
|
+
side: {
|
|
33
|
+
top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
|
|
34
|
+
bottom:
|
|
35
|
+
"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
|
|
36
|
+
left: "inset-y-0 left-0 h-full w-[min(100vw,22rem)] border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left",
|
|
37
|
+
right:
|
|
38
|
+
"inset-y-0 right-0 h-full w-[min(100vw,22rem)] border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right",
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
defaultVariants: {
|
|
42
|
+
side: "right",
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
interface SheetContentProps
|
|
48
|
+
extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>,
|
|
49
|
+
VariantProps<typeof sheetVariants> {
|
|
50
|
+
showClose?: boolean;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const SheetContent = React.forwardRef<
|
|
54
|
+
React.ComponentRef<typeof SheetPrimitive.Content>,
|
|
55
|
+
SheetContentProps
|
|
56
|
+
>(
|
|
57
|
+
(
|
|
58
|
+
{ side = "right", className, children, showClose = true, ...props },
|
|
59
|
+
ref,
|
|
60
|
+
) => (
|
|
61
|
+
<SheetPortal>
|
|
62
|
+
<SheetOverlay />
|
|
63
|
+
<SheetPrimitive.Content
|
|
64
|
+
ref={ref}
|
|
65
|
+
className={cn(sheetVariants({ side }), className)}
|
|
66
|
+
{...props}
|
|
67
|
+
>
|
|
68
|
+
{children}
|
|
69
|
+
{showClose && (
|
|
70
|
+
<SheetPrimitive.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">
|
|
71
|
+
<X className="h-4 w-4" />
|
|
72
|
+
<span className="sr-only">Close</span>
|
|
73
|
+
</SheetPrimitive.Close>
|
|
74
|
+
)}
|
|
75
|
+
</SheetPrimitive.Content>
|
|
76
|
+
</SheetPortal>
|
|
77
|
+
),
|
|
78
|
+
);
|
|
79
|
+
SheetContent.displayName = SheetPrimitive.Content.displayName;
|
|
80
|
+
|
|
81
|
+
function SheetHeader({
|
|
82
|
+
className,
|
|
83
|
+
...props
|
|
84
|
+
}: React.HTMLAttributes<HTMLDivElement>) {
|
|
85
|
+
return (
|
|
86
|
+
<div
|
|
87
|
+
className={cn(
|
|
88
|
+
"flex flex-col space-y-1.5 border-b px-5 py-3 text-left",
|
|
89
|
+
className,
|
|
90
|
+
)}
|
|
91
|
+
{...props}
|
|
92
|
+
/>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
SheetHeader.displayName = "SheetHeader";
|
|
96
|
+
|
|
97
|
+
const SheetTitle = React.forwardRef<
|
|
98
|
+
React.ComponentRef<typeof SheetPrimitive.Title>,
|
|
99
|
+
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Title>
|
|
100
|
+
>(({ className, ...props }, ref) => (
|
|
101
|
+
<SheetPrimitive.Title
|
|
102
|
+
ref={ref}
|
|
103
|
+
className={cn("text-sm font-semibold leading-none", className)}
|
|
104
|
+
{...props}
|
|
105
|
+
/>
|
|
106
|
+
));
|
|
107
|
+
SheetTitle.displayName = SheetPrimitive.Title.displayName;
|
|
108
|
+
|
|
109
|
+
const SheetDescription = React.forwardRef<
|
|
110
|
+
React.ComponentRef<typeof SheetPrimitive.Description>,
|
|
111
|
+
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Description>
|
|
112
|
+
>(({ className, ...props }, ref) => (
|
|
113
|
+
<SheetPrimitive.Description
|
|
114
|
+
ref={ref}
|
|
115
|
+
className={cn("text-xs text-muted-foreground", className)}
|
|
116
|
+
{...props}
|
|
117
|
+
/>
|
|
118
|
+
));
|
|
119
|
+
SheetDescription.displayName = SheetPrimitive.Description.displayName;
|
|
120
|
+
|
|
121
|
+
export {
|
|
122
|
+
Sheet,
|
|
123
|
+
SheetClose,
|
|
124
|
+
SheetContent,
|
|
125
|
+
SheetDescription,
|
|
126
|
+
SheetHeader,
|
|
127
|
+
SheetOverlay,
|
|
128
|
+
SheetPortal,
|
|
129
|
+
SheetTitle,
|
|
130
|
+
SheetTrigger,
|
|
131
|
+
};
|
package/src/sonner.tsx
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Toaster as Sonner, type ToasterProps } from "sonner";
|
|
2
|
+
|
|
3
|
+
import { useTheme } from "./ThemeProvider.js";
|
|
4
|
+
|
|
5
|
+
export function Toaster(props: ToasterProps) {
|
|
6
|
+
const { theme } = useTheme();
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
<Sonner
|
|
10
|
+
theme={theme}
|
|
11
|
+
className="toaster group"
|
|
12
|
+
toastOptions={{
|
|
13
|
+
classNames: {
|
|
14
|
+
toast:
|
|
15
|
+
"group toast group-[.toaster]:bg-popover group-[.toaster]:text-popover-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",
|
|
16
|
+
description: "group-[.toast]:text-muted-foreground",
|
|
17
|
+
actionButton:
|
|
18
|
+
"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",
|
|
19
|
+
cancelButton:
|
|
20
|
+
"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",
|
|
21
|
+
},
|
|
22
|
+
}}
|
|
23
|
+
{...props}
|
|
24
|
+
/>
|
|
25
|
+
);
|
|
26
|
+
}
|
package/src/switch.tsx
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import { cn } from "./utils.js";
|
|
4
|
+
|
|
5
|
+
export interface SwitchProps
|
|
6
|
+
extends Omit<
|
|
7
|
+
React.ButtonHTMLAttributes<HTMLButtonElement>,
|
|
8
|
+
"onChange" | "type" | "value"
|
|
9
|
+
> {
|
|
10
|
+
checked?: boolean;
|
|
11
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// Lightweight, accessible toggle switch (native button with role="switch").
|
|
15
|
+
// Avoids pulling in an extra Radix dependency while matching the shadcn look.
|
|
16
|
+
const Switch = React.forwardRef<HTMLButtonElement, SwitchProps>(
|
|
17
|
+
(
|
|
18
|
+
{ className, checked = false, onCheckedChange, disabled, ...props },
|
|
19
|
+
ref,
|
|
20
|
+
) => (
|
|
21
|
+
<button
|
|
22
|
+
type="button"
|
|
23
|
+
role="switch"
|
|
24
|
+
aria-checked={checked}
|
|
25
|
+
data-state={checked ? "checked" : "unchecked"}
|
|
26
|
+
disabled={disabled}
|
|
27
|
+
ref={ref}
|
|
28
|
+
onClick={() => onCheckedChange?.(!checked)}
|
|
29
|
+
className={cn(
|
|
30
|
+
"peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50",
|
|
31
|
+
checked ? "bg-primary" : "bg-input",
|
|
32
|
+
className,
|
|
33
|
+
)}
|
|
34
|
+
{...props}
|
|
35
|
+
>
|
|
36
|
+
<span
|
|
37
|
+
className={cn(
|
|
38
|
+
"pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform",
|
|
39
|
+
checked ? "translate-x-4" : "translate-x-0",
|
|
40
|
+
)}
|
|
41
|
+
/>
|
|
42
|
+
</button>
|
|
43
|
+
),
|
|
44
|
+
);
|
|
45
|
+
Switch.displayName = "Switch";
|
|
46
|
+
|
|
47
|
+
export { Switch };
|
package/src/tabs.tsx
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Tabs as TabsPrimitive } from "radix-ui";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
import { cn } from "./utils.js";
|
|
5
|
+
|
|
6
|
+
const Tabs = TabsPrimitive.Root;
|
|
7
|
+
|
|
8
|
+
const TabsList = React.forwardRef<
|
|
9
|
+
React.ComponentRef<typeof TabsPrimitive.List>,
|
|
10
|
+
React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>
|
|
11
|
+
>(({ className, ...props }, ref) => (
|
|
12
|
+
<TabsPrimitive.List
|
|
13
|
+
ref={ref}
|
|
14
|
+
className={cn(
|
|
15
|
+
"inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",
|
|
16
|
+
className,
|
|
17
|
+
)}
|
|
18
|
+
{...props}
|
|
19
|
+
/>
|
|
20
|
+
));
|
|
21
|
+
TabsList.displayName = TabsPrimitive.List.displayName;
|
|
22
|
+
|
|
23
|
+
const TabsTrigger = React.forwardRef<
|
|
24
|
+
React.ComponentRef<typeof TabsPrimitive.Trigger>,
|
|
25
|
+
React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>
|
|
26
|
+
>(({ className, ...props }, ref) => (
|
|
27
|
+
<TabsPrimitive.Trigger
|
|
28
|
+
ref={ref}
|
|
29
|
+
className={cn(
|
|
30
|
+
"inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",
|
|
31
|
+
className,
|
|
32
|
+
)}
|
|
33
|
+
{...props}
|
|
34
|
+
/>
|
|
35
|
+
));
|
|
36
|
+
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
|
|
37
|
+
|
|
38
|
+
const TabsContent = React.forwardRef<
|
|
39
|
+
React.ComponentRef<typeof TabsPrimitive.Content>,
|
|
40
|
+
React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>
|
|
41
|
+
>(({ className, ...props }, ref) => (
|
|
42
|
+
<TabsPrimitive.Content
|
|
43
|
+
ref={ref}
|
|
44
|
+
className={cn(
|
|
45
|
+
"mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
46
|
+
className,
|
|
47
|
+
)}
|
|
48
|
+
{...props}
|
|
49
|
+
/>
|
|
50
|
+
));
|
|
51
|
+
TabsContent.displayName = TabsPrimitive.Content.displayName;
|
|
52
|
+
|
|
53
|
+
export { Tabs, TabsContent, TabsList, TabsTrigger };
|
package/src/textarea.tsx
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import { cn } from "./utils.js";
|
|
4
|
+
|
|
5
|
+
const Textarea = React.forwardRef<
|
|
6
|
+
HTMLTextAreaElement,
|
|
7
|
+
React.TextareaHTMLAttributes<HTMLTextAreaElement>
|
|
8
|
+
>(({ className, ...props }, ref) => (
|
|
9
|
+
<textarea
|
|
10
|
+
ref={ref}
|
|
11
|
+
// Don't auto-capitalize/auto-correct what the user types. Listed before
|
|
12
|
+
// {...props} so a specific field can opt back in. (spellCheck is left at the
|
|
13
|
+
// browser default — a squiggle on prose is fine and doesn't mutate text.)
|
|
14
|
+
autoCapitalize="off"
|
|
15
|
+
autoCorrect="off"
|
|
16
|
+
className={cn(
|
|
17
|
+
"flex min-h-[60px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm shadow-sm 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",
|
|
18
|
+
className,
|
|
19
|
+
)}
|
|
20
|
+
{...props}
|
|
21
|
+
/>
|
|
22
|
+
));
|
|
23
|
+
Textarea.displayName = "Textarea";
|
|
24
|
+
|
|
25
|
+
export { Textarea };
|
package/src/tooltip.tsx
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Tooltip as TooltipPrimitive } from "radix-ui";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
import { cn } from "./utils.js";
|
|
5
|
+
|
|
6
|
+
const TooltipProvider = TooltipPrimitive.Provider;
|
|
7
|
+
const Tooltip = TooltipPrimitive.Root;
|
|
8
|
+
const TooltipTrigger = TooltipPrimitive.Trigger;
|
|
9
|
+
|
|
10
|
+
const TooltipContent = React.forwardRef<
|
|
11
|
+
React.ComponentRef<typeof TooltipPrimitive.Content>,
|
|
12
|
+
React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>
|
|
13
|
+
>(({ className, sideOffset = 4, ...props }, ref) => (
|
|
14
|
+
<TooltipPrimitive.Portal>
|
|
15
|
+
<TooltipPrimitive.Content
|
|
16
|
+
ref={ref}
|
|
17
|
+
sideOffset={sideOffset}
|
|
18
|
+
className={cn(
|
|
19
|
+
"z-50 overflow-hidden rounded-md border bg-popover px-2 py-1 text-xs text-popover-foreground shadow-md data-[state=delayed-open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=delayed-open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=delayed-open]:zoom-in-95",
|
|
20
|
+
className,
|
|
21
|
+
)}
|
|
22
|
+
{...props}
|
|
23
|
+
/>
|
|
24
|
+
</TooltipPrimitive.Portal>
|
|
25
|
+
));
|
|
26
|
+
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
27
|
+
|
|
28
|
+
export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };
|