import React from 'react'; import { type HexColor } from './hex-color.js'; export type ColorPickerSize = 'sm' | 'md' | 'lg'; /** A preset colour offered under the picker, and what to call it. */ export interface ColorPickerSwatch { /** `#RRGGBB`. */ value: HexColor; /** * The swatch's name, read out in place of its colour — "Northwind blue". * Leave it out and React Aria names the colour in the reader's language: * "vibrant blue". */ label?: string; } export interface ColorPickerLabels { /** The swatch button that opens the picker. Default "Choose a colour". */ picker?: string; /** The group of preset swatches. Default "Suggested colours". */ swatches?: string; } export interface ColorPickerProps { /** Field label. Required for a usable control — see `a11y.requires`. */ label?: React.ReactNode; /** Names the field when there is no visible `label`. */ 'aria-label'?: string; /** Helper text below the field — where the colour is used, and any rule it must meet. */ description?: React.ReactNode; /** Replaces the helper text while the field is invalid. */ errorMessage?: React.ReactNode; isInvalid?: boolean; isDisabled?: boolean; isReadOnly?: boolean; isRequired?: boolean; /** Matches Input's `Size` variant: Small, Medium, Large. */ size?: ColorPickerSize; /** * The colour as `#RRGGBB`. `null` means none is chosen. A malformed value * throws rather than rendering an empty field. */ value?: HexColor | null; /** The initial colour, for an uncontrolled picker. */ defaultValue?: HexColor; /** * Fires with `#RRGGBB` (upper case) on every change — each step of a drag * included — or `null` when the field is cleared. */ onChange?: (value: HexColor | null) => void; /** * Fires once a change is finished: a drag let go, a key step, a swatch * picked, the hex typed and committed. Save or preview here. */ onChangeEnd?: (value: HexColor | null) => void; /** Preset colours, offered under the picker as one radio group. */ swatches?: ReadonlyArray; /** Posts the hex under this name, for an uncontrolled form. */ name?: string; /** The swatch button's name and the presets' group name. */ labels?: ColorPickerLabels; className?: string; wrapperClassName?: string; id?: string; } /** * ColorPicker — a colour chosen by a person: a brand accent, a label's * colour, a chart series. A hex field with a swatch button; the button opens * a saturation and brightness area, a hue strip and any preset swatches. * * THE FIELD FIRST * * Typing `#0B5FFF` is the fastest way to a known colour and the only one that * needs no pointer, so the field is always there and the popover is the * second way in. The two cannot disagree: they are one value. * * THE HUE IS KEPT * * Hex has no hue for a grey or for black. Dragged to the bottom of the area, * `#000000` would come back as hue 0 and the strip would jump to red. The * picker holds its own HSB colour and emits hex from it, taking a new value * from the caller only when its hex differs — so a round trip through the * caller's state loses nothing. * * WHAT IT DOES NOT DO * * - No alpha. A transparent brand colour renders differently on every * ground; ask for a solid one. * - No contrast check: the picker cannot know what goes on the colour. * When text will sit on it, check the pair and say so with `isInvalid`. */ export declare function ColorPicker({ label, 'aria-label': ariaLabel, description, errorMessage, isInvalid, isDisabled, isReadOnly, isRequired, size, value, defaultValue, onChange, onChangeEnd, swatches, name, labels, className, wrapperClassName, id, }: ColorPickerProps): React.JSX.Element; export declare namespace ColorPicker { var displayName: string; } //# sourceMappingURL=ColorPicker.d.ts.map