dn-react-router-toolkit 0.2.7 → 0.3.1

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 (276) hide show
  1. package/dist/api/create_handler.d.mts +13 -0
  2. package/dist/api/create_handler.d.ts +13 -0
  3. package/dist/api/create_handler.js +276 -0
  4. package/dist/api/create_handler.mjs +282 -0
  5. package/dist/api/index.d.mts +4 -0
  6. package/dist/api/index.d.ts +4 -0
  7. package/dist/api/index.js +276 -0
  8. package/dist/api/index.mjs +282 -0
  9. package/dist/auth/client/index.d.mts +3 -0
  10. package/dist/auth/client/index.d.ts +3 -0
  11. package/dist/{date.js → auth/client/index.js} +25 -32
  12. package/dist/auth/client/index.mjs +21 -0
  13. package/dist/auth/client/redirect_page.d.mts +1 -0
  14. package/dist/auth/client/redirect_page.d.ts +1 -0
  15. package/dist/auth/index.d.mts +4 -0
  16. package/dist/auth/index.d.ts +4 -0
  17. package/dist/auth/index.js +116 -0
  18. package/dist/auth/index.mjs +89 -0
  19. package/dist/auth/server/index.d.mts +1 -0
  20. package/dist/auth/server/index.d.ts +1 -0
  21. package/dist/{slug.js → auth/server/index.js} +6 -14
  22. package/dist/auth/server/index.mjs +2 -0
  23. package/dist/auth/with_auth.d.mts +2 -6
  24. package/dist/auth/with_auth.d.ts +2 -6
  25. package/dist/auth/with_auth.js +3 -0
  26. package/dist/auth/with_auth.mjs +3 -0
  27. package/dist/{components → client}/client_env.d.mts +1 -1
  28. package/dist/{components → client}/client_env.d.ts +1 -1
  29. package/dist/{components → client}/client_env.js +6 -2
  30. package/dist/{components → client}/client_env.mjs +2 -2
  31. package/dist/client/index.d.mts +3 -0
  32. package/dist/client/index.d.ts +3 -0
  33. package/dist/{auth/client/google_login_button.js → client/index.js} +30 -33
  34. package/dist/client/index.mjs +31 -0
  35. package/dist/client/use_user_agent.d.mts +8 -0
  36. package/dist/client/use_user_agent.d.ts +8 -0
  37. package/dist/{file/client/format_size.js → client/use_user_agent.js} +14 -14
  38. package/dist/client/use_user_agent.mjs +13 -0
  39. package/dist/file/client/index.d.mts +1 -0
  40. package/dist/file/client/index.d.ts +1 -0
  41. package/dist/file/{cdn.js → client/index.js} +6 -16
  42. package/dist/file/client/index.mjs +2 -0
  43. package/dist/file/index.d.mts +1 -0
  44. package/dist/file/index.d.ts +1 -0
  45. package/dist/{cn.js → file/index.js} +6 -14
  46. package/dist/file/index.mjs +2 -0
  47. package/dist/file/server/index.d.mts +1 -0
  48. package/dist/file/server/index.d.ts +1 -0
  49. package/dist/file/server/index.js +24 -0
  50. package/dist/file/server/index.mjs +2 -0
  51. package/dist/http/index.d.mts +1 -1
  52. package/dist/http/index.d.ts +1 -1
  53. package/dist/http/index.js +3 -90
  54. package/dist/http/index.mjs +2 -68
  55. package/dist/index.d.mts +8 -6
  56. package/dist/index.d.ts +8 -6
  57. package/dist/index.js +3 -79
  58. package/dist/index.mjs +2 -58
  59. package/dist/modal/index.d.mts +1 -0
  60. package/dist/modal/index.d.ts +1 -0
  61. package/dist/{sleep.js → modal/index.js} +6 -14
  62. package/dist/modal/index.mjs +2 -0
  63. package/dist/seo/index.d.mts +4 -0
  64. package/dist/seo/index.d.ts +4 -0
  65. package/dist/seo/index.js +304 -0
  66. package/dist/seo/index.mjs +267 -0
  67. package/dist/text_editor/index.d.mts +1 -0
  68. package/dist/text_editor/index.d.ts +1 -0
  69. package/dist/text_editor/index.js +24 -0
  70. package/dist/text_editor/index.mjs +2 -0
  71. package/package.json +58 -32
  72. package/dist/auth/apple_auth.d.mts +0 -38
  73. package/dist/auth/apple_auth.d.ts +0 -38
  74. package/dist/auth/apple_auth.js +0 -88
  75. package/dist/auth/apple_auth.mjs +0 -63
  76. package/dist/auth/auth_repository.d.mts +0 -41
  77. package/dist/auth/auth_repository.d.ts +0 -41
  78. package/dist/auth/auth_repository.js +0 -18
  79. package/dist/auth/auth_repository.mjs +0 -0
  80. package/dist/auth/auth_service.d.mts +0 -63
  81. package/dist/auth/auth_service.d.ts +0 -63
  82. package/dist/auth/auth_service.js +0 -210
  83. package/dist/auth/auth_service.mjs +0 -171
  84. package/dist/auth/client/google_login_button.d.mts +0 -7
  85. package/dist/auth/client/google_login_button.d.ts +0 -7
  86. package/dist/auth/client/google_login_button.mjs +0 -37
  87. package/dist/auth/client/provider.d.mts +0 -24
  88. package/dist/auth/client/provider.d.ts +0 -24
  89. package/dist/auth/client/provider.js +0 -154
  90. package/dist/auth/client/provider.mjs +0 -118
  91. package/dist/auth/google_auth.d.mts +0 -33
  92. package/dist/auth/google_auth.d.ts +0 -33
  93. package/dist/auth/google_auth.js +0 -135
  94. package/dist/auth/google_auth.mjs +0 -108
  95. package/dist/auth/handlers/find_auth.d.mts +0 -13
  96. package/dist/auth/handlers/find_auth.d.ts +0 -13
  97. package/dist/auth/handlers/find_auth.js +0 -82
  98. package/dist/auth/handlers/find_auth.mjs +0 -55
  99. package/dist/auth/handlers/login.d.mts +0 -13
  100. package/dist/auth/handlers/login.d.ts +0 -13
  101. package/dist/auth/handlers/login.js +0 -107
  102. package/dist/auth/handlers/login.mjs +0 -80
  103. package/dist/auth/handlers/login_with_thirdparty.d.mts +0 -15
  104. package/dist/auth/handlers/login_with_thirdparty.d.ts +0 -15
  105. package/dist/auth/handlers/login_with_thirdparty.js +0 -98
  106. package/dist/auth/handlers/login_with_thirdparty.mjs +0 -71
  107. package/dist/auth/handlers/logout.d.mts +0 -13
  108. package/dist/auth/handlers/logout.d.ts +0 -13
  109. package/dist/auth/handlers/logout.js +0 -102
  110. package/dist/auth/handlers/logout.mjs +0 -75
  111. package/dist/auth/handlers/refresh.d.mts +0 -13
  112. package/dist/auth/handlers/refresh.d.ts +0 -13
  113. package/dist/auth/handlers/refresh.js +0 -92
  114. package/dist/auth/handlers/refresh.mjs +0 -65
  115. package/dist/auth/handlers/request_password_reset.d.mts +0 -10
  116. package/dist/auth/handlers/request_password_reset.d.ts +0 -10
  117. package/dist/auth/handlers/request_password_reset.js +0 -87
  118. package/dist/auth/handlers/request_password_reset.mjs +0 -60
  119. package/dist/auth/handlers/reset_password.d.mts +0 -10
  120. package/dist/auth/handlers/reset_password.d.ts +0 -10
  121. package/dist/auth/handlers/reset_password.js +0 -88
  122. package/dist/auth/handlers/reset_password.mjs +0 -61
  123. package/dist/auth/handlers/signup.d.mts +0 -15
  124. package/dist/auth/handlers/signup.d.ts +0 -15
  125. package/dist/auth/handlers/signup.js +0 -147
  126. package/dist/auth/handlers/signup.mjs +0 -112
  127. package/dist/auth/handlers/signup_with_thirdparty.d.mts +0 -17
  128. package/dist/auth/handlers/signup_with_thirdparty.d.ts +0 -17
  129. package/dist/auth/handlers/signup_with_thirdparty.js +0 -123
  130. package/dist/auth/handlers/signup_with_thirdparty.mjs +0 -98
  131. package/dist/auth/handlers/thirdparty_auth_callback.d.mts +0 -16
  132. package/dist/auth/handlers/thirdparty_auth_callback.d.ts +0 -16
  133. package/dist/auth/handlers/thirdparty_auth_callback.js +0 -129
  134. package/dist/auth/handlers/thirdparty_auth_callback.mjs +0 -102
  135. package/dist/auth/jwt_manager.d.mts +0 -38
  136. package/dist/auth/jwt_manager.d.ts +0 -38
  137. package/dist/auth/jwt_manager.js +0 -90
  138. package/dist/auth/jwt_manager.mjs +0 -65
  139. package/dist/auth/kakao_auth.d.mts +0 -27
  140. package/dist/auth/kakao_auth.d.ts +0 -27
  141. package/dist/auth/kakao_auth.js +0 -56
  142. package/dist/auth/kakao_auth.mjs +0 -31
  143. package/dist/auth/password_recovery.d.mts +0 -34
  144. package/dist/auth/password_recovery.d.ts +0 -34
  145. package/dist/auth/password_recovery.js +0 -169
  146. package/dist/auth/password_recovery.mjs +0 -134
  147. package/dist/auth/thirdparty_auth.d.mts +0 -41
  148. package/dist/auth/thirdparty_auth.d.ts +0 -41
  149. package/dist/auth/thirdparty_auth.js +0 -113
  150. package/dist/auth/thirdparty_auth.mjs +0 -86
  151. package/dist/cn.d.mts +0 -3
  152. package/dist/cn.d.ts +0 -3
  153. package/dist/cn.mjs +0 -7
  154. package/dist/components/index.d.mts +0 -5
  155. package/dist/components/index.d.ts +0 -5
  156. package/dist/components/index.js +0 -261
  157. package/dist/components/index.mjs +0 -219
  158. package/dist/components/modal/fullscreen_container.d.mts +0 -7
  159. package/dist/components/modal/fullscreen_container.d.ts +0 -7
  160. package/dist/components/modal/fullscreen_container.js +0 -102
  161. package/dist/components/modal/fullscreen_container.mjs +0 -68
  162. package/dist/components/modal/hooks.d.mts +0 -18
  163. package/dist/components/modal/hooks.d.ts +0 -18
  164. package/dist/components/modal/hooks.js +0 -236
  165. package/dist/components/modal/hooks.mjs +0 -204
  166. package/dist/components/modal/index.d.mts +0 -4
  167. package/dist/components/modal/index.d.ts +0 -4
  168. package/dist/components/modal/index.js +0 -238
  169. package/dist/components/modal/index.mjs +0 -203
  170. package/dist/components/modal/modal.d.mts +0 -13
  171. package/dist/components/modal/modal.d.ts +0 -13
  172. package/dist/components/modal/modal.js +0 -155
  173. package/dist/components/modal/modal.mjs +0 -130
  174. package/dist/components/styles.d.mts +0 -9
  175. package/dist/components/styles.d.ts +0 -9
  176. package/dist/components/styles.js +0 -48
  177. package/dist/components/styles.mjs +0 -17
  178. package/dist/date.d.mts +0 -5
  179. package/dist/date.d.ts +0 -5
  180. package/dist/date.mjs +0 -29
  181. package/dist/file/cdn.d.mts +0 -6
  182. package/dist/file/cdn.d.ts +0 -6
  183. package/dist/file/cdn.mjs +0 -9
  184. package/dist/file/client/drop_file_input.d.mts +0 -36
  185. package/dist/file/client/drop_file_input.d.ts +0 -36
  186. package/dist/file/client/drop_file_input.js +0 -323
  187. package/dist/file/client/drop_file_input.mjs +0 -294
  188. package/dist/file/client/file_upload_button.d.mts +0 -10
  189. package/dist/file/client/file_upload_button.d.ts +0 -10
  190. package/dist/file/client/file_upload_button.js +0 -89
  191. package/dist/file/client/file_upload_button.mjs +0 -58
  192. package/dist/file/client/file_uploader.d.mts +0 -13
  193. package/dist/file/client/file_uploader.d.ts +0 -13
  194. package/dist/file/client/file_uploader.js +0 -163
  195. package/dist/file/client/file_uploader.mjs +0 -136
  196. package/dist/file/client/format_size.d.mts +0 -3
  197. package/dist/file/client/format_size.d.ts +0 -3
  198. package/dist/file/client/format_size.mjs +0 -13
  199. package/dist/file/client/metadata.d.mts +0 -7
  200. package/dist/file/client/metadata.d.ts +0 -7
  201. package/dist/file/client/metadata.js +0 -85
  202. package/dist/file/client/metadata.mjs +0 -60
  203. package/dist/file/file_repository.d.mts +0 -16
  204. package/dist/file/file_repository.d.ts +0 -16
  205. package/dist/file/file_repository.js +0 -18
  206. package/dist/file/file_repository.mjs +0 -0
  207. package/dist/file/file_service.d.mts +0 -32
  208. package/dist/file/file_service.d.ts +0 -32
  209. package/dist/file/file_service.js +0 -66
  210. package/dist/file/file_service.mjs +0 -41
  211. package/dist/file/handlers/delete_file.d.mts +0 -17
  212. package/dist/file/handlers/delete_file.d.ts +0 -17
  213. package/dist/file/handlers/delete_file.js +0 -99
  214. package/dist/file/handlers/delete_file.mjs +0 -72
  215. package/dist/file/handlers/upload_file.d.mts +0 -16
  216. package/dist/file/handlers/upload_file.d.ts +0 -16
  217. package/dist/file/handlers/upload_file.js +0 -106
  218. package/dist/file/handlers/upload_file.mjs +0 -79
  219. package/dist/file/object_storage.d.mts +0 -20
  220. package/dist/file/object_storage.d.ts +0 -20
  221. package/dist/file/object_storage.js +0 -90
  222. package/dist/file/object_storage.mjs +0 -70
  223. package/dist/file/responsive_image.d.mts +0 -20
  224. package/dist/file/responsive_image.d.ts +0 -20
  225. package/dist/file/responsive_image.js +0 -132
  226. package/dist/file/responsive_image.mjs +0 -96
  227. package/dist/http/response.d.mts +0 -19
  228. package/dist/http/response.d.ts +0 -19
  229. package/dist/http/response.js +0 -109
  230. package/dist/http/response.mjs +0 -68
  231. package/dist/route/api.d.mts +0 -21
  232. package/dist/route/api.d.ts +0 -21
  233. package/dist/route/api.js +0 -584
  234. package/dist/route/api.mjs +0 -547
  235. package/dist/singleton.d.mts +0 -3
  236. package/dist/singleton.d.ts +0 -3
  237. package/dist/singleton.js +0 -37
  238. package/dist/singleton.mjs +0 -12
  239. package/dist/sleep.d.mts +0 -3
  240. package/dist/sleep.d.ts +0 -3
  241. package/dist/sleep.mjs +0 -7
  242. package/dist/slug.d.mts +0 -3
  243. package/dist/slug.d.ts +0 -3
  244. package/dist/slug.mjs +0 -7
  245. package/dist/text_editor/attach_media.d.mts +0 -16
  246. package/dist/text_editor/attach_media.d.ts +0 -16
  247. package/dist/text_editor/attach_media.js +0 -237
  248. package/dist/text_editor/attach_media.mjs +0 -210
  249. package/dist/text_editor/plugins/drag_and_drop.d.mts +0 -13
  250. package/dist/text_editor/plugins/drag_and_drop.d.ts +0 -13
  251. package/dist/text_editor/plugins/drag_and_drop.js +0 -59
  252. package/dist/text_editor/plugins/drag_and_drop.mjs +0 -34
  253. package/dist/text_editor/plugins/keymap.d.mts +0 -5
  254. package/dist/text_editor/plugins/keymap.d.ts +0 -5
  255. package/dist/text_editor/plugins/keymap.js +0 -40
  256. package/dist/text_editor/plugins/keymap.mjs +0 -15
  257. package/dist/text_editor/plugins/placehoder.d.mts +0 -5
  258. package/dist/text_editor/plugins/placehoder.d.ts +0 -5
  259. package/dist/text_editor/plugins/placehoder.js +0 -112
  260. package/dist/text_editor/plugins/placehoder.mjs +0 -87
  261. package/dist/text_editor/plugins/trailing_paragraph.d.mts +0 -5
  262. package/dist/text_editor/plugins/trailing_paragraph.d.ts +0 -5
  263. package/dist/text_editor/plugins/trailing_paragraph.js +0 -46
  264. package/dist/text_editor/plugins/trailing_paragraph.mjs +0 -21
  265. package/dist/text_editor/plugins/upload_placeholder.d.mts +0 -7
  266. package/dist/text_editor/plugins/upload_placeholder.d.ts +0 -7
  267. package/dist/text_editor/plugins/upload_placeholder.js +0 -94
  268. package/dist/text_editor/plugins/upload_placeholder.mjs +0 -68
  269. package/dist/text_editor/schema.d.mts +0 -9
  270. package/dist/text_editor/schema.d.ts +0 -9
  271. package/dist/text_editor/schema.js +0 -354
  272. package/dist/text_editor/schema.mjs +0 -319
  273. package/dist/text_editor/text_editor.d.mts +0 -45
  274. package/dist/text_editor/text_editor.d.ts +0 -45
  275. package/dist/text_editor/text_editor.js +0 -834
  276. package/dist/text_editor/text_editor.mjs +0 -806
