Add reusable Select (styled native select + chevron) and Textarea components matching Input's design language, and replace every native <select>/<textarea> across the app (system-panel, node-edit-dialog, notification-channel-dialog, settings customCss, widget note) with them. TLS cert UX: once a cert is installed, the sensitive PEM is no longer rendered on revisit — show an '已安装(未改变)' summary with 更改/删除 buttons; 更改 reveals the inputs again (with a 取消). Private key is never sent back to the client. Verified by tsc + vite build.
30 lines
1.2 KiB
TypeScript
30 lines
1.2 KiB
TypeScript
import * as React from 'react';
|
|
import { ChevronDown } from 'lucide-react';
|
|
import { cn } from '@/lib/utils';
|
|
|
|
// A styled native <select> matching Input's design language. Native keeps it
|
|
// accessible + zero-dep; we hide the OS arrow (appearance-none) and draw our
|
|
// own chevron for a consistent look. Pass <option>s as children.
|
|
const Select = React.forwardRef<HTMLSelectElement, React.SelectHTMLAttributes<HTMLSelectElement>>(
|
|
({ className, children, ...props }, ref) => (
|
|
<div className="relative w-full">
|
|
<select
|
|
ref={ref}
|
|
className={cn(
|
|
'flex h-9 w-full min-w-0 appearance-none rounded-md border border-border bg-transparent px-3 py-1 pr-8 text-sm shadow-xs transition-[color,box-shadow] outline-none',
|
|
'focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/40',
|
|
'disabled:cursor-not-allowed disabled:opacity-50',
|
|
className
|
|
)}
|
|
{...props}
|
|
>
|
|
{children}
|
|
</select>
|
|
<ChevronDown className="pointer-events-none absolute right-2.5 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" />
|
|
</div>
|
|
)
|
|
);
|
|
Select.displayName = 'Select';
|
|
|
|
export { Select };
|