@swing.xyz/design-system
Advanced tools
Comparing version 0.49.1 to 0.49.2
'use client' | ||
"use strict";var _=Object.create;var s=Object.defineProperty,H=Object.defineProperties,L=Object.getOwnPropertyDescriptor,j=Object.getOwnPropertyDescriptors,q=Object.getOwnPropertyNames,m=Object.getOwnPropertySymbols,J=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty,b=Object.prototype.propertyIsEnumerable;var P=(e,i,o)=>i in e?s(e,i,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[i]=o,N=(e,i)=>{for(var o in i||(i={}))u.call(i,o)&&P(e,o,i[o]);if(m)for(var o of m(i))b.call(i,o)&&P(e,o,i[o]);return e},C=(e,i)=>H(e,j(i));var I=(e,i)=>{var o={};for(var t in e)u.call(e,t)&&i.indexOf(t)<0&&(o[t]=e[t]);if(e!=null&&m)for(var t of m(e))i.indexOf(t)<0&&b.call(e,t)&&(o[t]=e[t]);return o};var K=(e,i)=>{for(var o in i)s(e,o,{get:i[o],enumerable:!0})},R=(e,i,o,t)=>{if(i&&typeof i=="object"||typeof i=="function")for(let r of q(i))!u.call(e,r)&&r!==o&&s(e,r,{get:()=>i[r],enumerable:!(t=L(i,r))||t.enumerable});return e};var v=(e,i,o)=>(o=e!=null?_(J(e)):{},R(i||!e||!e.__esModule?s(o,"default",{value:e,enumerable:!0}):o,e)),Q=e=>R(s({},"__esModule",{value:!0}),e);var Y={};K(Y,{Dialog:()=>M});module.exports=Q(Y);var F=require("react"),G=require("@fortawesome/free-solid-svg-icons"),h=require("@headlessui/react"),a=v(require("@radix-ui/react-dialog")),y=v(require("clsx"));var S=require("react");var T=v(require("clsx")),V=require("tailwind-merge"),z=(...e)=>(0,V.twMerge)((0,T.default)(...e));var l=require("react/jsx-runtime"),U={xs:"h-3 w-3",sm:"h-4 w-4",default:"h-5 w-5",lg:"h-6 w-6"},x=(0,S.forwardRef)(function(i,o){let D=i,{icon:t,children:r,className:d,fixedWidth:p,spin:c,size:g}=D,E=I(D,["icon","children","className","fixedWidth","spin","size"]),{prefix:O,iconName:$,icon:k}=t,[A,B,Z,ee,f]=k,w=`${O}-${$}`,W=U[g||"default"];return(0,l.jsxs)("svg",C(N({ref:o,viewBox:`0 0 ${A} ${B}`,xmlns:"http://www.w3.org/2000/svg",role:"img","aria-hidden":"true","data-fa":w,className:z(d,W,"svg-inline--fa fill-current",w,{"fa-spin":!!c,"fa-fw":!!p})},E),{children:[r,Array.isArray(f)?(0,l.jsxs)("g",{children:[(0,l.jsx)("path",{d:f[0]}),(0,l.jsx)("path",{d:f[1]})]}):(0,l.jsx)("path",{d:f})]}))});x.displayName="Icon";var n=require("react/jsx-runtime");function X(){return typeof window!="undefined"?window.document.getElementById("swing"):void 0}var M=({isOpen:e,onOpenChange:i,shouldCloseOnInteractOutside:o=!0,title:t,children:r,trigger:d,description:p})=>{var c;return(0,n.jsxs)(a.Root,{open:e,onOpenChange:i,children:[d&&(0,n.jsx)(a.Trigger,{asChild:!0,children:d}),(0,n.jsx)(a.Portal,{container:(c=X())==null?void 0:c.firstElementChild,children:(0,n.jsxs)(h.Transition,{show:e,children:[(0,n.jsx)(a.Overlay,{forceMount:!0,className:"bg-background/80 data-[state=closed]:animate-out data-[state=closed]:fade-out data-[state=open]:fade-in fixed inset-0 z-40 rounded-xl transition-all duration-100"}),(0,n.jsx)(h.Transition.Child,{as:F.Fragment,enter:"ease-in duration-300",enterFrom:"opacity-0 translate-y-full",enterTo:"opacity-100 translate-y-0",leave:"ease-out duration-400",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 translate-y-full",children:(0,n.jsxs)(a.Content,{forceMount:!0,className:(0,y.default)("fixed bottom-0 left-0 right-0 top-12 z-50 border-t","w-full overflow-hidden rounded-xl","bg-background focus:outline-none focus-visible:ring focus-visible:ring-blue-500 focus-visible:ring-opacity-75","flex flex-col"),onInteractOutside:o?void 0:g=>{g.preventDefault()},children:[(0,n.jsxs)(a.Title,{className:"text-foreground relative flex px-4 py-3 text-base font-bold",children:[(0,n.jsx)("div",{className:"flex-1",children:t}),(0,n.jsx)(a.Close,{className:(0,y.default)("text-muted text-base","inline-flex items-center justify-center rounded-full p-1","focus:outline-none focus-visible:ring focus-visible:ring-blue-500 focus-visible:ring-opacity-75"),"data-test":"dialog-close",tabIndex:-1,children:(0,n.jsx)(x,{size:"sm",icon:G.faClose})})]}),p&&(0,n.jsx)(a.Description,{className:"text-muted mt-2 text-sm font-normal"}),e&&(0,n.jsx)("div",{className:"h-full flex-1 overflow-hidden",children:r})]})})]})})]})};M.displayName="Dialog"; | ||
"use strict";var _=Object.create;var s=Object.defineProperty,H=Object.defineProperties,L=Object.getOwnPropertyDescriptor,j=Object.getOwnPropertyDescriptors,q=Object.getOwnPropertyNames,m=Object.getOwnPropertySymbols,J=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty,b=Object.prototype.propertyIsEnumerable;var P=(e,i,o)=>i in e?s(e,i,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[i]=o,N=(e,i)=>{for(var o in i||(i={}))u.call(i,o)&&P(e,o,i[o]);if(m)for(var o of m(i))b.call(i,o)&&P(e,o,i[o]);return e},C=(e,i)=>H(e,j(i));var I=(e,i)=>{var o={};for(var t in e)u.call(e,t)&&i.indexOf(t)<0&&(o[t]=e[t]);if(e!=null&&m)for(var t of m(e))i.indexOf(t)<0&&b.call(e,t)&&(o[t]=e[t]);return o};var K=(e,i)=>{for(var o in i)s(e,o,{get:i[o],enumerable:!0})},R=(e,i,o,t)=>{if(i&&typeof i=="object"||typeof i=="function")for(let r of q(i))!u.call(e,r)&&r!==o&&s(e,r,{get:()=>i[r],enumerable:!(t=L(i,r))||t.enumerable});return e};var v=(e,i,o)=>(o=e!=null?_(J(e)):{},R(i||!e||!e.__esModule?s(o,"default",{value:e,enumerable:!0}):o,e)),Q=e=>R(s({},"__esModule",{value:!0}),e);var Y={};K(Y,{Dialog:()=>M});module.exports=Q(Y);var F=require("react"),G=require("@fortawesome/free-solid-svg-icons"),h=require("@headlessui/react"),a=v(require("@radix-ui/react-dialog")),y=v(require("clsx"));var S=require("react");var T=v(require("clsx")),V=require("tailwind-merge"),z=(...e)=>(0,V.twMerge)((0,T.default)(...e));var l=require("react/jsx-runtime"),U={xs:"h-3 w-3",sm:"h-4 w-4",default:"h-5 w-5",lg:"h-6 w-6"},x=(0,S.forwardRef)(function(i,o){let D=i,{icon:t,children:r,className:d,fixedWidth:p,spin:c,size:g}=D,E=I(D,["icon","children","className","fixedWidth","spin","size"]),{prefix:O,iconName:$,icon:k}=t,[A,B,Z,ee,f]=k,w=`${O}-${$}`,W=U[g||"default"];return(0,l.jsxs)("svg",C(N({ref:o,viewBox:`0 0 ${A} ${B}`,xmlns:"http://www.w3.org/2000/svg",role:"img","aria-hidden":"true","data-fa":w,className:z(d,W,"svg-inline--fa fill-current",w,{"fa-spin":!!c,"fa-fw":!!p})},E),{children:[r,Array.isArray(f)?(0,l.jsxs)("g",{children:[(0,l.jsx)("path",{d:f[0]}),(0,l.jsx)("path",{d:f[1]})]}):(0,l.jsx)("path",{d:f})]}))});x.displayName="Icon";var n=require("react/jsx-runtime");function X(){return typeof window!="undefined"?window.document.getElementById("swing"):void 0}var M=({isOpen:e,onOpenChange:i,shouldCloseOnInteractOutside:o=!0,title:t,children:r,trigger:d,description:p})=>{var c;return(0,n.jsxs)(a.Root,{open:e,onOpenChange:i,modal:!1,children:[d&&(0,n.jsx)(a.Trigger,{asChild:!0,children:d}),(0,n.jsx)(a.Portal,{container:(c=X())==null?void 0:c.firstElementChild,children:(0,n.jsxs)(h.Transition,{show:e,children:[(0,n.jsx)(a.Overlay,{forceMount:!0,className:"bg-background/80 data-[state=closed]:animate-out data-[state=closed]:fade-out data-[state=open]:fade-in fixed inset-0 z-40 rounded-xl transition-all duration-100"}),(0,n.jsx)(h.Transition.Child,{as:F.Fragment,enter:"ease-in duration-300",enterFrom:"opacity-0 translate-y-full",enterTo:"opacity-100 translate-y-0",leave:"ease-out duration-400",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 translate-y-full",children:(0,n.jsxs)(a.Content,{forceMount:!0,className:(0,y.default)("fixed bottom-0 left-0 right-0 top-12 z-50 border-t","w-full overflow-hidden rounded-xl","bg-background focus:outline-none focus-visible:ring focus-visible:ring-blue-500 focus-visible:ring-opacity-75","flex flex-col"),onInteractOutside:o?void 0:g=>{g.preventDefault()},children:[(0,n.jsxs)(a.Title,{className:"text-foreground relative flex px-4 py-3 text-base font-bold",children:[(0,n.jsx)("div",{className:"flex-1",children:t}),(0,n.jsx)(a.Close,{className:(0,y.default)("text-muted text-base","inline-flex items-center justify-center rounded-full p-1","focus:outline-none focus-visible:ring focus-visible:ring-blue-500 focus-visible:ring-opacity-75"),"data-test":"dialog-close",tabIndex:-1,children:(0,n.jsx)(x,{size:"sm",icon:G.faClose})})]}),p&&(0,n.jsx)(a.Description,{className:"text-muted mt-2 text-sm font-normal"}),e&&(0,n.jsx)("div",{className:"h-full flex-1 overflow-hidden",children:r})]})})]})})]})};M.displayName="Dialog"; | ||
//# sourceMappingURL=index.js.map |
'use client' | ||
"use strict";var me=Object.create;var z=Object.defineProperty,ue=Object.defineProperties,fe=Object.getOwnPropertyDescriptor,pe=Object.getOwnPropertyDescriptors,ge=Object.getOwnPropertyNames,k=Object.getOwnPropertySymbols,ve=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty,j=Object.prototype.propertyIsEnumerable;var W=(e,t,o)=>t in e?z(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,_=(e,t)=>{for(var o in t||(t={}))F.call(t,o)&&W(e,o,t[o]);if(k)for(var o of k(t))j.call(t,o)&&W(e,o,t[o]);return e},U=(e,t)=>ue(e,pe(t));var Y=(e,t)=>{var o={};for(var i in e)F.call(e,i)&&t.indexOf(i)<0&&(o[i]=e[i]);if(e!=null&&k)for(var i of k(e))t.indexOf(i)<0&&j.call(e,i)&&(o[i]=e[i]);return o};var he=(e,t)=>{for(var o in t)z(e,o,{get:t[o],enumerable:!0})},q=(e,t,o,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of ge(t))!F.call(e,n)&&n!==o&&z(e,n,{get:()=>t[n],enumerable:!(i=fe(t,n))||i.enumerable});return e};var E=(e,t,o)=>(o=e!=null?me(ve(e)):{},q(t||!e||!e.__esModule?z(o,"default",{value:e,enumerable:!0}):o,e)),xe=e=>q(z({},"__esModule",{value:!0}),e);var M=(e,t,o)=>new Promise((i,n)=>{var s=r=>{try{l(o.next(r))}catch(h){n(h)}},a=r=>{try{l(o.throw(r))}catch(h){n(h)}},l=r=>r.done?i(r.value):Promise.resolve(r.value).then(s,a);l((o=o.apply(e,t)).next())});var Re={};he(Re,{Select:()=>De});module.exports=xe(Re);var V=require("react"),ce=require("@fortawesome/free-solid-svg-icons"),de=E(require("clsx"));var ee=require("react"),te=require("@fortawesome/free-solid-svg-icons"),H=require("@headlessui/react"),f=E(require("@radix-ui/react-dialog")),K=E(require("clsx"));var Z=require("react");var J=E(require("clsx")),Q=require("tailwind-merge"),X=(...e)=>(0,Q.twMerge)((0,J.default)(...e));var S=require("react/jsx-runtime"),be={xs:"h-3 w-3",sm:"h-4 w-4",default:"h-5 w-5",lg:"h-6 w-6"},C=(0,Z.forwardRef)(function(t,o){let u=t,{icon:i,children:n,className:s,fixedWidth:a,spin:l,size:r}=u,h=Y(u,["icon","children","className","fixedWidth","spin","size"]),{prefix:p,iconName:R,icon:D}=i,[x,w,b,T,P]=D,N=`${p}-${R}`,c=be[r||"default"];return(0,S.jsxs)("svg",U(_({ref:o,viewBox:`0 0 ${x} ${w}`,xmlns:"http://www.w3.org/2000/svg",role:"img","aria-hidden":"true","data-fa":N,className:X(s,c,"svg-inline--fa fill-current",N,{"fa-spin":!!l,"fa-fw":!!a})},h),{children:[n,Array.isArray(P)?(0,S.jsxs)("g",{children:[(0,S.jsx)("path",{d:P[0]}),(0,S.jsx)("path",{d:P[1]})]}):(0,S.jsx)("path",{d:P})]}))});C.displayName="Icon";var g=require("react/jsx-runtime");function ye(){return typeof window!="undefined"?window.document.getElementById("swing"):void 0}var $=({isOpen:e,onOpenChange:t,shouldCloseOnInteractOutside:o=!0,title:i,children:n,trigger:s,description:a})=>{var l;return(0,g.jsxs)(f.Root,{open:e,onOpenChange:t,children:[s&&(0,g.jsx)(f.Trigger,{asChild:!0,children:s}),(0,g.jsx)(f.Portal,{container:(l=ye())==null?void 0:l.firstElementChild,children:(0,g.jsxs)(H.Transition,{show:e,children:[(0,g.jsx)(f.Overlay,{forceMount:!0,className:"bg-background/80 data-[state=closed]:animate-out data-[state=closed]:fade-out data-[state=open]:fade-in fixed inset-0 z-40 rounded-xl transition-all duration-100"}),(0,g.jsx)(H.Transition.Child,{as:ee.Fragment,enter:"ease-in duration-300",enterFrom:"opacity-0 translate-y-full",enterTo:"opacity-100 translate-y-0",leave:"ease-out duration-400",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 translate-y-full",children:(0,g.jsxs)(f.Content,{forceMount:!0,className:(0,K.default)("fixed bottom-0 left-0 right-0 top-12 z-50 border-t","w-full overflow-hidden rounded-xl","bg-background focus:outline-none focus-visible:ring focus-visible:ring-blue-500 focus-visible:ring-opacity-75","flex flex-col"),onInteractOutside:o?void 0:r=>{r.preventDefault()},children:[(0,g.jsxs)(f.Title,{className:"text-foreground relative flex px-4 py-3 text-base font-bold",children:[(0,g.jsx)("div",{className:"flex-1",children:i}),(0,g.jsx)(f.Close,{className:(0,K.default)("text-muted text-base","inline-flex items-center justify-center rounded-full p-1","focus:outline-none focus-visible:ring focus-visible:ring-blue-500 focus-visible:ring-opacity-75"),"data-test":"dialog-close",tabIndex:-1,children:(0,g.jsx)(C,{size:"sm",icon:te.faClose})})]}),a&&(0,g.jsx)(f.Description,{className:"text-muted mt-2 text-sm font-normal"}),e&&(0,g.jsx)("div",{className:"h-full flex-1 overflow-hidden",children:n})]})})]})})]})};$.displayName="Dialog";var d=require("react"),A=require("@fortawesome/free-solid-svg-icons"),ne=require("@tanstack/react-virtual"),ae=E(require("clsx")),I=require("jotai");var L=require("react");function oe(e,t){let[o,i]=(0,L.useState)(e);return(0,L.useEffect)(()=>{let n=setTimeout(()=>{i(e)},t||500);return()=>{clearTimeout(n)}},[e,t]),o}var ie=require("react"),O=E(require("clsx")),y=require("react/jsx-runtime"),G=(0,ie.forwardRef)(function({value:t,onChange:o,onBlur:i,onKeyDown:n,subtext:s,readOnly:a,placeholder:l,className:r,dataTest:h,type:p,min:R,lang:D,error:x,autoFocus:w,isLoading:b,icon:T},P){return(0,y.jsxs)("div",{className:(0,O.default)(r,"relative rounded-xl border-2",{"focus-within:ring-0":a,"focus-within:ring focus-within:ring-blue-500":!x,"ring ring-rose-500 focus-within:ring focus-within:ring-rose-500":!!x}),children:[T&&(0,y.jsx)("div",{className:"absolute inset-y-0 left-0",children:(0,y.jsx)("div",{className:"text-muted flex h-full items-center justify-center pl-4",children:T})}),(0,y.jsx)("input",{ref:P,type:p!=null?p:"text",className:(0,O.default)("inline-block h-full w-full truncate rounded-xl bg-transparent px-7 outline-none",{"pl-12":!!T,"text-muted pr-12":b}),value:t,onChange:!b&&o?N=>{o(N.currentTarget.value)}:void 0,onBlur:i?N=>{i(N.currentTarget.value)}:void 0,onKeyDown:n?N=>{n(N)}:void 0,placeholder:l,readOnly:a,disabled:a,"data-test":h,min:R,lang:D,autoFocus:w}),(x||s)&&(0,y.jsx)("div",{className:(0,O.default)("absolute bottom-2 left-7 truncate text-[10px] text-xs",{"text-danger":!!x,"text-muted":!!s}),children:x||s}),b&&(0,y.jsx)("div",{className:"absolute inset-y-0 right-0",children:(0,y.jsx)("div",{className:"text-muted flex h-full items-center justify-center pr-4",children:(0,y.jsxs)("svg",{className:"h-5 w-5 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[(0,y.jsx)("circle",{className:"stroke-muted opacity-25",cx:"12",cy:"12",r:"10",strokeWidth:"4"}),(0,y.jsx)("path",{className:"fill-muted opacity-75",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})})})]})});G.displayName="Input";var m=require("react/jsx-runtime"),se=(0,I.atom)(""),re=(0,I.atom)(-1);function le({value:e,items:t,isLoading:o,searchPlaceholder:i,onChange:n,onSearch:s,renderItem:a}){return(0,m.jsxs)(m.Fragment,{children:[s&&(0,m.jsx)(we,{placeholder:i}),(0,m.jsx)(Ie,{value:e,items:t,onSearch:s,onChange:n,renderItem:a}),o&&(0,m.jsx)("div",{className:"bg-background absolute inset-0 z-10 flex h-full w-full items-center justify-center bg-opacity-70",children:(0,m.jsx)(C,{className:"text-muted",icon:A.faCircleNotch,size:"lg",spin:!0})})]})}var we=({placeholder:e})=>{let t=(0,d.useRef)(null),[o,i]=(0,d.useState)(""),n=oe(o,200),s=(0,I.useSetAtom)(se),a=(0,I.useSetAtom)(re);(0,d.useEffect)(()=>{var r;return(r=t.current)==null||r.focus(),s(""),()=>{s(""),a(-1)}},[s,a]),(0,d.useEffect)(()=>{s(n)},[n,s]);let l=(0,d.useCallback)(r=>{r.code==="ArrowDown"&&a(0)},[a]);return(0,m.jsx)("div",{className:"relative z-10 mx-4 mt-2",children:(0,m.jsx)(G,{ref:t,className:"h-12 bg-transparent",dataTest:"select-search-input",placeholder:e||"Search...",value:o,onChange:r=>{i(r),a(-1)},onKeyDown:l,autoFocus:!0,icon:(0,m.jsx)(C,{icon:A.faMagnifyingGlass})})})};function Ne({value:e,items:t,onChange:o,onSearch:i,renderItem:n}){var N;let s=(0,I.useAtomValue)(se),[a,l]=(0,I.useAtom)(re),r=(0,d.useRef)([]),h=(0,d.useRef)(null),p=(0,d.useMemo)(()=>i&&s?t.filter(c=>i(c,s)):t,[t,s,i]),R=typeof e!="undefined"?p.indexOf(e):-1,[D,x]=(0,d.useState)(null),w=(0,ne.useVirtualizer)({count:p.length,getScrollElement:()=>h.current,estimateSize:()=>60,overscan:5,getItemKey:c=>`${String(t[c])}-${c}`}),b=(0,d.useCallback)(c=>M(this,null,function*(){let u=o(c);u instanceof Promise&&(x(c),yield u,x(null)),l(-1)}),[o,l]),T=(0,d.useCallback)(c=>{if(c.code==="ArrowUp")l(a?a-1:p.length-1);else if(c.code==="ArrowDown")l(a===p.length-1?0:a+1);else if(c.code==="Enter"){let u=p[a];u&&b(u)}},[l,b,a,p]);(0,d.useEffect)(()=>{var c;(c=r.current[a])==null||c.focus()},[a]),(0,d.useEffect)(()=>{l(R)},[R,l]);let P=w.getVirtualItems();return(0,m.jsx)("div",{className:"flex-1 px-4",ref:h,style:{height:400,overflow:"auto"},children:(0,m.jsx)("div",{className:"relative w-full",style:{height:`${w.getTotalSize()}px`},children:(0,m.jsx)("div",{className:"pb-4",style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${(N=P[0])==null?void 0:N.start}px)`},children:w.getVirtualItems().map(c=>{let u=p[c.index];return(0,m.jsx)("div",{"data-index":c.index,ref:w.measureElement,"data-test":"select-item",children:(0,m.jsx)("div",{tabIndex:0,onClick:()=>M(this,null,function*(){typeof u!="undefined"&&(yield b(u))}),onKeyDown:T,ref:B=>{B&&(r.current[c.index]=B)},className:(0,ae.default)("bg-background hover:bg-accent mt-2.5 cursor-pointer space-x-2 rounded-xl border px-3 outline-none focus:ring focus:ring-blue-500",{"bg-secondary":e===u}),children:(0,m.jsx)("div",{className:"flex items-center justify-start text-sm",children:typeof u!="undefined"?n(u,e===u,{isLoading:D===u}):null})})},c.key)})})})})}var Te=d.memo,Ie=Te(Ne);var v=require("react/jsx-runtime");function De({className:e,title:t,value:o,items:i,isLoading:n,onChange:s,onSearch:a,renderTrigger:l,trigger:r,renderItem:h,children:p}){let[R,D]=(0,V.useState)(!1),x=(0,V.useCallback)(T=>M(this,null,function*(){yield s(T),D(!1)}),[s]),w=(0,V.useCallback)(T=>{T.preventDefault(),i.length&&D(!0)},[i]),b;return r?b=(0,V.cloneElement)(r,{onClick:w}):l&&(b=(0,v.jsxs)("button",{className:(0,de.default)("bg-background relative flex h-16 items-center space-x-2 rounded-xl border-2 px-4 py-3 text-left outline-none focus:ring focus:ring-blue-500",e),onClick:w,children:[(0,v.jsx)("div",{className:"flex-1 truncate",children:l(o)}),!n&&i.length>0&&(0,v.jsx)(C,{className:"text-muted",icon:ce.faCaretDown,size:"sm"}),n&&(0,v.jsx)("div",{className:"absolute inset-y-0 right-0",children:(0,v.jsx)("div",{className:"text-muted flex h-full items-center justify-center pr-4",children:(0,v.jsxs)("svg",{className:"h-5 w-5 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[(0,v.jsx)("circle",{className:"stroke-muted opacity-25",cx:"12",cy:"12",r:"10",strokeWidth:"4"}),(0,v.jsx)("path",{className:"fill-muted opacity-75",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})})})]})),(0,v.jsx)($,{title:t,isOpen:R,onOpenChange:D,trigger:b,children:(0,v.jsxs)("div",{className:"relative flex h-full flex-col",children:[(0,v.jsx)(le,{value:o,items:i,renderItem:h,onSearch:a,onChange:x,isLoading:n}),p]})})} | ||
"use strict";var me=Object.create;var z=Object.defineProperty,ue=Object.defineProperties,fe=Object.getOwnPropertyDescriptor,pe=Object.getOwnPropertyDescriptors,ge=Object.getOwnPropertyNames,k=Object.getOwnPropertySymbols,ve=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty,j=Object.prototype.propertyIsEnumerable;var W=(e,t,o)=>t in e?z(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,_=(e,t)=>{for(var o in t||(t={}))F.call(t,o)&&W(e,o,t[o]);if(k)for(var o of k(t))j.call(t,o)&&W(e,o,t[o]);return e},U=(e,t)=>ue(e,pe(t));var Y=(e,t)=>{var o={};for(var i in e)F.call(e,i)&&t.indexOf(i)<0&&(o[i]=e[i]);if(e!=null&&k)for(var i of k(e))t.indexOf(i)<0&&j.call(e,i)&&(o[i]=e[i]);return o};var he=(e,t)=>{for(var o in t)z(e,o,{get:t[o],enumerable:!0})},q=(e,t,o,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of ge(t))!F.call(e,n)&&n!==o&&z(e,n,{get:()=>t[n],enumerable:!(i=fe(t,n))||i.enumerable});return e};var E=(e,t,o)=>(o=e!=null?me(ve(e)):{},q(t||!e||!e.__esModule?z(o,"default",{value:e,enumerable:!0}):o,e)),xe=e=>q(z({},"__esModule",{value:!0}),e);var M=(e,t,o)=>new Promise((i,n)=>{var s=r=>{try{l(o.next(r))}catch(h){n(h)}},a=r=>{try{l(o.throw(r))}catch(h){n(h)}},l=r=>r.done?i(r.value):Promise.resolve(r.value).then(s,a);l((o=o.apply(e,t)).next())});var Re={};he(Re,{Select:()=>De});module.exports=xe(Re);var V=require("react"),ce=require("@fortawesome/free-solid-svg-icons"),de=E(require("clsx"));var ee=require("react"),te=require("@fortawesome/free-solid-svg-icons"),H=require("@headlessui/react"),f=E(require("@radix-ui/react-dialog")),K=E(require("clsx"));var Z=require("react");var J=E(require("clsx")),Q=require("tailwind-merge"),X=(...e)=>(0,Q.twMerge)((0,J.default)(...e));var S=require("react/jsx-runtime"),be={xs:"h-3 w-3",sm:"h-4 w-4",default:"h-5 w-5",lg:"h-6 w-6"},C=(0,Z.forwardRef)(function(t,o){let u=t,{icon:i,children:n,className:s,fixedWidth:a,spin:l,size:r}=u,h=Y(u,["icon","children","className","fixedWidth","spin","size"]),{prefix:p,iconName:R,icon:D}=i,[x,w,b,T,P]=D,N=`${p}-${R}`,c=be[r||"default"];return(0,S.jsxs)("svg",U(_({ref:o,viewBox:`0 0 ${x} ${w}`,xmlns:"http://www.w3.org/2000/svg",role:"img","aria-hidden":"true","data-fa":N,className:X(s,c,"svg-inline--fa fill-current",N,{"fa-spin":!!l,"fa-fw":!!a})},h),{children:[n,Array.isArray(P)?(0,S.jsxs)("g",{children:[(0,S.jsx)("path",{d:P[0]}),(0,S.jsx)("path",{d:P[1]})]}):(0,S.jsx)("path",{d:P})]}))});C.displayName="Icon";var g=require("react/jsx-runtime");function ye(){return typeof window!="undefined"?window.document.getElementById("swing"):void 0}var $=({isOpen:e,onOpenChange:t,shouldCloseOnInteractOutside:o=!0,title:i,children:n,trigger:s,description:a})=>{var l;return(0,g.jsxs)(f.Root,{open:e,onOpenChange:t,modal:!1,children:[s&&(0,g.jsx)(f.Trigger,{asChild:!0,children:s}),(0,g.jsx)(f.Portal,{container:(l=ye())==null?void 0:l.firstElementChild,children:(0,g.jsxs)(H.Transition,{show:e,children:[(0,g.jsx)(f.Overlay,{forceMount:!0,className:"bg-background/80 data-[state=closed]:animate-out data-[state=closed]:fade-out data-[state=open]:fade-in fixed inset-0 z-40 rounded-xl transition-all duration-100"}),(0,g.jsx)(H.Transition.Child,{as:ee.Fragment,enter:"ease-in duration-300",enterFrom:"opacity-0 translate-y-full",enterTo:"opacity-100 translate-y-0",leave:"ease-out duration-400",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 translate-y-full",children:(0,g.jsxs)(f.Content,{forceMount:!0,className:(0,K.default)("fixed bottom-0 left-0 right-0 top-12 z-50 border-t","w-full overflow-hidden rounded-xl","bg-background focus:outline-none focus-visible:ring focus-visible:ring-blue-500 focus-visible:ring-opacity-75","flex flex-col"),onInteractOutside:o?void 0:r=>{r.preventDefault()},children:[(0,g.jsxs)(f.Title,{className:"text-foreground relative flex px-4 py-3 text-base font-bold",children:[(0,g.jsx)("div",{className:"flex-1",children:i}),(0,g.jsx)(f.Close,{className:(0,K.default)("text-muted text-base","inline-flex items-center justify-center rounded-full p-1","focus:outline-none focus-visible:ring focus-visible:ring-blue-500 focus-visible:ring-opacity-75"),"data-test":"dialog-close",tabIndex:-1,children:(0,g.jsx)(C,{size:"sm",icon:te.faClose})})]}),a&&(0,g.jsx)(f.Description,{className:"text-muted mt-2 text-sm font-normal"}),e&&(0,g.jsx)("div",{className:"h-full flex-1 overflow-hidden",children:n})]})})]})})]})};$.displayName="Dialog";var d=require("react"),A=require("@fortawesome/free-solid-svg-icons"),ne=require("@tanstack/react-virtual"),ae=E(require("clsx")),I=require("jotai");var L=require("react");function oe(e,t){let[o,i]=(0,L.useState)(e);return(0,L.useEffect)(()=>{let n=setTimeout(()=>{i(e)},t||500);return()=>{clearTimeout(n)}},[e,t]),o}var ie=require("react"),O=E(require("clsx")),y=require("react/jsx-runtime"),G=(0,ie.forwardRef)(function({value:t,onChange:o,onBlur:i,onKeyDown:n,subtext:s,readOnly:a,placeholder:l,className:r,dataTest:h,type:p,min:R,lang:D,error:x,autoFocus:w,isLoading:b,icon:T},P){return(0,y.jsxs)("div",{className:(0,O.default)(r,"relative rounded-xl border-2",{"focus-within:ring-0":a,"focus-within:ring focus-within:ring-blue-500":!x,"ring ring-rose-500 focus-within:ring focus-within:ring-rose-500":!!x}),children:[T&&(0,y.jsx)("div",{className:"absolute inset-y-0 left-0",children:(0,y.jsx)("div",{className:"text-muted flex h-full items-center justify-center pl-4",children:T})}),(0,y.jsx)("input",{ref:P,type:p!=null?p:"text",className:(0,O.default)("inline-block h-full w-full truncate rounded-xl bg-transparent px-7 outline-none",{"pl-12":!!T,"text-muted pr-12":b}),value:t,onChange:!b&&o?N=>{o(N.currentTarget.value)}:void 0,onBlur:i?N=>{i(N.currentTarget.value)}:void 0,onKeyDown:n?N=>{n(N)}:void 0,placeholder:l,readOnly:a,disabled:a,"data-test":h,min:R,lang:D,autoFocus:w}),(x||s)&&(0,y.jsx)("div",{className:(0,O.default)("absolute bottom-2 left-7 truncate text-[10px] text-xs",{"text-danger":!!x,"text-muted":!!s}),children:x||s}),b&&(0,y.jsx)("div",{className:"absolute inset-y-0 right-0",children:(0,y.jsx)("div",{className:"text-muted flex h-full items-center justify-center pr-4",children:(0,y.jsxs)("svg",{className:"h-5 w-5 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[(0,y.jsx)("circle",{className:"stroke-muted opacity-25",cx:"12",cy:"12",r:"10",strokeWidth:"4"}),(0,y.jsx)("path",{className:"fill-muted opacity-75",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})})})]})});G.displayName="Input";var m=require("react/jsx-runtime"),se=(0,I.atom)(""),re=(0,I.atom)(-1);function le({value:e,items:t,isLoading:o,searchPlaceholder:i,onChange:n,onSearch:s,renderItem:a}){return(0,m.jsxs)(m.Fragment,{children:[s&&(0,m.jsx)(we,{placeholder:i}),(0,m.jsx)(Ie,{value:e,items:t,onSearch:s,onChange:n,renderItem:a}),o&&(0,m.jsx)("div",{className:"bg-background absolute inset-0 z-10 flex h-full w-full items-center justify-center bg-opacity-70",children:(0,m.jsx)(C,{className:"text-muted",icon:A.faCircleNotch,size:"lg",spin:!0})})]})}var we=({placeholder:e})=>{let t=(0,d.useRef)(null),[o,i]=(0,d.useState)(""),n=oe(o,200),s=(0,I.useSetAtom)(se),a=(0,I.useSetAtom)(re);(0,d.useEffect)(()=>{var r;return(r=t.current)==null||r.focus(),s(""),()=>{s(""),a(-1)}},[s,a]),(0,d.useEffect)(()=>{s(n)},[n,s]);let l=(0,d.useCallback)(r=>{r.code==="ArrowDown"&&a(0)},[a]);return(0,m.jsx)("div",{className:"relative z-10 mx-4 mt-2",children:(0,m.jsx)(G,{ref:t,className:"h-12 bg-transparent",dataTest:"select-search-input",placeholder:e||"Search...",value:o,onChange:r=>{i(r),a(-1)},onKeyDown:l,autoFocus:!0,icon:(0,m.jsx)(C,{icon:A.faMagnifyingGlass})})})};function Ne({value:e,items:t,onChange:o,onSearch:i,renderItem:n}){var N;let s=(0,I.useAtomValue)(se),[a,l]=(0,I.useAtom)(re),r=(0,d.useRef)([]),h=(0,d.useRef)(null),p=(0,d.useMemo)(()=>i&&s?t.filter(c=>i(c,s)):t,[t,s,i]),R=typeof e!="undefined"?p.indexOf(e):-1,[D,x]=(0,d.useState)(null),w=(0,ne.useVirtualizer)({count:p.length,getScrollElement:()=>h.current,estimateSize:()=>60,overscan:5,getItemKey:c=>`${String(t[c])}-${c}`}),b=(0,d.useCallback)(c=>M(this,null,function*(){let u=o(c);u instanceof Promise&&(x(c),yield u,x(null)),l(-1)}),[o,l]),T=(0,d.useCallback)(c=>{if(c.code==="ArrowUp")l(a?a-1:p.length-1);else if(c.code==="ArrowDown")l(a===p.length-1?0:a+1);else if(c.code==="Enter"){let u=p[a];u&&b(u)}},[l,b,a,p]);(0,d.useEffect)(()=>{var c;(c=r.current[a])==null||c.focus()},[a]),(0,d.useEffect)(()=>{l(R)},[R,l]);let P=w.getVirtualItems();return(0,m.jsx)("div",{className:"flex-1 px-4",ref:h,style:{height:400,overflow:"auto"},children:(0,m.jsx)("div",{className:"relative w-full",style:{height:`${w.getTotalSize()}px`},children:(0,m.jsx)("div",{className:"pb-4",style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${(N=P[0])==null?void 0:N.start}px)`},children:w.getVirtualItems().map(c=>{let u=p[c.index];return(0,m.jsx)("div",{"data-index":c.index,ref:w.measureElement,"data-test":"select-item",children:(0,m.jsx)("div",{tabIndex:0,onClick:()=>M(this,null,function*(){typeof u!="undefined"&&(yield b(u))}),onKeyDown:T,ref:B=>{B&&(r.current[c.index]=B)},className:(0,ae.default)("bg-background hover:bg-accent mt-2.5 cursor-pointer space-x-2 rounded-xl border px-3 outline-none focus:ring focus:ring-blue-500",{"bg-secondary":e===u}),children:(0,m.jsx)("div",{className:"flex items-center justify-start text-sm",children:typeof u!="undefined"?n(u,e===u,{isLoading:D===u}):null})})},c.key)})})})})}var Te=d.memo,Ie=Te(Ne);var v=require("react/jsx-runtime");function De({className:e,title:t,value:o,items:i,isLoading:n,onChange:s,onSearch:a,renderTrigger:l,trigger:r,renderItem:h,children:p}){let[R,D]=(0,V.useState)(!1),x=(0,V.useCallback)(T=>M(this,null,function*(){yield s(T),D(!1)}),[s]),w=(0,V.useCallback)(T=>{T.preventDefault(),i.length&&D(!0)},[i]),b;return r?b=(0,V.cloneElement)(r,{onClick:w}):l&&(b=(0,v.jsxs)("button",{className:(0,de.default)("bg-background relative flex h-16 items-center space-x-2 rounded-xl border-2 px-4 py-3 text-left outline-none focus:ring focus:ring-blue-500",e),onClick:w,children:[(0,v.jsx)("div",{className:"flex-1 truncate",children:l(o)}),!n&&i.length>0&&(0,v.jsx)(C,{className:"text-muted",icon:ce.faCaretDown,size:"sm"}),n&&(0,v.jsx)("div",{className:"absolute inset-y-0 right-0",children:(0,v.jsx)("div",{className:"text-muted flex h-full items-center justify-center pr-4",children:(0,v.jsxs)("svg",{className:"h-5 w-5 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[(0,v.jsx)("circle",{className:"stroke-muted opacity-25",cx:"12",cy:"12",r:"10",strokeWidth:"4"}),(0,v.jsx)("path",{className:"fill-muted opacity-75",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})})})]})),(0,v.jsx)($,{title:t,isOpen:R,onOpenChange:D,trigger:b,children:(0,v.jsxs)("div",{className:"relative flex h-full flex-col",children:[(0,v.jsx)(le,{value:o,items:i,renderItem:h,onSearch:a,onChange:x,isLoading:n}),p]})})} | ||
//# sourceMappingURL=index.js.map |
'use client' | ||
"use strict";var Se=Object.create;var X=Object.defineProperty,Ve=Object.defineProperties,Ae=Object.getOwnPropertyDescriptor,je=Object.getOwnPropertyDescriptors,Me=Object.getOwnPropertyNames,K=Object.getOwnPropertySymbols,Fe=Object.getPrototypeOf,ee=Object.prototype.hasOwnProperty,ge=Object.prototype.propertyIsEnumerable;var ce=(t,e,i)=>e in t?X(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,v=(t,e)=>{for(var i in e||(e={}))ee.call(e,i)&&ce(t,i,e[i]);if(K)for(var i of K(e))ge.call(e,i)&&ce(t,i,e[i]);return t},L=(t,e)=>Ve(t,je(e));var I=(t,e)=>{var i={};for(var r in t)ee.call(t,r)&&e.indexOf(r)<0&&(i[r]=t[r]);if(t!=null&&K)for(var r of K(t))e.indexOf(r)<0&&ge.call(t,r)&&(i[r]=t[r]);return i};var Be=(t,e)=>{for(var i in e)X(t,i,{get:e[i],enumerable:!0})},de=(t,e,i,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Me(e))!ee.call(t,s)&&s!==i&&X(t,s,{get:()=>e[s],enumerable:!(r=Ae(e,s))||r.enumerable});return t};var T=(t,e,i)=>(i=t!=null?Se(Fe(t)):{},de(e||!t||!t.__esModule?X(i,"default",{value:t,enumerable:!0}):i,t)),Le=t=>de(X({},"__esModule",{value:!0}),t);var M=(t,e,i)=>new Promise((r,s)=>{var n=l=>{try{a(i.next(l))}catch(p){s(p)}},o=l=>{try{a(i.throw(l))}catch(p){s(p)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(n,o);a((i=i.apply(t,e)).next())});var it={};Be(it,{Avatar:()=>pe,AvatarFallback:()=>ue,AvatarImage:()=>fe,Badge:()=>he,Button:()=>ye,Callout:()=>Ye,Dialog:()=>_,Icon:()=>P,Input:()=>Z,SearchList:()=>ae,Select:()=>et,useCopyToClipboard:()=>tt,useDebounce:()=>oe});module.exports=Le(it);var W=T(require("react")),S=T(require("@radix-ui/react-avatar"));var we=T(require("clsx")),me=require("tailwind-merge"),H=(...t)=>(0,me.twMerge)((0,we.default)(...t));var G=require("react/jsx-runtime"),pe=W.forwardRef((r,i)=>{var s=r,{className:t}=s,e=I(s,["className"]);return(0,G.jsx)(S.Root,v({ref:i,className:H("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t)},e))});pe.displayName=S.Root.displayName;var fe=W.forwardRef((r,i)=>{var s=r,{className:t}=s,e=I(s,["className"]);return(0,G.jsx)(S.Image,v({ref:i,className:H("aspect-square h-full w-full",t)},e))});fe.displayName=S.Image.displayName;var ue=W.forwardRef((r,i)=>{var s=r,{className:t}=s,e=I(s,["className"]);return(0,G.jsx)(S.Fallback,v({ref:i,className:H("flex h-full w-full items-center justify-center rounded-full",t)},e))});ue.displayName=S.Fallback.displayName;var ve=T(require("clsx")),Y=require("react/jsx-runtime"),he=({children:t,className:e,intent:i="default",icon:r})=>(0,Y.jsxs)("div",{className:(0,ve.default)(e,"inline-flex items-center space-x-1 truncate rounded-lg px-2 py-0.5 text-xs",{"bg-primary text-white":i==="primary","bg-success text-white":i==="success","bg-danger text-white":i==="danger","bg-warning text-white":i==="warning","bg-info text-white":i==="info","bg-secondary text-muted":i==="default"}),children:[r,(0,Y.jsx)("div",{className:"flex-1 truncate",children:t})]});he.displayName="Badge";var xe=require("react");function O(){return O=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t},O.apply(this,arguments)}var c=require("react");var He=require("react");function Oe(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e)}function be(...t){return e=>t.forEach(i=>Oe(i,e))}var ie=(0,c.forwardRef)((t,e)=>{let o=t,{children:i}=o,r=I(o,["children"]),s=c.Children.toArray(i),n=s.find(Ke);if(n){let a=n.props.children,l=s.map(p=>p===n?c.Children.count(a)>1?c.Children.only(null):(0,c.isValidElement)(a)?a.props.children:null:p);return(0,c.createElement)(te,O({},r,{ref:e}),(0,c.isValidElement)(a)?(0,c.cloneElement)(a,void 0,l):null)}return(0,c.createElement)(te,O({},r,{ref:e}),i)});ie.displayName="Slot";var te=(0,c.forwardRef)((t,e)=>{let s=t,{children:i}=s,r=I(s,["children"]);return(0,c.isValidElement)(i)?(0,c.cloneElement)(i,L(v({},We(r,i.props)),{ref:e?be(e,i.ref):i.ref})):c.Children.count(i)>1?c.Children.only(null):null});te.displayName="SlotClone";var Xe=({children:t})=>(0,c.createElement)(c.Fragment,null,t);function Ke(t){return(0,c.isValidElement)(t)&&t.type===Xe}function We(t,e){let i=v({},e);for(let r in e){let s=t[r],n=e[r];/^on[A-Z]/.test(r)?s&&n?i[r]=(...a)=>{n(...a),s(...a)}:s&&(i[r]=s):r==="style"?i[r]=v(v({},s),n):r==="className"&&(i[r]=[s,n].filter(Boolean).join(" "))}return v(v({},t),i)}var q=T(require("clsx"));var N=require("react/jsx-runtime"),ye=(0,xe.forwardRef)((p,l)=>{var w=p,{children:t,appearance:e="primary",className:i,disabled:r,dataTest:s,isLoading:n,asChild:o}=w,a=I(w,["children","appearance","className","disabled","dataTest","isLoading","asChild"]);return(0,N.jsx)(o?ie:"button",L(v({ref:l,"data-test":s},a),{disabled:r||n,className:(0,q.default)(i,"relative inline-flex h-12 cursor-pointer items-center justify-center rounded-lg px-4 py-2 text-sm font-medium","focus-visible:ring-primary-500 pointer-events-auto focus:outline-none focus-visible:ring focus-visible:ring-opacity-75",{"bg-primary text-white enabled:hover:bg-opacity-90":e==="primary","bg-secondary text-secondary-foreground enabled:hover:bg-border":e==="default","bg-background text-foreground border border-solid":e==="outline","cursor-not-allowed bg-opacity-50":r,"cursor-wait bg-opacity-50":n}),children:o?t:(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)("div",{className:"flex-shrink basis-0"}),(0,N.jsx)("div",{className:"flex-1",children:t}),(0,N.jsx)("div",{className:"flex h-full flex-shrink basis-0 items-center justify-end",children:n&&(0,N.jsxs)("svg",{className:"h-5 w-5 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[(0,N.jsx)("circle",{className:(0,q.default)("opacity-25",{"stroke-muted":e==="default","stroke-white":e==="primary"}),cx:"12",cy:"12",r:"10",strokeWidth:"4"}),(0,N.jsx)("path",{className:(0,q.default)("opacity-75",{"fill-muted":e==="default","fill-white":e==="primary"}),d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})})]})}))});ye.displayName="Button";var j=require("@fortawesome/free-solid-svg-icons"),re=T(require("clsx"));var Ne=require("react");var F=require("react/jsx-runtime"),Ge={xs:"h-3 w-3",sm:"h-4 w-4",default:"h-5 w-5",lg:"h-6 w-6"},P=(0,Ne.forwardRef)(function(e,i){let f=e,{icon:r,children:s,className:n,fixedWidth:o,spin:a,size:l}=f,p=I(f,["icon","children","className","fixedWidth","spin","size"]),{prefix:w,iconName:D,icon:E}=r,[x,R,y,$,V]=E,C=`${w}-${D}`,g=Ge[l||"default"];return(0,F.jsxs)("svg",L(v({ref:i,viewBox:`0 0 ${x} ${R}`,xmlns:"http://www.w3.org/2000/svg",role:"img","aria-hidden":"true","data-fa":C,className:H(n,g,"svg-inline--fa fill-current",C,{"fa-spin":!!a,"fa-fw":!!o})},p),{children:[s,Array.isArray(V)?(0,F.jsxs)("g",{children:[(0,F.jsx)("path",{d:V[0]}),(0,F.jsx)("path",{d:V[1]})]}):(0,F.jsx)("path",{d:V})]}))});P.displayName="Icon";var A=require("react/jsx-runtime"),Ye=({className:t,intent:e,title:i,description:r})=>(0,A.jsxs)("div",{className:(0,re.default)(t,"flex items-start space-x-4 rounded-xl px-4 py-2 text-base",{"bg-border":!e,"bg-blue-200":e==="info","bg-green-200":e==="success","bg-red-200":e==="danger","bg-amber-200":e==="warning"}),children:[(0,A.jsx)("div",{className:(0,re.default)("h-full py-1 text-lg",{"text-info":e==="info","text-success":e==="success","text-danger":e==="danger","text-warning":e==="warning"}),children:(0,A.jsx)(P,{className:"h-6 w-6",icon:qe[e||"info"]})}),(0,A.jsxs)("div",{children:[(0,A.jsx)("div",{className:"text-lg font-bold",children:i}),(0,A.jsx)("div",{className:"text-sm",children:r})]})]}),qe={info:j.faInfoCircle,success:j.faCircleCheck,danger:j.faExclamationCircle,warning:j.faTriangleExclamation};var ke=require("react"),Re=require("@fortawesome/free-solid-svg-icons"),se=require("@headlessui/react"),u=T(require("@radix-ui/react-dialog")),ne=T(require("clsx"));var h=require("react/jsx-runtime");function _e(){return typeof window!="undefined"?window.document.getElementById("swing"):void 0}var _=({isOpen:t,onOpenChange:e,shouldCloseOnInteractOutside:i=!0,title:r,children:s,trigger:n,description:o})=>{var a;return(0,h.jsxs)(u.Root,{open:t,onOpenChange:e,children:[n&&(0,h.jsx)(u.Trigger,{asChild:!0,children:n}),(0,h.jsx)(u.Portal,{container:(a=_e())==null?void 0:a.firstElementChild,children:(0,h.jsxs)(se.Transition,{show:t,children:[(0,h.jsx)(u.Overlay,{forceMount:!0,className:"bg-background/80 data-[state=closed]:animate-out data-[state=closed]:fade-out data-[state=open]:fade-in fixed inset-0 z-40 rounded-xl transition-all duration-100"}),(0,h.jsx)(se.Transition.Child,{as:ke.Fragment,enter:"ease-in duration-300",enterFrom:"opacity-0 translate-y-full",enterTo:"opacity-100 translate-y-0",leave:"ease-out duration-400",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 translate-y-full",children:(0,h.jsxs)(u.Content,{forceMount:!0,className:(0,ne.default)("fixed bottom-0 left-0 right-0 top-12 z-50 border-t","w-full overflow-hidden rounded-xl","bg-background focus:outline-none focus-visible:ring focus-visible:ring-blue-500 focus-visible:ring-opacity-75","flex flex-col"),onInteractOutside:i?void 0:l=>{l.preventDefault()},children:[(0,h.jsxs)(u.Title,{className:"text-foreground relative flex px-4 py-3 text-base font-bold",children:[(0,h.jsx)("div",{className:"flex-1",children:r}),(0,h.jsx)(u.Close,{className:(0,ne.default)("text-muted text-base","inline-flex items-center justify-center rounded-full p-1","focus:outline-none focus-visible:ring focus-visible:ring-blue-500 focus-visible:ring-opacity-75"),"data-test":"dialog-close",tabIndex:-1,children:(0,h.jsx)(P,{size:"sm",icon:Re.faClose})})]}),o&&(0,h.jsx)(u.Description,{className:"text-muted mt-2 text-sm font-normal"}),t&&(0,h.jsx)("div",{className:"h-full flex-1 overflow-hidden",children:s})]})})]})})]})};_.displayName="Dialog";var Ce=require("react"),U=T(require("clsx")),k=require("react/jsx-runtime"),Z=(0,Ce.forwardRef)(function({value:e,onChange:i,onBlur:r,onKeyDown:s,subtext:n,readOnly:o,placeholder:a,className:l,dataTest:p,type:w,min:D,lang:E,error:x,autoFocus:R,isLoading:y,icon:$},V){return(0,k.jsxs)("div",{className:(0,U.default)(l,"relative rounded-xl border-2",{"focus-within:ring-0":o,"focus-within:ring focus-within:ring-blue-500":!x,"ring ring-rose-500 focus-within:ring focus-within:ring-rose-500":!!x}),children:[$&&(0,k.jsx)("div",{className:"absolute inset-y-0 left-0",children:(0,k.jsx)("div",{className:"text-muted flex h-full items-center justify-center pl-4",children:$})}),(0,k.jsx)("input",{ref:V,type:w!=null?w:"text",className:(0,U.default)("inline-block h-full w-full truncate rounded-xl bg-transparent px-7 outline-none",{"pl-12":!!$,"text-muted pr-12":y}),value:e,onChange:!y&&i?C=>{i(C.currentTarget.value)}:void 0,onBlur:r?C=>{r(C.currentTarget.value)}:void 0,onKeyDown:s?C=>{s(C)}:void 0,placeholder:a,readOnly:o,disabled:o,"data-test":p,min:D,lang:E,autoFocus:R}),(x||n)&&(0,k.jsx)("div",{className:(0,U.default)("absolute bottom-2 left-7 truncate text-[10px] text-xs",{"text-danger":!!x,"text-muted":!!n}),children:x||n}),y&&(0,k.jsx)("div",{className:"absolute inset-y-0 right-0",children:(0,k.jsx)("div",{className:"text-muted flex h-full items-center justify-center pr-4",children:(0,k.jsxs)("svg",{className:"h-5 w-5 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[(0,k.jsx)("circle",{className:"stroke-muted opacity-25",cx:"12",cy:"12",r:"10",strokeWidth:"4"}),(0,k.jsx)("path",{className:"fill-muted opacity-75",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})})})]})});Z.displayName="Input";var d=require("react"),Q=require("@fortawesome/free-solid-svg-icons"),Ie=require("@tanstack/react-virtual"),Te=T(require("clsx")),z=require("jotai");var J=require("react");function oe(t,e){let[i,r]=(0,J.useState)(t);return(0,J.useEffect)(()=>{let s=setTimeout(()=>{r(t)},e||500);return()=>{clearTimeout(s)}},[t,e]),i}var m=require("react/jsx-runtime"),Pe=(0,z.atom)(""),$e=(0,z.atom)(-1);function ae({value:t,items:e,isLoading:i,searchPlaceholder:r,onChange:s,onSearch:n,renderItem:o}){return(0,m.jsxs)(m.Fragment,{children:[n&&(0,m.jsx)(Ue,{placeholder:r}),(0,m.jsx)(Qe,{value:t,items:e,onSearch:n,onChange:s,renderItem:o}),i&&(0,m.jsx)("div",{className:"bg-background absolute inset-0 z-10 flex h-full w-full items-center justify-center bg-opacity-70",children:(0,m.jsx)(P,{className:"text-muted",icon:Q.faCircleNotch,size:"lg",spin:!0})})]})}var Ue=({placeholder:t})=>{let e=(0,d.useRef)(null),[i,r]=(0,d.useState)(""),s=oe(i,200),n=(0,z.useSetAtom)(Pe),o=(0,z.useSetAtom)($e);(0,d.useEffect)(()=>{var l;return(l=e.current)==null||l.focus(),n(""),()=>{n(""),o(-1)}},[n,o]),(0,d.useEffect)(()=>{n(s)},[s,n]);let a=(0,d.useCallback)(l=>{l.code==="ArrowDown"&&o(0)},[o]);return(0,m.jsx)("div",{className:"relative z-10 mx-4 mt-2",children:(0,m.jsx)(Z,{ref:e,className:"h-12 bg-transparent",dataTest:"select-search-input",placeholder:t||"Search...",value:i,onChange:l=>{r(l),o(-1)},onKeyDown:a,autoFocus:!0,icon:(0,m.jsx)(P,{icon:Q.faMagnifyingGlass})})})};function Ze({value:t,items:e,onChange:i,onSearch:r,renderItem:s}){var C;let n=(0,z.useAtomValue)(Pe),[o,a]=(0,z.useAtom)($e),l=(0,d.useRef)([]),p=(0,d.useRef)(null),w=(0,d.useMemo)(()=>r&&n?e.filter(g=>r(g,n)):e,[e,n,r]),D=typeof t!="undefined"?w.indexOf(t):-1,[E,x]=(0,d.useState)(null),R=(0,Ie.useVirtualizer)({count:w.length,getScrollElement:()=>p.current,estimateSize:()=>60,overscan:5,getItemKey:g=>`${String(e[g])}-${g}`}),y=(0,d.useCallback)(g=>M(this,null,function*(){let f=i(g);f instanceof Promise&&(x(g),yield f,x(null)),a(-1)}),[i,a]),$=(0,d.useCallback)(g=>{if(g.code==="ArrowUp")a(o?o-1:w.length-1);else if(g.code==="ArrowDown")a(o===w.length-1?0:o+1);else if(g.code==="Enter"){let f=w[o];f&&y(f)}},[a,y,o,w]);(0,d.useEffect)(()=>{var g;(g=l.current[o])==null||g.focus()},[o]),(0,d.useEffect)(()=>{a(D)},[D,a]);let V=R.getVirtualItems();return(0,m.jsx)("div",{className:"flex-1 px-4",ref:p,style:{height:400,overflow:"auto"},children:(0,m.jsx)("div",{className:"relative w-full",style:{height:`${R.getTotalSize()}px`},children:(0,m.jsx)("div",{className:"pb-4",style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${(C=V[0])==null?void 0:C.start}px)`},children:R.getVirtualItems().map(g=>{let f=w[g.index];return(0,m.jsx)("div",{"data-index":g.index,ref:R.measureElement,"data-test":"select-item",children:(0,m.jsx)("div",{tabIndex:0,onClick:()=>M(this,null,function*(){typeof f!="undefined"&&(yield y(f))}),onKeyDown:$,ref:le=>{le&&(l.current[g.index]=le)},className:(0,Te.default)("bg-background hover:bg-accent mt-2.5 cursor-pointer space-x-2 rounded-xl border px-3 outline-none focus:ring focus:ring-blue-500",{"bg-secondary":t===f}),children:(0,m.jsx)("div",{className:"flex items-center justify-start text-sm",children:typeof f!="undefined"?s(f,t===f,{isLoading:E===f}):null})})},g.key)})})})})}var Je=d.memo,Qe=Je(Ze);var B=require("react"),ze=require("@fortawesome/free-solid-svg-icons"),De=T(require("clsx"));var b=require("react/jsx-runtime");function et({className:t,title:e,value:i,items:r,isLoading:s,onChange:n,onSearch:o,renderTrigger:a,trigger:l,renderItem:p,children:w}){let[D,E]=(0,B.useState)(!1),x=(0,B.useCallback)($=>M(this,null,function*(){yield n($),E(!1)}),[n]),R=(0,B.useCallback)($=>{$.preventDefault(),r.length&&E(!0)},[r]),y;return l?y=(0,B.cloneElement)(l,{onClick:R}):a&&(y=(0,b.jsxs)("button",{className:(0,De.default)("bg-background relative flex h-16 items-center space-x-2 rounded-xl border-2 px-4 py-3 text-left outline-none focus:ring focus:ring-blue-500",t),onClick:R,children:[(0,b.jsx)("div",{className:"flex-1 truncate",children:a(i)}),!s&&r.length>0&&(0,b.jsx)(P,{className:"text-muted",icon:ze.faCaretDown,size:"sm"}),s&&(0,b.jsx)("div",{className:"absolute inset-y-0 right-0",children:(0,b.jsx)("div",{className:"text-muted flex h-full items-center justify-center pr-4",children:(0,b.jsxs)("svg",{className:"h-5 w-5 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[(0,b.jsx)("circle",{className:"stroke-muted opacity-25",cx:"12",cy:"12",r:"10",strokeWidth:"4"}),(0,b.jsx)("path",{className:"fill-muted opacity-75",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})})})]})),(0,b.jsx)(_,{title:e,isOpen:D,onOpenChange:E,trigger:y,children:(0,b.jsxs)("div",{className:"relative flex h-full flex-col",children:[(0,b.jsx)(ae,{value:i,items:r,renderItem:p,onSearch:o,onChange:x,isLoading:s}),w]})})}var Ee=require("react");function tt(){let[t,e]=(0,Ee.useState)(null);return[t,r=>M(this,null,function*(){if(!("clipboard"in navigator))return console.warn("Clipboard not supported"),!1;try{return yield navigator.clipboard.writeText(r),e(r),!0}catch(s){return console.warn("Copy failed",s),e(null),!1}})]} | ||
"use strict";var Se=Object.create;var X=Object.defineProperty,Ve=Object.defineProperties,Ae=Object.getOwnPropertyDescriptor,je=Object.getOwnPropertyDescriptors,Me=Object.getOwnPropertyNames,K=Object.getOwnPropertySymbols,Fe=Object.getPrototypeOf,ee=Object.prototype.hasOwnProperty,ge=Object.prototype.propertyIsEnumerable;var ce=(t,e,i)=>e in t?X(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,v=(t,e)=>{for(var i in e||(e={}))ee.call(e,i)&&ce(t,i,e[i]);if(K)for(var i of K(e))ge.call(e,i)&&ce(t,i,e[i]);return t},L=(t,e)=>Ve(t,je(e));var I=(t,e)=>{var i={};for(var r in t)ee.call(t,r)&&e.indexOf(r)<0&&(i[r]=t[r]);if(t!=null&&K)for(var r of K(t))e.indexOf(r)<0&&ge.call(t,r)&&(i[r]=t[r]);return i};var Be=(t,e)=>{for(var i in e)X(t,i,{get:e[i],enumerable:!0})},de=(t,e,i,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Me(e))!ee.call(t,s)&&s!==i&&X(t,s,{get:()=>e[s],enumerable:!(r=Ae(e,s))||r.enumerable});return t};var T=(t,e,i)=>(i=t!=null?Se(Fe(t)):{},de(e||!t||!t.__esModule?X(i,"default",{value:t,enumerable:!0}):i,t)),Le=t=>de(X({},"__esModule",{value:!0}),t);var M=(t,e,i)=>new Promise((r,s)=>{var n=l=>{try{a(i.next(l))}catch(p){s(p)}},o=l=>{try{a(i.throw(l))}catch(p){s(p)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(n,o);a((i=i.apply(t,e)).next())});var it={};Be(it,{Avatar:()=>pe,AvatarFallback:()=>ue,AvatarImage:()=>fe,Badge:()=>he,Button:()=>ye,Callout:()=>Ye,Dialog:()=>_,Icon:()=>P,Input:()=>Z,SearchList:()=>ae,Select:()=>et,useCopyToClipboard:()=>tt,useDebounce:()=>oe});module.exports=Le(it);var W=T(require("react")),S=T(require("@radix-ui/react-avatar"));var we=T(require("clsx")),me=require("tailwind-merge"),H=(...t)=>(0,me.twMerge)((0,we.default)(...t));var G=require("react/jsx-runtime"),pe=W.forwardRef((r,i)=>{var s=r,{className:t}=s,e=I(s,["className"]);return(0,G.jsx)(S.Root,v({ref:i,className:H("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t)},e))});pe.displayName=S.Root.displayName;var fe=W.forwardRef((r,i)=>{var s=r,{className:t}=s,e=I(s,["className"]);return(0,G.jsx)(S.Image,v({ref:i,className:H("aspect-square h-full w-full",t)},e))});fe.displayName=S.Image.displayName;var ue=W.forwardRef((r,i)=>{var s=r,{className:t}=s,e=I(s,["className"]);return(0,G.jsx)(S.Fallback,v({ref:i,className:H("flex h-full w-full items-center justify-center rounded-full",t)},e))});ue.displayName=S.Fallback.displayName;var ve=T(require("clsx")),Y=require("react/jsx-runtime"),he=({children:t,className:e,intent:i="default",icon:r})=>(0,Y.jsxs)("div",{className:(0,ve.default)(e,"inline-flex items-center space-x-1 truncate rounded-lg px-2 py-0.5 text-xs",{"bg-primary text-white":i==="primary","bg-success text-white":i==="success","bg-danger text-white":i==="danger","bg-warning text-white":i==="warning","bg-info text-white":i==="info","bg-secondary text-muted":i==="default"}),children:[r,(0,Y.jsx)("div",{className:"flex-1 truncate",children:t})]});he.displayName="Badge";var xe=require("react");function O(){return O=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t},O.apply(this,arguments)}var c=require("react");var He=require("react");function Oe(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e)}function be(...t){return e=>t.forEach(i=>Oe(i,e))}var ie=(0,c.forwardRef)((t,e)=>{let o=t,{children:i}=o,r=I(o,["children"]),s=c.Children.toArray(i),n=s.find(Ke);if(n){let a=n.props.children,l=s.map(p=>p===n?c.Children.count(a)>1?c.Children.only(null):(0,c.isValidElement)(a)?a.props.children:null:p);return(0,c.createElement)(te,O({},r,{ref:e}),(0,c.isValidElement)(a)?(0,c.cloneElement)(a,void 0,l):null)}return(0,c.createElement)(te,O({},r,{ref:e}),i)});ie.displayName="Slot";var te=(0,c.forwardRef)((t,e)=>{let s=t,{children:i}=s,r=I(s,["children"]);return(0,c.isValidElement)(i)?(0,c.cloneElement)(i,L(v({},We(r,i.props)),{ref:e?be(e,i.ref):i.ref})):c.Children.count(i)>1?c.Children.only(null):null});te.displayName="SlotClone";var Xe=({children:t})=>(0,c.createElement)(c.Fragment,null,t);function Ke(t){return(0,c.isValidElement)(t)&&t.type===Xe}function We(t,e){let i=v({},e);for(let r in e){let s=t[r],n=e[r];/^on[A-Z]/.test(r)?s&&n?i[r]=(...a)=>{n(...a),s(...a)}:s&&(i[r]=s):r==="style"?i[r]=v(v({},s),n):r==="className"&&(i[r]=[s,n].filter(Boolean).join(" "))}return v(v({},t),i)}var q=T(require("clsx"));var N=require("react/jsx-runtime"),ye=(0,xe.forwardRef)((p,l)=>{var w=p,{children:t,appearance:e="primary",className:i,disabled:r,dataTest:s,isLoading:n,asChild:o}=w,a=I(w,["children","appearance","className","disabled","dataTest","isLoading","asChild"]);return(0,N.jsx)(o?ie:"button",L(v({ref:l,"data-test":s},a),{disabled:r||n,className:(0,q.default)(i,"relative inline-flex h-12 cursor-pointer items-center justify-center rounded-lg px-4 py-2 text-sm font-medium","focus-visible:ring-primary-500 pointer-events-auto focus:outline-none focus-visible:ring focus-visible:ring-opacity-75",{"bg-primary text-white enabled:hover:bg-opacity-90":e==="primary","bg-secondary text-secondary-foreground enabled:hover:bg-border":e==="default","bg-background text-foreground border border-solid":e==="outline","cursor-not-allowed bg-opacity-50":r,"cursor-wait bg-opacity-50":n}),children:o?t:(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)("div",{className:"flex-shrink basis-0"}),(0,N.jsx)("div",{className:"flex-1",children:t}),(0,N.jsx)("div",{className:"flex h-full flex-shrink basis-0 items-center justify-end",children:n&&(0,N.jsxs)("svg",{className:"h-5 w-5 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[(0,N.jsx)("circle",{className:(0,q.default)("opacity-25",{"stroke-muted":e==="default","stroke-white":e==="primary"}),cx:"12",cy:"12",r:"10",strokeWidth:"4"}),(0,N.jsx)("path",{className:(0,q.default)("opacity-75",{"fill-muted":e==="default","fill-white":e==="primary"}),d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})})]})}))});ye.displayName="Button";var j=require("@fortawesome/free-solid-svg-icons"),re=T(require("clsx"));var Ne=require("react");var F=require("react/jsx-runtime"),Ge={xs:"h-3 w-3",sm:"h-4 w-4",default:"h-5 w-5",lg:"h-6 w-6"},P=(0,Ne.forwardRef)(function(e,i){let f=e,{icon:r,children:s,className:n,fixedWidth:o,spin:a,size:l}=f,p=I(f,["icon","children","className","fixedWidth","spin","size"]),{prefix:w,iconName:D,icon:E}=r,[x,R,y,$,V]=E,C=`${w}-${D}`,g=Ge[l||"default"];return(0,F.jsxs)("svg",L(v({ref:i,viewBox:`0 0 ${x} ${R}`,xmlns:"http://www.w3.org/2000/svg",role:"img","aria-hidden":"true","data-fa":C,className:H(n,g,"svg-inline--fa fill-current",C,{"fa-spin":!!a,"fa-fw":!!o})},p),{children:[s,Array.isArray(V)?(0,F.jsxs)("g",{children:[(0,F.jsx)("path",{d:V[0]}),(0,F.jsx)("path",{d:V[1]})]}):(0,F.jsx)("path",{d:V})]}))});P.displayName="Icon";var A=require("react/jsx-runtime"),Ye=({className:t,intent:e,title:i,description:r})=>(0,A.jsxs)("div",{className:(0,re.default)(t,"flex items-start space-x-4 rounded-xl px-4 py-2 text-base",{"bg-border":!e,"bg-blue-200":e==="info","bg-green-200":e==="success","bg-red-200":e==="danger","bg-amber-200":e==="warning"}),children:[(0,A.jsx)("div",{className:(0,re.default)("h-full py-1 text-lg",{"text-info":e==="info","text-success":e==="success","text-danger":e==="danger","text-warning":e==="warning"}),children:(0,A.jsx)(P,{className:"h-6 w-6",icon:qe[e||"info"]})}),(0,A.jsxs)("div",{children:[(0,A.jsx)("div",{className:"text-lg font-bold",children:i}),(0,A.jsx)("div",{className:"text-sm",children:r})]})]}),qe={info:j.faInfoCircle,success:j.faCircleCheck,danger:j.faExclamationCircle,warning:j.faTriangleExclamation};var ke=require("react"),Re=require("@fortawesome/free-solid-svg-icons"),se=require("@headlessui/react"),u=T(require("@radix-ui/react-dialog")),ne=T(require("clsx"));var h=require("react/jsx-runtime");function _e(){return typeof window!="undefined"?window.document.getElementById("swing"):void 0}var _=({isOpen:t,onOpenChange:e,shouldCloseOnInteractOutside:i=!0,title:r,children:s,trigger:n,description:o})=>{var a;return(0,h.jsxs)(u.Root,{open:t,onOpenChange:e,modal:!1,children:[n&&(0,h.jsx)(u.Trigger,{asChild:!0,children:n}),(0,h.jsx)(u.Portal,{container:(a=_e())==null?void 0:a.firstElementChild,children:(0,h.jsxs)(se.Transition,{show:t,children:[(0,h.jsx)(u.Overlay,{forceMount:!0,className:"bg-background/80 data-[state=closed]:animate-out data-[state=closed]:fade-out data-[state=open]:fade-in fixed inset-0 z-40 rounded-xl transition-all duration-100"}),(0,h.jsx)(se.Transition.Child,{as:ke.Fragment,enter:"ease-in duration-300",enterFrom:"opacity-0 translate-y-full",enterTo:"opacity-100 translate-y-0",leave:"ease-out duration-400",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 translate-y-full",children:(0,h.jsxs)(u.Content,{forceMount:!0,className:(0,ne.default)("fixed bottom-0 left-0 right-0 top-12 z-50 border-t","w-full overflow-hidden rounded-xl","bg-background focus:outline-none focus-visible:ring focus-visible:ring-blue-500 focus-visible:ring-opacity-75","flex flex-col"),onInteractOutside:i?void 0:l=>{l.preventDefault()},children:[(0,h.jsxs)(u.Title,{className:"text-foreground relative flex px-4 py-3 text-base font-bold",children:[(0,h.jsx)("div",{className:"flex-1",children:r}),(0,h.jsx)(u.Close,{className:(0,ne.default)("text-muted text-base","inline-flex items-center justify-center rounded-full p-1","focus:outline-none focus-visible:ring focus-visible:ring-blue-500 focus-visible:ring-opacity-75"),"data-test":"dialog-close",tabIndex:-1,children:(0,h.jsx)(P,{size:"sm",icon:Re.faClose})})]}),o&&(0,h.jsx)(u.Description,{className:"text-muted mt-2 text-sm font-normal"}),t&&(0,h.jsx)("div",{className:"h-full flex-1 overflow-hidden",children:s})]})})]})})]})};_.displayName="Dialog";var Ce=require("react"),U=T(require("clsx")),k=require("react/jsx-runtime"),Z=(0,Ce.forwardRef)(function({value:e,onChange:i,onBlur:r,onKeyDown:s,subtext:n,readOnly:o,placeholder:a,className:l,dataTest:p,type:w,min:D,lang:E,error:x,autoFocus:R,isLoading:y,icon:$},V){return(0,k.jsxs)("div",{className:(0,U.default)(l,"relative rounded-xl border-2",{"focus-within:ring-0":o,"focus-within:ring focus-within:ring-blue-500":!x,"ring ring-rose-500 focus-within:ring focus-within:ring-rose-500":!!x}),children:[$&&(0,k.jsx)("div",{className:"absolute inset-y-0 left-0",children:(0,k.jsx)("div",{className:"text-muted flex h-full items-center justify-center pl-4",children:$})}),(0,k.jsx)("input",{ref:V,type:w!=null?w:"text",className:(0,U.default)("inline-block h-full w-full truncate rounded-xl bg-transparent px-7 outline-none",{"pl-12":!!$,"text-muted pr-12":y}),value:e,onChange:!y&&i?C=>{i(C.currentTarget.value)}:void 0,onBlur:r?C=>{r(C.currentTarget.value)}:void 0,onKeyDown:s?C=>{s(C)}:void 0,placeholder:a,readOnly:o,disabled:o,"data-test":p,min:D,lang:E,autoFocus:R}),(x||n)&&(0,k.jsx)("div",{className:(0,U.default)("absolute bottom-2 left-7 truncate text-[10px] text-xs",{"text-danger":!!x,"text-muted":!!n}),children:x||n}),y&&(0,k.jsx)("div",{className:"absolute inset-y-0 right-0",children:(0,k.jsx)("div",{className:"text-muted flex h-full items-center justify-center pr-4",children:(0,k.jsxs)("svg",{className:"h-5 w-5 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[(0,k.jsx)("circle",{className:"stroke-muted opacity-25",cx:"12",cy:"12",r:"10",strokeWidth:"4"}),(0,k.jsx)("path",{className:"fill-muted opacity-75",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})})})]})});Z.displayName="Input";var d=require("react"),Q=require("@fortawesome/free-solid-svg-icons"),Ie=require("@tanstack/react-virtual"),Te=T(require("clsx")),z=require("jotai");var J=require("react");function oe(t,e){let[i,r]=(0,J.useState)(t);return(0,J.useEffect)(()=>{let s=setTimeout(()=>{r(t)},e||500);return()=>{clearTimeout(s)}},[t,e]),i}var m=require("react/jsx-runtime"),Pe=(0,z.atom)(""),$e=(0,z.atom)(-1);function ae({value:t,items:e,isLoading:i,searchPlaceholder:r,onChange:s,onSearch:n,renderItem:o}){return(0,m.jsxs)(m.Fragment,{children:[n&&(0,m.jsx)(Ue,{placeholder:r}),(0,m.jsx)(Qe,{value:t,items:e,onSearch:n,onChange:s,renderItem:o}),i&&(0,m.jsx)("div",{className:"bg-background absolute inset-0 z-10 flex h-full w-full items-center justify-center bg-opacity-70",children:(0,m.jsx)(P,{className:"text-muted",icon:Q.faCircleNotch,size:"lg",spin:!0})})]})}var Ue=({placeholder:t})=>{let e=(0,d.useRef)(null),[i,r]=(0,d.useState)(""),s=oe(i,200),n=(0,z.useSetAtom)(Pe),o=(0,z.useSetAtom)($e);(0,d.useEffect)(()=>{var l;return(l=e.current)==null||l.focus(),n(""),()=>{n(""),o(-1)}},[n,o]),(0,d.useEffect)(()=>{n(s)},[s,n]);let a=(0,d.useCallback)(l=>{l.code==="ArrowDown"&&o(0)},[o]);return(0,m.jsx)("div",{className:"relative z-10 mx-4 mt-2",children:(0,m.jsx)(Z,{ref:e,className:"h-12 bg-transparent",dataTest:"select-search-input",placeholder:t||"Search...",value:i,onChange:l=>{r(l),o(-1)},onKeyDown:a,autoFocus:!0,icon:(0,m.jsx)(P,{icon:Q.faMagnifyingGlass})})})};function Ze({value:t,items:e,onChange:i,onSearch:r,renderItem:s}){var C;let n=(0,z.useAtomValue)(Pe),[o,a]=(0,z.useAtom)($e),l=(0,d.useRef)([]),p=(0,d.useRef)(null),w=(0,d.useMemo)(()=>r&&n?e.filter(g=>r(g,n)):e,[e,n,r]),D=typeof t!="undefined"?w.indexOf(t):-1,[E,x]=(0,d.useState)(null),R=(0,Ie.useVirtualizer)({count:w.length,getScrollElement:()=>p.current,estimateSize:()=>60,overscan:5,getItemKey:g=>`${String(e[g])}-${g}`}),y=(0,d.useCallback)(g=>M(this,null,function*(){let f=i(g);f instanceof Promise&&(x(g),yield f,x(null)),a(-1)}),[i,a]),$=(0,d.useCallback)(g=>{if(g.code==="ArrowUp")a(o?o-1:w.length-1);else if(g.code==="ArrowDown")a(o===w.length-1?0:o+1);else if(g.code==="Enter"){let f=w[o];f&&y(f)}},[a,y,o,w]);(0,d.useEffect)(()=>{var g;(g=l.current[o])==null||g.focus()},[o]),(0,d.useEffect)(()=>{a(D)},[D,a]);let V=R.getVirtualItems();return(0,m.jsx)("div",{className:"flex-1 px-4",ref:p,style:{height:400,overflow:"auto"},children:(0,m.jsx)("div",{className:"relative w-full",style:{height:`${R.getTotalSize()}px`},children:(0,m.jsx)("div",{className:"pb-4",style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${(C=V[0])==null?void 0:C.start}px)`},children:R.getVirtualItems().map(g=>{let f=w[g.index];return(0,m.jsx)("div",{"data-index":g.index,ref:R.measureElement,"data-test":"select-item",children:(0,m.jsx)("div",{tabIndex:0,onClick:()=>M(this,null,function*(){typeof f!="undefined"&&(yield y(f))}),onKeyDown:$,ref:le=>{le&&(l.current[g.index]=le)},className:(0,Te.default)("bg-background hover:bg-accent mt-2.5 cursor-pointer space-x-2 rounded-xl border px-3 outline-none focus:ring focus:ring-blue-500",{"bg-secondary":t===f}),children:(0,m.jsx)("div",{className:"flex items-center justify-start text-sm",children:typeof f!="undefined"?s(f,t===f,{isLoading:E===f}):null})})},g.key)})})})})}var Je=d.memo,Qe=Je(Ze);var B=require("react"),ze=require("@fortawesome/free-solid-svg-icons"),De=T(require("clsx"));var b=require("react/jsx-runtime");function et({className:t,title:e,value:i,items:r,isLoading:s,onChange:n,onSearch:o,renderTrigger:a,trigger:l,renderItem:p,children:w}){let[D,E]=(0,B.useState)(!1),x=(0,B.useCallback)($=>M(this,null,function*(){yield n($),E(!1)}),[n]),R=(0,B.useCallback)($=>{$.preventDefault(),r.length&&E(!0)},[r]),y;return l?y=(0,B.cloneElement)(l,{onClick:R}):a&&(y=(0,b.jsxs)("button",{className:(0,De.default)("bg-background relative flex h-16 items-center space-x-2 rounded-xl border-2 px-4 py-3 text-left outline-none focus:ring focus:ring-blue-500",t),onClick:R,children:[(0,b.jsx)("div",{className:"flex-1 truncate",children:a(i)}),!s&&r.length>0&&(0,b.jsx)(P,{className:"text-muted",icon:ze.faCaretDown,size:"sm"}),s&&(0,b.jsx)("div",{className:"absolute inset-y-0 right-0",children:(0,b.jsx)("div",{className:"text-muted flex h-full items-center justify-center pr-4",children:(0,b.jsxs)("svg",{className:"h-5 w-5 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[(0,b.jsx)("circle",{className:"stroke-muted opacity-25",cx:"12",cy:"12",r:"10",strokeWidth:"4"}),(0,b.jsx)("path",{className:"fill-muted opacity-75",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})})})]})),(0,b.jsx)(_,{title:e,isOpen:D,onOpenChange:E,trigger:y,children:(0,b.jsxs)("div",{className:"relative flex h-full flex-col",children:[(0,b.jsx)(ae,{value:i,items:r,renderItem:p,onSearch:o,onChange:x,isLoading:s}),w]})})}var Ee=require("react");function tt(){let[t,e]=(0,Ee.useState)(null);return[t,r=>M(this,null,function*(){if(!("clipboard"in navigator))return console.warn("Clipboard not supported"),!1;try{return yield navigator.clipboard.writeText(r),e(r),!0}catch(s){return console.warn("Copy failed",s),e(null),!1}})]} | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@swing.xyz/design-system", | ||
"version": "0.49.1", | ||
"version": "0.49.2", | ||
"publishConfig": { | ||
@@ -5,0 +5,0 @@ "access": "public" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
135983