@1024pix/pix-ui 20.2.3 → 22.0.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/.storybook/main.js +3 -0
- package/CHANGELOG.md +32 -0
- package/README.md +2 -2
- package/addon/components/pix-dropdown.hbs +3 -4
- package/addon/components/pix-filterable-and-searchable-select.hbs +45 -0
- package/addon/components/pix-filterable-and-searchable-select.js +48 -0
- package/addon/components/pix-multi-select.hbs +19 -23
- package/addon/components/pix-multi-select.js +26 -44
- package/addon/components/pix-pagination.hbs +2 -1
- package/addon/components/pix-select.hbs +133 -44
- package/addon/components/pix-select.js +134 -31
- package/addon/components/pix-stars.hbs +1 -1
- package/addon/components/pix-toggle.hbs +24 -0
- package/addon/components/pix-toggle.js +23 -0
- package/addon/styles/_form.scss +16 -3
- package/addon/styles/_pix-filterable-and-searchable-select.scss +57 -0
- package/addon/styles/_pix-multi-select.scss +15 -14
- package/addon/styles/_pix-select.scss +152 -45
- package/addon/styles/_pix-toggle.scss +63 -0
- package/addon/styles/addon.scss +4 -0
- package/app/components/pix-filterable-and-searchable-select.js +1 -0
- package/app/components/pix-toggle.js +1 -0
- package/app/modifiers/on-arrow-down-up-action.js +3 -3
- package/app/modifiers/on-enter-action.js +2 -2
- package/app/modifiers/on-space-action.js +20 -0
- package/app/stories/form.stories.js +86 -80
- package/app/stories/pix-background-header.stories.js +17 -9
- package/app/stories/pix-banner.stories.js +9 -10
- package/app/stories/pix-block.stories.js +3 -5
- package/app/stories/pix-button-link.stories.js +23 -27
- package/app/stories/pix-button-upload.stories.js +10 -12
- package/app/stories/pix-button.stories.js +30 -31
- package/app/stories/pix-checkbox.stories.js +9 -10
- package/app/stories/pix-collapsible.stories.js +22 -37
- package/app/stories/pix-dropdown.stories.js +17 -19
- package/app/stories/pix-filter-banner.stories.js +11 -8
- package/app/stories/pix-filterable-and-searchable-select.stories.js +212 -0
- package/app/stories/pix-filterable-and-searchable-select.stories.mdx +71 -0
- package/app/stories/pix-icon-button.stories.js +10 -12
- package/app/stories/pix-input-code.stories.js +7 -9
- package/app/stories/pix-input-password.stories.js +9 -11
- package/app/stories/pix-input.stories.js +9 -11
- package/app/stories/pix-message.stories.js +7 -8
- package/app/stories/pix-modal.stories.js +27 -20
- package/app/stories/pix-multi-select.stories.js +105 -81
- package/app/stories/pix-multi-select.stories.mdx +14 -9
- package/app/stories/pix-pagination.stories.js +6 -8
- package/app/stories/pix-progress-gauge.stories.js +16 -20
- package/app/stories/pix-radio-button.stories.js +2 -14
- package/app/stories/pix-return-to.stories.js +4 -8
- package/app/stories/pix-select.stories.js +235 -74
- package/app/stories/pix-select.stories.mdx +46 -20
- package/app/stories/pix-selectable-tag.stories.js +7 -38
- package/app/stories/pix-sidebar.stories.js +26 -19
- package/app/stories/pix-stars.stories.js +1 -8
- package/app/stories/pix-tag.stories.js +6 -10
- package/app/stories/pix-textarea.stories.js +7 -9
- package/app/stories/pix-toggle.stories.js +120 -0
- package/app/stories/pix-toggle.stories.mdx +38 -0
- package/app/stories/pix-tooltip.stories.js +41 -49
- package/package.json +60 -50
- package/.github/workflows/auto-merge.yml +0 -23
- package/.github/workflows/deploy-storybook.yml +0 -22
- package/.github/workflows/npm-publish.yml +0 -23
- package/.github/workflows/on-dev-merge.yml +0 -33
- package/.prettierignore +0 -1
|
@@ -1,6 +1,35 @@
|
|
|
1
1
|
import { hbs } from 'ember-cli-htmlbars';
|
|
2
2
|
import { action } from '@storybook/addon-actions';
|
|
3
3
|
|
|
4
|
+
const Template = (args) => ({
|
|
5
|
+
template: hbs`
|
|
6
|
+
<style>
|
|
7
|
+
.custom {
|
|
8
|
+
border : none;
|
|
9
|
+
}
|
|
10
|
+
</style>
|
|
11
|
+
<h4>⚠️ La sélection des éléments ne fonctionne pas dans Storybook.</h4>
|
|
12
|
+
{{#if this.id}}
|
|
13
|
+
<div>
|
|
14
|
+
<label for={{this.id}}>Un label en dehors du composant</label>
|
|
15
|
+
</div>
|
|
16
|
+
{{/if}}
|
|
17
|
+
<PixMultiSelect
|
|
18
|
+
@id={{this.id}}
|
|
19
|
+
@label={{this.label}}
|
|
20
|
+
@placeholder={{this.placeholder}}
|
|
21
|
+
@screenReaderOnly={{this.screenReaderOnly}}
|
|
22
|
+
@onChange={{this.onChange}}
|
|
23
|
+
@emptyMessage={{this.emptyMessage}}
|
|
24
|
+
@className={{this.className}}
|
|
25
|
+
@isSearchable={{this.isSearchable}}
|
|
26
|
+
@strictSearch={{this.strictSearch}}
|
|
27
|
+
@values={{this.values}}
|
|
28
|
+
@options={{this.options}} as |option|
|
|
29
|
+
>{{option.label}}</PixMultiSelect>
|
|
30
|
+
`,
|
|
31
|
+
context: args,
|
|
32
|
+
});
|
|
4
33
|
const DEFAULT_OPTIONS = [
|
|
5
34
|
{ label: 'ANETH HERBE AROMATIQUE', value: '1' },
|
|
6
35
|
{ label: 'ANIS VERT HERBE AROMATIQUE', value: '2' },
|
|
@@ -15,25 +44,30 @@ const DEFAULT_OPTIONS = [
|
|
|
15
44
|
{ label: 'CERFEUIL HERBE AROMATIQUE', value: '11' },
|
|
16
45
|
];
|
|
17
46
|
|
|
47
|
+
export const Default = Template.bind({});
|
|
48
|
+
Default.args = {
|
|
49
|
+
options: DEFAULT_OPTIONS,
|
|
50
|
+
onChange: action('onChange'),
|
|
51
|
+
placeholder: 'placeholder',
|
|
52
|
+
};
|
|
53
|
+
|
|
18
54
|
export const multiSelectWithChildComponent = (args) => {
|
|
19
55
|
return {
|
|
20
56
|
template: hbs`
|
|
21
57
|
<h4>⚠️ La sélection des éléments ne fonctionne pas dans Storybook.</h4>
|
|
22
58
|
<PixMultiSelect
|
|
23
|
-
@id={{this.id}}
|
|
24
59
|
@label={{this.label}}
|
|
25
|
-
@
|
|
60
|
+
@placeholder={{this.placeholder}}
|
|
26
61
|
@screenReaderOnly={{this.screenReaderOnly}}
|
|
27
|
-
|
|
28
|
-
@onSelect={{this.onSelect}}
|
|
62
|
+
@onChange={{this.onChange}}
|
|
29
63
|
@emptyMessage={{this.emptyMessage}}
|
|
30
|
-
|
|
31
|
-
@options={{this.options}} as |
|
|
64
|
+
@className={{this.className}}
|
|
65
|
+
@options={{this.options}} as |option|
|
|
32
66
|
>
|
|
33
67
|
<PixStars
|
|
34
|
-
@alt={{concat "Étoiles "
|
|
35
|
-
@count={{
|
|
36
|
-
@total={{
|
|
68
|
+
@alt={{concat "Étoiles " option.value " sur " option.total}}
|
|
69
|
+
@count={{option.value}}
|
|
70
|
+
@total={{option.total}}
|
|
37
71
|
/>
|
|
38
72
|
</PixMultiSelect>
|
|
39
73
|
`,
|
|
@@ -42,7 +76,7 @@ export const multiSelectWithChildComponent = (args) => {
|
|
|
42
76
|
};
|
|
43
77
|
|
|
44
78
|
multiSelectWithChildComponent.args = {
|
|
45
|
-
|
|
79
|
+
placeholder: 'Sélectionner le niveau souhaité',
|
|
46
80
|
label: 'Résultat évaluation',
|
|
47
81
|
options: [
|
|
48
82
|
{ value: '0', total: 3 },
|
|
@@ -52,70 +86,65 @@ multiSelectWithChildComponent.args = {
|
|
|
52
86
|
],
|
|
53
87
|
};
|
|
54
88
|
|
|
55
|
-
export const multiSelectSearchable = (
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
@id={{this.id}}
|
|
62
|
-
@label={{this.label}}
|
|
63
|
-
@screenReaderOnly={{this.screenReaderOnly}}
|
|
64
|
-
@innerText={{this.innerText}}
|
|
65
|
-
|
|
66
|
-
@isSearchable={{this.isSearchable}}
|
|
67
|
-
@strictSearch={{this.strictSearch}}
|
|
68
|
-
|
|
69
|
-
@onSelect={{this.doSomething}}
|
|
70
|
-
@selected={{this.selected}}
|
|
71
|
-
|
|
72
|
-
@emptyMessage={{this.emptyMessage}}
|
|
73
|
-
@options={{this.options}} as |option|
|
|
74
|
-
>
|
|
75
|
-
{{option.label}}
|
|
76
|
-
</PixMultiSelect>
|
|
77
|
-
`,
|
|
78
|
-
context: args,
|
|
79
|
-
};
|
|
89
|
+
export const multiSelectSearchable = Template.bind({});
|
|
90
|
+
multiSelectSearchable.args = {
|
|
91
|
+
...Default.args,
|
|
92
|
+
isSearchable: true,
|
|
93
|
+
strictSearch: true,
|
|
94
|
+
emptyMessage: 'Aucune option trouvée',
|
|
80
95
|
};
|
|
81
96
|
|
|
82
|
-
export const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
style="width:350px"
|
|
89
|
-
@id={{this.id}}
|
|
90
|
-
@label={{this.label}}
|
|
91
|
-
@screenReaderOnly={{this.screenReaderOnly}}
|
|
92
|
-
@innerText={{this.innerText}}
|
|
97
|
+
export const multiSelectWithCustomClass = Template.bind({});
|
|
98
|
+
multiSelectWithCustomClass.args = {
|
|
99
|
+
...Default.args,
|
|
100
|
+
className: 'custom',
|
|
101
|
+
isSearchable: false,
|
|
102
|
+
};
|
|
93
103
|
|
|
94
|
-
|
|
95
|
-
|
|
104
|
+
export const multiSelectWithId = Template.bind({});
|
|
105
|
+
multiSelectWithId.args = {
|
|
106
|
+
...Default.args,
|
|
107
|
+
label: undefined,
|
|
108
|
+
id: 'custom',
|
|
109
|
+
isSearchable: false,
|
|
110
|
+
};
|
|
96
111
|
|
|
97
|
-
|
|
98
|
-
|
|
112
|
+
const TemplateWithYield = (args) => ({
|
|
113
|
+
template: hbs`
|
|
114
|
+
<PixMultiSelect
|
|
115
|
+
@id={{this.id}}
|
|
116
|
+
@label={{this.label}}
|
|
117
|
+
@screenReaderOnly={{this.screenReaderOnly}}
|
|
118
|
+
@onChange={{this.onChange}}
|
|
119
|
+
@emptyMessage={{this.emptyMessage}}
|
|
120
|
+
@className={{this.className}}
|
|
121
|
+
@isSearchable={{this.isSearchable}}
|
|
122
|
+
@strictSearch={{this.strictSearch}}
|
|
123
|
+
@values={{this.values}}
|
|
124
|
+
@options={{this.options}}
|
|
125
|
+
>
|
|
126
|
+
<:placeholder>filtres (2)</:placeholder>
|
|
127
|
+
<:default as |option|>{{option.label}}</:default>
|
|
128
|
+
</PixMultiSelect>
|
|
129
|
+
`,
|
|
130
|
+
context: args,
|
|
131
|
+
});
|
|
99
132
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
`,
|
|
106
|
-
context: args,
|
|
107
|
-
};
|
|
133
|
+
export const multiSelectWithYield = TemplateWithYield.bind({});
|
|
134
|
+
multiSelectWithYield.args = {
|
|
135
|
+
...Default.args,
|
|
136
|
+
placeholder: undefined,
|
|
137
|
+
isSearchable: false,
|
|
108
138
|
};
|
|
109
139
|
|
|
110
140
|
export const argTypes = {
|
|
111
141
|
id: {
|
|
112
142
|
name: 'id',
|
|
113
143
|
description: 'Permet l‘accessibilité du composant attribuant des ``for`` pour chaque entité',
|
|
114
|
-
type: { name: 'string'
|
|
115
|
-
defaultValue: 'aromate',
|
|
144
|
+
type: { name: 'string' },
|
|
116
145
|
},
|
|
117
|
-
|
|
118
|
-
name: '
|
|
146
|
+
placeholder: {
|
|
147
|
+
name: 'placeholder',
|
|
119
148
|
description:
|
|
120
149
|
'Rempli le contenu interne du composant, `placeholder` pour `isSearchable` `true`, sinon rawContent du `button`',
|
|
121
150
|
type: { name: 'string', required: true },
|
|
@@ -124,7 +153,7 @@ export const argTypes = {
|
|
|
124
153
|
label: {
|
|
125
154
|
name: 'label',
|
|
126
155
|
description: "Donne un label au champ qui sera celui vocalisé par le lecteur d'écran",
|
|
127
|
-
type: { name: 'string'
|
|
156
|
+
type: { name: 'string' },
|
|
128
157
|
defaultValue: 'Label du champ',
|
|
129
158
|
},
|
|
130
159
|
screenReaderOnly: {
|
|
@@ -147,27 +176,14 @@ export const argTypes = {
|
|
|
147
176
|
type: { name: 'array', required: false },
|
|
148
177
|
defaultValue: DEFAULT_OPTIONS,
|
|
149
178
|
},
|
|
150
|
-
|
|
151
|
-
name: '
|
|
152
|
-
description:
|
|
153
|
-
'Charge de manière asynchrone les options. Doit renvoyer une promesse avec la liste des options. Les options sont représentées par un tableau d‘objet contenant les propriétés ``value`` et ``label``. ``value`` doit être de type ``String`` pour être conforme au traitement des input value.',
|
|
154
|
-
type: { required: false },
|
|
155
|
-
},
|
|
156
|
-
loadingMessage: {
|
|
157
|
-
name: 'loadingMessage',
|
|
158
|
-
description:
|
|
159
|
-
"Message qui apparaît dans les options quand celles-ci sont en train d'être chargées via onLoadOptions",
|
|
160
|
-
type: { name: 'string', required: false },
|
|
161
|
-
defaultValue: 'Chargement...',
|
|
162
|
-
},
|
|
163
|
-
onSelect: {
|
|
164
|
-
name: 'onSelect',
|
|
179
|
+
onChange: {
|
|
180
|
+
name: 'onChange',
|
|
165
181
|
description: "Une fonction permettant d'effectuer une action à chaque sélection",
|
|
166
182
|
type: { required: true },
|
|
167
|
-
defaultValue: action('
|
|
183
|
+
defaultValue: action('onChange'),
|
|
168
184
|
},
|
|
169
|
-
|
|
170
|
-
name: '
|
|
185
|
+
values: {
|
|
186
|
+
name: 'values',
|
|
171
187
|
description: 'Une pré-sélection peut être donnée au composant',
|
|
172
188
|
type: { name: 'array', required: false },
|
|
173
189
|
defaultValue: ['1', '4'],
|
|
@@ -185,4 +201,12 @@ export const argTypes = {
|
|
|
185
201
|
type: { name: 'boolean', required: false },
|
|
186
202
|
defaultValue: false,
|
|
187
203
|
},
|
|
204
|
+
className: {
|
|
205
|
+
name: 'className',
|
|
206
|
+
description: 'Cette classe css permet de surcharger le css par défaut du composant.',
|
|
207
|
+
type: { name: 'string', required: false },
|
|
208
|
+
table: {
|
|
209
|
+
type: { summary: 'string' },
|
|
210
|
+
},
|
|
211
|
+
},
|
|
188
212
|
};
|
|
@@ -25,15 +25,19 @@ L'ajout de ``class`` et d'autres attributs comme ``aria-label`` sont possibles.
|
|
|
25
25
|
<Story name="Searchable" story={stories.multiSelectSearchable} height={330}/>
|
|
26
26
|
</Canvas>
|
|
27
27
|
|
|
28
|
-
##
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
## withCustomClass
|
|
29
|
+
<Canvas>
|
|
30
|
+
<Story name="withCustomClass" story={stories.multiSelectWithCustomClass} height={330}/>
|
|
31
|
+
</Canvas>
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
## withId
|
|
34
|
+
<Canvas>
|
|
35
|
+
<Story name="withId" story={stories.multiSelectWithId} height={330}/>
|
|
36
|
+
</Canvas>
|
|
34
37
|
|
|
38
|
+
## withYield
|
|
35
39
|
<Canvas>
|
|
36
|
-
<Story name="
|
|
40
|
+
<Story name="withYield" story={stories.multiSelectWithYield} height={330}/>
|
|
37
41
|
</Canvas>
|
|
38
42
|
|
|
39
43
|
## Usage
|
|
@@ -43,11 +47,12 @@ Il est possible de donner un message via `loadingMessage` à afficher à la plac
|
|
|
43
47
|
@id={{id}}
|
|
44
48
|
@label={{label}}
|
|
45
49
|
@screenReaderOnly={{screenReaderOnly}}
|
|
46
|
-
@
|
|
50
|
+
@placeholder={{placeholder}}
|
|
47
51
|
|
|
48
|
-
@
|
|
49
|
-
@
|
|
52
|
+
@onChange={{doSomething}}
|
|
53
|
+
@values={{values}}
|
|
50
54
|
@emptyMessage={{emptyMessage}}
|
|
55
|
+
@className={{className}}
|
|
51
56
|
@options={{options}} as |option|>
|
|
52
57
|
{{option.label}}
|
|
53
58
|
</PixMultiSelect>
|
|
@@ -2,14 +2,12 @@ import { hbs } from 'ember-cli-htmlbars';
|
|
|
2
2
|
|
|
3
3
|
export const Template = (args) => {
|
|
4
4
|
return {
|
|
5
|
-
template: hbs
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
/>
|
|
12
|
-
`,
|
|
5
|
+
template: hbs`<PixPagination
|
|
6
|
+
@pagination={{pagination}}
|
|
7
|
+
@locale={{locale}}
|
|
8
|
+
@pageOptions={{pageOptions}}
|
|
9
|
+
@isCondensed={{isCondensed}}
|
|
10
|
+
/>`,
|
|
13
11
|
context: args,
|
|
14
12
|
};
|
|
15
13
|
};
|
|
@@ -2,15 +2,13 @@ import { hbs } from 'ember-cli-htmlbars';
|
|
|
2
2
|
|
|
3
3
|
export const Default = (args) => {
|
|
4
4
|
return {
|
|
5
|
-
template: hbs
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
/>
|
|
13
|
-
`,
|
|
5
|
+
template: hbs`<PixProgressGauge
|
|
6
|
+
@value={{value}}
|
|
7
|
+
@color={{color}}
|
|
8
|
+
@isArrowLeft={{isArrowLeft}}
|
|
9
|
+
@subtitle={{subtitle}}
|
|
10
|
+
@tooltipText={{tooltipText}}
|
|
11
|
+
/>`,
|
|
14
12
|
context: args,
|
|
15
13
|
};
|
|
16
14
|
};
|
|
@@ -20,17 +18,15 @@ Default.args = {
|
|
|
20
18
|
|
|
21
19
|
export const whiteProgressGauge = (args) => {
|
|
22
20
|
return {
|
|
23
|
-
template: hbs
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
</section>
|
|
33
|
-
`,
|
|
21
|
+
template: hbs`<section style='width: 100%; padding: 35px 35px 5px;background-color: lightgray'>
|
|
22
|
+
<PixProgressGauge
|
|
23
|
+
@value={{value}}
|
|
24
|
+
@color={{color}}
|
|
25
|
+
@isArrowLeft={{isArrowLeft}}
|
|
26
|
+
@subtitle={{subtitle}}
|
|
27
|
+
@tooltipText={{tooltipText}}
|
|
28
|
+
/>
|
|
29
|
+
</section>`,
|
|
34
30
|
context: args,
|
|
35
31
|
};
|
|
36
32
|
};
|
|
@@ -2,13 +2,7 @@ import { hbs } from 'ember-cli-htmlbars';
|
|
|
2
2
|
|
|
3
3
|
const Template = (args) => {
|
|
4
4
|
return {
|
|
5
|
-
template: hbs
|
|
6
|
-
<PixRadioButton
|
|
7
|
-
@label={{label}}
|
|
8
|
-
@value={{value}}
|
|
9
|
-
@isDisabled={{isDisabled}}
|
|
10
|
-
/>
|
|
11
|
-
`,
|
|
5
|
+
template: hbs`<PixRadioButton @label={{label}} @value={{value}} @isDisabled={{isDisabled}} />`,
|
|
12
6
|
context: args,
|
|
13
7
|
};
|
|
14
8
|
};
|
|
@@ -26,13 +20,7 @@ isDisabled.args = {
|
|
|
26
20
|
|
|
27
21
|
const checked = (args) => {
|
|
28
22
|
return {
|
|
29
|
-
template: hbs
|
|
30
|
-
<PixRadioButton
|
|
31
|
-
@label={{label}}
|
|
32
|
-
@isDisabled={{isDisabled}}
|
|
33
|
-
checked
|
|
34
|
-
/>
|
|
35
|
-
`,
|
|
23
|
+
template: hbs`<PixRadioButton @label={{label}} @isDisabled={{isDisabled}} checked />`,
|
|
36
24
|
context: args,
|
|
37
25
|
};
|
|
38
26
|
};
|
|
@@ -2,9 +2,7 @@ import { hbs } from 'ember-cli-htmlbars';
|
|
|
2
2
|
|
|
3
3
|
export const returnTo = (args) => {
|
|
4
4
|
return {
|
|
5
|
-
template: hbs
|
|
6
|
-
<PixReturnTo @route='profile' @shade={{shade}} />
|
|
7
|
-
`,
|
|
5
|
+
template: hbs`<PixReturnTo @route='profile' @shade={{shade}} />`,
|
|
8
6
|
context: args,
|
|
9
7
|
};
|
|
10
8
|
};
|
|
@@ -14,11 +12,9 @@ returnTo.args = {
|
|
|
14
12
|
|
|
15
13
|
export const returnToWithText = (args) => {
|
|
16
14
|
return {
|
|
17
|
-
template: hbs
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
</PixReturnTo>
|
|
21
|
-
`,
|
|
15
|
+
template: hbs`<PixReturnTo @route='profile' @shade={{shade}}>
|
|
16
|
+
Retour vers mon profil
|
|
17
|
+
</PixReturnTo>`,
|
|
22
18
|
context: args,
|
|
23
19
|
};
|
|
24
20
|
};
|