one-design-next 0.0.100 → 0.0.102

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 (48) hide show
  1. package/dist/chart/bar.d.ts +11 -0
  2. package/dist/chart/bar.js +24 -0
  3. package/dist/chart/bullet.d.ts +27 -0
  4. package/dist/chart/bullet.js +455 -0
  5. package/dist/chart/butterfly.d.ts +15 -0
  6. package/dist/chart/butterfly.js +256 -0
  7. package/dist/chart/dual-line.d.ts +85 -0
  8. package/dist/chart/dual-line.js +634 -0
  9. package/dist/chart/echarts.d.ts +2 -0
  10. package/dist/chart/echarts.js +6 -0
  11. package/dist/chart/host.d.ts +13 -0
  12. package/dist/chart/host.js +59 -0
  13. package/dist/chart/index.d.ts +33 -13
  14. package/dist/chart/index.js +28 -10
  15. package/dist/chart/line.d.ts +12 -0
  16. package/dist/chart/line.js +24 -0
  17. package/dist/chart/option.d.ts +27 -0
  18. package/dist/chart/option.js +225 -0
  19. package/dist/chart/pie.d.ts +10 -0
  20. package/dist/chart/pie.js +19 -0
  21. package/dist/chart/quadrant.d.ts +42 -0
  22. package/dist/chart/quadrant.js +382 -0
  23. package/dist/chart/radar.d.ts +11 -0
  24. package/dist/chart/radar.js +24 -0
  25. package/dist/chart/ripple-layout.d.ts +25 -0
  26. package/dist/chart/ripple-layout.js +405 -0
  27. package/dist/chart/ripple.d.ts +14 -0
  28. package/dist/chart/ripple.js +196 -0
  29. package/dist/chart/sankey-layout.d.ts +47 -0
  30. package/dist/chart/sankey-layout.js +174 -0
  31. package/dist/chart/sankey.d.ts +16 -0
  32. package/dist/chart/sankey.js +288 -0
  33. package/dist/chart/style/index.css +1575 -0
  34. package/dist/chart/symmetric.d.ts +18 -0
  35. package/dist/chart/symmetric.js +102 -0
  36. package/dist/chart/tokens.d.ts +18 -0
  37. package/dist/chart/tokens.js +57 -0
  38. package/dist/chart/treemap-layout.d.ts +27 -0
  39. package/dist/chart/treemap-layout.js +199 -0
  40. package/dist/chart/treemap.d.ts +24 -0
  41. package/dist/chart/treemap.js +241 -0
  42. package/dist/chart/word-cloud.d.ts +16 -0
  43. package/dist/chart/word-cloud.js +201 -0
  44. package/dist/index.d.ts +1 -1
  45. package/dist/tabs/index.d.ts +10 -7
  46. package/dist/tabs/index.js +139 -86
  47. package/dist/tabs/style/index.css +89 -1
  48. package/package.json +2 -3
