@nuvui/charts 0.0.0-stage → 0.1.1

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 (45) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +75 -2
  3. package/dist/components/chart/chart-container.cjs +62 -0
  4. package/dist/components/chart/chart-container.d.cts +44 -0
  5. package/dist/components/chart/chart-container.d.ts +44 -0
  6. package/dist/components/chart/chart-container.js +62 -0
  7. package/dist/components/chart/chart-legend.cjs +55 -0
  8. package/dist/components/chart/chart-legend.d.cts +29 -0
  9. package/dist/components/chart/chart-legend.d.ts +29 -0
  10. package/dist/components/chart/chart-legend.js +54 -0
  11. package/dist/components/chart/chart-table.cjs +42 -0
  12. package/dist/components/chart/chart-table.d.cts +41 -0
  13. package/dist/components/chart/chart-table.d.ts +41 -0
  14. package/dist/components/chart/chart-table.js +42 -0
  15. package/dist/components/chart/chart-tooltip.cjs +99 -0
  16. package/dist/components/chart/chart-tooltip.d.cts +41 -0
  17. package/dist/components/chart/chart-tooltip.d.ts +41 -0
  18. package/dist/components/chart/chart-tooltip.js +97 -0
  19. package/dist/components/chart/config.cjs +81 -0
  20. package/dist/components/chart/config.d.cts +45 -0
  21. package/dist/components/chart/config.d.ts +45 -0
  22. package/dist/components/chart/config.js +75 -0
  23. package/dist/components/chart/context.cjs +20 -0
  24. package/dist/components/chart/context.d.cts +6 -0
  25. package/dist/components/chart/context.d.ts +6 -0
  26. package/dist/components/chart/context.js +18 -0
  27. package/dist/components/chart/index.cjs +15 -0
  28. package/dist/components/chart/index.d.cts +8 -0
  29. package/dist/components/chart/index.d.ts +8 -0
  30. package/dist/components/chart/index.js +6 -0
  31. package/dist/components/chart/patterns.cjs +81 -0
  32. package/dist/components/chart/patterns.js +81 -0
  33. package/dist/components/chart/swatch.cjs +34 -0
  34. package/dist/components/chart/swatch.d.cts +7 -0
  35. package/dist/components/chart/swatch.d.ts +7 -0
  36. package/dist/components/chart/swatch.js +34 -0
  37. package/dist/css/chart.css +199 -0
  38. package/dist/index.cjs +15 -0
  39. package/dist/index.d.cts +9 -0
  40. package/dist/index.d.ts +9 -0
  41. package/dist/index.js +6 -0
  42. package/dist/styles.css +199 -0
  43. package/dist/utils/cx.cjs +6 -0
  44. package/dist/utils/cx.js +6 -0
  45. package/package.json +96 -3
