@1024pix/pix-ui 55.11.2 → 55.12.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/addon/components/pix-modal.hbs +5 -6
- package/addon/components/pix-modal.js +0 -12
- package/addon/components/pix-overlay.hbs +8 -0
- package/addon/components/pix-overlay.js +13 -0
- package/addon/components/pix-sidebar.hbs +2 -7
- package/addon/components/pix-sidebar.js +0 -12
- package/addon/styles/_pix-modal.scss +5 -38
- package/addon/styles/_pix-overlay.scss +13 -0
- package/addon/styles/addon.scss +1 -0
- package/app/components/pix-overlay.js +1 -0
- package/package.json +1 -1
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
{{
|
|
4
|
-
{{
|
|
5
|
-
{{on-escape-action @onCloseButtonClick}}
|
|
1
|
+
<PixOverlay
|
|
2
|
+
@isVisible={{@showModal}}
|
|
3
|
+
@onClose={{@onCloseButtonClick}}
|
|
4
|
+
@focusOnClose={{@focusOnClose}}
|
|
6
5
|
>
|
|
7
6
|
<div
|
|
8
7
|
class="pix-modal"
|
|
@@ -30,4 +29,4 @@
|
|
|
30
29
|
{{yield to="footer"}}
|
|
31
30
|
</div>
|
|
32
31
|
</div>
|
|
33
|
-
</
|
|
32
|
+
</PixOverlay>
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { action } from '@ember/object';
|
|
2
1
|
import { guidFor } from '@ember/object/internals';
|
|
3
2
|
import Component from '@glimmer/component';
|
|
4
3
|
|
|
@@ -11,17 +10,6 @@ export default class PixModal extends Component {
|
|
|
11
10
|
}
|
|
12
11
|
}
|
|
13
12
|
|
|
14
|
-
@action
|
|
15
|
-
closeAction(event) {
|
|
16
|
-
if (this.args.onCloseButtonClick && this.isClickOnOverlay(event)) {
|
|
17
|
-
this.args.onCloseButtonClick(event);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
isClickOnOverlay(event) {
|
|
22
|
-
return event.target.classList.contains('pix-modal__overlay');
|
|
23
|
-
}
|
|
24
|
-
|
|
25
13
|
get id() {
|
|
26
14
|
return guidFor(this);
|
|
27
15
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { action } from '@ember/object';
|
|
2
|
+
import Component from '@glimmer/component';
|
|
3
|
+
|
|
4
|
+
export default class PixOverlay extends Component {
|
|
5
|
+
@action
|
|
6
|
+
onClick(event) {
|
|
7
|
+
const isClickOnOverlay = event.target.classList.contains('pix-overlay');
|
|
8
|
+
|
|
9
|
+
if (this.args.onClose && isClickOnOverlay) {
|
|
10
|
+
this.args.onClose(event);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
<
|
|
2
|
-
class="pix-sidebar__overlay {{unless @showSidebar ' pix-sidebar__overlay--hidden'}}"
|
|
3
|
-
{{on "click" this.closeAction}}
|
|
4
|
-
{{trap-focus @showSidebar @focusOnClose}}
|
|
5
|
-
{{on-escape-action @onClose}}
|
|
6
|
-
>
|
|
1
|
+
<PixOverlay @isVisible={{@showSidebar}} @onClose={{@onClose}} @focusOnClose={{@focusOnClose}}>
|
|
7
2
|
<div
|
|
8
3
|
class="pix-sidebar {{unless @showSidebar ' pix-sidebar--hidden'}}"
|
|
9
4
|
role="dialog"
|
|
@@ -30,4 +25,4 @@
|
|
|
30
25
|
{{yield to="footer"}}
|
|
31
26
|
</div>
|
|
32
27
|
</div>
|
|
33
|
-
</
|
|
28
|
+
</PixOverlay>
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { action } from '@ember/object';
|
|
2
1
|
import { guidFor } from '@ember/object/internals';
|
|
3
2
|
import Component from '@glimmer/component';
|
|
4
3
|
|
|
@@ -11,17 +10,6 @@ export default class PixSidebar extends Component {
|
|
|
11
10
|
}
|
|
12
11
|
}
|
|
13
12
|
|
|
14
|
-
@action
|
|
15
|
-
closeAction(event) {
|
|
16
|
-
if (this.args.onClose && this.isClickOnOverlay(event)) {
|
|
17
|
-
this.args.onClose(event);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
isClickOnOverlay(event) {
|
|
22
|
-
return event.target.classList.contains('pix-sidebar__overlay');
|
|
23
|
-
}
|
|
24
|
-
|
|
25
13
|
get id() {
|
|
26
14
|
return guidFor(this);
|
|
27
15
|
}
|
|
@@ -2,51 +2,18 @@
|
|
|
2
2
|
@use "pix-design-tokens/typography";
|
|
3
3
|
@use "pix-design-tokens/shadows";
|
|
4
4
|
|
|
5
|
-
.pix-modal__overlay {
|
|
6
|
-
position: fixed;
|
|
7
|
-
top: 0;
|
|
8
|
-
right: 0;
|
|
9
|
-
bottom: 0;
|
|
10
|
-
left: 0;
|
|
11
|
-
z-index: 1000;
|
|
12
|
-
padding: var(--pix-spacing-2x) 0;
|
|
13
|
-
overflow-y: auto;
|
|
14
|
-
text-align: center; // Used to center horizontally the inline-block modal content
|
|
15
|
-
// we inline the pix-neutral-800 value
|
|
16
|
-
background-color: rgba(37,56,88, .5);
|
|
17
|
-
transition: all 0.3s ease-in-out;
|
|
18
|
-
|
|
19
|
-
// This block is used to center vertically the modal
|
|
20
|
-
// if the content is less than 100vh
|
|
21
|
-
// Inspired by https://mui.com/material-ui/react-dialog/#scrolling-long-content
|
|
22
|
-
&::after {
|
|
23
|
-
display: inline-block;
|
|
24
|
-
width: 0;
|
|
25
|
-
height: 100%;
|
|
26
|
-
vertical-align: middle;
|
|
27
|
-
content: '';
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
&--hidden {
|
|
31
|
-
visibility: hidden;
|
|
32
|
-
opacity: 0;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
5
|
.pix-modal {
|
|
37
6
|
@extend %pix-shadow-sm;
|
|
38
7
|
|
|
39
|
-
|
|
8
|
+
position: absolute;
|
|
9
|
+
top: 50%;
|
|
10
|
+
left: 50%;
|
|
40
11
|
width: 512px;
|
|
41
|
-
max-width: calc(
|
|
42
|
-
100% - var(--pix-spacing-4x)
|
|
43
|
-
); // Horizontal margin sets here to have extra space for the .pix-modal__overlay::after on mobile
|
|
44
|
-
|
|
12
|
+
max-width: calc(100% - var(--pix-spacing-4x));
|
|
45
13
|
overflow: hidden;
|
|
46
|
-
text-align: initial;
|
|
47
|
-
vertical-align: middle; // Centered vertically with the .pix-modal__overlay::after which is 100% height
|
|
48
14
|
background-color: var(--pix-neutral-20);
|
|
49
15
|
border-radius: 4px;
|
|
16
|
+
transform: translate(-50%, -50%);
|
|
50
17
|
|
|
51
18
|
&__header {
|
|
52
19
|
display: flex;
|
package/addon/styles/addon.scss
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@1024pix/pix-ui/components/pix-overlay';
|