@nexus-cross/design-system 1.0.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 (319) hide show
  1. package/cursor-rules/nexus-project-setup.mdc +292 -0
  2. package/cursor-rules/nexus-ui-api.mdc +698 -0
  3. package/cursor-rules/nexus-ui-components.mdc +136 -0
  4. package/dist/accordion.d.mts +28 -0
  5. package/dist/accordion.d.ts +28 -0
  6. package/dist/accordion.js +28 -0
  7. package/dist/accordion.mjs +3 -0
  8. package/dist/avatar.d.mts +17 -0
  9. package/dist/avatar.d.ts +17 -0
  10. package/dist/avatar.js +16 -0
  11. package/dist/avatar.mjs +3 -0
  12. package/dist/button.d.mts +17 -0
  13. package/dist/button.d.ts +17 -0
  14. package/dist/button.js +16 -0
  15. package/dist/button.mjs +3 -0
  16. package/dist/carousel.d.mts +36 -0
  17. package/dist/carousel.d.ts +36 -0
  18. package/dist/carousel.js +32 -0
  19. package/dist/carousel.mjs +3 -0
  20. package/dist/checkbox.d.mts +21 -0
  21. package/dist/checkbox.d.ts +21 -0
  22. package/dist/checkbox.js +20 -0
  23. package/dist/checkbox.mjs +3 -0
  24. package/dist/chip.d.mts +16 -0
  25. package/dist/chip.d.ts +16 -0
  26. package/dist/chip.js +16 -0
  27. package/dist/chip.mjs +3 -0
  28. package/dist/chunks/chunk-22ULI3BF.js +21 -0
  29. package/dist/chunks/chunk-26BUGBOY.mjs +57 -0
  30. package/dist/chunks/chunk-2JTPRBHZ.mjs +36 -0
  31. package/dist/chunks/chunk-2MC7XJSE.js +98 -0
  32. package/dist/chunks/chunk-2RPRCWKV.mjs +139 -0
  33. package/dist/chunks/chunk-2ZXDXO4I.js +166 -0
  34. package/dist/chunks/chunk-33UFQJIO.mjs +135 -0
  35. package/dist/chunks/chunk-3HHJORN7.mjs +137 -0
  36. package/dist/chunks/chunk-3PCNRCTB.js +61 -0
  37. package/dist/chunks/chunk-3VFBPFZF.mjs +640 -0
  38. package/dist/chunks/chunk-4J3GCZ7W.mjs +102 -0
  39. package/dist/chunks/chunk-54IA2P2Z.mjs +40 -0
  40. package/dist/chunks/chunk-54RBL7J4.mjs +179 -0
  41. package/dist/chunks/chunk-5JHJNN2K.js +83 -0
  42. package/dist/chunks/chunk-5JHN4FCY.mjs +58 -0
  43. package/dist/chunks/chunk-6FMDO6TT.mjs +114 -0
  44. package/dist/chunks/chunk-6H7V2I3X.mjs +270 -0
  45. package/dist/chunks/chunk-7AISZYWL.js +7 -0
  46. package/dist/chunks/chunk-7G65JBTN.js +133 -0
  47. package/dist/chunks/chunk-ADO7PDLY.mjs +66 -0
  48. package/dist/chunks/chunk-AFSEYJZT.js +267 -0
  49. package/dist/chunks/chunk-AOXXE5UQ.mjs +14 -0
  50. package/dist/chunks/chunk-AZ2URLDD.js +39 -0
  51. package/dist/chunks/chunk-B6G5TJRO.js +116 -0
  52. package/dist/chunks/chunk-BLGQHR3M.js +56 -0
  53. package/dist/chunks/chunk-BPUQ2CO2.mjs +48 -0
  54. package/dist/chunks/chunk-BSZ2LN6E.js +129 -0
  55. package/dist/chunks/chunk-CA3SOLI3.mjs +78 -0
  56. package/dist/chunks/chunk-CSJDDREF.js +90 -0
  57. package/dist/chunks/chunk-CVYXRSXT.mjs +8 -0
  58. package/dist/chunks/chunk-CZC76ZD5.js +10 -0
  59. package/dist/chunks/chunk-D6FII7HW.js +202 -0
  60. package/dist/chunks/chunk-DLFV7ZZV.js +112 -0
  61. package/dist/chunks/chunk-DO6VK2QQ.mjs +108 -0
  62. package/dist/chunks/chunk-ECVAVQUY.mjs +243 -0
  63. package/dist/chunks/chunk-EHAUUUWB.mjs +120 -0
  64. package/dist/chunks/chunk-EVOOTSY5.js +59 -0
  65. package/dist/chunks/chunk-GX6GSWX3.mjs +38 -0
  66. package/dist/chunks/chunk-HHXDOKXY.js +108 -0
  67. package/dist/chunks/chunk-HNLI646G.mjs +325 -0
  68. package/dist/chunks/chunk-HUPAHDJ7.js +273 -0
  69. package/dist/chunks/chunk-I252NERB.mjs +21 -0
  70. package/dist/chunks/chunk-IE4DGLMH.js +75 -0
  71. package/dist/chunks/chunk-INP2AH3B.js +27 -0
  72. package/dist/chunks/chunk-IOSIQLZL.js +70 -0
  73. package/dist/chunks/chunk-J5ZKGPBY.js +132 -0
  74. package/dist/chunks/chunk-JNMCYWGY.js +10 -0
  75. package/dist/chunks/chunk-LI7SFBUQ.mjs +89 -0
  76. package/dist/chunks/chunk-LMMON5AU.mjs +81 -0
  77. package/dist/chunks/chunk-LOQXCHKL.js +74 -0
  78. package/dist/chunks/chunk-MA2VCCIY.js +71 -0
  79. package/dist/chunks/chunk-MCKOWMLS.mjs +8 -0
  80. package/dist/chunks/chunk-MRRKW5QN.mjs +108 -0
  81. package/dist/chunks/chunk-MTX7GD3H.js +80 -0
  82. package/dist/chunks/chunk-NFIPQZ4O.js +100 -0
  83. package/dist/chunks/chunk-NHDGKOAM.js +104 -0
  84. package/dist/chunks/chunk-OMN5YQCE.js +143 -0
  85. package/dist/chunks/chunk-OTGS6BDQ.mjs +25 -0
  86. package/dist/chunks/chunk-P2T72N62.mjs +34 -0
  87. package/dist/chunks/chunk-P3DZKXG4.js +116 -0
  88. package/dist/chunks/chunk-QK6NCII4.js +36 -0
  89. package/dist/chunks/chunk-QZ4QR3XV.mjs +142 -0
  90. package/dist/chunks/chunk-RS3SBY3I.js +163 -0
  91. package/dist/chunks/chunk-RX5UKRYK.mjs +76 -0
  92. package/dist/chunks/chunk-SGNRVYYQ.mjs +99 -0
  93. package/dist/chunks/chunk-SJMCPSVH.mjs +76 -0
  94. package/dist/chunks/chunk-T2IY2TSR.js +43 -0
  95. package/dist/chunks/chunk-U53UA76K.js +653 -0
  96. package/dist/chunks/chunk-U56AGSLE.mjs +106 -0
  97. package/dist/chunks/chunk-ULGYTBCT.mjs +47 -0
  98. package/dist/chunks/chunk-V5OTJP6H.mjs +5 -0
  99. package/dist/chunks/chunk-VGO4Z2WH.js +336 -0
  100. package/dist/chunks/chunk-VIGRCJAE.mjs +37 -0
  101. package/dist/chunks/chunk-VVXQZ4XH.mjs +93 -0
  102. package/dist/chunks/chunk-W4GG5A7K.mjs +51 -0
  103. package/dist/chunks/chunk-WKCXACMZ.js +99 -0
  104. package/dist/chunks/chunk-WR55D4ZS.js +80 -0
  105. package/dist/chunks/chunk-X2SHTVZQ.js +89 -0
  106. package/dist/chunks/chunk-XEHFB62A.js +82 -0
  107. package/dist/chunks/chunk-XG6QG65W.mjs +63 -0
  108. package/dist/chunks/chunk-YB5ZKHVB.js +64 -0
  109. package/dist/chunks/chunk-YCG4FZC3.js +167 -0
  110. package/dist/chunks/chunk-YEWKPWK3.mjs +80 -0
  111. package/dist/chunks/chunk-YLO4UKSC.mjs +48 -0
  112. package/dist/chunks/chunk-YZV6FWE7.js +160 -0
  113. package/dist/chunks/chunk-ZWSIIGA3.mjs +58 -0
  114. package/dist/client-only.d.mts +13 -0
  115. package/dist/client-only.d.ts +13 -0
  116. package/dist/client-only.js +11 -0
  117. package/dist/client-only.mjs +2 -0
  118. package/dist/countdown.d.mts +27 -0
  119. package/dist/countdown.d.ts +27 -0
  120. package/dist/countdown.js +16 -0
  121. package/dist/countdown.mjs +3 -0
  122. package/dist/counter.d.mts +15 -0
  123. package/dist/counter.d.ts +15 -0
  124. package/dist/counter.js +11 -0
  125. package/dist/counter.mjs +2 -0
  126. package/dist/data-list.d.mts +33 -0
  127. package/dist/data-list.d.ts +33 -0
  128. package/dist/data-list.js +14 -0
  129. package/dist/data-list.mjs +5 -0
  130. package/dist/divider.d.mts +14 -0
  131. package/dist/divider.d.ts +14 -0
  132. package/dist/divider.js +16 -0
  133. package/dist/divider.mjs +3 -0
  134. package/dist/drawer.d.mts +42 -0
  135. package/dist/drawer.d.ts +42 -0
  136. package/dist/drawer.js +44 -0
  137. package/dist/drawer.mjs +3 -0
  138. package/dist/ellipsis.d.mts +16 -0
  139. package/dist/ellipsis.d.ts +16 -0
  140. package/dist/ellipsis.js +12 -0
  141. package/dist/ellipsis.mjs +3 -0
  142. package/dist/error-boundary.d.mts +20 -0
  143. package/dist/error-boundary.d.ts +20 -0
  144. package/dist/error-boundary.js +11 -0
  145. package/dist/error-boundary.mjs +2 -0
  146. package/dist/hooks/useCheckDevice.d.mts +47 -0
  147. package/dist/hooks/useCheckDevice.d.ts +47 -0
  148. package/dist/hooks/useCheckDevice.js +8 -0
  149. package/dist/hooks/useCheckDevice.mjs +2 -0
  150. package/dist/hooks/useClickOutside.d.mts +12 -0
  151. package/dist/hooks/useClickOutside.d.ts +12 -0
  152. package/dist/hooks/useClickOutside.js +8 -0
  153. package/dist/hooks/useClickOutside.mjs +2 -0
  154. package/dist/hooks/useDraggableBottomSheet.d.mts +24 -0
  155. package/dist/hooks/useDraggableBottomSheet.d.ts +24 -0
  156. package/dist/hooks/useDraggableBottomSheet.js +11 -0
  157. package/dist/hooks/useDraggableBottomSheet.mjs +2 -0
  158. package/dist/hooks/useDraggableWindow.d.mts +21 -0
  159. package/dist/hooks/useDraggableWindow.d.ts +21 -0
  160. package/dist/hooks/useDraggableWindow.js +11 -0
  161. package/dist/hooks/useDraggableWindow.mjs +2 -0
  162. package/dist/hooks/useInView.d.mts +14 -0
  163. package/dist/hooks/useInView.d.ts +14 -0
  164. package/dist/hooks/useInView.js +17 -0
  165. package/dist/hooks/useInView.mjs +2 -0
  166. package/dist/hooks/useModal.d.mts +2 -0
  167. package/dist/hooks/useModal.d.ts +2 -0
  168. package/dist/hooks/useModal.js +11 -0
  169. package/dist/hooks/useModal.mjs +2 -0
  170. package/dist/index.d.mts +76 -0
  171. package/dist/index.d.ts +76 -0
  172. package/dist/index.js +746 -0
  173. package/dist/index.mjs +328 -0
  174. package/dist/infinite-scroll.d.mts +26 -0
  175. package/dist/infinite-scroll.d.ts +26 -0
  176. package/dist/infinite-scroll.js +12 -0
  177. package/dist/infinite-scroll.mjs +3 -0
  178. package/dist/marquee.d.mts +12 -0
  179. package/dist/marquee.d.ts +12 -0
  180. package/dist/marquee.js +12 -0
  181. package/dist/marquee.mjs +3 -0
  182. package/dist/modal/index.d.mts +87 -0
  183. package/dist/modal/index.d.ts +87 -0
  184. package/dist/modal/index.js +54 -0
  185. package/dist/modal/index.mjs +9 -0
  186. package/dist/number-input.d.mts +38 -0
  187. package/dist/number-input.d.ts +38 -0
  188. package/dist/number-input.js +20 -0
  189. package/dist/number-input.mjs +3 -0
  190. package/dist/pagination.d.mts +22 -0
  191. package/dist/pagination.d.ts +22 -0
  192. package/dist/pagination.js +20 -0
  193. package/dist/pagination.mjs +3 -0
  194. package/dist/popover.d.mts +25 -0
  195. package/dist/popover.d.ts +25 -0
  196. package/dist/popover.js +32 -0
  197. package/dist/popover.mjs +3 -0
  198. package/dist/radio-group.d.mts +29 -0
  199. package/dist/radio-group.d.ts +29 -0
  200. package/dist/radio-group.js +24 -0
  201. package/dist/radio-group.mjs +3 -0
  202. package/dist/schemas/_all.json +2250 -0
  203. package/dist/schemas/accordion.json +101 -0
  204. package/dist/schemas/avatar.json +55 -0
  205. package/dist/schemas/button.json +71 -0
  206. package/dist/schemas/carousel.json +32 -0
  207. package/dist/schemas/carouselButton.json +20 -0
  208. package/dist/schemas/carouselDots.json +17 -0
  209. package/dist/schemas/carouselSlide.json +20 -0
  210. package/dist/schemas/checkBox.json +57 -0
  211. package/dist/schemas/chip.json +49 -0
  212. package/dist/schemas/clientOnly.json +19 -0
  213. package/dist/schemas/countdown.json +58 -0
  214. package/dist/schemas/counter.json +57 -0
  215. package/dist/schemas/dataList.json +56 -0
  216. package/dist/schemas/divider.json +40 -0
  217. package/dist/schemas/drawer.json +27 -0
  218. package/dist/schemas/drawerContent.json +50 -0
  219. package/dist/schemas/ellipsis.json +49 -0
  220. package/dist/schemas/errorBoundary.json +22 -0
  221. package/dist/schemas/infiniteScroll.json +65 -0
  222. package/dist/schemas/marquee.json +46 -0
  223. package/dist/schemas/modalCall.json +21 -0
  224. package/dist/schemas/modalTemplate.json +123 -0
  225. package/dist/schemas/numberInput.json +77 -0
  226. package/dist/schemas/pagination.json +50 -0
  227. package/dist/schemas/popover.json +67 -0
  228. package/dist/schemas/radioGroup.json +61 -0
  229. package/dist/schemas/radioItem.json +35 -0
  230. package/dist/schemas/select.json +62 -0
  231. package/dist/schemas/selectItem.json +31 -0
  232. package/dist/schemas/skeleton.json +48 -0
  233. package/dist/schemas/spinner.json +27 -0
  234. package/dist/schemas/switch.json +41 -0
  235. package/dist/schemas/tab.json +89 -0
  236. package/dist/schemas/table.json +75 -0
  237. package/dist/schemas/tableRow.json +32 -0
  238. package/dist/schemas/tdColumn.json +107 -0
  239. package/dist/schemas/textArea.json +44 -0
  240. package/dist/schemas/textInput.json +67 -0
  241. package/dist/schemas/themeProvider.json +65 -0
  242. package/dist/schemas/toaster.json +31 -0
  243. package/dist/schemas/tooltip.json +67 -0
  244. package/dist/schemas/virtualGrid.json +59 -0
  245. package/dist/schemas/virtualList.json +54 -0
  246. package/dist/schemas.d.mts +1263 -0
  247. package/dist/schemas.d.ts +1263 -0
  248. package/dist/schemas.js +513 -0
  249. package/dist/schemas.mjs +469 -0
  250. package/dist/select.d.mts +31 -0
  251. package/dist/select.d.ts +31 -0
  252. package/dist/select.js +24 -0
  253. package/dist/select.mjs +3 -0
  254. package/dist/skeleton.d.mts +15 -0
  255. package/dist/skeleton.d.ts +15 -0
  256. package/dist/skeleton.js +12 -0
  257. package/dist/skeleton.mjs +3 -0
  258. package/dist/spinner.d.mts +9 -0
  259. package/dist/spinner.d.ts +9 -0
  260. package/dist/spinner.js +12 -0
  261. package/dist/spinner.mjs +3 -0
  262. package/dist/styles/layer.d.mts +3 -0
  263. package/dist/styles/layer.d.ts +3 -0
  264. package/dist/styles/layer.js +18 -0
  265. package/dist/styles/layer.mjs +16 -0
  266. package/dist/styles.css +2401 -0
  267. package/dist/styles.d.mts +3 -0
  268. package/dist/styles.d.ts +3 -0
  269. package/dist/styles.js +16 -0
  270. package/dist/styles.layered.css +2404 -0
  271. package/dist/styles.mjs +14 -0
  272. package/dist/switch.d.mts +15 -0
  273. package/dist/switch.d.ts +15 -0
  274. package/dist/switch.js +16 -0
  275. package/dist/switch.mjs +3 -0
  276. package/dist/tab.d.mts +36 -0
  277. package/dist/tab.d.ts +36 -0
  278. package/dist/tab.js +20 -0
  279. package/dist/tab.mjs +3 -0
  280. package/dist/table.d.mts +80 -0
  281. package/dist/table.d.ts +80 -0
  282. package/dist/table.js +33 -0
  283. package/dist/table.mjs +4 -0
  284. package/dist/text-area.d.mts +15 -0
  285. package/dist/text-area.d.ts +15 -0
  286. package/dist/text-area.js +16 -0
  287. package/dist/text-area.mjs +3 -0
  288. package/dist/text-input.d.mts +21 -0
  289. package/dist/text-input.d.ts +21 -0
  290. package/dist/text-input.js +16 -0
  291. package/dist/text-input.mjs +3 -0
  292. package/dist/theme-provider.d.mts +25 -0
  293. package/dist/theme-provider.d.ts +25 -0
  294. package/dist/theme-provider.js +15 -0
  295. package/dist/theme-provider.mjs +2 -0
  296. package/dist/toast.d.mts +42 -0
  297. package/dist/toast.d.ts +42 -0
  298. package/dist/toast.js +20 -0
  299. package/dist/toast.mjs +3 -0
  300. package/dist/tooltip.d.mts +24 -0
  301. package/dist/tooltip.d.ts +24 -0
  302. package/dist/tooltip.js +20 -0
  303. package/dist/tooltip.mjs +3 -0
  304. package/dist/useModal-BsGIcP8t.d.mts +128 -0
  305. package/dist/useModal-BsGIcP8t.d.ts +128 -0
  306. package/dist/utils/cn.d.mts +5 -0
  307. package/dist/utils/cn.d.ts +5 -0
  308. package/dist/utils/cn.js +11 -0
  309. package/dist/utils/cn.mjs +2 -0
  310. package/dist/utils/scroll.d.mts +4 -0
  311. package/dist/utils/scroll.d.ts +4 -0
  312. package/dist/utils/scroll.js +15 -0
  313. package/dist/utils/scroll.mjs +2 -0
  314. package/dist/virtual-scroll.d.mts +34 -0
  315. package/dist/virtual-scroll.d.ts +34 -0
  316. package/dist/virtual-scroll.js +16 -0
  317. package/dist/virtual-scroll.mjs +3 -0
  318. package/package.json +291 -0
  319. package/scripts/setup-cursor-rules.cjs +92 -0
