oolib 2.192.2 → 2.193.1

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.
@@ -13,7 +13,7 @@ export function BarGraphCollection({ data: originalData, valuePath, labelPath, t
13
13
  totalDataCount: any;
14
14
  debug: any;
15
15
  }): React.JSX.Element;
16
- export function BarGraph({ tagCategory, index1, showCount, showPercent, onClick, debug }: {
16
+ export function BarGraph({ tagCategory, index1, showCount, showPercent, onClick, debug, }: {
17
17
  tagCategory: any;
18
18
  index1: any;
19
19
  showCount?: boolean;
@@ -75,7 +75,10 @@ var BarGraphCollection = function (_a) {
75
75
  if ((data === null || data === void 0 ? void 0 : data.length) === 0) {
76
76
  return null;
77
77
  }
78
+ var barDivisions = (0, useGetDimensions_1.divideBarIntoEqualParts)(highestCount);
78
79
  return (react_1.default.createElement(styled_1.StyledBarGraphContainer, { style: { width: "auto" }, ref: containerRef },
80
+ react_1.default.createElement("div", { style: { position: "absolute", left: 50, height: "".concat(exports.BAR_GRAPH_HEIGHT, "px"), width: "20px" } },
81
+ react_1.default.createElement(styled_1.YAxisLabels, null, (0, styled_1.generateYAxisValues)(barDivisions).map(function (value, index) { return (react_1.default.createElement(__2.UI_BODY_SM, { key: index }, String(value))); }))),
79
82
  react_1.default.createElement(styled_1.StyledBarGraphCollectionWrapper, { style: {
80
83
  width: "auto",
81
84
  gap: "".concat(exports.BAR_GAP, "rem"),
@@ -90,7 +93,7 @@ var BarGraphCollection = function (_a) {
90
93
  height: "".concat(exports.BAR_GRAPH_HEIGHT + 50, "px"),
91
94
  marginBottom: "0.6rem"
92
95
  } },
93
- react_1.default.createElement(exports.BarGraph, { tagCategory: tagCategory, index1: index1, showCount: showCount, showPercent: showPercent, onClick: onClick, debug: debug }),
96
+ react_1.default.createElement(exports.BarGraph, { tagCategory: tagCategory, index1: index1, showCount: showCount, showPercent: showPercent, onClick: onClick, debug: debug, highestCount: highestCount }),
94
97
  categoryTitle && react_1.default.createElement("div", { title: categoryTitle, style: {
95
98
  width: "".concat(tagCategory === null || tagCategory === void 0 ? void 0 : tagCategory.width, "px"),
96
99
  background: grey5,
@@ -5,3 +5,5 @@ export const StyledBarGraphWrapper: import("styled-components").StyledComponent<
5
5
  export const StyledSingleBarWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
6
6
  export const StyledBar: import("styled-components").StyledComponent<"div", any, {}, never>;
7
7
  export const StyledLabelWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
8
+ export const YAxisLabels: import("styled-components").StyledComponent<"div", any, {}, never>;
9
+ export function generateYAxisValues(barDivisions: any): any[];
@@ -3,19 +3,49 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
3
3
  if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
4
  return cooked;
5
5
  };
6
- var __importDefault = (this && this.__importDefault) || function (mod) {
7
- return (mod && mod.__esModule) ? mod : { "default": mod };
8
- };
6
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
+ if (k2 === undefined) k2 = k;
8
+ var desc = Object.getOwnPropertyDescriptor(m, k);
9
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
10
+ desc = { enumerable: true, get: function() { return m[k]; } };
11
+ }
12
+ Object.defineProperty(o, k2, desc);
13
+ }) : (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ o[k2] = m[k];
16
+ }));
17
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
18
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
19
+ }) : function(o, v) {
20
+ o["default"] = v;
21
+ });
22
+ var __importStar = (this && this.__importStar) || (function () {
23
+ var ownKeys = function(o) {
24
+ ownKeys = Object.getOwnPropertyNames || function (o) {
25
+ var ar = [];
26
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
27
+ return ar;
28
+ };
29
+ return ownKeys(o);
30
+ };
31
+ return function (mod) {
32
+ if (mod && mod.__esModule) return mod;
33
+ var result = {};
34
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
35
+ __setModuleDefault(result, mod);
36
+ return result;
37
+ };
38
+ })();
9
39
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.StyledLabelWrapper = exports.StyledBar = exports.StyledSingleBarWrapper = exports.StyledBarGraphWrapper = exports.StyledBarGraphCollectionWrapper = exports.StyledBarGraphContainer = exports.CONTAINER_PADDING = void 0;
11
- var styled_components_1 = __importDefault(require("styled-components"));
40
+ exports.generateYAxisValues = exports.YAxisLabels = exports.StyledLabelWrapper = exports.StyledBar = exports.StyledSingleBarWrapper = exports.StyledBarGraphWrapper = exports.StyledBarGraphCollectionWrapper = exports.StyledBarGraphContainer = exports.CONTAINER_PADDING = void 0;
41
+ var styled_components_1 = __importStar(require("styled-components"));
12
42
  var __1 = require("../../../..");
13
43
  exports.CONTAINER_PADDING = 10;
14
44
  var barColor = __1.colors2.secondaryContainer; // temp color
15
45
  var grey5 = __1.colors2.grey5;
16
46
  exports.StyledBarGraphContainer = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding: ", "px;\n padding-bottom: 0.4rem; // UI scroll bar bottom space \n overflow-x: auto;\n background-color: white;\n border-radius: 8px;\n"], ["\n padding: ", "px;\n padding-bottom: 0.4rem; // UI scroll bar bottom space \n overflow-x: auto;\n background-color: white;\n border-radius: 8px;\n"])), exports.CONTAINER_PADDING);
17
47
  exports.StyledBarGraphCollectionWrapper = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n"], ["\n display: flex;\n"])));
18
- exports.StyledBarGraphWrapper = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: flex;\n position: relative;\n "], ["\n display: flex;\n position: relative;\n "])));
48
+ exports.StyledBarGraphWrapper = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: flex;\n position: relative;\n\n "], ["\n display: flex;\n position: relative;\n\n "])));
19
49
  var generateDebugLines = function (barSections, debug) {
20
50
  if (!debug)
21
51
  return '';
@@ -36,4 +66,27 @@ exports.StyledSingleBarWrapper = styled_components_1.default.div(templateObject_
36
66
  });
37
67
  exports.StyledBar = styled_components_1.default.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n border-radius: 2px;\n background-color: ", ";\n color: ", ";\n position: relative;\n ", ";\n"], ["\n border-radius: 2px;\n background-color: ", ";\n color: ", ";\n position: relative;\n ", ";\n"])), barColor, __1.colors2.onSecondary, (0, __1.transition)("width"));
38
68
  exports.StyledLabelWrapper = styled_components_1.default.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n position: absolute;\n transform: rotate(-90deg);\n transform-origin: left top;\n bottom: 0;\n left: calc(50% - 8px); // 10px for font\n text-wrap: nowrap;\n display: flex;\n"], ["\n position: absolute;\n transform: rotate(-90deg);\n transform-origin: left top;\n bottom: 0;\n left: calc(50% - 8px); // 10px for font\n text-wrap: nowrap;\n display: flex;\n"])));
39
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
69
+ exports.YAxisLabels = styled_components_1.default.div(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n height: inherit;\n display: flex;\n\n flex-direction: column-reverse;\n justify-content: space-between;\n\n color: ", ";\n z-index: 100;\n"], ["\n height: inherit;\n display: flex;\n\n flex-direction: column-reverse;\n justify-content: space-between;\n\n color: ", ";\n z-index: 100;\n"])), __1.colors2.grey50);
70
+ var generateYAxisValues = function (barDivisions) {
71
+ // For 5 labels, we want to divide the range into 4 equal parts
72
+ var numLabels = 5;
73
+ var step = barDivisions / (numLabels - 1);
74
+ var values = [];
75
+ for (var i = 0; i < numLabels; i++) {
76
+ values.push(Math.round(step * i));
77
+ }
78
+ // Ensure the last value is exactly barDivisions to avoid rounding errors
79
+ values[values.length - 1] = barDivisions;
80
+ var uniqueValues = [];
81
+ var seen = new Set();
82
+ for (var _i = 0, values_1 = values; _i < values_1.length; _i++) {
83
+ var value = values_1[_i];
84
+ if (!seen.has(value)) {
85
+ uniqueValues.push(value);
86
+ seen.add(value);
87
+ }
88
+ }
89
+ return uniqueValues;
90
+ };
91
+ exports.generateYAxisValues = generateYAxisValues;
92
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;
@@ -1 +1,2 @@
1
+ export function divideBarIntoEqualParts(num: any): any;
1
2
  export function useGetDimensions(data: any, maxHeight: any, containerWidth: any, totalDataCount: any, highestCount: any): any;
@@ -11,9 +11,22 @@ var __assign = (this && this.__assign) || function () {
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.useGetDimensions = void 0;
14
+ exports.useGetDimensions = exports.divideBarIntoEqualParts = void 0;
15
15
  var __1 = require("..");
16
16
  var styled_1 = require("../styled");
17
+ var divideBarIntoEqualParts = function (num) {
18
+ if (num <= 100)
19
+ return num;
20
+ if (num <= 200)
21
+ return 200;
22
+ if (num <= 500)
23
+ return 500;
24
+ if (num <= 1000)
25
+ return 1000;
26
+ var magnitude = Math.pow(10, Math.floor(Math.log10(num)));
27
+ return Math.ceil(num / magnitude) * magnitude;
28
+ };
29
+ exports.divideBarIntoEqualParts = divideBarIntoEqualParts;
17
30
  var useGetDimensions = function (data, maxHeight, containerWidth, totalDataCount, highestCount) {
18
31
  var singleBarWidth;
19
32
  var totalBars = data === null || data === void 0 ? void 0 : data.reduce(function (total, tagCategory) {
@@ -26,25 +39,7 @@ var useGetDimensions = function (data, maxHeight, containerWidth, totalDataCount
26
39
  var dynamicBarWidth = availableWidthForBars / totalBars;
27
40
  singleBarWidth = Math.max(dynamicBarWidth, __1.DEFAULT_SINGLE_BAR_WIDTH);
28
41
  // Calculate the ceiling value for the highest count
29
- var divideBarIntoEqualParts = function (num) {
30
- if (num <= 10)
31
- return num;
32
- if (num <= 20)
33
- return 20;
34
- if (num <= 50)
35
- return 50;
36
- if (num <= 100)
37
- return 100;
38
- if (num <= 200)
39
- return 200;
40
- if (num <= 500)
41
- return 500;
42
- if (num <= 1000)
43
- return 1000;
44
- var magnitude = Math.pow(10, Math.floor(Math.log10(num)));
45
- return Math.ceil(num / magnitude) * magnitude;
46
- };
47
- var barSections = divideBarIntoEqualParts(highestCount);
42
+ var barSections = (0, exports.divideBarIntoEqualParts)(highestCount);
48
43
  return data === null || data === void 0 ? void 0 : data.map(function (category) {
49
44
  // total count for this category
50
45
  var total = category.tagSpecificCount.reduce(function (sum, tag) { return sum + tag.count; }, 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oolib",
3
- "version": "2.192.2",
3
+ "version": "2.193.1",
4
4
  "description": " OKE Component Library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",