diditui 1.0.27 → 1.0.28
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/diditui.cjs +1 -1
- package/dist/diditui.d.ts +2 -1
- package/dist/diditui.js +28 -14
- package/package.json +1 -1
package/dist/diditui.cjs
CHANGED
|
@@ -84,4 +84,4 @@ Make sure your charset is UTF-8`);r=(r>>>8&255)*192+(r&255),e.put(r,13)}};var pl
|
|
|
84
84
|
The chosen QR Code version cannot contain this amount of data.
|
|
85
85
|
Minimum version required to store current data is: `+a+`.
|
|
86
86
|
`);const i=Sl(t,r,o),s=At.getSymbolSize(t),c=new gl(s);return El(c,t),xl(c),kl(c,t),Qt(c,r,0),t>=7&&Ll(c,t),Ml(c,i),isNaN(n)&&(n=fr.getBestMask(c,Qt.bind(null,c,r))),fr.applyMask(n,c),Qt(c,r,n),{modules:c,version:t,errorCorrectionLevel:r,maskPattern:n,segments:o}}Bn.create=function(t,r){if(typeof t>"u"||t==="")throw new Error("No input text");let n=Kt.M,o,a;return typeof r<"u"&&(n=Kt.from(r.errorCorrectionLevel,Kt.M),o=_t.from(r.version),a=fr.from(r.maskPattern),r.toSJISFunc&&At.setToSJISFunction(r.toSJISFunc)),_l(t,o,n,a)};var Gn={},xr={};(function(e){function t(r){if(typeof r=="number"&&(r=r.toString()),typeof r!="string")throw new Error("Color should be defined as hex string");let n=r.slice().replace("#","").split("");if(n.length<3||n.length===5||n.length>8)throw new Error("Invalid hex color: "+r);(n.length===3||n.length===4)&&(n=Array.prototype.concat.apply([],n.map(function(a){return[a,a]}))),n.length===6&&n.push("F","F");const o=parseInt(n.join(""),16);return{r:o>>24&255,g:o>>16&255,b:o>>8&255,a:o&255,hex:"#"+n.slice(0,6).join("")}}e.getOptions=function(n){n||(n={}),n.color||(n.color={});const o=typeof n.margin>"u"||n.margin===null||n.margin<0?4:n.margin,a=n.width&&n.width>=21?n.width:void 0,i=n.scale||4;return{width:a,scale:a?4:i,margin:o,color:{dark:t(n.color.dark||"#000000ff"),light:t(n.color.light||"#ffffffff")},type:n.type,rendererOpts:n.rendererOpts||{}}},e.getScale=function(n,o){return o.width&&o.width>=n+o.margin*2?o.width/(n+o.margin*2):o.scale},e.getImageWidth=function(n,o){const a=e.getScale(n,o);return Math.floor((n+o.margin*2)*a)},e.qrToImageData=function(n,o,a){const i=o.modules.size,s=o.modules.data,c=e.getScale(i,a),d=Math.floor((i+a.margin*2)*c),f=a.margin*c,p=[a.color.light,a.color.dark];for(let h=0;h<d;h++)for(let m=0;m<d;m++){let y=(h*d+m)*4,v=a.color.light;if(h>=f&&m>=f&&h<d-f&&m<d-f){const x=Math.floor((h-f)/c),b=Math.floor((m-f)/c);v=p[s[x*i+b]?1:0]}n[y++]=v.r,n[y++]=v.g,n[y++]=v.b,n[y]=v.a}}})(xr);(function(e){const t=xr;function r(o,a,i){o.clearRect(0,0,a.width,a.height),a.style||(a.style={}),a.height=i,a.width=i,a.style.height=i+"px",a.style.width=i+"px"}function n(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}e.render=function(a,i,s){let c=s,d=i;typeof c>"u"&&(!i||!i.getContext)&&(c=i,i=void 0),i||(d=n()),c=t.getOptions(c);const f=t.getImageWidth(a.modules.size,c),p=d.getContext("2d"),h=p.createImageData(f,f);return t.qrToImageData(h.data,a,c),r(p,d,f),p.putImageData(h,0,0),d},e.renderToDataURL=function(a,i,s){let c=s;typeof c>"u"&&(!i||!i.getContext)&&(c=i,i=void 0),c||(c={});const d=e.render(a,i,c),f=c.type||"image/png",p=c.rendererOpts||{};return d.toDataURL(f,p.quality)}})(Gn);var Kn={};const Tl=xr;function un(e,t){const r=e.a/255,n=t+'="'+e.hex+'"';return r<1?n+" "+t+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function Xt(e,t,r){let n=e+t;return typeof r<"u"&&(n+=" "+r),n}function Ol(e,t,r){let n="",o=0,a=!1,i=0;for(let s=0;s<e.length;s++){const c=Math.floor(s%t),d=Math.floor(s/t);!c&&!a&&(a=!0),e[s]?(i++,s>0&&c>0&&e[s-1]||(n+=a?Xt("M",c+r,.5+d+r):Xt("m",o,0),o=0,a=!1),c+1<t&&e[s+1]||(n+=Xt("h",i),i=0)):o++}return n}Kn.render=function(t,r,n){const o=Tl.getOptions(r),a=t.modules.size,i=t.modules.data,s=a+o.margin*2,c=o.color.light.a?"<path "+un(o.color.light,"fill")+' d="M0 0h'+s+"v"+s+'H0z"/>':"",d="<path "+un(o.color.dark,"stroke")+' d="'+Ol(i,a,o.margin)+'"/>',f='viewBox="0 0 '+s+" "+s+'"',h='<svg xmlns="http://www.w3.org/2000/svg" '+(o.width?'width="'+o.width+'" height="'+o.width+'" ':"")+f+' shape-rendering="crispEdges">'+c+d+`</svg>
|
|
87
|
-
`;return typeof n=="function"&&n(null,h),h};const Nl=q1,hr=Bn,Jn=Gn,jl=Kn;function kr(e,t,r,n,o){const a=[].slice.call(arguments,1),i=a.length,s=typeof a[i-1]=="function";if(!s&&!Nl())throw new Error("Callback required as last argument");if(s){if(i<2)throw new Error("Too few arguments provided");i===2?(o=r,r=t,t=n=void 0):i===3&&(t.getContext&&typeof o>"u"?(o=n,n=void 0):(o=n,n=r,r=t,t=void 0))}else{if(i<1)throw new Error("Too few arguments provided");return i===1?(r=t,t=n=void 0):i===2&&!t.getContext&&(n=r,r=t,t=void 0),new Promise(function(c,d){try{const f=hr.create(r,n);c(e(f,t,n))}catch(f){d(f)}})}try{const c=hr.create(r,n);o(null,e(c,t,n))}catch(c){o(c)}}Ct.create=hr.create;Ct.toCanvas=kr.bind(null,Jn.render);Ct.toDataURL=kr.bind(null,Jn.renderToDataURL);Ct.toString=kr.bind(null,function(e,t,r){return jl.render(e,r)});const Pl=.1,dn=2.5,Te=7;function er(e,t,r){return e===t?!1:(e-t<0?t-e:e-t)<=r+Pl}function Al(e,t){const r=Array.prototype.slice.call(Ct.create(e,{errorCorrectionLevel:t}).modules.data,0),n=Math.sqrt(r.length);return r.reduce((o,a,i)=>(i%n===0?o.push([a]):o[o.length-1].push(a))&&o,[])}const Bl={generate(e,t,r,n="#141414"){const o="transparent",i=Al(e,"Q"),s=t/i.length,c=[{x:0,y:0},{x:1,y:0},{x:0,y:1}],d=[];c.forEach(({x:v,y:x})=>{const b=(i.length-Te)*s*v,E=(i.length-Te)*s*x,R=.3;for(let L=0;L<c.length;L+=1){const C=s*(Te-L*2);d.push(w.jsx("rect",{fill:L===2?n:o,width:L===0?C-5:C,rx:L===0?(C-5)*R:C*R,ry:L===0?(C-5)*R:C*R,stroke:n,strokeWidth:L===0?5:0,height:L===0?C-5:C,x:L===0?E+s*L+5/2:E+s*L,y:L===0?b+s*L+5/2:b+s*L},`${v}-${x}-${L}`))}});const f=Math.floor((r+25)/s),p=i.length/2-f/2,h=i.length/2+f/2-1,m=[];i.forEach((v,x)=>{v.forEach((b,E)=>{if(i[x][E]&&!(x<Te&&E<Te||x>i.length-(Te+1)&&E<Te||x<Te&&E>i.length-(Te+1))&&!(x>p&&x<h&&E>p&&E<h)){const R=x*s+s/2,L=E*s+s/2;m.push([R,L])}})});const y={};return m.forEach(([v,x])=>{var b;y[v]?(b=y[v])==null||b.push(x):y[v]=[x]}),Object.entries(y).map(([v,x])=>{const b=x.filter(E=>x.every(R=>!er(E,R,s)));return[Number(v),b]}).forEach(([v,x])=>{x.forEach(b=>{d.push(w.jsx("circle",{cx:v,cy:b,fill:n,r:s/dn}))})}),Object.entries(y).filter(([v,x])=>x.length>1).map(([v,x])=>{const b=x.filter(E=>x.some(R=>er(E,R,s)));return[Number(v),b]}).map(([v,x])=>{x.sort((E,R)=>E<R?-1:1);const b=[];for(const E of x){const R=b.find(L=>L.some(C=>er(E,C,s)));R?R.push(E):b.push([E])}return[v,b.map(E=>[E[0],E[E.length-1]])]}).forEach(([v,x])=>{x.forEach(([b,E])=>{d.push(w.jsx("line",{x1:v,x2:v,y1:b,y2:E,stroke:n,strokeWidth:s/(dn/2),strokeLinecap:"round"},`${v}-${b}-${E}`))})}),d}},Fl={sm:120,md:200,lg:256,xl:320};function Wl({uri:e,size:t="md",color:r,iconName:n,className:o,...a}){const i=typeof t=="number"?t:Fl[t],s=M.useMemo(()=>Bl.generate(e,i,i/4,r),[e,i,r]),c=B(["size-fit flex items-center justify-center","relative overflow-hidden aspect-square text-primary"],o),d=B(["size-full absolute top-1/2 left-1/2","transform -translate-x-1/2 -translate-y-1/2 scale-[0.25]","rounded-3xl overflow-hidden"]);return w.jsxs("div",{className:c,...a,children:[n&&w.jsx(ve,{type:n,className:d}),w.jsx("svg",{width:i,height:i,children:s})]})}function Vl({label:e,placeholder:t,value:r,disabled:n,className:o,error:a,onValueChange:i=()=>{},...s}){const c=M.useRef(null),[d,f]=M.useState(!1),p=B(["w-full overflow-hidden min-h-[68px] py-2 pr-2 cursor-pointer","flex items-center gap-2 border-b-[1.5px] border-transparent","focus:bg-transparent focus:border-foreground transition-all duration-300"],{"opacity-80":n,"border-foreground":d,"border-error":a},o),h=B([" placeholder:text-sm placeholder:font-normal placeholder:leading-[140%]","placeholder:text-surface-mdlo text-sm font-normal leading-[140%]","placeholder:tracking-tight tracking-tight","focus:ring-0 active:border-none bg-transparent border-none transition-all duration-300","p-0 m-0"]),m=B(["flex justify-center align-items-center hover:opacity-80 p-[2px]"],{invisible:!r}),y=B(["rounded-full bg-surface-ulo p-[9px] opacity-70","cursor-pointer hover:opacity-100"],{"opacity-100":d,"bg-error/5":a&&d});return w.jsxs("div",{className:"w-full overflow-hidden",children:[w.jsxs("div",{className:p,onClick:()=>{var v;return(v=c.current)==null?void 0:v.focus()},children:[w.jsx("div",{className:y,children:w.jsx(ve,{type:"search",size:"sm"})}),w.jsxs("div",{className:"flex flex-col gap-[6px] grow overflow-hidden min-w-0",children:[w.jsx(pe,{variant:"StyledLabel",as:"label",className:"text-surface-md cursor-pointer truncate",children:e}),w.jsx("input",{ref:c,onFocus:()=>f(!0),onBlur:()=>f(!1),className:h,value:r,type:"text",onChange:v=>i(v.target.value),placeholder:t,disabled:n,...s})]}),w.jsx("button",{className:m,onClick:()=>i(""),children:w.jsx(ve,{type:"closeCircleBold",size:"sm",className:"text-surface-mdlo"})})]}),w.jsx(pe,{variant:"P3",as:"span",className:"text-error mt-1",children:a})]})}var Il="Expected a function",fn=NaN,Dl="[object Symbol]",Hl=/^\s+|\s+$/g,$l=/^[-+]0x[0-9a-f]+$/i,Ul=/^0b[01]+$/i,zl=/^0o[0-7]+$/i,Zl=parseInt,ql=typeof Ve.commonjsGlobal=="object"&&Ve.commonjsGlobal&&Ve.commonjsGlobal.Object===Object&&Ve.commonjsGlobal,Yl=typeof self=="object"&&self&&self.Object===Object&&self,Gl=ql||Yl||Function("return this")(),Kl=Object.prototype,Jl=Kl.toString,Ql=Math.max,Xl=Math.min,tr=function(){return Gl.Date.now()};function ec(e,t,r){var n,o,a,i,s,c,d=0,f=!1,p=!1,h=!0;if(typeof e!="function")throw new TypeError(Il);t=pn(t)||0,mr(r)&&(f=!!r.leading,p="maxWait"in r,a=p?Ql(pn(r.maxWait)||0,t):a,h="trailing"in r?!!r.trailing:h);function m(j){var z=n,re=o;return n=o=void 0,d=j,i=e.apply(re,z),i}function y(j){return d=j,s=setTimeout(b,t),f?m(j):i}function v(j){var z=j-c,re=j-d,ie=t-z;return p?Xl(ie,a-re):ie}function x(j){var z=j-c,re=j-d;return c===void 0||z>=t||z<0||p&&re>=a}function b(){var j=tr();if(x(j))return E(j);s=setTimeout(b,v(j))}function E(j){return s=void 0,h&&n?m(j):(n=o=void 0,i)}function R(){s!==void 0&&clearTimeout(s),d=0,n=c=o=s=void 0}function L(){return s===void 0?i:E(tr())}function C(){var j=tr(),z=x(j);if(n=arguments,o=this,c=j,z){if(s===void 0)return y(c);if(p)return s=setTimeout(b,t),m(c)}return s===void 0&&(s=setTimeout(b,t)),i}return C.cancel=R,C.flush=L,C}function mr(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function tc(e){return!!e&&typeof e=="object"}function rc(e){return typeof e=="symbol"||tc(e)&&Jl.call(e)==Dl}function pn(e){if(typeof e=="number")return e;if(rc(e))return fn;if(mr(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=mr(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(Hl,"");var r=Ul.test(e);return r||zl.test(e)?Zl(e.slice(2),r?2:8):$l.test(e)?fn:+e}var nc=ec;const hn=Ve.getDefaultExportFromCjs(nc);var oc=typeof window<"u"?M.useLayoutEffect:M.useEffect;function ac(e,t,r,n){const o=M.useRef(t);oc(()=>{o.current=t},[t]),M.useEffect(()=>{const a=window;if(!(a&&a.addEventListener))return;const i=s=>{o.current(s)};return a.addEventListener(e,i,n),()=>{a.removeEventListener(e,i,n)}},[e,r,n])}function sc(e){const t=M.useRef(e);t.current=e,M.useEffect(()=>()=>{t.current()},[])}function ic(e,t=500,r){const n=M.useRef();sc(()=>{n.current&&n.current.cancel()});const o=M.useMemo(()=>{const a=hn(e,t,r),i=(...s)=>a(...s);return i.cancel=()=>{a.cancel()},i.isPending=()=>!!n.current,i.flush=()=>a.flush(),i},[e,t,r]);return M.useEffect(()=>{n.current=hn(e,t,r)},[e,t,r]),o}const lc=500;function Qn({id:e,className:t,disabled:r,placeholder:n,immediateFocus:o,value:a,onChange:i}){const s=M.useRef(null),[c,d]=M.useState(!1),f=ic(i,lc);M.useEffect(()=>{var y;o&&((y=s==null?void 0:s.current)==null||y.focus())},[]);const p=B("flex w-full items-center gap-3 px-4 py-3","border-b border-surface-ulo text-surface-hi",t),h=B("text-xs remove-arrow :focus:shadow-none grow shrink-0 truncate","placeholder:body-text placeholder:text-surface-md","border-none bg-transparent p-0 !shadow-none outline-none ring-0 ring-offset-0","focus:border-none focus:outline-none focus:ring-0","disabled:opacity-25"),m=B("shrink-0",{"opacity-25 transition-opacity duration-300":!c});return w.jsxs("div",{className:p,id:e,children:[w.jsx("div",{className:m,children:w.jsx(ve,{size:"sm",type:"search"})}),w.jsx("input",{disabled:r,ref:s,className:h,placeholder:n,type:"text",defaultValue:a,onBlur:()=>d(!1),onChange:y=>f(y.target.value),onFocus:()=>d(!0)})]})}const cc=typeof window<"u"?M.useLayoutEffect:M.useEffect,uc=typeof window>"u";function at(e,{defaultValue:t=!1,initializeWithValue:r=!0}={}){function n(s){return uc?t:window.matchMedia(s).matches}const[o,a]=M.useState(()=>r?n(e):t);function i(){a(n(e))}return cc(()=>{const s=window.matchMedia(e);return i(),s.addListener?s.addListener(i):s.addEventListener("change",i),()=>{s.removeListener?s.removeListener(i):s.removeEventListener("change",i)}},[e]),o}function dc(e={}){return at(`(min-width: ${tt.SM}px)`,e)}function fc(e={}){return at(`(min-width: ${tt.MD}px)`,e)}function pc(e={}){return at(`(min-width: ${tt.LG}px)`,e)}function hc(e={}){return at(`(min-width: ${tt.XL}px)`,e)}function mc(e={}){return at(`(min-width: ${tt.XXL}px)`,e)}function Xn(e,t,r,n="mousedown"){ac(n,o=>{const a=e==null?void 0:e.current,i=t==null?void 0:t.current;!a||a.contains(o.target)||!i||i.contains(o.target)||r(o)})}function eo(e,t){const r=M.useCallback(n=>{n.key===e&&t()},[e,t]);M.useEffect(()=>(window.addEventListener("keydown",r),()=>{window.removeEventListener("keydown",r)}),[r])}function gc({label:e,value:t,Icon:r=null,id:n="",dataTestId:o="",className:a="",onClick:i=()=>{}}){const s=M.useCallback(()=>{i(t)},[t,i]),c=B("flex w-full items-center gap-2 px-4 py-3 text-surface-hi","hover:bg-surface-ulo/60 border-b border-surface-ulo","transition-all duration-300",a);return w.jsx("li",{children:w.jsxs("button",{className:c,"data-testid":o,id:n,type:"button",onClick:s,children:[r&&w.jsx("span",{children:w.jsx(r,{})}),w.jsx(pe,{variant:"P3",as:"span",children:e})]})})}function Cc({id:e="",className:t="",label:r,placeholder:n,selectedOption:o={label:"",value:"",Icon:null},disabled:a=!1,required:i=!1,isDropdownOpen:s=!1,buttonRef:c=void 0,hasError:d=!1,onClick:f}){const p=B("w-full min-h-[68px] py-4 px-5 rounded-3xl","flex items-center gap-2 bg-surface-lo hover:bg-surface-ulo","transition-all duration-300 border border-transparent",{"opacity-50 hover:bg-surface-lo":a,"border-error bg-error/5":d,"bg-transparent border-foreground hover:bg-transparent":s,"border-error":s&&d},t),h=B("truncate w-fit",{"text-surface-background":o.value,"text-surface-md":!o.value}),m=B(["transition-all duration-300",{"-rotate-180":s}]);return w.jsxs("button",{disabled:a,id:e,className:p,ref:c,onClick:f,type:"button",children:[w.jsxs("div",{className:"flex flex-col gap-[6px] grow overflow-hidden min-w-0",children:[w.jsxs(pe,{variant:"StyledLabel",as:"label",className:"text-surface-md truncate w-fit",children:[r,i&&w.jsx("span",{className:"text-error text-[14px] leading-[90%]",children:"*"})]}),w.jsx(pe,{as:"span",variant:"P2",className:h,children:o.label||n})]}),w.jsx("div",{className:m,children:w.jsx(ve,{type:"chevronDown",size:"sm"})})]})}function vc({id:e="",className:t="",dataTestId:r="",label:n="",placeholder:o="",value:a=void 0,options:i,disabled:s=!1,required:c=!1,withSearch:d=!1,errorMessage:f="",dropdownClassName:p="",onChange:h=y=>{},onClick:m=()=>{}}){const y=M.useRef(null),v=M.useRef(null),[x,b]=M.useState(!1),[E,R]=M.useState(""),L=M.useMemo(()=>E?i.filter(Q=>Q.label.toLowerCase().startsWith(E.toLowerCase())):i,[E,i]),C=M.useMemo(()=>i.find(Q=>Q.value===a),[i,a]);eo("Escape",()=>b(!1)),Xn(y,v,()=>b(!1));const j=M.useCallback(Q=>{h(Q),b(!1)},[h]),z=M.useCallback(()=>{s||m()},[m,s]),re=B("w-full min-w-[230px]",t),ie=B("absolute righ-0 top-[calc(100%+8px)] w-full bg-background rounded-2xl p-2","shadow-card z-50 transition-all duration-300 overflow-hidden overflow-y-auto","scrollbar-none max-h-[240px]",{"cursor-pointer":!!m,"pt-0":d},p);return w.jsxs("div",{className:re,"data-testid":r,onClick:z,children:[w.jsxs("div",{className:"relative",children:[w.jsx(Cc,{label:n,buttonRef:y,hasError:!!f,id:e,required:c,disabled:s,isDropdownOpen:x,placeholder:o,selectedOption:C,onClick:()=>b(!x)}),x&&w.jsxs("div",{ref:v,className:ie,children:[w.jsx("div",{className:B("sticky top-0 left-0 w-full bg-background",{hidden:!d}),children:w.jsx(Qn,{immediateFocus:!0,placeholder:"Search",value:E,onChange:R})}),w.jsx("ul",{className:"[&>*:last-child]:border-none",children:L.length?L.map((Q,de)=>w.jsx(gc,{dataTestId:`${r}-option-${Q.value}`,Icon:Q.Icon,label:Q.label,value:Q.value,onClick:j},`${Q.value}-${de}`)):w.jsx(pe,{as:"p",variant:"P2",className:"truncate p-4 text-center",children:"No options"})})]})]}),w.jsx(pe,{variant:"P3",as:"span",className:B("text-error mt-1 pl-1",{invisible:x}),children:f})]})}const bc=Se(["w-fit max-w-full border border-foreground rounded-3xl py-[6px] px-2 bg-transparent","flex items-center justify-center gap-1 overflow-hidden"],{variants:{variant:{default:"bg-surface-ulo border-surface-lo text-surface-md",soft:"bg-soft/50 border-soft text-surface-hi",primary:"bg-soft border-primary/20 text-primary",accent:"bg-accent/10 border-accent/20 text-accent",success:"bg-success/10 border-success/20 text-success",warning:"bg-warning/10 border-warning/20 text-warning",error:"bg-error/10 border-error/20 text-error"},withIcon:{true:"pl-1 pr-2"}},defaultVariants:{variant:"default"}}),wc={success:"checkCircleBold",warning:"warningBold",error:"closeCircleBold",default:"info",soft:"info",primary:"refresh",accent:"info","":void 0};function yc({label:e,withIcon:t=!1,variant:r,className:n,...o}){const a=t?wc[r||""]:void 0;return w.jsxs("div",{className:B(bc({variant:r,withIcon:t,className:n})),...o,children:[a&&w.jsx(ve,{className:"shrink-0",type:a,size:"xs"}),w.jsx(pe,{className:"text-inherit text-[9px] truncate whitespace-nowrap",variant:"StyledLabel",as:"span",children:e})]})}function Ec({id:e,className:t,label:r,checked:n,disabled:o,onToggle:a=()=>{},size:i="md"}){const s=M.useCallback(f=>{a(f.target.checked)},[a]),c=B("inline-flex items-center gap-4 cursor-pointer",t),d=B(["relative bg-surface-lo peer-focus:outline-none","rounded-full peer peer-checked:after:translate-x-full ","rtl:peer-checked:after:-translate-x-full peer-checked:after:border-background","after:content-[''] after:absolute","after:bg-background after:border-background after:border after:rounded-full","after:transition-all peer-checked:bg-primary",{"w-11 h-6 after:h-5 after:w-5 after:top-[2px] after:start-[2px]":i==="md","w-[30px] h-4 after:h-[14px] after:w-[14px] after:top-[1px] after:start-[1px]":i==="sm"}]);return w.jsxs("label",{className:c,children:[w.jsx("input",{type:"checkbox",checked:n,onChange:s,id:e,className:"sr-only peer",disabled:o}),w.jsx("div",{className:d}),r&&w.jsx(pe,{as:"span",variant:"P3",className:"text-inheret",children:r})]})}function xc({name:e,label:t,avatar:r,radius:n="full",className:o,...a}){const i=B("w-[36px] h-[36px] overflow-hidden",{"rounded-none":n==="none","rounded-full":n==="full","rounded-md":n==="md","rounded-sm":n==="sm"});return w.jsxs("div",{className:B("flex items-center gap-3",o),...a,children:[w.jsx("div",{className:i,children:r?w.jsx("img",{src:r,alt:"avatar",className:"size-full object-cover"}):w.jsx(ve,{type:"didit",className:"size-full object-cover"})}),w.jsxs("div",{className:"flex flex-col gap-1",children:[w.jsx(pe,{className:"text-foreground",as:"h6",variant:"H6",children:e}),t&&w.jsx(pe,{className:"text-surface-md",as:"span",variant:"Label3",children:t})]})]})}const kc=Se(["group w-fit max-w-full flex items-center gap-1 rounded-[100px] overflow-hidden","transition-all duration-300 p-[7px] border border-transparent"],{variants:{variant:{default:"bg-transparent hover:bg-surface-ulo border-surface-lo text-surface-hi hover:text-foreground",soft:"bg-soft/20 border-soft text-surface-hi hover:bg-soft/50 hover:text-foreground",primary:"bg-primary/5 border-primary/20 text-primary hover:bg-primary/10",accent:"bg-accent/10 border-accent/20 text-accent hover:bg-accent/40",success:"bg-success/5 border-success/20 text-success hover:bg-success/10",warning:"bg-warning/5 border-warning/20 text-warning hover:bg-warning/10",error:"bg-error/5 border-error/20 text-error hover:bg-error/10"},disabled:{true:"pointer-events-none opacity-50"},isLoading:{true:"pointer-events-none"},isActive:{true:""}},compoundVariants:[{variant:"default",isActive:!0,disabled:!1,className:"text-foreground bg-surface-ulo"},{variant:"soft",isActive:!0,disabled:!1,className:"text-foreground bg-soft/50"},{variant:"primary",isActive:!0,disabled:!1,className:"bg-primary/10"},{variant:"accent",isActive:!0,disabled:!1,className:"bg-accent/40"},{variant:"success",isActive:!0,disabled:!1,className:"bg-success/10"},{variant:"warning",isActive:!0,disabled:!1,className:"bg-warning/10"},{variant:"error",isActive:!0,disabled:!1,className:"bg-error/10"}],defaultVariants:{variant:"default",disabled:!1,isLoading:!1}});function Lc({variant:e="default",icon:t,isLoading:r=!1,isActive:n=!1,disabled:o,className:a,children:i,...s}){const c=B(kc({variant:e,isLoading:r,disabled:o,isActive:n,className:a}),{"pr-[9px]":!!t||r}),d=B("transition-colors duration-300",{"text-surface-md group-hover:text-foreground":e==="default","text-surface-hi":n&&e==="default"});return w.jsxs("button",{className:c,...s,children:[t&&!r&&w.jsx(ve,{type:t,size:"xs",className:d}),r&&w.jsx(Tt,{size:"xs",variant:e==="soft"?"default":e}),w.jsx(pe,{as:"span",className:"truncate",variant:"Label4",children:i})]})}exports.ActionButton=Lc;exports.Button=wi;exports.Card=Ei;exports.CheckBox=ki;exports.CopyValue=Mi;exports.DiditAnimatedLogo=Ri;exports.Icon=ve;exports.IconButton=xn;exports.Input=Ti;exports.MediaQuery=tt;exports.Modal=Z1;exports.QrCode=Wl;exports.SearchInput=Vl;exports.SearchMini=Qn;exports.SelectDropdown=vc;exports.Spinner=Tt;exports.StatusLabel=yc;exports.Text=pe;exports.Toggle=Ec;exports.Tooltip=kt;exports.UserCard=xc;exports.cn=B;exports.svgOptions=En;exports.useKeyPress=eo;exports.useLgMediaQuery=pc;exports.useMdMediaQuery=fc;exports.useMediaQuery=at;exports.useOnClickOutside=Xn;exports.useSmMediaQuery=dc;exports.useXlMediaQuery=hc;exports.useXxlMediaQuery=mc;
|
|
87
|
+
`;return typeof n=="function"&&n(null,h),h};const Nl=q1,hr=Bn,Jn=Gn,jl=Kn;function kr(e,t,r,n,o){const a=[].slice.call(arguments,1),i=a.length,s=typeof a[i-1]=="function";if(!s&&!Nl())throw new Error("Callback required as last argument");if(s){if(i<2)throw new Error("Too few arguments provided");i===2?(o=r,r=t,t=n=void 0):i===3&&(t.getContext&&typeof o>"u"?(o=n,n=void 0):(o=n,n=r,r=t,t=void 0))}else{if(i<1)throw new Error("Too few arguments provided");return i===1?(r=t,t=n=void 0):i===2&&!t.getContext&&(n=r,r=t,t=void 0),new Promise(function(c,d){try{const f=hr.create(r,n);c(e(f,t,n))}catch(f){d(f)}})}try{const c=hr.create(r,n);o(null,e(c,t,n))}catch(c){o(c)}}Ct.create=hr.create;Ct.toCanvas=kr.bind(null,Jn.render);Ct.toDataURL=kr.bind(null,Jn.renderToDataURL);Ct.toString=kr.bind(null,function(e,t,r){return jl.render(e,r)});const Pl=.1,dn=2.5,Te=7;function er(e,t,r){return e===t?!1:(e-t<0?t-e:e-t)<=r+Pl}function Al(e,t){const r=Array.prototype.slice.call(Ct.create(e,{errorCorrectionLevel:t}).modules.data,0),n=Math.sqrt(r.length);return r.reduce((o,a,i)=>(i%n===0?o.push([a]):o[o.length-1].push(a))&&o,[])}const Bl={generate(e,t,r,n="#141414"){const o="transparent",i=Al(e,"Q"),s=t/i.length,c=[{x:0,y:0},{x:1,y:0},{x:0,y:1}],d=[];c.forEach(({x:v,y:x})=>{const b=(i.length-Te)*s*v,E=(i.length-Te)*s*x,R=.3;for(let L=0;L<c.length;L+=1){const C=s*(Te-L*2);d.push(w.jsx("rect",{fill:L===2?n:o,width:L===0?C-5:C,rx:L===0?(C-5)*R:C*R,ry:L===0?(C-5)*R:C*R,stroke:n,strokeWidth:L===0?5:0,height:L===0?C-5:C,x:L===0?E+s*L+5/2:E+s*L,y:L===0?b+s*L+5/2:b+s*L},`${v}-${x}-${L}`))}});const f=Math.floor((r+25)/s),p=i.length/2-f/2,h=i.length/2+f/2-1,m=[];i.forEach((v,x)=>{v.forEach((b,E)=>{if(i[x][E]&&!(x<Te&&E<Te||x>i.length-(Te+1)&&E<Te||x<Te&&E>i.length-(Te+1))&&!(x>p&&x<h&&E>p&&E<h)){const R=x*s+s/2,L=E*s+s/2;m.push([R,L])}})});const y={};return m.forEach(([v,x])=>{var b;y[v]?(b=y[v])==null||b.push(x):y[v]=[x]}),Object.entries(y).map(([v,x])=>{const b=x.filter(E=>x.every(R=>!er(E,R,s)));return[Number(v),b]}).forEach(([v,x])=>{x.forEach(b=>{d.push(w.jsx("circle",{cx:v,cy:b,fill:n,r:s/dn}))})}),Object.entries(y).filter(([v,x])=>x.length>1).map(([v,x])=>{const b=x.filter(E=>x.some(R=>er(E,R,s)));return[Number(v),b]}).map(([v,x])=>{x.sort((E,R)=>E<R?-1:1);const b=[];for(const E of x){const R=b.find(L=>L.some(C=>er(E,C,s)));R?R.push(E):b.push([E])}return[v,b.map(E=>[E[0],E[E.length-1]])]}).forEach(([v,x])=>{x.forEach(([b,E])=>{d.push(w.jsx("line",{x1:v,x2:v,y1:b,y2:E,stroke:n,strokeWidth:s/(dn/2),strokeLinecap:"round"},`${v}-${b}-${E}`))})}),d}},Fl={sm:120,md:200,lg:256,xl:320};function Wl({uri:e,size:t="md",color:r,iconName:n,className:o,...a}){const i=typeof t=="number"?t:Fl[t],s=M.useMemo(()=>Bl.generate(e,i,i/4,r),[e,i,r]),c=B(["size-fit flex items-center justify-center","relative overflow-hidden aspect-square text-primary"],o),d=B(["size-full absolute top-1/2 left-1/2","transform -translate-x-1/2 -translate-y-1/2 scale-[0.25]","rounded-3xl overflow-hidden"]);return w.jsxs("div",{className:c,...a,children:[n&&w.jsx(ve,{type:n,className:d}),w.jsx("svg",{width:i,height:i,children:s})]})}function Vl({label:e,placeholder:t,value:r,disabled:n,className:o,error:a,onValueChange:i=()=>{},...s}){const c=M.useRef(null),[d,f]=M.useState(!1),p=B(["w-full overflow-hidden min-h-[68px] py-2 pr-2 cursor-pointer","flex items-center gap-2 border-b-[1.5px] border-transparent","focus:bg-transparent focus:border-foreground transition-all duration-300"],{"opacity-80":n,"border-foreground":d,"border-error":a},o),h=B([" placeholder:text-sm placeholder:font-normal placeholder:leading-[140%]","placeholder:text-surface-mdlo text-sm font-normal leading-[140%]","placeholder:tracking-tight tracking-tight","focus:ring-0 active:border-none bg-transparent border-none transition-all duration-300","p-0 m-0"]),m=B(["flex justify-center align-items-center hover:opacity-80 p-[2px]"],{invisible:!r}),y=B(["rounded-full bg-surface-ulo p-[9px] opacity-70","cursor-pointer hover:opacity-100"],{"opacity-100":d,"bg-error/5":a&&d});return w.jsxs("div",{className:"w-full overflow-hidden",children:[w.jsxs("div",{className:p,onClick:()=>{var v;return(v=c.current)==null?void 0:v.focus()},children:[w.jsx("div",{className:y,children:w.jsx(ve,{type:"search",size:"sm"})}),w.jsxs("div",{className:"flex flex-col gap-[6px] grow overflow-hidden min-w-0",children:[w.jsx(pe,{variant:"StyledLabel",as:"label",className:"text-surface-md cursor-pointer truncate",children:e}),w.jsx("input",{ref:c,onFocus:()=>f(!0),onBlur:()=>f(!1),className:h,value:r,type:"text",onChange:v=>i(v.target.value),placeholder:t,disabled:n,...s})]}),w.jsx("button",{className:m,onClick:()=>i(""),children:w.jsx(ve,{type:"closeCircleBold",size:"sm",className:"text-surface-mdlo"})})]}),w.jsx(pe,{variant:"P3",as:"span",className:"text-error mt-1",children:a})]})}var Il="Expected a function",fn=NaN,Dl="[object Symbol]",Hl=/^\s+|\s+$/g,$l=/^[-+]0x[0-9a-f]+$/i,Ul=/^0b[01]+$/i,zl=/^0o[0-7]+$/i,Zl=parseInt,ql=typeof Ve.commonjsGlobal=="object"&&Ve.commonjsGlobal&&Ve.commonjsGlobal.Object===Object&&Ve.commonjsGlobal,Yl=typeof self=="object"&&self&&self.Object===Object&&self,Gl=ql||Yl||Function("return this")(),Kl=Object.prototype,Jl=Kl.toString,Ql=Math.max,Xl=Math.min,tr=function(){return Gl.Date.now()};function ec(e,t,r){var n,o,a,i,s,c,d=0,f=!1,p=!1,h=!0;if(typeof e!="function")throw new TypeError(Il);t=pn(t)||0,mr(r)&&(f=!!r.leading,p="maxWait"in r,a=p?Ql(pn(r.maxWait)||0,t):a,h="trailing"in r?!!r.trailing:h);function m(j){var z=n,re=o;return n=o=void 0,d=j,i=e.apply(re,z),i}function y(j){return d=j,s=setTimeout(b,t),f?m(j):i}function v(j){var z=j-c,re=j-d,ie=t-z;return p?Xl(ie,a-re):ie}function x(j){var z=j-c,re=j-d;return c===void 0||z>=t||z<0||p&&re>=a}function b(){var j=tr();if(x(j))return E(j);s=setTimeout(b,v(j))}function E(j){return s=void 0,h&&n?m(j):(n=o=void 0,i)}function R(){s!==void 0&&clearTimeout(s),d=0,n=c=o=s=void 0}function L(){return s===void 0?i:E(tr())}function C(){var j=tr(),z=x(j);if(n=arguments,o=this,c=j,z){if(s===void 0)return y(c);if(p)return s=setTimeout(b,t),m(c)}return s===void 0&&(s=setTimeout(b,t)),i}return C.cancel=R,C.flush=L,C}function mr(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function tc(e){return!!e&&typeof e=="object"}function rc(e){return typeof e=="symbol"||tc(e)&&Jl.call(e)==Dl}function pn(e){if(typeof e=="number")return e;if(rc(e))return fn;if(mr(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=mr(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(Hl,"");var r=Ul.test(e);return r||zl.test(e)?Zl(e.slice(2),r?2:8):$l.test(e)?fn:+e}var nc=ec;const hn=Ve.getDefaultExportFromCjs(nc);var oc=typeof window<"u"?M.useLayoutEffect:M.useEffect;function ac(e,t,r,n){const o=M.useRef(t);oc(()=>{o.current=t},[t]),M.useEffect(()=>{const a=window;if(!(a&&a.addEventListener))return;const i=s=>{o.current(s)};return a.addEventListener(e,i,n),()=>{a.removeEventListener(e,i,n)}},[e,r,n])}function sc(e){const t=M.useRef(e);t.current=e,M.useEffect(()=>()=>{t.current()},[])}function ic(e,t=500,r){const n=M.useRef();sc(()=>{n.current&&n.current.cancel()});const o=M.useMemo(()=>{const a=hn(e,t,r),i=(...s)=>a(...s);return i.cancel=()=>{a.cancel()},i.isPending=()=>!!n.current,i.flush=()=>a.flush(),i},[e,t,r]);return M.useEffect(()=>{n.current=hn(e,t,r)},[e,t,r]),o}const lc=500;function Qn({id:e,className:t,disabled:r,placeholder:n,immediateFocus:o,value:a,onChange:i}){const s=M.useRef(null),[c,d]=M.useState(!1),f=ic(i,lc);M.useEffect(()=>{var y;o&&((y=s==null?void 0:s.current)==null||y.focus())},[]);const p=B("flex w-full items-center gap-3 px-4 py-3","border-b border-surface-ulo text-surface-hi",t),h=B("text-xs remove-arrow :focus:shadow-none grow shrink-0 truncate","placeholder:body-text placeholder:text-surface-md","border-none bg-transparent p-0 !shadow-none outline-none ring-0 ring-offset-0","focus:border-none focus:outline-none focus:ring-0","disabled:opacity-25"),m=B("shrink-0",{"opacity-25 transition-opacity duration-300":!c});return w.jsxs("div",{className:p,id:e,children:[w.jsx("div",{className:m,children:w.jsx(ve,{size:"sm",type:"search"})}),w.jsx("input",{disabled:r,ref:s,className:h,placeholder:n,type:"text",defaultValue:a,onBlur:()=>d(!1),onChange:y=>f(y.target.value),onFocus:()=>d(!0)})]})}const cc=typeof window<"u"?M.useLayoutEffect:M.useEffect,uc=typeof window>"u";function at(e,{defaultValue:t=!1,initializeWithValue:r=!0}={}){function n(s){return uc?t:window.matchMedia(s).matches}const[o,a]=M.useState(()=>r?n(e):t);function i(){a(n(e))}return cc(()=>{const s=window.matchMedia(e);return i(),s.addListener?s.addListener(i):s.addEventListener("change",i),()=>{s.removeListener?s.removeListener(i):s.removeEventListener("change",i)}},[e]),o}function dc(e={}){return at(`(min-width: ${tt.SM}px)`,e)}function fc(e={}){return at(`(min-width: ${tt.MD}px)`,e)}function pc(e={}){return at(`(min-width: ${tt.LG}px)`,e)}function hc(e={}){return at(`(min-width: ${tt.XL}px)`,e)}function mc(e={}){return at(`(min-width: ${tt.XXL}px)`,e)}function Xn(e,t,r,n="mousedown"){ac(n,o=>{const a=e==null?void 0:e.current,i=t==null?void 0:t.current;!a||a.contains(o.target)||!i||i.contains(o.target)||r(o)})}function eo(e,t){const r=M.useCallback(n=>{n.key===e&&t()},[e,t]);M.useEffect(()=>(window.addEventListener("keydown",r),()=>{window.removeEventListener("keydown",r)}),[r])}function gc({label:e,value:t,Icon:r=null,id:n="",dataTestId:o="",className:a="",onClick:i=()=>{}}){const s=M.useCallback(()=>{i(t)},[t,i]),c=B("flex w-full items-center gap-2 px-4 py-3 text-surface-hi","hover:bg-surface-ulo/60 border-b border-surface-ulo","transition-all duration-300",a);return w.jsx("li",{children:w.jsxs("button",{className:c,"data-testid":o,id:n,type:"button",onClick:s,children:[r&&w.jsx("span",{children:w.jsx(r,{})}),w.jsx(pe,{variant:"P3",as:"span",children:e})]})})}function Cc({id:e="",className:t="",label:r,placeholder:n,selectedOption:o={label:"",value:"",Icon:null},disabled:a=!1,required:i=!1,isDropdownOpen:s=!1,buttonRef:c=void 0,hasError:d=!1,onClick:f}){const p=B("w-full min-h-[68px] py-4 px-5 rounded-3xl","flex items-center gap-2 bg-surface-lo hover:bg-surface-ulo","transition-all duration-300 border border-transparent",{"opacity-50 hover:bg-surface-lo":a,"border-error bg-error/5":d,"bg-transparent border-foreground hover:bg-transparent":s,"border-error":s&&d},t),h=B("truncate w-fit",{"text-surface-background":o.value,"text-surface-md":!o.value}),m=B(["transition-all duration-300",{"-rotate-180":s}]);return w.jsxs("button",{disabled:a,id:e,className:p,ref:c,onClick:f,type:"button",children:[w.jsxs("div",{className:"flex flex-col gap-[6px] grow overflow-hidden min-w-0",children:[w.jsxs(pe,{variant:"StyledLabel",as:"label",className:"text-surface-md truncate w-fit",children:[r,i&&w.jsx("span",{className:"text-error text-[14px] leading-[90%]",children:"*"})]}),w.jsx(pe,{as:"span",variant:"P2",className:h,children:o.label||n})]}),w.jsx("div",{className:m,children:w.jsx(ve,{type:"chevronDown",size:"sm"})})]})}function vc({id:e="",className:t="",dataTestId:r="",label:n="",placeholder:o="",value:a=void 0,options:i,disabled:s=!1,required:c=!1,withSearch:d=!1,errorMessage:f="",dropdownClassName:p="",onChange:h=y=>{},onClick:m=()=>{}}){const y=M.useRef(null),v=M.useRef(null),[x,b]=M.useState(!1),[E,R]=M.useState(""),L=M.useMemo(()=>E?i.filter(Q=>Q.label.toLowerCase().startsWith(E.toLowerCase())):i,[E,i]),C=M.useMemo(()=>i.find(Q=>Q.value===a),[i,a]);eo("Escape",()=>b(!1)),Xn(y,v,()=>b(!1));const j=M.useCallback(Q=>{h(Q),b(!1)},[h]),z=M.useCallback(()=>{s||m()},[m,s]),re=B("w-full min-w-[230px]",t),ie=B("absolute righ-0 top-[calc(100%+8px)] w-full bg-background rounded-2xl p-2","shadow-card z-50 transition-all duration-300 overflow-hidden overflow-y-auto","scrollbar-none max-h-[240px]",{"cursor-pointer":!!m,"pt-0":d},p);return w.jsxs("div",{className:re,"data-testid":r,onClick:z,children:[w.jsxs("div",{className:"relative",children:[w.jsx(Cc,{label:n,buttonRef:y,hasError:!!f,id:e,required:c,disabled:s,isDropdownOpen:x,placeholder:o,selectedOption:C,onClick:()=>b(!x)}),x&&w.jsxs("div",{ref:v,className:ie,children:[w.jsx("div",{className:B("sticky top-0 left-0 w-full bg-background",{hidden:!d}),children:w.jsx(Qn,{immediateFocus:!0,placeholder:"Search",value:E,onChange:R})}),w.jsx("ul",{className:"[&>*:last-child]:border-none",children:L.length?L.map((Q,de)=>w.jsx(gc,{dataTestId:`${r}-option-${Q.value}`,Icon:Q.Icon,label:Q.label,value:Q.value,onClick:j},`${Q.value}-${de}`)):w.jsx(pe,{as:"p",variant:"P2",className:"truncate p-4 text-center",children:"No options"})})]})]}),w.jsx(pe,{variant:"P3",as:"span",className:B("text-error mt-1 pl-1",{invisible:x}),children:f})]})}const bc=Se(["w-fit max-w-full border border-foreground rounded-3xl py-[6px] px-2 bg-transparent","flex items-center justify-center gap-1 overflow-hidden"],{variants:{variant:{default:"bg-surface-ulo border-surface-lo text-surface-md",soft:"bg-soft/50 border-soft text-surface-hi",primary:"bg-soft border-primary/20 text-primary",accent:"bg-accent/10 border-accent/20 text-accent",success:"bg-success/10 border-success/20 text-success",warning:"bg-warning/10 border-warning/20 text-warning",error:"bg-error/10 border-error/20 text-error"},withIcon:{true:"pl-1 pr-2"}},defaultVariants:{variant:"default"}}),wc={success:"checkCircleBold",warning:"warningBold",error:"closeCircleBold",default:"info",soft:"info",primary:"refresh",accent:"info","":void 0};function yc({label:e,icon:t,withIcon:r=!1,variant:n,className:o,...a}){const i=r?wc[n||""]:t;return w.jsxs("div",{className:B(bc({variant:n,withIcon:!!i,className:o})),...a,children:[i&&w.jsx(ve,{className:"shrink-0",type:i,size:"xs"}),w.jsx(pe,{className:"text-inherit text-[9px] truncate whitespace-nowrap",variant:"StyledLabel",as:"span",children:e})]})}function Ec({id:e,className:t,label:r,checked:n,disabled:o,onToggle:a=()=>{},size:i="md"}){const s=M.useCallback(f=>{a(f.target.checked)},[a]),c=B("inline-flex items-center gap-4 cursor-pointer",t),d=B(["relative bg-surface-lo peer-focus:outline-none","rounded-full peer peer-checked:after:translate-x-full ","rtl:peer-checked:after:-translate-x-full peer-checked:after:border-background","after:content-[''] after:absolute","after:bg-background after:border-background after:border after:rounded-full","after:transition-all peer-checked:bg-primary",{"w-11 h-6 after:h-5 after:w-5 after:top-[2px] after:start-[2px]":i==="md","w-[30px] h-4 after:h-[14px] after:w-[14px] after:top-[1px] after:start-[1px]":i==="sm"}]);return w.jsxs("label",{className:c,children:[w.jsx("input",{type:"checkbox",checked:n,onChange:s,id:e,className:"sr-only peer",disabled:o}),w.jsx("div",{className:d}),r&&w.jsx(pe,{as:"span",variant:"P3",className:"text-inheret",children:r})]})}function xc({name:e,label:t,avatar:r,radius:n="full",className:o,...a}){const i=B("w-[36px] h-[36px] overflow-hidden",{"rounded-none":n==="none","rounded-full":n==="full","rounded-md":n==="md","rounded-sm":n==="sm"});return w.jsxs("div",{className:B("flex items-center gap-3",o),...a,children:[w.jsx("div",{className:i,children:r?w.jsx("img",{src:r,alt:"avatar",className:"size-full object-cover"}):w.jsx(ve,{type:"didit",className:"size-full object-cover"})}),w.jsxs("div",{className:"flex flex-col gap-1",children:[w.jsx(pe,{className:"text-foreground",as:"h6",variant:"H6",children:e}),t&&w.jsx(pe,{className:"text-surface-md",as:"span",variant:"Label3",children:t})]})]})}const kc=Se(["group w-fit max-w-full flex items-center gap-1 rounded-[100px] overflow-hidden","transition-all duration-300 p-[7px] border border-transparent"],{variants:{variant:{default:"bg-transparent hover:bg-surface-ulo border-surface-lo text-surface-hi hover:text-foreground",soft:"bg-soft/20 border-soft text-surface-hi hover:bg-soft/50 hover:text-foreground",primary:"bg-primary/5 border-primary/20 text-primary hover:bg-primary/10",accent:"bg-accent/10 border-accent/20 text-accent hover:bg-accent/40",success:"bg-success/5 border-success/20 text-success hover:bg-success/10",warning:"bg-warning/5 border-warning/20 text-warning hover:bg-warning/10",error:"bg-error/5 border-error/20 text-error hover:bg-error/10"},disabled:{true:"pointer-events-none opacity-50"},isLoading:{true:"pointer-events-none"},isActive:{true:""}},compoundVariants:[{variant:"default",isActive:!0,disabled:!1,className:"text-foreground bg-surface-ulo"},{variant:"soft",isActive:!0,disabled:!1,className:"text-foreground bg-soft/50"},{variant:"primary",isActive:!0,disabled:!1,className:"bg-primary/10"},{variant:"accent",isActive:!0,disabled:!1,className:"bg-accent/40"},{variant:"success",isActive:!0,disabled:!1,className:"bg-success/10"},{variant:"warning",isActive:!0,disabled:!1,className:"bg-warning/10"},{variant:"error",isActive:!0,disabled:!1,className:"bg-error/10"}],defaultVariants:{variant:"default",disabled:!1,isLoading:!1}});function Lc({variant:e="default",icon:t,isLoading:r=!1,isActive:n=!1,disabled:o,className:a,children:i,...s}){const c=B(kc({variant:e,isLoading:r,disabled:o,isActive:n,className:a}),{"pr-[9px]":!!t||r}),d=B("transition-colors duration-300",{"text-surface-md group-hover:text-foreground":e==="default","text-surface-hi":n&&e==="default"});return w.jsxs("button",{className:c,...s,children:[t&&!r&&w.jsx(ve,{type:t,size:"xs",className:d}),r&&w.jsx(Tt,{size:"xs",variant:e==="soft"?"default":e}),w.jsx(pe,{as:"span",className:"truncate",variant:"Label4",children:i})]})}exports.ActionButton=Lc;exports.Button=wi;exports.Card=Ei;exports.CheckBox=ki;exports.CopyValue=Mi;exports.DiditAnimatedLogo=Ri;exports.Icon=ve;exports.IconButton=xn;exports.Input=Ti;exports.MediaQuery=tt;exports.Modal=Z1;exports.QrCode=Wl;exports.SearchInput=Vl;exports.SearchMini=Qn;exports.SelectDropdown=vc;exports.Spinner=Tt;exports.StatusLabel=yc;exports.Text=pe;exports.Toggle=Ec;exports.Tooltip=kt;exports.UserCard=xc;exports.cn=B;exports.svgOptions=En;exports.useKeyPress=eo;exports.useLgMediaQuery=pc;exports.useMdMediaQuery=fc;exports.useMediaQuery=at;exports.useOnClickOutside=Xn;exports.useSmMediaQuery=dc;exports.useXlMediaQuery=hc;exports.useXxlMediaQuery=mc;
|
package/dist/diditui.d.ts
CHANGED
|
@@ -258,10 +258,11 @@ declare const spinnerStyles: (props?: ({
|
|
|
258
258
|
size?: "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | null | undefined;
|
|
259
259
|
} & ClassProp) | undefined) => string;
|
|
260
260
|
|
|
261
|
-
export declare function StatusLabel({ label, withIcon, variant, className, ...props }: StatusLabelProps): JSX_2.Element;
|
|
261
|
+
export declare function StatusLabel({ label, icon, withIcon, variant, className, ...props }: StatusLabelProps): JSX_2.Element;
|
|
262
262
|
|
|
263
263
|
declare type StatusLabelProps = ComponentProps<'div'> & VariantProps<typeof statusLabelStyles> & {
|
|
264
264
|
label: string;
|
|
265
|
+
icon?: IconType;
|
|
265
266
|
withIcon?: boolean;
|
|
266
267
|
};
|
|
267
268
|
|
package/dist/diditui.js
CHANGED
|
@@ -7587,20 +7587,34 @@ const fc = _e(
|
|
|
7587
7587
|
accent: "info",
|
|
7588
7588
|
"": void 0
|
|
7589
7589
|
};
|
|
7590
|
-
function jc({
|
|
7591
|
-
|
|
7592
|
-
|
|
7593
|
-
|
|
7594
|
-
|
|
7595
|
-
|
|
7596
|
-
|
|
7597
|
-
|
|
7598
|
-
|
|
7599
|
-
|
|
7600
|
-
|
|
7601
|
-
|
|
7602
|
-
|
|
7603
|
-
|
|
7590
|
+
function jc({
|
|
7591
|
+
label: e,
|
|
7592
|
+
icon: t,
|
|
7593
|
+
withIcon: r = !1,
|
|
7594
|
+
variant: n,
|
|
7595
|
+
className: o,
|
|
7596
|
+
...a
|
|
7597
|
+
}) {
|
|
7598
|
+
const i = r ? pc[n || ""] : t;
|
|
7599
|
+
return /* @__PURE__ */ y.jsxs(
|
|
7600
|
+
"div",
|
|
7601
|
+
{
|
|
7602
|
+
className: B(fc({ variant: n, withIcon: !!i, className: o })),
|
|
7603
|
+
...a,
|
|
7604
|
+
children: [
|
|
7605
|
+
i && /* @__PURE__ */ y.jsx(be, { className: "shrink-0", type: i, size: "xs" }),
|
|
7606
|
+
/* @__PURE__ */ y.jsx(
|
|
7607
|
+
pe,
|
|
7608
|
+
{
|
|
7609
|
+
className: "text-inherit text-[9px] truncate whitespace-nowrap",
|
|
7610
|
+
variant: "StyledLabel",
|
|
7611
|
+
as: "span",
|
|
7612
|
+
children: e
|
|
7613
|
+
}
|
|
7614
|
+
)
|
|
7615
|
+
]
|
|
7616
|
+
}
|
|
7617
|
+
);
|
|
7604
7618
|
}
|
|
7605
7619
|
function Ac({
|
|
7606
7620
|
id: e,
|