@dataforsyningen/designsystem
Advanced tools
Comparing version 4.4.0 to 4.5.0
@@ -1050,7 +1050,15 @@ // src/js/codeview.js | ||
// src/js/toast.js | ||
function showToast({ message, target = "body", duration = 5e3 }) { | ||
function showToast({ message, duration = 5e3 }) { | ||
const newToast = document.createElement("div"); | ||
newToast.className = "ds-toast-item"; | ||
newToast.innerText = message; | ||
document.querySelector(target).append(newToast); | ||
const targetElement = document.querySelector(".ds-toast-container"); | ||
if (!targetElement) { | ||
const toastcontainer = document.createElement("div"); | ||
toastcontainer.className = "ds-toast-container"; | ||
document.body.append(toastcontainer); | ||
toastcontainer.append(newToast); | ||
} else { | ||
targetElement.append(newToast); | ||
} | ||
setTimeout(function() { | ||
@@ -1057,0 +1065,0 @@ newToast.remove(); |
{ | ||
"name": "@dataforsyningen/designsystem", | ||
"version": "4.4.0", | ||
"version": "4.5.0", | ||
"description": "Common design system for SDFI with CSS, icons, UI components, and logo images.", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -1,7 +0,16 @@ | ||
export function showToast({message, target = 'body', duration = 5000}) { | ||
export function showToast({message, duration = 5000}) { | ||
const newToast = document.createElement('div') | ||
newToast.className = 'ds-toast-item' | ||
newToast.innerText = message | ||
document.querySelector(target).append(newToast) | ||
const targetElement = document.querySelector('.ds-toast-container') | ||
if (!targetElement) { | ||
const toastcontainer = document.createElement('div') | ||
toastcontainer.className = 'ds-toast-container' | ||
document.body.append(toastcontainer) | ||
toastcontainer.append(newToast) | ||
} else { | ||
targetElement.append(newToast) | ||
} | ||
setTimeout(function() { | ||
@@ -8,0 +17,0 @@ newToast.remove() |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
655422
2521