diff --git a/CHANGELOG.md b/CHANGELOG.md index ce44d4916aa..a7ebc726d89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ - Added `theme` prop to `EuiHeader` ([#3524](https://github.com/elastic/eui/pull/3524)) - Added `.euiHeaderLink-isActive` class to `EuiHeaderLink` when `isActive` ([#3524](https://github.com/elastic/eui/pull/3524)) - Added `display`, `descriptionWidth`, `textWrap` and `isInvalid` props to `EuiExpression` ([#3467](https://github.com/elastic/eui/pull/3467)) +- Added more exports for `EuiColorPalettePicker` types ([#3542](https://github.com/elastic/eui/pull/3542)) **Bug Fixes** diff --git a/src-docs/src/views/color_picker/color_picker_example.js b/src-docs/src/views/color_picker/color_picker_example.js index da8f6b04405..35b12de3c9d 100644 --- a/src-docs/src/views/color_picker/color_picker_example.js +++ b/src-docs/src/views/color_picker/color_picker_example.js @@ -12,7 +12,11 @@ import { EuiSpacer, EuiText, } from '../../../../src/components'; -import { EuiColorPalettePickerPalette } from './props'; +import { + EuiColorPalettePickerPaletteText, + EuiColorPalettePickerPaletteFixed, + EuiColorPalettePickerPaletteGradient, +} from './props'; import { ColorPicker } from './color_picker'; const colorPickerSource = require('!!raw-loader!./color_picker'); @@ -341,7 +345,12 @@ export const ColorPickerExample = { code: colorPalettePickerHtml, }, ], - props: { EuiColorPalettePicker, EuiColorPalettePickerPalette }, + props: { + EuiColorPalettePicker, + EuiColorPalettePickerPaletteText, + EuiColorPalettePickerPaletteFixed, + EuiColorPalettePickerPaletteGradient, + }, snippet: colorPalettePickerSnippet, demo: , }, diff --git a/src-docs/src/views/color_picker/props.tsx b/src-docs/src/views/color_picker/props.tsx index f4cb616a8eb..cfedbaabc53 100644 --- a/src-docs/src/views/color_picker/props.tsx +++ b/src-docs/src/views/color_picker/props.tsx @@ -1,7 +1,19 @@ import React, { FunctionComponent } from 'react'; -import { EuiColorPalettePickerPaletteProps } from '../../../../src/components/color_picker/color_palette_picker'; +import { + EuiColorPalettePickerPaletteTextProps, + EuiColorPalettePickerPaletteFixedProps, + EuiColorPalettePickerPaletteGradientProps, +} from '../../../../src/components/color_picker/color_palette_picker'; -export const EuiColorPalettePickerPalette: FunctionComponent< - EuiColorPalettePickerPaletteProps +export const EuiColorPalettePickerPaletteText: FunctionComponent< + EuiColorPalettePickerPaletteTextProps +> = () =>
; + +export const EuiColorPalettePickerPaletteFixed: FunctionComponent< + EuiColorPalettePickerPaletteFixedProps +> = () =>
; + +export const EuiColorPalettePickerPaletteGradient: FunctionComponent< + EuiColorPalettePickerPaletteGradientProps > = () =>
; diff --git a/src/components/color_picker/color_palette_picker/color_palette_picker.tsx b/src/components/color_picker/color_palette_picker/color_palette_picker.tsx index 3ecca462b40..dd1bd843b00 100644 --- a/src/components/color_picker/color_palette_picker/color_palette_picker.tsx +++ b/src/components/color_picker/color_palette_picker/color_palette_picker.tsx @@ -28,7 +28,7 @@ import { ColorStop } from '../color_stops'; import { EuiSuperSelectProps } from '../../form/super_select'; -interface EuiColorPalettePickerPaletteText { +export interface EuiColorPalettePickerPaletteTextProps { /** * For storing unique value of item */ @@ -48,7 +48,7 @@ interface EuiColorPalettePickerPaletteText { palette?: string[] | ColorStop[]; } -interface EuiColorPalettePickerPaletteFixed { +export interface EuiColorPalettePickerPaletteFixedProps { /** * For storing unique value of item */ @@ -67,7 +67,7 @@ interface EuiColorPalettePickerPaletteFixed { palette: string[]; } -interface EuiColorPalettePickerPaletteGradient { +export interface EuiColorPalettePickerPaletteGradientProps { /** * For storing unique value of item */ @@ -88,9 +88,9 @@ interface EuiColorPalettePickerPaletteGradient { } export type EuiColorPalettePickerPaletteProps = - | EuiColorPalettePickerPaletteText - | EuiColorPalettePickerPaletteFixed - | EuiColorPalettePickerPaletteGradient; + | EuiColorPalettePickerPaletteTextProps + | EuiColorPalettePickerPaletteFixedProps + | EuiColorPalettePickerPaletteGradientProps; export type EuiColorPalettePickerProps = CommonProps & Omit< @@ -103,7 +103,7 @@ export type EuiColorPalettePickerProps = CommonProps & selectionDisplay?: 'palette' | 'title'; /** - * An array of #EuiColorPalettePickerPalette objects + * An array of one of the following objects: #EuiColorPalettePickerPaletteText, #EuiColorPalettePickerPaletteFixed, #EuiColorPalettePickerPaletteGradient */ palettes: EuiColorPalettePickerPaletteProps[]; }; @@ -127,8 +127,8 @@ export const EuiColorPalettePicker: FunctionComponent< }) => { const getPalette = ( item: - | EuiColorPalettePickerPaletteFixed - | EuiColorPalettePickerPaletteGradient + | EuiColorPalettePickerPaletteFixedProps + | EuiColorPalettePickerPaletteGradientProps ) => { const background = item.type === 'fixed' diff --git a/src/components/color_picker/color_palette_picker/index.ts b/src/components/color_picker/color_palette_picker/index.ts index 33fc24197d9..423fe78d092 100644 --- a/src/components/color_picker/color_palette_picker/index.ts +++ b/src/components/color_picker/color_palette_picker/index.ts @@ -20,5 +20,8 @@ export { EuiColorPalettePicker, EuiColorPalettePickerProps, + EuiColorPalettePickerPaletteTextProps, + EuiColorPalettePickerPaletteFixedProps, + EuiColorPalettePickerPaletteGradientProps, EuiColorPalettePickerPaletteProps, } from './color_palette_picker';