@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,136 @@
|
|
|
1
|
+
import { hbs } from 'ember-cli-htmlbars';
|
|
2
|
+
|
|
3
|
+
const Template = (args) => {
|
|
4
|
+
return {
|
|
5
|
+
template: hbs`
|
|
6
|
+
<PixTooltipDeprecated
|
|
7
|
+
@id="tooltip-1"
|
|
8
|
+
@text={{this.text}}
|
|
9
|
+
@position={{this.position}}
|
|
10
|
+
@isLight={{this.isLight}}
|
|
11
|
+
@isInline={{this.isInline}}
|
|
12
|
+
@isWide={{this.isWide}}
|
|
13
|
+
@unescapeHtml={{this.unescapeHtml}}
|
|
14
|
+
>
|
|
15
|
+
<PixButton aria-describedby="tooltip-1">
|
|
16
|
+
{{this.label}}
|
|
17
|
+
</PixButton>
|
|
18
|
+
</PixTooltipDeprecated>
|
|
19
|
+
`,
|
|
20
|
+
context: args,
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const Default = Template.bind({});
|
|
25
|
+
Default.args = {
|
|
26
|
+
text: 'Hello World',
|
|
27
|
+
label: 'À survoler pour voir la tooltip',
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const isLight = Template.bind({});
|
|
31
|
+
isLight.args = {
|
|
32
|
+
...Default.args,
|
|
33
|
+
isLight: true,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const isWide = Template.bind({});
|
|
37
|
+
isWide.args = {
|
|
38
|
+
...Default.args,
|
|
39
|
+
text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut egestas molestie mauris vel viverra.',
|
|
40
|
+
isWide: true,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const isInline = Template.bind({});
|
|
44
|
+
isInline.args = {
|
|
45
|
+
...Default.args,
|
|
46
|
+
text: 'Je suis une trèèèèèèèès longue information',
|
|
47
|
+
isInline: true,
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const left = Template.bind({});
|
|
51
|
+
left.args = {
|
|
52
|
+
...Default.args,
|
|
53
|
+
label: 'Mon infobulle apparaît à gauche',
|
|
54
|
+
position: 'left',
|
|
55
|
+
isInline: true,
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const right = Template.bind({});
|
|
59
|
+
right.args = {
|
|
60
|
+
...Default.args,
|
|
61
|
+
label: 'Mon infobulle apparaît à droite',
|
|
62
|
+
position: 'right',
|
|
63
|
+
isInline: true,
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const bottom = Template.bind({});
|
|
67
|
+
bottom.args = {
|
|
68
|
+
...Default.args,
|
|
69
|
+
label: 'Mon infobulle apparaît en bas',
|
|
70
|
+
position: 'bottom',
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export const unescapeHtml = Template.bind({});
|
|
74
|
+
unescapeHtml.args = {
|
|
75
|
+
...Default.args,
|
|
76
|
+
text: 'Hello <b style="color: red;">W</b>orld',
|
|
77
|
+
label: "J'affiche du html",
|
|
78
|
+
unescapeHtml: true,
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export const argTypes = {
|
|
82
|
+
id: {
|
|
83
|
+
name: 'id',
|
|
84
|
+
description: 'Identifiant permettant de référencer le déclencheur via aria-describedby',
|
|
85
|
+
type: { name: 'string', required: true },
|
|
86
|
+
},
|
|
87
|
+
text: {
|
|
88
|
+
name: 'text',
|
|
89
|
+
defaultValue: 'Tooltiptop',
|
|
90
|
+
description: 'Texte à afficher',
|
|
91
|
+
type: { name: 'string', required: false },
|
|
92
|
+
},
|
|
93
|
+
position: {
|
|
94
|
+
name: 'position',
|
|
95
|
+
description: 'Position de la tooltip',
|
|
96
|
+
type: { name: 'string', required: false },
|
|
97
|
+
table: { defaultValue: { summary: 'top' } },
|
|
98
|
+
control: {
|
|
99
|
+
type: 'select',
|
|
100
|
+
options: [
|
|
101
|
+
'top',
|
|
102
|
+
'top-left',
|
|
103
|
+
'top-right',
|
|
104
|
+
'right',
|
|
105
|
+
'bottom',
|
|
106
|
+
'bottom-left',
|
|
107
|
+
'bottom-right',
|
|
108
|
+
'left',
|
|
109
|
+
],
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
isLight: {
|
|
113
|
+
name: 'isLight',
|
|
114
|
+
description: 'Affichage en mode clair',
|
|
115
|
+
type: { name: 'boolean', required: false },
|
|
116
|
+
table: { defaultValue: { summary: false } },
|
|
117
|
+
},
|
|
118
|
+
isInline: {
|
|
119
|
+
name: 'isInline',
|
|
120
|
+
description: 'Affichage en une seule ligne',
|
|
121
|
+
type: { name: 'boolean', required: false },
|
|
122
|
+
table: { defaultValue: { summary: false } },
|
|
123
|
+
},
|
|
124
|
+
isWide: {
|
|
125
|
+
name: 'isWide',
|
|
126
|
+
description: 'Affichage large',
|
|
127
|
+
type: { name: 'boolean', required: false },
|
|
128
|
+
table: { defaultValue: { summary: false } },
|
|
129
|
+
},
|
|
130
|
+
unescapeHtml: {
|
|
131
|
+
name: 'unescapeHtml',
|
|
132
|
+
description: "Évite d'échapper les caractères HTML",
|
|
133
|
+
type: { name: 'boolean', required: false },
|
|
134
|
+
table: { defaultValue: { summary: false } },
|
|
135
|
+
},
|
|
136
|
+
};
|
|
@@ -0,0 +1,143 @@
|
|
|
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-tooltip-deprecated.stories.js';
|
|
4
|
+
|
|
5
|
+
<Meta
|
|
6
|
+
title='Basics/TooltipDeprecated (3.24 Compliant)'
|
|
7
|
+
component='PixTooltipDeprecated'
|
|
8
|
+
decorators={[centered]}
|
|
9
|
+
argTypes={stories.argTypes}
|
|
10
|
+
/>
|
|
11
|
+
|
|
12
|
+
# Pix Tooltip
|
|
13
|
+
|
|
14
|
+
Une infobulle qui s'affiche au survol d'un élément.
|
|
15
|
+
|
|
16
|
+
Ce composant est utilisé comme wrapper, c'est à dire qu'il encadre l'élément sur lequel on souhaite ajouter une infobulle.
|
|
17
|
+
|
|
18
|
+
> ⚠️ A noter que le wrapper PixTooltipDeprecated 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 PixTooltipDeprecated, veillez à rajouter les dimensions voulues à l'enfant.
|
|
19
|
+
|
|
20
|
+
> ⚠️ L'infobulle ne s'affichera pas si le texte est vide.
|
|
21
|
+
|
|
22
|
+
## Accessibilité
|
|
23
|
+
|
|
24
|
+
Les tooltips doivent être appliquées de préférences sur des éléments nativement focusable comme `<button>` ou `<input>`.
|
|
25
|
+
|
|
26
|
+
Si vous utilisez un élément `<div>` ou `<span>`, il faut ajouter `tabindex="0"` pour qu'il prenne le focus.
|
|
27
|
+
|
|
28
|
+
```html
|
|
29
|
+
<PixTooltipDeprecated @text="My tooltip">
|
|
30
|
+
<span tabindex="0">Mon span</span>
|
|
31
|
+
</PixTooltipDeprecated>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Les tooltips doivent prendre un `@id` et être référencées par leur élément déclencheur via `aria-describedby`:
|
|
35
|
+
|
|
36
|
+
```html
|
|
37
|
+
<PixTooltipDeprecated @id="tooltip-1" @text="My tooltip">
|
|
38
|
+
<PixButton aria-describedby="tooltip-1">Mon bouton</PixButton>
|
|
39
|
+
</PixTooltipDeprecated>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Default
|
|
43
|
+
|
|
44
|
+
Infobulle en position `top`, fond sombre (par défaut).
|
|
45
|
+
|
|
46
|
+
<Canvas>
|
|
47
|
+
<Story name="Default" story={stories.Default} height={200} />
|
|
48
|
+
</Canvas>
|
|
49
|
+
|
|
50
|
+
## Is Light
|
|
51
|
+
|
|
52
|
+
Infobulle en mode clair.
|
|
53
|
+
|
|
54
|
+
> ⚠️ le tooltip "light" est à utiliser de préférence sur fond coloré ! Mais ce n'est pas obligatoire.
|
|
55
|
+
|
|
56
|
+
<Canvas>
|
|
57
|
+
<Story name="Is Light" story={stories.isLight} height={200} />
|
|
58
|
+
</Canvas>
|
|
59
|
+
|
|
60
|
+
## Position
|
|
61
|
+
|
|
62
|
+
Différentes positions de l'infobulle.
|
|
63
|
+
Existe aussi `top-left`, `top-right`, `bottom-left` et `bottom-right`.
|
|
64
|
+
|
|
65
|
+
<Canvas isColumn>
|
|
66
|
+
<Story name="Left" story={stories.left} height={100} />
|
|
67
|
+
<Story name="Right" story={stories.right} height={100} />
|
|
68
|
+
<Story name="Bottom" story={stories.bottom} height={150} />
|
|
69
|
+
</Canvas>
|
|
70
|
+
|
|
71
|
+
## Is Wide
|
|
72
|
+
|
|
73
|
+
Infobulle en plus large.
|
|
74
|
+
|
|
75
|
+
<Canvas>
|
|
76
|
+
<Story name="Is Wide" story={stories.isWide} height={200} />
|
|
77
|
+
</Canvas>
|
|
78
|
+
|
|
79
|
+
## Is Inline
|
|
80
|
+
|
|
81
|
+
Infobulle dont le contenu reste sur une ligne.
|
|
82
|
+
|
|
83
|
+
<Canvas>
|
|
84
|
+
<Story name="Is Inline" story={stories.isInline} height={200} />
|
|
85
|
+
</Canvas>
|
|
86
|
+
|
|
87
|
+
## unescape HTML
|
|
88
|
+
|
|
89
|
+
N'échappe pas l'HTML (Affiche du HTML formaté)
|
|
90
|
+
|
|
91
|
+
<Canvas>
|
|
92
|
+
<Story name="unescape HTML" story={stories.unescapeHtml} height={200} />
|
|
93
|
+
</Canvas>
|
|
94
|
+
|
|
95
|
+
## Usage
|
|
96
|
+
|
|
97
|
+
```html
|
|
98
|
+
<PixTooltipDeprecated
|
|
99
|
+
@text='Hey'
|
|
100
|
+
>
|
|
101
|
+
<button>Tooltip par défaut</button>
|
|
102
|
+
</PixTooltipDeprecated>
|
|
103
|
+
|
|
104
|
+
<PixTooltipDeprecated
|
|
105
|
+
@text='Hey'
|
|
106
|
+
@isLight={{true}}
|
|
107
|
+
>
|
|
108
|
+
<button>Tooltip en mode clair</button>
|
|
109
|
+
</PixTooltipDeprecated>
|
|
110
|
+
|
|
111
|
+
<PixTooltipDeprecated
|
|
112
|
+
@text='Hey'
|
|
113
|
+
@isLight={{true}}
|
|
114
|
+
>
|
|
115
|
+
<button>Tooltip sur une ligne</button>
|
|
116
|
+
</PixTooltipDeprecated>
|
|
117
|
+
|
|
118
|
+
<PixTooltipDeprecated
|
|
119
|
+
@text='Hey'
|
|
120
|
+
@position='bottom'
|
|
121
|
+
@isLight={{true}}
|
|
122
|
+
>
|
|
123
|
+
<button>Tooltip apparaissant en bas</button>
|
|
124
|
+
</PixTooltipDeprecated>
|
|
125
|
+
|
|
126
|
+
<PixTooltipDeprecated
|
|
127
|
+
@text='Hey'
|
|
128
|
+
@isWide={{true}}
|
|
129
|
+
>
|
|
130
|
+
<button>Tooltip en mode large</button>
|
|
131
|
+
</PixTooltipDeprecated>
|
|
132
|
+
|
|
133
|
+
<PixTooltipDeprecated
|
|
134
|
+
@text='Super <b style="color: green">i</b>n<b style="color: green">f</b>o'
|
|
135
|
+
@unescapeHtml={{true}}
|
|
136
|
+
>
|
|
137
|
+
<button>Html tooltip</button>
|
|
138
|
+
</PixTooltipDeprecated>
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Arguments
|
|
142
|
+
|
|
143
|
+
<ArgsTable story="Default" />
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { hbs } from 'ember-cli-htmlbars';
|
|
2
|
+
|
|
3
|
+
const Template = (args) => {
|
|
4
|
+
return {
|
|
5
|
+
template: hbs`
|
|
6
|
+
<PixTooltip
|
|
7
|
+
@id={{this.id}}
|
|
8
|
+
@position={{this.position}}
|
|
9
|
+
@isLight={{this.isLight}}
|
|
10
|
+
@isInline={{this.isInline}}
|
|
11
|
+
@isWide={{this.isWide}}>
|
|
12
|
+
<:triggerElement>
|
|
13
|
+
<PixButton aria-describedby={{this.id}}>
|
|
14
|
+
{{this.label}}
|
|
15
|
+
</PixButton>
|
|
16
|
+
</:triggerElement>
|
|
17
|
+
|
|
18
|
+
<:tooltip>
|
|
19
|
+
{{this.text}}
|
|
20
|
+
</:tooltip>
|
|
21
|
+
</PixTooltip>
|
|
22
|
+
`,
|
|
23
|
+
context: args,
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const TemplateWithHTMLElement = (args) => {
|
|
28
|
+
return {
|
|
29
|
+
template: hbs`
|
|
30
|
+
<PixTooltip
|
|
31
|
+
@id={{this.id}}
|
|
32
|
+
@isInline=true>
|
|
33
|
+
<:triggerElement>
|
|
34
|
+
<PixButton aria-describedby={{this.id}}>
|
|
35
|
+
{{this.label}}
|
|
36
|
+
</PixButton>
|
|
37
|
+
</:triggerElement>
|
|
38
|
+
|
|
39
|
+
<:tooltip>
|
|
40
|
+
<FaIcon @icon="external-link-alt" /> <strong>HTML/Ember</strong>
|
|
41
|
+
</:tooltip>
|
|
42
|
+
</PixTooltip>
|
|
43
|
+
`,
|
|
44
|
+
context: args,
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const Default = Template.bind({});
|
|
49
|
+
Default.args = {
|
|
50
|
+
text: 'Hello World',
|
|
51
|
+
label: 'À survoler pour voir la tooltip',
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const isLight = Template.bind({});
|
|
55
|
+
isLight.args = {
|
|
56
|
+
...Default.args,
|
|
57
|
+
id: 'tooltip-light',
|
|
58
|
+
isLight: true,
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export const isWide = Template.bind({});
|
|
62
|
+
isWide.args = {
|
|
63
|
+
...Default.args,
|
|
64
|
+
id: 'tooltip-wide',
|
|
65
|
+
text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut egestas molestie mauris vel viverra.',
|
|
66
|
+
isWide: true,
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export const isInline = Template.bind({});
|
|
70
|
+
isInline.args = {
|
|
71
|
+
...Default.args,
|
|
72
|
+
id: 'tooltip-large',
|
|
73
|
+
text: 'Je suis une trèèèèèèèès longue information',
|
|
74
|
+
isInline: true,
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export const left = Template.bind({});
|
|
78
|
+
left.args = {
|
|
79
|
+
...Default.args,
|
|
80
|
+
id: 'tooltip-left',
|
|
81
|
+
label: 'Mon infobulle apparaît à gauche',
|
|
82
|
+
position: 'left',
|
|
83
|
+
isInline: true,
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export const right = Template.bind({});
|
|
87
|
+
right.args = {
|
|
88
|
+
...Default.args,
|
|
89
|
+
id: 'tooltip-right',
|
|
90
|
+
label: 'Mon infobulle apparaît à droite',
|
|
91
|
+
position: 'right',
|
|
92
|
+
isInline: true,
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export const bottom = Template.bind({});
|
|
96
|
+
bottom.args = {
|
|
97
|
+
...Default.args,
|
|
98
|
+
id: 'tooltip-bottom',
|
|
99
|
+
label: 'Mon infobulle apparaît en bas',
|
|
100
|
+
position: 'bottom',
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export const WithHTML = TemplateWithHTMLElement.bind({});
|
|
104
|
+
WithHTML.args = {
|
|
105
|
+
label: 'À survoler pour voir la tooltip',
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export const argTypes = {
|
|
109
|
+
id: {
|
|
110
|
+
name: 'id',
|
|
111
|
+
description: 'Identifiant permettant de référencer le déclencheur via aria-describedby',
|
|
112
|
+
type: { name: 'string', required: true },
|
|
113
|
+
},
|
|
114
|
+
text: {
|
|
115
|
+
name: 'text',
|
|
116
|
+
defaultValue: 'Tooltiptop',
|
|
117
|
+
description: 'Texte à afficher',
|
|
118
|
+
type: { name: 'string', required: false },
|
|
119
|
+
},
|
|
120
|
+
position: {
|
|
121
|
+
name: 'position',
|
|
122
|
+
description: 'Position de la tooltip',
|
|
123
|
+
type: { name: 'string', required: false },
|
|
124
|
+
table: { defaultValue: { summary: 'top' } },
|
|
125
|
+
control: {
|
|
126
|
+
type: 'select',
|
|
127
|
+
options: [
|
|
128
|
+
'top',
|
|
129
|
+
'top-left',
|
|
130
|
+
'top-right',
|
|
131
|
+
'right',
|
|
132
|
+
'bottom',
|
|
133
|
+
'bottom-left',
|
|
134
|
+
'bottom-right',
|
|
135
|
+
'left',
|
|
136
|
+
],
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
isLight: {
|
|
140
|
+
name: 'isLight',
|
|
141
|
+
description: 'Affichage en mode clair',
|
|
142
|
+
type: { name: 'boolean', required: false },
|
|
143
|
+
table: { defaultValue: { summary: false } },
|
|
144
|
+
},
|
|
145
|
+
isInline: {
|
|
146
|
+
name: 'isInline',
|
|
147
|
+
description: 'Affichage en une seule ligne',
|
|
148
|
+
type: { name: 'boolean', required: false },
|
|
149
|
+
table: { defaultValue: { summary: false } },
|
|
150
|
+
},
|
|
151
|
+
isWide: {
|
|
152
|
+
name: 'isWide',
|
|
153
|
+
description: 'Affichage large',
|
|
154
|
+
type: { name: 'boolean', required: false },
|
|
155
|
+
table: { defaultValue: { summary: false } },
|
|
156
|
+
},
|
|
157
|
+
};
|
|
@@ -0,0 +1,183 @@
|
|
|
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-tooltip.stories.js';
|
|
4
|
+
|
|
5
|
+
<Meta
|
|
6
|
+
title='Basics/Tooltip'
|
|
7
|
+
component='PixTooltip'
|
|
8
|
+
decorators={[centered]}
|
|
9
|
+
argTypes={stories.argTypes}
|
|
10
|
+
/>
|
|
11
|
+
|
|
12
|
+
# Pix Tooltip
|
|
13
|
+
|
|
14
|
+
Une infobulle qui s'affiche au survol d'un élément.
|
|
15
|
+
|
|
16
|
+
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.
|
|
17
|
+
|
|
18
|
+
> ⚠️ 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.
|
|
19
|
+
|
|
20
|
+
> ⚠️ L'infobulle ne s'affichera pas si le texte est vide.
|
|
21
|
+
|
|
22
|
+
## Accessibilité
|
|
23
|
+
|
|
24
|
+
Les tooltips doivent être appliquées de préférences sur des éléments nativement focusable comme `<button>` ou `<input>`.
|
|
25
|
+
|
|
26
|
+
Si vous utilisez un élément `<div>` ou `<span>`, il faut ajouter `tabindex="0"` pour qu'il prenne le focus.
|
|
27
|
+
|
|
28
|
+
```html
|
|
29
|
+
<PixTooltip>
|
|
30
|
+
<:triggerElement>
|
|
31
|
+
<span tabindex="0">Mon span</span>
|
|
32
|
+
</:triggerElement>
|
|
33
|
+
|
|
34
|
+
<:tooltip>
|
|
35
|
+
My tooltip
|
|
36
|
+
</:tooltip>
|
|
37
|
+
</PixTooltip>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Les tooltips doivent prendre un `@id` et être référencées par leur élément déclencheur
|
|
41
|
+
|
|
42
|
+
- soit via `aria-describedby` si l'élément possèdent déjà un label, car le tooltip agit alors comme une description supplémentaire.
|
|
43
|
+
|
|
44
|
+
```html
|
|
45
|
+
<PixTooltip @id="tooltip-1">
|
|
46
|
+
<:triggerElement>
|
|
47
|
+
<PixButton aria-describedby="tooltip-1">Mon bouton</PixButton>
|
|
48
|
+
</:triggerElement>
|
|
49
|
+
|
|
50
|
+
<:tooltip>
|
|
51
|
+
My tooltip
|
|
52
|
+
</:tooltip>
|
|
53
|
+
</PixTooltip>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
- soit via `aria-labelledby` si l'élément ne possède pas de label et que le tooltip fait office de libellé.
|
|
57
|
+
|
|
58
|
+
```html
|
|
59
|
+
<PixTooltip @id="tooltip-2" @text="Cette information apparaît uniquement au survol de l'icone">
|
|
60
|
+
<span class="icon icon-info" aria-labelledby="tooltip-2"></span>
|
|
61
|
+
</PixTooltip>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
## Default
|
|
66
|
+
|
|
67
|
+
Infobulle en position `top`, fond sombre (par défaut).
|
|
68
|
+
|
|
69
|
+
<Canvas>
|
|
70
|
+
<Story name="Default" story={stories.Default} height={200} />
|
|
71
|
+
</Canvas>
|
|
72
|
+
|
|
73
|
+
## Is Light
|
|
74
|
+
|
|
75
|
+
Infobulle en mode clair.
|
|
76
|
+
|
|
77
|
+
> ⚠️ le tooltip "light" est à utiliser de préférence sur fond coloré ! Mais ce n'est pas obligatoire.
|
|
78
|
+
|
|
79
|
+
<Canvas>
|
|
80
|
+
<Story name="Is Light" story={stories.isLight} height={200} />
|
|
81
|
+
</Canvas>
|
|
82
|
+
|
|
83
|
+
## Position
|
|
84
|
+
|
|
85
|
+
Différentes positions de l'infobulle.
|
|
86
|
+
Existe aussi `top-left`, `top-right`, `bottom-left` et `bottom-right`.
|
|
87
|
+
|
|
88
|
+
<Canvas isColumn>
|
|
89
|
+
<Story name="Left" story={stories.left} height={100} />
|
|
90
|
+
<Story name="Right" story={stories.right} height={100} />
|
|
91
|
+
<Story name="Bottom" story={stories.bottom} height={150} />
|
|
92
|
+
</Canvas>
|
|
93
|
+
|
|
94
|
+
## Is Wide
|
|
95
|
+
|
|
96
|
+
Infobulle en plus large.
|
|
97
|
+
|
|
98
|
+
<Canvas>
|
|
99
|
+
<Story name="Is Wide" story={stories.isWide} height={200} />
|
|
100
|
+
</Canvas>
|
|
101
|
+
|
|
102
|
+
## Is Inline
|
|
103
|
+
|
|
104
|
+
Infobulle dont le contenu reste sur une ligne.
|
|
105
|
+
|
|
106
|
+
<Canvas>
|
|
107
|
+
<Story name="Is Inline" story={stories.isInline} height={200} />
|
|
108
|
+
</Canvas>
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
## With HTML
|
|
112
|
+
|
|
113
|
+
Infobulle contenant des éléments HTML
|
|
114
|
+
|
|
115
|
+
<Canvas>
|
|
116
|
+
<Story name="WithHTML" story={stories.WithHTML} height={200} />
|
|
117
|
+
</Canvas>
|
|
118
|
+
|
|
119
|
+
## Usage
|
|
120
|
+
|
|
121
|
+
```html
|
|
122
|
+
<PixTooltip>
|
|
123
|
+
<:triggerElement>
|
|
124
|
+
<button>Tooltip par défaut</button>
|
|
125
|
+
</:triggerElement>
|
|
126
|
+
<:tooltip>
|
|
127
|
+
<FaIcon @icon="external-link-alt" /> Avec des <strong>éléments</strong> HTML/Ember
|
|
128
|
+
</:tooltip>
|
|
129
|
+
</PixTooltip>
|
|
130
|
+
|
|
131
|
+
<PixTooltip
|
|
132
|
+
@isLight={{true}}
|
|
133
|
+
>
|
|
134
|
+
<:triggerElement>
|
|
135
|
+
<button>Tooltip en mode clair</button>
|
|
136
|
+
</:triggerElement>
|
|
137
|
+
|
|
138
|
+
<:tooltip>
|
|
139
|
+
Hey
|
|
140
|
+
</:tooltip>
|
|
141
|
+
</PixTooltip>
|
|
142
|
+
|
|
143
|
+
<PixTooltip
|
|
144
|
+
@isLight={{true}}
|
|
145
|
+
>
|
|
146
|
+
<:triggerElement>
|
|
147
|
+
<button>Tooltip sur une ligne</button>
|
|
148
|
+
</:triggerElement>
|
|
149
|
+
|
|
150
|
+
<:tooltip>
|
|
151
|
+
Hey
|
|
152
|
+
</:tooltip>
|
|
153
|
+
</PixTooltip>
|
|
154
|
+
|
|
155
|
+
<PixTooltip
|
|
156
|
+
@position='bottom'
|
|
157
|
+
@isLight={{true}}
|
|
158
|
+
>
|
|
159
|
+
<:triggerElement>
|
|
160
|
+
<button>Tooltip apparaissant en bas</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
|
+
<ArgsTable story="Default" />
|
|
File without changes
|