Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

GDGT-2766 GDGT-2766 Migrates deprecated FormTextInput and FormInput components (#77161)

Egor Grushinab9a3e191a35
diff --git a/e2e/test/scenarios/actions/actions-in-object-detail-view.cy.spec.js b/e2e/test/scenarios/actions/actions-in-object-detail-view.cy.spec.js
index b745925be32..30f299b204b 100644
--- a/e2e/test/scenarios/actions/actions-in-object-detail-view.cy.spec.js
+++ b/e2e/test/scenarios/actions/actions-in-object-detail-view.cy.spec.js
@@ -217,10 +217,8 @@ describe(
cy.wait("@executeAction");
- cy.findByLabelText("Team Name").should("not.exist");
- cy.findByLabelText(
- "Team Name: This Team_name value already exists.",
- ).should("exist");
+ cy.findByLabelText("Team Name").should("exist");
+ cy.findByText("This Team_name value already exists.").should("exist");
cy.findByText("Team_name already exists.").should("exist");
});
diff --git a/e2e/test/scenarios/actions/actions-on-dashboards.cy.spec.js b/e2e/test/scenarios/actions/actions-on-dashboards.cy.spec.js
index 9de4f12aa36..7fba662b5a5 100644
--- a/e2e/test/scenarios/actions/actions-on-dashboards.cy.spec.js
+++ b/e2e/test/scenarios/actions/actions-on-dashboards.cy.spec.js
@@ -1119,10 +1119,8 @@ describe("action error handling", { tags: ["@external", "@actions"] }, () => {
cy.button(actionName).click();
cy.wait("@executeAction");
- cy.findByLabelText("Team Name").should("not.exist");
- cy.findByLabelText(
- "Team Name: This Team_name value already exists.",
- ).should("exist");
+ cy.findByLabelText("Team Name").should("exist");
+ cy.findByText("This Team_name value already exists.").should("exist");
cy.findByText("Team_name already exists.").should("exist");
});
diff --git a/frontend/src/metabase/actions/components/ActionFormFieldWidget/ActionFormFieldWidget.tsx b/frontend/src/metabase/actions/components/ActionFormFieldWidget/ActionFormFieldWidget.tsx
index 37680c85f1c..4fd40a7d46a 100644
--- a/frontend/src/metabase/actions/components/ActionFormFieldWidget/ActionFormFieldWidget.tsx
+++ b/frontend/src/metabase/actions/components/ActionFormFieldWidget/ActionFormFieldWidget.tsx
@@ -2,12 +2,12 @@ import type { FunctionComponent, ReactNode, Ref } from "react";
import { forwardRef } from "react";
import type { ActionFormFieldProps } from "metabase/actions/types";
-import { FormInput as FormInputWidget } from "metabase/common/components/FormInput";
import { FormToggle as FormBooleanWidget } from "metabase/common/components/FormToggle";
import { FormRadioGroup, type FormRadioGroupProps } from "metabase/forms";
import { Radio, Stack } from "metabase/ui";
import type { InputComponentType } from "metabase-types/api";
+import { FormInputWidget } from "./FormInputWidget";
import { FormNumberInputWidget } from "./FormNumberInputWidget";
import { FormSelectWidget } from "./FormSelectWidget";
import { FormTextareaWidget } from "./FormTextareaWidget";
diff --git a/frontend/src/metabase/actions/components/ActionFormFieldWidget/FormInputWidget.tsx b/frontend/src/metabase/actions/components/ActionFormFieldWidget/FormInputWidget.tsx
new file mode 100644
index 00000000000..40c01a74463
--- /dev/null
+++ b/frontend/src/metabase/actions/components/ActionFormFieldWidget/FormInputWidget.tsx
@@ -0,0 +1,54 @@
+import type { ReactNode, Ref } from "react";
+import { forwardRef } from "react";
+import { match } from "ts-pattern";
+
+import type { ActionFormFieldProps } from "metabase/actions/types";
+import { useUniqueId } from "metabase/common/hooks/use-unique-id";
+import { FormField, FormTextInput } from "metabase/forms";
+
+type FormInputWidgetProps = ActionFormFieldProps & {
+ actions?: ReactNode;
+ disabled?: boolean;
+ nullable?: boolean;
+};
+
+export const FormInputWidget = forwardRef(function FormInputWidget(
+ {
+ name,
+ title,
+ description,
+ placeholder,
+ type,
+ optional,
+ actions,
+ disabled,
+ nullable,
+ }: FormInputWidgetProps,
+ ref: Ref<HTMLInputElement>,
+) {
+ const id = useUniqueId();
+
+ return (
+ <FormField
+ title={title}
+ description={description}
+ actions={actions}
+ optional={optional}
+ htmlFor={id}
+ >
+ <FormTextInput
+ ref={ref}
+ id={id}
+ name={name}
+ type={match(type)
+ .with("date", () => "date")
+ .with("time", () => "time")
+ .with("datetime-local", () => "datetime-local")
+ .otherwise(() => "text")}
+ placeholder={placeholder}
+ nullable={nullable}
+ disabled={disabled}
+ />
+ </FormField>
+ );
+});
diff --git a/frontend/src/metabase/actions/containers/ActionCreator/CreateActionForm/CreateActionForm.tsx b/frontend/src/metabase/actions/containers/ActionCreator/CreateActionForm/CreateActionForm.tsx
index 88f1a95d7ca..0cd81f746b6 100644
--- a/frontend/src/metabase/actions/containers/ActionCreator/CreateActionForm/CreateActionForm.tsx
+++ b/frontend/src/metabase/actions/containers/ActionCreator/CreateActionForm/CreateActionForm.tsx
@@ -6,11 +6,11 @@ import { FormModelPicker } from "metabase/actions/containers/ActionCreator/FormM
import type { CreateQueryActionParams } from "metabase/actions/types";
import { FormErrorMessage } from "metabase/common/components/FormErrorMessage";
import { FormFooter } from "metabase/common/components/FormFooter";
-import { FormInput } from "metabase/common/components/FormInput";
import {
Form,
FormProvider,
FormSubmitButton,
+ FormTextInput,
FormTextarea,
} from "metabase/forms";
import { Button } from "metabase/ui";
@@ -59,11 +59,12 @@ function CreateActionForm({
>
{({ isValid }) => (
<Form disabled={!isValid} data-testid="create-action-form">
- <FormInput
+ <FormTextInput
name="name"
- title={t`Name`}
+ label={t`Name`}
placeholder={t`My new fantastic action`}
data-autofocus
+ mb="md"
/>
<FormTextarea
name="description"
diff --git a/frontend/src/metabase/auth/components/ForgotPasswordForm/ForgotPasswordForm.tsx b/frontend/src/metabase/auth/components/ForgotPasswordForm/ForgotPasswordForm.tsx
index 7e0670eefeb..a67c8e5d14a 100644
--- a/frontend/src/metabase/auth/components/ForgotPasswordForm/ForgotPasswordForm.tsx
+++ b/frontend/src/metabase/auth/components/ForgotPasswordForm/ForgotPasswordForm.tsx
@@ -3,10 +3,15 @@ import { t } from "ttag";
import * as Yup from "yup";
import { FormErrorMessage } from "metabase/common/components/FormErrorMessage";
-import { FormInput } from "metabase/common/components/FormInput";
-import { Form, FormProvider, FormSubmitButton } from "metabase/forms";
+import {
+ Form,
+ FormProvider,
+ FormSubmitButton,
+ FormTextInput,
+} from "metabase/forms";
import { useSelector } from "metabase/redux";
import { getApplicationName } from "metabase/selectors/whitelabel";
+import { Stack } from "metabase/ui";
import * as Errors from "metabase/utils/errors";
import type { ForgotPasswordData } from "../../types";
@@ -50,10 +55,10 @@ export const ForgotPasswordForm = ({
validationSchema={FORGOT_PASSWORD_SCHEMA}
onSubmit={handleSubmit}
>
- <Form>
- <FormInput
+ <Form as={Stack} gap="md">
+ <FormTextInput
name="email"
- title={t`Email address`}
+ label={t`Email address`}
placeholder={t`The email you use for your ${applicationName} account`}
autoFocus
/>
diff --git a/frontend/src/metabase/auth/components/ResetPasswordForm/ResetPasswordForm.tsx b/frontend/src/metabase/auth/components/ResetPasswordForm/ResetPasswordForm.tsx
index b06ab5edee3..0ec4a80178d 100644
--- a/frontend/src/metabase/auth/components/ResetPasswordForm/ResetPasswordForm.tsx
+++ b/frontend/src/metabase/auth/components/ResetPasswordForm/ResetPasswordForm.tsx
@@ -4,8 +4,13 @@ import _ from "underscore";
import * as Yup from "yup";
import { FormErrorMessage } from "metabase/common/components/FormErrorMessage";
-import { FormInput } from "metabase/common/components/FormInput";
-import { Form, FormProvider, FormSubmitButton } from "metabase/forms";
+import {
+ Form,
+ FormProvider,
+ FormSubmitButton,
+ FormTextInput,
+} from "metabase/forms";
+import { Stack } from "metabase/ui";
import * as Errors from "metabase/utils/errors";
import { passwordComplexityDescription } from "metabase/utils/password";
@@ -65,19 +70,19 @@ export const ResetPasswordForm = ({
validationContext={validationContext}
onSubmit={onSubmit}
>
- <Form>
- <FormInput
+ <Form as={Stack} gap="md">
+ <FormTextInput
name="password"
type="password"
- title={t`Create a password`}
+ label={t`Create a password`}
placeholder={t`Shhh...`}
autoComplete="new-password"
autoFocus
/>
- <FormInput
+ <FormTextInput
name="password_confirm"
type="password"
- title={t`Confirm your password`}
+ label={t`Confirm your password`}
placeholder={t`Shhh... but one more time so we get it right`}
autoComplete="new-password"
/>
diff --git a/frontend/src/metabase/common/collections/components/CreateCollectionForm/CreateCollectionForm.tsx b/frontend/src/metabase/common/collections/components/CreateCollectionForm/CreateCollectionForm.tsx
index 25871843e98..66cfd556ce8 100644
--- a/frontend/src/metabase/common/collections/components/CreateCollectionForm/CreateCollectionForm.tsx
+++ b/frontend/src/metabase/common/collections/components/CreateCollectionForm/CreateCollectionForm.tsx
@@ -7,7 +7,6 @@ import FormCollectionPicker from "metabase/common/collections/containers/FormCol
import { useInitialCollectionId } from "metabase/common/collections/hooks";
import { FormErrorMessage } from "metabase/common/components/FormErrorMessage";
import { FormFooter } from "metabase/common/components/FormFooter";
-import { FormInput } from "metabase/common/components/FormInput";
import type {
EntityPickerOptions,
FilterItemsInPersonalCollection,
@@ -17,6 +16,7 @@ import {
Form,
FormProvider,
FormSubmitButton,
+ FormTextInput,
FormTextarea,
} from "metabase/forms";
import { PLUGIN_TENANTS } from "metabase/plugins";
@@ -129,11 +129,12 @@ function CreateCollectionForm({
return (
<Form>
- <FormInput
+ <FormTextInput
name="name"
- title={t`Name`}
+ label={t`Name`}
placeholder={t`My new fantastic collection`}
data-autofocus
+ mb="md"
/>
<FormTextarea
name="description"
diff --git a/frontend/src/metabase/common/components/FormInput/FormInput.stories.tsx b/frontend/src/metabase/common/components/FormInput/FormInput.stories.tsx
deleted file mode 100644
index e95c4ec2aa6..00000000000
--- a/frontend/src/metabase/common/components/FormInput/FormInput.stories.tsx
+++ /dev/null
@@ -1,72 +0,0 @@
-import type { StoryFn } from "@storybook/react";
-import { useState } from "react";
-
-import { Form, FormProvider } from "metabase/forms";
-import { Checkbox } from "metabase/ui";
-
-import { FormInput } from "./FormInput";
-
-const TitleActions = () => {
- const [checked, setChecked] = useState(true);
- return (
- <Checkbox
- size="sm"
- onChange={() => setChecked((checked) => !checked)}
- checked={checked}
- label="Show field"
- />
- );
-};
-
-export default {
- title: "Components/Ask Before Using/FormInput",
- component: FormInput,
- argTypes: {
- actions: {
- mapping: {
- Default: <TitleActions />,
- },
- },
- },
-};
-
-const Template: StoryFn<typeof FormInput> = (args) => {
- const initialValues = { value: false };
- const handleSubmit = () => undefined;
-
- return (
- <FormProvider initialValues={initialValues} onSubmit={handleSubmit}>
- <Form>
- <FormInput {...args} name="value" />
- </Form>
- </FormProvider>
- );
-};
-
-export const Default = {
- render: Template,
-
- args: {
- title: "Title",
- },
-};
-
-export const WithDescription = {
- render: Template,
-
- args: {
- title: "Title",
- description: "Description",
- },
-};
-
-export const WithTitleAndActions = {
- render: Template,
-
- args: {
- title: "Title",
- description: "Description",
- optional: true,
- actions: "Default",
- },
-};
diff --git a/frontend/src/metabase/common/components/FormInput/FormInput.tsx b/frontend/src/metabase/common/components/FormInput/FormInput.tsx
deleted file mode 100644
index 69a41aa6fcf..00000000000
--- a/frontend/src/metabase/common/components/FormInput/FormInput.tsx
+++ /dev/null
@@ -1,77 +0,0 @@
-import { useField } from "formik";
-import type { ChangeEvent, ReactNode, Ref } from "react";
-import { forwardRef, useCallback } from "react";
-
-import { FormField } from "metabase/common/components/FormField";
-import type { InputProps } from "metabase/common/components/Input";
-import { Input } from "metabase/common/components/Input";
-import { useUniqueId } from "metabase/common/hooks/use-unique-id";
-
-export interface FormInputProps extends Omit<
- InputProps,
- "value" | "error" | "fullWidth" | "onChange" | "onBlur"
-> {
- name: string;
- title?: string;
- actions?: ReactNode;
- description?: ReactNode;
- infoTooltip?: string;
- nullable?: boolean;
- optional?: boolean;
-}
-
-/**
- * @deprecated: use FormTextInput from "metabase/forms"
- */
-export const FormInput = forwardRef(function FormInput(
- {
- name,
- className,
- style,
- title,
- actions,
- description,
- infoTooltip,
- nullable,
- optional,
- ...props
- }: FormInputProps,
- ref: Ref<HTMLDivElement>,
-) {
- const id = useUniqueId();
- const [{ value, onBlur }, { error, touched }, { setValue }] = useField(name);
-
- const handleChange = useCallback(
- ({ target: { value } }: ChangeEvent<HTMLInputElement>) => {
- setValue(value === "" && nullable ? null : value);
- },
- [nullable, setValue],
- );
-
- return (
- <FormField
- ref={ref}
- className={className}
- style={style}
- title={title}
- actions={actions}
- description={description}
- infoTooltip={infoTooltip}
- htmlFor={id}
- error={touched ? error : undefined}
- optional={optional}
- >
- <Input
- size="large"
- {...props}
- id={id}
- name={name}
- value={value ?? ""}
- error={touched && error != null}
- fullWidth
- onChange={handleChange}
- onBlur={onBlur}
- />
- </FormField>
- );
-});
diff --git a/frontend/src/metabase/common/components/FormInput/FormInput.unit.spec.tsx b/frontend/src/metabase/common/components/FormInput/FormInput.unit.spec.tsx
deleted file mode 100644
index 4cc31eda6e7..00000000000
--- a/frontend/src/metabase/common/components/FormInput/FormInput.unit.spec.tsx
+++ /dev/null
@@ -1,135 +0,0 @@
-import userEvent from "@testing-library/user-event";
-import { Form, Formik } from "formik";
-import * as Yup from "yup";
-
-import { render, screen, waitFor } from "__support__/ui";
-
-import { FormInput } from "./FormInput";
-
-const TEST_SCHEMA = Yup.object({
- value: Yup.string().required("error"),
-});
-
-interface TestFormInputProps {
- initialValue?: string;
- optional?: boolean;
- infoTooltip?: string;
- onSubmit: () => void;
-}
-
-const TestFormInput = ({
- initialValue = "",
- optional,
- infoTooltip,
- onSubmit,
-}: TestFormInputProps) => {
- return (
- <Formik
- initialValues={{ value: initialValue }}
- validationSchema={TEST_SCHEMA}
- onSubmit={onSubmit}
- >
- <Form>
- <FormInput
- name="value"
- title="Label"
- optional={optional}
- infoTooltip={infoTooltip}
- />
- <button type="submit">Submit</button>
- </Form>
- </Formik>
- );
-};
-
-describe("FormInput", () => {
- it("should use the initial value from the form", () => {
- const onSubmit = jest.fn();
-
- render(<TestFormInput initialValue="Text" onSubmit={onSubmit} />);
-
- expect(screen.getByRole("textbox")).toHaveValue("Text");
- });
-
- it("should propagate the changed value to the form", async () => {
- const onSubmit = jest.fn();
-
- render(<TestFormInput onSubmit={onSubmit} />);
- await userEvent.type(screen.getByRole("textbox"), "Text");
- await userEvent.click(screen.getByText("Submit"));
-
- await waitFor(() => {
- const values = { value: "Text" };
- expect(onSubmit).toHaveBeenCalledWith(values, expect.anything());
- });
- });
-
- it("should be referenced by the label", () => {
- const onSubmit = jest.fn();
-
- render(<TestFormInput onSubmit={onSubmit} />);
-
- expect(screen.getByLabelText("Label")).toBeInTheDocument();
- });
-
- it("should be validated on blur", async () => {
- const onSubmit = jest.fn();
-
- render(<TestFormInput initialValue="Text" onSubmit={onSubmit} />);
- await userEvent.clear(screen.getByRole("textbox"));
- await userEvent.tab();
-
- expect(await screen.findByText(": error")).toBeInTheDocument();
- });
-
- it("should mark the field as optional", () => {
- const onSubmit = jest.fn();
-
- render(<TestFormInput initialValue="" onSubmit={onSubmit} optional />);
-
- expect(screen.getByText(/optional/i)).toBeInTheDocument();
- });
-
- it("should not mark the field as optional (undefined)", () => {
- const onSubmit = jest.fn();
-
- render(<TestFormInput initialValue="" onSubmit={onSubmit} />);
-
- expect(screen.queryByText(/optional/i)).not.toBeInTheDocument();
- });
-
- it("should not mark the field as optional (false)", () => {
- const onSubmit = jest.fn();
-
- render(
- <TestFormInput initialValue="" onSubmit={onSubmit} optional={false} />,
- );
-
- expect(screen.queryByText(/optional/i)).not.toBeInTheDocument();
- });
-
- it("should be selectable by label text", () => {
- const onSubmit = jest.fn();
-
- render(<TestFormInput initialValue="" onSubmit={onSubmit} optional />);
-
- expect(screen.getByLabelText("Label")).toBeInTheDocument();
- });
-
- it("should have info tooltip", async () => {
- const onSubmit = jest.fn();
- const infoTooltipText = "info tooltip text";
-
- render(
- <TestFormInput
- initialValue=""
- onSubmit={onSubmit}
- optional
- infoTooltip={infoTooltipText}
- />,
- );
-
- await userEvent.hover(screen.getByLabelText("info icon"));
- expect(await screen.findByText(infoTooltipText)).toBeInTheDocument();
- });
-});
diff --git a/frontend/src/metabase/common/components/FormInput/index.ts b/frontend/src/metabase/common/components/FormInput/index.ts
deleted file mode 100644
index 008c0e0dc16..00000000000
--- a/frontend/src/metabase/common/components/FormInput/index.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-export { FormInput } from "./FormInput";
-export type { FormInputProps } from "./FormInput";
diff --git a/frontend/src/metabase/querying/components/NativeQueryEditor/SnippetForm/SnippetForm.tsx b/frontend/src/metabase/querying/components/NativeQueryEditor/SnippetForm/SnippetForm.tsx
index 9dccdb6d61d..4fab0e3a487 100644
--- a/frontend/src/metabase/querying/components/NativeQueryEditor/SnippetForm/SnippetForm.tsx
+++ b/frontend/src/metabase/querying/components/NativeQueryEditor/SnippetForm/SnippetForm.tsx
@@ -5,15 +5,15 @@ import * as Yup from "yup";
import { useListCollectionsQuery } from "metabase/api";
import FormCollectionPicker from "metabase/common/collections/containers/FormCollectionPicker";
import { FormErrorMessage } from "metabase/common/components/FormErrorMessage";
-import { FormInput } from "metabase/common/components/FormInput";
import { LoadingAndErrorWrapper } from "metabase/common/components/LoadingAndErrorWrapper";
import {
Form,
FormProvider,
FormSubmitButton,
+ FormTextInput,
FormTextarea,
} from "metabase/forms";
-import { Button, Flex, Icon } from "metabase/ui";
+import { Button, Flex, Icon, Stack } from "metabase/ui";
import * as Errors from "metabase/utils/errors";
import type { Collection, NativeQuerySnippet } from "metabase-types/api";
@@ -81,7 +81,12 @@ function SnippetFormInner({
onSubmit={onSubmit}
>
{({ dirty }) => (
- <Form disabled={!dirty && !isInitiallyDirty} className={S.SnippetForm}>
+ <Form
+ as={Stack}
+ gap="md"
+ disabled={!dirty && !isInitiallyDirty}
+ className={S.SnippetForm}
+ >
<FormTextarea
classNames={{ input: S.FormSnippetTextArea }}
name="content"
@@ -90,16 +95,15 @@ function SnippetFormInner({
autosize={false}
resize="vertical"
rows={5}
- mb="md"
/>
- <FormInput
+ <FormTextInput
name="name"
- title={t`Give your snippet a name`}
+ label={t`Give your snippet a name`}
placeholder={t`Current Customers`}
/>
- <FormInput
+ <FormTextInput
name="description"
- title={t`Add a description`}
+ label={t`Add a description`}
placeholder={t`It's optional but oh, so helpful`}
nullable
/>
@@ -127,7 +131,7 @@ function SnippetFormInner({
)}
<FormErrorMessage inline />
</Flex>
- <Flex align="center" justify="center" gap="sm" mt="md">
+ <Flex align="center" justify="center" gap="sm">
{!!onCancel && (
<Button type="button" size="sm" onClick={onCancel}>
{t`Cancel`}
diff --git a/frontend/src/metabase/setup/components/InviteUserForm/InviteUserForm.tsx b/frontend/src/metabase/setup/components/InviteUserForm/InviteUserForm.tsx
index f298b0c3905..98f90962292 100644
--- a/frontend/src/metabase/setup/components/InviteUserForm/InviteUserForm.tsx
+++ b/frontend/src/metabase/setup/components/InviteUserForm/InviteUserForm.tsx
@@ -2,9 +2,14 @@ import { useMemo } from "react";
import { t } from "ttag";
import * as Yup from "yup";
-import { FormInput } from "metabase/common/components/FormInput";
-import { Form, FormProvider, FormSubmitButton } from "metabase/forms";
+import {
+ Form,
+ FormProvider,
+ FormSubmitButton,
+ FormTextInput,
+} from "metabase/forms";
import type { InviteInfo, UserInfo } from "metabase/redux/store";
+import { Stack } from "metabase/ui";
import * as Errors from "metabase/utils/errors";
import S from "./InviteUserForm.module.css";
@@ -45,25 +50,25 @@ export const InviteUserForm = ({
validationContext={user}
onSubmit={onSubmit}
>
- <Form data-testid="invite-user-form">
+ <Form as={Stack} gap="md" data-testid="invite-user-form">
<div className={S.UserFieldGroup}>
- <FormInput
+ <FormTextInput
name="first_name"
- title={t`First name`}
+ label={t`First name`}
placeholder={t`Johnny`}
nullable
autoFocus
/>
- <FormInput
+ <FormTextInput
name="last_name"
- title={t`Last name`}
+ label={t`Last name`}
placeholder={t`Appleseed`}
nullable
/>
</div>
- <FormInput
+ <FormTextInput
name="email"
- title={t`Email`}
+ label={t`Email`}
placeholder={"[email protected]"}
/>
<FormSubmitButton label={t`Send invitation`} variant="filled" />
diff --git a/frontend/src/metabase/setup/components/UserForm/UserForm.tsx b/frontend/src/metabase/setup/components/UserForm/UserForm.tsx
index 514191d73ea..3195cba270b 100644
--- a/frontend/src/metabase/setup/components/UserForm/UserForm.tsx
+++ b/frontend/src/metabase/setup/components/UserForm/UserForm.tsx
@@ -3,11 +3,15 @@ import { t } from "ttag";
import _ from "underscore";
import * as Yup from "yup";
-import { FormInput } from "metabase/common/components/FormInput";
import { useValidatePassword } from "metabase/common/hooks";
-import { Form, FormProvider, FormSubmitButton } from "metabase/forms";
+import {
+ Form,
+ FormProvider,
+ FormSubmitButton,
+ FormTextInput,
+} from "metabase/forms";
import type { UserInfo } from "metabase/redux/store";
-import { Flex } from "metabase/ui";
+import { Flex, Stack } from "metabase/ui";
import * as Errors from "metabase/utils/errors";
import { UserFieldGroup } from "./UserForm.styled";
@@ -54,47 +58,47 @@ export const UserForm = ({ user, isHosted, onSubmit }: UserFormProps) => {
validationContext={validationContext}
onSubmit={onSubmit}
>
- <Form mt="md">
+ <Form as={Stack} gap="md" mt="md">
<UserFieldGroup>
- <FormInput
+ <FormTextInput
name="first_name"
- title={t`First name`}
+ label={t`First name`}
placeholder={t`Johnny`}
nullable
autoFocus={!isHosted}
/>
- <FormInput
+ <FormTextInput
name="last_name"
- title={t`Last name`}
+ label={t`Last name`}
placeholder={t`Appleseed`}
nullable
/>
</UserFieldGroup>
- <FormInput
+ <FormTextInput
name="email"
type="email"
- title={t`Email`}
+ label={t`Email`}
placeholder="[email protected]"
/>
- <FormInput
+ <FormTextInput
name="site_name"
- title={t`Company or team name`}
+ label={t`Company or team name`}
placeholder={t`Department of Awesome`}
/>
- <FormInput
+ <FormTextInput
name="password"
type="password"
- title={t`Create a password`}
+ label={t`Create a password`}
placeholder={t`Shhh...`}
// Hosted instances always pass user information in the URLSearchParams
// during the initial setup. Password is the first empty field
// so it makes sense to focus on it.
autoFocus={isHosted && initialValues.site_name !== ""}
/>
- <FormInput
+ <FormTextInput
name="password_confirm"
type="password"
- title={t`Confirm your password`}
+ label={t`Confirm your password`}
placeholder={t`Shhh... but one more time so we get it right`}
/>
<Flex align="center">
diff --git a/frontend/src/metabase/timelines/common/components/TimelineForm/TimelineForm.tsx b/frontend/src/metabase/timelines/common/components/TimelineForm/TimelineForm.tsx
index 23c4cbcf3e1..27082ded00f 100644
--- a/frontend/src/metabase/timelines/common/components/TimelineForm/TimelineForm.tsx
+++ b/frontend/src/metabase/timelines/common/components/TimelineForm/TimelineForm.tsx
@@ -3,12 +3,12 @@ import { t } from "ttag";
import * as Yup from "yup";
import { FormErrorMessage } from "metabase/common/components/FormErrorMessage";
-import { FormInput } from "metabase/common/components/FormInput";
import { getTimelineIcons } from "metabase/common/utils/timelines";
import {
Form,
FormProvider,
FormSubmitButton,
+ FormTextInput,
FormTextarea,
} from "metabase/forms";
import { Button } from "metabase/ui";
@@ -50,11 +50,12 @@ const TimelineForm = ({
>
{({ dirty }) => (
<Form disabled={!dirty}>
- <FormInput
+ <FormTextInput
name="name"
- title={t`Name`}
+ label={t`Name`}
placeholder={t`Product releases`}
autoFocus
+ mb="md"
/>
<FormTextarea
name="description"