@sanity/color-input
Version:
126 lines • 2.88 kB
TypeScript
import "@sanity/ui/styles.css";
import { ObjectDefinition, ObjectInputProps, ObjectOptions, ObjectSchemaType } from "sanity";
import "react";
declare function ColorInput$1(props: ObjectInputProps): React.JSX.Element;
interface HEXColor {
hex: string;
source?: string | undefined;
}
interface HSLColor {
a?: number | undefined;
h: number;
l: number;
s: number;
source?: string | undefined;
}
interface RGBColor {
a?: number | undefined;
b: number;
g: number;
r: number;
source?: string | undefined;
}
interface HSVColor {
a?: number | undefined;
h: number;
s: number;
v: number;
source?: string | undefined;
}
type Color = string | HEXColor | HSLColor | RGBColor | HSVColor;
interface ColorValue {
hex: string;
hsl: HSLColor;
hsv: HSVColor;
rgb: RGBColor;
}
interface ColorOptions extends Omit<ObjectOptions, 'columns'> {
disableAlpha?: boolean;
colorList?: Array<Color>;
}
type ColorSchemaType = Omit<ObjectSchemaType, 'options'> & {
options?: ColorOptions;
};
type ColorInputProps = ObjectInputProps<ColorValue, ColorSchemaType>;
declare const colorTypeName = "color";
/**
* @public
*/
interface ColorDefinition extends Omit<ObjectDefinition, 'type' | 'fields' | 'options'> {
type: typeof colorTypeName;
options?: ColorOptions;
}
declare module 'sanity' {
interface IntrinsicDefinitions {
color: ColorDefinition;
}
}
declare const color: {
name: "color";
type: "object";
title: string;
components: {
input: import("react").LazyExoticComponent<typeof ColorInput$1>;
};
fields: {
title: string;
name: string;
type: string;
}[];
preview: {
select: {
title: string;
alpha: string;
hex: string;
hsl: string;
};
prepare({ title, hex, hsl, alpha }: {
title?: string;
alpha?: number;
hex?: string;
hsl?: {
h: number;
s: number;
l: number;
};
}): {
title: string;
subtitle: string;
media: () => import("react").JSX.Element;
};
};
};
declare const hslaColor: {
title: string;
name: "hslaColor";
type: "object";
fields: {
name: string;
type: "number";
title: string;
}[];
};
declare const hsvaColor: {
title: string;
name: "hsvaColor";
type: "object";
fields: {
name: string;
type: "number";
title: string;
}[];
};
declare const rgbaColor: {
title: string;
name: "rgbaColor";
type: "object";
fields: {
name: string;
type: "number";
title: string;
}[];
};
declare const ColorInput: import("react").LazyExoticComponent<typeof ColorInput$1>;
declare const colorInput: import("sanity").Plugin<void>;
export { type ColorDefinition, ColorInput, type ColorInputProps, type ColorOptions, type ColorSchemaType, type ColorValue, color, colorInput, hslaColor, hsvaColor, rgbaColor };
//# sourceMappingURL=index.d.ts.map