Commit c11ea0b9 by Tobias Skarhed Committed by GitHub

Form migrations: TextArea from Forms namespace (#23436)

* Move from Forms namespace and move folder

* Figrate pages from Forms

* Make Enterprise mergable
parent 468f5d15
......@@ -16,7 +16,7 @@ import Forms from './index';
import mdx from './Form.mdx';
import { ValidateResult } from 'react-hook-form';
import { boolean } from '@storybook/addon-knobs';
import { TextArea } from './TextArea/TextArea';
import { TextArea } from '../TextArea/TextArea';
export default {
title: 'Forms/Example forms',
......
......@@ -5,8 +5,8 @@ import { RadioButtonGroup } from './RadioButtonGroup/RadioButtonGroup';
import { Form } from './Form';
import { Field } from './Field';
import { Legend } from './Legend';
import { TextArea } from './TextArea/TextArea';
import { Checkbox } from './Checkbox';
import { TextArea } from '../TextArea/TextArea';
const Forms = {
RadioButtonGroup,
......@@ -15,9 +15,9 @@ const Forms = {
Form,
Field,
InputControl,
TextArea,
Checkbox,
Legend,
TextArea,
};
export default Forms;
import React from 'react';
import { TextArea } from './TextArea';
import { withCenteredStory } from '../../../utils/storybook/withCenteredStory';
import { withCenteredStory } from '../../utils/storybook/withCenteredStory';
import { boolean, number, select, text } from '@storybook/addon-knobs';
import mdx from './TextArea.mdx';
......
import React, { HTMLProps } from 'react';
import { GrafanaTheme } from '@grafana/data';
import { css, cx } from 'emotion';
import { stylesFactory, useTheme } from '../../../themes';
import { getFocusStyle, inputSizes, sharedInputStyle } from '../commonStyles';
import { FormInputSize } from '../types';
import { stylesFactory, useTheme } from '../../themes';
import { getFocusStyle, inputSizes, sharedInputStyle } from '../Forms/commonStyles';
import { FormInputSize } from '../Forms/types';
export interface Props extends Omit<HTMLProps<HTMLTextAreaElement>, 'size'> {
/** Show an invalid state around the input */
......
......@@ -138,6 +138,7 @@ export { RadioButtonGroup } from './Forms/RadioButtonGroup/RadioButtonGroup';
export { Input } from './Input/Input';
export { Switch } from './Forms/Switch';
export { TextArea } from './TextArea/TextArea';
// Legacy forms
......
import React, { FC, useMemo } from 'react';
import { PanelModel, DashboardModel } from '../../state';
import { SelectableValue, PanelPlugin, FieldConfigSource, PanelData } from '@grafana/data';
import { Forms, Switch, Select, DataLinksInlineEditor, Input } from '@grafana/ui';
import { Forms, Switch, Select, DataLinksInlineEditor, Input, TextArea } from '@grafana/ui';
import { OptionsGroup } from './OptionsGroup';
import { getPanelLinksVariableSuggestions } from '../../../panel/panellinks/link_srv';
import { getVariables } from '../../../variables/state/selectors';
......@@ -45,7 +45,7 @@ export const PanelOptionsTab: FC<Props> = ({
<Input defaultValue={panel.title} onBlur={e => onPanelConfigChange('title', e.currentTarget.value)} />
</Forms.Field>
<Forms.Field label="Description" description="Panel description supports markdown and links.">
<Forms.TextArea
<TextArea
defaultValue={panel.description}
onBlur={e => onPanelConfigChange('description', e.currentTarget.value)}
/>
......
import React, { useMemo } from 'react';
import { Forms, Button, HorizontalGroup } from '@grafana/ui';
import { Forms, Button, HorizontalGroup, TextArea } from '@grafana/ui';
import { e2e } from '@grafana/e2e';
import { SaveDashboardFormProps } from '../types';
......@@ -50,12 +50,7 @@ export const SaveDashboardForm: React.FC<SaveDashboardFormProps> = ({ dashboard,
)}
{(hasVariableChanged || hasTimeChanged) && <div className="gf-form-group" />}
<Forms.TextArea
name="message"
ref={register}
placeholder="Add a note to describe your changes..."
autoFocus
/>
<TextArea name="message" ref={register} placeholder="Add a note to describe your changes..." autoFocus />
</div>
<HorizontalGroup>
......
......@@ -2,7 +2,8 @@ import React, { useState } from 'react';
import { connect } from 'react-redux';
import { hot } from 'react-hot-loader';
import { css, cx } from 'emotion';
import { stylesFactory, useTheme, Forms, Button, Icon } from '@grafana/ui';
import { stylesFactory, useTheme, TextArea, Button, Icon } from '@grafana/ui';
import { GrafanaTheme, AppEvents, DataSourceApi } from '@grafana/data';
import { RichHistoryQuery, ExploreId } from 'app/types/explore';
import { copyStringToClipboard, createUrlFromRichHistory, createDataQuery } from 'app/core/utils/richHistory';
......@@ -194,7 +195,7 @@ export function RichHistoryCard(props: Props) {
const updateComment = (
<div className={styles.updateCommentContainer}>
<Forms.TextArea
<TextArea
value={comment}
placeholder={comment ? undefined : 'An optional description of what the query does.'}
onChange={e => setComment(e.currentTarget.value)}
......
......@@ -2,7 +2,7 @@ import React, { FormEvent, PureComponent } from 'react';
import { connect, MapDispatchToProps, MapStateToProps } from 'react-redux';
import { css } from 'emotion';
import { AppEvents, NavModel } from '@grafana/data';
import { Button, Forms, stylesFactory, Input } from '@grafana/ui';
import { Button, Forms, stylesFactory, Input, TextArea } from '@grafana/ui';
import Page from 'app/core/components/Page/Page';
import { ImportDashboardOverview } from './components/ImportDashboardOverview';
import { DashboardFileUpload } from './components/DashboardFileUpload';
......@@ -111,7 +111,7 @@ class DashboardImportUnConnected extends PureComponent<Props> {
invalid={!!errors.dashboardJson}
error={errors.dashboardJson && errors.dashboardJson.message}
>
<Forms.TextArea
<TextArea
name="dashboardJson"
ref={register({
required: 'Need a dashboard json model',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment