@tap-payments/os-micro-frontend-shared 0.3.288 → 0.3.289-test.1794846477

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.
Files changed (64) hide show
  1. package/build/_chunks/chunk-PYE5IO3O.js +1 -0
  2. package/build/_chunks/chunk-RK4UGNRY.js +1 -0
  3. package/build/_chunks/{chunk-E2Z6V4OE.js → chunk-XL3OK5YJ.js} +1 -1
  4. package/build/components/ActionMenu/ActionMenu.d.ts +4 -0
  5. package/build/components/ActionMenu/ActionMenuFlyoutRow.d.ts +4 -0
  6. package/build/components/ActionMenu/ActionMenuLeafRow.d.ts +10 -0
  7. package/build/components/ActionMenu/ActionMenuPanelContext.d.ts +4 -0
  8. package/build/components/ActionMenu/ActionMenuRow.d.ts +7 -0
  9. package/build/components/ActionMenu/ActionMenuRowLeading.d.ts +4 -0
  10. package/build/components/ActionMenu/ActionMenuRowTrailing.d.ts +6 -0
  11. package/build/components/ActionMenu/constants.d.ts +47 -0
  12. package/build/components/ActionMenu/index.d.ts +4 -0
  13. package/build/components/ActionMenu/index.js +1 -0
  14. package/build/components/ActionMenu/style.d.ts +48 -0
  15. package/build/components/ActionMenu/type.d.ts +141 -0
  16. package/build/components/ActionMenu/utils.d.ts +27 -0
  17. package/build/components/ColumnViews/index.js +1 -1
  18. package/build/components/DateFilter/index.js +1 -1
  19. package/build/components/ExportReportButton/ExportReportButton.d.ts +4 -0
  20. package/build/components/ExportReportButton/ReportFileRow.d.ts +10 -0
  21. package/build/components/ExportReportButton/ReportLoadingRow.d.ts +8 -0
  22. package/build/components/ExportReportButton/ReportRequestRow.d.ts +11 -0
  23. package/build/components/ExportReportButton/constants.d.ts +51 -0
  24. package/build/components/ExportReportButton/hooks/useReportDownload.d.ts +21 -0
  25. package/build/components/ExportReportButton/index.d.ts +6 -0
  26. package/build/components/ExportReportButton/index.js +1 -0
  27. package/build/components/ExportReportButton/style.d.ts +67 -0
  28. package/build/components/ExportReportButton/type.d.ts +147 -0
  29. package/build/components/ExportReportButton/utils.d.ts +10 -0
  30. package/build/components/FilterDropdown/index.js +1 -1
  31. package/build/components/ListColumnFilter/index.js +1 -1
  32. package/build/components/ListHeader/index.js +1 -1
  33. package/build/components/PhoneFilter/index.js +1 -1
  34. package/build/components/StatusFilter/index.js +1 -1
  35. package/build/components/StatusIcons/index.js +1 -1
  36. package/build/components/TableCells/index.js +1 -1
  37. package/build/components/index.d.ts +2 -3
  38. package/build/components/index.js +1 -1
  39. package/build/datetime/components/index.js +1 -1
  40. package/build/index.js +1 -1
  41. package/package.json +1 -1
  42. package/build/_chunks/chunk-P6WIYEZX.js +0 -1
  43. package/build/_chunks/chunk-S3BFBCVM.js +0 -1
  44. package/build/components/ActionsDropdownMenu/ActionsDropdownMenu.d.ts +0 -3
  45. package/build/components/ActionsDropdownMenu/AppMenuItem.d.ts +0 -15
  46. package/build/components/ActionsDropdownMenu/constants.d.ts +0 -1
  47. package/build/components/ActionsDropdownMenu/index.d.ts +0 -3
  48. package/build/components/ActionsDropdownMenu/index.js +0 -1
  49. package/build/components/ActionsDropdownMenu/style.d.ts +0 -16
  50. package/build/components/ActionsDropdownMenu/types.d.ts +0 -42
  51. package/build/components/TableReports/DownloadIconButton.d.ts +0 -7
  52. package/build/components/TableReports/Downloads.d.ts +0 -10
  53. package/build/components/TableReports/RecordLoading.d.ts +0 -2
  54. package/build/components/TableReports/TableReports.d.ts +0 -5
  55. package/build/components/TableReports/components/DownloadButton/DownloadButton.d.ts +0 -8
  56. package/build/components/TableReports/components/DownloadButton/index.d.ts +0 -2
  57. package/build/components/TableReports/components/DownloadButton/style.d.ts +0 -263
  58. package/build/components/TableReports/hooks/index.d.ts +0 -1
  59. package/build/components/TableReports/hooks/useDownloadReport.d.ts +0 -11
  60. package/build/components/TableReports/index.d.ts +0 -7
  61. package/build/components/TableReports/index.js +0 -1
  62. package/build/components/TableReports/style.d.ts +0 -324
  63. package/build/components/TableReports/type.d.ts +0 -37
  64. package/build/components/TableReports/utils.d.ts +0 -2
