From f27fccdf63eefe0be47dcda839cfcf9997571a95 Mon Sep 17 00:00:00 2001 From: koji Date: Mon, 12 Aug 2024 13:25:13 +0900 Subject: [PATCH 1/2] refactor(components, app): move inputfile from app to components move inputfield from app to components and rename inputfield in components into legacyinputfield close AUTH-646 --- .../ConnectNetwork/ConnectModal/TextField.tsx | 4 ++-- components/src/forms/InputField.stories.tsx | 2 +- .../src/forms/{InputField.tsx => LegacyInputField.tsx} | 6 +++--- components/src/forms/index.ts | 2 +- .../src/labware-creator/components/TextField.tsx | 10 +++++----- protocol-designer/src/components/EditableTextField.tsx | 4 ++-- protocol-designer/src/components/FilePage.tsx | 8 ++++---- .../LiquidPlacementForm/LiquidPlacementForm.tsx | 4 ++-- .../src/components/LiquidsPage/LiquidEditForm.tsx | 6 +++--- .../fields/FlowRateField/FlowRateInput.tsx | 8 ++++---- .../components/StepEditForm/fields/ProfileItemRows.tsx | 4 ++-- .../src/components/StepEditForm/fields/TextField.tsx | 4 ++-- .../fields/TipPositionField/TipPositionModal.tsx | 8 ++++---- .../fields/TipPositionField/ZTipPositionModal.tsx | 4 ++-- .../StepEditForm/fields/TipPositionField/index.tsx | 4 ++-- .../fields/TipWellSelectionField/index.tsx | 4 ++-- .../fields/WellSelectionField/WellSelectionField.tsx | 4 ++-- .../src/components/modals/MoreOptionsModal.tsx | 4 ++-- 18 files changed, 45 insertions(+), 45 deletions(-) rename components/src/forms/{InputField.tsx => LegacyInputField.tsx} (95%) diff --git a/app/src/organisms/Devices/RobotSettings/ConnectNetwork/ConnectModal/TextField.tsx b/app/src/organisms/Devices/RobotSettings/ConnectNetwork/ConnectModal/TextField.tsx index 961e47eb093..4cfa4c0c48c 100644 --- a/app/src/organisms/Devices/RobotSettings/ConnectNetwork/ConnectModal/TextField.tsx +++ b/app/src/organisms/Devices/RobotSettings/ConnectNetwork/ConnectModal/TextField.tsx @@ -1,7 +1,7 @@ import * as React from 'react' import { - InputField, + LegacyInputField, DeprecatedCheckboxField, INPUT_TYPE_TEXT, INPUT_TYPE_PASSWORD, @@ -37,7 +37,7 @@ export const TextField = (props: TextFieldProps): JSX.Element => { return ( - {isPassword && ( diff --git a/components/src/forms/InputField.stories.tsx b/components/src/forms/InputField.stories.tsx index c6d98531ff1..2ca998acd2f 100644 --- a/components/src/forms/InputField.stories.tsx +++ b/components/src/forms/InputField.stories.tsx @@ -1,7 +1,7 @@ import * as React from 'react' import { Box, SIZE_6 } from '@opentrons/components' -import { InputField as InputFieldComponent } from './InputField' +import { LegacyInputField as InputFieldComponent } from './LegacyInputField' import type { Story, Meta } from '@storybook/react' diff --git a/components/src/forms/InputField.tsx b/components/src/forms/LegacyInputField.tsx similarity index 95% rename from components/src/forms/InputField.tsx rename to components/src/forms/LegacyInputField.tsx index 899594bc187..6a4a5d2895b 100644 --- a/components/src/forms/InputField.tsx +++ b/components/src/forms/LegacyInputField.tsx @@ -8,7 +8,7 @@ export const INPUT_TYPE_PASSWORD: 'password' = 'password' // TODO: Ian 2018-09-14 remove 'label' prop when IngredientPropertiesForm gets updated -export interface InputFieldProps { +export interface LegacyInputFieldProps { /** field is disabled if value is true */ disabled?: boolean /** change handler */ @@ -57,7 +57,7 @@ export interface InputFieldProps { * @deprecated Use `InputField` in App/atoms instead */ -export function InputField(props: InputFieldProps): JSX.Element { +export function LegacyInputField(props: LegacyInputFieldProps): JSX.Element { const error = props.error != null const labelClass = cx(styles.form_field, props.className, { [styles.error]: error, @@ -88,7 +88,7 @@ export function InputField(props: InputFieldProps): JSX.Element { } // TODO(mc, 2018-02-21): maybe simplify further and split out? -function Input(props: InputFieldProps): JSX.Element { +function Input(props: LegacyInputFieldProps): JSX.Element { const error = props.error != null const value = props.isIndeterminate ? '' : props.value ?? '' const placeHolder = props.isIndeterminate ? '-' : props.placeholder diff --git a/components/src/forms/index.ts b/components/src/forms/index.ts index bdadbdaba99..c8cd6e2b0f0 100644 --- a/components/src/forms/index.ts +++ b/components/src/forms/index.ts @@ -1,7 +1,7 @@ export * from './DeprecatedCheckboxField' export * from './DropdownField' export * from './FormGroup' -export * from './InputField' +export * from './LegacyInputField' export * from './RadioGroup' export * from './Select' export * from './SelectField' diff --git a/labware-library/src/labware-creator/components/TextField.tsx b/labware-library/src/labware-creator/components/TextField.tsx index 37f2a6541f3..6072c96651f 100644 --- a/labware-library/src/labware-creator/components/TextField.tsx +++ b/labware-library/src/labware-creator/components/TextField.tsx @@ -1,10 +1,10 @@ import * as React from 'react' import { Field } from 'formik' -import { InputField } from '@opentrons/components' +import { LegacyInputField } from '@opentrons/components' import { reportFieldEdit } from '../analyticsUtils' import { getIsHidden } from '../formSelectors' import { getLabel } from '../fields' -import type { InputFieldProps } from '@opentrons/components' +import type { LegacyInputFieldProps } from '@opentrons/components' import type { LabwareFields } from '../fields' import type { FieldProps } from 'formik' import fieldStyles from './fieldStyles.module.css' @@ -13,9 +13,9 @@ interface Props { name: keyof LabwareFields label?: string placeholder?: string - caption?: InputFieldProps['caption'] + caption?: LegacyInputFieldProps['caption'] inputMasks?: Array<(prevValue: string, update: string) => string> - units?: InputFieldProps['units'] + units?: LegacyInputFieldProps['units'] } // NOTE(Ian 2019-07-23): per-field hide-when-autofilled is not yet necessary, @@ -44,7 +44,7 @@ export const TextField = (props: Props): JSX.Element => {