@hisptz/dhis2-analytics 1.0.4 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (293) hide show
  1. package/build/cjs/components/ChartAnalytics/ChartAnalytics.stories.js +253 -0
  2. package/build/cjs/components/ChartAnalytics/ChartAnalytics.test.js +51 -0
  3. package/build/cjs/components/ChartAnalytics/components/DownloadMenu/components/Menu.js +48 -0
  4. package/build/cjs/components/ChartAnalytics/components/DownloadMenu/constants/menu.js +34 -0
  5. package/build/cjs/components/ChartAnalytics/components/DownloadMenu/index.js +67 -0
  6. package/build/cjs/components/ChartAnalytics/components/DownloadMenu/interfaces/menu.js +1 -0
  7. package/{src → build/cjs}/components/ChartAnalytics/data/column-data.json +0 -0
  8. package/{src → build/cjs}/components/ChartAnalytics/data/complex-multi-series-data.json +0 -0
  9. package/{src → build/cjs}/components/ChartAnalytics/data/multi-series-data.json +0 -0
  10. package/{src → build/cjs}/components/ChartAnalytics/data/pie-data.json +0 -0
  11. package/{src → build/cjs}/components/ChartAnalytics/data/stacked-chart-data.json +0 -0
  12. package/build/cjs/components/ChartAnalytics/hooks/useChart.js +38 -0
  13. package/build/cjs/components/ChartAnalytics/index.js +69 -0
  14. package/build/cjs/components/ChartAnalytics/models/column.js +53 -0
  15. package/build/cjs/components/ChartAnalytics/models/index.js +102 -0
  16. package/build/cjs/components/ChartAnalytics/models/line.js +35 -0
  17. package/build/cjs/components/ChartAnalytics/models/multi-series.js +111 -0
  18. package/build/cjs/components/ChartAnalytics/models/pie.js +53 -0
  19. package/build/cjs/components/ChartAnalytics/services/export.js +50 -0
  20. package/{src → build/cjs}/components/ChartAnalytics/styles/custom-highchart.css +0 -0
  21. package/build/cjs/components/ChartAnalytics/types/props.js +1 -0
  22. package/build/cjs/components/ChartAnalytics/utils/chart.js +133 -0
  23. package/build/cjs/components/CircularProgressDashboard/CircularProgressIndicator.stories.js +45 -0
  24. package/build/cjs/components/CircularProgressDashboard/CircularProgressIndicator.test.js +13 -0
  25. package/build/cjs/components/CircularProgressDashboard/index.js +49 -0
  26. package/build/cjs/components/CircularProgressDashboard/types/props.js +1 -0
  27. package/build/cjs/components/Map/Map.stories.js +352 -0
  28. package/build/cjs/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfigModal.stories.js +32 -0
  29. package/build/cjs/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfiguration.stories.js +40 -0
  30. package/build/cjs/components/Map/components/EarthEngineLayerConfiguration/index.js +458 -0
  31. package/build/cjs/components/Map/components/MapArea/index.js +101 -0
  32. package/build/cjs/components/Map/components/MapArea/interfaces/index.js +1 -0
  33. package/build/cjs/components/Map/components/MapControls/components/CustomControl/index.js +32 -0
  34. package/build/cjs/components/Map/components/MapControls/components/DownloadControl/index.js +25 -0
  35. package/build/cjs/components/Map/components/MapControls/components/FullscreenControl/index.js +13 -0
  36. package/build/cjs/components/Map/components/MapControls/index.js +42 -0
  37. package/build/cjs/components/Map/components/MapLayer/components/BoundaryLayer/hooks/useBoundaryData.js +13 -0
  38. package/build/cjs/components/Map/components/MapLayer/components/BoundaryLayer/index.js +51 -0
  39. package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/components/EarthEngineLegend.js +106 -0
  40. package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/constants/index.js +379 -0
  41. package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/hooks/index.js +36 -0
  42. package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/index.js +200 -0
  43. package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/interfaces/index.js +1 -0
  44. package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/services/api.js +10 -0
  45. package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/services/engine.js +412 -0
  46. package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/utils/index.js +124 -0
  47. package/{src → build/cjs}/components/Map/components/MapLayer/components/LegendArea/LegendArea.module.css +0 -0
  48. package/build/cjs/components/Map/components/MapLayer/components/LegendArea/components/LegendCardHeader/index.js +26 -0
  49. package/build/cjs/components/Map/components/MapLayer/components/LegendArea/index.js +181 -0
  50. package/build/cjs/components/Map/components/MapLayer/components/PointLayer/components/PointLegend/index.js +86 -0
  51. package/build/cjs/components/Map/components/MapLayer/components/PointLayer/hooks/index.js +14 -0
  52. package/build/cjs/components/Map/components/MapLayer/components/PointLayer/index.js +46 -0
  53. package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubble.js +57 -0
  54. package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubbles.js +145 -0
  55. package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/index.js +43 -0
  56. package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/index.js +56 -0
  57. package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/components/ChoroplethLegend.js +61 -0
  58. package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/index.js +43 -0
  59. package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/CustomTooltip/index.js +35 -0
  60. package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/hooks/config.js +15 -0
  61. package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/index.js +57 -0
  62. package/{src → build/cjs}/components/Map/components/MapLayer/components/ThematicLayer/styles/legends.css +0 -0
  63. package/build/cjs/components/Map/components/MapLayer/index.js +40 -0
  64. package/build/cjs/components/Map/components/MapLayer/interfaces/index.js +8 -0
  65. package/build/cjs/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.js +389 -0
  66. package/build/cjs/components/Map/components/MapProvider/components/MapLayerProvider/index.js +116 -0
  67. package/build/cjs/components/Map/components/MapProvider/hooks/index.js +19 -0
  68. package/build/cjs/components/Map/components/MapProvider/index.js +121 -0
  69. package/build/cjs/components/Map/components/MapUpdater/index.js +24 -0
  70. package/build/cjs/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfigModal.stories.js +32 -0
  71. package/build/cjs/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfiguration.stories.js +40 -0
  72. package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/components/ColorScale/index.js +40 -0
  73. package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/constants/colors.js +428 -0
  74. package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/index.js +63 -0
  75. package/{src → build/cjs}/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/styles/ColorScale.module.css +0 -0
  76. package/{src → build/cjs}/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/styles/ColorScaleSelect.module.css +0 -0
  77. package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/utils/colors.js +72 -0
  78. package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/CustomLegend/index.js +71 -0
  79. package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/IndicatorSelectorModal/index.js +47 -0
  80. package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/LegendSetSelector/index.js +79 -0
  81. package/build/cjs/components/Map/components/ThematicLayerConfiguration/index.js +265 -0
  82. package/build/cjs/components/Map/constants/colors.js +428 -0
  83. package/build/cjs/components/Map/constants/legendSet.js +22 -0
  84. package/build/cjs/components/Map/hooks/map.js +52 -0
  85. package/build/cjs/components/Map/index.js +108 -0
  86. package/build/cjs/components/Map/interfaces/index.js +1 -0
  87. package/build/cjs/components/Map/state/index.js +23 -0
  88. package/build/cjs/components/Map/utils/colors.js +78 -0
  89. package/build/cjs/components/Map/utils/helpers.js +25 -0
  90. package/build/cjs/components/Map/utils/map.js +161 -0
  91. package/build/cjs/components/SingleValueContainer/SingleValueContainer.stories.js +127 -0
  92. package/build/cjs/components/SingleValueContainer/SingleValueContainer.test.js +23 -0
  93. package/build/cjs/components/SingleValueContainer/components/SingleValueItem/SingleValueItem.js +54 -0
  94. package/build/cjs/components/SingleValueContainer/components/SingleValueItem/SingleValuePercentage.js +24 -0
  95. package/build/cjs/components/SingleValueContainer/index.js +43 -0
  96. package/{src → build/cjs}/components/SingleValueContainer/styles/SingleValueContainer.module.css +0 -0
  97. package/build/cjs/components/SingleValueContainer/types/props.js +1 -0
  98. package/{src → build/cjs}/data/map.json +0 -0
  99. package/build/cjs/dataProviders/map.js +31 -0
  100. package/build/cjs/index.js +49 -0
  101. package/build/cjs/index.test.js +7 -0
  102. package/build/cjs/locales/en/translations.json +128 -0
  103. package/build/cjs/locales/index.js +22 -0
  104. package/build/es/components/ChartAnalytics/ChartAnalytics.stories.js +235 -0
  105. package/build/es/components/ChartAnalytics/ChartAnalytics.test.js +46 -0
  106. package/build/es/components/ChartAnalytics/components/DownloadMenu/components/Menu.js +41 -0
  107. package/build/es/components/ChartAnalytics/components/DownloadMenu/constants/menu.js +26 -0
  108. package/build/es/components/ChartAnalytics/components/DownloadMenu/index.js +58 -0
  109. package/build/es/components/ChartAnalytics/components/DownloadMenu/interfaces/menu.js +1 -0
  110. package/build/es/components/ChartAnalytics/data/column-data.json +210 -0
  111. package/build/es/components/ChartAnalytics/data/complex-multi-series-data.json +124 -0
  112. package/build/es/components/ChartAnalytics/data/multi-series-data.json +536 -0
  113. package/build/es/components/ChartAnalytics/data/pie-data.json +115 -0
  114. package/build/es/components/ChartAnalytics/data/stacked-chart-data.json +415 -0
  115. package/build/es/components/ChartAnalytics/hooks/useChart.js +32 -0
  116. package/build/es/components/ChartAnalytics/index.js +40 -0
  117. package/build/es/components/ChartAnalytics/models/column.js +45 -0
  118. package/build/es/components/ChartAnalytics/models/index.js +95 -0
  119. package/build/es/components/ChartAnalytics/models/line.js +28 -0
  120. package/build/es/components/ChartAnalytics/models/multi-series.js +104 -0
  121. package/build/es/components/ChartAnalytics/models/pie.js +46 -0
  122. package/build/es/components/ChartAnalytics/services/export.js +36 -0
  123. package/build/es/components/ChartAnalytics/styles/custom-highchart.css +48 -0
  124. package/build/es/components/ChartAnalytics/types/props.js +1 -0
  125. package/build/es/components/ChartAnalytics/utils/chart.js +122 -0
  126. package/{src/components/CircularProgressDashboard/CircularProgressIndicator.stories.tsx → build/es/components/CircularProgressDashboard/CircularProgressIndicator.stories.js} +9 -16
  127. package/build/es/components/CircularProgressDashboard/CircularProgressIndicator.test.js +10 -0
  128. package/build/es/components/CircularProgressDashboard/index.js +41 -0
  129. package/build/es/components/CircularProgressDashboard/types/props.js +1 -0
  130. package/build/es/components/Map/Map.stories.js +334 -0
  131. package/build/es/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfigModal.stories.js +23 -0
  132. package/build/es/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfiguration.stories.js +31 -0
  133. package/build/es/components/Map/components/EarthEngineLayerConfiguration/index.js +448 -0
  134. package/build/es/components/Map/components/MapArea/index.js +91 -0
  135. package/build/es/components/Map/components/MapArea/interfaces/index.js +1 -0
  136. package/build/es/components/Map/components/MapControls/components/CustomControl/index.js +25 -0
  137. package/build/es/components/Map/components/MapControls/components/DownloadControl/index.js +18 -0
  138. package/build/es/components/Map/components/MapControls/components/FullscreenControl/index.js +6 -0
  139. package/build/es/components/Map/components/MapControls/index.js +35 -0
  140. package/build/es/components/Map/components/MapLayer/components/BoundaryLayer/hooks/useBoundaryData.js +7 -0
  141. package/build/es/components/Map/components/MapLayer/components/BoundaryLayer/index.js +41 -0
  142. package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/components/EarthEngineLegend.js +95 -0
  143. package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/constants/index.js +369 -0
  144. package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/hooks/index.js +29 -0
  145. package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/index.js +191 -0
  146. package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/interfaces/index.js +1 -0
  147. package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/services/api.js +10 -0
  148. package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/services/engine.js +403 -0
  149. package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/utils/index.js +111 -0
  150. package/build/es/components/Map/components/MapLayer/components/LegendArea/LegendArea.module.css +12 -0
  151. package/build/es/components/Map/components/MapLayer/components/LegendArea/components/LegendCardHeader/index.js +19 -0
  152. package/build/es/components/Map/components/MapLayer/components/LegendArea/index.js +172 -0
  153. package/build/es/components/Map/components/MapLayer/components/PointLayer/components/PointLegend/index.js +76 -0
  154. package/build/es/components/Map/components/MapLayer/components/PointLayer/hooks/index.js +8 -0
  155. package/build/es/components/Map/components/MapLayer/components/PointLayer/index.js +39 -0
  156. package/build/es/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubble.js +49 -0
  157. 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
  158. package/build/es/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/index.js +33 -0
  159. package/build/es/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/index.js +47 -0
  160. package/build/es/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/components/ChoroplethLegend.js +50 -0
  161. package/build/es/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/index.js +36 -0
  162. package/build/es/components/Map/components/MapLayer/components/ThematicLayer/components/CustomTooltip/index.js +28 -0
  163. package/build/es/components/Map/components/MapLayer/components/ThematicLayer/hooks/config.js +9 -0
  164. package/build/es/components/Map/components/MapLayer/components/ThematicLayer/index.js +50 -0
  165. package/build/es/components/Map/components/MapLayer/components/ThematicLayer/styles/legends.css +62 -0
  166. package/build/es/components/Map/components/MapLayer/index.js +33 -0
  167. package/build/es/components/Map/components/MapLayer/interfaces/index.js +1 -0
  168. package/build/es/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.js +381 -0
  169. package/build/es/components/Map/components/MapProvider/components/MapLayerProvider/index.js +107 -0
  170. package/{src/components/Map/components/MapProvider/hooks/index.ts → build/es/components/Map/components/MapProvider/hooks/index.js} +3 -6
  171. package/build/es/components/Map/components/MapProvider/index.js +112 -0
  172. package/build/es/components/Map/components/MapUpdater/index.js +17 -0
  173. package/build/es/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfigModal.stories.js +23 -0
  174. package/build/es/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfiguration.stories.js +31 -0
  175. package/build/es/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/components/ColorScale/index.js +33 -0
  176. package/{src/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/constants/colors.ts → build/es/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/constants/colors.js} +46 -59
  177. package/build/es/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/index.js +53 -0
  178. package/build/es/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/styles/ColorScale.module.css +15 -0
  179. package/build/es/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/styles/ColorScaleSelect.module.css +12 -0
  180. package/build/es/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/utils/colors.js +56 -0
  181. package/build/es/components/Map/components/ThematicLayerConfiguration/components/CustomLegend/index.js +64 -0
  182. package/build/es/components/Map/components/ThematicLayerConfiguration/components/IndicatorSelectorModal/index.js +38 -0
  183. package/build/es/components/Map/components/ThematicLayerConfiguration/components/LegendSetSelector/index.js +70 -0
  184. package/build/es/components/Map/components/ThematicLayerConfiguration/index.js +254 -0
  185. package/{src/components/Map/constants/colors.ts → build/es/components/Map/constants/colors.js} +46 -59
  186. package/build/es/components/Map/constants/legendSet.js +15 -0
  187. package/build/es/components/Map/hooks/map.js +44 -0
  188. package/build/es/components/Map/index.js +51 -0
  189. package/build/es/components/Map/interfaces/index.js +1 -0
  190. package/build/es/components/Map/state/index.js +14 -0
  191. package/build/es/components/Map/utils/colors.js +61 -0
  192. package/build/es/components/Map/utils/helpers.js +14 -0
  193. package/build/es/components/Map/utils/map.js +147 -0
  194. package/build/es/components/SingleValueContainer/SingleValueContainer.stories.js +115 -0
  195. package/build/es/components/SingleValueContainer/SingleValueContainer.test.js +20 -0
  196. package/build/es/components/SingleValueContainer/components/SingleValueItem/SingleValueItem.js +47 -0
  197. package/build/es/components/SingleValueContainer/components/SingleValueItem/SingleValuePercentage.js +17 -0
  198. package/build/es/components/SingleValueContainer/index.js +29 -0
  199. package/build/es/components/SingleValueContainer/styles/SingleValueContainer.module.css +39 -0
  200. package/build/es/components/SingleValueContainer/types/props.js +1 -0
  201. package/build/es/data/map.json +5984 -0
  202. package/build/es/dataProviders/map.js +24 -0
  203. package/{src/index.ts → build/es/index.js} +1 -0
  204. package/build/es/index.test.js +6 -0
  205. package/build/es/locales/en/translations.json +128 -0
  206. package/build/es/locales/index.js +13 -0
  207. package/package.json +21 -4
  208. package/d2.config.js +0 -8
  209. package/i18n/en.pot +0 -409
  210. package/src/components/ChartAnalytics/ChartAnalytics.stories.tsx +0 -250
  211. package/src/components/ChartAnalytics/ChartAnalytics.test.tsx +0 -51
  212. package/src/components/ChartAnalytics/components/DownloadMenu/components/Menu.tsx +0 -48
  213. package/src/components/ChartAnalytics/components/DownloadMenu/constants/menu.ts +0 -38
  214. package/src/components/ChartAnalytics/components/DownloadMenu/index.tsx +0 -67
  215. package/src/components/ChartAnalytics/components/DownloadMenu/interfaces/menu.ts +0 -1
  216. package/src/components/ChartAnalytics/hooks/useChart.ts +0 -35
  217. package/src/components/ChartAnalytics/index.tsx +0 -23
  218. package/src/components/ChartAnalytics/models/column.ts +0 -50
  219. package/src/components/ChartAnalytics/models/index.ts +0 -78
  220. package/src/components/ChartAnalytics/models/line.ts +0 -31
  221. package/src/components/ChartAnalytics/models/multi-series.ts +0 -115
  222. package/src/components/ChartAnalytics/models/pie.ts +0 -54
  223. package/src/components/ChartAnalytics/services/export.ts +0 -38
  224. package/src/components/ChartAnalytics/types/props.tsx +0 -48
  225. package/src/components/ChartAnalytics/utils/chart.ts +0 -123
  226. package/src/components/CircularProgressDashboard/CircularProgressIndicator.test.tsx +0 -9
  227. package/src/components/CircularProgressDashboard/index.tsx +0 -35
  228. package/src/components/CircularProgressDashboard/types/props.tsx +0 -17
  229. package/src/components/Map/Map.stories.tsx +0 -339
  230. package/src/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfigModal.stories.tsx +0 -28
  231. package/src/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfiguration.stories.tsx +0 -34
  232. package/src/components/Map/components/EarthEngineLayerConfiguration/index.tsx +0 -412
  233. package/src/components/Map/components/MapArea/index.tsx +0 -83
  234. package/src/components/Map/components/MapArea/interfaces/index.ts +0 -39
  235. package/src/components/Map/components/MapControls/components/CustomControl/index.tsx +0 -24
  236. package/src/components/Map/components/MapControls/components/DownloadControl/index.tsx +0 -10
  237. package/src/components/Map/components/MapControls/components/FullscreenControl/index.tsx +0 -7
  238. package/src/components/Map/components/MapControls/index.tsx +0 -24
  239. package/src/components/Map/components/MapLayer/components/BoundaryLayer/hooks/useBoundaryData.ts +0 -7
  240. package/src/components/Map/components/MapLayer/components/BoundaryLayer/index.tsx +0 -55
  241. package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/components/EarthEngineLegend.tsx +0 -76
  242. package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/constants/index.ts +0 -430
  243. package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/hooks/index.ts +0 -34
  244. package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/index.tsx +0 -185
  245. package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/interfaces/index.ts +0 -56
  246. package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/services/api.js +0 -34233
  247. package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/services/engine.ts +0 -423
  248. package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/utils/index.ts +0 -105
  249. package/src/components/Map/components/MapLayer/components/LegendArea/components/LegendCardHeader/index.tsx +0 -17
  250. package/src/components/Map/components/MapLayer/components/LegendArea/index.tsx +0 -168
  251. package/src/components/Map/components/MapLayer/components/PointLayer/components/PointLegend/index.tsx +0 -44
  252. package/src/components/Map/components/MapLayer/components/PointLayer/hooks/index.ts +0 -8
  253. package/src/components/Map/components/MapLayer/components/PointLayer/index.tsx +0 -36
  254. package/src/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubble.tsx +0 -48
  255. package/src/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/index.tsx +0 -39
  256. package/src/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/index.tsx +0 -57
  257. package/src/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/components/ChoroplethLegend.tsx +0 -43
  258. package/src/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/index.tsx +0 -38
  259. package/src/components/Map/components/MapLayer/components/ThematicLayer/components/CustomTooltip/index.tsx +0 -26
  260. package/src/components/Map/components/MapLayer/components/ThematicLayer/hooks/config.ts +0 -10
  261. package/src/components/Map/components/MapLayer/components/ThematicLayer/index.tsx +0 -46
  262. package/src/components/Map/components/MapLayer/index.tsx +0 -32
  263. package/src/components/Map/components/MapLayer/interfaces/index.ts +0 -139
  264. package/src/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.tsx +0 -359
  265. package/src/components/Map/components/MapProvider/components/MapLayerProvider/index.tsx +0 -105
  266. package/src/components/Map/components/MapProvider/index.tsx +0 -93
  267. package/src/components/Map/components/MapUpdater/index.tsx +0 -8
  268. package/src/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfigModal.stories.tsx +0 -28
  269. package/src/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfiguration.stories.tsx +0 -34
  270. package/src/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/components/ColorScale/index.tsx +0 -24
  271. package/src/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/index.tsx +0 -50
  272. package/src/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/utils/colors.ts +0 -91
  273. package/src/components/Map/components/ThematicLayerConfiguration/components/CustomLegend/index.tsx +0 -45
  274. package/src/components/Map/components/ThematicLayerConfiguration/components/IndicatorSelectorModal/index.tsx +0 -47
  275. package/src/components/Map/components/ThematicLayerConfiguration/components/LegendSetSelector/index.tsx +0 -57
  276. package/src/components/Map/components/ThematicLayerConfiguration/index.tsx +0 -248
  277. package/src/components/Map/constants/legendSet.ts +0 -19
  278. package/src/components/Map/hooks/map.ts +0 -47
  279. package/src/components/Map/index.tsx +0 -65
  280. package/src/components/Map/interfaces/index.ts +0 -57
  281. package/src/components/Map/state/index.tsx +0 -31
  282. package/src/components/Map/utils/colors.ts +0 -95
  283. package/src/components/Map/utils/helpers.ts +0 -15
  284. package/src/components/Map/utils/map.ts +0 -150
  285. package/src/components/SingleValueContainer/SingleValueContainer.stories.tsx +0 -146
  286. package/src/components/SingleValueContainer/SingleValueContainer.test.tsx +0 -24
  287. package/src/components/SingleValueContainer/components/SingleValueItem/SingleValueItem.tsx +0 -46
  288. package/src/components/SingleValueContainer/components/SingleValueItem/SingleValuePercentage.tsx +0 -12
  289. package/src/components/SingleValueContainer/index.tsx +0 -30
  290. package/src/components/SingleValueContainer/types/props.tsx +0 -16
  291. package/src/dataProviders/map.tsx +0 -24
  292. package/src/index.test.ts +0 -7
  293. package/tsconfig.json +0 -45
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.MapPeriodContext = exports.MapOrgUnitContext = exports.MapLayersContext = void 0;
7
+ var _react = require("react");
8
+ const MapOrgUnitContext = /*#__PURE__*/(0, _react.createContext)({
9
+ orgUnitSelection: {
10
+ orgUnits: []
11
+ },
12
+ orgUnits: []
13
+ });
14
+ exports.MapOrgUnitContext = MapOrgUnitContext;
15
+ const MapPeriodContext = /*#__PURE__*/(0, _react.createContext)({
16
+ periods: []
17
+ });
18
+ exports.MapPeriodContext = MapPeriodContext;
19
+ const MapLayersContext = /*#__PURE__*/(0, _react.createContext)({
20
+ layers: [],
21
+ updateLayer: () => {}
22
+ });
23
+ exports.MapLayersContext = MapLayersContext;
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isDarkColor = exports.getUniqueColor = exports.getContrastColor = exports.getColorScale = exports.getColorPalette = exports.getColorClasses = exports.defaultColorScaleName = exports.defaultColorScale = exports.defaultClasses = exports.cssColor = exports.colorScales = void 0;
7
+ var _d3Color = require("d3-color");
8
+ var _lodash = require("lodash");
9
+ var _colors = require("../constants/colors");
10
+ const colorbrewer = _colors.COLOR_PALETTES;
11
+
12
+ // Returns a color brewer scale for a number of classes
13
+ const getColorPalette = (scale, classes) => {
14
+ var _colorbrewer$scale;
15
+ return colorbrewer === null || colorbrewer === void 0 ? void 0 : (_colorbrewer$scale = colorbrewer[scale]) === null || _colorbrewer$scale === void 0 ? void 0 : _colorbrewer$scale[classes];
16
+ };
17
+ exports.getColorPalette = getColorPalette;
18
+ const getColorClasses = palette => {
19
+ var _palette$split;
20
+ return palette === null || palette === void 0 ? void 0 : (_palette$split = palette.split(",")) === null || _palette$split === void 0 ? void 0 : _palette$split.length;
21
+ };
22
+
23
+ // Returns color scale name for a palette
24
+ exports.getColorClasses = getColorClasses;
25
+ const getColorScale = palette => {
26
+ const classes = palette.split(",").length;
27
+ return colorScales.find(name => {
28
+ var _colorbrewer$name$cla;
29
+ return ((_colorbrewer$name$cla = colorbrewer[name][classes]) === null || _colorbrewer$name$cla === void 0 ? void 0 : _colorbrewer$name$cla.join(",")) === palette;
30
+ });
31
+ };
32
+ exports.getColorScale = getColorScale;
33
+ const defaultColorScaleName = "YlOrBr";
34
+ exports.defaultColorScaleName = defaultColorScaleName;
35
+ const defaultClasses = 5;
36
+ exports.defaultClasses = defaultClasses;
37
+ const defaultColorScale = getColorPalette(defaultColorScaleName, defaultClasses);
38
+
39
+ // Correct colors not adhering to the css standard (add missing #)
40
+ exports.defaultColorScale = defaultColorScale;
41
+ const cssColor = color => {
42
+ if (!(0, _lodash.isString)(color)) {
43
+ return color;
44
+ } else if (color === "##normal") {
45
+ // ##normal is used in old map favorites
46
+ return null; // Will apply default color
47
+ }
48
+
49
+ return (/(^[0-9A-F]{6}$)|(^[0-9A-F]{3}$)/i.test(color) ? "#" : "") + color;
50
+ };
51
+
52
+ // Returns an unique color (first from an array, then random but still unique)
53
+ exports.cssColor = cssColor;
54
+ const getUniqueColor = defaultColors => {
55
+ const colors = [...defaultColors];
56
+ function randomColor() {
57
+ const color = "#000000".replace(/0/g, () => (~~(Math.random() * 16)).toString(16));
58
+
59
+ // Recursive until color is unique
60
+ if (colors.includes(color)) {
61
+ return randomColor();
62
+ }
63
+ colors.push(color);
64
+ return color;
65
+ }
66
+ return index => colors[index] || randomColor();
67
+ };
68
+
69
+ // Returns true if a color is dark
70
+ exports.getUniqueColor = getUniqueColor;
71
+ const isDarkColor = color => (0, _d3Color.hcl)(color).l < 70;
72
+
73
+ // Returns constrasting color
74
+ exports.isDarkColor = isDarkColor;
75
+ const getContrastColor = color => isDarkColor(color) ? "#fff" : "#000";
76
+ exports.getContrastColor = getContrastColor;
77
+ const colorScales = ["YlOrBr", "Reds", "YlGn", "Greens", "Blues", "BuPu", "RdPu", "PuRd", "Greys", "YlOrBr_reverse", "Reds_reverse", "YlGn_reverse", "Greens_reverse", "Blues_reverse", "BuPu_reverse", "RdPu_reverse", "PuRd_reverse", "Greys_reverse", "PuOr", "BrBG", "PRGn", "PiYG", "RdBu", "RdGy", "RdYlBu", "Spectral", "RdYlGn", "Paired", "Pastel1", "Set1", "Set3"];
78
+ exports.colorScales = colorScales;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getIcon = getIcon;
7
+ exports.getIconUrl = getIconUrl;
8
+ exports.getLongestTextLength = void 0;
9
+ var _leaflet = _interopRequireDefault(require("leaflet"));
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+ // Get the longest text length from an object property in an array
12
+
13
+ const getLongestTextLength = (array, key) => array.reduce((text, curr) => curr[key] && String(curr[key]).length > text.length ? String(curr[key]) : text, "").length;
14
+ exports.getLongestTextLength = getLongestTextLength;
15
+ function getIconUrl(icon, _ref) {
16
+ let {
17
+ baseUrl
18
+ } = _ref;
19
+ return `${baseUrl}/images/orgunitgroup/${icon !== null && icon !== void 0 ? icon : "01.png"}`;
20
+ }
21
+ function getIcon(url) {
22
+ return new _leaflet.default.Icon({
23
+ iconUrl: url
24
+ });
25
+ }
@@ -0,0 +1,161 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.generateLegends = generateLegends;
7
+ exports.getColorFromLegendSet = getColorFromLegendSet;
8
+ exports.getLegendCount = getLegendCount;
9
+ exports.getOrgUnitsSelection = getOrgUnitsSelection;
10
+ exports.highlightFeature = highlightFeature;
11
+ exports.resetHighlight = resetHighlight;
12
+ exports.sanitizeDate = sanitizeDate;
13
+ exports.sanitizeOrgUnits = sanitizeOrgUnits;
14
+ exports.toGeoJson = toGeoJson;
15
+ var _lodash = require("lodash");
16
+ var _colors = require("./colors");
17
+ function highlightFeature(e, style) {
18
+ const layer = e.target;
19
+ layer.setStyle(style);
20
+ // layer.bringToFront();
21
+ }
22
+
23
+ function resetHighlight(e, defaultStyle) {
24
+ const layer = e.target;
25
+ layer.setStyle(defaultStyle);
26
+ // layer.bringToBack();
27
+ }
28
+
29
+ function getColorFromLegendSet(legends, value) {
30
+ var _find;
31
+ if (!value) {
32
+ return "";
33
+ }
34
+ const legend = (_find = (0, _lodash.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 : {};
35
+ return legend.color ? legend.color : "transparent";
36
+ }
37
+ function getLegendCount(legend, data) {
38
+ const {
39
+ startValue,
40
+ endValue
41
+ } = legend;
42
+ return (0, _lodash.filter)(data, d => d.data >= startValue && d.data <= endValue).length;
43
+ }
44
+ function getOrgUnitsSelection(orgUnitSelection) {
45
+ var _orgUnitSelection$org, _orgUnitSelection$org2;
46
+ const orgUnits = [];
47
+ if (orgUnitSelection.userOrgUnit) {
48
+ orgUnits.push("USER_ORGUNIT");
49
+ }
50
+ if (orgUnitSelection.userSubUnit) {
51
+ orgUnits.push("USER_ORGUNIT_CHILDREN");
52
+ }
53
+ if (orgUnitSelection.userSubX2Unit) {
54
+ orgUnits.push("USER_ORGUNIT_GRANDCHILDREN");
55
+ }
56
+ if (!(0, _lodash.isEmpty)(orgUnitSelection.levels)) {
57
+ (0, _lodash.forEach)(orgUnitSelection.levels, level => orgUnits.push(`LEVEL-${level}`));
58
+ }
59
+ 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 : [])];
60
+ }
61
+ function sanitizeOrgUnits(metaData) {
62
+ if (metaData) {
63
+ var _metaData$dimensions, _metaData$dimensions$;
64
+ 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 => {
65
+ var _metaData$items$ouId, _metaData$ouHierarchy;
66
+ return {
67
+ id: ouId,
68
+ 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,
69
+ path: metaData === null || metaData === void 0 ? void 0 : (_metaData$ouHierarchy = metaData.ouHierarchy) === null || _metaData$ouHierarchy === void 0 ? void 0 : _metaData$ouHierarchy[ouId]
70
+ };
71
+ });
72
+ }
73
+ return [];
74
+ }
75
+ function toGeoJson(organisationUnits) {
76
+ return (0, _lodash.sortBy)(organisationUnits, "le").map(ou => {
77
+ try {
78
+ const coord = JSON.parse(ou.co);
79
+ let gpid = "";
80
+ let gppg = "";
81
+ let type = "Point";
82
+ if (ou.ty === 2) {
83
+ type = "Polygon";
84
+ if (ou.co.substring(0, 4) === "[[[[") {
85
+ type = "MultiPolygon";
86
+ }
87
+ }
88
+
89
+ // Grand parent
90
+ if ((0, _lodash.isString)(ou.pg) && ou.pg.length) {
91
+ const ids = (0, _lodash.compact)(ou.pg.split("/"));
92
+
93
+ // Grand parent id
94
+ if (ids.length >= 2) {
95
+ gpid = ids[ids.length - 2];
96
+ }
97
+
98
+ // Grand parent parent graph
99
+ if (ids.length > 2) {
100
+ gppg = "/" + ids.slice(0, ids.length - 2).join("/");
101
+ }
102
+ }
103
+ return {
104
+ type: "Feature",
105
+ id: ou.id,
106
+ geometry: {
107
+ type,
108
+ coordinates: coord
109
+ },
110
+ properties: {
111
+ type,
112
+ id: ou.id,
113
+ name: ou.na,
114
+ hasCoordinatesDown: ou.hcd,
115
+ hasCoordinatesUp: ou.hcu,
116
+ level: ou.le,
117
+ grandParentParentGraph: gppg,
118
+ grandParentId: gpid,
119
+ parentGraph: ou.pg,
120
+ parentId: ou.pi,
121
+ parentName: ou.pn,
122
+ dimensions: ou.dimensions
123
+ }
124
+ };
125
+ } catch (e) {
126
+ return {};
127
+ }
128
+ });
129
+ }
130
+ function sanitizeDate(startDate) {
131
+ var _startDate$split, _startDate$split$;
132
+ 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) {
133
+ var _startDate$split2, _startDate$split2$rev;
134
+ 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("-");
135
+ }
136
+ return startDate;
137
+ }
138
+ function generateLegends(maxValue, minValue, _ref) {
139
+ let {
140
+ classesCount,
141
+ colorClass
142
+ } = _ref;
143
+ const count = classesCount !== null && classesCount !== void 0 ? classesCount : _colors.defaultClasses;
144
+ const color = colorClass !== null && colorClass !== void 0 ? colorClass : _colors.defaultColorScaleName;
145
+ const colorScale = [...(0, _colors.getColorPalette)(color, count)].reverse();
146
+ const maxLegendValue = 5 * Math.ceil(maxValue / 5);
147
+ const range = maxLegendValue / count;
148
+ const values = [];
149
+ let legendColorsIterator = colorScale.length - 1;
150
+ for (let i = 0; i < maxLegendValue; i += range) {
151
+ const id = colorScale[legendColorsIterator];
152
+ values.push({
153
+ startValue: Math.floor(i),
154
+ endValue: Math.floor(i + range),
155
+ id,
156
+ color: id
157
+ });
158
+ legendColorsIterator--;
159
+ }
160
+ return values.reverse();
161
+ }
@@ -0,0 +1,127 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.SingleValuesWithDecimalPlaces = exports.Default = exports.AnimatedSingleValue = exports.AnimatedAllValues = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _ = require(".");
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+ const Template = args => /*#__PURE__*/_react.default.createElement(_.SingleValueContainer, args);
11
+ const Default = Template.bind({});
12
+ exports.Default = Default;
13
+ Default.args = {
14
+ title: "PRIORITY INDICATORS",
15
+ singleValueItems: [{
16
+ label: "Total Bookings",
17
+ value: 136
18
+ }, {
19
+ label: "At least one dose",
20
+ value: 45,
21
+ percentage: 23,
22
+ color: "#0D47A1"
23
+ }, {
24
+ label: "Partially vaccinated",
25
+ value: 13,
26
+ percentage: 17,
27
+ color: "#0D47A1"
28
+ }, {
29
+ label: "Fully vaccinated",
30
+ value: 126,
31
+ percentage: 83,
32
+ color: "#0D47A1"
33
+ }, {
34
+ label: "Number of AEFI",
35
+ value: 26
36
+ }]
37
+ };
38
+ const AnimatedAllValues = Template.bind({});
39
+ exports.AnimatedAllValues = AnimatedAllValues;
40
+ AnimatedAllValues.args = {
41
+ title: "PRIORITY INDICATORS",
42
+ animationDuration: 1500,
43
+ animationDelay: 500,
44
+ singleValueItems: [{
45
+ label: "Total Bookings",
46
+ value: 136344
47
+ }, {
48
+ label: "At least one dose",
49
+ value: 4423,
50
+ percentage: 23,
51
+ color: "#0D47A1"
52
+ }, {
53
+ label: "Partially vaccinated",
54
+ value: 1394,
55
+ percentage: 17,
56
+ color: "#0D47A1"
57
+ }, {
58
+ label: "Fully vaccinated",
59
+ value: 12432,
60
+ percentage: 83,
61
+ color: "#0D47A1"
62
+ }, {
63
+ label: "Number of AEFI",
64
+ value: 26423
65
+ }]
66
+ };
67
+ const AnimatedSingleValue = Template.bind({});
68
+ exports.AnimatedSingleValue = AnimatedSingleValue;
69
+ AnimatedSingleValue.args = {
70
+ title: "PRIORITY INDICATORS",
71
+ singleValueItems: [{
72
+ label: "Total Bookings",
73
+ value: 13634244,
74
+ animationDuration: 1000,
75
+ animationDelay: 100
76
+ }, {
77
+ label: "At least one dose",
78
+ value: 45423,
79
+ percentage: 23,
80
+ color: "#0D47A1",
81
+ animationDuration: 1000,
82
+ animationDelay: 600
83
+ }, {
84
+ label: "Partially vaccinated",
85
+ value: 13434,
86
+ percentage: 17,
87
+ color: "#0D47A1",
88
+ animationDuration: 1000,
89
+ animationDelay: 1100
90
+ }, {
91
+ label: "Fully vaccinated",
92
+ value: 126432,
93
+ percentage: 83,
94
+ color: "#0D47A1",
95
+ animationDuration: 1000,
96
+ animationDelay: 1600
97
+ }, {
98
+ label: "Number of AEFI",
99
+ value: 268423,
100
+ animationDuration: 1000,
101
+ animationDelay: 2000
102
+ }]
103
+ };
104
+ const SingleValuesWithDecimalPlaces = Template.bind({});
105
+ exports.SingleValuesWithDecimalPlaces = SingleValuesWithDecimalPlaces;
106
+ SingleValuesWithDecimalPlaces.args = {
107
+ title: "ENROLLMENTS",
108
+ animationDuration: 1500,
109
+ animationDelay: 500,
110
+ singleValueItems: [{
111
+ label: "Number of Enrolled Clients",
112
+ value: 268423,
113
+ decimalPlaces: 3
114
+ }, {
115
+ label: "Number of Served Clients",
116
+ value: 268423,
117
+ decimalPlaces: 1
118
+ }]
119
+ };
120
+ var _default = {
121
+ title: "Components/Single Value Container",
122
+ component: _.SingleValueContainer,
123
+ decorators: [SingleValueStory => {
124
+ return /*#__PURE__*/_react.default.createElement(SingleValueStory, null);
125
+ }]
126
+ };
127
+ exports.default = _default;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ var _react = require("@cypress/react");
4
+ var _react2 = _interopRequireDefault(require("react"));
5
+ var _ = require(".");
6
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
7
+ describe("Single Value Container Tests", () => {
8
+ it("should render", function () {
9
+ const arg = {
10
+ title: "PRIORITY INDICATORS",
11
+ singleValueItems: [{
12
+ label: "Total Bookings",
13
+ value: 136
14
+ }, {
15
+ label: "At least one dose",
16
+ value: 45,
17
+ percentage: 23,
18
+ color: "#0D47A1"
19
+ }]
20
+ };
21
+ (0, _react.mount)( /*#__PURE__*/_react2.default.createElement(_.SingleValueContainer, arg));
22
+ });
23
+ });
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = SingleValueItem;
7
+ var _ui = require("@dhis2/ui");
8
+ var _lodash = require("lodash");
9
+ var _react = _interopRequireDefault(require("react"));
10
+ var _reactSpring = require("react-spring");
11
+ var _SingleValueContainerModule = _interopRequireDefault(require("../../styles/SingleValueContainer.module.css"));
12
+ var _SingleValuePercentage = _interopRequireDefault(require("./SingleValuePercentage"));
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+ function SingleValueItem(_ref) {
15
+ var _ref2, _ref3;
16
+ let {
17
+ label,
18
+ value,
19
+ color,
20
+ percentage,
21
+ animationDuration,
22
+ animationDelay,
23
+ globalAnimationDelay,
24
+ decimalPlaces,
25
+ globalAnimationDuration
26
+ } = _ref;
27
+ const numberFormatter = value => Intl.NumberFormat("en-US", {
28
+ notation: "compact",
29
+ maximumFractionDigits: decimalPlaces !== null && decimalPlaces !== void 0 ? decimalPlaces : 1
30
+ }).format(value);
31
+ const sanitizedValue = (0, _reactSpring.useSpring)({
32
+ val: value,
33
+ from: {
34
+ val: 0
35
+ },
36
+ config: {
37
+ duration: (_ref2 = animationDuration !== null && animationDuration !== void 0 ? animationDuration : globalAnimationDuration) !== null && _ref2 !== void 0 ? _ref2 : 1000
38
+ },
39
+ delay: (_ref3 = animationDelay !== null && animationDelay !== void 0 ? animationDelay : globalAnimationDelay) !== null && _ref3 !== void 0 ? _ref3 : 10
40
+ });
41
+ const tooltipContent = `${label}: ${value}`;
42
+ return /*#__PURE__*/_react.default.createElement("div", {
43
+ className: `${_SingleValueContainerModule.default["single-value-item"]} text-center`
44
+ }, /*#__PURE__*/_react.default.createElement("div", {
45
+ className: _SingleValueContainerModule.default["font-large"]
46
+ }, label), /*#__PURE__*/_react.default.createElement(_ui.Tooltip, {
47
+ content: (0, _lodash.capitalize)(tooltipContent)
48
+ }, /*#__PURE__*/_react.default.createElement(_reactSpring.animated.div, {
49
+ className: `${_SingleValueContainerModule.default["font-bold"]} ${_SingleValueContainerModule.default["font-xx-large"]} ${_SingleValueContainerModule.default["padding-top"]}`
50
+ }, sanitizedValue.val.to(value => numberFormatter(Math.floor(value))))), percentage ? /*#__PURE__*/_react.default.createElement(_SingleValuePercentage.default, {
51
+ color: color,
52
+ percentage: percentage
53
+ }) : /*#__PURE__*/_react.default.createElement("span", null));
54
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = SingleValuePercentage;
7
+ var _ui = require("@dhis2/ui");
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _SingleValueContainerModule = _interopRequireDefault(require("../../styles/SingleValueContainer.module.css"));
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+ function SingleValuePercentage(_ref) {
12
+ let {
13
+ percentage,
14
+ color
15
+ } = _ref;
16
+ const width = "100%";
17
+ return /*#__PURE__*/_react.default.createElement("div", {
18
+ className: "w-100"
19
+ }, /*#__PURE__*/_react.default.createElement(_ui.LinearLoader, {
20
+ className: _SingleValueContainerModule.default["percent-value"],
21
+ width: width,
22
+ amount: percentage
23
+ }));
24
+ }
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.SingleValueContainer = SingleValueContainer;
7
+ Object.defineProperty(exports, "SingleValueItem", {
8
+ enumerable: true,
9
+ get: function () {
10
+ return _SingleValueItem.default;
11
+ }
12
+ });
13
+ var _d2I18n = _interopRequireDefault(require("@dhis2/d2-i18n"));
14
+ var _ui = require("@dhis2/ui");
15
+ var _react = _interopRequireWildcard(require("react"));
16
+ var _SingleValueItem = _interopRequireDefault(require("./components/SingleValueItem/SingleValueItem"));
17
+ var _SingleValueContainerModule = _interopRequireDefault(require("./styles/SingleValueContainer.module.css"));
18
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
20
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
+ 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); }
22
+ function SingleValueContainer(_ref) {
23
+ let {
24
+ title,
25
+ singleValueItems,
26
+ animationDuration,
27
+ animationDelay
28
+ } = _ref;
29
+ return /*#__PURE__*/_react.default.createElement("div", {
30
+ className: "w-100 h-100"
31
+ }, /*#__PURE__*/_react.default.createElement(_ui.CssReset, null), /*#__PURE__*/_react.default.createElement(_react.Suspense, {
32
+ fallback: /*#__PURE__*/_react.default.createElement("div", null, _d2I18n.default.t("Loading ..."))
33
+ }, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("span", {
34
+ className: `${_SingleValueContainerModule.default["font-x-large"]} ${_SingleValueContainerModule.default["font-bold"]}`
35
+ }, title), /*#__PURE__*/_react.default.createElement("div", {
36
+ className: _SingleValueContainerModule.default["single-value-list"]
37
+ }, singleValueItems.map(singleValueItem => /*#__PURE__*/_react.default.createElement(_SingleValueItem.default, _extends({
38
+ key: `${singleValueItem.label}-${singleValueItem.value}`
39
+ }, singleValueItem, {
40
+ globalAnimationDuration: animationDuration,
41
+ globalAnimationDelay: animationDelay
42
+ })))))));
43
+ }
File without changes
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = MapDataProvider;
7
+ var _appRuntime = require("@dhis2/app-runtime");
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _map = _interopRequireDefault(require("../data/map.json"));
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+ function MapDataProvider(_ref) {
12
+ let {
13
+ children
14
+ } = _ref;
15
+ return /*#__PURE__*/_react.default.createElement(_appRuntime.CustomDataProvider, {
16
+ data: {
17
+ ..._map.default,
18
+ geoFeatures: async (type, query) => {
19
+ return _map.default.geoFeatures;
20
+ },
21
+ analytics: async (type, query) => {
22
+ var _query$params;
23
+ if (query !== null && query !== void 0 && (_query$params = query.params) !== null && _query$params !== void 0 && _query$params.skipData) {
24
+ return _map.default.analytics;
25
+ } else {
26
+ return _map.default.analyticsWithData;
27
+ }
28
+ }
29
+ }
30
+ }, children);
31
+ }
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _Map = require("./components/Map");
7
+ Object.keys(_Map).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _Map[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _Map[key];
14
+ }
15
+ });
16
+ });
17
+ var _CircularProgressDashboard = require("./components/CircularProgressDashboard");
18
+ Object.keys(_CircularProgressDashboard).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _CircularProgressDashboard[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _CircularProgressDashboard[key];
25
+ }
26
+ });
27
+ });
28
+ var _ChartAnalytics = require("./components/ChartAnalytics");
29
+ Object.keys(_ChartAnalytics).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (key in exports && exports[key] === _ChartAnalytics[key]) return;
32
+ Object.defineProperty(exports, key, {
33
+ enumerable: true,
34
+ get: function () {
35
+ return _ChartAnalytics[key];
36
+ }
37
+ });
38
+ });
39
+ var _SingleValueContainer = require("./components/SingleValueContainer");
40
+ Object.keys(_SingleValueContainer).forEach(function (key) {
41
+ if (key === "default" || key === "__esModule") return;
42
+ if (key in exports && exports[key] === _SingleValueContainer[key]) return;
43
+ Object.defineProperty(exports, key, {
44
+ enumerable: true,
45
+ get: function () {
46
+ return _SingleValueContainer[key];
47
+ }
48
+ });
49
+ });
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ describe('Just a test', function () {
4
+ test("", () => {
5
+ expect(true).toBe(true);
6
+ });
7
+ });