@proximus/lavender-drawer 2.0.0-alpha.20 → 2.0.0-alpha.200
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/dist/Drawer.d.ts +25 -5
- package/dist/custom-elements.json +247 -0
- package/dist/index.es.js +149 -130
- package/dist/vscode.css-custom-data.json +6 -0
- package/dist/vscode.html-custom-data.json +22 -0
- package/dist/web-types.json +61 -0
- package/package.json +2 -2
package/dist/Drawer.d.ts
CHANGED
|
@@ -6,22 +6,42 @@ import '@proximus/lavender-heading';
|
|
|
6
6
|
import { type Icon } from '@proximus/lavender-icon';
|
|
7
7
|
export declare const HIDE_EVENT = "px.lavender.drawer.hide";
|
|
8
8
|
export declare class Drawer extends HTMLElement {
|
|
9
|
+
observer: MutationObserver | null;
|
|
10
|
+
private previousFocusedElement;
|
|
9
11
|
template: string;
|
|
10
12
|
constructor();
|
|
11
13
|
connectedCallback(): void;
|
|
12
14
|
static get observedAttributes(): string[];
|
|
13
|
-
attributeChangedCallback(
|
|
15
|
+
attributeChangedCallback(attrName: string, oldValue: string, newValue: string): void;
|
|
14
16
|
disconnectedCallback(): void;
|
|
15
17
|
show(): void;
|
|
16
18
|
hide(): void;
|
|
17
19
|
toggleFooterVisibility(): void;
|
|
20
|
+
addOpenListener(): void;
|
|
21
|
+
addCloseListener(): void;
|
|
22
|
+
get $opener(): HTMLElement;
|
|
23
|
+
get $closer(): HTMLElement;
|
|
18
24
|
get $closeButton(): Icon;
|
|
19
25
|
get $dialog(): HTMLDialogElement;
|
|
20
26
|
get open(): boolean;
|
|
21
|
-
get $slotFooter(): HTMLSlotElement;
|
|
22
|
-
get $slottedFooter(): HTMLElement;
|
|
27
|
+
get $slotFooter(): HTMLSlotElement | null;
|
|
28
|
+
get $slottedFooter(): HTMLElement | null;
|
|
23
29
|
get $footer(): HTMLElement;
|
|
24
30
|
set open(value: boolean);
|
|
25
|
-
get closeButtonAriaLabel(): string;
|
|
26
|
-
set closeButtonAriaLabel(value: string);
|
|
31
|
+
get closeButtonAriaLabel(): string | null;
|
|
32
|
+
set closeButtonAriaLabel(value: string | null);
|
|
33
|
+
get openedby(): string | null;
|
|
34
|
+
set openedby(value: string | null);
|
|
35
|
+
get closedby(): string | null;
|
|
36
|
+
set closedby(value: string | null);
|
|
37
|
+
get fullscreen(): boolean;
|
|
38
|
+
set fullscreen(value: boolean);
|
|
39
|
+
get fullscreenMobile(): boolean;
|
|
40
|
+
set fullscreenMobile(value: boolean);
|
|
41
|
+
get fullscreenTablet(): boolean;
|
|
42
|
+
set fullscreenTablet(value: boolean);
|
|
43
|
+
get fullscreenLaptop(): boolean;
|
|
44
|
+
set fullscreenLaptop(value: boolean);
|
|
45
|
+
get fullscreenDesktop(): boolean;
|
|
46
|
+
set fullscreenDesktop(value: boolean);
|
|
27
47
|
}
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": "1.0.0",
|
|
3
|
+
"readme": "",
|
|
4
|
+
"modules": [
|
|
5
|
+
{
|
|
6
|
+
"kind": "javascript-module",
|
|
7
|
+
"path": "src/Drawer.ts",
|
|
8
|
+
"declarations": [
|
|
9
|
+
{
|
|
10
|
+
"kind": "variable",
|
|
11
|
+
"name": "HIDE_EVENT",
|
|
12
|
+
"type": {
|
|
13
|
+
"text": "string"
|
|
14
|
+
},
|
|
15
|
+
"default": "'px.lavender.drawer.hide'"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"kind": "class",
|
|
19
|
+
"description": "",
|
|
20
|
+
"name": "Drawer",
|
|
21
|
+
"members": [
|
|
22
|
+
{
|
|
23
|
+
"kind": "field",
|
|
24
|
+
"name": "observer",
|
|
25
|
+
"type": {
|
|
26
|
+
"text": "MutationObserver | null"
|
|
27
|
+
},
|
|
28
|
+
"default": "null"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"kind": "field",
|
|
32
|
+
"name": "previousFocusedElement",
|
|
33
|
+
"type": {
|
|
34
|
+
"text": "HTMLElement | null"
|
|
35
|
+
},
|
|
36
|
+
"privacy": "private",
|
|
37
|
+
"default": "null"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"kind": "field",
|
|
41
|
+
"name": "template",
|
|
42
|
+
"default": "`<dialog popover role=\"dialog\" aria-modal=\"true\" > <div id=\"container\"> <px-vstack gap=\"heading-to-subtitle\" id=\"header\"> <px-h1 variant=\"title-2xl\"> <slot name=\"title\"></slot> </px-h1> <px-h2 variant=\"subtitle\" color=\"neutral\"> <slot name=\"subtitle\"></slot> </px-h2> </px-vstack> <div id=\"content\"> <slot></slot> </div> <px-vstack gap=\"l\" id=\"footer\"> <px-separator size=\"m\"></px-separator> <px-stack gap=\"s\" justify-content=\"flex-end\" align-items=\"center\" align-items--mobile=\"stretch\" direction=\"row\" direction--mobile=\"column-reverse\" > <slot name=\"footer\"></slot> </px-stack> </px-vstack> <px-button-icon variant=\"secondary\" size=\"small\" id=\"close\"> <px-icon name=\"cross\" from=\"lavender\"></px-icon> </px-button-icon> </div> </dialog>`"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"kind": "method",
|
|
46
|
+
"name": "show"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"kind": "method",
|
|
50
|
+
"name": "hide"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"kind": "method",
|
|
54
|
+
"name": "toggleFooterVisibility"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"kind": "method",
|
|
58
|
+
"name": "addOpenListener"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"kind": "method",
|
|
62
|
+
"name": "addCloseListener"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"kind": "field",
|
|
66
|
+
"name": "$opener",
|
|
67
|
+
"readonly": true
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"kind": "field",
|
|
71
|
+
"name": "$closer",
|
|
72
|
+
"readonly": true
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"kind": "field",
|
|
76
|
+
"name": "$closeButton",
|
|
77
|
+
"readonly": true
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"kind": "field",
|
|
81
|
+
"name": "$dialog",
|
|
82
|
+
"readonly": true
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"kind": "field",
|
|
86
|
+
"name": "open"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"kind": "field",
|
|
90
|
+
"name": "$slotFooter",
|
|
91
|
+
"readonly": true
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"kind": "field",
|
|
95
|
+
"name": "$slottedFooter",
|
|
96
|
+
"readonly": true
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"kind": "field",
|
|
100
|
+
"name": "$footer",
|
|
101
|
+
"readonly": true
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"kind": "field",
|
|
105
|
+
"name": "closeButtonAriaLabel"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"kind": "field",
|
|
109
|
+
"name": "openedby"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"kind": "field",
|
|
113
|
+
"name": "closedby"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"kind": "field",
|
|
117
|
+
"name": "fullscreen"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"kind": "field",
|
|
121
|
+
"name": "fullscreenMobile"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"kind": "field",
|
|
125
|
+
"name": "fullscreenTablet"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"kind": "field",
|
|
129
|
+
"name": "fullscreenLaptop"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"kind": "field",
|
|
133
|
+
"name": "fullscreenDesktop"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"kind": "field",
|
|
137
|
+
"name": "innerHTML"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"kind": "field",
|
|
141
|
+
"name": "adoptedStyleSheets",
|
|
142
|
+
"type": {
|
|
143
|
+
"text": "array"
|
|
144
|
+
},
|
|
145
|
+
"default": "[styleSheet]"
|
|
146
|
+
}
|
|
147
|
+
],
|
|
148
|
+
"events": [
|
|
149
|
+
{
|
|
150
|
+
"name": "HIDE_EVENT",
|
|
151
|
+
"type": {
|
|
152
|
+
"text": "Event"
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
],
|
|
156
|
+
"attributes": [
|
|
157
|
+
{
|
|
158
|
+
"name": "open"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"name": "close-button-aria-label"
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
"name": "openedby"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"name": "closedby"
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"name": "fullscreen"
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"name": "fullscreen--mobile"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"name": "fullscreen--tablet"
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"name": "fullscreen--laptop"
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"name": "fullscreen--desktop"
|
|
183
|
+
}
|
|
184
|
+
],
|
|
185
|
+
"superclass": {
|
|
186
|
+
"name": "HTMLElement"
|
|
187
|
+
},
|
|
188
|
+
"tagName": "px-drawer",
|
|
189
|
+
"customElement": true
|
|
190
|
+
}
|
|
191
|
+
],
|
|
192
|
+
"exports": [
|
|
193
|
+
{
|
|
194
|
+
"kind": "js",
|
|
195
|
+
"name": "HIDE_EVENT",
|
|
196
|
+
"declaration": {
|
|
197
|
+
"name": "HIDE_EVENT",
|
|
198
|
+
"module": "src/Drawer.ts"
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
"kind": "js",
|
|
203
|
+
"name": "Drawer",
|
|
204
|
+
"declaration": {
|
|
205
|
+
"name": "Drawer",
|
|
206
|
+
"module": "src/Drawer.ts"
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"kind": "custom-element-definition",
|
|
211
|
+
"name": "px-drawer",
|
|
212
|
+
"declaration": {
|
|
213
|
+
"name": "Drawer",
|
|
214
|
+
"module": "src/Drawer.ts"
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
]
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
"kind": "javascript-module",
|
|
221
|
+
"path": "src/drawer.css",
|
|
222
|
+
"declarations": [],
|
|
223
|
+
"exports": []
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
"kind": "javascript-module",
|
|
227
|
+
"path": "src/drawer.css.diff",
|
|
228
|
+
"declarations": [],
|
|
229
|
+
"exports": []
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
"kind": "javascript-module",
|
|
233
|
+
"path": "src/index.ts",
|
|
234
|
+
"declarations": [],
|
|
235
|
+
"exports": [
|
|
236
|
+
{
|
|
237
|
+
"kind": "js",
|
|
238
|
+
"name": "*",
|
|
239
|
+
"declaration": {
|
|
240
|
+
"name": "*",
|
|
241
|
+
"module": "src/Drawer.ts"
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
]
|
|
245
|
+
}
|
|
246
|
+
]
|
|
247
|
+
}
|
package/dist/index.es.js
CHANGED
|
@@ -3,134 +3,153 @@ import "@proximus/lavender-layout";
|
|
|
3
3
|
import "@proximus/lavender-button-icon";
|
|
4
4
|
import "@proximus/lavender-icon";
|
|
5
5
|
import "@proximus/lavender-heading";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
<div id
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
6
|
+
import { booleanPropertyToAttributeSetter as e, propertyToAttributeSetter as t } from "@proximus/lavender-common";
|
|
7
|
+
//#region src/drawer.css?inline
|
|
8
|
+
var n = ":host *{box-sizing:border-box}::backdrop{-webkit-backdrop-filter:saturate(180%)blur(15px);backdrop-filter:saturate(180%)blur(15px);background:#0000004d}dialog{box-shadow:none;border-radius:var(--px-radius-main) var(--px-radius-main) 0 0;background-color:var(--px-color-background-surface-light);border:0;width:100%;margin:auto 0 0;padding:0;animation:.3s dialog-fade-in-bottom}#container{column-gap:var(--px-spacing-l-mobile);padding:var(--px-padding-l-mobile);grid-template:\"header close\"\"content content\"1fr\"footer footer\"/1fr auto;max-height:90dvh;display:grid}#header{margin-bottom:var(--px-spacing-l-mobile);grid-area:header}#close{grid-area:close}#content{grid-area:content;overflow:hidden auto}#footer{margin-top:var(--px-spacing-l-mobile);grid-area:footer}:host([fullscreen]) #container{height:90dvh}@media screen and (width<=47.938rem){:host([fullscreen--mobile]) #container{height:90dvh}}@media screen and (width>=48rem) and (width<=64rem){:host([fullscreen--tablet]) #container{height:90dvh}}@media screen and (width>=48rem){#container{column-gap:var(--px-spacing-l-tablet);padding:var(--px-padding-l-tablet)}#header{margin-bottom:var(--px-spacing-l-tablet)}#footer{margin-top:var(--px-spacing-l-tablet)}}@media screen and (width>=64.0625rem) and (width<=90rem){:host([fullscreen--laptop]:not([showfrom=left]):not([showfrom=right])) #container{height:90dvh}}@media screen and (width>=64.0625rem){#container{column-gap:var(--px-spacing-l-laptop);padding:var(--px-padding-l-laptop);max-width:var(--px-content-wrapper-max-width-laptop);margin:0 auto}#header{margin-bottom:var(--px-spacing-l-laptop)}#footer{margin-top:var(--px-spacing-l-laptop)}:is(:host([showfrom=right]),:host([showfrom=left])) dialog{width:75%;height:100%}:is(:host([showfrom=right]),:host([showfrom=left])) #container{height:100%;max-height:100%}:host([showfrom=right]) dialog{border-radius:var(--px-radius-main) 0 0 var(--px-radius-main);margin:0 0 0 auto;animation:.3s dialog-fade-in-right}:host([showfrom=right]) #container{margin:0 auto 0 0}:host([showfrom=left]) dialog{border-radius:0 var(--px-radius-main) var(--px-radius-main) 0;margin:0 auto 0 0;animation:.3s dialog-fade-in-left}:host([showfrom=left]) #container{margin:0 0 0 auto}:is(:host([showfrom=right][fullscreen]),:host([showfrom=left][fullscreen])) #container{height:100%}}@media screen and (width>=90.0625rem){#container{column-gap:var(--px-spacing-l-desktop);padding:var(--px-padding-l-desktop)}#header{margin-bottom:var(--px-spacing-l-desktop)}#footer{margin-top:var(--px-spacing-l-desktop)}:host([fullscreen--desktop]:not([showfrom=left]):not([showfrom=right])) #container{height:90dvh}}@keyframes dialog-fade-in-right{0%{margin-right:-1080px}to{margin-right:0}}@keyframes dialog-fade-in-left{0%{margin-left:-1080px}to{margin-left:0}}@keyframes dialog-fade-in-bottom{0%{margin-bottom:-200px}to{margin-bottom:0}}", r = new CSSStyleSheet();
|
|
9
|
+
r.replaceSync(n);
|
|
10
|
+
var i = "px.lavender.drawer.hide", a = class extends HTMLElement {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(), this.observer = null, this.previousFocusedElement = null, this.template = "<dialog popover role=\"dialog\" aria-modal=\"true\" >\n <div id=\"container\">\n <px-vstack gap=\"heading-to-subtitle\" id=\"header\">\n <px-h1 variant=\"title-2xl\">\n <slot name=\"title\"></slot>\n </px-h1>\n <px-h2 variant=\"subtitle\" color=\"neutral\">\n <slot name=\"subtitle\"></slot>\n </px-h2>\n </px-vstack>\n <div id=\"content\">\n <slot></slot>\n </div>\n <px-vstack gap=\"l\" id=\"footer\">\n <px-separator size=\"m\"></px-separator>\n <px-stack\n gap=\"s\"\n justify-content=\"flex-end\"\n align-items=\"center\"\n align-items--mobile=\"stretch\"\n direction=\"row\"\n direction--mobile=\"column-reverse\"\n >\n <slot name=\"footer\"></slot>\n </px-stack>\n </px-vstack>\n <px-button-icon variant=\"secondary\" size=\"small\" id=\"close\">\n <px-icon name=\"cross\" from=\"lavender\"></px-icon>\n </px-button-icon>\n </div>\n </dialog>", this.attachShadow({ mode: "open" }), this.shadowRoot.innerHTML = this.template, this.shadowRoot.adoptedStyleSheets = [r];
|
|
13
|
+
}
|
|
14
|
+
connectedCallback() {
|
|
15
|
+
this.toggleFooterVisibility = this.toggleFooterVisibility.bind(this), this.$opener && this.addOpenListener(), this.$closer && this.addCloseListener(), this.hasAttribute("showfrom") || this.setAttribute("showfrom", "bottom"), this.$closeButton.addEventListener("click", () => {
|
|
16
|
+
this.hide();
|
|
17
|
+
}), this.$dialog.addEventListener("toggle", (e) => {
|
|
18
|
+
e.newState === "closed" && this.hide();
|
|
19
|
+
}), this.toggleFooterVisibility(), this.$slotFooter?.addEventListener("slotchange", this.toggleFooterVisibility);
|
|
20
|
+
}
|
|
21
|
+
static get observedAttributes() {
|
|
22
|
+
return [
|
|
23
|
+
"open",
|
|
24
|
+
"close-button-aria-label",
|
|
25
|
+
"openedby",
|
|
26
|
+
"closedby",
|
|
27
|
+
"fullscreen",
|
|
28
|
+
"fullscreen--mobile",
|
|
29
|
+
"fullscreen--tablet",
|
|
30
|
+
"fullscreen--laptop",
|
|
31
|
+
"fullscreen--desktop"
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
attributeChangedCallback(e, t, n) {
|
|
35
|
+
switch (e) {
|
|
36
|
+
case "open":
|
|
37
|
+
n === null ? this.hide() : this.show();
|
|
38
|
+
break;
|
|
39
|
+
case "close-button-aria-label":
|
|
40
|
+
n ? this.$closeButton?.setAttribute?.("aria-label", n || "Close drawer") : this.$closeButton?.removeAttribute("aria-label");
|
|
41
|
+
break;
|
|
42
|
+
case "openedby":
|
|
43
|
+
n !== t && (t && document.querySelector(`#${t}`)?.removeEventListener("click", () => this.show()), this.addOpenListener());
|
|
44
|
+
break;
|
|
45
|
+
case "closedby": this.addCloseListener();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
disconnectedCallback() {
|
|
49
|
+
this.$slotFooter?.removeEventListener("slotchange", this.toggleFooterVisibility), this.observer?.disconnect(), this.$opener && this.$opener.removeEventListener("click", () => this.show()), this.$closer && this.$closer.removeEventListener("click", () => this.hide());
|
|
50
|
+
}
|
|
51
|
+
show() {
|
|
52
|
+
let e = document.activeElement;
|
|
53
|
+
this.previousFocusedElement = e?.shadowRoot?.activeElement ?? e, this.$dialog.showPopover?.(), document.body.style.overflow = "hidden";
|
|
54
|
+
}
|
|
55
|
+
hide() {
|
|
56
|
+
this.$dialog.hidePopover?.(), document.body.style.overflow = "", this.previousFocusedElement?.focus(), this.previousFocusedElement = null, this.dispatchEvent(new Event(i, {
|
|
57
|
+
bubbles: !0,
|
|
58
|
+
composed: !0
|
|
59
|
+
}));
|
|
60
|
+
}
|
|
61
|
+
toggleFooterVisibility() {
|
|
62
|
+
this.$slottedFooter ? this.$footer.style.display = "block" : this.$footer.style.display = "none";
|
|
63
|
+
}
|
|
64
|
+
addOpenListener() {
|
|
65
|
+
this.$opener ? this.$opener.getAttribute("data-has-opener") !== "true" && (this.$opener.setAttribute("data-has-opener", "true"), this.$opener.addEventListener("click", () => this.show())) : (this.observer = new MutationObserver(() => {
|
|
66
|
+
this.$opener && (this.observer.disconnect(), this.observer = null, this.addOpenListener());
|
|
67
|
+
}), this.observer.observe(document.body, {
|
|
68
|
+
childList: !0,
|
|
69
|
+
subtree: !0
|
|
70
|
+
}));
|
|
71
|
+
}
|
|
72
|
+
addCloseListener() {
|
|
73
|
+
this.$closer && this.$closer?.addEventListener("click", () => {
|
|
74
|
+
this.hide();
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
get $opener() {
|
|
78
|
+
return document.querySelector(`#${this.getAttribute("openedby")}`);
|
|
79
|
+
}
|
|
80
|
+
get $closer() {
|
|
81
|
+
return document.querySelector(`#${this.getAttribute("closedby")}`);
|
|
82
|
+
}
|
|
83
|
+
get $closeButton() {
|
|
84
|
+
return this.shadowRoot.querySelector("px-button-icon");
|
|
85
|
+
}
|
|
86
|
+
get $dialog() {
|
|
87
|
+
return this.shadowRoot.querySelector("dialog");
|
|
88
|
+
}
|
|
89
|
+
get open() {
|
|
90
|
+
return this.hasAttribute("open");
|
|
91
|
+
}
|
|
92
|
+
get $slotFooter() {
|
|
93
|
+
return this.shadowRoot.querySelector("slot[name=\"footer\"]");
|
|
94
|
+
}
|
|
95
|
+
get $slottedFooter() {
|
|
96
|
+
return this.querySelector("[slot=\"footer\"]");
|
|
97
|
+
}
|
|
98
|
+
get $footer() {
|
|
99
|
+
return this.shadowRoot.querySelector("#footer");
|
|
100
|
+
}
|
|
101
|
+
set open(t) {
|
|
102
|
+
e(this, "open", t);
|
|
103
|
+
}
|
|
104
|
+
get closeButtonAriaLabel() {
|
|
105
|
+
return this.getAttribute("close-button-aria-label");
|
|
106
|
+
}
|
|
107
|
+
set closeButtonAriaLabel(e) {
|
|
108
|
+
t(this, "close-button-aria-label", e);
|
|
109
|
+
}
|
|
110
|
+
get openedby() {
|
|
111
|
+
return this.getAttribute("openedby");
|
|
112
|
+
}
|
|
113
|
+
set openedby(e) {
|
|
114
|
+
t(this, "openedby", e);
|
|
115
|
+
}
|
|
116
|
+
get closedby() {
|
|
117
|
+
return this.getAttribute("closedby");
|
|
118
|
+
}
|
|
119
|
+
set closedby(e) {
|
|
120
|
+
t(this, "closedby", e);
|
|
121
|
+
}
|
|
122
|
+
get fullscreen() {
|
|
123
|
+
return this.hasAttribute("fullscreen");
|
|
124
|
+
}
|
|
125
|
+
set fullscreen(t) {
|
|
126
|
+
e(this, "fullscreen", t);
|
|
127
|
+
}
|
|
128
|
+
get fullscreenMobile() {
|
|
129
|
+
return this.hasAttribute("fullscreen--mobile");
|
|
130
|
+
}
|
|
131
|
+
set fullscreenMobile(t) {
|
|
132
|
+
e(this, "fullscreen--mobile", t);
|
|
133
|
+
}
|
|
134
|
+
get fullscreenTablet() {
|
|
135
|
+
return this.hasAttribute("fullscreen--tablet");
|
|
136
|
+
}
|
|
137
|
+
set fullscreenTablet(t) {
|
|
138
|
+
e(this, "fullscreen--tablet", t);
|
|
139
|
+
}
|
|
140
|
+
get fullscreenLaptop() {
|
|
141
|
+
return this.hasAttribute("fullscreen--laptop");
|
|
142
|
+
}
|
|
143
|
+
set fullscreenLaptop(t) {
|
|
144
|
+
e(this, "fullscreen--laptop", t);
|
|
145
|
+
}
|
|
146
|
+
get fullscreenDesktop() {
|
|
147
|
+
return this.hasAttribute("fullscreen--desktop");
|
|
148
|
+
}
|
|
149
|
+
set fullscreenDesktop(t) {
|
|
150
|
+
e(this, "fullscreen--desktop", t);
|
|
151
|
+
}
|
|
136
152
|
};
|
|
153
|
+
customElements.get("px-drawer") || customElements.define("px-drawer", a);
|
|
154
|
+
//#endregion
|
|
155
|
+
export { a as Drawer, i as HIDE_EVENT };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/microsoft/vscode-html-languageservice/main/docs/customData.schema.json",
|
|
3
|
+
"version": 1.1,
|
|
4
|
+
"tags": [
|
|
5
|
+
{
|
|
6
|
+
"name": "px-drawer",
|
|
7
|
+
"description": "\n---\n\n\n### **Events:**\n - **HIDE_EVENT**",
|
|
8
|
+
"attributes": [
|
|
9
|
+
{ "name": "open", "values": [] },
|
|
10
|
+
{ "name": "close-button-aria-label", "values": [] },
|
|
11
|
+
{ "name": "openedby", "values": [] },
|
|
12
|
+
{ "name": "closedby", "values": [] },
|
|
13
|
+
{ "name": "fullscreen", "values": [] },
|
|
14
|
+
{ "name": "fullscreen--mobile", "values": [] },
|
|
15
|
+
{ "name": "fullscreen--tablet", "values": [] },
|
|
16
|
+
{ "name": "fullscreen--laptop", "values": [] },
|
|
17
|
+
{ "name": "fullscreen--desktop", "values": [] }
|
|
18
|
+
],
|
|
19
|
+
"references": []
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
|
|
3
|
+
"name": "@proximus/lavender-drawer",
|
|
4
|
+
"version": "2.0.0-alpha.200",
|
|
5
|
+
"description-markup": "markdown",
|
|
6
|
+
"contributions": {
|
|
7
|
+
"html": {
|
|
8
|
+
"elements": [
|
|
9
|
+
{
|
|
10
|
+
"name": "px-drawer",
|
|
11
|
+
"description": "\n---\n\n\n### **Events:**\n - **HIDE_EVENT**",
|
|
12
|
+
"doc-url": "",
|
|
13
|
+
"attributes": [
|
|
14
|
+
{ "name": "open", "value": { "type": "string" } },
|
|
15
|
+
{
|
|
16
|
+
"name": "close-button-aria-label",
|
|
17
|
+
"value": { "type": "string" }
|
|
18
|
+
},
|
|
19
|
+
{ "name": "openedby", "value": { "type": "string" } },
|
|
20
|
+
{ "name": "closedby", "value": { "type": "string" } },
|
|
21
|
+
{ "name": "fullscreen", "value": { "type": "string" } },
|
|
22
|
+
{ "name": "fullscreen--mobile", "value": { "type": "string" } },
|
|
23
|
+
{ "name": "fullscreen--tablet", "value": { "type": "string" } },
|
|
24
|
+
{ "name": "fullscreen--laptop", "value": { "type": "string" } },
|
|
25
|
+
{ "name": "fullscreen--desktop", "value": { "type": "string" } }
|
|
26
|
+
],
|
|
27
|
+
"events": [{ "name": "HIDE_EVENT", "type": "Event" }],
|
|
28
|
+
"js": {
|
|
29
|
+
"properties": [
|
|
30
|
+
{ "name": "observer", "type": "MutationObserver | null" },
|
|
31
|
+
{ "name": "template" },
|
|
32
|
+
{ "name": "$opener" },
|
|
33
|
+
{ "name": "$closer" },
|
|
34
|
+
{ "name": "$closeButton" },
|
|
35
|
+
{ "name": "$dialog" },
|
|
36
|
+
{ "name": "open" },
|
|
37
|
+
{ "name": "$slotFooter" },
|
|
38
|
+
{ "name": "$slottedFooter" },
|
|
39
|
+
{ "name": "$footer" },
|
|
40
|
+
{ "name": "closeButtonAriaLabel" },
|
|
41
|
+
{ "name": "openedby" },
|
|
42
|
+
{ "name": "closedby" },
|
|
43
|
+
{ "name": "fullscreen" },
|
|
44
|
+
{ "name": "fullscreenMobile" },
|
|
45
|
+
{ "name": "fullscreenTablet" },
|
|
46
|
+
{ "name": "fullscreenLaptop" },
|
|
47
|
+
{ "name": "fullscreenDesktop" },
|
|
48
|
+
{ "name": "innerHTML" },
|
|
49
|
+
{ "name": "adoptedStyleSheets", "type": "array" }
|
|
50
|
+
],
|
|
51
|
+
"events": [{ "name": "HIDE_EVENT", "type": "Event" }]
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
"css": {
|
|
57
|
+
"properties": [],
|
|
58
|
+
"pseudo-elements": []
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@proximus/lavender-drawer",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.200",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.es.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"clean": "rm -rf dist",
|
|
14
14
|
"build": "npm run clean && NODE_ENV=development vite build && tsc && npm run transform-package-json && npm run wc-manifest",
|
|
15
15
|
"test": "vitest run --coverage",
|
|
16
|
-
"wc-manifest": "cem analyze --globs \"src/*\" --config
|
|
16
|
+
"wc-manifest": "cem analyze --globs \"src/*\" --config ../../custom-elements-manifest.config.js --outdir dist"
|
|
17
17
|
},
|
|
18
18
|
"publishConfig": {
|
|
19
19
|
"access": "public"
|