Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Emotion] Convert EuiFlyout #6213

Merged
merged 66 commits into from
Sep 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
18d3348
Removed Sass styling files for EuiFlyout
breehall Aug 31, 2022
61800ce
Created flyout.styles.ts
breehall Aug 31, 2022
7efcece
Broke out Flyout Footer styling into its own file and object. Includi…
breehall Sep 6, 2022
b5f5921
Moved FlyoutHeader styles out of flyout.styles.tsx and moved them to …
breehall Sep 6, 2022
3e18b05
Moved styles for FlyoutBody to a new flyout_body.styles.ts file. Comb…
breehall Sep 6, 2022
360a9a4
Removed Flyout close button styles from the base Flyout styles and m…
breehall Sep 6, 2022
de678da
Removed classToMap objects for Flyout sides and paddingSizes
breehall Sep 6, 2022
316be14
Updated required snapshots and a test case for collapsible_nav
breehall Sep 6, 2022
a0ac180
CHANGELOG
breehall Sep 7, 2022
937a79f
Updated tests for collapsible_nav
breehall Sep 7, 2022
9e608b1
Merge branch 'main' of https://github.com/breehall/eui into emotion/f…
breehall Sep 7, 2022
27e67a6
Updated branch with main
breehall Sep 7, 2022
15e6fd9
Converted the euiOverflowShadowStyles function back to an internal fu…
breehall Sep 12, 2022
c2aac17
Updated class names across EuiFlyout and Flyout children to match the…
breehall Sep 12, 2022
98332f6
Updated a few variables that converted pixel sizes to ints to no long…
breehall Sep 12, 2022
c224568
Removed paddingSize as a parameter to the Emotion styling function. H…
breehall Sep 12, 2022
77c00ca
Created the composeFlyoutSizing function to DRY out the Flyout sizing…
breehall Sep 12, 2022
2bf220a
Changes instances of euiTheme.levels.header to euiTheme.levels.flyout…
breehall Sep 12, 2022
186ead6
Updated CHANGELOG
breehall Sep 12, 2022
55de900
Restructured FlyoutBody styles and created a nested object structure …
breehall Sep 12, 2022
caa04ad
Resolved a bug that caused the Flyout close button (when placed outsi…
breehall Sep 12, 2022
eda6240
Updated required snapshots for EuiFlyout and EuiCollapsibleNav
breehall Sep 12, 2022
fab04ac
Code cleanup
breehall Sep 12, 2022
204820c
Created _EuiYScrollWithShadows interface for euiYScrollWithShadows fu…
breehall Sep 13, 2022
95886a3
Update src/components/flyout/flyout_body.tsx
breehall Sep 13, 2022
dedda37
Update src/components/flyout/flyout_body.tsx
breehall Sep 13, 2022
511c5f9
Update src/components/flyout/flyout_body.tsx
breehall Sep 13, 2022
58f9b37
Update src/components/flyout/flyout.tsx
breehall Sep 13, 2022
e251419
Merge branch 'emotion/flyout__redo' of https://github.com/breehall/eu…
breehall Sep 13, 2022
c5871be
Updated the sizing calculation for the medium flyout. Previously, it …
breehall Sep 13, 2022
478887b
Removed size and type classNameToMap objects for EuiFlyout
breehall Sep 13, 2022
4e8cb47
Update src/components/flyout/flyout.styles.ts
breehall Sep 13, 2022
ca3c76a
Update src/components/flyout/flyout.tsx
breehall Sep 13, 2022
eb46835
Merge branch 'emotion/flyout__redo' of https://github.com/breehall/eu…
breehall Sep 13, 2022
c05b66c
Update src/components/flyout/flyout.styles.ts
breehall Sep 13, 2022
5f243e4
Update src/components/flyout/flyout.tsx
breehall Sep 13, 2022
68aca67
Merge branch 'emotion/flyout__redo' of https://github.com/breehall/eu…
breehall Sep 13, 2022
359c2f5
Quick lint
breehall Sep 13, 2022
3bc70c1
Updated required snapshots for Flyout and CollapsibleNav
breehall Sep 13, 2022
f0a680b
Quick check to see if updating flyout.styles.ts will update github file
breehall Sep 13, 2022
fc65e75
Update src/components/flyout/flyout.styles.ts
breehall Sep 13, 2022
0d44180
Update src/components/flyout/flyout.styles.ts
breehall Sep 13, 2022
e87ec67
Pulled the latest code from Github UI commits and updated snapshots f…
breehall Sep 13, 2022
d5785e7
Update upcoming_changelogs/6213.md
breehall Sep 14, 2022
6e069d7
A few name changes to Flyout animations per PR comments
breehall Sep 14, 2022
3028597
Merge branch 'emotion/flyout__redo' of https://github.com/breehall/eu…
breehall Sep 14, 2022
0f34e0e
[docs] Fix button group label
cee-chen Sep 14, 2022
3933d9e
[docs] Fix incorrectly named flyout example files
cee-chen Sep 14, 2022
e9494ce
[docs] Convert all flyout examples to typescript
cee-chen Sep 14, 2022
a7e9d45
Fix close button color
cee-chen Sep 14, 2022
dee610f
Remove unnecessary left/right unsets on outside close buttons
cee-chen Sep 14, 2022
333d272
Fix flyout borders
cee-chen Sep 14, 2022
e6b0b1d
Fix euiFlyoutBody__banner CSS
cee-chen Sep 14, 2022
5536a15
Delete Amsterdam Flyout scss
cee-chen Sep 14, 2022
289b6ce
[EuiFlyoutBody] Misc fixes
cee-chen Sep 14, 2022
485be84
Merge remote-tracking branch 'upstream/main' into emotion/flyout__redo
cee-chen Sep 14, 2022
5dbe365
Use new mathWithUnits helper
cee-chen Sep 14, 2022
937695a
Fix various flyout width issues
cee-chen Sep 14, 2022
04ef1c9
Remove now-unused modifier classes from .euiFlyout__closeButton
cee-chen Sep 14, 2022
52ecb68
[misc] add newlines to Emotion styles for readability
cee-chen Sep 14, 2022
336a505
[docs] improve default value documentation
cee-chen Sep 14, 2022
1f93ad2
Update snapshots
cee-chen Sep 14, 2022
8ad5e9f
[misc] clean up syntax for inline styles
cee-chen Sep 14, 2022
d2d3d4a
clean up box-shadow unset
cee-chen Sep 14, 2022
9253c8a
Fix missing !important on 90vw
cee-chen Sep 14, 2022
a7bbed8
Restore removed comments/context
cee-chen Sep 14, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,9 @@ export default () => {
const togglePopover = () =>
setIsPopoverOpen((isPopoverOpen) => !isPopoverOpen);

const onSelectedTabChanged = (id) => setSelectedTabId(id);

const renderTabs = tabs.map((tab, index) => (
<EuiTab
onClick={() => onSelectedTabChanged(tab.id)}
onClick={() => setSelectedTabId(tab.id)}
isSelected={tab.id === selectedTabId}
key={index}
>
Expand Down Expand Up @@ -107,10 +105,6 @@ export default () => {
},
];

const onSuperSelectChange = (value) => {
setSuperSelectValue(value);
};

const flyoutContent = (
<EuiText>
<p>
Expand Down Expand Up @@ -224,7 +218,7 @@ export default () => {
<EuiSuperSelect
options={superSelectOptions}
valueOfSelected={superSelectvalue}
onChange={(value) => onSuperSelectChange(value)}
onChange={(value) => setSuperSelectValue(value)}
itemLayoutAlign="top"
popoverProps={{ repositionOnScroll: true }}
hasDividers
Expand Down
42 changes: 21 additions & 21 deletions src-docs/src/views/flyout/flyout_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -66,7 +66,7 @@ const flyoutComplicatedSnippet = `<EuiFlyout onClose={closeFlyout}>
</EuiFlyout>
`;

const flyoutSmallSnippet = `<EuiFlyout ownFocus={false} size="s" onClose={closeFlyout}>
const flyoutOwnFocusSnippet = `<EuiFlyout ownFocus={false} size="s" onClose={closeFlyout}>
<EuiFlyoutHeader hasBorder aria-labelledby={flyoutHeadingId}>
<EuiTitle>
<h2 id={flyoutHeadingId}><!-- Defaults to medium size. Change the heading level based on your context. --></h2>
Expand All @@ -78,7 +78,7 @@ const flyoutSmallSnippet = `<EuiFlyout ownFocus={false} size="s" onClose={closeF
</EuiFlyout>
`;

const flyoutMediumPaddingSnippet = `<EuiFlyout paddingSize="m" onClose={closeFlyout}>
const flyoutSizesPaddingSnippet = `<EuiFlyout paddingSize="m" onClose={closeFlyout}>
<EuiFlyoutHeader hasBorder aria-labelledby={flyoutHeadingId}>
<EuiTitle>
<h2 id={flyoutHeadingId}>
Expand All @@ -104,7 +104,7 @@ const flyoutMaxWidthSnippet = `<EuiFlyout maxWidth={448} onClose={closeFlyout}>
</EuiFlyout>
`;

const flyoutLargeSnippet = `<EuiFlyout size="l" onClose={closeFlyout}>
const flyoutSizesSnippet = `<EuiFlyout size="l" onClose={closeFlyout}>
<EuiFlyoutHeader hasBorder aria-labelledby={flyoutHeadingId}>
<EuiTitle>
<h2 id={flyoutHeadingId}><!-- Defaults to medium size. Change the heading level based on your context. --></h2>
Expand Down Expand Up @@ -214,8 +214,8 @@ export const FlyoutExample = {
title: 'Sizing',
source: [
{
type: GuideSectionTypes.JS,
code: flyoutLargeSource,
type: GuideSectionTypes.TSX,
code: flyoutSizesSource,
},
],
text: (
Expand All @@ -227,16 +227,16 @@ export const FlyoutExample = {
number or string format.
</p>
),
snippet: flyoutLargeSnippet,
demo: <FlyoutLarge />,
snippet: flyoutSizesSnippet,
demo: <FlyoutSizes />,
props: { EuiFlyout },
},
{
title: 'Adjusting padding',
source: [
{
type: GuideSectionTypes.JS,
code: FlyoutPaddingMediumSource,
type: GuideSectionTypes.TSX,
code: FlyoutPaddingSizesSource,
},
],
text: (
Expand All @@ -250,8 +250,8 @@ export const FlyoutExample = {
flyout.
</p>
),
snippet: flyoutMediumPaddingSnippet,
demo: <FlyoutPaddingMedium />,
snippet: flyoutSizesPaddingSnippet,
demo: <FlyoutPaddingSizes />,
props: { EuiFlyout },
},
{
Expand Down Expand Up @@ -282,7 +282,7 @@ export const FlyoutExample = {
source: [
{
type: GuideSectionTypes.JS,
code: flyoutSmallSource,
code: flyoutOwnFocusSource,
},
],
text: (
Expand All @@ -302,8 +302,8 @@ export const FlyoutExample = {
</p>
</>
),
snippet: flyoutSmallSnippet,
demo: <FlyoutSmall />,
snippet: flyoutOwnFocusSnippet,
demo: <FlyoutOwnFocus />,
props: { EuiFlyout },
},
{
Expand Down Expand Up @@ -339,7 +339,7 @@ export const FlyoutExample = {
title: 'Understanding max-width',
source: [
{
type: GuideSectionTypes.JS,
type: GuideSectionTypes.TSX,
code: flyoutMaxWidthSource,
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { useState } from 'react';

import {
EuiFlyout,
EuiFlyoutProps,
EuiFlyoutBody,
EuiFlyoutHeader,
EuiLink,
Expand All @@ -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<EuiFlyoutProps['size']>('m');
const [flyoutMaxWidth, setFlyoutMaxWidth] = useState<
EuiFlyoutProps['maxWidth']
>(false);
const maxWidthFlyoutTitleId = useGeneratedHtmlId({
prefix: 'maxWidthFlyoutTitle',
});
Expand All @@ -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);
Expand Down Expand Up @@ -105,6 +111,7 @@ export default () => {
max={100}
name="range"
id={maxWidthFlyoutRangeId}
value={50}
/>
</EuiFormRow>
</EuiForm>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
EuiFlexGroup,
EuiFlexItem,
EuiFlyout,
EuiFlyoutProps,
EuiFlyoutHeader,
EuiFlyoutBody,
EuiFlyoutFooter,
Expand Down Expand Up @@ -63,7 +64,7 @@ export default () => {
<EuiFlyout
ownFocus
onClose={closeFlyout}
paddingSize={paddingSize}
paddingSize={paddingSize as EuiFlyoutProps['paddingSize']}
id={mediumPaddingFlyoutId}
aria-labelledby={mediumPaddingFlyoutTitleId}
>
Expand All @@ -76,15 +77,16 @@ export default () => {
</EuiFlyoutHeader>
<EuiFlyoutBody banner={callOut}>
<EuiFormRow label="Change the paddingSize">
{/* @ts-ignore - EuiButtonGroup is not correctly detecting type="single" */}
<EuiButtonGroup
legend="Flyout paddingSize"
color="primary"
size="s"
buttonSize="s"
options={sizes}
idSelected={paddingSize}
onChange={(id) => {
onChange={(id: string) => {
const newName = sizes
.find((size) => size.id === id)
.find((size) => size.id === id)!
.label.toLowerCase();
setPaddingSize(id);
setPaddingSizeName(newName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,16 @@ export default () => {
</EuiTitle>
</EuiFlyoutHeader>
<EuiFlyoutBody>
<EuiFormRow label="Change the paddingSize">
<EuiFormRow label="Change the flyout size">
<EuiButtonGroup
legend="Flyout size"
color="primary"
size="s"
buttonSize="s"
options={sizes}
idSelected={size}
onChange={(id) => {
const newName = sizes
.find((size) => size.id === id)
.find((size) => size.id === id)!
.label.toLowerCase();
setSize(id);
setSizeName(newName);
Expand Down
Loading