visits-style 2.1.2 → 2.1.4
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/README.md +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.es.js +201 -194
- package/package.json +12 -7
package/README.md
CHANGED
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(()=>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;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("clsx"),ie=require("tailwind-merge"),s=require("react/jsx-runtime"),n=require("react"),d=require("@floating-ui/react"),le=require("react-dom");function R(e,t){return t?ie.twMerge(e,t):e}function Y({className:e,...t}){const o=n.useMemo(()=>x("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:m,...f}){const p=n.useMemo(()=>x("font-medium",o?'after:content-["*"] after:text-danger after:text-sm after:pl-0.5':""),[o]),y=n.useMemo(()=>R("flex flex-col space-y-2",c),[c]);return s.jsxs("div",{className:y,...f,children:[e?s.jsx(Y,{className:p,htmlFor:r,children:e}):null,i&&a?s.jsx("p",{className:"text-xs text-muted pb-2",children:i}):null,s.jsx("div",{className:m,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:R(x("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:R(x("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:R(x("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,...m}){const f=n.useMemo(()=>R(x("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]),p=()=>{m.disabled||i?.(!e)};return s.jsxs("button",{type:"button",role:"checkbox",id:r||l,className:f,onClick:p,"aria-checked":e,...m,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:p,disabled:m.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:m=me,unstyled:f,zIndex:p=9996,role:y,...C},M)=>{const[g,u]=n.useState(!1),j=d.useId(),h=n.useRef(i),w=n.useRef(a),{refs:v,floatingStyles:S,context:T}=d.useFloating({nodeId:j,placement:e,middleware:[d.shift(),d.flip({fallbackAxisSideDirection:"end"}),d.offset({mainAxis:l.y,crossAxis:l.x})],open:g,onOpenChange:N=>{N?h.current?.(v.reference.current,v.floating.current):w.current?.(v.reference.current,v.floating.current),u(N)},whileElementsMounted:d.autoUpdate}),{isMounted:P,styles:O}=d.useTransitionStyles(T,{duration:m,initial({side:N}){let I="";return N==="top"?I="translateY(5%) scale(0.95)":N==="bottom"?I="translateY(-5%) scale(0.95)":N==="left"?I="translateX(5%) scale(0.95)":I="translateX(-5%) scale(0.95)",{opacity:0,transform:I}}}),A=n.useCallback(N=>{if($(N),c)return c();u(!1),w.current?.(v.reference.current,v.floating.current)},[c]);n.useEffect(()=>{if(r&&g)return u(!1)},[r,g]),n.useImperativeHandle(M,()=>({open:()=>{u(!0),h.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 h.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":g,disabled:r,onClick:$})),s.jsx(E,{disabled:r||!P,children:s.jsx(d.FloatingOverlay,{"data-testid":"vs-popover-shadow",onClick:A,style:{zIndex:p},autoFocus:!0,children:s.jsx("div",{role:y||"region",ref:v.setFloating,style:S,children:s.jsx(G,{unstyled:f,styles:O,...D({...C,onClick:$}),children:o})})})})]})});H.displayName="Popover";const G=n.forwardRef(({className:e,unstyled:t,styles:o,style:r={},...l},i)=>{const a=n.useMemo(()=>R(x("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:m,closeIcon:f,checkIcon:p,onChange:y,onClear:C,renderItem:M,sectionLabelStyle:g,buttonAreaStyle:u,clearLabelText:j,optionStyle:h,...w}){const v=n.useRef(null),[S,T]=n.useState(0),P=n.useMemo(()=>l?e:R(x("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=>{y?.(b),O||v.current?.close()},[y,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]),N=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=N===t,re=n.useMemo(()=>x("overflow-hidden overflow-ellipsis whitespace-nowrap",I?"text-muted":"text-text"),[I]),oe=n.useCallback((b,F)=>M?typeof b=="string"?M(b,{index:F,selected:!1,onChange:()=>{}}):M(b,{index:F,selected:D(b.value),onChange:()=>A(b.value)}):typeof b=="string"?s.jsx("h5",{className:x("font-normal py-1 px-2 text-muted",g),children:b},`optionheader-${F}`):s.jsx(ge,{selected:D(b.value),onChange:A,checkIcon:p,className:h,...b},b.label),[M,A,D,g,h,p]),se=n.useMemo(()=>x("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:N}),s.jsxs("div",{className:se,children:[C&&!I?s.jsx("div",{tabIndex:-1,role:"button",className:"size-6 p-1.5 rounded hover:bg-accent cursor-pointer","aria-label":j,onKeyDown:b=>{b.key!=="Enter"&&b.key!=="Space"||C()},onClick:b=>{b.stopPropagation(),C()},children:f}):null,m]})]}),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(()=>x("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(()=>x("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]),m=()=>{a.disabled||l?.(!e)};return s.jsxs("button",{type:"button",role:"radio",id:o||r,className:c,onClick:m,"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:m,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 m=n.useMemo(()=>R(x("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(()=>R("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform",e),[e]),p=()=>{a.disabled||o?.(!t)};return s.jsxs("button",{type:"button",role:"switch",id:l||i,className:m,onClick:p,"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:p,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),m=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",m.current){m.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 p;const y=()=>{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?y():p=window.setTimeout(y,c.current),()=>{f.forEach(window.cancelAnimationFrame),p&&window.clearTimeout(p)}},[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},m)=>{const[f,p]=n.useState(!1),y=d.useId(),{refs:C,floatingStyles:M,context:g}=d.useFloating({nodeId:y,open:f,placement:t,middleware:[d.shift(),d.flip(),d.offset({mainAxis:i.y,crossAxis:i.x})],whileElementsMounted:c?void 0:d.autoUpdate,onOpenChange:p}),{getReferenceProps:u,getFloatingProps:j}=d.useInteractions([d.useHover(g,{enabled:!c}),d.useClientPoint(g,{enabled:a})]),{isMounted:h,styles:w}=d.useTransitionStyles(g,{duration:l,initial:{opacity:0,transform:"scale(0.8)"}});n.useImperativeHandle(m,()=>({floating:C.floating,reference:C.reference,open:()=>p(!0),close:()=>p(!1)})),n.useEffect(()=>{c&&p(!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:C.setReference,...u()}),s.jsx(E,{disabled:c||!h,children:s.jsx("div",{role:"tooltip",className:"z-[9999]",ref:C.setFloating,...j({style:M}),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(()=>R(x("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 x("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(()=>x(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:m,onOpenChange:f,size:p,...y}){const C=n.useRef(c),M=n.useRef(!1),g=d.useId(),{refs:u,context:j}=d.useFloating({open:e,onOpenChange:f,nodeId:g}),{getFloatingProps:h}=d.useInteractions([d.useDismiss(j,{enabled:a,escapeKey:a,outsidePress:!1})]),{isMounted:w,styles:v}=d.useTransitionStyles(j,{duration:o,initial:{opacity:0,transform:"scale(0.8)"}});n.useEffect(()=>{M.current!==w&&(M.current=w,!w&&C.current?.())},[w]);const S=n.useCallback(()=>{i&&f?.(!1)},[f,i]);C.current=c;const T=n.useMemo(()=>x("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(()=>R("transition ease-in-out",m),[m]);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:p,style:v,onClick:$,...h({...y}),children:t})})})}const V=n.forwardRef(({size:e,className:t,...o},r)=>{const l=n.useMemo(()=>x(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,onOpen:a,...c}){const m=d.useId(),f=n.useRef(!1),p=n.useRef(a),y=n.useRef(i),{refs:C,context:M}=d.useFloating({open:e,onOpenChange:o,nodeId:m}),{isMounted:g,styles:u}=d.useTransitionStyles(M,{duration:t,initial(){let h="translateX(75%)";return r==="left"?h="translateX(-75%)":r==="top"?h="translateY(-75%)":r==="bottom"&&(h="translateY(75%)"),{opacity:0,transform:h}}});n.useEffect(()=>{if(f.current!==g){if(f.current=g,g){p.current?.();return}y.current?.()}},[g]);const j=n.useMemo(()=>x("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 y.current=i,p.current=a,s.jsxs(E,{disabled:!g,children:[l?s.jsx(d.FloatingOverlay,{className:"bg-backdrop",style:{opacity:u.opacity},onClick:()=>o?.(!1)}):null,s.jsx("div",{ref:C.setFloating,className:j,role:"dialog",style:u,children:s.jsx(Ce,{...c})})]})}function Ce({className:e,unstyled:t,...o}){const r=n.useMemo(()=>t?e:R(x("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}=Ne();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 Re({id:e,type:t,index:o,duration:r=5e3,className:l,children:i,inverted:a,timeout:c=250,max:m=3}){const f=n.useRef(!1),[p,y]=n.useState(!1),{context:C,refs:M}=d.useFloating({open:p,onOpenChange:y,nodeId:e}),{isMounted:g,styles:u}=d.useTransitionStyles(C,{duration:c,initial:{opacity:0,transform:`translateY(${a?"":"-"}50%)`}});n.useLayoutEffect(()=>{y(o<=m)},[o,m]),n.useEffect(()=>{f.current!==g&&(g||L.remove(e),f.current=g)},[g,e]),n.useEffect(()=>{if(!r)return;const w=window.setTimeout(()=>y(!1),r);return()=>window.clearTimeout(w)},[r,e]);const j=n.useCallback(()=>{t!=="loading"&&y(!1)},[t]),h=n.useMemo(()=>x("relative flex w-fit transition-transform ease-in-out cursor-pointer",l),[l]);return g?s.jsx("li",{role:"log",tabIndex:-1,ref:M.setFloating,className:h,style:u,onClick:j,children:i}):null}const ne=n.createContext({});function Ne(){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(()=>x("flex flex-col z-40 overflow-hidden",e),[e]),m=n.useMemo(()=>o?.startsWith("bottom")||!1,[o]),f=n.useRef(new Map),[p,y]=n.useState([]),C=n.useState(0)[1];q(()=>L.subscribe(u=>{n.startTransition(()=>{if(u.type==="add")f.current.set(u.id,u.config),y(j=>[...j,u.id]);else if(u.type==="remove"){if(!f.current.delete(u.id))return;y(h=>{const w=new Set(h);return w.has(u.id)?(w.delete(u.id),Array.from(w)):h})}else if(u.type==="update"){const j=f.current.get(u.id);if(!j)return;f.current.set(u.id,{...j,...u.config}),C(h=>h+1)}})}),[]);const M=n.useMemo(()=>({icons:i}),[i]),g=p.length;return s.jsx(E,{children:s.jsx("ol",{className:c,style:a,"aria-live":"polite",children:s.jsx(ne.Provider,{value:M,children:p.map((u,j)=>{const h=f.current.get(u);if(!h)return null;const{className:w,duration:v,...S}=h;return s.jsx(Re,{id:u,index:g-j,className:w,duration:v,inverted:m,max:r,children:n.createElement(l,S)},u)})})})})}function Ie({className:e,...t}){const o=n.useMemo(()=>R("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(()=>x("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(()=>R("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(()=>R(x("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=x;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=R;exports.toast=L;exports.varientButton=Q;
|
package/dist/index.d.ts
CHANGED
|
@@ -278,7 +278,7 @@ export declare interface SelectProps<T> extends Omit<ButtonHTMLAttributes<HTMLBu
|
|
|
278
278
|
clearLabelText?: string;
|
|
279
279
|
}
|
|
280
280
|
|
|
281
|
-
export declare function Sheet({ open, timeout, onOpenChange, position, overlay, onExited, ...rest }: SheetProps): JSX.Element;
|
|
281
|
+
export declare function Sheet({ open, timeout, onOpenChange, position, overlay, onExited, onOpen, ...rest }: SheetProps): JSX.Element;
|
|
282
282
|
|
|
283
283
|
export declare interface SheetProps extends HTMLAttributes<HTMLDivElement> {
|
|
284
284
|
/** trueの場合、モーダルを表示します。 */
|
|
@@ -291,8 +291,9 @@ export declare interface SheetProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
291
291
|
open: number;
|
|
292
292
|
close: number;
|
|
293
293
|
};
|
|
294
|
-
/** モーダルのtransition exitが完了した時に発火されるcallback */
|
|
295
294
|
onOpenChange?: (open: boolean) => void;
|
|
295
|
+
/** 開けた場合のコールバック */
|
|
296
|
+
onOpen?: () => void;
|
|
296
297
|
/** モーダルのtransition exitが完了した時に発火されるcallback */
|
|
297
298
|
onExited?: () => void;
|
|
298
299
|
overlay?: boolean;
|
package/dist/index.es.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import h 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
|
|
5
|
+
import { useMemo as c, Children as z, cloneElement as Z, forwardRef as S, useLayoutEffect as ne, useEffect as M, useState as E, useRef as F, useCallback as j, 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
8
|
function I(e, t) {
|
|
9
9
|
return t ? he(e, t) : e;
|
|
10
10
|
}
|
|
11
11
|
function Te({ className: e, ...t }) {
|
|
12
|
-
const r = c(() =>
|
|
12
|
+
const r = c(() => h("leading-none peer-disabled:opacity-70", e), [e]);
|
|
13
13
|
return /* @__PURE__ */ i("label", { className: r, ...t });
|
|
14
14
|
}
|
|
15
15
|
function Je({
|
|
@@ -21,17 +21,17 @@ function Je({
|
|
|
21
21
|
help: o,
|
|
22
22
|
helpBefore: l,
|
|
23
23
|
className: u,
|
|
24
|
-
innerClass:
|
|
24
|
+
innerClass: p,
|
|
25
25
|
...d
|
|
26
26
|
}) {
|
|
27
|
-
const
|
|
27
|
+
const f = c(() => h(
|
|
28
28
|
"font-medium",
|
|
29
29
|
r ? 'after:content-["*"] after:text-danger after:text-sm after:pl-0.5' : ""
|
|
30
|
-
), [r]),
|
|
31
|
-
return /* @__PURE__ */ k("div", { className:
|
|
32
|
-
e ? /* @__PURE__ */ i(Te, { className:
|
|
30
|
+
), [r]), y = c(() => I("flex flex-col space-y-2", u), [u]);
|
|
31
|
+
return /* @__PURE__ */ k("div", { className: y, ...d, children: [
|
|
32
|
+
e ? /* @__PURE__ */ i(Te, { className: f, htmlFor: n, children: e }) : null,
|
|
33
33
|
o && l ? /* @__PURE__ */ i("p", { className: "text-xs text-muted pb-2", children: o }) : null,
|
|
34
|
-
/* @__PURE__ */ i("div", { className:
|
|
34
|
+
/* @__PURE__ */ i("div", { className: p, children: Pe(t, !!s) }),
|
|
35
35
|
o && !l && !s ? /* @__PURE__ */ i("p", { className: "text-xs text-muted", children: o }) : null,
|
|
36
36
|
s ? /* @__PURE__ */ i("p", { className: "text-xs text-danger", children: s }) : null
|
|
37
37
|
] });
|
|
@@ -45,21 +45,21 @@ 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 : I(
|
|
48
|
+
const s = c(() => t ? r : I(h(
|
|
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"
|
|
52
52
|
), r), [r, e, t]);
|
|
53
53
|
return /* @__PURE__ */ i("div", { className: s, ...n });
|
|
54
54
|
}
|
|
55
|
-
const
|
|
55
|
+
const Re = S(({
|
|
56
56
|
className: e,
|
|
57
57
|
type: t,
|
|
58
58
|
error: r,
|
|
59
59
|
unstyled: n,
|
|
60
60
|
...s
|
|
61
61
|
}, o) => {
|
|
62
|
-
const l = c(() => n ? e : I(
|
|
62
|
+
const l = c(() => n ? e : I(h(
|
|
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",
|
|
@@ -67,22 +67,22 @@ const Ae = S(({
|
|
|
67
67
|
), e), [e, t, r, n]);
|
|
68
68
|
return /* @__PURE__ */ i("input", { ref: o, type: t, className: l, ...s });
|
|
69
69
|
});
|
|
70
|
-
|
|
71
|
-
const
|
|
70
|
+
Re.displayName = "Input";
|
|
71
|
+
const Ae = S(({
|
|
72
72
|
className: e,
|
|
73
73
|
error: t,
|
|
74
74
|
unstyled: r,
|
|
75
75
|
...n
|
|
76
76
|
}, s) => {
|
|
77
|
-
const o = c(() => r ? e : I(
|
|
77
|
+
const o = c(() => r ? e : I(h(
|
|
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"
|
|
81
81
|
), e), [e, t, r]);
|
|
82
82
|
return /* @__PURE__ */ i("textarea", { ref: s, className: o, ...n });
|
|
83
83
|
});
|
|
84
|
-
|
|
85
|
-
function
|
|
84
|
+
Ae.displayName = "Textarea";
|
|
85
|
+
function Me() {
|
|
86
86
|
return /* @__PURE__ */ i("svg", { xmlns: "http://www.w3.org/2000/svg", width: "30", height: "30", viewBox: "0 0 30 30", children: /* @__PURE__ */ i("rect", { width: "20", height: "3", y: "13.5", x: "4.5", fill: "currentColor", stroke: "none", rx: "2" }) });
|
|
87
87
|
}
|
|
88
88
|
function Ve({
|
|
@@ -94,14 +94,14 @@ function Ve({
|
|
|
94
94
|
onChange: o,
|
|
95
95
|
value: l,
|
|
96
96
|
checkIcon: u,
|
|
97
|
-
...
|
|
97
|
+
...p
|
|
98
98
|
}) {
|
|
99
|
-
const d = c(() => I(
|
|
99
|
+
const d = c(() => I(h(
|
|
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"
|
|
103
|
-
), r), [e, t, r]),
|
|
104
|
-
|
|
103
|
+
), r), [e, t, r]), f = () => {
|
|
104
|
+
p.disabled || o?.(!e);
|
|
105
105
|
};
|
|
106
106
|
return /* @__PURE__ */ k(
|
|
107
107
|
"button",
|
|
@@ -110,12 +110,12 @@ function Ve({
|
|
|
110
110
|
role: "checkbox",
|
|
111
111
|
id: n || s,
|
|
112
112
|
className: d,
|
|
113
|
-
onClick:
|
|
113
|
+
onClick: f,
|
|
114
114
|
"aria-checked": e,
|
|
115
|
-
...
|
|
115
|
+
...p,
|
|
116
116
|
children: [
|
|
117
117
|
e ? u : null,
|
|
118
|
-
t && !e ? /* @__PURE__ */ i(
|
|
118
|
+
t && !e ? /* @__PURE__ */ i(Me, {}) : null,
|
|
119
119
|
/* @__PURE__ */ i(
|
|
120
120
|
"input",
|
|
121
121
|
{
|
|
@@ -124,8 +124,8 @@ function Ve({
|
|
|
124
124
|
name: s,
|
|
125
125
|
checked: e,
|
|
126
126
|
value: l,
|
|
127
|
-
onChange:
|
|
128
|
-
disabled:
|
|
127
|
+
onChange: f,
|
|
128
|
+
disabled: p.disabled,
|
|
129
129
|
style: { position: "absolute", pointerEvents: "none", top: 0, left: 0, width: 1, height: 1, opacity: 0 }
|
|
130
130
|
}
|
|
131
131
|
)
|
|
@@ -133,7 +133,7 @@ function Ve({
|
|
|
133
133
|
}
|
|
134
134
|
);
|
|
135
135
|
}
|
|
136
|
-
const Se = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", Q = Se ? ne :
|
|
136
|
+
const Se = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", Q = Se ? ne : M;
|
|
137
137
|
function W({ children: e, container: t, disabled: r }) {
|
|
138
138
|
const [n, s] = E(null);
|
|
139
139
|
return Q(() => {
|
|
@@ -156,40 +156,40 @@ const _e = { open: 150, close: 75 }, ae = S(({
|
|
|
156
156
|
onOpen: o,
|
|
157
157
|
onClose: l,
|
|
158
158
|
onManualClose: u,
|
|
159
|
-
timeout:
|
|
159
|
+
timeout: p = _e,
|
|
160
160
|
unstyled: d,
|
|
161
|
-
zIndex:
|
|
162
|
-
role:
|
|
163
|
-
...
|
|
164
|
-
},
|
|
165
|
-
const [
|
|
166
|
-
nodeId:
|
|
161
|
+
zIndex: f = 9996,
|
|
162
|
+
role: y,
|
|
163
|
+
...C
|
|
164
|
+
}, N) => {
|
|
165
|
+
const [m, a] = E(!1), v = K(), g = F(o), x = F(l), { refs: w, floatingStyles: _, context: D } = H({
|
|
166
|
+
nodeId: v,
|
|
167
167
|
placement: e,
|
|
168
168
|
middleware: [
|
|
169
169
|
ie(),
|
|
170
170
|
se({ fallbackAxisSideDirection: "end" }),
|
|
171
171
|
le({ mainAxis: s.y, crossAxis: s.x })
|
|
172
172
|
],
|
|
173
|
-
open:
|
|
173
|
+
open: m,
|
|
174
174
|
onOpenChange: (T) => {
|
|
175
|
-
T ?
|
|
175
|
+
T ? g.current?.(w.reference.current, w.floating.current) : x.current?.(w.reference.current, w.floating.current), a(T);
|
|
176
176
|
},
|
|
177
177
|
whileElementsMounted: oe
|
|
178
|
-
}), { isMounted:
|
|
179
|
-
duration:
|
|
178
|
+
}), { isMounted: O, styles: Y } = L(D, {
|
|
179
|
+
duration: p,
|
|
180
180
|
initial({ side: T }) {
|
|
181
|
-
let
|
|
182
|
-
return T === "top" ?
|
|
181
|
+
let R = "";
|
|
182
|
+
return T === "top" ? R = "translateY(5%) scale(0.95)" : T === "bottom" ? R = "translateY(-5%) scale(0.95)" : T === "left" ? R = "translateX(5%) scale(0.95)" : R = "translateX(-5%) scale(0.95)", { opacity: 0, transform: R };
|
|
183
183
|
}
|
|
184
|
-
}), $ =
|
|
184
|
+
}), $ = j((T) => {
|
|
185
185
|
if (q(T), u) return u();
|
|
186
186
|
a(!1), x.current?.(w.reference.current, w.floating.current);
|
|
187
187
|
}, [u]);
|
|
188
|
-
|
|
189
|
-
if (n &&
|
|
190
|
-
}, [n,
|
|
188
|
+
M(() => {
|
|
189
|
+
if (n && m) return a(!1);
|
|
190
|
+
}, [n, m]), re(N, () => ({
|
|
191
191
|
open: () => {
|
|
192
|
-
a(!0),
|
|
192
|
+
a(!0), g.current?.(w.reference.current, w.floating.current);
|
|
193
193
|
},
|
|
194
194
|
close: () => {
|
|
195
195
|
a(!1), x.current?.(w.reference.current, w.floating.current);
|
|
@@ -199,28 +199,28 @@ const _e = { open: 150, close: 75 }, ae = S(({
|
|
|
199
199
|
const { getFloatingProps: B, getReferenceProps: X } = U([
|
|
200
200
|
Ce(D, { enabled: !n })
|
|
201
201
|
]);
|
|
202
|
-
return
|
|
202
|
+
return g.current = o, x.current = l, /* @__PURE__ */ k(te, { children: [
|
|
203
203
|
Z(z.only(t), X({
|
|
204
204
|
ref: w.setReference,
|
|
205
205
|
tabIndex: 0,
|
|
206
206
|
role: "button",
|
|
207
|
-
"aria-expanded":
|
|
207
|
+
"aria-expanded": m,
|
|
208
208
|
disabled: n,
|
|
209
209
|
onClick: q
|
|
210
210
|
})),
|
|
211
|
-
/* @__PURE__ */ i(W, { disabled: n || !
|
|
211
|
+
/* @__PURE__ */ i(W, { disabled: n || !O, children: /* @__PURE__ */ i(
|
|
212
212
|
J,
|
|
213
213
|
{
|
|
214
214
|
"data-testid": "vs-popover-shadow",
|
|
215
215
|
onClick: $,
|
|
216
|
-
style: { zIndex:
|
|
216
|
+
style: { zIndex: f },
|
|
217
217
|
autoFocus: !0,
|
|
218
|
-
children: /* @__PURE__ */ i("div", { role:
|
|
218
|
+
children: /* @__PURE__ */ i("div", { role: y || "region", ref: w.setFloating, style: _, children: /* @__PURE__ */ i(
|
|
219
219
|
ce,
|
|
220
220
|
{
|
|
221
221
|
unstyled: d,
|
|
222
222
|
styles: Y,
|
|
223
|
-
...B({ ...
|
|
223
|
+
...B({ ...C, onClick: q }),
|
|
224
224
|
children: r
|
|
225
225
|
}
|
|
226
226
|
) })
|
|
@@ -236,7 +236,7 @@ const ce = S(({
|
|
|
236
236
|
style: n = {},
|
|
237
237
|
...s
|
|
238
238
|
}, o) => {
|
|
239
|
-
const l = c(() => I(
|
|
239
|
+
const l = c(() => I(h(
|
|
240
240
|
"z-20 w-auto h-auto outline-none transition-transform ease-in-out",
|
|
241
241
|
t ? null : "border border-accent rounded-md shadow-lg p-1 bg-background"
|
|
242
242
|
), e), [e, t]);
|
|
@@ -252,28 +252,28 @@ function et({
|
|
|
252
252
|
disabled: o,
|
|
253
253
|
value: l,
|
|
254
254
|
maxHeight: u = 408,
|
|
255
|
-
arrowIcon:
|
|
255
|
+
arrowIcon: p,
|
|
256
256
|
closeIcon: d,
|
|
257
|
-
checkIcon:
|
|
258
|
-
onChange:
|
|
259
|
-
onClear:
|
|
260
|
-
renderItem:
|
|
261
|
-
sectionLabelStyle:
|
|
257
|
+
checkIcon: f,
|
|
258
|
+
onChange: y,
|
|
259
|
+
onClear: C,
|
|
260
|
+
renderItem: N,
|
|
261
|
+
sectionLabelStyle: m,
|
|
262
262
|
buttonAreaStyle: a,
|
|
263
|
-
clearLabelText:
|
|
264
|
-
optionStyle:
|
|
263
|
+
clearLabelText: v,
|
|
264
|
+
optionStyle: g,
|
|
265
265
|
...x
|
|
266
266
|
}) {
|
|
267
|
-
const w = F(null), [_, D] = E(0),
|
|
267
|
+
const w = F(null), [_, D] = E(0), O = c(() => s ? e : I(h(
|
|
268
268
|
"flex items-center justify-between rounded-md border bg-background px-3 py-2 w-full overflow-hidden cursor-pointer",
|
|
269
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",
|
|
270
270
|
n ? "border-danger hover:border-danger-fore" : "border-input not-disabled:hover:border-input-fore"
|
|
271
|
-
), e), [e, n, s]), Y = c(() => Array.isArray(l), []), $ =
|
|
272
|
-
|
|
273
|
-
}, [
|
|
274
|
-
const b = {},
|
|
275
|
-
for (let P = 0, G =
|
|
276
|
-
const V =
|
|
271
|
+
), e), [e, n, s]), Y = c(() => Array.isArray(l), []), $ = j((b) => {
|
|
272
|
+
y?.(b), Y || w.current?.close();
|
|
273
|
+
}, [y, Y]), B = j((b) => Array.isArray(l) ? l.indexOf(b) > -1 : l === b, [l]), X = c(() => {
|
|
274
|
+
const b = {}, A = r.filter((P) => typeof P != "string");
|
|
275
|
+
for (let P = 0, G = A.length; P < G; P += 1) {
|
|
276
|
+
const V = A[P];
|
|
277
277
|
b[`${V.value}`] = V.label;
|
|
278
278
|
}
|
|
279
279
|
return b;
|
|
@@ -281,64 +281,64 @@ function et({
|
|
|
281
281
|
if (!l) return t;
|
|
282
282
|
if (Array.isArray(l)) {
|
|
283
283
|
if (!l.length) return t;
|
|
284
|
-
const b = [...l].sort(),
|
|
284
|
+
const b = [...l].sort(), A = [];
|
|
285
285
|
for (let P = 0, G = b.length; P < G; P += 1)
|
|
286
|
-
|
|
287
|
-
return
|
|
286
|
+
A[P] = X[`${b[P]}`] || "";
|
|
287
|
+
return A.filter(Boolean).join(",") || t;
|
|
288
288
|
}
|
|
289
289
|
return X[`${l}`] || t;
|
|
290
|
-
}, [t, l, X]),
|
|
290
|
+
}, [t, l, X]), R = T === t, be = c(() => h(
|
|
291
291
|
"overflow-hidden overflow-ellipsis whitespace-nowrap",
|
|
292
|
-
|
|
293
|
-
), [
|
|
294
|
-
} }) :
|
|
295
|
-
index:
|
|
292
|
+
R ? "text-muted" : "text-text"
|
|
293
|
+
), [R]), me = j((b, A) => N ? typeof b == "string" ? N(b, { index: A, selected: !1, onChange: () => {
|
|
294
|
+
} }) : N(b, {
|
|
295
|
+
index: A,
|
|
296
296
|
selected: B(b.value),
|
|
297
297
|
onChange: () => $(b.value)
|
|
298
298
|
}) : typeof b == "string" ? /* @__PURE__ */ i(
|
|
299
299
|
"h5",
|
|
300
300
|
{
|
|
301
|
-
className:
|
|
301
|
+
className: h("font-normal py-1 px-2 text-muted", m),
|
|
302
302
|
children: b
|
|
303
303
|
},
|
|
304
|
-
`optionheader-${
|
|
304
|
+
`optionheader-${A}`
|
|
305
305
|
) : /* @__PURE__ */ i(
|
|
306
306
|
Ee,
|
|
307
307
|
{
|
|
308
308
|
selected: B(b.value),
|
|
309
309
|
onChange: $,
|
|
310
|
-
checkIcon:
|
|
311
|
-
className:
|
|
310
|
+
checkIcon: f,
|
|
311
|
+
className: g,
|
|
312
312
|
...b
|
|
313
313
|
},
|
|
314
314
|
b.label
|
|
315
|
-
), [
|
|
315
|
+
), [N, $, B, m, g, f]), ge = c(() => h(
|
|
316
316
|
"relative flex items-center pr-4 space-x-2",
|
|
317
317
|
a
|
|
318
318
|
), [a]);
|
|
319
319
|
return /* @__PURE__ */ i(
|
|
320
320
|
ae,
|
|
321
321
|
{
|
|
322
|
-
label: /* @__PURE__ */ k("button", { type: "button", className:
|
|
322
|
+
label: /* @__PURE__ */ k("button", { type: "button", className: O, disabled: o, ...x, children: [
|
|
323
323
|
/* @__PURE__ */ i("span", { className: be, children: T }),
|
|
324
324
|
/* @__PURE__ */ k("div", { className: ge, children: [
|
|
325
|
-
|
|
325
|
+
C && !R ? /* @__PURE__ */ i(
|
|
326
326
|
"div",
|
|
327
327
|
{
|
|
328
328
|
tabIndex: -1,
|
|
329
329
|
role: "button",
|
|
330
330
|
className: "size-6 p-1.5 rounded hover:bg-accent cursor-pointer",
|
|
331
|
-
"aria-label":
|
|
331
|
+
"aria-label": v,
|
|
332
332
|
onKeyDown: (b) => {
|
|
333
|
-
b.key !== "Enter" && b.key !== "Space" ||
|
|
333
|
+
b.key !== "Enter" && b.key !== "Space" || C();
|
|
334
334
|
},
|
|
335
335
|
onClick: (b) => {
|
|
336
|
-
b.stopPropagation(),
|
|
336
|
+
b.stopPropagation(), C();
|
|
337
337
|
},
|
|
338
338
|
children: d
|
|
339
339
|
}
|
|
340
340
|
) : null,
|
|
341
|
-
|
|
341
|
+
p
|
|
342
342
|
] })
|
|
343
343
|
] }),
|
|
344
344
|
ref: w,
|
|
@@ -364,7 +364,7 @@ function Ee({
|
|
|
364
364
|
checkIcon: s,
|
|
365
365
|
onChange: o
|
|
366
366
|
}) {
|
|
367
|
-
const l = c(() =>
|
|
367
|
+
const l = c(() => h(
|
|
368
368
|
"flex items-center w-full hover:bg-accent rounded p-1 cursor-pointer",
|
|
369
369
|
e
|
|
370
370
|
), [e]);
|
|
@@ -384,12 +384,12 @@ function Ee({
|
|
|
384
384
|
);
|
|
385
385
|
}
|
|
386
386
|
function tt({ checked: e, className: t, id: r, name: n, onChange: s, value: o, ...l }) {
|
|
387
|
-
const u = c(() =>
|
|
387
|
+
const u = c(() => h(
|
|
388
388
|
"relative inline-flex justify-center items-center border border-input w-4.5 h-4.5 rounded-full",
|
|
389
389
|
"cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed not-disabled:hover:border-input-fore",
|
|
390
390
|
e ? "[&_i]:bg-primary disabled:[&_i]:bg-text disabled:border-input" : "",
|
|
391
391
|
t
|
|
392
|
-
), [t, e]),
|
|
392
|
+
), [t, e]), p = () => {
|
|
393
393
|
l.disabled || s?.(!e);
|
|
394
394
|
};
|
|
395
395
|
return /* @__PURE__ */ k(
|
|
@@ -399,7 +399,7 @@ function tt({ checked: e, className: t, id: r, name: n, onChange: s, value: o, .
|
|
|
399
399
|
role: "radio",
|
|
400
400
|
id: r || n,
|
|
401
401
|
className: u,
|
|
402
|
-
onClick:
|
|
402
|
+
onClick: p,
|
|
403
403
|
"aria-checked": e,
|
|
404
404
|
...l,
|
|
405
405
|
children: [
|
|
@@ -418,7 +418,7 @@ function tt({ checked: e, className: t, id: r, name: n, onChange: s, value: o, .
|
|
|
418
418
|
name: n,
|
|
419
419
|
checked: e,
|
|
420
420
|
value: o,
|
|
421
|
-
onChange:
|
|
421
|
+
onChange: p,
|
|
422
422
|
disabled: l.disabled,
|
|
423
423
|
style: { position: "absolute", pointerEvents: "none", top: 0, left: 0, width: 1, height: 1, opacity: 0 }
|
|
424
424
|
}
|
|
@@ -436,7 +436,7 @@ const De = S(({
|
|
|
436
436
|
name: o,
|
|
437
437
|
...l
|
|
438
438
|
}, u) => {
|
|
439
|
-
const
|
|
439
|
+
const p = c(() => I(h(
|
|
440
440
|
"inline-flex shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors",
|
|
441
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",
|
|
442
442
|
"w-11",
|
|
@@ -444,7 +444,7 @@ const De = S(({
|
|
|
444
444
|
), e), [e, t]), d = c(() => I(
|
|
445
445
|
"pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform",
|
|
446
446
|
e
|
|
447
|
-
), [e]),
|
|
447
|
+
), [e]), f = () => {
|
|
448
448
|
l.disabled || r?.(!t);
|
|
449
449
|
};
|
|
450
450
|
return /* @__PURE__ */ k(
|
|
@@ -453,8 +453,8 @@ const De = S(({
|
|
|
453
453
|
type: "button",
|
|
454
454
|
role: "switch",
|
|
455
455
|
id: s || o,
|
|
456
|
-
className:
|
|
457
|
-
onClick:
|
|
456
|
+
className: p,
|
|
457
|
+
onClick: f,
|
|
458
458
|
"aria-checked": t,
|
|
459
459
|
...l,
|
|
460
460
|
children: [
|
|
@@ -468,7 +468,7 @@ const De = S(({
|
|
|
468
468
|
name: o,
|
|
469
469
|
checked: t,
|
|
470
470
|
value: n,
|
|
471
|
-
onChange:
|
|
471
|
+
onChange: f,
|
|
472
472
|
disabled: l.disabled,
|
|
473
473
|
style: { position: "absolute", pointerEvents: "none", top: 0, left: 0, width: 1, height: 1, opacity: 0 }
|
|
474
474
|
}
|
|
@@ -479,13 +479,13 @@ const De = S(({
|
|
|
479
479
|
});
|
|
480
480
|
De.displayName = "Switch";
|
|
481
481
|
function nt({ header: e, show: t, children: r, timeout: n = 300, ...s }) {
|
|
482
|
-
const o = F(null), l = F(0), u = F(0),
|
|
483
|
-
return
|
|
482
|
+
const o = F(null), l = F(0), u = F(0), p = F(!0);
|
|
483
|
+
return M(() => {
|
|
484
484
|
u.current = n;
|
|
485
485
|
}, [n]), Q(() => {
|
|
486
486
|
if (!o.current) return;
|
|
487
|
-
if (o.current.style.overflow = "hidden", o.current.style.opacity = "1",
|
|
488
|
-
|
|
487
|
+
if (o.current.style.overflow = "hidden", o.current.style.opacity = "1", p.current) {
|
|
488
|
+
p.current = !1, o.current.style.height = t ? "auto" : "0px", t ? window.requestAnimationFrame(() => {
|
|
489
489
|
o.current && (l.current = o.current.offsetHeight);
|
|
490
490
|
}) : (window.requestAnimationFrame(() => {
|
|
491
491
|
o.current && (o.current.style.height = "auto", l.current = o.current.offsetHeight, o.current.style.height = "0px");
|
|
@@ -499,14 +499,14 @@ function nt({ header: e, show: t, children: r, timeout: n = 300, ...s }) {
|
|
|
499
499
|
o.current && (o.current.style.height = `${t ? l.current : 0}px`, o.current.style.opacity = t ? "1" : "0");
|
|
500
500
|
});
|
|
501
501
|
});
|
|
502
|
-
let
|
|
503
|
-
const
|
|
502
|
+
let f;
|
|
503
|
+
const y = () => {
|
|
504
504
|
o.current && (t ? (o.current.style.height = "auto", o.current.style.overflow = "", o.current.style.opacity = "", window.requestAnimationFrame(() => {
|
|
505
505
|
o.current && (l.current = o.current.offsetHeight);
|
|
506
506
|
})) : o.current.style.height = "0px");
|
|
507
507
|
};
|
|
508
|
-
return u.current === 0 ?
|
|
509
|
-
d.forEach(window.cancelAnimationFrame),
|
|
508
|
+
return u.current === 0 ? y() : f = window.setTimeout(y, u.current), () => {
|
|
509
|
+
d.forEach(window.cancelAnimationFrame), f && window.clearTimeout(f);
|
|
510
510
|
};
|
|
511
511
|
}, [t]), /* @__PURE__ */ k("div", { ...s, children: [
|
|
512
512
|
e,
|
|
@@ -523,7 +523,7 @@ function nt({ header: e, show: t, children: r, timeout: n = 300, ...s }) {
|
|
|
523
523
|
)
|
|
524
524
|
] });
|
|
525
525
|
}
|
|
526
|
-
const
|
|
526
|
+
const je = S(({
|
|
527
527
|
children: e,
|
|
528
528
|
position: t = "bottom",
|
|
529
529
|
label: r,
|
|
@@ -532,9 +532,9 @@ const Oe = S(({
|
|
|
532
532
|
offset: o = { x: 0, y: 6 },
|
|
533
533
|
clientPoint: l = !1,
|
|
534
534
|
disabled: u
|
|
535
|
-
},
|
|
536
|
-
const [d,
|
|
537
|
-
nodeId:
|
|
535
|
+
}, p) => {
|
|
536
|
+
const [d, f] = E(!1), y = K(), { refs: C, floatingStyles: N, context: m } = H({
|
|
537
|
+
nodeId: y,
|
|
538
538
|
open: d,
|
|
539
539
|
placement: t,
|
|
540
540
|
middleware: [
|
|
@@ -543,46 +543,46 @@ const Oe = S(({
|
|
|
543
543
|
le({ mainAxis: o.y, crossAxis: o.x })
|
|
544
544
|
],
|
|
545
545
|
whileElementsMounted: u ? void 0 : oe,
|
|
546
|
-
onOpenChange:
|
|
547
|
-
}), { getReferenceProps: a, getFloatingProps:
|
|
548
|
-
Ne(
|
|
549
|
-
ke(
|
|
550
|
-
]), { isMounted:
|
|
546
|
+
onOpenChange: f
|
|
547
|
+
}), { getReferenceProps: a, getFloatingProps: v } = U([
|
|
548
|
+
Ne(m, { enabled: !u }),
|
|
549
|
+
ke(m, { enabled: l })
|
|
550
|
+
]), { isMounted: g, styles: x } = L(m, {
|
|
551
551
|
duration: s,
|
|
552
552
|
initial: { opacity: 0, transform: "scale(0.8)" }
|
|
553
553
|
});
|
|
554
|
-
re(
|
|
555
|
-
floating:
|
|
556
|
-
reference:
|
|
557
|
-
open: () =>
|
|
558
|
-
close: () =>
|
|
559
|
-
})),
|
|
560
|
-
u &&
|
|
554
|
+
re(p, () => ({
|
|
555
|
+
floating: C.floating,
|
|
556
|
+
reference: C.reference,
|
|
557
|
+
open: () => f(!0),
|
|
558
|
+
close: () => f(!1)
|
|
559
|
+
})), M(() => {
|
|
560
|
+
u && f(!1);
|
|
561
561
|
}, [u]);
|
|
562
562
|
const w = typeof e == "string" ? /* @__PURE__ */ i("span", { children: e }) : e;
|
|
563
563
|
return /* @__PURE__ */ k(te, { children: [
|
|
564
564
|
Z(z.only(w), {
|
|
565
|
-
ref:
|
|
565
|
+
ref: C.setReference,
|
|
566
566
|
...a()
|
|
567
567
|
}),
|
|
568
|
-
/* @__PURE__ */ i(W, { disabled: u || !
|
|
568
|
+
/* @__PURE__ */ i(W, { disabled: u || !g, children: /* @__PURE__ */ i("div", { role: "tooltip", className: "z-[9999]", ref: C.setFloating, ...v({ style: N }), children: /* @__PURE__ */ i(ue, { className: n, style: x, children: r }) }) })
|
|
569
569
|
] });
|
|
570
570
|
});
|
|
571
|
-
|
|
571
|
+
je.displayName = "Tooltip";
|
|
572
572
|
const ue = S(({
|
|
573
573
|
className: e,
|
|
574
574
|
custom: t,
|
|
575
575
|
...r
|
|
576
576
|
}, n) => {
|
|
577
|
-
const s = c(() => I(
|
|
577
|
+
const s = c(() => I(h(
|
|
578
578
|
"relative w-auto h-auto outline-none transition-transform ease-in-out whitespace-pre",
|
|
579
579
|
t ? null : "border border-accent rounded shadow-md px-3 py-1 bg-background"
|
|
580
580
|
), e), [e, t]);
|
|
581
581
|
return /* @__PURE__ */ i("div", { ref: n, className: s, ...r });
|
|
582
582
|
});
|
|
583
583
|
ue.displayName = "TooltipContent";
|
|
584
|
-
function
|
|
585
|
-
return
|
|
584
|
+
function Oe({ variant: e, size: t }) {
|
|
585
|
+
return h(
|
|
586
586
|
"inline-flex items-center justify-center whitespace-nowrap transition-colors rounded-md cursor-pointer",
|
|
587
587
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
588
588
|
"disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-auto",
|
|
@@ -602,7 +602,7 @@ function je({ variant: e, size: t }) {
|
|
|
602
602
|
);
|
|
603
603
|
}
|
|
604
604
|
function rt({ size: e, variant: t, className: r, ...n }) {
|
|
605
|
-
const s = c(() =>
|
|
605
|
+
const s = c(() => h(Oe({ size: e, variant: t }), r), [e, t, r]);
|
|
606
606
|
return /* @__PURE__ */ i("button", { className: s, type: "button", ...n });
|
|
607
607
|
}
|
|
608
608
|
function ot({
|
|
@@ -614,33 +614,33 @@ function ot({
|
|
|
614
614
|
closeOnOverlay: o,
|
|
615
615
|
closeOnEsc: l,
|
|
616
616
|
onExited: u,
|
|
617
|
-
className:
|
|
617
|
+
className: p,
|
|
618
618
|
onOpenChange: d,
|
|
619
|
-
size:
|
|
620
|
-
...
|
|
619
|
+
size: f,
|
|
620
|
+
...y
|
|
621
621
|
}) {
|
|
622
|
-
const
|
|
623
|
-
Ie(
|
|
622
|
+
const C = F(u), N = F(!1), m = K(), { refs: a, context: v } = H({ open: e, onOpenChange: d, nodeId: m }), { getFloatingProps: g } = U([
|
|
623
|
+
Ie(v, {
|
|
624
624
|
enabled: l,
|
|
625
625
|
escapeKey: l,
|
|
626
626
|
outsidePress: !1
|
|
627
627
|
})
|
|
628
|
-
]), { isMounted: x, styles: w } = L(
|
|
628
|
+
]), { isMounted: x, styles: w } = L(v, {
|
|
629
629
|
duration: r,
|
|
630
630
|
initial: { opacity: 0, transform: "scale(0.8)" }
|
|
631
631
|
});
|
|
632
|
-
|
|
633
|
-
|
|
632
|
+
M(() => {
|
|
633
|
+
N.current !== x && (N.current = x, !x && C.current?.());
|
|
634
634
|
}, [x]);
|
|
635
|
-
const _ =
|
|
635
|
+
const _ = j(() => {
|
|
636
636
|
o && d?.(!1);
|
|
637
637
|
}, [d, o]);
|
|
638
|
-
|
|
639
|
-
const D = c(() =>
|
|
638
|
+
C.current = u;
|
|
639
|
+
const D = c(() => h("grid bg-backdrop z-40 justify-items-center", {
|
|
640
640
|
"place-items-start items-start": s === "start",
|
|
641
641
|
"place-items-end": s === "end",
|
|
642
642
|
"place-items-center": s === "center" || !s
|
|
643
|
-
}), [s]),
|
|
643
|
+
}), [s]), O = c(() => I("transition ease-in-out", p), [p]);
|
|
644
644
|
return /* @__PURE__ */ i(W, { disabled: !x, children: /* @__PURE__ */ i(
|
|
645
645
|
J,
|
|
646
646
|
{
|
|
@@ -653,12 +653,12 @@ function ot({
|
|
|
653
653
|
de,
|
|
654
654
|
{
|
|
655
655
|
ref: a.setFloating,
|
|
656
|
-
className:
|
|
656
|
+
className: O,
|
|
657
657
|
role: "dialog",
|
|
658
|
-
size:
|
|
658
|
+
size: f,
|
|
659
659
|
style: w,
|
|
660
660
|
onClick: q,
|
|
661
|
-
...
|
|
661
|
+
...g({ ...y }),
|
|
662
662
|
children: t
|
|
663
663
|
}
|
|
664
664
|
)
|
|
@@ -670,7 +670,7 @@ const de = S(({
|
|
|
670
670
|
className: t,
|
|
671
671
|
...r
|
|
672
672
|
}, n) => {
|
|
673
|
-
const s = c(() =>
|
|
673
|
+
const s = c(() => h(
|
|
674
674
|
e ? "flex flex-col bg-background shadow-lg p-5 rounded" : null,
|
|
675
675
|
{
|
|
676
676
|
"w-full max-w-dialog-sm": e === "small",
|
|
@@ -690,19 +690,26 @@ function it({
|
|
|
690
690
|
position: n = "right",
|
|
691
691
|
overlay: s,
|
|
692
692
|
onExited: o,
|
|
693
|
-
|
|
693
|
+
onOpen: l,
|
|
694
|
+
...u
|
|
694
695
|
}) {
|
|
695
|
-
const
|
|
696
|
+
const p = K(), d = F(!1), f = F(l), y = F(o), { refs: C, context: N } = H({ open: e, onOpenChange: r, nodeId: p }), { isMounted: m, styles: a } = L(N, {
|
|
696
697
|
duration: t,
|
|
697
698
|
initial() {
|
|
698
|
-
let
|
|
699
|
-
return n === "left" ?
|
|
699
|
+
let g = "translateX(75%)";
|
|
700
|
+
return n === "left" ? g = "translateX(-75%)" : n === "top" ? g = "translateY(-75%)" : n === "bottom" && (g = "translateY(75%)"), { opacity: 0, transform: g };
|
|
700
701
|
}
|
|
701
702
|
});
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
703
|
+
M(() => {
|
|
704
|
+
if (d.current !== m) {
|
|
705
|
+
if (d.current = m, m) {
|
|
706
|
+
f.current?.();
|
|
707
|
+
return;
|
|
708
|
+
}
|
|
709
|
+
y.current?.();
|
|
710
|
+
}
|
|
711
|
+
}, [m]);
|
|
712
|
+
const v = c(() => h(
|
|
706
713
|
"fixed transition-transform z-30",
|
|
707
714
|
{
|
|
708
715
|
"top-0 right-0 h-full max-h-screen": n === "right",
|
|
@@ -711,29 +718,29 @@ function it({
|
|
|
711
718
|
"bottom-0 left-0 right-0 w-full max-w-screen": n === "bottom"
|
|
712
719
|
}
|
|
713
720
|
), [n]);
|
|
714
|
-
return
|
|
721
|
+
return y.current = o, f.current = l, /* @__PURE__ */ k(W, { disabled: !m, children: [
|
|
715
722
|
s ? /* @__PURE__ */ i(
|
|
716
723
|
J,
|
|
717
724
|
{
|
|
718
725
|
className: "bg-backdrop",
|
|
719
|
-
style: { opacity:
|
|
726
|
+
style: { opacity: a.opacity },
|
|
720
727
|
onClick: () => r?.(!1)
|
|
721
728
|
}
|
|
722
729
|
) : null,
|
|
723
730
|
/* @__PURE__ */ i(
|
|
724
731
|
"div",
|
|
725
732
|
{
|
|
726
|
-
ref:
|
|
727
|
-
className:
|
|
733
|
+
ref: C.setFloating,
|
|
734
|
+
className: v,
|
|
728
735
|
role: "dialog",
|
|
729
|
-
style:
|
|
730
|
-
children: /* @__PURE__ */ i(Be, { ...
|
|
736
|
+
style: a,
|
|
737
|
+
children: /* @__PURE__ */ i(Be, { ...u })
|
|
731
738
|
}
|
|
732
739
|
)
|
|
733
740
|
] });
|
|
734
741
|
}
|
|
735
742
|
function Be({ className: e, unstyled: t, ...r }) {
|
|
736
|
-
const n = c(() => t ? e : I(
|
|
743
|
+
const n = c(() => t ? e : I(h(
|
|
737
744
|
"relative bg-background min-w-full min-h-full border border-input shadow-lg"
|
|
738
745
|
), e), [t, e]);
|
|
739
746
|
return /* @__PURE__ */ i("div", { className: n, ...r });
|
|
@@ -799,36 +806,36 @@ function We({
|
|
|
799
806
|
children: o,
|
|
800
807
|
inverted: l,
|
|
801
808
|
timeout: u = 250,
|
|
802
|
-
max:
|
|
809
|
+
max: p = 3
|
|
803
810
|
}) {
|
|
804
|
-
const d = F(!1), [
|
|
811
|
+
const d = F(!1), [f, y] = E(!1), { context: C, refs: N } = H({ open: f, onOpenChange: y, nodeId: e }), { isMounted: m, styles: a } = L(C, {
|
|
805
812
|
duration: u,
|
|
806
813
|
initial: { opacity: 0, transform: `translateY(${l ? "" : "-"}50%)` }
|
|
807
814
|
});
|
|
808
815
|
ne(() => {
|
|
809
|
-
|
|
810
|
-
}, [r,
|
|
811
|
-
d.current !==
|
|
812
|
-
}, [
|
|
816
|
+
y(r <= p);
|
|
817
|
+
}, [r, p]), M(() => {
|
|
818
|
+
d.current !== m && (m || fe.remove(e), d.current = m);
|
|
819
|
+
}, [m, e]), M(() => {
|
|
813
820
|
if (!n) return;
|
|
814
|
-
const x = window.setTimeout(() =>
|
|
821
|
+
const x = window.setTimeout(() => y(!1), n);
|
|
815
822
|
return () => window.clearTimeout(x);
|
|
816
823
|
}, [n, e]);
|
|
817
|
-
const
|
|
818
|
-
t !== "loading" &&
|
|
819
|
-
}, [t]),
|
|
824
|
+
const v = j(() => {
|
|
825
|
+
t !== "loading" && y(!1);
|
|
826
|
+
}, [t]), g = c(() => h(
|
|
820
827
|
"relative flex w-fit transition-transform ease-in-out cursor-pointer",
|
|
821
828
|
s
|
|
822
829
|
), [s]);
|
|
823
|
-
return
|
|
830
|
+
return m ? /* @__PURE__ */ i(
|
|
824
831
|
"li",
|
|
825
832
|
{
|
|
826
833
|
role: "log",
|
|
827
834
|
tabIndex: -1,
|
|
828
|
-
ref:
|
|
829
|
-
className:
|
|
835
|
+
ref: N.setFloating,
|
|
836
|
+
className: g,
|
|
830
837
|
style: a,
|
|
831
|
-
onClick:
|
|
838
|
+
onClick: v,
|
|
832
839
|
children: o
|
|
833
840
|
}
|
|
834
841
|
) : null;
|
|
@@ -848,40 +855,40 @@ function st({
|
|
|
848
855
|
const l = c(() => {
|
|
849
856
|
const a = { position: "fixed" };
|
|
850
857
|
return r.indexOf("top") > -1 ? a.top = t : r.indexOf("bottom") > -1 && (a.bottom = t), r.indexOf("left") > -1 ? (a.left = t, a.alignItems = "flex-start") : r.indexOf("right") > -1 ? (a.right = t, a.alignItems = "flex-end") : (a.left = "50%", a.alignItems = "center", a.transform = "translateX(-50%)"), a;
|
|
851
|
-
}, [t, r]), u = c(() =>
|
|
858
|
+
}, [t, r]), u = c(() => h(
|
|
852
859
|
"flex flex-col z-40 overflow-hidden",
|
|
853
860
|
e
|
|
854
|
-
), [e]),
|
|
861
|
+
), [e]), p = c(() => r?.startsWith("bottom") || !1, [r]), d = F(/* @__PURE__ */ new Map()), [f, y] = E([]), C = E(0)[1];
|
|
855
862
|
Q(() => fe.subscribe((a) => {
|
|
856
863
|
ye(() => {
|
|
857
864
|
if (a.type === "add")
|
|
858
|
-
d.current.set(a.id, a.config),
|
|
865
|
+
d.current.set(a.id, a.config), y((v) => [...v, a.id]);
|
|
859
866
|
else if (a.type === "remove") {
|
|
860
867
|
if (!d.current.delete(a.id)) return;
|
|
861
|
-
|
|
862
|
-
const x = new Set(
|
|
863
|
-
return x.has(a.id) ? (x.delete(a.id), Array.from(x)) :
|
|
868
|
+
y((g) => {
|
|
869
|
+
const x = new Set(g);
|
|
870
|
+
return x.has(a.id) ? (x.delete(a.id), Array.from(x)) : g;
|
|
864
871
|
});
|
|
865
872
|
} else if (a.type === "update") {
|
|
866
|
-
const
|
|
867
|
-
if (!
|
|
868
|
-
d.current.set(a.id, { ...
|
|
873
|
+
const v = d.current.get(a.id);
|
|
874
|
+
if (!v) return;
|
|
875
|
+
d.current.set(a.id, { ...v, ...a.config }), C((g) => g + 1);
|
|
869
876
|
}
|
|
870
877
|
});
|
|
871
878
|
}), []);
|
|
872
|
-
const
|
|
873
|
-
return /* @__PURE__ */ i(W, { children: /* @__PURE__ */ i("ol", { className: u, style: l, "aria-live": "polite", children: /* @__PURE__ */ i(pe.Provider, { value:
|
|
874
|
-
const
|
|
875
|
-
if (!
|
|
876
|
-
const { className: x, duration: w, ..._ } =
|
|
879
|
+
const N = c(() => ({ icons: o }), [o]), m = f.length;
|
|
880
|
+
return /* @__PURE__ */ i(W, { children: /* @__PURE__ */ i("ol", { className: u, style: l, "aria-live": "polite", children: /* @__PURE__ */ i(pe.Provider, { value: N, children: f.map((a, v) => {
|
|
881
|
+
const g = d.current.get(a);
|
|
882
|
+
if (!g) return null;
|
|
883
|
+
const { className: x, duration: w, ..._ } = g;
|
|
877
884
|
return /* @__PURE__ */ i(
|
|
878
885
|
We,
|
|
879
886
|
{
|
|
880
887
|
id: a,
|
|
881
|
-
index:
|
|
888
|
+
index: m - v,
|
|
882
889
|
className: x,
|
|
883
890
|
duration: w,
|
|
884
|
-
inverted:
|
|
891
|
+
inverted: p,
|
|
885
892
|
max: n,
|
|
886
893
|
children: we(s, _)
|
|
887
894
|
},
|
|
@@ -897,7 +904,7 @@ function lt({ className: e, ...t }) {
|
|
|
897
904
|
return /* @__PURE__ */ i("div", { className: r, ...t });
|
|
898
905
|
}
|
|
899
906
|
function at({ className: e, ...t }) {
|
|
900
|
-
const r = c(() =>
|
|
907
|
+
const r = c(() => h(
|
|
901
908
|
"flex items-center justify-center",
|
|
902
909
|
"[&_button]:rounded-none [&_:first-child]:rounded-bl [&_:first-child]:rounded-tl [&_:last-child]:rounded-br [&_:last-child]:rounded-tr",
|
|
903
910
|
"[&_:first-child]:border-r-0 [&_:last-child]:border-l-0",
|
|
@@ -916,7 +923,7 @@ function ct({ value: e, max: t, className: r, ...n }) {
|
|
|
916
923
|
) });
|
|
917
924
|
}
|
|
918
925
|
function ut({ className: e, orientation: t = "horizontal", ...r }) {
|
|
919
|
-
const n = c(() => I(
|
|
926
|
+
const n = c(() => I(h(
|
|
920
927
|
"border-0 p-0 shrink-0 bg-input",
|
|
921
928
|
t === "horizontal" ? "h-[1px] w-full" : "w-[1px] h-full"
|
|
922
929
|
), e), [e, t]);
|
|
@@ -931,7 +938,7 @@ export {
|
|
|
931
938
|
ut as Divider,
|
|
932
939
|
Je as FormField,
|
|
933
940
|
Te as FormLabel,
|
|
934
|
-
|
|
941
|
+
Re as Input,
|
|
935
942
|
Qe as InputField,
|
|
936
943
|
ae as Popover,
|
|
937
944
|
W as Portal,
|
|
@@ -942,12 +949,12 @@ export {
|
|
|
942
949
|
lt as Skeleton,
|
|
943
950
|
Xe as Spinner,
|
|
944
951
|
De as Switch,
|
|
945
|
-
|
|
952
|
+
Ae as Textarea,
|
|
946
953
|
st as Toast,
|
|
947
954
|
He as ToastItem,
|
|
948
|
-
|
|
955
|
+
je as Tooltip,
|
|
949
956
|
pt as clsx,
|
|
950
957
|
I as merge,
|
|
951
958
|
fe as toast,
|
|
952
|
-
|
|
959
|
+
Oe as varientButton
|
|
953
960
|
};
|
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.
|
|
5
|
+
"version": "2.1.4",
|
|
6
6
|
"description": "VISITS Technologiesのreactデザインコンポーネント",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "./dist/index.cjs.js",
|
|
@@ -10,9 +10,14 @@
|
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
13
|
-
"import":
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
"import": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"default": "./dist/index.es.js"
|
|
16
|
+
},
|
|
17
|
+
"default": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"default": "./dist/index.cjs.js"
|
|
20
|
+
}
|
|
16
21
|
},
|
|
17
22
|
"./lib.css": "./dist/lib.css"
|
|
18
23
|
},
|
|
@@ -22,9 +27,9 @@
|
|
|
22
27
|
"dist"
|
|
23
28
|
],
|
|
24
29
|
"peerDependencies": {
|
|
25
|
-
"react": "
|
|
26
|
-
"react-dom": "
|
|
27
|
-
"tailwindcss": "
|
|
30
|
+
"react": "^19",
|
|
31
|
+
"react-dom": "^19",
|
|
32
|
+
"tailwindcss": "^4"
|
|
28
33
|
},
|
|
29
34
|
"dependencies": {
|
|
30
35
|
"@floating-ui/react": "^0.27.16",
|