@t007/toast 0.0.34 → 0.0.36

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.
@@ -220,8 +220,8 @@
220
220
  this._setUpBodyHTML();
221
221
  this.toastElement.querySelector(".t007-toast-body").insertAdjacentElement("afterend", actionsWrapper() || createEl("div", { className: "t007-toast-actions-wrapper" }));
222
222
  const wrapper = actionsWrapper();
223
- wrapper.innerHTML = values.map(([label]) => label ? `<button class="t007-toast-action-button" data-action="${label}">${label}</button>` : "").join("");
224
- wrapper.querySelectorAll(".t007-toast-action-button").forEach((btn, i) => btn.onclick = (e) => values[i][1]?.(e, this));
223
+ wrapper.innerHTML = values.map(([label]) => label ? `<button class="t007-toast-action-button">${label}</button>` : "").join("");
224
+ wrapper.querySelectorAll(".t007-toast-action-button").forEach((btn, i) => (btn.onclick = (e) => values[i][1]?.(e, this), btn.dataset.action = btn.textContent.trim()));
225
225
  } else actionsWrapper()?.remove();
226
226
  }
227
227
  set image(value) {
package/dist/index.js CHANGED
@@ -73,8 +73,8 @@ var T007_Toast = class {
73
73
  this._setUpBodyHTML();
74
74
  this.toastElement.querySelector(".t007-toast-body").insertAdjacentElement("afterend", actionsWrapper() || createEl("div", { className: "t007-toast-actions-wrapper" }));
75
75
  const wrapper = actionsWrapper();
76
- wrapper.innerHTML = values.map(([label]) => label ? `<button class="t007-toast-action-button" data-action="${label}">${label}</button>` : "").join("");
77
- wrapper.querySelectorAll(".t007-toast-action-button").forEach((btn, i) => btn.onclick = (e) => values[i][1]?.(e, this));
76
+ wrapper.innerHTML = values.map(([label]) => label ? `<button class="t007-toast-action-button">${label}</button>` : "").join("");
77
+ wrapper.querySelectorAll(".t007-toast-action-button").forEach((btn, i) => (btn.onclick = (e) => values[i][1]?.(e, this), btn.dataset.action = btn.textContent.trim()));
78
78
  } else actionsWrapper()?.remove();
79
79
  }
80
80
  set image(value) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@t007/toast",
3
- "version": "0.0.34",
3
+ "version": "0.0.36",
4
4
  "description": "A lightweight, pure JS toast system.",
5
5
  "author": "Oketade Oluwatobiloba <tobioketade007@gmail.com>",
6
6
  "license": "MIT",
@@ -55,7 +55,7 @@
55
55
  "promise"
56
56
  ],
57
57
  "dependencies": {
58
- "@t007/utils": "^0.0.36"
58
+ "@t007/utils": "^0.0.37"
59
59
  },
60
60
  "devDependencies": {
61
61
  "esbuild-sass-plugin": "^3.7.0"