@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.
Files changed (296) 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 -310
  251. package/dist/components/Table/index.css +31 -5
  252. package/dist/components/Table/index.js +8 -273
  253. package/dist/components/Tag/index.cjs +6 -969
  254. package/dist/components/Tag/index.js +6 -942
  255. package/dist/components/TextArea/index.cjs +6 -229
  256. package/dist/components/TextArea/index.js +6 -192
  257. package/dist/components/TimePicker/index.cjs +9 -579
  258. package/dist/components/TimePicker/index.js +9 -542
  259. package/dist/components/Toast/index.cjs +5 -146
  260. package/dist/components/Toast/index.js +5 -108
  261. package/dist/components/ToggleChip/index.cjs +5 -66
  262. package/dist/components/ToggleChip/index.js +5 -39
  263. package/dist/components/Tooltip/index.cjs +6 -204
  264. package/dist/components/Tooltip/index.js +6 -167
  265. package/dist/components/Tour/index.cjs +6 -414
  266. package/dist/components/Tour/index.js +6 -377
  267. package/dist/components/Video/index.cjs +7 -796
  268. package/dist/components/Video/index.js +7 -759
  269. package/dist/components/index.cjs +140 -8315
  270. package/dist/components/index.css +31 -5
  271. package/dist/components/index.js +190 -8261
  272. package/dist/index.cjs +903 -13291
  273. package/dist/index.css +31 -5
  274. package/dist/index.js +524 -12499
  275. package/dist/layout/Grid/FullGrid/index.cjs +4 -46
  276. package/dist/layout/Grid/FullGrid/index.js +3 -18
  277. package/dist/layout/Grid/FullScreen/index.cjs +4 -46
  278. package/dist/layout/Grid/FullScreen/index.js +3 -18
  279. package/dist/layout/Grid/Item/index.cjs +5 -68
  280. package/dist/layout/Grid/Item/index.js +5 -41
  281. package/dist/layout/Grid/index.cjs +14 -109
  282. package/dist/layout/Grid/index.js +14 -79
  283. package/dist/layout/Header/index.cjs +4 -44
  284. package/dist/layout/Header/index.js +3 -16
  285. package/dist/layout/Layout/index.cjs +4 -42
  286. package/dist/layout/Layout/index.js +3 -14
  287. package/dist/layout/SideBar/index.cjs +6 -96
  288. package/dist/layout/SideBar/index.js +6 -57
  289. package/dist/layout/index.cjs +38 -209
  290. package/dist/layout/index.js +27 -153
  291. package/dist/tokens/index.cjs +627 -6119
  292. package/dist/tokens/index.js +324 -5489
  293. package/guidelines/components/editor.md +3 -0
  294. package/guidelines/components/table.md +23 -0
  295. package/guidelines/setup.md +7 -0
  296. package/package.json +6 -3
