mirror of
https://github.com/grafana/grafana.git
synced 2025-07-31 01:32:10 +08:00
GrafanaUI: Move Box out of unstable and into GrafanaUI (#77080)
This commit is contained in:
@ -9,8 +9,17 @@ import { Box, BackgroundColor, BorderColor, BorderStyle, BorderRadius, BoxShadow
|
|||||||
import mdx from './Box.mdx';
|
import mdx from './Box.mdx';
|
||||||
|
|
||||||
const backgroundOptions: BackgroundColor[] = ['primary', 'secondary', 'canvas', 'error', 'success', 'warning', 'info'];
|
const backgroundOptions: BackgroundColor[] = ['primary', 'secondary', 'canvas', 'error', 'success', 'warning', 'info'];
|
||||||
const borderColorOptions: BorderColor[] = ['weak', 'medium', 'strong', 'error', 'success', 'warning', 'info'];
|
const borderColorOptions: Array<BorderColor | undefined> = [
|
||||||
const borderStyleOptions: BorderStyle[] = ['dashed', 'solid'];
|
'weak',
|
||||||
|
'medium',
|
||||||
|
'strong',
|
||||||
|
'error',
|
||||||
|
'success',
|
||||||
|
'warning',
|
||||||
|
'info',
|
||||||
|
undefined,
|
||||||
|
];
|
||||||
|
const borderStyleOptions: Array<BorderStyle | undefined> = ['dashed', 'solid', undefined];
|
||||||
const borderRadiusOptions: BorderRadius[] = ['default', 'pill', 'circle'];
|
const borderRadiusOptions: BorderRadius[] = ['default', 'pill', 'circle'];
|
||||||
const boxShadowOptions: BoxShadow[] = ['z1', 'z2', 'z3'];
|
const boxShadowOptions: BoxShadow[] = ['z1', 'z2', 'z3'];
|
||||||
|
|
||||||
@ -39,11 +48,11 @@ const Item = ({ background }: { background?: string }) => {
|
|||||||
|
|
||||||
export const Basic: StoryFn<typeof Box> = (args) => {
|
export const Basic: StoryFn<typeof Box> = (args) => {
|
||||||
return (
|
return (
|
||||||
<div style={{ backgroundColor: 'green' }}>
|
<Flex>
|
||||||
<Box {...args}>
|
<Box borderColor="medium" {...args}>
|
||||||
<Item background="red" />
|
Box
|
||||||
</Box>
|
</Box>
|
||||||
</div>
|
</Flex>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -72,6 +81,11 @@ Basic.argTypes = {
|
|||||||
boxShadow: { control: 'select', options: boxShadowOptions },
|
boxShadow: { control: 'select', options: boxShadowOptions },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Basic.args = {
|
||||||
|
borderColor: 'medium',
|
||||||
|
borderStyle: 'solid',
|
||||||
|
};
|
||||||
|
|
||||||
export const Background: StoryFn<typeof Box> = () => {
|
export const Background: StoryFn<typeof Box> = () => {
|
||||||
return (
|
return (
|
||||||
<Flex gap={4}>
|
<Flex gap={4}>
|
@ -214,6 +214,7 @@ export { fieldMatchersUI } from './MatchersUI/fieldMatchersUI';
|
|||||||
export { Link } from './Link/Link';
|
export { Link } from './Link/Link';
|
||||||
export { TextLink } from './Link/TextLink';
|
export { TextLink } from './Link/TextLink';
|
||||||
export { Text } from './Text/Text';
|
export { Text } from './Text/Text';
|
||||||
|
export { Box } from './Layout/Box/Box';
|
||||||
|
|
||||||
export { Label } from './Forms/Label';
|
export { Label } from './Forms/Label';
|
||||||
export { Field, type FieldProps } from './Forms/Field';
|
export { Field, type FieldProps } from './Forms/Field';
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
* be subject to the standard policies
|
* be subject to the standard policies
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export * from './components/Layout/Box/Box';
|
|
||||||
export * from './components/Layout/Flex/Flex';
|
export * from './components/Layout/Flex/Flex';
|
||||||
|
|
||||||
export { Grid } from './components/Layout/Grid/Grid';
|
export { Grid } from './components/Layout/Grid/Grid';
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import React, { forwardRef, PropsWithChildren } from 'react';
|
import React, { forwardRef, PropsWithChildren } from 'react';
|
||||||
|
|
||||||
import { IconName } from '@grafana/data';
|
import { IconName } from '@grafana/data';
|
||||||
import { Icon, Tooltip } from '@grafana/ui';
|
import { Icon, Tooltip, Box } from '@grafana/ui';
|
||||||
import { Box, Flex } from '@grafana/ui/src/unstable';
|
import { Flex } from '@grafana/ui/src/unstable';
|
||||||
import { Unit } from 'app/types';
|
import { Unit } from 'app/types';
|
||||||
|
|
||||||
type OrgUnitProps = { units?: Unit[]; icon: IconName };
|
type OrgUnitProps = { units?: Unit[]; icon: IconName };
|
||||||
|
@ -14,8 +14,9 @@ import {
|
|||||||
FetchDataFunc,
|
FetchDataFunc,
|
||||||
Pagination,
|
Pagination,
|
||||||
Avatar,
|
Avatar,
|
||||||
|
Box,
|
||||||
} from '@grafana/ui';
|
} from '@grafana/ui';
|
||||||
import { Flex, Stack, Box } from '@grafana/ui/src/unstable';
|
import { Flex, Stack } from '@grafana/ui/src/unstable';
|
||||||
import { UserRolePicker } from 'app/core/components/RolePicker/UserRolePicker';
|
import { UserRolePicker } from 'app/core/components/RolePicker/UserRolePicker';
|
||||||
import { fetchRoleOptions } from 'app/core/components/RolePicker/api';
|
import { fetchRoleOptions } from 'app/core/components/RolePicker/api';
|
||||||
import { TagBadge } from 'app/core/components/TagFilter/TagBadge';
|
import { TagBadge } from 'app/core/components/TagFilter/TagBadge';
|
||||||
|
@ -12,8 +12,8 @@ import {
|
|||||||
Label,
|
Label,
|
||||||
HorizontalGroup,
|
HorizontalGroup,
|
||||||
TextArea,
|
TextArea,
|
||||||
|
Box,
|
||||||
} from '@grafana/ui';
|
} from '@grafana/ui';
|
||||||
import { Box } from '@grafana/ui/src/unstable';
|
|
||||||
import { Page } from 'app/core/components/Page/Page';
|
import { Page } from 'app/core/components/Page/Page';
|
||||||
import { FolderPicker } from 'app/core/components/Select/FolderPicker';
|
import { FolderPicker } from 'app/core/components/Select/FolderPicker';
|
||||||
import { t, Trans } from 'app/core/internationalization';
|
import { t, Trans } from 'app/core/internationalization';
|
||||||
|
@ -4,8 +4,8 @@ import React from 'react';
|
|||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { selectors } from '@grafana/e2e-selectors';
|
import { selectors } from '@grafana/e2e-selectors';
|
||||||
import { config, locationService, reportInteraction } from '@grafana/runtime';
|
import { config, locationService, reportInteraction } from '@grafana/runtime';
|
||||||
import { Button, useStyles2, Text } from '@grafana/ui';
|
import { Button, useStyles2, Text, Box } from '@grafana/ui';
|
||||||
import { Box, Flex } from '@grafana/ui/src/unstable';
|
import { Flex } from '@grafana/ui/src/unstable';
|
||||||
import { Trans } from 'app/core/internationalization';
|
import { Trans } from 'app/core/internationalization';
|
||||||
import { DashboardModel } from 'app/features/dashboard/state';
|
import { DashboardModel } from 'app/features/dashboard/state';
|
||||||
import { onAddLibraryPanel, onCreateNewPanel, onImportDashboard } from 'app/features/dashboard/utils/dashboard';
|
import { onAddLibraryPanel, onCreateNewPanel, onImportDashboard } from 'app/features/dashboard/utils/dashboard';
|
||||||
|
@ -2,8 +2,7 @@ import React, { useCallback } from 'react';
|
|||||||
|
|
||||||
import { Field, SelectableValue, valueMatchers } from '@grafana/data';
|
import { Field, SelectableValue, valueMatchers } from '@grafana/data';
|
||||||
import { FilterByValueFilter } from '@grafana/data/src/transformations/transformers/filterByValue';
|
import { FilterByValueFilter } from '@grafana/data/src/transformations/transformers/filterByValue';
|
||||||
import { Button, Select, InlineField, InlineFieldRow } from '@grafana/ui';
|
import { Button, Select, InlineField, InlineFieldRow, Box } from '@grafana/ui';
|
||||||
import { Box } from '@grafana/ui/src/unstable';
|
|
||||||
|
|
||||||
import { valueMatchersUI } from './ValueMatchers/valueMatchersUI';
|
import { valueMatchersUI } from './ValueMatchers/valueMatchersUI';
|
||||||
|
|
||||||
|
@ -20,8 +20,7 @@ import {
|
|||||||
FilterByValueTransformerOptions,
|
FilterByValueTransformerOptions,
|
||||||
FilterByValueType,
|
FilterByValueType,
|
||||||
} from '@grafana/data/src/transformations/transformers/filterByValue';
|
} from '@grafana/data/src/transformations/transformers/filterByValue';
|
||||||
import { Button, RadioButtonGroup, InlineField } from '@grafana/ui';
|
import { Button, RadioButtonGroup, InlineField, Box } from '@grafana/ui';
|
||||||
import { Box } from '@grafana/ui/src/unstable';
|
|
||||||
|
|
||||||
import { DataFrameFieldsInfo, FilterByValueFilterEditor } from './FilterByValueFilterEditor';
|
import { DataFrameFieldsInfo, FilterByValueFilterEditor } from './FilterByValueFilterEditor';
|
||||||
|
|
||||||
|
@ -4,8 +4,7 @@ import { connect, ConnectedProps } from 'react-redux';
|
|||||||
import { DataSourceInstanceSettings, getDataSourceRef, LoadingState, SelectableValue } from '@grafana/data';
|
import { DataSourceInstanceSettings, getDataSourceRef, LoadingState, SelectableValue } from '@grafana/data';
|
||||||
import { selectors } from '@grafana/e2e-selectors';
|
import { selectors } from '@grafana/e2e-selectors';
|
||||||
import { getTemplateSrv } from '@grafana/runtime';
|
import { getTemplateSrv } from '@grafana/runtime';
|
||||||
import { Field, Text } from '@grafana/ui';
|
import { Field, Text, Box } from '@grafana/ui';
|
||||||
import { Box } from '@grafana/ui/src/unstable';
|
|
||||||
import { DataSourcePicker } from 'app/features/datasources/components/picker/DataSourcePicker';
|
import { DataSourcePicker } from 'app/features/datasources/components/picker/DataSourcePicker';
|
||||||
|
|
||||||
import { StoreState } from '../../../types';
|
import { StoreState } from '../../../types';
|
||||||
|
Reference in New Issue
Block a user