@gemeentenijmegen/web-components 0.0.2-alpha.0 → 0.0.2-alpha.1
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/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.0.2-alpha.
|
|
2
|
+
"version": "0.0.2-alpha.1",
|
|
3
3
|
"author": "gemeente Nijmegen",
|
|
4
4
|
"description": "Web components for the gemeente Nijmegen design system",
|
|
5
5
|
"license": "EUPL-1.2",
|
|
@@ -20,8 +20,17 @@
|
|
|
20
20
|
"type": "git+ssh",
|
|
21
21
|
"url": "git@github.com:GemeenteNijmegen/design-system.git"
|
|
22
22
|
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "rollup -c ./rollup.config.mjs",
|
|
25
|
+
"clean": "rimraf dist"
|
|
26
|
+
},
|
|
23
27
|
"devDependencies": {
|
|
24
|
-
"@gemeentenijmegen/components-css": "0.0.1-alpha.
|
|
28
|
+
"@gemeentenijmegen/components-css": "0.0.1-alpha.24",
|
|
29
|
+
"postcss-discard-duplicates": "7.0.1",
|
|
30
|
+
"rollup": "4.12.1",
|
|
31
|
+
"rollup-plugin-html": "0.2.1",
|
|
32
|
+
"rollup-plugin-node-resolve": "5.2.0",
|
|
33
|
+
"rollup-plugin-postcss": "4.0.2"
|
|
25
34
|
},
|
|
26
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "0e6315bddfbc266bd3fe9ed6215ec3f767204f87"
|
|
27
36
|
}
|
package/src/header/header.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import style from '@gemeentenijmegen/components-css/
|
|
2
|
-
import html from './template.html
|
|
1
|
+
import style from '@gemeentenijmegen/components-css/menu.scss';
|
|
2
|
+
import html from './template.html';
|
|
3
3
|
|
|
4
4
|
class NijmegenHeader extends HTMLElement {
|
|
5
5
|
constructor() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import style from '@gemeentenijmegen/components-css/
|
|
2
|
-
import html from './template.html
|
|
1
|
+
import style from '@gemeentenijmegen/components-css/mobile-menu/index.scss';
|
|
2
|
+
import html from './template.html';
|
|
3
3
|
|
|
4
4
|
class NijmegenMobileMenu extends HTMLElement {
|
|
5
5
|
constructor() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import style from '@gemeentenijmegen/components-css/
|
|
2
|
-
import html from './template.html
|
|
1
|
+
import style from '@gemeentenijmegen/components-css/toolbar-button/index.scss';
|
|
2
|
+
import html from './template.html';
|
|
3
3
|
|
|
4
4
|
class NijmegenToolbarButton extends HTMLElement {
|
|
5
5
|
constructor() {
|
|
@@ -16,7 +16,7 @@ class NijmegenToolbarButton extends HTMLElement {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
static get observedAttributes() {
|
|
19
|
-
return ['type'];
|
|
19
|
+
return ['type', 'aria-controls'];
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
connectedCallback() {
|
|
@@ -28,12 +28,28 @@ class NijmegenToolbarButton extends HTMLElement {
|
|
|
28
28
|
target = event.target.parentElement;
|
|
29
29
|
}
|
|
30
30
|
target.ariaExpanded = target.ariaExpanded === 'true' ? 'false' : 'true';
|
|
31
|
+
|
|
32
|
+
// control mobile menu visibility
|
|
33
|
+
if (target.getAttribute('aria-controls')) {
|
|
34
|
+
const elementId = target.getAttribute('aria-controls');
|
|
35
|
+
if (elementId === 'mobile-menu') {
|
|
36
|
+
const mobileMenu = document.getElementById(elementId);
|
|
37
|
+
const visibleClass = 'nijmegen-header__mobile-menu--visible';
|
|
38
|
+
const isExpanded = target.getAttribute('aria-expanded') === 'true';
|
|
39
|
+
|
|
40
|
+
// Toggle menu visibility
|
|
41
|
+
mobileMenu.classList.toggle(visibleClass, isExpanded);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
31
44
|
});
|
|
32
45
|
}
|
|
33
46
|
}
|
|
34
47
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
35
48
|
if (name === 'type') {
|
|
36
49
|
this.#handleType(newValue);
|
|
50
|
+
} else if (name === 'aria-controls') {
|
|
51
|
+
const button = this.shadowRoot.querySelector('.nijmegen-toolbar-button');
|
|
52
|
+
button.setAttribute('aria-controls', newValue);
|
|
37
53
|
}
|
|
38
54
|
}
|
|
39
55
|
#handleType(type) {
|