Skip to content

Commit

Permalink
Add exports for EuiColorPalettePicker types (#3542)
Browse files Browse the repository at this point in the history
* Added exports for EuiColorPalettePicker types

* Adding changelog
  • Loading branch information
elizabetdev authored Jun 3, 2020
1 parent d0c497b commit 0e95b75
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**

Expand Down
13 changes: 11 additions & 2 deletions src-docs/src/views/color_picker/color_picker_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -341,7 +345,12 @@ export const ColorPickerExample = {
code: colorPalettePickerHtml,
},
],
props: { EuiColorPalettePicker, EuiColorPalettePickerPalette },
props: {
EuiColorPalettePicker,
EuiColorPalettePickerPaletteText,
EuiColorPalettePickerPaletteFixed,
EuiColorPalettePickerPaletteGradient,
},
snippet: colorPalettePickerSnippet,
demo: <ColorPalettePicker />,
},
Expand Down
18 changes: 15 additions & 3 deletions src-docs/src/views/color_picker/props.tsx
Original file line number Diff line number Diff line change
@@ -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
> = () => <div />;

export const EuiColorPalettePickerPaletteFixed: FunctionComponent<
EuiColorPalettePickerPaletteFixedProps
> = () => <div />;

export const EuiColorPalettePickerPaletteGradient: FunctionComponent<
EuiColorPalettePickerPaletteGradientProps
> = () => <div />;
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -48,7 +48,7 @@ interface EuiColorPalettePickerPaletteText {
palette?: string[] | ColorStop[];
}

interface EuiColorPalettePickerPaletteFixed {
export interface EuiColorPalettePickerPaletteFixedProps {
/**
* For storing unique value of item
*/
Expand All @@ -67,7 +67,7 @@ interface EuiColorPalettePickerPaletteFixed {
palette: string[];
}

interface EuiColorPalettePickerPaletteGradient {
export interface EuiColorPalettePickerPaletteGradientProps {
/**
* For storing unique value of item
*/
Expand All @@ -88,9 +88,9 @@ interface EuiColorPalettePickerPaletteGradient {
}

export type EuiColorPalettePickerPaletteProps =
| EuiColorPalettePickerPaletteText
| EuiColorPalettePickerPaletteFixed
| EuiColorPalettePickerPaletteGradient;
| EuiColorPalettePickerPaletteTextProps
| EuiColorPalettePickerPaletteFixedProps
| EuiColorPalettePickerPaletteGradientProps;

export type EuiColorPalettePickerProps<T extends string> = CommonProps &
Omit<
Expand All @@ -103,7 +103,7 @@ export type EuiColorPalettePickerProps<T extends string> = CommonProps &
selectionDisplay?: 'palette' | 'title';

/**
* An array of #EuiColorPalettePickerPalette objects
* An array of one of the following objects: #EuiColorPalettePickerPaletteText, #EuiColorPalettePickerPaletteFixed, #EuiColorPalettePickerPaletteGradient
*/
palettes: EuiColorPalettePickerPaletteProps[];
};
Expand All @@ -127,8 +127,8 @@ export const EuiColorPalettePicker: FunctionComponent<
}) => {
const getPalette = (
item:
| EuiColorPalettePickerPaletteFixed
| EuiColorPalettePickerPaletteGradient
| EuiColorPalettePickerPaletteFixedProps
| EuiColorPalettePickerPaletteGradientProps
) => {
const background =
item.type === 'fixed'
Expand Down
3 changes: 3 additions & 0 deletions src/components/color_picker/color_palette_picker/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,8 @@
export {
EuiColorPalettePicker,
EuiColorPalettePickerProps,
EuiColorPalettePickerPaletteTextProps,
EuiColorPalettePickerPaletteFixedProps,
EuiColorPalettePickerPaletteGradientProps,
EuiColorPalettePickerPaletteProps,
} from './color_palette_picker';

0 comments on commit 0e95b75

Please sign in to comment.