Spaces:
Running
Running
Download src/components/ui/select.tsx from evalstate/mcp-webcam: direct link, hf CLI and curl.
- Browser
- Download file 3.02 kB
-
https://huggingface.co/spaces/evalstate/mcp-webcam/resolve/main/src/components/ui/select.tsx
- Command line
-
hf download hf://spaces/evalstate/mcp-webcam/src/components/ui/select.tsx
-
curl -L -o select.tsx https://huggingface.co/spaces/evalstate/mcp-webcam/resolve/main/src/components/ui/select.tsx
3.02 kB
| import * as React from 'react'; | |
| import * as SelectPrimitive from '@radix-ui/react-select'; | |
| import { Check, ChevronDown } from 'lucide-react'; | |
| import { cn } from '@/lib/utils'; | |
| export const Select = SelectPrimitive.Root; | |
| export const SelectGroup = SelectPrimitive.Group; | |
| export const SelectValue = SelectPrimitive.Value; | |
| export const SelectTrigger = React.forwardRef< | |
| React.ComponentRef<typeof SelectPrimitive.Trigger>, | |
| React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger> | |
| >(({ className, children, ...props }, ref) => ( | |
| <SelectPrimitive.Trigger | |
| ref={ref} | |
| className={cn( | |
| 'flex h-8 w-full items-center justify-between gap-2 rounded-lg border border-line bg-panel-2/80 px-2.5 text-xs text-fg transition-colors hover:border-line-strong focus:outline-none focus:ring-2 focus:ring-push/40 disabled:cursor-not-allowed disabled:opacity-50 cursor-pointer [&>span]:truncate', | |
| className, | |
| )} | |
| {...props} | |
| > | |
| {children} | |
| <SelectPrimitive.Icon asChild> | |
| <ChevronDown className="h-3.5 w-3.5 shrink-0 text-muted" /> | |
| </SelectPrimitive.Icon> | |
| </SelectPrimitive.Trigger> | |
| )); | |
| SelectTrigger.displayName = SelectPrimitive.Trigger.displayName; | |
| export const SelectContent = React.forwardRef< | |
| React.ComponentRef<typeof SelectPrimitive.Content>, | |
| React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content> | |
| >(({ className, children, position = 'popper', ...props }, ref) => ( | |
| <SelectPrimitive.Portal> | |
| <SelectPrimitive.Content | |
| ref={ref} | |
| position={position} | |
| className={cn( | |
| 'relative z-50 max-h-72 min-w-[8rem] overflow-hidden rounded-lg border border-line-strong bg-panel text-fg shadow-lg', | |
| position === 'popper' && 'translate-y-1', | |
| className, | |
| )} | |
| {...props} | |
| > | |
| <SelectPrimitive.Viewport | |
| className={cn( | |
| 'p-1', | |
| position === 'popper' && 'w-full min-w-[var(--radix-select-trigger-width)]', | |
| )} | |
| > | |
| {children} | |
| </SelectPrimitive.Viewport> | |
| </SelectPrimitive.Content> | |
| </SelectPrimitive.Portal> | |
| )); | |
| SelectContent.displayName = SelectPrimitive.Content.displayName; | |
| export const SelectItem = React.forwardRef< | |
| React.ComponentRef<typeof SelectPrimitive.Item>, | |
| React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item> | |
| >(({ className, children, ...props }, ref) => ( | |
| <SelectPrimitive.Item | |
| ref={ref} | |
| className={cn( | |
| 'relative flex w-full cursor-pointer select-none items-center rounded-md py-1.5 pl-7 pr-2.5 text-xs text-fg outline-none focus:bg-panel-2 data-[disabled]:pointer-events-none data-[disabled]:opacity-50', | |
| className, | |
| )} | |
| {...props} | |
| > | |
| <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center"> | |
| <SelectPrimitive.ItemIndicator> | |
| <Check className="h-3.5 w-3.5 text-push" /> | |
| </SelectPrimitive.ItemIndicator> | |
| </span> | |
| <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText> | |
| </SelectPrimitive.Item> | |
| )); | |
| SelectItem.displayName = SelectPrimitive.Item.displayName; | |