@exmg/exm-drawer 1.1.36 → 1.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/.rollup.cache/root/repo/packages/exm-drawer/dist/exm-drawer-base.d.ts +34 -0
- package/.rollup.cache/root/repo/packages/exm-drawer/dist/exm-drawer-base.js +99 -0
- package/.rollup.cache/root/repo/packages/exm-drawer/dist/exm-drawer.d.ts +9 -0
- package/.rollup.cache/root/repo/packages/exm-drawer/dist/exm-drawer.js +12 -0
- package/.rollup.cache/root/repo/packages/exm-drawer/dist/index.d.ts +3 -0
- package/.rollup.cache/root/repo/packages/exm-drawer/dist/index.js +4 -0
- package/.rollup.cache/root/repo/packages/exm-drawer/dist/styles/exm-drawer-styles-css.d.ts +1 -0
- package/.rollup.cache/root/repo/packages/exm-drawer/dist/styles/exm-drawer-styles-css.js +81 -0
- package/dist/exm-drawer-base.js +7 -4
- package/dist/exm-drawer.js +4 -2
- package/dist/index.js +1 -1
- package/dist/styles/exm-drawer-styles-css.js +5 -2
- package/package.json +2 -2
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ExmgElement } from '@exmg/lit-base';
|
|
2
|
+
export declare class ExmDrawerBase extends ExmgElement {
|
|
3
|
+
/**
|
|
4
|
+
* The opened state of the drawer
|
|
5
|
+
*/
|
|
6
|
+
opened: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Which side should we show the drawer
|
|
9
|
+
* @type {String}
|
|
10
|
+
*/
|
|
11
|
+
side: 'right' | 'left';
|
|
12
|
+
/**
|
|
13
|
+
* Prevent cancel on outside click or not
|
|
14
|
+
*/
|
|
15
|
+
noCancelOnOutsideClick: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Prevent cancel on use of the escape key
|
|
18
|
+
*/
|
|
19
|
+
disableEsc: boolean;
|
|
20
|
+
dialogElement?: HTMLDialogElement;
|
|
21
|
+
private onBackdropPointerDown;
|
|
22
|
+
private onCancel;
|
|
23
|
+
protected firstUpdated(): void;
|
|
24
|
+
disconnectedCallback(): void;
|
|
25
|
+
private handleOpenedChange;
|
|
26
|
+
/**
|
|
27
|
+
* Handle the backdrop click. Check if the clicked element is the dialog. If so close it.
|
|
28
|
+
* In the dialog is a div.content element. When clicking this area, the target is not the dialog, so will not close the client
|
|
29
|
+
*/
|
|
30
|
+
private handleBackdropClick;
|
|
31
|
+
openDialog(): void;
|
|
32
|
+
closeDialog(): void;
|
|
33
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
34
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { html } from 'lit';
|
|
3
|
+
import { property, query } from 'lit/decorators.js';
|
|
4
|
+
import { ExmgElement, observer } from '@exmg/lit-base';
|
|
5
|
+
export class ExmDrawerBase extends ExmgElement {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
/**
|
|
9
|
+
* The opened state of the drawer
|
|
10
|
+
*/
|
|
11
|
+
this.opened = false;
|
|
12
|
+
/**
|
|
13
|
+
* Which side should we show the drawer
|
|
14
|
+
* @type {String}
|
|
15
|
+
*/
|
|
16
|
+
this.side = 'right';
|
|
17
|
+
/**
|
|
18
|
+
* Prevent cancel on outside click or not
|
|
19
|
+
*/
|
|
20
|
+
this.noCancelOnOutsideClick = false;
|
|
21
|
+
/**
|
|
22
|
+
* Prevent cancel on use of the escape key
|
|
23
|
+
*/
|
|
24
|
+
this.disableEsc = false;
|
|
25
|
+
this.onBackdropPointerDown = (event) => this.handleBackdropClick(event);
|
|
26
|
+
this.onCancel = (event) => {
|
|
27
|
+
if (this.disableEsc) {
|
|
28
|
+
event.preventDefault();
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
firstUpdated() {
|
|
33
|
+
if (!this.dialogElement)
|
|
34
|
+
return;
|
|
35
|
+
this.dialogElement.addEventListener('pointerdown', this.onBackdropPointerDown);
|
|
36
|
+
this.dialogElement.addEventListener('cancel', this.onCancel);
|
|
37
|
+
}
|
|
38
|
+
disconnectedCallback() {
|
|
39
|
+
var _a, _b;
|
|
40
|
+
(_a = this.dialogElement) === null || _a === void 0 ? void 0 : _a.removeEventListener('pointerdown', this.onBackdropPointerDown);
|
|
41
|
+
(_b = this.dialogElement) === null || _b === void 0 ? void 0 : _b.removeEventListener('cancel', this.onCancel);
|
|
42
|
+
super.disconnectedCallback();
|
|
43
|
+
}
|
|
44
|
+
async handleOpenedChange(opened) {
|
|
45
|
+
if (!this.dialogElement)
|
|
46
|
+
return;
|
|
47
|
+
if (opened) {
|
|
48
|
+
this.dialogElement.showModal();
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
this.dialogElement.close();
|
|
52
|
+
}
|
|
53
|
+
this.fire('exm-drawer-opened-changed', { value: opened }, true);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Handle the backdrop click. Check if the clicked element is the dialog. If so close it.
|
|
57
|
+
* In the dialog is a div.content element. When clicking this area, the target is not the dialog, so will not close the client
|
|
58
|
+
*/
|
|
59
|
+
handleBackdropClick(event) {
|
|
60
|
+
var _a;
|
|
61
|
+
if (!this.noCancelOnOutsideClick && event.target === this.dialogElement) {
|
|
62
|
+
(_a = this.dialogElement) === null || _a === void 0 ? void 0 : _a.close();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
openDialog() {
|
|
66
|
+
this.opened = true;
|
|
67
|
+
}
|
|
68
|
+
closeDialog() {
|
|
69
|
+
this.opened = false;
|
|
70
|
+
}
|
|
71
|
+
render() {
|
|
72
|
+
return html `
|
|
73
|
+
<dialog class="${this.side}" @close=${() => (this.opened = false)}>
|
|
74
|
+
<div class="content">
|
|
75
|
+
<slot></slot>
|
|
76
|
+
</div>
|
|
77
|
+
</dialog>
|
|
78
|
+
`;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
__decorate([
|
|
82
|
+
property({ type: Boolean }),
|
|
83
|
+
observer(function (opened) {
|
|
84
|
+
this.handleOpenedChange(opened);
|
|
85
|
+
})
|
|
86
|
+
], ExmDrawerBase.prototype, "opened", void 0);
|
|
87
|
+
__decorate([
|
|
88
|
+
property({ type: String })
|
|
89
|
+
], ExmDrawerBase.prototype, "side", void 0);
|
|
90
|
+
__decorate([
|
|
91
|
+
property({ type: Boolean, attribute: 'no-cancel-on-outside-click' })
|
|
92
|
+
], ExmDrawerBase.prototype, "noCancelOnOutsideClick", void 0);
|
|
93
|
+
__decorate([
|
|
94
|
+
property({ type: Boolean, attribute: 'no-cancel-on-escape' })
|
|
95
|
+
], ExmDrawerBase.prototype, "disableEsc", void 0);
|
|
96
|
+
__decorate([
|
|
97
|
+
query('dialog')
|
|
98
|
+
], ExmDrawerBase.prototype, "dialogElement", void 0);
|
|
99
|
+
//# sourceMappingURL=exm-drawer-base.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { customElement } from 'lit/decorators.js';
|
|
3
|
+
import { style } from './styles/exm-drawer-styles-css.js';
|
|
4
|
+
import { ExmDrawerBase } from './exm-drawer-base.js';
|
|
5
|
+
let ExmDrawer = class ExmDrawer extends ExmDrawerBase {
|
|
6
|
+
};
|
|
7
|
+
ExmDrawer.styles = [style];
|
|
8
|
+
ExmDrawer = __decorate([
|
|
9
|
+
customElement('exm-drawer')
|
|
10
|
+
], ExmDrawer);
|
|
11
|
+
export { ExmDrawer };
|
|
12
|
+
//# sourceMappingURL=exm-drawer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const style: import("lit").CSSResult;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
export const style = css `
|
|
3
|
+
:host {
|
|
4
|
+
--_exm-drawer-max-width: var(--exm-drawer-max-width, 574px);
|
|
5
|
+
--_exm-drawer-top-offset: var(--exm-drawer-top-offset, 0);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
dialog {
|
|
9
|
+
--drawer-animation-start: var(--_exm-drawer-max-width);
|
|
10
|
+
--drawer-animation-end: 0;
|
|
11
|
+
|
|
12
|
+
position: fixed;
|
|
13
|
+
top: var(--_exm-drawer-top-offset);
|
|
14
|
+
right: 0;
|
|
15
|
+
left: auto;
|
|
16
|
+
width: var(--_exm-drawer-max-width);
|
|
17
|
+
margin: 0;
|
|
18
|
+
height: calc(100vh - var(--_exm-drawer-top-offset));
|
|
19
|
+
max-height: calc(100vh - var(--_exm-drawer-top-offset));
|
|
20
|
+
padding: 0;
|
|
21
|
+
transition:
|
|
22
|
+
display 0.3s allow-discrete,
|
|
23
|
+
overlay 0.3s allow-discrete;
|
|
24
|
+
animation: drawerClose 0.3s forwards;
|
|
25
|
+
border: 0;
|
|
26
|
+
background-color: var(--exm-drawer-container-color, var(--md-sys-color-surface-container, #f3edf7));
|
|
27
|
+
color: var(--exm-drawer-container-on-color, var(--md-sys-color-on-surface, #f3edf7));
|
|
28
|
+
|
|
29
|
+
&[open] {
|
|
30
|
+
animation: drawerShow 0.3s forwards;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&::backdrop {
|
|
34
|
+
background: rgba(0, 0, 0, 0.7);
|
|
35
|
+
backdrop-filter: blur(4px);
|
|
36
|
+
top: var(--_exm-drawer-top-offset);
|
|
37
|
+
animation: overlayShow 300ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&.left {
|
|
41
|
+
--drawer-animation-start: calc(var(--_exm-drawer-max-width) * -1);
|
|
42
|
+
|
|
43
|
+
left: 0;
|
|
44
|
+
right: auto;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.content {
|
|
48
|
+
position: absolute;
|
|
49
|
+
width: 100%;
|
|
50
|
+
height: 100%;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@keyframes overlayShow {
|
|
55
|
+
from {
|
|
56
|
+
opacity: 0;
|
|
57
|
+
}
|
|
58
|
+
to {
|
|
59
|
+
opacity: 1;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@keyframes drawerShow {
|
|
64
|
+
from {
|
|
65
|
+
transform: translateX(var(--drawer-animation-start));
|
|
66
|
+
}
|
|
67
|
+
to {
|
|
68
|
+
transform: translateX(var(--drawer-animation-end));
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@keyframes drawerClose {
|
|
73
|
+
from {
|
|
74
|
+
transform: translateX(var(--drawer-animation-end));
|
|
75
|
+
}
|
|
76
|
+
to {
|
|
77
|
+
transform: translateX(var(--drawer-animation-start));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
`;
|
|
81
|
+
//# sourceMappingURL=exm-drawer-styles-css.js.map
|
package/dist/exm-drawer-base.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { __decorate } from
|
|
1
|
+
import { __decorate } from 'tslib';
|
|
2
2
|
import { html } from 'lit';
|
|
3
3
|
import { property, query } from 'lit/decorators.js';
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import { observer, ExmgElement } from '@exmg/lit-base';
|
|
5
|
+
|
|
6
|
+
class ExmDrawerBase extends ExmgElement {
|
|
6
7
|
constructor() {
|
|
7
8
|
super(...arguments);
|
|
8
9
|
/**
|
|
@@ -96,4 +97,6 @@ __decorate([
|
|
|
96
97
|
__decorate([
|
|
97
98
|
query('dialog')
|
|
98
99
|
], ExmDrawerBase.prototype, "dialogElement", void 0);
|
|
99
|
-
|
|
100
|
+
|
|
101
|
+
export { ExmDrawerBase };
|
|
102
|
+
//# sourceMappingURL=exm-drawer-base.js.map
|
package/dist/exm-drawer.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { __decorate } from
|
|
1
|
+
import { __decorate } from 'tslib';
|
|
2
2
|
import { customElement } from 'lit/decorators.js';
|
|
3
3
|
import { style } from './styles/exm-drawer-styles-css.js';
|
|
4
4
|
import { ExmDrawerBase } from './exm-drawer-base.js';
|
|
5
|
+
|
|
5
6
|
let ExmDrawer = class ExmDrawer extends ExmDrawerBase {
|
|
6
7
|
};
|
|
7
8
|
ExmDrawer.styles = [style];
|
|
8
9
|
ExmDrawer = __decorate([
|
|
9
10
|
customElement('exm-drawer')
|
|
10
11
|
], ExmDrawer);
|
|
12
|
+
|
|
11
13
|
export { ExmDrawer };
|
|
12
|
-
//# sourceMappingURL=exm-drawer.js.map
|
|
14
|
+
//# sourceMappingURL=exm-drawer.js.map
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
const style = css `
|
|
3
4
|
:host {
|
|
4
5
|
--_exm-drawer-max-width: var(--exm-drawer-max-width, 574px);
|
|
5
6
|
--_exm-drawer-top-offset: var(--exm-drawer-top-offset, 0);
|
|
@@ -78,4 +79,6 @@ export const style = css `
|
|
|
78
79
|
}
|
|
79
80
|
}
|
|
80
81
|
`;
|
|
81
|
-
|
|
82
|
+
|
|
83
|
+
export { style };
|
|
84
|
+
//# sourceMappingURL=exm-drawer-styles-css.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exmg/exm-drawer",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"publishConfig": {
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "b5f4ed4f41d79e3cce85dc0c44181ef4413d7458"
|
|
41
41
|
}
|