visits-style 2.1.1 → 2.1.2

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
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("clsx"),ie=require("tailwind-merge"),s=require("react/jsx-runtime"),n=require("react"),d=require("@floating-ui/react"),le=require("react-dom");function N(e,t){return t?ie.twMerge(e,t):e}function Y({className:e,...t}){const o=n.useMemo(()=>g("leading-none peer-disabled:opacity-70",e),[e]);return s.jsx("label",{className:o,...t})}function ae({label:e,children:t,required:o,htmlFor:r,error:l,help:i,helpBefore:a,className:c,innerClass:p,...f}){const m=n.useMemo(()=>g("font-medium",o?'after:content-["*"] after:text-danger after:text-sm after:pl-0.5':""),[o]),x=n.useMemo(()=>N("flex flex-col space-y-2",c),[c]);return s.jsxs("div",{className:x,...f,children:[e?s.jsx(Y,{className:m,htmlFor:r,children:e}):null,i&&a?s.jsx("p",{className:"text-xs text-muted pb-2",children:i}):null,s.jsx("div",{className:p,children:ue(t,!!l)}),i&&!a&&!l?s.jsx("p",{className:"text-xs text-muted",children:i}):null,l?s.jsx("p",{className:"text-xs text-danger",children:l}):null]})}function ue(e,t){const o=n.Children.count(e);if(!o)return null;if(o===1)return n.cloneElement(e,{error:t});const r=n.Children.toArray(e);return r[0]=n.cloneElement(r[0],{error:t}),r}function ce({error:e,unstyled:t,className:o,...r}){const l=n.useMemo(()=>t?o:N(g("flex rounded-md border bg-background px-3 py-2 w-full [&_input]:placeholder:text-muted","[&_input]:disabled:opacity-50 [&_input]:focus-visible:outline-none",e?"border-danger hover:border-danger-fore":"border-input"),o),[o,e,t]);return s.jsx("div",{className:l,...r})}const z=n.forwardRef(({className:e,type:t,error:o,unstyled:r,...l},i)=>{const a=n.useMemo(()=>r?e:N(g("flex rounded-md border bg-background px-3 py-2 w-full placeholder:text-muted","disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-ring",o?"border-danger hover:border-danger-fore":"border-input not-disabled:hover:border-input-fore",t==="file"?"file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground":null),e),[e,t,o,r]);return s.jsx("input",{ref:i,type:t,className:a,...l})});z.displayName="Input";const Z=n.forwardRef(({className:e,error:t,unstyled:o,...r},l)=>{const i=n.useMemo(()=>o?e:N(g("flex rounded-md border bg-background px-3 py-2 w-full","disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-ring",t?"border-danger hover:border-danger-fore":"border-input not-disabled:hover:border-input-fore"),e),[e,t,o]);return s.jsx("textarea",{ref:l,className:i,...r})});Z.displayName="Textarea";function de(){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"30",height:"30",viewBox:"0 0 30 30",children:s.jsx("rect",{width:"20",height:"3",y:"13.5",x:"4.5",fill:"currentColor",stroke:"none",rx:"2"})})}function fe({checked:e,indeterminate:t,className:o,id:r,name:l,onChange:i,value:a,checkIcon:c,...p}){const f=n.useMemo(()=>N(g("inline-flex justify-center items-center border w-4.5 h-4.5 rounded","cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",e||t?"bg-primary text-inverted disabled:text-text disabled:bg-input disabled:border-input":"border-input not-disabled:hover:border-input-fore"),o),[e,t,o]),m=()=>{p.disabled||i?.(!e)};return s.jsxs("button",{type:"button",role:"checkbox",id:r||l,className:f,onClick:m,"aria-checked":e,...p,children:[e?c:null,t&&!e?s.jsx(de,{}):null,s.jsx("input",{type:"checkbox","aria-hidden":"true",name:l,checked:e,value:a,onChange:m,disabled:p.disabled,style:{position:"absolute",pointerEvents:"none",top:0,left:0,width:1,height:1,opacity:0}})]})}const pe=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",q=pe?n.useLayoutEffect:n.useEffect;function E({children:e,container:t,disabled:o}){const[r,l]=n.useState(null);return q(()=>{if(!t){let i=document.getElementById("visits-style-portals");return i||(i=document.createElement("div"),i.id="visits-style-portals",document.body.appendChild(i)),l(i)}l(t)},[t]),o||!r?null:le.createPortal(e,r)}function $(e){e&&(e.stopPropagation(),e.preventDefault())}const me={open:150,close:75},H=n.forwardRef(({position:e,label:t,children:o,disabled:r,offset:l={x:0,y:6},onOpen:i,onClose:a,onManualClose:c,timeout:p=me,unstyled:f,zIndex:m=9996,role:x,...h},C)=>{const[y,u]=n.useState(!1),M=d.useId(),j=n.useRef(i),w=n.useRef(a),{refs:v,floatingStyles:S,context:T}=d.useFloating({nodeId:M,placement:e,middleware:[d.shift(),d.flip({fallbackAxisSideDirection:"end"}),d.offset({mainAxis:l.y,crossAxis:l.x})],open:y,onOpenChange:R=>{R?j.current?.(v.reference.current,v.floating.current):w.current?.(v.reference.current,v.floating.current),u(R)},whileElementsMounted:d.autoUpdate}),{isMounted:P,styles:O}=d.useTransitionStyles(T,{duration:p,initial({side:R}){let I="";return R==="top"?I="translateY(5%) scale(0.95)":R==="bottom"?I="translateY(-5%) scale(0.95)":R==="left"?I="translateX(5%) scale(0.95)":I="translateX(-5%) scale(0.95)",{opacity:0,transform:I}}}),A=n.useCallback(R=>{if($(R),c)return c();u(!1),w.current?.(v.reference.current,v.floating.current)},[c]);n.useEffect(()=>{if(r&&y)return u(!1)},[r,y]),n.useImperativeHandle(C,()=>({open:()=>{u(!0),j.current?.(v.reference.current,v.floating.current)},close:()=>{u(!1),w.current?.(v.reference.current,v.floating.current)}}),[]);const{getFloatingProps:D,getReferenceProps:_}=d.useInteractions([d.useClick(T,{enabled:!r})]);return j.current=i,w.current=a,s.jsxs(s.Fragment,{children:[n.cloneElement(n.Children.only(t),_({ref:v.setReference,tabIndex:0,role:"button","aria-expanded":y,disabled:r,onClick:$})),s.jsx(E,{disabled:r||!P,children:s.jsx(d.FloatingOverlay,{"data-testid":"vs-popover-shadow",onClick:A,style:{zIndex:m},autoFocus:!0,children:s.jsx("div",{role:x||"region",ref:v.setFloating,style:S,children:s.jsx(G,{unstyled:f,styles:O,...D({...h,onClick:$}),children:o})})})})]})});H.displayName="Popover";const G=n.forwardRef(({className:e,unstyled:t,styles:o,style:r={},...l},i)=>{const a=n.useMemo(()=>g("z-20 w-auto h-auto outline-none transition-transform ease-in-out",t?null:"border border-accent rounded-md shadow-lg p-1 bg-background",e),[e,t]);return s.jsx("div",{ref:i,className:a,style:{...o,...r},...l})});G.displayName="PopoverContent";function be({className:e,placeholder:t="",options:o=[],error:r,unstyled:l,disabled:i,value:a,maxHeight:c=408,arrowIcon:p,closeIcon:f,checkIcon:m,onChange:x,onClear:h,renderItem:C,sectionLabelStyle:y,buttonAreaStyle:u,clearLabelText:M,optionStyle:j,...w}){const v=n.useRef(null),[S,T]=n.useState(0),P=n.useMemo(()=>l?e:N(g("flex items-center justify-between rounded-md border bg-background px-3 py-2 w-full overflow-hidden cursor-pointer","disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-ring",r?"border-danger hover:border-danger-fore":"border-input not-disabled:hover:border-input-fore"),e),[e,r,l]),O=n.useMemo(()=>Array.isArray(a),[]),A=n.useCallback(b=>{x?.(b),O||v.current?.close()},[x,O]),D=n.useCallback(b=>Array.isArray(a)?a.indexOf(b)>-1:a===b,[a]),_=n.useMemo(()=>{const b={},F=o.filter(k=>typeof k!="string");for(let k=0,B=F.length;k<B;k+=1){const X=F[k];b[`${X.value}`]=X.label}return b},[o]),R=n.useMemo(()=>{if(!a)return t;if(Array.isArray(a)){if(!a.length)return t;const b=[...a].sort(),F=[];for(let k=0,B=b.length;k<B;k+=1)F[k]=_[`${b[k]}`]||"";return F.filter(Boolean).join(",")||t}return _[`${a}`]||t},[t,a,_]),I=R===t,re=n.useMemo(()=>g("overflow-hidden overflow-ellipsis whitespace-nowrap",I?"text-muted":"text-text"),[I]),oe=n.useCallback((b,F)=>C?typeof b=="string"?C(b,{index:F,selected:!1,onChange:()=>{}}):C(b,{index:F,selected:D(b.value),onChange:()=>A(b.value)}):typeof b=="string"?s.jsx("h5",{className:g("font-normal py-1 px-2 text-muted",y),children:b},`optionheader-${F}`):s.jsx(ge,{selected:D(b.value),onChange:A,checkIcon:m,className:j,...b},b.label),[C,A,D,y,j,m]),se=n.useMemo(()=>g("relative flex items-center pr-4 space-x-2",u),[u]);return s.jsx(H,{label:s.jsxs("button",{type:"button",className:P,disabled:i,...w,children:[s.jsx("span",{className:re,children:R}),s.jsxs("div",{className:se,children:[h&&!I?s.jsx("div",{tabIndex:-1,role:"button",className:"size-6 p-1.5 rounded hover:bg-accent cursor-pointer","aria-label":M,onKeyDown:b=>{b.key!=="Enter"&&b.key!=="Space"||h()},onClick:b=>{b.stopPropagation(),h()},children:f}):null,p]})]}),ref:v,onOpen:b=>T(b?.getBoundingClientRect().width||0),disabled:i,children:s.jsx("ul",{className:"overflow-y-auto flex flex-col",role:"listbox",style:{minWidth:S,maxWidth:"calc(100vw - 3rem)",maxHeight:c},children:o.map(oe)})})}function ge({className:e,value:t,label:o,selected:r,checkIcon:l,onChange:i}){const a=n.useMemo(()=>g("flex items-center w-full hover:bg-accent rounded p-1 cursor-pointer",e),[e]);return s.jsxs("button",{type:"button",role:"option",className:a,"aria-selected":r,onClick:()=>i?.(t),children:[r&&l?l:s.jsx("div",{className:"w-5 h-1 mr-1"}),o]})}function xe({checked:e,className:t,id:o,name:r,onChange:l,value:i,...a}){const c=n.useMemo(()=>g("relative inline-flex justify-center items-center border border-input w-4.5 h-4.5 rounded-full","cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed not-disabled:hover:border-input-fore",e?"[&_i]:bg-primary disabled:[&_i]:bg-text disabled:border-input":"",t),[t,e]),p=()=>{a.disabled||l?.(!e)};return s.jsxs("button",{type:"button",role:"radio",id:o||r,className:c,onClick:p,"aria-checked":e,...a,children:[s.jsx("i",{className:"block w-2.5 h-2.5 rounded-full transition-transform",style:{transform:e?"":"scale(0.8)",opacity:e?1:0}}),s.jsx("input",{type:"radio","aria-hidden":"true",name:r,checked:e,value:i,onChange:p,disabled:a.disabled,style:{position:"absolute",pointerEvents:"none",top:0,left:0,width:1,height:1,opacity:0}})]})}const K=n.forwardRef(({className:e,checked:t,onChange:o,value:r,id:l,name:i,...a},c)=>{const p=n.useMemo(()=>N(g("inline-flex shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50","w-11",t?"bg-primary":"bg-input"),e),[e,t]),f=n.useMemo(()=>N("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform",e),[e]),m=()=>{a.disabled||o?.(!t)};return s.jsxs("button",{type:"button",role:"switch",id:l||i,className:p,onClick:m,"aria-checked":t,...a,children:[s.jsx("span",{className:f,style:{transform:t?"translateX(100%)":""}}),s.jsx("input",{ref:c,type:"checkbox","aria-hidden":"true",name:i,checked:t,value:r,onChange:m,disabled:a.disabled,style:{position:"absolute",pointerEvents:"none",top:0,left:0,width:1,height:1,opacity:0}})]})});K.displayName="Switch";function he({header:e,show:t,children:o,timeout:r=300,...l}){const i=n.useRef(null),a=n.useRef(0),c=n.useRef(0),p=n.useRef(!0);return n.useEffect(()=>{c.current=r},[r]),q(()=>{if(!i.current)return;if(i.current.style.overflow="hidden",i.current.style.opacity="1",p.current){p.current=!1,i.current.style.height=t?"auto":"0px",t?window.requestAnimationFrame(()=>{i.current&&(a.current=i.current.offsetHeight)}):(window.requestAnimationFrame(()=>{i.current&&(i.current.style.height="auto",a.current=i.current.offsetHeight,i.current.style.height="0px")}),i.current.style.opacity="0");return}t||(i.current.style.height=`${a.current}px`);const f=[];f[0]=window.requestAnimationFrame(()=>{f[1]=window.requestAnimationFrame(()=>{i.current&&(i.current.style.height=`${t?a.current:0}px`,i.current.style.opacity=t?"1":"0")})});let m;const x=()=>{i.current&&(t?(i.current.style.height="auto",i.current.style.overflow="",i.current.style.opacity="",window.requestAnimationFrame(()=>{i.current&&(a.current=i.current.offsetHeight)})):i.current.style.height="0px")};return c.current===0?x():m=window.setTimeout(x,c.current),()=>{f.forEach(window.cancelAnimationFrame),m&&window.clearTimeout(m)}},[t]),s.jsxs("div",{...l,children:[e,s.jsx("div",{className:"transition-all ease-in-out overflow-hidden",role:"region","aria-hidden":!t,ref:i,style:{transitionDuration:`${r}ms`},children:o})]})}const U=n.forwardRef(({children:e,position:t="bottom",label:o,className:r,timeout:l=150,offset:i={x:0,y:6},clientPoint:a=!1,disabled:c},p)=>{const[f,m]=n.useState(!1),x=d.useId(),{refs:h,floatingStyles:C,context:y}=d.useFloating({nodeId:x,open:f,placement:t,middleware:[d.shift(),d.flip(),d.offset({mainAxis:i.y,crossAxis:i.x})],whileElementsMounted:c?void 0:d.autoUpdate,onOpenChange:m}),{getReferenceProps:u,getFloatingProps:M}=d.useInteractions([d.useHover(y,{enabled:!c}),d.useClientPoint(y,{enabled:a})]),{isMounted:j,styles:w}=d.useTransitionStyles(y,{duration:l,initial:{opacity:0,transform:"scale(0.8)"}});n.useImperativeHandle(p,()=>({floating:h.floating,reference:h.reference,open:()=>m(!0),close:()=>m(!1)})),n.useEffect(()=>{c&&m(!1)},[c]);const v=typeof e=="string"?s.jsx("span",{children:e}):e;return s.jsxs(s.Fragment,{children:[n.cloneElement(n.Children.only(v),{ref:h.setReference,...u()}),s.jsx(E,{disabled:c||!j,children:s.jsx("div",{role:"tooltip",className:"z-[9999]",ref:h.setFloating,...M({style:C}),children:s.jsx(J,{className:r,style:w,children:o})})})]})});U.displayName="Tooltip";const J=n.forwardRef(({className:e,custom:t,...o},r)=>{const l=n.useMemo(()=>g("relative w-auto h-auto outline-none transition-transform ease-in-out whitespace-pre",t?null:"border border-accent rounded shadow-md px-3 py-1 bg-background",e),[e,t]);return s.jsx("div",{ref:r,className:l,...o})});J.displayName="TooltipContent";function Q({variant:e,size:t}){return g("inline-flex items-center justify-center whitespace-nowrap transition-colors rounded-md cursor-pointer","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-auto",{"bg-primary text-inverted hover:bg-primary-fore":!e||e==="primary","bg-info text-inverted hover:bg-info-fore":e==="info","bg-warn text-inverted hover:bg-warn-fore":e==="warn","bg-danger text-inverted hover:bg-danger-fore":e==="danger","hover:bg-accent":e==="ghost","hover:underline":e==="link","border border-input hover:bg-accent":e==="outline"},{"px-2 py-1":!t,"p-1.5":t==="icon"})}function ye({size:e,variant:t,className:o,...r}){const l=n.useMemo(()=>g(Q({size:e,variant:t}),o),[e,t,o]);return s.jsx("button",{className:l,type:"button",...r})}function we({open:e,children:t,timeout:o=150,padding:r="0.85rem",verticalAlign:l="center",closeOnOverlay:i,closeOnEsc:a,onExited:c,className:p,onOpenChange:f,size:m,...x}){const h=n.useRef(c),C=n.useRef(!1),y=d.useId(),{refs:u,context:M}=d.useFloating({open:e,onOpenChange:f,nodeId:y}),{getFloatingProps:j}=d.useInteractions([d.useDismiss(M,{enabled:a,escapeKey:a,outsidePress:!1})]),{isMounted:w,styles:v}=d.useTransitionStyles(M,{duration:o,initial:{opacity:0,transform:"scale(0.8)"}});n.useEffect(()=>{C.current!==w&&(C.current=w,!w&&h.current?.())},[w]);const S=n.useCallback(()=>{i&&f?.(!1)},[f,i]);h.current=c;const T=n.useMemo(()=>g("grid bg-backdrop z-40 justify-items-center",{"place-items-start items-start":l==="start","place-items-end":l==="end","place-items-center":l==="center"||!l}),[l]),P=n.useMemo(()=>N("transition ease-in-out",p),[p]);return s.jsx(E,{disabled:!w,children:s.jsx(d.FloatingOverlay,{className:T,"data-testid":"vs-dialog-overlay",onClick:S,style:{padding:r,opacity:v.opacity},lockScroll:!0,children:s.jsx(V,{ref:u.setFloating,className:P,role:"dialog",size:m,style:v,onClick:$,...j({...x}),children:t})})})}const V=n.forwardRef(({size:e,className:t,...o},r)=>{const l=n.useMemo(()=>g(e?"flex flex-col bg-background shadow-lg p-5 rounded":null,{"w-full max-w-dialog-sm":e==="small","w-full max-w-dialog-md":e==="medium","w-full max-w-dialog-lg":e==="large"},t),[e,t]);return s.jsx("div",{ref:r,className:l,...o})});V.displayName="DialogContent";const ve={open:250,close:150};function je({open:e,timeout:t=ve,onOpenChange:o,position:r="right",overlay:l,onExited:i,...a}){const c=d.useId(),p=n.useRef(!1),f=n.useRef(i),{refs:m,context:x}=d.useFloating({open:e,onOpenChange:o,nodeId:c}),{isMounted:h,styles:C}=d.useTransitionStyles(x,{duration:t,initial(){let u="translateX(75%)";return r==="left"?u="translateX(-75%)":r==="top"?u="translateY(-75%)":r==="bottom"&&(u="translateY(75%)"),{opacity:0,transform:u}}});n.useEffect(()=>{p.current!==h&&(p.current=h,!h&&f.current?.())},[h]);const y=n.useMemo(()=>g("fixed transition-transform z-30",{"top-0 right-0 h-full max-h-screen":r==="right","top-0 left-0 h-full max-h-screen":r==="left","top-0 left-0 right-0 w-full max-w-screen":r==="top","bottom-0 left-0 right-0 w-full max-w-screen":r==="bottom"}),[r]);return f.current=i,s.jsxs(E,{disabled:!h,children:[l?s.jsx(d.FloatingOverlay,{className:"bg-backdrop",style:{opacity:C.opacity},onClick:()=>o?.(!1)}):null,s.jsx("div",{ref:m.setFloating,className:y,role:"dialog",style:C,children:s.jsx(Ce,{...a})})]})}function Ce({className:e,unstyled:t,...o}){const r=n.useMemo(()=>t?e:N(g("relative bg-background min-w-full min-h-full border border-input shadow-lg"),e),[t,e]);return s.jsx("div",{className:r,...o})}function ee({size:e=20,label:t="Loading...",...o}){return s.jsxs("div",{role:"status",...o,children:[s.jsxs("svg",{"aria-hidden":"true",className:"text-accent animate-spin fill-primary",width:e,height:e,viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[s.jsx("path",{d:"M100 50.6a50 50 0 1 1-100 0 50 50 0 0 1 100 0Zm-91 0a41 41 0 1 0 82 0 41 41 0 0 0-82 0Z",fill:"currentColor"}),s.jsx("path",{d:"M94 39a4.2 4.2 0 0 0 3-5.4A50 50 0 0 0 41.7 1.3c-2.4.4-3.9 2.9-3.2 5.3a5 5 0 0 0 5.6 3.5A41 41 0 0 1 88 36 5 5 0 0 0 94 39Z",fill:"currentFill"})]}),s.jsx("span",{className:"sr-only",children:t})]})}function te({type:e,label:t,message:o}){const{icons:r}=Re();return s.jsxs("div",{className:"flex items-center px-4 py-3 w-80 text-sm bg-background border border-input rounded-lg shadow-md m-2",children:[e?s.jsxs("figure",{className:"mr-2",children:[e==="success"&&r?.success?r.success:null,e==="info"&&r?.info?r.info:null,e==="error"&&r?.error?r.error:null,e==="warn"&&r?.warn?r.warn:null,e==="loading"?s.jsx(ee,{size:20}):null]}):null,s.jsxs("div",{className:"space-y-2",children:[s.jsx("p",{className:"font-medium leading-none",children:t}),o?s.jsx("p",{children:o}):null]})]})}function W(){}class Me{notify=W;lastId=0;subscribe=t=>(this.notify=t,()=>{this.notify=W});add=(t,o={})=>{this.lastId+=1;const r=`${this.lastId}`;return this.notify({id:r,type:"add",config:{id:r,label:t,...o}}),r};update=(t,o)=>{this.notify({id:t,type:"update",config:o})};remove=t=>{this.notify({id:t,type:"remove"})};clear=()=>{this.lastId=0}}const L=new Me;function Ne({id:e,type:t,index:o,duration:r=5e3,className:l,children:i,inverted:a,timeout:c=250,max:p=3}){const f=n.useRef(!1),[m,x]=n.useState(!1),{context:h,refs:C}=d.useFloating({open:m,onOpenChange:x,nodeId:e}),{isMounted:y,styles:u}=d.useTransitionStyles(h,{duration:c,initial:{opacity:0,transform:`translateY(${a?"":"-"}50%)`}});n.useLayoutEffect(()=>{x(o<=p)},[o,p]),n.useEffect(()=>{f.current!==y&&(y||L.remove(e),f.current=y)},[y,e]),n.useEffect(()=>{if(!r)return;const w=window.setTimeout(()=>x(!1),r);return()=>window.clearTimeout(w)},[r,e]);const M=n.useCallback(()=>{t!=="loading"&&x(!1)},[t]),j=n.useMemo(()=>g("relative flex w-fit transition-transform ease-in-out cursor-pointer",l),[l]);return y?s.jsx("li",{role:"log",tabIndex:-1,ref:C.setFloating,className:j,style:u,onClick:M,children:i}):null}const ne=n.createContext({});function Re(){return n.useContext(ne)}function ke({className:e,margin:t=16,position:o="top-left",max:r,ListItem:l=te,icons:i}){const a=n.useMemo(()=>{const u={position:"fixed"};return o.indexOf("top")>-1?u.top=t:o.indexOf("bottom")>-1&&(u.bottom=t),o.indexOf("left")>-1?(u.left=t,u.alignItems="flex-start"):o.indexOf("right")>-1?(u.right=t,u.alignItems="flex-end"):(u.left="50%",u.alignItems="center",u.transform="translateX(-50%)"),u},[t,o]),c=n.useMemo(()=>g("flex flex-col z-40 overflow-hidden",e),[e]),p=n.useMemo(()=>o?.startsWith("bottom")||!1,[o]),f=n.useRef(new Map),[m,x]=n.useState([]),h=n.useState(0)[1];q(()=>L.subscribe(u=>{n.startTransition(()=>{if(u.type==="add")f.current.set(u.id,u.config),x(M=>[...M,u.id]);else if(u.type==="remove"){if(!f.current.delete(u.id))return;x(j=>{const w=new Set(j);return w.has(u.id)?(w.delete(u.id),Array.from(w)):j})}else if(u.type==="update"){const M=f.current.get(u.id);if(!M)return;f.current.set(u.id,{...M,...u.config}),h(j=>j+1)}})}),[]);const C=n.useMemo(()=>({icons:i}),[i]),y=m.length;return s.jsx(E,{children:s.jsx("ol",{className:c,style:a,"aria-live":"polite",children:s.jsx(ne.Provider,{value:C,children:m.map((u,M)=>{const j=f.current.get(u);if(!j)return null;const{className:w,duration:v,...S}=j;return s.jsx(Ne,{id:u,index:y-M,className:w,duration:v,inverted:p,max:r,children:n.createElement(l,S)},u)})})})})}function Ie({className:e,...t}){const o=n.useMemo(()=>N("inline-block animate-pulse rounded-md bg-accent",e),[e]);return s.jsx("span",{className:o,...t})}function Fe({className:e,...t}){const o=n.useMemo(()=>g("flex items-center justify-center","[&_button]:rounded-none [&_:first-child]:rounded-bl [&_:first-child]:rounded-tl [&_:last-child]:rounded-br [&_:last-child]:rounded-tr","[&_:first-child]:border-r-0 [&_:last-child]:border-l-0",e),[e]);return s.jsx("div",{role:"group",className:o,...t})}function Se({value:e,max:t,className:o,...r}){const l=n.useMemo(()=>e?Math.round(e/t*100):0,[e,t]),i=n.useMemo(()=>N("relative overflow-hidden rounded-full bg-primary",o),[o]);return s.jsx("div",{role:"progressbar",className:i,"aria-valuemax":t,"aria-valuemin":0,...r,children:s.jsx("div",{className:"h-full w-full flex-1 bg-input transition-all origin-right",style:{transform:`translateX(${l>100?100:l}%)`}})})}function Te({className:e,orientation:t="horizontal",...o}){const r=n.useMemo(()=>N(g("border-0 p-0 shrink-0 bg-input",t==="horizontal"?"h-[1px] w-full":"w-[1px] h-full"),e),[e,t]);return s.jsx("hr",{className:r,role:"none",...o})}exports.clsx=g;exports.Accordion=he;exports.Button=ye;exports.ButtonGroup=Fe;exports.Checkbox=fe;exports.Dialog=we;exports.Divider=Te;exports.FormField=ae;exports.FormLabel=Y;exports.Input=z;exports.InputField=ce;exports.Placeholder=Ie;exports.Popover=H;exports.Portal=E;exports.Progress=Se;exports.Radio=xe;exports.Select=be;exports.Sheet=je;exports.Spinner=ee;exports.Switch=K;exports.Textarea=Z;exports.Toast=ke;exports.ToastItem=te;exports.Tooltip=U;exports.merge=N;exports.toast=L;exports.varientButton=Q;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("clsx"),ie=require("tailwind-merge"),s=require("react/jsx-runtime"),n=require("react"),d=require("@floating-ui/react"),le=require("react-dom");function N(e,t){return t?ie.twMerge(e,t):e}function Y({className:e,...t}){const o=n.useMemo(()=>g("leading-none peer-disabled:opacity-70",e),[e]);return s.jsx("label",{className:o,...t})}function ae({label:e,children:t,required:o,htmlFor:r,error:l,help:i,helpBefore:a,className:c,innerClass:p,...f}){const m=n.useMemo(()=>g("font-medium",o?'after:content-["*"] after:text-danger after:text-sm after:pl-0.5':""),[o]),x=n.useMemo(()=>N("flex flex-col space-y-2",c),[c]);return s.jsxs("div",{className:x,...f,children:[e?s.jsx(Y,{className:m,htmlFor:r,children:e}):null,i&&a?s.jsx("p",{className:"text-xs text-muted pb-2",children:i}):null,s.jsx("div",{className:p,children:ue(t,!!l)}),i&&!a&&!l?s.jsx("p",{className:"text-xs text-muted",children:i}):null,l?s.jsx("p",{className:"text-xs text-danger",children:l}):null]})}function ue(e,t){const o=n.Children.count(e);if(!o)return null;if(o===1)return n.cloneElement(e,{error:t});const r=n.Children.toArray(e);return r[0]=n.cloneElement(r[0],{error:t}),r}function ce({error:e,unstyled:t,className:o,...r}){const l=n.useMemo(()=>t?o:N(g("flex rounded-md border bg-background px-3 py-2 w-full [&_input]:placeholder:text-muted","[&_input]:disabled:opacity-50 [&_input]:focus-visible:outline-none",e?"border-danger hover:border-danger-fore":"border-input"),o),[o,e,t]);return s.jsx("div",{className:l,...r})}const z=n.forwardRef(({className:e,type:t,error:o,unstyled:r,...l},i)=>{const a=n.useMemo(()=>r?e:N(g("flex rounded-md border bg-background px-3 py-2 w-full placeholder:text-muted","disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-ring",o?"border-danger hover:border-danger-fore":"border-input not-disabled:hover:border-input-fore",t==="file"?"file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground":null),e),[e,t,o,r]);return s.jsx("input",{ref:i,type:t,className:a,...l})});z.displayName="Input";const Z=n.forwardRef(({className:e,error:t,unstyled:o,...r},l)=>{const i=n.useMemo(()=>o?e:N(g("flex rounded-md border bg-background px-3 py-2 w-full","disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-ring",t?"border-danger hover:border-danger-fore":"border-input not-disabled:hover:border-input-fore"),e),[e,t,o]);return s.jsx("textarea",{ref:l,className:i,...r})});Z.displayName="Textarea";function de(){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"30",height:"30",viewBox:"0 0 30 30",children:s.jsx("rect",{width:"20",height:"3",y:"13.5",x:"4.5",fill:"currentColor",stroke:"none",rx:"2"})})}function fe({checked:e,indeterminate:t,className:o,id:r,name:l,onChange:i,value:a,checkIcon:c,...p}){const f=n.useMemo(()=>N(g("inline-flex justify-center items-center border w-4.5 h-4.5 rounded","cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",e||t?"bg-primary text-inverted disabled:text-text disabled:bg-input disabled:border-input":"border-input not-disabled:hover:border-input-fore"),o),[e,t,o]),m=()=>{p.disabled||i?.(!e)};return s.jsxs("button",{type:"button",role:"checkbox",id:r||l,className:f,onClick:m,"aria-checked":e,...p,children:[e?c:null,t&&!e?s.jsx(de,{}):null,s.jsx("input",{type:"checkbox","aria-hidden":"true",name:l,checked:e,value:a,onChange:m,disabled:p.disabled,style:{position:"absolute",pointerEvents:"none",top:0,left:0,width:1,height:1,opacity:0}})]})}const pe=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",q=pe?n.useLayoutEffect:n.useEffect;function E({children:e,container:t,disabled:o}){const[r,l]=n.useState(null);return q(()=>{if(!t){let i=document.getElementById("visits-style-portals");return i||(i=document.createElement("div"),i.id="visits-style-portals",document.body.appendChild(i)),l(i)}l(t)},[t]),o||!r?null:le.createPortal(e,r)}function $(e){e&&(e.stopPropagation(),e.preventDefault())}const me={open:150,close:75},H=n.forwardRef(({position:e,label:t,children:o,disabled:r,offset:l={x:0,y:6},onOpen:i,onClose:a,onManualClose:c,timeout:p=me,unstyled:f,zIndex:m=9996,role:x,...h},C)=>{const[y,u]=n.useState(!1),M=d.useId(),j=n.useRef(i),w=n.useRef(a),{refs:v,floatingStyles:S,context:T}=d.useFloating({nodeId:M,placement:e,middleware:[d.shift(),d.flip({fallbackAxisSideDirection:"end"}),d.offset({mainAxis:l.y,crossAxis:l.x})],open:y,onOpenChange:R=>{R?j.current?.(v.reference.current,v.floating.current):w.current?.(v.reference.current,v.floating.current),u(R)},whileElementsMounted:d.autoUpdate}),{isMounted:P,styles:O}=d.useTransitionStyles(T,{duration:p,initial({side:R}){let I="";return R==="top"?I="translateY(5%) scale(0.95)":R==="bottom"?I="translateY(-5%) scale(0.95)":R==="left"?I="translateX(5%) scale(0.95)":I="translateX(-5%) scale(0.95)",{opacity:0,transform:I}}}),A=n.useCallback(R=>{if($(R),c)return c();u(!1),w.current?.(v.reference.current,v.floating.current)},[c]);n.useEffect(()=>{if(r&&y)return u(!1)},[r,y]),n.useImperativeHandle(C,()=>({open:()=>{u(!0),j.current?.(v.reference.current,v.floating.current)},close:()=>{u(!1),w.current?.(v.reference.current,v.floating.current)}}),[]);const{getFloatingProps:D,getReferenceProps:_}=d.useInteractions([d.useClick(T,{enabled:!r})]);return j.current=i,w.current=a,s.jsxs(s.Fragment,{children:[n.cloneElement(n.Children.only(t),_({ref:v.setReference,tabIndex:0,role:"button","aria-expanded":y,disabled:r,onClick:$})),s.jsx(E,{disabled:r||!P,children:s.jsx(d.FloatingOverlay,{"data-testid":"vs-popover-shadow",onClick:A,style:{zIndex:m},autoFocus:!0,children:s.jsx("div",{role:x||"region",ref:v.setFloating,style:S,children:s.jsx(G,{unstyled:f,styles:O,...D({...h,onClick:$}),children:o})})})})]})});H.displayName="Popover";const G=n.forwardRef(({className:e,unstyled:t,styles:o,style:r={},...l},i)=>{const a=n.useMemo(()=>N(g("z-20 w-auto h-auto outline-none transition-transform ease-in-out",t?null:"border border-accent rounded-md shadow-lg p-1 bg-background"),e),[e,t]);return s.jsx("div",{ref:i,className:a,style:{...o,...r},...l})});G.displayName="PopoverContent";function be({className:e,placeholder:t="",options:o=[],error:r,unstyled:l,disabled:i,value:a,maxHeight:c=408,arrowIcon:p,closeIcon:f,checkIcon:m,onChange:x,onClear:h,renderItem:C,sectionLabelStyle:y,buttonAreaStyle:u,clearLabelText:M,optionStyle:j,...w}){const v=n.useRef(null),[S,T]=n.useState(0),P=n.useMemo(()=>l?e:N(g("flex items-center justify-between rounded-md border bg-background px-3 py-2 w-full overflow-hidden cursor-pointer","disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-ring",r?"border-danger hover:border-danger-fore":"border-input not-disabled:hover:border-input-fore"),e),[e,r,l]),O=n.useMemo(()=>Array.isArray(a),[]),A=n.useCallback(b=>{x?.(b),O||v.current?.close()},[x,O]),D=n.useCallback(b=>Array.isArray(a)?a.indexOf(b)>-1:a===b,[a]),_=n.useMemo(()=>{const b={},F=o.filter(k=>typeof k!="string");for(let k=0,B=F.length;k<B;k+=1){const X=F[k];b[`${X.value}`]=X.label}return b},[o]),R=n.useMemo(()=>{if(!a)return t;if(Array.isArray(a)){if(!a.length)return t;const b=[...a].sort(),F=[];for(let k=0,B=b.length;k<B;k+=1)F[k]=_[`${b[k]}`]||"";return F.filter(Boolean).join(",")||t}return _[`${a}`]||t},[t,a,_]),I=R===t,re=n.useMemo(()=>g("overflow-hidden overflow-ellipsis whitespace-nowrap",I?"text-muted":"text-text"),[I]),oe=n.useCallback((b,F)=>C?typeof b=="string"?C(b,{index:F,selected:!1,onChange:()=>{}}):C(b,{index:F,selected:D(b.value),onChange:()=>A(b.value)}):typeof b=="string"?s.jsx("h5",{className:g("font-normal py-1 px-2 text-muted",y),children:b},`optionheader-${F}`):s.jsx(ge,{selected:D(b.value),onChange:A,checkIcon:m,className:j,...b},b.label),[C,A,D,y,j,m]),se=n.useMemo(()=>g("relative flex items-center pr-4 space-x-2",u),[u]);return s.jsx(H,{label:s.jsxs("button",{type:"button",className:P,disabled:i,...w,children:[s.jsx("span",{className:re,children:R}),s.jsxs("div",{className:se,children:[h&&!I?s.jsx("div",{tabIndex:-1,role:"button",className:"size-6 p-1.5 rounded hover:bg-accent cursor-pointer","aria-label":M,onKeyDown:b=>{b.key!=="Enter"&&b.key!=="Space"||h()},onClick:b=>{b.stopPropagation(),h()},children:f}):null,p]})]}),ref:v,onOpen:b=>T(b?.getBoundingClientRect().width||0),disabled:i,children:s.jsx("ul",{className:"overflow-y-auto flex flex-col",role:"listbox",style:{minWidth:S,maxWidth:"calc(100vw - 3rem)",maxHeight:c},children:o.map(oe)})})}function ge({className:e,value:t,label:o,selected:r,checkIcon:l,onChange:i}){const a=n.useMemo(()=>g("flex items-center w-full hover:bg-accent rounded p-1 cursor-pointer",e),[e]);return s.jsxs("button",{type:"button",role:"option",className:a,"aria-selected":r,onClick:()=>i?.(t),children:[r&&l?l:s.jsx("div",{className:"w-5 h-1 mr-1"}),o]})}function xe({checked:e,className:t,id:o,name:r,onChange:l,value:i,...a}){const c=n.useMemo(()=>g("relative inline-flex justify-center items-center border border-input w-4.5 h-4.5 rounded-full","cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed not-disabled:hover:border-input-fore",e?"[&_i]:bg-primary disabled:[&_i]:bg-text disabled:border-input":"",t),[t,e]),p=()=>{a.disabled||l?.(!e)};return s.jsxs("button",{type:"button",role:"radio",id:o||r,className:c,onClick:p,"aria-checked":e,...a,children:[s.jsx("i",{className:"block w-2.5 h-2.5 rounded-full transition-transform",style:{transform:e?"":"scale(0.8)",opacity:e?1:0}}),s.jsx("input",{type:"radio","aria-hidden":"true",name:r,checked:e,value:i,onChange:p,disabled:a.disabled,style:{position:"absolute",pointerEvents:"none",top:0,left:0,width:1,height:1,opacity:0}})]})}const K=n.forwardRef(({className:e,checked:t,onChange:o,value:r,id:l,name:i,...a},c)=>{const p=n.useMemo(()=>N(g("inline-flex shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50","w-11",t?"bg-primary":"bg-input"),e),[e,t]),f=n.useMemo(()=>N("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform",e),[e]),m=()=>{a.disabled||o?.(!t)};return s.jsxs("button",{type:"button",role:"switch",id:l||i,className:p,onClick:m,"aria-checked":t,...a,children:[s.jsx("span",{className:f,style:{transform:t?"translateX(100%)":""}}),s.jsx("input",{ref:c,type:"checkbox","aria-hidden":"true",name:i,checked:t,value:r,onChange:m,disabled:a.disabled,style:{position:"absolute",pointerEvents:"none",top:0,left:0,width:1,height:1,opacity:0}})]})});K.displayName="Switch";function he({header:e,show:t,children:o,timeout:r=300,...l}){const i=n.useRef(null),a=n.useRef(0),c=n.useRef(0),p=n.useRef(!0);return n.useEffect(()=>{c.current=r},[r]),q(()=>{if(!i.current)return;if(i.current.style.overflow="hidden",i.current.style.opacity="1",p.current){p.current=!1,i.current.style.height=t?"auto":"0px",t?window.requestAnimationFrame(()=>{i.current&&(a.current=i.current.offsetHeight)}):(window.requestAnimationFrame(()=>{i.current&&(i.current.style.height="auto",a.current=i.current.offsetHeight,i.current.style.height="0px")}),i.current.style.opacity="0");return}t||(i.current.style.height=`${a.current}px`);const f=[];f[0]=window.requestAnimationFrame(()=>{f[1]=window.requestAnimationFrame(()=>{i.current&&(i.current.style.height=`${t?a.current:0}px`,i.current.style.opacity=t?"1":"0")})});let m;const x=()=>{i.current&&(t?(i.current.style.height="auto",i.current.style.overflow="",i.current.style.opacity="",window.requestAnimationFrame(()=>{i.current&&(a.current=i.current.offsetHeight)})):i.current.style.height="0px")};return c.current===0?x():m=window.setTimeout(x,c.current),()=>{f.forEach(window.cancelAnimationFrame),m&&window.clearTimeout(m)}},[t]),s.jsxs("div",{...l,children:[e,s.jsx("div",{className:"transition-all ease-in-out overflow-hidden",role:"region","aria-hidden":!t,ref:i,style:{transitionDuration:`${r}ms`},children:o})]})}const U=n.forwardRef(({children:e,position:t="bottom",label:o,className:r,timeout:l=150,offset:i={x:0,y:6},clientPoint:a=!1,disabled:c},p)=>{const[f,m]=n.useState(!1),x=d.useId(),{refs:h,floatingStyles:C,context:y}=d.useFloating({nodeId:x,open:f,placement:t,middleware:[d.shift(),d.flip(),d.offset({mainAxis:i.y,crossAxis:i.x})],whileElementsMounted:c?void 0:d.autoUpdate,onOpenChange:m}),{getReferenceProps:u,getFloatingProps:M}=d.useInteractions([d.useHover(y,{enabled:!c}),d.useClientPoint(y,{enabled:a})]),{isMounted:j,styles:w}=d.useTransitionStyles(y,{duration:l,initial:{opacity:0,transform:"scale(0.8)"}});n.useImperativeHandle(p,()=>({floating:h.floating,reference:h.reference,open:()=>m(!0),close:()=>m(!1)})),n.useEffect(()=>{c&&m(!1)},[c]);const v=typeof e=="string"?s.jsx("span",{children:e}):e;return s.jsxs(s.Fragment,{children:[n.cloneElement(n.Children.only(v),{ref:h.setReference,...u()}),s.jsx(E,{disabled:c||!j,children:s.jsx("div",{role:"tooltip",className:"z-[9999]",ref:h.setFloating,...M({style:C}),children:s.jsx(J,{className:r,style:w,children:o})})})]})});U.displayName="Tooltip";const J=n.forwardRef(({className:e,custom:t,...o},r)=>{const l=n.useMemo(()=>N(g("relative w-auto h-auto outline-none transition-transform ease-in-out whitespace-pre",t?null:"border border-accent rounded shadow-md px-3 py-1 bg-background"),e),[e,t]);return s.jsx("div",{ref:r,className:l,...o})});J.displayName="TooltipContent";function Q({variant:e,size:t}){return g("inline-flex items-center justify-center whitespace-nowrap transition-colors rounded-md cursor-pointer","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-auto",{"bg-primary text-inverted hover:bg-primary-fore":!e||e==="primary","bg-info text-inverted hover:bg-info-fore":e==="info","bg-warn text-inverted hover:bg-warn-fore":e==="warn","bg-danger text-inverted hover:bg-danger-fore":e==="danger","hover:bg-accent":e==="ghost","hover:underline":e==="link","border border-input hover:bg-accent":e==="outline"},{"px-2 py-1":!t,"p-1.5":t==="icon"})}function ye({size:e,variant:t,className:o,...r}){const l=n.useMemo(()=>g(Q({size:e,variant:t}),o),[e,t,o]);return s.jsx("button",{className:l,type:"button",...r})}function we({open:e,children:t,timeout:o=150,padding:r="0.85rem",verticalAlign:l="center",closeOnOverlay:i,closeOnEsc:a,onExited:c,className:p,onOpenChange:f,size:m,...x}){const h=n.useRef(c),C=n.useRef(!1),y=d.useId(),{refs:u,context:M}=d.useFloating({open:e,onOpenChange:f,nodeId:y}),{getFloatingProps:j}=d.useInteractions([d.useDismiss(M,{enabled:a,escapeKey:a,outsidePress:!1})]),{isMounted:w,styles:v}=d.useTransitionStyles(M,{duration:o,initial:{opacity:0,transform:"scale(0.8)"}});n.useEffect(()=>{C.current!==w&&(C.current=w,!w&&h.current?.())},[w]);const S=n.useCallback(()=>{i&&f?.(!1)},[f,i]);h.current=c;const T=n.useMemo(()=>g("grid bg-backdrop z-40 justify-items-center",{"place-items-start items-start":l==="start","place-items-end":l==="end","place-items-center":l==="center"||!l}),[l]),P=n.useMemo(()=>N("transition ease-in-out",p),[p]);return s.jsx(E,{disabled:!w,children:s.jsx(d.FloatingOverlay,{className:T,"data-testid":"vs-dialog-overlay",onClick:S,style:{padding:r,opacity:v.opacity},lockScroll:!0,children:s.jsx(V,{ref:u.setFloating,className:P,role:"dialog",size:m,style:v,onClick:$,...j({...x}),children:t})})})}const V=n.forwardRef(({size:e,className:t,...o},r)=>{const l=n.useMemo(()=>g(e?"flex flex-col bg-background shadow-lg p-5 rounded":null,{"w-full max-w-dialog-sm":e==="small","w-full max-w-dialog-md":e==="medium","w-full max-w-dialog-lg":e==="large"},t),[e,t]);return s.jsx("div",{ref:r,className:l,...o})});V.displayName="DialogContent";const ve={open:250,close:150};function je({open:e,timeout:t=ve,onOpenChange:o,position:r="right",overlay:l,onExited:i,...a}){const c=d.useId(),p=n.useRef(!1),f=n.useRef(i),{refs:m,context:x}=d.useFloating({open:e,onOpenChange:o,nodeId:c}),{isMounted:h,styles:C}=d.useTransitionStyles(x,{duration:t,initial(){let u="translateX(75%)";return r==="left"?u="translateX(-75%)":r==="top"?u="translateY(-75%)":r==="bottom"&&(u="translateY(75%)"),{opacity:0,transform:u}}});n.useEffect(()=>{p.current!==h&&(p.current=h,!h&&f.current?.())},[h]);const y=n.useMemo(()=>g("fixed transition-transform z-30",{"top-0 right-0 h-full max-h-screen":r==="right","top-0 left-0 h-full max-h-screen":r==="left","top-0 left-0 right-0 w-full max-w-screen":r==="top","bottom-0 left-0 right-0 w-full max-w-screen":r==="bottom"}),[r]);return f.current=i,s.jsxs(E,{disabled:!h,children:[l?s.jsx(d.FloatingOverlay,{className:"bg-backdrop",style:{opacity:C.opacity},onClick:()=>o?.(!1)}):null,s.jsx("div",{ref:m.setFloating,className:y,role:"dialog",style:C,children:s.jsx(Ce,{...a})})]})}function Ce({className:e,unstyled:t,...o}){const r=n.useMemo(()=>t?e:N(g("relative bg-background min-w-full min-h-full border border-input shadow-lg"),e),[t,e]);return s.jsx("div",{className:r,...o})}function ee({size:e=20,label:t="Loading...",...o}){return s.jsxs("div",{role:"status",...o,children:[s.jsxs("svg",{"aria-hidden":"true",className:"text-accent animate-spin fill-primary",width:e,height:e,viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[s.jsx("path",{d:"M100 50.6a50 50 0 1 1-100 0 50 50 0 0 1 100 0Zm-91 0a41 41 0 1 0 82 0 41 41 0 0 0-82 0Z",fill:"currentColor"}),s.jsx("path",{d:"M94 39a4.2 4.2 0 0 0 3-5.4A50 50 0 0 0 41.7 1.3c-2.4.4-3.9 2.9-3.2 5.3a5 5 0 0 0 5.6 3.5A41 41 0 0 1 88 36 5 5 0 0 0 94 39Z",fill:"currentFill"})]}),s.jsx("span",{className:"sr-only",children:t})]})}function te({type:e,label:t,message:o}){const{icons:r}=Re();return s.jsxs("div",{className:"flex items-center px-4 py-3 w-80 text-sm bg-background border border-input rounded-lg shadow-md m-2",children:[e?s.jsxs("figure",{className:"mr-2",children:[e==="success"&&r?.success?r.success:null,e==="info"&&r?.info?r.info:null,e==="error"&&r?.error?r.error:null,e==="warn"&&r?.warn?r.warn:null,e==="loading"?s.jsx(ee,{size:20}):null]}):null,s.jsxs("div",{className:"space-y-2",children:[s.jsx("p",{className:"font-medium leading-none",children:t}),o?s.jsx("p",{children:o}):null]})]})}function W(){}class Me{notify=W;lastId=0;subscribe=t=>(this.notify=t,()=>{this.notify=W});add=(t,o={})=>{this.lastId+=1;const r=`${this.lastId}`;return this.notify({id:r,type:"add",config:{id:r,label:t,...o}}),r};update=(t,o)=>{this.notify({id:t,type:"update",config:o})};remove=t=>{this.notify({id:t,type:"remove"})};clear=()=>{this.lastId=0}}const L=new Me;function Ne({id:e,type:t,index:o,duration:r=5e3,className:l,children:i,inverted:a,timeout:c=250,max:p=3}){const f=n.useRef(!1),[m,x]=n.useState(!1),{context:h,refs:C}=d.useFloating({open:m,onOpenChange:x,nodeId:e}),{isMounted:y,styles:u}=d.useTransitionStyles(h,{duration:c,initial:{opacity:0,transform:`translateY(${a?"":"-"}50%)`}});n.useLayoutEffect(()=>{x(o<=p)},[o,p]),n.useEffect(()=>{f.current!==y&&(y||L.remove(e),f.current=y)},[y,e]),n.useEffect(()=>{if(!r)return;const w=window.setTimeout(()=>x(!1),r);return()=>window.clearTimeout(w)},[r,e]);const M=n.useCallback(()=>{t!=="loading"&&x(!1)},[t]),j=n.useMemo(()=>g("relative flex w-fit transition-transform ease-in-out cursor-pointer",l),[l]);return y?s.jsx("li",{role:"log",tabIndex:-1,ref:C.setFloating,className:j,style:u,onClick:M,children:i}):null}const ne=n.createContext({});function Re(){return n.useContext(ne)}function ke({className:e,margin:t=16,position:o="top-left",max:r,ListItem:l=te,icons:i}){const a=n.useMemo(()=>{const u={position:"fixed"};return o.indexOf("top")>-1?u.top=t:o.indexOf("bottom")>-1&&(u.bottom=t),o.indexOf("left")>-1?(u.left=t,u.alignItems="flex-start"):o.indexOf("right")>-1?(u.right=t,u.alignItems="flex-end"):(u.left="50%",u.alignItems="center",u.transform="translateX(-50%)"),u},[t,o]),c=n.useMemo(()=>g("flex flex-col z-40 overflow-hidden",e),[e]),p=n.useMemo(()=>o?.startsWith("bottom")||!1,[o]),f=n.useRef(new Map),[m,x]=n.useState([]),h=n.useState(0)[1];q(()=>L.subscribe(u=>{n.startTransition(()=>{if(u.type==="add")f.current.set(u.id,u.config),x(M=>[...M,u.id]);else if(u.type==="remove"){if(!f.current.delete(u.id))return;x(j=>{const w=new Set(j);return w.has(u.id)?(w.delete(u.id),Array.from(w)):j})}else if(u.type==="update"){const M=f.current.get(u.id);if(!M)return;f.current.set(u.id,{...M,...u.config}),h(j=>j+1)}})}),[]);const C=n.useMemo(()=>({icons:i}),[i]),y=m.length;return s.jsx(E,{children:s.jsx("ol",{className:c,style:a,"aria-live":"polite",children:s.jsx(ne.Provider,{value:C,children:m.map((u,M)=>{const j=f.current.get(u);if(!j)return null;const{className:w,duration:v,...S}=j;return s.jsx(Ne,{id:u,index:y-M,className:w,duration:v,inverted:p,max:r,children:n.createElement(l,S)},u)})})})})}function Ie({className:e,...t}){const o=n.useMemo(()=>N("inline-block animate-pulse rounded-md bg-accent",e),[e]);return s.jsx("div",{className:o,...t})}function Fe({className:e,...t}){const o=n.useMemo(()=>g("flex items-center justify-center","[&_button]:rounded-none [&_:first-child]:rounded-bl [&_:first-child]:rounded-tl [&_:last-child]:rounded-br [&_:last-child]:rounded-tr","[&_:first-child]:border-r-0 [&_:last-child]:border-l-0",e),[e]);return s.jsx("div",{role:"group",className:o,...t})}function Se({value:e,max:t,className:o,...r}){const l=n.useMemo(()=>e?Math.round(e/t*100):0,[e,t]),i=n.useMemo(()=>N("relative overflow-hidden rounded-full bg-primary",o),[o]);return s.jsx("div",{role:"progressbar",className:i,"aria-valuemax":t,"aria-valuemin":0,...r,children:s.jsx("div",{className:"h-full w-full flex-1 bg-input transition-all origin-right",style:{transform:`translateX(${l>100?100:l}%)`}})})}function Te({className:e,orientation:t="horizontal",...o}){const r=n.useMemo(()=>N(g("border-0 p-0 shrink-0 bg-input",t==="horizontal"?"h-[1px] w-full":"w-[1px] h-full"),e),[e,t]);return s.jsx("hr",{className:r,role:"none",...o})}exports.clsx=g;exports.Accordion=he;exports.Button=ye;exports.ButtonGroup=Fe;exports.Checkbox=fe;exports.Dialog=we;exports.Divider=Te;exports.FormField=ae;exports.FormLabel=Y;exports.Input=z;exports.InputField=ce;exports.Popover=H;exports.Portal=E;exports.Progress=Se;exports.Radio=xe;exports.Select=be;exports.Sheet=je;exports.Skeleton=Ie;exports.Spinner=ee;exports.Switch=K;exports.Textarea=Z;exports.Toast=ke;exports.ToastItem=te;exports.Tooltip=U;exports.merge=N;exports.toast=L;exports.varientButton=Q;
package/dist/index.d.ts CHANGED
@@ -155,8 +155,6 @@ declare type OptionType<T> = {
155
155
  label: string;
156
156
  } | string;
