@x-plat/design-system 0.19.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 -310
- package/dist/components/Table/index.css +31 -5
- package/dist/components/Table/index.js +8 -273
- 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 -8315
- package/dist/components/index.css +31 -5
- package/dist/components/index.js +190 -8261
- package/dist/index.cjs +903 -13291
- package/dist/index.css +31 -5
- package/dist/index.js +524 -12499
- 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/components/table.md +23 -0
- package/guidelines/setup.md +7 -0
- package/package.json +6 -3
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
var _chunkPFGSJJRYcjs = require('./chunk-PFGSJJRY.cjs');
|
|
4
|
+
|
|
5
|
+
// src/components/Swiper/Swiper.tsx
|
|
6
|
+
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
|
|
7
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
8
|
+
var Swiper = (props) => {
|
|
9
|
+
const {
|
|
10
|
+
auto = false,
|
|
11
|
+
swiperRef,
|
|
12
|
+
renderItems = [],
|
|
13
|
+
viewItemCount = 1,
|
|
14
|
+
maxItems,
|
|
15
|
+
loop = false,
|
|
16
|
+
spaceBetween = 16,
|
|
17
|
+
showProgress = false,
|
|
18
|
+
autoplayDelay = 3e3,
|
|
19
|
+
pauseOnInteraction = 0,
|
|
20
|
+
speed = 300,
|
|
21
|
+
slideBy = 1,
|
|
22
|
+
index: indexProp,
|
|
23
|
+
onChange
|
|
24
|
+
} = props;
|
|
25
|
+
const items = maxItems ? renderItems.slice(0, maxItems) : renderItems;
|
|
26
|
+
const totalSlides = items.length;
|
|
27
|
+
const canSlide = totalSlides > viewItemCount;
|
|
28
|
+
const maxIndex = Math.max(0, totalSlides - viewItemCount);
|
|
29
|
+
const useLoop = loop && canSlide;
|
|
30
|
+
const cloneCount = useLoop ? totalSlides : 0;
|
|
31
|
+
const extendedItems = _react2.default.useMemo(() => {
|
|
32
|
+
if (!useLoop) return items;
|
|
33
|
+
return [...items, ...items, ...items];
|
|
34
|
+
}, [items, useLoop]);
|
|
35
|
+
const initialIdx = Math.max(0, Math.min(_nullishCoalesce(indexProp, () => ( 0)), maxIndex));
|
|
36
|
+
const [innerIndex, setInnerIndex] = _react2.default.useState(
|
|
37
|
+
useLoop ? cloneCount + initialIdx : initialIdx
|
|
38
|
+
);
|
|
39
|
+
const [isDragging, setIsDragging] = _react2.default.useState(false);
|
|
40
|
+
const [dragOffset, setDragOffset] = _react2.default.useState(0);
|
|
41
|
+
const [animated, setAnimated] = _react2.default.useState(false);
|
|
42
|
+
const [containerWidth, setContainerWidth] = _react2.default.useState(0);
|
|
43
|
+
const containerRef = _react2.default.useRef(null);
|
|
44
|
+
const startXRef = _react2.default.useRef(0);
|
|
45
|
+
const startTimeRef = _react2.default.useRef(0);
|
|
46
|
+
const autoplayTimerRef = _react2.default.useRef(null);
|
|
47
|
+
const resumeTimeoutRef = _react2.default.useRef(null);
|
|
48
|
+
const [paused, setPaused] = _react2.default.useState(false);
|
|
49
|
+
const initializedRef = _react2.default.useRef(false);
|
|
50
|
+
_react2.default.useEffect(() => {
|
|
51
|
+
const el = containerRef.current;
|
|
52
|
+
if (!el) return;
|
|
53
|
+
const ro = new ResizeObserver((entries) => {
|
|
54
|
+
for (const entry of entries) {
|
|
55
|
+
setContainerWidth(entry.contentRect.width);
|
|
56
|
+
if (!initializedRef.current) {
|
|
57
|
+
initializedRef.current = true;
|
|
58
|
+
requestAnimationFrame(() => setAnimated(true));
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
ro.observe(el);
|
|
63
|
+
setContainerWidth(el.offsetWidth);
|
|
64
|
+
return () => ro.disconnect();
|
|
65
|
+
}, []);
|
|
66
|
+
const slideStep = containerWidth > 0 ? (containerWidth - (viewItemCount - 1) * spaceBetween) / viewItemCount + spaceBetween : 0;
|
|
67
|
+
const transformPx = -(innerIndex * slideStep) + dragOffset;
|
|
68
|
+
const getRealIndex = (inner) => {
|
|
69
|
+
if (!useLoop) return inner;
|
|
70
|
+
return ((inner - cloneCount) % totalSlides + totalSlides) % totalSlides;
|
|
71
|
+
};
|
|
72
|
+
const realIndex = getRealIndex(innerIndex);
|
|
73
|
+
const moveToInner = _react2.default.useCallback(
|
|
74
|
+
(idx, withAnim = true) => {
|
|
75
|
+
if (!useLoop) {
|
|
76
|
+
setAnimated(withAnim);
|
|
77
|
+
setInnerIndex(idx);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
setInnerIndex((prev) => {
|
|
81
|
+
const real = ((prev - cloneCount) % totalSlides + totalSlides) % totalSlides;
|
|
82
|
+
const canonical = cloneCount + real;
|
|
83
|
+
const delta = idx - prev;
|
|
84
|
+
const target = canonical + delta;
|
|
85
|
+
if (prev !== canonical) {
|
|
86
|
+
setAnimated(false);
|
|
87
|
+
requestAnimationFrame(() => {
|
|
88
|
+
requestAnimationFrame(() => {
|
|
89
|
+
setAnimated(withAnim);
|
|
90
|
+
setInnerIndex(target);
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
return canonical;
|
|
94
|
+
}
|
|
95
|
+
setAnimated(withAnim);
|
|
96
|
+
return target;
|
|
97
|
+
});
|
|
98
|
+
},
|
|
99
|
+
[useLoop, cloneCount, totalSlides]
|
|
100
|
+
);
|
|
101
|
+
const handleTransitionEnd = _react2.default.useCallback(() => {
|
|
102
|
+
if (!useLoop) return;
|
|
103
|
+
const real = getRealIndex(innerIndex);
|
|
104
|
+
const canonical = cloneCount + real;
|
|
105
|
+
if (innerIndex !== canonical) {
|
|
106
|
+
setAnimated(false);
|
|
107
|
+
setInnerIndex(canonical);
|
|
108
|
+
}
|
|
109
|
+
_optionalChain([onChange, 'optionalCall', _2 => _2(Math.min(real, maxIndex))]);
|
|
110
|
+
}, [useLoop, innerIndex, cloneCount, totalSlides, maxIndex, onChange]);
|
|
111
|
+
const slideTo = _react2.default.useCallback(
|
|
112
|
+
(logicalIndex) => {
|
|
113
|
+
if (!canSlide) return;
|
|
114
|
+
const clamped = useLoop ? logicalIndex : Math.max(0, Math.min(logicalIndex, maxIndex));
|
|
115
|
+
const target = useLoop ? cloneCount + clamped : clamped;
|
|
116
|
+
moveToInner(target, true);
|
|
117
|
+
if (!useLoop) _optionalChain([onChange, 'optionalCall', _3 => _3(clamped)]);
|
|
118
|
+
},
|
|
119
|
+
[canSlide, useLoop, cloneCount, maxIndex, onChange, moveToInner]
|
|
120
|
+
);
|
|
121
|
+
const slideNext = _react2.default.useCallback(() => {
|
|
122
|
+
if (!canSlide) return;
|
|
123
|
+
const nextInner = innerIndex + slideBy;
|
|
124
|
+
if (useLoop) {
|
|
125
|
+
moveToInner(nextInner, true);
|
|
126
|
+
} else {
|
|
127
|
+
moveToInner(Math.min(nextInner, maxIndex), true);
|
|
128
|
+
}
|
|
129
|
+
}, [canSlide, useLoop, innerIndex, slideBy, maxIndex, moveToInner]);
|
|
130
|
+
const slidePrev = _react2.default.useCallback(() => {
|
|
131
|
+
if (!canSlide) return;
|
|
132
|
+
const prevInner = innerIndex - slideBy;
|
|
133
|
+
if (useLoop) {
|
|
134
|
+
moveToInner(prevInner, true);
|
|
135
|
+
} else {
|
|
136
|
+
moveToInner(Math.max(prevInner, 0), true);
|
|
137
|
+
}
|
|
138
|
+
}, [canSlide, useLoop, innerIndex, slideBy, moveToInner]);
|
|
139
|
+
_react2.default.useEffect(() => {
|
|
140
|
+
if (indexProp === void 0) return;
|
|
141
|
+
const clamped = Math.max(0, Math.min(indexProp, maxIndex));
|
|
142
|
+
const target = useLoop ? cloneCount + clamped : clamped;
|
|
143
|
+
if (target !== innerIndex) {
|
|
144
|
+
moveToInner(target, true);
|
|
145
|
+
}
|
|
146
|
+
}, [indexProp]);
|
|
147
|
+
_react2.default.useImperativeHandle(swiperRef, () => ({
|
|
148
|
+
slidePrev,
|
|
149
|
+
slideNext,
|
|
150
|
+
slideTo
|
|
151
|
+
}));
|
|
152
|
+
_react2.default.useEffect(() => {
|
|
153
|
+
if (!auto || !canSlide || paused) return;
|
|
154
|
+
autoplayTimerRef.current = setInterval(slideNext, autoplayDelay);
|
|
155
|
+
return () => {
|
|
156
|
+
if (autoplayTimerRef.current) clearInterval(autoplayTimerRef.current);
|
|
157
|
+
};
|
|
158
|
+
}, [auto, autoplayDelay, slideNext, canSlide, paused]);
|
|
159
|
+
const pauseForInteraction = () => {
|
|
160
|
+
setPaused(true);
|
|
161
|
+
if (resumeTimeoutRef.current) {
|
|
162
|
+
clearTimeout(resumeTimeoutRef.current);
|
|
163
|
+
resumeTimeoutRef.current = null;
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
const scheduleAutoplayResume = () => {
|
|
167
|
+
if (!auto) return;
|
|
168
|
+
if (resumeTimeoutRef.current) clearTimeout(resumeTimeoutRef.current);
|
|
169
|
+
if (pauseOnInteraction <= 0) {
|
|
170
|
+
setPaused(false);
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
resumeTimeoutRef.current = setTimeout(() => {
|
|
174
|
+
setPaused(false);
|
|
175
|
+
resumeTimeoutRef.current = null;
|
|
176
|
+
}, pauseOnInteraction);
|
|
177
|
+
};
|
|
178
|
+
_react2.default.useEffect(() => {
|
|
179
|
+
return () => {
|
|
180
|
+
if (resumeTimeoutRef.current) clearTimeout(resumeTimeoutRef.current);
|
|
181
|
+
};
|
|
182
|
+
}, []);
|
|
183
|
+
const getClientX = (e) => {
|
|
184
|
+
if ("touches" in e) return _nullishCoalesce(_optionalChain([e, 'access', _4 => _4.touches, 'access', _5 => _5[0], 'optionalAccess', _6 => _6.clientX]), () => ( 0));
|
|
185
|
+
return e.clientX;
|
|
186
|
+
};
|
|
187
|
+
const handleDragStart = (e) => {
|
|
188
|
+
if (!canSlide) return;
|
|
189
|
+
if ("button" in e && e.button !== 0) return;
|
|
190
|
+
pauseForInteraction();
|
|
191
|
+
setIsDragging(true);
|
|
192
|
+
setAnimated(false);
|
|
193
|
+
startXRef.current = getClientX(e);
|
|
194
|
+
startTimeRef.current = Date.now();
|
|
195
|
+
};
|
|
196
|
+
_react2.default.useEffect(() => {
|
|
197
|
+
if (!isDragging) return;
|
|
198
|
+
const handleMove = (e) => {
|
|
199
|
+
setDragOffset(getClientX(e) - startXRef.current);
|
|
200
|
+
};
|
|
201
|
+
const handleEnd = () => {
|
|
202
|
+
setIsDragging(false);
|
|
203
|
+
const absDrag = Math.abs(dragOffset);
|
|
204
|
+
const elapsed = Date.now() - startTimeRef.current;
|
|
205
|
+
const velocity = absDrag / elapsed;
|
|
206
|
+
if ((absDrag > 30 || velocity > 0.3) && slideStep > 0) {
|
|
207
|
+
const rawCount = Math.max(1, Math.round(absDrag / slideStep));
|
|
208
|
+
const count = Math.max(slideBy, Math.round(rawCount / slideBy) * slideBy);
|
|
209
|
+
const direction = dragOffset < 0 ? 1 : -1;
|
|
210
|
+
const nextInner = innerIndex + direction * count;
|
|
211
|
+
if (useLoop) {
|
|
212
|
+
moveToInner(nextInner, true);
|
|
213
|
+
} else {
|
|
214
|
+
moveToInner(Math.max(0, Math.min(nextInner, maxIndex)), true);
|
|
215
|
+
}
|
|
216
|
+
} else {
|
|
217
|
+
setAnimated(true);
|
|
218
|
+
}
|
|
219
|
+
setDragOffset(0);
|
|
220
|
+
scheduleAutoplayResume();
|
|
221
|
+
};
|
|
222
|
+
window.addEventListener("mousemove", handleMove);
|
|
223
|
+
window.addEventListener("mouseup", handleEnd);
|
|
224
|
+
window.addEventListener("touchmove", handleMove, { passive: true });
|
|
225
|
+
window.addEventListener("touchend", handleEnd);
|
|
226
|
+
return () => {
|
|
227
|
+
window.removeEventListener("mousemove", handleMove);
|
|
228
|
+
window.removeEventListener("mouseup", handleEnd);
|
|
229
|
+
window.removeEventListener("touchmove", handleMove);
|
|
230
|
+
window.removeEventListener("touchend", handleEnd);
|
|
231
|
+
};
|
|
232
|
+
}, [isDragging, dragOffset, innerIndex, useLoop, maxIndex, slideStep, moveToInner]);
|
|
233
|
+
const slideWidthPercent = 100 / viewItemCount;
|
|
234
|
+
const gapAdjust = spaceBetween * (viewItemCount - 1) / viewItemCount;
|
|
235
|
+
const slideElements = _react2.default.useMemo(
|
|
236
|
+
() => extendedItems.map((item, idx) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
237
|
+
"div",
|
|
238
|
+
{
|
|
239
|
+
className: "lib-xplat-swiper__slide",
|
|
240
|
+
style: {
|
|
241
|
+
minWidth: `calc(${slideWidthPercent}% - ${gapAdjust}px)`,
|
|
242
|
+
maxWidth: `calc(${slideWidthPercent}% - ${gapAdjust}px)`
|
|
243
|
+
},
|
|
244
|
+
children: item
|
|
245
|
+
},
|
|
246
|
+
idx
|
|
247
|
+
)),
|
|
248
|
+
[extendedItems, slideWidthPercent, gapAdjust]
|
|
249
|
+
);
|
|
250
|
+
const totalSteps = Math.ceil((maxIndex + 1) / slideBy);
|
|
251
|
+
const currentStep = Math.min(
|
|
252
|
+
Math.floor(realIndex / slideBy),
|
|
253
|
+
totalSteps - 1
|
|
254
|
+
);
|
|
255
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "lib-xplat-swiper", ref: containerRef, children: [
|
|
256
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
257
|
+
"div",
|
|
258
|
+
{
|
|
259
|
+
className: "lib-xplat-swiper__viewport",
|
|
260
|
+
onMouseDown: handleDragStart,
|
|
261
|
+
onTouchStart: handleDragStart,
|
|
262
|
+
onDragStart: (e) => e.preventDefault(),
|
|
263
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
264
|
+
"div",
|
|
265
|
+
{
|
|
266
|
+
className: _chunkPFGSJJRYcjs.clsx_default.call(void 0,
|
|
267
|
+
"lib-xplat-swiper__track",
|
|
268
|
+
animated && !isDragging && "transitioning"
|
|
269
|
+
),
|
|
270
|
+
style: {
|
|
271
|
+
transform: `translateX(${transformPx}px)`,
|
|
272
|
+
transitionDuration: isDragging || !animated ? "0ms" : `${speed}ms`,
|
|
273
|
+
gap: `${spaceBetween}px`
|
|
274
|
+
},
|
|
275
|
+
onTransitionEnd: handleTransitionEnd,
|
|
276
|
+
children: slideElements
|
|
277
|
+
}
|
|
278
|
+
)
|
|
279
|
+
}
|
|
280
|
+
),
|
|
281
|
+
showProgress && canSlide && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "lib-xplat-swiper__progress", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "lib-xplat-swiper__progress-track", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
282
|
+
"span",
|
|
283
|
+
{
|
|
284
|
+
className: "lib-xplat-swiper__progress-fill",
|
|
285
|
+
style: {
|
|
286
|
+
width: `${(currentStep + 1) / totalSteps * 100}%`,
|
|
287
|
+
transitionDuration: `${speed}ms`
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
) }) }),
|
|
291
|
+
canSlide && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "lib-xplat-swiper__dots", children: Array.from({ length: totalSteps }, (_, i) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
292
|
+
"button",
|
|
293
|
+
{
|
|
294
|
+
className: _chunkPFGSJJRYcjs.clsx_default.call(void 0,
|
|
295
|
+
"lib-xplat-swiper__dot",
|
|
296
|
+
i === currentStep && "active"
|
|
297
|
+
),
|
|
298
|
+
onClick: () => slideTo(i * slideBy),
|
|
299
|
+
"aria-label": `\uC2AC\uB77C\uC774\uB4DC ${i + 1}`
|
|
300
|
+
},
|
|
301
|
+
i
|
|
302
|
+
)) })
|
|
303
|
+
] });
|
|
304
|
+
};
|
|
305
|
+
Swiper.displayName = "Swiper";
|
|
306
|
+
var Swiper_default = Swiper;
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
exports.Swiper_default = Swiper_default;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkI7TLJUTPcjs = require('./chunk-I7TLJUTP.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkPFGSJJRYcjs = require('./chunk-PFGSJJRY.cjs');
|
|
7
|
+
|
|
8
|
+
// src/components/Progress/Progress.tsx
|
|
9
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
10
|
+
var Progress = (props) => {
|
|
11
|
+
const {
|
|
12
|
+
value,
|
|
13
|
+
max = 100,
|
|
14
|
+
size = "md",
|
|
15
|
+
type = "primary",
|
|
16
|
+
showLabel = false
|
|
17
|
+
} = props;
|
|
18
|
+
const statusType = _chunkI7TLJUTPcjs.normalizeStatus.call(void 0, type);
|
|
19
|
+
const percentage = Math.min(100, Math.max(0, value / max * 100));
|
|
20
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunkPFGSJJRYcjs.clsx_default.call(void 0, "lib-xplat-progress", size, statusType), children: [
|
|
21
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
22
|
+
"div",
|
|
23
|
+
{
|
|
24
|
+
className: "track",
|
|
25
|
+
role: "progressbar",
|
|
26
|
+
"aria-valuenow": value,
|
|
27
|
+
"aria-valuemin": 0,
|
|
28
|
+
"aria-valuemax": max,
|
|
29
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
30
|
+
"div",
|
|
31
|
+
{
|
|
32
|
+
className: "bar",
|
|
33
|
+
style: { width: `${percentage}%` }
|
|
34
|
+
}
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
),
|
|
38
|
+
showLabel && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "label", children: [
|
|
39
|
+
Math.round(percentage),
|
|
40
|
+
"%"
|
|
41
|
+
] })
|
|
42
|
+
] });
|
|
43
|
+
};
|
|
44
|
+
Progress.displayName = "Progress";
|
|
45
|
+
var Progress_default = Progress;
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
exports.Progress_default = Progress_default;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useClickOutside_default,
|
|
3
|
+
useOverlayHost_default
|
|
4
|
+
} from "./chunk-UARGO5UG.js";
|
|
5
|
+
import {
|
|
6
|
+
Portal_default
|
|
7
|
+
} from "./chunk-VSA62N2O.js";
|
|
8
|
+
import {
|
|
9
|
+
useAutoPosition_default,
|
|
10
|
+
useCloseWhenFocusHidden,
|
|
11
|
+
useEscapeKey
|
|
12
|
+
} from "./chunk-F664X2OY.js";
|
|
13
|
+
import {
|
|
14
|
+
clsx_default
|
|
15
|
+
} from "./chunk-KZOJN57Q.js";
|
|
16
|
+
|
|
17
|
+
// src/components/Dropdown/Dropdown.tsx
|
|
18
|
+
import React from "react";
|
|
19
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
20
|
+
var Dropdown = (props) => {
|
|
21
|
+
const { items, children } = props;
|
|
22
|
+
const [isOpen, setIsOpen] = React.useState(false);
|
|
23
|
+
const [mounted, setMounted] = React.useState(false);
|
|
24
|
+
const [visible, setVisible] = React.useState(false);
|
|
25
|
+
const triggerRef = React.useRef(null);
|
|
26
|
+
const menuRef = React.useRef(null);
|
|
27
|
+
const host = useOverlayHost_default(triggerRef, mounted);
|
|
28
|
+
useAutoPosition_default(triggerRef, menuRef, mounted);
|
|
29
|
+
useClickOutside_default([triggerRef, menuRef], () => setIsOpen(false), isOpen);
|
|
30
|
+
useCloseWhenFocusHidden(isOpen, triggerRef, menuRef, () => setIsOpen(false));
|
|
31
|
+
useEscapeKey(isOpen, () => {
|
|
32
|
+
setIsOpen(false);
|
|
33
|
+
triggerRef.current?.focus({ preventScroll: true });
|
|
34
|
+
});
|
|
35
|
+
React.useEffect(() => {
|
|
36
|
+
if (isOpen) {
|
|
37
|
+
setMounted(true);
|
|
38
|
+
const t2 = setTimeout(() => setVisible(true), 1);
|
|
39
|
+
return () => clearTimeout(t2);
|
|
40
|
+
}
|
|
41
|
+
setVisible(false);
|
|
42
|
+
const t = setTimeout(() => setMounted(false), 150);
|
|
43
|
+
return () => clearTimeout(t);
|
|
44
|
+
}, [isOpen]);
|
|
45
|
+
const handleItemClick = (item) => {
|
|
46
|
+
if (item.disabled) return;
|
|
47
|
+
item.onClick?.();
|
|
48
|
+
setIsOpen(false);
|
|
49
|
+
};
|
|
50
|
+
return /* @__PURE__ */ jsxs("div", { className: "lib-xplat-dropdown", children: [
|
|
51
|
+
/* @__PURE__ */ jsx(
|
|
52
|
+
"div",
|
|
53
|
+
{
|
|
54
|
+
ref: triggerRef,
|
|
55
|
+
className: "dropdown-trigger",
|
|
56
|
+
onClick: () => setIsOpen((prev) => !prev),
|
|
57
|
+
children
|
|
58
|
+
}
|
|
59
|
+
),
|
|
60
|
+
mounted && /* @__PURE__ */ jsx(Portal_default, { container: host, children: /* @__PURE__ */ jsx(
|
|
61
|
+
"div",
|
|
62
|
+
{
|
|
63
|
+
ref: menuRef,
|
|
64
|
+
className: clsx_default("lib-xplat-dropdown-menu", { visible }),
|
|
65
|
+
role: "menu",
|
|
66
|
+
children: items.map((item) => /* @__PURE__ */ jsx(
|
|
67
|
+
"button",
|
|
68
|
+
{
|
|
69
|
+
className: clsx_default("dropdown-item", {
|
|
70
|
+
disabled: item.disabled,
|
|
71
|
+
danger: item.danger
|
|
72
|
+
}),
|
|
73
|
+
role: "menuitem",
|
|
74
|
+
disabled: item.disabled,
|
|
75
|
+
onClick: () => handleItemClick(item),
|
|
76
|
+
children: item.label
|
|
77
|
+
},
|
|
78
|
+
item.key
|
|
79
|
+
))
|
|
80
|
+
}
|
|
81
|
+
) })
|
|
82
|
+
] });
|
|
83
|
+
};
|
|
84
|
+
Dropdown.displayName = "Dropdown";
|
|
85
|
+
var Dropdown_default = Dropdown;
|
|
86
|
+
|
|
87
|
+
export {
|
|
88
|
+
Dropdown_default
|
|
89
|
+
};
|