You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(textfield): text area improved resize behavior and alignment wip
Improved resize behavior on text area, and alignment of the validation
icon in various scenarios.
Adds to the stories for Text area to try and account for more
combinations of the options available. An issue still exists with
long text within the field label no longer wrapping and preventing the
default defined width from being used.
Copy file name to clipboardExpand all lines: components/textfield/stories/textfield.stories.js
+41-25Lines changed: 41 additions & 25 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,6 @@
1
1
// Import the component markup template
2
2
import{html}from"lit";
3
+
import{when}from"lit/directives/when.js";
3
4
import{Template}from"./template";
4
5
5
6
exportdefault{
@@ -205,28 +206,24 @@ const TextFieldGroup = ({
205
206
${Template({
206
207
...args
207
208
})}
208
-
${window.isChromatic() ?
209
-
Template({
209
+
${when(window.isChromatic(),()=>html`
210
+
${Template({
210
211
displayLabel: true,
211
212
labelText: "Username",
212
-
})
213
-
: null}
214
-
${window.isChromatic() ?
215
-
Template({
213
+
})}
214
+
${Template({
216
215
displayLabel: true,
217
216
labelText: "Username that is really long and wraps onto a second line",
218
217
isInvalid: true,
219
-
})
220
-
: null}
221
-
${window.isChromatic() ?
222
-
Template({
218
+
})}
219
+
${Template({
223
220
displayLabel: true,
224
221
labelText: "Username",
225
222
labelPosition: 'side',
226
223
isValid: true,
227
224
value: "username@reallylongemail.com"
228
-
})
229
-
: null}
225
+
})}
226
+
`)}
230
227
</div>
231
228
`;
232
229
};
@@ -241,33 +238,52 @@ const TextAreaGroup = ({
241
238
multiline: true,
242
239
value: "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt."
243
240
})}
244
-
${window.isChromatic() ?
245
-
Template({
241
+
${when(window.isChromatic(),()=>html`
242
+
${Template({
246
243
displayLabel: true,
247
244
labelText: "Username",
248
245
multiline: true,
249
246
value: "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt.",
250
-
})
251
-
: null}
252
-
${window.isChromatic() ?
253
-
Template({
247
+
})}
248
+
${Template({
254
249
displayLabel: true,
255
-
labelText: "Username that is really long and wraps onto a second line",
250
+
labelText: "Username",
251
+
multiline: true,
252
+
grows: true,
253
+
value: "Grows, with no resize. Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt.",
254
+
})}
255
+
${Template({
256
+
displayLabel: true,
257
+
labelText: "Username",
258
+
multiline: true,
259
+
value: "Example of behavior where Text area gets stretched by default within a flex container with flex-direction: column. Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia volupta.",
260
+
customStyles: {
261
+
'align-self': 'stretch'
262
+
}
263
+
})}
264
+
${Template({
265
+
displayLabel: true,
266
+
labelText: "Username",
267
+
isInvalid: true,
268
+
multiline: true,
269
+
value: "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt.",
270
+
})}
271
+
${Template({
272
+
displayLabel: true,
273
+
labelText: "Username that has a really long label and wraps onto a second line. Lorem ipsum dolor sit amet.",
256
274
isInvalid: true,
257
275
multiline: true,
258
276
value: "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt.",
259
-
})
260
-
: null}
261
-
${window.isChromatic() ?
262
-
Template({
277
+
})}
278
+
${Template({
263
279
displayLabel: true,
264
280
labelText: "Username",
265
281
labelPosition: 'side',
266
282
isValid: true,
267
283
multiline: true,
268
284
value: "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt.",
0 commit comments