@@ -0,0 +1,102 @@
1
+ import { useState, useRef, useCallback } from 'react';
2
+
3
+ // src/hooks/useDraggableWindow.ts
4
+ function useDraggableWindow({
5
+ initialPosition,
6
+ persistKey,
7
+ targetRef
8
+ } = {}) {
9
+ const [position, setPosition] = useState(() => {
10
+ if (persistKey) {
11
+ try {
12
+ const saved = localStorage.getItem(`draggable-${persistKey}`);
13
+ if (saved) return JSON.parse(saved);
14
+ } catch {
15
+ }
16
+ }
17
+ return initialPosition ?? { x: -1, y: -1 };
18
+ });
19
+ const dragRef = useRef({
20
+ isDragging: false,
21
+ startX: 0,
22
+ startY: 0,
23
+ startPosX: 0,
24
+ startPosY: 0
25
+ });
26
+ const handleMouseDown = useCallback(
27
+ (e) => {
28
+ if (e.target.closest("button, input, select, textarea"))
29
+ return;
30
+ e.preventDefault();
31
+ let startPosX = position.x;
32
+ let startPosY = position.y;
33
+ if (startPosX === -1 && startPosY === -1 && targetRef?.current) {
34
+ const rect = targetRef.current.getBoundingClientRect();
35
+ startPosX = rect.left;
36
+ startPosY = rect.top;
37
+ setPosition({ x: startPosX, y: startPosY });
38
+ }
39
+ dragRef.current = {
40
+ isDragging: true,
41
+ startX: e.clientX,
42
+ startY: e.clientY,
43
+ startPosX,
44
+ startPosY
45
+ };
46
+ const handleMouseMove = (ev) => {
47
+ if (!dragRef.current.isDragging) return;
48
+ const dx = ev.clientX - dragRef.current.startX;
49
+ const dy = ev.clientY - dragRef.current.startY;
50
+ const newX = Math.max(
51
+ 0,
52
+ Math.min(window.innerWidth - 100, dragRef.current.startPosX + dx)
53
+ );
54
+ const newY = Math.max(
55
+ 0,
56
+ Math.min(window.innerHeight - 40, dragRef.current.startPosY + dy)
57
+ );
58
+ setPosition({ x: newX, y: newY });
59
+ };
60
+ const handleMouseUp = () => {
61
+ dragRef.current.isDragging = false;
62
+ document.removeEventListener("mousemove", handleMouseMove);
63
+ document.removeEventListener("mouseup", handleMouseUp);
64
+ document.body.style.cursor = "";
65
+ document.body.style.userSelect = "";
66
+ if (persistKey) {
67
+ setPosition((pos) => {
68
+ try {
69
+ localStorage.setItem(
70
+ `draggable-${persistKey}`,
71
+ JSON.stringify(pos)
72
+ );
73
+ } catch {
74
+ }
75
+ return pos;
76
+ });
77
+ }
78
+ };
79
+ document.body.style.cursor = "grabbing";
80
+ document.body.style.userSelect = "none";
81
+ document.addEventListener("mousemove", handleMouseMove);
82
+ document.addEventListener("mouseup", handleMouseUp);
83
+ },
84
+ [position, persistKey, targetRef]
85
+ );
86
+ const resetPosition = useCallback(() => {
87
+ const reset = initialPosition ?? { x: -1, y: -1 };
88
+ setPosition(reset);
89
+ if (persistKey) {
90
+ localStorage.removeItem(`draggable-${persistKey}`);
91
+ }
92
+ }, [initialPosition, persistKey]);
93
+ return {
94
+ position,
95
+ setPosition,
96
+ handleMouseDown,
97
+ resetPosition,
98
+ isDefaultPosition: position.x === -1 && position.y === -1
99
+ };
100
+ }
101
+
102
+ export { useDraggableWindow };
@@ -0,0 +1,40 @@
1
+ // src/utils/scroll.ts
2
+ var hasWindow = () => typeof window !== "undefined";
3
+ var scrollFreeze = () => {
4
+ if (!hasWindow()) return;
5
+ const body = document.body;
6
+ body.setAttribute(
7
+ "data-fz",
8
+ body.dataset.fz ? `${Number(body.dataset.fz) + 1}` : "1"
9
+ );
10
+ if (body.style.position !== "fixed") {
11
+ const scrollPosition = window.scrollY;
12
+ body.setAttribute("data-scroll-y", String(scrollPosition));
13
+ }
14
+ body.style.overflow = "hidden";
15
+ body.style.touchAction = "none";
16
+ body.style.position = "fixed";
17
+ body.style.top = `-${body.dataset.scrollY}px`;
18
+ body.style.left = "0";
19
+ body.style.width = "100%";
20
+ };
21
+ var scrollRelease = () => {
22
+ if (!hasWindow()) return;
23
+ const body = document.body;
24
+ if (body.dataset.fz && Number(body.dataset.fz) > 1) {
25
+ body.setAttribute("data-fz", `${Number(body.dataset.fz) - 1}`);
26
+ } else {
27
+ body.removeAttribute("data-fz");
28
+ body.style.position = "";
29
+ body.style.top = "";
30
+ body.style.left = "";
31
+ body.style.width = "";
32
+ body.style.overflow = "";
33
+ body.style.paddingRight = "";
34
+ body.style.backgroundColor = "";
35
+ body.style.touchAction = "";
36
+ window.scrollTo(0, Number(body.dataset.scrollY));
37
+ }
38
+ };
39
+
40
+ export { scrollFreeze, scrollRelease };
@@ -0,0 +1,179 @@
1
+ import { cn } from './chunk-MCKOWMLS.mjs';
2
+ import * as React from 'react';
3
+ import { cva } from 'class-variance-authority';
4
+ import { jsxs, jsx } from 'react/jsx-runtime';
5
+
6
+ var textInputVariants = cva("nexus-text-input", {
7
+ variants: {
8
+ size: {
9
+ sm: "nexus-text-input--sm",
10
+ md: "nexus-text-input--md",
11
+ lg: "nexus-text-input--lg",
12
+ xl: "nexus-text-input--xl"
13
+ },
14
+ state: {
15
+ default: "nexus-text-input--default",
16
+ error: "nexus-text-input--error"
17
+ }
18
+ },
19
+ defaultVariants: { size: "md", state: "default" }
20
+ });
21
+ var ClearIcon = () => /* @__PURE__ */ jsx(
22
+ "svg",
23
+ {
24
+ width: "14",
25
+ height: "14",
26
+ viewBox: "0 0 14 14",
27
+ fill: "none",
28
+ stroke: "currentColor",
29
+ strokeWidth: "1.5",
30
+ strokeLinecap: "round",
31
+ children: /* @__PURE__ */ jsx("path", { d: "M10.5 3.5L3.5 10.5M3.5 3.5L10.5 10.5" })
32
+ }
33
+ );
34
+ var TextInput = React.forwardRef(
35
+ ({
36
+ className,
37
+ size,
38
+ error,
39
+ prefixIcon,
40
+ suffixIcon,
41
+ label,
42
+ description,
43
+ showCount,
44
+ clearable,
45
+ onValueChange,
46
+ onChange,
47
+ value: controlledValue,
48
+ defaultValue,
49
+ disabled,
50
+ maxLength,
51
+ id,
52
+ ...props
53
+ }, ref) => {
54
+ const state = error ? "error" : "default";
55
+ const fallbackId = React.useRef(
56
+ `nexus-ti-${Math.random().toString(36).slice(2, 9)}`
57
+ );
58
+ const inputId = id || fallbackId.current;
59
+ const inputRef = React.useRef(null);
60
+ const setInputRef = React.useCallback(
61
+ (node) => {
62
+ inputRef.current = node;
63
+ if (typeof ref === "function") ref(node);
64
+ else if (ref)
65
+ ref.current = node;
66
+ },
67
+ [ref]
68
+ );
69
+ const isControlled = controlledValue !== void 0;
70
+ const [internalValue, setInternalValue] = React.useState(
71
+ () => defaultValue != null ? String(defaultValue) : ""
72
+ );
73
+ const currentValue = isControlled ? String(controlledValue) : internalValue;
74
+ const charCount = currentValue.length;
75
+ const isOverLimit = !!(maxLength && charCount > maxLength);
76
+ const hasField = !!(label || description || showCount);
77
+ const handleChange = React.useCallback(
78
+ (e) => {
79
+ if (!isControlled) setInternalValue(e.target.value);
80
+ onValueChange?.(e.target.value);
81
+ onChange?.(e);
82
+ },
83
+ [isControlled, onValueChange, onChange]
84
+ );
85
+ const handleClear = React.useCallback(() => {
86
+ const input = inputRef.current;
87
+ if (!input) return;
88
+ const setter = Object.getOwnPropertyDescriptor(
89
+ HTMLInputElement.prototype,
90
+ "value"
91
+ )?.set;
92
+ if (setter) {
93
+ setter.call(input, "");
94
+ input.dispatchEvent(new Event("input", { bubbles: true }));
95
+ }
96
+ if (!isControlled) setInternalValue("");
97
+ onValueChange?.("");
98
+ input.focus();
99
+ }, [isControlled, onValueChange]);
100
+ const inputBox = /* @__PURE__ */ jsxs(
101
+ "div",
102
+ {
103
+ className: cn(
104
+ textInputVariants({ size, state }),
105
+ disabled && "nexus-text-input--disabled",
106
+ !hasField && className
107
+ ),
108
+ children: [
109
+ prefixIcon && /* @__PURE__ */ jsx("span", { className: "nexus-text-input__icon", children: prefixIcon }),
110
+ /* @__PURE__ */ jsx(
111
+ "input",
112
+ {
113
+ ref: setInputRef,
114
+ id: label ? inputId : id,
115
+ className: "nexus-text-input__inner",
116
+ disabled,
117
+ maxLength,
118
+ "aria-invalid": error || void 0,
119
+ "aria-describedby": description ? `${inputId}-desc` : void 0,
120
+ value: isControlled ? controlledValue : void 0,
121
+ defaultValue: !isControlled ? defaultValue : void 0,
122
+ onChange: handleChange,
123
+ ...props
124
+ }
125
+ ),
126
+ clearable && currentValue.length > 0 && !disabled && /* @__PURE__ */ jsx(
127
+ "button",
128
+ {
129
+ type: "button",
130
+ className: "nexus-text-input__clear",
131
+ onClick: handleClear,
132
+ tabIndex: -1,
133
+ "aria-label": "Clear",
134
+ children: /* @__PURE__ */ jsx(ClearIcon, {})
135
+ }
136
+ ),
137
+ suffixIcon && /* @__PURE__ */ jsx("span", { className: "nexus-text-input__icon", children: suffixIcon })
138
+ ]
139
+ }
140
+ );
141
+ if (!hasField) return inputBox;
142
+ return /* @__PURE__ */ jsxs("div", { className: cn("nexus-text-input-field", className), children: [
143
+ label && /* @__PURE__ */ jsx("label", { className: "nexus-text-input-field__label", htmlFor: inputId, children: label }),
144
+ inputBox,
145
+ (description || showCount && maxLength) && /* @__PURE__ */ jsxs("div", { className: "nexus-text-input-field__footer", children: [
146
+ description && /* @__PURE__ */ jsx(
147
+ "p",
148
+ {
149
+ id: `${inputId}-desc`,
150
+ className: cn(
151
+ "nexus-text-input-field__description",
152
+ error && "nexus-text-input-field__description--error"
153
+ ),
154
+ children: description
155
+ }
156
+ ),
157
+ showCount && maxLength && /* @__PURE__ */ jsxs(
158
+ "span",
159
+ {
160
+ className: cn(
161
+ "nexus-text-input-field__count",
162
+ isOverLimit && "nexus-text-input-field__count--error"
163
+ ),
164
+ "aria-live": "polite",
165
+ "aria-atomic": "true",
166
+ children: [
167
+ charCount,
168
+ "/",
169
+ maxLength
170
+ ]
171
+ }
172
+ )
173
+ ] })
174
+ ] });
175
+ }
176
+ );
177
+ TextInput.displayName = "TextInput";
178
+
179
+ export { TextInput, textInputVariants };
@@ -0,0 +1,83 @@
1
+ 'use strict';
2
+
3
+ var chunkCZC76ZD5_js = require('./chunk-CZC76ZD5.js');
4
+ var react = require('react');
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+
7
+ var DefaultSpinner = () => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nexus-infinite-spinner", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nexus-infinite-spinner-icon" }) });
8
+ var InfiniteScroll = ({
9
+ className = "",
10
+ tag = "div",
11
+ list,
12
+ scrollTarget = null,
13
+ rootMargin = 100,
14
+ loading,
15
+ loadingElement = /* @__PURE__ */ jsxRuntime.jsx(DefaultSpinner, {}),
16
+ children,
17
+ handleLoadMore,
18
+ ...props
19
+ }) => {
20
+ const target = react.useRef(null);
21
+ const listRef = react.useRef(list);
22
+ const totalCountRef = react.useRef("totalCount" in props ? props.totalCount : void 0);
23
+ const hasMoreRef = react.useRef("hasMore" in props ? props.hasMore : void 0);
24
+ const loadingRef = react.useRef(loading);
25
+ const prevCount = react.useRef(-1);
26
+ const [count, setCount] = react.useState(0);
27
+ const io = react.useMemo(() => {
28
+ if (typeof window === "undefined") return null;
29
+ return new IntersectionObserver(
30
+ (entries, observer) => {
31
+ if (!target.current) return;
32
+ if (entries[0].intersectionRatio > 0.2) {
33
+ if (!loadingRef.current) {
34
+ setCount((v) => v + 1);
35
+ observer.disconnect();
36
+ }
37
+ }
38
+ },
39
+ {
40
+ root: !scrollTarget ? null : "current" in scrollTarget ? scrollTarget.current : scrollTarget,
41
+ rootMargin: `${rootMargin}px 0px`,
42
+ threshold: [0.1, 0.2, 0.5, 0.8, 0.9, 1]
43
+ }
44
+ );
45
+ }, [rootMargin, scrollTarget]);
46
+ const hasNext = react.useCallback(() => {
47
+ if (!listRef.current || loadingRef.current) return false;
48
+ if (typeof totalCountRef.current !== "undefined") {
49
+ return totalCountRef.current > listRef.current.length;
50
+ }
51
+ return !!hasMoreRef.current;
52
+ }, []);
53
+ react.useEffect(() => {
54
+ if (count > 0 && prevCount.current < count && (listRef.current ?? []).length && hasNext()) {
55
+ prevCount.current = count;
56
+ handleLoadMore();
57
+ }
58
+ }, [count, hasNext, handleLoadMore]);
59
+ react.useEffect(() => {
60
+ const observeEl = target.current;
61
+ if (observeEl && io) io.observe(observeEl);
62
+ return () => {
63
+ if (observeEl && io) io.unobserve(observeEl);
64
+ };
65
+ }, [list, io]);
66
+ react.useEffect(() => {
67
+ if ("totalCount" in props) {
68
+ totalCountRef.current = props.totalCount;
69
+ } else {
70
+ hasMoreRef.current = props.hasMore;
71
+ }
72
+ listRef.current = [...list || []];
73
+ }, [list, props]);
74
+ react.useEffect(() => {
75
+ loadingRef.current = loading;
76
+ }, [loading]);
77
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkCZC76ZD5_js.cn("nexus-infinite-scroll", className), children: [
78
+ react.createElement(tag, null, children),
79
+ /* @__PURE__ */ jsxRuntime.jsx("div", { ref: target, className: "nexus-infinite-sentinel", role: "status", "aria-live": "polite", children: loading && (list ?? []).length > 0 && loadingElement })
80
+ ] });
81
+ };
82
+
83
+ exports.InfiniteScroll = InfiniteScroll;
@@ -0,0 +1,58 @@
1
+ import { ErrorBoundary } from './chunk-VIGRCJAE.mjs';
2
+ import { Spinner } from './chunk-BPUQ2CO2.mjs';
3
+ import { cn } from './chunk-MCKOWMLS.mjs';
4
+ import * as React from 'react';
5
+ import { jsx } from 'react/jsx-runtime';
6
+
7
+ function DataList({
8
+ list,
9
+ loadingElement,
10
+ skeletonElement,
11
+ skeletonCount = 3,
12
+ noDataMessage,
13
+ loading = false,
14
+ errorFallback,
15
+ children,
16
+ className
17
+ }) {
18
+ const content = React.useMemo(() => {
19
+ if (!list || loading) {
20
+ if (skeletonElement) {
21
+ return Array.from({ length: skeletonCount }).map(
22
+ (_, index) => React.cloneElement(skeletonElement, {
23
+ ...skeletonElement.props,
24
+ key: index
25
+ })
26
+ );
27
+ }
28
+ return loadingElement ?? /* @__PURE__ */ jsx("div", { className: cn("nexus-datalist-center"), children: /* @__PURE__ */ jsx(Spinner, { size: 32 }) });
29
+ }
30
+ if (list.length === 0) {
31
+ if (React.isValidElement(noDataMessage)) {
32
+ return noDataMessage;
33
+ }
34
+ return /* @__PURE__ */ jsx(
35
+ "p",
36
+ {
37
+ className: cn("nexus-datalist-empty"),
38
+ children: noDataMessage ?? "\uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4"
39
+ }
40
+ );
41
+ }
42
+ return list.map(
43
+ (item, index) => children({ item, index })
44
+ );
45
+ }, [
46
+ list,
47
+ loading,
48
+ skeletonElement,
49
+ skeletonCount,
50
+ loadingElement,
51
+ noDataMessage,
52
+ children
53
+ ]);
54
+ return /* @__PURE__ */ jsx(ErrorBoundary, { fallback: errorFallback, children: /* @__PURE__ */ jsx("div", { className, children: content }) });
55
+ }
56
+ DataList.displayName = "DataList";
57
+
58
+ export { DataList };
@@ -0,0 +1,114 @@
1
+ import { cn } from './chunk-MCKOWMLS.mjs';
2
+ import { useRef, useState, useCallback, useMemo, useLayoutEffect } from 'react';
3
+ import { jsxs, jsx } from 'react/jsx-runtime';
4
+
5
+ var ChevronDown = ({ className }) => /* @__PURE__ */ jsx("svg", { className, viewBox: "0 0 16 16", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M4 6l4 4 4-4", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) });
6
+ var Ellipsis = ({
7
+ className,
8
+ content = "",
9
+ triggerMore = "more",
10
+ triggerLess = "less",
11
+ lineClamp = 2,
12
+ defaultShortened = true,
13
+ observingEnvs = [],
14
+ onShowMoreLessClick
15
+ }) => {
16
+ const contentRef = useRef(null);
17
+ const isMeasuringRef = useRef(false);
18
+ const prevObservingEnvs = useRef([...observingEnvs]);
19
+ const [shortened, setShortened] = useState(defaultShortened);
20
+ const [triggerVisible, setTriggerVisible] = useState(false);
21
+ const allocateContentElementStyle = useCallback(
22
+ (style) => {
23
+ const el = contentRef.current;
24
+ if (!el) return;
25
+ if (style) {
26
+ el.style.maxHeight = `${style.openHeight}px`;
27
+ el.style.minHeight = `${style.closeHeight}px`;
28
+ el.style.height = `${style.closeHeight}px`;
29
+ } else {
30
+ el.style.maxHeight = "";
31
+ el.style.minHeight = "";
32
+ el.style.height = "";
33
+ }
34
+ },
35
+ []
36
+ );
37
+ const resetContentElementAfterMeasuring = useCallback(
38
+ ({ openHeight, closeHeight }) => {
39
+ allocateContentElementStyle({ openHeight, closeHeight });
40
+ setTriggerVisible(closeHeight + 10 < openHeight);
41
+ setShortened(defaultShortened);
42
+ isMeasuringRef.current = false;
43
+ },
44
+ [defaultShortened, allocateContentElementStyle]
45
+ );
46
+ const initializeContentElement = useCallback(() => {
47
+ allocateContentElementStyle(null);
48
+ setShortened(true);
49
+ isMeasuringRef.current = true;
50
+ }, [allocateContentElementStyle]);
51
+ const handleToggle = useCallback((e) => {
52
+ e.stopPropagation();
53
+ setShortened((prev) => !prev);
54
+ }, []);
55
+ const contentStyle = useMemo(
56
+ () => shortened ? {
57
+ display: "-webkit-box",
58
+ WebkitLineClamp: lineClamp,
59
+ WebkitBoxOrient: "vertical",
60
+ overflow: "hidden",
61
+ height: contentRef.current?.style.minHeight
62
+ } : {
63
+ WebkitLineClamp: void 0,
64
+ height: contentRef.current?.style.maxHeight
65
+ },
66
+ [shortened, lineClamp]
67
+ );
68
+ useLayoutEffect(() => {
69
+ if (contentRef.current) initializeContentElement();
70
+ }, [initializeContentElement]);
71
+ useLayoutEffect(() => {
72
+ if (!contentRef.current) return;
73
+ const isEnvChanged = observingEnvs.length ? observingEnvs.some((env, i) => env !== prevObservingEnvs.current[i]) : false;
74
+ if (isEnvChanged) {
75
+ prevObservingEnvs.current = [...observingEnvs];
76
+ initializeContentElement();
77
+ }
78
+ }, [observingEnvs, initializeContentElement]);
79
+ useLayoutEffect(() => {
80
+ const el = contentRef.current;
81
+ if (shortened && isMeasuringRef.current && el) {
82
+ resetContentElementAfterMeasuring({
83
+ openHeight: el.scrollHeight,
84
+ closeHeight: el.offsetHeight
85
+ });
86
+ }
87
+ }, [shortened, content, observingEnvs, resetContentElementAfterMeasuring]);
88
+ return /* @__PURE__ */ jsxs("div", { className: cn("nexus-ellipsis", className), children: [
89
+ /* @__PURE__ */ jsx(
90
+ "div",
91
+ {
92
+ ref: contentRef,
93
+ className: "nexus-ellipsis__content",
94
+ style: contentStyle,
95
+ children: typeof content === "string" ? /* @__PURE__ */ jsx("span", { dangerouslySetInnerHTML: { __html: content } }) : content
96
+ }
97
+ ),
98
+ triggerVisible && /* @__PURE__ */ jsxs(
99
+ "button",
100
+ {
101
+ type: "button",
102
+ onClick: onShowMoreLessClick ?? handleToggle,
103
+ className: cn("nexus-ellipsis__trigger", !shortened && "nexus-ellipsis__trigger--expanded"),
104
+ "aria-expanded": !shortened,
105
+ children: [
106
+ shortened ? triggerMore : triggerLess,
107
+ /* @__PURE__ */ jsx(ChevronDown, { className: "nexus-ellipsis__chevron" })
108
+ ]
109
+ }
110
+ )
111
+ ] });
112
+ };
113
+
114
+ export { Ellipsis };