@total_onion/onion-library 2.0.220 → 2.0.221

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.
@@ -11,17 +11,25 @@ export default function toggletriggerJs(options = {}) {
11
11
  this.toggleButton.className = 'toggle-trigger__button';
12
12
  this.appendChild(this.toggleButton);
13
13
  this.toggleButton.innerText = this.dataset.toggletext;
14
+ this.toggleClass = this.dataset.toggleclass;
14
15
  this.toggleTarget = document.querySelector(
15
16
  this.dataset.toggletarget
16
17
  );
17
- this.toggleClass = this.dataset.toggleclass;
18
+ this.toggleButton.addEventListener('click', () => {
19
+ this.toggleTarget.classList.toggle(
20
+ this.toggleClass
21
+ );
22
+ });
23
+
18
24
  document.body.addEventListener('click', (e) => {
19
25
  if (
20
26
  (this.toggleTarget.classList.contains(
21
27
  this.toggleClass
22
28
  ) &&
23
29
  !this.toggleTarget.contains(e.target)) ||
24
- e.target == this.querySelector('button')
30
+ e.target.classList.contains(
31
+ 'toggle-trigger__button'
32
+ )
25
33
  ) {
26
34
  this.toggleTarget.classList.toggle(
27
35
  this.toggleClass
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@total_onion/onion-library",
3
- "version": "2.0.220",
3
+ "version": "2.0.221",
4
4
  "description": "Component library",
5
5
  "main": "index.js",
6
6
  "scripts": {