diff --git a/docs/components/InputText/InputText.stories.mdx b/docs/components/InputText/InputText.stories.mdx index d3b5029813..92d7fabab7 100644 --- a/docs/components/InputText/InputText.stories.mdx +++ b/docs/components/InputText/InputText.stories.mdx @@ -176,13 +176,3 @@ If you need to capture the error message and render it outside of the component. Read the [InputValidation](../?path=/docs/components-forms-and-inputs-inputvalidation--docs) documentation. - -### Version 2 Shim (Expermimental) - -If you need to use the version 2 shim, you can pass `version={2}` to the -`InputText` and provide the required props. Due to issues with typescript -[see](https://github.com/microsoft/TypeScript/issues/32447) the aria attributes -(and other props separated by `-`) are not typed correctly. This means that the -shim will not enforce the version to be set to `2` when using these props. As a -result version 1 usages will have these props appear in the intellisense but -they will not do anything. diff --git a/docs/components/InputText/Web.stories.tsx b/docs/components/InputText/Web.stories.tsx index f22098f990..f19383046d 100644 --- a/docs/components/InputText/Web.stories.tsx +++ b/docs/components/InputText/Web.stories.tsx @@ -2,8 +2,6 @@ import React, { useState } from "react"; import { ComponentMeta, ComponentStory } from "@storybook/react"; import { InputText } from "@jobber/components/InputText"; import { Button } from "@jobber/components/Button"; -import { Content } from "@jobber/components/Content"; -import { Grid } from "@jobber/components/Grid"; import { Box } from "@jobber/components/Box"; export default { @@ -16,9 +14,7 @@ export default { } as ComponentMeta; const BasicTemplate: ComponentStory = args => { - const [value, setValue] = React.useState(""); - - return ; + return ; }; export const Basic = BasicTemplate.bind({}); @@ -61,6 +57,7 @@ Toolbar.args = { export const Readonly = BasicTemplate.bind({}); Readonly.args = { + defaultValue: "Rocinante", readonly: true, }; @@ -76,264 +73,6 @@ Clearable.args = { clearable: "always", }; -export const VersionComparison = () => { - const [values, setValues] = React.useState({ - basic: "", - multiline: "", - error: "", - disabled: "", - readonly: "", - withToolbar: "", - prefix: "", - suffix: "", - both: "", - rightAlign: "", - centerAlign: "", - sizeSmall: "", - sizeLarge: "", - inline: "", - multilineResize: "", - }); - const [multiline, setMultiline] = React.useState(false); - const [inline, setInline] = React.useState(false); - const [invalid, setInvalid] = React.useState(undefined); - const [disabled, setDisabled] = React.useState(false); - const [errorMessage, setErrorMessage] = React.useState(); - const [description, setDescription] = React.useState(""); - - const extraProps = { - invalid, - error: errorMessage, - multiline, - inline, - disabled, - description, - }; - - const handleChange = (field: keyof typeof values) => (value: string) => { - setValues(prev => ({ ...prev, [field]: value })); - }; - - const toolbar = ( -
-
- ); - - const renderBothVersions = ( - title: string, - props: Record, - field: keyof typeof values, - ) => ( - - -

{title}

-
- - - - - - -
- ); - - return ( - -
- - -

V1

-
- -

V2

-
-
- {renderBothVersions( - "Left Aligned (Default)", - { - placeholder: "Default alignment", - ...extraProps, - }, - "basic", - )} - - {renderBothVersions( - "Right Aligned", - { - placeholder: "Right aligned text", - align: "right", - ...extraProps, - }, - "rightAlign", - )} - - {renderBothVersions( - "Center Aligned", - { - placeholder: "Center aligned text", - align: "center", - ...extraProps, - }, - "centerAlign", - )} - - {renderBothVersions( - "With Prefix", - { - placeholder: "Input with prefix", - prefix: { label: "$" }, - ...extraProps, - }, - "prefix", - )} - - {renderBothVersions( - "With Suffix", - { - placeholder: "Input with suffix", - suffix: { label: "%" }, - ...extraProps, - title: "this is a title", - }, - "suffix", - )} - - {renderBothVersions( - "With Prefix and Suffix", - { - placeholder: "Input with both", - prefix: { icon: "search" }, - suffix: { icon: "calendar" }, - ...extraProps, - }, - "both", - )} - - {renderBothVersions( - "With Toolbar", - { - placeholder: "With toolbar", - toolbar: toolbar, - ...extraProps, - }, - "withToolbar", - )} - - {renderBothVersions( - "Combined Features", - { - placeholder: "All features", - align: "right", - prefix: { label: "$" }, - suffix: { icon: "remove" }, - toolbar: toolbar, - ...extraProps, - }, - "both", - )} - {renderBothVersions( - "Size small", - { - placeholder: "With Size", - size: "small", - ...extraProps, - }, - "sizeSmall", - )} - {renderBothVersions( - "Size large", - { placeholder: "With Size", size: "large", ...extraProps }, - "sizeLarge", - )} - {renderBothVersions( - "Multiline Resize", - { - placeholder: "Multiline resize", - rows: { min: 2, max: 10 }, - multiline: true, - }, - "multilineResize", - )} -
- - -