@moderneinc/react-charts 1.2.0 → 1.3.0-next.44efd5

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 (39) hide show
  1. package/dist/components/chrono-chart/chrono-chart.component.d.ts +10 -0
  2. package/dist/components/chrono-chart/chrono-chart.types.d.ts +129 -0
  3. package/dist/components/chrono-chart/components/category-table.component.d.ts +13 -0
  4. package/dist/components/chrono-chart/components/category-table.types.d.ts +42 -0
  5. package/dist/components/chrono-chart/utils/data-transformer.d.ts +41 -0
  6. package/dist/components/d3-stacked-area-chart/d3-stacked-area-chart.component.d.ts +7 -0
  7. package/dist/components/d3-stacked-area-chart/d3-stacked-area-chart.types.d.ts +95 -0
  8. package/dist/components/d3-stacked-area-chart/hooks/use-d3-stacked-area.hook.d.ts +35 -0
  9. package/dist/components/d3-stacked-bar-chart/d3-stacked-bar-chart.component.d.ts +7 -0
  10. package/dist/components/d3-stacked-bar-chart/d3-stacked-bar-chart.types.d.ts +89 -0
  11. package/dist/components/d3-stacked-bar-chart/hooks/use-d3-stacked-bar.hook.d.ts +31 -0
  12. package/dist/components/morph-chart/hooks/shared/computations.d.ts +29 -0
  13. package/dist/components/morph-chart/hooks/shared/types.d.ts +24 -0
  14. package/dist/components/morph-chart/hooks/use-morph-chart.hook.d.ts +90 -0
  15. package/dist/components/morph-chart/morph-chart.component.d.ts +14 -0
  16. package/dist/components/morph-chart/morph-chart.types.d.ts +175 -0
  17. package/dist/components/morph-chart/utils/animation-constants.d.ts +23 -0
  18. package/dist/components/morph-chart/utils/area-renderer.d.ts +24 -0
  19. package/dist/components/morph-chart/utils/bar-renderer.d.ts +19 -0
  20. package/dist/components/morph-chart/utils/gsap-orchestrator.d.ts +291 -0
  21. package/dist/components/morph-chart/utils/parliament-renderer.d.ts +23 -0
  22. package/dist/components/morph-chart/utils/parliament-seat-extractor.d.ts +33 -0
  23. package/dist/components/morph-chart/utils/position-mapper.d.ts +48 -0
  24. package/dist/components/morph-chart/utils/svg-patterns.d.ts +19 -0
  25. package/dist/components/parliament-chart/hooks/use-parliament-chart.hook.d.ts +5 -1
  26. package/dist/components/parliament-chart/parliament-chart.types.d.ts +5 -0
  27. package/dist/components/parliament-chart/utils/parliament-animation.d.ts +13 -0
  28. package/dist/components/stacked-area-with-timeline/hooks/use-stacked-area-with-timeline.hook.d.ts +53 -0
  29. package/dist/components/stacked-area-with-timeline/stacked-area-with-timeline.component.d.ts +3 -0
  30. package/dist/components/stacked-area-with-timeline/stacked-area-with-timeline.types.d.ts +97 -0
  31. package/dist/components/stacked-area-with-timeline/utils/render-timeline-track.d.ts +46 -0
  32. package/dist/components/timeline-chart/timeline-chart.types.d.ts +44 -0
  33. package/dist/index.cjs +49 -11
  34. package/dist/index.d.ts +13 -1
  35. package/dist/index.js +13792 -3213
  36. package/dist/theme/chart-palettes.d.ts +59 -0
  37. package/dist/theme/default-colors.d.ts +8 -4
  38. package/dist/theme/timeline-defaults.d.ts +25 -1
  39. package/package.json +28 -16
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Generates gradient colors for categories, ordered from worst (red) to best (green).
3
+ */
4
+ export declare function generateMeasureGradient(count: number): string[];
5
+ /**
6
+ * Default colors for stacked area chart categories
7
+ * These colors are designed to work well together and provide good contrast
8
+ * Migration colors match the exact gradient used in ParliamentChart for visual consistency
9
+ */
10
+ export declare const DEFAULT_STACKED_AREA_COLORS: {
11
+ readonly critical: "#dc3545";
12
+ readonly high: "#fd7e14";
13
+ readonly medium: "#ffc107";
14
+ readonly low: "#17a2b8";
15
+ readonly complete: "#40c048";
16
+ readonly inProgress: "#007bff";
17
+ readonly farthest: string | undefined;
18
+ readonly far: string | undefined;
19
+ readonly close: string | undefined;
20
+ readonly closest: string | undefined;
21
+ readonly completed: string | undefined;
22
+ readonly primary: "#007bff";
23
+ readonly secondary: "#6c757d";
24
+ readonly success: "#40c048";
25
+ readonly danger: "#dc3545";
26
+ readonly warning: "#ffc107";
27
+ readonly info: "#17a2b8";
28
+ readonly light: "#EDEFEF";
29
+ readonly dark: "#343a40";
30
+ };
31
+ /**
32
+ * Predefined color palettes for common use cases
33
+ */
34
+ export declare const STACKED_AREA_PALETTES: {
35
+ readonly migration: string[];
36
+ readonly severity: readonly ["#dc3545", "#fd7e14", "#ffc107", "#17a2b8", "#17a2b8"];
37
+ readonly status: readonly ["#dc3545", "#ffc107", "#40c048"];
38
+ readonly extended: readonly ["#e74c3c", "#e67e22", "#f39c12", "#2ecc71", "#3498db", "#9b59b6", "#1abc9c", "#95a5a6"];
39
+ readonly colorblindSafe: readonly ["#0173B2", "#DE8F05", "#029E73", "#CC78BC", "#CA9161", "#FBAFE4", "#949494", "#ECE133"];
40
+ };
41
+ /**
42
+ * Category label constants for common use cases
43
+ * These match the categories used in ParliamentChart for transition compatibility
44
+ */
45
+ export declare const CATEGORY_LABELS: {
46
+ readonly FARTHEST: "Farthest";
47
+ readonly FAR: "Far";
48
+ readonly CLOSE: "Close";
49
+ readonly CLOSEST: "Closest";
50
+ readonly COMPLETE: "Complete";
51
+ readonly CRITICAL: "Critical";
52
+ readonly HIGH: "High";
53
+ readonly MEDIUM: "Medium";
54
+ readonly LOW: "Low";
55
+ readonly INFO: "Info";
56
+ readonly NOT_APPLICABLE: "N/A";
57
+ readonly NO_LST: "No LST";
58
+ readonly DATA_MISSING: "Data Missing";
59
+ };
@@ -13,6 +13,14 @@ export declare const DEFAULT_CHART_COLORS: {
13
13
  readonly 600: "#40c048";
14
14
  };
