@expcat/tigercat-react 2.1.3 → 2.2.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.
- package/README.md +13 -19
- package/dist/{chunk-65CDWNRJ.mjs → chunk-2IOF3EC7.mjs} +1 -1
- package/dist/{chunk-5I7FKHZO.mjs → chunk-2MKDIXBP.mjs} +1 -1
- package/dist/chunk-2MV3F7WP.mjs +56 -0
- package/dist/{chunk-WLCRBIZO.mjs → chunk-2W4SH2IG.mjs} +1 -1
- package/dist/{chunk-YLXEMZVI.mjs → chunk-3C62ULJT.mjs} +1 -1
- package/dist/{chunk-6IJFLGCN.mjs → chunk-3QXXNK5X.mjs} +1 -1
- package/dist/{chunk-KVXGNUIE.mjs → chunk-4IVRLBKW.mjs} +1 -1
- package/dist/{chunk-YCVORYEO.mjs → chunk-532OVXLV.mjs} +3 -1
- package/dist/{chunk-R7J37DKJ.mjs → chunk-5TQFSORK.mjs} +2 -2
- package/dist/{chunk-ZATZSMQY.mjs → chunk-6L7RWLOU.mjs} +1 -1
- package/dist/{chunk-T5VXIYWF.mjs → chunk-6T5AEQJV.mjs} +2 -2
- package/dist/{chunk-R2VBVZIH.mjs → chunk-75SQCTLC.mjs} +4 -4
- package/dist/{chunk-U7V7ZWJ6.mjs → chunk-7QM2ZC52.mjs} +1 -1
- package/dist/{chunk-M7TSPEXC.mjs → chunk-A2PQJEII.mjs} +1 -1
- package/dist/{chunk-5P3OFNH3.mjs → chunk-ACHXTII7.mjs} +1 -1
- package/dist/{chunk-EJY3Y2XU.mjs → chunk-AHQR57Z4.mjs} +2 -2
- package/dist/{chunk-2N6WZ5Z5.mjs → chunk-BNC4MMVG.mjs} +1 -1
- package/dist/{chunk-I4P4T6LL.mjs → chunk-BVSR27AF.mjs} +1 -1
- package/dist/{chunk-2STETY2J.mjs → chunk-CCFKRKGJ.mjs} +12 -6
- package/dist/{chunk-N53N6H54.mjs → chunk-CQGDJU2H.mjs} +2 -2
- package/dist/{chunk-GRB667BG.mjs → chunk-DDSY5FPV.mjs} +1 -1
- package/dist/{chunk-OIMP63RE.mjs → chunk-DJLVNYZD.mjs} +1 -1
- package/dist/{chunk-HZGTQGSM.mjs → chunk-DNRLMEKE.mjs} +11 -4
- package/dist/{chunk-PZ4LAI6G.mjs → chunk-EK7R3MIN.mjs} +1 -1
- package/dist/{chunk-RTKPLZ5A.mjs → chunk-EVO4YVSD.mjs} +1 -1
- package/dist/chunk-F4XF5CGQ.mjs +72 -0
- package/dist/{chunk-GMHJWSQB.mjs → chunk-FTLA6FRU.mjs} +2 -2
- package/dist/chunk-FZQUUTWN.mjs +145 -0
- package/dist/{chunk-AFVKH2Z3.mjs → chunk-G4Y25JES.mjs} +1 -1
- package/dist/{chunk-CJSB5NOK.mjs → chunk-H3UEVWOO.mjs} +1 -1
- package/dist/{chunk-CX7QZXU5.mjs → chunk-HEVB53MU.mjs} +1 -1
- package/dist/{chunk-5QTYD4XG.mjs → chunk-HKPRHDW4.mjs} +1 -1
- package/dist/{chunk-7KVHHNUI.mjs → chunk-ION7IDAW.mjs} +1 -1
- package/dist/{chunk-CCTBNDCX.mjs → chunk-IWXG4346.mjs} +1 -1
- package/dist/{chunk-WW6MFKTJ.mjs → chunk-IXMQQ6PV.mjs} +3 -3
- package/dist/{chunk-IPI45RUK.mjs → chunk-JX2WKSVM.mjs} +1 -1
- package/dist/{chunk-PTKQJPLM.mjs → chunk-KDXNJN6C.mjs} +1 -1
- package/dist/{chunk-WKZZ4IQK.mjs → chunk-KEFHL7CJ.mjs} +1 -1
- package/dist/{chunk-XBDLXTF7.mjs → chunk-KJHPPPB2.mjs} +1 -1
- package/dist/{chunk-PLEAZRIC.mjs → chunk-LKTM4NU4.mjs} +1 -1
- package/dist/{chunk-2FFAUB47.mjs → chunk-MF6LOOXR.mjs} +2 -2
- package/dist/{chunk-KJB2OIG7.mjs → chunk-MMDVFCCL.mjs} +3 -3
- package/dist/{chunk-25BKSXTX.mjs → chunk-NMRCBGFP.mjs} +1 -1
- package/dist/{chunk-NPGU6VYD.mjs → chunk-OU2AV7DY.mjs} +1 -1
- package/dist/{chunk-6D2VLITE.mjs → chunk-OZ4WH3GE.mjs} +1 -1
- package/dist/{chunk-A6PNUVY6.mjs → chunk-PBF5TEF4.mjs} +2 -2
- package/dist/{chunk-JML6CK44.mjs → chunk-PQPO7XSV.mjs} +1 -1
- package/dist/{chunk-TVVLCER6.mjs → chunk-QCRTRRBD.mjs} +179 -163
- package/dist/chunk-REHHFHZ3.mjs +67 -0
- package/dist/{chunk-XI6KQAHW.mjs → chunk-RJ2FJXHT.mjs} +5 -6
- package/dist/{chunk-XKB7ECPU.mjs → chunk-S37KEELR.mjs} +1 -1
- package/dist/{chunk-RNKUEEIX.mjs → chunk-S5GHNXGQ.mjs} +4 -4
- package/dist/{chunk-OES5DL3S.mjs → chunk-SCN6UULA.mjs} +1 -1
- package/dist/{chunk-OYQ6HTLQ.mjs → chunk-SGKPZW57.mjs} +1 -1
- package/dist/{chunk-WN6ZHQTI.mjs → chunk-SIBNSFVR.mjs} +10 -4
- package/dist/{chunk-C4UZFBFV.mjs → chunk-SOVB7HJF.mjs} +1 -1
- package/dist/{chunk-3WP4PGHF.mjs → chunk-TFHQODGK.mjs} +7 -1
- package/dist/{chunk-IR45LOEZ.mjs → chunk-UGKTSPS4.mjs} +38 -4
- package/dist/{chunk-GJRGMIB3.mjs → chunk-UVI5JN47.mjs} +1 -1
- package/dist/{chunk-UAFA5GOL.mjs → chunk-VE3PZFFT.mjs} +2 -1
- package/dist/{chunk-XXU5VQV5.mjs → chunk-VGWFHVJ7.mjs} +1 -1
- package/dist/{chunk-BNCUJLRV.mjs → chunk-VW6RNQK4.mjs} +1 -1
- package/dist/{chunk-IZC77KAN.mjs → chunk-WWDZAWTS.mjs} +1 -1
- package/dist/{chunk-ZGXC47M5.mjs → chunk-YDIEWFBM.mjs} +1 -1
- package/dist/{chunk-53RDSFKZ.mjs → chunk-YUFKPLCK.mjs} +1 -1
- package/dist/{chunk-WSN4Z4MC.mjs → chunk-Z3AD5DZX.mjs} +1 -1
- package/dist/{chunk-6NCG4SLX.mjs → chunk-ZZJVJUO4.mjs} +1 -1
- package/dist/components/ActivityFeed.mjs +4 -4
- package/dist/components/Anchor.mjs +1 -1
- package/dist/components/AreaChart.mjs +3 -3
- package/dist/components/AutoComplete.mjs +2 -2
- package/dist/components/BackTop.mjs +1 -1
- package/dist/components/BarChart.mjs +3 -3
- package/dist/components/Calendar.mjs +1 -1
- package/dist/components/Cascader.mjs +2 -2
- package/dist/components/ChartTooltip.mjs +2 -2
- package/dist/components/Code.mjs +1 -1
- package/dist/components/ColorPicker.mjs +2 -2
- package/dist/components/CommentThread.mjs +2 -2
- package/dist/components/ContextMenu.mjs +2 -2
- package/dist/components/CropUpload.mjs +4 -4
- package/dist/components/DataExport.mjs +3 -3
- package/dist/components/DataTableWithToolbar.mjs +7 -7
- package/dist/components/DatePicker.mjs +3 -3
- package/dist/components/DonutChart.mjs +4 -4
- package/dist/components/Drag.d.mts +17 -0
- package/dist/components/Drag.mjs +9 -0
- package/dist/components/Drawer.mjs +2 -2
- package/dist/components/Dropdown.mjs +2 -2
- package/dist/components/FloatButton.mjs +2 -2
- package/dist/components/Footer.mjs +1 -1
- package/dist/components/FormItem.mjs +2 -2
- package/dist/components/FullscreenButton.d.mts +8 -0
- package/dist/components/FullscreenButton.mjs +10 -0
- package/dist/components/FunnelChart.mjs +3 -3
- package/dist/components/GaugeChart.mjs +3 -3
- package/dist/components/HeatmapChart.mjs +3 -3
- package/dist/components/Image.mjs +5 -5
- package/dist/components/ImageCropper.mjs +1 -1
- package/dist/components/ImageGroup.mjs +3 -3
- package/dist/components/ImagePreview.mjs +2 -2
- package/dist/components/ImageViewer.mjs +3 -3
- package/dist/components/LineChart.mjs +3 -3
- package/dist/components/List.mjs +3 -3
- package/dist/components/Loading.mjs +2 -2
- package/dist/components/Mentions.mjs +2 -2
- package/dist/components/Menu.mjs +2 -2
- package/dist/components/Message.mjs +2 -2
- package/dist/components/MessageContainer.mjs +2 -2
- package/dist/components/MessageRoot.mjs +1 -1
- package/dist/components/Modal.mjs +2 -2
- package/dist/components/NavigationMenu.mjs +2 -2
- package/dist/components/Notification.mjs +2 -2
- package/dist/components/NotificationCenter.mjs +5 -5
- package/dist/components/NotificationContainer.mjs +2 -2
- package/dist/components/NotificationRoot.mjs +1 -1
- package/dist/components/NumberKeyboard.mjs +2 -2
- package/dist/components/PieChart.mjs +3 -3
- package/dist/components/Popconfirm.mjs +3 -3
- package/dist/components/Popover.mjs +3 -3
- package/dist/components/RadarChart.mjs +3 -3
- package/dist/components/Rate.mjs +1 -1
- package/dist/components/ScatterChart.mjs +3 -3
- package/dist/components/ScrollSpy.mjs +1 -1
- package/dist/components/Select.mjs +2 -2
- package/dist/components/Slider.mjs +1 -1
- package/dist/components/SplitButton.mjs +3 -3
- package/dist/components/Spotlight.mjs +2 -2
- package/dist/components/SunburstChart.mjs +3 -3
- package/dist/components/Table.mjs +4 -4
- package/dist/components/Text.d.mts +5 -1
- package/dist/components/Text.mjs +2 -1
- package/dist/components/TimePicker.mjs +2 -2
- package/dist/components/Tooltip.mjs +3 -3
- package/dist/components/Tour.mjs +2 -2
- package/dist/components/TreeMapChart.mjs +3 -3
- package/dist/components/TreeSelect.mjs +2 -2
- package/dist/components/Upload.mjs +3 -3
- package/dist/hooks/useFullscreen.d.mts +13 -0
- package/dist/hooks/useFullscreen.mjs +6 -0
- package/dist/index.d.mts +5 -2
- package/dist/index.mjs +43 -0
- package/package.json +17 -2
- package/dist/chunk-VDBLI5Y3.mjs +0 -33
- /package/dist/{chunk-HHRU7TK3.mjs → chunk-GF7W2FTZ.mjs} +0 -0
- /package/dist/{chunk-XJHC6JEC.mjs → chunk-P44HJQNB.mjs} +0 -0
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useTigerConfig
|
|
3
|
+
} from "./chunk-RUIFGSVN.mjs";
|
|
4
|
+
|
|
5
|
+
// src/components/Text.tsx
|
|
6
|
+
import React, { forwardRef, useEffect, useMemo, useRef, useState } from "react";
|
|
7
|
+
import {
|
|
8
|
+
classNames,
|
|
9
|
+
copyTextToClipboard,
|
|
10
|
+
createCopyStatusReset,
|
|
11
|
+
getCodeLabels,
|
|
12
|
+
getIconDefinition,
|
|
13
|
+
getTextClasses,
|
|
14
|
+
isTextCopyable,
|
|
15
|
+
mergeTigerLocale,
|
|
16
|
+
resolveLocaleText,
|
|
17
|
+
resolveTextCopyableOptions,
|
|
18
|
+
resolveTextCopyContent,
|
|
19
|
+
resolveTextTag,
|
|
20
|
+
textCopyableBodyClasses,
|
|
21
|
+
textCopyableButtonClasses,
|
|
22
|
+
textCopyableLiveClasses,
|
|
23
|
+
textCopyableRootClasses
|
|
24
|
+
} from "@expcat/tigercat-core";
|
|
25
|
+
import { jsx } from "react/jsx-runtime";
|
|
26
|
+
var copyIcon = getIconDefinition("copy");
|
|
27
|
+
function CopyGlyph() {
|
|
28
|
+
if (!copyIcon) return null;
|
|
29
|
+
return /* @__PURE__ */ jsx(
|
|
30
|
+
"svg",
|
|
31
|
+
{
|
|
32
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
33
|
+
viewBox: copyIcon.viewBox,
|
|
34
|
+
fill: "none",
|
|
35
|
+
stroke: "currentColor",
|
|
36
|
+
strokeWidth: "1.5",
|
|
37
|
+
strokeLinecap: "round",
|
|
38
|
+
strokeLinejoin: "round",
|
|
39
|
+
className: "h-3.5 w-3.5",
|
|
40
|
+
"aria-hidden": "true",
|
|
41
|
+
children: copyIcon.paths.map((d, i) => /* @__PURE__ */ jsx("path", { d }, i))
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
var Text = forwardRef(function Text2({
|
|
46
|
+
tag = "p",
|
|
47
|
+
size,
|
|
48
|
+
weight,
|
|
49
|
+
align,
|
|
50
|
+
color,
|
|
51
|
+
truncate,
|
|
52
|
+
italic,
|
|
53
|
+
underline,
|
|
54
|
+
lineThrough,
|
|
55
|
+
copyable,
|
|
56
|
+
locale,
|
|
57
|
+
children,
|
|
58
|
+
className,
|
|
59
|
+
onCopy,
|
|
60
|
+
...props
|
|
61
|
+
}, ref) {
|
|
62
|
+
const resolvedTag = resolveTextTag(tag);
|
|
63
|
+
const copyEnabled = isTextCopyable(copyable);
|
|
64
|
+
const copyOptions = resolveTextCopyableOptions(copyable);
|
|
65
|
+
const textClasses = classNames(
|
|
66
|
+
getTextClasses({
|
|
67
|
+
size,
|
|
68
|
+
weight,
|
|
69
|
+
align,
|
|
70
|
+
color,
|
|
71
|
+
truncate,
|
|
72
|
+
italic,
|
|
73
|
+
underline,
|
|
74
|
+
lineThrough,
|
|
75
|
+
copyable
|
|
76
|
+
}),
|
|
77
|
+
!copyEnabled && className
|
|
78
|
+
);
|
|
79
|
+
const config = useTigerConfig();
|
|
80
|
+
const mergedLocale = useMemo(
|
|
81
|
+
() => mergeTigerLocale(config.locale, locale),
|
|
82
|
+
[config.locale, locale]
|
|
83
|
+
);
|
|
84
|
+
const labels = useMemo(() => getCodeLabels(mergedLocale), [mergedLocale]);
|
|
85
|
+
const idleLabel = resolveLocaleText(labels.copyLabel, copyOptions?.tooltip);
|
|
86
|
+
const [copyStatus, setCopyStatus] = useState("idle");
|
|
87
|
+
const resetRef = useRef(null);
|
|
88
|
+
if (resetRef.current == null) {
|
|
89
|
+
resetRef.current = createCopyStatusReset(setCopyStatus);
|
|
90
|
+
}
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
const machine = resetRef.current;
|
|
93
|
+
return () => machine?.dispose();
|
|
94
|
+
}, []);
|
|
95
|
+
const bodyRef = useRef(null);
|
|
96
|
+
const buttonLabel = copyStatus === "failed" ? labels.copyFailedLabel : copyStatus === "copied" ? labels.copiedLabel : idleLabel;
|
|
97
|
+
const liveText = copyStatus === "idle" ? "" : buttonLabel;
|
|
98
|
+
const handleCopy = async () => {
|
|
99
|
+
if (!copyOptions) return;
|
|
100
|
+
const fallback = bodyRef.current?.textContent ?? "";
|
|
101
|
+
const text = resolveTextCopyContent(copyOptions, fallback);
|
|
102
|
+
const ok = await copyTextToClipboard(text);
|
|
103
|
+
if (ok) {
|
|
104
|
+
resetRef.current?.schedule("copied");
|
|
105
|
+
copyOptions.onCopy?.(text);
|
|
106
|
+
onCopy?.(text);
|
|
107
|
+
} else {
|
|
108
|
+
resetRef.current?.schedule("failed");
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
if (!copyEnabled) {
|
|
112
|
+
return React.createElement(resolvedTag, { ...props, ref, className: textClasses }, children);
|
|
113
|
+
}
|
|
114
|
+
return React.createElement(
|
|
115
|
+
resolvedTag,
|
|
116
|
+
{ ...props, ref, className: classNames(textCopyableRootClasses, className) },
|
|
117
|
+
/* @__PURE__ */ jsx(
|
|
118
|
+
"span",
|
|
119
|
+
{
|
|
120
|
+
ref: bodyRef,
|
|
121
|
+
className: classNames(textCopyableBodyClasses, truncate && "truncate", textClasses),
|
|
122
|
+
children
|
|
123
|
+
}
|
|
124
|
+
),
|
|
125
|
+
/* @__PURE__ */ jsx(
|
|
126
|
+
"button",
|
|
127
|
+
{
|
|
128
|
+
type: "button",
|
|
129
|
+
className: textCopyableButtonClasses,
|
|
130
|
+
"aria-label": buttonLabel,
|
|
131
|
+
title: buttonLabel,
|
|
132
|
+
onClick: () => {
|
|
133
|
+
void handleCopy();
|
|
134
|
+
},
|
|
135
|
+
children: /* @__PURE__ */ jsx(CopyGlyph, {})
|
|
136
|
+
}
|
|
137
|
+
),
|
|
138
|
+
/* @__PURE__ */ jsx("span", { className: textCopyableLiveClasses, "aria-live": "polite", children: liveText })
|
|
139
|
+
);
|
|
140
|
+
});
|
|
141
|
+
Text.displayName = "Text";
|
|
142
|
+
|
|
143
|
+
export {
|
|
144
|
+
Text
|
|
145
|
+
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Table
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-FTLA6FRU.mjs";
|
|
4
4
|
import {
|
|
5
5
|
Select
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-A2PQJEII.mjs";
|
|
7
7
|
import {
|
|
8
8
|
Popover
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-CQGDJU2H.mjs";
|
|
10
10
|
import {
|
|
11
11
|
Input
|
|
12
12
|
} from "./chunk-XE34TOCS.mjs";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
usePopup
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-S37KEELR.mjs";
|
|
4
4
|
import {
|
|
5
5
|
composeRefs,
|
|
6
6
|
renderOverlayTrigger
|
|
7
7
|
} from "./chunk-WWZZRB7H.mjs";
|
|
8
8
|
import {
|
|
9
9
|
renderOverlayPortal
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-OU2AV7DY.mjs";
|
|
11
11
|
|
|
12
12
|
// src/components/Tooltip.tsx
|
|
13
13
|
import { forwardRef, useId, useMemo } from "react";
|
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
} from "./chunk-4BJCH6FI.mjs";
|
|
5
5
|
import {
|
|
6
6
|
List
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-YDIEWFBM.mjs";
|
|
8
8
|
import {
|
|
9
9
|
Loading
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-VW6RNQK4.mjs";
|
|
11
11
|
import {
|
|
12
12
|
Text
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-FZQUUTWN.mjs";
|
|
14
14
|
import {
|
|
15
15
|
Card
|
|
16
16
|
} from "./chunk-WCIUNNIN.mjs";
|
|
@@ -335,7 +335,7 @@ function useAnchoredOverlay({
|
|
|
335
335
|
enabled: enabled && dismissOnOutside,
|
|
336
336
|
refs: [containerRef, referenceRef, floatingLayerRef, ...outsideRefs],
|
|
337
337
|
onOutsideClick: dismissOutside,
|
|
338
|
-
defer:
|
|
338
|
+
defer: true
|
|
339
339
|
});
|
|
340
340
|
useEscapeKey({
|
|
341
341
|
enabled: enabled && dismissOnEscape,
|