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 EuiListGroup #6207

Merged
merged 40 commits into from
Sep 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
b02e168
Converted list group styles to emotion
elizabetdev Sep 5, 2022
7164bc7
Merge remote-tracking branch 'upstream/main' into emotion-list-group
elizabetdev Sep 5, 2022
93d5433
Initial list group item styles
elizabetdev Sep 6, 2022
10a3b8f
Merge remote-tracking branch 'upstream/main' into emotion-list-group
elizabetdev Sep 7, 2022
0ff3a06
Converting `EuiListGroupItem` and `EuiPinnableListGroup` to Emotion
elizabetdev Sep 7, 2022
1fad37b
Adding extra action component
elizabetdev Sep 7, 2022
92135e6
Removed `inherit` color from `EuiListGroupItem`
elizabetdev Sep 8, 2022
bb45f94
Removed `ghost` color in favor of theme provider
elizabetdev Sep 8, 2022
1c168b6
Passing down `size` and `color` props
elizabetdev Sep 9, 2022
2304ec2
Merge remote-tracking branch 'upstream/main' into emotion-list-group
elizabetdev Sep 12, 2022
115a08b
Added new CL entry
elizabetdev Sep 13, 2022
8375cb1
Added list group inner
elizabetdev Sep 13, 2022
a3b18ed
Making focus outlines look good
elizabetdev Sep 13, 2022
2aa9ad1
Adding `alwaysShow`
elizabetdev Sep 13, 2022
c08bacb
Custom color in last example
elizabetdev Sep 13, 2022
f476e97
Updating ghost examples with theme provider
elizabetdev Sep 13, 2022
385117c
Reverting class names in use
elizabetdev Sep 13, 2022
99d699d
CL
elizabetdev Sep 14, 2022
c9cedf9
Merge remote-tracking branch 'upstream/main' into emotion-list-group
elizabetdev Sep 19, 2022
6ab15cd
[EuiDataGrid] Remove mounted snapshots in favor of render
cee-chen Sep 20, 2022
9452c15
[PR feedback ] misc test/css tweaks
cee-chen Sep 20, 2022
1f3261f
[PR feedback] Remove unnecessary `euiListGroupItemInnerStyles` args i…
cee-chen Sep 20, 2022
5674a7a
[PR feedback] Remove `euiListGroupItemStyles` in favor of array condi…
cee-chen Sep 20, 2022
ae3daf2
Merge remote-tracking branch 'upstream/main' into emotion-list-group
elizabetdev Sep 20, 2022
e0398b3
Fix non-dark-mode EuiListGroup in docs
cee-chen Sep 20, 2022
cb864e2
[docs] Convert EuiListGroup docs from js to tsx
cee-chen Sep 20, 2022
b5b656b
[EuiListGroupItemExtraAction] Export props type and document more cle…
cee-chen Sep 20, 2022
a12e1c8
[EuiListGroupItemExtraAction] Fix non-working hover/focus CSS selectors
cee-chen Sep 20, 2022
49a2188
[EuiListGroupItemExtraAction] Add basic unit tests + clean up styles …
cee-chen Sep 20, 2022
c2591c8
Fix overflowing text pushing action icons outside of item
cee-chen Sep 20, 2022
4e1de76
[EuiListGroupItemExtraAction] Fix margin-right spacing
cee-chen Sep 20, 2022
d41fa9a
[Enhancement] Improve button hitbox of tooltip wrapped items
cee-chen Sep 20, 2022
19e3850
Clean up wrapText CSS
cee-chen Sep 20, 2022
425ce47
Fix raw `icon` elements being passed it not receiving our new Emotion…
cee-chen Sep 20, 2022
28aa0bd
Fix/cleanup misc custom maxWidth behavior
cee-chen Sep 20, 2022
ec20ddb
[docs] other misc props documentation improvements
cee-chen Sep 20, 2022
86615c1
misc code organization
cee-chen Sep 20, 2022
aa206a5
Merge branch 'main' into emotion-list-group
cee-chen Sep 20, 2022
24fc328
[EuiListGroupItem] Add working `shouldRenderCustomStyles`
cee-chen Sep 20, 2022
49fb14f
Remove `euiPinnableListGroup__itemExtraAction` classes
cee-chen Sep 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
32 changes: 17 additions & 15 deletions src-docs/src/views/collapsible_nav/collapsible_nav_all.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { KibanaNavLinks, SecurityGroup } from './collapsible_nav_list';

import contentSvg from '../../images/content.svg';
import { useExitPath } from '../../services/routing/routing';
import { EuiThemeProvider } from '../../../../src/services';