15
15
  };
16
+ /**
17
+ * Measure gradient colors used for progress/distance categories
18
+ * Shared between ParliamentChart and StackedAreaChart for visual consistency
19
+ *
20
+ * Color progression: Green (best/complete) → Red (worst/farthest)
21
+ * Used for categories like: Complete, Closest, Close, Far, Farthest
22
+ */
23
+ export declare const MEASURE_GRADIENT_COLORS: readonly ["#4CA75A", "#FDDA04", "#FFC008", "#FF9800", "#F9A91B", "#FF5C24", "#ED4134", "#CB3446"];
16
24
  /**
17
25
  * Color configuration type for parliament chart theming
18
26
  */
@@ -24,7 +32,3 @@ export type ParliamentChartColors = typeof DEFAULT_CHART_COLORS;
24
32
  export interface ParliamentChartTheme {
25
33
  colors?: Partial<ParliamentChartColors>;
26
34
  }
27
- /**
28
- * Merges custom theme colors with default colors
29
- */
30
- export declare function mergeThemeColors(customColors?: Partial<ParliamentChartColors>): ParliamentChartColors;
@@ -4,7 +4,7 @@ export declare const TIMELINE_DEFAULTS: {
4
4
  readonly primary: "#992FB9";
5
5
  readonly background: "#FFFFFF";
6
6
  readonly border: "#9CA3AF";
7
- readonly highlightBackground: "rgba(229, 231, 235, 0.5)";
7
+ readonly highlightBackground: "rgba(31, 41, 55, 0.14)";
8
8
  readonly monthLabel: "#9ca3af";
9
9
  readonly tooltipText: "#6b7280";
10
10
  };
@@ -13,6 +13,17 @@ export declare const TIMELINE_DEFAULTS: {
13
13
  readonly eventWidth: 2;
14
14
  };
15
15
  };
