@frigade/react 2.1.21 → 2.1.22

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/index.cjs CHANGED
@@ -74,7 +74,7 @@ var fo=Object.defineProperty,Ht=Object.defineProperties;var Mt=Object.getOwnProp
74
74
  height: 0;
75
75
  opacity: 0;
76
76
  }
77
- `,fn=()=>jsxRuntime.jsx(x,{as:"svg",color:"primary.foreground",width:"10px",height:"8px",viewBox:"0 0 10 8",fill:"none",children:jsxRuntime.jsx("path",{d:"M1 4.34664L3.4618 6.99729L3.4459 6.98017L9 1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})});function gn({checked:e=!1}){return jsxRuntime.jsx(x,{backgroundColor:"inherit",borderWidth:"md",borderStyle:"solid",borderColor:"neutral.border",borderRadius:"100%",padding:"0",part:"field-radio-value",position:"relative",height:"22px",width:"22px",children:e&&jsxRuntime.jsx(x,{alignItems:"center",bg:"green500",borderWidth:"md",borderStyle:"solid",borderColor:"green500",borderRadius:"100%",display:"flex",height:"calc(100% + 2px)",justifyContent:"center",left:"-1px",part:"field-radio-indicator",position:"absolute",top:"-1px",width:"calc(100% + 2px)",children:jsxRuntime.jsx(fn,{})})})}function Ye({children:e}){return jsxRuntime.jsx(fe__namespace.Content,{asChild:!0,children:jsxRuntime.jsxs(S.Column,{css:{'&[data-state="open"]':{animation:`${un} 300ms ease-out`},'&[data-state="closed"]':{animation:`${mn} 300ms ease-out`},overflow:"hidden"},gap:5,children:[jsxRuntime.jsx(x,{}),e]})})}function Qe(a){var s=a,{children:e,disabled:o=!1,onOpenChange:t=()=>{},open:n=!1}=s,r=m(s,["children","disabled","onOpenChange","open"]);return jsxRuntime.jsx(fe__namespace.Root,{asChild:!0,disabled:o,open:n,onOpenChange:t,children:jsxRuntime.jsx(P,p(i({borderWidth:"md",css:{'&[data-state="open"] .fr-collapsible-step-icon':{transform:"rotate(180deg)"}},gap:0},r),{children:e}))})}function Ze({isCompleted:e,title:o}){return jsxRuntime.jsx(fe__namespace.Trigger,{asChild:!0,children:jsxRuntime.jsxs(S.Row,{alignItems:"center",justifyContent:"space-between",margin:-5,padding:5,zIndex:1,children:[jsxRuntime.jsxs(S.Row,{alignItems:"center",gap:2,children:[jsxRuntime.jsx(gn,{checked:e}),jsxRuntime.jsx(F.Body2,{fontWeight:"demibold",userSelect:"none",children:o})]}),jsxRuntime.jsx(x,{as:outline.ChevronDownIcon,color:"neutral100",css:{"& path":{vectorEffect:"non-scaling-stroke"}},display:"block",height:"16px",order:2,part:"collapsible-step-icon",width:"16px"})]})})}var Me={};Q(Me,{Bar:()=>He,Dots:()=>nt,Segments:()=>at});function He(n){var r=n,{current:e,total:o}=r,t=m(r,["current","total"]);let a=o>0?Math.min(e/o,1):0,s=a===0?"10px":`${100*a}%`;return jsxRuntime.jsx(x,p(i({part:"progress-bar",backgroundColor:"blue800",borderRadius:"md",height:"10px"},t),{children:jsxRuntime.jsx(x,{backgroundColor:"primary.surface",part:"progress-bar-fill",borderRadius:"md",height:"100%",style:{width:s},transition:"width 300ms ease-out"})}))}function nt(n){var r=n,{current:e,total:o}=r,t=m(r,["current","total"]);if(o==1)return null;let a=[...Array(o)].map((s,d)=>jsxRuntime.jsx(x,{as:"circle",r:4,cx:4+16*d,cy:"4px",fill:e-1===d?w.colors.blue500:w.colors.blue800},d));return jsxRuntime.jsx(x,p(i({as:"svg",height:"8px",part:"progress-dots",viewBox:`0 0 ${16*o-8} 8`,width:16*o-8},t),{children:a}))}function at(n){var r=n,{current:e,total:o}=r,t=m(r,["current","total"]);let a=[...Array(o)].map((s,d)=>jsxRuntime.jsx(x,{backgroundColor:e-1===d?"primary.surface":"blue800",borderRadius:"md",flexGrow:1,height:"100%"},d));return jsxRuntime.jsx(S.Row,p(i({gap:1,height:"10px",part:"progress-segments"},t),{children:a}))}var st=Ue.createContext({onPrimary:()=>{},onSecondary:()=>{},openStepId:null,setOpenStepId:()=>{},stepTypes:{}});function lt({handlePrimary:e,handleSecondary:o,open:t,onOpenChange:n,step:r}){var C,b,y,v,k,R;let{$state:{blocked:a,completed:s},subtitle:d,title:c}=r,u=(b=(C=r.primaryButton)==null?void 0:C.title)!=null?b:r.primaryButtonTitle,g=(v=(y=r.secondaryButton)==null?void 0:y.title)!=null?v:r.secondaryButtonTitle,h=(k=r.props)!=null?k:{},f=!!(s||a);return jsxRuntime.jsxs(Qe,p(i({open:t,onOpenChange:n},h),{children:[jsxRuntime.jsx(Ze,{isCompleted:s,title:c}),jsxRuntime.jsxs(Ye,{children:[jsxRuntime.jsx(P.Media,{aspectRatio:2.5,objectFit:"cover",src:(R=r.videoUri)!=null?R:r.imageUri,type:r.videoUri?"video":"image"}),jsxRuntime.jsx(P.Subtitle,{color:"neutral400",children:d}),jsxRuntime.jsxs(S.Row,{gap:3,children:[jsxRuntime.jsx(P.Secondary,{disabled:f,title:g,onClick:o}),jsxRuntime.jsx(P.Primary,{disabled:f,title:u,onClick:e})]})]})]}))}var hn={default:lt};function Pn(n){var r=n,{flow:e,step:o}=r,t=m(r,["flow","step"]);var y;let{onPrimary:a,onSecondary:s,openStepId:d,setOpenStepId:c,stepTypes:u}=Ue.useContext(st),{handlePrimary:g,handleSecondary:h}=le(o,{onPrimary:a,onSecondary:s}),f=(d!=null?d:e.getCurrentStep().id)===o.id,C=(y=u[o.type])!=null?y:lt;function b(v){return A(this,null,function*(){c(v?o.id:""),v&&!o.$state.completed&&(yield o.start(),c(null));})}return jsxRuntime.jsx(C,p(i({flow:e,onOpenChange:b,open:f,step:o},t),{handlePrimary:g,handleSecondary:h}),o.id)}function pt(d){var c=d,{dismissible:e,flowId:o,onPrimary:t,onSecondary:n,part:r,stepTypes:a={}}=c,s=m(c,["dismissible","flowId","onPrimary","onSecondary","part","stepTypes"]);let[u,g]=Ue.useState(null),h=i(i({},hn),a);return jsxRuntime.jsx(st.Provider,{value:{openStepId:u,setOpenStepId:g,onPrimary:t,onSecondary:n,stepTypes:h},children:jsxRuntime.jsx(J,p(i({as:P,borderWidth:"md",flowId:o,part:["checklist",r]},s),{children:y=>{var v=y,{flow:f,handleDismiss:C}=v,b=m(v,["flow","handleDismiss"]);let R=Array.from(f.steps.entries()).filter(([,B])=>B.$state.visible===!0).map(([,B])=>jsxRuntime.jsx(Pn,p(i({flow:f,handleDismiss:C},b),{step:B}),B.id)),H=f.getNumberOfCompletedSteps(),T=f.getNumberOfAvailableSteps();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(S.Column,{gap:2,children:[jsxRuntime.jsx(P.Header,{dismissible:e,handleDismiss:C,part:"checklist-header",subtitle:f.subtitle,title:f.title}),jsxRuntime.jsxs(S.Row,{alignItems:"center",gap:2,children:[jsxRuntime.jsxs(F.Body2,{fontWeight:"demibold",children:[H,"/",T]}),jsxRuntime.jsx(He,{current:H,total:T,flexGrow:1})]})]}),R]})}}))})}var Rn=new Set(["required","min","max","minLength","maxLength","pattern"]);function kn({fieldComponent:e,control:o,fieldData:t,submit:n}){let r=reactHookForm.useFormContext();t.pattern!=null&&(typeof t.pattern=="string"?t.pattern=new RegExp(t.pattern.replace(/^\/|\/$/g,"")):typeof t.pattern=="object"&&typeof t.pattern.value=="string"&&(t.pattern.value=new RegExp(t.pattern.value.replace(/^\/|\/$/g,""))));let a=Object.fromEntries(Object.entries(t).filter(([d])=>Rn.has(d))),s=reactHookForm.useController({name:t.id,control:o,rules:a});return jsxRuntime.jsx(e,p(i({},s),{fieldData:t,formContext:r,submit:n}))}function ct({fieldTypes:e,handleDismiss:o,handlePrimary:t,handleSecondary:n,parentProps:{dismissible:r},step:a}){var R,H,T,B,L,E;let{__readOnly:s}=Ue.useContext(O),d=reactHookForm.useForm({delayError:2e3,mode:"onChange"}),[c,u]=Ue.useState(!1),g=[],{control:h,handleSubmit:f}=d,C=(R=a.props)!=null?R:{};function b(j,xe){u(!0),t(xe,j,s===!0).then(()=>u(!1));}(H=a.fields)==null||H.forEach(j=>{e[j.type]!=null&&g.push(jsxRuntime.jsx(kn,{control:h,fieldComponent:e[j.type],fieldData:j,submit:f(b)},`${a.flow.id}-${j.id}`));});let y=(B=(T=a.primaryButton)==null?void 0:T.title)!=null?B:a.primaryButtonTitle,v=(E=(L=a.secondaryButton)==null?void 0:L.title)!=null?E:a.secondaryButtonTitle,k=!!(a.$state.completed||a.$state.blocked);return jsxRuntime.jsxs(S.Column,p(i({gap:5,part:"form-step"},C),{children:[jsxRuntime.jsx(P.Header,{dismissible:r,handleDismiss:o,part:"form-step-header",subtitle:a.subtitle,title:a.title}),jsxRuntime.jsx(reactHookForm.FormProvider,p(i({},d),{children:g})),jsxRuntime.jsxs(S.Row,{part:"form-step-footer",justifyContent:"flex-end",gap:3,children:[v&&jsxRuntime.jsx(D.Secondary,{disabled:k,onClick:n,title:v}),jsxRuntime.jsx(D.Primary,{disabled:k||c,onClick:f(b),title:y!=null?y:"Submit",loading:c})]},"form-footer")]}))}function ut({error:e}){var o;return (o=e==null?void 0:e.message)!=null&&o.length?jsxRuntime.jsx(F.Caption,{color:"red500",display:"block",part:"field-error",mt:"1",textAlign:"end",children:e==null?void 0:e.message}):null}function oo({children:e,id:o,required:t=!1}){return jsxRuntime.jsxs(F.Body2,{as:"label",htmlFor:o,part:"field-label",fontWeight:"medium",mb:"2",display:"block",children:[e,t&&"*"]})}var we={px:"4",py:"2",backgroundColor:"neutral.background",borderColor:"neutral.border",borderStyle:"solid",borderWidth:"md",borderRadius:"md",display:"block",outline:"none",width:"100%"};function te({children:e,field:o,fieldData:t,fieldState:n}){var u;let{id:r,label:a,placeholder:s}=t,{error:d}=n,c=p(i(i(i({id:r},o),s?{placeholder:s}:{}),we),{"aria-invalid":!!d,value:(u=o.value)!=null?u:""});return jsxRuntime.jsxs(x,{part:"field",children:[jsxRuntime.jsx(oo,{id:r,required:!!t.required,children:a}),e(c),jsxRuntime.jsx(ut,{error:d})]})}var In=()=>jsxRuntime.jsx(x,{as:"svg",color:"primary.foreground",width:"10px",height:"8px",viewBox:"0 0 10 8",fill:"none",children:jsxRuntime.jsx("path",{d:"M1 4.34664L3.4618 6.99729L3.4459 6.98017L9 1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),Hn=Ue__namespace.forwardRef(({label:e,value:o},t)=>jsxRuntime.jsxs(x,{as:"label",backgroundColor:"neutral.background",borderColor:"neutral.border",borderRadius:"md",borderStyle:"solid",borderWidth:"md",display:"flex",htmlFor:o,justifyContent:"space-between",part:"field-radio",px:4,py:2,children:[jsxRuntime.jsx(F.Body2,{part:"field-radio-label",children:e}),jsxRuntime.jsx(ye__namespace.Item,{id:o,value:o,ref:t,asChild:!0,children:jsxRuntime.jsx(x,{as:"button",backgroundColor:"inherit",borderWidth:"md",borderStyle:"solid",borderColor:"neutral.border",borderRadius:"100%",padding:"0",part:"field-radio-value",position:"relative",height:"24px",width:"24px",children:jsxRuntime.jsx(x,{as:ye__namespace.Indicator,alignItems:"center",bg:"primary.surface",borderWidth:"md",borderStyle:"solid",borderColor:"primary.border",borderRadius:"100%",display:"flex",height:"calc(100% + 2px)",justifyContent:"center",left:"-1px",part:"field-radio-indicator",position:"absolute",top:"-1px",width:"calc(100% + 2px)",children:jsxRuntime.jsx(In,{})})})})]}));function to(e){let{field:{onChange:o,value:t},fieldData:{options:n=[]}}=e,r=n.map(({label:a,value:s})=>jsxRuntime.jsx(Hn,{value:s,label:a},s));return jsxRuntime.jsx(te,p(i({},e),{children:()=>jsxRuntime.jsx(ye__namespace.Root,{value:t,onValueChange:o,asChild:!0,children:jsxRuntime.jsx(S.Column,{gap:2,part:"field-radio-group",children:r})})}))}var An=Ue__namespace.forwardRef(({label:e,value:o},t)=>jsxRuntime.jsx(V__namespace.Item,{value:o,ref:t,asChild:!0,children:jsxRuntime.jsx(x,{"backgroundColor:hover":"blue900",borderRadius:"md",outline:"none",part:"field-select-option",px:"3",py:"2",children:jsxRuntime.jsx(V__namespace.ItemText,{asChild:!0,children:jsxRuntime.jsx(F.Body2,{part:"field-select-option-label",children:e})})})}));function ro(e){let{field:{onChange:o,value:t},fieldData:{options:n=[],placeholder:r}}=e,a=n.map(({label:s,value:d})=>jsxRuntime.jsx(An,{value:d,label:s},d));return jsxRuntime.jsx(te,p(i({},e),{children:()=>jsxRuntime.jsxs(V__namespace.Root,{value:t,onValueChange:o,children:[jsxRuntime.jsx(V__namespace.Trigger,{asChild:!0,children:jsxRuntime.jsxs(F.Body2,p(i({},we),{alignItems:"center",display:"flex",justifyContent:"space-between",part:"field-select",children:[jsxRuntime.jsx(V__namespace.Value,{placeholder:r!=null?r:"Select one"}),jsxRuntime.jsx(V__namespace.Icon,{children:jsxRuntime.jsx(x,{as:outline.ChevronDownIcon,color:"neutral100",display:"block",height:"24px",part:"field-select-icon",width:"24px"})})]}))}),jsxRuntime.jsx(V__namespace.Content,{position:"popper",sideOffset:4,asChild:!0,children:jsxRuntime.jsx(x,p(i({},we),{boxShadow:"md",maxHeight:"var(--radix-select-content-available-height)",p:"1",part:"field-select-options",width:"var(--radix-popper-anchor-width)",zIndex:"99999",children:jsxRuntime.jsx(V__namespace.Viewport,{children:a})}))})]})}))}function no(e){return jsxRuntime.jsx(te,p(i({},e),{children:o=>jsxRuntime.jsx(F.Body2,i({as:"input",part:"field-text",type:"text"},o))}))}function Pt(e){return jsxRuntime.jsx(te,p(i({},e),{children:o=>jsxRuntime.jsx(F.Body2,i({as:"textarea",part:"field-textarea"},o))}))}var $n={radio:to,select:ro,text:no,textarea:Pt};function io(r){var a=r,{fieldTypes:e={},flowId:o,part:t}=a,n=m(a,["fieldTypes","flowId","part"]);let s=Object.assign({},$n,e);return jsxRuntime.jsx(J,p(i({flowId:o,part:["form",t]},n),{children:d=>jsxRuntime.jsx(ct,i({fieldTypes:s},d))}))}var ao={};Q(ao,{NPS:()=>Tt});function Ft({field:e,submit:o}){let t=[...Array(11)].map((n,r)=>{let a=e.value===r?D.Primary:D.Secondary;return jsxRuntime.jsx(a,{borderWidth:"1px",onClick:()=>{e.onChange(r),o();},title:`${r}`,css:{".fr-button-title":{fontSize:"15px"}}},r)});return jsxRuntime.jsxs(S.Column,{gap:2,children:[jsxRuntime.jsx(S.Row,{gap:2,part:"field-nps",css:{"@media (min-width: 660px)":{flexWrap:"nowrap",justifyContent:"space-between"},flexWrap:"wrap",justifyContent:"center"},children:t}),jsxRuntime.jsxs(S.Row,{justifyContent:"space-between",part:"field-nps-label",children:[jsxRuntime.jsx(F.Caption,{part:"field-nps-left-label",color:"neutral600",children:"Not likely at all"}),jsxRuntime.jsx(F.Caption,{part:"field-nps-right-label",color:"neutral600",children:"Extremely likely"})]})]})}function Tt(a){var s=a,{as:e=I,flowId:o,fieldTypes:t,part:n}=s,r=m(s,["as","flowId","fieldTypes","part"]);let{flow:d}=ae(o);return jsxRuntime.jsx(io,i({alignSelf:"end",as:e,flowId:o,fieldTypes:i({nps:Ft},t),modal:!1,onEscapeKeyDown:c=>{typeof r.onEscapeKeyDown=="function"&&r.onEscapeKeyDown(c),c.defaultPrevented||d.skip();},part:["nps",n],css:p(i({},!d||d.getCurrentStepIndex()==0?{".fr-form-step-footer":{display:"none"}}:{}),{".fr-form":{padding:"20px","@media (min-width: 660px)":{minWidth:"520px"},minWidth:"100%"},".fr-form-step":{gap:"14px","@media (min-width: 660px)":{gap:"1"}}})},r))}function Ae(){let e="DOMRect"in globalThis?new DOMRect:{height:0,width:0,x:0,y:0,bottom:0,top:0,right:0,left:0,toJSON:()=>{}},[o,t]=Ue.useState(e),[n,r]=Ue.useState(null),a=Ue.useCallback(s=>{r(s);},[]);return Ue.useLayoutEffect(()=>{if(!n)return;let s=()=>{let d=n.getBoundingClientRect();t(d);};return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s)},[n]),{node:n,rect:o,ref:a}}var Nn=react.keyframes({"0%":{opacity:.5,transform:"scale(0.5)"},"50%":{opacity:0,transform:"scale(1)"},"100%":{opacity:0,transform:"scale(1)"}});function Bt(n){var r=n,{style:e={},part:o=""}=r,t=m(r,["style","part"]);return jsxRuntime.jsxs(x,p(i({part:`dot-wrapper ${o}`,style:i({height:"48px",position:"absolute",width:"48px"},e)},t),{children:[jsxRuntime.jsx(x,{backgroundColor:"primary.surface",part:"dot-pulse",css:{animation:`2s ease-out infinite ${Nn}`,borderRadius:"24px",height:"48px",left:0,position:"absolute",top:0,transformOrigin:"center center",width:"48px"}}),jsxRuntime.jsx(x,{backgroundColor:"primary.surface",part:"dot",style:{borderRadius:"12px",height:"24px",left:"12px",position:"absolute",top:"12px",width:"24px"}})]}))}function Rt({props:e,alignAttr:o,sideAttr:t}){let n=t!=null?t:"bottom",r={},a=()=>{var u;if(["after","before"].includes(e.align)){if(o=="start")return "before";if(o=="end")return "after"}return (u=e.align)!=null?u:"after"},s="-24px",d={top:"bottom",right:"left",bottom:"top",left:"right"};r[d[n]]=s;let c=a();return ["before","end"].includes(c)?["top","bottom"].includes(n)?r.right=s:r.bottom=s:["after","start"].includes(c)?["top","bottom"].includes(n)?r.left=s:r.top=s:["top","bottom"].includes(n)?r.left=`calc(50% + ${s})`:r.top=`calc(50% + ${s})`,r}var $e={content:["align","alignOffset","arrowPadding","avoidCollisions","collisionBoundary","collisionPadding","forceMount","hideWhenDetached","onCloseAutoFocus","onEscapeKeyDown","onFocusOutside","onInteractOutside","onOpenAutoFocus","onPointerDownOutside","side","sideOffset","sticky"],root:["defaultOpen","modal","onOpenChange","open"]};function kt(e,o){var a,s,d,c,u;let t=Object.fromEntries($e.content.map(g=>[g,e[g]]).filter(g=>g[1]!==void 0)),n=Object.fromEntries($e.root.map(g=>[g,e[g]]).filter(g=>g[1]!==void 0)),r={};for(let g of Object.keys(e))!$e.content.includes(g)&&!$e.root.includes(g)&&(r[g]=e[g]);if(t.align=(a=t.align)!=null?a:"after",t.side=(s=t.side)!=null?s:"bottom",["before","after"].includes(t.align)){let g={after:"end",before:"start"},h=(k,R)=>["top","bottom"].includes(R)?k=="after"?"marginLeft":"marginRight":k=="after"?"marginTop":"marginBottom",f=(d=t.alignOffset)!=null?d:0,C=(c=t.style)!=null?c:{},b=(u=t.side)!=null?u:"bottom",y=t.align;t.style=p(i({},C),{[h(y,b)]:f});let v=["top","bottom"].includes(b)?o.width:o.height;t.alignOffset=(v+f)*-1,t.align=g[y];}return {contentProps:t,otherProps:r,rootProps:n}}var Dt=react.keyframes`
77
+ `,fn=()=>jsxRuntime.jsx(x,{as:"svg",color:"primary.foreground",width:"10px",height:"8px",viewBox:"0 0 10 8",fill:"none",children:jsxRuntime.jsx("path",{d:"M1 4.34664L3.4618 6.99729L3.4459 6.98017L9 1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})});function gn({checked:e=!1}){return jsxRuntime.jsx(x,{backgroundColor:"inherit",borderWidth:"md",borderStyle:"solid",borderColor:"neutral.border",borderRadius:"100%",padding:"0",part:"field-radio-value",position:"relative",height:"22px",width:"22px",children:e&&jsxRuntime.jsx(x,{alignItems:"center",bg:"green500",borderWidth:"md",borderStyle:"solid",borderColor:"green500",borderRadius:"100%",display:"flex",height:"calc(100% + 2px)",justifyContent:"center",left:"-1px",part:"field-radio-indicator",position:"absolute",top:"-1px",width:"calc(100% + 2px)",children:jsxRuntime.jsx(fn,{})})})}function Ye({children:e}){return jsxRuntime.jsx(fe__namespace.Content,{asChild:!0,children:jsxRuntime.jsxs(S.Column,{css:{'&[data-state="open"]':{animation:`${un} 300ms ease-out`},'&[data-state="closed"]':{animation:`${mn} 300ms ease-out`},overflow:"hidden"},gap:5,children:[jsxRuntime.jsx(x,{}),e]})})}function Qe(a){var s=a,{children:e,disabled:o=!1,onOpenChange:t=()=>{},open:n=!1}=s,r=m(s,["children","disabled","onOpenChange","open"]);return jsxRuntime.jsx(fe__namespace.Root,{asChild:!0,disabled:o,open:n,onOpenChange:t,children:jsxRuntime.jsx(P,p(i({borderWidth:"md",css:{'&[data-state="open"] .fr-collapsible-step-icon':{transform:"rotate(180deg)"}},gap:0},r),{children:e}))})}function Ze({isCompleted:e,title:o}){return jsxRuntime.jsx(fe__namespace.Trigger,{asChild:!0,children:jsxRuntime.jsxs(S.Row,{alignItems:"center",justifyContent:"space-between",margin:-5,padding:5,zIndex:1,children:[jsxRuntime.jsxs(S.Row,{alignItems:"center",gap:2,children:[jsxRuntime.jsx(gn,{checked:e}),jsxRuntime.jsx(F.Body2,{fontWeight:"demibold",userSelect:"none",children:o})]}),jsxRuntime.jsx(x,{as:outline.ChevronDownIcon,color:"neutral100",css:{"& path":{vectorEffect:"non-scaling-stroke"}},display:"block",height:"16px",order:2,part:"collapsible-step-icon",width:"16px"})]})})}var Me={};Q(Me,{Bar:()=>He,Dots:()=>nt,Segments:()=>at});function He(n){var r=n,{current:e,total:o}=r,t=m(r,["current","total"]);let a=o>0?Math.min(e/o,1):0,s=a===0?"10px":`${100*a}%`;return jsxRuntime.jsx(x,p(i({part:"progress-bar",backgroundColor:"blue800",borderRadius:"md",height:"10px"},t),{children:jsxRuntime.jsx(x,{backgroundColor:"primary.surface",part:"progress-bar-fill",borderRadius:"md",height:"100%",style:{width:s},transition:"width 300ms ease-out"})}))}function nt(n){var r=n,{current:e,total:o}=r,t=m(r,["current","total"]);if(o==1)return null;let a=[...Array(o)].map((s,d)=>jsxRuntime.jsx(x,{as:"circle",r:4,cx:4+16*d,cy:"4px",fill:e-1===d?w.colors.blue500:w.colors.blue800},d));return jsxRuntime.jsx(x,p(i({as:"svg",height:"8px",part:"progress-dots",viewBox:`0 0 ${16*o-8} 8`,width:16*o-8},t),{children:a}))}function at(n){var r=n,{current:e,total:o}=r,t=m(r,["current","total"]);let a=[...Array(o)].map((s,d)=>jsxRuntime.jsx(x,{backgroundColor:e-1===d?"primary.surface":"blue800",borderRadius:"md",flexGrow:1,height:"100%"},d));return jsxRuntime.jsx(S.Row,p(i({gap:1,height:"10px",part:"progress-segments"},t),{children:a}))}var st=Ue.createContext({onPrimary:()=>{},onSecondary:()=>{},openStepId:null,setOpenStepId:()=>{},stepTypes:{}});function lt({handlePrimary:e,handleSecondary:o,open:t,onOpenChange:n,step:r}){var C,b,y,v,k,R;let{$state:{blocked:a,completed:s},subtitle:d,title:c}=r,u=(b=(C=r.primaryButton)==null?void 0:C.title)!=null?b:r.primaryButtonTitle,g=(v=(y=r.secondaryButton)==null?void 0:y.title)!=null?v:r.secondaryButtonTitle,h=(k=r.props)!=null?k:{},f=!!(s||a);return jsxRuntime.jsxs(Qe,p(i({open:t,onOpenChange:n},h),{children:[jsxRuntime.jsx(Ze,{isCompleted:s,title:c}),jsxRuntime.jsxs(Ye,{children:[jsxRuntime.jsx(P.Media,{aspectRatio:2.5,objectFit:"cover",src:(R=r.videoUri)!=null?R:r.imageUri,type:r.videoUri?"video":"image"}),jsxRuntime.jsx(P.Subtitle,{color:"neutral400",children:d}),jsxRuntime.jsxs(S.Row,{gap:3,children:[jsxRuntime.jsx(P.Secondary,{disabled:f,title:g,onClick:o}),jsxRuntime.jsx(P.Primary,{disabled:f,title:u,onClick:e})]})]})]}))}var hn={default:lt};function Pn(n){var r=n,{flow:e,step:o}=r,t=m(r,["flow","step"]);var y;let{onPrimary:a,onSecondary:s,openStepId:d,setOpenStepId:c,stepTypes:u}=Ue.useContext(st),{handlePrimary:g,handleSecondary:h}=le(o,{onPrimary:a,onSecondary:s}),f=(d!=null?d:e.getCurrentStep().id)===o.id,C=(y=u[o.type])!=null?y:lt;function b(v){return A(this,null,function*(){c(v?o.id:""),v&&!o.$state.completed&&(yield o.start(),c(null));})}return jsxRuntime.jsx(C,p(i({flow:e,onOpenChange:b,open:f,step:o},t),{handlePrimary:g,handleSecondary:h}),o.id)}function pt(d){var c=d,{dismissible:e,flowId:o,onPrimary:t,onSecondary:n,part:r,stepTypes:a={}}=c,s=m(c,["dismissible","flowId","onPrimary","onSecondary","part","stepTypes"]);let[u,g]=Ue.useState(null),h=i(i({},hn),a);return jsxRuntime.jsx(st.Provider,{value:{openStepId:u,setOpenStepId:g,onPrimary:t,onSecondary:n,stepTypes:h},children:jsxRuntime.jsx(J,p(i({as:P,borderWidth:"md",flowId:o,part:["checklist",r]},s),{children:y=>{var v=y,{flow:f,handleDismiss:C}=v,b=m(v,["flow","handleDismiss"]);let R=Array.from(f.steps.entries()).filter(([,B])=>B.$state.visible===!0).map(([,B])=>jsxRuntime.jsx(Pn,p(i({flow:f,handleDismiss:C},b),{step:B}),B.id)),H=f.getNumberOfCompletedSteps(),T=f.getNumberOfAvailableSteps();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(S.Column,{gap:2,children:[jsxRuntime.jsx(P.Header,{dismissible:e,handleDismiss:C,part:"checklist-header",subtitle:f.subtitle,title:f.title}),jsxRuntime.jsxs(S.Row,{alignItems:"center",gap:2,children:[jsxRuntime.jsxs(F.Body2,{fontWeight:"demibold",children:[H,"/",T]}),jsxRuntime.jsx(He,{current:H,total:T,flexGrow:1})]})]}),R]})}}))})}var Rn=new Set(["required","min","max","minLength","maxLength","pattern"]);function kn({fieldComponent:e,control:o,fieldData:t,submit:n}){let r=reactHookForm.useFormContext();t.pattern!=null&&(typeof t.pattern=="string"?t.pattern=new RegExp(t.pattern.replace(/^\/|\/$/g,"")):typeof t.pattern=="object"&&typeof t.pattern.value=="string"&&(t.pattern.value=new RegExp(t.pattern.value.replace(/^\/|\/$/g,""))));let a=Object.fromEntries(Object.entries(t).filter(([d])=>Rn.has(d))),s=reactHookForm.useController({name:t.id,control:o,rules:a});return jsxRuntime.jsx(e,p(i({},s),{fieldData:t,formContext:r,submit:n}))}function ct({fieldTypes:e,handleDismiss:o,handlePrimary:t,handleSecondary:n,parentProps:{dismissible:r},step:a}){var R,H,T,B,L,E;let{__readOnly:s}=Ue.useContext(O),d=reactHookForm.useForm({delayError:2e3,mode:"onChange"}),[c,u]=Ue.useState(!1),g=[],{control:h,handleSubmit:f}=d,C=(R=a.props)!=null?R:{};function b(j,xe){u(!0),t(xe,j,s===!0).then(()=>u(!1));}(H=a.fields)==null||H.forEach(j=>{e[j.type]!=null&&g.push(jsxRuntime.jsx(kn,{control:h,fieldComponent:e[j.type],fieldData:j,submit:f(b)},`${a.flow.id}-${j.id}`));});let y=(B=(T=a.primaryButton)==null?void 0:T.title)!=null?B:a.primaryButtonTitle,v=(E=(L=a.secondaryButton)==null?void 0:L.title)!=null?E:a.secondaryButtonTitle,k=!!(a.$state.completed||a.$state.blocked);return jsxRuntime.jsxs(S.Column,p(i({gap:5,part:"form-step"},C),{children:[jsxRuntime.jsx(P.Header,{dismissible:r,handleDismiss:o,part:"form-step-header",subtitle:a.subtitle,title:a.title}),jsxRuntime.jsx(reactHookForm.FormProvider,p(i({},d),{children:g})),jsxRuntime.jsxs(S.Row,{part:"form-step-footer",justifyContent:"flex-end",gap:3,children:[v&&jsxRuntime.jsx(D.Secondary,{disabled:k,onClick:n,title:v}),jsxRuntime.jsx(D.Primary,{disabled:k||c,onClick:f(b),title:y!=null?y:"Submit",loading:c})]},"form-footer")]}))}function ut({error:e}){var o;return (o=e==null?void 0:e.message)!=null&&o.length?jsxRuntime.jsx(F.Caption,{color:"red500",display:"block",part:"field-error",mt:"1",textAlign:"end",children:e==null?void 0:e.message}):null}function oo({children:e,id:o,required:t=!1}){return jsxRuntime.jsxs(F.Body2,{as:"label",htmlFor:o,part:"field-label",fontWeight:"medium",mb:"2",display:"block",children:[e,t&&"*"]})}var we={px:"4",py:"2",backgroundColor:"neutral.background",borderColor:"neutral.border",borderStyle:"solid",borderWidth:"md",borderRadius:"md",display:"block",outline:"none",width:"100%"};function te({children:e,field:o,fieldData:t,fieldState:n}){var u;let{id:r,label:a,placeholder:s}=t,{error:d}=n,c=p(i(i(i({id:r},o),s?{placeholder:s}:{}),we),{"aria-invalid":!!d,value:(u=o.value)!=null?u:""});return jsxRuntime.jsxs(x,{part:"field",children:[jsxRuntime.jsx(oo,{id:r,required:!!t.required,children:a}),e(c),jsxRuntime.jsx(ut,{error:d})]})}var In=()=>jsxRuntime.jsx(x,{as:"svg",color:"primary.foreground",width:"10px",height:"8px",viewBox:"0 0 10 8",fill:"none",children:jsxRuntime.jsx("path",{d:"M1 4.34664L3.4618 6.99729L3.4459 6.98017L9 1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),Hn=Ue__namespace.forwardRef(({label:e,value:o},t)=>jsxRuntime.jsxs(x,{as:"label",backgroundColor:"neutral.background",borderColor:"neutral.border",borderRadius:"md",borderStyle:"solid",borderWidth:"md",display:"flex",htmlFor:o,justifyContent:"space-between",part:"field-radio",px:4,py:2,children:[jsxRuntime.jsx(F.Body2,{part:"field-radio-label",children:e}),jsxRuntime.jsx(ye__namespace.Item,{id:o,value:o,ref:t,asChild:!0,children:jsxRuntime.jsx(x,{as:"button",backgroundColor:"inherit",borderWidth:"md",borderStyle:"solid",borderColor:"neutral.border",borderRadius:"100%",padding:"0",part:"field-radio-value",position:"relative",height:"24px",width:"24px",children:jsxRuntime.jsx(x,{as:ye__namespace.Indicator,alignItems:"center",bg:"primary.surface",borderWidth:"md",borderStyle:"solid",borderColor:"primary.border",borderRadius:"100%",display:"flex",height:"calc(100% + 2px)",justifyContent:"center",left:"-1px",part:"field-radio-indicator",position:"absolute",top:"-1px",width:"calc(100% + 2px)",children:jsxRuntime.jsx(In,{})})})})]}));function to(e){let{field:{onChange:o,value:t},fieldData:{options:n=[]}}=e,r=n.map(({label:a,value:s})=>jsxRuntime.jsx(Hn,{value:s,label:a},s));return jsxRuntime.jsx(te,p(i({},e),{children:()=>jsxRuntime.jsx(ye__namespace.Root,{value:t,onValueChange:o,asChild:!0,children:jsxRuntime.jsx(S.Column,{gap:2,part:"field-radio-group",children:r})})}))}var An=Ue__namespace.forwardRef(({label:e,value:o},t)=>jsxRuntime.jsx(V__namespace.Item,{value:o,ref:t,asChild:!0,children:jsxRuntime.jsx(x,{"backgroundColor:hover":"blue900",borderRadius:"md",outline:"none",part:"field-select-option",px:"3",py:"2",children:jsxRuntime.jsx(V__namespace.ItemText,{asChild:!0,children:jsxRuntime.jsx(F.Body2,{part:"field-select-option-label",children:e})})})}));function ro(e){let{field:{onChange:o,value:t},fieldData:{options:n=[],placeholder:r}}=e,a=n.map(({label:s,value:d})=>jsxRuntime.jsx(An,{value:d,label:s},d));return jsxRuntime.jsx(te,p(i({},e),{children:()=>jsxRuntime.jsxs(V__namespace.Root,{value:t,onValueChange:o,children:[jsxRuntime.jsx(V__namespace.Trigger,{asChild:!0,children:jsxRuntime.jsxs(F.Body2,p(i({},we),{alignItems:"center",display:"flex",justifyContent:"space-between",part:"field-select",children:[jsxRuntime.jsx(V__namespace.Value,{placeholder:r!=null?r:"Select one"}),jsxRuntime.jsx(V__namespace.Icon,{children:jsxRuntime.jsx(x,{as:outline.ChevronDownIcon,color:"neutral100",display:"block",height:"24px",part:"field-select-icon",width:"24px"})})]}))}),jsxRuntime.jsx(V__namespace.Content,{position:"popper",sideOffset:4,asChild:!0,children:jsxRuntime.jsx(x,p(i({},we),{boxShadow:"md",maxHeight:"var(--radix-select-content-available-height)",p:"1",part:"field-select-options",width:"var(--radix-popper-anchor-width)",zIndex:"99999",children:jsxRuntime.jsx(V__namespace.Viewport,{children:a})}))})]})}))}function no(e){return jsxRuntime.jsx(te,p(i({},e),{children:o=>jsxRuntime.jsx(F.Body2,i({as:"input",part:"field-text",type:"text"},o))}))}function Pt(e){return jsxRuntime.jsx(te,p(i({},e),{children:o=>jsxRuntime.jsx(F.Body2,i({as:"textarea",part:"field-textarea"},o))}))}var $n={radio:to,select:ro,text:no,textarea:Pt};function io(r){var a=r,{fieldTypes:e={},flowId:o,part:t}=a,n=m(a,["fieldTypes","flowId","part"]);let s=Object.assign({},$n,e);return jsxRuntime.jsx(J,p(i({flowId:o,part:["form",t]},n),{children:d=>jsxRuntime.jsx(ct,i({fieldTypes:s},d))}))}var ao={};Q(ao,{NPS:()=>Tt});function Ft({field:e,submit:o}){let t=[...Array(11)].map((n,r)=>{let a=e.value===r?D.Primary:D.Secondary;return jsxRuntime.jsx(a,{borderWidth:"1px",onClick:()=>{e.onChange(r),o();},title:`${r}`,css:{".fr-button-title":{fontSize:"15px"}}},r)});return jsxRuntime.jsxs(S.Column,{gap:2,children:[jsxRuntime.jsx(S.Row,{gap:2,part:"field-nps",css:{"@media (min-width: 660px)":{flexWrap:"nowrap",justifyContent:"space-between"},flexWrap:"wrap",justifyContent:"center"},children:t}),jsxRuntime.jsxs(S.Row,{justifyContent:"space-between",part:"field-nps-label",children:[jsxRuntime.jsx(F.Caption,{part:"field-nps-left-label",color:"neutral400",children:"Not likely at all"}),jsxRuntime.jsx(F.Caption,{part:"field-nps-right-label",color:"neutral400",children:"Extremely likely"})]})]})}function Tt(a){var s=a,{as:e=I,flowId:o,fieldTypes:t,part:n}=s,r=m(s,["as","flowId","fieldTypes","part"]);let{flow:d}=ae(o);return jsxRuntime.jsx(io,i({alignSelf:"end",as:e,flowId:o,fieldTypes:i({nps:Ft},t),modal:!1,onEscapeKeyDown:c=>{typeof r.onEscapeKeyDown=="function"&&r.onEscapeKeyDown(c),c.defaultPrevented||d.skip();},part:["nps",n],css:p(i({},!d||d.getCurrentStepIndex()==0?{".fr-form-step-footer":{display:"none"}}:{}),{".fr-form":{padding:"20px","@media (min-width: 660px)":{minWidth:"600px"},minWidth:"100%"},".fr-form-step":{gap:"14px","@media (min-width: 660px)":{gap:"1"}}})},r))}function Ae(){let e="DOMRect"in globalThis?new DOMRect:{height:0,width:0,x:0,y:0,bottom:0,top:0,right:0,left:0,toJSON:()=>{}},[o,t]=Ue.useState(e),[n,r]=Ue.useState(null),a=Ue.useCallback(s=>{r(s);},[]);return Ue.useLayoutEffect(()=>{if(!n)return;let s=()=>{let d=n.getBoundingClientRect();t(d);};return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s)},[n]),{node:n,rect:o,ref:a}}var Nn=react.keyframes({"0%":{opacity:.5,transform:"scale(0.5)"},"50%":{opacity:0,transform:"scale(1)"},"100%":{opacity:0,transform:"scale(1)"}});function Bt(n){var r=n,{style:e={},part:o=""}=r,t=m(r,["style","part"]);return jsxRuntime.jsxs(x,p(i({part:`dot-wrapper ${o}`,style:i({height:"48px",position:"absolute",width:"48px"},e)},t),{children:[jsxRuntime.jsx(x,{backgroundColor:"primary.surface",part:"dot-pulse",css:{animation:`2s ease-out infinite ${Nn}`,borderRadius:"24px",height:"48px",left:0,position:"absolute",top:0,transformOrigin:"center center",width:"48px"}}),jsxRuntime.jsx(x,{backgroundColor:"primary.surface",part:"dot",style:{borderRadius:"12px",height:"24px",left:"12px",position:"absolute",top:"12px",width:"24px"}})]}))}function Rt({props:e,alignAttr:o,sideAttr:t}){let n=t!=null?t:"bottom",r={},a=()=>{var u;if(["after","before"].includes(e.align)){if(o=="start")return "before";if(o=="end")return "after"}return (u=e.align)!=null?u:"after"},s="-24px",d={top:"bottom",right:"left",bottom:"top",left:"right"};r[d[n]]=s;let c=a();return ["before","end"].includes(c)?["top","bottom"].includes(n)?r.right=s:r.bottom=s:["after","start"].includes(c)?["top","bottom"].includes(n)?r.left=s:r.top=s:["top","bottom"].includes(n)?r.left=`calc(50% + ${s})`:r.top=`calc(50% + ${s})`,r}var $e={content:["align","alignOffset","arrowPadding","avoidCollisions","collisionBoundary","collisionPadding","forceMount","hideWhenDetached","onCloseAutoFocus","onEscapeKeyDown","onFocusOutside","onInteractOutside","onOpenAutoFocus","onPointerDownOutside","side","sideOffset","sticky"],root:["defaultOpen","modal","onOpenChange","open"]};function kt(e,o){var a,s,d,c,u;let t=Object.fromEntries($e.content.map(g=>[g,e[g]]).filter(g=>g[1]!==void 0)),n=Object.fromEntries($e.root.map(g=>[g,e[g]]).filter(g=>g[1]!==void 0)),r={};for(let g of Object.keys(e))!$e.content.includes(g)&&!$e.root.includes(g)&&(r[g]=e[g]);if(t.align=(a=t.align)!=null?a:"after",t.side=(s=t.side)!=null?s:"bottom",["before","after"].includes(t.align)){let g={after:"end",before:"start"},h=(k,R)=>["top","bottom"].includes(R)?k=="after"?"marginLeft":"marginRight":k=="after"?"marginTop":"marginBottom",f=(d=t.alignOffset)!=null?d:0,C=(c=t.style)!=null?c:{},b=(u=t.side)!=null?u:"bottom",y=t.align;t.style=p(i({},C),{[h(y,b)]:f});let v=["top","bottom"].includes(b)?o.width:o.height;t.alignOffset=(v+f)*-1,t.align=g[y];}return {contentProps:t,otherProps:r,rootProps:n}}var Dt=react.keyframes`
78
78
  from {
79
79
  opacity: 0;
80
80
  }