const TopLinks: EuiPinnableListGroupItemProps[] = [
{
Expand Down Expand Up @@ -151,22 +152,23 @@ const CollapsibleNavAll = () => {
{/* Dark deployments section */}
<EuiFlexItem grow={false} style={{ flexShrink: 0 }}>
<EuiCollapsibleNavGroup isCollapsible={false} background="dark">
<EuiListGroup
color="ghost"
maxWidth="none"
gutterSize="none"
size="s"
listItems={[
{
label: 'Manage deployment',
href: '#',
iconType: 'logoCloud',
iconProps: {
color: 'ghost',
<EuiThemeProvider colorMode="dark">
<EuiListGroup
maxWidth="none"
gutterSize="none"
size="s"
listItems={[
{
label: 'Manage deployment',
href: '#',
iconType: 'logoCloud',
iconProps: {
color: 'ghost',
},
},
},
]}
/>
]}
/>
</EuiThemeProvider>
</EuiCollapsibleNavGroup>
</EuiFlexItem>

Expand Down
11 changes: 6 additions & 5 deletions src-docs/src/views/collapsible_nav/collapsible_nav_list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
import { EuiSpacer } from '../../../../src/components/spacer';
import { EuiButton, EuiButtonIcon } from '../../../../src/components/button';
import { EuiLink } from '../../../../src/components/link';
import { EuiThemeProvider } from '../../../../src/services';

const deploymentsList: EuiListGroupProps['listItems'] = [
{
Expand Down Expand Up @@ -62,11 +63,11 @@ export const DeploymentsGroup = (
background="dark"
>
<div role="group" className="kibanaNavDeployment__content">
<EuiListGroup listItems={deploymentsList} flush />
<EuiSpacer size="s" />
<EuiButton color="ghost" fullWidth>
Manage deployments
</EuiButton>
<EuiThemeProvider colorMode="dark">
<EuiListGroup listItems={deploymentsList} flush />
<EuiSpacer size="s" />
<EuiButton fullWidth>Manage deployments</EuiButton>
</EuiThemeProvider>
</div>
</EuiCollapsibleNavGroup>
);
Expand Down
25 changes: 15 additions & 10 deletions src-docs/src/views/list_group/list_group_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
EuiPinnableListGroup,
EuiCode,
} from '../../../../src/components';
import { EuiPinnableListGroupItem } from './props';
import { EuiPinnableListGroupItem, EuiListGroupItemExtraAction } from './props';

import ListGroup from './list_group';
const listGroupSource = require('!!raw-loader!./list_group');
Expand Down Expand Up @@ -53,7 +53,11 @@ export const ListGroupExample = {
</p>
</>
),
props: { EuiListGroup, EuiListGroupItem },
props: {
EuiListGroup,
EuiListGroupItem,
EuiListGroupItemExtraAction,
},
demo: <ListGroup />,
snippet: `<EuiListGroup flush={true} bordered={true}>
<EuiListGroupItem onClick={handleOnClick} label="Item" />
Expand Down Expand Up @@ -103,7 +107,7 @@ export const ListGroupExample = {
title: 'Secondary link actions',
source: [
{
type: GuideSectionTypes.JS,
type: GuideSectionTypes.TSX,
code: listGroupLinkActionsSource,
},
],
Expand All @@ -129,6 +133,9 @@ export const ListGroupExample = {
alwaysShow: pinned,
}}
/>`,
props: {
EuiListGroupItemExtraAction,
},
},
{
title: 'Text wrapping and tooltips',
Expand Down Expand Up @@ -172,13 +179,11 @@ export const ListGroupExample = {
text: (
<>
<p>
<strong>EuiListGroupItems</strong> will inherit the color from their
element type whether it is a <EuiCode>button</EuiCode>,{' '}
<EuiCode>anchor</EuiCode>, or <EuiCode>span</EuiCode>. You can
enforce a different color of <EuiCode>primary</EuiCode>,{' '}
<EuiCode>text</EuiCode>, or <EuiCode>subdued</EuiCode> with the{' '}
<EuiCode>color</EuiCode> prop. Or provide the prop directly to{' '}
<strong>EuiListGroup</strong>.
<strong>EuiListGroupItems</strong> will get by default the color{' '}
<EuiCode>text</EuiCode>. You can enforce a different color of{' '}
<EuiCode>primary</EuiCode>, <EuiCode>text</EuiCode>, or{' '}
<EuiCode>subdued</EuiCode> with the <EuiCode>color</EuiCode> prop.
Or provide the prop directly to <strong>EuiListGroup</strong>.
</p>
<p>
They also accept options for text size;{' '}
Expand Down
18 changes: 12 additions & 6 deletions src-docs/src/views/list_group/list_group_item_color.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import React from 'react';

import {
EuiSpacer,
EuiPanel,
EuiListGroupItem,
EuiListGroup,
} from '../../../../src/components/list_group';
import { EuiSpacer } from '../../../../src/components/spacer';
} from '../../../../src/components/';
import { EuiThemeProvider } from '../../../../src/services';

export default () => (
<>
<EuiListGroup>
<EuiListGroupItem href="#" label="Inherit by default (xs)" size="xs" />
<EuiListGroupItem href="#" label="Text by default (xs)" size="xs" />

<EuiListGroupItem
onClick={() => {}}
Expand All @@ -25,8 +27,12 @@ export default () => (

<EuiSpacer size="s" />

<EuiListGroup style={{ background: 'black' }}>
<EuiListGroupItem href="#" label="Ghost" color="ghost" />
</EuiListGroup>
<EuiThemeProvider colorMode="dark">
<EuiPanel borderRadius="none" hasShadow={false} color="subdued">
<EuiListGroup>
<EuiListGroupItem href="#" label="Ghost" />
</EuiListGroup>
</EuiPanel>
</EuiThemeProvider>
</>
);
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { EuiListGroup, EuiListGroupItem } from '../../../../src/components';
import { useGeneratedHtmlId } from '../../../../src/services';

export default () => {
const [favorite1, setFavorite1] = useState(undefined);
const [favorite2, setFavorite2] = useState('link2');
const [favorite3, setFavorite3] = useState(undefined);
const [favorite4, setFavorite4] = useState(undefined);
const [favorite1, setFavorite1] = useState<string | undefined>(undefined);
const [favorite2, setFavorite2] = useState<string | undefined>('link2');
const [favorite3, setFavorite3] = useState<string | undefined>(undefined);
const [favorite4, setFavorite4] = useState<string | undefined>(undefined);

const listGroupLinkId__1 = useGeneratedHtmlId({
prefix: 'listGroupLink',
Expand All @@ -33,28 +33,28 @@ export default () => {
const link1Clicked = () => {
setFavorite1(favorite1 === 'link1' ? undefined : 'link1');
if (favorite1 === undefined) {
document.activeElement.blur();
(document.activeElement as HTMLElement).blur();
}
};

const link2Clicked = () => {
setFavorite2(favorite2 === 'link2' ? undefined : 'link2');
if (favorite2 === undefined) {
document.activeElement.blur();
(document.activeElement as HTMLElement).blur();
}
};

const link3Clicked = () => {
setFavorite3(favorite3 === 'link3' ? undefined : 'link3');
if (favorite3 === undefined) {
document.activeElement.blur();
(document.activeElement as HTMLElement).blur();
}
};

const link4Clicked = () => {
setFavorite4(favorite4 === 'link4' ? undefined : 'link4');
if (favorite3 === undefined) {
document.activeElement.blur();
(document.activeElement as HTMLElement).blur();
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,31 @@ const myContent = [
label: 'First link',
href: '#/display/list-group',
iconType: 'calendar',
size: 's',
},
{
label: 'This is an active link with very long label that truncates',
href: '#/display/list-group',
isActive: true,
iconType: 'clock',
size: 's',
},
{
label: 'Third link is disabled',
href: '#/display/list-group',
isDisabled: true,
iconType: 'compute',
size: 's',
},
{
label: 'Fourth link',
href: '#/display/list-group',
iconType: 'copyClipboard',
size: 's',
},
{
label: 'Fifth link',
href: '#/display/list-group',
iconType: 'crosshairs',
size: 's',
},
];

export default () => {
return <EuiListGroup listItems={myContent} />;
return <EuiListGroup listItems={myContent} color="primary" size="s" />;
};
3 changes: 2 additions & 1 deletion src-docs/src/views/list_group/pinnable_list_group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const someListItems: EuiPinnableListGroupItemProps[] = [
{
id: '1',
label: 'Label with iconType',
iconType: 'stop',
iconType: 'home',
pinned: false,
},
{
Expand All @@ -22,6 +22,7 @@ const someListItems: EuiPinnableListGroupItemProps[] = [
label: 'Link with href and custom pin titles',
href: '/#',
pinned: false,
color: 'primary',
},
{
id: '3',
Expand Down
9 changes: 8 additions & 1 deletion src-docs/src/views/list_group/props.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import React, { FunctionComponent } from 'react';

import { EuiPinnableListGroupItemProps } from '../../../../src/components/list_group';
import {
EuiPinnableListGroupItemProps,
EuiListGroupItemExtraActionProps,
} from '../../../../src/components/list_group';

export const EuiPinnableListGroupItem: FunctionComponent<EuiPinnableListGroupItemProps> = () => (
<div />
);

export const EuiListGroupItemExtraAction: FunctionComponent<EuiListGroupItemExtraActionProps> = () => (
<div />
);
Loading