16
+ /**
17
+ * Get default slot props with arrow handle styling
18
+ */
19
+ export declare const getArrowHandleSlotProps: (color?: string) => {
20
+ startHandle: {
21
+ sx: SxProps<Theme>;
22
+ };
23
+ endHandle: {
24
+ sx: SxProps<Theme>;
25
+ };
26
+ };
16
27
  export declare const defaultSlotProps: {
17
28
  header: {
18
29
  sx: SxProps<Theme>;
@@ -38,6 +49,8 @@ export declare const defaultSlotProps: {
38
49
  selection: {
39
50
  sx: SxProps<Theme>;
40
51
  };
52
+ startHandle: {};
53
+ endHandle: {};
41
54
  tooltip: {
42
55
  sx: SxProps<Theme>;
43
56
  };
@@ -48,3 +61,14 @@ export declare const defaultSlotProps: {
48
61
  sx: SxProps<Theme>;
49
62
  };
50
63
  };
64
+ /**
65
+ * Get grip handle slot props with custom color
66
+ */
67
+ export declare const getGripHandleSlotProps: (color?: string) => {
68
+ startHandle: {
69
+ sx: SxProps<Theme>;
70
+ };
71
+ endHandle: {
72
+ sx: SxProps<Theme>;
73
+ };
74
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moderneinc/react-charts",
3
- "version": "1.2.0",
3
+ "version": "1.3.0-next.44efd5",
4
4
  "description": "Parliament chart visualization library for React",
5
5
  "type": "module",
6
6
  "devEngines": {
@@ -24,23 +24,25 @@
24
24
  }
25
25
  },
26
26
  "scripts": {
27
- "dev": "vite",
28
- "build": "tsc --noEmit && vite build",
29
- "test": "vitest",
30
- "test:ui": "vitest --ui",
31
- "storybook": "storybook dev -p 6006",
32
27
  "build-storybook": "storybook build",
33
- "check:all": "npm run format && npm run check:lint:fix && npm run check:lint && npm run check:types && npm run test",
34
- "check:lint:fix": "npm run check:biome:fix",
35
- "check:lint": "npm run check:biome",
28
+ "build": "tsc --noEmit && vite build",
29
+ "build:watch": "vite build --watch",
30
+ "check:all": "npm run format && npm run check:lint:fix && npm run check:lint && npm run check:types && npm run test && npm run check:unused",
36
31
  "check:biome:fix": "biome check --write",
37
32
  "check:biome": "biome check",
33
+ "check:lint:fix": "npm run check:biome:fix",
34
+ "check:lint": "npm run check:biome",
38
35
  "check:types": "tsc --noEmit",
36
+ "check:unused": "knip",
37
+ "dev": "vite",
39
38
  "format:check": "biome format .",
40
39
  "format": "biome format --write .",
41
40
  "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
42
41
  "preview": "vite preview",
43
42
  "release": "semantic-release",
43
+ "storybook": "storybook dev -p 6006",
44
+ "test:ui": "vitest --ui",
45
+ "test": "vitest",
44
46
  "update:nvmrc": "jq -r '.devEngines.runtime.version' package.json > .nvmrc"
45
47
  },
46
48
  "peerDependencies": {
@@ -52,6 +54,13 @@
52
54
  "react-dom": "^18.0.0 || ^19.0.0"
53
55
  },
54
56
  "dependencies": {
57
+ "d3-axis": "^3.0.0",
58
+ "d3-brush": "^3.0.0",
59
+ "d3-scale": "^4.0.2",
60
+ "d3-selection": "^3.0.0",
61
+ "d3-shape": "^3.2.0",
62
+ "d3-transition": "^3.0.1",
63
+ "gsap": "^3.13.0",
55
64
  "hast-util-to-html": "^9.0.5",
56
65
  "hastscript": "^9.0.1",
57
66
  "sainte-lague": "^3.0.0"
@@ -69,24 +78,27 @@
69
78
  "@storybook/addon-interactions": "^8.4.7",
70
79
  "@storybook/addon-links": "^8.4.7",
71
80
  "@storybook/addon-themes": "^8.4.7",
72
- "@storybook/blocks": "^8.4.7",
73
81
  "@storybook/react": "^8.4.7",
74
82
  "@storybook/react-vite": "^8.4.7",
75
83
  "@storybook/test": "^8.4.7",
84
+ "@types/d3-axis": "^3.0.6",
85
+ "@types/d3-brush": "^3.0.6",
86
+ "@types/d3-scale": "^4.0.9",
87
+ "@types/d3-selection": "^3.0.11",
88
+ "@types/d3-shape": "^3.1.7",
89
+ "@types/d3-transition": "^3.0.9",
90
+ "@types/hast": "^3.0.4",
76
91
  "@types/react": "^18.3.0",
77
92
  "@types/react-dom": "^18.3.0",
78
- "@typescript-eslint/eslint-plugin": "^8.44.0",
79
- "@typescript-eslint/parser": "^8.44.0",
80
93
  "@vitejs/plugin-react": "^4.3.4",
94
+ "@vitest/coverage-v8": "^3.2.4",
81
95
  "@vitest/ui": "^3.2.4",
82
96
  "eslint": "^9.36.0",
83
- "eslint-plugin-react-hooks": "^5.1.0",
84
- "eslint-plugin-react-refresh": "^0.4.16",
85
- "eslint-plugin-storybook": "^0.11.1",
86
97
  "jsdom": "^27.0.0",
98
+ "knip": "^5.66.4",
87
99
  "react": "^19.1.1",
88
100
  "react-dom": "^19.1.1",
89
- "semantic-release": "^24.2.0",
101
+ "semantic-release": "^25.0.2",
90
102
  "storybook": "^8.4.7",
91
103
  "typescript": "^5.9.2",
92
104
  "vite": "^6.0.11",