@bonnard/react 0.2.0 → 0.2.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.
package/dist/dashboard.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as BarChart, i as LineChart, n as PieChart, o as BigValue, r as AreaChart, t as DataTable, u as useBonnard } from "./data-table-
|
|
1
|
+
import { a as BarChart, i as LineChart, n as PieChart, o as BigValue, r as AreaChart, t as DataTable, u as useBonnard } from "./data-table-C3K4rPh2.js";
|
|
2
2
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
3
3
|
import DOMPurify from "isomorphic-dompurify";
|
|
4
4
|
import matter from "gray-matter";
|
|
@@ -798,10 +798,21 @@ function SectionRenderer({ section, queryStates }) {
|
|
|
798
798
|
queryStates
|
|
799
799
|
}, i))
|
|
800
800
|
});
|
|
801
|
-
|
|
801
|
+
const isBigValue = section.component.type === "BigValue";
|
|
802
|
+
const inner = /* @__PURE__ */ jsx(ComponentRenderer, {
|
|
802
803
|
component: section.component,
|
|
803
804
|
queryStates
|
|
804
805
|
});
|
|
806
|
+
if (isBigValue) return inner;
|
|
807
|
+
return /* @__PURE__ */ jsx("div", {
|
|
808
|
+
style: {
|
|
809
|
+
borderRadius: "var(--bon-radius, 8px)",
|
|
810
|
+
border: "1px solid var(--bon-border, rgba(128,128,128,0.2))",
|
|
811
|
+
backgroundColor: "var(--bon-card-bg, transparent)",
|
|
812
|
+
padding: 16
|
|
813
|
+
},
|
|
814
|
+
children: inner
|
|
815
|
+
});
|
|
805
816
|
}
|
|
806
817
|
function ComponentRenderer({ component, queryStates }) {
|
|
807
818
|
const { type, props } = component;
|
|
@@ -328,6 +328,12 @@ function buildSeries(data, x, y, series) {
|
|
|
328
328
|
labels: [],
|
|
329
329
|
datasets: []
|
|
330
330
|
};
|
|
331
|
+
const firstX = String(data[0][x] ?? "");
|
|
332
|
+
if (/^\d{4}-\d{2}-\d{2}/.test(firstX)) data = [...data].sort((a, b) => {
|
|
333
|
+
const aVal = String(a[x] ?? "");
|
|
334
|
+
const bVal = String(b[x] ?? "");
|
|
335
|
+
return aVal.localeCompare(bVal);
|
|
336
|
+
});
|
|
331
337
|
const yColumns = y.split(",").map((col) => col.trim()).filter(Boolean);
|
|
332
338
|
if (!series) return {
|
|
333
339
|
labels: data.map((row) => String(row[x] ?? "")),
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as BarChart, c as PALETTES, i as LineChart, l as BonnardContext, n as PieChart, o as BigValue, r as AreaChart, s as CHART_COLORS, t as DataTable, u as useBonnard } from "./data-table-
|
|
1
|
+
import { a as BarChart, c as PALETTES, i as LineChart, l as BonnardContext, n as PieChart, o as BigValue, r as AreaChart, s as CHART_COLORS, t as DataTable, u as useBonnard } from "./data-table-C3K4rPh2.js";
|
|
2
2
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
import { createClient } from "@bonnard/sdk";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-series.d.ts","sourceRoot":"","sources":["../../src/lib/build-series.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,WAAW,aAAa;IAC5B,mBAAmB;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,iEAAiE;IACjE,MAAM,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,iBAAiB;IAChC,4BAA4B;IAC5B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,6BAA6B;IAC7B,QAAQ,EAAE,aAAa,EAAE,CAAC;CAC3B;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EAC/B,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,MAAM,CAAC,EAAE,MAAM,GACd,iBAAiB,
|
|
1
|
+
{"version":3,"file":"build-series.d.ts","sourceRoot":"","sources":["../../src/lib/build-series.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,WAAW,aAAa;IAC5B,mBAAmB;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,iEAAiE;IACjE,MAAM,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,iBAAiB;IAChC,4BAA4B;IAC5B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,6BAA6B;IAC7B,QAAQ,EAAE,aAAa,EAAE,CAAC;CAC3B;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EAC/B,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,MAAM,CAAC,EAAE,MAAM,GACd,iBAAiB,CA+EnB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bonnard/react",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Bonnard embedded analytics — React charts, dashboards, and hooks",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"isomorphic-dompurify": "^2.0.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@bonnard/sdk": "^0.
|
|
50
|
+
"@bonnard/sdk": "^0.3.0",
|
|
51
51
|
"@types/react": "^19.0.0",
|
|
52
52
|
"tsdown": "^0.12.5",
|
|
53
53
|
"typescript": "^5.5.0"
|