@1024pix/pix-ui 20.2.2 → 20.2.4
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/CHANGELOG.md +6 -0
- package/addon/components/pix-tooltip.hbs +3 -2
- package/addon/styles/_pix-tooltip.scss +7 -5
- package/package.json +3 -3
- package/addon/components/pix-tooltip-deprecated.hbs +0 -18
- package/addon/components/pix-tooltip-deprecated.js +0 -26
- package/app/components/pix-tooltip-deprecated.js +0 -1
- package/app/stories/pix-tooltip-deprecated.stories.js +0 -136
- package/app/stories/pix-tooltip-deprecated.stories.mdx +0 -143
package/CHANGELOG.md
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
...attributes
|
|
9
9
|
>
|
|
10
10
|
{{#if (has-block "triggerElement")}}
|
|
11
|
-
<
|
|
11
|
+
<span class="pix-tooltip__trigger-element">
|
|
12
12
|
{{yield to="triggerElement"}}
|
|
13
|
-
</
|
|
13
|
+
</span>
|
|
14
14
|
{{/if}}
|
|
15
15
|
|
|
16
16
|
{{#if (has-block "tooltip")}}
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
id={{@id}}
|
|
20
20
|
role="tooltip"
|
|
21
21
|
class="pix-tooltip__content pix-tooltip__content--{{this.position}}
|
|
22
|
+
{{if this.isVisible 'pix-tooltip__content--visible'}}
|
|
22
23
|
{{if @isInline 'pix-tooltip__content--inline'}}
|
|
23
24
|
{{if @isLight 'pix-tooltip__content--light'}}
|
|
24
25
|
{{if @isWide 'pix-tooltip__content--wide'}}"
|
|
@@ -6,12 +6,9 @@
|
|
|
6
6
|
justify-content: center;
|
|
7
7
|
align-items: center;
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
.pix-tooltip--visible {
|
|
12
|
-
+ .pix-tooltip__content {
|
|
9
|
+
&__trigger-element {
|
|
13
10
|
display: block;
|
|
14
|
-
|
|
11
|
+
width: 100%;
|
|
15
12
|
}
|
|
16
13
|
}
|
|
17
14
|
|
|
@@ -31,6 +28,11 @@
|
|
|
31
28
|
line-height: 1.4rem;
|
|
32
29
|
transition: opacity 0.3s;
|
|
33
30
|
|
|
31
|
+
&--visible {
|
|
32
|
+
display: block;
|
|
33
|
+
opacity: 1;
|
|
34
|
+
}
|
|
35
|
+
|
|
34
36
|
&--inline {
|
|
35
37
|
white-space: nowrap;
|
|
36
38
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@1024pix/pix-ui",
|
|
3
|
-
"version": "20.2.
|
|
3
|
+
"version": "20.2.4",
|
|
4
4
|
"description": "Pix-UI is the implementation of Pix design principles and guidelines for its products.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon"
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"author": "GIP Pix",
|
|
10
10
|
"engines": {
|
|
11
|
-
"node": "16
|
|
12
|
-
"npm": ">=8.
|
|
11
|
+
"node": "16",
|
|
12
|
+
"npm": ">=8.13.2 <9"
|
|
13
13
|
},
|
|
14
14
|
"ember": {
|
|
15
15
|
"edition": "octane"
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
<span class="pix-tooltip" ...attributes>
|
|
2
|
-
|
|
3
|
-
{{yield}}
|
|
4
|
-
|
|
5
|
-
{{#if @text}}
|
|
6
|
-
<span
|
|
7
|
-
id={{@id}}
|
|
8
|
-
role="tooltip"
|
|
9
|
-
class="pix-tooltip__content pix-tooltip__content--{{this.position}}
|
|
10
|
-
{{if @isInline 'pix-tooltip__content--inline'}}
|
|
11
|
-
{{if @isLight 'pix-tooltip__content--light'}}
|
|
12
|
-
{{if @isWide 'pix-tooltip__content--wide'}}"
|
|
13
|
-
>
|
|
14
|
-
{{this.text}}
|
|
15
|
-
</span>
|
|
16
|
-
{{/if}}
|
|
17
|
-
|
|
18
|
-
</span>
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import Component from '@glimmer/component';
|
|
2
|
-
import { htmlSafe } from '@ember/template';
|
|
3
|
-
|
|
4
|
-
export default class PixTooltipDeprecated extends Component {
|
|
5
|
-
get position() {
|
|
6
|
-
const correctsPosition = [
|
|
7
|
-
'top',
|
|
8
|
-
'right',
|
|
9
|
-
'bottom',
|
|
10
|
-
'bottom-left',
|
|
11
|
-
'bottom-right',
|
|
12
|
-
'left',
|
|
13
|
-
'top-left',
|
|
14
|
-
'top-right',
|
|
15
|
-
];
|
|
16
|
-
return correctsPosition.includes(this.args.position) ? this.args.position : 'top';
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
get text() {
|
|
20
|
-
if (this.args.unescapeHtml) {
|
|
21
|
-
return htmlSafe(this.args.text);
|
|
22
|
-
} else {
|
|
23
|
-
return this.args.text;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from '@1024pix/pix-ui/components/pix-tooltip-deprecated';
|
|
@@ -1,136 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,143 +0,0 @@
|
|
|
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" />
|