mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
Remove legacy toolbar component (#170761)
## Summary
This PR removes the duplicated ToolbarButton component that has been
marked for deprecation since
cf16057333
.
In this changeset;
- The import declaration for `ToolbarButton` & `ToolbarButtonProps` from
`@kbn/kibana-react-plugin/public` is changed to
`@kbn/shared-ux-button-toolbar`.
- The visual expectation from the legacy `ToolbarButton` is preserved in
the new component
- A prop `as` is introduced to handle rendering toolbar buttons that are
simply just icons, a use case for this can be found when configuring
Legend settings for a visualisation. The `as` prop accepts values of
`standard` and `iconButton` and in either case the same styling is
preserved.
- When the standard version of the toolbar is being used, by default the
button will rendered with a down arrow positioned to the right, this
icon can be changed by specifying any eui compatible `IconType`.
### Checklist
<!--
Delete any items that are not applicable to this PR.
- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
-->
- [x]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [x] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
<!-- - [ ] If a plugin configuration key changed, check if it needs to
be allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)
### Risk Matrix
Delete this section if it is not applicable to this PR.
Before closing this PR, invite QA, stakeholders, and other developers to
identify risks that should be tested prior to the change/feature
release.
When forming the risk matrix, consider some of the following examples
and how they may potentially impact the change:
| Risk | Probability | Severity | Mitigation/Notes |
|---------------------------|-------------|----------|-------------------------|
| Multiple Spaces—unexpected behavior in non-default Kibana Space.
| Low | High | Integration tests will verify that all features are still
supported in non-default Kibana Space and when user switches between
spaces. |
| Multiple nodes—Elasticsearch polling might have race conditions
when multiple Kibana nodes are polling for the same tasks. | High | Low
| Tasks are idempotent, so executing them multiple times will not result
in logical error, but will degrade performance. To test for this case we
add plenty of unit tests around this logic and document manual testing
procedure. |
| Code should gracefully handle cases when feature X or plugin Y are
disabled. | Medium | High | Unit tests will verify that any feature flag
or plugin combination still results in our service operational. |
| [See more potential risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) |
### For maintainers
- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
-->
This commit is contained in:
parent
4d61cd7a66
commit
fc808a4534
24 changed files with 356 additions and 507 deletions
|
@ -10,7 +10,7 @@ import { i18n } from '@kbn/i18n';
|
|||
import React from 'react';
|
||||
import { ToolbarButton, ToolbarButtonProps } from '../toolbar_button';
|
||||
|
||||
export type Props = Omit<ToolbarButtonProps, 'iconType' | 'label' | 'type'>;
|
||||
export type Props = Omit<ToolbarButtonProps<'standard'>, 'iconType' | 'label' | 'type'>;
|
||||
|
||||
const label = {
|
||||
getLibraryButtonLabel: () =>
|
||||
|
|
|
@ -1,6 +1,22 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`<ToolbarButton /> is rendered - default 1`] = `
|
||||
exports[`<ToolbarButton /> iconButton is rendered - default 1`] = `
|
||||
<button
|
||||
as="iconButton"
|
||||
class="euiButtonIcon emotion-EuiButtonIcon"
|
||||
intl="[object Object]"
|
||||
type="button"
|
||||
>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
class="euiButtonIcon__icon"
|
||||
color="inherit"
|
||||
data-euiicon-type="launch"
|
||||
/>
|
||||
</button>
|
||||
`;
|
||||
|
||||
exports[`<ToolbarButton /> standard is rendered - default 1`] = `
|
||||
<button
|
||||
class="euiButton emotion-euiButtonDisplay-m-defaultMinWidth-EuiButton"
|
||||
intl="[object Object]"
|
||||
|
@ -14,13 +30,17 @@ exports[`<ToolbarButton /> is rendered - default 1`] = `
|
|||
>
|
||||
Create chart
|
||||
</span>
|
||||
<span
|
||||
color="inherit"
|
||||
data-euiicon-type="arrowDown"
|
||||
/>
|
||||
</span>
|
||||
</button>
|
||||
`;
|
||||
|
||||
exports[`<ToolbarButton /> is rendered - primary 1`] = `
|
||||
exports[`<ToolbarButton /> standard is rendered - primary 1`] = `
|
||||
<button
|
||||
class="euiButton emotion-euiButtonDisplay-m-defaultMinWidth-fill-primary"
|
||||
class="euiButton emotion-euiButtonDisplay-m-defaultMinWidth-EuiButton"
|
||||
intl="[object Object]"
|
||||
type="button"
|
||||
>
|
||||
|
@ -32,6 +52,32 @@ exports[`<ToolbarButton /> is rendered - primary 1`] = `
|
|||
>
|
||||
Create chart
|
||||
</span>
|
||||
<span
|
||||
color="inherit"
|
||||
data-euiicon-type="arrowDown"
|
||||
/>
|
||||
</span>
|
||||
</button>
|
||||
`;
|
||||
|
||||
exports[`<ToolbarButton /> standard is rendered - text wth icon 1`] = `
|
||||
<button
|
||||
class="euiButton emotion-euiButtonDisplay-m-defaultMinWidth-EuiButton"
|
||||
intl="[object Object]"
|
||||
type="button"
|
||||
>
|
||||
<span
|
||||
class="emotion-euiButtonDisplayContent"
|
||||
>
|
||||
<span
|
||||
color="inherit"
|
||||
data-euiicon-type="plusInCircle"
|
||||
/>
|
||||
<span
|
||||
class="eui-textTruncate"
|
||||
>
|
||||
Create chart
|
||||
</span>
|
||||
</span>
|
||||
</button>
|
||||
`;
|
||||
|
|
|
@ -21,6 +21,13 @@ export default {
|
|||
};
|
||||
|
||||
const argTypes = {
|
||||
buttonStyle: {
|
||||
defaultValue: 'standard',
|
||||
control: {
|
||||
type: 'radio',
|
||||
options: ['standard', 'iconButton'],
|
||||
},
|
||||
},
|
||||
buttonType: {
|
||||
defaultValue: 'empty',
|
||||
control: {
|
||||
|
@ -39,9 +46,15 @@ const argTypes = {
|
|||
|
||||
type Params = Record<keyof typeof argTypes, any>;
|
||||
|
||||
export const ToolbarButton = ({ buttonType, iconSide }: Params) => {
|
||||
export const ToolbarButton = ({ buttonStyle, buttonType, iconSide }: Params) => {
|
||||
return (
|
||||
<Component label="Toolbar button" iconType="lensApp" type={buttonType} iconSide={iconSide} />
|
||||
<Component
|
||||
as={buttonStyle}
|
||||
label="Toolbar button"
|
||||
iconType="lensApp"
|
||||
type={buttonType}
|
||||
iconSide={iconSide}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -8,12 +8,39 @@
|
|||
|
||||
import { UseEuiTheme } from '@elastic/eui';
|
||||
|
||||
export const fontWeightDefinitions = (euiTheme: UseEuiTheme['euiTheme']) => ({
|
||||
bold: euiTheme.font.weight.bold,
|
||||
normal: euiTheme.font.weight.regular,
|
||||
});
|
||||
|
||||
export const ToolbarButtonStyles = ({ euiTheme }: UseEuiTheme) => {
|
||||
return {
|
||||
default: {
|
||||
// style declaration carried over from https://github.com/elastic/kibana/blob/v8.10.4/src/plugins/kibana_react/public/toolbar_button/toolbar_button.scss
|
||||
// informed by issue https://github.com/elastic/eui/issues/4730
|
||||
borderStyle: 'solid',
|
||||
border: euiTheme.border.thin,
|
||||
borderColor: euiTheme.border.color,
|
||||
},
|
||||
emptyButton: {
|
||||
backgroundColor: euiTheme.colors.emptyShade,
|
||||
border: `${euiTheme.border.thin} !important`,
|
||||
border: `${euiTheme.border.thin}`,
|
||||
color: `${euiTheme.colors.text}`,
|
||||
},
|
||||
buttonPositions: {
|
||||
left: {
|
||||
borderTopRightRadius: 0,
|
||||
borderBottomRightRadius: 0,
|
||||
},
|
||||
right: {
|
||||
borderTopLeftRadius: 0,
|
||||
borderBottomLeftRadius: 0,
|
||||
borderLeft: 'none',
|
||||
},
|
||||
center: {
|
||||
borderRadius: 0,
|
||||
borderLeft: 'none',
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
|
|
|
@ -12,22 +12,47 @@ import { mountWithIntl } from '@kbn/test-jest-helpers';
|
|||
import { ToolbarButton } from './toolbar_button';
|
||||
|
||||
describe('<ToolbarButton />', () => {
|
||||
test('is rendered - default', () => {
|
||||
const component = mountWithIntl(<ToolbarButton label="Create chart" onClick={() => 'click'} />);
|
||||
expect(component.render()).toMatchSnapshot();
|
||||
describe('standard', () => {
|
||||
test('is rendered - default', () => {
|
||||
const component = mountWithIntl(
|
||||
<ToolbarButton label="Create chart" onClick={() => 'click'} />
|
||||
);
|
||||
expect(component.render()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('is rendered - primary', () => {
|
||||
const component = mountWithIntl(
|
||||
<ToolbarButton type="primary" label="Create chart" onClick={() => 'click'} />
|
||||
);
|
||||
expect(component.render()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('is rendered - text wth icon', () => {
|
||||
const component = mountWithIntl(
|
||||
<ToolbarButton
|
||||
type="primary"
|
||||
iconType="plusInCircle"
|
||||
label="Create chart"
|
||||
onClick={() => 'click'}
|
||||
/>
|
||||
);
|
||||
expect(component.render()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('accepts an onClick handler', () => {
|
||||
const mockHandler = jest.fn();
|
||||
const component = mountWithIntl(<ToolbarButton label="Create chart" onClick={mockHandler} />);
|
||||
component.find('button').simulate('click');
|
||||
expect(mockHandler).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
test('is rendered - primary', () => {
|
||||
const component = mountWithIntl(
|
||||
<ToolbarButton type="primary" label="Create chart" onClick={() => 'click'} />
|
||||
);
|
||||
expect(component.render()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('accepts an onClick handler', () => {
|
||||
const mockHandler = jest.fn();
|
||||
const component = mountWithIntl(<ToolbarButton label="Create chart" onClick={mockHandler} />);
|
||||
component.find('button').simulate('click');
|
||||
expect(mockHandler).toHaveBeenCalled();
|
||||
describe('iconButton', () => {
|
||||
test('is rendered - default', () => {
|
||||
const component = mountWithIntl(
|
||||
<ToolbarButton as="iconButton" iconType="launch" onClick={jest.fn()} />
|
||||
);
|
||||
expect(component.render()).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -7,48 +7,177 @@
|
|||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { EuiButton, useEuiTheme } from '@elastic/eui';
|
||||
import { EuiButton, EuiButtonIcon, useEuiTheme, IconType } from '@elastic/eui';
|
||||
import { EuiButtonPropsForButton } from '@elastic/eui/src/components/button/button';
|
||||
|
||||
import { ToolbarButtonStyles } from './toolbar_button.styles';
|
||||
import { ToolbarButtonStyles, fontWeightDefinitions } from './toolbar_button.styles';
|
||||
|
||||
type ToolbarButtonTypes = 'primary' | 'empty';
|
||||
|
||||
type ToolbarButtonFontWeights = 'normal' | 'bold';
|
||||
|
||||
type ButtonPositions = 'left' | 'right' | 'center' | 'none';
|
||||
|
||||
type ButtonRenderStyle = 'standard' | 'iconButton';
|
||||
|
||||
interface ToolbarButtonCommonProps
|
||||
extends Pick<
|
||||
EuiButtonPropsForButton,
|
||||
'onClick' | 'iconType' | 'size' | 'data-test-subj' | 'isDisabled'
|
||||
> {
|
||||
/**
|
||||
* Render style of the toolbar button
|
||||
*/
|
||||
as?: ButtonRenderStyle;
|
||||
type?: ToolbarButtonTypes;
|
||||
/**
|
||||
* Adjusts the borders for groupings
|
||||
*/
|
||||
groupPosition?: ButtonPositions;
|
||||
}
|
||||
|
||||
type ToolbarStandardButton = Pick<EuiButtonPropsForButton, 'fullWidth' | 'isLoading' | 'iconSide'> &
|
||||
Omit<ToolbarButtonCommonProps, 'label'> & {
|
||||
as?: Extract<ButtonRenderStyle, 'standard'>;
|
||||
/**
|
||||
* Display text for toolbar button
|
||||
*/
|
||||
label: React.ReactNode;
|
||||
/**
|
||||
* Determines if the button will have a down arrow or not
|
||||
*/
|
||||
hasArrow?: boolean;
|
||||
/**
|
||||
* Determines prominence
|
||||
*/
|
||||
fontWeight?: ToolbarButtonFontWeights;
|
||||
};
|
||||
|
||||
type ToolbarIconButton = ToolbarButtonCommonProps & {
|
||||
as: Extract<ButtonRenderStyle, 'iconButton'>;
|
||||
iconType: IconType;
|
||||
label?: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Props for `PrimaryButton`.
|
||||
*/
|
||||
export interface Props
|
||||
extends Pick<
|
||||
EuiButtonPropsForButton,
|
||||
'onClick' | 'iconType' | 'iconSide' | 'size' | 'data-test-subj' | 'isDisabled'
|
||||
> {
|
||||
label: string;
|
||||
type?: ToolbarButtonTypes;
|
||||
}
|
||||
export type Props<T extends ButtonRenderStyle> = T extends Extract<ButtonRenderStyle, 'iconButton'>
|
||||
? ToolbarIconButton
|
||||
: ToolbarStandardButton;
|
||||
|
||||
export const ToolbarButton: React.FunctionComponent<Props> = ({
|
||||
const isIconButton = (
|
||||
props: ToolbarStandardButton | ToolbarIconButton
|
||||
): props is ToolbarIconButton => {
|
||||
return (props as ToolbarIconButton).as === 'iconButton';
|
||||
};
|
||||
|
||||
const computeToolbarButtonCommonCSSProps = (
|
||||
euiTheme: ReturnType<typeof useEuiTheme>,
|
||||
{
|
||||
type,
|
||||
isDisabled,
|
||||
groupPosition,
|
||||
}: Pick<Props<ButtonRenderStyle>, 'type' | 'isDisabled' | 'groupPosition'>
|
||||
) => {
|
||||
const toolButtonStyles = ToolbarButtonStyles(euiTheme);
|
||||
|
||||
const groupPositionStyles =
|
||||
groupPosition && groupPosition !== 'none'
|
||||
? toolButtonStyles.buttonPositions[groupPosition]
|
||||
: {};
|
||||
|
||||
const defaultStyles = {
|
||||
...toolButtonStyles.default,
|
||||
...groupPositionStyles,
|
||||
};
|
||||
|
||||
return isDisabled
|
||||
? defaultStyles
|
||||
: {
|
||||
...defaultStyles,
|
||||
...(type === 'primary' ? {} : toolButtonStyles.emptyButton),
|
||||
};
|
||||
};
|
||||
|
||||
const ToolbarStandardButton = ({
|
||||
hasArrow = true,
|
||||
fontWeight = 'normal',
|
||||
type,
|
||||
label,
|
||||
type = 'empty',
|
||||
iconSide = 'left',
|
||||
size = 'm',
|
||||
iconSide,
|
||||
iconType,
|
||||
fullWidth,
|
||||
isDisabled,
|
||||
groupPosition,
|
||||
...rest
|
||||
}) => {
|
||||
}: Omit<ToolbarStandardButton, 'as'>) => {
|
||||
const euiTheme = useEuiTheme();
|
||||
const toolbarButtonStyleProps: EuiButtonPropsForButton = !isDisabled
|
||||
? type === 'primary'
|
||||
? { color: 'primary', fill: true }
|
||||
: { color: 'text', css: ToolbarButtonStyles(euiTheme).emptyButton }
|
||||
: {};
|
||||
const cssProps = {
|
||||
...computeToolbarButtonCommonCSSProps(euiTheme, { type, isDisabled, groupPosition }),
|
||||
fontWeight: fontWeightDefinitions(euiTheme.euiTheme)[fontWeight],
|
||||
};
|
||||
|
||||
const toolbarButtonStyleProps: EuiButtonPropsForButton = isDisabled
|
||||
? {}
|
||||
: type === 'primary'
|
||||
? { color: 'primary', fill: true }
|
||||
: { color: 'text' };
|
||||
|
||||
const icon = iconType ?? (hasArrow ? 'arrowDown' : '');
|
||||
|
||||
return (
|
||||
<EuiButton
|
||||
size={size}
|
||||
size={rest.size}
|
||||
isDisabled={isDisabled}
|
||||
css={cssProps}
|
||||
iconType={icon}
|
||||
iconSide={iconType ? iconSide : 'right'}
|
||||
fullWidth={fullWidth}
|
||||
contentProps={fullWidth ? { style: { justifyContent: 'space-between' } } : {}}
|
||||
{...toolbarButtonStyleProps}
|
||||
{...{ iconSide, ...rest }}
|
||||
{...rest}
|
||||
>
|
||||
{label}
|
||||
</EuiButton>
|
||||
);
|
||||
};
|
||||
|
||||
const ToolbarIconButton = ({
|
||||
size,
|
||||
type,
|
||||
label,
|
||||
isDisabled,
|
||||
groupPosition,
|
||||
...rest
|
||||
}: Omit<ToolbarIconButton, 'as'>) => {
|
||||
const euiTheme = useEuiTheme();
|
||||
const cssProps = computeToolbarButtonCommonCSSProps(euiTheme, {
|
||||
type,
|
||||
isDisabled,
|
||||
groupPosition,
|
||||
});
|
||||
|
||||
return (
|
||||
<EuiButtonIcon
|
||||
{...rest}
|
||||
disabled={isDisabled}
|
||||
aria-label={label}
|
||||
size={size}
|
||||
iconSize={size}
|
||||
css={cssProps}
|
||||
display={type === 'primary' ? 'fill' : 'base'}
|
||||
color={type === 'primary' ? 'primary' : 'text'}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export function ToolbarButton<T extends ButtonRenderStyle>(props: Props<T>) {
|
||||
const { type = 'empty', size = 'm' } = props;
|
||||
|
||||
if (isIconButton(props)) {
|
||||
return <ToolbarIconButton {...props} size={size} type={type} />;
|
||||
}
|
||||
|
||||
return <ToolbarStandardButton {...props} size={size} type={type} />;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ describe('<ToolbarPopover />', () => {
|
|||
expect(button.prop('color')).toBe('text');
|
||||
expect(button.prop('css')).toMatchObject({
|
||||
backgroundColor: '#FFF',
|
||||
border: '1px solid #D3DAE6 !important',
|
||||
border: '1px solid #D3DAE6',
|
||||
color: '#343741',
|
||||
});
|
||||
});
|
||||
|
|
|
@ -12,7 +12,10 @@ import { Props as EuiPopoverProps } from '@elastic/eui/src/components/popover/po
|
|||
|
||||
import { ToolbarButtonProps, ToolbarButton } from '../buttons';
|
||||
|
||||
type AllowedButtonProps = Omit<ToolbarButtonProps, 'iconSide' | 'onClick' | 'fill'>;
|
||||
type AllowedButtonProps = Omit<
|
||||
ToolbarButtonProps<'standard'>,
|
||||
'iconSide' | 'onClick' | 'fill' | 'label'
|
||||
>;
|
||||
type AllowedPopoverProps = Omit<
|
||||
EuiPopoverProps,
|
||||
'button' | 'isOpen' | 'closePopover' | 'anchorPosition'
|
||||
|
@ -24,6 +27,7 @@ type AllowedPopoverProps = Omit<
|
|||
export type Props = AllowedButtonProps &
|
||||
AllowedPopoverProps & {
|
||||
children: (arg: { closePopover: () => void }) => React.ReactNode;
|
||||
label: NonNullable<ToolbarButtonProps<'standard'>['label']>;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,7 +8,7 @@ exports[`<Toolbar /> is rendered 1`] = `
|
|||
class="euiFlexItem emotion-euiFlexItem-growZero"
|
||||
>
|
||||
<button
|
||||
class="euiButton emotion-euiButtonDisplay-m-defaultMinWidth-fill-primary"
|
||||
class="euiButton emotion-euiButtonDisplay-m-defaultMinWidth-EuiButton"
|
||||
type="button"
|
||||
>
|
||||
<span
|
||||
|
@ -19,6 +19,10 @@ exports[`<Toolbar /> is rendered 1`] = `
|
|||
>
|
||||
Create chart
|
||||
</span>
|
||||
<span
|
||||
color="inherit"
|
||||
data-euiicon-type="arrowDown"
|
||||
/>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
|
|
|
@ -44,10 +44,6 @@ export {
|
|||
|
||||
export { useExecutionContext } from './use_execution_context';
|
||||
|
||||
export type { ToolbarButtonProps } from './toolbar_button';
|
||||
/** @deprecated ToolbarButton - use `ToolbarButton` from `@kbn/shared-ux-button-toolbar` */
|
||||
export { POSITIONS, WEIGHTS, TOOLBAR_BUTTON_SIZES, ToolbarButton } from './toolbar_button';
|
||||
|
||||
export { reactRouterNavigate, reactRouterOnClickHandler } from './react_router_navigate';
|
||||
|
||||
export type {
|
||||
|
|
|
@ -1,199 +0,0 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`font weights bold is applied 1`] = `
|
||||
<EuiButton
|
||||
className="kbnToolbarButton kbnToolbarButton--bold kbnToolbarButton--m"
|
||||
color="text"
|
||||
contentProps={
|
||||
Object {
|
||||
"className": "kbnToolbarButton__content",
|
||||
}
|
||||
}
|
||||
data-test-subj=""
|
||||
iconSide="right"
|
||||
iconType="arrowDown"
|
||||
onClick={[Function]}
|
||||
size="m"
|
||||
textProps={
|
||||
Object {
|
||||
"className": "kbnToolbarButton__text",
|
||||
}
|
||||
}
|
||||
/>
|
||||
`;
|
||||
|
||||
exports[`font weights normal is applied 1`] = `
|
||||
<EuiButton
|
||||
className="kbnToolbarButton kbnToolbarButton--normal kbnToolbarButton--m"
|
||||
color="text"
|
||||
contentProps={
|
||||
Object {
|
||||
"className": "kbnToolbarButton__content",
|
||||
}
|
||||
}
|
||||
data-test-subj=""
|
||||
iconSide="right"
|
||||
iconType="arrowDown"
|
||||
onClick={[Function]}
|
||||
size="m"
|
||||
textProps={
|
||||
Object {
|
||||
"className": "kbnToolbarButton__text",
|
||||
}
|
||||
}
|
||||
/>
|
||||
`;
|
||||
|
||||
exports[`hasArrow is rendered 1`] = `
|
||||
<EuiButton
|
||||
className="kbnToolbarButton kbnToolbarButton--normal kbnToolbarButton--m"
|
||||
color="text"
|
||||
contentProps={
|
||||
Object {
|
||||
"className": "kbnToolbarButton__content",
|
||||
}
|
||||
}
|
||||
data-test-subj=""
|
||||
iconSide="right"
|
||||
iconType="arrowDown"
|
||||
onClick={[Function]}
|
||||
size="m"
|
||||
textProps={
|
||||
Object {
|
||||
"className": "kbnToolbarButton__text",
|
||||
}
|
||||
}
|
||||
/>
|
||||
`;
|
||||
|
||||
exports[`positions center is applied 1`] = `
|
||||
<EuiButton
|
||||
className="kbnToolbarButton kbnToolbarButton--groupCenter kbnToolbarButton--normal kbnToolbarButton--m"
|
||||
color="text"
|
||||
contentProps={
|
||||
Object {
|
||||
"className": "kbnToolbarButton__content",
|
||||
}
|
||||
}
|
||||
data-test-subj=""
|
||||
iconSide="right"
|
||||
iconType="arrowDown"
|
||||
onClick={[Function]}
|
||||
size="m"
|
||||
textProps={
|
||||
Object {
|
||||
"className": "kbnToolbarButton__text",
|
||||
}
|
||||
}
|
||||
/>
|
||||
`;
|
||||
|
||||
exports[`positions left is applied 1`] = `
|
||||
<EuiButton
|
||||
className="kbnToolbarButton kbnToolbarButton--groupLeft kbnToolbarButton--normal kbnToolbarButton--m"
|
||||
color="text"
|
||||
contentProps={
|
||||
Object {
|
||||
"className": "kbnToolbarButton__content",
|
||||
}
|
||||
}
|
||||
data-test-subj=""
|
||||
iconSide="right"
|
||||
iconType="arrowDown"
|
||||
onClick={[Function]}
|
||||
size="m"
|
||||
textProps={
|
||||
Object {
|
||||
"className": "kbnToolbarButton__text",
|
||||
}
|
||||
}
|
||||
/>
|
||||
`;
|
||||
|
||||
exports[`positions none is applied 1`] = `
|
||||
<EuiButton
|
||||
className="kbnToolbarButton kbnToolbarButton--normal kbnToolbarButton--m"
|
||||
color="text"
|
||||
contentProps={
|
||||
Object {
|
||||
"className": "kbnToolbarButton__content",
|
||||
}
|
||||
}
|
||||
data-test-subj=""
|
||||
iconSide="right"
|
||||
iconType="arrowDown"
|
||||
onClick={[Function]}
|
||||
size="m"
|
||||
textProps={
|
||||
Object {
|
||||
"className": "kbnToolbarButton__text",
|
||||
}
|
||||
}
|
||||
/>
|
||||
`;
|
||||
|
||||
exports[`positions right is applied 1`] = `
|
||||
<EuiButton
|
||||
className="kbnToolbarButton kbnToolbarButton--groupRight kbnToolbarButton--normal kbnToolbarButton--m"
|
||||
color="text"
|
||||
contentProps={
|
||||
Object {
|
||||
"className": "kbnToolbarButton__content",
|
||||
}
|
||||
}
|
||||
data-test-subj=""
|
||||
iconSide="right"
|
||||
iconType="arrowDown"
|
||||
onClick={[Function]}
|
||||
size="m"
|
||||
textProps={
|
||||
Object {
|
||||
"className": "kbnToolbarButton__text",
|
||||
}
|
||||
}
|
||||
/>
|
||||
`;
|
||||
|
||||
exports[`sizes m is applied 1`] = `
|
||||
<EuiButton
|
||||
className="kbnToolbarButton kbnToolbarButton--normal kbnToolbarButton--m"
|
||||
color="text"
|
||||
contentProps={
|
||||
Object {
|
||||
"className": "kbnToolbarButton__content",
|
||||
}
|
||||
}
|
||||
data-test-subj=""
|
||||
iconSide="right"
|
||||
iconType="arrowDown"
|
||||
onClick={[Function]}
|
||||
size="m"
|
||||
textProps={
|
||||
Object {
|
||||
"className": "kbnToolbarButton__text",
|
||||
}
|
||||
}
|
||||
/>
|
||||
`;
|
||||
|
||||
exports[`sizes s is applied 1`] = `
|
||||
<EuiButton
|
||||
className="kbnToolbarButton kbnToolbarButton--normal kbnToolbarButton--s"
|
||||
color="text"
|
||||
contentProps={
|
||||
Object {
|
||||
"className": "kbnToolbarButton__content",
|
||||
}
|
||||
}
|
||||
data-test-subj=""
|
||||
iconSide="right"
|
||||
iconType="arrowDown"
|
||||
onClick={[Function]}
|
||||
size="s"
|
||||
textProps={
|
||||
Object {
|
||||
"className": "kbnToolbarButton__text",
|
||||
}
|
||||
}
|
||||
/>
|
||||
`;
|
|
@ -1,9 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
export * from './toolbar_button';
|
|
@ -1,61 +0,0 @@
|
|||
.kbnToolbarButton {
|
||||
line-height: $euiButtonHeight; // Keeps alignment of text and chart icon
|
||||
|
||||
// Override background color for non-disabled buttons
|
||||
&:not(:disabled) {
|
||||
background-color: $euiColorEmptyShade;
|
||||
}
|
||||
|
||||
// todo: once issue https://github.com/elastic/eui/issues/4730 is merged, this code might be safe to remove
|
||||
// Some toolbar buttons are just icons, but EuiButton comes with margin and min-width that need to be removed
|
||||
min-width: 0;
|
||||
border-width: $euiBorderWidthThin;
|
||||
border-style: solid;
|
||||
border-color: $euiBorderColor; // Lighten the border color for all states
|
||||
|
||||
.kbnToolbarButton__text > svg {
|
||||
margin-top: -1px; // Just some weird alignment issue when icon is the child not the `iconType`
|
||||
}
|
||||
|
||||
.kbnToolbarButton__text:empty {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
// Toolbar buttons don't look good with centered text when fullWidth
|
||||
&[class*='fullWidth'] {
|
||||
text-align: left;
|
||||
|
||||
.kbnToolbarButton__content {
|
||||
justify-content: space-between;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.kbnToolbarButton--groupLeft {
|
||||
border-top-right-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
}
|
||||
|
||||
.kbnToolbarButton--groupCenter {
|
||||
border-radius: 0;
|
||||
border-left: none;
|
||||
}
|
||||
|
||||
.kbnToolbarButton--groupRight {
|
||||
border-top-left-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
border-left: none;
|
||||
}
|
||||
|
||||
.kbnToolbarButton--bold {
|
||||
font-weight: $euiFontWeightBold;
|
||||
}
|
||||
|
||||
.kbnToolbarButton--normal {
|
||||
font-weight: $euiFontWeightRegular;
|
||||
}
|
||||
|
||||
.kbnToolbarButton--s {
|
||||
box-shadow: none !important; // sass-lint:disable-line no-important
|
||||
font-size: $euiFontSizeS;
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { ToolbarButton, POSITIONS, WEIGHTS, TOOLBAR_BUTTON_SIZES } from './toolbar_button';
|
||||
|
||||
const noop = () => {};
|
||||
|
||||
describe('sizes', () => {
|
||||
TOOLBAR_BUTTON_SIZES.forEach((size) => {
|
||||
test(`${size} is applied`, () => {
|
||||
const component = shallow(<ToolbarButton onClick={noop} size={size} />);
|
||||
expect(component).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('positions', () => {
|
||||
POSITIONS.forEach((position) => {
|
||||
test(`${position} is applied`, () => {
|
||||
const component = shallow(<ToolbarButton onClick={noop} groupPosition={position} />);
|
||||
expect(component).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('font weights', () => {
|
||||
WEIGHTS.forEach((weight) => {
|
||||
test(`${weight} is applied`, () => {
|
||||
const component = shallow(<ToolbarButton onClick={noop} fontWeight={weight} />);
|
||||
expect(component).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('hasArrow', () => {
|
||||
it('is rendered', () => {
|
||||
const component = shallow(<ToolbarButton onClick={noop} hasArrow />);
|
||||
expect(component).toMatchSnapshot();
|
||||
});
|
||||
});
|
|
@ -1,85 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import './toolbar_button.scss';
|
||||
import React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import { EuiButton, PropsOf, EuiButtonProps } from '@elastic/eui';
|
||||
|
||||
const groupPositionToClassMap = {
|
||||
none: null,
|
||||
left: 'kbnToolbarButton--groupLeft',
|
||||
center: 'kbnToolbarButton--groupCenter',
|
||||
right: 'kbnToolbarButton--groupRight',
|
||||
};
|
||||
|
||||
type ButtonPositions = keyof typeof groupPositionToClassMap;
|
||||
export const POSITIONS = Object.keys(groupPositionToClassMap) as ButtonPositions[];
|
||||
|
||||
type Weights = 'normal' | 'bold';
|
||||
export const WEIGHTS = ['normal', 'bold'] as Weights[];
|
||||
|
||||
export const TOOLBAR_BUTTON_SIZES: Array<EuiButtonProps['size']> = ['s', 'm'];
|
||||
|
||||
export type ToolbarButtonProps = PropsOf<typeof EuiButton> & {
|
||||
/**
|
||||
* Determines prominence
|
||||
*/
|
||||
fontWeight?: Weights;
|
||||
/**
|
||||
* Smaller buttons also remove extra shadow for less prominence
|
||||
*/
|
||||
size?: EuiButtonProps['size'];
|
||||
/**
|
||||
* Determines if the button will have a down arrow or not
|
||||
*/
|
||||
hasArrow?: boolean;
|
||||
/**
|
||||
* Adjusts the borders for groupings
|
||||
*/
|
||||
groupPosition?: ButtonPositions;
|
||||
dataTestSubj?: string;
|
||||
};
|
||||
|
||||
export const ToolbarButton: React.FunctionComponent<ToolbarButtonProps> = ({
|
||||
children,
|
||||
className,
|
||||
fontWeight = 'normal',
|
||||
size = 'm',
|
||||
hasArrow = true,
|
||||
groupPosition = 'none',
|
||||
dataTestSubj = '',
|
||||
...rest
|
||||
}) => {
|
||||
const classes = classNames(
|
||||
'kbnToolbarButton',
|
||||
groupPositionToClassMap[groupPosition],
|
||||
[`kbnToolbarButton--${fontWeight}`, `kbnToolbarButton--${size}`],
|
||||
className
|
||||
);
|
||||
|
||||
return (
|
||||
<EuiButton
|
||||
data-test-subj={dataTestSubj}
|
||||
className={classes}
|
||||
iconSide="right"
|
||||
iconType={hasArrow ? 'arrowDown' : ''}
|
||||
color="text"
|
||||
contentProps={{
|
||||
className: 'kbnToolbarButton__content',
|
||||
}}
|
||||
textProps={{
|
||||
className: 'kbnToolbarButton__text',
|
||||
}}
|
||||
{...rest}
|
||||
size={size}
|
||||
>
|
||||
{children}
|
||||
</EuiButton>
|
||||
);
|
||||
};
|
|
@ -20,7 +20,7 @@ import {
|
|||
EuiHighlight,
|
||||
} from '@elastic/eui';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { ToolbarButton } from '@kbn/kibana-react-plugin/public';
|
||||
import { ToolbarButton } from '@kbn/shared-ux-button-toolbar';
|
||||
import { SavedObjectCommon } from '@kbn/saved-objects-finder-plugin/common';
|
||||
|
||||
import { pluginServices } from '../../services';
|
||||
|
@ -122,19 +122,20 @@ export function DashboardPicker({ isDisabled, onChange, idsToOmit }: DashboardPi
|
|||
isLoading={isLoading}
|
||||
data-test-subj="open-dashboard-picker"
|
||||
onClick={() => setIsPopoverOpen(!isPopoverOpen)}
|
||||
>
|
||||
<EuiText
|
||||
size="s"
|
||||
css={css`
|
||||
color: ${selectedDashboard ? euiTheme.colors.text : euiTheme.colors.disabledText};
|
||||
`}
|
||||
>
|
||||
{selectedDashboard?.label ??
|
||||
i18n.translate('presentationUtil.dashboardPicker.noDashboardOptionLabel', {
|
||||
defaultMessage: 'Select dashboard',
|
||||
})}
|
||||
</EuiText>
|
||||
</ToolbarButton>
|
||||
label={
|
||||
<EuiText
|
||||
size="s"
|
||||
css={css`
|
||||
color: ${selectedDashboard ? euiTheme.colors.text : euiTheme.colors.disabledText};
|
||||
`}
|
||||
>
|
||||
{selectedDashboard?.label ??
|
||||
i18n.translate('presentationUtil.dashboardPicker.noDashboardOptionLabel', {
|
||||
defaultMessage: 'Select dashboard',
|
||||
})}
|
||||
</EuiText>
|
||||
}
|
||||
/>
|
||||
}
|
||||
isOpen={isPopoverOpen}
|
||||
closePopover={() => setIsPopoverOpen(false)}
|
||||
|
|
|
@ -10,9 +10,9 @@ import React, { useState } from 'react';
|
|||
import { EuiSelectable, EuiInputPopover, EuiSelectableProps } from '@elastic/eui';
|
||||
import { DataViewListItem } from '@kbn/data-views-plugin/common';
|
||||
|
||||
import { ToolbarButton, ToolbarButtonProps } from '@kbn/kibana-react-plugin/public';
|
||||
import { ToolbarButton, ToolbarButtonProps } from '@kbn/shared-ux-button-toolbar';
|
||||
|
||||
export type DataViewTriggerProps = ToolbarButtonProps & {
|
||||
export type DataViewTriggerProps = Omit<ToolbarButtonProps<'standard'>, 'label'> & {
|
||||
label: string;
|
||||
title?: string;
|
||||
};
|
||||
|
@ -46,15 +46,14 @@ export function DataViewPicker({
|
|||
const { label, title, ...rest } = trigger;
|
||||
return (
|
||||
<ToolbarButton
|
||||
title={title}
|
||||
aria-label={title}
|
||||
data-test-subj="open-data-view-picker"
|
||||
onClick={() => setPopoverIsOpen(!isPopoverOpen)}
|
||||
label={label}
|
||||
fullWidth
|
||||
{...colorProp}
|
||||
{...rest}
|
||||
>
|
||||
{label}
|
||||
</ToolbarButton>
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -30,7 +30,8 @@
|
|||
"@kbn/storybook",
|
||||
"@kbn/ui-actions-plugin",
|
||||
"@kbn/saved-objects-finder-plugin",
|
||||
"@kbn/content-management-plugin"
|
||||
"@kbn/content-management-plugin",
|
||||
"@kbn/shared-ux-button-toolbar"
|
||||
],
|
||||
"exclude": ["target/**/*"]
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ import {
|
|||
} from '@elastic/eui';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { FormattedMessage } from '@kbn/i18n-react';
|
||||
import { ToolbarButton } from '@kbn/kibana-react-plugin/public';
|
||||
import { ToolbarButton } from '@kbn/shared-ux-button-toolbar';
|
||||
import {
|
||||
Visualization,
|
||||
FramePublicAPI,
|
||||
|
@ -429,12 +429,13 @@ export const ChartSwitch = memo(function ChartSwitch(props: Props) {
|
|||
onClick={() => setFlyoutOpen(!flyoutOpen)}
|
||||
data-test-subj="lnsChartSwitchPopover"
|
||||
fontWeight="bold"
|
||||
>
|
||||
<VisualizationSummary
|
||||
visualization={visualization}
|
||||
visualizationMap={props.visualizationMap}
|
||||
/>
|
||||
</ToolbarButton>
|
||||
label={
|
||||
<VisualizationSummary
|
||||
visualization={visualization}
|
||||
visualizationMap={props.visualizationMap}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
}
|
||||
isOpen={flyoutOpen}
|
||||
closePopover={() => setFlyoutOpen(false)}
|
||||
|
|
|
@ -15,10 +15,9 @@ import {
|
|||
EuiFieldNumber,
|
||||
} from '@elastic/eui';
|
||||
import { Position, VerticalAlignment, HorizontalAlignment } from '@elastic/charts';
|
||||
import { ToolbarButtonProps } from '@kbn/kibana-react-plugin/public';
|
||||
import { LegendSize } from '@kbn/visualizations-plugin/public';
|
||||
import { useDebouncedValue } from '@kbn/visualization-ui-components';
|
||||
import { ToolbarPopover } from '../toolbar_popover';
|
||||
import { ToolbarPopover, type ToolbarPopoverProps } from '../toolbar_popover';
|
||||
import { LegendLocationSettings } from './location/legend_location_settings';
|
||||
import { ColumnsNumberSetting } from './layout/columns_number_setting';
|
||||
import { LegendSizeSettings } from './size/legend_size_settings';
|
||||
|
@ -119,7 +118,7 @@ export interface LegendSettingsPopoverProps {
|
|||
/**
|
||||
* Button group position
|
||||
*/
|
||||
groupPosition?: ToolbarButtonProps['groupPosition'];
|
||||
groupPosition?: ToolbarPopoverProps['groupPosition'];
|
||||
/**
|
||||
* Legend size in pixels
|
||||
*/
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
|
||||
import './toolbar_popover.scss';
|
||||
import React, { useState } from 'react';
|
||||
import { EuiFlexItem, EuiPopover, EuiIcon, EuiPopoverTitle, IconType } from '@elastic/eui';
|
||||
import { ToolbarButton, ToolbarButtonProps } from '@kbn/kibana-react-plugin/public';
|
||||
import { EuiFlexItem, EuiPopover, EuiPopoverTitle, IconType } from '@elastic/eui';
|
||||
import { ToolbarButton, ToolbarButtonProps } from '@kbn/shared-ux-button-toolbar';
|
||||
import { EuiIconLegend } from '@kbn/chart-icons';
|
||||
|
||||
const typeToIconMap: { [type: string]: string | IconType } = {
|
||||
|
@ -35,7 +35,7 @@ export interface ToolbarPopoverProps {
|
|||
/**
|
||||
* Button group position
|
||||
*/
|
||||
groupPosition?: ToolbarButtonProps['groupPosition'];
|
||||
groupPosition?: ToolbarButtonProps<'iconButton'>['groupPosition'];
|
||||
buttonDataTestSubj?: string;
|
||||
panelClassName?: string;
|
||||
handleClose?: () => void;
|
||||
|
@ -63,18 +63,16 @@ export const ToolbarPopover: React.FunctionComponent<ToolbarPopoverProps> = ({
|
|||
aria-label={title}
|
||||
button={
|
||||
<ToolbarButton
|
||||
fontWeight="normal"
|
||||
as={'iconButton'}
|
||||
iconType={iconType}
|
||||
onClick={() => {
|
||||
setOpen(!open);
|
||||
}}
|
||||
title={title}
|
||||
hasArrow={false}
|
||||
aria-label={title}
|
||||
isDisabled={isDisabled}
|
||||
groupPosition={groupPosition}
|
||||
dataTestSubj={buttonDataTestSubj}
|
||||
>
|
||||
<EuiIcon type={iconType} />
|
||||
</ToolbarButton>
|
||||
data-test-subj={buttonDataTestSubj}
|
||||
/>
|
||||
}
|
||||
isOpen={open}
|
||||
closePopover={() => {
|
||||
|
|
|
@ -10,7 +10,7 @@ import { EuiSwitch, IconType, EuiFormRow, EuiButtonGroup, EuiSelect } from '@ela
|
|||
import { i18n } from '@kbn/i18n';
|
||||
import { isEqual } from 'lodash';
|
||||
import { AxisExtentConfig, YScaleType } from '@kbn/expression-xy-plugin/common';
|
||||
import { ToolbarButtonProps } from '@kbn/kibana-react-plugin/public';
|
||||
import { ToolbarButtonProps } from '@kbn/shared-ux-button-toolbar';
|
||||
import {
|
||||
EuiIconAxisBottom,
|
||||
EuiIconAxisLeft,
|
||||
|
@ -131,7 +131,7 @@ const popoverConfig = (
|
|||
isHorizontal: boolean
|
||||
): {
|
||||
icon: IconType;
|
||||
groupPosition: ToolbarButtonProps['groupPosition'];
|
||||
groupPosition: ToolbarButtonProps<'iconButton'>['groupPosition'];
|
||||
popoverTitle: string;
|
||||
buttonDataTestSubj: string;
|
||||
} => {
|
||||
|
|
|
@ -15,8 +15,10 @@ import {
|
|||
EuiPopoverTitle,
|
||||
useEuiTheme,
|
||||
EuiIconTip,
|
||||
EuiFlexGroup,
|
||||
EuiFlexItem,
|
||||
} from '@elastic/eui';
|
||||
import { ToolbarButton } from '@kbn/kibana-react-plugin/public';
|
||||
import { ToolbarButton } from '@kbn/shared-ux-button-toolbar';
|
||||
import { IconChartBarReferenceLine, IconChartBarAnnotations } from '@kbn/chart-icons';
|
||||
import { euiThemeVars } from '@kbn/ui-theme';
|
||||
import { css } from '@emotion/react';
|
||||
|
@ -231,18 +233,22 @@ const DataLayerHeaderTrigger = function ({
|
|||
return (
|
||||
<ToolbarButton
|
||||
data-test-subj="lns_layer_settings"
|
||||
title={currentVisType.fullLabel || currentVisType.label}
|
||||
aria-label={currentVisType.fullLabel || currentVisType.label}
|
||||
onClick={onClick}
|
||||
fullWidth
|
||||
size="s"
|
||||
textProps={{ style: { lineHeight: '100%' } }}
|
||||
>
|
||||
<>
|
||||
<EuiIcon type={currentVisType.icon} />
|
||||
<EuiText size="s" className="lnsLayerPanelChartSwitch_title">
|
||||
{currentVisType.fullLabel || currentVisType.label}
|
||||
</EuiText>
|
||||
</>
|
||||
</ToolbarButton>
|
||||
label={
|
||||
<EuiFlexGroup gutterSize="none" alignItems="center" responsive={false}>
|
||||
<EuiFlexItem grow={false}>
|
||||
<EuiIcon type={currentVisType.icon} />
|
||||
</EuiFlexItem>
|
||||
<EuiFlexItem grow={false}>
|
||||
<EuiText size="s" className="lnsLayerPanelChartSwitch_title">
|
||||
{currentVisType.fullLabel || currentVisType.label}
|
||||
</EuiText>
|
||||
</EuiFlexItem>
|
||||
</EuiFlexGroup>
|
||||
}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -90,7 +90,8 @@
|
|||
"@kbn/search-response-warnings",
|
||||
"@kbn/logging",
|
||||
"@kbn/core-plugins-server",
|
||||
"@kbn/field-utils"
|
||||
"@kbn/field-utils",
|
||||
"@kbn/shared-ux-button-toolbar"
|
||||
],
|
||||
"exclude": [
|
||||
"target/**/*",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue