@x-plat/design-system 0.20.0 → 0.21.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/dist/chunk-2EGVOUGV.cjs +93 -0
- package/dist/chunk-2T3BVV7R.js +0 -0
- package/dist/chunk-3FYYFDKQ.js +159 -0
- package/dist/chunk-3M3GFSHJ.js +67 -0
- package/dist/chunk-3WBHUFOA.cjs +48 -0
- package/dist/chunk-3XYYZQR5.cjs +22 -0
- package/dist/chunk-4EF7NVAL.js +67 -0
- package/dist/chunk-4ISERXK2.cjs +1 -0
- package/dist/chunk-4KYHHJ6Z.cjs +250 -0
- package/dist/chunk-4NSRDRXC.cjs +70 -0
- package/dist/chunk-4OXMRSVE.cjs +99 -0
- package/dist/chunk-55EPYLXN.js +30 -0
- package/dist/chunk-5CE3ADO5.js +254 -0
- package/dist/chunk-5F6Y2JD6.cjs +1 -0
- package/dist/chunk-5FMTMXSP.cjs +127 -0
- package/dist/chunk-5POCKDDY.js +36 -0
- package/dist/chunk-5VDI56BV.js +33 -0
- package/dist/chunk-5WLBUPSK.js +77 -0
- package/dist/chunk-5WNNWQHD.cjs +272 -0
- package/dist/chunk-66STZB6I.cjs +404 -0
- package/dist/chunk-6AIKCZN7.js +1455 -0
- package/dist/chunk-6IUJJUVP.js +18 -0
- package/dist/chunk-6P2B3ZGP.js +79 -0
- package/dist/chunk-764ILIDG.cjs +22 -0
- package/dist/chunk-7B44DWC4.js +0 -0
- package/dist/chunk-7BE6ETFY.js +18 -0
- package/dist/chunk-7BSUS5A4.js +97 -0
- package/dist/chunk-7RPWCDEW.cjs +20 -0
- package/dist/chunk-7ULXHGLO.cjs +77 -0
- package/dist/chunk-7YOI5XOW.js +55 -0
- package/dist/chunk-AFVTM5CP.js +0 -0
- package/dist/chunk-AN2WSL3B.cjs +1 -0
- package/dist/chunk-AT5Y5GLS.cjs +118 -0
- package/dist/chunk-AWPO2FI7.js +404 -0
- package/dist/chunk-BGXHIDUR.js +103 -0
- package/dist/chunk-BPZXL5TP.js +99 -0
- package/dist/chunk-BRTS5GWV.js +275 -0
- package/dist/chunk-BS3MLZCK.cjs +97 -0
- package/dist/chunk-BSPYYE2U.js +36 -0
- package/dist/chunk-BWJAEB42.js +48 -0
- package/dist/chunk-C4RMTISI.cjs +18 -0
- package/dist/chunk-C6M4XVR7.cjs +36 -0
- package/dist/chunk-CGC4D5MP.cjs +89 -0
- package/dist/chunk-CIRQYSQW.js +70 -0
- package/dist/chunk-CLOTWJNP.cjs +310 -0
- package/dist/chunk-CS7ZY35M.cjs +49 -0
- package/dist/chunk-CUV4RLDE.js +89 -0
- package/dist/chunk-CZAMLFSE.cjs +275 -0
- package/dist/chunk-D7QZLJ3Z.cjs +18 -0
- package/dist/chunk-DMSAAZ3M.cjs +92 -0
- package/dist/chunk-DUIZC7VJ.cjs +36 -0
- package/dist/chunk-DVBF4BDH.js +43 -0
- package/dist/chunk-EETYMP6K.cjs +584 -0
- package/dist/chunk-EFQL7JPX.js +0 -0
- package/dist/chunk-EFU7IAF5.cjs +12 -0
- package/dist/chunk-F3M2H5EX.cjs +79 -0
- package/dist/chunk-F436V2SX.cjs +254 -0
- package/dist/chunk-F664X2OY.js +250 -0
- package/dist/chunk-FF7ELUQW.cjs +1 -0
- package/dist/chunk-G3HE4S3Q.cjs +296 -0
- package/dist/chunk-GOPD5KUK.js +23 -0
- package/dist/chunk-GYTB24V6.cjs +107 -0
- package/dist/chunk-GZ657SGO.js +310 -0
- package/dist/chunk-H2QN65L6.cjs +1 -0
- package/dist/chunk-H6WUT7CK.js +22 -0
- package/dist/chunk-H76OQ75T.js +49 -0
- package/dist/chunk-HA3XONYI.js +18 -0
- package/dist/chunk-HF3UFXEU.js +296 -0
- package/dist/chunk-HGA47QVV.cjs +55 -0
- package/dist/chunk-HHPPAMXF.cjs +674 -0
- package/dist/chunk-HLV2XIE2.cjs +385 -0
- package/dist/chunk-HNQGIL45.cjs +96 -0
- package/dist/chunk-HQ37R7T3.js +53 -0
- package/dist/chunk-HXUGW4RR.js +187 -0
- package/dist/chunk-HYPRLWD3.js +272 -0
- package/dist/chunk-I7TLJUTP.cjs +6 -0
- package/dist/chunk-ICTWDTKC.cjs +1 -0
- package/dist/chunk-IPYKHDP4.cjs +187 -0
- package/dist/chunk-IRKREQ2X.cjs +18 -0
- package/dist/chunk-IVJJBMRY.js +92 -0
- package/dist/chunk-JPVIVOFG.js +26 -0
- package/dist/chunk-JYNBNSNF.js +151 -0
- package/dist/chunk-JZC3BXAC.js +93 -0
- package/dist/chunk-K5XPQWXN.cjs +92 -0
- package/dist/chunk-KQ3GOMHL.js +31 -0
- package/dist/chunk-KUJH72U6.cjs +159 -0
- package/dist/chunk-KVUXLC6M.cjs +479 -0
- package/dist/chunk-KZOJN57Q.js +19 -0
- package/dist/chunk-L3XPL4NP.cjs +53 -0
- package/dist/chunk-LOEMSXYB.js +0 -0
- package/dist/chunk-LU4KBPNG.cjs +23 -0
- package/dist/chunk-MWWWPQDB.js +26 -0
- package/dist/chunk-NCBB3WUJ.js +562 -0
- package/dist/chunk-NGCZTZST.cjs +562 -0
- package/dist/chunk-NSDKALIS.cjs +67 -0
- package/dist/chunk-NZHCRLNB.cjs +26 -0
- package/dist/chunk-OL4NANHB.js +0 -0
- package/dist/chunk-OTJRNKLR.js +96 -0
- package/dist/chunk-OWWFKTSK.js +0 -0
- package/dist/chunk-P2E3PB62.cjs +99 -0
- package/dist/chunk-P2QVFR7S.js +20 -0
- package/dist/chunk-P6ZGIYY7.cjs +18 -0
- package/dist/chunk-PFGSJJRY.cjs +19 -0
- package/dist/chunk-PNIUW7AJ.cjs +32 -0
- package/dist/chunk-Q2M2ONGO.js +70 -0
- package/dist/chunk-Q4PGP5KE.cjs +562 -0
- package/dist/chunk-QAI2YQPY.cjs +51 -0
- package/dist/chunk-QCD7UEZ3.cjs +59 -0
- package/dist/chunk-QEZ4R3SK.js +6 -0
- package/dist/chunk-QKDCPM2D.cjs +23 -0
- package/dist/chunk-QRGG3V7W.cjs +59 -0
- package/dist/chunk-QURIHUEC.js +107 -0
- package/dist/chunk-QY742LWN.js +30 -0
- package/dist/chunk-QYMRGYTN.js +127 -0
- package/dist/chunk-RLKJ2RZG.js +23 -0
- package/dist/chunk-RRR5BUOM.cjs +30 -0
- package/dist/chunk-RU3FCVXM.cjs +1 -0
- package/dist/chunk-RYTDVTV2.js +32 -0
- package/dist/chunk-RYYGUYDE.js +92 -0
- package/dist/chunk-SGLP4U3Y.cjs +67 -0
- package/dist/chunk-SJC543ZK.js +71 -0
- package/dist/chunk-SLYQK4SC.js +20 -0
- package/dist/chunk-SMLCOMLS.js +2888 -0
- package/dist/chunk-SNMOPLMH.cjs +372 -0
- package/dist/chunk-TRJUJYW7.cjs +151 -0
- package/dist/chunk-TTY5PE3P.js +30 -0
- package/dist/chunk-TXARYG3J.js +22 -0
- package/dist/chunk-TYXJU4EF.js +18 -0
- package/dist/chunk-U3PC7FYZ.cjs +26 -0
- package/dist/chunk-U67JM2WL.cjs +34 -0
- package/dist/chunk-UARGO5UG.js +59 -0
- package/dist/chunk-UCYE3H3F.cjs +43 -0
- package/dist/chunk-UGEGN35F.js +118 -0
- package/dist/chunk-UHUA3GQC.cjs +30 -0
- package/dist/chunk-UJQN477L.js +59 -0
- package/dist/chunk-UMX7DTFZ.cjs +70 -0
- package/dist/chunk-UT42P54P.js +372 -0
- package/dist/chunk-V76ZRGHQ.cjs +1 -0
- package/dist/chunk-VCIK366Y.cjs +1455 -0
- package/dist/chunk-VMA74ABT.cjs +137 -0
- package/dist/chunk-VSA62N2O.js +12 -0
- package/dist/chunk-WDAFLVQK.js +479 -0
- package/dist/chunk-WHMLMAMO.js +674 -0
- package/dist/chunk-WNBLKKLM.js +0 -0
- package/dist/chunk-WQ2GY7F3.js +46 -0
- package/dist/chunk-WRLCCK3M.cjs +30 -0
- package/dist/chunk-WVCZIOLY.js +562 -0
- package/dist/chunk-WZLGJQLW.js +385 -0
- package/dist/chunk-XB6FEBK6.js +34 -0
- package/dist/chunk-XMERDSRE.js +75 -0
- package/dist/chunk-XMLFKZYY.js +137 -0
- package/dist/chunk-XMM52J3T.js +584 -0
- package/dist/chunk-XZ7C5CGB.cjs +103 -0
- package/dist/chunk-YGFBAOKX.js +51 -0
- package/dist/chunk-YIN552MF.cjs +20 -0
- package/dist/chunk-YLC42E65.cjs +31 -0
- package/dist/chunk-YOTXRYJL.cjs +46 -0
- package/dist/chunk-ZAUGJZK7.js +99 -0
- package/dist/chunk-ZIZOQTDG.cjs +75 -0
- package/dist/chunk-ZMSV5VZI.cjs +2888 -0
- package/dist/chunk-ZN6MLZAE.cjs +71 -0
- package/dist/chunk-ZNCT6HXA.cjs +33 -0
- package/dist/components/Accordion/index.cjs +5 -1036
- package/dist/components/Accordion/index.js +5 -999
- package/dist/components/Alert/index.cjs +4 -69
- package/dist/components/Alert/index.js +4 -42
- package/dist/components/AutoResizeTextArea/index.cjs +6 -260
- package/dist/components/AutoResizeTextArea/index.js +6 -223
- package/dist/components/Avatar/index.cjs +4 -65
- package/dist/components/Avatar/index.js +4 -38
- package/dist/components/Badge/index.cjs +6 -69
- package/dist/components/Badge/index.js +5 -40
- package/dist/components/Box/index.cjs +4 -58
- package/dist/components/Box/index.js +4 -31
- package/dist/components/Breadcrumb/index.cjs +4 -42
- package/dist/components/Breadcrumb/index.js +3 -14
- package/dist/components/Button/index.cjs +5 -65
- package/dist/components/Button/index.js +5 -38
- package/dist/components/Calendar/index.cjs +6 -1317
- package/dist/components/Calendar/index.js +10 -1281
- package/dist/components/CardTab/index.cjs +4 -120
- package/dist/components/CardTab/index.js +4 -83
- package/dist/components/Chart/index.cjs +5 -708
- package/dist/components/Chart/index.js +4 -670
- package/dist/components/ChatInput/index.cjs +9 -390
- package/dist/components/ChatInput/index.js +9 -353
- package/dist/components/CheckBox/index.cjs +20 -1125
- package/dist/components/CheckBox/index.js +17 -1095
- package/dist/components/Chip/index.cjs +5 -55
- package/dist/components/Chip/index.js +5 -28
- package/dist/components/DatePicker/index.cjs +16 -2136
- package/dist/components/DatePicker/index.js +19 -2099
- package/dist/components/Divider/index.cjs +4 -58
- package/dist/components/Divider/index.js +4 -31
- package/dist/components/Drawer/index.cjs +5 -190
- package/dist/components/Drawer/index.js +5 -153
- package/dist/components/Dropdown/index.cjs +7 -375
- package/dist/components/Dropdown/index.js +7 -338
- package/dist/components/Editor/index.cjs +6 -1486
- package/dist/components/Editor/index.css +53 -0
- package/dist/components/Editor/index.d.cts +13 -0
- package/dist/components/Editor/index.d.ts +13 -0
- package/dist/components/Editor/index.js +6 -1453
- package/dist/components/EmptyState/index.cjs +4 -42
- package/dist/components/EmptyState/index.js +3 -14
- package/dist/components/FieldMessage/index.cjs +7 -182
- package/dist/components/FieldMessage/index.js +8 -154
- package/dist/components/FileUpload/index.cjs +7 -1171
- package/dist/components/FileUpload/index.js +7 -1134
- package/dist/components/HtmlTypeWriter/index.cjs +3 -171
- package/dist/components/HtmlTypeWriter/index.js +3 -133
- package/dist/components/IconButton/index.cjs +4 -65
- package/dist/components/IconButton/index.js +4 -38
- package/dist/components/ImageSelector/index.cjs +8 -1214
- package/dist/components/ImageSelector/index.js +8 -1177
- package/dist/components/Input/index.cjs +7 -429
- package/dist/components/Input/index.js +8 -392
- package/dist/components/Link/index.cjs +4 -61
- package/dist/components/Link/index.js +4 -34
- package/dist/components/LinkButton/index.cjs +5 -61
- package/dist/components/LinkButton/index.js +5 -34
- package/dist/components/Modal/index.cjs +5 -190
- package/dist/components/Modal/index.js +5 -153
- package/dist/components/NotificationBadge/index.cjs +5 -68
- package/dist/components/NotificationBadge/index.js +5 -40
- package/dist/components/Pagination/index.cjs +6 -1034
- package/dist/components/Pagination/index.js +6 -1007
- package/dist/components/PopOver/index.cjs +7 -363
- package/dist/components/PopOver/index.js +7 -326
- package/dist/components/Progress/index.cjs +5 -84
- package/dist/components/Progress/index.js +5 -57
- package/dist/components/Radio/index.cjs +7 -274
- package/dist/components/Radio/index.js +8 -237
- package/dist/components/Select/index.cjs +10 -1577
- package/dist/components/Select/index.js +11 -1540
- package/dist/components/Skeleton/index.cjs +4 -71
- package/dist/components/Skeleton/index.js +4 -44
- package/dist/components/Spinner/index.cjs +5 -88
- package/dist/components/Spinner/index.js +5 -61
- package/dist/components/Stat/index.cjs +5 -81
- package/dist/components/Stat/index.js +5 -54
- package/dist/components/Steps/index.cjs +7 -968
- package/dist/components/Steps/index.js +7 -941
- package/dist/components/Swiper/index.cjs +4 -357
- package/dist/components/Swiper/index.js +4 -320
- package/dist/components/Switch/index.cjs +7 -252
- package/dist/components/Switch/index.js +7 -215
- package/dist/components/Tab/index.cjs +4 -144
- package/dist/components/Tab/index.js +4 -107
- package/dist/components/Table/index.cjs +4 -337
- package/dist/components/Table/index.js +8 -300
- package/dist/components/Tag/index.cjs +6 -969
- package/dist/components/Tag/index.js +6 -942
- package/dist/components/TextArea/index.cjs +6 -229
- package/dist/components/TextArea/index.js +6 -192
- package/dist/components/TimePicker/index.cjs +9 -579
- package/dist/components/TimePicker/index.js +9 -542
- package/dist/components/Toast/index.cjs +5 -146
- package/dist/components/Toast/index.js +5 -108
- package/dist/components/ToggleChip/index.cjs +5 -66
- package/dist/components/ToggleChip/index.js +5 -39
- package/dist/components/Tooltip/index.cjs +6 -204
- package/dist/components/Tooltip/index.js +6 -167
- package/dist/components/Tour/index.cjs +6 -414
- package/dist/components/Tour/index.js +6 -377
- package/dist/components/Video/index.cjs +7 -796
- package/dist/components/Video/index.js +7 -759
- package/dist/components/index.cjs +140 -8342
- package/dist/components/index.js +190 -8288
- package/dist/index.cjs +903 -13318
- package/dist/index.js +524 -12526
- package/dist/layout/Grid/FullGrid/index.cjs +4 -46
- package/dist/layout/Grid/FullGrid/index.js +3 -18
- package/dist/layout/Grid/FullScreen/index.cjs +4 -46
- package/dist/layout/Grid/FullScreen/index.js +3 -18
- package/dist/layout/Grid/Item/index.cjs +5 -68
- package/dist/layout/Grid/Item/index.js +5 -41
- package/dist/layout/Grid/index.cjs +14 -109
- package/dist/layout/Grid/index.js +14 -79
- package/dist/layout/Header/index.cjs +4 -44
- package/dist/layout/Header/index.js +3 -16
- package/dist/layout/Layout/index.cjs +4 -42
- package/dist/layout/Layout/index.js +3 -14
- package/dist/layout/SideBar/index.cjs +6 -96
- package/dist/layout/SideBar/index.js +6 -57
- package/dist/layout/index.cjs +38 -209
- package/dist/layout/index.js +27 -153
- package/dist/tokens/index.cjs +627 -6119
- package/dist/tokens/index.js +324 -5489
- package/guidelines/components/editor.md +3 -0
- package/guidelines/setup.md +7 -0
- package/package.json +6 -3
|
@@ -1,150 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
29
2
|
|
|
30
|
-
// src/components/Toast/index.ts
|
|
31
|
-
var Toast_exports = {};
|
|
32
|
-
__export(Toast_exports, {
|
|
33
|
-
ToastProvider: () => ToastProvider,
|
|
34
|
-
useToast: () => useToast
|
|
35
|
-
});
|
|
36
|
-
module.exports = __toCommonJS(Toast_exports);
|
|
37
3
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
var import_react_dom = require("react-dom");
|
|
4
|
+
var _chunk4OXMRSVEcjs = require('../../chunk-4OXMRSVE.cjs');
|
|
5
|
+
require('../../chunk-PFGSJJRY.cjs');
|
|
41
6
|
|
|
42
|
-
// ../../node_modules/clsx/dist/clsx.mjs
|
|
43
|
-
function r(e) {
|
|
44
|
-
var t, f, n = "";
|
|
45
|
-
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
46
|
-
else if ("object" == typeof e) if (Array.isArray(e)) {
|
|
47
|
-
var o = e.length;
|
|
48
|
-
for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
49
|
-
} else for (f in e) e[f] && (n && (n += " "), n += f);
|
|
50
|
-
return n;
|
|
51
|
-
}
|
|
52
|
-
function clsx() {
|
|
53
|
-
for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
54
|
-
return n;
|
|
55
|
-
}
|
|
56
|
-
var clsx_default = clsx;
|
|
57
7
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
var ToastContext = import_react.default.createContext(null);
|
|
61
|
-
var useToast = () => {
|
|
62
|
-
const ctx = import_react.default.useContext(ToastContext);
|
|
63
|
-
if (!ctx) throw new Error("useToast must be used within ToastProvider");
|
|
64
|
-
return ctx;
|
|
65
|
-
};
|
|
66
|
-
var EXIT_DURATION = 300;
|
|
67
|
-
var ToastItemComponent = ({ item, isExiting, onClose }) => {
|
|
68
|
-
const ref = import_react.default.useRef(null);
|
|
69
|
-
const [height, setHeight] = import_react.default.useState(void 0);
|
|
70
|
-
import_react.default.useEffect(() => {
|
|
71
|
-
if (ref.current && !isExiting) {
|
|
72
|
-
setHeight(ref.current.offsetHeight);
|
|
73
|
-
}
|
|
74
|
-
}, [isExiting]);
|
|
75
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
76
|
-
"div",
|
|
77
|
-
{
|
|
78
|
-
className: clsx_default("lib-xplat-toast-wrapper", { exit: isExiting }),
|
|
79
|
-
style: {
|
|
80
|
-
maxHeight: isExiting ? 0 : height ?? "none",
|
|
81
|
-
marginBottom: isExiting ? 0 : void 0
|
|
82
|
-
},
|
|
83
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
84
|
-
"div",
|
|
85
|
-
{
|
|
86
|
-
ref,
|
|
87
|
-
className: clsx_default("lib-xplat-toast", item.type, { exit: isExiting }),
|
|
88
|
-
role: "alert",
|
|
89
|
-
children: [
|
|
90
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "message", children: item.message }),
|
|
91
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { className: "close-btn", onClick: onClose, "aria-label": "\uB2EB\uAE30", children: "\xD7" })
|
|
92
|
-
]
|
|
93
|
-
}
|
|
94
|
-
)
|
|
95
|
-
}
|
|
96
|
-
);
|
|
97
|
-
};
|
|
98
|
-
var ToastProvider = ({
|
|
99
|
-
children,
|
|
100
|
-
position = "top-right"
|
|
101
|
-
}) => {
|
|
102
|
-
const [toasts, setToasts] = import_react.default.useState([]);
|
|
103
|
-
const [removing, setRemoving] = import_react.default.useState(/* @__PURE__ */ new Set());
|
|
104
|
-
const [mounted, setMounted] = import_react.default.useState(false);
|
|
105
|
-
import_react.default.useEffect(() => {
|
|
106
|
-
setMounted(true);
|
|
107
|
-
}, []);
|
|
108
|
-
const remove = import_react.default.useCallback((id) => {
|
|
109
|
-
setRemoving((prev) => new Set(prev).add(id));
|
|
110
|
-
setTimeout(() => {
|
|
111
|
-
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
112
|
-
setRemoving((prev) => {
|
|
113
|
-
const next = new Set(prev);
|
|
114
|
-
next.delete(id);
|
|
115
|
-
return next;
|
|
116
|
-
});
|
|
117
|
-
}, EXIT_DURATION);
|
|
118
|
-
}, []);
|
|
119
|
-
const toast = import_react.default.useCallback(
|
|
120
|
-
(type, message, duration = 3e3) => {
|
|
121
|
-
const id = `${Date.now()}-${Math.random()}`;
|
|
122
|
-
setToasts((prev) => [...prev, { id, type, message }]);
|
|
123
|
-
if (duration > 0) {
|
|
124
|
-
setTimeout(() => remove(id), duration);
|
|
125
|
-
}
|
|
126
|
-
},
|
|
127
|
-
[remove]
|
|
128
|
-
);
|
|
129
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ToastContext.Provider, { value: { toast }, children: [
|
|
130
|
-
children,
|
|
131
|
-
mounted && (0, import_react_dom.createPortal)(
|
|
132
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: clsx_default("lib-xplat-toast-container", position), children: toasts.map((t) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
133
|
-
ToastItemComponent,
|
|
134
|
-
{
|
|
135
|
-
item: t,
|
|
136
|
-
isExiting: removing.has(t.id),
|
|
137
|
-
onClose: () => remove(t.id)
|
|
138
|
-
},
|
|
139
|
-
t.id
|
|
140
|
-
)) }),
|
|
141
|
-
document.body
|
|
142
|
-
)
|
|
143
|
-
] });
|
|
144
|
-
};
|
|
145
|
-
ToastProvider.displayName = "ToastProvider";
|
|
146
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
147
|
-
0 && (module.exports = {
|
|
148
|
-
ToastProvider,
|
|
149
|
-
useToast
|
|
150
|
-
});
|
|
8
|
+
|
|
9
|
+
exports.ToastProvider = _chunk4OXMRSVEcjs.ToastProvider; exports.useToast = _chunk4OXMRSVEcjs.useToast;
|
|
@@ -1,111 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
function r(e) {
|
|
7
|
-
var t, f, n = "";
|
|
8
|
-
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
9
|
-
else if ("object" == typeof e) if (Array.isArray(e)) {
|
|
10
|
-
var o = e.length;
|
|
11
|
-
for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
12
|
-
} else for (f in e) e[f] && (n && (n += " "), n += f);
|
|
13
|
-
return n;
|
|
14
|
-
}
|
|
15
|
-
function clsx() {
|
|
16
|
-
for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
17
|
-
return n;
|
|
18
|
-
}
|
|
19
|
-
var clsx_default = clsx;
|
|
20
|
-
|
|
21
|
-
// src/components/Toast/Toast.tsx
|
|
22
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
23
|
-
var ToastContext = React.createContext(null);
|
|
24
|
-
var useToast = () => {
|
|
25
|
-
const ctx = React.useContext(ToastContext);
|
|
26
|
-
if (!ctx) throw new Error("useToast must be used within ToastProvider");
|
|
27
|
-
return ctx;
|
|
28
|
-
};
|
|
29
|
-
var EXIT_DURATION = 300;
|
|
30
|
-
var ToastItemComponent = ({ item, isExiting, onClose }) => {
|
|
31
|
-
const ref = React.useRef(null);
|
|
32
|
-
const [height, setHeight] = React.useState(void 0);
|
|
33
|
-
React.useEffect(() => {
|
|
34
|
-
if (ref.current && !isExiting) {
|
|
35
|
-
setHeight(ref.current.offsetHeight);
|
|
36
|
-
}
|
|
37
|
-
}, [isExiting]);
|
|
38
|
-
return /* @__PURE__ */ jsx(
|
|
39
|
-
"div",
|
|
40
|
-
{
|
|
41
|
-
className: clsx_default("lib-xplat-toast-wrapper", { exit: isExiting }),
|
|
42
|
-
style: {
|
|
43
|
-
maxHeight: isExiting ? 0 : height ?? "none",
|
|
44
|
-
marginBottom: isExiting ? 0 : void 0
|
|
45
|
-
},
|
|
46
|
-
children: /* @__PURE__ */ jsxs(
|
|
47
|
-
"div",
|
|
48
|
-
{
|
|
49
|
-
ref,
|
|
50
|
-
className: clsx_default("lib-xplat-toast", item.type, { exit: isExiting }),
|
|
51
|
-
role: "alert",
|
|
52
|
-
children: [
|
|
53
|
-
/* @__PURE__ */ jsx("span", { className: "message", children: item.message }),
|
|
54
|
-
/* @__PURE__ */ jsx("button", { className: "close-btn", onClick: onClose, "aria-label": "\uB2EB\uAE30", children: "\xD7" })
|
|
55
|
-
]
|
|
56
|
-
}
|
|
57
|
-
)
|
|
58
|
-
}
|
|
59
|
-
);
|
|
60
|
-
};
|
|
61
|
-
var ToastProvider = ({
|
|
62
|
-
children,
|
|
63
|
-
position = "top-right"
|
|
64
|
-
}) => {
|
|
65
|
-
const [toasts, setToasts] = React.useState([]);
|
|
66
|
-
const [removing, setRemoving] = React.useState(/* @__PURE__ */ new Set());
|
|
67
|
-
const [mounted, setMounted] = React.useState(false);
|
|
68
|
-
React.useEffect(() => {
|
|
69
|
-
setMounted(true);
|
|
70
|
-
}, []);
|
|
71
|
-
const remove = React.useCallback((id) => {
|
|
72
|
-
setRemoving((prev) => new Set(prev).add(id));
|
|
73
|
-
setTimeout(() => {
|
|
74
|
-
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
75
|
-
setRemoving((prev) => {
|
|
76
|
-
const next = new Set(prev);
|
|
77
|
-
next.delete(id);
|
|
78
|
-
return next;
|
|
79
|
-
});
|
|
80
|
-
}, EXIT_DURATION);
|
|
81
|
-
}, []);
|
|
82
|
-
const toast = React.useCallback(
|
|
83
|
-
(type, message, duration = 3e3) => {
|
|
84
|
-
const id = `${Date.now()}-${Math.random()}`;
|
|
85
|
-
setToasts((prev) => [...prev, { id, type, message }]);
|
|
86
|
-
if (duration > 0) {
|
|
87
|
-
setTimeout(() => remove(id), duration);
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
[remove]
|
|
91
|
-
);
|
|
92
|
-
return /* @__PURE__ */ jsxs(ToastContext.Provider, { value: { toast }, children: [
|
|
93
|
-
children,
|
|
94
|
-
mounted && createPortal(
|
|
95
|
-
/* @__PURE__ */ jsx("div", { className: clsx_default("lib-xplat-toast-container", position), children: toasts.map((t) => /* @__PURE__ */ jsx(
|
|
96
|
-
ToastItemComponent,
|
|
97
|
-
{
|
|
98
|
-
item: t,
|
|
99
|
-
isExiting: removing.has(t.id),
|
|
100
|
-
onClose: () => remove(t.id)
|
|
101
|
-
},
|
|
102
|
-
t.id
|
|
103
|
-
)) }),
|
|
104
|
-
document.body
|
|
105
|
-
)
|
|
106
|
-
] });
|
|
107
|
-
};
|
|
108
|
-
ToastProvider.displayName = "ToastProvider";
|
|
1
|
+
import {
|
|
2
|
+
ToastProvider,
|
|
3
|
+
useToast
|
|
4
|
+
} from "../../chunk-ZAUGJZK7.js";
|
|
5
|
+
import "../../chunk-KZOJN57Q.js";
|
|
109
6
|
export {
|
|
110
7
|
ToastProvider,
|
|
111
8
|
useToast
|
|
@@ -1,69 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
19
2
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
ToggleChip: () => ToggleChip_default
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(ToggleChip_exports);
|
|
3
|
+
var _chunkYLC42E65cjs = require('../../chunk-YLC42E65.cjs');
|
|
4
|
+
require('../../chunk-ICTWDTKC.cjs');
|
|
5
|
+
require('../../chunk-PFGSJJRY.cjs');
|
|
26
6
|
|
|
27
|
-
// ../../node_modules/clsx/dist/clsx.mjs
|
|
28
|
-
function r(e) {
|
|
29
|
-
var t, f, n = "";
|
|
30
|
-
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
31
|
-
else if ("object" == typeof e) if (Array.isArray(e)) {
|
|
32
|
-
var o = e.length;
|
|
33
|
-
for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
34
|
-
} else for (f in e) e[f] && (n && (n += " "), n += f);
|
|
35
|
-
return n;
|
|
36
|
-
}
|
|
37
|
-
function clsx() {
|
|
38
|
-
for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
39
|
-
return n;
|
|
40
|
-
}
|
|
41
|
-
var clsx_default = clsx;
|
|
42
7
|
|
|
43
|
-
|
|
44
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
45
|
-
var ToggleChip = (props) => {
|
|
46
|
-
const { children, selected = false, onClick, disabled = false, size = "md" } = props;
|
|
47
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
48
|
-
"button",
|
|
49
|
-
{
|
|
50
|
-
type: "button",
|
|
51
|
-
className: clsx_default(
|
|
52
|
-
"lib-xplat-chip",
|
|
53
|
-
"lib-xplat-toggle-chip",
|
|
54
|
-
size,
|
|
55
|
-
selected ? "selected" : "unselected"
|
|
56
|
-
),
|
|
57
|
-
"aria-pressed": selected,
|
|
58
|
-
disabled,
|
|
59
|
-
onClick,
|
|
60
|
-
children
|
|
61
|
-
}
|
|
62
|
-
);
|
|
63
|
-
};
|
|
64
|
-
ToggleChip.displayName = "ToggleChip";
|
|
65
|
-
var ToggleChip_default = ToggleChip;
|
|
66
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
67
|
-
0 && (module.exports = {
|
|
68
|
-
ToggleChip
|
|
69
|
-
});
|
|
8
|
+
exports.ToggleChip = _chunkYLC42E65cjs.ToggleChip_default;
|
|
@@ -1,42 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var o = e.length;
|
|
7
|
-
for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
8
|
-
} else for (f in e) e[f] && (n && (n += " "), n += f);
|
|
9
|
-
return n;
|
|
10
|
-
}
|
|
11
|
-
function clsx() {
|
|
12
|
-
for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
13
|
-
return n;
|
|
14
|
-
}
|
|
15
|
-
var clsx_default = clsx;
|
|
16
|
-
|
|
17
|
-
// src/components/ToggleChip/ToggleChip.tsx
|
|
18
|
-
import { jsx } from "react/jsx-runtime";
|
|
19
|
-
var ToggleChip = (props) => {
|
|
20
|
-
const { children, selected = false, onClick, disabled = false, size = "md" } = props;
|
|
21
|
-
return /* @__PURE__ */ jsx(
|
|
22
|
-
"button",
|
|
23
|
-
{
|
|
24
|
-
type: "button",
|
|
25
|
-
className: clsx_default(
|
|
26
|
-
"lib-xplat-chip",
|
|
27
|
-
"lib-xplat-toggle-chip",
|
|
28
|
-
size,
|
|
29
|
-
selected ? "selected" : "unselected"
|
|
30
|
-
),
|
|
31
|
-
"aria-pressed": selected,
|
|
32
|
-
disabled,
|
|
33
|
-
onClick,
|
|
34
|
-
children
|
|
35
|
-
}
|
|
36
|
-
);
|
|
37
|
-
};
|
|
38
|
-
ToggleChip.displayName = "ToggleChip";
|
|
39
|
-
var ToggleChip_default = ToggleChip;
|
|
1
|
+
import {
|
|
2
|
+
ToggleChip_default
|
|
3
|
+
} from "../../chunk-KQ3GOMHL.js";
|
|
4
|
+
import "../../chunk-EFQL7JPX.js";
|
|
5
|
+
import "../../chunk-KZOJN57Q.js";
|
|
40
6
|
export {
|
|
41
7
|
ToggleChip_default as ToggleChip
|
|
42
8
|
};
|
|
@@ -1,207 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
29
2
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(Tooltip_exports);
|
|
3
|
+
var _chunkTRJUJYW7cjs = require('../../chunk-TRJUJYW7.cjs');
|
|
4
|
+
require('../../chunk-EFU7IAF5.cjs');
|
|
5
|
+
require('../../chunk-4ISERXK2.cjs');
|
|
6
|
+
require('../../chunk-PFGSJJRY.cjs');
|
|
36
7
|
|
|
37
|
-
// src/components/Tooltip/Tooltip.tsx
|
|
38
|
-
var import_react = __toESM(require("react"), 1);
|
|
39
8
|
|
|
40
|
-
|
|
41
|
-
var import_react_dom = __toESM(require("react-dom"), 1);
|
|
42
|
-
var Portal = ({ children, container }) => {
|
|
43
|
-
if (typeof document === "undefined") return null;
|
|
44
|
-
return import_react_dom.default.createPortal(children, container ?? document.body);
|
|
45
|
-
};
|
|
46
|
-
Portal.displayName = "Portal";
|
|
47
|
-
var Portal_default = Portal;
|
|
48
|
-
|
|
49
|
-
// ../../node_modules/clsx/dist/clsx.mjs
|
|
50
|
-
function r(e) {
|
|
51
|
-
var t, f, n = "";
|
|
52
|
-
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
53
|
-
else if ("object" == typeof e) if (Array.isArray(e)) {
|
|
54
|
-
var o = e.length;
|
|
55
|
-
for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
56
|
-
} else for (f in e) e[f] && (n && (n += " "), n += f);
|
|
57
|
-
return n;
|
|
58
|
-
}
|
|
59
|
-
function clsx() {
|
|
60
|
-
for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
61
|
-
return n;
|
|
62
|
-
}
|
|
63
|
-
var clsx_default = clsx;
|
|
64
|
-
|
|
65
|
-
// src/components/Tooltip/Tooltip.tsx
|
|
66
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
67
|
-
var OFFSET = 12;
|
|
68
|
-
var GAP = 8;
|
|
69
|
-
var SHOW_DELAY = 300;
|
|
70
|
-
var Tooltip = (props) => {
|
|
71
|
-
const {
|
|
72
|
-
children,
|
|
73
|
-
title,
|
|
74
|
-
description,
|
|
75
|
-
variant,
|
|
76
|
-
type,
|
|
77
|
-
follow = false,
|
|
78
|
-
disabled = false
|
|
79
|
-
} = props;
|
|
80
|
-
const shape = variant ?? type ?? "dark";
|
|
81
|
-
const triggerRef = import_react.default.useRef(null);
|
|
82
|
-
const tooltipRef = import_react.default.useRef(null);
|
|
83
|
-
const [visible, setVisible] = import_react.default.useState(false);
|
|
84
|
-
const [pos, setPos] = import_react.default.useState({ left: 0, top: 0 });
|
|
85
|
-
const delayTimer = import_react.default.useRef(0);
|
|
86
|
-
const rafRef = import_react.default.useRef(0);
|
|
87
|
-
const cursor = import_react.default.useRef(null);
|
|
88
|
-
const clamp = import_react.default.useCallback((left, top, w, h) => {
|
|
89
|
-
const vw = window.innerWidth;
|
|
90
|
-
const vh = window.innerHeight;
|
|
91
|
-
return {
|
|
92
|
-
left: Math.min(Math.max(GAP, left), Math.max(GAP, vw - w - GAP)),
|
|
93
|
-
top: Math.min(Math.max(GAP, top), Math.max(GAP, vh - h - GAP))
|
|
94
|
-
};
|
|
95
|
-
}, []);
|
|
96
|
-
const placeAtCursor = import_react.default.useCallback((x, y) => {
|
|
97
|
-
const el = tooltipRef.current;
|
|
98
|
-
if (!el) return;
|
|
99
|
-
const w = el.offsetWidth;
|
|
100
|
-
const h = el.offsetHeight;
|
|
101
|
-
let left = x + OFFSET;
|
|
102
|
-
let top = y - h - OFFSET;
|
|
103
|
-
if (left + w > window.innerWidth - GAP) left = x - w - OFFSET;
|
|
104
|
-
if (top < GAP) top = y + OFFSET;
|
|
105
|
-
setPos(clamp(left, top, w, h));
|
|
106
|
-
}, [clamp]);
|
|
107
|
-
const placeAtTrigger = import_react.default.useCallback(() => {
|
|
108
|
-
const el = tooltipRef.current;
|
|
109
|
-
const trigger = triggerRef.current;
|
|
110
|
-
if (!el || !trigger) return;
|
|
111
|
-
const w = el.offsetWidth;
|
|
112
|
-
const h = el.offsetHeight;
|
|
113
|
-
const rect = trigger.getBoundingClientRect();
|
|
114
|
-
let top = rect.top - h - GAP;
|
|
115
|
-
if (top < GAP) top = rect.bottom + GAP;
|
|
116
|
-
const left = rect.left + rect.width / 2 - w / 2;
|
|
117
|
-
setPos(clamp(left, top, w, h));
|
|
118
|
-
}, [clamp]);
|
|
119
|
-
const reposition = import_react.default.useCallback(() => {
|
|
120
|
-
if (follow && cursor.current) {
|
|
121
|
-
placeAtCursor(cursor.current.x, cursor.current.y);
|
|
122
|
-
} else {
|
|
123
|
-
placeAtTrigger();
|
|
124
|
-
}
|
|
125
|
-
}, [follow, placeAtCursor, placeAtTrigger]);
|
|
126
|
-
const handleMouseEnter = import_react.default.useCallback((e) => {
|
|
127
|
-
if (disabled) return;
|
|
128
|
-
cursor.current = { x: e.clientX, y: e.clientY };
|
|
129
|
-
delayTimer.current = window.setTimeout(() => setVisible(true), SHOW_DELAY);
|
|
130
|
-
}, [disabled]);
|
|
131
|
-
const handleMouseMove = import_react.default.useCallback((e) => {
|
|
132
|
-
cursor.current = { x: e.clientX, y: e.clientY };
|
|
133
|
-
if (!visible || !follow) return;
|
|
134
|
-
cancelAnimationFrame(rafRef.current);
|
|
135
|
-
rafRef.current = requestAnimationFrame(() => {
|
|
136
|
-
if (cursor.current) placeAtCursor(cursor.current.x, cursor.current.y);
|
|
137
|
-
});
|
|
138
|
-
}, [visible, follow, placeAtCursor]);
|
|
139
|
-
const close = import_react.default.useCallback(() => {
|
|
140
|
-
window.clearTimeout(delayTimer.current);
|
|
141
|
-
cancelAnimationFrame(rafRef.current);
|
|
142
|
-
setVisible(false);
|
|
143
|
-
}, []);
|
|
144
|
-
const handleMouseLeave = import_react.default.useCallback(() => {
|
|
145
|
-
cursor.current = null;
|
|
146
|
-
close();
|
|
147
|
-
}, [close]);
|
|
148
|
-
const handleFocus = import_react.default.useCallback(() => {
|
|
149
|
-
if (disabled) return;
|
|
150
|
-
cursor.current = null;
|
|
151
|
-
setVisible(true);
|
|
152
|
-
}, [disabled]);
|
|
153
|
-
import_react.default.useLayoutEffect(() => {
|
|
154
|
-
if (!visible) return;
|
|
155
|
-
reposition();
|
|
156
|
-
}, [visible, reposition]);
|
|
157
|
-
import_react.default.useEffect(() => {
|
|
158
|
-
if (!visible || follow) return;
|
|
159
|
-
const onChange = () => placeAtTrigger();
|
|
160
|
-
window.addEventListener("scroll", onChange, true);
|
|
161
|
-
window.addEventListener("resize", onChange);
|
|
162
|
-
return () => {
|
|
163
|
-
window.removeEventListener("scroll", onChange, true);
|
|
164
|
-
window.removeEventListener("resize", onChange);
|
|
165
|
-
};
|
|
166
|
-
}, [visible, follow, placeAtTrigger]);
|
|
167
|
-
import_react.default.useEffect(() => () => {
|
|
168
|
-
window.clearTimeout(delayTimer.current);
|
|
169
|
-
cancelAnimationFrame(rafRef.current);
|
|
170
|
-
}, []);
|
|
171
|
-
if (!title && !description) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
|
|
172
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
173
|
-
"div",
|
|
174
|
-
{
|
|
175
|
-
ref: triggerRef,
|
|
176
|
-
className: "lib-xplat-tooltip-trigger",
|
|
177
|
-
onMouseEnter: handleMouseEnter,
|
|
178
|
-
onMouseMove: handleMouseMove,
|
|
179
|
-
onMouseLeave: handleMouseLeave,
|
|
180
|
-
onClick: close,
|
|
181
|
-
onFocus: handleFocus,
|
|
182
|
-
onBlur: close,
|
|
183
|
-
children: [
|
|
184
|
-
children,
|
|
185
|
-
visible && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Portal_default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
186
|
-
"div",
|
|
187
|
-
{
|
|
188
|
-
ref: tooltipRef,
|
|
189
|
-
role: "tooltip",
|
|
190
|
-
className: clsx_default("lib-xplat-tooltip", shape),
|
|
191
|
-
style: { position: "fixed", left: pos.left, top: pos.top },
|
|
192
|
-
children: [
|
|
193
|
-
title && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "tooltip-title", children: title }),
|
|
194
|
-
description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "tooltip-desc", children: description })
|
|
195
|
-
]
|
|
196
|
-
}
|
|
197
|
-
) })
|
|
198
|
-
]
|
|
199
|
-
}
|
|
200
|
-
);
|
|
201
|
-
};
|
|
202
|
-
Tooltip.displayName = "Tooltip";
|
|
203
|
-
var Tooltip_default = Tooltip;
|
|
204
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
205
|
-
0 && (module.exports = {
|
|
206
|
-
Tooltip
|
|
207
|
-
});
|
|
9
|
+
exports.Tooltip = _chunkTRJUJYW7cjs.Tooltip_default;
|