@vasf/ragnar-core 1.0.3 → 1.0.4

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/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react/jsx-runtime"),R=require("react"),vi=require("react-dom");function Vb(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const m=Vb(R),Vl=Vb(vi);function XA(t,e){const n=m.createContext(e),r=s=>{const{children:i,...a}=s,l=m.useMemo(()=>a,Object.values(a));return p.jsx(n.Provider,{value:l,children:i})};r.displayName=t+"Provider";function o(s){const i=m.useContext(n);if(i)return i;if(e!==void 0)return e;throw new Error(`\`${s}\` must be used within \`${t}\``)}return[r,o]}function Ie(t,e=[]){let n=[];function r(s,i){const a=m.createContext(i),l=n.length;n=[...n,i];const c=d=>{var v;const{scope:f,children:h,...g}=d,b=((v=f==null?void 0:f[t])==null?void 0:v[l])||a,y=m.useMemo(()=>g,Object.values(g));return p.jsx(b.Provider,{value:y,children:h})};c.displayName=s+"Provider";function u(d,f){var b;const h=((b=f==null?void 0:f[t])==null?void 0:b[l])||a,g=m.useContext(h);if(g)return g;if(i!==void 0)return i;throw new Error(`\`${d}\` must be used within \`${s}\``)}return[c,u]}const o=()=>{const s=n.map(i=>m.createContext(i));return function(a){const l=(a==null?void 0:a[t])||s;return m.useMemo(()=>({[`__scope${t}`]:{...a,[t]:l}}),[a,l])}};return o.scopeName=t,[r,JA(o,...e)]}function JA(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const i=r.reduce((a,{useScope:l,scopeName:c})=>{const d=l(s)[`__scope${c}`];return{...a,...d}},{});return m.useMemo(()=>({[`__scope${e.scopeName}`]:i}),[i])}};return n.scopeName=e.scopeName,n}function Zh(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function rn(...t){return e=>{let n=!1;const r=t.map(o=>{const s=Zh(o,e);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():Zh(t[o],null)}}}}function oe(...t){return m.useCallback(rn(...t),t)}function Jr(t){const e=ZA(t),n=m.forwardRef((r,o)=>{const{children:s,...i}=r,a=m.Children.toArray(s),l=a.find(QA);if(l){const c=l.props.children,u=a.map(d=>d===l?m.Children.count(c)>1?m.Children.only(null):m.isValidElement(c)?c.props.children:null:d);return p.jsx(e,{...i,ref:o,children:m.isValidElement(c)?m.cloneElement(c,void 0,u):null})}return p.jsx(e,{...i,ref:o,children:s})});return n.displayName=`${t}.Slot`,n}function ZA(t){const e=m.forwardRef((n,r)=>{const{children:o,...s}=n;if(m.isValidElement(o)){const i=tO(o),a=eO(s,o.props);return o.type!==m.Fragment&&(a.ref=r?rn(r,i):i),m.cloneElement(o,a)}return m.Children.count(o)>1?m.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Wb=Symbol("radix.slottable");function Ub(t){const e=({children:n})=>p.jsx(p.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=Wb,e}function QA(t){return m.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Wb}function eO(t,e){const n={...e};for(const r in e){const o=t[r],s=e[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{const l=s(...a);return o(...a),l}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...t,...n}}function tO(t){var r,o;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(o=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:o.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function kr(t){const e=t+"CollectionProvider",[n,r]=Ie(e),[o,s]=n(e,{collectionRef:{current:null},itemMap:new Map}),i=b=>{const{scope:y,children:v}=b,x=R.useRef(null),w=R.useRef(new Map).current;return p.jsx(o,{scope:y,itemMap:w,collectionRef:x,children:v})};i.displayName=e;const a=t+"CollectionSlot",l=Jr(a),c=R.forwardRef((b,y)=>{const{scope:v,children:x}=b,w=s(a,v),S=oe(y,w.collectionRef);return p.jsx(l,{ref:S,children:x})});c.displayName=a;const u=t+"CollectionItemSlot",d="data-radix-collection-item",f=Jr(u),h=R.forwardRef((b,y)=>{const{scope:v,children:x,...w}=b,S=R.useRef(null),C=oe(y,S),k=s(u,v);return R.useEffect(()=>(k.itemMap.set(S,{ref:S,...w}),()=>void k.itemMap.delete(S))),p.jsx(f,{[d]:"",ref:C,children:x})});h.displayName=u;function g(b){const y=s(t+"CollectionConsumer",b);return R.useCallback(()=>{const x=y.collectionRef.current;if(!x)return[];const w=Array.from(x.querySelectorAll(`[${d}]`));return Array.from(y.itemMap.values()).sort((k,N)=>w.indexOf(k.ref.current)-w.indexOf(N.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:i,Slot:c,ItemSlot:h},g,r]}function P(t,e,{checkForDefaultPrevented:n=!0}={}){return function(o){if(t==null||t(o),n===!1||!o.defaultPrevented)return e==null?void 0:e(o)}}var De=globalThis!=null&&globalThis.document?m.useLayoutEffect:()=>{},nO=m[" useInsertionEffect ".trim().toString()]||De;function Oe({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[o,s,i]=rO({defaultProp:e,onChange:n}),a=t!==void 0,l=a?t:o;{const u=m.useRef(t!==void 0);m.useEffect(()=>{const d=u.current;d!==a&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=a},[a,r])}const c=m.useCallback(u=>{var d;if(a){const f=oO(u)?u(t):u;f!==t&&((d=i.current)==null||d.call(i,f))}else s(u)},[a,t,s,i]);return[l,c]}function rO({defaultProp:t,onChange:e}){const[n,r]=m.useState(t),o=m.useRef(n),s=m.useRef(e);return nO(()=>{s.current=e},[e]),m.useEffect(()=>{var i;o.current!==n&&((i=s.current)==null||i.call(s,n),o.current=n)},[n,o]),[n,r,s]}function oO(t){return typeof t=="function"}var sO=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Z=sO.reduce((t,e)=>{const n=Jr(`Primitive.${e}`),r=m.forwardRef((o,s)=>{const{asChild:i,...a}=o,l=i?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function Ia(t,e){t&&Vl.flushSync(()=>t.dispatchEvent(e))}function iO(t,e){return m.useReducer((n,r)=>e[n][r]??n,t)}var Pe=t=>{const{present:e,children:n}=t,r=aO(e),o=typeof n=="function"?n({present:r.isPresent}):m.Children.only(n),s=oe(r.ref,lO(o));return typeof n=="function"||r.isPresent?m.cloneElement(o,{ref:s}):null};Pe.displayName="Presence";function aO(t){const[e,n]=m.useState(),r=m.useRef(null),o=m.useRef(t),s=m.useRef("none"),i=t?"mounted":"unmounted",[a,l]=iO(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{const c=ta(r.current);s.current=a==="mounted"?c:"none"},[a]),De(()=>{const c=r.current,u=o.current;if(u!==t){const f=s.current,h=ta(c);t?l("MOUNT"):h==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&f!==h?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,l]),De(()=>{if(e){let c;const u=e.ownerDocument.defaultView??window,d=h=>{const b=ta(r.current).includes(CSS.escape(h.animationName));if(h.target===e&&b&&(l("ANIMATION_END"),!o.current)){const y=e.style.animationFillMode;e.style.animationFillMode="forwards",c=u.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=y)})}},f=h=>{h.target===e&&(s.current=ta(r.current))};return e.addEventListener("animationstart",f),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{u.clearTimeout(c),e.removeEventListener("animationstart",f),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:m.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function ta(t){return(t==null?void 0:t.animationName)||"none"}function lO(t){var r,o;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(o=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:o.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var cO=m[" useId ".trim().toString()]||(()=>{}),uO=0;function Ee(t){const[e,n]=m.useState(cO());return De(()=>{n(r=>r??String(uO++))},[t]),t||(e?`radix-${e}`:"")}var Wl="Collapsible",[dO,Gb]=Ie(Wl),[fO,of]=dO(Wl),Kb=m.forwardRef((t,e)=>{const{__scopeCollapsible:n,open:r,defaultOpen:o,disabled:s,onOpenChange:i,...a}=t,[l,c]=Oe({prop:r,defaultProp:o??!1,onChange:i,caller:Wl});return p.jsx(fO,{scope:n,disabled:s,contentId:Ee(),open:l,onOpenToggle:m.useCallback(()=>c(u=>!u),[c]),children:p.jsx(Z.div,{"data-state":cf(l),"data-disabled":s?"":void 0,...a,ref:e})})});Kb.displayName=Wl;var Yb="CollapsibleTrigger",sf=m.forwardRef((t,e)=>{const{__scopeCollapsible:n,...r}=t,o=of(Yb,n);return p.jsx(Z.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":cf(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...r,ref:e,onClick:P(t.onClick,o.onOpenToggle)})});sf.displayName=Yb;var af="CollapsibleContent",lf=m.forwardRef((t,e)=>{const{forceMount:n,...r}=t,o=of(af,t.__scopeCollapsible);return p.jsx(Pe,{present:n||o.open,children:({present:s})=>p.jsx(pO,{...r,ref:e,present:s})})});lf.displayName=af;var pO=m.forwardRef((t,e)=>{const{__scopeCollapsible:n,present:r,children:o,...s}=t,i=of(af,n),[a,l]=m.useState(r),c=m.useRef(null),u=oe(e,c),d=m.useRef(0),f=d.current,h=m.useRef(0),g=h.current,b=i.open||a,y=m.useRef(b),v=m.useRef(void 0);return m.useEffect(()=>{const x=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(x)},[]),De(()=>{const x=c.current;if(x){v.current=v.current||{transitionDuration:x.style.transitionDuration,animationName:x.style.animationName},x.style.transitionDuration="0s",x.style.animationName="none";const w=x.getBoundingClientRect();d.current=w.height,h.current=w.width,y.current||(x.style.transitionDuration=v.current.transitionDuration,x.style.animationName=v.current.animationName),l(r)}},[i.open,r]),p.jsx(Z.div,{"data-state":cf(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!b,...s,ref:u,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...t.style},children:b&&o})});function cf(t){return t?"open":"closed"}var uf=Kb,qb=sf,Xb=lf,hO=m.createContext(void 0);function an(t){const e=m.useContext(hO);return t||e||"ltr"}var ln="Accordion",mO=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[df,gO,bO]=kr(ln),[Ul]=Ie(ln,[bO,Gb]),ff=Gb(),Jb=R.forwardRef((t,e)=>{const{type:n,...r}=t,o=r,s=r;return p.jsx(df.Provider,{scope:t.__scopeAccordion,children:n==="multiple"?p.jsx(wO,{...s,ref:e}):p.jsx(xO,{...o,ref:e})})});Jb.displayName=ln;var[Zb,yO]=Ul(ln),[Qb,vO]=Ul(ln,{collapsible:!1}),xO=R.forwardRef((t,e)=>{const{value:n,defaultValue:r,onValueChange:o=()=>{},collapsible:s=!1,...i}=t,[a,l]=Oe({prop:n,defaultProp:r??"",onChange:o,caller:ln});return p.jsx(Zb,{scope:t.__scopeAccordion,value:R.useMemo(()=>a?[a]:[],[a]),onItemOpen:l,onItemClose:R.useCallback(()=>s&&l(""),[s,l]),children:p.jsx(Qb,{scope:t.__scopeAccordion,collapsible:s,children:p.jsx(ey,{...i,ref:e})})})}),wO=R.forwardRef((t,e)=>{const{value:n,defaultValue:r,onValueChange:o=()=>{},...s}=t,[i,a]=Oe({prop:n,defaultProp:r??[],onChange:o,caller:ln}),l=R.useCallback(u=>a((d=[])=>[...d,u]),[a]),c=R.useCallback(u=>a((d=[])=>d.filter(f=>f!==u)),[a]);return p.jsx(Zb,{scope:t.__scopeAccordion,value:i,onItemOpen:l,onItemClose:c,children:p.jsx(Qb,{scope:t.__scopeAccordion,collapsible:!0,children:p.jsx(ey,{...s,ref:e})})})}),[SO,Gl]=Ul(ln),ey=R.forwardRef((t,e)=>{const{__scopeAccordion:n,disabled:r,dir:o,orientation:s="vertical",...i}=t,a=R.useRef(null),l=oe(a,e),c=gO(n),d=an(o)==="ltr",f=P(t.onKeyDown,h=>{var E;if(!mO.includes(h.key))return;const g=h.target,b=c().filter(T=>{var O;return!((O=T.ref.current)!=null&&O.disabled)}),y=b.findIndex(T=>T.ref.current===g),v=b.length;if(y===-1)return;h.preventDefault();let x=y;const w=0,S=v-1,C=()=>{x=y+1,x>S&&(x=w)},k=()=>{x=y-1,x<w&&(x=S)};switch(h.key){case"Home":x=w;break;case"End":x=S;break;case"ArrowRight":s==="horizontal"&&(d?C():k());break;case"ArrowDown":s==="vertical"&&C();break;case"ArrowLeft":s==="horizontal"&&(d?k():C());break;case"ArrowUp":s==="vertical"&&k();break}const N=x%v;(E=b[N].ref.current)==null||E.focus()});return p.jsx(SO,{scope:n,disabled:r,direction:o,orientation:s,children:p.jsx(df.Slot,{scope:n,children:p.jsx(Z.div,{...i,"data-orientation":s,ref:l,onKeyDown:r?void 0:f})})})}),Pa="AccordionItem",[CO,pf]=Ul(Pa),ty=R.forwardRef((t,e)=>{const{__scopeAccordion:n,value:r,...o}=t,s=Gl(Pa,n),i=yO(Pa,n),a=ff(n),l=Ee(),c=r&&i.value.includes(r)||!1,u=s.disabled||t.disabled;return p.jsx(CO,{scope:n,open:c,disabled:u,triggerId:l,children:p.jsx(uf,{"data-orientation":s.orientation,"data-state":ay(c),...a,...o,ref:e,disabled:u,open:c,onOpenChange:d=>{d?i.onItemOpen(r):i.onItemClose(r)}})})});ty.displayName=Pa;var ny="AccordionHeader",ry=R.forwardRef((t,e)=>{const{__scopeAccordion:n,...r}=t,o=Gl(ln,n),s=pf(ny,n);return p.jsx(Z.h3,{"data-orientation":o.orientation,"data-state":ay(s.open),"data-disabled":s.disabled?"":void 0,...r,ref:e})});ry.displayName=ny;var Uu="AccordionTrigger",oy=R.forwardRef((t,e)=>{const{__scopeAccordion:n,...r}=t,o=Gl(ln,n),s=pf(Uu,n),i=vO(Uu,n),a=ff(n);return p.jsx(df.ItemSlot,{scope:n,children:p.jsx(qb,{"aria-disabled":s.open&&!i.collapsible||void 0,"data-orientation":o.orientation,id:s.triggerId,...a,...r,ref:e})})});oy.displayName=Uu;var sy="AccordionContent",iy=R.forwardRef((t,e)=>{const{__scopeAccordion:n,...r}=t,o=Gl(ln,n),s=pf(sy,n),i=ff(n);return p.jsx(Xb,{role:"region","aria-labelledby":s.triggerId,"data-orientation":o.orientation,...i,...r,ref:e,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...t.style}})});iy.displayName=sy;function ay(t){return t?"open":"closed"}var kO=Jb,NO=ty,EO=ry,ly=oy,cy=iy;/**
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react/jsx-runtime"),R=require("react"),vi=require("react-dom");function Vb(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const m=Vb(R),Vl=Vb(vi);function XA(t,e){const n=m.createContext(e),r=s=>{const{children:i,...a}=s,l=m.useMemo(()=>a,Object.values(a));return p.jsx(n.Provider,{value:l,children:i})};r.displayName=t+"Provider";function o(s){const i=m.useContext(n);if(i)return i;if(e!==void 0)return e;throw new Error(`\`${s}\` must be used within \`${t}\``)}return[r,o]}function Ie(t,e=[]){let n=[];function r(s,i){const a=m.createContext(i),l=n.length;n=[...n,i];const c=d=>{var v;const{scope:f,children:h,...g}=d,b=((v=f==null?void 0:f[t])==null?void 0:v[l])||a,y=m.useMemo(()=>g,Object.values(g));return p.jsx(b.Provider,{value:y,children:h})};c.displayName=s+"Provider";function u(d,f){var b;const h=((b=f==null?void 0:f[t])==null?void 0:b[l])||a,g=m.useContext(h);if(g)return g;if(i!==void 0)return i;throw new Error(`\`${d}\` must be used within \`${s}\``)}return[c,u]}const o=()=>{const s=n.map(i=>m.createContext(i));return function(a){const l=(a==null?void 0:a[t])||s;return m.useMemo(()=>({[`__scope${t}`]:{...a,[t]:l}}),[a,l])}};return o.scopeName=t,[r,JA(o,...e)]}function JA(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const i=r.reduce((a,{useScope:l,scopeName:c})=>{const d=l(s)[`__scope${c}`];return{...a,...d}},{});return m.useMemo(()=>({[`__scope${e.scopeName}`]:i}),[i])}};return n.scopeName=e.scopeName,n}function Zh(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function rn(...t){return e=>{let n=!1;const r=t.map(o=>{const s=Zh(o,e);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():Zh(t[o],null)}}}}function oe(...t){return m.useCallback(rn(...t),t)}function Jr(t){const e=ZA(t),n=m.forwardRef((r,o)=>{const{children:s,...i}=r,a=m.Children.toArray(s),l=a.find(QA);if(l){const c=l.props.children,u=a.map(d=>d===l?m.Children.count(c)>1?m.Children.only(null):m.isValidElement(c)?c.props.children:null:d);return p.jsx(e,{...i,ref:o,children:m.isValidElement(c)?m.cloneElement(c,void 0,u):null})}return p.jsx(e,{...i,ref:o,children:s})});return n.displayName=`${t}.Slot`,n}function ZA(t){const e=m.forwardRef((n,r)=>{const{children:o,...s}=n;if(m.isValidElement(o)){const i=tO(o),a=eO(s,o.props);return o.type!==m.Fragment&&(a.ref=r?rn(r,i):i),m.cloneElement(o,a)}return m.Children.count(o)>1?m.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Wb=Symbol("radix.slottable");function Ub(t){const e=({children:n})=>p.jsx(p.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=Wb,e}function QA(t){return m.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Wb}function eO(t,e){const n={...e};for(const r in e){const o=t[r],s=e[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{const l=s(...a);return o(...a),l}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...t,...n}}function tO(t){var r,o;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(o=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:o.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function kr(t){const e=t+"CollectionProvider",[n,r]=Ie(e),[o,s]=n(e,{collectionRef:{current:null},itemMap:new Map}),i=b=>{const{scope:y,children:v}=b,x=R.useRef(null),w=R.useRef(new Map).current;return p.jsx(o,{scope:y,itemMap:w,collectionRef:x,children:v})};i.displayName=e;const a=t+"CollectionSlot",l=Jr(a),c=R.forwardRef((b,y)=>{const{scope:v,children:x}=b,w=s(a,v),S=oe(y,w.collectionRef);return p.jsx(l,{ref:S,children:x})});c.displayName=a;const u=t+"CollectionItemSlot",d="data-radix-collection-item",f=Jr(u),h=R.forwardRef((b,y)=>{const{scope:v,children:x,...w}=b,S=R.useRef(null),C=oe(y,S),k=s(u,v);return R.useEffect(()=>(k.itemMap.set(S,{ref:S,...w}),()=>void k.itemMap.delete(S))),p.jsx(f,{[d]:"",ref:C,children:x})});h.displayName=u;function g(b){const y=s(t+"CollectionConsumer",b);return R.useCallback(()=>{const x=y.collectionRef.current;if(!x)return[];const w=Array.from(x.querySelectorAll(`[${d}]`));return Array.from(y.itemMap.values()).sort((k,N)=>w.indexOf(k.ref.current)-w.indexOf(N.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:i,Slot:c,ItemSlot:h},g,r]}function P(t,e,{checkForDefaultPrevented:n=!0}={}){return function(o){if(t==null||t(o),n===!1||!o.defaultPrevented)return e==null?void 0:e(o)}}var De=globalThis!=null&&globalThis.document?m.useLayoutEffect:()=>{},nO=m[" useInsertionEffect ".trim().toString()]||De;function Oe({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[o,s,i]=rO({defaultProp:e,onChange:n}),a=t!==void 0,l=a?t:o;{const u=m.useRef(t!==void 0);m.useEffect(()=>{const d=u.current;d!==a&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=a},[a,r])}const c=m.useCallback(u=>{var d;if(a){const f=oO(u)?u(t):u;f!==t&&((d=i.current)==null||d.call(i,f))}else s(u)},[a,t,s,i]);return[l,c]}function rO({defaultProp:t,onChange:e}){const[n,r]=m.useState(t),o=m.useRef(n),s=m.useRef(e);return nO(()=>{s.current=e},[e]),m.useEffect(()=>{var i;o.current!==n&&((i=s.current)==null||i.call(s,n),o.current=n)},[n,o]),[n,r,s]}function oO(t){return typeof t=="function"}var sO=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Z=sO.reduce((t,e)=>{const n=Jr(`Primitive.${e}`),r=m.forwardRef((o,s)=>{const{asChild:i,...a}=o,l=i?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function Ia(t,e){t&&Vl.flushSync(()=>t.dispatchEvent(e))}function iO(t,e){return m.useReducer((n,r)=>e[n][r]??n,t)}var Pe=t=>{const{present:e,children:n}=t,r=aO(e),o=typeof n=="function"?n({present:r.isPresent}):m.Children.only(n),s=oe(r.ref,lO(o));return typeof n=="function"||r.isPresent?m.cloneElement(o,{ref:s}):null};Pe.displayName="Presence";function aO(t){const[e,n]=m.useState(),r=m.useRef(null),o=m.useRef(t),s=m.useRef("none"),i=t?"mounted":"unmounted",[a,l]=iO(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{const c=ta(r.current);s.current=a==="mounted"?c:"none"},[a]),De(()=>{const c=r.current,u=o.current;if(u!==t){const f=s.current,h=ta(c);t?l("MOUNT"):h==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&f!==h?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,l]),De(()=>{if(e){let c;const u=e.ownerDocument.defaultView??window,d=h=>{const b=ta(r.current).includes(CSS.escape(h.animationName));if(h.target===e&&b&&(l("ANIMATION_END"),!o.current)){const y=e.style.animationFillMode;e.style.animationFillMode="forwards",c=u.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=y)})}},f=h=>{h.target===e&&(s.current=ta(r.current))};return e.addEventListener("animationstart",f),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{u.clearTimeout(c),e.removeEventListener("animationstart",f),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:m.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function ta(t){return(t==null?void 0:t.animationName)||"none"}function lO(t){var r,o;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(o=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:o.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var cO=m[" useId ".trim().toString()]||(()=>{}),uO=0;function Ee(t){const[e,n]=m.useState(cO());return De(()=>{n(r=>r??String(uO++))},[t]),t||(e?`radix-${e}`:"")}var Wl="Collapsible",[dO,Gb]=Ie(Wl),[fO,of]=dO(Wl),Kb=m.forwardRef((t,e)=>{const{__scopeCollapsible:n,open:r,defaultOpen:o,disabled:s,onOpenChange:i,...a}=t,[l,c]=Oe({prop:r,defaultProp:o??!1,onChange:i,caller:Wl});return p.jsx(fO,{scope:n,disabled:s,contentId:Ee(),open:l,onOpenToggle:m.useCallback(()=>c(u=>!u),[c]),children:p.jsx(Z.div,{"data-state":cf(l),"data-disabled":s?"":void 0,...a,ref:e})})});Kb.displayName=Wl;var Yb="CollapsibleTrigger",sf=m.forwardRef((t,e)=>{const{__scopeCollapsible:n,...r}=t,o=of(Yb,n);return p.jsx(Z.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":cf(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...r,ref:e,onClick:P(t.onClick,o.onOpenToggle)})});sf.displayName=Yb;var af="CollapsibleContent",lf=m.forwardRef((t,e)=>{const{forceMount:n,...r}=t,o=of(af,t.__scopeCollapsible);return p.jsx(Pe,{present:n||o.open,children:({present:s})=>p.jsx(pO,{...r,ref:e,present:s})})});lf.displayName=af;var pO=m.forwardRef((t,e)=>{const{__scopeCollapsible:n,present:r,children:o,...s}=t,i=of(af,n),[a,l]=m.useState(r),c=m.useRef(null),u=oe(e,c),d=m.useRef(0),f=d.current,h=m.useRef(0),g=h.current,b=i.open||a,y=m.useRef(b),v=m.useRef(void 0);return m.useEffect(()=>{const x=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(x)},[]),De(()=>{const x=c.current;if(x){v.current=v.current||{transitionDuration:x.style.transitionDuration,animationName:x.style.animationName},x.style.transitionDuration="0s",x.style.animationName="none";const w=x.getBoundingClientRect();d.current=w.height,h.current=w.width,y.current||(x.style.transitionDuration=v.current.transitionDuration,x.style.animationName=v.current.animationName),l(r)}},[i.open,r]),p.jsx(Z.div,{"data-state":cf(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!b,...s,ref:u,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...t.style},children:b&&o})});function cf(t){return t?"open":"closed"}var uf=Kb,qb=sf,Xb=lf,hO=m.createContext(void 0);function an(t){const e=m.useContext(hO);return t||e||"ltr"}var ln="Accordion",mO=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[df,gO,bO]=kr(ln),[Ul]=Ie(ln,[bO,Gb]),ff=Gb(),Jb=R.forwardRef((t,e)=>{const{type:n,...r}=t,o=r,s=r;return p.jsx(df.Provider,{scope:t.__scopeAccordion,children:n==="multiple"?p.jsx(wO,{...s,ref:e}):p.jsx(xO,{...o,ref:e})})});Jb.displayName=ln;var[Zb,yO]=Ul(ln),[Qb,vO]=Ul(ln,{collapsible:!1}),xO=R.forwardRef((t,e)=>{const{value:n,defaultValue:r,onValueChange:o=()=>{},collapsible:s=!1,...i}=t,[a,l]=Oe({prop:n,defaultProp:r??"",onChange:o,caller:ln});return p.jsx(Zb,{scope:t.__scopeAccordion,value:R.useMemo(()=>a?[a]:[],[a]),onItemOpen:l,onItemClose:R.useCallback(()=>s&&l(""),[s,l]),children:p.jsx(Qb,{scope:t.__scopeAccordion,collapsible:s,children:p.jsx(ey,{...i,ref:e})})})}),wO=R.forwardRef((t,e)=>{const{value:n,defaultValue:r,onValueChange:o=()=>{},...s}=t,[i,a]=Oe({prop:n,defaultProp:r??[],onChange:o,caller:ln}),l=R.useCallback(u=>a((d=[])=>[...d,u]),[a]),c=R.useCallback(u=>a((d=[])=>d.filter(f=>f!==u)),[a]);return p.jsx(Zb,{scope:t.__scopeAccordion,value:i,onItemOpen:l,onItemClose:c,children:p.jsx(Qb,{scope:t.__scopeAccordion,collapsible:!0,children:p.jsx(ey,{...s,ref:e})})})}),[SO,Gl]=Ul(ln),ey=R.forwardRef((t,e)=>{const{__scopeAccordion:n,disabled:r,dir:o,orientation:s="vertical",...i}=t,a=R.useRef(null),l=oe(a,e),c=gO(n),d=an(o)==="ltr",f=P(t.onKeyDown,h=>{var E;if(!mO.includes(h.key))return;const g=h.target,b=c().filter(T=>{var O;return!((O=T.ref.current)!=null&&O.disabled)}),y=b.findIndex(T=>T.ref.current===g),v=b.length;if(y===-1)return;h.preventDefault();let x=y;const w=0,S=v-1,C=()=>{x=y+1,x>S&&(x=w)},k=()=>{x=y-1,x<w&&(x=S)};switch(h.key){case"Home":x=w;break;case"End":x=S;break;case"ArrowRight":s==="horizontal"&&(d?C():k());break;case"ArrowDown":s==="vertical"&&C();break;case"ArrowLeft":s==="horizontal"&&(d?k():C());break;case"ArrowUp":s==="vertical"&&k();break}const N=x%v;(E=b[N].ref.current)==null||E.focus()});return p.jsx(SO,{scope:n,disabled:r,direction:o,orientation:s,children:p.jsx(df.Slot,{scope:n,children:p.jsx(Z.div,{...i,"data-orientation":s,ref:l,onKeyDown:r?void 0:f})})})}),Pa="AccordionItem",[CO,pf]=Ul(Pa),ty=R.forwardRef((t,e)=>{const{__scopeAccordion:n,value:r,...o}=t,s=Gl(Pa,n),i=yO(Pa,n),a=ff(n),l=Ee(),c=r&&i.value.includes(r)||!1,u=s.disabled||t.disabled;return p.jsx(CO,{scope:n,open:c,disabled:u,triggerId:l,children:p.jsx(uf,{"data-orientation":s.orientation,"data-state":ay(c),...a,...o,ref:e,disabled:u,open:c,onOpenChange:d=>{d?i.onItemOpen(r):i.onItemClose(r)}})})});ty.displayName=Pa;var ny="AccordionHeader",ry=R.forwardRef((t,e)=>{const{__scopeAccordion:n,...r}=t,o=Gl(ln,n),s=pf(ny,n);return p.jsx(Z.h3,{"data-orientation":o.orientation,"data-state":ay(s.open),"data-disabled":s.disabled?"":void 0,...r,ref:e})});ry.displayName=ny;var Uu="AccordionTrigger",oy=R.forwardRef((t,e)=>{const{__scopeAccordion:n,...r}=t,o=Gl(ln,n),s=pf(Uu,n),i=vO(Uu,n),a=ff(n);return p.jsx(df.ItemSlot,{scope:n,children:p.jsx(qb,{"aria-disabled":s.open&&!i.collapsible||void 0,"data-orientation":o.orientation,id:s.triggerId,...a,...r,ref:e})})});oy.displayName=Uu;var sy="AccordionContent",iy=R.forwardRef((t,e)=>{const{__scopeAccordion:n,...r}=t,o=Gl(ln,n),s=pf(sy,n),i=ff(n);return p.jsx(Xb,{role:"region","aria-labelledby":s.triggerId,"data-orientation":o.orientation,...i,...r,ref:e,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...t.style}})});iy.displayName=sy;function ay(t){return t?"open":"closed"}var kO=Jb,NO=ty,EO=ry,ly=oy,cy=iy;/**
2
2
  * @license lucide-react v0.395.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx as m, Fragment as Ye, jsxs as D } from "react/jsx-runtime";
2
3
  import * as h from "react";
3
4
  import R, { forwardRef as uf, createElement as Xu, useState as xr, createContext as jl, useContext as df, useCallback as Dt, useRef as Yr, useLayoutEffect as ff, useEffect as zo, useMemo as Ho, useDebugValue as Ib } from "react";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vasf/ragnar-core",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -65,7 +65,7 @@
65
65
  "react-day-picker": "^9.13.0",
66
66
  "sonner": "^2.0.7",
67
67
  "tailwind-merge": "^2.3.0",
68
- "@vasf/ragnar-tokens": "1.0.3"
68
+ "@vasf/ragnar-tokens": "1.0.4"
69
69
  },
70
70
  "devDependencies": {
71
71
  "@storybook/addon-essentials": "^8.1.10",