sanity-plugin-simpler-color-input
Version:
62 lines (52 loc) • 1.54 kB
TypeScript
import {JSX as JSX_2} from 'react'
import {ObjectInputProps} from 'sanity'
import {ObjectOptions} from 'sanity'
import {ObjectSchemaType} from 'sanity'
import {Plugin as Plugin_2} from 'sanity'
declare type ColorFormatType = 'hex' | 'hexa' | 'rgb' | 'rgba' | 'hsl' | 'hsla'
declare interface ColorOptions extends Omit<ObjectOptions, 'columns'> {
colorList?: Array<SimplerColorType>
colorFormat?: ColorFormatType
defaultColorList?: Array<SimplerColorType>
defaultColorFormat?: ColorFormatType
enableSearch?: boolean
showColorValue?: boolean
}
export declare const SimplerColorInput: (props: ObjectInputProps) => JSX_2.Element
/**
* Usage in `sanity.config.ts` (or .js)
*
* ```ts
* import {defineConfig} from 'sanity'
* import {simplerColorInput} from 'sanity-plugin-simpler-color-input'
*
* export default defineConfig({
* // ...
* plugins: [simplerColorInput()],
* })
* ```
*/
export declare const simplerColorInput: Plugin_2<void | SimplerColorInputConfig>
declare interface SimplerColorInputConfig {
defaultColorList?: Array<{
label: string
value: string
}>
defaultColorFormat?: ColorFormatType
enableSearch?: boolean
showColorValue?: boolean
}
export declare type SimplerColorInputProps = ObjectInputProps<
SimplerColorType,
SimplerColorSchemaType
>
export declare type SimplerColorSchemaType = Omit<ObjectSchemaType, 'options'> & {
options?: ColorOptions
}
export declare interface SimplerColorType {
label: string
value: string
_type?: string
_key?: string
}
export {}