Skip to content

Commit 2e25848

Browse files
fix(ui): update module resolution and add missing UI components
Co-Authored-By: Dan Lynch <[email protected]>
1 parent a095deb commit 2e25848

File tree

5 files changed

+2526
-44
lines changed

5 files changed

+2526
-44
lines changed

packages/ui/next.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const nextConfig = {
88
webpack: (config) => {
99
config.resolve.alias = {
1010
...config.resolve.alias,
11-
kubernetesjs: path.resolve(__dirname, '../../kubernetesjs')
11+
kubernetesjs: path.resolve(__dirname, '../kubernetesjs/dist')
1212
};
1313
return config;
1414
},

packages/ui/package.json

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,22 @@
4242
"@radix-ui/react-dialog": "^1.0.5",
4343
"@radix-ui/react-dropdown-menu": "^2.0.6",
4444
"@radix-ui/react-label": "^2.0.2",
45+
"@radix-ui/react-popover": "^1.1.14",
4546
"@radix-ui/react-slot": "^1.0.2",
4647
"@radix-ui/react-tabs": "^1.0.4",
48+
"class-variance-authority": "^0.7.0",
49+
"clsx": "^2.0.0",
50+
"cmdk": "^1.1.1",
4751
"kubernetesjs": "^0.6.0",
52+
"lucide-react": "^0.294.0",
53+
"monaco-editor": "^0.45.0",
4854
"next": "^14.1.0",
4955
"next-themes": "^0.2.1",
5056
"react": "^18.2.0",
5157
"react-dom": "^18.2.0",
52-
"monaco-editor": "^0.45.0",
53-
"zustand": "^4.4.7",
54-
"class-variance-authority": "^0.7.0",
55-
"clsx": "^2.0.0",
56-
"lucide-react": "^0.294.0",
5758
"tailwind-merge": "^2.1.0",
58-
"tailwindcss-animate": "^1.0.7"
59+
"tailwindcss-animate": "^1.0.7",
60+
"zustand": "^4.4.7"
5961
},
6062
"devDependencies": {
6163
"@types/node": "^20.10.4",
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
"use client";
2+
3+
import * as React from "react";
4+
import { DialogProps } from "@radix-ui/react-dialog";
5+
import { Command as CommandPrimitive } from "cmdk";
6+
import { Search } from "lucide-react";
7+
8+
import { cn } from "@/lib/utils";
9+
import { Dialog, DialogContent } from "@/components/ui/dialog";
10+
11+
const Command = React.forwardRef<
12+
React.ElementRef<typeof CommandPrimitive>,
13+
React.ComponentPropsWithoutRef<typeof CommandPrimitive>
14+
>(({ className, ...props }, ref) => (
15+
<CommandPrimitive
16+
ref={ref}
17+
className={cn(
18+
"flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
19+
className
20+
)}
21+
{...props}
22+
/>
23+
));
24+
Command.displayName = CommandPrimitive.displayName;
25+
26+
const CommandInput = React.forwardRef<
27+
React.ElementRef<typeof CommandPrimitive.Input>,
28+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>
29+
>(({ className, ...props }, ref) => (
30+
<div className="flex items-center border-b px-3" cmdk-input-wrapper="">
31+
<Search className="mr-2 h-4 w-4 shrink-0 opacity-50" />
32+
<CommandPrimitive.Input
33+
ref={ref}
34+
className={cn(
35+
"flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
36+
className
37+
)}
38+
{...props}
39+
/>
40+
</div>
41+
));
42+
43+
CommandInput.displayName = CommandPrimitive.Input.displayName;
44+
45+
const CommandList = React.forwardRef<
46+
React.ElementRef<typeof CommandPrimitive.List>,
47+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>
48+
>(({ className, ...props }, ref) => (
49+
<CommandPrimitive.List
50+
ref={ref}
51+
className={cn("max-h-[300px] overflow-y-auto overflow-x-hidden", className)}
52+
{...props}
53+
/>
54+
));
55+
56+
CommandList.displayName = CommandPrimitive.List.displayName;
57+
58+
const CommandEmpty = React.forwardRef<
59+
React.ElementRef<typeof CommandPrimitive.Empty>,
60+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>
61+
>((props, ref) => (
62+
<CommandPrimitive.Empty
63+
ref={ref}
64+
className="py-6 text-center text-sm"
65+
{...props}
66+
/>
67+
));
68+
69+
CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
70+
71+
const CommandGroup = React.forwardRef<
72+
React.ElementRef<typeof CommandPrimitive.Group>,
73+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>
74+
>(({ className, ...props }, ref) => (
75+
<CommandPrimitive.Group
76+
ref={ref}
77+
className={cn(
78+
"overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
79+
className
80+
)}
81+
{...props}
82+
/>
83+
));
84+
85+
CommandGroup.displayName = CommandPrimitive.Group.displayName;
86+
87+
const CommandItem = React.forwardRef<
88+
React.ElementRef<typeof CommandPrimitive.Item>,
89+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>
90+
>(({ className, ...props }, ref) => (
91+
<CommandPrimitive.Item
92+
ref={ref}
93+
className={cn(
94+
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
95+
className
96+
)}
97+
{...props}
98+
/>
99+
));
100+
101+
CommandItem.displayName = CommandPrimitive.Item.displayName;
102+
103+
const CommandSeparator = React.forwardRef<
104+
React.ElementRef<typeof CommandPrimitive.Separator>,
105+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>
106+
>(({ className, ...props }, ref) => (
107+
<CommandPrimitive.Separator
108+
ref={ref}
109+
className={cn("-mx-1 h-px bg-border", className)}
110+
{...props}
111+
/>
112+
));
113+
CommandSeparator.displayName = CommandPrimitive.Separator.displayName;
114+
115+
function CommandDialog({
116+
children,
117+
...props
118+
}: DialogProps) {
119+
return (
120+
<Dialog {...props}>
121+
<DialogContent className="overflow-hidden p-0 shadow-lg">
122+
<Command className="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
123+
{children}
124+
</Command>
125+
</DialogContent>
126+
</Dialog>
127+
);
128+
}
129+
130+
export {
131+
Command,
132+
CommandDialog,
133+
CommandInput,
134+
CommandList,
135+
CommandEmpty,
136+
CommandGroup,
137+
CommandItem,
138+
CommandSeparator,
139+
};
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
"use client";
2+
3+
import * as React from "react";
4+
import * as PopoverPrimitive from "@radix-ui/react-popover";
5+
6+
import { cn } from "@/lib/utils";
7+
8+
const Popover = PopoverPrimitive.Root;
9+
10+
const PopoverTrigger = PopoverPrimitive.Trigger;
11+
12+
const PopoverContent = React.forwardRef<
13+
React.ElementRef<typeof PopoverPrimitive.Content>,
14+
React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>
15+
>(({ className, align = "center", sideOffset = 4, ...props }, ref) => (
16+
<PopoverPrimitive.Portal>
17+
<PopoverPrimitive.Content
18+
ref={ref}
19+
align={align}
20+
sideOffset={sideOffset}
21+
className={cn(
22+
"z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
23+
className
24+
)}
25+
{...props}
26+
/>
27+
</PopoverPrimitive.Portal>
28+
));
29+
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
30+
31+
export { Popover, PopoverTrigger, PopoverContent };

0 commit comments

Comments
 (0)