oolib 2.199.3 → 2.199.5

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.
@@ -55,7 +55,7 @@ declare namespace _default {
55
55
  control: string;
56
56
  options: string[];
57
57
  };
58
- statusTagVariant: {
58
+ statusTagColorPreset: {
59
59
  name: string;
60
60
  control: string;
61
61
  options: string[];
@@ -54,7 +54,7 @@ declare namespace _default {
54
54
  control: string;
55
55
  options: string[];
56
56
  };
57
- statusTagVariant: {
57
+ statusTagColorPreset: {
58
58
  name: string;
59
59
  control: string;
60
60
  options: string[];
@@ -77,7 +77,7 @@ export namespace commonCardArgTypes {
77
77
  let options_1: string[];
78
78
  export { options_1 as options };
79
79
  }
80
- export namespace statusTagVariant {
80
+ export namespace statusTagColorPreset {
81
81
  let name_8: string;
82
82
  export { name_8 as name };
83
83
  let control_8: string;
@@ -49,8 +49,8 @@ exports.commonCardArgTypes = {
49
49
  control: 'select',
50
50
  options: [undefined, 'primary', 'secondary'],
51
51
  },
52
- statusTagVariant: {
53
- name: "Status Tag Variant",
52
+ statusTagColorPreset: {
53
+ name: "Status Tag Color preset",
54
54
  control: 'select',
55
55
  options: [undefined, 'primary', 'secondary', 'positive', 'inProgress', 'warning', 'negative', 'special', 'grey'],
56
56
  },
@@ -1,4 +1,4 @@
1
- export function parseCardArgs({ cardLabel, title, mediaType, image, video, metaName, metaDate, statusTag, disabled, tagDisplay, highlight, desc, statusTagVariant }: {
1
+ export function parseCardArgs({ cardLabel, title, mediaType, image, video, metaName, metaDate, statusTag, disabled, tagDisplay, highlight, desc, statusTagColorPreset }: {
2
2
  cardLabel: any;
3
3
  title: any;
4
4
  mediaType: any;
@@ -11,7 +11,7 @@ export function parseCardArgs({ cardLabel, title, mediaType, image, video, metaN
11
11
  tagDisplay: any;
12
12
  highlight: any;
13
13
  desc: any;
14
- statusTagVariant: any;
14
+ statusTagColorPreset: any;
15
15
  }): {
16
16
  data: {
17
17
  title: any;
@@ -39,10 +39,10 @@ export function parseCardArgs({ cardLabel, title, mediaType, image, video, metaN
39
39
  title: string;
40
40
  cardLabel: string;
41
41
  tagDisplay: string;
42
- statusTagVariant: string;
42
+ statusTagColorPreset: string;
43
43
  desc: string;
44
44
  };
45
45
  disabled: any;
46
46
  highlight: any;
47
- statusTagVariant: any;
47
+ statusTagColorPreset: any;
48
48
  };
@@ -22,7 +22,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.parseCardArgs = void 0;
24
24
  var parseCardArgs = function (_a) {
25
- var cardLabel = _a.cardLabel, title = _a.title, mediaType = _a.mediaType, image = _a.image, video = _a.video, metaName = _a.metaName, metaDate = _a.metaDate, statusTag = _a.statusTag, disabled = _a.disabled, tagDisplay = _a.tagDisplay, highlight = _a.highlight, desc = _a.desc, statusTagVariant = _a.statusTagVariant;
25
+ var cardLabel = _a.cardLabel, title = _a.title, mediaType = _a.mediaType, image = _a.image, video = _a.video, metaName = _a.metaName, metaDate = _a.metaDate, statusTag = _a.statusTag, disabled = _a.disabled, tagDisplay = _a.tagDisplay, highlight = _a.highlight, desc = _a.desc, statusTagColorPreset = _a.statusTagColorPreset;
26
26
  var data = {
27
27
  title: title,
28
28
  cardLabel: cardLabel,
@@ -34,14 +34,14 @@ var parseCardArgs = function (_a) {
34
34
  tagDisplay: tagDisplay,
35
35
  desc: desc,
36
36
  };
37
- var config = __assign(__assign(__assign({ title: "title", cardLabel: "cardLabel", tagDisplay: "tagDisplay", statusTagVariant: 'statusTagVariant', desc: "desc" }, (mediaType === "image" ? { image: "image" } : {})), (mediaType === "video" ? { video: "video" } : {})), { metaBlock: __spreadArray(__spreadArray([], (metaName ? [{ key: "name", valuePath: "name" }] : []), true), (metaDate ? [{ key: "date", valuePath: "date" }] : []), true) });
37
+ var config = __assign(__assign(__assign({ title: "title", cardLabel: "cardLabel", tagDisplay: "tagDisplay", statusTagColorPreset: 'statusTagColorPreset', desc: "desc" }, (mediaType === "image" ? { image: "image" } : {})), (mediaType === "video" ? { video: "video" } : {})), { metaBlock: __spreadArray(__spreadArray([], (metaName ? [{ key: "name", valuePath: "name" }] : []), true), (metaDate ? [{ key: "date", valuePath: "date" }] : []), true) });
38
38
  return {
39
39
  data: data,
40
40
  statusTag: statusTag,
41
41
  config: config,
42
42
  disabled: disabled,
43
43
  highlight: highlight,
44
- statusTagVariant: statusTagVariant
44
+ statusTagColorPreset: statusTagColorPreset
45
45
  };
46
46
  };
47
47
  exports.parseCardArgs = parseCardArgs;
@@ -1,4 +1,4 @@
1
- export function CardContent({ id, data, config, to, onClick, openInNewTab, highlight, statusTagVariant }: {
1
+ export function CardContent({ id, data, config, to, onClick, openInNewTab, highlight, statusTagColorPreset }: {
2
2
  id: any;
3
3
  data: any;
4
4
  config: any;
@@ -6,6 +6,6 @@ export function CardContent({ id, data, config, to, onClick, openInNewTab, highl
6
6
  onClick: any;
7
7
  openInNewTab: any;
8
8
  highlight: any;
9
- statusTagVariant: any;
9
+ statusTagColorPreset: any;
10
10
  }): React.JSX.Element;
11
11
  import React from "react";
@@ -30,13 +30,13 @@ var CardLabelTag = function (_a) {
30
30
  react_1.default.createElement(Tags_1.TagDisplay, { display: label.toUpperCase(), title: label, XS: true }))) : null;
31
31
  };
32
32
  var StatusTag = function (_a) {
33
- var display = _a.display, isEmbedPresent = _a.isEmbedPresent, isHighlightPresent = _a.isHighlightPresent, statusTagVariant = _a.statusTagVariant, bothTagsDisplayTogether = _a.bothTagsDisplayTogether;
33
+ var display = _a.display, isEmbedPresent = _a.isEmbedPresent, isHighlightPresent = _a.isHighlightPresent, statusTagColorPreset = _a.statusTagColorPreset, bothTagsDisplayTogether = _a.bothTagsDisplayTogether;
34
34
  return display ? (react_1.default.createElement(styled_2.StyledStatusTagWrapper, { isEmbedPresent: isEmbedPresent, isHighlightPresent: isHighlightPresent, bothTagsDisplayTogether: bothTagsDisplayTogether },
35
- react_1.default.createElement(Tags_1.TagDisplay, { display: display, title: display, XS: true, variant: statusTagVariant || "positive" }))) : null;
35
+ react_1.default.createElement(Tags_1.TagDisplay, { display: display, title: display, XS: true, colorPreset: statusTagColorPreset || "positive" }))) : null;
36
36
  };
37
37
  var CardContent = function (_a) {
38
38
  var id = _a.id, data = _a.data, config = _a.config, to = _a.to, onClick = _a.onClick, openInNewTab = _a.openInNewTab, highlight = _a.highlight, // primary | secondary
39
- statusTagVariant = _a.statusTagVariant;
39
+ statusTagColorPreset = _a.statusTagColorPreset;
40
40
  var theme = (0, styled_components_1.useTheme)();
41
41
  var localize = (0, utilsOolib_1.useLocale)();
42
42
  var parseSpecialSyntax = (theme || {}).parseSpecialSyntax;
@@ -56,23 +56,19 @@ var CardContent = function (_a) {
56
56
  react_1.default.createElement(styled_2.StyledCardWrapper, { id: id, highlight: highlight, onClick: onClick ? function (e) { return onClick(e, data); } : undefined },
57
57
  react_1.default.createElement("div", null,
58
58
  showEmbedSection ? (react_1.default.createElement(styled_2.StyledEmbedSection, null,
59
- react_1.default.createElement(CardLabelTag, { label: cardLabel, isEmbedPresent: showEmbedSection, isHighlightPresent: highlight, statusTagVariant: statusTagVariant }),
59
+ react_1.default.createElement(CardLabelTag, { label: cardLabel, isEmbedPresent: showEmbedSection, isHighlightPresent: highlight, statusTagColorPreset: statusTagColorPreset }),
60
60
  (0, mediaDataExists_1.imageDataExists)(image) ? (react_1.default.createElement("div", { style: { width: "100%" } }, react_1.default.createElement(ImageInput_1.ImageInput, { value: image, aspectRatio: "5/3", readOnly: true, defaultImageSpread: "cover", enableCaptions: false, disableImageBorder: true }))) : (0, mediaDataExists_1.videoDataExists)(video) ? (react_1.default.createElement("div", { style: { width: "100%", position: 'relative' } },
61
61
  react_1.default.createElement(VideoInput_1.default, { value: video, readOnly: true, light: true }),
62
62
  react_1.default.createElement("div", { style: { position: 'absolute', top: 0, left: 0, width: '100%', height: '100%' } }))) : (react_1.default.createElement(ImagePlaceholder_1.ImagePlaceholder, { title: title })))) : (react_1.default.createElement(styled_2.StyledCardLabelAndStatusTagWrapper, null,
63
63
  react_1.default.createElement(CardLabelTag, { label: cardLabel, isEmbedPresent: showEmbedSection, isHighlightPresent: highlight, bothTagsDisplayTogether: bothTagsDisplayTogether }),
64
- react_1.default.createElement(StatusTag, { display: tagDisplay, isEmbedPresent: showEmbedSection, isHighlightPresent: highlight, statusTagVariant: statusTagVariant, bothTagsDisplayTogether: bothTagsDisplayTogether }))),
64
+ react_1.default.createElement(StatusTag, { display: tagDisplay, isEmbedPresent: showEmbedSection, isHighlightPresent: highlight, statusTagColorPreset: statusTagColorPreset, bothTagsDisplayTogether: bothTagsDisplayTogether }))),
65
65
  highlight && react_1.default.createElement(styled_2.StyledStarWrapper, { highlight: highlight },
66
66
  react_1.default.createElement(HighLightIcon, { size: 18, color: white, weight: "fill", style: { filter: "drop-shadow(0px 2px 8.2px rgba(0, 0, 0, 0.50 ))" } })),
67
- showEmbedSection && (react_1.default.createElement(StatusTag, { display: tagDisplay, isEmbedPresent: showEmbedSection, isHighlightPresent: highlight, statusTagVariant: statusTagVariant })),
67
+ showEmbedSection && (react_1.default.createElement(StatusTag, { display: tagDisplay, isEmbedPresent: showEmbedSection, isHighlightPresent: highlight, statusTagColorPreset: statusTagColorPreset })),
68
68
  title ? (react_1.default.createElement(styled_2.StyledTitleWrapper, { highlight: highlight, showEmbedSection: showEmbedSection },
69
69
  react_1.default.createElement(LineClampWrapper_1.LineClampWrapper, { title: title, noOfLines_M: 6 },
70
70
  react_1.default.createElement(styled_1.StyledTitle, { capitalize: true, className: "StyledTitle" }, localize(title))))) : null,
71
71
  description ? (react_1.default.createElement(styled_2.StyledDescription, null,
72
- react_1.default.createElement(LineClampWrapper_1.LineClampWrapper, { title: description, noOfLines_M: 6 }, description))) : null),
73
- react_1.default.createElement("div", null, (metaBlock === null || metaBlock === void 0 ? void 0 : metaBlock.length) > 0 ? (
74
- //show only two meta for cardContent
75
- react_1.default.createElement(styled_2.StyledMetaBlockWrapper, null,
76
- react_1.default.createElement(MetaBlock_1.default, { data: data, config: metaBlock }))) : null))));
72
+ react_1.default.createElement(LineClampWrapper_1.LineClampWrapper, { title: description, noOfLines_M: 6 }, description))) : null))));
77
73
  };
78
74
  exports.CardContent = CardContent;
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ import { TooltipProps } from "recharts";
3
+ interface OptimizedTooltipProps extends TooltipProps<number, string> {
4
+ showPercent?: boolean;
5
+ breakdownCategoryName?: string;
6
+ }
7
+ declare const OptimizedTooltip: React.FC<OptimizedTooltipProps>;
8
+ export default OptimizedTooltip;
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
+ return cooked;
5
+ };
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
+ })();
39
+ var __importDefault = (this && this.__importDefault) || function (mod) {
40
+ return (mod && mod.__esModule) ? mod : { "default": mod };
41
+ };
42
+ Object.defineProperty(exports, "__esModule", { value: true });
43
+ var react_1 = __importStar(require("react"));
44
+ var styled_components_1 = __importDefault(require("styled-components"));
45
+ var __1 = require("../../../../../..");
46
+ var Typo2_1 = require("../../../../Typo2");
47
+ var LegendTooltipGlyph_1 = require("../LegendTooltipGlyph");
48
+ var UI_CAPTION_DF_WITH_LINE_CLAMP = (0, styled_components_1.default)(Typo2_1.UI_CAPTION_DF)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n /* ", " */\n"], ["\n /* ", " */\n"])), function (_a) {
49
+ var clampT = _a.clampT;
50
+ return (clampT ? (0, __1.clampText)(3) : "");
51
+ });
52
+ var OptimizedTooltip = (0, react_1.memo)(function (_a) {
53
+ var _b, _c;
54
+ var active = _a.active, payload = _a.payload, label = _a.label, _d = _a.showPercent, showPercent = _d === void 0 ? false : _d, breakdownCategoryName = _a.breakdownCategoryName;
55
+ // Early return for better performance
56
+ if (!active || !(payload === null || payload === void 0 ? void 0 : payload.length))
57
+ return null;
58
+ // Transform payload data to match your original tooltip structure
59
+ var value = ((_c = (_b = payload === null || payload === void 0 ? void 0 : payload[0]) === null || _b === void 0 ? void 0 : _b.payload) === null || _c === void 0 ? void 0 : _c.map(function (entry) {
60
+ return {
61
+ barColor: entry.labels.barColor,
62
+ percentage: entry.labels.percentage || 0,
63
+ count: entry.labels.count,
64
+ tooltipLabel: entry.labels.tooltipLabel,
65
+ name: entry.labels.name,
66
+ };
67
+ })) || [];
68
+ var style = {
69
+ backgroundColor: __1.colors2.black,
70
+ color: __1.colors2.white,
71
+ border: "1px solid ".concat(__1.colors2.grey10),
72
+ borderRadius: "6px",
73
+ padding: "8px",
74
+ boxShadow: "0px 4px 10px 0px rgba(0, 0, 0, 0.12)",
75
+ zIndex: 100000,
76
+ width: "max-content",
77
+ maxWidth: "300px",
78
+ maxHeight: "500px",
79
+ overflow: "auto",
80
+ display: "flex",
81
+ flexDirection: "column",
82
+ gap: "1rem",
83
+ fontSize: "12px",
84
+ };
85
+ return (react_1.default.createElement(react_1.Fragment, null,
86
+ react_1.default.createElement("div", { style: style },
87
+ breakdownCategoryName && (react_1.default.createElement(Typo2_1.UI_CAPTION_BOLD_DF, null, breakdownCategoryName)),
88
+ react_1.default.createElement("div", { style: {
89
+ display: "grid",
90
+ gridTemplateColumns: showPercent ? "auto auto auto" : "auto auto",
91
+ gap: "0.6rem",
92
+ } },
93
+ react_1.default.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "1rem" } }, value.map(function (entry, index) { return (react_1.default.createElement("div", { key: index },
94
+ react_1.default.createElement("div", { style: {
95
+ display: "flex",
96
+ alignItems: "center",
97
+ gap: "0.6rem",
98
+ } },
99
+ react_1.default.createElement(LegendTooltipGlyph_1.LegendTooltipGlyph, { color: entry.barColor }),
100
+ react_1.default.createElement(Typo2_1.UI_CAPTION_BOLD_DF, null, showPercent
101
+ ? entry.percentage + "%"
102
+ : entry.count || "0")))); })),
103
+ showPercent && (react_1.default.createElement("div", { style: {
104
+ display: "flex",
105
+ flexDirection: "column",
106
+ gap: "1rem",
107
+ } }, value.map(function (entry, index) { return (react_1.default.createElement("div", { key: index },
108
+ react_1.default.createElement(Typo2_1.UI_CAPTION_DF, null, entry.count || "0"))); }))),
109
+ react_1.default.createElement("div", { style: {
110
+ paddingLeft: "0.8rem",
111
+ display: "flex",
112
+ flexDirection: "column",
113
+ gap: "1rem",
114
+ } }, value.map(function (entry, index) { return (react_1.default.createElement("div", { key: index },
115
+ react_1.default.createElement(UI_CAPTION_DF_WITH_LINE_CLAMP, null, entry.tooltipLabel))); }))))));
116
+ });
117
+ exports.default = OptimizedTooltip;
118
+ var templateObject_1;
@@ -55,8 +55,8 @@ var CustomizedLabel_1 = require("./comps/CustomizedLabel");
55
55
  var __1 = require("../../../..");
