visits-style 2.3.2 → 2.3.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/dist/components/Accordion/index.d.ts +2 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +163 -157
- package/package.json +1 -1
|
@@ -13,5 +13,6 @@ export interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
|
13
13
|
* @default 300
|
|
14
14
|
*/
|
|
15
15
|
timeout?: number;
|
|
16
|
+
groupStyle?: string;
|
|
16
17
|
}
|
|
17
|
-
export default function Accordion({ header, show, children, timeout, ...rest }: Props): import("react").JSX.Element;
|
|
18
|
+
export default function Accordion({ header, show, children, groupStyle, timeout, ...rest }: Props): import("react").JSX.Element;
|
package/dist/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,s)=>(s=n==null?{}:e(i(n)),o(r||!n||!n.__esModule||!a.call(n,`default`)?t(s,`default`,{value:n,enumerable:!0}):s,n));let c=require("clsx");c=s(c,1);let l=require("tailwind-merge"),u=require("react"),d=require("react/jsx-runtime"),f=require("@floating-ui/react"),p=require("react-dom");var m=c.default;function h(e,t){return t?(0,l.twMerge)(e,t):e}function g({as:e,classList:t=[],className:n,override:r,...i}){let a=(0,u.useMemo)(()=>r?n:h(m(t),n),[t,n,r]);return(0,u.createElement)(e||`div`,{className:a,...i})}function _(e,t,n={}){let r=({className:r,...i})=>{let a=(0,u.useMemo)(()=>h(t,r),[r]);return(0,u.createElement)(e,{className:a,...n,...i})};return r.displayName=`Styled${typeof e==`string`?e:`Component`}`,r}function v(e){return(0,d.jsx)(g,{as:`label`,classList:[`leading-none peer-disabled:opacity-70`],...e})}function y({label:e,render:t,required:n,htmlFor:r,error:i,help:a,helpBefore:o,innerClass:s,...c}){let l=(0,u.useMemo)(()=>m(`font-medium`,n?`after:content-["*"] after:text-danger after:text-sm after:pl-0.5`:``),[n]);return(0,d.jsxs)(g,{classList:`flex flex-col space-y-2`,...c,children:[e?(0,d.jsx)(v,{className:l,htmlFor:r,children:e}):null,a&&o?(0,d.jsx)(`p`,{className:`text-xs text-muted pb-2`,children:a}):null,(0,d.jsx)(`div`,{className:s,children:t(!!i)}),a&&!o&&!i?(0,d.jsx)(`p`,{className:`text-xs text-muted`,children:a}):null,i?(0,d.jsx)(`p`,{className:`text-xs text-danger`,children:i}):null]})}function b({error:e,...t}){return(0,d.jsx)(g,{as:`fieldset`,classList:[`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`],...t})}function x({type:e,error:t,...n}){return(0,d.jsx)(g,{as:`input`,type:e,classList:[`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`,t?`border-danger hover:border-danger-fore focus-visible:ring-danger`:`border-input not-disabled:hover:border-input-fore focus-visible:ring-ring`,e===`file`?`file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground`:null],...n})}function S({error:e,...t}){return(0,d.jsx)(g,{as:`textarea`,classList:[`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`,e?`border-danger hover:border-danger-fore`:`border-input not-disabled:hover:border-input-fore`],...t})}function C(){return(0,d.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`30`,height:`30`,viewBox:`0 0 30 30`,children:(0,d.jsx)(`rect`,{width:`20`,height:`3`,y:`13.5`,x:`4.5`,fill:`currentColor`,stroke:`none`,rx:`2`})})}function w({checked:e,indeterminate:t,id:n,name:r,onChange:i,value:a,checkIcon:o,error:s,...c}){let l=()=>{c.disabled||i?.(!e)};return(0,d.jsxs)(g,{as:`button`,type:`button`,role:`checkbox`,id:n||r,classList:[`inline-flex justify-center items-center border w-4.5 h-4.5 rounded`,`cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed`,{"border-danger hover:border-danger-fore":s,"bg-primary text-inverted disabled:text-text disabled:bg-input disabled:border-input":!s&&e,"border-input not-disabled:hover:border-input-fore":!s&&!e}],onClick:l,"aria-checked":e,...c,children:[e?o:null,t&&!e?(0,d.jsx)(C,{}):null,(0,d.jsx)(`input`,{type:`checkbox`,"aria-hidden":`true`,name:r,checked:e,value:a,onChange:l,disabled:c.disabled,style:{position:`absolute`,pointerEvents:`none`,top:0,left:0,width:1,height:1,opacity:0}})]})}var T=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0?u.useLayoutEffect:u.useEffect;function E({children:e,container:t,disabled:n}){let[r,i]=(0,u.useState)(null);return T(()=>{if(!t){let e=document.getElementById(`visits-style-portals`);return e||(e=document.createElement(`div`),e.id=`visits-style-portals`,document.body.appendChild(e)),i(e)}i(t)},[t]),n||!r?null:(0,p.createPortal)(e,r)}function D(e){e&&(e.stopPropagation(),e.preventDefault())}var O={open:150,close:75};function k({ref:e,position:t,render:n,children:r,disabled:i,offset:a={x:0,y:6},onOpen:o,onClose:s,onManualClose:c,timeout:l=O,override:p,zIndex:m=9996,role:h,...g}){let[_,v]=(0,u.useState)(!1),y=(0,f.useId)(),b=(0,u.useRef)(o),x=(0,u.useRef)(s),{refs:S,floatingStyles:C,context:w}=(0,f.useFloating)({nodeId:y,placement:t,middleware:[(0,f.shift)(),(0,f.flip)({fallbackAxisSideDirection:`end`}),(0,f.offset)({mainAxis:a.y,crossAxis:a.x})],open:_,onOpenChange:e=>{e?b.current?.(S.reference.current,S.floating.current):x.current?.(S.reference.current,S.floating.current),v(e)},whileElementsMounted:f.autoUpdate}),{isMounted:T,styles:k}=(0,f.useTransitionStyles)(w,{duration:l,initial({side:e}){let t=``;return t=e===`top`?`translateY(5%) scale(0.95)`:e===`bottom`?`translateY(-5%) scale(0.95)`:e===`left`?`translateX(5%) scale(0.95)`:`translateX(-5%) scale(0.95)`,{opacity:0,transform:t}}}),j=(0,u.useCallback)(e=>{if(D(e),c)return c();v(!1),x.current?.(S.reference.current,S.floating.current)},[c]);(0,u.useEffect)(()=>{if(i&&_)return v(!1)},[i,_]),(0,u.useImperativeHandle)(e,()=>({open:()=>{v(!0),b.current?.(S.reference.current,S.floating.current)},close:()=>{v(!1),x.current?.(S.reference.current,S.floating.current)}}),[]);let{getFloatingProps:M,getReferenceProps:N}=(0,f.useInteractions)([(0,f.useClick)(w,{enabled:!i})]);return b.current=o,x.current=s,(0,d.jsxs)(d.Fragment,{children:[n(N({ref:S.setReference,tabIndex:0,"aria-expanded":_,"aria-disabled":i,onClick:D})),(0,d.jsx)(E,{disabled:i||!T,children:(0,d.jsx)(f.FloatingOverlay,{"data-testid":`vs-popover-shadow`,onClick:j,style:{zIndex:m},autoFocus:!0,children:(0,d.jsx)(`div`,{role:h||`region`,ref:S.setFloating,style:C,children:(0,d.jsx)(A,{override:p,styles:k,...M({...g,onClick:D}),children:r})})})})]})}function A({override:e,styles:t,style:n={},...r}){return(0,d.jsx)(g,{classList:[`z-20 w-auto h-auto outline-none transition-transform ease-in-out`,e?null:`border border-accent rounded-md shadow-lg p-1 bg-background`],style:{...t,...n},...r})}function j({ref:e,className:t,placeholder:n=``,options:r=[],error:i,disabled:a,value:o,maxHeight:s=408,arrowIcon:c,closeIcon:l,checkIcon:f,onChange:p,onClear:_,renderItem:v,sectionLabelStyle:y,buttonAreaStyle:b,clearLabelText:x,optionStyle:S,popover:C={},buttonRef:w,labelStyle:T,...E}){let D=(0,u.useRef)(null),[O,A]=(0,u.useState)(0),j=(0,u.useMemo)(()=>Array.isArray(o),[]),N=(0,u.useCallback)((e,t)=>{p?.(e,t),j||D.current?.close()},[p,j]),P=(0,u.useCallback)(e=>Array.isArray(o)?o.indexOf(e)>-1:o===e,[o]),F=(0,u.useMemo)(()=>{let e={},t=r.filter(e=>typeof e!=`string`);for(let n=0,r=t.length;n<r;n+=1){let r=t[n];e[`${r.value}`]=r.label}return e},[r]),I=(0,u.useMemo)(()=>{if(!o)return n;if(Array.isArray(o)){if(!o.length)return n;let e=[...o].sort(),t=[];for(let n=0,r=e.length;n<r;n+=1)t[n]=F[`${e[n]}`]||``;return t.filter(Boolean).join(`,`)||n}return F[`${o}`]||n},[n,o,F]),L=(0,u.useMemo)(()=>o==null?!0:Array.isArray(o)?!o.length:!1,[o]),R=(0,u.useCallback)((e,t)=>v?typeof e==`string`?v(e,{index:t,selected:!1,onChange:()=>{}}):v(e,{index:t,selected:P(e.value),onChange:()=>N(e.value,e)}):typeof e==`string`?(0,d.jsx)(g,{as:`h5`,classList:[`font-normal py-1 px-2 text-muted`],className:y,children:e},`optionheader-${t}`):(0,d.jsx)(M,{selected:P(e.value),onChange:N,checkIcon:f,className:S,data:e},e.label),[v,N,P,y,S,f]);return(0,u.useImperativeHandle)(e,()=>D.current,[]),(0,d.jsx)(k,{render:e=>(0,d.jsxs)(`button`,{type:`button`,className:h(m(`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`,i?`border-danger hover:border-danger-fore`:`border-input not-disabled:hover:border-input-fore`),t),disabled:a,...e,ref:t=>{e.ref?.(t),typeof w==`function`&&w?.(t)},...E,children:[(0,d.jsx)(g,{as:`span`,classList:[`overflow-hidden text-ellipsis whitespace-nowrap`,L?`text-muted`:`text-text`],className:T,children:I}),(0,d.jsxs)(g,{classList:`relative flex items-center space-x-2`,className:b,children:[_&&!L?(0,d.jsx)(`div`,{tabIndex:-1,role:`button`,className:`size-6 p-1.5 rounded hover:bg-accent cursor-pointer`,"aria-label":x,onKeyDown:e=>{(e.key===`Enter`||e.key===`Space`)&&_()},onClick:e=>{e.stopPropagation(),_()},children:l}):null,c]})]}),ref:D,onOpen:e=>A(e?.getBoundingClientRect().width||0),disabled:a,...C,children:(0,d.jsx)(`div`,{className:`overflow-y-auto flex flex-col`,role:`listbox`,style:{minWidth:O,maxWidth:`calc(100vw - 3rem)`,maxHeight:s},children:r.map(R)})})}function M({className:e,data:t,selected:n,checkIcon:r,onChange:i}){return(0,d.jsxs)(g,{as:`button`,type:`button`,role:`option`,classList:`flex items-center w-full hover:bg-accent rounded p-1 cursor-pointer`,className:e,"aria-selected":n,onClick:()=>i?.(t.value,t),children:[r===null||n&&r?r:(0,d.jsx)(`div`,{className:`w-5 h-1 mr-1`}),t.label]})}function N({checked:e,className:t,id:n,name:r,onChange:i,value:a,error:o,...s}){let c=()=>{s.disabled||i?.(!e)};return(0,d.jsxs)(g,{as:`button`,type:`button`,role:`radio`,id:n||r,classList:[`relative inline-flex justify-center items-center border w-4.5 h-4.5 rounded-full`,`cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed not-disabled:hover:border-input-fore`,o?`border-danger`:`border-input`,e?`[&_i]:bg-primary disabled:[&_i]:bg-text disabled:border-input`:``],className:t,onClick:c,"aria-checked":e,...s,children:[(0,d.jsx)(`i`,{className:`block w-2.5 h-2.5 rounded-full transition-transform`,style:{transform:e?``:`scale(0.8)`,opacity:+!!e}}),(0,d.jsx)(`input`,{type:`radio`,"aria-hidden":`true`,name:r,checked:e,value:a,onChange:c,disabled:s.disabled,style:{position:`absolute`,pointerEvents:`none`,top:0,left:0,width:1,height:1,opacity:0}})]})}function P({checked:e,onChange:t,value:n,id:r,name:i,error:a,ref:o,...s}){let c=()=>{s.disabled||t?.(!e)};return(0,d.jsxs)(g,{as:`button`,type:`button`,role:`switch`,id:r||i,classList:[`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`,e?`bg-primary disabled:bg-text`:`bg-input`],onClick:c,"aria-checked":e,"aria-invalid":a,...s,children:[(0,d.jsx)(`span`,{className:`pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform`,style:{transform:e?`translateX(100%)`:``}}),(0,d.jsx)(`input`,{ref:o,type:`checkbox`,"aria-hidden":`true`,name:i,checked:e,value:n,onChange:c,disabled:s.disabled,style:{position:`absolute`,pointerEvents:`none`,top:0,left:0,width:1,height:1,opacity:0}})]})}function F({header:e,show:t,children:n,timeout:r=300,...i}){let a=(0,u.useRef)(null),o=(0,u.useRef)(0),s=(0,u.useRef)(0),c=(0,u.useRef)(!0);return(0,u.useEffect)(()=>{s.current=r},[r]),T(()=>{if(!a.current)return;if(a.current.style.overflow=`hidden`,a.current.style.opacity=`1`,c.current){c.current=!1,a.current.style.height=t?`auto`:`0px`,t?window.requestAnimationFrame(()=>{a.current&&(o.current=a.current.offsetHeight)}):(window.requestAnimationFrame(()=>{a.current&&(a.current.style.height=`auto`,o.current=a.current.offsetHeight,a.current.style.height=`0px`)}),a.current.style.opacity=`0`);return}t||(a.current.style.height=`${o.current}px`);let e=[];e[0]=window.requestAnimationFrame(()=>{e[1]=window.requestAnimationFrame(()=>{a.current&&(a.current.style.height=`${t?o.current:0}px`,a.current.style.opacity=t?`1`:`0`)})});let n,r=()=>{a.current&&(t?(a.current.style.height=`auto`,a.current.style.overflow=``,a.current.style.opacity=``,window.requestAnimationFrame(()=>{a.current&&(o.current=a.current.offsetHeight)})):a.current.style.height=`0px`)};return s.current===0?r():n=window.setTimeout(r,s.current),()=>{e.forEach(window.cancelAnimationFrame),n&&window.clearTimeout(n)}},[t]),(0,d.jsxs)(`div`,{...i,children:[e,(0,d.jsx)(`div`,{className:`transition-all ease-in-out overflow-hidden`,role:`region`,"aria-hidden":!t,ref:a,style:{transitionDuration:`${r}ms`},children:n})]})}var I=(0,u.forwardRef)(({render:e,position:t=`bottom`,label:n,className:r,timeout:i=150,offset:a={x:0,y:6},clientPoint:o=!1,disabled:s},c)=>{let[l,p]=(0,u.useState)(!1),m=(0,f.useId)(),{refs:h,floatingStyles:g,context:_}=(0,f.useFloating)({nodeId:m,open:l,placement:t,middleware:[(0,f.shift)(),(0,f.flip)(),(0,f.offset)({mainAxis:a.y,crossAxis:a.x})],whileElementsMounted:s?void 0:f.autoUpdate,onOpenChange:p}),{getReferenceProps:v,getFloatingProps:y}=(0,f.useInteractions)([(0,f.useHover)(_,{enabled:!s}),(0,f.useClientPoint)(_,{enabled:o})]),{isMounted:b,styles:x}=(0,f.useTransitionStyles)(_,{duration:i,initial:{opacity:0,transform:`scale(0.8)`}});return(0,u.useImperativeHandle)(c,()=>({floating:h.floating,reference:h.reference,open:()=>p(!0),close:()=>p(!1)})),(0,u.useEffect)(()=>{s&&p(!1)},[s]),(0,d.jsxs)(d.Fragment,{children:[e({ref:h.setReference,...v()}),(0,d.jsx)(E,{disabled:s||!b,children:(0,d.jsx)(`div`,{role:`tooltip`,className:`z-9999`,ref:h.setFloating,...y({style:g}),children:(0,d.jsx)(L,{className:r,style:x,children:n})})})]})});I.displayName=`Tooltip`;var L=(0,u.forwardRef)(({className:e,custom:t,...n},r)=>{let i=(0,u.useMemo)(()=>h(m(`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(0,d.jsx)(`div`,{ref:r,className:i,...n})});L.displayName=`TooltipContent`;function R({variant:e,size:t}){return m(`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!==`icon`,"p-1.5":t===`icon`})}function z({size:e,variant:t,className:n,...r}){let i=(0,u.useMemo)(()=>h(R({size:e,variant:t}),n),[e,t,n]);return(0,d.jsx)(`button`,{className:i,type:`button`,...r})}var B={open:150,close:75};function V({open:e,children:t,timeout:n=B,padding:r=`0.85rem`,verticalAlign:i=`center`,closeOnOverlay:a,closeOnEsc:o,onExited:s,className:c,onOpenChange:l,size:p,...h}){let g=(0,u.useRef)(s),_=(0,u.useRef)(!1),v=(0,f.useId)(),{refs:y,context:b}=(0,f.useFloating)({open:e,onOpenChange:l,nodeId:v}),{getFloatingProps:x}=(0,f.useInteractions)([(0,f.useDismiss)(b,{enabled:o,escapeKey:o,outsidePress:!1})]),{isMounted:S,styles:C}=(0,f.useTransitionStyles)(b,{duration:n,initial:{opacity:0,transform:`scale(0.8)`}});(0,u.useEffect)(()=>{_.current!==S&&(_.current=S,!S&&g.current?.())},[S]);let w=(0,u.useCallback)(()=>{a&&l?.(!1)},[l,a]);g.current=s;let T=(0,u.useMemo)(()=>m(`grid bg-backdrop z-40 justify-items-center transition ease-in-out`,{"place-items-start items-start":i===`start`,"place-items-end":i===`end`,"place-items-center":i===`center`||!i}),[i]);return(0,d.jsx)(E,{disabled:!S,children:(0,d.jsx)(f.FloatingOverlay,{className:T,"data-testid":`vs-dialog-overlay`,onClick:w,style:{padding:r,opacity:C.opacity},lockScroll:!0,children:(0,d.jsx)(H,{ref:y.setFloating,className:c,role:`dialog`,size:p,...x({...h,style:C,onClick:e=>e?.stopPropagation()}),children:t})})})}function H({size:e,...t}){return(0,d.jsx)(g,{classList:[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})}function U(e){return(0,d.jsx)(g,{classList:`inline-block animate-pulse rounded-md bg-accent`,...e})}function W(e){return(0,d.jsx)(g,{role:`group`,classList:[`flex items-center justify-center`,`[&_button]:rounded-none **:first:rounded-bl **:first:rounded-tl **:last:rounded-br **:last:rounded-tr`,`**:first:border-r-0 **:last:border-l-0`],...e})}function G({label:e=`Loading...`,...t}){return(0,d.jsxs)(g,{as:`svg`,classList:`fill-accent animate-spin text-primary`,"aria-label":e,"aria-hidden":`true`,width:`32`,height:`32`,viewBox:`0 0 100 101`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...t,children:[(0,d.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:`currentFill`}),(0,d.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:`currentColor`})]})}function K({value:e,max:t,...n}){let r=(0,u.useMemo)(()=>e?Math.min(100,Math.round(e/t*100)):0,[e,t]);return(0,d.jsx)(g,{role:`progressbar`,classList:`relative overflow-hidden rounded-full bg-primary`,"aria-valuemax":t,"aria-valuemin":0,...n,children:(0,d.jsx)(g,{className:`h-full w-full flex-1 bg-input transition-all origin-right`,style:{transform:`translateX(${r}%)`}})})}function q({orientation:e=`horizontal`,...t}){return(0,d.jsx)(g,{as:`hr`,role:`none`,classList:[`border-0 p-0 shrink-0 bg-input`,e===`horizontal`?`h-px w-full`:`w-px h-full`],...t})}var J={open:250,close:150};function Y({open:e,timeout:t=J,onOpenChange:n,position:r=`right`,overlay:i,onExited:a,onOpen:o,...s}){let c=(0,f.useId)(),l=(0,u.useRef)(!1),p=(0,u.useRef)(o),m=(0,u.useRef)(a),{refs:h,context:_}=(0,f.useFloating)({open:e,onOpenChange:n,nodeId:c}),{isMounted:v,styles:y}=(0,f.useTransitionStyles)(_,{duration:t,initial(){let e=`translateX(75%)`;return r===`left`?e=`translateX(-75%)`:r===`top`?e=`translateY(-75%)`:r===`bottom`&&(e=`translateY(75%)`),{opacity:0,transform:e}}});return(0,u.useEffect)(()=>{if(l.current!==v){if(l.current=v,v){p.current?.();return}m.current?.()}},[v]),m.current=a,p.current=o,(0,d.jsxs)(E,{disabled:!v,children:[i?(0,d.jsx)(f.FloatingOverlay,{className:i===`transparent`?``:`bg-backdrop`,style:{opacity:y.opacity},onClick:()=>n?.(!1)}):null,(0,d.jsx)(g,{ref:h.setFloating,role:`complementary`,classList:[`fixed transition-transform z-1`,{"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`}],style:y,children:(0,d.jsx)(ee,{...s})})]})}function ee(e){return(0,d.jsx)(g,{classList:`relative bg-background min-w-full min-h-full border border-input shadow-lg`,...e})}function X({type:e,label:t,message:n}){let{icons:r}=ne();return(0,d.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?(0,d.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`?r?.loading:null]}):null,(0,d.jsxs)(`div`,{className:`space-y-2`,children:[(0,d.jsx)(`p`,{className:`font-medium leading-none`,children:t}),n?(0,d.jsx)(`p`,{children:n}):null]})]})}function Z(){}var Q=new class{notify=Z;lastId=0;subscribe=e=>(this.notify=e,()=>{this.notify=Z});add=(e,t={})=>{this.lastId+=1;let n=`${this.lastId}`;return this.notify({id:n,type:`add`,config:{id:n,label:e,...t}}),n};update=(e,t)=>{this.notify({id:e,type:`update`,config:t})};remove=e=>{this.notify({id:e,type:`remove`})};clear=()=>{this.lastId=0}};function te({id:e,type:t,index:n,duration:r=5e3,className:i,children:a,inverted:o,timeout:s=250,max:l=3}){let p=(0,u.useRef)(!1),[m,h]=(0,u.useState)(!1),{context:g,refs:_}=(0,f.useFloating)({open:m,onOpenChange:h,nodeId:e}),{isMounted:v,styles:y}=(0,f.useTransitionStyles)(g,{duration:s,initial:{opacity:0,transform:`translateY(${o?``:`-`}50%)`}});(0,u.useLayoutEffect)(()=>{h(n<=l)},[n,l]),(0,u.useEffect)(()=>{p.current!==v&&(v||Q.remove(e),p.current=v)},[v,e]),(0,u.useEffect)(()=>{if(!r)return;let e=window.setTimeout(()=>h(!1),r);return()=>window.clearTimeout(e)},[r,e]);let b=(0,u.useCallback)(()=>{t!==`loading`&&h(!1)},[t]),x=(0,u.useMemo)(()=>(0,c.default)(`relative flex w-fit transition-transform ease-in-out cursor-pointer`,i),[i]);return v?(0,d.jsx)(`li`,{role:`log`,tabIndex:-1,ref:_.setFloating,className:x,style:y,onClick:b,children:a}):null}var $=(0,u.createContext)({});function ne(){return(0,u.useContext)($)}function re({className:e,offset:t={},position:n=`top-left`,max:r,ListItem:i=X,icons:a}){let o=(0,u.useMemo)(()=>{let e={position:`fixed`,...t};return Object.keys(t).length||(n.indexOf(`top`)>-1?e.top=`16px`:n.indexOf(`bottom`)>-1&&(e.bottom=`16px`),n.indexOf(`left`)>-1?e.left=`16px`:n.indexOf(`right`)>-1&&(e.right=`16px`)),n.indexOf(`left`)>-1?e.alignItems=`flex-start`:n.indexOf(`right`)>-1?e.alignItems=`flex-end`:(e.left=`50%`,e.alignItems=`center`,e.transform=`translateX(-50%)`),e},[t,n]),s=(0,u.useMemo)(()=>(0,c.default)(`flex flex-col z-40 overflow-hidden`,e),[e]),l=(0,u.useMemo)(()=>n?.startsWith(`bottom`)||!1,[n]),f=(0,u.useRef)(new Map),[p,m]=(0,u.useState)([]),h=(0,u.useState)(0)[1];T(()=>Q.subscribe(e=>{(0,u.startTransition)(()=>{if(e.type===`add`)f.current.set(e.id,e.config),m(t=>[...t,e.id]);else if(e.type===`remove`){if(!f.current.delete(e.id))return;m(t=>{let n=new Set(t);return n.has(e.id)?(n.delete(e.id),Array.from(n)):t})}else if(e.type===`update`){let t=f.current.get(e.id);if(!t)return;f.current.set(e.id,{...t,...e.config}),h(e=>e+1)}})}),[]);let g=(0,u.useMemo)(()=>({icons:a}),[a]),_=p.length;return(0,d.jsx)(E,{children:(0,d.jsx)(`ol`,{className:s,style:o,"aria-live":`polite`,children:(0,d.jsx)($.Provider,{value:g,children:p.map((e,t)=>{let n=f.current.get(e);if(!n)return null;let{className:a,duration:o,...s}=n;return(0,d.jsx)(te,{id:e,index:_-t,className:a,duration:o,inverted:l,max:r,children:(0,u.createElement)(i,s)},e)})})})})}exports.Accordion=F,exports.Base=g,exports.Button=z,exports.ButtonGroup=W,exports.Checkbox=w,exports.Dialog=V,exports.Divider=q,exports.FormField=y,exports.FormLabel=v,exports.Input=x,exports.InputField=b,exports.Popover=k,exports.Portal=E,exports.Progress=K,exports.Radio=N,exports.Select=j,exports.Sheet=Y,exports.Skeleton=U,exports.Spinner=G,exports.Switch=P,exports.Textarea=S,exports.Toast=re,exports.ToastItem=X,exports.Tooltip=I,exports.cn=m,exports.element=_,exports.merge=h,exports.toast=Q,exports.varientButton=R;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,s)=>(s=n==null?{}:e(i(n)),o(r||!n||!n.__esModule||!a.call(n,`default`)?t(s,`default`,{value:n,enumerable:!0}):s,n));let c=require("clsx");c=s(c,1);let l=require("tailwind-merge"),u=require("react"),d=require("react/jsx-runtime"),f=require("@floating-ui/react"),p=require("react-dom");var m=c.default;function h(e,t){return t?(0,l.twMerge)(e,t):e}function g({as:e,classList:t=[],className:n,override:r,...i}){let a=(0,u.useMemo)(()=>r?n:h(m(t),n),[t,n,r]);return(0,u.createElement)(e||`div`,{className:a,...i})}function _(e,t,n={}){let r=({className:r,...i})=>{let a=(0,u.useMemo)(()=>h(t,r),[r]);return(0,u.createElement)(e,{className:a,...n,...i})};return r.displayName=`Styled${typeof e==`string`?e:`Component`}`,r}function v(e){return(0,d.jsx)(g,{as:`label`,classList:[`leading-none peer-disabled:opacity-70`],...e})}function y({label:e,render:t,required:n,htmlFor:r,error:i,help:a,helpBefore:o,innerClass:s,...c}){let l=(0,u.useMemo)(()=>m(`font-medium`,n?`after:content-["*"] after:text-danger after:text-sm after:pl-0.5`:``),[n]);return(0,d.jsxs)(g,{classList:`flex flex-col space-y-2`,...c,children:[e?(0,d.jsx)(v,{className:l,htmlFor:r,children:e}):null,a&&o?(0,d.jsx)(`p`,{className:`text-xs text-muted pb-2`,children:a}):null,(0,d.jsx)(`div`,{className:s,children:t(!!i)}),a&&!o&&!i?(0,d.jsx)(`p`,{className:`text-xs text-muted`,children:a}):null,i?(0,d.jsx)(`p`,{className:`text-xs text-danger`,children:i}):null]})}function b({error:e,...t}){return(0,d.jsx)(g,{as:`fieldset`,classList:[`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`],...t})}function x({type:e,error:t,...n}){return(0,d.jsx)(g,{as:`input`,type:e,classList:[`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`,t?`border-danger hover:border-danger-fore focus-visible:ring-danger`:`border-input not-disabled:hover:border-input-fore focus-visible:ring-ring`,e===`file`?`file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground`:null],...n})}function S({error:e,...t}){return(0,d.jsx)(g,{as:`textarea`,classList:[`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`,e?`border-danger hover:border-danger-fore`:`border-input not-disabled:hover:border-input-fore`],...t})}function C(){return(0,d.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`30`,height:`30`,viewBox:`0 0 30 30`,children:(0,d.jsx)(`rect`,{width:`20`,height:`3`,y:`13.5`,x:`4.5`,fill:`currentColor`,stroke:`none`,rx:`2`})})}function w({checked:e,indeterminate:t,id:n,name:r,onChange:i,value:a,checkIcon:o,error:s,...c}){let l=()=>{c.disabled||i?.(!e)};return(0,d.jsxs)(g,{as:`button`,type:`button`,role:`checkbox`,id:n||r,classList:[`inline-flex justify-center items-center border w-4.5 h-4.5 rounded`,`cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed`,{"border-danger hover:border-danger-fore":s,"bg-primary text-inverted disabled:text-text disabled:bg-input disabled:border-input":!s&&e,"border-input not-disabled:hover:border-input-fore":!s&&!e}],onClick:l,"aria-checked":e,...c,children:[e?o:null,t&&!e?(0,d.jsx)(C,{}):null,(0,d.jsx)(`input`,{type:`checkbox`,"aria-hidden":`true`,name:r,checked:e,value:a,onChange:l,disabled:c.disabled,style:{position:`absolute`,pointerEvents:`none`,top:0,left:0,width:1,height:1,opacity:0}})]})}var T=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0?u.useLayoutEffect:u.useEffect;function E({children:e,container:t,disabled:n}){let[r,i]=(0,u.useState)(null);return T(()=>{if(!t){let e=document.getElementById(`visits-style-portals`);return e||(e=document.createElement(`div`),e.id=`visits-style-portals`,document.body.appendChild(e)),i(e)}i(t)},[t]),n||!r?null:(0,p.createPortal)(e,r)}function D(e){e&&(e.stopPropagation(),e.preventDefault())}var O={open:150,close:75};function k({ref:e,position:t,render:n,children:r,disabled:i,offset:a={x:0,y:6},onOpen:o,onClose:s,onManualClose:c,timeout:l=O,override:p,zIndex:m=9996,role:h,...g}){let[_,v]=(0,u.useState)(!1),y=(0,f.useId)(),b=(0,u.useRef)(o),x=(0,u.useRef)(s),{refs:S,floatingStyles:C,context:w}=(0,f.useFloating)({nodeId:y,placement:t,middleware:[(0,f.shift)(),(0,f.flip)({fallbackAxisSideDirection:`end`}),(0,f.offset)({mainAxis:a.y,crossAxis:a.x})],open:_,onOpenChange:e=>{e?b.current?.(S.reference.current,S.floating.current):x.current?.(S.reference.current,S.floating.current),v(e)},whileElementsMounted:f.autoUpdate}),{isMounted:T,styles:k}=(0,f.useTransitionStyles)(w,{duration:l,initial({side:e}){let t=``;return t=e===`top`?`translateY(5%) scale(0.95)`:e===`bottom`?`translateY(-5%) scale(0.95)`:e===`left`?`translateX(5%) scale(0.95)`:`translateX(-5%) scale(0.95)`,{opacity:0,transform:t}}}),j=(0,u.useCallback)(e=>{if(D(e),c)return c();v(!1),x.current?.(S.reference.current,S.floating.current)},[c]);(0,u.useEffect)(()=>{if(i&&_)return v(!1)},[i,_]),(0,u.useImperativeHandle)(e,()=>({open:()=>{v(!0),b.current?.(S.reference.current,S.floating.current)},close:()=>{v(!1),x.current?.(S.reference.current,S.floating.current)}}),[]);let{getFloatingProps:M,getReferenceProps:N}=(0,f.useInteractions)([(0,f.useClick)(w,{enabled:!i})]);b.current=o,x.current=s;let P=`vs_${y||`tmp`}`;return(0,d.jsxs)(d.Fragment,{children:[n(N({ref:S.setReference,tabIndex:0,onClick:D,"aria-controls":P,"aria-expanded":_,"aria-disabled":i||void 0,disabled:i})),(0,d.jsx)(E,{disabled:i||!T,children:(0,d.jsx)(f.FloatingOverlay,{"data-testid":`vs-popover-shadow`,onClick:j,style:{zIndex:m},autoFocus:!0,children:(0,d.jsx)(`div`,{id:P,role:h||`region`,ref:S.setFloating,style:C,children:(0,d.jsx)(A,{override:p,styles:k,...M({...g,onClick:D}),children:r})})})})]})}function A({override:e,styles:t,style:n={},...r}){return(0,d.jsx)(g,{classList:[`z-20 w-auto h-auto outline-none transition-transform ease-in-out`,e?null:`border border-accent rounded-md shadow-lg p-1 bg-background`],style:{...t,...n},...r})}function j({ref:e,className:t,placeholder:n=``,options:r=[],error:i,disabled:a,value:o,maxHeight:s=408,arrowIcon:c,closeIcon:l,checkIcon:f,onChange:p,onClear:_,renderItem:v,sectionLabelStyle:y,buttonAreaStyle:b,clearLabelText:x,optionStyle:S,popover:C={},buttonRef:w,labelStyle:T,...E}){let D=(0,u.useRef)(null),[O,A]=(0,u.useState)(0),j=(0,u.useMemo)(()=>Array.isArray(o),[]),N=(0,u.useCallback)((e,t)=>{p?.(e,t),j||D.current?.close()},[p,j]),P=(0,u.useCallback)(e=>Array.isArray(o)?o.indexOf(e)>-1:o===e,[o]),F=(0,u.useMemo)(()=>{let e={},t=r.filter(e=>typeof e!=`string`);for(let n=0,r=t.length;n<r;n+=1){let r=t[n];e[`${r.value}`]=r.label}return e},[r]),I=(0,u.useMemo)(()=>{if(!o)return n;if(Array.isArray(o)){if(!o.length)return n;let e=[...o].sort(),t=[];for(let n=0,r=e.length;n<r;n+=1)t[n]=F[`${e[n]}`]||``;return t.filter(Boolean).join(`,`)||n}return F[`${o}`]||n},[n,o,F]),L=(0,u.useMemo)(()=>o==null?!0:Array.isArray(o)?!o.length:!1,[o]),R=(0,u.useCallback)((e,t)=>v?typeof e==`string`?v(e,{index:t,selected:!1,onChange:()=>{}}):v(e,{index:t,selected:P(e.value),onChange:()=>N(e.value,e)}):typeof e==`string`?(0,d.jsx)(g,{as:`h5`,classList:[`font-normal py-1 px-2 text-muted`],className:y,children:e},`optionheader-${t}`):(0,d.jsx)(M,{selected:P(e.value),onChange:N,checkIcon:f,className:S,data:e},e.label),[v,N,P,y,S,f]);return(0,u.useImperativeHandle)(e,()=>D.current,[]),(0,d.jsx)(k,{render:e=>(0,d.jsxs)(`button`,{type:`button`,className:h(m(`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`,i?`border-danger hover:border-danger-fore`:`border-input not-disabled:hover:border-input-fore`),t),disabled:a,...e,ref:t=>{e.ref?.(t),typeof w==`function`&&w?.(t)},...E,children:[(0,d.jsx)(g,{as:`span`,classList:[`overflow-hidden text-ellipsis whitespace-nowrap`,L?`text-muted`:`text-text`],className:T,children:I}),(0,d.jsxs)(g,{classList:`relative flex items-center space-x-2`,className:b,children:[_&&!L?(0,d.jsx)(`div`,{tabIndex:-1,role:`button`,className:`size-6 p-1.5 rounded hover:bg-accent cursor-pointer`,"aria-label":x,onKeyDown:e=>{(e.key===`Enter`||e.key===`Space`)&&_()},onClick:e=>{e.stopPropagation(),_()},children:l}):null,c]})]}),ref:D,onOpen:e=>A(e?.getBoundingClientRect().width||0),disabled:a,...C,children:(0,d.jsx)(`div`,{className:`overflow-y-auto flex flex-col`,role:`listbox`,style:{minWidth:O,maxWidth:`calc(100vw - 3rem)`,maxHeight:s},children:r.map(R)})})}function M({className:e,data:t,selected:n,checkIcon:r,onChange:i}){return(0,d.jsxs)(g,{as:`button`,type:`button`,role:`option`,classList:`flex items-center w-full hover:bg-accent rounded p-1 cursor-pointer`,className:e,"aria-selected":n,onClick:()=>i?.(t.value,t),children:[r===null||n&&r?r:(0,d.jsx)(`div`,{className:`w-5 h-1 mr-1`}),t.label]})}function N({checked:e,className:t,id:n,name:r,onChange:i,value:a,error:o,...s}){let c=()=>{s.disabled||i?.(!e)};return(0,d.jsxs)(g,{as:`button`,type:`button`,role:`radio`,id:n||r,classList:[`relative inline-flex justify-center items-center border w-4.5 h-4.5 rounded-full`,`cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed not-disabled:hover:border-input-fore`,o?`border-danger`:`border-input`,e?`[&_i]:bg-primary disabled:[&_i]:bg-text disabled:border-input`:``],className:t,onClick:c,"aria-checked":e,...s,children:[(0,d.jsx)(`i`,{className:`block w-2.5 h-2.5 rounded-full transition-transform`,style:{transform:e?``:`scale(0.8)`,opacity:+!!e}}),(0,d.jsx)(`input`,{type:`radio`,"aria-hidden":`true`,name:r,checked:e,value:a,onChange:c,disabled:s.disabled,style:{position:`absolute`,pointerEvents:`none`,top:0,left:0,width:1,height:1,opacity:0}})]})}function P({checked:e,onChange:t,value:n,id:r,name:i,error:a,ref:o,...s}){let c=()=>{s.disabled||t?.(!e)};return(0,d.jsxs)(g,{as:`button`,type:`button`,role:`switch`,id:r||i,classList:[`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`,e?`bg-primary disabled:bg-text`:`bg-input`],onClick:c,"aria-checked":e,"aria-invalid":a,...s,children:[(0,d.jsx)(`span`,{className:`pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform`,style:{transform:e?`translateX(100%)`:``}}),(0,d.jsx)(`input`,{ref:o,type:`checkbox`,"aria-hidden":`true`,name:i,checked:e,value:n,onChange:c,disabled:s.disabled,style:{position:`absolute`,pointerEvents:`none`,top:0,left:0,width:1,height:1,opacity:0}})]})}function F(e){return(0,d.jsx)(g,{classList:`inline-block animate-pulse rounded-md bg-accent`,...e})}function I({variant:e,size:t}){return m(`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!==`icon`,"p-1.5":t===`icon`})}function L({size:e,variant:t,className:n,...r}){let i=(0,u.useMemo)(()=>h(I({size:e,variant:t}),n),[e,t,n]);return(0,d.jsx)(`button`,{className:i,type:`button`,...r})}function R(e){return(0,d.jsx)(g,{role:`group`,classList:[`flex items-center justify-center`,`[&_button]:rounded-none **:first:rounded-bl **:first:rounded-tl **:last:rounded-br **:last:rounded-tr`,`**:first:border-r-0 **:last:border-l-0`],...e})}function z({label:e=`Loading...`,...t}){return(0,d.jsxs)(g,{as:`svg`,classList:`fill-accent animate-spin text-primary`,"aria-label":e,"aria-hidden":`true`,width:`32`,height:`32`,viewBox:`0 0 100 101`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...t,children:[(0,d.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:`currentFill`}),(0,d.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:`currentColor`})]})}function B({value:e,max:t,...n}){let r=(0,u.useMemo)(()=>e?Math.min(100,Math.round(e/t*100)):0,[e,t]);return(0,d.jsx)(g,{role:`progressbar`,classList:`relative overflow-hidden rounded-full bg-primary`,"aria-valuemax":t,"aria-valuemin":0,...n,children:(0,d.jsx)(g,{className:`h-full w-full flex-1 bg-input transition-all origin-right`,style:{transform:`translateX(${r}%)`}})})}function V({orientation:e=`horizontal`,...t}){return(0,d.jsx)(g,{as:`hr`,role:`none`,classList:[`border-0 p-0 shrink-0 bg-input`,e===`horizontal`?`h-px w-full`:`w-px h-full`],...t})}function H({header:e,show:t,children:n,groupStyle:r,timeout:i=300,...a}){let o=(0,u.useRef)(null),s=(0,u.useRef)(0),c=(0,u.useRef)(0),l=(0,u.useRef)(!0);return(0,u.useEffect)(()=>{c.current=i},[i]),T(()=>{if(!o.current)return;if(o.current.style.overflow=`hidden`,o.current.style.opacity=`1`,l.current){l.current=!1,o.current.style.height=t?`auto`:`0px`,t?window.requestAnimationFrame(()=>{o.current&&(s.current=o.current.offsetHeight)}):(window.requestAnimationFrame(()=>{o.current&&(o.current.style.height=`auto`,s.current=o.current.offsetHeight,o.current.style.height=`0px`)}),o.current.style.opacity=`0`);return}t||(o.current.style.height=`${s.current}px`);let e=[];e[0]=window.requestAnimationFrame(()=>{e[1]=window.requestAnimationFrame(()=>{o.current&&(o.current.style.height=`${t?s.current:0}px`,o.current.style.opacity=t?`1`:`0`)})});let n,r=()=>{o.current&&(t?(o.current.style.height=`auto`,o.current.style.overflow=``,o.current.style.opacity=``,window.requestAnimationFrame(()=>{o.current&&(s.current=o.current.offsetHeight)})):o.current.style.height=`0px`)};return c.current===0?r():n=window.setTimeout(r,c.current),()=>{e.forEach(window.cancelAnimationFrame),n&&window.clearTimeout(n)}},[t]),(0,d.jsxs)(`div`,{...a,children:[e,(0,d.jsx)(g,{classList:`transition-all ease-in-out overflow-hidden`,className:r,role:`group`,"aria-hidden":!t,ref:o,style:{transitionDuration:`${i}ms`},children:n})]})}var U=(0,u.forwardRef)(({render:e,position:t=`bottom`,label:n,className:r,timeout:i=150,offset:a={x:0,y:6},clientPoint:o=!1,disabled:s},c)=>{let[l,p]=(0,u.useState)(!1),m=(0,f.useId)(),{refs:h,floatingStyles:g,context:_}=(0,f.useFloating)({nodeId:m,open:l,placement:t,middleware:[(0,f.shift)(),(0,f.flip)(),(0,f.offset)({mainAxis:a.y,crossAxis:a.x})],whileElementsMounted:s?void 0:f.autoUpdate,onOpenChange:p}),{getReferenceProps:v,getFloatingProps:y}=(0,f.useInteractions)([(0,f.useHover)(_,{enabled:!s}),(0,f.useClientPoint)(_,{enabled:o})]),{isMounted:b,styles:x}=(0,f.useTransitionStyles)(_,{duration:i,initial:{opacity:0,transform:`scale(0.8)`}});return(0,u.useImperativeHandle)(c,()=>({floating:h.floating,reference:h.reference,open:()=>p(!0),close:()=>p(!1)})),(0,u.useEffect)(()=>{s&&p(!1)},[s]),(0,d.jsxs)(d.Fragment,{children:[e({ref:h.setReference,...v()}),(0,d.jsx)(E,{disabled:s||!b,children:(0,d.jsx)(`div`,{role:`tooltip`,className:`z-9999`,ref:h.setFloating,...y({style:g}),children:(0,d.jsx)(W,{className:r,style:x,children:n})})})]})});U.displayName=`Tooltip`;var W=(0,u.forwardRef)(({className:e,custom:t,...n},r)=>{let i=(0,u.useMemo)(()=>h(m(`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(0,d.jsx)(`div`,{ref:r,className:i,...n})});W.displayName=`TooltipContent`;var G={open:150,close:75};function K({open:e,children:t,timeout:n=G,padding:r=`0.85rem`,verticalAlign:i=`center`,closeOnOverlay:a,closeOnEsc:o,onExited:s,className:c,onOpenChange:l,size:p,...h}){let g=(0,u.useRef)(s),_=(0,u.useRef)(!1),v=(0,f.useId)(),{refs:y,context:b}=(0,f.useFloating)({open:e,onOpenChange:l,nodeId:v}),{getFloatingProps:x}=(0,f.useInteractions)([(0,f.useDismiss)(b,{enabled:o,escapeKey:o,outsidePress:!1})]),{isMounted:S,styles:C}=(0,f.useTransitionStyles)(b,{duration:n,initial:{opacity:0,transform:`scale(0.8)`}});(0,u.useEffect)(()=>{_.current!==S&&(_.current=S,!S&&g.current?.())},[S]);let w=(0,u.useCallback)(()=>{a&&l?.(!1)},[l,a]);g.current=s;let T=(0,u.useMemo)(()=>m(`grid bg-backdrop z-40 justify-items-center transition ease-in-out`,{"place-items-start items-start":i===`start`,"place-items-end":i===`end`,"place-items-center":i===`center`||!i}),[i]);return(0,d.jsx)(E,{disabled:!S,children:(0,d.jsx)(f.FloatingOverlay,{className:T,"data-testid":`vs-dialog-overlay`,onClick:w,style:{padding:r,opacity:C.opacity},lockScroll:!0,children:(0,d.jsx)(q,{ref:y.setFloating,className:c,role:`dialog`,size:p,...x({...h,style:C,onClick:e=>e?.stopPropagation()}),children:t})})})}function q({size:e,...t}){return(0,d.jsx)(g,{classList:[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})}var J={open:250,close:150};function Y({open:e,timeout:t=J,onOpenChange:n,position:r=`right`,overlay:i,onExited:a,onOpen:o,...s}){let c=(0,f.useId)(),l=(0,u.useRef)(!1),p=(0,u.useRef)(o),m=(0,u.useRef)(a),{refs:h,context:_}=(0,f.useFloating)({open:e,onOpenChange:n,nodeId:c}),{isMounted:v,styles:y}=(0,f.useTransitionStyles)(_,{duration:t,initial(){let e=`translateX(75%)`;return r===`left`?e=`translateX(-75%)`:r===`top`?e=`translateY(-75%)`:r===`bottom`&&(e=`translateY(75%)`),{opacity:0,transform:e}}});return(0,u.useEffect)(()=>{if(l.current!==v){if(l.current=v,v){p.current?.();return}m.current?.()}},[v]),m.current=a,p.current=o,(0,d.jsxs)(E,{disabled:!v,children:[i?(0,d.jsx)(f.FloatingOverlay,{className:i===`transparent`?``:`bg-backdrop`,style:{opacity:y.opacity},onClick:()=>n?.(!1)}):null,(0,d.jsx)(g,{ref:h.setFloating,role:`complementary`,classList:[`fixed transition-transform z-1`,{"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`}],style:y,children:(0,d.jsx)(ee,{...s})})]})}function ee(e){return(0,d.jsx)(g,{classList:`relative bg-background min-w-full min-h-full border border-input shadow-lg`,...e})}function X({type:e,label:t,message:n}){let{icons:r}=ne();return(0,d.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?(0,d.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`?r?.loading:null]}):null,(0,d.jsxs)(`div`,{className:`space-y-2`,children:[(0,d.jsx)(`p`,{className:`font-medium leading-none`,children:t}),n?(0,d.jsx)(`p`,{children:n}):null]})]})}function Z(){}var Q=new class{notify=Z;lastId=0;subscribe=e=>(this.notify=e,()=>{this.notify=Z});add=(e,t={})=>{this.lastId+=1;let n=`${this.lastId}`;return this.notify({id:n,type:`add`,config:{id:n,label:e,...t}}),n};update=(e,t)=>{this.notify({id:e,type:`update`,config:t})};remove=e=>{this.notify({id:e,type:`remove`})};clear=()=>{this.lastId=0}};function te({id:e,type:t,index:n,duration:r=5e3,className:i,children:a,inverted:o,timeout:s=250,max:l=3}){let p=(0,u.useRef)(!1),[m,h]=(0,u.useState)(!1),{context:g,refs:_}=(0,f.useFloating)({open:m,onOpenChange:h,nodeId:e}),{isMounted:v,styles:y}=(0,f.useTransitionStyles)(g,{duration:s,initial:{opacity:0,transform:`translateY(${o?``:`-`}50%)`}});(0,u.useLayoutEffect)(()=>{h(n<=l)},[n,l]),(0,u.useEffect)(()=>{p.current!==v&&(v||Q.remove(e),p.current=v)},[v,e]),(0,u.useEffect)(()=>{if(!r)return;let e=window.setTimeout(()=>h(!1),r);return()=>window.clearTimeout(e)},[r,e]);let b=(0,u.useCallback)(()=>{t!==`loading`&&h(!1)},[t]),x=(0,u.useMemo)(()=>(0,c.default)(`relative flex w-fit transition-transform ease-in-out cursor-pointer`,i),[i]);return v?(0,d.jsx)(`li`,{role:`log`,tabIndex:-1,ref:_.setFloating,className:x,style:y,onClick:b,children:a}):null}var $=(0,u.createContext)({});function ne(){return(0,u.useContext)($)}function re({className:e,offset:t={},position:n=`top-left`,max:r,ListItem:i=X,icons:a}){let o=(0,u.useMemo)(()=>{let e={position:`fixed`,...t};return Object.keys(t).length||(n.indexOf(`top`)>-1?e.top=`16px`:n.indexOf(`bottom`)>-1&&(e.bottom=`16px`),n.indexOf(`left`)>-1?e.left=`16px`:n.indexOf(`right`)>-1&&(e.right=`16px`)),n.indexOf(`left`)>-1?e.alignItems=`flex-start`:n.indexOf(`right`)>-1?e.alignItems=`flex-end`:(e.left=`50%`,e.alignItems=`center`,e.transform=`translateX(-50%)`),e},[t,n]),s=(0,u.useMemo)(()=>(0,c.default)(`flex flex-col z-40 overflow-hidden`,e),[e]),l=(0,u.useMemo)(()=>n?.startsWith(`bottom`)||!1,[n]),f=(0,u.useRef)(new Map),[p,m]=(0,u.useState)([]),h=(0,u.useState)(0)[1];T(()=>Q.subscribe(e=>{(0,u.startTransition)(()=>{if(e.type===`add`)f.current.set(e.id,e.config),m(t=>[...t,e.id]);else if(e.type===`remove`){if(!f.current.delete(e.id))return;m(t=>{let n=new Set(t);return n.has(e.id)?(n.delete(e.id),Array.from(n)):t})}else if(e.type===`update`){let t=f.current.get(e.id);if(!t)return;f.current.set(e.id,{...t,...e.config}),h(e=>e+1)}})}),[]);let g=(0,u.useMemo)(()=>({icons:a}),[a]),_=p.length;return(0,d.jsx)(E,{children:(0,d.jsx)(`ol`,{className:s,style:o,"aria-live":`polite`,children:(0,d.jsx)($.Provider,{value:g,children:p.map((e,t)=>{let n=f.current.get(e);if(!n)return null;let{className:a,duration:o,...s}=n;return(0,d.jsx)(te,{id:e,index:_-t,className:a,duration:o,inverted:l,max:r,children:(0,u.createElement)(i,s)},e)})})})})}exports.Accordion=H,exports.Base=g,exports.Button=L,exports.ButtonGroup=R,exports.Checkbox=w,exports.Dialog=K,exports.Divider=V,exports.FormField=y,exports.FormLabel=v,exports.Input=x,exports.InputField=b,exports.Popover=k,exports.Portal=E,exports.Progress=B,exports.Radio=N,exports.Select=j,exports.Sheet=Y,exports.Skeleton=F,exports.Spinner=z,exports.Switch=P,exports.Textarea=S,exports.Toast=re,exports.ToastItem=X,exports.Tooltip=U,exports.cn=m,exports.element=_,exports.merge=h,exports.toast=Q,exports.varientButton=I;
|
package/dist/index.es.js
CHANGED
|
@@ -249,12 +249,16 @@ function G({ ref: e, position: t, render: n, children: r, disabled: i, offset: a
|
|
|
249
249
|
}
|
|
250
250
|
}), []);
|
|
251
251
|
let { getFloatingProps: G, getReferenceProps: K } = O([S(z, { enabled: !i })]);
|
|
252
|
-
|
|
252
|
+
F.current = s, I.current = u;
|
|
253
|
+
let q = `vs_${P || "tmp"}`;
|
|
254
|
+
return /* @__PURE__ */ g(m, { children: [n(K({
|
|
253
255
|
ref: L.setReference,
|
|
254
256
|
tabIndex: 0,
|
|
257
|
+
onClick: W,
|
|
258
|
+
"aria-controls": q,
|
|
255
259
|
"aria-expanded": M,
|
|
256
|
-
"aria-disabled": i,
|
|
257
|
-
|
|
260
|
+
"aria-disabled": i || void 0,
|
|
261
|
+
disabled: i
|
|
258
262
|
})), /* @__PURE__ */ h(U, {
|
|
259
263
|
disabled: i || !B,
|
|
260
264
|
children: /* @__PURE__ */ h(_, {
|
|
@@ -263,6 +267,7 @@ function G({ ref: e, position: t, render: n, children: r, disabled: i, offset: a
|
|
|
263
267
|
style: { zIndex: E },
|
|
264
268
|
autoFocus: !0,
|
|
265
269
|
children: /* @__PURE__ */ h("div", {
|
|
270
|
+
id: q,
|
|
266
271
|
role: A || "region",
|
|
267
272
|
ref: L.setFloating,
|
|
268
273
|
style: R,
|
|
@@ -327,7 +332,7 @@ function K({ ref: e, className: t, placeholder: n = "", options: r = [], error:
|
|
|
327
332
|
classList: ["font-normal py-1 px-2 text-muted"],
|
|
328
333
|
className: x,
|
|
329
334
|
children: e
|
|
330
|
-
}, `optionheader-${t}`) : /* @__PURE__ */ h(
|
|
335
|
+
}, `optionheader-${t}`) : /* @__PURE__ */ h(q, {
|
|
331
336
|
selected: L(e.value),
|
|
332
337
|
onChange: I,
|
|
333
338
|
checkIcon: _,
|
|
@@ -390,7 +395,7 @@ function K({ ref: e, className: t, placeholder: n = "", options: r = [], error:
|
|
|
390
395
|
})
|
|
391
396
|
});
|
|
392
397
|
}
|
|
393
|
-
function
|
|
398
|
+
function q({ className: e, data: t, selected: n, checkIcon: r, onChange: i }) {
|
|
394
399
|
return /* @__PURE__ */ g(N, {
|
|
395
400
|
as: "button",
|
|
396
401
|
type: "button",
|
|
@@ -404,7 +409,7 @@ function ne({ className: e, data: t, selected: n, checkIcon: r, onChange: i }) {
|
|
|
404
409
|
}
|
|
405
410
|
//#endregion
|
|
406
411
|
//#region src/forms/Radio/index.tsx
|
|
407
|
-
function
|
|
412
|
+
function ne({ checked: e, className: t, id: n, name: r, onChange: i, value: a, error: o, ...s }) {
|
|
408
413
|
let c = () => {
|
|
409
414
|
s.disabled || i?.(!e);
|
|
410
415
|
};
|
|
@@ -451,7 +456,7 @@ function re({ checked: e, className: t, id: n, name: r, onChange: i, value: a, e
|
|
|
451
456
|
}
|
|
452
457
|
//#endregion
|
|
453
458
|
//#region src/forms/Switch/index.tsx
|
|
454
|
-
function
|
|
459
|
+
function re({ checked: e, onChange: t, value: n, id: r, name: i, error: a, ref: o, ...s }) {
|
|
455
460
|
let c = () => {
|
|
456
461
|
s.disabled || t?.(!e);
|
|
457
462
|
};
|
|
@@ -495,51 +500,153 @@ function ie({ checked: e, onChange: t, value: n, id: r, name: i, error: a, ref:
|
|
|
495
500
|
});
|
|
496
501
|
}
|
|
497
502
|
//#endregion
|
|
503
|
+
//#region src/elements/Skeleton/index.tsx
|
|
504
|
+
function ie(e) {
|
|
505
|
+
return /* @__PURE__ */ h(N, {
|
|
506
|
+
classList: "inline-block animate-pulse rounded-md bg-accent",
|
|
507
|
+
...e
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
//#endregion
|
|
511
|
+
//#region src/elements/Button/index.tsx
|
|
512
|
+
function J({ variant: e, size: t }) {
|
|
513
|
+
return j("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", {
|
|
514
|
+
"bg-primary text-inverted hover:bg-primary-fore": !e || e === "primary",
|
|
515
|
+
"bg-info text-inverted hover:bg-info-fore": e === "info",
|
|
516
|
+
"bg-warn text-inverted hover:bg-warn-fore": e === "warn",
|
|
517
|
+
"bg-danger text-inverted hover:bg-danger-fore": e === "danger",
|
|
518
|
+
"hover:bg-accent": e === "ghost",
|
|
519
|
+
"hover:underline": e === "link",
|
|
520
|
+
"border border-input hover:bg-accent": e === "outline"
|
|
521
|
+
}, {
|
|
522
|
+
"px-2 py-1": t !== "icon",
|
|
523
|
+
"p-1.5": t === "icon"
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
function ae({ size: e, variant: t, className: n, ...r }) {
|
|
527
|
+
let i = d(() => M(J({
|
|
528
|
+
size: e,
|
|
529
|
+
variant: t
|
|
530
|
+
}), n), [
|
|
531
|
+
e,
|
|
532
|
+
t,
|
|
533
|
+
n
|
|
534
|
+
]);
|
|
535
|
+
return /* @__PURE__ */ h("button", {
|
|
536
|
+
className: i,
|
|
537
|
+
type: "button",
|
|
538
|
+
...r
|
|
539
|
+
});
|
|
540
|
+
}
|
|
541
|
+
//#endregion
|
|
542
|
+
//#region src/elements/Button/ButtonGroup.tsx
|
|
543
|
+
function oe(e) {
|
|
544
|
+
return /* @__PURE__ */ h(N, {
|
|
545
|
+
role: "group",
|
|
546
|
+
classList: [
|
|
547
|
+
"flex items-center justify-center",
|
|
548
|
+
"[&_button]:rounded-none **:first:rounded-bl **:first:rounded-tl **:last:rounded-br **:last:rounded-tr",
|
|
549
|
+
"**:first:border-r-0 **:last:border-l-0"
|
|
550
|
+
],
|
|
551
|
+
...e
|
|
552
|
+
});
|
|
553
|
+
}
|
|
554
|
+
//#endregion
|
|
555
|
+
//#region src/elements/Spinner/index.tsx
|
|
556
|
+
function se({ label: e = "Loading...", ...t }) {
|
|
557
|
+
return /* @__PURE__ */ g(N, {
|
|
558
|
+
as: "svg",
|
|
559
|
+
classList: "fill-accent animate-spin text-primary",
|
|
560
|
+
"aria-label": e,
|
|
561
|
+
"aria-hidden": "true",
|
|
562
|
+
width: "32",
|
|
563
|
+
height: "32",
|
|
564
|
+
viewBox: "0 0 100 101",
|
|
565
|
+
fill: "none",
|
|
566
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
567
|
+
...t,
|
|
568
|
+
children: [/* @__PURE__ */ h("path", {
|
|
569
|
+
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",
|
|
570
|
+
fill: "currentFill"
|
|
571
|
+
}), /* @__PURE__ */ h("path", {
|
|
572
|
+
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",
|
|
573
|
+
fill: "currentColor"
|
|
574
|
+
})]
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
//#endregion
|
|
578
|
+
//#region src/elements/Progress/index.tsx
|
|
579
|
+
function ce({ value: e, max: t, ...n }) {
|
|
580
|
+
let r = d(() => e ? Math.min(100, Math.round(e / t * 100)) : 0, [e, t]);
|
|
581
|
+
return /* @__PURE__ */ h(N, {
|
|
582
|
+
role: "progressbar",
|
|
583
|
+
classList: "relative overflow-hidden rounded-full bg-primary",
|
|
584
|
+
"aria-valuemax": t,
|
|
585
|
+
"aria-valuemin": 0,
|
|
586
|
+
...n,
|
|
587
|
+
children: /* @__PURE__ */ h(N, {
|
|
588
|
+
className: "h-full w-full flex-1 bg-input transition-all origin-right",
|
|
589
|
+
style: { transform: `translateX(${r}%)` }
|
|
590
|
+
})
|
|
591
|
+
});
|
|
592
|
+
}
|
|
593
|
+
//#endregion
|
|
594
|
+
//#region src/elements/Divider/index.tsx
|
|
595
|
+
function le({ orientation: e = "horizontal", ...t }) {
|
|
596
|
+
return /* @__PURE__ */ h(N, {
|
|
597
|
+
as: "hr",
|
|
598
|
+
role: "none",
|
|
599
|
+
classList: ["border-0 p-0 shrink-0 bg-input", e === "horizontal" ? "h-px w-full" : "w-px h-full"],
|
|
600
|
+
...t
|
|
601
|
+
});
|
|
602
|
+
}
|
|
603
|
+
//#endregion
|
|
498
604
|
//#region src/components/Accordion/index.tsx
|
|
499
|
-
function
|
|
500
|
-
let
|
|
605
|
+
function ue({ header: e, show: t, children: n, groupStyle: r, timeout: i = 300, ...a }) {
|
|
606
|
+
let o = f(null), s = f(0), l = f(0), u = f(!0);
|
|
501
607
|
return c(() => {
|
|
502
|
-
|
|
503
|
-
}, [
|
|
504
|
-
if (!
|
|
505
|
-
if (
|
|
506
|
-
|
|
507
|
-
|
|
608
|
+
l.current = i;
|
|
609
|
+
}, [i]), H(() => {
|
|
610
|
+
if (!o.current) return;
|
|
611
|
+
if (o.current.style.overflow = "hidden", o.current.style.opacity = "1", u.current) {
|
|
612
|
+
u.current = !1, o.current.style.height = t ? "auto" : "0px", t ? window.requestAnimationFrame(() => {
|
|
613
|
+
o.current && (s.current = o.current.offsetHeight);
|
|
508
614
|
}) : (window.requestAnimationFrame(() => {
|
|
509
|
-
|
|
510
|
-
}),
|
|
615
|
+
o.current && (o.current.style.height = "auto", s.current = o.current.offsetHeight, o.current.style.height = "0px");
|
|
616
|
+
}), o.current.style.opacity = "0");
|
|
511
617
|
return;
|
|
512
618
|
}
|
|
513
|
-
t || (
|
|
619
|
+
t || (o.current.style.height = `${s.current}px`);
|
|
514
620
|
let e = [];
|
|
515
621
|
e[0] = window.requestAnimationFrame(() => {
|
|
516
622
|
e[1] = window.requestAnimationFrame(() => {
|
|
517
|
-
|
|
623
|
+
o.current && (o.current.style.height = `${t ? s.current : 0}px`, o.current.style.opacity = t ? "1" : "0");
|
|
518
624
|
});
|
|
519
625
|
});
|
|
520
626
|
let n, r = () => {
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
})) :
|
|
627
|
+
o.current && (t ? (o.current.style.height = "auto", o.current.style.overflow = "", o.current.style.opacity = "", window.requestAnimationFrame(() => {
|
|
628
|
+
o.current && (s.current = o.current.offsetHeight);
|
|
629
|
+
})) : o.current.style.height = "0px");
|
|
524
630
|
};
|
|
525
|
-
return
|
|
631
|
+
return l.current === 0 ? r() : n = window.setTimeout(r, l.current), () => {
|
|
526
632
|
e.forEach(window.cancelAnimationFrame), n && window.clearTimeout(n);
|
|
527
633
|
};
|
|
528
634
|
}, [t]), /* @__PURE__ */ g("div", {
|
|
529
|
-
...
|
|
530
|
-
children: [e, /* @__PURE__ */ h(
|
|
531
|
-
|
|
532
|
-
|
|
635
|
+
...a,
|
|
636
|
+
children: [e, /* @__PURE__ */ h(N, {
|
|
637
|
+
classList: "transition-all ease-in-out overflow-hidden",
|
|
638
|
+
className: r,
|
|
639
|
+
role: "group",
|
|
533
640
|
"aria-hidden": !t,
|
|
534
|
-
ref:
|
|
535
|
-
style: { transitionDuration: `${
|
|
641
|
+
ref: o,
|
|
642
|
+
style: { transitionDuration: `${i}ms` },
|
|
536
643
|
children: n
|
|
537
644
|
})]
|
|
538
645
|
});
|
|
539
646
|
}
|
|
540
647
|
//#endregion
|
|
541
648
|
//#region src/components/Tooltip/index.tsx
|
|
542
|
-
var
|
|
649
|
+
var Y = i(({ render: e, position: t = "bottom", label: n, className: r, timeout: i = 150, offset: a = {
|
|
543
650
|
x: 0,
|
|
544
651
|
y: 6
|
|
545
652
|
}, clientPoint: o = !1, disabled: s }, u) => {
|
|
@@ -581,7 +688,7 @@ var q = i(({ render: e, position: t = "bottom", label: n, className: r, timeout:
|
|
|
581
688
|
className: "z-9999",
|
|
582
689
|
ref: S.setFloating,
|
|
583
690
|
...M({ style: w }),
|
|
584
|
-
children: /* @__PURE__ */ h(
|
|
691
|
+
children: /* @__PURE__ */ h(X, {
|
|
585
692
|
className: r,
|
|
586
693
|
style: P,
|
|
587
694
|
children: n
|
|
@@ -589,8 +696,8 @@ var q = i(({ render: e, position: t = "bottom", label: n, className: r, timeout:
|
|
|
589
696
|
})
|
|
590
697
|
})] });
|
|
591
698
|
});
|
|
592
|
-
|
|
593
|
-
var
|
|
699
|
+
Y.displayName = "Tooltip";
|
|
700
|
+
var X = i(({ className: e, custom: t, ...n }, r) => {
|
|
594
701
|
let i = d(() => M(j("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]);
|
|
595
702
|
return /* @__PURE__ */ h("div", {
|
|
596
703
|
ref: r,
|
|
@@ -598,45 +705,14 @@ var J = i(({ className: e, custom: t, ...n }, r) => {
|
|
|
598
705
|
...n
|
|
599
706
|
});
|
|
600
707
|
});
|
|
601
|
-
|
|
602
|
-
//#endregion
|
|
603
|
-
//#region src/elements/Button/index.tsx
|
|
604
|
-
function Y({ variant: e, size: t }) {
|
|
605
|
-
return j("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", {
|
|
606
|
-
"bg-primary text-inverted hover:bg-primary-fore": !e || e === "primary",
|
|
607
|
-
"bg-info text-inverted hover:bg-info-fore": e === "info",
|
|
608
|
-
"bg-warn text-inverted hover:bg-warn-fore": e === "warn",
|
|
609
|
-
"bg-danger text-inverted hover:bg-danger-fore": e === "danger",
|
|
610
|
-
"hover:bg-accent": e === "ghost",
|
|
611
|
-
"hover:underline": e === "link",
|
|
612
|
-
"border border-input hover:bg-accent": e === "outline"
|
|
613
|
-
}, {
|
|
614
|
-
"px-2 py-1": t !== "icon",
|
|
615
|
-
"p-1.5": t === "icon"
|
|
616
|
-
});
|
|
617
|
-
}
|
|
618
|
-
function oe({ size: e, variant: t, className: n, ...r }) {
|
|
619
|
-
let i = d(() => M(Y({
|
|
620
|
-
size: e,
|
|
621
|
-
variant: t
|
|
622
|
-
}), n), [
|
|
623
|
-
e,
|
|
624
|
-
t,
|
|
625
|
-
n
|
|
626
|
-
]);
|
|
627
|
-
return /* @__PURE__ */ h("button", {
|
|
628
|
-
className: i,
|
|
629
|
-
type: "button",
|
|
630
|
-
...r
|
|
631
|
-
});
|
|
632
|
-
}
|
|
708
|
+
X.displayName = "TooltipContent";
|
|
633
709
|
//#endregion
|
|
634
710
|
//#region src/components/Dialog/index.tsx
|
|
635
|
-
var
|
|
711
|
+
var de = {
|
|
636
712
|
open: 150,
|
|
637
713
|
close: 75
|
|
638
714
|
};
|
|
639
|
-
function
|
|
715
|
+
function fe({ open: e, children: t, timeout: n = de, padding: r = "0.85rem", verticalAlign: i = "center", closeOnOverlay: a, closeOnEsc: s, onExited: l, className: u, onOpenChange: p, size: m, ...g }) {
|
|
640
716
|
let v = f(l), y = f(!1), b = D(), { refs: x, context: S } = T({
|
|
641
717
|
open: e,
|
|
642
718
|
onOpenChange: p,
|
|
@@ -675,7 +751,7 @@ function ce({ open: e, children: t, timeout: n = se, padding: r = "0.85rem", ver
|
|
|
675
751
|
opacity: A.opacity
|
|
676
752
|
},
|
|
677
753
|
lockScroll: !0,
|
|
678
|
-
children: /* @__PURE__ */ h(
|
|
754
|
+
children: /* @__PURE__ */ h(pe, {
|
|
679
755
|
ref: x.setFloating,
|
|
680
756
|
className: u,
|
|
681
757
|
role: "dialog",
|
|
@@ -690,7 +766,7 @@ function ce({ open: e, children: t, timeout: n = se, padding: r = "0.85rem", ver
|
|
|
690
766
|
})
|
|
691
767
|
});
|
|
692
768
|
}
|
|
693
|
-
function
|
|
769
|
+
function pe({ size: e, ...t }) {
|
|
694
770
|
return /* @__PURE__ */ h(N, {
|
|
695
771
|
classList: [e ? "flex flex-col bg-background shadow-lg p-5 rounded" : null, {
|
|
696
772
|
"w-full max-w-dialog-sm": e === "small",
|
|
@@ -701,82 +777,12 @@ function le({ size: e, ...t }) {
|
|
|
701
777
|
});
|
|
702
778
|
}
|
|
703
779
|
//#endregion
|
|
704
|
-
//#region src/elements/Skeleton/index.tsx
|
|
705
|
-
function ue(e) {
|
|
706
|
-
return /* @__PURE__ */ h(N, {
|
|
707
|
-
classList: "inline-block animate-pulse rounded-md bg-accent",
|
|
708
|
-
...e
|
|
709
|
-
});
|
|
710
|
-
}
|
|
711
|
-
//#endregion
|
|
712
|
-
//#region src/elements/Button/ButtonGroup.tsx
|
|
713
|
-
function de(e) {
|
|
714
|
-
return /* @__PURE__ */ h(N, {
|
|
715
|
-
role: "group",
|
|
716
|
-
classList: [
|
|
717
|
-
"flex items-center justify-center",
|
|
718
|
-
"[&_button]:rounded-none **:first:rounded-bl **:first:rounded-tl **:last:rounded-br **:last:rounded-tr",
|
|
719
|
-
"**:first:border-r-0 **:last:border-l-0"
|
|
720
|
-
],
|
|
721
|
-
...e
|
|
722
|
-
});
|
|
723
|
-
}
|
|
724
|
-
//#endregion
|
|
725
|
-
//#region src/elements/Spinner/index.tsx
|
|
726
|
-
function fe({ label: e = "Loading...", ...t }) {
|
|
727
|
-
return /* @__PURE__ */ g(N, {
|
|
728
|
-
as: "svg",
|
|
729
|
-
classList: "fill-accent animate-spin text-primary",
|
|
730
|
-
"aria-label": e,
|
|
731
|
-
"aria-hidden": "true",
|
|
732
|
-
width: "32",
|
|
733
|
-
height: "32",
|
|
734
|
-
viewBox: "0 0 100 101",
|
|
735
|
-
fill: "none",
|
|
736
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
737
|
-
...t,
|
|
738
|
-
children: [/* @__PURE__ */ h("path", {
|
|
739
|
-
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",
|
|
740
|
-
fill: "currentFill"
|
|
741
|
-
}), /* @__PURE__ */ h("path", {
|
|
742
|
-
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",
|
|
743
|
-
fill: "currentColor"
|
|
744
|
-
})]
|
|
745
|
-
});
|
|
746
|
-
}
|
|
747
|
-
//#endregion
|
|
748
|
-
//#region src/elements/Progress/index.tsx
|
|
749
|
-
function pe({ value: e, max: t, ...n }) {
|
|
750
|
-
let r = d(() => e ? Math.min(100, Math.round(e / t * 100)) : 0, [e, t]);
|
|
751
|
-
return /* @__PURE__ */ h(N, {
|
|
752
|
-
role: "progressbar",
|
|
753
|
-
classList: "relative overflow-hidden rounded-full bg-primary",
|
|
754
|
-
"aria-valuemax": t,
|
|
755
|
-
"aria-valuemin": 0,
|
|
756
|
-
...n,
|
|
757
|
-
children: /* @__PURE__ */ h(N, {
|
|
758
|
-
className: "h-full w-full flex-1 bg-input transition-all origin-right",
|
|
759
|
-
style: { transform: `translateX(${r}%)` }
|
|
760
|
-
})
|
|
761
|
-
});
|
|
762
|
-
}
|
|
763
|
-
//#endregion
|
|
764
|
-
//#region src/elements/Divider/index.tsx
|
|
765
|
-
function me({ orientation: e = "horizontal", ...t }) {
|
|
766
|
-
return /* @__PURE__ */ h(N, {
|
|
767
|
-
as: "hr",
|
|
768
|
-
role: "none",
|
|
769
|
-
classList: ["border-0 p-0 shrink-0 bg-input", e === "horizontal" ? "h-px w-full" : "w-px h-full"],
|
|
770
|
-
...t
|
|
771
|
-
});
|
|
772
|
-
}
|
|
773
|
-
//#endregion
|
|
774
780
|
//#region src/components/Sheet/index.tsx
|
|
775
|
-
var
|
|
781
|
+
var me = {
|
|
776
782
|
open: 250,
|
|
777
783
|
close: 150
|
|
778
784
|
};
|
|
779
|
-
function
|
|
785
|
+
function he({ open: e, timeout: t = me, onOpenChange: n, position: r = "right", overlay: i, onExited: a, onOpen: o, ...s }) {
|
|
780
786
|
let l = D(), u = f(!1), d = f(o), p = f(a), { refs: m, context: v } = T({
|
|
781
787
|
open: e,
|
|
782
788
|
onOpenChange: n,
|
|
@@ -815,11 +821,11 @@ function ge({ open: e, timeout: t = he, onOpenChange: n, position: r = "right",
|
|
|
815
821
|
"bottom-0 left-0 right-0 w-full max-w-screen": r === "bottom"
|
|
816
822
|
}],
|
|
817
823
|
style: b,
|
|
818
|
-
children: /* @__PURE__ */ h(
|
|
824
|
+
children: /* @__PURE__ */ h(ge, { ...s })
|
|
819
825
|
})]
|
|
820
826
|
});
|
|
821
827
|
}
|
|
822
|
-
function
|
|
828
|
+
function ge(e) {
|
|
823
829
|
return /* @__PURE__ */ h(N, {
|
|
824
830
|
classList: "relative bg-background min-w-full min-h-full border border-input shadow-lg",
|
|
825
831
|
...e
|
|
@@ -827,7 +833,7 @@ function _e(e) {
|
|
|
827
833
|
}
|
|
828
834
|
//#endregion
|
|
829
835
|
//#region src/components/Toast/ToastItem.tsx
|
|
830
|
-
function
|
|
836
|
+
function Z({ type: e, label: t, message: n }) {
|
|
831
837
|
let { icons: r } = ye();
|
|
832
838
|
return /* @__PURE__ */ g("div", {
|
|
833
839
|
className: "flex items-center px-4 py-3 w-80 text-sm bg-background border border-input rounded-lg shadow-md m-2",
|
|
@@ -851,12 +857,12 @@ function X({ type: e, label: t, message: n }) {
|
|
|
851
857
|
}
|
|
852
858
|
//#endregion
|
|
853
859
|
//#region src/components/Toast/observer.ts
|
|
854
|
-
function
|
|
855
|
-
var
|
|
856
|
-
notify =
|
|
860
|
+
function Q() {}
|
|
861
|
+
var $ = new class {
|
|
862
|
+
notify = Q;
|
|
857
863
|
lastId = 0;
|
|
858
864
|
subscribe = (e) => (this.notify = e, () => {
|
|
859
|
-
this.notify =
|
|
865
|
+
this.notify = Q;
|
|
860
866
|
});
|
|
861
867
|
add = (e, t = {}) => {
|
|
862
868
|
this.lastId += 1;
|
|
@@ -890,7 +896,7 @@ var Q = new class {
|
|
|
890
896
|
}();
|
|
891
897
|
//#endregion
|
|
892
898
|
//#region src/components/Toast/ToastFloat.tsx
|
|
893
|
-
function
|
|
899
|
+
function _e({ id: t, type: n, index: r, duration: i = 5e3, className: a, children: s, inverted: l, timeout: m = 250, max: g = 3 }) {
|
|
894
900
|
let _ = f(!1), [v, y] = p(!1), { context: b, refs: x } = T({
|
|
895
901
|
open: v,
|
|
896
902
|
onOpenChange: y,
|
|
@@ -905,7 +911,7 @@ function ve({ id: t, type: n, index: r, duration: i = 5e3, className: a, childre
|
|
|
905
911
|
u(() => {
|
|
906
912
|
y(r <= g);
|
|
907
913
|
}, [r, g]), c(() => {
|
|
908
|
-
_.current !== S && (S ||
|
|
914
|
+
_.current !== S && (S || $.remove(t), _.current = S);
|
|
909
915
|
}, [S, t]), c(() => {
|
|
910
916
|
if (!i) return;
|
|
911
917
|
let e = window.setTimeout(() => y(!1), i);
|
|
@@ -926,11 +932,11 @@ function ve({ id: t, type: n, index: r, duration: i = 5e3, className: a, childre
|
|
|
926
932
|
}
|
|
927
933
|
//#endregion
|
|
928
934
|
//#region src/components/Toast/index.tsx
|
|
929
|
-
var
|
|
935
|
+
var ve = n({});
|
|
930
936
|
function ye() {
|
|
931
|
-
return s(
|
|
937
|
+
return s(ve);
|
|
932
938
|
}
|
|
933
|
-
function be({ className: t, offset: n = {}, position: i = "top-left", max: o, ListItem: s =
|
|
939
|
+
function be({ className: t, offset: n = {}, position: i = "top-left", max: o, ListItem: s = Z, icons: c }) {
|
|
934
940
|
let l = d(() => {
|
|
935
941
|
let e = {
|
|
936
942
|
position: "fixed",
|
|
@@ -938,7 +944,7 @@ function be({ className: t, offset: n = {}, position: i = "top-left", max: o, Li
|
|
|
938
944
|
};
|
|
939
945
|
return Object.keys(n).length || (i.indexOf("top") > -1 ? e.top = "16px" : i.indexOf("bottom") > -1 && (e.bottom = "16px"), i.indexOf("left") > -1 ? e.left = "16px" : i.indexOf("right") > -1 && (e.right = "16px")), i.indexOf("left") > -1 ? e.alignItems = "flex-start" : i.indexOf("right") > -1 ? e.alignItems = "flex-end" : (e.left = "50%", e.alignItems = "center", e.transform = "translateX(-50%)"), e;
|
|
940
946
|
}, [n, i]), u = d(() => e("flex flex-col z-40 overflow-hidden", t), [t]), m = d(() => i?.startsWith("bottom") || !1, [i]), g = f(/* @__PURE__ */ new Map()), [_, v] = p([]), y = p(0)[1];
|
|
941
|
-
H(() =>
|
|
947
|
+
H(() => $.subscribe((e) => {
|
|
942
948
|
a(() => {
|
|
943
949
|
if (e.type === "add") g.current.set(e.id, e.config), v((t) => [...t, e.id]);
|
|
944
950
|
else if (e.type === "remove") {
|
|
@@ -962,13 +968,13 @@ function be({ className: t, offset: n = {}, position: i = "top-left", max: o, Li
|
|
|
962
968
|
className: u,
|
|
963
969
|
style: l,
|
|
964
970
|
"aria-live": "polite",
|
|
965
|
-
children: /* @__PURE__ */ h(
|
|
971
|
+
children: /* @__PURE__ */ h(ve.Provider, {
|
|
966
972
|
value: b,
|
|
967
973
|
children: _.map((e, t) => {
|
|
968
974
|
let n = g.current.get(e);
|
|
969
975
|
if (!n) return null;
|
|
970
976
|
let { className: i, duration: a, ...c } = n;
|
|
971
|
-
return /* @__PURE__ */ h(
|
|
977
|
+
return /* @__PURE__ */ h(_e, {
|
|
972
978
|
id: e,
|
|
973
979
|
index: x - t,
|
|
974
980
|
className: i,
|
|
@@ -982,4 +988,4 @@ function be({ className: t, offset: n = {}, position: i = "top-left", max: o, Li
|
|
|
982
988
|
}) });
|
|
983
989
|
}
|
|
984
990
|
//#endregion
|
|
985
|
-
export {
|
|
991
|
+
export { ue as Accordion, N as Base, ae as Button, oe as ButtonGroup, V as Checkbox, fe as Dialog, le as Divider, I as FormField, F as FormLabel, R as Input, L as InputField, G as Popover, U as Portal, ce as Progress, ne as Radio, K as Select, he as Sheet, ie as Skeleton, se as Spinner, re as Switch, z as Textarea, be as Toast, Z as ToastItem, Y as Tooltip, j as cn, P as element, M as merge, $ as toast, J as varientButton };
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"url": "git+https://github.com/visits-works/visits-style.git"
|
|
6
6
|
},
|
|
7
7
|
"homepage": "https://github.com/visits-works/visits-style",
|
|
8
|
-
"version": "2.3.
|
|
8
|
+
"version": "2.3.4",
|
|
9
9
|
"description": "VISITS Technologiesのreactデザインコンポーネント",
|
|
10
10
|
"type": "module",
|
|
11
11
|
"main": "./dist/index.cjs.js",
|