@dhis2/analytics 23.10.4 → 23.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [23.11.0](https://github.com/dhis2/analytics/compare/v23.10.4...v23.11.0) (2022-06-03)
2
+
3
+
4
+ ### Features
5
+
6
+ * export getColorByValueFromLegendSet ([#1249](https://github.com/dhis2/analytics/issues/1249)) ([6ce534d](https://github.com/dhis2/analytics/commit/6ce534d1d63d8aeac6ea44e7742681c10f57d709))
7
+
1
8
  ## [23.10.4](https://github.com/dhis2/analytics/compare/v23.10.3...v23.10.4) (2022-05-31)
2
9
 
3
10
 
@@ -7,7 +7,7 @@ exports.default = void 0;
7
7
 
8
8
  var _ui = require("@dhis2/ui");
9
9
 
10
- const _defaultExport = [".container.jsx-3203773516{width:180px;background:".concat(_ui.colors.white, ";padding:").concat(_ui.spacers.dp8, ";border:1px solid ").concat(_ui.colors.grey400, ";}"), ".legendSet.jsx-3203773516{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;margin-left:".concat(_ui.spacers.dp4, ";}"), ".legendSetName.jsx-3203773516{display:inline-block;font-size:13px;color:".concat(_ui.colors.grey700, ";margin-bottom:2px;}"), ".legend.jsx-3203773516{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;padding:".concat(_ui.spacers.dp4, " 0 ").concat(_ui.spacers.dp4, " 6px;white-space:break-spaces;text-align:left;font-size:13px;}"), ".values.jsx-3203773516{color:".concat(_ui.colors.grey600, ";font-size:12px;padding-top:2px;}"), ".divider.jsx-3203773516{border-top:1px solid ".concat(_ui.colors.grey400, ";padding-top:").concat(_ui.spacers.dp8, ";margin-top:").concat(_ui.spacers.dp8, ";}")];
11
- _defaultExport.__hash = "3203773516";
10
+ const _defaultExport = [".container.jsx-2467849725{width:180px;background:".concat(_ui.colors.white, ";padding:").concat(_ui.spacers.dp8, ";}"), ".legendSet.jsx-2467849725{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;margin-left:".concat(_ui.spacers.dp4, ";}"), ".legendSetName.jsx-2467849725{display:inline-block;font-size:13px;color:".concat(_ui.colors.grey700, ";margin-bottom:2px;}"), ".legend.jsx-2467849725{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;padding:".concat(_ui.spacers.dp4, " 0 ").concat(_ui.spacers.dp4, " 6px;white-space:break-spaces;text-align:left;font-size:13px;}"), ".values.jsx-2467849725{color:".concat(_ui.colors.grey600, ";font-size:12px;padding-top:2px;}"), ".divider.jsx-2467849725{border-top:1px solid ".concat(_ui.colors.grey400, ";padding-top:").concat(_ui.spacers.dp8, ";margin-top:").concat(_ui.spacers.dp8, ";}")];
11
+ _defaultExport.__hash = "2467849725";
12
12
  var _default = _defaultExport;
13
13
  exports.default = _default;
@@ -1131,6 +1131,12 @@ Object.defineProperty(exports, "getAxisPerLockedDimension", {
1131
1131
  return _index5.getAxisPerLockedDimension;
1132
1132
  }
1133
1133
  });
1134
+ Object.defineProperty(exports, "getColorByValueFromLegendSet", {
1135
+ enumerable: true,
1136
+ get: function () {
1137
+ return _legends.getColorByValueFromLegendSet;
1138
+ }
1139
+ });
1134
1140
  Object.defineProperty(exports, "getDimensionById", {
1135
1141
  enumerable: true,
1136
1142
  get: function () {
@@ -13,8 +13,12 @@ exports.LEGEND_DISPLAY_STYLE_FILL = LEGEND_DISPLAY_STYLE_FILL;
13
13
  const LEGEND_DISPLAY_STYLE_TEXT = 'TEXT';
14
14
  exports.LEGEND_DISPLAY_STYLE_TEXT = LEGEND_DISPLAY_STYLE_TEXT;
15
15
 
16
- const getLegendByValueFromLegendSet = (legendSet, value) => legendSet.legends.find(legend => value >= legend.startValue && value < legend.endValue // TODO: Confirm inclusive/exclusive bounds
17
- );
16
+ const getLegendByValueFromLegendSet = (legendSet, value) => {
17
+ var _legendSet$legends;
18
+
19
+ return legendSet === null || legendSet === void 0 ? void 0 : (_legendSet$legends = legendSet.legends) === null || _legendSet$legends === void 0 ? void 0 : _legendSet$legends.find(legend => value >= legend.startValue && value < legend.endValue // TODO: Confirm inclusive/exclusive bounds
20
+ );
21
+ };
18
22
 
19
23
  exports.getLegendByValueFromLegendSet = getLegendByValueFromLegendSet;
20
24
 
@@ -1,4 +1,4 @@
1
1
  import { spacers, colors } from '@dhis2/ui';
2
- const _defaultExport = [".container.jsx-3203773516{width:180px;background:".concat(colors.white, ";padding:").concat(spacers.dp8, ";border:1px solid ").concat(colors.grey400, ";}"), ".legendSet.jsx-3203773516{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;margin-left:".concat(spacers.dp4, ";}"), ".legendSetName.jsx-3203773516{display:inline-block;font-size:13px;color:".concat(colors.grey700, ";margin-bottom:2px;}"), ".legend.jsx-3203773516{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;padding:".concat(spacers.dp4, " 0 ").concat(spacers.dp4, " 6px;white-space:break-spaces;text-align:left;font-size:13px;}"), ".values.jsx-3203773516{color:".concat(colors.grey600, ";font-size:12px;padding-top:2px;}"), ".divider.jsx-3203773516{border-top:1px solid ".concat(colors.grey400, ";padding-top:").concat(spacers.dp8, ";margin-top:").concat(spacers.dp8, ";}")];
3
- _defaultExport.__hash = "3203773516";
2
+ const _defaultExport = [".container.jsx-2467849725{width:180px;background:".concat(colors.white, ";padding:").concat(spacers.dp8, ";}"), ".legendSet.jsx-2467849725{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;margin-left:".concat(spacers.dp4, ";}"), ".legendSetName.jsx-2467849725{display:inline-block;font-size:13px;color:".concat(colors.grey700, ";margin-bottom:2px;}"), ".legend.jsx-2467849725{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;padding:".concat(spacers.dp4, " 0 ").concat(spacers.dp4, " 6px;white-space:break-spaces;text-align:left;font-size:13px;}"), ".values.jsx-2467849725{color:".concat(colors.grey600, ";font-size:12px;padding-top:2px;}"), ".divider.jsx-2467849725{border-top:1px solid ".concat(colors.grey400, ";padding-top:").concat(spacers.dp8, ";margin-top:").concat(spacers.dp8, ";}")];
3
+ _defaultExport.__hash = "2467849725";
4
4
  export default _defaultExport;
package/build/es/index.js CHANGED
@@ -81,7 +81,7 @@ export { createVisualization } from './visualizations/index.js'; // Modules: fon
81
81
 
82
82
  export { FONT_STYLE_VISUALIZATION_TITLE, FONT_STYLE_VISUALIZATION_SUBTITLE, FONT_STYLE_HORIZONTAL_AXIS_TITLE, FONT_STYLE_VERTICAL_AXIS_TITLE, FONT_STYLE_LEGEND, FONT_STYLE_AXIS_LABELS, FONT_STYLE_REGRESSION_LINE_LABEL, FONT_STYLE_OPTION_FONT, FONT_STYLE_OPTION_FONT_SIZE, FONT_STYLE_OPTION_BOLD, FONT_STYLE_OPTION_ITALIC, FONT_STYLE_OPTION_UNDERLINE, FONT_STYLE_OPTION_TEXT_COLOR, FONT_STYLE_OPTION_TEXT_ALIGN, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER, TEXT_ALIGN_RIGHT, defaultFontStyle, getFontSizeOptions, getTextAlignOptions, deleteFontStyleOption } from './modules/fontStyle.js'; // Modules: legend
83
83
 
84
- export { LEGEND_DISPLAY_STRATEGY_BY_DATA_ITEM, LEGEND_DISPLAY_STRATEGY_FIXED, LEGEND_DISPLAY_STYLE_FILL, LEGEND_DISPLAY_STYLE_TEXT } from './modules/legends.js'; // Modules: general
84
+ export { LEGEND_DISPLAY_STRATEGY_BY_DATA_ITEM, LEGEND_DISPLAY_STRATEGY_FIXED, LEGEND_DISPLAY_STYLE_FILL, LEGEND_DISPLAY_STYLE_TEXT, getColorByValueFromLegendSet } from './modules/legends.js'; // Modules: general
85
85
 
86
86
  export { renderValue as formatValue } from './modules/renderValue.js'; // Utils: colorSets
87
87
 
@@ -2,8 +2,12 @@ export const LEGEND_DISPLAY_STRATEGY_BY_DATA_ITEM = 'BY_DATA_ITEM';
2
2
  export const LEGEND_DISPLAY_STRATEGY_FIXED = 'FIXED';
3
3
  export const LEGEND_DISPLAY_STYLE_FILL = 'FILL';
4
4
  export const LEGEND_DISPLAY_STYLE_TEXT = 'TEXT';
5
- export const getLegendByValueFromLegendSet = (legendSet, value) => legendSet.legends.find(legend => value >= legend.startValue && value < legend.endValue // TODO: Confirm inclusive/exclusive bounds
6
- );
5
+ export const getLegendByValueFromLegendSet = (legendSet, value) => {
6
+ var _legendSet$legends;
7
+
8
+ return legendSet === null || legendSet === void 0 ? void 0 : (_legendSet$legends = legendSet.legends) === null || _legendSet$legends === void 0 ? void 0 : _legendSet$legends.find(legend => value >= legend.startValue && value < legend.endValue // TODO: Confirm inclusive/exclusive bounds
9
+ );
10
+ };
7
11
  export const getColorByValueFromLegendSet = (legendSet, value) => {
8
12
  const legend = getLegendByValueFromLegendSet(legendSet, value);
9
13
  return legend && legend.color;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhis2/analytics",
3
- "version": "23.10.4",
3
+ "version": "23.11.0",
4
4
  "main": "./build/cjs/index.js",
5
5
  "module": "./build/es/index.js",
6
6
  "exports": {
@@ -35,7 +35,7 @@
35
35
  "@dhis2/cli-app-scripts": "^9.0.0",
36
36
  "@dhis2/cli-style": "^10.4.1",
37
37
  "@dhis2/d2-i18n": "^1.1.0",
38
- "@dhis2/ui": "^8.2.5",
38
+ "@dhis2/ui": "^8.3.1",
39
39
  "@sambego/storybook-state": "^2.0.1",
40
40
  "@storybook/addons": "^6.1.14",
41
41
  "@storybook/preset-create-react-app": "^3.1.7",