[Security Solution] Clean up expandable flyout props (#160628)

## Summary

This PR removes `onClose` prop from the expandable flyout as it is not
necessary anymore

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Luke 2023-07-07 19:16:21 +02:00 committed by GitHub
parent 9791c47fa2
commit 74e3eca687
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 9 deletions

View file

@ -20,7 +20,6 @@ describe('ExpandableFlyout', () => {
component: () => <div>{'component'}</div>,
},
];
const onClose = () => window.alert('closed');
it(`shouldn't render flyout if no panels`, () => {
const context: ExpandableFlyoutContext = {
@ -33,7 +32,7 @@ describe('ExpandableFlyout', () => {
const result = render(
<ExpandableFlyoutContext.Provider value={context}>
<ExpandableFlyout registeredPanels={registeredPanels} onClose={onClose} />
<ExpandableFlyout registeredPanels={registeredPanels} />
</ExpandableFlyoutContext.Provider>
);
@ -53,7 +52,7 @@ describe('ExpandableFlyout', () => {
const { getByTestId } = render(
<ExpandableFlyoutContext.Provider value={context}>
<ExpandableFlyout registeredPanels={registeredPanels} onClose={onClose} />
<ExpandableFlyout registeredPanels={registeredPanels} />
</ExpandableFlyoutContext.Provider>
);
@ -73,7 +72,7 @@ describe('ExpandableFlyout', () => {
const { getByTestId } = render(
<ExpandableFlyoutContext.Provider value={context}>
<ExpandableFlyout registeredPanels={registeredPanels} onClose={onClose} />
<ExpandableFlyout registeredPanels={registeredPanels} />
</ExpandableFlyoutContext.Provider>
);
@ -95,7 +94,7 @@ describe('ExpandableFlyout', () => {
const { getByTestId } = render(
<ExpandableFlyoutContext.Provider value={context}>
<ExpandableFlyout registeredPanels={registeredPanels} onClose={onClose} />
<ExpandableFlyout registeredPanels={registeredPanels} />
</ExpandableFlyoutContext.Provider>
);

View file

@ -16,7 +16,7 @@ import { RightSection } from './components/right_section';
import type { FlyoutPanel, Panel } from './types';
import { LeftSection } from './components/left_section';
export interface ExpandableFlyoutProps extends EuiFlyoutProps {
export interface ExpandableFlyoutProps extends Omit<EuiFlyoutProps, 'onClose'> {
/**
* List of all registered panels available for render
*/

View file

@ -110,7 +110,6 @@ export const SecuritySolutionTemplateWrapper: React.FC<Omit<KibanaPageTemplatePr
)}
<ExpandableFlyout
registeredPanels={expandableFlyoutDocumentsPanels}
onClose={() => {}}
handleOnFlyoutClosed={handleFlyoutChangedOrClosed}
/>
</StyledKibanaPageTemplate>

View file

@ -23,7 +23,7 @@ export interface UseAccordionStateValue {
/**
* Use this to control the accordion visual state
*/
state: typeof CLOSED | typeof OPEN;
state: ToggleReducerState;
/**
* Handler function for cycling between the states
@ -32,7 +32,7 @@ export interface UseAccordionStateValue {
}
/**
* Tiny hook for controlled useAccordionState
* Tiny hook for controlled AccordionState
* @param expandedInitially - is accordion expanded on first render
*/
export const useAccordionState = (expandedInitially: boolean): UseAccordionStateValue => {