toast-lia
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -1,26 +0,5 @@ | ||
import React, { useEffect, useState } from 'react'; | ||
import React, { useState, useEffect } from 'react'; | ||
import styled from 'styled-components'; | ||
import { createPortal } from 'react-dom'; | ||
import styled from 'styled-components'; | ||
var Portal$1 = function Portal(_ref) { | ||
var children = _ref.children; | ||
var mount = document.createElement("div"); | ||
document.body.appendChild(mount); | ||
mount.setAttribute("id", "toast-root"); | ||
var el = document.createElement("div"); | ||
el.setAttribute("id", "notification-wrapper"); | ||
useEffect(function () { | ||
mount.appendChild(el); | ||
return function () { | ||
mount.removeChild(el); | ||
document.getElementById("toast-root").remove(); | ||
}; | ||
}, [el, mount]); | ||
return /*#__PURE__*/createPortal(children, el); | ||
}; | ||
var ToastContainer = function ToastContainer(props) { | ||
return /*#__PURE__*/React.createElement(Portal$1, null, props.children); | ||
}; | ||
function _classCallCheck(instance, Constructor) { | ||
@@ -274,3 +253,3 @@ if (!(instance instanceof Constructor)) { | ||
Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119; | ||
function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}var AsyncMode=l;var ConcurrentMode=m;var ContextConsumer=k;var ContextProvider=h;var Element=c;var ForwardRef=n;var Fragment=e;var Lazy=t;var Memo=r;var Portal=d; | ||
function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}var AsyncMode=l;var ConcurrentMode=m;var ContextConsumer=k;var ContextProvider=h;var Element=c;var ForwardRef=n;var Fragment=e;var Lazy=t;var Memo=r;var Portal$1=d; | ||
var Profiler=g;var StrictMode=f;var Suspense=p;var isAsyncMode=function(a){return A(a)||z(a)===l};var isConcurrentMode=A;var isContextConsumer=function(a){return z(a)===k};var isContextProvider=function(a){return z(a)===h};var isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};var isForwardRef=function(a){return z(a)===n};var isFragment=function(a){return z(a)===e};var isLazy=function(a){return z(a)===t}; | ||
@@ -290,3 +269,3 @@ var isMemo=function(a){return z(a)===r};var isPortal=function(a){return z(a)===d};var isProfiler=function(a){return z(a)===g};var isStrictMode=function(a){return z(a)===f};var isSuspense=function(a){return z(a)===p}; | ||
Memo: Memo, | ||
Portal: Portal, | ||
Portal: Portal$1, | ||
Profiler: Profiler, | ||
@@ -1510,2 +1489,23 @@ StrictMode: StrictMode, | ||
var Portal = function Portal(_ref) { | ||
var children = _ref.children; | ||
var mount = document.createElement("div"); | ||
document.body.appendChild(mount); | ||
mount.setAttribute("id", "toast-root"); | ||
var el = document.createElement("div"); | ||
el.setAttribute("id", "notification-wrapper"); | ||
useEffect(function () { | ||
mount.appendChild(el); | ||
return function () { | ||
mount.removeChild(el); | ||
document.getElementById("toast-root").remove(); | ||
}; | ||
}, [el, mount]); | ||
return /*#__PURE__*/createPortal(children, el); | ||
}; | ||
var ToastContainer = function ToastContainer(props) { | ||
return /*#__PURE__*/React.createElement(Portal, null, props.children); | ||
}; | ||
var errorIcon = "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2264%22%20height%3D%2264%22%20viewBox%3D%220%200%2064%2064%22%3E%3Cdefs%3E%3Cstyle%3E.a%7Bfill%3A%23fff%3B%7D%3C%2Fstyle%3E%3C%2Fdefs%3E%3Cg%20transform%3D%22translate%280.198%200.198%29%22%3E%3Cpath%20class%3D%22a%22%20d%3D%22M63.8%2C59.986%2C52.321%2C48.5a29.7%2C29.7%2C0%2C1%2C0-3.816%2C3.816L59.988%2C63.8ZM5.262%2C29.533A24.271%2C24.271%2C0%2C1%2C1%2C29.533%2C53.8%2C24.271%2C24.271%2C0%2C0%2C1%2C5.262%2C29.533Z%22%20transform%3D%22translate%280%200%29%22%2F%3E%3Cpath%20class%3D%22a%22%20d%3D%22M67.251%2C55.566a2.734%2C2.734%2C0%2C0%2C0-2.445-1.511h-.784a18.942%2C18.942%2C0%2C0%2C0%2C.59-2.734h5.661V45.853H64.612a18.941%2C18.941%2C0%2C0%2C0-.59-2.734h.784a2.734%2C2.734%2C0%2C0%2C0%2C2.445-1.511l2.734-5.468L65.094%2C33.7l-1.978%2C3.956h-1.8a14.916%2C14.916%2C0%2C0%2C0-2.49-2.619%2C8.2%2C8.2%2C0%2C1%2C0-15.375%2C0%2C14.924%2C14.924%2C0%2C0%2C0-2.489%2C2.619h-1.8L37.179%2C33.7l-4.89%2C2.445%2C2.734%2C5.468a2.734%2C2.734%2C0%2C0%2C0%2C2.445%2C1.511h.784a18.942%2C18.942%2C0%2C0%2C0-.59%2C2.734H32v5.468h5.661a18.942%2C18.942%2C0%2C0%2C0%2C.59%2C2.734h-.784a2.734%2C2.734%2C0%2C0%2C0-2.445%2C1.511l-2.734%2C5.468%2C4.89%2C2.445%2C1.978-3.956h1.8A12.778%2C12.778%2C0%2C0%2C0%2C51.137%2C64.99a12.778%2C12.778%2C0%2C0%2C0%2C10.177-5.468h1.8l1.978%2C3.956%2C4.89-2.445ZM48.4%2C32.184a2.734%2C2.734%2C0%2C0%2C1%2C5.468%2C0%2C2.768%2C2.768%2C0%2C0%2C1-.025.325%2C11.461%2C11.461%2C0%2C0%2C0-5.417%2C0A2.766%2C2.766%2C0%2C0%2C1%2C48.4%2C32.184Zm2.734%2C27.338c-4.522%2C0-8.2-4.905-8.2-10.935s3.679-10.935%2C8.2-10.935%2C8.2%2C4.905%2C8.2%2C10.935S55.659%2C59.522%2C51.137%2C59.522Z%22%20transform%3D%22translate%28-21.558%20-15.912%29%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E"; | ||
@@ -1525,2 +1525,3 @@ | ||
var YELOW = "#F4E048"; | ||
var GREY = "#f2f2f2"; | ||
@@ -1614,3 +1615,3 @@ var SUCCESS = "success"; | ||
default: | ||
return GREEN; | ||
return GREY; | ||
} | ||
@@ -1670,2 +1671,2 @@ } | ||
export { ToastContainer, toast }; | ||
export { toast }; |
{ | ||
"name": "toast-lia", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/bundles/bundle.js", |
@@ -1,6 +0,6 @@ | ||
import React from "react" | ||
import { Portal } from "../Portal/Portal" | ||
import React from "react"; | ||
import { Portal } from "../Portal/Portal"; | ||
export const ToastContainer = props => { | ||
return <Portal>{props.children}</Portal> | ||
} | ||
export const ToastContainer = (props) => { | ||
return <Portal>{props.children}</Portal>; | ||
}; |
@@ -87,3 +87,3 @@ import React from "react"; | ||
default: | ||
return GREEN; | ||
return GREY; | ||
break; | ||
@@ -90,0 +90,0 @@ } |
@@ -1,3 +0,1 @@ | ||
export { ToastContainer } from "./components/Toast/ToastContainer"; | ||
export { toast } from "./container/ToastCore"; |
84911
26