RJBULK-APP/components/ui/select.tsx
SJCoetz 1efa979443 feat: initial setup of rj bulk supplies backoffice app
Adds complete initial codebase for the RJ Bulk Supplies fuel delivery backoffice:
- Authentication pages and protected route layouts
- Customer, supplier, fuel purchase, and delivery note management
- Custom reporting and customer statement sending tools
- Full UI component library and Tailwind styling
- Server actions, API routes, and PocketBase integration
- Development scripts and project configuration updates
- Updated README and package metadata
2026-07-19 20:38:16 +02:00

47 lines
1.3 KiB
TypeScript

"use client";
import * as React from "react";
import { cn } from "@/lib/utils";
/**
* Lightweight native <select>-based select. Radix's `Select` adds a lot of
* complexity and a11y plumbing we don't need for these admin forms. We use
* native select for simplicity and consistent keyboard support.
*/
export interface SelectOption {
value: string;
label: string;
}
interface SelectProps extends React.SelectHTMLAttributes<HTMLSelectElement> {
options: SelectOption[];
placeholder?: string;
}
export const Select = React.forwardRef<HTMLSelectElement, SelectProps>(
({ className, options, placeholder, ...props }, ref) => {
return (
<select
ref={ref}
className={cn(
"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
className
)}
{...props}
>
{placeholder && (
<option value="" disabled>
{placeholder}
</option>
)}
{options.map((opt) => (
<option key={opt.value} value={opt.value}>
{opt.label}
</option>
))}
</select>
);
}
);
Select.displayName = "Select";