@reltio/components 1.4.2246 → 1.4.2248

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 (101) hide show
  1. package/cjs/index.d.ts +0 -1
  2. package/cjs/index.js +5 -7
  3. package/index.d.ts +0 -1
  4. package/index.js +0 -1
  5. package/package.json +2 -2
  6. package/UpSetChart/UpSetChart.d.ts +0 -9
  7. package/UpSetChart/UpSetChart.js +0 -40
  8. package/UpSetChart/UpSetChart.test.d.ts +0 -1
  9. package/UpSetChart/UpSetChart.test.js +0 -193
  10. package/UpSetChart/components/IntersectionsChart/IntersectionsChart.d.ts +0 -15
  11. package/UpSetChart/components/IntersectionsChart/IntersectionsChart.js +0 -39
  12. package/UpSetChart/components/IntersectionsChart/index.d.ts +0 -1
  13. package/UpSetChart/components/IntersectionsChart/index.js +0 -1
  14. package/UpSetChart/components/IntersectionsChart/styles.d.ts +0 -1
  15. package/UpSetChart/components/IntersectionsChart/styles.js +0 -29
  16. package/UpSetChart/components/IntersectionsChartAxis/IntersectionsChartAxis.d.ts +0 -10
  17. package/UpSetChart/components/IntersectionsChartAxis/IntersectionsChartAxis.js +0 -34
  18. package/UpSetChart/components/IntersectionsChartAxis/index.d.ts +0 -1
  19. package/UpSetChart/components/IntersectionsChartAxis/index.js +0 -1
  20. package/UpSetChart/components/IntersectionsChartAxis/styles.d.ts +0 -1
  21. package/UpSetChart/components/IntersectionsChartAxis/styles.js +0 -29
  22. package/UpSetChart/components/IntersectionsMatrix/IntersectionsMatrix.d.ts +0 -13
  23. package/UpSetChart/components/IntersectionsMatrix/IntersectionsMatrix.js +0 -26
  24. package/UpSetChart/components/IntersectionsMatrix/index.d.ts +0 -1
  25. package/UpSetChart/components/IntersectionsMatrix/index.js +0 -1
  26. package/UpSetChart/components/IntersectionsMatrix/styles.d.ts +0 -1
  27. package/UpSetChart/components/IntersectionsMatrix/styles.js +0 -24
  28. package/UpSetChart/components/SetsChart/SetsChart.d.ts +0 -15
  29. package/UpSetChart/components/SetsChart/SetsChart.js +0 -31
  30. package/UpSetChart/components/SetsChart/index.d.ts +0 -1
  31. package/UpSetChart/components/SetsChart/index.js +0 -1
  32. package/UpSetChart/components/SetsChart/styles.d.ts +0 -1
  33. package/UpSetChart/components/SetsChart/styles.js +0 -40
  34. package/UpSetChart/components/SetsChartAxis/SetsChartAxis.d.ts +0 -6
  35. package/UpSetChart/components/SetsChartAxis/SetsChartAxis.js +0 -13
  36. package/UpSetChart/components/SetsChartAxis/index.d.ts +0 -1
  37. package/UpSetChart/components/SetsChartAxis/index.js +0 -1
  38. package/UpSetChart/components/SetsChartAxis/styles.d.ts +0 -1
  39. package/UpSetChart/components/SetsChartAxis/styles.js +0 -14
  40. package/UpSetChart/constants.d.ts +0 -17
  41. package/UpSetChart/constants.js +0 -20
  42. package/UpSetChart/gameOfThrones.test-data.d.ts +0 -4
  43. package/UpSetChart/gameOfThrones.test-data.js +0 -23
  44. package/UpSetChart/helpers.d.ts +0 -20
  45. package/UpSetChart/helpers.js +0 -120
  46. package/UpSetChart/index.d.ts +0 -1
  47. package/UpSetChart/index.js +0 -1
  48. package/UpSetChart/styles.d.ts +0 -4
  49. package/UpSetChart/styles.js +0 -15
  50. package/UpSetChart/types.d.ts +0 -16
  51. package/UpSetChart/types.js +0 -1
  52. package/UpSetChart/useUpSetChartSizes.d.ts +0 -20
  53. package/UpSetChart/useUpSetChartSizes.js +0 -30
  54. package/cjs/UpSetChart/UpSetChart.d.ts +0 -9
  55. package/cjs/UpSetChart/UpSetChart.js +0 -70
  56. package/cjs/UpSetChart/UpSetChart.test.d.ts +0 -1
  57. package/cjs/UpSetChart/UpSetChart.test.js +0 -198
  58. package/cjs/UpSetChart/components/IntersectionsChart/IntersectionsChart.d.ts +0 -15
  59. package/cjs/UpSetChart/components/IntersectionsChart/IntersectionsChart.js +0 -66
  60. package/cjs/UpSetChart/components/IntersectionsChart/index.d.ts +0 -1
  61. package/cjs/UpSetChart/components/IntersectionsChart/index.js +0 -5
  62. package/cjs/UpSetChart/components/IntersectionsChart/styles.d.ts +0 -1
  63. package/cjs/UpSetChart/components/IntersectionsChart/styles.js +0 -32
  64. package/cjs/UpSetChart/components/IntersectionsChartAxis/IntersectionsChartAxis.d.ts +0 -10
  65. package/cjs/UpSetChart/components/IntersectionsChartAxis/IntersectionsChartAxis.js +0 -64
  66. package/cjs/UpSetChart/components/IntersectionsChartAxis/index.d.ts +0 -1
  67. package/cjs/UpSetChart/components/IntersectionsChartAxis/index.js +0 -5
  68. package/cjs/UpSetChart/components/IntersectionsChartAxis/styles.d.ts +0 -1
  69. package/cjs/UpSetChart/components/IntersectionsChartAxis/styles.js +0 -32
  70. package/cjs/UpSetChart/components/IntersectionsMatrix/IntersectionsMatrix.d.ts +0 -13
  71. package/cjs/UpSetChart/components/IntersectionsMatrix/IntersectionsMatrix.js +0 -56
  72. package/cjs/UpSetChart/components/IntersectionsMatrix/index.d.ts +0 -1
  73. package/cjs/UpSetChart/components/IntersectionsMatrix/index.js +0 -5
  74. package/cjs/UpSetChart/components/IntersectionsMatrix/styles.d.ts +0 -1
  75. package/cjs/UpSetChart/components/IntersectionsMatrix/styles.js +0 -27
  76. package/cjs/UpSetChart/components/SetsChart/SetsChart.d.ts +0 -15
  77. package/cjs/UpSetChart/components/SetsChart/SetsChart.js +0 -58
  78. package/cjs/UpSetChart/components/SetsChart/index.d.ts +0 -1
  79. package/cjs/UpSetChart/components/SetsChart/index.js +0 -5
  80. package/cjs/UpSetChart/components/SetsChart/styles.d.ts +0 -1
  81. package/cjs/UpSetChart/components/SetsChart/styles.js +0 -43
  82. package/cjs/UpSetChart/components/SetsChartAxis/SetsChartAxis.d.ts +0 -6
  83. package/cjs/UpSetChart/components/SetsChartAxis/SetsChartAxis.js +0 -20
  84. package/cjs/UpSetChart/components/SetsChartAxis/index.d.ts +0 -1
  85. package/cjs/UpSetChart/components/SetsChartAxis/index.js +0 -5
  86. package/cjs/UpSetChart/components/SetsChartAxis/styles.d.ts +0 -1
  87. package/cjs/UpSetChart/components/SetsChartAxis/styles.js +0 -17
  88. package/cjs/UpSetChart/constants.d.ts +0 -17
  89. package/cjs/UpSetChart/constants.js +0 -23
  90. package/cjs/UpSetChart/gameOfThrones.test-data.d.ts +0 -4
  91. package/cjs/UpSetChart/gameOfThrones.test-data.js +0 -26
  92. package/cjs/UpSetChart/helpers.d.ts +0 -20
  93. package/cjs/UpSetChart/helpers.js +0 -127
  94. package/cjs/UpSetChart/index.d.ts +0 -1
  95. package/cjs/UpSetChart/index.js +0 -5
  96. package/cjs/UpSetChart/styles.d.ts +0 -4
  97. package/cjs/UpSetChart/styles.js +0 -18
  98. package/cjs/UpSetChart/types.d.ts +0 -16
  99. package/cjs/UpSetChart/types.js +0 -2
  100. package/cjs/UpSetChart/useUpSetChartSizes.d.ts +0 -20
  101. package/cjs/UpSetChart/useUpSetChartSizes.js +0 -34
