Skip to content

Commit

Permalink
feat: type and refactor textarea component (#536)
Browse files Browse the repository at this point in the history
  • Loading branch information
NateWaldschmidt authored Sep 4, 2024
1 parent 1647f0e commit 7e912af
Show file tree
Hide file tree
Showing 12 changed files with 315 additions and 362 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# CHANGELOG

## v2.0.91

- Type `Textarea` component and normalize props

## v2.0.90

-

## v2.0.89

- Slot `helper` added `RadioButton` as alternative to `helperText`
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lob/ui-components",
"version": "2.0.90",
"version": "2.0.91",
"engines": {
"node": ">=20.2.0",
"npm": ">=10.2.0"
Expand Down
12 changes: 0 additions & 12 deletions src/components/Textarea/Textarea.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,8 @@ import { Primary } from './Textarea.stories';

# Textarea

A textarea component for entering large blocks of text in a form.

<Canvas of={Primary} />

## How to Use

You can pass in the `v-model` prop to bind the textarea to the parent component's data model.

You can pass in a `@change` handler to trigger a custom function on change events. The `event` object will be emitted along with the `change` event.

```html
<textarea name="FancyTextarea" label="Fancy text" v-model="form.fancy" />
```

## Props

<ArgTypes story={PRIMARY_STORY} />
81 changes: 67 additions & 14 deletions src/components/Textarea/Textarea.stories.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Textarea from './Textarea.vue';
import mdx from './Textarea.mdx';
import { TextareaColor } from './constants';

export default {
title: 'Components/Textarea',
Expand All @@ -10,15 +11,76 @@ export default {
}
},
argTypes: {
'v-model': {
color: {
options: Object.values(TextareaColor),
control: {
type: null
type: 'select'
},
table: {
type: {
summary: Object.values(TextareaColor).join(' | ')
}
}
},
maxLength: {
cols: {
control: {
type: 'number'
}
},
disabled: {
control: {
type: 'boolean'
}
},
id: {
control: {
type: 'text'
}
},
label: {
control: {
type: 'text'
}
},
maxlength: {
control: {
type: 'number'
}
},
minlength: {
control: {
type: 'number'
}
},
name: {
control: {
type: 'text'
}
},
placeholder: {
control: {
type: 'text'
}
},
readonly: {
control: {
type: 'boolean'
}
},
required: {
control: {
type: 'boolean'
}
},
rows: {
control: {
type: 'number'
}
},
spellcheck: {
control: {
type: 'boolean'
}
}
}
};
Expand Down Expand Up @@ -47,22 +109,13 @@ WithTooltip.args = {
id: 'description',
label: 'Description',
placeholder: 'Add a description',
tooltipContent: 'Add a description for your campaign'
tooltip: 'Add a description for your campaign'
};

export const WithHelperText = Primary.bind({});
WithHelperText.args = {
id: 'description',
label: 'Description',
placeholder: 'Add a description',
helperText: 'Add a description for your campaign'
};

export const WithMaxLength = Primary.bind({});
WithMaxLength.args = {
id: 'description',
label: 'Description',
placeholder: 'Add a description',
showCounter: true,
maxLength: 60
helper: 'Add a description for your campaign'
};
Loading

0 comments on commit 7e912af

Please sign in to comment.