Skip to content

Commit b6a4a53

Browse files
Merge pull request #3140 from nextcloud/improve-textfields
Improve text fields
2 parents b98ced4 + f7acc0b commit b6a4a53

File tree

3 files changed

+121
-3
lines changed

3 files changed

+121
-3
lines changed

src/components/NcInputField/NcInputField.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,13 @@
2424
<label v-if="!labelOutside && label !== undefined"
2525
class="input-field__label"
2626
:class="{ 'input-field__label--hidden': !labelVisible }"
27-
:for="inputName">
27+
:for="computedId">
2828
{{ label }}
2929
</label>
3030
<div class="input-field__main-wrapper">
3131
<input v-bind="$attrs"
3232
:id="computedId"
3333
ref="input"
34-
:name="inputName"
3534
class="input-field__input"
3635
:type="type"
3736
:disabled="disabled"

src/components/NcPasswordField/NcPasswordField.vue

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ export default {
101101
:success="computedSuccess"
102102
:minlength="rules.minlength"
103103
:trailing-button-label="trailingButtonLabel"
104+
:disabled="disabled"
104105
v-on="$listeners"
105106
@trailing-button-click="togglePasswordVisibility"
106-
:disabled="disabled"
107107
@input="handleInput">
108108
<!-- Default slot for the leading icon -->
109109
<slot />
@@ -279,6 +279,24 @@ export default {
279279
type: Boolean,
280280
default: false,
281281
},
282+
283+
/**
284+
* Mark the password field as required
285+
*/
286+
required: {
287+
type: Boolean,
288+
default: false,
289+
},
290+
291+
/**
292+
* Name of the text field
293+
*
294+
* This is the key that will be send when sending a form
295+
*/
296+
name: {
297+
type: String,
298+
default: undefined,
299+
},
282300
},
283301
284302
emits: [

src/components/NcTextField/NcTextField.vue

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,107 @@ export default {
273273
type: String,
274274
default: '',
275275
},
276+
277+
/**
278+
* Disable the text field
279+
*/
280+
disabled: {
281+
type: Boolean,
282+
default: false,
283+
},
284+
285+
/**
286+
* Name of the text field
287+
*
288+
* This is the key that will be send when sending a form
289+
*/
290+
name: {
291+
type: String,
292+
default: undefined,
293+
},
294+
295+
/**
296+
* Helps the browser identify the type of text field and to provide
297+
* better autocompletion.
298+
*/
299+
autocomplete: {
300+
type: String,
301+
validator: (value) => [
302+
'on',
303+
'off',
304+
'name',
305+
'honorific-prefix',
306+
'given-name',
307+
'additional-name',
308+
'family-name',
309+
'honorific-suffix',
310+
'nickname',
311+
'email',
312+
'username',
313+
'organization-title',
314+
'organization',
315+
'street-address',
316+
'address-line1',
317+
'address-line2',
318+
'address-line3',
319+
'address-level4',
320+
'address-level3',
321+
'address-level2',
322+
'address-level1',
323+
'country',
324+
'country-name',
325+
'postal-code',
326+
'cc-name',
327+
'cc-given-name',
328+
'cc-additional-name',
329+
'cc-family-name',
330+
'cc-number',
331+
'cc-exp',
332+
'language',
333+
'bday',
334+
'bday-day',
335+
'bday-month',
336+
'bday-year',
337+
'sex',
338+
'tel',
339+
'impp',
340+
'url',
341+
'photo',
342+
].includes(value),
343+
default: 'on',
344+
},
345+
346+
/**
347+
* Define hows the mobile browser should capitalize the text input
348+
*/
349+
autocapitalize: {
350+
type: String,
351+
default: 'sentences',
352+
validator: (value) => [
353+
'none',
354+
'off',
355+
'on',
356+
'sentences',
357+
'words',
358+
'characters',
359+
].includes(value),
360+
},
361+
362+
/**
363+
* Allow to disable spellchecking
364+
*/
365+
spellcheck: {
366+
type: Boolean,
367+
default: true,
368+
},
369+
370+
/**
371+
* Mark the text field as required
372+
*/
373+
required: {
374+
type: Boolean,
375+
default: false,
376+
},
276377
},
277378
278379
emits: [

0 commit comments

Comments
 (0)