@undp/data-viz 1.5.2 → 1.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AreaChart.cjs +1 -1
- package/dist/AreaChart.cjs.map +1 -1
- package/dist/AreaChart.js +3 -2
- package/dist/AreaChart.js.map +1 -1
- package/dist/BarGraph.cjs +1 -1
- package/dist/BarGraph.cjs.map +1 -1
- package/dist/BarGraph.js +1196 -1224
- package/dist/BarGraph.js.map +1 -1
- package/dist/BeeSwarmChart.cjs +1 -1
- package/dist/BeeSwarmChart.cjs.map +1 -1
- package/dist/BeeSwarmChart.js +130 -142
- package/dist/BeeSwarmChart.js.map +1 -1
- package/dist/BiVariateChoroplethMap.cjs +1 -1
- package/dist/BiVariateChoroplethMap.cjs.map +1 -1
- package/dist/BiVariateChoroplethMap.js +41 -41
- package/dist/BiVariateChoroplethMap.js.map +1 -1
- package/dist/BulletChart.cjs +1 -1
- package/dist/BulletChart.cjs.map +1 -1
- package/dist/BulletChart.js +483 -487
- package/dist/BulletChart.js.map +1 -1
- package/dist/ButterflyChart.cjs +1 -1
- package/dist/ButterflyChart.cjs.map +1 -1
- package/dist/ButterflyChart.js +99 -99
- package/dist/ButterflyChart.js.map +1 -1
- package/dist/ChoroplethMap.cjs +1 -1
- package/dist/ChoroplethMap.cjs.map +1 -1
- package/dist/ChoroplethMap.js +125 -125
- package/dist/ChoroplethMap.js.map +1 -1
- package/dist/CirclePackingGraph.cjs +1 -1
- package/dist/CirclePackingGraph.js +2 -2
- package/dist/DataCards.cjs +2 -2
- package/dist/DataCards.cjs.map +1 -1
- package/dist/DataCards.js +6 -6
- package/dist/DataCards.js.map +1 -1
- package/dist/DataTable.cjs +1 -1
- package/dist/DataTable.cjs.map +1 -1
- package/dist/DataTable.js +66 -68
- package/dist/DataTable.js.map +1 -1
- package/dist/DifferenceLineChart.cjs +1 -1
- package/dist/DifferenceLineChart.cjs.map +1 -1
- package/dist/DifferenceLineChart.js +3 -2
- package/dist/DifferenceLineChart.js.map +1 -1
- package/dist/DonutChart.cjs +1 -1
- package/dist/DonutChart.cjs.map +1 -1
- package/dist/DonutChart.js +205 -205
- package/dist/DonutChart.js.map +1 -1
- package/dist/DotDensityMap.cjs +1 -1
- package/dist/DotDensityMap.cjs.map +1 -1
- package/dist/DotDensityMap.js +78 -81
- package/dist/DotDensityMap.js.map +1 -1
- package/dist/DualAxisLineChart.cjs +1 -1
- package/dist/DualAxisLineChart.cjs.map +1 -1
- package/dist/DualAxisLineChart.js +3 -2
- package/dist/DualAxisLineChart.js.map +1 -1
- package/dist/DumbbellChart.cjs +1 -1
- package/dist/DumbbellChart.cjs.map +1 -1
- package/dist/DumbbellChart.js +64 -65
- package/dist/DumbbellChart.js.map +1 -1
- package/dist/GeoHubMap.cjs +1 -1
- package/dist/GeoHubMap.js +1 -1
- package/dist/GeoHubMapWithLayerSelection.cjs +1 -1
- package/dist/GeoHubMapWithLayerSelection.js +1 -1
- package/dist/{GraphEl-4RUlclvW.cjs → GraphEl-BcYgMnN2.cjs} +2 -2
- package/dist/{GraphEl-4RUlclvW.cjs.map → GraphEl-BcYgMnN2.cjs.map} +1 -1
- package/dist/{GraphEl-ClIxlWa3.js → GraphEl-CMWeARJ3.js} +2 -2
- package/dist/{GraphEl-ClIxlWa3.js.map → GraphEl-CMWeARJ3.js.map} +1 -1
- package/dist/GriddedGraphs.cjs +1 -1
- package/dist/GriddedGraphs.js +4 -4
- package/dist/GriddedGraphsFromConfig.cjs +1 -1
- package/dist/GriddedGraphsFromConfig.js +1 -1
- package/dist/HeatMap.cjs +1 -1
- package/dist/HeatMap.cjs.map +1 -1
- package/dist/HeatMap.js +83 -83
- package/dist/HeatMap.js.map +1 -1
- package/dist/Histogram.cjs +1 -1
- package/dist/Histogram.js +1 -1
- package/dist/LineChartWithConfidenceInterval.cjs +1 -1
- package/dist/LineChartWithConfidenceInterval.cjs.map +1 -1
- package/dist/LineChartWithConfidenceInterval.js +7 -6
- package/dist/LineChartWithConfidenceInterval.js.map +1 -1
- package/dist/MultiGraphDashboard.cjs +1 -1
- package/dist/MultiGraphDashboard.js +2 -2
- package/dist/MultiGraphDashboardFromConfig.cjs +1 -1
- package/dist/MultiGraphDashboardFromConfig.js +1 -1
- package/dist/MultiGraphDashboardWideToLongFormat.cjs +1 -1
- package/dist/MultiGraphDashboardWideToLongFormat.js +1 -1
- package/dist/MultiGraphDashboardWideToLongFormatFromConfig.cjs +1 -1
- package/dist/MultiGraphDashboardWideToLongFormatFromConfig.js +1 -1
- package/dist/MultiLineAltChart.cjs +1 -1
- package/dist/MultiLineAltChart.cjs.map +1 -1
- package/dist/MultiLineAltChart.js +82 -91
- package/dist/MultiLineAltChart.js.map +1 -1
- package/dist/MultiLineChart.cjs +1 -1
- package/dist/MultiLineChart.cjs.map +1 -1
- package/dist/MultiLineChart.js +3 -2
- package/dist/MultiLineChart.js.map +1 -1
- package/dist/PerformanceIntensiveMultiGraphDashboard.cjs +1 -1
- package/dist/PerformanceIntensiveMultiGraphDashboard.js +2 -2
- package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.cjs +1 -1
- package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.js +1 -1
- package/dist/RadarChart.cjs +1 -1
- package/dist/RadarChart.cjs.map +1 -1
- package/dist/RadarChart.js +124 -130
- package/dist/RadarChart.js.map +1 -1
- package/dist/SankeyChart.cjs +1 -1
- package/dist/SankeyChart.cjs.map +1 -1
- package/dist/SankeyChart.js +200 -200
- package/dist/SankeyChart.js.map +1 -1
- package/dist/ScatterPlot.cjs +1 -1
- package/dist/ScatterPlot.cjs.map +1 -1
- package/dist/ScatterPlot.js +149 -155
- package/dist/ScatterPlot.js.map +1 -1
- package/dist/SimpleLineChart.cjs +1 -1
- package/dist/SimpleLineChart.cjs.map +1 -1
- package/dist/SimpleLineChart.js +44 -43
- package/dist/SimpleLineChart.js.map +1 -1
- package/dist/SingleGraphDashboard.cjs +1 -1
- package/dist/SingleGraphDashboard.js +4 -4
- package/dist/SingleGraphDashboardFromConfig.cjs +1 -1
- package/dist/SingleGraphDashboardFromConfig.js +1 -1
- package/dist/SingleGraphDashboardGeoHubMapsFromConfig.cjs +1 -1
- package/dist/SingleGraphDashboardGeoHubMapsFromConfig.js +1 -1
- package/dist/SingleGraphDashboardThreeDGraphs.cjs +1 -1
- package/dist/SingleGraphDashboardThreeDGraphs.js +3 -3
- package/dist/SingleGraphDashboardThreeDGraphsFromConfig.cjs +1 -1
- package/dist/SingleGraphDashboardThreeDGraphsFromConfig.js +1 -1
- package/dist/SlopeChart.cjs +1 -1
- package/dist/SlopeChart.cjs.map +1 -1
- package/dist/SlopeChart.js +107 -113
- package/dist/SlopeChart.js.map +1 -1
- package/dist/SparkLine.cjs +1 -1
- package/dist/SparkLine.cjs.map +1 -1
- package/dist/SparkLine.js +3 -2
- package/dist/SparkLine.js.map +1 -1
- package/dist/StripChart.cjs +1 -1
- package/dist/StripChart.cjs.map +1 -1
- package/dist/StripChart.js +159 -159
- package/dist/StripChart.js.map +1 -1
- package/dist/ThreeDGlobe.cjs +1 -1
- package/dist/ThreeDGlobe.cjs.map +1 -1
- package/dist/ThreeDGlobe.js +3 -3
- package/dist/ThreeDGlobe.js.map +1 -1
- package/dist/TreeMapGraph.cjs +1 -1
- package/dist/TreeMapGraph.cjs.map +1 -1
- package/dist/TreeMapGraph.js +194 -200
- package/dist/TreeMapGraph.js.map +1 -1
- package/dist/ensureCompleteData-DkQYPeDa.cjs +2 -0
- package/dist/ensureCompleteData-DkQYPeDa.cjs.map +1 -0
- package/dist/{ensureCompleteData-BALdOrsS.js → ensureCompleteData-DlmibgaI.js} +28 -8
- package/dist/ensureCompleteData-DlmibgaI.js.map +1 -0
- package/dist/fetchAndParseData-Ba-_CgxS.cjs +16 -0
- package/dist/fetchAndParseData-Ba-_CgxS.cjs.map +1 -0
- package/dist/fetchAndParseData-sapWbnYk.js +583 -0
- package/dist/fetchAndParseData-sapWbnYk.js.map +1 -0
- package/dist/fetchAndParseData.cjs +1 -1
- package/dist/fetchAndParseData.js +1 -1
- package/dist/getJenks-BbngDoBQ.js +19 -0
- package/dist/getJenks-BbngDoBQ.js.map +1 -0
- package/dist/getJenks-GYmdwBqm.cjs +2 -0
- package/dist/getJenks-GYmdwBqm.cjs.map +1 -0
- package/dist/getSliderMarks-9cNoRkDx.js +1023 -0
- package/dist/getSliderMarks-9cNoRkDx.js.map +1 -0
- package/dist/getSliderMarks-CRIbTGYV.cjs +6 -0
- package/dist/getSliderMarks-CRIbTGYV.cjs.map +1 -0
- package/dist/getUniqValue-DiCh_MOD.js +13 -0
- package/dist/getUniqValue-DiCh_MOD.js.map +1 -0
- package/dist/getUniqValue-RViz8tTw.cjs +2 -0
- package/dist/getUniqValue-RViz8tTw.cjs.map +1 -0
- package/dist/{index-BMgDMxKJ.js → index-37q0ULNQ.js} +44 -50
- package/dist/index-37q0ULNQ.js.map +1 -0
- package/dist/index-CVlCtJbC.cjs +2 -0
- package/dist/index-CVlCtJbC.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -6
- package/dist/sort-DfK1b0F5.js +34 -0
- package/dist/sort-DfK1b0F5.js.map +1 -0
- package/dist/sort-O96oMZLb.cjs +2 -0
- package/dist/sort-O96oMZLb.cjs.map +1 -0
- package/dist/transformData.cjs +1 -1
- package/dist/transformData.js +3 -3
- package/dist/transformDataForAggregation-KXGm6flX.cjs +2 -0
- package/dist/{transformDataForAggregation-BVxVu4yY.cjs.map → transformDataForAggregation-KXGm6flX.cjs.map} +1 -1
- package/dist/{transformDataForAggregation-1BYVFqvF.js → transformDataForAggregation-sBpdlX8n.js} +40 -44
- package/dist/{transformDataForAggregation-1BYVFqvF.js.map → transformDataForAggregation-sBpdlX8n.js.map} +1 -1
- package/dist/{transformDataForGraphFromFile-BC9Ha8hF.js → transformDataForGraphFromFile-ComYvzuz.js} +3 -3
- package/dist/{transformDataForGraphFromFile-BC9Ha8hF.js.map → transformDataForGraphFromFile-ComYvzuz.js.map} +1 -1
- package/dist/{transformDataForGraphFromFile-b41aNQYY.cjs → transformDataForGraphFromFile-DVZodTHd.cjs} +2 -2
- package/dist/{transformDataForGraphFromFile-b41aNQYY.cjs.map → transformDataForGraphFromFile-DVZodTHd.cjs.map} +1 -1
- package/dist/uniqBy-BHy4I8PK.js +8 -0
- package/dist/uniqBy-BHy4I8PK.js.map +1 -0
- package/dist/uniqBy-O05lp2S5.cjs +2 -0
- package/dist/uniqBy-O05lp2S5.cjs.map +1 -0
- package/dist/utils.cjs +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +2 -2
- package/package.json +1 -7
- package/dist/ensureCompleteData-BALdOrsS.js.map +0 -1
- package/dist/ensureCompleteData-BU5Zlccy.cjs +0 -2
- package/dist/ensureCompleteData-BU5Zlccy.cjs.map +0 -1
- package/dist/fetchAndParseData-DBOl1Icl.js +0 -1196
- package/dist/fetchAndParseData-DBOl1Icl.js.map +0 -1
- package/dist/fetchAndParseData-Dcy7AS_0.cjs +0 -16
- package/dist/fetchAndParseData-Dcy7AS_0.cjs.map +0 -1
- package/dist/getJenks-DW96UYNE.js +0 -23
- package/dist/getJenks-DW96UYNE.js.map +0 -1
- package/dist/getJenks-vofIZmeb.cjs +0 -2
- package/dist/getJenks-vofIZmeb.cjs.map +0 -1
- package/dist/getSliderMarks-C0jptXeP.js +0 -1054
- package/dist/getSliderMarks-C0jptXeP.js.map +0 -1
- package/dist/getSliderMarks-CtsEXiLV.cjs +0 -6
- package/dist/getSliderMarks-CtsEXiLV.cjs.map +0 -1
- package/dist/getUniqValue-CfuE_l9c.cjs +0 -2
- package/dist/getUniqValue-CfuE_l9c.cjs.map +0 -1
- package/dist/getUniqValue-CttuU_wn.js +0 -20
- package/dist/getUniqValue-CttuU_wn.js.map +0 -1
- package/dist/index-AqnpA7_O.js +0 -631
- package/dist/index-AqnpA7_O.js.map +0 -1
- package/dist/index-BJOeaYTk.cjs +0 -2
- package/dist/index-BJOeaYTk.cjs.map +0 -1
- package/dist/index-BMgDMxKJ.js.map +0 -1
- package/dist/index-DYH8g9WA.cjs +0 -2
- package/dist/index-DYH8g9WA.cjs.map +0 -1
- package/dist/index-Da2GUKrr.cjs +0 -2
- package/dist/index-Da2GUKrr.cjs.map +0 -1
- package/dist/index-fwdktvAS.js +0 -707
- package/dist/index-fwdktvAS.js.map +0 -1
- package/dist/transformDataForAggregation-BVxVu4yY.cjs +0 -2
package/dist/GriddedGraphs.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-CHPV5EwG-DDoeWRVt.cjs"),d=require("react"),ee=require("./index-D72cOtq7.cjs"),N=require("./index-BS2TADPj.cjs"),h=require("./checkIfMultiple-BXbHUCWM.cjs"),ae=require("./Spinner-DA6Z5E4n.cjs"),f=require("./DropdownSelect-DBDM64B5.cjs"),te=require("./GraphEl-4RUlclvW.cjs"),v=require("./fetchAndParseData-Dcy7AS_0.cjs"),le=require("./Colors.cjs"),W=require("./transformDataForAggregation-BVxVu4yY.cjs"),Z=require("./getUniqValue-CfuE_l9c.cjs"),re=require("./GraphHeader.cjs"),oe=require("./GraphFooter.cjs"),z=require("./filterData-BoYadk0l.cjs"),ne=require("./ColorLegend.cjs"),ie=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),B=require("./transformDataForSelect-YmStusCI.cjs");function se(J){const{graphSettings:a,dataSettings:n,filters:T,graphType:A,dataTransform:D,graphDataConfiguration:s,noOfColumns:E,columnGridBy:I,dataFilters:$,showCommonColorScale:k,minGraphHeight:K,minGraphWidth:q,debugMode:w,dataSelectionOptions:F,advancedDataSelectionOptions:O,readableHeader:Q,noOfFiltersPerRow:g=4,uiMode:p="normal",theme:H="light"}=J,[C,X]=d.useState(void 0),[S,Y]=d.useState(void 0),[b,_]=d.useState([]),M=d.useRef(null),[m,x]=d.useState(s),[j,L]=d.useState([]),[c,R]=d.useState({}),V=d.useMemo(()=>({ignoreCase:!0,ignoreAccents:!0,trim:!0}),[]),U=d.useMemo(()=>!S||j.length===0?S:S.filter(u=>j.every(t=>t.value&&N.flattenDeep([t.value]).length>0?ee.intersection(N.flattenDeep([u[t.filter]]),N.flattenDeep([t.value]).map(l=>l.value)).length>0:!0)),[j,S]);d.useEffect(()=>{X(U)},[U]);const P=d.useCallback(async()=>{if(n)try{const u=await(n.dataURL?typeof n.dataURL=="string"?n.fileType==="json"?v.fetchAndParseJSON(n.dataURL,n.columnsToArray,n.dataTransformation,w):n.fileType==="api"?v.fetchAndTransformDataFromAPI(n.dataURL,n.apiHeaders,n.columnsToArray,n.dataTransformation,w):v.fetchAndParseCSV(n.dataURL,n.dataTransformation,n.columnsToArray,w,n.delimiter,!0):v.fetchAndParseMultipleDataSources(n.dataURL,n.idColumnTitle):v.transformColumnsToArray(n.data,n.columnsToArray));Y(u);const t=Z.getUniqValue(u,I);_(t);const l=(T||[]).map(o=>({filter:o.column,label:o.label||`Filter by ${o.column}`,singleSelect:o.singleSelect,clearable:o.clearable,defaultValue:B.transformDefaultValue(o.defaultValue),value:B.transformDefaultValue(o.defaultValue),availableValues:Z.getUniqValue(u,o.column).filter(i=>!o.excludeValues?.includes(`${i}`)).map(i=>({value:i,label:i})),allowSelectAll:o.allowSelectAll,width:o.width}));L(l)}catch(e){console.error("Data fetching error:",e)}},[n,w,I,T]);d.useEffect(()=>{P()},[P]),d.useEffect(()=>{x(s)},[s]);const G=d.useCallback((e,u)=>{L(t=>t.map(l=>l.filter===e?{...l,value:u}:l))},[]);return r.jsxRuntimeExports.jsx("div",{className:`${H||a?.theme||"light"} flex ${a?.width?"w-fit grow-0":"w-full grow"}`,dir:a?.language==="he"||a?.language==="ar"?"rtl":void 0,children:r.jsxRuntimeExports.jsx("div",{className:`${a?.backgroundColor?a?.backgroundColor===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${a?.language||"en"}`,style:{...a?.backgroundColor&&a?.backgroundColor!==!0?{backgroundColor:a?.backgroundColor}:{}},id:a?.graphID,ref:M,"aria-label":a?.ariaLabel||`${a?.graphTitle?`The graph shows ${a?.graphTitle}. `:""}This is a gridded chart.${a?.graphDescription?` ${a?.graphDescription}`:""}`,children:r.jsxRuntimeExports.jsx("div",{style:{padding:a?.backgroundColor?a?.padding||"1rem":a?.padding||0,flexGrow:1,display:"flex"},children:r.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[c?.graphTitle||c?.graphDescription||a?.graphTitle||a?.graphDescription||a?.graphDownload||a?.dataDownload?r.jsxRuntimeExports.jsx(re.GraphHeader,{styles:{title:c?.styles?.title||a?.styles?.title,description:c?.styles?.description||a?.styles?.description},classNames:{title:c?.classNames?.title||a?.classNames?.title,description:c?.classNames?.description||a?.classNames?.description},graphTitle:c?.graphTitle||a?.graphTitle,graphDescription:c?.graphDescription||a?.graphDescription,width:c?.width||a?.width,graphDownload:a?.graphDownload?M.current:void 0,dataDownload:a?.dataDownload&&C&&C.length>0?C:null}):null,C&&b.length>0?r.jsxRuntimeExports.jsxs(r.jsxRuntimeExports.Fragment,{children:[j.length!==0||(F||[]).length!==0||(O||[]).length!==0?r.jsxRuntimeExports.jsxs("div",{style:{display:"flex",gap:"1rem",flexWrap:"wrap",alignItems:"flex-start",width:"100%"},children:[O?.map((e,u)=>r.jsxRuntimeExports.jsxs("div",{style:{width:e.width||`calc(${100/g}% - ${(g-1)/g}rem)`,flexGrow:1,flexShrink:e.ui!=="radio"?0:1,minWidth:"240px"},children:[r.jsxRuntimeExports.jsx(h.f,{className:"mb-2",children:e.label||"Graph by"}),e.ui!=="radio"?r.jsxRuntimeExports.jsx(f.Za,{options:e.options.map(t=>({...t,value:t.label})),isClearable:!1,isSearchable:!0,variant:p,controlShouldRenderValue:!0,defaultValue:e.defaultValue?{...e.defaultValue,value:e.defaultValue?.label}:{...e.options[0],value:e.options[0].label},onChange:t=>{R(t?.graphSettings||{}),x(t?.dataConfiguration)}}):r.jsxRuntimeExports.jsx(h.fe,{defaultValue:e.defaultValue?.label||e.options[0].label,variant:p,onValueChange:t=>{const l=e.options[e.options.findIndex(o=>o.label===t)];R(l.graphSettings||{}),x(l.dataConfiguration)},children:e.options.map((t,l)=>r.jsxRuntimeExports.jsx(h.ve,{label:t.label,value:t.label},l))})]},u)),F?.map((e,u)=>r.jsxRuntimeExports.jsxs("div",{style:{width:e.width||`calc(${100/g}% - ${(g-1)/g}rem)`,flexGrow:1,flexShrink:e.ui!=="radio"?0:1,minWidth:"240px"},children:[r.jsxRuntimeExports.jsx(h.f,{className:"mb-2",children:e.label||`Visualize ${e.chartConfigId} by`}),h.checkIfMultiple(e.chartConfigId,m||[])?e.ui!=="radio"?r.jsxRuntimeExports.jsx(f.Za,{options:e.allowedColumnIds,isMulti:!0,variant:p,isSearchable:!0,controlShouldRenderValue:!0,defaultValue:s?s[s.findIndex(t=>t.chartConfigId===e.chartConfigId)].columnId.map(t=>e.allowedColumnIds[e.allowedColumnIds.findIndex(l=>l.value===t)]):void 0,filterOption:f.Hu(V),onChange:t=>{const l={columnId:t.map(i=>i.value),chartConfigId:e.chartConfigId},o=m?.map(i=>i.chartConfigId===l.chartConfigId?l:i);x(o)},isRtl:a?.language==="ar"||a?.language==="he"}):r.jsxRuntimeExports.jsx(h.w,{variant:p,defaultValue:s?s[s.findIndex(t=>t.chartConfigId===e.chartConfigId)].columnId.map(t=>e.allowedColumnIds[e.allowedColumnIds.findIndex(l=>l.value===t)]).map(t=>t.value):[],onValueChange:t=>{const l={columnId:t||[],chartConfigId:e.chartConfigId},o=m?.map(i=>i.chartConfigId===l.chartConfigId?l:i);x(o)},children:e.allowedColumnIds.map((t,l)=>r.jsxRuntimeExports.jsx(h.G,{label:t.label,value:t.label},l))}):e.ui!=="radio"?r.jsxRuntimeExports.jsx(f.Za,{options:e.allowedColumnIds,isClearable:!1,isSearchable:!0,variant:p,defaultValue:s?e.allowedColumnIds[e.allowedColumnIds.findIndex(t=>t.value===s[s.findIndex(l=>l.chartConfigId===e.chartConfigId)].columnId)]:void 0,controlShouldRenderValue:!0,onChange:t=>{const l={columnId:t?.value,chartConfigId:e.chartConfigId},o=m?.map(i=>i.chartConfigId===l.chartConfigId?l:i);R(t?.graphSettings||{}),x(o)}}):r.jsxRuntimeExports.jsx(h.fe,{variant:p,defaultValue:s?e.allowedColumnIds[e.allowedColumnIds.findIndex(t=>t.value===s[s.findIndex(l=>l.chartConfigId===e.chartConfigId)].columnId)].label:"",onValueChange:t=>{const l=e.allowedColumnIds[e.allowedColumnIds.findIndex(y=>y.label===t)],o={columnId:l.value,chartConfigId:e.chartConfigId},i=m?.map(y=>y.chartConfigId===o.chartConfigId?o:y);R(l.graphSettings||{}),x(i)},children:e.allowedColumnIds.map((t,l)=>r.jsxRuntimeExports.jsx(h.ve,{label:t.label,value:t.label},l))})]},u)),j?.map((e,u)=>r.jsxRuntimeExports.jsxs("div",{style:{width:e.width||`calc(${100/g}% - ${(g-1)/g}rem)`,flexGrow:1,flexShrink:0,flexWrap:"wrap"},children:[r.jsxRuntimeExports.jsx(h.f,{className:"mb-2",children:e.label}),e.singleSelect?r.jsxRuntimeExports.jsx(f.Za,{variant:p,options:e.availableValues,isClearable:e.clearable===void 0?!0:e.clearable,isRtl:a?.language==="ar"||a?.language==="he",isSearchable:!0,controlShouldRenderValue:!0,filterOption:f.Hu(V),onChange:t=>{G(e.filter,t)},defaultValue:e.defaultValue}):r.jsxRuntimeExports.jsxs(r.jsxRuntimeExports.Fragment,{children:[r.jsxRuntimeExports.jsx(f.Za,{variant:p,options:e.availableValues,isMulti:!0,isClearable:e.clearable===void 0?!0:e.clearable,isSearchable:!0,controlShouldRenderValue:!0,filterOption:f.Hu(V),onChange:t=>{G(e.filter,t)},defaultValue:e.defaultValue,isRtl:a?.language==="ar"||a?.language==="he"}),e.allowSelectAll?r.jsxRuntimeExports.jsx("button",{className:"bg-transparent border-0 p-0 mt-2 cursor-pointer text-primary-blue-600 dark:text-primary-blue-400",type:"button",onClick:()=>{G(e.filter,e.availableValues)},children:"Select all options"}):null]})]},u))]}):null,k!==!1&&a?.showColorScale!==!1?r.jsxRuntimeExports.jsx(ne.ColorLegend,{width:a?.width,colorLegendTitle:a?.colorLegendTitle,colors:a?.colors||a?.lineColors||le.Colors[a?.theme||"light"].categoricalColors.colors,colorDomain:a?.colorDomain||a?.labels||[],showNAColor:a?.showNAColor===void 0||a?.showNAColor===null?!0:a?.showNAColor}):null,r.jsxRuntimeExports.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"1rem",flexDirection:a?.language==="ar"||a?.language==="he"?"row-reverse":"row",justifyContent:"center"},children:b.map((e,u)=>r.jsxRuntimeExports.jsx("div",{style:{width:`calc(${100/(E||Math.min(4,b.length||0))}% - ${((E||Math.min(4,b.length||0))-1)/(E||Math.min(4,b.length||0))}rem)`,minWidth:ie.checkIfNullOrUndefined(q)?"280px":`${q}px`},children:r.jsxRuntimeExports.jsx(te.GraphEl,{graph:A,graphDataConfiguration:m,graphData:W.transformDataForGraph(D?W.transformDataForAggregation(z.filterData(C,$||[]).filter(t=>t[I]===e),D.keyColumn,D.aggregationColumnsSetting):z.filterData(C,$||[]).filter(t=>t[I]===e),A,m)||[],debugMode:w,settings:{...a||{},...c,theme:a?.theme||H,width:void 0,height:void 0,relativeHeight:a?.relativeHeight||.67,minHeight:K,graphTitle:`${e}`,graphDescription:void 0,graphDownload:!1,dataDownload:!1,backgroundColor:void 0,padding:"0",footNote:void 0,sources:void 0,showColorScale:a?.showColorScale===!1?!1:k===!1},readableHeader:Q||[]})},u))})]}):r.jsxRuntimeExports.jsx("div",{className:"w-full flex justify-center p-4",children:r.jsxRuntimeExports.jsx(ae.y,{})}),a?.sources||a?.footNote?r.jsxRuntimeExports.jsx(oe.GraphFooter,{styles:{footnote:a?.styles?.footnote,source:a?.styles?.source},classNames:{footnote:a?.classNames?.footnote,source:a?.classNames?.source},sources:a?.sources,footNote:a?.footNote,width:a?.width}):null]})})})})}exports.GriddedGraphs=se;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-CHPV5EwG-DDoeWRVt.cjs"),d=require("react"),ee=require("./index-D72cOtq7.cjs"),N=require("./index-BS2TADPj.cjs"),h=require("./checkIfMultiple-BXbHUCWM.cjs"),ae=require("./Spinner-DA6Z5E4n.cjs"),f=require("./DropdownSelect-DBDM64B5.cjs"),te=require("./GraphEl-BcYgMnN2.cjs"),v=require("./fetchAndParseData-Ba-_CgxS.cjs"),le=require("./Colors.cjs"),W=require("./transformDataForAggregation-KXGm6flX.cjs"),Z=require("./getUniqValue-RViz8tTw.cjs"),re=require("./GraphHeader.cjs"),oe=require("./GraphFooter.cjs"),z=require("./filterData-BoYadk0l.cjs"),ne=require("./ColorLegend.cjs"),ie=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),B=require("./transformDataForSelect-YmStusCI.cjs");function se(J){const{graphSettings:a,dataSettings:n,filters:T,graphType:A,dataTransform:D,graphDataConfiguration:s,noOfColumns:E,columnGridBy:I,dataFilters:$,showCommonColorScale:k,minGraphHeight:K,minGraphWidth:q,debugMode:w,dataSelectionOptions:F,advancedDataSelectionOptions:O,readableHeader:Q,noOfFiltersPerRow:g=4,uiMode:p="normal",theme:H="light"}=J,[C,X]=d.useState(void 0),[S,Y]=d.useState(void 0),[b,_]=d.useState([]),M=d.useRef(null),[m,x]=d.useState(s),[j,L]=d.useState([]),[c,R]=d.useState({}),V=d.useMemo(()=>({ignoreCase:!0,ignoreAccents:!0,trim:!0}),[]),U=d.useMemo(()=>!S||j.length===0?S:S.filter(u=>j.every(t=>t.value&&N.flattenDeep([t.value]).length>0?ee.intersection(N.flattenDeep([u[t.filter]]),N.flattenDeep([t.value]).map(l=>l.value)).length>0:!0)),[j,S]);d.useEffect(()=>{X(U)},[U]);const P=d.useCallback(async()=>{if(n)try{const u=await(n.dataURL?typeof n.dataURL=="string"?n.fileType==="json"?v.fetchAndParseJSON(n.dataURL,n.columnsToArray,n.dataTransformation,w):n.fileType==="api"?v.fetchAndTransformDataFromAPI(n.dataURL,n.apiHeaders,n.columnsToArray,n.dataTransformation,w):v.fetchAndParseCSV(n.dataURL,n.dataTransformation,n.columnsToArray,w,n.delimiter,!0):v.fetchAndParseMultipleDataSources(n.dataURL,n.idColumnTitle):v.transformColumnsToArray(n.data,n.columnsToArray));Y(u);const t=Z.getUniqValue(u,I);_(t);const l=(T||[]).map(o=>({filter:o.column,label:o.label||`Filter by ${o.column}`,singleSelect:o.singleSelect,clearable:o.clearable,defaultValue:B.transformDefaultValue(o.defaultValue),value:B.transformDefaultValue(o.defaultValue),availableValues:Z.getUniqValue(u,o.column).filter(i=>!o.excludeValues?.includes(`${i}`)).map(i=>({value:i,label:i})),allowSelectAll:o.allowSelectAll,width:o.width}));L(l)}catch(e){console.error("Data fetching error:",e)}},[n,w,I,T]);d.useEffect(()=>{P()},[P]),d.useEffect(()=>{x(s)},[s]);const G=d.useCallback((e,u)=>{L(t=>t.map(l=>l.filter===e?{...l,value:u}:l))},[]);return r.jsxRuntimeExports.jsx("div",{className:`${H||a?.theme||"light"} flex ${a?.width?"w-fit grow-0":"w-full grow"}`,dir:a?.language==="he"||a?.language==="ar"?"rtl":void 0,children:r.jsxRuntimeExports.jsx("div",{className:`${a?.backgroundColor?a?.backgroundColor===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${a?.language||"en"}`,style:{...a?.backgroundColor&&a?.backgroundColor!==!0?{backgroundColor:a?.backgroundColor}:{}},id:a?.graphID,ref:M,"aria-label":a?.ariaLabel||`${a?.graphTitle?`The graph shows ${a?.graphTitle}. `:""}This is a gridded chart.${a?.graphDescription?` ${a?.graphDescription}`:""}`,children:r.jsxRuntimeExports.jsx("div",{style:{padding:a?.backgroundColor?a?.padding||"1rem":a?.padding||0,flexGrow:1,display:"flex"},children:r.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[c?.graphTitle||c?.graphDescription||a?.graphTitle||a?.graphDescription||a?.graphDownload||a?.dataDownload?r.jsxRuntimeExports.jsx(re.GraphHeader,{styles:{title:c?.styles?.title||a?.styles?.title,description:c?.styles?.description||a?.styles?.description},classNames:{title:c?.classNames?.title||a?.classNames?.title,description:c?.classNames?.description||a?.classNames?.description},graphTitle:c?.graphTitle||a?.graphTitle,graphDescription:c?.graphDescription||a?.graphDescription,width:c?.width||a?.width,graphDownload:a?.graphDownload?M.current:void 0,dataDownload:a?.dataDownload&&C&&C.length>0?C:null}):null,C&&b.length>0?r.jsxRuntimeExports.jsxs(r.jsxRuntimeExports.Fragment,{children:[j.length!==0||(F||[]).length!==0||(O||[]).length!==0?r.jsxRuntimeExports.jsxs("div",{style:{display:"flex",gap:"1rem",flexWrap:"wrap",alignItems:"flex-start",width:"100%"},children:[O?.map((e,u)=>r.jsxRuntimeExports.jsxs("div",{style:{width:e.width||`calc(${100/g}% - ${(g-1)/g}rem)`,flexGrow:1,flexShrink:e.ui!=="radio"?0:1,minWidth:"240px"},children:[r.jsxRuntimeExports.jsx(h.f,{className:"mb-2",children:e.label||"Graph by"}),e.ui!=="radio"?r.jsxRuntimeExports.jsx(f.Za,{options:e.options.map(t=>({...t,value:t.label})),isClearable:!1,isSearchable:!0,variant:p,controlShouldRenderValue:!0,defaultValue:e.defaultValue?{...e.defaultValue,value:e.defaultValue?.label}:{...e.options[0],value:e.options[0].label},onChange:t=>{R(t?.graphSettings||{}),x(t?.dataConfiguration)}}):r.jsxRuntimeExports.jsx(h.fe,{defaultValue:e.defaultValue?.label||e.options[0].label,variant:p,onValueChange:t=>{const l=e.options[e.options.findIndex(o=>o.label===t)];R(l.graphSettings||{}),x(l.dataConfiguration)},children:e.options.map((t,l)=>r.jsxRuntimeExports.jsx(h.ve,{label:t.label,value:t.label},l))})]},u)),F?.map((e,u)=>r.jsxRuntimeExports.jsxs("div",{style:{width:e.width||`calc(${100/g}% - ${(g-1)/g}rem)`,flexGrow:1,flexShrink:e.ui!=="radio"?0:1,minWidth:"240px"},children:[r.jsxRuntimeExports.jsx(h.f,{className:"mb-2",children:e.label||`Visualize ${e.chartConfigId} by`}),h.checkIfMultiple(e.chartConfigId,m||[])?e.ui!=="radio"?r.jsxRuntimeExports.jsx(f.Za,{options:e.allowedColumnIds,isMulti:!0,variant:p,isSearchable:!0,controlShouldRenderValue:!0,defaultValue:s?s[s.findIndex(t=>t.chartConfigId===e.chartConfigId)].columnId.map(t=>e.allowedColumnIds[e.allowedColumnIds.findIndex(l=>l.value===t)]):void 0,filterOption:f.Hu(V),onChange:t=>{const l={columnId:t.map(i=>i.value),chartConfigId:e.chartConfigId},o=m?.map(i=>i.chartConfigId===l.chartConfigId?l:i);x(o)},isRtl:a?.language==="ar"||a?.language==="he"}):r.jsxRuntimeExports.jsx(h.w,{variant:p,defaultValue:s?s[s.findIndex(t=>t.chartConfigId===e.chartConfigId)].columnId.map(t=>e.allowedColumnIds[e.allowedColumnIds.findIndex(l=>l.value===t)]).map(t=>t.value):[],onValueChange:t=>{const l={columnId:t||[],chartConfigId:e.chartConfigId},o=m?.map(i=>i.chartConfigId===l.chartConfigId?l:i);x(o)},children:e.allowedColumnIds.map((t,l)=>r.jsxRuntimeExports.jsx(h.G,{label:t.label,value:t.label},l))}):e.ui!=="radio"?r.jsxRuntimeExports.jsx(f.Za,{options:e.allowedColumnIds,isClearable:!1,isSearchable:!0,variant:p,defaultValue:s?e.allowedColumnIds[e.allowedColumnIds.findIndex(t=>t.value===s[s.findIndex(l=>l.chartConfigId===e.chartConfigId)].columnId)]:void 0,controlShouldRenderValue:!0,onChange:t=>{const l={columnId:t?.value,chartConfigId:e.chartConfigId},o=m?.map(i=>i.chartConfigId===l.chartConfigId?l:i);R(t?.graphSettings||{}),x(o)}}):r.jsxRuntimeExports.jsx(h.fe,{variant:p,defaultValue:s?e.allowedColumnIds[e.allowedColumnIds.findIndex(t=>t.value===s[s.findIndex(l=>l.chartConfigId===e.chartConfigId)].columnId)].label:"",onValueChange:t=>{const l=e.allowedColumnIds[e.allowedColumnIds.findIndex(y=>y.label===t)],o={columnId:l.value,chartConfigId:e.chartConfigId},i=m?.map(y=>y.chartConfigId===o.chartConfigId?o:y);R(l.graphSettings||{}),x(i)},children:e.allowedColumnIds.map((t,l)=>r.jsxRuntimeExports.jsx(h.ve,{label:t.label,value:t.label},l))})]},u)),j?.map((e,u)=>r.jsxRuntimeExports.jsxs("div",{style:{width:e.width||`calc(${100/g}% - ${(g-1)/g}rem)`,flexGrow:1,flexShrink:0,flexWrap:"wrap"},children:[r.jsxRuntimeExports.jsx(h.f,{className:"mb-2",children:e.label}),e.singleSelect?r.jsxRuntimeExports.jsx(f.Za,{variant:p,options:e.availableValues,isClearable:e.clearable===void 0?!0:e.clearable,isRtl:a?.language==="ar"||a?.language==="he",isSearchable:!0,controlShouldRenderValue:!0,filterOption:f.Hu(V),onChange:t=>{G(e.filter,t)},defaultValue:e.defaultValue}):r.jsxRuntimeExports.jsxs(r.jsxRuntimeExports.Fragment,{children:[r.jsxRuntimeExports.jsx(f.Za,{variant:p,options:e.availableValues,isMulti:!0,isClearable:e.clearable===void 0?!0:e.clearable,isSearchable:!0,controlShouldRenderValue:!0,filterOption:f.Hu(V),onChange:t=>{G(e.filter,t)},defaultValue:e.defaultValue,isRtl:a?.language==="ar"||a?.language==="he"}),e.allowSelectAll?r.jsxRuntimeExports.jsx("button",{className:"bg-transparent border-0 p-0 mt-2 cursor-pointer text-primary-blue-600 dark:text-primary-blue-400",type:"button",onClick:()=>{G(e.filter,e.availableValues)},children:"Select all options"}):null]})]},u))]}):null,k!==!1&&a?.showColorScale!==!1?r.jsxRuntimeExports.jsx(ne.ColorLegend,{width:a?.width,colorLegendTitle:a?.colorLegendTitle,colors:a?.colors||a?.lineColors||le.Colors[a?.theme||"light"].categoricalColors.colors,colorDomain:a?.colorDomain||a?.labels||[],showNAColor:a?.showNAColor===void 0||a?.showNAColor===null?!0:a?.showNAColor}):null,r.jsxRuntimeExports.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"1rem",flexDirection:a?.language==="ar"||a?.language==="he"?"row-reverse":"row",justifyContent:"center"},children:b.map((e,u)=>r.jsxRuntimeExports.jsx("div",{style:{width:`calc(${100/(E||Math.min(4,b.length||0))}% - ${((E||Math.min(4,b.length||0))-1)/(E||Math.min(4,b.length||0))}rem)`,minWidth:ie.checkIfNullOrUndefined(q)?"280px":`${q}px`},children:r.jsxRuntimeExports.jsx(te.GraphEl,{graph:A,graphDataConfiguration:m,graphData:W.transformDataForGraph(D?W.transformDataForAggregation(z.filterData(C,$||[]).filter(t=>t[I]===e),D.keyColumn,D.aggregationColumnsSetting):z.filterData(C,$||[]).filter(t=>t[I]===e),A,m)||[],debugMode:w,settings:{...a||{},...c,theme:a?.theme||H,width:void 0,height:void 0,relativeHeight:a?.relativeHeight||.67,minHeight:K,graphTitle:`${e}`,graphDescription:void 0,graphDownload:!1,dataDownload:!1,backgroundColor:void 0,padding:"0",footNote:void 0,sources:void 0,showColorScale:a?.showColorScale===!1?!1:k===!1},readableHeader:Q||[]})},u))})]}):r.jsxRuntimeExports.jsx("div",{className:"w-full flex justify-center p-4",children:r.jsxRuntimeExports.jsx(ae.y,{})}),a?.sources||a?.footNote?r.jsxRuntimeExports.jsx(oe.GraphFooter,{styles:{footnote:a?.styles?.footnote,source:a?.styles?.source},classNames:{footnote:a?.classNames?.footnote,source:a?.classNames?.source},sources:a?.sources,footNote:a?.footNote,width:a?.width}):null]})})})})}exports.GriddedGraphs=se;
|
|
2
2
|
//# sourceMappingURL=GriddedGraphs.cjs.map
|
package/dist/GriddedGraphs.js
CHANGED
|
@@ -5,11 +5,11 @@ import { f as G } from "./index-EArKRVKg.js";
|
|
|
5
5
|
import { f as $, a as B, v as J, c as na, w as ia, G as sa } from "./checkIfMultiple-ChTJk2Tk.js";
|
|
6
6
|
import { y as da } from "./Spinner-C85UF28E.js";
|
|
7
7
|
import { Z as x, H as A } from "./DropdownSelect-CtOKZHD0.js";
|
|
8
|
-
import { G as ca } from "./GraphEl-
|
|
9
|
-
import { f as ua, a as ha, b as ga, c as fa, t as pa } from "./fetchAndParseData-
|
|
8
|
+
import { G as ca } from "./GraphEl-CMWeARJ3.js";
|
|
9
|
+
import { f as ua, a as ha, b as ga, c as fa, t as pa } from "./fetchAndParseData-sapWbnYk.js";
|
|
10
10
|
import { Colors as ma } from "./Colors.js";
|
|
11
|
-
import { a as Ca, t as wa } from "./transformDataForAggregation-
|
|
12
|
-
import { g as K } from "./getUniqValue-
|
|
11
|
+
import { a as Ca, t as wa } from "./transformDataForAggregation-sBpdlX8n.js";
|
|
12
|
+
import { g as K } from "./getUniqValue-DiCh_MOD.js";
|
|
13
13
|
import { GraphHeader as ba } from "./GraphHeader.js";
|
|
14
14
|
import { GraphFooter as xa } from "./GraphFooter.js";
|
|
15
15
|
import { f as Q } from "./filterData-9nEcQ-Jp.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index-CHPV5EwG-DDoeWRVt.cjs"),n=require("react"),s=require("./Spinner-DA6Z5E4n.cjs"),d=require("./GriddedGraphs.cjs"),c=require("./fetchAndParseData-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index-CHPV5EwG-DDoeWRVt.cjs"),n=require("react"),s=require("./Spinner-DA6Z5E4n.cjs"),d=require("./GriddedGraphs.cjs"),c=require("./fetchAndParseData-Ba-_CgxS.cjs");function f(i){const{config:t}=i,[e,r]=n.useState(void 0);return n.useEffect(()=>{(async()=>{if(typeof t=="string"){const o=await c.fetchAndParseJSON(t);r(o)}else r(t)})()},[t]),e?a.jsxRuntimeExports.jsx(d.GriddedGraphs,{noOfColumns:e.noOfColumns,columnGridBy:e.columnGridBy,graphSettings:e.graphSettings,dataSettings:e.dataSettings,filters:e.filters,graphType:e.graphType,minGraphHeight:e.minGraphHeight,minGraphWidth:e.minGraphWidth,dataTransform:e.dataTransform,graphDataConfiguration:e.graphDataConfiguration,dataFilters:e.dataFilters,showCommonColorScale:e.showCommonColorScale,debugMode:e.debugMode,dataSelectionOptions:e.dataSelectionOptions,advancedDataSelectionOptions:e.advancedDataSelectionOptions,readableHeader:e.readableHeader,noOfFiltersPerRow:e.noOfFiltersPerRow,theme:e.theme}):a.jsxRuntimeExports.jsx("div",{className:"w-full flex justify-center p-4",children:a.jsxRuntimeExports.jsx(s.y,{})})}exports.GriddedGraphsFromConfig=f;
|
|
2
2
|
//# sourceMappingURL=GriddedGraphsFromConfig.cjs.map
|
|
@@ -2,7 +2,7 @@ import { j as a } from "./index-CHPV5EwG-BPSP-7Jg.js";
|
|
|
2
2
|
import { useState as n, useEffect as s } from "react";
|
|
3
3
|
import { y as d } from "./Spinner-C85UF28E.js";
|
|
4
4
|
import { GriddedGraphs as f } from "./GriddedGraphs.js";
|
|
5
|
-
import { f as m } from "./fetchAndParseData-
|
|
5
|
+
import { f as m } from "./fetchAndParseData-sapWbnYk.js";
|
|
6
6
|
function S(r) {
|
|
7
7
|
const { config: e } = r, [t, o] = n(void 0);
|
|
8
8
|
return s(() => {
|
package/dist/HeatMap.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-CHPV5EwG-DDoeWRVt.cjs"),x=require("react"),ue=require("./index-DQA8q5sC.cjs"),le=require("./index-BJOeaYTk.cjs"),ce=require("./Modal-tXZlLE5s.cjs"),xe=require("./numberFormattingFunction-02t-wJta.cjs"),he=require("./Tooltip-De16GWhY.cjs"),de=require("./getTextColorBasedOnBgColor-nqY-bsM_.cjs"),re=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),ge=require("./string2HTML-z7CwHXcx.cjs"),me=require("./XAxesLabels-OjBNl_lS.cjs"),pe=require("./YAxesLabels-D8IydyZj.cjs"),ae=require("./band-CAApY4Pd.cjs"),fe=require("./ordinal-BOeNbyae.cjs"),je=require("./threshold-DNsSUf8Q.cjs"),Ce=require("./linear-BVckp9RD.cjs"),ye=require("./use-in-view-sQJZ_xDO.cjs"),se=require("./proxy-BHRoeZgd.cjs"),ve=require("./GraphHeader.cjs"),we=require("./GraphFooter.cjs"),be=require("./ColorLegendWithMouseOver.cjs"),Ee=require("./LinearColorLegend.cjs"),Re=require("./ThresholdColorLegendWithMouseOver.cjs"),i=require("./Colors.cjs"),qe=require("./EmptyState-d8_8SxeW.cjs");function $e(U){const{data:m,showColumnLabels:N,leftMargin:O,rightMargin:F,truncateBy:p,width:H,height:I,topMargin:z,bottomMargin:_,tooltip:q,onSeriesMouseOver:r,suffix:J,prefix:s,showValues:G,colorDomain:$,colors:S,noDataColor:f,scaleType:X,showRowLabels:K,selectedColor:Y,onSeriesMouseClick:V,resetSelectionOnDoubleClick:Q,detailsOnClick:y,styles:L,classNames:j,animate:v,precision:Z}=U,W=x.useRef(null),D=ye.useInView(W,{once:v.once,amount:v.amount}),l={top:z,bottom:_,left:O,right:F},[w,T]=x.useState(void 0),[a,M]=x.useState(void 0),[A,b]=x.useState(void 0),[o,B]=x.useState(void 0),ee=H-l.left-l.right,te=I-l.top-l.bottom,h=le.uniqBy(m,e=>e.column).map(e=>e.column),d=le.uniqBy(m,e=>e.row).map(e=>e.row),E=ae.band().domain(d).range([0,te]),k=E.bandwidth(),u=ae.band().domain(h).range([0,ee]),R=u.bandwidth(),P=X==="categorical"?fe.ordinal().domain($).range(S):X==="threshold"?je.threshold().domain($).range(S):Ce.linear().domain($).range(S);return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs(se.motion.svg,{width:`${H}px`,height:`${I}px`,viewBox:`0 0 ${H} ${I}`,style:{marginLeft:"auto",marginRight:"auto"},direction:"ltr",ref:W,children:[t.jsxRuntimeExports.jsx("g",{transform:`translate(${l.left},0)`,children:N?h.map((e,C)=>t.jsxRuntimeExports.jsx(me.XAxesLabels,{y:0,x:u(e),width:R,height:l.top-5,value:`${e}`.length<p?`${e}`:`${`${e}`.substring(0,p)}...`,style:L?.xAxis?.labels,className:j?.xAxis?.labels,alignment:"bottom",animate:{duration:0,once:!0,amount:0},isInView:D},C)):null}),t.jsxRuntimeExports.jsx("g",{transform:`translate(0,${l.top})`,children:K?d.map((e,C)=>t.jsxRuntimeExports.jsx(pe.YAxesLabels,{value:`${e}`.length<p?`${e}`:`${`${e}`.substring(0,p)}...`,y:E(e),x:0,width:l.left,height:k,alignment:"right",style:L?.yAxis?.labels,className:j?.yAxis?.labels,animate:{duration:0,once:!0,amount:0},isInView:D},C)):null}),t.jsxRuntimeExports.jsxs("g",{transform:`translate(${l.left},${l.top})`,children:[d.map((e,C)=>t.jsxRuntimeExports.jsx("g",{transform:`translate(0,${E(e)})`,children:h.map(g=>t.jsxRuntimeExports.jsx("rect",{x:u(g),y:0,width:R,height:k,style:{fill:f},className:"stroke-1 stroke-primary-white dark:stroke-primary-gray-700"},`${e}-${g}`))},C)),m.filter(e=>!re.checkIfNullOrUndefined(e.value)).map((e,C)=>{const g=re.checkIfNullOrUndefined(e.value)?f:P(e.value);return t.jsxRuntimeExports.jsxs("g",{transform:`translate(${u(e.column)},${E(e.row)})`,onMouseEnter:c=>{M(e),B(c.clientY),b(c.clientX),r?.(e)},onClick:()=>{(V||y)&&(ue.isEqual(w,e)&&Q?(T(void 0),V?.(void 0)):(T(e),V?.(e)))},onMouseMove:c=>{M(e),B(c.clientY),b(c.clientX)},onMouseLeave:()=>{M(void 0),b(void 0),B(void 0),r?.(void 0)},opacity:Y?Y===g?1:.3:1,children:[t.jsxRuntimeExports.jsx(se.motion.rect,{x:0,y:0,width:R,height:k,className:"stroke-1 stroke-primary-white dark:stroke-primary-gray-700",exit:{opacity:0,transition:{duration:v.duration}},variants:{initial:{fill:g,opacity:0},whileInView:{fill:g,opacity:1,transition:{duration:v.duration}}},initial:"initial",animate:D?"whileInView":"initial"}),G&&!re.checkIfNullOrUndefined(e.value)?t.jsxRuntimeExports.jsx(se.motion.g,{variants:{initial:{opacity:0},whileInView:{opacity:1,transition:{duration:v.duration}}},initial:"initial",animate:D?"whileInView":"initial",exit:{opacity:0,transition:{duration:v.duration}},children:t.jsxRuntimeExports.jsx("foreignObject",{y:0,x:0,width:R,height:k,children:t.jsxRuntimeExports.jsx("div",{className:"flex flex-col justify-center items-center h-inherit p-1",children:t.jsxRuntimeExports.jsx("p",{className:t.mo("text-xs text-center m-0 leading-[1.25] graph-value",j?.graphObjectValues),style:{color:de.getTextColorBasedOnBgColor(g),...L?.graphObjectValues||{}},children:xe.numberFormattingFunction(e.value,"NA",Z,s,J)})})},C)}):null]},`${e.column}-${e.row}`)}),a?t.jsxRuntimeExports.jsx("rect",{x:u(a.column),y:E(a.row),width:R,height:k,style:{fill:"none",fillOpacity:0,strokeWidth:1.5},className:"stroke-primary-gray-700 dark:stroke-primary-gray-300"}):null]})]}),a&&q&&A&&o?t.jsxRuntimeExports.jsx(he.Tooltip,{data:a,body:q,xPos:A,yPos:o,backgroundStyle:L?.tooltip,className:j?.tooltip}):null,y&&w!==void 0?t.jsxRuntimeExports.jsx(ce.X,{open:w!==void 0,onClose:()=>{T(void 0)},children:t.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof y=="string"?{__html:ge.string2HTML(y,w)}:void 0,children:typeof y=="function"?y(w):null})}):null]})}function Me(U){const{data:m,graphTitle:N,colors:O,sources:F,graphDescription:p,showColumnLabels:H=!0,leftMargin:I=100,rightMargin:z=10,truncateBy:_=999,height:q,width:r,scaleType:J,colorDomain:s,footNote:G,colorLegendTitle:$,padding:S,backgroundColor:f=!1,topMargin:X=30,bottomMargin:K=10,tooltip:Y,onSeriesMouseOver:V,suffix:Q="",prefix:y="",showRowLabels:L=!0,relativeHeight:j,showValues:v,graphID:Z,noDataColor:W=i.Colors.gray,showColorScale:D=!0,onSeriesMouseClick:l,graphDownload:w=!1,dataDownload:T=!1,fillContainer:a=!0,language:M="en",showNAColor:A=!0,minHeight:b=0,theme:o="light",ariaLabel:B,resetSelectionOnDoubleClick:ee=!0,detailsOnClick:te,styles:h,classNames:d,animate:E=!1,precision:k=2}=U,[u,R]=x.useState(0),[P,e]=x.useState(0),[C,g]=x.useState(void 0),c=x.useRef(null),ie=x.useRef(null);x.useEffect(()=>{const n=new ResizeObserver(ne=>{R(r||ne[0].target.clientWidth||620),e(q||ne[0].target.clientHeight||480)});return c.current&&(e(c.current.clientHeight||480),R(c.current.clientWidth||620),r||n.observe(c.current)),()=>n.disconnect()},[r,q]);const oe=J||(typeof s[0]=="string"?"categorical":s.length===2?"linear":"threshold");return t.jsxRuntimeExports.jsx("div",{className:`${o||"light"} flex ${r?"grow-0":"grow"} ${a?"w-full":"w-fit"}`,dir:M==="he"||M==="ar"?"rtl":void 0,children:t.jsxRuntimeExports.jsx("div",{className:t.mo(`${f?f===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${M||"en"}`,a?"w-full":"w-fit",d?.graphContainer),style:{...h?.graphContainer||{},...f&&f!==!0?{backgroundColor:f}:{}},id:Z,ref:ie,"aria-label":B||`${N?`The graph shows ${N}. `:""}This is a heatmap. ${p?` ${p}`:""}`,children:t.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:f?S||"1rem":S||0},children:t.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[N||p||w||T?t.jsxRuntimeExports.jsx(ve.GraphHeader,{styles:{title:h?.title,description:h?.description},classNames:{title:d?.title,description:d?.description},graphTitle:N,graphDescription:p,width:r,graphDownload:w?ie.current:void 0,dataDownload:T?m.map(n=>n.data).filter(n=>n!==void 0).length>0?m.map(n=>n.data).filter(n=>n!==void 0):m.filter(n=>n!==void 0):null}):null,t.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:m.length===0?t.jsxRuntimeExports.jsx(qe.EmptyState,{}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[D?oe==="categorical"?t.jsxRuntimeExports.jsx(be.ColorLegendWithMouseOver,{width:a?void 0:r,colorLegendTitle:$,colors:O||(typeof s[0]=="string"?i.Colors[o].categoricalColors.colors:s.length===2?[i.Colors[o].sequentialColors.neutralColorsx09[0],i.Colors[o].sequentialColors.neutralColorsx09[8]]:i.Colors[o].sequentialColors[`neutralColorsx0${s.length+1}`]),colorDomain:s.map(n=>`${n}`),setSelectedColor:g,showNAColor:A}):oe==="threshold"?t.jsxRuntimeExports.jsx(Re.ThresholdColorLegendWithMouseOver,{width:a?void 0:r,colorLegendTitle:$,colors:O||(typeof s[0]=="string"?i.Colors[o].categoricalColors.colors:s.length===2?[i.Colors[o].sequentialColors.neutralColorsx09[0],i.Colors[o].sequentialColors.neutralColorsx09[8]]:i.Colors[o].sequentialColors[`neutralColorsx0${s.length+1}`]),colorDomain:s,setSelectedColor:g,naColor:W,showNAColor:A}):t.jsxRuntimeExports.jsx(Ee.LinearColorLegend,{width:a?void 0:r,colorLegendTitle:$,colors:O||[i.Colors[o].sequentialColors.neutralColorsx09[0],i.Colors[o].sequentialColors.neutralColorsx09[8]],colorDomain:s}):null,t.jsxRuntimeExports.jsx("div",{className:"flex grow flex-col justify-center w-full leading-0",ref:c,"aria-label":"Graph area",children:(r||u)&&(q||P)?t.jsxRuntimeExports.jsx($e,{data:m,colorDomain:s,width:r||u,colors:O||(typeof s[0]=="string"?i.Colors[o].categoricalColors.colors:s.length===2?[i.Colors[o].sequentialColors.neutralColorsx09[0],i.Colors[o].sequentialColors.neutralColorsx09[8]]:i.Colors[o].sequentialColors[`neutralColorsx0${s.length+1}`]),noDataColor:W,scaleType:oe,height:Math.max(b,q||(j?b?(r||u)*j>b?(r||u)*j:b:(r||u)*j:P)),showColumnLabels:H,leftMargin:I,rightMargin:z,topMargin:X,bottomMargin:K,selectedColor:C,truncateBy:_,showRowLabels:L,tooltip:Y,onSeriesMouseOver:V,showValues:v,suffix:Q,prefix:y,onSeriesMouseClick:l,resetSelectionOnDoubleClick:ee,detailsOnClick:te,styles:h,classNames:d,animate:E===!0?{duration:.5,once:!0,amount:.5}:E||{duration:0,once:!0,amount:0},precision:k}):null})]})}),F||G?t.jsxRuntimeExports.jsx(we.GraphFooter,{styles:{footnote:h?.footnote,source:h?.source},classNames:{footnote:d?.footnote,source:d?.source},sources:F,footNote:G,width:r}):null]})})})})}exports.HeatMap=Me;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CHPV5EwG-DDoeWRVt.cjs"),x=require("react"),ue=require("./index-DQA8q5sC.cjs"),ce=require("./Modal-tXZlLE5s.cjs"),xe=require("./numberFormattingFunction-02t-wJta.cjs"),he=require("./Tooltip-De16GWhY.cjs"),de=require("./getTextColorBasedOnBgColor-nqY-bsM_.cjs"),re=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),ge=require("./string2HTML-z7CwHXcx.cjs"),me=require("./XAxesLabels-OjBNl_lS.cjs"),pe=require("./YAxesLabels-D8IydyZj.cjs"),le=require("./uniqBy-O05lp2S5.cjs"),ae=require("./band-CAApY4Pd.cjs"),fe=require("./ordinal-BOeNbyae.cjs"),je=require("./threshold-DNsSUf8Q.cjs"),Ce=require("./linear-BVckp9RD.cjs"),ye=require("./use-in-view-sQJZ_xDO.cjs"),se=require("./proxy-BHRoeZgd.cjs"),ve=require("./GraphHeader.cjs"),we=require("./GraphFooter.cjs"),be=require("./ColorLegendWithMouseOver.cjs"),Ee=require("./LinearColorLegend.cjs"),Re=require("./ThresholdColorLegendWithMouseOver.cjs"),i=require("./Colors.cjs"),qe=require("./EmptyState-d8_8SxeW.cjs");function $e(U){const{data:m,showColumnLabels:N,leftMargin:O,rightMargin:F,truncateBy:p,width:H,height:I,topMargin:z,bottomMargin:_,tooltip:q,onSeriesMouseOver:r,suffix:J,prefix:s,showValues:G,colorDomain:$,colors:S,noDataColor:f,scaleType:X,showRowLabels:K,selectedColor:Y,onSeriesMouseClick:V,resetSelectionOnDoubleClick:Q,detailsOnClick:y,styles:L,classNames:j,animate:v,precision:Z}=U,W=x.useRef(null),D=ye.useInView(W,{once:v.once,amount:v.amount}),l={top:z,bottom:_,left:O,right:F},[w,T]=x.useState(void 0),[a,M]=x.useState(void 0),[A,b]=x.useState(void 0),[o,B]=x.useState(void 0),ee=H-l.left-l.right,te=I-l.top-l.bottom,h=le.uniqBy(m,"column",!0),d=le.uniqBy(m,"row",!0),E=ae.band().domain(d).range([0,te]),k=E.bandwidth(),u=ae.band().domain(h).range([0,ee]),R=u.bandwidth(),P=X==="categorical"?fe.ordinal().domain($).range(S):X==="threshold"?je.threshold().domain($).range(S):Ce.linear().domain($).range(S);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs(se.motion.svg,{width:`${H}px`,height:`${I}px`,viewBox:`0 0 ${H} ${I}`,style:{marginLeft:"auto",marginRight:"auto"},direction:"ltr",ref:W,children:[e.jsxRuntimeExports.jsx("g",{transform:`translate(${l.left},0)`,children:N?h.map((t,C)=>e.jsxRuntimeExports.jsx(me.XAxesLabels,{y:0,x:u(t),width:R,height:l.top-5,value:`${t}`.length<p?`${t}`:`${`${t}`.substring(0,p)}...`,style:L?.xAxis?.labels,className:j?.xAxis?.labels,alignment:"bottom",animate:{duration:0,once:!0,amount:0},isInView:D},C)):null}),e.jsxRuntimeExports.jsx("g",{transform:`translate(0,${l.top})`,children:K?d.map((t,C)=>e.jsxRuntimeExports.jsx(pe.YAxesLabels,{value:`${t}`.length<p?`${t}`:`${`${t}`.substring(0,p)}...`,y:E(t),x:0,width:l.left,height:k,alignment:"right",style:L?.yAxis?.labels,className:j?.yAxis?.labels,animate:{duration:0,once:!0,amount:0},isInView:D},C)):null}),e.jsxRuntimeExports.jsxs("g",{transform:`translate(${l.left},${l.top})`,children:[d.map((t,C)=>e.jsxRuntimeExports.jsx("g",{transform:`translate(0,${E(t)})`,children:h.map(g=>e.jsxRuntimeExports.jsx("rect",{x:u(g),y:0,width:R,height:k,style:{fill:f},className:"stroke-1 stroke-primary-white dark:stroke-primary-gray-700"},`${t}-${g}`))},C)),m.filter(t=>!re.checkIfNullOrUndefined(t.value)).map((t,C)=>{const g=re.checkIfNullOrUndefined(t.value)?f:P(t.value);return e.jsxRuntimeExports.jsxs("g",{transform:`translate(${u(t.column)},${E(t.row)})`,onMouseEnter:c=>{M(t),B(c.clientY),b(c.clientX),r?.(t)},onClick:()=>{(V||y)&&(ue.isEqual(w,t)&&Q?(T(void 0),V?.(void 0)):(T(t),V?.(t)))},onMouseMove:c=>{M(t),B(c.clientY),b(c.clientX)},onMouseLeave:()=>{M(void 0),b(void 0),B(void 0),r?.(void 0)},opacity:Y?Y===g?1:.3:1,children:[e.jsxRuntimeExports.jsx(se.motion.rect,{x:0,y:0,width:R,height:k,className:"stroke-1 stroke-primary-white dark:stroke-primary-gray-700",exit:{opacity:0,transition:{duration:v.duration}},variants:{initial:{fill:g,opacity:0},whileInView:{fill:g,opacity:1,transition:{duration:v.duration}}},initial:"initial",animate:D?"whileInView":"initial"}),G&&!re.checkIfNullOrUndefined(t.value)?e.jsxRuntimeExports.jsx(se.motion.g,{variants:{initial:{opacity:0},whileInView:{opacity:1,transition:{duration:v.duration}}},initial:"initial",animate:D?"whileInView":"initial",exit:{opacity:0,transition:{duration:v.duration}},children:e.jsxRuntimeExports.jsx("foreignObject",{y:0,x:0,width:R,height:k,children:e.jsxRuntimeExports.jsx("div",{className:"flex flex-col justify-center items-center h-inherit p-1",children:e.jsxRuntimeExports.jsx("p",{className:e.mo("text-xs text-center m-0 leading-[1.25] graph-value",j?.graphObjectValues),style:{color:de.getTextColorBasedOnBgColor(g),...L?.graphObjectValues||{}},children:xe.numberFormattingFunction(t.value,"NA",Z,s,J)})})},C)}):null]},`${t.column}-${t.row}`)}),a?e.jsxRuntimeExports.jsx("rect",{x:u(a.column),y:E(a.row),width:R,height:k,style:{fill:"none",fillOpacity:0,strokeWidth:1.5},className:"stroke-primary-gray-700 dark:stroke-primary-gray-300"}):null]})]}),a&&q&&A&&o?e.jsxRuntimeExports.jsx(he.Tooltip,{data:a,body:q,xPos:A,yPos:o,backgroundStyle:L?.tooltip,className:j?.tooltip}):null,y&&w!==void 0?e.jsxRuntimeExports.jsx(ce.X,{open:w!==void 0,onClose:()=>{T(void 0)},children:e.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof y=="string"?{__html:ge.string2HTML(y,w)}:void 0,children:typeof y=="function"?y(w):null})}):null]})}function Me(U){const{data:m,graphTitle:N,colors:O,sources:F,graphDescription:p,showColumnLabels:H=!0,leftMargin:I=100,rightMargin:z=10,truncateBy:_=999,height:q,width:r,scaleType:J,colorDomain:s,footNote:G,colorLegendTitle:$,padding:S,backgroundColor:f=!1,topMargin:X=30,bottomMargin:K=10,tooltip:Y,onSeriesMouseOver:V,suffix:Q="",prefix:y="",showRowLabels:L=!0,relativeHeight:j,showValues:v,graphID:Z,noDataColor:W=i.Colors.gray,showColorScale:D=!0,onSeriesMouseClick:l,graphDownload:w=!1,dataDownload:T=!1,fillContainer:a=!0,language:M="en",showNAColor:A=!0,minHeight:b=0,theme:o="light",ariaLabel:B,resetSelectionOnDoubleClick:ee=!0,detailsOnClick:te,styles:h,classNames:d,animate:E=!1,precision:k=2}=U,[u,R]=x.useState(0),[P,t]=x.useState(0),[C,g]=x.useState(void 0),c=x.useRef(null),ie=x.useRef(null);x.useEffect(()=>{const n=new ResizeObserver(ne=>{R(r||ne[0].target.clientWidth||620),t(q||ne[0].target.clientHeight||480)});return c.current&&(t(c.current.clientHeight||480),R(c.current.clientWidth||620),r||n.observe(c.current)),()=>n.disconnect()},[r,q]);const oe=J||(typeof s[0]=="string"?"categorical":s.length===2?"linear":"threshold");return e.jsxRuntimeExports.jsx("div",{className:`${o||"light"} flex ${r?"grow-0":"grow"} ${a?"w-full":"w-fit"}`,dir:M==="he"||M==="ar"?"rtl":void 0,children:e.jsxRuntimeExports.jsx("div",{className:e.mo(`${f?f===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${M||"en"}`,a?"w-full":"w-fit",d?.graphContainer),style:{...h?.graphContainer||{},...f&&f!==!0?{backgroundColor:f}:{}},id:Z,ref:ie,"aria-label":B||`${N?`The graph shows ${N}. `:""}This is a heatmap. ${p?` ${p}`:""}`,children:e.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:f?S||"1rem":S||0},children:e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[N||p||w||T?e.jsxRuntimeExports.jsx(ve.GraphHeader,{styles:{title:h?.title,description:h?.description},classNames:{title:d?.title,description:d?.description},graphTitle:N,graphDescription:p,width:r,graphDownload:w?ie.current:void 0,dataDownload:T?m.map(n=>n.data).filter(n=>n!==void 0).length>0?m.map(n=>n.data).filter(n=>n!==void 0):m.filter(n=>n!==void 0):null}):null,e.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:m.length===0?e.jsxRuntimeExports.jsx(qe.EmptyState,{}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[D?oe==="categorical"?e.jsxRuntimeExports.jsx(be.ColorLegendWithMouseOver,{width:a?void 0:r,colorLegendTitle:$,colors:O||(typeof s[0]=="string"?i.Colors[o].categoricalColors.colors:s.length===2?[i.Colors[o].sequentialColors.neutralColorsx09[0],i.Colors[o].sequentialColors.neutralColorsx09[8]]:i.Colors[o].sequentialColors[`neutralColorsx0${s.length+1}`]),colorDomain:s.map(n=>`${n}`),setSelectedColor:g,showNAColor:A}):oe==="threshold"?e.jsxRuntimeExports.jsx(Re.ThresholdColorLegendWithMouseOver,{width:a?void 0:r,colorLegendTitle:$,colors:O||(typeof s[0]=="string"?i.Colors[o].categoricalColors.colors:s.length===2?[i.Colors[o].sequentialColors.neutralColorsx09[0],i.Colors[o].sequentialColors.neutralColorsx09[8]]:i.Colors[o].sequentialColors[`neutralColorsx0${s.length+1}`]),colorDomain:s,setSelectedColor:g,naColor:W,showNAColor:A}):e.jsxRuntimeExports.jsx(Ee.LinearColorLegend,{width:a?void 0:r,colorLegendTitle:$,colors:O||[i.Colors[o].sequentialColors.neutralColorsx09[0],i.Colors[o].sequentialColors.neutralColorsx09[8]],colorDomain:s}):null,e.jsxRuntimeExports.jsx("div",{className:"flex grow flex-col justify-center w-full leading-0",ref:c,"aria-label":"Graph area",children:(r||u)&&(q||P)?e.jsxRuntimeExports.jsx($e,{data:m,colorDomain:s,width:r||u,colors:O||(typeof s[0]=="string"?i.Colors[o].categoricalColors.colors:s.length===2?[i.Colors[o].sequentialColors.neutralColorsx09[0],i.Colors[o].sequentialColors.neutralColorsx09[8]]:i.Colors[o].sequentialColors[`neutralColorsx0${s.length+1}`]),noDataColor:W,scaleType:oe,height:Math.max(b,q||(j?b?(r||u)*j>b?(r||u)*j:b:(r||u)*j:P)),showColumnLabels:H,leftMargin:I,rightMargin:z,topMargin:X,bottomMargin:K,selectedColor:C,truncateBy:_,showRowLabels:L,tooltip:Y,onSeriesMouseOver:V,showValues:v,suffix:Q,prefix:y,onSeriesMouseClick:l,resetSelectionOnDoubleClick:ee,detailsOnClick:te,styles:h,classNames:d,animate:E===!0?{duration:.5,once:!0,amount:.5}:E||{duration:0,once:!0,amount:0},precision:k}):null})]})}),F||G?e.jsxRuntimeExports.jsx(we.GraphFooter,{styles:{footnote:h?.footnote,source:h?.source},classNames:{footnote:d?.footnote,source:d?.source},sources:F,footNote:G,width:r}):null]})})})})}exports.HeatMap=Me;
|
|
2
2
|
//# sourceMappingURL=HeatMap.cjs.map
|
package/dist/HeatMap.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeatMap.cjs","sources":["../src/Components/Graphs/HeatMap/Graph.tsx","../src/Components/Graphs/HeatMap/index.tsx"],"sourcesContent":["import isEqual from 'fast-deep-equal';\r\nimport { scaleLinear, scaleBand, scaleOrdinal, scaleThreshold } from 'd3-scale';\r\nimport { useRef, useState } from 'react';\r\nimport uniqBy from 'lodash.uniqby';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport { Modal } from '@undp/design-system-react/Modal';\r\nimport { motion, useInView } from 'motion/react';\r\n\r\nimport {\r\n AnimateDataType,\r\n ClassNameObject,\r\n HeatMapDataType,\r\n ScaleDataType,\r\n StyleObject,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { getTextColorBasedOnBgColor } from '@/Utils/getTextColorBasedOnBgColor';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { string2HTML } from '@/Utils/string2HTML';\r\nimport { XAxesLabels } from '@/Components/Elements/Axes/XAxesLabels';\r\nimport { YAxesLabels } from '@/Components/Elements/Axes/YAxesLabels';\r\n\r\ninterface Props {\r\n data: HeatMapDataType[];\r\n colorDomain: string[] | number[];\r\n colors: string[];\r\n noDataColor: string;\r\n scaleType: ScaleDataType;\r\n showColumnLabels: boolean;\r\n leftMargin: number;\r\n truncateBy: number;\r\n width: number;\r\n height: number;\r\n rightMargin: number;\r\n topMargin: number;\r\n showRowLabels: boolean;\r\n bottomMargin: number;\r\n suffix: string;\r\n prefix: string;\r\n showValues?: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n selectedColor?: string;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n resetSelectionOnDoubleClick: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n animate: AnimateDataType;\r\n precision: number;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n showColumnLabels,\r\n leftMargin,\r\n rightMargin,\r\n truncateBy,\r\n width,\r\n height,\r\n topMargin,\r\n bottomMargin,\r\n tooltip,\r\n onSeriesMouseOver,\r\n suffix,\r\n prefix,\r\n showValues,\r\n colorDomain,\r\n colors,\r\n noDataColor,\r\n scaleType,\r\n showRowLabels,\r\n selectedColor,\r\n onSeriesMouseClick,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n animate,\r\n precision,\r\n } = props;\r\n const svgRef = useRef(null);\r\n const isInView = useInView(svgRef, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n const margin = {\r\n top: topMargin,\r\n bottom: bottomMargin,\r\n left: leftMargin,\r\n right: rightMargin,\r\n };\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n const [mouseOverData, setMouseOverData] = useState<HeatMapDataType | undefined>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n const graphWidth = width - margin.left - margin.right;\r\n const graphHeight = height - margin.top - margin.bottom;\r\n const columns = uniqBy(data, d => d.column).map(d => d.column);\r\n const rows = uniqBy(data, d => d.row).map(d => d.row);\r\n const y = scaleBand().domain(rows).range([0, graphHeight]);\r\n const barHeight = y.bandwidth();\r\n const x = scaleBand().domain(columns).range([0, graphWidth]);\r\n const barWidth = x.bandwidth();\r\n const colorScale =\r\n scaleType === 'categorical'\r\n ? scaleOrdinal<number | string, string>().domain(colorDomain).range(colors)\r\n : scaleType === 'threshold'\r\n ? scaleThreshold<number, string>()\r\n .domain(colorDomain as number[])\r\n .range(colors)\r\n : scaleLinear<string, string>()\r\n .domain(colorDomain as number[])\r\n .range(colors);\r\n return (\r\n <>\r\n <motion.svg\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n viewBox={`0 0 ${width} ${height}`}\r\n style={{ marginLeft: 'auto', marginRight: 'auto' }}\r\n direction='ltr'\r\n ref={svgRef}\r\n >\r\n <g transform={`translate(${margin.left},${0})`}>\r\n {showColumnLabels\r\n ? columns.map((d, i) => (\r\n <XAxesLabels\r\n key={i}\r\n y={0}\r\n x={x(d) as number}\r\n width={barWidth}\r\n height={margin.top - 5}\r\n value={\r\n `${d}`.length < truncateBy ? `${d}` : `${`${d}`.substring(0, truncateBy)}...`\r\n }\r\n style={styles?.xAxis?.labels}\r\n className={classNames?.xAxis?.labels}\r\n alignment='bottom'\r\n animate={{ duration: 0, once: true, amount: 0 }}\r\n isInView={isInView}\r\n />\r\n ))\r\n : null}\r\n </g>\r\n <g transform={`translate(${0},${margin.top})`}>\r\n {showRowLabels\r\n ? rows.map((d, i) => (\r\n <YAxesLabels\r\n value={\r\n `${d}`.length < truncateBy ? `${d}` : `${`${d}`.substring(0, truncateBy)}...`\r\n }\r\n key={i}\r\n y={y(d) as number}\r\n x={0}\r\n width={margin.left}\r\n height={barHeight}\r\n alignment='right'\r\n style={styles?.yAxis?.labels}\r\n className={classNames?.yAxis?.labels}\r\n animate={{ duration: 0, once: true, amount: 0 }}\r\n isInView={isInView}\r\n />\r\n ))\r\n : null}\r\n </g>\r\n <g transform={`translate(${margin.left},${margin.top})`}>\r\n {rows.map((d, i) => (\r\n <g key={i} transform={`translate(0,${y(d)})`}>\r\n {columns.map(el => (\r\n <rect\r\n key={`${d}-${el}`}\r\n x={x(el)}\r\n y={0}\r\n width={barWidth}\r\n height={barHeight}\r\n style={{ fill: noDataColor }}\r\n className='stroke-1 stroke-primary-white dark:stroke-primary-gray-700'\r\n />\r\n ))}\r\n </g>\r\n ))}\r\n {data\r\n .filter(d => !checkIfNullOrUndefined(d.value))\r\n .map((d, i) => {\r\n const color = !checkIfNullOrUndefined(d.value)\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n colorScale(d.value as any)\r\n : noDataColor;\r\n return (\r\n <g\r\n key={`${d.column}-${d.row}`}\r\n transform={`translate(${x(d.column)},${y(d.row)})`}\r\n onMouseEnter={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(d);\r\n }}\r\n onClick={() => {\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (isEqual(mouseClickData, d) && resetSelectionOnDoubleClick) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData(d);\r\n onSeriesMouseClick?.(d);\r\n }\r\n }\r\n }}\r\n onMouseMove={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n }}\r\n onMouseLeave={() => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n }}\r\n opacity={selectedColor ? (selectedColor === color ? 1 : 0.3) : 1}\r\n >\r\n <motion.rect\r\n x={0}\r\n y={0}\r\n width={barWidth}\r\n height={barHeight}\r\n className='stroke-1 stroke-primary-white dark:stroke-primary-gray-700'\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { fill: color, opacity: 0 },\r\n whileInView: {\r\n fill: color,\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n {showValues && !checkIfNullOrUndefined(d.value) ? (\r\n <motion.g\r\n variants={{\r\n initial: { opacity: 0 },\r\n whileInView: { opacity: 1, transition: { duration: animate.duration } },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n >\r\n <foreignObject key={i} y={0} x={0} width={barWidth} height={barHeight}>\r\n <div className='flex flex-col justify-center items-center h-inherit p-1'>\r\n <p\r\n className={cn(\r\n 'text-xs text-center m-0 leading-[1.25] graph-value',\r\n classNames?.graphObjectValues,\r\n )}\r\n style={{\r\n color: getTextColorBasedOnBgColor(color),\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n >\r\n {numberFormattingFunction(d.value, 'NA', precision, prefix, suffix)}\r\n </p>\r\n </div>\r\n </foreignObject>\r\n </motion.g>\r\n ) : null}\r\n </g>\r\n );\r\n })}\r\n {mouseOverData ? (\r\n <rect\r\n x={x(mouseOverData.column)}\r\n y={y(mouseOverData.row)}\r\n width={barWidth}\r\n height={barHeight}\r\n style={{\r\n fill: 'none',\r\n fillOpacity: 0,\r\n strokeWidth: 1.5,\r\n }}\r\n className='stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n />\r\n ) : null}\r\n </g>\r\n </motion.svg>\r\n {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n {detailsOnClick && mouseClickData !== undefined ? (\r\n <Modal\r\n open={mouseClickData !== undefined}\r\n onClose={() => {\r\n setMouseClickData(undefined);\r\n }}\r\n >\r\n <div\r\n className='graph-modal-content m-0'\r\n dangerouslySetInnerHTML={\r\n typeof detailsOnClick === 'string'\r\n ? { __html: string2HTML(detailsOnClick, mouseClickData) }\r\n : undefined\r\n }\r\n >\r\n {typeof detailsOnClick === 'function' ? detailsOnClick(mouseClickData) : null}\r\n </div>\r\n </Modal>\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { useState, useRef, useEffect } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport {\r\n HeatMapDataType,\r\n Languages,\r\n ScaleDataType,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n AnimateDataType,\r\n} from '@/Types';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { ColorLegendWithMouseOver } from '@/Components/Elements/ColorLegendWithMouseOver';\r\nimport { LinearColorLegend } from '@/Components/Elements/LinearColorLegend';\r\nimport { ThresholdColorLegendWithMouseOver } from '@/Components/Elements/ThresholdColorLegendWithMouseOver';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { EmptyState } from '@/Components/Elements/EmptyState';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: HeatMapDataType[];\r\n\r\n // Titles, Labels, and Sources\r\n /** Title of the graph */\r\n graphTitle?: string | React.ReactNode;\r\n /** Description of the graph */\r\n graphDescription?: string | React.ReactNode;\r\n /** Footnote for the graph */\r\n footNote?: string | React.ReactNode;\r\n /** Source data for the graph */\r\n sources?: SourcesDataType[];\r\n /** Accessibility label */\r\n ariaLabel?: string;\r\n\r\n // Colors and Styling\r\n /** Array of colors for cells */\r\n colors?: string[];\r\n /** Color where data is not available */\r\n noDataColor?: string;\r\n /** Title for the color legend */\r\n colorLegendTitle?: string;\r\n /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n /** Left margin of the graph */\r\n leftMargin?: number;\r\n /** Right margin of the graph */\r\n rightMargin?: number;\r\n /** Top margin of the graph */\r\n topMargin?: number;\r\n /** Bottom margin of the graph */\r\n bottomMargin?: number;\r\n /** Toggles the background to fill the container. This only works if the width of the graph is defined. */\r\n fillContainer?: boolean;\r\n\r\n // Values and Ticks\r\n /** Prefix for values */\r\n prefix?: string;\r\n /** Suffix for values */\r\n suffix?: string;\r\n /** Maximum value for the chart */\r\n truncateBy?: number;\r\n /** Reference values for comparison */\r\n\r\n // Graph Parameters\r\n /** Toggle visibility of labels in the column */\r\n showColumnLabels?: boolean;\r\n /** Toggle visibility of labels in the row */\r\n showRowLabels?: boolean;\r\n /** Scale for the colors in the cell */\r\n scaleType?: ScaleDataType;\r\n /** Toggle visibility of values */\r\n showValues?: boolean;\r\n /** Toggle visibility of color scale. This is only applicable if the data props hae color parameter */\r\n showColorScale?: boolean;\r\n /** Toggle visibility of NA color in the color scale. This is only applicable if the data props hae color parameter and showColorScale prop is true */\r\n showNAColor?: boolean;\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\r\n /** Domain for the colors in the cell. */\r\n colorDomain: number[] | string[];\r\n /** Specifies the number of decimal places to display in the value. */\r\n precision?: number;\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n /** Reset selection on double-click. Only applicable when used in a dashboard context with filters. */\r\n resetSelectionOnDoubleClick?: boolean;\r\n\r\n // Interactions and Callbacks\r\n /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n /** Details displayed on the modal when user clicks of a data point. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n /** Callback for mouse over event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n /** Callback for mouse click event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n\r\n // Configuration and Options\r\n /** Language setting */\r\n language?: Languages;\r\n /** Color theme */\r\n theme?: 'light' | 'dark';\r\n /** Unique ID for the graph */\r\n graphID?: string;\r\n}\r\n\r\nexport function HeatMap(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n colors,\r\n sources,\r\n graphDescription,\r\n showColumnLabels = true,\r\n leftMargin = 100,\r\n rightMargin = 10,\r\n truncateBy = 999,\r\n height,\r\n width,\r\n scaleType,\r\n colorDomain,\r\n footNote,\r\n colorLegendTitle,\r\n padding,\r\n backgroundColor = false,\r\n topMargin = 30,\r\n bottomMargin = 10,\r\n tooltip,\r\n onSeriesMouseOver,\r\n suffix = '',\r\n prefix = '',\r\n showRowLabels = true,\r\n relativeHeight,\r\n showValues,\r\n graphID,\r\n noDataColor = Colors.gray,\r\n showColorScale = true,\r\n onSeriesMouseClick,\r\n graphDownload = false,\r\n dataDownload = false,\r\n fillContainer = true,\r\n language = 'en',\r\n showNAColor = true,\r\n minHeight = 0,\r\n theme = 'light',\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n animate = false,\r\n precision = 2,\r\n } = props;\r\n\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n const [selectedColor, setSelectedColor] = useState<string | undefined>(undefined);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(width || entries[0].target.clientWidth || 620);\r\n setSvgHeight(height || entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n setSvgHeight(graphDiv.current.clientHeight || 480);\r\n setSvgWidth(graphDiv.current.clientWidth || 620);\r\n if (!width) resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, [width, height]);\r\n const scale =\r\n scaleType ||\r\n (typeof colorDomain[0] === 'string'\r\n ? 'categorical'\r\n : colorDomain.length === 2\r\n ? 'linear'\r\n : 'threshold');\r\n\r\n return (\r\n <div\r\n className={`${theme || 'light'} flex ${width ? 'grow-0' : 'grow'} ${\r\n !fillContainer ? 'w-fit' : 'w-full'\r\n }`}\r\n dir={language === 'he' || language === 'ar' ? 'rtl' : undefined}\r\n >\r\n <div\r\n className={cn(\r\n `${\r\n !backgroundColor\r\n ? 'bg-transparent '\r\n : backgroundColor === true\r\n ? 'bg-primary-gray-200 dark:bg-primary-gray-650 '\r\n : ''\r\n }ml-auto mr-auto flex flex-col grow h-inherit ${language || 'en'}`,\r\n !fillContainer ? 'w-fit' : 'w-full',\r\n classNames?.graphContainer,\r\n )}\r\n style={{\r\n ...(styles?.graphContainer || {}),\r\n ...(backgroundColor && backgroundColor !== true ? { backgroundColor } : {}),\r\n }}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={\r\n ariaLabel ||\r\n `${\r\n graphTitle ? `The graph shows ${graphTitle}. ` : ''\r\n }This is a heatmap. ${graphDescription ? ` ${graphDescription}` : ''}`\r\n }\r\n >\r\n <div\r\n className='flex grow'\r\n style={{ padding: backgroundColor ? padding || '1rem' : padding || 0 }}\r\n >\r\n <div className='flex flex-col w-full gap-4 grow justify-between'>\r\n {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv.current : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n <div className='grow flex flex-col justify-center gap-3 w-full'>\r\n {data.length === 0 ? (\r\n <EmptyState />\r\n ) : (\r\n <>\r\n {showColorScale ? (\r\n scale === 'categorical' ? (\r\n <ColorLegendWithMouseOver\r\n width={fillContainer ? undefined : width}\r\n colorLegendTitle={colorLegendTitle}\r\n colors={\r\n colors ||\r\n (typeof colorDomain[0] === 'string'\r\n ? Colors[theme].categoricalColors.colors\r\n : colorDomain.length === 2\r\n ? [\r\n Colors[theme].sequentialColors.neutralColorsx09[0],\r\n Colors[theme].sequentialColors.neutralColorsx09[8],\r\n ]\r\n : Colors[theme].sequentialColors[\r\n `neutralColorsx0${\r\n (colorDomain.length + 1) as 4 | 5 | 6 | 7 | 8 | 9\r\n }`\r\n ])\r\n }\r\n colorDomain={colorDomain.map(d => `${d}`)}\r\n setSelectedColor={setSelectedColor}\r\n showNAColor={showNAColor}\r\n />\r\n ) : scale === 'threshold' ? (\r\n <ThresholdColorLegendWithMouseOver\r\n width={fillContainer ? undefined : width}\r\n colorLegendTitle={colorLegendTitle}\r\n colors={\r\n colors ||\r\n (typeof colorDomain[0] === 'string'\r\n ? Colors[theme].categoricalColors.colors\r\n : colorDomain.length === 2\r\n ? [\r\n Colors[theme].sequentialColors.neutralColorsx09[0],\r\n Colors[theme].sequentialColors.neutralColorsx09[8],\r\n ]\r\n : Colors[theme].sequentialColors[\r\n `neutralColorsx0${\r\n (colorDomain.length + 1) as 4 | 5 | 6 | 7 | 8 | 9\r\n }`\r\n ])\r\n }\r\n colorDomain={colorDomain as number[]}\r\n setSelectedColor={setSelectedColor}\r\n naColor={noDataColor}\r\n showNAColor={showNAColor}\r\n />\r\n ) : (\r\n <LinearColorLegend\r\n width={fillContainer ? undefined : width}\r\n colorLegendTitle={colorLegendTitle}\r\n colors={\r\n colors || [\r\n Colors[theme].sequentialColors.neutralColorsx09[0],\r\n Colors[theme].sequentialColors.neutralColorsx09[8],\r\n ]\r\n }\r\n colorDomain={colorDomain as number[]}\r\n />\r\n )\r\n ) : null}\r\n <div\r\n className='flex grow flex-col justify-center w-full leading-0'\r\n ref={graphDiv}\r\n aria-label='Graph area'\r\n >\r\n {(width || svgWidth) && (height || svgHeight) ? (\r\n <Graph\r\n data={data}\r\n colorDomain={colorDomain}\r\n width={width || svgWidth}\r\n colors={\r\n colors ||\r\n (typeof colorDomain[0] === 'string'\r\n ? Colors[theme].categoricalColors.colors\r\n : colorDomain.length === 2\r\n ? [\r\n Colors[theme].sequentialColors.neutralColorsx09[0],\r\n Colors[theme].sequentialColors.neutralColorsx09[8],\r\n ]\r\n : Colors[theme].sequentialColors[\r\n `neutralColorsx0${\r\n (colorDomain.length + 1) as 4 | 5 | 6 | 7 | 8 | 9\r\n }`\r\n ])\r\n }\r\n noDataColor={noDataColor}\r\n scaleType={scale}\r\n height={Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}\r\n showColumnLabels={showColumnLabels}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n selectedColor={selectedColor}\r\n truncateBy={truncateBy}\r\n showRowLabels={showRowLabels}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n showValues={showValues}\r\n suffix={suffix}\r\n prefix={prefix}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n detailsOnClick={detailsOnClick}\r\n styles={styles}\r\n classNames={classNames}\r\n animate={\r\n animate === true\r\n ? { duration: 0.5, once: true, amount: 0.5 }\r\n : animate || { duration: 0, once: true, amount: 0 }\r\n }\r\n precision={precision}\r\n />\r\n ) : null}\r\n </div>\r\n </>\r\n )}\r\n </div>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n"],"names":["Graph","props","data","showColumnLabels","leftMargin","rightMargin","truncateBy","width","height","topMargin","bottomMargin","tooltip","onSeriesMouseOver","suffix","prefix","showValues","colorDomain","colors","noDataColor","scaleType","showRowLabels","selectedColor","onSeriesMouseClick","resetSelectionOnDoubleClick","detailsOnClick","styles","classNames","animate","precision","svgRef","useRef","isInView","useInView","margin","mouseClickData","setMouseClickData","useState","mouseOverData","setMouseOverData","eventX","setEventX","eventY","setEventY","graphWidth","graphHeight","columns","uniqBy","d","rows","y","scaleBand","barHeight","x","barWidth","colorScale","scaleOrdinal","scaleThreshold","scaleLinear","jsxs","Fragment","motion","jsx","i","XAxesLabels","YAxesLabels","el","checkIfNullOrUndefined","color","event","isEqual","cn","getTextColorBasedOnBgColor","Tooltip","Modal","string2HTML","HeatMap","graphTitle","sources","graphDescription","footNote","colorLegendTitle","padding","backgroundColor","relativeHeight","graphID","Colors","showColorScale","graphDownload","dataDownload","fillContainer","language","showNAColor","minHeight","theme","ariaLabel","svgWidth","setSvgWidth","svgHeight","setSvgHeight","setSelectedColor","graphDiv","graphParentDiv","useEffect","resizeObserver","entries","scale","GraphHeader","EmptyState","ColorLegendWithMouseOver","ThresholdColorLegendWithMouseOver","LinearColorLegend","GraphFooter"],"mappings":"wiCAyDO,SAASA,GAAMC,EAAc,CAClC,KAAM,CACJ,KAAAC,EACA,iBAAAC,EACA,WAAAC,EACA,YAAAC,EACA,WAAAC,EACA,MAAAC,EACA,OAAAC,EACA,UAAAC,EACA,aAAAC,EACA,QAAAC,EACA,kBAAAC,EACA,OAAAC,EACA,OAAAC,EACA,WAAAC,EACA,YAAAC,EACA,OAAAC,EACA,YAAAC,EACA,UAAAC,EACA,cAAAC,EACA,cAAAC,E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IAAA,CAAA,CACN,CAAA,CACF,CAAA,CAEJ,EACCiD,GAAWE,EACVlB,EAAAA,kBAAAA,IAACkD,GAAAA,YAAA,CACC,OAAQ,CAAE,SAAUtF,GAAQ,SAAU,OAAQA,GAAQ,MAAA,EACtD,WAAY,CACV,SAAUC,GAAY,SACtB,OAAQA,GAAY,MAAA,EAEtB,QAAAmD,EACA,SAAAE,EACA,MAAAxE,CAAA,CAAA,EAEA,IAAA,CAAA,CACN,CAAA,CAAA,CACF,CAAA,CACF,CAAA,CAGN"}
|
|
1
|
+
{"version":3,"file":"HeatMap.cjs","sources":["../src/Components/Graphs/HeatMap/Graph.tsx","../src/Components/Graphs/HeatMap/index.tsx"],"sourcesContent":["import isEqual from 'fast-deep-equal';\r\nimport { scaleLinear, scaleBand, scaleOrdinal, scaleThreshold } from 'd3-scale';\r\nimport { useRef, useState } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport { Modal } from '@undp/design-system-react/Modal';\r\nimport { motion, useInView } from 'motion/react';\r\n\r\nimport {\r\n AnimateDataType,\r\n ClassNameObject,\r\n HeatMapDataType,\r\n ScaleDataType,\r\n StyleObject,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { getTextColorBasedOnBgColor } from '@/Utils/getTextColorBasedOnBgColor';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { string2HTML } from '@/Utils/string2HTML';\r\nimport { XAxesLabels } from '@/Components/Elements/Axes/XAxesLabels';\r\nimport { YAxesLabels } from '@/Components/Elements/Axes/YAxesLabels';\r\nimport { uniqBy } from '@/Utils/uniqBy';\r\n\r\ninterface Props {\r\n data: HeatMapDataType[];\r\n colorDomain: string[] | number[];\r\n colors: string[];\r\n noDataColor: string;\r\n scaleType: ScaleDataType;\r\n showColumnLabels: boolean;\r\n leftMargin: number;\r\n truncateBy: number;\r\n width: number;\r\n height: number;\r\n rightMargin: number;\r\n topMargin: number;\r\n showRowLabels: boolean;\r\n bottomMargin: number;\r\n suffix: string;\r\n prefix: string;\r\n showValues?: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n selectedColor?: string;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n resetSelectionOnDoubleClick: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n animate: AnimateDataType;\r\n precision: number;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n showColumnLabels,\r\n leftMargin,\r\n rightMargin,\r\n truncateBy,\r\n width,\r\n height,\r\n topMargin,\r\n bottomMargin,\r\n tooltip,\r\n onSeriesMouseOver,\r\n suffix,\r\n prefix,\r\n showValues,\r\n colorDomain,\r\n colors,\r\n noDataColor,\r\n scaleType,\r\n showRowLabels,\r\n selectedColor,\r\n onSeriesMouseClick,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n animate,\r\n precision,\r\n } = props;\r\n const svgRef = useRef(null);\r\n const isInView = useInView(svgRef, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n const margin = {\r\n top: topMargin,\r\n bottom: bottomMargin,\r\n left: leftMargin,\r\n right: rightMargin,\r\n };\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n const [mouseOverData, setMouseOverData] = useState<HeatMapDataType | undefined>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n const graphWidth = width - margin.left - margin.right;\r\n const graphHeight = height - margin.top - margin.bottom;\r\n const columns = uniqBy(data, 'column', true) as string[];\r\n const rows = uniqBy(data, 'row', true) as string[];\r\n const y = scaleBand().domain(rows).range([0, graphHeight]);\r\n const barHeight = y.bandwidth();\r\n const x = scaleBand().domain(columns).range([0, graphWidth]);\r\n const barWidth = x.bandwidth();\r\n const colorScale =\r\n scaleType === 'categorical'\r\n ? scaleOrdinal<number | string, string>().domain(colorDomain).range(colors)\r\n : scaleType === 'threshold'\r\n ? scaleThreshold<number, string>()\r\n .domain(colorDomain as number[])\r\n .range(colors)\r\n : scaleLinear<string, string>()\r\n .domain(colorDomain as number[])\r\n .range(colors);\r\n return (\r\n <>\r\n <motion.svg\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n viewBox={`0 0 ${width} ${height}`}\r\n style={{ marginLeft: 'auto', marginRight: 'auto' }}\r\n direction='ltr'\r\n ref={svgRef}\r\n >\r\n <g transform={`translate(${margin.left},${0})`}>\r\n {showColumnLabels\r\n ? columns.map((d, i) => (\r\n <XAxesLabels\r\n key={i}\r\n y={0}\r\n x={x(d) as number}\r\n width={barWidth}\r\n height={margin.top - 5}\r\n value={\r\n `${d}`.length < truncateBy ? `${d}` : `${`${d}`.substring(0, truncateBy)}...`\r\n }\r\n style={styles?.xAxis?.labels}\r\n className={classNames?.xAxis?.labels}\r\n alignment='bottom'\r\n animate={{ duration: 0, once: true, amount: 0 }}\r\n isInView={isInView}\r\n />\r\n ))\r\n : null}\r\n </g>\r\n <g transform={`translate(${0},${margin.top})`}>\r\n {showRowLabels\r\n ? rows.map((d, i) => (\r\n <YAxesLabels\r\n value={\r\n `${d}`.length < truncateBy ? `${d}` : `${`${d}`.substring(0, truncateBy)}...`\r\n }\r\n key={i}\r\n y={y(d) as number}\r\n x={0}\r\n width={margin.left}\r\n height={barHeight}\r\n alignment='right'\r\n style={styles?.yAxis?.labels}\r\n className={classNames?.yAxis?.labels}\r\n animate={{ duration: 0, once: true, amount: 0 }}\r\n isInView={isInView}\r\n />\r\n ))\r\n : null}\r\n </g>\r\n <g transform={`translate(${margin.left},${margin.top})`}>\r\n {rows.map((d, i) => (\r\n <g key={i} transform={`translate(0,${y(d)})`}>\r\n {columns.map(el => (\r\n <rect\r\n key={`${d}-${el}`}\r\n x={x(el)}\r\n y={0}\r\n width={barWidth}\r\n height={barHeight}\r\n style={{ fill: noDataColor }}\r\n className='stroke-1 stroke-primary-white dark:stroke-primary-gray-700'\r\n />\r\n ))}\r\n </g>\r\n ))}\r\n {data\r\n .filter(d => !checkIfNullOrUndefined(d.value))\r\n .map((d, i) => {\r\n const color = !checkIfNullOrUndefined(d.value)\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n colorScale(d.value as any)\r\n : noDataColor;\r\n return (\r\n <g\r\n key={`${d.column}-${d.row}`}\r\n transform={`translate(${x(d.column)},${y(d.row)})`}\r\n onMouseEnter={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(d);\r\n }}\r\n onClick={() => {\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (isEqual(mouseClickData, d) && resetSelectionOnDoubleClick) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData(d);\r\n onSeriesMouseClick?.(d);\r\n }\r\n }\r\n }}\r\n onMouseMove={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n }}\r\n onMouseLeave={() => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n }}\r\n opacity={selectedColor ? (selectedColor === color ? 1 : 0.3) : 1}\r\n >\r\n <motion.rect\r\n x={0}\r\n y={0}\r\n width={barWidth}\r\n height={barHeight}\r\n className='stroke-1 stroke-primary-white dark:stroke-primary-gray-700'\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { fill: color, opacity: 0 },\r\n whileInView: {\r\n fill: color,\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n {showValues && !checkIfNullOrUndefined(d.value) ? (\r\n <motion.g\r\n variants={{\r\n initial: { opacity: 0 },\r\n whileInView: { opacity: 1, transition: { duration: animate.duration } },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n >\r\n <foreignObject key={i} y={0} x={0} width={barWidth} height={barHeight}>\r\n <div className='flex flex-col justify-center items-center h-inherit p-1'>\r\n <p\r\n className={cn(\r\n 'text-xs text-center m-0 leading-[1.25] graph-value',\r\n classNames?.graphObjectValues,\r\n )}\r\n style={{\r\n color: getTextColorBasedOnBgColor(color),\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n >\r\n {numberFormattingFunction(d.value, 'NA', precision, prefix, suffix)}\r\n </p>\r\n </div>\r\n </foreignObject>\r\n </motion.g>\r\n ) : null}\r\n </g>\r\n );\r\n })}\r\n {mouseOverData ? (\r\n <rect\r\n x={x(mouseOverData.column)}\r\n y={y(mouseOverData.row)}\r\n width={barWidth}\r\n height={barHeight}\r\n style={{\r\n fill: 'none',\r\n fillOpacity: 0,\r\n strokeWidth: 1.5,\r\n }}\r\n className='stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n />\r\n ) : null}\r\n </g>\r\n </motion.svg>\r\n {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n {detailsOnClick && mouseClickData !== undefined ? (\r\n <Modal\r\n open={mouseClickData !== undefined}\r\n onClose={() => {\r\n setMouseClickData(undefined);\r\n }}\r\n >\r\n <div\r\n className='graph-modal-content m-0'\r\n dangerouslySetInnerHTML={\r\n typeof detailsOnClick === 'string'\r\n ? { __html: string2HTML(detailsOnClick, mouseClickData) }\r\n : undefined\r\n }\r\n >\r\n {typeof detailsOnClick === 'function' ? detailsOnClick(mouseClickData) : null}\r\n </div>\r\n </Modal>\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { useState, useRef, useEffect } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport {\r\n HeatMapDataType,\r\n Languages,\r\n ScaleDataType,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n AnimateDataType,\r\n} from '@/Types';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { ColorLegendWithMouseOver } from '@/Components/Elements/ColorLegendWithMouseOver';\r\nimport { LinearColorLegend } from '@/Components/Elements/LinearColorLegend';\r\nimport { ThresholdColorLegendWithMouseOver } from '@/Components/Elements/ThresholdColorLegendWithMouseOver';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { EmptyState } from '@/Components/Elements/EmptyState';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: HeatMapDataType[];\r\n\r\n // Titles, Labels, and Sources\r\n /** Title of the graph */\r\n graphTitle?: string | React.ReactNode;\r\n /** Description of the graph */\r\n graphDescription?: string | React.ReactNode;\r\n /** Footnote for the graph */\r\n footNote?: string | React.ReactNode;\r\n /** Source data for the graph */\r\n sources?: SourcesDataType[];\r\n /** Accessibility label */\r\n ariaLabel?: string;\r\n\r\n // Colors and Styling\r\n /** Array of colors for cells */\r\n colors?: string[];\r\n /** Color where data is not available */\r\n noDataColor?: string;\r\n /** Title for the color legend */\r\n colorLegendTitle?: string;\r\n /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n /** Left margin of the graph */\r\n leftMargin?: number;\r\n /** Right margin of the graph */\r\n rightMargin?: number;\r\n /** Top margin of the graph */\r\n topMargin?: number;\r\n /** Bottom margin of the graph */\r\n bottomMargin?: number;\r\n /** Toggles the background to fill the container. This only works if the width of the graph is defined. */\r\n fillContainer?: boolean;\r\n\r\n // Values and Ticks\r\n /** Prefix for values */\r\n prefix?: string;\r\n /** Suffix for values */\r\n suffix?: string;\r\n /** Maximum value for the chart */\r\n truncateBy?: number;\r\n /** Reference values for comparison */\r\n\r\n // Graph Parameters\r\n /** Toggle visibility of labels in the column */\r\n showColumnLabels?: boolean;\r\n /** Toggle visibility of labels in the row */\r\n showRowLabels?: boolean;\r\n /** Scale for the colors in the cell */\r\n scaleType?: ScaleDataType;\r\n /** Toggle visibility of values */\r\n showValues?: boolean;\r\n /** Toggle visibility of color scale. This is only applicable if the data props hae color parameter */\r\n showColorScale?: boolean;\r\n /** Toggle visibility of NA color in the color scale. This is only applicable if the data props hae color parameter and showColorScale prop is true */\r\n showNAColor?: boolean;\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\r\n /** Domain for the colors in the cell. */\r\n colorDomain: number[] | string[];\r\n /** Specifies the number of decimal places to display in the value. */\r\n precision?: number;\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n /** Reset selection on double-click. Only applicable when used in a dashboard context with filters. */\r\n resetSelectionOnDoubleClick?: boolean;\r\n\r\n // Interactions and Callbacks\r\n /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n /** Details displayed on the modal when user clicks of a data point. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n /** Callback for mouse over event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n /** Callback for mouse click event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n\r\n // Configuration and Options\r\n /** Language setting */\r\n language?: Languages;\r\n /** Color theme */\r\n theme?: 'light' | 'dark';\r\n /** Unique ID for the graph */\r\n graphID?: string;\r\n}\r\n\r\nexport function HeatMap(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n colors,\r\n sources,\r\n graphDescription,\r\n showColumnLabels = true,\r\n leftMargin = 100,\r\n rightMargin = 10,\r\n truncateBy = 999,\r\n height,\r\n width,\r\n scaleType,\r\n colorDomain,\r\n footNote,\r\n colorLegendTitle,\r\n padding,\r\n backgroundColor = false,\r\n topMargin = 30,\r\n bottomMargin = 10,\r\n tooltip,\r\n onSeriesMouseOver,\r\n suffix = '',\r\n prefix = '',\r\n showRowLabels = true,\r\n relativeHeight,\r\n showValues,\r\n graphID,\r\n noDataColor = Colors.gray,\r\n showColorScale = true,\r\n onSeriesMouseClick,\r\n graphDownload = false,\r\n dataDownload = false,\r\n fillContainer = true,\r\n language = 'en',\r\n showNAColor = true,\r\n minHeight = 0,\r\n theme = 'light',\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n animate = false,\r\n precision = 2,\r\n } = props;\r\n\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n const [selectedColor, setSelectedColor] = useState<string | undefined>(undefined);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(width || entries[0].target.clientWidth || 620);\r\n setSvgHeight(height || entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n setSvgHeight(graphDiv.current.clientHeight || 480);\r\n setSvgWidth(graphDiv.current.clientWidth || 620);\r\n if (!width) resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, [width, height]);\r\n const scale =\r\n scaleType ||\r\n (typeof colorDomain[0] === 'string'\r\n ? 'categorical'\r\n : colorDomain.length === 2\r\n ? 'linear'\r\n : 'threshold');\r\n\r\n return (\r\n <div\r\n className={`${theme || 'light'} flex ${width ? 'grow-0' : 'grow'} ${\r\n !fillContainer ? 'w-fit' : 'w-full'\r\n }`}\r\n dir={language === 'he' || language === 'ar' ? 'rtl' : undefined}\r\n >\r\n <div\r\n className={cn(\r\n `${\r\n !backgroundColor\r\n ? 'bg-transparent '\r\n : backgroundColor === true\r\n ? 'bg-primary-gray-200 dark:bg-primary-gray-650 '\r\n : ''\r\n }ml-auto mr-auto flex flex-col grow h-inherit ${language || 'en'}`,\r\n !fillContainer ? 'w-fit' : 'w-full',\r\n classNames?.graphContainer,\r\n )}\r\n style={{\r\n ...(styles?.graphContainer || {}),\r\n ...(backgroundColor && backgroundColor !== true ? { backgroundColor } : {}),\r\n }}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={\r\n ariaLabel ||\r\n `${\r\n graphTitle ? `The graph shows ${graphTitle}. ` : ''\r\n }This is a heatmap. ${graphDescription ? ` ${graphDescription}` : ''}`\r\n }\r\n >\r\n <div\r\n className='flex grow'\r\n style={{ padding: backgroundColor ? padding || '1rem' : padding || 0 }}\r\n >\r\n <div className='flex flex-col w-full gap-4 grow justify-between'>\r\n {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv.current : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n <div className='grow flex flex-col justify-center gap-3 w-full'>\r\n {data.length === 0 ? (\r\n <EmptyState />\r\n ) : (\r\n <>\r\n {showColorScale ? (\r\n scale === 'categorical' ? (\r\n <ColorLegendWithMouseOver\r\n width={fillContainer ? undefined : width}\r\n colorLegendTitle={colorLegendTitle}\r\n colors={\r\n colors ||\r\n (typeof colorDomain[0] === 'string'\r\n ? Colors[theme].categoricalColors.colors\r\n : colorDomain.length === 2\r\n ? [\r\n Colors[theme].sequentialColors.neutralColorsx09[0],\r\n Colors[theme].sequentialColors.neutralColorsx09[8],\r\n ]\r\n : Colors[theme].sequentialColors[\r\n `neutralColorsx0${\r\n (colorDomain.length + 1) as 4 | 5 | 6 | 7 | 8 | 9\r\n }`\r\n ])\r\n }\r\n colorDomain={colorDomain.map(d => `${d}`)}\r\n setSelectedColor={setSelectedColor}\r\n showNAColor={showNAColor}\r\n />\r\n ) : scale === 'threshold' ? (\r\n <ThresholdColorLegendWithMouseOver\r\n width={fillContainer ? undefined : width}\r\n colorLegendTitle={colorLegendTitle}\r\n colors={\r\n colors ||\r\n (typeof colorDomain[0] === 'string'\r\n ? Colors[theme].categoricalColors.colors\r\n : colorDomain.length === 2\r\n ? [\r\n Colors[theme].sequentialColors.neutralColorsx09[0],\r\n Colors[theme].sequentialColors.neutralColorsx09[8],\r\n ]\r\n : Colors[theme].sequentialColors[\r\n `neutralColorsx0${\r\n (colorDomain.length + 1) as 4 | 5 | 6 | 7 | 8 | 9\r\n }`\r\n ])\r\n }\r\n colorDomain={colorDomain as number[]}\r\n setSelectedColor={setSelectedColor}\r\n naColor={noDataColor}\r\n showNAColor={showNAColor}\r\n />\r\n ) : (\r\n <LinearColorLegend\r\n width={fillContainer ? undefined : width}\r\n colorLegendTitle={colorLegendTitle}\r\n colors={\r\n colors || [\r\n Colors[theme].sequentialColors.neutralColorsx09[0],\r\n Colors[theme].sequentialColors.neutralColorsx09[8],\r\n ]\r\n }\r\n colorDomain={colorDomain as number[]}\r\n />\r\n )\r\n ) : null}\r\n <div\r\n className='flex grow flex-col justify-center w-full leading-0'\r\n ref={graphDiv}\r\n aria-label='Graph area'\r\n >\r\n {(width || svgWidth) && (height || svgHeight) ? (\r\n <Graph\r\n data={data}\r\n colorDomain={colorDomain}\r\n width={width || svgWidth}\r\n colors={\r\n colors ||\r\n (typeof colorDomain[0] === 'string'\r\n ? Colors[theme].categoricalColors.colors\r\n : colorDomain.length === 2\r\n ? [\r\n Colors[theme].sequentialColors.neutralColorsx09[0],\r\n Colors[theme].sequentialColors.neutralColorsx09[8],\r\n ]\r\n : Colors[theme].sequentialColors[\r\n `neutralColorsx0${\r\n (colorDomain.length + 1) as 4 | 5 | 6 | 7 | 8 | 9\r\n }`\r\n ])\r\n }\r\n noDataColor={noDataColor}\r\n scaleType={scale}\r\n height={Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}\r\n showColumnLabels={showColumnLabels}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n selectedColor={selectedColor}\r\n truncateBy={truncateBy}\r\n showRowLabels={showRowLabels}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n showValues={showValues}\r\n suffix={suffix}\r\n prefix={prefix}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n detailsOnClick={detailsOnClick}\r\n styles={styles}\r\n classNames={classNames}\r\n animate={\r\n animate === true\r\n ? { duration: 0.5, once: true, amount: 0.5 }\r\n : animate || { duration: 0, once: true, amount: 0 }\r\n }\r\n precision={precision}\r\n />\r\n ) : null}\r\n </div>\r\n </>\r\n )}\r\n </div>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n"],"names":["Graph","props","data","showColumnLabels","leftMargin","rightMargin","truncateBy","width","height","topMargin","bottomMargin","tooltip","onSeriesMouseOver","suffix","prefix","showValues","colorDomain","colors","noDataColor","scaleType","showRowLabels","selectedColor","onSeriesMouseClick","resetSelectionOnDoubleClick","detailsOnClick","styles","classNames","animate","precision","svgRef","useRef","isInView","useInView","margin","mouseClickData","setMouseClickData","useState","mouseOverData","setMouseOverData","eventX","setEventX","eventY","setEventY","graphWidth","graphHeight","columns","uniqBy","rows","y","scaleBand","barHeight","x","barWidth","colorScale","scaleOrdinal","scaleThreshold","scaleLinear","jsxs","Fragment","motion","jsx","d","i","XAxesLabels","YAxesLabels","el","checkIfNullOrUndefined","color","event","isEqual","cn","getTextColorBasedOnBgColor","Tooltip","Modal","string2HTML","HeatMap","graphTitle","sources","graphDescription","footNote","colorLegendTitle","padding","backgroundColor","relativeHeight","graphID","Colors","showColorScale","graphDownload","dataDownload","fillContainer","language","showNAColor","minHeight","theme","ariaLabel","svgWidth","setSvgWidth","svgHeight","setSvgHeight","setSelectedColor","graphDiv","graphParentDiv","useEffect","resizeObserver","entries","scale","GraphHeader","EmptyState","ColorLegendWithMouseOver","ThresholdColorLegendWithMouseOver","LinearColorLegend","GraphFooter"],"mappings":"yiCAyDO,SAASA,GAAMC,EAAc,CAClC,KAAM,CACJ,KAAAC,EACA,iBAAAC,EACA,WAAAC,EACA,YAAAC,EACA,WAAAC,EACA,MAAAC,EACA,OAAAC,EACA,UAAAC,EACA,aAAAC,EACA,QAAAC,EACA,kBAAAC,EACA,OAAAC,EACA,OAAAC,EACA,WAAAC,EACA,YAAAC,EACA,OAAAC,EACA,YAAAC,EACA,UAAAC,EACA,cAAAC,EACA,cAAAC,EACA,mBAAAC,EACA,4BAAAC,EACA,eAAAC,EACA,OAAAC,EACA,WAAAC,EACA,QAAAC,EACA,UAAAC,CAAA,EACE3B,EACE4B,EAASC,EAAAA,OAAO,IAAI,EACpBC,EAAWC,GAAAA,UAAUH,EAAQ,CACjC,KAAMF,EAAQ,KACd,OAAQA,EAAQ,MAAA,CACjB,EACKM,EAAS,CACb,IAAKxB,EACL,OAAQC,EACR,KAAMN,EACN,MAAOC,CAAA,EAGH,CAAC6B,EAAgBC,CAAiB,EAAIC,EAAAA,SAAc,MAAS,EAC7D,CAACC,EAAeC,CAAgB,EAAIF,EAAAA,SAAsC,MAAS,EACnF,CAACG,EAAQC,CAAS,EAAIJ,EAAAA,SAA6B,MAAS,EAC5D,CAACK,EAAQC,CAAS,EAAIN,EAAAA,SAA6B,MAAS,EAC5DO,GAAapC,EAAQ0B,EAAO,KAAOA,EAAO,MAC1CW,GAAcpC,EAASyB,EAAO,IAAMA,EAAO,OAC3CY,EAAUC,GAAAA,OAAO5C,EAAM,SAAU,EAAI,EACrC6C,EAAOD,GAAAA,OAAO5C,EAAM,MAAO,EAAI,EAC/B8C,EAAIC,QAAA,EAAY,OAAOF,CAAI,EAAE,MAAM,CAAC,EAAGH,EAAW,CAAC,EACnDM,EAAYF,EAAE,UAAA,EACdG,EAAIF,QAAA,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