@1024pix/pix-ui 13.2.0 → 13.3.0
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/CHANGELOG.md +6 -0
- package/addon/components/pix-dropdown.hbs +25 -8
- package/addon/styles/_form.scss +7 -0
- package/addon/styles/_pix-dropdown.scss +11 -4
- package/addon/styles/_reset-css.scss +0 -6
- package/app/stories/pix-dropdown.stories.js +11 -0
- package/app/stories/pix-dropdown.stories.mdx +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
<div class="pix-dropdown">
|
|
2
|
+
|
|
2
3
|
{{#if this.label}}
|
|
3
|
-
<label id={{@id}} class="pix-dropdown__label">
|
|
4
|
+
<label id={{@id}} class="pix-dropdown__label">
|
|
5
|
+
{{#if @requiredLabel}}
|
|
6
|
+
<abbr title={{@requiredLabel}} class="mandatory-mark" aria-hidden="true">*</abbr>
|
|
7
|
+
{{/if}}
|
|
8
|
+
{{this.label}}
|
|
9
|
+
</label>
|
|
4
10
|
{{/if}}
|
|
11
|
+
|
|
5
12
|
<div class="pix-dropdown__controller">
|
|
6
13
|
<button
|
|
7
14
|
type="button"
|
|
@@ -9,15 +16,16 @@
|
|
|
9
16
|
aria-label={{if this.isExpanded @collapseLabel @expandLabel}}
|
|
10
17
|
{{on "click" this.toggleDropdown}}
|
|
11
18
|
{{on "keyup" this.navigateThroughOptions}}
|
|
19
|
+
...attributes
|
|
12
20
|
>
|
|
13
21
|
<p
|
|
14
22
|
title={{this.placeholder}}
|
|
15
|
-
class="pix-dropdown__controller--placeholder-text
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}}"
|
|
23
|
+
class="pix-dropdown__controller--placeholder-text
|
|
24
|
+
{{unless this.hasSelectedOption ' default'}}"
|
|
25
|
+
aria-required={{if this.requiredLabel true false}}
|
|
19
26
|
>{{this.placeholder}}</p>
|
|
20
27
|
</button>
|
|
28
|
+
|
|
21
29
|
{{#if this.hasSelectedOption}}
|
|
22
30
|
<button
|
|
23
31
|
type="button"
|
|
@@ -28,11 +36,17 @@
|
|
|
28
36
|
<FaIcon @icon="times" />
|
|
29
37
|
</button>
|
|
30
38
|
{{/if}}
|
|
31
|
-
|
|
39
|
+
|
|
40
|
+
<button
|
|
41
|
+
tabindex="-1"
|
|
42
|
+
type="button"
|
|
32
43
|
class="pix-dropdown__controller--chevron"
|
|
33
|
-
|
|
34
|
-
|
|
44
|
+
{{on "click" this.toggleDropdown}}
|
|
45
|
+
>
|
|
46
|
+
<FaIcon @icon={{if this.isExpanded "chevron-up" "chevron-down"}} />
|
|
47
|
+
</button>
|
|
35
48
|
</div>
|
|
49
|
+
|
|
36
50
|
<div
|
|
37
51
|
role="listbox"
|
|
38
52
|
id={{this.menuId}}
|
|
@@ -45,6 +59,7 @@
|
|
|
45
59
|
{{on "keyup" this.navigateThroughOptions}}
|
|
46
60
|
{{on "scroll" this.incrementPage}}
|
|
47
61
|
>
|
|
62
|
+
|
|
48
63
|
{{#if @isSearchable}}
|
|
49
64
|
<div class="pix-dropdown__menu--search">
|
|
50
65
|
<FaIcon class="pix-dropdown__menu--search-icon" @icon="search" />
|
|
@@ -62,6 +77,7 @@
|
|
|
62
77
|
/>
|
|
63
78
|
</div>
|
|
64
79
|
{{/if}}
|
|
80
|
+
|
|
65
81
|
{{#each this.options as |opt index|}}
|
|
66
82
|
{{#if (lt index this.showLimit)}}
|
|
67
83
|
<div
|
|
@@ -82,4 +98,5 @@
|
|
|
82
98
|
{{/if}}
|
|
83
99
|
{{/each}}
|
|
84
100
|
</div>
|
|
101
|
+
|
|
85
102
|
</div>
|
package/addon/styles/_form.scss
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
position: relative;
|
|
5
5
|
|
|
6
6
|
button {
|
|
7
|
-
background: transparent;
|
|
8
7
|
margin: 0;
|
|
9
8
|
text-align: left;
|
|
10
9
|
cursor: pointer;
|
|
@@ -27,7 +26,7 @@
|
|
|
27
26
|
border: 1px solid $grey-40;
|
|
28
27
|
border-radius: $spacing-xxs;
|
|
29
28
|
padding: 0;
|
|
30
|
-
background: white;
|
|
29
|
+
background: $white;
|
|
31
30
|
|
|
32
31
|
&.expanded {
|
|
33
32
|
border-bottom-left-radius: 0;
|
|
@@ -50,6 +49,7 @@
|
|
|
50
49
|
}
|
|
51
50
|
|
|
52
51
|
&--clear {
|
|
52
|
+
background: transparent;
|
|
53
53
|
font-size: 1rem;
|
|
54
54
|
color: $grey-50;
|
|
55
55
|
position: absolute;
|
|
@@ -66,11 +66,18 @@
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
&--chevron {
|
|
69
|
+
background: transparent;
|
|
70
|
+
border: none;
|
|
71
|
+
padding: 0;
|
|
69
72
|
position: absolute;
|
|
70
|
-
|
|
71
|
-
top: 9px;
|
|
73
|
+
top: 9.5px;
|
|
72
74
|
right: 12px;
|
|
73
75
|
color: $grey-50;
|
|
76
|
+
font-size: 1rem;
|
|
77
|
+
|
|
78
|
+
&:hover {
|
|
79
|
+
color: $grey-70;
|
|
80
|
+
}
|
|
74
81
|
}
|
|
75
82
|
}
|
|
76
83
|
|
|
@@ -18,6 +18,7 @@ export const Template = (args) => {
|
|
|
18
18
|
@expandLabel={{expandLabel}}
|
|
19
19
|
@collapseLabel={{collapseLabel}}
|
|
20
20
|
@pageSize={{pageSize}}
|
|
21
|
+
@requiredLabel={{requiredLabel}}
|
|
21
22
|
/>
|
|
22
23
|
</div>
|
|
23
24
|
`,
|
|
@@ -54,6 +55,7 @@ withLabel.args = {
|
|
|
54
55
|
...Default.args,
|
|
55
56
|
id: 'dropdown-with-label',
|
|
56
57
|
label: 'Ton fruit préféré: ',
|
|
58
|
+
requiredLabel: 'Champ requis',
|
|
57
59
|
};
|
|
58
60
|
|
|
59
61
|
export const searchableDropdown = Template.bind({});
|
|
@@ -137,6 +139,15 @@ export const argTypes = {
|
|
|
137
139
|
type: { summary: 'string' },
|
|
138
140
|
},
|
|
139
141
|
},
|
|
142
|
+
requiredLabel: {
|
|
143
|
+
name: 'requiredLabel',
|
|
144
|
+
description:
|
|
145
|
+
'Label indiquant que le champ est requis, le paramètre @label devient obligatoire avec ce paramètre.',
|
|
146
|
+
type: { name: 'string', required: false },
|
|
147
|
+
table: {
|
|
148
|
+
type: { summary: 'string' },
|
|
149
|
+
},
|
|
150
|
+
},
|
|
140
151
|
id: {
|
|
141
152
|
name: 'id',
|
|
142
153
|
description: "L'id du label",
|
|
@@ -57,6 +57,7 @@ Les options sont représentées par un tableau d'objet contenant les propriété
|
|
|
57
57
|
@placeholder="Choisissez une option"
|
|
58
58
|
@searchPlaceholder="Rechercher"
|
|
59
59
|
@label="Mon menu déroulant"
|
|
60
|
+
@requiredLabel="Requis"
|
|
60
61
|
@clearLabel="Supprimer la sélection"
|
|
61
62
|
@expandLabel="Ouvrir le menu déroulant"
|
|
62
63
|
@collapseLabel="Réduire le menu déroulant"
|