From e179f0562f578ce198edf249ceff5703fa394f44 Mon Sep 17 00:00:00 2001 From: Pavel Klibani Date: Sun, 17 Sep 2023 02:43:16 +0200 Subject: [PATCH 1/2] Docs(web-react): Add TextField demo #DS-913 - TextField demo in web-react is now same as demo in web and web-twig --- .../components/TextField/demo/TextField.tsx | 16 ------ .../TextField/demo/TextFieldDefault.tsx | 21 ++++++++ .../TextField/demo/TextFieldDisabled.tsx | 23 ++++----- .../TextField/demo/TextFieldFluid.tsx | 8 +-- .../TextField/demo/TextFieldHelperText.tsx | 24 ++++----- .../TextField/demo/TextFieldHiddenLabel.tsx | 14 ++++++ .../TextField/demo/TextFieldInline.tsx | 44 +++++++++++++++++ .../TextField/demo/TextFieldInputWidth.tsx | 15 ++++-- .../TextField/demo/TextFieldLabelHidden.tsx | 10 ---- .../demo/TextFieldPasswordToggle.tsx | 30 ++++++++---- .../TextField/demo/TextFieldRequired.tsx | 8 ++- .../TextField/demo/TextFieldType.tsx | 18 ------- .../TextField/demo/TextFieldValidation.tsx | 49 +++++++++++++++++++ .../demo/TextFieldValidationState.tsx | 32 ------------ .../src/components/TextField/demo/index.tsx | 46 ++++++++--------- 15 files changed, 210 insertions(+), 148 deletions(-) delete mode 100644 packages/web-react/src/components/TextField/demo/TextField.tsx create mode 100644 packages/web-react/src/components/TextField/demo/TextFieldDefault.tsx create mode 100644 packages/web-react/src/components/TextField/demo/TextFieldHiddenLabel.tsx create mode 100644 packages/web-react/src/components/TextField/demo/TextFieldInline.tsx delete mode 100644 packages/web-react/src/components/TextField/demo/TextFieldLabelHidden.tsx delete mode 100644 packages/web-react/src/components/TextField/demo/TextFieldType.tsx create mode 100644 packages/web-react/src/components/TextField/demo/TextFieldValidation.tsx delete mode 100644 packages/web-react/src/components/TextField/demo/TextFieldValidationState.tsx diff --git a/packages/web-react/src/components/TextField/demo/TextField.tsx b/packages/web-react/src/components/TextField/demo/TextField.tsx deleted file mode 100644 index 3d6c8e6970..0000000000 --- a/packages/web-react/src/components/TextField/demo/TextField.tsx +++ /dev/null @@ -1,16 +0,0 @@ -// Because there is no `dist` directory during the CI run -/* eslint-disable import/no-extraneous-dependencies, import/extensions, import/no-unresolved */ -import React from 'react'; -import { ComponentStory } from '@storybook/react'; -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: No declaration file -import { SpiritTextFieldProps } from '../../../types'; -import TextField from '../TextField'; - -const Story: ComponentStory = (args: SpiritTextFieldProps) => ; - -Story.args = { - id: 'textfield-example', -}; - -export default Story; diff --git a/packages/web-react/src/components/TextField/demo/TextFieldDefault.tsx b/packages/web-react/src/components/TextField/demo/TextFieldDefault.tsx new file mode 100644 index 0000000000..0dec683971 --- /dev/null +++ b/packages/web-react/src/components/TextField/demo/TextFieldDefault.tsx @@ -0,0 +1,21 @@ +import React from 'react'; +import TextField from '../TextField'; + +const TextFieldDefault = () => ( + <> + + + + + + +); + +export default TextFieldDefault; diff --git a/packages/web-react/src/components/TextField/demo/TextFieldDisabled.tsx b/packages/web-react/src/components/TextField/demo/TextFieldDisabled.tsx index de04aefa4a..4edcc1916e 100644 --- a/packages/web-react/src/components/TextField/demo/TextFieldDisabled.tsx +++ b/packages/web-react/src/components/TextField/demo/TextFieldDisabled.tsx @@ -1,19 +1,20 @@ import React from 'react'; import TextField from '../TextField'; -// @see: https://github.com/storybookjs/storybook/issues/8104#issuecomment-932310244 -// eslint-disable-next-line @typescript-eslint/no-unused-vars -const Story = (props: unknown) => ( -
- +const TextFieldDisabled = () => ( + <> + + -
+ ); -export default Story; +export default TextFieldDisabled; diff --git a/packages/web-react/src/components/TextField/demo/TextFieldFluid.tsx b/packages/web-react/src/components/TextField/demo/TextFieldFluid.tsx index d7133bcb75..473ffdd5d3 100644 --- a/packages/web-react/src/components/TextField/demo/TextFieldFluid.tsx +++ b/packages/web-react/src/components/TextField/demo/TextFieldFluid.tsx @@ -1,8 +1,8 @@ import React from 'react'; import TextField from '../TextField'; -// @see: https://github.com/storybookjs/storybook/issues/8104#issuecomment-932310244 -// eslint-disable-next-line @typescript-eslint/no-unused-vars -const Story = (props: unknown) => ; +const TextFieldFluid = () => ( + +); -export default Story; +export default TextFieldFluid; diff --git a/packages/web-react/src/components/TextField/demo/TextFieldHelperText.tsx b/packages/web-react/src/components/TextField/demo/TextFieldHelperText.tsx index 9f1b5bacd7..74467481fb 100644 --- a/packages/web-react/src/components/TextField/demo/TextFieldHelperText.tsx +++ b/packages/web-react/src/components/TextField/demo/TextFieldHelperText.tsx @@ -1,18 +1,14 @@ -// Because there is no `dist` directory during the CI run -/* eslint-disable import/no-extraneous-dependencies, import/extensions, import/no-unresolved */ import React from 'react'; -import { ComponentStory } from '@storybook/react'; -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: No declaration file -import { SpiritTextFieldProps } from '../../../types'; import TextField from '../TextField'; -const Story: ComponentStory = (args: SpiritTextFieldProps) => ; +const TextFieldHelperText = () => ( + +); -Story.args = { - id: 'textfield-helper-text-example', - label: 'Label with helper text', - helperText: 'Custom helper text', -}; - -export default Story; +export default TextFieldHelperText; diff --git a/packages/web-react/src/components/TextField/demo/TextFieldHiddenLabel.tsx b/packages/web-react/src/components/TextField/demo/TextFieldHiddenLabel.tsx new file mode 100644 index 0000000000..cd86358452 --- /dev/null +++ b/packages/web-react/src/components/TextField/demo/TextFieldHiddenLabel.tsx @@ -0,0 +1,14 @@ +import React from 'react'; +import TextField from '../TextField'; + +const TextFieldHiddenLabel = () => ( + +); + +export default TextFieldHiddenLabel; diff --git a/packages/web-react/src/components/TextField/demo/TextFieldInline.tsx b/packages/web-react/src/components/TextField/demo/TextFieldInline.tsx new file mode 100644 index 0000000000..a26671d985 --- /dev/null +++ b/packages/web-react/src/components/TextField/demo/TextFieldInline.tsx @@ -0,0 +1,44 @@ +import React from 'react'; +import { Button } from '../../Button'; +import TextField from '../TextField'; + +const TextFieldInline = () => ( + <> +
+ + +
+ +
+ + + +
+ +); + +export default TextFieldInline; diff --git a/packages/web-react/src/components/TextField/demo/TextFieldInputWidth.tsx b/packages/web-react/src/components/TextField/demo/TextFieldInputWidth.tsx index 649f63ebdb..ffd72e64e7 100644 --- a/packages/web-react/src/components/TextField/demo/TextFieldInputWidth.tsx +++ b/packages/web-react/src/components/TextField/demo/TextFieldInputWidth.tsx @@ -1,10 +1,15 @@ import React from 'react'; import TextField from '../TextField'; -// @see: https://github.com/storybookjs/storybook/issues/8104#issuecomment-932310244 -// eslint-disable-next-line @typescript-eslint/no-unused-vars -const Story = (props: unknown) => ( - +const TextFieldInputWidth = () => ( + ); -export default Story; +export default TextFieldInputWidth; diff --git a/packages/web-react/src/components/TextField/demo/TextFieldLabelHidden.tsx b/packages/web-react/src/components/TextField/demo/TextFieldLabelHidden.tsx deleted file mode 100644 index e83c5370d6..0000000000 --- a/packages/web-react/src/components/TextField/demo/TextFieldLabelHidden.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import React from 'react'; -import TextField from '../TextField'; - -// @see: https://github.com/storybookjs/storybook/issues/8104#issuecomment-932310244 -// eslint-disable-next-line @typescript-eslint/no-unused-vars -const Story = (props: unknown) => ( - -); - -export default Story; diff --git a/packages/web-react/src/components/TextField/demo/TextFieldPasswordToggle.tsx b/packages/web-react/src/components/TextField/demo/TextFieldPasswordToggle.tsx index 72d75974ec..6be5b714c2 100644 --- a/packages/web-react/src/components/TextField/demo/TextFieldPasswordToggle.tsx +++ b/packages/web-react/src/components/TextField/demo/TextFieldPasswordToggle.tsx @@ -1,15 +1,25 @@ import React from 'react'; import TextField from '../TextField'; -// @see: https://github.com/storybookjs/storybook/issues/8104#issuecomment-932310244 -// eslint-disable-next-line @typescript-eslint/no-unused-vars -const Story = (props: unknown) => ( - +const TextFieldPasswordToggle = () => ( + <> + + + + ); -export default Story; +export default TextFieldPasswordToggle; diff --git a/packages/web-react/src/components/TextField/demo/TextFieldRequired.tsx b/packages/web-react/src/components/TextField/demo/TextFieldRequired.tsx index b5be91612e..cb8855bf69 100644 --- a/packages/web-react/src/components/TextField/demo/TextFieldRequired.tsx +++ b/packages/web-react/src/components/TextField/demo/TextFieldRequired.tsx @@ -1,10 +1,8 @@ import React from 'react'; import TextField from '../TextField'; -// @see: https://github.com/storybookjs/storybook/issues/8104#issuecomment-932310244 -// eslint-disable-next-line @typescript-eslint/no-unused-vars -const Story = (props: unknown) => ( - +const TextFieldRequired = () => ( + ); -export default Story; +export default TextFieldRequired; diff --git a/packages/web-react/src/components/TextField/demo/TextFieldType.tsx b/packages/web-react/src/components/TextField/demo/TextFieldType.tsx deleted file mode 100644 index c46e7dca52..0000000000 --- a/packages/web-react/src/components/TextField/demo/TextFieldType.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import React from 'react'; -import TextField from '../TextField'; - -// @see: https://github.com/storybookjs/storybook/issues/8104#issuecomment-932310244 -// eslint-disable-next-line @typescript-eslint/no-unused-vars -const Story = (props: unknown) => ( -
- - - - - - - -
-); - -export default Story; diff --git a/packages/web-react/src/components/TextField/demo/TextFieldValidation.tsx b/packages/web-react/src/components/TextField/demo/TextFieldValidation.tsx new file mode 100644 index 0000000000..4e6c68e95e --- /dev/null +++ b/packages/web-react/src/components/TextField/demo/TextFieldValidation.tsx @@ -0,0 +1,49 @@ +import React from 'react'; +import TextField from '../TextField'; + +const TextFieldValidation = () => ( + <> + + + + + + + + +); + +export default TextFieldValidation; diff --git a/packages/web-react/src/components/TextField/demo/TextFieldValidationState.tsx b/packages/web-react/src/components/TextField/demo/TextFieldValidationState.tsx deleted file mode 100644 index 770c8ffd6a..0000000000 --- a/packages/web-react/src/components/TextField/demo/TextFieldValidationState.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import React from 'react'; -import TextField from '../TextField'; - -// @see: https://github.com/storybookjs/storybook/issues/8104#issuecomment-932310244 -// eslint-disable-next-line @typescript-eslint/no-unused-vars -const Story = (props: unknown) => ( -
- - - -
-); - -export default Story; diff --git a/packages/web-react/src/components/TextField/demo/index.tsx b/packages/web-react/src/components/TextField/demo/index.tsx index d6734753c9..9b2d66e158 100644 --- a/packages/web-react/src/components/TextField/demo/index.tsx +++ b/packages/web-react/src/components/TextField/demo/index.tsx @@ -5,52 +5,52 @@ import ReactDOM from 'react-dom/client'; // eslint-disable-next-line @typescript-eslint/ban-ts-comment, import/extensions, import/no-unresolved // @ts-ignore: No declaration file import icons from '@lmc-eu/spirit-icons/dist/icons'; -import { IconsProvider } from '../../../context'; import DocsSection from '../../../../docs/DocsSections'; -import TextField from './TextField'; +import { IconsProvider } from '../../../context'; +import TextFieldDefault from './TextFieldDefault'; +import TextFieldRequired from './TextFieldRequired'; +import TextFieldHiddenLabel from './TextFieldHiddenLabel'; +import TextFieldHelperText from './TextFieldHelperText'; import TextFieldDisabled from './TextFieldDisabled'; +import TextFieldValidation from './TextFieldValidation'; import TextFieldFluid from './TextFieldFluid'; import TextFieldInputWidth from './TextFieldInputWidth'; -import TextFieldLabelHidden from './TextFieldLabelHidden'; +import TextFieldInline from './TextFieldInline'; import TextFieldPasswordToggle from './TextFieldPasswordToggle'; -import TextFieldLabelRequired from './TextFieldRequired'; -import TextFieldType from './TextFieldType'; -import TextFieldValidationState from './TextFieldValidationState'; -import TextFieldHelperText from './TextFieldHelperText'; ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render( - + + + + + + + + + + + + + - + - - + + - - - - - - - - - - - - , ); From 2fed992b3e2b657483cba2e9aa9b15ccfba4f9d2 Mon Sep 17 00:00:00 2001 From: Pavel Klibani Date: Sun, 17 Sep 2023 02:44:08 +0200 Subject: [PATCH 2/2] Docs(web): Add TextField demo #DS-913 - TextField demo in web is now same as demo in web-react and web-twig --- .../src/scss/components/TextField/index.html | 70 +++++++++++++++---- 1 file changed, 56 insertions(+), 14 deletions(-) diff --git a/packages/web/src/scss/components/TextField/index.html b/packages/web/src/scss/components/TextField/index.html index b68ff8f943..791e47c8f8 100644 --- a/packages/web/src/scss/components/TextField/index.html +++ b/packages/web/src/scss/components/TextField/index.html @@ -1,9 +1,11 @@ {{#> layout/plain }}
+

Default

-
+
+
@@ -18,47 +20,63 @@

Default

+
+
+

Required

-
+
+
+
+
+

Hidden Label

-
+
+
+
+
+

Helper Text

-
+
+
Helper text
+
+
+

Disabled

-
+
+
@@ -77,13 +95,17 @@

Disabled

value="Filled" />
+
+
+

Validation State with Validation Text

-
+
+
@@ -118,35 +140,49 @@

Validation State with Validation Text

This is helper text
Danger validation text
+
+
+

Fluid

-
- - +
+ +
+ + +
+
+
+

Size

-
+
+
+
+
+

Inline

-
-
+
+ +
@@ -154,7 +190,7 @@

Inline

-
+
@@ -187,13 +223,17 @@

Inline

+
+
+

Password Toggle

-
+
+
@@ -258,7 +298,9 @@

Password Toggle

+
+
{{/layout/plain }}