@zonos/amino 5.5.37 → 5.5.38
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var t=require("../../_rollupPluginBabelHelpers-697f213c.js"),e=require("../../tslib.es6-8c21e256.js"),o=require("react"),n=require("clsx"),s=require("framer-motion"),i=require("uuid"),r=require("../button/Button.js"),a=require("../flex/Flex.js"),u=require("./Toast.js"),l=require("../../icons/RemoveIcon.js"),d=require("../../style-inject.es-d4ddeae4.js"),
|
|
1
|
+
"use strict";var t=require("../../_rollupPluginBabelHelpers-697f213c.js"),e=require("../../tslib.es6-8c21e256.js"),o=require("react"),n=require("clsx"),s=require("framer-motion"),i=require("uuid"),r=require("../button/Button.js"),a=require("../flex/Flex.js"),u=require("./Toast.js"),l=require("../../icons/RemoveIcon.js"),d=require("../../style-inject.es-d4ddeae4.js"),m=require("react/jsx-runtime");function _(t){return t&&t.__esModule?t:{default:t}}require("../button/RippleGroup.js"),require("../button/_Ripple.js"),require("../../utils/getAminoColor.js"),require("../../styles/constants/theme.js"),require("../button/useRipple.js"),require("../spinner/Spinner.js"),require("../../utils/getTestId.js"),require("../../icons/CheckCircleIcon.js"),require("../../icons/icon-base/_IconBase.js"),require("../../icons/InfoIcon.js"),require("../../icons/RemoveCircleIcon.js"),require("../../icons/WarningIcon.js");var c=_(n),p="Amino_ToastContext-module__toastContainer--v8ymm",x="Amino_ToastContext-module__toastsWrapper--W5SKw",f="Amino_ToastContext-module__toastWrapperAdjust--j5R-v",T="Amino_ToastContext-module__persistentToastsWrapper--5dhd9",h="Amino_ToastContext-module__clearAllButton--r43o-",C="Amino_ToastContext-module__expanded--mPeFN",A="Amino_ToastContext-module__persistentToast--yMpFG";d.styleInject(".Amino_ToastContext-module__toastContainer--v8ymm{bottom:var(--amino-toast-context-bottom);display:flex;flex-direction:column;justify-content:flex-end;left:var(--amino-toast-context-left);pointer-events:none;position:fixed;width:100%;z-index:9999999}.Amino_ToastContext-module__toastsWrapper--W5SKw{align-items:center;display:flex;flex-direction:column;gap:16px;pointer-events:auto}.Amino_ToastContext-module__toastWrapperAdjust--j5R-v{margin-bottom:16px}.Amino_ToastContext-module__persistentToastsWrapper--5dhd9{margin:0 auto;max-height:60vh;max-width:600px;min-height:var(--amino-toast-persistent-height);position:relative;width:100%;z-index:1000}.Amino_ToastContext-module__persistentToastsWrapper--5dhd9:hover{cursor:pointer}.Amino_ToastContext-module__persistentToastsWrapper--5dhd9 .Amino_ToastContext-module__clearAllButton--r43o-{-webkit-backdrop-filter:blur(5px);backdrop-filter:blur(5px);background-color:#0000000f;border-radius:var(--amino-radius-4);margin-left:auto}.Amino_ToastContext-module__persistentToastsWrapper--5dhd9.Amino_ToastContext-module__expanded--mPeFN{position:relative;width:100%}.Amino_ToastContext-module__persistentToastsWrapper--5dhd9.Amino_ToastContext-module__expanded--mPeFN .Amino_ToastContext-module__clearAllButton--r43o-{margin-bottom:-8px}.Amino_ToastContext-module__persistentToastsWrapper--5dhd9 .Amino_ToastContext-module__persistentToast--yMpFG{width:100%;z-index:8}.Amino_ToastContext-module__persistentToastsWrapper--5dhd9 .Amino_ToastContext-module__persistentToast--yMpFG:first-of-type{z-index:10}.Amino_ToastContext-module__persistentToastsWrapper--5dhd9 .Amino_ToastContext-module__persistentToast--yMpFG:nth-of-type(2){z-index:9}.Amino_ToastContext-module__persistentToastsWrapper--5dhd9:not(.Amino_ToastContext-module__expanded--mPeFN) .Amino_ToastContext-module__persistentToast--yMpFG{filter:brightness(2);opacity:0;position:absolute;scale:.5;transform-origin:bottom center;transition:all .3s cubic-bezier(.4,0,.2,1)}.Amino_ToastContext-module__persistentToastsWrapper--5dhd9:not(.Amino_ToastContext-module__expanded--mPeFN) .Amino_ToastContext-module__persistentToast--yMpFG:first-of-type{bottom:0;filter:brightness(1);opacity:1;scale:1}.Amino_ToastContext-module__persistentToastsWrapper--5dhd9:not(.Amino_ToastContext-module__expanded--mPeFN) .Amino_ToastContext-module__persistentToast--yMpFG:nth-of-type(2){bottom:-8px;filter:brightness(1.5);opacity:1;scale:.9}.Amino_ToastContext-module__persistentToastsWrapper--5dhd9:not(.Amino_ToastContext-module__expanded--mPeFN) .Amino_ToastContext-module__persistentToast--yMpFG:nth-of-type(3){bottom:-16px;filter:brightness(2);opacity:.8;scale:.8}");var v=o.createContext({dismissAllToasts:function(){},dismissToast:function(t){},notify:function(t,e){}});exports.ToastContext=v,exports.ToastContextProvider=function(n){var d=n.children,_=e.__read(o.useState([]),2),b=_[0],j=_[1],y=e.__read(o.useState([]),2),g=y[0],q=y[1],W=e.__read(o.useState(!1),2),F=W[0],P=W[1],k=e.__read(o.useState({bottom:"",left:""}),2),N=k[0],I=k[1],S=o.useCallback((function(t,o){var n={isPersistent:null==o?void 0:o.isPersistent,props:o,toast:t,uuid:(null==o?void 0:o.id)||i.v4()};(null==o?void 0:o.isPersistent)?q((function(t){return t.some((function(t){return t.uuid===n.uuid}))?t:e.__spreadArray([n],e.__read(t),!1)})):(j((function(t){return t.some((function(t){return t.uuid===n.uuid}))?t:e.__spreadArray(e.__spreadArray([],e.__read(t),!1),[n],!1)})),setTimeout((function(){return j((function(t){return t.slice(1)}))}),(null==o?void 0:o.duration)||6e3))}),[j,q]),M=o.useCallback((function(t,e,o){o&&I({bottom:o.bottom||"",left:o.left||""}),S(t,e)}),[S]),w=o.useCallback((function(t){j((function(e){return e.filter((function(e){return e.uuid!==t}))})),q((function(e){return e.filter((function(e){return e.uuid!==t}))}))}),[q]),G=o.useCallback((function(){q([]),j([]),P(!1)}),[q,j,P]),R=function(t){var e=t.currentTarget.querySelector(".toast-actions");e&&!e.contains(t.target)&&P((function(t){return!t}))},B=o.useRef(null),z=e.__read(o.useState(0),2),K=z[0],D=z[1],E=g.find(Boolean);o.useEffect((function(){B.current&&D(B.current.offsetHeight)}),[E]);var H=o.useMemo((function(){return{dismissAllToasts:G,dismissToast:w,notify:M}}),[G,w,M]),J=g.length>0;return m.jsxs(v.Provider,{value:H,children:[d,m.jsxs("div",{className:p,style:{"--amino-toast-context-bottom":N.bottom||"40px","--amino-toast-context-left":N.left||"auto","--amino-toast-persistent-height":J&&!F?"".concat(K+40,"px"):"unset"},children:[m.jsx("div",{className:c.default(x,J&&f),children:m.jsx(s.AnimatePresence,{children:b.map((function(t){var e=t.props,o=t.toast,n=t.uuid,s="toast-".concat(o,"-").concat(n);return m.jsx(a.Flex,{children:m.jsx(u.Toast,{direction:null==e?void 0:e.direction,intent:null==e?void 0:e.intent,toastKey:s,children:o})},s)}))})}),m.jsxs("div",{className:c.default(x,T,F&&C),children:[!!g.length&&m.jsx(r.Button,{className:h,icon:m.jsx(l.RemoveIcon,{}),onClick:G,variant:"text",children:"Clear all"}),m.jsx(s.AnimatePresence,{children:g.map((function(e,o){var n=e.props,s=e.toast,i=e.uuid,r="persistent-toast-".concat(s,"-").concat(i),l=0===o||F;return m.jsx("div",{ref:0===o?B:null,className:A,onClick:R,onKeyDown:function(t){"Enter"!==t.key&&" "!==t.key||R(t)},role:"button",tabIndex:0,children:m.jsx(a.Flex,{fullWidth:!0,children:m.jsx(u.Toast,t._objectSpread2(t._objectSpread2({},n),{},{actions:l?null==n?void 0:n.actions:void 0,isPersistent:!0,onDismiss:function(t){var e;null===(e=null==n?void 0:n.onDismiss)||void 0===e||e.call(n,t),function(t,e){t.stopPropagation(),w(e)}(t,i)},toastKey:r,children:l?s:""}))})},r)}))})]})]})]})};
|