@hari_digitus/sms-ui-library 4.0.14 → 4.0.15
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.
|
@@ -82,4 +82,4 @@ React keys must be passed directly to JSX without using spread:
|
|
|
82
82
|
transform: scaleY(1);
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
`})]})}const Mt=({value:r,showLabel:n=!1,label:a,showPercentage:o=!0,height:c="h-2",containerClassName:m,progressClassName:d,wrapperClassName:h,labelClassName:u,percentageClassName:E,backgroundColor:w="bg-gray-200",progressColor:C="bg-[#02245A]",animated:F=!0,striped:L=!1,orientation:S="horizontal",dataTestId:z})=>{const $=Math.min(Math.max(r,0),100),j=S==="vertical";return y.jsxs("div",{className:xe("flex items-center gap-2",j&&"flex-col items-start",h),"data-testid":z,children:[n&&a&&y.jsx("span",{className:xe("text-sm font-medium text-[#414651] whitespace-nowrap",u),children:a}),y.jsx("div",{className:xe("w-full rounded-full overflow-hidden relative",j?"w-2 h-32":c,w,m),children:y.jsx("div",{className:xe("h-full rounded-full",C,F&&"transition-all duration-300",L&&"bg-[linear-gradient(45deg,rgba(255,255,255,.15)_25%,transparent_25%,transparent_50%,rgba(255,255,255,.15)_50%,rgba(255,255,255,.15)_75%,transparent_75%,transparent)] bg-[length:1rem_1rem]",d),style:{width:j?"100%":`${$}%`,height:j?`${$}%`:"100%"},role:"progressbar","aria-valuenow":$,"aria-valuemin":0,"aria-valuemax":100})}),o&&y.jsxs("span",{className:xe("text-xs text-gray-600 whitespace-nowrap",E),children:[$,"%"]})]})},ve=7,oe=6,It=({text:r,maxLength:n=40,maxWidth:a=280,position:o="top",bgColor:c="#1a1a1a",textColor:m="#fff",borderColor:d="#1a1a1a",className:h,style:u})=>{const[E,w]=ne.useState(!1),[C,F]=ne.useState({box:{x:0,y:0},arrow:{x:0,y:0},rotate:0}),L=ne.useRef(null),S=ne.useRef(null),z=r.length>n,$=z?r.slice(0,n)+"…":r,j=ne.useCallback(()=>{if(!L.current||!S.current)return;const b=L.current.getBoundingClientRect(),U=S.current.offsetWidth||a,B=S.current.offsetHeight||44;let G=0,D=0,Y=0,f=0,M=0;o==="top"?(G=b.left+b.width/2-U/2,D=b.top-B-ve-oe,Y=b.left+b.width/2-6,f=b.top-ve-oe,M=0):o==="bottom"?(G=b.left+b.width/2-U/2,D=b.bottom+ve+oe,Y=b.left+b.width/2-6,f=b.bottom+oe,M=180):o==="left"?(G=b.left-U-ve-oe,D=b.top+b.height/2-B/2,Y=b.left-ve-oe,f=b.top+b.height/2-6,M=90):o==="right"&&(G=b.right+ve+oe,D=b.top+b.height/2-B/2,Y=b.right+oe,f=b.top+b.height/2-6,M=-90);const de=window.innerWidth,ue=window.innerHeight;G=Math.max(8,Math.min(G,de-U-8)),D=Math.max(8,Math.min(D,ue-B-8)),F({box:{x:G,y:D},arrow:{x:Y,y:f},rotate:M})},[o,a]);return ne.useEffect(()=>{E&&setTimeout(j,0)},[E,j]),z?y.jsxs(y.Fragment,{children:[y.jsx("span",{ref:L,className:h,style:{display:"block",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",cursor:"default",maxWidth:"100%",...u},onMouseEnter:()=>w(!0),onMouseLeave:()=>w(!1),children:$}),E&&y.jsxs(y.Fragment,{children:[y.jsx("div",{ref:S,style:{position:"fixed",left:C.box.x,top:C.box.y,background:c,border:`1px solid ${d}`,borderRadius:8,padding:"8px 12px",fontSize:13,color:m,maxWidth:a,lineHeight:1.5,zIndex:99999,pointerEvents:"none",boxShadow:"0 2px 8px rgba(0,0,0,0.12)",wordBreak:"break-word",whiteSpace:"normal"},children:r}),y.jsx("div",{style:{position:"fixed",left:C.arrow.x,top:C.arrow.y,width:12,height:7,zIndex:1e5,pointerEvents:"none",transform:`rotate(${C.rotate}deg)`,transformOrigin:"center"},children:y.jsx("svg",{width:"12",height:"7",viewBox:"0 0 12 7",xmlns:"http://www.w3.org/2000/svg",children:y.jsx("polygon",{points:"6,7 0,0 12,0",fill:c})})})]})]}):y.jsx("span",{className:h,style:u,children:r})};function Ft({message:r,type:n,isVisible:a,onClose:o}){return console.log("message =",r),a?y.jsx("div",{style:{position:"fixed",top:"20px",right:"20px",zIndex:99999,backgroundColor:n==="success"?"#D4EDDA":n==="error"?"#FADBD8":n==="warning"?"#FDEBD0":"#D6EAF8",color:n==="success"?"#1E7E34":n==="error"?"#C0392B":n==="warning"?"#B9770E":"#1F618D",padding:"12px 20px",borderRadius:"6px",display:"flex",alignItems:"center",gap:"10px",boxShadow:"0 4px 12px rgba(0,0,0,0.1)",borderLeft:"4px solid "+(n==="success"?"#28A745":n==="error"?"#E74C3C":n==="warning"?"#F39C12":"#3498DB")},children:y.jsx("span",{children:r})}):null}const Dt=({isOpen:r,onClose:n,title:a,children:o,footer:c,width:m="450px",showCloseIcon:d})=>r?Jr.createPortal(y.jsx("div",{onClick:n,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:9999},children:y.jsxs("div",{onClick:h=>h.stopPropagation(),style:{background:"#fff",borderRadius:"8px",boxShadow:"0 4px 20px rgba(0,0,0,0.2)",width:m,maxWidth:"90%",overflow:"hidden"},children:[(a||d)&&y.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"center",padding:"16px"},children:[a&&y.jsx("h3",{style:{margin:0,fontSize:"16px",fontWeight:600,marginRight:"auto"},children:a}),d&&y.jsx("button",{onClick:n,style:{border:"none",background:"transparent",cursor:"pointer",fontSize:"18px"},children:"✕"})]}),y.jsx("div",{style:{paddingTop:"20px",paddingBottom:"6px",paddingLeft:"16px",paddingRight:"16px"},children:o}),c&&y.jsx("div",{style:{display:"flex",justifyContent:"flex-end",gap:"10px",padding:"
|
|
85
|
+
`})]})}const Mt=({value:r,showLabel:n=!1,label:a,showPercentage:o=!0,height:c="h-2",containerClassName:m,progressClassName:d,wrapperClassName:h,labelClassName:u,percentageClassName:E,backgroundColor:w="bg-gray-200",progressColor:C="bg-[#02245A]",animated:F=!0,striped:L=!1,orientation:S="horizontal",dataTestId:z})=>{const $=Math.min(Math.max(r,0),100),j=S==="vertical";return y.jsxs("div",{className:xe("flex items-center gap-2",j&&"flex-col items-start",h),"data-testid":z,children:[n&&a&&y.jsx("span",{className:xe("text-sm font-medium text-[#414651] whitespace-nowrap",u),children:a}),y.jsx("div",{className:xe("w-full rounded-full overflow-hidden relative",j?"w-2 h-32":c,w,m),children:y.jsx("div",{className:xe("h-full rounded-full",C,F&&"transition-all duration-300",L&&"bg-[linear-gradient(45deg,rgba(255,255,255,.15)_25%,transparent_25%,transparent_50%,rgba(255,255,255,.15)_50%,rgba(255,255,255,.15)_75%,transparent_75%,transparent)] bg-[length:1rem_1rem]",d),style:{width:j?"100%":`${$}%`,height:j?`${$}%`:"100%"},role:"progressbar","aria-valuenow":$,"aria-valuemin":0,"aria-valuemax":100})}),o&&y.jsxs("span",{className:xe("text-xs text-gray-600 whitespace-nowrap",E),children:[$,"%"]})]})},ve=7,oe=6,It=({text:r,maxLength:n=40,maxWidth:a=280,position:o="top",bgColor:c="#1a1a1a",textColor:m="#fff",borderColor:d="#1a1a1a",className:h,style:u})=>{const[E,w]=ne.useState(!1),[C,F]=ne.useState({box:{x:0,y:0},arrow:{x:0,y:0},rotate:0}),L=ne.useRef(null),S=ne.useRef(null),z=r.length>n,$=z?r.slice(0,n)+"…":r,j=ne.useCallback(()=>{if(!L.current||!S.current)return;const b=L.current.getBoundingClientRect(),U=S.current.offsetWidth||a,B=S.current.offsetHeight||44;let G=0,D=0,Y=0,f=0,M=0;o==="top"?(G=b.left+b.width/2-U/2,D=b.top-B-ve-oe,Y=b.left+b.width/2-6,f=b.top-ve-oe,M=0):o==="bottom"?(G=b.left+b.width/2-U/2,D=b.bottom+ve+oe,Y=b.left+b.width/2-6,f=b.bottom+oe,M=180):o==="left"?(G=b.left-U-ve-oe,D=b.top+b.height/2-B/2,Y=b.left-ve-oe,f=b.top+b.height/2-6,M=90):o==="right"&&(G=b.right+ve+oe,D=b.top+b.height/2-B/2,Y=b.right+oe,f=b.top+b.height/2-6,M=-90);const de=window.innerWidth,ue=window.innerHeight;G=Math.max(8,Math.min(G,de-U-8)),D=Math.max(8,Math.min(D,ue-B-8)),F({box:{x:G,y:D},arrow:{x:Y,y:f},rotate:M})},[o,a]);return ne.useEffect(()=>{E&&setTimeout(j,0)},[E,j]),z?y.jsxs(y.Fragment,{children:[y.jsx("span",{ref:L,className:h,style:{display:"block",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",cursor:"default",maxWidth:"100%",...u},onMouseEnter:()=>w(!0),onMouseLeave:()=>w(!1),children:$}),E&&y.jsxs(y.Fragment,{children:[y.jsx("div",{ref:S,style:{position:"fixed",left:C.box.x,top:C.box.y,background:c,border:`1px solid ${d}`,borderRadius:8,padding:"8px 12px",fontSize:13,color:m,maxWidth:a,lineHeight:1.5,zIndex:99999,pointerEvents:"none",boxShadow:"0 2px 8px rgba(0,0,0,0.12)",wordBreak:"break-word",whiteSpace:"normal"},children:r}),y.jsx("div",{style:{position:"fixed",left:C.arrow.x,top:C.arrow.y,width:12,height:7,zIndex:1e5,pointerEvents:"none",transform:`rotate(${C.rotate}deg)`,transformOrigin:"center"},children:y.jsx("svg",{width:"12",height:"7",viewBox:"0 0 12 7",xmlns:"http://www.w3.org/2000/svg",children:y.jsx("polygon",{points:"6,7 0,0 12,0",fill:c})})})]})]}):y.jsx("span",{className:h,style:u,children:r})};function Ft({message:r,type:n,isVisible:a,onClose:o}){return console.log("message =",r),a?y.jsx("div",{style:{position:"fixed",top:"20px",right:"20px",zIndex:99999,backgroundColor:n==="success"?"#D4EDDA":n==="error"?"#FADBD8":n==="warning"?"#FDEBD0":"#D6EAF8",color:n==="success"?"#1E7E34":n==="error"?"#C0392B":n==="warning"?"#B9770E":"#1F618D",padding:"12px 20px",borderRadius:"6px",display:"flex",alignItems:"center",gap:"10px",boxShadow:"0 4px 12px rgba(0,0,0,0.1)",borderLeft:"4px solid "+(n==="success"?"#28A745":n==="error"?"#E74C3C":n==="warning"?"#F39C12":"#3498DB")},children:y.jsx("span",{children:r})}):null}const Dt=({isOpen:r,onClose:n,title:a,children:o,footer:c,width:m="450px",showCloseIcon:d})=>r?Jr.createPortal(y.jsx("div",{onClick:n,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:9999},children:y.jsxs("div",{onClick:h=>h.stopPropagation(),style:{background:"#fff",borderRadius:"8px",boxShadow:"0 4px 20px rgba(0,0,0,0.2)",width:m,maxWidth:"90%",overflow:"hidden"},children:[(a||d)&&y.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"center",padding:"16px"},children:[a&&y.jsx("h3",{style:{margin:0,fontSize:"16px",fontWeight:600,marginRight:"auto"},children:a}),d&&y.jsx("button",{onClick:n,style:{border:"none",background:"transparent",cursor:"pointer",fontSize:"18px"},children:"✕"})]}),y.jsx("div",{style:{paddingTop:"20px",paddingBottom:"6px",paddingLeft:"16px",paddingRight:"16px"},children:o}),c&&y.jsx("div",{style:{display:"flex",justifyContent:"flex-end",gap:"10px",padding:"1px"},children:c})]})}),document.body):null;exports.Loader=zt;exports.Modal=Dt;exports.ProgressBar=Mt;exports.TextPopover=It;exports.Toast=Ft;exports.cn=xe;
|
package/dist/notifications.es.js
CHANGED