Chore: Remove last of the SCSS from grafana/ui (#88302)

* remove last of scss from grafana/ui

* add comment about legacySelect classes
pull/88394/head^2
Ashley Harrison 1 year ago committed by GitHub
parent b4e49e3114
commit ecfe50439b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 31
      .betterer.results
  2. 2
      packages/grafana-ui/src/components/DateTimePickers/TimeOfDayPicker.tsx
  3. 39
      packages/grafana-ui/src/components/DateTimePickers/_TimeOfDayPicker.scss
  4. 207
      packages/grafana-ui/src/components/Forms/Legacy/Select/_Select.scss
  5. 3
      packages/grafana-ui/src/components/index.scss
  6. 24
      packages/grafana-ui/src/components/uPlot/Plot.scss
  7. 2
      packages/grafana-ui/src/components/uPlot/Plot.tsx
  8. 1
      packages/grafana-ui/src/index.scss
  9. 6
      packages/grafana-ui/src/themes/GlobalStyles/GlobalStyles.tsx
  10. 207
      packages/grafana-ui/src/themes/GlobalStyles/legacySelect.ts
  11. 43
      packages/grafana-ui/src/themes/GlobalStyles/rcTimePicker.ts
  12. 27
      packages/grafana-ui/src/themes/GlobalStyles/uPlot.ts
  13. 3
      public/sass/_grafana.scss

@ -5202,6 +5202,37 @@ exports[`no gf-form usage`] = {
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"]
],
"packages/grafana-ui/src/themes/GlobalStyles/legacySelect.ts:5381": [
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"]
],
"public/app/angular/components/code_editor/code_editor.ts:5381": [
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"]
],

@ -10,6 +10,8 @@ import { inputSizes } from '../Forms/commonStyles';
import { FormInputSize } from '../Forms/types';
import { Icon } from '../Icon/Icon';
import 'rc-time-picker/assets/index.css';
export interface Props {
onChange: (value: DateTime) => void;
value?: DateTime;

@ -1,39 +0,0 @@
@import 'rc-time-picker/assets/index.css';
.rc-time-picker-input,
.rc-time-picker-panel-input-wrap,
.rc-time-picker-panel-inner {
background-color: $input-bg;
color: $input-color;
border-color: $input-border-color;
font-size: $font-size-base;
}
.rc-time-picker-input {
padding: $input-padding;
height: $input-height;
}
.rc-time-picker-panel {
width: 176px;
}
.rc-time-picker-panel-select {
width: 50%;
&:only-child {
width: 100%;
}
.rc-time-picker-panel-select-option-selected {
background-color: $menu-dropdown-hover-bg;
}
li:hover {
background-color: $menu-dropdown-hover-bg;
}
}
.rc-time-picker-panel-narrow {
max-width: none;
}

@ -1,207 +0,0 @@
$select-input-height: 32px;
$select-input-bg-disabled: $input-bg-disabled;
@mixin select-control() {
width: 100%;
margin-right: $space-xs;
@include border-radius($input-border-radius);
background-color: $input-bg;
}
@mixin select-control-focus() {
border-color: $input-border-focus;
outline: none;
// prettier-ignore
$shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px $input-box-shadow-focus;
@include box-shadow($shadow);
}
.gf-form-select-box__control {
@include select-control();
border: 1px solid $input-border-color;
color: $input-color;
cursor: default;
height: $select-input-height;
outline: none;
overflow: hidden;
position: relative;
}
.gf-form-select-box__control--is-focused {
background-color: $input-bg;
@include select-control-focus();
}
.gf-form-select-box__control--is-disabled {
background-color: $select-input-bg-disabled;
}
.gf-form-select-box__control--menu-right {
.gf-form-select-box__menu {
right: 0;
left: unset;
}
}
.gf-form-select-box__input {
input {
line-height: inherit;
}
}
.gf-form-select-box__menu {
background: $menu-dropdown-bg;
box-shadow: $menu-dropdown-shadow;
position: absolute;
z-index: $zindex-dropdown;
min-width: 100%;
&-notice--no-options {
background-color: $input-bg;
padding: 10px;
}
}
.gf-form-select-box__menu-list {
overflow-y: auto;
max-height: 300px;
max-width: 600px;
}
.tag-filter .gf-form-select-box__menu {
width: 100%;
}
/* .gf-form-select-box__single-value { */
/* } */
.gf-form-select-box__multi-value {
display: inline;
margin: 0 6px 0 0;
cursor: pointer;
}
.gf-form-select-box__multi-value__remove {
text-align: center;
display: inline-block;
margin-left: 2px;
position: relative;
}
.gf-form-select-box__multi-value__label {
display: inline;
vertical-align: middle;
}
.gf-form-select-box__option {
border-left: 2px solid transparent;
white-space: nowrap;
background-color: $input-bg;
&.gf-form-select-box__option--is-focused {
color: $dropdownLinkColorHover;
background: $menu-dropdown-hover-bg;
@include left-brand-border-gradient();
}
&.gf-form-select-box__option--is-selected {
.fa {
color: $input-color-select-arrow;
}
}
}
.gf-form-select-box__placeholder {
color: $input-color-placeholder;
}
.gf-form-select-box__control--is-focused .gf-form-select-box__placeholder {
display: none;
}
.gf-form-select-box__value-container {
display: inline-block;
padding: 6px 20px 6px 10px;
vertical-align: middle;
> div {
display: inline-block;
vertical-align: middle;
}
}
.gf-form-select-box__indicators {
position: absolute;
height: 100%;
right: 8px;
top: 1px;
display: inline-block;
text-align: right;
}
.gf-form-input--form-dropdown {
padding: 0;
border: 0;
overflow: visible;
position: relative;
}
.gf-form--has-input-icon {
.gf-form-select-box__value-container {
padding-left: 30px;
}
}
.gf-form-select-box__desc-option {
display: flex;
align-items: center;
justify-content: flex-start;
justify-items: center;
cursor: pointer;
padding: 7px 10px;
width: 100%;
}
.gf-form-select-box__desc-option__body {
display: flex;
flex-direction: column;
flex-grow: 1;
padding-right: 10px;
font-weight: $font-weight-semi-bold;
}
.gf-form-select-box__desc-option__desc {
font-weight: normal;
font-size: $font-size-sm;
color: $text-muted;
}
.gf-form-select-box__desc-option__img {
width: 16px;
margin-right: 10px;
}
.gf-form-select-box__option-group__header {
display: flex;
align-items: center;
justify-content: flex-start;
justify-items: center;
cursor: pointer;
padding: 7px 10px;
width: 100%;
border-bottom: 1px solid $hr-border-color;
text-transform: capitalize;
.fa {
padding-right: 2px;
}
}
.gf-form-select-box-button-select {
height: auto;
}
.select-button {
display: flex;
align-items: center;
}

@ -1,3 +0,0 @@
@import 'Forms/Legacy/Select/Select';
@import 'DateTimePickers/TimeOfDayPicker';
@import 'uPlot/Plot';

@ -1,24 +0,0 @@
// importing the uPlot css so it will be bundled with the rest of the styling.
@import 'uplot/dist/uPlot.min.css';
.uplot {
font-family: inherit;
}
.u-select {
background: rgba(120, 120, 130, 0.2);
}
.u-hz .u-cursor-x,
.u-vt .u-cursor-y {
border-right: 1px dashed rgba(120, 120, 130, 0.5);
}
.u-hz .u-cursor-y,
.u-vt .u-cursor-x {
border-bottom: 1px dashed rgba(120, 120, 130, 0.5);
}
.shared-crosshair:not(.plot-active) .u-cursor-pt {
display: none !important;
}

@ -4,6 +4,8 @@ import uPlot, { AlignedData, Options } from 'uplot';
import { PlotProps } from './types';
import { pluginLog } from './utils';
import 'uplot/dist/uPlot.min.css';
function sameDims(prevProps: PlotProps, nextProps: PlotProps) {
return nextProps.width === prevProps.width && nextProps.height === prevProps.height;
}

@ -1 +0,0 @@
@import 'components/index';

@ -8,9 +8,12 @@ import { getCardStyles } from './card';
import { getElementStyles } from './elements';
import { getExtraStyles } from './extra';
import { getFormElementStyles } from './forms';
import { getLegacySelectStyles } from './legacySelect';
import { getMarkdownStyles } from './markdownStyles';
import { getPageStyles } from './page';
import { getRcTimePickerStyles } from './rcTimePicker';
import { getSkeletonStyles } from './skeletonStyles';
import { getUplotStyles } from './uPlot';
/** @internal */
export function GlobalStyles() {
@ -27,6 +30,9 @@ export function GlobalStyles() {
getAgularPanelStyles(theme),
getMarkdownStyles(theme),
getSkeletonStyles(theme),
getRcTimePickerStyles(theme),
getUplotStyles(theme),
getLegacySelectStyles(theme),
]}
/>
);

@ -0,0 +1,207 @@
// some plugins depend on these classes
// TODO we should aim to remove this for Grafana 12
import { css } from '@emotion/react';
import { GrafanaTheme2 } from '@grafana/data';
export function getLegacySelectStyles(theme: GrafanaTheme2) {
return css({
'.gf-form-select-box__control': {
width: '100%',
marginRight: theme.spacing(0.5),
backgroundColor: theme.components.input.background,
border: `1px solid ${theme.components.input.borderColor}`,
borderRadius: theme.shape.radius.default,
color: theme.components.input.text,
cursor: 'default',
height: theme.spacing(4),
outline: 'none',
overflow: 'hidden',
position: 'relative',
},
'.gf-form-select-box__control--is-focused': {
backgroundColor: theme.components.input.background,
borderColor: theme.colors.primary.border,
outline: 'none',
boxShadow: `inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px ${theme.colors.primary.border}`,
},
'.gf-form-select-box__control--is-disabled': {
backgroundColor: theme.colors.action.disabledBackground,
},
'.gf-form-select-box__control--menu-right': {
'.gf-form-select-box__menu': {
right: 0,
left: 'unset',
},
},
'.gf-form-select-box__input': {
input: {
lineHeight: 'inherit',
},
},
'.gf-form-select-box__menu': {
background: theme.colors.background.primary,
boxShadow: theme.shadows.z3,
position: 'absolute',
zIndex: theme.zIndex.dropdown,
minWidth: '100%',
'&-notice--no-options': {
backgroundColor: theme.components.input.background,
padding: '10px',
},
},
'.gf-form-select-box__menu-list': {
overflowY: 'auto',
maxHeight: '300px',
maxWidth: '600px',
},
'.tag-filter .gf-form-select-box__menu': {
width: '100%',
},
'.gf-form-select-box__multi-value': {
display: 'inline',
margin: '0 6px 0 0',
cursor: 'pointer',
},
'.gf-form-select-box__multi-value__remove': {
textAlign: 'center',
display: 'inline-block',
marginLeft: '2px',
position: 'relative',
},
'.gf-form-select-box__multi-value__label': {
display: 'inline',
verticalAlign: 'middle',
},
'.gf-form-select-box__option': {
borderLeft: '2px solid transparent',
whiteSpace: 'nowrap',
backgroundColor: theme.components.input.background,
'&.gf-form-select-box__option--is-focused': {
color: theme.colors.text.primary,
background: theme.colors.action.hover,
borderImage: theme.colors.gradients.brandVertical,
borderImageSlice: 1,
borderStyle: 'solid',
borderTop: 0,
borderRight: 0,
borderBottom: 0,
borderLeftWidth: '2px',
},
'&.gf-form-select-box__option--is-selected': {
'.fa': {
color: theme.colors.text.primary,
},
},
},
'.gf-form-select-box__placeholder': {
color: theme.colors.text.disabled,
},
'.gf-form-select-box__control--is-focused .gf-form-select-box__placeholder': {
display: 'none',
},
'.gf-form-select-box__value-container': {
display: 'inline-block',
padding: '6px 20px 6px 10px',
verticalAlign: 'middle',
'> div': {
display: 'inline-block',
verticalAlign: 'middle',
},
},
'.gf-form-select-box__indicators': {
position: 'absolute',
height: '100%',
right: '8px',
top: '1px',
display: 'inline-block',
textAlign: 'right',
},
'.gf-form-input--form-dropdown': {
padding: 0,
border: 0,
overflow: 'visible',
position: 'relative',
},
'.gf-form--has-input-icon': {
'.gf-form-select-box__value-container': {
paddingLeft: '30px',
},
},
'.gf-form-select-box__desc-option': {
display: 'flex',
alignItems: 'center',
justifyContent: 'flex-start',
justifyItems: 'center',
cursor: 'pointer',
padding: '7px 10px',
width: '100%',
},
'.gf-form-select-box__desc-option__body': {
display: 'flex',
flexDirection: 'column',
flexGrow: 1,
paddingRight: '10px',
fontWeight: theme.typography.fontWeightMedium,
},
'.gf-form-select-box__desc-option__desc': {
fontWeight: 'normal',
fontSize: theme.typography.bodySmall.fontSize,
color: theme.colors.text.secondary,
},
'.gf-form-select-box__desc-option__img': {
width: '16px',
marginRight: '10px',
},
'.gf-form-select-box__option-group__header': {
display: 'flex',
alignItems: 'center',
justifyContent: 'flex-start',
justifyItems: 'center',
cursor: 'pointer',
padding: '7px 10px',
width: '100%',
borderBottom: `1px solid ${theme.v1.palette.dark9}`,
textTransform: 'capitalize',
'.fa': {
paddingRight: '2px',
},
},
'.gf-form-select-box-button-select': {
height: 'auto',
},
'.select-button': {
display: 'flex',
alignItems: 'center',
},
});
}

@ -0,0 +1,43 @@
import { css } from '@emotion/react';
import { GrafanaTheme2 } from '@grafana/data';
export function getRcTimePickerStyles(theme: GrafanaTheme2) {
return css({
'.rc-time-picker-input,.rc-time-picker-panel-input-wrap,.rc-time-picker-panel-inner': {
backgroundColor: theme.components.input.background,
color: theme.colors.text.secondary,
borderColor: theme.components.input.borderColor,
fontSize: theme.typography.body.fontSize,
},
'.rc-time-picker-input': {
padding: theme.spacing(0, 1),
height: theme.spacing(4),
},
'.rc-time-picker-panel': {
width: '176px',
},
'.rc-time-picker-panel-select': {
width: '50%',
'&:only-child': {
width: '100%',
},
'.rc-time-picker-panel-select-option-selected': {
backgroundColor: theme.colors.background.secondary,
},
'li:hover': {
backgroundColor: theme.colors.background.secondary,
},
},
'.rc-time-picker-panel-narrow': {
maxWidth: 'none',
},
});
}

@ -0,0 +1,27 @@
import { css } from '@emotion/react';
import { GrafanaTheme2 } from '@grafana/data';
export function getUplotStyles(theme: GrafanaTheme2) {
return css({
'.uplot': {
fontFamily: 'inherit',
},
'.u-select': {
background: 'rgba(120, 120, 130, 0.2)',
},
'.u-hz .u-cursor-x, .u-vt .u-cursor-y': {
borderRight: '1px dashed rgba(120, 120, 130, 0.5)',
},
'.u-hz .u-cursor-y, .u-vt .u-cursor-x': {
borderBottom: '1px dashed rgba(120, 120, 130, 0.5)',
},
'.shared-crosshair:not(.plot-active) .u-cursor-pt': {
display: 'none !important',
},
});
}

@ -50,9 +50,6 @@
@import 'components/add_data_source';
@import 'components/panel_header';
// LOAD @grafana/ui components
@import '@grafana/ui/src/index';
// PAGES
@import 'pages/dashboard';
@import 'pages/alerting';

Loading…
Cancel
Save