@expcat/tigercat-react 2.1.0 → 2.1.2
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/{chunk-RUAPTIQ7.mjs → chunk-246DAUEF.mjs} +2 -2
- package/dist/{chunk-PU3JY6RE.mjs → chunk-2JMI7TCM.mjs} +1 -1
- package/dist/{chunk-GCY55TBC.mjs → chunk-2XZHYYZ2.mjs} +106 -91
- package/dist/chunk-2YBLMVDT.mjs +428 -0
- package/dist/{chunk-25D5TXZH.mjs → chunk-32MCQMBJ.mjs} +8 -6
- package/dist/{chunk-6MGQAJ62.mjs → chunk-3GPGSNOQ.mjs} +71 -16
- package/dist/{chunk-M5MZWOHF.mjs → chunk-3HHEVMHE.mjs} +1 -1
- package/dist/{chunk-HSBN5MLS.mjs → chunk-3LACOSJQ.mjs} +1 -1
- package/dist/{chunk-F6WV53BS.mjs → chunk-3LDDXHW2.mjs} +28 -11
- package/dist/{chunk-IXQAECFP.mjs → chunk-3QNIFKVF.mjs} +12 -14
- package/dist/{chunk-UD4DTVJZ.mjs → chunk-4C2X5PZO.mjs} +57 -25
- package/dist/chunk-5JETWHLJ.mjs +28 -0
- package/dist/{chunk-VA6PZWOH.mjs → chunk-5SEMRHBD.mjs} +14 -6
- package/dist/{chunk-MXXAJSRS.mjs → chunk-6RMBUZZE.mjs} +11 -11
- package/dist/{chunk-EKILTLUO.mjs → chunk-72CJNKDY.mjs} +1 -1
- package/dist/{chunk-XE4YFBOZ.mjs → chunk-AUD3VOLO.mjs} +1 -1
- package/dist/{chunk-I4MWOYJS.mjs → chunk-AYFKHWJS.mjs} +13 -7
- package/dist/{chunk-RPSHILHD.mjs → chunk-BXAH2GH3.mjs} +8 -2
- package/dist/{chunk-EW5EO7VE.mjs → chunk-BYD7EAWK.mjs} +1 -1
- package/dist/{chunk-L55UK45A.mjs → chunk-CRIEUKMD.mjs} +5 -2
- package/dist/{chunk-DKNVSQSV.mjs → chunk-CUAXRBKO.mjs} +12 -0
- package/dist/{chunk-NWVNTZOP.mjs → chunk-DECUASRW.mjs} +14 -16
- package/dist/{chunk-XMTEMBQV.mjs → chunk-EAAWB3CK.mjs} +16 -13
- package/dist/{chunk-IR7VA6AO.mjs → chunk-EG7EMDKK.mjs} +1 -1
- package/dist/{chunk-HOYBHB7B.mjs → chunk-FNK2VWPP.mjs} +1 -1
- package/dist/{chunk-RJPNBYK5.mjs → chunk-FQS24AUH.mjs} +12 -3
- package/dist/{chunk-LADKKOJT.mjs → chunk-GBEDWXLL.mjs} +16 -10
- package/dist/{chunk-2ENQZECC.mjs → chunk-HAXRHSCN.mjs} +4 -3
- package/dist/{chunk-K4GIKSZE.mjs → chunk-I2BENK5X.mjs} +2 -1
- package/dist/{chunk-DNOPEJ5I.mjs → chunk-JZZPLKTW.mjs} +7 -4
- package/dist/{chunk-7KCQMXJA.mjs → chunk-KDURW5AS.mjs} +4 -3
- package/dist/{chunk-TFMEHUVZ.mjs → chunk-KKN7KLTB.mjs} +0 -1
- package/dist/{chunk-PFL4HNWM.mjs → chunk-M6ZPTGBV.mjs} +1 -2
- package/dist/{chunk-PXRZ6CKY.mjs → chunk-MJVSZ2UJ.mjs} +46 -16
- package/dist/{chunk-LZKBDQE4.mjs → chunk-MYI3FPG4.mjs} +23 -4
- package/dist/{chunk-OIGEBCAS.mjs → chunk-NADODEZX.mjs} +69 -1
- package/dist/{chunk-UKY2EPS3.mjs → chunk-NJWTZ5MO.mjs} +54 -42
- package/dist/{chunk-ASLRAZZN.mjs → chunk-NXJMVH26.mjs} +5 -2
- package/dist/{chunk-773LH7BK.mjs → chunk-O6VYD4E4.mjs} +24 -2
- package/dist/{chunk-G7D4QV7A.mjs → chunk-O7TV5OKS.mjs} +33 -6
- package/dist/{chunk-DPWRXXXW.mjs → chunk-OJ6SHHOZ.mjs} +3 -3
- package/dist/{chunk-UYJJLHVA.mjs → chunk-PMQJ6AYT.mjs} +23 -21
- package/dist/{chunk-KC55B62J.mjs → chunk-PY2VUNEJ.mjs} +143 -46
- package/dist/{chunk-BEJZPJIK.mjs → chunk-QOAOOD53.mjs} +10 -4
- package/dist/{chunk-JQJM65RJ.mjs → chunk-QU3QXUTC.mjs} +49 -23
- package/dist/{chunk-RQ4PUK6G.mjs → chunk-R7YZ6FKP.mjs} +24 -13
- package/dist/{chunk-YI6YWH66.mjs → chunk-RE5ZLA5D.mjs} +6 -6
- package/dist/{chunk-UCBW5RJN.mjs → chunk-RGVU4EMA.mjs} +11 -6
- package/dist/{chunk-IBSOUQGB.mjs → chunk-RRGPDFDI.mjs} +7 -4
- package/dist/{chunk-ZH5ZBLAN.mjs → chunk-RUQ3F3MV.mjs} +34 -7
- package/dist/{chunk-KVCI2346.mjs → chunk-S2V3HGLZ.mjs} +8 -7
- package/dist/{chunk-PGD5RPKF.mjs → chunk-SVIJ2UZA.mjs} +2 -1
- package/dist/{chunk-UETARXIK.mjs → chunk-SXWEFZOF.mjs} +246 -53
- package/dist/{chunk-H6MVW5YD.mjs → chunk-TEVEXDY2.mjs} +24 -13
- package/dist/{chunk-DJOFM2VO.mjs → chunk-TO6MZFNQ.mjs} +52 -40
- package/dist/{chunk-ZCGIZOMT.mjs → chunk-V7HJ5HLC.mjs} +6 -10
- package/dist/{chunk-SIDDYP3O.mjs → chunk-VJWSKJLJ.mjs} +1 -1
- package/dist/{chunk-ZG56T75O.mjs → chunk-WTHWLCRL.mjs} +51 -11
- package/dist/{chunk-KP6DEYWB.mjs → chunk-X4L3W7RQ.mjs} +1 -1
- package/dist/{chunk-ZMRTETN2.mjs → chunk-X6C6MNG5.mjs} +4 -3
- package/dist/{chunk-OGG2TQDG.mjs → chunk-XVHTJQ4T.mjs} +12 -1
- package/dist/{chunk-FSMJLJFL.mjs → chunk-Y6UH3EKE.mjs} +1 -1
- package/dist/{chunk-7EMCZVJ2.mjs → chunk-YH7FKFRM.mjs} +4 -4
- package/dist/chunk-YJ5T4XZN.mjs +81 -0
- package/dist/{chunk-VVNFXJMN.mjs → chunk-YNDPQVEK.mjs} +8 -1
- package/dist/{chunk-QGZ32NFQ.mjs → chunk-Z23KOLNU.mjs} +4 -3
- package/dist/{chunk-5CKMYMTS.mjs → chunk-ZATZRXMW.mjs} +27 -8
- package/dist/components/ActivityFeed.mjs +2 -2
- package/dist/components/Affix.mjs +1 -1
- package/dist/components/Anchor.mjs +1 -1
- package/dist/components/AreaChart.mjs +4 -3
- package/dist/components/AutoComplete.mjs +1 -1
- package/dist/components/BarChart.mjs +4 -3
- package/dist/components/Calendar.mjs +1 -1
- package/dist/components/Cascader.mjs +1 -1
- package/dist/components/ChartCanvas.mjs +1 -1
- package/dist/components/ChatWindow.mjs +3 -3
- package/dist/components/Code.mjs +3 -1
- package/dist/components/CollapsePanel.mjs +1 -1
- package/dist/components/ColorPicker.d.mts +3 -1
- package/dist/components/ColorPicker.mjs +3 -1
- package/dist/components/CommentThread.mjs +2 -2
- package/dist/components/DataExport.mjs +2 -2
- package/dist/components/DataTableWithToolbar.mjs +7 -7
- package/dist/components/DonutChart.mjs +4 -4
- package/dist/components/Dropdown.mjs +1 -1
- package/dist/components/FileManager.mjs +2 -1
- package/dist/components/FloatButton.mjs +1 -1
- package/dist/components/FormItem.mjs +1 -1
- package/dist/components/FormWizard.mjs +1 -1
- package/dist/components/FunnelChart.mjs +3 -3
- package/dist/components/Gantt.d.mts +3 -1
- package/dist/components/Gantt.mjs +2 -2
- package/dist/components/GaugeChart.mjs +2 -2
- package/dist/components/HeatmapChart.mjs +3 -3
- package/dist/components/Image.mjs +4 -4
- package/dist/components/ImageGroup.mjs +2 -2
- package/dist/components/ImagePreview.mjs +1 -1
- package/dist/components/Input.mjs +1 -1
- package/dist/components/InputNumber.d.mts +1 -1
- package/dist/components/InputNumber.mjs +1 -1
- package/dist/components/Kanban.mjs +2 -2
- package/dist/components/LineChart.mjs +4 -3
- package/dist/components/List.mjs +2 -2
- package/dist/components/Loading.mjs +1 -1
- package/dist/components/MarkdownEditor.mjs +1 -1
- package/dist/components/MaskInput.mjs +1 -1
- package/dist/components/NotificationCenter.mjs +4 -4
- package/dist/components/OrgChart.mjs +2 -2
- package/dist/components/Pagination.mjs +1 -1
- package/dist/components/PieChart.mjs +3 -3
- package/dist/components/Popconfirm.mjs +2 -2
- package/dist/components/Popover.mjs +2 -2
- package/dist/components/QRCode.d.mts +2 -2
- package/dist/components/QRCode.mjs +1 -1
- package/dist/components/RadarChart.mjs +3 -3
- package/dist/components/Rate.mjs +1 -1
- package/dist/components/RichTextEditor.mjs +1 -1
- package/dist/components/ScatterChart.mjs +4 -3
- package/dist/components/ScrollSpy.mjs +1 -1
- package/dist/components/Select.mjs +1 -1
- package/dist/components/Signature.mjs +1 -1
- package/dist/components/SplitButton.mjs +2 -2
- package/dist/components/Splitter.mjs +1 -1
- package/dist/components/Stepper.d.mts +2 -0
- package/dist/components/Stepper.mjs +2 -1
- package/dist/components/SunburstChart.mjs +3 -3
- package/dist/components/Switch.d.mts +5 -1
- package/dist/components/Switch.mjs +2 -1
- package/dist/components/Table.mjs +3 -3
- package/dist/components/TaskBoard.mjs +1 -1
- package/dist/components/Textarea.mjs +1 -1
- package/dist/components/Tooltip.mjs +2 -2
- package/dist/components/Tour.mjs +1 -1
- package/dist/components/TreeMapChart.mjs +3 -3
- package/dist/components/TreeSelect.mjs +1 -1
- package/dist/components/Upload.mjs +1 -1
- package/dist/hooks/useChartInteraction.d.mts +5 -0
- package/dist/hooks/useChartInteraction.mjs +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +57 -0
- package/package.json +2 -2
- package/dist/chunk-CB4SK5AU.mjs +0 -235
- package/dist/chunk-KPACLRQH.mjs +0 -55
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useResponsiveChartSize
|
|
3
|
+
} from "./chunk-5JETWHLJ.mjs";
|
|
1
4
|
import {
|
|
2
5
|
useChartInteraction
|
|
3
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-JZZPLKTW.mjs";
|
|
4
7
|
import {
|
|
5
8
|
ChartSeries
|
|
6
9
|
} from "./chunk-SDLMB34Y.mjs";
|
|
@@ -12,7 +15,7 @@ import {
|
|
|
12
15
|
} from "./chunk-RQSQXQN6.mjs";
|
|
13
16
|
import {
|
|
14
17
|
ChartCanvas
|
|
15
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-CUAXRBKO.mjs";
|
|
16
19
|
import {
|
|
17
20
|
ChartGrid
|
|
18
21
|
} from "./chunk-677VSTPW.mjs";
|
|
@@ -29,7 +32,6 @@ import {
|
|
|
29
32
|
createLinePath,
|
|
30
33
|
createPointScale,
|
|
31
34
|
getChartElementOpacity,
|
|
32
|
-
getChartInnerRect,
|
|
33
35
|
getStableChartGradientPrefix,
|
|
34
36
|
getNumberExtent,
|
|
35
37
|
linePointTransitionClasses,
|
|
@@ -109,9 +111,11 @@ var LineChart = ({
|
|
|
109
111
|
() => getStableChartGradientPrefix("line", gradientId),
|
|
110
112
|
[gradientId]
|
|
111
113
|
);
|
|
112
|
-
const innerRect =
|
|
113
|
-
|
|
114
|
-
|
|
114
|
+
const { innerRect, onResolvedSizeChange } = useResponsiveChartSize(
|
|
115
|
+
width,
|
|
116
|
+
height,
|
|
117
|
+
padding,
|
|
118
|
+
responsive
|
|
115
119
|
);
|
|
116
120
|
const resolvedSeries = useMemo(
|
|
117
121
|
() => resolveSeriesData(series, data, {
|
|
@@ -133,6 +137,7 @@ var LineChart = ({
|
|
|
133
137
|
wrapperClasses
|
|
134
138
|
} = useChartInteraction({
|
|
135
139
|
hoverable,
|
|
140
|
+
showTooltip,
|
|
136
141
|
hoveredIndexProp,
|
|
137
142
|
selectable,
|
|
138
143
|
selectedIndexProp,
|
|
@@ -255,17 +260,21 @@ var LineChart = ({
|
|
|
255
260
|
(seriesIndex, pointIndex, event) => {
|
|
256
261
|
setHoveredPointInfo({ seriesIndex, pointIndex });
|
|
257
262
|
setTooltipPosition({ x: event.clientX, y: event.clientY });
|
|
258
|
-
|
|
263
|
+
if (hoverable) {
|
|
264
|
+
onPointHover?.(seriesIndex, pointIndex, resolvedSeries[seriesIndex]?.data[pointIndex]);
|
|
265
|
+
}
|
|
259
266
|
},
|
|
260
|
-
[onPointHover, resolvedSeries]
|
|
267
|
+
[hoverable, onPointHover, resolvedSeries]
|
|
261
268
|
);
|
|
262
269
|
const handlePointMouseMove = useCallback((event) => {
|
|
263
270
|
setTooltipPosition({ x: event.clientX, y: event.clientY });
|
|
264
271
|
}, []);
|
|
265
272
|
const handlePointMouseLeave = useCallback(() => {
|
|
266
273
|
setHoveredPointInfo(null);
|
|
267
|
-
|
|
268
|
-
|
|
274
|
+
if (hoverable) {
|
|
275
|
+
onPointHover?.(null, null, null);
|
|
276
|
+
}
|
|
277
|
+
}, [hoverable, onPointHover]);
|
|
269
278
|
const showPointTooltipFromElement = useCallback(
|
|
270
279
|
(el, seriesIndex, pointIndex) => {
|
|
271
280
|
if (!hoverable) return;
|
|
@@ -293,6 +302,7 @@ var LineChart = ({
|
|
|
293
302
|
[selectable, handleSeriesSelect]
|
|
294
303
|
);
|
|
295
304
|
const pointClickable = selectable || !!onPointClick;
|
|
305
|
+
const trackPointHover = showTooltip || hoverable;
|
|
296
306
|
const chart = /* @__PURE__ */ jsxs(
|
|
297
307
|
ChartCanvas,
|
|
298
308
|
{
|
|
@@ -303,6 +313,7 @@ var LineChart = ({
|
|
|
303
313
|
title,
|
|
304
314
|
desc,
|
|
305
315
|
className: classNames(className),
|
|
316
|
+
onResolvedSizeChange,
|
|
306
317
|
children: [
|
|
307
318
|
(seriesData.some((sd) => sd.showArea) || animated || strokeGradient || pointGradient) && /* @__PURE__ */ jsxs("defs", { children: [
|
|
308
319
|
animated && /* @__PURE__ */ jsx("style", { children: `
|
|
@@ -477,9 +488,9 @@ var LineChart = ({
|
|
|
477
488
|
tabIndex: pointInteractive ? 0 : void 0,
|
|
478
489
|
"data-point-index": point.pointIndex,
|
|
479
490
|
"data-series-key": sd.seriesKey,
|
|
480
|
-
onMouseEnter:
|
|
481
|
-
onMouseMove:
|
|
482
|
-
onMouseLeave:
|
|
491
|
+
onMouseEnter: trackPointHover ? (e) => handlePointMouseEnter(sd.seriesIndex, point.pointIndex, e) : void 0,
|
|
492
|
+
onMouseMove: trackPointHover ? handlePointMouseMove : void 0,
|
|
493
|
+
onMouseLeave: trackPointHover ? handlePointMouseLeave : void 0,
|
|
483
494
|
onClick: pointClickable ? (e) => {
|
|
484
495
|
e.stopPropagation();
|
|
485
496
|
handlePointClick(sd.seriesIndex, point.pointIndex);
|
|
@@ -4,9 +4,11 @@ import {
|
|
|
4
4
|
classNames,
|
|
5
5
|
getSplitterContainerClasses,
|
|
6
6
|
getSplitterGutterClasses,
|
|
7
|
+
getSplitterGutterCssVars,
|
|
7
8
|
getSplitterGutterHandleClasses,
|
|
8
9
|
getPaneStyle,
|
|
9
10
|
resizePanes,
|
|
11
|
+
resolveInitialPaneSizes,
|
|
10
12
|
createDocumentDragSession
|
|
11
13
|
} from "@expcat/tigercat-core";
|
|
12
14
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -37,20 +39,21 @@ var Splitter = ({
|
|
|
37
39
|
useEffect(() => cleanupDragSession, [cleanupDragSession]);
|
|
38
40
|
useEffect(() => {
|
|
39
41
|
const el = containerRef.current;
|
|
40
|
-
if (!el) return;
|
|
41
42
|
const paneCount2 = React.Children.count(children);
|
|
42
43
|
if (paneCount2 === 0) return;
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
44
|
+
const containerSize = el ? direction === "horizontal" ? el.clientWidth : el.clientHeight : 0;
|
|
45
|
+
const resolved = resolveInitialPaneSizes(
|
|
46
|
+
paneCount2,
|
|
47
|
+
containerSize,
|
|
48
|
+
gutterSize,
|
|
49
|
+
controlledSizes,
|
|
50
|
+
min,
|
|
51
|
+
max
|
|
52
|
+
);
|
|
53
|
+
if (resolved) {
|
|
54
|
+
setPaneSizes(resolved);
|
|
52
55
|
}
|
|
53
|
-
}, [children, direction, gutterSize, controlledSizes]);
|
|
56
|
+
}, [children, direction, gutterSize, controlledSizes, min, max]);
|
|
54
57
|
const paneCount = paneSizes.length;
|
|
55
58
|
const mins = useMemo(() => Array.from({ length: paneCount }, () => min), [paneCount, min]);
|
|
56
59
|
const maxes = useMemo(() => Array.from({ length: paneCount }, () => max), [paneCount, max]);
|
|
@@ -136,35 +139,44 @@ var Splitter = ({
|
|
|
136
139
|
() => classNames(getSplitterContainerClasses(direction, className)),
|
|
137
140
|
[direction, className]
|
|
138
141
|
);
|
|
139
|
-
return /* @__PURE__ */ jsx(
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
142
|
+
return /* @__PURE__ */ jsx(
|
|
143
|
+
"div",
|
|
144
|
+
{
|
|
145
|
+
ref: containerRef,
|
|
146
|
+
className: containerClasses,
|
|
147
|
+
style: { ...style, ...getSplitterGutterCssVars(gutterSize) },
|
|
148
|
+
"data-direction": direction,
|
|
149
|
+
children: childArray.map((child, i) => {
|
|
150
|
+
const size = paneSizes[i];
|
|
151
|
+
const paneStyle = size != null ? getPaneStyle(size, direction) : void 0;
|
|
152
|
+
const isDragging = draggingIndex === i;
|
|
153
|
+
return /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
154
|
+
/* @__PURE__ */ jsx(
|
|
155
|
+
"div",
|
|
156
|
+
{
|
|
157
|
+
className: "tiger-splitter-pane relative overflow-auto",
|
|
158
|
+
style: paneStyle,
|
|
159
|
+
"data-pane-index": i,
|
|
160
|
+
children: child
|
|
161
|
+
}
|
|
162
|
+
),
|
|
163
|
+
i < childArray.length - 1 && /* @__PURE__ */ jsx(
|
|
164
|
+
"div",
|
|
165
|
+
{
|
|
166
|
+
className: getSplitterGutterClasses(direction, !!isDragging, disabled),
|
|
167
|
+
role: "separator",
|
|
168
|
+
"aria-orientation": direction === "horizontal" ? "vertical" : "horizontal",
|
|
169
|
+
tabIndex: disabled ? -1 : 0,
|
|
170
|
+
"data-gutter-index": i,
|
|
171
|
+
onMouseDown: (e) => handleMouseDown(i, e),
|
|
172
|
+
onKeyDown: (e) => handleKeyDown(i, e),
|
|
173
|
+
children: /* @__PURE__ */ jsx("div", { className: getSplitterGutterHandleClasses(direction) })
|
|
174
|
+
}
|
|
175
|
+
)
|
|
176
|
+
] }, i);
|
|
177
|
+
})
|
|
178
|
+
}
|
|
179
|
+
);
|
|
168
180
|
};
|
|
169
181
|
var Splitter_default = Splitter;
|
|
170
182
|
|
|
@@ -275,14 +275,11 @@ var ImagePreview = ({
|
|
|
275
275
|
},
|
|
276
276
|
[handleNext, handlePrev, touchSwipeThreshold]
|
|
277
277
|
);
|
|
278
|
-
const handleMaskClick = useCallback(
|
|
279
|
-
(
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
},
|
|
284
|
-
[maskClosable, handleClose]
|
|
285
|
-
);
|
|
278
|
+
const handleMaskClick = useCallback(() => {
|
|
279
|
+
if (maskClosable) {
|
|
280
|
+
handleClose();
|
|
281
|
+
}
|
|
282
|
+
}, [maskClosable, handleClose]);
|
|
286
283
|
const transform = useMemo(
|
|
287
284
|
() => `${calculateTransform(scale, offsetX, offsetY)} rotate(${rotation}deg)`,
|
|
288
285
|
[scale, offsetX, offsetY, rotation]
|
|
@@ -298,10 +295,9 @@ var ImagePreview = ({
|
|
|
298
295
|
role: "dialog",
|
|
299
296
|
"aria-modal": "true",
|
|
300
297
|
"aria-label": labels.previewDialogAriaLabel,
|
|
301
|
-
onClick: handleMaskClick,
|
|
302
298
|
onWheel: handleWheel,
|
|
303
299
|
children: [
|
|
304
|
-
/* @__PURE__ */ jsx("div", { className: imagePreviewMaskClasses, "aria-hidden": "true" }),
|
|
300
|
+
/* @__PURE__ */ jsx("div", { className: imagePreviewMaskClasses, "aria-hidden": "true", onClick: handleMaskClick }),
|
|
305
301
|
/* @__PURE__ */ jsx(
|
|
306
302
|
"img",
|
|
307
303
|
{
|
|
@@ -3,9 +3,10 @@ import {
|
|
|
3
3
|
} from "./chunk-HKAZXG74.mjs";
|
|
4
4
|
|
|
5
5
|
// src/utils/use-popup.ts
|
|
6
|
-
import { useCallback, useMemo, useRef, useState } from "react";
|
|
6
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
7
7
|
import {
|
|
8
8
|
buildTriggerHandlerMap,
|
|
9
|
+
createFloatingHoverDelayController,
|
|
9
10
|
restoreFocus
|
|
10
11
|
} from "@expcat/tigercat-core";
|
|
11
12
|
function usePopup(options) {
|
|
@@ -33,6 +34,18 @@ function usePopup(options) {
|
|
|
33
34
|
},
|
|
34
35
|
[disabled, isControlled, onOpenChange]
|
|
35
36
|
);
|
|
37
|
+
const setVisibleRef = useRef(setVisible);
|
|
38
|
+
setVisibleRef.current = setVisible;
|
|
39
|
+
const hoverControllerRef = useRef(
|
|
40
|
+
null
|
|
41
|
+
);
|
|
42
|
+
if (hoverControllerRef.current === null) {
|
|
43
|
+
hoverControllerRef.current = createFloatingHoverDelayController({
|
|
44
|
+
show: () => setVisibleRef.current(true),
|
|
45
|
+
hide: () => setVisibleRef.current(false)
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
const hoverController = hoverControllerRef.current;
|
|
36
49
|
const restoreTriggerFocus = useCallback(() => {
|
|
37
50
|
const trigger2 = triggerRef.current;
|
|
38
51
|
const target = trigger2?.querySelector(
|
|
@@ -43,19 +56,32 @@ function usePopup(options) {
|
|
|
43
56
|
}, 0);
|
|
44
57
|
}, []);
|
|
45
58
|
const closeAndRestoreFocus = useCallback(() => {
|
|
46
|
-
|
|
59
|
+
hoverController.closeNow();
|
|
47
60
|
restoreTriggerFocus();
|
|
48
|
-
}, [
|
|
61
|
+
}, [hoverController, restoreTriggerFocus]);
|
|
62
|
+
const effectiveTrigger = multiTrigger ? trigger : "click";
|
|
49
63
|
const handleToggle = useCallback(() => {
|
|
50
|
-
if (
|
|
51
|
-
|
|
64
|
+
if (disabled) return;
|
|
65
|
+
hoverController.cancel();
|
|
66
|
+
setVisible(!currentVisible);
|
|
67
|
+
}, [disabled, currentVisible, setVisible, hoverController]);
|
|
52
68
|
const handleShow = useCallback(() => {
|
|
53
|
-
if (
|
|
54
|
-
|
|
69
|
+
if (disabled) return;
|
|
70
|
+
if (effectiveTrigger === "hover") {
|
|
71
|
+
hoverController.enter();
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
hoverController.cancel();
|
|
75
|
+
setVisible(true);
|
|
76
|
+
}, [disabled, effectiveTrigger, setVisible, hoverController]);
|
|
55
77
|
const handleHide = useCallback(() => {
|
|
56
|
-
if (
|
|
57
|
-
|
|
58
|
-
|
|
78
|
+
if (disabled) return;
|
|
79
|
+
if (effectiveTrigger === "hover") {
|
|
80
|
+
hoverController.leave();
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
hoverController.closeNow();
|
|
84
|
+
}, [disabled, effectiveTrigger, hoverController]);
|
|
59
85
|
const overlay = useAnchoredOverlay({
|
|
60
86
|
enabled: currentVisible,
|
|
61
87
|
referenceRef: triggerRef,
|
|
@@ -69,10 +95,24 @@ function usePopup(options) {
|
|
|
69
95
|
if (reason === "escape") {
|
|
70
96
|
closeAndRestoreFocus();
|
|
71
97
|
} else {
|
|
72
|
-
|
|
98
|
+
hoverController.closeNow();
|
|
73
99
|
}
|
|
74
100
|
}
|
|
75
101
|
});
|
|
102
|
+
useEffect(() => {
|
|
103
|
+
if (!multiTrigger || effectiveTrigger !== "hover" || !currentVisible) return;
|
|
104
|
+
const el = floatingRef.current;
|
|
105
|
+
if (!el) return;
|
|
106
|
+
const handleEnter = () => hoverController.enter();
|
|
107
|
+
const handleLeave = () => hoverController.leave();
|
|
108
|
+
el.addEventListener("mouseenter", handleEnter);
|
|
109
|
+
el.addEventListener("mouseleave", handleLeave);
|
|
110
|
+
return () => {
|
|
111
|
+
el.removeEventListener("mouseenter", handleEnter);
|
|
112
|
+
el.removeEventListener("mouseleave", handleLeave);
|
|
113
|
+
};
|
|
114
|
+
}, [multiTrigger, effectiveTrigger, currentVisible, hoverController]);
|
|
115
|
+
useEffect(() => () => hoverController.dispose(), [hoverController]);
|
|
76
116
|
const triggerHandlers = useMemo(() => {
|
|
77
117
|
if (!multiTrigger) {
|
|
78
118
|
return { onClick: handleToggle };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useChartInteraction
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-JZZPLKTW.mjs";
|
|
4
4
|
import {
|
|
5
5
|
ChartTooltip
|
|
6
6
|
} from "./chunk-YORCCCQX.mjs";
|
|
7
7
|
import {
|
|
8
8
|
ChartCanvas
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-CUAXRBKO.mjs";
|
|
10
10
|
import {
|
|
11
11
|
ChartLegend
|
|
12
12
|
} from "./chunk-F2ITBDUS.mjs";
|
|
@@ -87,6 +87,7 @@ var TreeMapChart = ({
|
|
|
87
87
|
wrapperClasses
|
|
88
88
|
} = useChartInteraction({
|
|
89
89
|
hoverable,
|
|
90
|
+
showTooltip,
|
|
90
91
|
hoveredIndexProp,
|
|
91
92
|
selectable,
|
|
92
93
|
selectedIndexProp,
|
|
@@ -200,7 +201,7 @@ var TreeMapChart = ({
|
|
|
200
201
|
] })
|
|
201
202
|
}
|
|
202
203
|
);
|
|
203
|
-
const tooltip = showTooltip
|
|
204
|
+
const tooltip = showTooltip ? /* @__PURE__ */ jsx(
|
|
204
205
|
ChartTooltip,
|
|
205
206
|
{
|
|
206
207
|
content: tooltipContent,
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
3
3
|
import {
|
|
4
4
|
classNames,
|
|
5
|
+
createProgrammaticScrollLock,
|
|
5
6
|
createScrollSpyObserver,
|
|
6
7
|
createScrollSpyPayload,
|
|
7
8
|
flattenScrollSpyItems,
|
|
@@ -42,6 +43,7 @@ var ScrollSpy = ({
|
|
|
42
43
|
const activeKeyString = currentActiveKey === void 0 ? "" : getScrollSpyKeyString(currentActiveKey);
|
|
43
44
|
const getContainerRef = useRef(getContainer);
|
|
44
45
|
getContainerRef.current = getContainer;
|
|
46
|
+
const scrollLockRef = useRef(createProgrammaticScrollLock(() => getContainerRef.current()));
|
|
45
47
|
const onActiveKeyChangeRef = useRef(onActiveKeyChange);
|
|
46
48
|
onActiveKeyChangeRef.current = onActiveKeyChange;
|
|
47
49
|
const emitActive = useCallback(
|
|
@@ -68,15 +70,24 @@ var ScrollSpy = ({
|
|
|
68
70
|
offsetTop,
|
|
69
71
|
targetOffset,
|
|
70
72
|
bounds,
|
|
71
|
-
onChange: (item) =>
|
|
73
|
+
onChange: (item) => {
|
|
74
|
+
if (scrollLockRef.current.isLocked()) return;
|
|
75
|
+
emitActive(item, "scroll");
|
|
76
|
+
}
|
|
72
77
|
});
|
|
73
78
|
}, [bounds, emitActive, items, offsetTop, targetOffset]);
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
return () => {
|
|
81
|
+
scrollLockRef.current.dispose();
|
|
82
|
+
};
|
|
83
|
+
}, []);
|
|
74
84
|
const handleClick = useCallback(
|
|
75
85
|
(item, event) => {
|
|
76
86
|
event.preventDefault();
|
|
77
87
|
if (item.disabled) return;
|
|
78
88
|
onClick?.(item, event);
|
|
79
89
|
emitActive(item, "click");
|
|
90
|
+
scrollLockRef.current.lock();
|
|
80
91
|
scrollToScrollSpyItem(item, getContainerRef.current(), targetOffset ?? offsetTop);
|
|
81
92
|
},
|
|
82
93
|
[emitActive, offsetTop, onClick, targetOffset]
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Table
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-2XZHYYZ2.mjs";
|
|
4
4
|
import {
|
|
5
5
|
Select
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-S2V3HGLZ.mjs";
|
|
7
7
|
import {
|
|
8
8
|
Popover
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-FNK2VWPP.mjs";
|
|
10
10
|
import {
|
|
11
11
|
Input
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-3LDDXHW2.mjs";
|
|
13
13
|
import {
|
|
14
14
|
Checkbox
|
|
15
15
|
} from "./chunk-EPWAROC2.mjs";
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useTigerConfig
|
|
3
|
+
} from "./chunk-YSIXURBW.mjs";
|
|
4
|
+
|
|
5
|
+
// src/components/Code.tsx
|
|
6
|
+
import { useEffect, useMemo, useState } from "react";
|
|
7
|
+
import {
|
|
8
|
+
codeBlockPreClasses,
|
|
9
|
+
copyTextToClipboard,
|
|
10
|
+
getCodeBlockContainerClasses,
|
|
11
|
+
getCodeBlockCopyButtonClasses,
|
|
12
|
+
getCodeLabels,
|
|
13
|
+
mergeTigerLocale,
|
|
14
|
+
resolveLocaleText
|
|
15
|
+
} from "@expcat/tigercat-core";
|
|
16
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
17
|
+
var Code = ({
|
|
18
|
+
code,
|
|
19
|
+
copyable = true,
|
|
20
|
+
copyLabel,
|
|
21
|
+
copiedLabel,
|
|
22
|
+
copyFailedLabel,
|
|
23
|
+
locale,
|
|
24
|
+
labels: labelsOverride,
|
|
25
|
+
onCopy,
|
|
26
|
+
className,
|
|
27
|
+
...props
|
|
28
|
+
}) => {
|
|
29
|
+
const config = useTigerConfig();
|
|
30
|
+
const mergedLocale = useMemo(
|
|
31
|
+
() => mergeTigerLocale(config.locale, locale),
|
|
32
|
+
[config.locale, locale]
|
|
33
|
+
);
|
|
34
|
+
const labels = useMemo(
|
|
35
|
+
() => getCodeLabels(mergedLocale, labelsOverride),
|
|
36
|
+
[mergedLocale, labelsOverride]
|
|
37
|
+
);
|
|
38
|
+
const resolvedCopyLabel = resolveLocaleText(labels.copyLabel, copyLabel);
|
|
39
|
+
const resolvedCopiedLabel = resolveLocaleText(labels.copiedLabel, copiedLabel);
|
|
40
|
+
const resolvedCopyFailedLabel = resolveLocaleText(labels.copyFailedLabel, copyFailedLabel);
|
|
41
|
+
const [copyStatus, setCopyStatus] = useState("idle");
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (copyStatus === "idle") return;
|
|
44
|
+
const timer = window.setTimeout(() => {
|
|
45
|
+
setCopyStatus("idle");
|
|
46
|
+
}, 1500);
|
|
47
|
+
return () => window.clearTimeout(timer);
|
|
48
|
+
}, [copyStatus]);
|
|
49
|
+
const handleCopy = async () => {
|
|
50
|
+
if (!copyable) return;
|
|
51
|
+
const ok = await copyTextToClipboard(code);
|
|
52
|
+
if (ok) {
|
|
53
|
+
setCopyStatus("copied");
|
|
54
|
+
onCopy?.(code);
|
|
55
|
+
} else {
|
|
56
|
+
setCopyStatus("failed");
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
const containerClasses = getCodeBlockContainerClasses(className);
|
|
60
|
+
const copyButtonClasses = getCodeBlockCopyButtonClasses(copyStatus);
|
|
61
|
+
const buttonLabel = copyStatus === "failed" ? resolvedCopyFailedLabel : copyStatus === "copied" ? resolvedCopiedLabel : resolvedCopyLabel;
|
|
62
|
+
return /* @__PURE__ */ jsxs("div", { className: containerClasses, ...props, children: [
|
|
63
|
+
/* @__PURE__ */ jsx("pre", { className: codeBlockPreClasses, children: /* @__PURE__ */ jsx("code", { className: "block", children: code }) }),
|
|
64
|
+
copyable && /* @__PURE__ */ jsx(
|
|
65
|
+
"button",
|
|
66
|
+
{
|
|
67
|
+
type: "button",
|
|
68
|
+
className: copyButtonClasses,
|
|
69
|
+
onClick: handleCopy,
|
|
70
|
+
"aria-label": buttonLabel,
|
|
71
|
+
children: buttonLabel
|
|
72
|
+
}
|
|
73
|
+
)
|
|
74
|
+
] });
|
|
75
|
+
};
|
|
76
|
+
var Code_default = Code;
|
|
77
|
+
|
|
78
|
+
export {
|
|
79
|
+
Code,
|
|
80
|
+
Code_default
|
|
81
|
+
};
|
|
@@ -58,6 +58,9 @@ var CollapsePanel = ({
|
|
|
58
58
|
collapseContext.handlePanelClick(panelKey);
|
|
59
59
|
}
|
|
60
60
|
}, [disabled, collapseContext, panelKey]);
|
|
61
|
+
const handleExtraClick = useCallback((event) => {
|
|
62
|
+
event.stopPropagation();
|
|
63
|
+
}, []);
|
|
61
64
|
const handleKeyDown = useCallback(
|
|
62
65
|
(event) => {
|
|
63
66
|
if (disabled) {
|
|
@@ -119,7 +122,7 @@ var CollapsePanel = ({
|
|
|
119
122
|
children: [
|
|
120
123
|
showArrow && collapseContext.expandIconPosition === "start" && arrowIcon,
|
|
121
124
|
/* @__PURE__ */ jsx("span", { className: collapseHeaderTextClasses, children: header }),
|
|
122
|
-
extra && /* @__PURE__ */ jsx("span", { className: "ml-auto", children: extra }),
|
|
125
|
+
extra && /* @__PURE__ */ jsx("span", { className: "ml-auto", onClick: handleExtraClick, children: extra }),
|
|
123
126
|
showArrow && collapseContext.expandIconPosition === "end" && arrowIcon
|
|
124
127
|
]
|
|
125
128
|
}
|
|
@@ -131,6 +134,10 @@ var CollapsePanel = ({
|
|
|
131
134
|
"data-tiger-collapse-content": "",
|
|
132
135
|
className: collapsePanelContentWrapperClasses,
|
|
133
136
|
style: initialContentStyleRef.current,
|
|
137
|
+
...!isActive ? {
|
|
138
|
+
inert: true,
|
|
139
|
+
"aria-hidden": true
|
|
140
|
+
} : {},
|
|
134
141
|
children: /* @__PURE__ */ jsx("div", { className: collapsePanelContentBaseClasses, children })
|
|
135
142
|
}
|
|
136
143
|
)
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useChartInteraction
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-JZZPLKTW.mjs";
|
|
4
4
|
import {
|
|
5
5
|
ChartTooltip
|
|
6
6
|
} from "./chunk-YORCCCQX.mjs";
|
|
7
7
|
import {
|
|
8
8
|
ChartCanvas
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-CUAXRBKO.mjs";
|
|
10
10
|
import {
|
|
11
11
|
ChartLegend
|
|
12
12
|
} from "./chunk-F2ITBDUS.mjs";
|
|
@@ -86,6 +86,7 @@ var PieChart = ({
|
|
|
86
86
|
wrapperClasses
|
|
87
87
|
} = useChartInteraction({
|
|
88
88
|
hoverable,
|
|
89
|
+
showTooltip,
|
|
89
90
|
hoveredIndexProp,
|
|
90
91
|
selectable,
|
|
91
92
|
selectedIndexProp,
|
|
@@ -288,7 +289,7 @@ var PieChart = ({
|
|
|
288
289
|
ChartTooltip,
|
|
289
290
|
{
|
|
290
291
|
content: tooltipContent,
|
|
291
|
-
open:
|
|
292
|
+
open: resolvedHoveredIndex !== null && tooltipContent !== "",
|
|
292
293
|
x: tooltipPosition.x,
|
|
293
294
|
y: tooltipPosition.y
|
|
294
295
|
}
|