visits-style 2.2.0 → 2.2.1
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 +17 -0
- package/dist/components/Dialog/DialogHeader.d.ts +7 -0
- package/dist/components/Dialog/index.d.ts +50 -0
- package/dist/components/Popover/index.d.ts +58 -0
- package/dist/components/Portal/index.d.ts +7 -0
- package/dist/components/Sheet/index.d.ts +33 -0
- package/dist/components/Toast/ToastFloat.d.ts +11 -0
- package/dist/components/Toast/ToastItem.d.ts +2 -0
- package/dist/components/Toast/index.d.ts +3 -0
- package/dist/components/Toast/observer.d.ts +28 -0
- package/dist/components/Toast/types.d.ts +62 -0
- package/dist/components/Tooltip/index.d.ts +43 -0
- package/dist/components/index.d.ts +11 -0
- package/dist/elements/Base.d.ts +14 -0
- package/dist/elements/Button/ButtonGroup.d.ts +2 -0
- package/dist/elements/Button/index.d.ts +9 -0
- package/dist/elements/Divider/index.d.ts +6 -0
- package/dist/elements/Progress/index.d.ts +11 -0
- package/dist/elements/Skeleton/index.d.ts +4 -0
- package/dist/elements/Spinner/index.d.ts +7 -0
- package/dist/elements/index.d.ts +7 -0
- package/dist/forms/Checkbox/index.d.ts +13 -0
- package/dist/forms/Field/FormField.d.ts +16 -0
- package/dist/forms/Field/FormLabel.d.ts +2 -0
- package/dist/forms/Field/InputField.d.ts +7 -0
- package/dist/forms/Input/index.d.ts +8 -0
- package/dist/forms/Radio/RadioGroup.d.ts +14 -0
- package/dist/forms/Radio/index.d.ts +10 -0
- package/dist/forms/Select/index.d.ts +49 -0
- package/dist/forms/Select/native.d.ts +11 -0
- package/dist/forms/Switch/index.d.ts +8 -0
- package/dist/forms/Textarea/index.d.ts +8 -0
- package/dist/forms/index.d.ts +9 -0
- package/dist/hooks/useIsomorphicLayoutEffect.d.ts +3 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +4 -476
- package/dist/index.es.js +985 -1016
- package/dist/utils/isClient.d.ts +2 -0
- package/dist/utils/merge.d.ts +4 -0
- package/dist/utils/stopPropagation.d.ts +2 -0
- package/package.json +6 -6
package/dist/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("clsx"),ee=require("tailwind-merge"),n=require("react/jsx-runtime"),o=require("react"),d=require("@floating-ui/react"),te=require("react-dom");function I(...e){return e.length?_(...e):""}function E(e,t){return t?ee.twMerge(e,t):e}function v({as:e,classList:t=[],className:s,...r}){const l=o.useMemo(()=>Array.isArray(t)?t.length?E(I(...t),s):s:E(I(t),s),[t,s]);return o.createElement(e||"div",{className:l,...r})}function W(e){return n.jsx(v,{as:"label",classList:["leading-none peer-disabled:opacity-70"],...e})}function ne({label:e,children:t,required:s,htmlFor:r,error:l,help:i,helpBefore:a,innerClass:c,...f}){const p=o.useMemo(()=>I("font-medium",s?'after:content-["*"] after:text-danger after:text-sm after:pl-0.5':""),[s]);return n.jsxs(v,{classList:"flex flex-col space-y-2",...f,children:[e?n.jsx(W,{className:p,htmlFor:r,children:e}):null,i&&a?n.jsx("p",{className:"text-xs text-muted pb-2",children:i}):null,n.jsx("div",{className:c,children:re(t,!!l)}),i&&!a&&!l?n.jsx("p",{className:"text-xs text-muted",children:i}):null,l?n.jsx("p",{className:"text-xs text-danger",children:l}):null]})}function re(e,t){const s=o.Children.count(e);if(!s)return null;if(s===1)return o.cloneElement(e,{error:t});const r=o.Children.toArray(e);return r[0]=o.cloneElement(r[0],{error:t}),r}function se({error:e,customStyle:t,...s}){return n.jsx(v,{classList:t?void 0:["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"],...s})}function oe({type:e,error:t,customStyle:s,...r}){return n.jsx(v,{as:"input",type:e,classList:s?void 0:["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],...r})}function ie({error:e,customStyle:t,...s}){return n.jsx(v,{as:"textarea",classList:t?void 0:["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"],...s})}function le(){return n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"30",height:"30",viewBox:"0 0 30 30",children:n.jsx("rect",{width:"20",height:"3",y:"13.5",x:"4.5",fill:"currentColor",stroke:"none",rx:"2"})})}function ae({checked:e,indeterminate:t,id:s,name:r,onChange:l,value:i,checkIcon:a,error:c,...f}){const p=()=>{f.disabled||l?.(!e)};return n.jsxs(v,{as:"button",type:"button",role:"checkbox",id:s||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":c,"bg-primary text-inverted disabled:text-text disabled:bg-input disabled:border-input":!c&&e,"border-input not-disabled:hover:border-input-fore":!c&&!e}],onClick:p,"aria-checked":e,...f,children:[e?a:null,t&&!e?n.jsx(le,{}):null,n.jsx("input",{type:"checkbox","aria-hidden":"true",name:r,checked:e,value:i,onChange:p,disabled:f.disabled,style:{position:"absolute",pointerEvents:"none",top:0,left:0,width:1,height:1,opacity:0}})]})}const ue=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",H=ue?o.useLayoutEffect:o.useEffect;function A({children:e,container:t,disabled:s}){const[r,l]=o.useState(null);return H(()=>{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]),s||!r?null:te.createPortal(e,r)}function $(e){e&&(e.stopPropagation(),e.preventDefault())}const ce={open:150,close:75};function Z({ref:e,position:t,label:s,children:r,disabled:l,offset:i={x:0,y:6},onOpen:a,onClose:c,onManualClose:f,timeout:p=ce,customStyle:x,zIndex:h=9996,role:C,...k}){const[g,u]=o.useState(!1),j=d.useId(),m=o.useRef(a),y=o.useRef(c),{refs:w,floatingStyles:N,context:T}=d.useFloating({nodeId:j,placement:t,middleware:[d.shift(),d.flip({fallbackAxisSideDirection:"end"}),d.offset({mainAxis:i.y,crossAxis:i.x})],open:g,onOpenChange:M=>{M?m.current?.(w.reference.current,w.floating.current):y.current?.(w.reference.current,w.floating.current),u(M)},whileElementsMounted:d.autoUpdate}),{isMounted:D,styles:L}=d.useTransitionStyles(T,{duration:p,initial({side:M}){let S="";return M==="top"?S="translateY(5%) scale(0.95)":M==="bottom"?S="translateY(-5%) scale(0.95)":M==="left"?S="translateX(5%) scale(0.95)":S="translateX(-5%) scale(0.95)",{opacity:0,transform:S}}}),P=o.useCallback(M=>{if($(M),f)return f();u(!1),y.current?.(w.reference.current,w.floating.current)},[f]);o.useEffect(()=>{if(l&&g)return u(!1)},[l,g]),o.useImperativeHandle(e,()=>({open:()=>{u(!0),m.current?.(w.reference.current,w.floating.current)},close:()=>{u(!1),y.current?.(w.reference.current,w.floating.current)}}),[]);const{getFloatingProps:B,getReferenceProps:O}=d.useInteractions([d.useClick(T,{enabled:!l})]);return m.current=a,y.current=c,n.jsxs(n.Fragment,{children:[o.cloneElement(o.Children.only(s),O({ref:w.setReference,tabIndex:0,role:"button","aria-expanded":g,disabled:l,onClick:$})),n.jsx(A,{disabled:l||!D,children:n.jsx(d.FloatingOverlay,{"data-testid":"vs-popover-shadow",onClick:P,style:{zIndex:h},autoFocus:!0,children:n.jsx("div",{role:C||"region",ref:w.setFloating,style:N,children:n.jsx(de,{customStyle:x,styles:L,...B({...k,onClick:$}),children:r})})})})]})}function de({customStyle:e,styles:t,style:s={},...r}){return n.jsx(v,{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,...s},...r})}function fe({className:e,placeholder:t="",options:s=[],error:r,customStyle:l,disabled:i,value:a,maxHeight:c=408,arrowIcon:f,closeIcon:p,checkIcon:x,onChange:h,onClear:C,renderItem:k,sectionLabelStyle:g,buttonAreaStyle:u,clearLabelText:j,optionStyle:m,...y}){const w=o.useRef(null),[N,T]=o.useState(0),D=o.useMemo(()=>Array.isArray(a),[]),L=o.useCallback(b=>{h?.(b),D||w.current?.close()},[h,D]),P=o.useCallback(b=>Array.isArray(a)?a.indexOf(b)>-1:a===b,[a]),B=o.useMemo(()=>{const b={},F=s.filter(R=>typeof R!="string");for(let R=0,q=F.length;R<q;R+=1){const Y=F[R];b[`${Y.value}`]=Y.label}return b},[s]),O=o.useMemo(()=>{if(!a)return t;if(Array.isArray(a)){if(!a.length)return t;const b=[...a].sort(),F=[];for(let R=0,q=b.length;R<q;R+=1)F[R]=B[`${b[R]}`]||"";return F.filter(Boolean).join(",")||t}return B[`${a}`]||t},[t,a,B]),M=o.useMemo(()=>a==null?!0:Array.isArray(a)?!a.length:!1,[a]),S=o.useCallback((b,F)=>k?typeof b=="string"?k(b,{index:F,selected:!1,onChange:()=>{}}):k(b,{index:F,selected:P(b.value),onChange:()=>L(b.value)}):typeof b=="string"?n.jsx(v,{as:"h5",classList:["font-normal py-1 px-2 text-muted"],className:g,children:b},`optionheader-${F}`):n.jsx(pe,{selected:P(b.value),onChange:L,checkIcon:x,className:m,...b},b.label),[k,L,P,g,m,x]);return n.jsx(Z,{label:n.jsxs(v,{as:"button",type:"button",classList:l?void 0:["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"],className:e,disabled:i,...y,children:[n.jsx(v,{as:"span",classList:["overflow-hidden overflow-ellipsis whitespace-nowrap",M?"text-muted":"text-text"],children:O}),n.jsxs(v,{classList:"relative flex items-center space-x-2",className:u,children:[C&&!M?n.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:p}):null,f]})]}),ref:w,onOpen:b=>T(b?.getBoundingClientRect().width||0),disabled:i,children:n.jsx("ul",{className:"overflow-y-auto flex flex-col",role:"listbox",style:{minWidth:N,maxWidth:"calc(100vw - 3rem)",maxHeight:c},children:s.map(S)})})}function pe({className:e,value:t,label:s,selected:r,checkIcon:l,onChange:i}){return n.jsxs(v,{as:"button",type:"button",role:"option",classList:"flex items-center w-full hover:bg-accent rounded p-1 cursor-pointer",className:e,"aria-selected":r,onClick:()=>i?.(t),children:[r&&l?l:n.jsx("div",{className:"w-5 h-1 mr-1"}),s]})}function be({checked:e,className:t,id:s,name:r,onChange:l,value:i,error:a,...c}){const f=()=>{c.disabled||l?.(!e)};return n.jsxs(v,{as:"button",type:"button",role:"radio",id:s||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",a?"border-danger":"border-input",e?"[&_i]:bg-primary disabled:[&_i]:bg-text disabled:border-input":""],className:t,onClick:f,"aria-checked":e,...c,children:[n.jsx("i",{className:"block w-2.5 h-2.5 rounded-full transition-transform",style:{transform:e?"":"scale(0.8)",opacity:e?1:0}}),n.jsx("input",{type:"radio","aria-hidden":"true",name:r,checked:e,value:i,onChange:f,disabled:c.disabled,style:{position:"absolute",pointerEvents:"none",top:0,left:0,width:1,height:1,opacity:0}})]})}function ge({checked:e,onChange:t,value:s,id:r,name:l,error:i,ref:a,...c}){const f=()=>{c.disabled||t?.(!e)};return n.jsxs(v,{as:"button",type:"button",role:"switch",id:r||l,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:f,"aria-checked":e,"aria-invalid":i,...c,children:[n.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%)":""}}),n.jsx("input",{ref:a,type:"checkbox","aria-hidden":"true",name:l,checked:e,value:s,onChange:f,disabled:c.disabled,style:{position:"absolute",pointerEvents:"none",top:0,left:0,width:1,height:1,opacity:0}})]})}function me({header:e,show:t,children:s,timeout:r=300,...l}){const i=o.useRef(null),a=o.useRef(0),c=o.useRef(0),f=o.useRef(!0);return o.useEffect(()=>{c.current=r},[r]),H(()=>{if(!i.current)return;if(i.current.style.overflow="hidden",i.current.style.opacity="1",f.current){f.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 p=[];p[0]=window.requestAnimationFrame(()=>{p[1]=window.requestAnimationFrame(()=>{i.current&&(i.current.style.height=`${t?a.current:0}px`,i.current.style.opacity=t?"1":"0")})});let x;const h=()=>{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?h():x=window.setTimeout(h,c.current),()=>{p.forEach(window.cancelAnimationFrame),x&&window.clearTimeout(x)}},[t]),n.jsxs("div",{...l,children:[e,n.jsx("div",{className:"transition-all ease-in-out overflow-hidden",role:"region","aria-hidden":!t,ref:i,style:{transitionDuration:`${r}ms`},children:s})]})}const G=o.forwardRef(({children:e,position:t="bottom",label:s,className:r,timeout:l=150,offset:i={x:0,y:6},clientPoint:a=!1,disabled:c},f)=>{const[p,x]=o.useState(!1),h=d.useId(),{refs:C,floatingStyles:k,context:g}=d.useFloating({nodeId:h,open:p,placement:t,middleware:[d.shift(),d.flip(),d.offset({mainAxis:i.y,crossAxis:i.x})],whileElementsMounted:c?void 0:d.autoUpdate,onOpenChange:x}),{getReferenceProps:u,getFloatingProps:j}=d.useInteractions([d.useHover(g,{enabled:!c}),d.useClientPoint(g,{enabled:a})]),{isMounted:m,styles:y}=d.useTransitionStyles(g,{duration:l,initial:{opacity:0,transform:"scale(0.8)"}});o.useImperativeHandle(f,()=>({floating:C.floating,reference:C.reference,open:()=>x(!0),close:()=>x(!1)})),o.useEffect(()=>{c&&x(!1)},[c]);const w=typeof e=="string"?n.jsx("span",{children:e}):e;return n.jsxs(n.Fragment,{children:[o.cloneElement(o.Children.only(w),{ref:C.setReference,...u()}),n.jsx(A,{disabled:c||!m,children:n.jsx("div",{role:"tooltip",className:"z-9999",ref:C.setFloating,...j({style:k}),children:n.jsx(K,{className:r,style:y,children:s})})})]})});G.displayName="Tooltip";const K=o.forwardRef(({className:e,custom:t,...s},r)=>{const l=o.useMemo(()=>E(I("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 n.jsx("div",{ref:r,className:l,...s})});K.displayName="TooltipContent";function U({variant:e,size:t}){return I("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 xe({size:e,variant:t,className:s,...r}){const l=o.useMemo(()=>E(U({size:e,variant:t}),s),[e,t,s]);return n.jsx("button",{className:l,type:"button",...r})}const he={open:150,close:75};function ye({open:e,children:t,timeout:s=he,padding:r="0.85rem",verticalAlign:l="center",closeOnOverlay:i,closeOnEsc:a,onExited:c,className:f,onOpenChange:p,size:x,...h}){const C=o.useRef(c),k=o.useRef(!1),g=d.useId(),{refs:u,context:j}=d.useFloating({open:e,onOpenChange:p,nodeId:g}),{getFloatingProps:m}=d.useInteractions([d.useDismiss(j,{enabled:a,escapeKey:a,outsidePress:!1})]),{isMounted:y,styles:w}=d.useTransitionStyles(j,{duration:s,initial:{opacity:0,transform:"scale(0.8)"}});o.useEffect(()=>{k.current!==y&&(k.current=y,!y&&C.current?.())},[y]);const N=o.useCallback(()=>{i&&p?.(!1)},[p,i]);C.current=c;const T=o.useMemo(()=>I("grid bg-backdrop z-40 justify-items-center transition ease-in-out",{"place-items-start items-start":l==="start","place-items-end":l==="end","place-items-center":l==="center"||!l}),[l]);return n.jsx(A,{disabled:!y,children:n.jsx(d.FloatingOverlay,{className:T,"data-testid":"vs-dialog-overlay",onClick:N,style:{padding:r,opacity:w.opacity},lockScroll:!0,children:n.jsx(we,{ref:u.setFloating,className:f,role:"dialog",size:x,onClick:$,...m({...h,style:w}),children:t})})})}function we({size:e,...t}){return n.jsx(v,{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})}const ve={open:250,close:150};function je({open:e,timeout:t=ve,onOpenChange:s,position:r="right",overlay:l,onExited:i,onOpen:a,...c}){const f=d.useId(),p=o.useRef(!1),x=o.useRef(a),h=o.useRef(i),{refs:C,context:k}=d.useFloating({open:e,onOpenChange:s,nodeId:f}),{isMounted:g,styles:u}=d.useTransitionStyles(k,{duration:t,initial(){let m="translateX(75%)";return r==="left"?m="translateX(-75%)":r==="top"?m="translateY(-75%)":r==="bottom"&&(m="translateY(75%)"),{opacity:0,transform:m}}});o.useEffect(()=>{if(p.current!==g){if(p.current=g,g){x.current?.();return}h.current?.()}},[g]);const j=o.useMemo(()=>I("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 h.current=i,x.current=a,n.jsxs(A,{disabled:!g,children:[l?n.jsx(d.FloatingOverlay,{className:"bg-backdrop",style:{opacity:u.opacity},onClick:()=>s?.(!1)}):null,n.jsx("div",{ref:C.setFloating,className:j,role:"dialog",style:u,children:n.jsx(Ce,{...c})})]})}function Ce({className:e,customStyle:t,...s}){const r=o.useMemo(()=>t?e:E(I("relative bg-background min-w-full min-h-full border border-input shadow-lg"),e),[t,e]);return n.jsx("div",{className:r,...s})}function J({size:e=20,label:t="Loading...",...s}){return n.jsxs("div",{role:"status",...s,children:[n.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:[n.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"}),n.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"})]}),n.jsx("span",{className:"sr-only",children:t})]})}function Q({type:e,label:t,message:s}){const{icons:r}=Re();return n.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?n.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"?n.jsx(J,{size:20}):null]}):null,n.jsxs("div",{className:"space-y-2",children:[n.jsx("p",{className:"font-medium leading-none",children:t}),s?n.jsx("p",{children:s}):null]})]})}function z(){}class ke{notify=z;lastId=0;subscribe=t=>(this.notify=t,()=>{this.notify=z});add=(t,s={})=>{this.lastId+=1;const r=`${this.lastId}`;return this.notify({id:r,type:"add",config:{id:r,label:t,...s}}),r};update=(t,s)=>{this.notify({id:t,type:"update",config:s})};remove=t=>{this.notify({id:t,type:"remove"})};clear=()=>{this.lastId=0}}const X=new ke;function Me({id:e,type:t,index:s,duration:r=5e3,className:l,children:i,inverted:a,timeout:c=250,max:f=3}){const p=o.useRef(!1),[x,h]=o.useState(!1),{context:C,refs:k}=d.useFloating({open:x,onOpenChange:h,nodeId:e}),{isMounted:g,styles:u}=d.useTransitionStyles(C,{duration:c,initial:{opacity:0,transform:`translateY(${a?"":"-"}50%)`}});o.useLayoutEffect(()=>{h(s<=f)},[s,f]),o.useEffect(()=>{p.current!==g&&(g||X.remove(e),p.current=g)},[g,e]),o.useEffect(()=>{if(!r)return;const y=window.setTimeout(()=>h(!1),r);return()=>window.clearTimeout(y)},[r,e]);const j=o.useCallback(()=>{t!=="loading"&&h(!1)},[t]),m=o.useMemo(()=>_("relative flex w-fit transition-transform ease-in-out cursor-pointer",l),[l]);return g?n.jsx("li",{role:"log",tabIndex:-1,ref:k.setFloating,className:m,style:u,onClick:j,children:i}):null}const V=o.createContext({});function Re(){return o.useContext(V)}function Fe({className:e,margin:t=16,position:s="top-left",max:r,ListItem:l=Q,icons:i}){const a=o.useMemo(()=>{const u={position:"fixed"};return s.indexOf("top")>-1?u.top=t:s.indexOf("bottom")>-1&&(u.bottom=t),s.indexOf("left")>-1?(u.left=t,u.alignItems="flex-start"):s.indexOf("right")>-1?(u.right=t,u.alignItems="flex-end"):(u.left="50%",u.alignItems="center",u.transform="translateX(-50%)"),u},[t,s]),c=o.useMemo(()=>_("flex flex-col z-40 overflow-hidden",e),[e]),f=o.useMemo(()=>s?.startsWith("bottom")||!1,[s]),p=o.useRef(new Map),[x,h]=o.useState([]),C=o.useState(0)[1];H(()=>X.subscribe(u=>{o.startTransition(()=>{if(u.type==="add")p.current.set(u.id,u.config),h(j=>[...j,u.id]);else if(u.type==="remove"){if(!p.current.delete(u.id))return;h(m=>{const y=new Set(m);return y.has(u.id)?(y.delete(u.id),Array.from(y)):m})}else if(u.type==="update"){const j=p.current.get(u.id);if(!j)return;p.current.set(u.id,{...j,...u.config}),C(m=>m+1)}})}),[]);const k=o.useMemo(()=>({icons:i}),[i]),g=x.length;return n.jsx(A,{children:n.jsx("ol",{className:c,style:a,"aria-live":"polite",children:n.jsx(V.Provider,{value:k,children:x.map((u,j)=>{const m=p.current.get(u);if(!m)return null;const{className:y,duration:w,...N}=m;return n.jsx(Me,{id:u,index:g-j,className:y,duration:w,inverted:f,max:r,children:o.createElement(l,N)},u)})})})})}function Ie(e){return n.jsx(v,{classList:"inline-block animate-pulse rounded-md bg-accent",...e})}function Ne(e){return n.jsx(v,{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 Se({value:e,max:t,...s}){const r=o.useMemo(()=>e?Math.min(100,Math.round(e/t*100)):0,[e,t]);return n.jsx(v,{role:"progressbar",classList:"relative overflow-hidden rounded-full bg-primary","aria-valuemax":t,"aria-valuemin":0,...s,children:n.jsx(v,{className:"h-full w-full flex-1 bg-input transition-all origin-right",style:{transform:`translateX(${r}%)`}})})}function Te({orientation:e="horizontal",...t}){return n.jsx(v,{as:"hr",role:"none",classList:["border-0 p-0 shrink-0 bg-input",e==="horizontal"?"h-px w-full":"w-px h-full"],...t})}exports.Accordion=me;exports.Base=v;exports.Button=xe;exports.ButtonGroup=Ne;exports.Checkbox=ae;exports.Dialog=ye;exports.Divider=Te;exports.FormField=ne;exports.FormLabel=W;exports.Input=oe;exports.InputField=se;exports.Popover=Z;exports.Portal=A;exports.Progress=Se;exports.Radio=be;exports.Select=fe;exports.Sheet=je;exports.Skeleton=Ie;exports.Spinner=J;exports.Switch=ge;exports.Textarea=ie;exports.Toast=Fe;exports.ToastItem=Q;exports.Tooltip=G;exports.cn=I;exports.merge=E;exports.toast=X;exports.varientButton=U;
|
|
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){return(0,d.jsx)(g,{as:`label`,classList:[`leading-none peer-disabled:opacity-70`],...e})}function v({label:e,children: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)(_,{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:y(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 y(e,t){let n=u.Children.count(e);if(!n)return null;if(n===1)return(0,u.cloneElement)(e,{error:t});let r=u.Children.toArray(e);return r[0]=(0,u.cloneElement)(r[0],{error:t}),r}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,label: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:[(0,u.cloneElement)(u.Children.only(n),N({ref:S.setReference,tabIndex:0,role:`button`,"aria-expanded":_,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({className:e,placeholder:t=``,options:n=[],error:r,disabled:i,value:a,maxHeight:o=408,arrowIcon:s,closeIcon:c,checkIcon:l,onChange:f,onClear:p,renderItem:m,sectionLabelStyle:h,buttonAreaStyle:_,clearLabelText:v,optionStyle:y,...b}){let x=(0,u.useRef)(null),[S,C]=(0,u.useState)(0),w=(0,u.useMemo)(()=>Array.isArray(a),[]),T=(0,u.useCallback)(e=>{f?.(e),w||x.current?.close()},[f,w]),E=(0,u.useCallback)(e=>Array.isArray(a)?a.indexOf(e)>-1:a===e,[a]),D=(0,u.useMemo)(()=>{let e={},t=n.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},[n]),O=(0,u.useMemo)(()=>{if(!a)return t;if(Array.isArray(a)){if(!a.length)return t;let e=[...a].sort(),n=[];for(let t=0,r=e.length;t<r;t+=1)n[t]=D[`${e[t]}`]||``;return n.filter(Boolean).join(`,`)||t}return D[`${a}`]||t},[t,a,D]),A=(0,u.useMemo)(()=>a==null?!0:Array.isArray(a)?!a.length:!1,[a]),j=(0,u.useCallback)((e,t)=>m?typeof e==`string`?m(e,{index:t,selected:!1,onChange:()=>{}}):m(e,{index:t,selected:E(e.value),onChange:()=>T(e.value)}):typeof e==`string`?(0,d.jsx)(g,{as:`h5`,classList:[`font-normal py-1 px-2 text-muted`],className:h,children:e},`optionheader-${t}`):(0,d.jsx)(M,{selected:E(e.value),onChange:T,checkIcon:l,className:y,...e},e.label),[m,T,E,h,y,l]);return(0,d.jsx)(k,{label:(0,d.jsxs)(g,{as:`button`,type:`button`,classList:[`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`],className:e,disabled:i,...b,children:[(0,d.jsx)(g,{as:`span`,classList:[`overflow-hidden text-ellipsis whitespace-nowrap`,A?`text-muted`:`text-text`],children:O}),(0,d.jsxs)(g,{classList:`relative flex items-center space-x-2`,className:_,children:[p&&!A?(0,d.jsx)(`div`,{tabIndex:-1,role:`button`,className:`size-6 p-1.5 rounded hover:bg-accent cursor-pointer`,"aria-label":v,onKeyDown:e=>{(e.key===`Enter`||e.key===`Space`)&&p()},onClick:e=>{e.stopPropagation(),p()},children:c}):null,s]})]}),ref:x,onOpen:e=>C(e?.getBoundingClientRect().width||0),disabled:i,children:(0,d.jsx)(`ul`,{className:`overflow-y-auto flex flex-col`,role:`listbox`,style:{minWidth:S,maxWidth:`calc(100vw - 3rem)`,maxHeight:o},children:n.map(j)})})}function M({className:e,value:t,label:n,selected:r,checkIcon:i,onChange:a}){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":r,onClick:()=>a?.(t),children:[r&&i?i:(0,d.jsx)(`div`,{className:`w-5 h-1 mr-1`}),n]})}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)(({children: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)`}});(0,u.useImperativeHandle)(c,()=>({floating:h.floating,reference:h.reference,open:()=>p(!0),close:()=>p(!1)})),(0,u.useEffect)(()=>{s&&p(!1)},[s]);let S=typeof e==`string`?(0,d.jsx)(`span`,{children:e}):e;return(0,d.jsxs)(d.Fragment,{children:[(0,u.cloneElement)(u.Children.only(S),{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,"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,onClick:D,...x({...h,style:C}),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({size:e=20,label:t=`Loading...`,...n}){return(0,d.jsxs)(`div`,{role:`status`,...n,children:[(0,d.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:[(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:`currentColor`}),(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:`currentFill`})]}),(0,d.jsx)(`span`,{className:`sr-only`,children:t})]})}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:`bg-backdrop`,style:{opacity:y.opacity},onClick:()=>n?.(!1)}):null,(0,d.jsx)(g,{ref:h.setFloating,role:`dialog`,classList:[`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`}],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`?(0,d.jsx)(G,{size:20}):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=v,exports.FormLabel=_,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.merge=h,exports.toast=Q,exports.varientButton=R;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,476 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import { ForwardRefExoticComponent } from 'react';
|
|
6
|
-
import { FunctionComponent } from 'react';
|
|
7
|
-
import { HTMLAttributes } from 'react';
|
|
8
|
-
import { InputHTMLAttributes } from 'react';
|
|
9
|
-
import { JSX } from 'react/jsx-runtime';
|
|
10
|
-
import { LabelHTMLAttributes } from 'react';
|
|
11
|
-
import { Placement } from '@floating-ui/core';
|
|
12
|
-
import { ReactElement } from 'react';
|
|
13
|
-
import { ReactNode } from 'react';
|
|
14
|
-
import { ReactPortal } from 'react';
|
|
15
|
-
import { Ref } from 'react';
|
|
16
|
-
import { RefAttributes } from 'react';
|
|
17
|
-
import { ReferenceElement } from '@floating-ui/core';
|
|
18
|
-
import { ReferenceType } from '@floating-ui/react';
|
|
19
|
-
import { RefObject } from 'react';
|
|
20
|
-
import { TextareaHTMLAttributes } from 'react';
|
|
21
|
-
|
|
22
|
-
export declare function Accordion({ header, show, children, timeout, ...rest }: AccordionProps): JSX.Element;
|
|
23
|
-
|
|
24
|
-
export declare interface AccordionProps extends HTMLAttributes<HTMLDivElement> {
|
|
25
|
-
/**
|
|
26
|
-
* ボタンなどの表示するラベル\
|
|
27
|
-
* showを変更するロジックのイベントが必要となります
|
|
28
|
-
*/
|
|
29
|
-
header: ReactNode;
|
|
30
|
-
/** trueの場合、内容を開きます */
|
|
31
|
-
show: boolean;
|
|
32
|
-
/**
|
|
33
|
-
* アニメーションの時間\
|
|
34
|
-
* 0に設定すると、即時に反応します
|
|
35
|
-
* @default 300
|
|
36
|
-
*/
|
|
37
|
-
timeout?: number;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export declare function Base<T extends HTMLAttributes<HTMLElement>>({ as, classList, className, ...props }: T & BaseProps): DOMElement< {
|
|
41
|
-
className: string | undefined;
|
|
42
|
-
} & Omit<T & BaseProps, "as" | "classList" | "className">, Element>;
|
|
43
|
-
|
|
44
|
-
declare interface BaseProps {
|
|
45
|
-
as?: string;
|
|
46
|
-
classList?: ClassValue_3 | ClassValue_3[];
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export declare function Button({ size, variant, className, ...rest }: ButtonProps): JSX.Element;
|
|
50
|
-
|
|
51
|
-
export declare function ButtonGroup(props: HTMLAttributes<HTMLDivElement>): JSX.Element;
|
|
52
|
-
|
|
53
|
-
export declare type ButtonProps = InnerButtonProps & ButtonHTMLAttributes<HTMLButtonElement>;
|
|
54
|
-
|
|
55
|
-
export declare function Checkbox({ checked, indeterminate, id, name, onChange, value, checkIcon, error, ...rest }: CheckboxProps): JSX.Element;
|
|
56
|
-
|
|
57
|
-
export declare interface CheckboxProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onClick' | 'onChange' | 'type' | 'role'> {
|
|
58
|
-
error?: boolean;
|
|
59
|
-
children?: ReactNode;
|
|
60
|
-
checked?: boolean;
|
|
61
|
-
indeterminate?: boolean;
|
|
62
|
-
/** idが未指定の場合、nameが代わりに使われます */
|
|
63
|
-
name?: string;
|
|
64
|
-
/** チェック状態のアイコンを指定する */
|
|
65
|
-
checkIcon: ReactNode;
|
|
66
|
-
onChange?: (checked: boolean) => void;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export declare type ClassValue = ClassValue_2;
|
|
70
|
-
|
|
71
|
-
export declare function cn(...args: ClassValue_2[]): string;
|
|
72
|
-
|
|
73
|
-
export declare function Dialog({ open, children, timeout, padding, verticalAlign, closeOnOverlay, closeOnEsc, onExited, className, onOpenChange, size, ...rest }: DialogProps): JSX.Element;
|
|
74
|
-
|
|
75
|
-
export declare interface DialogProps extends HTMLAttributes<HTMLDivElement> {
|
|
76
|
-
/** trueの場合、モーダルを表示します。 */
|
|
77
|
-
open?: boolean;
|
|
78
|
-
/** モーダルのbodyに入れる内容 */
|
|
79
|
-
children?: ReactNode;
|
|
80
|
-
/** オーバーレイのクリックでモーダルクローズ */
|
|
81
|
-
closeOnOverlay?: boolean;
|
|
82
|
-
/** escボタンでクローズ */
|
|
83
|
-
closeOnEsc?: boolean;
|
|
84
|
-
/**
|
|
85
|
-
* モーダルの表示・非表示のアニメーション速度
|
|
86
|
-
* @default 150
|
|
87
|
-
*/
|
|
88
|
-
timeout?: number | {
|
|
89
|
-
open: number;
|
|
90
|
-
close: number;
|
|
91
|
-
};
|
|
92
|
-
/**
|
|
93
|
-
* モーダルのデフォルトデザインを適用し、サイズを指定します。\
|
|
94
|
-
* 未指定の場合は、スタイルを全部外した状態で表示されます
|
|
95
|
-
* */
|
|
96
|
-
size?: 'small' | 'medium' | 'large';
|
|
97
|
-
/** モーダルのtransition exitが完了した時に発火されるcallback */
|
|
98
|
-
onOpenChange?: (open: boolean) => void;
|
|
99
|
-
/** モーダルのtransition exitが完了した時に発火されるcallback */
|
|
100
|
-
onExited?: () => void;
|
|
101
|
-
/**
|
|
102
|
-
* モーダルの背景からのpaddingを指定します。
|
|
103
|
-
* @default '0.85rem'
|
|
104
|
-
*/
|
|
105
|
-
padding?: string;
|
|
106
|
-
/**
|
|
107
|
-
* モーダルの縦並びを設定します。
|
|
108
|
-
* @default 'center'
|
|
109
|
-
*/
|
|
110
|
-
verticalAlign?: 'start' | 'center' | 'end';
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export declare function Divider({ orientation, ...props }: DividerProps): JSX.Element;
|
|
114
|
-
|
|
115
|
-
export declare interface DividerProps extends HTMLAttributes<HTMLElement> {
|
|
116
|
-
/** @default 'horizontal' */
|
|
117
|
-
orientation?: 'horizontal' | 'vertical';
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
export declare function FormField({ label, children, required, htmlFor, error, help, helpBefore, innerClass, ...rest }: FormFieldProps): JSX.Element;
|
|
121
|
-
|
|
122
|
-
export declare interface FormFieldProps extends HTMLAttributes<HTMLDivElement> {
|
|
123
|
-
label?: string;
|
|
124
|
-
htmlFor?: string;
|
|
125
|
-
error?: string;
|
|
126
|
-
help?: string;
|
|
127
|
-
innerClass?: string;
|
|
128
|
-
/**
|
|
129
|
-
* メッセージの表示する箇所を指定します
|
|
130
|
-
* 未指定の場合、後に表示し、errorがあると、エラーの表示を優先して入れ替えます
|
|
131
|
-
*/
|
|
132
|
-
helpBefore?: boolean;
|
|
133
|
-
children: ReactElement | ReactElement[];
|
|
134
|
-
required?: boolean;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
export declare function FormLabel(props: LabelHTMLAttributes<HTMLLabelElement>): JSX.Element;
|
|
138
|
-
|
|
139
|
-
declare interface InnerButtonProps {
|
|
140
|
-
variant?: 'primary' | 'info' | 'warn' | 'link' | 'outline' | 'ghost' | 'danger';
|
|
141
|
-
size?: 'icon' | 'none';
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
export declare function Input({ type, error, customStyle, ...rest }: InputProps): JSX.Element;
|
|
145
|
-
|
|
146
|
-
export declare function InputField({ error, customStyle, ...rest }: InputFieldProps): JSX.Element;
|
|
147
|
-
|
|
148
|
-
export declare interface InputFieldProps extends HTMLAttributes<HTMLInputElement> {
|
|
149
|
-
error?: boolean;
|
|
150
|
-
/** 基本スタイルを全部外し、完全にclassNameの定義によせます */
|
|
151
|
-
customStyle?: boolean;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
export declare interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
155
|
-
error?: boolean;
|
|
156
|
-
/** 基本スタイルを全部外し、完全にclassNameの定義によせます */
|
|
157
|
-
customStyle?: boolean;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
export declare function merge(a: string, b?: string): string;
|
|
161
|
-
|
|
162
|
-
declare interface OptionRenderConfig {
|
|
163
|
-
index: number;
|
|
164
|
-
selected: boolean;
|
|
165
|
-
onChange: () => void;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
declare type OptionType<T> = {
|
|
169
|
-
value: T;
|
|
170
|
-
label: string;
|
|
171
|
-
} | string;
|
|
172
|
-
|
|
173
|
-
export declare function Popover({ ref, position, label, children, disabled, offset, onOpen, onClose, onManualClose, timeout, customStyle, zIndex, role, ...rest }: PopoverProps): JSX.Element;
|
|
174
|
-
|
|
175
|
-
export declare interface PopoverProps extends HTMLAttributes<HTMLDivElement> {
|
|
176
|
-
ref?: Ref<PopoverRef>;
|
|
177
|
-
/** ボタンの内容 */
|
|
178
|
-
label: ReactElement;
|
|
179
|
-
/** 内容のリスト */
|
|
180
|
-
children?: ReactNode;
|
|
181
|
-
/**
|
|
182
|
-
* 表示される場所
|
|
183
|
-
* @default 'bottom-end'
|
|
184
|
-
*/
|
|
185
|
-
position?: Placement;
|
|
186
|
-
/**
|
|
187
|
-
* Popoverが表示される間隔
|
|
188
|
-
* @default '{ x: 0, y: 6 }'
|
|
189
|
-
*/
|
|
190
|
-
offset?: {
|
|
191
|
-
x: number;
|
|
192
|
-
y: number;
|
|
193
|
-
};
|
|
194
|
-
/**
|
|
195
|
-
* Popoverの表示・非表示のアニメーション速度
|
|
196
|
-
* @default { open: 150, close: 75 }
|
|
197
|
-
*/
|
|
198
|
-
timeout?: number | {
|
|
199
|
-
open: number;
|
|
200
|
-
close: number;
|
|
201
|
-
};
|
|
202
|
-
/** 閉じた場合のコールバック */
|
|
203
|
-
onClose?: (ref?: ReferenceType | null, float?: HTMLElement | null) => void;
|
|
204
|
-
/** 開けた場合のコールバック */
|
|
205
|
-
onOpen?: (ref?: ReferenceType | null, float?: HTMLElement | null) => void;
|
|
206
|
-
/** popoverを閉じる処理を手動に設定します */
|
|
207
|
-
onManualClose?: () => void;
|
|
208
|
-
/** コンテンツを出さない */
|
|
209
|
-
disabled?: boolean;
|
|
210
|
-
/**
|
|
211
|
-
* zIndexを指定する
|
|
212
|
-
* @default 9996
|
|
213
|
-
*/
|
|
214
|
-
zIndex?: number;
|
|
215
|
-
/** デフォルトスタイルを外し、cssクラスを適用します */
|
|
216
|
-
customStyle?: boolean;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
export declare interface PopoverRef {
|
|
220
|
-
open: () => void;
|
|
221
|
-
close: () => void;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
export declare function Portal({ children, container, disabled }: PortalProps): ReactPortal | null;
|
|
225
|
-
|
|
226
|
-
export declare interface PortalProps {
|
|
227
|
-
children: ReactNode;
|
|
228
|
-
container?: HTMLElement;
|
|
229
|
-
disabled?: boolean;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
export declare function Progress({ value, max, ...rest }: ProgressProps): JSX.Element;
|
|
233
|
-
|
|
234
|
-
export declare interface ProgressProps extends HTMLAttributes<HTMLDivElement> {
|
|
235
|
-
/** 現状の進捗 */
|
|
236
|
-
value: number;
|
|
237
|
-
/**
|
|
238
|
-
* 進捗の最大値\
|
|
239
|
-
* 最小値は0基準になるので、それに合わせてください
|
|
240
|
-
*/
|
|
241
|
-
max: number;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
declare type Props = HTMLAttributes<HTMLDivElement>;
|
|
245
|
-
|
|
246
|
-
declare type PublishArgs = ({
|
|
247
|
-
id: string;
|
|
248
|
-
type: 'add';
|
|
249
|
-
config: ToastConfig;
|
|
250
|
-
} | {
|
|
251
|
-
id: string;
|
|
252
|
-
type: 'remove';
|
|
253
|
-
} | {
|
|
254
|
-
id: string;
|
|
255
|
-
type: 'update';
|
|
256
|
-
config: Partial<ToastConfig>;
|
|
257
|
-
});
|
|
258
|
-
|
|
259
|
-
export declare function Radio({ checked, className, id, name, onChange, value, error, ...rest }: RadioProps): JSX.Element;
|
|
260
|
-
|
|
261
|
-
export declare interface RadioProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onClick' | 'onChange' | 'type' | 'role'> {
|
|
262
|
-
error?: boolean;
|
|
263
|
-
children?: ReactNode;
|
|
264
|
-
checked?: boolean;
|
|
265
|
-
/** idが未指定の場合、nameが代わりに使われます */
|
|
266
|
-
name?: string;
|
|
267
|
-
onChange?: (checked: boolean) => void;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
export declare function Select<T = unknown>({ className, placeholder, options, error, customStyle, disabled, value, maxHeight, arrowIcon, closeIcon, checkIcon, onChange, onClear, renderItem, sectionLabelStyle, buttonAreaStyle, clearLabelText, optionStyle, ...rest }: SelectProps<T>): JSX.Element;
|
|
271
|
-
|
|
272
|
-
export declare interface SelectProps<T> extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onChange' | 'onClick' | 'type' | 'value' | 'children'> {
|
|
273
|
-
/** 配列の値の入力の場合、複数選択モードに切り替えます */
|
|
274
|
-
value: T | T[];
|
|
275
|
-
options: OptionType<T>[];
|
|
276
|
-
onChange?: (value: T) => void;
|
|
277
|
-
onClear?: () => void;
|
|
278
|
-
renderItem?: (item: OptionType<T>, config: OptionRenderConfig) => ReactElement;
|
|
279
|
-
placeholder?: string;
|
|
280
|
-
arrowIcon?: ReactNode;
|
|
281
|
-
closeIcon?: ReactNode;
|
|
282
|
-
checkIcon?: ReactNode;
|
|
283
|
-
/**
|
|
284
|
-
* select選択肢の最大高さ
|
|
285
|
-
* @default 408
|
|
286
|
-
*/
|
|
287
|
-
maxHeight?: number;
|
|
288
|
-
error?: boolean;
|
|
289
|
-
customStyle?: boolean;
|
|
290
|
-
/** クリアボタン、矢印アイコンの領域のdivのスタイルのカスタム指定 */
|
|
291
|
-
buttonAreaStyle?: string;
|
|
292
|
-
/** section(stringのみで区域を区切った場合)を使うときのスタイルのカスタム指定 */
|
|
293
|
-
sectionLabelStyle?: string;
|
|
294
|
-
/** 各選択肢のスタイルのカスタム指定 */
|
|
295
|
-
optionStyle?: string;
|
|
296
|
-
/** 選択を取り消すボタンのaria-label */
|
|
297
|
-
clearLabelText?: string;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
export declare function Sheet({ open, timeout, onOpenChange, position, overlay, onExited, onOpen, ...rest }: SheetProps): JSX.Element;
|
|
301
|
-
|
|
302
|
-
export declare interface SheetProps extends HTMLAttributes<HTMLDivElement> {
|
|
303
|
-
/** trueの場合、モーダルを表示します。 */
|
|
304
|
-
open?: boolean;
|
|
305
|
-
/**
|
|
306
|
-
* モーダルの表示・非表示のアニメーション速度
|
|
307
|
-
* @default '{ open: 250, close: 150 }'
|
|
308
|
-
*/
|
|
309
|
-
timeout?: number | {
|
|
310
|
-
open: number;
|
|
311
|
-
close: number;
|
|
312
|
-
};
|
|
313
|
-
onOpenChange?: (open: boolean) => void;
|
|
314
|
-
/** 開けた場合のコールバック */
|
|
315
|
-
onOpen?: () => void;
|
|
316
|
-
/** モーダルのtransition exitが完了した時に発火されるcallback */
|
|
317
|
-
onExited?: () => void;
|
|
318
|
-
overlay?: boolean;
|
|
319
|
-
/**
|
|
320
|
-
* sheetが表示されれう場所
|
|
321
|
-
* @defaut 'right'
|
|
322
|
-
*/
|
|
323
|
-
position?: 'left' | 'right' | 'top' | 'bottom';
|
|
324
|
-
customStyle?: boolean;
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
export declare interface SinnerProps extends HTMLAttributes<HTMLDivElement> {
|
|
328
|
-
/** サイズ */
|
|
329
|
-
size?: number;
|
|
330
|
-
label?: string;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
export declare function Skeleton(props: Props): JSX.Element;
|
|
334
|
-
|
|
335
|
-
export declare function Spinner({ size, label, ...rest }: SinnerProps): JSX.Element;
|
|
336
|
-
|
|
337
|
-
export declare function Switch({ checked, onChange, value, id, name, error, ref, ...rest }: SwitchProps): JSX.Element;
|
|
338
|
-
|
|
339
|
-
export declare interface SwitchProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onClick' | 'onChange' | 'type' | 'role'> {
|
|
340
|
-
ref?: Ref<HTMLInputElement>;
|
|
341
|
-
error?: boolean;
|
|
342
|
-
checked?: boolean;
|
|
343
|
-
onChange?: (checked: boolean) => void;
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
export declare function Textarea({ error, customStyle, ...rest }: TextareaProps): JSX.Element;
|
|
347
|
-
|
|
348
|
-
export declare interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
349
|
-
ref?: Ref<HTMLTextAreaElement>;
|
|
350
|
-
error?: boolean;
|
|
351
|
-
customStyle?: boolean;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
export declare function Toast({ className, margin, position, max, ListItem, icons, }: ToasterProps): JSX.Element;
|
|
355
|
-
|
|
356
|
-
export declare const toast: ToastObserver;
|
|
357
|
-
|
|
358
|
-
export declare interface ToastConfig {
|
|
359
|
-
/** 認識ID */
|
|
360
|
-
id: string;
|
|
361
|
-
label: ReactNode;
|
|
362
|
-
type?: ToastType;
|
|
363
|
-
/** ラベル以外に表示する内容 */
|
|
364
|
-
message?: ReactNode;
|
|
365
|
-
/**
|
|
366
|
-
* 表示される時間 nullの場合は自動で閉じられません
|
|
367
|
-
* @default 5000
|
|
368
|
-
*/
|
|
369
|
-
duration?: number | null;
|
|
370
|
-
className?: string;
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
export declare interface ToastContextType {
|
|
374
|
-
/**
|
|
375
|
-
* 表示するToastのタイプに使うアイコンを指定(未指定の場合はアイコンは表示されません)\
|
|
376
|
-
* ただし、loading状態はspinnerを表示します
|
|
377
|
-
*/
|
|
378
|
-
icons?: Record<Exclude<ToastType, 'loading'>, ReactNode>;
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
export declare type ToasterPosition = 'top' | 'top-right' | 'top-left' | 'bottom' | 'bottom-right' | 'bottom-left';
|
|
382
|
-
|
|
383
|
-
export declare interface ToasterProps {
|
|
384
|
-
className?: string;
|
|
385
|
-
/** レンダリング対象のコンポーネント */
|
|
386
|
-
/**
|
|
387
|
-
* toastの表示される場所の指定
|
|
388
|
-
* \
|
|
389
|
-
* top, top-right, top-left, bottom, bottom-right, bottom-left
|
|
390
|
-
* @default 'top-left'
|
|
391
|
-
*/
|
|
392
|
-
position?: ToasterPosition;
|
|
393
|
-
/**
|
|
394
|
-
* margin 単位はpx
|
|
395
|
-
* @default '16px'
|
|
396
|
-
*/
|
|
397
|
-
margin?: number;
|
|
398
|
-
/**
|
|
399
|
-
* 並ばずに、Toastが積み上げます\
|
|
400
|
-
* (まだ開発中です)
|
|
401
|
-
*/
|
|
402
|
-
stack?: boolean;
|
|
403
|
-
/**
|
|
404
|
-
* 表示する最大Toast数を指定します
|
|
405
|
-
* @default 3
|
|
406
|
-
*/
|
|
407
|
-
max?: number;
|
|
408
|
-
ListItem?: FunctionComponent<ToastItemProps>;
|
|
409
|
-
/**
|
|
410
|
-
* 表示するToastのタイプに使うアイコンを指定(未指定の場合はアイコンは表示されません)\
|
|
411
|
-
* ただし、loading状態はspinnerを表示します
|
|
412
|
-
*/
|
|
413
|
-
icons?: Record<Exclude<ToastType, 'loading'>, ReactNode>;
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
export declare function ToastItem({ type, label, message }: ToastItemProps): JSX.Element;
|
|
417
|
-
|
|
418
|
-
export declare type ToastItemProps = Omit<ToastConfig, 'duration' | 'className'>;
|
|
419
|
-
|
|
420
|
-
declare class ToastObserver {
|
|
421
|
-
/** システムで1つしか存在しない前提とする */
|
|
422
|
-
notify: (args: PublishArgs) => void;
|
|
423
|
-
lastId: number;
|
|
424
|
-
/** internal use only */
|
|
425
|
-
subscribe: (callback: (args: PublishArgs) => void) => () => void;
|
|
426
|
-
add: (label: ReactNode, config?: Omit<ToastConfig, "label" | "id">) => string;
|
|
427
|
-
/** 表示中のtoastを修正します。promiseのロード状態を表示することなどに使います */
|
|
428
|
-
update: (id: string, config: Partial<Omit<ToastConfig, "id">>) => void;
|
|
429
|
-
remove: (id: string) => void;
|
|
430
|
-
clear: () => void;
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
export declare type ToastType = 'info' | 'success' | 'error' | 'warn' | 'loading';
|
|
434
|
-
|
|
435
|
-
export declare const Tooltip: ForwardRefExoticComponent<TooltipProps & RefAttributes<TooltipRef>>;
|
|
436
|
-
|
|
437
|
-
export declare interface TooltipProps {
|
|
438
|
-
/** 吹き出しとして表示したい内容 */
|
|
439
|
-
label: ReactNode;
|
|
440
|
-
/** マウスオーバーの対象になるelement */
|
|
441
|
-
children: ReactElement;
|
|
442
|
-
/**
|
|
443
|
-
* 表示される場所
|
|
444
|
-
* @default 'bottom'
|
|
445
|
-
*/
|
|
446
|
-
position?: Placement;
|
|
447
|
-
/**
|
|
448
|
-
* ツールチップが表示される間隔, 単位はpx
|
|
449
|
-
* @default '{ x: 0, y: 6 }'
|
|
450
|
-
*/
|
|
451
|
-
offset?: {
|
|
452
|
-
x: number;
|
|
453
|
-
y: number;
|
|
454
|
-
};
|
|
455
|
-
/**
|
|
456
|
-
* ツールチップの表示・非表示のアニメーション速度
|
|
457
|
-
* @default 150
|
|
458
|
-
*/
|
|
459
|
-
timeout?: number;
|
|
460
|
-
/** 吹き出し表示座標を対象のElementではなくマウスカーソルにする */
|
|
461
|
-
clientPoint?: boolean;
|
|
462
|
-
/** 吹き出しを出さない */
|
|
463
|
-
disabled?: boolean;
|
|
464
|
-
className?: string;
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
export declare interface TooltipRef {
|
|
468
|
-
floating: RefObject<HTMLElement | null>;
|
|
469
|
-
reference: RefObject<ReferenceElement | null>;
|
|
470
|
-
open: () => void;
|
|
471
|
-
close: () => void;
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
export declare function varientButton({ variant, size }: InnerButtonProps): string;
|
|
475
|
-
|
|
476
|
-
export { }
|
|
1
|
+
export * from './utils/merge';
|
|
2
|
+
export * from './components';
|
|
3
|
+
export * from './elements';
|
|
4
|
+
export * from './forms';
|