import { ComponentProps, ComponentPropsWithRef, ElementType, ReactElement } from 'react'; /** * ---------------------------------------------------------------------------------- * Helpers */ export type Id = string | number; export type Obj = { [p: Id]: T; }; export type ToRequired = Required> & Partial>; /** * ---------------------------------------------------------------------------------- * Enums */ export type ThemeEasingName = 'linear' | 'ease' | 'easeIn' | 'easeOut' | 'easeInOut' | 'bounce' | 'swing'; export type Status = 'success' | 'error' | 'warning' | 'info'; export type ColorPresets = 'primary' | 'secondary' | Status; export type TextColorPresets = 'primary' | 'secondary' | 'disabled' | 'placeholder' | 'inverse'; export type ColorPropsValue = ColorPresets | 'text' | 'text.primary' | 'text.secondary' | 'text.disabled' | 'text.placeholder' | 'text.inverse' | string; export type Size = 'small' | 'medium' | 'large'; export type CornerPlacement = 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' | 'leftTop' | 'leftBottom' | 'rightTop' | 'rightBottom'; export type BlockPlacement = CornerPlacement | 'top' | 'bottom'; export type Placement = BlockPlacement | 'left' | 'right'; export type DefineElement = T | null | undefined | (() => T | null | undefined); /** * ---------------------------------------------------------------------------------- * Responsive */ export type Breakpoints = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | string; export type ResponsiveValue = { [P in Breakpoints]: T; }; export type ResponsiveProp = T | ResponsiveValue; /** * ---------------------------------------------------------------------------------- * Override props */ export type DivProps = ComponentProps<'div'>; export type MergeProps = P & Omit; export type OverridableProps = { component?: C; } & MergeProps>; export type OverridableComponent = (props: OverridableProps) => ReactElement; export type SlotsAndProps> = { slots?: { [P in keyof Default]?: ElementType; }; slotProps?: { [P in keyof Default]?: Default[P] | Obj; }; }; /** * ---------------------------------------------------------------------------------- * Common select props */ export type SelectableSingleProps = { multiple?: false; defaultValue?: T; value?: T; onChange?(value: T): void; }; export type SelectableMultipleProps = { multiple: true; defaultValue?: T[]; value?: T[]; onChange?(value: T[]): void; }; export type SelectableProps = SelectableSingleProps | SelectableMultipleProps;