@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,653 @@
1
+ 'use strict';
2
+
3
+ var chunkHHXDOKXY_js = require('./chunk-HHXDOKXY.js');
4
+ var chunkNHDGKOAM_js = require('./chunk-NHDGKOAM.js');
5
+ var chunkT2IY2TSR_js = require('./chunk-T2IY2TSR.js');
6
+ var chunkXEHFB62A_js = require('./chunk-XEHFB62A.js');
7
+ var chunkINP2AH3B_js = require('./chunk-INP2AH3B.js');
8
+ var chunkHUPAHDJ7_js = require('./chunk-HUPAHDJ7.js');
9
+ var chunkCZC76ZD5_js = require('./chunk-CZC76ZD5.js');
10
+ var React = require('react');
11
+ var jsxRuntime = require('react/jsx-runtime');
12
+ var reactDom = require('react-dom');
13
+ var classVarianceAuthority = require('class-variance-authority');
14
+
15
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
16
+
17
+ var React__default = /*#__PURE__*/_interopDefault(React);
18
+
19
+ function wait(ms) {
20
+ return new Promise((resolve) => setTimeout(resolve, ms));
21
+ }
22
+ var LazyLoadComponent = ({
23
+ onLoaded
24
+ }) => {
25
+ React.useEffect(() => {
26
+ onLoaded();
27
+ }, []);
28
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {});
29
+ };
30
+ var Component = ({
31
+ is,
32
+ props,
33
+ handleOpenStatus
34
+ }) => {
35
+ const [loading, setLoading] = React.useState(!is.displayName);
36
+ const component = React.useMemo(() => {
37
+ if (is.displayName) {
38
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: React__default.default.createElement(is, { ...props }) });
39
+ }
40
+ return /* @__PURE__ */ jsxRuntime.jsx(React.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
41
+ React__default.default.createElement(is, { ...props }),
42
+ /* @__PURE__ */ jsxRuntime.jsx(LazyLoadComponent, { onLoaded: () => setLoading(false) })
43
+ ] }) });
44
+ }, [is, props]);
45
+ React.useEffect(() => {
46
+ if (!loading) {
47
+ handleOpenStatus();
48
+ }
49
+ }, [loading, handleOpenStatus]);
50
+ return component;
51
+ };
52
+ var ModalComponent = React.forwardRef(
53
+ ({ className, modal, breakPoints, scrollFreeze: scrollFreeze2, scrollRelease: scrollRelease2, deleteModal, resolveModal }, ref) => {
54
+ const { isMobile } = chunkXEHFB62A_js.useCheckDevice_default(breakPoints);
55
+ const [status, setStatus] = React.useState("");
56
+ const clickOutSideTarget = React.useMemo(() => {
57
+ if (modal.props?.clickOutSideRef) {
58
+ return modal.props.clickOutSideRef.current ?? null;
59
+ }
60
+ if (modal.props?.portalId) {
61
+ return document.querySelector(`#${modal.props.portalId}`);
62
+ }
63
+ return null;
64
+ }, [modal.props?.clickOutSideRef, modal.props?.portalId]);
65
+ const animationInfo = React.useMemo(() => {
66
+ const animation = modal.props?.animation ?? {};
67
+ return {
68
+ name: isMobile ? animation.mobile ?? animation.name : animation.name,
69
+ duration: animation.duration || "0",
70
+ timingFunction: animation.timingFunc || "cubic-bezier(0.25, 0.1, 0.25, 1.0)",
71
+ leaveTimingFunction: animation.leaveTimingFunc ? animation.leaveTimingFunc : animation.timingFunc || "cubic-bezier(0.25, 0.1, 0.25, 1.0)"
72
+ };
73
+ }, [isMobile, modal.props?.animation]);
74
+ const resolvedLayout = React.useMemo(() => {
75
+ if (modal.props?.layout) {
76
+ return modal.props.layout;
77
+ }
78
+ if (animationInfo.name === "bottom-sheet") return "bottom-sheet";
79
+ if (animationInfo.name === "slide-left") return "slide-left";
80
+ if (animationInfo.name === "slide-right") return "slide-right";
81
+ if (animationInfo.name === "full-page") return "full-page";
82
+ if (animationInfo.name === "full-page-reverse") return "full-page-reverse";
83
+ return void 0;
84
+ }, [modal.props?.layout, animationInfo.name]);
85
+ const close = React.useCallback(
86
+ async (modalId, isAnimation = true) => {
87
+ setStatus("leave");
88
+ if (isAnimation && !!animationInfo.name) {
89
+ const duration = modal.props.animation?.duration ?? 0;
90
+ await wait(duration + 50);
91
+ }
92
+ deleteModal(modalId);
93
+ },
94
+ [animationInfo.name, deleteModal, modal.props.animation]
95
+ );
96
+ const resolve = (modal2, result, useClose) => {
97
+ resolveModal({ modal: modal2, result, useClose });
98
+ };
99
+ const handleOpenStatus = React.useCallback(async () => {
100
+ await wait(
101
+ modal.props?.animation?.delay ?? 0
102
+ );
103
+ setStatus("enter");
104
+ if (animationInfo.name) {
105
+ await wait(
106
+ modal.props.animation?.duration ?? 0
107
+ );
108
+ }
109
+ setStatus("enter-done");
110
+ }, [modal.props.animation, animationInfo.name]);
111
+ React.useEffect(() => {
112
+ if (!modal.props.scrollEnable) {
113
+ scrollFreeze2?.();
114
+ return () => {
115
+ scrollRelease2?.();
116
+ };
117
+ }
118
+ }, [modal.props.scrollEnable, scrollFreeze2, scrollRelease2]);
119
+ chunkINP2AH3B_js.useClickOutside_default(clickOutSideTarget, () => {
120
+ close(modal.id, true);
121
+ });
122
+ React.useImperativeHandle(ref, () => ({
123
+ modalId: modal.id,
124
+ hasClose: !!modal.close,
125
+ close
126
+ }));
127
+ const getModalClassName = () => {
128
+ const baseClasses = ["nexus-modal-component"];
129
+ if (modal.props.portalId) {
130
+ baseClasses.push("nexus-modal-component--portal");
131
+ }
132
+ if (["enter", "enter-done", "leave"].includes(status)) {
133
+ baseClasses.push("nexus-modal-component--visible");
134
+ }
135
+ if (status === "enter") {
136
+ baseClasses.push("nexus-modal-component--enter");
137
+ } else if (status === "leave") {
138
+ baseClasses.push("nexus-modal-component--leave");
139
+ }
140
+ if (className) {
141
+ baseClasses.push(className);
142
+ }
143
+ return baseClasses.join(" ");
144
+ };
145
+ const dimOpacity = status === "enter" || status === "enter-done" ? 1 : 0;
146
+ const getModalStyle = () => {
147
+ return {
148
+ "--modal-animation-name": status === "enter" || status === "leave" ? `modal-${animationInfo.name}` : "",
149
+ "--modal-animation-direction": status === "leave" ? "reverse" : "normal",
150
+ "--modal-animation-fill-mode": status === "leave" ? "forwards" : "",
151
+ "--modal-animation-duration": `${animationInfo.duration}ms`,
152
+ "--modal-animation-timing-function": status === "leave" ? animationInfo.leaveTimingFunction : animationInfo.timingFunction,
153
+ "--modal-dim-opacity": dimOpacity
154
+ };
155
+ };
156
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: getModalClassName(), style: getModalStyle(), children: /* @__PURE__ */ jsxRuntime.jsx(
157
+ Component,
158
+ {
159
+ is: modal.component,
160
+ props: {
161
+ ...modal.props,
162
+ className: status,
163
+ layout: resolvedLayout,
164
+ close: (isAnimation) => close(modal.id, isAnimation),
165
+ resolve: (result, useClose = true) => resolve(modal, result, useClose)
166
+ },
167
+ handleOpenStatus
168
+ },
169
+ modal.id
170
+ ) });
171
+ }
172
+ );
173
+ ModalComponent.displayName = "ModalComponent";
174
+ var ModalComponent_default = ModalComponent;
175
+ var ModalPortal = ({ children, selector }) => {
176
+ const [mounted, setMounted] = React.useState(false);
177
+ let element = null;
178
+ if (typeof window !== "undefined") {
179
+ const elements = document.querySelectorAll(
180
+ selector.includes("#") ? selector : `#${selector}`
181
+ );
182
+ if (elements.length === 1) {
183
+ element = elements[0];
184
+ }
185
+ }
186
+ React.useEffect(() => {
187
+ setMounted(true);
188
+ return () => setMounted(false);
189
+ }, []);
190
+ return mounted && element && children ? reactDom.createPortal(children, element) : null;
191
+ };
192
+ var ModalPortal_default = ModalPortal;
193
+ var ModalContainer = ({ className = "", breakPoints, ...defaultOption }) => {
194
+ const [modals, setModals] = React.useState(chunkHUPAHDJ7_js.Modal_default.modalList);
195
+ const setModalClose = React.useCallback((params) => {
196
+ if (!params) return;
197
+ const { modalId, hasClose, close } = params;
198
+ if (!hasClose) {
199
+ chunkHUPAHDJ7_js.Modal_default.modalList = chunkHUPAHDJ7_js.Modal_default.modalList.map(
200
+ (m) => m.id === modalId ? { ...m, close } : m
201
+ );
202
+ }
203
+ }, []);
204
+ React.useEffect(() => {
205
+ chunkHUPAHDJ7_js.Modal_default.observe({ options: defaultOption, observeFunction: setModals });
206
+ return () => {
207
+ chunkHUPAHDJ7_js.Modal_default.unobserve();
208
+ };
209
+ }, [defaultOption]);
210
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { id: "modal-wrapper", className, children: modals.map(
211
+ (m) => m.props.portalId ? /* @__PURE__ */ jsxRuntime.jsx(ModalPortal_default, { selector: m.props.portalId, children: /* @__PURE__ */ jsxRuntime.jsx(
212
+ ModalComponent_default,
213
+ {
214
+ ref: setModalClose,
215
+ modal: m,
216
+ breakPoints,
217
+ deleteModal: (id) => chunkHUPAHDJ7_js.Modal_default.deleteModal(id),
218
+ resolveModal: (params) => chunkHUPAHDJ7_js.Modal_default.resolveModal(params),
219
+ scrollFreeze: chunkT2IY2TSR_js.scrollFreeze,
220
+ scrollRelease: chunkT2IY2TSR_js.scrollRelease
221
+ },
222
+ m.id
223
+ ) }, m.id) : /* @__PURE__ */ jsxRuntime.jsx(
224
+ ModalComponent_default,
225
+ {
226
+ ref: setModalClose,
227
+ modal: m,
228
+ breakPoints,
229
+ deleteModal: (id) => chunkHUPAHDJ7_js.Modal_default.deleteModal(id),
230
+ resolveModal: (params) => chunkHUPAHDJ7_js.Modal_default.resolveModal(params),
231
+ scrollFreeze: chunkT2IY2TSR_js.scrollFreeze,
232
+ scrollRelease: chunkT2IY2TSR_js.scrollRelease
233
+ },
234
+ m.id
235
+ )
236
+ ) });
237
+ };
238
+ var ModalContainer_default = ModalContainer;
239
+ var ModalPortalTarget = ({ id, className }) => {
240
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { id, className: chunkCZC76ZD5_js.cn("nexus-modal-portal-target", className) });
241
+ };
242
+ var ModalPortalTarget_default = ModalPortalTarget;
243
+ var modalWrapVariants = classVarianceAuthority.cva("nexus-modal-wrap", {
244
+ variants: {
245
+ layout: {
246
+ default: "",
247
+ "bottom-sheet": "nexus-modal-wrap--bottom-sheet",
248
+ "slide-left": "nexus-modal-wrap--slide-left",
249
+ "slide-right": "nexus-modal-wrap--slide-right",
250
+ "full-page": "nexus-modal-wrap--full-page",
251
+ "full-page-reverse": "nexus-modal-wrap--full-page-reverse",
252
+ draggable: ""
253
+ }
254
+ },
255
+ defaultVariants: {
256
+ layout: "default"
257
+ }
258
+ });
259
+ var modalInnerVariants = classVarianceAuthority.cva("nexus-modal-inner", {
260
+ variants: {
261
+ layout: {
262
+ default: "",
263
+ "bottom-sheet": "nexus-modal-inner--bottom-sheet",
264
+ "slide-left": "nexus-modal-inner--slide-left",
265
+ "slide-right": "nexus-modal-inner--slide-right",
266
+ "full-page": "nexus-modal-inner--full-page",
267
+ "full-page-reverse": "nexus-modal-inner--full-page-reverse",
268
+ draggable: "nexus-modal-inner--draggable"
269
+ },
270
+ hasFooter: {
271
+ true: "nexus-modal-inner--has-footer",
272
+ false: ""
273
+ }
274
+ },
275
+ compoundVariants: [
276
+ { layout: "bottom-sheet", hasFooter: true, class: "nexus-modal-inner--bottom-sheet nexus-modal-inner--has-footer" }
277
+ ],
278
+ defaultVariants: {
279
+ layout: "default",
280
+ hasFooter: false
281
+ }
282
+ });
283
+ var modalHeaderVariants = classVarianceAuthority.cva("nexus-modal-header", {
284
+ variants: {
285
+ layout: {
286
+ default: "",
287
+ "bottom-sheet": "nexus-modal-header--bottom-sheet",
288
+ "slide-left": "",
289
+ "slide-right": "",
290
+ "full-page": "",
291
+ "full-page-reverse": "",
292
+ draggable: "nexus-modal-header--draggable"
293
+ }
294
+ },
295
+ defaultVariants: {
296
+ layout: "default"
297
+ }
298
+ });
299
+ var modalCloseButtonVariants = classVarianceAuthority.cva("nexus-modal-close-btn", {
300
+ variants: {
301
+ layout: {
302
+ default: "",
303
+ "bottom-sheet": "nexus-modal-close-btn--bottom-sheet",
304
+ "slide-left": "",
305
+ "slide-right": "",
306
+ "full-page": "",
307
+ "full-page-reverse": "",
308
+ draggable: ""
309
+ }
310
+ },
311
+ defaultVariants: {
312
+ layout: "default"
313
+ }
314
+ });
315
+ var modalTitleVariants = classVarianceAuthority.cva("nexus-modal-title", {
316
+ variants: {
317
+ layout: {
318
+ default: "",
319
+ "bottom-sheet": "nexus-modal-title--bottom-sheet",
320
+ "slide-left": "",
321
+ "slide-right": "",
322
+ "full-page": "",
323
+ "full-page-reverse": "",
324
+ draggable: ""
325
+ }
326
+ },
327
+ defaultVariants: {
328
+ layout: "default"
329
+ }
330
+ });
331
+ var modalBodyVariants = classVarianceAuthority.cva("nexus-modal-body", {
332
+ variants: {
333
+ layout: {
334
+ default: "",
335
+ "bottom-sheet": "nexus-modal-body--bottom-sheet",
336
+ "slide-left": "nexus-modal-body--slide",
337
+ "slide-right": "nexus-modal-body--slide",
338
+ "full-page": "nexus-modal-body--full-page",
339
+ "full-page-reverse": "nexus-modal-body--full-page",
340
+ draggable: ""
341
+ },
342
+ hasHeader: {
343
+ true: "",
344
+ false: ""
345
+ },
346
+ hasFooter: {
347
+ true: "",
348
+ false: "nexus-modal-body--no-footer"
349
+ }
350
+ },
351
+ defaultVariants: {
352
+ layout: "default",
353
+ hasHeader: false,
354
+ hasFooter: false
355
+ }
356
+ });
357
+ var modalFooterVariants = classVarianceAuthority.cva("nexus-modal-footer", {
358
+ variants: {
359
+ layout: {
360
+ default: "",
361
+ "bottom-sheet": "nexus-modal-footer--bottom-sheet",
362
+ "slide-left": "",
363
+ "slide-right": "",
364
+ "full-page": "",
365
+ "full-page-reverse": "",
366
+ draggable: "nexus-modal-footer--draggable"
367
+ }
368
+ },
369
+ defaultVariants: {
370
+ layout: "default"
371
+ }
372
+ });
373
+ var modalDimVariants = classVarianceAuthority.cva("nexus-modal-dim", {
374
+ variants: {
375
+ visible: {
376
+ true: "",
377
+ false: "nexus-modal-dim--hidden"
378
+ }
379
+ },
380
+ defaultVariants: {
381
+ visible: true
382
+ }
383
+ });
384
+ var CloseIcon = () => /* @__PURE__ */ jsxRuntime.jsx(
385
+ "svg",
386
+ {
387
+ className: "nexus-modal-close-icon",
388
+ fill: "none",
389
+ stroke: "currentColor",
390
+ viewBox: "0 0 24 24",
391
+ children: /* @__PURE__ */ jsxRuntime.jsx(
392
+ "path",
393
+ {
394
+ strokeLinecap: "round",
395
+ strokeLinejoin: "round",
396
+ strokeWidth: 2,
397
+ d: "M6 18L18 6M6 6l12 12"
398
+ }
399
+ )
400
+ }
401
+ );
402
+ var ModalTemplate = React.forwardRef(
403
+ ({
404
+ className,
405
+ layout = "default",
406
+ showDim = true,
407
+ innerClassName,
408
+ bodyClassName,
409
+ footerClassName,
410
+ dimClassName,
411
+ headerClassName,
412
+ children,
413
+ title,
414
+ desc,
415
+ hideHeader = false,
416
+ hideFooter = true,
417
+ dimClose,
418
+ footer,
419
+ close,
420
+ enableDrag = true,
421
+ dragPersistKey
422
+ }, ref) => {
423
+ const elRef = React.useRef(null);
424
+ const modalFooterRef = React.useRef(null);
425
+ const modalHeaderRef = React.useRef(null);
426
+ const innerRef = React.useRef(null);
427
+ const { dimCloseEnable } = getModalDefaultOption();
428
+ const isBottomSheet = layout === "bottom-sheet";
429
+ const isDraggable = layout === "draggable";
430
+ const dragHandlers = chunkHHXDOKXY_js.useDraggableBottomSheet({
431
+ enabled: isBottomSheet && enableDrag,
432
+ onClose: () => close(false),
433
+ threshold: 0.5,
434
+ velocityThreshold: 0.3
435
+ });
436
+ const windowDrag = chunkNHDGKOAM_js.useDraggableWindow({
437
+ persistKey: dragPersistKey,
438
+ initialPosition: { x: -1, y: -1 },
439
+ targetRef: innerRef
440
+ });
441
+ const closeModal2 = React.useCallback(() => {
442
+ if (!(dimClose ?? dimCloseEnable)) return;
443
+ close();
444
+ }, [close, dimClose, dimCloseEnable]);
445
+ React.useEffect(() => {
446
+ const modalFooterHeight = modalFooterRef.current?.getBoundingClientRect().height;
447
+ const modalHeaderHeight = modalHeaderRef.current?.getBoundingClientRect().height;
448
+ if (modalFooterHeight) {
449
+ document.documentElement.style.setProperty(
450
+ "--ft-height",
451
+ modalFooterHeight + "px"
452
+ );
453
+ }
454
+ if (modalHeaderHeight) {
455
+ document.documentElement.style.setProperty(
456
+ "--hd-height",
457
+ modalHeaderHeight + "px"
458
+ );
459
+ }
460
+ }, []);
461
+ React.useImperativeHandle(ref, () => elRef.current);
462
+ React.useEffect(() => {
463
+ const inner = innerRef.current;
464
+ if (!inner) return;
465
+ const focusableSelector = 'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';
466
+ const handleKeyDown = (e) => {
467
+ if (e.key !== "Tab") return;
468
+ const focusable = inner.querySelectorAll(focusableSelector);
469
+ if (focusable.length === 0) return;
470
+ const first = focusable[0];
471
+ const last = focusable[focusable.length - 1];
472
+ if (e.shiftKey) {
473
+ if (document.activeElement === first) {
474
+ e.preventDefault();
475
+ last.focus();
476
+ }
477
+ } else {
478
+ if (document.activeElement === last) {
479
+ e.preventDefault();
480
+ first.focus();
481
+ }
482
+ }
483
+ };
484
+ inner.addEventListener("keydown", handleKeyDown);
485
+ const prev = document.activeElement;
486
+ const firstFocusable = inner.querySelector(focusableSelector);
487
+ firstFocusable?.focus();
488
+ return () => {
489
+ inner.removeEventListener("keydown", handleKeyDown);
490
+ prev?.focus();
491
+ };
492
+ }, []);
493
+ const hasHeader = !hideHeader;
494
+ const hasFooter = !hideFooter;
495
+ const wrapStyle = {};
496
+ const innerStyle = {};
497
+ if (isDraggable && !windowDrag.isDefaultPosition) {
498
+ wrapStyle.alignItems = "flex-start";
499
+ wrapStyle.justifyContent = "flex-start";
500
+ innerStyle.position = "fixed";
501
+ innerStyle.left = windowDrag.position.x;
502
+ innerStyle.top = windowDrag.position.y;
503
+ }
504
+ if (isBottomSheet) {
505
+ if (dragHandlers.translateY !== 0) {
506
+ innerStyle.transform = `translateY(${dragHandlers.translateY}px)`;
507
+ }
508
+ if (dragHandlers.isAnimating) {
509
+ innerStyle.transition = "transform 250ms cubic-bezier(0.32, 0.72, 0, 1)";
510
+ }
511
+ }
512
+ return /* @__PURE__ */ jsxRuntime.jsxs(
513
+ "div",
514
+ {
515
+ ref: elRef,
516
+ className: chunkCZC76ZD5_js.cn(modalWrapVariants({ layout }), className),
517
+ style: wrapStyle,
518
+ onTouchStart: isBottomSheet ? dragHandlers.onTouchStart : void 0,
519
+ onTouchMove: isBottomSheet ? dragHandlers.onTouchMove : void 0,
520
+ onTouchEnd: isBottomSheet ? dragHandlers.onTouchEnd : void 0,
521
+ children: [
522
+ showDim && !isDraggable && /* @__PURE__ */ jsxRuntime.jsx(
523
+ "div",
524
+ {
525
+ tabIndex: -1,
526
+ role: "button",
527
+ "aria-label": "modal-dim",
528
+ className: chunkCZC76ZD5_js.cn(modalDimVariants({ visible: showDim }), dimClassName),
529
+ style: isBottomSheet ? {
530
+ opacity: dragHandlers.dimOpacity,
531
+ transition: dragHandlers.isAnimating ? "opacity 250ms ease-out" : void 0
532
+ } : {
533
+ opacity: "var(--modal-dim-opacity, 0)",
534
+ transition: "opacity var(--modal-animation-duration, 300ms) ease"
535
+ },
536
+ onClick: closeModal2
537
+ }
538
+ ),
539
+ isDraggable && showDim && /* @__PURE__ */ jsxRuntime.jsx(
540
+ "div",
541
+ {
542
+ tabIndex: -1,
543
+ role: "button",
544
+ "aria-label": "modal-dim",
545
+ className: chunkCZC76ZD5_js.cn("nexus-modal-dim nexus-modal-dim--draggable", dimClassName),
546
+ onClick: closeModal2
547
+ }
548
+ ),
549
+ /* @__PURE__ */ jsxRuntime.jsxs(
550
+ "div",
551
+ {
552
+ ref: innerRef,
553
+ role: "dialog",
554
+ "aria-modal": "true",
555
+ "aria-label": typeof title === "string" ? title : void 0,
556
+ className: chunkCZC76ZD5_js.cn(
557
+ modalInnerVariants({ layout, hasFooter }),
558
+ innerClassName
559
+ ),
560
+ style: innerStyle,
561
+ children: [
562
+ isBottomSheet && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nexus-modal-bottom-sheet-handle", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nexus-modal-bottom-sheet-bar" }) }),
563
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nexus-contents", children: [
564
+ hasHeader && /* @__PURE__ */ jsxRuntime.jsxs(
565
+ "header",
566
+ {
567
+ className: chunkCZC76ZD5_js.cn(modalHeaderVariants({ layout }), headerClassName),
568
+ ref: modalHeaderRef,
569
+ onMouseDown: isDraggable && enableDrag ? windowDrag.handleMouseDown : void 0,
570
+ children: [
571
+ /* @__PURE__ */ jsxRuntime.jsx(
572
+ "button",
573
+ {
574
+ type: "button",
575
+ className: modalCloseButtonVariants({ layout }),
576
+ onClick: () => close(),
577
+ "aria-label": "Close",
578
+ children: /* @__PURE__ */ jsxRuntime.jsx(CloseIcon, {})
579
+ }
580
+ ),
581
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "modal-header-inner", children: [
582
+ title && /* @__PURE__ */ jsxRuntime.jsx("h1", { className: modalTitleVariants({ layout }), children: title }),
583
+ desc && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "nexus-modal-desc", children: desc })
584
+ ] })
585
+ ]
586
+ }
587
+ ),
588
+ /* @__PURE__ */ jsxRuntime.jsx(
589
+ "section",
590
+ {
591
+ className: chunkCZC76ZD5_js.cn(
592
+ modalBodyVariants({ layout, hasHeader, hasFooter }),
593
+ bodyClassName
594
+ ),
595
+ children
596
+ }
597
+ ),
598
+ hasFooter && /* @__PURE__ */ jsxRuntime.jsx(
599
+ "footer",
600
+ {
601
+ ref: modalFooterRef,
602
+ className: chunkCZC76ZD5_js.cn(modalFooterVariants({ layout }), footerClassName),
603
+ children: footer
604
+ }
605
+ )
606
+ ] })
607
+ ]
608
+ }
609
+ )
610
+ ]
611
+ }
612
+ );
613
+ }
614
+ );
615
+ ModalTemplate.displayName = "ModalTemplate";
616
+ var ModalTemplate_default = ModalTemplate;
617
+
618
+ // src/modal/index.ts
619
+ var openModal = ((arg1, arg2 = {}) => {
620
+ if ("component" in arg1) {
621
+ const { component, props = {}, options = {} } = arg1;
622
+ return chunkHUPAHDJ7_js.Modal_default.openModal({
623
+ component,
624
+ props: { ...props, ...options }
625
+ });
626
+ } else {
627
+ return chunkHUPAHDJ7_js.Modal_default.openModal({
628
+ component: arg1,
629
+ props: arg2
630
+ });
631
+ }
632
+ });
633
+ var closeModal = (id, isAnimation) => {
634
+ return chunkHUPAHDJ7_js.Modal_default.closeModal(id, isAnimation);
635
+ };
636
+ var checkModal = (params) => {
637
+ return chunkHUPAHDJ7_js.Modal_default.checkModal(params);
638
+ };
639
+ var resetModal = () => {
640
+ return chunkHUPAHDJ7_js.Modal_default.resetModal();
641
+ };
642
+ var getModalDefaultOption = () => {
643
+ return chunkHUPAHDJ7_js.Modal_default.getDefaultOption();
644
+ };
645
+
646
+ exports.ModalContainer_default = ModalContainer_default;
647
+ exports.ModalPortalTarget_default = ModalPortalTarget_default;
648
+ exports.ModalTemplate_default = ModalTemplate_default;
649
+ exports.checkModal = checkModal;
650
+ exports.closeModal = closeModal;
651
+ exports.getModalDefaultOption = getModalDefaultOption;
652
+ exports.openModal = openModal;
653
+ exports.resetModal = resetModal;