@frigade/react 2.4.18 → 2.4.19
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 +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -7
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1417,18 +1417,12 @@ interface DialogContentProps extends Pick<RadixDialog.DialogContentProps, 'onOpe
|
|
|
1417
1417
|
interface DialogRootProps extends RadixDialog.DialogProps {
|
|
1418
1418
|
}
|
|
1419
1419
|
interface DialogProps extends BoxPropsWithoutChildren, DialogRootProps, DialogContentProps {
|
|
1420
|
-
/**
|
|
1421
|
-
* Whether to display an overlay behind the Dialog.
|
|
1422
|
-
* @default true
|
|
1423
|
-
*/
|
|
1424
|
-
overlay?: boolean;
|
|
1425
1420
|
/**
|
|
1426
1421
|
* The modality of the dialog. When set to `true`, interaction with outside elements will be disabled and only dialog content will be visible to screen readers.
|
|
1427
|
-
* @default false
|
|
1428
1422
|
*/
|
|
1429
1423
|
modal?: boolean;
|
|
1430
1424
|
}
|
|
1431
|
-
declare function Dialog({ children, className,
|
|
1425
|
+
declare function Dialog({ children, className, modal, ...props }: DialogProps): _emotion_react_jsx_runtime.JSX.Element;
|
|
1432
1426
|
declare namespace Dialog {
|
|
1433
1427
|
var Dismiss: (props: ButtonProps) => _emotion_react_jsx_runtime.JSX.Element;
|
|
1434
1428
|
var Subtitle: ({ children, ...props }: TextProps) => _emotion_react_jsx_runtime.JSX.Element;
|
package/dist/index.js
CHANGED
|
@@ -43,7 +43,7 @@ var Vo=Object.defineProperty,Fr=Object.defineProperties;var vr=Object.getOwnProp
|
|
|
43
43
|
height: 0;
|
|
44
44
|
opacity: 0;
|
|
45
45
|
}
|
|
46
|
-
`,Hn=()=>jsx(y,{as:"svg",color:"primary.foreground",width:"10px",height:"8px",viewBox:"0 0 10 8",fill:"none",children:jsx("path",{d:"M1 4.34664L3.4618 6.99729L3.4459 6.98017L9 1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})});function Mn({checked:e=!1}){return jsx(y,{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&&jsx(y,{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:jsx(Hn,{})})})}function Po({children:e}){return jsx(we.Content,{asChild:!0,children:jsxs(P.Column,{css:{'&[data-state="open"]':{animation:`${On} 300ms ease-out`},'&[data-state="closed"]':{animation:`${In} 300ms ease-out`},overflow:"hidden"},gap:5,part:"collapsible-content",children:[jsx(y,{}),e]})})}function Co(a){var s=a,{children:e,disabled:o=!1,onOpenChange:t=()=>{},open:n=!1}=s,r=m(s,["children","disabled","onOpenChange","open"]);return jsx(we.Root,{asChild:!0,disabled:o,open:n,onOpenChange:t,children:jsx(b,l(i({borderWidth:"md",css:{'&[data-state="open"] .fr-collapsible-step-icon':{transform:"rotate(180deg)"}},gap:0,part:"collapsible-step"},r),{children:e}))})}function So({isCompleted:e,isBlocked:o,title:t}){return jsx(we.Trigger,{asChild:!0,children:jsxs(P.Row,{alignItems:"center",justifyContent:"space-between",margin:-5,padding:5,zIndex:1,opacity:o?.4:1,disabled:o,pointerEvents:o?"none":"auto",cursor:o?"not-allowed":"pointer",part:"collapsible-header",children:[jsxs(P.Row,{alignItems:"center",gap:2,children:[jsx(Mn,{checked:e}),jsx(C.Body2,{fontWeight:"demibold",userSelect:"none",part:"collapsible-title",children:t})]}),jsx(y,{as:Dt,color:"neutral.100",css:{"& path":{vectorEffect:"non-scaling-stroke"}},display:"block",height:"16px",order:2,part:"collapsible-step-icon",width:"16px"})]})})}var Ot=createContext({onPrimary:()=>{},onSecondary:()=>{},openStepId:null,setOpenStepId:()=>{},stepTypes:{}});function It({handlePrimary:e,handleSecondary:o,open:t,onOpenChange:n,step:r}){var F,S,T,v,k,E;let{$state:{blocked:a,completed:s,skipped:d},subtitle:c,title:u}=r,g=(S=(F=r.primaryButton)==null?void 0:F.title)!=null?S:r.primaryButtonTitle,f=(v=(T=r.secondaryButton)==null?void 0:T.title)!=null?v:r.secondaryButtonTitle,x=(k=r.props)!=null?k:{},h=!!a;return jsxs(Co,l(i({open:t,onOpenChange:n},x),{children:[jsx(So,{isBlocked:r.$state.blocked,isCompleted:s||d,title:u}),jsxs(Po,{children:[jsx(b.Media,{aspectRatio:2.5,objectFit:"cover",overflowClipMargin:"unset",src:(E=r.videoUri)!=null?E:r.imageUri,transform:"translate3d(0, 0, 1px)",type:r.videoUri?"video":"image"}),jsx(b.Subtitle,{color:"neutral.400",children:c}),jsxs(P.Row,{gap:3,part:"collapsible-footer",children:[jsx(b.Secondary,{title:f,onClick:o}),jsx(b.Primary,{disabled:h,title:g,onClick:e})]})]})]}))}var Vn={default:It};function $n(n){var r=n,{flow:e,step:o}=r,t=m(r,["flow","step"]);var S;let{onPrimary:a,onSecondary:s,openStepId:d,setOpenStepId:c,stepTypes:u}=useContext(Ot),{handlePrimary:g,handleSecondary:f}=ne(o,{onPrimary:a,onSecondary:s}),x=(d!=null?d:e.getCurrentStep().id)===o.id,h=(S=u[o.type])!=null?S:It;function F(T){return $(this,null,function*(){c(T?o.id:""),T&&!o.$state.completed&&(yield o.start(),c(null));})}return jsx(h,l(i({flow:e,onOpenChange:F,open:x,step:o},t),{handlePrimary:g,handleSecondary:f}),o.id)}function Xe(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]=useState(null),f=i(i({},Vn),a);return jsx(Ot.Provider,{value:{openStepId:u,setOpenStepId:g,onPrimary:t,onSecondary:n,stepTypes:f},children:jsx(U,l(i({as:b,borderWidth:"md",flowId:o,part:["checklist",r]},s),{children:S=>{var T=S,{flow:x,handleDismiss:h}=T,F=m(T,["flow","handleDismiss"]);let k=Array.from(x.steps.entries()).filter(([,w])=>w.$state.visible===!0).map(([,w])=>jsx($n,l(i({flow:x,handleDismiss:h},F),{step:w}),w.id)),E=x.getNumberOfCompletedSteps(),B=x.getNumberOfAvailableSteps();return jsxs(Fragment,{children:[jsxs(P.Column,{gap:2,children:[jsx(b.Header,{dismissible:e,handleDismiss:h,part:"checklist-header",subtitle:x.subtitle,title:x.title}),jsxs(P.Row,{alignItems:"center",gap:2,children:[jsxs(C.Body2,{fontWeight:"demibold",children:[E,"/",B]}),jsx(Ce,{current:E,total:B,flexGrow:1})]})]}),k]})}}))})}var Xn=new Set(["required","min","max","minLength","maxLength","pattern"]);function qn({fieldComponent:e,control:o,fieldData:t,submit:n}){let r=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])=>Xn.has(d))),s=useController({name:t.id,control:o,rules:a});return jsx(e,l(i({},s),{fieldData:t,formContext:r,submit:n}))}function Mt({fieldTypes:e,handleDismiss:o,handlePrimary:t,handleSecondary:n,parentProps:{dismissible:r},step:a}){var E,B,w,O,D,X;let{__readOnly:s}=useContext(M),d=((E=a.fields)!=null?E:[]).filter(V=>e[V.type]!=null&&V.id),c=useForm({delayError:2e3,mode:"onChange",defaultValues:d.reduce((V,j)=>{var le;return V[j.id]=(le=j.value)!=null?le:"",V},{})}),[u,g]=useState(!1),f=[],{control:x,handleSubmit:h}=c,F=(B=a.props)!=null?B:{};function S(V,j){g(!0),t(j,V,s===!0).then(()=>g(!1));}d.forEach(V=>{e[V.type]!=null&&f.push(jsx(qn,{control:x,fieldComponent:e[V.type],fieldData:V,submit:h(S)},`${a.flow.id}-${V.id}`));});let T=(O=(w=a.primaryButton)==null?void 0:w.title)!=null?O:a.primaryButtonTitle,v=(X=(D=a.secondaryButton)==null?void 0:D.title)!=null?X:a.secondaryButtonTitle,k=!!(a.$state.blocked||!c.formState.isValid);return useEffect(()=>{c.reset();},[a]),jsxs(P.Column,l(i({gap:5,part:"form-step"},F),{children:[jsx(b.Header,{dismissible:r,handleDismiss:o,part:"form-step-header",subtitle:a.subtitle,title:a.title}),jsx(FormProvider,l(i({},c),{children:f})),jsxs(P.Row,{part:"form-step-footer",justifyContent:"flex-end",gap:3,children:[v&&jsx(I.Secondary,{onClick:n,title:v}),jsx(I.Primary,{disabled:k||u,onClick:h(S),title:T!=null?T:"Submit",loading:u})]},`form-footer-${a.id}`)]}))}function Wt({error:e}){var o;return (o=e==null?void 0:e.message)!=null&&o.length?jsx(C.Caption,{color:"red500",display:"block",part:"field-error",mt:"1",textAlign:"end",children:e==null?void 0:e.message}):null}function wo({children:e,id:o,required:t=!1}){return jsxs(C.Body2,{as:"label",htmlFor:o,part:"field-label",fontWeight:"medium",mb:"2",display:"block",children:[e,jsx(y,{part:"field-label-required",display:"inline",children:t&&"*"})]})}var Fo={backgroundColor:"neutral.background",borderColor:"neutral.border",borderStyle:"solid",borderWidth:"md",borderRadius:"md"},Me=l(i({},Fo),{px:"4",py:"2",display:"block",outline:"none",width:"100%"}),Ye={alignItems:"center",bg:"primary.surface",borderWidth:"md",borderStyle:"solid",borderColor:"primary.border",borderRadius:"100%",display:"flex",height:"calc(100% + 2px)",justifyContent:"center",left:"-1px",position:"absolute",top:"-1px",width:"calc(100% + 2px)",color:"primary.foreground"};function Q({children:e,field:o,fieldData:t,fieldState:n}){var u;let{id:r,label:a,placeholder:s}=t,{error:d}=n,c=l(i(i(i({id:r},o),s?{placeholder:s}:{}),Me),{"aria-invalid":!!d,value:(u=o.value)!=null?u:""});return jsxs(y,{part:"field",children:[jsx(wo,{id:r,required:!!t.required,children:a}),e(c),jsx(Wt,{error:d})]})}function ve(e){return jsx("svg",l(i({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"size-5"},e),{children:jsx("path",{fillRule:"evenodd",d:"M16.704 4.153a.75.75 0 0 1 .143 1.052l-8 10.5a.75.75 0 0 1-1.127.075l-4.5-4.5a.75.75 0 0 1 1.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 0 1 1.05-.143Z",clipRule:"evenodd"})}))}var oi=yo.forwardRef(({label:e,value:o},t)=>jsxs(y,{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:[jsx(C.Body2,{part:"field-radio-label",children:e}),jsx(Te.Item,{id:o,value:o,ref:t,asChild:!0,children:jsx(y,{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:jsx(y,l(i({as:Te.Indicator},Ye),{children:jsx(ve,{height:"14",width:"14"})}))})})]}));function vo(e){let{field:{onChange:o,value:t},fieldData:{options:n=[]}}=e,r=n.map(({label:a,value:s})=>jsx(oi,{value:s,label:a},s));return jsx(Q,l(i({},e),{children:()=>jsx(Te.Root,{value:t,onValueChange:o,asChild:!0,children:jsx(P.Column,{gap:2,part:"field-radio-group",children:r})})}))}function Nt(e){return jsx("svg",l(i({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"size-5"},e),{children:jsx("path",{fillRule:"evenodd",d:"M5.22 8.22a.75.75 0 0 1 1.06 0L10 11.94l3.72-3.72a.75.75 0 1 1 1.06 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L5.22 9.28a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"})}))}function _t(e){let{field:{onChange:o,value:t},fieldData:{options:n=[]}}=e,[r,a]=yo.useState([]);function s(d){let c=[];r.includes(d)?c=[...r.filter(u=>u!==d)]:c=[...r,d],a(c),o(c);}return jsx(Q,l(i({},e),{children:()=>jsx(P.Column,{gap:2,part:"field-select-multiple",children:n.map(({label:d,value:c})=>jsx(Ze.Root,{value:r.includes(c)?c:void 0,onCheckedChange:()=>s(c),asChild:!0,children:jsxs(y,{as:"button",backgroundColor:"neutral.background",borderColor:"neutral.border",borderRadius:"md",borderStyle:"solid",borderWidth:"md",display:"flex",justifyContent:"space-between",part:"field-check",px:4,py:2,children:[jsx(C.Body2,{part:"field-check-label",children:d}),jsx(y,{backgroundColor:"inherit",borderWidth:"md",borderStyle:"solid",borderColor:"neutral.border",borderRadius:"100%",padding:"0",part:"field-check-value",position:"relative",height:"24px",width:"24px",children:jsx(Ze.Indicator,{asChild:!0,children:jsx(y,l(i({},Ye),{children:jsx(ve,{height:"14",width:"14"})}))})})]})},c))})}))}var ni=yo.forwardRef(({label:e,value:o},t)=>jsx(A.Item,{value:o,ref:t,asChild:!0,children:jsx(y,{"backgroundColor:hover":"neutral.900",borderRadius:"md",outline:"none",part:"field-select-option",px:"3",py:"2",children:jsx(A.ItemText,{asChild:!0,children:jsx(C.Body2,{part:"field-select-option-label",children:e})})})}));function To(e){let{field:{onChange:o,value:t},fieldData:{options:n=[],placeholder:r}}=e,a=n.map(({label:s,value:d})=>jsx(ni,{value:d,label:s},d));return e.fieldData.multiple?jsx(_t,i({},e)):jsx(Q,l(i({},e),{children:()=>jsxs(A.Root,{value:t,onValueChange:o,children:[jsx(A.Trigger,{asChild:!0,children:jsxs(C.Body2,l(i({},Me),{alignItems:"center",display:"flex",justifyContent:"space-between",part:"field-select",children:[jsx(A.Value,{placeholder:r!=null?r:"Select one"}),jsx(A.Icon,{children:jsx(y,{as:Nt,color:"neutral.100",display:"block",height:"24px",part:"field-select-icon",width:"24px"})})]}))}),jsx(A.Portal,{children:jsx(A.Content,{position:"popper",sideOffset:4,asChild:!0,children:jsx(y,l(i({},Me),{boxShadow:"md",maxHeight:"var(--radix-select-content-available-height)",p:"1",part:"field-select-options",width:"var(--radix-popper-anchor-width)",zIndex:"99999",children:jsx(A.Viewport,{children:a})}))})})]})}))}function Bo(e){return jsx(Q,l(i({},e),{children:o=>jsx(C.Body2,i({as:"input",part:"field-text",type:"text"},o))}))}function Ro(e){return jsx(Q,l(i({},e),{children:o=>jsx(C.Body2,i({as:"textarea",part:"field-textarea"},o))}))}function Jt(e){let{field:{onChange:o,value:t},fieldData:{options:n,label:r,id:a=[]}}=e;return jsxs(y,{part:"field",display:"flex",gap:2,alignItems:"center",children:[jsx(Ze.Root,{defaultChecked:!0,onCheckedChange:o,value:t,checked:t===!0,asChild:!0,children:jsx(y,l(i({},Fo),{as:"button",width:"25px",minWidth:"25px",height:"25px",justifyContent:"center",alignItems:"center",display:"flex","backgroundColor:hover":"neutral.900",part:"field-checkbox",id:a,children:jsx(Ze.Indicator,{asChild:!0,children:jsx(y,{width:"20px",height:"20px",display:"flex",alignItems:"center",justifyContent:"center",children:jsx(ve,{height:"14",fill:"currentColor"})})})}))}),jsx(C.Body2,{part:"field-checkbox-label",as:"label",htmlFor:a,children:r})]})}var ai={checkbox:Jt,radio:vo,select:To,text:Bo,textarea:Ro};function Re(r){var a=r,{fieldTypes:e={},flowId:o,part:t}=a,n=m(a,["fieldTypes","flowId","part"]);let s=Object.assign({},ai,e);return jsx(U,l(i({flowId:o,part:["form",t]},n),{children:d=>jsx(Mt,i({fieldTypes:s},d))}))}var oo={};oe(oo,{NPS:()=>Ae});function Yt({field:e,fieldData:o,submit:t}){var r,a;let n=[...Array(11)].map((s,d)=>{let c=e.value===d?I.Primary:I.Secondary;return jsx(c,{borderWidth:"1px",onClick:()=>{e.onChange(d),t();},title:`${d}`,css:{".fr-button-title":{fontSize:"15px"}}},d)});return jsxs(P.Column,{gap:2,children:[jsx(P.Row,{gap:2,part:"field-nps",css:{"@media (min-width: 660px)":{flexWrap:"nowrap",justifyContent:"space-between"},flexWrap:"wrap",justifyContent:"center"},children:n}),jsxs(P.Row,{justifyContent:"space-between",part:"field-nps-label",children:[jsx(C.Caption,{part:"field-nps-left-label",color:"neutral.400",children:(r=o.negativeLabel)!=null?r:"Not likely at all"}),jsx(C.Caption,{part:"field-nps-right-label",color:"neutral.400",children:(a=o.positiveLabel)!=null?a:"Extremely likely"})]})]})}function Ae(a){var s=a,{as:e=H,flowId:o,fieldTypes:t,part:n}=s,r=m(s,["as","flowId","fieldTypes","part"]);let{flow:d}=ae(o);return jsx(Re,i({alignSelf:"end",as:e,css:l(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"}}}),fieldTypes:i({nps:Yt},t),flowId:o,onEscapeKeyDown:c=>{typeof r.onEscapeKeyDown=="function"&&r.onEscapeKeyDown(c),c.defaultPrevented||d.skip();},overlay:!1,modal:!1,part:["nps",n]},r))}function xe(e,{onComplete:o,onDismiss:t}={}){let n=useRef(null);return useEffect(()=>{e!=null&&(e.isCompleted&&n.current===!1&&$(this,null,function*(){yield o==null?void 0:o(e);}),n.current=e==null?void 0:e.isCompleted);},[e==null?void 0:e.isCompleted]),{handleDismiss:useCallback(r=>$(this,null,function*(){if((yield t==null?void 0:t(e,r))===!1)return r.preventDefault(),!1;e.skip();}),[e])}}function to(){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]=useState(e),[n,r]=useState(null),a=useCallback(s=>{r(s);},[]);return 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 fi=keyframes({"0%":{opacity:.5,transform:"scale(0.5)"},"50%":{opacity:0,transform:"scale(1)"},"100%":{opacity:0,transform:"scale(1)"}});function er(n){var r=n,{style:e={},part:o=""}=r,t=m(r,["style","part"]);return jsxs(y,l(i({part:`dot-wrapper ${o}`,style:i({height:"48px",position:"absolute",width:"48px"},e)},t),{children:[jsx(y,{backgroundColor:"primary.surface",part:"dot-pulse",css:{animation:`2s ease-out infinite ${fi}`,borderRadius:"24px",height:"48px",left:0,position:"absolute",top:0,transformOrigin:"center center",width:"48px"}}),jsx(y,{backgroundColor:"primary.surface",part:"dot",style:{borderRadius:"12px",height:"24px",left:"12px",position:"absolute",top:"12px",width:"24px"}})]}))}function ro(n){var r=n,{part:e,src:o}=r,t=m(r,["part","src"]);return jsx(y,i({as:"img",maxWidth:"unset",part:["image",e],src:o},t))}function xi(e){var o,t,n,r,a;return e.includes("youtube")?`https://www.youtube.com/embed/${(o=e.split("v=")[1])==null?void 0:o.split("&")[0]}`:e.includes("youtu.be")?`https://www.youtube.com/embed/${(t=e.split("youtu.be/")[1])==null?void 0:t.split("&")[0]}`:e.includes("vimeo")?`https://player.vimeo.com/video/${(n=e.split("vimeo.com/")[1])==null?void 0:n.split("&")[0]}`:e.includes("wistia")?`https://fast.wistia.net/embed/iframe/${(r=e.split("wistia.com/medias/")[1])==null?void 0:r.split("&")[0]}`:e.includes("loom")?`https://loom.com/embed/${(a=e.split("loom.com/share/")[1])==null?void 0:a.split("&")[0]}?hideEmbedTopBar=true&hide_title=true&hide_share=true&hide_owner=true`:null}function no(n){var r=n,{part:e,src:o}=r,t=m(r,["part","src"]);let a=xi(o);return a?jsx(y,i({allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,as:"iframe",backgroundColor:"neutral.100",borderWidth:"0",part:["video",e],src:a},t)):o!=null&&o.endsWith(".mp4")?jsx(y,i({as:"video",controls:!0,part:["video",e],src:o},t)):(console.error(`Could not map videoUri ${o} to a known provider (Youtube, Vimeo, Wistia, Loom) or valid mp4 file.`),null)}function de(n){var r=n,{src:e,type:o}=r,t=m(r,["src","type"]);return jsx(o==="video"?no:ro,i({src:e},t))}function tr({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 io={content:["align","alignOffset","arrowPadding","avoidCollisions","collisionBoundary","collisionPadding","forceMount","hideWhenDetached","onCloseAutoFocus","onEscapeKeyDown","onFocusOutside","onInteractOutside","onOpenAutoFocus","onPointerDownOutside","side","sideOffset","sticky"],root:["defaultOpen","modal","onOpenChange","open"]};function rr(e,o){var a,s,d,c,u;let t=Object.fromEntries(io.content.map(g=>[g,e[g]]).filter(g=>g[1]!==void 0)),n=Object.fromEntries(io.root.map(g=>[g,e[g]]).filter(g=>g[1]!==void 0)),r={};for(let g of Object.keys(e))!io.content.includes(g)&&!io.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"},f=(v,k)=>["top","bottom"].includes(k)?v=="after"?"marginLeft":"marginRight":v=="after"?"marginTop":"marginBottom",x=(d=t.alignOffset)!=null?d:0,h=(c=t.style)!=null?c:{},F=(u=t.side)!=null?u:"bottom",S=t.align;t.style=l(i({},h),{[f(S,F)]:x});let T=["top","bottom"].includes(F)?o.width:o.height;t.alignOffset=(T+x)*-1,t.align=g[S];}return {contentProps:t,otherProps:r,rootProps:n}}var nr=keyframes`
|
|
46
|
+
`,Hn=()=>jsx(y,{as:"svg",color:"primary.foreground",width:"10px",height:"8px",viewBox:"0 0 10 8",fill:"none",children:jsx("path",{d:"M1 4.34664L3.4618 6.99729L3.4459 6.98017L9 1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})});function Mn({checked:e=!1}){return jsx(y,{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&&jsx(y,{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:jsx(Hn,{})})})}function Po({children:e}){return jsx(we.Content,{asChild:!0,children:jsxs(P.Column,{css:{'&[data-state="open"]':{animation:`${On} 300ms ease-out`},'&[data-state="closed"]':{animation:`${In} 300ms ease-out`},overflow:"hidden"},gap:5,part:"collapsible-content",children:[jsx(y,{}),e]})})}function Co(a){var s=a,{children:e,disabled:o=!1,onOpenChange:t=()=>{},open:n=!1}=s,r=m(s,["children","disabled","onOpenChange","open"]);return jsx(we.Root,{asChild:!0,disabled:o,open:n,onOpenChange:t,children:jsx(b,l(i({borderWidth:"md",css:{'&[data-state="open"] .fr-collapsible-step-icon':{transform:"rotate(180deg)"}},gap:0,part:"collapsible-step"},r),{children:e}))})}function So({isCompleted:e,isBlocked:o,title:t}){return jsx(we.Trigger,{asChild:!0,children:jsxs(P.Row,{alignItems:"center",justifyContent:"space-between",margin:-5,padding:5,zIndex:1,opacity:o?.4:1,disabled:o,pointerEvents:o?"none":"auto",cursor:o?"not-allowed":"pointer",part:"collapsible-header",children:[jsxs(P.Row,{alignItems:"center",gap:2,children:[jsx(Mn,{checked:e}),jsx(C.Body2,{fontWeight:"demibold",userSelect:"none",part:"collapsible-title",children:t})]}),jsx(y,{as:Dt,color:"neutral.100",css:{"& path":{vectorEffect:"non-scaling-stroke"}},display:"block",height:"16px",order:2,part:"collapsible-step-icon",width:"16px"})]})})}var Ot=createContext({onPrimary:()=>{},onSecondary:()=>{},openStepId:null,setOpenStepId:()=>{},stepTypes:{}});function It({handlePrimary:e,handleSecondary:o,open:t,onOpenChange:n,step:r}){var F,S,T,v,k,E;let{$state:{blocked:a,completed:s,skipped:d},subtitle:c,title:u}=r,g=(S=(F=r.primaryButton)==null?void 0:F.title)!=null?S:r.primaryButtonTitle,f=(v=(T=r.secondaryButton)==null?void 0:T.title)!=null?v:r.secondaryButtonTitle,x=(k=r.props)!=null?k:{},h=!!a;return jsxs(Co,l(i({open:t,onOpenChange:n},x),{children:[jsx(So,{isBlocked:r.$state.blocked,isCompleted:s||d,title:u}),jsxs(Po,{children:[jsx(b.Media,{aspectRatio:2.5,objectFit:"cover",overflowClipMargin:"unset",src:(E=r.videoUri)!=null?E:r.imageUri,transform:"translate3d(0, 0, 1px)",type:r.videoUri?"video":"image"}),jsx(b.Subtitle,{color:"neutral.400",children:c}),jsxs(P.Row,{gap:3,part:"collapsible-footer",children:[jsx(b.Secondary,{title:f,onClick:o}),jsx(b.Primary,{disabled:h,title:g,onClick:e})]})]})]}))}var Vn={default:It};function $n(n){var r=n,{flow:e,step:o}=r,t=m(r,["flow","step"]);var S;let{onPrimary:a,onSecondary:s,openStepId:d,setOpenStepId:c,stepTypes:u}=useContext(Ot),{handlePrimary:g,handleSecondary:f}=ne(o,{onPrimary:a,onSecondary:s}),x=(d!=null?d:e.getCurrentStep().id)===o.id,h=(S=u[o.type])!=null?S:It;function F(T){return $(this,null,function*(){c(T?o.id:""),T&&!o.$state.completed&&(yield o.start(),c(null));})}return jsx(h,l(i({flow:e,onOpenChange:F,open:x,step:o},t),{handlePrimary:g,handleSecondary:f}),o.id)}function Xe(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]=useState(null),f=i(i({},Vn),a);return jsx(Ot.Provider,{value:{openStepId:u,setOpenStepId:g,onPrimary:t,onSecondary:n,stepTypes:f},children:jsx(U,l(i({as:b,borderWidth:"md",flowId:o,part:["checklist",r]},s),{children:S=>{var T=S,{flow:x,handleDismiss:h}=T,F=m(T,["flow","handleDismiss"]);let k=Array.from(x.steps.entries()).filter(([,w])=>w.$state.visible===!0).map(([,w])=>jsx($n,l(i({flow:x,handleDismiss:h},F),{step:w}),w.id)),E=x.getNumberOfCompletedSteps(),B=x.getNumberOfAvailableSteps();return jsxs(Fragment,{children:[jsxs(P.Column,{gap:2,children:[jsx(b.Header,{dismissible:e,handleDismiss:h,part:"checklist-header",subtitle:x.subtitle,title:x.title}),jsxs(P.Row,{alignItems:"center",gap:2,children:[jsxs(C.Body2,{fontWeight:"demibold",children:[E,"/",B]}),jsx(Ce,{current:E,total:B,flexGrow:1})]})]}),k]})}}))})}var Xn=new Set(["required","min","max","minLength","maxLength","pattern"]);function qn({fieldComponent:e,control:o,fieldData:t,submit:n}){let r=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])=>Xn.has(d))),s=useController({name:t.id,control:o,rules:a});return jsx(e,l(i({},s),{fieldData:t,formContext:r,submit:n}))}function Mt({fieldTypes:e,handleDismiss:o,handlePrimary:t,handleSecondary:n,parentProps:{dismissible:r},step:a}){var E,B,w,O,D,X;let{__readOnly:s}=useContext(M),d=((E=a.fields)!=null?E:[]).filter(V=>e[V.type]!=null&&V.id),c=useForm({delayError:2e3,mode:"onChange",defaultValues:d.reduce((V,j)=>{var le;return V[j.id]=(le=j.value)!=null?le:"",V},{})}),[u,g]=useState(!1),f=[],{control:x,handleSubmit:h}=c,F=(B=a.props)!=null?B:{};function S(V,j){g(!0),t(j,V,s===!0).then(()=>g(!1));}d.forEach(V=>{e[V.type]!=null&&f.push(jsx(qn,{control:x,fieldComponent:e[V.type],fieldData:V,submit:h(S)},`${a.flow.id}-${V.id}`));});let T=(O=(w=a.primaryButton)==null?void 0:w.title)!=null?O:a.primaryButtonTitle,v=(X=(D=a.secondaryButton)==null?void 0:D.title)!=null?X:a.secondaryButtonTitle,k=!!(a.$state.blocked||!c.formState.isValid);return useEffect(()=>{c.reset();},[a]),jsxs(P.Column,l(i({gap:5,part:"form-step"},F),{children:[jsx(b.Header,{dismissible:r,handleDismiss:o,part:"form-step-header",subtitle:a.subtitle,title:a.title}),jsx(FormProvider,l(i({},c),{children:f})),jsxs(P.Row,{part:"form-step-footer",justifyContent:"flex-end",gap:3,children:[v&&jsx(I.Secondary,{onClick:n,title:v}),jsx(I.Primary,{disabled:k||u,onClick:h(S),title:T!=null?T:"Submit",loading:u})]},`form-footer-${a.id}`)]}))}function Wt({error:e}){var o;return (o=e==null?void 0:e.message)!=null&&o.length?jsx(C.Caption,{color:"red500",display:"block",part:"field-error",mt:"1",textAlign:"end",children:e==null?void 0:e.message}):null}function wo({children:e,id:o,required:t=!1}){return jsxs(C.Body2,{as:"label",htmlFor:o,part:"field-label",fontWeight:"medium",mb:"2",display:"block",children:[e,jsx(y,{part:"field-label-required",display:"inline",children:t&&"*"})]})}var Fo={backgroundColor:"neutral.background",borderColor:"neutral.border",borderStyle:"solid",borderWidth:"md",borderRadius:"md"},Me=l(i({},Fo),{px:"4",py:"2",display:"block",outline:"none",width:"100%"}),Ye={alignItems:"center",bg:"primary.surface",borderWidth:"md",borderStyle:"solid",borderColor:"primary.border",borderRadius:"100%",display:"flex",height:"calc(100% + 2px)",justifyContent:"center",left:"-1px",position:"absolute",top:"-1px",width:"calc(100% + 2px)",color:"primary.foreground"};function Q({children:e,field:o,fieldData:t,fieldState:n}){var u;let{id:r,label:a,placeholder:s}=t,{error:d}=n,c=l(i(i(i({id:r},o),s?{placeholder:s}:{}),Me),{"aria-invalid":!!d,value:(u=o.value)!=null?u:""});return jsxs(y,{part:"field",children:[jsx(wo,{id:r,required:!!t.required,children:a}),e(c),jsx(Wt,{error:d})]})}function ve(e){return jsx("svg",l(i({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"size-5"},e),{children:jsx("path",{fillRule:"evenodd",d:"M16.704 4.153a.75.75 0 0 1 .143 1.052l-8 10.5a.75.75 0 0 1-1.127.075l-4.5-4.5a.75.75 0 0 1 1.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 0 1 1.05-.143Z",clipRule:"evenodd"})}))}var oi=yo.forwardRef(({label:e,value:o},t)=>jsxs(y,{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:[jsx(C.Body2,{part:"field-radio-label",children:e}),jsx(Te.Item,{id:o,value:o,ref:t,asChild:!0,children:jsx(y,{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:jsx(y,l(i({as:Te.Indicator},Ye),{children:jsx(ve,{height:"14",width:"14"})}))})})]}));function vo(e){let{field:{onChange:o,value:t},fieldData:{options:n=[]}}=e,r=n.map(({label:a,value:s})=>jsx(oi,{value:s,label:a},s));return jsx(Q,l(i({},e),{children:()=>jsx(Te.Root,{value:t,onValueChange:o,asChild:!0,children:jsx(P.Column,{gap:2,part:"field-radio-group",children:r})})}))}function Nt(e){return jsx("svg",l(i({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"size-5"},e),{children:jsx("path",{fillRule:"evenodd",d:"M5.22 8.22a.75.75 0 0 1 1.06 0L10 11.94l3.72-3.72a.75.75 0 1 1 1.06 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L5.22 9.28a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"})}))}function _t(e){let{field:{onChange:o,value:t},fieldData:{options:n=[]}}=e,[r,a]=yo.useState([]);function s(d){let c=[];r.includes(d)?c=[...r.filter(u=>u!==d)]:c=[...r,d],a(c),o(c);}return jsx(Q,l(i({},e),{children:()=>jsx(P.Column,{gap:2,part:"field-select-multiple",children:n.map(({label:d,value:c})=>jsx(Ze.Root,{value:r.includes(c)?c:void 0,onCheckedChange:()=>s(c),asChild:!0,children:jsxs(y,{as:"button",backgroundColor:"neutral.background",borderColor:"neutral.border",borderRadius:"md",borderStyle:"solid",borderWidth:"md",display:"flex",justifyContent:"space-between",part:"field-check",px:4,py:2,children:[jsx(C.Body2,{part:"field-check-label",children:d}),jsx(y,{backgroundColor:"inherit",borderWidth:"md",borderStyle:"solid",borderColor:"neutral.border",borderRadius:"100%",padding:"0",part:"field-check-value",position:"relative",height:"24px",width:"24px",children:jsx(Ze.Indicator,{asChild:!0,children:jsx(y,l(i({},Ye),{children:jsx(ve,{height:"14",width:"14"})}))})})]})},c))})}))}var ni=yo.forwardRef(({label:e,value:o},t)=>jsx(A.Item,{value:o,ref:t,asChild:!0,children:jsx(y,{"backgroundColor:hover":"neutral.900",borderRadius:"md",outline:"none",part:"field-select-option",px:"3",py:"2",children:jsx(A.ItemText,{asChild:!0,children:jsx(C.Body2,{part:"field-select-option-label",children:e})})})}));function To(e){let{field:{onChange:o,value:t},fieldData:{options:n=[],placeholder:r}}=e,a=n.map(({label:s,value:d})=>jsx(ni,{value:d,label:s},d));return e.fieldData.multiple?jsx(_t,i({},e)):jsx(Q,l(i({},e),{children:()=>jsxs(A.Root,{value:t,onValueChange:o,children:[jsx(A.Trigger,{asChild:!0,children:jsxs(C.Body2,l(i({},Me),{alignItems:"center",display:"flex",justifyContent:"space-between",part:"field-select",children:[jsx(A.Value,{placeholder:r!=null?r:"Select one"}),jsx(A.Icon,{children:jsx(y,{as:Nt,color:"neutral.100",display:"block",height:"24px",part:"field-select-icon",width:"24px"})})]}))}),jsx(A.Portal,{children:jsx(A.Content,{position:"popper",sideOffset:4,asChild:!0,children:jsx(y,l(i({},Me),{boxShadow:"md",maxHeight:"var(--radix-select-content-available-height)",p:"1",part:"field-select-options",width:"var(--radix-popper-anchor-width)",zIndex:"99999",children:jsx(A.Viewport,{children:a})}))})})]})}))}function Bo(e){return jsx(Q,l(i({},e),{children:o=>jsx(C.Body2,i({as:"input",part:"field-text",type:"text"},o))}))}function Ro(e){return jsx(Q,l(i({},e),{children:o=>jsx(C.Body2,i({as:"textarea",part:"field-textarea"},o))}))}function Jt(e){let{field:{onChange:o,value:t},fieldData:{options:n,label:r,id:a=[]}}=e;return jsxs(y,{part:"field",display:"flex",gap:2,alignItems:"center",children:[jsx(Ze.Root,{defaultChecked:!0,onCheckedChange:o,value:t,checked:t===!0,asChild:!0,children:jsx(y,l(i({},Fo),{as:"button",width:"25px",minWidth:"25px",height:"25px",justifyContent:"center",alignItems:"center",display:"flex","backgroundColor:hover":"neutral.900",part:"field-checkbox",id:a,children:jsx(Ze.Indicator,{asChild:!0,children:jsx(y,{width:"20px",height:"20px",display:"flex",alignItems:"center",justifyContent:"center",children:jsx(ve,{height:"14",fill:"currentColor"})})})}))}),jsx(C.Body2,{part:"field-checkbox-label",as:"label",htmlFor:a,children:r})]})}var ai={checkbox:Jt,radio:vo,select:To,text:Bo,textarea:Ro};function Re(r){var a=r,{fieldTypes:e={},flowId:o,part:t}=a,n=m(a,["fieldTypes","flowId","part"]);let s=Object.assign({},ai,e);return jsx(U,l(i({flowId:o,part:["form",t]},n),{children:d=>jsx(Mt,i({fieldTypes:s},d))}))}var oo={};oe(oo,{NPS:()=>Ae});function Yt({field:e,fieldData:o,submit:t}){var r,a;let n=[...Array(11)].map((s,d)=>{let c=e.value===d?I.Primary:I.Secondary;return jsx(c,{borderWidth:"1px",onClick:()=>{e.onChange(d),t();},title:`${d}`,css:{".fr-button-title":{fontSize:"15px"}}},d)});return jsxs(P.Column,{gap:2,children:[jsx(P.Row,{gap:2,part:"field-nps",css:{"@media (min-width: 660px)":{flexWrap:"nowrap",justifyContent:"space-between"},flexWrap:"wrap",justifyContent:"center"},children:n}),jsxs(P.Row,{justifyContent:"space-between",part:"field-nps-label",children:[jsx(C.Caption,{part:"field-nps-left-label",color:"neutral.400",children:(r=o.negativeLabel)!=null?r:"Not likely at all"}),jsx(C.Caption,{part:"field-nps-right-label",color:"neutral.400",children:(a=o.positiveLabel)!=null?a:"Extremely likely"})]})]})}function Ae(a){var s=a,{as:e=H,flowId:o,fieldTypes:t,part:n}=s,r=m(s,["as","flowId","fieldTypes","part"]);let{flow:d}=ae(o);return jsx(Re,i({alignSelf:"end",as:e,flowId:o,fieldTypes:i({nps:Yt},t),modal:!1,onEscapeKeyDown:c=>{typeof r.onEscapeKeyDown=="function"&&r.onEscapeKeyDown(c),c.defaultPrevented||d.skip();},part:["nps",n],css:l(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 xe(e,{onComplete:o,onDismiss:t}={}){let n=useRef(null);return useEffect(()=>{e!=null&&(e.isCompleted&&n.current===!1&&$(this,null,function*(){yield o==null?void 0:o(e);}),n.current=e==null?void 0:e.isCompleted);},[e==null?void 0:e.isCompleted]),{handleDismiss:useCallback(r=>$(this,null,function*(){if((yield t==null?void 0:t(e,r))===!1)return r.preventDefault(),!1;e.skip();}),[e])}}function to(){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]=useState(e),[n,r]=useState(null),a=useCallback(s=>{r(s);},[]);return 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 fi=keyframes({"0%":{opacity:.5,transform:"scale(0.5)"},"50%":{opacity:0,transform:"scale(1)"},"100%":{opacity:0,transform:"scale(1)"}});function er(n){var r=n,{style:e={},part:o=""}=r,t=m(r,["style","part"]);return jsxs(y,l(i({part:`dot-wrapper ${o}`,style:i({height:"48px",position:"absolute",width:"48px"},e)},t),{children:[jsx(y,{backgroundColor:"primary.surface",part:"dot-pulse",css:{animation:`2s ease-out infinite ${fi}`,borderRadius:"24px",height:"48px",left:0,position:"absolute",top:0,transformOrigin:"center center",width:"48px"}}),jsx(y,{backgroundColor:"primary.surface",part:"dot",style:{borderRadius:"12px",height:"24px",left:"12px",position:"absolute",top:"12px",width:"24px"}})]}))}function ro(n){var r=n,{part:e,src:o}=r,t=m(r,["part","src"]);return jsx(y,i({as:"img",maxWidth:"unset",part:["image",e],src:o},t))}function xi(e){var o,t,n,r,a;return e.includes("youtube")?`https://www.youtube.com/embed/${(o=e.split("v=")[1])==null?void 0:o.split("&")[0]}`:e.includes("youtu.be")?`https://www.youtube.com/embed/${(t=e.split("youtu.be/")[1])==null?void 0:t.split("&")[0]}`:e.includes("vimeo")?`https://player.vimeo.com/video/${(n=e.split("vimeo.com/")[1])==null?void 0:n.split("&")[0]}`:e.includes("wistia")?`https://fast.wistia.net/embed/iframe/${(r=e.split("wistia.com/medias/")[1])==null?void 0:r.split("&")[0]}`:e.includes("loom")?`https://loom.com/embed/${(a=e.split("loom.com/share/")[1])==null?void 0:a.split("&")[0]}?hideEmbedTopBar=true&hide_title=true&hide_share=true&hide_owner=true`:null}function no(n){var r=n,{part:e,src:o}=r,t=m(r,["part","src"]);let a=xi(o);return a?jsx(y,i({allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,as:"iframe",backgroundColor:"neutral.100",borderWidth:"0",part:["video",e],src:a},t)):o!=null&&o.endsWith(".mp4")?jsx(y,i({as:"video",controls:!0,part:["video",e],src:o},t)):(console.error(`Could not map videoUri ${o} to a known provider (Youtube, Vimeo, Wistia, Loom) or valid mp4 file.`),null)}function de(n){var r=n,{src:e,type:o}=r,t=m(r,["src","type"]);return jsx(o==="video"?no:ro,i({src:e},t))}function tr({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 io={content:["align","alignOffset","arrowPadding","avoidCollisions","collisionBoundary","collisionPadding","forceMount","hideWhenDetached","onCloseAutoFocus","onEscapeKeyDown","onFocusOutside","onInteractOutside","onOpenAutoFocus","onPointerDownOutside","side","sideOffset","sticky"],root:["defaultOpen","modal","onOpenChange","open"]};function rr(e,o){var a,s,d,c,u;let t=Object.fromEntries(io.content.map(g=>[g,e[g]]).filter(g=>g[1]!==void 0)),n=Object.fromEntries(io.root.map(g=>[g,e[g]]).filter(g=>g[1]!==void 0)),r={};for(let g of Object.keys(e))!io.content.includes(g)&&!io.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"},f=(v,k)=>["top","bottom"].includes(k)?v=="after"?"marginLeft":"marginRight":v=="after"?"marginTop":"marginBottom",x=(d=t.alignOffset)!=null?d:0,h=(c=t.style)!=null?c:{},F=(u=t.side)!=null?u:"bottom",S=t.align;t.style=l(i({},h),{[f(S,F)]:x});let T=["top","bottom"].includes(F)?o.width:o.height;t.alignOffset=(T+x)*-1,t.align=g[S];}return {contentProps:t,otherProps:r,rootProps:n}}var nr=keyframes`
|
|
47
47
|
from {
|
|
48
48
|
opacity: 0;
|
|
49
49
|
}
|
|
@@ -63,7 +63,7 @@ var Vo=Object.defineProperty,Fr=Object.defineProperties;var vr=Object.getOwnProp
|
|
|
63
63
|
to {
|
|
64
64
|
opacity: 1;
|
|
65
65
|
}
|
|
66
|
-
`;function H(
|
|
66
|
+
`;function H(r){var a=r,{children:e,className:o,modal:t=!0}=a,n=m(a,["children","className","modal"]);let{rootProps:s,contentProps:d,otherProps:g}=Cr(n),f=g,{zIndex:c}=f,u=m(f,["zIndex"]);return jsx(G.Root,l(i({defaultOpen:!0,modal:t},s),{children:jsx(G.Portal,{children:jsxs(y,{animation:`${Zi} 300ms ease-out`,className:o,display:"grid",inset:"0",padding:"6",part:"dialog-wrapper",pointerEvents:"none",position:"fixed",zIndex:c!=null?c:10,children:[jsx(G.Overlay,{asChild:!0,children:jsx(y,{background:"rgb(0 0 0 / 0.5)",inset:"0",part:"dialog-overlay",position:"absolute"})}),jsx(G.Content,l(i({asChild:!0,onOpenAutoFocus:x=>x.preventDefault(),onPointerDownOutside:x=>x.preventDefault(),onInteractOutside:x=>x.preventDefault()},d),{children:jsx(b,l(i({alignSelf:"center",boxShadow:"md",justifySelf:"center",maxHeight:"100%",maxWidth:"430px",overflowY:"auto",padding:8,part:"dialog",pointerEvents:"auto",position:"relative"},u),{children:e}))}))]})})}))}H.Dismiss=e=>jsx(G.Close,{"aria-label":"Close",asChild:!0,children:jsx(I.Plain,l(i({part:"close",position:"absolute",right:"2px",top:"2px"},e),{children:jsx(Pe,{height:"20",fill:"currentColor"})}))});H.Subtitle=t=>{var n=t,{children:e}=n,o=m(n,["children"]);return jsx(G.Description,{asChild:!0,children:jsx(C.Body2,l(i({part:"subtitle"},o),{children:e}))})};H.Media=t=>{var n=t,{src:e}=n,o=m(n,["src"]);return e==null?null:jsx(de,i({borderRadius:"md",src:e},o))};H.Primary=n=>{var r=n,{onClick:e,title:o}=r,t=m(r,["onClick","title"]);return o==null?null:jsx(I.Primary,i({title:o,onClick:e},t))};H.ProgressDots=({current:e,total:o})=>{if(o==1)return null;let t=[...Array(o)].map((n,r)=>jsx(y,{as:"circle",r:4,cx:4+16*r,cy:"4px",fill:e===r?R.colors.primary.surface:R.colors.neutral[700],part:e===r?"progress-dot-selected":"progress-dot"},r));return jsx(y,{as:"svg",height:"8px",marginInline:"auto",part:"progress",viewBox:`0 0 ${16*o-8} 8`,width:16*o-8,children:t})};H.Secondary=n=>{var r=n,{onClick:e,title:o}=r,t=m(r,["onClick","title"]);return o==null?null:jsx(I.Secondary,i({title:o,onClick:e},t))};H.Title=t=>{var n=t,{children:e}=n,o=m(n,["children"]);return jsx(G.Title,{asChild:!0,children:jsx(C.H4,l(i({part:"title"},o),{children:e}))})};H.displayName="Dialog";var Sr=["dismissible","flowId","forceMount","onComplete","onDismiss","onPrimary","onSecondary","variables"];function Ho(n){var r=n,{flowId:e,part:o}=r,t=m(r,["flowId","part"]);let a=Object.fromEntries(Object.entries(t).filter(([d])=>Sr.some(c=>d===c))),s=Object.fromEntries(Object.entries(t).filter(([d])=>Sr.indexOf(d)===-1));return jsx(U,l(i({as:null,flowId:e},a),{children:({flow:d,handleDismiss:c,handlePrimary:u,handleSecondary:g,parentProps:{containerProps:f,dismissible:x},step:h})=>{var k,E,B,w,O,D;let F=(k=h.props)!=null?k:{},S=(B=(E=h.primaryButton)==null?void 0:E.title)!=null?B:h.primaryButtonTitle,T=(O=(w=h.secondaryButton)==null?void 0:w.title)!=null?O:h.secondaryButtonTitle,v=h.$state.blocked;return jsx(H,l(i(i({part:["announcement",o],textAlign:"center"},f),s),{onEscapeKeyDown:X=>{if(t.dismissible===!1){X.preventDefault();return}typeof t.onEscapeKeyDown=="function"&&t.onEscapeKeyDown(X),X.defaultPrevented||c(X);},children:jsxs(P.Column,l(i({gap:5,part:"announcement-step"},F),{children:[x&&jsx(H.Dismiss,{onClick:c}),jsxs(P.Column,{gap:1,part:"announcement-header",children:[jsx(H.Title,{children:h.title}),jsx(H.Subtitle,{children:h.subtitle})]}),jsx(H.Media,{aspectRatio:"1.5",objectFit:"cover",overflowClipMargin:"unset",src:(D=h.videoUri)!=null?D:h.imageUri,transform:"translate3d(0, 0, 1px)",type:h.videoUri?"video":"image",width:"100%"}),jsx(H.ProgressDots,{current:d.getCurrentStepIndex(),total:d.getNumberOfAvailableSteps()}),jsxs(P.Row,{css:{"& > button":{flexBasis:"50%",flexGrow:1}},gap:3,part:"announcement-footer",children:[T&&jsx(H.Secondary,{disabled:v,onClick:g,title:T}),S&&jsx(H.Primary,{disabled:v,onClick:u,title:S})]})]}))}))}}))}function oa(){let{userId:e,frigade:o}=useContext(M);function t(r){return $(this,null,function*(){yield o.identify(e,r);})}function n(r,a){return $(this,null,function*(){yield o.track(r,a);})}return {userId:e,addProperties:t,track:n}}function ra(){var r;let{frigade:e}=useContext(M);function o(a){return $(this,null,function*(){if(!e.config.groupId){console.error("No Group ID is set. Cannot set properties without a Group ID.");return}yield e.group(e.config.groupId,a);})}function t(a,s){return $(this,null,function*(){yield e.track(a,s);})}function n(a,s){return $(this,null,function*(){yield e.group(a,s);})}return {groupId:(r=e==null?void 0:e.config)==null?void 0:r.groupId,setGroupId:n,addProperties:o,track:t}}
|
|
67
67
|
|
|
68
68
|
export { Ho as Announcement, xo as Banner, Q as BaseField, y as Box, I as Button, b as Card, qe as Checklist, Io as Collection, H as Dialog, P as Flex, U as Flow, Re as Form, ro as Image, wo as Label, de as Media, Oe as Progress, yr as Provider, vo as RadioField, To as SelectField, oo as Survey, C as Text, Bo as TextField, Ro as TextareaField, N as Tooltip, Oo as Tour, no as Video, uo as themeVariables, Ge as tokens, to as useBoundingClientRect, ae as useFlow, xe as useFlowHandlers, Ve as useFrigade, ra as useGroup, Le as useModal, ne as useStepHandlers, oa as useUser };
|
|
69
69
|
//# sourceMappingURL=out.js.map
|