@aic-kits/react 0.17.0 → 0.17.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -233,7 +233,7 @@ function print() { __p += __j.call(arguments, '') }
233
233
 
234
234
  /* Apply animation conditionally using the css helper */
235
235
  animation: ${({$autoScroll:r,$scrollDuration:s})=>r?ze`${l8} ${s}s linear infinite`:"none"};
236
- `;function c8({itemSpacing:r,itemsWrapperRef:s,items:i,renderItem:d,keyExtractor:c,autoScroll:g,activeIndex:_,itemsPerView:m=1,itemWidth:b}){const w=re(),A=w.__hd__.carousel.autoScroll,I=typeof g=="object"&&g.speed||A.defaultSpeed,T=g?i.length*(I/5):0,B=(W,D)=>c?c(W,D):`carousel-item-${D}`,O=w.spaces[r||w.__hd__.carousel.container.defaultItemSpacing]||0,z=f.useMemo(()=>{if(b)return b*m+O*(m-1)},[b,m,O]);return y.jsx(M,{width:z,display:"flex",children:y.jsx(u8,{$autoScroll:!!g,$scrollDuration:T,$itemSpacing:O,ref:s,children:g?y.jsxs(y.Fragment,{children:[i.map((W,D)=>y.jsx(zl,{item:W,index:D,renderItem:d},B(W,D))),i.map((W,D)=>y.jsx(zl,{item:W,index:D+i.length,renderItem:d},B(W,D+i.length)))]}):i.map((W,D)=>y.jsx(a8,{item:W,index:D,isFocused:D>=_&&D<_+m,renderItem:d,itemsPerView:m,itemWidth:b},B(W,D)))})})}function Fl({isLeft:r,onPrev:s,onNext:i}){const d=re(),c=d.__hd__.carousel.navigation,g=d.spaces[c.buttonPadding]*2+d.sizes[c.iconSize],_=Le(d,c.iconSize),m=d.colors[c.buttonColor]||c.buttonColor,b=typeof _=="string"?parseInt(_,10):_;return y.jsx(st,{onClick:r?s:i,display:"flex",justifyContent:"center",alignItems:"center",width:g,height:g,p:c.buttonPadding,ml:r?c.marginHorizontal:void 0,mr:r?void 0:c.marginHorizontal,r:c.buttonBorderRadius,bgColor:c.buttonBackgroundColor,zIndex:1,children:r?y.jsx(Lo,{size:b,color:m,weight:"fill"}):y.jsx(Vr,{size:b,color:m,weight:"fill"})})}function d8({itemsCount:r,activeIndex:s,onDotClick:i}){const d=re(),c=d.__hd__.carousel.pagination,g=c.container,_=Le(d,c.dotSize);return y.jsx(M,{display:"flex",justifyContent:"center",alignItems:"center",mt:g.marginTop,p:g.padding,r:g.borderRadius,bgColor:g.backgroundColor,gap:g.gap,children:Array.from({length:r}).map((m,b)=>y.jsx(M,{width:_,height:_,r:c.dotBorderRadius,bgColor:b===s?c.activeColor:c.inactiveColor,cursor:"pointer",transition:"background-color 0.3s ease",onClick:()=>i(b)},`dot-${b}`))})}const f8=/^(\d+|\d*\.\d+)(px)$/,h8=(r,s)=>{if(typeof s=="string"){if(Zn(s))return r.sizes[s];if(f8.test(s))return parseInt(s.replace("px",""),10);throw new Error("Invalid itemWidth, must be a Size or a number or a valid pixel value")}return s};function g8({items:r,renderItem:s,showPagination:i=!0,showNavigation:d=!0,autoPlay:c=!1,autoScroll:g=!1,initialIndex:_=0,onIndexChange:m,keyExtractor:b,itemSpacing:w,itemsPerView:R=1,itemWidth:A,...I},T){const B=re(),{width:O}=ju(),z=B.__hd__.carousel,[W,D]=f.useState(0),N=f.useRef(null),J=f.useRef(null),ie=f.useRef(!1),Y=!!g,q=Y?1:Math.max(1,R),fe=Y?void 0:h8(B,A),ae=B.spaces[w||z.container.defaultItemSpacing]||0,ge=Y?!1:i,pe=Y?!1:d,Ie=Math.max(0,r.length-q),It=Math.ceil(r.length/q),at=typeof c=="object"&&c.delay||3e3,Ae=f.useCallback(lt=>{const De=Math.max(0,Math.min(lt,Ie));if(De!==W&&(D(De),m==null||m(De)),N.current&&!Y){let ut=`calc(-${De*(100/q)}% - ${De*ae}px)`;fe&&(ut=`calc(-${De} * (${fe}px + ${ae}px))`),N.current.style.transform=`translateX(${ut})`}},[Ie,W,m,Y,q,ae,fe]),Zt=f.useCallback(()=>{Ae(Math.min(W+q,Ie))},[W,Ae,q,Ie]),Fe=f.useCallback(()=>{Ae(Math.max(W-q,0))},[W,Ae,q]);f.useImperativeHandle(T,()=>({goToIndex:Ae,goToNext:Zt,goToPrev:Fe}));const Me=f.useCallback(()=>{J.current&&clearTimeout(J.current)},[]),vn=()=>{ie.current=!0,c&&!Y&&Me(),Y&&N.current&&(N.current.style.animationPlayState="paused")},Ot=()=>{if(ie.current=!1,c&&!Y){Me();const lt=(W+1)%r.length,De=Math.min(lt,Ie);J.current=setTimeout(()=>Ae(De),at)}Y&&N.current&&(N.current.style.animationPlayState="running")},Pe=Math.floor(W/q),yn=lt=>{Ae(lt*q)};return f.useEffect(()=>{if(!c||Y||ie.current){Me();return}const lt=(W+1)%r.length,De=Math.min(lt,Ie);return J.current=setTimeout(()=>Ae(De),at),Me},[W,c,at,Ae,Me,Y,r.length,Ie]),f.useEffect(()=>{Ye()||Ae(_)},[O]),y.jsxs(M,{fw:!0,overflow:"hidden",onMouseEnter:vn,onMouseLeave:Ot,display:"flex",flexDirection:"column",alignItems:"center",...I,children:[y.jsxs(M,{display:"flex",justifyContent:pe?"space-between":"center",alignItems:"center",fw:!0,children:[pe&&r.length>q&&y.jsx(Fl,{isLeft:!0,onPrev:Fe,onNext:Zt}),y.jsx(c8,{itemsWrapperRef:N,itemSpacing:w,activeIndex:W,items:r,renderItem:s,keyExtractor:b,autoScroll:g,itemsPerView:q,itemWidth:fe}),pe&&r.length>q&&y.jsx(Fl,{isLeft:!1,onPrev:Fe,onNext:Zt})]}),ge&&It>1&&y.jsx(d8,{itemsCount:It,activeIndex:Pe,onDotClick:yn})]})}const p8=f.forwardRef(g8);function m8({renderContent:r,isExpanded:s}){const d=re().__hd__.accordion,c=d.animation,g=f.useRef(null),[_,m]=f.useState(0);return f.useEffect(()=>{s&&g.current&&m(g.current.scrollHeight)},[s,r]),y.jsx(M,{overflow:"hidden",transition:`height ${c.duration}ms ${c.easing},
236
+ `;function c8({itemSpacing:r,itemsWrapperRef:s,items:i,renderItem:d,keyExtractor:c,autoScroll:g,activeIndex:_,itemsPerView:m=1,itemWidth:b}){const w=re(),A=w.__hd__.carousel.autoScroll,I=typeof g=="object"&&g.speed||A.defaultSpeed,T=g?i.length*(I/5):0,B=(W,D)=>c?c(W,D):`carousel-item-${D}`,O=w.spaces[r||w.__hd__.carousel.container.defaultItemSpacing]||0,z=f.useMemo(()=>{if(b)return b*m+O*(m-1)},[b,m,O]);return y.jsx(M,{width:z,display:"flex",children:y.jsx(u8,{$autoScroll:!!g,$scrollDuration:T,$itemSpacing:O,ref:s,children:g?y.jsxs(y.Fragment,{children:[i.map((W,D)=>y.jsx(zl,{item:W,index:D,renderItem:d},B(W,D))),i.map((W,D)=>y.jsx(zl,{item:W,index:D+i.length,renderItem:d},B(W,D+i.length)))]}):i.map((W,D)=>y.jsx(a8,{item:W,index:D,isFocused:D>=_&&D<_+m,renderItem:d,itemsPerView:m,itemWidth:b},B(W,D)))})})}function Fl({isLeft:r,onPrev:s,onNext:i}){const d=re(),c=d.__hd__.carousel.navigation,g=d.spaces[c.buttonPadding]*2+d.sizes[c.iconSize],_=Le(d,c.iconSize),m=d.colors[c.buttonColor]||c.buttonColor,b=typeof _=="string"?parseInt(_,10):_;return y.jsx(st,{onClick:r?s:i,display:"flex",justifyContent:"center",alignItems:"center",width:g,height:g,p:c.buttonPadding,ml:r?{xs:"none",sm:c.marginHorizontal}:void 0,mr:r?void 0:{xs:"none",sm:c.marginHorizontal},r:c.buttonBorderRadius,bgColor:c.buttonBackgroundColor,zIndex:1,children:r?y.jsx(Lo,{size:b,color:m,weight:"fill"}):y.jsx(Vr,{size:b,color:m,weight:"fill"})})}function d8({itemsCount:r,activeIndex:s,onDotClick:i}){const d=re(),c=d.__hd__.carousel.pagination,g=c.container,_=Le(d,c.dotSize);return y.jsx(M,{display:"flex",justifyContent:"center",alignItems:"center",mt:g.marginTop,p:g.padding,r:g.borderRadius,bgColor:g.backgroundColor,gap:g.gap,children:Array.from({length:r}).map((m,b)=>y.jsx(M,{width:_,height:_,r:c.dotBorderRadius,bgColor:b===s?c.activeColor:c.inactiveColor,cursor:"pointer",transition:"background-color 0.3s ease",onClick:()=>i(b)},`dot-${b}`))})}const f8=/^(\d+|\d*\.\d+)(px)$/,h8=(r,s)=>{if(typeof s=="string"){if(Zn(s))return r.sizes[s];if(f8.test(s))return parseInt(s.replace("px",""),10);throw new Error("Invalid itemWidth, must be a Size or a number or a valid pixel value")}return s};function g8({items:r,renderItem:s,showPagination:i=!0,showNavigation:d=!0,autoPlay:c=!1,autoScroll:g=!1,initialIndex:_=0,onIndexChange:m,keyExtractor:b,itemSpacing:w,itemsPerView:R=1,itemWidth:A,...I},T){const B=re(),{width:O}=ju(),z=B.__hd__.carousel,[W,D]=f.useState(0),N=f.useRef(null),J=f.useRef(null),ie=f.useRef(!1),Y=!!g,q=Y?1:Math.max(1,R),fe=Y?void 0:h8(B,A),ae=B.spaces[w||z.container.defaultItemSpacing]||0,ge=Y?!1:i,pe=Y?!1:d,Ie=Math.max(0,r.length-q),It=Math.ceil(r.length/q),at=typeof c=="object"&&c.delay||3e3,Ae=f.useCallback(lt=>{const De=Math.max(0,Math.min(lt,Ie));if(De!==W&&(D(De),m==null||m(De)),N.current&&!Y){let ut=`calc(-${De*(100/q)}% - ${De*ae}px)`;fe&&(ut=`calc(-${De} * (${fe}px + ${ae}px))`),N.current.style.transform=`translateX(${ut})`}},[Ie,W,m,Y,q,ae,fe]),Zt=f.useCallback(()=>{Ae(Math.min(W+q,Ie))},[W,Ae,q,Ie]),Fe=f.useCallback(()=>{Ae(Math.max(W-q,0))},[W,Ae,q]);f.useImperativeHandle(T,()=>({goToIndex:Ae,goToNext:Zt,goToPrev:Fe}));const Me=f.useCallback(()=>{J.current&&clearTimeout(J.current)},[]),vn=()=>{ie.current=!0,c&&!Y&&Me(),Y&&N.current&&(N.current.style.animationPlayState="paused")},Ot=()=>{if(ie.current=!1,c&&!Y){Me();const lt=(W+1)%r.length,De=Math.min(lt,Ie);J.current=setTimeout(()=>Ae(De),at)}Y&&N.current&&(N.current.style.animationPlayState="running")},Pe=Math.floor(W/q),yn=lt=>{Ae(lt*q)};return f.useEffect(()=>{if(!c||Y||ie.current){Me();return}const lt=(W+1)%r.length,De=Math.min(lt,Ie);return J.current=setTimeout(()=>Ae(De),at),Me},[W,c,at,Ae,Me,Y,r.length,Ie]),f.useEffect(()=>{Ye()||Ae(_)},[O]),y.jsxs(M,{fw:!0,overflow:"hidden",onMouseEnter:vn,onMouseLeave:Ot,display:"flex",flexDirection:"column",alignItems:"center",...I,children:[y.jsxs(M,{display:"flex",justifyContent:pe?"space-between":"center",alignItems:"center",fw:!0,children:[pe&&r.length>q&&y.jsx(Fl,{isLeft:!0,onPrev:Fe,onNext:Zt}),y.jsx(c8,{itemsWrapperRef:N,itemSpacing:w,activeIndex:W,items:r,renderItem:s,keyExtractor:b,autoScroll:g,itemsPerView:q,itemWidth:fe}),pe&&r.length>q&&y.jsx(Fl,{isLeft:!1,onPrev:Fe,onNext:Zt})]}),ge&&It>1&&y.jsx(d8,{itemsCount:It,activeIndex:Pe,onDotClick:yn})]})}const p8=f.forwardRef(g8);function m8({renderContent:r,isExpanded:s}){const d=re().__hd__.accordion,c=d.animation,g=f.useRef(null),[_,m]=f.useState(0);return f.useEffect(()=>{s&&g.current&&m(g.current.scrollHeight)},[s,r]),y.jsx(M,{overflow:"hidden",transition:`height ${c.duration}ms ${c.easing},
237
237
  opacity ${c.duration}ms ${c.easing}`,height:s?_:0,opacity:s?1:0,children:y.jsx(M,{ref:g,pt:d.gap,children:r()})})}const x8=ue(Vr)`
