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

[Lens] Remove scss from annotations plugin, visualization-ui-components and gauge expression #208891

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -7,7 +7,6 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import './index.scss';
import { isFieldLensCompatible } from '@kbn/visualization-ui-components';
import React, { useCallback, useEffect, useMemo } from 'react';
import { i18n } from '@kbn/i18n';
Expand Down Expand Up @@ -365,7 +364,6 @@ const AnnotationEditorControls = ({
>
<EuiFormRow
display="rowCompressed"
className="lnsRowCompressedMargin"
fullWidth
label={i18n.translate('eventAnnotationComponents.xyChart.annotation.tooltip', {
defaultMessage: 'Show additional fields',
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ export const ConfigPanelQueryAnnotation = ({
<EuiFormRow
hasChildLabel
display="rowCompressed"
className="lnsRowCompressedMargin"
fullWidth
label={i18n.translate('eventAnnotationComponents.xyChart.annotation.queryInput', {
defaultMessage: 'Annotation query',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import { i18n } from '@kbn/i18n';
import React from 'react';
import { EuiFormRow, EuiSwitch, EuiText, EuiDatePicker } from '@elastic/eui';
import { EuiFormRow, EuiSwitch, EuiText, EuiDatePicker, UseEuiTheme } from '@elastic/eui';
import moment from 'moment';
import type {
PointInTimeEventAnnotationConfig,
Expand All @@ -31,7 +31,7 @@ export const ConfigPanelApplyAsRangeSwitch = ({
}) => {
const isRange = isRangeAnnotationConfig(annotation);
return (
<EuiFormRow display="columnCompressed" className="lnsRowCompressedMargin">
<EuiFormRow display="columnCompressed">
<EuiSwitch
data-test-subj="lns-xyAnnotation-rangeSwitch"
label={
Expand Down Expand Up @@ -84,6 +84,15 @@ export const ConfigPanelApplyAsRangeSwitch = ({
);
};

const RowCompressedMarginStyle = ({ euiTheme }: UseEuiTheme) => `
& + .lnsRowCompressedMargin {
margin-top: ${euiTheme.size.s};
}
.euiFormControlLayout__prepend {
min-width: 50px; // makes both labels ("from" and "to") the same width
}
`;

export const ConfigPanelRangeDatePicker = ({
value,
label,
Expand All @@ -102,9 +111,10 @@ export const ConfigPanelRangeDatePicker = ({
return (
<EuiFormRow
display="rowCompressed"
fullWidth
label={label}
className="lnsConfigPanelAnnotations__date lnsRowCompressedMargin"
fullWidth
className="lnsRowCompressedMargin"
css={RowCompressedMarginStyle}
>
<EuiDatePicker
compressed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { EuiFlexItem, EuiPanel, EuiText, htmlIdGenerator } from '@elastic/eui';
import { EuiFlexItem, EuiPanel, EuiText, UseEuiTheme, htmlIdGenerator } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import React, { useCallback, useState } from 'react';
import fastIsEqual from 'fast-deep-equal';
Expand Down Expand Up @@ -43,6 +43,10 @@ function removeNewEmptyField(v: string) {

const generateId = htmlIdGenerator();

const NewBucketButtonStyles = ({ euiTheme }: UseEuiTheme) => `
margin-top: ${euiTheme.size.xs};
`;

interface LocalFieldEntry {
name: string;
id: string;
Expand Down Expand Up @@ -78,7 +82,7 @@ export function TooltipSection({ currentConfig, setConfig, dataView }: FieldInpu

const addFieldButton = (
<NewBucketButton
className="lnsConfigPanelAnnotations__addButton"
css={NewBucketButtonStyles}
data-test-subj={`lnsXY-annotation-tooltip-add_field`}
onClick={() => {
setFields([...currentFields, { name: '', id: generateId() }]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,5 @@
"name": "@kbn/event-annotation-components",
"private": true,
"version": "1.0.0",
"license": "Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0",
"sideEffects": [
"*.scss"
]
"license": "Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
},
"include": [
"**/*",
"../../../../../typings/**/*",
],
"exclude": [
"target/**/*"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import React from 'react';
import { EuiColorPaletteDisplay } from '@elastic/eui';
import { css } from '@emotion/react';
import { euiThemeVars } from '@kbn/ui-theme';
import type { AccessorConfig } from './types';

export function PaletteIndicator({ accessorConfig }: { accessorConfig: AccessorConfig }) {
Expand All @@ -25,12 +24,7 @@ export function PaletteIndicator({ accessorConfig }: { accessorConfig: AccessorC
`}
>
<EuiColorPaletteDisplay
className="lnsLayerPanel__palette"
css={css`
height: ${euiThemeVars.euiSizeXS} / 2;
border-radius: 0 0 (${euiThemeVars.euiBorderRadius} - 1px)
(${euiThemeVars.euiBorderRadius} - 1px);

&::after {
border: none;
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { EuiTitle } from '@elastic/eui';
import { EuiTitle, UseEuiTheme } from '@elastic/eui';
import React from 'react';
import './dimension_editor_section.scss';

export const DimensionEditorSection = ({
children,
Expand All @@ -19,14 +18,42 @@ export const DimensionEditorSection = ({
children?: React.ReactNode | React.ReactNode[];
}) => {
return (
<div className="lnsDimensionEditorSection">
<div className="lnsDimensionEditorSection__border" />
<div css={DimensionEditorSectionStyles.self}>
<div css={DimensionEditorSectionStyles.divider} />
{title && (
<EuiTitle size="xxs" className="lnsDimensionEditorSection__heading">
<EuiTitle
size="xxs"
data-test-subj="lnsDimensionEditorSectionHeading"
css={DimensionEditorSectionStyles.heading}
>
<h3>{title}</h3>
</EuiTitle>
)}
{children}
</div>
);
};

const DimensionEditorSectionStyles = {
self: ({ euiTheme }: UseEuiTheme) => `
padding-bottom: ${euiTheme.size.base};
padding-top: ${euiTheme.size.base};
&:first-child {
padding-top: 0;
}
`,
divider: ({ euiTheme }: UseEuiTheme) => `
position: relative;
&:before {
content: '';
position: absolute;
top: -${euiTheme.size.base};
right: -${euiTheme.size.base};
left: -${euiTheme.size.base};
border-top: 1px solid ${euiTheme.colors.lightShade};
}
`,
heading: ({ euiTheme }: UseEuiTheme) => `
padding-bottom: ${euiTheme.size.base};
`,
};
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@ interface NewBucketButtonProps {
label: string;
onClick: () => void;
isDisabled?: boolean;
className?: string;
'data-test-subj'?: string;
}

export const NewBucketButton = ({
label,
onClick,
isDisabled,
className,
'data-test-subj': dataTestSubj = 'lns-newBucket-add',
}: NewBucketButtonProps) => (
<EuiButtonEmpty
Expand All @@ -32,7 +30,6 @@ export const NewBucketButton = ({
onClick={onClick}
isDisabled={isDisabled}
flush="left"
className={className}
>
{label}
</EuiButtonEmpty>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import './field_picker.scss';
import React from 'react';
import { i18n } from '@kbn/i18n';
import classNames from 'classnames';
import { comboBoxFieldOptionMatcher } from '@kbn/field-utils';
import { EuiComboBox, EuiComboBoxOptionOption, EuiComboBoxProps } from '@elastic/eui';
import { EuiComboBox, EuiComboBoxOptionOption, EuiComboBoxProps, useEuiTheme } from '@elastic/eui';
import { FieldIcon } from '@kbn/field-utils/src/components/field_icon';
import { calculateWidthFromCharCount } from '@kbn/calculate-width-from-char-count';
import type { FieldOptionValue, FieldOption } from './types';
Expand Down Expand Up @@ -43,6 +41,7 @@ export function FieldPicker<T extends FieldOptionValue = FieldOptionValue>(
...rest
} = props;

const { euiTheme } = useEuiTheme();
const [selectedOption, setSelectedOption] = React.useState(activeField);

let maxLabelLength = 0;
Expand All @@ -63,10 +62,10 @@ export function FieldPicker<T extends FieldOptionValue = FieldOptionValue>(
className="eui-alignMiddle"
/>
) : null,
className: classNames({
'lnFieldPicker__option--incompatible': !fieldOption.compatible,
'lnFieldPicker__option--nonExistant': !fieldOptionExists,
}),
css: {
color: !fieldOption.compatible ? euiTheme.colors.lightShade : undefined,
backgroundColor: !fieldOptionExists ? euiTheme.colors.lightestShade : undefined,
},
};
}),
};
Expand All @@ -77,10 +76,10 @@ export function FieldPicker<T extends FieldOptionValue = FieldOptionValue>(
prepend: otherAttr.value.dataType ? (
<FieldIcon type={otherAttr.value.dataType} fill="none" className="eui-alignMiddle" />
) : null,
className: classNames({
'lnFieldPicker__option--incompatible': !compatible,
'lnFieldPicker__option--nonExistant': !exists,
}),
css: {
color: !compatible ? euiTheme.colors.lightShade : undefined,
backgroundColor: !exists ? euiTheme.colors.lightestShade : undefined,
},
};
});

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@ import {
EuiFlexGroup,
EuiIconTip,
EuiPopoverProps,
euiTextBreakWord,
useEuiFontSize,
UseEuiTheme,
} from '@elastic/eui';
import type { DataViewBase, Query } from '@kbn/es-query';
import { css } from '@emotion/react';
import { QueryInput, validateQuery } from '.';
import type { QueryInputServices } from '.';
import './filter_query_input.scss';

const filterByLabel = i18n.translate('visualizationUiComponents.filterQueryInput.label', {
defaultMessage: 'Filter by',
Expand All @@ -46,6 +49,13 @@ export interface FilterQueryInputProps {
appName: string;
}

const LinkStyles = ({ euiTheme }: UseEuiTheme) => `
${euiTextBreakWord()};
${useEuiFontSize('s')};
min-height: ${euiTheme.size.xl};
width: 100%;
`;

export function FilterQueryInput({
inputFilter,
onChange,
Expand Down Expand Up @@ -100,6 +110,11 @@ export function FilterQueryInput({
isOpen={filterPopoverOpen}
closePopover={onClosePopup}
display="block"
panelProps={{
css: css`
width: 960px;
`,
}}
panelClassName="filterQueryInput__popover"
initialFocus={dataTestSubj ? `textarea[data-test-subj='${dataTestSubj}']` : undefined}
button={
Expand All @@ -113,6 +128,7 @@ export function FilterQueryInput({
onClick={() => {
setFilterPopoverOpen(!filterPopoverOpen);
}}
css={LinkStyles}
color={isInputFilterValid ? 'text' : 'danger'}
title={i18n.translate(
'visualizationUiComponents.filterQueryInput.clickToEdit',
Expand Down
Loading