visits-style 2.0.7 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +34 -30
- package/dist/index.es.js +553 -628
- package/dist/lib.css +4 -0
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -83,6 +83,11 @@ export default function TestComponent() {
|
|
|
83
83
|
--color-inverted: #FAFAFA;
|
|
84
84
|
// 無効、placeholder時に使うテキスト色
|
|
85
85
|
--color-muted: #808080;
|
|
86
|
+
|
|
87
|
+
// モーダルの幅サイズの設定
|
|
88
|
+
--container-dialog-sm: 24rem;
|
|
89
|
+
--container-dialog-md: 36rem;
|
|
90
|
+
--container-dialog-lg: 48rem;
|
|
86
91
|
```
|
|
87
92
|
|
|
88
93
|
## Docs
|
package/dist/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("clsx"),re=require("tailwind-merge"),t=require("react/jsx-runtime"),r=require("react"),f=require("@floating-ui/react"),oe=require("react-dom");function k(e,n){return n?re.twMerge(e,n):e}function H({className:e,...n}){const o=r.useMemo(()=>m("leading-none peer-disabled:opacity-70",e),[e]);return t.jsx("label",{className:o,...n})}function se({label:e,children:n,required:o,htmlFor:s,error:l,help:i,helpBefore:a,className:d,innerClass:u,...x}){const p=r.useMemo(()=>m("font-medium",o?'after:content-["*"] after:text-danger after:text-sm after:pl-0.5':""),[o]),g=r.useMemo(()=>k("flex flex-col space-y-2",d),[d]);return t.jsxs("div",{className:g,...x,children:[e?t.jsx(H,{className:p,htmlFor:s,children:e}):null,i&&a?t.jsx("p",{className:"text-xs text-muted pb-2",children:i}):null,t.jsx("div",{className:u,children:ie(n,!!l)}),i&&!a&&!l?t.jsx("p",{className:"text-xs text-muted",children:i}):null,l?t.jsx("p",{className:"text-xs text-danger",children:l}):null]})}function ie(e,n){const o=r.Children.count(e);if(!o)return null;if(o===1)return r.cloneElement(e,{error:n});const s=r.Children.toArray(e);return s[0]=r.cloneElement(s[0],{error:n}),s}function le({error:e,unstyled:n,className:o,...s}){const l=r.useMemo(()=>n?o:k(m("flex rounded-md border bg-background px-3 py-2 w-full [&_input]:placeholder:text-muted","[&_input]:disabled:opacity-50 [&_input]:focus-visible:outline-none",e?"border-danger hover:border-danger-fore":"border-input"),o),[o,e,n]);return t.jsx("div",{className:l,...s})}const W=r.forwardRef(({className:e,type:n,error:o,unstyled:s,...l},i)=>{const a=r.useMemo(()=>s?e:k(m("flex rounded-md border bg-background px-3 py-2 w-full placeholder:text-muted","disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-ring",o?"border-danger hover:border-danger-fore":"border-input not-disabled:hover:border-input-fore",n==="file"?"file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground":null),e),[e,n,o,s]);return t.jsx("input",{ref:i,type:n,className:a,...l})});W.displayName="Input";const X=r.forwardRef(({className:e,error:n,unstyled:o,...s},l)=>{const i=r.useMemo(()=>o?e:k(m("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",n?"border-danger hover:border-danger-fore":"border-input not-disabled:hover:border-input-fore"),e),[e,n,o]);return t.jsx("textarea",{ref:l,className:i,...s})});X.displayName="Textarea";function D(e){return t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"30",height:"30",viewBox:"0 0 30 30",...e,children:t.jsx("path",{d:"M11.5 18.5l-3.9-4L6 16l5.6 5.6 11.6-11.5-1.7-1.6z",fill:"currentColor"})})}function ae(){return t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"30",height:"30",viewBox:"0 0 30 30",children:t.jsx("rect",{width:"20",height:"3",y:"13.5",x:"4.5",fill:"currentColor",stroke:"none",rx:"2"})})}function ce({checked:e,indeterminate:n,className:o,id:s,name:l,onChange:i,value:a,...d}){const u=r.useMemo(()=>k(m("inline-flex justify-center items-center border w-4.5 h-4.5 rounded","cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",e||n?"bg-primary text-inverted disabled:text-text disabled:bg-input disabled:border-input":"border-input not-disabled:hover:border-input-fore"),o),[e,n,o]),x=()=>{d.disabled||i?.(!e)};return t.jsxs("button",{type:"button",role:"checkbox",id:s||l,className:u,onClick:x,"aria-checked":e,...d,children:[e?t.jsx(D,{}):null,n&&!e?t.jsx(ae,{}):null,t.jsx("input",{type:"checkbox","aria-hidden":"true",name:l,checked:e,value:a,onChange:x,disabled:d.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",_=ue?r.useLayoutEffect:r.useEffect;function z({children:e,container:n,disabled:o}){const[s,l]=r.useState(null);return _(()=>{if(!n){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(n)},[n]),o||!s?null:oe.createPortal(e,s)}function P(e){e&&(e.stopPropagation(),e.preventDefault())}const de={open:150,close:75},O=r.forwardRef(({position:e,label:n,children:o,color:s="background",disabled:l,offset:i={x:0,y:6},onOpen:a,onClose:d,onManualClose:u,timeout:x=de,unstyled:p,zIndex:g=9996,role:w,...c},b)=>{const[v,y]=r.useState(!1),I=f.useId(),j=r.useRef(a),A=r.useRef(d),{refs:M,floatingStyles:S,context:F}=f.useFloating({nodeId:I,placement:e,middleware:[f.shift(),f.flip({fallbackAxisSideDirection:"end"}),f.offset({mainAxis:i.y,crossAxis:i.x})],open:v,onOpenChange:C=>{C?j.current?.(M.reference.current,M.floating.current):A.current?.(M.reference.current,M.floating.current),y(C)},whileElementsMounted:f.autoUpdate}),{isMounted:T,styles:E}=f.useTransitionStyles(F,{duration:x,initial({side:C}){let R="";return C==="top"?R="translateY(5%) scale(0.95)":C==="bottom"?R="translateY(-5%) scale(0.95)":C==="left"?R="translateX(5%) scale(0.95)":R="translateX(-5%) scale(0.95)",{opacity:0,transform:R}}}),B=r.useCallback(C=>{if(P(C),u)return u();y(!1),A.current?.(M.reference.current,M.floating.current)},[u]);r.useEffect(()=>{if(l&&v)return y(!1)},[l,v]),r.useImperativeHandle(b,()=>({open:()=>{y(!0),j.current?.(M.reference.current,M.floating.current)},close:()=>{y(!1),A.current?.(M.reference.current,M.floating.current)}}),[]);const{getFloatingProps:h,getReferenceProps:N}=f.useInteractions([f.useClick(F,{enabled:!l})]);return j.current=a,A.current=d,t.jsxs(t.Fragment,{children:[r.cloneElement(r.Children.only(n),N({ref:M.setReference,tabIndex:0,role:"button","aria-expanded":v,disabled:l,onClick:P})),t.jsx(z,{disabled:l||!T,children:t.jsx(f.FloatingOverlay,{"data-testid":"vs-popover-shadow",onClick:B,style:{zIndex:g},autoFocus:!0,children:t.jsx("div",{role:w||"region",ref:M.setFloating,style:S,children:t.jsx(Y,{unstyled:p,styles:E,...h({...c,onClick:P}),children:o})})})})]})});O.displayName="Popover";const Y=r.forwardRef(({className:e,unstyled:n,styles:o,style:s={},...l},i)=>{const a=r.useMemo(()=>m("z-20 w-auto h-auto outline-none transition-transform ease-in-out",n?null:"border border-accent rounded-md shadow-lg p-1 bg-background",e),[e,n]);return t.jsx("div",{ref:i,className:a,style:{...o,...s},...l})});Y.displayName="PopoverContent";function U(e){return t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[t.jsx("path",{d:"M11.7 14.8 7 9.8a.5.5 0 0 1 0-.7c.2-.2.5-.2.7 0l4.5 5c.2.2.2.6 0 .8-.1.2-.4.2-.6 0Z",fill:"currentColor"}),t.jsx("path",{d:"m16.9 9.9-4.6 5c-.2.2-.4.2-.6 0a.5.5 0 0 1 0-.8l4.5-5c.2-.2.5-.2.7 0 .1.2.1.6 0 .8Z",fill:"currentColor"})]})}function V(e){return t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 30 30",...e,children:t.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[t.jsx("path",{d:"M26 26l-12.5-12.5L26 1"}),t.jsx("path",{d:"M1 26l12.5-12.5L1 1"})]})})}function fe({className:e,placeholder:n="",options:o=[],error:s,unstyled:l,disabled:i,value:a,maxHeight:d=408,arrow:u,onChange:x,onClear:p,renderItem:g,...w}){const c=r.useRef(null),[b,v]=r.useState(0),y=r.useMemo(()=>l?e:k(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",s?"border-danger hover:border-danger-fore":"border-input not-disabled:hover:border-input-fore"),e),[e,s,l]),I=r.useMemo(()=>Array.isArray(a),[]),j=r.useCallback(h=>{x?.(h),I||c.current?.close()},[x,I]),A=r.useCallback(h=>Array.isArray(a)?a.indexOf(h)>-1:a===h,[a]),M=r.useMemo(()=>{const h={},N=o.filter(C=>typeof C!="string");for(let C=0,R=N.length;C<R;C+=1){const $=N[C];h[`${$.value}`]=$.label}return h},[o]),S=r.useMemo(()=>{if(!a)return n;if(Array.isArray(a)){if(!a.length)return n;const h=[...a].sort(),N=[];for(let C=0,R=h.length;C<R;C+=1)N[C]=M[`${h[C]}`]||"";return N.filter(Boolean).join(",")||n}return M[`${a}`]||n},[n,a,M]),F=S===n,T=r.useMemo(()=>m("overflow-hidden overflow-ellipsis whitespace-nowrap",F?"text-muted":"text-text"),[F]),E=r.useMemo(()=>u||t.jsx(U,{className:"absolute right-0 text-muted size-5"}),[u]),B=r.useCallback((h,N)=>g?typeof h=="string"?g(h,{index:N,selected:!1,onChange:()=>{}}):g(h,{index:N,selected:A(h.value),onChange:()=>j(h.value)}):typeof h=="string"?t.jsx("h5",{className:"font-medium py-1 px-2 text-muted",children:h},`optionheader-${N}`):t.jsx(he,{selected:A(h.value),onChange:j,...h},h.label),[g,j,A]);return t.jsx(O,{label:t.jsxs("button",{type:"button",className:y,disabled:i,...w,children:[t.jsx("span",{className:T,children:S}),t.jsxs("div",{className:"relative flex items-center pl-8 pr-3 space-x-2",children:[p&&!F?t.jsx("div",{tabIndex:-1,role:"button",className:"size-6 p-1.5 rounded hover:bg-accent","aria-label":"clear selected values",onKeyDown:h=>{h.key!=="Enter"&&h.key!=="Space"||p()},onClick:h=>{h.stopPropagation(),p()},children:t.jsx(V,{})}):null,E]})]}),ref:c,onOpen:h=>v(h?.getBoundingClientRect().width||0),disabled:i,children:t.jsx("ul",{className:"overflow-y-auto flex flex-col",role:"listbox",style:{minWidth:b,maxWidth:"calc(100vw - 3rem)",maxHeight:d},children:o.map(B)})})}function he({className:e,value:n,label:o,selected:s,onChange:l}){const i=r.useMemo(()=>m("flex items-center w-full hover:bg-accent rounded p-1",e),[e]);return t.jsxs("button",{type:"button",role:"option",className:i,"aria-selected":s,onClick:()=>l?.(n),children:[s?t.jsx(D,{className:"w-5 h-5 mr-1"}):t.jsx("div",{className:"w-5 h-1 mr-1"}),o]})}function xe({checked:e,className:n,id:o,name:s,onChange:l,value:i,...a}){const d=r.useMemo(()=>m("relative inline-flex justify-center items-center border border-input w-4.5 h-4.5 rounded-full","cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed not-disabled:hover:border-input-fore",e?"[&_i]:bg-primary disabled:[&_i]:bg-text disabled:border-input":"",n),[n,e]),u=()=>{a.disabled||l?.(!e)};return t.jsxs("button",{type:"button",role:"radio",id:o||s,className:d,onClick:u,"aria-checked":e,...a,children:[t.jsx("i",{className:"block w-2.5 h-2.5 rounded-full transition-transform",style:{transform:e?"":"scale(0.8)",opacity:e?1:0}}),t.jsx("input",{type:"radio","aria-hidden":"true",name:s,checked:e,value:i,onChange:u,disabled:a.disabled,style:{position:"absolute",pointerEvents:"none",top:0,left:0,width:1,height:1,opacity:0}})]})}const G=r.forwardRef(({className:e,checked:n,onChange:o,value:s,id:l,name:i,...a},d)=>{const u=r.useMemo(()=>k(m("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",n?"bg-primary":"bg-input"),e),[e,n]),x=r.useMemo(()=>k("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform",e),[e]),p=()=>{a.disabled||o?.(!n)};return t.jsxs("button",{type:"button",role:"switch",id:l||i,className:u,onClick:p,"aria-checked":n,...a,children:[t.jsx("span",{className:x,style:{transform:n?"translateX(100%)":""}}),t.jsx("input",{ref:d,type:"checkbox","aria-hidden":"true",name:i,checked:n,value:s,onChange:p,disabled:a.disabled,style:{position:"absolute",pointerEvents:"none",top:0,left:0,width:1,height:1,opacity:0}})]})});G.displayName="Switch";function pe({header:e,show:n,children:o,timeout:s=300,...l}){const i=r.useRef(null),a=r.useRef(0),d=r.useRef(0),u=r.useRef(!0);return r.useEffect(()=>{d.current=s},[s]),_(()=>{if(!i.current)return;if(i.current.style.overflow="hidden",i.current.style.opacity="1",u.current){u.current=!1,i.current.style.height=n?"auto":"0px",n?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}n||(i.current.style.height=`${a.current}px`);const x=[];x[0]=window.requestAnimationFrame(()=>{x[1]=window.requestAnimationFrame(()=>{i.current&&(i.current.style.height=`${n?a.current:0}px`,i.current.style.opacity=n?"1":"0")})});let p;const g=()=>{i.current&&(n?(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 d.current===0?g():p=window.setTimeout(g,d.current),()=>{x.forEach(window.cancelAnimationFrame),p&&window.clearTimeout(p)}},[n]),t.jsxs("div",{...l,children:[e,t.jsx("div",{className:"transition-all ease-in-out overflow-hidden",role:"region","aria-hidden":!n,ref:i,style:{transitionDuration:`${s}ms`},children:o})]})}const ge=r.forwardRef(({children:e,position:n="bottom",label:o,className:s,timeout:l=150,offset:i={x:0,y:6},clientPoint:a=!1,disabled:d},u)=>{const[x,p]=r.useState(!1),g=f.useId(),{refs:w,floatingStyles:c,context:b}=f.useFloating({nodeId:g,open:x,placement:n,middleware:[f.shift(),f.flip(),f.offset({mainAxis:i.y,crossAxis:i.x})],whileElementsMounted:d?void 0:f.autoUpdate,onOpenChange:p}),{getReferenceProps:v,getFloatingProps:y}=f.useInteractions([f.useHover(b,{enabled:!d}),f.useClientPoint(b,{enabled:a})]),{isMounted:I,styles:j}=f.useTransitionStyles(b,{duration:l,initial:{opacity:0,transform:"scale(0.8)"}});r.useImperativeHandle(u,()=>({floating:w.floating,reference:w.reference,open:()=>p(!0),close:()=>p(!1)})),r.useEffect(()=>{d&&p(!1)},[d]);const A=typeof e=="string"?t.jsx("span",{children:e}):e;return t.jsxs(t.Fragment,{children:[r.cloneElement(r.Children.only(A),{ref:w.setReference,...v()}),t.jsx(z,{disabled:d||!I,children:t.jsx("div",{role:"tooltip",className:"z-[9999]",ref:w.setFloating,...y({style:c}),children:t.jsx(me,{className:s,style:j,children:o})})})]})}),me=r.forwardRef(({className:e,custom:n,...o},s)=>{const l=r.useMemo(()=>m("relative w-auto h-auto outline-none transition-transform ease-in-out whitespace-pre",n?null:"border border-accent rounded shadow-md px-3 py-1 bg-background",e),[e,n]);return t.jsx("div",{ref:s,className:l,...o})});function K({variant:e,size:n}){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":!n,"p-1.5":n==="icon"})}function be({size:e,variant:n,className:o,...s}){const l=r.useMemo(()=>m(K({size:e,variant:n}),o),[e,n,o]);return t.jsx("button",{className:l,type:"button",...s})}function we({open:e,children:n,timeout:o=150,padding:s="0.85rem",verticalAlign:l="center",closeOnOverlay:i,closeOnEsc:a,onExited:d,className:u,onOpenChange:x,size:p,...g}){const w=r.useRef(d),c=r.useRef(!1),b=f.useId(),{refs:v,context:y}=f.useFloating({open:e,onOpenChange:x,nodeId:b}),{getFloatingProps:I}=f.useInteractions([f.useDismiss(y,{enabled:a,escapeKey:a,outsidePress:!1})]),{isMounted:j,styles:A}=f.useTransitionStyles(y,{duration:o,initial:{opacity:0,transform:"scale(0.8)"}});r.useEffect(()=>{c.current!==j&&(c.current=j,!j&&w.current?.())},[j]);const M=r.useCallback(()=>{i&&x?.(!1)},[x,i]);w.current=d;const S=r.useMemo(()=>m("grid bg-backdrop z-40 justify-items-center",{"place-items-start items-start":l==="start","place-items-end":l==="end","place-items-center":l==="center"||!l}),[l]),F=r.useMemo(()=>k("transition ease-in-out",u),[u]);return t.jsx(z,{disabled:!j,children:t.jsx(f.FloatingOverlay,{className:S,"data-testid":"vs-dialog-overlay",onClick:M,style:{padding:s,opacity:A.opacity},lockScroll:!0,children:t.jsx(J,{ref:v.setFloating,className:F,role:"dialog",size:p,...I({...g,style:A,onClick:P}),children:n})})})}const J=r.forwardRef(({size:e,className:n,...o},s)=>{const l=r.useMemo(()=>m(e?"flex flex-col bg-background shadow-lg p-5 rounded":null,{"w-full max-w-sm":e==="small","w-full max-w-lg":e==="medium","w-full max-w-2xl":e==="large"},n),[e,n]);return t.jsx("div",{ref:s,className:l,...o})});J.displayName="DialogContent";const ve={open:300,close:150};function ye({open:e,timeout:n=ve,onOpenChange:o,position:s="right",overlay:l,...i}){const a=f.useId(),{refs:d,context:u}=f.useFloating({open:e,onOpenChange:o,nodeId:a}),{isMounted:x,styles:p}=f.useTransitionStyles(u,{duration:n,initial(){let w="translateX(75%)";return s==="left"?w="translateX(-75%)":s==="top"?w="translateY(-75%)":s==="bottom"&&(w="translateY(75%)"),{opacity:0,transform:w}}}),g=r.useMemo(()=>m("fixed transition-transform z-30",{"top-0 right-0 h-full max-h-screen":s==="right","top-0 left-0 h-full max-h-screen":s==="left","top-0 left-0 right-0 w-full max-w-screen":s==="top","bottom-0 left-0 right-0 w-full max-w-screen":s==="bottom"}),[s]);return t.jsxs(z,{disabled:!x,children:[l?t.jsx(f.FloatingOverlay,{className:"bg-backdrop",style:{opacity:p.opacity},onClick:()=>o?.(!1)}):null,t.jsx("div",{ref:d.setFloating,className:g,role:"dialog",style:p,children:t.jsx(je,{...i})})]})}function je({className:e,unstyled:n,...o}){const s=r.useMemo(()=>n?e:k(m("relative bg-background min-w-full min-h-full border border-input shadow-lg"),e),[n,e]);return t.jsx("div",{className:s,...o})}function Q(e){return t.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"30",height:"30",viewBox:"0 0 30 30",...e,children:[t.jsx("path",{d:"M15 29a14 14 0 0 1-9.9-4.1A14 14 0 0 1 1 15a14 14 0 0 1 4.1-9.9A14 14 0 0 1 15 1a14 14 0 0 1 9.9 4.1A14 14 0 0 1 29 15a14 14 0 0 1-4.1 9.9A14 14 0 0 1 15 29z",fill:"none"}),t.jsx("path",{d:"M15 2a13 13 0 0 0-9.2 3.8A13 13 0 0 0 2 15a13 13 0 0 0 3.8 9.2A13 13 0 0 0 15 28a13 13 0 0 0 9.2-3.8A13 13 0 0 0 28 15a13 13 0 0 0-3.8-9.2A13 13 0 0 0 15 2m0-2a15 15 0 1 1 0 30 15 15 0 0 1 0-30z",fill:"currentColor"}),t.jsx("path",{d:"m11.5 18.5-3.9-4L6 16l5.6 5.6L23.2 10l-1.7-1.6z",fill:"currentColor"})]})}function L(e){return t.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"30",height:"30",viewBox:"0 0 32 32",...e,children:[t.jsx("path",{d:"M16 0C7.16 0 0 7.16 0 16C0 24.84 7.16 32 16 32C24.84 32 32 24.84 32 16C32 7.16 24.84 0 16 0ZM16 31C7.73 31 1 24.27 1 16C1 7.73 7.73 1 16 1C24.27 1 31 7.73 31 16C31 24.27 24.27 31 16 31Z",fill:"currentColor"}),t.jsx("path",{d:"M15.5 19.55V8.54999C15.5 8.26999 15.72 8.04999 16 8.04999C16.28 8.04999 16.5 8.26999 16.5 8.54999V19.55C16.5 19.83 16.28 20.05 16 20.05C15.72 20.05 15.5 19.83 15.5 19.55Z",fill:"currentColor"}),t.jsx("path",{d:"M16 23.95C16.5523 23.95 17 23.5023 17 22.95C17 22.3977 16.5523 21.95 16 21.95C15.4477 21.95 15 22.3977 15 22.95C15 23.5023 15.4477 23.95 16 23.95Z",fill:"currentColor"})]})}function ee(e){return t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"30",height:"30",viewBox:"0 0 52 45",...e,children:t.jsx("path",{d:"M50.6 37.8 29.3 2c-1.5-2.6-5.1-2.8-6.7-.3l-21.2 36c-1.7 2.6.2 6.6 3.4 6.6h42.4c3.1 0 5-4 3.4-6.6Zm-24.7.6a2.7 2.7 0 1 1 0-5.5 2.7 2.7 0 0 1 0 5.5Zm2.9-10.1c0 1.5-1.3 2.7-2.8 2.7a2.8 2.8 0 0 1-2.8-2.7V13.9c0-1.5 1.3-2.7 2.8-2.7 1.5 0 2.8 1.2 2.8 2.7v14.4Z",fill:"currentColor"})})}function te({size:e=20,label:n="Loading...",...o}){return t.jsxs("div",{role:"status",...o,children:[t.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:[t.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"}),t.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"})]}),t.jsx("span",{className:"sr-only",children:n})]})}function ne({type:e,label:n,message:o}){return t.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?t.jsxs("figure",{className:"mr-2",children:[e==="success"?t.jsx(Q,{className:"text-primary size-5"}):null,e==="info"?t.jsx(L,{className:"text-info size-5"}):null,e==="error"?t.jsx(L,{className:"text-danger size-5"}):null,e==="warn"?t.jsx(ee,{className:"text-warn size-5"}):null,e==="loading"?t.jsx(te,{size:20}):null]}):null,t.jsxs("div",{className:"space-y-2",children:[t.jsx("p",{className:"font-medium leading-none",children:n}),o?t.jsx("p",{children:o}):null]})]})}function q(){}class Ce{notify=q;lastId=0;subscribe=n=>(this.notify=n,()=>{this.notify=q});add=(n,o={})=>{this.lastId+=1;const s=`${this.lastId}`;return this.notify({id:s,type:"add",config:{id:s,label:n,...o}}),s};update=(n,o)=>{this.notify({id:n,type:"update",config:o})};remove=n=>{this.notify({id:n,type:"remove"})};clear=()=>{this.lastId=0}}const Z=new Ce;function Me({id:e,type:n,index:o,duration:s,className:l,children:i,inverted:a,timeout:d=250,max:u=3}){const x=r.useRef(!1),[p,g]=r.useState(!1),{context:w,refs:c}=f.useFloating({open:p,onOpenChange:g,nodeId:e}),{isMounted:b,styles:v}=f.useTransitionStyles(w,{duration:d,initial:{opacity:0,transform:`translateY(${a?"":"-"}50%)`}});r.useLayoutEffect(()=>{g(o<=u)},[o,u]),r.useEffect(()=>{x.current!==b&&(b||Z.remove(e),x.current=b)},[b,e]),r.useEffect(()=>{if(!s)return;const j=window.setTimeout(()=>g(!1),s);return()=>window.clearTimeout(j)},[s,e]);const y=r.useCallback(()=>{n!=="loading"&&g(!1)},[n]),I=r.useMemo(()=>m("relative flex w-fit transition-transform ease-in-out cursor-pointer",l),[l]);return b?t.jsx("li",{role:"log",tabIndex:-1,ref:c.setFloating,className:I,style:v,onClick:y,children:i}):null}function ke({className:e,margin:n=16,position:o="top-left",max:s,ListItem:l=ne}){const i=r.useMemo(()=>{const c={position:"fixed"};return o.indexOf("top")>-1?c.top=n:o.indexOf("bottom")>-1&&(c.bottom=n),o.indexOf("left")>-1?(c.left=n,c.alignItems="flex-start"):o.indexOf("right")>-1?(c.right=n,c.alignItems="flex-end"):(c.left="50%",c.alignItems="center",c.transform="translateX(-50%)"),c},[n,o]),a=r.useMemo(()=>m("flex flex-col z-40 overflow-hidden",e),[e]),d=r.useMemo(()=>o?.startsWith("bottom")||!1,[o]),u=r.useRef(new Map),[x,p]=r.useState([]),g=r.useState(0)[1];_(()=>Z.subscribe(c=>{r.startTransition(()=>{if(c.type==="add")u.current.set(c.id,c.config),p(b=>[...b,c.id]);else if(c.type==="remove"){if(!u.current.delete(c.id))return;p(v=>{const y=new Set(v);return y.has(c.id)?(y.delete(c.id),Array.from(y)):v})}else if(c.type==="update"){const b=u.current.get(c.id);if(!b)return;u.current.set(c.id,{...b,...c.config}),g(v=>v+1)}})}),[]);const w=x.length;return t.jsx(z,{children:t.jsx("ol",{className:a,style:i,"aria-live":"polite",children:x.map((c,b)=>{const v=u.current.get(c);if(!v)return null;const{className:y,duration:I,...j}=v;return t.jsx(Me,{id:c,index:w-b,className:y,duration:I,inverted:d,max:s,children:r.createElement(l,j)},c)})})})}function Ae({className:e,...n}){const o=r.useMemo(()=>k("inline-block animate-pulse rounded-md bg-accent",e),[e]);return t.jsx("span",{className:o,...n})}function Ie({className:e,...n}){const o=r.useMemo(()=>m("flex items-center justify-center","[&_button]:rounded-none [&_:first-child]:rounded-bl [&_:first-child]:rounded-tl [&_:last-child]:rounded-br [&_:last-child]:rounded-tr","[&_:first-child]:border-r-0 [&_:last-child]:border-l-0",e),[e]);return t.jsx("div",{role:"group",className:o,...n})}function Ne({value:e,max:n,className:o,...s}){const l=r.useMemo(()=>e?Math.round(e/n*100):0,[e,n]),i=r.useMemo(()=>k("relative overflow-hidden rounded-full bg-primary",o),[o]);return t.jsx("div",{role:"progressbar",className:i,"aria-valuemax":n,"aria-valuemin":0,...s,children:t.jsx("div",{className:"h-full w-full flex-1 bg-input transition-all origin-right",style:{transform:`translateX(${l>100?100:l}%)`}})})}function Re({className:e,orientation:n="horizontal",...o}){const s=r.useMemo(()=>k(m("border-0 p-0 shrink-0 bg-input",n==="horizontal"?"h-[1px] w-full":"w-[1px] h-full"),e),[e,n]);return t.jsx("hr",{className:s,role:"none",...o})}function Fe(e){return t.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"30",height:"30",viewBox:"0 0 30 30",...e,children:[t.jsxs("g",{fill:"none",children:[t.jsx("path",{d:"M15 29c-3.74 0-7.255-1.456-9.9-4.1A13.908 13.908 0 011 15c0-3.74 1.456-7.255 4.1-9.9A13.908 13.908 0 0115 1c3.74 0 7.255 1.456 9.9 4.1A13.908 13.908 0 0129 15c0 3.74-1.456 7.255-4.1 9.9A13.908 13.908 0 0115 29z"}),t.jsx("path",{d:"M15 2a12.915 12.915 0 00-9.192 3.808A12.915 12.915 0 002 15c0 3.472 1.352 6.737 3.808 9.192A12.915 12.915 0 0015 28c3.472 0 6.737-1.352 9.192-3.808A12.915 12.915 0 0028 15c0-3.472-1.352-6.737-3.808-9.192A12.915 12.915 0 0015 2m0-2c8.284 0 15 6.716 15 15 0 8.284-6.716 15-15 15-8.284 0-15-6.716-15-15C0 6.716 6.716 0 15 0z",fill:"currentColor"})]}),t.jsx("path",{d:"M18.066 8.5l-7.567 6.731 7.567 6.2",fill:"none",stroke:"currentColor",strokeWidth:"2"})]})}function Se(e){return t.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"30",height:"30",viewBox:"0 0 30 30",...e,children:[t.jsxs("g",{fill:"none",children:[t.jsx("path",{d:"M15 29c-3.74 0-7.255-1.456-9.9-4.1A13.908 13.908 0 011 15c0-3.74 1.456-7.255 4.1-9.9A13.908 13.908 0 0115 1c3.74 0 7.255 1.456 9.9 4.1A13.908 13.908 0 0129 15c0 3.74-1.456 7.255-4.1 9.9A13.908 13.908 0 0115 29z"}),t.jsx("path",{d:"M15 2a12.915 12.915 0 00-9.192 3.808A12.915 12.915 0 002 15c0 3.472 1.352 6.737 3.808 9.192A12.915 12.915 0 0015 28c3.472 0 6.737-1.352 9.192-3.808A12.915 12.915 0 0028 15c0-3.472-1.352-6.737-3.808-9.192A12.915 12.915 0 0015 2m0-2c8.284 0 15 6.716 15 15 0 8.284-6.716 15-15 15-8.284 0-15-6.716-15-15C0 6.716 6.716 0 15 0z",fill:"currentColor"})]}),t.jsxs("g",{transform:"translate(9 7)",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("rect",{width:"12",height:"16",rx:"1",stroke:"none"}),t.jsx("path",{d:"M1 1h10v14H1z"})]}),t.jsx("path",{fill:"currentColor",d:"M13 11h4v1.3h-4zM13 14h4v1.3h-4zM13 17h4v1.3h-4z"})]})}function ze(e){return t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"17.796",height:"17.908",viewBox:"0 0 17.796 17.908",...e,children:t.jsx("path",{d:"M1.254 12.674L.5 17.408l4.726-.8L17.3 4.472 13.281.5zM1.375 12.766l3.851 3.838M10.949 2.959l3.836 3.801",fill:"none",stroke:"currentColor"})})}function Pe(e){return t.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"30",height:"30",viewBox:"0 0 30 30",...e,children:[t.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("circle",{cx:"15",cy:"15",r:"15",stroke:"none"}),t.jsx("circle",{cx:"15",cy:"15",r:"14"})]}),t.jsx("path",{d:"M8 23a6.018 6.018 0 016-6h2a6.018 6.018 0 016 6zm2.6-2h8.9a4.033 4.033 0 00-3.5-2h-1.9a4.035 4.035 0 00-3.5 2zm.4-9v-1a4.012 4.012 0 014-4 4.012 4.012 0 014 4v1a4.012 4.012 0 01-4 4 4.012 4.012 0 01-4-4zm2-1v1a2.006 2.006 0 002 2 2.006 2.006 0 002-2v-1a2.006 2.006 0 00-2-2 2.006 2.006 0 00-2 2z",fill:"currentColor"})]})}function Te(e){return t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"30",height:"30",viewBox:"0 0 30 30",...e,children:t.jsx("path",{d:"M15.065 0A15.069 15.069 0 00.142 13.105a1.256 1.256 0 102.478.406c0-.027.008-.055.01-.082a12.52 12.52 0 0121.3-7.226l-2.584 2.584 7.532 1.255-1.255-7.532-1.92 1.92A15 15 0 0015.065 0zm13.7 15.589A1.255 1.255 0 0027.5 16.7a12.512 12.512 0 01-21.893 6.569l1.927-1.927L0 20.086l1.255 7.532 2.572-2.572a15.02 15.02 0 0026.16-8.023 1.256 1.256 0 00-1.064-1.423 1.273 1.273 0 00-.16-.011z",fill:"currentColor"})})}function Ee(e){return t.jsxs("svg",{width:"30",height:"30",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[t.jsx("rect",{x:"16.5",y:"9",width:"14",height:"1",rx:".5",transform:"rotate(90 16.5 9)",fill:"currentColor"}),t.jsx("rect",{x:"9",y:"15.5",width:"14",height:"1",rx:".5",fill:"currentColor"})]})}exports.clsx=m;exports.Accordion=pe;exports.Button=be;exports.ButtonGroup=Ie;exports.Checkbox=ce;exports.Dialog=we;exports.Divider=Re;exports.FormField=se;exports.FormLabel=H;exports.IconAlert=L;exports.IconApproved=Q;exports.IconArrowDown=U;exports.IconCaution=ee;exports.IconCheck=D;exports.IconChevronRound=Fe;exports.IconClose=V;exports.IconFileRound=Se;exports.IconPencil=ze;exports.IconPlus=Ee;exports.IconRefresh=Te;exports.IconUser=Pe;exports.Input=W;exports.InputField=le;exports.Placeholder=Ae;exports.Popover=O;exports.Portal=z;exports.Progress=Ne;exports.Radio=xe;exports.Select=fe;exports.Sheet=ye;exports.Spinner=te;exports.Switch=G;exports.Textarea=X;exports.Toast=ke;exports.ToastItem=ne;exports.Tooltip=ge;exports.merge=k;exports.toast=Z;exports.varientButton=K;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("clsx"),ie=require("tailwind-merge"),s=require("react/jsx-runtime"),n=require("react"),d=require("@floating-ui/react"),le=require("react-dom");function N(e,t){return t?ie.twMerge(e,t):e}function Y({className:e,...t}){const o=n.useMemo(()=>g("leading-none peer-disabled:opacity-70",e),[e]);return s.jsx("label",{className:o,...t})}function ae({label:e,children:t,required:o,htmlFor:r,error:l,help:i,helpBefore:a,className:c,innerClass:p,...f}){const m=n.useMemo(()=>g("font-medium",o?'after:content-["*"] after:text-danger after:text-sm after:pl-0.5':""),[o]),x=n.useMemo(()=>N("flex flex-col space-y-2",c),[c]);return s.jsxs("div",{className:x,...f,children:[e?s.jsx(Y,{className:m,htmlFor:r,children:e}):null,i&&a?s.jsx("p",{className:"text-xs text-muted pb-2",children:i}):null,s.jsx("div",{className:p,children:ue(t,!!l)}),i&&!a&&!l?s.jsx("p",{className:"text-xs text-muted",children:i}):null,l?s.jsx("p",{className:"text-xs text-danger",children:l}):null]})}function ue(e,t){const o=n.Children.count(e);if(!o)return null;if(o===1)return n.cloneElement(e,{error:t});const r=n.Children.toArray(e);return r[0]=n.cloneElement(r[0],{error:t}),r}function ce({error:e,unstyled:t,className:o,...r}){const l=n.useMemo(()=>t?o:N(g("flex rounded-md border bg-background px-3 py-2 w-full [&_input]:placeholder:text-muted","[&_input]:disabled:opacity-50 [&_input]:focus-visible:outline-none",e?"border-danger hover:border-danger-fore":"border-input"),o),[o,e,t]);return s.jsx("div",{className:l,...r})}const z=n.forwardRef(({className:e,type:t,error:o,unstyled:r,...l},i)=>{const a=n.useMemo(()=>r?e:N(g("flex rounded-md border bg-background px-3 py-2 w-full placeholder:text-muted","disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-ring",o?"border-danger hover:border-danger-fore":"border-input not-disabled:hover:border-input-fore",t==="file"?"file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground":null),e),[e,t,o,r]);return s.jsx("input",{ref:i,type:t,className:a,...l})});z.displayName="Input";const Z=n.forwardRef(({className:e,error:t,unstyled:o,...r},l)=>{const i=n.useMemo(()=>o?e:N(g("flex rounded-md border bg-background px-3 py-2 w-full","disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-ring",t?"border-danger hover:border-danger-fore":"border-input not-disabled:hover:border-input-fore"),e),[e,t,o]);return s.jsx("textarea",{ref:l,className:i,...r})});Z.displayName="Textarea";function de(){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"30",height:"30",viewBox:"0 0 30 30",children:s.jsx("rect",{width:"20",height:"3",y:"13.5",x:"4.5",fill:"currentColor",stroke:"none",rx:"2"})})}function fe({checked:e,indeterminate:t,className:o,id:r,name:l,onChange:i,value:a,checkIcon:c,...p}){const f=n.useMemo(()=>N(g("inline-flex justify-center items-center border w-4.5 h-4.5 rounded","cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",e||t?"bg-primary text-inverted disabled:text-text disabled:bg-input disabled:border-input":"border-input not-disabled:hover:border-input-fore"),o),[e,t,o]),m=()=>{p.disabled||i?.(!e)};return s.jsxs("button",{type:"button",role:"checkbox",id:r||l,className:f,onClick:m,"aria-checked":e,...p,children:[e?c:null,t&&!e?s.jsx(de,{}):null,s.jsx("input",{type:"checkbox","aria-hidden":"true",name:l,checked:e,value:a,onChange:m,disabled:p.disabled,style:{position:"absolute",pointerEvents:"none",top:0,left:0,width:1,height:1,opacity:0}})]})}const pe=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",q=pe?n.useLayoutEffect:n.useEffect;function E({children:e,container:t,disabled:o}){const[r,l]=n.useState(null);return q(()=>{if(!t){let i=document.getElementById("visits-style-portals");return i||(i=document.createElement("div"),i.id="visits-style-portals",document.body.appendChild(i)),l(i)}l(t)},[t]),o||!r?null:le.createPortal(e,r)}function $(e){e&&(e.stopPropagation(),e.preventDefault())}const me={open:150,close:75},H=n.forwardRef(({position:e,label:t,children:o,disabled:r,offset:l={x:0,y:6},onOpen:i,onClose:a,onManualClose:c,timeout:p=me,unstyled:f,zIndex:m=9996,role:x,...h},C)=>{const[y,u]=n.useState(!1),M=d.useId(),j=n.useRef(i),w=n.useRef(a),{refs:v,floatingStyles:S,context:T}=d.useFloating({nodeId:M,placement:e,middleware:[d.shift(),d.flip({fallbackAxisSideDirection:"end"}),d.offset({mainAxis:l.y,crossAxis:l.x})],open:y,onOpenChange:R=>{R?j.current?.(v.reference.current,v.floating.current):w.current?.(v.reference.current,v.floating.current),u(R)},whileElementsMounted:d.autoUpdate}),{isMounted:P,styles:O}=d.useTransitionStyles(T,{duration:p,initial({side:R}){let I="";return R==="top"?I="translateY(5%) scale(0.95)":R==="bottom"?I="translateY(-5%) scale(0.95)":R==="left"?I="translateX(5%) scale(0.95)":I="translateX(-5%) scale(0.95)",{opacity:0,transform:I}}}),A=n.useCallback(R=>{if($(R),c)return c();u(!1),w.current?.(v.reference.current,v.floating.current)},[c]);n.useEffect(()=>{if(r&&y)return u(!1)},[r,y]),n.useImperativeHandle(C,()=>({open:()=>{u(!0),j.current?.(v.reference.current,v.floating.current)},close:()=>{u(!1),w.current?.(v.reference.current,v.floating.current)}}),[]);const{getFloatingProps:D,getReferenceProps:_}=d.useInteractions([d.useClick(T,{enabled:!r})]);return j.current=i,w.current=a,s.jsxs(s.Fragment,{children:[n.cloneElement(n.Children.only(t),_({ref:v.setReference,tabIndex:0,role:"button","aria-expanded":y,disabled:r,onClick:$})),s.jsx(E,{disabled:r||!P,children:s.jsx(d.FloatingOverlay,{"data-testid":"vs-popover-shadow",onClick:A,style:{zIndex:m},autoFocus:!0,children:s.jsx("div",{role:x||"region",ref:v.setFloating,style:S,children:s.jsx(G,{unstyled:f,styles:O,...D({...h,onClick:$}),children:o})})})})]})});H.displayName="Popover";const G=n.forwardRef(({className:e,unstyled:t,styles:o,style:r={},...l},i)=>{const a=n.useMemo(()=>g("z-20 w-auto h-auto outline-none transition-transform ease-in-out",t?null:"border border-accent rounded-md shadow-lg p-1 bg-background",e),[e,t]);return s.jsx("div",{ref:i,className:a,style:{...o,...r},...l})});G.displayName="PopoverContent";function be({className:e,placeholder:t="",options:o=[],error:r,unstyled:l,disabled:i,value:a,maxHeight:c=408,arrowIcon:p,closeIcon:f,checkIcon:m,onChange:x,onClear:h,renderItem:C,sectionLabelStyle:y,buttonAreaStyle:u,clearLabelText:M,optionStyle:j,...w}){const v=n.useRef(null),[S,T]=n.useState(0),P=n.useMemo(()=>l?e:N(g("flex items-center justify-between rounded-md border bg-background px-3 py-2 w-full overflow-hidden cursor-pointer","disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-ring",r?"border-danger hover:border-danger-fore":"border-input not-disabled:hover:border-input-fore"),e),[e,r,l]),O=n.useMemo(()=>Array.isArray(a),[]),A=n.useCallback(b=>{x?.(b),O||v.current?.close()},[x,O]),D=n.useCallback(b=>Array.isArray(a)?a.indexOf(b)>-1:a===b,[a]),_=n.useMemo(()=>{const b={},F=o.filter(k=>typeof k!="string");for(let k=0,B=F.length;k<B;k+=1){const X=F[k];b[`${X.value}`]=X.label}return b},[o]),R=n.useMemo(()=>{if(!a)return t;if(Array.isArray(a)){if(!a.length)return t;const b=[...a].sort(),F=[];for(let k=0,B=b.length;k<B;k+=1)F[k]=_[`${b[k]}`]||"";return F.filter(Boolean).join(",")||t}return _[`${a}`]||t},[t,a,_]),I=R===t,re=n.useMemo(()=>g("overflow-hidden overflow-ellipsis whitespace-nowrap",I?"text-muted":"text-text"),[I]),oe=n.useCallback((b,F)=>C?typeof b=="string"?C(b,{index:F,selected:!1,onChange:()=>{}}):C(b,{index:F,selected:D(b.value),onChange:()=>A(b.value)}):typeof b=="string"?s.jsx("h5",{className:g("font-normal py-1 px-2 text-muted",y),children:b},`optionheader-${F}`):s.jsx(ge,{selected:D(b.value),onChange:A,checkIcon:m,className:j,...b},b.label),[C,A,D,y,j,m]),se=n.useMemo(()=>g("relative flex items-center pr-4 space-x-2",u),[u]);return s.jsx(H,{label:s.jsxs("button",{type:"button",className:P,disabled:i,...w,children:[s.jsx("span",{className:re,children:R}),s.jsxs("div",{className:se,children:[h&&!I?s.jsx("div",{tabIndex:-1,role:"button",className:"size-6 p-1.5 rounded hover:bg-accent cursor-pointer","aria-label":M,onKeyDown:b=>{b.key!=="Enter"&&b.key!=="Space"||h()},onClick:b=>{b.stopPropagation(),h()},children:f}):null,p]})]}),ref:v,onOpen:b=>T(b?.getBoundingClientRect().width||0),disabled:i,children:s.jsx("ul",{className:"overflow-y-auto flex flex-col",role:"listbox",style:{minWidth:S,maxWidth:"calc(100vw - 3rem)",maxHeight:c},children:o.map(oe)})})}function ge({className:e,value:t,label:o,selected:r,checkIcon:l,onChange:i}){const a=n.useMemo(()=>g("flex items-center w-full hover:bg-accent rounded p-1 cursor-pointer",e),[e]);return s.jsxs("button",{type:"button",role:"option",className:a,"aria-selected":r,onClick:()=>i?.(t),children:[r&&l?l:s.jsx("div",{className:"w-5 h-1 mr-1"}),o]})}function xe({checked:e,className:t,id:o,name:r,onChange:l,value:i,...a}){const c=n.useMemo(()=>g("relative inline-flex justify-center items-center border border-input w-4.5 h-4.5 rounded-full","cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed not-disabled:hover:border-input-fore",e?"[&_i]:bg-primary disabled:[&_i]:bg-text disabled:border-input":"",t),[t,e]),p=()=>{a.disabled||l?.(!e)};return s.jsxs("button",{type:"button",role:"radio",id:o||r,className:c,onClick:p,"aria-checked":e,...a,children:[s.jsx("i",{className:"block w-2.5 h-2.5 rounded-full transition-transform",style:{transform:e?"":"scale(0.8)",opacity:e?1:0}}),s.jsx("input",{type:"radio","aria-hidden":"true",name:r,checked:e,value:i,onChange:p,disabled:a.disabled,style:{position:"absolute",pointerEvents:"none",top:0,left:0,width:1,height:1,opacity:0}})]})}const K=n.forwardRef(({className:e,checked:t,onChange:o,value:r,id:l,name:i,...a},c)=>{const p=n.useMemo(()=>N(g("inline-flex shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50","w-11",t?"bg-primary":"bg-input"),e),[e,t]),f=n.useMemo(()=>N("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform",e),[e]),m=()=>{a.disabled||o?.(!t)};return s.jsxs("button",{type:"button",role:"switch",id:l||i,className:p,onClick:m,"aria-checked":t,...a,children:[s.jsx("span",{className:f,style:{transform:t?"translateX(100%)":""}}),s.jsx("input",{ref:c,type:"checkbox","aria-hidden":"true",name:i,checked:t,value:r,onChange:m,disabled:a.disabled,style:{position:"absolute",pointerEvents:"none",top:0,left:0,width:1,height:1,opacity:0}})]})});K.displayName="Switch";function he({header:e,show:t,children:o,timeout:r=300,...l}){const i=n.useRef(null),a=n.useRef(0),c=n.useRef(0),p=n.useRef(!0);return n.useEffect(()=>{c.current=r},[r]),q(()=>{if(!i.current)return;if(i.current.style.overflow="hidden",i.current.style.opacity="1",p.current){p.current=!1,i.current.style.height=t?"auto":"0px",t?window.requestAnimationFrame(()=>{i.current&&(a.current=i.current.offsetHeight)}):(window.requestAnimationFrame(()=>{i.current&&(i.current.style.height="auto",a.current=i.current.offsetHeight,i.current.style.height="0px")}),i.current.style.opacity="0");return}t||(i.current.style.height=`${a.current}px`);const f=[];f[0]=window.requestAnimationFrame(()=>{f[1]=window.requestAnimationFrame(()=>{i.current&&(i.current.style.height=`${t?a.current:0}px`,i.current.style.opacity=t?"1":"0")})});let m;const x=()=>{i.current&&(t?(i.current.style.height="auto",i.current.style.overflow="",i.current.style.opacity="",window.requestAnimationFrame(()=>{i.current&&(a.current=i.current.offsetHeight)})):i.current.style.height="0px")};return c.current===0?x():m=window.setTimeout(x,c.current),()=>{f.forEach(window.cancelAnimationFrame),m&&window.clearTimeout(m)}},[t]),s.jsxs("div",{...l,children:[e,s.jsx("div",{className:"transition-all ease-in-out overflow-hidden",role:"region","aria-hidden":!t,ref:i,style:{transitionDuration:`${r}ms`},children:o})]})}const U=n.forwardRef(({children:e,position:t="bottom",label:o,className:r,timeout:l=150,offset:i={x:0,y:6},clientPoint:a=!1,disabled:c},p)=>{const[f,m]=n.useState(!1),x=d.useId(),{refs:h,floatingStyles:C,context:y}=d.useFloating({nodeId:x,open:f,placement:t,middleware:[d.shift(),d.flip(),d.offset({mainAxis:i.y,crossAxis:i.x})],whileElementsMounted:c?void 0:d.autoUpdate,onOpenChange:m}),{getReferenceProps:u,getFloatingProps:M}=d.useInteractions([d.useHover(y,{enabled:!c}),d.useClientPoint(y,{enabled:a})]),{isMounted:j,styles:w}=d.useTransitionStyles(y,{duration:l,initial:{opacity:0,transform:"scale(0.8)"}});n.useImperativeHandle(p,()=>({floating:h.floating,reference:h.reference,open:()=>m(!0),close:()=>m(!1)})),n.useEffect(()=>{c&&m(!1)},[c]);const v=typeof e=="string"?s.jsx("span",{children:e}):e;return s.jsxs(s.Fragment,{children:[n.cloneElement(n.Children.only(v),{ref:h.setReference,...u()}),s.jsx(E,{disabled:c||!j,children:s.jsx("div",{role:"tooltip",className:"z-[9999]",ref:h.setFloating,...M({style:C}),children:s.jsx(J,{className:r,style:w,children:o})})})]})});U.displayName="Tooltip";const J=n.forwardRef(({className:e,custom:t,...o},r)=>{const l=n.useMemo(()=>g("relative w-auto h-auto outline-none transition-transform ease-in-out whitespace-pre",t?null:"border border-accent rounded shadow-md px-3 py-1 bg-background",e),[e,t]);return s.jsx("div",{ref:r,className:l,...o})});J.displayName="TooltipContent";function Q({variant:e,size:t}){return g("inline-flex items-center justify-center whitespace-nowrap transition-colors rounded-md cursor-pointer","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-auto",{"bg-primary text-inverted hover:bg-primary-fore":!e||e==="primary","bg-info text-inverted hover:bg-info-fore":e==="info","bg-warn text-inverted hover:bg-warn-fore":e==="warn","bg-danger text-inverted hover:bg-danger-fore":e==="danger","hover:bg-accent":e==="ghost","hover:underline":e==="link","border border-input hover:bg-accent":e==="outline"},{"px-2 py-1":!t,"p-1.5":t==="icon"})}function ye({size:e,variant:t,className:o,...r}){const l=n.useMemo(()=>g(Q({size:e,variant:t}),o),[e,t,o]);return s.jsx("button",{className:l,type:"button",...r})}function we({open:e,children:t,timeout:o=150,padding:r="0.85rem",verticalAlign:l="center",closeOnOverlay:i,closeOnEsc:a,onExited:c,className:p,onOpenChange:f,size:m,...x}){const h=n.useRef(c),C=n.useRef(!1),y=d.useId(),{refs:u,context:M}=d.useFloating({open:e,onOpenChange:f,nodeId:y}),{getFloatingProps:j}=d.useInteractions([d.useDismiss(M,{enabled:a,escapeKey:a,outsidePress:!1})]),{isMounted:w,styles:v}=d.useTransitionStyles(M,{duration:o,initial:{opacity:0,transform:"scale(0.8)"}});n.useEffect(()=>{C.current!==w&&(C.current=w,!w&&h.current?.())},[w]);const S=n.useCallback(()=>{i&&f?.(!1)},[f,i]);h.current=c;const T=n.useMemo(()=>g("grid bg-backdrop z-40 justify-items-center",{"place-items-start items-start":l==="start","place-items-end":l==="end","place-items-center":l==="center"||!l}),[l]),P=n.useMemo(()=>N("transition ease-in-out",p),[p]);return s.jsx(E,{disabled:!w,children:s.jsx(d.FloatingOverlay,{className:T,"data-testid":"vs-dialog-overlay",onClick:S,style:{padding:r,opacity:v.opacity},lockScroll:!0,children:s.jsx(V,{ref:u.setFloating,className:P,role:"dialog",size:m,style:v,onClick:$,...j({...x}),children:t})})})}const V=n.forwardRef(({size:e,className:t,...o},r)=>{const l=n.useMemo(()=>g(e?"flex flex-col bg-background shadow-lg p-5 rounded":null,{"w-full max-w-dialog-sm":e==="small","w-full max-w-dialog-md":e==="medium","w-full max-w-dialog-lg":e==="large"},t),[e,t]);return s.jsx("div",{ref:r,className:l,...o})});V.displayName="DialogContent";const ve={open:250,close:150};function je({open:e,timeout:t=ve,onOpenChange:o,position:r="right",overlay:l,onExited:i,...a}){const c=d.useId(),p=n.useRef(!1),f=n.useRef(i),{refs:m,context:x}=d.useFloating({open:e,onOpenChange:o,nodeId:c}),{isMounted:h,styles:C}=d.useTransitionStyles(x,{duration:t,initial(){let u="translateX(75%)";return r==="left"?u="translateX(-75%)":r==="top"?u="translateY(-75%)":r==="bottom"&&(u="translateY(75%)"),{opacity:0,transform:u}}});n.useEffect(()=>{p.current!==h&&(p.current=h,!h&&f.current?.())},[h]);const y=n.useMemo(()=>g("fixed transition-transform z-30",{"top-0 right-0 h-full max-h-screen":r==="right","top-0 left-0 h-full max-h-screen":r==="left","top-0 left-0 right-0 w-full max-w-screen":r==="top","bottom-0 left-0 right-0 w-full max-w-screen":r==="bottom"}),[r]);return f.current=i,s.jsxs(E,{disabled:!h,children:[l?s.jsx(d.FloatingOverlay,{className:"bg-backdrop",style:{opacity:C.opacity},onClick:()=>o?.(!1)}):null,s.jsx("div",{ref:m.setFloating,className:y,role:"dialog",style:C,children:s.jsx(Ce,{...a})})]})}function Ce({className:e,unstyled:t,...o}){const r=n.useMemo(()=>t?e:N(g("relative bg-background min-w-full min-h-full border border-input shadow-lg"),e),[t,e]);return s.jsx("div",{className:r,...o})}function ee({size:e=20,label:t="Loading...",...o}){return s.jsxs("div",{role:"status",...o,children:[s.jsxs("svg",{"aria-hidden":"true",className:"text-accent animate-spin fill-primary",width:e,height:e,viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[s.jsx("path",{d:"M100 50.6a50 50 0 1 1-100 0 50 50 0 0 1 100 0Zm-91 0a41 41 0 1 0 82 0 41 41 0 0 0-82 0Z",fill:"currentColor"}),s.jsx("path",{d:"M94 39a4.2 4.2 0 0 0 3-5.4A50 50 0 0 0 41.7 1.3c-2.4.4-3.9 2.9-3.2 5.3a5 5 0 0 0 5.6 3.5A41 41 0 0 1 88 36 5 5 0 0 0 94 39Z",fill:"currentFill"})]}),s.jsx("span",{className:"sr-only",children:t})]})}function te({type:e,label:t,message:o}){const{icons:r}=Re();return s.jsxs("div",{className:"flex items-center px-4 py-3 w-80 text-sm bg-background border border-input rounded-lg shadow-md m-2",children:[e?s.jsxs("figure",{className:"mr-2",children:[e==="success"&&r?.success?r.success:null,e==="info"&&r?.info?r.info:null,e==="error"&&r?.error?r.error:null,e==="warn"&&r?.warn?r.warn:null,e==="loading"?s.jsx(ee,{size:20}):null]}):null,s.jsxs("div",{className:"space-y-2",children:[s.jsx("p",{className:"font-medium leading-none",children:t}),o?s.jsx("p",{children:o}):null]})]})}function W(){}class Me{notify=W;lastId=0;subscribe=t=>(this.notify=t,()=>{this.notify=W});add=(t,o={})=>{this.lastId+=1;const r=`${this.lastId}`;return this.notify({id:r,type:"add",config:{id:r,label:t,...o}}),r};update=(t,o)=>{this.notify({id:t,type:"update",config:o})};remove=t=>{this.notify({id:t,type:"remove"})};clear=()=>{this.lastId=0}}const L=new Me;function Ne({id:e,type:t,index:o,duration:r,className:l,children:i,inverted:a,timeout:c=250,max:p=3}){const f=n.useRef(!1),[m,x]=n.useState(!1),{context:h,refs:C}=d.useFloating({open:m,onOpenChange:x,nodeId:e}),{isMounted:y,styles:u}=d.useTransitionStyles(h,{duration:c,initial:{opacity:0,transform:`translateY(${a?"":"-"}50%)`}});n.useLayoutEffect(()=>{x(o<=p)},[o,p]),n.useEffect(()=>{f.current!==y&&(y||L.remove(e),f.current=y)},[y,e]),n.useEffect(()=>{if(!r)return;const w=window.setTimeout(()=>x(!1),r);return()=>window.clearTimeout(w)},[r,e]);const M=n.useCallback(()=>{t!=="loading"&&x(!1)},[t]),j=n.useMemo(()=>g("relative flex w-fit transition-transform ease-in-out cursor-pointer",l),[l]);return y?s.jsx("li",{role:"log",tabIndex:-1,ref:C.setFloating,className:j,style:u,onClick:M,children:i}):null}const ne=n.createContext({});function Re(){return n.useContext(ne)}function ke({className:e,margin:t=16,position:o="top-left",max:r,ListItem:l=te,icons:i}){const a=n.useMemo(()=>{const u={position:"fixed"};return o.indexOf("top")>-1?u.top=t:o.indexOf("bottom")>-1&&(u.bottom=t),o.indexOf("left")>-1?(u.left=t,u.alignItems="flex-start"):o.indexOf("right")>-1?(u.right=t,u.alignItems="flex-end"):(u.left="50%",u.alignItems="center",u.transform="translateX(-50%)"),u},[t,o]),c=n.useMemo(()=>g("flex flex-col z-40 overflow-hidden",e),[e]),p=n.useMemo(()=>o?.startsWith("bottom")||!1,[o]),f=n.useRef(new Map),[m,x]=n.useState([]),h=n.useState(0)[1];q(()=>L.subscribe(u=>{n.startTransition(()=>{if(u.type==="add")f.current.set(u.id,u.config),x(M=>[...M,u.id]);else if(u.type==="remove"){if(!f.current.delete(u.id))return;x(j=>{const w=new Set(j);return w.has(u.id)?(w.delete(u.id),Array.from(w)):j})}else if(u.type==="update"){const M=f.current.get(u.id);if(!M)return;f.current.set(u.id,{...M,...u.config}),h(j=>j+1)}})}),[]);const C=n.useMemo(()=>({icons:i}),[i]),y=m.length;return s.jsx(E,{children:s.jsx("ol",{className:c,style:a,"aria-live":"polite",children:s.jsx(ne.Provider,{value:C,children:m.map((u,M)=>{const j=f.current.get(u);if(!j)return null;const{className:w,duration:v,...S}=j;return s.jsx(Ne,{id:u,index:y-M,className:w,duration:v,inverted:p,max:r,children:n.createElement(l,S)},u)})})})})}function Ie({className:e,...t}){const o=n.useMemo(()=>N("inline-block animate-pulse rounded-md bg-accent",e),[e]);return s.jsx("span",{className:o,...t})}function Fe({className:e,...t}){const o=n.useMemo(()=>g("flex items-center justify-center","[&_button]:rounded-none [&_:first-child]:rounded-bl [&_:first-child]:rounded-tl [&_:last-child]:rounded-br [&_:last-child]:rounded-tr","[&_:first-child]:border-r-0 [&_:last-child]:border-l-0",e),[e]);return s.jsx("div",{role:"group",className:o,...t})}function Se({value:e,max:t,className:o,...r}){const l=n.useMemo(()=>e?Math.round(e/t*100):0,[e,t]),i=n.useMemo(()=>N("relative overflow-hidden rounded-full bg-primary",o),[o]);return s.jsx("div",{role:"progressbar",className:i,"aria-valuemax":t,"aria-valuemin":0,...r,children:s.jsx("div",{className:"h-full w-full flex-1 bg-input transition-all origin-right",style:{transform:`translateX(${l>100?100:l}%)`}})})}function Te({className:e,orientation:t="horizontal",...o}){const r=n.useMemo(()=>N(g("border-0 p-0 shrink-0 bg-input",t==="horizontal"?"h-[1px] w-full":"w-[1px] h-full"),e),[e,t]);return s.jsx("hr",{className:r,role:"none",...o})}exports.clsx=g;exports.Accordion=he;exports.Button=ye;exports.ButtonGroup=Fe;exports.Checkbox=fe;exports.Dialog=we;exports.Divider=Te;exports.FormField=ae;exports.FormLabel=Y;exports.Input=z;exports.InputField=ce;exports.Placeholder=Ie;exports.Popover=H;exports.Portal=E;exports.Progress=Se;exports.Radio=xe;exports.Select=be;exports.Sheet=je;exports.Spinner=ee;exports.Switch=K;exports.Textarea=Z;exports.Toast=ke;exports.ToastItem=te;exports.Tooltip=U;exports.merge=N;exports.toast=L;exports.varientButton=Q;
|
package/dist/index.d.ts
CHANGED
|
@@ -14,7 +14,6 @@ import { RefAttributes } from 'react';
|
|
|
14
14
|
import { ReferenceElement } from '@floating-ui/core';
|
|
15
15
|
import { ReferenceType } from '@floating-ui/react';
|
|
16
16
|
import { RefObject } from 'react';
|
|
17
|
-
import { SVGAttributes } from 'react';
|
|
18
17
|
import { TextareaHTMLAttributes } from 'react';
|
|
19
18
|
|
|
20
19
|
export declare function Accordion({ header, show, children, timeout, ...rest }: AccordionProps): JSX.Element;
|
|
@@ -41,7 +40,7 @@ export declare function ButtonGroup({ className, ...rest }: HTMLAttributes<HTMLD
|
|
|
41
40
|
|
|
42
41
|
export declare type ButtonProps = InnerButtonProps & ButtonHTMLAttributes<HTMLButtonElement>;
|
|
43
42
|
|
|
44
|
-
export declare function Checkbox({ checked, indeterminate, className, id, name, onChange, value, ...rest }: CheckboxProps): JSX.Element;
|
|
43
|
+
export declare function Checkbox({ checked, indeterminate, className, id, name, onChange, value, checkIcon, ...rest }: CheckboxProps): JSX.Element;
|
|
45
44
|
|
|
46
45
|
export declare interface CheckboxProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onClick' | 'onChange' | 'type' | 'role'> {
|
|
47
46
|
children?: ReactNode;
|
|
@@ -49,6 +48,8 @@ export declare interface CheckboxProps extends Omit<ButtonHTMLAttributes<HTMLBut
|
|
|
49
48
|
indeterminate?: boolean;
|
|
50
49
|
/** idが未指定の場合、nameが代わりに使われます */
|
|
51
50
|
name?: string;
|
|
51
|
+
/** チェック状態のアイコンを指定する */
|
|
52
|
+
checkIcon: ReactNode;
|
|
52
53
|
onChange?: (checked: boolean) => void;
|
|
53
54
|
}
|
|
54
55
|
|
|
@@ -120,30 +121,6 @@ export declare interface FormFieldProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
120
121
|
|
|
121
122
|
export declare function FormLabel({ className, ...rest }: LabelHTMLAttributes<HTMLLabelElement>): JSX.Element;
|
|
122
123
|
|
|
123
|
-
export declare function IconAlert(props: SVGAttributes<SVGSVGElement>): JSX.Element;
|
|
124
|
-
|
|
125
|
-
export declare function IconApproved(props: SVGAttributes<SVGSVGElement>): JSX.Element;
|
|
126
|
-
|
|
127
|
-
export declare function IconArrowDown(props: SVGAttributes<SVGSVGElement>): JSX.Element;
|
|
128
|
-
|
|
129
|
-
export declare function IconCaution(props: SVGAttributes<SVGSVGElement>): JSX.Element;
|
|
130
|
-
|
|
131
|
-
export declare function IconCheck(props: SVGAttributes<SVGSVGElement>): JSX.Element;
|
|
132
|
-
|
|
133
|
-
export declare function IconChevronRound(props: SVGAttributes<SVGSVGElement>): JSX.Element;
|
|
134
|
-
|
|
135
|
-
export declare function IconClose(props: SVGAttributes<SVGSVGElement>): JSX.Element;
|
|
136
|
-
|
|
137
|
-
export declare function IconFileRound(props: SVGAttributes<SVGSVGElement>): JSX.Element;
|
|
138
|
-
|
|
139
|
-
export declare function IconPencil(props: SVGAttributes<SVGSVGElement>): JSX.Element;
|
|
140
|
-
|
|
141
|
-
export declare function IconPlus(props: SVGAttributes<SVGSVGElement>): JSX.Element;
|
|
142
|
-
|
|
143
|
-
export declare function IconRefresh(props: SVGAttributes<SVGSVGElement>): JSX.Element;
|
|
144
|
-
|
|
145
|
-
export declare function IconUser(props: SVGAttributes<SVGSVGElement>): JSX.Element;
|
|
146
|
-
|
|
147
124
|
declare interface InnerButtonProps {
|
|
148
125
|
variant?: 'primary' | 'info' | 'warn' | 'link' | 'outline' | 'ghost' | 'danger';
|
|
149
126
|
size?: 'icon' | 'none';
|
|
@@ -273,7 +250,7 @@ export declare interface RadioProps extends Omit<ButtonHTMLAttributes<HTMLButton
|
|
|
273
250
|
onChange?: (checked: boolean) => void;
|
|
274
251
|
}
|
|
275
252
|
|
|
276
|
-
export declare function Select<T =
|
|
253
|
+
export declare function Select<T = unknown>({ className, placeholder, options, error, unstyled, disabled, value, maxHeight, arrowIcon, closeIcon, checkIcon, onChange, onClear, renderItem, sectionLabelStyle, buttonAreaStyle, clearLabelText, optionStyle, ...rest }: SelectProps<T>): JSX.Element;
|
|
277
254
|
|
|
278
255
|
export declare interface SelectProps<T> extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onChange' | 'onClick' | 'type' | 'value' | 'children'> {
|
|
279
256
|
/** 配列の値の入力の場合、複数選択モードに切り替えます */
|
|
@@ -283,13 +260,27 @@ export declare interface SelectProps<T> extends Omit<ButtonHTMLAttributes<HTMLBu
|
|
|
283
260
|
onClear?: () => void;
|
|
284
261
|
renderItem?: (item: OptionType<T>, config: OptionRenderConfig) => ReactElement;
|
|
285
262
|
placeholder?: string;
|
|
286
|
-
|
|
263
|
+
arrowIcon?: ReactNode;
|
|
264
|
+
closeIcon?: ReactNode;
|
|
265
|
+
checkIcon?: ReactNode;
|
|
266
|
+
/**
|
|
267
|
+
* select選択肢の最大高さ
|
|
268
|
+
* @default 408
|
|
269
|
+
*/
|
|
287
270
|
maxHeight?: number;
|
|
288
271
|
error?: boolean;
|
|
289
272
|
unstyled?: boolean;
|
|
273
|
+
/** クリアボタン、矢印アイコンの領域のdivのスタイルのカスタム指定 */
|
|
274
|
+
buttonAreaStyle?: string;
|
|
275
|
+
/** section(stringのみで区域を区切った場合)を使うときのスタイルのカスタム指定 */
|
|
276
|
+
sectionLabelStyle?: string;
|
|
277
|
+
/** 各選択肢のスタイルのカスタム指定 */
|
|
278
|
+
optionStyle?: string;
|
|
279
|
+
/** 選択を取り消すボタンのaria-label */
|
|
280
|
+
clearLabelText?: string;
|
|
290
281
|
}
|
|
291
282
|
|
|
292
|
-
export declare function Sheet({ open, timeout, onOpenChange, position, overlay, ...rest }: SheetProps): JSX.Element;
|
|
283
|
+
export declare function Sheet({ open, timeout, onOpenChange, position, overlay, onExited, ...rest }: SheetProps): JSX.Element;
|
|
293
284
|
|
|
294
285
|
export declare interface SheetProps extends HTMLAttributes<HTMLDivElement> {
|
|
295
286
|
/** trueの場合、モーダルを表示します。 */
|
|
@@ -337,7 +328,7 @@ export declare interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAr
|
|
|
337
328
|
unstyled?: boolean;
|
|
338
329
|
}
|
|
339
330
|
|
|
340
|
-
export declare function Toast({ className, margin, position, max, ListItem, }: ToasterProps): JSX.Element;
|
|
331
|
+
export declare function Toast({ className, margin, position, max, ListItem, icons, }: ToasterProps): JSX.Element;
|
|
341
332
|
|
|
342
333
|
export declare const toast: ToastObserver;
|
|
343
334
|
|
|
@@ -356,6 +347,14 @@ export declare interface ToastConfig {
|
|
|
356
347
|
className?: string;
|
|
357
348
|
}
|
|
358
349
|
|
|
350
|
+
export declare interface ToastContextType {
|
|
351
|
+
/**
|
|
352
|
+
* 表示するToastのタイプに使うアイコンを指定(未指定の場合はアイコンは表示されません)\
|
|
353
|
+
* ただし、loading状態はspinnerを表示します
|
|
354
|
+
*/
|
|
355
|
+
icons?: Record<Exclude<ToastType, 'loading'>, ReactNode>;
|
|
356
|
+
}
|
|
357
|
+
|
|
359
358
|
export declare type ToasterPosition = 'top' | 'top-right' | 'top-left' | 'bottom' | 'bottom-right' | 'bottom-left';
|
|
360
359
|
|
|
361
360
|
export declare interface ToasterProps {
|
|
@@ -384,6 +383,11 @@ export declare interface ToasterProps {
|
|
|
384
383
|
*/
|
|
385
384
|
max?: number;
|
|
386
385
|
ListItem?: FunctionComponent<ToastItemProps>;
|
|
386
|
+
/**
|
|
387
|
+
* 表示するToastのタイプに使うアイコンを指定(未指定の場合はアイコンは表示されません)\
|
|
388
|
+
* ただし、loading状態はspinnerを表示します
|
|
389
|
+
*/
|
|
390
|
+
icons?: Record<Exclude<ToastType, 'loading'>, ReactNode>;
|
|
387
391
|
}
|
|
388
392
|
|
|
389
393
|
export declare function ToastItem({ type, label, message }: ToastItemProps): JSX.Element;
|