| 229 | }; |
| 230 | |
| 231 | function CardStackEntry({ className, asChild = false, searchText, ...props }: CardStackEntryProps) { |
| 232 | const { searchable, searchQuery } = React.useContext(CardStackContext); |
| 233 | |
| 234 | if (searchable && searchText !== undefined) { |
| 235 | const trimmed = searchQuery.trim().toLowerCase(); |
| 236 | if (trimmed.length > 0 && !searchText.toLowerCase().includes(trimmed)) { |
| 237 | return null; |
| 238 | } |
| 239 | } |
| 240 | |
| 241 | const Comp = asChild ? Slot.Root : "div"; |
| 242 | return ( |
| 243 | <Comp |
| 244 | data-slot="card-stack-entry" |
| 245 | className={cn( |
| 246 | "group/card-stack-entry flex w-full items-center gap-3 px-4 py-3 text-sm outline-none transition-[background-color] duration-150 ease-[cubic-bezier(0.23,1,0.32,1)]", |
| 247 | "focus-visible:bg-accent/40", |
| 248 | "[&[href]]:cursor-pointer [&[href]]:hover:bg-accent/40", |
| 249 | className, |
| 250 | )} |
| 251 | {...props} |
| 252 | /> |
| 253 | ); |
| 254 | } |
| 255 | |
| 256 | type CardStackEntryFieldProps = React.ComponentProps<"div"> & { |
| 257 | label?: React.ReactNode; |