alope-ui 1.2.29 → 1.2.31
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/components/Badge/Badge.d.ts +2 -2
- package/dist/main.cjs +7 -7
- package/dist/main.js +8 -6
- package/package.json +1 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
declare const BadgeColors: {
|
|
3
3
|
default: string;
|
|
4
|
-
secondary: string;
|
|
5
4
|
success: string;
|
|
6
5
|
error: string;
|
|
7
6
|
info: string;
|
|
@@ -17,7 +16,8 @@ export type BadgeProps = {
|
|
|
17
16
|
children?: React.ReactNode | string;
|
|
18
17
|
color?: keyof typeof BadgeColors;
|
|
19
18
|
position?: keyof typeof BadgePositions;
|
|
20
|
-
|
|
19
|
+
prefixIcon?: React.ReactNode;
|
|
20
|
+
suffixIcon?: React.ReactNode;
|
|
21
21
|
} & Omit<React.HTMLAttributes<HTMLSpanElement>, 'className' | 'color'>;
|
|
22
22
|
export declare const Badge: React.FC<BadgeProps>;
|
|
23
23
|
export {};
|
package/dist/main.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict"
|
|
2
2
|
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})
|
|
3
3
|
const e=require("react/jsx-runtime"),r=require("react"),a=require("clsx-for-tailwind"),t=require("react-router-dom"),s=require("react-select"),o={outline:"outline-1",solid:""},n={success:"fill-success-700 dark:fill-success",info:"fill-info-700 dark:fill-info",error:"fill-error-700 dark:fill-error",warning:"fill-warning-700 dark:fill-warning",default:"fill-secondary-700 dark:fill-secondary"},l={success:"bg-success-30/50 outline-success-700 text-success-700 dark:bg-success-dark-30/20 dark:text-success",info:"bg-info-30/50 outline-info-700 text-info-700 dark:bg-info-dark-30/20 dark:text-info",warning:"bg-warning-30/50 outline-warning-700 text-warning-700 dark:bg-warning-dark-30/20 dark:text-warning",error:"bg-error-30/50 outline-error-700 text-error-700 dark:bg-error-dark-30/20 dark:text-error",default:"bg-secondary-30/50 outline-secondary-700 dark:bg-secondary-dark-30/20 dark:text-secondary"},d={sm:"w-8 h-8 text-xs",md:"w-12 h-12 text-sm",lg:"w-16 h-16 text-base"},i={solid:"bg-opacity-100",outline:"bg-transparent border-2"},c={sharp:"rounded-none",cornered:"rounded-md",rounded:"rounded-full"},m={primary:"bg-primary dark:bg-primary-dark text-white",error:"bg-error dark:bg-error-dark text-white",warning:"bg-warning dark:bg-warning-dark text-white",success:"bg-success dark:bg-success-dark text-white",info:"bg-info dark:bg-info-dark text-white",secondary:"bg-secondary dark:bg-secondary-dark text-white"},u=({imageSrc:t,fallbackName:s,ring:o=!1,ringClassName:n,shape:l="rounded",variant:u="solid",fallbackColor:p="primary",size:x="md",alt:b="avatar",status:g,className:h})=>{const[k,f]=r.useState(!1),y=d[x],w=i[u],v=c[l],j=m[p],N=o?a.cn("ring-2 ring-offset-2",n||"ring-primary dark:ring-primary-dark"):"",C=s?s.split(" ").map(e=>e[0]).join("").toUpperCase():"?",z=k||!t?e.jsx("div",{className:a.cn("flex items-center justify-center font-semibold",j,y,v,w,N,h),children:C}):e.jsx("img",{src:t,alt:b,onError:()=>f(!0),className:a.cn("object-cover",y,v,w,N,h)})
|
|
4
|
-
return e.jsxs("div",{className:"relative inline-block",children:[z,g&&e.jsx("span",{className:a.cn("absolute bottom-0 right-0 w-3 h-3 rounded-full border-2","online"===g?"bg-success":"bg-secondary-700 dark:bg-secondary-dark-700","border-white")})]})},p={default:"bg-
|
|
4
|
+
return e.jsxs("div",{className:"relative inline-block",children:[z,g&&e.jsx("span",{className:a.cn("absolute bottom-0 right-0 w-3 h-3 rounded-full border-2","online"===g?"bg-success":"bg-secondary-700 dark:bg-secondary-dark-700","border-white")})]})},p={default:"bg-secondary-30 text-black dark:bg-secondary-dark-30",success:"bg-success-30 text-green-700 dark:bg-success-dark-30",error:"bg-error-30 text-red-700 dark:bg-error-dark-30",info:"bg-info-30 text-blue-700 dark:bg-info-dark-30",warning:"bg-warning-30 text-amber-700 dark:bg-warning-dark-30"},x={"top-right":"absolute -top-3 -right-3","top-left":"absolute -top-3 -left-3","bottom-right":"absolute -bottom-3 -right-3","bottom-left":"absolute -bottom-3 -left-3"},b=({label:r,icon:t,value:s,selectedValue:o,onChangeValue:n,labelClassName:l,className:d})=>{const i=s===o
|
|
5
5
|
return e.jsxs("button",{onClick:()=>n?.(s),className:a.cn("inline-flex flex-1 flex-col items-center justify-center p-5 group",i?"bg-secondary-30-50 dark:bg-secondary/10":"hover:bg-secondary-30 dark:hover:bg-secondary/30",d),children:[t,e.jsx("span",{className:a.cn("text-sm",i?"text-primary":"text-secondary-dark-700 dark:text-secondary-dark group-hover:text-secondary-700 dark:group-hover:text-white",l),children:r})]})},g={primary:"text-primary dark:text-primary-dark-30",secondary:"text-secondary-foreground dark:text-secondary-foreground-dark",success:"text-success-dark dark:text-success-dark-30",info:"text-info-dark dark:text-info-dark-30",warning:"text-warning-dark dark:text-warning-dark-30",error:"text-error-dark dark:text-error-dark-30"},h={sm:"px-3 py-2 text-sm font-medium",md:"px-4 py-2 text-base font-semibold tracking-[.2px]",lg:"px-6 py-3 text-lg font-semibold"},k={regular:"rounded-md",pill:"rounded-full"},f={primary:{solid:"bg-primary text-white hover:bg-primary-dark dark:bg-primary-dark dark:hover:bg-primary-dark/70",outline:"border border-primary text-primary hover:bg-primary-30 dark:bg-primary-dark/30 dark:border-primary-dark dark:text-white dark:hover:bg-primary-dark/70",ghost:"text-primary hover:bg-primary-30 dark:text-primary-dark dark:hover:bg-primary-dark/70 dark:hover:text-white",plain:"text-primary dark:text-primary-dark"},secondary:{solid:"bg-secondary text-black hover:bg-secondary-dark/80 dark:bg-secondary-dark dark:text-white dark:hover:bg-secondary-dark/70",outline:"border border-secondary text-black hover:bg-secondary-30 dark:bg-secondary-dark/30 dark:border-secondary-dark dark:text-white dark:hover:bg-secondary-dark/70",ghost:"text-black hover:bg-secondary-30 dark:text-white dark:hover:bg-secondary-dark/70",plain:"text-black dark:text-white"},success:{solid:"bg-success text-white hover:bg-success-dark dark:bg-success-dark dark:hover:bg-success-dark/70",outline:"border border-success text-success hover:bg-success-30 dark:bg-success-dark/30 dark:border-success-dark dark:text-white dark:hover:bg-success-dark/70",ghost:"text-success hover:bg-success-30 dark:text-success-dark dark:hover:bg-success-dark/70 dark:hover:text-white",plain:"text-success dark:text-success-dark"},warning:{solid:"bg-warning text-white hover:bg-warning-dark dark:bg-warning-dark dark:hover:bg-warning-dark/70",outline:"border border-warning text-warning hover:bg-warning-30 dark:bg-warning-dark/30 dark:border-warning-dark dark:text-white dark:hover:bg-warning-dark/70",ghost:"text-warning hover:bg-warning-30 dark:text-warning-dark dark:hover:bg-warning-dark/70 dark:hover:text-white",plain:"text-warning dark:text-warning-dark"},error:{solid:"bg-error text-white hover:bg-error-dark dark:bg-error-dark dark:hover:bg-error-dark/70",outline:"border border-error text-error hover:bg-error-30 dark:bg-error-dark/30 dark:border-error-dark dark:text-white dark:hover:bg-error-dark/70",ghost:"text-error hover:bg-error-30 dark:text-error-dark dark:hover:bg-error-dark/70 dark:hover:text-white",plain:"text-error dark:text-error-dark"},info:{solid:"bg-info text-white hover:bg-info-dark dark:bg-info-dark dark:hover:bg-info-dark/70",outline:"border border-info text-info hover:bg-info-30 dark:bg-info-dark/30 dark:border-info-dark dark:text-white dark:hover:bg-info-dark/70",ghost:"text-info hover:bg-info-30 dark:text-info-dark dark:hover:bg-info-dark/70 dark:hover:text-white",plain:"text-info dark:text-info-dark"}},y=(e,r)=>f[r][e]||"",w=r.forwardRef(({label:t,description:s,className:o="",indeterminate:n=!1,descriptionClassName:l,checkboxClassName:d,labelClassName:i,disabled:c,readOnly:m,children:u,checked:p,defaultChecked:x,onChange:b,...g},h)=>{const k=r.useRef(null)
|
|
6
6
|
r.useImperativeHandle(h,()=>k.current)
|
|
7
7
|
const[f,y]=r.useState(x??!1),w=void 0!==p,v=w?p:f
|
|
@@ -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})}),
|
|
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",
|
|
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,
|
|
38
|
-
return e.jsxs("span",{...
|
|
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(
|
|
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 ${
|
|
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
|
@@ -266,8 +266,8 @@ const AvatarGroup = ({
|
|
|
266
266
|
] });
|
|
267
267
|
};
|
|
268
268
|
const BadgeColors = {
|
|
269
|
-
default:
|
|
270
|
-
|
|
269
|
+
// default: 'bg-primary-30 text-primary-700 dark:bg-primary-dark-30',
|
|
270
|
+
default: "bg-secondary-30 text-black dark:bg-secondary-dark-30",
|
|
271
271
|
success: "bg-success-30 text-green-700 dark:bg-success-dark-30",
|
|
272
272
|
error: "bg-error-30 text-red-700 dark:bg-error-dark-30",
|
|
273
273
|
info: "bg-info-30 text-blue-700 dark:bg-info-dark-30",
|
|
@@ -283,7 +283,8 @@ const Badge = ({
|
|
|
283
283
|
children,
|
|
284
284
|
color = "default",
|
|
285
285
|
position,
|
|
286
|
-
|
|
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
|
-
|
|
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
|
);
|