@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.
Files changed (292) hide show
  1. package/dist/chunk-2EGVOUGV.cjs +93 -0
  2. package/dist/chunk-2T3BVV7R.js +0 -0
  3. package/dist/chunk-3FYYFDKQ.js +159 -0
  4. package/dist/chunk-3M3GFSHJ.js +67 -0
  5. package/dist/chunk-3WBHUFOA.cjs +48 -0
  6. package/dist/chunk-3XYYZQR5.cjs +22 -0
  7. package/dist/chunk-4EF7NVAL.js +67 -0
  8. package/dist/chunk-4ISERXK2.cjs +1 -0
  9. package/dist/chunk-4KYHHJ6Z.cjs +250 -0
  10. package/dist/chunk-4NSRDRXC.cjs +70 -0
  11. package/dist/chunk-4OXMRSVE.cjs +99 -0
  12. package/dist/chunk-55EPYLXN.js +30 -0
  13. package/dist/chunk-5CE3ADO5.js +254 -0
  14. package/dist/chunk-5F6Y2JD6.cjs +1 -0
  15. package/dist/chunk-5FMTMXSP.cjs +127 -0
  16. package/dist/chunk-5POCKDDY.js +36 -0
  17. package/dist/chunk-5VDI56BV.js +33 -0
  18. package/dist/chunk-5WLBUPSK.js +77 -0
  19. package/dist/chunk-5WNNWQHD.cjs +272 -0
  20. package/dist/chunk-66STZB6I.cjs +404 -0
  21. package/dist/chunk-6AIKCZN7.js +1455 -0
  22. package/dist/chunk-6IUJJUVP.js +18 -0
  23. package/dist/chunk-6P2B3ZGP.js +79 -0
  24. package/dist/chunk-764ILIDG.cjs +22 -0
  25. package/dist/chunk-7B44DWC4.js +0 -0
  26. package/dist/chunk-7BE6ETFY.js +18 -0
  27. package/dist/chunk-7BSUS5A4.js +97 -0
  28. package/dist/chunk-7RPWCDEW.cjs +20 -0
  29. package/dist/chunk-7ULXHGLO.cjs +77 -0
  30. package/dist/chunk-7YOI5XOW.js +55 -0
  31. package/dist/chunk-AFVTM5CP.js +0 -0
  32. package/dist/chunk-AN2WSL3B.cjs +1 -0
  33. package/dist/chunk-AT5Y5GLS.cjs +118 -0
  34. package/dist/chunk-AWPO2FI7.js +404 -0
  35. package/dist/chunk-BGXHIDUR.js +103 -0
  36. package/dist/chunk-BPZXL5TP.js +99 -0
  37. package/dist/chunk-BRTS5GWV.js +275 -0
  38. package/dist/chunk-BS3MLZCK.cjs +97 -0
  39. package/dist/chunk-BSPYYE2U.js +36 -0
  40. package/dist/chunk-BWJAEB42.js +48 -0
  41. package/dist/chunk-C4RMTISI.cjs +18 -0
  42. package/dist/chunk-C6M4XVR7.cjs +36 -0
  43. package/dist/chunk-CGC4D5MP.cjs +89 -0
  44. package/dist/chunk-CIRQYSQW.js +70 -0
  45. package/dist/chunk-CLOTWJNP.cjs +310 -0
  46. package/dist/chunk-CS7ZY35M.cjs +49 -0
  47. package/dist/chunk-CUV4RLDE.js +89 -0
  48. package/dist/chunk-CZAMLFSE.cjs +275 -0
  49. package/dist/chunk-D7QZLJ3Z.cjs +18 -0
  50. package/dist/chunk-DMSAAZ3M.cjs +92 -0
  51. package/dist/chunk-DUIZC7VJ.cjs +36 -0
  52. package/dist/chunk-DVBF4BDH.js +43 -0
  53. package/dist/chunk-EETYMP6K.cjs +584 -0
  54. package/dist/chunk-EFQL7JPX.js +0 -0
  55. package/dist/chunk-EFU7IAF5.cjs +12 -0
  56. package/dist/chunk-F3M2H5EX.cjs +79 -0
  57. package/dist/chunk-F436V2SX.cjs +254 -0
  58. package/dist/chunk-F664X2OY.js +250 -0
  59. package/dist/chunk-FF7ELUQW.cjs +1 -0
  60. package/dist/chunk-G3HE4S3Q.cjs +296 -0
  61. package/dist/chunk-GOPD5KUK.js +23 -0
  62. package/dist/chunk-GYTB24V6.cjs +107 -0
  63. package/dist/chunk-GZ657SGO.js +310 -0
  64. package/dist/chunk-H2QN65L6.cjs +1 -0
  65. package/dist/chunk-H6WUT7CK.js +22 -0
  66. package/dist/chunk-H76OQ75T.js +49 -0
  67. package/dist/chunk-HA3XONYI.js +18 -0
  68. package/dist/chunk-HF3UFXEU.js +296 -0
  69. package/dist/chunk-HGA47QVV.cjs +55 -0
  70. package/dist/chunk-HHPPAMXF.cjs +674 -0
  71. package/dist/chunk-HLV2XIE2.cjs +385 -0
  72. package/dist/chunk-HNQGIL45.cjs +96 -0
  73. package/dist/chunk-HQ37R7T3.js +53 -0
  74. package/dist/chunk-HXUGW4RR.js +187 -0
  75. package/dist/chunk-HYPRLWD3.js +272 -0
  76. package/dist/chunk-I7TLJUTP.cjs +6 -0
  77. package/dist/chunk-ICTWDTKC.cjs +1 -0
  78. package/dist/chunk-IPYKHDP4.cjs +187 -0
  79. package/dist/chunk-IRKREQ2X.cjs +18 -0
  80. package/dist/chunk-IVJJBMRY.js +92 -0
  81. package/dist/chunk-JPVIVOFG.js +26 -0
  82. package/dist/chunk-JYNBNSNF.js +151 -0
  83. package/dist/chunk-JZC3BXAC.js +93 -0
  84. package/dist/chunk-K5XPQWXN.cjs +92 -0
  85. package/dist/chunk-KQ3GOMHL.js +31 -0
  86. package/dist/chunk-KUJH72U6.cjs +159 -0
  87. package/dist/chunk-KVUXLC6M.cjs +479 -0
  88. package/dist/chunk-KZOJN57Q.js +19 -0
  89. package/dist/chunk-L3XPL4NP.cjs +53 -0
  90. package/dist/chunk-LOEMSXYB.js +0 -0
  91. package/dist/chunk-LU4KBPNG.cjs +23 -0
  92. package/dist/chunk-MWWWPQDB.js +26 -0
  93. package/dist/chunk-NCBB3WUJ.js +562 -0
  94. package/dist/chunk-NGCZTZST.cjs +562 -0
  95. package/dist/chunk-NSDKALIS.cjs +67 -0
  96. package/dist/chunk-NZHCRLNB.cjs +26 -0
  97. package/dist/chunk-OL4NANHB.js +0 -0
  98. package/dist/chunk-OTJRNKLR.js +96 -0
  99. package/dist/chunk-OWWFKTSK.js +0 -0
  100. package/dist/chunk-P2E3PB62.cjs +99 -0
  101. package/dist/chunk-P2QVFR7S.js +20 -0
  102. package/dist/chunk-P6ZGIYY7.cjs +18 -0
  103. package/dist/chunk-PFGSJJRY.cjs +19 -0
  104. package/dist/chunk-PNIUW7AJ.cjs +32 -0
  105. package/dist/chunk-Q2M2ONGO.js +70 -0
  106. package/dist/chunk-Q4PGP5KE.cjs +562 -0
  107. package/dist/chunk-QAI2YQPY.cjs +51 -0
  108. package/dist/chunk-QCD7UEZ3.cjs +59 -0
  109. package/dist/chunk-QEZ4R3SK.js +6 -0
  110. package/dist/chunk-QKDCPM2D.cjs +23 -0
  111. package/dist/chunk-QRGG3V7W.cjs +59 -0
  112. package/dist/chunk-QURIHUEC.js +107 -0
  113. package/dist/chunk-QY742LWN.js +30 -0
  114. package/dist/chunk-QYMRGYTN.js +127 -0
  115. package/dist/chunk-RLKJ2RZG.js +23 -0
  116. package/dist/chunk-RRR5BUOM.cjs +30 -0
  117. package/dist/chunk-RU3FCVXM.cjs +1 -0
  118. package/dist/chunk-RYTDVTV2.js +32 -0
  119. package/dist/chunk-RYYGUYDE.js +92 -0
  120. package/dist/chunk-SGLP4U3Y.cjs +67 -0
  121. package/dist/chunk-SJC543ZK.js +71 -0
  122. package/dist/chunk-SLYQK4SC.js +20 -0
  123. package/dist/chunk-SMLCOMLS.js +2888 -0
  124. package/dist/chunk-SNMOPLMH.cjs +372 -0
  125. package/dist/chunk-TRJUJYW7.cjs +151 -0
  126. package/dist/chunk-TTY5PE3P.js +30 -0
  127. package/dist/chunk-TXARYG3J.js +22 -0
  128. package/dist/chunk-TYXJU4EF.js +18 -0
  129. package/dist/chunk-U3PC7FYZ.cjs +26 -0
  130. package/dist/chunk-U67JM2WL.cjs +34 -0
  131. package/dist/chunk-UARGO5UG.js +59 -0
  132. package/dist/chunk-UCYE3H3F.cjs +43 -0
  133. package/dist/chunk-UGEGN35F.js +118 -0
  134. package/dist/chunk-UHUA3GQC.cjs +30 -0
  135. package/dist/chunk-UJQN477L.js +59 -0
  136. package/dist/chunk-UMX7DTFZ.cjs +70 -0
  137. package/dist/chunk-UT42P54P.js +372 -0
  138. package/dist/chunk-V76ZRGHQ.cjs +1 -0
  139. package/dist/chunk-VCIK366Y.cjs +1455 -0
  140. package/dist/chunk-VMA74ABT.cjs +137 -0
  141. package/dist/chunk-VSA62N2O.js +12 -0
  142. package/dist/chunk-WDAFLVQK.js +479 -0
  143. package/dist/chunk-WHMLMAMO.js +674 -0
  144. package/dist/chunk-WNBLKKLM.js +0 -0
  145. package/dist/chunk-WQ2GY7F3.js +46 -0
  146. package/dist/chunk-WRLCCK3M.cjs +30 -0
  147. package/dist/chunk-WVCZIOLY.js +562 -0
  148. package/dist/chunk-WZLGJQLW.js +385 -0
  149. package/dist/chunk-XB6FEBK6.js +34 -0
  150. package/dist/chunk-XMERDSRE.js +75 -0
  151. package/dist/chunk-XMLFKZYY.js +137 -0
  152. package/dist/chunk-XMM52J3T.js +584 -0
  153. package/dist/chunk-XZ7C5CGB.cjs +103 -0
  154. package/dist/chunk-YGFBAOKX.js +51 -0
  155. package/dist/chunk-YIN552MF.cjs +20 -0
  156. package/dist/chunk-YLC42E65.cjs +31 -0
  157. package/dist/chunk-YOTXRYJL.cjs +46 -0
  158. package/dist/chunk-ZAUGJZK7.js +99 -0
  159. package/dist/chunk-ZIZOQTDG.cjs +75 -0
  160. package/dist/chunk-ZMSV5VZI.cjs +2888 -0
  161. package/dist/chunk-ZN6MLZAE.cjs +71 -0
  162. package/dist/chunk-ZNCT6HXA.cjs +33 -0
  163. package/dist/components/Accordion/index.cjs +5 -1036
  164. package/dist/components/Accordion/index.js +5 -999
  165. package/dist/components/Alert/index.cjs +4 -69
  166. package/dist/components/Alert/index.js +4 -42
  167. package/dist/components/AutoResizeTextArea/index.cjs +6 -260
  168. package/dist/components/AutoResizeTextArea/index.js +6 -223
  169. package/dist/components/Avatar/index.cjs +4 -65
  170. package/dist/components/Avatar/index.js +4 -38
  171. package/dist/components/Badge/index.cjs +6 -69
  172. package/dist/components/Badge/index.js +5 -40
  173. package/dist/components/Box/index.cjs +4 -58
  174. package/dist/components/Box/index.js +4 -31
  175. package/dist/components/Breadcrumb/index.cjs +4 -42
  176. package/dist/components/Breadcrumb/index.js +3 -14
  177. package/dist/components/Button/index.cjs +5 -65
  178. package/dist/components/Button/index.js +5 -38
  179. package/dist/components/Calendar/index.cjs +6 -1317
  180. package/dist/components/Calendar/index.js +10 -1281
  181. package/dist/components/CardTab/index.cjs +4 -120
  182. package/dist/components/CardTab/index.js +4 -83
  183. package/dist/components/Chart/index.cjs +5 -708
  184. package/dist/components/Chart/index.js +4 -670
  185. package/dist/components/ChatInput/index.cjs +9 -390
  186. package/dist/components/ChatInput/index.js +9 -353
  187. package/dist/components/CheckBox/index.cjs +20 -1125
  188. package/dist/components/CheckBox/index.js +17 -1095
  189. package/dist/components/Chip/index.cjs +5 -55
  190. package/dist/components/Chip/index.js +5 -28
  191. package/dist/components/DatePicker/index.cjs +16 -2136
  192. package/dist/components/DatePicker/index.js +19 -2099
  193. package/dist/components/Divider/index.cjs +4 -58
  194. package/dist/components/Divider/index.js +4 -31
  195. package/dist/components/Drawer/index.cjs +5 -190
  196. package/dist/components/Drawer/index.js +5 -153
  197. package/dist/components/Dropdown/index.cjs +7 -375
  198. package/dist/components/Dropdown/index.js +7 -338
  199. package/dist/components/Editor/index.cjs +6 -1486
  200. package/dist/components/Editor/index.css +53 -0
  201. package/dist/components/Editor/index.d.cts +13 -0
  202. package/dist/components/Editor/index.d.ts +13 -0
  203. package/dist/components/Editor/index.js +6 -1453
  204. package/dist/components/EmptyState/index.cjs +4 -42
  205. package/dist/components/EmptyState/index.js +3 -14
  206. package/dist/components/FieldMessage/index.cjs +7 -182
  207. package/dist/components/FieldMessage/index.js +8 -154
  208. package/dist/components/FileUpload/index.cjs +7 -1171
  209. package/dist/components/FileUpload/index.js +7 -1134
  210. package/dist/components/HtmlTypeWriter/index.cjs +3 -171
  211. package/dist/components/HtmlTypeWriter/index.js +3 -133
  212. package/dist/components/IconButton/index.cjs +4 -65
  213. package/dist/components/IconButton/index.js +4 -38
  214. package/dist/components/ImageSelector/index.cjs +8 -1214
  215. package/dist/components/ImageSelector/index.js +8 -1177
  216. package/dist/components/Input/index.cjs +7 -429
  217. package/dist/components/Input/index.js +8 -392
  218. package/dist/components/Link/index.cjs +4 -61
  219. package/dist/components/Link/index.js +4 -34
  220. package/dist/components/LinkButton/index.cjs +5 -61
  221. package/dist/components/LinkButton/index.js +5 -34
  222. package/dist/components/Modal/index.cjs +5 -190
  223. package/dist/components/Modal/index.js +5 -153
  224. package/dist/components/NotificationBadge/index.cjs +5 -68
  225. package/dist/components/NotificationBadge/index.js +5 -40
  226. package/dist/components/Pagination/index.cjs +6 -1034
  227. package/dist/components/Pagination/index.js +6 -1007
  228. package/dist/components/PopOver/index.cjs +7 -363
  229. package/dist/components/PopOver/index.js +7 -326
  230. package/dist/components/Progress/index.cjs +5 -84
  231. package/dist/components/Progress/index.js +5 -57
  232. package/dist/components/Radio/index.cjs +7 -274
  233. package/dist/components/Radio/index.js +8 -237
  234. package/dist/components/Select/index.cjs +10 -1577
  235. package/dist/components/Select/index.js +11 -1540
  236. package/dist/components/Skeleton/index.cjs +4 -71
  237. package/dist/components/Skeleton/index.js +4 -44
  238. package/dist/components/Spinner/index.cjs +5 -88
  239. package/dist/components/Spinner/index.js +5 -61
  240. package/dist/components/Stat/index.cjs +5 -81
  241. package/dist/components/Stat/index.js +5 -54
  242. package/dist/components/Steps/index.cjs +7 -968
  243. package/dist/components/Steps/index.js +7 -941
  244. package/dist/components/Swiper/index.cjs +4 -357
  245. package/dist/components/Swiper/index.js +4 -320
  246. package/dist/components/Switch/index.cjs +7 -252
  247. package/dist/components/Switch/index.js +7 -215
  248. package/dist/components/Tab/index.cjs +4 -144
  249. package/dist/components/Tab/index.js +4 -107
  250. package/dist/components/Table/index.cjs +4 -337
  251. package/dist/components/Table/index.js +8 -300
  252. package/dist/components/Tag/index.cjs +6 -969
  253. package/dist/components/Tag/index.js +6 -942
  254. package/dist/components/TextArea/index.cjs +6 -229
  255. package/dist/components/TextArea/index.js +6 -192
  256. package/dist/components/TimePicker/index.cjs +9 -579
  257. package/dist/components/TimePicker/index.js +9 -542
  258. package/dist/components/Toast/index.cjs +5 -146
  259. package/dist/components/Toast/index.js +5 -108
  260. package/dist/components/ToggleChip/index.cjs +5 -66
  261. package/dist/components/ToggleChip/index.js +5 -39
  262. package/dist/components/Tooltip/index.cjs +6 -204
  263. package/dist/components/Tooltip/index.js +6 -167
  264. package/dist/components/Tour/index.cjs +6 -414
  265. package/dist/components/Tour/index.js +6 -377
  266. package/dist/components/Video/index.cjs +7 -796
  267. package/dist/components/Video/index.js +7 -759
  268. package/dist/components/index.cjs +140 -8342
  269. package/dist/components/index.js +190 -8288
  270. package/dist/index.cjs +903 -13318
  271. package/dist/index.js +524 -12526
  272. package/dist/layout/Grid/FullGrid/index.cjs +4 -46
  273. package/dist/layout/Grid/FullGrid/index.js +3 -18
  274. package/dist/layout/Grid/FullScreen/index.cjs +4 -46
  275. package/dist/layout/Grid/FullScreen/index.js +3 -18
  276. package/dist/layout/Grid/Item/index.cjs +5 -68
  277. package/dist/layout/Grid/Item/index.js +5 -41
  278. package/dist/layout/Grid/index.cjs +14 -109
  279. package/dist/layout/Grid/index.js +14 -79
  280. package/dist/layout/Header/index.cjs +4 -44
  281. package/dist/layout/Header/index.js +3 -16
  282. package/dist/layout/Layout/index.cjs +4 -42
  283. package/dist/layout/Layout/index.js +3 -14
  284. package/dist/layout/SideBar/index.cjs +6 -96
  285. package/dist/layout/SideBar/index.js +6 -57
  286. package/dist/layout/index.cjs +38 -209
  287. package/dist/layout/index.js +27 -153
  288. package/dist/tokens/index.cjs +627 -6119
  289. package/dist/tokens/index.js +324 -5489
  290. package/guidelines/components/editor.md +3 -0
  291. package/guidelines/setup.md +7 -0
  292. package/package.json +6 -3
