@1024pix/pix-ui 11.1.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/.buildpacks +2 -0
- package/.circleci/config.yml +22 -0
- package/.gitattributes +7 -0
- package/.github/workflows/auto-merge.yml +26 -0
- package/.github/workflows/deploy-storybook.yml +21 -0
- package/.github/workflows/npm-publish.yml +23 -0
- package/.github/workflows/on-dev-merge.yml +33 -0
- package/.nvmrc +1 -0
- package/.prettierignore +1 -0
- package/.prettierrc.json +12 -0
- package/.storybook/fonts.css +1 -0
- package/.storybook/main.js +10 -0
- package/.storybook/manager.js +6 -0
- package/.storybook/preview.js +37 -0
- package/.storybook/storybook-custom-theme.js +37 -0
- package/CHANGELOG.md +469 -0
- package/CNAME +1 -0
- package/LICENSE.md +9 -0
- package/README.md +58 -0
- package/addon/components/pix-background-header.hbs +7 -0
- package/addon/components/pix-background-header.js +5 -0
- package/addon/components/pix-banner.hbs +16 -0
- package/addon/components/pix-banner.js +43 -0
- package/addon/components/pix-block.hbs +5 -0
- package/addon/components/pix-block.js +11 -0
- package/addon/components/pix-button-base.js +27 -0
- package/addon/components/pix-button-link.hbs +16 -0
- package/addon/components/pix-button-link.js +10 -0
- package/addon/components/pix-button-upload.hbs +11 -0
- package/addon/components/pix-button-upload.js +20 -0
- package/addon/components/pix-button.hbs +43 -0
- package/addon/components/pix-button.js +54 -0
- package/addon/components/pix-collapsible.hbs +29 -0
- package/addon/components/pix-collapsible.js +27 -0
- package/addon/components/pix-filter-banner.hbs +28 -0
- package/addon/components/pix-filter-banner.js +13 -0
- package/addon/components/pix-icon-button.hbs +11 -0
- package/addon/components/pix-icon-button.js +33 -0
- package/addon/components/pix-input-code.hbs +24 -0
- package/addon/components/pix-input-code.js +133 -0
- package/addon/components/pix-input-password.hbs +43 -0
- package/addon/components/pix-input-password.js +34 -0
- package/addon/components/pix-input.hbs +30 -0
- package/addon/components/pix-input.js +26 -0
- package/addon/components/pix-message.hbs +8 -0
- package/addon/components/pix-message.js +30 -0
- package/addon/components/pix-multi-select.hbs +70 -0
- package/addon/components/pix-multi-select.js +162 -0
- package/addon/components/pix-progress-gauge.hbs +19 -0
- package/addon/components/pix-progress-gauge.js +29 -0
- package/addon/components/pix-radio-button.hbs +12 -0
- package/addon/components/pix-radio-button.js +5 -0
- package/addon/components/pix-return-to.hbs +15 -0
- package/addon/components/pix-return-to.js +20 -0
- package/addon/components/pix-select.hbs +55 -0
- package/addon/components/pix-select.js +58 -0
- package/addon/components/pix-selectable-tag.hbs +10 -0
- package/addon/components/pix-selectable-tag.js +13 -0
- package/addon/components/pix-stars.hbs +16 -0
- package/addon/components/pix-stars.js +27 -0
- package/addon/components/pix-tag.hbs +3 -0
- package/addon/components/pix-tag.js +11 -0
- package/addon/components/pix-textarea.hbs +21 -0
- package/addon/components/pix-textarea.js +17 -0
- package/addon/components/pix-tooltip-deprecated.hbs +18 -0
- package/addon/components/pix-tooltip-deprecated.js +26 -0
- package/addon/components/pix-tooltip.hbs +18 -0
- package/addon/components/pix-tooltip.js +17 -0
- package/addon/styles/_breakpoints.scss +17 -0
- package/addon/styles/_colors.scss +87 -0
- package/addon/styles/_fonts.scss +10 -0
- package/addon/styles/_form.scss +68 -0
- package/addon/styles/_pix-background-header.scss +20 -0
- package/addon/styles/_pix-banner.scss +67 -0
- package/addon/styles/_pix-block.scss +29 -0
- package/addon/styles/_pix-button-base.scss +137 -0
- package/addon/styles/_pix-button-link.scss +4 -0
- package/addon/styles/_pix-button-upload.scss +5 -0
- package/addon/styles/_pix-button.scss +40 -0
- package/addon/styles/_pix-collapsible.scss +82 -0
- package/addon/styles/_pix-filter-banner.scss +74 -0
- package/addon/styles/_pix-icon-button.scss +60 -0
- package/addon/styles/_pix-input-code.scss +71 -0
- package/addon/styles/_pix-input-password.scss +68 -0
- package/addon/styles/_pix-input.scss +93 -0
- package/addon/styles/_pix-message.scss +35 -0
- package/addon/styles/_pix-multi-select.scss +182 -0
- package/addon/styles/_pix-progress-gauge.scss +119 -0
- package/addon/styles/_pix-radio-button.scss +72 -0
- package/addon/styles/_pix-return-to.scss +64 -0
- package/addon/styles/_pix-select.scss +71 -0
- package/addon/styles/_pix-selectable-tag.scss +86 -0
- package/addon/styles/_pix-stars.scss +43 -0
- package/addon/styles/_pix-tag.scss +69 -0
- package/addon/styles/_pix-textarea.scss +39 -0
- package/addon/styles/_pix-tooltip.scss +196 -0
- package/addon/styles/_reset-css.scss +36 -0
- package/addon/styles/_spacing.scss +9 -0
- package/addon/styles/addon.scss +41 -0
- package/app/components/pix-background-header.js +1 -0
- package/app/components/pix-banner.js +1 -0
- package/app/components/pix-block.js +1 -0
- package/app/components/pix-button-link.js +1 -0
- package/app/components/pix-button-upload.js +1 -0
- package/app/components/pix-button.js +1 -0
- package/app/components/pix-collapsible.js +1 -0
- package/app/components/pix-filter-banner.js +1 -0
- package/app/components/pix-icon-button.js +1 -0
- package/app/components/pix-input-code.js +1 -0
- package/app/components/pix-input-password.js +1 -0
- package/app/components/pix-input.js +1 -0
- package/app/components/pix-message.js +1 -0
- package/app/components/pix-multi-select.js +1 -0
- package/app/components/pix-progress-gauge.js +1 -0
- package/app/components/pix-radio-button.js +1 -0
- package/app/components/pix-return-to.js +1 -0
- package/app/components/pix-select.js +1 -0
- package/app/components/pix-selectable-tag.js +1 -0
- package/app/components/pix-stars.js +1 -0
- package/app/components/pix-tag.js +1 -0
- package/app/components/pix-textarea.js +1 -0
- package/app/components/pix-tooltip-deprecated.js +1 -0
- package/app/components/pix-tooltip.js +1 -0
- package/app/stories/form.stories.js +91 -0
- package/app/stories/form.stories.mdx +16 -0
- package/app/stories/pix-background-header.stories.js +19 -0
- package/app/stories/pix-background-header.stories.mdx +36 -0
- package/app/stories/pix-banner.stories.js +89 -0
- package/app/stories/pix-banner.stories.mdx +107 -0
- package/app/stories/pix-block.stories.js +20 -0
- package/app/stories/pix-block.stories.mdx +44 -0
- package/app/stories/pix-button-link.stories.js +125 -0
- package/app/stories/pix-button-link.stories.mdx +57 -0
- package/app/stories/pix-button-upload.stories.js +85 -0
- package/app/stories/pix-button-upload.stories.mdx +39 -0
- package/app/stories/pix-button.stories.js +253 -0
- package/app/stories/pix-button.stories.mdx +99 -0
- package/app/stories/pix-collapsible.stories.js +56 -0
- package/app/stories/pix-collapsible.stories.mdx +39 -0
- package/app/stories/pix-filter-banner.stories.js +51 -0
- package/app/stories/pix-filter-banner.stories.mdx +33 -0
- package/app/stories/pix-icon-button.stories.js +95 -0
- package/app/stories/pix-icon-button.stories.mdx +90 -0
- package/app/stories/pix-input-code.stories.js +74 -0
- package/app/stories/pix-input-code.stories.mdx +46 -0
- package/app/stories/pix-input-password.stories.js +89 -0
- package/app/stories/pix-input-password.stories.mdx +69 -0
- package/app/stories/pix-input.stories.js +94 -0
- package/app/stories/pix-input.stories.mdx +57 -0
- package/app/stories/pix-message.stories.js +57 -0
- package/app/stories/pix-message.stories.mdx +71 -0
- package/app/stories/pix-multi-select.stories.js +199 -0
- package/app/stories/pix-multi-select.stories.mdx +55 -0
- package/app/stories/pix-progress-gauge.stories.js +78 -0
- package/app/stories/pix-progress-gauge.stories.mdx +43 -0
- package/app/stories/pix-radio-button.stories.js +71 -0
- package/app/stories/pix-radio-button.stories.mdx +49 -0
- package/app/stories/pix-return-to.stories.js +45 -0
- package/app/stories/pix-return-to.stories.mdx +41 -0
- package/app/stories/pix-select.stories.js +140 -0
- package/app/stories/pix-select.stories.mdx +57 -0
- package/app/stories/pix-selectable-tag.stories.js +91 -0
- package/app/stories/pix-selectable-tag.stories.mdx +55 -0
- package/app/stories/pix-stars.stories.js +43 -0
- package/app/stories/pix-stars.stories.mdx +35 -0
- package/app/stories/pix-tag.stories.js +56 -0
- package/app/stories/pix-tag.stories.mdx +46 -0
- package/app/stories/pix-textarea.stories.js +59 -0
- package/app/stories/pix-textarea.stories.mdx +36 -0
- package/app/stories/pix-tooltip-deprecated.stories.js +136 -0
- package/app/stories/pix-tooltip-deprecated.stories.mdx +143 -0
- package/app/stories/pix-tooltip.stories.js +157 -0
- package/app/stories/pix-tooltip.stories.mdx +183 -0
- package/app/styles/app.scss +0 -0
- package/config/environment.js +5 -0
- package/docs/architecture.stories.mdx +106 -0
- package/docs/assets/accessibility-storybook.png +0 -0
- package/docs/assets/screen-pix-storybook.png +0 -0
- package/docs/breaking-changes.stories.mdx +90 -0
- package/docs/changelog.stories.mdx +6 -0
- package/docs/create-component.stories.mdx +118 -0
- package/docs/design-system.stories.mdx +20 -0
- package/docs/good-practices-a11y.stories.mdx +48 -0
- package/docs/good-practices-design.stories.mdx +71 -0
- package/docs/good-practices-responsive.stories.mdx +51 -0
- package/docs/good-practices-style-css.stories.mdx +40 -0
- package/docs/good-practices-tests.stories.mdx +9 -0
- package/docs/make-a-release.stories.mdx +66 -0
- package/docs/pull_request_template.md +14 -0
- package/docs/storybook.stories.mdx +44 -0
- package/docs/use-component.stories.mdx +89 -0
- package/docs/use-install.stories.mdx +37 -0
- package/index.js +5 -0
- package/package.json +121 -0
- package/scalingo.json +17 -0
- package/servers.conf.erb +30 -0
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { hbs } from 'ember-cli-htmlbars';
|
|
2
|
+
import { action } from '@storybook/addon-actions';
|
|
3
|
+
|
|
4
|
+
const DEFAULT_OPTIONS = [
|
|
5
|
+
{ label: 'ANETH HERBE AROMATIQUE', value: '1' },
|
|
6
|
+
{ label: 'ANIS VERT HERBE AROMATIQUE', value: '2' },
|
|
7
|
+
{ label: 'BADIANE AROMATE', value: '3' },
|
|
8
|
+
{ label: 'BAIES ROSES EPICES', value: '4' },
|
|
9
|
+
{ label: 'BASILIC HERBE AROMATIQUE', value: '5' },
|
|
10
|
+
{ label: 'BOURRACHE OFFICINALE HERBE AROMATIQUE', value: '6' },
|
|
11
|
+
{ label: 'CANNELLE AROMATE', value: '7' },
|
|
12
|
+
{ label: 'CAPRE CONDIMENT', value: '8' },
|
|
13
|
+
{ label: 'CARDAMOME AROMATE', value: '9' },
|
|
14
|
+
{ label: 'CARVI HERBE AROMATIQUE', value: '10' },
|
|
15
|
+
{ label: 'CERFEUIL HERBE AROMATIQUE', value: '11' },
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
export const multiSelectWithChildComponent = (args) => {
|
|
19
|
+
return {
|
|
20
|
+
template: hbs`
|
|
21
|
+
<h4>⚠️ La sélection des éléments ne fonctionne pas dans Storybook.</h4>
|
|
22
|
+
<PixMultiSelect
|
|
23
|
+
@title={{titleStars}}
|
|
24
|
+
@id={{id}}
|
|
25
|
+
@onSelect={{onSelect}}
|
|
26
|
+
@emptyMessage={{emptyMessage}}
|
|
27
|
+
@label={{label}}
|
|
28
|
+
@options={{options}} as |star|
|
|
29
|
+
>
|
|
30
|
+
<PixStars
|
|
31
|
+
@count={{star.value}}
|
|
32
|
+
@total={{star.total}}
|
|
33
|
+
/>
|
|
34
|
+
</PixMultiSelect>
|
|
35
|
+
`,
|
|
36
|
+
context: args,
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
multiSelectWithChildComponent.args = {
|
|
41
|
+
titleStars: 'Sélectionner le niveau souhaité',
|
|
42
|
+
options: [
|
|
43
|
+
{ value: '1', total: 3 },
|
|
44
|
+
{ value: '2', total: 3 },
|
|
45
|
+
{ value: '3', total: 3 },
|
|
46
|
+
],
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const multiSelectSearchable = (args) => {
|
|
50
|
+
return {
|
|
51
|
+
template: hbs`
|
|
52
|
+
<h4>⚠️ La sélection des éléments ne fonctionne pas dans Storybook.</h4>
|
|
53
|
+
<PixMultiSelect
|
|
54
|
+
style="width:350px"
|
|
55
|
+
@id={{id}}
|
|
56
|
+
@title={{title}}
|
|
57
|
+
@placeholder={{placeholder}}
|
|
58
|
+
@isSearchable={{isSearchable}}
|
|
59
|
+
@showOptionsOnInput={{showOptionsOnInput}}
|
|
60
|
+
@strictSearch={{strictSearch}}
|
|
61
|
+
@onSelect={{doSomething}}
|
|
62
|
+
@emptyMessage={{emptyMessage}}
|
|
63
|
+
@size={{size}}
|
|
64
|
+
@selected={{selected}}
|
|
65
|
+
@options={{options}} as |option|
|
|
66
|
+
>
|
|
67
|
+
{{option.label}}
|
|
68
|
+
</PixMultiSelect>
|
|
69
|
+
`,
|
|
70
|
+
context: args,
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const multiSelectAsyncOptions = (args) => {
|
|
75
|
+
args.onLoadOptions = () => Promise.resolve(DEFAULT_OPTIONS);
|
|
76
|
+
return {
|
|
77
|
+
template: hbs`
|
|
78
|
+
<h4>⚠️ La sélection des éléments ne fonctionne pas dans Storybook.</h4>
|
|
79
|
+
<PixMultiSelect
|
|
80
|
+
style="width:350px"
|
|
81
|
+
@id={{id}}
|
|
82
|
+
@title={{title}}
|
|
83
|
+
@placeholder={{placeholder}}
|
|
84
|
+
@isSearchable={{isSearchable}}
|
|
85
|
+
@showOptionsOnInput={{showOptionsOnInput}}
|
|
86
|
+
@strictSearch={{strictSearch}}
|
|
87
|
+
@onSelect={{doSomething}}
|
|
88
|
+
@emptyMessage={{emptyMessage}}
|
|
89
|
+
@size={{size}}
|
|
90
|
+
@selected={{selected}}
|
|
91
|
+
@onLoadOptions={{onLoadOptions}} as |option|
|
|
92
|
+
>
|
|
93
|
+
{{option.label}}
|
|
94
|
+
</PixMultiSelect>
|
|
95
|
+
`,
|
|
96
|
+
context: args,
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export const argTypes = {
|
|
101
|
+
id: {
|
|
102
|
+
name: 'id',
|
|
103
|
+
description: 'Permet l‘accessibilité du composant attribuant des ``for`` pour chaque entité',
|
|
104
|
+
type: { name: 'string', required: true },
|
|
105
|
+
defaultValue: 'aromate',
|
|
106
|
+
},
|
|
107
|
+
title: {
|
|
108
|
+
name: 'title',
|
|
109
|
+
description: 'Donne un titre à sa liste de choix multiple.',
|
|
110
|
+
type: { name: 'string', required: true },
|
|
111
|
+
defaultValue: 'Rechercher un condiment',
|
|
112
|
+
},
|
|
113
|
+
label: {
|
|
114
|
+
name: 'label',
|
|
115
|
+
description: 'Donne un label au champ, le paramètre @id devient obligatoire avec ce paramètre.',
|
|
116
|
+
type: { name: 'string', required: false },
|
|
117
|
+
table: {
|
|
118
|
+
type: { summary: 'string' },
|
|
119
|
+
defaultValue: { summary: null },
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
emptyMessage: {
|
|
123
|
+
name: 'emptyMessage',
|
|
124
|
+
description:
|
|
125
|
+
'Un intitulé de choix indisponible (dans le cas ou certains filtres seraient excluant)',
|
|
126
|
+
type: { name: 'string', required: true },
|
|
127
|
+
defaultValue: 'pas de résultat',
|
|
128
|
+
},
|
|
129
|
+
loadingMessage: {
|
|
130
|
+
name: 'loadingMessage',
|
|
131
|
+
description:
|
|
132
|
+
"Message qui apparaît dans les options quand celles-ci sont en train d'être chargées via onLoadOptions",
|
|
133
|
+
type: { name: 'string', required: false },
|
|
134
|
+
defaultValue: 'Chargement...',
|
|
135
|
+
},
|
|
136
|
+
placeholder: {
|
|
137
|
+
name: 'placeholder',
|
|
138
|
+
description:
|
|
139
|
+
'Donner une liste d‘exemple pour la recherche utilisateur dans le cas ``isSearchable`` à ``true``',
|
|
140
|
+
type: { name: 'string', required: true },
|
|
141
|
+
defaultValue: 'Curcuma, Thym, ...',
|
|
142
|
+
},
|
|
143
|
+
options: {
|
|
144
|
+
name: 'options',
|
|
145
|
+
description:
|
|
146
|
+
'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.',
|
|
147
|
+
type: { name: 'array', required: true },
|
|
148
|
+
defaultValue: DEFAULT_OPTIONS,
|
|
149
|
+
},
|
|
150
|
+
onLoadOptions: {
|
|
151
|
+
name: 'onLoadOptions',
|
|
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
|
+
onSelect: {
|
|
157
|
+
name: 'onSelect',
|
|
158
|
+
description: "Une fonction permettant d'effectuer une action à chaque sélection",
|
|
159
|
+
type: { required: true },
|
|
160
|
+
defaultValue: action('onSelect'),
|
|
161
|
+
},
|
|
162
|
+
selected: {
|
|
163
|
+
name: 'selected',
|
|
164
|
+
description: 'Une pré-sélection peut être donnée au composant',
|
|
165
|
+
type: { name: 'array', required: false },
|
|
166
|
+
defaultValue: ['1', '4'],
|
|
167
|
+
},
|
|
168
|
+
showOptionsOnInput: {
|
|
169
|
+
name: 'showOptionsOnInput',
|
|
170
|
+
description:
|
|
171
|
+
'Afficher la liste au focus du champs de saisie lorsque ``isSearchable`` à ``true``',
|
|
172
|
+
type: { name: 'boolean', required: false },
|
|
173
|
+
defaultValue: true,
|
|
174
|
+
},
|
|
175
|
+
isSearchable: {
|
|
176
|
+
name: 'isSearchable',
|
|
177
|
+
description: 'Permet de rajouter une saisie utilisateur pour faciliter la recherche',
|
|
178
|
+
type: { name: 'boolean', required: false },
|
|
179
|
+
defaultValue: true,
|
|
180
|
+
},
|
|
181
|
+
strictSearch: {
|
|
182
|
+
name: 'strictSearch',
|
|
183
|
+
description:
|
|
184
|
+
'Permet de rendre sensible à la casse et au diacritiques lorsque ``isSearchable`` à ``true``',
|
|
185
|
+
type: { name: 'boolean', required: false },
|
|
186
|
+
defaultValue: false,
|
|
187
|
+
},
|
|
188
|
+
size: {
|
|
189
|
+
name: 'size',
|
|
190
|
+
description:
|
|
191
|
+
'⚠️ **Propriété dépréciée** ⚠️ , désormais tous les éléments de formulaires feront 36px de hauteur.',
|
|
192
|
+
options: ['big', 'small'],
|
|
193
|
+
type: { name: 'string', required: false },
|
|
194
|
+
table: {
|
|
195
|
+
type: { summary: 'string' },
|
|
196
|
+
defaultValue: { summary: 'small' },
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Meta, Story, Canvas, ArgsTable } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import centered from '@storybook/addon-centered/ember';
|
|
3
|
+
import * as stories from './pix-multi-select.stories.js';
|
|
4
|
+
|
|
5
|
+
<Meta
|
|
6
|
+
title='Form/Multi Select'
|
|
7
|
+
component='Multi Select'
|
|
8
|
+
argTypes={stories.argTypes}
|
|
9
|
+
/>
|
|
10
|
+
|
|
11
|
+
# Pix Multi Select
|
|
12
|
+
|
|
13
|
+
Un select custom permettant une gestion de la multiselection. Permet de passer soit du texte brut soit des composants à sa liste. (PixStars etc...)
|
|
14
|
+
L'ajout de ``class`` et d'autres attributs comme ``aria-label`` sont possibles.
|
|
15
|
+
|
|
16
|
+
> ⚠️ La démonstration de PixMultiSelect NE fonctionne PAS comme prévu dans storybook (mais fonctionne très bien sur les app fronts). Pour plus d'informations, voir https://github.com/1024pix/pix-ui/pull/76.
|
|
17
|
+
|
|
18
|
+
## With child component
|
|
19
|
+
<Canvas>
|
|
20
|
+
<Story name="With child component" story={stories.multiSelectWithChildComponent} height={310} />
|
|
21
|
+
</Canvas>
|
|
22
|
+
|
|
23
|
+
## Searchable
|
|
24
|
+
<Canvas>
|
|
25
|
+
<Story name="Searchable" story={stories.multiSelectSearchable} height={330}/>
|
|
26
|
+
</Canvas>
|
|
27
|
+
|
|
28
|
+
## With async options
|
|
29
|
+
|
|
30
|
+
Via la propriété `onLoadOptions`, le composant peut charger lui-même les options de manière asynchrone.
|
|
31
|
+
Le callback `onLoadOptions` est une promesse renvoyant la liste des options. (eg. `[{ label: 'A', value: '1' }]`).
|
|
32
|
+
|
|
33
|
+
Il est possible de donner un message via `loadingMessage` à afficher à la place des options pendant que celles-ci soient chargées.
|
|
34
|
+
|
|
35
|
+
<Canvas>
|
|
36
|
+
<Story name="With async options" story={stories.multiSelectAsyncOptions} height={330}/>
|
|
37
|
+
</Canvas>
|
|
38
|
+
|
|
39
|
+
## Usage
|
|
40
|
+
|
|
41
|
+
```html
|
|
42
|
+
<PixMultiSelect
|
|
43
|
+
@title={{title}}
|
|
44
|
+
@emptyMessage={{emptyMessage}}
|
|
45
|
+
@id={{id}}
|
|
46
|
+
@onSelect={{doSomething}}
|
|
47
|
+
@selected={{selected}}
|
|
48
|
+
@options={{options}} as |option|>
|
|
49
|
+
{{option.label}}
|
|
50
|
+
</PixMultiSelect>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Arguments
|
|
54
|
+
|
|
55
|
+
<ArgsTable story="Searchable" />
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { hbs } from 'ember-cli-htmlbars';
|
|
2
|
+
|
|
3
|
+
export const Default = (args) => {
|
|
4
|
+
return {
|
|
5
|
+
template: hbs`
|
|
6
|
+
<PixProgressGauge
|
|
7
|
+
@value={{value}}
|
|
8
|
+
@color={{color}}
|
|
9
|
+
@isArrowLeft={{isArrowLeft}}
|
|
10
|
+
@subtitle={{subtitle}}
|
|
11
|
+
@tooltipText={{tooltipText}}
|
|
12
|
+
/>
|
|
13
|
+
`,
|
|
14
|
+
context: args,
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
Default.args = {
|
|
18
|
+
tooltipText: '%',
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const whiteProgressGauge = (args) => {
|
|
22
|
+
return {
|
|
23
|
+
template: hbs`
|
|
24
|
+
<section style="width: 100%; padding: 35px 35px 5px;background-color: lightgray">
|
|
25
|
+
<PixProgressGauge
|
|
26
|
+
@value={{value}}
|
|
27
|
+
@color={{color}}
|
|
28
|
+
@isArrowLeft={{isArrowLeft}}
|
|
29
|
+
@subtitle={{subtitle}}
|
|
30
|
+
@tooltipText={{tooltipText}}
|
|
31
|
+
/>
|
|
32
|
+
</section>
|
|
33
|
+
`,
|
|
34
|
+
context: args,
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
whiteProgressGauge.args = {
|
|
38
|
+
value: '50',
|
|
39
|
+
tooltipText: '50%',
|
|
40
|
+
color: 'white',
|
|
41
|
+
isArrowLeft: true,
|
|
42
|
+
subtitle: 'Avancement',
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const argTypes = {
|
|
46
|
+
value: {
|
|
47
|
+
name: 'value',
|
|
48
|
+
description: 'Valeur atteinte sur 100',
|
|
49
|
+
type: { name: 'number', required: false },
|
|
50
|
+
table: { defaultValue: { summary: null } },
|
|
51
|
+
},
|
|
52
|
+
color: {
|
|
53
|
+
name: 'color',
|
|
54
|
+
description:
|
|
55
|
+
'Modifie la couleur de la barre de progression. Peut prendre les valeurs `yellow` ou `white`',
|
|
56
|
+
type: { name: 'string', required: false },
|
|
57
|
+
table: { defaultValue: { summary: 'yellow' } },
|
|
58
|
+
control: { type: 'select', options: ['yellow', 'white'] },
|
|
59
|
+
},
|
|
60
|
+
isArrowLeft: {
|
|
61
|
+
name: 'isArrowLeft',
|
|
62
|
+
description: "Modifie la position de l'info bulle sur la gauche",
|
|
63
|
+
type: { name: 'boolean', required: false },
|
|
64
|
+
table: { defaultValue: { summary: false } },
|
|
65
|
+
},
|
|
66
|
+
subtitle: {
|
|
67
|
+
name: 'subtitle',
|
|
68
|
+
description: 'Afficher un sous-titre sous la barre de progression',
|
|
69
|
+
type: { name: 'string', required: false },
|
|
70
|
+
table: { defaultValue: { summary: 'null' } },
|
|
71
|
+
},
|
|
72
|
+
tooltipText: {
|
|
73
|
+
name: 'tooltipText',
|
|
74
|
+
description: "Afficher un label dans l'info bulle au dessus de la barre de progression",
|
|
75
|
+
type: { name: 'string', required: false },
|
|
76
|
+
table: { defaultValue: { summary: 'null' } },
|
|
77
|
+
},
|
|
78
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Meta, Story, Canvas, ArgsTable } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import centered from '@storybook/addon-centered/ember';
|
|
3
|
+
import * as stories from './pix-progress-gauge.stories.js';
|
|
4
|
+
|
|
5
|
+
<Meta
|
|
6
|
+
title='Others/Progress Gauge'
|
|
7
|
+
component='PixProgressGauge'
|
|
8
|
+
decorators={[centered]}
|
|
9
|
+
argTypes={stories.argTypes}
|
|
10
|
+
/>
|
|
11
|
+
|
|
12
|
+
# Progress Gauge
|
|
13
|
+
|
|
14
|
+
## Default
|
|
15
|
+
|
|
16
|
+
Permet d'afficher un barre de progression sur un barème de 100%. Des paramètres existent pour changer la position de la tooltip ou la couleur du composant
|
|
17
|
+
|
|
18
|
+
<Canvas>
|
|
19
|
+
<Story name='Default' story={stories.Default} height={60} />
|
|
20
|
+
</Canvas>
|
|
21
|
+
|
|
22
|
+
## White
|
|
23
|
+
|
|
24
|
+
Démonstration d'une barre de progression blanche avec l'info bulle à gauche avec un sous titre
|
|
25
|
+
|
|
26
|
+
<Canvas>
|
|
27
|
+
<Story name='White' story={stories.whiteProgressGauge} height={100} />
|
|
28
|
+
</Canvas>
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
|
|
32
|
+
```html
|
|
33
|
+
<PixProgressGauge
|
|
34
|
+
@value="50"
|
|
35
|
+
@color="white"
|
|
36
|
+
@tooltipText="50%"
|
|
37
|
+
@isArrowLeft="true"
|
|
38
|
+
@subTitle="Un sous titre" />
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Arguments
|
|
42
|
+
|
|
43
|
+
<ArgsTable story="Default" />
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { hbs } from 'ember-cli-htmlbars';
|
|
2
|
+
|
|
3
|
+
const Template = (args) => {
|
|
4
|
+
return {
|
|
5
|
+
template: hbs`
|
|
6
|
+
<PixRadioButton
|
|
7
|
+
@label={{label}}
|
|
8
|
+
@value={{value}}
|
|
9
|
+
@isDisabled={{isDisabled}}
|
|
10
|
+
/>
|
|
11
|
+
`,
|
|
12
|
+
context: args,
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const Default = Template.bind({});
|
|
17
|
+
Default.args = {
|
|
18
|
+
label: 'Poivron',
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const isDisabled = Template.bind({});
|
|
22
|
+
isDisabled.args = {
|
|
23
|
+
...Default.args,
|
|
24
|
+
isDisabled: true,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const checked = (args) => {
|
|
28
|
+
return {
|
|
29
|
+
template: hbs`
|
|
30
|
+
<PixRadioButton
|
|
31
|
+
@label={{label}}
|
|
32
|
+
@isDisabled={{isDisabled}}
|
|
33
|
+
checked
|
|
34
|
+
/>
|
|
35
|
+
`,
|
|
36
|
+
context: args,
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const disabledChecked = checked.bind({});
|
|
41
|
+
disabledChecked.args = {
|
|
42
|
+
...Default.args,
|
|
43
|
+
isDisabled: true,
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const defaultChecked = checked.bind({});
|
|
47
|
+
defaultChecked.args = Default.args;
|
|
48
|
+
|
|
49
|
+
export const argTypes = {
|
|
50
|
+
label: {
|
|
51
|
+
name: 'label',
|
|
52
|
+
description: 'Le label du bouton radio',
|
|
53
|
+
type: { name: 'string', required: true },
|
|
54
|
+
defaultValue: null,
|
|
55
|
+
},
|
|
56
|
+
value: {
|
|
57
|
+
name: 'value',
|
|
58
|
+
description: "Valeur permettant d'identifier l'option sélectionnée",
|
|
59
|
+
type: { name: 'string', required: false },
|
|
60
|
+
defaultValue: null,
|
|
61
|
+
},
|
|
62
|
+
isDisabled: {
|
|
63
|
+
name: 'isDisabled',
|
|
64
|
+
description: 'Pour désactiver/activer le bouton radio',
|
|
65
|
+
type: { name: 'boolean', required: false },
|
|
66
|
+
defaultValue: false,
|
|
67
|
+
table: {
|
|
68
|
+
defaultValue: { summary: 'false' },
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Meta, Story, Canvas, ArgsTable } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import centered from '@storybook/addon-centered/ember';
|
|
3
|
+
|
|
4
|
+
import * as stories from './pix-radio-button.stories.js';
|
|
5
|
+
|
|
6
|
+
<Meta
|
|
7
|
+
title='Form/Radio Button'
|
|
8
|
+
component='PixRadioButton'
|
|
9
|
+
decorators={[centered]}
|
|
10
|
+
argTypes={stories.argTypes}
|
|
11
|
+
/>
|
|
12
|
+
|
|
13
|
+
# Pix Radio Button
|
|
14
|
+
|
|
15
|
+
Un bouton radio permettant de sélectionner une seule option dans une liste.
|
|
16
|
+
|
|
17
|
+
⚠️ Le bouton radio ne peut pas être utilisé seul : il faut au minimum **2 options**.
|
|
18
|
+
Il est préférable de ne pas sélectionner d’option par défaut pour que le choix de l’utilisateur soit conscient (en particulier si le choix est obligatoire).
|
|
19
|
+
|
|
20
|
+
## Default
|
|
21
|
+
|
|
22
|
+
<Canvas isColumn>
|
|
23
|
+
<Story name= "Default" story={stories.Default} height={60} />
|
|
24
|
+
<Story name='Default checked' story={stories.defaultChecked} height={60} />
|
|
25
|
+
</Canvas>
|
|
26
|
+
|
|
27
|
+
## IsDisabled
|
|
28
|
+
|
|
29
|
+
État inactif du bouton radio.
|
|
30
|
+
|
|
31
|
+
<Canvas isColumn>
|
|
32
|
+
<Story name='Disabled' story={stories.isDisabled} height={60} />
|
|
33
|
+
<Story name='Disabled checked' story={stories.disabledChecked} height={60} />
|
|
34
|
+
</Canvas>
|
|
35
|
+
|
|
36
|
+
## Usage
|
|
37
|
+
|
|
38
|
+
```html
|
|
39
|
+
|
|
40
|
+
<PixRadioButton
|
|
41
|
+
@label={{label}}
|
|
42
|
+
@value={{value}}
|
|
43
|
+
@isDisabled={{isDisabled}}
|
|
44
|
+
/>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Arguments
|
|
48
|
+
|
|
49
|
+
<ArgsTable story="Default" />
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { hbs } from 'ember-cli-htmlbars';
|
|
2
|
+
|
|
3
|
+
export const returnTo = (args) => {
|
|
4
|
+
return {
|
|
5
|
+
template: hbs`
|
|
6
|
+
<PixReturnTo @route='profile' @shade={{shade}} />
|
|
7
|
+
`,
|
|
8
|
+
context: args,
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
returnTo.args = {
|
|
12
|
+
shade: 'blue',
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const returnToWithText = (args) => {
|
|
16
|
+
return {
|
|
17
|
+
template: hbs`
|
|
18
|
+
<PixReturnTo @route='profile' @shade={{shade}}>
|
|
19
|
+
Retour vers mon profil
|
|
20
|
+
</PixReturnTo>
|
|
21
|
+
`,
|
|
22
|
+
context: args,
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const argTypes = {
|
|
27
|
+
route: {
|
|
28
|
+
name: 'route',
|
|
29
|
+
description: 'Route de redirection',
|
|
30
|
+
type: { name: 'string', required: true },
|
|
31
|
+
defaultValue: null,
|
|
32
|
+
},
|
|
33
|
+
model: {
|
|
34
|
+
name: 'model',
|
|
35
|
+
description: 'Model Ember',
|
|
36
|
+
type: { required: false },
|
|
37
|
+
},
|
|
38
|
+
shade: {
|
|
39
|
+
name: 'shade',
|
|
40
|
+
description: 'Couleur du lien',
|
|
41
|
+
type: { name: 'string', required: false },
|
|
42
|
+
defaultValue: 'black',
|
|
43
|
+
control: { type: 'select', options: ['white', 'black', 'blue'] },
|
|
44
|
+
},
|
|
45
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Meta, Story, Canvas, ArgsTable } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import centered from '@storybook/addon-centered/ember';
|
|
3
|
+
import * as stories from './pix-return-to.stories.js';
|
|
4
|
+
|
|
5
|
+
<Meta
|
|
6
|
+
title='Basics/Return To'
|
|
7
|
+
component='PixReturnTo'
|
|
8
|
+
decorators={[centered]}
|
|
9
|
+
argTypes={stories.argTypes}
|
|
10
|
+
/>
|
|
11
|
+
|
|
12
|
+
# Pix Return To
|
|
13
|
+
|
|
14
|
+
Le `ReturnTo` est un lien de retour vers uneOpixRe page précédente.
|
|
15
|
+
|
|
16
|
+
> Il est nécessaire de passer une @route au composant.
|
|
17
|
+
|
|
18
|
+
> Il est possible d'afficher uniquement l'icone flèche en omettant de mettre du contenu enfant dans la balise.
|
|
19
|
+
|
|
20
|
+
<Canvas isColumn>
|
|
21
|
+
Lien sans texte
|
|
22
|
+
<Story name="Return To" story={stories.returnTo} height={60} />
|
|
23
|
+
Lien avec texte
|
|
24
|
+
<Story name="Return To With Text" story={stories.returnToWithText} height={60} />
|
|
25
|
+
</Canvas>
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
```html
|
|
30
|
+
Liens avec texte
|
|
31
|
+
<PixReturnTo @route='profile'>
|
|
32
|
+
Un lien de retour
|
|
33
|
+
</PixReturnTo>
|
|
34
|
+
|
|
35
|
+
Liens sans texte
|
|
36
|
+
<PixReturnTo @route='profile' />
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Arguments
|
|
40
|
+
|
|
41
|
+
<ArgsTable story="Return To With Text" />
|