@opencx/widget-react 5.0.0-beta.2 → 5.0.0-beta.4
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/Chart.impl-BSHyATLw.js +285 -0
- package/dist/{Chart.impl-CweIPST1.js.map → Chart.impl-BSHyATLw.js.map} +1 -1
- package/dist/Chart.impl-CgMJWhHk.cjs +2 -0
- package/dist/{Chart.impl-DHCOnsVA.cjs.map → Chart.impl-CgMJWhHk.cjs.map} +1 -1
- package/dist/index-Dq4Fgreq.cjs +343 -0
- package/dist/index-Dq4Fgreq.cjs.map +1 -0
- package/dist/index-JZSCf6mZ.js +17379 -0
- package/dist/index-JZSCf6mZ.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/dist/package.json.d.ts +1 -1
- package/dist/src/components/AgentMessageGroup.d.ts +1 -2
- package/dist/src/components/AgentMessageGroup.d.ts.map +1 -1
- package/dist/src/components/StepsGroup.d.ts.map +1 -1
- package/dist/src/components/StreamingTurn.d.ts.map +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/screens/chat/ChatMain.d.ts.map +1 -1
- package/dist/src/screens/chat/MessageGroups.d.ts +3 -1
- package/dist/src/screens/chat/MessageGroups.d.ts.map +1 -1
- package/dist/src/screens/chat/__tests__/chat-main.polling-progress.spec.d.ts +2 -0
- package/dist/src/screens/chat/__tests__/chat-main.polling-progress.spec.d.ts.map +1 -0
- package/package.json +3 -3
- package/dist/Chart.impl-CweIPST1.js +0 -153
- package/dist/Chart.impl-DHCOnsVA.cjs +0 -2
- package/dist/index-CBGXjABY.js +0 -12482
- package/dist/index-CBGXjABY.js.map +0 -1
- package/dist/index-RZV2KNTv.cjs +0 -343
- package/dist/index-RZV2KNTv.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");require("@radix-ui/react-popover");require("framer-motion");require("react");require("@opencx/widget-react-headless");const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-dev-runtime");require("@radix-ui/react-popover");require("framer-motion");require("react");require("@opencx/widget-react-headless");const e=require("./index-Dq4Fgreq.cjs");exports.HostedSpecRenderer=e.HostedSpecRenderer;exports.Widget=e.Widget;exports.segmentContent=e.segmentContent;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import "react/jsx-runtime";
|
|
1
|
+
import "react/jsx-dev-runtime";
|
|
2
2
|
import "@radix-ui/react-popover";
|
|
3
3
|
import "framer-motion";
|
|
4
4
|
import "react";
|
|
5
5
|
import "@opencx/widget-react-headless";
|
|
6
|
-
import { H as s, W as n, s as a } from "./index-
|
|
6
|
+
import { H as s, W as n, s as a } from "./index-JZSCf6mZ.js";
|
|
7
7
|
export {
|
|
8
8
|
s as HostedSpecRenderer,
|
|
9
9
|
n as Widget,
|
package/dist/package.json.d.ts
CHANGED
|
@@ -5,8 +5,7 @@ export declare function AgentMessageGroup({ messages, agent, suggestedReplies, a
|
|
|
5
5
|
agent: Agent | undefined;
|
|
6
6
|
suggestedReplies?: string[];
|
|
7
7
|
/**
|
|
8
|
-
* Offer the reply actions (copy)
|
|
9
|
-
* its text is not final yet.
|
|
8
|
+
* Offer the reply actions (copy) only when its text is final.
|
|
10
9
|
*/
|
|
11
10
|
actions?: boolean;
|
|
12
11
|
}): React.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentMessageGroup.d.ts","sourceRoot":"","sources":["../../../src/components/AgentMessageGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,KAAK,EACV,KAAK,eAAe,EACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,MAAM,OAAO,CAAC;AAiB1B,wBAAgB,iBAAiB,CAAC,EAChC,QAAQ,EACR,KAAK,EACL,gBAAgB,EAChB,OAAc,GACf,EAAE;IACD,QAAQ,EAAE,eAAe,EAAE,GAAG,kBAAkB,EAAE,CAAC;IACnD,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B
|
|
1
|
+
{"version":3,"file":"AgentMessageGroup.d.ts","sourceRoot":"","sources":["../../../src/components/AgentMessageGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,KAAK,EACV,KAAK,eAAe,EACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,MAAM,OAAO,CAAC;AAiB1B,wBAAgB,iBAAiB,CAAC,EAChC,QAAQ,EACR,KAAK,EACL,gBAAgB,EAChB,OAAc,GACf,EAAE;IACD,QAAQ,EAAE,eAAe,EAAE,GAAG,kBAAkB,EAAE,CAAC;IACnD,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,qBA+DA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StepsGroup.d.ts","sourceRoot":"","sources":["../../../src/components/StepsGroup.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"StepsGroup.d.ts","sourceRoot":"","sources":["../../../src/components/StepsGroup.tsx"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAsC,MAAM,OAAO,CAAC;AA0U3D,+DAA+D;AAC/D,MAAM,MAAM,4BAA4B,GAAG;IACzC,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,qEAAqE;IACrE,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,wBAAgB,UAAU,CAAC,EACzB,KAAK,EAAE,SAAS,EAChB,MAAM,GACP,EAAE,4BAA4B,4BA2G9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StreamingTurn.d.ts","sourceRoot":"","sources":["../../../src/components/StreamingTurn.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"StreamingTurn.d.ts","sourceRoot":"","sources":["../../../src/components/StreamingTurn.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EACV,YAAY,EAEZ,kBAAkB,EACnB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAA4B,MAAM,OAAO,CAAC;AAMjD;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,EAC5B,IAAI,EACJ,KAAK,EACL,SAAS,GACV,EAAE;IACD,IAAI,EAAE,kBAAkB,CAAC;IACzB,KAAK,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC;IAChC;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,qBAuEA;AAOD;;;;GAIG;AACH,MAAM,MAAM,2BAA2B,GAAG;IAAE,KAAK,EAAE,YAAY,EAAE,CAAA;CAAE,CAAC;AAEpE,wBAAgB,aAAa,CAAC,EAAE,KAAK,EAAE,EAAE,2BAA2B,qBAKnE"}
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAGV,YAAY,EACb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAML,KAAK,mBAAmB,EACzB,MAAM,+BAA+B,CAAC;AAUvC,OAAO,EAEL,KAAK,2BAA2B,EACjC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEL,KAAK,4BAA4B,EAClC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAEL,KAAK,2BAA2B,EACjC,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAEL,KAAK,SAAS,EACf,MAAM,2BAA2B,CAAC;AA6EnC,QAAA,MAAM,MAAM;aAGC,YAAY;iBACR,mBAAmB,EAAE;uBACf,KAAK,CAAC,SAAS;qBACjB,CAAC,KAAK,EAAE,KAAK,KAAK,KAAK,CAAC,SAAS;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAGV,YAAY,EACb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAML,KAAK,mBAAmB,EACzB,MAAM,+BAA+B,CAAC;AAUvC,OAAO,EAEL,KAAK,2BAA2B,EACjC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEL,KAAK,4BAA4B,EAClC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAEL,KAAK,2BAA2B,EACjC,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAEL,KAAK,SAAS,EACf,MAAM,2BAA2B,CAAC;AA6EnC,QAAA,MAAM,MAAM;aAGC,YAAY;iBACR,mBAAmB,EAAE;uBACf,KAAK,CAAC,SAAS;qBACjB,CAAC,KAAK,EAAE,KAAK,KAAK,KAAK,CAAC,SAAS;mCAgDpD,CAAC;AAGH,OAAO,EAAE,MAAM,EAAE,CAAC;AAClB;;;;;GAKG;AACH,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,KAAK,cAAc,GACpB,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,2BAA2B,EAC3B,2BAA2B,EAC3B,4BAA4B,EAC5B,SAAS,GACV,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatMain.d.ts","sourceRoot":"","sources":["../../../../src/screens/chat/ChatMain.tsx"],"names":[],"mappings":"AAUA,OAAO,
|
|
1
|
+
{"version":3,"file":"ChatMain.d.ts","sourceRoot":"","sources":["../../../../src/screens/chat/ChatMain.tsx"],"names":[],"mappings":"AAUA,OAAO,KAA+C,MAAM,OAAO,CAAC;AAUpE,wBAAgB,QAAQ,sBAgFvB"}
|
|
@@ -6,7 +6,9 @@ import { default as React } from 'react';
|
|
|
6
6
|
* (server-resolved agent branding wins); human-agent groups prefer the
|
|
7
7
|
* server-provided sender, patched by the `humanAgent` config override.
|
|
8
8
|
*/
|
|
9
|
-
export declare function MessageGroups({ groups }: {
|
|
9
|
+
export declare function MessageGroups({ groups, pendingReply, }: {
|
|
10
10
|
groups: WidgetMessageU[][];
|
|
11
|
+
/** The latest reply is still being prepared, including between polled updates. */
|
|
12
|
+
pendingReply?: boolean;
|
|
11
13
|
}): React.JSX.Element;
|
|
12
14
|
//# sourceMappingURL=MessageGroups.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageGroups.d.ts","sourceRoot":"","sources":["../../../../src/screens/chat/MessageGroups.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"MessageGroups.d.ts","sourceRoot":"","sources":["../../../../src/screens/chat/MessageGroups.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,EAC5B,MAAM,EACN,YAAoB,GACrB,EAAE;IACD,MAAM,EAAE,cAAc,EAAE,EAAE,CAAC;IAC3B,kFAAkF;IAClF,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,qBAwDA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-main.polling-progress.spec.d.ts","sourceRoot":"","sources":["../../../../../src/screens/chat/__tests__/chat-main.polling-progress.spec.tsx"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opencx/widget-react",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "5.0.0-beta.
|
|
4
|
+
"version": "5.0.0-beta.4",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"tailwind-merge": "^2.4.0",
|
|
41
41
|
"tinycolor2": "^1.6.0",
|
|
42
42
|
"zod": "^4.3.6",
|
|
43
|
-
"@opencx/widget-
|
|
44
|
-
"@opencx/widget-
|
|
43
|
+
"@opencx/widget-core": "5.0.0-beta.4",
|
|
44
|
+
"@opencx/widget-react-headless": "5.0.0-beta.4"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"@types/react": ">=18 <20",
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import { jsx as e, jsxs as s } from "react/jsx-runtime";
|
|
2
|
-
import d from "react";
|
|
3
|
-
import { PieChart as b, Tooltip as f, Legend as S, Pie as k, Cell as C, Label as R, LineChart as v, CartesianGrid as p, XAxis as y, YAxis as g, Line as z, BarChart as O, Bar as _ } from "recharts";
|
|
4
|
-
import { u as K } from "./index-CBGXjABY.js";
|
|
5
|
-
function A() {
|
|
6
|
-
const t = d.useRef(null), [n, c] = d.useState(0);
|
|
7
|
-
return d.useLayoutEffect(() => {
|
|
8
|
-
const r = t.current;
|
|
9
|
-
if (!r) return;
|
|
10
|
-
const i = () => c(r.clientWidth);
|
|
11
|
-
i();
|
|
12
|
-
const l = new ResizeObserver(i);
|
|
13
|
-
return l.observe(r), () => l.disconnect();
|
|
14
|
-
}, []), { ref: t, width: n };
|
|
15
|
-
}
|
|
16
|
-
const L = "hsl(var(--opencx-foreground, 240 10% 20%))", x = [90, 70, 50, 30].map(
|
|
17
|
-
(t) => `color-mix(in oklch, ${L} ${t}%, transparent)`
|
|
18
|
-
), u = (t) => x[t % x.length] ?? L, h = {
|
|
19
|
-
borderRadius: 8,
|
|
20
|
-
border: "1px solid color-mix(in oklch, currentColor 15%, transparent)",
|
|
21
|
-
fontSize: 12
|
|
22
|
-
};
|
|
23
|
-
function P({
|
|
24
|
-
type: t,
|
|
25
|
-
data: n,
|
|
26
|
-
height: c,
|
|
27
|
-
centerLabel: r
|
|
28
|
-
}) {
|
|
29
|
-
const i = c ?? 220, { ref: l, width: a } = A();
|
|
30
|
-
return n.length === 0 ? /* @__PURE__ */ e(T, { height: i }) : /* @__PURE__ */ e("div", { ref: l, className: "w-full text-foreground", style: { height: i }, children: a > 0 && (t === "pie" ? /* @__PURE__ */ s(b, { width: a, height: i, children: [
|
|
31
|
-
/* @__PURE__ */ e(f, { contentStyle: h }),
|
|
32
|
-
/* @__PURE__ */ e(
|
|
33
|
-
S,
|
|
34
|
-
{
|
|
35
|
-
verticalAlign: "bottom",
|
|
36
|
-
iconType: "circle",
|
|
37
|
-
iconSize: 8,
|
|
38
|
-
wrapperStyle: { fontSize: 12 }
|
|
39
|
-
}
|
|
40
|
-
),
|
|
41
|
-
/* @__PURE__ */ s(
|
|
42
|
-
k,
|
|
43
|
-
{
|
|
44
|
-
data: n,
|
|
45
|
-
dataKey: "value",
|
|
46
|
-
nameKey: "label",
|
|
47
|
-
outerRadius: "85%",
|
|
48
|
-
innerRadius: "60%",
|
|
49
|
-
children: [
|
|
50
|
-
n.map((o, m) => /* @__PURE__ */ e(C, { fill: u(m) }, m)),
|
|
51
|
-
r && /* @__PURE__ */ e(
|
|
52
|
-
R,
|
|
53
|
-
{
|
|
54
|
-
position: "center",
|
|
55
|
-
content: ({ viewBox: o }) => {
|
|
56
|
-
if (o && "cx" in o && "cy" in o)
|
|
57
|
-
return /* @__PURE__ */ e(
|
|
58
|
-
"text",
|
|
59
|
-
{
|
|
60
|
-
x: o.cx,
|
|
61
|
-
y: o.cy,
|
|
62
|
-
textAnchor: "middle",
|
|
63
|
-
dominantBaseline: "middle",
|
|
64
|
-
className: "fill-foreground text-2xl font-medium",
|
|
65
|
-
children: r
|
|
66
|
-
}
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
)
|
|
71
|
-
]
|
|
72
|
-
}
|
|
73
|
-
)
|
|
74
|
-
] }) : t === "line" ? /* @__PURE__ */ s(
|
|
75
|
-
v,
|
|
76
|
-
{
|
|
77
|
-
width: a,
|
|
78
|
-
height: i,
|
|
79
|
-
data: n,
|
|
80
|
-
margin: { top: 8, right: 8, bottom: 0, left: -16 },
|
|
81
|
-
children: [
|
|
82
|
-
/* @__PURE__ */ e(p, { strokeOpacity: 0.15, vertical: !1 }),
|
|
83
|
-
/* @__PURE__ */ e(
|
|
84
|
-
y,
|
|
85
|
-
{
|
|
86
|
-
dataKey: "label",
|
|
87
|
-
tickLine: !1,
|
|
88
|
-
axisLine: !1,
|
|
89
|
-
tickMargin: 10,
|
|
90
|
-
fontSize: 11
|
|
91
|
-
}
|
|
92
|
-
),
|
|
93
|
-
/* @__PURE__ */ e(g, { tickLine: !1, axisLine: !1, fontSize: 11, width: 32 }),
|
|
94
|
-
/* @__PURE__ */ e(f, { contentStyle: h }),
|
|
95
|
-
/* @__PURE__ */ e(
|
|
96
|
-
z,
|
|
97
|
-
{
|
|
98
|
-
type: "monotone",
|
|
99
|
-
dataKey: "value",
|
|
100
|
-
stroke: u(0),
|
|
101
|
-
strokeWidth: 2,
|
|
102
|
-
dot: !1
|
|
103
|
-
}
|
|
104
|
-
)
|
|
105
|
-
]
|
|
106
|
-
}
|
|
107
|
-
) : /* @__PURE__ */ s(
|
|
108
|
-
O,
|
|
109
|
-
{
|
|
110
|
-
width: a,
|
|
111
|
-
height: i,
|
|
112
|
-
data: n,
|
|
113
|
-
margin: { top: 8, right: 8, bottom: 0, left: -16 },
|
|
114
|
-
children: [
|
|
115
|
-
/* @__PURE__ */ e(p, { strokeOpacity: 0.15, vertical: !1 }),
|
|
116
|
-
/* @__PURE__ */ e(
|
|
117
|
-
y,
|
|
118
|
-
{
|
|
119
|
-
dataKey: "label",
|
|
120
|
-
tickLine: !1,
|
|
121
|
-
axisLine: !1,
|
|
122
|
-
tickMargin: 10,
|
|
123
|
-
fontSize: 11
|
|
124
|
-
}
|
|
125
|
-
),
|
|
126
|
-
/* @__PURE__ */ e(g, { tickLine: !1, axisLine: !1, fontSize: 11, width: 32 }),
|
|
127
|
-
/* @__PURE__ */ e(
|
|
128
|
-
f,
|
|
129
|
-
{
|
|
130
|
-
contentStyle: h,
|
|
131
|
-
cursor: { fillOpacity: 0.06 }
|
|
132
|
-
}
|
|
133
|
-
),
|
|
134
|
-
/* @__PURE__ */ e(_, { dataKey: "value", fill: u(0), radius: [4, 4, 0, 0] })
|
|
135
|
-
]
|
|
136
|
-
}
|
|
137
|
-
)) });
|
|
138
|
-
}
|
|
139
|
-
function T({ height: t }) {
|
|
140
|
-
const { t: n } = K();
|
|
141
|
-
return /* @__PURE__ */ e(
|
|
142
|
-
"div",
|
|
143
|
-
{
|
|
144
|
-
className: "flex w-full items-center justify-center rounded-lg border border-muted-foreground/15 text-xs text-muted-foreground",
|
|
145
|
-
style: { height: t },
|
|
146
|
-
children: n("json_no_chart_data")
|
|
147
|
-
}
|
|
148
|
-
);
|
|
149
|
-
}
|
|
150
|
-
export {
|
|
151
|
-
P as default
|
|
152
|
-
};
|
|
153
|
-
//# sourceMappingURL=Chart.impl-CweIPST1.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("react"),t=require("recharts"),j=require("./index-RZV2KNTv.cjs");function p(){const i=d.useRef(null),[n,c]=d.useState(0);return d.useLayoutEffect(()=>{const s=i.current;if(!s)return;const r=()=>c(s.clientWidth);r();const l=new ResizeObserver(r);return l.observe(s),()=>l.disconnect()},[]),{ref:i,width:n}}const m="hsl(var(--opencx-foreground, 240 10% 20%))",h=[90,70,50,30].map(i=>`color-mix(in oklch, ${m} ${i}%, transparent)`),u=i=>h[i%h.length]??m,f={borderRadius:8,border:"1px solid color-mix(in oklch, currentColor 15%, transparent)",fontSize:12};function y({type:i,data:n,height:c,centerLabel:s}){const r=c??220,{ref:l,width:a}=p();return n.length===0?e.jsx(g,{height:r}):e.jsx("div",{ref:l,className:"w-full text-foreground",style:{height:r},children:a>0&&(i==="pie"?e.jsxs(t.PieChart,{width:a,height:r,children:[e.jsx(t.Tooltip,{contentStyle:f}),e.jsx(t.Legend,{verticalAlign:"bottom",iconType:"circle",iconSize:8,wrapperStyle:{fontSize:12}}),e.jsxs(t.Pie,{data:n,dataKey:"value",nameKey:"label",outerRadius:"85%",innerRadius:"60%",children:[n.map((o,x)=>e.jsx(t.Cell,{fill:u(x)},x)),s&&e.jsx(t.Label,{position:"center",content:({viewBox:o})=>{if(o&&"cx"in o&&"cy"in o)return e.jsx("text",{x:o.cx,y:o.cy,textAnchor:"middle",dominantBaseline:"middle",className:"fill-foreground text-2xl font-medium",children:s})}})]})]}):i==="line"?e.jsxs(t.LineChart,{width:a,height:r,data:n,margin:{top:8,right:8,bottom:0,left:-16},children:[e.jsx(t.CartesianGrid,{strokeOpacity:.15,vertical:!1}),e.jsx(t.XAxis,{dataKey:"label",tickLine:!1,axisLine:!1,tickMargin:10,fontSize:11}),e.jsx(t.YAxis,{tickLine:!1,axisLine:!1,fontSize:11,width:32}),e.jsx(t.Tooltip,{contentStyle:f}),e.jsx(t.Line,{type:"monotone",dataKey:"value",stroke:u(0),strokeWidth:2,dot:!1})]}):e.jsxs(t.BarChart,{width:a,height:r,data:n,margin:{top:8,right:8,bottom:0,left:-16},children:[e.jsx(t.CartesianGrid,{strokeOpacity:.15,vertical:!1}),e.jsx(t.XAxis,{dataKey:"label",tickLine:!1,axisLine:!1,tickMargin:10,fontSize:11}),e.jsx(t.YAxis,{tickLine:!1,axisLine:!1,fontSize:11,width:32}),e.jsx(t.Tooltip,{contentStyle:f,cursor:{fillOpacity:.06}}),e.jsx(t.Bar,{dataKey:"value",fill:u(0),radius:[4,4,0,0]})]}))})}function g({height:i}){const{t:n}=j.useJsonRenderHost();return e.jsx("div",{className:"flex w-full items-center justify-center rounded-lg border border-muted-foreground/15 text-xs text-muted-foreground",style:{height:i},children:n("json_no_chart_data")})}exports.default=y;
|
|
2
|
-
//# sourceMappingURL=Chart.impl-DHCOnsVA.cjs.map
|