Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
"use client";
import { Select as SelectPrimitive } from "@base-ui/react/select";
import { CheckIcon, ChevronsUpDownIcon } from "lucide-react";
import { cn } from "./lib/utils";
function Select<Value, Multiple extends boolean | undefined = false>(
props: SelectPrimitive.Root.Props<Value, Multiple>,
) {
return <SelectPrimitive.Root {...props} />;
}
function SelectGroup(props: SelectPrimitive.Group.Props) {
return <SelectPrimitive.Group data-slot="select-group" {...props} />;
}
function SelectValue(props: SelectPrimitive.Value.Props) {
return (
<div className="flex w-full items-center justify-between gap-x-2.5">
<SelectPrimitive.Value data-slot="select-value" {...props} />
<SelectPrimitive.Icon
render={<ChevronsUpDownIcon className="size-4 opacity-50" />}
/>
</div>
);
}
function SelectTrigger({
className,
children,
...props
}: SelectPrimitive.Trigger.Props) {
return (
<SelectPrimitive.Trigger
data-slot="select-trigger"
className={cn(
"inline-flex h-9 shrink-0 items-center gap-x-2.5 whitespace-nowrap rounded-xl bg-background/80 px-2.5 text-sm outline-none ring-1 ring-button-outline ring-inset backdrop-blur-lg transition-[background-color,color,box-shadow] hover:bg-accent disabled:pointer-events-none disabled:opacity-50 data-popup-open:bg-accent dark:bg-foreground/5 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
"focus-visible:ring-[3px] focus-visible:ring-ring/50",
"data-invalid:ring-destructive",
className,
)}
{...props}
>
{children}
</SelectPrimitive.Trigger>
);
}
function SelectContent({
className,
children,
...props
}: SelectPrimitive.Popup.Props) {
return (
<SelectPrimitive.Portal>
<SelectPrimitive.Positioner
alignItemWithTrigger={false}
sideOffset={4}
className="isolate z-50"
>
<SelectPrimitive.Popup
data-slot="select-content"
className={cn(
"relative z-50 max-h-[300px] w-full min-w-[max(--spacing(32),var(--anchor-width))] animate-in overflow-y-auto rounded-xl border border-popover-border bg-popover p-1 shadow-sm",
className,
)}
{...props}
>
{children}
</SelectPrimitive.Popup>
</SelectPrimitive.Positioner>
</SelectPrimitive.Portal>
);
}
function SelectLabel({
className,
...props
}: SelectPrimitive.GroupLabel.Props) {
return (
<SelectPrimitive.GroupLabel
data-slot="select-label"
className={cn(
"px-2 py-1.5 font-semibold text-muted-foreground text-xs",
className,
)}
{...props}
/>
);
}
function SelectItem({
className,
children,
...props
}: SelectPrimitive.Item.Props) {
return (
<SelectPrimitive.Item
data-slot="select-item"
className={cn(
"relative flex w-full cursor-default select-none items-center rounded-lg py-1.5 pr-2 pl-8 text-sm outline-hidden data-disabled:pointer-events-none data-highlighted:bg-popover-accent data-disabled:opacity-50 data-highlighted:ring-1 data-highlighted:ring-black/5 data-highlighted:ring-inset dark:data-highlighted:ring-white/5",
className,
)}
{...props}
>
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
<SelectPrimitive.ItemIndicator>
<CheckIcon className="size-4 shrink-0 text-muted-foreground" />
</SelectPrimitive.ItemIndicator>
</span>
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
</SelectPrimitive.Item>
);
}
function SelectSeparator({
className,
...props
}: SelectPrimitive.Separator.Props) {
return (
<SelectPrimitive.Separator
data-slot="select-separator"
className={cn("-mx-1 my-1 h-px bg-muted", className)}
{...props}
/>
);
}
export {
Select,
SelectContent,
SelectGroup,
SelectItem,
SelectLabel,
SelectSeparator,
SelectTrigger,
SelectValue,
};