@1024pix/pix-ui 55.31.0 → 55.31.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.
@@ -26,10 +26,8 @@ export default class PixMNavigation extends Component {
26
26
  }
27
27
 
28
28
  @action
29
- handleNavigationClick(event) {
30
- if (event.target.nodeName === 'A') {
31
- this.navigationMenuOpened = false;
32
- }
29
+ handleNavigationClick() {
30
+ this.navigationMenuOpened = false;
33
31
  }
34
32
 
35
33
  get navigationId() {
@@ -8,7 +8,6 @@
8
8
  ...attributes
9
9
  >
10
10
  <PopperJS @placement="right-end" as |reference popover|>
11
-
12
11
  <PixButton
13
12
  {{reference}}
14
13
  @size="small"
@@ -18,23 +17,25 @@
18
17
  @triggerAction={{this.toggleMenu}}
19
18
  aria-expanded={{this.isMenuOpen}}
20
19
  >{{@label}}</PixButton>
21
- <div
22
- {{popover}}
23
- class="pix-select__dropdown {{unless this.isMenuOpen 'pix-select__dropdown--closed'}}"
24
- >
25
- <PixSelectList
26
- aria-labelledby={{this.switcherId}}
27
- {{on "transitionend" this.focus}}
28
- @hideDefaultOption={{true}}
29
- @listId={{this.listId}}
30
- @selectId={{this.switcherId}}
31
- @value={{@value}}
32
- @onChange={{this.onSelectListChange}}
33
- @defaultOption={{@defaultOption}}
34
- @isExpanded={{this.isMenuOpen}}
35
- @options={{@structures}}
36
- @defaultOptionValue={{@label}}
37
- />
38
- </div>
20
+ {{#if this.isMenuOpen}}
21
+ <div
22
+ {{popover}}
23
+ class="pix-select__dropdown {{unless this.isMenuOpen 'pix-select__dropdown--closed'}}"
24
+ >
25
+ <PixSelectList
26
+ aria-labelledby={{this.switcherId}}
27
+ {{on "transitionend" this.focus}}
28
+ @hideDefaultOption={{true}}
29
+ @listId={{this.listId}}
30
+ @selectId={{this.switcherId}}
31
+ @value={{@value}}
32
+ @onChange={{this.onSelectListChange}}
33
+ @defaultOption={{@defaultOption}}
34
+ @isExpanded={{this.isMenuOpen}}
35
+ @options={{@structures}}
36
+ @defaultOptionValue={{@label}}
37
+ />
38
+ </div>
39
+ {{/if}}
39
40
  </PopperJS>
40
41
  </div>
@@ -1,8 +1,6 @@
1
1
  import { modifier } from 'ember-modifier';
2
2
 
3
3
  export default modifier((element, [elementId, callback, isExpanded]) => {
4
- const elementToTarget = document.getElementById(elementId);
5
-
6
4
  element.addEventListener('keydown', handleKeyDown);
7
5
 
8
6
  return () => {
@@ -19,7 +17,10 @@ export default modifier((element, [elementId, callback, isExpanded]) => {
19
17
  event.preventDefault();
20
18
 
21
19
  const focusElement = () => {
22
- const focusableElements = findFocusableElements(elementToTarget);
20
+ const targetElement = document.getElementById(elementId);
21
+ if (!targetElement) return;
22
+
23
+ const focusableElements = findFocusableElements(targetElement);
23
24
 
24
25
  const [firstFocusableElement] = focusableElements;
25
26
  const lastFocusableElement = focusableElements[focusableElements.length - 1];
@@ -60,15 +61,20 @@ export default modifier((element, [elementId, callback, isExpanded]) => {
60
61
  };
61
62
 
62
63
  if (!isExpanded) {
63
- elementToTarget.addEventListener('transitionend', focusElement);
64
-
65
64
  callback(event);
66
65
 
67
- return () => {
68
- elementToTarget.removeEventListener('transitionend', focusElement);
66
+ const waitForElement = () => {
67
+ const targetElement = document.getElementById(elementId);
68
+ if (targetElement) {
69
+ targetElement.addEventListener('transitionend', focusElement, { once: true });
70
+ } else {
71
+ requestAnimationFrame(waitForElement);
72
+ }
69
73
  };
74
+
75
+ waitForElement();
70
76
  } else {
71
- focusElement(elementToTarget);
77
+ focusElement();
72
78
  }
73
79
  }
74
80
  });
@@ -91,6 +91,10 @@
91
91
  &:active {
92
92
  background-color: rgb(var(--pix-neutral-800-inline), 30%);
93
93
  }
94
+
95
+ .pix-button__icon--before {
96
+ margin-right: 0;
97
+ }
94
98
  }
95
99
  }
96
100
  }
@@ -35,6 +35,9 @@
35
35
  margin-left: calc(-1 * var(--pix-spacing-4x)) !important;
36
36
  overflow-y: auto;
37
37
  border-radius: 8px;
38
+ opacity: 0;
39
+ animation: fade-in-dropdown 150ms ease-in-out forwards;
40
+ animation-delay: 50ms;
38
41
 
39
42
  @include breakpoints.device-is('mobile') {
40
43
  position: static !important;
@@ -100,3 +103,13 @@
100
103
  }
101
104
  }
102
105
  }
106
+
107
+ @keyframes fade-in-dropdown {
108
+ from {
109
+ opacity: 0;
110
+ }
111
+
112
+ to {
113
+ opacity: 1;
114
+ }
115
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1024pix/pix-ui",
3
- "version": "55.31.0",
3
+ "version": "55.31.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"