From 0a277f356dc2a71a7f68cd1cbb979bd1f3ba4119 Mon Sep 17 00:00:00 2001 From: PhilippeOberti Date: Fri, 7 Jun 2024 11:56:06 -0500 Subject: [PATCH 1/2] [Package][Expandable flyout] - fix Storybook --- .../src/index.stories.tsx | 82 +++++++++++-------- .../src/test/provider.tsx | 13 +-- 2 files changed, 57 insertions(+), 38 deletions(-) diff --git a/packages/kbn-expandable-flyout/src/index.stories.tsx b/packages/kbn-expandable-flyout/src/index.stories.tsx index e02e3de8b791a..a0f5dd2ca1922 100644 --- a/packages/kbn-expandable-flyout/src/index.stories.tsx +++ b/packages/kbn-expandable-flyout/src/index.stories.tsx @@ -102,11 +102,15 @@ const registeredPanels = [ export const Right: Story = () => { const state = { - right: { - id: 'right', + byId: { + memory: { + right: { + id: 'right', + }, + left: {}, + preview: [], + }, }, - left: {}, - preview: [], } as unknown as State; return ( @@ -118,13 +122,17 @@ export const Right: Story = () => { export const Left: Story = () => { const state = { - right: { - id: 'right', - }, - left: { - id: 'left', + byId: { + memory: { + right: { + id: 'right', + }, + left: { + id: 'left', + }, + preview: [], + }, }, - preview: [], } as unknown as State; return ( @@ -136,17 +144,21 @@ export const Left: Story = () => { export const Preview: Story = () => { const state = { - right: { - id: 'right', - }, - left: { - id: 'left', - }, - preview: [ - { - id: 'preview1', + byId: { + memory: { + right: { + id: 'right', + }, + left: { + id: 'left', + }, + preview: [ + { + id: 'preview1', + }, + ], }, - ], + }, } as unknown as State; return ( @@ -158,20 +170,24 @@ export const Preview: Story = () => { export const MultiplePreviews: Story = () => { const state = { - right: { - id: 'right', - }, - left: { - id: 'left', - }, - preview: [ - { - id: 'preview1', + byId: { + memory: { + right: { + id: 'right', + }, + left: { + id: 'left', + }, + preview: [ + { + id: 'preview1', + }, + { + id: 'preview2', + }, + ], }, - { - id: 'preview2', - }, - ], + }, } as unknown as State; return ( diff --git a/packages/kbn-expandable-flyout/src/test/provider.tsx b/packages/kbn-expandable-flyout/src/test/provider.tsx index 896b563056206..281225161b27a 100644 --- a/packages/kbn-expandable-flyout/src/test/provider.tsx +++ b/packages/kbn-expandable-flyout/src/test/provider.tsx @@ -9,6 +9,7 @@ import { Provider as ReduxProvider } from 'react-redux'; import { configureStore } from '@reduxjs/toolkit'; import React, { FC, PropsWithChildren } from 'react'; +import { I18nProvider } from '@kbn/i18n-react'; import { ExpandableFlyoutContextProvider } from '../context'; import { reducer } from '../reducer'; import { Context } from '../redux'; @@ -32,10 +33,12 @@ export const TestProvider: FC> = ({ }); return ( - - - {children} - - + + + + {children} + + + ); }; From 8b8b3ac0312fb7d3e29936270c9622d47badded3 Mon Sep 17 00:00:00 2001 From: PhilippeOberti Date: Fri, 7 Jun 2024 12:23:50 -0500 Subject: [PATCH 2/2] remove as unknown --- .../src/index.stories.tsx | 22 +++++++++---------- packages/kbn-expandable-flyout/tsconfig.json | 3 ++- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/packages/kbn-expandable-flyout/src/index.stories.tsx b/packages/kbn-expandable-flyout/src/index.stories.tsx index a0f5dd2ca1922..1c10c5454b727 100644 --- a/packages/kbn-expandable-flyout/src/index.stories.tsx +++ b/packages/kbn-expandable-flyout/src/index.stories.tsx @@ -101,17 +101,17 @@ const registeredPanels = [ ]; export const Right: Story = () => { - const state = { + const state: State = { byId: { memory: { right: { id: 'right', }, - left: {}, - preview: [], + left: undefined, + preview: undefined, }, }, - } as unknown as State; + }; return ( @@ -121,7 +121,7 @@ export const Right: Story = () => { }; export const Left: Story = () => { - const state = { + const state: State = { byId: { memory: { right: { @@ -130,10 +130,10 @@ export const Left: Story = () => { left: { id: 'left', }, - preview: [], + preview: undefined, }, }, - } as unknown as State; + }; return ( @@ -143,7 +143,7 @@ export const Left: Story = () => { }; export const Preview: Story = () => { - const state = { + const state: State = { byId: { memory: { right: { @@ -159,7 +159,7 @@ export const Preview: Story = () => { ], }, }, - } as unknown as State; + }; return ( @@ -169,7 +169,7 @@ export const Preview: Story = () => { }; export const MultiplePreviews: Story = () => { - const state = { + const state: State = { byId: { memory: { right: { @@ -188,7 +188,7 @@ export const MultiplePreviews: Story = () => { ], }, }, - } as unknown as State; + }; return ( diff --git a/packages/kbn-expandable-flyout/tsconfig.json b/packages/kbn-expandable-flyout/tsconfig.json index 2b6e518016871..5a0cf87cf61e2 100644 --- a/packages/kbn-expandable-flyout/tsconfig.json +++ b/packages/kbn-expandable-flyout/tsconfig.json @@ -20,6 +20,7 @@ ], "kbn_references": [ "@kbn/i18n", - "@kbn/kibana-utils-plugin" + "@kbn/kibana-utils-plugin", + "@kbn/i18n-react" ] }