diff --git a/packages/grafana-ui/src/components/Forms/Switch.mdx b/packages/grafana-ui/src/components/Forms/Switch.mdx index 5a8cf5e3d46..8d1b1a92a9c 100644 --- a/packages/grafana-ui/src/components/Forms/Switch.mdx +++ b/packages/grafana-ui/src/components/Forms/Switch.mdx @@ -1,5 +1,5 @@ -import { Meta, Story, Preview, Props } from '@storybook/addon-docs/blocks'; -import { Switch } from './Switch'; +import { Meta, Story, Preview, Props } from "@storybook/addon-docs/blocks"; +import { Switch } from "./Switch"; @@ -10,11 +10,11 @@ Used to represent binary values ### Usage ```jsx -import { Forms } from '@grafana/ui'; +import { Switch } from '@grafana/ui'; - + ``` ### Props - + diff --git a/packages/grafana-ui/src/components/Forms/index.ts b/packages/grafana-ui/src/components/Forms/index.ts index 7274d05c189..418a562387a 100644 --- a/packages/grafana-ui/src/components/Forms/index.ts +++ b/packages/grafana-ui/src/components/Forms/index.ts @@ -4,14 +4,12 @@ import { Label } from './Label'; import { RadioButtonGroup } from './RadioButtonGroup/RadioButtonGroup'; import { Form } from './Form'; import { Field } from './Field'; -import { Switch } from './Switch'; import { Legend } from './Legend'; import { TextArea } from './TextArea/TextArea'; import { Checkbox } from './Checkbox'; const Forms = { RadioButtonGroup, - Switch, getFormStyles, Label, Form, diff --git a/packages/grafana-ui/src/components/index.ts b/packages/grafana-ui/src/components/index.ts index 1dfa95fb442..7082bb230ad 100644 --- a/packages/grafana-ui/src/components/index.ts +++ b/packages/grafana-ui/src/components/index.ts @@ -137,6 +137,7 @@ export { HorizontalGroup, VerticalGroup, Container } from './Layout/Layout'; export { RadioButtonGroup } from './Forms/RadioButtonGroup/RadioButtonGroup'; export { Input } from './Input/Input'; +export { Switch } from './Forms/Switch'; // Legacy forms @@ -160,5 +161,4 @@ const LegacyForms = { Input, Switch, }; -export { Switch }; export { LegacyForms, LegacyInputStatus }; diff --git a/packages/grafana-ui/src/utils/standardEditors.tsx b/packages/grafana-ui/src/utils/standardEditors.tsx index 32025c9a90f..8c0ed3742f5 100644 --- a/packages/grafana-ui/src/utils/standardEditors.tsx +++ b/packages/grafana-ui/src/utils/standardEditors.tsx @@ -20,6 +20,7 @@ import { ThresholdsMode, } from '@grafana/data'; import { NumberValueEditor, Forms, StringValueEditor, Select } from '../components'; +import { Switch } from '../components/Forms/Switch'; import { ValueMappingsValueEditor } from '../components/OptionsUI/mappings'; import { ThresholdsValueEditor } from '../components/OptionsUI/thresholds'; import { UnitValueEditor } from '../components/OptionsUI/units'; @@ -220,7 +221,7 @@ export const getStandardOptionEditors = () => { id: 'boolean', name: 'Boolean', description: 'Allows boolean values input', - editor: props => props.onChange(e.currentTarget.checked)} />, + editor: props => props.onChange(e.currentTarget.checked)} />, }; const select: StandardEditorsRegistryItem = { diff --git a/public/app/features/dashboard/components/PanelEditor/PanelOptionsTab.tsx b/public/app/features/dashboard/components/PanelEditor/PanelOptionsTab.tsx index c695cea3eee..c7ef6562fdb 100644 --- a/public/app/features/dashboard/components/PanelEditor/PanelOptionsTab.tsx +++ b/public/app/features/dashboard/components/PanelEditor/PanelOptionsTab.tsx @@ -1,7 +1,7 @@ import React, { FC, useMemo } from 'react'; import { PanelModel, DashboardModel } from '../../state'; import { SelectableValue, PanelPlugin, FieldConfigSource, PanelData } from '@grafana/data'; -import { Forms, Select, DataLinksInlineEditor, Input } from '@grafana/ui'; +import { Forms, Switch, Select, DataLinksInlineEditor, Input } from '@grafana/ui'; import { OptionsGroup } from './OptionsGroup'; import { getPanelLinksVariableSuggestions } from '../../../panel/panellinks/link_srv'; import { getVariables } from '../../../variables/state/selectors'; @@ -51,10 +51,7 @@ export const PanelOptionsTab: FC = ({ /> - onPanelConfigChange('transparent', e.currentTarget.checked)} - /> + onPanelConfigChange('transparent', e.currentTarget.checked)} /> ); diff --git a/public/app/features/dashboard/components/SaveDashboard/forms/SaveDashboardAsForm.tsx b/public/app/features/dashboard/components/SaveDashboard/forms/SaveDashboardAsForm.tsx index aec8b840266..c3dfd68e8de 100644 --- a/public/app/features/dashboard/components/SaveDashboard/forms/SaveDashboardAsForm.tsx +++ b/public/app/features/dashboard/components/SaveDashboard/forms/SaveDashboardAsForm.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { Button, Forms, HorizontalGroup, Input } from '@grafana/ui'; +import { Button, Forms, HorizontalGroup, Input, Switch } from '@grafana/ui'; import { DashboardModel, PanelModel } from 'app/features/dashboard/state'; import { FolderPicker } from 'app/core/components/Select/FolderPicker'; import { SaveDashboardFormProps } from '../types'; @@ -90,7 +90,7 @@ export const SaveDashboardAsForm: React.FC - +