@@ -0,0 +1 @@
1
+ import {B as B$1,p as p$1}from'./chunk-4NLQZJVN.js';import {nc,cc}from'./chunk-EP5VELEJ.js';import {xb,Ei,Ak,ja,Xd,Vj,E,ol}from'./chunk-XTJZTHR6.js';import {createContext,forwardRef,useMemo,Fragment,memo,useState,useCallback,useContext,createElement}from'react';import m from'@mui/material/Box';import ue from'@mui/material/Popper';import {styled}from'@mui/material/styles';import {jsx,jsxs}from'react/jsx-runtime';var D=createContext({});function te(){return useContext(D)}var l="os-shared-ActionMenu",o={root:`${l}-root`,popper:`${l}-popper`,panel:`${l}-panel`,sectionHeader:`${l}-sectionHeader`,sectionDivider:`${l}-sectionDivider`,item:`${l}-item`,itemContent:`${l}-itemContent`,itemLabel:`${l}-itemLabel`,itemIcon:`${l}-itemIcon`,startAdornment:`${l}-startAdornment`,rowEnd:`${l}-rowEnd`,endAdornment:`${l}-endAdornment`,arrow:`${l}-arrow`,trailingDot:`${l}-trailingDot`,flyoutHost:`${l}-flyoutHost`,flyoutPopper:`${l}-flyoutPopper`},Be={refund:ol,flag:E,viewReceipt:Vj,viewApi:Xd,capture:ja,void:Ak,clipboard:Ei},U=360,k=280,oe=148,ie=32,re=27,le=8,p=16,F=12,W=5,ae="#D9D9D9",se="drop-shadow(0px 8px 30px rgba(0, 0, 0, 0.16))",ce=1e3,de=1301;var pe={overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},me=styled(m)({display:"contents"}),Ae=styled(ue)({zIndex:ce}),fe=styled(ue)({zIndex:de}),C=styled(m,{shouldForwardProp:e=>e!=="$flyout"&&e!=="$maxWidth"&&e!=="$maxHeight"})(({theme:e,$flyout:n=false,$maxWidth:t,$maxHeight:i})=>({background:e.v2.palette.base.white,borderRadius:e.v2.radius(4),filter:se,minWidth:oe,maxWidth:t??k,maxHeight:i??U,width:"max-content",marginTop:n?0:e.v2.spacing(le),overflowY:"auto",overflowX:"hidden"})),T=styled(m,{shouldForwardProp:e=>e!=="$open"&&e!=="$disabled"})(({theme:e,$open:n=false,$disabled:t=false})=>{let{foreground:i}=e.v2.palette,c={boxShadow:e.v2.elevation[200],zIndex:1};return {...e.v2.typography.textVariants.body.small.medium,position:"relative",display:"flex",alignItems:"center",justifyContent:"space-between",height:ie,padding:`${e.v2.spacing(8)} ${e.v2.spacing(8)} ${e.v2.spacing(8)} ${e.v2.spacing(12)}`,cursor:t?"default":"pointer",color:t?i.disabled:i.primary,...!t&&{"&:hover":c},...n&&!t&&c}}),R=styled(m)(({theme:e})=>({display:"flex",alignItems:"center",gap:e.v2.spacing(8),flex:1,minWidth:0,overflow:"hidden"})),w=styled("span")({minWidth:0,...pe}),Me=styled(m)(({theme:e})=>({...e.v2.typography.textVariants.body.small.medium,...pe,height:re,display:"flex",alignItems:"center",padding:`0 ${e.v2.spacing(12)}`,lineHeight:"100%",color:e.v2.palette.foreground.secondary,pointerEvents:"none",userSelect:"none",flexShrink:0,minWidth:0})),Ne=styled(m)(({theme:e})=>({borderTop:`1px solid ${e.v2.palette.border.default}`})),Ie=styled(m)(({theme:e})=>({display:"flex",alignItems:"center",gap:e.v2.spacing(6),flexShrink:0})),ye=styled("span")({display:"inline-flex",lineHeight:0}),ge=styled(m,{shouldForwardProp:e=>e!=="$color"})(({$color:e})=>({width:W,height:W,borderRadius:"50%",backgroundColor:e,flexShrink:0,cursor:"default"})),Se={filter:"grayscale(1)",opacity:.4},_e=styled("span",{shouldForwardProp:e=>e!=="$disabled"})(({$disabled:e=false})=>({display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,"& img, & svg":{display:"block",maxWidth:p,maxHeight:p},[`& .${o.itemIcon}`]:{width:p,height:p,objectFit:"contain"},...e&&Se})),xe=styled("span",{shouldForwardProp:e=>e!=="$disabled"})(({$disabled:e=false})=>({display:"inline-flex",alignItems:"center",flexShrink:0,...e&&Se})),Ee=styled("img")({width:F,height:F,display:"block"});function b({startAdornment:e,disabled:n=false}){return e==null||e===false?null:jsx(_e,{className:o.startAdornment,$disabled:n,children:e})}function v(){return jsx(Ee,{className:o.arrow,src:xb,alt:""})}function h({trailingHint:e,endAdornment:n,disabled:t=false}){let i=n!=null&&n!==false;return !e&&!i?null:jsxs(Ie,{className:o.rowEnd,children:[e&&jsx(p$1,{title:e.tooltip,placement:"top",children:jsx(ye,{children:jsx(ge,{className:o.trailingDot,$color:e.color??ae})})}),i&&jsx(xe,{className:o.endAdornment,$disabled:t,children:n})]})}function Ce(e,n=false){return n||!!e.trailingHint}function B(e){return createElement("img",{src:e,alt:"",width:p,height:p,className:o.itemIcon})}function O(e,n){return e===void 0?n:e}function Te(e){return e.isVisible!==false}function P(e){return e?.length?e.filter(Te):[]}function ze(e){return e.isVisible!==false}function Ve(e){return e?.length?e.filter(ze).map(n=>({label:n.label,startAdornment:n.icon?B(n.icon):void 0,disabled:n.disabled,trailingHint:n.trailingHint,onClick:n.onClick?t=>{n.onClick?.(t);}:void 0,onRightClick:n.onContextMenu?t=>{t.preventDefault(),n.onContextMenu?.(t);}:void 0})):[]}function Ye(e,n){let t=Ve(e.menuItems);if(!t.length)return;let i=n(e.appCode),c=i?.iconUrl??e.appIcon;return {label:cc(i?.name)??e.appName??e.appCode,startAdornment:c?B(c):void 0,items:t}}function Re(e){return e.map(n=>({...n,items:n.items.filter(Te)})).filter(n=>n.items.length>0)}function we(...e){return e.filter(n=>n===false||n==null?false:n.items.length>0)}function be(e){if(e.length)return {items:e}}function ve(e,n,t){if(n.length)return {title:e,dividerBefore:t?.dividerBefore??false,linked:t?.linked??false,items:n}}function qe(e,n,t){return we(be(e),ve(t,n,{dividerBefore:e.length>0,linked:true}))}function Oe({item:e,onClose:n}){let{label:t,startAdornment:i,endAdornment:c,items:A,trailingHint:y,disabled:r=false}=e,{panelMaxWidth:f,panelMaxHeight:d}=te(),[g,u]=useState(null),M=!!g&&!r,_=useCallback(x=>{r||u(x.currentTarget.firstElementChild);},[r]),s=useCallback(()=>{u(null);},[]),S=useMemo(()=>P(A),[A]);return S.length?jsxs(m,{className:o.flyoutHost,onMouseEnter:_,onMouseLeave:s,children:[jsxs(T,{role:"menuitem","aria-haspopup":"menu","aria-expanded":M,"aria-disabled":r||void 0,className:o.item,$open:M,$disabled:r,children:[jsxs(R,{className:o.itemContent,children:[jsx(b,{startAdornment:i,disabled:r}),jsx(w,{className:o.itemLabel,children:t})]}),jsx(h,{trailingHint:y,endAdornment:O(c,r?null:jsx(v,{})),disabled:r})]}),jsx(fe,{className:o.flyoutPopper,open:M,anchorEl:g,placement:"left-start",children:jsx(C,{role:"menu",$flyout:true,className:o.panel,$maxWidth:f,$maxHeight:d,children:S.map((x,$)=>jsx(H,{item:x,nested:true,onClose:n},`flyout-${$}`))})})]}):null}function He({item:e,linked:n=false,nested:t=false,onClose:i}){let{label:c,startAdornment:A,endAdornment:y,disabled:r=false,onClick:f,onRightClick:d,trailingHint:g}=e,u=!t&&Ce(e,n),M=s=>{r||(s.stopPropagation(),f?.(s),u&&i());},_=r||!d?void 0:s=>{s.preventDefault(),d(s);};return jsxs(T,{role:"menuitem","aria-disabled":r||void 0,className:o.item,$disabled:r,onClick:M,onContextMenu:_,children:[jsxs(R,{className:o.itemContent,children:[jsx(b,{startAdornment:A,disabled:r}),jsx(w,{className:o.itemLabel,children:c})]}),jsx(h,{trailingHint:g,endAdornment:O(y,u?jsx(v,{}):null),disabled:r})]})}function H({item:e,linked:n=false,nested:t=false,onClose:i}){return e.items!==void 0?P(e.items).length?jsx(Oe,{item:e,onClose:i}):null:jsx(He,{item:e,linked:n,nested:t,onClose:i})}var Ue=forwardRef(({id:e,className:n,sx:t,popperSx:i,anchorEl:c,onClose:A,sections:y,placement:r="bottom-end",panelMaxWidth:f,panelMaxHeight:d},g)=>{let u=!!c,M=useMemo(()=>Re(y),[y]),_=useMemo(()=>({panelMaxWidth:f,panelMaxHeight:d}),[f,d]);return u?jsx(D.Provider,{value:_,children:jsxs(me,{className:o.root,children:[jsx(B$1,{onClick:A}),jsx(Ae,{open:u,anchorEl:c,placement:r,className:o.popper,sx:i,children:jsx(C,{ref:g,id:e,role:"menu",className:nc(o.panel,n),sx:t,"data-testid":e??"ActionMenu",$maxWidth:f,$maxHeight:d,children:M.map((s,S)=>jsxs(Fragment,{children:[s.dividerBefore&&S>0?jsx(Ne,{role:"separator",className:o.sectionDivider}):null,s.title?jsx(Me,{role:"presentation",className:o.sectionHeader,children:s.title}):null,s.items.map((x,$)=>jsx(H,{item:x,linked:s.linked,onClose:A},`${S}-${$}`))]},`section-${S}`))})})]})}):null});Ue.displayName="ActionMenu";var ke=memo(Ue);export{o as a,Be as b,U as c,k as d,B as e,Ye as f,we as g,be as h,ve as i,qe as j,ke as k};
@@ -0,0 +1 @@
1
+ import {b,E,d,j,n as n$1,F,p,B,R as R$1,r}from'./chunk-4NLQZJVN.js';import {nc,_b,Mb}from'./chunk-EP5VELEJ.js';import {$e,af,Lj,_e}from'./chunk-XTJZTHR6.js';import {memo,forwardRef,useState,useCallback,useMemo,useReducer,useEffect}from'react';import $ from'dayjs';import Je from'dayjs/plugin/relativeTime';import R from'@mui/material/Box';import {styled,alpha}from'@mui/material/styles';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var n="os-shared-ExportReportButton",t={root:`${n}-root`,trigger:`${n}-trigger`,triggerIcon:`${n}-triggerIcon`,triggerLabel:`${n}-triggerLabel`,triggerProgress:`${n}-triggerProgress`,requestRow:`${n}-requestRow`,requestRowIcon:`${n}-requestRowIcon`,requestRowLabel:`${n}-requestRowLabel`,fileList:`${n}-fileList`,fileRow:`${n}-fileRow`,fileRowIcon:`${n}-fileRowIcon`,fileRowInfo:`${n}-fileRowInfo`,fileRowName:`${n}-fileRowName`,fileRowTime:`${n}-fileRowTime`,fileRowAction:`${n}-fileRowAction`,menuFooter:`${n}-menuFooter`,loadingRow:`${n}-loadingRow`},f={trigger:$e,ready:af,failed:Lj,download:_e};$.extend(Je);var oe=e=>{let o=$(e);return o.isValid()?$().diff(o,"day")<1?o.fromNow():o.format(o.isSame($(),"year")?"DD MMM":"DD MMM, YYYY"):""},Ze=/\.(xlx|xlsx|csv|txt|doc|docx|pdf|jpg|png|gif|zip|rar)$/i,te=(e,o)=>{let p=o??`file_${new Date().toISOString().split("T")[0]}`,d=Ze.exec(e)?.[0]??".csv";return `${p}${d}`};var re={state:"idle"},ro=(e,o)=>{switch(o.type){case "LOADING":return {state:"loading"};case "SUCCESS":return {state:"success"};case "ERROR":return {state:"error"};case "RESET":return re;default:return e}},q=({onDownload:e,onError:o,fileNameFallback:p})=>{let[d,c]=useReducer(ro,re),{state:i}=d;useEffect(()=>{if(i!=="success"&&i!=="error")return;let l=setTimeout(()=>c({type:"RESET"}),3e3);return ()=>clearTimeout(l)},[i]);let m=useCallback(()=>{!e||i==="loading"||(c({type:"LOADING"}),e().then(l=>{c({type:"SUCCESS"}),Mb({type:"url",url:l.url},te(l.fileName,l.downloadName??p));}).catch(l=>{c({type:"ERROR"}),o?.(l);}));},[e,o,p,i]);return {state:i,handleDownload:m}};var ie=e=>typeof e=="string"&&!e.startsWith("$")&&e!=="sx"&&e!=="theme"&&e!=="ownerState"&&e!=="as",le=styled(R)(()=>({position:"relative",display:"inline-block"})),se=styled(b,{shouldForwardProp:ie})(({theme:e,$status:o,$badge:p})=>{let{base:d,border:c,brand:i,error:m,grey:l,success:S}=e.v2.palette;return {position:"relative",height:32,minWidth:0,padding:`0 ${e.v2.spacing(8)}`,border:`1px solid ${c.default}`,borderRadius:e.v2.radius(4),backgroundColor:d.white,color:l[900],fontSize:"11px",fontWeight:500,overflow:"hidden",cursor:"pointer",...o!=="idle"&&{borderBottomColor:"transparent"},...o!=="idle"&&{borderBottomLeftRadius:0,borderBottomRightRadius:0},"&.Mui-disabled":{opacity:1,border:`1px solid ${c.default}`,backgroundColor:d.white,color:l[900]},...p&&{"&:after":{content:'""',width:7,height:7,borderRadius:"50%",position:"absolute",top:5,right:6,border:`1px solid ${d.white}`,backgroundColor:p==="failed"?m[500]:S[700]}},'&[aria-expanded="true"]':{borderColor:i[500],boxShadow:`0px 0px 4px 0px ${alpha(i[500],.5)}`}}}),P=styled(R,{shouldForwardProp:ie})(({theme:e,$status:o})=>({position:"absolute",bottom:0,right:0,left:0,overflow:"hidden",lineHeight:0,[`& .${E.root}`]:{height:2,minHeight:2,minWidth:0,padding:0,borderRadius:0,background:"transparent",display:"block"},[`& .${E.fill}`]:{height:2,minHeight:2,minWidth:0,maxWidth:"none",padding:0,borderRadius:0,display:"block",backgroundColor:o==="ready"?e.v2.palette.success[700]:o==="failed"?e.v2.palette.error[500]:e.v2.palette.brand[500]},[`& .${E.text}`]:{display:"none"}})),ae=styled(R)(({theme:e})=>({display:"flex",alignItems:"center",gap:e.v2.spacing(8),height:32,padding:`${e.v2.spacing(4)} ${e.v2.spacing(8)}`,borderBottom:`1px solid ${e.v2.palette.border.default}`,cursor:"pointer","&:hover":{boxShadow:e.v2.elevation[200]}})),pe=styled(d)(()=>({width:16,height:16,objectFit:"contain",flexShrink:0,display:"block"})),de=styled(j)(()=>({fontSize:"11px",fontWeight:400,lineHeight:1.1,textTransform:"uppercase"})),ce=styled(R)(({theme:e})=>({borderTop:`2px solid ${e.v2.palette.border.default}`})),ue=styled(R)(({theme:e})=>({display:"flex",alignItems:"center",gap:e.v2.spacing(8),padding:"5.5px 8px",minHeight:48,height:"auto",borderBottom:`1px solid ${e.v2.palette.border.default}`,cursor:"pointer","&:hover":{boxShadow:e.v2.elevation[200]}})),Re=styled(d)(()=>({width:16,height:16,objectFit:"contain",flexShrink:0,display:"block"})),me=styled(R)(()=>({display:"flex",flexDirection:"column",gap:"2px",minWidth:0,flex:1})),fe=styled(j)(({theme:e})=>({fontSize:"11px",fontWeight:500,lineHeight:1.2,color:e.v2.palette.grey[900],wordBreak:"break-all",paddingInlineEnd:e.v2.spacing(8)})),ge=styled(j)(({theme:e})=>({fontSize:"9px",fontWeight:600,lineHeight:1.2,color:e.v2.palette.grey[500]})),xe=styled(R)(()=>({display:"flex",alignItems:"center",flexShrink:0})),we=styled(R)(({theme:e})=>({backgroundColor:alpha(e.v2.palette.grey[100],.5),backdropFilter:e.v2.blur[2],color:e.v2.palette.grey[900],fontSize:"11px",fontWeight:500,height:31,textAlign:"center",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",overflow:"hidden",borderBottomLeftRadius:e.v2.radius(4),borderBottomRightRadius:e.v2.radius(4)})),ye=styled(R)(({theme:e})=>({display:"flex",flexDirection:"row",alignItems:"center",gap:e.v2.spacing(8),padding:e.v2.spacing(8)}));function io({item:e,onDownloadReport:o,onDownloadError:p,renderIcon:d$1,formatDate:c}){let{state:i,handleDownload:m}=q({onDownload:o?()=>o(e.id):void 0,onError:p,fileNameFallback:e.id}),l=i==="loading"?jsx(n$1,{size:14}):i==="success"?jsx(d,{src:f.ready,alt:"downloaded"}):i==="error"?jsx(d,{src:f.failed,alt:"download failed"}):jsx(d,{src:f.download,alt:"download report",onClick:m});return jsxs(ue,{className:t.fileRow,children:[d$1?d$1(e):jsx(Re,{src:e.fileIconSrc??_b(e.fileName),alt:"report file",className:t.fileRowIcon}),jsxs(me,{className:t.fileRowInfo,children:[jsx(fe,{className:t.fileRowName,children:e.fileName}),jsx(ge,{className:t.fileRowTime,children:(c??oe)(e.createdAt)})]}),jsx(xe,{className:t.fileRowAction,children:l})]})}var he=memo(io);function so(){return jsxs(ye,{className:t.loadingRow,children:[jsx(r,{width:"16px",height:"16px",variant:"rectangular"}),jsx(r,{width:"100%",variant:"text"}),jsx(r,{width:"12px",height:"12px",variant:"circular"})]})}var A=memo(so);function co({row:e,onSelect:o}){let p=e.icon===void 0?jsx(pe,{src:_b(`file.${e.id}`),alt:`${e.id} file`,className:t.requestRowIcon}):e.icon;return jsxs(ae,{onClick:o,className:t.requestRow,children:[p,jsx(de,{className:t.requestRowLabel,children:e.label})]})}var be=memo(co);var go=[{id:"csv",label:"CSV"}],ve=forwardRef(({status:e="idle",progress:o=0,badge:p$1=null,reports:d$1,isLoadingReports:c=false,triggerIcon:i,loadingLabel:m,readyLabel:l,failedLabel:S,requestRows:Ne,renderMenuHeader:O,onDownloadReport:Fe,onDownloadError:Ie,renderReportIcon:Ce,formatReportDate:$e,footer:h,menuPlacement:Pe="bottom-end",menuProps:De,onMenuOpen:W,tooltipTitle:k,id:H,className:Te,sx:ke,...Le},qe)=>{let[z,U]=useState(null),E=!!z,Me=useCallback(s=>{e==="loading"||e==="ready"||(W?.(),U(s.currentTarget));},[e,W]),x=useCallback(()=>{U(null);},[]),Ae=useCallback(s=>{x(),s.onSelect?.();},[x]),Oe=useCallback(s=>{s.stopPropagation(),h?.onClick?.(),x();},[x,h]),{placement:We,sx:b,modifiers:y,...He}=De??{},ze=We??Pe,Ue=useMemo(()=>[{width:208,boxShadow:"0px 8px 30px 0px rgba(0, 0, 0, 0.16)"},...Array.isArray(b)?b:[b]],[b]),_e=useMemo(()=>{let s=[{name:"offset",options:{offset:[0,8]}}];if(!y)return s;let L=Array.isArray(y)?y:[y];return L.some(Qe=>Qe?.name==="offset")?L:[...s,...L]},[y]),Ge=Math.min(100,Math.max(0,o)),Ye=i===void 0?jsx(d,{src:f.trigger,alt:"reports"}):i,Ve=Ne??go,je=e==="loading"?jsxs(Fragment,{children:[jsx(n$1,{size:14}),m!=null?jsx("span",{className:t.triggerLabel,children:m}):null,jsx(P,{$status:e,className:t.triggerProgress,children:jsx(F,{value:Ge})})]}):e==="ready"?jsxs(Fragment,{children:[jsx(d,{src:f.ready,alt:"ready"}),l!=null?jsx("span",{className:t.triggerLabel,children:l}):null,jsx(P,{$status:e,className:t.triggerProgress,children:jsx(F,{value:100})})]}):e==="failed"?jsxs(Fragment,{children:[jsx(d,{src:f.failed,alt:"failed"}),S!=null?jsx("span",{className:t.triggerLabel,children:S}):null,jsx(P,{$status:e,className:t.triggerProgress,children:jsx(F,{value:100})})]}):Ye,_=jsx(se,{variant:"secondary",onClick:Me,"aria-haspopup":"menu","aria-expanded":E,$status:e,$badge:e==="idle"?p$1:void 0,className:t.trigger,children:je}),Xe=k!=null&&k!==false?jsx(p,{title:k,...E?{open:false}:{},children:_}):_,Ke=c||(d$1?.length??0)>0;return jsxs(le,{ref:qe,id:H,"data-testid":H??"ExportReportButton",className:nc(t.root,Te),sx:ke,...Le,children:[Xe,E&&jsx(B,{onClose:x}),jsxs(R$1,{open:E,anchorEl:z,placement:ze,sx:Ue,modifiers:_e,...He,children:[O?O({closeMenu:x}):Ve.map(s=>jsx(be,{row:s,onSelect:()=>Ae(s)},s.id)),Ke?jsx(ce,{className:t.fileList,children:c?jsxs(Fragment,{children:[jsx(A,{}),jsx(A,{})]}):d$1?.map(s=>jsx(he,{item:s,onDownloadReport:Fe,onDownloadError:Ie,renderIcon:Ce,formatDate:$e},s.id))}):null,h!=null?jsx(we,{onClick:Oe,className:t.menuFooter,children:h.label}):null]})]})});ve.displayName="ExportReportButton";var xo=memo(ve);export{t as a,q as b,xo as c};