@sps-woodland/growler 8.26.0 → 8.26.2
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.
- package/lib/index.js +3 -3
- package/lib/index.umd.cjs +2 -2
- package/lib/style.css +1 -1
- package/package.json +7 -7
package/lib/index.js
CHANGED
|
@@ -58,7 +58,7 @@ var mt = (t, n, o) => {
|
|
|
58
58
|
for (var [m, b] of t.compoundVariants)
|
|
59
59
|
mt(m, s, t.defaultVariants) && (o += " " + b);
|
|
60
60
|
return o;
|
|
61
|
-
}, pt = Ue({ defaultClassName: "pkg_sps-
|
|
61
|
+
}, pt = Ue({ defaultClassName: "pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnk1", variantClassNames: { kind: { activity: "pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnk2", info: "pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnk3", progress: "pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnk4", error: "pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnk5", success: "pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnk6", warning: "pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnk7" }, fade: { true: "pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnk8", false: "pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnk9" } }, defaultVariants: {}, compoundVariants: [] }), gt = "pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnka", wt = "pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnkh", ft = "pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnkc", ht = "pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnkb", vt = "pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnkd", bt = "pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnke", yt = "pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnkf";
|
|
62
62
|
const He = Object.freeze({
|
|
63
63
|
warning: "status-warning",
|
|
64
64
|
error: "status-error",
|
|
@@ -125,7 +125,7 @@ function We({
|
|
|
125
125
|
{
|
|
126
126
|
kind: "icon",
|
|
127
127
|
icon: "x",
|
|
128
|
-
title: y("design-system:growler.dismiss"),
|
|
128
|
+
title: y("design-system:growler.dismiss", { defaultValue: "Dismiss" }),
|
|
129
129
|
className: wt,
|
|
130
130
|
onClick: $
|
|
131
131
|
}
|
|
@@ -439,7 +439,7 @@ var Xt = dt(function(t, n) {
|
|
|
439
439
|
return a.createElement(Vt, { key: x.id, icons: M, index: be, toast: x, defaultRichColors: z, duration: (ne = y == null ? void 0 : y.duration) != null ? ne : re, className: y == null ? void 0 : y.className, descriptionClassName: y == null ? void 0 : y.descriptionClassName, invert: o, visibleToasts: Y, closeButton: (pe = y == null ? void 0 : y.closeButton) != null ? pe : f, interacting: ce, position: w, style: y == null ? void 0 : y.style, unstyled: y == null ? void 0 : y.unstyled, classNames: y == null ? void 0 : y.classNames, cancelButtonStyle: y == null ? void 0 : y.cancelButtonStyle, actionButtonStyle: y == null ? void 0 : y.actionButtonStyle, removeToast: ve, toasts: G.filter((ae) => ae.position == x.position), heights: ie.filter((ae) => ae.position == x.position), setHeights: he, expandByDefault: g, gap: O, loadingIcon: P, expanded: de, pauseWhenPageIsHidden: $, swipeDirections: t.swipeDirections });
|
|
440
440
|
})) : null;
|
|
441
441
|
}));
|
|
442
|
-
}), Jt = Ue({ defaultClassName: "pkg_sps-
|
|
442
|
+
}), Jt = Ue({ defaultClassName: "pkg_sps-woodland_growler__version_8_26_2__hash_l2jae50", variantClassNames: { kind: { activity: "pkg_sps-woodland_growler__version_8_26_2__hash_l2jae51", info: "pkg_sps-woodland_growler__version_8_26_2__hash_l2jae52", progress: "pkg_sps-woodland_growler__version_8_26_2__hash_l2jae53", error: "pkg_sps-woodland_growler__version_8_26_2__hash_l2jae54", success: "pkg_sps-woodland_growler__version_8_26_2__hash_l2jae55", warning: "pkg_sps-woodland_growler__version_8_26_2__hash_l2jae56" } }, defaultVariants: {}, compoundVariants: [] }), Qt = "pkg_sps-woodland_growler__version_8_26_2__hash_l2jae57", Zt = "pkg_sps-woodland_growler__version_8_26_2__hash_l2jae5e", er = "pkg_sps-woodland_growler__version_8_26_2__hash_l2jae59", tr = "pkg_sps-woodland_growler__version_8_26_2__hash_l2jae58", rr = "pkg_sps-woodland_growler__version_8_26_2__hash_l2jae5a", or = "pkg_sps-woodland_growler__version_8_26_2__hash_l2jae5b", nr = "pkg_sps-woodland_growler__version_8_26_2__hash_l2jae5c";
|
|
443
443
|
function qe() {
|
|
444
444
|
return /* @__PURE__ */ e.createElement(
|
|
445
445
|
Xt,
|
package/lib/index.umd.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
(function(k,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("react"),require("@sps-woodland/core"),require("@sps-woodland/buttons"),require("@sps-woodland/tokens"),require("react-dom"),require("@spscommerce/utils")):typeof define=="function"&&define.amd?define(["exports","react","@sps-woodland/core","@sps-woodland/buttons","@sps-woodland/tokens","react-dom","@spscommerce/utils"],a):(k=typeof globalThis<"u"?globalThis:k||self,a(k.Growler={},k.React,k.core,k.buttons,k.tokens,k.vt,k.utils))})(this,function(k,a,A,Ne,de,Ie,b){"use strict";function qe(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const s=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,s.get?s:{enumerable:!0,get:()=>t[r]})}}return n.default=t,Object.freeze(n)}const e=qe(a);function Xe(t,n,r){return n in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,t}function De(t,n){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);n&&(s=s.filter(function(l){return Object.getOwnPropertyDescriptor(t,l).enumerable})),r.push.apply(r,s)}return r}function Pe(t){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?De(Object(r),!0).forEach(function(s){Xe(t,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):De(Object(r)).forEach(function(s){Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(r,s))})}return t}var Je=(t,n,r)=>{for(var s of Object.keys(t)){var l;if(t[s]!==((l=n[s])!==null&&l!==void 0?l:r[s]))return!1}return!0},je=t=>n=>{var r=t.defaultClassName,s=Pe(Pe({},t.defaultVariants),n);for(var l in s){var g,f=(g=s[l])!==null&&g!==void 0?g:t.defaultVariants[l];if(f!=null){var u=f;typeof u=="boolean"&&(u=u===!0?"true":"false");var d=t.variantClassNames[l][u];d&&(r+=" "+d)}}for(var[m,y]of t.compoundVariants)Je(m,s,t.defaultVariants)&&(r+=" "+y);return r},Qe=je({defaultClassName:"pkg_sps-woodland_growler__version_8_26_0__hash_1c5fbnk1",variantClassNames:{kind:{activity:"pkg_sps-woodland_growler__version_8_26_0__hash_1c5fbnk2",info:"pkg_sps-woodland_growler__version_8_26_0__hash_1c5fbnk3",progress:"pkg_sps-woodland_growler__version_8_26_0__hash_1c5fbnk4",error:"pkg_sps-woodland_growler__version_8_26_0__hash_1c5fbnk5",success:"pkg_sps-woodland_growler__version_8_26_0__hash_1c5fbnk6",warning:"pkg_sps-woodland_growler__version_8_26_0__hash_1c5fbnk7"},fade:{true:"pkg_sps-woodland_growler__version_8_26_0__hash_1c5fbnk8",false:"pkg_sps-woodland_growler__version_8_26_0__hash_1c5fbnk9"}},defaultVariants:{},compoundVariants:[]}),Ze="pkg_sps-woodland_growler__version_8_26_0__hash_1c5fbnka",Re="pkg_sps-woodland_growler__version_8_26_0__hash_1c5fbnkh",et="pkg_sps-woodland_growler__version_8_26_0__hash_1c5fbnkc",tt="pkg_sps-woodland_growler__version_8_26_0__hash_1c5fbnkb",rt="pkg_sps-woodland_growler__version_8_26_0__hash_1c5fbnkd",ot="pkg_sps-woodland_growler__version_8_26_0__hash_1c5fbnke",nt="pkg_sps-woodland_growler__version_8_26_0__hash_1c5fbnkf";const be=Object.freeze({warning:"status-warning",error:"status-error",success:"status-ok",info:"info-circle"});function ye({children:t,className:n,imgSrc:r,kind:s="info",onClose:l,removeFromList:g,persist:f,title:u,id:d,...m}){const y=e.useRef(l);e.useEffect(()=>{y.current=l},[l]);const H=de.Tokens.component.growler.duration.visible,ne=de.Tokens.component.growler.duration.fadeout,[o,V]=e.useState(!1),{t:_}=e.useContext(A.I18nContext);function M(){return[window.setTimeout(()=>{V(!0)},H),window.setTimeout(()=>{y.current&&y.current(),g&&d&&g(d)},H+ne)]}const z=e.useRef([]);function O(){f||(z.current=M())}function I(){for(const B of z.current)window.clearTimeout(B);z.current=[]}function Z(){I(),V(!1)}function W(){Z(),V(!1),l&&l(),g&&d&&g(d)}return e.useEffect(()=>(O(),()=>{I()}),[]),e.createElement("div",{role:"alert","aria-live":"polite",className:A.cl(Qe({kind:s,fade:o}),n),onMouseEnter:Z,onMouseLeave:O,...m},e.createElement("div",{className:tt},r&&e.createElement("img",{src:r,alt:""}),s==="progress"?e.createElement(A.Spinner,null):e.createElement(A.Icon,{icon:be[s],className:et})),e.createElement("div",{className:rt},e.createElement("div",{className:ot},u&&e.createElement("span",{className:nt},u),e.createElement("div",null,t)),e.createElement(Ne.Button,{kind:"icon",icon:"x",title:_("design-system:growler.dismiss"),className:Re,onClick:W})))}A.Metadata.set(ye,{name:"Growler",props:{imgSrc:{type:"string"},kind:{type:"GrowlerKind",default:"info"},onClose:{type:"() => void"},persist:{type:"boolean"},title:{type:"string"}}});const at="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let st=(t=21)=>{let n="",r=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)n+=at[r[t]&63];return n};const Ae=e.createContext({growlerList:[],setGrowlerList:()=>{}});function Oe(t){const[n,r]=e.useState([]),s=f=>{if(!f){console.error("growlers should have an id");return}r(u=>u.filter(d=>f!==d.id))},l=n.map(({G:f,id:u})=>e.cloneElement(f(),{key:u,id:u,removeFromList:s})).filter(f=>A.Metadata.get(f.type).name==="Growler"?!0:(console.error("addGrowler only accepts a function that returns a Growler"),!1)),g=e.createElement("div",{"data-testid":t["data-testid"],"data-portalid":"growler-portal",className:Ze},l);return e.createElement(Ae.Provider,{value:{growlerList:n,setGrowlerList:r}},Ie.createPortal(g,document.body),t.children)}const lt=()=>{const t=e.useContext(Ae);if(t===void 0)throw new Error("addGrowler must be used within a GrowlerListProvider");return{addGrowler:e.useCallback(r=>{const s=st(),l={G:r,id:s};t.setGrowlerList([l,...t.growlerList])},[t])}};var it=t=>{switch(t){case"success":return ut;case"info":return pt;case"warning":return mt;case"error":return gt;default:return null}},dt=Array(12).fill(0),ct=({visible:t,className:n})=>a.createElement("div",{className:["sonner-loading-wrapper",n].filter(Boolean).join(" "),"data-visible":t},a.createElement("div",{className:"sonner-spinner"},dt.map((r,s)=>a.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${s}`})))),ut=a.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},a.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),mt=a.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},a.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),pt=a.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},a.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),gt=a.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},a.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),wt=a.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},a.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),ft=()=>{let[t,n]=a.useState(document.hidden);return a.useEffect(()=>{let r=()=>{n(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),t},_e=1,ht=class{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{let n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var n;let{message:r,...s}=t,l=typeof(t==null?void 0:t.id)=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:_e++,g=this.toasts.find(u=>u.id===l),f=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(l)&&this.dismissedToasts.delete(l),g?this.toasts=this.toasts.map(u=>u.id===l?(this.publish({...u,...t,id:l,title:r}),{...u,...t,id:l,dismissible:f,title:r}):u):this.addToast({title:r,...s,dismissible:f,id:l}),l},this.dismiss=t=>(this.dismissedToasts.add(t),t||this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),this.subscribers.forEach(n=>n({id:t,dismiss:!0})),t),this.message=(t,n)=>this.create({...n,message:t}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));let s=t instanceof Promise?t:t(),l=r!==void 0,g,f=s.then(async d=>{if(g=["resolve",d],a.isValidElement(d))l=!1,this.create({id:r,type:"default",message:d});else if(bt(d)&&!d.ok){l=!1;let m=typeof n.error=="function"?await n.error(`HTTP error! status: ${d.status}`):n.error,y=typeof n.description=="function"?await n.description(`HTTP error! status: ${d.status}`):n.description;this.create({id:r,type:"error",message:m,description:y})}else if(n.success!==void 0){l=!1;let m=typeof n.success=="function"?await n.success(d):n.success,y=typeof n.description=="function"?await n.description(d):n.description;this.create({id:r,type:"success",message:m,description:y})}}).catch(async d=>{if(g=["reject",d],n.error!==void 0){l=!1;let m=typeof n.error=="function"?await n.error(d):n.error,y=typeof n.description=="function"?await n.description(d):n.description;this.create({id:r,type:"error",message:m,description:y})}}).finally(()=>{var d;l&&(this.dismiss(r),r=void 0),(d=n.finally)==null||d.call(n)}),u=()=>new Promise((d,m)=>f.then(()=>g[0]==="reject"?m(g[1]):d(g[1])).catch(m));return typeof r!="string"&&typeof r!="number"?{unwrap:u}:Object.assign(r,{unwrap:u})},this.custom=(t,n)=>{let r=(n==null?void 0:n.id)||_e++;return this.create({jsx:t(r),id:r,...n}),r},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},G=new ht,vt=(t,n)=>{let r=(n==null?void 0:n.id)||_e++;return G.addToast({title:t,...n,id:r}),r},bt=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",yt=vt,_t=()=>G.toasts,Et=()=>G.getActiveToasts(),Ee=Object.assign(yt,{success:G.success,info:G.info,warning:G.warning,error:G.error,custom:G.custom,message:G.message,promise:G.promise,dismiss:G.dismiss,loading:G.loading},{getHistory:_t,getToasts:Et});function xt(t,{insertAt:n}={}){if(typeof document>"u")return;let r=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css",n==="top"&&r.firstChild?r.insertBefore(s,r.firstChild):r.appendChild(s),s.styleSheet?s.styleSheet.cssText=t:s.appendChild(document.createTextNode(t))}xt(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
|
|
2
|
-
`);function ce(t){return t.label!==void 0}var kt=3,Gt="32px",Ct="16px",Le=4e3,Bt=356,St=14,Mt=20,Tt=200;function N(...t){return t.filter(Boolean).join(" ")}function Nt(t){let[n,r]=t.split("-"),s=[];return n&&s.push(n),r&&s.push(r),s}var It=t=>{var n,r,s,l,g,f,u,d,m,y,H;let{invert:ne,toast:o,unstyled:V,interacting:_,setHeights:M,visibleToasts:z,heights:O,index:I,toasts:Z,expanded:W,removeToast:B,defaultRichColors:ae,closeButton:ue,style:me,cancelButtonStyle:ke,actionButtonStyle:pe,className:L="",descriptionClassName:ge="",duration:R,position:we,gap:q,loadingIcon:K,expandByDefault:fe,classNames:c,icons:S,closeButtonAriaLabel:Ge="Close toast",pauseWhenPageIsHidden:w}=t,[h,E]=a.useState(null),[C,ee]=a.useState(null),[x,Ce]=a.useState(!1),[se,he]=a.useState(!1),[le,Be]=a.useState(!1),[Fe,Ht]=a.useState(!1),[Vt,ze]=a.useState(!1),[Wt,Se]=a.useState(0),[qt,Ye]=a.useState(0),ie=a.useRef(o.duration||R||Le),$e=a.useRef(null),X=a.useRef(null),Xt=I===0,Jt=I+1<=z,T=o.type,te=o.dismissible!==!1,Qt=o.className||"",Zt=o.descriptionClassName||"",ve=a.useMemo(()=>O.findIndex(i=>i.toastId===o.id)||0,[O,o.id]),Rt=a.useMemo(()=>{var i;return(i=o.closeButton)!=null?i:ue},[o.closeButton,ue]),Ue=a.useMemo(()=>o.duration||R||Le,[o.duration,R]),Me=a.useRef(0),re=a.useRef(0),He=a.useRef(0),oe=a.useRef(null),[er,tr]=we.split("-"),Ve=a.useMemo(()=>O.reduce((i,p,v)=>v>=ve?i:i+p.height,0),[O,ve]),We=ft(),rr=o.invert||ne,Te=T==="loading";re.current=a.useMemo(()=>ve*q+Ve,[ve,Ve]),a.useEffect(()=>{ie.current=Ue},[Ue]),a.useEffect(()=>{Ce(!0)},[]),a.useEffect(()=>{let i=X.current;if(i){let p=i.getBoundingClientRect().height;return Ye(p),M(v=>[{toastId:o.id,height:p,position:o.position},...v]),()=>M(v=>v.filter(D=>D.toastId!==o.id))}},[M,o.id]),a.useLayoutEffect(()=>{if(!x)return;let i=X.current,p=i.style.height;i.style.height="auto";let v=i.getBoundingClientRect().height;i.style.height=p,Ye(v),M(D=>D.find(P=>P.toastId===o.id)?D.map(P=>P.toastId===o.id?{...P,height:v}:P):[{toastId:o.id,height:v,position:o.position},...D])},[x,o.title,o.description,M,o.id]);let Y=a.useCallback(()=>{he(!0),Se(re.current),M(i=>i.filter(p=>p.toastId!==o.id)),setTimeout(()=>{B(o)},Tt)},[o,B,M,re]);a.useEffect(()=>{if(o.promise&&T==="loading"||o.duration===1/0||o.type==="loading")return;let i;return W||_||w&&We?(()=>{if(He.current<Me.current){let p=new Date().getTime()-Me.current;ie.current=ie.current-p}He.current=new Date().getTime()})():ie.current!==1/0&&(Me.current=new Date().getTime(),i=setTimeout(()=>{var p;(p=o.onAutoClose)==null||p.call(o,o),Y()},ie.current)),()=>clearTimeout(i)},[W,_,o,T,w,We,Y]),a.useEffect(()=>{o.delete&&Y()},[Y,o.delete]);function or(){var i,p,v;return S!=null&&S.loading?a.createElement("div",{className:N(c==null?void 0:c.loader,(i=o==null?void 0:o.classNames)==null?void 0:i.loader,"sonner-loader"),"data-visible":T==="loading"},S.loading):K?a.createElement("div",{className:N(c==null?void 0:c.loader,(p=o==null?void 0:o.classNames)==null?void 0:p.loader,"sonner-loader"),"data-visible":T==="loading"},K):a.createElement(ct,{className:N(c==null?void 0:c.loader,(v=o==null?void 0:o.classNames)==null?void 0:v.loader),visible:T==="loading"})}return a.createElement("li",{tabIndex:0,ref:X,className:N(L,Qt,c==null?void 0:c.toast,(n=o==null?void 0:o.classNames)==null?void 0:n.toast,c==null?void 0:c.default,c==null?void 0:c[T],(r=o==null?void 0:o.classNames)==null?void 0:r[T]),"data-sonner-toast":"","data-rich-colors":(s=o.richColors)!=null?s:ae,"data-styled":!(o.jsx||o.unstyled||V),"data-mounted":x,"data-promise":!!o.promise,"data-swiped":Vt,"data-removed":se,"data-visible":Jt,"data-y-position":er,"data-x-position":tr,"data-index":I,"data-front":Xt,"data-swiping":le,"data-dismissible":te,"data-type":T,"data-invert":rr,"data-swipe-out":Fe,"data-swipe-direction":C,"data-expanded":!!(W||fe&&x),style:{"--index":I,"--toasts-before":I,"--z-index":Z.length-I,"--offset":`${se?Wt:re.current}px`,"--initial-height":fe?"auto":`${qt}px`,...me,...o.style},onDragEnd:()=>{Be(!1),E(null),oe.current=null},onPointerDown:i=>{Te||!te||($e.current=new Date,Se(re.current),i.target.setPointerCapture(i.pointerId),i.target.tagName!=="BUTTON"&&(Be(!0),oe.current={x:i.clientX,y:i.clientY}))},onPointerUp:()=>{var i,p,v,D;if(Fe||!te)return;oe.current=null;let P=Number(((i=X.current)==null?void 0:i.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),$=Number(((p=X.current)==null?void 0:p.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),J=new Date().getTime()-((v=$e.current)==null?void 0:v.getTime()),j=h==="x"?P:$,U=Math.abs(j)/J;if(Math.abs(j)>=Mt||U>.11){Se(re.current),(D=o.onDismiss)==null||D.call(o,o),ee(h==="x"?P>0?"right":"left":$>0?"down":"up"),Y(),Ht(!0),ze(!1);return}Be(!1),E(null)},onPointerMove:i=>{var p,v,D,P;if(!oe.current||!te||((p=window.getSelection())==null?void 0:p.toString().length)>0)return;let $=i.clientY-oe.current.y,J=i.clientX-oe.current.x,j=(v=t.swipeDirections)!=null?v:Nt(we);!h&&(Math.abs(J)>1||Math.abs($)>1)&&E(Math.abs(J)>Math.abs($)?"x":"y");let U={x:0,y:0};h==="y"?(j.includes("top")||j.includes("bottom"))&&(j.includes("top")&&$<0||j.includes("bottom")&&$>0)&&(U.y=$):h==="x"&&(j.includes("left")||j.includes("right"))&&(j.includes("left")&&J<0||j.includes("right")&&J>0)&&(U.x=J),(Math.abs(U.x)>0||Math.abs(U.y)>0)&&ze(!0),(D=X.current)==null||D.style.setProperty("--swipe-amount-x",`${U.x}px`),(P=X.current)==null||P.style.setProperty("--swipe-amount-y",`${U.y}px`)}},Rt&&!o.jsx?a.createElement("button",{"aria-label":Ge,"data-disabled":Te,"data-close-button":!0,onClick:Te||!te?()=>{}:()=>{var i;Y(),(i=o.onDismiss)==null||i.call(o,o)},className:N(c==null?void 0:c.closeButton,(l=o==null?void 0:o.classNames)==null?void 0:l.closeButton)},(g=S==null?void 0:S.close)!=null?g:wt):null,o.jsx||a.isValidElement(o.title)?o.jsx?o.jsx:typeof o.title=="function"?o.title():o.title:a.createElement(a.Fragment,null,T||o.icon||o.promise?a.createElement("div",{"data-icon":"",className:N(c==null?void 0:c.icon,(f=o==null?void 0:o.classNames)==null?void 0:f.icon)},o.promise||o.type==="loading"&&!o.icon?o.icon||or():null,o.type!=="loading"?o.icon||(S==null?void 0:S[T])||it(T):null):null,a.createElement("div",{"data-content":"",className:N(c==null?void 0:c.content,(u=o==null?void 0:o.classNames)==null?void 0:u.content)},a.createElement("div",{"data-title":"",className:N(c==null?void 0:c.title,(d=o==null?void 0:o.classNames)==null?void 0:d.title)},typeof o.title=="function"?o.title():o.title),o.description?a.createElement("div",{"data-description":"",className:N(ge,Zt,c==null?void 0:c.description,(m=o==null?void 0:o.classNames)==null?void 0:m.description)},typeof o.description=="function"?o.description():o.description):null),a.isValidElement(o.cancel)?o.cancel:o.cancel&&ce(o.cancel)?a.createElement("button",{"data-button":!0,"data-cancel":!0,style:o.cancelButtonStyle||ke,onClick:i=>{var p,v;ce(o.cancel)&&te&&((v=(p=o.cancel).onClick)==null||v.call(p,i),Y())},className:N(c==null?void 0:c.cancelButton,(y=o==null?void 0:o.classNames)==null?void 0:y.cancelButton)},o.cancel.label):null,a.isValidElement(o.action)?o.action:o.action&&ce(o.action)?a.createElement("button",{"data-button":!0,"data-action":!0,style:o.actionButtonStyle||pe,onClick:i=>{var p,v;ce(o.action)&&((v=(p=o.action).onClick)==null||v.call(p,i),!i.defaultPrevented&&Y())},className:N(c==null?void 0:c.actionButton,(H=o==null?void 0:o.classNames)==null?void 0:H.actionButton)},o.action.label):null))};function Ke(){if(typeof window>"u"||typeof document>"u")return"ltr";let t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function Dt(t,n){let r={};return[t,n].forEach((s,l)=>{let g=l===1,f=g?"--mobile-offset":"--offset",u=g?Ct:Gt;function d(m){["top","right","bottom","left"].forEach(y=>{r[`${f}-${y}`]=typeof m=="number"?`${m}px`:m})}typeof s=="number"||typeof s=="string"?d(s):typeof s=="object"?["top","right","bottom","left"].forEach(m=>{s[m]===void 0?r[`${f}-${m}`]=u:r[`${f}-${m}`]=typeof s[m]=="number"?`${s[m]}px`:s[m]}):d(u)}),r}var Pt=a.forwardRef(function(t,n){let{invert:r,position:s="bottom-right",hotkey:l=["altKey","KeyT"],expand:g,closeButton:f,className:u,offset:d,mobileOffset:m,theme:y="light",richColors:H,duration:ne,style:o,visibleToasts:V=kt,toastOptions:_,dir:M=Ke(),gap:z=St,loadingIcon:O,icons:I,containerAriaLabel:Z="Notifications",pauseWhenPageIsHidden:W}=t,[B,ae]=a.useState([]),ue=a.useMemo(()=>Array.from(new Set([s].concat(B.filter(w=>w.position).map(w=>w.position)))),[B,s]),[me,ke]=a.useState([]),[pe,L]=a.useState(!1),[ge,R]=a.useState(!1),[we,q]=a.useState(y!=="system"?y:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),K=a.useRef(null),fe=l.join("+").replace(/Key/g,"").replace(/Digit/g,""),c=a.useRef(null),S=a.useRef(!1),Ge=a.useCallback(w=>{ae(h=>{var E;return(E=h.find(C=>C.id===w.id))!=null&&E.delete||G.dismiss(w.id),h.filter(({id:C})=>C!==w.id)})},[]);return a.useEffect(()=>G.subscribe(w=>{if(w.dismiss){ae(h=>h.map(E=>E.id===w.id?{...E,delete:!0}:E));return}setTimeout(()=>{Ie.flushSync(()=>{ae(h=>{let E=h.findIndex(C=>C.id===w.id);return E!==-1?[...h.slice(0,E),{...h[E],...w},...h.slice(E+1)]:[w,...h]})})})}),[]),a.useEffect(()=>{if(y!=="system"){q(y);return}if(y==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?q("dark"):q("light")),typeof window>"u")return;let w=window.matchMedia("(prefers-color-scheme: dark)");try{w.addEventListener("change",({matches:h})=>{q(h?"dark":"light")})}catch{w.addListener(({matches:E})=>{try{q(E?"dark":"light")}catch(C){console.error(C)}})}},[y]),a.useEffect(()=>{B.length<=1&&L(!1)},[B]),a.useEffect(()=>{let w=h=>{var E,C;l.every(ee=>h[ee]||h.code===ee)&&(L(!0),(E=K.current)==null||E.focus()),h.code==="Escape"&&(document.activeElement===K.current||(C=K.current)!=null&&C.contains(document.activeElement))&&L(!1)};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[l]),a.useEffect(()=>{if(K.current)return()=>{c.current&&(c.current.focus({preventScroll:!0}),c.current=null,S.current=!1)}},[K.current]),a.createElement("section",{ref:n,"aria-label":`${Z} ${fe}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},ue.map((w,h)=>{var E;let[C,ee]=w.split("-");return B.length?a.createElement("ol",{key:w,dir:M==="auto"?Ke():M,tabIndex:-1,ref:K,className:u,"data-sonner-toaster":!0,"data-theme":we,"data-y-position":C,"data-lifted":pe&&B.length>1&&!g,"data-x-position":ee,style:{"--front-toast-height":`${((E=me[0])==null?void 0:E.height)||0}px`,"--width":`${Bt}px`,"--gap":`${z}px`,...o,...Dt(d,m)},onBlur:x=>{S.current&&!x.currentTarget.contains(x.relatedTarget)&&(S.current=!1,c.current&&(c.current.focus({preventScroll:!0}),c.current=null))},onFocus:x=>{x.target instanceof HTMLElement&&x.target.dataset.dismissible==="false"||S.current||(S.current=!0,c.current=x.relatedTarget)},onMouseEnter:()=>L(!0),onMouseMove:()=>L(!0),onMouseLeave:()=>{ge||L(!1)},onDragEnd:()=>L(!1),onPointerDown:x=>{x.target instanceof HTMLElement&&x.target.dataset.dismissible==="false"||R(!0)},onPointerUp:()=>R(!1)},B.filter(x=>!x.position&&h===0||x.position===w).map((x,Ce)=>{var se,he;return a.createElement(It,{key:x.id,icons:I,index:Ce,toast:x,defaultRichColors:H,duration:(se=_==null?void 0:_.duration)!=null?se:ne,className:_==null?void 0:_.className,descriptionClassName:_==null?void 0:_.descriptionClassName,invert:r,visibleToasts:V,closeButton:(he=_==null?void 0:_.closeButton)!=null?he:f,interacting:ge,position:w,style:_==null?void 0:_.style,unstyled:_==null?void 0:_.unstyled,classNames:_==null?void 0:_.classNames,cancelButtonStyle:_==null?void 0:_.cancelButtonStyle,actionButtonStyle:_==null?void 0:_.actionButtonStyle,removeToast:Ge,toasts:B.filter(le=>le.position==x.position),heights:me.filter(le=>le.position==x.position),setHeights:ke,expandByDefault:g,gap:z,loadingIcon:O,expanded:pe,pauseWhenPageIsHidden:W,swipeDirections:t.swipeDirections})})):null}))}),jt=je({defaultClassName:"pkg_sps-woodland_growler__version_8_26_0__hash_l2jae50",variantClassNames:{kind:{activity:"pkg_sps-woodland_growler__version_8_26_0__hash_l2jae51",info:"pkg_sps-woodland_growler__version_8_26_0__hash_l2jae52",progress:"pkg_sps-woodland_growler__version_8_26_0__hash_l2jae53",error:"pkg_sps-woodland_growler__version_8_26_0__hash_l2jae54",success:"pkg_sps-woodland_growler__version_8_26_0__hash_l2jae55",warning:"pkg_sps-woodland_growler__version_8_26_0__hash_l2jae56"}},defaultVariants:{},compoundVariants:[]}),At="pkg_sps-woodland_growler__version_8_26_0__hash_l2jae57",Ot="pkg_sps-woodland_growler__version_8_26_0__hash_l2jae5e",Lt="pkg_sps-woodland_growler__version_8_26_0__hash_l2jae59",Kt="pkg_sps-woodland_growler__version_8_26_0__hash_l2jae58",Ft="pkg_sps-woodland_growler__version_8_26_0__hash_l2jae5a",zt="pkg_sps-woodland_growler__version_8_26_0__hash_l2jae5b",Yt="pkg_sps-woodland_growler__version_8_26_0__hash_l2jae5c";function xe(){return e.createElement(Pt,{visibleToasts:10,expand:!0,closeButton:!0,position:"top-right",className:At,duration:de.Tokens.component.growler.duration.visible,richColors:!0,toastOptions:{style:{outline:"none"}}})}A.Metadata.set(xe,{name:"GrowlerEmitter"});function $t({children:t,kind:n="info",onCloseButtonClick:r,title:s}){const{t:l}=e.useContext(A.I18nContext);return e.createElement("div",{className:jt({kind:n})},e.createElement("div",{className:Kt},n==="progress"?e.createElement(A.Spinner,null):e.createElement(A.Icon,{icon:be[n],className:Lt})),e.createElement("div",{className:Ft},e.createElement("div",{className:zt},s?e.createElement("span",{className:Yt},s):void 0,e.createElement("div",null,t)),e.createElement(Ne.Button,{kind:"icon",icon:"x",title:l("design-system:growler.dismiss"),className:Ot,onClick:r})))}const Q=t=>(n,r)=>Ee.custom(s=>e.createElement($t,{title:n,kind:t,onCloseButtonClick:()=>{var l;Ee.dismiss(s),(l=r==null?void 0:r.onDismiss)==null||l.call(r,s)}},typeof(r==null?void 0:r.description)=="function"?r.description(s):r==null?void 0:r.description),{...r!=null&&r.id?{id:r.id}:{},duration:(r==null?void 0:r.autoClose)??!0?de.Tokens.component.growler.duration.visible:1/0,onDismiss:s=>{var l;(l=r==null?void 0:r.onDismiss)==null||l.call(r,s.id)},onAutoClose:s=>{var l;(l=r==null?void 0:r.onAutoClose)==null||l.call(r,s.id)}}),F=(t,{kind:n,...r})=>Q(n)(t,r);F.success=Q("success"),F.error=Q("error"),F.info=Q("info"),F.warning=Q("warning"),F.progress=Q("progress"),F.dismiss=Ee.dismiss;const Ut={Growlers:{description:()=>e.createElement("p",null,"Use Growlers for dynamic messages in response to a user's action. All Growlers have a Primary Message, and may optionally have a Secondary Message as needed. Growlers may also contain Hyperlinks in the Secondary Message."),components:[xe,F,ye,Oe],examples:{general:{label:"General Usage",description:()=>e.createElement(e.Fragment,null,e.createElement("p",null,"Use the following guidelines to write an effective Growler message."),e.createElement("ul",null,e.createElement("li",null,"Write all messages in sentence case.",e.createElement("ul",null,e.createElement("li",null,"Capitalize the first word of the message."),e.createElement("li",null,"Add punctuation, such as a period, at the end of the message."))),e.createElement("li",null,"Keep messages as succinct as possible while also providing sufficient information to the customer."),e.createElement("li",null,"If you can clearly convey your message in a single statement, use only the Primary Message."),e.createElement("li",null,"If the message requires additional details, such as further information or instructions, use both the Primary and Secondary Messages.")),e.createElement("p",null,"For more examples of effective feedback message writing, refer to"," ",e.createElement("a",{href:"https://atlassian.design/content/messaging-guidelines",target:"_blank"},"Atlassian's Messaging Guidelines"),"."))},emitter:{label:"Growler Emitter",description:()=>e.createElement(e.Fragment,null,e.createElement("p",null,e.createElement("code",null,"GrowlerEmitter")," is a component that displays growlers. It should be placed in the root of your application. It is not a provider and does not take any props."))},growlerKinds:{label:"Growler Kinds",description:()=>e.createElement(e.Fragment,null,e.createElement("p",null,"Growlers come in five different kinds: ",e.createElement("code",null,"success"),", ",e.createElement("code",null,"error"),","," ",e.createElement("code",null,"info"),", ",e.createElement("code",null,"warning"),", and ",e.createElement("code",null,"progress"),". Each kind has a unique icon and color scheme.")),examples:{success:{description:"Success",react:b.code`
|
|
1
|
+
(function(k,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("react"),require("@sps-woodland/core"),require("@sps-woodland/buttons"),require("@sps-woodland/tokens"),require("react-dom"),require("@spscommerce/utils")):typeof define=="function"&&define.amd?define(["exports","react","@sps-woodland/core","@sps-woodland/buttons","@sps-woodland/tokens","react-dom","@spscommerce/utils"],a):(k=typeof globalThis<"u"?globalThis:k||self,a(k.Growler={},k.React,k.core,k.buttons,k.tokens,k.vt,k.utils))})(this,function(k,a,A,Ne,de,Ie,b){"use strict";function qe(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const s=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,s.get?s:{enumerable:!0,get:()=>t[r]})}}return n.default=t,Object.freeze(n)}const e=qe(a);function Xe(t,n,r){return n in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,t}function De(t,n){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);n&&(s=s.filter(function(l){return Object.getOwnPropertyDescriptor(t,l).enumerable})),r.push.apply(r,s)}return r}function Pe(t){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?De(Object(r),!0).forEach(function(s){Xe(t,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):De(Object(r)).forEach(function(s){Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(r,s))})}return t}var Je=(t,n,r)=>{for(var s of Object.keys(t)){var l;if(t[s]!==((l=n[s])!==null&&l!==void 0?l:r[s]))return!1}return!0},je=t=>n=>{var r=t.defaultClassName,s=Pe(Pe({},t.defaultVariants),n);for(var l in s){var g,f=(g=s[l])!==null&&g!==void 0?g:t.defaultVariants[l];if(f!=null){var u=f;typeof u=="boolean"&&(u=u===!0?"true":"false");var d=t.variantClassNames[l][u];d&&(r+=" "+d)}}for(var[m,y]of t.compoundVariants)Je(m,s,t.defaultVariants)&&(r+=" "+y);return r},Qe=je({defaultClassName:"pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnk1",variantClassNames:{kind:{activity:"pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnk2",info:"pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnk3",progress:"pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnk4",error:"pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnk5",success:"pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnk6",warning:"pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnk7"},fade:{true:"pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnk8",false:"pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnk9"}},defaultVariants:{},compoundVariants:[]}),Ze="pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnka",Re="pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnkh",et="pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnkc",tt="pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnkb",rt="pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnkd",ot="pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnke",nt="pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnkf";const be=Object.freeze({warning:"status-warning",error:"status-error",success:"status-ok",info:"info-circle"});function ye({children:t,className:n,imgSrc:r,kind:s="info",onClose:l,removeFromList:g,persist:f,title:u,id:d,...m}){const y=e.useRef(l);e.useEffect(()=>{y.current=l},[l]);const H=de.Tokens.component.growler.duration.visible,ne=de.Tokens.component.growler.duration.fadeout,[o,V]=e.useState(!1),{t:_}=e.useContext(A.I18nContext);function M(){return[window.setTimeout(()=>{V(!0)},H),window.setTimeout(()=>{y.current&&y.current(),g&&d&&g(d)},H+ne)]}const z=e.useRef([]);function O(){f||(z.current=M())}function I(){for(const B of z.current)window.clearTimeout(B);z.current=[]}function Z(){I(),V(!1)}function W(){Z(),V(!1),l&&l(),g&&d&&g(d)}return e.useEffect(()=>(O(),()=>{I()}),[]),e.createElement("div",{role:"alert","aria-live":"polite",className:A.cl(Qe({kind:s,fade:o}),n),onMouseEnter:Z,onMouseLeave:O,...m},e.createElement("div",{className:tt},r&&e.createElement("img",{src:r,alt:""}),s==="progress"?e.createElement(A.Spinner,null):e.createElement(A.Icon,{icon:be[s],className:et})),e.createElement("div",{className:rt},e.createElement("div",{className:ot},u&&e.createElement("span",{className:nt},u),e.createElement("div",null,t)),e.createElement(Ne.Button,{kind:"icon",icon:"x",title:_("design-system:growler.dismiss",{defaultValue:"Dismiss"}),className:Re,onClick:W})))}A.Metadata.set(ye,{name:"Growler",props:{imgSrc:{type:"string"},kind:{type:"GrowlerKind",default:"info"},onClose:{type:"() => void"},persist:{type:"boolean"},title:{type:"string"}}});const at="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let st=(t=21)=>{let n="",r=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)n+=at[r[t]&63];return n};const Ae=e.createContext({growlerList:[],setGrowlerList:()=>{}});function Oe(t){const[n,r]=e.useState([]),s=f=>{if(!f){console.error("growlers should have an id");return}r(u=>u.filter(d=>f!==d.id))},l=n.map(({G:f,id:u})=>e.cloneElement(f(),{key:u,id:u,removeFromList:s})).filter(f=>A.Metadata.get(f.type).name==="Growler"?!0:(console.error("addGrowler only accepts a function that returns a Growler"),!1)),g=e.createElement("div",{"data-testid":t["data-testid"],"data-portalid":"growler-portal",className:Ze},l);return e.createElement(Ae.Provider,{value:{growlerList:n,setGrowlerList:r}},Ie.createPortal(g,document.body),t.children)}const lt=()=>{const t=e.useContext(Ae);if(t===void 0)throw new Error("addGrowler must be used within a GrowlerListProvider");return{addGrowler:e.useCallback(r=>{const s=st(),l={G:r,id:s};t.setGrowlerList([l,...t.growlerList])},[t])}};var it=t=>{switch(t){case"success":return ut;case"info":return pt;case"warning":return mt;case"error":return gt;default:return null}},dt=Array(12).fill(0),ct=({visible:t,className:n})=>a.createElement("div",{className:["sonner-loading-wrapper",n].filter(Boolean).join(" "),"data-visible":t},a.createElement("div",{className:"sonner-spinner"},dt.map((r,s)=>a.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${s}`})))),ut=a.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},a.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),mt=a.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},a.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),pt=a.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},a.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),gt=a.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},a.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),wt=a.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},a.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),ft=()=>{let[t,n]=a.useState(document.hidden);return a.useEffect(()=>{let r=()=>{n(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),t},_e=1,ht=class{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{let n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var n;let{message:r,...s}=t,l=typeof(t==null?void 0:t.id)=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:_e++,g=this.toasts.find(u=>u.id===l),f=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(l)&&this.dismissedToasts.delete(l),g?this.toasts=this.toasts.map(u=>u.id===l?(this.publish({...u,...t,id:l,title:r}),{...u,...t,id:l,dismissible:f,title:r}):u):this.addToast({title:r,...s,dismissible:f,id:l}),l},this.dismiss=t=>(this.dismissedToasts.add(t),t||this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),this.subscribers.forEach(n=>n({id:t,dismiss:!0})),t),this.message=(t,n)=>this.create({...n,message:t}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));let s=t instanceof Promise?t:t(),l=r!==void 0,g,f=s.then(async d=>{if(g=["resolve",d],a.isValidElement(d))l=!1,this.create({id:r,type:"default",message:d});else if(bt(d)&&!d.ok){l=!1;let m=typeof n.error=="function"?await n.error(`HTTP error! status: ${d.status}`):n.error,y=typeof n.description=="function"?await n.description(`HTTP error! status: ${d.status}`):n.description;this.create({id:r,type:"error",message:m,description:y})}else if(n.success!==void 0){l=!1;let m=typeof n.success=="function"?await n.success(d):n.success,y=typeof n.description=="function"?await n.description(d):n.description;this.create({id:r,type:"success",message:m,description:y})}}).catch(async d=>{if(g=["reject",d],n.error!==void 0){l=!1;let m=typeof n.error=="function"?await n.error(d):n.error,y=typeof n.description=="function"?await n.description(d):n.description;this.create({id:r,type:"error",message:m,description:y})}}).finally(()=>{var d;l&&(this.dismiss(r),r=void 0),(d=n.finally)==null||d.call(n)}),u=()=>new Promise((d,m)=>f.then(()=>g[0]==="reject"?m(g[1]):d(g[1])).catch(m));return typeof r!="string"&&typeof r!="number"?{unwrap:u}:Object.assign(r,{unwrap:u})},this.custom=(t,n)=>{let r=(n==null?void 0:n.id)||_e++;return this.create({jsx:t(r),id:r,...n}),r},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},G=new ht,vt=(t,n)=>{let r=(n==null?void 0:n.id)||_e++;return G.addToast({title:t,...n,id:r}),r},bt=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",yt=vt,_t=()=>G.toasts,Et=()=>G.getActiveToasts(),Ee=Object.assign(yt,{success:G.success,info:G.info,warning:G.warning,error:G.error,custom:G.custom,message:G.message,promise:G.promise,dismiss:G.dismiss,loading:G.loading},{getHistory:_t,getToasts:Et});function xt(t,{insertAt:n}={}){if(typeof document>"u")return;let r=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css",n==="top"&&r.firstChild?r.insertBefore(s,r.firstChild):r.appendChild(s),s.styleSheet?s.styleSheet.cssText=t:s.appendChild(document.createTextNode(t))}xt(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
|
|
2
|
+
`);function ce(t){return t.label!==void 0}var kt=3,Gt="32px",Ct="16px",Le=4e3,Bt=356,St=14,Mt=20,Tt=200;function N(...t){return t.filter(Boolean).join(" ")}function Nt(t){let[n,r]=t.split("-"),s=[];return n&&s.push(n),r&&s.push(r),s}var It=t=>{var n,r,s,l,g,f,u,d,m,y,H;let{invert:ne,toast:o,unstyled:V,interacting:_,setHeights:M,visibleToasts:z,heights:O,index:I,toasts:Z,expanded:W,removeToast:B,defaultRichColors:ae,closeButton:ue,style:me,cancelButtonStyle:ke,actionButtonStyle:pe,className:L="",descriptionClassName:ge="",duration:R,position:we,gap:q,loadingIcon:K,expandByDefault:fe,classNames:c,icons:S,closeButtonAriaLabel:Ge="Close toast",pauseWhenPageIsHidden:w}=t,[h,E]=a.useState(null),[C,ee]=a.useState(null),[x,Ce]=a.useState(!1),[se,he]=a.useState(!1),[le,Be]=a.useState(!1),[Fe,Ht]=a.useState(!1),[Vt,ze]=a.useState(!1),[Wt,Se]=a.useState(0),[qt,Ye]=a.useState(0),ie=a.useRef(o.duration||R||Le),$e=a.useRef(null),X=a.useRef(null),Xt=I===0,Jt=I+1<=z,T=o.type,te=o.dismissible!==!1,Qt=o.className||"",Zt=o.descriptionClassName||"",ve=a.useMemo(()=>O.findIndex(i=>i.toastId===o.id)||0,[O,o.id]),Rt=a.useMemo(()=>{var i;return(i=o.closeButton)!=null?i:ue},[o.closeButton,ue]),Ue=a.useMemo(()=>o.duration||R||Le,[o.duration,R]),Me=a.useRef(0),re=a.useRef(0),He=a.useRef(0),oe=a.useRef(null),[er,tr]=we.split("-"),Ve=a.useMemo(()=>O.reduce((i,p,v)=>v>=ve?i:i+p.height,0),[O,ve]),We=ft(),rr=o.invert||ne,Te=T==="loading";re.current=a.useMemo(()=>ve*q+Ve,[ve,Ve]),a.useEffect(()=>{ie.current=Ue},[Ue]),a.useEffect(()=>{Ce(!0)},[]),a.useEffect(()=>{let i=X.current;if(i){let p=i.getBoundingClientRect().height;return Ye(p),M(v=>[{toastId:o.id,height:p,position:o.position},...v]),()=>M(v=>v.filter(D=>D.toastId!==o.id))}},[M,o.id]),a.useLayoutEffect(()=>{if(!x)return;let i=X.current,p=i.style.height;i.style.height="auto";let v=i.getBoundingClientRect().height;i.style.height=p,Ye(v),M(D=>D.find(P=>P.toastId===o.id)?D.map(P=>P.toastId===o.id?{...P,height:v}:P):[{toastId:o.id,height:v,position:o.position},...D])},[x,o.title,o.description,M,o.id]);let Y=a.useCallback(()=>{he(!0),Se(re.current),M(i=>i.filter(p=>p.toastId!==o.id)),setTimeout(()=>{B(o)},Tt)},[o,B,M,re]);a.useEffect(()=>{if(o.promise&&T==="loading"||o.duration===1/0||o.type==="loading")return;let i;return W||_||w&&We?(()=>{if(He.current<Me.current){let p=new Date().getTime()-Me.current;ie.current=ie.current-p}He.current=new Date().getTime()})():ie.current!==1/0&&(Me.current=new Date().getTime(),i=setTimeout(()=>{var p;(p=o.onAutoClose)==null||p.call(o,o),Y()},ie.current)),()=>clearTimeout(i)},[W,_,o,T,w,We,Y]),a.useEffect(()=>{o.delete&&Y()},[Y,o.delete]);function or(){var i,p,v;return S!=null&&S.loading?a.createElement("div",{className:N(c==null?void 0:c.loader,(i=o==null?void 0:o.classNames)==null?void 0:i.loader,"sonner-loader"),"data-visible":T==="loading"},S.loading):K?a.createElement("div",{className:N(c==null?void 0:c.loader,(p=o==null?void 0:o.classNames)==null?void 0:p.loader,"sonner-loader"),"data-visible":T==="loading"},K):a.createElement(ct,{className:N(c==null?void 0:c.loader,(v=o==null?void 0:o.classNames)==null?void 0:v.loader),visible:T==="loading"})}return a.createElement("li",{tabIndex:0,ref:X,className:N(L,Qt,c==null?void 0:c.toast,(n=o==null?void 0:o.classNames)==null?void 0:n.toast,c==null?void 0:c.default,c==null?void 0:c[T],(r=o==null?void 0:o.classNames)==null?void 0:r[T]),"data-sonner-toast":"","data-rich-colors":(s=o.richColors)!=null?s:ae,"data-styled":!(o.jsx||o.unstyled||V),"data-mounted":x,"data-promise":!!o.promise,"data-swiped":Vt,"data-removed":se,"data-visible":Jt,"data-y-position":er,"data-x-position":tr,"data-index":I,"data-front":Xt,"data-swiping":le,"data-dismissible":te,"data-type":T,"data-invert":rr,"data-swipe-out":Fe,"data-swipe-direction":C,"data-expanded":!!(W||fe&&x),style:{"--index":I,"--toasts-before":I,"--z-index":Z.length-I,"--offset":`${se?Wt:re.current}px`,"--initial-height":fe?"auto":`${qt}px`,...me,...o.style},onDragEnd:()=>{Be(!1),E(null),oe.current=null},onPointerDown:i=>{Te||!te||($e.current=new Date,Se(re.current),i.target.setPointerCapture(i.pointerId),i.target.tagName!=="BUTTON"&&(Be(!0),oe.current={x:i.clientX,y:i.clientY}))},onPointerUp:()=>{var i,p,v,D;if(Fe||!te)return;oe.current=null;let P=Number(((i=X.current)==null?void 0:i.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),$=Number(((p=X.current)==null?void 0:p.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),J=new Date().getTime()-((v=$e.current)==null?void 0:v.getTime()),j=h==="x"?P:$,U=Math.abs(j)/J;if(Math.abs(j)>=Mt||U>.11){Se(re.current),(D=o.onDismiss)==null||D.call(o,o),ee(h==="x"?P>0?"right":"left":$>0?"down":"up"),Y(),Ht(!0),ze(!1);return}Be(!1),E(null)},onPointerMove:i=>{var p,v,D,P;if(!oe.current||!te||((p=window.getSelection())==null?void 0:p.toString().length)>0)return;let $=i.clientY-oe.current.y,J=i.clientX-oe.current.x,j=(v=t.swipeDirections)!=null?v:Nt(we);!h&&(Math.abs(J)>1||Math.abs($)>1)&&E(Math.abs(J)>Math.abs($)?"x":"y");let U={x:0,y:0};h==="y"?(j.includes("top")||j.includes("bottom"))&&(j.includes("top")&&$<0||j.includes("bottom")&&$>0)&&(U.y=$):h==="x"&&(j.includes("left")||j.includes("right"))&&(j.includes("left")&&J<0||j.includes("right")&&J>0)&&(U.x=J),(Math.abs(U.x)>0||Math.abs(U.y)>0)&&ze(!0),(D=X.current)==null||D.style.setProperty("--swipe-amount-x",`${U.x}px`),(P=X.current)==null||P.style.setProperty("--swipe-amount-y",`${U.y}px`)}},Rt&&!o.jsx?a.createElement("button",{"aria-label":Ge,"data-disabled":Te,"data-close-button":!0,onClick:Te||!te?()=>{}:()=>{var i;Y(),(i=o.onDismiss)==null||i.call(o,o)},className:N(c==null?void 0:c.closeButton,(l=o==null?void 0:o.classNames)==null?void 0:l.closeButton)},(g=S==null?void 0:S.close)!=null?g:wt):null,o.jsx||a.isValidElement(o.title)?o.jsx?o.jsx:typeof o.title=="function"?o.title():o.title:a.createElement(a.Fragment,null,T||o.icon||o.promise?a.createElement("div",{"data-icon":"",className:N(c==null?void 0:c.icon,(f=o==null?void 0:o.classNames)==null?void 0:f.icon)},o.promise||o.type==="loading"&&!o.icon?o.icon||or():null,o.type!=="loading"?o.icon||(S==null?void 0:S[T])||it(T):null):null,a.createElement("div",{"data-content":"",className:N(c==null?void 0:c.content,(u=o==null?void 0:o.classNames)==null?void 0:u.content)},a.createElement("div",{"data-title":"",className:N(c==null?void 0:c.title,(d=o==null?void 0:o.classNames)==null?void 0:d.title)},typeof o.title=="function"?o.title():o.title),o.description?a.createElement("div",{"data-description":"",className:N(ge,Zt,c==null?void 0:c.description,(m=o==null?void 0:o.classNames)==null?void 0:m.description)},typeof o.description=="function"?o.description():o.description):null),a.isValidElement(o.cancel)?o.cancel:o.cancel&&ce(o.cancel)?a.createElement("button",{"data-button":!0,"data-cancel":!0,style:o.cancelButtonStyle||ke,onClick:i=>{var p,v;ce(o.cancel)&&te&&((v=(p=o.cancel).onClick)==null||v.call(p,i),Y())},className:N(c==null?void 0:c.cancelButton,(y=o==null?void 0:o.classNames)==null?void 0:y.cancelButton)},o.cancel.label):null,a.isValidElement(o.action)?o.action:o.action&&ce(o.action)?a.createElement("button",{"data-button":!0,"data-action":!0,style:o.actionButtonStyle||pe,onClick:i=>{var p,v;ce(o.action)&&((v=(p=o.action).onClick)==null||v.call(p,i),!i.defaultPrevented&&Y())},className:N(c==null?void 0:c.actionButton,(H=o==null?void 0:o.classNames)==null?void 0:H.actionButton)},o.action.label):null))};function Ke(){if(typeof window>"u"||typeof document>"u")return"ltr";let t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function Dt(t,n){let r={};return[t,n].forEach((s,l)=>{let g=l===1,f=g?"--mobile-offset":"--offset",u=g?Ct:Gt;function d(m){["top","right","bottom","left"].forEach(y=>{r[`${f}-${y}`]=typeof m=="number"?`${m}px`:m})}typeof s=="number"||typeof s=="string"?d(s):typeof s=="object"?["top","right","bottom","left"].forEach(m=>{s[m]===void 0?r[`${f}-${m}`]=u:r[`${f}-${m}`]=typeof s[m]=="number"?`${s[m]}px`:s[m]}):d(u)}),r}var Pt=a.forwardRef(function(t,n){let{invert:r,position:s="bottom-right",hotkey:l=["altKey","KeyT"],expand:g,closeButton:f,className:u,offset:d,mobileOffset:m,theme:y="light",richColors:H,duration:ne,style:o,visibleToasts:V=kt,toastOptions:_,dir:M=Ke(),gap:z=St,loadingIcon:O,icons:I,containerAriaLabel:Z="Notifications",pauseWhenPageIsHidden:W}=t,[B,ae]=a.useState([]),ue=a.useMemo(()=>Array.from(new Set([s].concat(B.filter(w=>w.position).map(w=>w.position)))),[B,s]),[me,ke]=a.useState([]),[pe,L]=a.useState(!1),[ge,R]=a.useState(!1),[we,q]=a.useState(y!=="system"?y:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),K=a.useRef(null),fe=l.join("+").replace(/Key/g,"").replace(/Digit/g,""),c=a.useRef(null),S=a.useRef(!1),Ge=a.useCallback(w=>{ae(h=>{var E;return(E=h.find(C=>C.id===w.id))!=null&&E.delete||G.dismiss(w.id),h.filter(({id:C})=>C!==w.id)})},[]);return a.useEffect(()=>G.subscribe(w=>{if(w.dismiss){ae(h=>h.map(E=>E.id===w.id?{...E,delete:!0}:E));return}setTimeout(()=>{Ie.flushSync(()=>{ae(h=>{let E=h.findIndex(C=>C.id===w.id);return E!==-1?[...h.slice(0,E),{...h[E],...w},...h.slice(E+1)]:[w,...h]})})})}),[]),a.useEffect(()=>{if(y!=="system"){q(y);return}if(y==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?q("dark"):q("light")),typeof window>"u")return;let w=window.matchMedia("(prefers-color-scheme: dark)");try{w.addEventListener("change",({matches:h})=>{q(h?"dark":"light")})}catch{w.addListener(({matches:E})=>{try{q(E?"dark":"light")}catch(C){console.error(C)}})}},[y]),a.useEffect(()=>{B.length<=1&&L(!1)},[B]),a.useEffect(()=>{let w=h=>{var E,C;l.every(ee=>h[ee]||h.code===ee)&&(L(!0),(E=K.current)==null||E.focus()),h.code==="Escape"&&(document.activeElement===K.current||(C=K.current)!=null&&C.contains(document.activeElement))&&L(!1)};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[l]),a.useEffect(()=>{if(K.current)return()=>{c.current&&(c.current.focus({preventScroll:!0}),c.current=null,S.current=!1)}},[K.current]),a.createElement("section",{ref:n,"aria-label":`${Z} ${fe}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},ue.map((w,h)=>{var E;let[C,ee]=w.split("-");return B.length?a.createElement("ol",{key:w,dir:M==="auto"?Ke():M,tabIndex:-1,ref:K,className:u,"data-sonner-toaster":!0,"data-theme":we,"data-y-position":C,"data-lifted":pe&&B.length>1&&!g,"data-x-position":ee,style:{"--front-toast-height":`${((E=me[0])==null?void 0:E.height)||0}px`,"--width":`${Bt}px`,"--gap":`${z}px`,...o,...Dt(d,m)},onBlur:x=>{S.current&&!x.currentTarget.contains(x.relatedTarget)&&(S.current=!1,c.current&&(c.current.focus({preventScroll:!0}),c.current=null))},onFocus:x=>{x.target instanceof HTMLElement&&x.target.dataset.dismissible==="false"||S.current||(S.current=!0,c.current=x.relatedTarget)},onMouseEnter:()=>L(!0),onMouseMove:()=>L(!0),onMouseLeave:()=>{ge||L(!1)},onDragEnd:()=>L(!1),onPointerDown:x=>{x.target instanceof HTMLElement&&x.target.dataset.dismissible==="false"||R(!0)},onPointerUp:()=>R(!1)},B.filter(x=>!x.position&&h===0||x.position===w).map((x,Ce)=>{var se,he;return a.createElement(It,{key:x.id,icons:I,index:Ce,toast:x,defaultRichColors:H,duration:(se=_==null?void 0:_.duration)!=null?se:ne,className:_==null?void 0:_.className,descriptionClassName:_==null?void 0:_.descriptionClassName,invert:r,visibleToasts:V,closeButton:(he=_==null?void 0:_.closeButton)!=null?he:f,interacting:ge,position:w,style:_==null?void 0:_.style,unstyled:_==null?void 0:_.unstyled,classNames:_==null?void 0:_.classNames,cancelButtonStyle:_==null?void 0:_.cancelButtonStyle,actionButtonStyle:_==null?void 0:_.actionButtonStyle,removeToast:Ge,toasts:B.filter(le=>le.position==x.position),heights:me.filter(le=>le.position==x.position),setHeights:ke,expandByDefault:g,gap:z,loadingIcon:O,expanded:pe,pauseWhenPageIsHidden:W,swipeDirections:t.swipeDirections})})):null}))}),jt=je({defaultClassName:"pkg_sps-woodland_growler__version_8_26_2__hash_l2jae50",variantClassNames:{kind:{activity:"pkg_sps-woodland_growler__version_8_26_2__hash_l2jae51",info:"pkg_sps-woodland_growler__version_8_26_2__hash_l2jae52",progress:"pkg_sps-woodland_growler__version_8_26_2__hash_l2jae53",error:"pkg_sps-woodland_growler__version_8_26_2__hash_l2jae54",success:"pkg_sps-woodland_growler__version_8_26_2__hash_l2jae55",warning:"pkg_sps-woodland_growler__version_8_26_2__hash_l2jae56"}},defaultVariants:{},compoundVariants:[]}),At="pkg_sps-woodland_growler__version_8_26_2__hash_l2jae57",Ot="pkg_sps-woodland_growler__version_8_26_2__hash_l2jae5e",Lt="pkg_sps-woodland_growler__version_8_26_2__hash_l2jae59",Kt="pkg_sps-woodland_growler__version_8_26_2__hash_l2jae58",Ft="pkg_sps-woodland_growler__version_8_26_2__hash_l2jae5a",zt="pkg_sps-woodland_growler__version_8_26_2__hash_l2jae5b",Yt="pkg_sps-woodland_growler__version_8_26_2__hash_l2jae5c";function xe(){return e.createElement(Pt,{visibleToasts:10,expand:!0,closeButton:!0,position:"top-right",className:At,duration:de.Tokens.component.growler.duration.visible,richColors:!0,toastOptions:{style:{outline:"none"}}})}A.Metadata.set(xe,{name:"GrowlerEmitter"});function $t({children:t,kind:n="info",onCloseButtonClick:r,title:s}){const{t:l}=e.useContext(A.I18nContext);return e.createElement("div",{className:jt({kind:n})},e.createElement("div",{className:Kt},n==="progress"?e.createElement(A.Spinner,null):e.createElement(A.Icon,{icon:be[n],className:Lt})),e.createElement("div",{className:Ft},e.createElement("div",{className:zt},s?e.createElement("span",{className:Yt},s):void 0,e.createElement("div",null,t)),e.createElement(Ne.Button,{kind:"icon",icon:"x",title:l("design-system:growler.dismiss"),className:Ot,onClick:r})))}const Q=t=>(n,r)=>Ee.custom(s=>e.createElement($t,{title:n,kind:t,onCloseButtonClick:()=>{var l;Ee.dismiss(s),(l=r==null?void 0:r.onDismiss)==null||l.call(r,s)}},typeof(r==null?void 0:r.description)=="function"?r.description(s):r==null?void 0:r.description),{...r!=null&&r.id?{id:r.id}:{},duration:(r==null?void 0:r.autoClose)??!0?de.Tokens.component.growler.duration.visible:1/0,onDismiss:s=>{var l;(l=r==null?void 0:r.onDismiss)==null||l.call(r,s.id)},onAutoClose:s=>{var l;(l=r==null?void 0:r.onAutoClose)==null||l.call(r,s.id)}}),F=(t,{kind:n,...r})=>Q(n)(t,r);F.success=Q("success"),F.error=Q("error"),F.info=Q("info"),F.warning=Q("warning"),F.progress=Q("progress"),F.dismiss=Ee.dismiss;const Ut={Growlers:{description:()=>e.createElement("p",null,"Use Growlers for dynamic messages in response to a user's action. All Growlers have a Primary Message, and may optionally have a Secondary Message as needed. Growlers may also contain Hyperlinks in the Secondary Message."),components:[xe,F,ye,Oe],examples:{general:{label:"General Usage",description:()=>e.createElement(e.Fragment,null,e.createElement("p",null,"Use the following guidelines to write an effective Growler message."),e.createElement("ul",null,e.createElement("li",null,"Write all messages in sentence case.",e.createElement("ul",null,e.createElement("li",null,"Capitalize the first word of the message."),e.createElement("li",null,"Add punctuation, such as a period, at the end of the message."))),e.createElement("li",null,"Keep messages as succinct as possible while also providing sufficient information to the customer."),e.createElement("li",null,"If you can clearly convey your message in a single statement, use only the Primary Message."),e.createElement("li",null,"If the message requires additional details, such as further information or instructions, use both the Primary and Secondary Messages.")),e.createElement("p",null,"For more examples of effective feedback message writing, refer to"," ",e.createElement("a",{href:"https://atlassian.design/content/messaging-guidelines",target:"_blank"},"Atlassian's Messaging Guidelines"),"."))},emitter:{label:"Growler Emitter",description:()=>e.createElement(e.Fragment,null,e.createElement("p",null,e.createElement("code",null,"GrowlerEmitter")," is a component that displays growlers. It should be placed in the root of your application. It is not a provider and does not take any props."))},growlerKinds:{label:"Growler Kinds",description:()=>e.createElement(e.Fragment,null,e.createElement("p",null,"Growlers come in five different kinds: ",e.createElement("code",null,"success"),", ",e.createElement("code",null,"error"),","," ",e.createElement("code",null,"info"),", ",e.createElement("code",null,"warning"),", and ",e.createElement("code",null,"progress"),". Each kind has a unique icon and color scheme.")),examples:{success:{description:"Success",react:b.code`
|
|
3
3
|
import { growl } from "@sps-woodland/growler";
|
|
4
4
|
import { Button } from "@sps-woodland/buttons";
|
|
5
5
|
|
package/lib/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@keyframes pkg_sps-
|
|
1
|
+
@keyframes pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnk0{0%{opacity:1}to{opacity:0}}.pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnk1{border-radius:.25rem;box-shadow:0 0 .3125rem #00000040;display:flex;margin-bottom:1rem;overflow:hidden;width:25rem}.pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnk2{background:#e9e9ea;border:.0625rem oklch(56.48% .008 219.62) solid}.pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnk3{background:#027db8;border:.0625rem oklch(56.21% .128 239.83) solid}.pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnk4{background:#91467f;border:.0625rem oklch(50.83% .125 337.21) solid}.pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnk5{background:#de012e;border:.0625rem oklch(56.83% .229 22.94) solid}.pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnk6{background:#0b8940;border:.0625rem oklch(55.21% .148 150.27) solid}.pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnk7{background:#e77609;border:.0625rem oklch(68.35% .17 53.59) solid}.pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnk8{animation-name:pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnk0;animation-duration:2s}.pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnk9{opacity:1}.pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnka{display:flex;flex-direction:column;position:fixed;right:1.875rem;top:5.625rem;width:25rem}.pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnkb{align-items:center;display:flex;flex-grow:0;flex-shrink:0;flex-basis:4.375rem;justify-content:center}.pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnkc{color:#fff;font-size:1.875rem}.pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnkd{background-color:#fff;padding:1rem 2.625rem 1rem 1rem;position:relative;display:flex;flex-grow:1}.pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnke{flex-grow:1;font-size:.75rem;line-height:1.25rem}.pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnkf{font-weight:600}.pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnkg{color:#4b5356;overflow-wrap:break-word;width:16.5rem}.pkg_sps-woodland_growler__version_8_26_2__hash_1c5fbnkh{position:absolute;right:.5rem;top:.5rem}.pkg_sps-woodland_growler__version_8_26_2__hash_l2jae50{border-radius:.25rem;box-shadow:0 0 .3125rem #00000040;display:flex;overflow:hidden;width:25rem;outline:none}.pkg_sps-woodland_growler__version_8_26_2__hash_l2jae50:focus{outline:none}.pkg_sps-woodland_growler__version_8_26_2__hash_l2jae51{background:#e9e9ea;border:.0625rem oklch(56.48% .008 219.62) solid}.pkg_sps-woodland_growler__version_8_26_2__hash_l2jae52{background:#027db8;border:.0625rem oklch(56.21% .128 239.83) solid}.pkg_sps-woodland_growler__version_8_26_2__hash_l2jae53{background:#91467f;border:.0625rem oklch(50.83% .125 337.21) solid}.pkg_sps-woodland_growler__version_8_26_2__hash_l2jae54{background:#de012e;border:.0625rem oklch(56.83% .229 22.94) solid}.pkg_sps-woodland_growler__version_8_26_2__hash_l2jae55{background:#0b8940;border:.0625rem oklch(55.21% .148 150.27) solid}.pkg_sps-woodland_growler__version_8_26_2__hash_l2jae56{background:#e77609;border:.0625rem oklch(68.35% .17 53.59) solid}.pkg_sps-woodland_growler__version_8_26_2__hash_l2jae57{right:1.875rem;top:5.625rem;width:25rem}.pkg_sps-woodland_growler__version_8_26_2__hash_l2jae58{align-items:center;display:flex;flex-grow:0;flex-shrink:0;flex-basis:4.375rem;justify-content:center}.pkg_sps-woodland_growler__version_8_26_2__hash_l2jae59{color:#fff;font-size:1.875rem}.pkg_sps-woodland_growler__version_8_26_2__hash_l2jae5a{background-color:#fff;padding:1rem 2.625rem 1rem 1rem;position:relative;display:flex;flex-grow:1}.pkg_sps-woodland_growler__version_8_26_2__hash_l2jae5b{flex-grow:1;font-size:.75rem;line-height:1.25rem}.pkg_sps-woodland_growler__version_8_26_2__hash_l2jae5c{font-weight:600}.pkg_sps-woodland_growler__version_8_26_2__hash_l2jae5d{color:#4b5356;overflow-wrap:break-word;width:16.5rem}.pkg_sps-woodland_growler__version_8_26_2__hash_l2jae5e{position:absolute;right:.5rem;top:.5rem}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sps-woodland/growler",
|
|
3
3
|
"description": "SPS Woodland Design System growler component and hook",
|
|
4
|
-
"version": "8.26.
|
|
4
|
+
"version": "8.26.2",
|
|
5
5
|
"author": "SPS Commerce",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"repository": "https://github.com/SPSCommerce/woodland/tree/main/packages/@sps-woodland/growler",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"@spscommerce/utils": "^7.0.0",
|
|
35
35
|
"react": "^16.9.0",
|
|
36
36
|
"react-dom": "^16.9.0",
|
|
37
|
-
"@sps-woodland/buttons": "8.26.
|
|
38
|
-
"@sps-woodland/core": "8.26.
|
|
39
|
-
"@sps-woodland/tokens": "8.26.
|
|
37
|
+
"@sps-woodland/buttons": "8.26.2",
|
|
38
|
+
"@sps-woodland/core": "8.26.2",
|
|
39
|
+
"@sps-woodland/tokens": "8.26.2"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@spscommerce/utils": "^7.0.0",
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
"@vanilla-extract/recipes": "^0.2.5",
|
|
45
45
|
"react": "^16.9.0",
|
|
46
46
|
"react-dom": "^16.9.0",
|
|
47
|
-
"@sps-woodland/buttons": "8.26.
|
|
48
|
-
"@sps-woodland/core": "8.26.
|
|
49
|
-
"@sps-woodland/tokens": "8.26.
|
|
47
|
+
"@sps-woodland/buttons": "8.26.2",
|
|
48
|
+
"@sps-woodland/core": "8.26.2",
|
|
49
|
+
"@sps-woodland/tokens": "8.26.2"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
52
|
"build": "pnpm run build:js && pnpm run build:types",
|