'use client'; import {Check} from 'lucide-react'; import React from 'react'; import { ListBox as AriaListBox, ListBoxItem as AriaListBoxItem, ListBoxSection, Header, Collection, type ListBoxProps as AriaListBoxProps, type ListBoxItemProps, type ListBoxSectionProps } from 'react-aria-components/ListBox'; import {composeRenderProps} from 'react-aria-components/composeRenderProps'; import {tv} from 'tailwind-variants'; import {composeTailwindRenderProps, focusRing} from './utils'; interface ListBoxProps extends Omit, 'layout' | 'orientation'> {} export function ListBox({children, ...props}: ListBoxProps) { return ( {children} ); } export const itemStyles = tv({ extend: focusRing, base: 'group relative flex items-center gap-8 cursor-default select-none py-1.5 px-2.5 rounded-md will-change-transform text-sm forced-color-adjust-none', variants: { isSelected: { false: 'text-neutral-700 dark:text-neutral-300 hover:bg-neutral-100 pressed:bg-neutral-100 dark:hover:bg-neutral-800 dark:pressed:bg-neutral-800 -outline-offset-2', true: 'bg-blue-600 text-white forced-colors:bg-[Highlight] forced-colors:text-[HighlightText] [&:has(+[data-selected])]:rounded-b-none [&+[data-selected]]:rounded-t-none -outline-offset-4 outline-white dark:outline-white forced-colors:outline-[HighlightText]' }, isDisabled: { true: 'text-neutral-300 dark:text-neutral-600 forced-colors:text-[GrayText]' } } }); export function ListBoxItem(props: ListBoxItemProps) { let textValue = props.textValue || (typeof props.children === 'string' ? props.children : undefined); return ( {composeRenderProps(props.children, children => ( <> {children}
))} ); } export const dropdownItemStyles = tv({ base: 'group flex items-center gap-4 cursor-default select-none py-2 pl-3 pr-3 selected:pr-1 rounded-lg outline outline-0 text-sm forced-color-adjust-none no-underline [&[href]]:cursor-pointer [-webkit-tap-highlight-color:transparent]', variants: { isDisabled: { false: 'text-neutral-900 dark:text-neutral-100', true: 'text-neutral-300 dark:text-neutral-600 forced-colors:text-[GrayText]' }, isPressed: { true: 'bg-neutral-100 dark:bg-neutral-800' }, isFocused: { true: 'bg-blue-600 dark:bg-blue-600 text-white forced-colors:bg-[Highlight] forced-colors:text-[HighlightText]' } }, compoundVariants: [ { isFocused: false, isOpen: true, className: 'bg-neutral-100 dark:bg-neutral-700/60' } ] }); export function DropdownItem(props: ListBoxItemProps) { let textValue = props.textValue || (typeof props.children === 'string' ? props.children : undefined); return ( {composeRenderProps(props.children, (children, {isSelected}) => ( <> {children} {isSelected && } ))} ); } export interface DropdownSectionProps extends ListBoxSectionProps { title?: string; items?: any; } export function DropdownSection(props: DropdownSectionProps) { return (
{props.title}
{props.children}
); }