@1024pix/pix-ui 20.2.0 → 20.2.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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Pix-UI Changelog
2
2
 
3
+ ## v20.2.2 (09/11/2022)
4
+
5
+
6
+ ### :building_construction: Tech
7
+ - [#273](https://github.com/1024pix/pix-ui/pull/273) [TECH] Remplacer l'import d'`htmlSafe` depuis `ember/string` en `ember/template`
8
+
9
+ ## v20.2.1 (28/10/2022)
10
+
11
+
12
+ ### :bug: Correction
13
+ - [#268](https://github.com/1024pix/pix-ui/pull/268) [BUGFIX] Empêcher la propagation des événements dans tous les enfants sur la Tooltip (PIX-6149)
14
+
3
15
  ## v20.2.0 (25/10/2022)
4
16
 
5
17
 
@@ -1,5 +1,5 @@
1
1
  import Component from '@glimmer/component';
2
- import { htmlSafe } from '@ember/string';
2
+ import { htmlSafe } from '@ember/template';
3
3
 
4
4
  export default class PixProgressGauge extends Component {
5
5
  get progressValue() {
@@ -2,13 +2,15 @@
2
2
  class="pix-tooltip"
3
3
  {{on-escape-action this.hideTooltip}}
4
4
  {{on "mouseover" this.showTooltip}}
5
- {{on "mouseout" this.hideTooltipOnMouseOut}}
5
+ {{on "mouseleave" this.hideTooltipOnMouseOut}}
6
6
  {{on "focusin" this.showTooltip}}
7
7
  {{on "focusout" this.hideTooltip}}
8
8
  ...attributes
9
9
  >
10
10
  {{#if (has-block "triggerElement")}}
11
- {{yield to="triggerElement"}}
11
+ <div class={{if this.isVisible "pix-tooltip--visible" ""}}>
12
+ {{yield to="triggerElement"}}
13
+ </div>
12
14
  {{/if}}
13
15
 
14
16
  {{#if (has-block "tooltip")}}
@@ -1,7 +1,10 @@
1
1
  import Component from '@glimmer/component';
2
2
  import { action } from '@ember/object';
3
+ import { tracked } from '@glimmer/tracking';
3
4
 
4
5
  export default class PixTooltip extends Component {
6
+ @tracked isVisible = false;
7
+
5
8
  get position() {
6
9
  const correctsPosition = [
7
10
  'top',
@@ -21,18 +24,18 @@ export default class PixTooltip extends Component {
21
24
  }
22
25
 
23
26
  @action
24
- showTooltip(event) {
25
- event.target.classList.add('pix-tooltip--visible');
27
+ showTooltip() {
28
+ this.isVisible = true;
26
29
  }
27
30
 
28
31
  @action
29
- hideTooltip(event) {
30
- event.target.classList.remove('pix-tooltip--visible');
32
+ hideTooltip() {
33
+ this.isVisible = false;
31
34
  }
32
35
 
33
36
  @action
34
37
  hideTooltipOnMouseOut(event) {
35
- const isFocused = document.activeElement === event.target;
38
+ const isFocused = event.target.contains(document.activeElement);
36
39
 
37
40
  if (isFocused) {
38
41
  return;
@@ -5,6 +5,7 @@
5
5
  display: flex;
6
6
  justify-content: center;
7
7
  align-items: center;
8
+
8
9
  }
9
10
 
10
11
  .pix-tooltip--visible {
@@ -46,6 +46,27 @@ const TemplateWithHTMLElement = (args) => {
46
46
  };
47
47
  };
48
48
 
49
+ const TemplateWithIconElement = (args) => {
50
+ return {
51
+ template: hbs`
52
+ <PixTooltip
53
+ @id={{this.id}}
54
+ @isInline=true>
55
+ <:triggerElement>
56
+ <button style='padding:0; margin-left:4px; line-height:0;'>
57
+ <FaIcon class="external-link" @icon="up-right-from-square" />
58
+ </button>
59
+ </:triggerElement>
60
+
61
+ <:tooltip>
62
+ {{this.text}}
63
+ </:tooltip>
64
+ </PixTooltip>
65
+ `,
66
+ context: args,
67
+ };
68
+ };
69
+
49
70
  export const Default = Template.bind({});
50
71
  Default.args = {
51
72
  text: 'Hello World',
@@ -113,6 +134,12 @@ WithHTML.args = {
113
134
  label: 'À survoler pour voir la tooltip',
114
135
  };
115
136
 
137
+ export const WithIcon = TemplateWithIconElement.bind({});
138
+ Default.args = {
139
+ text: 'Hello World',
140
+ label: 'À survoler pour voir la tooltip',
141
+ };
142
+
116
143
  export const argTypes = {
117
144
  id: {
118
145
  name: 'id',
@@ -75,6 +75,7 @@ Infobulle en position `top`, fond sombre (par défaut).
75
75
 
76
76
  <Canvas>
77
77
  <Story name="Default" story={stories.Default} height={200} />
78
+ <Story name="WithIcon" story={stories.WithIcon} height={200} />
78
79
  </Canvas>
79
80
 
80
81
  ## Is Light
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1024pix/pix-ui",
3
- "version": "20.2.0",
3
+ "version": "20.2.2",
4
4
  "description": "Pix-UI is the implementation of Pix design principles and guidelines for its products.",
5
5
  "keywords": [
6
6
  "ember-addon"