@gravitee/graphene-charts 3.14.2 → 3.15.0
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BreakdownChart.d.ts","sourceRoot":"","sources":["../../../src/charts/BreakdownChart/BreakdownChart.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BreakdownChart.d.ts","sourceRoot":"","sources":["../../../src/charts/BreakdownChart/BreakdownChart.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,KAAK,EAAE,mBAAmB,EAAuD,MAAM,yBAAyB,CAAC;AA0DxH,MAAM,WAAW,2BAA4B,SAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;IAC9E,0CAA0C;IAC1C,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,kFAAkF;IAClF,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B;AAID,iBAAS,sBAAsB,CAAC,EAAE,IAAQ,EAAE,OAAe,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,2BAA2B,qBAwB9G;AAiQD,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,EAAE,mBAAmB,qBAO9E;AAgUD,OAAO,EAAE,sBAAsB,EAAE,CAAC"}
|
|
@@ -76,11 +76,21 @@ export interface BreakdownChartProps extends React.ComponentProps<'div'> {
|
|
|
76
76
|
readonly summary?: BreakdownSummary;
|
|
77
77
|
/**
|
|
78
78
|
* Maximum visible items before collapsing with "N others".
|
|
79
|
-
*
|
|
80
|
-
* `variant="stacked"`.
|
|
79
|
+
* List variant only — ignored by `variant="stacked"`.
|
|
81
80
|
*
|
|
82
|
-
*
|
|
83
|
-
* the
|
|
81
|
+
* **When omitted, the chart shows what fits.** It measures the height it was
|
|
82
|
+
* given and collapses to the rows that fit there, so a list never spills out
|
|
83
|
+
* of a dashboard tile or gets silently cropped by it. In a container that
|
|
84
|
+
* does not constrain height, everything fits and everything is shown. Pass
|
|
85
|
+
* `maxItems={items.length}` for a threshold no list can exceed, i.e. the
|
|
86
|
+
* unconditional "show every row".
|
|
87
|
+
*
|
|
88
|
+
* Expanding scrolls inside the chart and can be undone from a control that
|
|
89
|
+
* stays put while the rows scroll.
|
|
90
|
+
*
|
|
91
|
+
* A reader's "N others" expansion is transient: changing *this* threshold, or
|
|
92
|
+
* the list fitting entirely within the effective one, re-collapses the list.
|
|
93
|
+
* A resize does not — it only moves the measured threshold underneath.
|
|
84
94
|
*
|
|
85
95
|
* Fractions floor, negatives clamp to `0`, and `NaN` is ignored.
|
|
86
96
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breakdown-chart.types.d.ts","sourceRoot":"","sources":["../../../src/charts/BreakdownChart/breakdown-chart.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AACpC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAInE,MAAM,WAAW,aAAa;IAC5B,2CAA2C;IAC3C,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,4BAA4B;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,uDAAuD;IACvD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,0DAA0D;IAC1D,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,8EAA8E;IAC9E,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,gDAAgD;IAChD,QAAQ,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;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C;CAC7D"}
|
package/dist/index.js
CHANGED
|
@@ -5806,24 +5806,66 @@ function Tr({ items: t, formatValue: n, animated: r = !0, mounted: i, hoveredKey
|
|
|
5806
5806
|
})]
|
|
5807
5807
|
});
|
|
5808
5808
|
}
|
|
5809
|
-
function Er(e, t) {
|
|
5810
|
-
|
|
5811
|
-
|
|
5809
|
+
function Er(e, { pitch: t, gap: n }) {
|
|
5810
|
+
return Math.max(0, Math.floor((e + n) / t));
|
|
5811
|
+
}
|
|
5812
|
+
function Dr(e, t) {
|
|
5813
|
+
let n = e.querySelectorAll("[data-slot=\"bar-meter\"]");
|
|
5814
|
+
if (n.length >= 2) {
|
|
5815
|
+
let e = n[1].offsetTop - n[0].offsetTop;
|
|
5816
|
+
if (e > 0) return {
|
|
5817
|
+
pitch: e,
|
|
5818
|
+
gap: Math.max(0, e - n[0].offsetHeight)
|
|
5819
|
+
};
|
|
5820
|
+
}
|
|
5821
|
+
let r = n[0]?.offsetHeight ?? 0;
|
|
5822
|
+
if (r <= 0) return t;
|
|
5823
|
+
let i = t?.gap ?? 0;
|
|
5824
|
+
return {
|
|
5825
|
+
pitch: r + i,
|
|
5826
|
+
gap: i
|
|
5827
|
+
};
|
|
5828
|
+
}
|
|
5829
|
+
function Or(e) {
|
|
5830
|
+
let [t, n] = U.useState(void 0), r = U.useRef(null), i = U.useCallback(() => {
|
|
5831
|
+
let t = e.current;
|
|
5832
|
+
if (!t) return;
|
|
5833
|
+
r.current = Dr(t, r.current);
|
|
5834
|
+
let i = r.current, a = t.clientHeight, o = i && a > 0 ? Er(a, i) : void 0;
|
|
5835
|
+
n((e) => e === o ? e : o);
|
|
5836
|
+
}, [e]);
|
|
5837
|
+
return U.useEffect(() => {
|
|
5838
|
+
let t = e.current;
|
|
5839
|
+
if (!t) return;
|
|
5840
|
+
let n = new ResizeObserver(i);
|
|
5841
|
+
return n.observe(t), () => n.disconnect();
|
|
5842
|
+
}, [e, i]), {
|
|
5843
|
+
fitCount: t,
|
|
5844
|
+
remeasure: i
|
|
5845
|
+
};
|
|
5846
|
+
}
|
|
5847
|
+
function kr(e, t, n) {
|
|
5848
|
+
let r = t === void 0 || Number.isNaN(t) ? void 0 : Math.max(0, Math.floor(t)), i = r ?? n, [a, o] = U.useState(!1), [s, c] = U.useState(r);
|
|
5849
|
+
Object.is(r, s) || (c(r), a && o(!1));
|
|
5850
|
+
let l = U.useCallback(() => o((e) => !e), []);
|
|
5851
|
+
return i === void 0 || e.length <= i ? (a && o(!1), {
|
|
5812
5852
|
visibleItems: e,
|
|
5813
|
-
|
|
5814
|
-
expanded: !
|
|
5815
|
-
|
|
5853
|
+
hiddenCount: 0,
|
|
5854
|
+
expanded: !1,
|
|
5855
|
+
collapsible: !1,
|
|
5856
|
+
toggle: l
|
|
5816
5857
|
}) : {
|
|
5817
|
-
visibleItems:
|
|
5818
|
-
|
|
5819
|
-
expanded:
|
|
5820
|
-
|
|
5858
|
+
visibleItems: a ? e : e.slice(0, i),
|
|
5859
|
+
hiddenCount: a ? 0 : e.length - i,
|
|
5860
|
+
expanded: a,
|
|
5861
|
+
collapsible: !0,
|
|
5862
|
+
toggle: l
|
|
5821
5863
|
};
|
|
5822
5864
|
}
|
|
5823
|
-
function
|
|
5824
|
-
return /* @__PURE__ */ Z(fr, { children: [e, /* @__PURE__ */ X(
|
|
5865
|
+
function Ar({ children: e, ...t }) {
|
|
5866
|
+
return /* @__PURE__ */ Z(fr, { children: [e, /* @__PURE__ */ X(jr, { ...t })] });
|
|
5825
5867
|
}
|
|
5826
|
-
function
|
|
5868
|
+
function jr({ items: t, variant: n = "list", ratioMode: r = "total", formatValue: i, trendSentiment: a = "higher-is-better", sortByValue: o, showRank: s = !1, summary: c, maxItems: l, animated: u = !0, compact: d = !1, highlightOnHover: f = !0, state: p, skeletonRows: m = 3, ariaLabel: h = "Breakdown chart", onItemClick: g, onItemHover: _, className: y, ...b }) {
|
|
5827
5869
|
let { tooltip: x, legend: S, summary: C } = dr(), w = p ?? (t.length === 0 ? "empty" : "ready"), [T, E] = U.useState(null), D = g !== void 0, O = _r(u), k = U.useRef(null), [A, j] = U.useState(null), M = U.useMemo(() => o ? [...t].sort((e, t) => o === "asc" ? e.value - t.value : t.value - e.value) : t, [t, o]), N = U.useMemo(() => br(M, r), [M, r]), P = U.useCallback((e) => {
|
|
5828
5870
|
E(e?.key ?? null), e || j(null), _?.(e);
|
|
5829
5871
|
}, [_]), F = U.useCallback((e) => {
|
|
@@ -5874,7 +5916,7 @@ function Or({ items: t, variant: n = "list", ratioMode: r = "total", formatValue
|
|
|
5874
5916
|
onSegmentHover: P,
|
|
5875
5917
|
onSegmentClick: g
|
|
5876
5918
|
}), z]
|
|
5877
|
-
}) : /* @__PURE__ */ X(
|
|
5919
|
+
}) : /* @__PURE__ */ X(Mr, {
|
|
5878
5920
|
containerRef: k,
|
|
5879
5921
|
items: M,
|
|
5880
5922
|
ratios: N,
|
|
@@ -5899,73 +5941,96 @@ function Or({ items: t, variant: n = "list", ratioMode: r = "total", formatValue
|
|
|
5899
5941
|
...b
|
|
5900
5942
|
});
|
|
5901
5943
|
}
|
|
5902
|
-
function
|
|
5903
|
-
let {
|
|
5904
|
-
|
|
5905
|
-
|
|
5944
|
+
function Mr({ containerRef: t, items: n, ratios: r, formatValue: i, trendSentiment: a = "higher-is-better", showRank: o = !1, summary: s, summarySlot: c, maxItems: l, animated: u = !0, compact: d = !1, highlightOnHover: f, mounted: p, ariaLabel: m = "Breakdown chart", hoveredKey: h, interactive: g, onItemHover: _, onItemClick: v, tooltipPortal: y, className: b, ...x }) {
|
|
5945
|
+
let S = U.useRef(null), { fitCount: C, remeasure: w } = Or(S), { visibleItems: T, hiddenCount: E, expanded: D, collapsible: O, toggle: k } = kr(n, l, C);
|
|
5946
|
+
U.useLayoutEffect(w, [
|
|
5947
|
+
w,
|
|
5948
|
+
n,
|
|
5949
|
+
d,
|
|
5950
|
+
o,
|
|
5951
|
+
T.length
|
|
5952
|
+
]), U.useEffect(() => {
|
|
5953
|
+
h !== null && !T.some((e) => e.key === h) && _(null);
|
|
5906
5954
|
}, [
|
|
5907
5955
|
h,
|
|
5908
|
-
|
|
5956
|
+
T,
|
|
5909
5957
|
_
|
|
5910
|
-
])
|
|
5958
|
+
]);
|
|
5959
|
+
let A = C !== void 0 && T.length > C, j = c !== null || s !== void 0, M = d ? "gap-0" : "gap-1";
|
|
5960
|
+
return /* @__PURE__ */ Z("div", {
|
|
5911
5961
|
role: "group",
|
|
5912
5962
|
"aria-label": m,
|
|
5913
|
-
className: e("flex
|
|
5963
|
+
className: e("flex h-full min-h-0 flex-col", M, b),
|
|
5914
5964
|
...x,
|
|
5915
5965
|
ref: t,
|
|
5916
5966
|
children: [
|
|
5917
|
-
|
|
5918
|
-
|
|
5919
|
-
|
|
5920
|
-
|
|
5921
|
-
|
|
5922
|
-
|
|
5923
|
-
|
|
5924
|
-
|
|
5925
|
-
|
|
5926
|
-
|
|
5927
|
-
|
|
5928
|
-
|
|
5929
|
-
|
|
5930
|
-
|
|
5931
|
-
|
|
5932
|
-
|
|
5933
|
-
|
|
5934
|
-
|
|
5935
|
-
|
|
5936
|
-
|
|
5937
|
-
|
|
5938
|
-
|
|
5939
|
-
|
|
5940
|
-
|
|
5941
|
-
|
|
5942
|
-
|
|
5943
|
-
|
|
5944
|
-
|
|
5945
|
-
|
|
5946
|
-
|
|
5967
|
+
/* @__PURE__ */ X(H, {
|
|
5968
|
+
className: "min-h-0 flex-1",
|
|
5969
|
+
"data-dashboard-grid-no-drag": A ? "" : void 0,
|
|
5970
|
+
viewportProps: {
|
|
5971
|
+
ref: S,
|
|
5972
|
+
className: "overscroll-contain",
|
|
5973
|
+
...A ? {
|
|
5974
|
+
tabIndex: 0,
|
|
5975
|
+
role: "group",
|
|
5976
|
+
"aria-label": "Scrollable rows"
|
|
5977
|
+
} : {}
|
|
5978
|
+
},
|
|
5979
|
+
children: /* @__PURE__ */ X("div", {
|
|
5980
|
+
className: e("flex flex-col", M),
|
|
5981
|
+
children: T.map((e, t) => /* @__PURE__ */ X(lr, {
|
|
5982
|
+
label: e.label,
|
|
5983
|
+
formattedValue: i ? i(e.value) : String(e.value),
|
|
5984
|
+
ratio: p ? r[t] : 0,
|
|
5985
|
+
color: yr(e, t),
|
|
5986
|
+
detail: e.detail,
|
|
5987
|
+
icon: e.icon,
|
|
5988
|
+
trend: e.trend,
|
|
5989
|
+
trendSentiment: a,
|
|
5990
|
+
threshold: e.threshold,
|
|
5991
|
+
rank: o ? t + 1 : void 0,
|
|
5992
|
+
compact: d,
|
|
5993
|
+
animated: u,
|
|
5994
|
+
highlighted: f && h === e.key,
|
|
5995
|
+
dimmed: f && h !== null && h !== e.key,
|
|
5996
|
+
interactive: g,
|
|
5997
|
+
onMouseEnter: () => _(e),
|
|
5998
|
+
onMouseLeave: () => _(null),
|
|
5999
|
+
onClick: g ? () => v?.(e) : void 0
|
|
6000
|
+
}, e.key))
|
|
6001
|
+
})
|
|
6002
|
+
}),
|
|
6003
|
+
(O || j) && /* @__PURE__ */ Z("div", {
|
|
6004
|
+
className: e("flex shrink-0 flex-col", M),
|
|
6005
|
+
children: [O && /* @__PURE__ */ X("button", {
|
|
6006
|
+
type: "button",
|
|
6007
|
+
"data-slot": "breakdown-toggle",
|
|
6008
|
+
"aria-expanded": D,
|
|
6009
|
+
className: "px-2 py-1 text-left text-xs font-medium text-muted-foreground transition-colors hover:text-foreground",
|
|
6010
|
+
onClick: k,
|
|
6011
|
+
children: D ? "Show less" : `+${E} other${E > 1 ? "s" : ""}`
|
|
6012
|
+
}), c ?? (s && /* @__PURE__ */ Z(Y, { children: [/* @__PURE__ */ X("div", { className: "mx-2 border-t border-border" }), /* @__PURE__ */ Z("div", {
|
|
6013
|
+
className: "flex items-center justify-between px-2 pt-2",
|
|
6014
|
+
children: [/* @__PURE__ */ X("span", {
|
|
6015
|
+
className: "text-sm text-muted-foreground",
|
|
6016
|
+
children: s.label
|
|
6017
|
+
}), /* @__PURE__ */ X("span", {
|
|
6018
|
+
className: "text-sm font-semibold text-foreground tabular-nums",
|
|
6019
|
+
children: s.value
|
|
6020
|
+
})]
|
|
6021
|
+
})] }))]
|
|
5947
6022
|
}),
|
|
5948
|
-
c ?? (s && /* @__PURE__ */ Z(Y, { children: [/* @__PURE__ */ X("div", { className: "mx-2 border-t border-border" }), /* @__PURE__ */ Z("div", {
|
|
5949
|
-
className: "flex items-center justify-between px-2 pt-2",
|
|
5950
|
-
children: [/* @__PURE__ */ X("span", {
|
|
5951
|
-
className: "text-sm text-muted-foreground",
|
|
5952
|
-
children: s.label
|
|
5953
|
-
}), /* @__PURE__ */ X("span", {
|
|
5954
|
-
className: "text-sm font-semibold text-foreground tabular-nums",
|
|
5955
|
-
children: s.value
|
|
5956
|
-
})]
|
|
5957
|
-
})] })),
|
|
5958
6023
|
y
|
|
5959
6024
|
]
|
|
5960
6025
|
});
|
|
5961
6026
|
}
|
|
5962
6027
|
//#endregion
|
|
5963
6028
|
//#region src/charts/BreakdownChart/BreakdownLegend.tsx
|
|
5964
|
-
function
|
|
6029
|
+
function Nr({ children: e }) {
|
|
5965
6030
|
let { setLegend: t } = dr();
|
|
5966
6031
|
return U.useLayoutEffect(() => (t(e), () => t(null)), [e, t]), null;
|
|
5967
6032
|
}
|
|
5968
|
-
function
|
|
6033
|
+
function Pr({ items: t, colors: n, formatValue: r, className: i, ...a }) {
|
|
5969
6034
|
return /* @__PURE__ */ X("div", {
|
|
5970
6035
|
className: e("flex flex-wrap items-center gap-x-4 gap-y-1", i),
|
|
5971
6036
|
...a,
|
|
@@ -5991,13 +6056,13 @@ function jr({ items: t, colors: n, formatValue: r, className: i, ...a }) {
|
|
|
5991
6056
|
}
|
|
5992
6057
|
//#endregion
|
|
5993
6058
|
//#region src/charts/BreakdownChart/BreakdownSummary.tsx
|
|
5994
|
-
function
|
|
6059
|
+
function Fr({ children: e }) {
|
|
5995
6060
|
let { setSummary: t } = dr();
|
|
5996
6061
|
return U.useLayoutEffect(() => (t(e), () => t(null)), [e, t]), null;
|
|
5997
6062
|
}
|
|
5998
6063
|
//#endregion
|
|
5999
6064
|
//#region src/charts/FilterCombobox/DataTypeIcon.tsx
|
|
6000
|
-
function
|
|
6065
|
+
function Ir({ icon: t, tooltipContent: n, colorClass: r }) {
|
|
6001
6066
|
return /* @__PURE__ */ Z(ie, { children: [/* @__PURE__ */ X(se, {
|
|
6002
6067
|
asChild: !0,
|
|
6003
6068
|
children: /* @__PURE__ */ X("span", {
|
|
@@ -6011,10 +6076,10 @@ function Nr({ icon: t, tooltipContent: n, colorClass: r }) {
|
|
|
6011
6076
|
}
|
|
6012
6077
|
//#endregion
|
|
6013
6078
|
//#region src/charts/FilterCombobox/DataTypeIcons.tsx
|
|
6014
|
-
function
|
|
6079
|
+
function Lr({ dataTypes: e }) {
|
|
6015
6080
|
return e.length === 0 ? null : /* @__PURE__ */ X("span", {
|
|
6016
6081
|
className: "ml-2 flex shrink-0 items-center",
|
|
6017
|
-
children: e.map((e) => /* @__PURE__ */ X(
|
|
6082
|
+
children: e.map((e) => /* @__PURE__ */ X(Ir, {
|
|
6018
6083
|
icon: e.icon,
|
|
6019
6084
|
tooltipContent: e.tooltipContent,
|
|
6020
6085
|
colorClass: e.colorClass
|
|
@@ -6023,19 +6088,19 @@ function Pr({ dataTypes: e }) {
|
|
|
6023
6088
|
}
|
|
6024
6089
|
//#endregion
|
|
6025
6090
|
//#region src/charts/FilterCombobox/filter-combobox-options.ts
|
|
6026
|
-
function
|
|
6091
|
+
function Rr(e, t) {
|
|
6027
6092
|
return `${e}-${t}`;
|
|
6028
6093
|
}
|
|
6029
|
-
function
|
|
6094
|
+
function zr(e) {
|
|
6030
6095
|
return e;
|
|
6031
6096
|
}
|
|
6032
|
-
function
|
|
6097
|
+
function Br(e, t) {
|
|
6033
6098
|
return `${e}-option-${t}`;
|
|
6034
6099
|
}
|
|
6035
|
-
function
|
|
6100
|
+
function Vr(e, t, n, r) {
|
|
6036
6101
|
if (!e) return t.map((e) => ({
|
|
6037
6102
|
item: e,
|
|
6038
|
-
optionValue:
|
|
6103
|
+
optionValue: zr(e.id)
|
|
6039
6104
|
}));
|
|
6040
6105
|
let i = [];
|
|
6041
6106
|
for (let e of n) {
|
|
@@ -6043,30 +6108,30 @@ function Rr(e, t, n, r) {
|
|
|
6043
6108
|
let n = t.filter((t) => t.scopes.includes(e.id));
|
|
6044
6109
|
for (let t of n) i.push({
|
|
6045
6110
|
item: t,
|
|
6046
|
-
optionValue:
|
|
6111
|
+
optionValue: Rr(e.id, t.id)
|
|
6047
6112
|
});
|
|
6048
6113
|
}
|
|
6049
6114
|
return i;
|
|
6050
6115
|
}
|
|
6051
|
-
function
|
|
6116
|
+
function Hr(e, t, n) {
|
|
6052
6117
|
if (e.length === 0) return;
|
|
6053
6118
|
let r = t ? e.findIndex((e) => e.optionValue === t) : -1;
|
|
6054
6119
|
return r === -1 ? n === "next" ? e[0].optionValue : e[e.length - 1].optionValue : n === "next" ? e[r < e.length - 1 ? r + 1 : 0].optionValue : e[r > 0 ? r - 1 : e.length - 1].optionValue;
|
|
6055
6120
|
}
|
|
6056
|
-
function
|
|
6121
|
+
function Ur(e, t) {
|
|
6057
6122
|
if (t) return e.some((e) => e.optionValue === t) ? t : void 0;
|
|
6058
6123
|
}
|
|
6059
6124
|
//#endregion
|
|
6060
6125
|
//#region src/charts/FilterCombobox/resolve-item-data-types.ts
|
|
6061
|
-
function
|
|
6126
|
+
function Wr(e) {
|
|
6062
6127
|
return e.dataTypeIds ?? [];
|
|
6063
6128
|
}
|
|
6064
|
-
function
|
|
6065
|
-
return Array.from(new Set(
|
|
6129
|
+
function Gr(e, t) {
|
|
6130
|
+
return Array.from(new Set(Wr(e))).map((e) => t.find((t) => t.id === e)).filter((e) => e !== void 0);
|
|
6066
6131
|
}
|
|
6067
6132
|
//#endregion
|
|
6068
6133
|
//#region src/charts/FilterCombobox/FilterGroupedList.tsx
|
|
6069
|
-
function
|
|
6134
|
+
function Kr({ scopes: t, dataTypes: n, items: r, expandedScopes: i, onToggleScope: a, onSelect: o, onHighlightOption: s }) {
|
|
6070
6135
|
return /* @__PURE__ */ X(Y, { children: t.map((t) => {
|
|
6071
6136
|
let c = r.filter((e) => e.scopes.includes(t.id));
|
|
6072
6137
|
if (c.length === 0) return null;
|
|
@@ -6097,7 +6162,7 @@ function Ur({ scopes: t, dataTypes: n, items: r, expandedScopes: i, onToggleScop
|
|
|
6097
6162
|
}), /* @__PURE__ */ X(F, { children: /* @__PURE__ */ X(z, {
|
|
6098
6163
|
className: "mt-1 ml-3 pl-1",
|
|
6099
6164
|
children: (i[t.id] ?? !0) && c.map((e) => {
|
|
6100
|
-
let r =
|
|
6165
|
+
let r = Gr(e, n), i = Rr(t.id, e.id);
|
|
6101
6166
|
return /* @__PURE__ */ Z(ee, {
|
|
6102
6167
|
"data-filter-option-value": i,
|
|
6103
6168
|
value: i,
|
|
@@ -6107,7 +6172,7 @@ function Ur({ scopes: t, dataTypes: n, items: r, expandedScopes: i, onToggleScop
|
|
|
6107
6172
|
children: [/* @__PURE__ */ X("span", {
|
|
6108
6173
|
className: "min-w-0 flex-1 truncate font-medium text-foreground",
|
|
6109
6174
|
children: e.name
|
|
6110
|
-
}), /* @__PURE__ */ X(
|
|
6175
|
+
}), /* @__PURE__ */ X(Lr, { dataTypes: r })]
|
|
6111
6176
|
}, `${t.id}-${e.id}`);
|
|
6112
6177
|
})
|
|
6113
6178
|
}) })]
|
|
@@ -6116,12 +6181,12 @@ function Ur({ scopes: t, dataTypes: n, items: r, expandedScopes: i, onToggleScop
|
|
|
6116
6181
|
}
|
|
6117
6182
|
//#endregion
|
|
6118
6183
|
//#region src/charts/FilterCombobox/HighlightMatch.tsx
|
|
6119
|
-
function
|
|
6184
|
+
function qr(e) {
|
|
6120
6185
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
6121
6186
|
}
|
|
6122
|
-
function
|
|
6187
|
+
function Jr(e, t) {
|
|
6123
6188
|
if (!t.trim()) return [e];
|
|
6124
|
-
let n =
|
|
6189
|
+
let n = qr(t);
|
|
6125
6190
|
return e.split(RegExp(`(${n})`, "gi")).map((e, n) => e.toLowerCase() === t.toLowerCase() ? /* @__PURE__ */ X("mark", {
|
|
6126
6191
|
className: "rounded-sm bg-warning/10 text-warning-foreground",
|
|
6127
6192
|
children: e
|
|
@@ -6129,12 +6194,12 @@ function Gr(e, t) {
|
|
|
6129
6194
|
}
|
|
6130
6195
|
//#endregion
|
|
6131
6196
|
//#region src/charts/FilterCombobox/FilterSearchList.tsx
|
|
6132
|
-
function
|
|
6197
|
+
function Yr({ scopes: t, dataTypes: n, items: r, searchQuery: i, onSelect: a, onHighlightOption: o }) {
|
|
6133
6198
|
return /* @__PURE__ */ X(z, {
|
|
6134
6199
|
heading: `Results (${r.length})`,
|
|
6135
6200
|
className: "mt-1",
|
|
6136
6201
|
children: r.map((r) => {
|
|
6137
|
-
let s =
|
|
6202
|
+
let s = Gr(r, n), c = zr(r.id);
|
|
6138
6203
|
return /* @__PURE__ */ Z(ee, {
|
|
6139
6204
|
"data-filter-option-value": c,
|
|
6140
6205
|
value: c,
|
|
@@ -6145,7 +6210,7 @@ function Kr({ scopes: t, dataTypes: n, items: r, searchQuery: i, onSelect: a, on
|
|
|
6145
6210
|
className: "flex min-w-0 flex-1 flex-col gap-1.5 overflow-hidden",
|
|
6146
6211
|
children: [/* @__PURE__ */ X("span", {
|
|
6147
6212
|
className: "truncate text-sm font-medium text-foreground",
|
|
6148
|
-
children:
|
|
6213
|
+
children: Jr(r.name, i)
|
|
6149
6214
|
}), /* @__PURE__ */ X("div", {
|
|
6150
6215
|
className: "flex flex-wrap items-center gap-1.5",
|
|
6151
6216
|
children: r.scopes.map((n) => {
|
|
@@ -6159,14 +6224,14 @@ function Kr({ scopes: t, dataTypes: n, items: r, searchQuery: i, onSelect: a, on
|
|
|
6159
6224
|
}, n);
|
|
6160
6225
|
})
|
|
6161
6226
|
})]
|
|
6162
|
-
}), /* @__PURE__ */ X(
|
|
6227
|
+
}), /* @__PURE__ */ X(Lr, { dataTypes: s })]
|
|
6163
6228
|
}, r.id);
|
|
6164
6229
|
})
|
|
6165
6230
|
});
|
|
6166
6231
|
}
|
|
6167
6232
|
//#endregion
|
|
6168
6233
|
//#region src/charts/FilterCombobox/use-filter-combobox.ts
|
|
6169
|
-
function
|
|
6234
|
+
function Xr({ items: e, scopes: t, onSelect: n, value: r, onValueChange: i, open: a, onOpenChange: o }) {
|
|
6170
6235
|
let s = K(), c = J(null), l = J(null), u = J(null), d = J(!1), f = a !== void 0, p = r !== void 0, [m, h] = pe(!1), [g, _] = pe(null), [v, y] = pe(""), [b, x] = pe(void 0), S = f ? a : m, C = p ? r : g, w = G((e) => {
|
|
6171
6236
|
f ? o?.(e) : h(e);
|
|
6172
6237
|
}, [f, o]), T = G((e) => {
|
|
@@ -6179,15 +6244,15 @@ function qr({ items: e, scopes: t, onSelect: n, value: r, onValueChange: i, open
|
|
|
6179
6244
|
}, []), k = q(() => {
|
|
6180
6245
|
let t = v.trim().toLowerCase();
|
|
6181
6246
|
return t ? e.filter((e) => e.name.toLowerCase().includes(t) || e.id.toLowerCase().includes(t)) : e;
|
|
6182
|
-
}, [e, v]), A = v.trim() === "", j = q(() =>
|
|
6247
|
+
}, [e, v]), A = v.trim() === "", j = q(() => Vr(A, k, t, E), [
|
|
6183
6248
|
A,
|
|
6184
6249
|
k,
|
|
6185
6250
|
t,
|
|
6186
6251
|
E
|
|
6187
|
-
]), M = q(() =>
|
|
6252
|
+
]), M = q(() => Ur(j, b), [j, b]), N = M ? Br(s, M) : void 0, P = G(() => {
|
|
6188
6253
|
x(void 0);
|
|
6189
6254
|
}, []), F = G((e) => {
|
|
6190
|
-
x((t) =>
|
|
6255
|
+
x((t) => Hr(j, t, e));
|
|
6191
6256
|
}, [j]), I = G((e) => {
|
|
6192
6257
|
d.current = !1, u.current = e, T(e), y(e.name), P(), w(!1), n(e);
|
|
6193
6258
|
}, [
|
|
@@ -6257,7 +6322,7 @@ function qr({ items: e, scopes: t, onSelect: n, value: r, onValueChange: i, open
|
|
|
6257
6322
|
}
|
|
6258
6323
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
6259
6324
|
}, [P, w]), de(() => {
|
|
6260
|
-
!S || !M || document.getElementById(
|
|
6325
|
+
!S || !M || document.getElementById(Br(s, M))?.scrollIntoView({ block: "nearest" });
|
|
6261
6326
|
}, [
|
|
6262
6327
|
M,
|
|
6263
6328
|
S,
|
|
@@ -6270,7 +6335,7 @@ function qr({ items: e, scopes: t, onSelect: n, value: r, onValueChange: i, open
|
|
|
6270
6335
|
for (let e of t) {
|
|
6271
6336
|
if (!(e instanceof HTMLElement)) continue;
|
|
6272
6337
|
let t = e.getAttribute("data-filter-option-value");
|
|
6273
|
-
t && (e.id =
|
|
6338
|
+
t && (e.id = Br(s, t));
|
|
6274
6339
|
}
|
|
6275
6340
|
}, [
|
|
6276
6341
|
S,
|
|
@@ -6304,8 +6369,8 @@ function qr({ items: e, scopes: t, onSelect: n, value: r, onValueChange: i, open
|
|
|
6304
6369
|
}
|
|
6305
6370
|
//#endregion
|
|
6306
6371
|
//#region src/charts/FilterCombobox/FilterCombobox.tsx
|
|
6307
|
-
function
|
|
6308
|
-
let { listboxId: f, containerRef: p, inputRef: m, isOpen: h, isIdle: g, inputValue: _, highlightedOptionValue: v, activeDescendantId: y, expandedScopes: b, filteredItems: x, toggleScope: S, handleSelect: C, handleClear: w, handleInputChange: T, handleClick: E, handleHighlightOption: D, handleFocus: O, handleKeyDown: k } =
|
|
6372
|
+
function Zr({ scopes: e, dataTypes: t, items: n, onSelect: r, placeholder: i = "Search a property...", emptyMessage: a = "No results found.", listLabel: o = "Filter options", inputId: s, value: c, onValueChange: l, open: u, onOpenChange: d }) {
|
|
6373
|
+
let { listboxId: f, containerRef: p, inputRef: m, isOpen: h, isIdle: g, inputValue: _, highlightedOptionValue: v, activeDescendantId: y, expandedScopes: b, filteredItems: x, toggleScope: S, handleSelect: C, handleClear: w, handleInputChange: T, handleClick: E, handleHighlightOption: D, handleFocus: O, handleKeyDown: k } = Xr({
|
|
6309
6374
|
items: n,
|
|
6310
6375
|
scopes: e,
|
|
6311
6376
|
onSelect: r,
|
|
@@ -6368,7 +6433,7 @@ function Jr({ scopes: e, dataTypes: t, items: n, onSelect: r, placeholder: i = "
|
|
|
6368
6433
|
className: "text-xs",
|
|
6369
6434
|
children: a
|
|
6370
6435
|
})]
|
|
6371
|
-
}) }), g ? /* @__PURE__ */ X(
|
|
6436
|
+
}) }), g ? /* @__PURE__ */ X(Kr, {
|
|
6372
6437
|
scopes: e,
|
|
6373
6438
|
dataTypes: t,
|
|
6374
6439
|
items: x,
|
|
@@ -6376,7 +6441,7 @@ function Jr({ scopes: e, dataTypes: t, items: n, onSelect: r, placeholder: i = "
|
|
|
6376
6441
|
onToggleScope: S,
|
|
6377
6442
|
onSelect: C,
|
|
6378
6443
|
onHighlightOption: D
|
|
6379
|
-
}) : /* @__PURE__ */ X(
|
|
6444
|
+
}) : /* @__PURE__ */ X(Yr, {
|
|
6380
6445
|
scopes: e,
|
|
6381
6446
|
dataTypes: t,
|
|
6382
6447
|
items: x,
|
|
@@ -6391,4 +6456,4 @@ function Jr({ scopes: e, dataTypes: t, items: n, onSelect: r, placeholder: i = "
|
|
|
6391
6456
|
});
|
|
6392
6457
|
}
|
|
6393
6458
|
//#endregion
|
|
6394
|
-
export { Cn as AreaChart, Be as AreaSeries, Ue as BarChart, lr as BarMeter, Re as BarSeries,
|
|
6459
|
+
export { Cn as AreaChart, Be as AreaSeries, Ue as BarChart, lr as BarMeter, Re as BarSeries, Ar as BreakdownChart, Sr as BreakdownChartSkeleton, Nr as BreakdownLegend, Pr as BreakdownLegendContent, Fr as BreakdownSummary, pr as BreakdownTooltip, gr as BreakdownTooltipContent, a as CHART_THEMES, m as CartesianChart, g as CategoryAxis, g as XAxis, Ce as ChartCard, E as ChartContainer, Ne as ChartLegend, Me as ChartLegendContent, i as ChartStyle, Ae as ChartTooltip, ke as ChartTooltipContent, r as DEFAULT_MARGIN, Je as DoughnutChart, Zr as FilterCombobox, o as Grid, Sn as LineChart, Ie as LineSeries, an as Metric, xn as MetricGroup, f as ReferenceLine, ar as TraceWaterfall, p as ValueAxis, p as YAxis, jn as buildTimeAxisTicks, e as cn, n as compactTick, En as computeBarGeometry, Tn as computeTraceDurationNs, wn as formatDurationNs, Dn as formatTracePercent, Jt as resolveSentiment, t as useChartConfig };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravitee/graphene-charts",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.15.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Theme-compliant data visualization components for the Graphene design system. Built on D3, styled with Tailwind, and designed to inherit the Graphene token system out of the box.",
|
|
6
6
|
"keywords": [
|