From 6cf0c996f57faef067c77ae1abf69e9953c56c13 Mon Sep 17 00:00:00 2001
From: Ali Amouri Kadhim <53454241+AliKdhim87@users.noreply.github.com>
Date: Thu, 4 Aug 2022 10:05:45 +0200
Subject: [PATCH] feat: improve the vue textarea component (#1107)
* feat: improve the vue textarea component
* docs: add the vue textarea component stories
* docs: remove live textarea binding
---
.../src/UtrechtTextarea.vue | 44 +++--
.../src/stories/Textarea/Textarea.stories.mdx | 65 +++++++
.../Textarea/TextareaBinding.stories.mdx | 42 +++++
.../Textarea/TextareaStates.stories.mdx | 159 ++++++++++++++++++
.../src/stories/Textarea/argTypes.ts | 35 ++++
.../src/stories/Textarea/docs.stories.mdx | 8 +
.../src/stories/Textarea/tokens.stories.mdx | 20 +++
7 files changed, 350 insertions(+), 23 deletions(-)
create mode 100644 packages/storybook-vue/src/stories/Textarea/Textarea.stories.mdx
create mode 100644 packages/storybook-vue/src/stories/Textarea/TextareaBinding.stories.mdx
create mode 100644 packages/storybook-vue/src/stories/Textarea/TextareaStates.stories.mdx
create mode 100644 packages/storybook-vue/src/stories/Textarea/argTypes.ts
create mode 100644 packages/storybook-vue/src/stories/Textarea/docs.stories.mdx
create mode 100644 packages/storybook-vue/src/stories/Textarea/tokens.stories.mdx
diff --git a/packages/component-library-vue/src/UtrechtTextarea.vue b/packages/component-library-vue/src/UtrechtTextarea.vue
index 79ba9752c3b..571291a9949 100644
--- a/packages/component-library-vue/src/UtrechtTextarea.vue
+++ b/packages/component-library-vue/src/UtrechtTextarea.vue
@@ -1,32 +1,30 @@
-
+ :class="[
+ { 'utrecht-textarea--invalid': invalid },
+ 'utrecht-textarea',
+ 'utrecht-textarea--html-textarea'
+ ]"
+ />
diff --git a/packages/storybook-vue/src/stories/Textarea/Textarea.stories.mdx b/packages/storybook-vue/src/stories/Textarea/Textarea.stories.mdx
new file mode 100644
index 00000000000..8c42a67e1d4
--- /dev/null
+++ b/packages/storybook-vue/src/stories/Textarea/Textarea.stories.mdx
@@ -0,0 +1,65 @@
+import { action } from "@storybook/addon-actions";
+import { ArgsTable, Canvas, Meta, Story } from "@storybook/addon-docs";
+import { Textarea } from "@utrecht/component-library-vue";
+import { argTypes } from "./argTypes.ts";
+
+
+
+# Textarea
+
+export const Template = (args, { argTypes }) => ({
+ props: Object.keys(argTypes),
+ components: { Textarea },
+ setup() {
+ return { args };
+ },
+ template: ``,
+ methods: { action: action("change") },
+});
+
+## Default
+
+
+
+## With Placeholder
+
+
+
+
diff --git a/packages/storybook-vue/src/stories/Textarea/TextareaBinding.stories.mdx b/packages/storybook-vue/src/stories/Textarea/TextareaBinding.stories.mdx
new file mode 100644
index 00000000000..77213ac0bb4
--- /dev/null
+++ b/packages/storybook-vue/src/stories/Textarea/TextareaBinding.stories.mdx
@@ -0,0 +1,42 @@
+import { action } from "@storybook/addon-actions";
+import { ArgsTable, Canvas, Meta, Story } from "@storybook/addon-docs";
+import { Textarea } from "@utrecht/component-library-vue";
+import { argTypes } from "./argTypes.ts";
+
+
+
+# Textarea
+
+export const Template = (args, { argTypes }) => ({
+ props: Object.keys(argTypes),
+ components: { Textarea },
+ setup() {
+ return { args };
+ },
+ template: ``,
+ methods: { action: action("modelValue") },
+});
+
+## With form binding
+
+
+
+
diff --git a/packages/storybook-vue/src/stories/Textarea/TextareaStates.stories.mdx b/packages/storybook-vue/src/stories/Textarea/TextareaStates.stories.mdx
new file mode 100644
index 00000000000..15eabc22b20
--- /dev/null
+++ b/packages/storybook-vue/src/stories/Textarea/TextareaStates.stories.mdx
@@ -0,0 +1,159 @@
+import { action } from "@storybook/addon-actions";
+import { ArgsTable, Canvas, Meta, Story } from "@storybook/addon-docs";
+import { Textarea } from "@utrecht/component-library-vue";
+import { argTypes } from "./argTypes.ts";
+
+
+
+# Textarea States
+
+export const Template = (args, { argTypes }) => ({
+ props: Object.keys(argTypes),
+ components: { Textarea },
+ setup() {
+ return { args };
+ },
+ template: ``,
+ methods: { action: action("change") },
+});
+
+## Disabled
+
+
+
+## Invalid
+
+
+
+## Read-only
+
+
+
+## Required
+
+
+
+## Focus
+
+
+
+## Hover
+
+
+
+
diff --git a/packages/storybook-vue/src/stories/Textarea/argTypes.ts b/packages/storybook-vue/src/stories/Textarea/argTypes.ts
new file mode 100644
index 00000000000..035094c2b7d
--- /dev/null
+++ b/packages/storybook-vue/src/stories/Textarea/argTypes.ts
@@ -0,0 +1,35 @@
+export const argTypes = {
+ disabled: {
+ name: 'disabled',
+ type: { name: 'boolean', required: false },
+ defaultValue: false,
+ },
+ invalid: {
+ name: 'invalid',
+ type: { name: 'boolean', required: false },
+ defaultValue: false,
+ },
+ required: {
+ name: 'required',
+ type: { name: 'boolean', required: false },
+ defaultValue: false,
+ },
+ readonly: {
+ name: 'readonly',
+ type: { name: 'boolean', required: false },
+ defaultValue: false,
+ },
+ modelValue: {
+ name: 'modelValue',
+ type: { name: 'string', required: false },
+ defaultValue: 'The Quick Brown Fox Jumps Over The Lazy Dog',
+ },
+ rows: {
+ name: 'rows',
+ type: { name: 'number', required: false },
+ },
+ cols: {
+ name: 'cols',
+ type: { name: 'number', required: false },
+ },
+};
diff --git a/packages/storybook-vue/src/stories/Textarea/docs.stories.mdx b/packages/storybook-vue/src/stories/Textarea/docs.stories.mdx
new file mode 100644
index 00000000000..360f68fc7eb
--- /dev/null
+++ b/packages/storybook-vue/src/stories/Textarea/docs.stories.mdx
@@ -0,0 +1,8 @@
+import { Description, Meta } from "@storybook/addon-docs";
+import document from "@utrecht/components/textarea/README.md";
+
+
+
+
+
+
diff --git a/packages/storybook-vue/src/stories/Textarea/tokens.stories.mdx b/packages/storybook-vue/src/stories/Textarea/tokens.stories.mdx
new file mode 100644
index 00000000000..497187fd31a
--- /dev/null
+++ b/packages/storybook-vue/src/stories/Textarea/tokens.stories.mdx
@@ -0,0 +1,20 @@
+
+
+import { Meta } from "@storybook/addon-docs";
+import tokensDefinition from "@utrecht/components/textarea/tokens.json";
+import tokens from "@utrecht/design-tokens/dist/index.json";
+import { ComponentTokensSection } from "@utrecht/documentation/components/ComponentTokensSection.jsx";
+
+
+
+# Textarea Design Tokens
+
+