@feathery/react 2.15.1 → 2.16.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/cjs/Form/index.d.ts.map +1 -1
- package/cjs/elements/basic/TableElement/Actions.d.ts +3 -1
- package/cjs/elements/basic/TableElement/Actions.d.ts.map +1 -1
- package/cjs/elements/basic/TableElement/Search.d.ts.map +1 -1
- package/cjs/elements/basic/TableElement/Sort.d.ts +5 -0
- package/cjs/elements/basic/TableElement/Sort.d.ts.map +1 -1
- package/cjs/elements/basic/TableElement/index.d.ts.map +1 -1
- package/cjs/elements/basic/TableElement/styles.d.ts +1 -1
- package/cjs/elements/basic/TableElement/styles.d.ts.map +1 -1
- package/cjs/elements/basic/TableElement/useTableData.d.ts +7 -0
- package/cjs/elements/basic/TableElement/useTableData.d.ts.map +1 -1
- package/cjs/{fthry_FormControl.DhxdiYw6.js → fthry_FormControl.BKhBgGR8.js} +1 -1
- package/cjs/{fthry_InlineTooltip.BgAXRUIt.js → fthry_InlineTooltip.DzUT7zk0.js} +2 -2
- package/cjs/{fthry_Overlay.D7IM1ywp.js → fthry_Overlay.BpmW4YfX.js} +1 -1
- package/cjs/{fthry_PaymentMethodField.NEoloWMI.js → fthry_PaymentMethodField.CRiUSe8P.js} +4 -4
- package/cjs/{fthry_Placeholder.D5C0aH2S.js → fthry_Placeholder.BQbbxB6F.js} +1 -1
- package/cjs/{fthry_ShowEyeIcon.CmLMyaN5.js → fthry_ShowEyeIcon.hB_ow6JC.js} +1 -1
- package/cjs/{fthry_index.Ci8dMyBp.js → fthry_index.4N1YhCUq.js} +1 -1
- package/cjs/{fthry_index.JRP5lBfp.js → fthry_index.9iTTBFyN.js} +5 -5
- package/cjs/{fthry_index.GeYRayLh.js → fthry_index.B-CV6GlF.js} +1 -1
- package/cjs/{fthry_index.Bq3nU0FH.js → fthry_index.B9kpJ8RF.js} +6 -6
- package/cjs/{fthry_index.WDI9ExUl.js → fthry_index.BClazNwU.js} +1 -1
- package/cjs/{fthry_index.DzpGyyn4.js → fthry_index.BNmTPE57.js} +5 -5
- package/cjs/{fthry_index.BgeTdwT5.js → fthry_index.BT-MMWKW.js} +2 -2
- package/cjs/{fthry_index.By8RWuUY.js → fthry_index.BcS0pFWC.js} +6 -6
- package/cjs/{fthry_index.Bb1R5GZK.js → fthry_index.Biu3gbsh.js} +2 -2
- package/cjs/{fthry_index.CzzIM_Es.js → fthry_index.CBH-w87m.js} +602 -463
- package/cjs/{fthry_index.DDjTLR_C.js → fthry_index.CBq25pIU.js} +6 -6
- package/cjs/{fthry_index.BFpcCw2o.js → fthry_index.CbkwCml1.js} +1 -1
- package/cjs/{fthry_index.DLnigFf3.js → fthry_index.Cepb73QX.js} +4 -4
- package/cjs/{fthry_index.DXm31Dvn.js → fthry_index.CnCLJycW.js} +3 -3
- package/cjs/{fthry_index.D4rjZ-iU.js → fthry_index.CslonO6n.js} +4 -4
- package/cjs/{fthry_index.CrFjXWLg.js → fthry_index.CusiJzmn.js} +3 -3
- package/cjs/{fthry_index.CgMWWz7f.js → fthry_index.D--uB97c.js} +1 -1
- package/cjs/{fthry_index.CkmA933O.js → fthry_index.DLwBzlAm.js} +331 -59
- package/cjs/{fthry_index.BJYH_2P6.js → fthry_index.DOiXixKa.js} +1 -1
- package/cjs/{fthry_index.BK_jaGHn.js → fthry_index.DmsSGjy7.js} +5 -5
- package/cjs/{fthry_index.CbfDILWu.js → fthry_index.YRUJ420g.js} +4 -4
- package/cjs/{fthry_index.Bd1HfYvE.js → fthry_index.cplrWgvC.js} +5 -5
- package/cjs/{fthry_index.BqS0kCfh.js → fthry_index.lqNJzzej.js} +1 -1
- package/cjs/{fthry_index.E_vLB-7s.js → fthry_index.wYrRKH_Q.js} +8 -8
- package/cjs/{fthry_input.kxr0lkUP.js → fthry_input.Dt2FevPi.js} +1 -1
- package/cjs/{fthry_script.CpqGoZRW.js → fthry_script.Tl6aGziG.js} +1 -1
- package/cjs/{fthry_styles.UURZE2St.js → fthry_styles.Pvk5-k7a.js} +1 -1
- package/cjs/{fthry_useElementSize.B7mqB2ri.js → fthry_useElementSize.BFoAW8dM.js} +1 -1
- package/cjs/{fthry_useSalesforceSync.DFHAEpBn.js → fthry_useSalesforceSync.CGHmB1Kd.js} +1 -1
- package/cjs/{fthry_webfontloader.COsYlNwD.js → fthry_webfontloader.CeAHWOr6.js} +1 -1
- package/cjs/index.d.ts +3 -2
- package/cjs/index.d.ts.map +1 -1
- package/cjs/index.js +1 -1
- package/cjs/utils/error.d.ts +0 -5
- package/cjs/utils/error.d.ts.map +1 -1
- package/cjs/utils/featheryClient/index.d.ts +13 -20
- package/cjs/utils/featheryClient/index.d.ts.map +1 -1
- package/cjs/utils/featheryClient/integrationClient.d.ts +2 -8
- package/cjs/utils/featheryClient/integrationClient.d.ts.map +1 -1
- package/cjs/utils/featheryClient/utils.d.ts.map +1 -1
- package/cjs/utils/formContext.d.ts +3 -1
- package/cjs/utils/formContext.d.ts.map +1 -1
- package/cjs/utils/formHelperFunctions.d.ts.map +1 -1
- package/cjs/utils/internalState.d.ts +2 -12
- package/cjs/utils/internalState.d.ts.map +1 -1
- package/dist/Form/index.d.ts.map +1 -1
- package/dist/elements/basic/TableElement/Actions.d.ts +3 -1
- package/dist/elements/basic/TableElement/Actions.d.ts.map +1 -1
- package/dist/elements/basic/TableElement/Search.d.ts.map +1 -1
- package/dist/elements/basic/TableElement/Sort.d.ts +5 -0
- package/dist/elements/basic/TableElement/Sort.d.ts.map +1 -1
- package/dist/elements/basic/TableElement/index.d.ts.map +1 -1
- package/dist/elements/basic/TableElement/styles.d.ts +1 -1
- package/dist/elements/basic/TableElement/styles.d.ts.map +1 -1
- package/dist/elements/basic/TableElement/useTableData.d.ts +7 -0
- package/dist/elements/basic/TableElement/useTableData.d.ts.map +1 -1
- package/dist/{fthry_FormControl.CikgGb3C.js → fthry_FormControl.XVhBC21r.js} +1 -1
- package/dist/{fthry_InlineTooltip.BpfxcSEn.js → fthry_InlineTooltip.B5HOzwap.js} +2 -2
- package/dist/{fthry_Overlay.CJVfag7c.js → fthry_Overlay.Bimyn9cP.js} +1 -1
- package/dist/{fthry_PaymentMethodField.BpA_xhqt.js → fthry_PaymentMethodField.DC42S83Q.js} +4 -4
- package/dist/{fthry_Placeholder.DwCFN6a9.js → fthry_Placeholder.BSJmJpdc.js} +1 -1
- package/dist/{fthry_ShowEyeIcon.D6nQhesH.js → fthry_ShowEyeIcon.B9PAnnc8.js} +1 -1
- package/dist/{fthry_index.D9VjMJ_U.js → fthry_index.1C0U53je.js} +1 -1
- package/dist/{fthry_index.B84L3MVC.js → fthry_index.B0tXZhK_.js} +1 -1
- package/dist/{fthry_index.DhU16s57.js → fthry_index.BQH7UQHm.js} +5 -5
- package/dist/{fthry_index.BzrcCLzO.js → fthry_index.C2MFMacA.js} +4 -4
- package/dist/{fthry_index.BEZmvsoo.js → fthry_index.C8otB4PR.js} +5 -5
- package/dist/{fthry_index.B7VWXvgC.js → fthry_index.C9rpuLX0.js} +4 -4
- package/dist/{fthry_index.BSEfDQAc.js → fthry_index.CHndK5Ku.js} +2 -2
- package/dist/{fthry_index.DH2fsNWG.js → fthry_index.CJ2JTPaM.js} +3 -3
- package/dist/{fthry_index.NOuMR_hq.js → fthry_index.CRNNh-Vr.js} +6 -6
- package/dist/{fthry_index.OHN-Iv2R.js → fthry_index.CZMlc0Uq.js} +1 -1
- package/dist/{fthry_index.DoP7RwIP.js → fthry_index.Cqaf2wwS.js} +1 -1
- package/dist/{fthry_index.CJKGRCG-.js → fthry_index.D-Z9XSa-.js} +3 -3
- package/dist/{fthry_index.D9AKkBzu.js → fthry_index.D580ix-P.js} +1 -1
- package/dist/{fthry_index.BsNCOSBE.js → fthry_index.DOn8TnD9.js} +5 -5
- package/dist/{fthry_index.t4v0qqgv.js → fthry_index.DX3eUw60.js} +6 -6
- package/dist/{fthry_index.Fs86Fy9Y.js → fthry_index.DX823K0A.js} +5 -5
- package/dist/{fthry_index.BAhh3Pz6.js → fthry_index.DclC8fSK.js} +331 -59
- package/dist/{fthry_index.m7CZv4YY.js → fthry_index.DeVEe6wK.js} +4 -4
- package/dist/{fthry_index.Bz07r-AM.js → fthry_index.DuaCIs62.js} +1 -1
- package/dist/{fthry_index.Dgmpm9wy.js → fthry_index.DuaZsChW.js} +6 -6
- package/dist/{fthry_index.Dy4nSWZa.js → fthry_index.DucoThu1.js} +1 -1
- package/dist/{fthry_index.BsEfTy-x.js → fthry_index.Duj4YwU5.js} +8 -8
- package/dist/{fthry_index.B-oHlMGi.js → fthry_index.dbHyG7ZF.js} +2 -2
- package/dist/{fthry_index.y4j9reIZ.js → fthry_index.uXGVOaal.js} +602 -463
- package/dist/{fthry_input.Cb2u4VEf.js → fthry_input.ByujwKdQ.js} +1 -1
- package/dist/{fthry_script.C5O1ZNQQ.js → fthry_script.c1JhCd_N.js} +1 -1
- package/dist/{fthry_styles.DGB23xLr.js → fthry_styles.ChVA_k1Q.js} +1 -1
- package/dist/{fthry_useElementSize.CBdpS9aW.js → fthry_useElementSize.rXTn4Y2Q.js} +1 -1
- package/dist/{fthry_useSalesforceSync.Cae_lMG1.js → fthry_useSalesforceSync.CksS0l4W.js} +1 -1
- package/dist/{fthry_webfontloader.DAANkO2-.js → fthry_webfontloader.E26hycV1.js} +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/utils/error.d.ts +0 -5
- package/dist/utils/error.d.ts.map +1 -1
- package/dist/utils/featheryClient/index.d.ts +13 -20
- package/dist/utils/featheryClient/index.d.ts.map +1 -1
- package/dist/utils/featheryClient/integrationClient.d.ts +2 -8
- package/dist/utils/featheryClient/integrationClient.d.ts.map +1 -1
- package/dist/utils/featheryClient/utils.d.ts.map +1 -1
- package/dist/utils/formContext.d.ts +3 -1
- package/dist/utils/formContext.d.ts.map +1 -1
- package/dist/utils/formHelperFunctions.d.ts.map +1 -1
- package/dist/utils/internalState.d.ts +2 -12
- package/dist/utils/internalState.d.ts.map +1 -1
- package/package.json +2 -1
- package/umd/{509.341a4196aad912adb28d.js → 509.a863f8749c28540476bb.js} +2 -2
- package/umd/TableElement.8941c979f39547669b6a.js +1 -0
- package/umd/index.js +1 -1
- package/umd/TableElement.ef63774f461682dd3ac9.js +0 -1
- /package/umd/{509.341a4196aad912adb28d.js.LICENSE.txt → 509.a863f8749c28540476bb.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(this.webpackChunkFeathery=this.webpackChunkFeathery||[]).push([[844],{6056:(e,t,r)=>{r.r(t),r.d(t,{default:()=>Se});var n=r(5944),o=r(7294),a=r(426),i=function(){return i=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},i.apply(this,arguments)},l="#ffffff",c="#f9fafb",s="#f3f4f6",u="#e5e7eb",d="#9ca3af",f="#4b5563",p="#111827",h="#1d4ed8",g={width:"16px",height:"16px",color:"#6b7280"},v={display:"flex",flexDirection:"column",gap:"2px","& svg":{marginInlineStart:"4px",width:"20px",height:"20px"}},y={width:"12px",height:"12px",color:d,opacity:.3,'&[data-active="true"]':{color:h,opacity:1}},b={display:"flex",alignItems:"center",gap:"8px"},x={position:"relative",overflowX:"auto",overflowY:"auto",backgroundColor:l,boxShadow:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",borderRadius:"8px",border:"1px solid ".concat(u),minWidth:"100%",maxWidth:"100%",height:"100%",boxSizing:"border-box"},m={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"64px 24px",textAlign:"center"},w={color:f,fontSize:"16px",fontWeight:"500",margin:0},k={padding:"16px",borderBottom:"1px solid ".concat(u)},S={position:"relative"},C={position:"absolute",top:0,bottom:0,left:0,display:"flex",alignItems:"center",paddingLeft:"12px",pointerEvents:"none"},Z={display:"block",width:"100%",maxWidth:"384px",paddingLeft:"36px",paddingRight:"12px",paddingTop:"10px",paddingBottom:"10px",backgroundColor:c,border:"1px solid ".concat(u),color:p,fontSize:"14px",borderRadius:"8px",boxShadow:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",boxSizing:"border-box"},P={width:"100%",maxWidth:"100%",fontSize:"14px",textAlign:"left",color:f,textIndent:0,borderColor:"inherit",borderCollapse:"collapse"},R={fontSize:"14px",color:f,backgroundColor:c,borderBottom:"1px solid ".concat(u)},_={padding:"12px 24px",fontWeight:"500",userSelect:"none"},I={backgroundColor:l,borderBottom:"1px solid ".concat(u),transition:"background-color 0.2s"},A={padding:"16px 24px",wordBreak:"break-word",overflowWrap:"anywhere"},B={display:"flex",alignItems:"center",flexWrap:"wrap",justifyContent:"space-between",padding:"16px",gap:"8px"},T={fontSize:"14px",fontWeight:"normal",color:f},L={fontWeight:"600",color:p},j={display:"flex",marginLeft:"-1px",fontSize:"14px",listStyle:"none",padding:0,margin:0},M={display:"flex",alignItems:"center",justifyContent:"center",color:f,backgroundColor:c,boxSizing:"border-box",border:"1px solid ".concat(u),fontWeight:"500",fontSize:"14px",textDecoration:"none",cursor:"pointer",height:"36px",wordBreak:"keep-all",overflowWrap:"normal","&:hover":{backgroundColor:s,color:p}},D=i(i({},M),{borderRadius:"4px",paddingInline:"8px",width:"auto",height:"28px"}),O={width:"16px",height:"16px",color:f},W={position:"fixed",backgroundColor:l,border:"1px solid ".concat("#d1d5db"),borderRadius:"4px",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)",zIndex:9999,minWidth:"120px"},X={display:"block",width:"100%",textAlign:"left",paddingLeft:"12px",paddingRight:"12px",paddingTop:"8px",paddingBottom:"8px",fontSize:"14px",color:"#374151",backgroundColor:"transparent",border:"none",cursor:"pointer",whiteSpace:"nowrap","&:hover":{backgroundColor:s},"&:first-of-type":{borderTopLeftRadius:"4px",borderTopRightRadius:"4px"},"&:last-of-type":{borderBottomLeftRadius:"4px",borderBottomRightRadius:"4px"}},z=i(i({},D),{aspectRatio:1,paddingLeft:0,paddingRight:0}),N={display:"flex",gap:"8px",justifyContent:"flex-end"},E=i(i({},M),{width:"36px",borderRightWidth:0}),F=i(i({},E),{borderTopLeftRadius:"8px",borderBottomLeftRadius:"8px",paddingLeft:"12px",paddingRight:"12px",width:"auto"}),V=i(i({},E),{borderTopRightRadius:"8px",borderBottomRightRadius:"8px",paddingLeft:"12px",paddingRight:"12px",width:"auto",borderRightWidth:1}),Q=i(i({},E),{color:h,backgroundColor:"#eff6ff",border:"1px solid ".concat(u)}),Y=i(i({},E),{cursor:"default","&:focus":{outline:"none"}}),H={opacity:.8,cursor:"default",color:d,"&:hover":{backgroundColor:c,color:d}},$=function(){return $=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},$.apply(this,arguments)};function q(){return(0,n.tZ)("svg",$({css:g,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2},{children:(0,n.tZ)("path",{strokeLinecap:"round",d:"M21 21l-3.5-3.5M17 10a7 7 0 1 1-14 0 7 7 0 0 1 14 0Z"})}))}function K(e){var t=e.searchQuery,r=e.onSearchChange;return(0,n.tZ)("div",$({css:k},{children:(0,n.BX)("div",$({css:S},{children:[(0,n.tZ)("div",$({css:C},{children:(0,n.tZ)(q,{})})),(0,n.tZ)("input",{type:"text",css:Z,placeholder:"Search",value:t,onChange:function(e){return r(e.target.value)},onKeyDown:function(e){"Enter"===e.key&&e.preventDefault()}})]}))}))}var G=function(){return G=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},G.apply(this,arguments)};function J(e){var t=e.isSorted,r=e.sortDirection;return(0,n.BX)("svg",G({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"},{children:[(0,n.tZ)("path",{css:y,stroke:"currentColor","data-active":t&&"asc"===r||void 0,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"m8 9 4-4 4 4"}),(0,n.tZ)("path",{css:y,stroke:"currentColor","data-active":t&&"desc"===r||void 0,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"m8 15 4 4 4-4"})]}))}function U(e){var t=e.columns,r=e.enableSort,o=e.sortColumn,a=e.sortDirection,i=e.onSort,l=e.styles;return(0,n.tZ)(n.HY,{children:t.map((function(e,t){var c=r,s=o===e.name,u=0===t;return(0,n.tZ)("th",G({scope:"col",onClick:function(){return c&&i(e.name)},css:G(G(G(G({},_),u?{}:{paddingLeft:0}),l.getTarget("th")),c?{cursor:"pointer"}:{})},{children:(0,n.BX)("div",G({css:b},{children:[(0,n.tZ)("span",{children:e.name}),c&&(0,n.tZ)("span",G({css:v},{children:(0,n.tZ)(J,{isSorted:s,sortDirection:a})}))]}))}),t)}))})}var ee=function(){return ee=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},ee.apply(this,arguments)};function te(e){var t=e.currentPage,r=e.totalItems,o=e.rowsPerPage;return(0,n.BX)("span",ee({css:T},{children:["Showing"," ",(0,n.BX)("span",ee({css:L},{children:[t*o+1,"-",Math.min((t+1)*o,r)]}))," ","of ",(0,n.tZ)("span",ee({css:L},{children:r}))]}))}function re(e){var t=e.disabled,r=e.onClick;return(0,n.tZ)("button",ee({type:"button",onClick:r,disabled:t,css:ee(ee({},F),t?H:{})},{children:"Previous"}))}function ne(e){var t=e.disabled,r=e.onClick;return(0,n.tZ)("button",ee({type:"button",onClick:r,disabled:t,css:ee(ee({},V),t?H:{})},{children:"Next"}))}function oe(e){var t=e.currentPage,r=e.totalPages,o=e.onPageChange;return(0,n.tZ)(n.HY,{children:Array.from({length:r},(function(e,a){var i=0===a||a===r-1||Math.abs(a-t)<=1;if(1===a&&t>2||a===r-2&&t<r-3)return(0,n.tZ)("li",{children:(0,n.tZ)("button",ee({type:"button",disabled:!0,css:Y},{children:"..."}))},a);if(!i)return null;var l=a===t;return(0,n.tZ)("li",{children:(0,n.tZ)("button",ee({type:"button",onClick:function(){return o(a)},"aria-current":l?"page":void 0,css:l?Q:E},{children:a+1}))},a)}))})}function ae(e){var t=e.currentPage,r=e.totalPages,o=e.totalItems,a=e.rowsPerPage,i=e.onPageChange;return r<=1?null:(0,n.BX)("nav",ee({css:B,"aria-label":"Table navigation"},{children:[(0,n.tZ)(te,{currentPage:t,totalItems:o,rowsPerPage:a}),(0,n.BX)("ul",ee({css:j},{children:[(0,n.tZ)("li",{children:(0,n.tZ)(re,{disabled:0===t,onClick:function(){return i(Math.max(0,t-1))}})}),(0,n.tZ)(oe,{currentPage:t,totalPages:r,onPageChange:i}),(0,n.tZ)("li",{children:(0,n.tZ)(ne,{disabled:t>=r-1,onClick:function(){i(Math.min(r-1,t+1))}})})]}))]}))}var ie=r(3935),le=r(1142),ce=r(9479),se=function(){return se=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},se.apply(this,arguments)},ue=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,a=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return i};function de(){return(0,n.BX)("svg",se({css:O,fill:"currentColor",viewBox:"0 0 24 24"},{children:[(0,n.tZ)("circle",{cx:"12",cy:"5",r:"2"}),(0,n.tZ)("circle",{cx:"12",cy:"12",r:"2"}),(0,n.tZ)("circle",{cx:"12",cy:"19",r:"2"})]}))}function fe(e){var t=e.actions,r=e.rowIndex,a=e.columnData,i=e.fieldValues,l=e.onClick,c=e.forceInlineButtons,s=void 0!==c&&c;if(0===t.length)return null;var u=ue((0,o.useState)(!1),2),d=u[0],f=u[1],p=ue((0,o.useState)({top:0,left:0}),2),h=p[0],g=p[1],v=(0,o.useRef)(null),y=(0,o.useRef)(null),b=(0,o.useRef)(null),x=!s&&t.length>1;(0,o.useEffect)((function(){var e=function(e){y.current&&!y.current.contains(e.target)&&b.current&&!b.current.contains(e.target)&&f(!1)};return d&&(0,ce.me)().addEventListener("mousedown",e),function(){(0,ce.me)().removeEventListener("mousedown",e)}}),[d]);var m=function(e){f(!1);var t=i||le.u4,n={};a.forEach((function(e){var o=t[e.field_key],a=Array.isArray(o)?o[r]:o;n[e.name]=a})),l({action:e.label,rowIndex:r,rowData:n})};return(0,n.tZ)("div",se({ref:v,css:N},{children:x?(0,n.BX)(n.HY,{children:[(0,n.tZ)("button",se({ref:b,type:"button",onClick:function(e){e.stopPropagation(),function(){if(!d&&b.current){var e=b.current.getBoundingClientRect();g({top:e.bottom+4,left:e.right})}f(!d)}()},css:z},{children:(0,n.tZ)(de,{})})),d&&(0,ie.createPortal)((0,n.tZ)("div",se({ref:y,css:se(se({},W),{top:"".concat(h.top,"px"),left:"".concat(h.left,"px"),transform:"translateX(-100%)"})},{children:t.map((function(e,t){return(0,n.tZ)("button",se({type:"button",onClick:function(){return m(e)},css:X},{children:e.label}),t)}))})),(0,ce.me)().body)]}):t.map((function(e,t){return(0,n.tZ)("button",se({type:"button",onClick:function(t){t.stopPropagation(),m(e)},css:D},{children:e.label}),t)}))}))}var pe=function(){return pe=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},pe.apply(this,arguments)};function he(e){var t=e.hasSearchQuery;return(0,n.BX)("div",pe({css:m},{children:[t&&(0,n.tZ)("svg",pe({css:{width:"48px",height:"48px",color:"#9ca3af",marginBottom:"16px"},fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5},{children:(0,n.tZ)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z"})})),(0,n.tZ)("p",pe({css:w},{children:t?"No results found":"No data available"})),t&&(0,n.tZ)("p",pe({css:pe(pe({},w),{fontSize:"14px",marginTop:"8px"})},{children:"Try adjusting your search query"}))]}))}var ge=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,a=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return i};function ve(e){var t,r=function(e){if(null==e||""===e)return null;var t=String(e).trim().replace(/[$€£¥]/g,"").replace(/[,%]/g,"").replace(/\s/g,""),r=parseFloat(t);return isNaN(r)?null:r}(e),n=function(e){var t,r,n,o;if(null==e||""===e)return null;var a=String(e).trim(),i=new Date(a);if(!isNaN(i.getTime()))return i;try{for(var l=function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}([/^(\d{1,2})[/-](\d{1,2})[/-](\d{2,4})$/,/^(\d{4})[/-](\d{1,2})[/-](\d{1,2})$/]),c=l.next();!c.done;c=l.next()){var s=c.value,u=a.match(s);if(u){var d=void 0,f=void 0,p=void 0;4===u[1].length?(d=(n=ge(u,4))[1],f=n[2],p=n[3]):(f=(o=ge(u,4))[1],p=o[2],d=o[3]),2===d.length&&(d=parseInt(d)<50?"20".concat(d):"19".concat(d));var h=new Date(parseInt(d),parseInt(f)-1,parseInt(p));if(!isNaN(h.getTime()))return h}}}catch(e){t={error:e}}finally{try{c&&!c.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}return null}(e);return{original:e,asNumber:r,asDate:n,asString:null!==(t=(0,a.e7)(e))&&void 0!==t?t:""}}function ye(e,t){return null!==e.asNumber&&null!==t.asNumber?e.asNumber-t.asNumber:null!==e.asDate&&null!==t.asDate?e.asDate.getTime()-t.asDate.getTime():e.asString.localeCompare(t.asString)}var be=function(){return be=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},be.apply(this,arguments)},xe=function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},me=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,a=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return i},we=function(e,t,r){if(r||2===arguments.length)for(var n,o=0,a=t.length;o<a;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))};var ke=function(){return ke=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},ke.apply(this,arguments)};const Se=function(e){var t=e.element,r=e.responsiveStyles,i=e.onClick,l=void 0===i?function(){}:i,c=e.editMode,s=void 0!==c&&c,u=(0,o.useMemo)((function(){return function(e){return e.addTargets("table","thead","tbody","th","td","tr"),e}(r)}),[r]),d=function(e){var t,r,n,i,l,c,s,u,d,f,p=e.element,h=e.editMode,g=void 0!==h&&h,v=(null===(t=p.properties)||void 0===t?void 0:t.columns)||[],y=((null===(r=p.properties)||void 0===r?void 0:r.actions)||[]).filter((function(e){return e.label&&""!==e.label.trim()})),b=null!==(i=null===(n=p.properties)||void 0===n?void 0:n.search)&&void 0!==i&&i,x=null!==(c=null===(l=p.properties)||void 0===l?void 0:l.sort)&&void 0!==c&&c,m=null!==(u=null===(s=p.properties)||void 0===s?void 0:s.transpose)&&void 0!==u&&u,w=null!==(f=null===(d=p.properties)||void 0===d?void 0:d.pagination)&&void 0!==f?f:0,k="number"==typeof w&&w>0?Math.floor(w):0,S=k>0,C=(0,o.useMemo)((function(){var e=v;return g&&(e=e.map((function(e,t){return be(be({},e),{field_key:"example_column_".concat(t)})}))),e}),[g,v]),Z=(0,o.useMemo)((function(){return g?function(e,t){void 0===t&&(t=2);var r={};return e.forEach((function(e){r[e.field_key]=Array(t).fill("Sample")})),r}(C):le.u4}),[g,C,v.length]),P=me((0,o.useState)(""),2),R=P[0],_=P[1],I=me((0,o.useState)(null),2),A=I[0],B=I[1],T=me((0,o.useState)("asc"),2),L=T[0],j=T[1],M=me((0,o.useState)(0),2),D=M[0],O=M[1],W=(0,o.useMemo)((function(){return C.reduce((function(e,t){var r=Z[t.field_key];return Array.isArray(r)?Math.max(e,r.length):e}),0)}),[C,Z]),X=(0,o.useMemo)((function(){return Array.from({length:W},(function(e,t){return t}))}),[W]),z=(0,o.useMemo)((function(){return m&&b&&R.trim()?X.filter((function(e){return C.some((function(t){var r,n=Z[t.field_key],o=Array.isArray(n)?n[e]:n;return(null!==(r=(0,a.e7)(o))&&void 0!==r?r:"").toLowerCase().includes(R.toLowerCase().trim())}))})):X}),[m,X,C,R,b,Z]),N=me((0,o.useState)(null),2),E=N[0],F=N[1],V=(0,o.useMemo)((function(){if(!m||!x||null===E)return z;var e=C[E];return e?we([],me(z),!1).sort((function(t,r){var n=Z[e.field_key],o=Array.isArray(n)?n[t]:n,a=Array.isArray(n)?n[r]:n,i=ye(ve(o),ve(a));return"asc"===L?i:-i})):z}),[m,z,E,L,C,Z,x]),Q=(0,o.useMemo)((function(){if(!m||!S)return V;var e=D*k,t=e+k;return V.slice(e,t)}),[m,V,D,k,S]),Y=(0,o.useMemo)((function(){if(!m||0===W)return{columns:C,activeFieldValues:Z,transposedRowIndices:[]};var e=function(e,t,r,n){var o,a,i,l,c,s,u=n||Array.from({length:r},(function(e,t){return t})),d=[{name:"",field_id:"_transpose_field_name",field_type:"text",field_key:"_transpose_field_name"}];try{for(var f=xe(u),p=f.next();!p.done;p=f.next()){var h=p.value;d.push({name:"",field_id:"_transpose_row_".concat(h),field_type:"text",field_key:"_transpose_row_".concat(h),originalRowIndex:h})}}catch(e){o={error:e}}finally{try{p&&!p.done&&(a=f.return)&&a.call(f)}finally{if(o)throw o.error}}var g={_transpose_field_name:e.map((function(e){return e.name}))};try{for(var v=xe(u),y=v.next();!y.done;y=v.next()){h=y.value;var b=[];try{for(var x=(c=void 0,xe(e)),m=x.next();!m.done;m=x.next()){var w=t[m.value.field_key],k=Array.isArray(w)?w[h]:w;b.push(k)}}catch(e){c={error:e}}finally{try{m&&!m.done&&(s=x.return)&&s.call(x)}finally{if(c)throw c.error}}g["_transpose_row_".concat(h)]=b}}catch(e){i={error:e}}finally{try{y&&!y.done&&(l=v.return)&&l.call(v)}finally{if(i)throw i.error}}return{transposedColumns:d,transposedFieldValues:g,includedRowIndices:u}}(C,Z,W,Q);return{columns:e.transposedColumns,activeFieldValues:e.transposedFieldValues,transposedRowIndices:e.includedRowIndices}}),[m,C,Z,W,Q]),H=Y.columns,$=Y.activeFieldValues,q=Y.transposedRowIndices,K=(0,o.useMemo)((function(){return H.reduce((function(e,t){var r=$[t.field_key];return Array.isArray(r)?Math.max(e,r.length):e}),0)}),[H,$]),G=(0,o.useMemo)((function(){return Array.from({length:K},(function(e,t){return t}))}),[K]),J=(0,o.useMemo)((function(){return m?G:b&&R.trim()?G.filter((function(e){return H.some((function(t){var r,n=$[t.field_key],o=Array.isArray(n)?n[e]:n;return(null!==(r=(0,a.e7)(o))&&void 0!==r?r:"").toLowerCase().includes(R.toLowerCase().trim())}))})):G}),[m,G,H,R,b,$]),U=(0,o.useMemo)((function(){if(m)return J;if(!x||!A)return J;var e=H.find((function(e){return e.name===A}));return e?we([],me(J),!1).sort((function(t,r){var n=$[e.field_key],o=Array.isArray(n)?n[t]:n,a=Array.isArray(n)?n[r]:n,i=ye(ve(o),ve(a));return"asc"===L?i:-i})):J}),[m,J,A,L,H,x,$]),ee=(0,o.useMemo)((function(){if(m)return G;if(!S)return U;var e=D*k,t=e+k;return U.slice(e,t)}),[m,G,U,D,k,S]);(0,o.useEffect)((function(){O(0)}),[R,A,L]);var te=m?V.length:U.length,re=S?Math.ceil(te/k):1,ne=K>0,oe=m?z.length>0:J.length>0;return{enableSearch:b,searchQuery:R,hasSearchResults:oe,setSearchQuery:_,enableSort:x,sortColumn:A,sortDirection:L,sortedColumnIndex:E,handleSort:function(e){x&&(A===e?"asc"===L?j("desc"):(B(null),j("asc")):(B(e),j("asc")))},handleTransposedSort:function(e){x&&m&&(E===e?"asc"===L?j("desc"):(F(null),j("asc")):(F(e),j("asc")))},enablePagination:S,currentPage:D,paginatedRowIndices:ee,rowsPerPage:k,setCurrentPage:O,columns:H,actions:y,isTransposed:m&&W>0,transposedRowIndices:q,totalRows:te,totalPages:re,hasData:ne,activeFieldValues:$,baseColumns:C,baseFieldValues:Z}}({element:t,editMode:s}),f=d.enableSearch,p=d.searchQuery,h=d.setSearchQuery,g=d.enableSort,y=d.sortColumn,m=d.sortDirection,w=d.sortedColumnIndex,k=d.handleSort,S=d.handleTransposedSort,C=d.enablePagination,Z=d.currentPage,B=d.setCurrentPage,T=d.paginatedRowIndices,L=d.rowsPerPage,j=d.columns,M=d.actions,D=d.isTransposed,O=d.transposedRowIndices,W=d.totalRows,X=d.totalPages,z=d.hasData,N=d.hasSearchResults,E=d.activeFieldValues,F=d.baseColumns,V=d.baseFieldValues,Q=!z||z&&!N;return(0,n.tZ)("div",ke({css:ke(ke({},x),u.getTarget("container"))},{children:(0,n.BX)("div",ke({css:{minWidth:"fit-content"}},{children:[f&&(0,n.tZ)(K,{searchQuery:p,onSearchChange:h}),Q?(0,n.tZ)(he,{hasSearchQuery:p.trim().length>0}):(0,n.BX)("table",ke({css:ke(ke({},P),u.getTarget("table"))},{children:[!D&&(0,n.tZ)("thead",ke({css:R},{children:(0,n.BX)("tr",{children:[(0,n.tZ)(U,{columns:j,enableSort:g,sortColumn:y,sortDirection:m,onSort:k,styles:u}),M.length>0&&(0,n.tZ)("th",{scope:"col",css:ke(ke(ke({},_),{paddingLeft:0}),u.getTarget("th"))})]})})),(0,n.BX)("tbody",ke({css:u.getTarget("tbody")},{children:[T.map((function(e){var t={};return D||j.forEach((function(r){var n=E[r.field_key],o=Array.isArray(n)?n[e]:n;t[r.name]=o})),(0,n.BX)("tr",ke({css:ke(ke({},I),u.getTarget("tr")),onClick:function(){D||l({rowIndex:e,rowData:t})}},{children:[j.map((function(t,r){var o,i,c=E[t.field_key],s=Array.isArray(c)?c[e]:c,d=D&&0===r,f=d&&g,p=w===e,h=0===r,y=1===r,x=D&&!d?t.originalRowIndex:void 0,k=d?ke(ke(ke(ke({},_),{backgroundColor:"#f9fafb",borderRight:"1px solid #e5e7eb",width:"1px",whiteSpace:"nowrap"}),u.getTarget("th")),f?{cursor:"pointer"}:{}):ke(ke(ke(ke({},A),D?y?{}:{paddingLeft:0}:h?{}:{paddingLeft:0}),D&&!d?{cursor:"pointer"}:{}),u.getTarget("td")),C=d?"th":"td";return(0,n.tZ)(C,ke({css:k,onClick:function(t){if(f)S(e);else if(D&&void 0!==x){t.stopPropagation();var r={};F.forEach((function(e){var t=V[e.field_key],n=Array.isArray(t)?t[x]:t;r[e.name]=n})),l({rowIndex:x,rowData:r})}}},d?{scope:"row"}:{},{children:d&&f?(0,n.BX)("div",ke({css:ke(ke({},b),{justifyContent:"space-between"})},{children:[(0,n.tZ)("span",{children:null!==(o=(0,a.e7)(s))&&void 0!==o?o:""}),(0,n.tZ)("span",ke({css:v},{children:(0,n.tZ)(J,{isSorted:p,sortDirection:m})}))]})):null!==(i=(0,a.e7)(s))&&void 0!==i?i:""}),r)})),!D&&M.length>0&&(0,n.tZ)("td",ke({css:ke(ke(ke({},A),{paddingLeft:0}),u.getTarget("td"))},{children:(0,n.tZ)(fe,{actions:M,rowIndex:e,columnData:F,fieldValues:V,onClick:l})}))]}),e)})),D&&M.length>0&&(0,n.BX)("tr",ke({css:ke(ke({},I),u.getTarget("tr"))},{children:[(0,n.tZ)("th",{scope:"row",css:ke(ke(ke({},_),{backgroundColor:"#f9fafb",borderRight:"1px solid #e5e7eb",width:"1px",whiteSpace:"nowrap"}),u.getTarget("th"))}),O.map((function(e,t){return(0,n.tZ)("td",ke({css:ke(ke(ke({},A),0===t?{}:{paddingLeft:0}),u.getTarget("td"))},{children:(0,n.tZ)("div",ke({css:{display:"flex",justifyContent:"flex-start"}},{children:(0,n.tZ)(fe,{actions:M,rowIndex:e,columnData:F,fieldValues:V,onClick:l,forceInlineButtons:!0})}))}),e)}))]}))]}))]})),!Q&&C&&(0,n.tZ)(ae,{currentPage:Z,totalPages:X,totalItems:W,rowsPerPage:L,onPageChange:B})]}))}))}}}]);
|