UNPKG

dgz-ui

Version:

Custom ui library using React.js, Shadcn/ui, TailwindCSS, Typescript

39 lines 1.68 kB
import { type ReactNode } from 'react'; import { type GroupBase } from 'react-select'; import { type CreatableProps } from 'react-select/creatable'; /** * Option shape for ReactSelect component. * * @property {ReactNode} label - Rendered label. * @property {string|number} value - Primitive value emitted on selection. */ export type Option = { label: ReactNode; value: string | number; }; /** * Props for ReactSelect component. * Based on react-select CreatableProps but simplified to always accept Option[] for options. * * @property {Option[]} options - List of available options. * @property {ReactNode} [label] - Optional label to render externally. * @property {string} [containerClassName] - Extra classes for outer container. * @property {boolean} [error] - When true, applies error styles. * @property {boolean} [canAddItem=false] - If true, allows creating new options inline. */ export interface ReactSelectProps extends Omit<CreatableProps<Option | Option['value'], boolean, GroupBase<Option | Option['value']>>, 'options'> { options: Option[]; label?: ReactNode; containerClassName?: string; error?: boolean; canAddItem?: boolean; } /** * Enhanced select input built on react-select with optional creatable mode and tailored styles. * * @component * @param {ReactSelectProps} props - Props to configure behavior and appearance. * @returns {JSX.Element} */ export declare const ReactSelect: ({ options, label, required, error, containerClassName, className, onChange, placeholder, canAddItem, ...computedProps }: ReactSelectProps) => import("react/jsx-runtime").JSX.Element; //# sourceMappingURL=react-select.d.ts.map