From c3da3c91e99c79df8901420793b3615cc32ef36c Mon Sep 17 00:00:00 2001 From: miukimiu Date: Wed, 13 May 2020 17:36:18 +0100 Subject: [PATCH 1/5] Added exports for steps types --- CHANGELOG.md | 1 + src/components/steps/index.ts | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ee12037321..84f97e501e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - 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` types ([#3454](https://github.com/elastic/eui/pull/3454)) **Bug Fixes** diff --git a/src/components/steps/index.ts b/src/components/steps/index.ts index 4340ff23e87..ced5b7c87a3 100644 --- a/src/components/steps/index.ts +++ b/src/components/steps/index.ts @@ -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'; From ef16dddc46cd7efb35ee5d257b809e33f737bd9b Mon Sep 17 00:00:00 2001 From: miukimiu Date: Wed, 13 May 2020 17:57:30 +0100 Subject: [PATCH 2/5] Changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 84f97e501e8..c5a0a14aeb1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ - 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` types ([#3454](https://github.com/elastic/eui/pull/3454)) +- Added exports for `EuiSteps` types ([#3471](https://github.com/elastic/eui/pull/3471)) **Bug Fixes** From 7afda6f9313542072d6cd8d0f058355ff5c1b1f8 Mon Sep 17 00:00:00 2001 From: miukimiu Date: Wed, 13 May 2020 18:01:20 +0100 Subject: [PATCH 3/5] Changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c5a0a14aeb1..cf3ec678c9b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ - 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` types ([#3471](https://github.com/elastic/eui/pull/3471)) +- Added exports for `EuiSteps` and related components types ([#3471](https://github.com/elastic/eui/pull/3471)) **Bug Fixes** From 39559edbd5c7fb27f0e1072aba1b124c04e0dcda Mon Sep 17 00:00:00 2001 From: Greg Thompson Date: Thu, 14 May 2020 10:37:56 -0500 Subject: [PATCH 4/5] export updates --- src/components/steps/step.tsx | 8 ++++---- src/components/steps/step_horizontal.tsx | 8 ++++---- src/components/steps/step_number.tsx | 10 ++++++---- src/components/steps/steps.tsx | 16 ++++++++-------- src/components/steps/steps_horizontal.tsx | 12 ++++++++---- 5 files changed, 30 insertions(+), 24 deletions(-) diff --git a/src/components/steps/step.tsx b/src/components/steps/step.tsx index a4d962c4dd3..362166f0c91 100644 --- a/src/components/steps/step.tsx +++ b/src/components/steps/step.tsx @@ -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 @@ -49,11 +49,11 @@ export interface EuiStepProps { titleSize?: Exclude; } -export type StandaloneEuiStepProps = CommonProps & +export type EuiStepProps = CommonProps & HTMLAttributes & - EuiStepProps; + EuiStepInterface; -export const EuiStep: FunctionComponent = ({ +export const EuiStep: FunctionComponent = ({ className, children, headingElement = 'p', diff --git a/src/components/steps/step_horizontal.tsx b/src/components/steps/step_horizontal.tsx index f9ee979c842..668d4f48b0f 100644 --- a/src/components/steps/step_horizontal.tsx +++ b/src/components/steps/step_horizontal.tsx @@ -30,7 +30,9 @@ import { EuiScreenReaderOnly, EuiKeyboardAccessible } from '../accessibility'; import { EuiStepStatus, EuiStepNumber } from './step_number'; -export interface EuiStepHorizontalProps { +export interface EuiStepHorizontalProps + extends CommonProps, + HTMLAttributes { /** * Is the current step */ @@ -53,9 +55,7 @@ export interface EuiStepHorizontalProps { status?: EuiStepStatus; } -export const EuiStepHorizontal: FunctionComponent< - CommonProps & HTMLAttributes & EuiStepHorizontalProps -> = ({ +export const EuiStepHorizontal: FunctionComponent = ({ className, step = 1, title, diff --git a/src/components/steps/step_number.tsx b/src/components/steps/step_number.tsx index 0d019832abe..9b3588536fc 100644 --- a/src/components/steps/step_number.tsx +++ b/src/components/steps/step_number.tsx @@ -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'; @@ -44,7 +44,9 @@ export type EuiStepStatus = | 'danger' | 'disabled'; -export interface EuiStepNumberProps { +export interface EuiStepNumberProps + extends CommonProps, + HTMLAttributes { /** * May replace the number provided in props.number with alternate styling */ @@ -57,11 +59,11 @@ 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 & EuiStepNumberProps + 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 }) => { diff --git a/src/components/steps/steps.tsx b/src/components/steps/steps.tsx index ee355c04d41..10103e159f7 100644 --- a/src/components/steps/steps.tsx +++ b/src/components/steps/steps.tsx @@ -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; +export type EuiContainedStepProps = Omit; -export interface EuiStepsProps { +export interface EuiStepsProps + extends CommonProps, + HTMLAttributes { /** * An array of `EuiStep` objects excluding the `step` prop */ @@ -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; @@ -69,9 +71,7 @@ function renderSteps( }); } -export const EuiSteps: FunctionComponent< - CommonProps & HTMLAttributes & EuiStepsProps -> = ({ +export const EuiSteps: FunctionComponent = ({ className, firstStepNumber = 1, headingElement = 'p', diff --git a/src/components/steps/steps_horizontal.tsx b/src/components/steps/steps_horizontal.tsx index c9bb8bf29c9..9dc3c782288 100644 --- a/src/components/steps/steps_horizontal.tsx +++ b/src/components/steps/steps_horizontal.tsx @@ -25,7 +25,9 @@ import { EuiStepHorizontalProps, EuiStepHorizontal } from './step_horizontal'; type ContainedEuiStepHorizontalProps = Omit; -export interface EuiStepsHorizontalProps { +export interface EuiStepsHorizontalProps + extends CommonProps, + HTMLAttributes { /** * An array of `EuiStepHorizontal` objects excluding the `step` prop */ @@ -38,9 +40,11 @@ function renderHorizontalSteps(steps: ContainedEuiStepHorizontalProps[]) { }); } -export const EuiStepsHorizontal: FunctionComponent< - CommonProps & HTMLAttributes & EuiStepsHorizontalProps -> = ({ className, steps, ...rest }) => { +export const EuiStepsHorizontal: FunctionComponent = ({ + className, + steps, + ...rest +}) => { const classes = classNames('euiStepsHorizontal', className); return ( From 55f1a11981e2fe2d6e33c5be18bca88452c067c4 Mon Sep 17 00:00:00 2001 From: Greg Thompson Date: Thu, 14 May 2020 10:46:07 -0500 Subject: [PATCH 5/5] clean up --- src/components/steps/step_number.tsx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/components/steps/step_number.tsx b/src/components/steps/step_number.tsx index 9b3588536fc..2df7a717a1f 100644 --- a/src/components/steps/step_number.tsx +++ b/src/components/steps/step_number.tsx @@ -62,11 +62,14 @@ export interface EuiStepNumberProps titleSize?: EuiStepProps['titleSize']; } -export const EuiStepNumber: FunctionComponent< - 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 = ({ + className, + status, + number, + isHollow, + titleSize, + ...rest +}) => { const classes = classNames( 'euiStepNumber', status ? statusToClassNameMap[status] : undefined,