@salesforcedevs/dx-components 1.3.66-alpha001-a → 1.3.66-modal-001
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/package.json +1 -1
- package/src/modules/dx/cardTrial/cardTrial.html +2 -2
- package/src/modules/dx/cardTrial/cardTrial.ts +2 -2
- package/src/modules/dx/cardTrialExpanded/cardTrialExpanded.html +1 -1
- package/src/modules/dx/cardTrialExpanded/cardTrialExpanded.ts +2 -27
- package/src/modules/dx/modal/modal.css +4 -37
- package/src/modules/dx/modal/modal.html +10 -7
- package/src/modules/dx/modal/modal.ts +69 -26
- package/src/modules/dx/sidebarSearch/sidebarSearch.ts +1 -2
package/package.json
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
<dx-modal
|
|
3
3
|
if:true={hasTwoButtons}
|
|
4
4
|
open={_modalOpen}
|
|
5
|
-
ontogglemodal={toggleModal}
|
|
6
5
|
onclosemodal={closeModal}
|
|
7
6
|
>
|
|
8
7
|
<dx-card-trial-expanded
|
|
@@ -24,6 +23,7 @@
|
|
|
24
23
|
title={title}
|
|
25
24
|
type-badge-value={modalTypeBadgeValue}
|
|
26
25
|
type-badge-dark={modalTypeBadgeDark}
|
|
26
|
+
onclickclose={closeModal}
|
|
27
27
|
></dx-card-trial-expanded>
|
|
28
28
|
</dx-modal>
|
|
29
29
|
<div class="recommended-container" if:true={recommended}>
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
<dx-button
|
|
95
95
|
class="button-two"
|
|
96
96
|
size="large"
|
|
97
|
-
onclick={
|
|
97
|
+
onclick={openModal}
|
|
98
98
|
variant="secondary"
|
|
99
99
|
font="sans"
|
|
100
100
|
icon-symbol={buttonTwoIcon}
|
|
@@ -96,8 +96,8 @@ export default class CardTrial extends LightningElement {
|
|
|
96
96
|
return cx("details", this.hasButtons && "details_top-margin");
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
private
|
|
100
|
-
this._modalOpen =
|
|
99
|
+
private openModal() {
|
|
100
|
+
this._modalOpen = true;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
private closeModal() {
|
|
@@ -40,13 +40,6 @@ export default class CardTrial extends LightningElement {
|
|
|
40
40
|
private _colTwoDetails!: string[];
|
|
41
41
|
private stickyCloseObserver!: IntersectionObserver;
|
|
42
42
|
|
|
43
|
-
connectedCallback(): void {
|
|
44
|
-
this.template.addEventListener(
|
|
45
|
-
"keydown",
|
|
46
|
-
this.handleKeyDown.bind(this)
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
43
|
renderedCallback(): void {
|
|
51
44
|
this.observeStickyClose();
|
|
52
45
|
}
|
|
@@ -71,26 +64,8 @@ export default class CardTrial extends LightningElement {
|
|
|
71
64
|
}
|
|
72
65
|
}
|
|
73
66
|
|
|
74
|
-
private
|
|
75
|
-
|
|
76
|
-
this.handleModalClose();
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
private handleModalToggle() {
|
|
81
|
-
this.dispatchEvent(
|
|
82
|
-
new CustomEvent("togglemodal", {
|
|
83
|
-
bubbles: true
|
|
84
|
-
})
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
private handleModalClose() {
|
|
89
|
-
this.dispatchEvent(
|
|
90
|
-
new CustomEvent("closemodal", {
|
|
91
|
-
bubbles: true
|
|
92
|
-
})
|
|
93
|
-
);
|
|
67
|
+
private onClickClose() {
|
|
68
|
+
this.dispatchEvent(new CustomEvent("clickclose"));
|
|
94
69
|
}
|
|
95
70
|
|
|
96
71
|
private handleSignUpClick(e: PointerEvent) {
|
|
@@ -1,40 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
.dx-modal-drawer_container {
|
|
2
|
+
display: none !important;
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
-
.modal-
|
|
6
|
-
display: none;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.modal-drawer_container.modal-drawer_active {
|
|
10
|
-
position: fixed;
|
|
11
|
-
top: 50%;
|
|
12
|
-
left: 50%;
|
|
13
|
-
transform: translate(-50%, -50%);
|
|
14
|
-
display: grid;
|
|
15
|
-
justify-content: center;
|
|
16
|
-
align-items: center;
|
|
17
|
-
z-index: var(--dx-c-modal-drawer-z-index);
|
|
18
|
-
height: 100%;
|
|
19
|
-
width: 100%;
|
|
20
|
-
pointer-events: none;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.modal-drawer_overlay {
|
|
24
|
-
background-color: #195594;
|
|
25
|
-
bottom: 0;
|
|
26
|
-
height: 100%;
|
|
27
|
-
left: 0;
|
|
28
|
-
opacity: 0.62;
|
|
29
|
-
position: fixed;
|
|
30
|
-
right: 0;
|
|
31
|
-
top: 0;
|
|
32
|
-
width: 100%;
|
|
33
|
-
z-index: calc(var(--dx-c-modal-drawer-z-index) - 1);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
@media screen and (max-width: 768px) {
|
|
37
|
-
.modal-drawer_container.modal-drawer_active {
|
|
38
|
-
pointer-events: all;
|
|
39
|
-
}
|
|
5
|
+
.dx-modal-drawer_overlay {
|
|
6
|
+
display: none !important;
|
|
40
7
|
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class={containerClass} tabindex="0" role="dialog">
|
|
3
|
-
<slot></slot>
|
|
4
|
-
</div>
|
|
5
2
|
<div
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
class={containerClass}
|
|
4
|
+
onclick={onClickModal}
|
|
5
|
+
tabindex="0"
|
|
6
|
+
role="dialog"
|
|
7
|
+
>
|
|
8
|
+
<div style="pointer-events: all">
|
|
9
|
+
<slot onslotchange={onSlotChange}></slot>
|
|
10
|
+
</div>
|
|
11
|
+
</div>
|
|
12
|
+
<div class={overlayClass} onclick={onClickModal}></div>
|
|
10
13
|
</template>
|
|
@@ -1,55 +1,98 @@
|
|
|
1
|
-
import cx from "classnames";
|
|
2
1
|
import { LightningElement, api } from "lwc";
|
|
3
2
|
import { normalizeBoolean } from "dxUtils/normalizers";
|
|
3
|
+
import { LightningSlotElement } from "typings/custom";
|
|
4
|
+
|
|
5
|
+
const CONTAINER_CLASS = "dx-modal-drawer_container";
|
|
6
|
+
const OVERLAY_CLASS = "dx-modal-drawer_overlay";
|
|
7
|
+
|
|
8
|
+
const modalStyle =
|
|
9
|
+
"position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); display: grid; justify-content: center; align-items: center; z-index: 5000; height: 100%; width: 100%; pointer-events: none;";
|
|
10
|
+
const overlayStyle =
|
|
11
|
+
"background-color: #195594; bottom: 0; height: 100%; left: 0; opacity: 0.62; position: fixed; right: 0; top: 0; width: 100%; z-index: calc(5000 - 1);";
|
|
4
12
|
|
|
5
13
|
export default class Modal extends LightningElement {
|
|
6
14
|
private _open = false;
|
|
7
|
-
|
|
8
15
|
@api get open() {
|
|
9
16
|
return this._open;
|
|
10
17
|
}
|
|
11
|
-
|
|
12
18
|
set open(value) {
|
|
13
19
|
this._open = normalizeBoolean(value);
|
|
20
|
+
if (this._open) {
|
|
21
|
+
this.openModal();
|
|
22
|
+
} else {
|
|
23
|
+
this.closeModal();
|
|
24
|
+
}
|
|
14
25
|
}
|
|
15
26
|
|
|
27
|
+
private overlayClass = OVERLAY_CLASS;
|
|
28
|
+
private modal: HTMLElement | null = null;
|
|
29
|
+
private overlay: HTMLElement | null = null;
|
|
30
|
+
private root: HTMLElement | null = null;
|
|
31
|
+
private modalContent: HTMLElement | null = null;
|
|
32
|
+
private keydownListener: Event | null = null;
|
|
33
|
+
|
|
16
34
|
get containerClass(): string {
|
|
17
|
-
return
|
|
18
|
-
"modal-drawer_container",
|
|
19
|
-
this._open && "modal-drawer_active"
|
|
20
|
-
);
|
|
35
|
+
return CONTAINER_CLASS;
|
|
21
36
|
}
|
|
22
37
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
38
|
+
private onSlotChange = (e: LightningSlotElement) => {
|
|
39
|
+
// @ts-ignore
|
|
40
|
+
this.modalContent = e.target.assignedElements()[0];
|
|
41
|
+
if (!this.modal && !this.overlay) {
|
|
42
|
+
this.appendModalToHTML();
|
|
26
43
|
}
|
|
27
|
-
}
|
|
44
|
+
};
|
|
28
45
|
|
|
29
|
-
connectedCallback(): void {
|
|
30
|
-
this.
|
|
31
|
-
"keydown",
|
|
32
|
-
this.handleKeyDown.bind(this)
|
|
33
|
-
);
|
|
46
|
+
private connectedCallback(): void {
|
|
47
|
+
document.addEventListener("keydown", this.handleKeyDown.bind(this));
|
|
34
48
|
}
|
|
35
49
|
|
|
36
|
-
|
|
37
|
-
|
|
50
|
+
private disconnectedCallback(): void {
|
|
51
|
+
window.removeEventListener("keydown", this.handleKeyDown.bind(this));
|
|
52
|
+
this.modal?.remove();
|
|
53
|
+
this.overlay?.remove();
|
|
38
54
|
}
|
|
39
55
|
|
|
40
|
-
handleKeyDown(event: KeyboardEvent): void {
|
|
56
|
+
private handleKeyDown(event: KeyboardEvent): void {
|
|
41
57
|
if (event.key === "Escape") {
|
|
42
|
-
this.
|
|
58
|
+
this.closeModal();
|
|
43
59
|
}
|
|
44
60
|
}
|
|
45
61
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
this.
|
|
62
|
+
private appendModalToHTML = () => {
|
|
63
|
+
// @ts-ignore
|
|
64
|
+
this.root = document.querySelector("html");
|
|
65
|
+
this.modal = this.template.querySelector(`.${CONTAINER_CLASS}`);
|
|
66
|
+
this.overlay = this.template.querySelector(`.${OVERLAY_CLASS}`);
|
|
67
|
+
if (this.overlay && this.modal && this.modalContent && this.root) {
|
|
68
|
+
this.modal.setAttribute("style", modalStyle);
|
|
69
|
+
this.overlay.setAttribute("style", overlayStyle);
|
|
70
|
+
this.modal.querySelector("div")?.appendChild(this.modalContent);
|
|
71
|
+
if (this.open) {
|
|
72
|
+
this.openModal();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
private onClickModal(e) {
|
|
78
|
+
if (e?.target?.className === OVERLAY_CLASS) {
|
|
79
|
+
this.closeModal();
|
|
80
|
+
}
|
|
49
81
|
}
|
|
50
82
|
|
|
51
|
-
|
|
52
|
-
this.
|
|
53
|
-
|
|
83
|
+
private openModal() {
|
|
84
|
+
if (this.overlay && this.modal) {
|
|
85
|
+
this.root?.appendChild(this.modal);
|
|
86
|
+
this.root?.appendChild(this.overlay);
|
|
87
|
+
this.modal.querySelector("div")?.focus();
|
|
88
|
+
}
|
|
54
89
|
}
|
|
90
|
+
|
|
91
|
+
private closeModal = () => {
|
|
92
|
+
if (this.modal && this.overlay) {
|
|
93
|
+
this.modal.remove();
|
|
94
|
+
this.overlay.remove();
|
|
95
|
+
this.dispatchEvent(new CustomEvent("closemodal"));
|
|
96
|
+
}
|
|
97
|
+
};
|
|
55
98
|
}
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
export const SESSION_KEY = "dx-sidebar-search-state";
|
|
27
27
|
|
|
28
28
|
const DEFAULT_RESULT_COUNT = 20;
|
|
29
|
-
const SEARCH_DEBOUNCE_DELAY =
|
|
29
|
+
const SEARCH_DEBOUNCE_DELAY = 780;
|
|
30
30
|
|
|
31
31
|
const UserRecentSearches = new RecentSearches();
|
|
32
32
|
|
|
@@ -403,7 +403,6 @@ export default class SidebarSearch extends LightningElement {
|
|
|
403
403
|
|
|
404
404
|
private submitSearch = debounce((isSyncingSearchValue = false) => {
|
|
405
405
|
if (this.searchBox) {
|
|
406
|
-
console.log('SEARCHIN')
|
|
407
406
|
UserRecentSearches.add(this.value);
|
|
408
407
|
this.updateRecentSearches();
|
|
409
408
|
|