@ewc-lib/ewc-popovers 2.0.0-beta → 2.0.3-beta
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/ewc-popover/src/element.js +1 -1
- package/ewc-popover/src/markup.js +1 -1
- package/ewc-popover/src/popover.js +1 -1
- package/ewc-popover-sharing/readme.md +2 -0
- package/ewc-popover-sharing/src/element.js +21 -25
- package/ewc-popover-sharing/src/markup.js +1 -1
- package/package.json +1 -1
- package/readme.md +11 -0
|
@@ -14,7 +14,7 @@ export default class Element extends HTMLElement {
|
|
|
14
14
|
|
|
15
15
|
connectedCallback(ignoreCheck) {
|
|
16
16
|
if(this.#isInitialized) { return } else { this.#isInitialized=true }
|
|
17
|
-
this.setAttribute("ewc-version", "2.0.
|
|
17
|
+
this.setAttribute("ewc-version", "2.0.3-beta") // please always keep in sync with version in package.json
|
|
18
18
|
if(ignoreCheck || this.childElementCount===2) {
|
|
19
19
|
// please see also comment in html.js
|
|
20
20
|
|
|
@@ -21,7 +21,7 @@ function main() {
|
|
|
21
21
|
return `
|
|
22
22
|
<div class="main_container">
|
|
23
23
|
<slot name="toggle"></slot>
|
|
24
|
-
<div class="ewc-popover__container"
|
|
24
|
+
<div class="ewc-popover__container" role="dialog">
|
|
25
25
|
<div part="contentContainer" class="ewc-popover__scrollable">
|
|
26
26
|
<slot class="ewc-popover__content" name="content"></slot>
|
|
27
27
|
</div>
|
|
@@ -26,6 +26,8 @@ Note: can be modified at runtime.
|
|
|
26
26
|
This implements creating URLs and opening websites, email client or invoking an ewc-dialog (for embed).
|
|
27
27
|
It's usage is **optional**.
|
|
28
28
|
|
|
29
|
+
TODO: better description
|
|
30
|
+
|
|
29
31
|
# Details
|
|
30
32
|
|
|
31
33
|
The ewc-popover-sharing derives from ewc-popover.
|
|
@@ -16,11 +16,8 @@ export default class Element extends Popover {
|
|
|
16
16
|
} else {
|
|
17
17
|
this.#isInitialized = true;
|
|
18
18
|
}
|
|
19
|
+
super.connectedCallback(true);
|
|
19
20
|
if (this.childElementCount === 1) {
|
|
20
|
-
super.connectedCallback(true);
|
|
21
|
-
|
|
22
|
-
this.setAttribute("ewc-version", "2.0.0-beta") // please always keep in sync with version in package.json
|
|
23
|
-
|
|
24
21
|
this.shadowRoot.appendChild( CSS().cloneNode(true) )
|
|
25
22
|
this.shadowRoot.appendChild( MARKUP.getSvg() )
|
|
26
23
|
|
|
@@ -32,7 +29,7 @@ export default class Element extends Popover {
|
|
|
32
29
|
this.#enableFocusWrap();
|
|
33
30
|
this.#enableFocusFirstMenuItem()
|
|
34
31
|
} else {
|
|
35
|
-
console.error("popover-sharing: Must have exactly 1 child
|
|
32
|
+
console.error("popover-sharing: Must have exactly 1 child (some clickable element) to toggle visibility of the popover.");
|
|
36
33
|
}
|
|
37
34
|
}
|
|
38
35
|
|
|
@@ -70,26 +67,25 @@ export default class Element extends Popover {
|
|
|
70
67
|
this.shadowRoot.querySelector(".ewc-popover__container").addEventListener(
|
|
71
68
|
"keydown",
|
|
72
69
|
(e) => {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
(
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
70
|
+
if(e.key==="ArrowDown" || (e.key==="Tab" && !e.shiftKey)) {
|
|
71
|
+
handle(
|
|
72
|
+
(e) => e.nextElementSibling,
|
|
73
|
+
(e) => e.parentNode.firstElementChild,
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
if(e.key==="ArrowUp" || (e.key==="Tab" && e.shiftKey)) {
|
|
77
|
+
handle(
|
|
78
|
+
(e) => e.previousElementSibling,
|
|
79
|
+
(e) => e.parentNode.lastElementChild,
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
function handle(directionNext, wrapTo) {
|
|
83
|
+
e.preventDefault();
|
|
84
|
+
const el = directionNext(e.target.closest("li"));
|
|
85
|
+
if (el) {
|
|
86
|
+
el.focus();
|
|
87
|
+
} else {
|
|
88
|
+
wrapTo(e.target.closest("li")).focus();
|
|
93
89
|
}
|
|
94
90
|
}
|
|
95
91
|
},
|
|
@@ -24,7 +24,7 @@ export function html(enabledItems) {
|
|
|
24
24
|
|
|
25
25
|
function getMenuItemHtml(included, classId, label) {
|
|
26
26
|
return included?`<li class="ewc-popover-sharing__item ${classId}" tabindex="0">
|
|
27
|
-
<a class="ewc-link ewc-link--standalone ewc-popover-sharing__link"
|
|
27
|
+
<a class="ewc-link ewc-link--standalone ewc-popover-sharing__link" tabindex="-1">
|
|
28
28
|
<svg class="ewc-icon ewc-icon--m ewc-button__icon" focusable="false" aria-hidden="true">
|
|
29
29
|
<use href="#svg-${classId}"></use>
|
|
30
30
|
</svg>
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@ewc-lib/ewc-popovers",
|
|
3
3
|
"description": "Monorepo for EWCL popover WebComponents",
|
|
4
4
|
"//": "please always keep version in sync with version info in the sourcecode",
|
|
5
|
-
"version": "2.0.
|
|
5
|
+
"version": "2.0.3-beta",
|
|
6
6
|
"workspaces": [
|
|
7
7
|
"ewc-popover",
|
|
8
8
|
"ewc-popover-sharing"
|
package/readme.md
CHANGED
|
@@ -99,3 +99,14 @@ Before the 2 popover components were grouped together into this monorepo, they e
|
|
|
99
99
|
|
|
100
100
|
- 2.0.0-beta
|
|
101
101
|
- initial version of monorepo, containing 2 former singlerepos
|
|
102
|
+
|
|
103
|
+
- 2.0.1-beta
|
|
104
|
+
- bugfix: wrong focus after escape-key close
|
|
105
|
+
- a11y markup
|
|
106
|
+
- adapt tests
|
|
107
|
+
|
|
108
|
+
- 2.0.2-beta
|
|
109
|
+
- version info
|
|
110
|
+
|
|
111
|
+
- 2.0.3-beta
|
|
112
|
+
- focus wrap for tab key
|