@frigade/react 2.0.0-alpha.9 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +48 -513
- package/dist/index.cjs +48 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1111 -87
- package/dist/index.js +15 -7
- package/dist/index.js.map +1 -1
- package/package.json +20 -4
package/dist/index.cjs
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var T = require('@radix-ui/react-dialog');
|
|
4
|
+
var solid = require('@heroicons/react/24/solid');
|
|
5
|
+
var me = require('react');
|
|
4
6
|
var clsx = require('clsx');
|
|
7
|
+
var kt = require('known-css-properties');
|
|
8
|
+
var Lt = require('dompurify');
|
|
5
9
|
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
6
10
|
var react = require('@emotion/react');
|
|
7
|
-
var solid = require('@heroicons/react/24/solid');
|
|
8
|
-
var v = require('@radix-ui/react-popover');
|
|
9
11
|
var js = require('@frigade/js');
|
|
12
|
+
var reactHookForm = require('react-hook-form');
|
|
13
|
+
var N = require('@radix-ui/react-radio-group');
|
|
14
|
+
var S = require('@radix-ui/react-select');
|
|
15
|
+
var outline = require('@heroicons/react/24/outline');
|
|
16
|
+
var k = require('@radix-ui/react-popover');
|
|
17
|
+
|
|
18
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
19
|
|
|
11
20
|
function _interopNamespace(e) {
|
|
12
21
|
if (e && e.__esModule) return e;
|
|
@@ -26,17 +35,43 @@ function _interopNamespace(e) {
|
|
|
26
35
|
return Object.freeze(n);
|
|
27
36
|
}
|
|
28
37
|
|
|
29
|
-
var
|
|
30
|
-
var
|
|
38
|
+
var T__namespace = /*#__PURE__*/_interopNamespace(T);
|
|
39
|
+
var me__namespace = /*#__PURE__*/_interopNamespace(me);
|
|
40
|
+
var kt__default = /*#__PURE__*/_interopDefault(kt);
|
|
41
|
+
var Lt__default = /*#__PURE__*/_interopDefault(Lt);
|
|
42
|
+
var N__namespace = /*#__PURE__*/_interopNamespace(N);
|
|
43
|
+
var S__namespace = /*#__PURE__*/_interopNamespace(S);
|
|
44
|
+
var k__namespace = /*#__PURE__*/_interopNamespace(k);
|
|
31
45
|
|
|
32
|
-
var Z=Object.defineProperty,Le=Object.defineProperties;var ze=Object.getOwnPropertyDescriptors;var $=Object.getOwnPropertySymbols;var ee=Object.prototype.hasOwnProperty,te=Object.prototype.propertyIsEnumerable;var Y=(e,t,o)=>t in e?Z(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,s=(e,t)=>{for(var o in t||(t={}))ee.call(t,o)&&Y(e,o,t[o]);if($)for(var o of $(t))te.call(t,o)&&Y(e,o,t[o]);return e},p=(e,t)=>Le(e,ze(t));var f=(e,t)=>{var o={};for(var r in e)ee.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&$)for(var r of $(e))t.indexOf(r)<0&&te.call(e,r)&&(o[r]=e[r]);return o};var oe=(e,t)=>{for(var o in t)Z(e,o,{get:t[o],enumerable:!0});};var C=(e,t,o)=>new Promise((r,n)=>{var i=u=>{try{c(o.next(u));}catch(d){n(d);}},l=u=>{try{c(o.throw(u));}catch(d){n(d);}},c=u=>u.done?r(u.value):Promise.resolve(u.value).then(i,l);c((o=o.apply(e,t)).next());});var re={borders:{md:"1px solid"},borderWidths:{0:"0",md:"1px"}};var ne={black:"#000000",gray100:"#14161A",gray200:"#181B20",gray300:"#1F2329",gray400:"#2E343D",gray500:"#4C5766",gray600:"#5A6472",gray700:"#C5CBD3",gray800:"#E2E5E9",gray900:"#F1F2F4",white:"#ffffff",blue400:"#015AC6",blue500:"#0171F8",blue800:"#DBECFF",blue900:"#F5F9FF",green400:"#009E37",green500:"#00D149",green800:"#DBFFE8",transparent:"#FFFFFF00",inherit:"inherit",red500:"#c00000"};var ie={md:"10px",lg:"20px",round:"50%"};var a=e=>`var(--fr-colors-${e})`,se={neutral:{background:a("white"),border:a("gray500"),foreground:a("black"),surface:a("gray700"),active:{background:a("white"),border:a("gray900"),foreground:a("black"),surface:a("gray700")},focus:{background:a("white"),border:a("gray900"),foreground:a("black"),surface:a("gray700")},hover:{background:a("white"),border:a("gray900"),foreground:a("black"),surface:a("gray700")}},primary:{background:a("blue500"),border:a("blue500"),foreground:a("white"),surface:a("blue500"),active:{background:a("blue400"),border:a("blue400"),foreground:a("white"),surface:a("blue400")},focus:{background:a("blue500"),border:a("blue500"),foreground:a("white"),surface:a("blue500")},hover:{background:a("blue400"),border:a("blue400"),foreground:a("white"),surface:a("blue400")}},secondary:{background:a("gray900"),border:a("gray900"),foreground:a("black"),surface:a("gray900"),active:{background:a("gray800"),border:a("gray800"),foreground:a("black"),surface:a("gray800")},focus:{background:a("gray900"),border:a("gray900"),foreground:a("black"),surface:a("gray900")},hover:{background:a("gray800"),border:a("gray800"),foreground:a("black"),surface:a("gray800")}}};var ae={md:"0px 4px 20px rgba(0, 0, 0, 0.1)"};var Ke="px",Ue=e=>typeof e=="number"?`${4*e}${Ke}`:e,Ne=[-20,-19,-18,-17,-16,-15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,-.5,0,.5,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,"auto"],le=Object.fromEntries(Ne.map(e=>[e,Ue(e)]));var pe={fontFamilies:{default:"TT Interphases Pro, sans-serif"},fontSizes:{xs:"12px",sm:"14px",md:"16px",lg:"18px",xl:"20px","2xl":"24px","3xl":"30px","4xl":"36px","5xl":"48px"},fontWeights:{thin:"100",extralight:"200",light:"300",regular:"400",medium:"500",demibold:"600",bold:"700",extrabold:"800",black:"900"},letterSpacings:{md:"0.02em"},lineHeights:{xs:"18px",sm:"22px",md:"24px",lg:"26px",xl:"30px","2xl":"38px","3xl":"46px","4xl":"60px"}};var L=p(s(p(s({},re),{colors:s(s({},ne),se)}),pe),{radii:ie,shadows:ae,space:le});function F(e,t="",o="."){return Object.keys(e).reduce((r,n)=>{let l=`${t.length?`${t}${o}`:""}${n}`,c=e[n];return typeof c=="object"&&c!==null&&!Array.isArray(c)?Object.assign(r,F(c,l,o)):r[l]=c,r},{})}function z(e){return F(e,"--fr","-")}function ce(e,t="--fr"){let o={};return Object.keys(e).forEach(r=>{let n=e[r];typeof n=="object"&&n!==null&&!Array.isArray(n)?o[r]=ce(n,`${t}-${r}`):o[r]=`var(${t}-${r})`;}),o}var de=z(L),m=ce(L);var K=F(m.colors),fe={color:K,backgroundColor:K,borderColor:K,border:m.borders,borderRadius:m.radii,borderWidth:m.borderWidths,fontFamily:m.fontFamilies,fontSize:m.fontSizes,fontWeight:m.fontWeights,gap:m.space,lineHeight:m.lineHeights,margin:m.space,marginTop:m.space,marginRight:m.space,marginBottom:m.space,marginLeft:m.space,padding:m.space,paddingTop:m.space,paddingRight:m.space,paddingBottom:m.space,paddingLeft:m.space,alignContent:["center","start","end","flex-start","flex-end","normal","baseline","first baseline","last baseline","space-between","space-around","space-evenly","stretch","safe center","unsafe center","inherit","initial","revert","revert-layer","unset"],alignItems:["normal","stretch","center","start","end","flex-start","flex-end","self-start","self-end","baseline","first baseline","last baseline","safe center","unsafe center","inherit","initial","revert","revert-layer","unset"],alignSelf:["auto","normal","center","start","end","self-start","self-end","flex-start","flex-end","baseline","first baseline","last baseline","stretch","safe center","unsafe center","inherit","initial","revert","revert-layer","unset"],flexDirection:["row","row-reverse","column","column-reverse","inherit","initial","revert","revert-layer","unset"],flexWrap:["nowrap","wrap","wrap-reverse","inherit","initial","revert","revert-layer","unset"],justifyContent:["center","start","end","flex-start","flex-end","left","right","normal","space-between","space-around","space-evenly","stretch","safe center","unsafe center","inherit","initial","revert","revert-layer","unset"],justifyItems:["normal","stretch","center","start","end","flex-start","flex-end","self-start","self-end","left","right","baseline","first baseline","last baseline","safe center","unsafe center","legacy right","legacy left","legacy center","inherit","initial","revert","revert-layer","unset"],boxSizing:["border-box","content-box","inherit","initial","revert","revert-layer","unset"],position:["static","relative","absolute","fixed","sticky","inherit","initial","revert","revert-layer","unset"],display:["block","block flex","block flow","block flow-root","block grid","contents","flex","flow-root","grid","inherit","initial","inline","inline flex","inline flow","inline flow-root","inline grid","inline-block","inline-flex","inline-grid","list-item","none","revert","revert-layer","table","table-row-group","table-header-group","table-footer-group","table-row","table-cell","table-column-group","table-column","table-caption","unset"]},ue={m:["margin"],mt:["marginTop"],mr:["marginRight"],mb:["marginBottom"],ml:["marginLeft"],mx:["marginLeft","marginRight"],my:["marginTop","marginBottom"],p:["padding"],pt:["paddingTop"],pr:["paddingRight"],pb:["paddingBottom"],pl:["paddingLeft"],px:["paddingLeft","paddingRight"],py:["paddingTop","paddingBottom"]};function _e(e){if(Array.isArray(e))return new Map(e.map(t=>[t,t]));if(typeof e=="object"&&e!==null)return new Map(Object.entries(e));if(["string","number"].includes(typeof e))return new Map([e,e]);throw new Error("Invalid entry in styleProps")}var Xe=new Map(Object.entries(fe).map(([e,t])=>[e,_e(t)])),qe=new Map(Object.entries(ue).map(([e,t])=>[e,new Set(t)]));function me(e){let t=Object.assign({},e),o={};return Object.entries(t).forEach(([r,n])=>{let i=qe.get(r);i!=null&&(i.forEach(l=>{t[l]=n;}),delete t[r]);}),Object.entries(t).forEach(([r,n])=>{let i=Xe.get(r);if(i!=null)if(typeof n=="string"&&n.indexOf(" ")>-1){let l=n.split(" ");o[r]=l.map(c=>{var u;return (u=i.get(c.toString()))!=null?u:c}).join(" "),delete t[r];}else i.has(n.toString())&&(o[r]=i.get(n.toString()),delete t[r]);}),{cssFromProps:o,unmatchedProps:t}}function ge(e){return e&&`fr-${e}`}function Je(e){return e&&(Array.isArray(e)?e.map(t=>ge(t)).join(" "):ge(e))}function Qe(l,i){var c=l,{as:e,children:t,className:o,part:r}=c,n=f(c,["as","children","className","part"]);let u=e!=null?e:"div",{cssFromProps:d,unmatchedProps:h}=me(n),y=Je(r),w=o||y?clsx.clsx(o,y):void 0;return jsxRuntime.jsx(u,p(s({className:w,css:[{boxSizing:"border-box"},d]},h),{ref:i,children:t}))}var g=___namespace.forwardRef(Qe);var U={};oe(U,{Body1:()=>it,Body2:()=>st,Caption:()=>at,Display1:()=>Ze,Display2:()=>et,H1:()=>tt,H2:()=>ot,H3:()=>rt,H4:()=>nt});var T={color:"neutral.foreground",fontFamily:"default",margin:0},Ze=p(s({},T),{fontSize:"5xl",fontWeight:"bold",lineHeight:"4xl"}),et=p(s({},T),{fontSize:"4xl",fontWeight:"bold",lineHeight:"3xl"}),tt=p(s({},T),{fontSize:"3xl",fontWeight:"bold",lineHeight:"2xl"}),ot=p(s({},T),{fontSize:"2xl",fontWeight:"bold",lineHeight:"xl"}),rt=p(s({},T),{fontSize:"xl",fontWeight:"bold",lineHeight:"lg"}),nt=p(s({},T),{fontSize:"lg",fontWeight:"bold",lineHeight:"md"}),it=p(s({},T),{fontSize:"md",fontWeight:"regular",lineHeight:"md"}),st=p(s({},T),{fontSize:"sm",fontWeight:"regular",lineHeight:"md"}),at=p(s({},T),{fontSize:"xs",fontWeight:"regular",lineHeight:"sm"});function be(n){var i=n,{as:e="span",children:t,variant:o="Body1"}=i,r=f(i,["as","children","variant"]);return jsxRuntime.jsx(g,p(s(s({as:e},U[o]),r),{children:t}))}var lt=["Display1","Display2","H1","H2","H3","H4","Body1","Body2","Caption"],pt=Object.fromEntries(lt.map(e=>{let t=["H1","H2","H3","H4"].includes(e)?e.toLowerCase():void 0,o=r=>jsxRuntime.jsx(be,p(s({as:t},r),{variant:e,children:r.children}));return o.displayName=`Text.${e}`,[e,o]})),B=Object.assign(be,pt);var N={};oe(N,{Link:()=>ft,Plain:()=>ut,Primary:()=>ct,Secondary:()=>dt,base:()=>O});var O=({radii:e,space:t})=>({borderWidth:0,borderRadius:e.md,padding:`${t[2]} ${t[4]}`}),ct=({colors:e})=>[O,{backgroundColor:e.primary.surface,color:e.primary.foreground,"&:hover":{backgroundColor:e.primary.hover.surface}}],dt=({colors:e})=>[O,{backgroundColor:e.secondary.surface,color:e.secondary.foreground,"&:hover":{backgroundColor:e.secondary.hover.surface}}],ft=({colors:e})=>[O,{backgroundColor:e.transparent,color:e.primary.surface,"&:hover":{color:e.primary.hover.surface}}],ut=({colors:e})=>[O,{backgroundColor:e.transparent,color:e.neutral.foreground}];function he(i){var l=i,{as:e,children:t,title:o,variant:r="Primary"}=l,n=f(l,["as","children","title","variant"]);return jsxRuntime.jsxs(g,p(s({as:e!=null?e:"button",css:N[r]},n),{children:[t,o&&jsxRuntime.jsx(B.Body2,{fontWeight:"demibold",color:"inherit",children:o})]}))}var mt=["Primary","Secondary","Link","Plain"],gt=Object.fromEntries(mt.map(e=>{let t=e.toLocaleLowerCase(),o=i=>{var l=i,{part:r}=l,n=f(l,["part"]);return jsxRuntime.jsx(he,p(s({part:[`button-${t}`,r]},n),{variant:e,children:n.children}))};return o.displayName=`Text.${e}`,[e,o]})),H=Object.assign(he,gt);var bt=___namespace.forwardRef((n,r)=>{var i=n,{children:e,css:t}=i,o=f(i,["children","css"]);return jsxRuntime.jsx(g,p(s({css:[{display:"flex",flexDirection:"row"},t]},o),{ref:r,children:e}))}),yt=___namespace.forwardRef((n,r)=>{var i=n,{children:e,css:t}=i,o=f(i,["children","css"]);return jsxRuntime.jsx(g,p(s({css:[{display:"flex",flexDirection:"column"},t]},o),{ref:r,children:e}))}),E={Column:yt,Row:bt};var S=_.createContext({apiKey:"",modals:[],setModals:()=>{},navigate:()=>{}});function wt(n){var i=n,{children:e,navigate:t,theme:o}=i,r=f(i,["children","navigate","theme"]);let l=o?z(o):{},[c,u]=_.useState([]),d=t!=null?t:(h,y="_self")=>{window.open(h,y);};return jsxRuntime.jsxs(S.Provider,{value:s({modals:c,setModals:u,navigate:d},r),children:[jsxRuntime.jsx(react.Global,{styles:{":root":s(s({},de),l)}}),jsxRuntime.jsx(react.ThemeProvider,{theme:m,children:e})]})}function Ce(){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]=_.useState(e),[r,n]=_.useState(null),i=_.useCallback(l=>{n(l);},[]);return _.useLayoutEffect(()=>{r&&o(r.getBoundingClientRect());},[r]),{node:r,rect:t,ref:i}}var kt=react.keyframes({"0%":{opacity:.5,transform:"scale(0.5)"},"50%":{opacity:0,transform:"scale(1)"},"100%":{opacity:0,transform:"scale(1)"}});function Se(r){var n=r,{style:e={},part:t=""}=n,o=f(n,["style","part"]);return jsxRuntime.jsxs(g,p(s({part:`dot-wrapper ${t}`,style:s({height:"48px",position:"absolute",width:"48px"},e)},o),{children:[jsxRuntime.jsx(g,{backgroundColor:"primary.surface",part:"dot-pulse",css:{animation:`2s ease-out infinite ${kt}`,borderRadius:"24px",height:"48px",left:0,position:"absolute",top:0,transformOrigin:"center center",width:"48px"}}),jsxRuntime.jsx(g,{backgroundColor:"primary.surface",part:"dot",style:{borderRadius:"12px",height:"24px",left:"12px",position:"absolute",top:"12px",width:"24px"}})]}))}function Re(r){var n=r,{part:e,src:t}=n,o=f(n,["part","src"]);return jsxRuntime.jsx(g,s({as:"img",part:["image",e],src:t},o))}function Ht(e){var t,o,r;if(e.includes("youtube"))return `https://www.youtube.com/embed/${(t=e.split("v=")[1])==null?void 0:t.split("&")[0]}`;if(e.includes("vimeo"))return `https://player.vimeo.com/video/${(o=e.split("vimeo.com/")[1])==null?void 0:o.split("&")[0]}`;if(e.includes("wistia"))return `https://fast.wistia.net/embed/iframe/${(r=e.split("wistia.com/medias/")[1])==null?void 0:r.split("&")[0]}`;throw new Error("Could not map videoUri to a known provider (Youtube, Vimeo, Wistia).")}function ke(r){var n=r,{part:e,src:t}=n,o=f(n,["part","src"]);let i=Ht(t);return jsxRuntime.jsx(g,s({allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,as:"iframe",backgroundColor:"gray100",borderWidth:0,part:["video",e],src:i},o))}function X(r){var n=r,{src:e,type:t}=n,o=f(n,["src","type"]);return jsxRuntime.jsx(t==="video"?ke:Re,s({src:e},o))}function Fe({props:e,alignAttr:t,sideAttr:o}){let r=o!=null?o:"bottom",n={},i=()=>{var d;if(["after","before"].includes(e.align)){if(t=="start")return "before";if(t=="end")return "after"}return (d=e.align)!=null?d:"after"},l="-24px",c={top:"bottom",right:"left",bottom:"top",left:"right"};n[c[r]]=l;let u=i();return ["before","end"].includes(u)?["top","bottom"].includes(r)?n.right=l:n.bottom=l:["after","start"].includes(u)?["top","bottom"].includes(r)?n.left=l:n.top=l:["top","bottom"].includes(r)?n.left=`calc(50% + ${l})`:n.top=`calc(50% + ${l})`,n}var Oe={content:["align","alignOffset","arrowPadding","avoidCollisions","collisionBoundary","collisionPadding","forceMount","hideWhenDetached","onCloseAutoFocus","onEscapeKeyDown","onFocusOutside","onInteractOutside","onOpenAutoFocus","onPointerDownOutside","side","sideOffset","sticky"],root:["defaultOpen","modal","onOpenChange","open"]};function He(e,t){var n,i,l,c,u;let o=Object.fromEntries(Oe.content.map(d=>[d,e[d]]).filter(d=>d[1]!==void 0)),r=Object.fromEntries(Oe.root.map(d=>[d,e[d]]).filter(d=>d[1]!==void 0));if(o.align=(n=o.align)!=null?n:"after",o.side=(i=o.side)!=null?i:"bottom",["before","after"].includes(o.align)){let d={after:"end",before:"start"},h=(A,I)=>["top","bottom"].includes(I)?A=="after"?"marginLeft":"marginRight":A=="after"?"marginTop":"marginBottom",y=(l=o.alignOffset)!=null?l:0,w=(c=o.style)!=null?c:{},P=(u=o.side)!=null?u:"bottom",M=o.align;o.style=p(s({},w),{[h(M,P)]:y});let D=["top","bottom"].includes(P)?t.width:t.height;o.alignOffset=(D+y)*-1,o.align=d[M];}return {contentProps:o,rootProps:r}}function x(l){var c=l,{anchor:e,children:t,className:o,spotlight:r=!1,style:n}=c,i=f(c,["anchor","children","className","spotlight","style"]);let{node:u,rect:d,ref:h}=Ce(),{contentProps:y,rootProps:w}=He(i,d),[P,M]=_.useState(y.align),[D,A]=_.useState(y.side);if(u!==null){let k=u.getAttribute("data-align"),Q=u.getAttribute("data-side");P!==k&&M(k),D!==Q&&A(Q);}let I=_.useRef(null),[V,$e]=_.useState(null);if(_.useEffect(()=>{let k=document.querySelector(e);k!=null&&(I.current=k,$e(I));},[e]),V==null)return null;let W=V.current.getBoundingClientRect(),J="0";typeof window!="undefined"&&(J=window.getComputedStyle(V.current).borderRadius);let je=Fe({props:i,alignAttr:P,sideAttr:D});return jsxRuntime.jsxs(v__namespace.Root,p(s({defaultOpen:!0},w),{children:[jsxRuntime.jsx(v__namespace.Anchor,{virtualRef:V}),jsxRuntime.jsx(v__namespace.Portal,{children:jsxRuntime.jsxs("div",{className:o,css:{position:"absolute",zIndex:9999},children:[r&&jsxRuntime.jsx(g,{borderRadius:J,part:"tooltip-spotlight",position:"absolute",css:{boxShadow:"0 0 0 2000px rgb(0 0 0 / 0.5)",height:W.height,left:W.left,top:W.top,width:W.width}}),jsxRuntime.jsx(v__namespace.Content,p(s({asChild:!0},y),{ref:h,children:jsxRuntime.jsxs(E.Column,{backgroundColor:"neutral.background",borderRadius:"md",p:5,part:"tooltip-content",position:"relative",css:s({boxShadow:"0px 4px 20px rgba(0, 0, 0, 0.1)",maxWidth:"360px"},n),children:[jsxRuntime.jsx(Se,{style:je}),t]})}))]})})]}))}x.Close=e=>jsxRuntime.jsx(v__namespace.Close,{"aria-label":"Close",asChild:!0,children:jsxRuntime.jsx(H.Plain,p(s({css:{top:"12px",right:"4px"},part:"tooltip-close",position:"absolute"},e),{children:jsxRuntime.jsx(solid.XMarkIcon,{height:"24",fill:"currentColor"})}))});x.Media=o=>{var r=o,{src:e}=r,t=f(r,["src"]);return e==null?null:jsxRuntime.jsx(X,s({borderRadius:"md md 0 0",borderWidth:"0",css:{aspectRatio:"2"},margin:"-5 -5 5",src:e},t))};x.Primary=r=>{var n=r,{onClick:e,title:t}=n,o=f(n,["onClick","title"]);return t==null?null:jsxRuntime.jsx(H.Primary,s({title:t,onClick:e},o))};x.Progress=o=>{var r=o,{children:e}=r,t=f(r,["children"]);return e==null?null:jsxRuntime.jsx(B.Body2,p(s({fontWeight:"demibold",part:"progress"},t),{children:e}))};x.Secondary=r=>{var n=r,{onClick:e,title:t}=n,o=f(n,["onClick","title"]);return t==null?null:jsxRuntime.jsx(H.Secondary,s({title:t,onClick:e},o))};x.Subtitle=o=>{var r=o,{children:e}=r,t=f(r,["children"]);return e==null?null:jsxRuntime.jsx(B.Body2,p(s({part:"subtitle"},t),{children:e}))};x.Title=o=>{var r=o,{children:e}=r,t=f(r,["children"]);return e==null?null:jsxRuntime.jsx(B.Body1,p(s({fontWeight:"bold",mb:1,part:"title"},t),{children:e}))};function Ee(e){let[t,o]=_.useState(),{apiKey:r,apiUrl:n,userId:i}=_.useContext(S),c=_.useRef(new js.Frigade(r,{apiUrl:n,userId:i})).current,u=d=>{if(d.id!==e)return;let h=Object.assign(Object.create(Object.getPrototypeOf(d)),d);o(h);};return _.useEffect(()=>(C(this,null,function*(){let d=yield c.getFlow(e);o(d);}),c.onStateChange(u),()=>{c.removeStateChangeHandler(u);}),[]),{flow:t}}function De(e){let{modals:t,setModals:o}=_.useContext(S),[r,n]=_.useState(!1);return _.useEffect(()=>(o([...t,e]),()=>o(t.filter(i=>i!==e))),[]),_.useEffect(()=>{let i=t[0]===e;i!==r&&n(i);},[t]),{isCurrentModal:r}}function j(e,{onComplete:t,onDismiss:o}={}){let r=_.useRef(null);return _.useEffect(()=>{e!=null&&(e.isCompleted&&r.current===!1&&t(e),r.current=e==null?void 0:e.isCompleted);},[e==null?void 0:e.isCompleted]),{handleDismiss:_.useCallback(n=>C(this,null,function*(){if((o==null?void 0:o(e,n))===!1)return n.preventDefault(),!1;yield e.skip();}),[e])}}function Ie(e,{onPrimary:t,onSecondary:o}={}){let{navigate:r}=_.useContext(S);return {handlePrimary:_.useCallback(n=>C(this,null,function*(){if((t==null?void 0:t(e,n))===!1)return n.preventDefault(),!1;yield e.complete(),e.primaryButtonUri!=null&&r(e.primaryButtonUri,e.primaryButtonUriTarget);}),[e]),handleSecondary:_.useCallback(n=>C(this,null,function*(){if((o==null?void 0:o(e,n))===!1)return n.preventDefault(),!1;yield e.complete(),e.secondaryButtonUri!=null&&r(e.secondaryButtonUri,e.secondaryButtonUriTarget);}),[e])}}function We(l){var c=l,{step:e,flow:t,onDismiss:o,onPrimary:r,onSecondary:n}=c,i=f(c,["step","flow","onDismiss","onPrimary","onSecondary"]);var w;let{isCurrentModal:u}=De(`${t.id}-${e.id}`),{handleDismiss:d}=j(t,{onDismiss:o}),{handlePrimary:h,handleSecondary:y}=Ie(e,{onPrimary:r,onSecondary:n});return u?jsxRuntime.jsxs(x,p(s({anchor:e.selector,onOpenAutoFocus:P=>P.preventDefault(),onPointerDownOutside:P=>P.preventDefault()},i),{children:[jsxRuntime.jsx(x.Close,{onClick:d}),jsxRuntime.jsx(x.Media,{src:(w=e.videoUri)!=null?w:e.imageUri,type:e.videoUri?"video":"image"}),jsxRuntime.jsx(x.Title,{children:e.title}),jsxRuntime.jsx(x.Subtitle,{children:e.subtitle}),jsxRuntime.jsxs(E.Row,{alignItems:"center",gap:3,justifyContent:"flex-end",part:"tooltip-footer",pt:4,children:[jsxRuntime.jsx(x.Progress,{children:`${(e==null?void 0:e.order)+1}/${t.steps.size}`}),jsxRuntime.jsx(x.Secondary,{marginLeft:"auto",title:e.secondaryButtonTitle,onClick:y}),jsxRuntime.jsx(x.Primary,{title:e.primaryButtonTitle,onClick:h})]})]}),e.id):null}function qt(r){var n=r,{flowId:e,onComplete:t}=n,o=f(n,["flowId","onComplete"]);let{flow:i}=Ee(e);if(j(i,{onComplete:t}),i==null||i.isVisible===!1)return null;i.start();let l=i.getCurrentStep();return l==null||l.start(),jsxRuntime.jsx(We,s({step:l,flow:i},o))}
|
|
46
|
+
var Tt=Object.defineProperty;var wt=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,o)=>(typeof require<"u"?require:t)[o]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var Z=(e,t)=>{for(var o in t)Tt(e,o,{get:t[o],enumerable:!0});};var Se={borders:{md:"1px solid"},borderWidths:{0:"0",md:"1px"}};var Ce={black:"#000000",gray100:"#14161A",gray200:"#181B20",gray300:"#1F2329",gray400:"#2E343D",gray500:"#4C5766",gray600:"#5A6472",gray700:"#C5CBD3",gray800:"#E2E5E9",gray900:"#F1F2F4",white:"#ffffff",blue400:"#015AC6",blue500:"#0171F8",blue800:"#DBECFF",blue900:"#F5F9FF",green400:"#009E37",green500:"#00D149",green800:"#DBFFE8",transparent:"#FFFFFF00",inherit:"inherit",red500:"#c00000"};var Fe={md:"10px",lg:"20px",round:"50%"};var l=e=>`var(--fr-colors-${e})`,Te={neutral:{background:l("white"),border:l("gray800"),foreground:l("black"),surface:l("gray700"),active:{background:l("white"),border:l("gray900"),foreground:l("black"),surface:l("gray700")},focus:{background:l("white"),border:l("gray900"),foreground:l("black"),surface:l("gray700")},hover:{background:l("white"),border:l("gray900"),foreground:l("black"),surface:l("gray700")}},primary:{background:l("blue500"),border:l("blue500"),foreground:l("white"),surface:l("blue500"),active:{background:l("blue400"),border:l("blue400"),foreground:l("white"),surface:l("blue400")},focus:{background:l("blue500"),border:l("blue500"),foreground:l("white"),surface:l("blue500")},hover:{background:l("blue400"),border:l("blue400"),foreground:l("white"),surface:l("blue400")}},secondary:{background:l("white"),border:l("gray800"),foreground:l("black"),surface:l("gray900"),active:{background:l("gray900"),border:l("gray800"),foreground:l("black"),surface:l("gray800")},focus:{background:l("gray900"),border:l("gray800"),foreground:l("black"),surface:l("gray900")},hover:{background:l("gray900"),border:l("gray800"),foreground:l("black"),surface:l("gray800")}}};var we={md:"0px 4px 20px rgba(0, 0, 0, 0.1)"};var Rt="px",Bt=e=>typeof e=="number"?`${4*e}${Rt}`:e,vt=[-20,-19,-18,-17,-16,-15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,-.5,0,.5,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,"auto"],Re=Object.fromEntries(vt.map(e=>[e,Bt(e)]));var Be={fontFamilies:{default:"inherit"},fontSizes:{xs:"12px",sm:"14px",md:"16px",lg:"18px",xl:"20px","2xl":"24px","3xl":"30px","4xl":"36px","5xl":"48px"},fontWeights:{thin:"100",extralight:"200",light:"300",regular:"400",medium:"500",demibold:"600",bold:"700",extrabold:"800",black:"900"},letterSpacings:{md:"0.02em"},lineHeights:{xs:"18px",sm:"22px",md:"24px",lg:"26px",xl:"30px","2xl":"38px","3xl":"46px","4xl":"60px"}};var ae={...Se,colors:{...Ce,...Te},...Be,radii:Fe,shadows:we,space:Re};function U(e,t="",o="."){return Object.keys(e).reduce((n,r)=>{let a=`${t.length?`${t}${o}`:""}${r}`,s=e[r];return typeof s=="object"&&s!==null&&!Array.isArray(s)?Object.assign(n,U(s,a,o)):n[a]=s,n},{})}function se(e){return U(e,"--fr","-")}function ve(e,t="--fr"){let o={};return Object.keys(e).forEach(n=>{let r=e[n];typeof r=="object"&&r!==null&&!Array.isArray(r)?o[n]=ve(r,`${t}-${n}`):o[n]=`var(${t}-${n})`;}),o}var le=se(ae),f=ve(ae);var Et=new Set(["alt","size","src"]),Dt=kt__default.default.all.filter(e=>e.indexOf("-")!=0&&!Et.has(e)).map(e=>[e.replace(/-([a-z])/g,(t,o)=>o.toUpperCase()),null]),Ot=Object.fromEntries(Dt),pe=U(f.colors),Mt={color:pe,backgroundColor:pe,borderColor:pe,border:f.borders,borderRadius:f.radii,borderWidth:f.borderWidths,boxShadow:f.shadows,fontFamily:f.fontFamilies,fontSize:f.fontSizes,fontWeight:f.fontWeights,gap:f.space,lineHeight:f.lineHeights,margin:f.space,marginBottom:f.space,marginLeft:f.space,marginRight:f.space,marginTop:f.space,padding:f.space,paddingBottom:f.space,paddingLeft:f.space,paddingRight:f.space,paddingTop:f.space},ke={...Ot,...Mt},Ee={bg:["backgroundColor"],m:["margin"],mt:["marginTop"],mr:["marginRight"],mb:["marginBottom"],ml:["marginLeft"],mx:["marginLeft","marginRight"],my:["marginTop","marginBottom"],p:["padding"],pt:["paddingTop"],pr:["paddingRight"],pb:["paddingBottom"],pl:["paddingLeft"],px:["paddingLeft","paddingRight"],py:["paddingTop","paddingBottom"]},De=new Set(["active","focus","focusVisible","focusWithin","hover"]);function Ht(e){return Array.isArray(e)?new Map(e.map(t=>[t,t])):typeof e=="object"&&e!==null?new Map(Object.entries(e)):typeof e=="string"||typeof e=="number"?new Map([[e,e]]):new Map}var Oe=new Map(Object.entries(ke).map(([e,t])=>[e,Ht(t)])),It=new Map(Object.entries(Ee).map(([e,t])=>[e,new Set(t)])),At=new Set(["height","width"]),Vt=new Set(["canvas","embed","iframe","img","input","object","video"]);function Me(e){let[t,o]=e.split(":");return [t,De.has(o)?o:null]}function He(e,t="div"){let o=Object.assign({},e),n={};function r(i){if(i==null)return n;let s=`&:${i.replace(/[A-Z]/g,c=>`-${c.toLocaleLowerCase()}`)}`;return n[s]==null&&(n[s]={}),n[s]}return Object.entries(o).forEach(([i,a])=>{let[s,c]=Me(i),x=It.get(s);x!=null&&(x.forEach(u=>{let d=`${u}${c?":"+c:""}`;o[d]=a;}),delete o[i]);}),Object.entries(o).forEach(([i,a])=>{let[s,c]=Me(i),x=Oe.get(s);if(x!=null){if(typeof a=="string"&&a.indexOf(" ")>-1){let u=a.split(" ");r(c)[s]=u.map(d=>x.get(d.toString())??d).join(" ");}else x.has(a.toString())?r(c)[s]=x.get(a.toString()):r(c)[s]=a;(typeof t!="string"||!Vt.has(t)||!At.has(s))&&delete o[i];}}),Object.keys(o).forEach(i=>{let a=i.substring(1);i.indexOf("_")===0&&Oe.has(a)&&(o[a]=o[i],delete o[i]);}),{cssFromProps:n,unmatchedProps:o}}function Wt(){if(typeof window>"u"){let{JSDOM:e}=wt("jsdom");return new e("<!DOCTYPE html>").window}return window}function Ie(e){return e?{__html:Lt__default.default(Wt()).sanitize(e,{ALLOWED_TAGS:["b","i","a","span","div","p","pre","u","br","img","code","li","ul","table","tbody","thead","tr","td","th","h1","h2","h3","h4","video"],ALLOWED_ATTR:["style","class","target","id","href","alt","src","controls","autoplay","loop","muted"]})}:{__html:""}}function _t(e){return e&&`fr-${e}`}function Le(e){return e&&(Array.isArray(e)?e.map(t=>Le(t)).join(" "):_t(e))}function zt({as:e,children:t,className:o,css:n={},part:r,...i},a){let s=e??"div",{cssFromProps:c,unmatchedProps:x}=He(i,s),u=Le(r),d=o||u?clsx.clsx(o,u):void 0,h=[{boxSizing:"border-box"},c,n];return typeof t=="string"?jsxRuntime.jsx(s,{className:d,css:h,...x,ref:a,dangerouslySetInnerHTML:Ie(t)}):jsxRuntime.jsx(s,{className:d,css:h,...x,ref:a,children:t})}var p=me__namespace.forwardRef(zt);var m={};Z(m,{Body1:()=>io,Body2:()=>ao,Caption:()=>so,Display1:()=>Zt,Display2:()=>eo,H1:()=>to,H2:()=>oo,H3:()=>ro,H4:()=>no});var de={};Z(de,{Body1:()=>Xt,Body2:()=>qt,Caption:()=>Yt,Display1:()=>jt,Display2:()=>Kt,H1:()=>Nt,H2:()=>Ut,H3:()=>Gt,H4:()=>Jt});var E={color:"neutral.foreground",fontFamily:"default",margin:"0"},jt={...E,fontSize:"5xl",fontWeight:"bold",lineHeight:"4xl"},Kt={...E,fontSize:"4xl",fontWeight:"bold",lineHeight:"3xl"},Nt={...E,fontSize:"3xl",fontWeight:"demibold",lineHeight:"2xl"},Ut={...E,fontSize:"2xl",fontWeight:"demibold",lineHeight:"xl"},Gt={...E,fontSize:"xl",fontWeight:"demibold",lineHeight:"lg"},Jt={...E,fontSize:"md",fontWeight:"demibold",lineHeight:"md"},Xt={...E,fontSize:"md",fontWeight:"regular",lineHeight:"md"},qt={...E,fontSize:"sm",fontWeight:"regular",lineHeight:"sm"},Yt={...E,fontSize:"xs",fontWeight:"regular",lineHeight:"xs"};var Qt=["Display1","Display2","H1","H2","H3","H4","Body1","Body2","Caption"],D=Object.fromEntries(Qt.map(e=>{let t=["H1","H2","H3","H4"].includes(e)?e.toLowerCase():"span",o=me__namespace.forwardRef(({as:n=t,children:r,...i},a)=>jsxRuntime.jsx(p,{as:n,...de[e],...i,ref:a,children:r}));return o.displayName=`Text.${e}`,[e,o]})),Zt=D.Display1,eo=D.Display2,to=D.H1,oo=D.H2,ro=D.H3,no=D.H4,io=D.Body1,ao=D.Body2,so=D.Caption;var ce={};Z(ce,{Link:()=>mo,Plain:()=>uo,Primary:()=>po,Secondary:()=>co});var ee={borderWidth:"0",borderRadius:"md",display:"flex",gap:"2",padding:"2 4"},po={...ee,backgroundColor:"primary.surface",color:"primary.foreground","backgroundColor:hover":"primary.hover.surface"},co={...ee,backgroundColor:"secondary.background",borderColor:"secondary.border",borderStyle:"solid",borderWidth:"1px",color:"secondary.foreground","backgroundColor:hover":"secondary.hover.background"},mo={...ee,backgroundColor:"transparent",color:"primary.surface","color:hover":"primary.hover.surface"},uo={...ee,backgroundColor:"transparent",color:"neutral.foreground"};function $e({as:e,children:t,part:o,title:n,variant:r="Primary",...i}){let a=r.toLocaleLowerCase();return jsxRuntime.jsxs(p,{as:e??"button",part:[`button-${a}`,o],...ce[r],...i,children:[t,n&&jsxRuntime.jsx(m.Body2,{color:"inherit",flexGrow:"1",fontWeight:"demibold",css:{WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"},children:n})]})}var fo=["Primary","Secondary","Link","Plain"],go=Object.fromEntries(fo.map(e=>{let t=o=>jsxRuntime.jsx($e,{...o,variant:e,children:o.children});return t.displayName=`Button.${e}`,[e,t]})),b=Object.assign($e,go);var y={};Z(y,{Column:()=>ho,Row:()=>yo});var yo=me__namespace.forwardRef((e,t)=>jsxRuntime.jsx(p,{display:"flex",flexDirection:"row",...e,ref:t})),ho=me__namespace.forwardRef((e,t)=>jsxRuntime.jsx(p,{display:"flex",flexDirection:"column",...e,ref:t}));var B=me.createContext({apiKey:"",modals:new Set,setModals:()=>{},currentModal:null,navigate:()=>{}});function Ro({children:e,navigate:t,theme:o,...n}){let r=o?se(o):{},[i,a]=me.useState(new Set),s=me.useMemo(()=>new js.Frigade(n.apiKey,{apiKey:n.apiKey,apiUrl:n.apiUrl,userId:n.userId,groupId:n.groupId,__readOnly:n.__readOnly,__flowConfigOverrides:n.__flowConfigOverrides}),[n.userId,n.groupId,n.apiKey]),c=t??((u,d="_self")=>{window.open(u,d);});me.useEffect(()=>()=>{s.destroy();},[]);let x=i.size>0?i.values().next().value:null;return jsxRuntime.jsxs(B.Provider,{value:{modals:i,setModals:a,currentModal:x,navigate:c,...n,frigade:s},children:[jsxRuntime.jsx(react.Global,{styles:{":root":{...le,...r}}}),jsxRuntime.jsx(react.ThemeProvider,{theme:f,children:e})]})}function G(e,t){let[o,n]=me.useState(),[,r]=me.useState(""),{frigade:i}=me.useContext(B),a=s=>{s.id===e&&(t!=null&&t.variables&&s.applyVariables(t.variables),n(s),r(Math.random().toString()));};return me.useEffect(()=>((async()=>{let s=await i.getFlow(e);if(!s||i.hasFailedToLoad()){n(void 0);return}t!=null&&t.variables&&s.applyVariables(t.variables),n(s);})(),i.onStateChange(a),()=>{i.removeStateChangeHandler(a);}),[]),{flow:o}}function L(e,{onComplete:t,onDismiss:o}={}){let n=me.useRef(null);return me.useEffect(()=>{e!=null&&(e.isCompleted&&n.current===!1&&(async()=>await(t==null?void 0:t(e)))(),n.current=e==null?void 0:e.isCompleted);},[e==null?void 0:e.isCompleted]),{handleDismiss:me.useCallback(async r=>{if(await(o==null?void 0:o(e,r))===!1)return r.preventDefault(),!1;await e.skip();},[e])}}function J(e,{onPrimary:t,onSecondary:o}={}){let{navigate:n}=me.useContext(B);return {handlePrimary:me.useCallback(async(r,i)=>await(t==null?void 0:t(e,r))===!1?(r.preventDefault(),!1):(await e.complete(i),e.primaryButtonUri!=null&&n(e.primaryButtonUri,e.primaryButtonUriTarget),!0),[e]),handleSecondary:me.useCallback(async(r,i)=>await(o==null?void 0:o(e,r))===!1?(r.preventDefault(),!1):(await e.complete(i),e.secondaryButtonUri!=null&&n(e.secondaryButtonUri,e.secondaryButtonUriTarget),!0),[e])}}function X(e){let{currentModal:t,modals:o,setModals:n}=me.useContext(B),[r,i]=me.useState(!1);me.useEffect(()=>{e!=null&&e.isVisible&&e&&!o.has(e.id)&&n(s=>new Set(s).add(e.id));},[e==null?void 0:e.id,e==null?void 0:e.isVisible]),me.useEffect(()=>{let s=t===(e==null?void 0:e.id);(e==null?void 0:e.id)!=null&&s!==r&&i(s);},[e==null?void 0:e.id,t]);function a(){o.has(e==null?void 0:e.id)&&n(s=>{let c=new Set(s);return c.delete(e==null?void 0:e.id),c});}return {isCurrentModal:r,removeModal:a}}function H({as:e,children:t,container:o,dismissible:n=!1,flowId:r,onComplete:i,onDismiss:a,onPrimary:s,onSecondary:c,variables:x,...u}){let{flow:d}=G(r,{variables:x}),h=d==null?void 0:d.getCurrentStep(),{handleDismiss:V}=L(d,{onComplete:i,onDismiss:a}),{handlePrimary:Y,handleSecondary:ne}=J(h,{onPrimary:s,onSecondary:c}),{isCurrentModal:K,removeModal:ie}=X(d);return me.useEffect(()=>{!(d!=null&&d.isVisible)&&K&&ie();},[d==null?void 0:d.isVisible,K]),d==null||!d.isVisible||!K?null:(d.start(),h.start(),jsxRuntime.jsx(e??p,{position:"relative",...u,children:t({flow:d,handleDismiss:V,handlePrimary:Y,handleSecondary:ne,parentProps:{container:o,dismissible:n,flowId:r,variables:x,...u},step:h})}))}function Ge(e){return jsxRuntime.jsx(H,{as:g,gap:5,borderColor:"neutral.border",borderStyle:"solid",borderWidth:"md",...e,children:({handleDismiss:t,handlePrimary:o,handleSecondary:n,parentProps:{dismissible:r},step:i})=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(y.Row,{alignItems:"center",flexWrap:"wrap",gap:1,justifyContent:"space-between",part:"card-header",children:[jsxRuntime.jsx(g.Title,{children:i.title}),r&&jsxRuntime.jsx(g.Dismiss,{onClick:t}),jsxRuntime.jsx(g.Subtitle,{flexBasis:"100%",children:i.subtitle})]}),jsxRuntime.jsx(g.Media,{src:i.imageUri,css:{objectFit:"contain",width:"100%"}}),jsxRuntime.jsxs(y.Row,{gap:3,justifyContent:"flex-end",part:"card-footer",children:[jsxRuntime.jsx(g.Secondary,{title:i.secondaryButtonTitle,onClick:n}),jsxRuntime.jsx(g.Primary,{title:i.primaryButtonTitle??"Continue",onClick:o})]})]})})}function Je({part:e,src:t,...o}){return jsxRuntime.jsx(p,{as:"img",part:["image",e],src:t,...o})}function $o(e){var t,o,n,r;if(e.includes("youtube"))return `https://www.youtube.com/embed/${(t=e.split("v=")[1])==null?void 0:t.split("&")[0]}`;if(e.includes("vimeo"))return `https://player.vimeo.com/video/${(o=e.split("vimeo.com/")[1])==null?void 0:o.split("&")[0]}`;if(e.includes("wistia"))return `https://fast.wistia.net/embed/iframe/${(n=e.split("wistia.com/medias/")[1])==null?void 0:n.split("&")[0]}`;if(e.includes("loom"))return `https://loom.com/embed/${(r=e.split("loom.com/share/")[1])==null?void 0:r.split("&")[0]}?hideEmbedTopBar=true&hide_title=true&hide_share=true&hide_owner=true`;throw new Error("Could not map videoUri to a known provider (Youtube, Vimeo, Wistia, Loom).")}function Xe({part:e,src:t,...o}){let n=$o(t);return jsxRuntime.jsx(p,{allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,as:"iframe",backgroundColor:"gray100",borderWidth:0,part:["video",e],src:n,...o})}function $({src:e,type:t,...o}){return jsxRuntime.jsx(t==="video"?Xe:Je,{src:e,...o})}var g=me__namespace.forwardRef((e,t)=>{if(e.flowId!=null)return jsxRuntime.jsx(Ge,{...e});let o=e.as??y.Column;return jsxRuntime.jsx(o,{backgroundColor:"neutral.background",borderRadius:"md",gap:5,p:5,...e,ref:t})});g.Dismiss=e=>jsxRuntime.jsx(b.Plain,{part:"dismiss",padding:0,...e,children:jsxRuntime.jsx(solid.XMarkIcon,{height:"24",fill:"currentColor"})});g.Media=({src:e,...t})=>e==null?null:jsxRuntime.jsx($,{borderRadius:"md",src:e,...t});g.Primary=({onClick:e,title:t,...o})=>t==null?null:jsxRuntime.jsx(b.Primary,{title:t,onClick:e,...o});g.Secondary=({onClick:e,title:t,...o})=>t==null?null:jsxRuntime.jsx(b.Secondary,{title:t,onClick:e,...o});g.Subtitle=({children:e,...t})=>e==null?null:jsxRuntime.jsx(m.Body2,{display:"block",part:"subtitle",...t,children:e});g.Title=({children:e,...t})=>e==null?null:jsxRuntime.jsx(m.Body1,{display:"block",fontWeight:"bold",part:"title",...t,children:e});function F({children:e,...t}){return jsxRuntime.jsx(T__namespace.Root,{defaultOpen:!0,modal:!0,children:jsxRuntime.jsx(T__namespace.Portal,{children:jsxRuntime.jsxs(p,{inset:"0",position:"fixed",zIndex:"9999",children:[jsxRuntime.jsx(T__namespace.Overlay,{asChild:!0,children:jsxRuntime.jsx(p,{background:"rgb(0 0 0 / 0.5)",part:"dialog-overlay",position:"fixed",inset:"0"})}),jsxRuntime.jsx(T__namespace.Content,{asChild:!0,onOpenAutoFocus:o=>o.preventDefault(),onPointerDownOutside:o=>o.preventDefault(),children:jsxRuntime.jsx(g,{boxShadow:"md",left:"50%",maxWidth:"430px",p:8,part:"dialog-content",position:"fixed",textAlign:"center",top:"50%",transform:"translate(-50%, -50%)",...t,children:e})})]})})})}F.Dismiss=e=>jsxRuntime.jsx(T__namespace.Close,{"aria-label":"Close",asChild:!0,children:jsxRuntime.jsx(b.Plain,{part:"close",position:"absolute",right:"-4px",top:"4px",...e,children:jsxRuntime.jsx(solid.XMarkIcon,{height:"24",fill:"currentColor"})})});F.Subtitle=({children:e,...t})=>jsxRuntime.jsx(T__namespace.Description,{asChild:!0,children:jsxRuntime.jsx(m.Body2,{part:"subtitle",...t,children:e})});F.Media=({src:e,...t})=>e==null?null:jsxRuntime.jsx($,{borderRadius:"md",src:e,...t});F.Primary=({onClick:e,title:t,...o})=>t==null?null:jsxRuntime.jsx(b.Primary,{title:t,onClick:e,...o});F.ProgressDots=({current:e,total:t})=>{if(t==1)return null;let o=[...Array(t)].map((n,r)=>jsxRuntime.jsx("circle",{r:4,cx:4+16*r,cy:"4px",fill:e===r?f.colors.blue500:f.colors.blue800},r));return jsxRuntime.jsx(p,{as:"svg",height:"8px",marginInline:"auto",part:"progress",viewBox:`0 0 ${16*t-8} 8`,width:16*t-8,children:o})};F.Secondary=({onClick:e,title:t,...o})=>t==null?null:jsxRuntime.jsx(b.Secondary,{title:t,onClick:e,...o});F.Title=({children:e,...t})=>jsxRuntime.jsx(T__namespace.Title,{asChild:!0,children:jsxRuntime.jsx(m.H3,{part:"title",...t,children:e})});function Uo(e){return jsxRuntime.jsx(H,{as:F,dismissible:!0,...e,children:({flow:t,handleDismiss:o,handlePrimary:n,handleSecondary:r,parentProps:{dismissible:i},step:a})=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[i&&jsxRuntime.jsx(F.Dismiss,{onClick:o}),jsxRuntime.jsxs(y.Column,{gap:1,part:"announcement-header",children:[jsxRuntime.jsx(F.Title,{children:a.title}),jsxRuntime.jsx(F.Subtitle,{children:a.subtitle})]}),jsxRuntime.jsx(F.Media,{src:a.videoUri??a.imageUri,type:a.videoUri?"video":"image",css:{aspectRatio:"1.5",objectFit:"cover",width:"100%"}}),jsxRuntime.jsx(F.ProgressDots,{current:t.getNumberOfCompletedSteps(),total:t.getNumberOfAvailableSteps()}),jsxRuntime.jsxs(y.Row,{css:{"& > button":{flexBasis:"50%",flexGrow:1}},gap:3,part:"announcement-footer",children:[a.secondaryButtonTitle&&jsxRuntime.jsx(F.Secondary,{onClick:r,title:a.secondaryButtonTitle}),a.primaryButtonTitle&&jsxRuntime.jsx(F.Primary,{onClick:n,title:a.primaryButtonTitle??"Continue"})]})]})})}function Jo(e){return jsxRuntime.jsx(H,{as:g,border:"md",borderColor:"neutral.border",display:"flex",flexDirection:"row",gap:3,justifyContent:"space-between",...e,children:({handleDismiss:t,handlePrimary:o,handleSecondary:n,step:r})=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(y.Row,{gap:3,children:[r.imageUri&&jsxRuntime.jsx("img",{src:r.imageUri,style:{height:40,width:40,alignSelf:"center"}}),jsxRuntime.jsxs(y.Column,{children:[jsxRuntime.jsx(m.H4,{mb:1,children:r.title}),jsxRuntime.jsx(m.Body2,{color:"gray500",children:r.subtitle})]})]}),jsxRuntime.jsxs(y.Row,{alignItems:"center",gap:3,justifyContent:"center",children:[r.secondaryButtonTitle&&jsxRuntime.jsx(b.Secondary,{title:r.secondaryButtonTitle,onClick:n}),jsxRuntime.jsx(b.Primary,{title:r.primaryButtonTitle,onClick:o}),e.dismissible&&jsxRuntime.jsx(g.Dismiss,{onClick:t})]})]})})}var Qo=new Set(["required","min","max","minLength","maxLength","pattern"]);function Zo({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 n=Object.fromEntries(Object.entries(o).filter(([i])=>Qo.has(i))),r=reactHookForm.useController({name:o.id,control:t,rules:n});return jsxRuntime.jsx(e,{...r,fieldData:o})}function Ye({fieldTypes:e,handleDismiss:t,handlePrimary:o,handleSecondary:n,parentProps:{dismissible:r},step:i}){var d;let{control:a,handleSubmit:s}=reactHookForm.useForm({delayError:2e3,mode:"onChange"}),c=[];function x(h,V){o(V,h);}function u(h,V){n(V,h);}return (d=i.fields)==null||d.forEach(h=>{e[h.type]!=null&&c.push(jsxRuntime.jsx(Zo,{control:a,fieldComponent:e[h.type],fieldData:h},h.id));}),jsxRuntime.jsxs(y.Column,{gap:5,children:[jsxRuntime.jsxs(y.Row,{alignItems:"center",flexWrap:"wrap",gap:1,justifyContent:"space-between",part:"form-header",children:[jsxRuntime.jsx(g.Title,{children:i.title}),r&&jsxRuntime.jsx(g.Dismiss,{onClick:t}),jsxRuntime.jsx(g.Subtitle,{flexBasis:"100%",children:i.subtitle})]}),c,jsxRuntime.jsxs(y.Row,{part:"form-footer",justifyContent:"flex-end",gap:3,children:[i.secondaryButtonTitle&&jsxRuntime.jsx(b.Secondary,{title:i.secondaryButtonTitle,onClick:s(u)}),jsxRuntime.jsx(b.Primary,{title:i.primaryButtonTitle??"Submit",onClick:s(x)})]},"form-footer")]})}function Qe({error:e}){var t;return (t=e==null?void 0:e.message)!=null&&t.length?jsxRuntime.jsx(m.Caption,{color:"red500",display:"block",part:"field-error",textAlign:"end",children:e==null?void 0:e.message}):null}function Ze({children:e,id:t,required:o=!1}){return jsxRuntime.jsxs(m.H4,{as:"label",htmlFor:t,part:"field-label",children:[e,o&&" *"]})}var q={px:"4",py:"2",backgroundColor:"neutral.background",borderColor:"neutral.border",borderStyle:"solid",borderWidth:"md",borderRadius:"md",display:"block",outline:"none",width:"100%"};function A({children:e,field:t,fieldData:o,fieldState:n}){let{id:r,label:i,placeholder:a}=o,{error:s}=n,c={id:r,...t,...a?{placeholder:a}:{},...q,"aria-invalid":!!s,value:t.value??""};return jsxRuntime.jsxs(p,{part:"field",children:[jsxRuntime.jsx(Ze,{id:r,required:!!o.required,children:i}),e(c),jsxRuntime.jsx(Qe,{error:s})]})}var rr=()=>jsxRuntime.jsx(p,{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"})}),nr=me__namespace.forwardRef(({label:e,value:t},o)=>jsxRuntime.jsxs(p,{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(m.Body2,{part:"field-radio-label",children:e}),jsxRuntime.jsx(N__namespace.Item,{id:t,value:t,ref:o,asChild:!0,children:jsxRuntime.jsx(p,{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(p,{as:N__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(rr,{})})})})]}));function rt(e){let{field:{onChange:t,value:o},fieldData:{options:n=[]}}=e,r=n.map(({label:i,value:a})=>jsxRuntime.jsx(nr,{value:a,label:i},a));return jsxRuntime.jsx(A,{...e,children:()=>jsxRuntime.jsx(N__namespace.Root,{value:o,onValueChange:t,asChild:!0,children:jsxRuntime.jsx(y.Column,{gap:2,part:"field-radio-group",children:r})})})}var sr=me__namespace.forwardRef(({label:e,value:t},o)=>jsxRuntime.jsx(S__namespace.Item,{value:t,ref:o,asChild:!0,children:jsxRuntime.jsx(p,{"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(m.Body2,{part:"field-select-option-label",children:e})})})}));function at(e){let{field:{onChange:t,value:o},fieldData:{options:n=[],placeholder:r}}=e,i=n.map(({label:a,value:s})=>jsxRuntime.jsx(sr,{value:s,label:a},s));return jsxRuntime.jsx(A,{...e,children:()=>jsxRuntime.jsxs(S__namespace.Root,{value:o,onValueChange:t,children:[jsxRuntime.jsx(S__namespace.Trigger,{asChild:!0,children:jsxRuntime.jsxs(m.Body2,{...q,alignItems:"center",display:"flex",justifyContent:"space-between",part:"field-select",children:[jsxRuntime.jsx(S__namespace.Value,{placeholder:r??"Select one"}),jsxRuntime.jsx(S__namespace.Icon,{children:jsxRuntime.jsx(p,{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(p,{...q,p:"1",part:"field-select-options",width:"var(--radix-popper-anchor-width)",children:jsxRuntime.jsx(S__namespace.Viewport,{children:i})})})})]})})}function lt(e){return jsxRuntime.jsx(A,{...e,children:t=>jsxRuntime.jsx(m.Body2,{as:"input",part:"field-text",type:"text",...t})})}function dt(e){return jsxRuntime.jsx(A,{...e,children:t=>jsxRuntime.jsx(m.Body2,{as:"textarea",part:"field-textarea",...t})})}var lr={radio:rt,select:at,text:lt,textarea:dt};function pr({fieldTypes:e={},...t}){let o=Object.assign({},lr,e);return jsxRuntime.jsx(H,{...t,children:n=>jsxRuntime.jsx(Ye,{fieldTypes:o,...n})})}function oe(){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]=me.useState(e),[n,r]=me.useState(null),i=me.useCallback(a=>{r(a);},[]);return me.useLayoutEffect(()=>{if(!n)return;let a=()=>{let s=n.getBoundingClientRect();o(s);};return a(),window.addEventListener("resize",a),()=>window.removeEventListener("resize",a)},[n]),{node:n,rect:t,ref:i}}var ur=react.keyframes({"0%":{opacity:.5,transform:"scale(0.5)"},"50%":{opacity:0,transform:"scale(1)"},"100%":{opacity:0,transform:"scale(1)"}});function ft({style:e={},part:t="",...o}){return jsxRuntime.jsxs(p,{part:`dot-wrapper ${t}`,style:{height:"48px",position:"absolute",width:"48px",...e},...o,children:[jsxRuntime.jsx(p,{backgroundColor:"primary.surface",part:"dot-pulse",css:{animation:`2s ease-out infinite ${ur}`,borderRadius:"24px",height:"48px",left:0,position:"absolute",top:0,transformOrigin:"center center",width:"48px"}}),jsxRuntime.jsx(p,{backgroundColor:"primary.surface",part:"dot",style:{borderRadius:"12px",height:"24px",left:"12px",position:"absolute",top:"12px",width:"24px"}})]})}function gt({props:e,alignAttr:t,sideAttr:o}){let n=o??"bottom",r={},i=()=>{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"};r[s[n]]=a;let c=i();return ["before","end"].includes(c)?["top","bottom"].includes(n)?r.right=a:r.bottom=a:["after","start"].includes(c)?["top","bottom"].includes(n)?r.left=a:r.top=a:["top","bottom"].includes(n)?r.left=`calc(50% + ${a})`:r.top=`calc(50% + ${a})`,r}var xt={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(xt.content.map(r=>[r,e[r]]).filter(r=>r[1]!==void 0)),n=Object.fromEntries(xt.root.map(r=>[r,e[r]]).filter(r=>r[1]!==void 0));if(o.align=o.align??"after",o.side=o.side??"bottom",["before","after"].includes(o.align)){let r={after:"end",before:"start"},i=(d,h)=>["top","bottom"].includes(h)?d=="after"?"marginLeft":"marginRight":d=="after"?"marginTop":"marginBottom",a=o.alignOffset??0,s=o.style??{},c=o.side??"bottom",x=o.align;o.style={...s,[i(x,c)]:a};let u=["top","bottom"].includes(c)?t.width:t.height;o.alignOffset=(u+a)*-1,o.align=r[x];}return {contentProps:o,rootProps:n}}function C({anchor:e,children:t,className:o,spotlight:n=!1,style:r,...i}){let{node:a,rect:s,ref:c}=oe(),{node:x,rect:u,ref:d}=oe(),{contentProps:h,rootProps:V}=yt(i,s),[Y,ne]=me.useState(h.align),[K,ie]=me.useState(h.side),[he,Pt]=me.useState(0),[St,Ct]=me.useState(0);if(a!==null){let M=a.getAttribute("data-align"),Q=a.getAttribute("data-side");Y!==M&&ne(M),K!==Q&&ie(Q);}let be=me.useRef(null);if(me.useEffect(()=>{let M=document.querySelector(e);M!=null&&(d(M),be.current=M);},[e]),me.useEffect(()=>{let{scrollX:M,scrollY:Q}=window;Pt(u.left+M),Ct(u.top+Q);},[u.left,u.top]),x==null)return null;let Pe="0";typeof window<"u"&&(Pe=window.getComputedStyle(x).borderRadius);let Ft=gt({props:i,alignAttr:Y,sideAttr:K});return jsxRuntime.jsxs(k__namespace.Root,{defaultOpen:!0,...V,children:[jsxRuntime.jsx(k__namespace.Anchor,{virtualRef:be}),jsxRuntime.jsx(k__namespace.Portal,{children:jsxRuntime.jsxs("div",{className:o,css:{bottom:0,left:0,position:"absolute",right:0,top:0,zIndex:9999,pointerEvents:"none"},children:[n&&jsxRuntime.jsx(p,{part:"tooltip-spotlight",position:"absolute",style:{borderRadius:Pe,boxShadow:"0 0 0 20000px rgb(0 0 0 / 0.5)",height:u.height,left:he,top:St,width:u.width}}),jsxRuntime.jsx(k__namespace.Content,{asChild:!0,...h,ref:c,children:jsxRuntime.jsxs(g,{boxShadow:"md",part:"tooltip-content",position:"relative",css:{maxWidth:"360px",pointerEvents:"auto",...r},children:[jsxRuntime.jsx(ft,{style:Ft}),t]})})]})})]})}C.Close=e=>jsxRuntime.jsx(k__namespace.Close,{"aria-label":"Close",asChild:!0,children:jsxRuntime.jsx(b.Plain,{css:{top:"12px",right:"4px"},part:"close",position:"absolute",...e,children:jsxRuntime.jsx(solid.XMarkIcon,{height:"24",fill:"currentColor"})})});C.Media=({src:e,...t})=>e==null?null:jsxRuntime.jsx($,{borderRadius:"md md 0 0",borderWidth:"0",css:{aspectRatio:"2",objectFit:"cover"},margin:"-5 -5 0",src:e,...t});C.Primary=({onClick:e,title:t,...o})=>t==null?null:jsxRuntime.jsx(b.Primary,{title:t,onClick:e,...o});C.Progress=({children:e,...t})=>e==null?null:jsxRuntime.jsx(m.H4,{part:"progress",...t,children:e});C.Secondary=({onClick:e,title:t,...o})=>t==null?null:jsxRuntime.jsx(b.Secondary,{title:t,onClick:e,...o});C.Subtitle=({children:e,...t})=>e==null?null:jsxRuntime.jsx(m.Body2,{part:"subtitle",...t,children:e});C.Title=({children:e,...t})=>e==null?null:jsxRuntime.jsx(m.H4,{part:"title",...t,children:e});function bt({dismissible:e=!0,flow:t,onDismiss:o,onPrimary:n,onSecondary:r,step:i,...a}){let{handleDismiss:s}=L(t,{onDismiss:o}),{handlePrimary:c,handleSecondary:x}=J(i,{onPrimary:n,onSecondary:r});return jsxRuntime.jsxs(C,{anchor:i.selector,onOpenAutoFocus:u=>u.preventDefault(),onPointerDownOutside:u=>u.preventDefault(),...a,children:[e&&jsxRuntime.jsx(C.Close,{onClick:s}),jsxRuntime.jsx(C.Media,{src:i.videoUri??i.imageUri,type:i.videoUri?"video":"image"}),jsxRuntime.jsxs(y.Column,{gap:1,part:"tooltip-header",children:[jsxRuntime.jsx(C.Title,{children:i.title}),jsxRuntime.jsx(C.Subtitle,{color:"gray500",children:i.subtitle})]}),jsxRuntime.jsxs(y.Row,{alignItems:"center",gap:3,justifyContent:"flex-end",part:"tooltip-footer",children:[jsxRuntime.jsx(C.Progress,{marginRight:"auto",transform:"translateY(1px)",children:`${t.getNumberOfCompletedSteps()+1}/${t.getNumberOfAvailableSteps()}`}),jsxRuntime.jsx(C.Secondary,{title:i.secondaryButtonTitle,onClick:x}),jsxRuntime.jsx(C.Primary,{title:i.primaryButtonTitle,onClick:c})]})]},i.id)}function hr({flowId:e,onComplete:t,variables:o,...n}){let{flow:r}=G(e,{variables:o});L(r,{onComplete:t});let{isCurrentModal:i,removeModal:a}=X(r);if(me.useEffect(()=>{!(r!=null&&r.isVisible)&&i&&a();},[r==null?void 0:r.isVisible,i]),r==null||r.isVisible===!1||!i)return null;r.start();let s=r.getCurrentStep();return s==null||s.start(),jsxRuntime.jsx(bt,{step:s,flow:r,...n})}function Sr(){let{frigade:e}=me.useContext(B);return {frigade:e,isLoading:!(e!=null&&e.isReady())}}function Fr(){let{userId:e,frigade:t}=me.useContext(B);async function o(r){await t.identify(e,r);}async function n(r,i){await t.track(r,i);}return {userId:e,addProperties:o,track:n}}function wr(){let{groupId:e,frigade:t}=me.useContext(B);async function o(r){if(!e){console.error("No Group ID is set. Cannot set properties without a Group ID.");return}await t.group(e,r);}async function n(r,i){await t.track(r,i);}return {groupId:e,addProperties:o,track:n}}
|
|
33
47
|
|
|
34
|
-
exports
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
exports
|
|
39
|
-
|
|
40
|
-
|
|
48
|
+
Object.defineProperty(exports, 'Flow', {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () { return js.Flow; }
|
|
51
|
+
});
|
|
52
|
+
Object.defineProperty(exports, 'Frigade', {
|
|
53
|
+
enumerable: true,
|
|
54
|
+
get: function () { return js.Frigade; }
|
|
55
|
+
});
|
|
56
|
+
exports.Announcement = Uo;
|
|
57
|
+
exports.Banner = Jo;
|
|
58
|
+
exports.Box = p;
|
|
59
|
+
exports.Button = b;
|
|
60
|
+
exports.Card = g;
|
|
61
|
+
exports.Flex = y;
|
|
62
|
+
exports.Form = pr;
|
|
63
|
+
exports.Provider = Ro;
|
|
64
|
+
exports.Text = m;
|
|
65
|
+
exports.Tooltip = C;
|
|
66
|
+
exports.Tour = hr;
|
|
67
|
+
exports.themeVariables = le;
|
|
68
|
+
exports.useBoundingClientRect = oe;
|
|
69
|
+
exports.useFlow = G;
|
|
70
|
+
exports.useFlowHandlers = L;
|
|
71
|
+
exports.useFrigade = Sr;
|
|
72
|
+
exports.useGroup = wr;
|
|
73
|
+
exports.useModal = X;
|
|
74
|
+
exports.useStepHandlers = J;
|
|
75
|
+
exports.useUser = Fr;
|
|
41
76
|
//# sourceMappingURL=out.js.map
|
|
42
77
|
//# sourceMappingURL=index.cjs.map
|