@@ -0,0 +1,81 @@
1
+ let react_jsx_runtime = require("react/jsx-runtime");
2
+ //#region src/components/chart/patterns.tsx
3
+ function Tile({ pattern, color }) {
4
+ const line = {
5
+ stroke: color,
6
+ strokeWidth: 2
7
+ };
8
+ switch (pattern) {
9
+ case "diagonal":
10
+ case "reverse-diagonal":
11
+ case "vertical": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
12
+ x1: "4",
13
+ y1: "0",
14
+ x2: "4",
15
+ y2: "8",
16
+ ...line
17
+ });
18
+ case "horizontal": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
19
+ x1: "0",
20
+ y1: "4",
21
+ x2: "8",
22
+ y2: "4",
23
+ ...line
24
+ });
25
+ case "dots": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
26
+ cx: "4",
27
+ cy: "4",
28
+ r: "1.75",
29
+ fill: color
30
+ });
31
+ case "cross": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
32
+ d: "M1 1l6 6M7 1l-6 6",
33
+ fill: "none",
34
+ ...line,
35
+ strokeWidth: 1.5
36
+ });
37
+ case "grid": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
38
+ d: "M4 0v8M0 4h8",
39
+ fill: "none",
40
+ ...line,
41
+ strokeWidth: 1.5
42
+ });
43
+ default: return null;
44
+ }
45
+ }
46
+ const turns = {
47
+ diagonal: "rotate(45)",
48
+ "reverse-diagonal": "rotate(-45)"
49
+ };
50
+ function Patterns({ series }) {
51
+ const drawn = series.filter((entry) => entry.patternId);
52
+ if (drawn.length === 0) return null;
53
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
54
+ className: "nuv-chart__patterns",
55
+ "aria-hidden": "true",
56
+ focusable: "false",
57
+ width: "0",
58
+ height: "0",
59
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("defs", { children: drawn.map((entry) => {
60
+ const color = `var(--chart-${entry.name})`;
61
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("pattern", {
62
+ id: entry.patternId,
63
+ width: "8",
64
+ height: "8",
65
+ patternUnits: "userSpaceOnUse",
66
+ patternTransform: turns[entry.pattern],
67
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
68
+ width: "8",
69
+ height: "8",
70
+ fill: color,
71
+ opacity: "0.3"
72
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tile, {
73
+ pattern: entry.pattern,
74
+ color
75
+ })]
76
+ }, entry.key);
77
+ }) })
78
+ });
79
+ }
80
+ //#endregion
81
+ exports.Patterns = Patterns;
@@ -0,0 +1,81 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ //#region src/components/chart/patterns.tsx
3
+ function Tile({ pattern, color }) {
4
+ const line = {
5
+ stroke: color,
6
+ strokeWidth: 2
7
+ };
8
+ switch (pattern) {
9
+ case "diagonal":
10
+ case "reverse-diagonal":
11
+ case "vertical": return /* @__PURE__ */ jsx("line", {
12
+ x1: "4",
13
+ y1: "0",
14
+ x2: "4",
15
+ y2: "8",
16
+ ...line
17
+ });
18
+ case "horizontal": return /* @__PURE__ */ jsx("line", {
19
+ x1: "0",
20
+ y1: "4",
21
+ x2: "8",
22
+ y2: "4",
23
+ ...line
24
+ });
25
+ case "dots": return /* @__PURE__ */ jsx("circle", {
26
+ cx: "4",
27
+ cy: "4",
28
+ r: "1.75",
29
+ fill: color
30
+ });
31
+ case "cross": return /* @__PURE__ */ jsx("path", {
32
+ d: "M1 1l6 6M7 1l-6 6",
33
+ fill: "none",
34
+ ...line,
35
+ strokeWidth: 1.5
36
+ });
37
+ case "grid": return /* @__PURE__ */ jsx("path", {
38
+ d: "M4 0v8M0 4h8",
39
+ fill: "none",
40
+ ...line,
41
+ strokeWidth: 1.5
42
+ });
43
+ default: return null;
44
+ }
45
+ }
46
+ const turns = {
47
+ diagonal: "rotate(45)",
48
+ "reverse-diagonal": "rotate(-45)"
49
+ };
50
+ function Patterns({ series }) {
51
+ const drawn = series.filter((entry) => entry.patternId);
52
+ if (drawn.length === 0) return null;
53
+ return /* @__PURE__ */ jsx("svg", {
54
+ className: "nuv-chart__patterns",
55
+ "aria-hidden": "true",
56
+ focusable: "false",
57
+ width: "0",
58
+ height: "0",
59
+ children: /* @__PURE__ */ jsx("defs", { children: drawn.map((entry) => {
60
+ const color = `var(--chart-${entry.name})`;
61
+ return /* @__PURE__ */ jsxs("pattern", {
62
+ id: entry.patternId,
63
+ width: "8",
64
+ height: "8",
65
+ patternUnits: "userSpaceOnUse",
66
+ patternTransform: turns[entry.pattern],
67
+ children: [/* @__PURE__ */ jsx("rect", {
68
+ width: "8",
69
+ height: "8",
70
+ fill: color,
71
+ opacity: "0.3"
72
+ }), /* @__PURE__ */ jsx(Tile, {
73
+ pattern: entry.pattern,
74
+ color
75
+ })]
76
+ }, entry.key);
77
+ }) })
78
+ });
79
+ }
80
+ //#endregion
81
+ export { Patterns };
@@ -0,0 +1,34 @@
1
+ const require_config = require("./config.cjs");
2
+ let react_jsx_runtime = require("react/jsx-runtime");
3
+ //#region src/components/chart/swatch.tsx
4
+ function Swatch({ series, color, indicator }) {
5
+ if (indicator === "line") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
6
+ className: "nuv-chart__swatch nuv-chart__swatch--line",
7
+ "aria-hidden": "true",
8
+ focusable: "false",
9
+ viewBox: "0 0 24 12",
10
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
11
+ x1: "0",
12
+ y1: "6",
13
+ x2: "24",
14
+ y2: "6",
15
+ strokeWidth: "2",
16
+ stroke: series ? require_config.chartColor(series) : color,
17
+ strokeDasharray: series ? require_config.chartDash(series) : void 0
18
+ })
19
+ });
20
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
21
+ className: "nuv-chart__swatch",
22
+ "aria-hidden": "true",
23
+ focusable: "false",
24
+ viewBox: "0 0 12 12",
25
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
26
+ width: "12",
27
+ height: "12",
28
+ rx: "2",
29
+ fill: series ? require_config.chartFill(series) : color
30
+ })
31
+ });
32
+ }
33
+ //#endregion
34
+ exports.Swatch = Swatch;
@@ -0,0 +1,7 @@
1
+ //#region src/components/chart/swatch.d.ts
2
+ /**
3
+ * `"square"` shows a series' fill, pattern included. `"line"` shows its
4
+ * line, dashes included, and suits a line chart.
5
+ */
6
+ export type ChartIndicator = "square" | "line";
7
+ //#endregion
@@ -0,0 +1,7 @@
1
+ //#region src/components/chart/swatch.d.ts
2
+ /**
3
+ * `"square"` shows a series' fill, pattern included. `"line"` shows its
4
+ * line, dashes included, and suits a line chart.
5
+ */
6
+ export type ChartIndicator = "square" | "line";
7
+ //#endregion
@@ -0,0 +1,34 @@
1
+ import { chartColor, chartDash, chartFill } from "./config.js";
2
+ import { jsx } from "react/jsx-runtime";
3
+ //#region src/components/chart/swatch.tsx
4
+ function Swatch({ series, color, indicator }) {
5
+ if (indicator === "line") return /* @__PURE__ */ jsx("svg", {
6
+ className: "nuv-chart__swatch nuv-chart__swatch--line",
7
+ "aria-hidden": "true",
8
+ focusable: "false",
9
+ viewBox: "0 0 24 12",
10
+ children: /* @__PURE__ */ jsx("line", {
11
+ x1: "0",
12
+ y1: "6",
13
+ x2: "24",
14
+ y2: "6",
15
+ strokeWidth: "2",
16
+ stroke: series ? chartColor(series) : color,
17
+ strokeDasharray: series ? chartDash(series) : void 0
18
+ })
19
+ });
20
+ return /* @__PURE__ */ jsx("svg", {
21
+ className: "nuv-chart__swatch",
22
+ "aria-hidden": "true",
23
+ focusable: "false",
24
+ viewBox: "0 0 12 12",
25
+ children: /* @__PURE__ */ jsx("rect", {
26
+ width: "12",
27
+ height: "12",
28
+ rx: "2",
29
+ fill: series ? chartFill(series) : color
30
+ })
31
+ });
32
+ }
33
+ //#endregion
34
+ export { Swatch };
@@ -0,0 +1,199 @@
1
+ @layer tokens, base, components;
2
+ @layer components {
3
+ .nuv-chart {
4
+ --nuv-chart-patterns: ;
5
+ --nuv-chart-solid: initial;
6
+ position: relative;
7
+ inline-size: 100%;
8
+ min-inline-size: 0;
9
+ color: var(--nuv-chart-fg, var(--color-muted-foreground));
10
+ font-size: var(--nuv-chart-font-size, var(--text-xs));
11
+ line-height: var(--text-xs--line-height);
12
+ }
13
+ .nuv-chart[data-patterns] {
14
+ --nuv-chart-patterns: initial;
15
+ --nuv-chart-solid: ;
16
+ }
17
+ @media (forced-colors: active) {
18
+ .nuv-chart {
19
+ --nuv-chart-patterns: initial;
20
+ --nuv-chart-solid: ;
21
+ --nuv-chart-forced-color: CanvasText;
22
+ --nuv-chart-grid: GrayText;
23
+ --nuv-chart-axis: CanvasText;
24
+ --nuv-chart-fg: CanvasText;
25
+ --nuv-chart-label-fg: CanvasText;
26
+ --nuv-chart-backdrop: Canvas;
27
+ --nuv-chart-cursor: GrayText;
28
+ }
29
+ }
30
+ .nuv-chart__plot {
31
+ inline-size: 100%;
32
+ block-size: var(--nuv-chart-height, auto);
33
+ aspect-ratio: var(--nuv-chart-aspect-ratio, 16/9);
34
+ }
35
+ .nuv-chart__patterns {
36
+ position: absolute;
37
+ pointer-events: none;
38
+ }
39
+ .nuv-chart__tooltip {
40
+ display: grid;
41
+ gap: calc(var(--spacing) * 1.5);
42
+ min-inline-size: 8rem;
43
+ padding: calc(var(--spacing) * 2) calc(var(--spacing) * 2.5);
44
+ border: var(--nuv-border-width) solid var(--nuv-chart-tooltip-border, var(--color-border));
45
+ border-radius: var(--nuv-chart-tooltip-radius, var(--radius-lg));
46
+ background-color: var(--nuv-chart-tooltip-bg, var(--color-surface));
47
+ box-shadow: var(--nuv-chart-tooltip-shadow, var(--shadow-lg));
48
+ color: var(--nuv-chart-tooltip-fg, var(--color-surface-foreground));
49
+ font-size: var(--text-xs);
50
+ line-height: var(--text-xs--line-height);
51
+ }
52
+ .nuv-chart__tooltip[hidden] {
53
+ display: none;
54
+ }
55
+ .nuv-chart__tooltip-label {
56
+ font-weight: var(--font-weight-medium);
57
+ }
58
+ .nuv-chart__tooltip-items {
59
+ display: grid;
60
+ gap: var(--spacing);
61
+ margin: 0;
62
+ padding: 0;
63
+ list-style: none;
64
+ }
65
+ .nuv-chart__tooltip-item {
66
+ display: flex;
67
+ gap: calc(var(--spacing) * 2);
68
+ align-items: center;
69
+ }
70
+ .nuv-chart__tooltip-name {
71
+ flex: 1;
72
+ color: var(--color-muted-foreground);
73
+ }
74
+ .nuv-chart__tooltip-value {
75
+ margin-inline-start: calc(var(--spacing) * 2);
76
+ font-weight: var(--font-weight-medium);
77
+ font-variant-numeric: tabular-nums;
78
+ }
79
+ .nuv-chart__swatch {
80
+ flex: none;
81
+ inline-size: calc(var(--spacing) * 3);
82
+ block-size: calc(var(--spacing) * 3);
83
+ }
84
+ .nuv-chart__swatch--line {
85
+ inline-size: calc(var(--spacing) * 6);
86
+ }
87
+ .nuv-chart__legend {
88
+ display: flex;
89
+ flex-wrap: wrap;
90
+ gap: calc(var(--spacing) * 1) calc(var(--spacing) * 4);
91
+ align-items: center;
92
+ justify-content: center;
93
+ margin: 0;
94
+ padding: 0;
95
+ color: var(--nuv-chart-legend-fg, var(--color-foreground));
96
+ list-style: none;
97
+ }
98
+ .nuv-chart__legend-item {
99
+ display: inline-flex;
100
+ gap: calc(var(--spacing) * 1.5);
101
+ align-items: center;
102
+ }
103
+ .nuv-chart__legend-item--inactive {
104
+ opacity: var(--nuv-disabled-opacity);
105
+ }
106
+ .nuv-chart__data {
107
+ margin-block-start: calc(var(--spacing) * 4);
108
+ }
109
+ .nuv-chart__table {
110
+ inline-size: 100%;
111
+ border-collapse: collapse;
112
+ color: var(--nuv-chart-table-fg, var(--color-foreground));
113
+ font-size: var(--text-sm);
114
+ line-height: var(--text-sm--line-height);
115
+ font-variant-numeric: tabular-nums;
116
+ text-align: end;
117
+ }
118
+ .nuv-chart__table caption {
119
+ padding-block-end: calc(var(--spacing) * 2);
120
+ color: var(--color-muted-foreground);
121
+ text-align: start;
122
+ }
123
+ .nuv-chart__table th,
124
+ .nuv-chart__table td {
125
+ padding: calc(var(--spacing) * 1.5) calc(var(--spacing) * 3);
126
+ border-block-end: var(--nuv-border-width) solid var(--nuv-chart-table-border, var(--color-border));
127
+ }
128
+ .nuv-chart__table th {
129
+ font-weight: var(--font-weight-medium);
130
+ }
131
+ .nuv-chart__table th:first-child {
132
+ text-align: start;
133
+ }
134
+ .nuv-chart__data--hidden {
135
+ position: absolute;
136
+ inline-size: 1px;
137
+ block-size: 1px;
138
+ margin: -1px;
139
+ padding: 0;
140
+ overflow: hidden;
141
+ border: 0;
142
+ clip-path: inset(50%);
143
+ white-space: nowrap;
144
+ }
145
+ /* stylelint-disable selector-class-pattern, selector-max-compound-selectors */
146
+ .nuv-chart .recharts-surface {
147
+ overflow: visible;
148
+ border-radius: var(--radius-sm);
149
+ outline: none;
150
+ }
151
+ .nuv-chart .recharts-surface:focus-visible {
152
+ outline: var(--nuv-focus-ring-width, 2px) solid var(--nuv-focus-ring-color, var(--color-ring));
153
+ outline-offset: var(--nuv-focus-ring-offset, 2px);
154
+ }
155
+ .nuv-chart .recharts-layer,
156
+ .nuv-chart .recharts-sector {
157
+ outline: none;
158
+ }
159
+ .nuv-chart .recharts-text {
160
+ fill: currentcolor;
161
+ }
162
+ .nuv-chart .recharts-label {
163
+ fill: var(--nuv-chart-label-fg, var(--color-foreground));
164
+ }
165
+ .nuv-chart .recharts-cartesian-grid line,
166
+ .nuv-chart .recharts-polar-grid line,
167
+ .nuv-chart .recharts-polar-grid-concentric-polygon,
168
+ .nuv-chart .recharts-polar-grid-concentric-circle {
169
+ stroke: var(--nuv-chart-grid, var(--color-border));
170
+ }
171
+ .nuv-chart .recharts-cartesian-axis-line,
172
+ .nuv-chart .recharts-cartesian-axis-tick-line,
173
+ .nuv-chart .recharts-polar-angle-axis-tick-line,
174
+ .nuv-chart .recharts-polar-radius-axis-line,
175
+ .nuv-chart .recharts-polar-radius-axis-tick-line,
176
+ .nuv-chart .recharts-reference-line-line {
177
+ stroke: var(--nuv-chart-axis, var(--color-border-strong));
178
+ }
179
+ .nuv-chart .recharts-curve.recharts-tooltip-cursor {
180
+ stroke: var(--nuv-chart-cursor, var(--color-border-strong));
181
+ }
182
+ .nuv-chart .recharts-rectangle.recharts-tooltip-cursor,
183
+ .nuv-chart .recharts-sector.recharts-tooltip-cursor,
184
+ .nuv-chart .recharts-radial-bar-background-sector {
185
+ fill: var(--nuv-chart-cursor, var(--color-muted));
186
+ }
187
+ .nuv-chart .recharts-sector[stroke="#fff"],
188
+ .nuv-chart .recharts-dot[stroke="#fff"],
189
+ .nuv-chart .recharts-active-dot [stroke="#fff"] {
190
+ stroke: var(--nuv-chart-backdrop, var(--color-background));
191
+ }
192
+ .nuv-chart .recharts-dot[fill="#fff"] {
193
+ fill: var(--nuv-chart-backdrop, var(--color-background));
194
+ }
195
+ .nuv-chart .recharts-tooltip-wrapper {
196
+ z-index: var(--nuv-z-popover);
197
+ }
198
+ /* stylelint-enable selector-class-pattern, selector-max-compound-selectors */
199
+ }
package/dist/index.cjs ADDED
@@ -0,0 +1,15 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_config = require("./components/chart/config.cjs");
3
+ const require_chart_container = require("./components/chart/chart-container.cjs");
4
+ const require_chart_tooltip = require("./components/chart/chart-tooltip.cjs");
5
+ const require_chart_legend = require("./components/chart/chart-legend.cjs");
6
+ const require_chart_table = require("./components/chart/chart-table.cjs");
7
+ exports.ChartContainer = require_chart_container.ChartContainer;
8
+ exports.ChartLegend = require_chart_legend.ChartLegend;
9
+ exports.ChartLegendContent = require_chart_legend.ChartLegendContent;
10
+ exports.ChartTable = require_chart_table.ChartTable;
11
+ exports.ChartTooltip = require_chart_tooltip.ChartTooltip;
12
+ exports.ChartTooltipContent = require_chart_tooltip.ChartTooltipContent;
13
+ exports.chartColor = require_config.chartColor;
14
+ exports.chartDash = require_config.chartDash;
15
+ exports.chartFill = require_config.chartFill;
@@ -0,0 +1,9 @@
1
+ import { ChartConfig, ChartDash, ChartPattern, ChartSeries, chartColor, chartDash, chartFill } from "./components/chart/config.cjs";
2
+ import { ChartValueFormatter } from "./components/chart/context.cjs";
3
+ import { ChartContainer, ChartContainerOwnProps, ChartContainerProps, ChartName } from "./components/chart/chart-container.cjs";
4
+ import { ChartIndicator } from "./components/chart/swatch.cjs";
5
+ import { ChartLegend, ChartLegendContent, ChartLegendContentOwnProps, ChartLegendContentProps, ChartLegendProps } from "./components/chart/chart-legend.cjs";
6
+ import { ChartTable, ChartTableOwnProps, ChartTableProps } from "./components/chart/chart-table.cjs";
7
+ import { ChartTooltip, ChartTooltipContent, ChartTooltipContentOwnProps, ChartTooltipContentProps, ChartTooltipProps } from "./components/chart/chart-tooltip.cjs";
8
+ import "./components/chart/index.cjs";
9
+ export { type ChartConfig, ChartContainer, type ChartContainerOwnProps, type ChartContainerProps, type ChartDash, type ChartIndicator, ChartLegend, ChartLegendContent, type ChartLegendContentOwnProps, type ChartLegendContentProps, type ChartLegendProps, type ChartName, type ChartPattern, type ChartSeries, ChartTable, type ChartTableOwnProps, type ChartTableProps, ChartTooltip, ChartTooltipContent, type ChartTooltipContentOwnProps, type ChartTooltipContentProps, type ChartTooltipProps, type ChartValueFormatter, chartColor, chartDash, chartFill };
@@ -0,0 +1,9 @@
1
+ import { ChartConfig, ChartDash, ChartPattern, ChartSeries, chartColor, chartDash, chartFill } from "./components/chart/config.js";
2
+ import { ChartValueFormatter } from "./components/chart/context.js";
3
+ import { ChartContainer, ChartContainerOwnProps, ChartContainerProps, ChartName } from "./components/chart/chart-container.js";
4
+ import { ChartIndicator } from "./components/chart/swatch.js";
5
+ import { ChartLegend, ChartLegendContent, ChartLegendContentOwnProps, ChartLegendContentProps, ChartLegendProps } from "./components/chart/chart-legend.js";
6
+ import { ChartTable, ChartTableOwnProps, ChartTableProps } from "./components/chart/chart-table.js";
7
+ import { ChartTooltip, ChartTooltipContent, ChartTooltipContentOwnProps, ChartTooltipContentProps, ChartTooltipProps } from "./components/chart/chart-tooltip.js";
8
+ import "./components/chart/index.js";
9
+ export { type ChartConfig, ChartContainer, type ChartContainerOwnProps, type ChartContainerProps, type ChartDash, type ChartIndicator, ChartLegend, ChartLegendContent, type ChartLegendContentOwnProps, type ChartLegendContentProps, type ChartLegendProps, type ChartName, type ChartPattern, type ChartSeries, ChartTable, type ChartTableOwnProps, type ChartTableProps, ChartTooltip, ChartTooltipContent, type ChartTooltipContentOwnProps, type ChartTooltipContentProps, type ChartTooltipProps, type ChartValueFormatter, chartColor, chartDash, chartFill };
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ import { chartColor, chartDash, chartFill } from "./components/chart/config.js";
2
+ import { ChartContainer } from "./components/chart/chart-container.js";
3
+ import { ChartTooltip, ChartTooltipContent } from "./components/chart/chart-tooltip.js";
4
+ import { ChartLegend, ChartLegendContent } from "./components/chart/chart-legend.js";
5
+ import { ChartTable } from "./components/chart/chart-table.js";
6
+ export { ChartContainer, ChartLegend, ChartLegendContent, ChartTable, ChartTooltip, ChartTooltipContent, chartColor, chartDash, chartFill };
@@ -0,0 +1,199 @@
1
+ @layer tokens, base, components;
2
+ @layer components {
3
+ .nuv-chart {
4
+ --nuv-chart-patterns: ;
5
+ --nuv-chart-solid: initial;
6
+ position: relative;
7
+ inline-size: 100%;
8
+ min-inline-size: 0;
9
+ color: var(--nuv-chart-fg, var(--color-muted-foreground));
10
+ font-size: var(--nuv-chart-font-size, var(--text-xs));
11
+ line-height: var(--text-xs--line-height);
12
+ }
13
+ .nuv-chart[data-patterns] {
14
+ --nuv-chart-patterns: initial;
15
+ --nuv-chart-solid: ;
16
+ }
17
+ @media (forced-colors: active) {
18
+ .nuv-chart {
19
+ --nuv-chart-patterns: initial;
20
+ --nuv-chart-solid: ;
21
+ --nuv-chart-forced-color: CanvasText;
22
+ --nuv-chart-grid: GrayText;
23
+ --nuv-chart-axis: CanvasText;
24
+ --nuv-chart-fg: CanvasText;
25
+ --nuv-chart-label-fg: CanvasText;
26
+ --nuv-chart-backdrop: Canvas;
27
+ --nuv-chart-cursor: GrayText;
28
+ }
29
+ }
30
+ .nuv-chart__plot {
31
+ inline-size: 100%;
32
+ block-size: var(--nuv-chart-height, auto);
33
+ aspect-ratio: var(--nuv-chart-aspect-ratio, 16/9);
34
+ }
35
+ .nuv-chart__patterns {
36
+ position: absolute;
37
+ pointer-events: none;
38
+ }
39
+ .nuv-chart__tooltip {
40
+ display: grid;
41
+ gap: calc(var(--spacing) * 1.5);
42
+ min-inline-size: 8rem;
43
+ padding: calc(var(--spacing) * 2) calc(var(--spacing) * 2.5);
44
+ border: var(--nuv-border-width) solid var(--nuv-chart-tooltip-border, var(--color-border));
45
+ border-radius: var(--nuv-chart-tooltip-radius, var(--radius-lg));
46
+ background-color: var(--nuv-chart-tooltip-bg, var(--color-surface));
47
+ box-shadow: var(--nuv-chart-tooltip-shadow, var(--shadow-lg));
48
+ color: var(--nuv-chart-tooltip-fg, var(--color-surface-foreground));
49
+ font-size: var(--text-xs);
50
+ line-height: var(--text-xs--line-height);
51
+ }
52
+ .nuv-chart__tooltip[hidden] {
53
+ display: none;
54
+ }
55
+ .nuv-chart__tooltip-label {
56
+ font-weight: var(--font-weight-medium);
57
+ }
58
+ .nuv-chart__tooltip-items {
59
+ display: grid;
60
+ gap: var(--spacing);
61
+ margin: 0;
62
+ padding: 0;
63
+ list-style: none;
64
+ }
65
+ .nuv-chart__tooltip-item {
66
+ display: flex;
67
+ gap: calc(var(--spacing) * 2);
68
+ align-items: center;
69
+ }
70
+ .nuv-chart__tooltip-name {
71
+ flex: 1;
72
+ color: var(--color-muted-foreground);
73
+ }
74
+ .nuv-chart__tooltip-value {
75
+ margin-inline-start: calc(var(--spacing) * 2);
76
+ font-weight: var(--font-weight-medium);
77
+ font-variant-numeric: tabular-nums;
78
+ }
79
+ .nuv-chart__swatch {
80
+ flex: none;
81
+ inline-size: calc(var(--spacing) * 3);
82
+ block-size: calc(var(--spacing) * 3);
83
+ }
84
+ .nuv-chart__swatch--line {
85
+ inline-size: calc(var(--spacing) * 6);
86
+ }
87
+ .nuv-chart__legend {
88
+ display: flex;
89
+ flex-wrap: wrap;
90
+ gap: calc(var(--spacing) * 1) calc(var(--spacing) * 4);
91
+ align-items: center;
92
+ justify-content: center;
93
+ margin: 0;
94
+ padding: 0;
95
+ color: var(--nuv-chart-legend-fg, var(--color-foreground));
96
+ list-style: none;
97
+ }
98
+ .nuv-chart__legend-item {
99
+ display: inline-flex;
100
+ gap: calc(var(--spacing) * 1.5);
101
+ align-items: center;
102
+ }
103
+ .nuv-chart__legend-item--inactive {
104
+ opacity: var(--nuv-disabled-opacity);
105
+ }
106
+ .nuv-chart__data {
107
+ margin-block-start: calc(var(--spacing) * 4);
108
+ }
109
+ .nuv-chart__table {
110
+ inline-size: 100%;
111
+ border-collapse: collapse;
112
+ color: var(--nuv-chart-table-fg, var(--color-foreground));
113
+ font-size: var(--text-sm);
114
+ line-height: var(--text-sm--line-height);
115
+ font-variant-numeric: tabular-nums;
116
+ text-align: end;
117
+ }
118
+ .nuv-chart__table caption {
119
+ padding-block-end: calc(var(--spacing) * 2);
120
+ color: var(--color-muted-foreground);
121
+ text-align: start;
122
+ }
123
+ .nuv-chart__table th,
124
+ .nuv-chart__table td {
125
+ padding: calc(var(--spacing) * 1.5) calc(var(--spacing) * 3);
126
+ border-block-end: var(--nuv-border-width) solid var(--nuv-chart-table-border, var(--color-border));
127
+ }
128
+ .nuv-chart__table th {
129
+ font-weight: var(--font-weight-medium);
130
+ }
131
+ .nuv-chart__table th:first-child {
132
+ text-align: start;
133
+ }
134
+ .nuv-chart__data--hidden {
135
+ position: absolute;
136
+ inline-size: 1px;
137
+ block-size: 1px;
138
+ margin: -1px;
139
+ padding: 0;
140
+ overflow: hidden;
141
+ border: 0;
142
+ clip-path: inset(50%);
143
+ white-space: nowrap;
144
+ }
145
+ /* stylelint-disable selector-class-pattern, selector-max-compound-selectors */
146
+ .nuv-chart .recharts-surface {
147
+ overflow: visible;
148
+ border-radius: var(--radius-sm);
149
+ outline: none;
150
+ }
151
+ .nuv-chart .recharts-surface:focus-visible {
152
+ outline: var(--nuv-focus-ring-width, 2px) solid var(--nuv-focus-ring-color, var(--color-ring));
153
+ outline-offset: var(--nuv-focus-ring-offset, 2px);
154
+ }
155
+ .nuv-chart .recharts-layer,
156
+ .nuv-chart .recharts-sector {
157
+ outline: none;
158
+ }
159
+ .nuv-chart .recharts-text {
160
+ fill: currentcolor;
161
+ }
162
+ .nuv-chart .recharts-label {
163
+ fill: var(--nuv-chart-label-fg, var(--color-foreground));
164
+ }
165
+ .nuv-chart .recharts-cartesian-grid line,
166
+ .nuv-chart .recharts-polar-grid line,
167
+ .nuv-chart .recharts-polar-grid-concentric-polygon,
168
+ .nuv-chart .recharts-polar-grid-concentric-circle {
169
+ stroke: var(--nuv-chart-grid, var(--color-border));
170
+ }
171
+ .nuv-chart .recharts-cartesian-axis-line,
172
+ .nuv-chart .recharts-cartesian-axis-tick-line,
173
+ .nuv-chart .recharts-polar-angle-axis-tick-line,
174
+ .nuv-chart .recharts-polar-radius-axis-line,
175
+ .nuv-chart .recharts-polar-radius-axis-tick-line,
176
+ .nuv-chart .recharts-reference-line-line {
177
+ stroke: var(--nuv-chart-axis, var(--color-border-strong));
178
+ }
179
+ .nuv-chart .recharts-curve.recharts-tooltip-cursor {
180
+ stroke: var(--nuv-chart-cursor, var(--color-border-strong));
181
+ }
182
+ .nuv-chart .recharts-rectangle.recharts-tooltip-cursor,
183
+ .nuv-chart .recharts-sector.recharts-tooltip-cursor,
184
+ .nuv-chart .recharts-radial-bar-background-sector {
185
+ fill: var(--nuv-chart-cursor, var(--color-muted));
186
+ }
187
+ .nuv-chart .recharts-sector[stroke="#fff"],
188
+ .nuv-chart .recharts-dot[stroke="#fff"],
189
+ .nuv-chart .recharts-active-dot [stroke="#fff"] {
190
+ stroke: var(--nuv-chart-backdrop, var(--color-background));
191
+ }
192
+ .nuv-chart .recharts-dot[fill="#fff"] {
193
+ fill: var(--nuv-chart-backdrop, var(--color-background));
194
+ }
195
+ .nuv-chart .recharts-tooltip-wrapper {
196
+ z-index: var(--nuv-z-popover);
197
+ }
198
+ /* stylelint-enable selector-class-pattern, selector-max-compound-selectors */
199
+ }