@@ -1,261 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/components/index.ts
31
- var components_exports = {};
32
- __export(components_exports, {
33
- ModalContext: () => ModalContext,
34
- baseButtonStyle: () => baseButtonStyle,
35
- dangerousButtonStyle: () => dangerousButtonStyle,
36
- disabledButtonStyle: () => disabledButtonStyle,
37
- formInputStyle: () => formInputStyle,
38
- inputBackgroundStyle: () => inputBackgroundStyle,
39
- outlineButtonStyle: () => outlineButtonStyle,
40
- primaryButtonStyle: () => primaryButtonStyle,
41
- useFullscreen: () => useFullscreen,
42
- useModal: () => useModal,
43
- useModalPortal: () => useModalPortal,
44
- useModalRoot: () => useModalRoot
45
- });
46
- module.exports = __toCommonJS(components_exports);
47
-
48
- // src/cn.ts
49
- function cn(...classes) {
50
- return classes.filter(Boolean).join(" ").trim();
51
- }
52
-
53
- // src/components/modal/fullscreen_container.tsx
54
- var import_react = __toESM(require("react"));
55
- var import_react2 = require("react");
56
- function useFullscreen(ref) {
57
- (0, import_react2.useEffect)(() => {
58
- const container = ref.current;
59
- if (!container) {
60
- return;
61
- }
62
- const scroll = () => {
63
- if (scrollY > 0) {
64
- window.scrollTo({
65
- top: 0,
66
- behavior: "instant"
67
- });
68
- }
69
- };
70
- const resize = () => {
71
- if (!visualViewport) {
72
- return;
73
- }
74
- container.classList.remove("bottom-0");
75
- container.style.height = `${visualViewport?.height}px`;
76
- if (visualViewport.height < window.innerHeight) {
77
- window.addEventListener("scroll", scroll);
78
- } else {
79
- window.removeEventListener("scroll", scroll);
80
- }
81
- };
82
- resize();
83
- visualViewport?.addEventListener("resize", resize);
84
- scroll();
85
- return () => {
86
- window.removeEventListener("scroll", scroll);
87
- visualViewport?.removeEventListener("resize", resize);
88
- };
89
- }, [ref]);
90
- return "fixed inset-0";
91
- }
92
-
93
- // src/components/modal/hooks.tsx
94
- var import_react4 = require("react");
95
- var import_react_dom = require("react-dom");
96
-
97
- // src/components/modal/modal.tsx
98
- var import_react3 = __toESM(require("react"));
99
- function Modal({
100
- open,
101
- className,
102
- background = "bg-gray-500/25",
103
- onBackgroundClick,
104
- children,
105
- ...props
106
- }) {
107
- const containerRef = (0, import_react3.useRef)(null);
108
- const fullscreen = useFullscreen(containerRef);
109
- const [mounted, setMounted] = import_react3.default.useState(false);
110
- (0, import_react3.useEffect)(() => {
111
- if (open) {
112
- setMounted(true);
113
- } else {
114
- setTimeout(() => {
115
- setMounted(false);
116
- }, 200);
117
- }
118
- return () => {
119
- };
120
- }, [open]);
121
- const onBackgroundMouseDown = (event) => {
122
- event.preventDefault();
123
- onBackgroundClick?.();
124
- };
125
- const onModalMouseDown = (event) => {
126
- event.stopPropagation();
127
- };
128
- const onBackgroundTouchStart = (event) => {
129
- event.preventDefault();
130
- onBackgroundClick?.();
131
- };
132
- const onModalTouchStart = (event) => {
133
- event.stopPropagation();
134
- };
135
- return /* @__PURE__ */ import_react3.default.createElement(
136
- "div",
137
- {
138
- ref: containerRef,
139
- className: cn(
140
- fullscreen,
141
- "z-[999] flex flex-col justify-center transition-bg duration-200 md:px-6 overflow-hidden print:px-0 print:block print:overflow-auto",
142
- open && mounted ? cn(background, "ease-out") : "bg-transparent ease-in pointer-events-none"
143
- ),
144
- onMouseDown: onBackgroundMouseDown,
145
- onTouchStart: onBackgroundTouchStart
146
- },
147
- /* @__PURE__ */ import_react3.default.createElement(
148
- "div",
149
- {
150
- className: cn(
151
- "relative flex-1 flex flex-col justify-end md:justify-center items-center transition-[opacity transform] duration-200 print:block",
152
- open && mounted ? "translate-y-[0px] opacity-100 ease-out" : "translate-y-[100%] md:translate-y-[50px] opacity-0 ease-in"
153
- )
154
- },
155
- (open || mounted) && /* @__PURE__ */ import_react3.default.createElement(
156
- "div",
157
- {
158
- ...props,
159
- className: cn(
160
- className,
161
- "w-full max-h-[92vh] print:w-[unset] print:max-h-[unset] rounded-tl-lg rounded-tr-lg md:rounded-lg overflow-auto print:rounded-none"
162
- ),
163
- onMouseDown: onModalMouseDown,
164
- onTouchStart: onModalTouchStart
165
- },
166
- children
167
- )
168
- )
169
- );
170
- }
171
-
172
- // src/components/modal/hooks.tsx
173
- var import_react5 = __toESM(require("react"));
174
- function useModalRoot() {
175
- const [container, setContainer] = (0, import_react4.useState)(null);
176
- (0, import_react4.useEffect)(() => {
177
- const container2 = document.getElementById("modal-root");
178
- if (container2) {
179
- setContainer(container2);
180
- }
181
- return () => {
182
- setContainer(null);
183
- };
184
- }, []);
185
- return container;
186
- }
187
- function useModalPortal() {
188
- const container = useModalRoot();
189
- if (!container) {
190
- return (children) => null;
191
- }
192
- return (children) => {
193
- return (0, import_react_dom.createPortal)(children, container);
194
- };
195
- }
196
- var ModalContext = (0, import_react4.createContext)({});
197
- function useModal() {
198
- const ch2 = (0, import_react4.useRef)(
199
- null
200
- );
201
- const open = () => {
202
- ch2.current?.(true);
203
- };
204
- const close = () => {
205
- ch2.current?.(false);
206
- };
207
- const Component = (0, import_react4.useCallback)(
208
- function Component2(props) {
209
- const [isOpen, setIsOpen] = (0, import_react4.useState)(false);
210
- const createPortal2 = useModalPortal();
211
- (0, import_react4.useEffect)(() => {
212
- ch2.current = (v) => {
213
- setIsOpen(v);
214
- };
215
- return () => {
216
- ch2.current = null;
217
- };
218
- }, []);
219
- (0, import_react4.useEffect)(() => {
220
- if (isOpen) {
221
- } else {
222
- }
223
- return () => {
224
- };
225
- }, [isOpen]);
226
- return /* @__PURE__ */ import_react5.default.createElement(ModalContext.Provider, { value: { open, close, isOpen } }, createPortal2(
227
- /* @__PURE__ */ import_react5.default.createElement(Modal, { ...props, open: isOpen, onBackgroundClick: close })
228
- ));
229
- },
230
- []
231
- );
232
- return {
233
- open,
234
- close,
235
- Modal: Component
236
- };
237
- }
238
-
239
- // src/components/styles.ts
240
- var inputBackgroundStyle = "text-[16px] border border-neutral-200 outline-none appearance-none disabled:opacity-50 disabled:cursor-not-allowed placeholder:text-neutral-400";
241
- var formInputStyle = `w-full px-3 ${inputBackgroundStyle} h-[40px]`;
242
- var baseButtonStyle = "transition-colors text-sm font-semibold cursor-pointer flex items-center justify-center rounded-lg whitespace-nowrap text-ellipsis overflow-hidden";
243
- var primaryButtonStyle = `${baseButtonStyle} px-4 h-[40px] bg-gradient-to-br from-primary-400 to-primary-500 text-white transition-colors`;
244
- var disabledButtonStyle = `${baseButtonStyle} h-[40px] px-4 bg-neutral-200 text-neutral-400`;
245
- var outlineButtonStyle = `${baseButtonStyle} h-[40px] px-4 bg-white border border-neutral-300 hover:bg-neutral-50`;
246
- var dangerousButtonStyle = `${baseButtonStyle} h-[40px] px-4 bg-white border hover:bg-red-50 text-red-600`;
247
- // Annotate the CommonJS export names for ESM import in node:
248
- 0 && (module.exports = {
249
- ModalContext,
250
- baseButtonStyle,
251
- dangerousButtonStyle,
252
- disabledButtonStyle,
253
- formInputStyle,
254
- inputBackgroundStyle,
255
- outlineButtonStyle,
256
- primaryButtonStyle,
257
- useFullscreen,
258
- useModal,
259
- useModalPortal,
260
- useModalRoot
261
- });
@@ -1,219 +0,0 @@
1
- // src/cn.ts
2
- function cn(...classes) {
3
- return classes.filter(Boolean).join(" ").trim();
4
- }
5
-
6
- // src/components/modal/fullscreen_container.tsx
7
- import React from "react";
8
- import {
9
- useEffect,
10
- useRef
11
- } from "react";
12
- function useFullscreen(ref) {
13
- useEffect(() => {
14
- const container = ref.current;
15
- if (!container) {
16
- return;
17
- }
18
- const scroll = () => {
19
- if (scrollY > 0) {
20
- window.scrollTo({
21
- top: 0,
22
- behavior: "instant"
23
- });
24
- }
25
- };
26
- const resize = () => {
27
- if (!visualViewport) {
28
- return;
29
- }
30
- container.classList.remove("bottom-0");
31
- container.style.height = `${visualViewport?.height}px`;
32
- if (visualViewport.height < window.innerHeight) {
33
- window.addEventListener("scroll", scroll);
34
- } else {
35
- window.removeEventListener("scroll", scroll);
36
- }
37
- };
38
- resize();
39
- visualViewport?.addEventListener("resize", resize);
40
- scroll();
41
- return () => {
42
- window.removeEventListener("scroll", scroll);
43
- visualViewport?.removeEventListener("resize", resize);
44
- };
45
- }, [ref]);
46
- return "fixed inset-0";
47
- }
48
-
49
- // src/components/modal/hooks.tsx
50
- import { createContext, useCallback, useEffect as useEffect3, useRef as useRef3, useState } from "react";
51
- import { createPortal } from "react-dom";
52
-
53
- // src/components/modal/modal.tsx
54
- import React2, {
55
- useEffect as useEffect2,
56
- useRef as useRef2
57
- } from "react";
58
- function Modal({
59
- open,
60
- className,
61
- background = "bg-gray-500/25",
62
- onBackgroundClick,
63
- children,
64
- ...props
65
- }) {
66
- const containerRef = useRef2(null);
67
- const fullscreen = useFullscreen(containerRef);
68
- const [mounted, setMounted] = React2.useState(false);
69
- useEffect2(() => {
70
- if (open) {
71
- setMounted(true);
72
- } else {
73
- setTimeout(() => {
74
- setMounted(false);
75
- }, 200);
76
- }
77
- return () => {
78
- };
79
- }, [open]);
80
- const onBackgroundMouseDown = (event) => {
81
- event.preventDefault();
82
- onBackgroundClick?.();
83
- };
84
- const onModalMouseDown = (event) => {
85
- event.stopPropagation();
86
- };
87
- const onBackgroundTouchStart = (event) => {
88
- event.preventDefault();
89
- onBackgroundClick?.();
90
- };
91
- const onModalTouchStart = (event) => {
92
- event.stopPropagation();
93
- };
94
- return /* @__PURE__ */ React2.createElement(
95
- "div",
96
- {
97
- ref: containerRef,
98
- className: cn(
99
- fullscreen,
100
- "z-[999] flex flex-col justify-center transition-bg duration-200 md:px-6 overflow-hidden print:px-0 print:block print:overflow-auto",
101
- open && mounted ? cn(background, "ease-out") : "bg-transparent ease-in pointer-events-none"
102
- ),
103
- onMouseDown: onBackgroundMouseDown,
104
- onTouchStart: onBackgroundTouchStart
105
- },
106
- /* @__PURE__ */ React2.createElement(
107
- "div",
108
- {
109
- className: cn(
110
- "relative flex-1 flex flex-col justify-end md:justify-center items-center transition-[opacity transform] duration-200 print:block",
111
- open && mounted ? "translate-y-[0px] opacity-100 ease-out" : "translate-y-[100%] md:translate-y-[50px] opacity-0 ease-in"
112
- )
113
- },
114
- (open || mounted) && /* @__PURE__ */ React2.createElement(
115
- "div",
116
- {
117
- ...props,
118
- className: cn(
119
- className,
120
- "w-full max-h-[92vh] print:w-[unset] print:max-h-[unset] rounded-tl-lg rounded-tr-lg md:rounded-lg overflow-auto print:rounded-none"
121
- ),
122
- onMouseDown: onModalMouseDown,
123
- onTouchStart: onModalTouchStart
124
- },
125
- children
126
- )
127
- )
128
- );
129
- }
130
-
131
- // src/components/modal/hooks.tsx
132
- import React3 from "react";
133
- function useModalRoot() {
134
- const [container, setContainer] = useState(null);
135
- useEffect3(() => {
136
- const container2 = document.getElementById("modal-root");
137
- if (container2) {
138
- setContainer(container2);
139
- }
140
- return () => {
141
- setContainer(null);
142
- };
143
- }, []);
144
- return container;
145
- }
146
- function useModalPortal() {
147
- const container = useModalRoot();
148
- if (!container) {
149
- return (children) => null;
150
- }
151
- return (children) => {
152
- return createPortal(children, container);
153
- };
154
- }
155
- var ModalContext = createContext({});
156
- function useModal() {
157
- const ch2 = useRef3(
158
- null
159
- );
160
- const open = () => {
161
- ch2.current?.(true);
162
- };
163
- const close = () => {
164
- ch2.current?.(false);
165
- };
166
- const Component = useCallback(
167
- function Component2(props) {
168
- const [isOpen, setIsOpen] = useState(false);
169
- const createPortal2 = useModalPortal();
170
- useEffect3(() => {
171
- ch2.current = (v) => {
172
- setIsOpen(v);
173
- };
174
- return () => {
175
- ch2.current = null;
176
- };
177
- }, []);
178
- useEffect3(() => {
179
- if (isOpen) {
180
- } else {
181
- }
182
- return () => {
183
- };
184
- }, [isOpen]);
185
- return /* @__PURE__ */ React3.createElement(ModalContext.Provider, { value: { open, close, isOpen } }, createPortal2(
186
- /* @__PURE__ */ React3.createElement(Modal, { ...props, open: isOpen, onBackgroundClick: close })
187
- ));
188
- },
189
- []
190
- );
191
- return {
192
- open,
193
- close,
194
- Modal: Component
195
- };
196
- }
197
-
198
- // src/components/styles.ts
199
- var inputBackgroundStyle = "text-[16px] border border-neutral-200 outline-none appearance-none disabled:opacity-50 disabled:cursor-not-allowed placeholder:text-neutral-400";
200
- var formInputStyle = `w-full px-3 ${inputBackgroundStyle} h-[40px]`;
201
- var baseButtonStyle = "transition-colors text-sm font-semibold cursor-pointer flex items-center justify-center rounded-lg whitespace-nowrap text-ellipsis overflow-hidden";
202
- var primaryButtonStyle = `${baseButtonStyle} px-4 h-[40px] bg-gradient-to-br from-primary-400 to-primary-500 text-white transition-colors`;
203
- var disabledButtonStyle = `${baseButtonStyle} h-[40px] px-4 bg-neutral-200 text-neutral-400`;
204
- var outlineButtonStyle = `${baseButtonStyle} h-[40px] px-4 bg-white border border-neutral-300 hover:bg-neutral-50`;
205
- var dangerousButtonStyle = `${baseButtonStyle} h-[40px] px-4 bg-white border hover:bg-red-50 text-red-600`;
206
- export {
207
- ModalContext,
208
- baseButtonStyle,
209
- dangerousButtonStyle,
210
- disabledButtonStyle,
211
- formInputStyle,
212
- inputBackgroundStyle,
213
- outlineButtonStyle,
214
- primaryButtonStyle,
215
- useFullscreen,
216
- useModal,
217
- useModalPortal,
218
- useModalRoot
219
- };
@@ -1,7 +0,0 @@
1
- import React, { DetailedHTMLProps, HTMLAttributes } from 'react';
2
-
3
- type Props = DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
4
- declare function FullscreenContainer({ className, children, ...props }: Props): React.JSX.Element;
5
- declare function useFullscreen(ref: React.RefObject<HTMLDivElement | null>): string;
6
-
7
- export { type Props, FullscreenContainer as default, useFullscreen };
@@ -1,7 +0,0 @@
1
- import React, { DetailedHTMLProps, HTMLAttributes } from 'react';
2
-
3
- type Props = DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
4
- declare function FullscreenContainer({ className, children, ...props }: Props): React.JSX.Element;
5
- declare function useFullscreen(ref: React.RefObject<HTMLDivElement | null>): string;
6
-
7
- export { type Props, FullscreenContainer as default, useFullscreen };
@@ -1,102 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/components/modal/fullscreen_container.tsx
31
- var fullscreen_container_exports = {};
32
- __export(fullscreen_container_exports, {
33
- default: () => FullscreenContainer,
34
- useFullscreen: () => useFullscreen
35
- });
36
- module.exports = __toCommonJS(fullscreen_container_exports);
37
-
38
- // src/cn.ts
39
- function cn(...classes) {
40
- return classes.filter(Boolean).join(" ").trim();
41
- }
42
-
43
- // src/components/modal/fullscreen_container.tsx
44
- var import_react = __toESM(require("react"));
45
- var import_react2 = require("react");
46
- function FullscreenContainer({
47
- className,
48
- children,
49
- ...props
50
- }) {
51
- const containerRef = (0, import_react2.useRef)(null);
52
- useFullscreen(containerRef);
53
- return /* @__PURE__ */ import_react.default.createElement(
54
- "div",
55
- {
56
- ref: containerRef,
57
- ...props,
58
- className: cn("fixed left-0 right-0 top-0 bottom-0", className)
59
- },
60
- children
61
- );
62
- }
63
- function useFullscreen(ref) {
64
- (0, import_react2.useEffect)(() => {
65
- const container = ref.current;
66
- if (!container) {
67
- return;
68
- }
69
- const scroll = () => {
70
- if (scrollY > 0) {
71
- window.scrollTo({
72
- top: 0,
73
- behavior: "instant"
74
- });
75
- }
76
- };
77
- const resize = () => {
78
- if (!visualViewport) {
79
- return;
80
- }
81
- container.classList.remove("bottom-0");
82
- container.style.height = `${visualViewport?.height}px`;
83
- if (visualViewport.height < window.innerHeight) {
84
- window.addEventListener("scroll", scroll);
85
- } else {
86
- window.removeEventListener("scroll", scroll);
87
- }
88
- };
89
- resize();
90
- visualViewport?.addEventListener("resize", resize);
91
- scroll();
92
- return () => {
93
- window.removeEventListener("scroll", scroll);
94
- visualViewport?.removeEventListener("resize", resize);
95
- };
96
- }, [ref]);
97
- return "fixed inset-0";
98
- }
99
- // Annotate the CommonJS export names for ESM import in node:
100
- 0 && (module.exports = {
101
- useFullscreen
102
- });
@@ -1,68 +0,0 @@
1
- // src/cn.ts
2
- function cn(...classes) {
3
- return classes.filter(Boolean).join(" ").trim();
4
- }
5
-
6
- // src/components/modal/fullscreen_container.tsx
7
- import React from "react";
8
- import {
9
- useEffect,
10
- useRef
11
- } from "react";
12
- function FullscreenContainer({
13
- className,
14
- children,
15
- ...props
16
- }) {
17
- const containerRef = useRef(null);
18
- useFullscreen(containerRef);
19
- return /* @__PURE__ */ React.createElement(
20
- "div",
21
- {
22
- ref: containerRef,
23
- ...props,
24
- className: cn("fixed left-0 right-0 top-0 bottom-0", className)
25
- },
26
- children
27
- );
28
- }
29
- function useFullscreen(ref) {
30
- useEffect(() => {
31
- const container = ref.current;
32
- if (!container) {
33
- return;
34
- }
35
- const scroll = () => {
36
- if (scrollY > 0) {
37
- window.scrollTo({
38
- top: 0,
39
- behavior: "instant"
40
- });
41
- }
42
- };
43
- const resize = () => {
44
- if (!visualViewport) {
45
- return;
46
- }
47
- container.classList.remove("bottom-0");
48
- container.style.height = `${visualViewport?.height}px`;
49
- if (visualViewport.height < window.innerHeight) {
50
- window.addEventListener("scroll", scroll);
51
- } else {
52
- window.removeEventListener("scroll", scroll);
53
- }
54
- };
55
- resize();
56
- visualViewport?.addEventListener("resize", resize);
57
- scroll();
58
- return () => {
59
- window.removeEventListener("scroll", scroll);
60
- visualViewport?.removeEventListener("resize", resize);
61
- };
62
- }, [ref]);
63
- return "fixed inset-0";
64
- }
65
- export {
66
- FullscreenContainer as default,
67
- useFullscreen
68
- };
@@ -1,18 +0,0 @@
1
- import { ModalProps } from './modal.mjs';
2
- import React from 'react';
3
-
4
- declare function useModalRoot(): HTMLElement | null;
5
- declare function useModalPortal(): ((children: React.ReactNode) => null) | ((children: React.ReactNode) => React.ReactPortal);
6
- type ModalContextProps = {
7
- open: () => void;
8
- close: () => void;
9
- isOpen: boolean;
10
- };
11
- declare const ModalContext: React.Context<ModalContextProps>;
12
- declare function useModal(): {
13
- open: () => void;
14
- close: () => void;
15
- Modal: (props: Omit<ModalProps, "open">) => React.JSX.Element;
16
- };
17
-
18
- export { ModalContext, type ModalContextProps, useModal, useModalPortal, useModalRoot };
@@ -1,18 +0,0 @@
1
- import { ModalProps } from './modal.js';
2
- import React from 'react';
3
-
4
- declare function useModalRoot(): HTMLElement | null;
5
- declare function useModalPortal(): ((children: React.ReactNode) => null) | ((children: React.ReactNode) => React.ReactPortal);
6
- type ModalContextProps = {
7
- open: () => void;
8
- close: () => void;
9
- isOpen: boolean;
10
- };
11
- declare const ModalContext: React.Context<ModalContextProps>;
12
- declare function useModal(): {
13
- open: () => void;
14
- close: () => void;
15
- Modal: (props: Omit<ModalProps, "open">) => React.JSX.Element;
16
- };
17
-
18
- export { ModalContext, type ModalContextProps, useModal, useModalPortal, useModalRoot };