@zonos/amino 5.4.34 → 5.4.35

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("../../_tslib-bd4862e8.js"),e=require("react/jsx-runtime"),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");function m(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 _=m(n),c="Amino_ToastContext-module__toastContainer--v8ymm",p="Amino_ToastContext-module__toastsWrapper--W5SKw",x="Amino_ToastContext-module__toastWrapperAdjust--j5R-v",f="Amino_ToastContext-module__persistentToastsWrapper--5dhd9",T="Amino_ToastContext-module__clearAllButton--r43o-",h="Amino_ToastContext-module__expanded--mPeFN",C="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);position:fixed;width:100%;z-index:9999999}.Amino_ToastContext-module__toastsWrapper--W5SKw{align-items:center;display:flex;flex-direction:column;gap:16px}.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 A=o.createContext({dismissAllToasts:function(){},dismissToast:function(t){},notify:function(t,e){}});exports.ToastContext=A,exports.ToastContextProvider=function(n){var d=n.children,m=t.__read(o.useState([]),2),v=m[0],b=m[1],j=t.__read(o.useState([]),2),y=j[0],g=j[1],q=t.__read(o.useState(!1),2),W=q[0],F=q[1],P=t.__read(o.useState({bottom:"",left:""}),2),k=P[0],N=P[1],I=o.useCallback((function(e,o){var n={isPersistent:null==o?void 0:o.isPersistent,props:o,toast:e,uuid:(null==o?void 0:o.id)||i.v4()};(null==o?void 0:o.isPersistent)?g((function(e){return t.__spreadArray([n],t.__read(e),!1)})):(b((function(e){return t.__spreadArray(t.__spreadArray([],t.__read(e),!1),[n],!1)})),setTimeout((function(){return b((function(t){return t.slice(1)}))}),(null==o?void 0:o.duration)||6e3))}),[b,g]),M=o.useCallback((function(t,e,o){o&&N({bottom:o.bottom||"",left:o.left||""}),I(t,e)}),[I]),w=o.useCallback((function(t){b((function(e){return e.filter((function(e){return e.uuid!==t}))})),g((function(e){return e.filter((function(e){return e.uuid!==t}))}))}),[g]),G=o.useCallback((function(){g([]),b([]),F(!1)}),[g,b,F]),R=function(t){var e=t.currentTarget.querySelector(".toast-actions");e&&!e.contains(t.target)&&F((function(t){return!t}))},S=o.useRef(null),B=t.__read(o.useState(0),2),z=B[0],K=B[1],D=y.find(Boolean);o.useEffect((function(){S.current&&K(S.current.offsetHeight)}),[D]);var E=o.useMemo((function(){return{dismissAllToasts:G,dismissToast:w,notify:M}}),[G,w,M]),H=y.length>0;return e.jsxs(A.Provider,{value:E,children:[d,e.jsxs("div",{className:c,style:{"--amino-toast-context-bottom":k.bottom||"40px","--amino-toast-context-left":k.left||"auto","--amino-toast-persistent-height":H&&!W?"".concat(z+40,"px"):"unset"},children:[e.jsx("div",{className:_.default(p,H&&x),children:e.jsx(s.AnimatePresence,{children:v.map((function(t){var o=t.props,n=t.toast,s=t.uuid,i="toast-".concat(n,"-").concat(s);return e.jsx(a.Flex,{children:e.jsx(u.Toast,{direction:null==o?void 0:o.direction,intent:null==o?void 0:o.intent,toastKey:i,children:n})},i)}))})}),e.jsxs("div",{className:_.default(p,f,W&&h),children:[!!y.length&&e.jsx(r.Button,{className:T,icon:e.jsx(l.RemoveIcon,{}),onClick:G,variant:"text",children:"Clear all"}),e.jsx(s.AnimatePresence,{children:y.map((function(o,n){var s=o.props,i=o.toast,r=o.uuid,l="persistent-toast-".concat(i,"-").concat(r);return e.jsx("div",{ref:0===n?S:null,className:C,onClick:R,onKeyDown:function(t){"Enter"!==t.key&&" "!==t.key||R(t)},role:"button",tabIndex:0,children:e.jsx(a.Flex,{fullWidth:!0,children:e.jsx(u.Toast,t.__assign({isPersistent:!0,onDismiss:function(t){var e;null===(e=null==s?void 0:s.onDismiss)||void 0===e||e.call(s,t),function(t,e){t.stopPropagation(),w(e)}(t,r)},toastKey:l},s,{children:0===n||W?i:""}))})},l)}))})]})]})]})};
1
+ "use strict";var t=require("../../_tslib-bd4862e8.js"),e=require("react/jsx-runtime"),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");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 m=_(n),c="Amino_ToastContext-module__toastContainer--v8ymm",p="Amino_ToastContext-module__toastsWrapper--W5SKw",x="Amino_ToastContext-module__toastWrapperAdjust--j5R-v",f="Amino_ToastContext-module__persistentToastsWrapper--5dhd9",T="Amino_ToastContext-module__clearAllButton--r43o-",h="Amino_ToastContext-module__expanded--mPeFN",C="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 A=o.createContext({dismissAllToasts:function(){},dismissToast:function(t){},notify:function(t,e){}});exports.ToastContext=A,exports.ToastContextProvider=function(n){var d=n.children,_=t.__read(o.useState([]),2),v=_[0],b=_[1],j=t.__read(o.useState([]),2),y=j[0],g=j[1],q=t.__read(o.useState(!1),2),W=q[0],F=q[1],P=t.__read(o.useState({bottom:"",left:""}),2),k=P[0],N=P[1],I=o.useCallback((function(e,o){if(!(null==o?void 0:o.id)||!t.__spreadArray(t.__spreadArray([],t.__read(v),!1),t.__read(y),!1).some((function(t){return t.uuid===o.id}))){var n={isPersistent:null==o?void 0:o.isPersistent,props:o,toast:e,uuid:(null==o?void 0:o.id)||i.v4()};(null==o?void 0:o.isPersistent)?g((function(e){return t.__spreadArray([n],t.__read(e),!1)})):(b((function(e){return t.__spreadArray(t.__spreadArray([],t.__read(e),!1),[n],!1)})),setTimeout((function(){return b((function(t){return t.slice(1)}))}),(null==o?void 0:o.duration)||6e3))}}),[b,g,v,y]),M=o.useCallback((function(t,e,o){o&&N({bottom:o.bottom||"",left:o.left||""}),I(t,e)}),[I]),w=o.useCallback((function(t){b((function(e){return e.filter((function(e){return e.uuid!==t}))})),g((function(e){return e.filter((function(e){return e.uuid!==t}))}))}),[g]),G=o.useCallback((function(){g([]),b([]),F(!1)}),[g,b,F]),R=function(t){var e=t.currentTarget.querySelector(".toast-actions");e&&!e.contains(t.target)&&F((function(t){return!t}))},S=o.useRef(null),B=t.__read(o.useState(0),2),z=B[0],K=B[1],D=y.find(Boolean);o.useEffect((function(){S.current&&K(S.current.offsetHeight)}),[D]);var E=o.useMemo((function(){return{dismissAllToasts:G,dismissToast:w,notify:M}}),[G,w,M]),H=y.length>0;return e.jsxs(A.Provider,{value:E,children:[d,e.jsxs("div",{className:c,style:{"--amino-toast-context-bottom":k.bottom||"40px","--amino-toast-context-left":k.left||"auto","--amino-toast-persistent-height":H&&!W?"".concat(z+40,"px"):"unset"},children:[e.jsx("div",{className:m.default(p,H&&x),children:e.jsx(s.AnimatePresence,{children:v.map((function(t){var o=t.props,n=t.toast,s=t.uuid,i="toast-".concat(n,"-").concat(s);return e.jsx(a.Flex,{children:e.jsx(u.Toast,{direction:null==o?void 0:o.direction,intent:null==o?void 0:o.intent,toastKey:i,children:n})},i)}))})}),e.jsxs("div",{className:m.default(p,f,W&&h),children:[!!y.length&&e.jsx(r.Button,{className:T,icon:e.jsx(l.RemoveIcon,{}),onClick:G,variant:"text",children:"Clear all"}),e.jsx(s.AnimatePresence,{children:y.map((function(o,n){var s=o.props,i=o.toast,r=o.uuid,l="persistent-toast-".concat(i,"-").concat(r),d=0===n||W;return e.jsx("div",{ref:0===n?S:null,className:C,onClick:R,onKeyDown:function(t){"Enter"!==t.key&&" "!==t.key||R(t)},role:"button",tabIndex:0,children:e.jsx(a.Flex,{fullWidth:!0,children:e.jsx(u.Toast,t.__assign({},s,{actions:d?null==s?void 0:s.actions:void 0,isPersistent:!0,onDismiss:function(t){var e;null===(e=null==s?void 0:s.onDismiss)||void 0===e||e.call(s,t),function(t,e){t.stopPropagation(),w(e)}(t,r)},toastKey:l,children:d?i:""}))})},l)}))})]})]})]})};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zonos/amino",
3
- "version": "5.4.34",
3
+ "version": "5.4.35",
4
4
  "description": "Core UI components for Amino",
5
5
  "repository": "git@github.com:Zonos/amino.git",
6
6
  "license": "MIT",