diff --git a/src-docs/src/views/flyout/flyout.js b/src-docs/src/views/flyout/flyout.tsx similarity index 100% rename from src-docs/src/views/flyout/flyout.js rename to src-docs/src/views/flyout/flyout.tsx diff --git a/src-docs/src/views/flyout/flyout_banner.js b/src-docs/src/views/flyout/flyout_banner.tsx similarity index 100% rename from src-docs/src/views/flyout/flyout_banner.js rename to src-docs/src/views/flyout/flyout_banner.tsx diff --git a/src-docs/src/views/flyout/flyout_complicated.js b/src-docs/src/views/flyout/flyout_complicated.tsx similarity index 96% rename from src-docs/src/views/flyout/flyout_complicated.js rename to src-docs/src/views/flyout/flyout_complicated.tsx index e4f43c67fa7..8d6a4462efe 100644 --- a/src-docs/src/views/flyout/flyout_complicated.js +++ b/src-docs/src/views/flyout/flyout_complicated.tsx @@ -56,11 +56,9 @@ export default () => { const togglePopover = () => setIsPopoverOpen((isPopoverOpen) => !isPopoverOpen); - const onSelectedTabChanged = (id) => setSelectedTabId(id); - const renderTabs = tabs.map((tab, index) => ( onSelectedTabChanged(tab.id)} + onClick={() => setSelectedTabId(tab.id)} isSelected={tab.id === selectedTabId} key={index} > @@ -107,10 +105,6 @@ export default () => { }, ]; - const onSuperSelectChange = (value) => { - setSuperSelectValue(value); - }; - const flyoutContent = (

@@ -224,7 +218,7 @@ export default () => { onSuperSelectChange(value)} + onChange={(value) => setSuperSelectValue(value)} itemLayoutAlign="top" popoverProps={{ repositionOnScroll: true }} hasDividers diff --git a/src-docs/src/views/flyout/flyout_example.js b/src-docs/src/views/flyout/flyout_example.js index c57729a21ae..5d78b9b2e0c 100644 --- a/src-docs/src/views/flyout/flyout_example.js +++ b/src-docs/src/views/flyout/flyout_example.js @@ -18,14 +18,14 @@ const flyoutSource = require('!!raw-loader!./flyout'); import FlyoutComplicated from './flyout_complicated'; const flyoutComplicatedSource = require('!!raw-loader!./flyout_complicated'); -import FlyoutSmall from './flyout_small'; -const flyoutSmallSource = require('!!raw-loader!./flyout_small'); +import FlyoutOwnFocus from './flyout_own_focus'; +const flyoutOwnFocusSource = require('!!raw-loader!./flyout_own_focus'); -import FlyoutLarge from './flyout_large'; -const flyoutLargeSource = require('!!raw-loader!./flyout_large'); +import FlyoutSizes from './flyout_sizes'; +const flyoutSizesSource = require('!!raw-loader!./flyout_sizes'); -import FlyoutPaddingMedium from './flyout_padding_medium'; -const FlyoutPaddingMediumSource = require('!!raw-loader!./flyout_padding_medium'); +import FlyoutPaddingSizes from './flyout_padding_sizes'; +const FlyoutPaddingSizesSource = require('!!raw-loader!./flyout_padding_sizes'); import FlyoutMaxWidth from './flyout_max_width'; const flyoutMaxWidthSource = require('!!raw-loader!./flyout_max_width'); @@ -66,7 +66,7 @@ const flyoutComplicatedSnippet = ` `; -const flyoutSmallSnippet = ` +const flyoutOwnFocusSnippet = `

@@ -78,7 +78,7 @@ const flyoutSmallSnippet = ` `; -const flyoutMediumPaddingSnippet = ` +const flyoutSizesPaddingSnippet = `

@@ -104,7 +104,7 @@ const flyoutMaxWidthSnippet = ` `; -const flyoutLargeSnippet = ` +const flyoutSizesSnippet = `

@@ -214,8 +214,8 @@ export const FlyoutExample = { title: 'Sizing', source: [ { - type: GuideSectionTypes.JS, - code: flyoutLargeSource, + type: GuideSectionTypes.TSX, + code: flyoutSizesSource, }, ], text: ( @@ -227,16 +227,16 @@ export const FlyoutExample = { number or string format.

), - snippet: flyoutLargeSnippet, - demo: , + snippet: flyoutSizesSnippet, + demo: , props: { EuiFlyout }, }, { title: 'Adjusting padding', source: [ { - type: GuideSectionTypes.JS, - code: FlyoutPaddingMediumSource, + type: GuideSectionTypes.TSX, + code: FlyoutPaddingSizesSource, }, ], text: ( @@ -250,8 +250,8 @@ export const FlyoutExample = { flyout.

), - snippet: flyoutMediumPaddingSnippet, - demo: , + snippet: flyoutSizesPaddingSnippet, + demo: , props: { EuiFlyout }, }, { @@ -282,7 +282,7 @@ export const FlyoutExample = { source: [ { type: GuideSectionTypes.JS, - code: flyoutSmallSource, + code: flyoutOwnFocusSource, }, ], text: ( @@ -302,8 +302,8 @@ export const FlyoutExample = {

), - snippet: flyoutSmallSnippet, - demo: , + snippet: flyoutOwnFocusSnippet, + demo: , props: { EuiFlyout }, }, { @@ -339,7 +339,7 @@ export const FlyoutExample = { title: 'Understanding max-width', source: [ { - type: GuideSectionTypes.JS, + type: GuideSectionTypes.TSX, code: flyoutMaxWidthSource, }, ], diff --git a/src-docs/src/views/flyout/flyout_max_width.js b/src-docs/src/views/flyout/flyout_max_width.tsx similarity index 95% rename from src-docs/src/views/flyout/flyout_max_width.js rename to src-docs/src/views/flyout/flyout_max_width.tsx index 80db2a0c417..666e9626138 100644 --- a/src-docs/src/views/flyout/flyout_max_width.js +++ b/src-docs/src/views/flyout/flyout_max_width.tsx @@ -2,6 +2,7 @@ import React, { useState } from 'react'; import { EuiFlyout, + EuiFlyoutProps, EuiFlyoutBody, EuiFlyoutHeader, EuiLink, @@ -19,8 +20,10 @@ import { useGeneratedHtmlId } from '../../../../src/services'; export default () => { const [isFlyoutVisible, setIsFlyoutVisible] = useState(false); - const [flyoutSize, setFlyoutSize] = useState('m'); - const [flyoutMaxWidth, setFlyoutMaxWidth] = useState(false); + const [flyoutSize, setFlyoutSize] = useState('m'); + const [flyoutMaxWidth, setFlyoutMaxWidth] = useState< + EuiFlyoutProps['maxWidth'] + >(false); const maxWidthFlyoutTitleId = useGeneratedHtmlId({ prefix: 'maxWidthFlyoutTitle', }); @@ -30,7 +33,10 @@ export default () => { const closeFlyout = () => setIsFlyoutVisible(false); - const showFlyout = (size = 'm', maxWidth = false) => { + const showFlyout = ( + size: EuiFlyoutProps['size'] = 'm', + maxWidth: EuiFlyoutProps['maxWidth'] = false + ) => { setFlyoutSize(size); setFlyoutMaxWidth(maxWidth); setIsFlyoutVisible(true); @@ -105,6 +111,7 @@ export default () => { max={100} name="range" id={maxWidthFlyoutRangeId} + value={50} /> diff --git a/src-docs/src/views/flyout/flyout_small.js b/src-docs/src/views/flyout/flyout_own_focus.tsx similarity index 100% rename from src-docs/src/views/flyout/flyout_small.js rename to src-docs/src/views/flyout/flyout_own_focus.tsx diff --git a/src-docs/src/views/flyout/flyout_padding_medium.js b/src-docs/src/views/flyout/flyout_padding_sizes.tsx similarity index 91% rename from src-docs/src/views/flyout/flyout_padding_medium.js rename to src-docs/src/views/flyout/flyout_padding_sizes.tsx index 7c7d1561925..024cd4338f8 100644 --- a/src-docs/src/views/flyout/flyout_padding_medium.js +++ b/src-docs/src/views/flyout/flyout_padding_sizes.tsx @@ -6,6 +6,7 @@ import { EuiFlexGroup, EuiFlexItem, EuiFlyout, + EuiFlyoutProps, EuiFlyoutHeader, EuiFlyoutBody, EuiFlyoutFooter, @@ -63,7 +64,7 @@ export default () => { @@ -76,15 +77,16 @@ export default () => {
+ {/* @ts-ignore - EuiButtonGroup is not correctly detecting type="single" */} { + onChange={(id: string) => { const newName = sizes - .find((size) => size.id === id) + .find((size) => size.id === id)! .label.toLowerCase(); setPaddingSize(id); setPaddingSizeName(newName); diff --git a/src-docs/src/views/flyout/flyout_push.js b/src-docs/src/views/flyout/flyout_push.tsx similarity index 100% rename from src-docs/src/views/flyout/flyout_push.js rename to src-docs/src/views/flyout/flyout_push.tsx diff --git a/src-docs/src/views/flyout/flyout_large.js b/src-docs/src/views/flyout/flyout_sizes.tsx similarity index 93% rename from src-docs/src/views/flyout/flyout_large.js rename to src-docs/src/views/flyout/flyout_sizes.tsx index d6bd1bdbf25..cb7f11bf1f5 100644 --- a/src-docs/src/views/flyout/flyout_large.js +++ b/src-docs/src/views/flyout/flyout_sizes.tsx @@ -56,16 +56,16 @@ export default () => { - + { const newName = sizes - .find((size) => size.id === id) + .find((size) => size.id === id)! .label.toLowerCase(); setSize(id); setSizeName(newName); diff --git a/src/components/collapsible_nav/__snapshots__/collapsible_nav.test.tsx.snap b/src/components/collapsible_nav/__snapshots__/collapsible_nav.test.tsx.snap index df70f8cc7fc..522b53e413b 100644 --- a/src/components/collapsible_nav/__snapshots__/collapsible_nav.test.tsx.snap +++ b/src/components/collapsible_nav/__snapshots__/collapsible_nav.test.tsx.snap @@ -17,14 +17,14 @@ Array [ data-focus-lock-disabled="false" >