@sanity/color-input
Version:
94 lines (78 loc) • 2.4 kB
text/typescript
import type {Color} from 'react-color'
import type {HSLColor} from 'react-color'
import type {HSVColor} from 'react-color'
import {JSX as JSX_2} from 'react'
import {LazyExoticComponent} from 'react'
import {ObjectDefinition} from 'sanity'
import {ObjectInputProps} from 'sanity'
import type {ObjectOptions} from 'sanity'
import type {ObjectSchemaType} from 'sanity'
import {Plugin as Plugin_2} from 'sanity'
import {PreviewConfig} from 'sanity'
import type {RGBColor} from 'react-color'
export declare const color: {
type: 'object'
name: 'color'
} & Omit<ObjectDefinition, 'preview'> & {
preview?:
| PreviewConfig<
{
title: string
alpha: string
hex: string
hsl: string
},
Record<'title' | 'hex' | 'hsl' | 'alpha', any>
>
| undefined
}
/**
* @public
*/
export declare interface ColorDefinition
extends Omit<ObjectDefinition, 'type' | 'fields' | 'options'> {
type: typeof colorTypeName
options?: ColorOptions
}
export declare const ColorInput: LazyExoticComponent<ColorInput_2>
export declare const colorInput: Plugin_2<void>
declare function ColorInput_2(props: ObjectInputProps): JSX_2.Element
export declare type ColorInputProps = ObjectInputProps<ColorValue, ColorSchemaType>
export declare interface ColorOptions extends Omit<ObjectOptions, 'columns'> {
disableAlpha?: boolean
colorList?: Array<Color>
}
export declare type ColorSchemaType = Omit<ObjectSchemaType, 'options'> & {
options?: ColorOptions
}
declare const colorTypeName: 'color'
export declare interface ColorValue {
hex: string
hsl: HSLColor
hsv: HSVColor
rgb: RGBColor
}
export declare const hslaColor: {
type: 'object'
name: 'hslaColor'
} & Omit<ObjectDefinition, 'preview'> & {
preview?: PreviewConfig<Record<string, string>, Record<never, any>> | undefined
}
export declare const hsvaColor: {
type: 'object'
name: 'hsvaColor'
} & Omit<ObjectDefinition, 'preview'> & {
preview?: PreviewConfig<Record<string, string>, Record<never, any>> | undefined
}
export declare const rgbaColor: {
type: 'object'
name: 'rgbaColor'
} & Omit<ObjectDefinition, 'preview'> & {
preview?: PreviewConfig<Record<string, string>, Record<never, any>> | undefined
}
export {}
declare module '@sanity/types' {
interface IntrinsicDefinitions {
color: ColorDefinition
}
}