mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Theme: Renames new theme model from GrafanaThemeV2 to just GrafanaTheme (#33619)
This commit is contained in:
parent
b165bfabc1
commit
7ee994f843
@ -9,7 +9,7 @@ import { getMappedValue } from '../utils/valueMappings';
|
|||||||
import { dateTime } from '../datetime';
|
import { dateTime } from '../datetime';
|
||||||
import { KeyValue, TimeZone } from '../types';
|
import { KeyValue, TimeZone } from '../types';
|
||||||
import { getScaleCalculator } from './scale';
|
import { getScaleCalculator } from './scale';
|
||||||
import { GrafanaThemeV2 } from '../themes/types';
|
import { GrafanaTheme2 } from '../themes/types';
|
||||||
|
|
||||||
interface DisplayProcessorOptions {
|
interface DisplayProcessorOptions {
|
||||||
field: Partial<Field>;
|
field: Partial<Field>;
|
||||||
@ -20,7 +20,7 @@ interface DisplayProcessorOptions {
|
|||||||
/**
|
/**
|
||||||
* Will pick 'dark' if not defined
|
* Will pick 'dark' if not defined
|
||||||
*/
|
*/
|
||||||
theme: GrafanaThemeV2;
|
theme: GrafanaTheme2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reasonable units for time
|
// Reasonable units for time
|
||||||
|
@ -5,14 +5,14 @@ import { interpolateRgbBasis } from 'd3-interpolate';
|
|||||||
import { fallBackTreshold } from './thresholds';
|
import { fallBackTreshold } from './thresholds';
|
||||||
import { getScaleCalculator, ColorScaleValue } from './scale';
|
import { getScaleCalculator, ColorScaleValue } from './scale';
|
||||||
import { reduceField } from '../transformations/fieldReducer';
|
import { reduceField } from '../transformations/fieldReducer';
|
||||||
import { GrafanaThemeV2 } from '../themes/types';
|
import { GrafanaTheme2 } from '../themes/types';
|
||||||
|
|
||||||
/** @beta */
|
/** @beta */
|
||||||
export type FieldValueColorCalculator = (value: number, percent: number, Threshold?: Threshold) => string;
|
export type FieldValueColorCalculator = (value: number, percent: number, Threshold?: Threshold) => string;
|
||||||
|
|
||||||
/** @beta */
|
/** @beta */
|
||||||
export interface FieldColorMode extends RegistryItem {
|
export interface FieldColorMode extends RegistryItem {
|
||||||
getCalculator: (field: Field, theme: GrafanaThemeV2) => FieldValueColorCalculator;
|
getCalculator: (field: Field, theme: GrafanaTheme2) => FieldValueColorCalculator;
|
||||||
colors?: string[];
|
colors?: string[];
|
||||||
isContinuous?: boolean;
|
isContinuous?: boolean;
|
||||||
isByValue?: boolean;
|
isByValue?: boolean;
|
||||||
@ -167,7 +167,7 @@ export class FieldColorSchemeMode implements FieldColorMode {
|
|||||||
this.isByValue = options.isByValue;
|
this.isByValue = options.isByValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
private getColors(theme: GrafanaThemeV2) {
|
private getColors(theme: GrafanaTheme2) {
|
||||||
if (this.colorCache) {
|
if (this.colorCache) {
|
||||||
return this.colorCache;
|
return this.colorCache;
|
||||||
}
|
}
|
||||||
@ -184,7 +184,7 @@ export class FieldColorSchemeMode implements FieldColorMode {
|
|||||||
return this.interpolator;
|
return this.interpolator;
|
||||||
}
|
}
|
||||||
|
|
||||||
getCalculator(field: Field, theme: GrafanaThemeV2) {
|
getCalculator(field: Field, theme: GrafanaTheme2) {
|
||||||
const colors = this.getColors(theme);
|
const colors = this.getColors(theme);
|
||||||
|
|
||||||
if (this.isByValue) {
|
if (this.isByValue) {
|
||||||
@ -222,7 +222,7 @@ export function getFieldColorMode(mode?: FieldColorModeId | string): FieldColorM
|
|||||||
* Function that will return a series color for any given color mode. If the color mode is a by value color
|
* Function that will return a series color for any given color mode. If the color mode is a by value color
|
||||||
* mode it will use the field.config.color.seriesBy property to figure out which value to use
|
* mode it will use the field.config.color.seriesBy property to figure out which value to use
|
||||||
*/
|
*/
|
||||||
export function getFieldSeriesColor(field: Field, theme: GrafanaThemeV2): ColorScaleValue {
|
export function getFieldSeriesColor(field: Field, theme: GrafanaTheme2): ColorScaleValue {
|
||||||
const mode = getFieldColorModeForField(field);
|
const mode = getFieldColorModeForField(field);
|
||||||
|
|
||||||
if (!mode.isByValue) {
|
if (!mode.isByValue) {
|
||||||
@ -241,7 +241,7 @@ export function getFieldSeriesColor(field: Field, theme: GrafanaThemeV2): ColorS
|
|||||||
return scale(value);
|
return scale(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFixedColor(field: Field, theme: GrafanaThemeV2) {
|
function getFixedColor(field: Field, theme: GrafanaTheme2) {
|
||||||
return () => {
|
return () => {
|
||||||
return getColorForTheme(field.config.color?.fixedColor ?? FALLBACK_COLOR, theme.v1);
|
return getColorForTheme(field.config.color?.fixedColor ?? FALLBACK_COLOR, theme.v1);
|
||||||
};
|
};
|
||||||
|
@ -15,7 +15,7 @@ import {
|
|||||||
TimeZone,
|
TimeZone,
|
||||||
} from '../types';
|
} from '../types';
|
||||||
import { DataFrameView } from '../dataframe/DataFrameView';
|
import { DataFrameView } from '../dataframe/DataFrameView';
|
||||||
import { GrafanaThemeV2 } from '../themes';
|
import { GrafanaTheme2 } from '../themes';
|
||||||
import { reduceField, ReducerID } from '../transformations/fieldReducer';
|
import { reduceField, ReducerID } from '../transformations/fieldReducer';
|
||||||
import { ScopedVars } from '../types/ScopedVars';
|
import { ScopedVars } from '../types/ScopedVars';
|
||||||
import { getTimeField } from '../dataframe/processDataFrame';
|
import { getTimeField } from '../dataframe/processDataFrame';
|
||||||
@ -71,7 +71,7 @@ export interface GetFieldDisplayValuesOptions {
|
|||||||
fieldConfig: FieldConfigSource;
|
fieldConfig: FieldConfigSource;
|
||||||
replaceVariables: InterpolateFunction;
|
replaceVariables: InterpolateFunction;
|
||||||
sparkline?: boolean; // Calculate the sparkline
|
sparkline?: boolean; // Calculate the sparkline
|
||||||
theme: GrafanaThemeV2;
|
theme: GrafanaTheme2;
|
||||||
timeZone?: TimeZone;
|
timeZone?: TimeZone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { isNumber } from 'lodash';
|
import { isNumber } from 'lodash';
|
||||||
import { GrafanaThemeV2 } from '../themes/types';
|
import { GrafanaTheme2 } from '../themes/types';
|
||||||
import { reduceField, ReducerID } from '../transformations/fieldReducer';
|
import { reduceField, ReducerID } from '../transformations/fieldReducer';
|
||||||
import { Field, FieldConfig, FieldType, NumericRange, Threshold } from '../types';
|
import { Field, FieldConfig, FieldType, NumericRange, Threshold } from '../types';
|
||||||
import { getFieldColorModeForField } from './fieldColor';
|
import { getFieldColorModeForField } from './fieldColor';
|
||||||
@ -13,7 +13,7 @@ export interface ColorScaleValue {
|
|||||||
|
|
||||||
export type ScaleCalculator = (value: number) => ColorScaleValue;
|
export type ScaleCalculator = (value: number) => ColorScaleValue;
|
||||||
|
|
||||||
export function getScaleCalculator(field: Field, theme: GrafanaThemeV2): ScaleCalculator {
|
export function getScaleCalculator(field: Field, theme: GrafanaTheme2): ScaleCalculator {
|
||||||
const mode = getFieldColorModeForField(field);
|
const mode = getFieldColorModeForField(field);
|
||||||
const getColor = mode.getCalculator(field, theme);
|
const getColor = mode.getCalculator(field, theme);
|
||||||
const info = field.state?.range ?? getMinMaxAndDelta(field);
|
const info = field.state?.range ?? getMinMaxAndDelta(field);
|
||||||
|
@ -7,7 +7,7 @@ import { createSpacing, ThemeSpacingOptions } from './createSpacing';
|
|||||||
import { createTransitions } from './createTransitions';
|
import { createTransitions } from './createTransitions';
|
||||||
import { createTypography, ThemeTypographyInput } from './createTypography';
|
import { createTypography, ThemeTypographyInput } from './createTypography';
|
||||||
import { createV1Theme } from './createV1Theme';
|
import { createV1Theme } from './createV1Theme';
|
||||||
import { GrafanaThemeV2 } from './types';
|
import { GrafanaTheme2 } from './types';
|
||||||
import { zIndex } from './zIndex';
|
import { zIndex } from './zIndex';
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
@ -20,7 +20,7 @@ export interface NewThemeOptions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export function createTheme(options: NewThemeOptions = {}): GrafanaThemeV2 {
|
export function createTheme(options: NewThemeOptions = {}): GrafanaTheme2 {
|
||||||
const {
|
const {
|
||||||
name = 'Dark',
|
name = 'Dark',
|
||||||
colors: colorsInput = {},
|
colors: colorsInput = {},
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { GrafanaTheme, GrafanaThemeCommons, GrafanaThemeType } from '../types';
|
import { GrafanaTheme, GrafanaThemeCommons, GrafanaThemeType } from '../types';
|
||||||
import { GrafanaThemeV2 } from './types';
|
import { GrafanaTheme2 } from './types';
|
||||||
|
|
||||||
export function createV1Theme(theme: Omit<GrafanaThemeV2, 'v1'>): GrafanaTheme {
|
export function createV1Theme(theme: Omit<GrafanaTheme2, 'v1'>): GrafanaTheme {
|
||||||
const oldCommon: GrafanaThemeCommons = {
|
const oldCommon: GrafanaThemeCommons = {
|
||||||
name: 'Grafana Default',
|
name: 'Grafana Default',
|
||||||
typography: {
|
typography: {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
export { createTheme } from './createTheme';
|
export { createTheme } from './createTheme';
|
||||||
export { ThemeRichColor, GrafanaThemeV2 } from './types';
|
export { ThemeRichColor, GrafanaTheme2 } from './types';
|
||||||
export { ThemeColors } from './createColors';
|
export { ThemeColors } from './createColors';
|
||||||
export { ThemeBreakpoints, ThemeBreakpointsKey } from './breakpoints';
|
export { ThemeBreakpoints, ThemeBreakpointsKey } from './breakpoints';
|
||||||
export { ThemeShadows } from './createShadows';
|
export { ThemeShadows } from './createShadows';
|
||||||
|
@ -9,8 +9,11 @@ import { ThemeTransitions } from './createTransitions';
|
|||||||
import { ThemeTypography } from './createTypography';
|
import { ThemeTypography } from './createTypography';
|
||||||
import { ThemeZIndices } from './zIndex';
|
import { ThemeZIndices } from './zIndex';
|
||||||
|
|
||||||
/** @beta */
|
/**
|
||||||
export interface GrafanaThemeV2 {
|
* @beta
|
||||||
|
* Next gen theme model introduced in Grafana v8.
|
||||||
|
*/
|
||||||
|
export interface GrafanaTheme2 {
|
||||||
name: string;
|
name: string;
|
||||||
isDark: boolean;
|
isDark: boolean;
|
||||||
isLight: boolean;
|
isLight: boolean;
|
||||||
|
@ -2,7 +2,7 @@ import { DataSourceInstanceSettings } from './datasource';
|
|||||||
import { PanelPluginMeta } from './panel';
|
import { PanelPluginMeta } from './panel';
|
||||||
import { GrafanaTheme } from './theme';
|
import { GrafanaTheme } from './theme';
|
||||||
import { SystemDateFormatSettings } from '../datetime';
|
import { SystemDateFormatSettings } from '../datetime';
|
||||||
import { GrafanaThemeV2 } from '../themes';
|
import { GrafanaTheme2 } from '../themes';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Describes the build information that will be available via the Grafana configuration.
|
* Describes the build information that will be available via the Grafana configuration.
|
||||||
@ -124,7 +124,7 @@ export interface GrafanaConfig {
|
|||||||
editorsCanAdmin: boolean;
|
editorsCanAdmin: boolean;
|
||||||
disableSanitizeHtml: boolean;
|
disableSanitizeHtml: boolean;
|
||||||
theme: GrafanaTheme;
|
theme: GrafanaTheme;
|
||||||
theme2: GrafanaThemeV2;
|
theme2: GrafanaTheme2;
|
||||||
pluginsToPreload: string[];
|
pluginsToPreload: string[];
|
||||||
featureToggles: FeatureToggles;
|
featureToggles: FeatureToggles;
|
||||||
licenseInfo: LicenseInfo;
|
licenseInfo: LicenseInfo;
|
||||||
|
@ -4,7 +4,7 @@ import { InterpolateFunction } from './panel';
|
|||||||
import { StandardEditorProps, FieldConfigOptionsRegistry, StandardEditorContext } from '../field';
|
import { StandardEditorProps, FieldConfigOptionsRegistry, StandardEditorContext } from '../field';
|
||||||
import { OptionsEditorItem } from './OptionsUIRegistryBuilder';
|
import { OptionsEditorItem } from './OptionsUIRegistryBuilder';
|
||||||
import { OptionEditorConfig } from './options';
|
import { OptionEditorConfig } from './options';
|
||||||
import { GrafanaThemeV2 } from '../themes';
|
import { GrafanaTheme2 } from '../themes';
|
||||||
|
|
||||||
export interface DynamicConfigValue {
|
export interface DynamicConfigValue {
|
||||||
id: string;
|
id: string;
|
||||||
@ -114,7 +114,7 @@ export interface ApplyFieldOverrideOptions {
|
|||||||
fieldConfig: FieldConfigSource;
|
fieldConfig: FieldConfigSource;
|
||||||
fieldConfigRegistry?: FieldConfigOptionsRegistry;
|
fieldConfigRegistry?: FieldConfigOptionsRegistry;
|
||||||
replaceVariables: InterpolateFunction;
|
replaceVariables: InterpolateFunction;
|
||||||
theme: GrafanaThemeV2;
|
theme: GrafanaTheme2;
|
||||||
timeZone?: TimeZone;
|
timeZone?: TimeZone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import {
|
|||||||
FeatureToggles,
|
FeatureToggles,
|
||||||
GrafanaConfig,
|
GrafanaConfig,
|
||||||
GrafanaTheme,
|
GrafanaTheme,
|
||||||
GrafanaThemeV2,
|
GrafanaTheme2,
|
||||||
LicenseInfo,
|
LicenseInfo,
|
||||||
PanelPluginMeta,
|
PanelPluginMeta,
|
||||||
systemDateFormats,
|
systemDateFormats,
|
||||||
@ -50,7 +50,7 @@ export class GrafanaBootConfig implements GrafanaConfig {
|
|||||||
editorsCanAdmin = false;
|
editorsCanAdmin = false;
|
||||||
disableSanitizeHtml = false;
|
disableSanitizeHtml = false;
|
||||||
theme: GrafanaTheme;
|
theme: GrafanaTheme;
|
||||||
theme2: GrafanaThemeV2;
|
theme2: GrafanaTheme2;
|
||||||
pluginsToPreload: string[] = [];
|
pluginsToPreload: string[] = [];
|
||||||
featureToggles: FeatureToggles = {
|
featureToggles: FeatureToggles = {
|
||||||
live: false,
|
live: false,
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { GrafanaThemeV2, createTheme } from '@grafana/data';
|
import { GrafanaTheme2, createTheme } from '@grafana/data';
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
import { create } from '@storybook/theming/create';
|
import { create } from '@storybook/theming/create';
|
||||||
import '../src/components/Icon/iconBundle';
|
import '../src/components/Icon/iconBundle';
|
||||||
|
|
||||||
const createStorybookTheme = (theme: GrafanaThemeV2) => {
|
const createStorybookTheme = (theme: GrafanaTheme2) => {
|
||||||
return create({
|
return create({
|
||||||
base: theme.name.includes('Light') ? 'light' : 'dark',
|
base: theme.name.includes('Light') ? 'light' : 'dark',
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React, { HTMLAttributes, ReactNode } from 'react';
|
import React, { HTMLAttributes, ReactNode } from 'react';
|
||||||
import { css, cx } from '@emotion/css';
|
import { css, cx } from '@emotion/css';
|
||||||
import { GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { selectors } from '@grafana/e2e-selectors';
|
import { selectors } from '@grafana/e2e-selectors';
|
||||||
import { useTheme2 } from '../../themes';
|
import { useTheme2 } from '../../themes';
|
||||||
import { Icon } from '../Icon/Icon';
|
import { Icon } from '../Icon/Icon';
|
||||||
@ -77,7 +77,7 @@ export const Alert = React.forwardRef<HTMLDivElement, Props>(
|
|||||||
|
|
||||||
Alert.displayName = 'Alert';
|
Alert.displayName = 'Alert';
|
||||||
|
|
||||||
const getStyles = (theme: GrafanaThemeV2, severity: AlertVariant, elevated?: boolean, bottomSpacing?: number) => {
|
const getStyles = (theme: GrafanaTheme2, severity: AlertVariant, elevated?: boolean, bottomSpacing?: number) => {
|
||||||
const color = theme.colors[severity];
|
const color = theme.colors[severity];
|
||||||
const borderRadius = theme.shape.borderRadius();
|
const borderRadius = theme.shape.borderRadius();
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import {
|
|||||||
getFieldColorModeForField,
|
getFieldColorModeForField,
|
||||||
getFieldDisplayName,
|
getFieldDisplayName,
|
||||||
getFieldSeriesColor,
|
getFieldSeriesColor,
|
||||||
GrafanaThemeV2,
|
GrafanaTheme2,
|
||||||
MutableDataFrame,
|
MutableDataFrame,
|
||||||
VizOrientation,
|
VizOrientation,
|
||||||
} from '@grafana/data';
|
} from '@grafana/data';
|
||||||
@ -18,7 +18,7 @@ import { FIXED_UNIT } from '../GraphNG/GraphNG';
|
|||||||
/** @alpha */
|
/** @alpha */
|
||||||
export function preparePlotConfigBuilder(
|
export function preparePlotConfigBuilder(
|
||||||
data: DataFrame,
|
data: DataFrame,
|
||||||
theme: GrafanaThemeV2,
|
theme: GrafanaTheme2,
|
||||||
{ orientation, showValue, groupWidth, barWidth }: BarChartOptions
|
{ orientation, showValue, groupWidth, barWidth }: BarChartOptions
|
||||||
) {
|
) {
|
||||||
const builder = new UPlotConfigBuilder();
|
const builder = new UPlotConfigBuilder();
|
||||||
|
@ -3,7 +3,7 @@ import { css, CSSObject, cx } from '@emotion/css';
|
|||||||
import { useTheme2 } from '../../themes';
|
import { useTheme2 } from '../../themes';
|
||||||
import { IconName } from '../../types/icon';
|
import { IconName } from '../../types/icon';
|
||||||
import { getPropertiesForButtonSize } from '../Forms/commonStyles';
|
import { getPropertiesForButtonSize } from '../Forms/commonStyles';
|
||||||
import { colorManipulator, GrafanaThemeV2, ThemeRichColor } from '@grafana/data';
|
import { colorManipulator, GrafanaTheme2, ThemeRichColor } from '@grafana/data';
|
||||||
import { ComponentSize } from '../../types/size';
|
import { ComponentSize } from '../../types/size';
|
||||||
import { getFocusStyles, getMouseFocusStyles } from '../../themes/mixins';
|
import { getFocusStyles, getMouseFocusStyles } from '../../themes/mixins';
|
||||||
import { Icon } from '../Icon/Icon';
|
import { Icon } from '../Icon/Icon';
|
||||||
@ -105,7 +105,7 @@ export interface StyleProps {
|
|||||||
variant: ButtonVariant;
|
variant: ButtonVariant;
|
||||||
fill?: ButtonFill;
|
fill?: ButtonFill;
|
||||||
iconOnly?: boolean;
|
iconOnly?: boolean;
|
||||||
theme: GrafanaThemeV2;
|
theme: GrafanaTheme2;
|
||||||
fullWidth?: boolean;
|
fullWidth?: boolean;
|
||||||
narrow?: boolean;
|
narrow?: boolean;
|
||||||
}
|
}
|
||||||
@ -163,7 +163,7 @@ export const getButtonStyles = (props: StyleProps) => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
function getButtonVariantStyles(theme: GrafanaThemeV2, color: ThemeRichColor, fill: ButtonFill): CSSObject {
|
function getButtonVariantStyles(theme: GrafanaTheme2, color: ThemeRichColor, fill: ButtonFill): CSSObject {
|
||||||
if (fill === 'outline') {
|
if (fill === 'outline') {
|
||||||
return {
|
return {
|
||||||
background: 'transparent',
|
background: 'transparent',
|
||||||
@ -218,7 +218,7 @@ function getButtonVariantStyles(theme: GrafanaThemeV2, color: ThemeRichColor, fi
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPropertiesForDisabled(theme: GrafanaThemeV2, variant: ButtonVariant, fill: ButtonFill) {
|
function getPropertiesForDisabled(theme: GrafanaTheme2, variant: ButtonVariant, fill: ButtonFill) {
|
||||||
const disabledStyles: CSSObject = {
|
const disabledStyles: CSSObject = {
|
||||||
cursor: 'not-allowed',
|
cursor: 'not-allowed',
|
||||||
boxShadow: 'none',
|
boxShadow: 'none',
|
||||||
@ -250,7 +250,7 @@ function getPropertiesForDisabled(theme: GrafanaThemeV2, variant: ButtonVariant,
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getPropertiesForVariant(theme: GrafanaThemeV2, variant: ButtonVariant, fill: ButtonFill) {
|
export function getPropertiesForVariant(theme: GrafanaTheme2, variant: ButtonVariant, fill: ButtonFill) {
|
||||||
const buttonVariant = variant === 'link' ? 'primary' : variant;
|
const buttonVariant = variant === 'link' ? 'primary' : variant;
|
||||||
const buttonFill = variant === 'link' ? 'text' : fill;
|
const buttonFill = variant === 'link' ? 'text' : fill;
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React, { forwardRef, HTMLAttributes } from 'react';
|
import React, { forwardRef, HTMLAttributes } from 'react';
|
||||||
import { css, cx } from '@emotion/css';
|
import { css, cx } from '@emotion/css';
|
||||||
import { useStyles2 } from '../../themes';
|
import { useStyles2 } from '../../themes';
|
||||||
import { GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
|
|
||||||
export interface Props extends HTMLAttributes<HTMLDivElement> {
|
export interface Props extends HTMLAttributes<HTMLDivElement> {
|
||||||
className?: string;
|
className?: string;
|
||||||
@ -19,7 +19,7 @@ export const ButtonGroup = forwardRef<HTMLDivElement, Props>(({ className, child
|
|||||||
|
|
||||||
ButtonGroup.displayName = 'ButtonGroup';
|
ButtonGroup.displayName = 'ButtonGroup';
|
||||||
|
|
||||||
const getStyles = (theme: GrafanaThemeV2) => ({
|
const getStyles = (theme: GrafanaTheme2) => ({
|
||||||
wrapper: css`
|
wrapper: css`
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React, { forwardRef, ButtonHTMLAttributes } from 'react';
|
import React, { forwardRef, ButtonHTMLAttributes } from 'react';
|
||||||
import { cx, css } from '@emotion/css';
|
import { cx, css } from '@emotion/css';
|
||||||
import { GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { styleMixins, useStyles2 } from '../../themes';
|
import { styleMixins, useStyles2 } from '../../themes';
|
||||||
import { IconName } from '../../types/icon';
|
import { IconName } from '../../types/icon';
|
||||||
import { Tooltip } from '../Tooltip/Tooltip';
|
import { Tooltip } from '../Tooltip/Tooltip';
|
||||||
@ -104,7 +104,7 @@ function renderIcon(icon: IconName | React.ReactNode) {
|
|||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
const getStyles = (theme: GrafanaThemeV2) => {
|
const getStyles = (theme: GrafanaTheme2) => {
|
||||||
const primaryVariant = getPropertiesForVariant(theme, 'primary', 'solid');
|
const primaryVariant = getPropertiesForVariant(theme, 'primary', 'solid');
|
||||||
const destructiveVariant = getPropertiesForVariant(theme, 'destructive', 'solid');
|
const destructiveVariant = getPropertiesForVariant(theme, 'destructive', 'solid');
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React, { forwardRef, HTMLAttributes } from 'react';
|
import React, { forwardRef, HTMLAttributes } from 'react';
|
||||||
import { css, cx } from '@emotion/css';
|
import { css, cx } from '@emotion/css';
|
||||||
import { useStyles2 } from '../../themes';
|
import { useStyles2 } from '../../themes';
|
||||||
import { GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
|
|
||||||
export interface Props extends HTMLAttributes<HTMLDivElement> {
|
export interface Props extends HTMLAttributes<HTMLDivElement> {
|
||||||
className?: string;
|
className?: string;
|
||||||
@ -19,7 +19,7 @@ export const ToolbarButtonRow = forwardRef<HTMLDivElement, Props>(({ className,
|
|||||||
|
|
||||||
ToolbarButtonRow.displayName = 'ToolbarButtonRow';
|
ToolbarButtonRow.displayName = 'ToolbarButtonRow';
|
||||||
|
|
||||||
const getStyles = (theme: GrafanaThemeV2) => ({
|
const getStyles = (theme: GrafanaTheme2) => ({
|
||||||
wrapper: css`
|
wrapper: css`
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ import RCCascader from 'rc-cascader';
|
|||||||
import { CascaderOption } from '../Cascader/Cascader';
|
import { CascaderOption } from '../Cascader/Cascader';
|
||||||
import { onChangeCascader, onLoadDataCascader } from '../Cascader/optionMappings';
|
import { onChangeCascader, onLoadDataCascader } from '../Cascader/optionMappings';
|
||||||
import { stylesFactory, useTheme2 } from '../../themes';
|
import { stylesFactory, useTheme2 } from '../../themes';
|
||||||
import { GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
|
|
||||||
export interface ButtonCascaderProps {
|
export interface ButtonCascaderProps {
|
||||||
options: CascaderOption[];
|
options: CascaderOption[];
|
||||||
@ -23,7 +23,7 @@ export interface ButtonCascaderProps {
|
|||||||
className?: string;
|
className?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const getStyles = stylesFactory((theme: GrafanaThemeV2) => {
|
const getStyles = stylesFactory((theme: GrafanaTheme2) => {
|
||||||
return {
|
return {
|
||||||
popup: css`
|
popup: css`
|
||||||
label: popup;
|
label: popup;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { css, cx } from '@emotion/css';
|
import { css, cx } from '@emotion/css';
|
||||||
import { useStyles2 } from '../../themes/ThemeContext';
|
import { useStyles2 } from '../../themes/ThemeContext';
|
||||||
import { GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
|
|
||||||
export interface CallToActionCardProps {
|
export interface CallToActionCardProps {
|
||||||
message?: string | JSX.Element;
|
message?: string | JSX.Element;
|
||||||
@ -27,7 +27,7 @@ export const CallToActionCard: React.FunctionComponent<CallToActionCardProps> =
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const getStyles = (theme: GrafanaThemeV2) => ({
|
const getStyles = (theme: GrafanaTheme2) => ({
|
||||||
wrapper: css`
|
wrapper: css`
|
||||||
label: call-to-action-card;
|
label: call-to-action-card;
|
||||||
padding: ${theme.spacing(3)};
|
padding: ${theme.spacing(3)};
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React, { memo, cloneElement, FC, ReactNode, useCallback } from 'react';
|
import React, { memo, cloneElement, FC, ReactNode, useCallback } from 'react';
|
||||||
import { css, cx } from '@emotion/css';
|
import { css, cx } from '@emotion/css';
|
||||||
import { GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { useTheme2, stylesFactory } from '../../themes';
|
import { useTheme2, stylesFactory } from '../../themes';
|
||||||
import { CardContainer, CardContainerProps } from './CardContainer';
|
import { CardContainer, CardContainerProps } from './CardContainer';
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ export const Card: CardInterface = ({
|
|||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
export const getCardStyles = stylesFactory((theme: GrafanaThemeV2) => {
|
export const getCardStyles = stylesFactory((theme: GrafanaTheme2) => {
|
||||||
return {
|
return {
|
||||||
inner: css`
|
inner: css`
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React, { HTMLAttributes, ReactNode } from 'react';
|
import React, { HTMLAttributes, ReactNode } from 'react';
|
||||||
import { css, cx } from '@emotion/css';
|
import { css, cx } from '@emotion/css';
|
||||||
import { GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { styleMixins, stylesFactory, useTheme2 } from '../../themes';
|
import { styleMixins, stylesFactory, useTheme2 } from '../../themes';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -52,7 +52,7 @@ export const CardContainer = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const getCardContainerStyles = stylesFactory((theme: GrafanaThemeV2, disabled = false, disableHover = false) => {
|
const getCardContainerStyles = stylesFactory((theme: GrafanaTheme2, disabled = false, disableHover = false) => {
|
||||||
return {
|
return {
|
||||||
container: css({
|
container: css({
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
|
@ -2,7 +2,7 @@ import React, { FC, ReactNode, useState } from 'react';
|
|||||||
import { css } from '@emotion/css';
|
import { css } from '@emotion/css';
|
||||||
import { useStyles2 } from '../../themes';
|
import { useStyles2 } from '../../themes';
|
||||||
import { Icon } from '..';
|
import { Icon } from '..';
|
||||||
import { GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
label: string;
|
label: string;
|
||||||
@ -27,7 +27,7 @@ export const CollapsableSection: FC<Props> = ({ label, isOpen, children }) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const collapsableSectionStyles = (theme: GrafanaThemeV2) => {
|
const collapsableSectionStyles = (theme: GrafanaTheme2) => {
|
||||||
const header = css({
|
const header = css({
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
justifyContent: 'space-between',
|
justifyContent: 'space-between',
|
||||||
|
@ -3,9 +3,9 @@ import { css, cx } from '@emotion/css';
|
|||||||
|
|
||||||
import { useStyles2 } from '../../themes/ThemeContext';
|
import { useStyles2 } from '../../themes/ThemeContext';
|
||||||
import { Icon } from '../Icon/Icon';
|
import { Icon } from '../Icon/Icon';
|
||||||
import { GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
|
|
||||||
const getStyles = (theme: GrafanaThemeV2) => ({
|
const getStyles = (theme: GrafanaTheme2) => ({
|
||||||
collapse: css`
|
collapse: css`
|
||||||
label: collapse;
|
label: collapse;
|
||||||
margin-bottom: ${theme.spacing(1)};
|
margin-bottom: ${theme.spacing(1)};
|
||||||
|
@ -5,7 +5,7 @@ import { debounce } from 'lodash';
|
|||||||
import { ColorPickerProps } from './ColorPickerPopover';
|
import { ColorPickerProps } from './ColorPickerPopover';
|
||||||
import { Input } from '../Input/Input';
|
import { Input } from '../Input/Input';
|
||||||
import { useStyles2 } from '../../themes';
|
import { useStyles2 } from '../../themes';
|
||||||
import { GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { cx, css } from '@emotion/css';
|
import { cx, css } from '@emotion/css';
|
||||||
|
|
||||||
interface ColorInputState {
|
interface ColorInputState {
|
||||||
@ -102,7 +102,7 @@ const ColorPreview = ({ color }: ColorPreviewProps) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const getColorPreviewStyles = (theme: GrafanaThemeV2) => css`
|
const getColorPreviewStyles = (theme: GrafanaTheme2) => css`
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: ${theme.spacing.gridSize * 4}px;
|
width: ${theme.spacing.gridSize * 4}px;
|
||||||
border-radius: ${theme.shape.borderRadius()} 0 0 ${theme.shape.borderRadius()};
|
border-radius: ${theme.shape.borderRadius()} 0 0 ${theme.shape.borderRadius()};
|
||||||
|
@ -4,7 +4,7 @@ import { Modal } from '../Modal/Modal';
|
|||||||
import { IconName } from '../../types/icon';
|
import { IconName } from '../../types/icon';
|
||||||
import { Button } from '../Button';
|
import { Button } from '../Button';
|
||||||
import { useStyles2 } from '../../themes';
|
import { useStyles2 } from '../../themes';
|
||||||
import { GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { HorizontalGroup, Input } from '..';
|
import { HorizontalGroup, Input } from '..';
|
||||||
import { selectors } from '@grafana/e2e-selectors';
|
import { selectors } from '@grafana/e2e-selectors';
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ export const ConfirmModal = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const getStyles = (theme: GrafanaThemeV2) => ({
|
const getStyles = (theme: GrafanaTheme2) => ({
|
||||||
modal: css`
|
modal: css`
|
||||||
width: 500px;
|
width: 500px;
|
||||||
`,
|
`,
|
||||||
|
@ -4,7 +4,7 @@ import classNames from 'classnames';
|
|||||||
import { css } from '@emotion/css';
|
import { css } from '@emotion/css';
|
||||||
import Scrollbars from 'react-custom-scrollbars';
|
import Scrollbars from 'react-custom-scrollbars';
|
||||||
import { useStyles2 } from '../../themes';
|
import { useStyles2 } from '../../themes';
|
||||||
import { GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
className?: string;
|
className?: string;
|
||||||
@ -127,7 +127,7 @@ export const CustomScrollbar: FC<Props> = ({
|
|||||||
|
|
||||||
export default CustomScrollbar;
|
export default CustomScrollbar;
|
||||||
|
|
||||||
const getStyles = (theme: GrafanaThemeV2) => {
|
const getStyles = (theme: GrafanaTheme2) => {
|
||||||
return {
|
return {
|
||||||
customScrollbar: css`
|
customScrollbar: css`
|
||||||
// Fix for Firefox. For some reason sometimes .view container gets a height of its content, but in order to
|
// Fix for Firefox. For some reason sometimes .view container gets a height of its content, but in order to
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import React, { ChangeEvent } from 'react';
|
import React, { ChangeEvent } from 'react';
|
||||||
import { VariableSuggestion, GrafanaThemeV2, DataLink } from '@grafana/data';
|
import { VariableSuggestion, GrafanaTheme2, DataLink } from '@grafana/data';
|
||||||
import { Switch } from '../Switch/Switch';
|
import { Switch } from '../Switch/Switch';
|
||||||
import { css } from '@emotion/css';
|
import { css } from '@emotion/css';
|
||||||
import { useStyles2 } from '../../themes/index';
|
import { useStyles2 } from '../../themes/index';
|
||||||
@ -15,7 +15,7 @@ interface DataLinkEditorProps {
|
|||||||
onChange: (index: number, link: DataLink, callback?: () => void) => void;
|
onChange: (index: number, link: DataLink, callback?: () => void) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const getStyles = (theme: GrafanaThemeV2) => ({
|
const getStyles = (theme: GrafanaTheme2) => ({
|
||||||
listItem: css`
|
listItem: css`
|
||||||
margin-bottom: ${theme.spacing()};
|
margin-bottom: ${theme.spacing()};
|
||||||
`,
|
`,
|
||||||
|
@ -16,7 +16,7 @@ import { css, cx } from '@emotion/css';
|
|||||||
import { SlatePrism } from '../../slate-plugins';
|
import { SlatePrism } from '../../slate-plugins';
|
||||||
import { SCHEMA } from '../../utils/slate';
|
import { SCHEMA } from '../../utils/slate';
|
||||||
import { useStyles2 } from '../../themes';
|
import { useStyles2 } from '../../themes';
|
||||||
import { DataLinkBuiltInVars, GrafanaThemeV2, VariableOrigin, VariableSuggestion } from '@grafana/data';
|
import { DataLinkBuiltInVars, GrafanaTheme2, VariableOrigin, VariableSuggestion } from '@grafana/data';
|
||||||
import { getInputStyles } from '../Input/Input';
|
import { getInputStyles } from '../Input/Input';
|
||||||
import CustomScrollbar from '../CustomScrollbar/CustomScrollbar';
|
import CustomScrollbar from '../CustomScrollbar/CustomScrollbar';
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ const plugins = [
|
|||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
const getStyles = (theme: GrafanaThemeV2) => ({
|
const getStyles = (theme: GrafanaTheme2) => ({
|
||||||
input: getInputStyles({ theme, invalid: false }).input,
|
input: getInputStyles({ theme, invalid: false }).input,
|
||||||
editor: css`
|
editor: css`
|
||||||
.token.builtInVariable {
|
.token.builtInVariable {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { VariableSuggestion, GrafanaThemeV2 } from '@grafana/data';
|
import { VariableSuggestion, GrafanaTheme2 } from '@grafana/data';
|
||||||
import { css, cx } from '@emotion/css';
|
import { css, cx } from '@emotion/css';
|
||||||
import { groupBy, capitalize } from 'lodash';
|
import { groupBy, capitalize } from 'lodash';
|
||||||
import React, { useRef, useMemo } from 'react';
|
import React, { useRef, useMemo } from 'react';
|
||||||
@ -14,7 +14,7 @@ interface DataLinkSuggestionsProps {
|
|||||||
onClose?: () => void;
|
onClose?: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const getStyles = (theme: GrafanaThemeV2) => {
|
const getStyles = (theme: GrafanaTheme2) => {
|
||||||
return {
|
return {
|
||||||
list: css`
|
list: css`
|
||||||
border-bottom: 1px solid ${theme.colors.border.weak};
|
border-bottom: 1px solid ${theme.colors.border.weak};
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { DataFrame, DataLink, GrafanaThemeV2, VariableSuggestion } from '@grafana/data';
|
import { DataFrame, DataLink, GrafanaTheme2, VariableSuggestion } from '@grafana/data';
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { css } from '@emotion/css';
|
import { css } from '@emotion/css';
|
||||||
import { Button } from '../../Button/Button';
|
import { Button } from '../../Button/Button';
|
||||||
@ -111,7 +111,7 @@ export const DataLinksInlineEditor: React.FC<DataLinksInlineEditorProps> = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const getDataLinksInlineEditorStyles = stylesFactory((theme: GrafanaThemeV2) => {
|
const getDataLinksInlineEditorStyles = stylesFactory((theme: GrafanaTheme2) => {
|
||||||
return {
|
return {
|
||||||
wrapper: css`
|
wrapper: css`
|
||||||
margin-bottom: ${theme.spacing(2)};
|
margin-bottom: ${theme.spacing(2)};
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React, { FC } from 'react';
|
import React, { FC } from 'react';
|
||||||
import { css, cx } from '@emotion/css';
|
import { css, cx } from '@emotion/css';
|
||||||
import { DataFrame, DataLink, GrafanaThemeV2 } from '@grafana/data';
|
import { DataFrame, DataLink, GrafanaTheme2 } from '@grafana/data';
|
||||||
import { stylesFactory, useTheme2 } from '../../../themes';
|
import { stylesFactory, useTheme2 } from '../../../themes';
|
||||||
import { HorizontalGroup, VerticalGroup } from '../../Layout/Layout';
|
import { HorizontalGroup, VerticalGroup } from '../../Layout/Layout';
|
||||||
import { IconButton } from '../../IconButton/IconButton';
|
import { IconButton } from '../../IconButton/IconButton';
|
||||||
@ -43,7 +43,7 @@ export const DataLinksListItem: FC<DataLinksListItemProps> = ({ link, onEdit, on
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const getDataLinkListItemStyles = stylesFactory((theme: GrafanaThemeV2) => {
|
const getDataLinkListItemStyles = stylesFactory((theme: GrafanaTheme2) => {
|
||||||
return {
|
return {
|
||||||
wrapper: css`
|
wrapper: css`
|
||||||
margin-bottom: ${theme.spacing(2)};
|
margin-bottom: ${theme.spacing(2)};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import React, { CSSProperties, FC, ReactNode, useState } from 'react';
|
import React, { CSSProperties, FC, ReactNode, useState } from 'react';
|
||||||
import { GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import RcDrawer from 'rc-drawer';
|
import RcDrawer from 'rc-drawer';
|
||||||
import { css } from '@emotion/css';
|
import { css } from '@emotion/css';
|
||||||
import { selectors } from '@grafana/e2e-selectors';
|
import { selectors } from '@grafana/e2e-selectors';
|
||||||
@ -30,7 +30,7 @@ export interface Props {
|
|||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const getStyles = stylesFactory((theme: GrafanaThemeV2, scrollableContent: boolean) => {
|
const getStyles = stylesFactory((theme: GrafanaTheme2, scrollableContent: boolean) => {
|
||||||
return {
|
return {
|
||||||
drawer: css`
|
drawer: css`
|
||||||
.drawer-content {
|
.drawer-content {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React, { useState, HTMLAttributes } from 'react';
|
import React, { useState, HTMLAttributes } from 'react';
|
||||||
import { PopoverContent } from '../Tooltip/Tooltip';
|
import { PopoverContent } from '../Tooltip/Tooltip';
|
||||||
import { GrafanaThemeV2, SelectableValue } from '@grafana/data';
|
import { GrafanaTheme2, SelectableValue } from '@grafana/data';
|
||||||
import { ToolbarButtonVariant, ToolbarButton } from '../Button';
|
import { ToolbarButtonVariant, ToolbarButton } from '../Button';
|
||||||
import { ClickOutsideWrapper } from '../ClickOutsideWrapper/ClickOutsideWrapper';
|
import { ClickOutsideWrapper } from '../ClickOutsideWrapper/ClickOutsideWrapper';
|
||||||
import { css } from '@emotion/css';
|
import { css } from '@emotion/css';
|
||||||
@ -77,7 +77,7 @@ export const ButtonSelect = React.memo(<T,>(props: Props<T>) => {
|
|||||||
|
|
||||||
ButtonSelect.displayName = 'ButtonSelect';
|
ButtonSelect.displayName = 'ButtonSelect';
|
||||||
|
|
||||||
const getStyles = (theme: GrafanaThemeV2) => {
|
const getStyles = (theme: GrafanaTheme2) => {
|
||||||
return {
|
return {
|
||||||
wrapper: css`
|
wrapper: css`
|
||||||
position: relative;
|
position: relative;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import React, { FC } from 'react';
|
import React, { FC } from 'react';
|
||||||
import { GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { css } from '@emotion/css';
|
import { css } from '@emotion/css';
|
||||||
import { useStyles2 } from '../../themes';
|
import { useStyles2 } from '../../themes';
|
||||||
|
|
||||||
@ -12,7 +12,7 @@ const EmptySearchResult: FC<Props> = ({ children }) => {
|
|||||||
return <div className={styles.container}>{children}</div>;
|
return <div className={styles.container}>{children}</div>;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getStyles = (theme: GrafanaThemeV2) => {
|
const getStyles = (theme: GrafanaTheme2) => {
|
||||||
return {
|
return {
|
||||||
container: css`
|
container: css`
|
||||||
border-left: 3px solid ${theme.colors.info.main};
|
border-left: 3px solid ${theme.colors.info.main};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import React, { FC, FormEvent, useCallback, useState } from 'react';
|
import React, { FC, FormEvent, useCallback, useState } from 'react';
|
||||||
import { GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { css, cx } from '@emotion/css';
|
import { css, cx } from '@emotion/css';
|
||||||
import { Icon } from '../index';
|
import { Icon } from '../index';
|
||||||
import { stylesFactory, useTheme2 } from '../../themes';
|
import { stylesFactory, useTheme2 } from '../../themes';
|
||||||
@ -75,7 +75,7 @@ export const FileUpload: FC<Props> = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const getStyles = stylesFactory((theme: GrafanaThemeV2, size: ComponentSize) => {
|
const getStyles = stylesFactory((theme: GrafanaTheme2, size: ComponentSize) => {
|
||||||
const buttonStyles = getButtonStyles({ theme, variant: 'primary', size, iconOnly: false });
|
const buttonStyles = getButtonStyles({ theme, variant: 'primary', size, iconOnly: false });
|
||||||
return {
|
return {
|
||||||
fileUpload: css`
|
fileUpload: css`
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import React, { HTMLProps, useCallback } from 'react';
|
import React, { HTMLProps, useCallback } from 'react';
|
||||||
import { GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { getLabelStyles } from './Label';
|
import { getLabelStyles } from './Label';
|
||||||
import { useTheme2, stylesFactory } from '../../themes';
|
import { useTheme2, stylesFactory } from '../../themes';
|
||||||
import { css, cx } from '@emotion/css';
|
import { css, cx } from '@emotion/css';
|
||||||
@ -11,7 +11,7 @@ export interface CheckboxProps extends Omit<HTMLProps<HTMLInputElement>, 'value'
|
|||||||
value?: boolean;
|
value?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getCheckboxStyles = stylesFactory((theme: GrafanaThemeV2) => {
|
export const getCheckboxStyles = stylesFactory((theme: GrafanaTheme2) => {
|
||||||
const labelStyles = getLabelStyles(theme);
|
const labelStyles = getLabelStyles(theme);
|
||||||
const checkboxSize = '16px';
|
const checkboxSize = '16px';
|
||||||
return {
|
return {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { useTheme2, stylesFactory } from '../../themes';
|
import { useTheme2, stylesFactory } from '../../themes';
|
||||||
import { GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { css, cx } from '@emotion/css';
|
import { css, cx } from '@emotion/css';
|
||||||
import { Icon } from '../Icon/Icon';
|
import { Icon } from '../Icon/Icon';
|
||||||
|
|
||||||
@ -10,7 +10,7 @@ export interface LabelProps extends React.LabelHTMLAttributes<HTMLLabelElement>
|
|||||||
category?: string[];
|
category?: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getLabelStyles = stylesFactory((theme: GrafanaThemeV2) => {
|
export const getLabelStyles = stylesFactory((theme: GrafanaTheme2) => {
|
||||||
return {
|
return {
|
||||||
label: css`
|
label: css`
|
||||||
label: Label;
|
label: Label;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { useTheme2, stylesFactory } from '../../../themes';
|
import { useTheme2, stylesFactory } from '../../../themes';
|
||||||
import { GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { css, cx } from '@emotion/css';
|
import { css, cx } from '@emotion/css';
|
||||||
import { getPropertiesForButtonSize } from '../commonStyles';
|
import { getPropertiesForButtonSize } from '../commonStyles';
|
||||||
import { getFocusStyles, getMouseFocusStyles } from '../../../themes/mixins';
|
import { getFocusStyles, getMouseFocusStyles } from '../../../themes/mixins';
|
||||||
@ -52,7 +52,7 @@ export const RadioButton: React.FC<RadioButtonProps> = ({
|
|||||||
|
|
||||||
RadioButton.displayName = 'RadioButton';
|
RadioButton.displayName = 'RadioButton';
|
||||||
|
|
||||||
const getRadioButtonStyles = stylesFactory((theme: GrafanaThemeV2, size: RadioButtonSize, fullWidth?: boolean) => {
|
const getRadioButtonStyles = stylesFactory((theme: GrafanaTheme2, size: RadioButtonSize, fullWidth?: boolean) => {
|
||||||
const { fontSize, height, padding } = getPropertiesForButtonSize(size, theme);
|
const { fontSize, height, padding } = getPropertiesForButtonSize(size, theme);
|
||||||
|
|
||||||
const textColor = theme.colors.text.secondary;
|
const textColor = theme.colors.text.secondary;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React, { useCallback, useRef } from 'react';
|
import React, { useCallback, useRef } from 'react';
|
||||||
import { css, cx } from '@emotion/css';
|
import { css, cx } from '@emotion/css';
|
||||||
import { uniqueId } from 'lodash';
|
import { uniqueId } from 'lodash';
|
||||||
import { GrafanaThemeV2, SelectableValue } from '@grafana/data';
|
import { GrafanaTheme2, SelectableValue } from '@grafana/data';
|
||||||
import { RadioButtonSize, RadioButton } from './RadioButton';
|
import { RadioButtonSize, RadioButton } from './RadioButton';
|
||||||
import { Icon } from '../../Icon/Icon';
|
import { Icon } from '../../Icon/Icon';
|
||||||
import { IconName } from '../../../types/icon';
|
import { IconName } from '../../../types/icon';
|
||||||
@ -69,7 +69,7 @@ export function RadioButtonGroup<T>({
|
|||||||
|
|
||||||
RadioButtonGroup.displayName = 'RadioButtonGroup';
|
RadioButtonGroup.displayName = 'RadioButtonGroup';
|
||||||
|
|
||||||
const getStyles = (theme: GrafanaThemeV2) => {
|
const getStyles = (theme: GrafanaTheme2) => {
|
||||||
return {
|
return {
|
||||||
radioGroup: css({
|
radioGroup: css({
|
||||||
display: 'inline-flex',
|
display: 'inline-flex',
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { css } from '@emotion/css';
|
import { css } from '@emotion/css';
|
||||||
import { GrafanaTheme, GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme, GrafanaTheme2 } from '@grafana/data';
|
||||||
import { focusCss } from '../../themes/mixins';
|
import { focusCss } from '../../themes/mixins';
|
||||||
import { ComponentSize } from '../../types/size';
|
import { ComponentSize } from '../../types/size';
|
||||||
|
|
||||||
@ -9,7 +9,7 @@ export const getFocusStyle = (theme: GrafanaTheme) => css`
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export const sharedInputStyle = (theme: GrafanaThemeV2, invalid = false) => {
|
export const sharedInputStyle = (theme: GrafanaTheme2, invalid = false) => {
|
||||||
const borderColor = invalid ? theme.colors.error.border : theme.components.input.borderColor;
|
const borderColor = invalid ? theme.colors.error.border : theme.components.input.borderColor;
|
||||||
const borderColorHover = invalid ? theme.colors.error.shade : theme.components.input.borderHover;
|
const borderColorHover = invalid ? theme.colors.error.shade : theme.components.input.borderHover;
|
||||||
const background = theme.components.input.background;
|
const background = theme.components.input.background;
|
||||||
@ -93,7 +93,7 @@ export const inputSizesPixels = (size: string) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export function getPropertiesForButtonSize(size: ComponentSize, theme: GrafanaThemeV2) {
|
export function getPropertiesForButtonSize(size: ComponentSize, theme: GrafanaTheme2) {
|
||||||
switch (size) {
|
switch (size) {
|
||||||
case 'sm':
|
case 'sm':
|
||||||
return {
|
return {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { stylesFactory } from '../../themes';
|
import { stylesFactory } from '../../themes';
|
||||||
import { GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { getLabelStyles } from './Label';
|
import { getLabelStyles } from './Label';
|
||||||
import { getLegendStyles } from './Legend';
|
import { getLegendStyles } from './Legend';
|
||||||
import { getFieldValidationMessageStyles } from './FieldValidationMessage';
|
import { getFieldValidationMessageStyles } from './FieldValidationMessage';
|
||||||
@ -10,7 +10,7 @@ import { getCheckboxStyles } from './Checkbox';
|
|||||||
|
|
||||||
/** @deprecated */
|
/** @deprecated */
|
||||||
export const getFormStyles = stylesFactory(
|
export const getFormStyles = stylesFactory(
|
||||||
(theme: GrafanaThemeV2, options: { variant: ButtonVariant; size: ComponentSize; invalid: boolean }) => {
|
(theme: GrafanaTheme2, options: { variant: ButtonVariant; size: ComponentSize; invalid: boolean }) => {
|
||||||
console.warn('getFormStyles is deprecated');
|
console.warn('getFormStyles is deprecated');
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -10,7 +10,7 @@ import {
|
|||||||
getFieldColorModeForField,
|
getFieldColorModeForField,
|
||||||
getFieldDisplayName,
|
getFieldDisplayName,
|
||||||
getFieldSeriesColor,
|
getFieldSeriesColor,
|
||||||
GrafanaThemeV2,
|
GrafanaTheme2,
|
||||||
outerJoinDataFrames,
|
outerJoinDataFrames,
|
||||||
TimeRange,
|
TimeRange,
|
||||||
TimeZone,
|
TimeZone,
|
||||||
@ -83,7 +83,7 @@ export function preparePlotFrame(frames: DataFrame[], dimFields: XYFieldMatchers
|
|||||||
|
|
||||||
export function preparePlotConfigBuilder(
|
export function preparePlotConfigBuilder(
|
||||||
frame: DataFrame,
|
frame: DataFrame,
|
||||||
theme: GrafanaThemeV2,
|
theme: GrafanaTheme2,
|
||||||
getTimeRange: () => TimeRange,
|
getTimeRange: () => TimeRange,
|
||||||
getTimeZone: () => TimeZone
|
getTimeZone: () => TimeZone
|
||||||
): UPlotConfigBuilder {
|
): UPlotConfigBuilder {
|
||||||
|
@ -4,7 +4,7 @@ import { IconName, IconSize, IconType } from '../../types/icon';
|
|||||||
import { stylesFactory } from '../../themes/stylesFactory';
|
import { stylesFactory } from '../../themes/stylesFactory';
|
||||||
import { css, cx } from '@emotion/css';
|
import { css, cx } from '@emotion/css';
|
||||||
import { useTheme2 } from '../../themes/ThemeContext';
|
import { useTheme2 } from '../../themes/ThemeContext';
|
||||||
import { GrafanaThemeV2, colorManipulator } from '@grafana/data';
|
import { GrafanaTheme2, colorManipulator } from '@grafana/data';
|
||||||
import { Tooltip } from '../Tooltip/Tooltip';
|
import { Tooltip } from '../Tooltip/Tooltip';
|
||||||
import { TooltipPlacement } from '../Tooltip/PopoverController';
|
import { TooltipPlacement } from '../Tooltip/PopoverController';
|
||||||
import { getFocusStyles, getMouseFocusStyles } from '../../themes/mixins';
|
import { getFocusStyles, getMouseFocusStyles } from '../../themes/mixins';
|
||||||
@ -55,7 +55,7 @@ export const IconButton = React.forwardRef<HTMLButtonElement, Props>(
|
|||||||
|
|
||||||
IconButton.displayName = 'IconButton';
|
IconButton.displayName = 'IconButton';
|
||||||
|
|
||||||
const getStyles = stylesFactory((theme: GrafanaThemeV2, size: IconSize, variant: IconButtonVariant) => {
|
const getStyles = stylesFactory((theme: GrafanaTheme2, size: IconSize, variant: IconButtonVariant) => {
|
||||||
const pixelSize = getSvgSize(size);
|
const pixelSize = getSvgSize(size);
|
||||||
const hoverSize = Math.max(pixelSize / 3, 8);
|
const hoverSize = Math.max(pixelSize / 3, 8);
|
||||||
let iconColor = theme.colors.text.primary;
|
let iconColor = theme.colors.text.primary;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { css, cx } from '@emotion/css';
|
import { css, cx } from '@emotion/css';
|
||||||
import { GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { Icon } from '../Icon/Icon';
|
import { Icon } from '../Icon/Icon';
|
||||||
import { Alert, AlertVariant } from '../Alert/Alert';
|
import { Alert, AlertVariant } from '../Alert/Alert';
|
||||||
import { stylesFactory, useStyles2 } from '../../themes';
|
import { stylesFactory, useStyles2 } from '../../themes';
|
||||||
@ -43,7 +43,7 @@ export const InfoBox = React.memo(
|
|||||||
|
|
||||||
InfoBox.displayName = 'InfoBox';
|
InfoBox.displayName = 'InfoBox';
|
||||||
|
|
||||||
const getStyles = stylesFactory((theme: GrafanaThemeV2) => {
|
const getStyles = stylesFactory((theme: GrafanaTheme2) => {
|
||||||
return {
|
return {
|
||||||
docsLink: css`
|
docsLink: css`
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import React, { HTMLProps, ReactNode } from 'react';
|
import React, { HTMLProps, ReactNode } from 'react';
|
||||||
import { GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { css, cx } from '@emotion/css';
|
import { css, cx } from '@emotion/css';
|
||||||
import { getFocusStyle, sharedInputStyle } from '../Forms/commonStyles';
|
import { getFocusStyle, sharedInputStyle } from '../Forms/commonStyles';
|
||||||
import { stylesFactory, useTheme2 } from '../../themes';
|
import { stylesFactory, useTheme2 } from '../../themes';
|
||||||
@ -24,7 +24,7 @@ export interface Props extends Omit<HTMLProps<HTMLInputElement>, 'prefix' | 'siz
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface StyleDeps {
|
interface StyleDeps {
|
||||||
theme: GrafanaThemeV2;
|
theme: GrafanaTheme2;
|
||||||
invalid: boolean;
|
invalid: boolean;
|
||||||
width?: number;
|
width?: number;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { css } from '@emotion/css';
|
import { css } from '@emotion/css';
|
||||||
import { GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { useStyles2 } from '../../themes';
|
import { useStyles2 } from '../../themes';
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
@ -27,7 +27,7 @@ export const Menu = React.forwardRef<HTMLDivElement, MenuProps>(
|
|||||||
Menu.displayName = 'Menu';
|
Menu.displayName = 'Menu';
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
const getStyles = (theme: GrafanaThemeV2) => {
|
const getStyles = (theme: GrafanaTheme2) => {
|
||||||
return {
|
return {
|
||||||
header: css`
|
header: css`
|
||||||
padding: ${theme.spacing(0.5, 0.5, 1, 0.5)};
|
padding: ${theme.spacing(0.5, 0.5, 1, 0.5)};
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { css } from '@emotion/css';
|
import { css } from '@emotion/css';
|
||||||
import { GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { useStyles2 } from '../../themes';
|
import { useStyles2 } from '../../themes';
|
||||||
import { MenuItemProps } from './MenuItem';
|
import { MenuItemProps } from './MenuItem';
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ export const MenuGroup: React.FC<MenuGroupProps> = ({ label, children, ariaLabel
|
|||||||
MenuGroup.displayName = 'MenuGroup';
|
MenuGroup.displayName = 'MenuGroup';
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
const getStyles = (theme: GrafanaThemeV2) => {
|
const getStyles = (theme: GrafanaTheme2) => {
|
||||||
return {
|
return {
|
||||||
groupLabel: css`
|
groupLabel: css`
|
||||||
color: ${theme.colors.text.secondary};
|
color: ${theme.colors.text.secondary};
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { css, cx } from '@emotion/css';
|
import { css, cx } from '@emotion/css';
|
||||||
import { GrafanaThemeV2, LinkTarget } from '@grafana/data';
|
import { GrafanaTheme2, LinkTarget } from '@grafana/data';
|
||||||
import { useStyles2 } from '../../themes';
|
import { useStyles2 } from '../../themes';
|
||||||
import { Icon } from '../Icon/Icon';
|
import { Icon } from '../Icon/Icon';
|
||||||
import { IconName } from '../../types';
|
import { IconName } from '../../types';
|
||||||
@ -55,7 +55,7 @@ export const MenuItem: React.FC<MenuItemProps> = React.memo(
|
|||||||
MenuItem.displayName = 'MenuItem';
|
MenuItem.displayName = 'MenuItem';
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
const getStyles = (theme: GrafanaThemeV2) => {
|
const getStyles = (theme: GrafanaTheme2) => {
|
||||||
return {
|
return {
|
||||||
link: css`
|
link: css`
|
||||||
color: ${theme.colors.text.primary};
|
color: ${theme.colors.text.primary};
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { css } from '@emotion/css';
|
import { css } from '@emotion/css';
|
||||||
import { GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { stylesFactory } from '../../themes';
|
import { stylesFactory } from '../../themes';
|
||||||
|
|
||||||
export const getModalStyles = stylesFactory((theme: GrafanaThemeV2) => {
|
export const getModalStyles = stylesFactory((theme: GrafanaTheme2) => {
|
||||||
const borderRadius = theme.shape.borderRadius(1);
|
const borderRadius = theme.shape.borderRadius(1);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -2,10 +2,10 @@ import React, { memo } from 'react';
|
|||||||
import { EdgeDatum, NodeDatum } from './types';
|
import { EdgeDatum, NodeDatum } from './types';
|
||||||
import { css } from '@emotion/css';
|
import { css } from '@emotion/css';
|
||||||
import { useStyles2 } from '../../themes';
|
import { useStyles2 } from '../../themes';
|
||||||
import { GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { shortenLine } from './utils';
|
import { shortenLine } from './utils';
|
||||||
|
|
||||||
const getStyles = (theme: GrafanaThemeV2) => {
|
const getStyles = (theme: GrafanaTheme2) => {
|
||||||
return {
|
return {
|
||||||
mainGroup: css`
|
mainGroup: css`
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
|
@ -6,7 +6,7 @@ import { EdgeDatum, NodeDatum } from './types';
|
|||||||
import { Node } from './Node';
|
import { Node } from './Node';
|
||||||
import { Edge } from './Edge';
|
import { Edge } from './Edge';
|
||||||
import { ViewControls } from './ViewControls';
|
import { ViewControls } from './ViewControls';
|
||||||
import { DataFrame, GrafanaThemeV2, LinkModel } from '@grafana/data';
|
import { DataFrame, GrafanaTheme2, LinkModel } from '@grafana/data';
|
||||||
import { useZoom } from './useZoom';
|
import { useZoom } from './useZoom';
|
||||||
import { Bounds, Config, defaultConfig, useLayout } from './layout';
|
import { Bounds, Config, defaultConfig, useLayout } from './layout';
|
||||||
import { EdgeArrowMarker } from './EdgeArrowMarker';
|
import { EdgeArrowMarker } from './EdgeArrowMarker';
|
||||||
@ -19,7 +19,7 @@ import { processNodes } from './utils';
|
|||||||
import { Icon } from '..';
|
import { Icon } from '..';
|
||||||
import { useNodeLimit } from './useNodeLimit';
|
import { useNodeLimit } from './useNodeLimit';
|
||||||
|
|
||||||
const getStyles = stylesFactory((theme: GrafanaThemeV2) => ({
|
const getStyles = stylesFactory((theme: GrafanaTheme2) => ({
|
||||||
wrapper: css`
|
wrapper: css`
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
@ -5,7 +5,7 @@ import {
|
|||||||
FieldCache,
|
FieldCache,
|
||||||
FieldType,
|
FieldType,
|
||||||
getFieldColorModeForField,
|
getFieldColorModeForField,
|
||||||
GrafanaThemeV2,
|
GrafanaTheme2,
|
||||||
MutableDataFrame,
|
MutableDataFrame,
|
||||||
} from '@grafana/data';
|
} from '@grafana/data';
|
||||||
import { EdgeDatum, NodeDatum } from './types';
|
import { EdgeDatum, NodeDatum } from './types';
|
||||||
@ -84,7 +84,7 @@ export enum DataFrameFieldNames {
|
|||||||
export function processNodes(
|
export function processNodes(
|
||||||
nodes: DataFrame | undefined,
|
nodes: DataFrame | undefined,
|
||||||
edges: DataFrame | undefined,
|
edges: DataFrame | undefined,
|
||||||
theme: GrafanaThemeV2
|
theme: GrafanaTheme2
|
||||||
): { nodes: NodeDatum[]; edges: EdgeDatum[] } {
|
): { nodes: NodeDatum[]; edges: EdgeDatum[] } {
|
||||||
if (!nodes) {
|
if (!nodes) {
|
||||||
return { nodes: [], edges: [] };
|
return { nodes: [], edges: [] };
|
||||||
@ -276,7 +276,7 @@ function edgesFrame() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getColor(field: Field, index: number, theme: GrafanaThemeV2): string {
|
function getColor(field: Field, index: number, theme: GrafanaTheme2): string {
|
||||||
if (!field.config.color) {
|
if (!field.config.color) {
|
||||||
return field.values.get(index);
|
return field.values.get(index);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React, { FC, ReactNode } from 'react';
|
import React, { FC, ReactNode } from 'react';
|
||||||
import { css, cx } from '@emotion/css';
|
import { css, cx } from '@emotion/css';
|
||||||
import { GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { useStyles2 } from '../../themes/ThemeContext';
|
import { useStyles2 } from '../../themes/ThemeContext';
|
||||||
import { IconName } from '../../types';
|
import { IconName } from '../../types';
|
||||||
import { Icon } from '../Icon/Icon';
|
import { Icon } from '../Icon/Icon';
|
||||||
@ -109,7 +109,7 @@ export const PageToolbar: FC<Props> = React.memo(
|
|||||||
|
|
||||||
PageToolbar.displayName = 'PageToolbar';
|
PageToolbar.displayName = 'PageToolbar';
|
||||||
|
|
||||||
const getStyles = (theme: GrafanaThemeV2) => {
|
const getStyles = (theme: GrafanaTheme2) => {
|
||||||
const { spacing, typography } = theme;
|
const { spacing, typography } = theme;
|
||||||
|
|
||||||
const titleStyles = `
|
const titleStyles = `
|
||||||
|
@ -6,7 +6,7 @@ import {
|
|||||||
FieldDisplay,
|
FieldDisplay,
|
||||||
formattedValueToString,
|
formattedValueToString,
|
||||||
getFieldDisplayValues,
|
getFieldDisplayValues,
|
||||||
GrafanaThemeV2,
|
GrafanaTheme2,
|
||||||
} from '@grafana/data';
|
} from '@grafana/data';
|
||||||
import { useStyles2, useTheme2 } from '../../themes/ThemeContext';
|
import { useStyles2, useTheme2 } from '../../themes/ThemeContext';
|
||||||
import tinycolor from 'tinycolor2';
|
import tinycolor from 'tinycolor2';
|
||||||
@ -414,14 +414,14 @@ function getLabelPos(arc: PieArcDatum<FieldDisplay>, outerRadius: number, innerR
|
|||||||
return [Math.cos(a) * r, Math.sin(a) * r];
|
return [Math.cos(a) * r, Math.sin(a) * r];
|
||||||
}
|
}
|
||||||
|
|
||||||
function getGradientColorFrom(color: string, theme: GrafanaThemeV2) {
|
function getGradientColorFrom(color: string, theme: GrafanaTheme2) {
|
||||||
return tinycolor(color)
|
return tinycolor(color)
|
||||||
.darken(20 * (theme.isDark ? 1 : -0.7))
|
.darken(20 * (theme.isDark ? 1 : -0.7))
|
||||||
.spin(8)
|
.spin(8)
|
||||||
.toRgbString();
|
.toRgbString();
|
||||||
}
|
}
|
||||||
|
|
||||||
function getGradientColorTo(color: string, theme: GrafanaThemeV2) {
|
function getGradientColorTo(color: string, theme: GrafanaTheme2) {
|
||||||
return tinycolor(color)
|
return tinycolor(color)
|
||||||
.darken(10 * (theme.isDark ? 1 : -0.7))
|
.darken(10 * (theme.isDark ? 1 : -0.7))
|
||||||
.spin(-8)
|
.spin(-8)
|
||||||
@ -453,7 +453,7 @@ function getPieLayout(height: number, width: number, pieType: PieChartType, marg
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const getStyles = (theme: GrafanaThemeV2) => {
|
const getStyles = (theme: GrafanaTheme2) => {
|
||||||
return {
|
return {
|
||||||
container: css`
|
container: css`
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
@ -4,7 +4,7 @@ import { sharedInputStyle } from '../Forms/commonStyles';
|
|||||||
import { getInputStyles } from '../Input/Input';
|
import { getInputStyles } from '../Input/Input';
|
||||||
import { css, cx } from '@emotion/css';
|
import { css, cx } from '@emotion/css';
|
||||||
import { stylesFactory } from '../../themes';
|
import { stylesFactory } from '../../themes';
|
||||||
import { GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { focusCss } from '../../themes/mixins';
|
import { focusCss } from '../../themes/mixins';
|
||||||
|
|
||||||
interface InputControlProps {
|
interface InputControlProps {
|
||||||
@ -17,7 +17,7 @@ interface InputControlProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const getInputControlStyles = stylesFactory(
|
const getInputControlStyles = stylesFactory(
|
||||||
(theme: GrafanaThemeV2, invalid: boolean, focused: boolean, disabled: boolean, withPrefix: boolean) => {
|
(theme: GrafanaTheme2, invalid: boolean, focused: boolean, disabled: boolean, withPrefix: boolean) => {
|
||||||
const styles = getInputStyles({ theme, invalid });
|
const styles = getInputStyles({ theme, invalid });
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -6,9 +6,9 @@ import { useStyles2 } from '../../themes';
|
|||||||
import { SlideOutTransition } from '../transitions/SlideOutTransition';
|
import { SlideOutTransition } from '../transitions/SlideOutTransition';
|
||||||
import { FadeTransition } from '../transitions/FadeTransition';
|
import { FadeTransition } from '../transitions/FadeTransition';
|
||||||
import { Spinner } from '../Spinner/Spinner';
|
import { Spinner } from '../Spinner/Spinner';
|
||||||
import { GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
|
|
||||||
const getStyles = (theme: GrafanaThemeV2) => {
|
const getStyles = (theme: GrafanaTheme2) => {
|
||||||
const singleValue = css`
|
const singleValue = css`
|
||||||
label: singleValue;
|
label: singleValue;
|
||||||
color: ${theme.components.input.text};
|
color: ${theme.components.input.text};
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { stylesFactory } from '../../themes/stylesFactory';
|
import { stylesFactory } from '../../themes/stylesFactory';
|
||||||
import { css } from '@emotion/css';
|
import { css } from '@emotion/css';
|
||||||
import { GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
|
|
||||||
export const getSelectStyles = stylesFactory((theme: GrafanaThemeV2) => {
|
export const getSelectStyles = stylesFactory((theme: GrafanaTheme2) => {
|
||||||
return {
|
return {
|
||||||
menu: css`
|
menu: css`
|
||||||
label: grafana-select-menu;
|
label: grafana-select-menu;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { stylesFactory } from '../../themes';
|
import { stylesFactory } from '../../themes';
|
||||||
import { GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { css as cssCore } from '@emotion/react';
|
import { css as cssCore } from '@emotion/react';
|
||||||
import { css } from '@emotion/css';
|
import { css } from '@emotion/css';
|
||||||
|
|
||||||
export const getStyles = stylesFactory((theme: GrafanaThemeV2, isHorizontal: boolean) => {
|
export const getStyles = stylesFactory((theme: GrafanaTheme2, isHorizontal: boolean) => {
|
||||||
const { spacing } = theme;
|
const { spacing } = theme;
|
||||||
const railColor = theme.colors.border.strong;
|
const railColor = theme.colors.border.strong;
|
||||||
const trackColor = theme.colors.primary.main;
|
const trackColor = theme.colors.primary.main;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React, { HTMLProps, useRef } from 'react';
|
import React, { HTMLProps, useRef } from 'react';
|
||||||
import { css, cx } from '@emotion/css';
|
import { css, cx } from '@emotion/css';
|
||||||
import { uniqueId } from 'lodash';
|
import { uniqueId } from 'lodash';
|
||||||
import { GrafanaThemeV2, deprecationWarning } from '@grafana/data';
|
import { GrafanaTheme2, deprecationWarning } from '@grafana/data';
|
||||||
import { stylesFactory, useTheme2 } from '../../themes';
|
import { stylesFactory, useTheme2 } from '../../themes';
|
||||||
import { getFocusStyles, getMouseFocusStyles } from '../../themes/mixins';
|
import { getFocusStyles, getMouseFocusStyles } from '../../themes/mixins';
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ export const InlineSwitch = React.forwardRef<HTMLInputElement, Props>(({ transpa
|
|||||||
|
|
||||||
InlineSwitch.displayName = 'Switch';
|
InlineSwitch.displayName = 'Switch';
|
||||||
|
|
||||||
const getSwitchStyles = stylesFactory((theme: GrafanaThemeV2, transparent?: boolean) => {
|
const getSwitchStyles = stylesFactory((theme: GrafanaTheme2, transparent?: boolean) => {
|
||||||
return {
|
return {
|
||||||
switch: css`
|
switch: css`
|
||||||
width: 32px;
|
width: 32px;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { css } from '@emotion/css';
|
import { css } from '@emotion/css';
|
||||||
|
|
||||||
import { SelectableValue, GrafanaThemeV2 } from '@grafana/data';
|
import { SelectableValue, GrafanaTheme2 } from '@grafana/data';
|
||||||
import { stylesFactory, useTheme2 } from '../../themes';
|
import { stylesFactory, useTheme2 } from '../../themes';
|
||||||
import { IconName, TabsBar, Tab, IconButton, CustomScrollbar, TabContent } from '../..';
|
import { IconName, TabsBar, Tab, IconButton, CustomScrollbar, TabContent } from '../..';
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ export interface TabbedContainerProps {
|
|||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const getStyles = stylesFactory((theme: GrafanaThemeV2) => {
|
const getStyles = stylesFactory((theme: GrafanaTheme2) => {
|
||||||
return {
|
return {
|
||||||
container: css`
|
container: css`
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React, { FC, useCallback, useMemo, useState } from 'react';
|
import React, { FC, useCallback, useMemo, useState } from 'react';
|
||||||
import { FixedSizeList as List } from 'react-window';
|
import { FixedSizeList as List } from 'react-window';
|
||||||
import { css } from '@emotion/css';
|
import { css } from '@emotion/css';
|
||||||
import { GrafanaThemeV2, SelectableValue } from '@grafana/data';
|
import { GrafanaTheme2, SelectableValue } from '@grafana/data';
|
||||||
|
|
||||||
import { stylesFactory, useTheme2 } from '../../themes';
|
import { stylesFactory, useTheme2 } from '../../themes';
|
||||||
import { Checkbox, Input, Label, VerticalGroup } from '..';
|
import { Checkbox, Input, Label, VerticalGroup } from '..';
|
||||||
@ -78,7 +78,7 @@ export const FilterList: FC<Props> = ({ options, values, onChange }) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const getStyles = stylesFactory((theme: GrafanaThemeV2) => ({
|
const getStyles = stylesFactory((theme: GrafanaTheme2) => ({
|
||||||
filterList: css`
|
filterList: css`
|
||||||
label: filterList;
|
label: filterList;
|
||||||
`,
|
`,
|
||||||
|
@ -8,7 +8,7 @@ import mdx from './Table.mdx';
|
|||||||
import {
|
import {
|
||||||
DataFrame,
|
DataFrame,
|
||||||
FieldType,
|
FieldType,
|
||||||
GrafanaThemeV2,
|
GrafanaTheme2,
|
||||||
MutableDataFrame,
|
MutableDataFrame,
|
||||||
ThresholdsConfig,
|
ThresholdsConfig,
|
||||||
ThresholdsMode,
|
ThresholdsMode,
|
||||||
@ -27,7 +27,7 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
function buildData(theme: GrafanaThemeV2, config: Record<string, FieldConfig>): DataFrame {
|
function buildData(theme: GrafanaTheme2, config: Record<string, FieldConfig>): DataFrame {
|
||||||
const data = new MutableDataFrame({
|
const data = new MutableDataFrame({
|
||||||
fields: [
|
fields: [
|
||||||
{ name: 'Time', type: FieldType.time, values: [] }, // The time field
|
{ name: 'Time', type: FieldType.time, values: [] }, // The time field
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { css, cx } from '@emotion/css';
|
import { css, cx } from '@emotion/css';
|
||||||
import { GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { getScrollbarWidth } from '../../utils';
|
import { getScrollbarWidth } from '../../utils';
|
||||||
|
|
||||||
export const getTableStyles = (theme: GrafanaThemeV2) => {
|
export const getTableStyles = (theme: GrafanaTheme2) => {
|
||||||
const { colors } = theme;
|
const { colors } = theme;
|
||||||
const headerBg = theme.colors.background.secondary;
|
const headerBg = theme.colors.background.secondary;
|
||||||
const borderColor = theme.colors.border.weak;
|
const borderColor = theme.colors.border.weak;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import React, { FC } from 'react';
|
import React, { FC } from 'react';
|
||||||
import { css } from '@emotion/css';
|
import { css } from '@emotion/css';
|
||||||
import { stylesFactory, useStyles2 } from '../../themes';
|
import { stylesFactory, useStyles2 } from '../../themes';
|
||||||
import { GrafanaThemeV2, locale } from '@grafana/data';
|
import { GrafanaTheme2, locale } from '@grafana/data';
|
||||||
|
|
||||||
const getStyles = stylesFactory((theme: GrafanaThemeV2) => {
|
const getStyles = stylesFactory((theme: GrafanaTheme2) => {
|
||||||
return {
|
return {
|
||||||
counter: css`
|
counter: css`
|
||||||
label: counter;
|
label: counter;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React, { HTMLProps } from 'react';
|
import React, { HTMLProps } from 'react';
|
||||||
import { css, cx } from '@emotion/css';
|
import { css, cx } from '@emotion/css';
|
||||||
import { GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { selectors } from '@grafana/e2e-selectors';
|
import { selectors } from '@grafana/e2e-selectors';
|
||||||
|
|
||||||
import { Icon } from '../Icon/Icon';
|
import { Icon } from '../Icon/Icon';
|
||||||
@ -52,7 +52,7 @@ export const Tab = React.forwardRef<HTMLAnchorElement, TabProps>(
|
|||||||
|
|
||||||
Tab.displayName = 'Tab';
|
Tab.displayName = 'Tab';
|
||||||
|
|
||||||
const getTabStyles = stylesFactory((theme: GrafanaThemeV2) => {
|
const getTabStyles = stylesFactory((theme: GrafanaTheme2) => {
|
||||||
return {
|
return {
|
||||||
item: css`
|
item: css`
|
||||||
list-style: none;
|
list-style: none;
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
import React, { FC, HTMLAttributes, ReactNode } from 'react';
|
import React, { FC, HTMLAttributes, ReactNode } from 'react';
|
||||||
import { stylesFactory, useTheme2 } from '../../themes';
|
import { stylesFactory, useTheme2 } from '../../themes';
|
||||||
import { css, cx } from '@emotion/css';
|
import { css, cx } from '@emotion/css';
|
||||||
import { GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
|
|
||||||
interface Props extends HTMLAttributes<HTMLDivElement> {
|
interface Props extends HTMLAttributes<HTMLDivElement> {
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
const getTabContentStyle = stylesFactory((theme: GrafanaThemeV2) => {
|
const getTabContentStyle = stylesFactory((theme: GrafanaTheme2) => {
|
||||||
return {
|
return {
|
||||||
tabContent: css`
|
tabContent: css`
|
||||||
background: ${theme.colors.background.primary};
|
background: ${theme.colors.background.primary};
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React, { ReactNode } from 'react';
|
import React, { ReactNode } from 'react';
|
||||||
import { stylesFactory, useTheme2 } from '../../themes';
|
import { stylesFactory, useTheme2 } from '../../themes';
|
||||||
import { GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { css, cx } from '@emotion/css';
|
import { css, cx } from '@emotion/css';
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
@ -11,7 +11,7 @@ export interface Props {
|
|||||||
hideBorder?: boolean;
|
hideBorder?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const getTabsBarStyles = stylesFactory((theme: GrafanaThemeV2, hideBorder = false) => {
|
const getTabsBarStyles = stylesFactory((theme: GrafanaTheme2, hideBorder = false) => {
|
||||||
return {
|
return {
|
||||||
tabsWrapper:
|
tabsWrapper:
|
||||||
!hideBorder &&
|
!hideBorder &&
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import React, { HTMLProps } from 'react';
|
import React, { HTMLProps } from 'react';
|
||||||
import { GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { css, cx } from '@emotion/css';
|
import { css, cx } from '@emotion/css';
|
||||||
import { stylesFactory, useTheme2 } from '../../themes';
|
import { stylesFactory, useTheme2 } from '../../themes';
|
||||||
import { getFocusStyle, sharedInputStyle } from '../Forms/commonStyles';
|
import { getFocusStyle, sharedInputStyle } from '../Forms/commonStyles';
|
||||||
@ -16,7 +16,7 @@ export const TextArea = React.forwardRef<HTMLTextAreaElement, Props>(({ invalid,
|
|||||||
return <textarea {...props} className={cx(styles.textarea, className)} ref={ref} />;
|
return <textarea {...props} className={cx(styles.textarea, className)} ref={ref} />;
|
||||||
});
|
});
|
||||||
|
|
||||||
const getTextAreaStyle = stylesFactory((theme: GrafanaThemeV2, invalid = false) => {
|
const getTextAreaStyle = stylesFactory((theme: GrafanaTheme2, invalid = false) => {
|
||||||
return {
|
return {
|
||||||
textarea: cx(
|
textarea: cx(
|
||||||
sharedInputStyle(theme),
|
sharedInputStyle(theme),
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @jsxImportSource @emotion/react */
|
/** @jsxImportSource @emotion/react */
|
||||||
|
|
||||||
import { Profiler, ProfilerOnRenderCallback, useState, FC } from 'react';
|
import { Profiler, ProfilerOnRenderCallback, useState, FC } from 'react';
|
||||||
import { GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { css, cx } from '@emotion/css';
|
import { css, cx } from '@emotion/css';
|
||||||
import { useStyles2, useTheme2 } from '../../themes';
|
import { useStyles2, useTheme2 } from '../../themes';
|
||||||
import { Button } from '../Button';
|
import { Button } from '../Button';
|
||||||
@ -141,7 +141,7 @@ function MeasureRender({ children, id }: { children: React.ReactNode; id: string
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const getStyles = (theme: GrafanaThemeV2) => {
|
const getStyles = (theme: GrafanaTheme2) => {
|
||||||
return {
|
return {
|
||||||
main: css(getStylesObjectMain(theme)),
|
main: css(getStylesObjectMain(theme)),
|
||||||
large: css({
|
large: css({
|
||||||
@ -156,7 +156,7 @@ const getStyles = (theme: GrafanaThemeV2) => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const getStylesObjects = (theme: GrafanaThemeV2) => {
|
const getStylesObjects = (theme: GrafanaTheme2) => {
|
||||||
return {
|
return {
|
||||||
main: getStylesObjectMain(theme),
|
main: getStylesObjectMain(theme),
|
||||||
large: {
|
large: {
|
||||||
@ -171,7 +171,7 @@ const getStylesObjects = (theme: GrafanaThemeV2) => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
function getStylesObjectMain(theme: GrafanaThemeV2): any {
|
function getStylesObjectMain(theme: GrafanaTheme2): any {
|
||||||
return {
|
return {
|
||||||
background: 'blue',
|
background: 'blue',
|
||||||
border: '1px solid red',
|
border: '1px solid red',
|
||||||
@ -184,7 +184,7 @@ function getStylesObjectMain(theme: GrafanaThemeV2): any {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function getStylesObjectChild(theme: GrafanaThemeV2): any {
|
function getStylesObjectChild(theme: GrafanaTheme2): any {
|
||||||
return {
|
return {
|
||||||
padding: '2px',
|
padding: '2px',
|
||||||
fontSize: '10px',
|
fontSize: '10px',
|
||||||
|
@ -3,7 +3,7 @@ import { css, cx } from '@emotion/css';
|
|||||||
import { useTheme2 } from '../../themes/ThemeContext';
|
import { useTheme2 } from '../../themes/ThemeContext';
|
||||||
import { Icon } from '../Icon/Icon';
|
import { Icon } from '../Icon/Icon';
|
||||||
import { HorizontalGroup, VerticalGroup } from '../Layout/Layout';
|
import { HorizontalGroup, VerticalGroup } from '../Layout/Layout';
|
||||||
import { GrafanaThemeV2, ThemeRichColor } from '@grafana/data';
|
import { GrafanaTheme2, ThemeRichColor } from '@grafana/data';
|
||||||
import { CollapsableSection } from '../Collapse/CollapsableSection';
|
import { CollapsableSection } from '../Collapse/CollapsableSection';
|
||||||
import { Field } from '../Forms/Field';
|
import { Field } from '../Forms/Field';
|
||||||
import { Input } from '../Input/Input';
|
import { Input } from '../Input/Input';
|
||||||
@ -211,7 +211,7 @@ export const ThemeDemo = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
interface RichColorDemoProps {
|
interface RichColorDemoProps {
|
||||||
theme: GrafanaThemeV2;
|
theme: GrafanaTheme2;
|
||||||
color: ThemeRichColor;
|
color: ThemeRichColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -269,7 +269,7 @@ const colorsTableStyle = css`
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export function TextColors({ t }: { t: GrafanaThemeV2 }) {
|
export function TextColors({ t }: { t: GrafanaTheme2 }) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<DemoText color={t.colors.text.primary}>
|
<DemoText color={t.colors.text.primary}>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React, { FC, FormEvent, MouseEvent, useState } from 'react';
|
import React, { FC, FormEvent, MouseEvent, useState } from 'react';
|
||||||
import { css, cx } from '@emotion/css';
|
import { css, cx } from '@emotion/css';
|
||||||
import { dateMath, dateTime, getDefaultTimeRange, GrafanaThemeV2, TimeRange, TimeZone } from '@grafana/data';
|
import { dateMath, dateTime, getDefaultTimeRange, GrafanaTheme2, TimeRange, TimeZone } from '@grafana/data';
|
||||||
import { useStyles2 } from '../../themes/ThemeContext';
|
import { useStyles2 } from '../../themes/ThemeContext';
|
||||||
import { ClickOutsideWrapper } from '../ClickOutsideWrapper/ClickOutsideWrapper';
|
import { ClickOutsideWrapper } from '../ClickOutsideWrapper/ClickOutsideWrapper';
|
||||||
import { Icon } from '../Icon/Icon';
|
import { Icon } from '../Icon/Icon';
|
||||||
@ -106,7 +106,7 @@ export const TimeRangeInput: FC<TimeRangeInputProps> = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const getStyles = (theme: GrafanaThemeV2) => {
|
const getStyles = (theme: GrafanaTheme2) => {
|
||||||
const inputStyles = getInputStyles({ theme, invalid: false });
|
const inputStyles = getInputStyles({ theme, invalid: false });
|
||||||
return {
|
return {
|
||||||
container: css`
|
container: css`
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React, { FormEvent, memo, useCallback } from 'react';
|
import React, { FormEvent, memo, useCallback } from 'react';
|
||||||
import { css } from '@emotion/css';
|
import { css } from '@emotion/css';
|
||||||
import Calendar from 'react-calendar/dist/entry.nostyle';
|
import Calendar from 'react-calendar/dist/entry.nostyle';
|
||||||
import { dateTime, DateTime, dateTimeParse, GrafanaThemeV2, TimeZone } from '@grafana/data';
|
import { dateTime, DateTime, dateTimeParse, GrafanaTheme2, TimeZone } from '@grafana/data';
|
||||||
import { stylesFactory, useTheme2 } from '../../../themes';
|
import { stylesFactory, useTheme2 } from '../../../themes';
|
||||||
import { TimePickerTitle } from './TimePickerTitle';
|
import { TimePickerTitle } from './TimePickerTitle';
|
||||||
import { Button } from '../../Button';
|
import { Button } from '../../Button';
|
||||||
@ -9,7 +9,7 @@ import { Icon } from '../../Icon/Icon';
|
|||||||
import { Portal } from '../../Portal/Portal';
|
import { Portal } from '../../Portal/Portal';
|
||||||
import { ClickOutsideWrapper } from '../../ClickOutsideWrapper/ClickOutsideWrapper';
|
import { ClickOutsideWrapper } from '../../ClickOutsideWrapper/ClickOutsideWrapper';
|
||||||
|
|
||||||
const getStyles = stylesFactory((theme: GrafanaThemeV2, isReversed = false) => {
|
const getStyles = stylesFactory((theme: GrafanaTheme2, isReversed = false) => {
|
||||||
return {
|
return {
|
||||||
container: css`
|
container: css`
|
||||||
top: -1px;
|
top: -1px;
|
||||||
@ -57,7 +57,7 @@ const getStyles = stylesFactory((theme: GrafanaThemeV2, isReversed = false) => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
const getFooterStyles = stylesFactory((theme: GrafanaThemeV2) => {
|
const getFooterStyles = stylesFactory((theme: GrafanaTheme2) => {
|
||||||
return {
|
return {
|
||||||
container: css`
|
container: css`
|
||||||
background-color: ${theme.colors.background.primary};
|
background-color: ${theme.colors.background.primary};
|
||||||
@ -74,7 +74,7 @@ const getFooterStyles = stylesFactory((theme: GrafanaThemeV2) => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
const getBodyStyles = stylesFactory((theme: GrafanaThemeV2) => {
|
const getBodyStyles = stylesFactory((theme: GrafanaTheme2) => {
|
||||||
return {
|
return {
|
||||||
title: css`
|
title: css`
|
||||||
color: ${theme.colors.text};
|
color: ${theme.colors.text};
|
||||||
@ -171,7 +171,7 @@ const getBodyStyles = stylesFactory((theme: GrafanaThemeV2) => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
const getHeaderStyles = stylesFactory((theme: GrafanaThemeV2) => {
|
const getHeaderStyles = stylesFactory((theme: GrafanaTheme2) => {
|
||||||
return {
|
return {
|
||||||
container: css`
|
container: css`
|
||||||
background-color: ${theme.colors.background.primary};
|
background-color: ${theme.colors.background.primary};
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { GrafanaThemeV2, isDateTime, TimeOption, TimeRange, TimeZone } from '@grafana/data';
|
import { GrafanaTheme2, isDateTime, TimeOption, TimeRange, TimeZone } from '@grafana/data';
|
||||||
import { css, cx } from '@emotion/css';
|
import { css, cx } from '@emotion/css';
|
||||||
import React, { memo, useState } from 'react';
|
import React, { memo, useState } from 'react';
|
||||||
import { useMedia } from 'react-use';
|
import { useMedia } from 'react-use';
|
||||||
@ -11,7 +11,7 @@ import { TimeRangeForm } from './TimeRangeForm';
|
|||||||
import { TimeRangeList } from './TimeRangeList';
|
import { TimeRangeList } from './TimeRangeList';
|
||||||
import { TimePickerFooter } from './TimePickerFooter';
|
import { TimePickerFooter } from './TimePickerFooter';
|
||||||
|
|
||||||
const getStyles = stylesFactory((theme: GrafanaThemeV2, isReversed, hideQuickRanges, isContainerTall) => {
|
const getStyles = stylesFactory((theme: GrafanaTheme2, isReversed, hideQuickRanges, isContainerTall) => {
|
||||||
return {
|
return {
|
||||||
container: css`
|
container: css`
|
||||||
background: ${theme.colors.background.primary};
|
background: ${theme.colors.background.primary};
|
||||||
@ -54,7 +54,7 @@ const getStyles = stylesFactory((theme: GrafanaThemeV2, isReversed, hideQuickRan
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
const getNarrowScreenStyles = stylesFactory((theme: GrafanaThemeV2) => {
|
const getNarrowScreenStyles = stylesFactory((theme: GrafanaTheme2) => {
|
||||||
return {
|
return {
|
||||||
header: css`
|
header: css`
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -73,7 +73,7 @@ const getNarrowScreenStyles = stylesFactory((theme: GrafanaThemeV2) => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
const getFullScreenStyles = stylesFactory((theme: GrafanaThemeV2, hideQuickRanges?: boolean) => {
|
const getFullScreenStyles = stylesFactory((theme: GrafanaTheme2, hideQuickRanges?: boolean) => {
|
||||||
return {
|
return {
|
||||||
container: css`
|
container: css`
|
||||||
padding-top: 9px;
|
padding-top: 9px;
|
||||||
@ -93,7 +93,7 @@ const getFullScreenStyles = stylesFactory((theme: GrafanaThemeV2, hideQuickRange
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
const getEmptyListStyles = stylesFactory((theme: GrafanaThemeV2) => {
|
const getEmptyListStyles = stylesFactory((theme: GrafanaTheme2) => {
|
||||||
return {
|
return {
|
||||||
container: css`
|
container: css`
|
||||||
padding: 12px;
|
padding: 12px;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React, { FC, useState, useCallback } from 'react';
|
import React, { FC, useState, useCallback } from 'react';
|
||||||
import { css, cx } from '@emotion/css';
|
import { css, cx } from '@emotion/css';
|
||||||
import { TimeZone, GrafanaThemeV2, getTimeZoneInfo } from '@grafana/data';
|
import { TimeZone, GrafanaTheme2, getTimeZoneInfo } from '@grafana/data';
|
||||||
import { stylesFactory, useTheme2 } from '../../../themes';
|
import { stylesFactory, useTheme2 } from '../../../themes';
|
||||||
import { TimeZoneTitle } from '../TimeZonePicker/TimeZoneTitle';
|
import { TimeZoneTitle } from '../TimeZonePicker/TimeZoneTitle';
|
||||||
import { TimeZoneDescription } from '../TimeZonePicker/TimeZoneDescription';
|
import { TimeZoneDescription } from '../TimeZonePicker/TimeZoneDescription';
|
||||||
@ -82,7 +82,7 @@ export const TimePickerFooter: FC<Props> = (props) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const getStyle = stylesFactory((theme: GrafanaThemeV2) => {
|
const getStyle = stylesFactory((theme: GrafanaTheme2) => {
|
||||||
return {
|
return {
|
||||||
container: css`
|
container: css`
|
||||||
border-top: 1px solid ${theme.colors.border.weak};
|
border-top: 1px solid ${theme.colors.border.weak};
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import React, { memo } from 'react';
|
import React, { memo } from 'react';
|
||||||
import { css, cx } from '@emotion/css';
|
import { css, cx } from '@emotion/css';
|
||||||
import { GrafanaThemeV2, TimeOption } from '@grafana/data';
|
import { GrafanaTheme2, TimeOption } from '@grafana/data';
|
||||||
import { useStyles2 } from '../../../themes/ThemeContext';
|
import { useStyles2 } from '../../../themes/ThemeContext';
|
||||||
|
|
||||||
const getStyles = (theme: GrafanaThemeV2) => {
|
const getStyles = (theme: GrafanaTheme2) => {
|
||||||
return {
|
return {
|
||||||
container: css`
|
container: css`
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React, { PropsWithChildren } from 'react';
|
import React, { PropsWithChildren } from 'react';
|
||||||
import { css, cx } from '@emotion/css';
|
import { css, cx } from '@emotion/css';
|
||||||
import { GrafanaThemeV2, SelectableValue, getTimeZoneInfo } from '@grafana/data';
|
import { GrafanaTheme2, SelectableValue, getTimeZoneInfo } from '@grafana/data';
|
||||||
import { useTheme2 } from '../../../themes/ThemeContext';
|
import { useTheme2 } from '../../../themes/ThemeContext';
|
||||||
import { stylesFactory } from '../../../themes/stylesFactory';
|
import { stylesFactory } from '../../../themes/stylesFactory';
|
||||||
import { Icon } from '../../Icon/Icon';
|
import { Icon } from '../../Icon/Icon';
|
||||||
@ -93,7 +93,7 @@ export const CompactTimeZoneOption: React.FC<PropsWithChildren<Props>> = (props,
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const getStyles = stylesFactory((theme: GrafanaThemeV2) => {
|
const getStyles = stylesFactory((theme: GrafanaTheme2) => {
|
||||||
return {
|
return {
|
||||||
container: css`
|
container: css`
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -11,7 +11,7 @@ import {
|
|||||||
TimeZone,
|
TimeZone,
|
||||||
classicColors,
|
classicColors,
|
||||||
Field,
|
Field,
|
||||||
GrafanaThemeV2,
|
GrafanaTheme2,
|
||||||
} from '@grafana/data';
|
} from '@grafana/data';
|
||||||
import { UPlotConfigBuilder } from '../uPlot/config/UPlotConfigBuilder';
|
import { UPlotConfigBuilder } from '../uPlot/config/UPlotConfigBuilder';
|
||||||
import { TimelineCoreOptions, getConfig } from './timeline';
|
import { TimelineCoreOptions, getConfig } from './timeline';
|
||||||
@ -45,14 +45,14 @@ export function preparePlotFrame(data: DataFrame[], dimFields: XYFieldMatchers)
|
|||||||
|
|
||||||
export type uPlotConfigBuilderSupplier = (
|
export type uPlotConfigBuilderSupplier = (
|
||||||
frame: DataFrame,
|
frame: DataFrame,
|
||||||
theme: GrafanaThemeV2,
|
theme: GrafanaTheme2,
|
||||||
getTimeRange: () => TimeRange,
|
getTimeRange: () => TimeRange,
|
||||||
getTimeZone: () => TimeZone
|
getTimeZone: () => TimeZone
|
||||||
) => UPlotConfigBuilder;
|
) => UPlotConfigBuilder;
|
||||||
|
|
||||||
export function preparePlotConfigBuilder(
|
export function preparePlotConfigBuilder(
|
||||||
frame: DataFrame,
|
frame: DataFrame,
|
||||||
theme: GrafanaThemeV2,
|
theme: GrafanaTheme2,
|
||||||
getTimeRange: () => TimeRange,
|
getTimeRange: () => TimeRange,
|
||||||
getTimeZone: () => TimeZone,
|
getTimeZone: () => TimeZone,
|
||||||
coreOptions: Partial<TimelineCoreOptions>
|
coreOptions: Partial<TimelineCoreOptions>
|
||||||
|
@ -3,7 +3,7 @@ import { css, cx } from '@emotion/css';
|
|||||||
import { useStyles2 } from '../../themes';
|
import { useStyles2 } from '../../themes';
|
||||||
import { getTooltipContainerStyles } from '../../themes/mixins';
|
import { getTooltipContainerStyles } from '../../themes/mixins';
|
||||||
import useWindowSize from 'react-use/lib/useWindowSize';
|
import useWindowSize from 'react-use/lib/useWindowSize';
|
||||||
import { Dimensions2D, GrafanaThemeV2 } from '@grafana/data';
|
import { Dimensions2D, GrafanaTheme2 } from '@grafana/data';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
@ -105,7 +105,7 @@ export const VizTooltipContainer: React.FC<VizTooltipContainerProps> = ({
|
|||||||
|
|
||||||
VizTooltipContainer.displayName = 'VizTooltipContainer';
|
VizTooltipContainer.displayName = 'VizTooltipContainer';
|
||||||
|
|
||||||
const getStyles = (theme: GrafanaThemeV2) => ({
|
const getStyles = (theme: GrafanaTheme2) => ({
|
||||||
wrapper: css`
|
wrapper: css`
|
||||||
${getTooltipContainerStyles(theme)}
|
${getTooltipContainerStyles(theme)}
|
||||||
`,
|
`,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { dateTimeFormat, GrafanaThemeV2, systemDateFormats, TimeZone } from '@grafana/data';
|
import { dateTimeFormat, GrafanaTheme2, systemDateFormats, TimeZone } from '@grafana/data';
|
||||||
import uPlot, { Axis } from 'uplot';
|
import uPlot, { Axis } from 'uplot';
|
||||||
import { PlotConfigBuilder } from '../types';
|
import { PlotConfigBuilder } from '../types';
|
||||||
import { measureText } from '../../../utils/measureText';
|
import { measureText } from '../../../utils/measureText';
|
||||||
@ -7,7 +7,7 @@ import { optMinMax } from './UPlotScaleBuilder';
|
|||||||
|
|
||||||
export interface AxisProps {
|
export interface AxisProps {
|
||||||
scaleKey: string;
|
scaleKey: string;
|
||||||
theme: GrafanaThemeV2;
|
theme: GrafanaTheme2;
|
||||||
label?: string;
|
label?: string;
|
||||||
show?: boolean;
|
show?: boolean;
|
||||||
size?: number | null;
|
size?: number | null;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { DataFrameFieldIndex, FALLBACK_COLOR, FieldColorMode, GrafanaThemeV2, ThresholdsConfig } from '@grafana/data';
|
import { DataFrameFieldIndex, FALLBACK_COLOR, FieldColorMode, GrafanaTheme2, ThresholdsConfig } from '@grafana/data';
|
||||||
import tinycolor from 'tinycolor2';
|
import tinycolor from 'tinycolor2';
|
||||||
import uPlot, { Series } from 'uplot';
|
import uPlot, { Series } from 'uplot';
|
||||||
import {
|
import {
|
||||||
@ -30,7 +30,7 @@ export interface SeriesProps extends LineConfig, BarConfig, FillConfig, PointsCo
|
|||||||
show?: boolean;
|
show?: boolean;
|
||||||
dataFrameFieldIndex?: DataFrameFieldIndex;
|
dataFrameFieldIndex?: DataFrameFieldIndex;
|
||||||
hideInLegend?: boolean;
|
hideInLegend?: boolean;
|
||||||
theme: GrafanaThemeV2;
|
theme: GrafanaTheme2;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class UPlotSeriesBuilder extends PlotConfigBuilder<SeriesProps, Series> {
|
export class UPlotSeriesBuilder extends PlotConfigBuilder<SeriesProps, Series> {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { FieldColorMode, GrafanaThemeV2, ThresholdsConfig } from '@grafana/data';
|
import { FieldColorMode, GrafanaTheme2, ThresholdsConfig } from '@grafana/data';
|
||||||
import tinycolor from 'tinycolor2';
|
import tinycolor from 'tinycolor2';
|
||||||
import uPlot from 'uplot';
|
import uPlot from 'uplot';
|
||||||
import { getCanvasContext } from '../../../utils/measureText';
|
import { getCanvasContext } from '../../../utils/measureText';
|
||||||
@ -20,7 +20,7 @@ export function getOpacityGradientFn(
|
|||||||
export function getHueGradientFn(
|
export function getHueGradientFn(
|
||||||
color: string,
|
color: string,
|
||||||
opacity: number,
|
opacity: number,
|
||||||
theme: GrafanaThemeV2
|
theme: GrafanaTheme2
|
||||||
): (self: uPlot, seriesIdx: number) => CanvasGradient {
|
): (self: uPlot, seriesIdx: number) => CanvasGradient {
|
||||||
return (plot: uPlot, seriesIdx: number) => {
|
return (plot: uPlot, seriesIdx: number) => {
|
||||||
const ctx = getCanvasContext();
|
const ctx = getCanvasContext();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { css } from '@emotion/react';
|
import { css } from '@emotion/react';
|
||||||
import { GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
|
|
||||||
export function getAgularPanelStyles(theme: GrafanaThemeV2) {
|
export function getAgularPanelStyles(theme: GrafanaTheme2) {
|
||||||
return css`
|
return css`
|
||||||
.panel-options-group {
|
.panel-options-group {
|
||||||
border-bottom: 1px solid ${theme.colors.border.weak};
|
border-bottom: 1px solid ${theme.colors.border.weak};
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { css } from '@emotion/react';
|
import { css } from '@emotion/react';
|
||||||
import { GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
|
|
||||||
export function getCardStyles(theme: GrafanaThemeV2) {
|
export function getCardStyles(theme: GrafanaTheme2) {
|
||||||
return css`
|
return css`
|
||||||
.card-section {
|
.card-section {
|
||||||
margin-bottom: ${theme.spacing(4)};
|
margin-bottom: ${theme.spacing(4)};
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { css } from '@emotion/react';
|
import { css } from '@emotion/react';
|
||||||
import { GrafanaThemeV2, ThemeTypographyVariant } from '@grafana/data';
|
import { GrafanaTheme2, ThemeTypographyVariant } from '@grafana/data';
|
||||||
|
|
||||||
export function getElementStyles(theme: GrafanaThemeV2) {
|
export function getElementStyles(theme: GrafanaTheme2) {
|
||||||
return css`
|
return css`
|
||||||
html {
|
html {
|
||||||
-ms-overflow-style: scrollbar;
|
-ms-overflow-style: scrollbar;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { css } from '@emotion/react';
|
import { css } from '@emotion/react';
|
||||||
import { GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
|
|
||||||
export function getPageStyles(theme: GrafanaThemeV2) {
|
export function getPageStyles(theme: GrafanaTheme2) {
|
||||||
const maxWidthBreakpoint =
|
const maxWidthBreakpoint =
|
||||||
theme.breakpoints.values.xxl + theme.spacing.gridSize * 2 + theme.components.sidemenu.width;
|
theme.breakpoints.values.xxl + theme.spacing.gridSize * 2 + theme.components.sidemenu.width;
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { createTheme, GrafanaTheme, GrafanaThemeV2 } from '@grafana/data';
|
import { createTheme, GrafanaTheme, GrafanaTheme2 } from '@grafana/data';
|
||||||
import hoistNonReactStatics from 'hoist-non-react-statics';
|
import hoistNonReactStatics from 'hoist-non-react-statics';
|
||||||
import React, { useContext } from 'react';
|
import React, { useContext } from 'react';
|
||||||
import { Themeable, Themeable2 } from '../types/theme';
|
import { Themeable, Themeable2 } from '../types/theme';
|
||||||
@ -10,7 +10,7 @@ type Subtract<T, K> = Omit<T, keyof K>;
|
|||||||
/**
|
/**
|
||||||
* Mock used in tests
|
* Mock used in tests
|
||||||
*/
|
*/
|
||||||
let ThemeContextMock: React.Context<GrafanaThemeV2> | null = null;
|
let ThemeContextMock: React.Context<GrafanaTheme2> | null = null;
|
||||||
|
|
||||||
// Used by useStyles()
|
// Used by useStyles()
|
||||||
export const memoizedStyleCreators = new WeakMap();
|
export const memoizedStyleCreators = new WeakMap();
|
||||||
@ -66,7 +66,7 @@ export function useTheme(): GrafanaTheme {
|
|||||||
return useContext(ThemeContextMock || ThemeContext).v1;
|
return useContext(ThemeContextMock || ThemeContext).v1;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useTheme2(): GrafanaThemeV2 {
|
export function useTheme2(): GrafanaTheme2 {
|
||||||
return useContext(ThemeContextMock || ThemeContext);
|
return useContext(ThemeContextMock || ThemeContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ export function useStyles<T>(getStyles: (theme: GrafanaTheme) => T) {
|
|||||||
* you pass in doesn't change, or only if it needs to. (i.e. declare
|
* you pass in doesn't change, or only if it needs to. (i.e. declare
|
||||||
* your style creator outside of a function component or use `useCallback()`.)
|
* your style creator outside of a function component or use `useCallback()`.)
|
||||||
* */
|
* */
|
||||||
export function useStyles2<T>(getStyles: (theme: GrafanaThemeV2) => T) {
|
export function useStyles2<T>(getStyles: (theme: GrafanaTheme2) => T) {
|
||||||
const theme = useTheme2();
|
const theme = useTheme2();
|
||||||
|
|
||||||
let memoizedStyleCreator = memoizedStyleCreators.get(getStyles) as typeof getStyles;
|
let memoizedStyleCreator = memoizedStyleCreators.get(getStyles) as typeof getStyles;
|
||||||
@ -111,8 +111,8 @@ export function useStyles2<T>(getStyles: (theme: GrafanaThemeV2) => T) {
|
|||||||
/**
|
/**
|
||||||
* Enables theme context mocking
|
* Enables theme context mocking
|
||||||
*/
|
*/
|
||||||
export const mockThemeContext = (theme: Partial<GrafanaThemeV2>) => {
|
export const mockThemeContext = (theme: Partial<GrafanaTheme2>) => {
|
||||||
ThemeContextMock = React.createContext(theme as GrafanaThemeV2);
|
ThemeContextMock = React.createContext(theme as GrafanaTheme2);
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
ThemeContextMock = null;
|
ThemeContextMock = null;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
/* eslint-disable max-len */
|
/* eslint-disable max-len */
|
||||||
|
|
||||||
import { GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { renderGeneratedFileBanner } from '../utils/generatedFileBanner';
|
import { renderGeneratedFileBanner } from '../utils/generatedFileBanner';
|
||||||
|
|
||||||
export const darkThemeVarsTemplate = (theme: GrafanaThemeV2) =>
|
export const darkThemeVarsTemplate = (theme: GrafanaTheme2) =>
|
||||||
`${renderGeneratedFileBanner('grafana-ui/src/themes/dark.ts', 'grafana-ui/src/themes/_variables.dark.scss.tmpl.ts')}
|
`${renderGeneratedFileBanner('grafana-ui/src/themes/dark.ts', 'grafana-ui/src/themes/_variables.dark.scss.tmpl.ts')}
|
||||||
// Global values
|
// Global values
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
import { renderGeneratedFileBanner } from '../utils/generatedFileBanner';
|
import { renderGeneratedFileBanner } from '../utils/generatedFileBanner';
|
||||||
import { styleMixins } from '.';
|
import { styleMixins } from '.';
|
||||||
import { GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
|
|
||||||
export const lightThemeVarsTemplate = (theme: GrafanaThemeV2) =>
|
export const lightThemeVarsTemplate = (theme: GrafanaTheme2) =>
|
||||||
`${renderGeneratedFileBanner('grafana-ui/src/themes/light.ts', 'grafana-ui/src/themes/_variable.light.scss.tmpl.ts')}
|
`${renderGeneratedFileBanner('grafana-ui/src/themes/light.ts', 'grafana-ui/src/themes/_variable.light.scss.tmpl.ts')}
|
||||||
// Global values
|
// Global values
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
/* eslint-disable max-len */
|
/* eslint-disable max-len */
|
||||||
|
|
||||||
import { GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { renderGeneratedFileBanner } from '../utils/generatedFileBanner';
|
import { renderGeneratedFileBanner } from '../utils/generatedFileBanner';
|
||||||
|
|
||||||
export const commonThemeVarsTemplate = (theme: GrafanaThemeV2) =>
|
export const commonThemeVarsTemplate = (theme: GrafanaTheme2) =>
|
||||||
`${renderGeneratedFileBanner('grafana-ui/src/themes/default.ts', 'grafana-ui/src/themes/_variables.scss.tmpl.ts')}
|
`${renderGeneratedFileBanner('grafana-ui/src/themes/default.ts', 'grafana-ui/src/themes/_variables.scss.tmpl.ts')}
|
||||||
// Options
|
// Options
|
||||||
//
|
//
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { CSSObject } from '@emotion/css';
|
import { CSSObject } from '@emotion/css';
|
||||||
import { GrafanaTheme, GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme, GrafanaTheme2 } from '@grafana/data';
|
||||||
import tinycolor from 'tinycolor2';
|
import tinycolor from 'tinycolor2';
|
||||||
|
|
||||||
export function cardChrome(theme: GrafanaTheme): string {
|
export function cardChrome(theme: GrafanaTheme): string {
|
||||||
@ -46,14 +46,14 @@ export const focusCss = (theme: GrafanaTheme) => `
|
|||||||
transition: all 0.2s cubic-bezier(0.19, 1, 0.22, 1);
|
transition: all 0.2s cubic-bezier(0.19, 1, 0.22, 1);
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export function getMouseFocusStyles(theme: GrafanaThemeV2): CSSObject {
|
export function getMouseFocusStyles(theme: GrafanaTheme2): CSSObject {
|
||||||
return {
|
return {
|
||||||
outline: 'none',
|
outline: 'none',
|
||||||
boxShadow: `none`,
|
boxShadow: `none`,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getFocusStyles(theme: GrafanaThemeV2): CSSObject {
|
export function getFocusStyles(theme: GrafanaTheme2): CSSObject {
|
||||||
return {
|
return {
|
||||||
outline: '2px dotted transparent',
|
outline: '2px dotted transparent',
|
||||||
outlineOffset: '2px',
|
outlineOffset: '2px',
|
||||||
@ -63,7 +63,7 @@ export function getFocusStyles(theme: GrafanaThemeV2): CSSObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// max-width is set up based on .grafana-tooltip class that's used in dashboard
|
// max-width is set up based on .grafana-tooltip class that's used in dashboard
|
||||||
export const getTooltipContainerStyles = (theme: GrafanaThemeV2) => `
|
export const getTooltipContainerStyles = (theme: GrafanaTheme2) => `
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
background: ${theme.colors.background.secondary};
|
background: ${theme.colors.background.secondary};
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { GrafanaTheme, GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme, GrafanaTheme2 } from '@grafana/data';
|
||||||
|
|
||||||
export interface Themeable {
|
export interface Themeable {
|
||||||
theme: GrafanaTheme;
|
theme: GrafanaTheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Themeable2 {
|
export interface Themeable2 {
|
||||||
theme: GrafanaThemeV2;
|
theme: GrafanaTheme2;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { applyFieldOverrides, DataFrame, GrafanaThemeV2 } from '@grafana/data';
|
import { applyFieldOverrides, DataFrame, GrafanaTheme2 } from '@grafana/data';
|
||||||
|
|
||||||
export function prepDataForStorybook(data: DataFrame[], theme: GrafanaThemeV2) {
|
export function prepDataForStorybook(data: DataFrame[], theme: GrafanaTheme2) {
|
||||||
return applyFieldOverrides({
|
return applyFieldOverrides({
|
||||||
data: data,
|
data: data,
|
||||||
fieldConfig: {
|
fieldConfig: {
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { ThemeContext } from '../../themes/ThemeContext';
|
import { ThemeContext } from '../../themes/ThemeContext';
|
||||||
import { createTheme, GrafanaThemeV2 } from '@grafana/data';
|
import { createTheme, GrafanaTheme2 } from '@grafana/data';
|
||||||
import { RenderFunction } from '../../types';
|
import { RenderFunction } from '../../types';
|
||||||
import { useDarkMode } from 'storybook-dark-mode';
|
import { useDarkMode } from 'storybook-dark-mode';
|
||||||
import { GlobalStyles } from '../../themes/GlobalStyles/GlobalStyles';
|
import { GlobalStyles } from '../../themes/GlobalStyles/GlobalStyles';
|
||||||
|
|
||||||
type SassThemeChangeHandler = (theme: GrafanaThemeV2) => void;
|
type SassThemeChangeHandler = (theme: GrafanaTheme2) => void;
|
||||||
const ThemeableStory: React.FunctionComponent<{ handleSassThemeChange: SassThemeChangeHandler }> = ({
|
const ThemeableStory: React.FunctionComponent<{ handleSassThemeChange: SassThemeChangeHandler }> = ({
|
||||||
children,
|
children,
|
||||||
handleSassThemeChange,
|
handleSassThemeChange,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { css } from '@emotion/css';
|
import { css } from '@emotion/css';
|
||||||
import { IconButton, useStyles2 } from '@grafana/ui';
|
import { IconButton, useStyles2 } from '@grafana/ui';
|
||||||
import { GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
onClick: () => void;
|
onClick: () => void;
|
||||||
@ -12,7 +12,7 @@ export const CloseButton: React.FC<Props> = ({ onClick }) => {
|
|||||||
return <IconButton className={styles} name="times" onClick={onClick} />;
|
return <IconButton className={styles} name="times" onClick={onClick} />;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getStyles = (theme: GrafanaThemeV2) =>
|
const getStyles = (theme: GrafanaTheme2) =>
|
||||||
css`
|
css`
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: ${theme.spacing(0.5)};
|
right: ${theme.spacing(0.5)};
|
||||||
|
@ -2,7 +2,7 @@ import React from 'react';
|
|||||||
import config from 'app/core/config';
|
import config from 'app/core/config';
|
||||||
import { css, cx } from '@emotion/css';
|
import { css, cx } from '@emotion/css';
|
||||||
import { Icon, IconName, LinkButton, useStyles, useTheme2, VerticalGroup } from '@grafana/ui';
|
import { Icon, IconName, LinkButton, useStyles, useTheme2, VerticalGroup } from '@grafana/ui';
|
||||||
import { GrafanaTheme, GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme, GrafanaTheme2 } from '@grafana/data';
|
||||||
import { pickBy } from 'lodash';
|
import { pickBy } from 'lodash';
|
||||||
|
|
||||||
export interface LoginService {
|
export interface LoginService {
|
||||||
@ -124,7 +124,7 @@ const LoginDivider = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
function getButtonStyleFor(service: LoginService, styles: ReturnType<typeof getServiceStyles>, theme: GrafanaThemeV2) {
|
function getButtonStyleFor(service: LoginService, styles: ReturnType<typeof getServiceStyles>, theme: GrafanaTheme2) {
|
||||||
return cx(
|
return cx(
|
||||||
styles.button,
|
styles.button,
|
||||||
css`
|
css`
|
||||||
|
@ -7,7 +7,7 @@ import PageHeader from '../PageHeader/PageHeader';
|
|||||||
import { Footer } from '../Footer/Footer';
|
import { Footer } from '../Footer/Footer';
|
||||||
import { PageContents } from './PageContents';
|
import { PageContents } from './PageContents';
|
||||||
import { CustomScrollbar, useStyles2 } from '@grafana/ui';
|
import { CustomScrollbar, useStyles2 } from '@grafana/ui';
|
||||||
import { GrafanaThemeV2, NavModel } from '@grafana/data';
|
import { GrafanaTheme2, NavModel } from '@grafana/data';
|
||||||
import { Branding } from '../Branding/Branding';
|
import { Branding } from '../Branding/Branding';
|
||||||
import { css, cx } from '@emotion/css';
|
import { css, cx } from '@emotion/css';
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ Page.Contents = PageContents;
|
|||||||
|
|
||||||
export default Page;
|
export default Page;
|
||||||
|
|
||||||
const getStyles = (theme: GrafanaThemeV2) => ({
|
const getStyles = (theme: GrafanaTheme2) => ({
|
||||||
wrapper: css`
|
wrapper: css`
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React, { FC } from 'react';
|
import React, { FC } from 'react';
|
||||||
import { css } from '@emotion/css';
|
import { css } from '@emotion/css';
|
||||||
import { Tab, TabsBar, Icon, IconName, useStyles2 } from '@grafana/ui';
|
import { Tab, TabsBar, Icon, IconName, useStyles2 } from '@grafana/ui';
|
||||||
import { NavModel, NavModelItem, NavModelBreadcrumb, GrafanaThemeV2 } from '@grafana/data';
|
import { NavModel, NavModelItem, NavModelBreadcrumb, GrafanaTheme2 } from '@grafana/data';
|
||||||
import { PanelHeaderMenuItem } from 'app/features/dashboard/dashgrid/PanelHeader/PanelHeaderMenuItem';
|
import { PanelHeaderMenuItem } from 'app/features/dashboard/dashgrid/PanelHeader/PanelHeaderMenuItem';
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
@ -137,7 +137,7 @@ function renderTitle(title: string, breadcrumbs: NavModelBreadcrumb[]) {
|
|||||||
return <h1 className="page-header__title">{breadcrumbsResult}</h1>;
|
return <h1 className="page-header__title">{breadcrumbsResult}</h1>;
|
||||||
}
|
}
|
||||||
|
|
||||||
const getStyles = (theme: GrafanaThemeV2) => ({
|
const getStyles = (theme: GrafanaTheme2) => ({
|
||||||
headerCanvas: css`
|
headerCanvas: css`
|
||||||
background: ${theme.colors.background.canvas};
|
background: ${theme.colors.background.canvas};
|
||||||
`,
|
`,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import React, { useCallback, useMemo, useState } from 'react';
|
import React, { useCallback, useMemo, useState } from 'react';
|
||||||
import { GrafanaThemeV2, PanelPluginMeta, SelectableValue } from '@grafana/data';
|
import { GrafanaTheme2, PanelPluginMeta, SelectableValue } from '@grafana/data';
|
||||||
import { getAllPanelPluginMeta } from '../../../features/dashboard/components/VizTypePicker/VizTypePicker';
|
import { getAllPanelPluginMeta } from '../../../features/dashboard/components/VizTypePicker/VizTypePicker';
|
||||||
import { Icon, resetSelectStyles, Select, useStyles2 } from '@grafana/ui';
|
import { Icon, resetSelectStyles, Select, useStyles2 } from '@grafana/ui';
|
||||||
import { css } from '@emotion/css';
|
import { css } from '@emotion/css';
|
||||||
@ -61,7 +61,7 @@ export const PanelTypeFilter = ({ onChange: propsOnChange }: Props): JSX.Element
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
function getStyles(theme: GrafanaThemeV2) {
|
function getStyles(theme: GrafanaTheme2) {
|
||||||
return {
|
return {
|
||||||
container: css`
|
container: css`
|
||||||
label: container;
|
label: container;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { css } from '@emotion/css';
|
import { css } from '@emotion/css';
|
||||||
import { GrafanaThemeV2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { Modal, useStyles2 } from '@grafana/ui';
|
import { Modal, useStyles2 } from '@grafana/ui';
|
||||||
|
|
||||||
const shortcuts = {
|
const shortcuts = {
|
||||||
@ -85,7 +85,7 @@ export const HelpModal = ({ onDismiss }: HelpModalProps): JSX.Element => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
function getStyles(theme: GrafanaThemeV2) {
|
function getStyles(theme: GrafanaTheme2) {
|
||||||
return {
|
return {
|
||||||
titleDescription: css`
|
titleDescription: css`
|
||||||
font-size: ${theme.typography.bodySmall.fontSize};
|
font-size: ${theme.typography.bodySmall.fontSize};
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user