@simple-parlay/components 2.0.0 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +7 -7
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.mjs +6 -6
- package/dist/react-native/components/HowToPlayButton.d.ts +11 -1
- package/dist/react-native/components/PlaceEntryProvider.d.ts +5 -1
- package/dist/react-native/index.cjs +1 -1
- package/dist/react-native/index.mjs +514 -514
- package/dist/shared/selection-actions.d.ts +3 -1
- package/package.json +3 -8
package/dist/react/index.mjs
CHANGED
|
@@ -98,8 +98,8 @@ return h(Fl,{theme:n,className:"gs-item","aria-label":`Explore ${gl(e,A.presets)
|
|
|
98
98
|
/* @__PURE__ */h("g",{style:{transform:"translate(25px, 25px)"},children:/* @__PURE__ */h("rect",{x:"40",y:"5",width:"210",height:"210",rx:"42",fill:i,opacity:"0.55"})}),
|
|
99
99
|
/* @__PURE__ */h("rect",{x:"40",y:"5",width:"210",height:"210",rx:"42",fill:i}),
|
|
100
100
|
/* @__PURE__ */h("text",{x:"180",y:"305",fontFamily:"Manrope, Poppins, sans-serif",fontSize:"32",letterSpacing:"1.5",textAnchor:"middle",fontWeight:800,fill:i,children:"PRESS TO PLAY"}),
|
|
101
|
-
/* @__PURE__ */h("text",{x:"180",y:"338",fontFamily:"Manrope, Poppins, sans-serif",fontSize:"18",letterSpacing:"2",textAnchor:"middle",fontWeight:500,fill:s,children:p})]}),/* @__PURE__ */h("div",{style:{position:"absolute",left:60*m,top:25*m,width:170*m,height:170*m,pointerEvents:"none"},children:/* @__PURE__ */h(Bl,{iconUrl:e,width:"100%",height:"100%",iconColor:g,accentColor:f})})]});return n?/* @__PURE__ */h(Pl,{size:r,onPress:n,className:c,ariaLabel:d??`Press to play ${t}`,renderInner:x}):/* @__PURE__ */h("div",{className:c,style:{width:r,height:r},children:x()})}function Pl({size:e,onPress:t,className:n,ariaLabel:r,renderInner:i}){const[a,o]=p(!1)
|
|
102
|
-
return h("button",{type:"button",onClick:t,"aria-label":r,className:n,
|
|
101
|
+
/* @__PURE__ */h("text",{x:"180",y:"338",fontFamily:"Manrope, Poppins, sans-serif",fontSize:"18",letterSpacing:"2",textAnchor:"middle",fontWeight:500,fill:s,children:p})]}),/* @__PURE__ */h("div",{style:{position:"absolute",left:60*m,top:25*m,width:170*m,height:170*m,pointerEvents:"none"},children:/* @__PURE__ */h(Bl,{iconUrl:e,width:"100%",height:"100%",iconColor:g,accentColor:f})})]});return n?/* @__PURE__ */h(Pl,{size:r,onPress:n,className:c,ariaLabel:d??`Press to play ${t}`,renderInner:x}):/* @__PURE__ */h("div",{className:c,style:{width:r,height:r},children:x()})}function Pl({size:e,onPress:t,className:n,ariaLabel:r,renderInner:i}){const[a,o]=p(!1);/* @__PURE__ */
|
|
102
|
+
return h("button",{type:"button",onClick:t,"aria-label":r,className:n,onMouseLeave:()=>o(!1),onMouseDown:()=>o(!0),onMouseUp:()=>o(!1),onTouchStart:()=>o(!0),onTouchEnd:()=>o(!1),onBlur:()=>o(!1),style:{width:e,height:e,padding:0,background:"transparent",border:0,cursor:"pointer",borderRadius:e/360*78,transform:a?"scale(0.96)":"none",transition:"transform 140ms ease-out"},children:i(a)})}function Ml({theme:e,active:t,small:n,onClick:r,children:i}){const a=e.colors,{hovered:o,pressed:l,handlers:s}=jn(),c=t?null:Ln(a.primary,{hovered:o,pressed:l});/* @__PURE__ */
|
|
103
103
|
return h("button",{type:"button","aria-pressed":t,onClick:r,...s,style:{flex:"0 0 auto",display:"inline-flex",alignItems:"center",gap:6,minWidth:44,padding:"0 13px",borderRadius:zt(e,999),border:`1px solid ${c?.borderColor??"transparent"}`,cursor:"pointer",fontFamily:"inherit",fontSize:n?13:14,fontWeight:700,whiteSpace:"nowrap",background:t?a.primary:c?.background??"transparent",color:t?a.primaryText:a.textMuted,...In(e,l)},children:i})}function Tl({items:e,value:t,onChange:n,label:r,theme:i,small:a}){const o=i.colors;/* @__PURE__ */
|
|
104
104
|
return h("div",{role:"group","aria-label":r,className:"pb-seg",style:{display:"flex",gap:2,padding:a?3:4,minHeight:a?36:44,borderRadius:zt(i,999),background:o.backgroundAlt,border:`1px solid ${o.border}`,overflowX:"auto",scrollbarWidth:"none",width:"fit-content",maxWidth:"100%"},children:e.map(e=>{const r=e.id===t;/* @__PURE__ */
|
|
105
105
|
return u(Ml,{theme:i,active:r,small:a,onClick:()=>n(e.id),children:[e.label,null!=e.count&&/* @__PURE__ */h("span",{style:{display:"inline-flex",alignItems:"center",height:18,padding:"0 6px",borderRadius:zt(i,999),fontSize:11,fontWeight:600,fontVariantNumeric:"tabular-nums",background:r?kt(o.primaryText,.18):kt(o.primary,.12),color:"inherit"},children:e.count})]},String(e.id))})})}function Dl({games:e,selectedGame:t,theme:n,onPlay:r,maxPayouts:i,quickPickLoading:a}){const o=n.colors,l=Eo(n),s=l.colors,c=Dt(n),m=Pn(n),g=Sn(n),f=It(n),x=function(e){const t=Ir.map(t=>({id:t.id,label:t.shortLabel,count:e.filter(e=>Er(e)===t.level).length})).filter(e=>e.count>0);return t.length>1?[{id:"all",label:"All",count:e.length},...t]:[]}(e),[b,y]=p("all"),[v,w]=p(t?.id??null),[k,N]=p({}),B=d(null),C=function(e,t){return"all"===t?[...e]:e.filter(e=>ll(e).id===t)}(e,b),A=e.find(e=>e.id===v)??C[0]??e[0];if(!A)/* @__PURE__ */return h("div",{role:"status",style:{color:s.textMuted,fontFamily:g},children:"No games available"});const F=il(A),z=$o(A,i?.[A.id]),S=ol(A,i?.[A.id]),P=pt(A),M=!(!A.quick_pick_only||!a),T=z.legOptions.includes(k[A.id])?k[A.id]:S?.count??z.maxLegCount,D=e=>{P&&!M&&r(A,e)},L={fontSize:12,fontWeight:500,letterSpacing:"0.18em",textTransform:"uppercase",color:s.textMuted},W={display:"inline-flex",alignItems:"center",height:18,padding:"0 7px",borderRadius:zt(n,999),fontSize:10,fontWeight:700,letterSpacing:"0.12em",textTransform:"uppercase",background:kt(o.primary,.12),color:c,whiteSpace:"nowrap"},H=x.find(e=>e.id===b)?.label??"All";/* @__PURE__ */
|
|
@@ -448,7 +448,7 @@ return u("div",{className:"flex items-center justify-between gap-2 px-3 py-2 cur
|
|
|
448
448
|
/* @__PURE__ */h("h3",{style:{margin:0,fontSize:13,fontWeight:700,color:O.textMuted},children:"Stake"}),
|
|
449
449
|
/* @__PURE__ */h("div",{className:"tabular-nums",style:{fontSize:oo,fontWeight:800,letterSpacing:"-0.02em",color:q,fontFamily:G},children:He(f)}),null!=M&&/* @__PURE__ */u("div",{style:{fontSize:13,fontWeight:500,color:O.textMuted},children:[He(M)," available"]}),A&&/* @__PURE__ */h("div",{style:{fontSize:13,fontWeight:500,color:O.textMuted},children:F??"Stake is set for this ticket."})]}),!A&&!ue&&(ge?/* @__PURE__ */h(Yn,{theme:H,size:32,"aria-expanded":!0,"aria-label":"Close stake",onClick:()=>fe(!1),children:/* @__PURE__ */h("span",{style:{fontSize:16,lineHeight:1},children:"×"})}):/* @__PURE__ */h(En,{theme:H,variant:"quiet","aria-expanded":!1,onClick:()=>fe(!0),style:{flexShrink:0},children:"Change stake"}))]}:{className:"flex items-center justify-between mb-3 sm:mb-4",children:[/* @__PURE__ */h("h3",{className:"text-base sm:text-lg font-semibold",style:{color:q,fontFamily:G,...U},children:"How much are you betting?"}),null!=M&&/* @__PURE__ */u("span",{className:"text-xs font-semibold",style:{color:O.textMuted},children:["Balance: ",/* @__PURE__ */h("span",{style:{color:he?O.error:O.success},children:He(M)})]})]}),(!W||ge)&&he&&/* @__PURE__ */u("div",{className:"mb-3 px-3 py-2 flex items-center justify-between gap-3",style:{borderRadius:zt(H,8),backgroundColor:O.errorBg??`${O.error}15`,color:O.errorText??O.error},children:[/* @__PURE__ */u("span",{className:"text-xs font-medium",children:["Insufficient balance. Your bet of ",He(f)," exceeds your available ",He(M),"."]}),T&&/* @__PURE__ */h(En,{theme:H,variant:"secondary",onClick:T,style:{flexShrink:0},children:"Add funds"})]}),A?W?null:/* @__PURE__ */u("div",{className:"flex items-center justify-between gap-3 px-3 py-2.5",style:{borderRadius:zt(H,8),backgroundColor:O.backgroundAlt,border:`1px solid ${O.border}`},children:[/* @__PURE__ */h("span",{className:"text-xs",style:{color:O.textMuted},children:F??"Stake is set for this ticket."}),/* @__PURE__ */h("span",{className:"text-lg font-bold tabular-nums",style:{color:q,fontFamily:G},children:He(f)})]}):(!W||ge)&&/* @__PURE__ */u("div",{className:"space-y-4",children:[C&&/* @__PURE__ */u("div",{children:[
|
|
450
450
|
/* @__PURE__ */h("p",{className:"text-xs sm:text-sm font-semibold mb-2",style:{color:V},children:"Entry amount"}),
|
|
451
|
-
/* @__PURE__ */u("div",{className:"relative",children:[/* @__PURE__ */h("span",{className:"absolute left-3 top-1/2 -translate-y-1/2",style:{color:O.textMuted},children:"$"}),/* @__PURE__ */h("input",{type:"number",inputMode:"decimal",min:Z,max:$??void 0,step:"any",placeholder:"Enter amount","aria-label":"Entry amount",value:f||"",onChange:e=>{if(""===e.target.value)return void x(0);const t=Number(e.target.value);if(!Number.isFinite(t))return;const n=Math.max(0,Math.round(100*t)/100);x(null!==$?Math.min(n,$):n)},...Rn(H,O.border),className:"w-full pl-8 pr-4 py-3 border focus:outline-none text-lg font-semibold tabular-nums",style:{borderRadius:zt(H,8),borderColor:O.border,color:K,backgroundColor:O.backgroundAlt,fontFamily:Y,transition:"border-color .15s ease"}})]}),
|
|
451
|
+
/* @__PURE__ */u("div",{className:"relative",children:[/* @__PURE__ */h("span",{className:"absolute left-3 top-1/2 -translate-y-1/2",style:{color:O.textMuted},children:"$"}),/* @__PURE__ */h("input",{type:"number",inputMode:"decimal",min:Z,max:$??void 0,step:"any",placeholder:"Enter amount","aria-label":"Entry amount",value:f||"",onChange:e=>{if(""===e.target.value)return void x(0);const t=Number(e.target.value);if(!Number.isFinite(t))return;const n=Math.max(0,Math.round(100*t)/100);x(null!==$?Math.min(n,$):n)},...Rn(H,O.border),className:"w-full pl-8 pr-4 py-3 border focus:outline-none text-lg font-semibold tabular-nums",style:{borderRadius:zt(H,8),borderColor:O.border,color:K,backgroundColor:O.backgroundAlt,fontFamily:Y,outline:"none",transition:"border-color .15s ease"}})]}),
|
|
452
452
|
/* @__PURE__ */u("p",{className:"text-xs mt-1.5",style:{color:O.textMuted},children:["Minimum bet: ",He(Z),null!==$&&/* @__PURE__ */u(m,{children:[" · Maximum: ",He($)]})]}),f>0&&f<Z&&/* @__PURE__ */u("p",{className:"text-xs mt-1",style:{color:O.error},children:["Bet amount must be at least ",He(Z)]})]}),W?/* @__PURE__ */u(m,{children:[/* @__PURE__ */h("div",{role:"group","aria-label":"Quick stakes",style:{display:"grid",gridTemplateColumns:`repeat(${Math.max(_.length,1)}, minmax(0, 1fr))`,gap:5},children:_.map(e=>/* @__PURE__ */h(po,{theme:H,selected:f===e,onClick:()=>x(e),style:{minWidth:0},children:He(e)},e))}),f>0&&/* @__PURE__ */h(En,{theme:H,variant:"quiet",onClick:()=>x(0),children:"Reset stake"})]}):/* @__PURE__ */u("div",{children:[(C||f>0)&&/* @__PURE__ */u("div",{className:"flex items-center justify-between mb-2",children:[C?/* @__PURE__ */h("p",{className:"text-xs sm:text-sm font-semibold",style:{color:V},children:"Add to bet"}):/* @__PURE__ */h("span",{}),f>0&&/* @__PURE__ */h(En,{theme:H,variant:"quiet",onClick:()=>x(0),children:"Reset stake"})]}),/* @__PURE__ */h("div",{style:{display:"grid",gridTemplateColumns:`repeat(${Math.max(_.length,1)}, minmax(0, 1fr))`,gap:8},children:_.map(e=>/* @__PURE__ */u(po,{theme:H,selected:!1,"aria-pressed":void 0,onClick:()=>{const t=f+e;x(null!==$?Math.min(t,$):t)},disabled:null!==$&&f>=$,style:{minWidth:0},children:["+",He(e)]},e))})]})]})]}),/* @__PURE__ */h(Uc,{shelf:W,theme:H,sticky:!se,above:L,style:E,children:(()=>{const e=v&&!!o,t=re.enabled&&/* @__PURE__ */u("div",{className:"flex justify-between items-center mt-2 px-2 py-1.5",style:{borderRadius:zt(H,4),backgroundColor:`${O.warning}08`,border:`1px solid ${O.warning}25`},children:[/* @__PURE__ */u("span",{className:"text-xs font-semibold",style:{color:O.warning},children:["★ ",re.progressive?"Progressive Jackpot":"Jackpot"]}),/* @__PURE__ */h("span",{className:"text-sm font-bold",style:{color:O.warning},children:re.progressive?re.amount>0?He(re.amount):re.limit>0?`Up to ${He(re.limit)}`:"Progressive":He(re.amount)})]});if(W)/* @__PURE__ */return u(m,{children:[Fe?/* @__PURE__ */h("div",{"aria-live":"polite",children:/* @__PURE__ */h(Rc,{view:Fe,theme:H,bare:!0})}):/* @__PURE__ */u(m,{children:[/* @__PURE__ */h("span",{className:"block text-[11px] font-extrabold uppercase",style:{letterSpacing:"0.16em",color:I.accent},children:ne>0?"Potential payout":"Stake"}),/* @__PURE__ */u("p",{"aria-live":"polite",className:"flex flex-wrap items-baseline gap-x-1.5 mt-1",style:{margin:0},children:[
|
|
453
453
|
/* @__PURE__ */h("strong",{className:"tabular-nums",style:{fontSize:oo,fontWeight:800,letterSpacing:"-0.02em",lineHeight:1.12,color:q,fontFamily:G},children:He(ne>0?ne:f)}),ne>0&&/* @__PURE__ */u("span",{className:"text-sm",style:{color:O.textMuted},children:["for ",He(f)]}),ie&&/* @__PURE__ */h("span",{className:"text-xs font-semibold",style:{color:O.warning},children:"+ Jackpot"})]})]}),t,e&&/* @__PURE__ */h(En,{variant:S?"confirm":"primary",size:"lg",theme:H,block:!0,onClick:o,disabled:me,"aria-busy":s,style:{marginTop:4},children:s?/* @__PURE__ */u(m,{children:[/* @__PURE__ */h(cs,{color:O.textMuted}),/* @__PURE__ */h("span",{children:"Placing entry…"})]}):`${S?"Confirm":"Place"} entry · ${He(f)}`}),e&&me&&xe&&/* @__PURE__ */h("p",{role:"status",style:{margin:0,fontSize:13,fontWeight:600,color:O.text,textAlign:"center"},children:xe})]});const n=/* @__PURE__ */u(m,{children:[
|
|
454
454
|
/* @__PURE__ */u("div",{className:"flex justify-between items-center text-sm mb-1",children:[/* @__PURE__ */h("span",{style:{color:V},children:"Bet"}),/* @__PURE__ */h("span",{className:"font-semibold",style:{color:X},children:He(f)})]}),ne>0&&/* @__PURE__ */u("div",{className:"flex flex-wrap gap-x-2 justify-between items-center pt-2 border-t",style:{borderColor:O.border},children:[/* @__PURE__ */h("span",{className:"font-semibold text-sm",style:{color:V},children:"Potential Payout"}),/* @__PURE__ */u("span",{className:"font-bold text-lg",style:{color:q},children:[He(ne),ie&&/* @__PURE__ */h("span",{className:"text-xs ml-1",style:{color:O.warning},children:"+ Jackpot"})]})]}),t]});return e?/* @__PURE__ */u("div",{className:"flex items-stretch gap-4",children:[
|
|
@@ -542,7 +542,7 @@ return u("button",{type:"button","aria-label":r,"aria-pressed":i,onClick:a,style
|
|
|
542
542
|
/* @__PURE__ */h("span",{style:o(.22*n,.55)}),
|
|
543
543
|
/* @__PURE__ */h("span",{style:{position:"absolute",left:0,top:0,width:n,height:n,borderRadius:.26*n,backgroundColor:t,color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",fontSize:n*(e>9?.42:.5),fontWeight:800,letterSpacing:"-0.02em",boxShadow:i?"inset 0 0 0 2px #fff":"none"},children:e})]})}function Sd(){const{theme:t,selectionUndo:n,undoSelectionChange:r,dismissSelectionUndo:i,uiVariant:a}=Da(),[o,l]=e.useState(!1),s=e.useRef(i);s.current=i,e.useEffect(()=>{if(!n||o)return;const e=setTimeout(()=>s.current(),6e3);return()=>clearTimeout(e)},[n,o]);const c=t.colors;return zn(a)?/* @__PURE__ */h("div",{role:"status",children:n&&/* @__PURE__ */u(co,{theme:t,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),onFocus:()=>l(!0),onBlur:()=>l(!1),style:{flexDirection:"row",alignItems:"center",gap:10,padding:"6px 6px 6px 8px",marginBottom:8,fontSize:14,fontWeight:700,color:c.text},children:["quickpick"===n.kind&&/* @__PURE__ */h("span",{"aria-hidden":"true",style:{flex:"none",width:32,height:32,display:"grid",placeItems:"center",borderRadius:zt(t,Xa)-4,background:c.primary},children:/* @__PURE__ */h(fl,{size:16,color:c.primaryText})}),
|
|
544
544
|
/* @__PURE__ */h("span",{style:{flex:1,minWidth:0,paddingLeft:"quickpick"===n.kind?0:8},children:n.message}),
|
|
545
|
-
/* @__PURE__ */h(En,{theme:t,variant:"quiet",onClick:r,style:{flex:"none"},children:"Undo"})]})}):null}function Pd({onNext:t,onBack:n,className:r=""}){const{theme:i,headingFont:a,selectedGame:o,selectedPropositionCount:l,selectedEventId:s,propositions:c,goToConfirmation:d,selectedRule:p,maxPayouts:m,betAmount:g,setBetAmount:f,selections:x,expectedCorrect:b,gamePrice:y,toggleSelection:v,correlationTargetCount:w,selectionValid:k,uiVariant:N,previewCallPayouts:B,selectedRuleId:C,clearSelections:F,dismissSelectionUndo:z}=Da(),S=i.colors,P=o?Xe(o,l,p):{min:0,max:0},M=Fi(o,l),T=Wi(o)?w:M??P.min,D=Wi(o)?w:M??(A(o)&&s?Math.min(P.max,c.length):P.max),L=e.useRef(!1);e.useEffect(()=>{L.current=!1},[o?.id]),e.useEffect(()=>{fn(N)&&g>0&&(L.current=!0),g<=0&&!L.current&&f(Math.max(20,y))},[g,y,f]);const W=e.useRef([]);W.current=Sa(W.current,x);const H=function({selections:e,order:t,minReq:n,maxReq:r,stake:i,payout20:a=0}){const
|
|
545
|
+
/* @__PURE__ */h(En,{theme:t,variant:"quiet",onClick:r,style:{flex:"none"},children:"Undo"})]})}):null}function Pd({onNext:t,onBack:n,className:r=""}){const{theme:i,headingFont:a,selectedGame:o,selectedPropositionCount:l,selectedEventId:s,propositions:c,goToConfirmation:d,selectedRule:p,maxPayouts:m,betAmount:g,setBetAmount:f,selections:x,expectedCorrect:b,gamePrice:y,toggleSelection:v,correlationTargetCount:w,selectionValid:k,uiVariant:N,previewCallPayouts:B,selectedRuleId:C,clearSelections:F,dismissSelectionUndo:z}=Da(),S=i.colors,P=o?Xe(o,l,p):{min:0,max:0},M=Fi(o,l),T=Wi(o)?w:M??P.min,D=Wi(o)?w:M??(A(o)&&s?Math.min(P.max,c.length):P.max),L=e.useRef(!1);e.useEffect(()=>{L.current=!1},[o?.id]),e.useEffect(()=>{fn(N)&&g>0&&(L.current=!0),g<=0&&!L.current&&f(Math.max(20,y))},[g,y,f]);const W=e.useRef([]);W.current=Sa(W.current,x);const H=function({selections:e,order:t,minReq:n,maxReq:r,stake:i,payout20:a=0,game:o}){const l=[];for(const m of t){const t=e[m];t&&l.push({id:m,number:l.length+1,side:t})}const s=l.length,c=s>=n,d=Math.max(0,n-s),p=c||r>0&&n===r?o?Li(a*(i/20),o):a*(i/20):0;return{legs:l,count:s,dividend:p,dividendText:He(p),ctaLabel:c?`Continue with ${s} ›`:0===s?`Select at least ${n}`:`Add ${d} more to continue`,ctaDisabled:!c,atMax:r>0&&s>=r}}({game:o,selections:x,order:W.current,minReq:T,maxReq:D,stake:g,payout20:o?Pa(m?.[o.id],D>0&&T===D?D:W.current.length,{game:o,expectedCorrect:b,stake:g}):0}),O=Ht(i),j=Ot(i),R=H.ctaDisabled||Wi(o)&&!k,I=Hn(i,"primary"),E=Et(I.background,It(i),I.color),U=Mi(o),[Y,G]=e.useState(!1),[q,V]=e.useState(!1),[X,K]=e.useState(null),Q=H.legs.find(e=>e.id===X)??null,J=Q?c.find(e=>e.id===Q.id)?.description??c.find(e=>e.id===Q.id)?.proposition??"":"",Z=()=>{K(null),F()},$=e.useRef(null),_=H.legs[H.legs.length-1]?.side;!function(t,n,r){const i=e.useRef(null),a=e.useRef(t);e.useEffect(()=>{const e=e=>{i.current={x:e.clientX,y:e.clientY}};return document.addEventListener("pointerdown",e,!0),()=>document.removeEventListener("pointerdown",e,!0)},[]),e.useEffect(()=>{const e=t>a.current;a.current=t;const o=i.current,l=n.current?.lastElementChild;if(!e||!o||!l)return;if(window.matchMedia?.("(prefers-reduced-motion: reduce)").matches)return;const s=l.getBoundingClientRect(),c=s.height||44,d=uo(l).createElement("div");d.setAttribute("aria-hidden","true"),Object.assign(d.style,{position:"fixed",left:o.x-c/2+"px",top:o.y-c/2+"px",width:`${c}px`,height:`${c}px`,borderRadius:.26*c+"px",backgroundColor:r,boxShadow:"0 9px 14px rgba(10,49,56,0.4)",pointerEvents:"none",zIndex:"3",transition:"transform 0.42s cubic-bezier(0.34,0.82,0.3,1), opacity 0.42s ease-in"}),uo(l).body.appendChild(d);const p=s.left+s.width/2-o.x,m=s.top+s.height/2-o.y,h=requestAnimationFrame(()=>{d.style.transform=`translate(${p}px, ${m}px) scale(0.5) rotate(-8deg)`,d.style.opacity="0"}),u=()=>d.remove();d.addEventListener("transitionend",u);const g=window.setTimeout(u,700);return()=>{cancelAnimationFrame(h),window.clearTimeout(g),u()}},[t])}(H.count,$,"no"===_?j:O);const ee=o?nl(o,l??H.count,g,b??void 0):null,te=Jl("default"!==N?B:void 0,o,l??H.count,g,b,C,ee),ne=o&&!Wi(o)?te.view??rl(o,g,m[o.id]):null,re=ee?te.estimated?"Estimated all correct":"All correct payout":"Potential dividend",ie=ee?He(Math.max(...(te.view??ee).rows.map(e=>e.amount))):H.dividendText;if(fn(N))/* @__PURE__ */return h(rs,{count:H.count,target:D,minimum:T,disabled:H.ctaDisabled||Wi(o)&&!k,label:H.ctaLabel,view:ne,payoutText:ie,onNext:()=>{d(),t?.()}});const ae=Math.max(0,T-H.count),oe=D>0&&D<=16?D:T,le=ee?Math.max(...(te.view??ee).rows.map(e=>e.amount)):H.dividend,se=Math.max(T,H.count),ce=/* @__PURE__ */u("div",{style:{display:"flex",alignItems:"flex-end",gap:12},children:[/* @__PURE__ */u("div",{style:{flex:1,minWidth:0},children:[/* @__PURE__ */u("span",{style:{display:"block",fontSize:13,fontWeight:600,color:S.textMuted},children:[0===ae&&H.count>0?`All ${se}`:`${H.count} of ${se}`," picked"]}),/* @__PURE__ */u("span",{"aria-live":"polite",style:{display:"flex",flexWrap:"wrap",alignItems:"baseline",columnGap:6},children:[/* @__PURE__ */h("strong",{style:{fontSize:26,fontWeight:800,letterSpacing:"-0.02em",color:Dt(i),fontVariantNumeric:"tabular-nums"},children:le>0?He(le):"—"}),/* @__PURE__ */u("span",{style:{fontSize:13,fontWeight:500,color:S.textMuted,whiteSpace:"nowrap"},children:["if all ",se," right"]})]})]}),/* @__PURE__ */h(En,{size:"lg",theme:i,disabled:H.ctaDisabled||Wi(o)&&!k,onClick:()=>{z(),d(),t?.()},children:ae>0?`Pick ${ae} more`:"Review picks"})]});return zn(N)?/* @__PURE__ */u("div",{className:r,style:{color:S.text,fontFamily:a},children:[/* @__PURE__ */u("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:[/* @__PURE__ */u("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",alignItems:"flex-start",gap:6},children:[/* @__PURE__ */h("span",{style:{display:"flex",opacity:.6},children:/* @__PURE__ */h(ld,{size:12})}),oe>0&&/* @__PURE__ */h(mo,{theme:i,states:Array.from({length:oe},(e,t)=>t<H.count?"right":"open"),style:{alignSelf:"stretch"}})]}),/* @__PURE__ */u("span",U?{title:Ti(o),children:[He(g)," · locked"]}:{...Rn(i,S.border),style:{display:"flex",alignItems:"center",minHeight:44,marginLeft:"auto",border:`1px solid ${S.border}`,borderRadius:zt(i,Xa),paddingLeft:12,fontSize:16},children:["$",/* @__PURE__ */h("input",{type:"number",inputMode:"decimal","aria-label":ha,min:1,step:1,value:g>0?String(g):"",onChange:e=>{L.current=!0,f(Math.max(0,parseFloat(e.target.value)||0))},style:{width:96,minHeight:44,padding:"8px 12px 8px 4px",border:0,outline:"none",background:"transparent",color:S.text,fontSize:16,fontWeight:700,fontFamily:"inherit"}})]})]}),ce]}):/* @__PURE__ */u("div","call"===N?{className:r,style:{fontFamily:a,color:S.text,containerType:"inline-size"},children:[
|
|
546
546
|
/* @__PURE__ */h("style",{children:".blade-call-continue{flex:1 0 100%}@container(min-width:700px){.blade-call-continue{flex:1 1 200px}}"}),
|
|
547
547
|
/* @__PURE__ */u("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:[
|
|
548
548
|
/* @__PURE__ */u("p",{"aria-live":"polite",style:{margin:0,flex:1,fontSize:13,fontWeight:750},children:[H.count," ",1===H.count?"pick":"picks"," selected",
|
|
@@ -557,7 +557,7 @@ return u("button",{type:"button","aria-label":r,"aria-pressed":i,onClick:a,style
|
|
|
557
557
|
/* @__PURE__ */h("span",{className:"px-1.5 py-0.5 font-bold text-[10px] uppercase shrink-0",style:{borderRadius:zt(i,4),backgroundColor:"yes"===Q.side?O:j,color:"#fff"},children:Q.side}),
|
|
558
558
|
/* @__PURE__ */h("span",{className:"line-clamp-2",children:J}),
|
|
559
559
|
/* @__PURE__ */h(En,{theme:i,variant:"quiet",onPress:()=>{K(null),v(Q.id,Q.side)},"aria-label":`Remove leg ${Q.number}`,style:{marginLeft:"auto",flexShrink:0},children:"Remove"})]}),
|
|
560
|
-
/* @__PURE__ */u("div",{className:"flex items-stretch gap-2",children:[/* @__PURE__ */u("div",U?{className:"flex flex-none items-center gap-2 px-3",style:{borderRadius:zt(i,10),border:`1px solid ${S.border}`,backgroundColor:S.backgroundAlt},title:Ti(o),children:[/* @__PURE__ */h("span",{className:"text-[15px] font-extrabold",style:{color:S.text},children:He(g)}),/* @__PURE__ */h("span",{className:"text-[10px]",style:{color:S.textMuted},children:"locked"})]}:{className:"flex flex-none items-center overflow-hidden w-[96px]",...Rn(i,S.border),style:{borderRadius:zt(i,10),border:`1px solid ${S.border}`,backgroundColor:S.background},children:[/* @__PURE__ */h("span",{className:"pl-3 text-base font-extrabold",style:{color:S.text},children:"$"}),/* @__PURE__ */h("input",{type:"number",min:1,step:1,inputMode:"decimal","aria-label":ha,value:g>0?String(g):"",onChange:e=>{L.current=!0,f(Math.max(0,parseFloat(e.target.value)||0))},className:"flex-1 min-w-0 bg-transparent outline-none border-0 py-2 pl-1 pr-2 text-[15px] font-extrabold",style:{color:S.text,fontFamily:a}})]}),/* @__PURE__ */h(En,{theme:i,size:"lg",disabled:R,onPress:()=>{d(),t?.()},style:{flex:1,minWidth:0},children:/* @__PURE__ */u("span",{className:"flex min-w-0 flex-col items-center leading-tight",children:[H.dividend>0&&/* @__PURE__ */u("span",{className:"text-[10px] font-bold uppercase tracking-[0.08em]",style:{color:kt(I.color,.8)},children:["Potential dividend"," ",
|
|
560
|
+
/* @__PURE__ */u("div",{className:"flex items-stretch gap-2",children:[/* @__PURE__ */u("div",U?{className:"flex flex-none items-center gap-2 px-3",style:{borderRadius:zt(i,10),border:`1px solid ${S.border}`,backgroundColor:S.backgroundAlt},title:Ti(o),children:[/* @__PURE__ */h("span",{className:"text-[15px] font-extrabold",style:{color:S.text},children:He(g)}),/* @__PURE__ */h("span",{className:"text-[10px]",style:{color:S.textMuted},children:"locked"})]}:{className:"flex flex-none items-center overflow-hidden w-[96px]",...Rn(i,S.border),style:{borderRadius:zt(i,10),border:`1px solid ${S.border}`,backgroundColor:S.background},children:[/* @__PURE__ */h("span",{className:"pl-3 text-base font-extrabold",style:{color:S.text},children:"$"}),/* @__PURE__ */h("input",{type:"number",min:1,step:1,inputMode:"decimal","aria-label":ha,value:g>0?String(g):"",onChange:e=>{L.current=!0,f(Math.max(0,parseFloat(e.target.value)||0))},className:"flex-1 min-w-0 bg-transparent outline-none border-0 py-2 pl-1 pr-2 text-[15px] font-extrabold",style:{color:S.text,fontFamily:a,outline:"none"}})]}),/* @__PURE__ */h(En,{theme:i,size:"lg",disabled:R,onPress:()=>{d(),t?.()},style:{flex:1,minWidth:0},children:/* @__PURE__ */u("span",{className:"flex min-w-0 flex-col items-center leading-tight",children:[H.dividend>0&&/* @__PURE__ */u("span",{className:"text-[10px] font-bold uppercase tracking-[0.08em]",style:{color:kt(I.color,.8)},children:["Potential dividend"," ",
|
|
561
561
|
/* @__PURE__ */h("span",{className:"text-[13px] font-extrabold tracking-normal",style:{color:R?void 0:E},children:H.dividendText})]}),/* @__PURE__ */h("span",{children:H.ctaLabel})]})})]})]})}function Md(){const{theme:t,propositions:n,uiVariant:r}=Da(),[i,a]=e.useState(!1),o=Eo(t),l=!zn(r);return 0===n.length?null:/* @__PURE__ */u(m,{children:[/* @__PURE__ */u(En,{theme:o,variant:"quiet","aria-haspopup":"dialog","aria-label":"Swipe all matches",title:"Swipe all matches",onClick:()=>a(!0),style:{flexShrink:0,...l&&{width:44,padding:0}},children:[/* @__PURE__ */h(ic,{}),l?null:za]}),i&&/* @__PURE__ */h(ac,{propositions:n,title:"All matches",onClose:()=>a(!1)})]})}function Td({view:e,onChange:t}){const n=Eo(Da().theme),r="list"===e?"swipe":"list";/* @__PURE__ */
|
|
562
562
|
return h(En,{theme:n,variant:"quiet",onClick:()=>t(r),style:{flexShrink:0},children:"swipe"===r?za:"List"})}function Dd({onNext:t,onBack:n,hideTitle:r,hideActions:i,defaultView:a="list",view:o,onViewChange:l,hideViewSwitch:s,onSwipeDragStateChange:c,className:d=""}){const p=Da(),{selectedRule:g,correlation:f,correlationTargetCount:x,selectionValid:b,selectionUndo:y}=p,{theme:v,bodyFont:w,selectedGame:k,propositions:N,selections:B,toggleSelection:C,loading:F,error:z,renderTeamLogo:S,filterSport:P,initialSport:M,gameCategory:T,selectedPropositionCount:D,handlePropositionCountChange:L,goToConfirmation:W,goBack:H,selectedCategory:O,setSelectedCategory:j,selectedSport:R,selectedEventId:I,propositionsForCategoryPicker:E,answeredCount:U}=p,Y=v.colors,[G,q]=e.useState(a),V=o??G,X=e.useCallback(e=>{void 0===o&&q(e),l?.(e)},[o,l]);e.useEffect(()=>{k||(p.goToSportSelection(),n?.())},[k,p,n]);const K=e.useMemo(()=>{if(!k)return null;if(Wi(k))return x;const{min:e,max:t}=Xe(k,D??void 0,g);return e>0&&e===t?e:Fi(k,D)},[k,D,x]),Q=e.useRef(!1),J=e.useRef(U);e.useEffect(()=>{const e=J.current;if(J.current=U,null==K)return;const n=e===K-1&&U===K&&!y;if(Wi(k)){if(U!==K&&(Q.current=!1),n&&(Q.current=!0),!Q.current||!b)return;return Q.current=!1,W(),void t?.()}n&&(W(),t?.())},[U,K,b]);const Z=e.useMemo(()=>Ye(E??[]),[E]);if(e.useEffect(()=>{k&&1===Z.length&&O!==Z[0]&&j(Z[0])},[k,Z,O,j]),!k)return null;const $=Z.length>1&&!O,_=!$&&A(k)&&!I,ee=(()=>{if(Wi(k))return{...k,allowed_propositions:f.data?.supported_counts??k.allowed_propositions};if(!A(k)||!I)return k;const e=Math.min(k.max_propositions??N.length,N.length);return{...k,max_propositions:e,allowed_propositions:k.allowed_propositions?.filter(t=>t<=e)}})(),te=()=>{H(),n?.()};/* @__PURE__ */
|
|
563
563
|
return u("div",{className:`flex flex-col min-h-full ${d}`,style:{fontFamily:w},children:[!r&&/* @__PURE__ */h("div",{className:fn(p.uiVariant)||zn(p.uiVariant)?"":"mb-6",style:zn(p.uiVariant)?{marginBottom:ao}:void 0,children:/* @__PURE__ */h(Fd,{onBack:i?te:void 0,onNext:i?t:void 0,hideActions:i})}),!A(k)&&/* @__PURE__ */h(od,{}),Wi(k)&&!$&&!_&&/* @__PURE__ */u(m,{children:[/* @__PURE__ */h(md,{}),f.error&&/* @__PURE__ */h(En,{theme:v,variant:"quiet",onClick:f.retry,style:{alignSelf:"flex-start"},children:"Retry available choices"})]}),
|
|
@@ -637,7 +637,7 @@ return u("div",{className:`pl-0 sm:pl-2 ${e}`,children:[/* @__PURE__ */h("h1",{c
|
|
|
637
637
|
/* @__PURE__ */h("div",{className:"flex flex-wrap gap-1.5",role:"radiogroup","aria-label":"Number of legs",children:W.legOptions.map(e=>Y(e,String(e),e===M,()=>T(e)))}),
|
|
638
638
|
/* @__PURE__ */u("div",{className:"mt-2 flex items-baseline justify-between text-[11px] italic",style:{color:N.textMuted},children:[/* @__PURE__ */h("span",{children:"Easier to land"}),/* @__PURE__ */h("span",{children:"Bigger prizes"})]})]}),
|
|
639
639
|
/* @__PURE__ */u("div",{className:"mt-4",children:[U("Stake",He(D)),
|
|
640
|
-
/* @__PURE__ */u("div",{className:"relative",children:[/* @__PURE__ */h("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 font-bold",style:{color:N.textMuted},children:"$"}),/* @__PURE__ */h("input",{type:"number",inputMode:"decimal",min:z.minStake,max:z.maxStake??void 0,step:"any",placeholder:"Enter stake","aria-label":"Stake amount",value:D||"",onChange:e=>{if(""===e.target.value)return void L(0);const t=Number(e.target.value);Number.isFinite(t)&&L(O(t))},...Rn(m,N.border),className:"w-full rounded-lg border py-3 pl-8 pr-4 text-lg font-semibold tabular-nums focus:outline-none",style:{borderColor:N.border,color:N.textAlt??N.text,backgroundColor:N.backgroundAlt,fontFamily:B,transition:"border-color .15s ease"}})]}),
|
|
640
|
+
/* @__PURE__ */u("div",{className:"relative",children:[/* @__PURE__ */h("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 font-bold",style:{color:N.textMuted},children:"$"}),/* @__PURE__ */h("input",{type:"number",inputMode:"decimal",min:z.minStake,max:z.maxStake??void 0,step:"any",placeholder:"Enter stake","aria-label":"Stake amount",value:D||"",onChange:e=>{if(""===e.target.value)return void L(0);const t=Number(e.target.value);Number.isFinite(t)&&L(O(t))},...Rn(m,N.border),className:"w-full rounded-lg border py-3 pl-8 pr-4 text-lg font-semibold tabular-nums focus:outline-none",style:{borderColor:N.border,color:N.textAlt??N.text,backgroundColor:N.backgroundAlt,fontFamily:B,outline:"none",transition:"border-color .15s ease"}})]}),
|
|
641
641
|
/* @__PURE__ */h("div",{className:"mt-2 flex flex-wrap gap-1.5",children:z.quickAdds.map(e=>/* @__PURE__ */u("button",{type:"button",onClick:()=>L(O((D||0)+e)),className:"min-w-[48px] flex-1 rounded-lg border px-1 py-2 text-sm font-bold transition-colors",style:{backgroundColor:"transparent",borderColor:N.border,color:N.textMuted,cursor:"pointer"},children:["+$",e]},e))}),!R&&D>0&&/* @__PURE__ */u("p",{className:"mt-2 text-xs",style:{color:N.error},children:["Minimum stake is ",He(z.minStake),"."]})]}),
|
|
642
642
|
/* @__PURE__ */u("div",{className:"mt-4 border-t pt-3",style:{borderColor:Jd(A,.08)},children:[
|
|
643
643
|
/* @__PURE__ */u("div",{className:"flex items-baseline justify-between text-[10px] font-semibold uppercase tracking-[0.1em]",style:{color:N.textMuted},children:[/* @__PURE__ */h("span",{children:"What you can win"}),/* @__PURE__ */u("span",{children:[He(D)," returns"]})]}),
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { HowToPlayPanelContent } from '../../shared/how-to-play-panel';
|
|
3
3
|
import { BladeTheme } from '../types';
|
|
4
|
+
export type WebViewComponent = React.ComponentType<{
|
|
5
|
+
source: {
|
|
6
|
+
html: string;
|
|
7
|
+
};
|
|
8
|
+
style: object;
|
|
9
|
+
originWhitelist?: string[];
|
|
10
|
+
scrollEnabled?: boolean;
|
|
11
|
+
}>;
|
|
4
12
|
export interface HowToPlayButtonProps {
|
|
5
13
|
content?: string | null;
|
|
6
14
|
panel?: HowToPlayPanelContent | null;
|
|
@@ -24,5 +32,7 @@ export interface HowToPlayButtonProps {
|
|
|
24
32
|
};
|
|
25
33
|
bodyFont?: string;
|
|
26
34
|
headingFont?: string;
|
|
35
|
+
/** Pass `WebView` from react-native-webview for HTML guides. Defaults to PlaceEntryProvider's. */
|
|
36
|
+
WebViewComponent?: WebViewComponent;
|
|
27
37
|
}
|
|
28
|
-
export declare function HowToPlayButton({ content, panel, theme, extra, title, label, variant, touchSize, colors, bodyFont, headingFont, }: HowToPlayButtonProps): import("react/jsx-runtime").JSX.Element | null;
|
|
38
|
+
export declare function HowToPlayButton({ content, panel, theme, extra, title, label, variant, touchSize, colors, bodyFont, headingFont, WebViewComponent: WebViewProp, }: HowToPlayButtonProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -14,6 +14,7 @@ import { SwipeVariant } from '../../shared/swipe-deck';
|
|
|
14
14
|
import { useCorrelationSteering } from '../../shared/correlation-steering';
|
|
15
15
|
import { QuickPickMode } from '../../shared/selection-caps';
|
|
16
16
|
import { SameGameMultiEvent } from '../../shared/same-game-multi';
|
|
17
|
+
import { WebViewComponent } from './HowToPlayButton';
|
|
17
18
|
export interface PlaceEntryContextValue {
|
|
18
19
|
gameLibrary: GameLibrary<PlaceEntryContextValue>;
|
|
19
20
|
getGameFlow: (game: Game | null | undefined) => GameFlow;
|
|
@@ -155,6 +156,8 @@ export interface PlaceEntryContextValue {
|
|
|
155
156
|
}
|
|
156
157
|
declare const PlaceEntryContext: React.Context<PlaceEntryContextValue | null>;
|
|
157
158
|
export { PlaceEntryContext };
|
|
159
|
+
/** To stop Metro throwing a hissy fit. */
|
|
160
|
+
export declare const WebViewContext: React.Context<WebViewComponent | undefined>;
|
|
158
161
|
export declare function usePlaceEntry(): PlaceEntryContextValue;
|
|
159
162
|
export interface PlaceEntryProviderProps {
|
|
160
163
|
/** Additional game implementations. Perfect Pick, H2H and Safety Net are built in. */
|
|
@@ -207,7 +210,8 @@ export interface PlaceEntryProviderProps {
|
|
|
207
210
|
onClearEventFilter?: () => void;
|
|
208
211
|
screenSize?: ScreenSize;
|
|
209
212
|
howToPlayMarkdown?: string | null;
|
|
213
|
+
WebViewComponent?: WebViewComponent;
|
|
210
214
|
sportDisplayNames?: SportDisplayNameOverrides;
|
|
211
215
|
categoryDisplayNames?: CategoryDisplayNameOverrides;
|
|
212
216
|
}
|
|
213
|
-
export declare function PlaceEntryProvider({ gameLibrary, showCorrelationDebug, apiUrl, apiKey, fetchImpl, getAuthHeaders, userId, getUserBalance, children, theme: themeProp, colorScheme, demoGames, demoPropositions, demoEntries, demoMaxPayouts, gameCategory, jurisdiction, initialGameId, filterSport, initialSport, initialEventId, initialEventLabel, sportBaseKey, disableQuickPick, renderTeamLogo, renderPropositionSilk, uiVariant, selectionVariant, gameVariant, disableEventSwipe, swipeVariant, enableSportFavourites, yesNoLabels, onEntryPlaced, onBeforeSubmit, entryReference, onCancel, onShare, onRecharge, onClearEventFilter, screenSize, howToPlayMarkdown: howToPlayMarkdownProp, sportDisplayNames, categoryDisplayNames, }: PlaceEntryProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
217
|
+
export declare function PlaceEntryProvider({ gameLibrary, showCorrelationDebug, apiUrl, apiKey, fetchImpl, getAuthHeaders, userId, getUserBalance, children, theme: themeProp, colorScheme, demoGames, demoPropositions, demoEntries, demoMaxPayouts, gameCategory, jurisdiction, initialGameId, filterSport, initialSport, initialEventId, initialEventLabel, sportBaseKey, disableQuickPick, renderTeamLogo, renderPropositionSilk, uiVariant, selectionVariant, gameVariant, disableEventSwipe, swipeVariant, enableSportFavourites, yesNoLabels, onEntryPlaced, onBeforeSubmit, entryReference, onCancel, onShare, onRecharge, onClearEventFilter, screenSize, howToPlayMarkdown: howToPlayMarkdownProp, WebViewComponent, sportDisplayNames, categoryDisplayNames, }: PlaceEntryProviderProps): import("react/jsx-runtime").JSX.Element;
|