@getflip/swirl-components 0.8.0 → 0.8.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.
- package/dist/cjs/flip-console-layout.cjs.entry.js +29 -1156
- package/dist/cjs/flip-popover.cjs.entry.js +1 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/swirl-components.cjs.js +1 -1
- package/dist/collection/assets/pdfjs/pdf.worker.min.js +1 -1
- package/dist/collection/components/flip-console-layout/flip-console-layout.js +63 -15
- package/dist/collection/components/flip-popover/flip-popover.js +1 -0
- package/dist/components/assets/pdfjs/pdf.worker.min.js +1 -1
- package/dist/components/flip-console-layout.js +32 -1157
- package/dist/components/flip-popover2.js +1 -0
- package/dist/esm/flip-console-layout.entry.js +29 -1156
- package/dist/esm/flip-popover.entry.js +1 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/swirl-components.js +1 -1
- package/dist/swirl-components/p-622824bf.entry.js +1 -0
- package/dist/swirl-components/p-a57ef771.entry.js +1 -0
- package/dist/swirl-components/swirl-components.esm.js +1 -1
- package/dist/types/components/flip-console-layout/flip-console-layout.d.ts +9 -1
- package/dist/types/components.d.ts +8 -0
- package/package.json +1 -1
- package/dist/swirl-components/p-4d82b925.entry.js +0 -1
- package/dist/swirl-components/p-f99eb1b8.entry.js +0 -10
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Component, Element, Event, h, Host, Listen, Method, Prop, State, } from "@stencil/core";
|
|
2
2
|
import classnames from "classnames";
|
|
3
|
-
import { createFocusTrap } from "focus-trap";
|
|
4
3
|
import { isMobileViewport } from "../../utils";
|
|
5
4
|
export class FlipConsoleLayout {
|
|
6
5
|
constructor() {
|
|
@@ -19,12 +18,20 @@ export class FlipConsoleLayout {
|
|
|
19
18
|
this.onMobileNavigationToggleClick = () => {
|
|
20
19
|
this.toggleSidebar();
|
|
21
20
|
};
|
|
21
|
+
this.onHideNavigationButtonClick = () => {
|
|
22
|
+
this.hideSidebar();
|
|
23
|
+
};
|
|
22
24
|
this.onClick = (event) => {
|
|
25
|
+
var _a;
|
|
23
26
|
const target = event.target;
|
|
24
27
|
const clickOnToggle = Boolean(target.closest(".console-layout__mobile-navigation-button"));
|
|
28
|
+
const clickOnOverlay = ((_a = target.closest("[slot]")) === null || _a === void 0 ? void 0 : _a.slot) === "overlays";
|
|
25
29
|
const clickInsideSidebar = event.composedPath().includes(this.sidebarEl);
|
|
26
|
-
if (!clickInsideSidebar &&
|
|
27
|
-
|
|
30
|
+
if (!clickInsideSidebar &&
|
|
31
|
+
!clickOnToggle &&
|
|
32
|
+
!clickOnOverlay &&
|
|
33
|
+
this.sidebarActive) {
|
|
34
|
+
this.deactivateSidebar();
|
|
28
35
|
}
|
|
29
36
|
};
|
|
30
37
|
this.onKeyDown = (event) => {
|
|
@@ -34,13 +41,6 @@ export class FlipConsoleLayout {
|
|
|
34
41
|
};
|
|
35
42
|
}
|
|
36
43
|
componentDidLoad() {
|
|
37
|
-
const sidebarContents = [
|
|
38
|
-
this.sidebarEl,
|
|
39
|
-
...Array.from(this.el.querySelectorAll('[slot="navigation"], [slot="user"]')).filter((el) => Boolean(el)),
|
|
40
|
-
];
|
|
41
|
-
this.focusTrap = createFocusTrap(sidebarContents, {
|
|
42
|
-
clickOutsideDeactivates: true,
|
|
43
|
-
});
|
|
44
44
|
queueMicrotask(() => {
|
|
45
45
|
if (!isMobileViewport()) {
|
|
46
46
|
this.activateSidebar();
|
|
@@ -70,21 +70,35 @@ export class FlipConsoleLayout {
|
|
|
70
70
|
this.activateSidebar();
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Show the mobile navigation.
|
|
75
|
+
*/
|
|
76
|
+
async showSidebar() {
|
|
77
|
+
if (!this.sidebarActive) {
|
|
78
|
+
this.activateSidebar();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Hide the mobile navigation.
|
|
83
|
+
*/
|
|
84
|
+
async hideSidebar() {
|
|
85
|
+
if (this.sidebarActive) {
|
|
86
|
+
this.deactivateSidebar();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
73
89
|
activateSidebar() {
|
|
74
90
|
var _a;
|
|
75
91
|
this.sidebarActive = true;
|
|
76
92
|
this.sidebarEl.removeAttribute("inert");
|
|
77
93
|
if (isMobileViewport()) {
|
|
78
|
-
(_a = this.
|
|
94
|
+
(_a = this.el.querySelector("flip-tree-navigation-item")) === null || _a === void 0 ? void 0 : _a.focus();
|
|
79
95
|
}
|
|
80
96
|
}
|
|
81
97
|
deactivateSidebar() {
|
|
82
|
-
var _a;
|
|
83
98
|
this.sidebarActive = false;
|
|
84
99
|
if (isMobileViewport()) {
|
|
85
100
|
this.sidebarEl.setAttribute("inert", "");
|
|
86
101
|
}
|
|
87
|
-
(_a = this.focusTrap) === null || _a === void 0 ? void 0 : _a.deactivate({ returnFocus: true });
|
|
88
102
|
}
|
|
89
103
|
render() {
|
|
90
104
|
const className = classnames("console-layout", {
|
|
@@ -104,7 +118,7 @@ export class FlipConsoleLayout {
|
|
|
104
118
|
h("nav", { "aria-label": this.navigationLabel, class: "console-layout__navigation" },
|
|
105
119
|
h("slot", { name: "navigation" }),
|
|
106
120
|
this.sidebarActive && (h("flip-visually-hidden", null,
|
|
107
|
-
h("button", { class: "console-layout__hide-navigation-button", onClick: this.
|
|
121
|
+
h("button", { class: "console-layout__hide-navigation-button", onClick: this.onHideNavigationButtonClick, type: "button" }, this.hideNavigationButtonLabel)))),
|
|
108
122
|
h("div", { class: "console-layout__user" },
|
|
109
123
|
h("slot", { name: "user" }))),
|
|
110
124
|
h("main", { "aria-labelledby": "app-name", class: "console-layout__main" },
|
|
@@ -123,7 +137,9 @@ export class FlipConsoleLayout {
|
|
|
123
137
|
h("flip-heading", { as: "h2", class: "console-layout__heading", headingId: "heading", level: 1, text: this.heading }),
|
|
124
138
|
this.subheading && (h("flip-text", { class: "console-layout__subheading", color: "subdued" }, this.subheading)))),
|
|
125
139
|
h("div", { class: "console-layout__integration" },
|
|
126
|
-
h("slot", { name: "content" })))
|
|
140
|
+
h("slot", { name: "content" }))),
|
|
141
|
+
h("div", { class: "console-layout__overlays" },
|
|
142
|
+
h("slot", { name: "overlays" }))))));
|
|
127
143
|
}
|
|
128
144
|
static get is() { return "flip-console-layout"; }
|
|
129
145
|
static get encapsulation() { return "shadow"; }
|
|
@@ -386,6 +402,38 @@ export class FlipConsoleLayout {
|
|
|
386
402
|
"text": "Toggle the mobile navigation visibility.",
|
|
387
403
|
"tags": []
|
|
388
404
|
}
|
|
405
|
+
},
|
|
406
|
+
"showSidebar": {
|
|
407
|
+
"complexType": {
|
|
408
|
+
"signature": "() => Promise<void>",
|
|
409
|
+
"parameters": [],
|
|
410
|
+
"references": {
|
|
411
|
+
"Promise": {
|
|
412
|
+
"location": "global"
|
|
413
|
+
}
|
|
414
|
+
},
|
|
415
|
+
"return": "Promise<void>"
|
|
416
|
+
},
|
|
417
|
+
"docs": {
|
|
418
|
+
"text": "Show the mobile navigation.",
|
|
419
|
+
"tags": []
|
|
420
|
+
}
|
|
421
|
+
},
|
|
422
|
+
"hideSidebar": {
|
|
423
|
+
"complexType": {
|
|
424
|
+
"signature": "() => Promise<void>",
|
|
425
|
+
"parameters": [],
|
|
426
|
+
"references": {
|
|
427
|
+
"Promise": {
|
|
428
|
+
"location": "global"
|
|
429
|
+
}
|
|
430
|
+
},
|
|
431
|
+
"return": "Promise<void>"
|
|
432
|
+
},
|
|
433
|
+
"docs": {
|
|
434
|
+
"text": "Hide the mobile navigation.",
|
|
435
|
+
"tags": []
|
|
436
|
+
}
|
|
389
437
|
}
|
|
390
438
|
}; }
|
|
391
439
|
static get elementRef() { return "el"; }
|