Skip to content

Commit

Permalink
Fix broken EuiFlyout subcomponent props
Browse files Browse the repository at this point in the history
  • Loading branch information
cee-chen committed Sep 27, 2023
1 parent 3291371 commit c762937
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/

import React, { useContext } from 'react';
import React, { FunctionComponent, useContext } from 'react';
import classNames from 'classnames';

import { useEuiTheme } from '../../services';
Expand All @@ -30,7 +30,7 @@ import {
* Note: They are not intended to be used standalone outside of EuiCollapsibleNav
*/

export const EuiCollapsibleNavBody: EuiFlyoutBodyProps = ({
export const EuiCollapsibleNavBody: FunctionComponent<EuiFlyoutBodyProps> = ({
className,
...props
}) => {
Expand All @@ -55,10 +55,9 @@ export const EuiCollapsibleNavBody: EuiFlyoutBodyProps = ({
);
};

export const EuiCollapsibleNavFooter: EuiFlyoutFooterProps = ({
className,
...props
}) => {
export const EuiCollapsibleNavFooter: FunctionComponent<
EuiFlyoutFooterProps
> = ({ className, ...props }) => {
const classes = classNames('euiCollapsibleNav__footer', className);

const euiTheme = useEuiTheme();
Expand Down
38 changes: 18 additions & 20 deletions src/components/flyout/flyout_body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,25 @@ import { CommonProps } from '../common';
import { useEuiTheme } from '../../services';
import { euiFlyoutBodyStyles } from './flyout_body.styles';

export type EuiFlyoutBodyProps = FunctionComponent<
HTMLAttributes<HTMLDivElement> &
CommonProps & {
/**
* Use to display a banner at the top of the body. It is suggested to use `EuiCallOut` for it.
*/
banner?: ReactNode;
/**
* [Scrollable regions (or their children) should be focusable](https://dequeuniversity.com/rules/axe/4.0/scrollable-region-focusable)
* to allow keyboard users to scroll the region via arrow keys.
*
* By default, EuiFlyoutBody's scroll overflow wrapper sets a `tabIndex` of `0`.
* If you know your flyout body content already contains focusable children
* that satisfy keyboard accessibility requirements, you can use this prop
* to override this default.
*/
scrollableTabIndex?: number;
}
>;
export type EuiFlyoutBodyProps = HTMLAttributes<HTMLDivElement> &
CommonProps & {
/**
* Use to display a banner at the top of the body. It is suggested to use `EuiCallOut` for it.
*/
banner?: ReactNode;
/**
* [Scrollable regions (or their children) should be focusable](https://dequeuniversity.com/rules/axe/4.0/scrollable-region-focusable)
* to allow keyboard users to scroll the region via arrow keys.
*
* By default, EuiFlyoutBody's scroll overflow wrapper sets a `tabIndex` of `0`.
* If you know your flyout body content already contains focusable children
* that satisfy keyboard accessibility requirements, you can use this prop
* to override this default.
*/
scrollableTabIndex?: number;
};

export const EuiFlyoutBody: EuiFlyoutBodyProps = ({
export const EuiFlyoutBody: FunctionComponent<EuiFlyoutBodyProps> = ({
children,
className,
banner,
Expand Down
6 changes: 2 additions & 4 deletions src/components/flyout/flyout_footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ import { CommonProps } from '../common';
import { useEuiTheme } from '../../services';
import { euiFlyoutFooterStyles } from './flyout_footer.styles';

export type EuiFlyoutFooterProps = FunctionComponent<
HTMLAttributes<HTMLDivElement> & CommonProps
>;
export type EuiFlyoutFooterProps = HTMLAttributes<HTMLDivElement> & CommonProps;

export const EuiFlyoutFooter: EuiFlyoutFooterProps = ({
export const EuiFlyoutFooter: FunctionComponent<EuiFlyoutFooterProps> = ({
children,
className,
...rest
Expand Down
12 changes: 5 additions & 7 deletions src/components/flyout/flyout_header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@ import { CommonProps } from '../common';
import { useEuiTheme } from '../../services';
import { euiFlyoutHeaderStyles } from './flyout_header.styles';

export type EuiFlyoutHeaderProps = FunctionComponent<
HTMLAttributes<HTMLDivElement> &
CommonProps & {
hasBorder?: boolean;
}
>;
export type EuiFlyoutHeaderProps = HTMLAttributes<HTMLDivElement> &
CommonProps & {
hasBorder?: boolean;
};

export const EuiFlyoutHeader: EuiFlyoutHeaderProps = ({
export const EuiFlyoutHeader: FunctionComponent<EuiFlyoutHeaderProps> = ({
children,
className,
hasBorder = false,
Expand Down
3 changes: 3 additions & 0 deletions upcoming_changelogs/7228.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**Bug fixes**

- Fixed `EuiFlyoutBodyProps`, `EuiFlyoutFooterProps`, and `EuiFlyoutHeaderProps` type exports

0 comments on commit c762937

Please sign in to comment.