@contentmunch/contentmunch-ui 1.1.18 → 1.1.19

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.
@@ -36,6 +36,11 @@
36
36
  --orange: rgba(255, 127, 0, 1.0);
37
37
  --red: rgba(255, 0, 0, 1.0);
38
38
  --brown: var(--danger-color);
39
+ --light-color: #f0f0f0;
40
+ --snippet-highlight-color: #fff3b0;
41
+ --not-started-color: #64748b;
42
+ --completed-color: var(--success-color);
43
+ --in-progress-color: #3730a3;
39
44
 
40
45
  /* Sizes */
41
46
  --extra-small-size: 20rem;
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ import "./assets/pie-chart.css";
3
+ import type { PieChartData } from "./data/PieChartData";
4
+ export declare const PieChart: React.FC<PieChartProps>;
5
+ export interface PieChartProps {
6
+ data: PieChartData[];
7
+ withLegend?: boolean;
8
+ legendTitle?: string;
9
+ onClick?: (index: number) => void;
10
+ valueFormatter?: (num: number, index: number) => string;
11
+ colorRange?: string[];
12
+ }
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ import "./assets/stacked-bar-chart.css";
3
+ import type { StackedBarChartData } from "./data/StackedBarChartData";
4
+ export declare const StackedBarChart: React.FC<BarChartProps>;
5
+ export interface BarChartProps {
6
+ data: StackedBarChartData;
7
+ comparisonData?: StackedBarChartData;
8
+ toPercentage?: boolean;
9
+ colorRange?: string[];
10
+ withLegend?: boolean;
11
+ showOnlyValues?: boolean;
12
+ }
@@ -0,0 +1,84 @@
1
+ .muncher-pie-chart {
2
+ .svg-pie-chart-legend {
3
+ display: none;
4
+ }
5
+
6
+
7
+ .svg-pie-chart {
8
+ width: 12rem;
9
+ height: 12rem;
10
+
11
+ path {
12
+ cursor: pointer;
13
+ opacity: 1;
14
+ transition: fill ease-in-out .4s;
15
+ }
16
+
17
+ path:hover {
18
+ opacity: .9;
19
+ }
20
+
21
+ .selected {
22
+ opacity: .9;
23
+ stroke: var(--light-color);
24
+ stroke-width: .1rem;
25
+ }
26
+
27
+ .text {
28
+ font-size: .3rem;
29
+ font-weight: bold;
30
+ font-family: var(--sans-serif-font), sans-serif;
31
+ }
32
+
33
+ .value {
34
+ font-size: .2rem;
35
+ }
36
+
37
+ @media (max-width: 40rem) {
38
+ width: 15rem;
39
+ height: 15rem;
40
+ .text {
41
+ font-weight: lighter;
42
+ }
43
+ }
44
+ }
45
+
46
+ @media (max-width: 40rem) {
47
+ display: flex;
48
+ align-items: flex-start;
49
+ justify-content: flex-start;
50
+
51
+ .svg-pie-chart-legend {
52
+ display: block;
53
+ width: 10rem;
54
+ height: 15rem;
55
+
56
+ .legend-rect {
57
+ cursor: pointer;
58
+ }
59
+
60
+ .legend-rect--selected {
61
+ stroke: var(--light-color);
62
+ stroke-width: .05rem;
63
+
64
+ }
65
+
66
+ .legend-title {
67
+ font-size: .3rem;
68
+ }
69
+
70
+ .legend-text {
71
+ font-size: .25rem;
72
+ cursor: pointer;
73
+ }
74
+
75
+ .legend-text--selected {
76
+ text-decoration: underline;
77
+ }
78
+
79
+ .legend-rect:hover, .legend-text:hover {
80
+ opacity: .8;
81
+ }
82
+ }
83
+ }
84
+ }
@@ -0,0 +1,50 @@
1
+ .muncher-bar-chart {
2
+ .svg-bar-chart-legend {
3
+ display: none;
4
+ }
5
+
6
+ .svg-bar-chart {
7
+ width: 90vw;
8
+ @media (max-width: 40rem) {
9
+ width: 60vw;
10
+ }
11
+
12
+ .tick {
13
+ text {
14
+ color: #000;
15
+ font-family: var(--serif-font), serif;
16
+ font-size: .4rem;
17
+ }
18
+ }
19
+
20
+ .bar-rectangle:hover {
21
+ opacity: .8;
22
+ }
23
+
24
+ .bar-text {
25
+ font-family: var(--serif-font), serif;
26
+ color: white;
27
+ font-size: .3rem;
28
+ fill: #000;
29
+
30
+ }
31
+ }
32
+
33
+ @media (max-width: 40rem) {
34
+ display: flex;
35
+ align-items: flex-start;
36
+ justify-content: flex-start;
37
+ .svg-bar-chart-legend {
38
+ display: block;
39
+ width: 10vw;
40
+
41
+ text {
42
+ font-family: var(--serif-font), serif;
43
+ font-size: .16rem;
44
+ text-transform: capitalize;
45
+ }
46
+
47
+ }
48
+ }
49
+
50
+ }
@@ -0,0 +1,6 @@
1
+ export interface PieChartData {
2
+ title: string;
3
+ value: number;
4
+ legend?: string;
5
+ isSelected: boolean;
6
+ }
@@ -0,0 +1,10 @@
1
+ export interface StackedBarChartData {
2
+ titleField: string;
3
+ totalField: string;
4
+ stackFields: string[];
5
+ values: FieldValue[];
6
+ titleSeparator?: string;
7
+ }
8
+ export interface FieldValue {
9
+ [id: string]: number | string;
10
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentmunch/contentmunch-ui",
3
- "version": "1.1.18",
3
+ "version": "1.1.19",
4
4
  "description": "Contentmunch UI components",
5
5
  "author": "contentmunch",
6
6
  "license": "MIT",
@@ -59,10 +59,12 @@
59
59
  "@storybook/react": "^8.6.14",
60
60
  "@storybook/react-vite": "^8.6.14",
61
61
  "@storybook/test": "^8.6.14",
62
+ "@types/d3": "^7.4.3",
62
63
  "@types/node": "^22.15.21",
63
64
  "@types/react": "^19.1.2",
64
65
  "@types/react-dom": "^19.1.2",
65
66
  "@vitejs/plugin-react": "^4.4.1",
67
+ "d3": "^7.9.0",
66
68
  "eslint": "^9.25.0",
67
69
  "eslint-plugin-react-hooks": "^5.2.0",
68
70
  "eslint-plugin-react-refresh": "^0.4.19",