@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,140 @@
|
|
|
1
|
+
import { hbs } from 'ember-cli-htmlbars';
|
|
2
|
+
import { action } from '@storybook/addon-actions';
|
|
3
|
+
|
|
4
|
+
const Template = (args) => ({
|
|
5
|
+
template: hbs`
|
|
6
|
+
<PixSelect
|
|
7
|
+
@id={{id}}
|
|
8
|
+
@options={{options}}
|
|
9
|
+
@onChange={{onChange}}
|
|
10
|
+
@selectedOption={{selectedOption}}
|
|
11
|
+
@emptyOptionLabel={{emptyOptionLabel}}
|
|
12
|
+
@emptyOptionNotSelectable={{emptyOptionNotSelectable}}
|
|
13
|
+
@isSearchable={{isSearchable}}
|
|
14
|
+
@isValidationActive={{isValidationActive}}
|
|
15
|
+
@label={{label}}
|
|
16
|
+
/>
|
|
17
|
+
`,
|
|
18
|
+
context: args,
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export const Default = Template.bind({});
|
|
22
|
+
Default.args = {
|
|
23
|
+
options: [
|
|
24
|
+
{ value: '1', label: 'Figues' },
|
|
25
|
+
{ value: '2', label: 'Bananes' },
|
|
26
|
+
{ value: '3', label: 'Noix' },
|
|
27
|
+
{ value: '4', label: 'Papayes' },
|
|
28
|
+
{ value: '5', label: 'Fèves de chocolat' },
|
|
29
|
+
{ value: '6', label: 'Dattes' },
|
|
30
|
+
{ value: '7', label: 'Mangues' },
|
|
31
|
+
{ value: '8', label: 'Jujube' },
|
|
32
|
+
{ value: '9', label: 'Avocat' },
|
|
33
|
+
{ value: '10', label: 'Fraises' },
|
|
34
|
+
{ value: '11', label: 'Kaki' },
|
|
35
|
+
{ value: '12', label: 'Asiminier trilobé oblong vert (à ne pas confondre avec la papaye)' },
|
|
36
|
+
],
|
|
37
|
+
onChange: action('onChange'),
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const withLabel = Template.bind({});
|
|
41
|
+
withLabel.args = {
|
|
42
|
+
...Default.args,
|
|
43
|
+
id: 'pix-select-with-label',
|
|
44
|
+
label: 'Ton fruit préféré: ',
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const searchableSelect = Template.bind({});
|
|
48
|
+
searchableSelect.args = {
|
|
49
|
+
...Default.args,
|
|
50
|
+
emptyOptionNotSelectable: false,
|
|
51
|
+
isSearchable: true,
|
|
52
|
+
isValidationActive: true,
|
|
53
|
+
placeholder: 'Fraises, Mangues...',
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export const argTypes = {
|
|
57
|
+
options: {
|
|
58
|
+
name: 'options',
|
|
59
|
+
description:
|
|
60
|
+
'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 que le champ puisse être cherchable',
|
|
61
|
+
type: { name: 'object', required: true },
|
|
62
|
+
},
|
|
63
|
+
onChange: {
|
|
64
|
+
name: 'onChange',
|
|
65
|
+
description: 'Fonction à appeler si une option est sélectionnée',
|
|
66
|
+
type: { required: true },
|
|
67
|
+
control: { disable: true },
|
|
68
|
+
},
|
|
69
|
+
selectedOption: {
|
|
70
|
+
name: 'selectedOption',
|
|
71
|
+
description: 'Option sélectionnée',
|
|
72
|
+
options: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10'],
|
|
73
|
+
control: { type: 'select' },
|
|
74
|
+
type: { name: 'string', required: false },
|
|
75
|
+
table: {
|
|
76
|
+
type: { summary: 'string' },
|
|
77
|
+
defaultValue: { summary: null },
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
emptyOptionLabel: {
|
|
81
|
+
name: 'emptyOptionLabel',
|
|
82
|
+
description: 'Texte à afficher si aucune option n‘est sélectionnée',
|
|
83
|
+
type: { name: 'string', required: false },
|
|
84
|
+
table: {
|
|
85
|
+
type: { summary: 'string' },
|
|
86
|
+
defaultValue: { summary: null },
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
isSearchable: {
|
|
90
|
+
name: 'isSearchable',
|
|
91
|
+
description: 'Rend le champ cherchable',
|
|
92
|
+
control: { type: 'boolean' },
|
|
93
|
+
type: { name: 'boolean', required: false },
|
|
94
|
+
table: {
|
|
95
|
+
type: { summary: 'boolean' },
|
|
96
|
+
defaultValue: { summary: false },
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
isValidationActive: {
|
|
100
|
+
name: 'isValidationActive',
|
|
101
|
+
description:
|
|
102
|
+
"Rend la bordure du champ vert au focus si la valeur de recherche match une option (c'est à dire si l'utilisateur a selectionné une option valable",
|
|
103
|
+
control: { type: 'boolean' },
|
|
104
|
+
type: { name: 'boolean', required: false },
|
|
105
|
+
table: {
|
|
106
|
+
type: { summary: 'boolean' },
|
|
107
|
+
defaultValue: { summary: false },
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
emptyOptionNotSelectable: {
|
|
111
|
+
name: 'emptyOptionNotSelectable',
|
|
112
|
+
description: 'Rend le premier champ qui est vide non visible une fois sélectionné',
|
|
113
|
+
control: { type: 'boolean' },
|
|
114
|
+
type: { name: 'boolean', required: false },
|
|
115
|
+
table: {
|
|
116
|
+
type: { summary: 'boolean' },
|
|
117
|
+
defaultValue: { summary: false },
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
size: {
|
|
121
|
+
name: 'size',
|
|
122
|
+
description:
|
|
123
|
+
'⚠️ **Propriété dépréciée** ⚠️ , désormais tous les éléments de formulaires feront 36px de hauteur.',
|
|
124
|
+
options: ['big', 'small'],
|
|
125
|
+
type: { name: 'string', required: false },
|
|
126
|
+
table: {
|
|
127
|
+
type: { summary: 'string' },
|
|
128
|
+
defaultValue: { summary: 'small' },
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
label: {
|
|
132
|
+
name: 'label',
|
|
133
|
+
description: 'Donne un label au champ, le paramètre @id devient obligatoire avec ce paramètre.',
|
|
134
|
+
type: { name: 'string', required: false },
|
|
135
|
+
table: {
|
|
136
|
+
type: { summary: 'string' },
|
|
137
|
+
defaultValue: { summary: null },
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
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-select.stories.js';
|
|
4
|
+
|
|
5
|
+
<Meta
|
|
6
|
+
title='Form/Select'
|
|
7
|
+
component='PixSelect'
|
|
8
|
+
decorators={[centered]}
|
|
9
|
+
argTypes={stories.argTypes}
|
|
10
|
+
/>
|
|
11
|
+
|
|
12
|
+
# Pix Select
|
|
13
|
+
|
|
14
|
+
Affiche un champ Select avec la liste des options fournie.
|
|
15
|
+
|
|
16
|
+
Les options sont représentées par un tableau d'objet contenant les propriétés value et label.
|
|
17
|
+
|
|
18
|
+
> **⚠️** __N'oubliez pas de rajouter un id et un label rattaché à l'input pour le rendre accessible !
|
|
19
|
+
A défaut d'avoir un label, vous pouvez rajouter l'attribut `aria-label` à l'input.__
|
|
20
|
+
|
|
21
|
+
> Pour aider l'utilisateur avec le PixSelect cherchable, rajoutez un placeholder cohérent !
|
|
22
|
+
|
|
23
|
+
## Default
|
|
24
|
+
|
|
25
|
+
<Canvas>
|
|
26
|
+
<Story name="Select" story={stories.Default} height={100} />
|
|
27
|
+
</Canvas>
|
|
28
|
+
|
|
29
|
+
## With label
|
|
30
|
+
|
|
31
|
+
<Canvas>
|
|
32
|
+
<Story story={stories.withLabel} height={100} />
|
|
33
|
+
</Canvas>
|
|
34
|
+
|
|
35
|
+
## Searchable
|
|
36
|
+
|
|
37
|
+
<Canvas>
|
|
38
|
+
<Story name="SearchableSelect" story={stories.searchableSelect} height={110} />
|
|
39
|
+
</Canvas>
|
|
40
|
+
|
|
41
|
+
## Usage
|
|
42
|
+
|
|
43
|
+
```html
|
|
44
|
+
<PixSelect
|
|
45
|
+
@options={{options}}
|
|
46
|
+
@onChange={{onChange}}
|
|
47
|
+
@selectedOption="1"
|
|
48
|
+
@emptyOptionLabel="Empty option"
|
|
49
|
+
@isSearchable={{false}}
|
|
50
|
+
@isValidationActive={{false}}
|
|
51
|
+
@emptyOptionNotSelectable={{false}}
|
|
52
|
+
/>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Arguments
|
|
56
|
+
|
|
57
|
+
<ArgsTable story="Select" />
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { hbs } from 'ember-cli-htmlbars';
|
|
2
|
+
|
|
3
|
+
export const selectableTagDefault = (args) => {
|
|
4
|
+
return {
|
|
5
|
+
template: hbs`
|
|
6
|
+
<PixSelectableTag
|
|
7
|
+
@label="non sélectionné"
|
|
8
|
+
@id="123"
|
|
9
|
+
@onChange={{onChange}}
|
|
10
|
+
@checked={{false}}
|
|
11
|
+
/>
|
|
12
|
+
`,
|
|
13
|
+
context: args,
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const selectableTagSelected = (args) => {
|
|
18
|
+
return {
|
|
19
|
+
template: hbs`
|
|
20
|
+
<PixSelectableTag
|
|
21
|
+
@label="Sélectionné"
|
|
22
|
+
@id="456"
|
|
23
|
+
@onChange={{onChange}}
|
|
24
|
+
@checked={{true}}
|
|
25
|
+
/>
|
|
26
|
+
`,
|
|
27
|
+
context: args,
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const selectableTagMultiple = (args) => {
|
|
32
|
+
return {
|
|
33
|
+
template: hbs`
|
|
34
|
+
<div style="display:flex;justify-content:space-around;width:400px;height:100%;padding:10px">
|
|
35
|
+
<PixSelectableTag
|
|
36
|
+
@label="Lorem ipsum"
|
|
37
|
+
@id="1"
|
|
38
|
+
@onChange={{onChange}}
|
|
39
|
+
@checked={{false}}
|
|
40
|
+
/>
|
|
41
|
+
<PixSelectableTag
|
|
42
|
+
@label="Lorem ipsum"
|
|
43
|
+
@id="2"
|
|
44
|
+
@onChange={{onChange}}
|
|
45
|
+
@checked={{false}}
|
|
46
|
+
/>
|
|
47
|
+
<PixSelectableTag
|
|
48
|
+
@label="Lorem ipsum"
|
|
49
|
+
@id="3"
|
|
50
|
+
@onChange={{onChange}}
|
|
51
|
+
@checked={{false}}
|
|
52
|
+
/>
|
|
53
|
+
</div>
|
|
54
|
+
`,
|
|
55
|
+
context: args,
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export const argTypes = {
|
|
60
|
+
label: {
|
|
61
|
+
name: 'label',
|
|
62
|
+
description: 'Le label du tag sélectionnable',
|
|
63
|
+
type: { name: 'string', required: true },
|
|
64
|
+
table: {
|
|
65
|
+
type: { summary: 'string' },
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
id: {
|
|
69
|
+
name: 'id',
|
|
70
|
+
description: "L'id du tag sélectionnable",
|
|
71
|
+
type: { name: 'string', required: true },
|
|
72
|
+
table: {
|
|
73
|
+
type: { summary: 'string' },
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
onChange: {
|
|
77
|
+
name: 'onChange',
|
|
78
|
+
description: 'Fonction à appeler si le tag est sélectionné',
|
|
79
|
+
type: { required: true },
|
|
80
|
+
control: { disable: true },
|
|
81
|
+
},
|
|
82
|
+
checked: {
|
|
83
|
+
name: 'checked',
|
|
84
|
+
description: 'Indiquez si le tag doit être coché',
|
|
85
|
+
type: { name: 'boolean', required: true },
|
|
86
|
+
table: {
|
|
87
|
+
type: { summary: 'boolean' },
|
|
88
|
+
defaultValue: { summary: false },
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
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-selectable-tag.stories.js';
|
|
5
|
+
|
|
6
|
+
<Meta
|
|
7
|
+
title='basics/Tag/Selectable Tag'
|
|
8
|
+
component='PixSelectableTag'
|
|
9
|
+
decorators={[centered]}
|
|
10
|
+
argTypes={stories.argTypes}
|
|
11
|
+
/>
|
|
12
|
+
|
|
13
|
+
# Pix Selectable Tag
|
|
14
|
+
|
|
15
|
+
Un tag permettant de sélectionner ou non la valeur.
|
|
16
|
+
|
|
17
|
+
## Default
|
|
18
|
+
|
|
19
|
+
<Canvas>
|
|
20
|
+
<Story name='Selectable Tag default' story={stories.selectableTagDefault} height={60} />
|
|
21
|
+
</Canvas>
|
|
22
|
+
|
|
23
|
+
## Selected
|
|
24
|
+
|
|
25
|
+
<Canvas>
|
|
26
|
+
<Story name='Selectable Tag checked' story={stories.selectableTagSelected} height={60} />
|
|
27
|
+
</Canvas>
|
|
28
|
+
|
|
29
|
+
## Multiple tags
|
|
30
|
+
<Canvas>
|
|
31
|
+
<Story name='Selectable Tag multiple' story={stories.selectableTagMultiple} height={60} />
|
|
32
|
+
</Canvas>
|
|
33
|
+
|
|
34
|
+
## Usage
|
|
35
|
+
|
|
36
|
+
```html
|
|
37
|
+
Par défaut :
|
|
38
|
+
<PixSelectableTag>
|
|
39
|
+
@label={{label}}
|
|
40
|
+
@id={{id}}
|
|
41
|
+
@onChange={{onChange}}
|
|
42
|
+
</PixSelectableTag>
|
|
43
|
+
|
|
44
|
+
Tag Sélectionné :
|
|
45
|
+
<PixSelectableTag>
|
|
46
|
+
@label={{label}}
|
|
47
|
+
@id={{id}}
|
|
48
|
+
@onChange={{onChange}}
|
|
49
|
+
@checked={{true}}
|
|
50
|
+
</PixSelectableTag>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Arguments
|
|
54
|
+
|
|
55
|
+
<ArgsTable story="Selectable Tag default" />
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { hbs } from 'ember-cli-htmlbars';
|
|
2
|
+
|
|
3
|
+
export const stars = (args) => {
|
|
4
|
+
return {
|
|
5
|
+
template: hbs`
|
|
6
|
+
<PixStars
|
|
7
|
+
@count={{count}}
|
|
8
|
+
@total={{total}}
|
|
9
|
+
@alt={{alt}}
|
|
10
|
+
@color={{color}}
|
|
11
|
+
/>
|
|
12
|
+
`,
|
|
13
|
+
context: args,
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const argTypes = {
|
|
18
|
+
count: {
|
|
19
|
+
name: 'count',
|
|
20
|
+
description: 'Nombre total d’étoiles actives',
|
|
21
|
+
type: { name: 'number', required: false },
|
|
22
|
+
defaultValue: 2,
|
|
23
|
+
},
|
|
24
|
+
total: {
|
|
25
|
+
name: 'total',
|
|
26
|
+
description: 'Nombre total d’étoiles',
|
|
27
|
+
type: { name: 'number', required: false },
|
|
28
|
+
defaultValue: 5,
|
|
29
|
+
},
|
|
30
|
+
alt: {
|
|
31
|
+
name: 'alt',
|
|
32
|
+
description: 'Message alternatif pour les étoiles',
|
|
33
|
+
type: { name: 'string', required: true },
|
|
34
|
+
defaultValue: 'Message',
|
|
35
|
+
},
|
|
36
|
+
color: {
|
|
37
|
+
name: 'color',
|
|
38
|
+
description: 'Couleur des étoiles',
|
|
39
|
+
type: { name: 'string', required: false },
|
|
40
|
+
defaultValue: 'yellow',
|
|
41
|
+
control: { type: 'select', options: ['yellow', 'blue', 'grey'] },
|
|
42
|
+
},
|
|
43
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
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-stars.stories.js';
|
|
4
|
+
|
|
5
|
+
<Meta
|
|
6
|
+
title='Others/PixStars'
|
|
7
|
+
component='PixStars'
|
|
8
|
+
decorators={[centered]}
|
|
9
|
+
argTypes={stories.argTypes}
|
|
10
|
+
/>
|
|
11
|
+
|
|
12
|
+
# Pix Stars
|
|
13
|
+
|
|
14
|
+
Affiche une série d'étoiles en fonction des paramètres donnés.
|
|
15
|
+
Un texte alternatif peut être renseigné et différents styles sont pré-définis.
|
|
16
|
+
Pour ne pas afficher les étoiles vides, il suffit de ne pas donner le total d'étoiles.
|
|
17
|
+
|
|
18
|
+
<Canvas>
|
|
19
|
+
<Story name="PixStars" story={stories.stars} height={60} />
|
|
20
|
+
</Canvas>
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
```html
|
|
25
|
+
<PixStars
|
|
26
|
+
@count={{2}}
|
|
27
|
+
@total={{5}}
|
|
28
|
+
@alt="message alternatif"
|
|
29
|
+
@color="blue"
|
|
30
|
+
/>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Arguments
|
|
34
|
+
|
|
35
|
+
<ArgsTable story="PixStars" />
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { hbs } from 'ember-cli-htmlbars';
|
|
2
|
+
|
|
3
|
+
export const tag = (args) => {
|
|
4
|
+
return {
|
|
5
|
+
template: hbs`
|
|
6
|
+
<PixTag @color={{color}} @compact={{compact}}>
|
|
7
|
+
Contenu du tag
|
|
8
|
+
</PixTag>
|
|
9
|
+
`,
|
|
10
|
+
context: args,
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const compactTag = (args) => {
|
|
15
|
+
return {
|
|
16
|
+
template: hbs`
|
|
17
|
+
<PixTag @color={{color}} @compact={{compact}}>
|
|
18
|
+
Contenu du tag
|
|
19
|
+
</PixTag>
|
|
20
|
+
`,
|
|
21
|
+
context: args,
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
compactTag.args = {
|
|
25
|
+
compact: true,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const argTypes = {
|
|
29
|
+
color: {
|
|
30
|
+
name: 'color',
|
|
31
|
+
description: 'Couleur du tag',
|
|
32
|
+
type: { name: 'number', required: false },
|
|
33
|
+
defaultValue: 'blue',
|
|
34
|
+
control: {
|
|
35
|
+
type: 'select',
|
|
36
|
+
options: [
|
|
37
|
+
'blue',
|
|
38
|
+
'blue-light',
|
|
39
|
+
'purple',
|
|
40
|
+
'purple-light',
|
|
41
|
+
'green',
|
|
42
|
+
'green-light',
|
|
43
|
+
'yellow',
|
|
44
|
+
'yellow-light',
|
|
45
|
+
'grey',
|
|
46
|
+
'grey-light',
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
compact: {
|
|
51
|
+
name: 'compact',
|
|
52
|
+
description: 'Tag compact ou non',
|
|
53
|
+
type: { name: 'boolean', required: false },
|
|
54
|
+
defaultValue: false,
|
|
55
|
+
},
|
|
56
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
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-tag.stories.js';
|
|
4
|
+
|
|
5
|
+
<Meta
|
|
6
|
+
title='Basics/Tag'
|
|
7
|
+
component='PixTag'
|
|
8
|
+
decorators={[centered]}
|
|
9
|
+
argTypes={stories.argTypes}
|
|
10
|
+
/>
|
|
11
|
+
|
|
12
|
+
# Pix Tag
|
|
13
|
+
|
|
14
|
+
Un `Tag` est un type de `Chips` qui permet de mettre en avant une information ou bien de la catégoriser.
|
|
15
|
+
|
|
16
|
+
> Il est possible de surcharger le style d'un `<PixTag>` via l'attribut `class` ainsi que de passer n'importe quel attribut sur sa `div` wrapper (par exemple, un `aria-label`)
|
|
17
|
+
|
|
18
|
+
<Canvas isColumn>
|
|
19
|
+
Tag
|
|
20
|
+
<Story name="Tag" story={stories.tag} height={60} />
|
|
21
|
+
Tag compact
|
|
22
|
+
<Story name="Compact Tag" story={stories.compactTag} height={60} />
|
|
23
|
+
</Canvas>
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
```html
|
|
28
|
+
Par défaut:
|
|
29
|
+
<PixTag>
|
|
30
|
+
This is a blue tag
|
|
31
|
+
</PixTag>
|
|
32
|
+
|
|
33
|
+
Customiser la couleur du tag:
|
|
34
|
+
<PixTag @color='purple'>
|
|
35
|
+
This is a purple tag
|
|
36
|
+
</PixTag>
|
|
37
|
+
|
|
38
|
+
Tag Compact
|
|
39
|
+
<PixTag @compact={{true}} @color='blue'>
|
|
40
|
+
This is a compactg tag
|
|
41
|
+
</PixTag>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Arguments
|
|
45
|
+
|
|
46
|
+
<ArgsTable story="Tag" />
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { hbs } from 'ember-cli-htmlbars';
|
|
2
|
+
|
|
3
|
+
export const textarea = (args) => {
|
|
4
|
+
return {
|
|
5
|
+
template: hbs`
|
|
6
|
+
<PixTextarea
|
|
7
|
+
@id={{id}}
|
|
8
|
+
@value={{value}}
|
|
9
|
+
@maxlength={{maxlength}}
|
|
10
|
+
@label={{label}}
|
|
11
|
+
@errorMessage={{errorMessage}}
|
|
12
|
+
/>
|
|
13
|
+
`,
|
|
14
|
+
context: args,
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const argTypes = {
|
|
19
|
+
id: {
|
|
20
|
+
name: 'id',
|
|
21
|
+
description: 'Identifiant du champ permettant de lui attacher un label',
|
|
22
|
+
type: { name: 'string', required: true },
|
|
23
|
+
defaultValue: '',
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
value: {
|
|
27
|
+
name: 'value',
|
|
28
|
+
description: 'Valeur du champ',
|
|
29
|
+
type: { name: 'string', required: true },
|
|
30
|
+
defaultValue: '',
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
maxlength: {
|
|
34
|
+
name: 'maxlength',
|
|
35
|
+
description: 'Nombre de caractères maximal à taper dans le champ',
|
|
36
|
+
type: { name: 'number', required: false },
|
|
37
|
+
defaultValue: 500,
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
label: {
|
|
41
|
+
name: 'label',
|
|
42
|
+
description: 'Donne un label au champ.',
|
|
43
|
+
type: { name: 'string', required: false },
|
|
44
|
+
table: {
|
|
45
|
+
type: { summary: 'string' },
|
|
46
|
+
defaultValue: { summary: null },
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
errorMessage: {
|
|
51
|
+
name: 'errorMessage',
|
|
52
|
+
description: 'Affiche une erreur en dessous du champ.',
|
|
53
|
+
type: { name: 'string', required: false },
|
|
54
|
+
table: {
|
|
55
|
+
type: { summary: 'string' },
|
|
56
|
+
defaultValue: { summary: null },
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
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-textarea.stories.js';
|
|
4
|
+
|
|
5
|
+
<Meta
|
|
6
|
+
title='Form/Textarea'
|
|
7
|
+
component='PixTextarea'
|
|
8
|
+
decorators={[centered]}
|
|
9
|
+
argTypes={stories.argTypes}
|
|
10
|
+
/>
|
|
11
|
+
|
|
12
|
+
# PixTextarea
|
|
13
|
+
|
|
14
|
+
Un textarea permettant d'avoir un champ de saisie libre.
|
|
15
|
+
|
|
16
|
+
Optionellement, il peut afficher le nombre de caractères tapés ainsi que le nombre de caractères maximum.
|
|
17
|
+
|
|
18
|
+
> A noter qu'un `id` est nécessaire pour attribuer au textarea un label. Par ailleurs, l'attribut `value` permet de traiter son contenu.
|
|
19
|
+
|
|
20
|
+
<Canvas>
|
|
21
|
+
<Story name='PixTextarea' story={stories.textarea} height={100} />
|
|
22
|
+
</Canvas>
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
```html
|
|
27
|
+
<PixTextarea
|
|
28
|
+
@id={{id}}
|
|
29
|
+
@value={{value}}
|
|
30
|
+
@maxlength={{maxlength}}
|
|
31
|
+
@errorMessage={{errorMessage}} />
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Arguments
|
|
35
|
+
|
|
36
|
+
<ArgsTable story="PixTextarea" />
|