@frigade/react 2.0.17 → 2.0.18
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 +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -63,7 +63,7 @@ var oo=Object.defineProperty;var ro=(e=>typeof require<"u"?require:typeof Proxy<
|
|
|
63
63
|
height: 0;
|
|
64
64
|
opacity: 0;
|
|
65
65
|
}
|
|
66
|
-
`,Dr=()=>jsxRuntime.jsx(l,{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 Er({checked:e=!1}){return jsxRuntime.jsx(l,{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(l,{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(Dr,{})})})}function De({children:e}){return jsxRuntime.jsx(te__namespace.Content,{asChild:!0,children:jsxRuntime.jsxs(g.Column,{css:{'&[data-state="open"]':{animation:`${vr} 300ms ease-out`},'&[data-state="closed"]':{animation:`${kr} 300ms ease-out`},overflow:"hidden"},gap:5,children:[jsxRuntime.jsx(l,{}),e]})})}function Ee({children:e,open:t=!1,onOpenChange:o=()=>{}}){return jsxRuntime.jsx(te__namespace.Root,{asChild:!0,open:t,onOpenChange:o,children:jsxRuntime.jsx(u,{borderWidth:"md",css:{'&[data-state="open"] .fr-collapsible-step-icon':{transform:"rotate(180deg)"}},gap:0,children:e})})}function Oe({isCompleted:e,title:t}){return jsxRuntime.jsx(te__namespace.Trigger,{asChild:!0,children:jsxRuntime.jsxs(g.Row,{alignItems:"center",justifyContent:"space-between",margin:-5,padding:5,zIndex:1,children:[jsxRuntime.jsxs(g.Row,{alignItems:"center",gap:2,children:[jsxRuntime.jsx(Er,{checked:e}),jsxRuntime.jsx(f.Body2,{fontWeight:"demibold",userSelect:"none",children:t})]}),jsxRuntime.jsx(l,{as:outline.ChevronDownIcon,color:"gray100",css:{"& path":{vectorEffect:"non-scaling-stroke"}},display:"block",height:"16px",order:2,part:"collapsible-step-icon",width:"16px"})]})})}var Me={};N(Me,{Bar:()=>ue,Dots:()=>Ct,Segments:()=>Ft});function ue({current:e,total:t,...o}){let i=t>0?Math.min(e/t,1):0,n=i===0?"10px":`${100*i}%`;return jsxRuntime.jsx(l,{part:"progress-bar",backgroundColor:"blue800",borderRadius:"md",height:"10px",...o,children:jsxRuntime.jsx(l,{backgroundColor:"primary.surface",part:"progress-bar-fill",borderRadius:"md",height:"100%",style:{width:n},transition:"width 300ms ease-out"})})}function Ct({current:e,total:t,...o}){if(t==1)return null;let i=[...Array(t)].map((n,r)=>jsxRuntime.jsx(l,{as:"circle",r:4,cx:4+16*r,cy:"4px",fill:e-1===r?y.colors.blue500:y.colors.blue800},r));return jsxRuntime.jsx(l,{as:"svg",height:"8px",part:"progress-dots",viewBox:`0 0 ${16*t-8} 8`,width:16*t-8,...o,children:i})}function Ft({current:e,total:t,...o}){let i=[...Array(t)].map((n,r)=>jsxRuntime.jsx(l,{backgroundColor:e-1===r?"primary.surface":"blue800",borderRadius:"md",flexGrow:1,height:"100%"},r));return jsxRuntime.jsx(g.Row,{gap:1,height:"10px",...o,children:i})}var Tt=Re.createContext({onPrimary:()=>{},onSecondary:()=>{},openStepId:null,setOpenStepId:()=>{},stepTypes:{}});function wt({handlePrimary:e,handleSecondary:t,open:o,onOpenChange:i,step:n}){let{isBlocked:r,isCompleted:a,primaryButtonTitle:s,secondaryButtonTitle:d,subtitle:m,title:x}=n;return jsxRuntime.jsxs(Ee,{open:o,onOpenChange:i,children:[jsxRuntime.jsx(Oe,{isCompleted:a,title:x}),jsxRuntime.jsxs(De,{children:[jsxRuntime.jsx(u.Media,{aspectRatio:2.5,objectFit:"cover",src:n.imageUri}),jsxRuntime.jsx(u.Subtitle,{color:"gray500",children:m}),jsxRuntime.jsxs(g.Row,{gap:3,children:[jsxRuntime.jsx(u.Secondary,{disabled:!!(a||r),title:d,onClick:t}),jsxRuntime.jsx(u.Primary,{disabled:!!(a||r),title:s,onClick:e})]})]})]})}var Hr={default:wt};function Wr({flow:e,step:t,...o}){let{onPrimary:i,onSecondary:n,openStepId:r,setOpenStepId:a,stepTypes:s}=Re.useContext(Tt),{handlePrimary:d,handleSecondary:m}=G(t,{onPrimary:i,onSecondary:n}),x=(r??e.getCurrentStep().id)===t.id,b=s[t.type]??wt;async function c(F){a(F?t.id:""),F&&!t.isCompleted&&await t.start();}return jsxRuntime.jsx(b,{flow:e,onOpenChange:c,open:x,step:t,...o,handlePrimary:d,handleSecondary:m},t.id)}function Rt({dismissible:e,flowId:t,onPrimary:o,onSecondary:i,stepTypes:n={},...r}){let[a,s]=Re.useState(null),d={...Hr,...n};return jsxRuntime.jsx(Tt.Provider,{value:{openStepId:a,setOpenStepId:s,onPrimary:o,onSecondary:i,stepTypes:d},children:jsxRuntime.jsx(H,{as:u,borderWidth:"md",flowId:t,part:"checklist",...r,children:({flow:m,handleDismiss:x,...b})=>{let c=Array.from(m.steps.entries()).map(([,K])=>jsxRuntime.jsx(Wr,{flow:m,handleDismiss:x,...b,step:K},K.id)),F=m.getNumberOfCompletedSteps(),ee=m.getNumberOfAvailableSteps();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(g.Column,{gap:2,children:[jsxRuntime.jsxs(g.Row,{alignItems:"center",flexWrap:"wrap",gap:1,justifyContent:"space-between",part:"checklist-header",children:[jsxRuntime.jsx(u.Title,{children:m.title}),e&&jsxRuntime.jsx(u.Dismiss,{onClick:x}),jsxRuntime.jsx(u.Subtitle,{color:"gray500",flexBasis:"100%",children:m.subtitle})]}),jsxRuntime.jsxs(g.Row,{alignItems:"center",gap:2,children:[jsxRuntime.jsxs(f.Body2,{fontWeight:"demibold",children:[F,"/",ee]}),jsxRuntime.jsx(ue,{current:F,total:ee,flexGrow:1})]})]}),c]})}})})}var $r=new Set(["required","min","max","minLength","maxLength","pattern"]);function Nr({fieldComponent:e,control:t,fieldData:o}){o.pattern!=null&&(typeof o.pattern=="string"?o.pattern=new RegExp(o.pattern.replace(/^\/|\/$/g,"")):typeof o.pattern=="object"&&typeof o.pattern.value=="string"&&(o.pattern.value=new RegExp(o.pattern.value.replace(/^\/|\/$/g,""))));let i=Object.fromEntries(Object.entries(o).filter(([r])=>$r.has(r))),n=reactHookForm.useController({name:o.id,control:t,rules:i});return jsxRuntime.jsx(e,{...n,fieldData:o})}function vt({fieldTypes:e,handleDismiss:t,handlePrimary:o,handleSecondary:i,parentProps:{dismissible:n},step:r}){var b;let{control:a,handleSubmit:s}=reactHookForm.useForm({delayError:2e3,mode:"onChange"}),d=[];function m(c,F){o(F,c);}function x(c,F){i(F,c);}return (b=r.fields)==null||b.forEach(c=>{e[c.type]!=null&&d.push(jsxRuntime.jsx(Nr,{control:a,fieldComponent:e[c.type],fieldData:c},c.id));}),jsxRuntime.jsxs(g.Column,{gap:5,part:"form-step",children:[jsxRuntime.jsxs(g.Row,{alignItems:"center",flexWrap:"wrap",gap:1,justifyContent:"space-between",part:"form-step-header",children:[jsxRuntime.jsx(u.Title,{children:r.title}),n&&jsxRuntime.jsx(u.Dismiss,{onClick:t}),jsxRuntime.jsx(u.Subtitle,{flexBasis:"100%",children:r.subtitle})]}),d,jsxRuntime.jsxs(g.Row,{part:"form-step-footer",justifyContent:"flex-end",gap:3,children:[r.secondaryButtonTitle&&jsxRuntime.jsx(h.Secondary,{title:r.secondaryButtonTitle,onClick:s(x)}),jsxRuntime.jsx(h.Primary,{title:r.primaryButtonTitle??"Submit",onClick:s(m)})]},"form-footer")]})}function kt({error:e}){var t;return (t=e==null?void 0:e.message)!=null&&t.length?jsxRuntime.jsx(f.Caption,{color:"red500",display:"block",part:"field-error",textAlign:"end",children:e==null?void 0:e.message}):null}function Dt({children:e,id:t,required:o=!1}){return jsxRuntime.jsxs(f.H4,{as:"label",htmlFor:t,part:"field-label",children:[e,o&&" *"]})}var se={px:"4",py:"2",backgroundColor:"neutral.background",borderColor:"neutral.border",borderStyle:"solid",borderWidth:"md",borderRadius:"md",display:"block",outline:"none",width:"100%"};function j({children:e,field:t,fieldData:o,fieldState:i}){let{id:n,label:r,placeholder:a}=o,{error:s}=i,d={id:n,...t,...a?{placeholder:a}:{},...se,"aria-invalid":!!s,value:t.value??""};return jsxRuntime.jsxs(l,{part:"field",children:[jsxRuntime.jsx(Dt,{id:n,required:!!o.required,children:r}),e(d),jsxRuntime.jsx(kt,{error:s})]})}var Kr=()=>jsxRuntime.jsx(l,{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"})}),Ur=Re__namespace.forwardRef(({label:e,value:t},o)=>jsxRuntime.jsxs(l,{as:"label",backgroundColor:"neutral.background",borderColor:"neutral.border",borderRadius:"md",borderStyle:"solid",borderWidth:"md",display:"flex",htmlFor:t,justifyContent:"space-between",part:"field-radio",px:4,py:2,children:[jsxRuntime.jsx(f.Body2,{part:"field-radio-label",children:e}),jsxRuntime.jsx(oe__namespace.Item,{id:t,value:t,ref:o,asChild:!0,children:jsxRuntime.jsx(l,{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(l,{as:oe__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(Kr,{})})})})]}));function It(e){let{field:{onChange:t,value:o},fieldData:{options:i=[]}}=e,n=i.map(({label:r,value:a})=>jsxRuntime.jsx(Ur,{value:a,label:r},a));return jsxRuntime.jsx(j,{...e,children:()=>jsxRuntime.jsx(oe__namespace.Root,{value:o,onValueChange:t,asChild:!0,children:jsxRuntime.jsx(g.Column,{gap:2,part:"field-radio-group",children:n})})})}var Jr=Re__namespace.forwardRef(({label:e,value:t},o)=>jsxRuntime.jsx(S__namespace.Item,{value:t,ref:o,asChild:!0,children:jsxRuntime.jsx(l,{"backgroundColor:hover":"blue900",borderRadius:"md",outline:"none",part:"field-select-option",px:"3",py:"2",children:jsxRuntime.jsx(S__namespace.ItemText,{asChild:!0,children:jsxRuntime.jsx(f.Body2,{part:"field-select-option-label",children:e})})})}));function At(e){let{field:{onChange:t,value:o},fieldData:{options:i=[],placeholder:n}}=e,r=i.map(({label:a,value:s})=>jsxRuntime.jsx(Jr,{value:s,label:a},s));return jsxRuntime.jsx(j,{...e,children:()=>jsxRuntime.jsxs(S__namespace.Root,{value:o,onValueChange:t,children:[jsxRuntime.jsx(S__namespace.Trigger,{asChild:!0,children:jsxRuntime.jsxs(f.Body2,{...se,alignItems:"center",display:"flex",justifyContent:"space-between",part:"field-select",children:[jsxRuntime.jsx(S__namespace.Value,{placeholder:n??"Select one"}),jsxRuntime.jsx(S__namespace.Icon,{children:jsxRuntime.jsx(l,{as:outline.ChevronDownIcon,color:"gray100",display:"block",height:"24px",part:"field-select-icon",width:"24px"})})]})}),jsxRuntime.jsx(S__namespace.Portal,{children:jsxRuntime.jsx(S__namespace.Content,{position:"popper",sideOffset:4,asChild:!0,children:jsxRuntime.jsx(l,{...se,p:"1",part:"field-select-options",width:"var(--radix-popper-anchor-width)",children:jsxRuntime.jsx(S__namespace.Viewport,{children:r})})})})]})})}function Vt(e){return jsxRuntime.jsx(j,{...e,children:t=>jsxRuntime.jsx(f.Body2,{as:"input",part:"field-text",type:"text",...t})})}function Nt(e){return jsxRuntime.jsx(j,{...e,children:t=>jsxRuntime.jsx(f.Body2,{as:"textarea",part:"field-textarea",...t})})}var qr={radio:It,select:At,text:Vt,textarea:Nt};function He({fieldTypes:e={},flowId:t,...o}){let i=Object.assign({},qr,e);return jsxRuntime.jsx(H,{flowId:t,part:"form",...o,children:n=>jsxRuntime.jsx(vt,{fieldTypes:i,...n})})}var Ut={};N(Ut,{NPS:()=>Kt});function jt({field:e}){let t=[...Array(11)].map((o,i)=>{let n=e.value===i?h.Primary:h.Secondary;return jsxRuntime.jsx(n,{borderWidth:"1px",onClick:()=>e.onChange(i),title:`${i}`},i)});return jsxRuntime.jsx(g.Row,{gap:2,justifyContent:"center",part:"field-nps",children:t})}var O="24px";function Q({children:e,align:t,...o}){function i(){switch(t){case"top":return {top:O,left:"50%",transform:"translate(-50%, 0)"};case"bottom":return {bottom:O,left:"50%",transform:"translate(-50%, 0)"};case"left":return {top:"50%",left:O,transform:"translate(0, -50%)"};case"right":return {top:"50%",right:O,transform:"translate(0, -50%)"};case"top-left":return {top:O,left:O};case"top-right":return {top:O,right:O};case"bottom-left":return {bottom:O,left:O};case"bottom-right":return {bottom:O,right:O}}return {top:"50%",transform:"translate(-50%, -50%)"}}return jsxRuntime.jsx(w__namespace.Root,{defaultOpen:!0,modal:!0,children:jsxRuntime.jsx(w__namespace.Portal,{children:jsxRuntime.jsx(l,{inset:"0",position:"fixed",zIndex:"9999",width:"100vw",height:"100vh",children:jsxRuntime.jsx(w__namespace.Content,{asChild:!0,onOpenAutoFocus:n=>n.preventDefault(),onPointerDownOutside:n=>n.preventDefault(),children:jsxRuntime.jsx(u,{boxShadow:"md",left:"50%",maxWidth:"430px",p:8,part:"modal",...i(),...o,position:"fixed",children:e})})})})})}Q.Dismiss=e=>jsxRuntime.jsx(w__namespace.Close,{"aria-label":"Close",asChild:!0,children:jsxRuntime.jsx(h.Plain,{part:"close",position:"absolute",right:"-4px",top:"4px",...e,children:jsxRuntime.jsx(solid.XMarkIcon,{height:"24",fill:"currentColor"})})});Q.Subtitle=({children:e,...t})=>jsxRuntime.jsx(w__namespace.Description,{asChild:!0,children:jsxRuntime.jsx(f.Body2,{part:"subtitle",...t,children:e})});Q.Secondary=({onClick:e,title:t,...o})=>t==null?null:jsxRuntime.jsx(h.Secondary,{title:t,onClick:e,...o});Q.Title=({children:e,...t})=>jsxRuntime.jsx(w__namespace.Title,{asChild:!0,children:jsxRuntime.jsx(f.H3,{part:"title",...t,children:e})});Q.displayName="Modal";function Kt({as:e=Q,flowId:t,fieldTypes:o,...i}){return jsxRuntime.jsx(He,{as:e,flowId:t,fieldTypes:{nps:jt,...o},maxWidth:"auto",minWidth:"min-content",width:"50vw",align:"bottom",...i})}function fe(){let e="DOMRect"in globalThis?new DOMRect:{height:0,width:0,x:0,y:0,bottom:0,top:0,right:0,left:0,toJSON:()=>{}},[t,o]=Re.useState(e),[i,n]=Re.useState(null),r=Re.useCallback(a=>{n(a);},[]);return Re.useLayoutEffect(()=>{if(!i)return;let a=()=>{let s=i.getBoundingClientRect();o(s);};return a(),window.addEventListener("resize",a),()=>window.removeEventListener("resize",a)},[i]),{node:i,rect:t,ref:r}}var on=react.keyframes({"0%":{opacity:.5,transform:"scale(0.5)"},"50%":{opacity:0,transform:"scale(1)"},"100%":{opacity:0,transform:"scale(1)"}});function Jt({style:e={},part:t="",...o}){return jsxRuntime.jsxs(l,{part:`dot-wrapper ${t}`,style:{height:"48px",position:"absolute",width:"48px",...e},...o,children:[jsxRuntime.jsx(l,{backgroundColor:"primary.surface",part:"dot-pulse",css:{animation:`2s ease-out infinite ${on}`,borderRadius:"24px",height:"48px",left:0,position:"absolute",top:0,transformOrigin:"center center",width:"48px"}}),jsxRuntime.jsx(l,{backgroundColor:"primary.surface",part:"dot",style:{borderRadius:"12px",height:"24px",left:"12px",position:"absolute",top:"12px",width:"24px"}})]})}function qt({props:e,alignAttr:t,sideAttr:o}){let i=o??"bottom",n={},r=()=>{if(["after","before"].includes(e.align)){if(t=="start")return "before";if(t=="end")return "after"}return e.align??"after"},a="-24px",s={top:"bottom",right:"left",bottom:"top",left:"right"};n[s[i]]=a;let d=r();return ["before","end"].includes(d)?["top","bottom"].includes(i)?n.right=a:n.bottom=a:["after","start"].includes(d)?["top","bottom"].includes(i)?n.left=a:n.top=a:["top","bottom"].includes(i)?n.left=`calc(50% + ${a})`:n.top=`calc(50% + ${a})`,n}var ge={content:["align","alignOffset","arrowPadding","avoidCollisions","collisionBoundary","collisionPadding","forceMount","hideWhenDetached","onCloseAutoFocus","onEscapeKeyDown","onFocusOutside","onInteractOutside","onOpenAutoFocus","onPointerDownOutside","side","sideOffset","sticky"],root:["defaultOpen","modal","onOpenChange","open"]};function Yt(e,t){let o=Object.fromEntries(ge.content.map(r=>[r,e[r]]).filter(r=>r[1]!==void 0)),i=Object.fromEntries(ge.root.map(r=>[r,e[r]]).filter(r=>r[1]!==void 0)),n={};for(let r of Object.keys(e))!ge.content.includes(r)&&!ge.root.includes(r)&&(n[r]=e[r]);if(o.align=o.align??"after",o.side=o.side??"bottom",["before","after"].includes(o.align)){let r={after:"end",before:"start"},a=(c,F)=>["top","bottom"].includes(F)?c=="after"?"marginLeft":"marginRight":c=="after"?"marginTop":"marginBottom",s=o.alignOffset??0,d=o.style??{},m=o.side??"bottom",x=o.align;o.style={...d,[a(x,m)]:s};let b=["top","bottom"].includes(m)?t.width:t.height;o.alignOffset=(b+s)*-1,o.align=r[x];}return {contentProps:o,otherProps:n,rootProps:i}}function T({anchor:e,children:t,className:o,spotlight:i=!1,style:n,...r}){let{node:a,rect:s,ref:d}=fe(),{node:m,rect:x,ref:b}=fe(),{contentProps:c,otherProps:F,rootProps:ee}=Yt(r,s),[K,ye]=Re.useState(c.align),[le,re]=Re.useState(c.side),[he,be]=Re.useState(0),[Le,eo]=Re.useState(0);if(a!==null){let $=a.getAttribute("data-align"),pe=a.getAttribute("data-side");K!==$&&ye($),le!==pe&&re(pe);}let Ve=Re.useRef(null);if(Re.useEffect(()=>{let $=document.querySelector(e);$!=null?(b($),Ve.current=$):console.debug(`No anchor found for query: ${e}`);},[e]),Re.useEffect(()=>{let{scrollX:$,scrollY:pe}=window;be(x.left+$),eo(x.top+pe);},[x.left,x.top]),m==null)return null;let $e="0";typeof window<"u"&&($e=window.getComputedStyle(m).borderRadius);let to=qt({props:r,alignAttr:K,sideAttr:le});return jsxRuntime.jsxs(W__namespace.Root,{defaultOpen:!0,...ee,children:[jsxRuntime.jsx(W__namespace.Anchor,{virtualRef:Ve}),jsxRuntime.jsx(W__namespace.Portal,{children:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[i&&jsxRuntime.jsx(l,{part:"tooltip-spotlight",position:"absolute",style:{borderRadius:$e,boxShadow:"0 0 0 20000px rgb(0 0 0 / 0.5)",height:x.height,left:he,top:Le,width:x.width}}),jsxRuntime.jsx(W__namespace.Content,{asChild:!0,...c,ref:d,children:jsxRuntime.jsxs(u,{boxShadow:"md",part:"tooltip",position:"relative",className:o,css:{maxWidth:"360px",pointerEvents:"auto"},style:n,...F,children:[jsxRuntime.jsx(Jt,{style:to}),t]})})]})})]})}T.Close=e=>jsxRuntime.jsx(W__namespace.Close,{"aria-label":"Close",asChild:!0,children:jsxRuntime.jsx(h.Plain,{css:{top:"12px",right:"4px"},part:"close",position:"absolute",...e,children:jsxRuntime.jsx(solid.XMarkIcon,{height:"24",fill:"currentColor"})})});T.Media=({src:e,...t})=>e==null?null:jsxRuntime.jsx(J,{borderRadius:"md md 0 0",borderWidth:"0",css:{aspectRatio:"2",objectFit:"cover"},margin:"-5 -5 0",src:e,...t});T.Primary=({onClick:e,title:t,...o})=>t==null?null:jsxRuntime.jsx(h.Primary,{title:t,onClick:e,...o});T.Progress=({children:e,...t})=>e==null?null:jsxRuntime.jsx(f.H4,{part:"progress",...t,children:e});T.Secondary=({onClick:e,title:t,...o})=>t==null?null:jsxRuntime.jsx(h.Secondary,{title:t,onClick:e,...o});T.Subtitle=({children:e,...t})=>e==null?null:jsxRuntime.jsx(f.Body2,{part:"subtitle",...t,children:e});T.Title=({children:e,...t})=>e==null?null:jsxRuntime.jsx(f.H4,{part:"title",...t,children:e});function Zt({dismissible:e=!0,flow:t,onDismiss:o,onPrimary:i,onSecondary:n,step:r,...a}){let{handleDismiss:s}=U(t,{onDismiss:o}),{handlePrimary:d,handleSecondary:m}=G(r,{onPrimary:i,onSecondary:n});return jsxRuntime.jsxs(T,{anchor:r.selector,onOpenAutoFocus:x=>x.preventDefault(),onPointerDownOutside:x=>x.preventDefault(),onInteractOutside:x=>x.preventDefault(),...a,children:[e&&jsxRuntime.jsx(T.Close,{onClick:s}),jsxRuntime.jsx(T.Media,{src:r.videoUri??r.imageUri,type:r.videoUri?"video":"image"}),jsxRuntime.jsxs(g.Column,{gap:1,part:"tooltip-header",children:[jsxRuntime.jsx(T.Title,{children:r.title}),jsxRuntime.jsx(T.Subtitle,{color:"gray500",children:r.subtitle})]}),jsxRuntime.jsxs(g.Row,{alignItems:"center",gap:3,justifyContent:"flex-end",part:"tooltip-footer",children:[jsxRuntime.jsx(T.Progress,{marginRight:"auto",transform:"translateY(1px)",children:`${t.getNumberOfCompletedSteps()+1}/${t.getNumberOfAvailableSteps()}`}),jsxRuntime.jsx(T.Secondary,{title:r.secondaryButtonTitle,onClick:m}),jsxRuntime.jsx(T.Primary,{title:r.primaryButtonTitle,onClick:d})]})]},r.id)}function pn({flowId:e,onComplete:t,variables:o,...i}){let{flow:n}=ie(e,{variables:o});U(n,{onComplete:t});let{isCurrentModal:r,removeModal:a}=ae(n);if(Re.useEffect(()=>{!(n!=null&&n.isVisible)&&r&&a();},[n==null?void 0:n.isVisible,r]),n==null||n.isVisible===!1||!r)return null;let s=n.getCurrentStep();return s==null||s.start(),jsxRuntime.jsx(Zt,{step:s,flow:n,...i})}function mn(){let{frigade:e}=Re.useContext(v);return {frigade:e,isLoading:!(e!=null&&e.isReady())}}function fn(){let{userId:e,frigade:t}=Re.useContext(v);async function o(n){await t.identify(e,n);}async function i(n,r){await t.track(n,r);}return {userId:e,addProperties:o,track:i}}function xn(){let{groupId:e,frigade:t}=Re.useContext(v);async function o(n){if(!e){console.error("No Group ID is set. Cannot set properties without a Group ID.");return}await t.group(e,n);}async function i(n,r){await t.track(n,r);}return {groupId:e,addProperties:o,track:i}}
|
|
66
|
+
`,Dr=()=>jsxRuntime.jsx(l,{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 Er({checked:e=!1}){return jsxRuntime.jsx(l,{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(l,{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(Dr,{})})})}function De({children:e}){return jsxRuntime.jsx(te__namespace.Content,{asChild:!0,children:jsxRuntime.jsxs(g.Column,{css:{'&[data-state="open"]':{animation:`${vr} 300ms ease-out`},'&[data-state="closed"]':{animation:`${kr} 300ms ease-out`},overflow:"hidden"},gap:5,children:[jsxRuntime.jsx(l,{}),e]})})}function Ee({children:e,open:t=!1,onOpenChange:o=()=>{}}){return jsxRuntime.jsx(te__namespace.Root,{asChild:!0,open:t,onOpenChange:o,children:jsxRuntime.jsx(u,{borderWidth:"md",css:{'&[data-state="open"] .fr-collapsible-step-icon':{transform:"rotate(180deg)"}},gap:0,children:e})})}function Oe({isCompleted:e,title:t}){return jsxRuntime.jsx(te__namespace.Trigger,{asChild:!0,children:jsxRuntime.jsxs(g.Row,{alignItems:"center",justifyContent:"space-between",margin:-5,padding:5,zIndex:1,children:[jsxRuntime.jsxs(g.Row,{alignItems:"center",gap:2,children:[jsxRuntime.jsx(Er,{checked:e}),jsxRuntime.jsx(f.Body2,{fontWeight:"demibold",userSelect:"none",children:t})]}),jsxRuntime.jsx(l,{as:outline.ChevronDownIcon,color:"gray100",css:{"& path":{vectorEffect:"non-scaling-stroke"}},display:"block",height:"16px",order:2,part:"collapsible-step-icon",width:"16px"})]})})}var Me={};N(Me,{Bar:()=>ue,Dots:()=>Ct,Segments:()=>Ft});function ue({current:e,total:t,...o}){let i=t>0?Math.min(e/t,1):0,n=i===0?"10px":`${100*i}%`;return jsxRuntime.jsx(l,{part:"progress-bar",backgroundColor:"blue800",borderRadius:"md",height:"10px",...o,children:jsxRuntime.jsx(l,{backgroundColor:"primary.surface",part:"progress-bar-fill",borderRadius:"md",height:"100%",style:{width:n},transition:"width 300ms ease-out"})})}function Ct({current:e,total:t,...o}){if(t==1)return null;let i=[...Array(t)].map((n,r)=>jsxRuntime.jsx(l,{as:"circle",r:4,cx:4+16*r,cy:"4px",fill:e-1===r?y.colors.blue500:y.colors.blue800},r));return jsxRuntime.jsx(l,{as:"svg",height:"8px",part:"progress-dots",viewBox:`0 0 ${16*t-8} 8`,width:16*t-8,...o,children:i})}function Ft({current:e,total:t,...o}){let i=[...Array(t)].map((n,r)=>jsxRuntime.jsx(l,{backgroundColor:e-1===r?"primary.surface":"blue800",borderRadius:"md",flexGrow:1,height:"100%"},r));return jsxRuntime.jsx(g.Row,{gap:1,height:"10px",...o,children:i})}var Tt=Re.createContext({onPrimary:()=>{},onSecondary:()=>{},openStepId:null,setOpenStepId:()=>{},stepTypes:{}});function wt({handlePrimary:e,handleSecondary:t,open:o,onOpenChange:i,step:n}){let{isBlocked:r,isCompleted:a,primaryButtonTitle:s,secondaryButtonTitle:d,subtitle:m,title:x}=n;return jsxRuntime.jsxs(Ee,{open:o,onOpenChange:i,children:[jsxRuntime.jsx(Oe,{isCompleted:a,title:x}),jsxRuntime.jsxs(De,{children:[jsxRuntime.jsx(u.Media,{aspectRatio:2.5,objectFit:"cover",src:n.imageUri}),jsxRuntime.jsx(u.Subtitle,{color:"gray500",children:m}),jsxRuntime.jsxs(g.Row,{gap:3,children:[jsxRuntime.jsx(u.Secondary,{disabled:!!(a||r),title:d,onClick:t}),jsxRuntime.jsx(u.Primary,{disabled:!!(a||r),title:s,onClick:e})]})]})]})}var Hr={default:wt};function Wr({flow:e,step:t,...o}){let{onPrimary:i,onSecondary:n,openStepId:r,setOpenStepId:a,stepTypes:s}=Re.useContext(Tt),{handlePrimary:d,handleSecondary:m}=G(t,{onPrimary:i,onSecondary:n}),x=(r??e.getCurrentStep().id)===t.id,b=s[t.type]??wt;async function c(F){a(F?t.id:""),F&&!t.isCompleted&&await t.start();}return jsxRuntime.jsx(b,{flow:e,onOpenChange:c,open:x,step:t,...o,handlePrimary:d,handleSecondary:m},t.id)}function Rt({dismissible:e,flowId:t,onPrimary:o,onSecondary:i,stepTypes:n={},...r}){let[a,s]=Re.useState(null),d={...Hr,...n};return jsxRuntime.jsx(Tt.Provider,{value:{openStepId:a,setOpenStepId:s,onPrimary:o,onSecondary:i,stepTypes:d},children:jsxRuntime.jsx(H,{as:u,borderWidth:"md",flowId:t,part:"checklist",...r,children:({flow:m,handleDismiss:x,...b})=>{let c=Array.from(m.steps.entries()).map(([,K])=>jsxRuntime.jsx(Wr,{flow:m,handleDismiss:x,...b,step:K},K.id)),F=m.getNumberOfCompletedSteps(),ee=m.getNumberOfAvailableSteps();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(g.Column,{gap:2,children:[jsxRuntime.jsxs(g.Row,{alignItems:"center",flexWrap:"wrap",gap:1,justifyContent:"space-between",part:"checklist-header",children:[jsxRuntime.jsx(u.Title,{children:m.title}),e&&jsxRuntime.jsx(u.Dismiss,{onClick:x}),jsxRuntime.jsx(u.Subtitle,{color:"gray500",flexBasis:"100%",children:m.subtitle})]}),jsxRuntime.jsxs(g.Row,{alignItems:"center",gap:2,children:[jsxRuntime.jsxs(f.Body2,{fontWeight:"demibold",children:[F,"/",ee]}),jsxRuntime.jsx(ue,{current:F,total:ee,flexGrow:1})]})]}),c]})}})})}var $r=new Set(["required","min","max","minLength","maxLength","pattern"]);function Nr({fieldComponent:e,control:t,fieldData:o}){o.pattern!=null&&(typeof o.pattern=="string"?o.pattern=new RegExp(o.pattern.replace(/^\/|\/$/g,"")):typeof o.pattern=="object"&&typeof o.pattern.value=="string"&&(o.pattern.value=new RegExp(o.pattern.value.replace(/^\/|\/$/g,""))));let i=Object.fromEntries(Object.entries(o).filter(([r])=>$r.has(r))),n=reactHookForm.useController({name:o.id,control:t,rules:i});return jsxRuntime.jsx(e,{...n,fieldData:o})}function vt({fieldTypes:e,handleDismiss:t,handlePrimary:o,handleSecondary:i,parentProps:{dismissible:n},step:r}){var b;let{control:a,handleSubmit:s}=reactHookForm.useForm({delayError:2e3,mode:"onChange"}),d=[];function m(c,F){o(F,c);}function x(c,F){i(F,c);}return (b=r.fields)==null||b.forEach(c=>{e[c.type]!=null&&d.push(jsxRuntime.jsx(Nr,{control:a,fieldComponent:e[c.type],fieldData:c},c.id));}),jsxRuntime.jsxs(g.Column,{gap:5,part:"form-step",children:[jsxRuntime.jsxs(g.Row,{alignItems:"center",flexWrap:"wrap",gap:1,justifyContent:"space-between",part:"form-step-header",children:[jsxRuntime.jsx(u.Title,{children:r.title}),n&&jsxRuntime.jsx(u.Dismiss,{onClick:t}),jsxRuntime.jsx(u.Subtitle,{flexBasis:"100%",children:r.subtitle})]}),d,jsxRuntime.jsxs(g.Row,{part:"form-step-footer",justifyContent:"flex-end",gap:3,children:[r.secondaryButtonTitle&&jsxRuntime.jsx(h.Secondary,{title:r.secondaryButtonTitle,onClick:s(x)}),jsxRuntime.jsx(h.Primary,{title:r.primaryButtonTitle??"Submit",onClick:s(m)})]},"form-footer")]})}function kt({error:e}){var t;return (t=e==null?void 0:e.message)!=null&&t.length?jsxRuntime.jsx(f.Caption,{color:"red500",display:"block",part:"field-error",textAlign:"end",children:e==null?void 0:e.message}):null}function Dt({children:e,id:t,required:o=!1}){return jsxRuntime.jsxs(f.H4,{as:"label",htmlFor:t,part:"field-label",children:[e,o&&" *"]})}var se={px:"4",py:"2",backgroundColor:"neutral.background",borderColor:"neutral.border",borderStyle:"solid",borderWidth:"md",borderRadius:"md",display:"block",outline:"none",width:"100%"};function j({children:e,field:t,fieldData:o,fieldState:i}){let{id:n,label:r,placeholder:a}=o,{error:s}=i,d={id:n,...t,...a?{placeholder:a}:{},...se,"aria-invalid":!!s,value:t.value??""};return jsxRuntime.jsxs(l,{part:"field",children:[jsxRuntime.jsx(Dt,{id:n,required:!!o.required,children:r}),e(d),jsxRuntime.jsx(kt,{error:s})]})}var Kr=()=>jsxRuntime.jsx(l,{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"})}),Ur=Re__namespace.forwardRef(({label:e,value:t},o)=>jsxRuntime.jsxs(l,{as:"label",backgroundColor:"neutral.background",borderColor:"neutral.border",borderRadius:"md",borderStyle:"solid",borderWidth:"md",display:"flex",htmlFor:t,justifyContent:"space-between",part:"field-radio",px:4,py:2,children:[jsxRuntime.jsx(f.Body2,{part:"field-radio-label",children:e}),jsxRuntime.jsx(oe__namespace.Item,{id:t,value:t,ref:o,asChild:!0,children:jsxRuntime.jsx(l,{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(l,{as:oe__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(Kr,{})})})})]}));function It(e){let{field:{onChange:t,value:o},fieldData:{options:i=[]}}=e,n=i.map(({label:r,value:a})=>jsxRuntime.jsx(Ur,{value:a,label:r},a));return jsxRuntime.jsx(j,{...e,children:()=>jsxRuntime.jsx(oe__namespace.Root,{value:o,onValueChange:t,asChild:!0,children:jsxRuntime.jsx(g.Column,{gap:2,part:"field-radio-group",children:n})})})}var Jr=Re__namespace.forwardRef(({label:e,value:t},o)=>jsxRuntime.jsx(S__namespace.Item,{value:t,ref:o,asChild:!0,children:jsxRuntime.jsx(l,{"backgroundColor:hover":"blue900",borderRadius:"md",outline:"none",part:"field-select-option",px:"3",py:"2",children:jsxRuntime.jsx(S__namespace.ItemText,{asChild:!0,children:jsxRuntime.jsx(f.Body2,{part:"field-select-option-label",children:e})})})}));function At(e){let{field:{onChange:t,value:o},fieldData:{options:i=[],placeholder:n}}=e,r=i.map(({label:a,value:s})=>jsxRuntime.jsx(Jr,{value:s,label:a},s));return jsxRuntime.jsx(j,{...e,children:()=>jsxRuntime.jsxs(S__namespace.Root,{value:o,onValueChange:t,children:[jsxRuntime.jsx(S__namespace.Trigger,{asChild:!0,children:jsxRuntime.jsxs(f.Body2,{...se,alignItems:"center",display:"flex",justifyContent:"space-between",part:"field-select",children:[jsxRuntime.jsx(S__namespace.Value,{placeholder:n??"Select one"}),jsxRuntime.jsx(S__namespace.Icon,{children:jsxRuntime.jsx(l,{as:outline.ChevronDownIcon,color:"gray100",display:"block",height:"24px",part:"field-select-icon",width:"24px"})})]})}),jsxRuntime.jsx(S__namespace.Portal,{children:jsxRuntime.jsx(S__namespace.Content,{position:"popper",sideOffset:4,asChild:!0,children:jsxRuntime.jsx(l,{...se,p:"1",part:"field-select-options",width:"var(--radix-popper-anchor-width)",children:jsxRuntime.jsx(S__namespace.Viewport,{children:r})})})})]})})}function Vt(e){return jsxRuntime.jsx(j,{...e,children:t=>jsxRuntime.jsx(f.Body2,{as:"input",part:"field-text",type:"text",...t})})}function Nt(e){return jsxRuntime.jsx(j,{...e,children:t=>jsxRuntime.jsx(f.Body2,{as:"textarea",part:"field-textarea",...t})})}var qr={radio:It,select:At,text:Vt,textarea:Nt};function He({fieldTypes:e={},flowId:t,...o}){let i=Object.assign({},qr,e);return jsxRuntime.jsx(H,{flowId:t,part:"form",...o,children:n=>jsxRuntime.jsx(vt,{fieldTypes:i,...n})})}var Ut={};N(Ut,{NPS:()=>Kt});function jt({field:e}){let t=[...Array(11)].map((o,i)=>{let n=e.value===i?h.Primary:h.Secondary;return jsxRuntime.jsx(n,{borderWidth:"1px",onClick:()=>e.onChange(i),title:`${i}`},i)});return jsxRuntime.jsx(g.Row,{gap:2,justifyContent:"space-between",part:"field-nps",children:t})}var O="24px";function Q({children:e,align:t,...o}){function i(){switch(t){case"top":return {top:O,left:"50%",transform:"translate(-50%, 0)"};case"bottom":return {bottom:O,left:"50%",transform:"translate(-50%, 0)"};case"left":return {top:"50%",left:O,transform:"translate(0, -50%)"};case"right":return {top:"50%",right:O,transform:"translate(0, -50%)"};case"top-left":return {top:O,left:O};case"top-right":return {top:O,right:O};case"bottom-left":return {bottom:O,left:O};case"bottom-right":return {bottom:O,right:O}}return {top:"50%",transform:"translate(-50%, -50%)"}}return jsxRuntime.jsx(w__namespace.Root,{defaultOpen:!0,modal:!0,children:jsxRuntime.jsx(w__namespace.Portal,{children:jsxRuntime.jsx(l,{inset:"0",position:"fixed",zIndex:"9999",width:"100vw",height:"100vh",children:jsxRuntime.jsx(w__namespace.Content,{asChild:!0,onOpenAutoFocus:n=>n.preventDefault(),onPointerDownOutside:n=>n.preventDefault(),children:jsxRuntime.jsx(u,{boxShadow:"md",p:8,part:"modal",...i(),...o,position:"fixed",children:e})})})})})}Q.Dismiss=e=>jsxRuntime.jsx(w__namespace.Close,{"aria-label":"Close",asChild:!0,children:jsxRuntime.jsx(h.Plain,{part:"close",position:"absolute",right:"-4px",top:"4px",...e,children:jsxRuntime.jsx(solid.XMarkIcon,{height:"24",fill:"currentColor"})})});Q.Subtitle=({children:e,...t})=>jsxRuntime.jsx(w__namespace.Description,{asChild:!0,children:jsxRuntime.jsx(f.Body2,{part:"subtitle",...t,children:e})});Q.Secondary=({onClick:e,title:t,...o})=>t==null?null:jsxRuntime.jsx(h.Secondary,{title:t,onClick:e,...o});Q.Title=({children:e,...t})=>jsxRuntime.jsx(w__namespace.Title,{asChild:!0,children:jsxRuntime.jsx(f.H3,{part:"title",...t,children:e})});Q.displayName="Modal";function Kt({as:e=Q,flowId:t,fieldTypes:o,...i}){return jsxRuntime.jsx(He,{as:e,flowId:t,fieldTypes:{nps:jt,...o},minWidth:"620px",width:"620px",align:"bottom",...i})}function fe(){let e="DOMRect"in globalThis?new DOMRect:{height:0,width:0,x:0,y:0,bottom:0,top:0,right:0,left:0,toJSON:()=>{}},[t,o]=Re.useState(e),[i,n]=Re.useState(null),r=Re.useCallback(a=>{n(a);},[]);return Re.useLayoutEffect(()=>{if(!i)return;let a=()=>{let s=i.getBoundingClientRect();o(s);};return a(),window.addEventListener("resize",a),()=>window.removeEventListener("resize",a)},[i]),{node:i,rect:t,ref:r}}var on=react.keyframes({"0%":{opacity:.5,transform:"scale(0.5)"},"50%":{opacity:0,transform:"scale(1)"},"100%":{opacity:0,transform:"scale(1)"}});function Jt({style:e={},part:t="",...o}){return jsxRuntime.jsxs(l,{part:`dot-wrapper ${t}`,style:{height:"48px",position:"absolute",width:"48px",...e},...o,children:[jsxRuntime.jsx(l,{backgroundColor:"primary.surface",part:"dot-pulse",css:{animation:`2s ease-out infinite ${on}`,borderRadius:"24px",height:"48px",left:0,position:"absolute",top:0,transformOrigin:"center center",width:"48px"}}),jsxRuntime.jsx(l,{backgroundColor:"primary.surface",part:"dot",style:{borderRadius:"12px",height:"24px",left:"12px",position:"absolute",top:"12px",width:"24px"}})]})}function qt({props:e,alignAttr:t,sideAttr:o}){let i=o??"bottom",n={},r=()=>{if(["after","before"].includes(e.align)){if(t=="start")return "before";if(t=="end")return "after"}return e.align??"after"},a="-24px",s={top:"bottom",right:"left",bottom:"top",left:"right"};n[s[i]]=a;let d=r();return ["before","end"].includes(d)?["top","bottom"].includes(i)?n.right=a:n.bottom=a:["after","start"].includes(d)?["top","bottom"].includes(i)?n.left=a:n.top=a:["top","bottom"].includes(i)?n.left=`calc(50% + ${a})`:n.top=`calc(50% + ${a})`,n}var ge={content:["align","alignOffset","arrowPadding","avoidCollisions","collisionBoundary","collisionPadding","forceMount","hideWhenDetached","onCloseAutoFocus","onEscapeKeyDown","onFocusOutside","onInteractOutside","onOpenAutoFocus","onPointerDownOutside","side","sideOffset","sticky"],root:["defaultOpen","modal","onOpenChange","open"]};function Yt(e,t){let o=Object.fromEntries(ge.content.map(r=>[r,e[r]]).filter(r=>r[1]!==void 0)),i=Object.fromEntries(ge.root.map(r=>[r,e[r]]).filter(r=>r[1]!==void 0)),n={};for(let r of Object.keys(e))!ge.content.includes(r)&&!ge.root.includes(r)&&(n[r]=e[r]);if(o.align=o.align??"after",o.side=o.side??"bottom",["before","after"].includes(o.align)){let r={after:"end",before:"start"},a=(c,F)=>["top","bottom"].includes(F)?c=="after"?"marginLeft":"marginRight":c=="after"?"marginTop":"marginBottom",s=o.alignOffset??0,d=o.style??{},m=o.side??"bottom",x=o.align;o.style={...d,[a(x,m)]:s};let b=["top","bottom"].includes(m)?t.width:t.height;o.alignOffset=(b+s)*-1,o.align=r[x];}return {contentProps:o,otherProps:n,rootProps:i}}function T({anchor:e,children:t,className:o,spotlight:i=!1,style:n,...r}){let{node:a,rect:s,ref:d}=fe(),{node:m,rect:x,ref:b}=fe(),{contentProps:c,otherProps:F,rootProps:ee}=Yt(r,s),[K,ye]=Re.useState(c.align),[le,re]=Re.useState(c.side),[he,be]=Re.useState(0),[Le,eo]=Re.useState(0);if(a!==null){let $=a.getAttribute("data-align"),pe=a.getAttribute("data-side");K!==$&&ye($),le!==pe&&re(pe);}let Ve=Re.useRef(null);if(Re.useEffect(()=>{let $=document.querySelector(e);$!=null?(b($),Ve.current=$):console.debug(`No anchor found for query: ${e}`);},[e]),Re.useEffect(()=>{let{scrollX:$,scrollY:pe}=window;be(x.left+$),eo(x.top+pe);},[x.left,x.top]),m==null)return null;let $e="0";typeof window<"u"&&($e=window.getComputedStyle(m).borderRadius);let to=qt({props:r,alignAttr:K,sideAttr:le});return jsxRuntime.jsxs(W__namespace.Root,{defaultOpen:!0,...ee,children:[jsxRuntime.jsx(W__namespace.Anchor,{virtualRef:Ve}),jsxRuntime.jsx(W__namespace.Portal,{children:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[i&&jsxRuntime.jsx(l,{part:"tooltip-spotlight",position:"absolute",style:{borderRadius:$e,boxShadow:"0 0 0 20000px rgb(0 0 0 / 0.5)",height:x.height,left:he,top:Le,width:x.width}}),jsxRuntime.jsx(W__namespace.Content,{asChild:!0,...c,ref:d,children:jsxRuntime.jsxs(u,{boxShadow:"md",part:"tooltip",position:"relative",className:o,css:{maxWidth:"360px",pointerEvents:"auto"},style:n,...F,children:[jsxRuntime.jsx(Jt,{style:to}),t]})})]})})]})}T.Close=e=>jsxRuntime.jsx(W__namespace.Close,{"aria-label":"Close",asChild:!0,children:jsxRuntime.jsx(h.Plain,{css:{top:"12px",right:"4px"},part:"close",position:"absolute",...e,children:jsxRuntime.jsx(solid.XMarkIcon,{height:"24",fill:"currentColor"})})});T.Media=({src:e,...t})=>e==null?null:jsxRuntime.jsx(J,{borderRadius:"md md 0 0",borderWidth:"0",css:{aspectRatio:"2",objectFit:"cover"},margin:"-5 -5 0",src:e,...t});T.Primary=({onClick:e,title:t,...o})=>t==null?null:jsxRuntime.jsx(h.Primary,{title:t,onClick:e,...o});T.Progress=({children:e,...t})=>e==null?null:jsxRuntime.jsx(f.H4,{part:"progress",...t,children:e});T.Secondary=({onClick:e,title:t,...o})=>t==null?null:jsxRuntime.jsx(h.Secondary,{title:t,onClick:e,...o});T.Subtitle=({children:e,...t})=>e==null?null:jsxRuntime.jsx(f.Body2,{part:"subtitle",...t,children:e});T.Title=({children:e,...t})=>e==null?null:jsxRuntime.jsx(f.H4,{part:"title",...t,children:e});function Zt({dismissible:e=!0,flow:t,onDismiss:o,onPrimary:i,onSecondary:n,step:r,...a}){let{handleDismiss:s}=U(t,{onDismiss:o}),{handlePrimary:d,handleSecondary:m}=G(r,{onPrimary:i,onSecondary:n});return jsxRuntime.jsxs(T,{anchor:r.selector,onOpenAutoFocus:x=>x.preventDefault(),onPointerDownOutside:x=>x.preventDefault(),onInteractOutside:x=>x.preventDefault(),...a,children:[e&&jsxRuntime.jsx(T.Close,{onClick:s}),jsxRuntime.jsx(T.Media,{src:r.videoUri??r.imageUri,type:r.videoUri?"video":"image"}),jsxRuntime.jsxs(g.Column,{gap:1,part:"tooltip-header",children:[jsxRuntime.jsx(T.Title,{children:r.title}),jsxRuntime.jsx(T.Subtitle,{color:"gray500",children:r.subtitle})]}),jsxRuntime.jsxs(g.Row,{alignItems:"center",gap:3,justifyContent:"flex-end",part:"tooltip-footer",children:[jsxRuntime.jsx(T.Progress,{marginRight:"auto",transform:"translateY(1px)",children:`${t.getNumberOfCompletedSteps()+1}/${t.getNumberOfAvailableSteps()}`}),jsxRuntime.jsx(T.Secondary,{title:r.secondaryButtonTitle,onClick:m}),jsxRuntime.jsx(T.Primary,{title:r.primaryButtonTitle,onClick:d})]})]},r.id)}function pn({flowId:e,onComplete:t,variables:o,...i}){let{flow:n}=ie(e,{variables:o});U(n,{onComplete:t});let{isCurrentModal:r,removeModal:a}=ae(n);if(Re.useEffect(()=>{!(n!=null&&n.isVisible)&&r&&a();},[n==null?void 0:n.isVisible,r]),n==null||n.isVisible===!1||!r)return null;let s=n.getCurrentStep();return s==null||s.start(),jsxRuntime.jsx(Zt,{step:s,flow:n,...i})}function mn(){let{frigade:e}=Re.useContext(v);return {frigade:e,isLoading:!(e!=null&&e.isReady())}}function fn(){let{userId:e,frigade:t}=Re.useContext(v);async function o(n){await t.identify(e,n);}async function i(n,r){await t.track(n,r);}return {userId:e,addProperties:o,track:i}}function xn(){let{groupId:e,frigade:t}=Re.useContext(v);async function o(n){if(!e){console.error("No Group ID is set. Cannot set properties without a Group ID.");return}await t.group(e,n);}async function i(n,r){await t.track(n,r);}return {groupId:e,addProperties:o,track:i}}
|
|
67
67
|
|
|
68
68
|
Object.defineProperty(exports, 'Flow', {
|
|
69
69
|
enumerable: true,
|