56
56
  var usePrepareData_1 = require("../utils/usePrepareData");
57
57
  var _base_barchart_ui_configs_1 = require("./_base_barchart_ui_configs");
58
- var CustomTooltip_1 = __importDefault(require("./comps/CustomTooltip"));
59
58
  var Legend_1 = require("./comps/Legend");
59
+ var OptimizedTooltip_1 = __importDefault(require("./comps/CustomTooltip/OptimizedTooltip"));
60
60
  var useTrackMousePosition = function () {
61
61
  var _a = (0, react_1.useState)({
62
62
  x: 0,
@@ -268,14 +268,7 @@ var BarChartRenderer = function (_a) {
268
268
  } },
269
269
  react_1.default.createElement(recharts_1.XAxis, { hide: true, type: "number", domain: [0, dataMaxValue] }),
270
270
  react_1.default.createElement(recharts_1.YAxis, { hide: true, type: "category" }),
271
- isBreakdown && (react_1.default.createElement(recharts_1.Tooltip, { content: function (props) {
272
- var _a;
273
- return (react_1.default.createElement(CustomTooltip_1.default, __assign({}, props, { breakdownCategoryName: breakdownCategoryName, activeBar: activeBar, mousePosition: mousePosition, showPercent: showPercent,
274
- // god knows why the dataindex gets stored against props.label.
275
- // this is some internal recharts thing for tooltips specifically.
276
- // we dont do this.
277
- value: (_a = data[props.label]) === null || _a === void 0 ? void 0 : _a.map(function (item, idx) { return (__assign({}, item.labels)); }) })));
278
- }, cursor: false, allowEscapeViewBox: { x: true, y: true } })),
271
+ isBreakdown && (react_1.default.createElement(recharts_1.Tooltip, { cursor: false, content: react_1.default.createElement(OptimizedTooltip_1.default, null), animationDuration: 0, isAnimationActive: false, allowEscapeViewBox: { x: false, y: false }, position: { x: undefined, y: undefined } })),
279
272
  isBreakdown
280
273
  ? data[0].map(function (_, stackIndex) {
281
274
  //note that this map renders the individual bars within a breakdown group
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oolib",
3
- "version": "2.199.3",
3
+ "version": "2.199.5",
4
4
  "description": " OKE Component Library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",