238
238
  transition: transform ${({$duration:r,$easing:s})=>`${r}ms ${s}`};
239
239
  transform: rotate(${({$isExpanded:r})=>r?"90deg":"0deg"});
package/dist/index.js CHANGED
@@ -7197,8 +7197,8 @@ function Tl({
7197
7197
  width: h,
7198
7198
  height: h,
7199
7199
  p: c.buttonPadding,
7200
- ml: r ? c.marginHorizontal : void 0,
7201
- mr: r ? void 0 : c.marginHorizontal,
7200
+ ml: r ? { xs: "none", sm: c.marginHorizontal } : void 0,
7201
+ mr: r ? void 0 : { xs: "none", sm: c.marginHorizontal },
7202
7202
  r: c.buttonBorderRadius,
7203
7203
  bgColor: c.buttonBackgroundColor,
7204
7204
  zIndex: 1,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aic-kits/react",
3
- "version": "0.17.0",
3
+ "version": "0.17.1",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -46,5 +46,5 @@
46
46
  "vite-plugin-dts": "^4.3.0",
47
47
  "vitest": "^2.1.8"
48
48
  },
49
- "gitHead": "f93460af34343f41c04e85c478f7a20104b86db7"
49
+ "gitHead": "c0004234f948da37d7cf1b239600ab47ce889dc9"
50
50
  }