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

[Presentation] Deprecate Solution Toolbar Button in favor of Shared UX Component #126916

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
6164988
deprecate
rshen91 Mar 4, 2022
a1b8b49
Merge branch 'main' into deprecate-solution-toolbar-button
rshen91 Mar 4, 2022
ce333b0
Merge remote-tracking branch 'upstream/main' into deprecate-solution-…
rshen91 Mar 7, 2022
5c6cd01
Merge remote-tracking branch 'upstream/main' into deprecate-solution-…
rshen91 Mar 9, 2022
cd0b90f
replace the solution toolbar buttons in presentation utils
rshen91 Mar 9, 2022
ed176d8
Merge remote-tracking branch 'origin/deprecate-solution-toolbar-butto…
rshen91 Mar 9, 2022
997b379
fix imports for storybook to run
rshen91 Mar 9, 2022
a75f4b9
Merge branch 'main' into deprecate-solution-toolbar-button
rshen91 Mar 9, 2022
c1755c7
fix errors
rshen91 Mar 9, 2022
5e4ea0c
Merge remote-tracking branch 'origin/deprecate-solution-toolbar-butto…
rshen91 Mar 9, 2022
8959416
update requiredPlugins
rshen91 Mar 9, 2022
7054dee
Merge branch 'main' into deprecate-solution-toolbar-button
rshen91 Mar 9, 2022
a78e943
props in public
rshen91 Mar 9, 2022
a6975c5
Merge remote-tracking branch 'origin/deprecate-solution-toolbar-butto…
rshen91 Mar 9, 2022
d565815
fix kibana json
rshen91 Mar 10, 2022
6983822
Merge branch 'main' into deprecate-solution-toolbar-button
rshen91 Mar 10, 2022
18688d1
clean up
rshen91 Mar 14, 2022
0d32c06
Merge branch 'main' into deprecate-solution-toolbar-button
rshen91 Mar 14, 2022
52081d2
remove deprecated from public index
rshen91 Mar 14, 2022
46c79b0
remove icon side
rshen91 Mar 15, 2022
93b5a22
Merge remote-tracking branch 'upstream/main' into deprecate-solution-…
rshen91 Mar 15, 2022
e414da2
refactor
rshen91 Mar 15, 2022
17d8b8e
change tsconfig
rshen91 Mar 15, 2022
d4e7ea9
fix spelling
rshen91 Mar 15, 2022
ccdfdb5
remove icon side
rshen91 Mar 15, 2022
8678625
Merge branch 'main' into deprecate-solution-toolbar-button
rshen91 Mar 15, 2022
49b35eb
Merge remote-tracking branch 'upstream/main' into deprecate-solution-…
rshen91 Mar 16, 2022
b60cb4d
Merge remote-tracking branch 'origin/deprecate-solution-toolbar-butto…
rshen91 Mar 16, 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
15 changes: 12 additions & 3 deletions src/plugins/presentation_util/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,16 @@
"kibanaVersion": "kibana",
"server": true,
"ui": true,
"extraPublicDirs": ["common/lib"],
"requiredPlugins": ["savedObjects", "kibanaReact", "embeddable", "expressions", "dataViews"],
"extraPublicDirs": [
"common/lib"
],
"requiredPlugins": [
"savedObjects",
"kibanaReact",
"embeddable",
"expressions",
"dataViews",
"sharedUX"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For plugin ids we have historically kept to the most simple form of camelcase, and only capitalized the first letter in an abbreviation. Said another way, the capital just replaces the _ in the snake_case version of the word, so shared_ux would be come sharedUx

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I was confused about which PR this is, maybe @clintandrewhall is open to a rename PR outside of this work or maybe when the number of inflight PRs is a bit lower.

],
"optionalPlugins": []
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

import React from 'react';
import { ComponentStrings } from '../../../i18n/components';
import { SolutionToolbarButton, Props as SolutionToolbarButtonProps } from './button';
import { SolutionToolbarButton, SolutionToolbarButtonProps } from '../../../../../shared_ux/public';

const { SolutionToolbar: strings } = ComponentStrings;

export type Props = Omit<SolutionToolbarButtonProps, 'iconType' | 'label'>;
export type Props = Omit<typeof SolutionToolbarButtonProps, 'iconType' | 'label'>;

