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

[EuiPopover and parts] Converted to Emotion #5977

Merged
merged 28 commits into from
Jul 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
9da3c20
Move Amsterdam Sass overrides to src/
Jun 14, 2022
8affcf0
[EuiPopoverFooter] Converted except for…
Jun 14, 2022
85b3146
[EuiPopoverTitle] Converted except for…
Jun 14, 2022
3d6b35c
Removed Sass mixin `euiPopoverTitle`
Jun 14, 2022
e1ff004
Added [EuiPopoverArrow] and simplified styles
Jun 14, 2022
3c825fd
[EuiPopover] BREAKING Changed `display` type to accept real CSS `disp…
Jun 14, 2022
568f6c5
Fix grid tests
Jun 14, 2022
479d55e
WIP: Converted base EuiPaopover and panel styles
Jun 15, 2022
9fec434
New EuiPopoverPanel for internal use
Jun 15, 2022
612aa20
Skip test & fix props
Jun 15, 2022
a1dd897
Fixed EuiTour’s styles
Jun 15, 2022
65ad54b
Undo HOC by moving panel styles to it’s own folder
Jun 15, 2022
52d68f6
Created a EuiPopoverPanelContext for passing through `paddingSize`
Jun 15, 2022
653cdc8
[EuiInputPopover] Converted by applying max-width directly in component
Jun 16, 2022
3281c02
Converted to logical properties
Jun 16, 2022
9825f94
Merge remote-tracking branch origin/main into emotion/popover
Jun 16, 2022
b381d30
Convert some docs files to TS
Jun 16, 2022
4e3029f
Increase opacity of shadows in DARK mode
Jun 16, 2022
8dc669d
Cleanup
Jun 16, 2022
ebc20a9
cl
Jun 16, 2022
4d35b81
Mostly fix class name output
Jun 16, 2022
060eed3
Fix TS and rename internal files with `_`
Jun 21, 2022
dd1d104
Attempting to fix props table
Jun 21, 2022
e445989
Merge remote-tracking branch origin/main into emotion/popover
Jun 28, 2022
31889ea
EuiPopoverPanel extends _EuiPanelDivlike and better prop table
Jun 29, 2022
ddd912a
Merge branch 'main' into emotion/popover
cee-chen Jul 11, 2022
192fc01
Merge branch 'main' into emotion/popover
thompsongl Jul 20, 2022
b713470
snapshot updates
thompsongl Jul 20, 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 @@ -6,7 +6,7 @@ import {
EuiPopover,
EuiSpacer,
EuiFieldText,
} from '../../../../src/components';
} from '../../../../src';

export default () => {
const [isPopoverOpen, setIsPopoverOpen] = useState(false);
Expand Down Expand Up @@ -34,7 +34,9 @@ export default () => {

<EuiSpacer />

<EuiButton fill>Submit</EuiButton>
<EuiButton size="s" fill>
Submit
</EuiButton>
</EuiPopover>
);
};
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import React, { useState } from 'react';

import {
EuiInputPopover,
EuiFieldText,
EuiSpacer,
} from '../../../../src/components';
import { EuiInputPopover, EuiFieldText, EuiSpacer } from '../../../../src';

export default () => {
const [inputWidth, setInputWidth] = useState(200);
Expand All @@ -27,10 +23,9 @@ export default () => {
const inputTwo = (
<EuiFieldText
onFocus={() => {
setInputWidth(400);
setInputWidth(300);
toggleIsPopoverOpenTwo();
}}
style={{ width: inputWidth }}
aria-label="Popover attached to an adjustable sized input element"
/>
);
Expand All @@ -52,6 +47,7 @@ export default () => {
<EuiInputPopover
input={inputTwo}
isOpen={isPopoverOpenTwo}
style={{ width: inputWidth }}
closePopover={() => {
toggleIsPopoverOpenTwo(false);
setInputWidth(200);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState } from 'react';

import { EuiPopover, EuiButton, EuiText } from '../../../../src/components';
import { EuiPopover, EuiButton, EuiText } from '../../../../src';

export default () => {
const [isPopoverOpen, setIsPopoverOpen] = useState(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
EuiFlexItem,
EuiSpacer,
EuiText,
} from '../../../../src/components';
} from '../../../../src';

export default () => {
const [isPopoverOpen1, setIsPopoverOpen1] = useState(false);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState } from 'react';

import { EuiButton, EuiPopover } from '../../../../src/components';
import { EuiButton, EuiPopover } from '../../../../src';

export default () => {
const [isPopoverOpen, setIsPopoverOpen] = useState(false);
Expand Down
4 changes: 3 additions & 1 deletion src-docs/src/views/popover/popover_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import {
EuiCallOut,
} from '../../../../src/components';

import { EuiPopoverPanelProps } from './props';

import Popover from './popover';
const popoverSource = require('!!raw-loader!./popover');

Expand Down Expand Up @@ -171,7 +173,7 @@ export const PopoverExample = {
</p>
</>
),
props: { EuiPopover },
props: { EuiPopover, EuiPopoverPanelProps },
cchaos marked this conversation as resolved.
Show resolved Hide resolved
snippet: popOverSnippet,
demo: <Popover />,
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState } from 'react';

import { EuiButton, EuiPopover } from '../../../../src/components';
import { EuiButton, EuiPopover } from '../../../../src';

export default () => {
const [isExampleShown, setIsExampleShown] = useState(false);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState } from 'react';

import { EuiPopover, EuiButton, EuiText } from '../../../../src/components';
import { EuiPopover, EuiButton, EuiText } from '../../../../src';

export default () => {
const [isPopoverOpen, setIsPopoverOpen] = useState(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
EuiFlexItem,
EuiText,
EuiTextColor,
} from '../../../../src/components';
} from '../../../../src';

export default () => {
const [isPopoverOpen1, setIsPopoverOpen1] = useState(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
EuiFlexItem,
EuiText,
EuiCode,
} from '../../../../src/components';
} from '../../../../src';

export default () => {
const [isPopoverOpen1, setIsPopoverOpen1] = useState(false);
Expand Down
7 changes: 7 additions & 0 deletions src-docs/src/views/popover/props.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import React, { FunctionComponent } from 'react';

import { EuiPopoverPanelProps as _EuiPopoverPanelProps } from '../../../../src/components/popover/popover_panel/_popover_panel';

export const EuiPopoverPanelProps: FunctionComponent<_EuiPopoverPanelProps> = () => (
<div />
);
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default () => {
const focusId = useGeneratedHtmlId();
useEffect(() => {
if (isPopoverOpen) {
document.getElementById(focusId).focus({ preventScroll: true });
document.getElementById(focusId)!.focus({ preventScroll: true });
}
}, [isPopoverOpen, focusId]);

Expand Down
53 changes: 53 additions & 0 deletions src-docs/src/views/theme/sizing/_sizing_js.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ import {
PADDING_SIZES,
LOGICAL_SIDES,
EuiPanel,
EuiSpacer,
logicalSizeCSS,
logicalSizeStyle,
} from '../../../../../src';

import { ThemeExample } from '../_components/_theme_example';
Expand Down Expand Up @@ -258,6 +261,56 @@ export const UtilsJS = () => {
</EuiText>
</EuiAccordion>
</EuiPanel>

<EuiSpacer size="xl" />

<ThemeExample
title={<code>{'logicalSizeCSS(width, height)'}</code>}
type="function"
description={
<p>
Returns the <strong>string version</strong> of the logical CSS size
properties given <EuiCode language="css">width</EuiCode> and{' '}
<EuiCode language="css">height</EuiCode>. Best used when providing
styles via Emotion&apos;s <EuiCode>{'css``'}</EuiCode> method.
</p>
}
example={
<p
css={[
useEuiBackgroundColorCSS().warning,
logicalSizeCSS('200px', '100px'),
]}
>
<code>{logicalSizeCSS('200px', '100px')}</code>
</p>
}
snippetLanguage="emotion"
snippet={"${logicalSizeCSS('200px', '100px')};"}
/>

<ThemeExample
title={<code>{'logicalStyle(property, value)'}</code>}
type="function"
description={
<p>
Returns the <strong>object version</strong> of the logical CSS size
properties given <EuiCode language="css">width</EuiCode> and{' '}
<EuiCode language="css">height</EuiCode>. Best used when providing
styles via React&apos;s <EuiCode>style</EuiCode> property.
</p>
}
example={
<p
css={css(useEuiBackgroundColorCSS().warning)}
style={logicalSizeStyle('200px', '100px')}
>
<code>{JSON.stringify(logicalSizeStyle('200px', '100px'))}</code>
</p>
}
snippetLanguage="tsx"
snippet={"<p style={logicalSizeStyle('200px', '100px')} />"}
/>
</>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

exports[`CollapsedItemActions render 1`] = `
<div
class="euiPopover euiPopover--anchorLeftCenter"
class="euiPopover emotion-euiPopover"
id="id-actions"
>
<div
class="euiPopover__anchor"
class="euiPopover__anchor css-16vtueo-render"
>
<span
class="euiToolTipAnchor"
Expand Down Expand Up @@ -41,7 +41,7 @@ exports[`CollapsedItemActions render with href and _target provided 1`] = `
</EuiI18n>
}
closePopover={[Function]}
display="inlineBlock"
display="inline-block"
hasArrow={true}
id="id-actions"
isOpen={true}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ exports[`EuiInMemoryTable behavior pagination 1`] = `
class="euiFlexItem euiFlexItem--flexGrowZero"
>
<div
class="euiPopover euiPopover--anchorUpRight"
class="euiPopover emotion-euiPopover"
>
<div
class="euiPopover__anchor"
class="euiPopover__anchor css-16vtueo-render"
>
<button
class="euiButtonEmpty euiButtonEmpty--text euiButtonEmpty--xSmall"
Expand Down Expand Up @@ -765,10 +765,10 @@ exports[`EuiInMemoryTable with pagination and "show all" page size 1`] = `
class="euiFlexItem euiFlexItem--flexGrowZero"
>
<div
class="euiPopover euiPopover--anchorUpRight"
class="euiPopover emotion-euiPopover"
>
<div
class="euiPopover__anchor"
class="euiPopover__anchor css-16vtueo-render"
>
<button
class="euiButtonEmpty euiButtonEmpty--text euiButtonEmpty--xSmall"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ exports[`EuiBreadcrumbs is rendered 1`] = `
class="euiBreadcrumb euiBreadcrumb--collapsed"
>
<div
class="euiPopover euiPopover--anchorDownCenter"
class="euiPopover emotion-euiPopover"
>
<div
class="euiPopover__anchor"
class="euiPopover__anchor css-16vtueo-render"
>
<button
aria-label="See collapsed breadcrumbs"
Expand Down Expand Up @@ -123,10 +123,10 @@ exports[`EuiBreadcrumbs is rendered with final item as link 1`] = `
class="euiBreadcrumb euiBreadcrumb--collapsed"
>
<div
class="euiPopover euiPopover--anchorDownCenter"
class="euiPopover emotion-euiPopover"
>
<div
class="euiPopover__anchor"
class="euiPopover__anchor css-16vtueo-render"
>
<button
aria-label="See collapsed breadcrumbs"
Expand Down Expand Up @@ -286,10 +286,10 @@ exports[`EuiBreadcrumbs props max renders 1 item 1`] = `
class="euiBreadcrumb euiBreadcrumb--collapsed"
>
<div
class="euiPopover euiPopover--anchorDownCenter"
class="euiPopover emotion-euiPopover"
>
<div
class="euiPopover__anchor"
class="euiPopover__anchor css-16vtueo-render"
>
<button
aria-label="See collapsed breadcrumbs"
Expand Down Expand Up @@ -447,10 +447,10 @@ exports[`EuiBreadcrumbs props responsive is rendered 1`] = `
class="euiBreadcrumb euiBreadcrumb--collapsed"
>
<div
class="euiPopover euiPopover--anchorDownCenter"
class="euiPopover emotion-euiPopover"
>
<div
class="euiPopover__anchor"
class="euiPopover__anchor css-16vtueo-render"
>
<button
aria-label="See collapsed breadcrumbs"
Expand Down Expand Up @@ -536,10 +536,10 @@ exports[`EuiBreadcrumbs props responsive is rendered as false 1`] = `
class="euiBreadcrumb euiBreadcrumb--collapsed"
>
<div
class="euiPopover euiPopover--anchorDownCenter"
class="euiPopover emotion-euiPopover"
>
<div
class="euiPopover__anchor"
class="euiPopover__anchor css-16vtueo-render"
>
<button
aria-label="See collapsed breadcrumbs"
Expand Down Expand Up @@ -604,10 +604,10 @@ exports[`EuiBreadcrumbs props responsive is rendered with custom breakpoints 1`]
class="euiBreadcrumb euiBreadcrumb--collapsed"
>
<div
class="euiPopover euiPopover--anchorDownCenter"
class="euiPopover emotion-euiPopover"
>
<div
class="euiPopover__anchor"
class="euiPopover__anchor css-16vtueo-render"
>
<button
aria-label="See collapsed breadcrumbs"
Expand Down Expand Up @@ -670,10 +670,10 @@ exports[`EuiBreadcrumbs props truncate as false is rendered 1`] = `
class="euiBreadcrumb euiBreadcrumb--collapsed"
>
<div
class="euiPopover euiPopover--anchorDownCenter"
class="euiPopover emotion-euiPopover"
>
<div
class="euiPopover__anchor"
class="euiPopover__anchor css-16vtueo-render"
>
<button
aria-label="See collapsed breadcrumbs"
Expand Down
Loading