@snowball-tech/fractal
Version:
Fractal's (Snowball's design system) React component library based on RadixUI and PandaCSS
56 lines (53 loc) • 1.68 kB
TypeScript
import { SelectContentProps } from '@radix-ui/react-select';
import { AllHTMLAttributes, ReactNode, ForwardedRef } from 'react';
type CombinedRefs = {
container: HTMLDivElement | null;
dropdown: HTMLDivElement | null;
trigger: HTMLButtonElement | null;
};
interface SelectProps extends Omit<AllHTMLAttributes<HTMLSelectElement>, 'onSelect'> {
autoFocus?: boolean;
children?: ReactNode;
defaultValue?: string;
description?: string;
disabled?: boolean;
displayedValue?: ReactNode;
dropdown?: Partial<{
className?: string;
ref?: ForwardedRef<HTMLDivElement>;
} & Omit<SelectContentProps, 'asChild'>>;
fullWidth?: boolean;
id?: string;
label?: string;
name?: string;
open?: boolean;
placeholder?: string;
portalled?: boolean;
rainbow?: boolean;
readOnly?: boolean;
required?: boolean;
value?: string;
onClose?: () => void;
onOpen?: () => void;
onSelect?: (newValue: string) => void;
}
interface SelectEmptyProps extends AllHTMLAttributes<HTMLDivElement> {
children?: ReactNode;
label?: string;
value?: string;
}
interface SelectItemProps extends AllHTMLAttributes<HTMLDivElement> {
value: string;
children?: ReactNode;
disabled?: boolean;
label?: string;
rainbow?: boolean;
}
interface SelectItemGroupProps extends AllHTMLAttributes<HTMLDivElement> {
children: ReactNode;
label: string;
disabled?: boolean;
rainbow?: boolean;
}
type SelectItemSeparatorProps = AllHTMLAttributes<HTMLDivElement>;
export type { CombinedRefs, SelectEmptyProps, SelectItemGroupProps, SelectItemProps, SelectItemSeparatorProps, SelectProps };