From 00a7c05aeca02bf21b9ae056b3b0bf8576f29d54 Mon Sep 17 00:00:00 2001 From: HoshinoSuzumi Date: Tue, 26 Nov 2024 14:09:11 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(textarea):=20new=20component?= =?UTF-8?q?=20`textarea`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/content/2.components/textarea.md | 182 ++++++++++++++++++++ src/runtime/components/forms/Textarea.vue | 192 ++++++++++++++++++++++ src/runtime/types/index.ts | 1 + src/runtime/types/textarea.d.ts | 19 +++ src/runtime/ui.config/forms/textarea.ts | 24 +++ src/runtime/ui.config/index.ts | 1 + 6 files changed, 419 insertions(+) create mode 100644 docs/content/2.components/textarea.md create mode 100644 src/runtime/components/forms/Textarea.vue create mode 100644 src/runtime/types/textarea.d.ts create mode 100644 src/runtime/ui.config/forms/textarea.ts diff --git a/docs/content/2.components/textarea.md b/docs/content/2.components/textarea.md new file mode 100644 index 0000000..b170db2 --- /dev/null +++ b/docs/content/2.components/textarea.md @@ -0,0 +1,182 @@ +--- +description: Create a textarea component +since: 1.3.5 +--- + +## Usage + +The basic usage. + +::ComponentPreview +--- +privateProps: + placeholder: Description +--- +:: + +### Sizes + +::ComponentPreview +--- +privateProps: + placeholder: Description +props: + size: sm +--- +:: + +### Colors + +::ComponentPreview +--- +privateProps: + placeholder: Description +props: + color: primary +--- +:: + +### Variants + +::ComponentPreview +--- +privateProps: + placeholder: Description +props: + variant: outline +--- +:: + +### Placeholder + +You can also set a placeholder. + +::ComponentPreview +--- +props: + placeholder: "Description here..." +--- +:: + +### Padded + +::ComponentPreview +--- +privateProps: + placeholder: Description + variant: plain +props: + padded: false +--- +:: + +### Rows + +Set the number of rows of the textarea. + +::ComponentPreview +--- +privateProps: + placeholder: Description +props: + rows: 4 +--- +:: + +### Resize + +Enable the resize control. + +::ComponentPreview +--- +privateProps: + placeholder: Description +props: + resize: true +--- +:: + +### Auto Resize + +The `autosize` prop enables the auto resizing of the textarea. The textarea will grow in height as the user types. + +::ComponentPreview +--- +privateProps: + placeholder: Description +props: + autosize: true +--- +:: + +The `maxrows` prop can be used to set the maximum number of rows the textarea can grow to. + +::ComponentPreview +--- +privateProps: + placeholder: Description +props: + autosize: true + maxrows: 8 +--- +:: + +### Disabled + +::ComponentPreview +--- +privateProps: + placeholder: Description +props: + disabled: true +--- +:: + +### Model Modifiers + +#### .trim + +The `.trim` modifier trims the input value. + +```vue [page] + + + +``` + +#### .number + +The `.number` modifier converts the input value to a number. Non-numeric values are ignored. + +```vue [page] + + + +``` + +#### .lazy + +The `.lazy` modifier syncs the input value with the model only on `change` event. + +```vue [page] + + + +``` + +## Config + +::ComponentDefaults +:: diff --git a/src/runtime/components/forms/Textarea.vue b/src/runtime/components/forms/Textarea.vue new file mode 100644 index 0000000..e9b5025 --- /dev/null +++ b/src/runtime/components/forms/Textarea.vue @@ -0,0 +1,192 @@ + + +