UNPKG

mui-color-input

Version:

A color input designed for the React library MUI built with TinyColor

55 lines (41 loc) 2.04 kB
import { ButtonProps } from '@mui/material/Button'; import { ColorFormats } from '@ctrl/tinycolor'; import { default as default_2 } from 'react'; import { JSX } from 'react/jsx-runtime'; import { ColorInput as MuiColorInputValue } from '@ctrl/tinycolor'; import { PopoverProps as PopoverProps_2 } from '@mui/material/Popover'; import { TextFieldProps as TextFieldProps_2 } from '@mui/material/TextField'; import { TinyColor } from '@ctrl/tinycolor'; declare type ColorButtonElement = (props: MuiColorButtonProps) => default_2.ReactNode; export declare function matchIsValidColor(color: MuiColorInputValue): boolean; export declare type MuiColorButtonProps = Omit<ButtonProps, 'children'> & { bgColor: string; isBgColorValid: boolean; disablePopover: boolean; }; export declare const MuiColorInput: default_2.ForwardRefExoticComponent<Omit<MuiColorInputProps, "ref"> & default_2.RefAttributes<HTMLDivElement>>; export declare const MuiColorInputButton: (props: MuiColorButtonProps) => JSX.Element; export declare type MuiColorInputColors = { hex: string; hsl: string; hsv: string; rgb: string; hex8: string; }; export declare type MuiColorInputFormat = Extract<'hex' | 'rgb' | 'hex8' | 'hsl' | 'hsv', ColorFormats>; export declare interface MuiColorInputProps extends TextFieldProps { value: MuiColorInputValue; adornmentPosition?: 'start' | 'end'; Adornment?: ColorButtonElement; fallbackValue?: MuiColorInputValue; format?: MuiColorInputFormat; disablePopover?: boolean; isAlphaHidden?: boolean; onChange?: (value: string, colors: MuiColorInputColors) => void; PopoverProps?: PopoverProps; } export { MuiColorInputValue } declare type PopoverProps = Omit<PopoverProps_2, 'anchorEl' | 'open' | 'children'>; declare type TextFieldProps = Omit<TextFieldProps_2, 'onChange' | 'select' | 'type' | 'multiline' | 'defaultValue' | 'InputProps' | 'inputProps' | 'InputLabelProps'>; export { TinyColor } export { }