ant-design/components/color-picker/context.ts
二货爱吃白萝卜 832cffcdf9
feat: ColorPicker support gradient color (#50050)
* refactor: support type update

* chore: update clear style

* chore: bump color picker

* chore: use slider

* chore: bump color picker

* chore: range slider

* chore: layout

* chore: useModeColor

* chore: simplify

* chore: bump color picker

* refactor: event

* chore: tmp lock check

* chore: of it

* chore: update ts def

* chore: update ts def

* chore: remove useless ts

* chore: linear

* chore: adjust style

* chore: rm useless code

* chore: fill color

* chore: basic linear

* chore: support toStr

* chore: limit minCount

* chore: use cache

* chore: drag support:

* chore: yes

* chore: update demo

* chore: useLayoutEffect instead

* chore: fix click to add point

* chore: add smmoth

* chore: support of locale

* chore: add locale

* chore: fix lint

* chore: adjust style

* chore: fix lint

* chore: fix style

* test: fix test case

* chore: fix popover

* test: fix test case

* chore: fix test

* test: clean up

* chore: fix lint

* chore: fix lint

* chore: fix lint

* test: coverage

* test: coverage

* test: coverage

* test: coverage

* test: coverage

* test: coverage

* chore: fix docs

* docs: update demo desc

* chore: enhance hover range

* fix: delete not working

* chore: fix lint

* test: coverage

* test: coverage

* chore: clean up

* chore: adjust

* chore: highlight

* chore: adjust style

* chore: fix lint

* chore: update demo

* chore: memo perf

* refactor: up to down colors

* test: update snapshot
2024-07-29 16:38:50 +08:00

51 lines
1.5 KiB
TypeScript

import React from 'react';
import type { GetProp } from '../_util/type';
import type { AggregationColor } from './color';
import type { ModeOptions } from './hooks/useModeColor';
import type { ColorFormatType, ColorPickerProps, ModeType, PresetsItem } from './interface';
export interface PanelPickerContextProps {
prefixCls: string;
allowClear?: boolean;
disabled?: boolean;
disabledAlpha?: boolean;
mode: ModeType;
onModeChange: (mode: ModeType) => void;
modeOptions: ModeOptions;
value: AggregationColor;
onChange: (value?: AggregationColor, pickColor?: boolean) => void;
onChangeComplete: GetProp<ColorPickerProps, 'onChangeComplete'>;
format?: ColorFormatType;
onFormatChange?: ColorPickerProps['onFormatChange'];
/** The gradient Slider active handle */
activeIndex: number;
/** The gradient Slider handle active changed */
onActive: (index: number) => void;
/** Is gradient Slider dragging */
gradientDragging: boolean;
/** The gradient Slider dragging changed */
onGradientDragging: (dragging: boolean) => void;
onClear?: () => void;
}
export interface PanelPresetsContextProps {
prefixCls: string;
presets?: PresetsItem[];
disabled?: boolean;
value: AggregationColor;
onChange?: (value: AggregationColor) => void;
}
export const PanelPickerContext = React.createContext<PanelPickerContextProps>(
{} as PanelPickerContextProps,
);
export const PanelPresetsContext = React.createContext<PanelPresetsContextProps>(
{} as PanelPresetsContextProps,
);