@@ -1,545 +1,12 @@
1
- // src/components/TimePicker/TimePicker.tsx
2
- import React5 from "react";
3
-
4
- // src/tokens/hooks/Portal.tsx
5
- import ReactDOM from "react-dom";
6
- var Portal = ({ children, container }) => {
7
- if (typeof document === "undefined") return null;
8
- return ReactDOM.createPortal(children, container ?? document.body);
9
- };
10
- Portal.displayName = "Portal";
11
- var Portal_default = Portal;
12
-
13
- // src/tokens/hooks/useAutoPosition.ts
14
- import React from "react";
15
- var findScrollParent = (el) => {
16
- for (let p = el.parentElement; p; p = p.parentElement) {
17
- if (p.dataset.xplatOverlayEscape !== void 0) continue;
18
- const { overflowY } = getComputedStyle(p);
19
- if (!/(auto|scroll)/.test(overflowY)) continue;
20
- if (p.scrollHeight > p.clientHeight) return p;
21
- }
22
- return null;
23
- };
24
- var TRIGGER_GAP = 8;
25
- var computePlacement = (triggerRect, popW, popH, clip) => {
26
- const roomBelow = clip.bottom - triggerRect.bottom - TRIGGER_GAP;
27
- const roomAbove = triggerRect.top - clip.top - TRIGGER_GAP;
28
- let direction;
29
- let top;
30
- let maxHeight = null;
31
- if (popH <= roomBelow) {
32
- direction = "bottom";
33
- top = triggerRect.bottom + TRIGGER_GAP;
34
- } else if (popH <= roomAbove) {
35
- direction = "top";
36
- top = triggerRect.top - TRIGGER_GAP - popH;
37
- } else {
38
- const room = Math.max(roomBelow, roomAbove, 0);
39
- if (roomBelow >= roomAbove) {
40
- direction = "bottom";
41
- top = triggerRect.bottom + TRIGGER_GAP;
42
- } else {
43
- direction = "top";
44
- top = triggerRect.top - TRIGGER_GAP - room;
45
- }
46
- maxHeight = room;
47
- }
48
- let left = triggerRect.left;
49
- if (left + popW > clip.right - 8) {
50
- left = triggerRect.right - popW;
51
- }
52
- if (left < clip.left + 8) left = clip.left + 8;
53
- return {
54
- direction,
55
- top,
56
- left,
57
- maxHeight
58
- };
59
- };
60
- var useAutoPosition = (triggerRef, popRef, enabled = true) => {
61
- const directionRef = React.useRef("bottom");
62
- const sizeRef = React.useRef(null);
63
- const scrollParentRef = React.useRef(null);
64
- const placedRef = React.useRef(false);
65
- const frozenMaxRef = React.useRef(void 0);
66
- const cssCapRef = React.useRef(void 0);
67
- const calculatePosition = React.useCallback((remeasure = false) => {
68
- const pop = popRef.current;
69
- if (!triggerRef.current || !pop) return;
70
- if (remeasure) frozenMaxRef.current = void 0;
71
- if (cssCapRef.current === void 0) {
72
- pop.style.maxHeight = "";
73
- const raw = getComputedStyle(pop).maxHeight;
74
- cssCapRef.current = raw === "none" ? null : Number.parseFloat(raw) || null;
75
- }
76
- if (remeasure || !sizeRef.current) {
77
- sizeRef.current = {
78
- w: pop.offsetWidth,
79
- h: Math.max(pop.offsetHeight, pop.scrollHeight)
80
- };
81
- }
82
- const { w: popW, h: popH } = sizeRef.current;
83
- const triggerRect = triggerRef.current.getBoundingClientRect();
84
- if (popH === 0 || popW === 0) {
85
- sizeRef.current = null;
86
- return;
87
- }
88
- const parentRect = scrollParentRef.current?.getBoundingClientRect();
89
- const clip = {
90
- top: Math.max(parentRect?.top ?? 0, 0),
91
- bottom: Math.min(parentRect?.bottom ?? window.innerHeight, window.innerHeight),
92
- left: Math.max(parentRect?.left ?? 0, 0),
93
- right: Math.min(parentRect?.right ?? window.innerWidth, window.innerWidth)
94
- };
95
- const first = !placedRef.current;
96
- if (first) pop.style.transition = "none";
97
- const cap = cssCapRef.current;
98
- const desiredH = cap == null ? popH : Math.min(popH, cap);
99
- const frozen = frozenMaxRef.current;
100
- const effectiveH = frozen == null ? desiredH : Math.min(desiredH, frozen);
101
- const { direction: next, top, left, maxHeight: suggested } = computePlacement(
102
- triggerRect,
103
- popW,
104
- effectiveH,
105
- clip
106
- );
107
- if (frozenMaxRef.current === void 0) frozenMaxRef.current = suggested;
108
- const maxHeight = frozenMaxRef.current;
109
- const hostRect = (pop.offsetParent ?? pop.parentElement)?.getBoundingClientRect();
110
- pop.style.top = `${top - (hostRect?.top ?? 0)}px`;
111
- pop.style.left = `${left - (hostRect?.left ?? 0)}px`;
112
- pop.style.maxHeight = maxHeight === null ? "" : `${maxHeight}px`;
113
- directionRef.current = next;
114
- pop.classList.toggle("top", next === "top");
115
- pop.classList.toggle("bottom", next === "bottom");
116
- if (first) {
117
- void pop.offsetHeight;
118
- pop.style.transition = "";
119
- placedRef.current = true;
120
- }
121
- }, [triggerRef, popRef]);
122
- React.useLayoutEffect(() => {
123
- if (!enabled) {
124
- sizeRef.current = null;
125
- scrollParentRef.current = null;
126
- placedRef.current = false;
127
- frozenMaxRef.current = void 0;
128
- cssCapRef.current = void 0;
129
- return;
130
- }
131
- if (triggerRef.current) {
132
- scrollParentRef.current = findScrollParent(triggerRef.current);
133
- }
134
- calculatePosition(true);
135
- const raf = requestAnimationFrame(() => calculatePosition(true));
136
- return () => cancelAnimationFrame(raf);
137
- }, [calculatePosition, enabled, triggerRef]);
138
- React.useEffect(() => {
139
- if (!enabled || !popRef.current) return;
140
- const observer = new ResizeObserver(() => {
141
- calculatePosition(true);
142
- });
143
- observer.observe(popRef.current);
144
- return () => observer.disconnect();
145
- }, [calculatePosition, enabled, popRef]);
146
- React.useEffect(() => {
147
- if (!enabled) return;
148
- const onScroll = () => calculatePosition();
149
- const onResize = () => calculatePosition(true);
150
- window.addEventListener("resize", onResize, { passive: true });
151
- window.addEventListener("scroll", onScroll, { passive: true, capture: true });
152
- return () => {
153
- window.removeEventListener("resize", onResize);
154
- window.removeEventListener("scroll", onScroll, true);
155
- };
156
- }, [calculatePosition, enabled]);
157
- };
158
- var useAutoPosition_default = useAutoPosition;
159
-
160
- // src/tokens/hooks/useClickOutside.ts
161
- import React2 from "react";
162
- var useClickOutside = (refs, handler, enabled = true) => {
163
- React2.useEffect(() => {
164
- if (!enabled) return;
165
- const refArray = Array.isArray(refs) ? refs : [refs];
166
- const listener = (event) => {
167
- const target = event.target;
168
- const isInside = refArray.some(
169
- (ref) => ref.current && ref.current.contains(target)
170
- );
171
- if (!isInside) {
172
- handler();
173
- }
174
- };
175
- document.addEventListener("mousedown", listener);
176
- document.addEventListener("touchstart", listener);
177
- return () => {
178
- document.removeEventListener("mousedown", listener);
179
- document.removeEventListener("touchstart", listener);
180
- };
181
- }, [refs, handler, enabled]);
182
- };
183
- var useClickOutside_default = useClickOutside;
184
-
185
- // src/tokens/hooks/useOverlayHost.ts
186
- import React3 from "react";
187
- var useOverlayHost = (triggerRef, enabled) => {
188
- const [host, setHost] = React3.useState(null);
189
- React3.useLayoutEffect(() => {
190
- if (!enabled || !triggerRef.current) {
191
- setHost(null);
192
- return;
193
- }
194
- const el = document.createElement("div");
195
- el.dataset.xplatOverlayHost = "";
196
- el.style.position = "relative";
197
- el.style.width = "0";
198
- el.style.height = "0";
199
- const parent = findScrollParent(triggerRef.current) ?? document.body;
200
- parent.appendChild(el);
201
- setHost(el);
202
- return () => {
203
- el.remove();
204
- setHost(null);
205
- };
206
- }, [enabled, triggerRef]);
207
- return host;
208
- };
209
- var useOverlayHost_default = useOverlayHost;
210
-
211
- // src/tokens/hooks/useOverlayKeyboard.ts
212
- import React4 from "react";
213
- var FOCUSABLE = [
214
- "a[href]",
215
- "button:not([disabled])",
216
- "input:not([disabled]):not([type='hidden'])",
217
- "select:not([disabled])",
218
- "textarea:not([disabled])",
219
- "[tabindex]:not([tabindex='-1'])"
220
- ].join(",");
221
- var useEscapeKey = (enabled, onEscape) => {
222
- React4.useEffect(() => {
223
- if (!enabled) return;
224
- const onKey = (e) => {
225
- if (e.key !== "Escape") return;
226
- if (e.defaultPrevented) return;
227
- e.preventDefault();
228
- onEscape();
229
- };
230
- document.addEventListener("keydown", onKey);
231
- return () => document.removeEventListener("keydown", onKey);
232
- }, [enabled, onEscape]);
233
- };
234
- var useCloseWhenFocusHidden = (enabled, triggerRef, popRef, onClose) => {
235
- const onCloseRef = React4.useRef(onClose);
236
- onCloseRef.current = onClose;
237
- React4.useEffect(() => {
238
- const trigger = triggerRef.current;
239
- if (!enabled || !trigger) return;
240
- const observer = new IntersectionObserver(
241
- ([entry]) => {
242
- if (entry.isIntersecting) return;
243
- if (!popRef.current?.contains(document.activeElement)) return;
244
- onCloseRef.current();
245
- trigger.focus({ preventScroll: true });
246
- },
247
- // 그릇이 없으면 root: null → 뷰포트 기준
248
- { root: findScrollParent(trigger), threshold: 0 }
249
- );
250
- observer.observe(trigger);
251
- return () => observer.disconnect();
252
- }, [enabled, triggerRef, popRef]);
253
- };
254
-
255
- // ../../node_modules/clsx/dist/clsx.mjs
256
- function r(e) {
257
- var t, f, n = "";
258
- if ("string" == typeof e || "number" == typeof e) n += e;
259
- else if ("object" == typeof e) if (Array.isArray(e)) {
260
- var o = e.length;
261
- for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
262
- } else for (f in e) e[f] && (n && (n += " "), n += f);
263
- return n;
264
- }
265
- function clsx() {
266
- for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
267
- return n;
268
- }
269
- var clsx_default = clsx;
270
-
271
- // src/tokens/svg/status/ErrorIcon.tsx
272
- import { jsx, jsxs } from "react/jsx-runtime";
273
- var ErrorIcon = () => /* @__PURE__ */ jsxs(
274
- "svg",
275
- {
276
- xmlns: "http://www.w3.org/2000/svg",
277
- width: "1em",
278
- height: "1em",
279
- viewBox: "0 0 16 16",
280
- fill: "none",
281
- children: [
282
- /* @__PURE__ */ jsxs("g", { clipPath: "url(#clip0_1196_9603)", children: [
283
- /* @__PURE__ */ jsx(
284
- "path",
285
- {
286
- d: "M9.57588 5.57559C9.81019 5.34127 10.19 5.34127 10.4243 5.57559C10.6586 5.8099 10.6586 6.18971 10.4243 6.42402L8.84854 7.9998L10.4243 9.57559C10.6586 9.8099 10.6586 10.1897 10.4243 10.424C10.19 10.6583 9.81019 10.6583 9.57588 10.424L8.0001 8.84824L6.42432 10.424C6.19 10.6583 5.81019 10.6583 5.57588 10.424C5.34156 10.1897 5.34156 9.8099 5.57588 9.57559L7.15166 7.9998L5.57588 6.42402C5.34156 6.18971 5.34156 5.8099 5.57588 5.57559C5.81019 5.34127 6.19 5.34127 6.42432 5.57559L8.0001 7.15137L9.57588 5.57559Z",
287
- fill: "currentColor"
288
- }
289
- ),
290
- /* @__PURE__ */ jsx(
291
- "path",
292
- {
293
- fillRule: "evenodd",
294
- clipRule: "evenodd",
295
- d: "M8.0001 0.733398C12.0131 0.73361 15.2671 3.98679 15.2673 7.9998C15.2672 12.0129 12.0131 15.2668 8.0001 15.267C3.98701 15.2669 0.733016 12.0129 0.73291 7.9998C0.733051 3.98674 3.98704 0.733539 8.0001 0.733398ZM8.0001 1.9334C4.64978 1.93354 1.93383 4.64948 1.93369 7.9998C1.9338 11.3502 4.64975 14.0669 8.0001 14.067C11.3504 14.0668 14.0672 11.3501 14.0673 7.9998C14.0671 4.64953 11.3504 1.93361 8.0001 1.9334Z",
296
- fill: "currentColor"
297
- }
298
- )
299
- ] }),
300
- /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: "clip0_1196_9603", children: /* @__PURE__ */ jsx("rect", { width: "16", height: "16", fill: "white" }) }) })
301
- ]
302
- }
303
- );
304
- var ErrorIcon_default = ErrorIcon;
305
-
306
- // src/tokens/svg/status/InfoIcon.tsx
307
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
308
- var InfoIcon = () => /* @__PURE__ */ jsxs2(
309
- "svg",
310
- {
311
- xmlns: "http://www.w3.org/2000/svg",
312
- width: "1em",
313
- height: "1em",
314
- viewBox: "0 0 16 16",
315
- fill: "none",
316
- children: [
317
- /* @__PURE__ */ jsxs2("g", { clipPath: "url(#clip0_1188_11261)", children: [
318
- /* @__PURE__ */ jsx2(
319
- "path",
320
- {
321
- d: "M8.00156 7.39999C8.33293 7.39999 8.60156 7.66862 8.60156 7.99999V10.6664C8.60156 10.9978 8.33293 11.2664 8.00156 11.2664C7.67019 11.2664 7.40156 10.9978 7.40156 10.6664V7.99999C7.40156 7.66862 7.67019 7.39999 8.00156 7.39999Z",
322
- fill: "currentColor"
323
- }
324
- ),
325
- /* @__PURE__ */ jsx2(
326
- "path",
327
- {
328
- d: "M8.00859 4.73358C8.3398 4.73378 8.60859 5.00233 8.60859 5.33358C8.60849 5.66474 8.33973 5.93338 8.00859 5.93358H8.00156C7.67026 5.93358 7.40167 5.66486 7.40156 5.33358C7.40156 5.00221 7.67019 4.73358 8.00156 4.73358H8.00859Z",
329
- fill: "currentColor"
330
- }
331
- ),
332
- /* @__PURE__ */ jsx2(
333
- "path",
334
- {
335
- fillRule: "evenodd",
336
- clipRule: "evenodd",
337
- d: "M8.00156 0.733582C12.0146 0.733793 15.2686 3.98697 15.2688 7.99999C15.2686 12.013 12.0146 15.267 8.00156 15.2672C3.98848 15.267 0.734481 12.0131 0.734375 7.99999C0.734516 3.98693 3.9885 0.733722 8.00156 0.733582ZM8.00156 1.93358C4.65124 1.93372 1.9353 4.64967 1.93516 7.99999C1.93526 11.3503 4.65122 14.067 8.00156 14.0672C11.3518 14.067 14.0686 11.3503 14.0688 7.99999C14.0686 4.64971 11.3518 1.93379 8.00156 1.93358Z",
338
- fill: "currentColor"
339
- }
340
- )
341
- ] }),
342
- /* @__PURE__ */ jsx2("defs", { children: /* @__PURE__ */ jsx2("clipPath", { id: "clip0_1188_11261", children: /* @__PURE__ */ jsx2("rect", { width: "16", height: "16", fill: "white" }) }) })
343
- ]
344
- }
345
- );
346
- var InfoIcon_default = InfoIcon;
347
-
348
- // src/tokens/svg/status/SuccessIcon.tsx
349
- import { jsx as jsx3 } from "react/jsx-runtime";
350
- var SuccessIcon = () => /* @__PURE__ */ jsx3(
351
- "svg",
352
- {
353
- xmlns: "http://www.w3.org/2000/svg",
354
- width: "1em",
355
- height: "1em",
356
- viewBox: "0 0 16 16",
357
- fill: "none",
358
- children: /* @__PURE__ */ jsx3(
359
- "path",
360
- {
361
- d: "M12.9084 3.57597C13.1426 3.34172 13.5225 3.34185 13.7568 3.57597C13.9911 3.81028 13.9911 4.19009 13.7568 4.4244L6.424 11.758C6.31157 11.8703 6.15869 11.9337 5.99978 11.9338C5.8409 11.9337 5.68798 11.8703 5.57556 11.758L2.24197 8.4244C2.00782 8.19018 2.00795 7.81028 2.24197 7.57597C2.47626 7.34167 2.85609 7.34172 3.09041 7.57597L5.999 10.4846L12.9084 3.57597Z",
362
- fill: "currentColor"
363
- }
364
- )
365
- }
366
- );
367
- var SuccessIcon_default = SuccessIcon;
368
-
369
- // src/components/FieldMessage/FieldMessage.tsx
370
- import { Fragment, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
371
- var ICON = {
372
- default: /* @__PURE__ */ jsx4(InfoIcon_default, {}),
373
- success: /* @__PURE__ */ jsx4(SuccessIcon_default, {}),
374
- warning: /* @__PURE__ */ jsx4(InfoIcon_default, {}),
375
- error: /* @__PURE__ */ jsx4(ErrorIcon_default, {})
376
- };
377
- var FieldMessage = (props) => {
378
- const { validations } = props;
379
- if (!validations || validations.length === 0) return null;
380
- return /* @__PURE__ */ jsx4("div", { className: "lib-xplat-field-message-wrap", children: validations.map((v, idx) => /* @__PURE__ */ jsxs3(
381
- "div",
382
- {
383
- className: clsx_default("lib-xplat-field-message", v.status),
384
- children: [
385
- /* @__PURE__ */ jsx4("div", { className: "icon", children: ICON[v.status] }),
386
- /* @__PURE__ */ jsx4("span", { children: v.message })
387
- ]
388
- },
389
- `${v.message}_${idx}`
390
- )) });
391
- };
392
- FieldMessage.displayName = "FieldMessage";
393
- var Field = (props) => {
394
- const { label, required = false, htmlFor, labelId, validations, children } = props;
395
- const hasMessages = !!validations && validations.length > 0;
396
- if (!label && !hasMessages) return /* @__PURE__ */ jsx4(Fragment, { children });
397
- return /* @__PURE__ */ jsxs3("div", { className: "lib-xplat-field", children: [
398
- label && /* @__PURE__ */ jsxs3("label", { className: "lib-xplat-field-label", id: labelId, htmlFor, children: [
399
- label,
400
- required && /* @__PURE__ */ jsx4("span", { className: "required", "aria-hidden": "true", children: "*" })
401
- ] }),
402
- children,
403
- hasMessages && /* @__PURE__ */ jsx4(FieldMessage, { validations })
404
- ] });
405
- };
406
- Field.displayName = "Field";
407
- var hasError = (validations) => !!validations?.some((v) => v.status === "error");
408
-
409
- // src/components/TimePicker/TimePicker.tsx
410
- import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
411
- var ANIMATION_DURATION_MS = 200;
412
- var toMinutes = (hhmm) => {
413
- if (!hhmm) return null;
414
- const m = /^(\d{1,2}):(\d{2})$/.exec(hhmm.trim());
415
- if (!m) return null;
416
- const h = Number(m[1]);
417
- const min = Number(m[2]);
418
- if (h > 23 || min > 59) return null;
419
- return h * 60 + min;
420
- };
421
- var toHHmm = (minutes) => `${String(Math.floor(minutes / 60)).padStart(2, "0")}:${String(minutes % 60).padStart(2, "0")}`;
422
- var display = (hhmm, use12Hours) => {
423
- if (!use12Hours) return hhmm;
424
- const total = toMinutes(hhmm);
425
- if (total === null) return hhmm;
426
- const h24 = Math.floor(total / 60);
427
- const mm = String(total % 60).padStart(2, "0");
428
- const period = h24 < 12 ? "\uC624\uC804" : "\uC624\uD6C4";
429
- const h12 = h24 % 12 === 0 ? 12 : h24 % 12;
430
- return `${period} ${h12}:${mm}`;
431
- };
432
- var TimePicker = (props) => {
433
- const {
434
- value,
435
- onChange,
436
- step = 30,
437
- min,
438
- max,
439
- use12Hours = false,
440
- placeholder = "\uC2DC\uAC01 \uC120\uD0DD",
441
- disabled = false,
442
- size = "md",
443
- label,
444
- required,
445
- validations
446
- } = props;
447
- const fieldId = React5.useId();
448
- const triggerRef = React5.useRef(null);
449
- const contentRef = React5.useRef(null);
450
- const [isOpen, setOpen] = React5.useState(false);
451
- const [mounted, setMounted] = React5.useState(false);
452
- const [visible, setVisible] = React5.useState(false);
453
- const options = React5.useMemo(() => {
454
- const safeStep = step > 0 && step <= 720 ? step : 30;
455
- const lo = toMinutes(min) ?? 0;
456
- const hi = toMinutes(max) ?? 24 * 60 - 1;
457
- const out = [];
458
- for (let t = lo; t <= hi; t += safeStep) out.push(toHHmm(t));
459
- return out;
460
- }, [step, min, max]);
461
- const close = React5.useCallback(() => setOpen(false), []);
462
- useClickOutside_default([triggerRef, contentRef], close, isOpen);
463
- useCloseWhenFocusHidden(isOpen, triggerRef, contentRef, close);
464
- useEscapeKey(isOpen, () => {
465
- close();
466
- triggerRef.current?.focus({ preventScroll: true });
467
- });
468
- const host = useOverlayHost_default(triggerRef, mounted);
469
- useAutoPosition_default(triggerRef, contentRef, mounted);
470
- React5.useEffect(() => {
471
- if (disabled && isOpen) setOpen(false);
472
- }, [disabled, isOpen]);
473
- React5.useEffect(() => {
474
- if (isOpen) {
475
- setMounted(true);
476
- const t2 = setTimeout(() => setVisible(true), 1);
477
- return () => clearTimeout(t2);
478
- }
479
- setVisible(false);
480
- const t = setTimeout(() => setMounted(false), ANIMATION_DURATION_MS);
481
- return () => clearTimeout(t);
482
- }, [isOpen]);
483
- const pick = (hhmm) => {
484
- onChange?.(hhmm);
485
- close();
486
- triggerRef.current?.focus({ preventScroll: true });
487
- };
488
- const control = /* @__PURE__ */ jsxs4("div", { className: clsx_default("lib-xplat-time-picker", size, disabled && "disabled"), children: [
489
- /* @__PURE__ */ jsx5(
490
- "div",
491
- {
492
- id: fieldId,
493
- ref: triggerRef,
494
- className: clsx_default("time-picker-trigger", hasError(validations) && "error"),
495
- role: "combobox",
496
- "aria-expanded": isOpen,
497
- "aria-haspopup": "listbox",
498
- "aria-invalid": hasError(validations) || void 0,
499
- tabIndex: disabled ? void 0 : 0,
500
- onClick: () => !disabled && setOpen((p) => !p),
501
- onKeyDown: (e) => {
502
- if (disabled) return;
503
- if (e.key === "Enter" || e.key === " " || e.key === "ArrowDown") {
504
- e.preventDefault();
505
- setOpen(true);
506
- }
507
- },
508
- children: /* @__PURE__ */ jsx5("span", { className: clsx_default("time-picker-value", !value && "placeholder"), children: value ? display(value, use12Hours) : placeholder })
509
- }
510
- ),
511
- mounted && /* @__PURE__ */ jsx5(Portal_default, { container: host, children: /* @__PURE__ */ jsx5(
512
- "div",
513
- {
514
- ref: contentRef,
515
- className: clsx_default("lib-xplat-time-picker-content", size, visible ? "enter" : "exit"),
516
- style: { width: triggerRef.current?.offsetWidth },
517
- role: "listbox",
518
- children: options.map((t) => /* @__PURE__ */ jsx5(
519
- "div",
520
- {
521
- className: clsx_default("time-picker-item", t === value && "is-selected"),
522
- role: "option",
523
- "aria-selected": t === value,
524
- tabIndex: 0,
525
- onClick: () => pick(t),
526
- onKeyDown: (e) => {
527
- if (e.key === "Enter" || e.key === " ") {
528
- e.preventDefault();
529
- pick(t);
530
- }
531
- },
532
- children: display(t, use12Hours)
533
- },
534
- t
535
- ))
536
- }
537
- ) })
538
- ] });
539
- return /* @__PURE__ */ jsx5(Field, { validations, label, required, htmlFor: fieldId, children: control });
540
- };
541
- TimePicker.displayName = "TimePicker";
542
- var TimePicker_default = TimePicker;
1
+ import {
2
+ TimePicker_default
3
+ } from "../../chunk-3FYYFDKQ.js";
4
+ import "../../chunk-UARGO5UG.js";
5
+ import "../../chunk-VSA62N2O.js";
6
+ import "../../chunk-F664X2OY.js";
7
+ import "../../chunk-7YOI5XOW.js";
8
+ import "../../chunk-BGXHIDUR.js";
9
+ import "../../chunk-KZOJN57Q.js";
543
10
  export {
544
11
  TimePicker_default as TimePicker
545
12
  };