@agregio-solutions/design-system 1.97.1 → 1.99.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.
@@ -34,6 +34,25 @@ export type Block = {
34
34
  */
35
35
  onClick?: () => void;
36
36
  };
37
+ export type MergedBlock = {
38
+ /**
39
+ * The start date of the merged interval
40
+ */
41
+ startDate: Date;
42
+ /**
43
+ * The end date of the merged interval
44
+ */
45
+ endDate: Date;
46
+ /**
47
+ * The color shared by all blocks merged into this interval
48
+ */
49
+ color: Block["color"];
50
+ /**
51
+ * The original blocks (from all sub-lines) that were merged into this interval
52
+ */
53
+ blocks: Array<Block>;
54
+ };
55
+ export type GroupHoverTextFormatter = (mergedBlock: MergedBlock) => string;
37
56
  export type SubLine = {
38
57
  /**
39
58
  * The name of the sub-line, displayed at the left when expanded
@@ -71,10 +90,22 @@ export type GroupLine = {
71
90
  * The sub-lines to display when expanded
72
91
  */
73
92
  subLines: Array<SubLine>;
93
+ /**
94
+ * Custom formatter for the hover text of the merged blocks shown on the group's
95
+ * collapsed row. Receives the merged date range, color, and the original blocks
96
+ * that were merged into it. Defaults to a "start date - end date" format.
97
+ * Give it a stable identity (e.g. via `useCallback`, or defined outside the
98
+ * component) so the merge computation isn't redone on every render.
99
+ */
100
+ groupHoverText?: GroupHoverTextFormatter;
74
101
  };
75
102
  export type Line = SimpleLine | GroupLine;
103
+ /**
104
+ * Expanded state of the group lines, keyed by group line name.
105
+ */
106
+ export type ExpandedGroups = Record<string, boolean>;
76
107
  export declare function isGroupLine(line: Line): line is GroupLine;
77
108
  export declare const NAMES_SECTION_WIDTH = 188;
78
109
  export declare const lineHeightForIndentLevel: (indentLevel: number) => 40 | 58;
79
- export declare const maxBlocksToDisplayBeforeCollapsingForIndentLevel: (indentLevel: number) => 3 | 5;
110
+ export declare const maxLanesToDisplayBeforeCollapsingForIndentLevel: (indentLevel: number) => 3 | 5;
80
111
  export {};
@@ -1,7 +1,7 @@
1
- import { Block, SubLine } from '../Timeline.types';
1
+ import { Block, GroupHoverTextFormatter, SubLine } from '../Timeline.types';
2
2
  /**
3
3
  * Merges blocks from all sub-lines by color.
4
4
  * For each color group, overlapping intervals are merged into a single block.
5
5
  * Returns a flat array of merged blocks.
6
6
  */
7
- export declare function mergeBlocksByColor(subLines: SubLine[]): Block[];
7
+ export declare function mergeBlocksByColor(subLines: SubLine[], groupHoverText?: GroupHoverTextFormatter): Block[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agregio-solutions/design-system",
3
- "version": "1.97.1",
3
+ "version": "1.99.0",
4
4
  "description": "React Component library and Storybook that is part of the Design System for Agregio Solutions",
5
5
  "type": "module",
6
6
  "module": "dist/design-system.js",