@udixio/ui-react 2.9.11 → 2.9.13

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/CHANGELOG.md CHANGED
@@ -1,3 +1,24 @@
1
+ ## 2.9.13 (2026-01-30)
2
+
3
+ ### 🚀 Features
4
+
5
+ - **ui-react:** sync component state with updated props via `useEffect` ([086671b](https://github.com/Udixio/UI/commit/086671b))
6
+
7
+ ### 🧱 Updated Dependencies
8
+
9
+ - Updated @udixio/tailwind to 2.4.12
10
+ - Updated @udixio/theme to 2.1.12
11
+
12
+ ### ❤️ Thank You
13
+
14
+ - Joël VIGREUX
15
+
16
+ ## 2.9.12 (2026-01-26)
17
+
18
+ ### 🧱 Updated Dependencies
19
+
20
+ - Updated @udixio/tailwind to 2.4.11
21
+
1
22
  ## 2.9.11 (2026-01-26)
2
23
 
3
24
  ### 🧱 Updated Dependencies
package/dist/index.cjs CHANGED
@@ -7,4 +7,4 @@
7
7
  0%, 50% { opacity: 1; }
8
8
  50.01%, 100% { opacity: 0; }
9
9
  }
10
- `})]}),C&&d.jsx(Le,{ref:W,className:"opacity-0",draggable:r,editable:!0,editing:!0,onChange:x=>{var E;if(x=x.replace(/(&nbsp;)+/g," ").trim(),console.log("Ghost chip onChange",x,!!x),x)k(x);else if(c.length>0){const I=h.current[c.length-1];(E=I==null?void 0:I.focus)==null||E.call(I)}},onEditCommit:()=>{},onBlur:()=>{o(!1)},onFocus:x=>{o(!0),x.stopPropagation()},children:" "})]})};function Vt({trigger:e=["hover","focus"],isOpen:t,defaultOpen:n=!1,onOpenChange:r,openDelay:s=400,closeDelay:a=150,id:c}={}){const l=i.useId(),u=c??`tooltip-${l}`,o=Array.isArray(e)?e:[e],f=typeof t=="boolean",[y,h]=i.useState(n?"hovered":"hidden"),[m,p]=i.useState(!1),S=i.useRef(null),b=i.useRef(null),k=i.useCallback(()=>{S.current&&(clearTimeout(S.current),S.current=null),b.current&&(clearTimeout(b.current),b.current=null)},[]);i.useEffect(()=>()=>k(),[k]);const g=i.useCallback(_=>{if(f){const P=_!=="hidden";r==null||r(P)}else{h(_);const P=_!=="hidden";r==null||r(P)}},[f,r]),v=f?t?"hovered":"hidden":y,W=v!=="hidden",C=_=>{switch(_){case"hidden":return 0;case"hovered":return 1;case"focused":return 2;case"clicked":return 3;default:return 0}},x=i.useCallback(_=>{k(),!(C(_)<=C(v))&&(S.current=setTimeout(()=>{g(_)},s))},[k,s,v,g]),E=i.useCallback(_=>{k(),b.current=setTimeout(()=>{(!f&&C(y)<=C(_)||f)&&g("hidden")},a)},[k,a,y,f,g]),I=i.useCallback(()=>{o.includes("hover")&&x("hovered")},[o,x]),M=i.useCallback(()=>{o.includes("hover")&&(v==="focused"||v==="clicked"||m||E("hovered"))},[o,v,m,E]),D=i.useCallback(()=>{o.includes("focus")&&(k(),g("focused"))},[o,k,g]),L=i.useCallback(()=>{if(o.includes("focus")&&v!=="clicked"){if(o.includes("hover")&&m){g("hovered");return}E("focused")}},[o,v,m,E,g]),j=i.useCallback(()=>{o.includes("click")&&(k(),g(v==="clicked"?"hidden":"clicked"))},[o,v,k,g]),N=i.useCallback(_=>{_.key==="Escape"&&W&&(k(),g("hidden"),_.preventDefault())},[W,k,g]),H=i.useCallback(()=>{p(!0),k()},[k]),X=i.useCallback(()=>{p(!1),o.includes("hover")&&v==="hovered"&&E("hovered")},[o,v,E]);return{triggerProps:{"aria-describedby":W?u:void 0,onMouseEnter:I,onMouseLeave:M,onFocus:D,onBlur:L,onClick:j,onKeyDown:N},tooltipProps:{id:u,role:"tooltip","aria-hidden":!W,onMouseEnter:H,onMouseLeave:X},isOpen:W,state:v}}function _t({targetRef:e,position:t,variant:n="plain",isOpen:r}){const[s,a]=i.useState(t??"bottom");return i.useLayoutEffect(()=>{if(t){a(t);return}if(!r||!e.current||typeof window>"u")return;const l=e.current.getBoundingClientRect(),u=window.innerWidth,o=window.innerHeight,f=l.left/u,y=l.top/o;let h;n==="plain"?f<1/3?h="right":f>2/3?h="left":h=y>.5?"top":"bottom":f<.5&&y<.5?h="bottom-right":f>=.5&&y<.5?h="bottom-left":f>=.5&&y>=.5?h="top-left":h="top-right",a(h)},[r,e,t,n]),{resolvedPosition:s}}const $e=({variant:e="plain",buttons:t,className:n,children:r,title:s,text:a,content:c,position:l,targetRef:u,ref:o,trigger:f=["hover","focus"],transition:y,openDelay:h=400,closeDelay:m=150,isOpen:p,defaultOpen:S=!1,onOpenChange:b,id:k,...g})=>{if(y={duration:.3,...y},!r&&!u)throw new Error("Tooltip must have a child or a targetRef");t&&!Array.isArray(t)&&(t=[t]);const v=i.useRef(null),W=u||v,{triggerProps:C,tooltipProps:x,isOpen:E}=Vt({trigger:f,isOpen:p,defaultOpen:S,onOpenChange:b,openDelay:h,closeDelay:m,id:k}),{resolvedPosition:I}=_t({targetRef:W,position:l,variant:e,isOpen:E}),M=!u&&i.isValidElement(r)?i.cloneElement(r,{ref:v,...C,onMouseEnter:j=>{var N,H;C.onMouseEnter(),(H=(N=r.props)==null?void 0:N.onMouseEnter)==null||H.call(N,j)},onMouseLeave:j=>{var N,H;C.onMouseLeave(),(H=(N=r.props)==null?void 0:N.onMouseLeave)==null||H.call(N,j)},onFocus:j=>{var N,H;C.onFocus(),(H=(N=r.props)==null?void 0:N.onFocus)==null||H.call(N,j)},onBlur:j=>{var N,H;C.onBlur(),(H=(N=r.props)==null?void 0:N.onBlur)==null||H.call(N,j)},onClick:j=>{var N,H;C.onClick(),(H=(N=r.props)==null?void 0:N.onClick)==null||H.call(N,j)},onKeyDown:j=>{var N,H;C.onKeyDown(j),(H=(N=r.props)==null?void 0:N.onKeyDown)==null||H.call(N,j)}}):r;i.useEffect(()=>{if(!u)return;const j=u.current;if(!j)return;const N=()=>C.onMouseEnter(),H=()=>C.onMouseLeave(),X=()=>C.onFocus(),_=()=>C.onBlur(),P=()=>C.onClick(),F=U=>C.onKeyDown(U);return j.addEventListener("mouseenter",N),j.addEventListener("mouseleave",H),j.addEventListener("focus",X,!0),j.addEventListener("blur",_,!0),j.addEventListener("click",P),j.addEventListener("keydown",F),C["aria-describedby"]?j.setAttribute("aria-describedby",C["aria-describedby"]):j.removeAttribute("aria-describedby"),()=>{j.removeEventListener("mouseenter",N),j.removeEventListener("mouseleave",H),j.removeEventListener("focus",X,!0),j.removeEventListener("blur",_,!0),j.removeEventListener("click",P),j.removeEventListener("keydown",F)}},[u,C]);const D=Dt({variant:e,buttons:t,className:n,title:s,text:a,position:I,trigger:f,targetRef:u,children:r}),L={open:{opacity:1,height:"auto"},close:{opacity:0,height:16}};return d.jsxs(d.Fragment,{children:[M,d.jsx(O.AnimatePresence,{children:E&&d.jsx(Ht,{targetRef:W,children:d.jsx(O.motion.div,{initial:"close",variants:L,animate:"open",transition:{duration:y.duration},exit:"close",className:D.toolTip,...g,...x,children:d.jsx("div",{className:D.container,children:c?d.jsx("div",{className:D.content,children:c}):d.jsxs(d.Fragment,{children:[s&&d.jsx("div",{className:D.subHead,children:s}),a&&d.jsx("div",{className:D.supportingText,children:a}),t&&d.jsx("div",{className:D.actions,children:Array.isArray(t)&&t.map((j,N)=>d.jsx(Ce,{size:"small",variant:"text",...j},N))})]})})})})})]})},ve=({className:e,label:t,variant:n="primary",size:r="medium",href:s,type:a,icon:c,extended:l=!1,ref:u,transition:o,children:f,...y})=>{if(f&&(t=f),!t)throw new Error("FAB component requires either a label prop or children content");const h=s?"a":"button",m=at({href:s,icon:c,extended:l,label:t,size:r,variant:n,className:e,transition:o,children:t});o={duration:.3,...o};const p=i.useRef(null),S=u||p,b={visible:{width:"auto",marginLeft:12,opacity:1,transition:{...o,opacity:{duration:o.duration/2,delay:o.duration-o.duration/2}}},hidden:{width:0,marginLeft:0,opacity:0,transition:{...o,marginLeft:{duration:o.duration/2,delay:o.duration-o.duration/2}}}};return d.jsxs(h,{...y,ref:S,href:s,"aria-label":l?void 0:t,className:m.fab,children:[d.jsx($e,{trigger:l?null:void 0,text:t,targetRef:S}),d.jsx(ce,{style:{transition:o.duration+"s"},className:m.stateLayer,colorName:w({"on-primary":n=="primary","on-secondary":n=="secondary","on-tertiary":n=="tertiary","on-primary-container":n=="primaryContainer","on-secondary-container":n=="secondaryContainer","on-tertiary-container":n=="tertiaryContainer"}),stateClassName:"state-ripple-group-[fab]"}),d.jsx(le,{icon:c,className:m.icon}),d.jsx(O.AnimatePresence,{children:l&&d.jsx(O.motion.span,{variants:b,initial:"hidden",animate:"visible",exit:"hidden",className:m.label,children:t})})]})},ye=({variant:e="standard",href:t,disabled:n=!1,title:r,label:s,onToggle:a,activated:c=!1,onClick:l,icon:u,size:o="medium",iconSelected:f,className:y,ref:h,width:m="default",shape:p="rounded",allowShapeTransformation:S=!0,transition:b,children:k,...g})=>{if(k&&(s=k),!s)throw new Error("IconButton component requires either a label prop or children content to provide an accessible aria-label");r||(r=s);const[v,W]=i.useState(c),C=D=>{n&&D.preventDefault(),a?(W(!v),a(!v)):l&&l(D)};i.useEffect(()=>{W(c)},[c]);const x=t?"a":"button",E=ft({transition:b,shape:p,allowShapeTransformation:S,width:m,href:t,activated:v,label:s,iconSelected:f,isActive:v,onToggle:a,disabled:n,icon:u,variant:e,className:y,size:o,children:s,...g}),I=i.useRef(null),M=h||I;return b={duration:.3,...b},d.jsxs(x,{disabled:n,href:t,style:{transition:b.duration+"s"},className:E.iconButton,"aria-label":s,...g,title:void 0,onClick:C,ref:M,children:[d.jsx($e,{targetRef:M,trigger:n?null:void 0,text:r}),d.jsx("div",{className:E.touchTarget}),d.jsx(ce,{style:{transition:b.duration+"s"},className:E.stateLayer,colorName:w(e==="standard"&&{"on-surface-variant":!v,"on-primary":v},e==="filled"&&{"on-surface-variant":!v&&!!a,"on-primary":v||!a},e==="tonal"&&{"on-secondary":v&&!!a,"on-secondary-container":!v||!a},e==="outlined"&&{"inverse-on-surface":v&&!!a,"on-surface-variant":!v||!a}),stateClassName:"state-ripple-group-[icon-button]"}),u&&d.jsx(le,{icon:u,className:E.icon})]})},ts=({className:e,label:t,variant:n="primary",size:r="medium",href:s,icon:a,extended:c=!1,ref:l,transition:u,children:o,open:f,defaultOpen:y=!1,onOpenChange:h,...m})=>{u={duration:.3,ease:"easeInOut",...u};const p=i.useRef(null),S=l||p,b=typeof f=="boolean",[k,g]=i.useState(y),v=b?f:k,W=L=>{b||g(L),h==null||h(L)},C=i.Children.toArray(o).filter(L=>i.isValidElement(L)&&L.type===Ce),x=ut({href:s,icon:a,extended:c,label:t,size:r,variant:n,className:e,transition:u,children:t,open:v}),E=O.motion.create(ve),I=O.motion.create(ye),M=L=>d.jsx(E,{icon:a,extended:c,label:t,variant:n+"Container",size:r,className:x.fab+" "+(e??""),"aria-expanded":v,onClick:()=>W(!0),style:{transition:"border-radius 0.3s ease-in-out"},transition:{duration:u.duration,ease:"easeInOut",borderRadius:{duration:u.duration,ease:"easeInOut"},background:{duration:u.duration,ease:"easeInOut"},...u},...L}),[D]=i.useState(pe());return d.jsxs("div",{className:x.fabMenu,ref:S,...m,children:[d.jsx(O.AnimatePresence,{children:v&&d.jsx("div",{className:x.actions,role:"menu","aria-hidden":!v,children:(()=>{const L=C.length;return C.map((j,N)=>{j.props;const H=L-1-N,X=((u==null?void 0:u.delay)??0)+H*.06,_={open:{overflow:"visible",opacity:1,width:"auto",transition:{...u,delay:X,opacity:{delay:(u==null?void 0:u.duration)/2+X}}},close:{overflow:"hidden",opacity:0,width:0,transition:{...u,delay:X,opacity:{duration:(u==null?void 0:u.duration)/1.5}}}};return d.jsx(O.motion.div,{initial:"close",animate:"open",variants:_,transition:u,exit:"close",children:i.cloneElement(j,{key:N,shape:"rounded",variant:"filled",className:()=>({button:w("max-w-full overflow-hidden",{"px-0":!v,"bg-primary-container text-on-primary-container ":n==="primary","bg-secondary-container text-on-secondary-container":n==="secondary","bg-tertiary-container text-on-tertiary-container":n==="tertiary"}),stateLayer:w({"state-on-primary-container":n==="primary","state-on-secondary-container":n==="secondary","state-on-tertiary-container":n==="tertiary"})})})})})})()})}),M({className:"invisible pointer-events-none"}),d.jsxs("div",{className:"absolute right-0 top-0",children:[!v&&M({className:"",layout:!0,layoutId:"fab-menu"+D}),v&&d.jsx(d.Fragment,{children:d.jsx(I,{layout:!0,layoutId:"fab-menu"+D,variant:"filled",className:()=>({iconButton:w("",{"bg-primary text-on-primary":n==="primary","bg-secondary text-on-secondary":n==="secondary","bg-tertiary text-on-tertiary":n==="tertiary"}),stateLayer:w({"[--default-color:var(--color-on-primary)]":n==="primary","[--default-color:var(--color-on-secondary)]":n==="secondary","[--default-color:var(--color-on-tertiary)]":n==="tertiary"})}),style:{transition:"border-radius 0.3s ease-in-out"},transition:{duration:u.duration,ease:"easeInOut",borderRadius:{duration:u.duration,ease:"easeInOut"},background:{duration:u.duration,ease:"easeInOut"},...u},icon:zn,onClick:()=>W(!1),children:"Close"})})]})]})},ns=({className:e,valueFormatter:t,step:n=10,name:r,value:s=0,min:a=0,max:c=100,marks:l=[{value:0,label:"0"},{value:100,label:"100"}],ref:u,onChange:o,...f})=>{const y=P=>{const F=m(),U=h();return P===1/0?100:P===-1/0?0:(P-F)/(U-F)*100},h=(P=!1)=>P?c:c==1/0?l[(l==null?void 0:l.length)-1].value:c,m=(P=!1)=>P?a:a==-1/0?l[0].value:a,p=P=>{const F=m(!1);return(h(!1)-F)*P/100+F},[S,b]=i.useState(!1),k=i.useRef(null),g=u||k,[v,W]=i.useState(s),[C,x]=i.useState(y(s)),[E,I]=i.useState(!1),M=P=>{I(!0),b(!0),j(P)},D=()=>{I(!1),b(!1)};i.useEffect(()=>(E?(window.addEventListener("mouseup",D),window.addEventListener("mousemove",j),window.addEventListener("touchend",D),window.addEventListener("touchmove",j)):(window.removeEventListener("mouseup",D),window.removeEventListener("mousemove",j),window.removeEventListener("touchend",D),window.removeEventListener("touchmove",j)),()=>{window.removeEventListener("mouseup",D),window.removeEventListener("mousemove",j),window.removeEventListener("touchend",D),window.removeEventListener("touchmove",j)}),[E]);const L=yt({className:e,isChanging:S,marks:l,max:c,min:a,name:r,step:n,value:v,valueFormatter:t,onChange:o}),j=P=>{const F=g==null?void 0:g.current;if(F){const U=F.getBoundingClientRect().left,re=((P.type==="touchmove"||P.type==="touchstart"?P.touches[0].clientX:P.clientX)-U)/F.offsetWidth*100;N({percent:re})}},N=({percent:P,value:F})=>{if(P){if(P>=100){W(h(!0)),x(100);return}if(P<=0){W(m(!0)),x(0);return}F=p(P),F==m()&&(F=m(!0)),F==h()&&(F=h(!0))}else if(F!=null){if(F>=h()){W(h(!0)),x(100);return}if(F<=m()){W(m(!0)),x(0);return}P=y(F)}else return;n!=null?F=Math.round((F-m())/n)*n+m():l&&(F=l.reduce((U,G,re)=>{let ie=G.value===1/0?h():G.value===-1/0?m():G.value,B=U.value===1/0?h():U.value===-1/0?m():U.value;return ie=Math.abs(ie-F),B=Math.abs(B-F),ie<B?G:U}).value),F>=h()&&(F=h(!0)),F<=m()&&(F=m(!0)),P=y(F),W(F),x(P),o&&o(F)},[H,X]=i.useState(0);i.useEffect(()=>{const P=()=>{g.current&&X(g.current.offsetWidth)};return P(),window.addEventListener("resize",P),()=>{window.removeEventListener("resize",P)}},[]);const _=P=>{switch(P.key){case"ArrowRight":if(n)N({value:v+n});else if(l){const F=l.find(U=>U.value>v);F&&N({value:F.value})}break;case"ArrowLeft":if(n)N({value:v-n});else if(l){const F=l.slice(0).reverse().find((U,G,re)=>v===1/0?G===1:U.value<v);F&&N({value:F.value})}break;default:return}};return d.jsxs("div",{tabIndex:0,onKeyDown:_,role:"slider","aria-valuemin":m(!0),"aria-valuemax":h(!0),"aria-valuenow":v,"aria-valuetext":v.toString(),className:L.slider,onMouseDown:M,onClick:j,ref:g,onTouchStart:M,onDragStart:P=>P.preventDefault(),...f,children:[d.jsx("input",{type:"hidden",name:r,value:v}),d.jsx("div",{className:L.activeTrack,style:{flex:C/100}}),d.jsx("div",{className:L.handle,children:d.jsx(O.AnimatePresence,{children:S&&d.jsx(O.motion.div,{className:L.valueIndicator,initial:"hidden",animate:"visible",exit:"hidden",style:{translate:"-50%",transformOrigin:"center bottom",textWrap:"nowrap"},variants:{visible:{opacity:1,scale:1},hidden:{opacity:1,scale:0}},transition:{duration:.1},children:t?t(v):v})})}),d.jsx("div",{className:L.inactiveTrack,style:{flex:1-C/100}}),d.jsx("div",{className:"w-[calc(100%-12px)] h-full absolute -translate-x-1/2 transform left-1/2",children:l&&l.map((P,F)=>{let U=null;const G=(S?9:10)/H*100,re=y(P.value);return re<=C-G?U=!0:re>=C+G&&(U=!1),d.jsx("div",{className:w(L.dot,{"bg-primary-container":U!=null&&U,"bg-primary":U!=null&&!U}),style:{left:`${y(P.value)}%`}},F)})})]})},ss=({variant:e="standard",className:t,children:n,title:r,position:s="right",extended:a,divider:c,onExtendedChange:l,closeIcon:u=me,transition:o,...f})=>{o={duration:.3,...o};const[y,h]=i.useState(a??!0),m=pt({transition:o,title:r,position:s,closeIcon:u,className:t,children:n,onExtendedChange:l,divider:c,isExtended:y,extended:y,variant:e});i.useEffect(()=>{l==null||l(y??!1)},[y]),i.useEffect(()=>{a!=null&&h(a)},[a]);const p={close:{width:0},open:{width:"auto"}},S=()=>d.jsxs(d.Fragment,{children:[d.jsx(O.AnimatePresence,{children:e=="modal"&&y&&d.jsx(O.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:o,onClick:()=>h(!1),className:m.overlay})}),d.jsx(O.AnimatePresence,{children:y&&d.jsxs("div",{...f,className:m.sideSheet,style:{transition:o.duration+"s"},children:[d.jsxs(O.motion.div,{variants:p,initial:a===!1?"open":"close",animate:"open",exit:"close",className:m.container,children:[d.jsxs("div",{className:m.header,children:[r&&d.jsx("p",{className:m.title,children:r}),d.jsx(ye,{size:"small",label:"close",icon:u,onClick:()=>h(!1),className:m.closeButton})]}),d.jsx("div",{className:m.content,style:{transition:o.duration+"s"},children:n})]}),(c==null&&e=="standard"?!0:c)&&d.jsx(De,{className:m.divider,orientation:"vertical"})]})})]});return e=="modal"?qe.createPortal(S(),document.body):S()},rs=({message:e,className:t,duration:n,closeIcon:r=me,onClose:s,...a})=>{const[c,l]=i.useState(!0),u=vt({className:t,closeIcon:r,duration:n,isVisible:c,onClose:s,message:e});i.useEffect(()=>{n&&setTimeout(()=>{o()},n)},[n]);const o=()=>{l(!1),s==null||s()};return d.jsx(O.AnimatePresence,{children:c&&d.jsx(O.motion.div,{initial:{height:0},animate:{height:"auto"},exit:{height:0},transition:{duration:.1},className:u.snackbar,...a,children:d.jsxs("div",{className:u.container,children:[d.jsx("p",{className:u.supportingText,children:e}),d.jsx(ye,{onClick:()=>o(),className:u.icon,icon:r,label:"close the snackbar"})]})})})},os=({selected:e=!1,className:t,activeIcon:n,disabled:r=!1,inactiveIcon:s,onChange:a,onClick:c,onKeyDown:l,ref:u,...o})=>{const[f,y]=i.useState(e),h=g=>{r||(p(),c&&c(g))},m=g=>{r||((g.key===" "||g.key==="Enter")&&(g.preventDefault(),p()),l&&l(g))},p=()=>{y(!f),a==null||a(!f)},S=gt({className:t,isSelected:f,activeIcon:n,inactiveIcon:s,disabled:r,selected:f,onChange:a}),b=i.useRef(null),k=u||b;return d.jsxs(O.motion.div,{role:"switch","aria-checked":f,tabIndex:r?-1:0,onKeyDown:m,onClick:h,ref:k,className:S.switch,...o,children:[d.jsx("input",{type:"hidden",value:f?"1":"0"}),d.jsxs(O.motion.div,{layout:!0,style:{translate:f?"50%":"-50%"},transition:{type:"spring",stiffness:700,damping:30},className:S.handleContainer,children:[d.jsx("div",{className:S.handle,children:(f?n:s)&&d.jsx(le,{className:S.icon,icon:f?n:s})}),d.jsx("div",{className:S.handleStateLayer})]})]})},qt=({className:e,onClick:t,label:n,variant:r="primary",href:s,icon:a,selectedTab:c,setSelectedTab:l,tabsId:u,index:o,onTabSelected:f,scrollable:y=!1,selected:h=!1,children:m,ref:p,...S})=>{const b=i.useRef(null),k=p||b,g=n??(typeof m=="string"?m:void 0),[v,W]=i.useState(h);i.useEffect(()=>{h&&c==null?W(!0):W(c==o&&o!=null)},[c]),i.useEffect(()=>{c==o&&f&&f({ref:k,index:o||0,label:g,icon:a})},[c]);const C=s?"a":"button",x=I=>{l&&l(o??null),t&&t(I)},E=St({className:e,onTabSelected:f,scrollable:y,selectedTab:c,index:o,tabsId:u,selected:v,variant:r,icon:a,label:g,isSelected:v,setSelectedTab:l,href:s});return d.jsxs(C,{...S,role:"tab","aria-selected":v,ref:k,href:s,className:E.tab,onClick:x,...S,children:[d.jsx(ce,{style:{transition:.3+"s"},className:E.stateLayer,colorName:r==="primary"&&v?"primary":"on-surface",stateClassName:"state-ripple-group-[tab]"}),d.jsxs("span",{className:E.content,children:[a&&d.jsx(le,{icon:a,className:E.icon}),d.jsx("span",{className:E.label,children:g}),v&&d.jsx(O.motion.span,{layoutId:`underline-${u}`,className:E.underline,transition:{duration:.3}})]})]})},We=i.createContext(null),is=({variant:e="primary",onTabSelected:t,children:n,className:r,selectedTab:s,setSelectedTab:a,scrollable:c=!1})=>{const l=i.useContext(We),[u,o]=i.useState(null);let f;s===0||s!=null?f=s:l?f=l.selectedTab:f=u;const y=a??(l==null?void 0:l.setSelectedTab)??o,h=i.Children.toArray(n).filter(k=>i.isValidElement(k)&&k.type===qt),m=i.useRef(null),p=k=>{if(t==null||t(k),c){const g=m.current,v=k.ref.current;if(g&&v){const W=v.offsetLeft+v.offsetWidth/2-g.offsetWidth/2;g.scrollTo({left:W,behavior:"smooth"})}}},S=i.useMemo(()=>(l==null?void 0:l.tabsId)??pe(),[l==null?void 0:l.tabsId]),b=Nt({children:n,onTabSelected:t,scrollable:c,selectedTab:f,setSelectedTab:y,className:r,variant:e});return d.jsx("div",{ref:m,role:"tablist",className:b.tabs,children:h.map((k,g)=>i.cloneElement(k,{key:g,index:g,variant:e,selectedTab:f,setSelectedTab:y,tabsId:S,onTabSelected:p,scrollable:c}))})},ls=({children:e,selectedTab:t,setSelectedTab:n,defaultTab:r=0})=>{const[s,a]=i.useState(r),c=i.useRef(null),l=t!==void 0?t:s,u=n??a,o=c.current!==null&&l!==null?l>c.current?1:-1:0;l!==c.current&&(c.current=l);const f=i.useMemo(()=>pe(),[]),y=i.useMemo(()=>({selectedTab:l,setSelectedTab:u,previousTab:c.current,direction:o,tabsId:f}),[l,u,o,f]);return d.jsx(We.Provider,{value:y,children:e})},Xt=({children:e,className:t,isSelected:n=!1})=>{const r=It({children:e,className:t,isSelected:n});return d.jsx("div",{className:r.tabPanel,children:e})},as=({children:e,className:t})=>{const n=i.useContext(We);if(!n)return console.warn("TabPanels must be used within a TabGroup"),null;const{selectedTab:r,direction:s,tabsId:a}=n,c=i.Children.toArray(e).filter(u=>i.isValidElement(u)&&u.type===Xt),l=kt({children:e,className:t});return d.jsx("div",{className:l.tabPanels,children:d.jsx(O.AnimatePresence,{initial:!1,custom:s,mode:"popLayout",children:c.map((u,o)=>r===o&&d.jsx(O.motion.div,{custom:s,variants:{enter:f=>({x:f*100+"%",opacity:1}),center:{x:0,opacity:1},exit:f=>({x:f*-100+"%",opacity:1})},initial:"enter",animate:"center",exit:"exit",transition:{type:"spring",stiffness:400,damping:40},role:"tabpanel","aria-labelledby":`tab-${a}-${o}`,children:i.cloneElement(u,{isSelected:!0})},o))})})},cs=({variant:e="filled",disabled:t=!1,errorText:n,placeholder:r,suffix:s,name:a,label:c,className:l,supportingText:u,trailingIcon:o,leadingIcon:f,type:y="text",textLine:h="singleLine",autoComplete:m="on",onChange:p,value:S,showSupportingText:b=!1,...k})=>{const[g,v]=i.useState(S??""),[W,C]=i.useState(!1),[x,E]=i.useState(!1),[I,M]=i.useState(b);i.useEffect(()=>{v(S??"")},[S]),i.useEffect(()=>{n!=null&&n.length?E(!0):E(!1)},[n]),i.useEffect(()=>{b?M(b):u!=null&&u.length?M(!0):M(!1)},[I,u]),i.useEffect(()=>{W&&E(!1)},[W]);const D=i.useRef(null),L=()=>{D.current&&!W&&D.current.focus()},j=()=>{C(!0)},N=U=>{const G=U.target.value;v(G),E(!1),typeof p=="function"&&p(G)},H=()=>{C(!1)},X=Rt({showSupportingText:I,isFocused:W,showErrorIcon:x,disabled:t,name:a,label:c,autoComplete:m,className:l,onChange:p,placeholder:r,supportingText:u,type:y,leadingIcon:f,trailingIcon:o,variant:e,errorText:n,value:g,suffix:s,textLine:h}),[_]=i.useState(pe());let P,F;switch(h){case"multiLine":F=Jt,P={};break;case"textAreas":F="textarea",P={};break;case"singleLine":default:F="input",P={type:y};break}return d.jsxs("div",{className:X.textField,...k,children:[d.jsxs("fieldset",{onClick:L,className:X.content,children:[d.jsx("div",{className:X.stateLayer}),f&&d.jsx("div",{className:X.leadingIcon,children:i.isValidElement(f)?f:d.jsx(le,{className:"w-5 h-5",icon:f})}),!(!W&&!g.length||e=="filled")&&d.jsx(O.motion.legend,{variants:{hidden:{width:0,padding:0},visible:{width:"auto",padding:"0 8px"}},initial:"hidden",animate:!W&&!g.length?"hidden":"visible",className:"max-w-full ml-2 px-2 text-body-small h-0",transition:{duration:.2},children:d.jsx("span",{className:"transform inline-flex -translate-y-1/2",children:d.jsx(O.motion.span,{className:X.label,transition:{duration:.3},layoutId:_,children:c})})}),d.jsxs("div",{className:"flex-1 relative",children:[(!W&&!g.length||e=="filled")&&d.jsx(O.motion.label,{htmlFor:a,className:w("absolute left-4 transition-all duration-300",{"text-body-small top-2":e=="filled"&&!(!W&&!g.length),"text-body-large top-1/2 transform -translate-y-1/2":!(e=="filled"&&!(!W&&!g.length))}),transition:{duration:.3},children:d.jsx(O.motion.span,{className:X.label,transition:{duration:.3},layoutId:e=="outlined"?_:void 0,children:c})}),d.jsx(F,{ref:D,value:g,onChange:N,className:X.input,id:a,name:a,placeholder:W?r??void 0:"",onFocus:j,onBlur:H,disabled:t,autoComplete:m,"aria-invalid":!!(n!=null&&n.length),"aria-label":c,...P})]}),d.jsx("div",{className:X.activeIndicator}),!x&&d.jsxs(d.Fragment,{children:[o&&d.jsx("div",{onClick:U=>{U.stopPropagation()},className:X.trailingIcon,children:i.isValidElement(o)?o:d.jsx(le,{className:"h-5",icon:o})}),!o&&s&&d.jsx("span",{className:X.suffix,children:s})]}),x&&d.jsx("div",{className:w(X.trailingIcon,{" absolute right-0":!o}),children:d.jsx(le,{className:"h-5 text-error",icon:Un})})]}),I&&d.jsx("p",{className:X.supportingText,children:n!=null&&n.length?n:u!=null&&u.length?u:" "})]})},us=({isSelected:e,icon:t,label:n,variant:r})=>({navigationRailItem:w(" group/navigation-rail-item flex flex-col pt-1 pb-1.5 cursor-pointer",{"text-on-surface-variant":!e,"text-on-secondary-container":e,"gap-2 h-[68px]":r=="vertical","gap-0 h-[66px]":r=="horizontal"}),container:w(" w-fit flex justify-center relative rounded-full items-center mx-5",{"bg-secondary-container overflow-hidden":e,"gap-2 ":r=="horizontal","gap-0 ":r=="vertical","p-4":!n},n&&["px-4",{"py-1 ":r=="vertical","py-4 ":r=="horizontal"}]),stateLayer:w("rounded-full"),icon:w("size-6 flex"),label:w("w-fit mx-auto text-nowrap",{"text-label-large ":r=="horizontal","text-label-medium":r=="vertical"})}),ds=J("navigationRailItem",us),Ut=({label:e})=>d.jsx("div",{className:" h-9 flex items-center mx-9 mt-3",children:d.jsx("p",{className:"text-label-large text-on-surface-variant",children:e})}),Yt=({className:e,onClick:t,label:n,variant:r="vertical",href:s,icon:a,selectedItem:c,setSelectedItem:l,index:u,onItemSelected:o,selected:f=!1,ref:y,transition:h,isExtended:m,iconSelected:p,style:S,extendedOnly:b,children:k,...g})=>{k&&(n=k);const v=i.useRef(null),W=y||v,[C,x]=i.useState(f);i.useEffect(()=>{f&&c==null?x(!0):x(c==u&&u!=null)},[c]),i.useEffect(()=>{c==u&&o&&o({ref:W,index:u||0,label:n,icon:a})},[c]);const E=s?"a":"button",I=D=>{l&&l(u??null),t&&t(D)},M=ds({isExtended:m,extendedOnly:b,className:e,onItemSelected:o,selectedItem:c,index:u,transition:h,selected:C,variant:r,icon:a,label:n,isSelected:C,setSelectedItem:l,href:s,children:n,iconSelected:p});return h={duration:.3,...h},b&&!m?null:d.jsxs(E,{...g,role:"tab","aria-selected":C,ref:W,href:s,className:M.navigationRailItem,onClick:I,style:{transition:h.duration+"s",...S},children:[d.jsxs(O.motion.div,{style:{transition:r=="horizontal"?h.duration+`s, gap ${h.duration/2}s ${h.duration-h.duration/2}s`:h.duration+`s, gap ${h.duration/3}s ${h.duration-h.duration/3}s`},transition:h,className:M.container,children:[d.jsx(ce,{style:{transition:h.duration+"s"},className:M.stateLayer,colorName:w({"on-surface":!C,"on-secondary-container":C}),stateClassName:"state-ripple-group-[navigation-rail-item]"}),a&&d.jsx(le,{icon:C?p:a,className:M.icon}),d.jsx(O.AnimatePresence,{children:r=="horizontal"&&(()=>{const D={width:0,opacity:0,transition:{...h}},L={width:"auto",opacity:1,transition:{...h,opacity:{duration:h.duration/2,delay:h.duration-h.duration/2}}};return d.jsx(O.motion.span,{initial:D,animate:L,exit:D,className:M.label,children:n})})()})]}),d.jsx(O.AnimatePresence,{children:r=="vertical"&&(()=>{const D={height:0,opacity:0,transition:{...h,opacity:{duration:0}}},L={height:"auto",opacity:1,transition:{...h,opacity:{duration:h.duration/3,delay:h.duration-h.duration/3}}};return d.jsx(O.motion.span,{initial:L,animate:L,exit:D,className:M.label,transition:h,children:n})})()})]})},fs=({isExtended:e,alignment:t})=>({navigationRail:w("flex flex-col left-0 h-full top-0 pt-11",{"w-fit max-w-24":!e,"w-fit min-w-[220px] max-w-[360px]":e,"justify-between":t=="middle","justify-start":t=="top"}),header:w("flex flex-col gap-1 items-start"),menuIcon:"mx-5",segments:w(" flex flex-col overflow-auto min-w-full mt-10",{"w-full":!e,"w-fit items-start":e})}),hs=J("navigationRail",fs),ms=({variant:e="standard",onItemSelected:t,children:n,className:r,selectedItem:s,extended:a,alignment:c="top",menu:l={closed:{icon:Kn,label:"Open menu"},opened:{icon:me,label:"Close menu"}},style:u,onExtendedChange:o,transition:f,setSelectedItem:y})=>{const[h,m]=i.useState(null),[p,S]=i.useState(a);let b;s==0||s!=null?b=s:b=h;const k=y||m,g=i.useRef(null),v=M=>{t==null||t(M)};function W(M){const D=[];return i.Children.forEach(M,L=>{i.isValidElement(L)&&L.type===i.Fragment?D.push(...W(L.props.children)):D.push(L)}),D}const C=W(n),x=C.filter(M=>i.isValidElement(M)&&M.type===ve),E=hs({children:n,onItemSelected:t,selectedItem:b,setSelectedItem:k,className:r,variant:e,extended:p,isExtended:p,alignment:c,menu:l,transition:f,onExtendedChange:o});f={duration:.3,...f};const I=i.useRef(!1);return I.current=!1,i.useEffect(()=>{o==null||o(p??!1)},[p]),d.jsxs("div",{style:{transition:f.duration+"s",...u},ref:g,className:E.navigationRail,children:[d.jsxs("div",{className:E.header,children:[d.jsx(ye,{onClick:()=>S(!p),label:p?l==null?void 0:l.opened.label:l==null?void 0:l.closed.label,className:E.menuIcon,icon:p?l.opened.icon:l==null?void 0:l.closed.icon}),x.length>0&&i.cloneElement(x[0],{transition:f,isExtended:p,className:"!shadow-none mx-5 "+x[0].props.className})]}),d.jsx("div",{className:E.segments,children:(()=>{let M=0;return C.map(D=>i.isValidElement(D)&&D.type===Yt?i.cloneElement(D,{key:M,index:M++,variant:p?"horizontal":"vertical",selectedItem:b,setSelectedItem:k,onItemSelected:v,transition:f,extendedOnly:I.current,isExtended:p}):i.isValidElement(D)&&D.type===ve?null:i.isValidElement(D)&&D.type===Ut?(I.current=!0,p?i.cloneElement(D,{}):null):D)})()}),d.jsx("div",{className:"flex-1 max-h-[160px]"})]})};function ps(e){return xe.defineConfig({variant:xe.Variants.Udixio,...e,plugins:[new xe.FontPlugin(e),new Xe.TailwindPlugin(e)]})}exports.AnimateOnScrollInit=On;exports.Button=Ce;exports.Card=qn;exports.Carousel=Xn;exports.CarouselItem=Ot;exports.Chip=Le;exports.Chips=es;exports.CustomScroll=Pt;exports.Divider=De;exports.Fab=ve;exports.FabMenu=ts;exports.Icon=le;exports.IconButton=ye;exports.NavigationRail=ms;exports.NavigationRailItem=Yt;exports.NavigationRailSection=Ut;exports.ProgressIndicator=$t;exports.RippleEffect=Wt;exports.SideSheet=ss;exports.Slider=ns;exports.SmoothScroll=Dn;exports.Snackbar=rs;exports.State=ce;exports.Switch=os;exports.SyncedFixedWrapper=Ht;exports.Tab=qt;exports.TabGroup=ls;exports.TabPanel=Xt;exports.TabPanels=as;exports.Tabs=is;exports.TextField=cs;exports.ThemeProvider=An;exports.Tooltip=$e;exports.animateOnScroll=Vn;exports.buttonStyle=en;exports.cardStyle=tn;exports.carouselItemConfig=ke;exports.carouselItemStyle=nn;exports.carouselStyle=sn;exports.chipStyle=rn;exports.chipsStyle=on;exports.classNames=w;exports.classnames=Ye;exports.createUseClassNames=J;exports.customScrollStyle=At;exports.defaultClassNames=Z;exports.defineConfig=ps;exports.dividerStyle=ln;exports.fabMenuStyle=cn;exports.fabStyle=an;exports.getClassNames=we;exports.iconButtonStyle=un;exports.initAnimateOnScroll=Re;exports.normalize=de;exports.progressIndicatorStyle=dn;exports.sideSheetConfig=je;exports.sideSheetStyle=pt;exports.sliderConfig=Ie;exports.sliderStyle=hn;exports.snackbarStyle=mn;exports.switchStyle=pn;exports.tabPanelStyle=wn;exports.tabPanelsStyle=vn;exports.tabStyle=yn;exports.tabsStyle=xn;exports.textFieldStyle=gn;exports.toolStyle=bn;exports.useButtonStyle=Ke;exports.useCardStyle=Je;exports.useCarouselItemStyle=Ze;exports.useCarouselStyle=et;exports.useChipStyle=nt;exports.useChipsStyle=rt;exports.useClassNames=Qt;exports.useDividerStyle=it;exports.useFabMenuStyle=ut;exports.useFabStyle=at;exports.useIconButtonStyle=ft;exports.useProgressIndicatorStyle=mt;exports.useSideSheetStyle=fn;exports.useSliderStyle=yt;exports.useSnackbarStyle=vt;exports.useStateStyle=Tt;exports.useSwitchStyle=gt;exports.useTabPanelStyle=It;exports.useTabPanelsStyle=kt;exports.useTabStyle=St;exports.useTabsStyle=Nt;exports.useTextFieldStyle=Rt;exports.useToolTipStyle=Dt;exports.useTooltipPosition=_t;exports.useTooltipTrigger=Vt;
10
+ `})]}),C&&d.jsx(Le,{ref:W,className:"opacity-0",draggable:r,editable:!0,editing:!0,onChange:x=>{var E;if(x=x.replace(/(&nbsp;)+/g," ").trim(),console.log("Ghost chip onChange",x,!!x),x)k(x);else if(c.length>0){const I=h.current[c.length-1];(E=I==null?void 0:I.focus)==null||E.call(I)}},onEditCommit:()=>{},onBlur:()=>{o(!1)},onFocus:x=>{o(!0),x.stopPropagation()},children:" "})]})};function Vt({trigger:e=["hover","focus"],isOpen:t,defaultOpen:n=!1,onOpenChange:r,openDelay:s=400,closeDelay:a=150,id:c}={}){const l=i.useId(),u=c??`tooltip-${l}`,o=Array.isArray(e)?e:[e],f=typeof t=="boolean",[y,h]=i.useState(n?"hovered":"hidden"),[m,p]=i.useState(!1),S=i.useRef(null),b=i.useRef(null),k=i.useCallback(()=>{S.current&&(clearTimeout(S.current),S.current=null),b.current&&(clearTimeout(b.current),b.current=null)},[]);i.useEffect(()=>()=>k(),[k]);const g=i.useCallback(_=>{if(f){const P=_!=="hidden";r==null||r(P)}else{h(_);const P=_!=="hidden";r==null||r(P)}},[f,r]),v=f?t?"hovered":"hidden":y,W=v!=="hidden",C=_=>{switch(_){case"hidden":return 0;case"hovered":return 1;case"focused":return 2;case"clicked":return 3;default:return 0}},x=i.useCallback(_=>{k(),!(C(_)<=C(v))&&(S.current=setTimeout(()=>{g(_)},s))},[k,s,v,g]),E=i.useCallback(_=>{k(),b.current=setTimeout(()=>{(!f&&C(y)<=C(_)||f)&&g("hidden")},a)},[k,a,y,f,g]),I=i.useCallback(()=>{o.includes("hover")&&x("hovered")},[o,x]),M=i.useCallback(()=>{o.includes("hover")&&(v==="focused"||v==="clicked"||m||E("hovered"))},[o,v,m,E]),D=i.useCallback(()=>{o.includes("focus")&&(k(),g("focused"))},[o,k,g]),L=i.useCallback(()=>{if(o.includes("focus")&&v!=="clicked"){if(o.includes("hover")&&m){g("hovered");return}E("focused")}},[o,v,m,E,g]),j=i.useCallback(()=>{o.includes("click")&&(k(),g(v==="clicked"?"hidden":"clicked"))},[o,v,k,g]),N=i.useCallback(_=>{_.key==="Escape"&&W&&(k(),g("hidden"),_.preventDefault())},[W,k,g]),H=i.useCallback(()=>{p(!0),k()},[k]),X=i.useCallback(()=>{p(!1),o.includes("hover")&&v==="hovered"&&E("hovered")},[o,v,E]);return{triggerProps:{"aria-describedby":W?u:void 0,onMouseEnter:I,onMouseLeave:M,onFocus:D,onBlur:L,onClick:j,onKeyDown:N},tooltipProps:{id:u,role:"tooltip","aria-hidden":!W,onMouseEnter:H,onMouseLeave:X},isOpen:W,state:v}}function _t({targetRef:e,position:t,variant:n="plain",isOpen:r}){const[s,a]=i.useState(t??"bottom");return i.useLayoutEffect(()=>{if(t){a(t);return}if(!r||!e.current||typeof window>"u")return;const l=e.current.getBoundingClientRect(),u=window.innerWidth,o=window.innerHeight,f=l.left/u,y=l.top/o;let h;n==="plain"?f<1/3?h="right":f>2/3?h="left":h=y>.5?"top":"bottom":f<.5&&y<.5?h="bottom-right":f>=.5&&y<.5?h="bottom-left":f>=.5&&y>=.5?h="top-left":h="top-right",a(h)},[r,e,t,n]),{resolvedPosition:s}}const $e=({variant:e="plain",buttons:t,className:n,children:r,title:s,text:a,content:c,position:l,targetRef:u,ref:o,trigger:f=["hover","focus"],transition:y,openDelay:h=400,closeDelay:m=150,isOpen:p,defaultOpen:S=!1,onOpenChange:b,id:k,...g})=>{if(y={duration:.3,...y},!r&&!u)throw new Error("Tooltip must have a child or a targetRef");t&&!Array.isArray(t)&&(t=[t]);const v=i.useRef(null),W=u||v,{triggerProps:C,tooltipProps:x,isOpen:E}=Vt({trigger:f,isOpen:p,defaultOpen:S,onOpenChange:b,openDelay:h,closeDelay:m,id:k}),{resolvedPosition:I}=_t({targetRef:W,position:l,variant:e,isOpen:E}),M=!u&&i.isValidElement(r)?i.cloneElement(r,{ref:v,...C,onMouseEnter:j=>{var N,H;C.onMouseEnter(),(H=(N=r.props)==null?void 0:N.onMouseEnter)==null||H.call(N,j)},onMouseLeave:j=>{var N,H;C.onMouseLeave(),(H=(N=r.props)==null?void 0:N.onMouseLeave)==null||H.call(N,j)},onFocus:j=>{var N,H;C.onFocus(),(H=(N=r.props)==null?void 0:N.onFocus)==null||H.call(N,j)},onBlur:j=>{var N,H;C.onBlur(),(H=(N=r.props)==null?void 0:N.onBlur)==null||H.call(N,j)},onClick:j=>{var N,H;C.onClick(),(H=(N=r.props)==null?void 0:N.onClick)==null||H.call(N,j)},onKeyDown:j=>{var N,H;C.onKeyDown(j),(H=(N=r.props)==null?void 0:N.onKeyDown)==null||H.call(N,j)}}):r;i.useEffect(()=>{if(!u)return;const j=u.current;if(!j)return;const N=()=>C.onMouseEnter(),H=()=>C.onMouseLeave(),X=()=>C.onFocus(),_=()=>C.onBlur(),P=()=>C.onClick(),F=U=>C.onKeyDown(U);return j.addEventListener("mouseenter",N),j.addEventListener("mouseleave",H),j.addEventListener("focus",X,!0),j.addEventListener("blur",_,!0),j.addEventListener("click",P),j.addEventListener("keydown",F),C["aria-describedby"]?j.setAttribute("aria-describedby",C["aria-describedby"]):j.removeAttribute("aria-describedby"),()=>{j.removeEventListener("mouseenter",N),j.removeEventListener("mouseleave",H),j.removeEventListener("focus",X,!0),j.removeEventListener("blur",_,!0),j.removeEventListener("click",P),j.removeEventListener("keydown",F)}},[u,C]);const D=Dt({variant:e,buttons:t,className:n,title:s,text:a,position:I,trigger:f,targetRef:u,children:r}),L={open:{opacity:1,height:"auto"},close:{opacity:0,height:16}};return d.jsxs(d.Fragment,{children:[M,d.jsx(O.AnimatePresence,{children:E&&d.jsx(Ht,{targetRef:W,children:d.jsx(O.motion.div,{initial:"close",variants:L,animate:"open",transition:{duration:y.duration},exit:"close",className:D.toolTip,...g,...x,children:d.jsx("div",{className:D.container,children:c?d.jsx("div",{className:D.content,children:c}):d.jsxs(d.Fragment,{children:[s&&d.jsx("div",{className:D.subHead,children:s}),a&&d.jsx("div",{className:D.supportingText,children:a}),t&&d.jsx("div",{className:D.actions,children:Array.isArray(t)&&t.map((j,N)=>d.jsx(Ce,{size:"small",variant:"text",...j},N))})]})})})})})]})},ve=({className:e,label:t,variant:n="primary",size:r="medium",href:s,type:a,icon:c,extended:l=!1,ref:u,transition:o,children:f,...y})=>{if(f&&(t=f),!t)throw new Error("FAB component requires either a label prop or children content");const h=s?"a":"button",m=at({href:s,icon:c,extended:l,label:t,size:r,variant:n,className:e,transition:o,children:t});o={duration:.3,...o};const p=i.useRef(null),S=u||p,b={visible:{width:"auto",marginLeft:12,opacity:1,transition:{...o,opacity:{duration:o.duration/2,delay:o.duration-o.duration/2}}},hidden:{width:0,marginLeft:0,opacity:0,transition:{...o,marginLeft:{duration:o.duration/2,delay:o.duration-o.duration/2}}}};return d.jsxs(h,{...y,ref:S,href:s,"aria-label":l?void 0:t,className:m.fab,children:[d.jsx($e,{trigger:l?null:void 0,text:t,targetRef:S}),d.jsx(ce,{style:{transition:o.duration+"s"},className:m.stateLayer,colorName:w({"on-primary":n=="primary","on-secondary":n=="secondary","on-tertiary":n=="tertiary","on-primary-container":n=="primaryContainer","on-secondary-container":n=="secondaryContainer","on-tertiary-container":n=="tertiaryContainer"}),stateClassName:"state-ripple-group-[fab]"}),d.jsx(le,{icon:c,className:m.icon}),d.jsx(O.AnimatePresence,{children:l&&d.jsx(O.motion.span,{variants:b,initial:"hidden",animate:"visible",exit:"hidden",className:m.label,children:t})})]})},ye=({variant:e="standard",href:t,disabled:n=!1,title:r,label:s,onToggle:a,activated:c=!1,onClick:l,icon:u,size:o="medium",iconSelected:f,className:y,ref:h,width:m="default",shape:p="rounded",allowShapeTransformation:S=!0,transition:b,children:k,...g})=>{if(k&&(s=k),!s)throw new Error("IconButton component requires either a label prop or children content to provide an accessible aria-label");r||(r=s);const[v,W]=i.useState(c),C=D=>{n&&D.preventDefault(),a?(W(!v),a(!v)):l&&l(D)};i.useEffect(()=>{W(c)},[c]);const x=t?"a":"button",E=ft({transition:b,shape:p,allowShapeTransformation:S,width:m,href:t,activated:v,label:s,iconSelected:f,isActive:v,onToggle:a,disabled:n,icon:u,variant:e,className:y,size:o,children:s,...g}),I=i.useRef(null),M=h||I;return b={duration:.3,...b},d.jsxs(x,{disabled:n,href:t,style:{transition:b.duration+"s"},className:E.iconButton,"aria-label":s,...g,title:void 0,onClick:C,ref:M,children:[d.jsx($e,{targetRef:M,trigger:n?null:void 0,text:r}),d.jsx("div",{className:E.touchTarget}),d.jsx(ce,{style:{transition:b.duration+"s"},className:E.stateLayer,colorName:w(e==="standard"&&{"on-surface-variant":!v,"on-primary":v},e==="filled"&&{"on-surface-variant":!v&&!!a,"on-primary":v||!a},e==="tonal"&&{"on-secondary":v&&!!a,"on-secondary-container":!v||!a},e==="outlined"&&{"inverse-on-surface":v&&!!a,"on-surface-variant":!v||!a}),stateClassName:"state-ripple-group-[icon-button]"}),u&&d.jsx(le,{icon:u,className:E.icon})]})},ts=({className:e,label:t,variant:n="primary",size:r="medium",href:s,icon:a,extended:c=!1,ref:l,transition:u,children:o,open:f,defaultOpen:y=!1,onOpenChange:h,...m})=>{u={duration:.3,ease:"easeInOut",...u};const p=i.useRef(null),S=l||p,b=typeof f=="boolean",[k,g]=i.useState(y),v=b?f:k,W=L=>{b||g(L),h==null||h(L)},C=i.Children.toArray(o).filter(L=>i.isValidElement(L)&&L.type===Ce),x=ut({href:s,icon:a,extended:c,label:t,size:r,variant:n,className:e,transition:u,children:t,open:v}),E=O.motion.create(ve),I=O.motion.create(ye),M=L=>d.jsx(E,{icon:a,extended:c,label:t,variant:n+"Container",size:r,className:x.fab+" "+(e??""),"aria-expanded":v,onClick:()=>W(!0),style:{transition:"border-radius 0.3s ease-in-out"},transition:{duration:u.duration,ease:"easeInOut",borderRadius:{duration:u.duration,ease:"easeInOut"},background:{duration:u.duration,ease:"easeInOut"},...u},...L}),[D]=i.useState(pe());return d.jsxs("div",{className:x.fabMenu,ref:S,...m,children:[d.jsx(O.AnimatePresence,{children:v&&d.jsx("div",{className:x.actions,role:"menu","aria-hidden":!v,children:(()=>{const L=C.length;return C.map((j,N)=>{j.props;const H=L-1-N,X=((u==null?void 0:u.delay)??0)+H*.06,_={open:{overflow:"visible",opacity:1,width:"auto",transition:{...u,delay:X,opacity:{delay:(u==null?void 0:u.duration)/2+X}}},close:{overflow:"hidden",opacity:0,width:0,transition:{...u,delay:X,opacity:{duration:(u==null?void 0:u.duration)/1.5}}}};return d.jsx(O.motion.div,{initial:"close",animate:"open",variants:_,transition:u,exit:"close",children:i.cloneElement(j,{key:N,shape:"rounded",variant:"filled",className:()=>({button:w("max-w-full overflow-hidden",{"px-0":!v,"bg-primary-container text-on-primary-container ":n==="primary","bg-secondary-container text-on-secondary-container":n==="secondary","bg-tertiary-container text-on-tertiary-container":n==="tertiary"}),stateLayer:w({"state-on-primary-container":n==="primary","state-on-secondary-container":n==="secondary","state-on-tertiary-container":n==="tertiary"})})})})})})()})}),M({className:"invisible pointer-events-none"}),d.jsxs("div",{className:"absolute right-0 top-0",children:[!v&&M({className:"",layout:!0,layoutId:"fab-menu"+D}),v&&d.jsx(d.Fragment,{children:d.jsx(I,{layout:!0,layoutId:"fab-menu"+D,variant:"filled",className:()=>({iconButton:w("",{"bg-primary text-on-primary":n==="primary","bg-secondary text-on-secondary":n==="secondary","bg-tertiary text-on-tertiary":n==="tertiary"}),stateLayer:w({"[--default-color:var(--color-on-primary)]":n==="primary","[--default-color:var(--color-on-secondary)]":n==="secondary","[--default-color:var(--color-on-tertiary)]":n==="tertiary"})}),style:{transition:"border-radius 0.3s ease-in-out"},transition:{duration:u.duration,ease:"easeInOut",borderRadius:{duration:u.duration,ease:"easeInOut"},background:{duration:u.duration,ease:"easeInOut"},...u},icon:zn,onClick:()=>W(!1),children:"Close"})})]})]})},ns=({className:e,valueFormatter:t,step:n=10,name:r,value:s=0,min:a=0,max:c=100,marks:l=[{value:0,label:"0"},{value:100,label:"100"}],ref:u,onChange:o,...f})=>{const y=P=>{const F=m(),U=h();return P===1/0?100:P===-1/0?0:(P-F)/(U-F)*100},h=(P=!1)=>P?c:c==1/0?l[(l==null?void 0:l.length)-1].value:c,m=(P=!1)=>P?a:a==-1/0?l[0].value:a,p=P=>{const F=m(!1);return(h(!1)-F)*P/100+F},[S,b]=i.useState(!1),k=i.useRef(null),g=u||k,[v,W]=i.useState(s),[C,x]=i.useState(y(s)),[E,I]=i.useState(!1);i.useEffect(()=>{W(s),x(y(s))},[s]);const M=P=>{I(!0),b(!0),j(P)},D=()=>{I(!1),b(!1)};i.useEffect(()=>(E?(window.addEventListener("mouseup",D),window.addEventListener("mousemove",j),window.addEventListener("touchend",D),window.addEventListener("touchmove",j)):(window.removeEventListener("mouseup",D),window.removeEventListener("mousemove",j),window.removeEventListener("touchend",D),window.removeEventListener("touchmove",j)),()=>{window.removeEventListener("mouseup",D),window.removeEventListener("mousemove",j),window.removeEventListener("touchend",D),window.removeEventListener("touchmove",j)}),[E]);const L=yt({className:e,isChanging:S,marks:l,max:c,min:a,name:r,step:n,value:v,valueFormatter:t,onChange:o}),j=P=>{const F=g==null?void 0:g.current;if(F){const U=F.getBoundingClientRect().left,re=((P.type==="touchmove"||P.type==="touchstart"?P.touches[0].clientX:P.clientX)-U)/F.offsetWidth*100;N({percent:re})}},N=({percent:P,value:F})=>{if(P){if(P>=100){W(h(!0)),x(100);return}if(P<=0){W(m(!0)),x(0);return}F=p(P),F==m()&&(F=m(!0)),F==h()&&(F=h(!0))}else if(F!=null){if(F>=h()){W(h(!0)),x(100);return}if(F<=m()){W(m(!0)),x(0);return}P=y(F)}else return;n!=null?F=Math.round((F-m())/n)*n+m():l&&(F=l.reduce((U,G,re)=>{let ie=G.value===1/0?h():G.value===-1/0?m():G.value,B=U.value===1/0?h():U.value===-1/0?m():U.value;return ie=Math.abs(ie-F),B=Math.abs(B-F),ie<B?G:U}).value),F>=h()&&(F=h(!0)),F<=m()&&(F=m(!0)),P=y(F),W(F),x(P),o&&o(F)},[H,X]=i.useState(0);i.useEffect(()=>{const P=()=>{g.current&&X(g.current.offsetWidth)};return P(),window.addEventListener("resize",P),()=>{window.removeEventListener("resize",P)}},[]);const _=P=>{switch(P.key){case"ArrowRight":if(n)N({value:v+n});else if(l){const F=l.find(U=>U.value>v);F&&N({value:F.value})}break;case"ArrowLeft":if(n)N({value:v-n});else if(l){const F=l.slice(0).reverse().find((U,G,re)=>v===1/0?G===1:U.value<v);F&&N({value:F.value})}break;default:return}};return d.jsxs("div",{tabIndex:0,onKeyDown:_,role:"slider","aria-valuemin":m(!0),"aria-valuemax":h(!0),"aria-valuenow":v,"aria-valuetext":v.toString(),className:L.slider,onMouseDown:M,onClick:j,ref:g,onTouchStart:M,onDragStart:P=>P.preventDefault(),...f,children:[d.jsx("input",{type:"hidden",name:r,value:v}),d.jsx("div",{className:L.activeTrack,style:{flex:C/100}}),d.jsx("div",{className:L.handle,children:d.jsx(O.AnimatePresence,{children:S&&d.jsx(O.motion.div,{className:L.valueIndicator,initial:"hidden",animate:"visible",exit:"hidden",style:{translate:"-50%",transformOrigin:"center bottom",textWrap:"nowrap"},variants:{visible:{opacity:1,scale:1},hidden:{opacity:1,scale:0}},transition:{duration:.1},children:t?t(v):v})})}),d.jsx("div",{className:L.inactiveTrack,style:{flex:1-C/100}}),d.jsx("div",{className:"w-[calc(100%-12px)] h-full absolute -translate-x-1/2 transform left-1/2",children:l&&l.map((P,F)=>{let U=null;const G=(S?9:10)/H*100,re=y(P.value);return re<=C-G?U=!0:re>=C+G&&(U=!1),d.jsx("div",{className:w(L.dot,{"bg-primary-container":U!=null&&U,"bg-primary":U!=null&&!U}),style:{left:`${y(P.value)}%`}},F)})})]})},ss=({variant:e="standard",className:t,children:n,title:r,position:s="right",extended:a,divider:c,onExtendedChange:l,closeIcon:u=me,transition:o,...f})=>{o={duration:.3,...o};const[y,h]=i.useState(a??!0),m=pt({transition:o,title:r,position:s,closeIcon:u,className:t,children:n,onExtendedChange:l,divider:c,isExtended:y,extended:y,variant:e});i.useEffect(()=>{l==null||l(y??!1)},[y]),i.useEffect(()=>{a!=null&&h(a)},[a]);const p={close:{width:0},open:{width:"auto"}},S=()=>d.jsxs(d.Fragment,{children:[d.jsx(O.AnimatePresence,{children:e=="modal"&&y&&d.jsx(O.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:o,onClick:()=>h(!1),className:m.overlay})}),d.jsx(O.AnimatePresence,{children:y&&d.jsxs("div",{...f,className:m.sideSheet,style:{transition:o.duration+"s"},children:[d.jsxs(O.motion.div,{variants:p,initial:a===!1?"open":"close",animate:"open",exit:"close",className:m.container,children:[d.jsxs("div",{className:m.header,children:[r&&d.jsx("p",{className:m.title,children:r}),d.jsx(ye,{size:"small",label:"close",icon:u,onClick:()=>h(!1),className:m.closeButton})]}),d.jsx("div",{className:m.content,style:{transition:o.duration+"s"},children:n})]}),(c==null&&e=="standard"?!0:c)&&d.jsx(De,{className:m.divider,orientation:"vertical"})]})})]});return e=="modal"?qe.createPortal(S(),document.body):S()},rs=({message:e,className:t,duration:n,closeIcon:r=me,onClose:s,...a})=>{const[c,l]=i.useState(!0),u=vt({className:t,closeIcon:r,duration:n,isVisible:c,onClose:s,message:e});i.useEffect(()=>{n&&setTimeout(()=>{o()},n)},[n]);const o=()=>{l(!1),s==null||s()};return d.jsx(O.AnimatePresence,{children:c&&d.jsx(O.motion.div,{initial:{height:0},animate:{height:"auto"},exit:{height:0},transition:{duration:.1},className:u.snackbar,...a,children:d.jsxs("div",{className:u.container,children:[d.jsx("p",{className:u.supportingText,children:e}),d.jsx(ye,{onClick:()=>o(),className:u.icon,icon:r,label:"close the snackbar"})]})})})},os=({selected:e=!1,className:t,activeIcon:n,disabled:r=!1,inactiveIcon:s,onChange:a,onClick:c,onKeyDown:l,ref:u,...o})=>{const[f,y]=i.useState(e);i.useEffect(()=>{y(e)},[e]);const h=g=>{r||(p(),c&&c(g))},m=g=>{r||((g.key===" "||g.key==="Enter")&&(g.preventDefault(),p()),l&&l(g))},p=()=>{y(!f),a==null||a(!f)},S=gt({className:t,isSelected:f,activeIcon:n,inactiveIcon:s,disabled:r,selected:f,onChange:a}),b=i.useRef(null),k=u||b;return d.jsxs(O.motion.div,{role:"switch","aria-checked":f,tabIndex:r?-1:0,onKeyDown:m,onClick:h,ref:k,className:S.switch,...o,children:[d.jsx("input",{type:"hidden",value:f?"1":"0"}),d.jsxs(O.motion.div,{layout:!0,style:{translate:f?"50%":"-50%"},transition:{type:"spring",stiffness:700,damping:30},className:S.handleContainer,children:[d.jsx("div",{className:S.handle,children:(f?n:s)&&d.jsx(le,{className:S.icon,icon:f?n:s})}),d.jsx("div",{className:S.handleStateLayer})]})]})},qt=({className:e,onClick:t,label:n,variant:r="primary",href:s,icon:a,selectedTab:c,setSelectedTab:l,tabsId:u,index:o,onTabSelected:f,scrollable:y=!1,selected:h=!1,children:m,ref:p,...S})=>{const b=i.useRef(null),k=p||b,g=n??(typeof m=="string"?m:void 0),[v,W]=i.useState(h);i.useEffect(()=>{h&&c==null?W(!0):W(c==o&&o!=null)},[c]),i.useEffect(()=>{c==o&&f&&f({ref:k,index:o||0,label:g,icon:a})},[c]);const C=s?"a":"button",x=I=>{l&&l(o??null),t&&t(I)},E=St({className:e,onTabSelected:f,scrollable:y,selectedTab:c,index:o,tabsId:u,selected:v,variant:r,icon:a,label:g,isSelected:v,setSelectedTab:l,href:s});return d.jsxs(C,{...S,role:"tab","aria-selected":v,ref:k,href:s,className:E.tab,onClick:x,...S,children:[d.jsx(ce,{style:{transition:.3+"s"},className:E.stateLayer,colorName:r==="primary"&&v?"primary":"on-surface",stateClassName:"state-ripple-group-[tab]"}),d.jsxs("span",{className:E.content,children:[a&&d.jsx(le,{icon:a,className:E.icon}),d.jsx("span",{className:E.label,children:g}),v&&d.jsx(O.motion.span,{layoutId:`underline-${u}`,className:E.underline,transition:{duration:.3}})]})]})},We=i.createContext(null),is=({variant:e="primary",onTabSelected:t,children:n,className:r,selectedTab:s,setSelectedTab:a,scrollable:c=!1})=>{const l=i.useContext(We),[u,o]=i.useState(null);let f;s===0||s!=null?f=s:l?f=l.selectedTab:f=u;const y=a??(l==null?void 0:l.setSelectedTab)??o,h=i.Children.toArray(n).filter(k=>i.isValidElement(k)&&k.type===qt),m=i.useRef(null),p=k=>{if(t==null||t(k),c){const g=m.current,v=k.ref.current;if(g&&v){const W=v.offsetLeft+v.offsetWidth/2-g.offsetWidth/2;g.scrollTo({left:W,behavior:"smooth"})}}},S=i.useMemo(()=>(l==null?void 0:l.tabsId)??pe(),[l==null?void 0:l.tabsId]),b=Nt({children:n,onTabSelected:t,scrollable:c,selectedTab:f,setSelectedTab:y,className:r,variant:e});return d.jsx("div",{ref:m,role:"tablist",className:b.tabs,children:h.map((k,g)=>i.cloneElement(k,{key:g,index:g,variant:e,selectedTab:f,setSelectedTab:y,tabsId:S,onTabSelected:p,scrollable:c}))})},ls=({children:e,selectedTab:t,setSelectedTab:n,defaultTab:r=0})=>{const[s,a]=i.useState(r),c=i.useRef(null),l=t!==void 0?t:s,u=n??a,o=c.current!==null&&l!==null?l>c.current?1:-1:0;l!==c.current&&(c.current=l);const f=i.useMemo(()=>pe(),[]),y=i.useMemo(()=>({selectedTab:l,setSelectedTab:u,previousTab:c.current,direction:o,tabsId:f}),[l,u,o,f]);return d.jsx(We.Provider,{value:y,children:e})},Xt=({children:e,className:t,isSelected:n=!1})=>{const r=It({children:e,className:t,isSelected:n});return d.jsx("div",{className:r.tabPanel,children:e})},as=({children:e,className:t})=>{const n=i.useContext(We);if(!n)return console.warn("TabPanels must be used within a TabGroup"),null;const{selectedTab:r,direction:s,tabsId:a}=n,c=i.Children.toArray(e).filter(u=>i.isValidElement(u)&&u.type===Xt),l=kt({children:e,className:t});return d.jsx("div",{className:l.tabPanels,children:d.jsx(O.AnimatePresence,{initial:!1,custom:s,mode:"popLayout",children:c.map((u,o)=>r===o&&d.jsx(O.motion.div,{custom:s,variants:{enter:f=>({x:f*100+"%",opacity:1}),center:{x:0,opacity:1},exit:f=>({x:f*-100+"%",opacity:1})},initial:"enter",animate:"center",exit:"exit",transition:{type:"spring",stiffness:400,damping:40},role:"tabpanel","aria-labelledby":`tab-${a}-${o}`,children:i.cloneElement(u,{isSelected:!0})},o))})})},cs=({variant:e="filled",disabled:t=!1,errorText:n,placeholder:r,suffix:s,name:a,label:c,className:l,supportingText:u,trailingIcon:o,leadingIcon:f,type:y="text",textLine:h="singleLine",autoComplete:m="on",onChange:p,value:S,showSupportingText:b=!1,...k})=>{const[g,v]=i.useState(S??""),[W,C]=i.useState(!1),[x,E]=i.useState(!1),[I,M]=i.useState(b);i.useEffect(()=>{v(S??"")},[S]),i.useEffect(()=>{n!=null&&n.length?E(!0):E(!1)},[n]),i.useEffect(()=>{b?M(b):u!=null&&u.length?M(!0):M(!1)},[I,u]),i.useEffect(()=>{W&&E(!1)},[W]);const D=i.useRef(null),L=()=>{D.current&&!W&&D.current.focus()},j=()=>{C(!0)},N=U=>{const G=U.target.value;v(G),E(!1),typeof p=="function"&&p(G)},H=()=>{C(!1)},X=Rt({showSupportingText:I,isFocused:W,showErrorIcon:x,disabled:t,name:a,label:c,autoComplete:m,className:l,onChange:p,placeholder:r,supportingText:u,type:y,leadingIcon:f,trailingIcon:o,variant:e,errorText:n,value:g,suffix:s,textLine:h}),[_]=i.useState(pe());let P,F;switch(h){case"multiLine":F=Jt,P={};break;case"textAreas":F="textarea",P={};break;case"singleLine":default:F="input",P={type:y};break}return d.jsxs("div",{className:X.textField,...k,children:[d.jsxs("fieldset",{onClick:L,className:X.content,children:[d.jsx("div",{className:X.stateLayer}),f&&d.jsx("div",{className:X.leadingIcon,children:i.isValidElement(f)?f:d.jsx(le,{className:"w-5 h-5",icon:f})}),!(!W&&!g.length||e=="filled")&&d.jsx(O.motion.legend,{variants:{hidden:{width:0,padding:0},visible:{width:"auto",padding:"0 8px"}},initial:"hidden",animate:!W&&!g.length?"hidden":"visible",className:"max-w-full ml-2 px-2 text-body-small h-0",transition:{duration:.2},children:d.jsx("span",{className:"transform inline-flex -translate-y-1/2",children:d.jsx(O.motion.span,{className:X.label,transition:{duration:.3},layoutId:_,children:c})})}),d.jsxs("div",{className:"flex-1 relative",children:[(!W&&!g.length||e=="filled")&&d.jsx(O.motion.label,{htmlFor:a,className:w("absolute left-4 transition-all duration-300",{"text-body-small top-2":e=="filled"&&!(!W&&!g.length),"text-body-large top-1/2 transform -translate-y-1/2":!(e=="filled"&&!(!W&&!g.length))}),transition:{duration:.3},children:d.jsx(O.motion.span,{className:X.label,transition:{duration:.3},layoutId:e=="outlined"?_:void 0,children:c})}),d.jsx(F,{ref:D,value:g,onChange:N,className:X.input,id:a,name:a,placeholder:W?r??void 0:"",onFocus:j,onBlur:H,disabled:t,autoComplete:m,"aria-invalid":!!(n!=null&&n.length),"aria-label":c,...P})]}),d.jsx("div",{className:X.activeIndicator}),!x&&d.jsxs(d.Fragment,{children:[o&&d.jsx("div",{onClick:U=>{U.stopPropagation()},className:X.trailingIcon,children:i.isValidElement(o)?o:d.jsx(le,{className:"h-5",icon:o})}),!o&&s&&d.jsx("span",{className:X.suffix,children:s})]}),x&&d.jsx("div",{className:w(X.trailingIcon,{" absolute right-0":!o}),children:d.jsx(le,{className:"h-5 text-error",icon:Un})})]}),I&&d.jsx("p",{className:X.supportingText,children:n!=null&&n.length?n:u!=null&&u.length?u:" "})]})},us=({isSelected:e,icon:t,label:n,variant:r})=>({navigationRailItem:w(" group/navigation-rail-item flex flex-col pt-1 pb-1.5 cursor-pointer",{"text-on-surface-variant":!e,"text-on-secondary-container":e,"gap-2 h-[68px]":r=="vertical","gap-0 h-[66px]":r=="horizontal"}),container:w(" w-fit flex justify-center relative rounded-full items-center mx-5",{"bg-secondary-container overflow-hidden":e,"gap-2 ":r=="horizontal","gap-0 ":r=="vertical","p-4":!n},n&&["px-4",{"py-1 ":r=="vertical","py-4 ":r=="horizontal"}]),stateLayer:w("rounded-full"),icon:w("size-6 flex"),label:w("w-fit mx-auto text-nowrap",{"text-label-large ":r=="horizontal","text-label-medium":r=="vertical"})}),ds=J("navigationRailItem",us),Ut=({label:e})=>d.jsx("div",{className:" h-9 flex items-center mx-9 mt-3",children:d.jsx("p",{className:"text-label-large text-on-surface-variant",children:e})}),Yt=({className:e,onClick:t,label:n,variant:r="vertical",href:s,icon:a,selectedItem:c,setSelectedItem:l,index:u,onItemSelected:o,selected:f=!1,ref:y,transition:h,isExtended:m,iconSelected:p,style:S,extendedOnly:b,children:k,...g})=>{k&&(n=k);const v=i.useRef(null),W=y||v,[C,x]=i.useState(f);i.useEffect(()=>{f&&c==null?x(!0):x(c==u&&u!=null)},[c]),i.useEffect(()=>{c==u&&o&&o({ref:W,index:u||0,label:n,icon:a})},[c]);const E=s?"a":"button",I=D=>{l&&l(u??null),t&&t(D)},M=ds({isExtended:m,extendedOnly:b,className:e,onItemSelected:o,selectedItem:c,index:u,transition:h,selected:C,variant:r,icon:a,label:n,isSelected:C,setSelectedItem:l,href:s,children:n,iconSelected:p});return h={duration:.3,...h},b&&!m?null:d.jsxs(E,{...g,role:"tab","aria-selected":C,ref:W,href:s,className:M.navigationRailItem,onClick:I,style:{transition:h.duration+"s",...S},children:[d.jsxs(O.motion.div,{style:{transition:r=="horizontal"?h.duration+`s, gap ${h.duration/2}s ${h.duration-h.duration/2}s`:h.duration+`s, gap ${h.duration/3}s ${h.duration-h.duration/3}s`},transition:h,className:M.container,children:[d.jsx(ce,{style:{transition:h.duration+"s"},className:M.stateLayer,colorName:w({"on-surface":!C,"on-secondary-container":C}),stateClassName:"state-ripple-group-[navigation-rail-item]"}),a&&d.jsx(le,{icon:C?p:a,className:M.icon}),d.jsx(O.AnimatePresence,{children:r=="horizontal"&&(()=>{const D={width:0,opacity:0,transition:{...h}},L={width:"auto",opacity:1,transition:{...h,opacity:{duration:h.duration/2,delay:h.duration-h.duration/2}}};return d.jsx(O.motion.span,{initial:D,animate:L,exit:D,className:M.label,children:n})})()})]}),d.jsx(O.AnimatePresence,{children:r=="vertical"&&(()=>{const D={height:0,opacity:0,transition:{...h,opacity:{duration:0}}},L={height:"auto",opacity:1,transition:{...h,opacity:{duration:h.duration/3,delay:h.duration-h.duration/3}}};return d.jsx(O.motion.span,{initial:L,animate:L,exit:D,className:M.label,transition:h,children:n})})()})]})},fs=({isExtended:e,alignment:t})=>({navigationRail:w("flex flex-col left-0 h-full top-0 pt-11",{"w-fit max-w-24":!e,"w-fit min-w-[220px] max-w-[360px]":e,"justify-between":t=="middle","justify-start":t=="top"}),header:w("flex flex-col gap-1 items-start"),menuIcon:"mx-5",segments:w(" flex flex-col overflow-auto min-w-full mt-10",{"w-full":!e,"w-fit items-start":e})}),hs=J("navigationRail",fs),ms=({variant:e="standard",onItemSelected:t,children:n,className:r,selectedItem:s,extended:a,alignment:c="top",menu:l={closed:{icon:Kn,label:"Open menu"},opened:{icon:me,label:"Close menu"}},style:u,onExtendedChange:o,transition:f,setSelectedItem:y})=>{const[h,m]=i.useState(null),[p,S]=i.useState(a);let b;s==0||s!=null?b=s:b=h;const k=y||m,g=i.useRef(null),v=M=>{t==null||t(M)};function W(M){const D=[];return i.Children.forEach(M,L=>{i.isValidElement(L)&&L.type===i.Fragment?D.push(...W(L.props.children)):D.push(L)}),D}const C=W(n),x=C.filter(M=>i.isValidElement(M)&&M.type===ve),E=hs({children:n,onItemSelected:t,selectedItem:b,setSelectedItem:k,className:r,variant:e,extended:p,isExtended:p,alignment:c,menu:l,transition:f,onExtendedChange:o});f={duration:.3,...f};const I=i.useRef(!1);return I.current=!1,i.useEffect(()=>{o==null||o(p??!1)},[p]),d.jsxs("div",{style:{transition:f.duration+"s",...u},ref:g,className:E.navigationRail,children:[d.jsxs("div",{className:E.header,children:[d.jsx(ye,{onClick:()=>S(!p),label:p?l==null?void 0:l.opened.label:l==null?void 0:l.closed.label,className:E.menuIcon,icon:p?l.opened.icon:l==null?void 0:l.closed.icon}),x.length>0&&i.cloneElement(x[0],{transition:f,isExtended:p,className:"!shadow-none mx-5 "+x[0].props.className})]}),d.jsx("div",{className:E.segments,children:(()=>{let M=0;return C.map(D=>i.isValidElement(D)&&D.type===Yt?i.cloneElement(D,{key:M,index:M++,variant:p?"horizontal":"vertical",selectedItem:b,setSelectedItem:k,onItemSelected:v,transition:f,extendedOnly:I.current,isExtended:p}):i.isValidElement(D)&&D.type===ve?null:i.isValidElement(D)&&D.type===Ut?(I.current=!0,p?i.cloneElement(D,{}):null):D)})()}),d.jsx("div",{className:"flex-1 max-h-[160px]"})]})};function ps(e){return xe.defineConfig({variant:xe.Variants.Udixio,...e,plugins:[new xe.FontPlugin(e),new Xe.TailwindPlugin(e)]})}exports.AnimateOnScrollInit=On;exports.Button=Ce;exports.Card=qn;exports.Carousel=Xn;exports.CarouselItem=Ot;exports.Chip=Le;exports.Chips=es;exports.CustomScroll=Pt;exports.Divider=De;exports.Fab=ve;exports.FabMenu=ts;exports.Icon=le;exports.IconButton=ye;exports.NavigationRail=ms;exports.NavigationRailItem=Yt;exports.NavigationRailSection=Ut;exports.ProgressIndicator=$t;exports.RippleEffect=Wt;exports.SideSheet=ss;exports.Slider=ns;exports.SmoothScroll=Dn;exports.Snackbar=rs;exports.State=ce;exports.Switch=os;exports.SyncedFixedWrapper=Ht;exports.Tab=qt;exports.TabGroup=ls;exports.TabPanel=Xt;exports.TabPanels=as;exports.Tabs=is;exports.TextField=cs;exports.ThemeProvider=An;exports.Tooltip=$e;exports.animateOnScroll=Vn;exports.buttonStyle=en;exports.cardStyle=tn;exports.carouselItemConfig=ke;exports.carouselItemStyle=nn;exports.carouselStyle=sn;exports.chipStyle=rn;exports.chipsStyle=on;exports.classNames=w;exports.classnames=Ye;exports.createUseClassNames=J;exports.customScrollStyle=At;exports.defaultClassNames=Z;exports.defineConfig=ps;exports.dividerStyle=ln;exports.fabMenuStyle=cn;exports.fabStyle=an;exports.getClassNames=we;exports.iconButtonStyle=un;exports.initAnimateOnScroll=Re;exports.normalize=de;exports.progressIndicatorStyle=dn;exports.sideSheetConfig=je;exports.sideSheetStyle=pt;exports.sliderConfig=Ie;exports.sliderStyle=hn;exports.snackbarStyle=mn;exports.switchStyle=pn;exports.tabPanelStyle=wn;exports.tabPanelsStyle=vn;exports.tabStyle=yn;exports.tabsStyle=xn;exports.textFieldStyle=gn;exports.toolStyle=bn;exports.useButtonStyle=Ke;exports.useCardStyle=Je;exports.useCarouselItemStyle=Ze;exports.useCarouselStyle=et;exports.useChipStyle=nt;exports.useChipsStyle=rt;exports.useClassNames=Qt;exports.useDividerStyle=it;exports.useFabMenuStyle=ut;exports.useFabStyle=at;exports.useIconButtonStyle=ft;exports.useProgressIndicatorStyle=mt;exports.useSideSheetStyle=fn;exports.useSliderStyle=yt;exports.useSnackbarStyle=vt;exports.useStateStyle=Tt;exports.useSwitchStyle=gt;exports.useTabPanelStyle=It;exports.useTabPanelsStyle=kt;exports.useTabStyle=St;exports.useTabsStyle=Nt;exports.useTextFieldStyle=Rt;exports.useToolTipStyle=Dt;exports.useTooltipPosition=_t;exports.useTooltipTrigger=Vt;
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ var A = (e, t, n) => kt(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  import { jsx as m, jsxs as G, Fragment as pe } from "react/jsx-runtime";
5
5
  import { clsx as ze } from "clsx";
6
6
  import { extendTailwindMerge as It } from "tailwind-merge";
7
- import q, { useMemo as Se, useState as P, useEffect as O, useRef as _, useLayoutEffect as We, useId as Mt, useCallback as de, isValidElement as ge, cloneElement as Ee, createContext as Ct, useContext as Ke, Children as Rt, Fragment as $t } from "react";
7
+ import q, { useMemo as Se, useState as O, useEffect as P, useRef as _, useLayoutEffect as We, useId as Mt, useCallback as de, isValidElement as ge, cloneElement as Ee, createContext as Ct, useContext as Ke, Children as Rt, Fragment as $t } from "react";
8
8
  import { motion as ee, AnimatePresence as fe, useScroll as Dt, useMotionValueEvent as Fe, animate as Wt } from "motion/react";
9
9
  import { createPortal as je } from "react-dom";
10
10
  import { loader as At, defineConfig as Bt, FontPlugin as Ht, Variants as Ft } from "@udixio/theme";
@@ -956,12 +956,12 @@ const Ze = ({
956
956
  className: s,
957
957
  ...r
958
958
  }) => {
959
- const [l, a] = P(t), [i] = P(1.5);
960
- O(() => {
959
+ const [l, a] = O(t), [i] = O(1.5);
960
+ P(() => {
961
961
  t > 100 && (t = 100), t < 0 && (t = 0), a(t);
962
962
  }, [t]);
963
- const [c, o] = P(!0), u = () => c ? i : i * 0.5;
964
- O(() => {
963
+ const [c, o] = O(!0), u = () => c ? i : i * 0.5;
964
+ P(() => {
965
965
  if ((e === "circular-indeterminate" || e === "linear-indeterminate") && l !== 100) {
966
966
  const f = setInterval(() => {
967
967
  a(c ? 10 : 90), o(!c);
@@ -969,8 +969,8 @@ const Ze = ({
969
969
  return () => clearInterval(f);
970
970
  }
971
971
  }, [e, c, l]);
972
- const [p, d] = P(!1);
973
- O(() => {
972
+ const [p, d] = O(!1);
973
+ P(() => {
974
974
  if (l >= 100) {
975
975
  const f = setTimeout(() => {
976
976
  d(!1);
@@ -1093,10 +1093,10 @@ const Ze = ({
1093
1093
  duration: 0.3
1094
1094
  }
1095
1095
  }
1096
- }, [s, r] = P(!0), [l, a] = P(!1), [i, c] = P({ x: 50, y: 50 });
1097
- O(() => {
1096
+ }, [s, r] = O(!0), [l, a] = O(!1), [i, c] = O({ x: 50, y: 50 });
1097
+ P(() => {
1098
1098
  l && (r(!0), r(!1));
1099
- }, [l]), O(() => {
1099
+ }, [l]), P(() => {
1100
1100
  const f = t == null ? void 0 : t.current;
1101
1101
  if (f)
1102
1102
  return f.addEventListener("mousedown", o), f.addEventListener("mouseup", p), f.addEventListener("mouseleave", u), () => {
@@ -1192,11 +1192,11 @@ const fn = ({
1192
1192
  setScroll: c
1193
1193
  }) => {
1194
1194
  var ae, ue;
1195
- const o = _(null), u = _(null), [p, d] = P({
1195
+ const o = _(null), u = _(null), [p, d] = O({
1196
1196
  width: null,
1197
1197
  height: null
1198
1198
  });
1199
- O(() => {
1199
+ P(() => {
1200
1200
  if (!o.current) return;
1201
1201
  const F = new ResizeObserver((C) => {
1202
1202
  for (const T of C)
@@ -1245,9 +1245,9 @@ const fn = ({
1245
1245
  const W = (F, C) => {
1246
1246
  v.current && v.current(F, C);
1247
1247
  };
1248
- O(() => {
1248
+ P(() => {
1249
1249
  p.width && W(g.get(), "x"), p.height && W(E.get(), "y");
1250
- }, [p]), O(() => {
1250
+ }, [p]), P(() => {
1251
1251
  const F = o.current, C = u.current;
1252
1252
  if (!F || !C || typeof i != "number") return;
1253
1253
  const T = (U, j, J) => Math.min(J, Math.max(j, U));
@@ -1263,7 +1263,7 @@ const fn = ({
1263
1263
  }), Fe(E, "change", (F) => {
1264
1264
  W(F, "y");
1265
1265
  });
1266
- const [R, y] = P(!1);
1266
+ const [R, y] = O(!1);
1267
1267
  We(() => {
1268
1268
  R || !f.current || !h.current || !s || (s({
1269
1269
  scrollProgress: 0,
@@ -1272,7 +1272,7 @@ const fn = ({
1272
1272
  scrollVisible: t == "vertical" ? f.current.height : f.current.width
1273
1273
  }), y(!0));
1274
1274
  }, [f, h, s]), h.current = x(), f.current = b();
1275
- const [S, I] = P(!1), M = dn({
1275
+ const [S, I] = O(!1), M = dn({
1276
1276
  isDragging: S,
1277
1277
  children: e,
1278
1278
  className: r,
@@ -1281,7 +1281,7 @@ const fn = ({
1281
1281
  scrollSize: n,
1282
1282
  draggable: l,
1283
1283
  throttleDuration: a
1284
- }), [$, N] = P(0), [k, L] = P(0), V = (F) => {
1284
+ }), [$, N] = O(0), [k, L] = O(0), V = (F) => {
1285
1285
  if (!l) return;
1286
1286
  const C = o.current;
1287
1287
  if (!C || $ == null) return;
@@ -1299,9 +1299,9 @@ const fn = ({
1299
1299
  }, K = (F) => {
1300
1300
  F.preventDefault();
1301
1301
  }, Q = _(null);
1302
- return O(() => () => {
1302
+ return P(() => () => {
1303
1303
  Q.current && clearTimeout(Q.current);
1304
- }, []), O(() => {
1304
+ }, []), P(() => {
1305
1305
  const F = o.current;
1306
1306
  if (!F) return;
1307
1307
  const C = (T) => {
@@ -2175,7 +2175,7 @@ const Rr = ({
2175
2175
  children: l
2176
2176
  }) => {
2177
2177
  const a = _(null), i = _(null);
2178
- return O(() => {
2178
+ return P(() => {
2179
2179
  let c;
2180
2180
  typeof e == "string" ? e.endsWith("ms") ? c = parseFloat(e) / 1e3 : e.endsWith("s") ? c = parseFloat(e) : c = parseFloat(e) || 1.2 : c = e;
2181
2181
  const o = (p) => 1 - Math.pow(1 - p, 5);
@@ -2202,13 +2202,13 @@ const Rr = ({
2202
2202
  stateClassName: n = "state-ripple-group",
2203
2203
  className: s
2204
2204
  }) => {
2205
- const r = _(null), l = _(null), [a, i] = P(!1), c = Nn({
2205
+ const r = _(null), l = _(null), [a, i] = O(!1), c = Nn({
2206
2206
  isClient: a,
2207
2207
  stateClassName: n,
2208
2208
  className: s,
2209
2209
  colorName: t
2210
2210
  });
2211
- return O(() => {
2211
+ return P(() => {
2212
2212
  if (r.current && n !== "state-layer") {
2213
2213
  const u = (n.includes("[") ? "group/" + n.split("[")[1].split("]")[0] : "group").replace(/\//g, "\\/"), p = r.current.closest(
2214
2214
  `.${u}:not(.${u} .${u})`
@@ -2243,7 +2243,7 @@ const Rr = ({
2243
2243
  targetRef: e,
2244
2244
  children: t
2245
2245
  }) => {
2246
- const [n, s] = P(null), r = _(null), l = () => {
2246
+ const [n, s] = O(null), r = _(null), l = () => {
2247
2247
  const a = e.current;
2248
2248
  if (!a) return;
2249
2249
  const i = a.getBoundingClientRect();
@@ -2259,7 +2259,7 @@ const Rr = ({
2259
2259
  // personnalise si besoin
2260
2260
  });
2261
2261
  };
2262
- return O(() => {
2262
+ return P(() => {
2263
2263
  const a = e.current;
2264
2264
  if (a)
2265
2265
  return l(), window.addEventListener("scroll", l, !0), window.addEventListener("resize", l), r.current = new ResizeObserver(l), r.current.observe(a), () => {
@@ -2278,15 +2278,15 @@ const $r = ({
2278
2278
  onLoad: n,
2279
2279
  loadTheme: s = !1
2280
2280
  }) => {
2281
- const [r, l] = P(null);
2282
- O(() => {
2281
+ const [r, l] = O(null);
2282
+ P(() => {
2283
2283
  (async () => {
2284
2284
  const d = await At(e, s);
2285
2285
  l(d);
2286
2286
  })();
2287
2287
  }, []);
2288
- const [a, i] = P(null), c = _(null), o = _(0), u = _(null);
2289
- O(() => {
2288
+ const [a, i] = O(null), c = _(null), o = _(0), u = _(null);
2289
+ P(() => {
2290
2290
  if (!r) return;
2291
2291
  const d = {
2292
2292
  ...e,
@@ -2317,7 +2317,7 @@ const $r = ({
2317
2317
  const h = r == null ? void 0 : r.plugins.getPlugin(Ge).getInstance().outputCss;
2318
2318
  i(h), n == null || n(r);
2319
2319
  };
2320
- return O(() => () => {
2320
+ return P(() => () => {
2321
2321
  c.current && (clearTimeout(c.current), c.current = null);
2322
2322
  }, []), a ? /* @__PURE__ */ m("style", { dangerouslySetInnerHTML: { __html: a } }) : null;
2323
2323
  };
@@ -2525,7 +2525,7 @@ const St = ({
2525
2525
  );
2526
2526
  e = Dn(e);
2527
2527
  const v = s ? "a" : "button", W = _(null), R = h || W, [y, S] = q.useState(d);
2528
- O(() => {
2528
+ P(() => {
2529
2529
  S(d);
2530
2530
  }, [d]), b = { duration: 0.3, ...b };
2531
2531
  const I = (N) => {
@@ -2705,7 +2705,7 @@ const St = ({
2705
2705
  scrollSensitivity: p = 1.25,
2706
2706
  ...d
2707
2707
  }) => {
2708
- const h = _(null), f = s || h, [x, b] = P(0), E = Ut({
2708
+ const h = _(null), f = s || h, [x, b] = O(0), E = Ut({
2709
2709
  index: u,
2710
2710
  className: t,
2711
2711
  children: n,
@@ -2719,9 +2719,9 @@ const St = ({
2719
2719
  onMetricsChange: o
2720
2720
  }), g = q.Children.toArray(n).filter(
2721
2721
  (C) => q.isValidElement(C) && C.type === Wn
2722
- ), v = _(null), [W, R] = P(
2722
+ ), v = _(null), [W, R] = O(
2723
2723
  {}
2724
- ), [y, S] = P(null), I = _(0), M = _(null), $ = () => {
2724
+ ), [y, S] = O(null), I = _(0), M = _(null), $ = () => {
2725
2725
  var ye, be;
2726
2726
  if (!v.current || !f.current || (y == null ? void 0 : y.scrollProgress) === void 0)
2727
2727
  return [];
@@ -2782,17 +2782,17 @@ const St = ({
2782
2782
  return b(Ie), Object.fromEntries(
2783
2783
  se.map((X) => [X.index, X.width])
2784
2784
  );
2785
- }, N = _([]).current, [k, L] = P(0);
2786
- O(() => {
2785
+ }, N = _([]).current, [k, L] = O(0);
2786
+ P(() => {
2787
2787
  c && c(k);
2788
- }, [k]), O(() => {
2788
+ }, [k]), P(() => {
2789
2789
  typeof u == "number" && g.length > 0 && u !== k && z(u);
2790
- }, [u, g.length]), O(() => {
2790
+ }, [u, g.length]), P(() => {
2791
2791
  Y(k);
2792
2792
  }, [k]), N.length !== g.length && g.forEach((C, T) => {
2793
2793
  N[T] || (N[T] = q.createRef());
2794
2794
  });
2795
- const [V, Y] = P(0), z = (C, T = {}) => {
2795
+ const [V, Y] = O(0), z = (C, T = {}) => {
2796
2796
  if (!g.length) return 0;
2797
2797
  const U = N[C];
2798
2798
  if (!U || !U.current || !v.current) return 0;
@@ -2849,16 +2849,16 @@ const St = ({
2849
2849
  });
2850
2850
  }
2851
2851
  };
2852
- O(() => {
2852
+ P(() => {
2853
2853
  const C = $();
2854
2854
  R(C);
2855
2855
  }, [y]);
2856
2856
  const K = _(o);
2857
- O(() => {
2857
+ P(() => {
2858
2858
  K.current = o;
2859
2859
  }, [o]);
2860
2860
  const Q = _(null);
2861
- O(() => {
2861
+ P(() => {
2862
2862
  var oe;
2863
2863
  const C = K.current;
2864
2864
  if (!C || !(f != null && f.current)) return;
@@ -2889,11 +2889,11 @@ const St = ({
2889
2889
  }
2890
2890
  }
2891
2891
  X && (Q.current = ye, C(ye));
2892
- }, [f, g.length, k, y, i, a]), O(() => () => {
2892
+ }, [f, g.length, k, y, i, a]), P(() => () => {
2893
2893
  var C;
2894
2894
  (C = M.current) == null || C.stop();
2895
2895
  }, []);
2896
- const [ae, ue] = P(0);
2896
+ const [ae, ue] = O(0);
2897
2897
  We(() => {
2898
2898
  let C = a[1];
2899
2899
  y && C > y.scrollVisible && (C = y.scrollVisible);
@@ -2922,7 +2922,7 @@ const St = ({
2922
2922
  break;
2923
2923
  }
2924
2924
  };
2925
- return O(() => {
2925
+ return P(() => {
2926
2926
  const C = f.current;
2927
2927
  if (!C) return;
2928
2928
  const T = (U) => {
@@ -3017,19 +3017,19 @@ const qe = ({
3017
3017
  throw new Error(
3018
3018
  "Chip component requires either a label prop or children content"
3019
3019
  );
3020
- const W = s ? "a" : "button", R = _(null), y = o || R, [S, I] = q.useState(c), [M, $] = q.useState(!1), [N, k] = P(g && p), [L, V] = q.useState(!1), [Y, z] = q.useState(
3020
+ const W = s ? "a" : "button", R = _(null), y = o || R, [S, I] = q.useState(c), [M, $] = q.useState(!1), [N, k] = O(g && p), [L, V] = q.useState(!1), [Y, z] = q.useState(
3021
3021
  typeof r == "string" ? r : ""
3022
3022
  ), B = q.useRef(null);
3023
- O(() => {
3023
+ P(() => {
3024
3024
  I(c);
3025
- }, [c]), O(() => {
3025
+ }, [c]), P(() => {
3026
3026
  if (g && k(g), p && M) {
3027
3027
  const D = setTimeout(() => {
3028
3028
  v != null && v.draggable && L || k(!0);
3029
3029
  }, 1e3);
3030
3030
  return () => clearTimeout(D);
3031
3031
  } else M || k(!1);
3032
- }, [M, p, L, v, Y]), O(() => {
3032
+ }, [M, p, L, v, Y]), P(() => {
3033
3033
  if (N) {
3034
3034
  z(typeof r == "string" ? r : "");
3035
3035
  const D = J.current || B.current;
@@ -3262,8 +3262,8 @@ const Hr = ({
3262
3262
  });
3263
3263
  },
3264
3264
  [e, l, a, p]
3265
- ), [g, v] = P(null);
3266
- O(() => {
3265
+ ), [g, v] = O(null);
3266
+ P(() => {
3267
3267
  var y;
3268
3268
  if (g) {
3269
3269
  const S = a.findIndex(
@@ -3442,12 +3442,12 @@ function _n({
3442
3442
  closeDelay: l = 150,
3443
3443
  id: a
3444
3444
  } = {}) {
3445
- const i = Mt(), c = a ?? `tooltip-${i}`, o = Array.isArray(e) ? e : [e], u = typeof t == "boolean", [p, d] = P(
3445
+ const i = Mt(), c = a ?? `tooltip-${i}`, o = Array.isArray(e) ? e : [e], u = typeof t == "boolean", [p, d] = O(
3446
3446
  n ? "hovered" : "hidden"
3447
- ), [h, f] = P(!1), x = _(null), b = _(null), E = de(() => {
3447
+ ), [h, f] = O(!1), x = _(null), b = _(null), E = de(() => {
3448
3448
  x.current && (clearTimeout(x.current), x.current = null), b.current && (clearTimeout(b.current), b.current = null);
3449
3449
  }, []);
3450
- O(() => () => E(), [E]);
3450
+ P(() => () => E(), [E]);
3451
3451
  const g = de(
3452
3452
  (z) => {
3453
3453
  if (u) {
@@ -3540,7 +3540,7 @@ function Xn({
3540
3540
  variant: n = "plain",
3541
3541
  isOpen: s
3542
3542
  }) {
3543
- const [r, l] = P(
3543
+ const [r, l] = O(
3544
3544
  t ?? "bottom"
3545
3545
  );
3546
3546
  return We(() => {
@@ -3623,7 +3623,7 @@ const Nt = ({
3623
3623
  R.onKeyDown(k), (V = (L = s.props) == null ? void 0 : L.onKeyDown) == null || V.call(L, k);
3624
3624
  }
3625
3625
  }) : s;
3626
- O(() => {
3626
+ P(() => {
3627
3627
  if (!c) return;
3628
3628
  const k = c.current;
3629
3629
  if (!k) return;
@@ -3817,7 +3817,7 @@ const Nt = ({
3817
3817
  const [v, W] = q.useState(a), R = ($) => {
3818
3818
  n && $.preventDefault(), l ? (W(!v), l(!v)) : i && i($);
3819
3819
  };
3820
- O(() => {
3820
+ P(() => {
3821
3821
  W(a);
3822
3822
  }, [a]);
3823
3823
  const y = t ? "a" : "button", S = Gt({
@@ -3908,7 +3908,7 @@ const Nt = ({
3908
3908
  ...h
3909
3909
  }) => {
3910
3910
  c = { duration: 0.3, ease: "easeInOut", ...c };
3911
- const f = _(null), x = i || f, b = typeof u == "boolean", [E, g] = P(p), v = b ? u : E, W = (N) => {
3911
+ const f = _(null), x = i || f, b = typeof u == "boolean", [E, g] = O(p), v = b ? u : E, W = (N) => {
3912
3912
  b || g(N), d == null || d(N);
3913
3913
  }, R = q.Children.toArray(o).filter(
3914
3914
  (N) => q.isValidElement(N) && N.type === St
@@ -3944,7 +3944,7 @@ const Nt = ({
3944
3944
  },
3945
3945
  ...N
3946
3946
  }
3947
- ), [$] = P(Ne());
3947
+ ), [$] = O(Ne());
3948
3948
  return /* @__PURE__ */ G("div", { className: y.fabMenu, ref: x, ...h, children: [
3949
3949
  /* @__PURE__ */ m(fe, { children: v && /* @__PURE__ */ m("div", { className: y.actions, role: "menu", "aria-hidden": !v, children: (() => {
3950
3950
  const N = R.length;
@@ -4085,12 +4085,16 @@ const Nt = ({
4085
4085
  }, d = (B = !1) => B ? a : a == 1 / 0 ? i[(i == null ? void 0 : i.length) - 1].value : a, h = (B = !1) => B ? l : l == -1 / 0 ? i[0].value : l, f = (B) => {
4086
4086
  const H = h(!1);
4087
4087
  return (d(!1) - H) * B / 100 + H;
4088
- }, [x, b] = P(!1), E = _(null), g = c || E, [v, W] = P(r), [R, y] = P(p(r)), [S, I] = P(!1), M = (B) => {
4088
+ }, [x, b] = O(!1), E = _(null), g = c || E, [v, W] = O(r), [R, y] = O(p(r)), [S, I] = O(!1);
4089
+ P(() => {
4090
+ W(r), y(p(r));
4091
+ }, [r]);
4092
+ const M = (B) => {
4089
4093
  I(!0), b(!0), k(B);
4090
4094
  }, $ = () => {
4091
4095
  I(!1), b(!1);
4092
4096
  };
4093
- O(() => (S ? (window.addEventListener("mouseup", $), window.addEventListener("mousemove", k), window.addEventListener("touchend", $), window.addEventListener("touchmove", k)) : (window.removeEventListener("mouseup", $), window.removeEventListener("mousemove", k), window.removeEventListener("touchend", $), window.removeEventListener("touchmove", k)), () => {
4097
+ P(() => (S ? (window.addEventListener("mouseup", $), window.addEventListener("mousemove", k), window.addEventListener("touchend", $), window.addEventListener("touchmove", k)) : (window.removeEventListener("mouseup", $), window.removeEventListener("mousemove", k), window.removeEventListener("touchend", $), window.removeEventListener("touchmove", k)), () => {
4094
4098
  window.removeEventListener("mouseup", $), window.removeEventListener("mousemove", k), window.removeEventListener("touchend", $), window.removeEventListener("touchmove", k);
4095
4099
  }), [S]);
4096
4100
  const N = Qt({
@@ -4140,8 +4144,8 @@ const Nt = ({
4140
4144
  let ue = Q.value === 1 / 0 ? d() : Q.value === -1 / 0 ? h() : Q.value, F = K.value === 1 / 0 ? d() : K.value === -1 / 0 ? h() : K.value;
4141
4145
  return ue = Math.abs(ue - H), F = Math.abs(F - H), ue < F ? Q : K;
4142
4146
  }).value), H >= d() && (H = d(!0)), H <= h() && (H = h(!0)), B = p(H), W(H), y(B), o && o(H);
4143
- }, [V, Y] = P(0);
4144
- return O(() => {
4147
+ }, [V, Y] = O(0);
4148
+ return P(() => {
4145
4149
  const B = () => {
4146
4150
  g.current && Y(g.current.offsetWidth);
4147
4151
  };
@@ -4256,7 +4260,7 @@ const Nt = ({
4256
4260
  ...u
4257
4261
  }) => {
4258
4262
  o = { duration: 0.3, ...o };
4259
- const [p, d] = P(l ?? !0), h = Zt({
4263
+ const [p, d] = O(l ?? !0), h = Zt({
4260
4264
  transition: o,
4261
4265
  title: s,
4262
4266
  position: r,
@@ -4269,9 +4273,9 @@ const Nt = ({
4269
4273
  extended: p,
4270
4274
  variant: e
4271
4275
  });
4272
- O(() => {
4276
+ P(() => {
4273
4277
  i == null || i(p ?? !1);
4274
- }, [p]), O(() => {
4278
+ }, [p]), P(() => {
4275
4279
  l != null && d(l);
4276
4280
  }, [l]);
4277
4281
  const f = {
@@ -4347,7 +4351,7 @@ const Nt = ({
4347
4351
  onClose: r,
4348
4352
  ...l
4349
4353
  }) => {
4350
- const [a, i] = P(!0), c = en({
4354
+ const [a, i] = O(!0), c = en({
4351
4355
  className: t,
4352
4356
  closeIcon: s,
4353
4357
  duration: n,
@@ -4355,7 +4359,7 @@ const Nt = ({
4355
4359
  onClose: r,
4356
4360
  message: e
4357
4361
  });
4358
- O(() => {
4362
+ P(() => {
4359
4363
  n && setTimeout(() => {
4360
4364
  o();
4361
4365
  }, n);
@@ -4398,7 +4402,11 @@ const Nt = ({
4398
4402
  ref: c,
4399
4403
  ...o
4400
4404
  }) => {
4401
- const [u, p] = P(e), d = (g) => {
4405
+ const [u, p] = O(e);
4406
+ P(() => {
4407
+ p(e);
4408
+ }, [e]);
4409
+ const d = (g) => {
4402
4410
  s || (f(), a && a(g));
4403
4411
  }, h = (g) => {
4404
4412
  s || ((g.key === " " || g.key === "Enter") && (g.preventDefault(), f()), i && i(g));
@@ -4470,10 +4478,10 @@ const Nt = ({
4470
4478
  ref: f,
4471
4479
  ...x
4472
4480
  }) => {
4473
- const b = _(null), E = f || b, g = n ?? (typeof h == "string" ? h : void 0), [v, W] = P(d);
4474
- O(() => {
4481
+ const b = _(null), E = f || b, g = n ?? (typeof h == "string" ? h : void 0), [v, W] = O(d);
4482
+ P(() => {
4475
4483
  d && a == null ? W(!0) : W(a == o && o != null);
4476
- }, [a]), O(() => {
4484
+ }, [a]), P(() => {
4477
4485
  a == o && u && u({
4478
4486
  ref: E,
4479
4487
  index: o || 0,
@@ -4543,7 +4551,7 @@ const Nt = ({
4543
4551
  setSelectedTab: l,
4544
4552
  scrollable: a = !1
4545
4553
  }) => {
4546
- const i = Ke(He), [c, o] = P(
4554
+ const i = Ke(He), [c, o] = O(
4547
4555
  null
4548
4556
  );
4549
4557
  let u;
@@ -4586,7 +4594,7 @@ const Nt = ({
4586
4594
  setSelectedTab: n,
4587
4595
  defaultTab: s = 0
4588
4596
  }) => {
4589
- const [r, l] = P(
4597
+ const [r, l] = O(
4590
4598
  s
4591
4599
  ), a = _(null), i = t !== void 0 ? t : r, c = n ?? l, o = a.current !== null && i !== null ? i > a.current ? 1 : -1 : 0;
4592
4600
  i !== a.current && (a.current = i);
@@ -4672,16 +4680,16 @@ const Nt = ({
4672
4680
  showSupportingText: b = !1,
4673
4681
  ...E
4674
4682
  }) => {
4675
- const [g, v] = P(x ?? ""), [W, R] = P(!1), [y, S] = P(!1), [I, M] = P(
4683
+ const [g, v] = O(x ?? ""), [W, R] = O(!1), [y, S] = O(!1), [I, M] = O(
4676
4684
  b
4677
4685
  );
4678
- O(() => {
4686
+ P(() => {
4679
4687
  v(x ?? "");
4680
- }, [x]), O(() => {
4688
+ }, [x]), P(() => {
4681
4689
  n != null && n.length ? S(!0) : S(!1);
4682
- }, [n]), O(() => {
4690
+ }, [n]), P(() => {
4683
4691
  b ? M(b) : c != null && c.length ? M(!0) : M(!1);
4684
- }, [I, c]), O(() => {
4692
+ }, [I, c]), P(() => {
4685
4693
  W && S(!1);
4686
4694
  }, [W]);
4687
4695
  const $ = q.useRef(null), N = () => {
@@ -4713,7 +4721,7 @@ const Nt = ({
4713
4721
  value: g,
4714
4722
  suffix: r,
4715
4723
  textLine: d
4716
- }), [z] = P(Ne());
4724
+ }), [z] = O(Ne());
4717
4725
  let B, H;
4718
4726
  switch (d) {
4719
4727
  case "multiLine":
@@ -4886,10 +4894,10 @@ const Nt = ({
4886
4894
  ...g
4887
4895
  }) => {
4888
4896
  E && (n = E);
4889
- const v = _(null), W = p || v, [R, y] = P(u);
4890
- O(() => {
4897
+ const v = _(null), W = p || v, [R, y] = O(u);
4898
+ P(() => {
4891
4899
  u && a == null ? y(!0) : y(a == c && c != null);
4892
- }, [a]), O(() => {
4900
+ }, [a]), P(() => {
4893
4901
  a == c && o && o({
4894
4902
  ref: W,
4895
4903
  index: c || 0,
@@ -5071,7 +5079,7 @@ const Nt = ({
5071
5079
  transition: u,
5072
5080
  setSelectedItem: p
5073
5081
  }) => {
5074
- const [d, h] = P(null), [f, x] = P(l);
5082
+ const [d, h] = O(null), [f, x] = O(l);
5075
5083
  let b;
5076
5084
  r == 0 || r != null ? b = r : b = d;
5077
5085
  const E = p || h, g = _(null), v = (M) => {
@@ -5101,7 +5109,7 @@ const Nt = ({
5101
5109
  });
5102
5110
  u = { duration: 0.3, ...u };
5103
5111
  const I = _(!1);
5104
- return I.current = !1, O(() => {
5112
+ return I.current = !1, P(() => {
5105
5113
  o == null || o(f ?? !1);
5106
5114
  }, [f]), /* @__PURE__ */ G(
5107
5115
  "div",
@@ -1 +1 @@
1
- {"version":3,"file":"Slider.d.ts","sourceRoot":"","sources":["../../../src/lib/components/Slider.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,OAAO,EAAc,UAAU,EAAE,MAAM,UAAU,CAAC;AAGlD;;;;;;;;;GASG;AACH,eAAO,MAAM,MAAM,GAAI,8GAqBpB,UAAU,CAAC,eAAe,CAAC,4CA0U7B,CAAC"}
1
+ {"version":3,"file":"Slider.d.ts","sourceRoot":"","sources":["../../../src/lib/components/Slider.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,OAAO,EAAc,UAAU,EAAE,MAAM,UAAU,CAAC;AAGlD;;;;;;;;;GASG;AACH,eAAO,MAAM,MAAM,GAAI,8GAqBpB,UAAU,CAAC,eAAe,CAAC,4CAgV7B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../../src/lib/components/Switch.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEjE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD;;;;;;;;GAQG;AACH,eAAO,MAAM,MAAM,GAAI,8GAWpB,WAAW,CAAC,eAAe,CAAC,4CA0E9B,CAAC"}
1
+ {"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../../src/lib/components/Switch.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEjE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD;;;;;;;;GAQG;AACH,eAAO,MAAM,MAAM,GAAI,8GAWpB,WAAW,CAAC,eAAe,CAAC,4CA8E9B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@udixio/ui-react",
3
- "version": "2.9.11",
3
+ "version": "2.9.13",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -37,8 +37,8 @@
37
37
  "devDependencies": {
38
38
  "react": "^19.1.1",
39
39
  "react-dom": "^19.1.1",
40
- "@udixio/theme": "2.1.11",
41
- "@udixio/tailwind": "2.4.10"
40
+ "@udixio/tailwind": "2.4.12",
41
+ "@udixio/theme": "2.1.12"
42
42
  },
43
43
  "repository": {
44
44
  "type": "git",
@@ -75,6 +75,12 @@ export const Slider = ({
75
75
  const [value, setValue] = useState(defaultValue);
76
76
  const [percent, setpercent] = useState(getpercentFromValue(defaultValue));
77
77
  const [mouseDown, setMouseDown] = useState(false);
78
+
79
+ useEffect(() => {
80
+ setValue(defaultValue);
81
+ setpercent(getpercentFromValue(defaultValue));
82
+ }, [defaultValue]);
83
+
78
84
  const handleMouseDown = (e: any) => {
79
85
  setMouseDown(true);
80
86
  setIsChanging(true);
@@ -1,4 +1,4 @@
1
- import React, { useRef, useState } from 'react';
1
+ import React, { useEffect, useRef, useState } from 'react';
2
2
 
3
3
  import { Icon } from '../icon';
4
4
  import { motion } from 'motion/react';
@@ -29,6 +29,10 @@ export const Switch = ({
29
29
  }: MotionProps<SwitchInterface>) => {
30
30
  const [isSelected, setIsSelected] = useState(selected);
31
31
 
32
+ useEffect(() => {
33
+ setIsSelected(selected);
34
+ }, [selected]);
35
+
32
36
  const handleClick = (event: React.MouseEvent<HTMLDivElement>) => {
33
37
  if (disabled) return;
34
38
  toggleSwitchState();