docthub-core-components 1.0.60 → 1.0.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js
CHANGED
|
@@ -179,7 +179,7 @@
|
|
|
179
179
|
|
|
180
180
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
181
181
|
|
|
182
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return d.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},_1="DialogDescriptionWarning",P1=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Ju(_1).contentName}}.`;return d.useEffect(()=>{var a;const o=(a=e.current)==null?void 0:a.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},ls=Fu,ed=Bu,us=zu,yo=Hu,wo=Uu,ds=qu,fs=Ku,ms=Zu,Fn='[cmdk-group=""]',Zo='[cmdk-group-items=""]',A1='[cmdk-group-heading=""]',td='[cmdk-item=""]',Li=`${td}:not([aria-disabled="true"])`,Na="cmdk-item-select",gn="data-value",I1=(e,t,n)=>m1(e,t,n),nd=d.createContext(void 0),pr=()=>d.useContext(nd),rd=d.createContext(void 0),ps=()=>d.useContext(rd),od=d.createContext(void 0),ad=d.forwardRef((e,t)=>{let n=vn(()=>{var T,$;return{search:"",value:($=(T=e.value)!=null?T:e.defaultValue)!=null?$:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=vn(()=>new Set),o=vn(()=>new Map),a=vn(()=>new Map),i=vn(()=>new Set),s=sd(e),{label:c,children:u,value:f,onValueChange:l,filter:p,shouldFilter:h,loop:b,disablePointerSelection:g=!1,vimBindings:v=!0,...y}=e,w=_e(),C=_e(),D=_e(),E=d.useRef(null),R=G1();rn(()=>{if(f!==void 0){let T=f.trim();n.current.value=T,S.emit()}},[f]),rn(()=>{R(6,B)},[]);let S=d.useMemo(()=>({subscribe:T=>(i.current.add(T),()=>i.current.delete(T)),snapshot:()=>n.current,setState:(T,$,z)=>{var U,V,F,X;if(!Object.is(n.current[T],$)){if(n.current[T]=$,T==="search")q(),j(),R(1,L);else if(T==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let Z=document.getElementById(D);Z?Z.focus():(U=document.getElementById(w))==null||U.focus()}if(R(7,()=>{var Z;n.current.selectedItemId=(Z=P())==null?void 0:Z.id,S.emit()}),z||R(5,B),((V=s.current)==null?void 0:V.value)!==void 0){let Z=$??"";(X=(F=s.current).onValueChange)==null||X.call(F,Z);return}}S.emit()}},emit:()=>{i.current.forEach(T=>T())}}),[]),k=d.useMemo(()=>({value:(T,$,z)=>{var U;$!==((U=a.current.get(T))==null?void 0:U.value)&&(a.current.set(T,{value:$,keywords:z}),n.current.filtered.items.set(T,I($,z)),R(2,()=>{j(),S.emit()}))},item:(T,$)=>(r.current.add(T),$&&(o.current.has($)?o.current.get($).add(T):o.current.set($,new Set([T]))),R(3,()=>{q(),j(),n.current.value||L(),S.emit()}),()=>{a.current.delete(T),r.current.delete(T),n.current.filtered.items.delete(T);let z=P();R(4,()=>{q(),(z==null?void 0:z.getAttribute("id"))===T&&L(),S.emit()})}),group:T=>(o.current.has(T)||o.current.set(T,new Set),()=>{a.current.delete(T),o.current.delete(T)}),filter:()=>s.current.shouldFilter,label:c||e["aria-label"],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:w,inputId:D,labelId:C,listInnerRef:E}),[]);function I(T,$){var z,U;let V=(U=(z=s.current)==null?void 0:z.filter)!=null?U:I1;return T?V(T,n.current.search,$):0}function j(){if(!n.current.search||s.current.shouldFilter===!1)return;let T=n.current.filtered.items,$=[];n.current.filtered.groups.forEach(U=>{let V=o.current.get(U),F=0;V.forEach(X=>{let Z=T.get(X);F=Math.max(Z,F)}),$.push([U,F])});let z=E.current;O().sort((U,V)=>{var F,X;let Z=U.getAttribute("id"),Q=V.getAttribute("id");return((F=T.get(Q))!=null?F:0)-((X=T.get(Z))!=null?X:0)}).forEach(U=>{let V=U.closest(Zo);V?V.appendChild(U.parentElement===V?U:U.closest(`${Zo} > *`)):z.appendChild(U.parentElement===z?U:U.closest(`${Zo} > *`))}),$.sort((U,V)=>V[1]-U[1]).forEach(U=>{var V;let F=(V=E.current)==null?void 0:V.querySelector(`${Fn}[${gn}="${encodeURIComponent(U[0])}"]`);F==null||F.parentElement.appendChild(F)})}function L(){let T=O().find(z=>z.getAttribute("aria-disabled")!=="true"),$=T==null?void 0:T.getAttribute(gn);S.setState("value",$||void 0)}function q(){var T,$,z,U;if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let V=0;for(let F of r.current){let X=($=(T=a.current.get(F))==null?void 0:T.value)!=null?$:"",Z=(U=(z=a.current.get(F))==null?void 0:z.keywords)!=null?U:[],Q=I(X,Z);n.current.filtered.items.set(F,Q),Q>0&&V++}for(let[F,X]of o.current)for(let Z of X)if(n.current.filtered.items.get(Z)>0){n.current.filtered.groups.add(F);break}n.current.filtered.count=V}function B(){var T,$,z;let U=P();U&&(((T=U.parentElement)==null?void 0:T.firstChild)===U&&((z=($=U.closest(Fn))==null?void 0:$.querySelector(A1))==null||z.scrollIntoView({block:"nearest"})),U.scrollIntoView({block:"nearest"}))}function P(){var T;return(T=E.current)==null?void 0:T.querySelector(`${td}[aria-selected="true"]`)}function O(){var T;return Array.from(((T=E.current)==null?void 0:T.querySelectorAll(Li))||[])}function M(T){let $=O()[T];$&&S.setState("value",$.getAttribute(gn))}function A(T){var $;let z=P(),U=O(),V=U.findIndex(X=>X===z),F=U[V+T];($=s.current)!=null&&$.loop&&(F=V+T<0?U[U.length-1]:V+T===U.length?U[0]:U[V+T]),F&&S.setState("value",F.getAttribute(gn))}function N(T){let $=P(),z=$==null?void 0:$.closest(Fn),U;for(;z&&!U;)z=T>0?H1(z,Fn):U1(z,Fn),U=z==null?void 0:z.querySelector(Li);U?S.setState("value",U.getAttribute(gn)):A(T)}let _=()=>M(O().length-1),Y=T=>{T.preventDefault(),T.metaKey?_():T.altKey?N(1):A(1)},H=T=>{T.preventDefault(),T.metaKey?M(0):T.altKey?N(-1):A(-1)};return d.createElement(J.div,{ref:t,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:T=>{var $;($=y.onKeyDown)==null||$.call(y,T);let z=T.nativeEvent.isComposing||T.keyCode===229;if(!(T.defaultPrevented||z))switch(T.key){case"n":case"j":{v&&T.ctrlKey&&Y(T);break}case"ArrowDown":{Y(T);break}case"p":case"k":{v&&T.ctrlKey&&H(T);break}case"ArrowUp":{H(T);break}case"Home":{T.preventDefault(),M(0);break}case"End":{T.preventDefault(),_();break}case"Enter":{T.preventDefault();let U=P();if(U){let V=new Event(Na);U.dispatchEvent(V)}}}}},d.createElement("label",{"cmdk-label":"",htmlFor:k.inputId,id:k.labelId,style:V1},c),xo(e,T=>d.createElement(rd.Provider,{value:S},d.createElement(nd.Provider,{value:k},T))))}),j1=d.forwardRef((e,t)=>{var n,r;let o=_e(),a=d.useRef(null),i=d.useContext(od),s=pr(),c=sd(e),u=(r=(n=c.current)==null?void 0:n.forceMount)!=null?r:i==null?void 0:i.forceMount;rn(()=>{if(!u)return s.item(o,i==null?void 0:i.id)},[u]);let f=id(o,a,[e.value,e.children,a],e.keywords),l=ps(),p=Yt(R=>R.value&&R.value===f.current),h=Yt(R=>u||s.filter()===!1?!0:R.search?R.filtered.items.get(o)>0:!0);d.useEffect(()=>{let R=a.current;if(!(!R||e.disabled))return R.addEventListener(Na,b),()=>R.removeEventListener(Na,b)},[h,e.onSelect,e.disabled]);function b(){var R,S;g(),(S=(R=c.current).onSelect)==null||S.call(R,f.current)}function g(){l.setState("value",f.current,!0)}if(!h)return null;let{disabled:v,value:y,onSelect:w,forceMount:C,keywords:D,...E}=e;return d.createElement(J.div,{ref:kt(a,t),...E,id:o,"cmdk-item":"",role:"option","aria-disabled":!!v,"aria-selected":!!p,"data-disabled":!!v,"data-selected":!!p,onPointerMove:v||s.getDisablePointerSelection()?void 0:g,onClick:v?void 0:b},e.children)}),$1=d.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:o,...a}=e,i=_e(),s=d.useRef(null),c=d.useRef(null),u=_e(),f=pr(),l=Yt(h=>o||f.filter()===!1?!0:h.search?h.filtered.groups.has(i):!0);rn(()=>f.group(i),[]),id(i,s,[e.value,e.heading,c]);let p=d.useMemo(()=>({id:i,forceMount:o}),[o]);return d.createElement(J.div,{ref:kt(s,t),...a,"cmdk-group":"",role:"presentation",hidden:l?void 0:!0},n&&d.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:u},n),xo(e,h=>d.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?u:void 0},d.createElement(od.Provider,{value:p},h))))}),L1=d.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,o=d.useRef(null),a=Yt(i=>!i.search);return!n&&!a?null:d.createElement(J.div,{ref:kt(o,t),...r,"cmdk-separator":"",role:"separator"})}),F1=d.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,o=e.value!=null,a=ps(),i=Yt(u=>u.search),s=Yt(u=>u.selectedItemId),c=pr();return d.useEffect(()=>{e.value!=null&&a.setState("search",e.value)},[e.value]),d.createElement(J.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:"text",value:o?e.value:i,onChange:u=>{o||a.setState("search",u.target.value),n==null||n(u.target.value)}})}),W1=d.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...o}=e,a=d.useRef(null),i=d.useRef(null),s=Yt(u=>u.selectedItemId),c=pr();return d.useEffect(()=>{if(i.current&&a.current){let u=i.current,f=a.current,l,p=new ResizeObserver(()=>{l=requestAnimationFrame(()=>{let h=u.offsetHeight;f.style.setProperty("--cmdk-list-height",h.toFixed(1)+"px")})});return p.observe(u),()=>{cancelAnimationFrame(l),p.unobserve(u)}}},[]),d.createElement(J.div,{ref:kt(a,t),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},xo(e,u=>d.createElement("div",{ref:kt(i,c.listInnerRef),"cmdk-list-sizer":""},u)))}),B1=d.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:o,contentClassName:a,container:i,...s}=e;return d.createElement(ls,{open:n,onOpenChange:r},d.createElement(us,{container:i},d.createElement(yo,{"cmdk-overlay":"",className:o}),d.createElement(wo,{"aria-label":e.label,"cmdk-dialog":"",className:a},d.createElement(ad,{ref:t,...s}))))}),Y1=d.forwardRef((e,t)=>Yt(n=>n.filtered.count===0)?d.createElement(J.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),z1=d.forwardRef((e,t)=>{let{progress:n,children:r,label:o="Loading...",...a}=e;return d.createElement(J.div,{ref:t,...a,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},xo(e,i=>d.createElement("div",{"aria-hidden":!0},i)))}),ze=Object.assign(ad,{List:W1,Item:j1,Input:F1,Group:$1,Separator:L1,Dialog:B1,Empty:Y1,Loading:z1});function H1(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function U1(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function sd(e){let t=d.useRef(e);return rn(()=>{t.current=e}),t}var rn=typeof window>"u"?d.useEffect:d.useLayoutEffect;function vn(e){let t=d.useRef();return t.current===void 0&&(t.current=e()),t}function Yt(e){let t=ps(),n=()=>e(t.snapshot());return d.useSyncExternalStore(t.subscribe,n,n)}function id(e,t,n,r=[]){let o=d.useRef(),a=pr();return rn(()=>{var i;let s=(()=>{var u;for(let f of n){if(typeof f=="string")return f.trim();if(typeof f=="object"&&"current"in f)return f.current?(u=f.current.textContent)==null?void 0:u.trim():o.current}})(),c=r.map(u=>u.trim());a.value(e,s,c),(i=t.current)==null||i.setAttribute(gn,s),o.current=s}),o}var G1=()=>{let[e,t]=d.useState(),n=vn(()=>new Map);return rn(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,o)=>{n.current.set(r,o),t({})}};function q1(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function xo({asChild:e,children:t},n){return e&&d.isValidElement(t)?d.cloneElement(q1(t),{ref:t.ref},n(t.props.children)):n(t)}var V1={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const K1=ls,X1=ed,Z1=us,Q1=ms,cd=d.forwardRef(({className:e,...t},n)=>m.jsx(yo,{ref:n,className:W("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));cd.displayName=yo.displayName;const ld=d.forwardRef(({className:e,children:t,...n},r)=>m.jsxs(Z1,{children:[m.jsx(cd,{}),m.jsxs(wo,{ref:r,className:W("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...n,children:[t,m.jsxs(ms,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[m.jsx(kn,{className:"h-4 w-4"}),m.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));ld.displayName=wo.displayName;const ud=({className:e,...t})=>m.jsx("div",{className:W("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});ud.displayName="DialogHeader";const dd=({className:e,...t})=>m.jsx("div",{className:W("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});dd.displayName="DialogFooter";const fd=d.forwardRef(({className:e,...t},n)=>m.jsx(ds,{ref:n,className:W("text-lg font-semibold leading-none tracking-tight",e),...t}));fd.displayName=ds.displayName;const md=d.forwardRef(({className:e,...t},n)=>m.jsx(fs,{ref:n,className:W("text-sm text-muted-foreground",e),...t}));md.displayName=fs.displayName;const J1=d.forwardRef(({className:e,...t},n)=>m.jsx(ze,{ref:n,className:W("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));J1.displayName=ze.displayName;const pd=d.forwardRef(({className:e,...t},n)=>m.jsxs("div",{className:"flex items-center h-auto px-3","cmdk-input-wrapper":"",children:[m.jsx(Dc,{strokeWidth:1.25,className:"mr-2 h-4 w-4 shrink-0"}),m.jsx(ze.Input,{ref:n,className:W("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-gray-400 disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));pd.displayName=ze.Input.displayName;const hd=d.forwardRef(({className:e,...t},n)=>m.jsx(ze.List,{ref:n,className:W("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));hd.displayName=ze.List.displayName;const eS=d.forwardRef((e,t)=>m.jsx(ze.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));eS.displayName=ze.Empty.displayName;const gd=d.forwardRef(({className:e,...t},n)=>m.jsx(ze.Group,{ref:n,className:W("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));gd.displayName=ze.Group.displayName;const tS=d.forwardRef(({className:e,...t},n)=>m.jsx(ze.Separator,{ref:n,className:W("-mx-1 h-px bg-border",e),...t}));tS.displayName=ze.Separator.displayName;const vd=d.forwardRef(({className:e,...t},n)=>m.jsx(ze.Item,{ref:n,className:W("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e),...t}));vd.displayName=ze.Item.displayName;function nS({className:e,...t}){return m.jsx("div",{className:W("animate-pulse rounded-md bg-muted",e),...t})}function rS(e="medium",t="white"){const n={small:"text-sm py-1 px-2 h-8",medium:"text-base py-2 px-3 h-10",large:"text-lg py-3 px-4 h-12"},r={white:"bg-background text-foreground border-border",grey:"bg-muted text-muted-foreground border-border"};return{sizeClasses:n[e],variantClasses:r[t],combined:`${n[e]} ${r[t]}`}}const oS=({options:e,placeholder:t,emptyMessage:n,value:r,onValueChange:o,disabled:a,isLoading:i=!1,className:s,size:c,variant:u})=>{const{variantClasses:f,combined:l}=rS(c,u),p=x.useRef(null),[h,b]=x.useState(!1),[g,v]=x.useState(r),[y,w]=x.useState((r==null?void 0:r.label)||""),C=x.useCallback(R=>{const S=p.current;if(S){if(h||b(!0),R.key==="Enter"&&S.value!==""){const k=e.find(I=>I.label===S.value);k&&(v(k),o==null||o(k))}R.key==="Escape"&&S.blur()}},[h,e,o]),D=x.useCallback(()=>{b(!1),w((g==null?void 0:g.label)||"")},[g]),E=x.useCallback(R=>{w(R.label),v(R),o==null||o(R),setTimeout(()=>{var S;(S=p==null?void 0:p.current)==null||S.blur()},0)},[o]);return m.jsxs(ze,{onKeyDown:C,children:[m.jsxs("div",{className:W("rounded-full border bg-gray-100",f,s),children:[" ",m.jsx(pd,{ref:p,value:y,onValueChange:i?void 0:w,onBlur:D,onFocus:()=>b(!0),placeholder:t,disabled:a,className:l})]}),m.jsx("div",{className:"relative mt-1",children:m.jsx("div",{className:W("animate-in fade-in-0 zoom-in-95 absolute top-0 z-10 w-full rounded-xl bg-white dark:bg-gray-800 outline-none",h?"block":"hidden",s),children:m.jsxs(hd,{className:"rounded-lg ring-1 ring-slate-200 dark:ring-gray-700",children:[i?m.jsx(ze.Loading,{children:m.jsx("div",{className:"p-1",children:m.jsx(nS,{className:"h-8 w-full"})})}):null,e.length>0&&!i?m.jsx(gd,{children:e.map(R=>{const S=(g==null?void 0:g.value)===R.value;return m.jsxs(vd,{value:R.label,onMouseDown:k=>{k.preventDefault(),k.stopPropagation()},onSelect:()=>E(R),className:W("flex w-full items-center gap-2 dark:text-white",S?null:"pl-8"),children:[S?m.jsx(er,{className:"w-4"}):null,R.label]},R.value)})}):null,i?null:m.jsx(ze.Empty,{className:"select-none rounded-sm px-2 py-3 text-center text-sm dark:text-gray-400",children:n})]})})})]})},aS=to("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function sS({className:e,variant:t,...n}){return m.jsx("div",{className:W(aS({variant:t}),e),...n})}function iS({title:e,children:t,className:n}){return m.jsxs("section",{className:W("space-y-6",n),children:[m.jsx("div",{className:"border-b border-gray-200 pb-3",children:m.jsx("h2",{className:"text-sm font-semibold text-gray-900 tracking-wide uppercase",children:e})}),t]})}function cS({title:e,variant:t="primary",children:n,className:r}){return m.jsxs("div",{className:W("space-y-4",r),children:[m.jsx(sS,{variant:t==="primary"?"default":"secondary",className:W(t==="primary"&&"bg-black text-white hover:bg-black/90"),children:e}),n]})}const bd=x.forwardRef(({className:e,label:t,helperText:n,error:r,startAdornment:o,endAdornment:a,required:i,id:s,onInput:c,...u},f)=>{const l=!!r,p=s||`currency-input-${Math.random().toString(36).substr(2,9)}`,h=b=>{var w;const g=b.currentTarget;let v=g.value;v=v.replace(/[^0-9.]/g,"");const y=v.split(".");y.length>2&&(v=y[0]+"."+y.slice(1).join("")),((w=y[1])==null?void 0:w.length)>2&&(v=y[0]+"."+y[1].substring(0,2)),g.value=v,c&&c(b)};return m.jsxs("div",{className:"flex flex-col space-y-1",children:[t&&m.jsxs("label",{htmlFor:p,className:"text-sm font-medium text-gray-700",children:[t,i&&m.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),m.jsxs("div",{className:W("flex items-center h-10 w-full rounded-md border bg-background text-sm ring-offset-background disabled:cursor-not-allowed disabled:opacity-50",l?"border-destructive":"border-input",e),children:[o&&m.jsx("span",{className:"px-3 text-sm text-muted-foreground",children:o}),m.jsx("input",{id:p,type:"text",inputMode:"decimal",pattern:"^\\d+(\\.\\d{0,2})?$",className:W("flex-1 px-3 py-2 rounded-md placeholder:text-muted-foreground focus:outline-none disabled:opacity-50"),ref:f,onInput:h,...u}),a&&m.jsx("span",{className:"px-3 text-sm text-muted-foreground",children:a})]}),(n||r)&&m.jsx("span",{className:W("text-xs",l?"text-red-500":"text-muted-foreground"),children:r||n})]})});bd.displayName="CurrencyInput";const lS={small:"h-8 text-xs px-2",medium:"h-10 text-sm px-3",large:"h-12 text-base px-4"},uS={outlined:"border border-input",filled:"border-0 bg-accent",standard:"border-0 border-b border-input rounded-none"},dS=(e,t)=>t&&typeof e=="object"&&e!==null?e[t.text]:typeof e=="string"?e:(e==null?void 0:e.label)||"",fS=(e,t)=>t&&typeof e=="object"&&e!==null?e[t.value]:typeof e=="string"?e:(e==null?void 0:e.value)||e,mS=(e,t,n,r)=>n(e,r)===n(t,r),pS=(e,t,n,r)=>{if(!t)return e;const o=t.toLowerCase();return e.filter(a=>n(a,r).toLowerCase().includes(o))},yd=x.memo(({className:e="",variant:t="default",children:n,...r})=>{const o={default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground border-border bg-background hover:bg-accent hover:text-accent-foreground"};return m.jsx("div",{className:`inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 ${o[t]} ${e}`,...r,children:n})});yd.displayName="Badge";const wd=e=>{const{option:t,index:n,isSelected:r,isHighlighted:o,onSelect:a,getOptionLabel:i,renderOption:s}=e,c=x.useCallback(()=>{a(t)},[t,a]);return m.jsx("div",{onClick:c,className:`
|
|
182
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return d.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},_1="DialogDescriptionWarning",P1=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Ju(_1).contentName}}.`;return d.useEffect(()=>{var a;const o=(a=e.current)==null?void 0:a.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},ls=Fu,ed=Bu,us=zu,yo=Hu,wo=Uu,ds=qu,fs=Ku,ms=Zu,Fn='[cmdk-group=""]',Zo='[cmdk-group-items=""]',A1='[cmdk-group-heading=""]',td='[cmdk-item=""]',Li=`${td}:not([aria-disabled="true"])`,Na="cmdk-item-select",gn="data-value",I1=(e,t,n)=>m1(e,t,n),nd=d.createContext(void 0),pr=()=>d.useContext(nd),rd=d.createContext(void 0),ps=()=>d.useContext(rd),od=d.createContext(void 0),ad=d.forwardRef((e,t)=>{let n=vn(()=>{var T,$;return{search:"",value:($=(T=e.value)!=null?T:e.defaultValue)!=null?$:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=vn(()=>new Set),o=vn(()=>new Map),a=vn(()=>new Map),i=vn(()=>new Set),s=sd(e),{label:c,children:u,value:f,onValueChange:l,filter:p,shouldFilter:h,loop:b,disablePointerSelection:g=!1,vimBindings:v=!0,...y}=e,w=_e(),C=_e(),D=_e(),E=d.useRef(null),R=G1();rn(()=>{if(f!==void 0){let T=f.trim();n.current.value=T,S.emit()}},[f]),rn(()=>{R(6,B)},[]);let S=d.useMemo(()=>({subscribe:T=>(i.current.add(T),()=>i.current.delete(T)),snapshot:()=>n.current,setState:(T,$,z)=>{var U,V,F,X;if(!Object.is(n.current[T],$)){if(n.current[T]=$,T==="search")q(),j(),R(1,L);else if(T==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let Z=document.getElementById(D);Z?Z.focus():(U=document.getElementById(w))==null||U.focus()}if(R(7,()=>{var Z;n.current.selectedItemId=(Z=P())==null?void 0:Z.id,S.emit()}),z||R(5,B),((V=s.current)==null?void 0:V.value)!==void 0){let Z=$??"";(X=(F=s.current).onValueChange)==null||X.call(F,Z);return}}S.emit()}},emit:()=>{i.current.forEach(T=>T())}}),[]),k=d.useMemo(()=>({value:(T,$,z)=>{var U;$!==((U=a.current.get(T))==null?void 0:U.value)&&(a.current.set(T,{value:$,keywords:z}),n.current.filtered.items.set(T,I($,z)),R(2,()=>{j(),S.emit()}))},item:(T,$)=>(r.current.add(T),$&&(o.current.has($)?o.current.get($).add(T):o.current.set($,new Set([T]))),R(3,()=>{q(),j(),n.current.value||L(),S.emit()}),()=>{a.current.delete(T),r.current.delete(T),n.current.filtered.items.delete(T);let z=P();R(4,()=>{q(),(z==null?void 0:z.getAttribute("id"))===T&&L(),S.emit()})}),group:T=>(o.current.has(T)||o.current.set(T,new Set),()=>{a.current.delete(T),o.current.delete(T)}),filter:()=>s.current.shouldFilter,label:c||e["aria-label"],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:w,inputId:D,labelId:C,listInnerRef:E}),[]);function I(T,$){var z,U;let V=(U=(z=s.current)==null?void 0:z.filter)!=null?U:I1;return T?V(T,n.current.search,$):0}function j(){if(!n.current.search||s.current.shouldFilter===!1)return;let T=n.current.filtered.items,$=[];n.current.filtered.groups.forEach(U=>{let V=o.current.get(U),F=0;V.forEach(X=>{let Z=T.get(X);F=Math.max(Z,F)}),$.push([U,F])});let z=E.current;O().sort((U,V)=>{var F,X;let Z=U.getAttribute("id"),Q=V.getAttribute("id");return((F=T.get(Q))!=null?F:0)-((X=T.get(Z))!=null?X:0)}).forEach(U=>{let V=U.closest(Zo);V?V.appendChild(U.parentElement===V?U:U.closest(`${Zo} > *`)):z.appendChild(U.parentElement===z?U:U.closest(`${Zo} > *`))}),$.sort((U,V)=>V[1]-U[1]).forEach(U=>{var V;let F=(V=E.current)==null?void 0:V.querySelector(`${Fn}[${gn}="${encodeURIComponent(U[0])}"]`);F==null||F.parentElement.appendChild(F)})}function L(){let T=O().find(z=>z.getAttribute("aria-disabled")!=="true"),$=T==null?void 0:T.getAttribute(gn);S.setState("value",$||void 0)}function q(){var T,$,z,U;if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let V=0;for(let F of r.current){let X=($=(T=a.current.get(F))==null?void 0:T.value)!=null?$:"",Z=(U=(z=a.current.get(F))==null?void 0:z.keywords)!=null?U:[],Q=I(X,Z);n.current.filtered.items.set(F,Q),Q>0&&V++}for(let[F,X]of o.current)for(let Z of X)if(n.current.filtered.items.get(Z)>0){n.current.filtered.groups.add(F);break}n.current.filtered.count=V}function B(){var T,$,z;let U=P();U&&(((T=U.parentElement)==null?void 0:T.firstChild)===U&&((z=($=U.closest(Fn))==null?void 0:$.querySelector(A1))==null||z.scrollIntoView({block:"nearest"})),U.scrollIntoView({block:"nearest"}))}function P(){var T;return(T=E.current)==null?void 0:T.querySelector(`${td}[aria-selected="true"]`)}function O(){var T;return Array.from(((T=E.current)==null?void 0:T.querySelectorAll(Li))||[])}function M(T){let $=O()[T];$&&S.setState("value",$.getAttribute(gn))}function A(T){var $;let z=P(),U=O(),V=U.findIndex(X=>X===z),F=U[V+T];($=s.current)!=null&&$.loop&&(F=V+T<0?U[U.length-1]:V+T===U.length?U[0]:U[V+T]),F&&S.setState("value",F.getAttribute(gn))}function N(T){let $=P(),z=$==null?void 0:$.closest(Fn),U;for(;z&&!U;)z=T>0?H1(z,Fn):U1(z,Fn),U=z==null?void 0:z.querySelector(Li);U?S.setState("value",U.getAttribute(gn)):A(T)}let _=()=>M(O().length-1),Y=T=>{T.preventDefault(),T.metaKey?_():T.altKey?N(1):A(1)},H=T=>{T.preventDefault(),T.metaKey?M(0):T.altKey?N(-1):A(-1)};return d.createElement(J.div,{ref:t,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:T=>{var $;($=y.onKeyDown)==null||$.call(y,T);let z=T.nativeEvent.isComposing||T.keyCode===229;if(!(T.defaultPrevented||z))switch(T.key){case"n":case"j":{v&&T.ctrlKey&&Y(T);break}case"ArrowDown":{Y(T);break}case"p":case"k":{v&&T.ctrlKey&&H(T);break}case"ArrowUp":{H(T);break}case"Home":{T.preventDefault(),M(0);break}case"End":{T.preventDefault(),_();break}case"Enter":{T.preventDefault();let U=P();if(U){let V=new Event(Na);U.dispatchEvent(V)}}}}},d.createElement("label",{"cmdk-label":"",htmlFor:k.inputId,id:k.labelId,style:V1},c),xo(e,T=>d.createElement(rd.Provider,{value:S},d.createElement(nd.Provider,{value:k},T))))}),j1=d.forwardRef((e,t)=>{var n,r;let o=_e(),a=d.useRef(null),i=d.useContext(od),s=pr(),c=sd(e),u=(r=(n=c.current)==null?void 0:n.forceMount)!=null?r:i==null?void 0:i.forceMount;rn(()=>{if(!u)return s.item(o,i==null?void 0:i.id)},[u]);let f=id(o,a,[e.value,e.children,a],e.keywords),l=ps(),p=Yt(R=>R.value&&R.value===f.current),h=Yt(R=>u||s.filter()===!1?!0:R.search?R.filtered.items.get(o)>0:!0);d.useEffect(()=>{let R=a.current;if(!(!R||e.disabled))return R.addEventListener(Na,b),()=>R.removeEventListener(Na,b)},[h,e.onSelect,e.disabled]);function b(){var R,S;g(),(S=(R=c.current).onSelect)==null||S.call(R,f.current)}function g(){l.setState("value",f.current,!0)}if(!h)return null;let{disabled:v,value:y,onSelect:w,forceMount:C,keywords:D,...E}=e;return d.createElement(J.div,{ref:kt(a,t),...E,id:o,"cmdk-item":"",role:"option","aria-disabled":!!v,"aria-selected":!!p,"data-disabled":!!v,"data-selected":!!p,onPointerMove:v||s.getDisablePointerSelection()?void 0:g,onClick:v?void 0:b},e.children)}),$1=d.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:o,...a}=e,i=_e(),s=d.useRef(null),c=d.useRef(null),u=_e(),f=pr(),l=Yt(h=>o||f.filter()===!1?!0:h.search?h.filtered.groups.has(i):!0);rn(()=>f.group(i),[]),id(i,s,[e.value,e.heading,c]);let p=d.useMemo(()=>({id:i,forceMount:o}),[o]);return d.createElement(J.div,{ref:kt(s,t),...a,"cmdk-group":"",role:"presentation",hidden:l?void 0:!0},n&&d.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:u},n),xo(e,h=>d.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?u:void 0},d.createElement(od.Provider,{value:p},h))))}),L1=d.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,o=d.useRef(null),a=Yt(i=>!i.search);return!n&&!a?null:d.createElement(J.div,{ref:kt(o,t),...r,"cmdk-separator":"",role:"separator"})}),F1=d.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,o=e.value!=null,a=ps(),i=Yt(u=>u.search),s=Yt(u=>u.selectedItemId),c=pr();return d.useEffect(()=>{e.value!=null&&a.setState("search",e.value)},[e.value]),d.createElement(J.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:"text",value:o?e.value:i,onChange:u=>{o||a.setState("search",u.target.value),n==null||n(u.target.value)}})}),W1=d.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...o}=e,a=d.useRef(null),i=d.useRef(null),s=Yt(u=>u.selectedItemId),c=pr();return d.useEffect(()=>{if(i.current&&a.current){let u=i.current,f=a.current,l,p=new ResizeObserver(()=>{l=requestAnimationFrame(()=>{let h=u.offsetHeight;f.style.setProperty("--cmdk-list-height",h.toFixed(1)+"px")})});return p.observe(u),()=>{cancelAnimationFrame(l),p.unobserve(u)}}},[]),d.createElement(J.div,{ref:kt(a,t),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},xo(e,u=>d.createElement("div",{ref:kt(i,c.listInnerRef),"cmdk-list-sizer":""},u)))}),B1=d.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:o,contentClassName:a,container:i,...s}=e;return d.createElement(ls,{open:n,onOpenChange:r},d.createElement(us,{container:i},d.createElement(yo,{"cmdk-overlay":"",className:o}),d.createElement(wo,{"aria-label":e.label,"cmdk-dialog":"",className:a},d.createElement(ad,{ref:t,...s}))))}),Y1=d.forwardRef((e,t)=>Yt(n=>n.filtered.count===0)?d.createElement(J.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),z1=d.forwardRef((e,t)=>{let{progress:n,children:r,label:o="Loading...",...a}=e;return d.createElement(J.div,{ref:t,...a,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},xo(e,i=>d.createElement("div",{"aria-hidden":!0},i)))}),ze=Object.assign(ad,{List:W1,Item:j1,Input:F1,Group:$1,Separator:L1,Dialog:B1,Empty:Y1,Loading:z1});function H1(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function U1(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function sd(e){let t=d.useRef(e);return rn(()=>{t.current=e}),t}var rn=typeof window>"u"?d.useEffect:d.useLayoutEffect;function vn(e){let t=d.useRef();return t.current===void 0&&(t.current=e()),t}function Yt(e){let t=ps(),n=()=>e(t.snapshot());return d.useSyncExternalStore(t.subscribe,n,n)}function id(e,t,n,r=[]){let o=d.useRef(),a=pr();return rn(()=>{var i;let s=(()=>{var u;for(let f of n){if(typeof f=="string")return f.trim();if(typeof f=="object"&&"current"in f)return f.current?(u=f.current.textContent)==null?void 0:u.trim():o.current}})(),c=r.map(u=>u.trim());a.value(e,s,c),(i=t.current)==null||i.setAttribute(gn,s),o.current=s}),o}var G1=()=>{let[e,t]=d.useState(),n=vn(()=>new Map);return rn(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,o)=>{n.current.set(r,o),t({})}};function q1(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function xo({asChild:e,children:t},n){return e&&d.isValidElement(t)?d.cloneElement(q1(t),{ref:t.ref},n(t.props.children)):n(t)}var V1={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const K1=ls,X1=ed,Z1=us,Q1=ms,cd=d.forwardRef(({className:e,...t},n)=>m.jsx(yo,{ref:n,className:W("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));cd.displayName=yo.displayName;const ld=d.forwardRef(({className:e,children:t,closeOnOutsideClick:n=!0,...r},o)=>m.jsxs(Z1,{children:[m.jsx(cd,{}),m.jsxs(wo,{ref:o,className:W("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),onInteractOutside:n?void 0:a=>a.preventDefault(),...r,children:[t,m.jsxs(ms,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[m.jsx(kn,{className:"h-4 w-4"}),m.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));ld.displayName=wo.displayName;const ud=({className:e,...t})=>m.jsx("div",{className:W("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});ud.displayName="DialogHeader";const dd=({className:e,...t})=>m.jsx("div",{className:W("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});dd.displayName="DialogFooter";const fd=d.forwardRef(({className:e,...t},n)=>m.jsx(ds,{ref:n,className:W("text-lg font-semibold leading-none tracking-tight",e),...t}));fd.displayName=ds.displayName;const md=d.forwardRef(({className:e,...t},n)=>m.jsx(fs,{ref:n,className:W("text-sm text-muted-foreground",e),...t}));md.displayName=fs.displayName;const J1=d.forwardRef(({className:e,...t},n)=>m.jsx(ze,{ref:n,className:W("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));J1.displayName=ze.displayName;const pd=d.forwardRef(({className:e,...t},n)=>m.jsxs("div",{className:"flex items-center h-auto px-3","cmdk-input-wrapper":"",children:[m.jsx(Dc,{strokeWidth:1.25,className:"mr-2 h-4 w-4 shrink-0"}),m.jsx(ze.Input,{ref:n,className:W("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-gray-400 disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));pd.displayName=ze.Input.displayName;const hd=d.forwardRef(({className:e,...t},n)=>m.jsx(ze.List,{ref:n,className:W("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));hd.displayName=ze.List.displayName;const eS=d.forwardRef((e,t)=>m.jsx(ze.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));eS.displayName=ze.Empty.displayName;const gd=d.forwardRef(({className:e,...t},n)=>m.jsx(ze.Group,{ref:n,className:W("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));gd.displayName=ze.Group.displayName;const tS=d.forwardRef(({className:e,...t},n)=>m.jsx(ze.Separator,{ref:n,className:W("-mx-1 h-px bg-border",e),...t}));tS.displayName=ze.Separator.displayName;const vd=d.forwardRef(({className:e,...t},n)=>m.jsx(ze.Item,{ref:n,className:W("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e),...t}));vd.displayName=ze.Item.displayName;function nS({className:e,...t}){return m.jsx("div",{className:W("animate-pulse rounded-md bg-muted",e),...t})}function rS(e="medium",t="white"){const n={small:"text-sm py-1 px-2 h-8",medium:"text-base py-2 px-3 h-10",large:"text-lg py-3 px-4 h-12"},r={white:"bg-background text-foreground border-border",grey:"bg-muted text-muted-foreground border-border"};return{sizeClasses:n[e],variantClasses:r[t],combined:`${n[e]} ${r[t]}`}}const oS=({options:e,placeholder:t,emptyMessage:n,value:r,onValueChange:o,disabled:a,isLoading:i=!1,className:s,size:c,variant:u})=>{const{variantClasses:f,combined:l}=rS(c,u),p=x.useRef(null),[h,b]=x.useState(!1),[g,v]=x.useState(r),[y,w]=x.useState((r==null?void 0:r.label)||""),C=x.useCallback(R=>{const S=p.current;if(S){if(h||b(!0),R.key==="Enter"&&S.value!==""){const k=e.find(I=>I.label===S.value);k&&(v(k),o==null||o(k))}R.key==="Escape"&&S.blur()}},[h,e,o]),D=x.useCallback(()=>{b(!1),w((g==null?void 0:g.label)||"")},[g]),E=x.useCallback(R=>{w(R.label),v(R),o==null||o(R),setTimeout(()=>{var S;(S=p==null?void 0:p.current)==null||S.blur()},0)},[o]);return m.jsxs(ze,{onKeyDown:C,children:[m.jsxs("div",{className:W("rounded-full border bg-gray-100",f,s),children:[" ",m.jsx(pd,{ref:p,value:y,onValueChange:i?void 0:w,onBlur:D,onFocus:()=>b(!0),placeholder:t,disabled:a,className:l})]}),m.jsx("div",{className:"relative mt-1",children:m.jsx("div",{className:W("animate-in fade-in-0 zoom-in-95 absolute top-0 z-10 w-full rounded-xl bg-white dark:bg-gray-800 outline-none",h?"block":"hidden",s),children:m.jsxs(hd,{className:"rounded-lg ring-1 ring-slate-200 dark:ring-gray-700",children:[i?m.jsx(ze.Loading,{children:m.jsx("div",{className:"p-1",children:m.jsx(nS,{className:"h-8 w-full"})})}):null,e.length>0&&!i?m.jsx(gd,{children:e.map(R=>{const S=(g==null?void 0:g.value)===R.value;return m.jsxs(vd,{value:R.label,onMouseDown:k=>{k.preventDefault(),k.stopPropagation()},onSelect:()=>E(R),className:W("flex w-full items-center gap-2 dark:text-white",S?null:"pl-8"),children:[S?m.jsx(er,{className:"w-4"}):null,R.label]},R.value)})}):null,i?null:m.jsx(ze.Empty,{className:"select-none rounded-sm px-2 py-3 text-center text-sm dark:text-gray-400",children:n})]})})})]})},aS=to("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function sS({className:e,variant:t,...n}){return m.jsx("div",{className:W(aS({variant:t}),e),...n})}function iS({title:e,children:t,className:n}){return m.jsxs("section",{className:W("space-y-6",n),children:[m.jsx("div",{className:"border-b border-gray-200 pb-3",children:m.jsx("h2",{className:"text-sm font-semibold text-gray-900 tracking-wide uppercase",children:e})}),t]})}function cS({title:e,variant:t="primary",children:n,className:r}){return m.jsxs("div",{className:W("space-y-4",r),children:[m.jsx(sS,{variant:t==="primary"?"default":"secondary",className:W(t==="primary"&&"bg-black text-white hover:bg-black/90"),children:e}),n]})}const bd=x.forwardRef(({className:e,label:t,helperText:n,error:r,startAdornment:o,endAdornment:a,required:i,id:s,onInput:c,...u},f)=>{const l=!!r,p=s||`currency-input-${Math.random().toString(36).substr(2,9)}`,h=b=>{var w;const g=b.currentTarget;let v=g.value;v=v.replace(/[^0-9.]/g,"");const y=v.split(".");y.length>2&&(v=y[0]+"."+y.slice(1).join("")),((w=y[1])==null?void 0:w.length)>2&&(v=y[0]+"."+y[1].substring(0,2)),g.value=v,c&&c(b)};return m.jsxs("div",{className:"flex flex-col space-y-1",children:[t&&m.jsxs("label",{htmlFor:p,className:"text-sm font-medium text-gray-700",children:[t,i&&m.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),m.jsxs("div",{className:W("flex items-center h-10 w-full rounded-md border bg-background text-sm ring-offset-background disabled:cursor-not-allowed disabled:opacity-50",l?"border-destructive":"border-input",e),children:[o&&m.jsx("span",{className:"px-3 text-sm text-muted-foreground",children:o}),m.jsx("input",{id:p,type:"text",inputMode:"decimal",pattern:"^\\d+(\\.\\d{0,2})?$",className:W("flex-1 px-3 py-2 rounded-md placeholder:text-muted-foreground focus:outline-none disabled:opacity-50"),ref:f,onInput:h,...u}),a&&m.jsx("span",{className:"px-3 text-sm text-muted-foreground",children:a})]}),(n||r)&&m.jsx("span",{className:W("text-xs",l?"text-red-500":"text-muted-foreground"),children:r||n})]})});bd.displayName="CurrencyInput";const lS={small:"h-8 text-xs px-2",medium:"h-10 text-sm px-3",large:"h-12 text-base px-4"},uS={outlined:"border border-input",filled:"border-0 bg-accent",standard:"border-0 border-b border-input rounded-none"},dS=(e,t)=>t&&typeof e=="object"&&e!==null?e[t.text]:typeof e=="string"?e:(e==null?void 0:e.label)||"",fS=(e,t)=>t&&typeof e=="object"&&e!==null?e[t.value]:typeof e=="string"?e:(e==null?void 0:e.value)||e,mS=(e,t,n,r)=>n(e,r)===n(t,r),pS=(e,t,n,r)=>{if(!t)return e;const o=t.toLowerCase();return e.filter(a=>n(a,r).toLowerCase().includes(o))},yd=x.memo(({className:e="",variant:t="default",children:n,...r})=>{const o={default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground border-border bg-background hover:bg-accent hover:text-accent-foreground"};return m.jsx("div",{className:`inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 ${o[t]} ${e}`,...r,children:n})});yd.displayName="Badge";const wd=e=>{const{option:t,index:n,isSelected:r,isHighlighted:o,onSelect:a,getOptionLabel:i,renderOption:s}=e,c=x.useCallback(()=>{a(t)},[t,a]);return m.jsx("div",{onClick:c,className:`
|
|
183
183
|
px-3 py-2 cursor-pointer flex items-center justify-between
|
|
184
184
|
text-sm transition-colors mb-[0.4vh]
|
|
185
185
|
${o?"bg-accent text-accent-foreground":""}
|
package/dist/index.esm.js
CHANGED
|
@@ -12461,17 +12461,18 @@ const xM = fs, SM = id, b1 = ms, EM = gs, hd = d.forwardRef(({ className: e, ...
|
|
|
12461
12461
|
}
|
|
12462
12462
|
));
|
|
12463
12463
|
hd.displayName = Eo.displayName;
|
|
12464
|
-
const w1 = d.forwardRef(({ className: e, children: t,
|
|
12464
|
+
const w1 = d.forwardRef(({ className: e, children: t, closeOnOutsideClick: n = !0, ...r }, o) => /* @__PURE__ */ K(b1, { children: [
|
|
12465
12465
|
/* @__PURE__ */ p(hd, {}),
|
|
12466
12466
|
/* @__PURE__ */ K(
|
|
12467
12467
|
Co,
|
|
12468
12468
|
{
|
|
12469
|
-
ref:
|
|
12469
|
+
ref: o,
|
|
12470
12470
|
className: B(
|
|
12471
12471
|
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
|
|
12472
12472
|
e
|
|
12473
12473
|
),
|
|
12474
|
-
|
|
12474
|
+
onInteractOutside: n ? void 0 : (a) => a.preventDefault(),
|
|
12475
|
+
...r,
|
|
12475
12476
|
children: [
|
|
12476
12477
|
t,
|
|
12477
12478
|
/* @__PURE__ */ K(gs, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
1
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
2
|
+
import * as React from "react";
|
|
3
3
|
declare const Dialog: React.FC<DialogPrimitive.DialogProps>;
|
|
4
4
|
declare const DialogTrigger: React.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
5
5
|
declare const DialogPortal: React.FC<DialogPrimitive.DialogPortalProps>;
|
|
6
6
|
declare const DialogClose: React.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
|
|
7
7
|
declare const DialogOverlay: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
-
declare const DialogContent: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> &
|
|
8
|
+
declare const DialogContent: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
9
|
+
closeOnOutsideClick?: boolean;
|
|
10
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
9
11
|
declare const DialogHeader: {
|
|
10
12
|
({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
|
|
11
13
|
displayName: string;
|
|
@@ -16,4 +18,4 @@ declare const DialogFooter: {
|
|
|
16
18
|
};
|
|
17
19
|
declare const DialogTitle: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
|
|
18
20
|
declare const DialogDescription: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
19
|
-
export { Dialog,
|
|
21
|
+
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docthub-core-components",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.62",
|
|
4
4
|
"main": "dist/index.cjs.js",
|
|
5
5
|
"module": "dist/index.esm.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -100,4 +100,4 @@
|
|
|
100
100
|
"plugin:storybook/recommended"
|
|
101
101
|
]
|
|
102
102
|
}
|
|
103
|
-
}
|
|
103
|
+
}
|