alope-ui 1.2.29 → 1.2.30

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.
@@ -17,7 +17,8 @@ export type BadgeProps = {
17
17
  children?: React.ReactNode | string;
18
18
  color?: keyof typeof BadgeColors;
19
19
  position?: keyof typeof BadgePositions;
20
- icon?: React.ReactNode;
20
+ prefixIcon?: React.ReactNode;
21
+ suffixIcon?: React.ReactNode;
21
22
  } & Omit<React.HTMLAttributes<HTMLSpanElement>, 'className' | 'color'>;
22
23
  export declare const Badge: React.FC<BadgeProps>;
23
24
  export {};
package/dist/main.cjs CHANGED
@@ -12,10 +12,10 @@ function M(e){return"number"==typeof e?{base:e}:e}const R={base:{1:"col-span-1",
12
12
  function E(e){return"number"==typeof e?{base:e}:e}const F=r.forwardRef(({children:r,className:t,cols:s,gap:o=4,...n},l)=>{const d=(i=E(s))?Object.entries(i).map(([e,r])=>$[e]?.[r]??""):[]
13
13
  var i
14
14
  const c=function(e){return e?Object.entries(e).map(([e,r])=>T[e]?.[r]??""):[]}(E(o))
15
- return e.jsx("div",{ref:l,className:a.cn("grid-mason",d,c,t),...n,children:r})}),V={outline:"border border-current",solid:""},B={topLeft:"top-5 left-5",bottomLeft:"bottom-5 left-5",topRight:"top-5 right-5",bottomRight:"bottom-5 right-5"},I={success:"bg-success-30 border-success-700 text-success-700",info:"bg-info-30 border-info-700 text-info-700",warning:"bg-warning-30 border-warning-700 text-warning-700",error:"bg-error-30 border-error-700 text-error-700"},A={topRight:"translate-x-0",bottomRight:"translate-x-0",topLeft:"-translate-x-0",bottomLeft:"-translate-x-0"},O={topRight:"translate-x-40",bottomRight:"translate-x-40",topLeft:"-translate-x-40",bottomLeft:"-translate-x-40"},P={topRight:"translate-x-10",bottomRight:"translate-x-10",topLeft:"-translate-x-10",bottomLeft:"-translate-x-10"},W=({title:t,message:s,type:o,icon:n,position:l="bottomRight",variant:d="solid",onClose:i})=>{const[c,m]=r.useState(!1),[u,p]=r.useState(!1),x=r.useRef(null)
15
+ return e.jsx("div",{ref:l,className:a.cn("grid-mason",d,c,t),...n,children:r})}),I={outline:"border border-current",solid:""},V={topLeft:"top-5 left-5",bottomLeft:"bottom-5 left-5",topRight:"top-5 right-5",bottomRight:"bottom-5 right-5"},B={success:"bg-success-30 border-success-700 text-success-700",info:"bg-info-30 border-info-700 text-info-700",warning:"bg-warning-30 border-warning-700 text-warning-700",error:"bg-error-30 border-error-700 text-error-700"},A={topRight:"translate-x-0",bottomRight:"translate-x-0",topLeft:"-translate-x-0",bottomLeft:"-translate-x-0"},O={topRight:"translate-x-40",bottomRight:"translate-x-40",topLeft:"-translate-x-40",bottomLeft:"-translate-x-40"},P={topRight:"translate-x-10",bottomRight:"translate-x-10",topLeft:"-translate-x-10",bottomLeft:"-translate-x-10"},W=({title:t,message:s,type:o,icon:n,position:l="bottomRight",variant:d="solid",onClose:i})=>{const[c,m]=r.useState(!1),[u,p]=r.useState(!1),x=r.useRef(null)
16
16
  r.useEffect(()=>(setTimeout(()=>m(!0),50),x.current=setTimeout(()=>{b()},3500),()=>{x.current&&clearTimeout(x.current)}),[])
17
17
  const b=()=>{p(!0),setTimeout(()=>{i&&i()},500)}
18
- return e.jsxs("div",{onMouseEnter:()=>{x.current&&(clearTimeout(x.current),x.current=null)},onMouseLeave:()=>{x.current=setTimeout(()=>{b()},3500)},className:a.cn("flex max-w-sm items-start gap-3 p-4 mb-3 rounded-lg shadow-lg transition-all duration-500 transform",I[o],V[d],u?`opacity-0 ${O[l]}`:c?`opacity-100 ${A[l]}`:`opacity-0 ${P[l]}`),children:[n&&e.jsx("div",{className:"text-2xl mt-1",children:n}),e.jsxs("div",{className:"flex-1",children:[t&&e.jsx("p",{className:"font-semibold text-base mb-1",children:t}),e.jsx("p",{className:"text-sm leading-snug",children:s})]}),e.jsx("button",{onClick:b,className:"ml-2 text-lg leading-none hover:text-red-500 focus:outline-none cursor-pointer","aria-label":"Close",children:"×"})]})},H=r.createContext(void 0),Y={sm:"max-w-sm",md:"max-w-md",lg:"max-w-2xl",xl:"max-w-4xl"},X={default:"w-3/4 md:w-1/2",sm:"w-3/4 md:w-60",md:"w-3/4 md:w-80",lg:"w-3/4 md:w-[40rem]"},q={sm:"px-3 py-2 text-sm font-medium rounded-lg",md:"px-4 py-2 text-base font-medium rounded-lg",lg:"px-6 py-3 text-lg font-medium rounded-lg"},G={sm:{container:"text-sm",radio:"w-4 h-4",label:"pl-2"},md:{container:"text-base",radio:"w-5 h-5",label:"pl-2"},lg:{container:"text-lg",radio:"w-6 h-6",label:"pl-3"}},U={solid:{label:"border-transparent bg-primary dark:bg-primary-dark text-white dark:hover:bg-primary-dark-700 hover:bg-primary-700",checked:"bg-primary-700 dark:bg-primary-dark-700",radio:"",checkedRadio:"border-white bg-primary dark:bg-primary"},subtle:{label:"border-none bg-secondary/30 dark:text-white hover:text-primary-700 hover:dark:text-primary-30 dark:text-white dark:bg-primary-dark/50 hover:bg-primary/30",checked:"bg-primary/30 text-primary-700 dark:bg-primary/30 dark:text-white hover:dark:text-white",radio:"dark:bg-primary",checkedRadio:"bg-primary dark:bg-primary-500 border-none"},outline:{label:"border-secondary-700 hover:bg-primary/30 hover:text-primary-700 hover:border-primary-700 dark:hover:bg-primary/20 bg-transparent dark:text-white dark:border-secondary-dark dark:hover:bg-primary-dark/20",checked:"border-primary bg-primary/30 text-primary-700 dark:border-primary-700 dark:bg-primary-dark/20",radio:" dark:border-secondary-dark hover:border-primary",checkedRadio:"bg-primary-700 dark:border-primary-700 dark:border-primary dark:bg-primary"}},Z=({children:t,text:s,showArrow:o=!0,placement:n="top",offset:l=8,bgColor:d="bg-gray-800 dark:bg-gray-600",isOpen:i,onOpenChange:c,disabled:m=!1,animationDuration:u=300,delay:p=700})=>{const[x,b]=r.useState(!1),g=i??x,h={...(()=>{switch(n){case"top":default:return{bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:`${l}px`}
18
+ return e.jsxs("div",{onMouseEnter:()=>{x.current&&(clearTimeout(x.current),x.current=null)},onMouseLeave:()=>{x.current=setTimeout(()=>{b()},3500)},className:a.cn("flex max-w-sm items-start gap-3 p-4 mb-3 rounded-lg shadow-lg transition-all duration-500 transform",B[o],I[d],u?`opacity-0 ${O[l]}`:c?`opacity-100 ${A[l]}`:`opacity-0 ${P[l]}`),children:[n&&e.jsx("div",{className:"text-2xl mt-1",children:n}),e.jsxs("div",{className:"flex-1",children:[t&&e.jsx("p",{className:"font-semibold text-base mb-1",children:t}),e.jsx("p",{className:"text-sm leading-snug",children:s})]}),e.jsx("button",{onClick:b,className:"ml-2 text-lg leading-none hover:text-red-500 focus:outline-none cursor-pointer","aria-label":"Close",children:"×"})]})},H=r.createContext(void 0),Y={sm:"max-w-sm",md:"max-w-md",lg:"max-w-2xl",xl:"max-w-4xl"},X={default:"w-3/4 md:w-1/2",sm:"w-3/4 md:w-60",md:"w-3/4 md:w-80",lg:"w-3/4 md:w-[40rem]"},q={sm:"px-3 py-2 text-sm font-medium rounded-lg",md:"px-4 py-2 text-base font-medium rounded-lg",lg:"px-6 py-3 text-lg font-medium rounded-lg"},G={sm:{container:"text-sm",radio:"w-4 h-4",label:"pl-2"},md:{container:"text-base",radio:"w-5 h-5",label:"pl-2"},lg:{container:"text-lg",radio:"w-6 h-6",label:"pl-3"}},U={solid:{label:"border-transparent bg-primary dark:bg-primary-dark text-white dark:hover:bg-primary-dark-700 hover:bg-primary-700",checked:"bg-primary-700 dark:bg-primary-dark-700",radio:"",checkedRadio:"border-white bg-primary dark:bg-primary"},subtle:{label:"border-none bg-secondary/30 dark:text-white hover:text-primary-700 hover:dark:text-primary-30 dark:text-white dark:bg-primary-dark/50 hover:bg-primary/30",checked:"bg-primary/30 text-primary-700 dark:bg-primary/30 dark:text-white hover:dark:text-white",radio:"dark:bg-primary",checkedRadio:"bg-primary dark:bg-primary-500 border-none"},outline:{label:"border-secondary-700 hover:bg-primary/30 hover:text-primary-700 hover:border-primary-700 dark:hover:bg-primary/20 bg-transparent dark:text-white dark:border-secondary-dark dark:hover:bg-primary-dark/20",checked:"border-primary bg-primary/30 text-primary-700 dark:border-primary-700 dark:bg-primary-dark/20",radio:" dark:border-secondary-dark hover:border-primary",checkedRadio:"bg-primary-700 dark:border-primary-700 dark:border-primary dark:bg-primary"}},Z=({children:t,text:s,showArrow:o=!0,placement:n="top",offset:l=8,bgColor:d="bg-gray-800 dark:bg-gray-600",isOpen:i,onOpenChange:c,disabled:m=!1,animationDuration:u=300,delay:p=700})=>{const[x,b]=r.useState(!1),g=i??x,h={...(()=>{switch(n){case"top":default:return{bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:`${l}px`}
19
19
  case"bottom":return{top:"100%",left:"50%",transform:"translateX(-50%)",marginTop:`${l}px`}
20
20
  case"left":return{right:"100%",top:"50%",transform:"translateY(-50%)",marginRight:`${l}px`}
21
21
  case"right":return{left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:`${l}px`}}})(),transitionDelay:g&&!i?`${p}ms`:"0ms",transitionDuration:`${u}ms`}
@@ -34,8 +34,8 @@ p?n?.(o?a[0]??null:a):b(a)})(t),className:"w-full flex justify-between items-cen
34
34
  if(!p)return null
35
35
  const b=i?e.jsx("div",{className:"mt-2",children:"function"==typeof i?i():i}):null
36
36
  return e.jsxs("div",{id:"alopeAlert",className:a.cn("flex gap-2 p-4 rounded-md w-full",l[m],o[u]),children:[d??e.jsx("svg",{viewBox:"0 0 24 24",className:a.cn("w-6 h-6 shrink-0",n[m]),children:e.jsx("path",{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM11 15H13V17H11V15ZM11 7H13V13H11V7Z"})}),e.jsxs("div",{className:"flex md:flex-row flex-col justify-between md:items-center w-full",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("p",{className:"font-medium",children:t}),s&&e.jsx("p",{className:"text-sm",children:s}),c&&b]}),!c&&b&&e.jsx("div",{children:b})]}),c&&e.jsx("svg",{onClick:()=>x(!1),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",className:"w-6 h-6 shrink-0 hover:cursor-pointer",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M6 18L18 6M6 6l12 12"})})]})},exports.Avatar=u,exports.AvatarGroup=({avatars:r,maxVisible:t=3,size:s="md",overlap:o="-ml-3",className:n})=>{const l=r.slice(0,t),d=r.length-t
37
- return e.jsxs("div",{className:a.cn("flex items-center",n),children:[l.map((r,t)=>e.jsx("div",{className:a.cn(0!==t&&o),children:e.jsx(u,{...r,size:s})},t)),d>0&&e.jsxs("div",{className:a.cn("flex items-center justify-center bg-secondary dark:bg-secondary-dark font-medium",o,"sm"===s&&"w-8 h-8 text-xs rounded-full","md"===s&&"w-12 h-12 text-sm rounded-full","lg"===s&&"w-16 h-16 text-base rounded-full"),children:["+",d]})]})},exports.Badge=({children:r,color:t="default",position:s,icon:o,...n})=>{const l=p[t],d=s?x[s]:""
38
- return e.jsxs("span",{...n,className:a.cn("inline-flex items-center px-3 py-1 rounded-full text-sm font-semibold",l,d),children:[o&&e.jsx("span",{className:"mr-1",children:o}),r]})},exports.BottomNavbar=({children:a,className:t,value:s,onChangeValue:o})=>e.jsx("div",{className:`fixed bottom-0 left-0 z-50 w-full bg-white border-t border-secondary dark:bg-gray-800 dark:border-secondary-dark-700 ${t??""}`,children:e.jsx("div",{className:"flex items-center justify-center h-full max-w-lg md:max-w-md mx-auto font-medium",children:r.Children.map(a,e=>r.isValidElement(e)&&e.type===b?r.cloneElement(e,{selectedValue:s,onChangeValue:o}):(process.env.NODE_ENV,null))})}),exports.BottomNavbarAction=b,exports.Breadcrumb=({data:r,color:s="primary",separator:o="/"})=>e.jsx("nav",{"aria-label":"breadcrumb",className:"mb-5",children:e.jsx("ol",{className:"flex flex-wrap items-center gap-2 text-sm",children:r.map((n,l)=>{const d=null===n.path||l===r.length-1
37
+ return e.jsxs("div",{className:a.cn("flex items-center",n),children:[l.map((r,t)=>e.jsx("div",{className:a.cn(0!==t&&o),children:e.jsx(u,{...r,size:s})},t)),d>0&&e.jsxs("div",{className:a.cn("flex items-center justify-center bg-secondary dark:bg-secondary-dark font-medium",o,"sm"===s&&"w-8 h-8 text-xs rounded-full","md"===s&&"w-12 h-12 text-sm rounded-full","lg"===s&&"w-16 h-16 text-base rounded-full"),children:["+",d]})]})},exports.Badge=({children:r,color:t="default",position:s,prefixIcon:o,suffixIcon:n,...l})=>{const d=p[t],i=s?x[s]:""
38
+ return e.jsxs("span",{...l,className:a.cn("inline-flex items-center gap-1 px-3 py-1 rounded-full text-sm font-semibold",d,i),children:[o&&e.jsx("span",{className:"inline-flex shrink-0",children:o}),r,n&&e.jsx("span",{className:"inline-flex shrink-0",children:n})]})},exports.BottomNavbar=({children:a,className:t,value:s,onChangeValue:o})=>e.jsx("div",{className:`fixed bottom-0 left-0 z-50 w-full bg-white border-t border-secondary dark:bg-gray-800 dark:border-secondary-dark-700 ${t??""}`,children:e.jsx("div",{className:"flex items-center justify-center h-full max-w-lg md:max-w-md mx-auto font-medium",children:r.Children.map(a,e=>r.isValidElement(e)&&e.type===b?r.cloneElement(e,{selectedValue:s,onChangeValue:o}):(process.env.NODE_ENV,null))})}),exports.BottomNavbarAction=b,exports.Breadcrumb=({data:r,color:s="primary",separator:o="/"})=>e.jsx("nav",{"aria-label":"breadcrumb",className:"mb-5",children:e.jsx("ol",{className:"flex flex-wrap items-center gap-2 text-sm",children:r.map((n,l)=>{const d=null===n.path||l===r.length-1
39
39
  return e.jsxs("li",{className:"flex items-center",children:[d?e.jsxs("span",{"aria-current":"page",className:a.cn("flex items-center font-medium",g[s]),children:[n.icon&&e.jsx("span",{className:"mr-1.5",children:n.icon}),n.label]}):n.path?e.jsxs(t.Link,{to:n.path,className:"flex items-center text-zinc-400 transition-colors hover:text-zinc-700 dark:text-zinc-500 dark:hover:text-zinc-300",children:[n.icon&&e.jsx("span",{className:"mr-1.5",children:n.icon}),n.label]}):e.jsxs("span",{className:"flex items-center text-zinc-400 dark:text-zinc-500",children:[n.icon&&e.jsx("span",{className:"mr-1.5",children:n.icon}),n.label]}),!d&&e.jsx("span",{"aria-hidden":"true",className:"ml-2 select-none text-zinc-300 dark:text-zinc-700",children:o})]},l)})})}),exports.Button=({children:r,onClick:s,size:o="md",to:n,type:l="button",disabled:d=!1,variant:i="solid",color:c="primary",radius:m="regular",fullWidth:u=!1,prefixIcon:p,suffixIcon:x})=>{const b=k[m],g=y(i,c),f=h[o]||"",w=d?"opacity-50 cursor-not-allowed":"cursor-pointer",v=u?"w-full":"",j=a.cn("inline-flex items-center justify-center transition-all duration-[170ms] hover:scale-[98%]",g,f,w,v,b)
40
40
  return n?e.jsxs(t.Link,{to:n,className:j,children:[p&&e.jsx("span",{className:"mr-2",children:p}),r,x&&e.jsx("span",{className:"ml-2",children:x})]}):e.jsxs("button",{disabled:d,type:l,onClick:s,className:j,children:[p&&e.jsx("span",{className:"mr-2",children:p}),r,x&&e.jsx("span",{className:"ml-2",children:x})]})},exports.ButtonVariantsMap=f,exports.Card=({title:r,description:t,image:s,onClick:o,footer:n,horizontal:l=!1,size:d="md",containerClassName:i,descriptionClassName:c,imageClassName:m,titleClassName:u,ribbonClassName:p,ribbon:x,children:b})=>e.jsx("div",{onClick:o,className:a.cn("relative bg-white rounded-xl shadow-lg hover:shadow-xl transition-shadow duration-300 cursor-pointer overflow-hidden dark:border dark:bg-gray-800 dark:border-gray-700",l?"flex flex-col md:flex-row":"flex flex-col",{sm:"max-w-xs",md:"max-w-sm",lg:"max-w-md",full:"w-full"}[d]||d,i),children:b??e.jsxs(e.Fragment,{children:[s?"string"==typeof s?e.jsx("img",{src:s,alt:r,className:a.cn("object-cover w-full h-48 md:h-full",l?"md:w-[40%]":"w-full",m)}):e.jsx("div",{className:a.cn("w-full h-48 md:h-full",l?"md:w-[40%]":"w-full",m),children:s}):null,e.jsxs("div",{className:"p-4 flex flex-col justify-between flex-1",children:[x&&e.jsx("span",{className:a.cn("bg-red-500 text-white py-1 absolute text-[10px] md:text-xs w-[150px] text-center z-10",l?"top-3 -left-[50px] -rotate-45":"top-3 -right-[50px] rotate-45",p),children:x}),e.jsxs("div",{children:[r&&e.jsx("h3",{className:a.cn("text-lg font-semibold text-gray-800 line-clamp-1 dark:text-white",u),children:r}),t&&e.jsx("p",{className:a.cn("mt-2 text-secondary-700 text-sm mb-2 line-clamp-3 dark:text-secondary-dark",c),children:t})]}),n&&e.jsx("div",{className:"mt-2",children:n})]})]})}),exports.CheckboxInput=w,exports.CodeInput=({id:t,label:s,length:o,value:n,disabled:l,labelClassName:d,name:i,onCodeChange:c,inputSize:m="md",...u})=>{const p=r.useRef([]),x=N[m],b=e=>{const r=p.current.map(e=>e?.value||"").join("")
41
41
  c&&c(r),p.current[e]?.value&&e<o-1&&p.current[e+1]?.focus()}
@@ -117,9 +117,9 @@ if(e&&r){const a=e.offsetLeft,t=e.offsetWidth
117
117
  r.style.transform=`translateX(${a}px)`,r.style.width=`${t}px`,e.scrollIntoView({behavior:"smooth",inline:"center",block:"nearest"})}},[b,t]),e.jsxs("div",{children:[e.jsx("div",{className:a.cn("relative",g.wrapper,n),children:e.jsxs("nav",{className:"relative -mb-px flex space-x-2 overflow-x-auto scroll-smooth","aria-label":"Tabs",children:[t.map((r,t)=>{const o=a.cn("hover:cursor-pointer",s&&"flex-1",g.button,l,b===t?a.cn(g.active,d):a.cn(g.inactive,i),r.disabled&&"hover:cursor-not-allowed cursor-not-allowed opacity-50")
118
118
  return r.link?e.jsx("a",{href:r.disabled?void 0:r.link,ref:e=>{k.current[t]=e},className:o,"aria-disabled":r.disabled,onClick:e=>r.disabled&&e.preventDefault(),children:r.label},r.label):e.jsx("button",{ref:e=>{k.current[t]=e},onClick:()=>(e=>{x?m(e):p(e)})(t),disabled:r.disabled,className:o,children:r.label},r.label)}),e.jsx("div",{ref:f,className:a.cn(h),style:{width:0,transform:"translateX(0px)"}})]})}),e.jsx("div",{className:"mt-4",children:t[b]?.content})]})},exports.TextInput=C,exports.Textarea=({label:t,id:s,name:o,error:n,autoResize:l=!1,customClassName:d,...i})=>{const c=r.useRef(null),m=()=>{const e=c.current
119
119
  e&&(e.style.height="auto",e.style.height=`${e.scrollHeight}px`)}
120
- return r.useEffect(()=>{l&&m()},[]),e.jsxs("div",{children:[t&&e.jsx("label",{htmlFor:s||o,className:"inline-block text-sm font-medium mb-1 dark:text-white",children:t}),e.jsx("textarea",{id:s||o,name:o,rows:l?1:5,ref:c,onInput:m,className:a.cn("overflow-hidden bg-gray-50 w-full block px-3 py-2 border rounded-md shadow-sm focus:outline-none focus:ring-primary focus:border-primary sm:text-sm border-secondary min-h-[58px] max-h-[10rem]","dark:bg-gray-800 dark:border-secondary-dark dark:text-white dark:placeholder:text-gray-400",l?"resize-none":"resize",n&&"border-error dark:border-error-dark",i.disabled&&"bg-secondary/40 cursor-not-allowed",d),...i}),n&&e.jsx("p",{className:"mt-1 text-sm text-red-600 dark:text-red-500",children:n})]})},exports.Timeline=le,exports.ToastProvider=({children:a})=>{const[t,s]=r.useState([]),o=Object.keys(B)
120
+ return r.useEffect(()=>{l&&m()},[]),e.jsxs("div",{children:[t&&e.jsx("label",{htmlFor:s||o,className:"inline-block text-sm font-medium mb-1 dark:text-white",children:t}),e.jsx("textarea",{id:s||o,name:o,rows:l?1:5,ref:c,onInput:m,className:a.cn("overflow-hidden bg-gray-50 w-full block px-3 py-2 border rounded-md shadow-sm focus:outline-none focus:ring-primary focus:border-primary sm:text-sm border-secondary min-h-[58px] max-h-[10rem]","dark:bg-gray-800 dark:border-secondary-dark dark:text-white dark:placeholder:text-gray-400",l?"resize-none":"resize",n&&"border-error dark:border-error-dark",i.disabled&&"bg-secondary/40 cursor-not-allowed",d),...i}),n&&e.jsx("p",{className:"mt-1 text-sm text-red-600 dark:text-red-500",children:n})]})},exports.Timeline=le,exports.ToastProvider=({children:a})=>{const[t,s]=r.useState([]),o=Object.keys(V)
121
121
  return e.jsxs(H.Provider,{value:{addToast:({title:e,message:r,type:a,variant:t,icon:o,onClose:n,position:l="bottomRight"})=>{const d=Date.now()
122
- s(s=>[...s,{title:e,id:d,message:r,type:a,variant:t,icon:o,onClose:n,position:l}])}},children:[a,o.map(r=>e.jsx("div",{className:`fixed z-50 ${B[r]}`,children:t.filter(e=>e.position===r).map(r=>e.jsx(W,{title:r.title,message:r.message,type:r.type,variant:r.variant,icon:r.icon,position:r.position,onClose:()=>{return e=r.id,void s(r=>r.filter(r=>r.id!==e))
122
+ s(s=>[...s,{title:e,id:d,message:r,type:a,variant:t,icon:o,onClose:n,position:l}])}},children:[a,o.map(r=>e.jsx("div",{className:`fixed z-50 ${V[r]}`,children:t.filter(e=>e.position===r).map(r=>e.jsx(W,{title:r.title,message:r.message,type:r.type,variant:r.variant,icon:r.icon,position:r.position,onClose:()=>{return e=r.id,void s(r=>r.filter(r=>r.id!==e))
123
123
  var e}},r.id))},r))]})},exports.Toggle=({variant:r="primary",customSize:t="md",thumbShape:s="stadium",label:o,wrapperClassName:n,labelClassName:l,...d})=>{const i=["relative","bg-secondary-700 dark:bg-secondary-dark-700","peer-checked:after:translate-x-full","rtl:peer-checked:after:-translate-x-full","peer-checked:after:border-white","after:absolute","after:bg-white","after:transition-colors","after:transition-transform","duration-500"].filter(Boolean).join(" "),c=["inline-flex items-center cursor-pointer"].filter(Boolean).join(" ")
124
124
  return e.jsxs("label",{className:a.cn(c,n,d.disabled&&"cursor-not-allowed"),children:[e.jsx("input",{type:"checkbox",value:"",className:"sr-only peer",...d}),e.jsx("div",{className:a.cn(i,ce[t],de[r],ie[s],d.disabled&&"opacity-50 cursor-not-allowed")}),o&&e.jsx("span",{className:a.cn("ms-3 text-sm font-medium dark:text-white",l),children:o})]})},exports.Tooltip=Z,exports.getVariantClasses=y,exports.useToast=()=>{const e=r.useContext(H)
125
125
  if(!e)throw new Error("useToast must be used within a ToastProvider")
package/dist/main.js CHANGED
@@ -283,7 +283,8 @@ const Badge = ({
283
283
  children,
284
284
  color = "default",
285
285
  position,
286
- icon,
286
+ prefixIcon,
287
+ suffixIcon,
287
288
  ...props
288
289
  }) => {
289
290
  const colorClass = BadgeColors[color];
@@ -293,13 +294,14 @@ const Badge = ({
293
294
  {
294
295
  ...props,
295
296
  className: cn(
296
- "inline-flex items-center px-3 py-1 rounded-full text-sm font-semibold",
297
+ "inline-flex items-center gap-1 px-3 py-1 rounded-full text-sm font-semibold",
297
298
  colorClass,
298
299
  positionClass
299
300
  ),
300
301
  children: [
301
- icon && /* @__PURE__ */ jsx("span", { className: "mr-1", children: icon }),
302
- children
302
+ prefixIcon && /* @__PURE__ */ jsx("span", { className: "inline-flex shrink-0", children: prefixIcon }),
303
+ children,
304
+ suffixIcon && /* @__PURE__ */ jsx("span", { className: "inline-flex shrink-0", children: suffixIcon })
303
305
  ]
304
306
  }
305
307
  );
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/Alope-Community/alope-ui.git"
7
7
  },
8
- "version": "1.2.29",
8
+ "version": "1.2.30",
9
9
  "type": "module",
10
10
  "files": [
11
11
  "dist"