export const AddFromLibraryButton = ({ onClick, ...rest }: Props) => (
<SolutionToolbarButton
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
* Side Public License, v 1.
*/

export { SolutionToolbarButton } from './button';
export { SolutionToolbarPopover } from './popover';
export { AddFromLibraryButton } from './add_from_library';
export type { QuickButtonProps } from './quick_group';
export { QuickButtonGroup } from './quick_group';
export { PrimaryActionButton } from './primary_button';
export { PrimaryActionPopover } from './primary_popover';
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
*/

import React, { useState } from 'react';
import { EuiPopover } from '@elastic/eui';
import { EuiPopover, IconType } from '@elastic/eui';
import { Props as EuiPopoverProps } from '@elastic/eui/src/components/popover/popover';
import {
SolutionToolbarButton,
SolutionToolbarButtonProps as ButtonProps,
} from '../../../../../shared_ux/public';

import { SolutionToolbarButton, Props as ButtonProps } from './button';

type AllowedButtonProps = Omit<ButtonProps, 'onClick' | 'fill'>;
type AllowedButtonProps = Omit<typeof ButtonProps, 'onClick' | 'fill'>;
type AllowedPopoverProps = Omit<
EuiPopoverProps,
'button' | 'isOpen' | 'closePopover' | 'anchorPosition'
Expand All @@ -21,24 +23,18 @@ type AllowedPopoverProps = Omit<
export type Props = AllowedButtonProps &
AllowedPopoverProps & {
children: (arg: { closePopover: () => void }) => React.ReactNode;
iconType: IconType;
};

export const SolutionToolbarPopover = ({
label,
iconType,
primary,
iconSide,
children,
...popover
}: Props) => {
export const SolutionToolbarPopover = ({ iconType, children, ...popover }: Props) => {
const [isOpen, setIsOpen] = useState(false);

const onButtonClick = () => setIsOpen((status) => !status);
const closePopover = () => setIsOpen(false);

const button = (
<SolutionToolbarButton
{...{ label, iconType, primary, iconSide }}
{...{ label, iconType }}
onClick={onButtonClick}
data-test-subj={popover['data-test-subj']}
/>
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ import { Story } from '@storybook/react';
import { action } from '@storybook/addon-actions';
import { EuiContextMenu } from '@elastic/eui';

import { SolutionToolbarButton as PrimaryActionButton } from '../../../../shared_ux/public';
import { SolutionToolbar } from './solution_toolbar';
import { SolutionToolbarPopover } from './items';
import { AddFromLibraryButton, PrimaryActionButton, QuickButtonGroup } from './items';
import { AddFromLibraryButton, QuickButtonGroup } from './items';

const quickButtons = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@
import React, { ReactElement } from 'react';
import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui';

import {
SolutionToolbarButton,
SolutionToolbarButton as PrimaryActionButton,
} from '../../../../shared_ux/public';

import {
AddFromLibraryButton,
QuickButtonGroup,
PrimaryActionButton,
SolutionToolbarButton,
PrimaryActionPopover,
SolutionToolbarPopover,
} from './items';
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/presentation_util/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
{ "path": "../saved_objects/tsconfig.json" },
{ "path": "../embeddable/tsconfig.json" },
{ "path": "../kibana_react/tsconfig.json" },
{ "path": "../data/tsconfig.json" }
{ "path": "../data/tsconfig.json" },
{ "path": "../shared_ux/tsconfig.json" }
rshen91 marked this conversation as resolved.
Show resolved Hide resolved
]
}
2 changes: 1 addition & 1 deletion src/plugins/shared_ux/public/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const LazyExitFullScreenButton = React.lazy(() =>
);

export const LazySolutionToolbarButton = React.lazy(() =>
import('./toolbar/index').then(({ SolutionToolbarButton }) => ({
import('./toolbar').then(({ SolutionToolbarButton }) => ({
default: SolutionToolbarButton,
}))
);
Expand Down
1 change: 1 addition & 0 deletions src/plugins/shared_ux/public/components/toolbar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
*/

export { SolutionToolbarButton } from './solution_toolbar/button/primary';
export type { SolutionToolbarButtonProps } from './solution_toolbar/button/primary';
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ import React from 'react';
import { EuiButton } from '@elastic/eui';
import { EuiButtonPropsForButton } from '@elastic/eui/src/components/button/button';

export interface Props extends Pick<EuiButtonPropsForButton, 'onClick' | 'iconType'> {
export interface SolutionToolbarButtonProps
extends Pick<EuiButtonPropsForButton, 'onClick' | 'iconType'> {
label: string;
}

export const SolutionToolbarButton = ({ label, ...rest }: Props) => {
export const SolutionToolbarButton = ({ label, ...rest }: SolutionToolbarButtonProps) => {
return (
<EuiButton size="m" color="primary" fill={true} {...rest}>
{label}
Expand Down
1 change: 1 addition & 0 deletions src/plugins/shared_ux/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ export function plugin() {
export type { SharedUXPluginSetup, SharedUXPluginStart } from './types';
export { ExitFullScreenButton, LazyExitFullScreenButton } from './components';
export { NoDataViewsPage, LazyNoDataViewsPage } from './components';
export { SolutionToolbarButton, SolutionToolbarButtonProps } from './components';