@easy-shadcn/react
Version:
Use shadcn/ui easy&enhance like component library
42 lines (37 loc) • 2.12 kB
TypeScript
import * as react_jsx_runtime from 'react/jsx-runtime';
import * as React from 'react';
import { ReactNode, ComponentProps } from 'react';
import * as PopoverPrimitive from '@radix-ui/react-popover';
import { a as ButtonProps } from '../index-C1qd6jJR.js';
import 'class-variance-authority/types';
import 'class-variance-authority';
declare const PopoverContent: React.ForwardRefExoticComponent<Omit<PopoverPrimitive.PopoverContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
declare const CommandInput: React.ForwardRefExoticComponent<Omit<Omit<Pick<Pick<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "key" | keyof React.InputHTMLAttributes<HTMLInputElement>> & {
ref?: React.Ref<HTMLInputElement>;
} & {
asChild?: boolean;
}, "key" | "asChild" | keyof React.InputHTMLAttributes<HTMLInputElement>>, "onChange" | "type" | "value"> & {
value?: string;
onValueChange?: (search: string) => void;
} & React.RefAttributes<HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
type BaseOption = {
value: string | number;
label: string;
};
type SelectValue<OPT extends BaseOption, IsMultiple extends boolean> = IsMultiple extends true ? OPT['value'][] : OPT['value'];
interface SelectProps<OPT extends BaseOption, IsMultiple extends boolean> {
placeholder?: ReactNode;
buttonProps?: ButtonProps;
showSearch?: boolean;
searchProps?: ComponentProps<typeof CommandInput>;
contentProps?: ComponentProps<typeof PopoverContent>;
empty?: ReactNode;
options: OPT[];
value?: SelectValue<OPT, IsMultiple>;
width?: number | string;
onChange?: (val?: SelectValue<OPT, IsMultiple>, opt?: OPT) => void;
allowClear?: boolean;
multiple?: IsMultiple;
}
declare const Select: <OPT extends BaseOption, IsMultiple extends boolean = false>({ placeholder, buttonProps, showSearch, searchProps, contentProps, empty, options, value, onChange, width, allowClear, multiple, }: SelectProps<OPT, IsMultiple>) => react_jsx_runtime.JSX.Element;
export { Select, type SelectProps };