@undp/data-viz 1.4.1 → 1.4.2
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.js +21 -21
- package/dist/BarGraph.cjs +1 -1
- package/dist/BarGraph.js +7 -7
- package/dist/BeeSwarmChart.cjs +1 -1
- package/dist/BeeSwarmChart.js +2 -2
- package/dist/BiVariateChoroplethMap.cjs +1 -1
- package/dist/BiVariateChoroplethMap.js +5 -5
- package/dist/BulletChart.cjs +1 -1
- package/dist/BulletChart.js +14 -14
- package/dist/ButterflyChart.cjs +1 -1
- package/dist/ButterflyChart.js +9 -9
- package/dist/ChoroplethMap.cjs +1 -1
- package/dist/ChoroplethMap.js +9 -9
- package/dist/CirclePackingGraph.cjs +1 -1
- package/dist/CirclePackingGraph.js +1 -1
- package/dist/CopyTextButton.cjs +7 -7
- package/dist/CopyTextButton.cjs.map +1 -1
- package/dist/CopyTextButton.js +4 -4
- package/dist/CopyTextButton.js.map +1 -1
- package/dist/DataCards.cjs +9 -9
- package/dist/DataCards.cjs.map +1 -1
- package/dist/DataCards.js +93 -93
- package/dist/DataCards.js.map +1 -1
- package/dist/DifferenceLineChart.cjs +1 -1
- package/dist/DifferenceLineChart.js +18 -18
- package/dist/DonutChart.cjs +1 -1
- package/dist/DonutChart.js +1 -1
- package/dist/DotDensityMap.cjs +1 -1
- package/dist/DotDensityMap.js +8 -8
- package/dist/{DropdownSelect-0I2QxaVy.cjs → DropdownSelect-BmE5JaeE.cjs} +6 -6
- package/dist/{DropdownSelect-0I2QxaVy.cjs.map → DropdownSelect-BmE5JaeE.cjs.map} +1 -1
- package/dist/{DropdownSelect-CDC9lEqU.js → DropdownSelect-CeHog_ih.js} +4 -4
- package/dist/{DropdownSelect-CDC9lEqU.js.map → DropdownSelect-CeHog_ih.js.map} +1 -1
- package/dist/DualAxisLineChart.cjs +1 -1
- package/dist/DualAxisLineChart.js +15 -15
- package/dist/DumbbellChart.cjs +1 -1
- package/dist/DumbbellChart.js +13 -13
- package/dist/GeoHubMap.cjs +1 -1
- package/dist/GeoHubMap.js +2 -2
- package/dist/GeoHubMapWithLayerSelection.cjs +1 -1
- package/dist/GeoHubMapWithLayerSelection.js +2 -2
- package/dist/{GraphEl-B6SoGRFW.cjs → GraphEl-B5gAX1IQ.cjs} +2 -2
- package/dist/{GraphEl-B6SoGRFW.cjs.map → GraphEl-B5gAX1IQ.cjs.map} +1 -1
- package/dist/{GraphEl-Cw2tDUb3.js → GraphEl-BdIyscdt.js} +3 -3
- package/dist/{GraphEl-Cw2tDUb3.js.map → GraphEl-BdIyscdt.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.js +10 -10
- package/dist/Histogram.cjs +1 -1
- package/dist/Histogram.js +1 -1
- package/dist/LineChartWithConfidenceInterval.cjs +1 -1
- package/dist/LineChartWithConfidenceInterval.js +21 -21
- package/dist/{Modal-CUU6ZK3U.js → Modal-DVVwpKhP.js} +2 -2
- package/dist/{Modal-CUU6ZK3U.js.map → Modal-DVVwpKhP.js.map} +1 -1
- package/dist/{Modal-C_dl0EtQ.cjs → Modal-tXZlLE5s.cjs} +4 -4
- package/dist/{Modal-C_dl0EtQ.cjs.map → Modal-tXZlLE5s.cjs.map} +1 -1
- package/dist/MultiGraphDashboard.cjs +1 -1
- package/dist/MultiGraphDashboard.js +3 -3
- package/dist/MultiGraphDashboardFromConfig.cjs +1 -1
- package/dist/MultiGraphDashboardFromConfig.js +1 -1
- package/dist/MultiGraphDashboardWideToLongFormat.cjs +1 -1
- package/dist/MultiGraphDashboardWideToLongFormat.js +3 -3
- package/dist/MultiGraphDashboardWideToLongFormatFromConfig.cjs +1 -1
- package/dist/MultiGraphDashboardWideToLongFormatFromConfig.js +1 -1
- package/dist/MultiLineAltChart.cjs +1 -1
- package/dist/MultiLineAltChart.js +21 -21
- package/dist/MultiLineChart.cjs +1 -1
- package/dist/MultiLineChart.js +19 -19
- package/dist/ParetoChart.cjs +1 -1
- package/dist/ParetoChart.js +12 -12
- package/dist/PerformanceIntensiveMultiGraphDashboard.cjs +1 -1
- package/dist/PerformanceIntensiveMultiGraphDashboard.js +3 -3
- package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.cjs +1 -1
- package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.js +1 -1
- package/dist/PerformanceIntensiveScrollStory.cjs +1 -1
- package/dist/PerformanceIntensiveScrollStory.js +2 -2
- package/dist/RadarChart.cjs +1 -1
- package/dist/RadarChart.js +8 -8
- package/dist/{ReferenceLine-CuFMk0cI.cjs → ReferenceLine-CFVBBN__.cjs} +2 -2
- package/dist/{ReferenceLine-CuFMk0cI.cjs.map → ReferenceLine-CFVBBN__.cjs.map} +1 -1
- package/dist/{ReferenceLine-C1GpoG9d.js → ReferenceLine-CfAW3vKJ.js} +2 -2
- package/dist/{ReferenceLine-C1GpoG9d.js.map → ReferenceLine-CfAW3vKJ.js.map} +1 -1
- package/dist/{RegressionLine-BFwDCTUU.js → RegressionLine-mH7UKOPi.js} +3 -3
- package/dist/{RegressionLine-BFwDCTUU.js.map → RegressionLine-mH7UKOPi.js.map} +1 -1
- package/dist/{RegressionLine-7_rKTHN_.cjs → RegressionLine-xKdiJ8sw.cjs} +2 -2
- package/dist/{RegressionLine-7_rKTHN_.cjs.map → RegressionLine-xKdiJ8sw.cjs.map} +1 -1
- package/dist/SankeyChart.cjs +1 -1
- package/dist/SankeyChart.js +4 -4
- package/dist/ScatterPlot.cjs +1 -1
- package/dist/ScatterPlot.js +13 -13
- package/dist/ScrollStory.cjs +1 -1
- package/dist/ScrollStory.js +2 -2
- package/dist/SimpleLineChart.cjs +1 -1
- package/dist/SimpleLineChart.js +20 -20
- 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.js +7 -7
- package/dist/StripChart.cjs +1 -1
- package/dist/StripChart.js +9 -9
- package/dist/ThreeDGlobe.cjs +1 -1
- package/dist/ThreeDGlobe.js +2 -2
- package/dist/TreeMapGraph.cjs +1 -1
- package/dist/TreeMapGraph.js +4 -4
- package/dist/UnitChart.cjs +1 -1
- package/dist/UnitChart.js +3 -3
- package/dist/{XAxesLabels-DQFo_z2R.js → XAxesLabels-CaV2q-6H.js} +2 -2
- package/dist/{XAxesLabels-DQFo_z2R.js.map → XAxesLabels-CaV2q-6H.js.map} +1 -1
- package/dist/{XAxesLabels-CJMQbfVy.cjs → XAxesLabels-OjBNl_lS.cjs} +2 -2
- package/dist/{XAxesLabels-CJMQbfVy.cjs.map → XAxesLabels-OjBNl_lS.cjs.map} +1 -1
- package/dist/{YAxesLabels-H5-002X5.js → YAxesLabels-CPGZjmZJ.js} +2 -2
- package/dist/{YAxesLabels-H5-002X5.js.map → YAxesLabels-CPGZjmZJ.js.map} +1 -1
- package/dist/{YAxesLabels-BXLTX7AI.cjs → YAxesLabels-D8IydyZj.cjs} +2 -2
- package/dist/{YAxesLabels-BXLTX7AI.cjs.map → YAxesLabels-D8IydyZj.cjs.map} +1 -1
- package/dist/{checkIfMultiple-Do4kADNr.cjs → checkIfMultiple-BXbHUCWM.cjs} +6 -6
- package/dist/{checkIfMultiple-Do4kADNr.cjs.map → checkIfMultiple-BXbHUCWM.cjs.map} +1 -1
- package/dist/{checkIfMultiple-CYp3vADF.js → checkIfMultiple-ChTJk2Tk.js} +5 -5
- package/dist/{checkIfMultiple-CYp3vADF.js.map → checkIfMultiple-ChTJk2Tk.js.map} +1 -1
- package/dist/{customArea-CaxScFmW.js → customArea-B-dWU0zZ.js} +2 -2
- package/dist/{customArea-CaxScFmW.js.map → customArea-B-dWU0zZ.js.map} +1 -1
- package/dist/{customArea-BYNyxAkm.cjs → customArea-CK768gCn.cjs} +2 -2
- package/dist/{customArea-BYNyxAkm.cjs.map → customArea-CK768gCn.cjs.map} +1 -1
- package/dist/{fetchAndParseData-Bcmr659B.js → fetchAndParseData-4gsYTy6_.js} +3 -3
- package/dist/fetchAndParseData-4gsYTy6_.js.map +1 -0
- package/dist/{fetchAndParseData-DmgQtB9n.cjs → fetchAndParseData-CQyVGCul.cjs} +6 -6
- package/dist/fetchAndParseData-CQyVGCul.cjs.map +1 -0
- package/dist/fetchAndParseData.cjs +1 -1
- package/dist/fetchAndParseData.js +1 -1
- package/dist/index-BW8iNx7E.cjs +10 -0
- package/dist/index-BW8iNx7E.cjs.map +1 -0
- package/dist/index-CNvov0eg.js +122 -0
- package/dist/index-CNvov0eg.js.map +1 -0
- package/dist/{index-D_n8aamX.cjs → index-CZLvTu6p.cjs} +2 -2
- package/dist/{index-D_n8aamX.cjs.map → index-CZLvTu6p.cjs.map} +1 -1
- package/dist/{index-n_RI8T0n.js → index-Cdcfp4nk.js} +2 -2
- package/dist/{index-n_RI8T0n.js.map → index-Cdcfp4nk.js.map} +1 -1
- package/dist/{index-BVnYktl4.js → index-DGAaLNu9.js} +2 -2
- package/dist/{index-BVnYktl4.js.map → index-DGAaLNu9.js.map} +1 -1
- package/dist/{index-CylX-pWB.cjs → index-DNj994Pv.cjs} +2 -2
- package/dist/{index-CylX-pWB.cjs.map → index-DNj994Pv.cjs.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +3 -3
- package/dist/proxy-BHRoeZgd.cjs +2 -0
- package/dist/proxy-BHRoeZgd.cjs.map +1 -0
- package/dist/{proxy-DJxJg1kD.js → proxy-CkpFesk1.js} +4123 -4075
- package/dist/proxy-CkpFesk1.js.map +1 -0
- package/dist/style.css +1 -1
- package/dist/transformData.cjs +1 -1
- package/dist/transformData.js +2 -2
- package/dist/{transformDataForGraphFromFile-D9G3ToQf.cjs → transformDataForGraphFromFile-B1A0AS-Z.cjs} +2 -2
- package/dist/{transformDataForGraphFromFile-D9G3ToQf.cjs.map → transformDataForGraphFromFile-B1A0AS-Z.cjs.map} +1 -1
- package/dist/{transformDataForGraphFromFile-CA0rw80A.js → transformDataForGraphFromFile-BCjsizvb.js} +2 -2
- package/dist/{transformDataForGraphFromFile-CA0rw80A.js.map → transformDataForGraphFromFile-BCjsizvb.js.map} +1 -1
- package/dist/{use-in-view-BCmzDU2O.cjs → use-in-view-sQJZ_xDO.cjs} +2 -2
- package/dist/use-in-view-sQJZ_xDO.cjs.map +1 -0
- package/dist/{use-in-view-BAHrBy6b.js → use-in-view-yS6jzJAp.js} +2 -2
- package/dist/use-in-view-yS6jzJAp.js.map +1 -0
- package/dist/x-BBpi7a_7-Dz2vKSfu.cjs +27 -0
- package/dist/x-BBpi7a_7-Dz2vKSfu.cjs.map +1 -0
- package/dist/x-BBpi7a_7-WVdj1j6r.js +106 -0
- package/dist/x-BBpi7a_7-WVdj1j6r.js.map +1 -0
- package/package.json +50 -51
- package/dist/fetchAndParseData-Bcmr659B.js.map +0 -1
- package/dist/fetchAndParseData-DmgQtB9n.cjs.map +0 -1
- package/dist/index-BxAUvrua.js +0 -120
- package/dist/index-BxAUvrua.js.map +0 -1
- package/dist/index-DVOJ7vxH.cjs +0 -10
- package/dist/index-DVOJ7vxH.cjs.map +0 -1
- package/dist/proxy-DJxJg1kD.js.map +0 -1
- package/dist/proxy-PQd2AItT.cjs +0 -2
- package/dist/proxy-PQd2AItT.cjs.map +0 -1
- package/dist/use-in-view-BAHrBy6b.js.map +0 -1
- package/dist/use-in-view-BCmzDU2O.cjs.map +0 -1
- package/dist/x-CnsEH4Ox-CGGXQl4M.cjs +0 -27
- package/dist/x-CnsEH4Ox-CGGXQl4M.cjs.map +0 -1
- package/dist/x-CnsEH4Ox-DDvAJndW.js +0 -101
- package/dist/x-CnsEH4Ox-DDvAJndW.js.map +0 -1
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-Ds0uHjK9.cjs"),N=require("./index-B0rbzOoC.cjs"),h=require("./checkIfMultiple-Do4kADNr.cjs"),ae=require("./Spinner-DA6Z5E4n.cjs"),f=require("./DropdownSelect-0I2QxaVy.cjs"),te=require("./GraphEl-B6SoGRFW.cjs"),v=require("./fetchAndParseData-DmgQtB9n.cjs"),le=require("./Colors.cjs"),W=require("./transformDataForAggregation-Du-Hei-W.cjs"),Z=require("./getUniqValue-CHqgSss5.cjs"),re=require("./GraphHeader.cjs"),oe=require("./GraphFooter.cjs"),z=require("./filterData-DN6py7y_.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-Ds0uHjK9.cjs"),N=require("./index-B0rbzOoC.cjs"),h=require("./checkIfMultiple-BXbHUCWM.cjs"),ae=require("./Spinner-DA6Z5E4n.cjs"),f=require("./DropdownSelect-BmE5JaeE.cjs"),te=require("./GraphEl-B5gAX1IQ.cjs"),v=require("./fetchAndParseData-CQyVGCul.cjs"),le=require("./Colors.cjs"),W=require("./transformDataForAggregation-Du-Hei-W.cjs"),Z=require("./getUniqValue-CHqgSss5.cjs"),re=require("./GraphHeader.cjs"),oe=require("./GraphFooter.cjs"),z=require("./filterData-DN6py7y_.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
|
@@ -2,11 +2,11 @@ import { j as o } from "./index-CHPV5EwG-BPSP-7Jg.js";
|
|
|
2
2
|
import { useState as m, useRef as oa, useMemo as q, useEffect as T, useCallback as z } from "react";
|
|
3
3
|
import { i as ra } from "./index-C1rRk_50.js";
|
|
4
4
|
import { f as G } from "./index-UV9hjG_S.js";
|
|
5
|
-
import { f as $, a as B, v as J, c as na, w as ia, G as sa } from "./checkIfMultiple-
|
|
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
|
-
import { Z as x, H as A } from "./DropdownSelect-
|
|
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-
|
|
7
|
+
import { Z as x, H as A } from "./DropdownSelect-CeHog_ih.js";
|
|
8
|
+
import { G as ca } from "./GraphEl-BdIyscdt.js";
|
|
9
|
+
import { f as ua, a as ha, b as ga, c as fa, t as pa } from "./fetchAndParseData-4gsYTy6_.js";
|
|
10
10
|
import { Colors as ma } from "./Colors.js";
|
|
11
11
|
import { a as Ca, t as wa } from "./transformDataForAggregation-CdcwlnNe.js";
|
|
12
12
|
import { g as K } from "./getUniqValue-BtUENB2H.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-CQyVGCul.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-4gsYTy6_.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"),c=require("react"),ue=require("./index-BXns0-ng.cjs"),le=require("./index-CZbIGs8q.cjs"),ce=require("./Modal-C_dl0EtQ.cjs"),xe=require("./numberFormattingFunction-02t-wJta.cjs"),he=require("./Tooltip-n8z5bfav.cjs"),de=require("./getTextColorBasedOnBgColor-nqY-bsM_.cjs"),re=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),ge=require("./string2HTML-D2Avudmb.cjs"),me=require("./XAxesLabels-CJMQbfVy.cjs"),pe=require("./YAxesLabels-BXLTX7AI.cjs"),fe=require("./use-in-view-BCmzDU2O.cjs"),ae=require("./band-CAApY4Pd.cjs"),je=require("./ordinal-BOeNbyae.cjs"),Ce=require("./threshold-DNsSUf8Q.cjs"),ye=require("./linear-BVckp9RD.cjs"),se=require("./proxy-PQd2AItT.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=c.useRef(null),D=fe.useInView(W,{once:v.once,amount:v.amount}),l={top:z,bottom:_,left:O,right:F},[w,T]=c.useState(void 0),[x,M]=c.useState(void 0),[A,b]=c.useState(void 0),[o,B]=c.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(),a=ae.band().domain(h).range([0,ee]),R=a.bandwidth(),P=X==="categorical"?je.ordinal().domain($).range(S):X==="threshold"?Ce.threshold().domain($).range(S):ye.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:a(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:a(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(${a(e.column)},${E(e.row)})`,onMouseEnter:u=>{M(e),B(u.clientY),b(u.clientX),r?.(e)},onClick:()=>{(V||y)&&(ue.isEqual(w,e)&&Q?(T(void 0),V?.(void 0)):(T(e),V?.(e)))},onMouseMove:u=>{M(e),B(u.clientY),b(u.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}`)}),x?t.jsxRuntimeExports.jsx("rect",{x:a(x.column),y:E(x.row),width:R,height:k,style:{fill:"none",fillOpacity:0,strokeWidth:1.5},className:"stroke-primary-gray-700 dark:stroke-primary-gray-300"}):null]})]}),x&&q&&A&&o?t.jsxRuntimeExports.jsx(he.Tooltip,{data:x,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:x=!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,[a,R]=c.useState(0),[P,e]=c.useState(0),[C,g]=c.useState(void 0),u=c.useRef(null),ie=c.useRef(null);c.useEffect(()=>{const n=new ResizeObserver(ne=>{R(r||ne[0].target.clientWidth||620),e(q||ne[0].target.clientHeight||480)});return u.current&&(e(u.current.clientHeight||480),R(u.current.clientWidth||620),r||n.observe(u.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"} ${x?"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"}`,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:x?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:x?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:x?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:u,"aria-label":"Graph area",children:(r||a)&&(q||P)?t.jsxRuntimeExports.jsx($e,{data:m,colorDomain:s,width:r||a,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||a)*j>b?(r||a)*j:b:(r||a)*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 t=require("./index-CHPV5EwG-DDoeWRVt.cjs"),c=require("react"),ue=require("./index-BXns0-ng.cjs"),le=require("./index-CZbIGs8q.cjs"),ce=require("./Modal-tXZlLE5s.cjs"),xe=require("./numberFormattingFunction-02t-wJta.cjs"),he=require("./Tooltip-n8z5bfav.cjs"),de=require("./getTextColorBasedOnBgColor-nqY-bsM_.cjs"),re=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),ge=require("./string2HTML-D2Avudmb.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=c.useRef(null),D=ye.useInView(W,{once:v.once,amount:v.amount}),l={top:z,bottom:_,left:O,right:F},[w,T]=c.useState(void 0),[x,M]=c.useState(void 0),[A,b]=c.useState(void 0),[o,B]=c.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(),a=ae.band().domain(h).range([0,ee]),R=a.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:a(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:a(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(${a(e.column)},${E(e.row)})`,onMouseEnter:u=>{M(e),B(u.clientY),b(u.clientX),r?.(e)},onClick:()=>{(V||y)&&(ue.isEqual(w,e)&&Q?(T(void 0),V?.(void 0)):(T(e),V?.(e)))},onMouseMove:u=>{M(e),B(u.clientY),b(u.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}`)}),x?t.jsxRuntimeExports.jsx("rect",{x:a(x.column),y:E(x.row),width:R,height:k,style:{fill:"none",fillOpacity:0,strokeWidth:1.5},className:"stroke-primary-gray-700 dark:stroke-primary-gray-300"}):null]})]}),x&&q&&A&&o?t.jsxRuntimeExports.jsx(he.Tooltip,{data:x,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:x=!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,[a,R]=c.useState(0),[P,e]=c.useState(0),[C,g]=c.useState(void 0),u=c.useRef(null),ie=c.useRef(null);c.useEffect(()=>{const n=new ResizeObserver(ne=>{R(r||ne[0].target.clientWidth||620),e(q||ne[0].target.clientHeight||480)});return u.current&&(e(u.current.clientHeight||480),R(u.current.clientWidth||620),r||n.observe(u.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"} ${x?"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"}`,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:x?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:x?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:x?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:u,"aria-label":"Graph area",children:(r||a)&&(q||P)?t.jsxRuntimeExports.jsx($e,{data:m,colorDomain:s,width:r||a,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||a)*j>b?(r||a)*j:b:(r||a)*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;
|
|
2
2
|
//# sourceMappingURL=HeatMap.cjs.map
|
package/dist/HeatMap.js
CHANGED
|
@@ -2,20 +2,20 @@ import { j as t, m as me } from "./index-CHPV5EwG-BPSP-7Jg.js";
|
|
|
2
2
|
import { useRef as ae, useState as O, useEffect as ue } from "react";
|
|
3
3
|
import { i as he } from "./index-27yTRcko.js";
|
|
4
4
|
import { u as ne } from "./index-CaAIPGZo.js";
|
|
5
|
-
import { X as ge } from "./Modal-
|
|
5
|
+
import { X as ge } from "./Modal-DVVwpKhP.js";
|
|
6
6
|
import { n as de } from "./numberFormattingFunction-14YCbkN2.js";
|
|
7
7
|
import { T as pe } from "./Tooltip-DyM5snqx.js";
|
|
8
8
|
import { g as fe } from "./getTextColorBasedOnBgColor-B6Nk2WBf.js";
|
|
9
9
|
import { c as re } from "./checkIfNullOrUndefined-DmfiKkNw.js";
|
|
10
10
|
import { s as xe } from "./string2HTML-CWHGfz_d.js";
|
|
11
|
-
import { X as ye } from "./XAxesLabels-
|
|
12
|
-
import { Y as ve } from "./YAxesLabels-
|
|
13
|
-
import { u as we } from "./use-in-view-BAHrBy6b.js";
|
|
11
|
+
import { X as ye } from "./XAxesLabels-CaV2q-6H.js";
|
|
12
|
+
import { Y as ve } from "./YAxesLabels-CPGZjmZJ.js";
|
|
14
13
|
import { b as ce } from "./band-BEjh2CHI.js";
|
|
15
|
-
import { o as
|
|
16
|
-
import { t as
|
|
17
|
-
import { a as
|
|
18
|
-
import {
|
|
14
|
+
import { o as we } from "./ordinal-w9Lu4Stb.js";
|
|
15
|
+
import { t as Ce } from "./threshold-DFfqcDMa.js";
|
|
16
|
+
import { a as be } from "./linear-DUdu7l2G.js";
|
|
17
|
+
import { u as je } from "./use-in-view-yS6jzJAp.js";
|
|
18
|
+
import { m as ie } from "./proxy-CkpFesk1.js";
|
|
19
19
|
import { GraphHeader as $e } from "./GraphHeader.js";
|
|
20
20
|
import { GraphFooter as ke } from "./GraphFooter.js";
|
|
21
21
|
import { ColorLegendWithMouseOver as Me } from "./ColorLegendWithMouseOver.js";
|
|
@@ -52,7 +52,7 @@ function Le(z) {
|
|
|
52
52
|
classNames: x,
|
|
53
53
|
animate: w,
|
|
54
54
|
precision: Z
|
|
55
|
-
} = z, E = ae(null), H =
|
|
55
|
+
} = z, E = ae(null), H = je(E, {
|
|
56
56
|
once: w.once,
|
|
57
57
|
amount: w.amount
|
|
58
58
|
}), s = {
|
|
@@ -60,7 +60,7 @@ function Le(z) {
|
|
|
60
60
|
bottom: U,
|
|
61
61
|
left: S,
|
|
62
62
|
right: B
|
|
63
|
-
}, [C, V] = O(void 0), [m, N] = O(void 0), [R, b] = O(void 0), [o, X] = O(void 0), ee = I - s.left - s.right, te = W - s.top - s.bottom, u = ne(d, (e) => e.column).map((e) => e.column), h = ne(d, (e) => e.row).map((e) => e.row), j = ce().domain(h).range([0, te]), D = j.bandwidth(), n = ce().domain(u).range([0, ee]), $ = n.bandwidth(), P = F === "categorical" ?
|
|
63
|
+
}, [C, V] = O(void 0), [m, N] = O(void 0), [R, b] = O(void 0), [o, X] = O(void 0), ee = I - s.left - s.right, te = W - s.top - s.bottom, u = ne(d, (e) => e.column).map((e) => e.column), h = ne(d, (e) => e.row).map((e) => e.row), j = ce().domain(h).range([0, te]), D = j.bandwidth(), n = ce().domain(u).range([0, ee]), $ = n.bandwidth(), P = F === "categorical" ? we().domain(M).range(q) : F === "threshold" ? Ce().domain(M).range(q) : be().domain(M).range(q);
|
|
64
64
|
return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
65
65
|
/* @__PURE__ */ t.jsxs(
|
|
66
66
|
ie.svg,
|
package/dist/Histogram.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const j=require("./index-CHPV5EwG-DDoeWRVt.cjs"),z=require("react"),_=require("./Spinner-DA6Z5E4n.cjs"),F=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const j=require("./index-CHPV5EwG-DDoeWRVt.cjs"),z=require("react"),_=require("./Spinner-DA6Z5E4n.cjs"),F=require("./index-CZLvTu6p.cjs"),ee=require("./TreeMapGraph.cjs"),re=require("./DonutChart.cjs"),te=require("./BarGraph.cjs"),B=require("./Colors.cjs"),ie=require("./init-DU0ybBc_.cjs"),H=require("./linear-BVckp9RD.cjs");function ne(o,s){let c=0;for(let a of o)a!=null&&(a=+a)>=a&&++c;return c}function oe(o){return o}var ae=Array.prototype,se=ae.slice;function N(o){return()=>o}function le(o,s,c){let a;for(;;){const e=H.tickIncrement(o,s,c);if(e===a||e===0||!isFinite(e))return[o,s];e>0?(o=Math.floor(o/e)*e,s=Math.ceil(s/e)*e):e<0&&(o=Math.ceil(o*e)/e,s=Math.floor(s*e)/e),a=e}}function ue(o){return Math.max(1,Math.ceil(Math.log(ne(o))/Math.LN2)+1)}function ce(){var o=oe,s=F.extent,c=ue;function a(e){Array.isArray(e)||(e=Array.from(e));var r,m=e.length,l,p,g=new Array(m);for(r=0;r<m;++r)g[r]=o(e[r],r,e);var f=s(g),t=f[0],i=f[1],n=c(g,t,i);if(!Array.isArray(n)){const C=i,y=+n;if(s===F.extent&&([t,i]=le(t,i,y)),n=H.ticks(t,i,y),n[0]<=t&&(p=H.tickIncrement(t,i,y)),n[n.length-1]>=i)if(C>=i&&s===F.extent){const h=H.tickIncrement(t,i,y);isFinite(h)&&(h>0?i=(Math.floor(i/h)+1)*h:h<0&&(i=(Math.ceil(i*-h)+1)/-h))}else n.pop()}for(var u=n.length,x=0,d=u;n[x]<=t;)++x;for(;n[d-1]>i;)--d;(x||d<u)&&(n=n.slice(x,d),u=d-x);var M=new Array(u+1),b;for(r=0;r<=u;++r)b=M[r]=[],b.x0=r>0?n[r-1]:t,b.x1=r<u?n[r]:i;if(isFinite(p)){if(p>0)for(r=0;r<m;++r)(l=g[r])!=null&&t<=l&&l<=i&&M[Math.min(u,Math.floor((l-t)/p))].push(e[r]);else if(p<0){for(r=0;r<m;++r)if((l=g[r])!=null&&t<=l&&l<=i){const C=Math.floor((t-l)*p);M[Math.min(u,C+(n[C]<=l))].push(e[r])}}}else for(r=0;r<m;++r)(l=g[r])!=null&&t<=l&&l<=i&&M[ie.bisectRight(n,l,0,u)].push(e[r]);return M}return a.value=function(e){return arguments.length?(o=typeof e=="function"?e:N(e),a):o},a.domain=function(e){return arguments.length?(s=typeof e=="function"?e:N([e[0],e[1]]),a):s},a.thresholds=function(e){return arguments.length?(c=typeof e=="function"?e:N(Array.isArray(e)?se.call(e):e),a):c},a}function he(o){const{data:s,graphTitle:c,sources:a,graphDescription:e,barPadding:r,showValues:m,showTicks:l,leftMargin:p,rightMargin:g,height:f,width:t,footNote:i,colors:n,padding:u,backgroundColor:x,topMargin:d,bottomMargin:M,showLabels:b,relativeHeight:C,tooltip:y,onSeriesMouseOver:h,refValues:W,graphID:S,maxValue:U,onSeriesMouseClick:q,graphDownload:A,dataDownload:E,numberOfBins:O,truncateBy:J,graphType:I,barGraphLayout:K,donutStrokeWidth:Q,sortData:V,language:D,minHeight:L,theme:w="light",maxBarThickness:X,ariaLabel:G,detailsOnClick:R,styles:T,classNames:P,precision:$}=o,[k,Y]=z.useState([]);return z.useEffect(()=>{const Z=ce().thresholds(O||10).value(v=>v.value)(s).map(v=>({label:`${v.x0}-${v.x1}`,size:v.length,data:{options:`${v.x0}-${v.x1}`,frequency:v.length}}));Y(Z)},[s,O]),k.length===0?j.jsxRuntimeExports.jsx("div",{style:{width:`${t}px`,height:`${f}px`,margin:"auto"},children:j.jsxRuntimeExports.jsx("div",{className:"flex m-auto items-center justify-center p-0 leading-none text-base h-40",children:j.jsxRuntimeExports.jsx(_.y,{})})}):I==="circlePacking"?j.jsxRuntimeExports.jsx(F.CirclePackingGraph,{colors:n||B.Colors.graphMainColor,graphTitle:c,graphDescription:e,footNote:i,width:t,height:f,sources:a,leftMargin:p,rightMargin:g,backgroundColor:x,padding:u,topMargin:d,bottomMargin:M,relativeHeight:C,showLabels:b,tooltip:y,onSeriesMouseOver:h,showColorScale:!1,showValues:m,graphID:S,onSeriesMouseClick:q,graphDownload:A,dataDownload:E,data:k,language:D,minHeight:L,theme:w,ariaLabel:G,detailsOnClick:R,styles:T,classNames:P,precision:$}):I==="treeMap"?j.jsxRuntimeExports.jsx(ee.TreeMapGraph,{colors:n||B.Colors.graphMainColor,graphTitle:c,graphDescription:e,footNote:i,width:t,height:f,sources:a,leftMargin:p,rightMargin:g,backgroundColor:x,padding:u,topMargin:d,bottomMargin:M,relativeHeight:C,showLabels:b,tooltip:y,onSeriesMouseOver:h,showColorScale:!1,showValues:m,graphID:S,onSeriesMouseClick:q,graphDownload:A,dataDownload:E,data:k,language:D,minHeight:L,theme:w,ariaLabel:G,detailsOnClick:R,styles:T,classNames:P,precision:$}):I==="donutChart"?j.jsxRuntimeExports.jsx(re.DonutChart,{colors:n||B.Colors[w].categoricalColors.colors,graphTitle:c,graphDescription:e,footNote:i,radius:t&&f?t<f?t:f:t||f||void 0,sources:a,backgroundColor:x,padding:u,tooltip:y,onSeriesMouseOver:h,graphID:S,onSeriesMouseClick:q,graphDownload:A,dataDownload:E,data:k,strokeWidth:Q,showColorScale:!0,sortData:V,language:D,theme:w,ariaLabel:G,detailsOnClick:R,styles:T,classNames:P,precision:$}):j.jsxRuntimeExports.jsx(te.SimpleBarGraph,{colors:n||B.Colors.graphMainColor,graphTitle:c,graphDescription:e,footNote:i,width:t,height:f,sources:a,leftMargin:p,rightMargin:g,backgroundColor:x,padding:u,topMargin:d,bottomMargin:M,relativeHeight:C,showLabels:b,tooltip:y,onSeriesMouseOver:h,showColorScale:!1,showValues:m,graphID:S,onSeriesMouseClick:q,graphDownload:A,dataDownload:E,data:k,barPadding:r,refValues:W,truncateBy:J,maxValue:U,showTicks:l,sortData:V,language:D,minHeight:L,theme:w,maxBarThickness:X,ariaLabel:G,orientation:K,detailsOnClick:R,styles:T,classNames:P,precision:$})}exports.Histogram=he;
|
|
2
2
|
//# sourceMappingURL=Histogram.cjs.map
|
package/dist/Histogram.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { j as C } from "./index-CHPV5EwG-BPSP-7Jg.js";
|
|
2
2
|
import { useState as Z, useEffect as _ } from "react";
|
|
3
3
|
import { y as rr } from "./Spinner-C85UF28E.js";
|
|
4
|
-
import { e as P, C as er } from "./index-
|
|
4
|
+
import { e as P, C as er } from "./index-DGAaLNu9.js";
|
|
5
5
|
import { TreeMapGraph as tr } from "./TreeMapGraph.js";
|
|
6
6
|
import { DonutChart as or } from "./DonutChart.js";
|
|
7
7
|
import { SimpleBarGraph as ir } from "./BarGraph.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CHPV5EwG-DDoeWRVt.cjs"),p=require("react"),y=require("./parse-hMnG_lRV.cjs"),qt=require("./index-BzeLQvXk.cjs"),kt=require("./simple-statistics-xm8c0LQQ.cjs"),ot=require("./numberFormattingFunction-02t-wJta.cjs"),$t=require("./Tooltip-n8z5bfav.cjs"),v=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),bt=require("./customArea-BYNyxAkm.cjs"),Ft=require("./AxisTitle-CK9YeovX.cjs"),Tt=require("./Axis-DE7dSn1_.cjs"),Wt=require("./ReferenceLine-CuFMk0cI.cjs"),Ht=require("./RegressionLine-7_rKTHN_.cjs"),Pt=require("./YTicksAndGridLines-DBDuz6vb.cjs"),Ut=require("./index-CylX-pWB.cjs"),Yt=require("./use-in-view-BCmzDU2O.cjs"),Gt=require("./time-Byw_jYQ7.cjs"),Xt=require("./linear-BVckp9RD.cjs"),lt=require("./line-DHV4JwCR.cjs"),ct=require("./step-BZ3C8QFW.cjs"),Bt=require("./area-D3Qx7k7K.cjs"),zt=require("./select-Bnfk0lJx.cjs"),g=require("./proxy-PQd2AItT.cjs"),Jt=require("./init-DU0ybBc_.cjs"),Kt=require("./pointer-Dkq5NV1q.cjs"),Qt=require("./GraphFooter.cjs"),Zt=require("./GraphHeader.cjs"),xt=require("./Colors.cjs"),_t=require("./ColorLegend.cjs"),te=require("./EmptyState-d8_8SxeW.cjs");function ee(ut){const{data:A,width:M,height:$,lineColor:k,suffix:I,prefix:j,dateFormat:o,highlightAreaSettings:h,showValues:G,noOfXTicks:mt,rightMargin:ht,leftMargin:R,topMargin:C,bottomMargin:X,tooltip:B,onSeriesMouseOver:F,refValues:z,minValue:J,maxValue:K,animate:a,rtl:Q,strokeWidth:yt,showDots:D,annotations:pt,customHighlightAreaSettings:dt,regressionLine:T,showIntervalDots:gt,showIntervalValues:ft,intervalLineStrokeWidth:W,intervalLineColors:b,intervalAreaColor:jt,intervalAreaOpacity:wt,yAxisTitle:Z,noOfYTicks:vt,minDate:H,maxDate:P,curveType:L,styles:c,classNames:x,precision:N,customLayers:_}=ut,tt=p.useRef(null),l=Yt.useInView(tt,{once:a.once,amount:a.amount}),[u,Rt]=p.useState(!1);p.useEffect(()=>{if(l&&!u){const t=setTimeout(()=>{Rt(!0)},(a.duration+.5)*1e3);return()=>clearTimeout(t)}},[l,u,a.duration]);const S=L==="linear"?lt.curveLinear:L==="step"?ct.curveStep:L==="stepAfter"?ct.stepAfter:L==="stepBefore"?ct.stepBefore:ct.monotoneX,[V,et]=p.useState(void 0),[it,nt]=p.useState(void 0),[U,Y]=p.useState(void 0),f={top:C,bottom:X,left:Z?R+30:R,right:ht},E=p.useRef(null),n=qt.sortBy(A.filter(t=>!v.checkIfNullOrUndefined(t.y)).map(t=>({date:y.parse(`${t.date}`,o,new Date),y:t.y,yMin:v.checkIfNullOrUndefined(t.yMin)?t.y:t.yMin,yMax:v.checkIfNullOrUndefined(t.yMax)?t.y:t.yMax,data:t.data})),"date"),Et=h.map(t=>({...t,coordinates:[t.coordinates[0]===null?null:y.parse(`${t.coordinates[0]}`,o,new Date),t.coordinates[1]===null?null:y.parse(`${t.coordinates[1]}`,o,new Date)]})),Mt=dt.map(t=>({...t,coordinates:t.coordinates.map((d,O)=>O%2===0?y.parse(`${d}`,o,new Date):d)})),r=M-f.left-f.right,w=$-f.top-f.bottom,at=H?y.parse(`${H}`,o,new Date):n[0].date,st=P?y.parse(`${P}`,o,new Date):n[n.length-1].date,m=v.checkIfNullOrUndefined(J)?Math.min(...n.map(t=>Math.min(t.y,t.yMax,t.yMin)))?Math.min(...n.map(t=>Math.min(t.y,t.yMax,t.yMin)))>0?0:Math.min(...n.map(t=>Math.min(t.y,t.yMax,t.yMin))):0:J,q=Math.max(...n.map(t=>Math.max(t.y,t.yMax,t.yMin)))?Math.max(...n.map(t=>Math.max(t.y,t.yMax,t.yMin))):0,i=Gt.time().domain([at,st]).range([0,r]),s=Xt.linear().domain([m,v.checkIfNullOrUndefined(K)?q>0?q:0:K]).range([w,0]).nice(),Ot=lt.line().x(t=>i(t.date)).y(t=>s(t.y)).curve(S),At=lt.line().x(t=>i(t.date)).y(t=>s(t.yMin)).curve(S),It=lt.line().x(t=>i(t.date)).y(t=>s(t.yMax)).curve(S),Lt=Bt.area().x(t=>i(t.date)).y0(t=>s(t.yMin)).y1(t=>s(t.yMax)).curve(S),Nt=s.ticks(vt),Dt=i.ticks(mt);p.useEffect(()=>{const t=O=>{const rt=n[Jt.bisectCenter(n.map(Ct=>Ct.date),i.invert(Kt.pointer(O)[0]),1)];et(rt||n[n.length-1]),F?.(rt||n[n.length-1]),Y(O.clientY),nt(O.clientX)},d=()=>{et(void 0),nt(void 0),Y(void 0),F?.(void 0)};zt.select(E.current).on("mousemove",t).on("mouseout",d)},[i,n,F]);const St=kt.linearRegression(n.filter(t=>!v.checkIfNullOrUndefined(t.date)&&!v.checkIfNullOrUndefined(t.y)).map(t=>[i(t.date),s(t.y)])),Vt=kt.linearRegressionLine(St);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(g.motion.svg,{width:`${M}px`,height:`${$}px`,viewBox:`0 0 ${M} ${$}`,direction:"ltr",ref:tt,children:e.jsxRuntimeExports.jsxs("g",{transform:`translate(${f.left},${f.top})`,children:[e.jsxRuntimeExports.jsx(Ut.HighlightArea,{areaSettings:Et,width:r,height:w,scale:i,animate:a,isInView:l}),e.jsxRuntimeExports.jsx(bt.CustomArea,{areaSettings:Mt,scaleX:i,scaleY:s,animate:a,isInView:l}),e.jsxRuntimeExports.jsxs("g",{children:[e.jsxRuntimeExports.jsx(Pt.YTicksAndGridLines,{values:Nt.filter(t=>t!==0),y:Nt.filter(t=>t!==0).map(t=>s(t)),x1:0-R,x2:r+f.right,styles:{gridLines:c?.yAxis?.gridLines,labels:c?.yAxis?.labels},classNames:{gridLines:x?.yAxis?.gridLines,labels:x?.yAxis?.labels},suffix:I,prefix:j,labelType:"secondary",showGridLines:!0,labelPos:"vertical",precision:N}),e.jsxRuntimeExports.jsx(Tt.Axis,{y1:s(m<0?0:m),y2:s(m<0?0:m),x1:0-R,x2:r+f.right,label:ot.numberFormattingFunction(m<0?0:m,"NA",N,j,I),labelPos:{x:0-R,y:s(m<0?0:m),dx:0,dy:q<0?"1em":-5},classNames:{axis:x?.xAxis?.axis,label:x?.yAxis?.labels},styles:{axis:c?.xAxis?.axis,label:c?.yAxis?.labels}}),e.jsxRuntimeExports.jsx(Ft.AxisTitle,{x:0-R+15,y:w/2,style:c?.yAxis?.title,className:x?.yAxis?.title,text:Z,rotate90:!0})]}),e.jsxRuntimeExports.jsx("g",{children:Dt.map((t,d)=>e.jsxRuntimeExports.jsx("g",{children:e.jsxRuntimeExports.jsx("text",{y:w,x:i(t),style:{textAnchor:"middle"},className:"fill-primary-gray-700 dark:fill-primary-gray-300 xs:max-[360px]:hidden text-[9px] md:text-[10px] lg:text-xs",dy:15,children:y.format(t,o)})},d))}),_.filter(t=>t.position==="before").map(t=>t.layer),e.jsxRuntimeExports.jsx(g.motion.path,{style:{fill:jt},exit:{opacity:0,transition:{duration:a.duration}},variants:{initial:{opacity:0,d:Lt(n)||""},whileInView:{opacity:wt,d:Lt(n)||"",transition:{duration:a.duration}}},initial:"initial",animate:l?"whileInView":"initial"}),W?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(g.motion.path,{style:{stroke:b[0],fill:"none",strokeWidth:W},exit:{opacity:0,transition:{duration:a.duration}},variants:{initial:{pathLength:0,d:At(n)||"",opacity:1},whileInView:{pathLength:1,d:At(n)||"",opacity:1,transition:{duration:a.duration}}},initial:"initial",animate:l?"whileInView":"initial"}),e.jsxRuntimeExports.jsx(g.motion.path,{style:{stroke:b[1],fill:"none",strokeWidth:W},exit:{opacity:0,transition:{duration:a.duration}},variants:{initial:{pathLength:0,d:It(n)||"",opacity:1},whileInView:{pathLength:1,d:It(n)||"",opacity:1,transition:{duration:a.duration}}},initial:"initial",animate:l?"whileInView":"initial"})]}):null,e.jsxRuntimeExports.jsx(g.motion.path,{style:{stroke:k,fill:"none",strokeWidth:yt},exit:{opacity:0,transition:{duration:a.duration}},variants:{initial:{pathLength:0,d:Ot(n)||"",opacity:1},whileInView:{pathLength:1,d:Ot(n)||"",opacity:1,transition:{duration:a.duration}}},initial:"initial",animate:l?"whileInView":"initial"}),V?e.jsxRuntimeExports.jsx("line",{y1:0,y2:w,x1:i(V.date),x2:i(V.date),className:e.mo("undp-tick-line stroke-primary-gray-700 dark:stroke-primary-gray-100",x?.mouseOverLine),style:c?.mouseOverLine}):null,e.jsxRuntimeExports.jsx("g",{children:n.map((t,d)=>e.jsxRuntimeExports.jsx(g.motion.g,{children:v.checkIfNullOrUndefined(t.y)?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[D?e.jsxRuntimeExports.jsx(g.motion.circle,{r:r/n.length<5?0:r/n.length<20?2:4,style:{fill:k},exit:{opacity:0,transition:{duration:a.duration}},variants:{initial:{opacity:0,cx:i(t.date),cy:s(t.y)},whileInView:{opacity:1,transition:{duration:u?a.duration:.5,delay:u?0:a.duration},cx:i(t.date),cy:s(t.y)}},initial:"initial",animate:l?"whileInView":"initial"}):null,gt?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(g.motion.circle,{r:r/n.length<5?0:r/n.length<20?2:4,style:{fill:b[0]},exit:{opacity:0,transition:{duration:a.duration}},variants:{initial:{opacity:0,cx:i(t.date),cy:s(t.yMin)},whileInView:{opacity:1,transition:{duration:u?a.duration:.5,delay:u?0:a.duration},cx:i(t.date),cy:s(t.yMin)}},initial:"initial",animate:l?"whileInView":"initial"}),e.jsxRuntimeExports.jsx(g.motion.circle,{r:r/n.length<5?0:r/n.length<20?2:4,style:{fill:b[1]},exit:{opacity:0,transition:{duration:a.duration}},variants:{initial:{opacity:0,cx:i(t.date),cy:s(t.yMax)},whileInView:{opacity:1,transition:{duration:u?a.duration:.5,delay:u?0:a.duration},cx:i(t.date),cy:s(t.yMax)}},initial:"initial",animate:l?"whileInView":"initial"})]}):null,G?e.jsxRuntimeExports.jsx(g.motion.text,{dy:-8,style:{fill:k,textAnchor:"middle",...c?.graphObjectValues||{}},className:e.mo("graph-value text-xs font-bold",x?.graphObjectValues),exit:{opacity:0,transition:{duration:a.duration}},variants:{initial:{opacity:0,x:i(t.date),y:s(t.y)},whileInView:{opacity:1,x:i(t.date),y:s(t.y),transition:{duration:u?a.duration:.5,delay:u?0:a.duration}}},initial:"initial",animate:l?"whileInView":"initial",children:ot.numberFormattingFunction(t.y,"NA",N,j,I)}):null,ft?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(g.motion.text,{dy:"1em",style:{fill:b[0],textAnchor:"middle",...c?.graphObjectValues||{}},className:e.mo("text-xs font-bold",x?.graphObjectValues),exit:{opacity:0,transition:{duration:a.duration}},variants:{initial:{opacity:0,x:i(t.date),y:s(t.yMin)},whileInView:{opacity:1,x:i(t.date),y:s(t.yMin),transition:{duration:u?a.duration:.5,delay:u?0:a.duration}}},initial:"initial",animate:l?"whileInView":"initial",children:ot.numberFormattingFunction(t.yMin,"NA",N,j,I)}),e.jsxRuntimeExports.jsx(g.motion.text,{dy:-8,style:{fill:b[1],textAnchor:"middle",...c?.graphObjectValues||{}},className:e.mo("text-xs font-bold",x?.graphObjectValues),exit:{opacity:0,transition:{duration:a.duration}},variants:{initial:{opacity:0,x:i(t.date),y:s(t.yMax)},whileInView:{opacity:1,x:i(t.date),y:s(t.yMax),transition:{duration:u?a.duration:.5,delay:u?0:a.duration}}},initial:"initial",animate:l?"whileInView":"initial",children:ot.numberFormattingFunction(t.yMax,"NA",N,j,I)})]}):null]})},d))}),z?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:z.map((t,d)=>e.jsxRuntimeExports.jsx(Wt.RefLineY,{text:t.text,color:t.color,y:s(t.value),x1:0-R,x2:r+f.right,classNames:t.classNames,styles:t.styles,animate:a,isInView:l},d))}):null,e.jsxRuntimeExports.jsx("g",{children:pt.map((t,d)=>{const O=bt.getLineEndPoint({x:t.xCoordinate?i(y.parse(`${t.xCoordinate}`,o,new Date))+(t.xOffset||0):0+(t.xOffset||0),y:t.yCoordinate?s(t.yCoordinate)+(t.yOffset||0)-8:0+(t.yOffset||0)-8},{x:t.xCoordinate?i(y.parse(`${t.xCoordinate}`,o,new Date)):0,y:t.yCoordinate?s(t.yCoordinate):0},v.checkIfNullOrUndefined(t.connectorRadius)?3.5:t.connectorRadius),rt=t.showConnector?{y1:O.y,x1:O.x,y2:t.yCoordinate?s(t.yCoordinate)+(t.yOffset||0):0+(t.yOffset||0),x2:t.xCoordinate?i(y.parse(`${t.xCoordinate}`,o,new Date))+(t.xOffset||0):0+(t.xOffset||0),cy:t.yCoordinate?s(t.yCoordinate):0,cx:t.xCoordinate?i(y.parse(`${t.xCoordinate}`,o,new Date)):0,circleRadius:v.checkIfNullOrUndefined(t.connectorRadius)?3.5:t.connectorRadius,strokeWidth:t.showConnector===!0?2:Math.min(t.showConnector||0,1)}:void 0,Ct={y:t.yCoordinate?s(t.yCoordinate)+(t.yOffset||0)-8:0+(t.yOffset||0)-8,x:Q?0:t.xCoordinate?i(y.parse(`${t.xCoordinate}`,o,new Date))+(t.xOffset||0):0+(t.xOffset||0),width:Q?t.xCoordinate?i(y.parse(`${t.xCoordinate}`,o,new Date))+(t.xOffset||0):0+(t.xOffset||0):r-(t.xCoordinate?i(y.parse(`${t.xCoordinate}`,o,new Date))+(t.xOffset||0):0+(t.xOffset||0)),maxWidth:t.maxWidth,fontWeight:t.fontWeight,align:t.align};return e.jsxRuntimeExports.jsx(bt.Annotation,{color:t.color,connectorsSettings:rt,labelSettings:Ct,text:t.text,classNames:t.classNames,styles:t.styles,animate:a,isInView:l},d)})}),e.jsxRuntimeExports.jsx("g",{children:T?e.jsxRuntimeExports.jsx(Ht.RegressionLine,{x1:0,x2:r,y1:Vt(0),y2:Vt(r),graphHeight:w,graphWidth:r,className:x?.regLine,style:c?.regLine,color:typeof T=="string"?T:void 0,animate:a,isInView:l}):null}),_.filter(t=>t.position==="after").map(t=>t.layer),e.jsxRuntimeExports.jsx("rect",{ref:E,style:{fill:"none",pointerEvents:"all"},width:r,height:w})]})}),V&&B&&it&&U?e.jsxRuntimeExports.jsx($t.Tooltip,{data:V,body:B,xPos:it,yPos:U,backgroundStyle:c?.tooltip,className:x?.tooltip}):null]})}function ie(ut){const{data:A,graphTitle:M,suffix:$="",sources:k,prefix:I="",graphDescription:j,height:o,width:h,footNote:G,noOfXTicks:mt=10,dateFormat:ht="yyyy",showValues:R=!1,backgroundColor:C=!1,padding:X,lineColor:B,leftMargin:F=30,rightMargin:z=30,topMargin:J=20,bottomMargin:K=25,tooltip:a,refValues:Q=[],highlightAreaSettings:yt=[],relativeHeight:D,onSeriesMouseOver:pt,graphID:dt,minValue:T,maxValue:gt,regressionLine:ft=!1,showIntervalDots:W=!1,showIntervalValues:b=!1,intervalLineStrokeWidth:jt=0,intervalLineColors:wt=[xt.Colors.light.grays["gray-500"],xt.Colors.light.grays["gray-500"]],intervalAreaColor:Z=xt.Colors.primaryColors["blue-100"],intervalAreaOpacity:vt=.4,graphDownload:H=!1,dataDownload:P=!1,animate:L=!1,language:c="en",minHeight:x=0,strokeWidth:N=2,showDots:_=!0,annotations:tt=[],customHighlightAreaSettings:l=[],theme:u="light",ariaLabel:Rt,yAxisTitle:S,noOfYTicks:V=5,minDate:et,maxDate:it,colorLegendTitle:nt,colorLegendColors:U,colorLegendDomain:Y,curveType:f="curve",styles:E,classNames:n,precision:Et=2,customLayers:Mt=[]}=ut,[r,w]=p.useState(0),[at,st]=p.useState(0),m=p.useRef(null),q=p.useRef(null);return p.useEffect(()=>{const i=new ResizeObserver(s=>{w(h||s[0].target.clientWidth||620),st(o||s[0].target.clientHeight||480)});return m.current&&(st(m.current.clientHeight||480),w(m.current.clientWidth||620),h||i.observe(m.current)),()=>i.disconnect()},[h,o]),e.jsxRuntimeExports.jsx("div",{className:`${u||"light"} flex ${h?"w-fit grow-0":"w-full grow"}`,dir:c==="he"||c==="ar"?"rtl":void 0,children:e.jsxRuntimeExports.jsx("div",{className:e.mo(`${C?C===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${c||"en"}`,n?.graphContainer),style:{...E?.graphContainer||{},...C&&C!==!0?{backgroundColor:C}:{}},id:dt,ref:q,"aria-label":Rt||`${M?`The graph shows ${M}. `:""}This is a line chart that highlights the difference between two datasets over time.${j?` ${j}`:""}`,children:e.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:C?X||"1rem":X||0},children:e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[M||j||H||P?e.jsxRuntimeExports.jsx(Zt.GraphHeader,{styles:{title:E?.title,description:E?.description},classNames:{title:n?.title,description:n?.description},graphTitle:M,graphDescription:j,width:h,graphDownload:H?q.current:void 0,dataDownload:P?A.map(i=>i.data).filter(i=>i!==void 0).length>0?A.map(i=>i.data).filter(i=>i!==void 0):A.filter(i=>i!==void 0):null}):null,e.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:A.length===0?e.jsxRuntimeExports.jsx(te.EmptyState,{}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[U&&Y?e.jsxRuntimeExports.jsx(_t.ColorLegend,{width:h,colorLegendTitle:nt,colors:U,colorDomain:Y,showNAColor:!1}):null,e.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:m,"aria-label":"Graph area",children:(h||r)&&(o||at)?e.jsxRuntimeExports.jsx(ee,{data:A,lineColor:B||xt.Colors.primaryColors["blue-600"],width:h||r,height:Math.max(x,o||(D?x?(h||r)*D>x?(h||r)*D:x:(h||r)*D:at)),suffix:$,prefix:I,dateFormat:ht,showValues:R,noOfXTicks:mt,leftMargin:F,rightMargin:z,topMargin:J,bottomMargin:K,tooltip:a,highlightAreaSettings:yt,onSeriesMouseOver:pt,refValues:Q,minValue:T,maxValue:gt,animate:L===!0?{duration:.5,once:!0,amount:.5}:L||{duration:0,once:!0,amount:0},rtl:c==="he"||c==="ar",strokeWidth:N,showDots:_,annotations:tt,customHighlightAreaSettings:l,regressionLine:ft,showIntervalDots:W,showIntervalValues:b,intervalLineStrokeWidth:jt,intervalLineColors:wt,intervalAreaColor:Z,intervalAreaOpacity:vt,yAxisTitle:S,noOfYTicks:V,minDate:et,maxDate:it,curveType:f,styles:E,classNames:n,precision:Et,customLayers:Mt}):null})]})}),k||G?e.jsxRuntimeExports.jsx(Qt.GraphFooter,{styles:{footnote:E?.footnote,source:E?.source},classNames:{footnote:n?.footnote,source:n?.source},sources:k,footNote:G,width:h}):null]})})})})}exports.LineChartWithConfidenceInterval=ie;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CHPV5EwG-DDoeWRVt.cjs"),p=require("react"),y=require("./parse-hMnG_lRV.cjs"),qt=require("./index-BzeLQvXk.cjs"),kt=require("./simple-statistics-xm8c0LQQ.cjs"),ot=require("./numberFormattingFunction-02t-wJta.cjs"),$t=require("./Tooltip-n8z5bfav.cjs"),v=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),bt=require("./customArea-CK768gCn.cjs"),Ft=require("./AxisTitle-CK9YeovX.cjs"),Tt=require("./Axis-DE7dSn1_.cjs"),Wt=require("./ReferenceLine-CFVBBN__.cjs"),Ht=require("./RegressionLine-xKdiJ8sw.cjs"),Pt=require("./YTicksAndGridLines-DBDuz6vb.cjs"),Ut=require("./index-DNj994Pv.cjs"),Yt=require("./time-Byw_jYQ7.cjs"),Gt=require("./linear-BVckp9RD.cjs"),lt=require("./line-DHV4JwCR.cjs"),ct=require("./step-BZ3C8QFW.cjs"),Xt=require("./area-D3Qx7k7K.cjs"),Bt=require("./select-Bnfk0lJx.cjs"),zt=require("./init-DU0ybBc_.cjs"),Jt=require("./pointer-Dkq5NV1q.cjs"),Kt=require("./use-in-view-sQJZ_xDO.cjs"),g=require("./proxy-BHRoeZgd.cjs"),Qt=require("./GraphFooter.cjs"),Zt=require("./GraphHeader.cjs"),xt=require("./Colors.cjs"),_t=require("./ColorLegend.cjs"),te=require("./EmptyState-d8_8SxeW.cjs");function ee(ut){const{data:A,width:M,height:$,lineColor:k,suffix:I,prefix:j,dateFormat:o,highlightAreaSettings:h,showValues:G,noOfXTicks:mt,rightMargin:ht,leftMargin:R,topMargin:C,bottomMargin:X,tooltip:B,onSeriesMouseOver:F,refValues:z,minValue:J,maxValue:K,animate:a,rtl:Q,strokeWidth:yt,showDots:D,annotations:pt,customHighlightAreaSettings:dt,regressionLine:T,showIntervalDots:gt,showIntervalValues:ft,intervalLineStrokeWidth:W,intervalLineColors:b,intervalAreaColor:jt,intervalAreaOpacity:wt,yAxisTitle:Z,noOfYTicks:vt,minDate:H,maxDate:P,curveType:L,styles:c,classNames:x,precision:N,customLayers:_}=ut,tt=p.useRef(null),l=Kt.useInView(tt,{once:a.once,amount:a.amount}),[u,Rt]=p.useState(!1);p.useEffect(()=>{if(l&&!u){const t=setTimeout(()=>{Rt(!0)},(a.duration+.5)*1e3);return()=>clearTimeout(t)}},[l,u,a.duration]);const S=L==="linear"?lt.curveLinear:L==="step"?ct.curveStep:L==="stepAfter"?ct.stepAfter:L==="stepBefore"?ct.stepBefore:ct.monotoneX,[V,et]=p.useState(void 0),[it,nt]=p.useState(void 0),[U,Y]=p.useState(void 0),f={top:C,bottom:X,left:Z?R+30:R,right:ht},E=p.useRef(null),n=qt.sortBy(A.filter(t=>!v.checkIfNullOrUndefined(t.y)).map(t=>({date:y.parse(`${t.date}`,o,new Date),y:t.y,yMin:v.checkIfNullOrUndefined(t.yMin)?t.y:t.yMin,yMax:v.checkIfNullOrUndefined(t.yMax)?t.y:t.yMax,data:t.data})),"date"),Et=h.map(t=>({...t,coordinates:[t.coordinates[0]===null?null:y.parse(`${t.coordinates[0]}`,o,new Date),t.coordinates[1]===null?null:y.parse(`${t.coordinates[1]}`,o,new Date)]})),Mt=dt.map(t=>({...t,coordinates:t.coordinates.map((d,O)=>O%2===0?y.parse(`${d}`,o,new Date):d)})),r=M-f.left-f.right,w=$-f.top-f.bottom,at=H?y.parse(`${H}`,o,new Date):n[0].date,st=P?y.parse(`${P}`,o,new Date):n[n.length-1].date,m=v.checkIfNullOrUndefined(J)?Math.min(...n.map(t=>Math.min(t.y,t.yMax,t.yMin)))?Math.min(...n.map(t=>Math.min(t.y,t.yMax,t.yMin)))>0?0:Math.min(...n.map(t=>Math.min(t.y,t.yMax,t.yMin))):0:J,q=Math.max(...n.map(t=>Math.max(t.y,t.yMax,t.yMin)))?Math.max(...n.map(t=>Math.max(t.y,t.yMax,t.yMin))):0,i=Yt.time().domain([at,st]).range([0,r]),s=Gt.linear().domain([m,v.checkIfNullOrUndefined(K)?q>0?q:0:K]).range([w,0]).nice(),Ot=lt.line().x(t=>i(t.date)).y(t=>s(t.y)).curve(S),At=lt.line().x(t=>i(t.date)).y(t=>s(t.yMin)).curve(S),It=lt.line().x(t=>i(t.date)).y(t=>s(t.yMax)).curve(S),Lt=Xt.area().x(t=>i(t.date)).y0(t=>s(t.yMin)).y1(t=>s(t.yMax)).curve(S),Nt=s.ticks(vt),Dt=i.ticks(mt);p.useEffect(()=>{const t=O=>{const rt=n[zt.bisectCenter(n.map(Ct=>Ct.date),i.invert(Jt.pointer(O)[0]),1)];et(rt||n[n.length-1]),F?.(rt||n[n.length-1]),Y(O.clientY),nt(O.clientX)},d=()=>{et(void 0),nt(void 0),Y(void 0),F?.(void 0)};Bt.select(E.current).on("mousemove",t).on("mouseout",d)},[i,n,F]);const St=kt.linearRegression(n.filter(t=>!v.checkIfNullOrUndefined(t.date)&&!v.checkIfNullOrUndefined(t.y)).map(t=>[i(t.date),s(t.y)])),Vt=kt.linearRegressionLine(St);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(g.motion.svg,{width:`${M}px`,height:`${$}px`,viewBox:`0 0 ${M} ${$}`,direction:"ltr",ref:tt,children:e.jsxRuntimeExports.jsxs("g",{transform:`translate(${f.left},${f.top})`,children:[e.jsxRuntimeExports.jsx(Ut.HighlightArea,{areaSettings:Et,width:r,height:w,scale:i,animate:a,isInView:l}),e.jsxRuntimeExports.jsx(bt.CustomArea,{areaSettings:Mt,scaleX:i,scaleY:s,animate:a,isInView:l}),e.jsxRuntimeExports.jsxs("g",{children:[e.jsxRuntimeExports.jsx(Pt.YTicksAndGridLines,{values:Nt.filter(t=>t!==0),y:Nt.filter(t=>t!==0).map(t=>s(t)),x1:0-R,x2:r+f.right,styles:{gridLines:c?.yAxis?.gridLines,labels:c?.yAxis?.labels},classNames:{gridLines:x?.yAxis?.gridLines,labels:x?.yAxis?.labels},suffix:I,prefix:j,labelType:"secondary",showGridLines:!0,labelPos:"vertical",precision:N}),e.jsxRuntimeExports.jsx(Tt.Axis,{y1:s(m<0?0:m),y2:s(m<0?0:m),x1:0-R,x2:r+f.right,label:ot.numberFormattingFunction(m<0?0:m,"NA",N,j,I),labelPos:{x:0-R,y:s(m<0?0:m),dx:0,dy:q<0?"1em":-5},classNames:{axis:x?.xAxis?.axis,label:x?.yAxis?.labels},styles:{axis:c?.xAxis?.axis,label:c?.yAxis?.labels}}),e.jsxRuntimeExports.jsx(Ft.AxisTitle,{x:0-R+15,y:w/2,style:c?.yAxis?.title,className:x?.yAxis?.title,text:Z,rotate90:!0})]}),e.jsxRuntimeExports.jsx("g",{children:Dt.map((t,d)=>e.jsxRuntimeExports.jsx("g",{children:e.jsxRuntimeExports.jsx("text",{y:w,x:i(t),style:{textAnchor:"middle"},className:"fill-primary-gray-700 dark:fill-primary-gray-300 xs:max-[360px]:hidden text-[9px] md:text-[10px] lg:text-xs",dy:15,children:y.format(t,o)})},d))}),_.filter(t=>t.position==="before").map(t=>t.layer),e.jsxRuntimeExports.jsx(g.motion.path,{style:{fill:jt},exit:{opacity:0,transition:{duration:a.duration}},variants:{initial:{opacity:0,d:Lt(n)||""},whileInView:{opacity:wt,d:Lt(n)||"",transition:{duration:a.duration}}},initial:"initial",animate:l?"whileInView":"initial"}),W?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(g.motion.path,{style:{stroke:b[0],fill:"none",strokeWidth:W},exit:{opacity:0,transition:{duration:a.duration}},variants:{initial:{pathLength:0,d:At(n)||"",opacity:1},whileInView:{pathLength:1,d:At(n)||"",opacity:1,transition:{duration:a.duration}}},initial:"initial",animate:l?"whileInView":"initial"}),e.jsxRuntimeExports.jsx(g.motion.path,{style:{stroke:b[1],fill:"none",strokeWidth:W},exit:{opacity:0,transition:{duration:a.duration}},variants:{initial:{pathLength:0,d:It(n)||"",opacity:1},whileInView:{pathLength:1,d:It(n)||"",opacity:1,transition:{duration:a.duration}}},initial:"initial",animate:l?"whileInView":"initial"})]}):null,e.jsxRuntimeExports.jsx(g.motion.path,{style:{stroke:k,fill:"none",strokeWidth:yt},exit:{opacity:0,transition:{duration:a.duration}},variants:{initial:{pathLength:0,d:Ot(n)||"",opacity:1},whileInView:{pathLength:1,d:Ot(n)||"",opacity:1,transition:{duration:a.duration}}},initial:"initial",animate:l?"whileInView":"initial"}),V?e.jsxRuntimeExports.jsx("line",{y1:0,y2:w,x1:i(V.date),x2:i(V.date),className:e.mo("undp-tick-line stroke-primary-gray-700 dark:stroke-primary-gray-100",x?.mouseOverLine),style:c?.mouseOverLine}):null,e.jsxRuntimeExports.jsx("g",{children:n.map((t,d)=>e.jsxRuntimeExports.jsx(g.motion.g,{children:v.checkIfNullOrUndefined(t.y)?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[D?e.jsxRuntimeExports.jsx(g.motion.circle,{r:r/n.length<5?0:r/n.length<20?2:4,style:{fill:k},exit:{opacity:0,transition:{duration:a.duration}},variants:{initial:{opacity:0,cx:i(t.date),cy:s(t.y)},whileInView:{opacity:1,transition:{duration:u?a.duration:.5,delay:u?0:a.duration},cx:i(t.date),cy:s(t.y)}},initial:"initial",animate:l?"whileInView":"initial"}):null,gt?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(g.motion.circle,{r:r/n.length<5?0:r/n.length<20?2:4,style:{fill:b[0]},exit:{opacity:0,transition:{duration:a.duration}},variants:{initial:{opacity:0,cx:i(t.date),cy:s(t.yMin)},whileInView:{opacity:1,transition:{duration:u?a.duration:.5,delay:u?0:a.duration},cx:i(t.date),cy:s(t.yMin)}},initial:"initial",animate:l?"whileInView":"initial"}),e.jsxRuntimeExports.jsx(g.motion.circle,{r:r/n.length<5?0:r/n.length<20?2:4,style:{fill:b[1]},exit:{opacity:0,transition:{duration:a.duration}},variants:{initial:{opacity:0,cx:i(t.date),cy:s(t.yMax)},whileInView:{opacity:1,transition:{duration:u?a.duration:.5,delay:u?0:a.duration},cx:i(t.date),cy:s(t.yMax)}},initial:"initial",animate:l?"whileInView":"initial"})]}):null,G?e.jsxRuntimeExports.jsx(g.motion.text,{dy:-8,style:{fill:k,textAnchor:"middle",...c?.graphObjectValues||{}},className:e.mo("graph-value text-xs font-bold",x?.graphObjectValues),exit:{opacity:0,transition:{duration:a.duration}},variants:{initial:{opacity:0,x:i(t.date),y:s(t.y)},whileInView:{opacity:1,x:i(t.date),y:s(t.y),transition:{duration:u?a.duration:.5,delay:u?0:a.duration}}},initial:"initial",animate:l?"whileInView":"initial",children:ot.numberFormattingFunction(t.y,"NA",N,j,I)}):null,ft?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(g.motion.text,{dy:"1em",style:{fill:b[0],textAnchor:"middle",...c?.graphObjectValues||{}},className:e.mo("text-xs font-bold",x?.graphObjectValues),exit:{opacity:0,transition:{duration:a.duration}},variants:{initial:{opacity:0,x:i(t.date),y:s(t.yMin)},whileInView:{opacity:1,x:i(t.date),y:s(t.yMin),transition:{duration:u?a.duration:.5,delay:u?0:a.duration}}},initial:"initial",animate:l?"whileInView":"initial",children:ot.numberFormattingFunction(t.yMin,"NA",N,j,I)}),e.jsxRuntimeExports.jsx(g.motion.text,{dy:-8,style:{fill:b[1],textAnchor:"middle",...c?.graphObjectValues||{}},className:e.mo("text-xs font-bold",x?.graphObjectValues),exit:{opacity:0,transition:{duration:a.duration}},variants:{initial:{opacity:0,x:i(t.date),y:s(t.yMax)},whileInView:{opacity:1,x:i(t.date),y:s(t.yMax),transition:{duration:u?a.duration:.5,delay:u?0:a.duration}}},initial:"initial",animate:l?"whileInView":"initial",children:ot.numberFormattingFunction(t.yMax,"NA",N,j,I)})]}):null]})},d))}),z?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:z.map((t,d)=>e.jsxRuntimeExports.jsx(Wt.RefLineY,{text:t.text,color:t.color,y:s(t.value),x1:0-R,x2:r+f.right,classNames:t.classNames,styles:t.styles,animate:a,isInView:l},d))}):null,e.jsxRuntimeExports.jsx("g",{children:pt.map((t,d)=>{const O=bt.getLineEndPoint({x:t.xCoordinate?i(y.parse(`${t.xCoordinate}`,o,new Date))+(t.xOffset||0):0+(t.xOffset||0),y:t.yCoordinate?s(t.yCoordinate)+(t.yOffset||0)-8:0+(t.yOffset||0)-8},{x:t.xCoordinate?i(y.parse(`${t.xCoordinate}`,o,new Date)):0,y:t.yCoordinate?s(t.yCoordinate):0},v.checkIfNullOrUndefined(t.connectorRadius)?3.5:t.connectorRadius),rt=t.showConnector?{y1:O.y,x1:O.x,y2:t.yCoordinate?s(t.yCoordinate)+(t.yOffset||0):0+(t.yOffset||0),x2:t.xCoordinate?i(y.parse(`${t.xCoordinate}`,o,new Date))+(t.xOffset||0):0+(t.xOffset||0),cy:t.yCoordinate?s(t.yCoordinate):0,cx:t.xCoordinate?i(y.parse(`${t.xCoordinate}`,o,new Date)):0,circleRadius:v.checkIfNullOrUndefined(t.connectorRadius)?3.5:t.connectorRadius,strokeWidth:t.showConnector===!0?2:Math.min(t.showConnector||0,1)}:void 0,Ct={y:t.yCoordinate?s(t.yCoordinate)+(t.yOffset||0)-8:0+(t.yOffset||0)-8,x:Q?0:t.xCoordinate?i(y.parse(`${t.xCoordinate}`,o,new Date))+(t.xOffset||0):0+(t.xOffset||0),width:Q?t.xCoordinate?i(y.parse(`${t.xCoordinate}`,o,new Date))+(t.xOffset||0):0+(t.xOffset||0):r-(t.xCoordinate?i(y.parse(`${t.xCoordinate}`,o,new Date))+(t.xOffset||0):0+(t.xOffset||0)),maxWidth:t.maxWidth,fontWeight:t.fontWeight,align:t.align};return e.jsxRuntimeExports.jsx(bt.Annotation,{color:t.color,connectorsSettings:rt,labelSettings:Ct,text:t.text,classNames:t.classNames,styles:t.styles,animate:a,isInView:l},d)})}),e.jsxRuntimeExports.jsx("g",{children:T?e.jsxRuntimeExports.jsx(Ht.RegressionLine,{x1:0,x2:r,y1:Vt(0),y2:Vt(r),graphHeight:w,graphWidth:r,className:x?.regLine,style:c?.regLine,color:typeof T=="string"?T:void 0,animate:a,isInView:l}):null}),_.filter(t=>t.position==="after").map(t=>t.layer),e.jsxRuntimeExports.jsx("rect",{ref:E,style:{fill:"none",pointerEvents:"all"},width:r,height:w})]})}),V&&B&&it&&U?e.jsxRuntimeExports.jsx($t.Tooltip,{data:V,body:B,xPos:it,yPos:U,backgroundStyle:c?.tooltip,className:x?.tooltip}):null]})}function ie(ut){const{data:A,graphTitle:M,suffix:$="",sources:k,prefix:I="",graphDescription:j,height:o,width:h,footNote:G,noOfXTicks:mt=10,dateFormat:ht="yyyy",showValues:R=!1,backgroundColor:C=!1,padding:X,lineColor:B,leftMargin:F=30,rightMargin:z=30,topMargin:J=20,bottomMargin:K=25,tooltip:a,refValues:Q=[],highlightAreaSettings:yt=[],relativeHeight:D,onSeriesMouseOver:pt,graphID:dt,minValue:T,maxValue:gt,regressionLine:ft=!1,showIntervalDots:W=!1,showIntervalValues:b=!1,intervalLineStrokeWidth:jt=0,intervalLineColors:wt=[xt.Colors.light.grays["gray-500"],xt.Colors.light.grays["gray-500"]],intervalAreaColor:Z=xt.Colors.primaryColors["blue-100"],intervalAreaOpacity:vt=.4,graphDownload:H=!1,dataDownload:P=!1,animate:L=!1,language:c="en",minHeight:x=0,strokeWidth:N=2,showDots:_=!0,annotations:tt=[],customHighlightAreaSettings:l=[],theme:u="light",ariaLabel:Rt,yAxisTitle:S,noOfYTicks:V=5,minDate:et,maxDate:it,colorLegendTitle:nt,colorLegendColors:U,colorLegendDomain:Y,curveType:f="curve",styles:E,classNames:n,precision:Et=2,customLayers:Mt=[]}=ut,[r,w]=p.useState(0),[at,st]=p.useState(0),m=p.useRef(null),q=p.useRef(null);return p.useEffect(()=>{const i=new ResizeObserver(s=>{w(h||s[0].target.clientWidth||620),st(o||s[0].target.clientHeight||480)});return m.current&&(st(m.current.clientHeight||480),w(m.current.clientWidth||620),h||i.observe(m.current)),()=>i.disconnect()},[h,o]),e.jsxRuntimeExports.jsx("div",{className:`${u||"light"} flex ${h?"w-fit grow-0":"w-full grow"}`,dir:c==="he"||c==="ar"?"rtl":void 0,children:e.jsxRuntimeExports.jsx("div",{className:e.mo(`${C?C===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${c||"en"}`,n?.graphContainer),style:{...E?.graphContainer||{},...C&&C!==!0?{backgroundColor:C}:{}},id:dt,ref:q,"aria-label":Rt||`${M?`The graph shows ${M}. `:""}This is a line chart that highlights the difference between two datasets over time.${j?` ${j}`:""}`,children:e.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:C?X||"1rem":X||0},children:e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[M||j||H||P?e.jsxRuntimeExports.jsx(Zt.GraphHeader,{styles:{title:E?.title,description:E?.description},classNames:{title:n?.title,description:n?.description},graphTitle:M,graphDescription:j,width:h,graphDownload:H?q.current:void 0,dataDownload:P?A.map(i=>i.data).filter(i=>i!==void 0).length>0?A.map(i=>i.data).filter(i=>i!==void 0):A.filter(i=>i!==void 0):null}):null,e.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:A.length===0?e.jsxRuntimeExports.jsx(te.EmptyState,{}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[U&&Y?e.jsxRuntimeExports.jsx(_t.ColorLegend,{width:h,colorLegendTitle:nt,colors:U,colorDomain:Y,showNAColor:!1}):null,e.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:m,"aria-label":"Graph area",children:(h||r)&&(o||at)?e.jsxRuntimeExports.jsx(ee,{data:A,lineColor:B||xt.Colors.primaryColors["blue-600"],width:h||r,height:Math.max(x,o||(D?x?(h||r)*D>x?(h||r)*D:x:(h||r)*D:at)),suffix:$,prefix:I,dateFormat:ht,showValues:R,noOfXTicks:mt,leftMargin:F,rightMargin:z,topMargin:J,bottomMargin:K,tooltip:a,highlightAreaSettings:yt,onSeriesMouseOver:pt,refValues:Q,minValue:T,maxValue:gt,animate:L===!0?{duration:.5,once:!0,amount:.5}:L||{duration:0,once:!0,amount:0},rtl:c==="he"||c==="ar",strokeWidth:N,showDots:_,annotations:tt,customHighlightAreaSettings:l,regressionLine:ft,showIntervalDots:W,showIntervalValues:b,intervalLineStrokeWidth:jt,intervalLineColors:wt,intervalAreaColor:Z,intervalAreaOpacity:vt,yAxisTitle:S,noOfYTicks:V,minDate:et,maxDate:it,curveType:f,styles:E,classNames:n,precision:Et,customLayers:Mt}):null})]})}),k||G?e.jsxRuntimeExports.jsx(Qt.GraphFooter,{styles:{footnote:E?.footnote,source:E?.source},classNames:{footnote:n?.footnote,source:n?.source},sources:k,footNote:G,width:h}):null]})})})})}exports.LineChartWithConfidenceInterval=ie;
|
|
2
2
|
//# sourceMappingURL=LineChartWithConfidenceInterval.cjs.map
|
|
@@ -6,23 +6,23 @@ import { l as Ft, a as Ht } from "./simple-statistics-flVzqVtt.js";
|
|
|
6
6
|
import { n as lt } from "./numberFormattingFunction-14YCbkN2.js";
|
|
7
7
|
import { T as Yt } from "./Tooltip-DyM5snqx.js";
|
|
8
8
|
import { c as v } from "./checkIfNullOrUndefined-DmfiKkNw.js";
|
|
9
|
-
import { C as Pt, g as Et, A as Xt } from "./customArea-
|
|
9
|
+
import { C as Pt, g as Et, A as Xt } from "./customArea-B-dWU0zZ.js";
|
|
10
10
|
import { A as Gt } from "./AxisTitle-BmHLMRJZ.js";
|
|
11
11
|
import { A as Bt } from "./Axis-Ddg-seDi.js";
|
|
12
|
-
import { R as zt } from "./ReferenceLine-
|
|
13
|
-
import { R as Ut } from "./RegressionLine-
|
|
12
|
+
import { R as zt } from "./ReferenceLine-CfAW3vKJ.js";
|
|
13
|
+
import { R as Ut } from "./RegressionLine-mH7UKOPi.js";
|
|
14
14
|
import { Y as qt } from "./YTicksAndGridLines-B6ah7CRf.js";
|
|
15
|
-
import { H as Jt } from "./index-
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
15
|
+
import { H as Jt } from "./index-Cdcfp4nk.js";
|
|
16
|
+
import { t as Kt } from "./time-BzJP5SPC.js";
|
|
17
|
+
import { a as Qt } from "./linear-DUdu7l2G.js";
|
|
18
|
+
import { l as Ot, c as Zt } from "./line-CPfhohvF.js";
|
|
19
|
+
import { c as _t, s as ti, a as ii, m as ei } from "./step-BrDul-H4.js";
|
|
20
|
+
import { a as ai } from "./area-BE2wo7fv.js";
|
|
21
|
+
import { s as ni } from "./select-DKy99ogv.js";
|
|
22
|
+
import { a as oi } from "./init-BhZylTFx.js";
|
|
23
|
+
import { p as ri } from "./pointer-CWRWOsrb.js";
|
|
24
|
+
import { u as si } from "./use-in-view-yS6jzJAp.js";
|
|
25
|
+
import { m as g } from "./proxy-CkpFesk1.js";
|
|
26
26
|
import { GraphFooter as li } from "./GraphFooter.js";
|
|
27
27
|
import { GraphHeader as ci } from "./GraphHeader.js";
|
|
28
28
|
import { Colors as ct } from "./Colors.js";
|
|
@@ -71,7 +71,7 @@ function xi(yt) {
|
|
|
71
71
|
classNames: m,
|
|
72
72
|
precision: N,
|
|
73
73
|
customLayers: tt
|
|
74
|
-
} = yt, it = mt(null), l =
|
|
74
|
+
} = yt, it = mt(null), l = si(it, {
|
|
75
75
|
once: n.once,
|
|
76
76
|
amount: n.amount
|
|
77
77
|
}), [y, Mt] = R(!1);
|
|
@@ -86,7 +86,7 @@ function xi(yt) {
|
|
|
86
86
|
return () => clearTimeout(t);
|
|
87
87
|
}
|
|
88
88
|
}, [l, y, n.duration]);
|
|
89
|
-
const S = D === "linear" ?
|
|
89
|
+
const S = D === "linear" ? Zt : D === "step" ? _t : D === "stepAfter" ? ti : D === "stepBefore" ? ii : ei, [I, et] = R(void 0), [at, nt] = R(void 0), [X, G] = R(void 0), d = {
|
|
90
90
|
top: b,
|
|
91
91
|
bottom: U,
|
|
92
92
|
left: _ ? j + 30 : j,
|
|
@@ -111,22 +111,22 @@ function xi(yt) {
|
|
|
111
111
|
coordinates: t.coordinates.map(
|
|
112
112
|
(p, O) => O % 2 === 0 ? u(`${p}`, s, /* @__PURE__ */ new Date()) : p
|
|
113
113
|
)
|
|
114
|
-
})), r = C - d.left - d.right, w = W - d.top - d.bottom, ot = P ? u(`${P}`, s, /* @__PURE__ */ new Date()) : a[0].date, rt = E ? u(`${E}`, s, /* @__PURE__ */ new Date()) : a[a.length - 1].date, x = v(K) ? Math.min(...a.map((t) => Math.min(t.y, t.yMax, t.yMin))) ? Math.min(...a.map((t) => Math.min(t.y, t.yMax, t.yMin))) > 0 ? 0 : Math.min(...a.map((t) => Math.min(t.y, t.yMax, t.yMin))) : 0 : K, T = Math.max(...a.map((t) => Math.max(t.y, t.yMax, t.yMin))) ? Math.max(...a.map((t) => Math.max(t.y, t.yMax, t.yMin))) : 0, e =
|
|
114
|
+
})), r = C - d.left - d.right, w = W - d.top - d.bottom, ot = P ? u(`${P}`, s, /* @__PURE__ */ new Date()) : a[0].date, rt = E ? u(`${E}`, s, /* @__PURE__ */ new Date()) : a[a.length - 1].date, x = v(K) ? Math.min(...a.map((t) => Math.min(t.y, t.yMax, t.yMin))) ? Math.min(...a.map((t) => Math.min(t.y, t.yMax, t.yMin))) > 0 ? 0 : Math.min(...a.map((t) => Math.min(t.y, t.yMax, t.yMin))) : 0 : K, T = Math.max(...a.map((t) => Math.max(t.y, t.yMax, t.yMin))) ? Math.max(...a.map((t) => Math.max(t.y, t.yMax, t.yMin))) : 0, e = Kt().domain([ot, rt]).range([0, r]), o = Qt().domain([
|
|
115
115
|
x,
|
|
116
116
|
v(Q) ? T > 0 ? T : 0 : Q
|
|
117
|
-
]).range([w, 0]).nice(), Lt = Ot().x((t) => e(t.date)).y((t) => o(t.y)).curve(S), Dt = Ot().x((t) => e(t.date)).y((t) => o(t.yMin)).curve(S), Nt = Ot().x((t) => e(t.date)).y((t) => o(t.yMax)).curve(S), It =
|
|
117
|
+
]).range([w, 0]).nice(), Lt = Ot().x((t) => e(t.date)).y((t) => o(t.y)).curve(S), Dt = Ot().x((t) => e(t.date)).y((t) => o(t.yMin)).curve(S), Nt = Ot().x((t) => e(t.date)).y((t) => o(t.yMax)).curve(S), It = ai().x((t) => e(t.date)).y0((t) => o(t.yMin)).y1((t) => o(t.yMax)).curve(S), kt = o.ticks(jt), St = e.ticks(xt);
|
|
118
118
|
Vt(() => {
|
|
119
119
|
const t = (O) => {
|
|
120
|
-
const st = a[
|
|
120
|
+
const st = a[oi(
|
|
121
121
|
a.map((At) => At.date),
|
|
122
|
-
e.invert(
|
|
122
|
+
e.invert(ri(O)[0]),
|
|
123
123
|
1
|
|
124
124
|
)];
|
|
125
125
|
et(st || a[a.length - 1]), F?.(st || a[a.length - 1]), G(O.clientY), nt(O.clientX);
|
|
126
126
|
}, p = () => {
|
|
127
127
|
et(void 0), nt(void 0), G(void 0), F?.(void 0);
|
|
128
128
|
};
|
|
129
|
-
|
|
129
|
+
ni(M.current).on("mousemove", t).on("mouseout", p);
|
|
130
130
|
}, [e, a, F]);
|
|
131
131
|
const Tt = Ft(
|
|
132
132
|
a.filter((t) => !v(t.date) && !v(t.y)).map((t) => [e(t.date), o(t.y)])
|
|
@@ -2,7 +2,7 @@ import { a as l, m as O } from "./index-CHPV5EwG-BPSP-7Jg.js";
|
|
|
2
2
|
import * as c from "react";
|
|
3
3
|
import I, { useState as tt } from "react";
|
|
4
4
|
import { b as nt, c as le, P as Y, w as T, _ as rt, g as at, E as oe, u as ot, j as F, C as it, T as ct, R as st, a as ut } from "./index-DG3YrCr5-D3FrrXj8.js";
|
|
5
|
-
import { t as lt } from "./x-
|
|
5
|
+
import { t as lt } from "./x-BBpi7a_7-WVdj1j6r.js";
|
|
6
6
|
var dt = c[" useId ".trim().toString()] || (() => {
|
|
7
7
|
}), ft = 0;
|
|
8
8
|
function q(e) {
|
|
@@ -1016,4 +1016,4 @@ export {
|
|
|
1016
1016
|
$n as X,
|
|
1017
1017
|
q as n
|
|
1018
1018
|
};
|
|
1019
|
-
//# sourceMappingURL=Modal-
|
|
1019
|
+
//# sourceMappingURL=Modal-DVVwpKhP.js.map
|