Skip to content

Commit 4c0128c

Browse files
authored
Merge pull request #264 from dnum-mi/fix/add-input-hint
fix: 🐛 Corrige l'oubli de l'indice du composant champ de saisie
2 parents ac18e3f + f4259fe commit 4c0128c

File tree

4 files changed

+25
-1
lines changed

4 files changed

+25
-1
lines changed

src/components/DsfrInput/DsfrInput.stories.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ export default {
1313
control: 'text',
1414
description: 'Label du champ de saisie',
1515
},
16+
hint: {
17+
control: 'text',
18+
description: 'Indice associé au champ de saisie',
19+
},
1620
labelVisible: {
1721
control: 'boolean',
1822
description: 'Indique si le label doit être visible (`true`) ou non (`false`, défaut)',
@@ -65,6 +69,7 @@ export const LabelNotVisible = (args) => ({
6569
<DsfrInput
6670
:model-value="modelValue"
6771
:label="label"
72+
:hint="hint"
6873
:placeholder="placeholder"
6974
:label-visible="labelVisible"
7075
:disabled="disabled"
@@ -77,7 +82,6 @@ export const LabelNotVisible = (args) => ({
7782
})
7883
LabelNotVisible.args = {
7984
dark: false,
80-
label: 'Label champ de saisie',
8185
labelVisible: false,
8286
placeholder: 'Placeholder',
8387
modelValue: '',
@@ -98,6 +102,7 @@ export const LabelVisible = (args) => ({
98102
<DsfrInput
99103
:model-value="modelValue"
100104
:label="label"
105+
:hint="hint"
101106
:label-visible="labelVisible"
102107
:placeholder="placeholder"
103108
:disabled="disabled"
@@ -111,6 +116,7 @@ export const LabelVisible = (args) => ({
111116
LabelVisible.args = {
112117
dark: false,
113118
label: 'Label champ de saisie',
119+
hint: 'Indice de champ de saisie',
114120
labelVisible: true,
115121
placeholder: 'Placeholder',
116122
modelValue: '',

src/components/DsfrInput/DsfrInput.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ export default defineComponent({
2020
type: String,
2121
default: '',
2222
},
23+
hint: {
24+
type: String,
25+
default: '',
26+
},
2327
labelVisible: Boolean,
2428
modelValue: {
2529
type: String,
@@ -47,6 +51,10 @@ export default defineComponent({
4751
:for="id"
4852
>
4953
{{ label }} {{ $attrs.required ? '*' : '' }}
54+
<span
55+
v-if="hint"
56+
class="fr-hint-text"
57+
>{{ hint }}</span>
5058
</label>
5159
<component
5260
:is="isComponent"

src/components/DsfrInput/DsfrInputGroup.stories.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ export default {
1313
control: 'text',
1414
description: 'Label du champ de saisie. Sera passé à DsfrInput si modelValue n’est pas `undefined`',
1515
},
16+
hint: {
17+
control: 'text',
18+
description: 'Indice associé au champ de saisie',
19+
},
1620
labelVisible: {
1721
control: 'boolean',
1822
description: 'Indique si le label doit être visible (`true`) ou non (`false`, défaut). Sera passé à DsfrInput si modelValue n’est pas `undefined`',
@@ -65,6 +69,7 @@ export const ChampEnErreur = (args) => ({
6569
:error-message="errorMessage"
6670
:model-value="modelValue"
6771
:label="label"
72+
:hint="hint"
6873
:label-visible="labelVisible"
6974
:placeholder="placeholder"
7075
:is-invalid="isInvalid"

src/components/DsfrInput/DsfrInputGroup.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ export default defineComponent({
2626
type: String,
2727
default: '',
2828
},
29+
hint: {
30+
type: String,
31+
default: '',
32+
},
2933
labelVisible: Boolean,
3034
modelValue: {
3135
type: String,
@@ -76,6 +80,7 @@ export default defineComponent({
7680
:is-valid="!!validMessage"
7781
:is-invalid="!!errorMessage"
7882
:label="label"
83+
:hint="hint"
7984
:description-id="descriptionId"
8085
:label-visible="labelVisible"
8186
:model-value="modelValue"

0 commit comments

Comments
 (0)