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