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 EuiSteps and related components types #3471

Merged
merged 8 commits into from
May 14, 2020
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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## [`master`](https://github.com/elastic/eui/tree/master)

No public interface changes since `24.0.0`.
- Added exports for `EuiSteps` and related components types ([#3471](https://github.com/elastic/eui/pull/3471))

## [`24.0.0`](https://github.com/elastic/eui/tree/v24.0.0)

Expand All @@ -11,6 +11,7 @@ No public interface changes since `24.0.0`.
- Updated `EuiImage`'s `caption` prop type from `string` to `ReactNode` ([#3387](https://github.com/elastic/eui/pull/3387))
- Improved contrast for `EuiCollapsibleNav` close button ([#3465](https://github.com/elastic/eui/pull/3465))
- Fixed `EuiCodeEditor` console error when using the editor without import the default theme ([#3454](https://github.com/elastic/eui/pull/3454))
- Added exports for `EuiSteps` and related components types ([#3471](https://github.com/elastic/eui/pull/3471))

**Bug Fixes**

Expand Down
17 changes: 12 additions & 5 deletions src/components/steps/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,19 @@
* under the License.
*/

export { EuiStep } from './step';
export { EuiStep, EuiStepProps } from './step';

export { EuiSteps } from './steps';
export { EuiSteps, EuiStepsProps } from './steps';

export { EuiSubSteps } from './sub_steps';
export { EuiSubSteps, EuiSubStepsProps } from './sub_steps';

export { EuiStepsHorizontal } from './steps_horizontal';
export {
EuiStepsHorizontal,
EuiStepsHorizontalProps,
} from './steps_horizontal';

export { EuiStepStatus } from './step_number';
export {
EuiStepStatus,
EuiStepNumber,
EuiStepNumberProps,
} from './step_number';
8 changes: 4 additions & 4 deletions src/components/steps/step.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { EuiStepStatus, EuiStepNumber } from './step_number';

import { EuiI18n } from '../i18n';

export interface EuiStepProps {
export interface EuiStepInterface {
children: ReactNode;
/**
* The HTML tag used for the title
Expand All @@ -49,11 +49,11 @@ export interface EuiStepProps {
titleSize?: Exclude<EuiTitleProps['size'], 'xxxs' | 'xxs' | 'l'>;
}

export type StandaloneEuiStepProps = CommonProps &
export type EuiStepProps = CommonProps &
HTMLAttributes<HTMLDivElement> &
EuiStepProps;
EuiStepInterface;

export const EuiStep: FunctionComponent<StandaloneEuiStepProps> = ({
export const EuiStep: FunctionComponent<EuiStepProps> = ({
className,
children,
headingElement = 'p',
Expand Down
8 changes: 4 additions & 4 deletions src/components/steps/step_horizontal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ import { EuiScreenReaderOnly, EuiKeyboardAccessible } from '../accessibility';

import { EuiStepStatus, EuiStepNumber } from './step_number';

export interface EuiStepHorizontalProps {
export interface EuiStepHorizontalProps
extends CommonProps,
HTMLAttributes<HTMLDivElement> {
/**
* Is the current step
*/
Expand All @@ -53,9 +55,7 @@ export interface EuiStepHorizontalProps {
status?: EuiStepStatus;
}

export const EuiStepHorizontal: FunctionComponent<
CommonProps & HTMLAttributes<HTMLDivElement> & EuiStepHorizontalProps
> = ({
export const EuiStepHorizontal: FunctionComponent<EuiStepHorizontalProps> = ({
className,
step = 1,
title,
Expand Down
21 changes: 13 additions & 8 deletions src/components/steps/step_number.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import classNames from 'classnames';

import { EuiIcon } from '../icon';

import { StandaloneEuiStepProps } from './step';
import { EuiStepProps } from './step';

import { EuiI18n } from '../i18n';
import { CommonProps, keysOf } from '../common';
Expand All @@ -44,7 +44,9 @@ export type EuiStepStatus =
| 'danger'
| 'disabled';

export interface EuiStepNumberProps {
export interface EuiStepNumberProps
extends CommonProps,
HTMLAttributes<HTMLDivElement> {
/**
* May replace the number provided in props.number with alternate styling
*/
Expand All @@ -57,14 +59,17 @@ export interface EuiStepNumberProps {
/**
* Title sizing equivalent to EuiTitle, but only `m`, `s` and `xs`. Defaults to `s`
*/
titleSize?: StandaloneEuiStepProps['titleSize'];
titleSize?: EuiStepProps['titleSize'];
}

export const EuiStepNumber: FunctionComponent<
CommonProps & HTMLAttributes<HTMLDivElement> & EuiStepNumberProps
// Note - tslint:disable refers to the `number` as it conflicts with the build in number type
// tslint:disable-next-line:variable-name
> = ({ className, status, number, isHollow, titleSize, ...rest }) => {
export const EuiStepNumber: FunctionComponent<EuiStepNumberProps> = ({
className,
status,
number,
isHollow,
titleSize,
...rest
}) => {
const classes = classNames(
'euiStepNumber',
status ? statusToClassNameMap[status] : undefined,
Expand Down
16 changes: 8 additions & 8 deletions src/components/steps/steps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ import React, { FunctionComponent, HTMLAttributes } from 'react';
import { CommonProps } from '../common';
import classNames from 'classnames';

import { StandaloneEuiStepProps, EuiStep } from './step';
import { EuiStepProps, EuiStep } from './step';

export type EuiContainedStepProps = Omit<StandaloneEuiStepProps, 'step'>;
export type EuiContainedStepProps = Omit<EuiStepProps, 'step'>;

export interface EuiStepsProps {
export interface EuiStepsProps
extends CommonProps,
HTMLAttributes<HTMLDivElement> {
/**
* An array of `EuiStep` objects excluding the `step` prop
*/
Expand All @@ -41,14 +43,14 @@ export interface EuiStepsProps {
/**
* Title sizing equivalent to EuiTitle, but only `m`, `s` and `xs`. Defaults to `s`
*/
titleSize?: StandaloneEuiStepProps['titleSize'];
titleSize?: EuiStepProps['titleSize'];
}

function renderSteps(
steps: EuiContainedStepProps[],
firstStepNumber: number,
headingElement: string,
titleSize?: StandaloneEuiStepProps['titleSize']
titleSize?: EuiStepProps['titleSize']
) {
return steps.map((step, index) => {
const { className, children, title, status, ...rest } = step;
Expand All @@ -69,9 +71,7 @@ function renderSteps(
});
}

export const EuiSteps: FunctionComponent<
CommonProps & HTMLAttributes<HTMLDivElement> & EuiStepsProps
> = ({
export const EuiSteps: FunctionComponent<EuiStepsProps> = ({
className,
firstStepNumber = 1,
headingElement = 'p',
Expand Down
12 changes: 8 additions & 4 deletions src/components/steps/steps_horizontal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ import { EuiStepHorizontalProps, EuiStepHorizontal } from './step_horizontal';

type ContainedEuiStepHorizontalProps = Omit<EuiStepHorizontalProps, 'step'>;

export interface EuiStepsHorizontalProps {
export interface EuiStepsHorizontalProps
extends CommonProps,
HTMLAttributes<HTMLDivElement> {
/**
* An array of `EuiStepHorizontal` objects excluding the `step` prop
*/
Expand All @@ -38,9 +40,11 @@ function renderHorizontalSteps(steps: ContainedEuiStepHorizontalProps[]) {
});
}

export const EuiStepsHorizontal: FunctionComponent<
CommonProps & HTMLAttributes<HTMLDivElement> & EuiStepsHorizontalProps
> = ({ className, steps, ...rest }) => {
export const EuiStepsHorizontal: FunctionComponent<EuiStepsHorizontalProps> = ({
className,
steps,
...rest
}) => {
const classes = classNames('euiStepsHorizontal', className);

return (
Expand Down