@udixio/ui-react 1.2.0 → 1.3.0
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 +19 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +57 -57
- package/dist/lib/interfaces/navigation-rail-item.interface.d.ts +1 -2
- package/dist/lib/interfaces/navigation-rail-item.interface.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/lib/components/NavigationRailItem.tsx +1 -1
- package/src/lib/interfaces/navigation-rail-item.interface.ts +1 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
## 1.3.0 (2025-08-25)
|
|
2
|
+
|
|
3
|
+
### 🚀 Features
|
|
4
|
+
|
|
5
|
+
- **doc:** refactor navigation and layout structure for consistency ([644c21a](https://github.com/Udixio/UI/commit/644c21a))
|
|
6
|
+
|
|
7
|
+
### 🩹 Fixes
|
|
8
|
+
|
|
9
|
+
- **ui-react:** update `NavigationRailItem` animation handling ([0ed4606](https://github.com/Udixio/UI/commit/0ed4606))
|
|
10
|
+
|
|
11
|
+
### 🧱 Updated Dependencies
|
|
12
|
+
|
|
13
|
+
- Updated @udixio/tailwind to 1.3.0
|
|
14
|
+
- Updated @udixio/theme to 1.1.0
|
|
15
|
+
|
|
16
|
+
### ❤️ Thank You
|
|
17
|
+
|
|
18
|
+
- Joël VIGREUX
|
|
19
|
+
|
|
1
20
|
## 1.2.0 (2025-08-23)
|
|
2
21
|
|
|
3
22
|
### 🚀 Features
|
package/dist/index.cjs
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* Font Awesome Free 7.0.0 by @fontawesome - https://fontawesome.com
|
|
3
3
|
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
|
4
4
|
* Copyright 2025 Fonticons, Inc.
|
|
5
|
-
*/var Ye={prefix:"fas",iconName:"circle-exclamation",icon:[512,512,["exclamation-circle"],"f06a","M256 512a256 256 0 1 0 0-512 256 256 0 1 0 0 512zm0-376c13.3 0 24 10.7 24 24l0 112c0 13.3-10.7 24-24 24s-24-10.7-24-24l0-112c0-13.3 10.7-24 24-24zM229.3 352a26.7 26.7 0 1 1 53.3 0 26.7 26.7 0 1 1 -53.3 0z"]},ke={prefix:"fas",iconName:"xmark",icon:[384,512,[128473,10005,10006,10060,215,"close","multiply","remove","times"],"f00d","M55.1 73.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L147.2 256 9.9 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192.5 301.3 329.9 438.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.8 256 375.1 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192.5 210.7 55.1 73.4z"]},Ze={prefix:"fas",iconName:"bars",icon:[448,512,["navicon"],"f0c9","M0 96C0 78.3 14.3 64 32 64l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 128C14.3 128 0 113.7 0 96zM0 256c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 288c-17.7 0-32-14.3-32-32zM448 416c0 17.7-14.3 32-32 32L32 448c-17.7 0-32-14.3-32-32s14.3-32 32-32l384 0c17.7 0 32 14.3 32 32z"]};const Je=({message:e,className:t,duration:n,closeIcon:s=ke,onClose:r,...i})=>{const[f,a]=c.useState(!0),m=ye({className:t,closeIcon:s,duration:n,isVisible:f,onClose:r,message:e});c.useEffect(()=>{n&&setTimeout(()=>{o()},n)},[n]);const o=()=>{a(!1),r==null||r()};return l.jsx(k.AnimatePresence,{children:f&&l.jsx(k.motion.div,{initial:{height:0},animate:{height:"auto"},exit:{height:0},transition:{duration:.1},className:m.snackbar,...i,children:l.jsxs("div",{className:m.container,children:[l.jsx("p",{className:m.supportingText,children:e}),l.jsx(ne,{onClick:()=>o(),className:m.icon,icon:s,label:"close the snackbar"})]})})})},Qe=({selected:e=!1,className:t,activeIcon:n,disabled:s=!1,inactiveIcon:r,onChange:i,onClick:f,onKeyDown:a,ref:m,...o})=>{const[h,x]=c.useState(e),u=w=>{s||(b(),f&&f(w))},y=w=>{s||((w.key===" "||w.key==="Enter")&&(w.preventDefault(),b()),a&&a(w))},b=()=>{x(!h),i==null||i(!h)},L=ge({className:t,isSelected:h,activeIcon:n,inactiveIcon:r,disabled:s,selected:h,onChange:i}),N=c.useRef(null),S=m||N;return l.jsxs(k.motion.div,{role:"switch","aria-checked":h,tabIndex:s?-1:0,onKeyDown:y,onClick:u,ref:S,className:L.switch,...o,children:[l.jsx("input",{type:"hidden",value:h?"1":"0"}),l.jsxs(k.motion.div,{layout:!0,style:{translate:h?"50%":"-50%"},transition:{type:"spring",stiffness:700,damping:30},className:L.handleContainer,children:[l.jsx("div",{className:L.handle,children:(h?n:r)&&l.jsx(_,{className:L.icon,icon:h?n:r})}),l.jsx("div",{className:L.handleStateLayer})]})]})},Me=({className:e,onClick:t,label:n,variant:s="primary",href:r,icon:i,selectedTab:f,setSelectedTab:a,tabsId:m,index:o,onTabSelected:h,scrollable:x=!1,selected:u=!1,ref:y,...b})=>{const L=c.useRef(null),N=y||L,[S,w]=c.useState(u);c.useEffect(()=>{u&&f==null?w(!0):w(f==o&&o!=null)},[f]),c.useEffect(()=>{f==o&&h&&h({ref:N,index:o||0,label:n,icon:i})},[f]);const B=r?"a":"button",j=M=>{a&&a(o??null),t&&t(M)},E=ve({className:e,onTabSelected:h,scrollable:x,selectedTab:f,index:o,tabsId:m,selected:S,variant:s,icon:i,label:n,isSelected:S,setSelectedTab:a,href:r});return l.jsxs(B,{...b,role:"tab","aria-selected":S,ref:N,href:r,className:E.tab,onClick:j,...b,children:[l.jsx("span",{className:E.stateLayer,children:l.jsx(J,{colorName:s==="primary"&&S?"primary":"on-surface",triggerRef:N})}),l.jsxs("span",{className:E.content,children:[i&&l.jsx(_,{icon:i,className:E.icon}),l.jsx("span",{className:E.label,children:n}),S&&l.jsx(k.motion.span,{layoutId:`underline-${m}`,className:E.underline,transition:{duration:.3}})]})]})},Ae=({variant:e="primary",onTabSelected:t,children:n,className:s,selectedTab:r,setSelectedTab:i,scrollable:f=!1})=>{const[a,m]=c.useState(null);let o;r==0||r!=null?o=r:o=a;const h=i||m,x=c.Children.toArray(n).filter(N=>c.isValidElement(N)&&N.type===Me),u=c.useRef(null),y=N=>{if(t==null||t(N),f){const S=u.current,w=N.ref.current;if(S&&w){const B=w.offsetLeft+w.offsetWidth/2-S.offsetWidth/2;S.scrollTo({left:B,behavior:"smooth"})}}},b=c.useMemo(()=>ee(),[]),L=we({children:n,onTabSelected:t,scrollable:f,selectedTab:o,setSelectedTab:h,className:s,variant:e});return l.jsx("div",{ref:u,role:"tablist",className:L.tabs,children:x.map((N,S)=>c.cloneElement(N,{key:S,index:S,variant:e,selectedTab:o,setSelectedTab:h,tabsId:b,onTabSelected:y,scrollable:f}))})},ze=({variant:e="filled",disabled:t=!1,errorText:n,placeholder:s,suffix:r,name:i,label:f,className:a,supportingText:m,trailingIcon:o,leadingIcon:h,type:x="text",textLine:u="singleLine",autoComplete:y="on",onChange:b,value:L,showSupportingText:N=!1,...S})=>{const[w,B]=c.useState(L??""),[j,E]=c.useState(!1),[M,D]=c.useState(!1),[P,I]=c.useState(N);c.useEffect(()=>{B(L??"")},[L]),c.useEffect(()=>{n!=null&&n.length?D(!0):D(!1)},[n]),c.useEffect(()=>{N?I(N):m!=null&&m.length?I(!0):I(!1)},[P,m]),c.useEffect(()=>{j&&D(!1)},[j]);const p=c.useRef(null),C=()=>{p.current&&!j&&p.current.focus()},q=()=>{E(!0)},O=V=>{const W=V.target.value;B(W),D(!1),typeof b=="function"&&b(W)},G=()=>{E(!1)},U=be({showSupportingText:P,isFocused:j,showErrorIcon:M,disabled:t,name:i,label:f,autoComplete:y,className:a,onChange:b,placeholder:s,supportingText:m,type:x,leadingIcon:h,trailingIcon:o,variant:e,errorText:n,value:w,suffix:r,textLine:u}),[Y]=c.useState(ee());let v,g;switch(u){case"multiLine":g=We,v={};break;case"textAreas":g="textarea",v={};break;case"singleLine":default:g="input",v={type:x};break}return l.jsxs("div",{className:U.textField,...S,children:[l.jsxs("fieldset",{onClick:C,className:U.content,children:[l.jsx("div",{className:U.stateLayer}),h&&l.jsx("div",{className:U.leadingIcon,children:c.isValidElement(h)?h:l.jsx(_,{className:"w-5 h-5",icon:h})}),!(!j&&!w.length||e=="filled")&&l.jsx(k.motion.legend,{variants:{hidden:{width:0,padding:0},visible:{width:"auto",padding:"0 8px"}},initial:"hidden",animate:!j&&!w.length?"hidden":"visible",className:"max-w-full ml-2 px-2 text-body-small h-0",transition:{duration:.2},children:l.jsx("span",{className:"transform inline-flex -translate-y-1/2",children:l.jsx(k.motion.span,{className:U.label,transition:{duration:.3},layoutId:Y,children:f})})}),l.jsxs("div",{className:"flex-1 relative",children:[(!j&&!w.length||e=="filled")&&l.jsx(k.motion.label,{htmlFor:i,className:d("absolute left-4 transition-all duration-300",{"text-body-small top-2":e=="filled"&&!(!j&&!w.length),"text-body-large top-1/2 transform -translate-y-1/2":!(e=="filled"&&!(!j&&!w.length))}),transition:{duration:.3},children:l.jsx(k.motion.span,{className:U.label,transition:{duration:.3},layoutId:e=="outlined"?Y:void 0,children:f})}),l.jsx(g,{ref:p,value:w,onChange:O,className:U.input,id:i,name:i,placeholder:j?s??void 0:"",onFocus:q,onBlur:G,disabled:t,autoComplete:y,"aria-invalid":!!(n!=null&&n.length),"aria-label":f,...v})]}),l.jsx("div",{className:U.activeIndicator}),!M&&l.jsxs(l.Fragment,{children:[o&&l.jsx("div",{onClick:V=>{V.stopPropagation()},className:U.trailingIcon,children:c.isValidElement(o)?o:l.jsx(_,{className:"h-5",icon:o})}),!o&&r&&l.jsx("span",{className:U.suffix,children:r})]}),M&&l.jsx("div",{className:d(U.trailingIcon,{" absolute right-0":!o}),children:l.jsx(_,{className:"h-5 text-error",icon:Ye})})]}),P&&l.jsx("p",{className:U.supportingText,children:n!=null&&n.length?n:m!=null&&m.length?m:" "})]})},Te=X("navigationRailItem",({isSelected:e,icon:t,label:n,variant:s})=>({navigationRailItem:d(" group flex flex-col pt-1 pb-1.5 cursor-pointer",{"text-on-surface-variant":!e,"text-on-secondary-container":e,"gap-2 h-[68px]":s=="vertical","gap-0 h-[66px]":s=="horizontal"}),container:d(" w-fit flex justify-center relative rounded-full items-center mx-5",{"bg-secondary-container overflow-hidden":e,"gap-2 ":s=="horizontal","gap-0 ":s=="vertical","p-4":!n},n&&["px-4",{"py-1 ":s=="vertical","py-4 ":s=="horizontal"}]),stateLayer:d(" absolute w-full rounded-full h-full left-0 top-0 ",{"group-state-on-surface":!e,"group-state-on-secondary-container":e}),icon:d("size-6 flex"),label:d("w-fit mx-auto text-nowrap",{"text-label-large ":s=="horizontal","text-label-medium":s=="vertical"})})),Ce=({label:e})=>l.jsx("div",{className:" h-9 flex items-center mx-9 mt-3",children:l.jsx("p",{className:"text-label-large text-on-surface-variant",children:e})}),Be=({className:e,onClick:t,label:n,variant:s="vertical",href:r,icon:i,selectedItem:f,setSelectedItem:a,index:m,onItemSelected:o,selected:h=!1,ref:x,transition:u,isExtended:y,iconSelected:b,style:L,extendedOnly:N,children:S,...w})=>{S&&(n=S);const B=c.useRef(null),j=x||B,[E,M]=c.useState(h);c.useEffect(()=>{h&&f==null?M(!0):M(f==m&&m!=null)},[f]),c.useEffect(()=>{f==m&&o&&o({ref:j,index:m||0,label:n,icon:i})},[f]);const D=r?"a":"button",P=p=>{a&&a(m??null),t&&t(p)},I=Te({isExtended:y,extendedOnly:N,className:e,onItemSelected:o,selectedItem:f,index:m,transition:u,selected:E,variant:s,icon:i,label:n,isSelected:E,setSelectedItem:a,href:r,children:n,iconSelected:b});return u={duration:.3,...u},N&&!y?null:l.jsxs(D,{...w,role:"tab","aria-selected":E,ref:j,href:r,className:I.navigationRailItem,onClick:P,style:{transition:u.duration+"s",...L},children:[l.jsxs(k.motion.div,{style:{transition:s=="horizontal"?u.duration+`s, gap ${u.duration/2}s ${u.duration-u.duration/2}s`:u.duration+`s, gap ${u.duration/3}s ${u.duration-u.duration/3}s`},transition:u,className:I.container,children:[l.jsx(k.motion.div,{layout:!0,className:I.stateLayer}),i&&l.jsx(_,{icon:E?b:i,className:I.icon}),l.jsx(k.AnimatePresence,{children:s=="horizontal"&&(()=>{const p={width:0,opacity:0,transition:{...u}},C={width:"auto",opacity:1,transition:{...u,opacity:{duration:u.duration/2,delay:u.duration-u.duration/2}}};return l.jsx(k.motion.span,{initial:p,animate:C,exit:p,className:I.label,children:n})})()})]}),l.jsx(k.AnimatePresence,{children:s=="vertical"&&(()=>{const p={height:0,opacity:0,transition:{...u,opacity:{duration:0}}},C={height:"auto",opacity:1,transition:{...u,opacity:{duration:u.duration/3,delay:u.duration-u.duration/3}}};return l.jsx(k.motion.span,{initial:p,animate:C,exit:p,className:I.label,transition:u,children:n})})()})]})},et=X("navigationRail",({isExtended:e,alignment:t})=>({navigationRail:d("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:d("flex flex-col gap-1 items-start"),menuIcon:"mx-5",segments:d(" flex flex-col overflow-auto min-w-full mt-10",{"w-full":!e,"w-fit items-start":e})})),tt=({variant:e="standard",onItemSelected:t,children:n,className:s,selectedItem:r,extended:i,alignment:f="top",menu:a={closed:{icon:Ze,label:"Open menu"},opened:{icon:ke,label:"Close menu"}},style:m,onExtendedChange:o,transition:h,setSelectedItem:x})=>{const[u,y]=c.useState(null),[b,L]=c.useState(i);let N;r==0||r!=null?N=r:N=u;const S=x||y,w=c.useRef(null),B=I=>{t==null||t(I)};function j(I){const p=[];return c.Children.forEach(I,C=>{c.isValidElement(C)&&C.type===c.Fragment?p.push(...j(C.props.children)):p.push(C)}),p}const E=j(n),M=E.filter(I=>c.isValidElement(I)&&I.type===z),D=et({children:n,onItemSelected:t,selectedItem:N,setSelectedItem:S,className:s,variant:e,extended:b,isExtended:b,alignment:f,menu:a,transition:h,onExtendedChange:o});h={duration:.3,...h};const P=c.useRef(!1);return P.current=!1,c.useEffect(()=>{o==null||o(b??!1)},[b]),l.jsxs("div",{style:{transition:h.duration+"s",...m},ref:w,className:D.navigationRail,children:[l.jsxs("div",{className:D.header,children:[l.jsx(ne,{onClick:()=>L(!b),label:b?a==null?void 0:a.opened.label:a==null?void 0:a.closed.label,className:D.menuIcon,icon:b?a.opened.icon:a==null?void 0:a.closed.icon}),M.length>0&&c.cloneElement(M[0],{transition:h,isExtended:b,className:"!shadow-none mx-5 "+M[0].props.className})]}),l.jsx("div",{className:D.segments,children:(()=>{let I=0;return E.map(p=>c.isValidElement(p)&&p.type===Be?c.cloneElement(p,{key:I,index:I++,variant:b?"horizontal":"vertical",selectedItem:N,setSelectedItem:S,onItemSelected:B,transition:h,extendedOnly:P.current,isExtended:b}):c.isValidElement(p)&&p.type===z?null:c.isValidElement(p)&&p.type===Ce?(P.current=!0,b?c.cloneElement(p,{}):null):p)})()}),l.jsx("div",{className:"flex-1 max-h-[160px]"})]})};exports.Button=Ee;exports.Card=qe;exports.Carousel=Ue;exports.CarouselItem=Re;exports.CustomScroll=T;exports.Divider=Xe;exports.Fab=z;exports.Icon=_;exports.IconButton=ne;exports.NavigationRail=tt;exports.NavigationRailItem=Be;exports.NavigationRailSection=Ce;exports.ProgressIndicator=Ne;exports.RippleEffect=J;exports.Slider=_e;exports.SmoothScroll=Fe;exports.Snackbar=Je;exports.Switch=Qe;exports.SyncedFixedWrapper=Se;exports.Tab=Me;exports.Tabs=Ae;exports.TextField=ze;exports.ToolTip=te;exports.buttonStyle=ce;exports.cardStyle=ie;exports.carouselItemStyle=ue;exports.carouselStyle=fe;exports.classNames=d;exports.classnames=le;exports.customScrollStyle=Le;exports.defaultClassNames=X;exports.dividerStyle=de;exports.fabStyle=me;exports.getClassNames=ae;exports.iconButtonStyle=pe;exports.normalize=Ie;exports.progressIndicatorStyle=he;exports.sliderStyle=xe;exports.snackbarStyle=ye;exports.switchStyle=ge;exports.tabStyle=ve;exports.tabsStyle=we;exports.textFieldStyle=be;exports.toolStyle=je;
|
|
5
|
+
*/var Ye={prefix:"fas",iconName:"circle-exclamation",icon:[512,512,["exclamation-circle"],"f06a","M256 512a256 256 0 1 0 0-512 256 256 0 1 0 0 512zm0-376c13.3 0 24 10.7 24 24l0 112c0 13.3-10.7 24-24 24s-24-10.7-24-24l0-112c0-13.3 10.7-24 24-24zM229.3 352a26.7 26.7 0 1 1 53.3 0 26.7 26.7 0 1 1 -53.3 0z"]},ke={prefix:"fas",iconName:"xmark",icon:[384,512,[128473,10005,10006,10060,215,"close","multiply","remove","times"],"f00d","M55.1 73.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L147.2 256 9.9 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192.5 301.3 329.9 438.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.8 256 375.1 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192.5 210.7 55.1 73.4z"]},Ze={prefix:"fas",iconName:"bars",icon:[448,512,["navicon"],"f0c9","M0 96C0 78.3 14.3 64 32 64l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 128C14.3 128 0 113.7 0 96zM0 256c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 288c-17.7 0-32-14.3-32-32zM448 416c0 17.7-14.3 32-32 32L32 448c-17.7 0-32-14.3-32-32s14.3-32 32-32l384 0c17.7 0 32 14.3 32 32z"]};const Je=({message:e,className:t,duration:n,closeIcon:s=ke,onClose:r,...i})=>{const[f,a]=c.useState(!0),m=ye({className:t,closeIcon:s,duration:n,isVisible:f,onClose:r,message:e});c.useEffect(()=>{n&&setTimeout(()=>{o()},n)},[n]);const o=()=>{a(!1),r==null||r()};return l.jsx(k.AnimatePresence,{children:f&&l.jsx(k.motion.div,{initial:{height:0},animate:{height:"auto"},exit:{height:0},transition:{duration:.1},className:m.snackbar,...i,children:l.jsxs("div",{className:m.container,children:[l.jsx("p",{className:m.supportingText,children:e}),l.jsx(ne,{onClick:()=>o(),className:m.icon,icon:s,label:"close the snackbar"})]})})})},Qe=({selected:e=!1,className:t,activeIcon:n,disabled:s=!1,inactiveIcon:r,onChange:i,onClick:f,onKeyDown:a,ref:m,...o})=>{const[h,x]=c.useState(e),u=w=>{s||(b(),f&&f(w))},y=w=>{s||((w.key===" "||w.key==="Enter")&&(w.preventDefault(),b()),a&&a(w))},b=()=>{x(!h),i==null||i(!h)},L=ge({className:t,isSelected:h,activeIcon:n,inactiveIcon:r,disabled:s,selected:h,onChange:i}),N=c.useRef(null),S=m||N;return l.jsxs(k.motion.div,{role:"switch","aria-checked":h,tabIndex:s?-1:0,onKeyDown:y,onClick:u,ref:S,className:L.switch,...o,children:[l.jsx("input",{type:"hidden",value:h?"1":"0"}),l.jsxs(k.motion.div,{layout:!0,style:{translate:h?"50%":"-50%"},transition:{type:"spring",stiffness:700,damping:30},className:L.handleContainer,children:[l.jsx("div",{className:L.handle,children:(h?n:r)&&l.jsx(_,{className:L.icon,icon:h?n:r})}),l.jsx("div",{className:L.handleStateLayer})]})]})},Me=({className:e,onClick:t,label:n,variant:s="primary",href:r,icon:i,selectedTab:f,setSelectedTab:a,tabsId:m,index:o,onTabSelected:h,scrollable:x=!1,selected:u=!1,ref:y,...b})=>{const L=c.useRef(null),N=y||L,[S,w]=c.useState(u);c.useEffect(()=>{u&&f==null?w(!0):w(f==o&&o!=null)},[f]),c.useEffect(()=>{f==o&&h&&h({ref:N,index:o||0,label:n,icon:i})},[f]);const B=r?"a":"button",j=M=>{a&&a(o??null),t&&t(M)},E=ve({className:e,onTabSelected:h,scrollable:x,selectedTab:f,index:o,tabsId:m,selected:S,variant:s,icon:i,label:n,isSelected:S,setSelectedTab:a,href:r});return l.jsxs(B,{...b,role:"tab","aria-selected":S,ref:N,href:r,className:E.tab,onClick:j,...b,children:[l.jsx("span",{className:E.stateLayer,children:l.jsx(J,{colorName:s==="primary"&&S?"primary":"on-surface",triggerRef:N})}),l.jsxs("span",{className:E.content,children:[i&&l.jsx(_,{icon:i,className:E.icon}),l.jsx("span",{className:E.label,children:n}),S&&l.jsx(k.motion.span,{layoutId:`underline-${m}`,className:E.underline,transition:{duration:.3}})]})]})},Ae=({variant:e="primary",onTabSelected:t,children:n,className:s,selectedTab:r,setSelectedTab:i,scrollable:f=!1})=>{const[a,m]=c.useState(null);let o;r==0||r!=null?o=r:o=a;const h=i||m,x=c.Children.toArray(n).filter(N=>c.isValidElement(N)&&N.type===Me),u=c.useRef(null),y=N=>{if(t==null||t(N),f){const S=u.current,w=N.ref.current;if(S&&w){const B=w.offsetLeft+w.offsetWidth/2-S.offsetWidth/2;S.scrollTo({left:B,behavior:"smooth"})}}},b=c.useMemo(()=>ee(),[]),L=we({children:n,onTabSelected:t,scrollable:f,selectedTab:o,setSelectedTab:h,className:s,variant:e});return l.jsx("div",{ref:u,role:"tablist",className:L.tabs,children:x.map((N,S)=>c.cloneElement(N,{key:S,index:S,variant:e,selectedTab:o,setSelectedTab:h,tabsId:b,onTabSelected:y,scrollable:f}))})},ze=({variant:e="filled",disabled:t=!1,errorText:n,placeholder:s,suffix:r,name:i,label:f,className:a,supportingText:m,trailingIcon:o,leadingIcon:h,type:x="text",textLine:u="singleLine",autoComplete:y="on",onChange:b,value:L,showSupportingText:N=!1,...S})=>{const[w,B]=c.useState(L??""),[j,E]=c.useState(!1),[M,D]=c.useState(!1),[P,I]=c.useState(N);c.useEffect(()=>{B(L??"")},[L]),c.useEffect(()=>{n!=null&&n.length?D(!0):D(!1)},[n]),c.useEffect(()=>{N?I(N):m!=null&&m.length?I(!0):I(!1)},[P,m]),c.useEffect(()=>{j&&D(!1)},[j]);const p=c.useRef(null),C=()=>{p.current&&!j&&p.current.focus()},q=()=>{E(!0)},O=V=>{const W=V.target.value;B(W),D(!1),typeof b=="function"&&b(W)},G=()=>{E(!1)},U=be({showSupportingText:P,isFocused:j,showErrorIcon:M,disabled:t,name:i,label:f,autoComplete:y,className:a,onChange:b,placeholder:s,supportingText:m,type:x,leadingIcon:h,trailingIcon:o,variant:e,errorText:n,value:w,suffix:r,textLine:u}),[Y]=c.useState(ee());let v,g;switch(u){case"multiLine":g=We,v={};break;case"textAreas":g="textarea",v={};break;case"singleLine":default:g="input",v={type:x};break}return l.jsxs("div",{className:U.textField,...S,children:[l.jsxs("fieldset",{onClick:C,className:U.content,children:[l.jsx("div",{className:U.stateLayer}),h&&l.jsx("div",{className:U.leadingIcon,children:c.isValidElement(h)?h:l.jsx(_,{className:"w-5 h-5",icon:h})}),!(!j&&!w.length||e=="filled")&&l.jsx(k.motion.legend,{variants:{hidden:{width:0,padding:0},visible:{width:"auto",padding:"0 8px"}},initial:"hidden",animate:!j&&!w.length?"hidden":"visible",className:"max-w-full ml-2 px-2 text-body-small h-0",transition:{duration:.2},children:l.jsx("span",{className:"transform inline-flex -translate-y-1/2",children:l.jsx(k.motion.span,{className:U.label,transition:{duration:.3},layoutId:Y,children:f})})}),l.jsxs("div",{className:"flex-1 relative",children:[(!j&&!w.length||e=="filled")&&l.jsx(k.motion.label,{htmlFor:i,className:d("absolute left-4 transition-all duration-300",{"text-body-small top-2":e=="filled"&&!(!j&&!w.length),"text-body-large top-1/2 transform -translate-y-1/2":!(e=="filled"&&!(!j&&!w.length))}),transition:{duration:.3},children:l.jsx(k.motion.span,{className:U.label,transition:{duration:.3},layoutId:e=="outlined"?Y:void 0,children:f})}),l.jsx(g,{ref:p,value:w,onChange:O,className:U.input,id:i,name:i,placeholder:j?s??void 0:"",onFocus:q,onBlur:G,disabled:t,autoComplete:y,"aria-invalid":!!(n!=null&&n.length),"aria-label":f,...v})]}),l.jsx("div",{className:U.activeIndicator}),!M&&l.jsxs(l.Fragment,{children:[o&&l.jsx("div",{onClick:V=>{V.stopPropagation()},className:U.trailingIcon,children:c.isValidElement(o)?o:l.jsx(_,{className:"h-5",icon:o})}),!o&&r&&l.jsx("span",{className:U.suffix,children:r})]}),M&&l.jsx("div",{className:d(U.trailingIcon,{" absolute right-0":!o}),children:l.jsx(_,{className:"h-5 text-error",icon:Ye})})]}),P&&l.jsx("p",{className:U.supportingText,children:n!=null&&n.length?n:m!=null&&m.length?m:" "})]})},Te=X("navigationRailItem",({isSelected:e,icon:t,label:n,variant:s})=>({navigationRailItem:d(" group flex flex-col pt-1 pb-1.5 cursor-pointer",{"text-on-surface-variant":!e,"text-on-secondary-container":e,"gap-2 h-[68px]":s=="vertical","gap-0 h-[66px]":s=="horizontal"}),container:d(" w-fit flex justify-center relative rounded-full items-center mx-5",{"bg-secondary-container overflow-hidden":e,"gap-2 ":s=="horizontal","gap-0 ":s=="vertical","p-4":!n},n&&["px-4",{"py-1 ":s=="vertical","py-4 ":s=="horizontal"}]),stateLayer:d(" absolute w-full rounded-full h-full left-0 top-0 ",{"group-state-on-surface":!e,"group-state-on-secondary-container":e}),icon:d("size-6 flex"),label:d("w-fit mx-auto text-nowrap",{"text-label-large ":s=="horizontal","text-label-medium":s=="vertical"})})),Ce=({label:e})=>l.jsx("div",{className:" h-9 flex items-center mx-9 mt-3",children:l.jsx("p",{className:"text-label-large text-on-surface-variant",children:e})}),Be=({className:e,onClick:t,label:n,variant:s="vertical",href:r,icon:i,selectedItem:f,setSelectedItem:a,index:m,onItemSelected:o,selected:h=!1,ref:x,transition:u,isExtended:y,iconSelected:b,style:L,extendedOnly:N,children:S,...w})=>{S&&(n=S);const B=c.useRef(null),j=x||B,[E,M]=c.useState(h);c.useEffect(()=>{h&&f==null?M(!0):M(f==m&&m!=null)},[f]),c.useEffect(()=>{f==m&&o&&o({ref:j,index:m||0,label:n,icon:i})},[f]);const D=r?"a":"button",P=p=>{a&&a(m??null),t&&t(p)},I=Te({isExtended:y,extendedOnly:N,className:e,onItemSelected:o,selectedItem:f,index:m,transition:u,selected:E,variant:s,icon:i,label:n,isSelected:E,setSelectedItem:a,href:r,children:n,iconSelected:b});return u={duration:.3,...u},N&&!y?null:l.jsxs(D,{...w,role:"tab","aria-selected":E,ref:j,href:r,className:I.navigationRailItem,onClick:P,style:{transition:u.duration+"s",...L},children:[l.jsxs(k.motion.div,{style:{transition:s=="horizontal"?u.duration+`s, gap ${u.duration/2}s ${u.duration-u.duration/2}s`:u.duration+`s, gap ${u.duration/3}s ${u.duration-u.duration/3}s`},transition:u,className:I.container,children:[l.jsx(k.motion.div,{layout:!0,className:I.stateLayer}),i&&l.jsx(_,{icon:E?b:i,className:I.icon}),l.jsx(k.AnimatePresence,{children:s=="horizontal"&&(()=>{const p={width:0,opacity:0,transition:{...u}},C={width:"auto",opacity:1,transition:{...u,opacity:{duration:u.duration/2,delay:u.duration-u.duration/2}}};return l.jsx(k.motion.span,{initial:p,animate:C,exit:p,className:I.label,children:n})})()})]}),l.jsx(k.AnimatePresence,{children:s=="vertical"&&(()=>{const p={height:0,opacity:0,transition:{...u,opacity:{duration:0}}},C={height:"auto",opacity:1,transition:{...u,opacity:{duration:u.duration/3,delay:u.duration-u.duration/3}}};return l.jsx(k.motion.span,{initial:C,animate:C,exit:p,className:I.label,transition:u,children:n})})()})]})},et=X("navigationRail",({isExtended:e,alignment:t})=>({navigationRail:d("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:d("flex flex-col gap-1 items-start"),menuIcon:"mx-5",segments:d(" flex flex-col overflow-auto min-w-full mt-10",{"w-full":!e,"w-fit items-start":e})})),tt=({variant:e="standard",onItemSelected:t,children:n,className:s,selectedItem:r,extended:i,alignment:f="top",menu:a={closed:{icon:Ze,label:"Open menu"},opened:{icon:ke,label:"Close menu"}},style:m,onExtendedChange:o,transition:h,setSelectedItem:x})=>{const[u,y]=c.useState(null),[b,L]=c.useState(i);let N;r==0||r!=null?N=r:N=u;const S=x||y,w=c.useRef(null),B=I=>{t==null||t(I)};function j(I){const p=[];return c.Children.forEach(I,C=>{c.isValidElement(C)&&C.type===c.Fragment?p.push(...j(C.props.children)):p.push(C)}),p}const E=j(n),M=E.filter(I=>c.isValidElement(I)&&I.type===z),D=et({children:n,onItemSelected:t,selectedItem:N,setSelectedItem:S,className:s,variant:e,extended:b,isExtended:b,alignment:f,menu:a,transition:h,onExtendedChange:o});h={duration:.3,...h};const P=c.useRef(!1);return P.current=!1,c.useEffect(()=>{o==null||o(b??!1)},[b]),l.jsxs("div",{style:{transition:h.duration+"s",...m},ref:w,className:D.navigationRail,children:[l.jsxs("div",{className:D.header,children:[l.jsx(ne,{onClick:()=>L(!b),label:b?a==null?void 0:a.opened.label:a==null?void 0:a.closed.label,className:D.menuIcon,icon:b?a.opened.icon:a==null?void 0:a.closed.icon}),M.length>0&&c.cloneElement(M[0],{transition:h,isExtended:b,className:"!shadow-none mx-5 "+M[0].props.className})]}),l.jsx("div",{className:D.segments,children:(()=>{let I=0;return E.map(p=>c.isValidElement(p)&&p.type===Be?c.cloneElement(p,{key:I,index:I++,variant:b?"horizontal":"vertical",selectedItem:N,setSelectedItem:S,onItemSelected:B,transition:h,extendedOnly:P.current,isExtended:b}):c.isValidElement(p)&&p.type===z?null:c.isValidElement(p)&&p.type===Ce?(P.current=!0,b?c.cloneElement(p,{}):null):p)})()}),l.jsx("div",{className:"flex-1 max-h-[160px]"})]})};exports.Button=Ee;exports.Card=qe;exports.Carousel=Ue;exports.CarouselItem=Re;exports.CustomScroll=T;exports.Divider=Xe;exports.Fab=z;exports.Icon=_;exports.IconButton=ne;exports.NavigationRail=tt;exports.NavigationRailItem=Be;exports.NavigationRailSection=Ce;exports.ProgressIndicator=Ne;exports.RippleEffect=J;exports.Slider=_e;exports.SmoothScroll=Fe;exports.Snackbar=Je;exports.Switch=Qe;exports.SyncedFixedWrapper=Se;exports.Tab=Me;exports.Tabs=Ae;exports.TextField=ze;exports.ToolTip=te;exports.buttonStyle=ce;exports.cardStyle=ie;exports.carouselItemStyle=ue;exports.carouselStyle=fe;exports.classNames=d;exports.classnames=le;exports.customScrollStyle=Le;exports.defaultClassNames=X;exports.dividerStyle=de;exports.fabStyle=me;exports.getClassNames=ae;exports.iconButtonStyle=pe;exports.normalize=Ie;exports.progressIndicatorStyle=he;exports.sliderStyle=xe;exports.snackbarStyle=ye;exports.switchStyle=ge;exports.tabStyle=ve;exports.tabsStyle=we;exports.textFieldStyle=be;exports.toolStyle=je;
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as u, jsxs as U, Fragment as re } from "react/jsx-runtime";
|
|
2
2
|
import { clsx as de } from "clsx";
|
|
3
3
|
import { extendTailwindMerge as we } from "tailwind-merge";
|
|
4
|
-
import Y, { useState as
|
|
4
|
+
import Y, { useState as C, useEffect as D, useRef as V, useLayoutEffect as fe, isValidElement as ee, cloneElement as le, useMemo as ve, Children as be, Fragment as Ne } from "react";
|
|
5
5
|
import { motion as j, AnimatePresence as z, useScroll as Le, useMotionValueEvent as se, motionValue as me, useTransform as oe } from "motion/react";
|
|
6
6
|
import { throttle as Ee } from "throttle-debounce";
|
|
7
7
|
import { createPortal as Ie } from "react-dom";
|
|
@@ -794,11 +794,11 @@ const Se = (e) => {
|
|
|
794
794
|
className: l,
|
|
795
795
|
...n
|
|
796
796
|
}) => {
|
|
797
|
-
const [s, i] =
|
|
797
|
+
const [s, i] = C(t), [a] = C(1.5);
|
|
798
798
|
D(() => {
|
|
799
799
|
t > 100 && (t = 100), t < 0 && (t = 0), i(t);
|
|
800
800
|
}, [t]);
|
|
801
|
-
const [f, o] =
|
|
801
|
+
const [f, o] = C(!0), p = () => f ? a : a * 0.5;
|
|
802
802
|
D(() => {
|
|
803
803
|
if ((e === "circular-indeterminate" || e === "linear-indeterminate") && s !== 100) {
|
|
804
804
|
const v = setInterval(() => {
|
|
@@ -807,7 +807,7 @@ const Se = (e) => {
|
|
|
807
807
|
return () => clearInterval(v);
|
|
808
808
|
}
|
|
809
809
|
}, [e, f, s]);
|
|
810
|
-
const [h, c] =
|
|
810
|
+
const [h, c] = C(!1);
|
|
811
811
|
D(() => {
|
|
812
812
|
if (s >= 100) {
|
|
813
813
|
const v = setTimeout(() => {
|
|
@@ -929,7 +929,7 @@ const Se = (e) => {
|
|
|
929
929
|
borderRadius: { duration: 0.3, delay: 0.3 }
|
|
930
930
|
}
|
|
931
931
|
}
|
|
932
|
-
}, [l, n] =
|
|
932
|
+
}, [l, n] = C(!0), [s, i] = C(!1), [a, f] = C({ x: 0, y: 0 });
|
|
933
933
|
D(() => {
|
|
934
934
|
s && (n(!0), n(!1));
|
|
935
935
|
}, [s]), D(() => {
|
|
@@ -1008,7 +1008,7 @@ const Se = (e) => {
|
|
|
1008
1008
|
throttleDuration: i = 75
|
|
1009
1009
|
}) => {
|
|
1010
1010
|
var $, F;
|
|
1011
|
-
const a = V(null), f = V(null), [o, p] =
|
|
1011
|
+
const a = V(null), f = V(null), [o, p] = C({
|
|
1012
1012
|
width: null,
|
|
1013
1013
|
height: null
|
|
1014
1014
|
});
|
|
@@ -1068,7 +1068,7 @@ const Se = (e) => {
|
|
|
1068
1068
|
}), se(L, "change", (M) => {
|
|
1069
1069
|
w(M, "y");
|
|
1070
1070
|
});
|
|
1071
|
-
const [B, b] =
|
|
1071
|
+
const [B, b] = C(!1);
|
|
1072
1072
|
fe(() => {
|
|
1073
1073
|
B || !c.current || !h.current || !l || (l({
|
|
1074
1074
|
scrollProgress: 0,
|
|
@@ -1077,7 +1077,7 @@ const Se = (e) => {
|
|
|
1077
1077
|
scrollVisible: t == "vertical" ? c.current.height : c.current.width
|
|
1078
1078
|
}), b(!0));
|
|
1079
1079
|
}, [c, h, l]), h.current = y(), c.current = v();
|
|
1080
|
-
const [I, R] =
|
|
1080
|
+
const [I, R] = C(!1), P = _e({
|
|
1081
1081
|
isDragging: I,
|
|
1082
1082
|
children: e,
|
|
1083
1083
|
className: n,
|
|
@@ -1086,7 +1086,7 @@ const Se = (e) => {
|
|
|
1086
1086
|
scrollSize: r,
|
|
1087
1087
|
draggable: s,
|
|
1088
1088
|
throttleDuration: i
|
|
1089
|
-
}), [W, k] =
|
|
1089
|
+
}), [W, k] = C(0), [m, S] = C(0), q = (M) => {
|
|
1090
1090
|
if (!s) return;
|
|
1091
1091
|
const X = a.current;
|
|
1092
1092
|
if (!X || W == null) return;
|
|
@@ -1094,7 +1094,7 @@ const Se = (e) => {
|
|
|
1094
1094
|
X.scrollLeft = m - J;
|
|
1095
1095
|
}, K = (M) => {
|
|
1096
1096
|
const X = a.current;
|
|
1097
|
-
X && (R(!0), k(M.pageX - X.offsetLeft),
|
|
1097
|
+
X && (R(!0), k(M.pageX - X.offsetLeft), S(X.scrollLeft));
|
|
1098
1098
|
}, Z = (M) => {
|
|
1099
1099
|
I && (M.preventDefault(), q(M));
|
|
1100
1100
|
}, H = () => {
|
|
@@ -1161,7 +1161,7 @@ const Se = (e) => {
|
|
|
1161
1161
|
throttleDuration: l = 25,
|
|
1162
1162
|
...n
|
|
1163
1163
|
}) => {
|
|
1164
|
-
const [s, i] =
|
|
1164
|
+
const [s, i] = C(null), a = me((s == null ? void 0 : s.scrollProgress) ?? 0), f = oe(
|
|
1165
1165
|
a,
|
|
1166
1166
|
[0, 1],
|
|
1167
1167
|
[0, 1 - ((s == null ? void 0 : s.scrollVisible) ?? 0) / ((s == null ? void 0 : s.scrollTotal) ?? 0)]
|
|
@@ -1204,7 +1204,7 @@ const Se = (e) => {
|
|
|
1204
1204
|
targetRef: e,
|
|
1205
1205
|
children: t
|
|
1206
1206
|
}) => {
|
|
1207
|
-
const [r, l] =
|
|
1207
|
+
const [r, l] = C(null), n = V(null), s = () => {
|
|
1208
1208
|
const i = e.current;
|
|
1209
1209
|
if (!i) return;
|
|
1210
1210
|
const a = i.getBoundingClientRect();
|
|
@@ -1258,12 +1258,12 @@ const Se = (e) => {
|
|
|
1258
1258
|
P(c);
|
|
1259
1259
|
}, [c]), N = { duration: 0.3, ...N };
|
|
1260
1260
|
let W;
|
|
1261
|
-
h ? h && (W = (
|
|
1262
|
-
t &&
|
|
1261
|
+
h ? h && (W = (S) => {
|
|
1262
|
+
t && S.preventDefault();
|
|
1263
1263
|
const q = !R;
|
|
1264
1264
|
P(q), h(q);
|
|
1265
|
-
}) : W = (
|
|
1266
|
-
t &&
|
|
1265
|
+
}) : W = (S) => {
|
|
1266
|
+
t && S.preventDefault(), p && p(S);
|
|
1267
1267
|
};
|
|
1268
1268
|
const k = Ce({
|
|
1269
1269
|
allowShapeTransformation: L,
|
|
@@ -1424,7 +1424,7 @@ const Se = (e) => {
|
|
|
1424
1424
|
scrollSensitivity: o
|
|
1425
1425
|
}), v = Y.Children.toArray(r).filter(
|
|
1426
1426
|
(g) => Y.isValidElement(g) && g.type === Qe
|
|
1427
|
-
), L = V(null), [N, E] =
|
|
1427
|
+
), L = V(null), [N, E] = C([]), [w, B] = C(null), b = () => {
|
|
1428
1428
|
var X;
|
|
1429
1429
|
if (!L.current || !c.current || !w) return [];
|
|
1430
1430
|
const { scrollVisible: g, scrollProgress: x } = w;
|
|
@@ -1445,7 +1445,7 @@ const Se = (e) => {
|
|
|
1445
1445
|
let T = Je(M, [0, 1], [0, i[1]]);
|
|
1446
1446
|
T < i[0] && (T = i[0]), M--, F[O.originalIndex] = T;
|
|
1447
1447
|
}), F;
|
|
1448
|
-
}, I = V([]).current, [R, P] =
|
|
1448
|
+
}, I = V([]).current, [R, P] = C(0);
|
|
1449
1449
|
D(() => {
|
|
1450
1450
|
f && f(R);
|
|
1451
1451
|
}, [R]), I.length !== v.length && v.forEach((g, x) => {
|
|
@@ -1466,7 +1466,7 @@ const Se = (e) => {
|
|
|
1466
1466
|
0,
|
|
1467
1467
|
1 - (((H = c.current) == null ? void 0 : H.clientWidth) ?? 0) / (((A = L == null ? void 0 : L.current) == null ? void 0 : A.clientWidth) ?? 0)
|
|
1468
1468
|
]
|
|
1469
|
-
),
|
|
1469
|
+
), S = oe(
|
|
1470
1470
|
m,
|
|
1471
1471
|
(g) => `${-g * 100}%`
|
|
1472
1472
|
), q = (g) => {
|
|
@@ -1476,7 +1476,7 @@ const Se = (e) => {
|
|
|
1476
1476
|
const g = b();
|
|
1477
1477
|
E(g);
|
|
1478
1478
|
}, [w]);
|
|
1479
|
-
const [K, Z] =
|
|
1479
|
+
const [K, Z] = C(0);
|
|
1480
1480
|
return fe(() => {
|
|
1481
1481
|
let g = i[1];
|
|
1482
1482
|
w && g > w.scrollVisible && (g = w.scrollVisible);
|
|
@@ -1498,7 +1498,7 @@ const Se = (e) => {
|
|
|
1498
1498
|
transitionDuration: "0.5s",
|
|
1499
1499
|
transitionTimingFunction: "ease-out",
|
|
1500
1500
|
gap: `${a}px`,
|
|
1501
|
-
x:
|
|
1501
|
+
x: S
|
|
1502
1502
|
},
|
|
1503
1503
|
children: W
|
|
1504
1504
|
}
|
|
@@ -1555,10 +1555,10 @@ const ye = ({
|
|
|
1555
1555
|
if (!l && !a)
|
|
1556
1556
|
throw new Error("ToolTip must have a child or a targetRef");
|
|
1557
1557
|
Array.isArray(o) || (o = [o]), t && !Array.isArray(t) && (t = [t]);
|
|
1558
|
-
const h = V(null), c = a || h, [y, v] =
|
|
1558
|
+
const h = V(null), c = a || h, [y, v] = C(null), [L] = C(ce()), [N, E] = C(!1), w = V(null);
|
|
1559
1559
|
D(() => {
|
|
1560
|
-
const m = (
|
|
1561
|
-
v(
|
|
1560
|
+
const m = (S) => {
|
|
1561
|
+
v(S.detail);
|
|
1562
1562
|
};
|
|
1563
1563
|
return document.addEventListener("tooltip-update", m), () => {
|
|
1564
1564
|
document.removeEventListener(
|
|
@@ -1609,7 +1609,7 @@ const ye = ({
|
|
|
1609
1609
|
}, [c, o, L, N]);
|
|
1610
1610
|
const W = !a && ee(l) ? le(l, { ref: h }) : l;
|
|
1611
1611
|
if (!i && typeof window < "u" && c != null && c.current && !i) {
|
|
1612
|
-
const m = c.current.getBoundingClientRect(),
|
|
1612
|
+
const m = c.current.getBoundingClientRect(), S = window.innerWidth, q = window.innerHeight, K = m.left / S, Z = m.top / q;
|
|
1613
1613
|
e === "plain" ? K < 1 / 3 ? i = "right" : K > 2 / 3 ? i = "left" : i = Z > 0.5 ? "top" : "bottom" : K < 1 / 2 && Z < 1 / 2 ? i = "bottom-right" : K > 1 / 2 && Z < 1 / 2 ? i = "bottom-left" : K > 1 / 2 && Z > 1 / 2 ? i = "top-left" : K < 1 / 2 && Z > 1 / 2 && (i = "top-right");
|
|
1614
1614
|
}
|
|
1615
1615
|
const k = Ke({
|
|
@@ -1649,14 +1649,14 @@ const ye = ({
|
|
|
1649
1649
|
children: [
|
|
1650
1650
|
n && /* @__PURE__ */ u("div", { className: k.subHead, children: n }),
|
|
1651
1651
|
/* @__PURE__ */ u("div", { className: k.supportingText, children: s }),
|
|
1652
|
-
t && /* @__PURE__ */ u("div", { className: k.actions, children: Array.isArray(t) && t.map((m,
|
|
1652
|
+
t && /* @__PURE__ */ u("div", { className: k.actions, children: Array.isArray(t) && t.map((m, S) => /* @__PURE__ */ u(
|
|
1653
1653
|
Ze,
|
|
1654
1654
|
{
|
|
1655
1655
|
size: "small",
|
|
1656
1656
|
variant: "text",
|
|
1657
1657
|
...m
|
|
1658
1658
|
},
|
|
1659
|
-
|
|
1659
|
+
S
|
|
1660
1660
|
)) })
|
|
1661
1661
|
]
|
|
1662
1662
|
}
|
|
@@ -1793,10 +1793,10 @@ const ye = ({
|
|
|
1793
1793
|
n || (n = s);
|
|
1794
1794
|
const [b, I] = Y.useState(a);
|
|
1795
1795
|
let R;
|
|
1796
|
-
i ? i && (R = (
|
|
1797
|
-
r &&
|
|
1798
|
-
}, o = b && h || o) : R = (
|
|
1799
|
-
r &&
|
|
1796
|
+
i ? i && (R = (S) => {
|
|
1797
|
+
r && S.preventDefault(), I(!b), i(!!b);
|
|
1798
|
+
}, o = b && h || o) : R = (S) => {
|
|
1799
|
+
r && S.preventDefault(), f && f(S);
|
|
1800
1800
|
}, D(() => {
|
|
1801
1801
|
I(a);
|
|
1802
1802
|
}, [a]);
|
|
@@ -1904,7 +1904,7 @@ const ye = ({
|
|
|
1904
1904
|
}, c = (g = !1) => g ? i : i == 1 / 0 ? a[(a == null ? void 0 : a.length) - 1].value : i, y = (g = !1) => g ? s : s == -1 / 0 ? a[0].value : s, v = (g) => {
|
|
1905
1905
|
const x = y(!1);
|
|
1906
1906
|
return (c(!1) - x) * g / 100 + x;
|
|
1907
|
-
}, [L, N] =
|
|
1907
|
+
}, [L, N] = C(!1), E = V(null), w = f || E, [B, b] = C(n), [I, R] = C(h(n)), [P, W] = C(!1), k = (g) => {
|
|
1908
1908
|
W(!0), N(!0), q(g);
|
|
1909
1909
|
}, m = () => {
|
|
1910
1910
|
W(!1), N(!1);
|
|
@@ -1912,7 +1912,7 @@ const ye = ({
|
|
|
1912
1912
|
D(() => (P ? (window.addEventListener("mouseup", m), window.addEventListener("mousemove", q), window.addEventListener("touchend", m), window.addEventListener("touchmove", q)) : (window.removeEventListener("mouseup", m), window.removeEventListener("mousemove", q), window.removeEventListener("touchend", m), window.removeEventListener("touchmove", q)), () => {
|
|
1913
1913
|
window.removeEventListener("mouseup", m), window.removeEventListener("mousemove", q), window.removeEventListener("touchend", m), window.removeEventListener("touchmove", q);
|
|
1914
1914
|
}), [P]);
|
|
1915
|
-
const
|
|
1915
|
+
const S = je({
|
|
1916
1916
|
className: e,
|
|
1917
1917
|
isChanging: L,
|
|
1918
1918
|
marks: a,
|
|
@@ -1959,7 +1959,7 @@ const ye = ({
|
|
|
1959
1959
|
let X = F.value === 1 / 0 ? c() : F.value === -1 / 0 ? y() : F.value, O = $.value === 1 / 0 ? c() : $.value === -1 / 0 ? y() : $.value;
|
|
1960
1960
|
return X = Math.abs(X - x), O = Math.abs(O - x), X < O ? F : $;
|
|
1961
1961
|
}).value), x >= c() && (x = c(!0)), x <= y() && (x = y(!0)), g = h(x), b(x), R(g), o && o(x);
|
|
1962
|
-
}, [Z, H] =
|
|
1962
|
+
}, [Z, H] = C(0);
|
|
1963
1963
|
return D(() => {
|
|
1964
1964
|
const g = () => {
|
|
1965
1965
|
w.current && H(w.current.offsetWidth);
|
|
@@ -1998,7 +1998,7 @@ const ye = ({
|
|
|
1998
1998
|
"aria-valuemax": c(!0),
|
|
1999
1999
|
"aria-valuenow": B,
|
|
2000
2000
|
"aria-valuetext": B.toString(),
|
|
2001
|
-
className:
|
|
2001
|
+
className: S.slider,
|
|
2002
2002
|
onMouseDown: k,
|
|
2003
2003
|
onClick: q,
|
|
2004
2004
|
ref: w,
|
|
@@ -2010,14 +2010,14 @@ const ye = ({
|
|
|
2010
2010
|
/* @__PURE__ */ u(
|
|
2011
2011
|
"div",
|
|
2012
2012
|
{
|
|
2013
|
-
className:
|
|
2013
|
+
className: S.activeTrack,
|
|
2014
2014
|
style: { flex: I / 100 }
|
|
2015
2015
|
}
|
|
2016
2016
|
),
|
|
2017
|
-
/* @__PURE__ */ u("div", { className:
|
|
2017
|
+
/* @__PURE__ */ u("div", { className: S.handle, children: /* @__PURE__ */ u(z, { children: L && /* @__PURE__ */ u(
|
|
2018
2018
|
j.div,
|
|
2019
2019
|
{
|
|
2020
|
-
className:
|
|
2020
|
+
className: S.valueIndicator,
|
|
2021
2021
|
initial: "hidden",
|
|
2022
2022
|
animate: "visible",
|
|
2023
2023
|
exit: "hidden",
|
|
@@ -2037,7 +2037,7 @@ const ye = ({
|
|
|
2037
2037
|
/* @__PURE__ */ u(
|
|
2038
2038
|
"div",
|
|
2039
2039
|
{
|
|
2040
|
-
className:
|
|
2040
|
+
className: S.inactiveTrack,
|
|
2041
2041
|
style: { flex: 1 - I / 100 }
|
|
2042
2042
|
}
|
|
2043
2043
|
),
|
|
@@ -2051,7 +2051,7 @@ const ye = ({
|
|
|
2051
2051
|
return M <= I - F ? $ = !0 : M >= I + F && ($ = !1), /* @__PURE__ */ u(
|
|
2052
2052
|
"div",
|
|
2053
2053
|
{
|
|
2054
|
-
className: d(
|
|
2054
|
+
className: d(S.dot, {
|
|
2055
2055
|
"bg-primary-container": $ != null && $,
|
|
2056
2056
|
"bg-primary": $ != null && !$
|
|
2057
2057
|
}),
|
|
@@ -2094,7 +2094,7 @@ const bt = ({
|
|
|
2094
2094
|
onClose: n,
|
|
2095
2095
|
...s
|
|
2096
2096
|
}) => {
|
|
2097
|
-
const [i, a] =
|
|
2097
|
+
const [i, a] = C(!0), f = Fe({
|
|
2098
2098
|
className: t,
|
|
2099
2099
|
closeIcon: l,
|
|
2100
2100
|
duration: r,
|
|
@@ -2145,7 +2145,7 @@ const bt = ({
|
|
|
2145
2145
|
ref: f,
|
|
2146
2146
|
...o
|
|
2147
2147
|
}) => {
|
|
2148
|
-
const [p, h] =
|
|
2148
|
+
const [p, h] = C(e), c = (w) => {
|
|
2149
2149
|
l || (v(), i && i(w));
|
|
2150
2150
|
}, y = (w) => {
|
|
2151
2151
|
l || ((w.key === " " || w.key === "Enter") && (w.preventDefault(), v()), a && a(w));
|
|
@@ -2216,7 +2216,7 @@ const bt = ({
|
|
|
2216
2216
|
ref: y,
|
|
2217
2217
|
...v
|
|
2218
2218
|
}) => {
|
|
2219
|
-
const L = V(null), N = y || L, [E, w] =
|
|
2219
|
+
const L = V(null), N = y || L, [E, w] = C(c);
|
|
2220
2220
|
D(() => {
|
|
2221
2221
|
c && i == null ? w(!0) : w(i == o && o != null);
|
|
2222
2222
|
}, [i]), D(() => {
|
|
@@ -2287,7 +2287,7 @@ const bt = ({
|
|
|
2287
2287
|
setSelectedTab: s,
|
|
2288
2288
|
scrollable: i = !1
|
|
2289
2289
|
}) => {
|
|
2290
|
-
const [a, f] =
|
|
2290
|
+
const [a, f] = C(
|
|
2291
2291
|
null
|
|
2292
2292
|
);
|
|
2293
2293
|
let o;
|
|
@@ -2341,7 +2341,7 @@ const bt = ({
|
|
|
2341
2341
|
showSupportingText: N = !1,
|
|
2342
2342
|
...E
|
|
2343
2343
|
}) => {
|
|
2344
|
-
const [w, B] =
|
|
2344
|
+
const [w, B] = C(L ?? ""), [b, I] = C(!1), [R, P] = C(!1), [W, k] = C(
|
|
2345
2345
|
N
|
|
2346
2346
|
);
|
|
2347
2347
|
D(() => {
|
|
@@ -2353,7 +2353,7 @@ const bt = ({
|
|
|
2353
2353
|
}, [W, f]), D(() => {
|
|
2354
2354
|
b && P(!1);
|
|
2355
2355
|
}, [b]);
|
|
2356
|
-
const m = Y.useRef(null),
|
|
2356
|
+
const m = Y.useRef(null), S = () => {
|
|
2357
2357
|
m.current && !b && m.current.focus();
|
|
2358
2358
|
}, q = () => {
|
|
2359
2359
|
I(!0);
|
|
@@ -2382,7 +2382,7 @@ const bt = ({
|
|
|
2382
2382
|
value: w,
|
|
2383
2383
|
suffix: n,
|
|
2384
2384
|
textLine: c
|
|
2385
|
-
}), [A] =
|
|
2385
|
+
}), [A] = C(ce());
|
|
2386
2386
|
let g, x;
|
|
2387
2387
|
switch (c) {
|
|
2388
2388
|
case "multiLine":
|
|
@@ -2397,7 +2397,7 @@ const bt = ({
|
|
|
2397
2397
|
break;
|
|
2398
2398
|
}
|
|
2399
2399
|
return /* @__PURE__ */ U("div", { className: H.textField, ...E, children: [
|
|
2400
|
-
/* @__PURE__ */ U("fieldset", { onClick:
|
|
2400
|
+
/* @__PURE__ */ U("fieldset", { onClick: S, className: H.content, children: [
|
|
2401
2401
|
/* @__PURE__ */ u("div", { className: H.stateLayer }),
|
|
2402
2402
|
p && /* @__PURE__ */ u("div", { className: H.leadingIcon, children: Y.isValidElement(p) ? p : /* @__PURE__ */ u(Q, { className: "w-5 h-5", icon: p }) }),
|
|
2403
2403
|
!(!b && !w.length || e == "filled") && /* @__PURE__ */ u(
|
|
@@ -2561,7 +2561,7 @@ const bt = ({
|
|
|
2561
2561
|
...w
|
|
2562
2562
|
}) => {
|
|
2563
2563
|
E && (r = E);
|
|
2564
|
-
const B = V(null), b = h || B, [I, R] =
|
|
2564
|
+
const B = V(null), b = h || B, [I, R] = C(p);
|
|
2565
2565
|
D(() => {
|
|
2566
2566
|
p && i == null ? R(!0) : R(i == f && f != null);
|
|
2567
2567
|
}, [i]), D(() => {
|
|
@@ -2631,7 +2631,7 @@ const bt = ({
|
|
|
2631
2631
|
transition: {
|
|
2632
2632
|
...c
|
|
2633
2633
|
}
|
|
2634
|
-
},
|
|
2634
|
+
}, S = {
|
|
2635
2635
|
width: "auto",
|
|
2636
2636
|
opacity: 1,
|
|
2637
2637
|
transition: {
|
|
@@ -2646,7 +2646,7 @@ const bt = ({
|
|
|
2646
2646
|
j.span,
|
|
2647
2647
|
{
|
|
2648
2648
|
initial: m,
|
|
2649
|
-
animate:
|
|
2649
|
+
animate: S,
|
|
2650
2650
|
exit: m,
|
|
2651
2651
|
className: k.label,
|
|
2652
2652
|
children: r
|
|
@@ -2666,7 +2666,7 @@ const bt = ({
|
|
|
2666
2666
|
duration: 0
|
|
2667
2667
|
}
|
|
2668
2668
|
}
|
|
2669
|
-
},
|
|
2669
|
+
}, S = {
|
|
2670
2670
|
height: "auto",
|
|
2671
2671
|
opacity: 1,
|
|
2672
2672
|
transition: {
|
|
@@ -2680,8 +2680,8 @@ const bt = ({
|
|
|
2680
2680
|
return /* @__PURE__ */ u(
|
|
2681
2681
|
j.span,
|
|
2682
2682
|
{
|
|
2683
|
-
initial:
|
|
2684
|
-
animate:
|
|
2683
|
+
initial: S,
|
|
2684
|
+
animate: S,
|
|
2685
2685
|
exit: m,
|
|
2686
2686
|
className: k.label,
|
|
2687
2687
|
transition: c,
|
|
@@ -2732,7 +2732,7 @@ const bt = ({
|
|
|
2732
2732
|
transition: p,
|
|
2733
2733
|
setSelectedItem: h
|
|
2734
2734
|
}) => {
|
|
2735
|
-
const [c, y] =
|
|
2735
|
+
const [c, y] = C(null), [v, L] = C(s);
|
|
2736
2736
|
let N;
|
|
2737
2737
|
n == 0 || n != null ? N = n : N = c;
|
|
2738
2738
|
const E = h || y, w = V(null), B = (k) => {
|
|
@@ -2740,8 +2740,8 @@ const bt = ({
|
|
|
2740
2740
|
};
|
|
2741
2741
|
function b(k) {
|
|
2742
2742
|
const m = [];
|
|
2743
|
-
return be.forEach(k, (
|
|
2744
|
-
ee(
|
|
2743
|
+
return be.forEach(k, (S) => {
|
|
2744
|
+
ee(S) && S.type === Ne ? m.push(...b(S.props.children)) : m.push(S);
|
|
2745
2745
|
}), m;
|
|
2746
2746
|
}
|
|
2747
2747
|
const I = b(r), R = I.filter(
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ActionOrLink } from '../utils';
|
|
2
|
-
import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
|
|
3
2
|
import { Dispatch, RefObject, SetStateAction } from 'react';
|
|
4
3
|
import { Transition } from 'motion';
|
|
5
4
|
import { Icon } from '../icon';
|
|
@@ -9,7 +8,7 @@ export type NavProps = {
|
|
|
9
8
|
label?: string;
|
|
10
9
|
children?: string;
|
|
11
10
|
icon: Icon;
|
|
12
|
-
iconSelected:
|
|
11
|
+
iconSelected: Icon;
|
|
13
12
|
selectedItem?: number | null;
|
|
14
13
|
setSelectedItem?: Dispatch<SetStateAction<number | null>>;
|
|
15
14
|
onItemSelected?: (args: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation-rail-item.interface.d.ts","sourceRoot":"","sources":["../../../src/lib/interfaces/navigation-rail-item.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"navigation-rail-item.interface.d.ts","sourceRoot":"","sources":["../../../src/lib/interfaces/navigation-rail-item.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,MAAM,MAAM,QAAQ,GAAG;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,UAAU,GAAG,YAAY,CAAC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,IAAI,CAAC;IACX,YAAY,EAAE,IAAI,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,eAAe,CAAC,EAAE,QAAQ,CAAC,cAAc,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC;IAC1D,cAAc,CAAC,EAAE,CACf,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,CAAC,GAAG;QACzD,GAAG,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC;KACrB,KACA,IAAI,CAAC;IACV,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,KAAK,QAAQ,GAAG;IACd,oBAAoB;IACpB,YAAY;IACZ,MAAM;IACN,OAAO;IACP,WAAW;CACZ,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,YAAY,CAAC,QAAQ,CAAC,GAAG;IACjE,MAAM,EAAE;QACN,UAAU,EAAE,OAAO,CAAC;KACrB,CAAC;IACF,QAAQ,EAAE,QAAQ,CAAC;CACpB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@udixio/ui-react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"react": "^19.1.1",
|
|
37
37
|
"react-dom": "^19.1.1",
|
|
38
|
-
"@udixio/theme": "1.
|
|
39
|
-
"@udixio/tailwind": "1.
|
|
38
|
+
"@udixio/theme": "1.1.0",
|
|
39
|
+
"@udixio/tailwind": "1.3.0"
|
|
40
40
|
},
|
|
41
41
|
"repository": {
|
|
42
42
|
"type": "git",
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ActionOrLink } from '../utils';
|
|
2
|
-
import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
|
|
3
2
|
import { Dispatch, RefObject, SetStateAction } from 'react';
|
|
4
3
|
import { Transition } from 'motion';
|
|
5
4
|
import { Icon } from '../icon';
|
|
@@ -10,7 +9,7 @@ export type NavProps = {
|
|
|
10
9
|
label?: string;
|
|
11
10
|
children?: string;
|
|
12
11
|
icon: Icon;
|
|
13
|
-
iconSelected:
|
|
12
|
+
iconSelected: Icon;
|
|
14
13
|
selectedItem?: number | null;
|
|
15
14
|
setSelectedItem?: Dispatch<SetStateAction<number | null>>;
|
|
16
15
|
onItemSelected?: (
|