@@ -1,360 +1,7 @@
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/Swiper/index.ts
31
- var Swiper_exports = {};
32
- __export(Swiper_exports, {
33
- Swiper: () => Swiper_default
34
- });
35
- module.exports = __toCommonJS(Swiper_exports);
3
+ var _chunkCLOTWJNPcjs = require('../../chunk-CLOTWJNP.cjs');
4
+ require('../../chunk-PFGSJJRY.cjs');
36
5
 
37
- // src/components/Swiper/Swiper.tsx
38
- var import_react = __toESM(require("react"), 1);
39
6
 
40
- // ../../node_modules/clsx/dist/clsx.mjs
41
- function r(e) {
42
- var t, f, n = "";
43
- if ("string" == typeof e || "number" == typeof e) n += e;
44
- else if ("object" == typeof e) if (Array.isArray(e)) {
45
- var o = e.length;
46
- for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
47
- } else for (f in e) e[f] && (n && (n += " "), n += f);
48
- return n;
49
- }
50
- function clsx() {
51
- for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
52
- return n;
53
- }
54
- var clsx_default = clsx;
55
-
56
- // src/components/Swiper/Swiper.tsx
57
- var import_jsx_runtime = require("react/jsx-runtime");
58
- var Swiper = (props) => {
59
- const {
60
- auto = false,
61
- swiperRef,
62
- renderItems = [],
63
- viewItemCount = 1,
64
- maxItems,
65
- loop = false,
66
- spaceBetween = 16,
67
- showProgress = false,
68
- autoplayDelay = 3e3,
69
- pauseOnInteraction = 0,
70
- speed = 300,
71
- slideBy = 1,
72
- index: indexProp,
73
- onChange
74
- } = props;
75
- const items = maxItems ? renderItems.slice(0, maxItems) : renderItems;
76
- const totalSlides = items.length;
77
- const canSlide = totalSlides > viewItemCount;
78
- const maxIndex = Math.max(0, totalSlides - viewItemCount);
79
- const useLoop = loop && canSlide;
80
- const cloneCount = useLoop ? totalSlides : 0;
81
- const extendedItems = import_react.default.useMemo(() => {
82
- if (!useLoop) return items;
83
- return [...items, ...items, ...items];
84
- }, [items, useLoop]);
85
- const initialIdx = Math.max(0, Math.min(indexProp ?? 0, maxIndex));
86
- const [innerIndex, setInnerIndex] = import_react.default.useState(
87
- useLoop ? cloneCount + initialIdx : initialIdx
88
- );
89
- const [isDragging, setIsDragging] = import_react.default.useState(false);
90
- const [dragOffset, setDragOffset] = import_react.default.useState(0);
91
- const [animated, setAnimated] = import_react.default.useState(false);
92
- const [containerWidth, setContainerWidth] = import_react.default.useState(0);
93
- const containerRef = import_react.default.useRef(null);
94
- const startXRef = import_react.default.useRef(0);
95
- const startTimeRef = import_react.default.useRef(0);
96
- const autoplayTimerRef = import_react.default.useRef(null);
97
- const resumeTimeoutRef = import_react.default.useRef(null);
98
- const [paused, setPaused] = import_react.default.useState(false);
99
- const initializedRef = import_react.default.useRef(false);
100
- import_react.default.useEffect(() => {
101
- const el = containerRef.current;
102
- if (!el) return;
103
- const ro = new ResizeObserver((entries) => {
104
- for (const entry of entries) {
105
- setContainerWidth(entry.contentRect.width);
106
- if (!initializedRef.current) {
107
- initializedRef.current = true;
108
- requestAnimationFrame(() => setAnimated(true));
109
- }
110
- }
111
- });
112
- ro.observe(el);
113
- setContainerWidth(el.offsetWidth);
114
- return () => ro.disconnect();
115
- }, []);
116
- const slideStep = containerWidth > 0 ? (containerWidth - (viewItemCount - 1) * spaceBetween) / viewItemCount + spaceBetween : 0;
117
- const transformPx = -(innerIndex * slideStep) + dragOffset;
118
- const getRealIndex = (inner) => {
119
- if (!useLoop) return inner;
120
- return ((inner - cloneCount) % totalSlides + totalSlides) % totalSlides;
121
- };
122
- const realIndex = getRealIndex(innerIndex);
123
- const moveToInner = import_react.default.useCallback(
124
- (idx, withAnim = true) => {
125
- if (!useLoop) {
126
- setAnimated(withAnim);
127
- setInnerIndex(idx);
128
- return;
129
- }
130
- setInnerIndex((prev) => {
131
- const real = ((prev - cloneCount) % totalSlides + totalSlides) % totalSlides;
132
- const canonical = cloneCount + real;
133
- const delta = idx - prev;
134
- const target = canonical + delta;
135
- if (prev !== canonical) {
136
- setAnimated(false);
137
- requestAnimationFrame(() => {
138
- requestAnimationFrame(() => {
139
- setAnimated(withAnim);
140
- setInnerIndex(target);
141
- });
142
- });
143
- return canonical;
144
- }
145
- setAnimated(withAnim);
146
- return target;
147
- });
148
- },
149
- [useLoop, cloneCount, totalSlides]
150
- );
151
- const handleTransitionEnd = import_react.default.useCallback(() => {
152
- if (!useLoop) return;
153
- const real = getRealIndex(innerIndex);
154
- const canonical = cloneCount + real;
155
- if (innerIndex !== canonical) {
156
- setAnimated(false);
157
- setInnerIndex(canonical);
158
- }
159
- onChange?.(Math.min(real, maxIndex));
160
- }, [useLoop, innerIndex, cloneCount, totalSlides, maxIndex, onChange]);
161
- const slideTo = import_react.default.useCallback(
162
- (logicalIndex) => {
163
- if (!canSlide) return;
164
- const clamped = useLoop ? logicalIndex : Math.max(0, Math.min(logicalIndex, maxIndex));
165
- const target = useLoop ? cloneCount + clamped : clamped;
166
- moveToInner(target, true);
167
- if (!useLoop) onChange?.(clamped);
168
- },
169
- [canSlide, useLoop, cloneCount, maxIndex, onChange, moveToInner]
170
- );
171
- const slideNext = import_react.default.useCallback(() => {
172
- if (!canSlide) return;
173
- const nextInner = innerIndex + slideBy;
174
- if (useLoop) {
175
- moveToInner(nextInner, true);
176
- } else {
177
- moveToInner(Math.min(nextInner, maxIndex), true);
178
- }
179
- }, [canSlide, useLoop, innerIndex, slideBy, maxIndex, moveToInner]);
180
- const slidePrev = import_react.default.useCallback(() => {
181
- if (!canSlide) return;
182
- const prevInner = innerIndex - slideBy;
183
- if (useLoop) {
184
- moveToInner(prevInner, true);
185
- } else {
186
- moveToInner(Math.max(prevInner, 0), true);
187
- }
188
- }, [canSlide, useLoop, innerIndex, slideBy, moveToInner]);
189
- import_react.default.useEffect(() => {
190
- if (indexProp === void 0) return;
191
- const clamped = Math.max(0, Math.min(indexProp, maxIndex));
192
- const target = useLoop ? cloneCount + clamped : clamped;
193
- if (target !== innerIndex) {
194
- moveToInner(target, true);
195
- }
196
- }, [indexProp]);
197
- import_react.default.useImperativeHandle(swiperRef, () => ({
198
- slidePrev,
199
- slideNext,
200
- slideTo
201
- }));
202
- import_react.default.useEffect(() => {
203
- if (!auto || !canSlide || paused) return;
204
- autoplayTimerRef.current = setInterval(slideNext, autoplayDelay);
205
- return () => {
206
- if (autoplayTimerRef.current) clearInterval(autoplayTimerRef.current);
207
- };
208
- }, [auto, autoplayDelay, slideNext, canSlide, paused]);
209
- const pauseForInteraction = () => {
210
- setPaused(true);
211
- if (resumeTimeoutRef.current) {
212
- clearTimeout(resumeTimeoutRef.current);
213
- resumeTimeoutRef.current = null;
214
- }
215
- };
216
- const scheduleAutoplayResume = () => {
217
- if (!auto) return;
218
- if (resumeTimeoutRef.current) clearTimeout(resumeTimeoutRef.current);
219
- if (pauseOnInteraction <= 0) {
220
- setPaused(false);
221
- return;
222
- }
223
- resumeTimeoutRef.current = setTimeout(() => {
224
- setPaused(false);
225
- resumeTimeoutRef.current = null;
226
- }, pauseOnInteraction);
227
- };
228
- import_react.default.useEffect(() => {
229
- return () => {
230
- if (resumeTimeoutRef.current) clearTimeout(resumeTimeoutRef.current);
231
- };
232
- }, []);
233
- const getClientX = (e) => {
234
- if ("touches" in e) return e.touches[0]?.clientX ?? 0;
235
- return e.clientX;
236
- };
237
- const handleDragStart = (e) => {
238
- if (!canSlide) return;
239
- if ("button" in e && e.button !== 0) return;
240
- pauseForInteraction();
241
- setIsDragging(true);
242
- setAnimated(false);
243
- startXRef.current = getClientX(e);
244
- startTimeRef.current = Date.now();
245
- };
246
- import_react.default.useEffect(() => {
247
- if (!isDragging) return;
248
- const handleMove = (e) => {
249
- setDragOffset(getClientX(e) - startXRef.current);
250
- };
251
- const handleEnd = () => {
252
- setIsDragging(false);
253
- const absDrag = Math.abs(dragOffset);
254
- const elapsed = Date.now() - startTimeRef.current;
255
- const velocity = absDrag / elapsed;
256
- if ((absDrag > 30 || velocity > 0.3) && slideStep > 0) {
257
- const rawCount = Math.max(1, Math.round(absDrag / slideStep));
258
- const count = Math.max(slideBy, Math.round(rawCount / slideBy) * slideBy);
259
- const direction = dragOffset < 0 ? 1 : -1;
260
- const nextInner = innerIndex + direction * count;
261
- if (useLoop) {
262
- moveToInner(nextInner, true);
263
- } else {
264
- moveToInner(Math.max(0, Math.min(nextInner, maxIndex)), true);
265
- }
266
- } else {
267
- setAnimated(true);
268
- }
269
- setDragOffset(0);
270
- scheduleAutoplayResume();
271
- };
272
- window.addEventListener("mousemove", handleMove);
273
- window.addEventListener("mouseup", handleEnd);
274
- window.addEventListener("touchmove", handleMove, { passive: true });
275
- window.addEventListener("touchend", handleEnd);
276
- return () => {
277
- window.removeEventListener("mousemove", handleMove);
278
- window.removeEventListener("mouseup", handleEnd);
279
- window.removeEventListener("touchmove", handleMove);
280
- window.removeEventListener("touchend", handleEnd);
281
- };
282
- }, [isDragging, dragOffset, innerIndex, useLoop, maxIndex, slideStep, moveToInner]);
283
- const slideWidthPercent = 100 / viewItemCount;
284
- const gapAdjust = spaceBetween * (viewItemCount - 1) / viewItemCount;
285
- const slideElements = import_react.default.useMemo(
286
- () => extendedItems.map((item, idx) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
287
- "div",
288
- {
289
- className: "lib-xplat-swiper__slide",
290
- style: {
291
- minWidth: `calc(${slideWidthPercent}% - ${gapAdjust}px)`,
292
- maxWidth: `calc(${slideWidthPercent}% - ${gapAdjust}px)`
293
- },
294
- children: item
295
- },
296
- idx
297
- )),
298
- [extendedItems, slideWidthPercent, gapAdjust]
299
- );
300
- const totalSteps = Math.ceil((maxIndex + 1) / slideBy);
301
- const currentStep = Math.min(
302
- Math.floor(realIndex / slideBy),
303
- totalSteps - 1
304
- );
305
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "lib-xplat-swiper", ref: containerRef, children: [
306
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
307
- "div",
308
- {
309
- className: "lib-xplat-swiper__viewport",
310
- onMouseDown: handleDragStart,
311
- onTouchStart: handleDragStart,
312
- onDragStart: (e) => e.preventDefault(),
313
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
314
- "div",
315
- {
316
- className: clsx_default(
317
- "lib-xplat-swiper__track",
318
- animated && !isDragging && "transitioning"
319
- ),
320
- style: {
321
- transform: `translateX(${transformPx}px)`,
322
- transitionDuration: isDragging || !animated ? "0ms" : `${speed}ms`,
323
- gap: `${spaceBetween}px`
324
- },
325
- onTransitionEnd: handleTransitionEnd,
326
- children: slideElements
327
- }
328
- )
329
- }
330
- ),
331
- showProgress && canSlide && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "lib-xplat-swiper__progress", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "lib-xplat-swiper__progress-track", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
332
- "span",
333
- {
334
- className: "lib-xplat-swiper__progress-fill",
335
- style: {
336
- width: `${(currentStep + 1) / totalSteps * 100}%`,
337
- transitionDuration: `${speed}ms`
338
- }
339
- }
340
- ) }) }),
341
- canSlide && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "lib-xplat-swiper__dots", children: Array.from({ length: totalSteps }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
342
- "button",
343
- {
344
- className: clsx_default(
345
- "lib-xplat-swiper__dot",
346
- i === currentStep && "active"
347
- ),
348
- onClick: () => slideTo(i * slideBy),
349
- "aria-label": `\uC2AC\uB77C\uC774\uB4DC ${i + 1}`
350
- },
351
- i
352
- )) })
353
- ] });
354
- };
355
- Swiper.displayName = "Swiper";
356
- var Swiper_default = Swiper;
357
- // Annotate the CommonJS export names for ESM import in node:
358
- 0 && (module.exports = {
359
- Swiper
360
- });
7
+ exports.Swiper = _chunkCLOTWJNPcjs.Swiper_default;
@@ -1,323 +1,7 @@
1
- // src/components/Swiper/Swiper.tsx
2
- import React from "react";
3
-
4
- // ../../node_modules/clsx/dist/clsx.mjs
5
- function r(e) {
6
- var t, f, n = "";
7
- if ("string" == typeof e || "number" == typeof e) n += e;
8
- else if ("object" == typeof e) if (Array.isArray(e)) {
9
- var o = e.length;
10
- for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
11
- } else for (f in e) e[f] && (n && (n += " "), n += f);
12
- return n;
13
- }
14
- function clsx() {
15
- for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
16
- return n;
17
- }
18
- var clsx_default = clsx;
19
-
20
- // src/components/Swiper/Swiper.tsx
21
- import { jsx, jsxs } from "react/jsx-runtime";
22
- var Swiper = (props) => {
23
- const {
24
- auto = false,
25
- swiperRef,
26
- renderItems = [],
27
- viewItemCount = 1,
28
- maxItems,
29
- loop = false,
30
- spaceBetween = 16,
31
- showProgress = false,
32
- autoplayDelay = 3e3,
33
- pauseOnInteraction = 0,
34
- speed = 300,
35
- slideBy = 1,
36
- index: indexProp,
37
- onChange
38
- } = props;
39
- const items = maxItems ? renderItems.slice(0, maxItems) : renderItems;
40
- const totalSlides = items.length;
41
- const canSlide = totalSlides > viewItemCount;
42
- const maxIndex = Math.max(0, totalSlides - viewItemCount);
43
- const useLoop = loop && canSlide;
44
- const cloneCount = useLoop ? totalSlides : 0;
45
- const extendedItems = React.useMemo(() => {
46
- if (!useLoop) return items;
47
- return [...items, ...items, ...items];
48
- }, [items, useLoop]);
49
- const initialIdx = Math.max(0, Math.min(indexProp ?? 0, maxIndex));
50
- const [innerIndex, setInnerIndex] = React.useState(
51
- useLoop ? cloneCount + initialIdx : initialIdx
52
- );
53
- const [isDragging, setIsDragging] = React.useState(false);
54
- const [dragOffset, setDragOffset] = React.useState(0);
55
- const [animated, setAnimated] = React.useState(false);
56
- const [containerWidth, setContainerWidth] = React.useState(0);
57
- const containerRef = React.useRef(null);
58
- const startXRef = React.useRef(0);
59
- const startTimeRef = React.useRef(0);
60
- const autoplayTimerRef = React.useRef(null);
61
- const resumeTimeoutRef = React.useRef(null);
62
- const [paused, setPaused] = React.useState(false);
63
- const initializedRef = React.useRef(false);
64
- React.useEffect(() => {
65
- const el = containerRef.current;
66
- if (!el) return;
67
- const ro = new ResizeObserver((entries) => {
68
- for (const entry of entries) {
69
- setContainerWidth(entry.contentRect.width);
70
- if (!initializedRef.current) {
71
- initializedRef.current = true;
72
- requestAnimationFrame(() => setAnimated(true));
73
- }
74
- }
75
- });
76
- ro.observe(el);
77
- setContainerWidth(el.offsetWidth);
78
- return () => ro.disconnect();
79
- }, []);
80
- const slideStep = containerWidth > 0 ? (containerWidth - (viewItemCount - 1) * spaceBetween) / viewItemCount + spaceBetween : 0;
81
- const transformPx = -(innerIndex * slideStep) + dragOffset;
82
- const getRealIndex = (inner) => {
83
- if (!useLoop) return inner;
84
- return ((inner - cloneCount) % totalSlides + totalSlides) % totalSlides;
85
- };
86
- const realIndex = getRealIndex(innerIndex);
87
- const moveToInner = React.useCallback(
88
- (idx, withAnim = true) => {
89
- if (!useLoop) {
90
- setAnimated(withAnim);
91
- setInnerIndex(idx);
92
- return;
93
- }
94
- setInnerIndex((prev) => {
95
- const real = ((prev - cloneCount) % totalSlides + totalSlides) % totalSlides;
96
- const canonical = cloneCount + real;
97
- const delta = idx - prev;
98
- const target = canonical + delta;
99
- if (prev !== canonical) {
100
- setAnimated(false);
101
- requestAnimationFrame(() => {
102
- requestAnimationFrame(() => {
103
- setAnimated(withAnim);
104
- setInnerIndex(target);
105
- });
106
- });
107
- return canonical;
108
- }
109
- setAnimated(withAnim);
110
- return target;
111
- });
112
- },
113
- [useLoop, cloneCount, totalSlides]
114
- );
115
- const handleTransitionEnd = React.useCallback(() => {
116
- if (!useLoop) return;
117
- const real = getRealIndex(innerIndex);
118
- const canonical = cloneCount + real;
119
- if (innerIndex !== canonical) {
120
- setAnimated(false);
121
- setInnerIndex(canonical);
122
- }
123
- onChange?.(Math.min(real, maxIndex));
124
- }, [useLoop, innerIndex, cloneCount, totalSlides, maxIndex, onChange]);
125
- const slideTo = React.useCallback(
126
- (logicalIndex) => {
127
- if (!canSlide) return;
128
- const clamped = useLoop ? logicalIndex : Math.max(0, Math.min(logicalIndex, maxIndex));
129
- const target = useLoop ? cloneCount + clamped : clamped;
130
- moveToInner(target, true);
131
- if (!useLoop) onChange?.(clamped);
132
- },
133
- [canSlide, useLoop, cloneCount, maxIndex, onChange, moveToInner]
134
- );
135
- const slideNext = React.useCallback(() => {
136
- if (!canSlide) return;
137
- const nextInner = innerIndex + slideBy;
138
- if (useLoop) {
139
- moveToInner(nextInner, true);
140
- } else {
141
- moveToInner(Math.min(nextInner, maxIndex), true);
142
- }
143
- }, [canSlide, useLoop, innerIndex, slideBy, maxIndex, moveToInner]);
144
- const slidePrev = React.useCallback(() => {
145
- if (!canSlide) return;
146
- const prevInner = innerIndex - slideBy;
147
- if (useLoop) {
148
- moveToInner(prevInner, true);
149
- } else {
150
- moveToInner(Math.max(prevInner, 0), true);
151
- }
152
- }, [canSlide, useLoop, innerIndex, slideBy, moveToInner]);
153
- React.useEffect(() => {
154
- if (indexProp === void 0) return;
155
- const clamped = Math.max(0, Math.min(indexProp, maxIndex));
156
- const target = useLoop ? cloneCount + clamped : clamped;
157
- if (target !== innerIndex) {
158
- moveToInner(target, true);
159
- }
160
- }, [indexProp]);
161
- React.useImperativeHandle(swiperRef, () => ({
162
- slidePrev,
163
- slideNext,
164
- slideTo
165
- }));
166
- React.useEffect(() => {
167
- if (!auto || !canSlide || paused) return;
168
- autoplayTimerRef.current = setInterval(slideNext, autoplayDelay);
169
- return () => {
170
- if (autoplayTimerRef.current) clearInterval(autoplayTimerRef.current);
171
- };
172
- }, [auto, autoplayDelay, slideNext, canSlide, paused]);
173
- const pauseForInteraction = () => {
174
- setPaused(true);
175
- if (resumeTimeoutRef.current) {
176
- clearTimeout(resumeTimeoutRef.current);
177
- resumeTimeoutRef.current = null;
178
- }
179
- };
180
- const scheduleAutoplayResume = () => {
181
- if (!auto) return;
182
- if (resumeTimeoutRef.current) clearTimeout(resumeTimeoutRef.current);
183
- if (pauseOnInteraction <= 0) {
184
- setPaused(false);
185
- return;
186
- }
187
- resumeTimeoutRef.current = setTimeout(() => {
188
- setPaused(false);
189
- resumeTimeoutRef.current = null;
190
- }, pauseOnInteraction);
191
- };
192
- React.useEffect(() => {
193
- return () => {
194
- if (resumeTimeoutRef.current) clearTimeout(resumeTimeoutRef.current);
195
- };
196
- }, []);
197
- const getClientX = (e) => {
198
- if ("touches" in e) return e.touches[0]?.clientX ?? 0;
199
- return e.clientX;
200
- };
201
- const handleDragStart = (e) => {
202
- if (!canSlide) return;
203
- if ("button" in e && e.button !== 0) return;
204
- pauseForInteraction();
205
- setIsDragging(true);
206
- setAnimated(false);
207
- startXRef.current = getClientX(e);
208
- startTimeRef.current = Date.now();
209
- };
210
- React.useEffect(() => {
211
- if (!isDragging) return;
212
- const handleMove = (e) => {
213
- setDragOffset(getClientX(e) - startXRef.current);
214
- };
215
- const handleEnd = () => {
216
- setIsDragging(false);
217
- const absDrag = Math.abs(dragOffset);
218
- const elapsed = Date.now() - startTimeRef.current;
219
- const velocity = absDrag / elapsed;
220
- if ((absDrag > 30 || velocity > 0.3) && slideStep > 0) {
221
- const rawCount = Math.max(1, Math.round(absDrag / slideStep));
222
- const count = Math.max(slideBy, Math.round(rawCount / slideBy) * slideBy);
223
- const direction = dragOffset < 0 ? 1 : -1;
224
- const nextInner = innerIndex + direction * count;
225
- if (useLoop) {
226
- moveToInner(nextInner, true);
227
- } else {
228
- moveToInner(Math.max(0, Math.min(nextInner, maxIndex)), true);
229
- }
230
- } else {
231
- setAnimated(true);
232
- }
233
- setDragOffset(0);
234
- scheduleAutoplayResume();
235
- };
236
- window.addEventListener("mousemove", handleMove);
237
- window.addEventListener("mouseup", handleEnd);
238
- window.addEventListener("touchmove", handleMove, { passive: true });
239
- window.addEventListener("touchend", handleEnd);
240
- return () => {
241
- window.removeEventListener("mousemove", handleMove);
242
- window.removeEventListener("mouseup", handleEnd);
243
- window.removeEventListener("touchmove", handleMove);
244
- window.removeEventListener("touchend", handleEnd);
245
- };
246
- }, [isDragging, dragOffset, innerIndex, useLoop, maxIndex, slideStep, moveToInner]);
247
- const slideWidthPercent = 100 / viewItemCount;
248
- const gapAdjust = spaceBetween * (viewItemCount - 1) / viewItemCount;
249
- const slideElements = React.useMemo(
250
- () => extendedItems.map((item, idx) => /* @__PURE__ */ jsx(
251
- "div",
252
- {
253
- className: "lib-xplat-swiper__slide",
254
- style: {
255
- minWidth: `calc(${slideWidthPercent}% - ${gapAdjust}px)`,
256
- maxWidth: `calc(${slideWidthPercent}% - ${gapAdjust}px)`
257
- },
258
- children: item
259
- },
260
- idx
261
- )),
262
- [extendedItems, slideWidthPercent, gapAdjust]
263
- );
264
- const totalSteps = Math.ceil((maxIndex + 1) / slideBy);
265
- const currentStep = Math.min(
266
- Math.floor(realIndex / slideBy),
267
- totalSteps - 1
268
- );
269
- return /* @__PURE__ */ jsxs("div", { className: "lib-xplat-swiper", ref: containerRef, children: [
270
- /* @__PURE__ */ jsx(
271
- "div",
272
- {
273
- className: "lib-xplat-swiper__viewport",
274
- onMouseDown: handleDragStart,
275
- onTouchStart: handleDragStart,
276
- onDragStart: (e) => e.preventDefault(),
277
- children: /* @__PURE__ */ jsx(
278
- "div",
279
- {
280
- className: clsx_default(
281
- "lib-xplat-swiper__track",
282
- animated && !isDragging && "transitioning"
283
- ),
284
- style: {
285
- transform: `translateX(${transformPx}px)`,
286
- transitionDuration: isDragging || !animated ? "0ms" : `${speed}ms`,
287
- gap: `${spaceBetween}px`
288
- },
289
- onTransitionEnd: handleTransitionEnd,
290
- children: slideElements
291
- }
292
- )
293
- }
294
- ),
295
- showProgress && canSlide && /* @__PURE__ */ jsx("div", { className: "lib-xplat-swiper__progress", children: /* @__PURE__ */ jsx("div", { className: "lib-xplat-swiper__progress-track", children: /* @__PURE__ */ jsx(
296
- "span",
297
- {
298
- className: "lib-xplat-swiper__progress-fill",
299
- style: {
300
- width: `${(currentStep + 1) / totalSteps * 100}%`,
301
- transitionDuration: `${speed}ms`
302
- }
303
- }
304
- ) }) }),
305
- canSlide && /* @__PURE__ */ jsx("div", { className: "lib-xplat-swiper__dots", children: Array.from({ length: totalSteps }, (_, i) => /* @__PURE__ */ jsx(
306
- "button",
307
- {
308
- className: clsx_default(
309
- "lib-xplat-swiper__dot",
310
- i === currentStep && "active"
311
- ),
312
- onClick: () => slideTo(i * slideBy),
313
- "aria-label": `\uC2AC\uB77C\uC774\uB4DC ${i + 1}`
314
- },
315
- i
316
- )) })
317
- ] });
318
- };
319
- Swiper.displayName = "Swiper";
320
- var Swiper_default = Swiper;
1
+ import {
2
+ Swiper_default
3
+ } from "../../chunk-GZ657SGO.js";
4
+ import "../../chunk-KZOJN57Q.js";
321
5
  export {
322
6
  Swiper_default as Swiper
323
7
  };