@primer/view-components 0.0.70 → 0.0.71
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.
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
+
};
|
|
6
|
+
var _NavigationListElement_instances, _NavigationListElement_handleClick;
|
|
7
|
+
class NavigationListElement extends HTMLElement {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
_NavigationListElement_instances.add(this);
|
|
11
|
+
}
|
|
12
|
+
connectedCallback() {
|
|
13
|
+
this.addEventListener('click', this);
|
|
14
|
+
}
|
|
15
|
+
handleEvent(event) {
|
|
16
|
+
var _a;
|
|
17
|
+
if (!(event.target instanceof HTMLElement))
|
|
18
|
+
return;
|
|
19
|
+
const item = (_a = event.target) === null || _a === void 0 ? void 0 : _a.closest('button');
|
|
20
|
+
if ((item === null || item === void 0 ? void 0 : item.closest(this.tagName)) !== this)
|
|
21
|
+
return;
|
|
22
|
+
if (event.type === 'click') {
|
|
23
|
+
__classPrivateFieldGet(this, _NavigationListElement_instances, "m", _NavigationListElement_handleClick).call(this, item, event);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
_NavigationListElement_instances = new WeakSet(), _NavigationListElement_handleClick = function _NavigationListElement_handleClick(item, e) {
|
|
28
|
+
if (item.getAttribute('aria-expanded') !== null) {
|
|
29
|
+
if (item.getAttribute('aria-expanded') === 'true') {
|
|
30
|
+
item.setAttribute('aria-expanded', 'false');
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
item.setAttribute('aria-expanded', 'true');
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
e.stopPropagation();
|
|
37
|
+
};
|
|
38
|
+
if (!window.customElements.get('navigation-list')) {
|
|
39
|
+
window.NavigationListElement = NavigationListElement;
|
|
40
|
+
window.customElements.define('navigation-list', NavigationListElement);
|
|
41
|
+
}
|
|
42
|
+
export {};
|
package/package.json
CHANGED