@1024pix/pix-ui 46.13.1 → 46.13.2
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/package.json +5 -5
- package/app/stories/form.mdx +0 -11
- package/app/stories/form.stories.js +0 -142
- package/app/stories/pix-background-header.mdx +0 -29
- package/app/stories/pix-background-header.stories.js +0 -33
- package/app/stories/pix-banner.mdx +0 -86
- package/app/stories/pix-banner.stories.js +0 -112
- package/app/stories/pix-block.mdx +0 -32
- package/app/stories/pix-block.stories.js +0 -22
- package/app/stories/pix-button-link.mdx +0 -39
- package/app/stories/pix-button-link.stories.js +0 -114
- package/app/stories/pix-button-upload.mdx +0 -26
- package/app/stories/pix-button-upload.stories.js +0 -81
- package/app/stories/pix-button.mdx +0 -79
- package/app/stories/pix-button.stories.js +0 -270
- package/app/stories/pix-checkbox-variant-tile.mdx +0 -49
- package/app/stories/pix-checkbox-variant-tile.stories.js +0 -102
- package/app/stories/pix-checkbox.mdx +0 -75
- package/app/stories/pix-checkbox.stories.js +0 -220
- package/app/stories/pix-collapsible.mdx +0 -37
- package/app/stories/pix-collapsible.stories.js +0 -104
- package/app/stories/pix-filter-banner.mdx +0 -26
- package/app/stories/pix-filter-banner.stories.js +0 -87
- package/app/stories/pix-filterable-and-searchable-select.mdx +0 -62
- package/app/stories/pix-filterable-and-searchable-select.stories.js +0 -202
- package/app/stories/pix-icon-button.mdx +0 -84
- package/app/stories/pix-icon-button.stories.js +0 -108
- package/app/stories/pix-icon.mdx +0 -20
- package/app/stories/pix-icon.stories.js +0 -51
- package/app/stories/pix-indicator-card.mdx +0 -41
- package/app/stories/pix-indicator-card.stories.js +0 -78
- package/app/stories/pix-input-code.mdx +0 -33
- package/app/stories/pix-input-code.stories.js +0 -75
- package/app/stories/pix-input-password.mdx +0 -76
- package/app/stories/pix-input-password.stories.js +0 -145
- package/app/stories/pix-input.mdx +0 -104
- package/app/stories/pix-input.stories.js +0 -175
- package/app/stories/pix-label.mdx +0 -47
- package/app/stories/pix-label.stories.js +0 -112
- package/app/stories/pix-message.mdx +0 -54
- package/app/stories/pix-message.stories.js +0 -61
- package/app/stories/pix-modal.mdx +0 -53
- package/app/stories/pix-modal.stories.js +0 -73
- package/app/stories/pix-multi-select.mdx +0 -55
- package/app/stories/pix-multi-select.stories.js +0 -290
- package/app/stories/pix-pagination.mdx +0 -56
- package/app/stories/pix-pagination.stories.js +0 -148
- package/app/stories/pix-progress-gauge.mdx +0 -40
- package/app/stories/pix-progress-gauge.stories.js +0 -117
- package/app/stories/pix-radio-button-variant-tile.mdx +0 -46
- package/app/stories/pix-radio-button-variant-tile.stories.js +0 -92
- package/app/stories/pix-radio-button.mdx +0 -59
- package/app/stories/pix-radio-button.stories.js +0 -165
- package/app/stories/pix-return-to.mdx +0 -34
- package/app/stories/pix-return-to.stories.js +0 -41
- package/app/stories/pix-search-input.mdx +0 -41
- package/app/stories/pix-search-input.stories.js +0 -117
- package/app/stories/pix-select.mdx +0 -80
- package/app/stories/pix-select.stories.js +0 -445
- package/app/stories/pix-selectable-tag.mdx +0 -37
- package/app/stories/pix-selectable-tag.stories.js +0 -69
- package/app/stories/pix-sidebar.mdx +0 -49
- package/app/stories/pix-sidebar.stories.js +0 -74
- package/app/stories/pix-stars.mdx +0 -22
- package/app/stories/pix-stars.stories.js +0 -45
- package/app/stories/pix-tag.mdx +0 -26
- package/app/stories/pix-tag.stories.js +0 -25
- package/app/stories/pix-textarea.mdx +0 -50
- package/app/stories/pix-textarea.stories.js +0 -146
- package/app/stories/pix-toggle.mdx +0 -28
- package/app/stories/pix-toggle.stories.js +0 -134
- package/app/stories/pix-tooltip.mdx +0 -183
- package/app/stories/pix-tooltip.stories.js +0 -215
- package/app/styles/app.scss +0 -0
- package/scripts/migrate-colors-scss-vars-to-css-vars.sh +0 -120
- package/scripts/migrate-spacing-scss-vars-to-css-vars.sh +0 -23
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { hbs } from 'ember-cli-htmlbars';
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
title: 'Others/PixStars',
|
|
5
|
-
argTypes: {
|
|
6
|
-
count: {
|
|
7
|
-
name: 'count',
|
|
8
|
-
description: 'Nombre total d’étoiles actives',
|
|
9
|
-
type: { name: 'number', required: false },
|
|
10
|
-
},
|
|
11
|
-
total: {
|
|
12
|
-
name: 'total',
|
|
13
|
-
description: 'Nombre total d’étoiles',
|
|
14
|
-
type: { name: 'number', required: false },
|
|
15
|
-
},
|
|
16
|
-
alt: {
|
|
17
|
-
name: 'alt',
|
|
18
|
-
description: 'Message alternatif pour les étoiles',
|
|
19
|
-
type: { name: 'string', required: true },
|
|
20
|
-
},
|
|
21
|
-
color: {
|
|
22
|
-
name: 'color',
|
|
23
|
-
description: 'Couleur des étoiles',
|
|
24
|
-
type: { name: 'string', required: false },
|
|
25
|
-
table: { defaultValue: { summary: undefined } },
|
|
26
|
-
control: { type: 'radio' },
|
|
27
|
-
options: [undefined, 'primary'],
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const Template = (args) => {
|
|
33
|
-
return {
|
|
34
|
-
template: hbs`<PixStars @count={{this.count}} @total={{this.total}} @alt={{this.alt}} @color={{this.color}} />`,
|
|
35
|
-
context: args,
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export const stars = Template.bind({});
|
|
40
|
-
stars.args = {
|
|
41
|
-
count: 2,
|
|
42
|
-
total: 5,
|
|
43
|
-
alt: 'message alternatif',
|
|
44
|
-
color: undefined,
|
|
45
|
-
};
|
package/app/stories/pix-tag.mdx
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Meta, Story, ArgTypes } from '@storybook/blocks';
|
|
2
|
-
import * as ComponentStories from './pix-tag.stories';
|
|
3
|
-
|
|
4
|
-
<Meta of={ComponentStories} />
|
|
5
|
-
|
|
6
|
-
# Pix Tag
|
|
7
|
-
|
|
8
|
-
Un `Tag` est un type de `Chips` qui permet de mettre en avant une information ou bien de la catégoriser.
|
|
9
|
-
|
|
10
|
-
> 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`)
|
|
11
|
-
|
|
12
|
-
<Story of={ComponentStories.tag} height={60} />
|
|
13
|
-
|
|
14
|
-
## Usage
|
|
15
|
-
|
|
16
|
-
```html
|
|
17
|
-
Par défaut:
|
|
18
|
-
<PixTag> This is a blue tag </PixTag>
|
|
19
|
-
|
|
20
|
-
Customiser la couleur du tag:
|
|
21
|
-
<PixTag @color="purple"> This is a purple tag </PixTag>
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
## Arguments
|
|
25
|
-
|
|
26
|
-
<ArgTypes />
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { hbs } from 'ember-cli-htmlbars';
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
title: 'Basics/Tag',
|
|
5
|
-
render: (args) => ({
|
|
6
|
-
template: hbs`<PixTag @color={{this.color}}>
|
|
7
|
-
Contenu du tag
|
|
8
|
-
</PixTag>`,
|
|
9
|
-
context: args,
|
|
10
|
-
}),
|
|
11
|
-
argTypes: {
|
|
12
|
-
color: {
|
|
13
|
-
name: 'color',
|
|
14
|
-
description: 'Couleur du tag',
|
|
15
|
-
type: { name: 'number', required: false },
|
|
16
|
-
table: { defaultValue: { summary: 'primary' } },
|
|
17
|
-
control: {
|
|
18
|
-
type: 'select',
|
|
19
|
-
},
|
|
20
|
-
options: ['neutral', 'secondary', 'tertiary', 'success', 'error', 'orga'],
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const tag = {};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { Meta, Story, ArgTypes } from '@storybook/blocks';
|
|
2
|
-
import * as ComponentStories from './pix-textarea.stories.js';
|
|
3
|
-
|
|
4
|
-
<Meta of={ComponentStories} />
|
|
5
|
-
|
|
6
|
-
# PixTextarea
|
|
7
|
-
|
|
8
|
-
Un textarea permettant d'avoir un champ de saisie libre.
|
|
9
|
-
|
|
10
|
-
Optionellement, il peut afficher le nombre de caractères tapés ainsi que le nombre de caractères maximum.
|
|
11
|
-
|
|
12
|
-
<Story of={ComponentStories.textarea} height={150} />
|
|
13
|
-
|
|
14
|
-
## Dimensions
|
|
15
|
-
|
|
16
|
-
Le PixTextarea prend tout l'espace à sa disposition.
|
|
17
|
-
|
|
18
|
-
<Story of={ComponentStories.FullWidth} height={290} />
|
|
19
|
-
|
|
20
|
-
## Accessibilité
|
|
21
|
-
|
|
22
|
-
La propriété label est optionnelle pour le composant.
|
|
23
|
-
|
|
24
|
-
Mais au niveau de l'accessibilité, il est quand même nécessaire que le champ soit rattaché à un label.
|
|
25
|
-
|
|
26
|
-
Il y a alors plusieurs possibilités :
|
|
27
|
-
|
|
28
|
-
- Vous pouvez cacher le label visuellement mais le rendre disponible pour les lecteurs d'écran via la propriété `screenReaderOnly` à `true`.
|
|
29
|
-
- Les attributs `aria-label` et `aria-labelledby` sont utilisables.
|
|
30
|
-
- Un attribut `@for` pointant vers l'id du textarea peut être ajouté à un composant `<PixLabel />` extérieur.
|
|
31
|
-
|
|
32
|
-
<Story of={ComponentStories.textareaWithoutLabel} height={100} />
|
|
33
|
-
|
|
34
|
-
## Usage
|
|
35
|
-
|
|
36
|
-
```html
|
|
37
|
-
<PixTextarea
|
|
38
|
-
@id="{{id}}"
|
|
39
|
-
@value="{{value}}"
|
|
40
|
-
@maxlength="{{maxlength}}"
|
|
41
|
-
@errorMessage="{{errorMessage}}"
|
|
42
|
-
@requiredLabel="{{requiredLabel}}"
|
|
43
|
-
>
|
|
44
|
-
<:label>{{label}}</:label>
|
|
45
|
-
</PixTextarea>
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
## Arguments
|
|
49
|
-
|
|
50
|
-
<ArgTypes of={ComponentStories} />
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { hbs } from 'ember-cli-htmlbars';
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
title: 'Form/Textarea',
|
|
5
|
-
argTypes: {
|
|
6
|
-
id: {
|
|
7
|
-
name: 'id',
|
|
8
|
-
description: 'id généré automatiquement, peut être définit manuellement si besoin',
|
|
9
|
-
type: { name: 'string', required: false },
|
|
10
|
-
},
|
|
11
|
-
value: {
|
|
12
|
-
name: 'value',
|
|
13
|
-
description: 'Valeur du champ',
|
|
14
|
-
type: { name: 'string', required: false },
|
|
15
|
-
},
|
|
16
|
-
maxlength: {
|
|
17
|
-
name: 'maxlength',
|
|
18
|
-
description: 'Nombre de caractères maximal à taper dans le champ',
|
|
19
|
-
type: { name: 'number', required: false },
|
|
20
|
-
},
|
|
21
|
-
errorMessage: {
|
|
22
|
-
name: 'errorMessage',
|
|
23
|
-
description: 'Affiche une erreur en dessous du champ.',
|
|
24
|
-
type: { name: 'string', required: false },
|
|
25
|
-
},
|
|
26
|
-
label: {
|
|
27
|
-
name: 'label',
|
|
28
|
-
description: 'Donne un label au champ.',
|
|
29
|
-
type: { name: 'string', required: false },
|
|
30
|
-
},
|
|
31
|
-
subLabel: {
|
|
32
|
-
name: 'subLabel',
|
|
33
|
-
description: 'Un descriptif complétant le label',
|
|
34
|
-
type: { name: 'string', required: false },
|
|
35
|
-
},
|
|
36
|
-
requiredLabel: {
|
|
37
|
-
name: 'requiredLabel',
|
|
38
|
-
description: 'Label indiquant que le champ est requis.',
|
|
39
|
-
type: { name: 'string', required: false },
|
|
40
|
-
table: {
|
|
41
|
-
type: { summary: 'string' },
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
screenReaderOnly: {
|
|
45
|
-
name: 'screenReaderOnly',
|
|
46
|
-
description: "Permet de rendre le label lisible uniquement par les lecteurs d'écran",
|
|
47
|
-
control: { type: 'boolean' },
|
|
48
|
-
type: { name: 'boolean', required: false },
|
|
49
|
-
table: {
|
|
50
|
-
type: { summary: 'boolean' },
|
|
51
|
-
defaultValue: { summary: false },
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
size: {
|
|
55
|
-
name: 'size',
|
|
56
|
-
description: 'Correspond à la taille de la police du label.',
|
|
57
|
-
type: { name: 'string', required: false },
|
|
58
|
-
table: {
|
|
59
|
-
defaultValue: { summary: 'default' },
|
|
60
|
-
},
|
|
61
|
-
control: { type: 'select' },
|
|
62
|
-
options: ['small', 'large', 'default'],
|
|
63
|
-
},
|
|
64
|
-
inlineLabel: {
|
|
65
|
-
name: 'inlineLabel',
|
|
66
|
-
description: 'Permet de ne pas afficher la marge pour les éléments de formulaire inline',
|
|
67
|
-
type: { name: 'boolean', required: false },
|
|
68
|
-
table: {
|
|
69
|
-
defaultValue: { summary: false },
|
|
70
|
-
},
|
|
71
|
-
control: { type: 'boolean' },
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
const Template = (args) => {
|
|
77
|
-
return {
|
|
78
|
-
template: hbs`<PixTextarea
|
|
79
|
-
@id={{this.id}}
|
|
80
|
-
@value={{this.value}}
|
|
81
|
-
@maxlength={{this.maxlength}}
|
|
82
|
-
@errorMessage={{this.errorMessage}}
|
|
83
|
-
@size={{this.size}}
|
|
84
|
-
@subLabel={{this.subLabel}}
|
|
85
|
-
@requiredLabel={{this.requiredLabel}}
|
|
86
|
-
@inlineLabel={{this.inlineLabel}}
|
|
87
|
-
><:label>{{this.label}}</:label></PixTextarea>`,
|
|
88
|
-
context: args,
|
|
89
|
-
};
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
const TemplateWithoutlabel = (args) => {
|
|
93
|
-
return {
|
|
94
|
-
template: hbs`<PixTextarea
|
|
95
|
-
@id={{this.id}}
|
|
96
|
-
@value={{this.value}}
|
|
97
|
-
@maxlength={{this.maxlength}}
|
|
98
|
-
@errorMessage={{this.errorMessage}}
|
|
99
|
-
@size={{this.size}}
|
|
100
|
-
@subLabel={{this.subLabel}}
|
|
101
|
-
@requiredLabel={{this.requiredLabel}}
|
|
102
|
-
@inlineLabel={{this.inlineLabel}}
|
|
103
|
-
/>`,
|
|
104
|
-
context: args,
|
|
105
|
-
};
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
export const textarea = Template.bind({});
|
|
109
|
-
textarea.args = {
|
|
110
|
-
id: 'textarea',
|
|
111
|
-
label: 'Label du textarea',
|
|
112
|
-
subLabel: 'Sous-label',
|
|
113
|
-
value: 'Contenu du textarea',
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
const FullWidthTemplate = (args) => {
|
|
117
|
-
return {
|
|
118
|
-
template: hbs`{{! template-lint-disable no-inline-styles }}
|
|
119
|
-
<div
|
|
120
|
-
style='border: 1px solid var(--pix-neutral-500); background: var(--pix-neutral-20); padding: var(--pix-spacing-4x); width: 500px; height: 250px;'
|
|
121
|
-
>
|
|
122
|
-
<PixTextarea
|
|
123
|
-
@id={{this.id}}
|
|
124
|
-
@value={{this.value}}
|
|
125
|
-
@subLabel={{this.subLabel}}
|
|
126
|
-
@maxlength={{this.maxlength}}
|
|
127
|
-
><:label>{{this.label}}</:label></PixTextarea>
|
|
128
|
-
</div>`,
|
|
129
|
-
context: args,
|
|
130
|
-
};
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
export const FullWidth = FullWidthTemplate.bind({});
|
|
134
|
-
FullWidth.args = {
|
|
135
|
-
id: 'textarea',
|
|
136
|
-
label: 'Label du textarea',
|
|
137
|
-
subLabel: 'Sous-label',
|
|
138
|
-
value: 'Contenu du textarea',
|
|
139
|
-
maxlength: 120,
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
export const textareaWithoutLabel = TemplateWithoutlabel.bind({});
|
|
143
|
-
textareaWithoutLabel.args = {
|
|
144
|
-
id: 'textarea-without-label',
|
|
145
|
-
value: 'Contenu du textarea sans label affiché',
|
|
146
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Meta, Story, ArgTypes } from '@storybook/blocks';
|
|
2
|
-
import * as ComponentStories from './pix-toggle.stories.js';
|
|
3
|
-
|
|
4
|
-
<Meta of={ComponentStories}/>
|
|
5
|
-
|
|
6
|
-
# Pix Toggle
|
|
7
|
-
|
|
8
|
-
Affiche un bouton à deux états.
|
|
9
|
-
|
|
10
|
-
## Default
|
|
11
|
-
|
|
12
|
-
<Story of={ComponentStories.Default} height={200} />
|
|
13
|
-
|
|
14
|
-
## Inline
|
|
15
|
-
|
|
16
|
-
<Story of={ComponentStories.Inline} height={200} />
|
|
17
|
-
|
|
18
|
-
## ScreenReaderOnly
|
|
19
|
-
|
|
20
|
-
<Story of={ComponentStories.ScreenReaderOnly} height={200} />
|
|
21
|
-
|
|
22
|
-
## WithYields
|
|
23
|
-
|
|
24
|
-
<Story of={ComponentStories.WithYields} height={200} />
|
|
25
|
-
|
|
26
|
-
## Arguments
|
|
27
|
-
|
|
28
|
-
<ArgTypes of={ComponentStories} />
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import { hbs } from 'ember-cli-htmlbars';
|
|
2
|
-
import { action } from '@storybook/addon-actions';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: 'Basics/Toggle',
|
|
6
|
-
argTypes: {
|
|
7
|
-
label: {
|
|
8
|
-
name: 'label',
|
|
9
|
-
description: 'Le label du PixToggle',
|
|
10
|
-
type: { name: 'string', required: true },
|
|
11
|
-
},
|
|
12
|
-
subLabel: {
|
|
13
|
-
name: 'subLabel',
|
|
14
|
-
description: 'Le sous label du PixToggle',
|
|
15
|
-
type: { name: 'string', required: true },
|
|
16
|
-
},
|
|
17
|
-
size: {
|
|
18
|
-
name: 'size',
|
|
19
|
-
description: 'Correspond à la taille de la police du label.',
|
|
20
|
-
type: { name: 'string', required: false },
|
|
21
|
-
table: {
|
|
22
|
-
defaultValue: { summary: 'default' },
|
|
23
|
-
},
|
|
24
|
-
control: { type: 'select' },
|
|
25
|
-
options: ['small', 'large', 'default'],
|
|
26
|
-
},
|
|
27
|
-
onLabel: {
|
|
28
|
-
name: 'onLabel',
|
|
29
|
-
description: "Le label de l'état actif du PixToggle",
|
|
30
|
-
type: { name: 'string', required: false },
|
|
31
|
-
},
|
|
32
|
-
offLabel: {
|
|
33
|
-
name: 'offLabel',
|
|
34
|
-
description: "Le label de l'état non actif du PixToggle",
|
|
35
|
-
type: { name: 'string', required: false },
|
|
36
|
-
},
|
|
37
|
-
toggled: {
|
|
38
|
-
name: 'toggled',
|
|
39
|
-
description: 'Détermine si le PixToggle est activé',
|
|
40
|
-
type: { name: 'boolean', required: true },
|
|
41
|
-
},
|
|
42
|
-
onChange: {
|
|
43
|
-
name: 'onChange',
|
|
44
|
-
description: "Fonction à appeler quand le PixToggle change d'état.",
|
|
45
|
-
type: { required: true },
|
|
46
|
-
control: { disable: true },
|
|
47
|
-
},
|
|
48
|
-
inlineLabel: {
|
|
49
|
-
name: 'inlineLabel',
|
|
50
|
-
description: "Permet d'afficher le PixToggle sur une seule ligne",
|
|
51
|
-
control: { type: 'boolean' },
|
|
52
|
-
type: { name: 'boolean', required: false },
|
|
53
|
-
table: {
|
|
54
|
-
type: { summary: 'boolean' },
|
|
55
|
-
defaultValue: { summary: false },
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
screenReaderOnly: {
|
|
59
|
-
name: 'screenReaderOnly',
|
|
60
|
-
description: "Permet de rendre le label lisible uniquement par les lecteurs d'écran",
|
|
61
|
-
control: { type: 'boolean' },
|
|
62
|
-
type: { name: 'boolean', required: false },
|
|
63
|
-
table: {
|
|
64
|
-
type: { summary: 'boolean' },
|
|
65
|
-
defaultValue: { summary: false },
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
const Template = (args) => {
|
|
72
|
-
return {
|
|
73
|
-
template: hbs`<PixToggle
|
|
74
|
-
@onLabel={{this.onLabel}}
|
|
75
|
-
@offLabel={{this.offLabel}}
|
|
76
|
-
@toggled={{this.toggled}}
|
|
77
|
-
@onChange={{this.onChange}}
|
|
78
|
-
@size={{this.size}}
|
|
79
|
-
@subLabel={{this.subLabel}}
|
|
80
|
-
@inlineLabel={{this.inlineLabel}}
|
|
81
|
-
@screenReaderOnly={{this.screenReaderOnly}}
|
|
82
|
-
>
|
|
83
|
-
<:label>{{this.label}}</:label>
|
|
84
|
-
</PixToggle>`,
|
|
85
|
-
context: args,
|
|
86
|
-
};
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
const TemplateWithYields = (args) => {
|
|
90
|
-
return {
|
|
91
|
-
template: hbs`<PixToggle @toggled={{this.toggled}} @onChange={{this.onChange}}>
|
|
92
|
-
<:label>{{this.label}}</:label>
|
|
93
|
-
<:on><FaIcon @icon='eye' /></:on>
|
|
94
|
-
<:off><FaIcon @icon='eye-slash' /></:off>
|
|
95
|
-
</PixToggle>`,
|
|
96
|
-
context: args,
|
|
97
|
-
};
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
export const Default = Template.bind({});
|
|
101
|
-
Default.args = {
|
|
102
|
-
label: 'Mon toggle',
|
|
103
|
-
onLabel: 'Option A',
|
|
104
|
-
offLabel: 'Option B',
|
|
105
|
-
toggled: false,
|
|
106
|
-
onChange: action('onChange'),
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
export const Inline = Template.bind({});
|
|
110
|
-
Inline.args = {
|
|
111
|
-
inline: true,
|
|
112
|
-
label: 'Mon toggle',
|
|
113
|
-
onLabel: 'Option A',
|
|
114
|
-
offLabel: 'Option B',
|
|
115
|
-
toggled: false,
|
|
116
|
-
onChange: action('onChange'),
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
export const ScreenReaderOnly = Template.bind({});
|
|
120
|
-
ScreenReaderOnly.args = {
|
|
121
|
-
screenReaderOnly: true,
|
|
122
|
-
label: 'Mon toggle',
|
|
123
|
-
onLabel: 'Option A',
|
|
124
|
-
offLabel: 'Option B',
|
|
125
|
-
toggled: false,
|
|
126
|
-
onChange: action('onChange'),
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
export const WithYields = TemplateWithYields.bind({});
|
|
130
|
-
WithYields.args = {
|
|
131
|
-
label: 'Mon toggle',
|
|
132
|
-
toggled: false,
|
|
133
|
-
onChange: action('onChange'),
|
|
134
|
-
};
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import { Meta, Story, ArgTypes } from '@storybook/blocks';
|
|
2
|
-
import * as ComponentStories from './pix-tooltip.stories';
|
|
3
|
-
|
|
4
|
-
<Meta of={ComponentStories} />
|
|
5
|
-
|
|
6
|
-
# Pix Tooltip
|
|
7
|
-
|
|
8
|
-
Une infobulle qui s'affiche au survol d'un élément.
|
|
9
|
-
|
|
10
|
-
Ce composant est utilisé comme wrapper, c'est à dire qu'il encadre l'élément sur lequel on souhaite ajouter une infobulle. L'utilisation de `Named Block` permet d'utiliser des composants HTML facilement dans la tooltip.
|
|
11
|
-
|
|
12
|
-
> ⚠️ A noter que le wrapper PixTooltip est en `display: flex;`, il s'adaptera donc à la taille de ses enfants. Ainsi si votre élément ne s'affiche plus comme avant après l'ajout de la PixTooltip, veillez à rajouter les dimensions voulues à l'enfant.
|
|
13
|
-
|
|
14
|
-
> ⚠️ L'infobulle ne s'affichera pas si le texte est vide.
|
|
15
|
-
|
|
16
|
-
## Accessibilité
|
|
17
|
-
|
|
18
|
-
Les tooltips doivent être appliquées de préférences sur des éléments nativement focusable comme `<button>` ou `<input>`.
|
|
19
|
-
|
|
20
|
-
Si vous utilisez un élément `<div>` ou `<span>`, il faut ajouter `tabindex="0"` pour qu'il prenne le focus.
|
|
21
|
-
|
|
22
|
-
```html
|
|
23
|
-
<PixTooltip>
|
|
24
|
-
<:triggerElement>
|
|
25
|
-
<span tabindex="0">Mon span</span>
|
|
26
|
-
</:triggerElement>
|
|
27
|
-
|
|
28
|
-
<:tooltip>
|
|
29
|
-
My tooltip
|
|
30
|
-
</:tooltip>
|
|
31
|
-
</PixTooltip>
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
Les tooltips doivent prendre un `@id` et être référencées par leur élément déclencheur
|
|
35
|
-
|
|
36
|
-
- soit via `aria-describedby` si l'élément possèdent déjà un label, car le tooltip agit alors comme une description supplémentaire.
|
|
37
|
-
|
|
38
|
-
```html
|
|
39
|
-
<PixTooltip @id="tooltip-1">
|
|
40
|
-
<:triggerElement>
|
|
41
|
-
<PixButton aria-describedby="tooltip-1">Mon bouton</PixButton>
|
|
42
|
-
</:triggerElement>
|
|
43
|
-
|
|
44
|
-
<:tooltip>
|
|
45
|
-
My tooltip
|
|
46
|
-
</:tooltip>
|
|
47
|
-
</PixTooltip>
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
- soit via `aria-labelledby` si l'élément ne possède pas de label et que le tooltip fait office de libellé.
|
|
51
|
-
|
|
52
|
-
```html
|
|
53
|
-
<PixTooltip @id="tooltip-2" @text="Cette information apparaît uniquement au survol de l'icone">
|
|
54
|
-
<span class="icon icon-info" aria-labelledby="tooltip-2"></span>
|
|
55
|
-
</PixTooltip>
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
## Default
|
|
59
|
-
|
|
60
|
-
Infobulle en position `top`, fond sombre (par défaut).
|
|
61
|
-
|
|
62
|
-
<Story of={ComponentStories.Default} height={200} />
|
|
63
|
-
<Story of={ComponentStories.WithIcon} height={200} />
|
|
64
|
-
<Story of={ComponentStories.WithInput} height={200} />
|
|
65
|
-
|
|
66
|
-
## Is Light
|
|
67
|
-
|
|
68
|
-
Infobulle en mode clair.
|
|
69
|
-
|
|
70
|
-
> ⚠️ le tooltip "light" est à utiliser de préférence sur fond coloré ! Mais ce n'est pas obligatoire.
|
|
71
|
-
|
|
72
|
-
<Story of={ComponentStories.isLight} height={200} />
|
|
73
|
-
|
|
74
|
-
## Position
|
|
75
|
-
|
|
76
|
-
Différentes positions de l'infobulle.
|
|
77
|
-
Existe aussi `top-left`, `top-right`, `bottom-left` et `bottom-right`.
|
|
78
|
-
|
|
79
|
-
<Story of={ComponentStories.left} height={100} />
|
|
80
|
-
<Story of={ComponentStories.right} height={100} />
|
|
81
|
-
<Story of={ComponentStories.bottom} height={150} />
|
|
82
|
-
|
|
83
|
-
## Is Wide
|
|
84
|
-
|
|
85
|
-
Infobulle en plus large.
|
|
86
|
-
|
|
87
|
-
<Story of={ComponentStories.isWide} height={200} />
|
|
88
|
-
|
|
89
|
-
## Is Inline
|
|
90
|
-
|
|
91
|
-
Infobulle dont le contenu reste sur une ligne.
|
|
92
|
-
|
|
93
|
-
<Story of={ComponentStories.isInline} height={200} />
|
|
94
|
-
|
|
95
|
-
## With HTML
|
|
96
|
-
|
|
97
|
-
Infobulle contenant des éléments HTML
|
|
98
|
-
|
|
99
|
-
<Story of={ComponentStories.WithHTML} height={200} />
|
|
100
|
-
|
|
101
|
-
## Hide
|
|
102
|
-
|
|
103
|
-
Cache la tooltip (par exemple si le contenu est vide).
|
|
104
|
-
|
|
105
|
-
<Story of={ComponentStories.hide} height={200} />
|
|
106
|
-
|
|
107
|
-
## Usage
|
|
108
|
-
|
|
109
|
-
```html
|
|
110
|
-
<PixTooltip>
|
|
111
|
-
<:triggerElement>
|
|
112
|
-
<button>Tooltip par défaut</button>
|
|
113
|
-
</:triggerElement>
|
|
114
|
-
<:tooltip>
|
|
115
|
-
<FaIcon @icon="up-right-from-square" /> Avec des <strong>éléments</strong> HTML/Ember
|
|
116
|
-
</:tooltip>
|
|
117
|
-
</PixTooltip>
|
|
118
|
-
|
|
119
|
-
<PixTooltip
|
|
120
|
-
@isLight={{true}}
|
|
121
|
-
>
|
|
122
|
-
<:triggerElement>
|
|
123
|
-
<button>Tooltip en mode clair</button>
|
|
124
|
-
</:triggerElement>
|
|
125
|
-
|
|
126
|
-
<:tooltip>
|
|
127
|
-
Hey
|
|
128
|
-
</:tooltip>
|
|
129
|
-
</PixTooltip>
|
|
130
|
-
|
|
131
|
-
<PixTooltip
|
|
132
|
-
@isLight={{true}}
|
|
133
|
-
>
|
|
134
|
-
<:triggerElement>
|
|
135
|
-
<button>Tooltip sur une ligne</button>
|
|
136
|
-
</:triggerElement>
|
|
137
|
-
|
|
138
|
-
<:tooltip>
|
|
139
|
-
Hey
|
|
140
|
-
</:tooltip>
|
|
141
|
-
</PixTooltip>
|
|
142
|
-
|
|
143
|
-
<PixTooltip
|
|
144
|
-
@position='bottom'
|
|
145
|
-
@isLight={{true}}
|
|
146
|
-
>
|
|
147
|
-
<:triggerElement>
|
|
148
|
-
<button>Tooltip apparaissant en bas</button>
|
|
149
|
-
</:triggerElement>
|
|
150
|
-
|
|
151
|
-
<:tooltip>
|
|
152
|
-
Hey
|
|
153
|
-
</:tooltip>
|
|
154
|
-
</PixTooltip>
|
|
155
|
-
|
|
156
|
-
<PixTooltip
|
|
157
|
-
@hide={{true}}
|
|
158
|
-
>
|
|
159
|
-
<:triggerElement>
|
|
160
|
-
<button>Tooltip n'apparaissant pas</button>
|
|
161
|
-
</:triggerElement>
|
|
162
|
-
|
|
163
|
-
<:tooltip>
|
|
164
|
-
Hey
|
|
165
|
-
</:tooltip>
|
|
166
|
-
</PixTooltip>
|
|
167
|
-
|
|
168
|
-
<PixTooltip
|
|
169
|
-
@isWide={{true}}
|
|
170
|
-
>
|
|
171
|
-
<:triggerElement>
|
|
172
|
-
<button>Tooltip en mode large</button>
|
|
173
|
-
</:triggerElement>
|
|
174
|
-
|
|
175
|
-
<:tooltip>
|
|
176
|
-
Hey
|
|
177
|
-
</:tooltip>
|
|
178
|
-
</PixTooltip>
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
## Arguments
|
|
182
|
-
|
|
183
|
-
<ArgTypes of={ComponentStories} />
|