@1024pix/pix-ui 42.0.4 → 43.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/addon/components/pix-checkbox.hbs +11 -7
- package/addon/components/pix-checkbox.js +0 -14
- package/addon/components/pix-filterable-and-searchable-select.hbs +8 -8
- package/addon/components/pix-filterable-and-searchable-select.js +0 -8
- package/addon/components/pix-input-password.hbs +9 -14
- package/addon/components/pix-input.hbs +9 -14
- package/addon/components/pix-input.js +0 -8
- package/addon/components/pix-label.hbs +11 -0
- package/addon/components/pix-label.js +19 -0
- package/addon/components/pix-multi-select.hbs +9 -6
- package/addon/components/pix-radio-button.hbs +10 -7
- package/addon/components/pix-search-input.hbs +9 -4
- package/addon/components/pix-select.hbs +10 -12
- package/addon/components/pix-select.js +0 -3
- package/addon/components/pix-selectable-tag.hbs +3 -3
- package/addon/components/pix-selectable-tag.js +1 -5
- package/addon/components/pix-textarea.hbs +11 -12
- package/addon/components/pix-textarea.js +1 -22
- package/addon/components/pix-toggle.hbs +10 -3
- package/addon/components/pix-toggle.js +5 -6
- package/addon/styles/_pix-checkbox.scss +1 -18
- package/addon/styles/_pix-filterable-and-searchable-select.scss +0 -8
- package/addon/styles/_pix-input-code.scss +0 -4
- package/addon/styles/_pix-input-password.scss +0 -2
- package/addon/styles/_pix-input.scss +1 -11
- package/addon/styles/_pix-label.scss +35 -0
- package/addon/styles/_pix-multi-select.scss +1 -6
- package/addon/styles/_pix-radio-button.scss +1 -9
- package/addon/styles/_pix-search-input.scss +18 -30
- package/addon/styles/_pix-select.scss +1 -10
- package/addon/styles/_pix-textarea.scss +0 -4
- package/addon/styles/_pix-toggle.scss +0 -22
- package/addon/styles/addon.scss +1 -0
- package/addon/styles/component-state/_form.scss +5 -19
- package/addon/styles/pix-design-tokens/_typography.scss +17 -17
- package/app/components/pix-label.js +1 -0
- package/app/stories/pix-checkbox.mdx +0 -6
- package/app/stories/pix-checkbox.stories.js +18 -15
- package/app/stories/pix-filterable-and-searchable-select.stories.js +11 -0
- package/app/stories/pix-input-password.mdx +2 -4
- package/app/stories/pix-input-password.stories.js +10 -5
- package/app/stories/pix-input.mdx +3 -5
- package/app/stories/pix-input.stories.js +11 -6
- package/app/stories/pix-label.mdx +46 -0
- package/app/stories/pix-label.stories.js +102 -0
- package/app/stories/pix-multi-select.stories.js +11 -0
- package/app/stories/pix-radio-button.stories.js +40 -6
- package/app/stories/pix-search-input.mdx +9 -2
- package/app/stories/pix-search-input.stories.js +7 -7
- package/app/stories/pix-select.stories.js +11 -0
- package/app/stories/pix-textarea.stories.js +17 -0
- package/app/stories/pix-toggle.stories.js +17 -0
- package/package.json +6 -6
|
@@ -2,40 +2,28 @@
|
|
|
2
2
|
position: relative;
|
|
3
3
|
display: flex;
|
|
4
4
|
flex-direction: column;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
.pix-search-input__label {
|
|
8
|
-
margin-bottom: var(--pix-spacing-1x);
|
|
9
|
-
color: var(--pix-neutral-900);
|
|
10
|
-
font-size: 0.875rem;
|
|
11
|
-
}
|
|
12
5
|
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
&__input-container {
|
|
7
|
+
position: relative;
|
|
15
8
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
9
|
+
svg {
|
|
10
|
+
position: absolute;
|
|
11
|
+
bottom: calc(50% - 8px);
|
|
12
|
+
left: 12px;
|
|
13
|
+
width: 12px;
|
|
14
|
+
height: 12px;
|
|
15
|
+
padding: 2px;
|
|
16
|
+
color: var(--pix-neutral-500);
|
|
17
|
+
font-size: 0.6rem;
|
|
18
|
+
}
|
|
25
19
|
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.pix-search-input__input {
|
|
29
|
-
@extend %pix-form-element-state;
|
|
30
|
-
@extend %pix-input-default;
|
|
31
|
-
|
|
32
20
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
border: 1px solid var(--pix-neutral-500);
|
|
21
|
+
&__input {
|
|
22
|
+
@extend %pix-input-default;
|
|
23
|
+
@extend %pix-form-element-state;
|
|
37
24
|
|
|
38
|
-
|
|
39
|
-
|
|
25
|
+
width: 100%;
|
|
26
|
+
padding-left: var(--pix-spacing-10x) !important;
|
|
27
|
+
border: 1px solid var(--pix-neutral-500);
|
|
40
28
|
}
|
|
41
29
|
}
|
|
@@ -2,14 +2,6 @@
|
|
|
2
2
|
position: relative;
|
|
3
3
|
display: inline-block;
|
|
4
4
|
|
|
5
|
-
&__label {
|
|
6
|
-
@extend %pix-label;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
&__sub-label {
|
|
10
|
-
@extend %pix-sublabel;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
5
|
&__dropdown {
|
|
14
6
|
@extend %pix-shadow-sm;
|
|
15
7
|
|
|
@@ -93,8 +85,7 @@
|
|
|
93
85
|
align-items: center;
|
|
94
86
|
justify-content: space-between;
|
|
95
87
|
width: 100%;
|
|
96
|
-
|
|
97
|
-
padding: 0 var(--pix-spacing-4x) 0 var(--pix-spacing-4x);
|
|
88
|
+
padding: var(--pix-spacing-2x) var(--pix-spacing-3x);
|
|
98
89
|
color: var(--pix-neutral-900);
|
|
99
90
|
background-color: var(--pix-neutral-0);
|
|
100
91
|
border: 1px var(--pix-neutral-500) solid;
|
|
@@ -2,15 +2,8 @@
|
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
|
|
5
|
-
&__label {
|
|
6
|
-
color: var(--pix-neutral-900);
|
|
7
|
-
|
|
8
|
-
@extend %pix-body-m;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
5
|
&__button {
|
|
12
6
|
width: fit-content;
|
|
13
|
-
margin-top: var(--pix-spacing-1x);
|
|
14
7
|
padding: var(--pix-spacing-1x);
|
|
15
8
|
background-color: transparent;
|
|
16
9
|
border: 1px solid var(--pix-neutral-500);
|
|
@@ -32,21 +25,6 @@
|
|
|
32
25
|
background-color: var(--pix-neutral-800);
|
|
33
26
|
}
|
|
34
27
|
|
|
35
|
-
&--inline {
|
|
36
|
-
flex-direction: row;
|
|
37
|
-
gap: var(--pix-spacing-1x);
|
|
38
|
-
align-items: center;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
&--inline,
|
|
42
|
-
&--screen-reader-only {
|
|
43
|
-
.pix-toggle {
|
|
44
|
-
&__button {
|
|
45
|
-
margin-top: 0;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
28
|
&--pressed {
|
|
51
29
|
.pix-toggle {
|
|
52
30
|
&__on {
|
package/addon/styles/addon.scss
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
%pix-input-default {
|
|
2
2
|
@extend %pix-body-s;
|
|
3
3
|
|
|
4
|
-
padding:
|
|
4
|
+
padding: var(--pix-spacing-2x) var(--pix-spacing-3x);
|
|
5
5
|
color: var(--pix-neutral-900);
|
|
6
6
|
border-radius: var(--pix-spacing-1x);
|
|
7
7
|
}
|
|
@@ -22,6 +22,10 @@
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
%pix-form-element-state {
|
|
25
|
+
&::placeholder {
|
|
26
|
+
color: var(--pix-neutral-500);
|
|
27
|
+
}
|
|
28
|
+
|
|
25
29
|
&:hover {
|
|
26
30
|
background-color: var(--pix-neutral-20);
|
|
27
31
|
border-color: var(--pix-neutral-900);
|
|
@@ -57,24 +61,6 @@
|
|
|
57
61
|
}
|
|
58
62
|
}
|
|
59
63
|
|
|
60
|
-
%pix-label {
|
|
61
|
-
@extend %pix-body-s;
|
|
62
|
-
|
|
63
|
-
display: block;
|
|
64
|
-
margin-bottom: var(--pix-spacing-1x);
|
|
65
|
-
color: var(--pix-neutral-900);
|
|
66
|
-
font-weight: var(--pix-font-medium);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
%pix-sublabel {
|
|
70
|
-
@extend %pix-body-s;
|
|
71
|
-
|
|
72
|
-
display: block;
|
|
73
|
-
margin-bottom: var(--pix-spacing-1x);
|
|
74
|
-
color: var(--pix-neutral-500);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
64
|
// Only on StoryBook
|
|
79
65
|
.pix-form__label {
|
|
80
66
|
@extend %pix-body-m;
|
|
@@ -81,16 +81,21 @@
|
|
|
81
81
|
font-family: 'Roboto', 'Arial', sans-serif;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
%pix-body-
|
|
85
|
-
.pix-body-
|
|
84
|
+
%pix-body-xs,
|
|
85
|
+
.pix-body-xs {
|
|
86
86
|
@extend %-pix-body;
|
|
87
87
|
|
|
88
|
-
font-size:
|
|
88
|
+
font-size: 0.75rem;
|
|
89
89
|
line-height: 1.5;
|
|
90
|
+
letter-spacing: 0.02em;
|
|
91
|
+
}
|
|
90
92
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
93
|
+
%pix-body-s,
|
|
94
|
+
.pix-body-s {
|
|
95
|
+
@extend %-pix-body;
|
|
96
|
+
|
|
97
|
+
font-size: 0.875rem;
|
|
98
|
+
line-height: 1.5;
|
|
94
99
|
}
|
|
95
100
|
|
|
96
101
|
%pix-body-m,
|
|
@@ -105,21 +110,16 @@
|
|
|
105
110
|
}
|
|
106
111
|
}
|
|
107
112
|
|
|
108
|
-
%pix-body-
|
|
109
|
-
.pix-body-
|
|
113
|
+
%pix-body-l,
|
|
114
|
+
.pix-body-l {
|
|
110
115
|
@extend %-pix-body;
|
|
111
116
|
|
|
112
|
-
font-size:
|
|
117
|
+
font-size: 1rem;
|
|
113
118
|
line-height: 1.5;
|
|
114
|
-
}
|
|
115
119
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
font-size: 0.75rem;
|
|
121
|
-
line-height: 1.5;
|
|
122
|
-
letter-spacing: 0.02em;
|
|
120
|
+
@include device-is('tablet') {
|
|
121
|
+
font-size: 1.125rem;
|
|
122
|
+
}
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
.pix-body-weight-medium {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@1024pix/pix-ui/components/pix-label';
|
|
@@ -47,12 +47,6 @@ En ce sens, nous avons déjà prévu un espace vertical pour séparer 2 composan
|
|
|
47
47
|
<Story of={ComponentStories.checkboxWithSmallLabel} height={60} />
|
|
48
48
|
|
|
49
49
|
|
|
50
|
-
### Large
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
<Story of={ComponentStories.checkboxWithLargeLabel} height={60} />
|
|
54
|
-
|
|
55
|
-
|
|
56
50
|
## Usage
|
|
57
51
|
|
|
58
52
|
```html
|
|
@@ -28,6 +28,16 @@ export default {
|
|
|
28
28
|
defaultValue: { summary: false },
|
|
29
29
|
},
|
|
30
30
|
},
|
|
31
|
+
labelSize: {
|
|
32
|
+
name: 'labelSize',
|
|
33
|
+
description: 'Correspond à la taille de la police du label.',
|
|
34
|
+
type: { name: 'string', required: false },
|
|
35
|
+
table: {
|
|
36
|
+
defaultValue: { summary: 'default' },
|
|
37
|
+
},
|
|
38
|
+
control: { type: 'select' },
|
|
39
|
+
options: ['small', 'default'],
|
|
40
|
+
},
|
|
31
41
|
isIndeterminate: {
|
|
32
42
|
name: 'isIndeterminate',
|
|
33
43
|
description:
|
|
@@ -38,16 +48,6 @@ export default {
|
|
|
38
48
|
defaultValue: { summary: false },
|
|
39
49
|
},
|
|
40
50
|
},
|
|
41
|
-
labelSize: {
|
|
42
|
-
name: 'labelSize',
|
|
43
|
-
description: 'Correspond à la taille de la police du label.',
|
|
44
|
-
type: { name: 'string', required: false },
|
|
45
|
-
table: {
|
|
46
|
-
defaultValue: { summary: 'default' },
|
|
47
|
-
},
|
|
48
|
-
control: { type: 'select' },
|
|
49
|
-
options: ['small', 'default', 'large'],
|
|
50
|
-
},
|
|
51
51
|
checked: {
|
|
52
52
|
name: 'checked',
|
|
53
53
|
description: 'Permet de cocher la checkbox',
|
|
@@ -57,8 +57,8 @@ export default {
|
|
|
57
57
|
defaultValue: { summary: false },
|
|
58
58
|
},
|
|
59
59
|
},
|
|
60
|
-
|
|
61
|
-
name: '
|
|
60
|
+
isDisabled: {
|
|
61
|
+
name: 'isDisabled',
|
|
62
62
|
description: 'Permet de désactiver la checkbox',
|
|
63
63
|
type: { name: 'boolean', required: false },
|
|
64
64
|
table: {
|
|
@@ -78,7 +78,8 @@ export const Template = (args) => {
|
|
|
78
78
|
@isIndeterminate={{this.isIndeterminate}}
|
|
79
79
|
@labelSize={{this.labelSize}}
|
|
80
80
|
@checked={{this.checked}}
|
|
81
|
-
|
|
81
|
+
@isDisabled={{this.isDisabled}}
|
|
82
|
+
disabled={{this.isDisabled}}
|
|
82
83
|
>
|
|
83
84
|
{{this.label}}
|
|
84
85
|
</PixCheckbox>`,
|
|
@@ -147,7 +148,8 @@ export const MultipleTemplate = (args) => {
|
|
|
147
148
|
@isIndeterminate={{this.isIndeterminate}}
|
|
148
149
|
@labelSize={{this.labelSize}}
|
|
149
150
|
@checked={{this.checked}}
|
|
150
|
-
disabled={{this.
|
|
151
|
+
disabled={{this.isDisabled}}
|
|
152
|
+
@isDisabled={{this.isDisabled}}
|
|
151
153
|
>
|
|
152
154
|
{{this.label}}
|
|
153
155
|
</PixCheckbox>
|
|
@@ -158,7 +160,8 @@ export const MultipleTemplate = (args) => {
|
|
|
158
160
|
@isIndeterminate={{this.isIndeterminate}}
|
|
159
161
|
@labelSize={{this.labelSize}}
|
|
160
162
|
@checked={{this.checked}}
|
|
161
|
-
disabled={{this.
|
|
163
|
+
disabled={{this.isDisabled}}
|
|
164
|
+
@isDisabled={{this.isDisabled}}
|
|
162
165
|
>
|
|
163
166
|
{{this.label}}
|
|
164
167
|
</PixCheckbox>`,
|
|
@@ -20,6 +20,16 @@ export default {
|
|
|
20
20
|
type: { summary: 'string' },
|
|
21
21
|
},
|
|
22
22
|
},
|
|
23
|
+
labelSize: {
|
|
24
|
+
name: 'labelSize',
|
|
25
|
+
description: 'Correspond à la taille de la police du label.',
|
|
26
|
+
type: { name: 'string', required: false },
|
|
27
|
+
table: {
|
|
28
|
+
defaultValue: { summary: 'default' },
|
|
29
|
+
},
|
|
30
|
+
control: { type: 'select' },
|
|
31
|
+
options: ['small', 'large', 'default'],
|
|
32
|
+
},
|
|
23
33
|
options: {
|
|
24
34
|
name: 'options',
|
|
25
35
|
description:
|
|
@@ -142,6 +152,7 @@ const Template = (args) => {
|
|
|
142
152
|
template: hbs`<PixFilterableAndSearchableSelect
|
|
143
153
|
@label={{this.label}}
|
|
144
154
|
@subLabel={{this.subLabel}}
|
|
155
|
+
@labelSize={{this.labelSize}}
|
|
145
156
|
@screenReaderOnly={{this.screenReaderOnly}}
|
|
146
157
|
@placeholder={{this.placeholder}}
|
|
147
158
|
@hideDefaultOption={{this.hideDefaultOption}}
|
|
@@ -11,12 +11,10 @@ Champ pour le mot de passe, avec un `PixIconButton` pour l'afficher ou le masque
|
|
|
11
11
|
|
|
12
12
|
## Accessibilité
|
|
13
13
|
|
|
14
|
-
Si vous utilisez le `PixInputPassword` sans label
|
|
15
|
-
|
|
16
|
-
> Si vous renseignez les paramètres label et ariaLabel ensemble, ariaLabel sera nullifié.
|
|
14
|
+
Si vous utilisez le `PixInputPassword` sans vouloir afficher le label, il faudra renseigner `screenReaderOnly` à `true`.
|
|
17
15
|
|
|
18
16
|
```html
|
|
19
|
-
<PixInputPassword @
|
|
17
|
+
<PixInputPassword @label="{{label}}" @screenReaderOnly={{true}} @id="{{id}}" />
|
|
20
18
|
```
|
|
21
19
|
|
|
22
20
|
## Default
|
|
@@ -18,10 +18,15 @@ export default {
|
|
|
18
18
|
description: "Label de l'input. Requis si ariaLabel n'est pas définit.",
|
|
19
19
|
type: { name: 'string', required: true },
|
|
20
20
|
},
|
|
21
|
-
|
|
22
|
-
name: '
|
|
23
|
-
description:
|
|
24
|
-
type: { name: 'string', required:
|
|
21
|
+
labelSize: {
|
|
22
|
+
name: 'labelSize',
|
|
23
|
+
description: 'Correspond à la taille de la police du label.',
|
|
24
|
+
type: { name: 'string', required: false },
|
|
25
|
+
table: {
|
|
26
|
+
defaultValue: { summary: 'default' },
|
|
27
|
+
},
|
|
28
|
+
control: { type: 'select' },
|
|
29
|
+
options: ['small', 'large', 'default'],
|
|
25
30
|
},
|
|
26
31
|
information: {
|
|
27
32
|
name: 'information',
|
|
@@ -62,9 +67,9 @@ export default {
|
|
|
62
67
|
const Template = (args) => {
|
|
63
68
|
return {
|
|
64
69
|
template: hbs`<PixInputPassword
|
|
65
|
-
@ariaLabel={{this.ariaLabel}}
|
|
66
70
|
@id={{this.id}}
|
|
67
71
|
@label={{this.label}}
|
|
72
|
+
@labelSize={{this.labelSize}}
|
|
68
73
|
@information={{this.information}}
|
|
69
74
|
@errorMessage={{this.errorMessage}}
|
|
70
75
|
@prefix={{this.prefix}}
|
|
@@ -9,11 +9,9 @@ Le PixInput permet de créer un champ de texte.
|
|
|
9
9
|
|
|
10
10
|
## Accessibilité
|
|
11
11
|
|
|
12
|
-
Si vous utilisez le `PixInput` sans label
|
|
12
|
+
Si vous utilisez le `PixInput` sans vouloir afficher le label, il faudra renseigner `screenReaderOnly` à `true`. Il est possible d'ajouter un label en dehors du composant en précisant bien un attribut `for` correspondant à l'`@id` passé au PixInput.
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
Pour acceder à l'élément via son label/aria-label avec testing-library:
|
|
14
|
+
Pour acceder à l'élément via son label avec testing-library:
|
|
17
15
|
|
|
18
16
|
```html
|
|
19
17
|
<PixInput @id="firstName" @label="Prénom" />
|
|
@@ -23,7 +21,7 @@ Pour acceder à l'élément via son label/aria-label avec testing-library:
|
|
|
23
21
|
screen.getByLabelText('Prénom');
|
|
24
22
|
```
|
|
25
23
|
|
|
26
|
-
Si le paramètre @information est utilisé, il faudra concatener les valeurs de `@label
|
|
24
|
+
Si le paramètre @information est utilisé, il faudra concatener les valeurs de `@label` et `@information`
|
|
27
25
|
|
|
28
26
|
```html
|
|
29
27
|
<PixInput @id="firstName" @label="Prénom" @information="exemple: Barry" />
|
|
@@ -3,11 +3,6 @@ import { hbs } from 'ember-cli-htmlbars';
|
|
|
3
3
|
export default {
|
|
4
4
|
title: 'Form/Inputs/Input',
|
|
5
5
|
argTypes: {
|
|
6
|
-
ariaLabel: {
|
|
7
|
-
name: 'ariaLabel',
|
|
8
|
-
description: "L'action du champ, pour l'accessibilité. Requis si label n'est pas définit.",
|
|
9
|
-
type: { name: 'string', required: false },
|
|
10
|
-
},
|
|
11
6
|
id: {
|
|
12
7
|
name: 'id',
|
|
13
8
|
description: 'Identifiant du champ permettant de lui attacher un label',
|
|
@@ -51,6 +46,16 @@ export default {
|
|
|
51
46
|
type: { summary: 'string' },
|
|
52
47
|
},
|
|
53
48
|
},
|
|
49
|
+
labelSize: {
|
|
50
|
+
name: 'labelSize',
|
|
51
|
+
description: 'Correspond à la taille de la police du label.',
|
|
52
|
+
type: { name: 'string', required: false },
|
|
53
|
+
table: {
|
|
54
|
+
defaultValue: { summary: 'default' },
|
|
55
|
+
},
|
|
56
|
+
control: { type: 'select' },
|
|
57
|
+
options: ['small', 'large', 'default'],
|
|
58
|
+
},
|
|
54
59
|
},
|
|
55
60
|
};
|
|
56
61
|
|
|
@@ -63,8 +68,8 @@ const Template = (args) => {
|
|
|
63
68
|
@errorMessage={{this.errorMessage}}
|
|
64
69
|
placeholder='Jeanne, Pierre ...'
|
|
65
70
|
@requiredLabel={{this.requiredLabel}}
|
|
66
|
-
@ariaLabel={{this.ariaLabel}}
|
|
67
71
|
@validationStatus={{this.validationStatus}}
|
|
72
|
+
@labelSize={{this.labelSize}}
|
|
68
73
|
disabled={{this.disabled}}
|
|
69
74
|
readonly={{this.readonly}}
|
|
70
75
|
/>`,
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Meta, Story, ArgTypes } from '@storybook/blocks';
|
|
2
|
+
import * as ComponentStories from './pix-label.stories';
|
|
3
|
+
|
|
4
|
+
<Meta of={ComponentStories} />
|
|
5
|
+
|
|
6
|
+
# Pix Label
|
|
7
|
+
|
|
8
|
+
Le `PixLabel` permet de créer label pour un input donnée.
|
|
9
|
+
|
|
10
|
+
## Accessibilité
|
|
11
|
+
|
|
12
|
+
Cet élément ne s'utilise pas seul, il doit être accompagné d'un élément à identifier
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## Default
|
|
16
|
+
|
|
17
|
+
<Story of={ComponentStories.Default} height={100} />
|
|
18
|
+
|
|
19
|
+
## With label and information
|
|
20
|
+
|
|
21
|
+
<Story of={ComponentStories.withSubLabel} height={110} />
|
|
22
|
+
|
|
23
|
+
## With required label
|
|
24
|
+
|
|
25
|
+
<Story of={ComponentStories.withRequiredLabel} height={100} />
|
|
26
|
+
|
|
27
|
+
## Screen reader context
|
|
28
|
+
|
|
29
|
+
<Story of={ComponentStories.screenReaderOnlyLabel} height={100} />
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
```html
|
|
34
|
+
<PixLabel
|
|
35
|
+
@id="firstName"
|
|
36
|
+
@subLabel="Complément du label"
|
|
37
|
+
@requiredLabel="Champ obligatoire"
|
|
38
|
+
@screenReaderOnly=true
|
|
39
|
+
@inlineLabel=true>
|
|
40
|
+
Prénom
|
|
41
|
+
</PixLabel>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Arguments
|
|
45
|
+
|
|
46
|
+
<ArgTypes of={ComponentStories} />
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { hbs } from 'ember-cli-htmlbars';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Form/Label',
|
|
5
|
+
argTypes: {
|
|
6
|
+
for: {
|
|
7
|
+
name: 'for',
|
|
8
|
+
description: 'Identifiant du champ à rattacher au label',
|
|
9
|
+
type: { name: 'string', required: true },
|
|
10
|
+
},
|
|
11
|
+
label: {
|
|
12
|
+
name: 'label',
|
|
13
|
+
description: 'Le label du champ',
|
|
14
|
+
type: { name: 'string', required: true },
|
|
15
|
+
},
|
|
16
|
+
subLabel: {
|
|
17
|
+
name: 'subLabel',
|
|
18
|
+
description: 'Un descriptif complétant le label',
|
|
19
|
+
type: { name: 'string', required: false },
|
|
20
|
+
},
|
|
21
|
+
requiredLabel: {
|
|
22
|
+
name: 'requiredLabel',
|
|
23
|
+
description: 'Label indiquant que le champ est requis.',
|
|
24
|
+
type: { name: 'string', required: false },
|
|
25
|
+
table: {
|
|
26
|
+
type: { summary: 'string' },
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
screenReaderOnly: {
|
|
30
|
+
name: 'screenReaderOnly',
|
|
31
|
+
description: "Permet de rendre le label lisible uniquement par les lecteurs d'écran",
|
|
32
|
+
control: { type: 'boolean' },
|
|
33
|
+
type: { name: 'boolean', required: false },
|
|
34
|
+
table: {
|
|
35
|
+
type: { summary: 'boolean' },
|
|
36
|
+
defaultValue: { summary: false },
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
labelSize: {
|
|
40
|
+
name: 'labelSize',
|
|
41
|
+
description: 'Correspond à la taille de la police du label.',
|
|
42
|
+
type: { name: 'string', required: false },
|
|
43
|
+
table: {
|
|
44
|
+
defaultValue: { summary: 'default' },
|
|
45
|
+
},
|
|
46
|
+
control: { type: 'select' },
|
|
47
|
+
options: ['small', 'large', 'default'],
|
|
48
|
+
},
|
|
49
|
+
inlineLabel: {
|
|
50
|
+
name: 'inlineLabel',
|
|
51
|
+
description:
|
|
52
|
+
'Permet de ne pas afficher la marge pour les éléments de formulaire inline ( checkbox / radio )',
|
|
53
|
+
type: { name: 'boolean', required: false },
|
|
54
|
+
table: {
|
|
55
|
+
defaultValue: { summary: false },
|
|
56
|
+
},
|
|
57
|
+
control: { type: 'boolean' },
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const Template = (args) => {
|
|
63
|
+
return {
|
|
64
|
+
template: hbs`<PixLabel
|
|
65
|
+
@id={{this.id}}
|
|
66
|
+
@subLabel={{this.subLabel}}
|
|
67
|
+
@requiredLabel={{this.requiredLabel}}
|
|
68
|
+
@screenReaderOnly={{this.screenReaderOnly}}
|
|
69
|
+
@inlineLabel={{this.inlineLabel}}
|
|
70
|
+
>
|
|
71
|
+
{{this.label}}
|
|
72
|
+
</PixLabel>`,
|
|
73
|
+
context: args,
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export const Default = Template.bind({});
|
|
78
|
+
Default.args = {
|
|
79
|
+
id: 'first-name',
|
|
80
|
+
label: 'Prénom',
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export const withSubLabel = Template.bind({});
|
|
84
|
+
withSubLabel.args = {
|
|
85
|
+
id: 'first-name',
|
|
86
|
+
label: 'Prénom',
|
|
87
|
+
subLabel: 'a small information',
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export const withRequiredLabel = Template.bind({});
|
|
91
|
+
withRequiredLabel.args = {
|
|
92
|
+
id: 'first-name',
|
|
93
|
+
label: 'Prénom',
|
|
94
|
+
requiredLabel: 'Champ obligatoire',
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export const screenReaderOnlyLabel = Template.bind({});
|
|
98
|
+
screenReaderOnlyLabel.args = {
|
|
99
|
+
id: 'first-name',
|
|
100
|
+
label: 'Prénom',
|
|
101
|
+
screenReaderOnlyLabel: true,
|
|
102
|
+
};
|
|
@@ -19,6 +19,7 @@ export default {
|
|
|
19
19
|
@label={{this.label}}
|
|
20
20
|
@placeholder={{this.placeholder}}
|
|
21
21
|
@screenReaderOnly={{this.screenReaderOnly}}
|
|
22
|
+
@labelSize={{this.labelSize}}
|
|
22
23
|
@onChange={{this.onChange}}
|
|
23
24
|
@emptyMessage={{this.emptyMessage}}
|
|
24
25
|
@className={{this.className}}
|
|
@@ -49,6 +50,16 @@ export default {
|
|
|
49
50
|
"Donne un label au champ qui sera celui vocalisé par le lecteur d'écran. **⚠️ Le`label` est obligatoire que si l'`id` n'est pas donné. ⚠️**",
|
|
50
51
|
type: { name: 'string' },
|
|
51
52
|
},
|
|
53
|
+
labelSize: {
|
|
54
|
+
name: 'labelSize',
|
|
55
|
+
description: 'Correspond à la taille de la police du label.',
|
|
56
|
+
type: { name: 'string', required: false },
|
|
57
|
+
table: {
|
|
58
|
+
defaultValue: { summary: 'default' },
|
|
59
|
+
},
|
|
60
|
+
control: { type: 'select' },
|
|
61
|
+
options: ['small', 'large', 'default'],
|
|
62
|
+
},
|
|
52
63
|
screenReaderOnly: {
|
|
53
64
|
name: 'screenReaderOnly',
|
|
54
65
|
description: "Permet de cacher à l'écran le label tout en restant vocalisable",
|