fansunited-management-components 1.23.1 → 1.24.0

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/index.es.js CHANGED
@@ -31426,43 +31426,43 @@ const xN = F.forwardRef(function(t, n) {
31426
31426
  }
31427
31427
  ) : /* @__PURE__ */ u.jsx(u.Fragment, {})
31428
31428
  ] });
31429
- }, RN = ({ defaultValue: e, labels: t, onChange: n }) => {
31430
- const r = Me.useRef(null), i = [
31429
+ }, RN = ({ defaultValue: e, isClearable: t = !0, labels: n, onChange: r }) => {
31430
+ const i = Me.useRef(null), o = [
31431
31431
  {
31432
31432
  id: "FREE",
31433
- label: t.free
31433
+ label: n.free
31434
31434
  },
31435
31435
  {
31436
31436
  id: "LEAD",
31437
- label: t.lead
31437
+ label: n.lead
31438
31438
  },
31439
31439
  {
31440
31440
  id: "REGISTERED",
31441
- label: t.registered
31441
+ label: n.registered
31442
31442
  }
31443
31443
  ];
31444
31444
  return /* @__PURE__ */ u.jsxs(st, { size: "sm", sx: { mb: 2 }, children: [
31445
- /* @__PURE__ */ u.jsx(lt, { children: t.authRequirement }),
31445
+ /* @__PURE__ */ u.jsx(lt, { children: n.authRequirement }),
31446
31446
  /* @__PURE__ */ u.jsx(
31447
31447
  Gn,
31448
31448
  X(V({
31449
31449
  value: e,
31450
31450
  size: "sm",
31451
31451
  slotProps: { button: { sx: { whiteSpace: "nowrap" } } },
31452
- onChange: (o, a) => n(a),
31452
+ onChange: (a, l) => r(l),
31453
31453
  sx: { minHeight: "37px" }
31454
- }, e && {
31454
+ }, e && t && {
31455
31455
  endDecorator: /* @__PURE__ */ u.jsx(
31456
31456
  gn,
31457
31457
  {
31458
31458
  variant: "plain",
31459
31459
  color: "neutral",
31460
- onMouseDown: (o) => {
31461
- o.stopPropagation();
31460
+ onMouseDown: (a) => {
31461
+ a.stopPropagation();
31462
31462
  },
31463
31463
  onClick: () => {
31464
- var o;
31465
- n(null), (o = r.current) == null || o.focusVisible();
31464
+ var a;
31465
+ r(null), (a = i.current) == null || a.focusVisible();
31466
31466
  },
31467
31467
  sx: { width: "18px", height: "18px" },
31468
31468
  children: /* @__PURE__ */ u.jsx(nb, {})
@@ -31470,10 +31470,10 @@ const xN = F.forwardRef(function(t, n) {
31470
31470
  ),
31471
31471
  indicator: null
31472
31472
  }), {
31473
- children: i.map((o) => /* @__PURE__ */ u.jsx(kn, { value: o.id, children: o.label }, o.id))
31473
+ children: o.map((a) => /* @__PURE__ */ u.jsx(kn, { value: a.id, children: a.label }, a.id))
31474
31474
  })
31475
31475
  ),
31476
- /* @__PURE__ */ u.jsx(_o, { children: t.authRequirementDescription })
31476
+ /* @__PURE__ */ u.jsx(_o, { children: n.authRequirementDescription })
31477
31477
  ] });
31478
31478
  };
31479
31479
  function ON() {
package/index.umd.js CHANGED
@@ -2468,7 +2468,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
2468
2468
  Prefix can't start with '-' when allowNegative is true.
2469
2469
  prefix: `+i+`
2470
2470
  allowNegative: `+o+`
2471
- `),o=!1),Object.assign(Object.assign({},e),{allowNegative:o})}function DB(e){e=kB(e),e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle;var t=e.suffix,n=e.allowNegative,r=e.allowLeadingZeros,i=e.onKeyDown;i===void 0&&(i=nr);var o=e.onBlur;o===void 0&&(o=nr);var a=e.thousandSeparator,l=e.decimalScale,s=e.fixedDecimalScale,c=e.prefix;c===void 0&&(c="");var d=e.defaultValue,f=e.value,h=e.valueIsNumericString,p=e.onValueChange,m=ev(e,["decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","suffix","allowNegative","allowLeadingZeros","onKeyDown","onBlur","thousandSeparator","decimalScale","fixedDecimalScale","prefix","defaultValue","value","valueIsNumericString","onValueChange"]),g=us(e),v=g.decimalSeparator,w=g.allowedDecimalSeparators,x=function(B){return uv(B,e)},b=function(B,L){return EB(B,L,e)},I=ci(f)?d:f,y=h!=null?h:TB(I,c,t);ci(f)?ci(d)||(y=y||typeof d=="number"):y=y||typeof f=="number";var S=function(B){return tv(B)?B:(typeof B=="number"&&(B=ov(B)),y&&typeof l=="number"?av(B,l,!!s):B)},E=cv(S(f),S(d),!!y,x,b,p),P=E[0],F=P.numAsString,Y=P.formattedValue,W=E[1],A=function(B){var L=B.target,V=B.key,q=L.selectionStart,ee=L.selectionEnd,O=L.value;if(O===void 0&&(O=""),(V==="Backspace"||V==="Delete")&&ee<c.length){B.preventDefault();return}if(q!==ee){i(B);return}V==="Backspace"&&O[0]==="-"&&q===c.length+1&&n&&wr(L,1),l&&s&&(V==="Backspace"&&O[q-1]===v?(wr(L,q-1),B.preventDefault()):V==="Delete"&&O[q]===v&&B.preventDefault()),w!=null&&w.includes(V)&&O[q]===v&&wr(L,q+1);var M=a===!0?",":a;V==="Backspace"&&O[q-1]===M&&wr(L,q-1),V==="Delete"&&O[q]===M&&wr(L,q+1),i(B)},U=function(B){var L=F;if(L.match(/\d/g)||(L=""),r||(L=hB(L)),s&&l&&(L=av(L,l,s)),L!==F){var V=uv(L,e);W({formattedValue:V,value:L,floatValue:parseFloat(L)},{event:B,source:lo.event})}o(B)},G=function(B){return B===v?!0:co(B)},$=function(B){var L=B.currentValue,V=B.lastValue,q=B.formattedValue,ee=B.currentValueIndex,O=B.formattedValueIndex,M=L[ee],N=q[O],z=sv(V,L),te=z.to,ae=function(oe){return b(oe).indexOf(".")+c.length};return f===0&&s&&l&&L[te.start]===v&&ae(L)<ee&&ae(q)>O?!1:ee>=te.start&&ee<te.end&&w&&w.includes(M)&&N===v?!0:M===N};return Object.assign(Object.assign({},m),{value:Y,valueIsNumericString:!1,isValidInputCharacter:G,isCharacterSame:$,onValueChange:W,format:x,removeFormatting:b,getCaretBoundary:function(B){return _B(B,e)},onKeyDown:A,onBlur:U})}function PB(e){var t=DB(e);return C.createElement(IB,Object.assign({},t))}const OB=j.forwardRef(function(t,n){const o=t,{onChange:r}=o,i=He(o,["onChange"]);return u.jsx(PB,Z(H({},i),{getInputRef:n,onValueChange:a=>{r({target:{name:t.name,value:a.value}})},thousandSeparator:!0,valueIsNumericString:!0}))}),RB=e=>{const t=n=>{e.onChange(Number(n.target.value))};return u.jsxs(ou,{size:"sm",children:[u.jsx(au,{children:e.label}),u.jsx(Va,{sx:e.sx,value:e.defaultValue,onChange:t,slotProps:{input:{component:OB}}}),e.description?u.jsx(T.FormHelperText,{children:e.description}):u.jsx(u.Fragment,{})]})},MB=e=>e.startsWith("fb:c:")?"competition":e.startsWith("fb:t:")?"team":"player",LB=(e,t,n,r)=>{const i=e.filter(c=>c.type.toLocaleLowerCase()==="competition").map(c=>c.id),o=e.filter(c=>c.type.toLocaleLowerCase()==="team").map(c=>c.id),a=e.filter(c=>c.type.toLocaleLowerCase()==="player").map(c=>c.id),l=[],s=[];if(i.length>0){const c=t.football.getCompetitions({competitionIds:i}).then(d=>{s.push(d)}).catch(d=>{console.error(d),r()});l.push(c)}if(o.length>0){const c=t.football.getTeams({teamIds:o}).then(d=>{s.push(d.data)}).catch(d=>{console.error(d),r()});l.push(c)}if(a.length>0){const c=t.football.getPlayers({playerIds:a}).then(d=>{s.push(d.data)}).catch(d=>{console.error(d),r()});l.push(c)}Promise.all(l).then(()=>{const d=Array.prototype.concat.apply([],s).map(f=>BB(f));n(d)})},BB=e=>{const t=new Xm;return t.label=e.name,t.value=e.name,t.id=e.id,t.group=MB(e.id),e.birthDate?t.logo=e.assets&&e.assets.headshot&&e.assets.headshot:t.logo=e.assets&&e.assets.logo&&e.assets.logo,t.countryName=e.country.name,t.countryFlag=e.country.assets&&e.country.assets.flag?e.country.assets.flag:ht.country,t},$B=10,NB=e=>{const[t,n]=C.useState([]),[r,i]=C.useState([]),[o,a]=C.useState(!1),[l,s]=C.useState(""),[c,d]=C.useState(!1),{sdk:f}=xt(),h=()=>d(!c),p=(v,w)=>{n(w),e.onChangeTags(w)};C.useEffect(()=>{LB(e.tags,f,n,h)},[e.tags]);const m=C.useMemo(()=>si(v=>{if(!v){i([]),a(!1);return}a(!0),f.football.search({query:v}).then(w=>{i([...Zm(w)]),a(!1)}).catch(w=>{console.error(w),i([]),a(!1)})},300),[]);C.useEffect(()=>(m(l),()=>m.cancel()),[l,m]);const g=(v,w)=>v.map((x,b)=>u.jsx(T.Chip,{variant:"solid",endDecorator:u.jsx(T.ChipDelete,{color:"danger",sx:{marginRight:.5},variant:"plain",onClick:I=>w({index:b}).onClick(I),children:u.jsx(je.Close,{fontSize:"small"})}),sx:{marginLeft:"3px",marginY:"1px",backgroundColor:"#e0f3ff",padding:"2px",borderRadius:4,"&:hover":{cursor:"default"}},children:u.jsx(xn,{option:x},`option_${x.id}`)},x.id));return u.jsxs(T.FormControl,{size:"sm",sx:{marginBottom:"16px"},children:[u.jsx(T.FormLabel,{color:"primary",children:e.labels.contextEntityTag}),u.jsx(T.Autocomplete,{getOptionDisabled:()=>t.length===$B,forcePopupIcon:!1,multiple:!0,loading:o,slotProps:{input:{sx:{"&::placeholder":{fontSize:"14px"}}},root:{sx:{boxShadow:"none",backgroundColor:"white",minHeight:38}}},isOptionEqualToValue:(v,w)=>v.id===w.id,endDecorator:o?u.jsx(T.CircularProgress,{size:"sm",sx:{bgcolor:"primary"}}):null,placeholder:t.length>0?"":e.labels.typeContextTagNamePlaceholder,options:r,filterOptions:v=>v.filter(w=>!t.some(x=>x.value===w.value)),onInputChange:(v,w)=>{s(w)},onChange:p,getOptionKey:v=>v.id,groupBy:v=>v.group+"s",value:t!=null?t:[],renderTags:g,renderOption:(v,w)=>u.jsx(T.AutocompleteOption,Z(H({},v),{children:u.jsx(xn,{option:w})}))}),u.jsx(bt,{showToast:c,message:e.labels.getFootballEntitiesErrorMessage,color:"danger",hideToast:h})]})},FB=e=>new Map().set("id",e.id).set("type",e.type).set("label",e.label),jB=e=>{const t=JSON.parse(JSON.stringify(e.context)),n=e.context.content,r=e.context.campaign,i=FB(e.labels),o=(s,c)=>{const d=s.target.value;t.content[c]=d,e.onChange(t)},a=(s,c)=>{const d=s.target.value;t.campaign[c]=d,e.onChange(t)},l=s=>{s.length?t.tags=s.map(c=>({id:c.id,type:c.group,source:"football"})):t.tags=[],e.onChange(t)};return u.jsx(u.Fragment,{children:u.jsxs(Fh,{defaultValue:0,sx:{p:0,bgcolor:"transparent"},children:[u.jsxs(jh,{sx:{borderRadius:0,fontSize:"0.875rem",[`& .${ac.root}`]:{'&[aria-selected="true"]':{bgcolor:"transparent",py:1,borderColor:"transparent","&::before":{content:'""',display:"block",position:"absolute",height:2,bottom:-2,left:0,right:0},"&::after":{bgcolor:"primary.500"}}}},tabFlex:"auto",children:[u.jsx(zr,{children:e.labels.tags}),u.jsx(zr,{children:e.labels.content}),u.jsx(zr,{children:e.labels.campaign})]}),u.jsx(Jr,{value:0,sx:{px:0},children:u.jsx(NB,{labels:e.labels,tags:e.context.tags,onChangeTags:l})}),u.jsx(Jr,{value:1,sx:{px:0},children:Object.keys(n).map(s=>u.jsx(T.Box,{mb:2,children:u.jsx(eo,{label:i.get(s),placeholder:"",defaultValue:n[s],required:!1,size:"sm",onChange:c=>o(c,s)})},`context-content-${s}`))}),u.jsx(Jr,{value:2,sx:{px:0},children:Object.keys(r).map(s=>u.jsx(T.Box,{mb:2,children:u.jsx(eo,{label:i.get(s),placeholder:"",defaultValue:r[s],required:!1,size:"sm",onChange:c=>a(c,s)})},`context-campaign-${s}`))})]})})},zB=e=>e?H({},e):{main:"",mobile:""},VB=e=>{const[t,n]=C.useState(!1),r=zB(e.defaultValue),i=(a,l)=>{r[l]=a,e.onChange(r)},o=a=>{r[a]="",e.onChange(r)};return u.jsxs(T.Box,{sx:{marginBottom:"10px"},children:[u.jsx(ls,{labels:e.labels,title:e.labels.mainImage,image:r.main,onChangeImages:a=>i(a,"main"),clearImage:()=>o("main")}),u.jsx(T.Link,{underline:"hover",onClick:()=>n(!t),sx:{marginBottom:"10px"},children:t?e.labels.hideMoreImages:e.labels.showMoreImages}),t?u.jsx(ls,{labels:e.labels,title:e.labels.mobileImage,image:r.mobile,onChangeImages:a=>i(a,"mobile"),clearImage:()=>o("mobile")}):u.jsx(u.Fragment,{})]})},UB=({defaultValue:e,labels:t,onChange:n})=>{const r=C.useRef(null),i=[{id:"FREE",label:t.free},{id:"LEAD",label:t.lead},{id:"REGISTERED",label:t.registered}];return u.jsxs(T.FormControl,{size:"sm",sx:{mb:2},children:[u.jsx(T.FormLabel,{children:t.authRequirement}),u.jsx(T.Select,Z(H({value:e,size:"sm",slotProps:{button:{sx:{whiteSpace:"nowrap"}}},onChange:(o,a)=>n(a),sx:{minHeight:"37px"}},e&&{endDecorator:u.jsx(T.IconButton,{variant:"plain",color:"neutral",onMouseDown:o=>{o.stopPropagation()},onClick:()=>{var o;n(null),(o=r.current)==null||o.focusVisible()},sx:{width:"18px",height:"18px"},children:u.jsx(fm,{})}),indicator:null}),{children:i.map(o=>u.jsx(T.Option,{value:o.id,children:o.label},o.id))})),u.jsx(T.FormHelperText,{children:t.authRequirementDescription})]})};function HB(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return C.useMemo(()=>r=>{t.forEach(i=>i(r))},t)}const ds=typeof window!="undefined"&&typeof window.document!="undefined"&&typeof window.document.createElement!="undefined";function ui(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function hu(e){return"nodeType"in e}function Rt(e){var t,n;return e?ui(e)?e:hu(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function pu(e){const{Document:t}=Rt(e);return e instanceof t}function uo(e){return ui(e)?!1:e instanceof Rt(e).HTMLElement}function dv(e){return e instanceof Rt(e).SVGElement}function di(e){return e?ui(e)?e.document:hu(e)?pu(e)?e:uo(e)||dv(e)?e.ownerDocument:document:document:document}const ln=ds?C.useLayoutEffect:C.useEffect;function fs(e){const t=C.useRef(e);return ln(()=>{t.current=e}),C.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return t.current==null?void 0:t.current(...r)},[])}function WB(){const e=C.useRef(null),t=C.useCallback((r,i)=>{e.current=setInterval(r,i)},[]),n=C.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function fo(e,t){t===void 0&&(t=[e]);const n=C.useRef(e);return ln(()=>{n.current!==e&&(n.current=e)},t),n}function ho(e,t){const n=C.useRef();return C.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function hs(e){const t=fs(e),n=C.useRef(null),r=C.useCallback(i=>{i!==n.current&&(t==null||t(i,n.current)),n.current=i},[]);return[n,r]}function ps(e){const t=C.useRef();return C.useEffect(()=>{t.current=e},[e]),t.current}let gu={};function po(e,t){return C.useMemo(()=>{if(t)return t;const n=gu[e]==null?0:gu[e]+1;return gu[e]=n,e+"-"+n},[e,t])}function fv(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((o,a)=>{const l=Object.entries(a);for(const[s,c]of l){const d=o[s];d!=null&&(o[s]=d+e*c)}return o},H({},t))}}const fi=fv(1),go=fv(-1);function GB(e){return"clientX"in e&&"clientY"in e}function gs(e){if(!e)return!1;const{KeyboardEvent:t}=Rt(e.target);return t&&e instanceof t}function YB(e){if(!e)return!1;const{TouchEvent:t}=Rt(e.target);return t&&e instanceof t}function ms(e){if(YB(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return GB(e)?{x:e.clientX,y:e.clientY}:null}const rr=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[rr.Translate.toString(e),rr.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),hv="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function KB(e){return e.matches(hv)?e:e.querySelector(hv)}const qB={display:"none"};function JB(e){let{id:t,value:n}=e;return C.createElement("div",{id:t,style:qB},n)}function QB(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const i={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return C.createElement("div",{id:t,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function XB(){const[e,t]=C.useState("");return{announce:C.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const pv=C.createContext(null);function ZB(e){const t=C.useContext(pv);C.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function e$(){const[e]=C.useState(()=>new Set),t=C.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[C.useCallback(r=>{let{type:i,event:o}=r;e.forEach(a=>{var l;return(l=a[i])==null?void 0:l.call(a,o)})},[e]),t]}const t$={draggable:`
2471
+ `),o=!1),Object.assign(Object.assign({},e),{allowNegative:o})}function DB(e){e=kB(e),e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle;var t=e.suffix,n=e.allowNegative,r=e.allowLeadingZeros,i=e.onKeyDown;i===void 0&&(i=nr);var o=e.onBlur;o===void 0&&(o=nr);var a=e.thousandSeparator,l=e.decimalScale,s=e.fixedDecimalScale,c=e.prefix;c===void 0&&(c="");var d=e.defaultValue,f=e.value,h=e.valueIsNumericString,p=e.onValueChange,m=ev(e,["decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","suffix","allowNegative","allowLeadingZeros","onKeyDown","onBlur","thousandSeparator","decimalScale","fixedDecimalScale","prefix","defaultValue","value","valueIsNumericString","onValueChange"]),g=us(e),v=g.decimalSeparator,w=g.allowedDecimalSeparators,x=function(B){return uv(B,e)},b=function(B,L){return EB(B,L,e)},I=ci(f)?d:f,y=h!=null?h:TB(I,c,t);ci(f)?ci(d)||(y=y||typeof d=="number"):y=y||typeof f=="number";var S=function(B){return tv(B)?B:(typeof B=="number"&&(B=ov(B)),y&&typeof l=="number"?av(B,l,!!s):B)},E=cv(S(f),S(d),!!y,x,b,p),P=E[0],F=P.numAsString,Y=P.formattedValue,W=E[1],A=function(B){var L=B.target,V=B.key,q=L.selectionStart,ee=L.selectionEnd,O=L.value;if(O===void 0&&(O=""),(V==="Backspace"||V==="Delete")&&ee<c.length){B.preventDefault();return}if(q!==ee){i(B);return}V==="Backspace"&&O[0]==="-"&&q===c.length+1&&n&&wr(L,1),l&&s&&(V==="Backspace"&&O[q-1]===v?(wr(L,q-1),B.preventDefault()):V==="Delete"&&O[q]===v&&B.preventDefault()),w!=null&&w.includes(V)&&O[q]===v&&wr(L,q+1);var M=a===!0?",":a;V==="Backspace"&&O[q-1]===M&&wr(L,q-1),V==="Delete"&&O[q]===M&&wr(L,q+1),i(B)},U=function(B){var L=F;if(L.match(/\d/g)||(L=""),r||(L=hB(L)),s&&l&&(L=av(L,l,s)),L!==F){var V=uv(L,e);W({formattedValue:V,value:L,floatValue:parseFloat(L)},{event:B,source:lo.event})}o(B)},G=function(B){return B===v?!0:co(B)},$=function(B){var L=B.currentValue,V=B.lastValue,q=B.formattedValue,ee=B.currentValueIndex,O=B.formattedValueIndex,M=L[ee],N=q[O],z=sv(V,L),te=z.to,ae=function(oe){return b(oe).indexOf(".")+c.length};return f===0&&s&&l&&L[te.start]===v&&ae(L)<ee&&ae(q)>O?!1:ee>=te.start&&ee<te.end&&w&&w.includes(M)&&N===v?!0:M===N};return Object.assign(Object.assign({},m),{value:Y,valueIsNumericString:!1,isValidInputCharacter:G,isCharacterSame:$,onValueChange:W,format:x,removeFormatting:b,getCaretBoundary:function(B){return _B(B,e)},onKeyDown:A,onBlur:U})}function PB(e){var t=DB(e);return C.createElement(IB,Object.assign({},t))}const OB=j.forwardRef(function(t,n){const o=t,{onChange:r}=o,i=He(o,["onChange"]);return u.jsx(PB,Z(H({},i),{getInputRef:n,onValueChange:a=>{r({target:{name:t.name,value:a.value}})},thousandSeparator:!0,valueIsNumericString:!0}))}),RB=e=>{const t=n=>{e.onChange(Number(n.target.value))};return u.jsxs(ou,{size:"sm",children:[u.jsx(au,{children:e.label}),u.jsx(Va,{sx:e.sx,value:e.defaultValue,onChange:t,slotProps:{input:{component:OB}}}),e.description?u.jsx(T.FormHelperText,{children:e.description}):u.jsx(u.Fragment,{})]})},MB=e=>e.startsWith("fb:c:")?"competition":e.startsWith("fb:t:")?"team":"player",LB=(e,t,n,r)=>{const i=e.filter(c=>c.type.toLocaleLowerCase()==="competition").map(c=>c.id),o=e.filter(c=>c.type.toLocaleLowerCase()==="team").map(c=>c.id),a=e.filter(c=>c.type.toLocaleLowerCase()==="player").map(c=>c.id),l=[],s=[];if(i.length>0){const c=t.football.getCompetitions({competitionIds:i}).then(d=>{s.push(d)}).catch(d=>{console.error(d),r()});l.push(c)}if(o.length>0){const c=t.football.getTeams({teamIds:o}).then(d=>{s.push(d.data)}).catch(d=>{console.error(d),r()});l.push(c)}if(a.length>0){const c=t.football.getPlayers({playerIds:a}).then(d=>{s.push(d.data)}).catch(d=>{console.error(d),r()});l.push(c)}Promise.all(l).then(()=>{const d=Array.prototype.concat.apply([],s).map(f=>BB(f));n(d)})},BB=e=>{const t=new Xm;return t.label=e.name,t.value=e.name,t.id=e.id,t.group=MB(e.id),e.birthDate?t.logo=e.assets&&e.assets.headshot&&e.assets.headshot:t.logo=e.assets&&e.assets.logo&&e.assets.logo,t.countryName=e.country.name,t.countryFlag=e.country.assets&&e.country.assets.flag?e.country.assets.flag:ht.country,t},$B=10,NB=e=>{const[t,n]=C.useState([]),[r,i]=C.useState([]),[o,a]=C.useState(!1),[l,s]=C.useState(""),[c,d]=C.useState(!1),{sdk:f}=xt(),h=()=>d(!c),p=(v,w)=>{n(w),e.onChangeTags(w)};C.useEffect(()=>{LB(e.tags,f,n,h)},[e.tags]);const m=C.useMemo(()=>si(v=>{if(!v){i([]),a(!1);return}a(!0),f.football.search({query:v}).then(w=>{i([...Zm(w)]),a(!1)}).catch(w=>{console.error(w),i([]),a(!1)})},300),[]);C.useEffect(()=>(m(l),()=>m.cancel()),[l,m]);const g=(v,w)=>v.map((x,b)=>u.jsx(T.Chip,{variant:"solid",endDecorator:u.jsx(T.ChipDelete,{color:"danger",sx:{marginRight:.5},variant:"plain",onClick:I=>w({index:b}).onClick(I),children:u.jsx(je.Close,{fontSize:"small"})}),sx:{marginLeft:"3px",marginY:"1px",backgroundColor:"#e0f3ff",padding:"2px",borderRadius:4,"&:hover":{cursor:"default"}},children:u.jsx(xn,{option:x},`option_${x.id}`)},x.id));return u.jsxs(T.FormControl,{size:"sm",sx:{marginBottom:"16px"},children:[u.jsx(T.FormLabel,{color:"primary",children:e.labels.contextEntityTag}),u.jsx(T.Autocomplete,{getOptionDisabled:()=>t.length===$B,forcePopupIcon:!1,multiple:!0,loading:o,slotProps:{input:{sx:{"&::placeholder":{fontSize:"14px"}}},root:{sx:{boxShadow:"none",backgroundColor:"white",minHeight:38}}},isOptionEqualToValue:(v,w)=>v.id===w.id,endDecorator:o?u.jsx(T.CircularProgress,{size:"sm",sx:{bgcolor:"primary"}}):null,placeholder:t.length>0?"":e.labels.typeContextTagNamePlaceholder,options:r,filterOptions:v=>v.filter(w=>!t.some(x=>x.value===w.value)),onInputChange:(v,w)=>{s(w)},onChange:p,getOptionKey:v=>v.id,groupBy:v=>v.group+"s",value:t!=null?t:[],renderTags:g,renderOption:(v,w)=>u.jsx(T.AutocompleteOption,Z(H({},v),{children:u.jsx(xn,{option:w})}))}),u.jsx(bt,{showToast:c,message:e.labels.getFootballEntitiesErrorMessage,color:"danger",hideToast:h})]})},FB=e=>new Map().set("id",e.id).set("type",e.type).set("label",e.label),jB=e=>{const t=JSON.parse(JSON.stringify(e.context)),n=e.context.content,r=e.context.campaign,i=FB(e.labels),o=(s,c)=>{const d=s.target.value;t.content[c]=d,e.onChange(t)},a=(s,c)=>{const d=s.target.value;t.campaign[c]=d,e.onChange(t)},l=s=>{s.length?t.tags=s.map(c=>({id:c.id,type:c.group,source:"football"})):t.tags=[],e.onChange(t)};return u.jsx(u.Fragment,{children:u.jsxs(Fh,{defaultValue:0,sx:{p:0,bgcolor:"transparent"},children:[u.jsxs(jh,{sx:{borderRadius:0,fontSize:"0.875rem",[`& .${ac.root}`]:{'&[aria-selected="true"]':{bgcolor:"transparent",py:1,borderColor:"transparent","&::before":{content:'""',display:"block",position:"absolute",height:2,bottom:-2,left:0,right:0},"&::after":{bgcolor:"primary.500"}}}},tabFlex:"auto",children:[u.jsx(zr,{children:e.labels.tags}),u.jsx(zr,{children:e.labels.content}),u.jsx(zr,{children:e.labels.campaign})]}),u.jsx(Jr,{value:0,sx:{px:0},children:u.jsx(NB,{labels:e.labels,tags:e.context.tags,onChangeTags:l})}),u.jsx(Jr,{value:1,sx:{px:0},children:Object.keys(n).map(s=>u.jsx(T.Box,{mb:2,children:u.jsx(eo,{label:i.get(s),placeholder:"",defaultValue:n[s],required:!1,size:"sm",onChange:c=>o(c,s)})},`context-content-${s}`))}),u.jsx(Jr,{value:2,sx:{px:0},children:Object.keys(r).map(s=>u.jsx(T.Box,{mb:2,children:u.jsx(eo,{label:i.get(s),placeholder:"",defaultValue:r[s],required:!1,size:"sm",onChange:c=>a(c,s)})},`context-campaign-${s}`))})]})})},zB=e=>e?H({},e):{main:"",mobile:""},VB=e=>{const[t,n]=C.useState(!1),r=zB(e.defaultValue),i=(a,l)=>{r[l]=a,e.onChange(r)},o=a=>{r[a]="",e.onChange(r)};return u.jsxs(T.Box,{sx:{marginBottom:"10px"},children:[u.jsx(ls,{labels:e.labels,title:e.labels.mainImage,image:r.main,onChangeImages:a=>i(a,"main"),clearImage:()=>o("main")}),u.jsx(T.Link,{underline:"hover",onClick:()=>n(!t),sx:{marginBottom:"10px"},children:t?e.labels.hideMoreImages:e.labels.showMoreImages}),t?u.jsx(ls,{labels:e.labels,title:e.labels.mobileImage,image:r.mobile,onChangeImages:a=>i(a,"mobile"),clearImage:()=>o("mobile")}):u.jsx(u.Fragment,{})]})},UB=({defaultValue:e,isClearable:t=!0,labels:n,onChange:r})=>{const i=C.useRef(null),o=[{id:"FREE",label:n.free},{id:"LEAD",label:n.lead},{id:"REGISTERED",label:n.registered}];return u.jsxs(T.FormControl,{size:"sm",sx:{mb:2},children:[u.jsx(T.FormLabel,{children:n.authRequirement}),u.jsx(T.Select,Z(H({value:e,size:"sm",slotProps:{button:{sx:{whiteSpace:"nowrap"}}},onChange:(a,l)=>r(l),sx:{minHeight:"37px"}},e&&t&&{endDecorator:u.jsx(T.IconButton,{variant:"plain",color:"neutral",onMouseDown:a=>{a.stopPropagation()},onClick:()=>{var a;r(null),(a=i.current)==null||a.focusVisible()},sx:{width:"18px",height:"18px"},children:u.jsx(fm,{})}),indicator:null}),{children:o.map(a=>u.jsx(T.Option,{value:a.id,children:a.label},a.id))})),u.jsx(T.FormHelperText,{children:n.authRequirementDescription})]})};function HB(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return C.useMemo(()=>r=>{t.forEach(i=>i(r))},t)}const ds=typeof window!="undefined"&&typeof window.document!="undefined"&&typeof window.document.createElement!="undefined";function ui(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function hu(e){return"nodeType"in e}function Rt(e){var t,n;return e?ui(e)?e:hu(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function pu(e){const{Document:t}=Rt(e);return e instanceof t}function uo(e){return ui(e)?!1:e instanceof Rt(e).HTMLElement}function dv(e){return e instanceof Rt(e).SVGElement}function di(e){return e?ui(e)?e.document:hu(e)?pu(e)?e:uo(e)||dv(e)?e.ownerDocument:document:document:document}const ln=ds?C.useLayoutEffect:C.useEffect;function fs(e){const t=C.useRef(e);return ln(()=>{t.current=e}),C.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return t.current==null?void 0:t.current(...r)},[])}function WB(){const e=C.useRef(null),t=C.useCallback((r,i)=>{e.current=setInterval(r,i)},[]),n=C.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function fo(e,t){t===void 0&&(t=[e]);const n=C.useRef(e);return ln(()=>{n.current!==e&&(n.current=e)},t),n}function ho(e,t){const n=C.useRef();return C.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function hs(e){const t=fs(e),n=C.useRef(null),r=C.useCallback(i=>{i!==n.current&&(t==null||t(i,n.current)),n.current=i},[]);return[n,r]}function ps(e){const t=C.useRef();return C.useEffect(()=>{t.current=e},[e]),t.current}let gu={};function po(e,t){return C.useMemo(()=>{if(t)return t;const n=gu[e]==null?0:gu[e]+1;return gu[e]=n,e+"-"+n},[e,t])}function fv(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((o,a)=>{const l=Object.entries(a);for(const[s,c]of l){const d=o[s];d!=null&&(o[s]=d+e*c)}return o},H({},t))}}const fi=fv(1),go=fv(-1);function GB(e){return"clientX"in e&&"clientY"in e}function gs(e){if(!e)return!1;const{KeyboardEvent:t}=Rt(e.target);return t&&e instanceof t}function YB(e){if(!e)return!1;const{TouchEvent:t}=Rt(e.target);return t&&e instanceof t}function ms(e){if(YB(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return GB(e)?{x:e.clientX,y:e.clientY}:null}const rr=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[rr.Translate.toString(e),rr.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),hv="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function KB(e){return e.matches(hv)?e:e.querySelector(hv)}const qB={display:"none"};function JB(e){let{id:t,value:n}=e;return C.createElement("div",{id:t,style:qB},n)}function QB(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const i={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return C.createElement("div",{id:t,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function XB(){const[e,t]=C.useState("");return{announce:C.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const pv=C.createContext(null);function ZB(e){const t=C.useContext(pv);C.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function e$(){const[e]=C.useState(()=>new Set),t=C.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[C.useCallback(r=>{let{type:i,event:o}=r;e.forEach(a=>{var l;return(l=a[i])==null?void 0:l.call(a,o)})},[e]),t]}const t$={draggable:`
2472
2472
  To pick up a draggable item, press the space bar.
2473
2473
  While dragging, use the arrow keys to move the item.
2474
2474
  Press space again to drop the item in its new position, or press escape to cancel.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fansunited-management-components",
3
- "version": "1.23.1",
3
+ "version": "1.24.0",
4
4
  "main": "index.es.js",
5
5
  "author": "Fans United",
6
6
  "description": "",
@@ -2,6 +2,7 @@ import { default as React } from 'react';
2
2
 
3
3
  type AuthRequirementProps = {
4
4
  defaultValue: string;
5
+ isClearable?: boolean;
5
6
  labels: any;
6
7
  onChange: (authRequirement: string | null) => void;
7
8
  };