@texturehq/edges 1.35.3 → 1.36.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/{colors-HFXagXDT.d.cts → colors-DlH6URGg.d.cts} +44 -0
- package/dist/{colors-_FKNnBIn.d.ts → colors-Dq4EZi3c.d.ts} +44 -0
- package/dist/form/index.cjs +1 -1
- package/dist/form/index.cjs.map +1 -1
- package/dist/form/index.js +1 -1
- package/dist/form/index.js.map +1 -1
- package/dist/index.cjs +12 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +97 -4
- package/dist/index.d.ts +97 -4
- package/dist/index.js +12 -12
- package/dist/index.js.map +1 -1
- package/dist/rhf/index.cjs +1 -1
- package/dist/rhf/index.cjs.map +1 -1
- package/dist/rhf/index.js +1 -1
- package/dist/rhf/index.js.map +1 -1
- package/dist/server.cjs +4 -4
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +4 -4
- package/dist/server.js.map +1 -1
- package/dist/styles.css +20 -17
- package/package.json +1 -1
package/dist/form/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import*as go from'react';import go__default,{memo,useRef,useCallback,useEffect,useState,Component}from'react';import {Modal,Dialog,Form,Link,Button,ModalOverlay,composeRenderProps}from'react-aria-components';import {twMerge}from'tailwind-merge';import*as Nt from'@phosphor-icons/react';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var ht=Object.defineProperty;var xt=(e,t,o)=>t in e?ht(e,t,{enumerable:true,configurable:true,writable:true,value:o}):e[t]=o;var Re=(e,t,o)=>xt(e,typeof t!="symbol"?t+"":t,o);function ze(e,t=false){let[o,r]=useState(t);return useEffect(()=>{if(typeof window>"u")return;let n=window.matchMedia(e);r(n.matches);let a=l=>{r(l.matches);};return n.addEventListener("change",a),()=>{n.removeEventListener("change",a);}},[e]),o}function me(e=true){let[t,o]=useState(null);return useEffect(()=>{if(!e){o(null);return}let r=typeof window<"u"?window.visualViewport:null;if(!r)return;let n=()=>{let a=Math.max(0,window.innerHeight-r.height-(r.offsetTop??0));o({height:r.height,keyboardOffset:a});};return n(),r.addEventListener("resize",n),r.addEventListener("scroll",n),()=>{r.removeEventListener("resize",n),r.removeEventListener("scroll",n);}},[e]),t}function ge(...e){return e.filter(Boolean).join(" ")}var F={displayXl:"text-display-xl",displayLg:"text-display-lg",displayMd:"text-display-md",displaySm:"text-display-sm",headingXl:"text-heading-xl",headingLg:"text-heading-lg",headingMd:"text-heading-md",headingSm:"text-heading-sm",bodyLg:"text-body-lg",bodyMd:"text-body-md",bodySm:"text-body-sm",labelLg:"text-label-lg",labelMd:"text-label-md",labelSm:"text-label-sm",code:"text-code",agent:"text-agent"};function Ve(e,...t){return ge(F[e],...t)}function $e(e=false){return `${e?"outline outline-1 outline-border-input data-[focus-visible]:outline-2 data-[focus-visible]:outline-action-default data-[focus-visible]:outline-offset-0 invalid:outline-2 invalid:outline-feedback-error-border group-invalid:outline-2 group-invalid:outline-feedback-error-border forced-colors:focus:outline-[Highlight] forced-colors:focus:outline-2 forced-colors:focus:outline-offset-2":"outline-none data-[focus-visible]:outline data-[focus-visible]:outline-2 data-[focus-visible]:outline-action-default data-[focus-visible]:outline-offset-0 invalid:outline-2 invalid:outline-feedback-error-border group-invalid:outline-2 group-invalid:outline-feedback-error-border forced-colors:focus:outline-[Highlight] forced-colors:focus:outline-2 forced-colors:focus:outline-offset-2"}`}var Q={sm:{text:"text-[length:var(--control-text-sm)]",height:"h-[var(--control-sm-height)]",padding:"px-[var(--control-padding-sm)]",paddingY:"py-[var(--control-gap-sm)]",gap:"gap-[var(--control-gap-sm)]"},md:{text:"text-[length:var(--control-text-md)]",height:"h-[var(--control-md-height)]",padding:"px-[var(--control-padding-md)]",paddingY:"py-[var(--control-gap-md)]",gap:"gap-[var(--control-gap-md)]"},lg:{text:"text-[length:var(--control-text-lg)]",height:"h-[var(--control-lg-height)]",padding:"px-[var(--control-padding-lg)]",paddingY:"py-[var(--control-gap-lg)]",gap:"gap-[var(--control-gap-lg)]"},xl:{text:"text-[length:var(--control-text-xl)]",height:"h-[var(--control-xl-height)]",padding:"px-[var(--control-padding-xl)]",paddingY:"py-[var(--control-gap-xl)]",gap:"gap-[var(--control-gap-xl)]"}};var oe={xs:16,sm:20,md:24,lg:32,xl:40,"2xl":48},D=memo(({name:e,size:t="md",color:o,weight:r="regular",className:n,ariaLabel:a,...l})=>{let i=Nt[e];if(!i)return process.env.NODE_ENV==="development"&&console.error(`Icon "${e}" not found in @phosphor-icons/react`),null;let s=typeof t=="string"&&t in oe?oe[t]:t,d=twMerge("inline-block flex-shrink-0",!o&&"text-current",n);return jsx(i,{...l,size:s,color:o,weight:r,className:d,"aria-label":a||`${e} icon`,"data-testid":`icon-${e}`})});D.displayName="Icon";var We=memo(({variant:e="subtle",shape:t="square",containerSize:o,containerClassName:r,size:n="md",className:a,name:l,color:i,weight:s,ariaLabel:d,ref:p,...c})=>{let g=typeof n=="string"&&n in oe?oe[n]:n,v=o?typeof o=="string"&&o in oe?oe[o]:o:g*1.75,b=twMerge("inline-flex items-center justify-center flex-shrink-0",t==="circle"?"rounded-full":"rounded-lg",e==="subtle"&&"bg-background-muted",e==="solid"&&"bg-action-brand text-[color:var(--color-action-brand-text)]",e==="outline"&&"border-2 border-current",r);return jsx("div",{className:b,style:{width:v,height:v},children:jsx(D,{...c,name:l,size:n,color:i,weight:s,className:a,ariaLabel:d})})});We.displayName="IconWithContainer";var Dt="flex font-medium justify-center items-center gap-2 text-center transition rounded-[var(--control-border-radius)] whitespace-nowrap box-border",kt="bg-action-primary text-[color:var(--color-action-primary-text)] hover:bg-action-primary-hover forced-colors:bg-[ButtonText] forced-colors:text-[ButtonFace] border-2 border-transparent",St={primary:kt,secondary:"bg-action-secondary text-[color:var(--color-action-secondary-text)] border-2 border-border-muted hover:bg-action-secondary-hover forced-colors:border-[ButtonBorder] forced-colors:bg-[ButtonFace] forced-colors:text-[ButtonText]",ghost:"border-none text-text-primary hover:bg-text-primary/5 forced-colors:text-[ButtonText] forced-colors:hover:bg-[ButtonFace]",destructive:"bg-action-destructive text-[color:var(--color-action-destructive-text)] hover:bg-action-destructive-hover forced-colors:bg-[Mark] forced-colors:text-[MarkText] border-2 border-transparent",link:"!text-action-primary hover:text-action-primary/90 hover:underline hover:decoration-2 hover:underline-offset-4",icon:"border-none text-text-primary hover:bg-background-hover hover:text-text-primary forced-colors:text-[ButtonText] forced-colors:hover:bg-[ButtonFace] p-1 flex-shrink-0 rounded-[var(--control-border-radius)]",unstyled:"bg-transparent"},Ye={full:"w-full",default:"w-fit"},Bt="opacity-50 cursor-not-allowed pointer-events-none",It="opacity-100 cursor-pointer",Tt={"top-right":"-right-2 -top-2","top-left":"-left-2 -top-2","bottom-right":"-right-2 -bottom-2","bottom-left":"-left-2 -bottom-2"},Ft={primary:"bg-action-primary text-[color:var(--color-action-primary-text)]",destructive:"bg-action-destructive text-[color:var(--color-action-destructive-text)] hover:bg-action-destructive-hover forced-colors:bg-[Mark] forced-colors:text-[MarkText] border-2 border-transparent"};function Mt(e){return !e||e==="default"||e==="brand"?"primary":e}function Et(e){let{variant:t="primary",size:o="md",isDisabled:r,fullWidth:n=false,isLoading:a=false}=e,l=Mt(t),i=l==="unstyled"?"":`${Dt} ${St[l]}`;l!=="unstyled"&&(i+=` ${Q[o].text} ${Q[o].height} ${Q[o].padding} ${Q[o].gap}`),r||a?i+=` ${Bt}`:i+=` ${It}`,n?i+=` ${Ye.full}`:i+=` ${Ye.default}`;let s=l==="primary"?"focus-visible:outline-action-primary":void 0;return [i,$e(),s].filter(Boolean).join(" ")}function V(e){let{icon:t,children:o,isLoading:r=false,loadingText:n,loadingIndicator:a,size:l="md",iconPosition:i="left",iconWeight:s,href:d,className:p,badgeNumber:c,badgeVariant:g="primary",badgePosition:v="top-right",style:b,target:C,rel:S,...w}=e,f=t?jsx(D,{name:t,size:l,weight:s}):null,y=jsxs(Fragment,{children:[i==="left"&&f,typeof o=="function"?null:o,i==="right"&&f]}),N=jsxs("div",{className:"relative inline-flex items-center justify-center",children:[jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:a||jsx(D,{name:"CircleNotch",size:l,className:"animate-spin","aria-hidden":"true"})}),jsx("div",{className:"invisible","aria-hidden":"true",children:y}),n&&jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:n})]}),h=(c??0)>0,P=twMerge(Et(e),p),_=d?{href:d,target:C,rel:S,...w}:{};if(d){let{onPress:L,onPressStart:I,onPressEnd:ae,onPressChange:W,onPressUp:Z,onAuxClick:ie,onContextMenu:ee,onDoubleClick:A,...T}=w;Object.assign(_,T);}let B=d?jsx(Link,{..._,...r&&{"aria-busy":true},style:h?void 0:b,className:P,children:r?N:typeof o=="function"?(function(L){return jsxs(Fragment,{children:[i==="left"&&f,o(L),i==="right"&&f]})}):y}):jsx(Button,{...w,...r&&{"aria-busy":true},style:h?void 0:b,className:P,children:r?N:typeof o=="function"?(function(L){return jsxs(Fragment,{children:[i==="left"&&f,o(L),i==="right"&&f]})}):y});return h?jsxs("div",{className:twMerge("relative flex",p),style:b,children:[B,jsx("span",{className:`absolute ${Tt[v]} flex h-5 w-5 items-center justify-center rounded-full ${Ft[g]} text-xs font-medium`,"aria-label":`${c} items`,children:c})]}):B}function Se({action:e,defaultVariant:t,defaultSize:o="lg"}){let r=!!e.formId;return jsx(V,{type:r?"submit":"button",form:r?e.formId:void 0,size:e.size||o,variant:e.variant||t,onPress:r?void 0:e.onPress,isLoading:e.isLoading,isDisabled:e.isDisabled,children:e.label})}function Y({primaryAction:e,secondaryAction:t,tertiaryAction:o,footerContent:r}){let n=e||t||o;return !n&&!r?null:jsxs("div",{className:`flex w-full flex-col items-center justify-center border-t p-4 ${r?"h-28":""}`,children:[r&&jsx("div",{className:"flex h-10 justify-center",children:r}),n&&jsxs("div",{className:"flex w-full items-center justify-between gap-3",children:[jsx("div",{children:o&&jsx(Se,{action:o,defaultVariant:"destructive"})}),jsxs("div",{className:"flex items-center gap-3",children:[t&&jsx(Se,{action:t,defaultVariant:"secondary"}),e&&jsx(Se,{action:e,defaultVariant:"primary"})]})]})]})}var Ht={heading:{sm:F.headingSm,md:F.headingMd,lg:F.headingLg,xl:F.headingXl},display:{sm:F.displaySm,md:F.displayMd,lg:F.displayLg,xl:F.displayXl}},Lt={page:"h-16 leading-[62px]"};function J({tag:e="h1",variant:t="heading",size:o="lg",height:r,className:n="",children:a}){let l=o==="xs"?"sm":o,i=Ht[t][l],s=r?Lt[r]:"";return jsx(e,{className:ge(i,"text-text-primary",s,n),children:a})}var R=({title:e,onClose:t,hideCloseIcon:o=false,titleAlign:r="left",hasBackArrow:n=false,onBack:a,headerContent:l})=>jsxs("div",{className:twMerge("relative flex h-16 w-full flex-shrink-0 items-center justify-between border-b px-6",e&&"border-b",r==="center"?"justify-center":""),children:[n&&jsx(V,{variant:"icon",onPress:a,className:"absolute left-6","aria-label":"Go back",children:jsx(D,{name:"CaretLeft","data-testid":"back-arrow"})}),l||jsxs(Fragment,{children:[e&&jsx(J,{size:"xs",children:e}),t&&!o&&jsx(V,{variant:"icon",onPress:t,"aria-label":"Close dialog",children:jsx(D,{name:"X","data-testid":"close-button"})})]})]});var k=({width:e,height:t,variant:o="rect",animation:r="pulse",gradient:n=false,flex:a=false,stack:l,responsive:i,delay:s=0,adjustAnimationSpeedBasedOnWidth:d=false,ariaLabel:p,className:c,"data-testid":g})=>{let[v,b]=useState(s===0);if(useEffect(()=>{if(s>0){let h=setTimeout(()=>b(true),s);return ()=>clearTimeout(h)}},[s]),!v)return null;let C=n?"bg-gradient-to-r from-[var(--color-skeleton-base)] via-[var(--color-skeleton-highlight)] to-[var(--color-skeleton-base)]":"bg-[var(--color-skeleton-base)]",S=d&&e?(()=>{let h=typeof e=="number"?e:parseFloat(String(e));return isNaN(h)?"":`animation-duration-[${Math.max(.8,h/100)}s]`})():"",w=r==="pulse"?`animate-pulse ${S}`:r==="wave"?`relative overflow-hidden before:absolute before:inset-0 before:bg-gradient-to-r before:from-transparent before:via-[var(--color-skeleton-wave)] before:to-transparent before:animate-wave ${S}`:"",f="rounded-sm";o==="circle"&&(f="rounded-full"),o==="text"&&(f="h-4 w-full rounded-sm");let y=a?"flex-1 min-w-0":"",N=i?Object.entries(i).map(([h,P])=>`${h}:w-[${P}]`).join(" "):"";return l?jsx("div",{className:"space-y-2","data-testid":g,children:l.map((h,P)=>jsx("div",{className:twMerge(C,w,f,y,N,c),style:{width:h,height:t}},P))}):jsx("div",{className:twMerge(C,w,f,y,N,c),style:{width:e,height:t},role:"presentation","aria-hidden":!p,"aria-label":p??void 0,"data-testid":g})};var _t={outlined:"bg-background-surface border border-border-default",elevated:"bg-background-surface border-0 shadow-md",filled:"bg-background-muted border-0",ghost:"bg-transparent border-0 shadow-none"},Wt="rounded-lg",Te={square:"aspect-square",video:"aspect-video",wide:"aspect-[2/1]",auto:""},jt={start:"justify-start",end:"justify-end",center:"justify-center",between:"justify-between"};function $({variant:e="outlined",className:t,children:o,isLoading:r=false,layout:n="default"}){return jsx("div",{className:twMerge("w-full overflow-hidden",_t[e],Wt,n==="flex"&&"flex flex-col",t),"data-testid":"card",children:r?jsx(k,{width:"100%",height:"100%",className:"rounded-none"}):o})}function qe({title:e,subtitle:t,actions:o,className:r,isLoading:n=false}){return n?jsxs("div",{className:twMerge("p-6 pb-4",r),children:[jsxs("div",{className:"flex justify-between items-start mb-1",children:[jsx(k,{width:120,height:20}),jsx(k,{width:24,height:24})]}),t&&jsx(k,{width:200,height:16})]}):!e&&!t&&!o?null:jsx("div",{className:twMerge("p-6 pb-4",r),children:jsxs("div",{className:"flex justify-between items-start gap-4",children:[jsxs("div",{className:"min-w-0 flex-1",children:[e&&jsx("div",{className:"mb-1",children:typeof e=="string"?jsx(J,{tag:"h3",size:"sm",className:"text-text-primary",children:e}):e}),t&&jsx("div",{className:Ve("bodySm","text-text-secondary"),children:t})]}),o&&jsx("div",{className:"flex-shrink-0",children:o})]})})}function Xe({src:e,alt:t,aspectRatio:o="auto",className:r,children:n,isLoading:a=false}){return a?jsx("div",{className:twMerge("bg-background-muted",Te[o],r),children:jsx(k,{width:"100%",height:"100%"})}):n?jsx("div",{className:twMerge("overflow-hidden",Te[o],r),children:n}):e?jsx("div",{className:twMerge("overflow-hidden",Te[o],r),children:jsx("img",{src:e,alt:t||"",className:"w-full h-full object-cover",loading:"lazy"})}):null}function Qe({className:e,children:t,isLoading:o=false,fill:r=false}){let a=e?.match(/p(?:t|b|l|r|x|y)?-(?:\d+(?:\.\d+)?|px|\[.+?\])/)?"":"px-6 py-4";return o?jsx("div",{className:twMerge(a,r&&"flex-1 flex flex-col min-h-0",e),children:jsxs("div",{className:"space-y-2",children:[jsx(k,{width:"100%",height:16}),jsx(k,{width:"80%",height:16}),jsx(k,{width:"60%",height:16})]})}):t?jsx("div",{className:twMerge("px-6 py-4 text-text-primary",r&&"flex-1 flex flex-col min-h-0",e),children:t}):null}function Je({className:e,children:t,align:o="end",isLoading:r=false}){return r?jsxs("div",{className:twMerge("px-6 py-4 flex gap-2 justify-end",e),children:[jsx(k,{width:80,height:32}),jsx(k,{width:60,height:32})]}):t?jsx("div",{className:twMerge("px-6 py-4 flex items-center gap-2",jt[o],e),children:t}):null}$.Header=qe;$.Media=Xe;$.Content=Qe;$.Footer=Je;var E=class extends Component{constructor(){super(...arguments);Re(this,"state",{hasError:false});Re(this,"handleRetry",()=>{this.setState({hasError:false,error:void 0}),typeof window<"u"&&window.location.reload();});}static getDerivedStateFromError(o){return {hasError:true,error:o}}componentDidCatch(o,r){console.error("Error Boundary caught an error:",o,r);}render(){return this.state.hasError?this.props.fallback?this.props.fallback:jsxs($,{children:[this.props.title&&jsx($.Header,{title:this.props.title}),jsx($.Content,{children:jsxs("div",{className:"flex flex-col items-center justify-center gap-4","data-testid":"error-boundary",children:[jsx("p",{className:"text-feedback-error-text",children:this.state.error?.message||"Something went wrong"}),jsx("button",{className:"rounded bg-action-default px-4 py-2 text-[color:var(--color-action-default-text)] hover:bg-action-default-hover",onClick:this.handleRetry,children:"Retry"})]})})]}):this.props.children}};function G({transparent:e=false,className:t,children:o,...r}){return jsx(ModalOverlay,{...r,className:composeRenderProps(t,(n,a)=>twMerge("fixed inset-0 z-50","outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0 focus-visible:ring-0",e?"bg-transparent":["bg-gradient-to-br from-background-modal/20 via-background-modal/15 to-background-modal/20","backdrop-blur-[2px]","supports-[backdrop-filter]:bg-background-modal/15"].join(" "),a.isEntering&&["animate-in fade-in","duration-300 ease-out"].join(" "),a.isExiting&&["animate-out fade-out","duration-200 ease-in"].join(" "),n)),children:o})}var Kt=.3,Zt=.5;function ve({children:e,title:t,headerContent:o,titleAlign:r="left",hideCloseIcon:n=false,hasBackArrow:a=false,onBack:l,isOpen:i,onClose:s,isDismissable:d=true,transparentOverlay:p=false,primaryAction:c,secondaryAction:g,footerContent:v,maxHeight:b="80vh",height:C,maxWidth:S="640px",contentPadding:w=true,showHandle:f=true,animationVariant:y="scale",className:N}){let[h,P]=useState(false),[_,B]=useState(0),[L,I]=useState(false),ae=me(i),W=ae?.height??null,Z=ae?.keyboardOffset??0,ie=useRef(null),ee=useRef(null),A=useRef(null),T=useRef({isDragging:false,startY:0,startTime:0,pointerId:null});useEffect(()=>{if(i){let m=setTimeout(()=>{P(true),setTimeout(()=>P(false),600);},400);return ()=>clearTimeout(m)}},[i]),useEffect(()=>{i||(B(0),I(false),T.current={isDragging:false,startY:0,startTime:0,pointerId:null});},[i]),useEffect(()=>{let m=ee.current;if(!m||!i)return;let z=null,te=de=>{let X=de.target;X&&["INPUT","TEXTAREA","SELECT"].includes(X.tagName)&&(z&&clearTimeout(z),z=setTimeout(()=>{X.scrollIntoView({block:"nearest",behavior:"smooth"});},320));};return m.addEventListener("focusin",te),()=>{m.removeEventListener("focusin",te),z&&clearTimeout(z);}},[i]);let U=useCallback(m=>{d&&(m.pointerType!=="touch"&&m.pointerType!=="pen"||(A.current&&(clearTimeout(A.current),A.current=null),T.current={isDragging:true,startY:m.clientY,startTime:Date.now(),pointerId:m.pointerId},I(false),m.currentTarget.setPointerCapture(m.pointerId)));},[d]),q=useCallback(m=>{let{isDragging:z,startY:te,pointerId:de}=T.current;if(!z||m.pointerId!==de)return;let X=m.clientY-te;B(Math.max(0,X));},[]),se=useCallback(m=>{let{isDragging:z,startY:te,startTime:de,pointerId:X}=T.current;if(!z||m.pointerId!==X)return;let Ce=m.clientY-te,mt=Date.now()-de,gt=Ce/mt;T.current={isDragging:false,startY:0,startTime:0,pointerId:null};let bt=(ie.current?.getBoundingClientRect().height??0)*Kt;(Ce>bt||gt>Zt&&Ce>50)&&d?(s?.(),B(0)):(I(true),B(0),A.current=setTimeout(()=>{I(false),A.current=null;},200));},[d,s]);if(!i)return null;let Ne=t||o,le=c||g||v;return jsx(E,{children:jsx(G,{isOpen:i,onOpenChange:m=>{m||s?.();},isDismissable:d,transparent:p,style:{paddingBottom:Z>0?`${Z}px`:void 0,transition:"padding-bottom 0.25s ease-out"},className:"flex items-end justify-center p-0 sm:p-4",children:jsx(Modal,{className:"w-full max-w-full p-0 sm:p-2 outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0 focus-visible:ring-0",isDismissable:d,children:jsx("div",{ref:ie,className:twMerge("w-full",L&&"transition-transform duration-200"),style:{transform:_>0?`translateY(${_}px)`:void 0},children:jsxs(Dialog,{className:twMerge("relative flex w-full flex-col overflow-hidden","bg-background-surface","shadow-2xl shadow-black/30 dark:shadow-black/60","border-t border-x border-border-default/40","outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0 focus-visible:ring-0 focus:shadow-none","origin-bottom",y==="scale"?"animate-[tray-enter-scale_400ms_cubic-bezier(0.32,0.72,0,1)]":"animate-[tray-enter_400ms_cubic-bezier(0.32,0.72,0,1)]",y==="scale"?"data-[exiting]:animate-[tray-exit-scale_250ms_cubic-bezier(0.32,0,0.67,0)]":"data-[exiting]:animate-[tray-exit_250ms_cubic-bezier(0.32,0,0.67,0)]",N),style:{maxWidth:S,...C?{height:C}:{maxHeight:/\d/.test(b)?W!==null?`min(${b}, ${Math.max(W-8,0)}px, 100dvh)`:`min(${b}, 100dvh)`:b}},children:[f&&jsx("div",{className:"absolute top-0 left-0 right-0 h-8 z-10 flex justify-center items-start pt-2 touch-none cursor-grab active:cursor-grabbing",onPointerDown:U,onPointerMove:q,onPointerUp:se,onPointerCancel:se,children:jsx("div",{className:twMerge("h-1 w-12 rounded-full bg-border-muted transition-all duration-300","hover:bg-border-default hover:w-16",h&&"animate-[handle-wiggle_0.6s_ease-in-out]")})}),Ne&&(a?jsx(R,{title:t,headerContent:o,titleAlign:r,hideCloseIcon:n||!s,hasBackArrow:true,onBack:l??(()=>{}),onClose:s||(()=>{})}):jsx(R,{title:t,headerContent:o,titleAlign:r,hideCloseIcon:n||!s,onClose:s||(()=>{})})),jsx("div",{ref:ee,className:twMerge("flex-1 min-h-0 overflow-y-auto overscroll-contain",w?"p-4":"p-0"),children:e}),le&&jsx(Y,{primaryAction:c,secondaryAction:g,footerContent:v})]})})})})})}ve.displayName="Tray";function Le({isOpen:e,onClose:t,title:o,headerContent:r,titleAlign:n="left",hideCloseIcon:a=false,hasBackArrow:l=false,onBack:i,children:s,primaryAction:d,secondaryAction:p,tertiaryAction:c,footerContent:g,transparentOverlay:v=false,maxWidth:b="600px",minWidth:C="400px",maxHeight:S="85vh",height:w,mobileMaxHeight:f="90vh",mobileHeight:y,contentPadding:N=true,className:h}){let P=ze("(max-width: 767px)"),_=me(P&&e===void 0),B=_?.height??null,L=_?.keyboardOffset??0,I=useRef(null),ae=useCallback(()=>{I.current&&I.current.scrollTop!==0&&(I.current.scrollTop=0);},[]),W=useRef(null),Z=useRef(null);useEffect(()=>{let U=Z.current;if(!U||!P)return;let q=null,se=Ne=>{let le=Ne.target;le&&["INPUT","TEXTAREA","SELECT"].includes(le.tagName)&&(q&&clearTimeout(q),q=setTimeout(()=>{le.scrollIntoView({block:"nearest",behavior:"smooth"});},320));};return U.addEventListener("focusin",se),()=>{U.removeEventListener("focusin",se),q&&clearTimeout(q);}},[P]);let ie=useCallback(()=>{W.current&&W.current.scrollTop!==0&&(W.current.scrollTop=0);},[]);if(e===false)return null;let ee=o||r,A=d||p||c||g,T=e!==void 0;return P?T?jsx(ve,{isOpen:e,onClose:t,title:o,headerContent:r,titleAlign:n,hideCloseIcon:a,hasBackArrow:l,onBack:i,primaryAction:d,secondaryAction:p,footerContent:g,transparentOverlay:v,maxHeight:f,height:y,maxWidth:b,contentPadding:N,showHandle:true,animationVariant:"scale",className:h,children:s}):jsx(E,{children:jsx(G,{isDismissable:true,transparent:v,style:{paddingBottom:L>0?`${L}px`:void 0,transition:"padding-bottom 0.25s ease-out"},className:"flex items-end justify-center",children:jsx(Modal,{className:"w-full p-0 outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0 focus-visible:ring-0",children:jsxs(Dialog,{ref:I,onScroll:ae,className:twMerge("relative flex w-full flex-col","bg-background-surface","shadow-2xl shadow-black/20","border-t border-x border-border-default/40","rounded-t-xl","overflow-hidden","animate-in slide-in-from-bottom","duration-300 ease-out","data-[exiting]:animate-out data-[exiting]:slide-out-to-bottom","data-[exiting]:duration-200 data-[exiting]:ease-in",h),style:{...y?{height:y}:{maxHeight:/\d/.test(f)?B!==null?`min(${f}, ${Math.max(B-8,0)}px, 100dvh)`:`min(${f}, 100dvh)`:f}},children:[jsx("div",{className:"flex justify-center pt-2",children:jsx("div",{className:"h-1.5 w-12 rounded-full bg-border-muted"})}),ee&&(l?jsx(R,{title:o,headerContent:r,titleAlign:n,hideCloseIcon:a||!t,hasBackArrow:true,onBack:i,onClose:t||(()=>{})}):jsx(R,{title:o,headerContent:r,titleAlign:n,hideCloseIcon:a||!t,onClose:t||(()=>{})})),jsx("div",{ref:Z,className:twMerge("flex-1 min-h-0 overflow-y-auto overscroll-contain",N?"px-6 py-6":"p-0"),children:s}),A&&jsx(Y,{primaryAction:d,secondaryAction:p,tertiaryAction:c,footerContent:g})]})})})}):jsx(E,{children:jsx(G,{...T?{isOpen:e,onOpenChange:U=>{!U&&t&&t();}}:{},isDismissable:true,transparent:v,className:"flex items-center justify-center",children:jsx(Modal,{className:"w-full p-4 outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0 focus-visible:ring-0",style:{maxWidth:b},children:jsxs(Dialog,{ref:W,onScroll:ie,className:twMerge("relative flex w-full flex-col","bg-background-surface","shadow-2xl shadow-black/20","border border-border-default/50","rounded-md","overflow-hidden","outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0","animate-in fade-in zoom-in-96 slide-in-from-bottom-2","duration-300 ease-out","data-[exiting]:animate-out data-[exiting]:fade-out data-[exiting]:zoom-out-95","data-[exiting]:duration-200 data-[exiting]:ease-in",h),style:{minWidth:C,...w?{height:w}:{maxHeight:S}},children:[ee&&(l?jsx(R,{title:o,headerContent:r,titleAlign:n,hideCloseIcon:a||!t,hasBackArrow:true,onBack:i,onClose:t||(()=>{})}):jsx(R,{title:o,headerContent:r,titleAlign:n,hideCloseIcon:a||!t,onClose:t||(()=>{})})),jsx("div",{className:twMerge("flex-1 min-h-0 overflow-y-auto",N?"px-6 py-6":"p-0"),children:s}),A&&jsx(Y,{primaryAction:d,secondaryAction:p,tertiaryAction:c,footerContent:g})]})})})})}function pe(e){return jsx(Form,{validationBehavior:"aria",...e,className:twMerge("flex flex-col gap-6",e.className)})}function Hn({formId:e="dialog-form",onSubmit:t,primaryLabel:o="Save",secondaryLabel:r="Cancel",onCancel:n,primaryVariant:a,secondaryVariant:l="secondary",children:i,title:s,...d}){return jsx(Le,{title:s,primaryAction:{label:o,onPress:()=>{let c=document.getElementById(e);c&&c.requestSubmit();},variant:a},secondaryAction:n?{label:r,onPress:n,variant:l}:void 0,...d,children:jsx(pe,{id:e,onSubmit:t,children:i})})}function Pe({children:e,title:t,headerContent:o,titleAlign:r="left",hideCloseIcon:n=false,hasBackArrow:a=false,onBack:l,isOpen:i,slideInFrom:s="right",transparentOverlay:d=false,onClose:p,className:c,primaryAction:g,secondaryAction:v,tertiaryAction:b,footerContent:C,contentPadding:S=true,maxWidth:w="400px"}){if(!i)return null;let f=t||o,y=g||v||b||C;return jsx(E,{children:jsx(G,{isOpen:i,onOpenChange:N=>!N&&p?.(),isDismissable:true,transparent:d,children:jsx(Modal,{className:"outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0 focus-visible:ring-0",children:jsxs(Dialog,{className:twMerge("fixed top-0 bottom-0 flex flex-col bg-background-surface shadow-xl overflow-hidden",s==="right"?"right-0":"left-0",s==="right"?"animate-in slide-in-from-right duration-300 ease-out":"animate-in slide-in-from-left duration-300 ease-out","data-[exiting]:animate-out",s==="right"?"data-[exiting]:slide-out-to-right":"data-[exiting]:slide-out-to-left","data-[exiting]:duration-200 data-[exiting]:ease-in","outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-action-default focus-visible:outline-offset-0",c),style:{maxWidth:w,width:"100%"},children:[f&&(a&&l?jsx(R,{title:t,headerContent:o,titleAlign:r,hideCloseIcon:n,hasBackArrow:true,onBack:l,onClose:p}):jsx(R,{title:t,headerContent:o,titleAlign:r,hideCloseIcon:n,onClose:p})),jsx("div",{className:twMerge("flex-1 overflow-y-auto overscroll-contain",S?"px-6 py-6":"p-0"),children:e}),y&&jsx(Y,{primaryAction:g,secondaryAction:v,tertiaryAction:b,footerContent:C})]})})})})}Pe.displayName="Drawer";function Qn({formId:e="drawer-form",onSubmit:t,primaryLabel:o="Save",secondaryLabel:r="Cancel",onCancel:n,primaryVariant:a,secondaryVariant:l="secondary",children:i,...s}){return jsx(Pe,{primaryAction:{label:o,onPress:()=>{let p=document.getElementById(e);p&&p.requestSubmit();},variant:a},secondaryAction:n?{label:r,onPress:n,variant:l}:void 0,...s,children:jsx(pe,{id:e,onSubmit:t,className:"mt-2",children:i})})}function ea({align:e="end",className:t,...o}){return jsx("div",{...o,className:twMerge("flex gap-2",e==="start"?"justify-start":e==="between"?"justify-between":"justify-end",t)})}var po={sm:"gap-2",md:"gap-4",lg:"gap-6"};function fo(e){if(!e)return "";let t=e.base?`grid-cols-${e.base}`:"",o=e.md?`md:grid-cols-${e.md}`:"",r=e.lg?`lg:grid-cols-${e.lg}`:"";return [t,o,r].filter(Boolean).join(" ")}function na({cols:e={base:1},gap:t="lg",className:o,...r}){return jsx("div",{...r,className:twMerge("grid",fo(e),po[t],o)})}var bo=go__default.forwardRef(({children:e,className:t},o)=>jsx("div",{ref:o,className:twMerge("relative w-full",t),children:e}));bo.displayName="InputWrapper";function st({size:e="md",className:t,children:o,...r}){return jsx("div",{...r,className:twMerge("leading-[2.25] text-text-secondary",Q[e].text,t),children:o})}function ba({title:e,description:t,showDivider:o,className:r,children:n,...a}){return jsxs("section",{...a,className:twMerge("flex flex-col",r),children:[(e||t)&&jsxs("div",{className:"flex flex-col gap-1 mb-6",children:[typeof e=="string"?jsx(J,{tag:"h3",size:"sm",children:e}):e,t?jsx(st,{size:"lg",children:t}):null]}),jsx("div",{className:"flex flex-col gap-6",children:n}),o&&jsx("hr",{className:"mt-2 border-border-muted"})]})}function ha(){return jsx("hr",{className:"border-border-muted"})}function wa({steps:e,currentStepId:t,onStepClick:o,className:r}){let n=e.findIndex(a=>a.id===t);return jsx("nav",{"aria-label":"Progress",className:twMerge("w-full",r),children:jsx("div",{className:"relative mb-12",children:jsx("ol",{className:"relative flex items-start justify-between",children:e.map((a,l)=>{let i=a.id===t,s=l<n,d=o&&(s||i);return jsxs("li",{className:"relative flex flex-col items-center",style:{flex:`1 1 ${100/e.length}%`},children:[jsx("button",{type:"button",disabled:!d,onClick:()=>d&&o?.(a.id),className:twMerge("relative z-10 flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-full border-2 transition-colors bg-background-body",s&&"border-action-primary bg-action-primary text-text-inverse hover:bg-action-primary/90",i&&"border-action-primary bg-background-body text-action-primary",!s&&!i&&"border-border-default bg-background-body text-text-secondary",d&&"cursor-pointer",!d&&"cursor-default"),"aria-current":i?"step":void 0,children:s?jsx(D,{name:"Check",size:20,weight:"bold"}):jsx("span",{className:"text-sm font-semibold",children:l+1})}),l<e.length-1&&jsx("div",{className:"absolute top-5 h-0.5 transition-colors",style:{left:"50%",width:"100%",marginLeft:"20px",backgroundColor:l<n?"var(--color-action-primary)":"var(--color-border-default)"}}),jsxs("div",{className:"mt-3 flex flex-col items-center text-center w-32",children:[jsx("span",{className:twMerge("text-sm font-medium",i&&"text-text-default",s&&"text-text-primary",!i&&!s&&"text-text-secondary"),children:a.title}),a.description&&jsx("span",{className:"mt-1 text-xs text-text-secondary",children:a.description})]})]},a.id)})})})})}function ka({formId:e,show:t,isSubmitting:o,onCancel:r,primaryLabel:n="Save changes",secondaryLabel:a="Cancel",className:l}){return t?jsx("div",{className:twMerge("fixed inset-x-0 bottom-0 z-40 border-t border-border-muted bg-background-surface/95 backdrop-blur supports-[backdrop-filter]:bg-background-surface/70",l),children:jsxs("div",{className:"mx-auto flex max-w-screen-lg items-center justify-between gap-3 p-3",children:[jsx("div",{className:"text-sm text-text-secondary",children:"You have unsaved changes"}),jsxs("div",{className:"flex gap-2",children:[jsx(V,{variant:"secondary",onPress:r,children:a}),jsx(V,{type:"submit",form:e,isDisabled:!!o,children:o?"Saving...":n})]})]})}):null}function Ia({when:e,message:t="You have unsaved changes. Leave anyway?"}){return go.useEffect(()=>{if(!e)return;let o=r=>(r.preventDefault(),r.returnValue=t,t);return window.addEventListener("beforeunload",o),()=>window.removeEventListener("beforeunload",o)},[e,t]),null}function Fa({steps:e,initialStepId:t,canNavigate:o}){if(e.length===0)throw new Error("useWizard: steps array cannot be empty");let[r,n]=go.useState(t||e[0].id),a=e.findIndex(c=>c.id===r),l=a>0,i=a<e.length-1,s=async c=>c===r?true:o&&!await o(r,c)?false:(n(c),true);return {steps:e,currentStepId:r,setCurrentStepId:s,next:async()=>!i||a===-1?false:s(e[a+1].id),prev:async()=>!l||a===-1?false:s(e[a-1].id),hasNext:i,hasPrev:l,stepIndex:a}}export{Hn as DialogForm,Qn as DrawerForm,ea as FormActions,ha as FormDivider,na as FormGrid,ba as FormSection,wa as FormStepper,ka as SaveBar,Ia as UnsavedChangesPrompt,Fa as useWizard};//# sourceMappingURL=index.js.map
|
|
1
|
+
import*as go from'react';import go__default,{memo,useRef,useCallback,useEffect,useState,Component}from'react';import {Modal,Dialog,Form,Link,Button,ModalOverlay,composeRenderProps}from'react-aria-components';import {twMerge}from'tailwind-merge';import*as Nt from'@phosphor-icons/react';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var ht=Object.defineProperty;var xt=(e,t,o)=>t in e?ht(e,t,{enumerable:true,configurable:true,writable:true,value:o}):e[t]=o;var Re=(e,t,o)=>xt(e,typeof t!="symbol"?t+"":t,o);function ze(e,t=false){let[o,r]=useState(t);return useEffect(()=>{if(typeof window>"u")return;let n=window.matchMedia(e);r(n.matches);let a=l=>{r(l.matches);};return n.addEventListener("change",a),()=>{n.removeEventListener("change",a);}},[e]),o}function me(e=true){let[t,o]=useState(null);return useEffect(()=>{if(!e){o(null);return}let r=typeof window<"u"?window.visualViewport:null;if(!r)return;let n=()=>{let a=Math.max(0,window.innerHeight-r.height-(r.offsetTop??0));o({height:r.height,keyboardOffset:a});};return n(),r.addEventListener("resize",n),r.addEventListener("scroll",n),()=>{r.removeEventListener("resize",n),r.removeEventListener("scroll",n);}},[e]),t}function ge(...e){return e.filter(Boolean).join(" ")}var T={displayXl:"text-display-xl",displayLg:"text-display-lg",displayMd:"text-display-md",displaySm:"text-display-sm",headingXl:"text-heading-xl",headingLg:"text-heading-lg",headingMd:"text-heading-md",headingSm:"text-heading-sm",bodyLg:"text-body-lg",bodyMd:"text-body-md",bodySm:"text-body-sm",labelLg:"text-label-lg",labelMd:"text-label-md",labelSm:"text-label-sm",code:"text-code",agent:"text-agent"};function Ve(e,...t){return ge(T[e],...t)}function $e(e=false){return `${e?"outline outline-1 outline-border-input data-[focus-visible]:outline-2 data-[focus-visible]:outline-action-default data-[focus-visible]:outline-offset-0 invalid:outline-2 invalid:outline-feedback-error-border group-invalid:outline-2 group-invalid:outline-feedback-error-border forced-colors:focus:outline-[Highlight] forced-colors:focus:outline-2 forced-colors:focus:outline-offset-2":"outline-none data-[focus-visible]:outline data-[focus-visible]:outline-2 data-[focus-visible]:outline-action-default data-[focus-visible]:outline-offset-0 invalid:outline-2 invalid:outline-feedback-error-border group-invalid:outline-2 group-invalid:outline-feedback-error-border forced-colors:focus:outline-[Highlight] forced-colors:focus:outline-2 forced-colors:focus:outline-offset-2"}`}var Q={sm:{text:"text-[length:var(--control-text-sm)]",height:"h-[var(--control-sm-height)]",padding:"px-[var(--control-padding-sm)]",paddingY:"py-[var(--control-gap-sm)]",gap:"gap-[var(--control-gap-sm)]"},md:{text:"text-[length:var(--control-text-md)]",height:"h-[var(--control-md-height)]",padding:"px-[var(--control-padding-md)]",paddingY:"py-[var(--control-gap-md)]",gap:"gap-[var(--control-gap-md)]"},lg:{text:"text-[length:var(--control-text-lg)]",height:"h-[var(--control-lg-height)]",padding:"px-[var(--control-padding-lg)]",paddingY:"py-[var(--control-gap-lg)]",gap:"gap-[var(--control-gap-lg)]"},xl:{text:"text-[length:var(--control-text-xl)]",height:"h-[var(--control-xl-height)]",padding:"px-[var(--control-padding-xl)]",paddingY:"py-[var(--control-gap-xl)]",gap:"gap-[var(--control-gap-xl)]"}};var oe={xs:16,sm:20,md:24,lg:32,xl:40,"2xl":48},k=memo(({name:e,size:t="md",color:o,weight:r="regular",className:n,ariaLabel:a,...l})=>{let i=Nt[e];if(!i)return process.env.NODE_ENV==="development"&&console.error(`Icon "${e}" not found in @phosphor-icons/react`),null;let s=typeof t=="string"&&t in oe?oe[t]:t,d=twMerge("inline-block flex-shrink-0",!o&&"text-current",n);return jsx(i,{...l,size:s,color:o,weight:r,className:d,"aria-label":a||`${e} icon`,"data-testid":`icon-${e}`})});k.displayName="Icon";var We=memo(({variant:e="subtle",shape:t="square",containerSize:o,containerClassName:r,size:n="md",className:a,name:l,color:i,weight:s,ariaLabel:d,ref:p,...c})=>{let g=typeof n=="string"&&n in oe?oe[n]:n,v=o?typeof o=="string"&&o in oe?oe[o]:o:g*1.75,b=twMerge("inline-flex items-center justify-center flex-shrink-0",t==="circle"?"rounded-full":"rounded-lg",e==="subtle"&&"bg-background-muted",e==="solid"&&"bg-action-brand text-[color:var(--color-action-brand-text)]",e==="outline"&&"border-2 border-current",r);return jsx("div",{className:b,style:{width:v,height:v},children:jsx(k,{...c,name:l,size:n,color:i,weight:s,className:a,ariaLabel:d})})});We.displayName="IconWithContainer";var kt="flex font-medium justify-center items-center gap-2 text-center transition rounded-[var(--control-border-radius)] whitespace-nowrap box-border",Dt="bg-action-primary text-[color:var(--color-action-primary-text)] hover:bg-action-primary-hover forced-colors:bg-[ButtonText] forced-colors:text-[ButtonFace] border-2 border-transparent",St={primary:Dt,secondary:"bg-action-secondary text-[color:var(--color-action-secondary-text)] border-2 border-border-muted hover:bg-action-secondary-hover forced-colors:border-[ButtonBorder] forced-colors:bg-[ButtonFace] forced-colors:text-[ButtonText]",ghost:"border-none text-text-primary hover:bg-text-primary/5 forced-colors:text-[ButtonText] forced-colors:hover:bg-[ButtonFace]",destructive:"bg-transparent text-feedback-error-text border-2 border-border-muted hover:bg-feedback-error-background/50 forced-colors:border-[ButtonBorder] forced-colors:bg-[ButtonFace] forced-colors:text-[Mark]",link:"!text-action-primary hover:text-action-primary/90 hover:underline hover:decoration-2 hover:underline-offset-4",icon:"border-none text-text-primary hover:bg-background-hover hover:text-text-primary forced-colors:text-[ButtonText] forced-colors:hover:bg-[ButtonFace] p-1 flex-shrink-0 rounded-[var(--control-border-radius)]",unstyled:"bg-transparent"},Ye={full:"w-full",default:"w-fit"},Bt="opacity-50 cursor-not-allowed pointer-events-none",It="opacity-100 cursor-pointer",Ft={"top-right":"-right-2 -top-2","top-left":"-left-2 -top-2","bottom-right":"-right-2 -bottom-2","bottom-left":"-left-2 -bottom-2"},Tt={primary:"bg-action-primary text-[color:var(--color-action-primary-text)]",destructive:"bg-feedback-error-border text-text-inverse"};function Et(e){return !e||e==="default"||e==="brand"?"primary":e}function Mt(e){let{variant:t="primary",size:o="md",isDisabled:r,fullWidth:n=false,isLoading:a=false}=e,l=Et(t),i=l==="unstyled"?"":`${kt} ${St[l]}`;l!=="unstyled"&&(i+=` ${Q[o].text} ${Q[o].height} ${Q[o].padding} ${Q[o].gap}`),r||a?i+=` ${Bt}`:i+=` ${It}`,n?i+=` ${Ye.full}`:i+=` ${Ye.default}`;let s=l==="primary"?"focus-visible:outline-action-primary":void 0;return [i,$e(),s].filter(Boolean).join(" ")}function V(e){let{icon:t,children:o,isLoading:r=false,loadingText:n,loadingIndicator:a,size:l="md",iconPosition:i="left",iconWeight:s,href:d,className:p,badgeNumber:c,badgeVariant:g="primary",badgePosition:v="top-right",style:b,target:C,rel:S,...w}=e,f=t?jsx(k,{name:t,size:l,weight:s}):null,y=jsxs(Fragment,{children:[i==="left"&&f,typeof o=="function"?null:o,i==="right"&&f]}),N=jsxs("div",{className:"relative inline-flex items-center justify-center",children:[jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:a||jsx(k,{name:"CircleNotch",size:l,className:"animate-spin","aria-hidden":"true"})}),jsx("div",{className:"invisible","aria-hidden":"true",children:y}),n&&jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:n})]}),h=(c??0)>0,P=twMerge(Mt(e),p),_=d?{href:d,target:C,rel:S,...w}:{};if(d){let{onPress:L,onPressStart:I,onPressEnd:ae,onPressChange:W,onPressUp:Z,onAuxClick:ie,onContextMenu:ee,onDoubleClick:A,...F}=w;Object.assign(_,F);}let B=d?jsx(Link,{..._,...r&&{"aria-busy":true},style:h?void 0:b,className:P,children:r?N:typeof o=="function"?(function(L){return jsxs(Fragment,{children:[i==="left"&&f,o(L),i==="right"&&f]})}):y}):jsx(Button,{...w,...r&&{"aria-busy":true},style:h?void 0:b,className:P,children:r?N:typeof o=="function"?(function(L){return jsxs(Fragment,{children:[i==="left"&&f,o(L),i==="right"&&f]})}):y});return h?jsxs("div",{className:twMerge("relative flex",p),style:b,children:[B,jsx("span",{className:`absolute ${Ft[v]} flex h-5 w-5 items-center justify-center rounded-full ${Tt[g]} text-xs font-medium`,"aria-label":`${c} items`,children:c})]}):B}function Se({action:e,defaultVariant:t,defaultSize:o="lg"}){let r=!!e.formId;return jsx(V,{type:r?"submit":"button",form:r?e.formId:void 0,size:e.size||o,variant:e.variant||t,onPress:r?void 0:e.onPress,isLoading:e.isLoading,isDisabled:e.isDisabled,children:e.label})}function Y({primaryAction:e,secondaryAction:t,tertiaryAction:o,footerContent:r}){let n=e||t||o;return !n&&!r?null:jsxs("div",{className:`flex w-full flex-col items-center justify-center border-t p-4 ${r?"h-28":""}`,children:[r&&jsx("div",{className:"flex h-10 justify-center",children:r}),n&&jsxs("div",{className:"flex w-full items-center justify-between gap-3",children:[jsx("div",{children:o&&jsx(Se,{action:o,defaultVariant:"destructive"})}),jsxs("div",{className:"flex items-center gap-3",children:[t&&jsx(Se,{action:t,defaultVariant:"secondary"}),e&&jsx(Se,{action:e,defaultVariant:"primary"})]})]})]})}var Ht={heading:{sm:T.headingSm,md:T.headingMd,lg:T.headingLg,xl:T.headingXl},display:{sm:T.displaySm,md:T.displayMd,lg:T.displayLg,xl:T.displayXl}},Lt={page:"h-16 leading-[62px]"};function J({tag:e="h1",variant:t="heading",size:o="lg",height:r,className:n="",children:a}){let l=o==="xs"?"sm":o,i=Ht[t][l],s=r?Lt[r]:"";return jsx(e,{className:ge(i,"text-text-primary",s,n),children:a})}var R=({title:e,onClose:t,hideCloseIcon:o=false,titleAlign:r="left",hasBackArrow:n=false,onBack:a,headerContent:l})=>jsxs("div",{className:twMerge("relative flex h-16 w-full flex-shrink-0 items-center justify-between border-b px-6",e&&"border-b",r==="center"?"justify-center":""),children:[n&&jsx(V,{variant:"icon",onPress:a,className:"absolute left-6","aria-label":"Go back",children:jsx(k,{name:"CaretLeft","data-testid":"back-arrow"})}),l||jsxs(Fragment,{children:[e&&jsx(J,{size:"xs",children:e}),t&&!o&&jsx(V,{variant:"icon",onPress:t,"aria-label":"Close dialog",children:jsx(k,{name:"X","data-testid":"close-button"})})]})]});var D=({width:e,height:t,variant:o="rect",animation:r="pulse",gradient:n=false,flex:a=false,stack:l,responsive:i,delay:s=0,adjustAnimationSpeedBasedOnWidth:d=false,ariaLabel:p,className:c,"data-testid":g})=>{let[v,b]=useState(s===0);if(useEffect(()=>{if(s>0){let h=setTimeout(()=>b(true),s);return ()=>clearTimeout(h)}},[s]),!v)return null;let C=n?"bg-gradient-to-r from-[var(--color-skeleton-base)] via-[var(--color-skeleton-highlight)] to-[var(--color-skeleton-base)]":"bg-[var(--color-skeleton-base)]",S=d&&e?(()=>{let h=typeof e=="number"?e:parseFloat(String(e));return isNaN(h)?"":`animation-duration-[${Math.max(.8,h/100)}s]`})():"",w=r==="pulse"?`animate-pulse ${S}`:r==="wave"?`relative overflow-hidden before:absolute before:inset-0 before:bg-gradient-to-r before:from-transparent before:via-[var(--color-skeleton-wave)] before:to-transparent before:animate-wave ${S}`:"",f="rounded-sm";o==="circle"&&(f="rounded-full"),o==="text"&&(f="h-4 w-full rounded-sm");let y=a?"flex-1 min-w-0":"",N=i?Object.entries(i).map(([h,P])=>`${h}:w-[${P}]`).join(" "):"";return l?jsx("div",{className:"space-y-2","data-testid":g,children:l.map((h,P)=>jsx("div",{className:twMerge(C,w,f,y,N,c),style:{width:h,height:t}},P))}):jsx("div",{className:twMerge(C,w,f,y,N,c),style:{width:e,height:t},role:"presentation","aria-hidden":!p,"aria-label":p??void 0,"data-testid":g})};var _t={outlined:"bg-background-surface border border-border-default",elevated:"bg-background-surface border-0 shadow-md",filled:"bg-background-muted border-0",ghost:"bg-transparent border-0 shadow-none"},Wt="rounded-lg",Fe={square:"aspect-square",video:"aspect-video",wide:"aspect-[2/1]",auto:""},jt={start:"justify-start",end:"justify-end",center:"justify-center",between:"justify-between"};function $({variant:e="outlined",className:t,children:o,isLoading:r=false,layout:n="default"}){return jsx("div",{className:twMerge("w-full overflow-hidden",_t[e],Wt,n==="flex"&&"flex flex-col",t),"data-testid":"card",children:r?jsx(D,{width:"100%",height:"100%",className:"rounded-none"}):o})}function qe({title:e,subtitle:t,actions:o,className:r,isLoading:n=false}){return n?jsxs("div",{className:twMerge("p-6 pb-4",r),children:[jsxs("div",{className:"flex justify-between items-start mb-1",children:[jsx(D,{width:120,height:20}),jsx(D,{width:24,height:24})]}),t&&jsx(D,{width:200,height:16})]}):!e&&!t&&!o?null:jsx("div",{className:twMerge("p-6 pb-4",r),children:jsxs("div",{className:"flex justify-between items-start gap-4",children:[jsxs("div",{className:"min-w-0 flex-1",children:[e&&jsx("div",{className:"mb-1",children:typeof e=="string"?jsx(J,{tag:"h3",size:"sm",className:"text-text-primary",children:e}):e}),t&&jsx("div",{className:Ve("bodySm","text-text-secondary"),children:t})]}),o&&jsx("div",{className:"flex-shrink-0",children:o})]})})}function Xe({src:e,alt:t,aspectRatio:o="auto",className:r,children:n,isLoading:a=false}){return a?jsx("div",{className:twMerge("bg-background-muted",Fe[o],r),children:jsx(D,{width:"100%",height:"100%"})}):n?jsx("div",{className:twMerge("overflow-hidden",Fe[o],r),children:n}):e?jsx("div",{className:twMerge("overflow-hidden",Fe[o],r),children:jsx("img",{src:e,alt:t||"",className:"w-full h-full object-cover",loading:"lazy"})}):null}function Qe({className:e,children:t,isLoading:o=false,fill:r=false}){let a=e?.match(/p(?:t|b|l|r|x|y)?-(?:\d+(?:\.\d+)?|px|\[.+?\])/)?"":"px-6 py-4";return o?jsx("div",{className:twMerge(a,r&&"flex-1 flex flex-col min-h-0",e),children:jsxs("div",{className:"space-y-2",children:[jsx(D,{width:"100%",height:16}),jsx(D,{width:"80%",height:16}),jsx(D,{width:"60%",height:16})]})}):t?jsx("div",{className:twMerge("px-6 py-4 text-text-primary",r&&"flex-1 flex flex-col min-h-0",e),children:t}):null}function Je({className:e,children:t,align:o="end",isLoading:r=false}){return r?jsxs("div",{className:twMerge("px-6 py-4 flex gap-2 justify-end",e),children:[jsx(D,{width:80,height:32}),jsx(D,{width:60,height:32})]}):t?jsx("div",{className:twMerge("px-6 py-4 flex items-center gap-2",jt[o],e),children:t}):null}$.Header=qe;$.Media=Xe;$.Content=Qe;$.Footer=Je;var M=class extends Component{constructor(){super(...arguments);Re(this,"state",{hasError:false});Re(this,"handleRetry",()=>{this.setState({hasError:false,error:void 0}),typeof window<"u"&&window.location.reload();});}static getDerivedStateFromError(o){return {hasError:true,error:o}}componentDidCatch(o,r){console.error("Error Boundary caught an error:",o,r);}render(){return this.state.hasError?this.props.fallback?this.props.fallback:jsxs($,{children:[this.props.title&&jsx($.Header,{title:this.props.title}),jsx($.Content,{children:jsxs("div",{className:"flex flex-col items-center justify-center gap-4","data-testid":"error-boundary",children:[jsx("p",{className:"text-feedback-error-text",children:this.state.error?.message||"Something went wrong"}),jsx("button",{className:"rounded bg-action-default px-4 py-2 text-[color:var(--color-action-default-text)] hover:bg-action-default-hover",onClick:this.handleRetry,children:"Retry"})]})})]}):this.props.children}};function G({transparent:e=false,className:t,children:o,...r}){return jsx(ModalOverlay,{...r,className:composeRenderProps(t,(n,a)=>twMerge("fixed inset-0 z-50","outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0 focus-visible:ring-0",e?"bg-transparent":["bg-gradient-to-br from-background-modal/20 via-background-modal/15 to-background-modal/20","backdrop-blur-[2px]","supports-[backdrop-filter]:bg-background-modal/15"].join(" "),a.isEntering&&["animate-in fade-in","duration-300 ease-out"].join(" "),a.isExiting&&["animate-out fade-out","duration-200 ease-in"].join(" "),n)),children:o})}var Kt=.3,Zt=.5;function ve({children:e,title:t,headerContent:o,titleAlign:r="left",hideCloseIcon:n=false,hasBackArrow:a=false,onBack:l,isOpen:i,onClose:s,isDismissable:d=true,transparentOverlay:p=false,primaryAction:c,secondaryAction:g,footerContent:v,maxHeight:b="80vh",height:C,maxWidth:S="640px",contentPadding:w=true,showHandle:f=true,animationVariant:y="scale",className:N}){let[h,P]=useState(false),[_,B]=useState(0),[L,I]=useState(false),ae=me(i),W=ae?.height??null,Z=ae?.keyboardOffset??0,ie=useRef(null),ee=useRef(null),A=useRef(null),F=useRef({isDragging:false,startY:0,startTime:0,pointerId:null});useEffect(()=>{if(i){let m=setTimeout(()=>{P(true),setTimeout(()=>P(false),600);},400);return ()=>clearTimeout(m)}},[i]),useEffect(()=>{i||(B(0),I(false),F.current={isDragging:false,startY:0,startTime:0,pointerId:null});},[i]),useEffect(()=>{let m=ee.current;if(!m||!i)return;let z=null,te=de=>{let X=de.target;X&&["INPUT","TEXTAREA","SELECT"].includes(X.tagName)&&(z&&clearTimeout(z),z=setTimeout(()=>{X.scrollIntoView({block:"nearest",behavior:"smooth"});},320));};return m.addEventListener("focusin",te),()=>{m.removeEventListener("focusin",te),z&&clearTimeout(z);}},[i]);let U=useCallback(m=>{d&&(m.pointerType!=="touch"&&m.pointerType!=="pen"||(A.current&&(clearTimeout(A.current),A.current=null),F.current={isDragging:true,startY:m.clientY,startTime:Date.now(),pointerId:m.pointerId},I(false),m.currentTarget.setPointerCapture(m.pointerId)));},[d]),q=useCallback(m=>{let{isDragging:z,startY:te,pointerId:de}=F.current;if(!z||m.pointerId!==de)return;let X=m.clientY-te;B(Math.max(0,X));},[]),se=useCallback(m=>{let{isDragging:z,startY:te,startTime:de,pointerId:X}=F.current;if(!z||m.pointerId!==X)return;let Ce=m.clientY-te,mt=Date.now()-de,gt=Ce/mt;F.current={isDragging:false,startY:0,startTime:0,pointerId:null};let bt=(ie.current?.getBoundingClientRect().height??0)*Kt;(Ce>bt||gt>Zt&&Ce>50)&&d?(s?.(),B(0)):(I(true),B(0),A.current=setTimeout(()=>{I(false),A.current=null;},200));},[d,s]);if(!i)return null;let Ne=t||o,le=c||g||v;return jsx(M,{children:jsx(G,{isOpen:i,onOpenChange:m=>{m||s?.();},isDismissable:d,transparent:p,style:{paddingBottom:Z>0?`${Z}px`:void 0,transition:"padding-bottom 0.25s ease-out"},className:"flex items-end justify-center p-0 sm:p-4",children:jsx(Modal,{className:"w-full max-w-full p-0 sm:p-2 outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0 focus-visible:ring-0",isDismissable:d,children:jsx("div",{ref:ie,className:twMerge("w-full",L&&"transition-transform duration-200"),style:{transform:_>0?`translateY(${_}px)`:void 0},children:jsxs(Dialog,{className:twMerge("relative flex w-full flex-col overflow-hidden","bg-background-surface","shadow-2xl shadow-black/30 dark:shadow-black/60","border-t border-x border-border-default/40","outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0 focus-visible:ring-0 focus:shadow-none","origin-bottom",y==="scale"?"animate-[tray-enter-scale_400ms_cubic-bezier(0.32,0.72,0,1)]":"animate-[tray-enter_400ms_cubic-bezier(0.32,0.72,0,1)]",y==="scale"?"data-[exiting]:animate-[tray-exit-scale_250ms_cubic-bezier(0.32,0,0.67,0)]":"data-[exiting]:animate-[tray-exit_250ms_cubic-bezier(0.32,0,0.67,0)]",N),style:{maxWidth:S,...C?{height:C}:{maxHeight:/\d/.test(b)?W!==null?`min(${b}, ${Math.max(W-8,0)}px, 100dvh)`:`min(${b}, 100dvh)`:b}},children:[f&&jsx("div",{className:"absolute top-0 left-0 right-0 h-8 z-10 flex justify-center items-start pt-2 touch-none cursor-grab active:cursor-grabbing",onPointerDown:U,onPointerMove:q,onPointerUp:se,onPointerCancel:se,children:jsx("div",{className:twMerge("h-1 w-12 rounded-full bg-border-muted transition-all duration-300","hover:bg-border-default hover:w-16",h&&"animate-[handle-wiggle_0.6s_ease-in-out]")})}),Ne&&(a?jsx(R,{title:t,headerContent:o,titleAlign:r,hideCloseIcon:n||!s,hasBackArrow:true,onBack:l??(()=>{}),onClose:s||(()=>{})}):jsx(R,{title:t,headerContent:o,titleAlign:r,hideCloseIcon:n||!s,onClose:s||(()=>{})})),jsx("div",{ref:ee,className:twMerge("flex-1 min-h-0 overflow-y-auto overscroll-contain",w?"p-4":"p-0"),children:e}),le&&jsx(Y,{primaryAction:c,secondaryAction:g,footerContent:v})]})})})})})}ve.displayName="Tray";function Le({isOpen:e,onClose:t,title:o,headerContent:r,titleAlign:n="left",hideCloseIcon:a=false,hasBackArrow:l=false,onBack:i,children:s,primaryAction:d,secondaryAction:p,tertiaryAction:c,footerContent:g,transparentOverlay:v=false,maxWidth:b="600px",minWidth:C="400px",maxHeight:S="85vh",height:w,mobileMaxHeight:f="90vh",mobileHeight:y,contentPadding:N=true,className:h}){let P=ze("(max-width: 767px)"),_=me(P&&e===void 0),B=_?.height??null,L=_?.keyboardOffset??0,I=useRef(null),ae=useCallback(()=>{I.current&&I.current.scrollTop!==0&&(I.current.scrollTop=0);},[]),W=useRef(null),Z=useRef(null);useEffect(()=>{let U=Z.current;if(!U||!P)return;let q=null,se=Ne=>{let le=Ne.target;le&&["INPUT","TEXTAREA","SELECT"].includes(le.tagName)&&(q&&clearTimeout(q),q=setTimeout(()=>{le.scrollIntoView({block:"nearest",behavior:"smooth"});},320));};return U.addEventListener("focusin",se),()=>{U.removeEventListener("focusin",se),q&&clearTimeout(q);}},[P]);let ie=useCallback(()=>{W.current&&W.current.scrollTop!==0&&(W.current.scrollTop=0);},[]);if(e===false)return null;let ee=o||r,A=d||p||c||g,F=e!==void 0;return P?F?jsx(ve,{isOpen:e,onClose:t,title:o,headerContent:r,titleAlign:n,hideCloseIcon:a,hasBackArrow:l,onBack:i,primaryAction:d,secondaryAction:p,footerContent:g,transparentOverlay:v,maxHeight:f,height:y,maxWidth:b,contentPadding:N,showHandle:true,animationVariant:"scale",className:h,children:s}):jsx(M,{children:jsx(G,{isDismissable:true,transparent:v,style:{paddingBottom:L>0?`${L}px`:void 0,transition:"padding-bottom 0.25s ease-out"},className:"flex items-end justify-center",children:jsx(Modal,{className:"w-full p-0 outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0 focus-visible:ring-0",children:jsxs(Dialog,{ref:I,onScroll:ae,className:twMerge("relative flex w-full flex-col","bg-background-surface","shadow-2xl shadow-black/20","border-t border-x border-border-default/40","rounded-t-xl","overflow-hidden","animate-in slide-in-from-bottom","duration-300 ease-out","data-[exiting]:animate-out data-[exiting]:slide-out-to-bottom","data-[exiting]:duration-200 data-[exiting]:ease-in",h),style:{...y?{height:y}:{maxHeight:/\d/.test(f)?B!==null?`min(${f}, ${Math.max(B-8,0)}px, 100dvh)`:`min(${f}, 100dvh)`:f}},children:[jsx("div",{className:"flex justify-center pt-2",children:jsx("div",{className:"h-1.5 w-12 rounded-full bg-border-muted"})}),ee&&(l?jsx(R,{title:o,headerContent:r,titleAlign:n,hideCloseIcon:a||!t,hasBackArrow:true,onBack:i,onClose:t||(()=>{})}):jsx(R,{title:o,headerContent:r,titleAlign:n,hideCloseIcon:a||!t,onClose:t||(()=>{})})),jsx("div",{ref:Z,className:twMerge("flex-1 min-h-0 overflow-y-auto overscroll-contain",N?"px-6 py-6":"p-0"),children:s}),A&&jsx(Y,{primaryAction:d,secondaryAction:p,tertiaryAction:c,footerContent:g})]})})})}):jsx(M,{children:jsx(G,{...F?{isOpen:e,onOpenChange:U=>{!U&&t&&t();}}:{},isDismissable:true,transparent:v,className:"flex items-center justify-center",children:jsx(Modal,{className:"w-full p-4 outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0 focus-visible:ring-0",style:{maxWidth:b},children:jsxs(Dialog,{ref:W,onScroll:ie,className:twMerge("relative flex w-full flex-col","bg-background-surface","shadow-2xl shadow-black/20","border border-border-default/50","rounded-md","overflow-hidden","outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0","animate-in fade-in zoom-in-96 slide-in-from-bottom-2","duration-300 ease-out","data-[exiting]:animate-out data-[exiting]:fade-out data-[exiting]:zoom-out-95","data-[exiting]:duration-200 data-[exiting]:ease-in",h),style:{minWidth:C,...w?{height:w}:{maxHeight:S}},children:[ee&&(l?jsx(R,{title:o,headerContent:r,titleAlign:n,hideCloseIcon:a||!t,hasBackArrow:true,onBack:i,onClose:t||(()=>{})}):jsx(R,{title:o,headerContent:r,titleAlign:n,hideCloseIcon:a||!t,onClose:t||(()=>{})})),jsx("div",{className:twMerge("flex-1 min-h-0 overflow-y-auto",N?"px-6 py-6":"p-0"),children:s}),A&&jsx(Y,{primaryAction:d,secondaryAction:p,tertiaryAction:c,footerContent:g})]})})})})}function pe(e){return jsx(Form,{validationBehavior:"aria",...e,className:twMerge("flex flex-col gap-6",e.className)})}function Hn({formId:e="dialog-form",onSubmit:t,primaryLabel:o="Save",secondaryLabel:r="Cancel",onCancel:n,primaryVariant:a,secondaryVariant:l="secondary",children:i,title:s,...d}){return jsx(Le,{title:s,primaryAction:{label:o,onPress:()=>{let c=document.getElementById(e);c&&c.requestSubmit();},variant:a},secondaryAction:n?{label:r,onPress:n,variant:l}:void 0,...d,children:jsx(pe,{id:e,onSubmit:t,children:i})})}function Pe({children:e,title:t,headerContent:o,titleAlign:r="left",hideCloseIcon:n=false,hasBackArrow:a=false,onBack:l,isOpen:i,slideInFrom:s="right",transparentOverlay:d=false,onClose:p,className:c,primaryAction:g,secondaryAction:v,tertiaryAction:b,footerContent:C,contentPadding:S=true,maxWidth:w="400px"}){if(!i)return null;let f=t||o,y=g||v||b||C;return jsx(M,{children:jsx(G,{isOpen:i,onOpenChange:N=>!N&&p?.(),isDismissable:true,transparent:d,children:jsx(Modal,{className:"outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0 focus-visible:ring-0",children:jsxs(Dialog,{className:twMerge("fixed top-0 bottom-0 flex flex-col bg-background-surface shadow-xl overflow-hidden",s==="right"?"right-0":"left-0",s==="right"?"animate-in slide-in-from-right duration-300 ease-out":"animate-in slide-in-from-left duration-300 ease-out","data-[exiting]:animate-out",s==="right"?"data-[exiting]:slide-out-to-right":"data-[exiting]:slide-out-to-left","data-[exiting]:duration-200 data-[exiting]:ease-in","outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-action-default focus-visible:outline-offset-0",c),style:{maxWidth:w,width:"100%"},children:[f&&(a&&l?jsx(R,{title:t,headerContent:o,titleAlign:r,hideCloseIcon:n,hasBackArrow:true,onBack:l,onClose:p}):jsx(R,{title:t,headerContent:o,titleAlign:r,hideCloseIcon:n,onClose:p})),jsx("div",{className:twMerge("flex-1 overflow-y-auto overscroll-contain",S?"px-6 py-6":"p-0"),children:e}),y&&jsx(Y,{primaryAction:g,secondaryAction:v,tertiaryAction:b,footerContent:C})]})})})})}Pe.displayName="Drawer";function Qn({formId:e="drawer-form",onSubmit:t,primaryLabel:o="Save",secondaryLabel:r="Cancel",onCancel:n,primaryVariant:a,secondaryVariant:l="secondary",children:i,...s}){return jsx(Pe,{primaryAction:{label:o,onPress:()=>{let p=document.getElementById(e);p&&p.requestSubmit();},variant:a},secondaryAction:n?{label:r,onPress:n,variant:l}:void 0,...s,children:jsx(pe,{id:e,onSubmit:t,className:"mt-2",children:i})})}function ea({align:e="end",className:t,...o}){return jsx("div",{...o,className:twMerge("flex gap-2",e==="start"?"justify-start":e==="between"?"justify-between":"justify-end",t)})}var po={sm:"gap-2",md:"gap-4",lg:"gap-6"};function fo(e){if(!e)return "";let t=e.base?`grid-cols-${e.base}`:"",o=e.md?`md:grid-cols-${e.md}`:"",r=e.lg?`lg:grid-cols-${e.lg}`:"";return [t,o,r].filter(Boolean).join(" ")}function na({cols:e={base:1},gap:t="lg",className:o,...r}){return jsx("div",{...r,className:twMerge("grid",fo(e),po[t],o)})}var bo=go__default.forwardRef(({children:e,className:t},o)=>jsx("div",{ref:o,className:twMerge("relative w-full",t),children:e}));bo.displayName="InputWrapper";function st({size:e="md",className:t,children:o,...r}){return jsx("div",{...r,className:twMerge("leading-[2.25] text-text-secondary",Q[e].text,t),children:o})}function ba({title:e,description:t,showDivider:o,className:r,children:n,...a}){return jsxs("section",{...a,className:twMerge("flex flex-col",r),children:[(e||t)&&jsxs("div",{className:"flex flex-col gap-1 mb-6",children:[typeof e=="string"?jsx(J,{tag:"h3",size:"sm",children:e}):e,t?jsx(st,{size:"lg",children:t}):null]}),jsx("div",{className:"flex flex-col gap-6",children:n}),o&&jsx("hr",{className:"mt-2 border-border-muted"})]})}function ha(){return jsx("hr",{className:"border-border-muted"})}function wa({steps:e,currentStepId:t,onStepClick:o,className:r}){let n=e.findIndex(a=>a.id===t);return jsx("nav",{"aria-label":"Progress",className:twMerge("w-full",r),children:jsx("div",{className:"relative mb-12",children:jsx("ol",{className:"relative flex items-start justify-between",children:e.map((a,l)=>{let i=a.id===t,s=l<n,d=o&&(s||i);return jsxs("li",{className:"relative flex flex-col items-center",style:{flex:`1 1 ${100/e.length}%`},children:[jsx("button",{type:"button",disabled:!d,onClick:()=>d&&o?.(a.id),className:twMerge("relative z-10 flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-full border-2 transition-colors bg-background-body",s&&"border-action-primary bg-action-primary text-text-inverse hover:bg-action-primary/90",i&&"border-action-primary bg-background-body text-action-primary",!s&&!i&&"border-border-default bg-background-body text-text-secondary",d&&"cursor-pointer",!d&&"cursor-default"),"aria-current":i?"step":void 0,children:s?jsx(k,{name:"Check",size:20,weight:"bold"}):jsx("span",{className:"text-sm font-semibold",children:l+1})}),l<e.length-1&&jsx("div",{className:"absolute top-5 h-0.5 transition-colors",style:{left:"50%",width:"100%",marginLeft:"20px",backgroundColor:l<n?"var(--color-action-primary)":"var(--color-border-default)"}}),jsxs("div",{className:"mt-3 flex flex-col items-center text-center w-32",children:[jsx("span",{className:twMerge("text-sm font-medium",i&&"text-text-default",s&&"text-text-primary",!i&&!s&&"text-text-secondary"),children:a.title}),a.description&&jsx("span",{className:"mt-1 text-xs text-text-secondary",children:a.description})]})]},a.id)})})})})}function Da({formId:e,show:t,isSubmitting:o,onCancel:r,primaryLabel:n="Save changes",secondaryLabel:a="Cancel",className:l}){return t?jsx("div",{className:twMerge("fixed inset-x-0 bottom-0 z-40 border-t border-border-muted bg-background-surface/95 backdrop-blur supports-[backdrop-filter]:bg-background-surface/70",l),children:jsxs("div",{className:"mx-auto flex max-w-screen-lg items-center justify-between gap-3 p-3",children:[jsx("div",{className:"text-sm text-text-secondary",children:"You have unsaved changes"}),jsxs("div",{className:"flex gap-2",children:[jsx(V,{variant:"secondary",onPress:r,children:a}),jsx(V,{type:"submit",form:e,isDisabled:!!o,children:o?"Saving...":n})]})]})}):null}function Ia({when:e,message:t="You have unsaved changes. Leave anyway?"}){return go.useEffect(()=>{if(!e)return;let o=r=>(r.preventDefault(),r.returnValue=t,t);return window.addEventListener("beforeunload",o),()=>window.removeEventListener("beforeunload",o)},[e,t]),null}function Ta({steps:e,initialStepId:t,canNavigate:o}){if(e.length===0)throw new Error("useWizard: steps array cannot be empty");let[r,n]=go.useState(t||e[0].id),a=e.findIndex(c=>c.id===r),l=a>0,i=a<e.length-1,s=async c=>c===r?true:o&&!await o(r,c)?false:(n(c),true);return {steps:e,currentStepId:r,setCurrentStepId:s,next:async()=>!i||a===-1?false:s(e[a+1].id),prev:async()=>!l||a===-1?false:s(e[a-1].id),hasNext:i,hasPrev:l,stepIndex:a}}export{Hn as DialogForm,Qn as DrawerForm,ea as FormActions,ha as FormDivider,na as FormGrid,ba as FormSection,wa as FormStepper,Da as SaveBar,Ia as UnsavedChangesPrompt,Ta as useWizard};//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|