// AlignUI CommandMenu v0.0.0 'use client'; import * as React from 'react'; import { Command } from 'cmdk'; import { cn } from '@/utils/cn'; import { tv, type VariantProps } from '@/utils/tv'; import { PolymorphicComponentProps } from '@/utils/polymorphic'; import * as Modal from '@/components/ui/modal'; import { type DialogProps } from '@radix-ui/react-dialog'; const CommandDialogTitle = Modal.Title; const CommandDialogDescription = Modal.Description; const CommandDialog = ({ children, className, overlayClassName, ...rest }: DialogProps & { className?: string; overlayClassName?: string; }) => { return ( [cmdk-label]+*]:!border-t-0', )} > {children} ); }; const CommandInput = React.forwardRef< React.ComponentRef, React.ComponentPropsWithoutRef >(({ className, ...rest }, forwardedRef) => { return ( ); }); CommandInput.displayName = 'CommandInput'; const CommandList = React.forwardRef< React.ComponentRef, React.ComponentPropsWithoutRef >(({ className, ...rest }, forwardedRef) => { return ( [cmdk-list-sizer]]:divide-y [&>[cmdk-list-sizer]]:divide-stroke-soft-200', '[&>[cmdk-list-sizer]]:overflow-auto', className, )} {...rest} /> ); }); CommandList.displayName = 'CommandList'; const CommandGroup = React.forwardRef< React.ComponentRef, React.ComponentPropsWithoutRef >(({ className, ...rest }, forwardedRef) => { return ( [cmdk-group-heading]]:text-label-xs [&>[cmdk-group-heading]]:text-text-sub-600', '[&>[cmdk-group-heading]]:mb-2 [&>[cmdk-group-heading]]:px-3 [&>[cmdk-group-heading]]:pt-1', className, )} {...rest} /> ); }); CommandGroup.displayName = 'CommandGroup'; const commandItemVariants = tv({ base: [ 'flex items-center gap-3 rounded-10 bg-bg-white-0', 'cursor-pointer text-paragraph-sm text-text-strong-950', 'transition duration-200 ease-out', // hover/selected 'data-[selected=true]:bg-bg-weak-50', ], variants: { size: { small: 'px-3 py-2.5', medium: 'px-3 py-3', }, }, defaultVariants: { size: 'small', }, }); type CommandItemProps = VariantProps & React.ComponentPropsWithoutRef; const CommandItem = React.forwardRef< React.ComponentRef, CommandItemProps >(({ className, size, ...rest }, forwardedRef) => { return ( ); }); CommandItem.displayName = 'CommandItem'; function CommandItemIcon({ className, as, ...rest }: PolymorphicComponentProps) { const Component = as || 'div'; return ( ); } function CommandFooter({ className, ...rest }: React.HTMLAttributes) { return (
); } function CommandFooterKeyBox({ className, ...rest }: React.HTMLAttributes) { return (
); } export { CommandDialog as Dialog, CommandDialogTitle as DialogTitle, CommandDialogDescription as DialogDescription, CommandInput as Input, CommandList as List, CommandGroup as Group, CommandItem as Item, CommandItemIcon as ItemIcon, CommandFooter as Footer, CommandFooterKeyBox as FooterKeyBox, };