@@ -0,0 +1,11 @@
1
+ import type { EChartsOption } from 'echarts';
2
+ import * as React from 'react';
3
+ import { type ChartHostProps } from './host';
4
+ import { type ChartSeries } from './option';
5
+ export interface ChartBarProps extends Omit<ChartHostProps, 'option'> {
6
+ categories: string[];
7
+ series: ChartSeries[];
8
+ option?: EChartsOption;
9
+ }
10
+ declare const ChartBar: React.FC<ChartBarProps>;
11
+ export default ChartBar;
@@ -0,0 +1,24 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ var _excluded = ["categories", "series", "option"];
4
+ import * as React from 'react';
5
+ import ChartHost from "./host";
6
+ import { cartesianOption, mergeOption } from "./option";
7
+ var ChartBar = function ChartBar(_ref) {
8
+ var categories = _ref.categories,
9
+ series = _ref.series,
10
+ option = _ref.option,
11
+ rest = _objectWithoutProperties(_ref, _excluded);
12
+ var built = React.useMemo(function () {
13
+ return mergeOption(cartesianOption({
14
+ kind: 'bar',
15
+ categories: categories,
16
+ series: series
17
+ }), option);
18
+ }, [categories, series, option]);
19
+ return /*#__PURE__*/React.createElement(ChartHost, _extends({
20
+ option: built
21
+ }, rest));
22
+ };
23
+ ChartBar.displayName = 'Chart.Bar';
24
+ export default ChartBar;
@@ -0,0 +1,27 @@
1
+ import * as React from 'react';
2
+ import '../pop-base/style';
3
+ import './style';
4
+ export type ChartBulletItem = {
5
+ name: string;
6
+ value: number;
7
+ rate: number;
8
+ bench?: number;
9
+ };
10
+ export interface ChartBulletProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {
11
+ data: ChartBulletItem[];
12
+ nameLabel?: string;
13
+ valueLabel?: string;
14
+ rateLabel?: string;
15
+ benchLabel?: string;
16
+ /** 名称列宽。心智触点默认 140 */
17
+ nameWidth?: number;
18
+ /** 绝对量列兜底宽。心智触点默认 100,渲染后按内容撑开,顶 120 */
19
+ valueWidth?: number;
20
+ /** 藏绝对量列。渗透列表只有条和竖线,不是新图种 */
21
+ hideValue?: boolean;
22
+ hideAxisLabel?: boolean;
23
+ hideTopBarBorder?: boolean;
24
+ maxBodyHeight?: number;
25
+ }
26
+ declare const ChartBullet: React.FC<ChartBulletProps>;
27
+ export default ChartBullet;
@@ -0,0 +1,455 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
6
+ var _excluded = ["data", "nameLabel", "valueLabel", "rateLabel", "benchLabel", "nameWidth", "valueWidth", "hideValue", "hideAxisLabel", "hideTopBarBorder", "maxBodyHeight", "className", "style"];
7
+ import clsx from 'clsx';
8
+ import * as React from 'react';
9
+ import { createPortal } from 'react-dom';
10
+ import Empty from "../empty";
11
+ import HoverFill from "../hover-fill";
12
+ import "../pop-base/style";
13
+ import "./style";
14
+ var TICK_THRESHOLDS = [{
15
+ max: 0.1,
16
+ base: 0.05
17
+ }, {
18
+ max: 0.5,
19
+ base: 0.2
20
+ }, {
21
+ max: 1,
22
+ base: 0.5
23
+ }, {
24
+ max: 2,
25
+ base: 1
26
+ }, {
27
+ max: 5,
28
+ base: 2
29
+ }, {
30
+ max: 10,
31
+ base: 5
32
+ }, {
33
+ max: 20,
34
+ base: 10
35
+ }, {
36
+ max: 50,
37
+ base: 20
38
+ }];
39
+ var TICK_COUNT = 5;
40
+ var TGI_COL_MAX = 120;
41
+ var SHARED_POPOVER_OFFSET = 8;
42
+ var SHARED_POPOVER_TRANSITION = 'transform 120ms ease-out';
43
+ var SHARED_POPOVER_HIDE_DELAY = 80;
44
+ function getTickBase(value) {
45
+ for (var _i = 0, _TICK_THRESHOLDS = TICK_THRESHOLDS; _i < _TICK_THRESHOLDS.length; _i++) {
46
+ var _TICK_THRESHOLDS$_i = _TICK_THRESHOLDS[_i],
47
+ max = _TICK_THRESHOLDS$_i.max,
48
+ base = _TICK_THRESHOLDS$_i.base;
49
+ if (value <= max) return base;
50
+ }
51
+ return 25;
52
+ }
53
+ function formatAxisLabel(value) {
54
+ if (value === 0) return '0%';
55
+ if (Number.isInteger(value)) return "".concat(value, "%");
56
+ return value < 1 ? "".concat(value.toFixed(2), "%") : "".concat(value.toFixed(1), "%");
57
+ }
58
+ function formatPercentage(value) {
59
+ if (value > 0 && value < 0.01) return '0.01%';
60
+ return "".concat(value.toFixed(2), "%");
61
+ }
62
+ function formatValue(value) {
63
+ return Math.round(value).toLocaleString();
64
+ }
65
+ function getMaxRate(data) {
66
+ if (data.length === 0) return 20;
67
+ var maxValue = Math.max.apply(Math, _toConsumableArray(data.map(function (item) {
68
+ var _item$bench;
69
+ return Math.max(item.rate, (_item$bench = item.bench) !== null && _item$bench !== void 0 ? _item$bench : 0);
70
+ })));
71
+ return Math.max(5, maxValue);
72
+ }
73
+ function getPopoverOffset(area, target) {
74
+ var rect = target.getBoundingClientRect();
75
+ return {
76
+ x: Math.round(area === 'left' ? rect.right : rect.left),
77
+ y: Math.round(rect.top + rect.height / 2)
78
+ };
79
+ }
80
+ function getPopoverRootStyle(popoverState, area) {
81
+ var _popoverState$offset$, _popoverState$offset$2;
82
+ var x = (_popoverState$offset$ = popoverState === null || popoverState === void 0 ? void 0 : popoverState.offset.x) !== null && _popoverState$offset$ !== void 0 ? _popoverState$offset$ : 0;
83
+ var y = (_popoverState$offset$2 = popoverState === null || popoverState === void 0 ? void 0 : popoverState.offset.y) !== null && _popoverState$offset$2 !== void 0 ? _popoverState$offset$2 : 0;
84
+ var horizontalOffset = area === 'left' ? SHARED_POPOVER_OFFSET : -SHARED_POPOVER_OFFSET;
85
+ var alignTransform = area === 'left' ? 'translateY(-50%)' : 'translate(-100%, -50%)';
86
+ return {
87
+ pointerEvents: 'none',
88
+ position: 'fixed',
89
+ left: 0,
90
+ top: 0,
91
+ transition: popoverState !== null && popoverState !== void 0 && popoverState.animate ? SHARED_POPOVER_TRANSITION : 'none',
92
+ transform: "translate3d(".concat(x + horizontalOffset, "px, ").concat(y, "px, 0) ").concat(alignTransform),
93
+ willChange: 'transform'
94
+ };
95
+ }
96
+ function SortCarets(_ref) {
97
+ var order = _ref.order;
98
+ return /*#__PURE__*/React.createElement("span", {
99
+ "data-odn-chart-bullet-sort": true,
100
+ "data-order": order || undefined,
101
+ "aria-hidden": true
102
+ }, /*#__PURE__*/React.createElement("svg", {
103
+ "data-odn-chart-bullet-sort-up": true,
104
+ viewBox: "0 0 16 16"
105
+ }, /*#__PURE__*/React.createElement("path", {
106
+ d: "M7.41437 2.73204C7.71461 2.35674 8.28543 2.35674 8.58567 2.73204L11.0252 5.78145C11.4181 6.27253 11.0684 6.99998 10.4396 6.99998L5.56049 6.99998C4.93161 6.99998 4.58198 6.27253 4.97484 5.78145L7.41437 2.73204Z"
107
+ })), /*#__PURE__*/React.createElement("svg", {
108
+ "data-odn-chart-bullet-sort-down": true,
109
+ viewBox: "0 0 16 16"
110
+ }, /*#__PURE__*/React.createElement("path", {
111
+ d: "M8.58567 13.2679C8.28543 13.6432 7.71461 13.6432 7.41437 13.2679L4.97484 10.2185C4.58198 9.72743 4.93161 8.99998 5.56049 8.99998H10.4396C11.0684 8.99998 11.4181 9.72743 11.0252 10.2185L8.58567 13.2679Z"
112
+ })));
113
+ }
114
+ var ChartBullet = function ChartBullet(_ref2) {
115
+ var data = _ref2.data,
116
+ _ref2$nameLabel = _ref2.nameLabel,
117
+ nameLabel = _ref2$nameLabel === void 0 ? '触点' : _ref2$nameLabel,
118
+ _ref2$valueLabel = _ref2.valueLabel,
119
+ valueLabel = _ref2$valueLabel === void 0 ? '心智量' : _ref2$valueLabel,
120
+ _ref2$rateLabel = _ref2.rateLabel,
121
+ rateLabel = _ref2$rateLabel === void 0 ? '心智量占比' : _ref2$rateLabel,
122
+ _ref2$benchLabel = _ref2.benchLabel,
123
+ benchLabel = _ref2$benchLabel === void 0 ? '行业均值' : _ref2$benchLabel,
124
+ _ref2$nameWidth = _ref2.nameWidth,
125
+ nameWidth = _ref2$nameWidth === void 0 ? 140 : _ref2$nameWidth,
126
+ _ref2$valueWidth = _ref2.valueWidth,
127
+ valueWidth = _ref2$valueWidth === void 0 ? 100 : _ref2$valueWidth,
128
+ _ref2$hideValue = _ref2.hideValue,
129
+ hideValue = _ref2$hideValue === void 0 ? false : _ref2$hideValue,
130
+ _ref2$hideAxisLabel = _ref2.hideAxisLabel,
131
+ hideAxisLabel = _ref2$hideAxisLabel === void 0 ? false : _ref2$hideAxisLabel,
132
+ _ref2$hideTopBarBorde = _ref2.hideTopBarBorder,
133
+ hideTopBarBorder = _ref2$hideTopBarBorde === void 0 ? false : _ref2$hideTopBarBorde,
134
+ _ref2$maxBodyHeight = _ref2.maxBodyHeight,
135
+ maxBodyHeight = _ref2$maxBodyHeight === void 0 ? 368 : _ref2$maxBodyHeight,
136
+ className = _ref2.className,
137
+ style = _ref2.style,
138
+ rest = _objectWithoutProperties(_ref2, _excluded);
139
+ var rootRef = React.useRef(null);
140
+ var bodyInnerRef = React.useRef(null);
141
+ var chartAreaObserverRef = React.useRef(null);
142
+ var _React$useState = React.useState(0),
143
+ _React$useState2 = _slicedToArray(_React$useState, 2),
144
+ chartWidth = _React$useState2[0],
145
+ setChartWidth = _React$useState2[1];
146
+ var _React$useState3 = React.useState(hideValue ? 0 : valueWidth),
147
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
148
+ tgiColWidth = _React$useState4[0],
149
+ setTgiColWidth = _React$useState4[1];
150
+ var tgiColWidthRef = React.useRef(hideValue ? 0 : valueWidth);
151
+ var _React$useState5 = React.useState('rate'),
152
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
153
+ sortField = _React$useState6[0],
154
+ setSortField = _React$useState6[1];
155
+ var _React$useState7 = React.useState('desc'),
156
+ _React$useState8 = _slicedToArray(_React$useState7, 2),
157
+ sortOrder = _React$useState8[0],
158
+ setSortOrder = _React$useState8[1];
159
+ var _React$useState9 = React.useState(null),
160
+ _React$useState10 = _slicedToArray(_React$useState9, 2),
161
+ popoverState = _React$useState10[0],
162
+ setPopoverState = _React$useState10[1];
163
+ var popoverTimerRef = React.useRef(0);
164
+ var measureTgiColWidth = React.useCallback(function () {
165
+ if (hideValue) {
166
+ if (tgiColWidthRef.current !== 0) {
167
+ tgiColWidthRef.current = 0;
168
+ setTgiColWidth(0);
169
+ }
170
+ return;
171
+ }
172
+ var container = rootRef.current;
173
+ if (!container) return;
174
+ var elements = container.querySelectorAll('[data-tgi-col]');
175
+ var maxWidth = valueWidth;
176
+ elements.forEach(function (el) {
177
+ var width = el.getBoundingClientRect().width;
178
+ if (width > maxWidth) maxWidth = width;
179
+ });
180
+ maxWidth = Math.min(TGI_COL_MAX, Math.ceil(maxWidth));
181
+ if (maxWidth !== tgiColWidthRef.current) {
182
+ tgiColWidthRef.current = maxWidth;
183
+ setTgiColWidth(maxWidth);
184
+ }
185
+ }, [hideValue, valueWidth]);
186
+ React.useLayoutEffect(function () {
187
+ requestAnimationFrame(measureTgiColWidth);
188
+ }, [data, measureTgiColWidth]);
189
+ var chartAreaRef = React.useCallback(function (node) {
190
+ var _chartAreaObserverRef;
191
+ (_chartAreaObserverRef = chartAreaObserverRef.current) === null || _chartAreaObserverRef === void 0 || _chartAreaObserverRef.disconnect();
192
+ chartAreaObserverRef.current = null;
193
+ if (!node) return;
194
+ var observer = new ResizeObserver(function (entries) {
195
+ var _entries$0$contentRec, _entries$;
196
+ var width = Math.round((_entries$0$contentRec = (_entries$ = entries[0]) === null || _entries$ === void 0 ? void 0 : _entries$.contentRect.width) !== null && _entries$0$contentRec !== void 0 ? _entries$0$contentRec : 0);
197
+ setChartWidth(function (prev) {
198
+ return prev === width ? prev : width;
199
+ });
200
+ });
201
+ observer.observe(node);
202
+ chartAreaObserverRef.current = observer;
203
+ setChartWidth(Math.round(node.getBoundingClientRect().width));
204
+ }, []);
205
+ React.useEffect(function () {
206
+ return function () {
207
+ var _chartAreaObserverRef2;
208
+ (_chartAreaObserverRef2 = chartAreaObserverRef.current) === null || _chartAreaObserverRef2 === void 0 || _chartAreaObserverRef2.disconnect();
209
+ window.clearTimeout(popoverTimerRef.current);
210
+ };
211
+ }, []);
212
+ var hideSharedPopover = React.useCallback(function () {
213
+ window.clearTimeout(popoverTimerRef.current);
214
+ setPopoverState(null);
215
+ }, []);
216
+ React.useEffect(function () {
217
+ if (!popoverState) return undefined;
218
+ var onScroll = function onScroll() {
219
+ return hideSharedPopover();
220
+ };
221
+ window.addEventListener('scroll', onScroll, true);
222
+ return function () {
223
+ return window.removeEventListener('scroll', onScroll, true);
224
+ };
225
+ }, [hideSharedPopover, popoverState]);
226
+ var onRowAreaMouseEnter = React.useCallback(function (item, area, target) {
227
+ window.clearTimeout(popoverTimerRef.current);
228
+ var offset = getPopoverOffset(area, target);
229
+ setPopoverState(function (prev) {
230
+ return {
231
+ item: item,
232
+ area: area,
233
+ offset: offset,
234
+ animate: !!prev && prev.area === area
235
+ };
236
+ });
237
+ }, []);
238
+ var onRowAreaMouseLeave = React.useCallback(function () {
239
+ window.clearTimeout(popoverTimerRef.current);
240
+ popoverTimerRef.current = window.setTimeout(function () {
241
+ setPopoverState(null);
242
+ }, SHARED_POPOVER_HIDE_DELAY);
243
+ }, []);
244
+ var rows = React.useMemo(function () {
245
+ var next = _toConsumableArray(data);
246
+ if (!sortField || !sortOrder) return next;
247
+ var dir = sortOrder === 'asc' ? 1 : -1;
248
+ next.sort(function (a, b) {
249
+ var _b$bench, _a$bench;
250
+ if (sortField === 'value') {
251
+ var _diff = (a.value - b.value) * dir;
252
+ return _diff !== 0 ? _diff : b.rate - a.rate;
253
+ }
254
+ var diff = (a.rate - b.rate) * dir;
255
+ return diff !== 0 ? diff : ((_b$bench = b.bench) !== null && _b$bench !== void 0 ? _b$bench : 0) - ((_a$bench = a.bench) !== null && _a$bench !== void 0 ? _a$bench : 0);
256
+ });
257
+ return next;
258
+ }, [data, sortField, sortOrder]);
259
+ var maxRate = getMaxRate(data);
260
+ var tickBase = getTickBase(maxRate);
261
+ var axisMax = Math.min(Math.max(Math.ceil(maxRate / tickBase) * tickBase, tickBase), 100);
262
+ var step = axisMax / (TICK_COUNT - 1);
263
+ var axisLabels = Array.from({
264
+ length: TICK_COUNT
265
+ }, function (_, index) {
266
+ return formatAxisLabel(index * step);
267
+ });
268
+ var onSort = function onSort(field) {
269
+ hideSharedPopover();
270
+ if (sortField === field) {
271
+ if (sortOrder === 'desc') setSortOrder('asc');else if (sortOrder === 'asc') {
272
+ setSortField(null);
273
+ setSortOrder('');
274
+ } else setSortOrder('desc');
275
+ } else {
276
+ setSortField(field);
277
+ setSortOrder('desc');
278
+ }
279
+ };
280
+ var popupOf = function popupOf(item) {
281
+ return /*#__PURE__*/React.createElement("div", {
282
+ "data-odn-chart-bullet-popup": true
283
+ }, /*#__PURE__*/React.createElement("div", {
284
+ "data-odn-chart-bullet-popup-title": true
285
+ }, item.name), /*#__PURE__*/React.createElement("div", {
286
+ "data-odn-chart-bullet-popup-divider": true
287
+ }), /*#__PURE__*/React.createElement("div", {
288
+ "data-odn-chart-bullet-popup-list": true
289
+ }, /*#__PURE__*/React.createElement("div", {
290
+ "data-odn-chart-bullet-popup-row": true
291
+ }, /*#__PURE__*/React.createElement("span", null, rateLabel), /*#__PURE__*/React.createElement("span", {
292
+ "data-odn-chart-bullet-popup-value": true
293
+ }, formatPercentage(item.rate))), item.bench !== undefined && benchLabel ? /*#__PURE__*/React.createElement("div", {
294
+ "data-odn-chart-bullet-popup-row": true
295
+ }, /*#__PURE__*/React.createElement("span", null, benchLabel), /*#__PURE__*/React.createElement("span", {
296
+ "data-odn-chart-bullet-popup-value": true
297
+ }, formatPercentage(item.bench))) : null, hideValue ? null : /*#__PURE__*/React.createElement("div", {
298
+ "data-odn-chart-bullet-popup-row": true
299
+ }, /*#__PURE__*/React.createElement("span", null, valueLabel), /*#__PURE__*/React.createElement("span", {
300
+ "data-odn-chart-bullet-popup-value": true
301
+ }, formatValue(item.value)))));
302
+ };
303
+ var popupPlacement = (popoverState === null || popoverState === void 0 ? void 0 : popoverState.area) === 'left' ? 'right' : 'left';
304
+ return /*#__PURE__*/React.createElement("div", _extends({
305
+ ref: rootRef,
306
+ "data-odn-chart": true,
307
+ "data-odn-chart-kind": "bullet",
308
+ "data-hide-value": hideValue ? '' : undefined,
309
+ className: clsx(className),
310
+ style: _objectSpread(_objectSpread({}, style), {}, {
311
+ '--name-col-width': "".concat(nameWidth, "px"),
312
+ '--tgi-col-width': "".concat(tgiColWidth, "px")
313
+ })
314
+ }, rest), data.length === 0 ? /*#__PURE__*/React.createElement("div", {
315
+ "data-odn-chart-empty": true
316
+ }, /*#__PURE__*/React.createElement(Empty, {
317
+ type: "data",
318
+ size: "small",
319
+ title: "\u6682\u65E0\u6570\u636E"
320
+ })) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
321
+ "data-odn-chart-bullet-topbar": true,
322
+ "data-border": hideTopBarBorder ? undefined : ''
323
+ }, /*#__PURE__*/React.createElement("div", {
324
+ "data-odn-chart-bullet-legend": true
325
+ }, /*#__PURE__*/React.createElement("span", {
326
+ "data-odn-chart-bullet-legend-item": true
327
+ }, /*#__PURE__*/React.createElement("i", {
328
+ "data-odn-chart-bullet-legend-bar": true
329
+ }), /*#__PURE__*/React.createElement("span", null, rateLabel)), benchLabel ? /*#__PURE__*/React.createElement("span", {
330
+ "data-odn-chart-bullet-legend-item": true
331
+ }, /*#__PURE__*/React.createElement("i", {
332
+ "data-odn-chart-bullet-legend-line": true
333
+ }), /*#__PURE__*/React.createElement("span", null, benchLabel)) : null)), /*#__PURE__*/React.createElement("div", {
334
+ "data-odn-chart-bullet-header": true
335
+ }, /*#__PURE__*/React.createElement("div", {
336
+ "data-odn-chart-bullet-header-name": true
337
+ }, nameLabel), hideValue ? null : /*#__PURE__*/React.createElement("button", {
338
+ type: "button",
339
+ "data-odn-chart-bullet-header-value": true,
340
+ "data-tgi-col": "",
341
+ onClick: function onClick() {
342
+ return onSort('value');
343
+ }
344
+ }, valueLabel, /*#__PURE__*/React.createElement(SortCarets, {
345
+ order: sortField === 'value' ? sortOrder : ''
346
+ })), /*#__PURE__*/React.createElement("button", {
347
+ type: "button",
348
+ "data-odn-chart-bullet-header-chart": true,
349
+ onClick: function onClick() {
350
+ return onSort('rate');
351
+ }
352
+ }, rateLabel, /*#__PURE__*/React.createElement(SortCarets, {
353
+ order: sortField === 'rate' ? sortOrder : ''
354
+ }))), /*#__PURE__*/React.createElement("div", {
355
+ "data-odn-chart-bullet-body": true,
356
+ style: maxBodyHeight !== undefined ? {
357
+ maxHeight: maxBodyHeight,
358
+ overflowY: 'auto',
359
+ flex: '0 1 auto'
360
+ } : undefined,
361
+ onScroll: hideSharedPopover
362
+ }, /*#__PURE__*/React.createElement("div", {
363
+ "data-odn-chart-bullet-body-inner": true,
364
+ ref: bodyInnerRef
365
+ }, /*#__PURE__*/React.createElement("div", {
366
+ ref: chartAreaRef,
367
+ "data-odn-chart-bullet-grid": true,
368
+ style: {
369
+ left: nameWidth + tgiColWidth
370
+ }
371
+ }, axisLabels.map(function (_, index) {
372
+ return /*#__PURE__*/React.createElement("i", {
373
+ key: index,
374
+ "data-odn-chart-bullet-grid-line": true,
375
+ style: {
376
+ left: Math.round(index / (TICK_COUNT - 1) * chartWidth)
377
+ }
378
+ });
379
+ })), rows.map(function (item) {
380
+ var barWidth = axisMax > 0 ? Math.round(item.rate / axisMax * chartWidth) : 0;
381
+ var benchLeft = item.bench !== undefined && axisMax > 0 ? Math.round(item.bench / axisMax * chartWidth) : undefined;
382
+ return /*#__PURE__*/React.createElement(HoverFill, {
383
+ key: item.name
384
+ }, /*#__PURE__*/React.createElement("div", {
385
+ "data-odn-chart-bullet-row": true
386
+ }, /*#__PURE__*/React.createElement("div", {
387
+ "data-odn-chart-bullet-left": true,
388
+ onMouseEnter: function onMouseEnter(event) {
389
+ return onRowAreaMouseEnter(item, 'left', event.currentTarget);
390
+ },
391
+ onMouseLeave: onRowAreaMouseLeave
392
+ }, /*#__PURE__*/React.createElement("div", {
393
+ "data-odn-chart-bullet-name": true,
394
+ title: item.name
395
+ }, item.name), hideValue ? null : /*#__PURE__*/React.createElement("div", {
396
+ "data-odn-chart-bullet-value": true,
397
+ "data-tgi-col": "",
398
+ title: formatValue(item.value)
399
+ }, formatValue(item.value))), /*#__PURE__*/React.createElement("div", {
400
+ "data-odn-chart-bullet-chart": true,
401
+ onMouseEnter: function onMouseEnter(event) {
402
+ return onRowAreaMouseEnter(item, 'chart', event.currentTarget);
403
+ },
404
+ onMouseLeave: onRowAreaMouseLeave
405
+ }, /*#__PURE__*/React.createElement("div", {
406
+ "data-odn-chart-bullet-track": true
407
+ }, /*#__PURE__*/React.createElement("i", {
408
+ "data-odn-chart-bullet-bar": true,
409
+ style: {
410
+ width: barWidth
411
+ }
412
+ }), benchLeft !== undefined ? /*#__PURE__*/React.createElement("i", {
413
+ "data-odn-chart-bullet-bench": true,
414
+ style: {
415
+ left: benchLeft
416
+ }
417
+ }) : null))));
418
+ }), popoverState ? /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement("div", {
419
+ "data-odn-popup": true,
420
+ "data-type": "popover",
421
+ "data-arrowed": "false",
422
+ "data-status": "open",
423
+ "data-odn-popup-no-transition": "",
424
+ "data-placement": popupPlacement,
425
+ style: getPopoverRootStyle(popoverState, popoverState.area)
426
+ }, /*#__PURE__*/React.createElement("div", {
427
+ "data-odn-popup-content": true,
428
+ "data-arrowed": "false",
429
+ "data-status": "open",
430
+ "data-odn-popup-no-transition": "",
431
+ "data-placement": popupPlacement,
432
+ style: {
433
+ maxWidth: 'initial'
434
+ }
435
+ }, popupOf(popoverState.item))), document.body) : null)), /*#__PURE__*/React.createElement("div", {
436
+ "data-odn-chart-bullet-axis-wrap": true,
437
+ style: {
438
+ paddingLeft: nameWidth + tgiColWidth
439
+ }
440
+ }, hideAxisLabel ? null : /*#__PURE__*/React.createElement("span", {
441
+ "data-odn-chart-bullet-axis-label": true
442
+ }, rateLabel), /*#__PURE__*/React.createElement("div", {
443
+ "data-odn-chart-bullet-axis": true
444
+ }, axisLabels.map(function (label, index) {
445
+ return /*#__PURE__*/React.createElement("span", {
446
+ key: "".concat(label, "-").concat(index),
447
+ "data-odn-chart-bullet-tick": true,
448
+ style: {
449
+ left: Math.round(index / (TICK_COUNT - 1) * chartWidth)
450
+ }
451
+ }, label);
452
+ })))));
453
+ };
454
+ ChartBullet.displayName = 'Chart.Bullet';
455
+ export default ChartBullet;
@@ -0,0 +1,15 @@
1
+ import type { EChartsOption } from 'echarts';
2
+ import * as React from 'react';
3
+ import { type ChartHostProps } from './host';
4
+ export interface ChartButterflyProps extends Omit<ChartHostProps, 'option'> {
5
+ categories: string[];
6
+ leftValues: number[];
7
+ rightValues: number[];
8
+ leftLabel?: string;
9
+ rightLabel?: string;
10
+ leftReferenceValue?: number;
11
+ leftReferenceLabel?: string;
12
+ option?: EChartsOption;
13
+ }
14
+ declare const ChartButterfly: React.FC<ChartButterflyProps>;
15
+ export default ChartButterfly;