fansunited-management-components 1.43.0-RC5 → 1.43.0-RC6
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 +6 -6
- package/index.umd.js +1 -1
- package/package.json +1 -1
- package/src/components/Utils/FormatNumber.d.ts +1 -0
package/index.es.js
CHANGED
|
@@ -36136,12 +36136,12 @@ const wy = Qe(/* @__PURE__ */ u.jsx("path", {
|
|
|
36136
36136
|
) }),
|
|
36137
36137
|
/* @__PURE__ */ u.jsx(gt, { showToast: p, message: e.searchProfilesErrorMessage, color: "danger", hideToast: C })
|
|
36138
36138
|
] });
|
|
36139
|
-
}, sz = ({ value: e, sx: t }) => {
|
|
36140
|
-
const
|
|
36141
|
-
const
|
|
36142
|
-
return
|
|
36143
|
-
},
|
|
36144
|
-
return
|
|
36139
|
+
}, sz = ({ value: e, sx: t, tooltipPlacement: n }) => {
|
|
36140
|
+
const r = (l) => {
|
|
36141
|
+
const c = Math.abs(l);
|
|
36142
|
+
return c >= 1e9 ? (l / 1e9).toFixed(1) + "b" : c >= 1e6 ? (l / 1e6).toFixed(1) + "m" : c >= 1e3 ? (l / 1e3).toFixed(1) + "k" : l.toString();
|
|
36143
|
+
}, i = (l) => new Intl.NumberFormat("en-US").format(l), o = Math.abs(e) >= 1e3, a = r(e), s = i(e);
|
|
36144
|
+
return o ? /* @__PURE__ */ u.jsx(Oe, { title: s, placement: n, arrow: !0, children: /* @__PURE__ */ u.jsx(ge, { sx: t, children: a }) }) : /* @__PURE__ */ u.jsx(ge, { sx: t, children: a });
|
|
36145
36145
|
}, lz = {
|
|
36146
36146
|
Login: NL,
|
|
36147
36147
|
InformationInput: On,
|
package/index.umd.js
CHANGED
|
@@ -2487,4 +2487,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
2487
2487
|
data-poll-url="${l}"`:"",m=`<div
|
|
2488
2488
|
data-component="fu-widget"
|
|
2489
2489
|
data-content-type="list"${d}${f}${h}${p}
|
|
2490
|
-
></div>`,g=({title:I})=>u.jsx(b.Tooltip,{title:I,sx:{maxWidth:300},children:u.jsx(ni,{color:"primary"})}),v=()=>u.jsxs(b.Card,{sx:{pb:1,mb:3},children:[u.jsx(xn,{label:t.classicQuizURL,placeholder:"",defaultValue:i,required:!1,size:"md",endDecorator:u.jsx(g,{title:t.quizzesInfoMessage}),onChange:I=>o(I.target.value)}),u.jsx(xn,{label:t.eitherOrURL,placeholder:"",defaultValue:a,required:!1,size:"md",endDecorator:u.jsx(g,{title:t.eitherOrsInfoMessage}),onChange:I=>s(I.target.value)}),u.jsx(xn,{label:t.pollURL,placeholder:"",defaultValue:l,required:!1,size:"md",endDecorator:u.jsx(g,{title:t.pollsInfoMessage}),onChange:I=>c(I.target.value)})]});return u.jsxs(b.Box,{mt:1,children:[u.jsx(fs,{defaultValue:n,label:t.configureURLs,labelPosition:"end",description:"",descriptionColor:"neutral",disabled:!1,onChange:I=>{I===!1&&(o(""),s(""),c("")),r(I)}}),n&&v(),u.jsxs(b.Box,{position:"relative",mb:1,children:[u.jsx(b.Textarea,{value:m,minRows:"5",maxRows:"20",readOnly:!0,onMouseDown:I=>I.preventDefault(),sx:{cursor:"default","&:hover":{cursor:"default"},"& textarea":{cursor:"default"}}}),u.jsx(b.Tooltip,{title:t.copyToClipboard,children:u.jsx(b.Button,{onClick:()=>{navigator.clipboard.writeText(m)},sx:{position:"absolute",top:"10px",right:"10px",zIndex:1},variant:"soft",color:"neutral",children:u.jsx(Oe.ContentCopy,{})})})]}),u.jsx(b.Alert,{variant:"outlined",color:"primary",startDecorator:u.jsx(ni,{}),sx:{mb:1,width:"fit-content"},children:u.jsxs(b.Typography,{color:"primary",fontSize:14,fontWeight:500,children:[t.divElementTextInfo,u.jsx(b.Link,{href:"https://docs.fansunitedmedia.com/docs/user-centric-widgets#/",underline:"always",target:"_blank",rel:"noopener noreferrer",children:"User-centric widgets"})]})})]})},ub=e=>(e==null?void 0:e.map(t=>({id:t.id,value:t.nickname?t.nickname:t.name||`No name ${t.id.slice(0,5)}`,label:t.nickname?t.nickname:t.name||`No name ${t.id.slice(0,5)}`,avatar:t.avatar})))||[],pF={Login:KR,InformationInput:xn,RichText:dc,HeaderButtons:IP,MarketSelection:cL,Accordion:dT,DynamicFields:zP,BasicSelect:hT,BooleanSwitch:fs,Branding:wP,ProfileSearchSelect:PM,RangeCalendar:NP,CompetitionSearchSelect:kM,Related:hL,Images:SR,Duration:$P,DatePickerComponent:no,Flags:xR,Spinner:ds,Tags:Om,Toast:at,AdContent:fT,Match:uL,Winners:yB,CompetitionsSearchSelect:_M,TeamsSearchSelect:DM,CustomSelect:_L,Schedule:wL,NoPermissionCard:FP,CustomFlatpickrCalendar:Qc,ContextSelectFilter:CB,NumberInput:YB,EntityContext:e$,MiniGamesImages:n$,AuthRequirement:r$,SortableList:YN,ItemsPerPageFilter:KN,ImageCard:lo,RelatedRelationship:lF,ExportUsersLeads:cF,SignOutButton:ag,BasicSortableList:dF,WidgetEmbedCode:fF,WidgetListEmbedCode:hF,AdvancedProfileSearchSelect:({labels:e,ids:t,onChange:n})=>{const[r,i]=C.useState([]),[o,a]=C.useState([]),[s,l]=C.useState(""),[c,d]=C.useState("name"),[f,h]=C.useState(!1),[p,m]=C.useState(!1),{sdk:g}=ft(),v=!0,I=()=>m(!p),S=(A,E)=>{i(E);const _=E.map(D=>D.id);n(_&&_.length?_:null)},x=3;C.useEffect(()=>{!s&&t&&t.length&&g.profile.getByIds(t,void 0,v).then(A=>{i(ub(A))}).catch(A=>{I(),console.error(A),i([])})},[]);const w=C.useMemo(()=>Sr((A,E)=>{h(!0),g.profile.getByIds(E==="id"?[A]:[],E==="name"?A:void 0,v).then(_=>{a([...ub(_)]),h(!1)}).catch(_=>{console.error(_),I(),a([]),h(!1)})},300),[]);C.useEffect(()=>{if(!s||s.length<x){a([]);return}return w(s,c),()=>w.cancel()},[s,w,c]);const y=(A,E)=>A.map((_,D)=>{var G;return u.jsx(b.Chip,{variant:"solid",endDecorator:u.jsx(b.ChipDelete,{color:"danger",sx:{marginRight:.5},variant:"plain",onClick:F=>E({index:D}).onClick(F),children:u.jsx(Oe.Close,{fontSize:"small"})}),sx:{marginLeft:"3px",marginY:"1px",backgroundColor:"#e0f3ff",padding:"2px",borderRadius:4,"&:hover":{cursor:"default"}},children:u.jsxs(b.Box,{display:"flex",alignItems:"center",mr:1,children:[u.jsx(b.Avatar,{sx:{width:"1.5rem",height:" 1.5rem",mr:.5,borderRadius:"0.75rem"},src:(G=_.avatar)!=null?G:st.avatar}),u.jsx(b.Typography,{children:_.label})]})},_.id)});return u.jsxs(u.Fragment,{children:[u.jsx(b.Box,{sx:{marginBottom:"16px"},children:u.jsx(b.Autocomplete,{forcePopupIcon:!1,multiple:!0,loading:f,disableClearable:!0,slotProps:{input:{sx:{"&::placeholder":{fontSize:"14px"}}},root:{sx:{boxShadow:"none",backgroundColor:"white",minHeight:38}}},isOptionEqualToValue:(A,E)=>A.id===E.id,endDecorator:u.jsxs(u.Fragment,{children:[f&&u.jsx(b.CircularProgress,{size:"sm",sx:{bgcolor:"primary",marginRight:2}}),u.jsx(b.Divider,{orientation:"vertical"}),u.jsxs(b.Select,{variant:"plain",value:c,onChange:(A,E)=>d(E),slotProps:{listbox:{variant:"outlined"}},sx:{mr:-1.5,"&:hover":{bgcolor:"transparent"}},children:[u.jsx(b.Option,{value:"name",children:e.searchByName}),u.jsx(b.Option,{value:"id",children:e.searchById})]})]}),placeholder:r.length>0?"":e.excludedProfilesPlaceholder,options:o,filterOptions:A=>A.filter(E=>!r.some(_=>_.value===E.value)),onInputChange:(A,E)=>{l(E)},onChange:S,getOptionKey:A=>A.id,value:r,renderTags:y,renderOption:(A,E)=>{var _;return u.jsx(b.AutocompleteOption,q(N({},A),{children:u.jsxs(b.Box,{display:"flex",alignItems:"center",mr:1,children:[u.jsx(b.Avatar,{sx:{width:"1.5rem",height:" 1.5rem",mr:.5,borderRadius:"0.75rem"},src:(_=E.avatar)!=null?_:st.avatar}),u.jsx(b.Typography,{children:E.label})]})}))}})}),u.jsx(at,{showToast:p,message:e.searchProfilesErrorMessage,color:"danger",hideToast:I})]})},FormatNumber:({value:e,sx:t})=>{const
|
|
2490
|
+
></div>`,g=({title:I})=>u.jsx(b.Tooltip,{title:I,sx:{maxWidth:300},children:u.jsx(ni,{color:"primary"})}),v=()=>u.jsxs(b.Card,{sx:{pb:1,mb:3},children:[u.jsx(xn,{label:t.classicQuizURL,placeholder:"",defaultValue:i,required:!1,size:"md",endDecorator:u.jsx(g,{title:t.quizzesInfoMessage}),onChange:I=>o(I.target.value)}),u.jsx(xn,{label:t.eitherOrURL,placeholder:"",defaultValue:a,required:!1,size:"md",endDecorator:u.jsx(g,{title:t.eitherOrsInfoMessage}),onChange:I=>s(I.target.value)}),u.jsx(xn,{label:t.pollURL,placeholder:"",defaultValue:l,required:!1,size:"md",endDecorator:u.jsx(g,{title:t.pollsInfoMessage}),onChange:I=>c(I.target.value)})]});return u.jsxs(b.Box,{mt:1,children:[u.jsx(fs,{defaultValue:n,label:t.configureURLs,labelPosition:"end",description:"",descriptionColor:"neutral",disabled:!1,onChange:I=>{I===!1&&(o(""),s(""),c("")),r(I)}}),n&&v(),u.jsxs(b.Box,{position:"relative",mb:1,children:[u.jsx(b.Textarea,{value:m,minRows:"5",maxRows:"20",readOnly:!0,onMouseDown:I=>I.preventDefault(),sx:{cursor:"default","&:hover":{cursor:"default"},"& textarea":{cursor:"default"}}}),u.jsx(b.Tooltip,{title:t.copyToClipboard,children:u.jsx(b.Button,{onClick:()=>{navigator.clipboard.writeText(m)},sx:{position:"absolute",top:"10px",right:"10px",zIndex:1},variant:"soft",color:"neutral",children:u.jsx(Oe.ContentCopy,{})})})]}),u.jsx(b.Alert,{variant:"outlined",color:"primary",startDecorator:u.jsx(ni,{}),sx:{mb:1,width:"fit-content"},children:u.jsxs(b.Typography,{color:"primary",fontSize:14,fontWeight:500,children:[t.divElementTextInfo,u.jsx(b.Link,{href:"https://docs.fansunitedmedia.com/docs/user-centric-widgets#/",underline:"always",target:"_blank",rel:"noopener noreferrer",children:"User-centric widgets"})]})})]})},ub=e=>(e==null?void 0:e.map(t=>({id:t.id,value:t.nickname?t.nickname:t.name||`No name ${t.id.slice(0,5)}`,label:t.nickname?t.nickname:t.name||`No name ${t.id.slice(0,5)}`,avatar:t.avatar})))||[],pF={Login:KR,InformationInput:xn,RichText:dc,HeaderButtons:IP,MarketSelection:cL,Accordion:dT,DynamicFields:zP,BasicSelect:hT,BooleanSwitch:fs,Branding:wP,ProfileSearchSelect:PM,RangeCalendar:NP,CompetitionSearchSelect:kM,Related:hL,Images:SR,Duration:$P,DatePickerComponent:no,Flags:xR,Spinner:ds,Tags:Om,Toast:at,AdContent:fT,Match:uL,Winners:yB,CompetitionsSearchSelect:_M,TeamsSearchSelect:DM,CustomSelect:_L,Schedule:wL,NoPermissionCard:FP,CustomFlatpickrCalendar:Qc,ContextSelectFilter:CB,NumberInput:YB,EntityContext:e$,MiniGamesImages:n$,AuthRequirement:r$,SortableList:YN,ItemsPerPageFilter:KN,ImageCard:lo,RelatedRelationship:lF,ExportUsersLeads:cF,SignOutButton:ag,BasicSortableList:dF,WidgetEmbedCode:fF,WidgetListEmbedCode:hF,AdvancedProfileSearchSelect:({labels:e,ids:t,onChange:n})=>{const[r,i]=C.useState([]),[o,a]=C.useState([]),[s,l]=C.useState(""),[c,d]=C.useState("name"),[f,h]=C.useState(!1),[p,m]=C.useState(!1),{sdk:g}=ft(),v=!0,I=()=>m(!p),S=(A,E)=>{i(E);const _=E.map(D=>D.id);n(_&&_.length?_:null)},x=3;C.useEffect(()=>{!s&&t&&t.length&&g.profile.getByIds(t,void 0,v).then(A=>{i(ub(A))}).catch(A=>{I(),console.error(A),i([])})},[]);const w=C.useMemo(()=>Sr((A,E)=>{h(!0),g.profile.getByIds(E==="id"?[A]:[],E==="name"?A:void 0,v).then(_=>{a([...ub(_)]),h(!1)}).catch(_=>{console.error(_),I(),a([]),h(!1)})},300),[]);C.useEffect(()=>{if(!s||s.length<x){a([]);return}return w(s,c),()=>w.cancel()},[s,w,c]);const y=(A,E)=>A.map((_,D)=>{var G;return u.jsx(b.Chip,{variant:"solid",endDecorator:u.jsx(b.ChipDelete,{color:"danger",sx:{marginRight:.5},variant:"plain",onClick:F=>E({index:D}).onClick(F),children:u.jsx(Oe.Close,{fontSize:"small"})}),sx:{marginLeft:"3px",marginY:"1px",backgroundColor:"#e0f3ff",padding:"2px",borderRadius:4,"&:hover":{cursor:"default"}},children:u.jsxs(b.Box,{display:"flex",alignItems:"center",mr:1,children:[u.jsx(b.Avatar,{sx:{width:"1.5rem",height:" 1.5rem",mr:.5,borderRadius:"0.75rem"},src:(G=_.avatar)!=null?G:st.avatar}),u.jsx(b.Typography,{children:_.label})]})},_.id)});return u.jsxs(u.Fragment,{children:[u.jsx(b.Box,{sx:{marginBottom:"16px"},children:u.jsx(b.Autocomplete,{forcePopupIcon:!1,multiple:!0,loading:f,disableClearable:!0,slotProps:{input:{sx:{"&::placeholder":{fontSize:"14px"}}},root:{sx:{boxShadow:"none",backgroundColor:"white",minHeight:38}}},isOptionEqualToValue:(A,E)=>A.id===E.id,endDecorator:u.jsxs(u.Fragment,{children:[f&&u.jsx(b.CircularProgress,{size:"sm",sx:{bgcolor:"primary",marginRight:2}}),u.jsx(b.Divider,{orientation:"vertical"}),u.jsxs(b.Select,{variant:"plain",value:c,onChange:(A,E)=>d(E),slotProps:{listbox:{variant:"outlined"}},sx:{mr:-1.5,"&:hover":{bgcolor:"transparent"}},children:[u.jsx(b.Option,{value:"name",children:e.searchByName}),u.jsx(b.Option,{value:"id",children:e.searchById})]})]}),placeholder:r.length>0?"":e.excludedProfilesPlaceholder,options:o,filterOptions:A=>A.filter(E=>!r.some(_=>_.value===E.value)),onInputChange:(A,E)=>{l(E)},onChange:S,getOptionKey:A=>A.id,value:r,renderTags:y,renderOption:(A,E)=>{var _;return u.jsx(b.AutocompleteOption,q(N({},A),{children:u.jsxs(b.Box,{display:"flex",alignItems:"center",mr:1,children:[u.jsx(b.Avatar,{sx:{width:"1.5rem",height:" 1.5rem",mr:.5,borderRadius:"0.75rem"},src:(_=E.avatar)!=null?_:st.avatar}),u.jsx(b.Typography,{children:E.label})]})}))}})}),u.jsx(at,{showToast:p,message:e.searchProfilesErrorMessage,color:"danger",hideToast:I})]})},FormatNumber:({value:e,sx:t,tooltipPlacement:n})=>{const r=l=>{const c=Math.abs(l);return c>=1e9?(l/1e9).toFixed(1)+"b":c>=1e6?(l/1e6).toFixed(1)+"m":c>=1e3?(l/1e3).toFixed(1)+"k":l.toString()},i=l=>new Intl.NumberFormat("en-US").format(l),o=Math.abs(e)>=1e3,a=r(e),s=i(e);return o?u.jsx(b.Tooltip,{title:s,placement:n,arrow:!0,children:u.jsx(b.Typography,{sx:t,children:a})}):u.jsx(b.Typography,{sx:t,children:a})}},db=C.createContext(null),gF=({children:e})=>u.jsx(db.Provider,{value:pF,children:e}),mF=()=>{const e=C.useContext(db);if(!e)throw new Error("useComponentContext must be used within a ComponentProvider");return e},fb=425,hb=1024;return{APIProvider:SI,AuthProvider:AI,AuthContext:zf,ComponentProvider:gF,useComponentContext:mF,useAPIContext:ft,useIsMobile:()=>{const[e,t]=C.useState(window.innerWidth<=hb),[n,r]=C.useState(window.innerWidth<=fb);return C.useLayoutEffect(()=>{const i=()=>{t(window.innerWidth<=hb),r(window.innerWidth<=fb)};return window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)},[]),{isMobile:e,isPhone:n}}}});
|
package/package.json
CHANGED
|
@@ -4,6 +4,7 @@ import { SxProps } from '@mui/material';
|
|
|
4
4
|
interface FormatNumberProps {
|
|
5
5
|
value: number;
|
|
6
6
|
sx?: SxProps;
|
|
7
|
+
tooltipPlacement?: 'bottom-end' | 'bottom-start' | 'bottom' | 'left-end' | 'left-start' | 'left' | 'right-end' | 'right-start' | 'right' | 'top-end' | 'top-start' | 'top';
|
|
7
8
|
}
|
|
8
9
|
declare const FormatNumber: React.FC<FormatNumberProps>;
|
|
9
10
|
export default FormatNumber;
|