@1024pix/pix-ui 20.0.1 → 20.2.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/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Pix-UI Changelog
2
2
 
3
+ ## v20.2.0 (25/10/2022)
4
+
5
+
6
+ ### :rocket: Amélioration
7
+ - [#267](https://github.com/1024pix/pix-ui/pull/267) [FEATURE] Gérer l'échappement de la tooltip (PIX-6114)
8
+
9
+ ## v20.1.0 (13/10/2022)
10
+
11
+
12
+ ### :rocket: Amélioration
13
+ - [#241](https://github.com/1024pix/pix-ui/pull/241) [FEATURE] PixCollapsible : Autoriser l'utilisation d'un Block Content pour le titre
14
+
15
+ ### :bug: Correction
16
+ - [#264](https://github.com/1024pix/pix-ui/pull/264) [BUGFIX] Réparer l'ombre du compsant Pix Block.
17
+ - [#263](https://github.com/1024pix/pix-ui/pull/263) [BUGFIX] Permettre le scroll quand la modale est détruite
18
+
3
19
  ## v20.0.1 (11/10/2022)
4
20
 
5
21
 
@@ -8,14 +8,22 @@
8
8
  aria-expanded={{if this.isUnCollapsed "true" "false"}}
9
9
  ...attributes
10
10
  >
11
- <span>
11
+ <span class="pix-collapsible-title__container">
12
12
  {{#if @titleIcon}}
13
13
  <FaIcon @icon={{@titleIcon}} class="pix-collapsible-title__icon" />
14
14
  {{/if}}
15
- {{this.title}}
15
+
16
+ {{#if (has-block "title")}}
17
+ {{yield to="title"}}
18
+ {{else}}
19
+ {{this.title}}
20
+ {{/if}}
16
21
  </span>
17
22
 
18
- <FaIcon @icon="{{if this.isCollapsed 'plus' 'minus'}}" class="pix-collapsible-title__icon" />
23
+ <FaIcon
24
+ @icon="{{if this.isCollapsed 'plus' 'minus'}}"
25
+ class="pix-collapsible-title__toggle-icon"
26
+ />
19
27
  </button>
20
28
 
21
29
  <div
@@ -1,4 +1,12 @@
1
- <span class="pix-tooltip" ...attributes>
1
+ <span
2
+ class="pix-tooltip"
3
+ {{on-escape-action this.hideTooltip}}
4
+ {{on "mouseover" this.showTooltip}}
5
+ {{on "mouseout" this.hideTooltipOnMouseOut}}
6
+ {{on "focusin" this.showTooltip}}
7
+ {{on "focusout" this.hideTooltip}}
8
+ ...attributes
9
+ >
2
10
  {{#if (has-block "triggerElement")}}
3
11
  {{yield to="triggerElement"}}
4
12
  {{/if}}
@@ -1,4 +1,5 @@
1
1
  import Component from '@glimmer/component';
2
+ import { action } from '@ember/object';
2
3
 
3
4
  export default class PixTooltip extends Component {
4
5
  get position() {
@@ -18,4 +19,25 @@ export default class PixTooltip extends Component {
18
19
  get display() {
19
20
  return typeof this.args.hide === 'undefined' || !this.args.hide;
20
21
  }
22
+
23
+ @action
24
+ showTooltip(event) {
25
+ event.target.classList.add('pix-tooltip--visible');
26
+ }
27
+
28
+ @action
29
+ hideTooltip(event) {
30
+ event.target.classList.remove('pix-tooltip--visible');
31
+ }
32
+
33
+ @action
34
+ hideTooltipOnMouseOut(event) {
35
+ const isFocused = document.activeElement === event.target;
36
+
37
+ if (isFocused) {
38
+ return;
39
+ }
40
+
41
+ this.hideTooltip(event);
42
+ }
21
43
  }
@@ -4,11 +4,10 @@
4
4
  border-radius: 5px;
5
5
 
6
6
  &--shadow-light {
7
- box-shadow: 0px 4px 8px 0px $pix-neutral-110;
7
+ box-shadow: 0px 4px 8px rgba($pix-neutral-110, 0.08);
8
8
  }
9
9
 
10
10
  &--shadow-heavy {
11
- box-shadow: 0 50px 54px -40px rgba($pix-neutral-110, 0.4),
12
- 0 7px 14px 0 rgba($pix-neutral-100, 0.1);
11
+ box-shadow: 0px 12px 24px rgba($pix-neutral-110, 0.08);
13
12
  }
14
13
  }
@@ -12,7 +12,7 @@
12
12
  background-color: $pix-neutral-0;
13
13
 
14
14
  &__title {
15
- padding: 14px 10px 14px 16px;
15
+ padding: 14px 16px;
16
16
  min-width: 100%;
17
17
  cursor: pointer;
18
18
  display: flex;
@@ -22,11 +22,7 @@
22
22
  color: $pix-neutral-60;
23
23
  font-size: 1rem;
24
24
  font-weight: 500;
25
-
26
- .pix-collapsible-title__icon {
27
- color: $pix-neutral-45;
28
- margin-right: 6px;
29
- }
25
+ align-items: center;
30
26
 
31
27
  &:hover {
32
28
  background-color: $pix-neutral-10;
@@ -41,6 +37,25 @@
41
37
  }
42
38
  }
43
39
 
40
+ &-title {
41
+
42
+ &__container {
43
+ align-items: center;
44
+ display: flex;
45
+ flex-grow: 1;
46
+ }
47
+
48
+ &__icon{
49
+ color: $pix-neutral-45;
50
+ margin-right: 6px;
51
+ }
52
+
53
+ &__toggle-icon{
54
+ color: $pix-neutral-45;
55
+ margin-left: 16px;
56
+ }
57
+ }
58
+
44
59
  &__content {
45
60
  padding: 16px 20px;
46
61
  display: none;
@@ -5,9 +5,10 @@
5
5
  display: flex;
6
6
  justify-content: center;
7
7
  align-items: center;
8
+ }
8
9
 
9
- & > *:first-child:hover + .pix-tooltip__content,
10
- & > *:first-child:focus + .pix-tooltip__content {
10
+ .pix-tooltip--visible {
11
+ + .pix-tooltip__content {
11
12
  display: block;
12
13
  opacity: 1;
13
14
  }
@@ -22,6 +22,7 @@ export default modifier(function trapFocus(element, [isOpen]) {
22
22
  element.removeEventListener('keydown', (event) => {
23
23
  handleKeyDown(event, element);
24
24
  });
25
+ allowPageScrolling();
25
26
  };
26
27
  });
27
28
 
@@ -13,6 +13,23 @@ export const collapsible = (args) => {
13
13
  };
14
14
  };
15
15
 
16
+ export const collapsibleWithBlockTitle = (args) => {
17
+ return {
18
+ template: hbs`
19
+ <PixCollapsible
20
+ @titleIcon={{titleIcon}}>
21
+ <:title>
22
+ <span>Titre avec <em>contenu de type block</em></span>
23
+ </:title>
24
+ <:default>
25
+ <div>Contenu du PixCollapsible</div>
26
+ </:default>
27
+ </PixCollapsible>
28
+ `,
29
+ context: args,
30
+ };
31
+ };
32
+
16
33
  export const multipleCollapsible = (args) => {
17
34
  return {
18
35
  template: hbs`
@@ -20,6 +20,10 @@ Par défaut le contenu est masqué et cliquer sur le libellé permet de montrer
20
20
  <Story name='PixCollapsible' story={stories.collapsible} height={150} />
21
21
  </Canvas>
22
22
 
23
+ <Canvas>
24
+ <Story name='With block title' story={stories.collapsibleWithBlockTitle} height={150} />
25
+ </Canvas>
26
+
23
27
  <Canvas>
24
28
  <Story name='MultiplePixCollapsible' story={stories.multipleCollapsible} height={260} />
25
29
  </Canvas>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1024pix/pix-ui",
3
- "version": "20.0.1",
3
+ "version": "20.2.0",
4
4
  "description": "Pix-UI is the implementation of Pix design principles and guidelines for its products.",
5
5
  "keywords": [
6
6
  "ember-addon"