@@ -1 +0,0 @@
1
- export declare const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"setsBarBackground" | "setsBarDimmed" | "setsBar" | "hoverBar" | "setsLabel" | "gridLine">;
@@ -1,43 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useStyles = void 0;
4
- var styles_1 = require("@mui/styles");
5
- var constants_1 = require("../../constants");
6
- exports.useStyles = (0, styles_1.makeStyles)(function () { return ({
7
- setsBarBackground: {
8
- fill: constants_1.PRIMARY_COLOR,
9
- opacity: 0.08,
10
- transition: 'x ease-in-out 0.3s, width ease-in-out 0.3s'
11
- },
12
- setsBarDimmed: {
13
- fill: constants_1.DIMMED_COLOR,
14
- transition: 'x ease-in-out 0.3s, width ease-in-out 0.3s'
15
- },
16
- setsBar: {
17
- fill: constants_1.PRIMARY_COLOR,
18
- transition: 'x ease-in-out 0.3s, width ease-in-out 0.3s'
19
- },
20
- hoverBar: {
21
- fill: 'transparent',
22
- strokeWidth: '1px',
23
- cursor: 'pointer',
24
- stroke: constants_1.PRIMARY_COLOR,
25
- opacity: 0,
26
- transition: 'opacity ease-in-out 0.3s',
27
- '&:hover': {
28
- opacity: 1
29
- }
30
- },
31
- setsLabel: {
32
- fontSize: constants_1.SET_LABEL_SIZE,
33
- fill: constants_1.TEXT_COLOR,
34
- textAnchor: 'start',
35
- dominantBaseline: 'middle',
36
- transition: 'all ease-in-out 0.3s'
37
- },
38
- gridLine: {
39
- stroke: '#000000',
40
- opacity: 0.04,
41
- strokeWidth: '1px'
42
- }
43
- }); });
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- type Props = {
3
- width: number;
4
- };
5
- export declare const SetsChartAxis: ({ width }: Props) => React.JSX.Element;
6
- export {};
@@ -1,20 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.SetsChartAxis = void 0;
7
- var react_1 = __importDefault(require("react"));
8
- var styles_1 = require("./styles");
9
- var SetsChartAxis = function (_a) {
10
- var width = _a.width;
11
- var styles = (0, styles_1.useStyles)();
12
- return (react_1.default.createElement("g", null,
13
- react_1.default.createElement("g", { transform: "translate(0,0)" },
14
- react_1.default.createElement("line", { y2: -6, className: styles.axisTick }),
15
- react_1.default.createElement("text", { x: 0, y: -9, className: styles.axisTickLabel }, "100%")),
16
- react_1.default.createElement("g", { transform: "translate(".concat(width, ",0)") },
17
- react_1.default.createElement("line", { y2: -6, className: styles.axisTick }),
18
- react_1.default.createElement("text", { x: 0, y: -9, className: styles.axisTickLabel }, "0%"))));
19
- };
20
- exports.SetsChartAxis = SetsChartAxis;
@@ -1 +0,0 @@
1
- export { SetsChartAxis } from './SetsChartAxis';
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SetsChartAxis = void 0;
4
- var SetsChartAxis_1 = require("./SetsChartAxis");
5
- Object.defineProperty(exports, "SetsChartAxis", { enumerable: true, get: function () { return SetsChartAxis_1.SetsChartAxis; } });
@@ -1 +0,0 @@
1
- export declare const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"axisTick" | "axisTickLabel">;
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useStyles = void 0;
4
- var styles_1 = require("@mui/styles");
5
- exports.useStyles = (0, styles_1.makeStyles)(function () { return ({
6
- axisTick: {
7
- stroke: '#000000',
8
- strokeWidth: '1px',
9
- opacity: 0.54
10
- },
11
- axisTickLabel: {
12
- fontSize: '10px',
13
- fill: '#000000',
14
- opacity: 0.54,
15
- textAnchor: 'middle'
16
- }
17
- }); });
@@ -1,17 +0,0 @@
1
- export declare const PRIMARY_COLOR = "#000066";
2
- export declare const DIMMED_COLOR = "#CCCCE0";
3
- export declare const TEXT_COLOR = "rgba(0, 0, 0, 0.87)";
4
- export declare const TOP_GAP = 24;
5
- export declare const TEXT_GAP = 16;
6
- export declare const GAP_BETWEEN_TABLE_AND_CHART = 8;
7
- export declare const GAP_BEFORE_LEFT_BAR = 12;
8
- export declare const AXIS_TICK_LABEL_SIZE = "12px";
9
- export declare const SET_LABEL_SIZE = "13px";
10
- export declare const SET_BAR_HEIGHT = 12;
11
- export declare const MATRIX_ROW_HEIGHT = 29;
12
- export declare const MIN_MATRIX_COLUMN_WIDTH = 28;
13
- export declare const MIN_INTERSECTION_CHART_HEIGHT = 120;
14
- export declare const MIN_SETS_CHART_WIDTH = 100;
15
- export declare const MAX_SETS_CHART_WIDTH = 200;
16
- export declare const MAX_CHARACTERS = 20;
17
- export declare const MIN_CHARACTERS = 8;
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MIN_CHARACTERS = exports.MAX_CHARACTERS = exports.MAX_SETS_CHART_WIDTH = exports.MIN_SETS_CHART_WIDTH = exports.MIN_INTERSECTION_CHART_HEIGHT = exports.MIN_MATRIX_COLUMN_WIDTH = exports.MATRIX_ROW_HEIGHT = exports.SET_BAR_HEIGHT = exports.SET_LABEL_SIZE = exports.AXIS_TICK_LABEL_SIZE = exports.GAP_BEFORE_LEFT_BAR = exports.GAP_BETWEEN_TABLE_AND_CHART = exports.TEXT_GAP = exports.TOP_GAP = exports.TEXT_COLOR = exports.DIMMED_COLOR = exports.PRIMARY_COLOR = void 0;
4
- // Colors
5
- exports.PRIMARY_COLOR = '#000066';
6
- exports.DIMMED_COLOR = '#CCCCE0';
7
- exports.TEXT_COLOR = 'rgba(0, 0, 0, 0.87)';
8
- // Gaps
9
- exports.TOP_GAP = 24;
10
- exports.TEXT_GAP = 16;
11
- exports.GAP_BETWEEN_TABLE_AND_CHART = 8;
12
- exports.GAP_BEFORE_LEFT_BAR = 12;
13
- // Sizes
14
- exports.AXIS_TICK_LABEL_SIZE = '12px';
15
- exports.SET_LABEL_SIZE = '13px';
16
- exports.SET_BAR_HEIGHT = 12;
17
- exports.MATRIX_ROW_HEIGHT = 29;
18
- exports.MIN_MATRIX_COLUMN_WIDTH = 28;
19
- exports.MIN_INTERSECTION_CHART_HEIGHT = 120;
20
- exports.MIN_SETS_CHART_WIDTH = 100;
21
- exports.MAX_SETS_CHART_WIDTH = 200;
22
- exports.MAX_CHARACTERS = 20;
23
- exports.MIN_CHARACTERS = 8;
@@ -1,4 +0,0 @@
1
- export declare const gameOfThronesData: {
2
- name: string;
3
- sets: string[];
4
- }[];
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.gameOfThronesData = void 0;
4
- exports.gameOfThronesData = [
5
- { name: 'Alton Lannister', sets: ['was killed', 'Lannister', 'male'] },
6
- { name: 'Arya Stark', sets: ['Stark', 'female'] },
7
- { name: 'Bran Stark', sets: ['royal', 'Stark', 'male'] },
8
- { name: 'Benjen Stark', sets: ['was killed', 'Stark', 'male'] },
9
- { name: 'Brandon Stark', sets: ['was killed', 'Stark'] },
10
- { name: 'Catelyn Stark', sets: ['was killed', 'Stark', 'female'] },
11
- { name: 'Cersei Lannister', sets: ['royal', 'was killed', 'Lannister', 'female'] },
12
- { name: 'Eddard Stark', sets: ['was killed', 'Stark', 'male'] },
13
- { name: 'Jaime Lannister', sets: ['was killed', 'Lannister', 'male'] },
14
- { name: 'Jon Snow', sets: ['royal', 'was killed', 'Stark', 'male'] },
15
- { name: 'Kevan Lannister', sets: ['was killed', 'Lannister', 'male'] },
16
- { name: 'Lancel Lannister', sets: ['was killed', 'Lannister', 'male'] },
17
- { name: 'Lyanna Stark', sets: ['was killed', 'Stark', 'female'] },
18
- { name: 'Martyn Lannister', sets: ['was killed', 'Lannister', 'male'] },
19
- { name: 'Rickard Stark', sets: ['was killed', 'Stark', 'male'] },
20
- { name: 'Rickon Stark', sets: ['was killed', 'Stark', 'male'] },
21
- { name: 'Robb Stark', sets: ['royal', 'was killed', 'Stark', 'male'] },
22
- { name: 'Sansa Stark', sets: ['royal', 'Stark', 'female'] },
23
- { name: 'Tyrion Lannister', sets: ['Lannister', 'male'] },
24
- { name: 'Tywin Lannister', sets: ['was killed', 'Lannister', 'male'] },
25
- { name: 'Willem Lannister', sets: ['was killed', 'Lannister', 'male'] }
26
- ];
@@ -1,20 +0,0 @@
1
- import { ScaleBand } from 'd3-scale';
2
- import { DataSet, Intersection, UpSetChartData } from './types';
3
- export declare const findIntersections: (data: UpSetChartData) => {
4
- intersections: Intersection[];
5
- sets: DataSet[];
6
- };
7
- export declare const getMatrixData: (xScale: ScaleBand<string>, yScale: ScaleBand<string>, intersections: Intersection[], sets: DataSet[]) => {
8
- circles: {
9
- cx: number;
10
- cy: number;
11
- isPresent: boolean;
12
- intersectionIndex: number;
13
- }[];
14
- lines: any[];
15
- };
16
- export declare const truncateLabels: (sets: DataSet[], maxLabelsWidth: number) => {
17
- labels: string[];
18
- maxWidth: number;
19
- };
20
- export declare const calculateTicksWidth: (ticks: number[]) => number;
@@ -1,127 +0,0 @@
1
- "use strict";
2
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
- if (ar || !(i in from)) {
5
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
- ar[i] = from[i];
7
- }
8
- }
9
- return to.concat(ar || Array.prototype.slice.call(from));
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.calculateTicksWidth = exports.truncateLabels = exports.getMatrixData = exports.findIntersections = void 0;
13
- var constants_1 = require("./constants");
14
- var findIntersections = function (data) {
15
- var setsCombinations = {};
16
- var individualSets = {};
17
- data.forEach(function (_a) {
18
- var name = _a.name, sets = _a.sets;
19
- sets.forEach(function (set) {
20
- if (!individualSets[set]) {
21
- individualSets[set] = [];
22
- }
23
- individualSets[set].push(name);
24
- });
25
- var generateCombinations = function (subset, index) {
26
- if (index === sets.length) {
27
- if (subset.length > 0) {
28
- var key = subset.sort().join(',');
29
- if (!setsCombinations[key]) {
30
- setsCombinations[key] = [];
31
- }
32
- setsCombinations[key].push(name);
33
- }
34
- return;
35
- }
36
- generateCombinations(subset, index + 1);
37
- generateCombinations(__spreadArray(__spreadArray([], subset, true), [sets[index]], false), index + 1);
38
- };
39
- generateCombinations([], 0);
40
- });
41
- var intersections = Object.entries(setsCombinations)
42
- .map(function (_a, index) {
43
- var key = _a[0], elements = _a[1];
44
- return ({
45
- index: index,
46
- sets: key.split(','),
47
- size: elements.length,
48
- elements: elements
49
- });
50
- })
51
- .sort(function (a, b) { return b.size - a.size; });
52
- var sets = Object.entries(individualSets).map(function (_a, index) {
53
- var name = _a[0], elements = _a[1];
54
- return ({
55
- index: index,
56
- name: name,
57
- size: elements.length,
58
- elements: elements
59
- });
60
- });
61
- return { intersections: intersections, sets: sets };
62
- };
63
- exports.findIntersections = findIntersections;
64
- var getMatrixData = function (xScale, yScale, intersections, sets) {
65
- var circles = intersections.flatMap(function (intersection, i) {
66
- return sets.map(function (set) { return ({
67
- cx: xScale(String(i)) + xScale.bandwidth() / 2,
68
- cy: yScale(set.name) + yScale.bandwidth() / 2,
69
- isPresent: intersection.sets.includes(set.name),
70
- intersectionIndex: intersection.index
71
- }); });
72
- });
73
- var lines = intersections.reduce(function (acc, intersection, i) {
74
- var activeSetIndices = intersection.sets
75
- .map(function (name) { return sets.findIndex(function (set) { return set.name === name; }); })
76
- .filter(function (i) { return i >= 0; })
77
- .sort(function (a, b) { return a - b; });
78
- if (activeSetIndices.length > 1) {
79
- var firstIdx = activeSetIndices[0];
80
- var lastIdx = activeSetIndices[activeSetIndices.length - 1];
81
- var x = xScale(String(i)) + xScale.bandwidth() / 2;
82
- var y1 = yScale(sets[firstIdx].name) + yScale.bandwidth() / 2;
83
- var y2 = yScale(sets[lastIdx].name) + yScale.bandwidth() / 2;
84
- return __spreadArray(__spreadArray([], acc, true), [{ x: x, y1: y1, y2: y2, intersectionIndex: intersection.index }], false);
85
- }
86
- return acc;
87
- }, []);
88
- return { circles: circles, lines: lines };
89
- };
90
- exports.getMatrixData = getMatrixData;
91
- var truncateLabels = function (sets, maxLabelsWidth) {
92
- var newTruncatedLabels = [];
93
- var maxWidth = 0;
94
- var tempSvgElement = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
95
- document.body.appendChild(tempSvgElement);
96
- var tempTextElement = document.createElementNS('http://www.w3.org/2000/svg', 'text');
97
- tempTextElement.setAttribute('font-size', constants_1.SET_LABEL_SIZE);
98
- tempSvgElement.appendChild(tempTextElement);
99
- sets.forEach(function (_a) {
100
- var name = _a.name;
101
- var truncatedText = name.length > constants_1.MAX_CHARACTERS ? name.slice(0, constants_1.MAX_CHARACTERS) + '...' : name;
102
- tempTextElement.textContent = truncatedText;
103
- while (tempTextElement.getBBox().width > maxLabelsWidth && truncatedText.length > constants_1.MIN_CHARACTERS) {
104
- truncatedText = truncatedText.slice(0, -4) + '...';
105
- tempTextElement.textContent = truncatedText;
106
- }
107
- newTruncatedLabels.push(truncatedText);
108
- maxWidth = Math.max(maxWidth, tempTextElement.getBBox().width);
109
- });
110
- document.body.removeChild(tempSvgElement);
111
- return { labels: newTruncatedLabels, maxWidth: maxWidth };
112
- };
113
- exports.truncateLabels = truncateLabels;
114
- var calculateTicksWidth = function (ticks) {
115
- var tempSvgElement = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
116
- var tempTextElement = document.createElementNS('http://www.w3.org/2000/svg', 'text');
117
- tempTextElement.setAttribute('font-size', constants_1.AXIS_TICK_LABEL_SIZE);
118
- tempSvgElement.appendChild(tempTextElement);
119
- document.body.appendChild(tempSvgElement);
120
- var maxWidth = ticks.reduce(function (maxWidth, tick) {
121
- tempTextElement.textContent = String(tick);
122
- return Math.max(maxWidth, tempTextElement.getBBox().width);
123
- }, 0);
124
- document.body.removeChild(tempSvgElement);
125
- return maxWidth;
126
- };
127
- exports.calculateTicksWidth = calculateTicksWidth;
@@ -1 +0,0 @@
1
- export { UpSetChart } from './UpSetChart';
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UpSetChart = void 0;
4
- var UpSetChart_1 = require("./UpSetChart");
5
- Object.defineProperty(exports, "UpSetChart", { enumerable: true, get: function () { return UpSetChart_1.UpSetChart; } });
@@ -1,4 +0,0 @@
1
- export declare const useStyles: (props: {
2
- width: number;
3
- height: number;
4
- }) => import("@mui/styles").ClassNameMap<"svg" | "wrapper">;
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useStyles = void 0;
4
- var styles_1 = require("@mui/styles");
5
- exports.useStyles = (0, styles_1.makeStyles)(function () { return ({
6
- wrapper: function (_a) {
7
- var width = _a.width, height = _a.height;
8
- return ({
9
- width: width,
10
- height: height,
11
- display: 'flex',
12
- overflow: 'auto'
13
- });
14
- },
15
- svg: {
16
- flexShrink: '0'
17
- }
18
- }); });
@@ -1,16 +0,0 @@
1
- export type UpSetChartData = {
2
- name: string;
3
- sets: string[];
4
- }[];
5
- export type Intersection = {
6
- index: number;
7
- sets: string[];
8
- size: number;
9
- elements: string[];
10
- };
11
- export type DataSet = {
12
- index: number;
13
- name: string;
14
- size: number;
15
- elements: string[];
16
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,20 +0,0 @@
1
- import { DataSet, Intersection } from './types';
2
- type Props = {
3
- width: number;
4
- height: number;
5
- intersections: Intersection[];
6
- sets: DataSet[];
7
- };
8
- export declare const useUpSetChartSizes: ({ width, height, intersections, sets }: Props) => {
9
- labels: string[];
10
- svgWidth: number;
11
- svgHeight: number;
12
- intersectionsChartWidth: number;
13
- intersectionsChartHeight: number;
14
- matrixY: number;
15
- matrixHeight: number;
16
- maxLabelsWidth: number;
17
- leftPadding: number;
18
- setsChartWidth: number;
19
- };
20
- export {};
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useUpSetChartSizes = void 0;
4
- var constants_1 = require("./constants");
5
- var helpers_1 = require("./helpers");
6
- var useUpSetChartSizes = function (_a) {
7
- var width = _a.width, height = _a.height, intersections = _a.intersections, sets = _a.sets;
8
- var minMatrixWidth = intersections.length * constants_1.MIN_MATRIX_COLUMN_WIDTH * 1.2;
9
- var matrixHeight = sets.length * constants_1.MATRIX_ROW_HEIGHT;
10
- var availableLabelsWidth = width - minMatrixWidth - constants_1.TEXT_GAP * 2 - constants_1.GAP_BEFORE_LEFT_BAR - constants_1.MIN_SETS_CHART_WIDTH;
11
- var _b = (0, helpers_1.truncateLabels)(sets, availableLabelsWidth), labels = _b.labels, labelsWidth = _b.maxWidth;
12
- var availableSetsChartWidth = width - minMatrixWidth - constants_1.TEXT_GAP * 2 - constants_1.GAP_BEFORE_LEFT_BAR - labelsWidth;
13
- var setsChartWidth = Math.min(Math.max(availableSetsChartWidth, constants_1.MIN_SETS_CHART_WIDTH), constants_1.MAX_SETS_CHART_WIDTH);
14
- var maxLabelsWidth = width - minMatrixWidth - constants_1.TEXT_GAP * 2 - constants_1.GAP_BEFORE_LEFT_BAR - setsChartWidth;
15
- var leftPadding = setsChartWidth + labelsWidth + constants_1.TEXT_GAP * 2 + constants_1.GAP_BEFORE_LEFT_BAR;
16
- var intersectionsChartWidth = Math.max(minMatrixWidth, width - leftPadding);
17
- var intersectionsChartHeight = Math.max(constants_1.MIN_INTERSECTION_CHART_HEIGHT, height - constants_1.TOP_GAP - matrixHeight - constants_1.GAP_BETWEEN_TABLE_AND_CHART);
18
- var svgWidth = leftPadding + intersectionsChartWidth;
19
- var svgHeight = intersectionsChartHeight + matrixHeight + constants_1.TOP_GAP + constants_1.GAP_BETWEEN_TABLE_AND_CHART;
20
- var matrixY = svgHeight - matrixHeight - 1;
21
- return {
22
- labels: labels,
23
- svgWidth: svgWidth,
24
- svgHeight: svgHeight,
25
- intersectionsChartWidth: intersectionsChartWidth,
26
- intersectionsChartHeight: intersectionsChartHeight,
27
- matrixY: matrixY,
28
- matrixHeight: matrixHeight,
29
- maxLabelsWidth: maxLabelsWidth,
30
- leftPadding: leftPadding,
31
- setsChartWidth: setsChartWidth
32
- };
33
- };
34
- exports.useUpSetChartSizes = useUpSetChartSizes;