From 5b6d970d8825867cc5e74b618aae3bf1865b567c Mon Sep 17 00:00:00 2001 From: BABAK0T0 Date: Mon, 23 Jan 2023 15:58:12 +0100 Subject: [PATCH] =?UTF-8?q?refactor(RichSelect):=20renamed=20RichSelect=20?= =?UTF-8?q?and=20RichSelectField=20to=20Selec=E2=80=A6=20(#2216)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor(RichSelect): renamed RichSelect and RichSelectField to SelectInput and SelectInputField --- .../Form/__stories__/Playground.stories.tsx | 10 +- .../__stories__/Template.stories.tsx | 10 - .../__stories__/Groups.stories.tsx | 8 +- .../__stories__/Playground.stories.tsx | 0 .../__stories__/Template.stories.tsx | 10 + .../__stories__/index.stories.tsx | 6 +- .../__snapshots__/index.spec.tsx.snap | 72 ++--- .../__tests__/index.spec.tsx | 38 +-- .../index.tsx | 87 ++--- .../__snapshots__/index.spec.tsx.snap | 48 +-- packages/form/src/components/index.ts | 4 +- packages/form/src/index.ts | 2 +- .../DateInput/__stories__/I18n.stories.tsx | 12 +- .../List/__stories__/Animated.stories.tsx | 6 +- .../__stories__/KnownIssues.stories.tsx | 16 - .../RichSelect/__stories__/Multi.stories.tsx | 21 -- .../__stories__/NoLabel.stories.tsx | 17 - .../__stories__/OptionDisabled.stories.tsx | 18 -- .../__stories__/Required.stories.tsx | 17 - .../__stories__/Searchable.stories.tsx | 17 - .../__stories__/Template.stories.tsx | 6 - .../RichSelect/__stories__/Time.stories.tsx | 17 - .../__stories__/Animated.stories.tsx | 12 +- .../__stories__/Controlled.stories.tsx | 18 +- .../__stories__/CustomOptions.stories.tsx | 10 +- .../__stories__/Description.stories.tsx | 16 +- .../__stories__/Disabled.stories.tsx | 8 +- .../__stories__/EmptyState.stories.tsx | 2 +- .../__stories__/IsClearable.stories.tsx | 8 +- .../__stories__/KnownIssues.stories.tsx | 16 + .../__stories__/LoadingDemo.stories.tsx | 8 +- .../__stories__/LoadingExample.stories.tsx | 12 +- .../SelectInput/__stories__/Multi.stories.tsx | 21 ++ .../__stories__/MultiDisabled.stories.tsx | 8 +- .../__stories__/NoLabel.stories.tsx | 17 + .../__stories__/OptionDisabled.stories.tsx | 18 ++ .../__stories__/Playground.stories.tsx | 6 +- .../__stories__/Required.stories.tsx | 17 + .../__stories__/Searchable.stories.tsx | 17 + .../__stories__/Template.stories.tsx | 6 + .../SelectInput/__stories__/Time.stories.tsx | 17 + .../__stories__/TimeError.stories.tsx | 8 +- .../__stories__/Uncontrolled.stories.tsx | 8 +- .../__stories__/index.stories.tsx | 10 +- .../__tests__/__snapshots__/index.tsx.snap | 304 +++++++++--------- .../__tests__/index.tsx | 216 ++++++------- .../{RichSelect => SelectInput}/index.tsx | 24 +- .../__stories__/Children.stories.tsx | 16 +- .../__stories__/Controlled.stories.tsx | 2 +- .../__tests__/__snapshots__/index.tsx.snap | 12 +- .../ui/src/components/TimeInput/index.tsx | 6 +- .../UnitInput/__stories__/index.stories.tsx | 2 +- .../__tests__/__snapshots__/index.tsx.snap | 202 ++++++------ .../components/UnitInput/__tests__/index.tsx | 14 +- .../ui/src/components/UnitInput/index.tsx | 20 +- packages/ui/src/components/index.ts | 2 +- packages/ui/src/index.ts | 2 +- website/src/pages/home/AdvancedUseCases.tsx | 12 +- 58 files changed, 773 insertions(+), 766 deletions(-) delete mode 100644 packages/form/src/components/RichSelectField/__stories__/Template.stories.tsx rename packages/form/src/components/{RichSelectField => SelectInputField}/__stories__/Groups.stories.tsx (80%) rename packages/form/src/components/{RichSelectField => SelectInputField}/__stories__/Playground.stories.tsx (100%) create mode 100644 packages/form/src/components/SelectInputField/__stories__/Template.stories.tsx rename packages/form/src/components/{RichSelectField => SelectInputField}/__stories__/index.stories.tsx (81%) rename packages/form/src/components/{RichSelectField => SelectInputField}/__tests__/__snapshots__/index.spec.tsx.snap (96%) rename packages/form/src/components/{RichSelectField => SelectInputField}/__tests__/index.spec.tsx (74%) rename packages/form/src/components/{RichSelectField => SelectInputField}/index.tsx (72%) delete mode 100644 packages/ui/src/components/RichSelect/__stories__/KnownIssues.stories.tsx delete mode 100644 packages/ui/src/components/RichSelect/__stories__/Multi.stories.tsx delete mode 100644 packages/ui/src/components/RichSelect/__stories__/NoLabel.stories.tsx delete mode 100644 packages/ui/src/components/RichSelect/__stories__/OptionDisabled.stories.tsx delete mode 100644 packages/ui/src/components/RichSelect/__stories__/Required.stories.tsx delete mode 100644 packages/ui/src/components/RichSelect/__stories__/Searchable.stories.tsx delete mode 100644 packages/ui/src/components/RichSelect/__stories__/Template.stories.tsx delete mode 100644 packages/ui/src/components/RichSelect/__stories__/Time.stories.tsx rename packages/ui/src/components/{RichSelect => SelectInput}/__stories__/Animated.stories.tsx (81%) rename packages/ui/src/components/{RichSelect => SelectInput}/__stories__/Controlled.stories.tsx (52%) rename packages/ui/src/components/{RichSelect => SelectInput}/__stories__/CustomOptions.stories.tsx (75%) rename packages/ui/src/components/{RichSelect => SelectInput}/__stories__/Description.stories.tsx (85%) rename packages/ui/src/components/{RichSelect => SelectInput}/__stories__/Disabled.stories.tsx (51%) rename packages/ui/src/components/{RichSelect => SelectInput}/__stories__/EmptyState.stories.tsx (90%) rename packages/ui/src/components/{RichSelect => SelectInput}/__stories__/IsClearable.stories.tsx (52%) create mode 100644 packages/ui/src/components/SelectInput/__stories__/KnownIssues.stories.tsx rename packages/ui/src/components/{RichSelect => SelectInput}/__stories__/LoadingDemo.stories.tsx (53%) rename packages/ui/src/components/{RichSelect => SelectInput}/__stories__/LoadingExample.stories.tsx (77%) create mode 100644 packages/ui/src/components/SelectInput/__stories__/Multi.stories.tsx rename packages/ui/src/components/{RichSelect => SelectInput}/__stories__/MultiDisabled.stories.tsx (57%) create mode 100644 packages/ui/src/components/SelectInput/__stories__/NoLabel.stories.tsx create mode 100644 packages/ui/src/components/SelectInput/__stories__/OptionDisabled.stories.tsx rename packages/ui/src/components/{RichSelect => SelectInput}/__stories__/Playground.stories.tsx (74%) create mode 100644 packages/ui/src/components/SelectInput/__stories__/Required.stories.tsx create mode 100644 packages/ui/src/components/SelectInput/__stories__/Searchable.stories.tsx create mode 100644 packages/ui/src/components/SelectInput/__stories__/Template.stories.tsx create mode 100644 packages/ui/src/components/SelectInput/__stories__/Time.stories.tsx rename packages/ui/src/components/{RichSelect => SelectInput}/__stories__/TimeError.stories.tsx (50%) rename packages/ui/src/components/{RichSelect => SelectInput}/__stories__/Uncontrolled.stories.tsx (51%) rename packages/ui/src/components/{RichSelect => SelectInput}/__stories__/index.stories.tsx (84%) rename packages/ui/src/components/{RichSelect => SelectInput}/__tests__/__snapshots__/index.tsx.snap (97%) rename packages/ui/src/components/{RichSelect => SelectInput}/__tests__/index.tsx (52%) rename packages/ui/src/components/{RichSelect => SelectInput}/index.tsx (96%) diff --git a/packages/form/src/components/Form/__stories__/Playground.stories.tsx b/packages/form/src/components/Form/__stories__/Playground.stories.tsx index 6192223f09..348bfc354c 100644 --- a/packages/form/src/components/Form/__stories__/Playground.stories.tsx +++ b/packages/form/src/components/Form/__stories__/Playground.stories.tsx @@ -7,7 +7,7 @@ import { DateField, Form, RadioField, - RichSelectField, + SelectInputField, SelectableCardField, Submit, SubmitErrorAlert, @@ -78,10 +78,10 @@ export const Playground: ComponentStory = args => { regex={[emailRegex]} /> - - 1 - 2 - + + 1 + 2 + diff --git a/packages/form/src/components/RichSelectField/__stories__/Template.stories.tsx b/packages/form/src/components/RichSelectField/__stories__/Template.stories.tsx deleted file mode 100644 index 65b52c9f8a..0000000000 --- a/packages/form/src/components/RichSelectField/__stories__/Template.stories.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import type { Story } from '@storybook/react' -import type { RichSelectFieldProps } from '..' -import { RichSelectField } from '..' - -export const Template: Story = args => ( - - Label - Label 2 - -) diff --git a/packages/form/src/components/RichSelectField/__stories__/Groups.stories.tsx b/packages/form/src/components/SelectInputField/__stories__/Groups.stories.tsx similarity index 80% rename from packages/form/src/components/RichSelectField/__stories__/Groups.stories.tsx rename to packages/form/src/components/SelectInputField/__stories__/Groups.stories.tsx index a3f5fbafdc..fe429e1d5f 100644 --- a/packages/form/src/components/RichSelectField/__stories__/Groups.stories.tsx +++ b/packages/form/src/components/SelectInputField/__stories__/Groups.stories.tsx @@ -1,9 +1,9 @@ import type { Story } from '@storybook/react' -import type { RichSelectFieldProps } from '..' -import { RichSelectField } from '..' +import type { SelectInputFieldProps } from '..' +import { SelectInputField } from '..' -export const Groups: Story = () => ( - = () => ( + = args => ( + + Label + Label 2 + +) diff --git a/packages/form/src/components/RichSelectField/__stories__/index.stories.tsx b/packages/form/src/components/SelectInputField/__stories__/index.stories.tsx similarity index 81% rename from packages/form/src/components/RichSelectField/__stories__/index.stories.tsx rename to packages/form/src/components/SelectInputField/__stories__/index.stories.tsx index 7c6124ed52..75f39b6359 100644 --- a/packages/form/src/components/RichSelectField/__stories__/index.stories.tsx +++ b/packages/form/src/components/SelectInputField/__stories__/index.stories.tsx @@ -1,6 +1,6 @@ import styled from '@emotion/styled' import type { Meta } from '@storybook/react' -import { Form, RichSelectField } from '../..' +import { Form, SelectInputField } from '../..' import { mockErrors } from '../../../mocks' const Container = styled.div` @@ -8,7 +8,7 @@ const Container = styled.div` ` export default { - component: RichSelectField, + component: SelectInputField, decorators: [ ChildStory => (
{}} errors={mockErrors}> @@ -23,7 +23,7 @@ export default { }, }, }, - title: 'Form/Components/Fields/RichSelectField', + title: 'Form/Components/Fields/SelectInputField', } as Meta export { Playground } from './Playground.stories' diff --git a/packages/form/src/components/RichSelectField/__tests__/__snapshots__/index.spec.tsx.snap b/packages/form/src/components/SelectInputField/__tests__/__snapshots__/index.spec.tsx.snap similarity index 96% rename from packages/form/src/components/RichSelectField/__tests__/__snapshots__/index.spec.tsx.snap rename to packages/form/src/components/SelectInputField/__tests__/__snapshots__/index.spec.tsx.snap index dea88507de..00a14484cd 100644 --- a/packages/form/src/components/RichSelectField/__tests__/__snapshots__/index.spec.tsx.snap +++ b/packages/form/src/components/SelectInputField/__tests__/__snapshots__/index.spec.tsx.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`RichSelectField should display right value on grouped options 1`] = ` +exports[`SelectInputField should display right value on grouped options 1`] = ` .cache-1gb28ew-container-StyledContainer { width: 100%; @@ -277,8 +277,8 @@ exports[`RichSelectField should display right value on grouped options 1`] = ` novalidate="" >
Select... @@ -362,10 +362,10 @@ exports[`RichSelectField should display right value on grouped options 1`] = ` value="Group Value" />
@@ -373,7 +373,7 @@ exports[`RichSelectField should display right value on grouped options 1`] = ` `; -exports[`RichSelectField should render correctly 1`] = ` +exports[`SelectInputField should render correctly 1`] = ` .cache-1gb28ew-container-StyledContainer { width: 100%; @@ -635,8 +635,8 @@ exports[`RichSelectField should render correctly 1`] = ` novalidate="" >
Select... @@ -722,10 +722,10 @@ exports[`RichSelectField should render correctly 1`] = ` value="" />
@@ -733,7 +733,7 @@ exports[`RichSelectField should render correctly 1`] = ` `; -exports[`RichSelectField should render correctly disabled 1`] = ` +exports[`SelectInputField should render correctly disabled 1`] = ` .cache-iwdjsb-container-StyledContainer { width: 100%; @@ -981,8 +981,8 @@ exports[`RichSelectField should render correctly disabled 1`] = ` novalidate="" >
Select... @@ -1064,10 +1064,10 @@ exports[`RichSelectField should render correctly disabled 1`] = `
@@ -1075,7 +1075,7 @@ exports[`RichSelectField should render correctly disabled 1`] = `
`; -exports[`RichSelectField should render correctly multiple 1`] = ` +exports[`SelectInputField should render correctly multiple 1`] = ` .cache-1gb28ew-container-StyledContainer { width: 100%; @@ -1336,8 +1336,8 @@ exports[`RichSelectField should render correctly multiple 1`] = ` novalidate="" >
Select... @@ -1425,10 +1425,10 @@ exports[`RichSelectField should render correctly multiple 1`] = ` />
@@ -1436,7 +1436,7 @@ exports[`RichSelectField should render correctly multiple 1`] = `
`; -exports[`RichSelectField should render correctly with a disabled option 1`] = ` +exports[`SelectInputField should render correctly with a disabled option 1`] = ` .cache-1gb28ew-container-StyledContainer { width: 100%; @@ -1698,8 +1698,8 @@ exports[`RichSelectField should render correctly with a disabled option 1`] = ` novalidate="" >
Select... @@ -1785,10 +1785,10 @@ exports[`RichSelectField should render correctly with a disabled option 1`] = ` value="" />
@@ -1796,7 +1796,7 @@ exports[`RichSelectField should render correctly with a disabled option 1`] = ` `; -exports[`RichSelectField should trigger events 1`] = ` +exports[`SelectInputField should trigger events 1`] = ` .cache-1gb28ew-container-StyledContainer { width: 100%; @@ -2073,8 +2073,8 @@ exports[`RichSelectField should trigger events 1`] = ` novalidate="" >
Select... @@ -2158,10 +2158,10 @@ exports[`RichSelectField should trigger events 1`] = ` value="value" />
diff --git a/packages/form/src/components/RichSelectField/__tests__/index.spec.tsx b/packages/form/src/components/SelectInputField/__tests__/index.spec.tsx similarity index 74% rename from packages/form/src/components/RichSelectField/__tests__/index.spec.tsx rename to packages/form/src/components/SelectInputField/__tests__/index.spec.tsx index 7481f50849..915454603e 100644 --- a/packages/form/src/components/RichSelectField/__tests__/index.spec.tsx +++ b/packages/form/src/components/SelectInputField/__tests__/index.spec.tsx @@ -1,46 +1,46 @@ import { fireEvent } from '@testing-library/dom' import { act } from '@testing-library/react' -import { RichSelectField } from '..' +import { SelectInputField } from '..' import { mockRandom, restoreRandom, shouldMatchEmotionSnapshotFormWrapper, } from '../../../../.jest/helpers' -describe('RichSelectField', () => { +describe('SelectInputField', () => { beforeAll(mockRandom) afterAll(restoreRandom) test('should render correctly', () => shouldMatchEmotionSnapshotFormWrapper( - - - , + + + , )) test('should render correctly disabled', () => shouldMatchEmotionSnapshotFormWrapper( - - - - , + + + + , )) test('should render correctly multiple', () => shouldMatchEmotionSnapshotFormWrapper( - - - - , + + + + , )) test('should render correctly with a disabled option', () => shouldMatchEmotionSnapshotFormWrapper( - - - - , + + + + , )) test('should display right value on grouped options', () => { @@ -56,7 +56,7 @@ describe('RichSelectField', () => { ] return shouldMatchEmotionSnapshotFormWrapper( - , + , { transform: async ({ getByRole, getByTestId, container }) => { const select = getByRole('combobox') as HTMLInputElement @@ -85,7 +85,7 @@ describe('RichSelectField', () => { const onChange = jest.fn() return shouldMatchEmotionSnapshotFormWrapper( - /** - * Custom components of the RichSelect. See [React select documentation](https://react-select.com/components) + * Custom components of the SelectInput. See [React select documentation](https://react-select.com/components) */ customComponents?: SelectProps['components'] children: ReactNode @@ -88,17 +88,17 @@ type RichSelectProps = Partial< } > -type RichSelectOptionProps = OptionProps -type RichSelectOptionElement = ReactElement -type RichSelectOptions = SelectProps['options'] -type RichSelectOptionOrGroup = NonNullable[number] -type RichSelectOption = { value: string; label: string } +type SelectInputOptionProps = OptionProps +type SelectInputOptionElement = ReactElement +type SelectInputOptions = SelectProps['options'] +type SelectInputOptionOrGroup = NonNullable[number] +type SelectInputOption = { value: string; label: string } -export type RichSelectFieldProps< - T extends RichSelectOptionOrGroup = RichSelectOptionOrGroup, +export type SelectInputFieldProps< + T extends SelectInputOptionOrGroup = SelectInputOptionOrGroup, > = BaseFieldProps & Pick< - RichSelectProps, + SelectInputProps, | 'animation' | 'animationDuration' | 'animationOnChange' @@ -132,8 +132,8 @@ export type RichSelectFieldProps< const identity = (x: T) => x -export const RichSelectField = < - T extends RichSelectOptionOrGroup = RichSelectOptionOrGroup, +export const SelectInputField = < + T extends SelectInputOptionOrGroup = SelectInputOptionOrGroup, >({ animation, animationDuration, @@ -167,7 +167,7 @@ export const RichSelectField = < noTopLabel, noOptionsMessage, customStyle, -}: RichSelectFieldProps) => { +}: SelectInputFieldProps) => { const { getError } = useErrors() const options = useMemo( @@ -176,11 +176,11 @@ export const RichSelectField = < (( Children.toArray(children) .flat() - .filter(Boolean) as RichSelectOptionElement[] + .filter(Boolean) as SelectInputOptionElement[] ).map(({ props: { children: labelChild, ...option } }) => ({ ...option, label: labelChild, - })) as RichSelectOptions), + })) as SelectInputOptions), [optionsProp, children], ) @@ -189,27 +189,29 @@ export const RichSelectField = < multiple ? parseProp : (option: unknown) => - parseProp((option as RichSelectOption)?.value ?? null, name), + parseProp((option as SelectInputOption)?.value ?? null, name), [multiple, parseProp, name], ) const format = useCallback( (val: T) => { - if (multiple) return formatProp(val, name) as RichSelectOption + if (multiple) return formatProp(val, name) as SelectInputOption - const find = (opts: RichSelectOptionOrGroup[], valueToFind: string) => - opts?.find(option => (option as RichSelectOption).value === valueToFind) + const find = (opts: SelectInputOptionOrGroup[], valueToFind: string) => + opts?.find( + option => (option as SelectInputOption).value === valueToFind, + ) let selected: - | RichSelectOptionOrGroup - | (RichSelectOptionOrGroup | undefined)[] + | SelectInputOptionOrGroup + | (SelectInputOptionOrGroup | undefined)[] | string | undefined = '' if (val && options) { // TODO: find a proper way to simplify format with recursive options selected = find( - options as unknown as RichSelectOptionOrGroup[], + options as unknown as SelectInputOptionOrGroup[], val as unknown as string, ) @@ -217,7 +219,7 @@ export const RichSelectField = < selected = options .map(curr => find( - (curr as unknown as { options: RichSelectOptionOrGroup[] }) + (curr as unknown as { options: SelectInputOptionOrGroup[] }) .options, val as unknown as string, ), @@ -229,22 +231,25 @@ export const RichSelectField = < } } - return formatProp(selected as T, name) as RichSelectOption + return formatProp(selected as T, name) as SelectInputOption }, [formatProp, multiple, name, options], ) - const { input, meta } = useFormField(name, { - disabled, - format, - formatOnBlur, - maxLength, - minLength: minLength || required ? 1 : undefined, - multiple, - parse, - required, - value, - }) + const { input, meta } = useFormField( + name, + { + disabled, + format, + formatOnBlur, + maxLength, + minLength: minLength || required ? 1 : undefined, + multiple, + parse, + required, + value, + }, + ) const error = getError({ errorProp, @@ -255,7 +260,7 @@ export const RichSelectField = < }) return ( - {children} - + ) } -RichSelectField.Option = RichSelect.Option +SelectInputField.Option = SelectInput.Option diff --git a/packages/form/src/components/TimeField/__tests__/__snapshots__/index.spec.tsx.snap b/packages/form/src/components/TimeField/__tests__/__snapshots__/index.spec.tsx.snap index 8b08ab09d5..83fdea771a 100644 --- a/packages/form/src/components/TimeField/__tests__/__snapshots__/index.spec.tsx.snap +++ b/packages/form/src/components/TimeField/__tests__/__snapshots__/index.spec.tsx.snap @@ -290,8 +290,8 @@ exports[`TimeField should render correctly 1`] = ` novalidate="" >
Select... @@ -357,7 +357,7 @@ exports[`TimeField should render correctly 1`] = ` >
@@ -674,8 +674,8 @@ exports[`TimeField should render correctly checked without value 1`] = ` novalidate="" >
Select... @@ -741,7 +741,7 @@ exports[`TimeField should render correctly checked without value 1`] = ` >
@@ -1045,8 +1045,8 @@ exports[`TimeField should render correctly disabled 1`] = ` novalidate="" >
Select... @@ -1113,7 +1113,7 @@ exports[`TimeField should render correctly disabled 1`] = ` >
@@ -1430,8 +1430,8 @@ exports[`TimeField should trigger events 1`] = ` novalidate="" >
Select... @@ -1499,7 +1499,7 @@ exports[`TimeField should trigger events 1`] = ` >
diff --git a/packages/form/src/components/index.ts b/packages/form/src/components/index.ts index 58366bc8da..20d3521540 100644 --- a/packages/form/src/components/index.ts +++ b/packages/form/src/components/index.ts @@ -3,8 +3,8 @@ export { DateField } from './DateField' export type { FormProps } from './Form' export { Form } from './Form' export { RadioField } from './RadioField' -export type { RichSelectFieldProps } from './RichSelectField' -export { RichSelectField } from './RichSelectField' +export type { SelectInputFieldProps } from './SelectInputField' +export { SelectInputField } from './SelectInputField' export { SelectableCardField } from './SelectableCardField' export { SelectNumberField } from './SelectNumberField' export { SubmitErrorAlert } from './SubmitErrorAlert' diff --git a/packages/form/src/index.ts b/packages/form/src/index.ts index 04e818e23b..0cf70e0629 100644 --- a/packages/form/src/index.ts +++ b/packages/form/src/index.ts @@ -7,8 +7,8 @@ export { DateField, Form, RadioField, - RichSelectField, SelectableCardField, + SelectInputField, SelectNumberField, Submit, SubmitErrorAlert, diff --git a/packages/ui/src/components/DateInput/__stories__/I18n.stories.tsx b/packages/ui/src/components/DateInput/__stories__/I18n.stories.tsx index 4158bb216a..373bab1863 100644 --- a/packages/ui/src/components/DateInput/__stories__/I18n.stories.tsx +++ b/packages/ui/src/components/DateInput/__stories__/I18n.stories.tsx @@ -2,8 +2,8 @@ import { useI18n } from '@scaleway/use-i18n' import type { Story } from '@storybook/react' import type { ComponentProps } from 'react' import { DateInput } from '..' -import type { SelectOption } from '../../RichSelect' -import { RichSelect } from '../../RichSelect' +import type { SelectOption } from '../../SelectInput' +import { SelectInput } from '../../SelectInput' export const I18n: Story> = () => { const { locales, currentLocale, switchLocale, dateFnsLocale } = useI18n() @@ -14,7 +14,7 @@ export const I18n: Story> = () => { return (
- > = () => { noTopLabel > {locales.map(locale => ( - + {locale} - + ))} - + {}} label={currentLocale} />
) diff --git a/packages/ui/src/components/List/__stories__/Animated.stories.tsx b/packages/ui/src/components/List/__stories__/Animated.stories.tsx index a40d6a8497..bd4659f881 100644 --- a/packages/ui/src/components/List/__stories__/Animated.stories.tsx +++ b/packages/ui/src/components/List/__stories__/Animated.stories.tsx @@ -3,8 +3,8 @@ import List from '..' import { generateData } from '../../../mocks/list' import * as animations from '../../../utils/animations' import { Button } from '../../Button' -import type { SelectOption } from '../../RichSelect' -import { RichSelect } from '../../RichSelect' +import type { SelectOption } from '../../SelectInput' +import { SelectInput } from '../../SelectInput' import { Stack } from '../../Stack' const selectableAnimations = Object.keys(animations).map(animation => ({ @@ -21,7 +21,7 @@ export const Animated = () => { return ( - setCurrentAnimation(value as SelectOption)} diff --git a/packages/ui/src/components/RichSelect/__stories__/KnownIssues.stories.tsx b/packages/ui/src/components/RichSelect/__stories__/KnownIssues.stories.tsx deleted file mode 100644 index 1dcfcdf198..0000000000 --- a/packages/ui/src/components/RichSelect/__stories__/KnownIssues.stories.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { Template } from './Template.stories' - -export const KnownIssues = Template.bind({}) - -KnownIssues.parameters = { - docs: { - storyDescription: `#### RichSelect doesn’t keep focus on selected option - -RichSelect is based on the \`react-select\` library. To keep the focus on the selected option you need to use \`options\` prop with a memoized value or a memoized \`children\` - -#### OnChange signature is broken and will cause typescript type check error - -Use @ts-expect-error if needed. -`, - }, -} diff --git a/packages/ui/src/components/RichSelect/__stories__/Multi.stories.tsx b/packages/ui/src/components/RichSelect/__stories__/Multi.stories.tsx deleted file mode 100644 index b1ca528556..0000000000 --- a/packages/ui/src/components/RichSelect/__stories__/Multi.stories.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { RichSelect } from '..' -import { Template } from './Template.stories' - -export const Multi = Template.bind({}) -Multi.args = { - name: 'multi', - isMulti: true, - children: [ - Option A, - Option B, - Option C, - Option D, - Option E, - Option F, - ], -} -Multi.parameters = { - docs: { - storyDescription: 'This shows how to use `isMulti`on RichSelect.', - }, -} diff --git a/packages/ui/src/components/RichSelect/__stories__/NoLabel.stories.tsx b/packages/ui/src/components/RichSelect/__stories__/NoLabel.stories.tsx deleted file mode 100644 index 6cfd8f580c..0000000000 --- a/packages/ui/src/components/RichSelect/__stories__/NoLabel.stories.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { RichSelect } from '..' -import { Template } from './Template.stories' - -export const NoLabel = Template.bind({}) -NoLabel.args = { - name: 'no-label', - noTopLabel: true, - children: [ - Option A, - Option B, - ], -} -NoLabel.parameters = { - docs: { - storyDescription: 'This shows how to use `noTopLabel` in RichSelect.', - }, -} diff --git a/packages/ui/src/components/RichSelect/__stories__/OptionDisabled.stories.tsx b/packages/ui/src/components/RichSelect/__stories__/OptionDisabled.stories.tsx deleted file mode 100644 index 91aeee5f0e..0000000000 --- a/packages/ui/src/components/RichSelect/__stories__/OptionDisabled.stories.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { RichSelect } from '../..' -import { Template } from './Template.stories' - -export const OptionDisabled = Template.bind({}) -OptionDisabled.args = { - name: 'option-disabled', - children: [ - Option A, - - Option B - , - ], -} -OptionDisabled.parameters = { - docs: { - storyDescription: 'This shows how to use `disabled` on RichSelect.Option.', - }, -} diff --git a/packages/ui/src/components/RichSelect/__stories__/Required.stories.tsx b/packages/ui/src/components/RichSelect/__stories__/Required.stories.tsx deleted file mode 100644 index 53b2a8a171..0000000000 --- a/packages/ui/src/components/RichSelect/__stories__/Required.stories.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { RichSelect } from '..' -import { Template } from './Template.stories' - -export const Required = Template.bind({}) -Required.args = { - name: 'required', - required: true, - children: [ - Option A, - Option B, - ], -} -Required.parameters = { - docs: { - storyDescription: 'This shows how to use `required` on RichSelect', - }, -} diff --git a/packages/ui/src/components/RichSelect/__stories__/Searchable.stories.tsx b/packages/ui/src/components/RichSelect/__stories__/Searchable.stories.tsx deleted file mode 100644 index 4888c8707d..0000000000 --- a/packages/ui/src/components/RichSelect/__stories__/Searchable.stories.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { RichSelect } from '..' -import { Template } from './Template.stories' - -export const Searchable = Template.bind({}) -Searchable.args = { - name: 'required', - isSearchable: true, - children: [ - Option A, - Option B, - ], -} -Searchable.parameters = { - docs: { - storyDescription: 'This shows how to use `isSearchable` on RichSelect.', - }, -} diff --git a/packages/ui/src/components/RichSelect/__stories__/Template.stories.tsx b/packages/ui/src/components/RichSelect/__stories__/Template.stories.tsx deleted file mode 100644 index f2f83230c7..0000000000 --- a/packages/ui/src/components/RichSelect/__stories__/Template.stories.tsx +++ /dev/null @@ -1,6 +0,0 @@ -import type { ComponentStory } from '@storybook/react' -import { RichSelect } from '..' - -export const Template: ComponentStory = ({ ...props }) => ( - -) diff --git a/packages/ui/src/components/RichSelect/__stories__/Time.stories.tsx b/packages/ui/src/components/RichSelect/__stories__/Time.stories.tsx deleted file mode 100644 index b4876925dc..0000000000 --- a/packages/ui/src/components/RichSelect/__stories__/Time.stories.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { RichSelect } from '..' -import { Template } from './Template.stories' - -export const Time = Template.bind({}) -Time.args = { - name: 'time', - time: true, - children: [ - 11:00, - 12:00, - ], -} -Time.parameters = { - docs: { - storyDescription: 'This shows how to use `time` on RichSelect', - }, -} diff --git a/packages/ui/src/components/RichSelect/__stories__/Animated.stories.tsx b/packages/ui/src/components/SelectInput/__stories__/Animated.stories.tsx similarity index 81% rename from packages/ui/src/components/RichSelect/__stories__/Animated.stories.tsx rename to packages/ui/src/components/SelectInput/__stories__/Animated.stories.tsx index cbfb1dc747..5486e0b18f 100644 --- a/packages/ui/src/components/RichSelect/__stories__/Animated.stories.tsx +++ b/packages/ui/src/components/SelectInput/__stories__/Animated.stories.tsx @@ -1,13 +1,13 @@ import type { ComponentStory } from '@storybook/react' import { useState } from 'react' import type { SingleValue } from 'react-select' -import { RichSelect } from '..' +import { SelectInput } from '..' import { Button } from '../..' import * as animations from '../../../utils/animations' type OptionType = { label: string; value: string } -export const Animated: ComponentStory = ({ ...props }) => { +export const Animated: ComponentStory = ({ ...props }) => { const [options] = useState( Object.keys(animations).map(animation => ({ label: animation, @@ -28,13 +28,13 @@ export const Animated: ComponentStory = ({ ...props }) => { - = ({ ...props }) => { Animated.parameters = { docs: { - storyDescription: `THis shows how to use \`animationOnChange\`, \`animation\` and \`animationDuration\` on RichSelect. -The animation will be played when the value changes. Animation start when you select new value but also if you change the value of RichSelect with an external way (check example with button). + storyDescription: `THis shows how to use \`animationOnChange\`, \`animation\` and \`animationDuration\` on SelectInput. +The animation will be played when the value changes. Animation start when you select new value but also if you change the value of SelectInput with an external way (check example with button). #### Available animations diff --git a/packages/ui/src/components/RichSelect/__stories__/Controlled.stories.tsx b/packages/ui/src/components/SelectInput/__stories__/Controlled.stories.tsx similarity index 52% rename from packages/ui/src/components/RichSelect/__stories__/Controlled.stories.tsx rename to packages/ui/src/components/SelectInput/__stories__/Controlled.stories.tsx index 1668e9b116..811d67fc2c 100644 --- a/packages/ui/src/components/RichSelect/__stories__/Controlled.stories.tsx +++ b/packages/ui/src/components/SelectInput/__stories__/Controlled.stories.tsx @@ -1,11 +1,13 @@ import type { ComponentStory } from '@storybook/react' import { useState } from 'react' import type { SingleValue } from 'react-select' -import { RichSelect } from '..' +import { SelectInput } from '..' type OptionType = { label: string; value: string } -export const Controlled: ComponentStory = ({ ...props }) => { +export const Controlled: ComponentStory = ({ + ...props +}) => { const [value, setValue] = useState() const handleChange = (newValue: SingleValue) => { @@ -15,21 +17,21 @@ export const Controlled: ComponentStory = ({ ...props }) => { } return ( - - Option A - Option B - + Option A + Option B + ) } Controlled.parameters = { docs: { - storyDescription: 'This shows how to use Controlled RichSelect.', + storyDescription: 'This shows how to use Controlled SelectInput.', }, } diff --git a/packages/ui/src/components/RichSelect/__stories__/CustomOptions.stories.tsx b/packages/ui/src/components/SelectInput/__stories__/CustomOptions.stories.tsx similarity index 75% rename from packages/ui/src/components/RichSelect/__stories__/CustomOptions.stories.tsx rename to packages/ui/src/components/SelectInput/__stories__/CustomOptions.stories.tsx index 215f7aba15..7a5a228ac5 100644 --- a/packages/ui/src/components/RichSelect/__stories__/CustomOptions.stories.tsx +++ b/packages/ui/src/components/SelectInput/__stories__/CustomOptions.stories.tsx @@ -1,4 +1,4 @@ -import { RichSelect } from '..' +import { SelectInput } from '..' import { Badge } from '../../Badge' import { Template } from './Template.stories' @@ -6,8 +6,8 @@ export const CustomOptions = Template.bind({}) CustomOptions.args = { name: 'custom-options', children: [ - Option A, - + Option A, +
Option BAwesome badge
-
, + , ], } CustomOptions.parameters = { docs: { - storyDescription: 'This shows how to customize options in a RichSelect.', + storyDescription: 'This shows how to customize options in a SelectInput.', }, } diff --git a/packages/ui/src/components/RichSelect/__stories__/Description.stories.tsx b/packages/ui/src/components/SelectInput/__stories__/Description.stories.tsx similarity index 85% rename from packages/ui/src/components/RichSelect/__stories__/Description.stories.tsx rename to packages/ui/src/components/SelectInput/__stories__/Description.stories.tsx index 6ce8d79def..4848a3af34 100644 --- a/packages/ui/src/components/RichSelect/__stories__/Description.stories.tsx +++ b/packages/ui/src/components/SelectInput/__stories__/Description.stories.tsx @@ -1,4 +1,4 @@ -import { RichSelect } from '..' +import { SelectInput } from '..' import { Template } from './Template.stories' export const Description = Template.bind({}) @@ -7,24 +7,24 @@ Description.args = { isClearable: true, value: { label: 'Option A', value: 'a' }, children: [ - Option A - , - , + Option B - , - , + Option with long description - , + , ], } Description.decorators = [ @@ -39,7 +39,7 @@ Description.parameters = { docs: { description: { story: - 'This shows how to use `description` and `inlineDescription` on RichSelect.Option.', + 'This shows how to use `description` and `inlineDescription` on SelectInput.Option.', }, }, } diff --git a/packages/ui/src/components/RichSelect/__stories__/Disabled.stories.tsx b/packages/ui/src/components/SelectInput/__stories__/Disabled.stories.tsx similarity index 51% rename from packages/ui/src/components/RichSelect/__stories__/Disabled.stories.tsx rename to packages/ui/src/components/SelectInput/__stories__/Disabled.stories.tsx index 984a12d4f1..0ed3678fb3 100644 --- a/packages/ui/src/components/RichSelect/__stories__/Disabled.stories.tsx +++ b/packages/ui/src/components/SelectInput/__stories__/Disabled.stories.tsx @@ -1,4 +1,4 @@ -import { RichSelect } from '..' +import { SelectInput } from '..' import { Template } from './Template.stories' export const Disabled = Template.bind({}) @@ -7,12 +7,12 @@ Disabled.args = { disabled: true, value: { label: 'Option A', value: 'a' }, children: [ - Option A, - Option B, + Option A, + Option B, ], } Disabled.parameters = { docs: { - storyDescription: 'This shows how to use `disabled` on RichSelect.', + storyDescription: 'This shows how to use `disabled` on SelectInput.', }, } diff --git a/packages/ui/src/components/RichSelect/__stories__/EmptyState.stories.tsx b/packages/ui/src/components/SelectInput/__stories__/EmptyState.stories.tsx similarity index 90% rename from packages/ui/src/components/RichSelect/__stories__/EmptyState.stories.tsx rename to packages/ui/src/components/SelectInput/__stories__/EmptyState.stories.tsx index 32462493c9..8d47fc05c5 100644 --- a/packages/ui/src/components/RichSelect/__stories__/EmptyState.stories.tsx +++ b/packages/ui/src/components/SelectInput/__stories__/EmptyState.stories.tsx @@ -24,7 +24,7 @@ EmptyState.args = { EmptyState.parameters = { docs: { description: { - story: 'This shows how to use `emptyState` on RichSelect.', + story: 'This shows how to use `emptyState` on SelectInput.', }, }, } diff --git a/packages/ui/src/components/RichSelect/__stories__/IsClearable.stories.tsx b/packages/ui/src/components/SelectInput/__stories__/IsClearable.stories.tsx similarity index 52% rename from packages/ui/src/components/RichSelect/__stories__/IsClearable.stories.tsx rename to packages/ui/src/components/SelectInput/__stories__/IsClearable.stories.tsx index d77368cb20..2e8dc2ac6d 100644 --- a/packages/ui/src/components/RichSelect/__stories__/IsClearable.stories.tsx +++ b/packages/ui/src/components/SelectInput/__stories__/IsClearable.stories.tsx @@ -1,4 +1,4 @@ -import { RichSelect } from '..' +import { SelectInput } from '..' import { Template } from './Template.stories' export const IsClearable = Template.bind({}) @@ -7,12 +7,12 @@ IsClearable.args = { isClearable: true, value: { label: 'Option A', value: 'a' }, children: [ - Option A, - Option B, + Option A, + Option B, ], } IsClearable.parameters = { docs: { - storyDescription: 'This shows how to use `isClearable` on RichSelect.', + storyDescription: 'This shows how to use `isClearable` on SelectInput.', }, } diff --git a/packages/ui/src/components/SelectInput/__stories__/KnownIssues.stories.tsx b/packages/ui/src/components/SelectInput/__stories__/KnownIssues.stories.tsx new file mode 100644 index 0000000000..aefc4e53a0 --- /dev/null +++ b/packages/ui/src/components/SelectInput/__stories__/KnownIssues.stories.tsx @@ -0,0 +1,16 @@ +import { Template } from './Template.stories' + +export const KnownIssues = Template.bind({}) + +KnownIssues.parameters = { + docs: { + storyDescription: `#### SelectInput doesn’t keep focus on selected option + +SelectInput is based on the \`react-select\` library. To keep the focus on the selected option you need to use \`options\` prop with a memoized value or a memoized \`children\` + +#### OnChange signature is broken and will cause typescript type check error + +Use @ts-expect-error if needed. +`, + }, +} diff --git a/packages/ui/src/components/RichSelect/__stories__/LoadingDemo.stories.tsx b/packages/ui/src/components/SelectInput/__stories__/LoadingDemo.stories.tsx similarity index 53% rename from packages/ui/src/components/RichSelect/__stories__/LoadingDemo.stories.tsx rename to packages/ui/src/components/SelectInput/__stories__/LoadingDemo.stories.tsx index 0ac91e8ca4..0c4123bceb 100644 --- a/packages/ui/src/components/RichSelect/__stories__/LoadingDemo.stories.tsx +++ b/packages/ui/src/components/SelectInput/__stories__/LoadingDemo.stories.tsx @@ -1,4 +1,4 @@ -import { RichSelect } from '..' +import { SelectInput } from '..' import { Template } from './Template.stories' export const LoadingDemo = Template.bind({}) @@ -8,12 +8,12 @@ LoadingDemo.args = { disabled: true, value: { label: 'Option A', value: 'a' }, children: [ - Option A, - Option B, + Option A, + Option B, ], } LoadingDemo.parameters = { docs: { - storyDescription: 'This shows how to use `isLoading` on RichSelect', + storyDescription: 'This shows how to use `isLoading` on SelectInput', }, } diff --git a/packages/ui/src/components/RichSelect/__stories__/LoadingExample.stories.tsx b/packages/ui/src/components/SelectInput/__stories__/LoadingExample.stories.tsx similarity index 77% rename from packages/ui/src/components/RichSelect/__stories__/LoadingExample.stories.tsx rename to packages/ui/src/components/SelectInput/__stories__/LoadingExample.stories.tsx index 439aa26693..500fa7925d 100644 --- a/packages/ui/src/components/RichSelect/__stories__/LoadingExample.stories.tsx +++ b/packages/ui/src/components/SelectInput/__stories__/LoadingExample.stories.tsx @@ -1,9 +1,9 @@ import type { ComponentStory } from '@storybook/react' import { useEffect, useState } from 'react' -import { RichSelect } from '..' +import { SelectInput } from '..' import { Button, Loader } from '../..' -export const LoadingExample: ComponentStory = ({ +export const LoadingExample: ComponentStory = ({ ...props }) => { const [isLoading, setIsLoading] = useState(true) @@ -24,7 +24,7 @@ export const LoadingExample: ComponentStory = ({ - = ({ }} {...props} > - Option A + Option A {!isLoading && ( - Option B + Option B )} - + ) } diff --git a/packages/ui/src/components/SelectInput/__stories__/Multi.stories.tsx b/packages/ui/src/components/SelectInput/__stories__/Multi.stories.tsx new file mode 100644 index 0000000000..a299f3eff9 --- /dev/null +++ b/packages/ui/src/components/SelectInput/__stories__/Multi.stories.tsx @@ -0,0 +1,21 @@ +import { SelectInput } from '..' +import { Template } from './Template.stories' + +export const Multi = Template.bind({}) +Multi.args = { + name: 'multi', + isMulti: true, + children: [ + Option A, + Option B, + Option C, + Option D, + Option E, + Option F, + ], +} +Multi.parameters = { + docs: { + storyDescription: 'This shows how to use `isMulti`on SelectInput.', + }, +} diff --git a/packages/ui/src/components/RichSelect/__stories__/MultiDisabled.stories.tsx b/packages/ui/src/components/SelectInput/__stories__/MultiDisabled.stories.tsx similarity index 57% rename from packages/ui/src/components/RichSelect/__stories__/MultiDisabled.stories.tsx rename to packages/ui/src/components/SelectInput/__stories__/MultiDisabled.stories.tsx index 0d53e18e45..a67ef17692 100644 --- a/packages/ui/src/components/RichSelect/__stories__/MultiDisabled.stories.tsx +++ b/packages/ui/src/components/SelectInput/__stories__/MultiDisabled.stories.tsx @@ -1,4 +1,4 @@ -import { RichSelect } from '..' +import { SelectInput } from '..' import { Template } from './Template.stories' export const MultiDisabled = Template.bind({}) @@ -8,13 +8,13 @@ MultiDisabled.args = { disabled: true, value: { label: 'Option A', value: 'a' }, children: [ - Option A, - Option B, + Option A, + Option B, ], } MultiDisabled.parameters = { docs: { storyDescription: - 'This shows how to use `disabled` on `isMulti` RichSelect.', + 'This shows how to use `disabled` on `isMulti` SelectInput.', }, } diff --git a/packages/ui/src/components/SelectInput/__stories__/NoLabel.stories.tsx b/packages/ui/src/components/SelectInput/__stories__/NoLabel.stories.tsx new file mode 100644 index 0000000000..28d9aafed3 --- /dev/null +++ b/packages/ui/src/components/SelectInput/__stories__/NoLabel.stories.tsx @@ -0,0 +1,17 @@ +import { SelectInput } from '..' +import { Template } from './Template.stories' + +export const NoLabel = Template.bind({}) +NoLabel.args = { + name: 'no-label', + noTopLabel: true, + children: [ + Option A, + Option B, + ], +} +NoLabel.parameters = { + docs: { + storyDescription: 'This shows how to use `noTopLabel` in SelectInput.', + }, +} diff --git a/packages/ui/src/components/SelectInput/__stories__/OptionDisabled.stories.tsx b/packages/ui/src/components/SelectInput/__stories__/OptionDisabled.stories.tsx new file mode 100644 index 0000000000..9d2254d4b8 --- /dev/null +++ b/packages/ui/src/components/SelectInput/__stories__/OptionDisabled.stories.tsx @@ -0,0 +1,18 @@ +import { SelectInput } from '../..' +import { Template } from './Template.stories' + +export const OptionDisabled = Template.bind({}) +OptionDisabled.args = { + name: 'option-disabled', + children: [ + Option A, + + Option B + , + ], +} +OptionDisabled.parameters = { + docs: { + storyDescription: 'This shows how to use `disabled` on SelectInput.Option.', + }, +} diff --git a/packages/ui/src/components/RichSelect/__stories__/Playground.stories.tsx b/packages/ui/src/components/SelectInput/__stories__/Playground.stories.tsx similarity index 74% rename from packages/ui/src/components/RichSelect/__stories__/Playground.stories.tsx rename to packages/ui/src/components/SelectInput/__stories__/Playground.stories.tsx index 280ee27540..c67a58e548 100644 --- a/packages/ui/src/components/RichSelect/__stories__/Playground.stories.tsx +++ b/packages/ui/src/components/SelectInput/__stories__/Playground.stories.tsx @@ -1,5 +1,5 @@ import { fireEvent, screen } from '@storybook/testing-library' -import { RichSelect } from '..' +import { SelectInput } from '..' import { Template } from './Template.stories' export const Playground = Template.bind({}) @@ -9,8 +9,8 @@ Playground.args = { name: 'basic', value: { label: 'Option A', value: 'a' }, children: [ - Option A, - Option B, + Option A, + Option B, ], } diff --git a/packages/ui/src/components/SelectInput/__stories__/Required.stories.tsx b/packages/ui/src/components/SelectInput/__stories__/Required.stories.tsx new file mode 100644 index 0000000000..fffc7058fe --- /dev/null +++ b/packages/ui/src/components/SelectInput/__stories__/Required.stories.tsx @@ -0,0 +1,17 @@ +import { SelectInput } from '..' +import { Template } from './Template.stories' + +export const Required = Template.bind({}) +Required.args = { + name: 'required', + required: true, + children: [ + Option A, + Option B, + ], +} +Required.parameters = { + docs: { + storyDescription: 'This shows how to use `required` on SelectInput', + }, +} diff --git a/packages/ui/src/components/SelectInput/__stories__/Searchable.stories.tsx b/packages/ui/src/components/SelectInput/__stories__/Searchable.stories.tsx new file mode 100644 index 0000000000..518144c426 --- /dev/null +++ b/packages/ui/src/components/SelectInput/__stories__/Searchable.stories.tsx @@ -0,0 +1,17 @@ +import { SelectInput } from '..' +import { Template } from './Template.stories' + +export const Searchable = Template.bind({}) +Searchable.args = { + name: 'required', + isSearchable: true, + children: [ + Option A, + Option B, + ], +} +Searchable.parameters = { + docs: { + storyDescription: 'This shows how to use `isSearchable` on SelectInput.', + }, +} diff --git a/packages/ui/src/components/SelectInput/__stories__/Template.stories.tsx b/packages/ui/src/components/SelectInput/__stories__/Template.stories.tsx new file mode 100644 index 0000000000..f03baa5734 --- /dev/null +++ b/packages/ui/src/components/SelectInput/__stories__/Template.stories.tsx @@ -0,0 +1,6 @@ +import type { ComponentStory } from '@storybook/react' +import { SelectInput } from '..' + +export const Template: ComponentStory = ({ ...props }) => ( + +) diff --git a/packages/ui/src/components/SelectInput/__stories__/Time.stories.tsx b/packages/ui/src/components/SelectInput/__stories__/Time.stories.tsx new file mode 100644 index 0000000000..fbe3a2d7ac --- /dev/null +++ b/packages/ui/src/components/SelectInput/__stories__/Time.stories.tsx @@ -0,0 +1,17 @@ +import { SelectInput } from '..' +import { Template } from './Template.stories' + +export const Time = Template.bind({}) +Time.args = { + name: 'time', + time: true, + children: [ + 11:00, + 12:00, + ], +} +Time.parameters = { + docs: { + storyDescription: 'This shows how to use `time` on SelectInput', + }, +} diff --git a/packages/ui/src/components/RichSelect/__stories__/TimeError.stories.tsx b/packages/ui/src/components/SelectInput/__stories__/TimeError.stories.tsx similarity index 50% rename from packages/ui/src/components/RichSelect/__stories__/TimeError.stories.tsx rename to packages/ui/src/components/SelectInput/__stories__/TimeError.stories.tsx index 474649d9e4..9b1e9948e4 100644 --- a/packages/ui/src/components/RichSelect/__stories__/TimeError.stories.tsx +++ b/packages/ui/src/components/SelectInput/__stories__/TimeError.stories.tsx @@ -1,4 +1,4 @@ -import { RichSelect } from '..' +import { SelectInput } from '..' import { Template } from './Template.stories' export const TimeError = Template.bind({}) @@ -7,12 +7,12 @@ TimeError.args = { time: true, error: 'this is an error', children: [ - 11:00, - 12:00, + 11:00, + 12:00, ], } TimeError.parameters = { docs: { - storyDescription: 'This shows how to use `time-error` on RichSelect', + storyDescription: 'This shows how to use `time-error` on SelectInput', }, } diff --git a/packages/ui/src/components/RichSelect/__stories__/Uncontrolled.stories.tsx b/packages/ui/src/components/SelectInput/__stories__/Uncontrolled.stories.tsx similarity index 51% rename from packages/ui/src/components/RichSelect/__stories__/Uncontrolled.stories.tsx rename to packages/ui/src/components/SelectInput/__stories__/Uncontrolled.stories.tsx index 15519597ab..4812656925 100644 --- a/packages/ui/src/components/RichSelect/__stories__/Uncontrolled.stories.tsx +++ b/packages/ui/src/components/SelectInput/__stories__/Uncontrolled.stories.tsx @@ -1,4 +1,4 @@ -import { RichSelect } from '..' +import { SelectInput } from '..' import { Template } from './Template.stories' export const Uncontrolled = Template.bind({}) @@ -6,12 +6,12 @@ Uncontrolled.args = { name: 'uncontrolled', value: { label: 'Option A', value: 'a' }, children: [ - Option A, - Option B, + Option A, + Option B, ], } Uncontrolled.parameters = { docs: { - storyDescription: 'This shows how to use Uncontrolled RichSelect.', + storyDescription: 'This shows how to use Uncontrolled SelectInput.', }, } diff --git a/packages/ui/src/components/RichSelect/__stories__/index.stories.tsx b/packages/ui/src/components/SelectInput/__stories__/index.stories.tsx similarity index 84% rename from packages/ui/src/components/RichSelect/__stories__/index.stories.tsx rename to packages/ui/src/components/SelectInput/__stories__/index.stories.tsx index 2bfed26efb..a4d6ff01ba 100644 --- a/packages/ui/src/components/RichSelect/__stories__/index.stories.tsx +++ b/packages/ui/src/components/SelectInput/__stories__/index.stories.tsx @@ -1,8 +1,8 @@ import type { ComponentMeta } from '@storybook/react' -import { RichSelect } from '..' +import { SelectInput } from '..' export default { - component: RichSelect, + component: SelectInput, decorators: [ StoryComponent => (
@@ -14,12 +14,12 @@ export default { docs: { description: { component: - 'RichSelect is a component used to select a value between different options.', + 'SelectInput is a component used to select a value between different options.', }, }, }, - title: 'Components/Data Entry/RichSelect', -} as ComponentMeta + title: 'Components/Data Entry/SelectInput', +} as ComponentMeta export { Playground } from './Playground.stories' export { Uncontrolled } from './Uncontrolled.stories' diff --git a/packages/ui/src/components/RichSelect/__tests__/__snapshots__/index.tsx.snap b/packages/ui/src/components/SelectInput/__tests__/__snapshots__/index.tsx.snap similarity index 97% rename from packages/ui/src/components/RichSelect/__tests__/__snapshots__/index.tsx.snap rename to packages/ui/src/components/SelectInput/__tests__/__snapshots__/index.tsx.snap index e03d364f5e..4a5fb11eed 100644 --- a/packages/ui/src/components/RichSelect/__tests__/__snapshots__/index.tsx.snap +++ b/packages/ui/src/components/SelectInput/__tests__/__snapshots__/index.tsx.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`RichSelect renders correctly animated 1`] = ` +exports[`SelectInput renders correctly animated 1`] = ` @keyframes animation-0 { 0% { @@ -285,8 +285,8 @@ exports[`RichSelect renders correctly animated 1`] = ` }
Select... @@ -372,17 +372,17 @@ exports[`RichSelect renders correctly animated 1`] = ` value="" />
`; -exports[`RichSelect renders correctly controlled 1`] = ` +exports[`SelectInput renders correctly controlled 1`] = ` .cache-w1hmin-StyledContainer-container-StyledContainer { width: 100%; @@ -641,8 +641,8 @@ exports[`RichSelect renders correctly controlled 1`] = ` }
Select... @@ -728,17 +728,17 @@ exports[`RichSelect renders correctly controlled 1`] = ` value="" />
`; -exports[`RichSelect renders correctly default values with click 1`] = ` +exports[`SelectInput renders correctly default values with click 1`] = ` .cache-w1hmin-StyledContainer-container-StyledContainer { width: 100%; @@ -1073,8 +1073,8 @@ exports[`RichSelect renders correctly default values with click 1`] = ` }
Select... @@ -1203,17 +1203,17 @@ exports[`RichSelect renders correctly default values with click 1`] = ` value="" />
`; -exports[`RichSelect renders correctly disabled 1`] = ` +exports[`SelectInput renders correctly disabled 1`] = ` .cache-1n7poat-StyledContainer-container-StyledContainer { width: 100%; @@ -1458,8 +1458,8 @@ exports[`RichSelect renders correctly disabled 1`] = ` }
Select... @@ -1541,17 +1541,17 @@ exports[`RichSelect renders correctly disabled 1`] = `
`; -exports[`RichSelect renders correctly disabled with click 1`] = ` +exports[`SelectInput renders correctly disabled with click 1`] = ` .cache-1n7poat-StyledContainer-container-StyledContainer { width: 100%; @@ -1796,8 +1796,8 @@ exports[`RichSelect renders correctly disabled with click 1`] = ` }
Select... @@ -1879,17 +1879,17 @@ exports[`RichSelect renders correctly disabled with click 1`] = `
`; -exports[`RichSelect renders correctly multi 1`] = ` +exports[`SelectInput renders correctly multi 1`] = ` .cache-w1hmin-StyledContainer-container-StyledContainer { width: 100%; @@ -2147,8 +2147,8 @@ exports[`RichSelect renders correctly multi 1`] = ` }
Select... @@ -2236,17 +2236,17 @@ exports[`RichSelect renders correctly multi 1`] = ` />
`; -exports[`RichSelect renders correctly multi disabled 1`] = ` +exports[`SelectInput renders correctly multi disabled 1`] = ` .cache-1n7poat-StyledContainer-container-StyledContainer { width: 100%; @@ -2568,8 +2568,8 @@ exports[`RichSelect renders correctly multi disabled 1`] = ` }
Select... @@ -2667,17 +2667,17 @@ exports[`RichSelect renders correctly multi disabled 1`] = `
`; -exports[`RichSelect renders correctly required 1`] = ` +exports[`SelectInput renders correctly required 1`] = ` .cache-w1hmin-StyledContainer-container-StyledContainer { width: 100%; @@ -2955,8 +2955,8 @@ exports[`RichSelect renders correctly required 1`] = ` }
Select... @@ -3053,17 +3053,17 @@ exports[`RichSelect renders correctly required 1`] = ` value="" />
`; -exports[`RichSelect renders correctly timed 1`] = ` +exports[`SelectInput renders correctly timed 1`] = ` .cache-w1hmin-StyledContainer-container-StyledContainer { width: 100%; @@ -3335,8 +3335,8 @@ exports[`RichSelect renders correctly timed 1`] = ` }
Select... @@ -3406,7 +3406,7 @@ exports[`RichSelect renders correctly timed 1`] = ` >
`; -exports[`RichSelect renders correctly timed with error 1`] = ` +exports[`SelectInput renders correctly timed with error 1`] = ` .cache-w1hmin-StyledContainer-container-StyledContainer { width: 100%; @@ -3709,8 +3709,8 @@ exports[`RichSelect renders correctly timed with error 1`] = ` }
Select... @@ -3780,7 +3780,7 @@ exports[`RichSelect renders correctly timed with error 1`] = ` >
`; -exports[`RichSelect renders correctly uncontrolled 1`] = ` +exports[`SelectInput renders correctly uncontrolled 1`] = ` .cache-w1hmin-StyledContainer-container-StyledContainer { width: 100%; @@ -4146,8 +4146,8 @@ exports[`RichSelect renders correctly uncontrolled 1`] = ` }
Select... @@ -4276,17 +4276,17 @@ exports[`RichSelect renders correctly uncontrolled 1`] = ` value="" />
`; -exports[`RichSelect renders correctly with click 1`] = ` +exports[`SelectInput renders correctly with click 1`] = ` .cache-w1hmin-StyledContainer-container-StyledContainer { width: 100%; @@ -4621,8 +4621,8 @@ exports[`RichSelect renders correctly with click 1`] = ` }
Select... @@ -4751,17 +4751,17 @@ exports[`RichSelect renders correctly with click 1`] = ` value="" />
`; -exports[`RichSelect renders correctly with click and option disabled 1`] = ` +exports[`SelectInput renders correctly with click and option disabled 1`] = ` .cache-w1hmin-StyledContainer-container-StyledContainer { width: 100%; @@ -5122,8 +5122,8 @@ exports[`RichSelect renders correctly with click and option disabled 1`] = ` }
Select... @@ -5264,17 +5264,17 @@ exports[`RichSelect renders correctly with click and option disabled 1`] = ` value="" />
`; -exports[`RichSelect renders correctly with click and options 1`] = ` +exports[`SelectInput renders correctly with click and options 1`] = ` .cache-w1hmin-StyledContainer-container-StyledContainer { width: 100%; @@ -5635,8 +5635,8 @@ exports[`RichSelect renders correctly with click and options 1`] = ` }
Select... @@ -5777,17 +5777,17 @@ exports[`RichSelect renders correctly with click and options 1`] = ` value="" />
`; -exports[`RichSelect renders correctly with custom styles 1`] = ` +exports[`SelectInput renders correctly with custom styles 1`] = ` .cache-w1hmin-StyledContainer-container-StyledContainer { width: 100%; @@ -6046,8 +6046,8 @@ exports[`RichSelect renders correctly with custom styles 1`] = ` }
Select... @@ -6133,17 +6133,17 @@ exports[`RichSelect renders correctly with custom styles 1`] = ` value="" />
`; -exports[`RichSelect renders correctly with emptyState 1`] = ` +exports[`SelectInput renders correctly with emptyState 1`] = ` .cache-w1hmin-StyledContainer-container-StyledContainer { width: 100%; @@ -6433,8 +6433,8 @@ exports[`RichSelect renders correctly with emptyState 1`] = ` }
Select... @@ -6544,17 +6544,17 @@ exports[`RichSelect renders correctly with emptyState 1`] = ` value="" />
`; -exports[`RichSelect should render correctly custom isLoading 1`] = ` +exports[`SelectInput should render correctly custom isLoading 1`] = ` .cache-w1hmin-StyledContainer-container-StyledContainer { width: 100%; @@ -6813,8 +6813,8 @@ exports[`RichSelect should render correctly custom isLoading 1`] = ` }
Select... @@ -6903,17 +6903,17 @@ exports[`RichSelect should render correctly custom isLoading 1`] = ` value="" />
`; -exports[`RichSelect should render correctly description and inlineDescription 1`] = ` +exports[`SelectInput should render correctly description and inlineDescription 1`] = ` .cache-w1hmin-StyledContainer-container-StyledContainer { width: 100%; @@ -7172,8 +7172,8 @@ exports[`RichSelect should render correctly description and inlineDescription 1` }
Select... @@ -7259,17 +7259,17 @@ exports[`RichSelect should render correctly description and inlineDescription 1` value="" />
`; -exports[`RichSelect should render correctly isLoading 1`] = ` +exports[`SelectInput should render correctly isLoading 1`] = ` @keyframes animation-0 { 0%, 80%, 100% { @@ -7613,8 +7613,8 @@ exports[`RichSelect should render correctly isLoading 1`] = ` }
Select... @@ -7714,17 +7714,17 @@ exports[`RichSelect should render correctly isLoading 1`] = ` value="" />
`; -exports[`RichSelect should render correctly multi isClearable 1`] = ` +exports[`SelectInput should render correctly multi isClearable 1`] = ` .cache-w1hmin-StyledContainer-container-StyledContainer { width: 100%; @@ -8007,8 +8007,8 @@ exports[`RichSelect should render correctly multi isClearable 1`] = ` }
Select... @@ -8106,17 +8106,17 @@ exports[`RichSelect should render correctly multi isClearable 1`] = ` value="a" />
`; -exports[`RichSelect should render correctly multi isClearable disabled 1`] = ` +exports[`SelectInput should render correctly multi isClearable disabled 1`] = ` .cache-1n7poat-StyledContainer-container-StyledContainer { width: 100%; @@ -8377,8 +8377,8 @@ exports[`RichSelect should render correctly multi isClearable disabled 1`] = ` }
Select... @@ -8458,17 +8458,17 @@ exports[`RichSelect should render correctly multi isClearable disabled 1`] = `
`; -exports[`RichSelect should render correctly multi isSearchable 1`] = ` +exports[`SelectInput should render correctly multi isSearchable 1`] = ` .cache-w1hmin-StyledContainer-container-StyledContainer { width: 100%; @@ -8742,8 +8742,8 @@ exports[`RichSelect should render correctly multi isSearchable 1`] = ` }
Select... @@ -8827,17 +8827,17 @@ exports[`RichSelect should render correctly multi isSearchable 1`] = ` value="a" />
`; -exports[`RichSelect should render correctly multi isSearchable disabled 1`] = ` +exports[`SelectInput should render correctly multi isSearchable disabled 1`] = ` .cache-1n7poat-StyledContainer-container-StyledContainer { width: 100%; @@ -9098,8 +9098,8 @@ exports[`RichSelect should render correctly multi isSearchable disabled 1`] = ` }
Select... @@ -9179,17 +9179,17 @@ exports[`RichSelect should render correctly multi isSearchable disabled 1`] = `
`; -exports[`RichSelect should render correctly with portal 1`] = ` +exports[`SelectInput should render correctly with portal 1`] = ` .cache-w1hmin-StyledContainer-container-StyledContainer { width: 100%; @@ -9448,8 +9448,8 @@ exports[`RichSelect should render correctly with portal 1`] = ` }
Select... @@ -9535,10 +9535,10 @@ exports[`RichSelect should render correctly with portal 1`] = ` value="" />
@@ -9548,7 +9548,7 @@ exports[`RichSelect should render correctly with portal 1`] = ` `; -exports[`RichSelect should render correctly without children 1`] = ` +exports[`SelectInput should render correctly without children 1`] = ` .cache-w1hmin-StyledContainer-container-StyledContainer { width: 100%; @@ -9807,8 +9807,8 @@ exports[`RichSelect should render correctly without children 1`] = ` }
Select... @@ -9894,10 +9894,10 @@ exports[`RichSelect should render correctly without children 1`] = ` value="" />
diff --git a/packages/ui/src/components/RichSelect/__tests__/index.tsx b/packages/ui/src/components/SelectInput/__tests__/index.tsx similarity index 52% rename from packages/ui/src/components/RichSelect/__tests__/index.tsx rename to packages/ui/src/components/SelectInput/__tests__/index.tsx index 5b1d915436..426ac48bc1 100644 --- a/packages/ui/src/components/RichSelect/__tests__/index.tsx +++ b/packages/ui/src/components/SelectInput/__tests__/index.tsx @@ -1,6 +1,6 @@ import type { CSSObject } from '@emotion/react' import userEvent from '@testing-library/user-event' -import { RichSelect } from '..' +import { SelectInput } from '..' import { shouldMatchEmotionSnapshot, shouldMatchEmotionSnapshotWithPortal, @@ -22,13 +22,13 @@ const customStyles: Record = { valueContainer: {}, } -describe('RichSelect', () => { +describe('SelectInput', () => { test('renders correctly uncontrolled', () => shouldMatchEmotionSnapshot( - - Option A - Option B - , + + Option A + Option B + , { transform: async node => { const input = node.getByRole('combobox') @@ -39,7 +39,7 @@ describe('RichSelect', () => { test('renders correctly with emptyState', () => shouldMatchEmotionSnapshot( - { test('renders correctly with custom styles', () => shouldMatchEmotionSnapshot( - customStyles} > - Option A - Option B - , + Option A + Option B + , )) test('renders correctly controlled', () => shouldMatchEmotionSnapshot( - {}} > - Option A - Option B - , + Option A + Option B + , )) test('renders correctly disabled', () => shouldMatchEmotionSnapshot( - - Option A - Option B - , + + Option A + Option B + , )) test('renders correctly required', () => shouldMatchEmotionSnapshot( - - 11:00 - 12:00 - , + + 11:00 + 12:00 + , )) test('renders correctly timed', () => shouldMatchEmotionSnapshot( - - 11:00 - 12:00 - , + + 11:00 + 12:00 + , )) test('renders correctly timed with error', () => shouldMatchEmotionSnapshot( - - 11:00 - 12:00 - , + 11:00 + 12:00 + , )) test('renders correctly with click', () => shouldMatchEmotionSnapshot( - - Option A - Option B - , + + Option A + Option B + , { transform: async node => { const input = node.getByRole('combobox') @@ -132,13 +132,13 @@ describe('RichSelect', () => { test('renders correctly with click and option disabled', () => shouldMatchEmotionSnapshot( - - Option A - Option B - + + Option A + Option B + Option C - - , + + , { transform: async node => { const input = node.getByRole('combobox') @@ -149,17 +149,17 @@ describe('RichSelect', () => { test('renders correctly with click and options', () => shouldMatchEmotionSnapshot( - - + + Option A - - + + Option B - - + + Option C - - , + + , { transform: async node => { const input = node.getByRole('combobox') @@ -169,17 +169,17 @@ describe('RichSelect', () => { )) test('renders correctly disabled with click', () => shouldMatchEmotionSnapshot( - - Option A - Option B - , + + Option A + Option B + , )) test('renders correctly default values with click', () => shouldMatchEmotionSnapshot( - - Option A - Option B - , + + Option A + Option B + , { transform: async node => { const input = node.getByRole('combobox') @@ -190,7 +190,7 @@ describe('RichSelect', () => { test('renders correctly animated', () => shouldMatchEmotionSnapshot( - { value="a" onChange={() => {}} > - Option A - Option B - , + Option A + Option B + , )) test('renders correctly multi', () => shouldMatchEmotionSnapshot( - - Option A - Option B - Option C - Option D - Option E - Option F - , + + Option A + Option B + Option C + Option D + Option E + Option F + , )) test('renders correctly multi disabled', () => shouldMatchEmotionSnapshot( - { isMulti disabled > - Option A - Option B - , + Option A + Option B + , )) test('should render correctly multi isClearable', () => shouldMatchEmotionSnapshot( - - Option A - Option B - , + Option A + Option B + , )) test('should render correctly multi isClearable disabled', () => shouldMatchEmotionSnapshot( - { isClearable disabled > - Option A - Option B - , + Option A + Option B + , )) test('should render correctly multi isSearchable', () => shouldMatchEmotionSnapshot( - - Option A - Option B - , + Option A + Option B + , )) test('should render correctly multi isSearchable disabled', () => shouldMatchEmotionSnapshot( - { isSearchable disabled > - Option A - Option B - , + Option A + Option B + , )) test('should render correctly isLoading', () => shouldMatchEmotionSnapshot( - - Option A - Option B - , + + Option A + Option B + , )) test('should render correctly with portal', () => shouldMatchEmotionSnapshotWithPortal( <> - - Option A - Option B - + Option A + Option B +
, )) test('should render correctly without children', () => shouldMatchEmotionSnapshotWithPortal( - , + , )) test('should render correctly custom isLoading', () => shouldMatchEmotionSnapshot( - { LoadingIndicator: () =>
Loading...
, }} > - Option A - Option B -
, + Option A + Option B +
, )) test('should render correctly description and inlineDescription', () => shouldMatchEmotionSnapshot( - - + Option A - - + + Option B - - , + + , )) }) diff --git a/packages/ui/src/components/RichSelect/index.tsx b/packages/ui/src/components/SelectInput/index.tsx similarity index 96% rename from packages/ui/src/components/RichSelect/index.tsx rename to packages/ui/src/components/SelectInput/index.tsx index 1e33ae9b3c..271e846b38 100644 --- a/packages/ui/src/components/RichSelect/index.tsx +++ b/packages/ui/src/components/SelectInput/index.tsx @@ -94,7 +94,7 @@ type SelectStyleMap = Record type SelectStyleProps = { error?: string /** - * Custom styles of the RichSelect. See [React select documentation](https://react-select.com/styles) + * Custom styles of the SelectInput. See [React select documentation](https://react-select.com/styles) */ customStyle: ( state: SelectProps & WithSelectProps, @@ -347,7 +347,7 @@ const SelectContainer = ( return ( /** - * Custom components of the RichSelect. See [React select documentation](https://react-select.com/components) + * Custom components of the SelectInput. See [React select documentation](https://react-select.com/components) */ customComponents?: SelectProps['components'] children: ReactNode @@ -663,7 +663,7 @@ type RichSelectProps = SelectProps & const defaultCustomStyle = () => ({}) -const FwdRichSelect = ({ +const FwdSelectInput = ({ animation = 'pulse', animationDuration = 1000, animationOnChange = false, @@ -691,7 +691,7 @@ const FwdRichSelect = ({ isLoading, required, emptyState, -}: Partial) => { +}: Partial) => { const id = useId() const inputId = inputIdProp ?? id const theme = useTheme() @@ -773,14 +773,14 @@ type OptionComponent = ( props: Partial & SelectOption>, ) => JSX.Element -export const RichSelect = forwardRef( - (props: RichSelectProps, ref: ForwardedRef) => ( - +export const SelectInput = forwardRef( + (props: SelectInputProps, ref: ForwardedRef) => ( + ), -) as ForwardRefExoticComponent> & { +) as ForwardRefExoticComponent> & { Option: OptionComponent } -RichSelect.displayName = 'RichSelect' +SelectInput.displayName = 'SelectInput' -RichSelect.Option = Option as OptionComponent +SelectInput.Option = Option as OptionComponent diff --git a/packages/ui/src/components/SelectableCard/__stories__/Children.stories.tsx b/packages/ui/src/components/SelectableCard/__stories__/Children.stories.tsx index a9ff0bc8df..b5436e8137 100644 --- a/packages/ui/src/components/SelectableCard/__stories__/Children.stories.tsx +++ b/packages/ui/src/components/SelectableCard/__stories__/Children.stories.tsx @@ -5,21 +5,21 @@ import type { MultiValue, SingleValue } from 'react-select' import { SelectableCard } from '..' import { Badge } from '../../Badge' import { Checkbox } from '../../Checkbox' -import type { SelectOption } from '../../RichSelect' -import { RichSelect } from '../../RichSelect' +import type { SelectOption } from '../../SelectInput' +import { SelectInput } from '../../SelectInput' import { Stack } from '../../Stack' export const Children: Story = () => { const [value, onChange] = useState('label-9') - const [richSelectValue, richSelectOnChange] = useState({ + const [selectInputValue, selectInputOnChange] = useState({ label: 'Option 1', value: 'option-1', }) - const onRichSelectSelectChange = ( + const onSelectInputSelectChange = ( newValue: SingleValue | MultiValue, ) => { - richSelectOnChange(newValue as SelectOption) + selectInputOnChange(newValue as SelectOption) } return ( @@ -62,9 +62,9 @@ export const Children: Story = () => { First element - value !== null && !Array.isArray(value) diff --git a/packages/ui/src/components/TimeInput/__tests__/__snapshots__/index.tsx.snap b/packages/ui/src/components/TimeInput/__tests__/__snapshots__/index.tsx.snap index 9d0577f4f8..cd72faeefe 100644 --- a/packages/ui/src/components/TimeInput/__tests__/__snapshots__/index.tsx.snap +++ b/packages/ui/src/components/TimeInput/__tests__/__snapshots__/index.tsx.snap @@ -287,8 +287,8 @@ exports[`TimeInput renders correctly with base props 1`] = ` }
Select... @@ -356,7 +356,7 @@ exports[`TimeInput renders correctly with base props 1`] = ` >
diff --git a/packages/ui/src/components/TimeInput/index.tsx b/packages/ui/src/components/TimeInput/index.tsx index 4af76cf4b1..7dc6f19828 100644 --- a/packages/ui/src/components/TimeInput/index.tsx +++ b/packages/ui/src/components/TimeInput/index.tsx @@ -1,5 +1,5 @@ import type { ComponentProps } from 'react' -import { RichSelect } from '../RichSelect' +import { SelectInput } from '../SelectInput' const hours = [ '00:00', @@ -197,7 +197,7 @@ const defaultValue = { value: '00:00', } -type TimeInputProps = Partial> & { +type TimeInputProps = Partial> & { schedule?: ScheduleType } @@ -210,7 +210,7 @@ export const TimeInput: TimeInputType = ({ schedule = 'hours', ...props }: TimeInputProps = {}) => ( - + ) TimeInput.options = options diff --git a/packages/ui/src/components/UnitInput/__stories__/index.stories.tsx b/packages/ui/src/components/UnitInput/__stories__/index.stories.tsx index 037c46e59b..acbf8b2bed 100644 --- a/packages/ui/src/components/UnitInput/__stories__/index.stories.tsx +++ b/packages/ui/src/components/UnitInput/__stories__/index.stories.tsx @@ -7,7 +7,7 @@ export default { docs: { description: { component: - 'UnitInput is a component made out of 2 components: a **TextInput** and a **RichSelect**.', + 'UnitInput is a component made out of 2 components: a **TextInput** and a **SelectInput**.', }, }, }, diff --git a/packages/ui/src/components/UnitInput/__tests__/__snapshots__/index.tsx.snap b/packages/ui/src/components/UnitInput/__tests__/__snapshots__/index.tsx.snap index 00ccbc6016..51799ca192 100644 --- a/packages/ui/src/components/UnitInput/__tests__/__snapshots__/index.tsx.snap +++ b/packages/ui/src/components/UnitInput/__tests__/__snapshots__/index.tsx.snap @@ -113,7 +113,7 @@ exports[`UnitInput renders with custom options 1`] = ` padding-top: 2px; } -.cache-19pbbcy-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect { +.cache-1hutwle-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput { width: 100%; position: relative; box-sizing: border-box; @@ -123,16 +123,16 @@ exports[`UnitInput renders with custom options 1`] = ` height: 40px; } -.cache-19pbbcy-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect:hover, -.cache-19pbbcy-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect:focus { +.cache-1hutwle-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput:hover, +.cache-1hutwle-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput:focus { -webkit-text-decoration: none; text-decoration: none; border-color: #4f0599; box-shadow: none; } -.cache-19pbbcy-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect:hover, -.cache-19pbbcy-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect:focus { +.cache-1hutwle-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput:hover, +.cache-1hutwle-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput:focus { -webkit-text-decoration: none; text-decoration: none; border-color: #4f0599; @@ -424,8 +424,8 @@ exports[`UnitInput renders with custom options 1`] = `
Select... @@ -509,10 +509,10 @@ exports[`UnitInput renders with custom options 1`] = ` value="kb" />
@@ -633,7 +633,7 @@ exports[`UnitInput renders with default props 1`] = ` padding-top: 2px; } -.cache-19pbbcy-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect { +.cache-1hutwle-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput { width: 100%; position: relative; box-sizing: border-box; @@ -643,16 +643,16 @@ exports[`UnitInput renders with default props 1`] = ` height: 40px; } -.cache-19pbbcy-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect:hover, -.cache-19pbbcy-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect:focus { +.cache-1hutwle-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput:hover, +.cache-1hutwle-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput:focus { -webkit-text-decoration: none; text-decoration: none; border-color: #4f0599; box-shadow: none; } -.cache-19pbbcy-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect:hover, -.cache-19pbbcy-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect:focus { +.cache-1hutwle-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput:hover, +.cache-1hutwle-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput:focus { -webkit-text-decoration: none; text-decoration: none; border-color: #4f0599; @@ -944,8 +944,8 @@ exports[`UnitInput renders with default props 1`] = `
Select... @@ -1029,10 +1029,10 @@ exports[`UnitInput renders with default props 1`] = ` value="hours" />
@@ -1153,7 +1153,7 @@ exports[`UnitInput renders with defaultOption 1`] = ` padding-top: 2px; } -.cache-19pbbcy-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect { +.cache-1hutwle-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput { width: 100%; position: relative; box-sizing: border-box; @@ -1163,16 +1163,16 @@ exports[`UnitInput renders with defaultOption 1`] = ` height: 40px; } -.cache-19pbbcy-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect:hover, -.cache-19pbbcy-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect:focus { +.cache-1hutwle-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput:hover, +.cache-1hutwle-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput:focus { -webkit-text-decoration: none; text-decoration: none; border-color: #4f0599; box-shadow: none; } -.cache-19pbbcy-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect:hover, -.cache-19pbbcy-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect:focus { +.cache-1hutwle-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput:hover, +.cache-1hutwle-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput:focus { -webkit-text-decoration: none; text-decoration: none; border-color: #4f0599; @@ -1464,8 +1464,8 @@ exports[`UnitInput renders with defaultOption 1`] = `
Select... @@ -1549,10 +1549,10 @@ exports[`UnitInput renders with defaultOption 1`] = ` value="hours" />
@@ -1673,7 +1673,7 @@ exports[`UnitInput renders with defaultValue 1`] = ` padding-top: 2px; } -.cache-19pbbcy-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect { +.cache-1hutwle-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput { width: 100%; position: relative; box-sizing: border-box; @@ -1683,16 +1683,16 @@ exports[`UnitInput renders with defaultValue 1`] = ` height: 40px; } -.cache-19pbbcy-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect:hover, -.cache-19pbbcy-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect:focus { +.cache-1hutwle-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput:hover, +.cache-1hutwle-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput:focus { -webkit-text-decoration: none; text-decoration: none; border-color: #4f0599; box-shadow: none; } -.cache-19pbbcy-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect:hover, -.cache-19pbbcy-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect:focus { +.cache-1hutwle-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput:hover, +.cache-1hutwle-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput:focus { -webkit-text-decoration: none; text-decoration: none; border-color: #4f0599; @@ -1984,8 +1984,8 @@ exports[`UnitInput renders with defaultValue 1`] = `
Select... @@ -2069,10 +2069,10 @@ exports[`UnitInput renders with defaultValue 1`] = ` value="hours" />
@@ -2198,7 +2198,7 @@ exports[`UnitInput renders with disabled and placeHolder 1`] = ` padding-top: 2px; } -.cache-x52pnu-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect { +.cache-1h7hx7s-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput { width: 100%; pointer-events: initial; pointer-events: none; @@ -2210,16 +2210,16 @@ exports[`UnitInput renders with disabled and placeHolder 1`] = ` height: 40px; } -.cache-x52pnu-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect:hover, -.cache-x52pnu-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect:focus { +.cache-1h7hx7s-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput:hover, +.cache-1h7hx7s-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput:focus { -webkit-text-decoration: none; text-decoration: none; border-color: #4f0599; box-shadow: none; } -.cache-x52pnu-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect:hover, -.cache-x52pnu-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect:focus { +.cache-1h7hx7s-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput:hover, +.cache-1h7hx7s-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput:focus { -webkit-text-decoration: none; text-decoration: none; border-color: #4f0599; @@ -2497,8 +2497,8 @@ exports[`UnitInput renders with disabled and placeHolder 1`] = `
Select... @@ -2578,10 +2578,10 @@ exports[`UnitInput renders with disabled and placeHolder 1`] = `
@@ -2702,7 +2702,7 @@ exports[`UnitInput renders with min max 1`] = ` padding-top: 2px; } -.cache-19pbbcy-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect { +.cache-1hutwle-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput { width: 100%; position: relative; box-sizing: border-box; @@ -2712,16 +2712,16 @@ exports[`UnitInput renders with min max 1`] = ` height: 40px; } -.cache-19pbbcy-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect:hover, -.cache-19pbbcy-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect:focus { +.cache-1hutwle-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput:hover, +.cache-1hutwle-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput:focus { -webkit-text-decoration: none; text-decoration: none; border-color: #4f0599; box-shadow: none; } -.cache-19pbbcy-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect:hover, -.cache-19pbbcy-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect:focus { +.cache-1hutwle-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput:hover, +.cache-1hutwle-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput:focus { -webkit-text-decoration: none; text-decoration: none; border-color: #4f0599; @@ -3013,8 +3013,8 @@ exports[`UnitInput renders with min max 1`] = `
Select... @@ -3098,10 +3098,10 @@ exports[`UnitInput renders with min max 1`] = ` value="hours" />
@@ -3222,7 +3222,7 @@ exports[`UnitInput renders with size large 1`] = ` padding-top: 2px; } -.cache-48dgaz-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect { +.cache-10i11ug-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput { width: 100%; position: relative; box-sizing: border-box; @@ -3232,16 +3232,16 @@ exports[`UnitInput renders with size large 1`] = ` height: 48px; } -.cache-48dgaz-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect:hover, -.cache-48dgaz-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect:focus { +.cache-10i11ug-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput:hover, +.cache-10i11ug-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput:focus { -webkit-text-decoration: none; text-decoration: none; border-color: #4f0599; box-shadow: none; } -.cache-48dgaz-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect:hover, -.cache-48dgaz-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect:focus { +.cache-10i11ug-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput:hover, +.cache-10i11ug-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput:focus { -webkit-text-decoration: none; text-decoration: none; border-color: #4f0599; @@ -3533,8 +3533,8 @@ exports[`UnitInput renders with size large 1`] = `
Select... @@ -3618,10 +3618,10 @@ exports[`UnitInput renders with size large 1`] = ` value="hours" />
@@ -3742,7 +3742,7 @@ exports[`UnitInput renders with size medium 1`] = ` padding-top: 2px; } -.cache-19pbbcy-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect { +.cache-1hutwle-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput { width: 100%; position: relative; box-sizing: border-box; @@ -3752,16 +3752,16 @@ exports[`UnitInput renders with size medium 1`] = ` height: 40px; } -.cache-19pbbcy-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect:hover, -.cache-19pbbcy-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect:focus { +.cache-1hutwle-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput:hover, +.cache-1hutwle-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput:focus { -webkit-text-decoration: none; text-decoration: none; border-color: #4f0599; box-shadow: none; } -.cache-19pbbcy-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect:hover, -.cache-19pbbcy-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect:focus { +.cache-1hutwle-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput:hover, +.cache-1hutwle-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput:focus { -webkit-text-decoration: none; text-decoration: none; border-color: #4f0599; @@ -4053,8 +4053,8 @@ exports[`UnitInput renders with size medium 1`] = `
Select... @@ -4138,10 +4138,10 @@ exports[`UnitInput renders with size medium 1`] = ` value="hours" />
@@ -4262,7 +4262,7 @@ exports[`UnitInput renders with size small 1`] = ` padding-top: 2px; } -.cache-1sprnb0-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect { +.cache-1q2d7vh-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput { width: 100%; position: relative; box-sizing: border-box; @@ -4272,16 +4272,16 @@ exports[`UnitInput renders with size small 1`] = ` height: 32px; } -.cache-1sprnb0-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect:hover, -.cache-1sprnb0-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect:focus { +.cache-1q2d7vh-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput:hover, +.cache-1q2d7vh-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput:focus { -webkit-text-decoration: none; text-decoration: none; border-color: #4f0599; box-shadow: none; } -.cache-1sprnb0-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect:hover, -.cache-1sprnb0-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect:focus { +.cache-1q2d7vh-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput:hover, +.cache-1q2d7vh-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput:focus { -webkit-text-decoration: none; text-decoration: none; border-color: #4f0599; @@ -4573,8 +4573,8 @@ exports[`UnitInput renders with size small 1`] = `
Select... @@ -4658,10 +4658,10 @@ exports[`UnitInput renders with size small 1`] = ` value="hours" />
@@ -4669,7 +4669,7 @@ exports[`UnitInput renders with size small 1`] = ` `; -exports[`UnitInput renders with textBoxWidth and richSelectWidth 1`] = ` +exports[`UnitInput renders with textBoxWidth and selectInputWidth 1`] = ` .cache-1doeye3-CustomTextInput input { border-radius: 4px 0 0 4px; @@ -4782,7 +4782,7 @@ exports[`UnitInput renders with textBoxWidth and richSelectWidth 1`] = ` padding-top: 2px; } -.cache-11ws1p9-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect { +.cache-qr3lfr-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput { width: 100%; position: relative; box-sizing: border-box; @@ -4792,16 +4792,16 @@ exports[`UnitInput renders with textBoxWidth and richSelectWidth 1`] = ` height: 40px; } -.cache-11ws1p9-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect:hover, -.cache-11ws1p9-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect:focus { +.cache-qr3lfr-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput:hover, +.cache-qr3lfr-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput:focus { -webkit-text-decoration: none; text-decoration: none; border-color: #4f0599; box-shadow: none; } -.cache-11ws1p9-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect:hover, -.cache-11ws1p9-StyledContainer-container-StyledContainer-CustomRichSelect-CustomRichSelect:focus { +.cache-qr3lfr-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput:hover, +.cache-qr3lfr-StyledContainer-container-StyledContainer-CustomSelectInput-CustomSelectInput:focus { -webkit-text-decoration: none; text-decoration: none; border-color: #4f0599; @@ -5093,8 +5093,8 @@ exports[`UnitInput renders with textBoxWidth and richSelectWidth 1`] = `
Select... @@ -5178,10 +5178,10 @@ exports[`UnitInput renders with textBoxWidth and richSelectWidth 1`] = ` value="hours" />
diff --git a/packages/ui/src/components/UnitInput/__tests__/index.tsx b/packages/ui/src/components/UnitInput/__tests__/index.tsx index ac6a5c73d9..0d66d00e9f 100644 --- a/packages/ui/src/components/UnitInput/__tests__/index.tsx +++ b/packages/ui/src/components/UnitInput/__tests__/index.tsx @@ -55,9 +55,9 @@ describe('UnitInput', () => { shouldMatchEmotionSnapshot()), ) - test(`renders with textBoxWidth and richSelectWidth`, () => + test(`renders with textBoxWidth and selectInputWidth`, () => shouldMatchEmotionSnapshot( - , + , )) test(`renders with disabled and placeHolder`, () => @@ -65,7 +65,7 @@ describe('UnitInput', () => { , )) - test(`renders with RichSelect update`, async () => { + test(`renders with SelectInput update`, async () => { const node = renderWithTheme() // Role textbox is only for the searchable input @@ -74,12 +74,12 @@ describe('UnitInput', () => { await userEvent.type(valueContainer, 'weeks{enter}') await waitFor(() => expect(valueContainer.value).toBe('')) - const richSelect = node.getByTestId('rich-select-test-unit') - // Real rich select value is inside a hidden input with the name put in RichSelect props. - const richSelectInputHidden = richSelect.querySelector( + const selectInput = node.getByTestId('select-input-test-unit') + // Real select input value is inside a hidden input with the name put in SelectInput props. + const selectInputInputHidden = selectInput.querySelector( 'input[type="hidden"]', ) as HTMLInputElement - await waitFor(() => expect(richSelectInputHidden?.value).toBe('weeks')) + await waitFor(() => expect(selectInputInputHidden?.value).toBe('weeks')) }) }) diff --git a/packages/ui/src/components/UnitInput/index.tsx b/packages/ui/src/components/UnitInput/index.tsx index 5da22764df..b0252277b8 100644 --- a/packages/ui/src/components/UnitInput/index.tsx +++ b/packages/ui/src/components/UnitInput/index.tsx @@ -1,8 +1,8 @@ import styled from '@emotion/styled' import type { ComponentProps } from 'react' import { useEffect, useState } from 'react' -import type { SelectOption } from '../RichSelect' -import { RichSelect } from '../RichSelect' +import type { SelectOption } from '../SelectInput' +import { SelectInput } from '../SelectInput' import { TextInput } from '../TextInput' export const sizesHeight: Record = { @@ -27,7 +27,7 @@ const CustomTextInput = styled(TextInput)` } ` -const CustomRichSelect = styled(RichSelect)<{ +const CustomSelectInput = styled(SelectInput)<{ width?: number height?: number }>` @@ -80,7 +80,7 @@ type UnitInputValue = { } type UnitInputProps = Omit< - Partial>, + Partial>, 'defaultValue' > & { name?: string @@ -93,13 +93,13 @@ type UnitInputProps = Omit< * @param {{value, unit}} UnitInputValue The value containing the unit select and the value in the TextInput */ onChange?: (value: UnitInputValue) => void - /** Possible RichSelect options */ + /** Possible SelectInput options */ options?: SelectOption[] placeholder?: string - richSelectWidth?: number + selectInputWidth?: number size?: string textBoxWidth?: number - /** The default selected option in the RichSelect */ + /** The default selected option in the SelectInput */ defaultOption?: SelectOption } @@ -112,7 +112,7 @@ export const UnitInput = ({ placeholder = '0', onChange, textBoxWidth = 100, - richSelectWidth = 200, + selectInputWidth = 200, disabled = false, options = defaultOptionValues, defaultOption, @@ -141,8 +141,8 @@ export const UnitInput = ({ }} disabled={disabled} /> - ( /> - - Javascript - Javascript - Javascript - + + Javascript + Javascript + Javascript + I agree with this form