ui-soxo-bootstrap-core 2.6.40-dev.1 → 2.6.40-dev.12

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 (420) hide show
  1. package/.babelrc +8 -8
  2. package/.github/workflows/npm-publish.yml +5 -4
  3. package/.husky/pre-commit +11 -11
  4. package/.prettierrc.json +10 -10
  5. package/DEVELOPER_GUIDE.md +323 -323
  6. package/PUBLISHING.md +333 -0
  7. package/babel.config.js +2 -2
  8. package/core/components/component-loader/component-loader.js +125 -125
  9. package/core/components/component-wrapper/component-wrapper.js +121 -121
  10. package/core/components/external-window/DEVELOPER_GUIDE.md +705 -705
  11. package/core/components/external-window/external-window.js +236 -236
  12. package/core/components/external-window/external-window.test.js +80 -80
  13. package/core/components/extra-info/extra-info-details.js +155 -155
  14. package/core/components/extra-info/extra-info-details.scss +26 -26
  15. package/core/components/extra-info/extra-info.js +134 -134
  16. package/core/components/index.js +12 -12
  17. package/core/components/landing-api/landing-api.js +707 -707
  18. package/core/components/landing-api/landing-api.scss +41 -41
  19. package/core/components/license-management/license-alert.js +97 -97
  20. package/core/components/menu-template-api/menu-template-api.js +321 -321
  21. package/core/components/root-application-api/root-application-api.js +174 -174
  22. package/core/index.js +13 -13
  23. package/core/lib/Store.js +369 -369
  24. package/core/lib/components/application-bootstrap/application-bootstrap.js +115 -115
  25. package/core/lib/components/approval-form/approval-form.js +280 -280
  26. package/core/lib/components/approval-form/approval-form.scss +183 -183
  27. package/core/lib/components/approval-list/approval-list.js +143 -143
  28. package/core/lib/components/approval-list/approval-list.scss +2 -2
  29. package/core/lib/components/approval-list/components/request-card/request-card.js +42 -42
  30. package/core/lib/components/approval-list/components/request-card/request-card.scss +30 -30
  31. package/core/lib/components/camera/camera.js +230 -230
  32. package/core/lib/components/camera/camera.scss +86 -86
  33. package/core/lib/components/comment-block/comment-block.js +138 -138
  34. package/core/lib/components/comment-block/comment-block.scss +3 -3
  35. package/core/lib/components/confirm-modal/confirm-modal.js +82 -82
  36. package/core/lib/components/confirm-modal/confirm-modal.scss +2 -2
  37. package/core/lib/components/consent/consent.js +67 -67
  38. package/core/lib/components/consent/pdf-signature.js +299 -299
  39. package/core/lib/components/consent/signature-pad.js +90 -90
  40. package/core/lib/components/consent/signature-pad.scss +14 -14
  41. package/core/lib/components/file-upload/file-upload.js +133 -133
  42. package/core/lib/components/finger-print-reader/finger-print-reader.js +295 -295
  43. package/core/lib/components/finger-print-reader/finger-print-reader.scss +47 -47
  44. package/core/lib/components/finger-print-search/finger-print-search.js +200 -200
  45. package/core/lib/components/finger-print-search/finger-print-search.scss +47 -47
  46. package/core/lib/components/global-header/animations.js +18 -18
  47. package/core/lib/components/global-header/global-header.js +286 -286
  48. package/core/lib/components/global-header/global-header.scss +397 -397
  49. package/core/lib/components/header/generic-header.js +76 -76
  50. package/core/lib/components/header/generic-header.scss +99 -99
  51. package/core/lib/components/image-preview/image-preview.js +33 -33
  52. package/core/lib/components/image-wrapper/image-wrapper.js +108 -108
  53. package/core/lib/components/image-wrapper/image-wrapper.scss +12 -12
  54. package/core/lib/components/index.js +206 -206
  55. package/core/lib/components/landing/landing.js +403 -403
  56. package/core/lib/components/language-switcher/language-switcher.js +49 -49
  57. package/core/lib/components/menu-context/menu-context.js +69 -69
  58. package/core/lib/components/menu-template/menu-template.js +249 -249
  59. package/core/lib/components/menu-template/menu-template.scss +9 -9
  60. package/core/lib/components/modal-search/modal-search.js +153 -153
  61. package/core/lib/components/modal-search/modal-search.scss +78 -78
  62. package/core/lib/components/modal-wrapper/modal-manager.js +15 -15
  63. package/core/lib/components/modal-wrapper/modal-wrapper.js +108 -108
  64. package/core/lib/components/modal-wrapper/modal-wrapper.scss +13 -13
  65. package/core/lib/components/notice-board/notice-board.js +132 -132
  66. package/core/lib/components/notice-board/notice-board.scss +65 -65
  67. package/core/lib/components/page-container/page-container.js +55 -55
  68. package/core/lib/components/page-container/page-container.scss +8 -8
  69. package/core/lib/components/page-header/page-header.js +23 -23
  70. package/core/lib/components/page-header/page-header.scss +17 -17
  71. package/core/lib/components/pdf-viewer/pdf-viewer.js +56 -56
  72. package/core/lib/components/portlet-table/components/table-actions/table-actions.js +58 -58
  73. package/core/lib/components/portlet-table/components/table-actions/table-actions.scss +1 -1
  74. package/core/lib/components/portlet-table/components/table-data/table-data.js +106 -106
  75. package/core/lib/components/portlet-table/portlet-table.js +63 -63
  76. package/core/lib/components/portlet-table/portlet-table.scss +90 -90
  77. package/core/lib/components/progress-bar/progress-bar.js +58 -58
  78. package/core/lib/components/progress-bar/progress-bar.scss +15 -15
  79. package/core/lib/components/request-form/request-form.js +110 -110
  80. package/core/lib/components/root-application/root-application.js +70 -70
  81. package/core/lib/components/rupee/rupee.js +14 -14
  82. package/core/lib/components/script-input/script-input.js +169 -169
  83. package/core/lib/components/script-input/script-input.scss +8 -8
  84. package/core/lib/components/sidemenu/animations.js +51 -51
  85. package/core/lib/components/sidemenu/sidemenu.js +713 -713
  86. package/core/lib/components/sidemenu/sidemenu.scss +314 -314
  87. package/core/lib/components/spotlight-search/spotlight-search.component.js +635 -635
  88. package/core/lib/components/spotlight-search/spotlight-search.component.scss +78 -78
  89. package/core/lib/components/table-wrapper/table-wrapper.js +135 -135
  90. package/core/lib/components/table-wrapper/table-wrapper.scss +72 -72
  91. package/core/lib/components/ui_elements/Loader.js +12 -12
  92. package/core/lib/components/ui_elements/Notify.js +12 -12
  93. package/core/lib/components/ui_elements/PlaceHolder.js +33 -33
  94. package/core/lib/components/web-camera/web-camera.js +161 -161
  95. package/core/lib/components/web-camera/web-camera.scss +28 -28
  96. package/core/lib/core.md +9 -9
  97. package/core/lib/elements/Elements.md +2 -2
  98. package/core/lib/elements/basic/LoggedUserRedirect.js +21 -21
  99. package/core/lib/elements/basic/PrivateRoute.js +16 -16
  100. package/core/lib/elements/basic/button/Button.md +43 -43
  101. package/core/lib/elements/basic/button/button.js +170 -170
  102. package/core/lib/elements/basic/card/Card.md +15 -15
  103. package/core/lib/elements/basic/card/card.js +40 -40
  104. package/core/lib/elements/basic/card/card.scss +13 -13
  105. package/core/lib/elements/basic/checkbox/checkbox.js +23 -23
  106. package/core/lib/elements/basic/col/col.js +15 -15
  107. package/core/lib/elements/basic/copy-to-clipboard/Readme.md +40 -40
  108. package/core/lib/elements/basic/copy-to-clipboard/copy-to-clipboard.js +61 -61
  109. package/core/lib/elements/basic/country-phone-input/Readme.md +98 -98
  110. package/core/lib/elements/basic/country-phone-input/country-phone-input.js +81 -81
  111. package/core/lib/elements/basic/country-phone-input/phone-input.scss +75 -75
  112. package/core/lib/elements/basic/datepicker/datepicker.js +33 -33
  113. package/core/lib/elements/basic/dragabble-wrapper/draggable-wrapper.js +203 -203
  114. package/core/lib/elements/basic/empty/empty.js +14 -14
  115. package/core/lib/elements/basic/fingerprint-protrected/fingerprint-protected.js +118 -118
  116. package/core/lib/elements/basic/fingerprint-protrected/fingerprint-protected.scss +10 -10
  117. package/core/lib/elements/basic/form/form.js +70 -70
  118. package/core/lib/elements/basic/form/form.scss +3 -3
  119. package/core/lib/elements/basic/image/image.js +45 -45
  120. package/core/lib/elements/basic/image/image.scss +17 -17
  121. package/core/lib/elements/basic/image/readme.md +26 -26
  122. package/core/lib/elements/basic/image-viewer/image-viewer.js +108 -108
  123. package/core/lib/elements/basic/image-viewer/image-viewer.scss +7 -7
  124. package/core/lib/elements/basic/input/input.js +81 -81
  125. package/core/lib/elements/basic/input/readme.md +77 -77
  126. package/core/lib/elements/basic/json-input/json-input.js +51 -51
  127. package/core/lib/elements/basic/menu-dashboard/menu-dashboard.js +216 -216
  128. package/core/lib/elements/basic/menu-dashboard/menu-dashboard.scss +28 -28
  129. package/core/lib/elements/basic/menu-tree/menu-tree.js +127 -127
  130. package/core/lib/elements/basic/modal/modal.js +64 -64
  131. package/core/lib/elements/basic/modal/readme.md +62 -62
  132. package/core/lib/elements/basic/popconfirm/popconfirm.js +17 -17
  133. package/core/lib/elements/basic/popover/popover.js +12 -12
  134. package/core/lib/elements/basic/radio/radio.js +18 -18
  135. package/core/lib/elements/basic/rangepicker/rangepicker.js +141 -141
  136. package/core/lib/elements/basic/rangepicker/rangepicker.scss +24 -24
  137. package/core/lib/elements/basic/rangepicker/readme.md +81 -81
  138. package/core/lib/elements/basic/reference-select/readme.md +18 -18
  139. package/core/lib/elements/basic/reference-select/reference-select.js +337 -337
  140. package/core/lib/elements/basic/row/row.js +15 -15
  141. package/core/lib/elements/basic/select/select.js +46 -46
  142. package/core/lib/elements/basic/select-box/readme.md +52 -52
  143. package/core/lib/elements/basic/select-box/select-box.js +63 -63
  144. package/core/lib/elements/basic/skeleton/readme.md +35 -35
  145. package/core/lib/elements/basic/skeleton/skeleton.js +35 -35
  146. package/core/lib/elements/basic/skeleton/skeleton.scss +53 -53
  147. package/core/lib/elements/basic/space/space.js +12 -12
  148. package/core/lib/elements/basic/switch/readme.md +29 -29
  149. package/core/lib/elements/basic/switch/switch.js +67 -67
  150. package/core/lib/elements/basic/tab/tab.js +14 -14
  151. package/core/lib/elements/basic/table/readme.md +8 -8
  152. package/core/lib/elements/basic/table/table.js +95 -95
  153. package/core/lib/elements/basic/tag/tag.js +63 -63
  154. package/core/lib/elements/basic/tag/tag.scss +2 -2
  155. package/core/lib/elements/basic/timeline/timeline.js +13 -13
  156. package/core/lib/elements/basic/title/readme.md +20 -20
  157. package/core/lib/elements/basic/title/title.js +37 -37
  158. package/core/lib/elements/basic/user-search/user-search.js +192 -192
  159. package/core/lib/elements/complex/barcode/barcode.js +27 -27
  160. package/core/lib/elements/complex/bargraph/bar-graph.js +262 -262
  161. package/core/lib/elements/complex/basic-table/basic-table.js +110 -110
  162. package/core/lib/elements/complex/basic-table/basic-table.scss +4 -4
  163. package/core/lib/elements/complex/date-display/date-display.js +37 -37
  164. package/core/lib/elements/complex/error-boundary/error-boundary.js +29 -29
  165. package/core/lib/elements/complex/google-location-input/map-container-library-load.js +92 -92
  166. package/core/lib/elements/complex/google-map/google-map.js +230 -230
  167. package/core/lib/elements/complex/google-map/google-map.scss +13 -13
  168. package/core/lib/elements/complex/line-graph/line-graph.js +108 -108
  169. package/core/lib/elements/complex/location-search-input/location-search-input.js +100 -100
  170. package/core/lib/elements/complex/pie-chart/pie-chart.js +202 -202
  171. package/core/lib/elements/complex/qr-code/qr-code.js +27 -27
  172. package/core/lib/elements/complex/qrscanner/qrscanner.js +57 -57
  173. package/core/lib/elements/complex/search-debounce/search-debounce.js +37 -37
  174. package/core/lib/elements/complex/statistic-card/dashboard-statistic-card.js +75 -75
  175. package/core/lib/elements/complex/statistic-card/statistic-card.js +28 -28
  176. package/core/lib/elements/index.js +226 -226
  177. package/core/lib/hooks/device-detect.js +25 -25
  178. package/core/lib/hooks/index.js +9 -9
  179. package/core/lib/hooks/use-location.js +33 -33
  180. package/core/lib/hooks/use-otp-timer.js +80 -80
  181. package/core/lib/hooks/use-window-size.js +34 -34
  182. package/core/lib/i18n.js +69 -69
  183. package/core/lib/index.js +106 -106
  184. package/core/lib/introduction.md +73 -73
  185. package/core/lib/js-styleguide.md +4112 -4112
  186. package/core/lib/models/actions/actions.js +127 -127
  187. package/core/lib/models/actions/components/action-detail/action-detail.js +190 -190
  188. package/core/lib/models/actions/components/custom-actions/custom-actions.js +185 -185
  189. package/core/lib/models/attachments/attachments.js +231 -231
  190. package/core/lib/models/base-loader.js +99 -99
  191. package/core/lib/models/base.js +716 -716
  192. package/core/lib/models/branches/branches.js +125 -125
  193. package/core/lib/models/checklists/checklists.js +114 -114
  194. package/core/lib/models/columns/columns.js +169 -169
  195. package/core/lib/models/columns/components/columns-add/columns-add.js +171 -171
  196. package/core/lib/models/comments/comments.js +213 -213
  197. package/core/lib/models/departments/departments.js +107 -107
  198. package/core/lib/models/financial-years/financial_years.js +127 -127
  199. package/core/lib/models/forms/components/form-creator/form-creator.js +665 -665
  200. package/core/lib/models/forms/components/form-creator/form-creator.scss +39 -39
  201. package/core/lib/models/forms/components/form-detail/form-detail.js +224 -224
  202. package/core/lib/models/forms/forms.js +121 -121
  203. package/core/lib/models/index.js +203 -203
  204. package/core/lib/models/invoice-numbers/invoice_numbers.js +204 -204
  205. package/core/lib/models/lookup-types/components/lookup-detail/lookup-detail.js +145 -145
  206. package/core/lib/models/lookup-types/lookup-types.js +113 -113
  207. package/core/lib/models/lookup-values/components/lookup-values-add/lookup-values-add.js +126 -126
  208. package/core/lib/models/lookup-values/lookup-values.js +107 -107
  209. package/core/lib/models/menu-roles/menu-roles.js +127 -127
  210. package/core/lib/models/menus/components/menu-add/menu-add.js +228 -228
  211. package/core/lib/models/menus/components/menu-detail/menu-detail.js +170 -170
  212. package/core/lib/models/menus/components/menu-list/menu-list.js +550 -550
  213. package/core/lib/models/menus/components/menu-list/menu-list.scss +5 -5
  214. package/core/lib/models/menus/components/menu-roles-add/menu-roles-add.js +183 -183
  215. package/core/lib/models/menus/menus.js +499 -499
  216. package/core/lib/models/models/components/model-detail/model-detail.js +137 -137
  217. package/core/lib/models/models/components/models.js +128 -128
  218. package/core/lib/models/modules/modules.js +204 -204
  219. package/core/lib/models/outbox/outbox.js +73 -73
  220. package/core/lib/models/pages/pages.js +107 -107
  221. package/core/lib/models/permissions/permissions.js +71 -71
  222. package/core/lib/models/process/components/process-add/process-add.js +181 -181
  223. package/core/lib/models/process/components/process-dashboard/process-dashboard.js +1068 -1068
  224. package/core/lib/models/process/components/process-dashboard/process-dashboard.scss +66 -66
  225. package/core/lib/models/process/components/process-detail/process-detail.js +140 -140
  226. package/core/lib/models/process/components/process-timeline/process-timeline.js +139 -139
  227. package/core/lib/models/process/components/task-detail/task-detail.js +240 -240
  228. package/core/lib/models/process/components/task-detail/task-detail.scss +27 -27
  229. package/core/lib/models/process/components/task-form/task-form.js +528 -528
  230. package/core/lib/models/process/components/task-form/task-form.scss +7 -7
  231. package/core/lib/models/process/components/task-list/task-list.js +221 -221
  232. package/core/lib/models/process/components/task-list/task-list.scss +14 -14
  233. package/core/lib/models/process/components/task-overview/task-overview.js +299 -299
  234. package/core/lib/models/process/components/task-overview-legacy/task-overview-legacy.js +192 -192
  235. package/core/lib/models/process/components/task-routes/task-routes.js +45 -45
  236. package/core/lib/models/process/components/task-status/task-status.js +175 -175
  237. package/core/lib/models/process/components/task-status/task-status.scss +11 -11
  238. package/core/lib/models/process/process.js +780 -780
  239. package/core/lib/models/process-transactions/process-transactions.js +123 -123
  240. package/core/lib/models/roles/roles.js +106 -106
  241. package/core/lib/models/scripts/scripts.js +111 -111
  242. package/core/lib/models/step-transactions/step-transcations.js +147 -147
  243. package/core/lib/models/steps/components/step-add/step-add.js +261 -261
  244. package/core/lib/models/steps/components/step-detail/step-detail.js +157 -157
  245. package/core/lib/models/steps/steps.js +356 -356
  246. package/core/lib/models/user-preferences/user-preferences.js +83 -83
  247. package/core/lib/models/users/components/user-add/user-add.js +226 -226
  248. package/core/lib/models/users/users.js +119 -119
  249. package/core/lib/modules/business/launch-page/launch-page.js +29 -29
  250. package/core/lib/modules/business/launch-page/launch-page.scss +5 -5
  251. package/core/lib/modules/business/slots/slots.js +231 -231
  252. package/core/lib/modules/business/slots/slots.scss +108 -108
  253. package/core/lib/modules/forms/components/field-customizer/field-customizer.js +138 -138
  254. package/core/lib/modules/forms/components/field-selector/field-selector.js +157 -157
  255. package/core/lib/modules/forms/components/field-selector/field-selector.scss +25 -25
  256. package/core/lib/modules/forms/components/form-display/form-display.js +203 -203
  257. package/core/lib/modules/forms/components/form-display/form-display.scss +9 -9
  258. package/core/lib/modules/forms/components/tab-customizer/tab-customizer.js +124 -124
  259. package/core/lib/modules/generic/generic-add/generic-add.js +213 -213
  260. package/core/lib/modules/generic/generic-detail/generic-detail.js +199 -199
  261. package/core/lib/modules/generic/generic-edit/generic-edit.js +120 -120
  262. package/core/lib/modules/generic/generic-list/ExportReactCSV.js +414 -414
  263. package/core/lib/modules/generic/generic-list/generic-list.js +705 -705
  264. package/core/lib/modules/generic/generic-list/generic-list.scss +68 -68
  265. package/core/lib/modules/generic/generic-upload/generic-upload.js +483 -483
  266. package/core/lib/modules/generic/table-settings/table-settings.js +226 -226
  267. package/core/lib/modules/generic/table-settings/table-settings.scss +37 -37
  268. package/core/lib/modules/index.js +52 -52
  269. package/core/lib/modules/modules-routes/module-routes.js +35 -35
  270. package/core/lib/pages/change-password/change-password.js +204 -204
  271. package/core/lib/pages/change-password/change-password.scss +73 -73
  272. package/core/lib/pages/homepage/homepage.js +53 -53
  273. package/core/lib/pages/index.js +19 -19
  274. package/core/lib/pages/login/commnication-mode-selection.js +46 -46
  275. package/core/lib/pages/login/communication-mode-selection.scss +60 -60
  276. package/core/lib/pages/login/login.js +872 -872
  277. package/core/lib/pages/login/login.scss +353 -353
  278. package/core/lib/pages/login/reset-password.js +124 -124
  279. package/core/lib/pages/login/reset-password.scss +31 -31
  280. package/core/lib/pages/manage-users/manage-users.js +429 -429
  281. package/core/lib/pages/manage-users/manage-users.scss +25 -25
  282. package/core/lib/pages/profile/profile.js +247 -247
  283. package/core/lib/pages/profile/profile.scss +107 -107
  284. package/core/lib/pages/profile/theme-config.js +18 -18
  285. package/core/lib/pages/profile/themes-backup.json +310 -310
  286. package/core/lib/pages/profile/themes.json +254 -254
  287. package/core/lib/pages/register/register.js +176 -176
  288. package/core/lib/pages/register/register.scss +128 -128
  289. package/core/lib/react-styleguide.md +756 -756
  290. package/core/lib/utils/api/api.utils.js +207 -207
  291. package/core/lib/utils/api/readme.md +426 -426
  292. package/core/lib/utils/async.js +35 -35
  293. package/core/lib/utils/common/common.utils.js +237 -237
  294. package/core/lib/utils/common/readme.md +30 -30
  295. package/core/lib/utils/date/date.utils.js +295 -295
  296. package/core/lib/utils/date/readme.md +2 -2
  297. package/core/lib/utils/firebase.support.utils.js +98 -98
  298. package/core/lib/utils/firebase.utils.js +808 -808
  299. package/core/lib/utils/font-awesome.utils.js +168 -168
  300. package/core/lib/utils/form/form.utils.js +255 -255
  301. package/core/lib/utils/generic/generic.utils.js +70 -70
  302. package/core/lib/utils/http/auth.helper.js +95 -95
  303. package/core/lib/utils/http/http.utils.js +186 -186
  304. package/core/lib/utils/http/readme.md +14 -14
  305. package/core/lib/utils/index.js +43 -43
  306. package/core/lib/utils/location/location.utils.js +137 -137
  307. package/core/lib/utils/location/readme.md +18 -18
  308. package/core/lib/utils/modal.utils.js +15 -15
  309. package/core/lib/utils/notification.utils.js +34 -34
  310. package/core/lib/utils/pwa/pwa.utils.js +88 -88
  311. package/core/lib/utils/script.utils.js +235 -235
  312. package/core/lib/utils/setting.utils.js +68 -68
  313. package/core/lib/utils/upload.utils.js +29 -29
  314. package/core/models/Preference/Preferences.js +46 -46
  315. package/core/models/base/base.js +403 -403
  316. package/core/models/base-clone-loader.js +107 -107
  317. package/core/models/base-clone.js +187 -187
  318. package/core/models/base-loader.js +97 -97
  319. package/core/models/core-scripts/core-scripts.js +179 -179
  320. package/core/models/dashboard/dashboard.js +201 -201
  321. package/core/models/detail-loader.js +88 -88
  322. package/core/models/doctor/components/doctor-add/doctor-add.js +432 -432
  323. package/core/models/doctor/components/doctor-add/doctor-add.scss +32 -32
  324. package/core/models/groups.js +82 -82
  325. package/core/models/index.js +100 -100
  326. package/core/models/lookup-types/components/lookup-detail/lookup-detail.js +129 -129
  327. package/core/models/lookup-types/lookup-types.js +96 -96
  328. package/core/models/lookup-values/components/lookup-values-modal/lookup-values-modal.js +95 -95
  329. package/core/models/lookup-values/lookup-values.js +92 -92
  330. package/core/models/menu-roles/components/menu-roles-add/menu-roles-add.js +153 -153
  331. package/core/models/menu-roles/menu-roles.js +158 -158
  332. package/core/models/menus/components/menu-add/menu-add.js +288 -288
  333. package/core/models/menus/components/menu-add/menu-add.scss +31 -31
  334. package/core/models/menus/components/menu-detail/menu-detail.js +263 -263
  335. package/core/models/menus/components/menu-list/menu-list.js +392 -392
  336. package/core/models/menus/components/menu-lists/menu-lists.js +635 -584
  337. package/core/models/menus/components/menu-lists/menu-lists.scss +46 -46
  338. package/core/models/menus/menus.js +338 -338
  339. package/core/models/model-columns.js +121 -121
  340. package/core/models/models/components/model-detail/model-add.js +120 -120
  341. package/core/models/models/components/model-detail/model-detail.js +133 -133
  342. package/core/models/models/models.js +154 -154
  343. package/core/models/pages/components/page-add/page-add.js +163 -163
  344. package/core/models/pages/components/page-add/page-add.scss +30 -30
  345. package/core/models/pages/components/page-details/page-details.js +209 -209
  346. package/core/models/pages/components/page-list/page-list.js +248 -248
  347. package/core/models/pages/pages.js +142 -142
  348. package/core/models/pages.js +142 -142
  349. package/core/models/roles/components/role-add/menu-label.js +14 -14
  350. package/core/models/roles/components/role-add/menu-tree.js +127 -127
  351. package/core/models/roles/components/role-add/role-add.js +222 -222
  352. package/core/models/roles/components/role-add/role-add.scss +4 -4
  353. package/core/models/roles/components/role-list/role-list.js +406 -406
  354. package/core/models/roles/roles.js +196 -196
  355. package/core/models/staff/components/staff-add/staff-add.js +455 -455
  356. package/core/models/user-roles/components/user-roles-add/user-roles-add.js +149 -149
  357. package/core/models/user-roles/user-roles.js +113 -113
  358. package/core/models/users/components/assign-role/assign-role.js +428 -428
  359. package/core/models/users/components/assign-role/assign-role.scss +281 -281
  360. package/core/models/users/components/assign-role/avatar-props.js +45 -45
  361. package/core/models/users/components/user-add/user-add.js +847 -847
  362. package/core/models/users/components/user-add/user-edit.js +110 -110
  363. package/core/models/users/components/user-detail/user-detail.js +236 -236
  364. package/core/models/users/components/user-list/user-list.js +397 -397
  365. package/core/models/users/users.js +379 -379
  366. package/core/modules/Informations/change-info/change-info.js +618 -618
  367. package/core/modules/Informations/change-info/change-info.scss +134 -134
  368. package/core/modules/dashboard/components/dashboard-card/animations.js +64 -64
  369. package/core/modules/dashboard/components/dashboard-card/dashboard-card.js +197 -197
  370. package/core/modules/dashboard/components/dashboard-card/menu-dashboard-card.js +430 -430
  371. package/core/modules/dashboard/components/dashboard-card/menu-dashboard-card.scss +59 -59
  372. package/core/modules/dashboard/components/pop-query-dashboard/pop-query-dashboard.js +66 -66
  373. package/core/modules/generic/components/generic-add/generic-add.js +121 -121
  374. package/core/modules/generic/components/generic-add/generic-add.scss +13 -13
  375. package/core/modules/generic/components/generic-add-modal/generic-add-modal.js +125 -125
  376. package/core/modules/generic/components/generic-add-modal/generic-add-modal.scss +13 -13
  377. package/core/modules/generic/components/generic-detail/generic-detail.js +184 -184
  378. package/core/modules/generic/components/generic-detail/generic-detail.scss +25 -25
  379. package/core/modules/generic/components/generic-edit/generic-edit.js +123 -123
  380. package/core/modules/generic/components/generic-list/generic-list.js +335 -335
  381. package/core/modules/generic/components/generic-list/generic-list.scss +35 -35
  382. package/core/modules/index.js +42 -42
  383. package/core/modules/module-routes/module-routes.js +37 -37
  384. package/core/modules/reporting/components/index.js +6 -6
  385. package/core/modules/reporting/components/reporting-dashboard/README.md +316 -316
  386. package/core/modules/reporting/components/reporting-dashboard/adavance-search/advance-search.js +271 -271
  387. package/core/modules/reporting/components/reporting-dashboard/adavance-search/advance-search.scss +76 -76
  388. package/core/modules/reporting/components/reporting-dashboard/display-columns/build-display-columns.js +90 -90
  389. package/core/modules/reporting/components/reporting-dashboard/display-columns/build-display-columns.test.js +74 -74
  390. package/core/modules/reporting/components/reporting-dashboard/display-columns/display-cell-renderer.js +449 -449
  391. package/core/modules/reporting/components/reporting-dashboard/display-columns/display-cell-renderer.test.js +199 -199
  392. package/core/modules/reporting/components/reporting-dashboard/reporting-dashboard.js +1116 -1116
  393. package/core/modules/reporting/components/reporting-dashboard/reporting-dashboard.scss +215 -215
  394. package/core/modules/reporting/components/reporting-dashboard/reporting-table.js +519 -519
  395. package/core/modules/steps/action-buttons.js +92 -92
  396. package/core/modules/steps/action-buttons.scss +62 -62
  397. package/core/modules/steps/chat-assistant.js +141 -141
  398. package/core/modules/steps/narration.js +192 -192
  399. package/core/modules/steps/openai-realtime.js +275 -275
  400. package/core/modules/steps/progress-storage.js +140 -140
  401. package/core/modules/steps/readme.md +167 -167
  402. package/core/modules/steps/steps.js +1567 -1567
  403. package/core/modules/steps/steps.scss +907 -907
  404. package/core/modules/steps/timeline.js +56 -56
  405. package/core/modules/steps/voice-navigation.js +709 -709
  406. package/core/pages/homepage-api/homepage-api.js +106 -106
  407. package/core/pages/homepage-api/homepage-api.scss +233 -233
  408. package/core/pages/homepage-api/menu-dashboard.js +169 -169
  409. package/core/pages/homepage-api/menu-dashboard.scss +11 -11
  410. package/core/translation.json +53 -53
  411. package/core/translations.json +19 -19
  412. package/core/utils/script.utils.js +129 -129
  413. package/core/utils/settings.utils.js +25 -25
  414. package/eslint.config.mjs +79 -79
  415. package/index.js +35 -35
  416. package/jest.config.js +7 -7
  417. package/jest.setup.js +1 -1
  418. package/package.json +124 -124
  419. package/tsconfig.json +26 -26
  420. package/webpack.config.js +173 -173
