Skip to content

Commit a22efd5

Browse files
committed
updated stories, removed bloat
1 parent bf4af78 commit a22efd5

File tree

2 files changed

+96
-25
lines changed

2 files changed

+96
-25
lines changed

packages/uui-textarea/lib/uui-textarea.element.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -215,15 +215,10 @@ export class UUITextareaElement extends LabelMixin('input label', LitElement) {
215215
}
216216
}
217217

218-
getMaxLengthClasses() {
219-
if (this.maxLength && this.value) {
220-
return this.value.length >= this.maxLength ? 'maxed' : '';
221-
}
222-
return '';
223-
}
224-
225218
renderMaxLength() {
226-
return html`<span id="char-count" class=${this.getMaxLengthClasses()}
219+
return html`<span
220+
id="char-count"
221+
class=${this.value.length >= this.maxLength! ? 'maxed' : ''}
227222
>${this.value ? this.value.length : 0}/${this.maxLength}</span
228223
>`;
229224
}

packages/uui-textarea/lib/uui-textarea.story.ts

Lines changed: 93 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,6 @@ export default {
66
id: 'uui-textarea',
77
title: 'Inputs/Textarea',
88
component: 'uui-textarea',
9-
parameters: {
10-
docs: {
11-
source: {
12-
code: `<uui-textarea></uui-textarea>`,
13-
},
14-
},
15-
},
169
args: {
1710
value: '',
1811
},
@@ -35,37 +28,120 @@ export const AAAOverview: Story = props =>
3528
AAAOverview.storyName = 'Overview';
3629
AAAOverview.args = {
3730
label: 'Label',
38-
autoHeight: true,
3931
maxLength: 200,
4032
minHeight: '100px',
4133
maxHeight: '200px',
4234
};
35+
AAAOverview.parameters = {
36+
docs: {
37+
source: {
38+
code: `<uui-textarea label="Label"></uui-textarea>`,
39+
},
40+
},
41+
};
4342

4443
export const MaxLength: Story = props =>
45-
html`<uui-textarea label="textarea" maxLength="20"></uui-textarea>`;
44+
html`<uui-textarea
45+
label="textarea"
46+
maxLength=${props.maxLength}></uui-textarea>`;
47+
48+
MaxLength.args = { maxLength: 20 };
49+
MaxLength.parameters = {
50+
controls: { include: ['maxLength'] },
51+
docs: {
52+
source: {
53+
code: `<uui-textarea label="textarea" maxLength="20"></uui-textarea>`,
54+
},
55+
},
56+
};
4657

4758
export const Disabled: Story = props =>
48-
html`<uui-textarea label="textarea" disabled></uui-textarea>`;
59+
html`<uui-textarea label="Label" ?disabled=${props.disabled}></uui-textarea>`;
60+
61+
Disabled.args = { disabled: true };
62+
Disabled.parameters = {
63+
controls: { include: ['disabled'] },
64+
docs: {
65+
source: {
66+
code: `<uui-textarea label="Label" disabled></uui-textarea>`,
67+
},
68+
},
69+
};
4970

5071
export const Placeholder: Story = props =>
5172
html`<uui-textarea
52-
label="textarea"
53-
placeholder="I am a placeholder..."></uui-textarea>`;
73+
label="Label"
74+
placeholder=${props.placeholder}></uui-textarea>`;
75+
76+
Placeholder.args = { placeholder: 'I am a placeholder...' };
77+
Placeholder.parameters = {
78+
controls: { include: ['placeholder'] },
79+
docs: {
80+
source: {
81+
code: `<uui-textarea
82+
label="Label"
83+
placeholder="I am a placeholder..."></uui-textarea>`,
84+
},
85+
},
86+
};
5487

5588
export const MaxAndMinHeight: Story = props =>
5689
html`<uui-textarea
57-
label="textarea"
58-
minHeight="100px"
59-
maxHeight="200px"></uui-textarea>`;
90+
label="Label"
91+
minHeight=${props.minHeight}
92+
maxHeight=${props.maxHeight}></uui-textarea>`;
93+
94+
MaxAndMinHeight.args = { minHeight: '100px', maxHeight: '200px' };
95+
MaxAndMinHeight.parameters = {
96+
controls: { include: ['minHeight', 'maxHeight'] },
97+
docs: {
98+
source: {
99+
code: `<uui-textarea
100+
label="Label"
101+
minHeight="100px"
102+
maxHeight="200px"></uui-textarea>`,
103+
},
104+
},
105+
};
60106

61107
export const AutomaticHeightAdjustment: Story = props =>
62108
html` the height wil confine itself within the max and min height if defined.
63-
<uui-textarea label="textarea" auto-height></uui-textarea>`;
109+
<uui-textarea
110+
label="Label"
111+
?auto-height=${props.autoHeight}></uui-textarea>`;
112+
113+
AutomaticHeightAdjustment.args = { autoHeight: true };
114+
AutomaticHeightAdjustment.parameters = {
115+
controls: { include: ['autoHeight'] },
116+
docs: {
117+
source: {
118+
code: `<uui-textarea label="Label" auto-height></uui-textarea>`,
119+
},
120+
},
121+
};
64122

65123
export const AutomaticHeightAdjustmentWithHeightLimits: Story = props =>
66124
html` the height wil confine itself within the max and min height if defined.
67125
<uui-textarea
68-
label="textarea"
126+
label="Label"
69127
auto-height
70128
minHeight="100px"
71129
maxHeight="200px"></uui-textarea>`;
130+
131+
AutomaticHeightAdjustmentWithHeightLimits.args = {
132+
minHeight: '100px',
133+
maxHeight: '200px',
134+
autoHeight: true,
135+
};
136+
AutomaticHeightAdjustmentWithHeightLimits.parameters = {
137+
controls: { include: ['minHeight', 'maxHeight', 'autoHeight'] },
138+
docs: {
139+
source: {
140+
code: `<uui-textarea
141+
label="Label"
142+
auto-height
143+
minHeight="100px"
144+
maxHeight="200px"></uui-textarea>`,
145+
},
146+
},
147+
};

0 commit comments

Comments
 (0)