|
|
|
|
@@ -1,12 +1,12 @@
|
|
|
|
|
"use client"
|
|
|
|
|
'use client';
|
|
|
|
|
|
|
|
|
|
import * as React from "react"
|
|
|
|
|
import { type DialogProps } from "@radix-ui/react-dialog"
|
|
|
|
|
import { Command as CommandPrimitive } from "cmdk"
|
|
|
|
|
import { Search } from "lucide-react"
|
|
|
|
|
import * as React from 'react';
|
|
|
|
|
import { type DialogProps } from '@radix-ui/react-dialog';
|
|
|
|
|
import { Command as CommandPrimitive } from 'cmdk';
|
|
|
|
|
import { Search } from 'lucide-react';
|
|
|
|
|
|
|
|
|
|
import { cn } from "@/lib/utils"
|
|
|
|
|
import { Dialog, DialogContent } from "@/components/ui/dialog"
|
|
|
|
|
import { cn } from '@/lib/utils';
|
|
|
|
|
import { Dialog, DialogContent } from '@/components/ui/dialog';
|
|
|
|
|
|
|
|
|
|
const Command = React.forwardRef<
|
|
|
|
|
React.ElementRef<typeof CommandPrimitive>,
|
|
|
|
|
@@ -15,13 +15,13 @@ const Command = React.forwardRef<
|
|
|
|
|
<CommandPrimitive
|
|
|
|
|
ref={ref}
|
|
|
|
|
className={cn(
|
|
|
|
|
"flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
|
|
|
|
|
className
|
|
|
|
|
'flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground',
|
|
|
|
|
className,
|
|
|
|
|
)}
|
|
|
|
|
{...props}
|
|
|
|
|
/>
|
|
|
|
|
))
|
|
|
|
|
Command.displayName = CommandPrimitive.displayName
|
|
|
|
|
));
|
|
|
|
|
Command.displayName = CommandPrimitive.displayName;
|
|
|
|
|
|
|
|
|
|
const CommandDialog = ({ children, ...props }: DialogProps) => {
|
|
|
|
|
return (
|
|
|
|
|
@@ -32,8 +32,8 @@ const CommandDialog = ({ children, ...props }: DialogProps) => {
|
|
|
|
|
</Command>
|
|
|
|
|
</DialogContent>
|
|
|
|
|
</Dialog>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const CommandInput = React.forwardRef<
|
|
|
|
|
React.ElementRef<typeof CommandPrimitive.Input>,
|
|
|
|
|
@@ -44,15 +44,15 @@ const CommandInput = React.forwardRef<
|
|
|
|
|
<CommandPrimitive.Input
|
|
|
|
|
ref={ref}
|
|
|
|
|
className={cn(
|
|
|
|
|
"flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
|
|
|
|
|
className
|
|
|
|
|
'flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50',
|
|
|
|
|
className,
|
|
|
|
|
)}
|
|
|
|
|
{...props}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
))
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
CommandInput.displayName = CommandPrimitive.Input.displayName
|
|
|
|
|
CommandInput.displayName = CommandPrimitive.Input.displayName;
|
|
|
|
|
|
|
|
|
|
const CommandList = React.forwardRef<
|
|
|
|
|
React.ElementRef<typeof CommandPrimitive.List>,
|
|
|
|
|
@@ -64,30 +64,26 @@ const CommandList = React.forwardRef<
|
|
|
|
|
// event ourselves so the list scrolls regardless of focus state.
|
|
|
|
|
<CommandPrimitive.List
|
|
|
|
|
ref={ref}
|
|
|
|
|
className={cn("max-h-[300px] overflow-y-auto overflow-x-hidden overscroll-contain", className)}
|
|
|
|
|
className={cn('max-h-[300px] overflow-y-auto overflow-x-hidden overscroll-contain', className)}
|
|
|
|
|
onWheel={(event) => {
|
|
|
|
|
onWheel?.(event)
|
|
|
|
|
if (event.defaultPrevented) return
|
|
|
|
|
event.currentTarget.scrollTop += event.deltaY
|
|
|
|
|
onWheel?.(event);
|
|
|
|
|
if (event.defaultPrevented) return;
|
|
|
|
|
event.currentTarget.scrollTop += event.deltaY;
|
|
|
|
|
}}
|
|
|
|
|
{...props}
|
|
|
|
|
/>
|
|
|
|
|
))
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
CommandList.displayName = CommandPrimitive.List.displayName
|
|
|
|
|
CommandList.displayName = CommandPrimitive.List.displayName;
|
|
|
|
|
|
|
|
|
|
const CommandEmpty = React.forwardRef<
|
|
|
|
|
React.ElementRef<typeof CommandPrimitive.Empty>,
|
|
|
|
|
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>
|
|
|
|
|
>((props, ref) => (
|
|
|
|
|
<CommandPrimitive.Empty
|
|
|
|
|
ref={ref}
|
|
|
|
|
className="py-6 text-center text-sm"
|
|
|
|
|
{...props}
|
|
|
|
|
/>
|
|
|
|
|
))
|
|
|
|
|
<CommandPrimitive.Empty ref={ref} className="py-6 text-center text-sm" {...props} />
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
CommandEmpty.displayName = CommandPrimitive.Empty.displayName
|
|
|
|
|
CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
|
|
|
|
|
|
|
|
|
|
const CommandGroup = React.forwardRef<
|
|
|
|
|
React.ElementRef<typeof CommandPrimitive.Group>,
|
|
|
|
|
@@ -96,14 +92,14 @@ const CommandGroup = React.forwardRef<
|
|
|
|
|
<CommandPrimitive.Group
|
|
|
|
|
ref={ref}
|
|
|
|
|
className={cn(
|
|
|
|
|
"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",
|
|
|
|
|
className
|
|
|
|
|
'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',
|
|
|
|
|
className,
|
|
|
|
|
)}
|
|
|
|
|
{...props}
|
|
|
|
|
/>
|
|
|
|
|
))
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
CommandGroup.displayName = CommandPrimitive.Group.displayName
|
|
|
|
|
CommandGroup.displayName = CommandPrimitive.Group.displayName;
|
|
|
|
|
|
|
|
|
|
const CommandSeparator = React.forwardRef<
|
|
|
|
|
React.ElementRef<typeof CommandPrimitive.Separator>,
|
|
|
|
|
@@ -111,11 +107,11 @@ const CommandSeparator = React.forwardRef<
|
|
|
|
|
>(({ className, ...props }, ref) => (
|
|
|
|
|
<CommandPrimitive.Separator
|
|
|
|
|
ref={ref}
|
|
|
|
|
className={cn("-mx-1 h-px bg-border", className)}
|
|
|
|
|
className={cn('-mx-1 h-px bg-border', className)}
|
|
|
|
|
{...props}
|
|
|
|
|
/>
|
|
|
|
|
))
|
|
|
|
|
CommandSeparator.displayName = CommandPrimitive.Separator.displayName
|
|
|
|
|
));
|
|
|
|
|
CommandSeparator.displayName = CommandPrimitive.Separator.displayName;
|
|
|
|
|
|
|
|
|
|
const CommandItem = React.forwardRef<
|
|
|
|
|
React.ElementRef<typeof CommandPrimitive.Item>,
|
|
|
|
|
@@ -124,30 +120,24 @@ const CommandItem = React.forwardRef<
|
|
|
|
|
<CommandPrimitive.Item
|
|
|
|
|
ref={ref}
|
|
|
|
|
className={cn(
|
|
|
|
|
"relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
|
|
|
className
|
|
|
|
|
'relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',
|
|
|
|
|
className,
|
|
|
|
|
)}
|
|
|
|
|
{...props}
|
|
|
|
|
/>
|
|
|
|
|
))
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
CommandItem.displayName = CommandPrimitive.Item.displayName
|
|
|
|
|
CommandItem.displayName = CommandPrimitive.Item.displayName;
|
|
|
|
|
|
|
|
|
|
const CommandShortcut = ({
|
|
|
|
|
className,
|
|
|
|
|
...props
|
|
|
|
|
}: React.HTMLAttributes<HTMLSpanElement>) => {
|
|
|
|
|
const CommandShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => {
|
|
|
|
|
return (
|
|
|
|
|
<span
|
|
|
|
|
className={cn(
|
|
|
|
|
"ml-auto text-xs tracking-widest text-muted-foreground",
|
|
|
|
|
className
|
|
|
|
|
)}
|
|
|
|
|
className={cn('ml-auto text-xs tracking-widest text-muted-foreground', className)}
|
|
|
|
|
{...props}
|
|
|
|
|
/>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
CommandShortcut.displayName = "CommandShortcut"
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
CommandShortcut.displayName = 'CommandShortcut';
|
|
|
|
|
|
|
|
|
|
export {
|
|
|
|
|
Command,
|
|
|
|
|
@@ -159,4 +149,4 @@ export {
|
|
|
|
|
CommandItem,
|
|
|
|
|
CommandShortcut,
|
|
|
|
|
CommandSeparator,
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|