@hisptz/dhis2-analytics 1.0.5 → 1.0.7
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/build/cjs/components/ChartAnalytics/ChartAnalytics.stories.js +253 -0
- package/build/cjs/components/ChartAnalytics/ChartAnalytics.test.js +51 -0
- package/build/cjs/components/ChartAnalytics/components/DownloadMenu/components/Menu.js +48 -0
- package/build/cjs/components/ChartAnalytics/components/DownloadMenu/constants/menu.js +34 -0
- package/build/cjs/components/ChartAnalytics/components/DownloadMenu/index.js +67 -0
- package/build/cjs/components/ChartAnalytics/components/DownloadMenu/interfaces/menu.js +1 -0
- package/{src → build/cjs}/components/ChartAnalytics/data/column-data.json +0 -0
- package/{src → build/cjs}/components/ChartAnalytics/data/complex-multi-series-data.json +0 -0
- package/{src → build/cjs}/components/ChartAnalytics/data/multi-series-data.json +0 -0
- package/{src → build/cjs}/components/ChartAnalytics/data/pie-data.json +0 -0
- package/{src → build/cjs}/components/ChartAnalytics/data/stacked-chart-data.json +0 -0
- package/build/cjs/components/ChartAnalytics/hooks/useChart.js +38 -0
- package/build/cjs/components/ChartAnalytics/index.js +69 -0
- package/build/cjs/components/ChartAnalytics/models/column.js +53 -0
- package/build/cjs/components/ChartAnalytics/models/index.js +102 -0
- package/build/cjs/components/ChartAnalytics/models/line.js +35 -0
- package/build/cjs/components/ChartAnalytics/models/multi-series.js +111 -0
- package/build/cjs/components/ChartAnalytics/models/pie.js +53 -0
- package/build/cjs/components/ChartAnalytics/services/export.js +50 -0
- package/{src → build/cjs}/components/ChartAnalytics/styles/custom-highchart.css +0 -0
- package/build/cjs/components/ChartAnalytics/types/props.js +1 -0
- package/build/cjs/components/ChartAnalytics/utils/chart.js +133 -0
- package/build/cjs/components/CircularProgressDashboard/CircularProgressIndicator.stories.js +45 -0
- package/build/cjs/components/CircularProgressDashboard/CircularProgressIndicator.test.js +13 -0
- package/build/cjs/components/CircularProgressDashboard/index.js +49 -0
- package/build/cjs/components/CircularProgressDashboard/types/props.js +1 -0
- package/build/cjs/components/Map/Map.stories.js +352 -0
- package/build/cjs/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfigModal.stories.js +32 -0
- package/build/cjs/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfiguration.stories.js +40 -0
- package/build/cjs/components/Map/components/EarthEngineLayerConfiguration/index.js +458 -0
- package/build/cjs/components/Map/components/MapArea/index.js +101 -0
- package/build/cjs/components/Map/components/MapArea/interfaces/index.js +1 -0
- package/build/cjs/components/Map/components/MapControls/components/CustomControl/index.js +32 -0
- package/build/cjs/components/Map/components/MapControls/components/DownloadControl/index.js +25 -0
- package/build/cjs/components/Map/components/MapControls/components/FullscreenControl/index.js +13 -0
- package/build/cjs/components/Map/components/MapControls/index.js +42 -0
- package/build/cjs/components/Map/components/MapLayer/components/BoundaryLayer/hooks/useBoundaryData.js +13 -0
- package/build/cjs/components/Map/components/MapLayer/components/BoundaryLayer/index.js +51 -0
- package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/components/EarthEngineLegend.js +106 -0
- package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/constants/index.js +379 -0
- package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/hooks/index.js +36 -0
- package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/index.js +200 -0
- package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/interfaces/index.js +1 -0
- package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/services/api.js +14 -0
- package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/services/engine.js +412 -0
- package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/utils/index.js +124 -0
- package/{src → build/cjs}/components/Map/components/MapLayer/components/LegendArea/LegendArea.module.css +0 -0
- package/build/cjs/components/Map/components/MapLayer/components/LegendArea/components/LegendCardHeader/index.js +26 -0
- package/build/cjs/components/Map/components/MapLayer/components/LegendArea/index.js +181 -0
- package/build/cjs/components/Map/components/MapLayer/components/PointLayer/components/PointLegend/index.js +86 -0
- package/build/cjs/components/Map/components/MapLayer/components/PointLayer/hooks/index.js +14 -0
- package/build/cjs/components/Map/components/MapLayer/components/PointLayer/index.js +46 -0
- package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubble.js +57 -0
- package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubbles.js +145 -0
- package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/index.js +43 -0
- package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/index.js +56 -0
- package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/components/ChoroplethLegend.js +61 -0
- package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/index.js +43 -0
- package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/CustomTooltip/index.js +35 -0
- package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/hooks/config.js +15 -0
- package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/index.js +57 -0
- package/{src → build/cjs}/components/Map/components/MapLayer/components/ThematicLayer/styles/legends.css +0 -0
- package/build/cjs/components/Map/components/MapLayer/index.js +40 -0
- package/build/cjs/components/Map/components/MapLayer/interfaces/index.js +8 -0
- package/build/cjs/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.js +389 -0
- package/build/cjs/components/Map/components/MapProvider/components/MapLayerProvider/index.js +116 -0
- package/build/cjs/components/Map/components/MapProvider/hooks/index.js +19 -0
- package/build/cjs/components/Map/components/MapProvider/index.js +121 -0
- package/build/cjs/components/Map/components/MapUpdater/index.js +24 -0
- package/build/cjs/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfigModal.stories.js +32 -0
- package/build/cjs/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfiguration.stories.js +40 -0
- package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/components/ColorScale/index.js +40 -0
- package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/constants/colors.js +428 -0
- package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/index.js +63 -0
- package/{src → build/cjs}/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/styles/ColorScale.module.css +0 -0
- package/{src → build/cjs}/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/styles/ColorScaleSelect.module.css +0 -0
- package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/utils/colors.js +72 -0
- package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/CustomLegend/index.js +71 -0
- package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/IndicatorSelectorModal/index.js +47 -0
- package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/LegendSetSelector/index.js +79 -0
- package/build/cjs/components/Map/components/ThematicLayerConfiguration/index.js +265 -0
- package/build/cjs/components/Map/constants/colors.js +428 -0
- package/build/cjs/components/Map/constants/legendSet.js +22 -0
- package/build/cjs/components/Map/hooks/map.js +52 -0
- package/build/cjs/components/Map/index.js +108 -0
- package/build/cjs/components/Map/interfaces/index.js +1 -0
- package/build/cjs/components/Map/state/index.js +23 -0
- package/build/cjs/components/Map/utils/colors.js +78 -0
- package/build/cjs/components/Map/utils/helpers.js +25 -0
- package/build/cjs/components/Map/utils/map.js +161 -0
- package/build/cjs/components/SingleValueContainer/SingleValueContainer.stories.js +127 -0
- package/build/cjs/components/SingleValueContainer/SingleValueContainer.test.js +23 -0
- package/build/cjs/components/SingleValueContainer/components/SingleValueItem/SingleValueItem.js +54 -0
- package/build/cjs/components/SingleValueContainer/components/SingleValueItem/SingleValuePercentage.js +24 -0
- package/build/cjs/components/SingleValueContainer/index.js +43 -0
- package/{src → build/cjs}/components/SingleValueContainer/styles/SingleValueContainer.module.css +0 -0
- package/build/cjs/components/SingleValueContainer/types/props.js +1 -0
- package/{src → build/cjs}/data/map.json +0 -0
- package/build/cjs/dataProviders/map.js +31 -0
- package/build/cjs/index.js +49 -0
- package/build/cjs/locales/en/translations.json +128 -0
- package/build/cjs/locales/index.js +22 -0
- package/build/es/components/ChartAnalytics/ChartAnalytics.stories.js +235 -0
- package/build/es/components/ChartAnalytics/ChartAnalytics.test.js +46 -0
- package/build/es/components/ChartAnalytics/components/DownloadMenu/components/Menu.js +41 -0
- package/build/es/components/ChartAnalytics/components/DownloadMenu/constants/menu.js +26 -0
- package/build/es/components/ChartAnalytics/components/DownloadMenu/index.js +58 -0
- package/build/es/components/ChartAnalytics/components/DownloadMenu/interfaces/menu.js +1 -0
- package/build/es/components/ChartAnalytics/data/column-data.json +210 -0
- package/build/es/components/ChartAnalytics/data/complex-multi-series-data.json +124 -0
- package/build/es/components/ChartAnalytics/data/multi-series-data.json +536 -0
- package/build/es/components/ChartAnalytics/data/pie-data.json +115 -0
- package/build/es/components/ChartAnalytics/data/stacked-chart-data.json +415 -0
- package/build/es/components/ChartAnalytics/hooks/useChart.js +32 -0
- package/build/es/components/ChartAnalytics/index.js +40 -0
- package/build/es/components/ChartAnalytics/models/column.js +45 -0
- package/build/es/components/ChartAnalytics/models/index.js +95 -0
- package/build/es/components/ChartAnalytics/models/line.js +28 -0
- package/build/es/components/ChartAnalytics/models/multi-series.js +104 -0
- package/build/es/components/ChartAnalytics/models/pie.js +46 -0
- package/build/es/components/ChartAnalytics/services/export.js +36 -0
- package/build/es/components/ChartAnalytics/styles/custom-highchart.css +48 -0
- package/build/es/components/ChartAnalytics/types/props.js +1 -0
- package/build/es/components/ChartAnalytics/utils/chart.js +122 -0
- package/{src/components/CircularProgressDashboard/CircularProgressIndicator.stories.tsx → build/es/components/CircularProgressDashboard/CircularProgressIndicator.stories.js} +9 -16
- package/build/es/components/CircularProgressDashboard/CircularProgressIndicator.test.js +10 -0
- package/build/es/components/CircularProgressDashboard/index.js +41 -0
- package/build/es/components/CircularProgressDashboard/types/props.js +1 -0
- package/build/es/components/Map/Map.stories.js +334 -0
- package/build/es/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfigModal.stories.js +23 -0
- package/build/es/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfiguration.stories.js +31 -0
- package/build/es/components/Map/components/EarthEngineLayerConfiguration/index.js +448 -0
- package/build/es/components/Map/components/MapArea/index.js +91 -0
- package/build/es/components/Map/components/MapArea/interfaces/index.js +1 -0
- package/build/es/components/Map/components/MapControls/components/CustomControl/index.js +25 -0
- package/build/es/components/Map/components/MapControls/components/DownloadControl/index.js +18 -0
- package/build/es/components/Map/components/MapControls/components/FullscreenControl/index.js +6 -0
- package/build/es/components/Map/components/MapControls/index.js +35 -0
- package/build/es/components/Map/components/MapLayer/components/BoundaryLayer/hooks/useBoundaryData.js +7 -0
- package/build/es/components/Map/components/MapLayer/components/BoundaryLayer/index.js +41 -0
- package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/components/EarthEngineLegend.js +95 -0
- package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/constants/index.js +369 -0
- package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/hooks/index.js +29 -0
- package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/index.js +191 -0
- package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/interfaces/index.js +1 -0
- package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/services/api.js +14 -0
- package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/services/engine.js +403 -0
- package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/utils/index.js +111 -0
- package/build/es/components/Map/components/MapLayer/components/LegendArea/LegendArea.module.css +12 -0
- package/build/es/components/Map/components/MapLayer/components/LegendArea/components/LegendCardHeader/index.js +19 -0
- package/build/es/components/Map/components/MapLayer/components/LegendArea/index.js +172 -0
- package/build/es/components/Map/components/MapLayer/components/PointLayer/components/PointLegend/index.js +76 -0
- package/build/es/components/Map/components/MapLayer/components/PointLayer/hooks/index.js +8 -0
- package/build/es/components/Map/components/MapLayer/components/PointLayer/index.js +39 -0
- package/build/es/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubble.js +49 -0
- package/{src/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubbles.tsx → build/es/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubbles.js} +57 -74
- package/build/es/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/index.js +33 -0
- package/build/es/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/index.js +47 -0
- package/build/es/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/components/ChoroplethLegend.js +50 -0
- package/build/es/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/index.js +36 -0
- package/build/es/components/Map/components/MapLayer/components/ThematicLayer/components/CustomTooltip/index.js +28 -0
- package/build/es/components/Map/components/MapLayer/components/ThematicLayer/hooks/config.js +9 -0
- package/build/es/components/Map/components/MapLayer/components/ThematicLayer/index.js +50 -0
- package/build/es/components/Map/components/MapLayer/components/ThematicLayer/styles/legends.css +62 -0
- package/build/es/components/Map/components/MapLayer/index.js +33 -0
- package/build/es/components/Map/components/MapLayer/interfaces/index.js +1 -0
- package/build/es/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.js +381 -0
- package/build/es/components/Map/components/MapProvider/components/MapLayerProvider/index.js +107 -0
- package/{src/components/Map/components/MapProvider/hooks/index.ts → build/es/components/Map/components/MapProvider/hooks/index.js} +3 -6
- package/build/es/components/Map/components/MapProvider/index.js +112 -0
- package/build/es/components/Map/components/MapUpdater/index.js +17 -0
- package/build/es/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfigModal.stories.js +23 -0
- package/build/es/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfiguration.stories.js +31 -0
- package/build/es/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/components/ColorScale/index.js +33 -0
- package/{src/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/constants/colors.ts → build/es/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/constants/colors.js} +46 -59
- package/build/es/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/index.js +53 -0
- package/build/es/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/styles/ColorScale.module.css +15 -0
- package/build/es/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/styles/ColorScaleSelect.module.css +12 -0
- package/build/es/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/utils/colors.js +56 -0
- package/build/es/components/Map/components/ThematicLayerConfiguration/components/CustomLegend/index.js +64 -0
- package/build/es/components/Map/components/ThematicLayerConfiguration/components/IndicatorSelectorModal/index.js +38 -0
- package/build/es/components/Map/components/ThematicLayerConfiguration/components/LegendSetSelector/index.js +70 -0
- package/build/es/components/Map/components/ThematicLayerConfiguration/index.js +254 -0
- package/{src/components/Map/constants/colors.ts → build/es/components/Map/constants/colors.js} +46 -59
- package/build/es/components/Map/constants/legendSet.js +15 -0
- package/build/es/components/Map/hooks/map.js +44 -0
- package/build/es/components/Map/index.js +51 -0
- package/build/es/components/Map/interfaces/index.js +1 -0
- package/build/es/components/Map/state/index.js +14 -0
- package/build/es/components/Map/utils/colors.js +61 -0
- package/build/es/components/Map/utils/helpers.js +14 -0
- package/build/es/components/Map/utils/map.js +147 -0
- package/build/es/components/SingleValueContainer/SingleValueContainer.stories.js +115 -0
- package/build/es/components/SingleValueContainer/SingleValueContainer.test.js +20 -0
- package/build/es/components/SingleValueContainer/components/SingleValueItem/SingleValueItem.js +47 -0
- package/build/es/components/SingleValueContainer/components/SingleValueItem/SingleValuePercentage.js +17 -0
- package/build/es/components/SingleValueContainer/index.js +29 -0
- package/build/es/components/SingleValueContainer/styles/SingleValueContainer.module.css +39 -0
- package/build/es/components/SingleValueContainer/types/props.js +1 -0
- package/build/es/data/map.json +5984 -0
- package/build/es/dataProviders/map.js +24 -0
- package/build/es/index.js +5 -0
- package/build/es/locales/en/translations.json +128 -0
- package/build/es/locales/index.js +13 -0
- package/build/types/components/ChartAnalytics/components/DownloadMenu/components/Menu.d.ts +8 -0
- package/build/types/components/ChartAnalytics/components/DownloadMenu/constants/menu.d.ts +7 -0
- package/build/types/components/ChartAnalytics/components/DownloadMenu/index.d.ts +9 -0
- package/{src/components/ChartAnalytics/components/DownloadMenu/interfaces/menu.ts → build/types/components/ChartAnalytics/components/DownloadMenu/interfaces/menu.d.ts} +0 -0
- package/build/types/components/ChartAnalytics/hooks/useChart.d.ts +11 -0
- package/build/types/components/ChartAnalytics/index.d.ts +9 -0
- package/build/types/components/ChartAnalytics/models/column.d.ts +12 -0
- package/build/types/components/ChartAnalytics/models/index.d.ts +17 -0
- package/build/types/components/ChartAnalytics/models/line.d.ts +8 -0
- package/build/types/components/ChartAnalytics/models/multi-series.d.ts +9 -0
- package/build/types/components/ChartAnalytics/models/pie.d.ts +8 -0
- package/build/types/components/ChartAnalytics/services/export.d.ts +8 -0
- package/build/types/components/ChartAnalytics/types/props.d.ts +43 -0
- package/build/types/components/ChartAnalytics/utils/chart.d.ts +15 -0
- package/build/types/components/CircularProgressDashboard/index.d.ts +3 -0
- package/build/types/components/CircularProgressDashboard/types/props.d.ts +17 -0
- package/build/types/components/Map/components/EarthEngineLayerConfiguration/index.d.ts +17 -0
- package/build/types/components/Map/components/MapArea/index.d.ts +5 -0
- package/build/types/components/Map/components/MapArea/interfaces/index.d.ts +30 -0
- package/build/types/components/Map/components/MapControls/components/CustomControl/index.d.ts +7 -0
- package/build/types/components/Map/components/MapControls/components/DownloadControl/index.d.ts +8 -0
- package/build/types/components/Map/components/MapControls/components/FullscreenControl/index.d.ts +5 -0
- package/build/types/components/Map/components/MapControls/index.d.ts +6 -0
- package/build/types/components/Map/components/MapLayer/components/BoundaryLayer/hooks/useBoundaryData.d.ts +1 -0
- package/build/types/components/Map/components/MapLayer/components/BoundaryLayer/index.d.ts +15 -0
- package/build/types/components/Map/components/MapLayer/components/GoogleEngineLayer/components/EarthEngineLegend.d.ts +17 -0
- package/build/types/components/Map/components/MapLayer/components/GoogleEngineLayer/constants/index.d.ts +4 -0
- package/build/types/components/Map/components/MapLayer/components/GoogleEngineLayer/hooks/index.d.ts +9 -0
- package/build/types/components/Map/components/MapLayer/components/GoogleEngineLayer/index.d.ts +4 -0
- package/build/types/components/Map/components/MapLayer/components/GoogleEngineLayer/interfaces/index.d.ts +58 -0
- package/build/types/components/Map/components/MapLayer/components/GoogleEngineLayer/services/api.d.ts +1 -0
- package/build/types/components/Map/components/MapLayer/components/GoogleEngineLayer/services/engine.d.ts +55 -0
- package/build/types/components/Map/components/MapLayer/components/GoogleEngineLayer/utils/index.d.ts +20 -0
- package/build/types/components/Map/components/MapLayer/components/LegendArea/components/LegendCardHeader/index.d.ts +6 -0
- package/build/types/components/Map/components/MapLayer/components/LegendArea/index.d.ts +9 -0
- package/build/types/components/Map/components/MapLayer/components/PointLayer/components/PointLegend/index.d.ts +3 -0
- package/build/types/components/Map/components/MapLayer/components/PointLayer/hooks/index.d.ts +2 -0
- package/build/types/components/Map/components/MapLayer/components/PointLayer/index.d.ts +2 -0
- package/build/types/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubble.d.ts +13 -0
- package/build/types/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubbles.d.ts +10 -0
- package/build/types/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/index.d.ts +16 -0
- package/build/types/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/index.d.ts +12 -0
- package/build/types/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/components/ChoroplethLegend.d.ts +21 -0
- package/build/types/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/index.d.ts +12 -0
- package/build/types/components/Map/components/MapLayer/components/ThematicLayer/components/CustomTooltip/index.d.ts +5 -0
- package/build/types/components/Map/components/MapLayer/components/ThematicLayer/hooks/config.d.ts +2 -0
- package/build/types/components/Map/components/MapLayer/components/ThematicLayer/index.d.ts +5 -0
- package/build/types/components/Map/components/MapLayer/index.d.ts +6 -0
- package/build/types/components/Map/components/MapLayer/interfaces/index.d.ts +123 -0
- package/build/types/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.d.ts +9 -0
- package/build/types/components/Map/components/MapProvider/components/MapLayerProvider/index.d.ts +6 -0
- package/build/types/components/Map/components/MapProvider/hooks/index.d.ts +15 -0
- package/build/types/components/Map/components/MapProvider/index.d.ts +3 -0
- package/build/types/components/Map/components/MapUpdater/index.d.ts +5 -0
- package/build/types/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/components/ColorScale/index.d.ts +8 -0
- package/build/types/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/constants/colors.d.ts +419 -0
- package/build/types/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/index.d.ts +9 -0
- package/build/types/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/utils/colors.d.ts +11 -0
- package/build/types/components/Map/components/ThematicLayerConfiguration/components/CustomLegend/index.d.ts +2 -0
- package/build/types/components/Map/components/ThematicLayerConfiguration/components/IndicatorSelectorModal/index.d.ts +8 -0
- package/build/types/components/Map/components/ThematicLayerConfiguration/components/LegendSetSelector/index.d.ts +9 -0
- package/build/types/components/Map/components/ThematicLayerConfiguration/index.d.ts +18 -0
- package/build/types/components/Map/constants/colors.d.ts +419 -0
- package/build/types/components/Map/constants/legendSet.d.ts +7 -0
- package/build/types/components/Map/hooks/map.d.ts +9 -0
- package/build/types/components/Map/index.d.ts +8 -0
- package/build/types/components/Map/interfaces/index.d.ts +65 -0
- package/build/types/components/Map/state/index.d.ts +20 -0
- package/build/types/components/Map/utils/colors.d.ts +12 -0
- package/build/types/components/Map/utils/helpers.d.ts +6 -0
- package/build/types/components/Map/utils/map.d.ts +40 -0
- package/build/types/components/SingleValueContainer/components/SingleValueItem/SingleValueItem.d.ts +8 -0
- package/build/types/components/SingleValueContainer/components/SingleValueItem/SingleValuePercentage.d.ts +2 -0
- package/build/types/components/SingleValueContainer/index.d.ts +5 -0
- package/build/types/components/SingleValueContainer/types/props.d.ts +15 -0
- package/build/types/dataProviders/map.d.ts +4 -0
- package/{src/index.ts → build/types/index.d.ts} +0 -0
- package/package.json +26 -5
- package/d2.config.js +0 -8
- package/i18n/en.pot +0 -409
- package/src/components/ChartAnalytics/ChartAnalytics.stories.tsx +0 -250
- package/src/components/ChartAnalytics/ChartAnalytics.test.tsx +0 -51
- package/src/components/ChartAnalytics/components/DownloadMenu/components/Menu.tsx +0 -48
- package/src/components/ChartAnalytics/components/DownloadMenu/constants/menu.ts +0 -38
- package/src/components/ChartAnalytics/components/DownloadMenu/index.tsx +0 -67
- package/src/components/ChartAnalytics/hooks/useChart.ts +0 -35
- package/src/components/ChartAnalytics/index.tsx +0 -23
- package/src/components/ChartAnalytics/models/column.ts +0 -50
- package/src/components/ChartAnalytics/models/index.ts +0 -78
- package/src/components/ChartAnalytics/models/line.ts +0 -31
- package/src/components/ChartAnalytics/models/multi-series.ts +0 -115
- package/src/components/ChartAnalytics/models/pie.ts +0 -54
- package/src/components/ChartAnalytics/services/export.ts +0 -38
- package/src/components/ChartAnalytics/types/props.tsx +0 -48
- package/src/components/ChartAnalytics/utils/chart.ts +0 -123
- package/src/components/CircularProgressDashboard/CircularProgressIndicator.test.tsx +0 -9
- package/src/components/CircularProgressDashboard/index.tsx +0 -35
- package/src/components/CircularProgressDashboard/types/props.tsx +0 -17
- package/src/components/Map/Map.stories.tsx +0 -339
- package/src/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfigModal.stories.tsx +0 -28
- package/src/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfiguration.stories.tsx +0 -34
- package/src/components/Map/components/EarthEngineLayerConfiguration/index.tsx +0 -412
- package/src/components/Map/components/MapArea/index.tsx +0 -83
- package/src/components/Map/components/MapArea/interfaces/index.ts +0 -39
- package/src/components/Map/components/MapControls/components/CustomControl/index.tsx +0 -24
- package/src/components/Map/components/MapControls/components/DownloadControl/index.tsx +0 -10
- package/src/components/Map/components/MapControls/components/FullscreenControl/index.tsx +0 -7
- package/src/components/Map/components/MapControls/index.tsx +0 -24
- package/src/components/Map/components/MapLayer/components/BoundaryLayer/hooks/useBoundaryData.ts +0 -7
- package/src/components/Map/components/MapLayer/components/BoundaryLayer/index.tsx +0 -55
- package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/components/EarthEngineLegend.tsx +0 -76
- package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/constants/index.ts +0 -430
- package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/hooks/index.ts +0 -34
- package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/index.tsx +0 -185
- package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/interfaces/index.ts +0 -56
- package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/services/api.js +0 -34233
- package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/services/engine.ts +0 -431
- package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/utils/index.ts +0 -105
- package/src/components/Map/components/MapLayer/components/LegendArea/components/LegendCardHeader/index.tsx +0 -17
- package/src/components/Map/components/MapLayer/components/LegendArea/index.tsx +0 -168
- package/src/components/Map/components/MapLayer/components/PointLayer/components/PointLegend/index.tsx +0 -44
- package/src/components/Map/components/MapLayer/components/PointLayer/hooks/index.ts +0 -8
- package/src/components/Map/components/MapLayer/components/PointLayer/index.tsx +0 -36
- package/src/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubble.tsx +0 -48
- package/src/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/index.tsx +0 -39
- package/src/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/index.tsx +0 -57
- package/src/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/components/ChoroplethLegend.tsx +0 -43
- package/src/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/index.tsx +0 -38
- package/src/components/Map/components/MapLayer/components/ThematicLayer/components/CustomTooltip/index.tsx +0 -26
- package/src/components/Map/components/MapLayer/components/ThematicLayer/hooks/config.ts +0 -10
- package/src/components/Map/components/MapLayer/components/ThematicLayer/index.tsx +0 -46
- package/src/components/Map/components/MapLayer/index.tsx +0 -32
- package/src/components/Map/components/MapLayer/interfaces/index.ts +0 -139
- package/src/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.tsx +0 -359
- package/src/components/Map/components/MapProvider/components/MapLayerProvider/index.tsx +0 -105
- package/src/components/Map/components/MapProvider/index.tsx +0 -93
- package/src/components/Map/components/MapUpdater/index.tsx +0 -8
- package/src/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfigModal.stories.tsx +0 -28
- package/src/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfiguration.stories.tsx +0 -34
- package/src/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/components/ColorScale/index.tsx +0 -24
- package/src/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/index.tsx +0 -50
- package/src/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/utils/colors.ts +0 -91
- package/src/components/Map/components/ThematicLayerConfiguration/components/CustomLegend/index.tsx +0 -45
- package/src/components/Map/components/ThematicLayerConfiguration/components/IndicatorSelectorModal/index.tsx +0 -47
- package/src/components/Map/components/ThematicLayerConfiguration/components/LegendSetSelector/index.tsx +0 -57
- package/src/components/Map/components/ThematicLayerConfiguration/index.tsx +0 -248
- package/src/components/Map/constants/legendSet.ts +0 -19
- package/src/components/Map/hooks/map.ts +0 -47
- package/src/components/Map/index.tsx +0 -65
- package/src/components/Map/interfaces/index.ts +0 -57
- package/src/components/Map/state/index.tsx +0 -31
- package/src/components/Map/utils/colors.ts +0 -95
- package/src/components/Map/utils/helpers.ts +0 -15
- package/src/components/Map/utils/map.ts +0 -150
- package/src/components/SingleValueContainer/SingleValueContainer.stories.tsx +0 -146
- package/src/components/SingleValueContainer/SingleValueContainer.test.tsx +0 -24
- package/src/components/SingleValueContainer/components/SingleValueItem/SingleValueItem.tsx +0 -46
- package/src/components/SingleValueContainer/components/SingleValueItem/SingleValuePercentage.tsx +0 -12
- package/src/components/SingleValueContainer/index.tsx +0 -30
- package/src/components/SingleValueContainer/types/props.tsx +0 -16
- package/src/dataProviders/map.tsx +0 -24
- package/src/index.test.ts +0 -7
- package/tsconfig.json +0 -45
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { compact, filter, find, forEach, isEmpty, isString, sortBy } from "lodash";
|
|
2
|
+
import { defaultClasses, defaultColorScaleName, getColorPalette } from "./colors";
|
|
3
|
+
export function highlightFeature(e, style) {
|
|
4
|
+
const layer = e.target;
|
|
5
|
+
layer.setStyle(style);
|
|
6
|
+
// layer.bringToFront();
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function resetHighlight(e, defaultStyle) {
|
|
10
|
+
const layer = e.target;
|
|
11
|
+
layer.setStyle(defaultStyle);
|
|
12
|
+
// layer.bringToBack();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function getColorFromLegendSet(legends, value) {
|
|
16
|
+
var _find;
|
|
17
|
+
if (!value) {
|
|
18
|
+
return "";
|
|
19
|
+
}
|
|
20
|
+
const legend = (_find = find(legends !== null && legends !== void 0 ? legends : [], legend => (legend === null || legend === void 0 ? void 0 : legend.startValue) <= value && (legend === null || legend === void 0 ? void 0 : legend.endValue) >= value)) !== null && _find !== void 0 ? _find : {};
|
|
21
|
+
return legend.color ? legend.color : "transparent";
|
|
22
|
+
}
|
|
23
|
+
export function getLegendCount(legend, data) {
|
|
24
|
+
const {
|
|
25
|
+
startValue,
|
|
26
|
+
endValue
|
|
27
|
+
} = legend;
|
|
28
|
+
return filter(data, d => d.data >= startValue && d.data <= endValue).length;
|
|
29
|
+
}
|
|
30
|
+
export function getOrgUnitsSelection(orgUnitSelection) {
|
|
31
|
+
var _orgUnitSelection$org, _orgUnitSelection$org2;
|
|
32
|
+
const orgUnits = [];
|
|
33
|
+
if (orgUnitSelection.userOrgUnit) {
|
|
34
|
+
orgUnits.push("USER_ORGUNIT");
|
|
35
|
+
}
|
|
36
|
+
if (orgUnitSelection.userSubUnit) {
|
|
37
|
+
orgUnits.push("USER_ORGUNIT_CHILDREN");
|
|
38
|
+
}
|
|
39
|
+
if (orgUnitSelection.userSubX2Unit) {
|
|
40
|
+
orgUnits.push("USER_ORGUNIT_GRANDCHILDREN");
|
|
41
|
+
}
|
|
42
|
+
if (!isEmpty(orgUnitSelection.levels)) {
|
|
43
|
+
forEach(orgUnitSelection.levels, level => orgUnits.push(`LEVEL-${level}`));
|
|
44
|
+
}
|
|
45
|
+
return [...orgUnits, ...((_orgUnitSelection$org = orgUnitSelection === null || orgUnitSelection === void 0 ? void 0 : (_orgUnitSelection$org2 = orgUnitSelection.orgUnits) === null || _orgUnitSelection$org2 === void 0 ? void 0 : _orgUnitSelection$org2.map(ou => `${ou.id}`)) !== null && _orgUnitSelection$org !== void 0 ? _orgUnitSelection$org : [])];
|
|
46
|
+
}
|
|
47
|
+
export function sanitizeOrgUnits(metaData) {
|
|
48
|
+
if (metaData) {
|
|
49
|
+
var _metaData$dimensions, _metaData$dimensions$;
|
|
50
|
+
return metaData === null || metaData === void 0 ? void 0 : (_metaData$dimensions = metaData.dimensions) === null || _metaData$dimensions === void 0 ? void 0 : (_metaData$dimensions$ = _metaData$dimensions.ou) === null || _metaData$dimensions$ === void 0 ? void 0 : _metaData$dimensions$.map(ouId => {
|
|
51
|
+
var _metaData$items$ouId, _metaData$ouHierarchy;
|
|
52
|
+
return {
|
|
53
|
+
id: ouId,
|
|
54
|
+
name: metaData === null || metaData === void 0 ? void 0 : (_metaData$items$ouId = metaData.items[ouId]) === null || _metaData$items$ouId === void 0 ? void 0 : _metaData$items$ouId.name,
|
|
55
|
+
path: metaData === null || metaData === void 0 ? void 0 : (_metaData$ouHierarchy = metaData.ouHierarchy) === null || _metaData$ouHierarchy === void 0 ? void 0 : _metaData$ouHierarchy[ouId]
|
|
56
|
+
};
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
return [];
|
|
60
|
+
}
|
|
61
|
+
export function toGeoJson(organisationUnits) {
|
|
62
|
+
return sortBy(organisationUnits, "le").map(ou => {
|
|
63
|
+
try {
|
|
64
|
+
const coord = JSON.parse(ou.co);
|
|
65
|
+
let gpid = "";
|
|
66
|
+
let gppg = "";
|
|
67
|
+
let type = "Point";
|
|
68
|
+
if (ou.ty === 2) {
|
|
69
|
+
type = "Polygon";
|
|
70
|
+
if (ou.co.substring(0, 4) === "[[[[") {
|
|
71
|
+
type = "MultiPolygon";
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Grand parent
|
|
76
|
+
if (isString(ou.pg) && ou.pg.length) {
|
|
77
|
+
const ids = compact(ou.pg.split("/"));
|
|
78
|
+
|
|
79
|
+
// Grand parent id
|
|
80
|
+
if (ids.length >= 2) {
|
|
81
|
+
gpid = ids[ids.length - 2];
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Grand parent parent graph
|
|
85
|
+
if (ids.length > 2) {
|
|
86
|
+
gppg = "/" + ids.slice(0, ids.length - 2).join("/");
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
type: "Feature",
|
|
91
|
+
id: ou.id,
|
|
92
|
+
geometry: {
|
|
93
|
+
type,
|
|
94
|
+
coordinates: coord
|
|
95
|
+
},
|
|
96
|
+
properties: {
|
|
97
|
+
type,
|
|
98
|
+
id: ou.id,
|
|
99
|
+
name: ou.na,
|
|
100
|
+
hasCoordinatesDown: ou.hcd,
|
|
101
|
+
hasCoordinatesUp: ou.hcu,
|
|
102
|
+
level: ou.le,
|
|
103
|
+
grandParentParentGraph: gppg,
|
|
104
|
+
grandParentId: gpid,
|
|
105
|
+
parentGraph: ou.pg,
|
|
106
|
+
parentId: ou.pi,
|
|
107
|
+
parentName: ou.pn,
|
|
108
|
+
dimensions: ou.dimensions
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
} catch (e) {
|
|
112
|
+
return {};
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
export function sanitizeDate(startDate) {
|
|
117
|
+
var _startDate$split, _startDate$split$;
|
|
118
|
+
if ((startDate === null || startDate === void 0 ? void 0 : (_startDate$split = startDate.split("-")) === null || _startDate$split === void 0 ? void 0 : (_startDate$split$ = _startDate$split[0]) === null || _startDate$split$ === void 0 ? void 0 : _startDate$split$.length) < 4) {
|
|
119
|
+
var _startDate$split2, _startDate$split2$rev;
|
|
120
|
+
return startDate === null || startDate === void 0 ? void 0 : (_startDate$split2 = startDate.split("-")) === null || _startDate$split2 === void 0 ? void 0 : (_startDate$split2$rev = _startDate$split2.reverse()) === null || _startDate$split2$rev === void 0 ? void 0 : _startDate$split2$rev.join("-");
|
|
121
|
+
}
|
|
122
|
+
return startDate;
|
|
123
|
+
}
|
|
124
|
+
export function generateLegends(maxValue, minValue, _ref) {
|
|
125
|
+
let {
|
|
126
|
+
classesCount,
|
|
127
|
+
colorClass
|
|
128
|
+
} = _ref;
|
|
129
|
+
const count = classesCount !== null && classesCount !== void 0 ? classesCount : defaultClasses;
|
|
130
|
+
const color = colorClass !== null && colorClass !== void 0 ? colorClass : defaultColorScaleName;
|
|
131
|
+
const colorScale = [...getColorPalette(color, count)].reverse();
|
|
132
|
+
const maxLegendValue = 5 * Math.ceil(maxValue / 5);
|
|
133
|
+
const range = maxLegendValue / count;
|
|
134
|
+
const values = [];
|
|
135
|
+
let legendColorsIterator = colorScale.length - 1;
|
|
136
|
+
for (let i = 0; i < maxLegendValue; i += range) {
|
|
137
|
+
const id = colorScale[legendColorsIterator];
|
|
138
|
+
values.push({
|
|
139
|
+
startValue: Math.floor(i),
|
|
140
|
+
endValue: Math.floor(i + range),
|
|
141
|
+
id,
|
|
142
|
+
color: id
|
|
143
|
+
});
|
|
144
|
+
legendColorsIterator--;
|
|
145
|
+
}
|
|
146
|
+
return values.reverse();
|
|
147
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { SingleValueContainer } from ".";
|
|
3
|
+
const Template = args => /*#__PURE__*/React.createElement(SingleValueContainer, args);
|
|
4
|
+
export const Default = Template.bind({});
|
|
5
|
+
Default.args = {
|
|
6
|
+
title: "PRIORITY INDICATORS",
|
|
7
|
+
singleValueItems: [{
|
|
8
|
+
label: "Total Bookings",
|
|
9
|
+
value: 136
|
|
10
|
+
}, {
|
|
11
|
+
label: "At least one dose",
|
|
12
|
+
value: 45,
|
|
13
|
+
percentage: 23,
|
|
14
|
+
color: "#0D47A1"
|
|
15
|
+
}, {
|
|
16
|
+
label: "Partially vaccinated",
|
|
17
|
+
value: 13,
|
|
18
|
+
percentage: 17,
|
|
19
|
+
color: "#0D47A1"
|
|
20
|
+
}, {
|
|
21
|
+
label: "Fully vaccinated",
|
|
22
|
+
value: 126,
|
|
23
|
+
percentage: 83,
|
|
24
|
+
color: "#0D47A1"
|
|
25
|
+
}, {
|
|
26
|
+
label: "Number of AEFI",
|
|
27
|
+
value: 26
|
|
28
|
+
}]
|
|
29
|
+
};
|
|
30
|
+
export const AnimatedAllValues = Template.bind({});
|
|
31
|
+
AnimatedAllValues.args = {
|
|
32
|
+
title: "PRIORITY INDICATORS",
|
|
33
|
+
animationDuration: 1500,
|
|
34
|
+
animationDelay: 500,
|
|
35
|
+
singleValueItems: [{
|
|
36
|
+
label: "Total Bookings",
|
|
37
|
+
value: 136344
|
|
38
|
+
}, {
|
|
39
|
+
label: "At least one dose",
|
|
40
|
+
value: 4423,
|
|
41
|
+
percentage: 23,
|
|
42
|
+
color: "#0D47A1"
|
|
43
|
+
}, {
|
|
44
|
+
label: "Partially vaccinated",
|
|
45
|
+
value: 1394,
|
|
46
|
+
percentage: 17,
|
|
47
|
+
color: "#0D47A1"
|
|
48
|
+
}, {
|
|
49
|
+
label: "Fully vaccinated",
|
|
50
|
+
value: 12432,
|
|
51
|
+
percentage: 83,
|
|
52
|
+
color: "#0D47A1"
|
|
53
|
+
}, {
|
|
54
|
+
label: "Number of AEFI",
|
|
55
|
+
value: 26423
|
|
56
|
+
}]
|
|
57
|
+
};
|
|
58
|
+
export const AnimatedSingleValue = Template.bind({});
|
|
59
|
+
AnimatedSingleValue.args = {
|
|
60
|
+
title: "PRIORITY INDICATORS",
|
|
61
|
+
singleValueItems: [{
|
|
62
|
+
label: "Total Bookings",
|
|
63
|
+
value: 13634244,
|
|
64
|
+
animationDuration: 1000,
|
|
65
|
+
animationDelay: 100
|
|
66
|
+
}, {
|
|
67
|
+
label: "At least one dose",
|
|
68
|
+
value: 45423,
|
|
69
|
+
percentage: 23,
|
|
70
|
+
color: "#0D47A1",
|
|
71
|
+
animationDuration: 1000,
|
|
72
|
+
animationDelay: 600
|
|
73
|
+
}, {
|
|
74
|
+
label: "Partially vaccinated",
|
|
75
|
+
value: 13434,
|
|
76
|
+
percentage: 17,
|
|
77
|
+
color: "#0D47A1",
|
|
78
|
+
animationDuration: 1000,
|
|
79
|
+
animationDelay: 1100
|
|
80
|
+
}, {
|
|
81
|
+
label: "Fully vaccinated",
|
|
82
|
+
value: 126432,
|
|
83
|
+
percentage: 83,
|
|
84
|
+
color: "#0D47A1",
|
|
85
|
+
animationDuration: 1000,
|
|
86
|
+
animationDelay: 1600
|
|
87
|
+
}, {
|
|
88
|
+
label: "Number of AEFI",
|
|
89
|
+
value: 268423,
|
|
90
|
+
animationDuration: 1000,
|
|
91
|
+
animationDelay: 2000
|
|
92
|
+
}]
|
|
93
|
+
};
|
|
94
|
+
export const SingleValuesWithDecimalPlaces = Template.bind({});
|
|
95
|
+
SingleValuesWithDecimalPlaces.args = {
|
|
96
|
+
title: "ENROLLMENTS",
|
|
97
|
+
animationDuration: 1500,
|
|
98
|
+
animationDelay: 500,
|
|
99
|
+
singleValueItems: [{
|
|
100
|
+
label: "Number of Enrolled Clients",
|
|
101
|
+
value: 268423,
|
|
102
|
+
decimalPlaces: 3
|
|
103
|
+
}, {
|
|
104
|
+
label: "Number of Served Clients",
|
|
105
|
+
value: 268423,
|
|
106
|
+
decimalPlaces: 1
|
|
107
|
+
}]
|
|
108
|
+
};
|
|
109
|
+
export default {
|
|
110
|
+
title: "Components/Single Value Container",
|
|
111
|
+
component: SingleValueContainer,
|
|
112
|
+
decorators: [SingleValueStory => {
|
|
113
|
+
return /*#__PURE__*/React.createElement(SingleValueStory, null);
|
|
114
|
+
}]
|
|
115
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { mount } from "@cypress/react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { SingleValueContainer } from ".";
|
|
4
|
+
describe("Single Value Container Tests", () => {
|
|
5
|
+
it("should render", function () {
|
|
6
|
+
const arg = {
|
|
7
|
+
title: "PRIORITY INDICATORS",
|
|
8
|
+
singleValueItems: [{
|
|
9
|
+
label: "Total Bookings",
|
|
10
|
+
value: 136
|
|
11
|
+
}, {
|
|
12
|
+
label: "At least one dose",
|
|
13
|
+
value: 45,
|
|
14
|
+
percentage: 23,
|
|
15
|
+
color: "#0D47A1"
|
|
16
|
+
}]
|
|
17
|
+
};
|
|
18
|
+
mount( /*#__PURE__*/React.createElement(SingleValueContainer, arg));
|
|
19
|
+
});
|
|
20
|
+
});
|
package/build/es/components/SingleValueContainer/components/SingleValueItem/SingleValueItem.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Tooltip } from "@dhis2/ui";
|
|
2
|
+
import { capitalize } from "lodash";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { animated, useSpring } from "react-spring";
|
|
5
|
+
import styles from "../../styles/SingleValueContainer.module.css";
|
|
6
|
+
import SingleValuePercentage from "./SingleValuePercentage";
|
|
7
|
+
export default function SingleValueItem(_ref) {
|
|
8
|
+
var _ref2, _ref3;
|
|
9
|
+
let {
|
|
10
|
+
label,
|
|
11
|
+
value,
|
|
12
|
+
color,
|
|
13
|
+
percentage,
|
|
14
|
+
animationDuration,
|
|
15
|
+
animationDelay,
|
|
16
|
+
globalAnimationDelay,
|
|
17
|
+
decimalPlaces,
|
|
18
|
+
globalAnimationDuration
|
|
19
|
+
} = _ref;
|
|
20
|
+
const numberFormatter = value => Intl.NumberFormat("en-US", {
|
|
21
|
+
notation: "compact",
|
|
22
|
+
maximumFractionDigits: decimalPlaces !== null && decimalPlaces !== void 0 ? decimalPlaces : 1
|
|
23
|
+
}).format(value);
|
|
24
|
+
const sanitizedValue = useSpring({
|
|
25
|
+
val: value,
|
|
26
|
+
from: {
|
|
27
|
+
val: 0
|
|
28
|
+
},
|
|
29
|
+
config: {
|
|
30
|
+
duration: (_ref2 = animationDuration !== null && animationDuration !== void 0 ? animationDuration : globalAnimationDuration) !== null && _ref2 !== void 0 ? _ref2 : 1000
|
|
31
|
+
},
|
|
32
|
+
delay: (_ref3 = animationDelay !== null && animationDelay !== void 0 ? animationDelay : globalAnimationDelay) !== null && _ref3 !== void 0 ? _ref3 : 10
|
|
33
|
+
});
|
|
34
|
+
const tooltipContent = `${label}: ${value}`;
|
|
35
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
36
|
+
className: `${styles["single-value-item"]} text-center`
|
|
37
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
38
|
+
className: styles["font-large"]
|
|
39
|
+
}, label), /*#__PURE__*/React.createElement(Tooltip, {
|
|
40
|
+
content: capitalize(tooltipContent)
|
|
41
|
+
}, /*#__PURE__*/React.createElement(animated.div, {
|
|
42
|
+
className: `${styles["font-bold"]} ${styles["font-xx-large"]} ${styles["padding-top"]}`
|
|
43
|
+
}, sanitizedValue.val.to(value => numberFormatter(Math.floor(value))))), percentage ? /*#__PURE__*/React.createElement(SingleValuePercentage, {
|
|
44
|
+
color: color,
|
|
45
|
+
percentage: percentage
|
|
46
|
+
}) : /*#__PURE__*/React.createElement("span", null));
|
|
47
|
+
}
|
package/build/es/components/SingleValueContainer/components/SingleValueItem/SingleValuePercentage.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { LinearLoader } from "@dhis2/ui";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import styles from "../../styles/SingleValueContainer.module.css";
|
|
4
|
+
export default function SingleValuePercentage(_ref) {
|
|
5
|
+
let {
|
|
6
|
+
percentage,
|
|
7
|
+
color
|
|
8
|
+
} = _ref;
|
|
9
|
+
const width = "100%";
|
|
10
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
11
|
+
className: "w-100"
|
|
12
|
+
}, /*#__PURE__*/React.createElement(LinearLoader, {
|
|
13
|
+
className: styles["percent-value"],
|
|
14
|
+
width: width,
|
|
15
|
+
amount: percentage
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
import i18n from "@dhis2/d2-i18n";
|
|
3
|
+
import { CssReset } from "@dhis2/ui";
|
|
4
|
+
import React, { Suspense } from "react";
|
|
5
|
+
import SingleValueItem from "./components/SingleValueItem/SingleValueItem";
|
|
6
|
+
import styles from "./styles/SingleValueContainer.module.css";
|
|
7
|
+
export function SingleValueContainer(_ref) {
|
|
8
|
+
let {
|
|
9
|
+
title,
|
|
10
|
+
singleValueItems,
|
|
11
|
+
animationDuration,
|
|
12
|
+
animationDelay
|
|
13
|
+
} = _ref;
|
|
14
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
15
|
+
className: "w-100 h-100"
|
|
16
|
+
}, /*#__PURE__*/React.createElement(CssReset, null), /*#__PURE__*/React.createElement(Suspense, {
|
|
17
|
+
fallback: /*#__PURE__*/React.createElement("div", null, i18n.t("Loading ..."))
|
|
18
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", {
|
|
19
|
+
className: `${styles["font-x-large"]} ${styles["font-bold"]}`
|
|
20
|
+
}, title), /*#__PURE__*/React.createElement("div", {
|
|
21
|
+
className: styles["single-value-list"]
|
|
22
|
+
}, singleValueItems.map(singleValueItem => /*#__PURE__*/React.createElement(SingleValueItem, _extends({
|
|
23
|
+
key: `${singleValueItem.label}-${singleValueItem.value}`
|
|
24
|
+
}, singleValueItem, {
|
|
25
|
+
globalAnimationDuration: animationDuration,
|
|
26
|
+
globalAnimationDelay: animationDelay
|
|
27
|
+
})))))));
|
|
28
|
+
}
|
|
29
|
+
export { SingleValueItem };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
.single-value-list {
|
|
2
|
+
padding: 10px 2px;
|
|
3
|
+
width: 100%;
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-wrap: wrap;
|
|
6
|
+
justify-content: space-around;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.padding-top {
|
|
10
|
+
padding-top: 12px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.percent-value {
|
|
14
|
+
border-radius: 1rem;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.percent-value div {
|
|
18
|
+
height: .5rem !important;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.font-large {
|
|
22
|
+
font-size: 1rem;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.font-x-large {
|
|
26
|
+
font-size: 1.5rem;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.font-xx-large {
|
|
30
|
+
font-size: 3rem;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.font-bold {
|
|
34
|
+
font-weight: bold;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.single-value-item {
|
|
38
|
+
margin: 0 1vw;
|
|
39
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|