@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
|
classNames,
|
|
30
33
|
createLinearScale,
|
|
31
34
|
getChartElementOpacity,
|
|
32
|
-
getChartInnerRect,
|
|
33
35
|
getNumberExtent,
|
|
34
36
|
getStableChartGradientPrefix,
|
|
35
37
|
getScatterHoverShadow,
|
|
@@ -137,6 +139,7 @@ var ScatterChart = ({
|
|
|
137
139
|
wrapperClasses
|
|
138
140
|
} = useChartInteraction({
|
|
139
141
|
hoverable,
|
|
142
|
+
showTooltip,
|
|
140
143
|
hoveredIndexProp,
|
|
141
144
|
selectable,
|
|
142
145
|
selectedIndexProp,
|
|
@@ -151,9 +154,11 @@ var ScatterChart = ({
|
|
|
151
154
|
onSelectedIndexChange,
|
|
152
155
|
callbacks: { onClick: onPointClick }
|
|
153
156
|
});
|
|
154
|
-
const innerRect =
|
|
155
|
-
|
|
156
|
-
|
|
157
|
+
const { innerRect, onResolvedSizeChange } = useResponsiveChartSize(
|
|
158
|
+
width,
|
|
159
|
+
height,
|
|
160
|
+
padding,
|
|
161
|
+
responsive
|
|
157
162
|
);
|
|
158
163
|
const xValues = useMemo(() => data.map((item) => item.x), [data]);
|
|
159
164
|
const yValues = useMemo(() => data.map((item) => item.y), [data]);
|
|
@@ -232,6 +237,7 @@ var ScatterChart = ({
|
|
|
232
237
|
title,
|
|
233
238
|
desc,
|
|
234
239
|
className: classNames(className),
|
|
240
|
+
onResolvedSizeChange,
|
|
235
241
|
children: [
|
|
236
242
|
gradient && /* @__PURE__ */ jsx("defs", { children: palette.map((color, i) => /* @__PURE__ */ jsxs(
|
|
237
243
|
"radialGradient",
|
|
@@ -330,20 +336,12 @@ var ScatterChart = ({
|
|
|
330
336
|
`point-${index}`
|
|
331
337
|
);
|
|
332
338
|
}
|
|
333
|
-
return /* @__PURE__ */ jsx(
|
|
334
|
-
"path",
|
|
335
|
-
{
|
|
336
|
-
d: getScatterPointPath(pointStyle, point.r),
|
|
337
|
-
transform: `translate(${point.cx},${point.cy})`,
|
|
338
|
-
...sharedProps
|
|
339
|
-
},
|
|
340
|
-
`point-${index}`
|
|
341
|
-
);
|
|
339
|
+
return /* @__PURE__ */ jsx("g", { transform: `translate(${point.cx},${point.cy})`, children: /* @__PURE__ */ jsx("path", { d: getScatterPointPath(pointStyle, point.r), ...sharedProps }) }, `point-${index}`);
|
|
342
340
|
}) })
|
|
343
341
|
]
|
|
344
342
|
}
|
|
345
343
|
);
|
|
346
|
-
const tooltip = showTooltip &&
|
|
344
|
+
const tooltip = showTooltip && /* @__PURE__ */ jsx(
|
|
347
345
|
ChartTooltip,
|
|
348
346
|
{
|
|
349
347
|
content: tooltipContent,
|
|
@@ -113,24 +113,27 @@ var Affix = ({
|
|
|
113
113
|
style: { display: "block", width: 0, height: 0, pointerEvents: "none" }
|
|
114
114
|
}
|
|
115
115
|
);
|
|
116
|
-
|
|
116
|
+
const content = /* @__PURE__ */ jsx("div", { ref: wrapperRef, className: wrapperClasses, style: wrapperStyle, ...props, children });
|
|
117
|
+
const placeholder = state.affixed ? /* @__PURE__ */ jsx(
|
|
118
|
+
"div",
|
|
119
|
+
{
|
|
120
|
+
style: {
|
|
121
|
+
width: originalRectRef.current?.width ?? 0,
|
|
122
|
+
height: originalRectRef.current?.height ?? 0
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
) : null;
|
|
126
|
+
if (offsetBottom !== void 0) {
|
|
117
127
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
{
|
|
122
|
-
style: {
|
|
123
|
-
width: originalRectRef.current?.width ?? 0,
|
|
124
|
-
height: originalRectRef.current?.height ?? 0
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
),
|
|
128
|
-
/* @__PURE__ */ jsx("div", { ref: wrapperRef, className: wrapperClasses, style: wrapperStyle, ...props, children })
|
|
128
|
+
placeholder,
|
|
129
|
+
content,
|
|
130
|
+
sentinel
|
|
129
131
|
] });
|
|
130
132
|
}
|
|
131
133
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
132
134
|
sentinel,
|
|
133
|
-
|
|
135
|
+
placeholder,
|
|
136
|
+
content
|
|
134
137
|
] });
|
|
135
138
|
};
|
|
136
139
|
|
|
@@ -26,9 +26,10 @@ import {
|
|
|
26
26
|
tourFooterClasses,
|
|
27
27
|
tourIndicatorClasses,
|
|
28
28
|
tourCloseButtonClasses,
|
|
29
|
+
tourMaskClasses,
|
|
29
30
|
getTourTargetRect,
|
|
30
31
|
getTourPopoverPosition,
|
|
31
|
-
|
|
32
|
+
getTourMaskHoleStyle,
|
|
32
33
|
getActiveTourSteps,
|
|
33
34
|
getCurrentActiveTourStep,
|
|
34
35
|
getActiveTourStepPosition,
|
|
@@ -169,8 +170,16 @@ var Tour = ({
|
|
|
169
170
|
};
|
|
170
171
|
}
|
|
171
172
|
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
172
|
-
showMask &&
|
|
173
|
-
|
|
173
|
+
showMask && /* @__PURE__ */ jsx(
|
|
174
|
+
"div",
|
|
175
|
+
{
|
|
176
|
+
className: tourMaskClasses,
|
|
177
|
+
"data-tiger-tour-mask": "",
|
|
178
|
+
"aria-hidden": "true",
|
|
179
|
+
style: targetRect ? getTourMaskHoleStyle(targetRect) : void 0,
|
|
180
|
+
onClick: close
|
|
181
|
+
}
|
|
182
|
+
),
|
|
174
183
|
/* @__PURE__ */ jsxs(
|
|
175
184
|
"div",
|
|
176
185
|
{
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useControlledState
|
|
3
|
+
} from "./chunk-MEFARVQI.mjs";
|
|
4
|
+
|
|
1
5
|
// src/components/Stepper.tsx
|
|
2
6
|
import { useEffect, useRef } from "react";
|
|
3
7
|
import {
|
|
@@ -13,7 +17,8 @@ import {
|
|
|
13
17
|
} from "@expcat/tigercat-core";
|
|
14
18
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
19
|
var Stepper = ({
|
|
16
|
-
value
|
|
20
|
+
value,
|
|
21
|
+
defaultValue,
|
|
17
22
|
min = -Infinity,
|
|
18
23
|
max = Infinity,
|
|
19
24
|
step = 1,
|
|
@@ -25,16 +30,17 @@ var Stepper = ({
|
|
|
25
30
|
decrementAriaLabel = "Decrease",
|
|
26
31
|
onChange
|
|
27
32
|
}) => {
|
|
33
|
+
const [currentValue, setCurrentValue] = useControlledState(value, defaultValue ?? 0, onChange);
|
|
28
34
|
const repeatControllerRef = useRef(createRafRepeatActionController());
|
|
29
|
-
const repeatValueRef = useRef(
|
|
35
|
+
const repeatValueRef = useRef(currentValue);
|
|
30
36
|
const suppressNextClickRef = useRef(false);
|
|
31
37
|
useEffect(() => () => repeatControllerRef.current.stop(), []);
|
|
32
38
|
function setValue(v) {
|
|
33
39
|
const clamped = clampStepperValue(v, min, max, precision);
|
|
34
|
-
|
|
40
|
+
setCurrentValue(clamped);
|
|
35
41
|
return clamped;
|
|
36
42
|
}
|
|
37
|
-
function stepBy(direction, baseValue =
|
|
43
|
+
function stepBy(direction, baseValue = currentValue) {
|
|
38
44
|
return setValue(direction === "up" ? baseValue + step : baseValue - step);
|
|
39
45
|
}
|
|
40
46
|
function handleStepClick(direction) {
|
|
@@ -48,10 +54,10 @@ var Stepper = ({
|
|
|
48
54
|
return (event) => {
|
|
49
55
|
event.preventDefault();
|
|
50
56
|
if (disabled) return;
|
|
51
|
-
if (direction === "down" &&
|
|
52
|
-
if (direction === "up" &&
|
|
57
|
+
if (direction === "down" && currentValue <= min) return;
|
|
58
|
+
if (direction === "up" && currentValue >= max) return;
|
|
53
59
|
suppressNextClickRef.current = true;
|
|
54
|
-
repeatValueRef.current =
|
|
60
|
+
repeatValueRef.current = currentValue;
|
|
55
61
|
repeatControllerRef.current.start(() => {
|
|
56
62
|
const baseValue = repeatValueRef.current;
|
|
57
63
|
const nextValue = stepBy(direction, baseValue);
|
|
@@ -65,8 +71,8 @@ var Stepper = ({
|
|
|
65
71
|
function stopStepRepeat() {
|
|
66
72
|
repeatControllerRef.current.stop();
|
|
67
73
|
}
|
|
68
|
-
const atMin =
|
|
69
|
-
const atMax =
|
|
74
|
+
const atMin = currentValue <= min;
|
|
75
|
+
const atMax = currentValue >= max;
|
|
70
76
|
const icon = (d) => /* @__PURE__ */ jsx("svg", { className: "w-4 h-4", viewBox: stepperIconViewBox, fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d, fillRule: "evenodd", clipRule: "evenodd" }) });
|
|
71
77
|
return /* @__PURE__ */ jsxs("div", { className: classNames(stepperBaseClasses, className), role: "group", "aria-label": "Stepper", children: [
|
|
72
78
|
/* @__PURE__ */ jsx(
|
|
@@ -89,7 +95,7 @@ var Stepper = ({
|
|
|
89
95
|
{
|
|
90
96
|
type: "text",
|
|
91
97
|
className: getStepperInputClasses(size),
|
|
92
|
-
value: precision !== void 0 ?
|
|
98
|
+
value: precision !== void 0 ? currentValue.toFixed(precision) : String(currentValue),
|
|
93
99
|
disabled,
|
|
94
100
|
"aria-label": "Value",
|
|
95
101
|
onChange: (e) => {
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
getAutoCompleteInputClasses,
|
|
16
16
|
getAutoCompleteOptionClasses,
|
|
17
17
|
filterAutoCompleteOptions,
|
|
18
|
+
resolveAutoCompleteDisplayValue,
|
|
18
19
|
getInitialPickerActiveIndex,
|
|
19
20
|
getPickerComboboxAria,
|
|
20
21
|
getPickerListboxAria,
|
|
@@ -87,7 +88,7 @@ var AutoComplete = (props) => {
|
|
|
87
88
|
const listboxId = `tiger-autocomplete-listbox-${instanceId}`;
|
|
88
89
|
const [isOpen, setIsOpen] = useState(false);
|
|
89
90
|
const [uncontrolledSearchValue, setUncontrolledSearchValue] = useState(
|
|
90
|
-
|
|
91
|
+
searchValue ?? resolveAutoCompleteDisplayValue(value, options, defaultSearchValue)
|
|
91
92
|
);
|
|
92
93
|
const inputValue = searchValue ?? uncontrolledSearchValue;
|
|
93
94
|
const [activeIndex, setActiveIndex] = useState(-1);
|
|
@@ -111,8 +112,8 @@ var AutoComplete = (props) => {
|
|
|
111
112
|
if (searchValue !== void 0) {
|
|
112
113
|
return;
|
|
113
114
|
}
|
|
114
|
-
setUncontrolledSearchValue(
|
|
115
|
-
}, [defaultSearchValue, searchValue, value]);
|
|
115
|
+
setUncontrolledSearchValue(resolveAutoCompleteDisplayValue(value, options, defaultSearchValue));
|
|
116
|
+
}, [defaultSearchValue, options, searchValue, value]);
|
|
116
117
|
const filteredOptions = useMemo(
|
|
117
118
|
() => filterAutoCompleteOptions(options, inputValue, filterOption),
|
|
118
119
|
[options, inputValue, filterOption]
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
getLoadingDotsWrapperClasses,
|
|
20
20
|
getLoadingTextClasses,
|
|
21
21
|
getSpinnerSVG,
|
|
22
|
+
DEFAULT_LOADING_BACKGROUND,
|
|
22
23
|
loadingContainerBaseClasses,
|
|
23
24
|
loadingFullscreenBaseClasses,
|
|
24
25
|
loadingColorClasses,
|
|
@@ -32,7 +33,7 @@ var Loading = ({
|
|
|
32
33
|
text,
|
|
33
34
|
fullscreen = false,
|
|
34
35
|
delay = 0,
|
|
35
|
-
background =
|
|
36
|
+
background = DEFAULT_LOADING_BACKGROUND,
|
|
36
37
|
customColor,
|
|
37
38
|
lockScroll = true,
|
|
38
39
|
className,
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
function useChartInteraction(options) {
|
|
9
9
|
const {
|
|
10
10
|
hoverable,
|
|
11
|
+
showTooltip = true,
|
|
11
12
|
hoveredIndexProp,
|
|
12
13
|
selectable,
|
|
13
14
|
selectedIndexProp,
|
|
@@ -50,17 +51,18 @@ function useChartInteraction(options) {
|
|
|
50
51
|
);
|
|
51
52
|
const handleMouseEnter = useCallback(
|
|
52
53
|
(index, event) => {
|
|
53
|
-
if (!hoverable) return;
|
|
54
|
+
if (!hoverable && !showTooltip) return;
|
|
54
55
|
if (hoveredIndexProp === void 0) {
|
|
55
56
|
setLocalHoveredIndex(index);
|
|
56
57
|
}
|
|
57
58
|
setTooltipPosition({ x: event.clientX, y: event.clientY });
|
|
59
|
+
if (!hoverable) return;
|
|
58
60
|
onHoveredIndexChange?.(index);
|
|
59
61
|
if (callbacks?.onHover && getData) {
|
|
60
62
|
callbacks.onHover(index, getData(index) ?? null);
|
|
61
63
|
}
|
|
62
64
|
},
|
|
63
|
-
[hoverable, hoveredIndexProp, onHoveredIndexChange, callbacks, getData]
|
|
65
|
+
[hoverable, showTooltip, hoveredIndexProp, onHoveredIndexChange, callbacks, getData]
|
|
64
66
|
);
|
|
65
67
|
const handleMouseMove = useCallback(
|
|
66
68
|
(event) => {
|
|
@@ -70,13 +72,14 @@ function useChartInteraction(options) {
|
|
|
70
72
|
);
|
|
71
73
|
const handleMouseLeave = useCallback(() => {
|
|
72
74
|
tooltipScheduler.cancel();
|
|
73
|
-
if (!hoverable) return;
|
|
75
|
+
if (!hoverable && !showTooltip) return;
|
|
74
76
|
if (hoveredIndexProp === void 0) {
|
|
75
77
|
setLocalHoveredIndex(null);
|
|
76
78
|
}
|
|
79
|
+
if (!hoverable) return;
|
|
77
80
|
onHoveredIndexChange?.(null);
|
|
78
81
|
callbacks?.onHover?.(null, null);
|
|
79
|
-
}, [hoverable, tooltipScheduler, hoveredIndexProp, onHoveredIndexChange, callbacks]);
|
|
82
|
+
}, [hoverable, showTooltip, tooltipScheduler, hoveredIndexProp, onHoveredIndexChange, callbacks]);
|
|
80
83
|
const handleClick = useCallback(
|
|
81
84
|
(index) => {
|
|
82
85
|
if (!selectable) return;
|
|
@@ -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";
|
|
@@ -70,6 +70,7 @@ var FunnelChart = ({
|
|
|
70
70
|
wrapperClasses
|
|
71
71
|
} = useChartInteraction({
|
|
72
72
|
hoverable,
|
|
73
|
+
showTooltip,
|
|
73
74
|
hoveredIndexProp,
|
|
74
75
|
selectable,
|
|
75
76
|
selectedIndexProp,
|
|
@@ -191,7 +192,7 @@ var FunnelChart = ({
|
|
|
191
192
|
]
|
|
192
193
|
}
|
|
193
194
|
);
|
|
194
|
-
const tooltip = showTooltip
|
|
195
|
+
const tooltip = showTooltip ? /* @__PURE__ */ jsx(
|
|
195
196
|
ChartTooltip,
|
|
196
197
|
{
|
|
197
198
|
content: tooltipContent,
|
|
@@ -10,7 +10,6 @@ import {
|
|
|
10
10
|
getPageRange,
|
|
11
11
|
validateCurrentPage,
|
|
12
12
|
getPageNumbers,
|
|
13
|
-
defaultTotalText,
|
|
14
13
|
formatPaginationTotal,
|
|
15
14
|
getPaginationContainerClasses,
|
|
16
15
|
getPaginationButtonBaseClasses,
|
|
@@ -179,7 +178,7 @@ var Pagination = ({
|
|
|
179
178
|
const nextDisabled = validatedCurrentPage >= totalPages || disabled;
|
|
180
179
|
const elements = [];
|
|
181
180
|
if (showTotal) {
|
|
182
|
-
const totalTextFn = totalText || (
|
|
181
|
+
const totalTextFn = totalText || ((value, range) => formatPaginationTotal(labels.totalText, value, range, localeCode));
|
|
183
182
|
elements.push(
|
|
184
183
|
/* @__PURE__ */ jsx("span", { className: getTotalTextClasses(size), children: totalTextFn(total, pageRange) }, "total")
|
|
185
184
|
);
|
|
@@ -3,38 +3,47 @@ import {
|
|
|
3
3
|
} from "./chunk-Y5X3G2LD.mjs";
|
|
4
4
|
import {
|
|
5
5
|
Input
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-3LDDXHW2.mjs";
|
|
7
7
|
import {
|
|
8
8
|
Empty
|
|
9
9
|
} from "./chunk-W7BC4I2Y.mjs";
|
|
10
10
|
import {
|
|
11
11
|
Textarea
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-PMQJ6AYT.mjs";
|
|
13
13
|
import {
|
|
14
14
|
Button
|
|
15
15
|
} from "./chunk-5TE7KLE5.mjs";
|
|
16
16
|
import {
|
|
17
17
|
Avatar
|
|
18
18
|
} from "./chunk-OO562MFD.mjs";
|
|
19
|
+
import {
|
|
20
|
+
useTigerConfig
|
|
21
|
+
} from "./chunk-YSIXURBW.mjs";
|
|
19
22
|
|
|
20
23
|
// src/components/ChatWindow.tsx
|
|
21
24
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
22
25
|
import {
|
|
23
26
|
classNames,
|
|
24
27
|
getChatMessageStatusInfo,
|
|
28
|
+
buildChatMessageStatusInfo,
|
|
25
29
|
getChatStatusBarClasses,
|
|
26
|
-
formatChatTime
|
|
30
|
+
formatChatTime,
|
|
31
|
+
getChatWindowLabels,
|
|
32
|
+
mergeTigerLocale,
|
|
33
|
+
resolveLocaleText
|
|
27
34
|
} from "@expcat/tigercat-core";
|
|
28
35
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
29
36
|
var ChatWindow = ({
|
|
30
37
|
messages = [],
|
|
31
38
|
value,
|
|
32
39
|
defaultValue = "",
|
|
33
|
-
placeholder
|
|
40
|
+
placeholder,
|
|
34
41
|
disabled = false,
|
|
35
42
|
maxLength,
|
|
36
|
-
emptyText
|
|
37
|
-
sendText
|
|
43
|
+
emptyText,
|
|
44
|
+
sendText,
|
|
45
|
+
locale,
|
|
46
|
+
labels: labelsOverride,
|
|
38
47
|
messageListAriaLabel,
|
|
39
48
|
inputAriaLabel,
|
|
40
49
|
sendAriaLabel,
|
|
@@ -59,6 +68,19 @@ var ChatWindow = ({
|
|
|
59
68
|
className,
|
|
60
69
|
...props
|
|
61
70
|
}) => {
|
|
71
|
+
const config = useTigerConfig();
|
|
72
|
+
const mergedLocale = useMemo(
|
|
73
|
+
() => mergeTigerLocale(config.locale, locale),
|
|
74
|
+
[config.locale, locale]
|
|
75
|
+
);
|
|
76
|
+
const labels = useMemo(
|
|
77
|
+
() => getChatWindowLabels(mergedLocale, labelsOverride),
|
|
78
|
+
[mergedLocale, labelsOverride]
|
|
79
|
+
);
|
|
80
|
+
const statusMap = useMemo(() => buildChatMessageStatusInfo(labels), [labels]);
|
|
81
|
+
const resolvedPlaceholder = resolveLocaleText(labels.placeholder, placeholder);
|
|
82
|
+
const resolvedEmptyText = resolveLocaleText(labels.emptyText, emptyText);
|
|
83
|
+
const resolvedSendText = resolveLocaleText(labels.sendText, sendText);
|
|
62
84
|
const [innerValue, setInnerValue] = useState(value ?? defaultValue);
|
|
63
85
|
useEffect(() => {
|
|
64
86
|
if (value !== void 0) {
|
|
@@ -112,7 +134,7 @@ var ChatWindow = ({
|
|
|
112
134
|
const renderMessageItem = useCallback(
|
|
113
135
|
(message, index) => {
|
|
114
136
|
const isSelf = message.direction === "self";
|
|
115
|
-
const statusInfo = message.status ? getChatMessageStatusInfo(message.status) : void 0;
|
|
137
|
+
const statusInfo = message.status ? getChatMessageStatusInfo(message.status, statusMap) : void 0;
|
|
116
138
|
const timeText = showTime ? formatChatTime(message.time) : "";
|
|
117
139
|
return /* @__PURE__ */ jsxs(
|
|
118
140
|
"div",
|
|
@@ -163,7 +185,7 @@ var ChatWindow = ({
|
|
|
163
185
|
message.id ?? index
|
|
164
186
|
);
|
|
165
187
|
},
|
|
166
|
-
[renderMessage, showAvatar, showName, showTime]
|
|
188
|
+
[renderMessage, showAvatar, showName, showTime, statusMap]
|
|
167
189
|
);
|
|
168
190
|
const messageListRef = useRef(null);
|
|
169
191
|
useEffect(() => {
|
|
@@ -185,7 +207,7 @@ var ChatWindow = ({
|
|
|
185
207
|
role: "log",
|
|
186
208
|
"aria-live": "polite",
|
|
187
209
|
"aria-relevant": "additions text",
|
|
188
|
-
"aria-label": messageListAriaLabel ?? "
|
|
210
|
+
"aria-label": messageListAriaLabel ?? "Message list",
|
|
189
211
|
children: /* @__PURE__ */ jsx(
|
|
190
212
|
VirtualList,
|
|
191
213
|
{
|
|
@@ -204,8 +226,8 @@ var ChatWindow = ({
|
|
|
204
226
|
role: "log",
|
|
205
227
|
"aria-live": "polite",
|
|
206
228
|
"aria-relevant": "additions text",
|
|
207
|
-
"aria-label": messageListAriaLabel ?? "
|
|
208
|
-
children: messages.length === 0 ? /* @__PURE__ */ jsx("div", { className: "h-full flex items-center justify-center py-8", children: /* @__PURE__ */ jsx(Empty, { description:
|
|
229
|
+
"aria-label": messageListAriaLabel ?? "Message list",
|
|
230
|
+
children: messages.length === 0 ? /* @__PURE__ */ jsx("div", { className: "h-full flex items-center justify-center py-8", children: /* @__PURE__ */ jsx(Empty, { description: resolvedEmptyText }) }) : messages.map(renderMessageItem)
|
|
209
231
|
}
|
|
210
232
|
),
|
|
211
233
|
statusText && /* @__PURE__ */ jsx("div", { className: getChatStatusBarClasses(statusVariant), children: statusText }),
|
|
@@ -214,10 +236,10 @@ var ChatWindow = ({
|
|
|
214
236
|
Input,
|
|
215
237
|
{
|
|
216
238
|
value: inputValue,
|
|
217
|
-
placeholder,
|
|
239
|
+
placeholder: resolvedPlaceholder,
|
|
218
240
|
disabled,
|
|
219
241
|
maxLength,
|
|
220
|
-
"aria-label": inputAriaLabel ??
|
|
242
|
+
"aria-label": inputAriaLabel ?? resolvedPlaceholder,
|
|
221
243
|
onChange: (event) => handleValueChange(event.currentTarget.value),
|
|
222
244
|
onKeyDown: handleKeyDown
|
|
223
245
|
}
|
|
@@ -225,16 +247,24 @@ var ChatWindow = ({
|
|
|
225
247
|
Textarea,
|
|
226
248
|
{
|
|
227
249
|
value: inputValue,
|
|
228
|
-
placeholder,
|
|
250
|
+
placeholder: resolvedPlaceholder,
|
|
229
251
|
disabled,
|
|
230
252
|
maxLength,
|
|
231
253
|
rows: inputRows,
|
|
232
|
-
"aria-label": inputAriaLabel ??
|
|
254
|
+
"aria-label": inputAriaLabel ?? resolvedPlaceholder,
|
|
233
255
|
onChange: (event) => handleValueChange(event.currentTarget.value),
|
|
234
256
|
onKeyDown: handleKeyDown
|
|
235
257
|
}
|
|
236
258
|
) }),
|
|
237
|
-
/* @__PURE__ */ jsx(
|
|
259
|
+
/* @__PURE__ */ jsx(
|
|
260
|
+
Button,
|
|
261
|
+
{
|
|
262
|
+
disabled: !canSend,
|
|
263
|
+
onClick: handleSend,
|
|
264
|
+
"aria-label": sendAriaLabel ?? resolvedSendText,
|
|
265
|
+
children: resolvedSendText
|
|
266
|
+
}
|
|
267
|
+
)
|
|
238
268
|
] })
|
|
239
269
|
] });
|
|
240
270
|
};
|
|
@@ -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";
|
|
@@ -16,6 +16,7 @@ import { useId, useMemo } from "react";
|
|
|
16
16
|
import {
|
|
17
17
|
classNames,
|
|
18
18
|
computeSunburstArcs,
|
|
19
|
+
getSunburstLabelPoint,
|
|
19
20
|
getChartElementOpacity,
|
|
20
21
|
getChartInnerRect,
|
|
21
22
|
getStableChartGradientPrefix,
|
|
@@ -30,7 +31,7 @@ var SunburstChart = ({
|
|
|
30
31
|
padding = 24,
|
|
31
32
|
data,
|
|
32
33
|
innerRadiusRatio = 0,
|
|
33
|
-
showLabels
|
|
34
|
+
showLabels = true,
|
|
34
35
|
colors,
|
|
35
36
|
gradient = false,
|
|
36
37
|
hoverable = false,
|
|
@@ -97,6 +98,7 @@ var SunburstChart = ({
|
|
|
97
98
|
wrapperClasses
|
|
98
99
|
} = useChartInteraction({
|
|
99
100
|
hoverable,
|
|
101
|
+
showTooltip,
|
|
100
102
|
hoveredIndexProp,
|
|
101
103
|
selectable,
|
|
102
104
|
selectedIndexProp,
|
|
@@ -189,11 +191,28 @@ var SunburstChart = ({
|
|
|
189
191
|
},
|
|
190
192
|
`arc-${arc.index}`
|
|
191
193
|
);
|
|
194
|
+
}),
|
|
195
|
+
showLabels && arcs.map((arc) => {
|
|
196
|
+
const { x, y } = getSunburstLabelPoint(arc, cx, cy);
|
|
197
|
+
return /* @__PURE__ */ jsx(
|
|
198
|
+
"text",
|
|
199
|
+
{
|
|
200
|
+
x,
|
|
201
|
+
y,
|
|
202
|
+
className: "fill-white text-xs",
|
|
203
|
+
textAnchor: "middle",
|
|
204
|
+
dominantBaseline: "middle",
|
|
205
|
+
style: { pointerEvents: "none" },
|
|
206
|
+
"aria-hidden": "true",
|
|
207
|
+
children: arc.label
|
|
208
|
+
},
|
|
209
|
+
`label-${arc.index}`
|
|
210
|
+
);
|
|
192
211
|
})
|
|
193
212
|
] })
|
|
194
213
|
}
|
|
195
214
|
);
|
|
196
|
-
const tooltip = showTooltip
|
|
215
|
+
const tooltip = showTooltip ? /* @__PURE__ */ jsx(
|
|
197
216
|
ChartTooltip,
|
|
198
217
|
{
|
|
199
218
|
content: tooltipContent,
|