From 55f2927fe74d3321ffa24b6c1f0aeb758cbdba3a Mon Sep 17 00:00:00 2001 From: Caroline Horn <549577+cchaos@users.noreply.github.com> Date: Tue, 20 Oct 2020 11:43:06 -0400 Subject: [PATCH] [EuiPopover] Adjustments for more padding options and Amsterdam (#4146) * [EuiPopoverTitle] Remove uppercase * [EuiPopover] Allowing panelPadding to adjust title as well - And fixing some instances, including removing it from EuiContextMenu for a custom element * Added `paddingSize` to EuiPopoverTitle/Footer - And updated instances and tests --- CHANGELOG.md | 3 + src-docs/src/views/datagrid/datagrid.js | 1 + .../views/filter_group/filter_group_multi.js | 4 +- src-docs/src/views/header/header.js | 6 +- src-docs/src/views/header/header_alert.js | 4 +- src-docs/src/views/popover/input_popover.js | 2 - src-docs/src/views/popover/popover.js | 8 +- src-docs/src/views/popover/popover_example.js | 215 ++++++------- src-docs/src/views/popover/popover_fixed.js | 4 +- .../views/popover/popover_panel_class_name.js | 11 +- .../src/views/popover/popover_with_title.js | 6 +- .../popover/popover_with_title_padding.js | 283 ++++++++++++------ .../views/selectable/selectable_popover.js | 4 +- .../views/suggest/global_filter_options.js | 2 +- src-docs/src/views/suggest/hashtag_popover.js | 8 +- .../__snapshots__/context_menu.test.tsx.snap | 6 +- .../context_menu_panel.test.tsx.snap | 8 +- .../context_menu/_context_menu_panel.scss | 5 +- .../context_menu/context_menu_panel.tsx | 5 +- .../markdown_editor_footer.tsx | 5 +- .../panel/__snapshots__/panel.test.tsx.snap | 24 ++ src/components/panel/panel.test.tsx | 14 +- src/components/panel/panel.tsx | 4 +- .../popover_footer.test.tsx.snap | 24 ++ .../__snapshots__/popover_title.test.tsx.snap | 24 ++ src/components/popover/_popover_footer.scss | 27 +- src/components/popover/_popover_title.scss | 26 +- src/components/popover/popover.tsx | 100 ++++--- .../popover/popover_footer.test.tsx | 14 +- src/components/popover/popover_footer.tsx | 28 +- src/components/popover/popover_title.test.tsx | 14 +- src/components/popover/popover_title.tsx | 28 +- .../filters/field_value_selection_filter.tsx | 3 +- .../selectable_template_sitewide.tsx | 6 +- .../overrides/_context_menu.scss | 3 + .../eui-amsterdam/overrides/_index.scss | 1 + .../eui-amsterdam/overrides/_popover.scss | 39 +++ 37 files changed, 671 insertions(+), 298 deletions(-) create mode 100644 src/themes/eui-amsterdam/overrides/_context_menu.scss diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c6b0448d66..7fde32fef49 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,11 +5,13 @@ - Added `minWidth` prop to `EuiButton` ([4056](https://github.com/elastic/eui/pull/4056)) - Added `isSelected` prop to easily turn `EuiButton`, `EuiButtonEmpty`, and `EuiButtonIcon` into toggle buttons ([4056](https://github.com/elastic/eui/pull/4056)) - Updated `EuiButtonGroup` props and render for better accessibility ([4056](https://github.com/elastic/eui/pull/4056)) +- Added `paddingSize` prop to `EuiPopoverTitle` and `EuiPopoverFooter` ([4133](https://github.com/elastic/eui/pull/4133)) - Added more exports for `EuiBasicTable` types ([#4125](https://github.com/elastic/eui/pull/4125)) - Updated types associated with `EuiMarkdownEditor` plugin dependencies ([4124](https://github.com/elastic/eui/pull/4124)) - Upgraded dependencies related to `EuiMarkdownEditor`: `react-dropzone`, `rehype-*`, `remark-*`, and `unified` ([#4124](https://github.com/elastic/eui/pull/4124)) **Bug fixes** + - Fixed focus management bug in `EuiSelectable` ([4152](https://github.com/elastic/eui/pull/4152)) **Breaking changes** @@ -25,6 +27,7 @@ **Theme: Amsterdam** - Tightened `line-height` for some `EuiTitle` sizes ([4133](https://github.com/elastic/eui/pull/4133)) +- Removed uppercase from `EuiPopoverTitle` and fixed inherited padding from `EuiPopover` ([4133](https://github.com/elastic/eui/pull/4133)) - Fixed `EuiFilterGroup` and `EuiFilterButton` styles ([4151](https://github.com/elastic/eui/pull/4151)) ## [`29.5.0`](https://github.com/elastic/eui/tree/v29.5.0) diff --git a/src-docs/src/views/datagrid/datagrid.js b/src-docs/src/views/datagrid/datagrid.js index 7479019ac57..7024a855e75 100644 --- a/src-docs/src/views/datagrid/datagrid.js +++ b/src-docs/src/views/datagrid/datagrid.js @@ -169,6 +169,7 @@ const trailingControlColumns = [
Version 7.0
Popover content that’s wider than the default width
++ Use the EuiPopover component to hide controls or + options behind a clickable element. A popover is temporary so keep + tasks simple and narrowly focused. +
++ While the visibility of the popover is maintained by the consuming + application, popovers will automatically close when clicking outside + of the popover bounds. Therefore all work done in a popover should + automatically be saved. +
++ Avoid popover inception (popover triggering another popover), and + instead use a{' '} + + EuiContextMenu + {' '} + to swap the popover panel content. +
+ > ), props: { EuiPopover }, snippet: popOverSnippet, @@ -182,13 +201,11 @@ export const PopoverExample = { }, ], text: ( -
The alignment and arrow on your popover can be set with the{' '}
-
Some tips: @@ -204,13 +221,14 @@ export const PopoverExample = { popover. -
- Popovers often need titling. This can be applied through a prop or - used separately as its own component{' '} - EuiPopoverTitle nested somewhere in the child prop. + Popovers often need titling. Use the + EuiPopoverTitle component nested somewhere inside + the popover contents.
- You can also add a similiarly styled{' '} + You can also add a similarly styled{' '} EuiPopoverFooter for smaller captions or call to action buttons.
-
Use the
- When using popover titles, you can still propogate the padding size
- by using
- EuiPopover can accept a React or DOM element as a{' '}
-
+ Use the
- EuiWrappingPopover is an extra popover component
- that allows any existing DOM element to be passed as the{' '}
-
+ Popover anchors default to{' '}
+
- Popover content even works on
+ Popover content even works on{' '}
+
- Popover anchors default to{' '}
-
+ EuiPopover can accept a React or DOM element as a{' '}
+
EuiInputPopover is a specialized popover component
intended to be used with form elements. Stylistically, the popover
@@ -414,14 +406,14 @@ export const PopoverExample = {
- If the popover cannot trap focus within itself, then you can remove{' '}
-
+ EuiWrappingPopover is an extra popover component that
+ allows any existing DOM element to be passed as the{' '}
+
This has a custom class that applies some grid lines.
+Selfies migas stumptown hot chicken quinoa wolf green juice, mumblecore tattooed trust fund hammock truffaut taxidermy kogi. @@ -71,7 +71,7 @@ export default () => { closePopover={closePopover2} anchorPosition="upCenter">
Selfies migas stumptown hot chicken quinoa wolf green juice,
mumblecore tattooed trust fund hammock truffaut taxidermy kogi.
@@ -102,7 +102,7 @@ export default () => {
anchorPosition="upCenter">
Selfies migas stumptown hot chicken quinoa wolf green juice,
mumblecore tattooed trust fund hammock truffaut taxidermy kogi.
diff --git a/src-docs/src/views/popover/popover_with_title_padding.js b/src-docs/src/views/popover/popover_with_title_padding.js
index 2a4465e09f1..9d137cc1757 100644
--- a/src-docs/src/views/popover/popover_with_title_padding.js
+++ b/src-docs/src/views/popover/popover_with_title_padding.js
@@ -3,10 +3,12 @@ import React, { useState } from 'react';
import {
EuiPopover,
EuiPopoverTitle,
+ EuiPopoverFooter,
EuiButton,
EuiFlexGroup,
EuiFlexItem,
EuiText,
+ EuiCode,
} from '../../../../src/components';
export default () => {
@@ -14,6 +16,8 @@ export default () => {
const [isPopoverOpen2, setIsPopoverOpen2] = useState(false);
const [isPopoverOpen3, setIsPopoverOpen3] = useState(false);
const [isPopoverOpen4, setIsPopoverOpen4] = useState(false);
+ const [isPopoverOpen5, setIsPopoverOpen5] = useState(false);
+ const [isPopoverOpen6, setIsPopoverOpen6] = useState(false);
const onButtonClick1 = () =>
setIsPopoverOpen1((isPopoverOpen1) => !isPopoverOpen1);
@@ -31,102 +35,203 @@ export default () => {
setIsPopoverOpen4((isPopoverOpen4) => !isPopoverOpen4);
const closePopover4 = () => setIsPopoverOpen4(false);
+ const onButtonClick5 = () =>
+ setIsPopoverOpen5((isPopoverOpen5) => !isPopoverOpen5);
+ const closePopover5 = () => setIsPopoverOpen5(false);
+
+ const onButtonClick6 = () =>
+ setIsPopoverOpen6((isPopoverOpen6) => !isPopoverOpen6);
+ const closePopover6 = () => setIsPopoverOpen6(false);
+
return (
- Popover content
+ Only changing the
+ Removing the
+ Removing the padding from titles only with{' '}
+ Popover content
+ You can adjust both the Popover content
+ Removing the padding from footers only with{' '}
+ Popover content
+ For the most reliable padding display, set the{' '}
+