@@ -1,705 +1,705 @@
1
- # ExternalWindow Component
2
-
3
- A React component that renders content in a separate browser window with full style inheritance and keyboard shortcuts support.
4
-
5
- ## Features
6
-
7
- - 🪟 Opens content in a new browser window
8
- - 🎨 Automatically copies parent window styles (Ant Design, SCSS, etc.)
9
- - ⚨️ Customizable keyboard shortcuts
10
- - 📍 Flexible positioning (manual or auto-center)
11
- - 🔄 React Portal-based rendering
12
- - ⚡ No white flash - instant background color matching
13
- - 🧹 Automatic cleanup on unmount
14
-
15
- ## Quick Start
16
-
17
- ```jsx
18
- import { useState, useCallback } from 'react';
19
- import { ExternalWindow } from './ExternalWindow';
20
- import { Button } from 'antd';
21
-
22
- function App() {
23
- const [showWindow, setShowWindow] = useState(false);
24
-
25
- // Use useCallback to prevent re-renders
26
- const handleClose = useCallback(() => {
27
- setShowWindow(false);
28
- }, []);
29
-
30
- return (
31
- <>
32
- <Button onClick={() => setShowWindow(true)}>Open New Window</Button>
33
-
34
- {showWindow && (
35
- <ExternalWindow title="My External Window" onClose={handleClose}>
36
- <div style={{ padding: 20 }}>
37
- <h1>Hello from external window!</h1>
38
- <p>All your styles are automatically copied here.</p>
39
- </div>
40
- </ExternalWindow>
41
- )}
42
- </>
43
- );
44
- }
45
- ```
46
-
47
- ## Props Reference
48
-
49
- ### Props
50
-
51
- | Prop | Type | Default | Description |
52
- | -------------- | --------------- | -------------------------------------------- | ----------------------------------------------------------------- |
53
- | `children` | `ReactNode` | **required** | Content to render in the new window |
54
- | `onClose` | `Function` | **required** | Callback when window closes (wrap in `useCallback`) |
55
- | `title` | `string` | `'New Window'` | Window title (shown in browser tab) |
56
- | `width` | `number` | `600` | Window width in pixels |
57
- | `height` | `number` | `400` | Window height in pixels |
58
- | `left` | `number` | `200` | Window X position (overridden by `centerScreen`) |
59
- | `top` | `number` | `200` | Window Y position (overridden by `centerScreen`) |
60
- | `copyStyles` | `boolean` | `true` | Whether to copy parent window styles |
61
- | `centerScreen` | `string\|false` | `false` | Center window: `'horizontal'`, `'vertical'`, `'both'`, or `false` |
62
- | `shortcuts` | `Object` | `{ close: 'Escape', focus: 'Ctrl+Shift+F' }` | Keyboard shortcuts configuration |
63
- | `onMinimize` | `Function` | `undefined` | Callback when window is minimized |
64
- | `onMaximize` | `Function` | `undefined` | Callback when window is maximized |
65
-
66
- ## Usage Examples
67
-
68
- ### Centered Window
69
-
70
- ```jsx
71
- import { useState, useCallback } from 'react';
72
-
73
- function App() {
74
- const [showWindow, setShowWindow] = useState(false);
75
-
76
- const handleClose = useCallback(() => {
77
- setShowWindow(false);
78
- }, []);
79
-
80
- return (
81
- <>
82
- <Button onClick={() => setShowWindow(true)}>Open Centered</Button>
83
-
84
- {showWindow && (
85
- <ExternalWindow title="Centered Window" width={800} height={600} centerScreen="both" onClose={handleClose}>
86
- <YourContent />
87
- </ExternalWindow>
88
- )}
89
- </>
90
- );
91
- }
92
- ```
93
-
94
- ### Custom Positioning
95
-
96
- ```jsx
97
- const handleClose = useCallback(() => setShowWindow(false), []);
98
-
99
- <ExternalWindow title="Custom Position" width={1000} height={700} left={100} top={50} onClose={handleClose}>
100
- <YourContent />
101
- </ExternalWindow>;
102
- ```
103
-
104
- ### With Custom Keyboard Shortcuts
105
-
106
- ```jsx
107
- const handleClose = useCallback(() => setShowWindow(false), []);
108
- const handleMinimize = useCallback(() => console.log('Minimized'), []);
109
- const handleMaximize = useCallback(() => console.log('Maximized'), []);
110
-
111
- <ExternalWindow
112
- title="With Shortcuts"
113
- shortcuts={{
114
- close: 'Escape', // Close window
115
- focus: 'Ctrl+Shift+F', // Focus window
116
- minimize: 'Ctrl+M', // Minimize window
117
- maximize: 'Ctrl+Shift+M', // Maximize window
118
- }}
119
- onClose={handleClose}
120
- onMinimize={handleMinimize}
121
- onMaximize={handleMaximize}
122
- >
123
- <YourContent />
124
- </ExternalWindow>;
125
- ```
126
-
127
- ### Without Style Copying
128
-
129
- ```jsx
130
- const handleClose = useCallback(() => setShowWindow(false), []);
131
-
132
- <ExternalWindow title="No Styles" copyStyles={false} onClose={handleClose}>
133
- {/* You'll need to add inline styles or external CSS links */}
134
- <div style={{ padding: 20, fontFamily: 'Arial' }}>
135
- <h1>Plain content</h1>
136
- </div>
137
- </ExternalWindow>;
138
- ```
139
-
140
- ### Managing Multiple Windows
141
-
142
- ```jsx
143
- function MultiWindowApp() {
144
- const [windows, setWindows] = useState([]);
145
-
146
- const openWindow = useCallback((config) => {
147
- const id = Date.now();
148
- setWindows((prev) => [...prev, { id, ...config }]);
149
- }, []);
150
-
151
- const closeWindow = useCallback((id) => {
152
- setWindows((prev) => prev.filter((w) => w.id !== id));
153
- }, []);
154
-
155
- return (
156
- <>
157
- <Button
158
- onClick={() =>
159
- openWindow({
160
- title: 'Window ' + (windows.length + 1),
161
- content: <MyComponent />,
162
- })
163
- }
164
- >
165
- Add Window
166
- </Button>
167
-
168
- {windows.map(({ id, title, content }) => (
169
- <ExternalWindow key={id} title={title} onClose={() => closeWindow(id)}>
170
- {content}
171
- </ExternalWindow>
172
- ))}
173
- </>
174
- );
175
- }
176
- ```
177
-
178
- ### Full-Featured Dashboard Example
179
-
180
- ```jsx
181
- import { useState, useCallback } from 'react';
182
- import { ExternalWindow } from './ExternalWindow';
183
- import { Button, Card, Space } from 'antd';
184
-
185
- function Dashboard() {
186
- const [windows, setWindows] = useState({
187
- chart: false,
188
- report: false,
189
- settings: false,
190
- });
191
-
192
- const openWindow = useCallback((name) => {
193
- setWindows((prev) => ({ ...prev, [name]: true }));
194
- }, []);
195
-
196
- const closeWindow = useCallback((name) => {
197
- setWindows((prev) => ({ ...prev, [name]: false }));
198
- }, []);
199
-
200
- return (
201
- <div style={{ padding: 24 }}>
202
- <Space>
203
- <Button onClick={() => openWindow('chart')}>Open Chart</Button>
204
- <Button onClick={() => openWindow('report')}>Open Report</Button>
205
- <Button onClick={() => openWindow('settings')}>Open Settings</Button>
206
- </Space>
207
-
208
- {windows.chart && (
209
- <ExternalWindow title="Analytics Chart" width={1200} height={800} centerScreen="both" onClose={() => closeWindow('chart')}>
210
- <Card title="Sales Analytics" style={{ margin: 20 }}>
211
- {/* Your chart component */}
212
- </Card>
213
- </ExternalWindow>
214
- )}
215
-
216
- {windows.report && (
217
- <ExternalWindow title="Monthly Report" width={900} height={700} left={50} top={50} onClose={() => closeWindow('report')}>
218
- <div style={{ padding: 20 }}>{/* Your report component */}</div>
219
- </ExternalWindow>
220
- )}
221
-
222
- {windows.settings && (
223
- <ExternalWindow
224
- title="Settings"
225
- width={600}
226
- height={500}
227
- centerScreen="horizontal"
228
- shortcuts={{
229
- close: 'Escape',
230
- focus: 'Ctrl+S',
231
- }}
232
- onClose={() => closeWindow('settings')}
233
- >
234
- <div style={{ padding: 20 }}>{/* Your settings component */}</div>
235
- </ExternalWindow>
236
- )}
237
- </div>
238
- );
239
- }
240
- ```
241
-
242
- ### With Shared State
243
-
244
- ```jsx
245
- function StatefulWindow() {
246
- const [showWindow, setShowWindow] = useState(false);
247
- const [data, setData] = useState([]);
248
-
249
- const handleClose = useCallback(() => {
250
- setShowWindow(false);
251
- }, []);
252
-
253
- return (
254
- <>
255
- <Button onClick={() => setShowWindow(true)}>Open Data Viewer</Button>
256
-
257
- {showWindow && (
258
- <ExternalWindow title="Data Viewer" onClose={handleClose}>
259
- {/* State is shared between parent and child window */}
260
- <DataTable data={data} onUpdate={setData} />
261
- </ExternalWindow>
262
- )}
263
- </>
264
- );
265
- }
266
- ```
267
-
268
- ## Keyboard Shortcuts
269
-
270
- ### Default Shortcuts
271
-
272
- - **Escape**: Close window
273
- - **Ctrl+Shift+F**: Focus window
274
-
275
- ### Customizing Shortcuts
276
-
277
- Define custom shortcuts using the `shortcuts` prop. Shortcuts support modifiers:
278
-
279
- - `Ctrl` / `Control`
280
- - `Shift`
281
- - `Alt`
282
- - `Meta` (Command on Mac)
283
-
284
- **Format Examples:**
285
-
286
- ```javascript
287
- shortcuts={{
288
- close: 'Escape',
289
- focus: 'Ctrl+Shift+F',
290
- minimize: 'Ctrl+M',
291
- maximize: 'Ctrl+Shift+M',
292
- save: 'Ctrl+S',
293
- custom: 'Alt+K'
294
- }}
295
- ```
296
-
297
- ## How It Works
298
-
299
- ### Style Inheritance
300
-
301
- When `copyStyles={true}` (default):
302
-
303
- 1. **Instant Background**: Critical inline styles are applied immediately, inheriting the parent window's background color and text color
304
- 2. **No White Flash**: The window opens with proper styling from the start
305
- 3. **Async Loading**: Full stylesheets are copied asynchronously for smooth rendering
306
- 4. **Complete Coverage**: All parent window styles are copied:
307
- - Ant Design themes
308
- - SCSS/CSS modules
309
- - Custom fonts
310
- - External stylesheets
311
- - Inline styles
312
-
313
- ### Window Lifecycle
314
-
315
- 1. Window opens with specified dimensions and position
316
- 2. Critical styles applied instantly (background, colors, layout)
317
- 3. Full styles copied from parent window
318
- 4. Content rendered via React Portal
319
- 5. Event listeners attached (keyboard shortcuts, window close)
320
- 6. Automatic cleanup on component unmount
321
-
322
- ### Performance Optimizations
323
-
324
- - **Single Window Creation**: Window is created once and reused throughout component lifecycle
325
- - **Async Style Loading**: Styles are copied using `requestAnimationFrame` to avoid blocking
326
- - **Stable References**: Uses `useCallback` and `useMemo` to prevent unnecessary re-renders
327
- - **Efficient Cleanup**: Proper event listener removal and window closure
328
-
329
- ## Best Practices
330
-
331
- ### ✅ Do's
332
-
333
- ```jsx
334
- // Use useCallback for all callbacks
335
- const handleClose = useCallback(() => setShowWindow(false), []);
336
- const handleMinimize = useCallback(() => console.log('Min'), []);
337
-
338
- // Center important windows
339
- <ExternalWindow centerScreen="both" ... />
340
-
341
- // Provide meaningful titles
342
- <ExternalWindow title="Sales Report - Q4 2024" ... />
343
-
344
- // Use appropriate dimensions
345
- <ExternalWindow width={1200} height={800} ... />
346
- ```
347
-
348
- ### ❌ Don'ts
349
-
350
- ```jsx
351
- // Don't use inline functions - causes re-renders
352
- <ExternalWindow onClose={() => setShowWindow(false)} ... />
353
-
354
- // Don't forget to handle window state
355
- {showWindow && <ExternalWindow ... />}
356
-
357
- // Don't use tiny dimensions
358
- <ExternalWindow width={100} height={100} ... />
359
-
360
- // Don't disable style copying without reason
361
- <ExternalWindow copyStyles={false} ... />
362
- ```
363
-
364
- ## Advanced Patterns
365
-
366
- ### Window with Tabs
367
-
368
- ```jsx
369
- function TabbedWindow() {
370
- const [showWindow, setShowWindow] = useState(false);
371
- const [activeTab, setActiveTab] = useState('1');
372
-
373
- const handleClose = useCallback(() => setShowWindow(false), []);
374
-
375
- return (
376
- <>
377
- <Button onClick={() => setShowWindow(true)}>Open</Button>
378
-
379
- {showWindow && (
380
- <ExternalWindow title="Multi-Tab Window" width={1000} height={700} centerScreen="both" onClose={handleClose}>
381
- <Tabs activeKey={activeTab} onChange={setActiveTab}>
382
- <TabPane tab="Dashboard" key="1">
383
- <Dashboard />
384
- </TabPane>
385
- <TabPane tab="Settings" key="2">
386
- <Settings />
387
- </TabPane>
388
- <TabPane tab="Reports" key="3">
389
- <Reports />
390
- </TabPane>
391
- </Tabs>
392
- </ExternalWindow>
393
- )}
394
- </>
395
- );
396
- }
397
- ```
398
-
399
- ### Window with Form Submission
400
-
401
- ```jsx
402
- function FormWindow() {
403
- const [showWindow, setShowWindow] = useState(false);
404
-
405
- const handleClose = useCallback(() => setShowWindow(false), []);
406
-
407
- const handleSubmit = useCallback((values) => {
408
- console.log('Form submitted:', values);
409
- setShowWindow(false);
410
- }, []);
411
-
412
- return (
413
- <>
414
- <Button onClick={() => setShowWindow(true)}>Open Form</Button>
415
-
416
- {showWindow && (
417
- <ExternalWindow title="User Form" width={600} height={500} centerScreen="both" onClose={handleClose}>
418
- <Form onFinish={handleSubmit} style={{ padding: 20 }}>
419
- <Form.Item name="name" label="Name">
420
- <Input />
421
- </Form.Item>
422
- <Form.Item>
423
- <Button type="primary" htmlType="submit">
424
- Submit
425
- </Button>
426
- </Form.Item>
427
- </Form>
428
- </ExternalWindow>
429
- )}
430
- </>
431
- );
432
- }
433
- ```
434
-
435
- ## Browser Compatibility
436
-
437
- | Browser | Support | Notes |
438
- | ------------- | ---------- | -------------------------------- |
439
- | Chrome/Edge | ✅ Full | Recommended |
440
- | Firefox | ✅ Full | All features work |
441
- | Safari | ✅ Full | All features work |
442
- | Mobile Safari | ⚠️ Limited | Popup windows not well supported |
443
- | Mobile Chrome | ⚠️ Limited | Popup windows not well supported |
444
-
445
- **Note**: Mobile browsers have limited support for popup windows due to platform restrictions.
446
-
447
- ## Troubleshooting
448
-
449
- ### Issue: Window flickering or re-rendering constantly
450
-
451
- **Symptoms:**
452
-
453
- - Window content flickers
454
- - Continuous re-renders
455
- - Poor performance
456
-
457
- **Cause:** The `onClose` callback is not memoized, creating a new function reference on every render.
458
-
459
- **Solution:**
460
-
461
- ```jsx
462
- // ❌ Wrong - creates new function every render
463
- <ExternalWindow onClose={() => setShowWindow(false)}>
464
-
465
- // ✅ Correct - stable function reference
466
- const handleClose = useCallback(() => setShowWindow(false), []);
467
- <ExternalWindow onClose={handleClose}>
468
- ```
469
-
470
- ---
471
-
472
- ### Issue: Window not opening / "Please allow popups" message
473
-
474
- **Symptoms:**
475
-
476
- - Error message appears
477
- - Window doesn't open
478
- - `window.open()` returns `null`
479
-
480
- **Cause:** Browser popup blocker is active.
481
-
482
- **Solution:**
483
-
484
- 1. Click the popup blocker icon in the browser's address bar
485
- 2. Allow popups for your site
486
- 3. Refresh the page and try again
487
-
488
- **Prevention:** Always trigger `ExternalWindow` from a user action (click, keyboard event), not automatically on page load.
489
-
490
- ---
491
-
492
- ### Issue: Styles not appearing correctly
493
-
494
- **Symptoms:**
495
-
496
- - Missing Ant Design styles
497
- - SCSS not applied
498
- - Different appearance from parent window
499
-
500
- **Cause:**
501
-
502
- - `copyStyles={false}` is set
503
- - Cross-origin stylesheet restrictions (CORS)
504
- - Styles loaded after component initialization
505
-
506
- **Solution:**
507
-
508
- ```jsx
509
- // Ensure copyStyles is true (default)
510
- <ExternalWindow copyStyles={true} ... />
511
-
512
- // Check browser console for CORS warnings
513
- // Allow time for async style loading
514
- ```
515
-
516
- ---
517
-
518
- ### Issue: White flash when opening window
519
-
520
- **Status:** ✅ **Fixed in current version**
521
-
522
- The component now includes critical inline styles that apply immediately, inheriting the parent window's background color. Full styles load asynchronously without blocking.
523
-
524
- If you still see a white flash:
525
-
526
- - Ensure you're using the latest version of the component
527
- - Check that `copyStyles={true}` (default)
528
- - Verify your parent window has a defined background color
529
-
530
- ---
531
-
532
- ### Issue: Unexpected body spacing or margins
533
-
534
- **Symptoms:**
535
-
536
- - Unwanted whitespace around content
537
- - Incorrect layout
538
- - Content not filling window
539
-
540
- **Cause:** Browser default styles or inherited styles.
541
-
542
- **Solution:** The component applies aggressive CSS resets:
543
-
544
- ```css
545
- html,
546
- body {
547
- margin: 0 !important;
548
- padding: 0 !important;
549
- width: 100%;
550
- height: 100%;
551
- }
552
- ```
553
-
554
- If you need custom body styles, apply them to your content wrapper:
555
-
556
- ```jsx
557
- <ExternalWindow ...>
558
- <div style={{ padding: 20, background: '#f0f0f0' }}>
559
- Your content here
560
- </div>
561
- </ExternalWindow>
562
- ```
563
-
564
- ---
565
-
566
- ### Issue: Keyboard shortcuts not working
567
-
568
- **Symptoms:**
569
-
570
- - Pressing shortcut keys doesn't trigger actions
571
- - Only works in parent window
572
-
573
- **Cause:**
574
-
575
- - Window doesn't have focus
576
- - Shortcut conflicts with browser defaults
577
- - Incorrect shortcut format
578
-
579
- **Solution:**
580
-
581
- ```jsx
582
- // Correct format
583
- shortcuts={{
584
- close: 'Escape',
585
- focus: 'Ctrl+Shift+F', // Not 'Control+Shift+F'
586
- save: 'Ctrl+S'
587
- }}
588
-
589
- // Use focus shortcut to bring window to front
590
- // Avoid browser shortcuts (Ctrl+T, Ctrl+W, etc.)
591
- ```
592
-
593
- ---
594
-
595
- ### Issue: Multiple windows interfere with each other
596
-
597
- **Symptoms:**
598
-
599
- - Opening one window closes another
600
- - State conflicts between windows
601
-
602
- **Cause:** Poor state management or shared state keys.
603
-
604
- **Solution:**
605
-
606
- ```jsx
607
- // Use unique keys and separate state
608
- const [windows, setWindows] = useState({});
609
-
610
- const openWindow = (id) => {
611
- setWindows((prev) => ({ ...prev, [id]: true }));
612
- };
613
-
614
- const closeWindow = (id) => {
615
- setWindows((prev) => {
616
- const updated = { ...prev };
617
- delete updated[id];
618
- return updated;
619
- });
620
- };
621
- ```
622
-
623
- ---
624
-
625
- ### Issue: Content not updating in external window
626
-
627
- **Symptoms:**
628
-
629
- - Changes in parent don't reflect in child window
630
- - Stale data displayed
631
-
632
- **Cause:** React Portal works correctly, but state might not be lifting properly.
633
-
634
- **Solution:** React Portal automatically syncs state. Ensure your state is at the correct level:
635
-
636
- ```jsx
637
- // State should be in parent component
638
- const [data, setData] = useState([]);
639
-
640
- <ExternalWindow ...>
641
- <DataDisplay data={data} onChange={setData} />
642
- </ExternalWindow>
643
- ```
644
-
645
- ---
646
-
647
- ### Issue: Window closes unexpectedly
648
-
649
- **Symptoms:**
650
-
651
- - Window closes on its own
652
- - Window closes when clicking parent
653
-
654
- **Cause:**
655
-
656
- - User closed the window (triggers `onClose`)
657
- - Parent component unmounted
658
- - State management issue
659
-
660
- **Solution:** This is expected behavior. The `onClose` callback is triggered when:
661
-
662
- - User clicks the window's close button
663
- - User presses the close keyboard shortcut
664
- - Component unmounts
665
- - Parent explicitly calls the close handler
666
-
667
- ---
668
-
669
- ### Issue: Cross-origin stylesheet warnings in console
670
-
671
- **Symptoms:**
672
-
673
- - Console warnings: "Could not copy stylesheet"
674
- - Some styles missing
675
-
676
- **Cause:** CORS restrictions prevent accessing external stylesheet rules.
677
-
678
- **Solution:** This is expected and usually not a problem:
679
-
680
- - External stylesheets (CDNs) are copied by `<link>` reference
681
- - Only inline style rules require CORS access
682
- - Most styles will still work correctly
683
-
684
- To debug:
685
-
686
- ```javascript
687
- // The component logs warnings for debugging
688
- console.warn('Could not copy stylesheet:', e);
689
- ```
690
-
691
- ---
692
-
693
- ## Getting Help
694
-
695
- If you encounter issues not covered here:
696
-
697
- 1. Check the browser console for errors
698
- 2. Verify all props are correctly typed
699
- 3. Ensure `useCallback` is used for callbacks
700
- 4. Test in a different browser
701
- 5. Check for popup blocker settings
702
-
703
- ## License
704
-
705
- MIT
1
+ # ExternalWindow Component
2
+
3
+ A React component that renders content in a separate browser window with full style inheritance and keyboard shortcuts support.
4
+
5
+ ## Features
6
+
7
+ - 🪟 Opens content in a new browser window
8
+ - 🎨 Automatically copies parent window styles (Ant Design, SCSS, etc.)
9
+ - ⚨️ Customizable keyboard shortcuts
10
+ - 📍 Flexible positioning (manual or auto-center)
11
+ - 🔄 React Portal-based rendering
12
+ - ⚡ No white flash - instant background color matching
13
+ - 🧹 Automatic cleanup on unmount
14
+
15
+ ## Quick Start
16
+
17
+ ```jsx
18
+ import { useState, useCallback } from 'react';
19
+ import { ExternalWindow } from './ExternalWindow';
20
+ import { Button } from 'antd';
21
+
22
+ function App() {
23
+ const [showWindow, setShowWindow] = useState(false);
24
+
25
+ // Use useCallback to prevent re-renders
26
+ const handleClose = useCallback(() => {
27
+ setShowWindow(false);
28
+ }, []);
29
+
30
+ return (
31
+ <>
32
+ <Button onClick={() => setShowWindow(true)}>Open New Window</Button>
33
+
34
+ {showWindow && (
35
+ <ExternalWindow title="My External Window" onClose={handleClose}>
36
+ <div style={{ padding: 20 }}>
37
+ <h1>Hello from external window!</h1>
38
+ <p>All your styles are automatically copied here.</p>
39
+ </div>
40
+ </ExternalWindow>
41
+ )}
42
+ </>
43
+ );
44
+ }
45
+ ```
46
+
47
+ ## Props Reference
48
+
49
+ ### Props
50
+
51
+ | Prop | Type | Default | Description |
52
+ | -------------- | --------------- | -------------------------------------------- | ----------------------------------------------------------------- |
53
+ | `children` | `ReactNode` | **required** | Content to render in the new window |
54
+ | `onClose` | `Function` | **required** | Callback when window closes (wrap in `useCallback`) |
55
+ | `title` | `string` | `'New Window'` | Window title (shown in browser tab) |
56
+ | `width` | `number` | `600` | Window width in pixels |
57
+ | `height` | `number` | `400` | Window height in pixels |
58
+ | `left` | `number` | `200` | Window X position (overridden by `centerScreen`) |
59
+ | `top` | `number` | `200` | Window Y position (overridden by `centerScreen`) |
60
+ | `copyStyles` | `boolean` | `true` | Whether to copy parent window styles |
61
+ | `centerScreen` | `string\|false` | `false` | Center window: `'horizontal'`, `'vertical'`, `'both'`, or `false` |
62
+ | `shortcuts` | `Object` | `{ close: 'Escape', focus: 'Ctrl+Shift+F' }` | Keyboard shortcuts configuration |
63
+ | `onMinimize` | `Function` | `undefined` | Callback when window is minimized |
64
+ | `onMaximize` | `Function` | `undefined` | Callback when window is maximized |
65
+
66
+ ## Usage Examples
67
+
68
+ ### Centered Window
69
+
70
+ ```jsx
71
+ import { useState, useCallback } from 'react';
72
+
73
+ function App() {
74
+ const [showWindow, setShowWindow] = useState(false);
75
+
76
+ const handleClose = useCallback(() => {
77
+ setShowWindow(false);
78
+ }, []);
79
+
80
+ return (
81
+ <>
82
+ <Button onClick={() => setShowWindow(true)}>Open Centered</Button>
83
+
84
+ {showWindow && (
85
+ <ExternalWindow title="Centered Window" width={800} height={600} centerScreen="both" onClose={handleClose}>
86
+ <YourContent />
87
+ </ExternalWindow>
88
+ )}
89
+ </>
90
+ );
91
+ }
92
+ ```
93
+
94
+ ### Custom Positioning
95
+
96
+ ```jsx
97
+ const handleClose = useCallback(() => setShowWindow(false), []);
98
+
99
+ <ExternalWindow title="Custom Position" width={1000} height={700} left={100} top={50} onClose={handleClose}>
100
+ <YourContent />
101
+ </ExternalWindow>;
102
+ ```
103
+
104
+ ### With Custom Keyboard Shortcuts
105
+
106
+ ```jsx
107
+ const handleClose = useCallback(() => setShowWindow(false), []);
108
+ const handleMinimize = useCallback(() => console.log('Minimized'), []);
109
+ const handleMaximize = useCallback(() => console.log('Maximized'), []);
110
+
111
+ <ExternalWindow
112
+ title="With Shortcuts"
113
+ shortcuts={{
114
+ close: 'Escape', // Close window
115
+ focus: 'Ctrl+Shift+F', // Focus window
116
+ minimize: 'Ctrl+M', // Minimize window
117
+ maximize: 'Ctrl+Shift+M', // Maximize window
118
+ }}
119
+ onClose={handleClose}
120
+ onMinimize={handleMinimize}
121
+ onMaximize={handleMaximize}
122
+ >
123
+ <YourContent />
124
+ </ExternalWindow>;
125
+ ```
126
+
127
+ ### Without Style Copying
128
+
129
+ ```jsx
130
+ const handleClose = useCallback(() => setShowWindow(false), []);
131
+
132
+ <ExternalWindow title="No Styles" copyStyles={false} onClose={handleClose}>
133
+ {/* You'll need to add inline styles or external CSS links */}
134
+ <div style={{ padding: 20, fontFamily: 'Arial' }}>
135
+ <h1>Plain content</h1>
136
+ </div>
137
+ </ExternalWindow>;
138
+ ```
139
+
140
+ ### Managing Multiple Windows
141
+
142
+ ```jsx
143
+ function MultiWindowApp() {
144
+ const [windows, setWindows] = useState([]);
145
+
146
+ const openWindow = useCallback((config) => {
147
+ const id = Date.now();
148
+ setWindows((prev) => [...prev, { id, ...config }]);
149
+ }, []);
150
+
151
+ const closeWindow = useCallback((id) => {
152
+ setWindows((prev) => prev.filter((w) => w.id !== id));
153
+ }, []);
154
+
155
+ return (
156
+ <>
157
+ <Button
158
+ onClick={() =>
159
+ openWindow({
160
+ title: 'Window ' + (windows.length + 1),
161
+ content: <MyComponent />,
162
+ })
163
+ }
164
+ >
165
+ Add Window
166
+ </Button>
167
+
168
+ {windows.map(({ id, title, content }) => (
169
+ <ExternalWindow key={id} title={title} onClose={() => closeWindow(id)}>
170
+ {content}
171
+ </ExternalWindow>
172
+ ))}
173
+ </>
174
+ );
175
+ }
176
+ ```
177
+
178
+ ### Full-Featured Dashboard Example
179
+
180
+ ```jsx
181
+ import { useState, useCallback } from 'react';
182
+ import { ExternalWindow } from './ExternalWindow';
183
+ import { Button, Card, Space } from 'antd';
184
+
185
+ function Dashboard() {
186
+ const [windows, setWindows] = useState({
187
+ chart: false,
188
+ report: false,
189
+ settings: false,
190
+ });
191
+
192
+ const openWindow = useCallback((name) => {
193
+ setWindows((prev) => ({ ...prev, [name]: true }));
194
+ }, []);
195
+
196
+ const closeWindow = useCallback((name) => {
197
+ setWindows((prev) => ({ ...prev, [name]: false }));
198
+ }, []);
199
+
200
+ return (
201
+ <div style={{ padding: 24 }}>
202
+ <Space>
203
+ <Button onClick={() => openWindow('chart')}>Open Chart</Button>
204
+ <Button onClick={() => openWindow('report')}>Open Report</Button>
205
+ <Button onClick={() => openWindow('settings')}>Open Settings</Button>
206
+ </Space>
207
+
208
+ {windows.chart && (
209
+ <ExternalWindow title="Analytics Chart" width={1200} height={800} centerScreen="both" onClose={() => closeWindow('chart')}>
210
+ <Card title="Sales Analytics" style={{ margin: 20 }}>
211
+ {/* Your chart component */}
212
+ </Card>
213
+ </ExternalWindow>
214
+ )}
215
+
216
+ {windows.report && (
217
+ <ExternalWindow title="Monthly Report" width={900} height={700} left={50} top={50} onClose={() => closeWindow('report')}>
218
+ <div style={{ padding: 20 }}>{/* Your report component */}</div>
219
+ </ExternalWindow>
220
+ )}
221
+
222
+ {windows.settings && (
223
+ <ExternalWindow
224
+ title="Settings"
225
+ width={600}
226
+ height={500}
227
+ centerScreen="horizontal"
228
+ shortcuts={{
229
+ close: 'Escape',
230
+ focus: 'Ctrl+S',
231
+ }}
232
+ onClose={() => closeWindow('settings')}
233
+ >
234
+ <div style={{ padding: 20 }}>{/* Your settings component */}</div>
235
+ </ExternalWindow>
236
+ )}
237
+ </div>
238
+ );
239
+ }
240
+ ```
241
+
242
+ ### With Shared State
243
+
244
+ ```jsx
245
+ function StatefulWindow() {
246
+ const [showWindow, setShowWindow] = useState(false);
247
+ const [data, setData] = useState([]);
248
+
249
+ const handleClose = useCallback(() => {
250
+ setShowWindow(false);
251
+ }, []);
252
+
253
+ return (
254
+ <>
255
+ <Button onClick={() => setShowWindow(true)}>Open Data Viewer</Button>
256
+
257
+ {showWindow && (
258
+ <ExternalWindow title="Data Viewer" onClose={handleClose}>
259
+ {/* State is shared between parent and child window */}
260
+ <DataTable data={data} onUpdate={setData} />
261
+ </ExternalWindow>
262
+ )}
263
+ </>
264
+ );
265
+ }
266
+ ```
267
+
268
+ ## Keyboard Shortcuts
269
+
270
+ ### Default Shortcuts
271
+
272
+ - **Escape**: Close window
273
+ - **Ctrl+Shift+F**: Focus window
274
+
275
+ ### Customizing Shortcuts
276
+
277
+ Define custom shortcuts using the `shortcuts` prop. Shortcuts support modifiers:
278
+
279
+ - `Ctrl` / `Control`
280
+ - `Shift`
281
+ - `Alt`
282
+ - `Meta` (Command on Mac)
283
+
284
+ **Format Examples:**
285
+
286
+ ```javascript
287
+ shortcuts={{
288
+ close: 'Escape',
289
+ focus: 'Ctrl+Shift+F',
290
+ minimize: 'Ctrl+M',
291
+ maximize: 'Ctrl+Shift+M',
292
+ save: 'Ctrl+S',
293
+ custom: 'Alt+K'
294
+ }}
295
+ ```
296
+
297
+ ## How It Works
298
+
299
+ ### Style Inheritance
300
+
301
+ When `copyStyles={true}` (default):
302
+
303
+ 1. **Instant Background**: Critical inline styles are applied immediately, inheriting the parent window's background color and text color
304
+ 2. **No White Flash**: The window opens with proper styling from the start
305
+ 3. **Async Loading**: Full stylesheets are copied asynchronously for smooth rendering
306
+ 4. **Complete Coverage**: All parent window styles are copied:
307
+ - Ant Design themes
308
+ - SCSS/CSS modules
309
+ - Custom fonts
310
+ - External stylesheets
311
+ - Inline styles
312
+
313
+ ### Window Lifecycle
314
+
315
+ 1. Window opens with specified dimensions and position
316
+ 2. Critical styles applied instantly (background, colors, layout)
317
+ 3. Full styles copied from parent window
318
+ 4. Content rendered via React Portal
319
+ 5. Event listeners attached (keyboard shortcuts, window close)
320
+ 6. Automatic cleanup on component unmount
321
+
322
+ ### Performance Optimizations
323
+
324
+ - **Single Window Creation**: Window is created once and reused throughout component lifecycle
325
+ - **Async Style Loading**: Styles are copied using `requestAnimationFrame` to avoid blocking
326
+ - **Stable References**: Uses `useCallback` and `useMemo` to prevent unnecessary re-renders
327
+ - **Efficient Cleanup**: Proper event listener removal and window closure
328
+
329
+ ## Best Practices
330
+
331
+ ### ✅ Do's
332
+
333
+ ```jsx
334
+ // Use useCallback for all callbacks
335
+ const handleClose = useCallback(() => setShowWindow(false), []);
336
+ const handleMinimize = useCallback(() => console.log('Min'), []);
337
+
338
+ // Center important windows
339
+ <ExternalWindow centerScreen="both" ... />
340
+
341
+ // Provide meaningful titles
342
+ <ExternalWindow title="Sales Report - Q4 2024" ... />
343
+
344
+ // Use appropriate dimensions
345
+ <ExternalWindow width={1200} height={800} ... />
346
+ ```
347
+
348
+ ### ❌ Don'ts
349
+
350
+ ```jsx
351
+ // Don't use inline functions - causes re-renders
352
+ <ExternalWindow onClose={() => setShowWindow(false)} ... />
353
+
354
+ // Don't forget to handle window state
355
+ {showWindow && <ExternalWindow ... />}
356
+
357
+ // Don't use tiny dimensions
358
+ <ExternalWindow width={100} height={100} ... />
359
+
360
+ // Don't disable style copying without reason
361
+ <ExternalWindow copyStyles={false} ... />
362
+ ```
363
+
364
+ ## Advanced Patterns
365
+
366
+ ### Window with Tabs
367
+
368
+ ```jsx
369
+ function TabbedWindow() {
370
+ const [showWindow, setShowWindow] = useState(false);
371
+ const [activeTab, setActiveTab] = useState('1');
372
+
373
+ const handleClose = useCallback(() => setShowWindow(false), []);
374
+
375
+ return (
376
+ <>
377
+ <Button onClick={() => setShowWindow(true)}>Open</Button>
378
+
379
+ {showWindow && (
380
+ <ExternalWindow title="Multi-Tab Window" width={1000} height={700} centerScreen="both" onClose={handleClose}>
381
+ <Tabs activeKey={activeTab} onChange={setActiveTab}>
382
+ <TabPane tab="Dashboard" key="1">
383
+ <Dashboard />
384
+ </TabPane>
385
+ <TabPane tab="Settings" key="2">
386
+ <Settings />
387
+ </TabPane>
388
+ <TabPane tab="Reports" key="3">
389
+ <Reports />
390
+ </TabPane>
391
+ </Tabs>
392
+ </ExternalWindow>
393
+ )}
394
+ </>
395
+ );
396
+ }
397
+ ```
398
+
399
+ ### Window with Form Submission
400
+
401
+ ```jsx
402
+ function FormWindow() {
403
+ const [showWindow, setShowWindow] = useState(false);
404
+
405
+ const handleClose = useCallback(() => setShowWindow(false), []);
406
+
407
+ const handleSubmit = useCallback((values) => {
408
+ console.log('Form submitted:', values);
409
+ setShowWindow(false);
410
+ }, []);
411
+
412
+ return (
413
+ <>
414
+ <Button onClick={() => setShowWindow(true)}>Open Form</Button>
415
+
416
+ {showWindow && (
417
+ <ExternalWindow title="User Form" width={600} height={500} centerScreen="both" onClose={handleClose}>
418
+ <Form onFinish={handleSubmit} style={{ padding: 20 }}>
419
+ <Form.Item name="name" label="Name">
420
+ <Input />
421
+ </Form.Item>
422
+ <Form.Item>
423
+ <Button type="primary" htmlType="submit">
424
+ Submit
425
+ </Button>
426
+ </Form.Item>
427
+ </Form>
428
+ </ExternalWindow>
429
+ )}
430
+ </>
431
+ );
432
+ }
433
+ ```
434
+
435
+ ## Browser Compatibility
436
+
437
+ | Browser | Support | Notes |
438
+ | ------------- | ---------- | -------------------------------- |
439
+ | Chrome/Edge | ✅ Full | Recommended |
440
+ | Firefox | ✅ Full | All features work |
441
+ | Safari | ✅ Full | All features work |
442
+ | Mobile Safari | ⚠️ Limited | Popup windows not well supported |
443
+ | Mobile Chrome | ⚠️ Limited | Popup windows not well supported |
444
+
445
+ **Note**: Mobile browsers have limited support for popup windows due to platform restrictions.
446
+
447
+ ## Troubleshooting
448
+
449
+ ### Issue: Window flickering or re-rendering constantly
450
+
451
+ **Symptoms:**
452
+
453
+ - Window content flickers
454
+ - Continuous re-renders
455
+ - Poor performance
456
+
457
+ **Cause:** The `onClose` callback is not memoized, creating a new function reference on every render.
458
+
459
+ **Solution:**
460
+
461
+ ```jsx
462
+ // ❌ Wrong - creates new function every render
463
+ <ExternalWindow onClose={() => setShowWindow(false)}>
464
+
465
+ // ✅ Correct - stable function reference
466
+ const handleClose = useCallback(() => setShowWindow(false), []);
467
+ <ExternalWindow onClose={handleClose}>
468
+ ```
469
+
470
+ ---
471
+
472
+ ### Issue: Window not opening / "Please allow popups" message
473
+
474
+ **Symptoms:**
475
+
476
+ - Error message appears
477
+ - Window doesn't open
478
+ - `window.open()` returns `null`
479
+
480
+ **Cause:** Browser popup blocker is active.
481
+
482
+ **Solution:**
483
+
484
+ 1. Click the popup blocker icon in the browser's address bar
485
+ 2. Allow popups for your site
486
+ 3. Refresh the page and try again
487
+
488
+ **Prevention:** Always trigger `ExternalWindow` from a user action (click, keyboard event), not automatically on page load.
489
+
490
+ ---
491
+
492
+ ### Issue: Styles not appearing correctly
493
+
494
+ **Symptoms:**
495
+
496
+ - Missing Ant Design styles
497
+ - SCSS not applied
498
+ - Different appearance from parent window
499
+
500
+ **Cause:**
501
+
502
+ - `copyStyles={false}` is set
503
+ - Cross-origin stylesheet restrictions (CORS)
504
+ - Styles loaded after component initialization
505
+
506
+ **Solution:**
507
+
508
+ ```jsx
509
+ // Ensure copyStyles is true (default)
510
+ <ExternalWindow copyStyles={true} ... />
511
+
512
+ // Check browser console for CORS warnings
513
+ // Allow time for async style loading
514
+ ```
515
+
516
+ ---
517
+
518
+ ### Issue: White flash when opening window
519
+
520
+ **Status:** ✅ **Fixed in current version**
521
+
522
+ The component now includes critical inline styles that apply immediately, inheriting the parent window's background color. Full styles load asynchronously without blocking.
523
+
524
+ If you still see a white flash:
525
+
526
+ - Ensure you're using the latest version of the component
527
+ - Check that `copyStyles={true}` (default)
528
+ - Verify your parent window has a defined background color
529
+
530
+ ---
531
+
532
+ ### Issue: Unexpected body spacing or margins
533
+
534
+ **Symptoms:**
535
+
536
+ - Unwanted whitespace around content
537
+ - Incorrect layout
538
+ - Content not filling window
539
+
540
+ **Cause:** Browser default styles or inherited styles.
541
+
542
+ **Solution:** The component applies aggressive CSS resets:
543
+
544
+ ```css
545
+ html,
546
+ body {
547
+ margin: 0 !important;
548
+ padding: 0 !important;
549
+ width: 100%;
550
+ height: 100%;
551
+ }
552
+ ```
553
+
554
+ If you need custom body styles, apply them to your content wrapper:
555
+
556
+ ```jsx
557
+ <ExternalWindow ...>
558
+ <div style={{ padding: 20, background: '#f0f0f0' }}>
559
+ Your content here
560
+ </div>
561
+ </ExternalWindow>
562
+ ```
563
+
564
+ ---
565
+
566
+ ### Issue: Keyboard shortcuts not working
567
+
568
+ **Symptoms:**
569
+
570
+ - Pressing shortcut keys doesn't trigger actions
571
+ - Only works in parent window
572
+
573
+ **Cause:**
574
+
575
+ - Window doesn't have focus
576
+ - Shortcut conflicts with browser defaults
577
+ - Incorrect shortcut format
578
+
579
+ **Solution:**
580
+
581
+ ```jsx
582
+ // Correct format
583
+ shortcuts={{
584
+ close: 'Escape',
585
+ focus: 'Ctrl+Shift+F', // Not 'Control+Shift+F'
586
+ save: 'Ctrl+S'
587
+ }}
588
+
589
+ // Use focus shortcut to bring window to front
590
+ // Avoid browser shortcuts (Ctrl+T, Ctrl+W, etc.)
591
+ ```
592
+
593
+ ---
594
+
595
+ ### Issue: Multiple windows interfere with each other
596
+
597
+ **Symptoms:**
598
+
599
+ - Opening one window closes another
600
+ - State conflicts between windows
601
+
602
+ **Cause:** Poor state management or shared state keys.
603
+
604
+ **Solution:**
605
+
606
+ ```jsx
607
+ // Use unique keys and separate state
608
+ const [windows, setWindows] = useState({});
609
+
610
+ const openWindow = (id) => {
611
+ setWindows((prev) => ({ ...prev, [id]: true }));
612
+ };
613
+
614
+ const closeWindow = (id) => {
615
+ setWindows((prev) => {
616
+ const updated = { ...prev };
617
+ delete updated[id];
618
+ return updated;
619
+ });
620
+ };
621
+ ```
622
+
623
+ ---
624
+
625
+ ### Issue: Content not updating in external window
626
+
627
+ **Symptoms:**
628
+
629
+ - Changes in parent don't reflect in child window
630
+ - Stale data displayed
631
+
632
+ **Cause:** React Portal works correctly, but state might not be lifting properly.
633
+
634
+ **Solution:** React Portal automatically syncs state. Ensure your state is at the correct level:
635
+
636
+ ```jsx
637
+ // State should be in parent component
638
+ const [data, setData] = useState([]);
639
+
640
+ <ExternalWindow ...>
641
+ <DataDisplay data={data} onChange={setData} />
642
+ </ExternalWindow>
643
+ ```
644
+
645
+ ---
646
+
647
+ ### Issue: Window closes unexpectedly
648
+
649
+ **Symptoms:**
650
+
651
+ - Window closes on its own
652
+ - Window closes when clicking parent
653
+
654
+ **Cause:**
655
+
656
+ - User closed the window (triggers `onClose`)
657
+ - Parent component unmounted
658
+ - State management issue
659
+
660
+ **Solution:** This is expected behavior. The `onClose` callback is triggered when:
661
+
662
+ - User clicks the window's close button
663
+ - User presses the close keyboard shortcut
664
+ - Component unmounts
665
+ - Parent explicitly calls the close handler
666
+
667
+ ---
668
+
669
+ ### Issue: Cross-origin stylesheet warnings in console
670
+
671
+ **Symptoms:**
672
+
673
+ - Console warnings: "Could not copy stylesheet"
674
+ - Some styles missing
675
+
676
+ **Cause:** CORS restrictions prevent accessing external stylesheet rules.
677
+
678
+ **Solution:** This is expected and usually not a problem:
679
+
680
+ - External stylesheets (CDNs) are copied by `<link>` reference
681
+ - Only inline style rules require CORS access
682
+ - Most styles will still work correctly
683
+
684
+ To debug:
685
+
686
+ ```javascript
687
+ // The component logs warnings for debugging
688
+ console.warn('Could not copy stylesheet:', e);
689
+ ```
690
+
691
+ ---
692
+
693
+ ## Getting Help
694
+
695
+ If you encounter issues not covered here:
696
+
697
+ 1. Check the browser console for errors
698
+ 2. Verify all props are correctly typed
699
+ 3. Ensure `useCallback` is used for callbacks
700
+ 4. Test in a different browser
701
+ 5. Check for popup blocker settings
702
+
703
+ ## License
704
+
705
+ MIT