Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add exports for EuiColorPalettePicker types #3542

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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';