157
157
 
158
- export declare function Placeholder({ className, ...props }: HTMLAttributes<HTMLDivElement>): JSX.Element;
159
-
160
158
  export declare const Popover: ForwardRefExoticComponent<PopoverProps & RefAttributes<PopoverRef>>;
161
159
 
162
160
  export declare interface PopoverProps extends HTMLAttributes<HTMLDivElement> {
@@ -312,6 +310,8 @@ export declare interface SinnerProps extends HTMLAttributes<HTMLDivElement> {
312
310
  label?: string;
313
311
  }
314
312
 
313
+ export declare function Skeleton({ className, ...props }: HTMLAttributes<HTMLDivElement>): JSX.Element;
314
+
315
315
  export declare function Spinner({ size, label, ...rest }: SinnerProps): JSX.Element;
316
316
 
317
317
  export declare const Switch: ForwardRefExoticComponent<SwitchProps & RefAttributes<HTMLInputElement>>;
package/dist/index.es.js CHANGED
@@ -2,10 +2,10 @@ import m from "clsx";
2
2
  import { default as pt } from "clsx";
3
3
  import { twMerge as he } from "tailwind-merge";
4
4
  import { jsx as i, jsxs as k, Fragment as te } from "react/jsx-runtime";
5
- import { useMemo as c, Children as z, cloneElement as Z, forwardRef as S, useLayoutEffect as ne, useEffect as R, useState as E, useRef as I, useCallback as O, useImperativeHandle as re, startTransition as ye, createContext as xe, createElement as we, useContext as ve } from "react";
5
+ import { useMemo as c, Children as z, cloneElement as Z, forwardRef as S, useLayoutEffect as ne, useEffect as R, useState as E, useRef as F, useCallback as O, useImperativeHandle as re, startTransition as ye, createContext as xe, createElement as we, useContext as ve } from "react";
6
6
  import { useId as K, useFloating as H, autoUpdate as oe, shift as ie, flip as se, offset as le, useTransitionStyles as L, useInteractions as U, useClick as Ce, FloatingOverlay as J, useHover as Ne, useClientPoint as ke, useDismiss as Ie } from "@floating-ui/react";
7
7
  import { createPortal as Fe } from "react-dom";
8
- function F(e, t) {
8
+ function I(e, t) {
9
9
  return t ? he(e, t) : e;
10
10
  }
11
11
  function Te({ className: e, ...t }) {
@@ -27,7 +27,7 @@ function Je({
27
27
  const p = c(() => m(
28
28
  "font-medium",
29
29
  r ? 'after:content-["*"] after:text-danger after:text-sm after:pl-0.5' : ""
30
- ), [r]), g = c(() => F("flex flex-col space-y-2", u), [u]);
30
+ ), [r]), g = c(() => I("flex flex-col space-y-2", u), [u]);
31
31
  return /* @__PURE__ */ k("div", { className: g, ...d, children: [
32
32
  e ? /* @__PURE__ */ i(Te, { className: p, htmlFor: n, children: e }) : null,
33
33
  o && l ? /* @__PURE__ */ i("p", { className: "text-xs text-muted pb-2", children: o }) : null,
@@ -45,7 +45,7 @@ function Pe(e, t) {
45
45
  return n[0] = Z(n[0], { error: t }), n;
46
46
  }
47
47
  function Qe({ error: e, unstyled: t, className: r, ...n }) {
48
- const s = c(() => t ? r : F(m(
48
+ const s = c(() => t ? r : I(m(
49
49
  "flex rounded-md border bg-background px-3 py-2 w-full [&_input]:placeholder:text-muted",
50
50
  "[&_input]:disabled:opacity-50 [&_input]:focus-visible:outline-none",
51
51
  e ? "border-danger hover:border-danger-fore" : "border-input"
@@ -59,7 +59,7 @@ const Ae = S(({
59
59
  unstyled: n,
60
60
  ...s
61
61
  }, o) => {
62
- const l = c(() => n ? e : F(m(
62
+ const l = c(() => n ? e : I(m(
63
63
  "flex rounded-md border bg-background px-3 py-2 w-full placeholder:text-muted",
64
64
  "disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-ring",
65
65
  r ? "border-danger hover:border-danger-fore" : "border-input not-disabled:hover:border-input-fore",
@@ -74,7 +74,7 @@ const Me = S(({
74
74
  unstyled: r,
75
75
  ...n
76
76
  }, s) => {
77
- const o = c(() => r ? e : F(m(
77
+ const o = c(() => r ? e : I(m(
78
78
  "flex rounded-md border bg-background px-3 py-2 w-full",
79
79
  "disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-ring",
80
80
  t ? "border-danger hover:border-danger-fore" : "border-input not-disabled:hover:border-input-fore"
@@ -96,7 +96,7 @@ function Ve({
96
96
  checkIcon: u,
97
97
  ...f
98
98
  }) {
99
- const d = c(() => F(m(
99
+ const d = c(() => I(m(
100
100
  "inline-flex justify-center items-center border w-4.5 h-4.5 rounded",
101
101
  "cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",
102
102
  e || t ? "bg-primary text-inverted disabled:text-text disabled:bg-input disabled:border-input" : "border-input not-disabled:hover:border-input-fore"
@@ -162,7 +162,7 @@ const _e = { open: 150, close: 75 }, ae = S(({
162
162
  role: g,
163
163
  ...h
164
164
  }, C) => {
165
- const [y, a] = E(!1), N = K(), v = I(o), x = I(l), { refs: w, floatingStyles: _, context: D } = H({
165
+ const [y, a] = E(!1), N = K(), v = F(o), x = F(l), { refs: w, floatingStyles: _, context: D } = H({
166
166
  nodeId: N,
167
167
  placement: e,
168
168
  middleware: [
@@ -236,11 +236,10 @@ const ce = S(({
236
236
  style: n = {},
237
237
  ...s
238
238
  }, o) => {
239
- const l = c(() => m(
239
+ const l = c(() => I(m(
240
240
  "z-20 w-auto h-auto outline-none transition-transform ease-in-out",
241
- t ? null : "border border-accent rounded-md shadow-lg p-1 bg-background",
242
- e
243
- ), [e, t]);
241
+ t ? null : "border border-accent rounded-md shadow-lg p-1 bg-background"
242
+ ), e), [e, t]);
244
243
  return /* @__PURE__ */ i("div", { ref: o, className: l, style: { ...r, ...n }, ...s });
245
244
  });
246
245
  ce.displayName = "PopoverContent";
@@ -265,7 +264,7 @@ function et({
265
264
  optionStyle: v,
266
265
  ...x
267
266
  }) {
268
- const w = I(null), [_, D] = E(0), j = c(() => s ? e : F(m(
267
+ const w = F(null), [_, D] = E(0), j = c(() => s ? e : I(m(
269
268
  "flex items-center justify-between rounded-md border bg-background px-3 py-2 w-full overflow-hidden cursor-pointer",
270
269
  "disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-ring",
271
270
  n ? "border-danger hover:border-danger-fore" : "border-input not-disabled:hover:border-input-fore"
@@ -437,12 +436,12 @@ const De = S(({
437
436
  name: o,
438
437
  ...l
439
438
  }, u) => {
440
- const f = c(() => F(m(
439
+ const f = c(() => I(m(
441
440
  "inline-flex shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors",
442
441
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50",
443
442
  "w-11",
444
443
  t ? "bg-primary" : "bg-input"
445
- ), e), [e, t]), d = c(() => F(
444
+ ), e), [e, t]), d = c(() => I(
446
445
  "pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform",
447
446
  e
448
447
  ), [e]), p = () => {
@@ -480,7 +479,7 @@ const De = S(({
480
479
  });
481
480
  De.displayName = "Switch";
482
481
  function nt({ header: e, show: t, children: r, timeout: n = 300, ...s }) {
483
- const o = I(null), l = I(0), u = I(0), f = I(!0);
482
+ const o = F(null), l = F(0), u = F(0), f = F(!0);
484
483
  return R(() => {
485
484
  u.current = n;
486
485
  }, [n]), Q(() => {
@@ -575,11 +574,10 @@ const ue = S(({
575
574
  custom: t,
576
575
  ...r
577
576
  }, n) => {
578
- const s = c(() => m(
577
+ const s = c(() => I(m(
579
578
  "relative w-auto h-auto outline-none transition-transform ease-in-out whitespace-pre",
580
- t ? null : "border border-accent rounded shadow-md px-3 py-1 bg-background",
581
- e
582
- ), [e, t]);
579
+ t ? null : "border border-accent rounded shadow-md px-3 py-1 bg-background"
580
+ ), e), [e, t]);
583
581
  return /* @__PURE__ */ i("div", { ref: n, className: s, ...r });
584
582
  });
585
583
  ue.displayName = "TooltipContent";
@@ -621,7 +619,7 @@ function ot({
621
619
  size: p,
622
620
  ...g
623
621
  }) {
624
- const h = I(u), C = I(!1), y = K(), { refs: a, context: N } = H({ open: e, onOpenChange: d, nodeId: y }), { getFloatingProps: v } = U([
622
+ const h = F(u), C = F(!1), y = K(), { refs: a, context: N } = H({ open: e, onOpenChange: d, nodeId: y }), { getFloatingProps: v } = U([
625
623
  Ie(N, {
626
624
  enabled: l,
627
625
  escapeKey: l,
@@ -642,7 +640,7 @@ function ot({
642
640
  "place-items-start items-start": s === "start",
643
641
  "place-items-end": s === "end",
644
642
  "place-items-center": s === "center" || !s
645
- }), [s]), j = c(() => F("transition ease-in-out", f), [f]);
643
+ }), [s]), j = c(() => I("transition ease-in-out", f), [f]);
646
644
  return /* @__PURE__ */ i(W, { disabled: !x, children: /* @__PURE__ */ i(
647
645
  J,
648
646
  {
@@ -694,7 +692,7 @@ function it({
694
692
  onExited: o,
695
693
  ...l
696
694
  }) {
697
- const u = K(), f = I(!1), d = I(o), { refs: p, context: g } = H({ open: e, onOpenChange: r, nodeId: u }), { isMounted: h, styles: C } = L(g, {
695
+ const u = K(), f = F(!1), d = F(o), { refs: p, context: g } = H({ open: e, onOpenChange: r, nodeId: u }), { isMounted: h, styles: C } = L(g, {
698
696
  duration: t,
699
697
  initial() {
700
698
  let a = "translateX(75%)";
@@ -735,7 +733,7 @@ function it({
735
733
  ] });
736
734
  }
737
735
  function Be({ className: e, unstyled: t, ...r }) {
738
- const n = c(() => t ? e : F(m(
736
+ const n = c(() => t ? e : I(m(
739
737
  "relative bg-background min-w-full min-h-full border border-input shadow-lg"
740
738
  ), e), [t, e]);
741
739
  return /* @__PURE__ */ i("div", { className: n, ...r });
@@ -803,7 +801,7 @@ function We({
803
801
  timeout: u = 250,
804
802
  max: f = 3
805
803
  }) {
806
- const d = I(!1), [p, g] = E(!1), { context: h, refs: C } = H({ open: p, onOpenChange: g, nodeId: e }), { isMounted: y, styles: a } = L(h, {
804
+ const d = F(!1), [p, g] = E(!1), { context: h, refs: C } = H({ open: p, onOpenChange: g, nodeId: e }), { isMounted: y, styles: a } = L(h, {
807
805
  duration: u,
808
806
  initial: { opacity: 0, transform: `translateY(${l ? "" : "-"}50%)` }
809
807
  });
@@ -853,7 +851,7 @@ function st({
853
851
  }, [t, r]), u = c(() => m(
854
852
  "flex flex-col z-40 overflow-hidden",
855
853
  e
856
- ), [e]), f = c(() => r?.startsWith("bottom") || !1, [r]), d = I(/* @__PURE__ */ new Map()), [p, g] = E([]), h = E(0)[1];
854
+ ), [e]), f = c(() => r?.startsWith("bottom") || !1, [r]), d = F(/* @__PURE__ */ new Map()), [p, g] = E([]), h = E(0)[1];
857
855
  Q(() => fe.subscribe((a) => {
858
856
  ye(() => {
859
857
  if (a.type === "add")
@@ -892,11 +890,11 @@ function st({
892
890
  }) }) }) });
893
891
  }
894
892
  function lt({ className: e, ...t }) {
895
- const r = c(() => F(
893
+ const r = c(() => I(
896
894
  "inline-block animate-pulse rounded-md bg-accent",
897
895
  e
898
896
  ), [e]);
899
- return /* @__PURE__ */ i("span", { className: r, ...t });
897
+ return /* @__PURE__ */ i("div", { className: r, ...t });
900
898
  }
901
899
  function at({ className: e, ...t }) {
902
900
  const r = c(() => m(
@@ -908,7 +906,7 @@ function at({ className: e, ...t }) {
908
906
  return /* @__PURE__ */ i("div", { role: "group", className: r, ...t });
909
907
  }
910
908
  function ct({ value: e, max: t, className: r, ...n }) {
911
- const s = c(() => e ? Math.round(e / t * 100) : 0, [e, t]), o = c(() => F("relative overflow-hidden rounded-full bg-primary", r), [r]);
909
+ const s = c(() => e ? Math.round(e / t * 100) : 0, [e, t]), o = c(() => I("relative overflow-hidden rounded-full bg-primary", r), [r]);
912
910
  return /* @__PURE__ */ i("div", { role: "progressbar", className: o, "aria-valuemax": t, "aria-valuemin": 0, ...n, children: /* @__PURE__ */ i(
913
911
  "div",
914
912
  {
@@ -918,7 +916,7 @@ function ct({ value: e, max: t, className: r, ...n }) {
918
916
  ) });
919
917
  }
920
918
  function ut({ className: e, orientation: t = "horizontal", ...r }) {
921
- const n = c(() => F(m(
919
+ const n = c(() => I(m(
922
920
  "border-0 p-0 shrink-0 bg-input",
923
921
  t === "horizontal" ? "h-[1px] w-full" : "w-[1px] h-full"
924
922
  ), e), [e, t]);
@@ -935,13 +933,13 @@ export {
935
933
  Te as FormLabel,
936
934
  Ae as Input,
937
935
  Qe as InputField,
938
- lt as Placeholder,
939
936
  ae as Popover,
940
937
  W as Portal,
941
938
  ct as Progress,
942
939
  tt as Radio,
943
940
  et as Select,
944
941
  it as Sheet,
942
+ lt as Skeleton,
945
943
  Xe as Spinner,
946
944
  De as Switch,
947
945
  Me as Textarea,
@@ -949,7 +947,7 @@ export {
949
947
  He as ToastItem,
950
948
  Oe as Tooltip,
951
949
  pt as clsx,
952
- F as merge,
950
+ I as merge,
953
951
  fe as toast,
954
952
  je as varientButton
955
953
  };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "visits-style",
3
3
  "repository": "https://github.com/visits-works/visits-style",
4
4
  "homepage": "https://github.com/visits-works/visits-style",
5
- "version": "2.1.1",
5
+ "version": "2.1.2",
6
6
  "description": "VISITS Technologiesのreactデザインコンポーネント",
7
7
  "type": "module",
8
8
  "main": "./dist/index.cjs.js",