@ecopages/radiant-ui 0.2.4 → 0.2.5
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/dist/components/ui/calendar/calendar.d.ts +3 -1
- package/dist/components/ui/calendar/index.js +1 -1
- package/dist/components/ui/calendar/index.js.map +3 -3
- package/dist/components/ui/date-field/date-field.d.ts +3 -2
- package/dist/components/ui/date-field/index.js +1 -1
- package/dist/components/ui/date-field/index.js.map +3 -3
- package/dist/components/ui/date-input/date-input.d.ts +3 -2
- package/dist/components/ui/date-input/index.js +1 -1
- package/dist/components/ui/date-input/index.js.map +3 -3
- package/dist/components/ui/date-range-picker/date-range-picker.d.ts +4 -3
- package/dist/components/ui/date-range-picker/index.js +1 -1
- package/dist/components/ui/date-range-picker/index.js.map +3 -3
- package/dist/components/ui/meter/meter.d.ts +4 -2
- package/dist/components/ui/separator/separator.d.ts +2 -1
- package/dist/components/ui/toast/index.js +1 -1
- package/dist/components/ui/toast/index.js.map +3 -3
- package/dist/components/ui/toast/toast.d.ts +6 -3
- package/dist/components/ui/toc/toc.d.ts +3 -1
- package/dist/components/ui/tooltip/index.js +1 -1
- package/dist/components/ui/tooltip/index.js.map +3 -3
- package/dist/components/ui/tooltip/tooltip.script.d.ts +7 -14
- package/dist/index.js +1 -1
- package/dist/index.js.map +3 -3
- package/dist/lib/without-children.d.ts +10 -0
- package/package.json +11 -11
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { JsxCustomElementAttributes } from '@ecopages/jsx';
|
|
2
2
|
import type { RuiMeter as RuiMeterElement, RuiMeterProps } from './meter.script';
|
|
3
3
|
import './meter.script';
|
|
4
|
+
import type { WithoutChildren } from '../../../lib/without-children';
|
|
4
5
|
/**
|
|
5
6
|
* JSX helper around `<rui-meter>`. Styling classes live on the element's
|
|
6
|
-
* composed surface (`@cssclass` on `RuiMeterElement`).
|
|
7
|
+
* composed surface (`@cssclass` on `RuiMeterElement`). The element renders that
|
|
8
|
+
* surface, so the view takes no children.
|
|
7
9
|
*/
|
|
8
|
-
export declare function RuiMeter(props: JsxCustomElementAttributes<RuiMeterElement, RuiMeterProps
|
|
10
|
+
export declare function RuiMeter(props: WithoutChildren<JsxCustomElementAttributes<RuiMeterElement, RuiMeterProps>>): import("@ecopages/jsx").JsxRenderable;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { JsxElementProps } from '@ecopages/jsx';
|
|
2
|
+
import type { WithoutChildren } from '../../../lib/without-children';
|
|
2
3
|
export type RuiSeparatorOrientation = 'horizontal' | 'vertical';
|
|
3
|
-
export type RuiSeparatorProps =
|
|
4
|
+
export type RuiSeparatorProps = WithoutChildren<JsxElementProps<HTMLHRElement>> & {
|
|
4
5
|
/** Visual and semantic direction. Default: `horizontal`. */
|
|
5
6
|
orientation?: RuiSeparatorOrientation;
|
|
6
7
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as F,jsxs as oe}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as re,bindTo as It,bound as Et,customElement as Ge,onEvent as ae,onUpdated as Ot,prop as L,query as Je}from"@ecopages/radiant";function pt(...i){return i.filter(Boolean).join(" ")}import{jsx as Rt}from"@ecopages/jsx/jsx-runtime";function gt({class:i,size:t="sm",...e}){return Rt("svg",{...e,class:pt("rui-icon",t==="md"&&"rui-icon--md",i),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",children:Rt("path",{d:"m5 12 4 4L19 6"})})}import{jsx as Lt,jsxs as He}from"@ecopages/jsx/jsx-runtime";function ft({class:i,size:t="sm",...e}){return He("svg",{...e,class:pt("rui-icon",t==="md"&&"rui-icon--md",i),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",children:[Lt("path",{d:"m18 6-12 12"}),Lt("path",{d:"m6 6 12 12"})]})}var at="rui-toast-show",lt="rui-toast-dismiss",Ne=["top-start","top-center","top-end","bottom-start","bottom-center","bottom-end"],ut=4e3,$e=356,bt=14,Tt=24,_t=3,St=3,ct=45,xt=200,dt="bottom-end";function j(i){let[t,e]=i.split("-");return{y:t,x:e}}var We=1;function qe(){return We++}function kt(i,t){return typeof i=="function"?i(t):i}var wt=class{subscribers=[];toasts=[];subscribe=t=>(this.subscribers.push(t),t(this.toasts),()=>{let e=this.subscribers.indexOf(t);e>=0&&this.subscribers.splice(e,1)});getSnapshot=()=>this.toasts;publish(){let t=this.toasts;for(let e of this.subscribers)e(t)}create=(t,e={})=>{let s=e.id??qe(),a=e.dismissible??!0,d=this.toasts.findIndex(o=>o.id===s),p={id:s,title:t,description:e.description,variant:e.variant??"default",duration:e.duration,action:e.action,dismissible:a,closeButton:e.closeButton,position:e.position,delete:!1};return d>=0?this.toasts=this.toasts.map(o=>o.id===s?{...o,...p,delete:!1}:o):this.toasts=[p,...this.toasts],this.publish(),s};dismiss=t=>{if(t==null){if(this.toasts.length===0)return;this.toasts=this.toasts.map(e=>({...e,delete:!0}))}else{let e=this.toasts.find(s=>s.id===t);if(!e||e.delete)return;this.toasts=this.toasts.map(s=>s.id===t?{...s,delete:!0}:s)}this.publish()};remove=t=>{this.toasts=this.toasts.filter(e=>e.id!==t),this.publish()};clear=()=>{this.toasts.length!==0&&(this.toasts=[],this.publish())};message=(t,e)=>this.create(t,e);success=(t,e)=>this.create(t,{...e,variant:"success"});error=(t,e)=>this.create(t,{...e,variant:"error"});info=(t,e)=>this.create(t,{...e,variant:"info"});warning=(t,e)=>this.create(t,{...e,variant:"warning"});loading=(t,e)=>this.create(t,{...e,variant:"loading",duration:e?.duration??Number.POSITIVE_INFINITY});promise=(t,e)=>{let s=this.loading(e.loading,{duration:Number.POSITIVE_INFINITY,action:e.action,closeButton:e.closeButton,position:e.position,description:typeof e.description=="string"?e.description:void 0});return(typeof t=="function"?t():t).then(d=>{let p=typeof e.description=="function"?e.description(d):e.description;this.create(kt(e.success,d),{id:s,variant:"success",description:p,duration:e.duration,action:e.action,closeButton:e.closeButton,position:e.position})}).catch(d=>{let p=typeof e.description=="function"?e.description(d):e.description;this.create(kt(e.error,d),{id:s,variant:"error",description:p,duration:e.duration,action:e.action,closeButton:e.closeButton,position:e.position})}),s}},T=new wt;var Ct,Mt,Vt,Bt,Ut,jt,Ft,Ht,Nt,$t,Wt,qt,Yt,Xt,zt,Kt,Gt,Jt,Qt,Zt,te,ee,ie,se;function Ye(i,t,e,s,a,d){var p,o,I,k,f,u,E,H=Symbol.metadata||Symbol.for("Symbol.metadata"),N=Object.defineProperty,R=Object.create,W=[R(null),R(null)],G=t.length;function C(n,g,y){return function(r,l){g&&(l=r,r=i);for(var b=0;b<n.length;b++)l=n[b].apply(r,y?[l]:[]);return y?l:r}}function x(n,g,y,r){if(typeof n!="function"&&(r||n!==void 0))throw new TypeError(g+" must "+(y||"be")+" a function"+(r?"":" or undefined"));return n}function J(n,g,y,r,l,b,O,v,_,S,Z){function q(h){if(!Z(h))throw new TypeError("Attempted to access private element on non-instance")}var Y=[].concat(g[0]),tt=g[3],X=!O,A=l===1,et=l===3,it=l===4,M=l===2;function V(h,P,ot){return function(U,rt){return P&&(rt=U,U=n),ot&&ot(U),c[h].call(U,rt)}}if(!X){var c={},z=[],w=et?"get":it||A?"set":"value";if(_?(S||A?c={get:ne(function(){return tt(this)},r,"get"),set:function(h){g[4](this,h)}}:c[w]=tt,S||ne(c[w],r,M?"":w)):S||(c=Object.getOwnPropertyDescriptor(n,r)),!S&&!_){if((o=W[+v][r])&&(o^l)!==7)throw Error("Decorating two elements with the same name ("+c[w].name+") is not supported yet");W[+v][r]=l<3?1:l}}for(var m=n,B=Y.length-1;B>=0;B-=y?2:1){var st=x(Y[B],"A decorator","be",!0),nt=y?Y[B-1]:void 0,K={},D={kind:["field","accessor","method","getter","setter","class"][l],name:r,metadata:p,addInitializer:function(h,P){if(h.v)throw new TypeError("attempted to call addInitializer after decoration was finished");x(P,"An initializer","be",!0),b.push(P)}.bind(null,K)};if(X)o=st.call(nt,m,D),K.v=1,x(o,"class decorators","return")&&(m=o);else if(D.static=v,D.private=_,o=D.access={has:_?Z.bind():function(h){return r in h}},it||(o.get=_?M?function(h){return q(h),c.value}:V("get",0,q):function(h){return h[r]}),M||et||(o.set=_?V("set",0,q):function(h,P){h[r]=P}),m=st.call(nt,A?{get:c.get,set:c.set}:c[w],D),K.v=1,A){if(typeof m=="object"&&m)(o=x(m.get,"accessor.get"))&&(c.get=o),(o=x(m.set,"accessor.set"))&&(c.set=o),(o=x(m.init,"accessor.init"))&&z.unshift(o);else if(m!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else x(m,(S?"field":"method")+" decorators","return")&&(S?z.unshift(m):c[w]=m)}return l<2&&O.push(C(z,v,1),C(b,v,0)),S||X||(_?A?O.splice(-1,0,V("get",v),V("set",v)):O.push(M?c[w]:x.call.bind(c[w])):N(n,r,c)),m}function Q(n){return N(n,H,{configurable:!0,enumerable:!0,value:p})}return d!==void 0&&(p=d[H]),p=R(p??null),f=[],u=function(n){n&&f.push(C(n))},E=function(n,g){for(var y=0;y<e.length;y++){var r=e[y],l=r[1],b=7&l;if((8&l)==n&&!b==g){var O=r[2],v=!!r[3],_=16&l;J(n?i:i.prototype,r,_,v?"#"+O:Xe(O),b,b<2?[]:n?k=k||[]:I=I||[],f,!!n,v,g,n&&v?function(S){return Ke(S)===i}:a)}}},E(8,0),E(0,0),E(8,1),E(0,1),u(I),u(k),o=f,G||Q(i),{e:o,get c(){var n=[];return G&&[Q(i=J(i,[t],s,i.name,5,n)),C(n,1)]}}}function Xe(i){var t=ze(i,"string");return typeof t=="symbol"?t:t+""}function ze(i,t){if(typeof i!="object"||!i)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var s=e.call(i,t||"default");if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}function ne(i,t,e){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(i,"name",{configurable:!0,value:e?e+" "+t:t})}catch{}return i}function Ke(i){if(Object(i)!==i)throw TypeError("right-hand side of 'in' should be an object, got "+(i!==null?typeof i:"null"));return i}var ht=new Map,yt=new Map;function Pt(i){return String(i)}function mt(i){if(i==="")return;let t=Pt(i);ht.delete(t),yt.delete(t)}function Qe(i){if(i==="")return;let t=Pt(i),e=ht.get(t);e!=null&&(yt.set(t,Math.max(0,e-Date.now())),ht.delete(t))}var ue,le=class extends re{static{({e:[Vt,Bt,Ut,jt,Ft,Ht,Nt,$t,Wt,qt,Yt,Xt,zt,Kt,Gt,Jt,Qt,Zt,te,ee,ie,se,Ct],c:[ue,Mt]}=Ye(this,[Ge("rui-toast")],[[L({type:String,reflect:!0,defaultValue:""}),0,"toastId"],[L({type:String,defaultValue:""}),0,"title"],[L({type:String,defaultValue:""}),0,"description"],[[L({type:String,reflect:!0,defaultValue:"default"}),It({attr:"data-variant",map:t=>t??"default"})],0,"variant"],[L({type:Number,defaultValue:4e3}),0,"duration"],[[L({type:Boolean,defaultValue:!0}),It({attr:"data-dismissible"})],0,"dismissible"],[L({type:Boolean,defaultValue:!1}),0,"closeButton"],[L({type:String,defaultValue:""}),0,"actionLabel"],[[L({type:String,defaultValue:dt}),It([{attr:"data-y-position",map:t=>j(t).y},{attr:"data-x-position",map:t=>j(t).x}])],0,"position"],[L({type:Boolean,defaultValue:!1}),0,"markedDelete"],[Je({ref:"toast"}),0,"toastTarget"],[Ot("position"),2,"onPositionUpdated"],[Ot("duration"),2,"onDurationUpdated"],[Ot("markedDelete"),2,"onMarkedDeleteUpdated"],[Et,2,"onPointerDown"],[Et,2,"onPointerMove"],[Et,2,"onPointerUp"],[ae({selector:"[data-toast-close]",type:"click"}),2,"onCloseClick"],[ae({selector:"[data-toast-action]",type:"click"}),2,"onActionClick"]],0,void 0,re))}toastId=(Ct(this),Vt(this));title=(Bt(this),Ut(this));description=(jt(this),Ft(this));variant=(Ht(this),Nt(this));duration=($t(this),Wt(this));dismissible=(qt(this),Yt(this));closeButton=(Xt(this),zt(this));actionLabel=(Kt(this),Gt(this));position=(Jt(this),Qt(this));markedDelete=(Zt(this),te(this));toastTarget=(ee(this),ie(this));mounted=(se(this),!1);removed=!1;swiping=!1;swipeOut=!1;swipeAxis=null;swipeOutDirection=null;held=!1;timerReady=!1;timeoutId=null;pointerStart=null;dragStartTime=null;exitTimer=null;connectedCallback(){super.connectedCallback();let t=this.mounted;if(this.addEventListener("pointerdown",this.onPointerDown),this.addEventListener("pointermove",this.onPointerMove),this.addEventListener("pointerup",this.onPointerUp),this.addEventListener("pointercancel",this.onPointerUp),t){this.timerReady=!0,this.syncDomState(),this.dispatchEvent(new CustomEvent("rui-toast-mounted",{bubbles:!0})),!this.held&&!this.removed&&this.startTimer();return}this.timerReady=!1,requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.isConnected&&(this.mounted=!0,this.timerReady=!0,this.syncDomState(),this.dispatchEvent(new CustomEvent("rui-toast-mounted",{bubbles:!0})),!this.held&&!this.removed&&this.startTimer())})}),this.syncDomState()}disconnectedCallback(){this.clearTimer(),this.exitTimer&&(clearTimeout(this.exitTimer),this.exitTimer=null);let t=this.resolvedId;t!==""&&this.removed&&T.remove(t),this.held=!1,this.timerReady=!1,this.removeEventListener("pointerdown",this.onPointerDown),this.removeEventListener("pointermove",this.onPointerMove),this.removeEventListener("pointerup",this.onPointerUp),this.removeEventListener("pointercancel",this.onPointerUp),super.disconnectedCallback()}onPositionUpdated(){this.syncDomState()}setPaused(t){if(this.held===t){!t&&this.timerReady&&this.mounted&&!this.removed&&!this.timeoutId&&this.startTimer();return}this.held=t,!(!this.timerReady||!this.mounted||this.removed)&&(t||document.hidden?(Qe(this.resolvedId),this.clearTimer()):this.startTimer())}onDurationUpdated(){!this.timerReady||!this.mounted||this.removed||this.held||(mt(this.resolvedId),this.startTimer())}onMarkedDeleteUpdated(){this.markedDelete&&!this.removed&&this.beginRemove()}get resolvedId(){let t=this.toastId;if(t==null||t==="")return"";let e=Number(t);return Number.isFinite(e)&&String(e)===t?e:t}clearTimer(){this.timeoutId&&clearTimeout(this.timeoutId),this.timeoutId=null}startTimer(){if(this.held||this.removed||document.hidden||this.duration===Number.POSITIVE_INFINITY||this.variant==="loading")return;if(this.duration<=0){this.beginRemove();return}let t=this.resolvedId,e=Pt(t),s=Date.now(),a=yt.get(e);if(yt.delete(e),a==null){let d=ht.get(e);a=d!=null?d-s:this.duration}if(a<=0){mt(t),this.beginRemove();return}ht.set(e,s+a),this.clearTimer(),this.timeoutId=setTimeout(()=>{mt(t),this.beginRemove()},a)}beginRemove(){this.removed||(this.removed=!0,this.clearTimer(),mt(this.resolvedId),this.syncDomState(),this.markedDelete||T.dismiss(this.resolvedId),this.exitTimer=setTimeout(()=>{this.exitTimer=null,T.remove(this.resolvedId)},200))}onPointerDown(t){!this.dismissible||this.variant==="loading"||t.button!==0||t.target?.closest("[data-toast-close], [data-toast-action], button, a")||(this.dragStartTime=Date.now(),this.pointerStart={x:t.clientX,y:t.clientY},this.swipeAxis=null,this.setPointerCapture(t.pointerId))}onPointerMove(t){if(!this.pointerStart)return;let e={x:t.clientX-this.pointerStart.x,y:t.clientY-this.pointerStart.y};if(!this.startSwipe(e))return;this.swipeAxis??=Math.abs(e.x)>Math.abs(e.y)?"x":"y";let s=this.swipeAxis==="x"?{x:e.x,y:0}:{x:0,y:e.y};this.isSwipeReversing(s)?this.resetSwipeTranslation():this.setSwipeTranslation(s)}startSwipe(t){return this.swiping?!0:Math.abs(t.x)<8&&Math.abs(t.y)<8?!1:(this.swiping=!0,this.syncDomState(),!0)}isSwipeReversing(t){let{x:e,y:s}=j(this.position);return this.swipeAxis==="y"?(s==="bottom"?t.y<0:t.y>0)&&Math.abs(t.y)<45:e!=="center"&&(e==="start"?t.x>0:t.x<0)&&Math.abs(t.x)<45}setSwipeTranslation(t){this.style.setProperty("--rui-toast-swipe-x",`${t.x}px`),this.style.setProperty("--rui-toast-swipe-y",`${t.y}px`)}resetSwipeTranslation(){this.setSwipeTranslation({x:0,y:0})}onPointerUp(t){if(!this.pointerStart)return;this.releaseToastPointer(t.pointerId);let e=this.readSwipe();this.swiping=!1,e&&this.dismissible&&this.shouldDismissSwipe(e)?this.dismissFromSwipe(e):this.cancelSwipe(),this.clearPointerState()}releaseToastPointer(t){try{this.releasePointerCapture(t)}catch{}}readSwipe(){if(this.swiping)return{x:Number.parseFloat(this.style.getPropertyValue("--rui-toast-swipe-x")||"0"),y:Number.parseFloat(this.style.getPropertyValue("--rui-toast-swipe-y")||"0")}}shouldDismissSwipe(t){let e=this.swipeAxis==="x"?t.x:t.y,s=this.dragStartTime?Date.now()-this.dragStartTime:0;return Math.abs(e)>=45||Math.abs(e)/Math.max(s,1)>.11}dismissFromSwipe(t){let{x:e,y:s}=j(this.position);this.swipeOutDirection=this.swipeAxis==="y"?s==="bottom"?"down":"up":e==="start"?"left":e==="end"?"right":t.x<0?"left":"right",this.swipeOut=!0,this.syncDomState(),this.beginRemove()}cancelSwipe(){this.resetSwipeTranslation(),this.swipeAxis=null,this.syncDomState()}clearPointerState(){this.pointerStart=null,this.dragStartTime=null}onCloseClick(t){t.stopPropagation(),this.dismissible&&this.beginRemove()}onActionClick(t){t.stopPropagation(),T.getSnapshot().find(s=>s.id===this.resolvedId)?.action?.onClick(t),this.dismissible&&this.beginRemove()}syncDomState(){this.setAttribute("role","listitem"),this.dataset.mounted=String(this.mounted),this.dataset.removed=String(this.removed),this.dataset.swiping=String(this.swiping),this.dataset.swipeOut=String(this.swipeOut),this.swipeOutDirection?this.dataset.swipeDirection=this.swipeOutDirection:delete this.dataset.swipeDirection}iconForVariant(){switch(this.variant){case"success":return F(gt,{});case"error":return F(ft,{});case"warning":return"!";case"info":return"i";default:return""}}render(){let t=this.variant??"default",e=this.iconForVariant(),s=t!=="default";return oe("div",{ref:"toast",class:`rui-toast rui-toast--${t}`,role:"status","aria-live":"off","data-ref":"toast",children:[this.closeButton&&t!=="loading"?F("button",{type:"button",class:"rui-toast__close","data-toast-close":!0,"aria-label":"Close toast",children:F(ft,{})}):null,s?F("span",{class:"rui-toast__icon","data-icon":!0,"aria-hidden":"true",children:t==="loading"?F("span",{class:"rui-toast__loader"}):e}):null,oe("div",{class:"rui-toast__content",children:[F("div",{class:"rui-toast__title","data-title":!0,children:this.$.title}),this.description?F("div",{class:"rui-toast__description","data-description":!0,children:this.$.description}):null]}),this.actionLabel?F("button",{type:"button",class:"rui-toast__action rui-button rui-button--outline rui-button--sm","data-toast-action":!0,children:this.$.actionLabel}):null]})}static{Mt()}};import{jsx as At}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as Ve,bindTo as si,bound as vt,customElement as ni,onEvent as Dt,onUpdated as oi,prop as $,query as ri,state as ai}from"@ecopages/radiant";function ce(i,t,e){let s=0;for(let a=0;a<i;a+=1)s+=t[a]??0;return s+i*e}function de(i,t){return i.length===0?0:i.reduce((s,a)=>s+a,0)+Math.max(0,i.length-1)*t}function he(i,t,e){return t<=0?0:i+Math.max(0,t-1)*e}var pe,fe,me,ye,ve,ge,be,Te,_e,Se,xe,we,Ie,Ee,Oe,Pe,Ae,De,Re,Le,ke,Ce;function Ze(i,t,e,s,a,d){var p,o,I,k,f,u,E,H=Symbol.metadata||Symbol.for("Symbol.metadata"),N=Object.defineProperty,R=Object.create,W=[R(null),R(null)],G=t.length;function C(n,g,y){return function(r,l){g&&(l=r,r=i);for(var b=0;b<n.length;b++)l=n[b].apply(r,y?[l]:[]);return y?l:r}}function x(n,g,y,r){if(typeof n!="function"&&(r||n!==void 0))throw new TypeError(g+" must "+(y||"be")+" a function"+(r?"":" or undefined"));return n}function J(n,g,y,r,l,b,O,v,_,S,Z){function q(h){if(!Z(h))throw new TypeError("Attempted to access private element on non-instance")}var Y=[].concat(g[0]),tt=g[3],X=!O,A=l===1,et=l===3,it=l===4,M=l===2;function V(h,P,ot){return function(U,rt){return P&&(rt=U,U=n),ot&&ot(U),c[h].call(U,rt)}}if(!X){var c={},z=[],w=et?"get":it||A?"set":"value";if(_?(S||A?c={get:Me(function(){return tt(this)},r,"get"),set:function(h){g[4](this,h)}}:c[w]=tt,S||Me(c[w],r,M?"":w)):S||(c=Object.getOwnPropertyDescriptor(n,r)),!S&&!_){if((o=W[+v][r])&&(o^l)!==7)throw Error("Decorating two elements with the same name ("+c[w].name+") is not supported yet");W[+v][r]=l<3?1:l}}for(var m=n,B=Y.length-1;B>=0;B-=y?2:1){var st=x(Y[B],"A decorator","be",!0),nt=y?Y[B-1]:void 0,K={},D={kind:["field","accessor","method","getter","setter","class"][l],name:r,metadata:p,addInitializer:function(h,P){if(h.v)throw new TypeError("attempted to call addInitializer after decoration was finished");x(P,"An initializer","be",!0),b.push(P)}.bind(null,K)};if(X)o=st.call(nt,m,D),K.v=1,x(o,"class decorators","return")&&(m=o);else if(D.static=v,D.private=_,o=D.access={has:_?Z.bind():function(h){return r in h}},it||(o.get=_?M?function(h){return q(h),c.value}:V("get",0,q):function(h){return h[r]}),M||et||(o.set=_?V("set",0,q):function(h,P){h[r]=P}),m=st.call(nt,A?{get:c.get,set:c.set}:c[w],D),K.v=1,A){if(typeof m=="object"&&m)(o=x(m.get,"accessor.get"))&&(c.get=o),(o=x(m.set,"accessor.set"))&&(c.set=o),(o=x(m.init,"accessor.init"))&&z.unshift(o);else if(m!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else x(m,(S?"field":"method")+" decorators","return")&&(S?z.unshift(m):c[w]=m)}return l<2&&O.push(C(z,v,1),C(b,v,0)),S||X||(_?A?O.splice(-1,0,V("get",v),V("set",v)):O.push(M?c[w]:x.call.bind(c[w])):N(n,r,c)),m}function Q(n){return N(n,H,{configurable:!0,enumerable:!0,value:p})}return d!==void 0&&(p=d[H]),p=R(p??null),f=[],u=function(n){n&&f.push(C(n))},E=function(n,g){for(var y=0;y<e.length;y++){var r=e[y],l=r[1],b=7&l;if((8&l)==n&&!b==g){var O=r[2],v=!!r[3],_=16&l;J(n?i:i.prototype,r,_,v?"#"+O:ti(O),b,b<2?[]:n?k=k||[]:I=I||[],f,!!n,v,g,n&&v?function(S){return ii(S)===i}:a)}}},E(8,0),E(0,0),E(8,1),E(0,1),u(I),u(k),o=f,G||Q(i),{e:o,get c(){var n=[];return G&&[Q(i=J(i,[t],s,i.name,5,n)),C(n,1)]}}}function ti(i){var t=ei(i,"string");return typeof t=="symbol"?t:t+""}function ei(i,t){if(typeof i!="object"||!i)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var s=e.call(i,t||"default");if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}function Me(i,t,e){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(i,"name",{configurable:!0,value:e?e+" "+t:t})}catch{}return i}function ii(i){if(Object(i)!==i)throw TypeError("right-hand side of 'in' should be an object, got "+(i!==null?typeof i:"null"));return i}function Be(i,t){return i instanceof Node&&t.contains(i)}var je,Ue=class extends Ve{static{({e:[me,ye,ve,ge,be,Te,_e,Se,xe,we,Ie,Ee,Oe,Pe,Ae,De,Re,Le,ke,Ce,pe],c:[je,fe]}=Ze(this,[ni("rui-toaster")],[[[$({type:String,reflect:!0,defaultValue:dt}),si([{attr:"data-y-position",map:t=>j(t).y},{attr:"data-x-position",map:t=>j(t).x}])],0,"position"],[$({type:Number,defaultValue:4e3}),0,"duration"],[$({type:Number,defaultValue:3}),0,"visibleToasts"],[$({type:Boolean,defaultValue:!1}),0,"closeButton"],[$({type:Boolean,defaultValue:!1}),0,"expand"],[$({type:Number,defaultValue:14}),0,"gap"],[$({type:Number,defaultValue:24}),0,"offset"],[$({type:String,reflect:!0,defaultValue:""}),0,"container"],[ri({ref:"list"}),0,"listTarget"],[ai,0,"toasts"],[oi(["position","duration","visibleToasts","closeButton","expand","gap","offset","container"]),2,"onConfigUpdated"],[Dt({document:!0,type:at}),2,"onDocumentShow"],[Dt({document:!0,type:lt}),2,"onDocumentDismiss"],[Dt({selector:"rui-toast",type:"rui-toast-mounted"}),2,"onToastMounted"],[vt,2,"onPointerOver"],[vt,2,"onPointerOut"],[vt,2,"onPointerDown"],[vt,2,"onPointerUp"]],0,void 0,Ve))}position=(pe(this),me(this));duration=(ye(this),ve(this));visibleToasts=(ge(this),be(this));closeButton=(Te(this),_e(this));expand=(Se(this),xe(this));gap=(we(this),Ie(this));offset=(Ee(this),Oe(this));container=(Pe(this),Ae(this));listTarget=(De(this),Re(this));toasts=(Le(this),ke(this,[]));expanded=(Ce(this),!1);interacting=!1;unsubscribe=null;visibilityHandler=null;heights=new Map;observers=new Map;layoutFrame=null;measuring=!1;connectedCallback(){super.connectedCallback(),this.syncHostPosition(),this.syncContainer(),this.unsubscribe=T.subscribe(t=>{this.toasts=t,t.length===0&&this.resetLayoutState(),this.scheduleLayoutSync()}),this.visibilityHandler=()=>this.syncPauseState(),document.addEventListener("visibilitychange",this.visibilityHandler)}disconnectedCallback(){this.unsubscribe?.(),this.unsubscribe=null,this.visibilityHandler&&(document.removeEventListener("visibilitychange",this.visibilityHandler),this.visibilityHandler=null),document.removeEventListener("pointerup",this.onPointerUp),document.removeEventListener("pointercancel",this.onPointerUp),this.layoutFrame!=null&&cancelAnimationFrame(this.layoutFrame),this.resetLayoutState(),super.disconnectedCallback()}onConfigUpdated(){this.syncHostPosition(),this.syncContainer(),this.scheduleLayoutSync()}onDocumentShow(t){let e=t.detail;e?.title&&T.create(e.title,{id:e.id,description:e.description,variant:e.variant,duration:e.duration,action:e.action,dismissible:e.dismissible,closeButton:e.closeButton,position:e.position})}onDocumentDismiss(t){let e=t.detail;T.dismiss(e?.id)}onToastMounted(){this.scheduleLayoutSync()}filteredToasts(){let t=this.toasts.filter(a=>(a.position??this.position)===this.position),e=[],s=[];for(let a of t)a.delete?s.push(a):e.push(a);return[...e.slice(0,this.visibleToasts),...s]}syncHostPosition(){this.style.setProperty("--rui-toaster-gap",`${this.gap}px`),this.style.setProperty("--rui-toaster-offset",`${this.offset}px`)}syncContainer(){let t=this.container.trim();if(!t){this.removeAttribute("data-contained"),this.style.position="";return}let e=this.closest(t)??document.querySelector(t);if(!e){this.removeAttribute("data-contained"),this.style.position="";return}getComputedStyle(e).position==="static"&&(e.style.position="relative"),e.contains(this)||e.appendChild(this),this.dataset.contained="true",this.style.position="absolute"}isStackExpanded(){return this.expanded||this.expand}isPaused(){return this.expanded||this.interacting||document.hidden}resetLayoutState(){for(let e of this.observers.values())e.disconnect();this.observers.clear(),this.heights.clear(),this.expanded=!1,this.interacting=!1;let t=this.listTarget;t&&(t.style.height="0px",t.dataset.expanded="false"),this.dataset.expanded="false"}syncPauseState(){let t=this.isPaused();for(let e of this.querySelectorAll("rui-toast"))e.setPaused(t);this.patchStackLayout()}scheduleLayoutSync(){this.layoutFrame!=null&&cancelAnimationFrame(this.layoutFrame),this.layoutFrame=requestAnimationFrame(()=>{if(this.layoutFrame=null,this.toasts.length>0&&!this.interacting){let e=!!(this.listTarget?.matches(":hover")||this.matches(":hover"));this.expanded=e}this.observeToasts(),this.syncPauseState()})}measureToast(t){this.measuring=!0;let e=t.style.height,s=t.style.overflow;t.style.height="auto",t.style.overflow="visible";let a=t.getRef("toast"),d=Math.round(a instanceof HTMLElement?a.offsetHeight:t.offsetHeight)||64;return t.style.height=e,t.style.overflow=s,this.measuring=!1,d}observeToasts(){let t=this.listTarget;if(!t)return;let e=[...t.querySelectorAll("rui-toast")],s=new Set;for(let a of e){let d=a.toastId;if(!d)continue;s.add(d);let p=a.getRef("toast")??a;if(!this.observers.has(d)){let o=new ResizeObserver(()=>{if(this.measuring)return;let I=this.measureToast(a);this.heights.get(d)!==I&&(this.heights.set(d,I),this.patchStackLayout())});o.observe(p),this.observers.set(d,o)}this.heights.set(d,this.measureToast(a))}for(let[a,d]of[...this.observers])s.has(a)||(d.disconnect(),this.observers.delete(a),this.heights.delete(a))}patchStackLayout(){let t=this.listTarget;if(!t)return;let e=this.isStackExpanded(),{y:s}=j(this.position),a=s==="bottom"?-1:1,d=Math.min(3,Math.max(1,this.visibleToasts));this.dataset.expanded=String(e),t.dataset.expanded=String(e),this.style.setProperty("--rui-toaster-lift",String(a)),t.style.setProperty("--rui-toaster-gap",`${this.gap}px`);let p=[...t.querySelectorAll("rui-toast")].filter(f=>f.dataset.mounted==="true"&&f.dataset.removed!=="true");if(p.length===0){t.style.height="0px";return}let o=p.map(f=>{let u=this.measureToast(f);return this.heights.set(f.toastId,u),u}),I=o[0]??64;this.style.setProperty("--rui-toaster-front-height",`${I}px`);for(let f=0;f<p.length;f+=1){let u=p[f];if(!u)continue;let E=o[f]??64,H=f===0,N=ce(f,o,this.gap),R=f<d;if(u.dataset.index=String(f),u.dataset.front=String(H),u.dataset.expanded=String(e),u.dataset.visible=String(e||R),u.style.setProperty("--rui-toast-z",String(p.length-f)),u.style.setProperty("--rui-toast-index",String(f)),u.style.setProperty("--rui-toast-offset",`${N}px`),u.style.setProperty("--rui-toast-initial-height",`${E}px`),u.style.setProperty("--rui-toaster-gap",`${this.gap}px`),e)u.style.setProperty("--rui-toast-y",`translateY(${a*N}px)`),u.style.height=`${E}px`,u.style.overflow="visible";else if(!R)u.style.setProperty("--rui-toast-y",`translateY(${a*(d-1)*this.gap}px) scale(0.7)`),u.style.height=`${I}px`,u.style.overflow="hidden";else if(H)u.style.setProperty("--rui-toast-y","translateY(0px)"),u.style.height=`${E}px`,u.style.overflow="visible";else{let W=Math.max(.7,1-f*.05);u.style.setProperty("--rui-toast-y",`translateY(${a*f*this.gap}px) scale(${W})`),u.style.height=`${I}px`,u.style.overflow="hidden"}}let k=Math.min(d,p.length);t.style.height=`${e?de(o,this.gap):he(I,k,this.gap)}px`}onPointerOver(t){Be(t.relatedTarget,this)||(this.expanded=!0,this.syncPauseState())}onPointerOut(t){Be(t.relatedTarget,this)||this.interacting||(this.expanded=!1,this.syncPauseState())}onPointerDown(){this.interacting=!0,this.expanded=!0,this.syncPauseState(),document.addEventListener("pointerup",this.onPointerUp,{once:!0}),document.addEventListener("pointercancel",this.onPointerUp,{once:!0})}onPointerUp(){if(!this.interacting)return;this.interacting=!1,this.listTarget?.matches(":hover")||this.querySelector("rui-toast:hover")||(this.expanded=!1),this.syncPauseState()}render(){let t=this.filteredToasts();return At("section",{class:"rui-toaster-region","aria-label":"Notifications","aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",tabIndex:-1,children:At("ol",{class:"rui-toaster","data-ref":"list","data-rui-toaster":!0,"on:pointerover":this.onPointerOver,"on:pointerout":this.onPointerOut,"on:pointerdown":this.onPointerDown,children:t.map(e=>{let s=e.duration??(e.variant==="loading"?Number.POSITIVE_INFINITY:this.duration);return At("rui-toast",{"prop:toastId":String(e.id),"prop:title":e.title,"prop:description":e.description??"","prop:variant":e.variant,"prop:duration":s,"prop:dismissible":e.dismissible,"prop:closeButton":e.closeButton??this.closeButton,"prop:actionLabel":e.action?.label??"","prop:position":e.position??this.position,"prop:markedDelete":!!e.delete},String(e.id))})})})}static{fe()}};import{jsx as Fe}from"@ecopages/jsx/jsx-runtime";function li({toastId:i,...t}){return Fe("rui-toast",{...t,toastId:i!=null?String(i):void 0})}function ui({children:i,...t}){return Fe("rui-toaster",{...t,children:i})}var ci=Object.assign((i,t)=>T.create(i,t),{message:(i,t)=>T.message(i,t),success:(i,t)=>T.success(i,t),error:(i,t)=>T.error(i,t),info:(i,t)=>T.info(i,t),warning:(i,t)=>T.warning(i,t),loading:(i,t)=>T.loading(i,t),promise:(i,t)=>T.promise(i,t),dismiss:i=>T.dismiss(i),clear:()=>T.clear()});function di(i){document.dispatchEvent(new CustomEvent(at,{detail:i,bubbles:!0,composed:!0}))}function hi(i){let t=i==null?{}:{id:i};document.dispatchEvent(new CustomEvent(lt,{detail:t,bubbles:!0,composed:!0}))}export{dt as DEFAULT_TOAST_POSITION,lt as RUI_TOAST_DISMISS_EVENT,at as RUI_TOAST_SHOW_EVENT,li as RuiToast,ue as RuiToastElement,ui as RuiToaster,je as RuiToasterElement,St as TOAST_COLLAPSED_PEEK,xt as TOAST_EXIT_MS,bt as TOAST_GAP,ut as TOAST_LIFETIME,Ne as TOAST_POSITIONS,ct as TOAST_SWIPE_THRESHOLD,Tt as TOAST_VIEWPORT_OFFSET,_t as TOAST_VISIBLE_AMOUNT,$e as TOAST_WIDTH,hi as dismissToast,di as showToast,ci as toast};
|
|
1
|
+
import{jsx as F,jsxs as oe}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as re,bindTo as It,bound as Et,customElement as Ge,onEvent as ae,onUpdated as Ot,prop as L,query as Je}from"@ecopages/radiant";function pt(...i){return i.filter(Boolean).join(" ")}import{jsx as Rt}from"@ecopages/jsx/jsx-runtime";function gt({class:i,size:t="sm",...e}){return Rt("svg",{...e,class:pt("rui-icon",t==="md"&&"rui-icon--md",i),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",children:Rt("path",{d:"m5 12 4 4L19 6"})})}import{jsx as Lt,jsxs as He}from"@ecopages/jsx/jsx-runtime";function ft({class:i,size:t="sm",...e}){return He("svg",{...e,class:pt("rui-icon",t==="md"&&"rui-icon--md",i),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",children:[Lt("path",{d:"m18 6-12 12"}),Lt("path",{d:"m6 6 12 12"})]})}var at="rui-toast-show",lt="rui-toast-dismiss",Ne=["top-start","top-center","top-end","bottom-start","bottom-center","bottom-end"],ut=4e3,$e=356,bt=14,Tt=24,_t=3,St=3,ct=45,xt=200,dt="bottom-end";function j(i){let[t,e]=i.split("-");return{y:t,x:e}}var We=1;function qe(){return We++}function kt(i,t){return typeof i=="function"?i(t):i}var wt=class{subscribers=[];toasts=[];subscribe=t=>(this.subscribers.push(t),t(this.toasts),()=>{let e=this.subscribers.indexOf(t);e>=0&&this.subscribers.splice(e,1)});getSnapshot=()=>this.toasts;publish(){let t=this.toasts;for(let e of this.subscribers)e(t)}create=(t,e={})=>{let s=e.id??qe(),a=e.dismissible??!0,d=this.toasts.findIndex(o=>o.id===s),p={id:s,title:t,description:e.description,variant:e.variant??"default",duration:e.duration,action:e.action,dismissible:a,closeButton:e.closeButton,position:e.position,delete:!1};return d>=0?this.toasts=this.toasts.map(o=>o.id===s?{...o,...p,delete:!1}:o):this.toasts=[p,...this.toasts],this.publish(),s};dismiss=t=>{if(t==null){if(this.toasts.length===0)return;this.toasts=this.toasts.map(e=>({...e,delete:!0}))}else{let e=this.toasts.find(s=>s.id===t);if(!e||e.delete)return;this.toasts=this.toasts.map(s=>s.id===t?{...s,delete:!0}:s)}this.publish()};remove=t=>{this.toasts=this.toasts.filter(e=>e.id!==t),this.publish()};clear=()=>{this.toasts.length!==0&&(this.toasts=[],this.publish())};message=(t,e)=>this.create(t,e);success=(t,e)=>this.create(t,{...e,variant:"success"});error=(t,e)=>this.create(t,{...e,variant:"error"});info=(t,e)=>this.create(t,{...e,variant:"info"});warning=(t,e)=>this.create(t,{...e,variant:"warning"});loading=(t,e)=>this.create(t,{...e,variant:"loading",duration:e?.duration??Number.POSITIVE_INFINITY});promise=(t,e)=>{let s=this.loading(e.loading,{duration:Number.POSITIVE_INFINITY,action:e.action,closeButton:e.closeButton,position:e.position,description:typeof e.description=="string"?e.description:void 0});return(typeof t=="function"?t():t).then(d=>{let p=typeof e.description=="function"?e.description(d):e.description;this.create(kt(e.success,d),{id:s,variant:"success",description:p,duration:e.duration,action:e.action,closeButton:e.closeButton,position:e.position})}).catch(d=>{let p=typeof e.description=="function"?e.description(d):e.description;this.create(kt(e.error,d),{id:s,variant:"error",description:p,duration:e.duration,action:e.action,closeButton:e.closeButton,position:e.position})}),s}},T=new wt;var Ct,Mt,Vt,Bt,Ut,jt,Ft,Ht,Nt,$t,Wt,qt,Yt,Xt,zt,Kt,Gt,Jt,Qt,Zt,te,ee,ie,se;function Ye(i,t,e,s,a,d){var p,o,I,k,f,u,E,H=Symbol.metadata||Symbol.for("Symbol.metadata"),N=Object.defineProperty,R=Object.create,W=[R(null),R(null)],G=t.length;function C(n,g,y){return function(r,l){g&&(l=r,r=i);for(var b=0;b<n.length;b++)l=n[b].apply(r,y?[l]:[]);return y?l:r}}function x(n,g,y,r){if(typeof n!="function"&&(r||n!==void 0))throw new TypeError(g+" must "+(y||"be")+" a function"+(r?"":" or undefined"));return n}function J(n,g,y,r,l,b,O,v,_,S,Z){function q(h){if(!Z(h))throw new TypeError("Attempted to access private element on non-instance")}var Y=[].concat(g[0]),tt=g[3],X=!O,A=l===1,et=l===3,it=l===4,M=l===2;function V(h,P,ot){return function(U,rt){return P&&(rt=U,U=n),ot&&ot(U),c[h].call(U,rt)}}if(!X){var c={},z=[],w=et?"get":it||A?"set":"value";if(_?(S||A?c={get:ne(function(){return tt(this)},r,"get"),set:function(h){g[4](this,h)}}:c[w]=tt,S||ne(c[w],r,M?"":w)):S||(c=Object.getOwnPropertyDescriptor(n,r)),!S&&!_){if((o=W[+v][r])&&(o^l)!==7)throw Error("Decorating two elements with the same name ("+c[w].name+") is not supported yet");W[+v][r]=l<3?1:l}}for(var m=n,B=Y.length-1;B>=0;B-=y?2:1){var st=x(Y[B],"A decorator","be",!0),nt=y?Y[B-1]:void 0,K={},D={kind:["field","accessor","method","getter","setter","class"][l],name:r,metadata:p,addInitializer:function(h,P){if(h.v)throw new TypeError("attempted to call addInitializer after decoration was finished");x(P,"An initializer","be",!0),b.push(P)}.bind(null,K)};if(X)o=st.call(nt,m,D),K.v=1,x(o,"class decorators","return")&&(m=o);else if(D.static=v,D.private=_,o=D.access={has:_?Z.bind():function(h){return r in h}},it||(o.get=_?M?function(h){return q(h),c.value}:V("get",0,q):function(h){return h[r]}),M||et||(o.set=_?V("set",0,q):function(h,P){h[r]=P}),m=st.call(nt,A?{get:c.get,set:c.set}:c[w],D),K.v=1,A){if(typeof m=="object"&&m)(o=x(m.get,"accessor.get"))&&(c.get=o),(o=x(m.set,"accessor.set"))&&(c.set=o),(o=x(m.init,"accessor.init"))&&z.unshift(o);else if(m!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else x(m,(S?"field":"method")+" decorators","return")&&(S?z.unshift(m):c[w]=m)}return l<2&&O.push(C(z,v,1),C(b,v,0)),S||X||(_?A?O.splice(-1,0,V("get",v),V("set",v)):O.push(M?c[w]:x.call.bind(c[w])):N(n,r,c)),m}function Q(n){return N(n,H,{configurable:!0,enumerable:!0,value:p})}return d!==void 0&&(p=d[H]),p=R(p??null),f=[],u=function(n){n&&f.push(C(n))},E=function(n,g){for(var y=0;y<e.length;y++){var r=e[y],l=r[1],b=7&l;if((8&l)==n&&!b==g){var O=r[2],v=!!r[3],_=16&l;J(n?i:i.prototype,r,_,v?"#"+O:Xe(O),b,b<2?[]:n?k=k||[]:I=I||[],f,!!n,v,g,n&&v?function(S){return Ke(S)===i}:a)}}},E(8,0),E(0,0),E(8,1),E(0,1),u(I),u(k),o=f,G||Q(i),{e:o,get c(){var n=[];return G&&[Q(i=J(i,[t],s,i.name,5,n)),C(n,1)]}}}function Xe(i){var t=ze(i,"string");return typeof t=="symbol"?t:t+""}function ze(i,t){if(typeof i!="object"||!i)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var s=e.call(i,t||"default");if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}function ne(i,t,e){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(i,"name",{configurable:!0,value:e?e+" "+t:t})}catch{}return i}function Ke(i){if(Object(i)!==i)throw TypeError("right-hand side of 'in' should be an object, got "+(i!==null?typeof i:"null"));return i}var ht=new Map,yt=new Map;function Pt(i){return String(i)}function mt(i){if(i==="")return;let t=Pt(i);ht.delete(t),yt.delete(t)}function Qe(i){if(i==="")return;let t=Pt(i),e=ht.get(t);e!=null&&(yt.set(t,Math.max(0,e-Date.now())),ht.delete(t))}var ue,le=class extends re{static{({e:[Vt,Bt,Ut,jt,Ft,Ht,Nt,$t,Wt,qt,Yt,Xt,zt,Kt,Gt,Jt,Qt,Zt,te,ee,ie,se,Ct],c:[ue,Mt]}=Ye(this,[Ge("rui-toast")],[[L({type:String,reflect:!0,defaultValue:""}),0,"toastId"],[L({type:String,defaultValue:""}),0,"title"],[L({type:String,defaultValue:""}),0,"description"],[[L({type:String,reflect:!0,defaultValue:"default"}),It({attr:"data-variant",map:t=>t??"default"})],0,"variant"],[L({type:Number,defaultValue:4e3}),0,"duration"],[[L({type:Boolean,defaultValue:!0}),It({attr:"data-dismissible"})],0,"dismissible"],[L({type:Boolean,defaultValue:!1}),0,"closeButton"],[L({type:String,defaultValue:""}),0,"actionLabel"],[[L({type:String,defaultValue:dt}),It([{attr:"data-y-position",map:t=>j(t).y},{attr:"data-x-position",map:t=>j(t).x}])],0,"position"],[L({type:Boolean,defaultValue:!1}),0,"markedDelete"],[Je({ref:"toast"}),0,"toastTarget"],[Ot("position"),2,"onPositionUpdated"],[Ot("duration"),2,"onDurationUpdated"],[Ot("markedDelete"),2,"onMarkedDeleteUpdated"],[Et,2,"onPointerDown"],[Et,2,"onPointerMove"],[Et,2,"onPointerUp"],[ae({selector:"[data-toast-close]",type:"click"}),2,"onCloseClick"],[ae({selector:"[data-toast-action]",type:"click"}),2,"onActionClick"]],0,void 0,re))}toastId=(Ct(this),Vt(this));title=(Bt(this),Ut(this));description=(jt(this),Ft(this));variant=(Ht(this),Nt(this));duration=($t(this),Wt(this));dismissible=(qt(this),Yt(this));closeButton=(Xt(this),zt(this));actionLabel=(Kt(this),Gt(this));position=(Jt(this),Qt(this));markedDelete=(Zt(this),te(this));toastTarget=(ee(this),ie(this));mounted=(se(this),!1);removed=!1;swiping=!1;swipeOut=!1;swipeAxis=null;swipeOutDirection=null;held=!1;timerReady=!1;timeoutId=null;pointerStart=null;dragStartTime=null;exitTimer=null;connectedCallback(){super.connectedCallback();let t=this.mounted;if(this.addEventListener("pointerdown",this.onPointerDown),this.addEventListener("pointermove",this.onPointerMove),this.addEventListener("pointerup",this.onPointerUp),this.addEventListener("pointercancel",this.onPointerUp),t){this.timerReady=!0,this.syncDomState(),this.dispatchEvent(new CustomEvent("rui-toast-mounted",{bubbles:!0})),!this.held&&!this.removed&&this.startTimer();return}this.timerReady=!1,requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.isConnected&&(this.mounted=!0,this.timerReady=!0,this.syncDomState(),this.dispatchEvent(new CustomEvent("rui-toast-mounted",{bubbles:!0})),!this.held&&!this.removed&&this.startTimer())})}),this.syncDomState()}disconnectedCallback(){this.clearTimer(),this.exitTimer&&(clearTimeout(this.exitTimer),this.exitTimer=null);let t=this.resolvedId;t!==""&&this.removed&&T.remove(t),this.held=!1,this.timerReady=!1,this.removeEventListener("pointerdown",this.onPointerDown),this.removeEventListener("pointermove",this.onPointerMove),this.removeEventListener("pointerup",this.onPointerUp),this.removeEventListener("pointercancel",this.onPointerUp),super.disconnectedCallback()}onPositionUpdated(){this.syncDomState()}setPaused(t){if(this.held===t){!t&&this.timerReady&&this.mounted&&!this.removed&&!this.timeoutId&&this.startTimer();return}this.held=t,!(!this.timerReady||!this.mounted||this.removed)&&(t||document.hidden?(Qe(this.resolvedId),this.clearTimer()):this.startTimer())}onDurationUpdated(){!this.timerReady||!this.mounted||this.removed||this.held||(mt(this.resolvedId),this.startTimer())}onMarkedDeleteUpdated(){this.markedDelete&&!this.removed&&this.beginRemove()}get resolvedId(){let t=this.toastId;if(t==null||t==="")return"";let e=Number(t);return Number.isFinite(e)&&String(e)===t?e:t}clearTimer(){this.timeoutId&&clearTimeout(this.timeoutId),this.timeoutId=null}startTimer(){if(this.held||this.removed||document.hidden||this.duration===Number.POSITIVE_INFINITY||this.variant==="loading")return;if(this.duration<=0){this.beginRemove();return}let t=this.resolvedId,e=Pt(t),s=Date.now(),a=yt.get(e);if(yt.delete(e),a==null){let d=ht.get(e);a=d!=null?d-s:this.duration}if(a<=0){mt(t),this.beginRemove();return}ht.set(e,s+a),this.clearTimer(),this.timeoutId=setTimeout(()=>{mt(t),this.beginRemove()},a)}beginRemove(){this.removed||(this.removed=!0,this.clearTimer(),mt(this.resolvedId),this.syncDomState(),this.markedDelete||T.dismiss(this.resolvedId),this.exitTimer=setTimeout(()=>{this.exitTimer=null,T.remove(this.resolvedId)},200))}onPointerDown(t){!this.dismissible||this.variant==="loading"||t.button!==0||t.target?.closest("[data-toast-close], [data-toast-action], button, a")||(this.dragStartTime=Date.now(),this.pointerStart={x:t.clientX,y:t.clientY},this.swipeAxis=null,this.setPointerCapture(t.pointerId))}onPointerMove(t){if(!this.pointerStart)return;let e={x:t.clientX-this.pointerStart.x,y:t.clientY-this.pointerStart.y};if(!this.startSwipe(e))return;this.swipeAxis??=Math.abs(e.x)>Math.abs(e.y)?"x":"y";let s=this.swipeAxis==="x"?{x:e.x,y:0}:{x:0,y:e.y};this.isSwipeReversing(s)?this.resetSwipeTranslation():this.setSwipeTranslation(s)}startSwipe(t){return this.swiping?!0:Math.abs(t.x)<8&&Math.abs(t.y)<8?!1:(this.swiping=!0,this.syncDomState(),!0)}isSwipeReversing(t){let{x:e,y:s}=j(this.position);return this.swipeAxis==="y"?(s==="bottom"?t.y<0:t.y>0)&&Math.abs(t.y)<45:e!=="center"&&(e==="start"?t.x>0:t.x<0)&&Math.abs(t.x)<45}setSwipeTranslation(t){this.style.setProperty("--rui-toast-swipe-x",`${t.x}px`),this.style.setProperty("--rui-toast-swipe-y",`${t.y}px`)}resetSwipeTranslation(){this.setSwipeTranslation({x:0,y:0})}onPointerUp(t){if(!this.pointerStart)return;this.releaseToastPointer(t.pointerId);let e=this.readSwipe();this.swiping=!1,e&&this.dismissible&&this.shouldDismissSwipe(e)?this.dismissFromSwipe(e):this.cancelSwipe(),this.clearPointerState()}releaseToastPointer(t){try{this.releasePointerCapture(t)}catch{}}readSwipe(){if(this.swiping)return{x:Number.parseFloat(this.style.getPropertyValue("--rui-toast-swipe-x")||"0"),y:Number.parseFloat(this.style.getPropertyValue("--rui-toast-swipe-y")||"0")}}shouldDismissSwipe(t){let e=this.swipeAxis==="x"?t.x:t.y,s=this.dragStartTime?Date.now()-this.dragStartTime:0;return Math.abs(e)>=45||Math.abs(e)/Math.max(s,1)>.11}dismissFromSwipe(t){let{x:e,y:s}=j(this.position);this.swipeOutDirection=this.swipeAxis==="y"?s==="bottom"?"down":"up":e==="start"?"left":e==="end"?"right":t.x<0?"left":"right",this.swipeOut=!0,this.syncDomState(),this.beginRemove()}cancelSwipe(){this.resetSwipeTranslation(),this.swipeAxis=null,this.syncDomState()}clearPointerState(){this.pointerStart=null,this.dragStartTime=null}onCloseClick(t){t.stopPropagation(),this.dismissible&&this.beginRemove()}onActionClick(t){t.stopPropagation(),T.getSnapshot().find(s=>s.id===this.resolvedId)?.action?.onClick(t),this.dismissible&&this.beginRemove()}syncDomState(){this.setAttribute("role","listitem"),this.dataset.mounted=String(this.mounted),this.dataset.removed=String(this.removed),this.dataset.swiping=String(this.swiping),this.dataset.swipeOut=String(this.swipeOut),this.swipeOutDirection?this.dataset.swipeDirection=this.swipeOutDirection:delete this.dataset.swipeDirection}iconForVariant(){switch(this.variant){case"success":return F(gt,{});case"error":return F(ft,{});case"warning":return"!";case"info":return"i";default:return""}}render(){let t=this.variant??"default",e=this.iconForVariant(),s=t!=="default";return oe("div",{ref:"toast",class:`rui-toast rui-toast--${t}`,role:"status","aria-live":"off","data-ref":"toast",children:[this.closeButton&&t!=="loading"?F("button",{type:"button",class:"rui-toast__close","data-toast-close":!0,"aria-label":"Close toast",children:F(ft,{})}):null,s?F("span",{class:"rui-toast__icon","data-icon":!0,"aria-hidden":"true",children:t==="loading"?F("span",{class:"rui-toast__loader"}):e}):null,oe("div",{class:"rui-toast__content",children:[F("div",{class:"rui-toast__title","data-title":!0,children:this.$.title}),this.description?F("div",{class:"rui-toast__description","data-description":!0,children:this.$.description}):null]}),this.actionLabel?F("button",{type:"button",class:"rui-toast__action rui-button rui-button--outline rui-button--sm","data-toast-action":!0,children:this.$.actionLabel}):null]})}static{Mt()}};import{jsx as At}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as Ve,bindTo as si,bound as vt,customElement as ni,onEvent as Dt,onUpdated as oi,prop as $,query as ri,state as ai}from"@ecopages/radiant";function ce(i,t,e){let s=0;for(let a=0;a<i;a+=1)s+=t[a]??0;return s+i*e}function de(i,t){return i.length===0?0:i.reduce((s,a)=>s+a,0)+Math.max(0,i.length-1)*t}function he(i,t,e){return t<=0?0:i+Math.max(0,t-1)*e}var pe,fe,me,ye,ve,ge,be,Te,_e,Se,xe,we,Ie,Ee,Oe,Pe,Ae,De,Re,Le,ke,Ce;function Ze(i,t,e,s,a,d){var p,o,I,k,f,u,E,H=Symbol.metadata||Symbol.for("Symbol.metadata"),N=Object.defineProperty,R=Object.create,W=[R(null),R(null)],G=t.length;function C(n,g,y){return function(r,l){g&&(l=r,r=i);for(var b=0;b<n.length;b++)l=n[b].apply(r,y?[l]:[]);return y?l:r}}function x(n,g,y,r){if(typeof n!="function"&&(r||n!==void 0))throw new TypeError(g+" must "+(y||"be")+" a function"+(r?"":" or undefined"));return n}function J(n,g,y,r,l,b,O,v,_,S,Z){function q(h){if(!Z(h))throw new TypeError("Attempted to access private element on non-instance")}var Y=[].concat(g[0]),tt=g[3],X=!O,A=l===1,et=l===3,it=l===4,M=l===2;function V(h,P,ot){return function(U,rt){return P&&(rt=U,U=n),ot&&ot(U),c[h].call(U,rt)}}if(!X){var c={},z=[],w=et?"get":it||A?"set":"value";if(_?(S||A?c={get:Me(function(){return tt(this)},r,"get"),set:function(h){g[4](this,h)}}:c[w]=tt,S||Me(c[w],r,M?"":w)):S||(c=Object.getOwnPropertyDescriptor(n,r)),!S&&!_){if((o=W[+v][r])&&(o^l)!==7)throw Error("Decorating two elements with the same name ("+c[w].name+") is not supported yet");W[+v][r]=l<3?1:l}}for(var m=n,B=Y.length-1;B>=0;B-=y?2:1){var st=x(Y[B],"A decorator","be",!0),nt=y?Y[B-1]:void 0,K={},D={kind:["field","accessor","method","getter","setter","class"][l],name:r,metadata:p,addInitializer:function(h,P){if(h.v)throw new TypeError("attempted to call addInitializer after decoration was finished");x(P,"An initializer","be",!0),b.push(P)}.bind(null,K)};if(X)o=st.call(nt,m,D),K.v=1,x(o,"class decorators","return")&&(m=o);else if(D.static=v,D.private=_,o=D.access={has:_?Z.bind():function(h){return r in h}},it||(o.get=_?M?function(h){return q(h),c.value}:V("get",0,q):function(h){return h[r]}),M||et||(o.set=_?V("set",0,q):function(h,P){h[r]=P}),m=st.call(nt,A?{get:c.get,set:c.set}:c[w],D),K.v=1,A){if(typeof m=="object"&&m)(o=x(m.get,"accessor.get"))&&(c.get=o),(o=x(m.set,"accessor.set"))&&(c.set=o),(o=x(m.init,"accessor.init"))&&z.unshift(o);else if(m!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else x(m,(S?"field":"method")+" decorators","return")&&(S?z.unshift(m):c[w]=m)}return l<2&&O.push(C(z,v,1),C(b,v,0)),S||X||(_?A?O.splice(-1,0,V("get",v),V("set",v)):O.push(M?c[w]:x.call.bind(c[w])):N(n,r,c)),m}function Q(n){return N(n,H,{configurable:!0,enumerable:!0,value:p})}return d!==void 0&&(p=d[H]),p=R(p??null),f=[],u=function(n){n&&f.push(C(n))},E=function(n,g){for(var y=0;y<e.length;y++){var r=e[y],l=r[1],b=7&l;if((8&l)==n&&!b==g){var O=r[2],v=!!r[3],_=16&l;J(n?i:i.prototype,r,_,v?"#"+O:ti(O),b,b<2?[]:n?k=k||[]:I=I||[],f,!!n,v,g,n&&v?function(S){return ii(S)===i}:a)}}},E(8,0),E(0,0),E(8,1),E(0,1),u(I),u(k),o=f,G||Q(i),{e:o,get c(){var n=[];return G&&[Q(i=J(i,[t],s,i.name,5,n)),C(n,1)]}}}function ti(i){var t=ei(i,"string");return typeof t=="symbol"?t:t+""}function ei(i,t){if(typeof i!="object"||!i)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var s=e.call(i,t||"default");if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}function Me(i,t,e){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(i,"name",{configurable:!0,value:e?e+" "+t:t})}catch{}return i}function ii(i){if(Object(i)!==i)throw TypeError("right-hand side of 'in' should be an object, got "+(i!==null?typeof i:"null"));return i}function Be(i,t){return i instanceof Node&&t.contains(i)}var je,Ue=class extends Ve{static{({e:[me,ye,ve,ge,be,Te,_e,Se,xe,we,Ie,Ee,Oe,Pe,Ae,De,Re,Le,ke,Ce,pe],c:[je,fe]}=Ze(this,[ni("rui-toaster")],[[[$({type:String,reflect:!0,defaultValue:dt}),si([{attr:"data-y-position",map:t=>j(t).y},{attr:"data-x-position",map:t=>j(t).x}])],0,"position"],[$({type:Number,defaultValue:4e3}),0,"duration"],[$({type:Number,defaultValue:3}),0,"visibleToasts"],[$({type:Boolean,defaultValue:!1}),0,"closeButton"],[$({type:Boolean,defaultValue:!1}),0,"expand"],[$({type:Number,defaultValue:14}),0,"gap"],[$({type:Number,defaultValue:24}),0,"offset"],[$({type:String,reflect:!0,defaultValue:""}),0,"container"],[ri({ref:"list"}),0,"listTarget"],[ai,0,"toasts"],[oi(["position","duration","visibleToasts","closeButton","expand","gap","offset","container"]),2,"onConfigUpdated"],[Dt({document:!0,type:at}),2,"onDocumentShow"],[Dt({document:!0,type:lt}),2,"onDocumentDismiss"],[Dt({selector:"rui-toast",type:"rui-toast-mounted"}),2,"onToastMounted"],[vt,2,"onPointerOver"],[vt,2,"onPointerOut"],[vt,2,"onPointerDown"],[vt,2,"onPointerUp"]],0,void 0,Ve))}position=(pe(this),me(this));duration=(ye(this),ve(this));visibleToasts=(ge(this),be(this));closeButton=(Te(this),_e(this));expand=(Se(this),xe(this));gap=(we(this),Ie(this));offset=(Ee(this),Oe(this));container=(Pe(this),Ae(this));listTarget=(De(this),Re(this));toasts=(Le(this),ke(this,[]));expanded=(Ce(this),!1);interacting=!1;unsubscribe=null;visibilityHandler=null;heights=new Map;observers=new Map;layoutFrame=null;measuring=!1;connectedCallback(){super.connectedCallback(),this.syncHostPosition(),this.syncContainer(),this.unsubscribe=T.subscribe(t=>{this.toasts=t,t.length===0&&this.resetLayoutState(),this.scheduleLayoutSync()}),this.visibilityHandler=()=>this.syncPauseState(),document.addEventListener("visibilitychange",this.visibilityHandler)}disconnectedCallback(){this.unsubscribe?.(),this.unsubscribe=null,this.visibilityHandler&&(document.removeEventListener("visibilitychange",this.visibilityHandler),this.visibilityHandler=null),document.removeEventListener("pointerup",this.onPointerUp),document.removeEventListener("pointercancel",this.onPointerUp),this.layoutFrame!=null&&cancelAnimationFrame(this.layoutFrame),this.resetLayoutState(),super.disconnectedCallback()}onConfigUpdated(){this.syncHostPosition(),this.syncContainer(),this.scheduleLayoutSync()}onDocumentShow(t){let e=t.detail;e?.title&&T.create(e.title,{id:e.id,description:e.description,variant:e.variant,duration:e.duration,action:e.action,dismissible:e.dismissible,closeButton:e.closeButton,position:e.position})}onDocumentDismiss(t){let e=t.detail;T.dismiss(e?.id)}onToastMounted(){this.scheduleLayoutSync()}filteredToasts(){let t=this.toasts.filter(a=>(a.position??this.position)===this.position),e=[],s=[];for(let a of t)a.delete?s.push(a):e.push(a);return[...e.slice(0,this.visibleToasts),...s]}syncHostPosition(){this.style.setProperty("--rui-toaster-gap",`${this.gap}px`),this.style.setProperty("--rui-toaster-offset",`${this.offset}px`)}syncContainer(){let t=this.container.trim();if(!t){this.removeAttribute("data-contained"),this.style.position="";return}let e=this.closest(t)??document.querySelector(t);if(!e){this.removeAttribute("data-contained"),this.style.position="";return}getComputedStyle(e).position==="static"&&(e.style.position="relative"),e.contains(this)||e.appendChild(this),this.dataset.contained="true",this.style.position="absolute"}isStackExpanded(){return this.expanded||this.expand}isPaused(){return this.expanded||this.interacting||document.hidden}resetLayoutState(){for(let e of this.observers.values())e.disconnect();this.observers.clear(),this.heights.clear(),this.expanded=!1,this.interacting=!1;let t=this.listTarget;t&&(t.style.height="0px",t.dataset.expanded="false"),this.dataset.expanded="false"}syncPauseState(){let t=this.isPaused();for(let e of this.querySelectorAll("rui-toast"))e.setPaused(t);this.patchStackLayout()}scheduleLayoutSync(){this.layoutFrame!=null&&cancelAnimationFrame(this.layoutFrame),this.layoutFrame=requestAnimationFrame(()=>{if(this.layoutFrame=null,this.toasts.length>0&&!this.interacting){let e=!!(this.listTarget?.matches(":hover")||this.matches(":hover"));this.expanded=e}this.observeToasts(),this.syncPauseState()})}measureToast(t){this.measuring=!0;let e=t.style.height,s=t.style.overflow;t.style.height="auto",t.style.overflow="visible";let a=t.getRef("toast"),d=Math.round(a instanceof HTMLElement?a.offsetHeight:t.offsetHeight)||64;return t.style.height=e,t.style.overflow=s,this.measuring=!1,d}observeToasts(){let t=this.listTarget;if(!t)return;let e=[...t.querySelectorAll("rui-toast")],s=new Set;for(let a of e){let d=a.toastId;if(!d)continue;s.add(d);let p=a.getRef("toast")??a;if(!this.observers.has(d)){let o=new ResizeObserver(()=>{if(this.measuring)return;let I=this.measureToast(a);this.heights.get(d)!==I&&(this.heights.set(d,I),this.patchStackLayout())});o.observe(p),this.observers.set(d,o)}this.heights.set(d,this.measureToast(a))}for(let[a,d]of[...this.observers])s.has(a)||(d.disconnect(),this.observers.delete(a),this.heights.delete(a))}patchStackLayout(){let t=this.listTarget;if(!t)return;let e=this.isStackExpanded(),{y:s}=j(this.position),a=s==="bottom"?-1:1,d=Math.min(3,Math.max(1,this.visibleToasts));this.dataset.expanded=String(e),t.dataset.expanded=String(e),this.style.setProperty("--rui-toaster-lift",String(a)),t.style.setProperty("--rui-toaster-gap",`${this.gap}px`);let p=[...t.querySelectorAll("rui-toast")].filter(f=>f.dataset.mounted==="true"&&f.dataset.removed!=="true");if(p.length===0){t.style.height="0px";return}let o=p.map(f=>{let u=this.measureToast(f);return this.heights.set(f.toastId,u),u}),I=o[0]??64;this.style.setProperty("--rui-toaster-front-height",`${I}px`);for(let f=0;f<p.length;f+=1){let u=p[f];if(!u)continue;let E=o[f]??64,H=f===0,N=ce(f,o,this.gap),R=f<d;if(u.dataset.index=String(f),u.dataset.front=String(H),u.dataset.expanded=String(e),u.dataset.visible=String(e||R),u.style.setProperty("--rui-toast-z",String(p.length-f)),u.style.setProperty("--rui-toast-index",String(f)),u.style.setProperty("--rui-toast-offset",`${N}px`),u.style.setProperty("--rui-toast-initial-height",`${E}px`),u.style.setProperty("--rui-toaster-gap",`${this.gap}px`),e)u.style.setProperty("--rui-toast-y",`translateY(${a*N}px)`),u.style.height=`${E}px`,u.style.overflow="visible";else if(!R)u.style.setProperty("--rui-toast-y",`translateY(${a*(d-1)*this.gap}px) scale(0.7)`),u.style.height=`${I}px`,u.style.overflow="hidden";else if(H)u.style.setProperty("--rui-toast-y","translateY(0px)"),u.style.height=`${E}px`,u.style.overflow="visible";else{let W=Math.max(.7,1-f*.05);u.style.setProperty("--rui-toast-y",`translateY(${a*f*this.gap}px) scale(${W})`),u.style.height=`${I}px`,u.style.overflow="hidden"}}let k=Math.min(d,p.length);t.style.height=`${e?de(o,this.gap):he(I,k,this.gap)}px`}onPointerOver(t){Be(t.relatedTarget,this)||(this.expanded=!0,this.syncPauseState())}onPointerOut(t){Be(t.relatedTarget,this)||this.interacting||(this.expanded=!1,this.syncPauseState())}onPointerDown(){this.interacting=!0,this.expanded=!0,this.syncPauseState(),document.addEventListener("pointerup",this.onPointerUp,{once:!0}),document.addEventListener("pointercancel",this.onPointerUp,{once:!0})}onPointerUp(){if(!this.interacting)return;this.interacting=!1,this.listTarget?.matches(":hover")||this.querySelector("rui-toast:hover")||(this.expanded=!1),this.syncPauseState()}render(){let t=this.filteredToasts();return At("section",{class:"rui-toaster-region","aria-label":"Notifications","aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",tabIndex:-1,children:At("ol",{class:"rui-toaster","data-ref":"list","data-rui-toaster":!0,"on:pointerover":this.onPointerOver,"on:pointerout":this.onPointerOut,"on:pointerdown":this.onPointerDown,children:t.map(e=>{let s=e.duration??(e.variant==="loading"?Number.POSITIVE_INFINITY:this.duration);return At("rui-toast",{"prop:toastId":String(e.id),"prop:title":e.title,"prop:description":e.description??"","prop:variant":e.variant,"prop:duration":s,"prop:dismissible":e.dismissible,"prop:closeButton":e.closeButton??this.closeButton,"prop:actionLabel":e.action?.label??"","prop:position":e.position??this.position,"prop:markedDelete":!!e.delete},String(e.id))})})})}static{fe()}};import{jsx as Fe}from"@ecopages/jsx/jsx-runtime";function li({toastId:i,...t}){return Fe("rui-toast",{...t,toastId:i!=null?String(i):void 0})}function ui(i){return Fe("rui-toaster",{...i})}var ci=Object.assign((i,t)=>T.create(i,t),{message:(i,t)=>T.message(i,t),success:(i,t)=>T.success(i,t),error:(i,t)=>T.error(i,t),info:(i,t)=>T.info(i,t),warning:(i,t)=>T.warning(i,t),loading:(i,t)=>T.loading(i,t),promise:(i,t)=>T.promise(i,t),dismiss:i=>T.dismiss(i),clear:()=>T.clear()});function di(i){document.dispatchEvent(new CustomEvent(at,{detail:i,bubbles:!0,composed:!0}))}function hi(i){let t=i==null?{}:{id:i};document.dispatchEvent(new CustomEvent(lt,{detail:t,bubbles:!0,composed:!0}))}export{dt as DEFAULT_TOAST_POSITION,lt as RUI_TOAST_DISMISS_EVENT,at as RUI_TOAST_SHOW_EVENT,li as RuiToast,ue as RuiToastElement,ui as RuiToaster,je as RuiToasterElement,St as TOAST_COLLAPSED_PEEK,xt as TOAST_EXIT_MS,bt as TOAST_GAP,ut as TOAST_LIFETIME,Ne as TOAST_POSITIONS,ct as TOAST_SWIPE_THRESHOLD,Tt as TOAST_VIEWPORT_OFFSET,_t as TOAST_VISIBLE_AMOUNT,$e as TOAST_WIDTH,hi as dismissToast,di as showToast,ci as toast};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|