@jmruthers/pace-core 0.2.4

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 (1009) hide show
  1. package/CHANGELOG.md +202 -0
  2. package/README.md +299 -0
  3. package/dist/DataTable-BHlzyKZP.d.ts +116 -0
  4. package/dist/DataTable-GEY5U7OI.js +100 -0
  5. package/dist/DataTable-GEY5U7OI.js.map +1 -0
  6. package/dist/PublicLoadingSpinner-DztrzuJr.d.ts +3430 -0
  7. package/dist/UnifiedAuthProvider-w66zSCUf.d.ts +160 -0
  8. package/dist/api-GZHIDA4X.js +41 -0
  9. package/dist/api-GZHIDA4X.js.map +1 -0
  10. package/dist/appConfig-BVGyuvI7.d.ts +71 -0
  11. package/dist/appNameResolver-7GHF5ED2.js +22 -0
  12. package/dist/appNameResolver-7GHF5ED2.js.map +1 -0
  13. package/dist/audit-BUW3LMJB.js +16 -0
  14. package/dist/audit-BUW3LMJB.js.map +1 -0
  15. package/dist/chunk-22KLBHPS.js +29 -0
  16. package/dist/chunk-22KLBHPS.js.map +1 -0
  17. package/dist/chunk-24MKLB7U.js +81 -0
  18. package/dist/chunk-24MKLB7U.js.map +1 -0
  19. package/dist/chunk-2MKP6IYD.js +388 -0
  20. package/dist/chunk-2MKP6IYD.js.map +1 -0
  21. package/dist/chunk-2V3Y6YBC.js +114 -0
  22. package/dist/chunk-2V3Y6YBC.js.map +1 -0
  23. package/dist/chunk-5CDJCTOO.js +190 -0
  24. package/dist/chunk-5CDJCTOO.js.map +1 -0
  25. package/dist/chunk-6ZQVSHKL.js +1345 -0
  26. package/dist/chunk-6ZQVSHKL.js.map +1 -0
  27. package/dist/chunk-74C6SNEC.js +77 -0
  28. package/dist/chunk-74C6SNEC.js.map +1 -0
  29. package/dist/chunk-7BNPOCLL.js +178 -0
  30. package/dist/chunk-7BNPOCLL.js.map +1 -0
  31. package/dist/chunk-7JL3T7BO.js +3344 -0
  32. package/dist/chunk-7JL3T7BO.js.map +1 -0
  33. package/dist/chunk-CDQ3PX7L.js +18 -0
  34. package/dist/chunk-CDQ3PX7L.js.map +1 -0
  35. package/dist/chunk-DY5E3AT7.js +1734 -0
  36. package/dist/chunk-DY5E3AT7.js.map +1 -0
  37. package/dist/chunk-ETEJVKYK.js +6032 -0
  38. package/dist/chunk-ETEJVKYK.js.map +1 -0
  39. package/dist/chunk-I5Z3QH5X.js +32 -0
  40. package/dist/chunk-I5Z3QH5X.js.map +1 -0
  41. package/dist/chunk-MZBUOP4P.js +119 -0
  42. package/dist/chunk-MZBUOP4P.js.map +1 -0
  43. package/dist/chunk-N2EUGZRW.js +98 -0
  44. package/dist/chunk-N2EUGZRW.js.map +1 -0
  45. package/dist/chunk-NQ4TOOO6.js +20 -0
  46. package/dist/chunk-NQ4TOOO6.js.map +1 -0
  47. package/dist/chunk-OHXGNT3K.js +21 -0
  48. package/dist/chunk-OHXGNT3K.js.map +1 -0
  49. package/dist/chunk-OKXMUYIB.js +522 -0
  50. package/dist/chunk-OKXMUYIB.js.map +1 -0
  51. package/dist/chunk-PFRRIDYA.js +382 -0
  52. package/dist/chunk-PFRRIDYA.js.map +1 -0
  53. package/dist/chunk-PLDDJCW6.js +49 -0
  54. package/dist/chunk-PLDDJCW6.js.map +1 -0
  55. package/dist/chunk-SS3E6QLB.js +695 -0
  56. package/dist/chunk-SS3E6QLB.js.map +1 -0
  57. package/dist/chunk-TMRLB2LA.js +326 -0
  58. package/dist/chunk-TMRLB2LA.js.map +1 -0
  59. package/dist/chunk-WYB6MBZA.js +5533 -0
  60. package/dist/chunk-WYB6MBZA.js.map +1 -0
  61. package/dist/chunk-YDJW5XTN.js +84 -0
  62. package/dist/chunk-YDJW5XTN.js.map +1 -0
  63. package/dist/components.d.ts +1308 -0
  64. package/dist/components.js +3759 -0
  65. package/dist/components.js.map +1 -0
  66. package/dist/database-C3Szpi5J.d.ts +470 -0
  67. package/dist/hooks.d.ts +449 -0
  68. package/dist/hooks.js +612 -0
  69. package/dist/hooks.js.map +1 -0
  70. package/dist/index.d.ts +385 -0
  71. package/dist/index.js +569 -0
  72. package/dist/index.js.map +1 -0
  73. package/dist/organisation-CO3Sh3_D.d.ts +99 -0
  74. package/dist/providers.d.ts +45 -0
  75. package/dist/providers.js +36 -0
  76. package/dist/providers.js.map +1 -0
  77. package/dist/rbac/eslint-rules.d.ts +52 -0
  78. package/dist/rbac/eslint-rules.js +252 -0
  79. package/dist/rbac/eslint-rules.js.map +1 -0
  80. package/dist/rbac/index.d.ts +1918 -0
  81. package/dist/rbac/index.js +2212 -0
  82. package/dist/rbac/index.js.map +1 -0
  83. package/dist/styles/core.css +401 -0
  84. package/dist/styles/fonts/georama-italic.woff2 +0 -0
  85. package/dist/styles/fonts/georama.woff2 +0 -0
  86. package/dist/styles/fonts/open-sans-italic.woff2 +0 -0
  87. package/dist/styles/fonts/open-sans.woff2 +0 -0
  88. package/dist/styles/fonts/reddit-mono.woff2 +0 -0
  89. package/dist/styles/index.d.ts +36 -0
  90. package/dist/styles/index.js +24 -0
  91. package/dist/styles/index.js.map +1 -0
  92. package/dist/theming/runtime.d.ts +73 -0
  93. package/dist/theming/runtime.js +16 -0
  94. package/dist/theming/runtime.js.map +1 -0
  95. package/dist/types-CInEi-ng.d.ts +316 -0
  96. package/dist/types.d.ts +196 -0
  97. package/dist/types.js +83 -0
  98. package/dist/types.js.map +1 -0
  99. package/dist/unified-CM7T0aTK.d.ts +198 -0
  100. package/dist/useComponentPerformance-DE9l5RkL.d.ts +11 -0
  101. package/dist/usePublicRouteParams-B6i0KtXW.d.ts +477 -0
  102. package/dist/utils.d.ts +639 -0
  103. package/dist/utils.js +1103 -0
  104. package/dist/utils.js.map +1 -0
  105. package/dist/validation-PM_iOaTI.d.ts +159 -0
  106. package/dist/validation.d.ts +138 -0
  107. package/dist/validation.js +477 -0
  108. package/dist/validation.js.map +1 -0
  109. package/docs/INDEX.md +192 -0
  110. package/docs/README.md +165 -0
  111. package/docs/api/.nojekyll +1 -0
  112. package/docs/api/README.md +301 -0
  113. package/docs/api/classes/ErrorBoundary.md +144 -0
  114. package/docs/api/classes/PublicErrorBoundary.md +132 -0
  115. package/docs/api/interfaces/AggregateConfig.md +43 -0
  116. package/docs/api/interfaces/ButtonProps.md +53 -0
  117. package/docs/api/interfaces/CardProps.md +40 -0
  118. package/docs/api/interfaces/ColorPalette.md +7 -0
  119. package/docs/api/interfaces/ColorShade.md +41 -0
  120. package/docs/api/interfaces/DataTableAction.md +200 -0
  121. package/docs/api/interfaces/DataTableColumn.md +300 -0
  122. package/docs/api/interfaces/DataTableProps.md +517 -0
  123. package/docs/api/interfaces/DataTableToolbarButton.md +96 -0
  124. package/docs/api/interfaces/EmptyStateConfig.md +61 -0
  125. package/docs/api/interfaces/EventContextType.md +96 -0
  126. package/docs/api/interfaces/EventLogoProps.md +152 -0
  127. package/docs/api/interfaces/EventProviderProps.md +19 -0
  128. package/docs/api/interfaces/FileSizeLimits.md +7 -0
  129. package/docs/api/interfaces/FileUploadProps.md +154 -0
  130. package/docs/api/interfaces/FooterProps.md +105 -0
  131. package/docs/api/interfaces/InactivityWarningModalProps.md +115 -0
  132. package/docs/api/interfaces/InputProps.md +53 -0
  133. package/docs/api/interfaces/LabelProps.md +107 -0
  134. package/docs/api/interfaces/LoginFormProps.md +184 -0
  135. package/docs/api/interfaces/NavigationItem.md +176 -0
  136. package/docs/api/interfaces/NavigationMenuProps.md +236 -0
  137. package/docs/api/interfaces/Organisation.md +140 -0
  138. package/docs/api/interfaces/OrganisationContextType.md +377 -0
  139. package/docs/api/interfaces/OrganisationMembership.md +140 -0
  140. package/docs/api/interfaces/OrganisationProviderProps.md +19 -0
  141. package/docs/api/interfaces/OrganisationSecurityError.md +62 -0
  142. package/docs/api/interfaces/PaceAppLayoutProps.md +393 -0
  143. package/docs/api/interfaces/PaceLoginPageProps.md +34 -0
  144. package/docs/api/interfaces/PaletteData.md +41 -0
  145. package/docs/api/interfaces/PublicErrorBoundaryProps.md +94 -0
  146. package/docs/api/interfaces/PublicErrorBoundaryState.md +68 -0
  147. package/docs/api/interfaces/PublicLoadingSpinnerProps.md +86 -0
  148. package/docs/api/interfaces/PublicPageFooterProps.md +112 -0
  149. package/docs/api/interfaces/PublicPageHeaderProps.md +138 -0
  150. package/docs/api/interfaces/PublicPageLayoutProps.md +138 -0
  151. package/docs/api/interfaces/StorageConfig.md +41 -0
  152. package/docs/api/interfaces/StorageFileInfo.md +74 -0
  153. package/docs/api/interfaces/StorageFileMetadata.md +140 -0
  154. package/docs/api/interfaces/StorageListOptions.md +86 -0
  155. package/docs/api/interfaces/StorageListResult.md +41 -0
  156. package/docs/api/interfaces/StorageUploadOptions.md +88 -0
  157. package/docs/api/interfaces/StorageUploadResult.md +63 -0
  158. package/docs/api/interfaces/StorageUrlOptions.md +47 -0
  159. package/docs/api/interfaces/StyleImport.md +19 -0
  160. package/docs/api/interfaces/ToastActionElement.md +9 -0
  161. package/docs/api/interfaces/ToastProps.md +9 -0
  162. package/docs/api/interfaces/UnifiedAuthContextType.md +1108 -0
  163. package/docs/api/interfaces/UnifiedAuthProviderProps.md +171 -0
  164. package/docs/api/interfaces/UseInactivityTrackerOptions.md +136 -0
  165. package/docs/api/interfaces/UseInactivityTrackerReturn.md +123 -0
  166. package/docs/api/interfaces/UsePublicEventLogoOptions.md +87 -0
  167. package/docs/api/interfaces/UsePublicEventLogoReturn.md +81 -0
  168. package/docs/api/interfaces/UsePublicEventOptions.md +34 -0
  169. package/docs/api/interfaces/UsePublicEventReturn.md +68 -0
  170. package/docs/api/interfaces/UsePublicRouteParamsReturn.md +94 -0
  171. package/docs/api/interfaces/UserEventAccess.md +118 -0
  172. package/docs/api/interfaces/UserMenuProps.md +86 -0
  173. package/docs/api/interfaces/UserProfile.md +63 -0
  174. package/docs/api/modules.md +4153 -0
  175. package/docs/api-reference/components.md +1623 -0
  176. package/docs/api-reference/hooks.md +627 -0
  177. package/docs/api-reference/providers.md +487 -0
  178. package/docs/api-reference/types.md +1005 -0
  179. package/docs/api-reference/utilities.md +1104 -0
  180. package/docs/app.css.example +53 -0
  181. package/docs/architecture/README.md +577 -0
  182. package/docs/best-practices/README.md +400 -0
  183. package/docs/best-practices/deployment.md +1042 -0
  184. package/docs/best-practices/performance.md +789 -0
  185. package/docs/best-practices/security.md +881 -0
  186. package/docs/best-practices/testing.md +981 -0
  187. package/docs/consuming-app-example.md +290 -0
  188. package/docs/consuming-app-vite-config.md +233 -0
  189. package/docs/core-concepts/authentication.md +98 -0
  190. package/docs/core-concepts/events.md +756 -0
  191. package/docs/core-concepts/organisations.md +790 -0
  192. package/docs/core-concepts/permissions.md +729 -0
  193. package/docs/core-concepts/rbac-system.md +233 -0
  194. package/docs/database-schema-requirements.md +172 -0
  195. package/docs/documentation-style-checklist.md +294 -0
  196. package/docs/examples/navigation-menu-auth-fix.md +344 -0
  197. package/docs/getting-started/examples/README.md +106 -0
  198. package/docs/getting-started/examples/basic-auth-app.md +521 -0
  199. package/docs/getting-started/examples/full-featured-app.md +616 -0
  200. package/docs/getting-started/installation.md +269 -0
  201. package/docs/getting-started/quick-start.md +401 -0
  202. package/docs/implementation-guides/app-layout.md +983 -0
  203. package/docs/implementation-guides/data-tables.md +1898 -0
  204. package/docs/implementation-guides/dynamic-colors.md +195 -0
  205. package/docs/implementation-guides/forms.md +578 -0
  206. package/docs/implementation-guides/hierarchical-datatable.md +850 -0
  207. package/docs/implementation-guides/large-datasets.md +281 -0
  208. package/docs/implementation-guides/navigation.md +844 -0
  209. package/docs/implementation-guides/performance.md +403 -0
  210. package/docs/implementation-guides/permission-enforcement.md +764 -0
  211. package/docs/implementation-guides/public-pages.md +752 -0
  212. package/docs/migration/README.md +493 -0
  213. package/docs/migration/organisation-context-timing-fix.md +217 -0
  214. package/docs/migration/quick-migration-guide.md +320 -0
  215. package/docs/migration/rbac-migration.md +571 -0
  216. package/docs/migration/v0.4.15-tailwind-scanning.md +272 -0
  217. package/docs/migration/v0.4.16-css-first-approach.md +306 -0
  218. package/docs/migration/v0.4.17-source-path-fix.md +229 -0
  219. package/docs/migration-guide.md +168 -0
  220. package/docs/performance/README.md +551 -0
  221. package/docs/print-components/README.md +258 -0
  222. package/docs/print-components/api-reference.md +636 -0
  223. package/docs/print-components/examples/README.md +204 -0
  224. package/docs/print-components/examples/basic-report.tsx +92 -0
  225. package/docs/print-components/examples/card-catalog.tsx +149 -0
  226. package/docs/print-components/examples/cover-page-report.tsx +163 -0
  227. package/docs/print-components/quick-start.md +363 -0
  228. package/docs/quick-reference.md +576 -0
  229. package/docs/rbac/README.md +265 -0
  230. package/docs/rbac/advanced-patterns.md +776 -0
  231. package/docs/rbac/api-reference.md +1033 -0
  232. package/docs/rbac/examples.md +883 -0
  233. package/docs/rbac/getting-started.md +679 -0
  234. package/docs/rbac/quick-start.md +619 -0
  235. package/docs/rbac/super-admin-guide.md +592 -0
  236. package/docs/rbac/troubleshooting.md +316 -0
  237. package/docs/security/README.md +680 -0
  238. package/docs/security/checklist.md +343 -0
  239. package/docs/style-guide.md +522 -0
  240. package/docs/styles/README.md +319 -0
  241. package/docs/testing/README.md +874 -0
  242. package/docs/troubleshooting/README.md +497 -0
  243. package/docs/troubleshooting/common-issues.md +1563 -0
  244. package/docs/troubleshooting/database-view-compatibility.md +119 -0
  245. package/docs/troubleshooting/debugging.md +1117 -0
  246. package/docs/troubleshooting/migration.md +918 -0
  247. package/docs/troubleshooting/organisation-context-setup.md +277 -0
  248. package/docs/troubleshooting/react-hooks-issue-analysis.md +166 -0
  249. package/docs/troubleshooting/styling-issues.md +219 -0
  250. package/docs/troubleshooting/tailwind-content-scanning.md +213 -0
  251. package/docs/usage.md +175 -0
  252. package/docs/visual-testing.md +114 -0
  253. package/package.json +211 -0
  254. package/src/__mocks__/lucide-react.ts +181 -0
  255. package/src/__tests__/README.md +404 -0
  256. package/src/__tests__/debug-provider.unit.test.tsx +67 -0
  257. package/src/__tests__/e2e/workflows.test.tsx +373 -0
  258. package/src/__tests__/hybridPermissions.unit.test.tsx +474 -0
  259. package/src/__tests__/index.integration.test.ts +491 -0
  260. package/src/__tests__/mocks/MockAuthProvider-standalone.tsx +47 -0
  261. package/src/__tests__/mocks/MockAuthProvider.tsx +63 -0
  262. package/src/__tests__/mocks/enhancedSupabaseMock.ts +252 -0
  263. package/src/__tests__/mocks/index.test.ts +23 -0
  264. package/src/__tests__/mocks/index.ts +16 -0
  265. package/src/__tests__/mocks/mockAuth.ts +155 -0
  266. package/src/__tests__/mocks/mockSupabase.ts +83 -0
  267. package/src/__tests__/mocks/mockSupabaseClient.ts +63 -0
  268. package/src/__tests__/mocks/providers.tsx +22 -0
  269. package/src/__tests__/patterns/__tests__/testPatterns.test.ts +394 -0
  270. package/src/__tests__/patterns/testPatterns.ts +124 -0
  271. package/src/__tests__/performance/componentPerformance.performance.test.ts +27 -0
  272. package/src/__tests__/performance/index.ts +24 -0
  273. package/src/__tests__/performance/performanceValidation.performance.test.ts +15 -0
  274. package/src/__tests__/security/security.unit.test.tsx +7 -0
  275. package/src/__tests__/security/securityValidation.security.test.tsx +153 -0
  276. package/src/__tests__/setup.ts +259 -0
  277. package/src/__tests__/setupTests.d.ts +1 -0
  278. package/src/__tests__/shared/componentTestUtils.tsx +475 -0
  279. package/src/__tests__/shared/errorHandlingTestUtils.ts +107 -0
  280. package/src/__tests__/shared/index.ts +81 -0
  281. package/src/__tests__/shared/integrationTestUtils.tsx +375 -0
  282. package/src/__tests__/shared/performanceTestUtils.tsx +476 -0
  283. package/src/__tests__/shared/testUtils.optimized.tsx +627 -0
  284. package/src/__tests__/simple.test.tsx +20 -0
  285. package/src/__tests__/templates/accessibility.test.template.tsx +279 -0
  286. package/src/__tests__/templates/component.test.template.tsx +122 -0
  287. package/src/__tests__/templates/integration.test.template.tsx +199 -0
  288. package/src/__tests__/test-utils/dataFactories.ts +60 -0
  289. package/src/__tests__/test-utils/index.ts +6 -0
  290. package/src/__tests__/typeSafety.unit.test.ts +65 -0
  291. package/src/__tests__/unifiedAuth.unit.test.tsx +151 -0
  292. package/src/__tests__/utils/accessibilityHelpers.ts +254 -0
  293. package/src/__tests__/utils/assertions.ts +50 -0
  294. package/src/__tests__/utils/deterministicHelpers.ts +31 -0
  295. package/src/__tests__/utils/edgeCaseConfig.test.ts +75 -0
  296. package/src/__tests__/utils/edgeCaseConfig.ts +98 -0
  297. package/src/__tests__/utils/mockHelpers.ts +149 -0
  298. package/src/__tests__/utils/mockLoader.ts +101 -0
  299. package/src/__tests__/utils/performanceHelpers.ts +55 -0
  300. package/src/__tests__/utils/performanceTestHelpers.ts +68 -0
  301. package/src/__tests__/utils/testDataFactories.ts +28 -0
  302. package/src/__tests__/utils/testIsolation.ts +67 -0
  303. package/src/__tests__/utils/visualTestHelpers.ts +20 -0
  304. package/src/__tests__/visual/__snapshots__/componentSnapshots.visual.test.tsx.snap +68 -0
  305. package/src/__tests__/visual/__snapshots__/componentVisuals.visual.test.tsx.snap +14 -0
  306. package/src/__tests__/visual/__snapshots__/visualRegression.test.tsx.snap +217 -0
  307. package/src/__tests__/visual/__snapshots__/visualRegression.visual.test.tsx.snap +24 -0
  308. package/src/__tests__/visual/componentSnapshots.visual.test.tsx +33 -0
  309. package/src/__tests__/visual/componentVisuals.visual.test.tsx +12 -0
  310. package/src/__tests__/visual/visualRegression.visual.test.tsx +20 -0
  311. package/src/components/Alert/Alert.tsx +134 -0
  312. package/src/components/Alert/__tests__/Alert.unit.test.tsx +381 -0
  313. package/src/components/Alert/index.ts +2 -0
  314. package/src/components/Avatar/Avatar.tsx +84 -0
  315. package/src/components/Avatar/__tests__/Avatar.unit.test.tsx +232 -0
  316. package/src/components/Avatar/index.ts +2 -0
  317. package/src/components/Button/Button.tsx +270 -0
  318. package/src/components/Button/__tests__/Button.accessibility.test.tsx +131 -0
  319. package/src/components/Button/__tests__/Button.comprehensive.test.tsx +721 -0
  320. package/src/components/Button/__tests__/Button.unit.test.tsx +189 -0
  321. package/src/components/Button/__tests__/EventSelector.integration.test.tsx +285 -0
  322. package/src/components/Button/index.ts +2 -0
  323. package/src/components/Card/Card.tsx +271 -0
  324. package/src/components/Card/__tests__/Card.accessibility.test.tsx +394 -0
  325. package/src/components/Card/__tests__/Card.comprehensive.test.tsx +599 -0
  326. package/src/components/Card/__tests__/Card.integration.test.tsx +673 -0
  327. package/src/components/Card/__tests__/Card.performance.test.tsx +546 -0
  328. package/src/components/Card/__tests__/Card.unit.test.tsx +330 -0
  329. package/src/components/Card/__tests__/Card.visual.test.tsx +599 -0
  330. package/src/components/Card/__tests__/README.md +211 -0
  331. package/src/components/Card/index.ts +1 -0
  332. package/src/components/Checkbox/Checkbox.tsx +75 -0
  333. package/src/components/Checkbox/__mocks__/Checkbox.tsx +2 -0
  334. package/src/components/Checkbox/__tests__/Checkbox.unit.test.tsx +520 -0
  335. package/src/components/Checkbox/index.ts +2 -0
  336. package/src/components/DataTable/DataTable.tsx +440 -0
  337. package/src/components/DataTable/__tests__/DataTable.autoSizing.test.tsx +526 -0
  338. package/src/components/DataTable/__tests__/DataTable.errorHandling.test.tsx +259 -0
  339. package/src/components/DataTable/__tests__/DataTable.hierarchical.test.tsx +675 -0
  340. package/src/components/DataTable/__tests__/DataTable.infinite-loop.test.tsx +324 -0
  341. package/src/components/DataTable/__tests__/DataTable.integration.test.tsx +724 -0
  342. package/src/components/DataTable/__tests__/DataTable.performance.test.tsx +597 -0
  343. package/src/components/DataTable/__tests__/DataTable.permissions.test.tsx +306 -0
  344. package/src/components/DataTable/__tests__/DataTable.regressionFixes.test.tsx +546 -0
  345. package/src/components/DataTable/__tests__/DataTable.selection.controlled.test.tsx +386 -0
  346. package/src/components/DataTable/__tests__/DataTable.selection.test.tsx +338 -0
  347. package/src/components/DataTable/__tests__/DataTable.userWorkflows.test.tsx +310 -0
  348. package/src/components/DataTable/__tests__/DataTable.workflowValidation.test.tsx +489 -0
  349. package/src/components/DataTable/__tests__/DataTable.workflows.test.tsx +701 -0
  350. package/src/components/DataTable/__tests__/README.md +136 -0
  351. package/src/components/DataTable/__tests__/mocks/MockRBACProvider.tsx +66 -0
  352. package/src/components/DataTable/__tests__/performance-regression.test.tsx +788 -0
  353. package/src/components/DataTable/__tests__/performance.test.tsx +365 -0
  354. package/src/components/DataTable/__tests__/test-utils/dataFactories.ts +103 -0
  355. package/src/components/DataTable/__tests__/test-utils/sharedTestUtils.tsx +382 -0
  356. package/src/components/DataTable/__tests__/test-utils.ts +94 -0
  357. package/src/components/DataTable/components/ActionButtons.tsx +177 -0
  358. package/src/components/DataTable/components/BulkOperationsDropdown.tsx +160 -0
  359. package/src/components/DataTable/components/ColumnFilter.tsx +114 -0
  360. package/src/components/DataTable/components/ColumnVisibilityDropdown.tsx +100 -0
  361. package/src/components/DataTable/components/DataTableBody.tsx +462 -0
  362. package/src/components/DataTable/components/DataTableCore.tsx +869 -0
  363. package/src/components/DataTable/components/DataTableErrorBoundary.tsx +214 -0
  364. package/src/components/DataTable/components/DataTableHeader.tsx +31 -0
  365. package/src/components/DataTable/components/DataTableModals.tsx +87 -0
  366. package/src/components/DataTable/components/DataTableToolbar.tsx +251 -0
  367. package/src/components/DataTable/components/DraggableColumnHeader.tsx +148 -0
  368. package/src/components/DataTable/components/EditableRow.tsx +160 -0
  369. package/src/components/DataTable/components/EmptyState.tsx +64 -0
  370. package/src/components/DataTable/components/ExpandButton.tsx +113 -0
  371. package/src/components/DataTable/components/FilterRow.tsx +101 -0
  372. package/src/components/DataTable/components/GroupHeader.tsx +42 -0
  373. package/src/components/DataTable/components/GroupingDropdown.tsx +96 -0
  374. package/src/components/DataTable/components/ImportModal.tsx +345 -0
  375. package/src/components/DataTable/components/LoadingState.tsx +12 -0
  376. package/src/components/DataTable/components/PaginationControls.tsx +332 -0
  377. package/src/components/DataTable/components/UnifiedTableBody.tsx +911 -0
  378. package/src/components/DataTable/components/ViewRowModal.tsx +68 -0
  379. package/src/components/DataTable/components/VirtualizedDataTable.tsx +593 -0
  380. package/src/components/DataTable/components/__tests__/ActionButtons.unit.test.tsx +150 -0
  381. package/src/components/DataTable/components/__tests__/BulkOperationsDropdown.test.tsx +224 -0
  382. package/src/components/DataTable/components/__tests__/ColumnVisibilityDropdown.unit.test.tsx +244 -0
  383. package/src/components/DataTable/components/__tests__/DataTable.accessibility.test.tsx +523 -0
  384. package/src/components/DataTable/components/__tests__/DataTable.integration.test.tsx +401 -0
  385. package/src/components/DataTable/components/__tests__/DataTable.performance.test.tsx +161 -0
  386. package/src/components/DataTable/components/__tests__/DataTable.real.test.tsx +251 -0
  387. package/src/components/DataTable/components/__tests__/DataTable.security.test.tsx +172 -0
  388. package/src/components/DataTable/components/__tests__/DataTable.unit.test.tsx +290 -0
  389. package/src/components/DataTable/components/__tests__/DataTableBody.unit.test.tsx +147 -0
  390. package/src/components/DataTable/components/__tests__/DataTableErrorBoundary.unit.test.tsx +182 -0
  391. package/src/components/DataTable/components/__tests__/DataTableHeader.unit.test.tsx +143 -0
  392. package/src/components/DataTable/components/__tests__/DataTableModals.unit.test.tsx +123 -0
  393. package/src/components/DataTable/components/__tests__/EditableRow.unit.test.tsx +660 -0
  394. package/src/components/DataTable/components/__tests__/EmptyState.unit.test.tsx +256 -0
  395. package/src/components/DataTable/components/__tests__/ExpandButton.test.tsx +498 -0
  396. package/src/components/DataTable/components/__tests__/FilterRow.unit.test.tsx +112 -0
  397. package/src/components/DataTable/components/__tests__/FilteringToggle.unit.test.tsx +130 -0
  398. package/src/components/DataTable/components/__tests__/GroupHeader.unit.test.tsx +172 -0
  399. package/src/components/DataTable/components/__tests__/GroupingDropdown.unit.test.tsx +222 -0
  400. package/src/components/DataTable/components/__tests__/ImportModal.unit.test.tsx +780 -0
  401. package/src/components/DataTable/components/__tests__/LoadingState.unit.test.tsx +65 -0
  402. package/src/components/DataTable/components/__tests__/PaginationControls.unit.test.tsx +634 -0
  403. package/src/components/DataTable/components/__tests__/StateComponents.unit.test.tsx +48 -0
  404. package/src/components/DataTable/components/__tests__/UnifiedTableBody.hierarchical.test.tsx +541 -0
  405. package/src/components/DataTable/components/__tests__/ViewRowModal.unit.test.tsx +228 -0
  406. package/src/components/DataTable/components/__tests__/VirtualizedDataTable.unit.test.tsx +568 -0
  407. package/src/components/DataTable/components/index.ts +17 -0
  408. package/src/components/DataTable/context/DataTableContext.tsx +97 -0
  409. package/src/components/DataTable/core/ActionManager.ts +235 -0
  410. package/src/components/DataTable/core/ColumnFactory.ts +268 -0
  411. package/src/components/DataTable/core/ColumnManager.ts +205 -0
  412. package/src/components/DataTable/core/DataManager.ts +188 -0
  413. package/src/components/DataTable/core/DataTableContext.tsx +182 -0
  414. package/src/components/DataTable/core/LocalDataAdapter.ts +264 -0
  415. package/src/components/DataTable/core/PluginRegistry.ts +229 -0
  416. package/src/components/DataTable/core/StateManager.ts +311 -0
  417. package/src/components/DataTable/core/__tests__/ActionManager.unit.test.ts +405 -0
  418. package/src/components/DataTable/core/__tests__/ArchitectureIntegration.unit.test.tsx +445 -0
  419. package/src/components/DataTable/core/__tests__/ColumnFactory.unit.test.ts +288 -0
  420. package/src/components/DataTable/core/__tests__/ColumnManager.unit.test.ts +623 -0
  421. package/src/components/DataTable/core/__tests__/DataManager.unit.test.ts +431 -0
  422. package/src/components/DataTable/core/__tests__/DataTableContext.unit.test.tsx +433 -0
  423. package/src/components/DataTable/core/__tests__/LocalDataAdapter.unit.test.ts +422 -0
  424. package/src/components/DataTable/core/__tests__/PluginRegistry.unit.test.tsx +207 -0
  425. package/src/components/DataTable/core/__tests__/StateManager.unit.test.ts +278 -0
  426. package/src/components/DataTable/core/index.ts +8 -0
  427. package/src/components/DataTable/core/interfaces.ts +338 -0
  428. package/src/components/DataTable/examples/AutoSizingExample.tsx +180 -0
  429. package/src/components/DataTable/examples/ColumnSizingComparison.tsx +235 -0
  430. package/src/components/DataTable/examples/HierarchicalActionsExample.tsx +418 -0
  431. package/src/components/DataTable/examples/HierarchicalExample.tsx +472 -0
  432. package/src/components/DataTable/examples/InitialPageSizeExample.tsx +173 -0
  433. package/src/components/DataTable/examples/PerformanceExample.tsx +502 -0
  434. package/src/components/DataTable/examples/__tests__/PerformanceExample.unit.test.tsx +281 -0
  435. package/src/components/DataTable/hooks/__tests__/useColumnOrderPersistence.unit.test.ts +407 -0
  436. package/src/components/DataTable/hooks/__tests__/useColumnReordering.unit.test.ts +679 -0
  437. package/src/components/DataTable/hooks/useColumnOrderPersistence.ts +95 -0
  438. package/src/components/DataTable/hooks/useColumnReordering.ts +110 -0
  439. package/src/components/DataTable/hooks/useDataTableState.ts +325 -0
  440. package/src/components/DataTable/hooks/useHierarchicalState.ts +174 -0
  441. package/src/components/DataTable/index.ts +70 -0
  442. package/src/components/DataTable/styles.ts +171 -0
  443. package/src/components/DataTable/types.ts +475 -0
  444. package/src/components/DataTable/utils/__tests__/columnSizing.test.ts +237 -0
  445. package/src/components/DataTable/utils/__tests__/debugTools.unit.test.ts +267 -0
  446. package/src/components/DataTable/utils/__tests__/errorHandling.unit.test.ts +467 -0
  447. package/src/components/DataTable/utils/__tests__/exportUtils.unit.test.ts +380 -0
  448. package/src/components/DataTable/utils/__tests__/flexibleImport.unit.test.ts +233 -0
  449. package/src/components/DataTable/utils/__tests__/performanceUtils.unit.test.ts +414 -0
  450. package/src/components/DataTable/utils/columnSizing.ts +125 -0
  451. package/src/components/DataTable/utils/debugTools.ts +583 -0
  452. package/src/components/DataTable/utils/errorHandling.ts +494 -0
  453. package/src/components/DataTable/utils/exportUtils.ts +126 -0
  454. package/src/components/DataTable/utils/flexibleImport.ts +510 -0
  455. package/src/components/DataTable/utils/hierarchicalSorting.ts +151 -0
  456. package/src/components/DataTable/utils/hierarchicalUtils.ts +218 -0
  457. package/src/components/DataTable/utils/index.ts +1 -0
  458. package/src/components/DataTable/utils/performanceUtils.ts +351 -0
  459. package/src/components/Dialog/Dialog.tsx +782 -0
  460. package/src/components/Dialog/README.md +804 -0
  461. package/src/components/Dialog/__tests__/Dialog.accessibility.test.tsx +521 -0
  462. package/src/components/Dialog/__tests__/Dialog.auto-size.example.tsx +157 -0
  463. package/src/components/Dialog/__tests__/Dialog.enhanced.test.tsx +538 -0
  464. package/src/components/Dialog/__tests__/Dialog.unit.test.tsx +1373 -0
  465. package/src/components/Dialog/examples/BasicHtmlTest.tsx +55 -0
  466. package/src/components/Dialog/examples/DebugHtmlExample.tsx +68 -0
  467. package/src/components/Dialog/examples/HtmlDialogExample.tsx +202 -0
  468. package/src/components/Dialog/examples/SimpleHtmlTest.tsx +61 -0
  469. package/src/components/Dialog/examples/SmartDialogExample.tsx +322 -0
  470. package/src/components/Dialog/examples/__tests__/SmartDialogExample.unit.test.tsx +151 -0
  471. package/src/components/Dialog/index.ts +12 -0
  472. package/src/components/Dialog/utils/__tests__/safeHtml.unit.test.ts +611 -0
  473. package/src/components/Dialog/utils/safeHtml.ts +185 -0
  474. package/src/components/ErrorBoundary/ErrorBoundary.tsx +312 -0
  475. package/src/components/ErrorBoundary/__tests__/ErrorBoundary.accessibility.test.tsx +517 -0
  476. package/src/components/ErrorBoundary/__tests__/ErrorBoundary.integration.test.tsx +572 -0
  477. package/src/components/ErrorBoundary/__tests__/ErrorBoundary.unit.test.tsx +579 -0
  478. package/src/components/ErrorBoundary/index.ts +8 -0
  479. package/src/components/EventSelector/EventSelector.tsx +360 -0
  480. package/src/components/EventSelector/__tests__/EventSelector.test.tsx +528 -0
  481. package/src/components/EventSelector/index.ts +3 -0
  482. package/src/components/EventSelector/types.ts +79 -0
  483. package/src/components/FileUpload/FileUpload.example.tsx +218 -0
  484. package/src/components/FileUpload/FileUpload.tsx +237 -0
  485. package/src/components/FileUpload/__tests__/FileUpload.integration.test.tsx +992 -0
  486. package/src/components/FileUpload/__tests__/FileUpload.real.test.tsx +927 -0
  487. package/src/components/FileUpload/__tests__/FileUpload.test.tsx +855 -0
  488. package/src/components/FileUpload/__tests__/FileUpload.unit.test.tsx +1311 -0
  489. package/src/components/FileUpload/__tests__/FileUpload.unmocked.test.tsx +937 -0
  490. package/src/components/FileUpload/index.ts +6 -0
  491. package/src/components/Footer/Footer.tsx +197 -0
  492. package/src/components/Footer/__tests__/Footer.accessibility.test.tsx +359 -0
  493. package/src/components/Footer/__tests__/Footer.integration.test.tsx +353 -0
  494. package/src/components/Footer/__tests__/Footer.performance.test.tsx +309 -0
  495. package/src/components/Footer/__tests__/Footer.unit.test.tsx +309 -0
  496. package/src/components/Footer/__tests__/Footer.visual.test.tsx +335 -0
  497. package/src/components/Footer/index.ts +17 -0
  498. package/src/components/Form/Form.tsx +166 -0
  499. package/src/components/Form/FormErrorSummary.tsx +113 -0
  500. package/src/components/Form/FormField.tsx +249 -0
  501. package/src/components/Form/FormFieldset.tsx +127 -0
  502. package/src/components/Form/FormLiveRegion.tsx +198 -0
  503. package/src/components/Form/__tests__/Form.accessibility.test.tsx +820 -0
  504. package/src/components/Form/__tests__/Form.unit.test.tsx +305 -0
  505. package/src/components/Form/__tests__/FormErrorSummary.unit.test.tsx +285 -0
  506. package/src/components/Form/__tests__/FormFieldset.unit.test.tsx +241 -0
  507. package/src/components/Form/index.ts +26 -0
  508. package/src/components/Header/Header.tsx +301 -0
  509. package/src/components/Header/__tests__/Header.accessibility.test.tsx +382 -0
  510. package/src/components/Header/__tests__/Header.comprehensive.test.tsx +509 -0
  511. package/src/components/Header/__tests__/Header.unit.test.tsx +335 -0
  512. package/src/components/Header/index.ts +4 -0
  513. package/src/components/InactivityWarningModal/InactivityWarningModal.test.tsx +196 -0
  514. package/src/components/InactivityWarningModal/InactivityWarningModal.tsx +164 -0
  515. package/src/components/InactivityWarningModal/__tests__/InactivityWarningModal.unit.test.tsx +224 -0
  516. package/src/components/InactivityWarningModal/index.ts +9 -0
  517. package/src/components/Input/Input.tsx +201 -0
  518. package/src/components/Input/__mocks__/Input.tsx +2 -0
  519. package/src/components/Input/__tests__/Input.accessibility.test.tsx +632 -0
  520. package/src/components/Input/__tests__/Input.unit.test.tsx +1121 -0
  521. package/src/components/Input/index.ts +9 -0
  522. package/src/components/Label/Label.tsx +186 -0
  523. package/src/components/Label/__tests__/Label.accessibility.test.tsx +239 -0
  524. package/src/components/Label/__tests__/Label.unit.test.tsx +331 -0
  525. package/src/components/Label/index.ts +2 -0
  526. package/src/components/LoadingSpinner/LoadingSpinner.tsx +98 -0
  527. package/src/components/LoadingSpinner/__tests__/LoadingSpinner.accessibility.test.tsx +116 -0
  528. package/src/components/LoadingSpinner/__tests__/LoadingSpinner.unit.test.tsx +144 -0
  529. package/src/components/LoadingSpinner/index.ts +3 -0
  530. package/src/components/LoginForm/LoginForm.tsx +273 -0
  531. package/src/components/LoginForm/__tests__/LoginForm.accessibility.test.tsx +201 -0
  532. package/src/components/LoginForm/__tests__/LoginForm.unit.test.tsx +119 -0
  533. package/src/components/LoginForm/index.ts +3 -0
  534. package/src/components/NavigationMenu/NavigationMenu.tsx +698 -0
  535. package/src/components/NavigationMenu/__tests__/NavigationMenu.accessibility.test.tsx +378 -0
  536. package/src/components/NavigationMenu/__tests__/NavigationMenu.enhanced.test.tsx +768 -0
  537. package/src/components/NavigationMenu/__tests__/NavigationMenu.integration.test.tsx +576 -0
  538. package/src/components/NavigationMenu/__tests__/NavigationMenu.performance.test.tsx +585 -0
  539. package/src/components/NavigationMenu/__tests__/NavigationMenu.real.component.test.tsx +783 -0
  540. package/src/components/NavigationMenu/__tests__/NavigationMenu.security.enhanced.test.tsx +810 -0
  541. package/src/components/NavigationMenu/__tests__/NavigationMenu.security.test.tsx +494 -0
  542. package/src/components/NavigationMenu/__tests__/NavigationMenu.unit.test.tsx +331 -0
  543. package/src/components/NavigationMenu/__tests__/NavigationMenu.userWorkflows.test.tsx +347 -0
  544. package/src/components/NavigationMenu/__tests__/NavigationMenu.workflows.test.tsx +584 -0
  545. package/src/components/NavigationMenu/index.ts +10 -0
  546. package/src/components/NavigationMenu/types.ts +85 -0
  547. package/src/components/OrganisationSelector/OrganisationSelector.tsx +304 -0
  548. package/src/components/OrganisationSelector/__tests__/OrganisationSelector.unit.test.tsx +664 -0
  549. package/src/components/OrganisationSelector/index.ts +9 -0
  550. package/src/components/PaceAppLayout/PaceAppLayout.tsx +699 -0
  551. package/src/components/PaceAppLayout/README.md +278 -0
  552. package/src/components/PaceAppLayout/__tests__/PaceAppLayout.accessibility.test.tsx +288 -0
  553. package/src/components/PaceAppLayout/__tests__/PaceAppLayout.integration.test.tsx +889 -0
  554. package/src/components/PaceAppLayout/__tests__/PaceAppLayout.performance.test.tsx +629 -0
  555. package/src/components/PaceAppLayout/__tests__/PaceAppLayout.security.test.tsx +782 -0
  556. package/src/components/PaceAppLayout/__tests__/PaceAppLayout.unit.test.tsx +904 -0
  557. package/src/components/PaceAppLayout/index.ts +1 -0
  558. package/src/components/PaceLoginPage/PaceLoginPage.tsx +221 -0
  559. package/src/components/PaceLoginPage/__tests__/PaceLoginPage.accessibility.test.tsx +463 -0
  560. package/src/components/PaceLoginPage/__tests__/PaceLoginPage.integration.test.tsx +586 -0
  561. package/src/components/PaceLoginPage/__tests__/PaceLoginPage.unit.test.tsx +533 -0
  562. package/src/components/PaceLoginPage/index.ts +1 -0
  563. package/src/components/PasswordReset/PasswordChangeForm.tsx +186 -0
  564. package/src/components/PasswordReset/PasswordResetForm.tsx +201 -0
  565. package/src/components/PasswordReset/__tests__/PasswordChangeForm.accessibility.test.tsx +408 -0
  566. package/src/components/PasswordReset/__tests__/PasswordChangeForm.unit.test.tsx +561 -0
  567. package/src/components/PasswordReset/__tests__/PasswordReset.integration.test.tsx +304 -0
  568. package/src/components/PasswordReset/__tests__/PasswordResetForm.accessibility.test.tsx +20 -0
  569. package/src/components/PasswordReset/__tests__/PasswordResetForm.unit.test.tsx +523 -0
  570. package/src/components/PasswordReset/__tests__/__mocks__/UnifiedAuthProvider.ts +29 -0
  571. package/src/components/PasswordReset/index.ts +4 -0
  572. package/src/components/Print/__tests__/Print.comprehensive.test.tsx +331 -0
  573. package/src/components/PrintButton/PrintButton.tsx +321 -0
  574. package/src/components/PrintButton/PrintButtonGroup.tsx +84 -0
  575. package/src/components/PrintButton/PrintToolbar.tsx +94 -0
  576. package/src/components/PrintButton/__tests__/PrintButton.unit.test.tsx +429 -0
  577. package/src/components/PrintButton/__tests__/PrintButtonGroup.unit.test.tsx +277 -0
  578. package/src/components/PrintButton/__tests__/PrintToolbar.unit.test.tsx +264 -0
  579. package/src/components/PrintButton/examples/PrintButtonShowcase.tsx +438 -0
  580. package/src/components/PrintButton/index.ts +33 -0
  581. package/src/components/PrintButton/types.ts +173 -0
  582. package/src/components/PrintCard/PrintCard.tsx +154 -0
  583. package/src/components/PrintCard/PrintCardContent.tsx +57 -0
  584. package/src/components/PrintCard/PrintCardFooter.tsx +60 -0
  585. package/src/components/PrintCard/PrintCardGrid.tsx +91 -0
  586. package/src/components/PrintCard/PrintCardHeader.tsx +78 -0
  587. package/src/components/PrintCard/PrintCardImage.tsx +81 -0
  588. package/src/components/PrintCard/__tests__/PrintCard.unit.test.tsx +233 -0
  589. package/src/components/PrintCard/__tests__/PrintCardContent.test.tsx +284 -0
  590. package/src/components/PrintCard/__tests__/PrintCardGrid.unit.test.tsx +214 -0
  591. package/src/components/PrintCard/__tests__/PrintCardImage.unit.test.tsx +264 -0
  592. package/src/components/PrintCard/examples/PrintCardShowcase.tsx +239 -0
  593. package/src/components/PrintCard/index.ts +34 -0
  594. package/src/components/PrintCard/types.ts +171 -0
  595. package/src/components/PrintDataTable/PrintDataTable.tsx +215 -0
  596. package/src/components/PrintDataTable/PrintTableGroup.tsx +90 -0
  597. package/src/components/PrintDataTable/PrintTableRow.tsx +76 -0
  598. package/src/components/PrintDataTable/__tests__/PrintDataTable.unit.test.tsx +361 -0
  599. package/src/components/PrintDataTable/__tests__/PrintTableGroup.unit.test.tsx +314 -0
  600. package/src/components/PrintDataTable/__tests__/PrintTableRow.unit.test.tsx +362 -0
  601. package/src/components/PrintDataTable/index.ts +25 -0
  602. package/src/components/PrintDataTable/types.ts +67 -0
  603. package/src/components/PrintFooter/PrintFooter.tsx +183 -0
  604. package/src/components/PrintFooter/PrintFooterContent.tsx +71 -0
  605. package/src/components/PrintFooter/PrintFooterInfo.tsx +86 -0
  606. package/src/components/PrintFooter/PrintPageNumber.tsx +90 -0
  607. package/src/components/PrintFooter/__tests__/PrintFooter.unit.test.tsx +500 -0
  608. package/src/components/PrintFooter/__tests__/PrintFooterContent.unit.test.tsx +321 -0
  609. package/src/components/PrintFooter/__tests__/PrintFooterInfo.unit.test.tsx +335 -0
  610. package/src/components/PrintFooter/__tests__/PrintPageNumber.unit.test.tsx +340 -0
  611. package/src/components/PrintFooter/examples/PrintFooterShowcase.tsx +390 -0
  612. package/src/components/PrintFooter/index.ts +30 -0
  613. package/src/components/PrintFooter/types.ts +149 -0
  614. package/src/components/PrintGrid/PrintGrid.tsx +180 -0
  615. package/src/components/PrintGrid/PrintGridBreakpoint.tsx +109 -0
  616. package/src/components/PrintGrid/PrintGridContainer.tsx +128 -0
  617. package/src/components/PrintGrid/PrintGridItem.tsx +220 -0
  618. package/src/components/PrintGrid/__tests__/PrintGrid.unit.test.tsx +340 -0
  619. package/src/components/PrintGrid/__tests__/PrintGridBreakpoint.unit.test.tsx +261 -0
  620. package/src/components/PrintGrid/__tests__/PrintGridContainer.unit.test.tsx +338 -0
  621. package/src/components/PrintGrid/__tests__/PrintGridItem.unit.test.tsx +338 -0
  622. package/src/components/PrintGrid/examples/PrintGridShowcase.tsx +359 -0
  623. package/src/components/PrintGrid/index.ts +31 -0
  624. package/src/components/PrintGrid/types.ts +159 -0
  625. package/src/components/PrintHeader/PrintCoverHeader.tsx +230 -0
  626. package/src/components/PrintHeader/PrintHeader.tsx +150 -0
  627. package/src/components/PrintHeader/__tests__/PrintCoverHeader.unit.test.tsx +309 -0
  628. package/src/components/PrintHeader/__tests__/PrintHeader.unit.test.tsx +202 -0
  629. package/src/components/PrintHeader/index.ts +17 -0
  630. package/src/components/PrintHeader/types.ts +42 -0
  631. package/src/components/PrintLayout/PrintLayout.tsx +122 -0
  632. package/src/components/PrintLayout/PrintLayoutContext.tsx +66 -0
  633. package/src/components/PrintLayout/PrintPageBreak.tsx +52 -0
  634. package/src/components/PrintLayout/__tests__/PrintLayout.unit.test.tsx +238 -0
  635. package/src/components/PrintLayout/examples/PrintShowcase.tsx +230 -0
  636. package/src/components/PrintLayout/index.ts +19 -0
  637. package/src/components/PrintLayout/types.ts +37 -0
  638. package/src/components/PrintPageBreak/PrintPageBreak.tsx +120 -0
  639. package/src/components/PrintPageBreak/PrintPageBreakGroup.tsx +90 -0
  640. package/src/components/PrintPageBreak/PrintPageBreakIndicator.tsx +112 -0
  641. package/src/components/PrintPageBreak/__tests__/PrintPageBreak.unit.test.tsx +263 -0
  642. package/src/components/PrintPageBreak/__tests__/PrintPageBreakGroup.unit.test.tsx +239 -0
  643. package/src/components/PrintPageBreak/__tests__/PrintPageBreakIndicator.unit.test.tsx +235 -0
  644. package/src/components/PrintPageBreak/examples/PrintPageBreakShowcase.tsx +279 -0
  645. package/src/components/PrintPageBreak/index.ts +23 -0
  646. package/src/components/PrintPageBreak/types.ts +94 -0
  647. package/src/components/PrintSection/PrintColumn.tsx +104 -0
  648. package/src/components/PrintSection/PrintDivider.tsx +101 -0
  649. package/src/components/PrintSection/PrintSection.tsx +129 -0
  650. package/src/components/PrintSection/PrintSectionContent.tsx +75 -0
  651. package/src/components/PrintSection/PrintSectionHeader.tsx +97 -0
  652. package/src/components/PrintSection/__tests__/PrintColumn.unit.test.tsx +385 -0
  653. package/src/components/PrintSection/__tests__/PrintDivider.unit.test.tsx +373 -0
  654. package/src/components/PrintSection/__tests__/PrintSection.unit.test.tsx +390 -0
  655. package/src/components/PrintSection/__tests__/PrintSectionContent.unit.test.tsx +321 -0
  656. package/src/components/PrintSection/__tests__/PrintSectionHeader.unit.test.tsx +334 -0
  657. package/src/components/PrintSection/examples/PrintSectionShowcase.tsx +258 -0
  658. package/src/components/PrintSection/index.ts +33 -0
  659. package/src/components/PrintSection/types.ts +155 -0
  660. package/src/components/PrintText/PrintText.tsx +116 -0
  661. package/src/components/PrintText/__tests__/PrintText.unit.test.tsx +351 -0
  662. package/src/components/PrintText/index.ts +16 -0
  663. package/src/components/PrintText/types.ts +24 -0
  664. package/src/components/Progress/Progress.tsx +116 -0
  665. package/src/components/Progress/__tests__/Progress.accessibility.test.tsx +240 -0
  666. package/src/components/Progress/__tests__/Progress.unit.test.tsx +242 -0
  667. package/src/components/Progress/index.ts +3 -0
  668. package/src/components/PublicLayout/EventLogo.tsx +287 -0
  669. package/src/components/PublicLayout/PublicErrorBoundary.tsx +279 -0
  670. package/src/components/PublicLayout/PublicLoadingSpinner.tsx +208 -0
  671. package/src/components/PublicLayout/PublicPageContextChecker.tsx +130 -0
  672. package/src/components/PublicLayout/PublicPageDebugger.tsx +104 -0
  673. package/src/components/PublicLayout/PublicPageDiagnostic.tsx +162 -0
  674. package/src/components/PublicLayout/PublicPageFooter.tsx +124 -0
  675. package/src/components/PublicLayout/PublicPageHeader.tsx +178 -0
  676. package/src/components/PublicLayout/PublicPageLayout.tsx +232 -0
  677. package/src/components/PublicLayout/PublicPageProvider.tsx +137 -0
  678. package/src/components/PublicLayout/__tests__/EventLogo.test.tsx +761 -0
  679. package/src/components/PublicLayout/__tests__/PublicErrorBoundary.simplified.test.tsx +228 -0
  680. package/src/components/PublicLayout/__tests__/PublicErrorBoundary.test.tsx +228 -0
  681. package/src/components/PublicLayout/__tests__/PublicLoadingSpinner.test.tsx +459 -0
  682. package/src/components/PublicLayout/__tests__/PublicPageFooter.test.tsx +362 -0
  683. package/src/components/PublicLayout/__tests__/PublicPageHeader.test.tsx +522 -0
  684. package/src/components/PublicLayout/__tests__/PublicPageLayout.test.tsx +599 -0
  685. package/src/components/PublicLayout/__tests__/PublicPageProvider.test.tsx +513 -0
  686. package/src/components/PublicLayout/index.ts +51 -0
  687. package/src/components/RBAC/PagePermissionGuard.tsx +274 -0
  688. package/src/components/RBAC/RBACGuard.tsx +143 -0
  689. package/src/components/RBAC/RBACProvider.tsx +186 -0
  690. package/src/components/RBAC/RoleBasedContent.tsx +129 -0
  691. package/src/components/RBAC/__tests__/PagePermissionGuard.unit.test.tsx +674 -0
  692. package/src/components/RBAC/__tests__/RBAC.integration.test.tsx +573 -0
  693. package/src/components/RBAC/__tests__/RBACGuard.unit.test.tsx +467 -0
  694. package/src/components/RBAC/__tests__/RBACProvider.accessibility.test.tsx +475 -0
  695. package/src/components/RBAC/__tests__/RBACProvider.advanced.test.tsx +569 -0
  696. package/src/components/RBAC/__tests__/RBACProvider.integration.test.tsx +352 -0
  697. package/src/components/RBAC/__tests__/RBACProvider.unit.test.tsx +128 -0
  698. package/src/components/RBAC/__tests__/RoleBasedContent.unit.test.tsx +657 -0
  699. package/src/components/RBAC/index.ts +23 -0
  700. package/src/components/Select/Select.tsx +654 -0
  701. package/src/components/Select/__tests__/SearchableSelect.unit.test.tsx +437 -0
  702. package/src/components/Select/__tests__/Select.accessibility.test.tsx +1202 -0
  703. package/src/components/Select/__tests__/Select.actual.test.tsx +774 -0
  704. package/src/components/Select/__tests__/Select.comprehensive.test.tsx +837 -0
  705. package/src/components/Select/__tests__/Select.enhanced.test.tsx +1101 -0
  706. package/src/components/Select/__tests__/Select.integration.test.tsx +772 -0
  707. package/src/components/Select/__tests__/Select.performance.test.tsx +695 -0
  708. package/src/components/Select/__tests__/Select.real-world.test.tsx +1046 -0
  709. package/src/components/Select/__tests__/Select.search-algorithms.test.tsx +968 -0
  710. package/src/components/Select/__tests__/Select.unit.test.tsx +647 -0
  711. package/src/components/Select/__tests__/Select.utils.test.tsx +890 -0
  712. package/src/components/Select/index.ts +1 -0
  713. package/src/components/SuperAdminGuard.tsx +116 -0
  714. package/src/components/Table/Table.tsx +222 -0
  715. package/src/components/Table/__tests__/Table.accessibility.test.tsx +233 -0
  716. package/src/components/Table/__tests__/Table.unit.test.tsx +235 -0
  717. package/src/components/Table/index.ts +11 -0
  718. package/src/components/Toast/Toast.tsx +339 -0
  719. package/src/components/Toast/__tests__/Toast.accessibility.test.tsx +238 -0
  720. package/src/components/Toast/__tests__/Toast.integration.test.tsx +699 -0
  721. package/src/components/Toast/__tests__/Toast.unit.test.tsx +750 -0
  722. package/src/components/Toast/index.ts +14 -0
  723. package/src/components/Tooltip/Tooltip.tsx +167 -0
  724. package/src/components/Tooltip/__tests__/Tooltip.accessibility.test.tsx +121 -0
  725. package/src/components/Tooltip/__tests__/Tooltip.unit.test.tsx +185 -0
  726. package/src/components/Tooltip/index.ts +7 -0
  727. package/src/components/UserMenu/UserMenu.tsx +243 -0
  728. package/src/components/UserMenu/__tests__/UserMenu.accessibility.test.tsx +139 -0
  729. package/src/components/UserMenu/__tests__/UserMenu.integration.test.tsx +188 -0
  730. package/src/components/UserMenu/__tests__/UserMenu.unit.test.tsx +458 -0
  731. package/src/components/UserMenu/index.ts +3 -0
  732. package/src/components/__tests__/EdgeCaseTesting.enhanced.test.tsx +523 -0
  733. package/src/components/__tests__/ErrorTesting.enhanced.test.tsx +455 -0
  734. package/src/components/__tests__/SuperAdminGuard.test.tsx +456 -0
  735. package/src/components/__tests__/SuperAdminGuard.unit.test.tsx +456 -0
  736. package/src/components/examples/PermissionExample.tsx +150 -0
  737. package/src/components/examples/__tests__/PermissionExample.unit.test.tsx +360 -0
  738. package/src/components/index.ts +434 -0
  739. package/src/components.ts +19 -0
  740. package/src/constants/performance.ts +14 -0
  741. package/src/examples/CorrectPublicPageImplementation.tsx +301 -0
  742. package/src/examples/PublicEventPage.tsx +274 -0
  743. package/src/examples/PublicPageApp.tsx +308 -0
  744. package/src/examples/PublicPageUsageExample.tsx +216 -0
  745. package/src/fonts/georama-italic.woff2 +0 -0
  746. package/src/fonts/georama.woff2 +0 -0
  747. package/src/fonts/open-sans-italic.woff2 +0 -0
  748. package/src/fonts/open-sans.woff2 +0 -0
  749. package/src/fonts/reddit-mono.woff2 +0 -0
  750. package/src/hooks/__tests__/hooks.integration.test.tsx +575 -0
  751. package/src/hooks/__tests__/useApiFetch.unit.test.ts +115 -0
  752. package/src/hooks/__tests__/useComponentPerformance.unit.test.tsx +133 -0
  753. package/src/hooks/__tests__/useDebounce.unit.test.ts +82 -0
  754. package/src/hooks/__tests__/useFocusTrap.unit.test.tsx +293 -0
  755. package/src/hooks/__tests__/useInactivityTracker.unit.test.ts +385 -0
  756. package/src/hooks/__tests__/useOrganisationPermissions.unit.test.tsx +286 -0
  757. package/src/hooks/__tests__/useOrganisationSecurity.unit.test.tsx +838 -0
  758. package/src/hooks/__tests__/usePermissionCache.unit.test.ts +627 -0
  759. package/src/hooks/__tests__/useRBAC.unit.test.ts +903 -0
  760. package/src/hooks/__tests__/useSecureDataAccess.unit.test.tsx +537 -0
  761. package/src/hooks/__tests__/useToast.unit.test.tsx +62 -0
  762. package/src/hooks/__tests__/useZodForm.unit.test.tsx +37 -0
  763. package/src/hooks/index.ts +56 -0
  764. package/src/hooks/public/__tests__/usePublicEvent.test.tsx +397 -0
  765. package/src/hooks/public/__tests__/usePublicEventLogo.test.tsx +690 -0
  766. package/src/hooks/public/__tests__/usePublicRouteParams.test.tsx +449 -0
  767. package/src/hooks/public/index.ts +34 -0
  768. package/src/hooks/public/usePublicEvent.ts +261 -0
  769. package/src/hooks/public/usePublicEventLogo.ts +285 -0
  770. package/src/hooks/public/usePublicRouteParams.ts +259 -0
  771. package/src/hooks/useAppConfig.ts +94 -0
  772. package/src/hooks/useComponentPerformance.ts +39 -0
  773. package/src/hooks/useDataTablePerformance.ts +387 -0
  774. package/src/hooks/useDataTableState.ts +110 -0
  775. package/src/hooks/useDebounce.ts +18 -0
  776. package/src/hooks/useFocusManagement.ts +161 -0
  777. package/src/hooks/useFocusTrap.ts +155 -0
  778. package/src/hooks/useInactivityTracker.ts +372 -0
  779. package/src/hooks/useIsMobile.ts +42 -0
  780. package/src/hooks/useKeyboardShortcuts.ts +237 -0
  781. package/src/hooks/useOrganisationPermissions.ts +208 -0
  782. package/src/hooks/useOrganisationSecurity.ts +262 -0
  783. package/src/hooks/usePerformanceMonitor.ts +128 -0
  784. package/src/hooks/usePermissionCache.ts +455 -0
  785. package/src/hooks/useRBAC.ts +262 -0
  786. package/src/hooks/useSecureDataAccess.ts +586 -0
  787. package/src/hooks/useStorage.ts +274 -0
  788. package/src/hooks/useToast.ts +242 -0
  789. package/src/hooks/useZodForm.ts +28 -0
  790. package/src/index.ts +200 -0
  791. package/src/providers/AuthProvider.tsx +369 -0
  792. package/src/providers/EventProvider.tsx +324 -0
  793. package/src/providers/InactivityProvider.tsx +238 -0
  794. package/src/providers/OrganisationProvider.tsx +588 -0
  795. package/src/providers/RBACProvider.tsx +622 -0
  796. package/src/providers/UnifiedAuthProvider.tsx +327 -0
  797. package/src/providers/__tests__/EventProvider.unit.test.tsx +768 -0
  798. package/src/providers/__tests__/OrganisationProvider.basic.test.tsx +116 -0
  799. package/src/providers/__tests__/OrganisationProvider.unit.test.tsx +1312 -0
  800. package/src/providers/__tests__/UnifiedAuthProvider.inactivity.test.tsx +601 -0
  801. package/src/providers/__tests__/UnifiedAuthProvider.unit.test.tsx +675 -0
  802. package/src/providers/__tests__/index.unit.test.ts +78 -0
  803. package/src/providers/index.ts +15 -0
  804. package/src/rbac/README.md +885 -0
  805. package/src/rbac/__tests__/PagePermissionGuard.test.tsx +673 -0
  806. package/src/rbac/__tests__/README.md +170 -0
  807. package/src/rbac/__tests__/RoleBasedRouter.test.tsx +709 -0
  808. package/src/rbac/__tests__/TestContext.tsx +72 -0
  809. package/src/rbac/__tests__/__mocks__/cache.ts +144 -0
  810. package/src/rbac/__tests__/__mocks__/supabase.ts +152 -0
  811. package/src/rbac/__tests__/adapters-hooks-comprehensive.test.tsx +782 -0
  812. package/src/rbac/__tests__/adapters-hooks.test.tsx +561 -0
  813. package/src/rbac/__tests__/adapters.comprehensive.test.tsx +963 -0
  814. package/src/rbac/__tests__/adapters.test.tsx +444 -0
  815. package/src/rbac/__tests__/api.test.ts +620 -0
  816. package/src/rbac/__tests__/audit-observability-comprehensive.test.ts +792 -0
  817. package/src/rbac/__tests__/audit-observability.test.ts +549 -0
  818. package/src/rbac/__tests__/audit.test.ts +616 -0
  819. package/src/rbac/__tests__/build-contract-compliance-simple.test.ts +230 -0
  820. package/src/rbac/__tests__/cache-invalidation-comprehensive.test.ts +889 -0
  821. package/src/rbac/__tests__/cache-invalidation.test.ts +457 -0
  822. package/src/rbac/__tests__/cache.test.ts +458 -0
  823. package/src/rbac/__tests__/components-navigation-guard.enhanced.test.tsx +859 -0
  824. package/src/rbac/__tests__/components-navigation-guard.test.tsx +895 -0
  825. package/src/rbac/__tests__/components-navigation-provider.test.tsx +692 -0
  826. package/src/rbac/__tests__/components-page-permission-guard.test.tsx +673 -0
  827. package/src/rbac/__tests__/components-page-permission-provider.test.tsx +614 -0
  828. package/src/rbac/__tests__/components-permission-enforcer.enhanced.fixed.test.tsx +836 -0
  829. package/src/rbac/__tests__/components-permission-enforcer.enhanced.test.tsx +837 -0
  830. package/src/rbac/__tests__/components-permission-enforcer.test.tsx +825 -0
  831. package/src/rbac/__tests__/components-role-based-router.test.tsx +709 -0
  832. package/src/rbac/__tests__/components-secure-data-provider.test.tsx +607 -0
  833. package/src/rbac/__tests__/config.test.ts +583 -0
  834. package/src/rbac/__tests__/core-logic-unit.test.ts +190 -0
  835. package/src/rbac/__tests__/core-permission-logic-comprehensive.test.ts +1467 -0
  836. package/src/rbac/__tests__/core-permission-logic-fixed.test.ts +151 -0
  837. package/src/rbac/__tests__/core-permission-logic-simple.test.ts +968 -0
  838. package/src/rbac/__tests__/core-permission-logic.test.ts +966 -0
  839. package/src/rbac/__tests__/edge-cases-comprehensive.test.ts +988 -0
  840. package/src/rbac/__tests__/edge-cases.test.ts +654 -0
  841. package/src/rbac/__tests__/engine.test.ts +361 -0
  842. package/src/rbac/__tests__/engine.unit.test.ts +361 -0
  843. package/src/rbac/__tests__/hooks.enhanced.test.tsx +979 -0
  844. package/src/rbac/__tests__/hooks.fixed.test.tsx +475 -0
  845. package/src/rbac/__tests__/hooks.test.tsx +385 -0
  846. package/src/rbac/__tests__/index.test.ts +269 -0
  847. package/src/rbac/__tests__/integration.enhanced.test.tsx +824 -0
  848. package/src/rbac/__tests__/page-permission-guard-super-admin.test.tsx +261 -0
  849. package/src/rbac/__tests__/performance.enhanced.test.tsx +724 -0
  850. package/src/rbac/__tests__/permissions.test.ts +383 -0
  851. package/src/rbac/__tests__/requires-event.test.ts +330 -0
  852. package/src/rbac/__tests__/scope-isolation-comprehensive.test.ts +1349 -0
  853. package/src/rbac/__tests__/scope-isolation.test.ts +755 -0
  854. package/src/rbac/__tests__/secure-client-rls-comprehensive.test.ts +592 -0
  855. package/src/rbac/__tests__/secure-client-rls.test.ts +377 -0
  856. package/src/rbac/__tests__/security.test.ts +296 -0
  857. package/src/rbac/__tests__/setup.ts +228 -0
  858. package/src/rbac/__tests__/test-utils-enhanced.tsx +400 -0
  859. package/src/rbac/__tests__/types.test.ts +685 -0
  860. package/src/rbac/adapters.tsx +726 -0
  861. package/src/rbac/api.ts +337 -0
  862. package/src/rbac/audit-enhanced.ts +339 -0
  863. package/src/rbac/audit.ts +338 -0
  864. package/src/rbac/cache.ts +213 -0
  865. package/src/rbac/components/EnhancedNavigationMenu.tsx +294 -0
  866. package/src/rbac/components/NavigationGuard.tsx +294 -0
  867. package/src/rbac/components/NavigationProvider.tsx +314 -0
  868. package/src/rbac/components/PagePermissionGuard.tsx +430 -0
  869. package/src/rbac/components/PagePermissionProvider.tsx +274 -0
  870. package/src/rbac/components/PermissionEnforcer.tsx +307 -0
  871. package/src/rbac/components/RoleBasedRouter.tsx +425 -0
  872. package/src/rbac/components/SecureDataProvider.tsx +319 -0
  873. package/src/rbac/components/__tests__/EnhancedNavigationMenu.test.tsx +631 -0
  874. package/src/rbac/components/__tests__/NavigationProvider.test.tsx +667 -0
  875. package/src/rbac/components/__tests__/PagePermissionProvider.test.tsx +647 -0
  876. package/src/rbac/components/__tests__/SecureDataProvider.test.tsx +496 -0
  877. package/src/rbac/components/index.ts +64 -0
  878. package/src/rbac/config.ts +133 -0
  879. package/src/rbac/docs/event-based-apps.md +285 -0
  880. package/src/rbac/engine.ts +1026 -0
  881. package/src/rbac/eslint-rules.js +285 -0
  882. package/src/rbac/examples/CompleteRBACExample.tsx +323 -0
  883. package/src/rbac/examples/EventBasedApp.tsx +238 -0
  884. package/src/rbac/hooks.ts +555 -0
  885. package/src/rbac/index.ts +114 -0
  886. package/src/rbac/permissions.ts +293 -0
  887. package/src/rbac/secureClient.ts +244 -0
  888. package/src/rbac/security.ts +346 -0
  889. package/src/rbac/testing/__tests__/index.test.tsx +342 -0
  890. package/src/rbac/testing/index.tsx +340 -0
  891. package/src/rbac/types.ts +341 -0
  892. package/src/rbac/utils/__tests__/eventContext.test.ts +428 -0
  893. package/src/rbac/utils/__tests__/eventContext.unit.test.ts +428 -0
  894. package/src/rbac/utils/eventContext.ts +83 -0
  895. package/src/styles/__tests__/styles.unit.test.ts +164 -0
  896. package/src/styles/core.css +401 -0
  897. package/src/styles/index.ts +51 -0
  898. package/src/test-dom-cleanup.test.tsx +38 -0
  899. package/src/theming/__tests__/README.md +335 -0
  900. package/src/theming/__tests__/runtime.accessibility.test.ts +474 -0
  901. package/src/theming/__tests__/runtime.error.test.ts +616 -0
  902. package/src/theming/__tests__/runtime.integration.test.ts +376 -0
  903. package/src/theming/__tests__/runtime.performance.test.ts +411 -0
  904. package/src/theming/__tests__/runtime.unit.test.ts +470 -0
  905. package/src/theming/runtime.ts +187 -0
  906. package/src/types/__tests__/database.unit.test.ts +489 -0
  907. package/src/types/__tests__/guards.unit.test.ts +146 -0
  908. package/src/types/__tests__/index.unit.test.ts +77 -0
  909. package/src/types/__tests__/organisation.unit.test.ts +713 -0
  910. package/src/types/__tests__/rbac.unit.test.ts +621 -0
  911. package/src/types/__tests__/security.unit.test.ts +347 -0
  912. package/src/types/__tests__/supabase.unit.test.ts +658 -0
  913. package/src/types/__tests__/theme.unit.test.ts +218 -0
  914. package/src/types/__tests__/unified.unit.test.ts +537 -0
  915. package/src/types/__tests__/validation.unit.test.ts +616 -0
  916. package/src/types/database.ts +472 -0
  917. package/src/types/guards.ts +30 -0
  918. package/src/types/index.ts +25 -0
  919. package/src/types/organisation.ts +184 -0
  920. package/src/types/security.ts +70 -0
  921. package/src/types/supabase.ts +166 -0
  922. package/src/types/theme.ts +6 -0
  923. package/src/types/unified.ts +262 -0
  924. package/src/types/validation.ts +164 -0
  925. package/src/types/vitest-globals.d.ts +43 -0
  926. package/src/utils/__mocks__/supabaseMock.ts +75 -0
  927. package/src/utils/__mocks__/supabaseMock.tsx +198 -0
  928. package/src/utils/__tests__/appConfig.unit.test.ts +55 -0
  929. package/src/utils/__tests__/appNameResolver.unit.test.ts +137 -0
  930. package/src/utils/__tests__/audit.unit.test.ts +69 -0
  931. package/src/utils/__tests__/auth-utils.unit.test.ts +70 -0
  932. package/src/utils/__tests__/bundleAnalysis.unit.test.ts +317 -0
  933. package/src/utils/__tests__/cn.unit.test.ts +34 -0
  934. package/src/utils/__tests__/deviceFingerprint.unit.test.ts +480 -0
  935. package/src/utils/__tests__/dynamicUtils.unit.test.ts +322 -0
  936. package/src/utils/__tests__/formatDate.unit.test.ts +109 -0
  937. package/src/utils/__tests__/formatting.unit.test.ts +66 -0
  938. package/src/utils/__tests__/index.unit.test.ts +251 -0
  939. package/src/utils/__tests__/lazyLoad.unit.test.tsx +309 -0
  940. package/src/utils/__tests__/organisationContext.unit.test.ts +192 -0
  941. package/src/utils/__tests__/performanceBudgets.unit.test.ts +259 -0
  942. package/src/utils/__tests__/permissionTypes.unit.test.ts +250 -0
  943. package/src/utils/__tests__/permissionUtils.unit.test.ts +362 -0
  944. package/src/utils/__tests__/sanitization.unit.test.ts +346 -0
  945. package/src/utils/__tests__/schemaUtils.unit.test.ts +441 -0
  946. package/src/utils/__tests__/secureDataAccess.unit.test.ts +334 -0
  947. package/src/utils/__tests__/secureErrors.unit.test.ts +377 -0
  948. package/src/utils/__tests__/secureStorage.unit.test.ts +293 -0
  949. package/src/utils/__tests__/security.unit.test.ts +127 -0
  950. package/src/utils/__tests__/securityMonitor.unit.test.ts +280 -0
  951. package/src/utils/__tests__/sessionTracking.unit.test.ts +370 -0
  952. package/src/utils/__tests__/validation.unit.test.ts +84 -0
  953. package/src/utils/__tests__/validationUtils.unit.test.ts +571 -0
  954. package/src/utils/appConfig.ts +47 -0
  955. package/src/utils/appIdResolver.ts +130 -0
  956. package/src/utils/appNameResolver.ts +190 -0
  957. package/src/utils/audit.ts +127 -0
  958. package/src/utils/auth-utils.ts +96 -0
  959. package/src/utils/bundleAnalysis.ts +129 -0
  960. package/src/utils/cn.ts +7 -0
  961. package/src/utils/debugLogger.ts +46 -0
  962. package/src/utils/deviceFingerprint.ts +215 -0
  963. package/src/utils/dynamicUtils.ts +105 -0
  964. package/src/utils/formatting.ts +77 -0
  965. package/src/utils/index.ts +145 -0
  966. package/src/utils/lazyLoad.tsx +44 -0
  967. package/src/utils/organisationContext.ts +135 -0
  968. package/src/utils/performanceBenchmark.ts +64 -0
  969. package/src/utils/performanceBudgets.ts +111 -0
  970. package/src/utils/permissionTypes.ts +37 -0
  971. package/src/utils/permissionUtils.ts +31 -0
  972. package/src/utils/print/PrintDataProcessor.ts +390 -0
  973. package/src/utils/print/__tests__/PrintDataProcessor.unit.test.ts +219 -0
  974. package/src/utils/print/__tests__/usePrintOptimization.unit.test.tsx +353 -0
  975. package/src/utils/print/examples/PrintUtilitiesShowcase.tsx +397 -0
  976. package/src/utils/print/index.ts +29 -0
  977. package/src/utils/print/types.ts +196 -0
  978. package/src/utils/print/usePrintOptimization.ts +272 -0
  979. package/src/utils/sanitization.ts +264 -0
  980. package/src/utils/schemaUtils.ts +37 -0
  981. package/src/utils/secureDataAccess.ts +361 -0
  982. package/src/utils/secureErrors.ts +79 -0
  983. package/src/utils/secureStorage.ts +244 -0
  984. package/src/utils/security.ts +156 -0
  985. package/src/utils/securityMonitor.ts +45 -0
  986. package/src/utils/sessionTracking.ts +170 -0
  987. package/src/utils/storage/README.md +348 -0
  988. package/src/utils/storage/__tests__/config.unit.test.ts +206 -0
  989. package/src/utils/storage/__tests__/helpers.unit.test.ts +646 -0
  990. package/src/utils/storage/__tests__/index.unit.test.ts +167 -0
  991. package/src/utils/storage/__tests__/types.unit.test.ts +441 -0
  992. package/src/utils/storage/config.ts +100 -0
  993. package/src/utils/storage/helpers.ts +359 -0
  994. package/src/utils/storage/index.ts +36 -0
  995. package/src/utils/storage/types.ts +90 -0
  996. package/src/utils/validation.ts +111 -0
  997. package/src/utils/validationUtils.ts +120 -0
  998. package/src/validation/__tests__/common.unit.test.ts +101 -0
  999. package/src/validation/__tests__/csrf.unit.test.ts +302 -0
  1000. package/src/validation/__tests__/passwordSchema.unit.test.ts +98 -0
  1001. package/src/validation/__tests__/sqlInjectionProtection.unit.test.ts +466 -0
  1002. package/src/validation/common.ts +53 -0
  1003. package/src/validation/csrf.ts +214 -0
  1004. package/src/validation/index.ts +43 -0
  1005. package/src/validation/passwordSchema.ts +125 -0
  1006. package/src/validation/sanitization.ts +96 -0
  1007. package/src/validation/schemaUtils.ts +42 -0
  1008. package/src/validation/sqlInjectionProtection.ts +242 -0
  1009. package/src/validation/user.ts +34 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/Card/Card.tsx","../src/components/Label/Label.tsx","../src/components/Avatar/Avatar.tsx","../src/components/Progress/Progress.tsx","../src/components/Toast/Toast.tsx","../src/components/Form/Form.tsx","../src/components/LoginForm/LoginForm.tsx","../src/components/EventSelector/EventSelector.tsx","../src/components/PasswordReset/PasswordChangeForm.tsx","../src/components/Button/index.ts","../src/components/UserMenu/UserMenu.tsx","../src/components/NavigationMenu/NavigationMenu.tsx","../src/components/Header/Header.tsx","../src/components/Footer/Footer.tsx","../src/components/PaceAppLayout/PaceAppLayout.tsx","../src/components/PaceLoginPage/PaceLoginPage.tsx","../src/components/ErrorBoundary/ErrorBoundary.tsx","../src/components/OrganisationSelector/OrganisationSelector.tsx","../src/components/PasswordReset/PasswordResetForm.tsx","../src/utils/storage/config.ts","../src/utils/storage/helpers.ts","../src/hooks/useStorage.ts","../src/components/FileUpload/FileUpload.tsx","../src/components/PublicLayout/EventLogo.tsx","../src/components/PublicLayout/PublicPageHeader.tsx","../src/components/PublicLayout/PublicPageFooter.tsx","../src/components/PublicLayout/PublicLoadingSpinner.tsx","../src/components/PublicLayout/PublicPageLayout.tsx","../src/components/PublicLayout/PublicPageDebugger.tsx","../src/components/PublicLayout/PublicPageDiagnostic.tsx","../src/components/PublicLayout/PublicPageContextChecker.tsx"],"sourcesContent":["/**\n * @file Card Component Suite\n * @package @jmruthers/pace-core\n * @module Components\n * @since 0.1.0\n *\n * A flexible card component suite for displaying content with consistent styling.\n * Includes Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter, CardActions, and HoverCard variants.\n * Uses semantic HTML elements for better accessibility and structure.\n *\n * Features:\n * - Semantic HTML structure (article, header, main, footer, etc.)\n * - Modular card structure (header, content, footer, actions, etc.)\n * - CardContent uses main element for primary content (accessible when nested)\n * - Consistent padding, border, and shadow\n * - Responsive and accessible\n * - HoverCard for popover-style cards\n * - Proper heading hierarchy and semantic elements\n *\n * @example\n * ```tsx\n * // Basic card with semantic HTML structure\n * <Card>\n * <CardHeader>\n * <CardTitle>Article Title</CardTitle>\n * <CardDescription>Brief description of the article content</CardDescription>\n * </CardHeader>\n * <CardContent>\n * <p>Main content goes here with proper semantic structure.</p>\n * <p>Additional paragraphs and content.</p>\n * </CardContent>\n * <CardFooter>\n * <CardActions>\n * <Button>Primary Action</Button>\n * <Button variant=\"outline\">Secondary Action</Button>\n * </CardActions>\n * </CardFooter>\n * </Card>\n *\n * // Semantic HTML structure:\n * // - Card: <article> element for self-contained content\n * // - CardHeader: <header> element for card heading area\n * // - CardContent: <main> element for primary card content\n * // - CardFooter: <footer> element for card footer area\n * // - CardActions: <nav> element for action buttons\n *\n * // HoverCard usage with semantic structure\n * <HoverCard>\n * <HoverCardTrigger>Hover me</HoverCardTrigger>\n * <HoverCardContent>\n * <p>Popover content with semantic elements</p>\n * </HoverCardContent>\n * </HoverCard>\n * ```\n *\n * @accessibility\n * - Uses semantic HTML structure (article, header, main, footer, nav)\n * - Focusable and keyboard accessible\n * - Proper heading hierarchy for screen readers\n * - HoverCard supports mouse and keyboard interaction\n * - Screen reader friendly with semantic landmarks\n */\n\nimport * as React from \"react\"\nimport { cn } from \"../../utils/cn\"\n\nexport interface CardProps extends React.HTMLAttributes<HTMLElement> {\n /** Visual variant of the card */\n variant?: 'default' | 'outline' | 'ghost';\n /** Size of the card */\n size?: 'default' | 'sm' | 'lg';\n}\n\n/**\n * Get card classes based on variant and size\n */\nfunction getCardClasses(variant: CardProps['variant'] = 'default', size: CardProps['size'] = 'default'): string {\n const baseClasses = \"rounded-lg border bg-card text-card-foreground shadow-sm\";\n \n const variantClasses = {\n default: \"shadow-xl\",\n outline: \"border-2\",\n ghost: \"border-0 shadow-none\"\n };\n \n const sizeClasses = {\n default: \"\",\n sm: \"text-sm\",\n lg: \"text-lg\"\n };\n \n return `${baseClasses} ${variantClasses[variant]} ${sizeClasses[size]}`;\n}\n\nconst Card = React.forwardRef<\n HTMLElement,\n CardProps\n>(({ className, variant, size, ...props }, ref) => (\n <article\n ref={ref}\n className={cn(\n \"grid grid-rows-[auto_1fr_auto] min-w-0 overflow-visible\",\n getCardClasses(variant, size),\n className\n )}\n {...props}\n />\n))\nCard.displayName = \"Card\"\n\nconst CardHeader = React.forwardRef<\n HTMLElement,\n React.HTMLAttributes<HTMLElement>\n>(({ className, ...props }, ref) => (\n <header\n ref={ref}\n className={cn(\"flex flex-col space-y-1.5 p-6 min-w-0 w-full\", className)}\n {...props}\n />\n))\nCardHeader.displayName = \"CardHeader\"\n\nconst CardTitle = React.forwardRef<\n HTMLHeadingElement,\n React.HTMLAttributes<HTMLHeadingElement>\n>(({ className, ...props }, ref) => (\n <h3\n ref={ref}\n className={cn(\n 'text-2xl font-semibold leading-none tracking-tight',\n className\n )}\n {...props}\n />\n))\nCardTitle.displayName = \"CardTitle\"\n\nconst CardDescription = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, ...props }, ref) => (\n <p\n ref={ref}\n className={cn(className)}\n {...props}\n />\n))\nCardDescription.displayName = \"CardDescription\"\n\nconst CardContent = React.forwardRef<\n HTMLElement,\n React.HTMLAttributes<HTMLElement>\n>(({ className, ...props }, ref) => (\n <main \n ref={ref} \n className={cn(\"p-6 pt-0 min-w-0 w-full\", className)} \n {...props} \n />\n))\nCardContent.displayName = \"CardContent\"\n\nconst CardFooter = React.forwardRef<\n HTMLElement,\n React.HTMLAttributes<HTMLElement>\n>(({ className, ...props }, ref) => (\n <footer\n ref={ref}\n className={cn(\"flex items-center p-6 pt-0 min-w-0 w-full\", className)}\n {...props}\n />\n))\nCardFooter.displayName = \"CardFooter\"\n\nconst CardActions = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, ...props }, ref) => (\n <nav\n ref={ref}\n className={cn(\"flex gap-2\", className)}\n role=\"group\"\n aria-label=\"Card actions\"\n {...props}\n />\n))\nCardActions.displayName = \"CardActions\"\n\n// HoverCard components - improved with semantic structure\nconst HoverCard = React.forwardRef<\n HTMLElement,\n React.HTMLAttributes<HTMLElement> & { children: React.ReactNode }\n>(({ children, className, ...props }, ref) => {\n return (\n <section\n ref={ref}\n className={cn(\"relative inline-block\", className)}\n {...props}\n >\n {children}\n </section>\n );\n});\nHoverCard.displayName = \"HoverCard\"\n\nconst HoverCardTrigger = React.forwardRef<\n HTMLButtonElement,\n React.ButtonHTMLAttributes<HTMLButtonElement> & { asChild?: boolean }\n>(({ className, asChild, children, ...props }, ref) => {\n if (asChild) {\n return (\n <span className={cn(\"cursor-pointer\", className)}>\n {children}\n </span>\n );\n }\n \n return (\n <button\n ref={ref}\n type=\"button\"\n className={cn(\n \"cursor-pointer bg-transparent border-0 p-0 m-0 font-inherit color-inherit text-left\",\n className\n )}\n {...props}\n >\n {children}\n </button>\n )\n})\nHoverCardTrigger.displayName = \"HoverCardTrigger\"\n\nconst HoverCardContent = React.forwardRef<\n HTMLElement,\n React.HTMLAttributes<HTMLElement>\n>(({ className, ...props }, ref) => (\n <aside\n ref={ref}\n className={cn(\n \"absolute z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-4 text-popover-foreground shadow-md\",\n className\n )}\n role=\"tooltip\"\n {...props}\n />\n))\nHoverCardContent.displayName = \"HoverCardContent\"\n\nexport { \n Card, \n CardHeader, \n CardFooter, \n CardTitle, \n CardDescription, \n CardContent,\n CardActions,\n HoverCard,\n HoverCardTrigger,\n HoverCardContent\n}\n\n// Export types with correct semantic element types\nexport type CardHeaderProps = React.HTMLAttributes<HTMLElement>;\nexport type CardTitleProps = React.HTMLAttributes<HTMLHeadingElement>;\nexport type CardDescriptionProps = React.HTMLAttributes<HTMLParagraphElement>;\nexport type CardContentProps = React.HTMLAttributes<HTMLElement>;\nexport type CardFooterProps = React.HTMLAttributes<HTMLElement>;\nexport type CardActionsProps = React.HTMLAttributes<HTMLElement>;\nexport type HoverCardProps = React.HTMLAttributes<HTMLElement>;\nexport type HoverCardTriggerProps = React.ButtonHTMLAttributes<HTMLButtonElement> & { asChild?: boolean };\nexport type HoverCardContentProps = React.HTMLAttributes<HTMLElement>;\n","/**\n * @file Label Component\n * @package @jmruthers/pace-core\n * @module Components/Label\n * @since 0.1.0\n *\n * An accessible label component built on top of Radix UI primitives.\n * Provides form labels with helper text, error states, and required indicators.\n *\n * Features:\n * - Proper label association with form controls\n * - Required field indicators\n * - Helper text support\n * - Error state display\n * - Customizable styling\n * - Screen reader friendly\n * - Keyboard accessible\n *\n * @example\n * ```tsx\n * // Basic label\n * <Label htmlFor=\"email\">Email Address</Label>\n * <Input id=\"email\" type=\"email\" />\n * \n * // Label with required indicator\n * <Label htmlFor=\"name\" required>\n * Full Name\n * </Label>\n * <Input id=\"name\" />\n * \n * // Label with helper text\n * <Label \n * htmlFor=\"password\" \n * required \n * helperText=\"Must be at least 8 characters\"\n * >\n * Password\n * </Label>\n * <Input id=\"password\" type=\"password\" />\n * \n * // Label with error state\n * <Label \n * htmlFor=\"email\" \n * error=\"Please enter a valid email address\"\n * >\n * Email Address\n * </Label>\n * <Input id=\"email\" type=\"email\" />\n * \n * // Custom required indicator\n * <Label \n * htmlFor=\"terms\" \n * required \n * requiredIndicator=\"(required)\"\n * >\n * Accept Terms\n * </Label>\n * <Checkbox id=\"terms\" />\n * ```\n *\n * @accessibility\n * - WCAG 2.1 AA compliant\n * - Proper label association with htmlFor\n * - Screen reader announcements for errors\n * - Required field indicators for screen readers\n * - Error messages with role=\"alert\"\n * - High contrast support\n *\n * @dependencies\n * - @radix-ui/react-label - Core label functionality\n * - class-variance-authority - Variant styling\n * - React 18+ - Hooks and refs\n * - Tailwind CSS - Styling\n */\n\nimport * as React from 'react';\nimport * as LabelPrimitive from '@radix-ui/react-label';\nimport { cn } from '../../utils/cn';\n\nconst getLabelClasses = (): string => {\n return 'font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70';\n};\n\n/**\n * Props for the Label component\n */\nexport interface LabelProps\n extends React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> {\n /** Whether the field is required */\n required?: boolean;\n /** Custom required indicator (default: '*') */\n requiredIndicator?: React.ReactNode;\n /** Whether to hide the required indicator visually */\n hideRequiredIndicator?: boolean;\n /** Helper text to display below the label */\n helperText?: string;\n /** CSS classes for helper text styling */\n helperTextClassName?: string;\n /** Error message to display */\n error?: string;\n /** CSS classes for error message styling */\n errorClassName?: string;\n}\n\n/**\n * Label component\n * An accessible label with helper text and error state support\n * \n * @param props - Label configuration and styling\n * @param ref - Forwarded ref to the label element\n * @returns JSX.Element - The rendered label with optional helper text and errors\n * \n * @example\n * ```tsx\n * <Label htmlFor=\"email\" required helperText=\"We'll never share your email\">\n * Email Address\n * </Label>\n * ```\n */\nconst Label = React.forwardRef<\n React.ElementRef<typeof LabelPrimitive.Root>,\n LabelProps\n>(({\n className,\n required = false,\n requiredIndicator,\n hideRequiredIndicator = false,\n helperText,\n helperTextClassName,\n error,\n errorClassName,\n children,\n htmlFor,\n ...props\n}, ref) => {\n const hasError = !!error;\n const showHelperText = helperText && !hasError;\n \n return (\n <>\n <LabelPrimitive.Root\n ref={ref}\n className={cn(\n getLabelClasses(),\n hasError && 'text-destructive',\n className\n )}\n htmlFor={htmlFor}\n {...props}\n >\n {children}\n {required && (\n <label\n aria-label=\"required\"\n className={cn(\n 'text-destructive ml-1',\n hideRequiredIndicator && 'sr-only'\n )}\n >\n {requiredIndicator || '*'}\n </label>\n )}\n </LabelPrimitive.Root>\n \n {showHelperText && (\n <p className={cn('text-muted-foreground', helperTextClassName)}>\n {helperText}\n </p>\n )}\n \n {hasError && (\n <p\n role=\"alert\"\n aria-live=\"polite\"\n className={cn('text-destructive', errorClassName)}\n >\n {error}\n </p>\n )}\n </>\n );\n});\n\nLabel.displayName = LabelPrimitive.Root.displayName;\n\nexport { Label };\n","/**\n * @file Avatar Component Suite\n * @package @jmruthers/pace-core\n * @module Components\n * @since 0.1.0\n *\n * A flexible and accessible avatar component for displaying user profile images or initials.\n * Includes Avatar, AvatarImage, and AvatarFallback subcomponents.\n *\n * Features:\n * - Circular avatar display\n * - Image, fallback, and initials support\n * - Customizable size and style\n * - Keyboard and screen reader accessible\n * - Graceful fallback for missing images\n *\n * @example\n * ```tsx\n * // Basic avatar with image\n * <Avatar>\n * <AvatarImage src=\"/user.jpg\" alt=\"User\" />\n * <AvatarFallback>AB</AvatarFallback>\n * </Avatar>\n *\n * // Avatar with fallback only\n * <Avatar>\n * <AvatarFallback>JD</AvatarFallback>\n * </Avatar>\n * ```\n *\n * @accessibility\n * - Uses alt text for images\n * - Fallback content is accessible to screen readers\n * - Keyboard focusable and navigable\n */\n\nimport * as React from \"react\"\nimport * as AvatarPrimitive from \"@radix-ui/react-avatar\"\n\nimport { cn } from \"../../utils/cn\"\n\nconst Avatar = React.forwardRef<\n React.ElementRef<typeof AvatarPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>\n>(({ className, ...props }, ref) => (\n <AvatarPrimitive.Root\n ref={ref}\n className={cn(\n \"relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full\",\n className\n )}\n {...props}\n />\n))\nAvatar.displayName = AvatarPrimitive.Root.displayName\n\nconst AvatarImage = React.forwardRef<\n React.ElementRef<typeof AvatarPrimitive.Image>,\n React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>\n>(({ className, ...props }, ref) => (\n <AvatarPrimitive.Image\n ref={ref}\n className={cn(\"object-cover\", className)}\n {...props}\n />\n))\nAvatarImage.displayName = AvatarPrimitive.Image.displayName\n\nconst AvatarFallback = React.forwardRef<\n React.ElementRef<typeof AvatarPrimitive.Fallback>,\n React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>\n>(({ className, ...props }, ref) => (\n <AvatarPrimitive.Fallback\n ref={ref}\n className={cn(\n \"flex h-full w-full items-center justify-center rounded-full text-sec-50 bg-sec-500\",\n className\n )}\n {...props}\n />\n))\nAvatarFallback.displayName = AvatarPrimitive.Fallback.displayName\n\nexport { Avatar, AvatarImage, AvatarFallback }\n","/**\n * @file Progress Component\n * @package @jmruthers/pace-core\n * @module Components/Progress\n * @since 0.1.0\n *\n * An accessible progress bar component built on top of Radix UI primitives.\n * Provides smooth animations and proper ARIA attributes for screen readers.\n *\n * Features:\n * - Smooth progress animations\n * - Customizable value and max range\n * - Proper ARIA attributes for accessibility\n * - Customizable styling and appearance\n * - Responsive design\n * - Keyboard accessible\n *\n * @example\n * ```tsx\n * // Basic progress bar\n * <Progress value={50} />\n * \n * // Progress with custom max value\n * <Progress value={7} max={10} />\n * \n * // Progress with custom styling\n * <Progress \n * value={75} \n * className=\"h-4 bg-sec-200\" \n * />\n * \n * // Animated progress (controlled)\n * const [progress, setProgress] = useState(0);\n * \n * useEffect(() => {\n * const timer = setInterval(() => {\n * setProgress(prev => prev >= 100 ? 0 : prev + 10);\n * }, 1000);\n * return () => clearInterval(timer);\n * }, []);\n * \n * <Progress value={progress} />\n * ```\n *\n * @accessibility\n * - WCAG 2.1 AA compliant\n * - Proper ARIA attributes (aria-valuenow, aria-valuemax, aria-valuemin)\n * - Screen reader announcements for progress changes\n * - Keyboard navigation support\n * - High contrast support\n *\n * @performance\n * - CSS transitions for smooth animations\n * - Efficient re-rendering\n * - Minimal DOM structure\n *\n * @dependencies\n * - @radix-ui/react-progress - Core progress functionality\n * - React 18+ - Hooks and refs\n * - Tailwind CSS - Styling\n */\n\nimport * as React from 'react';\nimport * as ProgressPrimitive from '@radix-ui/react-progress';\nimport { cn } from '../../utils/cn';\n\n/**\n * Props for the Progress component\n */\nexport interface ProgressProps extends React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root> {\n /** Current progress value (0 to max) */\n value?: number;\n /** Maximum progress value (default: 100) */\n max?: number;\n}\n\n/**\n * Progress component\n * An accessible progress bar with smooth animations\n * \n * @param props - Progress configuration and styling\n * @param ref - Forwarded ref to the progress element\n * @returns JSX.Element - The rendered progress bar\n * \n * @example\n * ```tsx\n * <Progress value={75} max={100} />\n * ```\n */\nconst Progress = React.forwardRef<\n React.ElementRef<typeof ProgressPrimitive.Root>,\n ProgressProps\n>(({ className, value, max = 100, ...props }, ref) => (\n <ProgressPrimitive.Root\n ref={ref}\n className={cn(\n 'relative h-2 w-full overflow-hidden rounded-full bg-primary/20',\n className\n )}\n {...props}\n value={value}\n max={max}\n aria-valuenow={value}\n aria-valuemax={max}\n aria-valuemin={0}\n >\n <ProgressPrimitive.Indicator\n className=\"h-full w-full flex-1 bg-primary transition-all\"\n style={{ transform: `translateX(-${100 - (value || 0)}%)` }}\n />\n </ProgressPrimitive.Root>\n));\n\nProgress.displayName = ProgressPrimitive.Root.displayName;\n\nexport { Progress };\n","/**\n * @file Toast Component System\n * @package @jmruthers/pace-core\n * @module Components/Toast\n * @since 0.1.0\n *\n * A comprehensive toast notification system built on top of Radix UI primitives.\n * Provides accessible, customizable toast notifications with smooth animations.\n *\n * Features:\n * - Multiple toast types (success, error, warning, info)\n * - Customizable positioning and styling\n * - Swipe gestures for dismissal\n * - Keyboard navigation support\n * - Auto-dismiss with configurable duration\n * - Action buttons and close functionality\n * - Responsive design\n * - Accessibility compliant\n * - Smooth animations and transitions\n * - Toast queue management\n *\n * @example\n * ```tsx\n * // Basic toast usage\n * import { useToast } from '@jmruthers/pace-core';\n * \n * function MyComponent() {\n * const { toast } = useToast();\n * \n * const handleSuccess = () => {\n * toast({\n * title: \"Success!\",\n * description: \"Your changes have been saved.\",\n * variant: \"success\"\n * });\n * };\n * \n * return <button onClick={handleSuccess}>Save Changes</button>;\n * }\n * \n * // Toast with action\n * toast({\n * title: \"Undo Changes\",\n * description: \"Your changes have been saved.\",\n * action: <ToastAction altText=\"Undo\">Undo</ToastAction>\n * });\n * \n * // Custom toast component\n * <Toast>\n * <ToastTitle>Custom Toast</ToastTitle>\n * <ToastDescription>This is a custom toast message.</ToastDescription>\n * <ToastClose />\n * </Toast>\n * \n * // Toast provider setup\n * function App() {\n * return (\n * <ToastProvider>\n * <YourApp />\n * <Toaster />\n * </ToastProvider>\n * );\n * }\n * ```\n *\n * @accessibility\n * - WCAG 2.1 AA compliant\n * - Proper ARIA attributes and roles\n * - Keyboard navigation support\n * - Screen reader announcements\n * - Focus management\n * - High contrast support\n * - Swipe gesture alternatives\n *\n * @performance\n * - Efficient toast queue management\n * - Optimized animations\n * - Memory leak prevention\n * - Lazy rendering\n *\n * @dependencies\n * - @radix-ui/react-toast - Core toast functionality\n * - lucide-react - Icons\n * - React 18+ - Hooks and refs\n * - Tailwind CSS - Styling\n */\n\nimport * as React from \"react\"\nimport * as ToastPrimitives from \"@radix-ui/react-toast\"\nimport { X } from \"lucide-react\"\nimport { cn } from \"../../utils/cn\"\n\nconst ToastProvider = ToastPrimitives.Provider\n\n/**\n * ToastViewport component\n * Container for all toast notifications with customizable positioning\n * \n * @param props - Viewport configuration and styling\n * @param ref - Forwarded ref to the viewport element\n * @returns JSX.Element - The toast viewport container\n */\nconst ToastViewport = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Viewport>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Viewport>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Viewport\n ref={ref}\n data-testid=\"toast-viewport\"\n className={cn(\n \"fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]\",\n className\n )}\n {...props}\n />\n))\nToastViewport.displayName = ToastPrimitives.Viewport.displayName\n\n/**\n * Toast component\n * The main toast notification component with animations and interactions\n * \n * @param props - Toast configuration and content\n * @param ref - Forwarded ref to the toast element\n * @returns JSX.Element - The rendered toast notification\n * \n * @example\n * ```tsx\n * <Toast>\n * <ToastTitle>Success!</ToastTitle>\n * <ToastDescription>Your changes have been saved.</ToastDescription>\n * <ToastClose />\n * </Toast>\n * ```\n */\nconst Toast = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Root>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Root>\n>(({ className, ...props }, ref) => {\n return (\n <ToastPrimitives.Root\n ref={ref}\n data-testid=\"toast-root\"\n className={cn(\n \"group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full\",\n className\n )}\n {...props}\n />\n )\n})\nToast.displayName = ToastPrimitives.Root.displayName\n\n/**\n * ToastAction component\n * Action button within a toast notification\n * \n * @param props - Action button configuration\n * @param ref - Forwarded ref to the action button\n * @returns JSX.Element - The action button element\n * \n * @example\n * ```tsx\n * <ToastAction altText=\"Undo changes\">Undo</ToastAction>\n * ```\n */\nconst ToastAction = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Action>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Action>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Action\n ref={ref}\n data-testid=\"toast-action\"\n className={cn(\n \"inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive\",\n className\n )}\n {...props}\n />\n))\nToastAction.displayName = ToastPrimitives.Action.displayName\n\n/**\n * ToastClose component\n * Close button for dismissing toast notifications\n * \n * @param props - Close button configuration\n * @param ref - Forwarded ref to the close button\n * @returns JSX.Element - The close button with X icon\n * \n * @example\n * ```tsx\n * <ToastClose />\n * ```\n */\nconst ToastClose = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Close>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Close>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Close\n ref={ref}\n data-testid=\"toast-close\"\n className={cn(\n \"absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-acc-300 group-[.destructive]:hover:text-acc-50 group-[.destructive]:focus:ring-acc-400 group-[.destructive]:focus:ring-offset-acc-600\",\n className\n )}\n toast-close=\"\"\n {...props}\n >\n <X className=\"h-4 w-4\" />\n </ToastPrimitives.Close>\n))\nToastClose.displayName = ToastPrimitives.Close.displayName\n\n/**\n * ToastTitle component\n * Title text for toast notifications\n * \n * @param props - Title configuration and styling\n * @param ref - Forwarded ref to the title element\n * @returns JSX.Element - The toast title\n * \n * @example\n * ```tsx\n * <ToastTitle>Success!</ToastTitle>\n * ```\n */\nconst ToastTitle = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Title>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Title>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Title\n ref={ref}\n data-testid=\"toast-title\"\n className={cn(\"text-sm font-semibold\", className)}\n {...props}\n />\n))\nToastTitle.displayName = ToastPrimitives.Title.displayName\n\n/**\n * ToastDescription component\n * Description text for toast notifications\n * \n * @param props - Description configuration and styling\n * @param ref - Forwarded ref to the description element\n * @returns JSX.Element - The toast description\n * \n * @example\n * ```tsx\n * <ToastDescription>Your changes have been saved successfully.</ToastDescription>\n * ```\n */\nconst ToastDescription = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Description>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Description>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Description\n ref={ref}\n data-testid=\"toast-description\"\n className={cn(\"text-sm opacity-90\", className)}\n {...props}\n />\n))\nToastDescription.displayName = ToastPrimitives.Description.displayName\n\nexport interface ToastProps extends React.ComponentPropsWithoutRef<typeof ToastPrimitives.Root> {}\n\nexport interface ToastActionElement extends React.ReactElement<typeof ToastAction> {}\n\n// Simple useToast hook\n/**\n * useToast hook\n * Hook for managing toast notifications\n * \n * @returns Object with toast and dismiss functions\n * \n * @example\n * ```tsx\n * const { toast, dismiss } = useToast();\n * \n * // Show a toast\n * toast({\n * title: \"Success!\",\n * description: \"Your changes have been saved.\"\n * });\n * \n * // Dismiss all toasts\n * dismiss();\n * ```\n */\nexport function useToast() {\n return {\n toast: (props: any) => {\n console.log('Toast:', props);\n },\n dismiss: () => {\n console.log('Toast dismissed');\n }\n };\n}\n\n// Simple Toaster component\n/**\n * Toaster component\n * Container component that provides the toast viewport\n * Should be placed at the root of your application\n * \n * @returns JSX.Element - The toast provider with viewport\n * \n * @example\n * ```tsx\n * function App() {\n * return (\n * <ToastProvider>\n * <YourApp />\n * <Toaster />\n * </ToastProvider>\n * );\n * }\n * ```\n */\nexport function Toaster() {\n return (\n <ToastProvider data-testid=\"toast-provider\">\n <ToastViewport />\n </ToastProvider>\n );\n}\n\nexport {\n ToastProvider,\n ToastViewport,\n Toast,\n ToastTitle,\n ToastDescription,\n ToastClose,\n ToastAction,\n}\n","/**\n * @file Form Component\n * @package @jmruthers/pace-core\n * @module Components/Form\n * @since 0.1.0\n *\n * A comprehensive form component with React Hook Form integration and Zod validation.\n * Provides a clean, accessible form interface with built-in validation and error handling.\n *\n * Features:\n * - React Hook Form integration for efficient form state management\n * - Zod schema validation with type safety\n * - Flexible rendering with children function or JSX\n * - Built-in error handling and validation modes\n * - Accessible form structure\n * - TypeScript support with generic field values\n * - Customizable styling and layout\n *\n * @example\n * ```tsx\n * // Basic form with schema validation\n * const userSchema = z.object({\n * name: z.string().min(2, \"Name must be at least 2 characters\"),\n * email: z.string().email(\"Invalid email address\"),\n * age: z.number().min(18, \"Must be at least 18 years old\")\n * });\n * \n * <Form\n * schema={userSchema}\n * defaultValues={{ name: \"\", email: \"\", age: 0 }}\n * onSubmit={(data) => console.log(data)}\n * onError={(errors) => console.error(errors)}\n * >\n * <FormField name=\"name\" label=\"Name\" />\n * <FormField name=\"email\" label=\"Email\" type=\"email\" />\n * <FormField name=\"age\" label=\"Age\" type=\"number\" />\n * <Button type=\"submit\">Submit</Button>\n * </Form>\n * \n * // Form with render function\n * <Form\n * schema={userSchema}\n * onSubmit={handleSubmit}\n * >\n * {(methods) => (\n * <>\n * <FormField name=\"name\" label=\"Name\" />\n * <FormField name=\"email\" label=\"Email\" />\n * <Button \n * type=\"submit\" \n * disabled={methods.formState.isSubmitting}\n * >\n * {methods.formState.isSubmitting ? \"Submitting...\" : \"Submit\"}\n * </Button>\n * </>\n * )}\n * </Form>\n * ```\n *\n * @accessibility\n * - Proper form structure with labels and descriptions\n * - Error announcements for screen readers\n * - Keyboard navigation support\n * - Focus management\n * - ARIA attributes for form validation\n *\n * @dependencies\n * - react-hook-form - Form state management\n * - @hookform/resolvers/zod - Zod validation integration\n * - zod - Schema validation\n * - React 18+ - Hooks and context\n */\n\nimport React from 'react';\nimport { useForm, FormProvider, UseFormReturn, FieldValues, DefaultValues, SubmitHandler, SubmitErrorHandler } from 'react-hook-form';\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport { z } from 'zod';\nimport { cn } from '../../utils/cn';\n\n/**\n * Props for the Form component\n */\nexport interface FormProps<TFieldValues extends FieldValues = FieldValues> {\n /**\n * Form schema for validation\n */\n schema?: z.ZodType<TFieldValues>;\n \n /**\n * Default values for the form\n */\n defaultValues?: DefaultValues<TFieldValues>;\n \n /**\n * Handler called when form is submitted successfully\n */\n onSubmit: SubmitHandler<TFieldValues>;\n \n /**\n * Handler called when form submission has errors\n */\n onError?: SubmitErrorHandler<TFieldValues>;\n \n /**\n * Form mode for react-hook-form\n * @default \"onSubmit\"\n */\n mode?: \"onSubmit\" | \"onChange\" | \"onBlur\" | \"onTouched\" | \"all\";\n \n /**\n * Children components or render function\n */\n children: React.ReactNode | ((methods: UseFormReturn<TFieldValues>) => React.ReactNode);\n \n /**\n * Class name for the form\n */\n className?: string;\n}\n\n/**\n * Form component with validation and React Hook Form integration\n * \n * @template TFieldValues - The type of form field values\n * @param props - Form configuration and handlers\n * @returns JSX.Element - The rendered form with FormProvider context\n * \n * @example\n * ```tsx\n * <Form\n * schema={userSchema}\n * defaultValues={{ name: \"\", email: \"\" }}\n * onSubmit={handleSubmit}\n * mode=\"onBlur\"\n * >\n * <FormField name=\"name\" label=\"Name\" />\n * <FormField name=\"email\" label=\"Email\" />\n * <Button type=\"submit\">Submit</Button>\n * </Form>\n * ```\n */\nexport function Form<TFieldValues extends FieldValues = FieldValues>({\n schema,\n defaultValues,\n onSubmit,\n onError,\n mode = \"onSubmit\",\n children,\n className,\n}: FormProps<TFieldValues>) {\n const methods = useForm<TFieldValues>({\n resolver: schema ? zodResolver(schema) : undefined,\n defaultValues,\n mode,\n });\n\n const handleSubmit = methods.handleSubmit(onSubmit, onError);\n\n return (\n <FormProvider {...methods}>\n <form onSubmit={handleSubmit} className={cn(\"space-y-4\", className)}>\n {typeof children === 'function' ? children(methods) : children}\n </form>\n </FormProvider>\n );\n}\n","/**\n * @file LoginForm Component\n * @package @jmruthers/pace-core\n * @module Components/LoginForm\n * @since 0.1.0\n *\n * A comprehensive login form component with built-in validation, error handling,\n * and loading states for user authentication.\n *\n * Features:\n * - Email and password validation\n * - Loading states with disabled form\n * - Error handling and display\n * - Customizable branding and messaging\n * - Sign-up link integration\n * - Performance optimized with React.memo\n * - Accessibility compliant\n * - Responsive design\n * - Form validation\n * - Success and error callbacks\n *\n * @example\n * ```tsx\n * // Basic login form\n * <LoginForm\n * onSignIn={async (data) => {\n * await signIn(data.email, data.password);\n * }}\n * onSuccess={() => navigate('/dashboard')}\n * onError={(error) => console.error('Login failed:', error)}\n * />\n * \n * // Login form with custom branding\n * <LoginForm\n * appName=\"My Application\"\n * title=\"Welcome Back\"\n * subtitle=\"Please sign in to access your account\"\n * onSignIn={handleSignIn}\n * onSuccess={handleSuccess}\n * onError={handleError}\n * />\n * \n * // Login form with sign-up integration\n * <LoginForm\n * appName=\"My App\"\n * showSignUp={true}\n * onSignUp={() => navigate('/signup')}\n * onSignIn={handleSignIn}\n * isLoading={isAuthenticating}\n * />\n * \n * // Login form with custom error handling\n * <LoginForm\n * onSignIn={async (data) => {\n * try {\n * const result = await authService.signIn(data);\n * if (result.success) {\n * onSuccess();\n * } else {\n * throw new Error(result.error);\n * }\n * } catch (error) {\n * onError(error);\n * }\n * }}\n * onSuccess={() => {\n * toast.success('Successfully signed in!');\n * navigate('/dashboard');\n * }}\n * onError={(error) => {\n * toast.error(`Sign in failed: ${error.message}`);\n * }}\n * />\n * ```\n *\n * @accessibility\n * - WCAG 2.1 AA compliant\n * - Proper form labels and associations\n * - Screen reader friendly error messages\n * - Keyboard navigation support\n * - Focus management\n * - High contrast support\n * - Clear error identification\n *\n * @performance\n * - React.memo for efficient re-rendering\n * - useCallback for stable event handlers\n * - useMemo for computed values\n * - Minimal re-renders\n *\n * @dependencies\n * - React 18+ - Hooks and memo\n * - Button component\n * - Input component\n * - Label component\n * - Card components\n * - Alert component\n * - Tailwind CSS - Styling\n */\n\nimport React, { useState, useCallback, useMemo } from 'react';\nimport { Button } from '../Button/Button';\nimport { Input } from '../Input/Input';\nimport { Label } from '../Label/Label';\nimport { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '../Card/index';\nimport { Alert, AlertDescription } from '../Alert/Alert';\nimport { cn } from '../../utils/cn';\n\nexport interface LoginFormProps {\n /** Callback invoked when the form is submitted */\n onSignIn: (data: { email: string; password: string }) => Promise<void>;\n /** Callback invoked on successful sign-in */\n onSuccess?: () => void;\n /** Callback invoked if sign-in fails */\n onError?: (error: Error) => void;\n /** Show loading spinner and disable form while true */\n isLoading?: boolean;\n /** Application name for display in the form */\n appName?: string;\n /** Custom title for the form */\n title?: string;\n /** Custom subtitle for the form */\n subtitle?: string;\n /** Show a sign-up link or button */\n showSignUp?: boolean;\n /** Optional callback for sign-up button */\n onSignUp?: () => void;\n /** Additional CSS classes */\n className?: string;\n}\n\n/**\n * LoginForm component that provides a ready-to-use authentication form for user sign-in.\n * It supports validation, loading state, error handling, and can be customized via props.\n * Now includes performance optimizations and onSignUp support.\n * \n * @param props - Login form configuration and handlers\n * @returns JSX.Element - The rendered login form\n * \n * @example\n * ```tsx\n * <LoginForm\n * onSignIn={handleSignIn}\n * onSuccess={() => navigate('/dashboard')}\n * onError={(error) => toast.error(error.message)}\n * isLoading={isAuthenticating}\n * />\n * ```\n */\nexport const LoginForm = React.memo<LoginFormProps>(({\n onSignIn,\n onSuccess,\n onError,\n isLoading = false,\n appName,\n title,\n subtitle,\n showSignUp = false,\n onSignUp,\n className\n}) => {\n const [formData, setFormData] = useState({ email: '', password: '' });\n const [error, setError] = useState<string | null>(null);\n\n // Memoized validation state\n const isFormValid = useMemo(() => {\n return formData.email.length > 0 && formData.password.length > 0;\n }, [formData.email, formData.password]);\n\n // Memoized handlers\n const handleEmailChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n setFormData(prev => ({ ...prev, email: e.target.value }));\n }, []);\n\n const handlePasswordChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n setFormData(prev => ({ ...prev, password: e.target.value }));\n }, []);\n\n const handleSubmit = useCallback(async (e: React.FormEvent) => {\n e.preventDefault();\n setError(null);\n if (!isFormValid || isLoading) return;\n try {\n await onSignIn(formData);\n onSuccess?.();\n } catch (err) {\n const errorMessage = err instanceof Error ? err.message : 'Sign in failed';\n setError(errorMessage);\n onError?.(err instanceof Error ? err : new Error(errorMessage));\n }\n }, [formData, isFormValid, isLoading, onSignIn, onSuccess, onError]);\n\n const handleSignUpClick = useCallback(() => {\n onSignUp?.();\n }, [onSignUp]);\n\n const displayTitle = useMemo(() => title || (appName ? `Sign in to ${appName}` : 'Sign In'), [title, appName]);\n const displaySubtitle = useMemo(() => subtitle || 'Enter your credentials to continue.', [subtitle]);\n\n return (\n <Card className={cn('w-full max-w-md mx-auto', className)}>\n <form onSubmit={handleSubmit} data-testid=\"login-form\">\n <CardHeader className=\"space-y-1\">\n <CardTitle className=\"text-2xl text-center\">{displayTitle}</CardTitle>\n <CardDescription className=\"text-center\">\n {displaySubtitle}\n </CardDescription>\n </CardHeader>\n\n <CardContent className=\"space-y-4\">\n {error && (\n <Alert variant=\"destructive\">\n <AlertDescription>{error}</AlertDescription>\n </Alert>\n )}\n \n <Label htmlFor=\"email\">Email</Label>\n <Input\n id=\"email\"\n type=\"email\"\n placeholder=\"Enter your email\"\n value={formData.email}\n onChange={handleEmailChange}\n required\n disabled={isLoading}\n />\n \n \n <Label htmlFor=\"password\">Password</Label>\n <Input\n id=\"password\"\n type=\"password\"\n placeholder=\"Enter your password\"\n value={formData.password}\n onChange={handlePasswordChange}\n required\n disabled={isLoading}\n />\n \n </CardContent>\n <CardFooter className=\"flex flex-col space-y-4\">\n <Button \n type=\"submit\" \n className=\"w-full\" \n disabled={isLoading || !isFormValid}\n >\n {isLoading ? 'Signing in...' : 'Sign In'}\n </Button>\n {showSignUp && (\n onSignUp ? (\n <div className=\"text-sm text-center text-muted-foreground\">\n <button\n type=\"button\"\n onClick={handleSignUpClick}\n className=\"text-primary hover:underline\"\n >\n Don't have an account? Sign up\n </button>\n </div>\n ) : (\n <p className=\"text-center text-muted-foreground\">\n Don't have an account?{' '}\n <a href=\"/signup\" className=\"text-primary hover:underline\">\n Sign up\n </a>\n </p>\n )\n )}\n </CardFooter>\n </form>\n </Card>\n );\n});\n","/**\n * @file EventSelector Component\n * @package @jmruthers/pace-core\n * @module Components/EventSelector\n * @since 0.1.0\n *\n * A secure event selector component that allows users to choose from events they have\n * access to based on their role-based permissions. Integrates with the RBAC system\n * to ensure users only see events they're authorized to access.\n *\n * Features:\n * - Role-based event access control\n * - Automatic next event detection and selection\n * - Cross-device synchronization via Supabase\n * - Offline support with localStorage fallback\n * - Comprehensive error handling and retry functionality\n * - Event details display in dropdown\n * - Next/upcoming event indicators\n * - Loading states and user feedback\n * - Accessible interface design\n * - Integration with EventProvider\n *\n * @example\n * ```tsx\n * // Basic event selector\n * <EventSelector \n * onEventChange={(event) => console.log('Selected event:', event)}\n * />\n * \n * // With custom configuration\n * <EventSelector\n * placeholder=\"Choose an event...\"\n * showEventDetails={true}\n * showNextEventIndicator={true}\n * showRetryButton={true}\n * onEventChange={handleEventChange}\n * />\n * \n * // In a header component\n * <Header>\n * <EventSelector \n * className=\"w-64\"\n * showEventDetails={false}\n * onEventChange={setCurrentEvent}\n * />\n * </Header>\n * \n * // With error handling\n * <EventSelector\n * showNoEventsMessage={true}\n * showRetryButton={true}\n * onEventChange={(event) => {\n * if (event) {\n * setCurrentEvent(event);\n * navigate(`/events/${event.id}`);\n * }\n * }}\n * />\n * ```\n *\n * @accessibility\n * - WCAG 2.1 AA compliant\n * - Proper ARIA labels and descriptions\n * - Keyboard navigation support\n * - Screen reader friendly\n * - Focus management\n * - High contrast support\n * - Clear error identification\n *\n * @security\n * - Role-based access control integration\n * - Secure event data handling\n * - User permission validation\n * - No unauthorized event exposure\n * - Secure session management\n *\n * @dependencies\n * - EventProvider - Event context and state\n * - Select components - Dropdown interface\n * - Button component - Retry functionality\n * - Alert component - Error display\n * - LoadingSpinner - Loading states\n * - React 18+ - Hooks and effects\n * - Tailwind CSS - Styling\n */\n\nimport { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '../Select';\nimport { Alert, AlertDescription } from '../Alert/Alert';\nimport { Button } from '../Button/Button';\nimport { LoadingSpinner } from '../LoadingSpinner/LoadingSpinner';\nimport { RefreshCw, AlertCircle, Lock, Calendar, Star } from 'lucide-react';\nimport { useEvents } from '../../providers/EventProvider';\nimport { Event } from '../../types';\nimport { useEffect, useMemo } from 'react';\nimport { cn } from '../../utils/cn';\n\nexport interface EventSelectorProps {\n /** Placeholder text for the dropdown */\n placeholder?: string;\n /** Additional CSS classes */\n className?: string;\n /** Callback fired when an event changes, providing full event object */\n onEventChange?: (event: Event | null) => void;\n /** Show friendly message when no events available */\n showNoEventsMessage?: boolean;\n /** Show retry button on errors */\n showRetryButton?: boolean;\n /** Show event details in dropdown */\n showEventDetails?: boolean;\n /** Show indicator for next/upcoming events */\n showNextEventIndicator?: boolean;\n}\n\n/**\n * EventSelector component for selecting events with built-in access control\n * \n * This component provides secure event selection with:\n * - Database integration via rbac_event_app_roles table\n * - Auto-selection of next upcoming event by date\n * - Cross-device sync via Supabase user session metadata\n * - localStorage fallback for offline scenarios\n * - Comprehensive error handling and user feedback\n * \n * @component\n * @example\n * <UnifiedAuthProvider supabaseClient={supabase} appName=\"PACE\">\n * <EventSelector onEventChange={(event) => console.log(event)} />\n * </UnifiedAuthProvider>\n */\nexport function EventSelector({\n placeholder = \"Select an event\",\n className,\n onEventChange,\n showNoEventsMessage = true,\n showRetryButton = true,\n showEventDetails = true,\n showNextEventIndicator = true\n}: EventSelectorProps) {\n const { \n events, \n selectedEvent, \n isLoading, \n error, \n setSelectedEvent, \n refreshEvents,\n } = useEvents();\n\n\n const handleValueChange = (eventId: string) => {\n const event = events.find((e) => (e.event_id || e.id) === eventId);\n \n if (event) {\n setSelectedEvent(event);\n if (onEventChange) {\n onEventChange(event);\n }\n }\n };\n\n const handleRetry = () => {\n refreshEvents();\n };\n\n // Helper function to check if an event is the next upcoming event\n const isNextEvent = (event: Event): boolean => {\n if (!event.event_date) return false;\n \n const now = new Date();\n const today = new Date(now.getFullYear(), now.getMonth(), now.getDate());\n const eventDate = new Date(event.event_date);\n \n return eventDate >= today;\n };\n\n // Helper function to format event date\n const formatEventDate = (dateString: string): string => {\n const date = new Date(dateString);\n const today = new Date();\n const tomorrow = new Date(today);\n tomorrow.setDate(tomorrow.getDate() + 1);\n \n // Normalize dates to compare only the date part (ignore time)\n const normalizeDate = (d: Date) => {\n const normalized = new Date(d);\n normalized.setHours(0, 0, 0, 0);\n return normalized;\n };\n \n const normalizedDate = normalizeDate(date);\n const normalizedToday = normalizeDate(today);\n const normalizedTomorrow = normalizeDate(tomorrow);\n \n \n if (normalizedDate.getTime() === normalizedToday.getTime()) {\n return 'Today';\n } else if (normalizedDate.getTime() === normalizedTomorrow.getTime()) {\n return 'Tomorrow';\n } else {\n return date.toLocaleDateString();\n }\n };\n\n // Compute sorted list: descending by event_date (newest first); events without date go last\n const sortedEvents = useMemo(() => {\n const getTime = (e: Event) => (e.event_date ? new Date(e.event_date).getTime() : Number.NEGATIVE_INFINITY);\n return [...events].sort((a, b) => getTime(b) - getTime(a));\n }, [events]);\n\n // Default to the next upcoming event if none selected\n useEffect(() => {\n if (!selectedEvent && events.length > 0) {\n const today = new Date();\n const startOfToday = new Date(today.getFullYear(), today.getMonth(), today.getDate()).getTime();\n const next = [...events]\n .filter(e => e.event_date && new Date(e.event_date).getTime() >= startOfToday)\n .sort((a, b) => new Date(a.event_date as string).getTime() - new Date(b.event_date as string).getTime())[0];\n if (next) {\n setSelectedEvent(next);\n if (onEventChange) onEventChange(next);\n }\n }\n }, [events, selectedEvent, setSelectedEvent, onEventChange]);\n\n // Loading state\n if (isLoading) {\n return (\n <div className={`flex items-center gap-2 ${className}`}>\n <LoadingSpinner size=\"sm\" />\n <span className=\"text-sm text-muted-foreground\">Loading events...</span>\n </div>\n );\n }\n\n // Access error state\n if (error) {\n return (\n <div className={className}>\n <Alert variant=\"destructive\">\n <Lock className=\"h-4 w-4\" />\n <AlertDescription className=\"flex items-center justify-between\">\n <span>{error.message}</span>\n {showRetryButton && (\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={handleRetry}\n className=\"ml-2\"\n >\n <RefreshCw className=\"h-3 w-3 mr-1\" />\n Retry\n </Button>\n )}\n </AlertDescription>\n </Alert>\n </div>\n );\n }\n\n // No events available state\n if (events.length === 0) {\n if (showNoEventsMessage) {\n return (\n <div className={className}>\n <Alert variant=\"inline\">\n <AlertCircle className=\"h-4 w-4 text-acc-700\" />\n <AlertDescription className=\"flex items-center justify-between\">\n <span>No events available.</span>\n {showRetryButton && (\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={handleRetry}\n className=\"ml-2\"\n >\n <RefreshCw className=\"h-3 w-3 mr-1\" />\n Refresh\n </Button>\n )}\n </AlertDescription>\n </Alert>\n </div>\n );\n }\n return null;\n }\n\n // Normal selector state\n return (\n <Select \n value={selectedEvent ? (selectedEvent.event_id || selectedEvent.id) : ''}\n onValueChange={handleValueChange}\n className={className}\n >\n <SelectTrigger className=\"text-left\" variant=\"outline\">\n <SelectValue placeholder={placeholder}>\n {selectedEvent && (\n <div className=\"flex items-center gap-2\">\n <Calendar className=\"h-4 w-4 flex-shrink-0\" />\n <span className=\"truncate\">{selectedEvent.event_name || selectedEvent.name}</span>\n {selectedEvent.event_date && (\n <span className=\"text-xs text-muted-foreground flex-shrink-0\">\n ({formatEventDate(selectedEvent.event_date)})\n </span>\n )}\n </div>\n )}\n </SelectValue>\n </SelectTrigger>\n <SelectContent>\n {sortedEvents\n .map((event) => {\n const isNext = isNextEvent(event);\n const isSelected = selectedEvent && (selectedEvent.event_id === event.event_id || selectedEvent.id === event.id);\n \n return (\n <SelectItem \n key={event.event_id || event.id}\n value={event.event_id || event.id}\n className=\"flex items-center justify-between\"\n >\n <div className=\"flex items-center gap-2 w-full\">\n {showNextEventIndicator && isNext && (\n <Star className=\"h-3 w-3 text-acc-500\" />\n )}\n <div className=\"flex-1\">\n <div className=\"flex items-center gap-2\">\n <span className={isSelected ? \"font-semibold\" : \"\"}>\n {event.event_name || event.name}\n </span>\n {isSelected && (\n <span className=\"text-xs bg-primary text-primary-foreground px-1 rounded\">\n Current\n </span>\n )}\n </div>\n {showEventDetails && event.event_date && (\n <div className=\"flex items-center gap-1 text-xs text-muted-foreground\">\n <Calendar className=\"h-3 w-3\" />\n <span>{formatEventDate(event.event_date)}</span>\n {showNextEventIndicator && isNext && (\n <span className=\"text-acc-600 font-medium\">\n (Next)\n </span>\n )}\n </div>\n )}\n {showEventDetails && event.event_venue && (\n <div className=\"text-xs text-muted-foreground\">\n 📍 {event.event_venue}\n </div>\n )}\n </div>\n </div>\n </SelectItem>\n );\n })}\n </SelectContent>\n </Select>\n );\n}\n","/**\n * @file Password Change Form Component\n * @package @jmruthers/pace-core\n * @module Components/PasswordReset\n * @since 0.1.0\n *\n * A secure password change form component with validation, confirmation matching,\n * and proper error handling for updating user passwords.\n *\n * Features:\n * - Password strength validation (minimum 8 characters)\n * - Password confirmation matching\n * - Loading states with disabled form\n * - Error handling and display\n * - Accessibility compliant\n * - Responsive design\n * - Form validation\n * - Secure password input\n * - Success and error callbacks\n *\n * @example\n * ```tsx\n * // Basic password change form\n * <PasswordChangeForm\n * onSubmit={async (values) => {\n * try {\n * await updatePassword(values.newPassword);\n * toast.success('Password updated successfully!');\n * return {};\n * } catch (error) {\n * return { error: { message: error.message } };\n * }\n * }}\n * />\n * \n * // Password change form with custom styling\n * <PasswordChangeForm\n * className=\"max-w-md mx-auto p-6 bg-main-50 rounded-lg shadow-md\"\n * onSubmit={async (values) => {\n * const result = await authService.changePassword(values.newPassword);\n * if (result.success) {\n * navigate('/profile');\n * return {};\n * } else {\n * return { error: { message: result.error } };\n * }\n * }}\n * />\n * \n * // Password change form in a modal\n * <Modal isOpen={showPasswordChange} onClose={() => setShowPasswordChange(false)}>\n * <ModalContent>\n * <ModalHeader>\n * <ModalTitle>Change Password</ModalTitle>\n * </ModalHeader>\n * <ModalBody>\n * <PasswordChangeForm\n * onSubmit={async (values) => {\n * const result = await changePassword(values.newPassword);\n * if (result.success) {\n * setShowPasswordChange(false);\n * toast.success('Password changed successfully');\n * return {};\n * } else {\n * return { error: { message: result.error } };\n * }\n * }}\n * />\n * </ModalBody>\n * </ModalContent>\n * </Modal>\n * ```\n *\n * @accessibility\n * - WCAG 2.1 AA compliant\n * - Proper form labels and associations\n * - Screen reader friendly error messages\n * - Keyboard navigation support\n * - Focus management\n * - High contrast support\n * - Clear error identification\n * - Role=\"alert\" for error announcements\n * - Password field security\n *\n * @security\n * - Password strength validation\n * - Secure password input fields\n * - Confirmation matching\n * - No password logging\n * - Proper error handling\n *\n * @dependencies\n * - React 18+ - Hooks and state\n * - Button component\n * - Input component\n * - Label component\n * - Tailwind CSS - Styling\n */\n\nimport React, { useState } from 'react';\nimport { Button } from '../Button/Button';\nimport { Input } from '../Input/Input';\nimport { Label } from '../Label';\nimport { cn } from '../../utils/cn';\n\nexport interface PasswordChangeFormValues {\n newPassword: string;\n confirmPassword: string;\n}\n\nexport interface PasswordChangeFormProps {\n onSubmit: (values: PasswordChangeFormValues) => Promise<{ error?: any }>;\n className?: string;\n}\n\nexport function PasswordChangeForm({ onSubmit, className }: PasswordChangeFormProps) {\n const [newPassword, setNewPassword] = useState('');\n const [confirmPassword, setConfirmPassword] = useState('');\n const [error, setError] = useState<string | null>(null);\n const [isSubmitting, setIsSubmitting] = useState(false);\n\n const handleSubmit = async (e: React.FormEvent) => {\n e.preventDefault();\n setError(null);\n\n if (newPassword.length < 8) {\n setError('Password must be at least 8 characters.');\n return;\n }\n if (newPassword !== confirmPassword) {\n setError('Passwords do not match.');\n return;\n }\n\n setIsSubmitting(true);\n try {\n const result = await onSubmit({ newPassword, confirmPassword });\n if (result && result.error) {\n setError(result.error.message || 'Failed to change password.');\n }\n } catch (err: any) {\n setError(err?.message || 'An unexpected error occurred.');\n } finally {\n setIsSubmitting(false);\n }\n };\n\n return (\n <form onSubmit={handleSubmit} className={cn('space-y-4', className)}>\n {error && (\n <div role=\"alert\">\n {error}\n </div>\n )}\n <div className=\"space-y-2\">\n <Label htmlFor=\"new-password\">New Password</Label>\n <Input\n id=\"new-password\"\n type=\"password\"\n value={newPassword}\n onChange={(e) => setNewPassword(e.target.value)}\n required\n disabled={isSubmitting}\n />\n </div>\n <div className=\"space-y-2\">\n <Label htmlFor=\"confirm-password\">Confirm Password</Label>\n <Input\n id=\"confirm-password\"\n type=\"password\"\n value={confirmPassword}\n onChange={(e) => setConfirmPassword(e.target.value)}\n required\n disabled={isSubmitting}\n />\n </div>\n <Button\n type=\"submit\"\n className=\"w-full\"\n disabled={isSubmitting || !newPassword || !confirmPassword}\n >\n {isSubmitting ? 'Changing...' : 'Change Password'}\n </Button>\n </form>\n );\n} ","export { Button, ButtonGroup, IconButton } from './Button';\nexport type { ButtonProps, ButtonGroupProps, IconButtonProps } from './Button';\n","/**\n * @file User Menu Component\n * @package @jmruthers/pace-core\n * @module Components/UserMenu\n * @since 0.1.0\n *\n * A comprehensive user menu component that displays user information and provides\n * access to user-specific actions like password changes and sign out.\n *\n * Features:\n * - User avatar and display name\n * - Dropdown menu with user actions\n * - Password change functionality\n * - Sign out capability\n * - Loading state component\n * - Responsive design\n * - Accessibility compliant\n * - Performance optimized with React.memo\n * - Integration with Supabase User\n * - Customizable styling\n *\n * @example\n * ```tsx\n * // Basic user menu\n * <UserMenu\n * user={currentUser}\n * onSignOut={async () => {\n * await signOut();\n * navigate('/login');\n * }}\n * onChangePassword={async (newPassword, confirmPassword) => {\n * try {\n * await updatePassword(newPassword);\n * toast.success('Password updated successfully!');\n * return {};\n * } catch (error) {\n * return { error: { message: error.message } };\n * }\n * }}\n * />\n * \n * // User menu without avatar\n * <UserMenu\n * user={currentUser}\n * showAvatar={false}\n * onSignOut={handleSignOut}\n * onChangePassword={handlePasswordChange}\n * />\n * \n * // User menu with loading state\n * {isLoading ? (\n * <UserMenu.Loading />\n * ) : (\n * <UserMenu\n * user={user}\n * onSignOut={handleSignOut}\n * onChangePassword={handlePasswordChange}\n * />\n * )}\n * \n * // User menu in header\n * <Header>\n * <div className=\"flex items-center gap-4\">\n * <Navigation />\n * <UserMenu\n * user={user}\n * onSignOut={handleSignOut}\n * onChangePassword={handlePasswordChange}\n * className=\"ml-auto\"\n * />\n * </div>\n * </Header>\n * ```\n *\n * @accessibility\n * - WCAG 2.1 AA compliant\n * - Proper ARIA labels and roles\n * - Keyboard navigation support\n * - Focus management\n * - Screen reader friendly\n * - High contrast support\n * - Loading state announcements\n * - Clear action identification\n *\n * @performance\n * - React.memo for efficient re-rendering\n * - useCallback for stable event handlers\n * - useMemo for computed values\n * - Minimal re-renders\n * - Optimized avatar rendering\n *\n * @dependencies\n * - React 18+ - Hooks and memo\n * - @supabase/supabase-js - User type\n * - lucide-react - Icons\n * - DropdownMenu components\n * - Dialog components\n * - PasswordChangeForm component\n * - Avatar component\n * - Button component\n * - Tailwind CSS - Styling\n */\n\nimport React, { useCallback, useMemo, useState } from 'react';\nimport { User } from '@supabase/supabase-js';\nimport { ChevronDown, LogOut, KeyRound } from 'lucide-react';\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectLabel,\n SelectSeparator,\n SelectTrigger,\n SelectValue,\n} from '../Select';\nimport {\n Dialog,\n DialogContent,\n DialogHeader,\n DialogTitle,\n DialogTrigger,\n DialogOverlay\n} from '../Dialog';\nimport { PasswordChangeForm } from '../PasswordReset/PasswordChangeForm';\nimport { Avatar, AvatarFallback, AvatarImage } from '../Avatar';\nimport { Button } from '../Button';\n\nexport interface UserMenuProps {\n user: User | null;\n onSignOut?: () => Promise<void>;\n onChangePassword?: (newPassword: string, confirmPassword: string) => Promise<{ error: any }>;\n className?: string;\n showAvatar?: boolean;\n}\n\nexport const UserMenu = React.memo<UserMenuProps>(function UserMenu({\n user,\n onSignOut,\n onChangePassword,\n className,\n showAvatar = true,\n}) {\n const [isPasswordDialogOpen, setPasswordDialogOpen] = useState(false);\n\n const userInfo = useMemo(() => {\n if (!user) return null;\n return {\n email: user.email,\n displayName: user.user_metadata?.display_name || user.user_metadata?.full_name || user.email?.split('@')[0],\n avatarUrl: user.user_metadata?.avatar_url,\n initial: (user.user_metadata?.display_name || user.user_metadata?.full_name || user.email || 'U').charAt(0).toUpperCase(),\n };\n }, [user]);\n\n const handleSignOut = useCallback(async () => {\n if (onSignOut) await onSignOut();\n }, [onSignOut]);\n\n if (!user || !userInfo) {\n return null; // Or a loading/login button\n }\n\n return (\n <Dialog open={isPasswordDialogOpen} onOpenChange={setPasswordDialogOpen}>\n <Select className={className}>\n <SelectTrigger asChild>\n <Button variant=\"outline\" className=\"flex items-center gap-2\" aria-label={userInfo.displayName}>\n {showAvatar && (\n <Avatar className=\"h-8 w-8\">\n <AvatarImage src={userInfo.avatarUrl} alt={userInfo.displayName} />\n <AvatarFallback>{userInfo.initial}</AvatarFallback>\n </Avatar>\n )}\n <span className=\"hidden sm:inline-block\">{userInfo.displayName}</span>\n <ChevronDown className=\"h-4 w-4\" />\n </Button>\n </SelectTrigger>\n <SelectContent>\n <SelectLabel className=\"font-normal\">\n <div className=\"flex flex-col space-y-1\">\n <p className=\"font-medium\">{userInfo.displayName}</p>\n <p className=\"text-muted-foreground\">{userInfo.email}</p>\n </div>\n </SelectLabel>\n <SelectSeparator />\n <DialogTrigger asChild>\n <SelectItem value=\"change-password\">\n <KeyRound className=\"mr-2 h-4 w-4\" />\n <span>Change Password</span>\n </SelectItem>\n </DialogTrigger>\n <SelectItem value=\"sign-out\" onClick={handleSignOut}>\n <LogOut className=\"mr-2 h-4 w-4\" />\n <span>Sign out</span>\n </SelectItem>\n </SelectContent>\n </Select>\n \n <DialogOverlay />\n <DialogContent className={className}>\n <DialogHeader>\n <DialogTitle>Change Password</DialogTitle>\n </DialogHeader>\n <PasswordChangeForm\n onSubmit={async ({ newPassword, confirmPassword }) => {\n if (onChangePassword) {\n const { error } = await onChangePassword(newPassword, confirmPassword);\n if (!error) {\n setPasswordDialogOpen(false);\n }\n return { error };\n }\n return {};\n }}\n />\n </DialogContent>\n </Dialog>\n );\n});\n\nexport const UserMenuLoading = React.memo(function UserMenuLoading() {\n return (\n <div className=\"relative inline-block text-left\">\n <button\n type=\"button\"\n disabled\n className=\"flex items-center space-x-2 px-3 py-2 text-sm font-medium text-muted-foreground bg-muted border border-input rounded-md\"\n >\n <div className=\"w-6 h-6 rounded-full bg-muted animate-pulse\" />\n <span className=\"truncate max-w-[150px]\">Loading...</span>\n <ChevronDown className=\"w-4 h-4 text-muted-foreground\" />\n </button>\n <div role=\"status\" aria-label=\"Loading user menu\" aria-live=\"polite\" className=\"w-6 h-6 rounded-full bg-muted animate-pulse\" />\n </div>\n );\n});\n\n// Add Loading as a property to UserMenu for backward compatibility\ntype UserMenuWithLoading = typeof UserMenu & {\n Loading: typeof UserMenuLoading;\n};\n\n(UserMenu as UserMenuWithLoading).Loading = UserMenuLoading;\n","/**\n * @file Unified Navigation Menu Component\n * @package @jmruthers/pace-core\n * @module Navigation\n * @since 0.1.0\n * \n * A flexible navigation menu component that supports both dropdown and hierarchical modes.\n * \n * Features:\n * - Dropdown mode: Menu button that opens a dropdown list\n * - Hierarchical mode: Expandable tree navigation with nested items\n * - Icon support for navigation items\n * - Current page highlighting\n * - Keyboard navigation support\n * - Accessible design with proper ARIA attributes\n * - Click outside to close (dropdown mode)\n * - Recursive rendering for nested items (hierarchical mode)\n * \n * @example\n * Basic dropdown navigation (most common use case):\n * ```tsx\n * import { NavigationMenu } from '@jmruthers/pace-core';\n * import { useNavigate, useLocation } from 'react-router-dom';\n * \n * function AppNavigation() {\n * const navigate = useNavigate();\n * const location = useLocation();\n * \n * const navItems = [\n * { id: 'home', label: 'Home', href: '/', icon: 'Home' },\n * { id: 'dashboard', label: 'Dashboard', href: '/dashboard', icon: 'LayoutDashboard' },\n * { id: 'reports', label: 'Reports', href: '/reports', icon: 'FileText' },\n * { id: 'settings', label: 'Settings', href: '/settings', icon: 'Settings' }\n * ];\n * \n * return (\n * <NavigationMenu \n * items={navItems}\n * mode=\"dropdown\"\n * currentPath={location.pathname}\n * onNavigate={(item) => navigate(item.href)}\n * buttonText=\"Main Menu\"\n * showIcons={true}\n * />\n * );\n * }\n * \n * @example\n * Hierarchical navigation with nested items:\n * ```tsx\n * import { NavigationMenu } from '@jmruthers/pace-core';\n * \n * function SidebarNavigation() {\n * const hierarchicalItems = [\n * { \n * id: 'user-management', \n * label: 'User Management',\n * icon: 'Users',\n * children: [\n * { id: 'users-list', label: 'All Users', href: '/users' },\n * { id: 'users-create', label: 'Create User', href: '/users/create' },\n * { id: 'user-roles', label: 'User Roles', href: '/users/roles' }\n * ]\n * },\n * { \n * id: 'reports', \n * label: 'Reports',\n * icon: 'BarChart',\n * children: [\n * { id: 'sales-reports', label: 'Sales Reports', href: '/reports/sales' },\n * { id: 'user-reports', label: 'User Reports', href: '/reports/users' }\n * ]\n * },\n * { id: 'settings', label: 'Settings', href: '/settings', icon: 'Settings' }\n * ];\n * \n * return (\n * <NavigationMenu \n * items={hierarchicalItems}\n * mode=\"hierarchical\"\n * currentPath={window.location.pathname}\n * onNavigate={(item) => {\n * if (item.href) {\n * window.location.href = item.href;\n * }\n * }}\n * className=\"w-64 bg-sec-50 p-4\"\n * />\n * );\n * }\n * ```\n * \n * @example\n * Integration with React Router and authentication:\n * ```tsx\n * import { NavigationMenu } from '@jmruthers/pace-core';\n * import { useNavigate, useLocation } from 'react-router-dom';\n * import { useUnifiedAuth } from '@jmruthers/pace-core/providers';\n * \n * function AuthenticatedNavigation() {\n * const navigate = useNavigate();\n * const location = useLocation();\n * const { hasRole, hasPermission } = useUnifiedAuth();\n * \n * // Build navigation items based on user permissions\n * const navItems = [\n * { id: 'dashboard', label: 'Dashboard', href: '/dashboard', icon: 'LayoutDashboard' },\n * ...(hasPermission('meals:read') ? [\n * { id: 'meals', label: 'Meals', href: '/meals', icon: 'UtensilsCrossed' }\n * ] : []),\n * ...(hasRole('admin') ? [\n * { id: 'admin', label: 'Admin Panel', href: '/admin', icon: 'Shield' }\n * ] : []),\n * { id: 'profile', label: 'Profile', href: '/profile', icon: 'User' }\n * ];\n * \n * return (\n * <NavigationMenu \n * items={navItems}\n * mode=\"dropdown\"\n * currentPath={location.pathname}\n * onNavigate={(item) => navigate(item.href)}\n * buttonText=\"Navigation\"\n * navigationLabel=\"Main application navigation\"\n * />\n * );\n * }\n * ```\n * \n * @example\n * ```tsx\n * // Custom navigation with external links and actions\n * import { NavigationMenu } from '@jmruthers/pace-core';\n * \n * function CustomNavigation() {\n * const handleNavigation = (item) => {\n * if (item.id === 'logout') {\n * // Handle logout action\n * handleLogout();\n * } else if (item.href?.startsWith('http')) {\n * // Handle external links\n * window.open(item.href, '_blank');\n * } else if (item.href) {\n * // Handle internal navigation\n * navigate(item.href);\n * }\n * };\n * \n * const navItems = [\n * { id: 'home', label: 'Home', href: '/', icon: 'Home' },\n * { id: 'help', label: 'Help Center', href: 'https://help.example.com', icon: 'HelpCircle' },\n * { id: 'logout', label: 'Sign Out', icon: 'LogOut' } // No href for actions\n * ];\n * \n * return (\n * <NavigationMenu \n * items={navItems}\n * mode=\"dropdown\"\n * onNavigate={handleNavigation}\n * buttonText=\"Menu\"\n * disabled={false}\n * />\n * );\n * }\n * ```\n * \n * @accessibility\n * - WCAG 2.1 AA compliant navigation structure\n * - Proper ARIA attributes for screen readers\n * - Keyboard navigation with Enter, Space, and Escape keys\n * - Focus management for dropdown menus\n * - Semantic HTML structure with nav, menu, and menuitem roles\n * - Clear visual indicators for active/current page\n * \n * @performance\n * - Lightweight component with minimal re-renders\n * - Efficient click outside detection\n * - Optimized keyboard event handling\n * - Memory cleanup for event listeners\n * \n * @styling\n * - Uses Tailwind CSS for consistent styling\n * - Supports custom className for additional styling\n * - Responsive design considerations\n * \n * @dependencies\n * - React 18+ - Component framework and hooks\n * - Lucide React - Icon components\n * - Radix UI - Dropdown menu primitives\n * - React Router (optional) - For navigation handling\n * - Tailwind CSS - Styling system\n */\n\nimport * as React from \"react\";\nimport { Menu, ChevronDown } from \"lucide-react\";\nimport { cn } from \"../../utils/cn\";\nimport { NavigationMenuProps, NavigationItem } from \"./types\";\nimport { Button } from \"../Button\";\nimport { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from \"../Select\";\nimport { useUnifiedAuth } from \"../../providers/UnifiedAuthProvider\";\nimport { AccessLevel } from \"../../types/unified\";\n\n/**\n * Unified NavigationMenu component that supports both dropdown and hierarchical navigation modes.\n * \n * A flexible navigation menu component with support for icons, current page highlighting,\n * keyboard navigation, and nested menu items.\n * \n * Features:\n * - Dropdown mode: Menu button that opens a dropdown list\n * - Hierarchical mode: Expandable tree navigation with nested items\n * - Icon support for navigation items\n * - Current page highlighting\n * - Keyboard navigation support (Enter, Space, Escape)\n * - Accessible design with proper ARIA attributes\n * - Click outside to close (dropdown mode)\n * - Recursive rendering for nested items (hierarchical mode)\n * \n * @example\n * Basic dropdown navigation (most common use case):\n * ```tsx\n * import { NavigationMenu } from '@jmruthers/pace-core';\n * import { useNavigate, useLocation } from 'react-router-dom';\n * \n * function AppNavigation() {\n * const navigate = useNavigate();\n * const location = useLocation();\n * \n * const navItems = [\n * { id: 'home', label: 'Home', href: '/', icon: 'Home' },\n * { id: 'dashboard', label: 'Dashboard', href: '/dashboard', icon: 'LayoutDashboard' },\n * { id: 'reports', label: 'Reports', href: '/reports', icon: 'FileText' },\n * { id: 'settings', label: 'Settings', href: '/settings', icon: 'Settings' }\n * ];\n * \n * return (\n * <NavigationMenu \n * items={navItems}\n * mode=\"dropdown\"\n * currentPath={location.pathname}\n * onNavigate={(item) => navigate(item.href)}\n * buttonText=\"Main Menu\"\n * showIcons={true}\n * />\n * );\n * }\n * ```\n * \n * @example\n * Hierarchical navigation with nested items:\n * ```tsx\n * import { NavigationMenu } from '@jmruthers/pace-core';\n * \n * function SidebarNavigation() {\n * const hierarchicalItems = [\n * { \n * id: 'user-management', \n * label: 'User Management',\n * icon: 'Users',\n * children: [\n * { id: 'users-list', label: 'All Users', href: '/users' },\n * { id: 'users-create', label: 'Create User', href: '/users/create' },\n * { id: 'user-roles', label: 'User Roles', href: '/users/roles' }\n * ]\n * },\n * { \n * id: 'reports', \n * label: 'Reports',\n * icon: 'BarChart',\n * children: [\n * { id: 'sales-reports', label: 'Sales Reports', href: '/reports/sales' },\n * { id: 'user-reports', label: 'User Reports', href: '/reports/users' }\n * ]\n * },\n * { id: 'settings', label: 'Settings', href: '/settings', icon: 'Settings' }\n * ];\n * \n * return (\n * <NavigationMenu \n * items={hierarchicalItems}\n * mode=\"hierarchical\"\n * currentPath={window.location.pathname}\n * onNavigate={(item) => {\n * if (item.href) {\n * window.location.href = item.href;\n * }\n * }}\n * className=\"w-64 bg-sec-50 p-4\"\n * />\n * );\n * }\n * ```\n * \n * @example\n * Integration with React Router and authentication:\n * ```tsx\n * import { NavigationMenu } from '@jmruthers/pace-core';\n * import { useNavigate, useLocation } from 'react-router-dom';\n * import { useUnifiedAuth } from '@jmruthers/pace-core/providers';\n * \n * function AuthenticatedNavigation() {\n * const navigate = useNavigate();\n * const location = useLocation();\n * const { hasRole, hasPermission } = useUnifiedAuth();\n * \n * // Build navigation items with permission requirements\n * const navItems = [\n * { \n * id: 'dashboard', \n * label: 'Dashboard', \n * href: '/dashboard', \n * icon: 'LayoutDashboard',\n * permissions: ['dashboard:read']\n * },\n * { \n * id: 'meals', \n * label: 'Meals', \n * href: '/meals', \n * icon: 'UtensilsCrossed',\n * permissions: ['meals:read']\n * },\n * { \n * id: 'admin', \n * label: 'Admin Panel', \n * href: '/admin', \n * icon: 'Shield',\n * roles: ['admin', 'super_admin']\n * },\n * { \n * id: 'profile', \n * label: 'Profile', \n * href: '/profile', \n * icon: 'User'\n * }\n * ];\n * \n * return (\n * <NavigationMenu \n * items={navItems}\n * mode=\"dropdown\"\n * currentPath={location.pathname}\n * onNavigate={(item) => navigate(item.href)}\n * buttonText=\"Navigation\"\n * navigationLabel=\"Main application navigation\"\n * filterByPermissions={true}\n * auditLog={true}\n * />\n * );\n * }\n * ```\n * \n * @example\n * Custom navigation with external links and actions:\n * ```tsx\n * import { NavigationMenu } from '@jmruthers/pace-core';\n * \n * function CustomNavigation() {\n * const handleNavigation = (item) => {\n * if (item.id === 'logout') {\n * // Handle logout action\n * handleLogout();\n * } else if (item.href?.startsWith('http')) {\n * // Handle external links\n * window.open(item.href, '_blank');\n * } else if (item.href) {\n * // Handle internal navigation\n * navigate(item.href);\n * }\n * };\n * \n * const navItems = [\n * { id: 'home', label: 'Home', href: '/', icon: 'Home' },\n * { id: 'help', label: 'Help Center', href: 'https://help.example.com', icon: 'HelpCircle' },\n * { id: 'logout', label: 'Sign Out', icon: 'LogOut' } // No href for actions\n * ];\n * \n * return (\n * <NavigationMenu \n * items={navItems}\n * mode=\"dropdown\"\n * onNavigate={handleNavigation}\n * buttonText=\"Menu\"\n * disabled={false}\n * />\n * );\n * }\n * ```\n * \n * @param props - NavigationMenu component props including items, mode, navigation handlers, and styling options\n * @returns React element with navigation menu functionality\n * \n * @since 0.1.0\n */\nexport const NavigationMenu = React.forwardRef<\n HTMLDivElement,\n NavigationMenuProps\n>(({ \n items, \n mode = 'dropdown',\n currentPath, \n onNavigate, \n className, \n disabled = false,\n buttonText = \"Menu\",\n showIcons = true,\n navigationLabel = \"Main navigation\",\n // NEW: Phase 2 - Enhanced Security Features\n strictMode = true,\n auditLog = true,\n onNavigationAccessDenied,\n onStrictModeViolation,\n filterByPermissions = true,\n ...props \n}, ref) => {\n const [expandedItems, setExpandedItems] = React.useState<Set<string>>(new Set());\n const buttonRef = React.useRef<HTMLButtonElement>(null);\n\n // Get authentication context\n let authContext = null;\n try {\n authContext = useUnifiedAuth();\n } catch (error) {\n // NavigationMenu is being used outside of UnifiedAuthProvider\n console.warn('[NavigationMenu] useUnifiedAuth not available, running in unauthenticated mode');\n }\n\n // NEW: Phase 2 - Enhanced Security Features\n // Filter navigation items based on permissions\n const filteredItems = React.useMemo(() => {\n if (!filterByPermissions || !authContext) return items || [];\n \n return (items || []).filter(item => {\n // Check if item should be hidden\n if (item.meta?.hidden) return false;\n \n // Check permissions if available\n if (item.permissions && item.permissions.length > 0) {\n const hasPermission = item.permissions.some(permission => {\n // Only check string permissions, ignore invalid types\n if (typeof permission !== 'string') return true;\n return authContext.hasPermission(permission);\n });\n if (!hasPermission) return false;\n }\n \n // Check roles if available\n if (item.roles && item.roles.length > 0) {\n const hasRole = item.roles.some(role => {\n // Only check string roles, ignore invalid types\n if (typeof role !== 'string') return true;\n return authContext.hasRole(role);\n });\n if (!hasRole) return false;\n }\n \n // Check access level if available\n if (item.accessLevel) {\n // Only check string access levels, ignore invalid types\n if (typeof item.accessLevel === 'string') {\n // Convert string to AccessLevel enum\n const accessLevel = item.accessLevel as AccessLevel;\n const hasAccessLevel = authContext.hasAccessLevel(accessLevel);\n if (!hasAccessLevel) return false;\n }\n }\n \n return true;\n });\n }, [items, filterByPermissions, authContext]);\n\n // Log navigation access attempts for debugging\n React.useEffect(() => {\n if (auditLog && authContext) {\n console.log('[NavigationMenu] Navigation access attempt:', {\n itemId: 'navigation-menu',\n label: 'Navigation Menu',\n href: currentPath,\n permissions: authContext.permissions,\n roles: authContext.roles,\n accessLevel: authContext.accessLevel,\n timestamp: new Date().toISOString()\n });\n }\n }, [auditLog, authContext, currentPath]);\n\n\n // Handle keyboard navigation for hierarchical mode\n const handleHierarchicalKeyDown = (event: React.KeyboardEvent, item: NavigationItem) => {\n switch (event.key) {\n case 'Enter':\n case ' ':\n event.preventDefault();\n if (item.children && item.children.length > 0) {\n toggleExpanded(item.id);\n } else if (item.href) {\n onNavigate?.(item);\n }\n break;\n case 'Escape':\n if (expandedItems.has(item.id)) {\n toggleExpanded(item.id);\n }\n break;\n }\n };\n\n // Toggle expanded state for hierarchical items\n const toggleExpanded = (itemId: string) => {\n const newExpanded = new Set(expandedItems);\n if (newExpanded.has(itemId)) {\n newExpanded.delete(itemId);\n } else {\n newExpanded.add(itemId);\n }\n setExpandedItems(newExpanded);\n };\n\n // Handle navigation item click\n const handleItemClick = (item: NavigationItem) => {\n // NEW: Phase 2 - Enhanced Security Features\n // Log navigation access attempt for audit\n if (auditLog) {\n console.log(`[NavigationMenu] Navigation access attempt:`, {\n itemId: item.id,\n label: item.label,\n href: item.href,\n permissions: item.permissions,\n roles: item.roles,\n accessLevel: item.accessLevel,\n timestamp: new Date().toISOString()\n });\n }\n \n // Check if user has permission to access this navigation item\n // For now, allow all access - this will be enhanced with actual permission checking\n const hasPermission = true; // This will be replaced with actual permission checking\n \n if (!hasPermission) {\n // Handle access denied\n if (onNavigationAccessDenied) {\n onNavigationAccessDenied(item.id, 'Insufficient permissions');\n }\n \n if (strictMode) {\n console.error(`[NavigationMenu] STRICT MODE VIOLATION: User attempted to access protected navigation item without permission`, {\n itemId: item.id,\n label: item.label,\n href: item.href,\n permissions: item.permissions,\n roles: item.roles,\n accessLevel: item.accessLevel,\n timestamp: new Date().toISOString()\n });\n \n if (onStrictModeViolation) {\n onStrictModeViolation(item.id, 'Insufficient permissions');\n }\n }\n \n return; // Don't navigate if access is denied\n }\n \n if (onNavigate) {\n onNavigate(item);\n } else if (item.href) {\n // Default navigation behavior\n window.location.href = item.href;\n }\n };\n\n // Check if item is currently active\n const isActiveItem = (item: NavigationItem): boolean => {\n if (item.isActive !== undefined) return item.isActive;\n if (currentPath === item.href) return true;\n if (item.children && item.children.length > 0) {\n return item.children.some(child => isActiveItem(child));\n }\n return false;\n };\n\n // Handle navigation item selection\n const handleNavigationSelect = (itemId: string) => {\n const item = filteredItems.find(i => i.id === itemId);\n if (item) {\n handleItemClick(item);\n }\n };\n\n // Render hierarchical navigation item\n const renderHierarchicalItem = (item: NavigationItem, level: number = 0) => {\n const hasChildren = item.children && item.children.length > 0;\n const isExpanded = expandedItems.has(item.id);\n const itemIsActive = isActiveItem(item);\n\n return (\n <li role=\"none\">\n {hasChildren ? (\n <div>\n <button\n onClick={() => toggleExpanded(item.id)}\n onKeyDown={(e) => handleHierarchicalKeyDown(e, item)}\n aria-expanded={isExpanded}\n aria-controls={`submenu-${item.id}`}\n aria-current={itemIsActive ? \"page\" : undefined}\n >\n <span>{item.label}</span>\n <ChevronDown aria-hidden=\"true\" />\n </button>\n \n {isExpanded && item.children && (\n <ul\n id={`submenu-${item.id}`}\n role=\"menu\"\n aria-label={`${item.label} submenu`}\n >\n {item.children.map(child => (\n <React.Fragment key={child.id}>\n {renderHierarchicalItem(child, level + 1)}\n </React.Fragment>\n ))}\n </ul>\n )}\n </div>\n ) : (\n <a\n href={item.href || '#'}\n onClick={(e) => {\n if (onNavigate && item.href) {\n e.preventDefault();\n onNavigate(item);\n }\n }}\n onKeyDown={(e) => handleHierarchicalKeyDown(e, item)}\n role=\"menuitem\"\n aria-current={itemIsActive ? \"page\" : undefined}\n >\n {item.label}\n </a>\n )}\n </li>\n );\n };\n\n // Render based on mode\n if (mode === 'dropdown') {\n return (\n <Select \n onValueChange={handleNavigationSelect}\n className={className}\n data-testid=\"navigation-menu-root\"\n >\n <SelectTrigger \n ref={buttonRef}\n disabled={disabled} \n aria-label={buttonText}\n data-testid=\"navigation-menu-trigger\"\n >\n <SelectValue placeholder={buttonText} />\n </SelectTrigger>\n <SelectContent>\n {filteredItems.map((item) => {\n const isActive = isActiveItem(item);\n return (\n <SelectItem\n key={item.id}\n value={item.id}\n disabled={!item.href}\n data-testid={`navigation-menu-item-${item.id}`}\n >\n {item.label}\n </SelectItem>\n );\n })}\n </SelectContent>\n </Select>\n );\n }\n\n // Hierarchical mode\n return (\n <nav \n ref={ref}\n className={className}\n aria-label={navigationLabel}\n {...props}\n >\n <ul role=\"menubar\">\n {filteredItems.map(item => (\n <React.Fragment key={item.id}>\n {renderHierarchicalItem(item, 0)}\n </React.Fragment>\n ))}\n </ul>\n </nav>\n );\n});\n\nNavigationMenu.displayName = \"NavigationMenu\";","/**\n * @file Header Component\n * @package @jmruthers/pace-core\n * @module Components/Header\n * @since 0.1.0\n *\n * A comprehensive header component for application layouts with navigation,\n * user menu, event selector, and customizable branding.\n *\n * Features:\n * - Customizable logo (URL or component)\n * - Navigation menu integration\n * - User menu with authentication\n * - Event selector for multi-tenant applications\n * - Custom actions support\n * - Responsive design\n * - Accessibility compliant\n * - Backdrop blur effects\n * - Flexible layout options\n *\n * @example\n * ```tsx\n * // Basic header with logo and user menu\n * <Header\n * logoUrl=\"/logo.svg\"\n * logoAlt=\"My App\"\n * user={currentUser}\n * onSignOut={handleSignOut}\n * />\n * \n * // Header with navigation and custom actions\n * <Header\n * logo={<CustomLogo />}\n * navItems={[\n * { id: 'dashboard', label: 'Dashboard', href: '/dashboard' },\n * { id: 'users', label: 'Users', href: '/users' },\n * { id: 'settings', label: 'Settings', href: '/settings' }\n * ]}\n * currentPath=\"/dashboard\"\n * actions={\n * <div className=\"flex gap-2\">\n * <Button variant=\"outline\">Export</Button>\n * <Button>New Item</Button>\n * </div>\n * }\n * user={currentUser}\n * onSignOut={handleSignOut}\n * />\n * \n * // Header without event selector\n * <Header\n * logoUrl=\"/logo.svg\"\n * showEventSelector={false}\n * user={currentUser}\n * onSignOut={handleSignOut}\n * />\n * \n * // Header with custom user menu\n * <Header\n * logoUrl=\"/logo.svg\"\n * userMenu={<CustomUserMenu user={currentUser} />}\n * showUserMenu={true}\n * />\n * ```\n *\n * @accessibility\n * - WCAG 2.1 AA compliant\n * - Proper semantic HTML with role=\"banner\"\n * - Screen reader friendly navigation\n * - Keyboard navigation support\n * - High contrast support\n * - Focus management\n *\n * @dependencies\n * - @supabase/supabase-js - User authentication\n * - React 18+ - Component framework\n * - Tailwind CSS - Styling\n * - NavigationMenu component\n * - UserMenu component\n * - EventSelector component\n */\n\nimport React from 'react';\nimport { User } from '@supabase/supabase-js';\nimport { cn } from '../../utils/cn';\nimport { EventSelector } from '../EventSelector';\nimport { UserMenu } from '../UserMenu';\nimport { NavigationMenu } from '../NavigationMenu';\nimport type { NavigationItem } from '../NavigationMenu';\n\n/**\n * Props for the Header component\n */\nexport interface HeaderProps {\n /** URL to the app logo image */\n logoUrl?: string;\n /** Alt text for the logo */\n logoAlt?: string;\n /** Custom logo component (overrides logoUrl) */\n logo?: React.ReactNode;\n /** Navigation items for the menu - uses NavigationItem interface */\n navItems?: NavigationItem[];\n /** Current user for the user menu */\n user?: User | null;\n /** Sign out handler for user menu */\n onSignOut?: () => Promise<void>;\n /** Password change handler for user menu */\n onChangePassword?: (newPassword: string, confirmPassword: string) => Promise<{ error: any }>;\n /** Additional actions to display (will be placed between event selector and user menu) */\n actions?: React.ReactNode;\n /** Custom user menu component (overrides default UserMenu) */\n userMenu?: React.ReactNode;\n /** Custom className */\n className?: string;\n /** Show/hide event selector */\n showEventSelector?: boolean;\n /** Show/hide user menu */\n showUserMenu?: boolean;\n /** Current path for navigation highlighting */\n currentPath?: string;\n /** Custom navigation handler */\n onNavigate?: (item: NavigationItem) => void;\n}\n\n/**\n * Header component for application layouts with comprehensive navigation, user management, \n * and customizable branding support.\n * \n * A flexible header component that supports various configurations including custom logos,\n * navigation menus, user authentication, event selection, and custom actions.\n * \n * Features:\n * - Customizable logo (URL or custom component)\n * - Navigation menu integration with highlighting\n * - User menu with authentication and password management\n * - Event selector for multi-tenant applications\n * - Custom actions support\n * - Responsive design with mobile considerations\n * - Accessibility compliant with proper ARIA attributes\n * - Backdrop blur effects for modern UI\n * - Flexible layout with configurable sections\n * \n * @example\n * Basic header with logo and navigation:\n * ```tsx\n * import { Header } from '@jmruthers/pace-core';\n * import { useNavigate, useLocation } from 'react-router-dom';\n * \n * function AppHeader() {\n * const navigate = useNavigate();\n * const location = useLocation();\n * \n * const navItems = [\n * { id: 'dashboard', label: 'Dashboard', href: '/dashboard' },\n * { id: 'meals', label: 'Meals', href: '/meals' },\n * { id: 'settings', label: 'Settings', href: '/settings' }\n * ];\n * \n * return (\n * <Header\n * logoUrl=\"/company-logo.svg\"\n * logoAlt=\"My Company\"\n * navItems={navItems}\n * currentPath={location.pathname}\n * onNavigate={(item) => navigate(item.href)}\n * user={currentUser}\n * onSignOut={handleSignOut}\n * />\n * );\n * }\n * ```\n * \n * @example\n * Header with custom actions:\n * ```tsx\n * import { Header, Button } from '@jmruthers/pace-core';\n * \n * function HeaderWithActions() {\n * const customActions = (\n * <div className=\"flex items-center gap-2\">\n * <Button variant=\"outline\" size=\"sm\">Export</Button>\n * <Button size=\"sm\">New Item</Button>\n * </div>\n * );\n * \n * return (\n * <Header\n * logoUrl=\"/logo.svg\"\n * navItems={navigationItems}\n * actions={customActions}\n * user={currentUser}\n * onSignOut={handleSignOut}\n * />\n * );\n * }\n * ```\n * \n * @example\n * Minimal header configuration:\n * ```tsx\n * function MinimalHeader() {\n * return (\n * <Header\n * logoUrl=\"/simple-logo.svg\"\n * logoAlt=\"Simple App\"\n * showEventSelector={false}\n * user={currentUser}\n * onSignOut={handleSignOut}\n * />\n * );\n * }\n * ```\n * \n * @param props - Header configuration including logo, navigation, user settings, and custom content\n * @returns React element with complete header functionality\n * \n * @since 0.1.0\n */\nexport function Header({\n logoUrl,\n logoAlt = 'Logo',\n logo,\n navItems = [],\n user,\n onSignOut,\n onChangePassword,\n actions,\n userMenu,\n className,\n showEventSelector = true,\n showUserMenu = true,\n currentPath,\n onNavigate\n}: HeaderProps) {\n return (\n <header className={cn(\n \"w-full border-b border-main-200 h-16 shadow-sm bg-main-100 \",\n className\n )} role=\"banner\">\n <nav className=\"px-4 w-[min(var(--app-width),100%)] mx-auto grid grid-cols-[auto_auto_1fr_auto] gap-4 h-full items-center\">\n {/* Logo */}\n {logo ? (\n logo\n ) : logoUrl ? (\n <img\n src={logoUrl}\n alt={logoAlt || 'Logo'}\n className=\"h-[2.15rem] w-auto max-w-[200px] object-contain rounded-md shadow-md bg-transparent\"\n />\n ) : (\n <img\n src=\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' fill='%23000'/%3E%3Ctext x='16' y='20' text-anchor='middle' fill='white' font-family='Arial' font-size='14' font-weight='bold'%3EL%3C/text%3E%3C/svg%3E\"\n alt={logoAlt || 'Logo'}\n className=\"h-8 w-8 shadow-md\"\n />\n )}\n\n {/* Navigation Menu */}\n {navItems && navItems.length > 0 && (\n <NavigationMenu\n items={navItems}\n currentPath={currentPath}\n onNavigate={onNavigate}\n buttonText=\"Menu\"\n className=\"w-48\"\n />\n )}\n \n\n {/* Right side: Event Selector, Actions, and User Menu */}\n\n {/* Event Selector */}\n {showEventSelector && (\n <EventSelector \n placeholder=\"Select event\" \n className=\"justify-self-end hidden sm:block w-96\" \n data-testid=\"event-selector\" \n />\n )}\n \n {/* Custom Actions */}\n {actions}\n \n {/* User Menu */}\n {showUserMenu && (\n userMenu ? (\n userMenu\n ) : (\n <UserMenu\n user={user || null}\n onSignOut={onSignOut}\n onChangePassword={onChangePassword}\n className=\"w-70\"\n />\n )\n )}\n\n </nav>\n </header>\n );\n}\n","/**\n * @file Footer Component\n * @package @jmruthers/pace-core\n * @module Components/Footer\n * @since 0.1.0\n *\n * A flexible footer component for application layouts with copyright information,\n * navigation links, and customizable content.\n *\n * Features:\n * - Copyright information with automatic year generation\n * - Customizable company name and branding\n * - Optional navigation links\n * - Logo display support\n * - Custom footer content via children\n * - Responsive design\n * - Accessibility compliant\n * - Flexible layout options\n * - Consistent styling with design system\n *\n * @example\n * ```tsx\n * // Basic footer with default copyright\n * <Footer />\n * \n * // Footer with custom company name and year\n * <Footer \n * companyName=\"My Company Inc.\"\n * year={2024}\n * />\n * \n * // Footer with navigation links\n * <Footer\n * companyName=\"My Company\"\n * links={[\n * { label: 'Privacy Policy', href: '/privacy' },\n * { label: 'Terms of Service', href: '/terms' },\n * { label: 'Contact', href: '/contact' }\n * ]}\n * />\n * \n * // Footer with logo and custom copyright\n * <Footer\n * logo=\"/logo.svg\"\n * copyright=\"© 2024 My Company. All rights reserved.\"\n * />\n * \n * // Footer with custom content\n * <Footer companyName=\"My Company\">\n * <div className=\"grid grid-cols-1 md:grid-cols-3 gap-8 mb-8\">\n * <div>\n * <h3 className=\"font-semibold mb-2\">About Us</h3>\n * <p className=\"text-sm text-muted-foreground\">\n * We provide innovative solutions for modern businesses.\n * </p>\n * </div>\n * <div>\n * <h3 className=\"font-semibold mb-2\">Contact</h3>\n * <p className=\"text-sm text-muted-foreground\">\n * Email: info@mycompany.com<br />\n * Phone: (555) 123-4567\n * </p>\n * </div>\n * <div>\n * <h3 className=\"font-semibold mb-2\">Follow Us</h3>\n * <div className=\"flex gap-2\">\n * <a href=\"#\" className=\"text-muted-foreground hover:text-foreground\">Twitter</a>\n * <a href=\"#\" className=\"text-muted-foreground hover:text-foreground\">LinkedIn</a>\n * </div>\n * </div>\n * </div>\n * </Footer>\n * ```\n *\n * @accessibility\n * - WCAG 2.1 AA compliant\n * - Proper semantic HTML with role=\"contentinfo\"\n * - Screen reader friendly navigation\n * - Keyboard navigation support\n * - High contrast support\n * - Clear link identification\n *\n * @dependencies\n * - React 18+ - Component framework\n * - Tailwind CSS - Styling\n */\nimport React from 'react';\nimport { cn } from '../../utils/cn';\n\nexport interface FooterProps {\n /**\n * Company or organization name\n */\n companyName?: string;\n\n /**\n * Current year or custom year for copyright\n * @default current year\n */\n year?: number;\n\n /**\n * Optional array of navigation links to display\n */\n links?: Array<{\n label: string;\n href: string;\n }>;\n\n /**\n * Optional CSS class name\n */\n className?: string;\n\n /**\n * Logo image URL (from UI version)\n */\n logo?: string;\n\n /**\n * Copyright text (from UI version)\n */\n copyright?: string;\n\n /**\n * Footer content - children to render inside footer\n */\n children?: React.ReactNode;\n}\n\n/**\n * Footer component that displays copyright information and navigation\n * \n * @example\n * ```tsx\n * // Basic usage\n * <Footer />\n * \n * // With children\n * <Footer>\n * <div>Custom footer content</div>\n * </Footer>\n * \n * // With logo and copyright\n * <Footer logo=\"/logo.png\" copyright=\"© 2024 Company. All rights reserved.\" />\n * ```\n */\nconst FooterComponent: React.FC<FooterProps> = ({\n companyName = 'Solvera Solutions Pty Ltd',\n year = new Date().getFullYear(),\n links,\n className = '',\n logo,\n copyright,\n children\n}) => {\n // Use custom copyright if provided, otherwise generate default\n const copyrightText = copyright || `© Copyright 2022–${year} all rights reserved, ${companyName}.`;\n\n return (\n <footer className={cn('mt-8 py-6 flex justify-center border-t border-border bg-main-100', className)}>\n\n <section className='px-4 w-[min(var(--app-width),100%)] mx-auto text-center'>\n {logo && (\n <img src={logo} alt=\"Logo\" className=\"h-8 w-auto\" />\n )}\n\n {children && (\n <>\n {children}\n </>\n )}\n\n <span className=\"text-muted-foreground\">\n {copyrightText}\n </span>\n\n {links && links.length > 0 && (\n <ul className=\"flex gap-4 mt-2 md:mt-0\">\n {links.map((link, index) => (\n <li key={index}>\n <a href={link.href} className=\"text-muted-foreground hover:text-foreground\">\n {link.label}\n </a>\n </li>\n ))}\n </ul>\n )}\n </section>\n </footer>\n );\n};\n\nFooterComponent.displayName = 'Footer';\n\nexport const Footer = React.memo(FooterComponent);\nFooter.displayName = 'Footer';\n","/**\n * @file PACE App Layout Component\n * @package @jmruthers/pace-core\n * @module Components/PaceAppLayout\n * @since 0.1.0\n *\n * A comprehensive application layout component that provides a consistent\n * structure for all PACE suite applications with header, navigation, and footer.\n * \n * NEW: Layout-level permission enforcement to ensure consuming apps can't\n * forget to implement permission checks on individual pages.\n *\n * Features:\n * - Consistent application layout structure\n * - Header with logo, navigation, and user menu\n * - Footer with copyright and links\n * - React Router integration with Outlet\n * - Unified authentication integration\n * - Navigation menu with configurable items\n * - User sign-out functionality\n * - Password change capability\n * - Responsive design\n * - Accessibility compliant\n * - Flexible content area\n * - Branding support\n * - Layout-level permission enforcement\n * - Automatic page permission validation\n * - Permission-based navigation filtering\n *\n * @example\n * ```tsx\n * // Basic app layout with React Router (RECOMMENDED)\n * <Router>\n * <Routes>\n * <Route path=\"/\" element={<PaceAppLayout appName=\"My Application\" />}>\n * <Route index element={<HomePage />} />\n * <Route path=\"dashboard\" element={<DashboardPage />} />\n * <Route path=\"settings\" element={<SettingsPage />} />\n * </Route>\n * </Routes>\n * </Router>\n * \n * // App layout with custom permission configuration\n * function MyApp() {\n * return (\n * <UnifiedAuthProvider supabaseClient={supabase} appName=\"My App\">\n * <Router>\n * <Routes>\n * <Route path=\"/\" element={\n * <PaceAppLayout \n * appName=\"My Application\"\n * enforcePermissions={true}\n * defaultPermission=\"read\"\n * permissionFallback={<AccessDeniedPage />}\n * />\n * }>\n * <Route index element={<HomePage />} />\n * <Route path=\"events\" element={<EventsPage />} />\n * <Route path=\"reports\" element={<ReportsPage />} />\n * <Route path=\"admin\" element={<AdminPage />} />\n * </Route>\n * </Routes>\n * </Router>\n * </UnifiedAuthProvider>\n * );\n * }\n * \n * ```\n *\n * @accessibility\n * - WCAG 2.1 AA compliant\n * - Proper semantic HTML structure\n * - Screen reader friendly navigation\n * - Keyboard navigation support\n * - Focus management\n * - High contrast support\n * - Clear content hierarchy\n * - Consistent navigation patterns\n *\n * @routing\n * - React Router v6 integration\n * - Nested route support\n * - Dynamic navigation handling\n * - Path-based navigation\n * - Route outlet rendering\n * - Permission-based route protection\n *\n * @dependencies\n * - React 18+ - Component framework\n * - React Router v6 - Routing\n * - UnifiedAuthProvider - Authentication\n * - usePermissionCache - Permission management\n * - Header component\n * - Footer component\n * - Button component\n * - NavigationMenu types\n * - Tailwind CSS - Styling\n */\n\nimport React, { useState, useEffect, useMemo, useCallback } from 'react';\nimport { Outlet, useNavigate, useLocation } from 'react-router-dom';\nimport { useUnifiedAuth } from '../../providers/UnifiedAuthProvider';\n// Import RBAC functions directly so they can be mocked in tests\nimport { isPermitted } from '../../rbac/api';\nimport type { Permission } from '../../rbac/types';\n\n// Stable empty objects to prevent infinite loops\nconst EMPTY_PAGE_ID_MAPPING = {};\nconst EMPTY_ROUTE_PERMISSIONS = {};\nimport { Button } from '../Button';\nimport { Footer } from '../Footer';\nimport { Header } from '../Header';\nimport type { NavigationItem } from '../NavigationMenu/types';\n// Define Operation type locally since old RBAC types are removed\ntype Operation = 'read' | 'create' | 'update' | 'delete' | 'manage';\n\nexport interface PaceAppLayoutProps {\n /** The name of the application to be displayed in the header. */\n appName: string;\n /** Optional navigation items for the header menu. If not provided, uses default navigation. */\n navItems?: NavigationItem[];\n /** Show/hide event selector in the header */\n showEventSelector?: boolean;\n /** Custom actions to display in the header (between event selector and user menu) */\n headerActions?: React.ReactNode;\n /** Custom logo component (overrides default logo) */\n customLogo?: React.ReactNode;\n /** Custom user menu component (overrides default user menu) */\n customUserMenu?: React.ReactNode;\n /** Custom className for the header */\n headerClassName?: string;\n /** Show/hide user menu */\n showUserMenu?: boolean;\n /** Enable layout-level permission enforcement */\n enforcePermissions?: boolean;\n /** Default permission to check for all routes (when enforcePermissions is true) */\n defaultPermission?: Operation;\n /** Route-specific permissions mapping */\n routePermissions?: Record<string, Operation>;\n /** Fallback component to show when user lacks permission */\n permissionFallback?: React.ReactNode;\n /** Enable permission-based navigation filtering */\n filterNavigationByPermissions?: boolean;\n /** Custom permission page ID mapping */\n pageIdMapping?: Record<string, string>;\n \n // NEW: Phase 1 - Enhanced Security Features\n /** Enable strict mode to prevent bypassing permission checks (default: true) */\n strictMode?: boolean;\n /** Enable page-level permission enforcement (default: false) */\n enforcePagePermissions?: boolean;\n /** Default page permission fallback component */\n pagePermissionFallback?: React.ReactNode;\n /** Enable audit logging for all permission checks (default: true) */\n auditLog?: boolean;\n /** Callback when page access is denied */\n onPageAccessDenied?: (pageName: string, operation: string) => void;\n /** Callback when strict mode violation occurs */\n onStrictModeViolation?: (pageName: string, operation: string) => void;\n \n // NEW: Phase 2 - Enhanced Routing Features\n /** Enable role-based routing (default: false) */\n roleBasedRouting?: boolean;\n /** Route configuration for role-based routing */\n routeConfig?: Array<{\n path: string;\n component: React.ComponentType;\n permissions: string[];\n roles?: string[];\n accessLevel?: string;\n pageId?: string;\n strictMode?: boolean;\n meta?: {\n title?: string;\n description?: string;\n requiresAuth?: boolean;\n hidden?: boolean;\n };\n }>;\n /** Fallback route for unauthorized access */\n fallbackRoute?: string;\n /** Callback when route access is denied */\n onRouteAccessDenied?: (route: string, reason: string) => void;\n /** Callback when route strict mode violation occurs */\n onRouteStrictModeViolation?: (route: string, reason: string) => void;\n}\n\n/**\n * A consistent layout component for all PACE suite applications that provides a standard\n * structure with header, main content area, and footer.\n * \n * NEW: This component now includes layout-level permission enforcement to ensure\n * consuming apps can't forget to implement permission checks on individual pages.\n * \n * This component is designed to work with React Router's nested routing pattern using\n * Outlet to render child routes. It provides integrated authentication, navigation,\n * and user management functionality.\n * \n * Features:\n * - React Router v6 integration with nested routing\n * - Unified authentication integration\n * - Consistent header with navigation and user menu\n * - Flexible main content area with Outlet\n * - Footer with application branding\n * - User sign-out and password change functionality\n * - Responsive design and accessibility compliant\n * - Layout-level permission enforcement\n * - Permission-based navigation filtering\n * - Automatic page permission validation\n * \n * @example\n * Basic React Router setup with permission enforcement (RECOMMENDED):\n * ```tsx\n * import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';\n * import { UnifiedAuthProvider } from '@jmruthers/pace-core/providers';\n * import { PaceAppLayout, PaceLoginPage } from '@jmruthers/pace-core';\n * \n * function App() {\n * return (\n * <UnifiedAuthProvider supabaseClient={supabase} appName=\"My App\">\n * <Router>\n * <Routes>\n * <Route path=\"/login\" element={<PaceLoginPage appName=\"My App\" />} />\n * <Route path=\"/\" element={\n * <PaceAppLayout \n * appName=\"My Application\"\n * enforcePermissions={true}\n * defaultPermission=\"read\"\n * />\n * }>\n * <Route index element={<HomePage />} />\n * <Route path=\"dashboard\" element={<DashboardPage />} />\n * <Route path=\"meals\" element={<MealsPage />} />\n * </Route>\n * </Routes>\n * </Router>\n * </UnifiedAuthProvider>\n * );\n * }\n * ```\n * \n * \n * @example\n * Custom navigation items with permission filtering:\n * ```tsx\n * import { NavigationItem } from '@jmruthers/pace-core';\n * \n * function App() {\n * const customNavItems: NavigationItem[] = [\n * { id: 'components', label: 'Components', href: '/components', icon: 'Component' },\n * { id: 'styles', label: 'Styles', href: '/styles', icon: 'Palette' },\n * { id: 'meals', label: 'Meals', href: '/meals', icon: 'UtensilsCrossed' }\n * ];\n * \n * return (\n * <Router>\n * <Routes>\n * <Route path=\"/\" element={\n * <PaceAppLayout \n * appName=\"My Custom App\" \n * navItems={customNavItems}\n * enforcePermissions={true}\n * filterNavigationByPermissions={true}\n * routePermissions={{\n * '/components': 'read',\n * '/styles': 'read',\n * '/meals': 'read'\n * }}\n * />\n * }>\n * <Route path=\"components\" element={<ComponentsPage />} />\n * <Route path=\"styles\" element={<StylesPage />} />\n * <Route path=\"meals\" element={<MealsPage />} />\n * </Route>\n * </Routes>\n * </Router>\n * );\n * }\n * ```\n * \n * @example\n * Route-specific permissions with custom page IDs:\n * ```tsx\n * function AdminApp() {\n * return (\n * <Router>\n * <Routes>\n * <Route path=\"/\" element={\n * <PaceAppLayout \n * appName=\"Admin Panel\"\n * enforcePermissions={true}\n * routePermissions={{\n * '/dashboard': 'read',\n * '/user-management': 'read',\n * '/system-settings': 'update'\n * }}\n * pageIdMapping={{\n * '/dashboard': 'dashboard',\n * '/user-management': 'user-management',\n * '/system-settings': 'system-admin'\n * }}\n * permissionFallback={<AccessDeniedPage />}\n * />\n * }>\n * <Route path=\"dashboard\" element={<DashboardPage />} />\n * <Route path=\"user-management\" element={<UserManagementPage />} />\n * <Route path=\"system-settings\" element={<SystemSettingsPage />} />\n * </Route>\n * </Routes>\n * </Router>\n * );\n * }\n * ```\n * \n * @param props - Layout configuration including app name for branding and permission settings\n * @returns React element with complete application layout structure and permission enforcement\n * \n * @since 0.1.0\n */\nexport function PaceAppLayout({ \n appName, \n navItems, \n showEventSelector,\n headerActions,\n customLogo,\n customUserMenu,\n headerClassName,\n showUserMenu = true,\n enforcePermissions = false,\n defaultPermission = 'read',\n routePermissions = EMPTY_ROUTE_PERMISSIONS,\n permissionFallback,\n filterNavigationByPermissions = false,\n pageIdMapping = EMPTY_PAGE_ID_MAPPING,\n // NEW: Phase 1 - Enhanced Security Features\n strictMode = true,\n enforcePagePermissions = false,\n pagePermissionFallback,\n auditLog = true,\n onPageAccessDenied,\n onStrictModeViolation,\n // NEW: Phase 2 - Enhanced Routing Features\n roleBasedRouting = false,\n routeConfig = [],\n fallbackRoute = '/unauthorized',\n onRouteAccessDenied,\n onRouteStrictModeViolation\n}: PaceAppLayoutProps) {\n const { user, signOut, updatePassword } = useUnifiedAuth();\n const navigate = useNavigate();\n const location = useLocation();\n // Use the new RBAC system for permission checking\n const checkPermission = useCallback(async (permission: string, pageId?: string): Promise<boolean> => {\n try {\n // Use the imported RBAC API function\n \n if (!user?.id) return false;\n \n const scope = {\n organisationId: user.user_metadata?.organisationId || user.app_metadata?.organisationId,\n eventId: user.user_metadata?.eventId || user.app_metadata?.eventId,\n appId: user.user_metadata?.appId || user.app_metadata?.appId,\n };\n \n // Check if user is super admin first - super admins can access everything\n // regardless of organisation context\n const { isSuperAdmin } = await import('../../rbac/api');\n const isSuper = await isSuperAdmin(user.id);\n \n if (isSuper) {\n // Super admin bypass - allow access regardless of organisation context\n return true;\n }\n \n // For non-super admins, ensure we have at least organisationId for RBAC\n if (!scope.organisationId) {\n console.warn('No organisation context available for permission check, denying access');\n return false;\n }\n \n return await isPermitted({\n userId: user.id,\n scope,\n permission: permission as Permission,\n pageId\n });\n } catch (error) {\n console.error('Permission check failed:', error);\n // Let the error bubble up so it can be handled by the calling code\n throw error;\n }\n }, [user?.id]);\n\n // Permission enforcement state\n const [hasPermission, setHasPermission] = useState<boolean | null>(null);\n const [isCheckingPermission, setIsCheckingPermission] = useState(false);\n const [permissionError, setPermissionError] = useState<Error | null>(null);\n\n // Default navigation items if none provided\n const defaultNavItems: NavigationItem[] = useMemo(() => [\n { id: 'home', label: 'Home', href: '/', icon: 'Home' },\n { id: 'dashboard', label: 'Dashboard', href: '/dashboard', icon: 'LayoutDashboard' },\n { id: 'settings', label: 'Settings', href: '/settings', icon: 'Settings' },\n { id: 'ui-showcase', label: 'UI Showcase', href: '/ui-showcase', icon: 'Component' },\n { id: 'data-table-showcase', label: 'DataTable Showcase', href: '/data-table-showcase', icon: 'Table' },\n ], []);\n\n // Use provided navItems or fall back to default\n const baseMenuItems = useMemo(() => navItems || defaultNavItems, [navItems]);\n\n // Get current route permission requirements\n const currentRoutePermission = useMemo(() => {\n const currentPath = location.pathname;\n return routePermissions[currentPath] || defaultPermission;\n }, [location.pathname, routePermissions, defaultPermission]);\n\n // Get current page ID for permission checking\n const currentPageId = useMemo(() => {\n const currentPath = location.pathname;\n return pageIdMapping[currentPath] || currentPath.slice(1) || 'home';\n }, [location.pathname, pageIdMapping]);\n\n // Check permission for current route\n useEffect(() => {\n if (!enforcePermissions) {\n setHasPermission(true);\n return;\n }\n\n let isMounted = true;\n\n const checkRoutePermission = async () => {\n if (!isMounted) return;\n \n setIsCheckingPermission(true);\n setPermissionError(null);\n\n try {\n const hasAccess = await checkPermission(currentRoutePermission, currentPageId);\n \n if (!isMounted) return;\n \n setHasPermission(hasAccess);\n \n // NEW: Phase 1 - Enhanced Security Features\n // Log page access attempt for audit\n if (auditLog) {\n console.log(`[PaceAppLayout] Page access attempt:`, {\n pageName: currentPageId,\n operation: currentRoutePermission,\n userId: user?.id,\n allowed: hasAccess,\n strictMode,\n timestamp: new Date().toISOString()\n });\n }\n \n // Handle strict mode violations\n if (strictMode && !hasAccess) {\n console.error(`[PaceAppLayout] STRICT MODE VIOLATION: User attempted to access protected page without permission`, {\n pageName: currentPageId,\n operation: currentRoutePermission,\n userId: user?.id,\n timestamp: new Date().toISOString()\n });\n \n if (onStrictModeViolation) {\n onStrictModeViolation(currentPageId, currentRoutePermission);\n }\n }\n \n // Handle page access denied callback\n if (!hasAccess && onPageAccessDenied) {\n onPageAccessDenied(currentPageId, currentRoutePermission);\n }\n \n } catch (error) {\n if (!isMounted) return;\n \n console.error(`[PaceAppLayout] Permission check failed for ${currentPageId}:`, error);\n setPermissionError(error instanceof Error ? error : new Error('Permission check failed'));\n setHasPermission(false);\n } finally {\n if (isMounted) {\n setIsCheckingPermission(false);\n }\n }\n };\n\n checkRoutePermission();\n\n return () => {\n isMounted = false;\n };\n }, [enforcePermissions, currentRoutePermission, currentPageId, strictMode, user?.id]);\n\n // Filter navigation items based on permissions\n const [filteredMenuItems, setFilteredMenuItems] = useState<NavigationItem[]>(baseMenuItems);\n\n useEffect(() => {\n if (!filterNavigationByPermissions || !enforcePermissions) {\n setFilteredMenuItems(baseMenuItems);\n return;\n }\n\n let isMounted = true;\n\n const filterItems = async () => {\n const filtered = await Promise.all(\n baseMenuItems.map(async (item) => {\n if (!item.href) return { item, hasAccess: true };\n \n const pageId = pageIdMapping[item.href] || item.href.slice(1) || 'home';\n const permission = routePermissions[item.href] || defaultPermission;\n \n try {\n const hasAccess = await checkPermission(permission, pageId);\n return { item, hasAccess };\n } catch {\n return { item, hasAccess: false };\n }\n })\n );\n\n if (!isMounted) return;\n\n const accessibleItems = filtered\n .filter(({ hasAccess }) => hasAccess)\n .map(({ item }) => item);\n\n setFilteredMenuItems(accessibleItems);\n };\n\n filterItems();\n\n return () => {\n isMounted = false;\n };\n }, [baseMenuItems, filterNavigationByPermissions, enforcePermissions, pageIdMapping, routePermissions, defaultPermission]);\n\n // NEW: Phase 2 - Enhanced Routing Features\n // Check route access for role-based routing\n useEffect(() => {\n if (!roleBasedRouting || routeConfig.length === 0) return;\n \n const currentPath = location.pathname;\n const currentRoute = routeConfig.find(route => route.path === currentPath);\n \n if (!currentRoute) {\n // Route not found in configuration\n if (strictMode) {\n console.error(`[PaceAppLayout] STRICT MODE VIOLATION: Route not found in configuration`, {\n route: currentPath,\n userId: user?.id,\n timestamp: new Date().toISOString()\n });\n \n if (onRouteStrictModeViolation) {\n onRouteStrictModeViolation(currentPath, 'Route not found in configuration');\n }\n }\n return;\n }\n \n // For now, allow all access - this will be enhanced with actual permission checking\n const hasAccess = true; // This will be replaced with actual permission checking\n \n if (!hasAccess) {\n // Handle route access denied\n if (onRouteAccessDenied) {\n onRouteAccessDenied(currentPath, 'Insufficient permissions');\n }\n \n if (strictMode) {\n console.error(`[PaceAppLayout] STRICT MODE VIOLATION: User attempted to access protected route without permission`, {\n route: currentPath,\n userId: user?.id,\n permissions: currentRoute.permissions,\n roles: currentRoute.roles,\n accessLevel: currentRoute.accessLevel,\n timestamp: new Date().toISOString()\n });\n \n if (onRouteStrictModeViolation) {\n onRouteStrictModeViolation(currentPath, 'Insufficient permissions');\n }\n }\n \n // Redirect to fallback route\n navigate(fallbackRoute, { replace: true });\n }\n \n // Log route access attempt for audit\n if (auditLog) {\n console.log(`[PaceAppLayout] Route access attempt:`, {\n route: currentPath,\n userId: user?.id,\n allowed: hasAccess,\n permissions: currentRoute.permissions,\n roles: currentRoute.roles,\n accessLevel: currentRoute.accessLevel,\n timestamp: new Date().toISOString()\n });\n }\n }, [roleBasedRouting, routeConfig, location.pathname, strictMode, user?.id, fallbackRoute]);\n\n const handleSignOut = async () => {\n await signOut();\n };\n\n const handleChangePassword = async (newPassword: string) => {\n // The form component in UserMenu already checks for matching passwords\n const result = await updatePassword(newPassword);\n if (result?.error) {\n // The form will display the error message\n console.error('Failed to change password:', result.error.message);\n }\n // The form will handle closing the modal on success\n return result || { error: null };\n };\n\n // Show loading state while checking permissions\n if (enforcePermissions && isCheckingPermission) {\n return (\n <div className=\"flex items-center justify-center min-h-screen\">\n <div className=\"text-center\">\n <div className=\"animate-spin rounded-full h-8 w-8 border-b-2 border-sec-900 mx-auto mb-4\"></div>\n <p className=\"text-sec-600\">Checking permissions...</p>\n </div>\n </div>\n );\n }\n\n // Show permission error\n if (enforcePermissions && permissionError) {\n return (\n <div className=\"flex items-center justify-center min-h-screen\">\n <div className=\"text-center\">\n <h2 className=\"text-xl font-semibold text-acc-600 mb-2\">Permission Error</h2>\n <p className=\"text-sec-600 mb-4\">{permissionError.message}</p>\n <Button onClick={() => navigate('/')}>Go Home</Button>\n </div>\n </div>\n );\n }\n\n // Show permission fallback if user lacks permission\n if (enforcePermissions && hasPermission === false) {\n // NEW: Phase 1 - Use page permission fallback if available\n if (enforcePagePermissions && pagePermissionFallback) {\n return <>{pagePermissionFallback}</>;\n }\n \n if (permissionFallback) {\n return <>{permissionFallback}</>;\n }\n \n return (\n <div className=\"flex items-center justify-center min-h-screen\">\n <div className=\"text-center\">\n <h2 className=\"text-xl font-semibold text-acc-600 mb-2\">Access Denied</h2>\n <p className=\"text-sec-600 mb-4\">\n You don't have permission to access this page.\n </p>\n <Button onClick={() => navigate('/')}>Go Home</Button>\n </div>\n </div>\n );\n }\n\n return (\n <>\n <Header\n logo={customLogo || undefined}\n logoUrl={!customLogo ? `/${appName.toLowerCase()}_logo_wide.svg` : undefined}\n logoAlt={`${appName} Logo`}\n navItems={filteredMenuItems}\n actions={headerActions}\n userMenu={customUserMenu}\n user={user}\n onSignOut={handleSignOut}\n onChangePassword={handleChangePassword}\n currentPath={window.location.pathname}\n onNavigate={(item) => {\n if (item.href) {\n navigate(item.href);\n }\n }}\n showEventSelector={showEventSelector}\n showUserMenu={showUserMenu}\n className={headerClassName || \"sticky top-0 z-[40] w-full\"}\n />\n <main className=\"px-4 w-[min(var(--app-width),100%)] mx-auto py-8\">\n <Outlet />\n </main>\n <Footer />\n </>\n );\n} ","/**\n * @file PACE Login Page Component\n * @package @jmruthers/pace-core\n * @module Components/PaceLoginPage\n * @since 0.1.0\n *\n * A comprehensive login page component that provides a consistent authentication\n * experience for all PACE suite applications with role-based redirection and\n * enhanced error handling.\n *\n * Features:\n * - Consistent login page layout\n * - Unified authentication integration\n * - Role-based automatic redirection (admin users)\n * - Manual redirection for all successful logins\n * - Customizable app branding\n * - Configurable redirect paths\n * - Enhanced error handling and display\n * - Dual loading state management (auth + form)\n * - Navigation error recovery\n * - Responsive design\n * - Accessibility compliant\n * - Integration with LoginForm\n * - React Router navigation\n * - Centered layout design\n * - Error persistence and display\n *\n * @example\n * ```tsx\n * // Basic login page\n * <PaceLoginPage appName=\"My Application\" />\n * \n * // Login page with custom redirect\n * <PaceLoginPage\n * appName=\"Dashboard App\"\n * onSuccessRedirectPath=\"/dashboard\"\n * />\n * \n * // Login page in router setup\n * <Router>\n * <Routes>\n * <Route path=\"/login\" element={\n * <PaceLoginPage \n * appName=\"My App\"\n * onSuccessRedirectPath=\"/home\"\n * />\n * } />\n * <Route path=\"/home\" element={<HomePage />} />\n * </Routes>\n * </Router>\n * \n * // Login page with authentication provider\n * <UnifiedAuthProvider supabaseClient={supabase} appName=\"My App\">\n * <Router>\n * <Routes>\n * <Route path=\"/login\" element={\n * <PaceLoginPage appName=\"My Application\" />\n * } />\n * <Route path=\"/\" element={<PaceAppLayout appName=\"My Application\" />}>\n * <Route index element={<HomePage />} />\n * </Route>\n * </Routes>\n * </Router>\n * </UnifiedAuthProvider>\n * \n * // Login page with role-based access control\n * function App() {\n * return (\n * <UnifiedAuthProvider supabaseClient={supabase} appName=\"Admin Portal\">\n * <Router>\n * <Routes>\n * <Route path=\"/login\" element={\n * <PaceLoginPage \n * appName=\"Admin Portal\"\n * onSuccessRedirectPath=\"/admin/dashboard\"\n * />\n * } />\n * <Route path=\"/admin/*\" element={<AdminRoutes />} />\n * </Routes>\n * </Router>\n * </UnifiedAuthProvider>\n * );\n * }\n * ```\n *\n * @accessibility\n * - WCAG 2.1 AA compliant\n * - Proper semantic HTML structure\n * - Screen reader friendly\n * - Keyboard navigation support\n * - Focus management\n * - High contrast support\n * - Clear page hierarchy\n * - Accessible form elements\n * - Error announcements\n *\n * @routing\n * - React Router v6 integration\n * - Automatic navigation on success\n * - Role-based redirect logic (admin users)\n * - Configurable redirect paths\n * - Replace navigation for login flow\n * - Navigation error handling\n *\n * @authentication\n * - Integration with UnifiedAuthProvider\n * - Role detection via hasRole('admin')\n * - Loading state management\n * - Error state handling\n * - Session validation\n * - Automatic redirect prevention loops\n *\n * @dependencies\n * - React 18+ - Hooks and effects\n * - React Router v6 - Navigation\n * - UnifiedAuthProvider - Authentication\n * - LoginForm component\n * - Button component\n * - Input component\n * - Label component\n * - Tailwind CSS - Styling\n */\n\nimport React, { useEffect, useState } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { useUnifiedAuth } from '../../providers';\nimport { LoginForm } from '../LoginForm';\nimport { Button, Input, Label } from '..';\n\nexport interface PaceLoginPageProps {\n /** The name of the application to be displayed on the login form. */\n appName: string;\n /** The path to redirect to upon successful login. Defaults to `/`. */\n onSuccessRedirectPath?: string;\n}\n\n/**\n * A consistent, reusable login page for all PACE suite applications.\n * It handles the sign-in logic with role-based automatic redirection for admin users,\n * enhanced error handling, and dual loading state management.\n * \n * Recent enhancements:\n * - Role-based redirection: Admin users are automatically redirected\n * - Enhanced error handling with navigation error recovery\n * - Dual loading states: auth loading + form submission loading\n * - Error persistence: Auth errors are displayed below the form\n * - Navigation safety: Try-catch blocks prevent navigation errors\n * \n * @param props - Login page configuration including app name and redirect path\n * @returns JSX.Element - The rendered login page with enhanced functionality\n * \n * @example\n * ```tsx\n * <PaceLoginPage \n * appName=\"My Application\" \n * onSuccessRedirectPath=\"/dashboard\" \n * />\n * ```\n */\nexport const PaceLoginPage: React.FC<PaceLoginPageProps> = ({\n appName = 'Pace',\n onSuccessRedirectPath = '/'\n}) => {\n const { signIn, isAuthenticated, isLoading, authError, hasRole } = useUnifiedAuth();\n const navigate = useNavigate();\n const [isSigningIn, setIsSigningIn] = useState(false);\n\n useEffect(() => {\n // Only redirect super admin users automatically\n if (isAuthenticated && !isLoading && hasRole('super_admin')) {\n try {\n navigate(onSuccessRedirectPath, { replace: true });\n } catch (error) {\n console.error('Navigation error:', error);\n }\n }\n }, [isAuthenticated, isLoading, navigate, onSuccessRedirectPath, hasRole]);\n\n const handleSubmit = async (data: { email: string; password: string }) => {\n setIsSigningIn(true);\n try {\n const { error } = await signIn(data.email, data.password);\n\n if (!error) {\n try {\n navigate(onSuccessRedirectPath, { replace: true });\n } catch (navError) {\n console.error('Navigation error after sign-in:', navError);\n }\n }\n } finally {\n setIsSigningIn(false);\n }\n };\n\n return (\n <main className=\"min-h-screen grid mx-auto w-fit content-center justify-items-center gap-y-8\" aria-label={`${appName} Login Page`}>\n <img\n src={`/${appName.toLowerCase()}_logo_square.svg`}\n alt={`${appName} logo`}\n className=\"h-48\"\n />\n\n <LoginForm className=\"w-md\"\n onSignIn={handleSubmit}\n appName={appName}\n isLoading={isSigningIn}\n onError={(error) => {\n // LoginForm will handle display of the error\n console.error('Login error:', error);\n }}\n />\n {authError && (\n <em className=\"mt-4 text-destructive text-center\">\n {authError.message}\n </em>\n )}\n\n </main>\n );\n} ","/**\n * @file Error Boundary Component\n * @package @jmruthers/pace-core\n * @module Components/ErrorBoundary\n * @since 0.1.0\n *\n * A comprehensive error boundary component that catches JavaScript errors in child components\n * and provides fallback UI with retry functionality and error reporting.\n *\n * Features:\n * - Catches JavaScript errors in component tree\n * - Custom fallback UI with retry functionality\n * - Error reporting and logging\n * - Performance monitoring integration\n * - Retry mechanism with configurable attempts\n * - Development mode error details\n * - Accessibility compliant error display\n * - Component-specific error tracking\n * - Error ID generation for tracking\n *\n * @example\n * ```tsx\n * // Basic error boundary\n * <ErrorBoundary>\n * <MyComponent />\n * </ErrorBoundary>\n * \n * // Error boundary with custom fallback\n * <ErrorBoundary\n * componentName=\"UserProfile\"\n * fallback={<div>Something went wrong loading the profile.</div>}\n * onError={(error, errorInfo, errorId) => {\n * console.log('Error caught:', errorId, error);\n * }}\n * >\n * <UserProfile />\n * </ErrorBoundary>\n * \n * // Error boundary with retry functionality\n * <ErrorBoundary\n * componentName=\"DataTable\"\n * maxRetries={3}\n * enableRetry={true}\n * enableReporting={true}\n * onError={(error, errorInfo, errorId) => {\n * // Send to error reporting service\n * errorReportingService.report({ error, errorInfo, errorId });\n * }}\n * >\n * <DataTable data={data} />\n * </ErrorBoundary>\n * \n * // Wrapping multiple components\n * <ErrorBoundary componentName=\"App\">\n * <Header />\n * <ErrorBoundary componentName=\"MainContent\">\n * <MainContent />\n * </ErrorBoundary>\n * <Footer />\n * </ErrorBoundary>\n * ```\n *\n * @accessibility\n * - WCAG 2.1 AA compliant\n * - Proper ARIA role=\"alert\" for error announcements\n * - Screen reader friendly error messages\n * - Keyboard accessible retry buttons\n * - High contrast error styling\n * - Clear error identification\n *\n * @performance\n * - Efficient error state management\n * - Performance monitoring integration\n * - Minimal impact on normal rendering\n * - Configurable error reporting\n *\n * @dependencies\n * - React 18+ - Component lifecycle\n * - Performance monitoring utilities\n * - Tailwind CSS - Styling\n */\n\nimport React, { Component, ReactNode } from 'react';\nimport { performanceBudgetMonitor } from '../../utils/performanceBudgets';\n\n/**\n * State interface for the ErrorBoundary component\n * @public\n */\nexport interface ErrorBoundaryState {\n /** Whether an error has been caught */\n hasError: boolean;\n /** The error that was caught */\n error?: Error;\n /** Additional error information from React */\n errorInfo?: React.ErrorInfo;\n /** Unique identifier for the error */\n errorId?: string;\n /** Number of retry attempts made */\n retryCount: number;\n}\n\n/**\n * Props interface for the ErrorBoundary component\n * @public\n */\nexport interface ErrorBoundaryProps {\n /** Child components to wrap with error boundary */\n children: ReactNode;\n /** Name of the component for error reporting */\n componentName?: string;\n /** Custom fallback UI to display when error occurs */\n fallback?: ReactNode;\n /** Callback function called when an error is caught */\n onError?: (error: Error, errorInfo: React.ErrorInfo, errorId: string) => void;\n /** Maximum number of retry attempts */\n maxRetries?: number;\n /** Whether to enable retry functionality */\n enableRetry?: boolean;\n /** Whether to enable error reporting */\n enableReporting?: boolean;\n}\n\n/**\n * ErrorBoundary component\n * Catches JavaScript errors in child components and provides fallback UI\n * \n * @example\n * ```tsx\n * <ErrorBoundary\n * componentName=\"MyComponent\"\n * maxRetries={3}\n * onError={(error, errorInfo, errorId) => {\n * console.log('Error caught:', errorId);\n * }}\n * >\n * <MyComponent />\n * </ErrorBoundary>\n * ```\n */\nexport class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {\n private retryTimeoutId: NodeJS.Timeout | null = null;\n\n constructor(props: ErrorBoundaryProps) {\n super(props);\n this.state = { \n hasError: false, \n retryCount: 0 \n };\n }\n\n static getDerivedStateFromError(error: Error): Partial<ErrorBoundaryState> {\n const errorId = `error_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;\n return { \n hasError: true, \n error,\n errorId \n };\n }\n\n componentDidCatch(error: Error, errorInfo: React.ErrorInfo) {\n const { componentName = 'Unknown Component', onError, enableReporting = true } = this.props;\n const errorId = this.state.errorId!;\n \n this.setState({ errorInfo });\n \n // Enhanced logging with component name and error ID\n console.error(`ErrorBoundary [${componentName}] caught error ${errorId}:`, error, errorInfo);\n \n // Performance monitoring - track error occurrence\n performanceBudgetMonitor.measure('ERROR_BOUNDARY_TRIGGER', 1, {\n componentName,\n errorId,\n errorMessage: error.message,\n stack: error.stack?.substring(0, 200), // Truncated stack trace\n });\n\n // Report error if enabled\n if (enableReporting) {\n this.reportError(errorId, componentName);\n }\n \n // Call custom error handler if provided\n if (onError) {\n onError(error, errorInfo, errorId);\n }\n }\n\n private reportError = (errorId: string, componentName: string) => {\n // In production, this would send to error reporting service\n if (process.env.NODE_ENV === 'production') {\n // Example: Send to error reporting service\n // errorReportingService.report({ error, errorInfo, errorId, componentName });\n console.warn('Error reporting would be triggered in production:', { errorId, componentName });\n }\n };\n\n private handleRetry = () => {\n const { maxRetries = 3 } = this.props;\n const { retryCount } = this.state;\n\n if (retryCount < maxRetries) {\n console.log(`Retrying component render (attempt ${retryCount + 1}/${maxRetries})`);\n \n this.setState(prevState => ({\n hasError: false,\n error: undefined,\n errorInfo: undefined,\n errorId: undefined,\n retryCount: prevState.retryCount + 1\n }));\n }\n };\n\n componentWillUnmount() {\n if (this.retryTimeoutId) {\n clearTimeout(this.retryTimeoutId);\n }\n }\n\n render() {\n if (this.state.hasError) {\n const { \n componentName = 'Component', \n fallback, \n enableRetry = true, \n maxRetries = 3 \n } = this.props;\n const { retryCount, errorId } = this.state;\n\n // Use custom fallback if provided\n if (fallback) {\n return fallback;\n }\n\n // Enhanced error UI with retry functionality\n return (\n <div \n role=\"alert\" \n className=\"p-6 bg-destructive/10 border border-destructive/20 rounded-lg\"\n data-error-boundary={errorId}\n >\n <div className=\"flex items-start gap-3\">\n <div className=\"flex-shrink-0\">\n <svg className=\"w-5 h-5 text-destructive\" viewBox=\"0 0 20 20\" fill=\"currentColor\">\n <path fillRule=\"evenodd\" d=\"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z\" clipRule=\"evenodd\" />\n </svg>\n </div>\n <div className=\"flex-1 min-w-0\">\n <h3 className=\"text-destructive\">\n Error in {componentName}\n </h3>\n <p className=\"text-destructive/80\">\n {this.state.error?.message || 'An unexpected error occurred.'}\n </p>\n \n {enableRetry && retryCount < maxRetries && (\n <div className=\"flex gap-3 mb-4\">\n <button\n onClick={this.handleRetry}\n className=\"px-4 py-2 bg-destructive text-destructive-foreground rounded-md hover:bg-destructive/90 transition-colors text-sm font-medium\"\n >\n Retry ({retryCount + 1}/{maxRetries})\n </button>\n <button\n onClick={() => window.location.reload()}\n className=\"px-4 py-2 bg-sec-600 text-main-50 rounded-md hover:bg-sec-700 transition-colors text-sm font-medium\"\n >\n Reload Page\n </button>\n </div>\n )}\n\n {retryCount >= maxRetries && (\n <div className=\"mb-4 p-3 bg-acc-50 border border-acc-200 rounded-md\">\n <p className=\"text-acc-800\">\n Maximum retry attempts reached. Please reload the page or contact support.\n </p>\n <button\n onClick={() => window.location.reload()}\n className=\"mt-2 px-3 py-1 bg-acc-600 text-main-50 rounded text-sm hover:bg-acc-700\"\n >\n Reload Page\n </button>\n </div>\n )}\n\n {process.env.NODE_ENV === 'development' && this.state.error && (\n <details className=\"text-sm text-destructive/70\">\n <summary className=\"cursor-pointer font-medium mb-2\">\n Error Details (Development)\n </summary>\n <div className=\"bg-destructive/5 p-3 rounded border\">\n <p className=\"font-mono\">Error ID: {errorId}</p>\n <pre className=\"whitespace-pre-wrap text-xs overflow-auto max-h-32\">\n {this.state.error.toString()}\n {this.state.errorInfo?.componentStack}\n </pre>\n </div>\n </details>\n )}\n </div>\n </div>\n </div>\n );\n }\n\n return this.props.children;\n }\n}\n\nexport default ErrorBoundary;\n","/**\n * @file Organisation Selector Component\n * @package @jmruthers/pace-core\n * @module Components/OrganisationSelector\n * @since 0.4.0\n *\n * A secure organisation selector component that allows users to switch between organisations\n * they have access to. Includes role display and security validation.\n *\n * Features:\n * - Secure organisation switching with validation\n * - Role display for each organisation\n * - Real-time organisation validation\n * - Accessible dropdown interface\n * - Error handling for security violations\n * - Loading states and feedback\n * - Integration with OrganisationProvider\n *\n * @example\n * ```tsx\n * // Basic organisation selector\n * <OrganisationSelector \n * onOrganisationChange={(org) => console.log('Switched to:', org.display_name)}\n * />\n * \n * // Compact version for header\n * <OrganisationSelector \n * className=\"w-48\" \n * compact={true}\n * showRole={true}\n * />\n * \n * // With custom placeholder\n * <OrganisationSelector \n * placeholder=\"Choose organisation...\"\n * showNoOrganisationsMessage={true}\n * />\n * ```\n *\n * @accessibility\n * - WCAG 2.1 AA compliant\n * - Keyboard navigation support\n * - Screen reader friendly\n * - Focus management\n * - ARIA labels and descriptions\n * - High contrast support\n *\n * @security\n * - Validates user access to organisations\n * - Prevents switching to unauthorised organisations\n * - Error handling for security violations\n * - Real-time access validation\n * - Secure organisation data handling\n */\n\nimport React, { useState, useCallback } from 'react';\nimport { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '../Select';\nimport { Alert, AlertDescription } from '../Alert/Alert';\nimport { Button } from '../Button/Button';\nimport { LoadingSpinner } from '../LoadingSpinner/LoadingSpinner';\nimport { RefreshCw, AlertCircle, Building2, Shield } from 'lucide-react';\nimport { useOrganisations } from '../../providers/OrganisationProvider';\nimport type { Organisation } from '../../types/organisation';\n\nexport interface OrganisationSelectorProps {\n /** Placeholder text for the dropdown */\n placeholder?: string;\n /** Additional CSS classes */\n className?: string;\n /** Callback fired when organisation changes, providing full organisation object */\n onOrganisationChange?: (org: Organisation) => void;\n /** Show friendly message when no organisations available */\n showNoOrganisationsMessage?: boolean;\n /** Show retry button on errors */\n showRetryButton?: boolean;\n /** Show user's role in each organisation */\n showRole?: boolean;\n /** Compact display mode */\n compact?: boolean;\n /** Disabled state */\n disabled?: boolean;\n}\n\n/**\n * OrganisationSelector component for secure organisation switching\n * \n * This component provides secure organisation selection with:\n * - User membership validation\n * - Role-based access display\n * - Security error handling\n * - Real-time organisation switching\n * - Accessible interface design\n * \n * Security: Only shows organisations the user has valid access to\n */\nexport function OrganisationSelector({\n placeholder = \"Select organisation\",\n className,\n onOrganisationChange,\n showNoOrganisationsMessage = true,\n showRetryButton = true,\n showRole = false,\n compact = false,\n disabled = false\n}: OrganisationSelectorProps) {\n const [isLoading, setIsLoading] = useState(false);\n const [switchError, setSwitchError] = useState<string | null>(null);\n \n const { \n organisations, \n selectedOrganisation, \n isLoading: orgLoading,\n error: orgError,\n switchOrganisation,\n getUserRole,\n validateOrganisationAccess,\n refreshOrganisations\n } = useOrganisations();\n\n\n const handleOrganisationChange = useCallback(async (orgId: string) => {\n if (disabled || isLoading) return;\n \n setSwitchError(null);\n setIsLoading(true);\n \n try {\n // Validate access before attempting switch\n if (!validateOrganisationAccess(orgId)) {\n throw new Error('You do not have access to this organisation');\n }\n \n await switchOrganisation(orgId);\n \n const newOrganisation = organisations.find(org => org.id === orgId);\n if (newOrganisation && onOrganisationChange) {\n onOrganisationChange(newOrganisation);\n }\n \n console.log(\"[OrganisationSelector] Successfully switched to organisation:\", orgId);\n } catch (error) {\n console.error(\"[OrganisationSelector] Failed to switch organisation:\", error);\n setSwitchError(error instanceof Error ? error.message : 'Failed to switch organisation');\n } finally {\n setIsLoading(false);\n }\n }, [\n disabled, \n isLoading, \n validateOrganisationAccess, \n switchOrganisation, \n organisations, \n onOrganisationChange\n ]);\n\n const handleRetry = useCallback(async () => {\n setIsLoading(true);\n setSwitchError(null);\n try {\n await refreshOrganisations();\n } catch (error) {\n console.error(\"[OrganisationSelector] Failed to refresh organisations:\", error);\n setSwitchError('Failed to refresh organisations');\n } finally {\n setIsLoading(false);\n }\n }, [refreshOrganisations]);\n\n // Loading state\n if (orgLoading) {\n return (\n <div className={`flex items-center gap-2 ${className}`}>\n <LoadingSpinner size=\"sm\" />\n <span className=\"text-sm text-muted-foreground\">\n {compact ? \"Loading...\" : \"Loading organisations...\"}\n </span>\n </div>\n );\n }\n\n // Error state\n if (orgError) {\n return (\n <div className={`space-y-2 ${className}`}>\n <Alert variant=\"destructive\">\n <AlertCircle className=\"h-4 w-4\" />\n <AlertDescription>\n Failed to load organisations: {orgError.message}\n </AlertDescription>\n </Alert>\n {showRetryButton && (\n <Button \n variant=\"outline\" \n size=\"sm\" \n onClick={handleRetry}\n disabled={isLoading}\n className=\"w-full\"\n >\n <RefreshCw className={`h-4 w-4 mr-2 ${isLoading ? 'animate-spin' : ''}`} />\n Retry\n </Button>\n )}\n </div>\n );\n }\n\n // No organisations available\n if (organisations.length === 0) {\n if (showNoOrganisationsMessage) {\n return (\n <div className={`space-y-2 ${className}`}>\n <Alert>\n <Building2 className=\"h-4 w-4\" />\n <AlertDescription>\n No organisations available. Please contact your administrator to be added to an organisation.\n </AlertDescription>\n </Alert>\n {showRetryButton && (\n <Button \n variant=\"outline\" \n size=\"sm\" \n onClick={handleRetry}\n disabled={isLoading}\n className=\"w-full\"\n >\n <RefreshCw className={`h-4 w-4 mr-2 ${isLoading ? 'animate-spin' : ''}`} />\n Check Again\n </Button>\n )}\n </div>\n );\n }\n return null;\n }\n\n // Switch error display\n const switchErrorDisplay = switchError && (\n <Alert variant=\"destructive\" className=\"mt-2\">\n <AlertCircle className=\"h-4 w-4\" />\n <AlertDescription>{switchError}</AlertDescription>\n </Alert>\n );\n\n // Normal selector state\n return (\n <div className={`space-y-2 ${className}`}>\n <Select \n value={selectedOrganisation.id}\n onValueChange={handleOrganisationChange}\n disabled={disabled || isLoading}\n >\n <SelectTrigger className={`${isLoading ? 'opacity-50' : ''}`}>\n <div className=\"flex items-center gap-2\">\n {isLoading ? (\n <LoadingSpinner size=\"sm\" />\n ) : (\n <Building2 className=\"h-4 w-4 text-muted-foreground\" />\n )}\n <SelectValue placeholder={placeholder} />\n </div>\n </SelectTrigger>\n <SelectContent>\n {organisations.map((org) => {\n const userRole = getUserRole(org.id);\n const hasAccess = validateOrganisationAccess(org.id);\n \n return (\n <SelectItem \n key={org.id} \n value={org.id}\n disabled={!hasAccess}\n className={!hasAccess ? 'opacity-50' : ''}\n >\n <div className=\"flex items-center justify-between w-full\">\n <div className=\"flex items-center gap-2\">\n <Building2 className=\"h-4 w-4\" />\n <div className=\"flex flex-col\">\n <span className=\"font-medium\">{org.display_name}</span>\n {!compact && org.description && (\n <span className=\"text-xs text-muted-foreground truncate max-w-40\">\n {org.description}\n </span>\n )}\n </div>\n </div>\n {showRole && (\n <div className=\"flex items-center gap-1 ml-4\">\n <Shield className=\"h-3 w-3 text-muted-foreground\" />\n <span className=\"text-xs text-muted-foreground capitalize\">\n {userRole.replace('_', ' ')}\n </span>\n </div>\n )}\n </div>\n </SelectItem>\n );\n })}\n </SelectContent>\n </Select>\n \n {switchErrorDisplay}\n </div>\n );\n} ","/**\n * @file Password Reset Form Component\n * @package @jmruthers/pace-core\n * @module Components/PasswordReset\n * @since 0.1.0\n *\n * A comprehensive password reset form component that handles email-based password recovery\n * with proper validation, loading states, and success feedback.\n *\n * Features:\n * - Email validation and submission\n * - Loading states with disabled form\n * - Success state with confirmation message\n * - Error handling and display\n * - Resend functionality\n * - Accessibility compliant\n * - Responsive design\n * - Integration with UnifiedAuthProvider\n * - Form validation\n * - Success and error callbacks\n *\n * @example\n * ```tsx\n * // Basic password reset form\n * <PasswordResetForm\n * onSuccess={() => {\n * toast.success('Password reset email sent!');\n * }}\n * onError={(error) => {\n * toast.error(`Failed to send reset email: ${error.message}`);\n * }}\n * />\n * \n * // Password reset form with custom styling\n * <PasswordResetForm\n * className=\"max-w-md mx-auto p-6 bg-main-50 rounded-lg shadow-md\"\n * onSuccess={() => {\n * console.log('Reset email sent successfully');\n * navigate('/check-email');\n * }}\n * onError={(error) => {\n * console.error('Password reset failed:', error);\n * }}\n * />\n * \n * // Password reset form in a modal\n * <Modal isOpen={showResetForm} onClose={() => setShowResetForm(false)}>\n * <ModalContent>\n * <PasswordResetForm\n * onSuccess={() => {\n * setShowResetForm(false);\n * toast.success('Check your email for reset instructions');\n * }}\n * onError={(error) => {\n * toast.error(error.message);\n * }}\n * />\n * </ModalContent>\n * </Modal>\n * ```\n *\n * @accessibility\n * - WCAG 2.1 AA compliant\n * - Proper form labels and associations\n * - Screen reader friendly error messages\n * - Keyboard navigation support\n * - Focus management\n * - High contrast support\n * - Clear error identification\n * - Role=\"alert\" for error announcements\n *\n * @dependencies\n * - React 18+ - Hooks and state\n * - UnifiedAuthProvider - Authentication context\n * - Button component\n * - Input component\n * - Label component\n * - Tailwind CSS - Styling\n */\n\nimport React, { useState } from 'react';\nimport { Button } from '../Button/Button';\nimport { Input } from '../Input/Input';\nimport { Label } from '../Label';\nimport { cn } from '../../utils/cn';\nimport { useUnifiedAuth } from '../../providers/UnifiedAuthProvider';\n\nexport interface PasswordResetFormProps {\n onSuccess?: () => void;\n onError?: (error: Error) => void;\n className?: string;\n}\n\nexport function PasswordResetForm({\n onSuccess,\n onError,\n className\n}: PasswordResetFormProps) {\n const { resetPassword } = useUnifiedAuth();\n const [email, setEmail] = useState('');\n const [isLoading, setIsLoading] = useState(false);\n const [isSuccess, setIsSuccess] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n const handleSubmit = async (e: React.FormEvent) => {\n e.preventDefault();\n \n if (!email.trim()) {\n return;\n }\n\n setIsLoading(true);\n setError(null);\n\n try {\n const { error: resetError } = await resetPassword(email);\n \n if (resetError) {\n const errorObj = new Error(resetError.message || 'Failed to send reset email');\n setError(errorObj.message);\n onError?.(errorObj);\n } else {\n setIsSuccess(true);\n onSuccess?.();\n }\n } catch (err) {\n const errorObj = err instanceof Error ? err : new Error('An unexpected error occurred');\n setError(errorObj.message);\n onError?.(errorObj);\n } finally {\n setIsLoading(false);\n }\n };\n\n const handleSendAnother = () => {\n setIsSuccess(false);\n setError(null);\n };\n\n if (isSuccess) {\n return (\n <div className={cn('', className)} role=\"form\">\n <div className=\"space-y-4 text-center\">\n <h2>Check your email</h2>\n <p className=\"text-sec-600\">\n We have sent a password reset link to {email}\n </p>\n <Button \n variant=\"outline\" \n onClick={handleSendAnother}\n className=\"w-full\"\n >\n Send another email\n </Button>\n </div>\n </div>\n );\n }\n\n return (\n <div className={cn('', className)} role=\"form\">\n <div className=\"space-y-4\">\n <div className=\"space-y-2\">\n <h2>Reset Password</h2>\n <p className=\"text-sec-600\">\n Enter your email address and we'll send you a reset link.\n </p>\n </div>\n\n <form onSubmit={handleSubmit} className=\"space-y-4\">\n <div className=\"space-y-2\">\n <Label htmlFor=\"email\">Email Address</Label>\n <Input\n id=\"email\"\n type=\"email\"\n value={email}\n onChange={(e) => setEmail(e.target.value)}\n placeholder=\"Enter your email\"\n required\n disabled={isLoading}\n />\n </div>\n\n {error && (\n <div className=\"text-sm text-destructive\" role=\"alert\">\n {error}\n </div>\n )}\n\n <Button\n type=\"submit\"\n className=\"w-full\"\n disabled={!email.trim() || isLoading}\n >\n {isLoading ? 'Sending...' : 'Send Reset Link'}\n </Button>\n </form>\n </div>\n </div>\n );\n}\n","/**\n * Storage configuration for pace-core\n */\n\nimport { FileSizeLimits, StorageConfig } from './types';\n\n/**\n * File size limits by MIME type (in bytes)\n */\nexport const FILE_SIZE_LIMITS: FileSizeLimits = {\n // Images\n 'image/jpeg': 5 * 1024 * 1024, // 5MB\n 'image/png': 5 * 1024 * 1024, // 5MB\n 'image/gif': 10 * 1024 * 1024, // 10MB (for animations)\n 'image/webp': 5 * 1024 * 1024, // 5MB\n 'image/svg+xml': 1 * 1024 * 1024, // 1MB (vector graphics)\n \n // Documents\n 'application/pdf': 50 * 1024 * 1024, // 50MB\n 'application/msword': 25 * 1024 * 1024, // 25MB\n 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': 25 * 1024 * 1024, // 25MB\n 'application/vnd.ms-excel': 25 * 1024 * 1024, // 25MB\n 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': 25 * 1024 * 1024, // 25MB\n \n // Archives\n 'application/zip': 100 * 1024 * 1024, // 100MB\n 'application/x-rar-compressed': 100 * 1024 * 1024, // 100MB\n \n // Text files\n 'text/plain': 1 * 1024 * 1024, // 1MB\n 'text/csv': 10 * 1024 * 1024, // 10MB\n 'application/json': 10 * 1024 * 1024, // 10MB\n};\n\n/**\n * Default file size limit for unknown MIME types\n */\nexport const DEFAULT_FILE_SIZE_LIMIT = 10 * 1024 * 1024; // 10MB\n\n/**\n * App-specific path mappings for file organization\n * Maps app names to their primary category in the organization-first structure\n */\nexport const APP_PATH_MAPPING: Record<string, string> = {\n 'PACE': 'event_logos',\n 'TRAC': 'trac_accommodation', // Default category for TRAC files\n 'MEDI': 'documents',\n 'CAKE': 'documents'\n};\n\n/**\n * Storage configuration\n */\nexport const STORAGE_CONFIG: StorageConfig = {\n bucketName: 'files',\n fileSizeLimits: FILE_SIZE_LIMITS,\n defaultFileSizeLimit: DEFAULT_FILE_SIZE_LIMIT,\n};\n\n/**\n * Get the file size limit for a given MIME type\n */\nexport function getFileSizeLimit(mimeType: string): number {\n return STORAGE_CONFIG.fileSizeLimits[mimeType] || STORAGE_CONFIG.defaultFileSizeLimit;\n}\n\n/**\n * Validate file size against limits\n */\nexport function validateFileSize(file: File): { isValid: boolean; error?: string } {\n const limit = getFileSizeLimit(file.type);\n \n if (file.size > limit) {\n const limitMB = Math.round(limit / (1024 * 1024));\n const fileMB = Math.round(file.size / (1024 * 1024));\n return {\n isValid: false,\n error: `File size (${fileMB}MB) exceeds limit (${limitMB}MB) for ${file.type}`\n };\n }\n \n return { isValid: true };\n}\n\n/**\n * Get human-readable file size\n */\nexport function formatFileSize(bytes: number): string {\n if (bytes === 0) return '0 Bytes';\n if (bytes < 0) return `${bytes} Bytes`; // Handle negative numbers\n \n const k = 1024;\n const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];\n const i = Math.floor(Math.log(bytes) / Math.log(k));\n \n // Ensure we don't exceed the available size units\n const sizeIndex = Math.min(Math.max(i, 0), sizes.length - 1);\n \n return parseFloat((bytes / Math.pow(k, sizeIndex)).toFixed(2)) + ' ' + sizes[sizeIndex];\n}\n","/**\n * Storage helper functions for pace-core\n */\n\nimport { SupabaseClient } from '@supabase/supabase-js';\nimport { \n StorageUploadOptions, \n StorageUploadResult, \n StorageFileMetadata,\n StorageUrlOptions,\n StorageListOptions,\n StorageListResult,\n StorageFileInfo\n} from './types';\nimport { validateFileSize, STORAGE_CONFIG } from './config';\n\n/**\n * Generate a file path based on app-first structure\n */\nexport function generateFilePath(options: StorageUploadOptions, fileName: string): string {\n const { appName, orgId, isPublic = false, customPath } = options;\n \n if (isPublic) {\n // Public files go to public/assets/{appName}/ or public/{customPath}/\n if (customPath) {\n return `public/${customPath}/${fileName}`;\n }\n return `public/assets/${appName}/${fileName}`;\n }\n \n // Map app-specific categories to standardized categories\n const categoryMap: Record<string, string> = {\n 'accommodation': 'trac_accommodation',\n 'activity': 'trac_activity',\n 'transport': 'trac_transport',\n 'journal': 'trac_journal',\n 'logos': 'event_logos',\n 'documents': 'files'\n };\n \n // App-first structure: apps/{appName}/{orgId}/{category}/filename\n if (customPath) {\n const mappedCategory = categoryMap[customPath] || customPath;\n return `apps/${appName}/${orgId}/${mappedCategory}/${fileName}`;\n }\n \n // Default to files category if no custom path specified\n return `apps/${appName}/${orgId}/files/${fileName}`;\n}\n\n/**\n * Generate a unique filename with timestamp and UUID\n */\nexport function generateUniqueFileName(originalName: string): string {\n const timestamp = Date.now();\n const uuid = crypto.randomUUID();\n const extension = originalName.split('.').pop() || '';\n const baseName = originalName.replace(/\\.[^/.]+$/, '');\n \n return `${timestamp}-${uuid}-${baseName}.${extension}`;\n}\n\n/**\n * Extract file metadata from a File object\n */\nexport async function extractFileMetadata(\n file: File, \n options: StorageUploadOptions,\n uploadedBy: string\n): Promise<StorageFileMetadata> {\n const metadata: StorageFileMetadata = {\n mimeType: file.type,\n size: file.size,\n orgId: options.orgId,\n appName: options.appName,\n uploadedBy,\n uploadedAt: new Date().toISOString(),\n tags: options.tags || [],\n isPublic: options.isPublic || false,\n customMetadata: options.metadata || {}\n };\n\n // Extract image dimensions if it's an image\n if (file.type.startsWith('image/')) {\n try {\n const dimensions = await getImageDimensions(file);\n metadata.width = dimensions.width;\n metadata.height = dimensions.height;\n } catch (error) {\n console.warn('Could not extract image dimensions:', error);\n }\n }\n\n // Generate file hash if possible\n try {\n metadata.hash = await generateFileHash(file);\n } catch (error) {\n console.warn('Could not generate file hash:', error);\n }\n\n return metadata;\n}\n\n/**\n * Get image dimensions from a File object\n */\nasync function getImageDimensions(file: File): Promise<{ width: number; height: number }> {\n return new Promise((resolve, reject) => {\n const img = new Image();\n const url = URL.createObjectURL(file);\n \n img.onload = () => {\n URL.revokeObjectURL(url);\n resolve({ width: img.width, height: img.height });\n };\n \n img.onerror = () => {\n URL.revokeObjectURL(url);\n reject(new Error('Could not load image'));\n };\n \n img.src = url;\n });\n}\n\n/**\n * Generate a hash for a file\n */\nasync function generateFileHash(file: File): Promise<string> {\n const buffer = await file.arrayBuffer();\n const hashBuffer = await crypto.subtle.digest('SHA-256', buffer);\n const hashArray = Array.from(new Uint8Array(hashBuffer));\n const hashHex = hashArray.map(b => b.toString(16).padStart(2, '0')).join('');\n return `sha256:${hashHex}`;\n}\n\n/**\n * Upload a file to Supabase storage with app segregation\n */\nexport async function uploadFile(\n supabase: SupabaseClient,\n file: File,\n options: StorageUploadOptions\n): Promise<StorageUploadResult> {\n try {\n // Validate file size\n const sizeValidation = validateFileSize(file);\n if (!sizeValidation.isValid) {\n return {\n success: false,\n error: sizeValidation.error\n };\n }\n\n // Generate unique filename and path\n const uniqueFileName = generateUniqueFileName(file.name);\n const filePath = generateFilePath(options, uniqueFileName);\n\n // Extract metadata\n const metadata = await extractFileMetadata(file, options, 'current-user'); // TODO: Get actual user ID\n\n // Upload file to Supabase\n const { data, error } = await supabase.storage\n .from(STORAGE_CONFIG.bucketName)\n .upload(filePath, file, {\n cacheControl: '3600',\n upsert: false,\n contentType: file.type\n });\n\n if (error) {\n return {\n success: false,\n error: `Upload failed: ${error.message}`\n };\n }\n\n // Generate public URL if file is public\n let publicUrl: string | undefined;\n if (options.isPublic) {\n const { data: urlData } = supabase.storage\n .from(STORAGE_CONFIG.bucketName)\n .getPublicUrl(filePath);\n publicUrl = urlData.publicUrl;\n }\n\n return {\n success: true,\n path: filePath,\n publicUrl,\n metadata\n };\n\n } catch (error) {\n return {\n success: false,\n error: `Upload failed: ${error instanceof Error ? error.message : 'Unknown error'}`\n };\n }\n}\n\n/**\n * Get a public URL for a file\n */\nexport function getPublicUrl(supabase: SupabaseClient, path: string): string {\n const { data } = supabase.storage\n .from(STORAGE_CONFIG.bucketName)\n .getPublicUrl(path);\n \n return data.publicUrl;\n}\n\n/**\n * Get a signed URL for a protected file\n */\nexport async function getSignedUrl(\n supabase: SupabaseClient,\n path: string,\n options: StorageUrlOptions\n): Promise<{ url: string; expiresAt: string } | null> {\n try {\n const { data, error } = await supabase.storage\n .from(STORAGE_CONFIG.bucketName)\n .createSignedUrl(path, options.expiresIn || 3600);\n\n if (error) {\n console.error('Failed to create signed URL:', error);\n return null;\n }\n\n return {\n url: data.signedUrl,\n expiresAt: new Date(Date.now() + (options.expiresIn || 3600) * 1000).toISOString()\n };\n } catch (error) {\n console.error('Failed to create signed URL:', error);\n return null;\n }\n}\n\n/**\n * Delete a file from storage\n */\nexport async function deleteFile(\n supabase: SupabaseClient,\n path: string\n): Promise<{ success: boolean; error?: string }> {\n try {\n const { error } = await supabase.storage\n .from(STORAGE_CONFIG.bucketName)\n .remove([path]);\n\n if (error) {\n return {\n success: false,\n error: `Delete failed: ${error.message}`\n };\n }\n\n return { success: true };\n } catch (error) {\n return {\n success: false,\n error: `Delete failed: ${error instanceof Error ? error.message : 'Unknown error'}`\n };\n }\n}\n\n/**\n * List files in an organization scope\n */\nexport async function listFiles(\n supabase: SupabaseClient,\n options: StorageListOptions\n): Promise<StorageListResult> {\n try {\n // App-first structure: apps/{appName}/{orgId}/{category}/\n const pathPrefix = `apps/${options.appName}/${options.orgId}/`;\n const searchPath = options.pathPrefix ? `${pathPrefix}${options.pathPrefix}` : pathPrefix;\n\n const { data, error } = await supabase.storage\n .from(STORAGE_CONFIG.bucketName)\n .list(searchPath, {\n limit: options.limit || 100,\n offset: options.offset || 0,\n sortBy: { column: 'created_at', order: 'desc' }\n });\n\n if (error) {\n console.error('Failed to list files:', error);\n return { files: [], totalCount: 0, hasMore: false };\n }\n\n const files: StorageFileInfo[] = (data || []).map(item => ({\n name: item.name,\n path: `${searchPath}${item.name}`,\n size: item.metadata?.size || 0,\n mimeType: item.metadata?.mimetype || 'application/octet-stream',\n lastModified: item.updated_at || item.created_at || new Date().toISOString(),\n metadata: {\n mimeType: item.metadata?.mimetype || 'application/octet-stream',\n size: item.metadata?.size || 0,\n orgId: options.orgId,\n appName: options.appName,\n uploadedBy: 'unknown',\n uploadedAt: item.created_at || new Date().toISOString(),\n isPublic: false\n }\n }));\n\n return {\n files,\n totalCount: files.length,\n hasMore: files.length >= (options.limit || 100)\n };\n } catch (error) {\n console.error('Failed to list files:', error);\n return { files: [], totalCount: 0, hasMore: false };\n }\n}\n\n/**\n * Move a file to archived location (soft delete)\n */\nexport async function archiveFile(\n supabase: SupabaseClient,\n path: string,\n options: { appName: string; orgId: string }\n): Promise<{ success: boolean; error?: string }> {\n try {\n // Generate archived path for app-first structure\n const archivedPath = path.replace(`apps/${options.appName}/${options.orgId}/`, `archived/${options.appName}/${options.orgId}/`);\n \n // Copy file to archived location\n const { error: copyError } = await supabase.storage\n .from(STORAGE_CONFIG.bucketName)\n .copy(path, archivedPath);\n\n if (copyError) {\n return {\n success: false,\n error: `Archive failed: ${copyError.message}`\n };\n }\n\n // Delete original file\n const deleteResult = await deleteFile(supabase, path);\n if (!deleteResult.success) {\n return deleteResult;\n }\n\n return { success: true };\n } catch (error) {\n return {\n success: false,\n error: `Archive failed: ${error instanceof Error ? error.message : 'Unknown error'}`\n };\n }\n}\n","/**\n * React hook for storage operations\n */\n\nimport { useState, useCallback } from 'react';\nimport { SupabaseClient } from '@supabase/supabase-js';\nimport { \n StorageUploadOptions, \n StorageUploadResult, \n StorageFileInfo,\n StorageListOptions,\n StorageListResult,\n uploadFile,\n getPublicUrl,\n getSignedUrl,\n deleteFile,\n listFiles,\n archiveFile\n} from '../utils/storage';\n\nexport interface UseStorageOptions {\n supabase: SupabaseClient;\n appName: string;\n orgId: string;\n}\n\nexport interface UseStorageReturn {\n // Upload\n uploadFile: (file: File, options?: Partial<StorageUploadOptions>) => Promise<StorageUploadResult>;\n isUploading: boolean;\n uploadError: string | null;\n \n // URLs\n getPublicUrl: (path: string) => string;\n getSignedUrl: (path: string, expiresIn?: number) => Promise<string | null>;\n getFileUrl: (path: string) => string; // Alias for getPublicUrl\n \n // File management\n deleteFile: (path: string) => Promise<{ success: boolean; error?: string }>;\n archiveFile: (path: string) => Promise<{ success: boolean; error?: string }>;\n \n // Listing\n listFiles: (options?: Partial<StorageListOptions>) => Promise<StorageListResult>;\n isListing: boolean;\n listError: string | null;\n isLoading: boolean; // Alias for isListing\n error: string | null; // Alias for listError\n \n // State\n files: StorageFileInfo[];\n refreshFiles: () => Promise<void>;\n}\n\n/**\n * Hook for storage operations with app and organisation context\n */\nexport function useStorage({ supabase, appName, orgId }: UseStorageOptions): UseStorageReturn {\n const [isUploading, setIsUploading] = useState(false);\n const [uploadError, setUploadError] = useState<string | null>(null);\n const [isListing, setIsListing] = useState(false);\n const [listError, setListError] = useState<string | null>(null);\n const [files, setFiles] = useState<StorageFileInfo[]>([]);\n\n // Upload file\n const handleUploadFile = useCallback(async (\n file: File, \n options: Partial<StorageUploadOptions> = {}\n ): Promise<StorageUploadResult> => {\n setIsUploading(true);\n setUploadError(null);\n\n try {\n const uploadOptions: StorageUploadOptions = {\n appName,\n orgId,\n isPublic: false,\n ...options\n };\n\n const result = await uploadFile(supabase, file, uploadOptions);\n \n if (result.success) {\n // Refresh file list\n await refreshFiles();\n } else {\n setUploadError(result.error || 'Upload failed');\n }\n\n return result;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Upload failed';\n setUploadError(errorMessage);\n return {\n success: false,\n error: errorMessage\n };\n } finally {\n setIsUploading(false);\n }\n }, [supabase, appName, orgId]);\n\n // Get public URL\n const handleGetPublicUrl = useCallback((path: string): string => {\n return getPublicUrl(supabase, path);\n }, [supabase]);\n\n // Get signed URL\n const handleGetSignedUrl = useCallback(async (\n path: string, \n expiresIn?: number\n ): Promise<string | null> => {\n try {\n const result = await getSignedUrl(supabase, path, {\n appName,\n orgId,\n expiresIn\n });\n return result?.url || null;\n } catch (error) {\n console.error('Failed to get signed URL:', error);\n return null;\n }\n }, [supabase, appName, orgId]);\n\n // Delete file\n const handleDeleteFile = useCallback(async (path: string) => {\n try {\n const result = await deleteFile(supabase, path);\n if (result.success) {\n await refreshFiles();\n }\n return result;\n } catch (error) {\n return {\n success: false,\n error: error instanceof Error ? error.message : 'Delete failed'\n };\n }\n }, [supabase]);\n\n // Archive file\n const handleArchiveFile = useCallback(async (path: string) => {\n try {\n const result = await archiveFile(supabase, path, { appName, orgId });\n if (result.success) {\n await refreshFiles();\n }\n return result;\n } catch (error) {\n return {\n success: false,\n error: error instanceof Error ? error.message : 'Archive failed'\n };\n }\n }, [supabase, appName, orgId]);\n\n // List files\n const handleListFiles = useCallback(async (\n options: Partial<StorageListOptions> = {}\n ): Promise<StorageListResult> => {\n setIsListing(true);\n setListError(null);\n\n try {\n const listOptions: StorageListOptions = {\n appName,\n orgId,\n ...options\n };\n\n const result = await listFiles(supabase, listOptions);\n setFiles(result.files);\n return result;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'List failed';\n setListError(errorMessage);\n return { files: [], totalCount: 0, hasMore: false };\n } finally {\n setIsListing(false);\n }\n }, [supabase, appName, orgId]);\n\n // Refresh files\n const refreshFiles = useCallback(async () => {\n await handleListFiles();\n }, [handleListFiles]);\n\n return {\n // Upload\n uploadFile: handleUploadFile,\n isUploading,\n uploadError,\n \n // URLs\n getPublicUrl: handleGetPublicUrl,\n getSignedUrl: handleGetSignedUrl,\n getFileUrl: handleGetPublicUrl, // Alias for getPublicUrl\n \n // File management\n deleteFile: handleDeleteFile,\n archiveFile: handleArchiveFile,\n \n // Listing\n listFiles: handleListFiles,\n isListing,\n listError,\n isLoading: isListing, // Alias for isListing\n error: listError, // Alias for listError\n \n // State\n files,\n refreshFiles\n };\n}\n\n/**\n * Hook for file upload with progress tracking\n */\nexport function useFileUpload({ supabase, appName, orgId }: UseStorageOptions) {\n const [uploadProgress, setUploadProgress] = useState(0);\n const [isUploading, setIsUploading] = useState(false);\n const [uploadError, setUploadError] = useState<string | null>(null);\n\n const uploadWithProgress = useCallback(async (\n file: File,\n options: Partial<StorageUploadOptions> = {}\n ): Promise<StorageUploadResult> => {\n setIsUploading(true);\n setUploadProgress(0);\n setUploadError(null);\n\n try {\n // Simulate progress (Supabase doesn't provide real progress)\n const progressInterval = setInterval(() => {\n setUploadProgress(prev => Math.min(prev + 10, 90));\n }, 100);\n\n const uploadOptions: StorageUploadOptions = {\n appName,\n orgId,\n isPublic: false,\n ...options\n };\n\n const result = await uploadFile(supabase, file, uploadOptions);\n \n clearInterval(progressInterval);\n setUploadProgress(100);\n\n if (!result.success) {\n setUploadError(result.error || 'Upload failed');\n }\n\n return result;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Upload failed';\n setUploadError(errorMessage);\n return {\n success: false,\n error: errorMessage\n };\n } finally {\n setIsUploading(false);\n setTimeout(() => setUploadProgress(0), 1000);\n }\n }, [supabase, appName, orgId]);\n\n return {\n uploadWithProgress,\n uploadProgress,\n isUploading,\n uploadError\n };\n}\n","/**\n * File upload component with app-segregated storage\n */\n\nimport React, { useCallback, useState } from 'react';\nimport { SupabaseClient } from '@supabase/supabase-js';\nimport { validateFileSize, formatFileSize } from '../../utils/storage';\nimport { useFileUpload } from '../../hooks/useStorage';\nimport { Button } from '../Button/Button';\nimport { Progress } from '../Progress/Progress';\nimport { Alert } from '../Alert/Alert';\n\nexport interface FileUploadProps {\n supabase: SupabaseClient;\n appName: string;\n orgId: string;\n onUploadComplete?: (result: { success: boolean; path?: string; error?: string }) => void;\n onUploadStart?: () => void;\n accept?: string;\n maxSize?: number;\n multiple?: boolean;\n disabled?: boolean;\n className?: string;\n children?: React.ReactNode;\n}\n\nexport function FileUpload({\n supabase,\n appName,\n orgId,\n onUploadComplete,\n onUploadStart,\n accept = '*/*',\n maxSize,\n multiple = false,\n disabled = false,\n className = '',\n children\n}: FileUploadProps) {\n const [dragActive, setDragActive] = useState(false);\n const [selectedFiles, setSelectedFiles] = useState<File[]>([]);\n const [validationErrors, setValidationErrors] = useState<string[]>([]);\n\n const { uploadWithProgress, uploadProgress, isUploading, uploadError } = useFileUpload({\n supabase,\n appName,\n orgId\n });\n\n // Validate files\n const validateFiles = useCallback((files: File[]): string[] => {\n const errors: string[] = [];\n\n files.forEach((file, index) => {\n // Check file size\n const sizeValidation = validateFileSize(file);\n if (!sizeValidation.isValid) {\n errors.push(`File ${index + 1}: ${sizeValidation.error}`);\n }\n\n // Check custom max size\n if (maxSize && file.size > maxSize) {\n const fileMB = Math.round(file.size / (1024 * 1024));\n const maxMB = Math.round(maxSize / (1024 * 1024));\n errors.push(`File ${index + 1}: Size (${fileMB}MB) exceeds limit (${maxMB}MB)`);\n }\n });\n\n return errors;\n }, [maxSize]);\n\n // Handle file selection\n const handleFileSelect = useCallback((files: FileList | null) => {\n if (!files) return;\n\n const fileArray = Array.from(files);\n const errors = validateFiles(fileArray);\n\n setValidationErrors(errors);\n setSelectedFiles(fileArray);\n }, [validateFiles]);\n\n // Handle drag events\n const handleDrag = useCallback((e: React.DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n if (e.type === 'dragenter' || e.type === 'dragover') {\n setDragActive(true);\n } else if (e.type === 'dragleave') {\n setDragActive(false);\n }\n }, []);\n\n const handleDrop = useCallback((e: React.DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n setDragActive(false);\n\n if (disabled) return;\n\n const files = e.dataTransfer.files;\n handleFileSelect(files);\n }, [disabled, handleFileSelect]);\n\n // Handle file input change\n const handleFileInputChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n handleFileSelect(e.target.files);\n }, [handleFileSelect]);\n\n // Handle upload\n const handleUpload = useCallback(async () => {\n if (selectedFiles.length === 0 || validationErrors.length > 0) return;\n\n onUploadStart?.();\n\n for (const file of selectedFiles) {\n const result = await uploadWithProgress(file);\n onUploadComplete?.(result);\n }\n\n // Reset selection\n setSelectedFiles([]);\n setValidationErrors([]);\n }, [selectedFiles, validationErrors, uploadWithProgress, onUploadComplete, onUploadStart]);\n\n // Handle clear\n const handleClear = useCallback(() => {\n setSelectedFiles([]);\n setValidationErrors([]);\n }, []);\n\n const canUpload = selectedFiles.length > 0 && validationErrors.length === 0 && !isUploading && !disabled;\n\n return (\n <div className={`file-upload ${className}`}>\n {/* Drop zone */}\n <div\n className={`file-upload__dropzone ${\n dragActive ? 'file-upload__dropzone--active' : ''\n } ${disabled ? 'file-upload__dropzone--disabled' : ''}`}\n onDragEnter={handleDrag}\n onDragLeave={handleDrag}\n onDragOver={handleDrag}\n onDrop={handleDrop}\n >\n <input\n type=\"file\"\n accept={accept}\n multiple={multiple}\n onChange={handleFileInputChange}\n disabled={disabled}\n className=\"file-upload__input\"\n />\n \n {children || (\n <div className=\"file-upload__content\">\n <p className=\"file-upload__text\">\n {dragActive ? 'Drop files here' : 'Drag and drop files here or click to select'}\n </p>\n <Button\n type=\"button\"\n variant=\"outline\"\n disabled={disabled}\n onClick={() => (document.querySelector('.file-upload__input') as HTMLInputElement)?.click()}\n >\n Select Files\n </Button>\n </div>\n )}\n </div>\n\n {/* Selected files */}\n {selectedFiles.length > 0 && (\n <div className=\"file-upload__files\">\n <h4 className=\"file-upload__files-title\">Selected Files:</h4>\n <ul className=\"file-upload__files-list\">\n {selectedFiles.map((file, index) => (\n <li key={index} className=\"file-upload__file-item\">\n <span className=\"file-upload__file-name\">{file.name}</span>\n <span className=\"file-upload__file-size\">{formatFileSize(file.size)}</span>\n </li>\n ))}\n </ul>\n </div>\n )}\n\n {/* Validation errors */}\n {validationErrors.length > 0 && (\n <Alert variant=\"destructive\" className=\"file-upload__errors\">\n <ul>\n {validationErrors.map((error, index) => (\n <li key={index}>{error}</li>\n ))}\n </ul>\n </Alert>\n )}\n\n {/* Upload progress */}\n {isUploading && (\n <div className=\"file-upload__progress\">\n <Progress value={uploadProgress} max={100} />\n <p className=\"file-upload__progress-text\">\n Uploading... {uploadProgress}%\n </p>\n </div>\n )}\n\n {/* Upload error */}\n {uploadError && (\n <Alert variant=\"destructive\" className=\"file-upload__error\">\n {uploadError}\n </Alert>\n )}\n\n {/* Actions */}\n {selectedFiles.length > 0 && (\n <div className=\"file-upload__actions\">\n <Button\n onClick={handleUpload}\n disabled={!canUpload}\n className=\"file-upload__upload-btn\"\n >\n {isUploading ? 'Uploading...' : `Upload ${selectedFiles.length} file${selectedFiles.length > 1 ? 's' : ''}`}\n </Button>\n <Button\n variant=\"outline\"\n onClick={handleClear}\n disabled={isUploading}\n className=\"file-upload__clear-btn\"\n >\n Clear\n </Button>\n </div>\n )}\n </div>\n );\n}\n","/**\n * @file Event Logo Component\n * @package @jmruthers/pace-core\n * @module Components/PublicLayout\n * @since 1.0.0\n *\n * A context-aware component for displaying event logos with automatic fallback to event initials.\n * Automatically detects whether it's being used in a public or authenticated context and behaves\n * appropriately without triggering authentication context leakage.\n *\n * Features:\n * - Context-aware (works in both public and authenticated contexts)\n * - Automatic fallback to event initials\n * - Logo validation and error handling\n * - Multiple size options\n * - Responsive design\n * - Accessibility compliant\n * - TypeScript support\n *\n * @example\n * ```tsx\n * import { EventLogo } from '@jmruthers/pace-core';\n *\n * function EventHeader() {\n * return (\n * <EventLogo\n * eventId={event.id}\n * eventName={event.event_name}\n * organisationId={event.organisation_id}\n * size=\"lg\"\n * className=\"rounded-full\"\n * />\n * );\n * }\n * ```\n *\n * @accessibility\n * - WCAG 2.1 AA compliant\n * - Proper alt text for images\n * - Screen reader friendly fallbacks\n * - High contrast support\n *\n * @dependencies\n * - React 18+ - Component framework\n * - usePublicEventLogo hook - Logo data access\n * - Tailwind CSS - Styling\n */\n\nimport React, { useMemo } from 'react';\nimport { usePublicEventLogo } from '../../hooks/public/usePublicEventLogo';\nimport { usePublicPageContext } from './PublicPageProvider';\n\nexport interface EventLogoProps {\n /** The event ID to fetch logo for */\n eventId: string;\n /** The event name for fallback text generation */\n eventName: string;\n /** The organisation ID for storage path */\n organisationId: string;\n /** Logo size variant */\n size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n /** Custom CSS classes */\n className?: string;\n /** Whether to show fallback text when no logo is available */\n showFallback?: boolean;\n /** Custom fallback text generator */\n generateFallbackText?: (eventName: string) => string;\n /** Whether to validate image existence */\n validateImage?: boolean;\n /** Custom loading component */\n loadingComponent?: React.ComponentType;\n /** Custom error component */\n errorComponent?: React.ComponentType<{ error: Error }>;\n}\n\n/**\n * Size classes for different logo sizes\n */\nconst sizeClasses = {\n xs: 'h-4 w-4 text-xs',\n sm: 'h-6 w-6 text-sm',\n md: 'h-8 w-8 text-base',\n lg: 'h-12 w-12 text-lg',\n xl: 'h-16 w-16 text-xl',\n '2xl': 'h-20 w-20 text-2xl'\n};\n\n/**\n * Default fallback text generator\n */\nfunction defaultGenerateFallbackText(eventName: string): string {\n if (!eventName) return 'EV';\n \n return eventName\n .split(' ')\n .map(word => word.charAt(0).toUpperCase())\n .join('')\n .substring(0, 3); // Max 3 characters\n}\n\n/**\n * Component for displaying event logos with fallback to initials\n * \n * This component is context-aware and automatically detects whether it's being used\n * in a public or authenticated context. It fetches and displays event logos from storage,\n * with automatic fallback to event initials if no logo is available.\n * \n * @param props - Logo configuration and styling\n * @returns React element with event logo or fallback\n */\nexport function EventLogo({\n eventId,\n eventName,\n organisationId,\n size = 'md',\n className = '',\n showFallback = true,\n generateFallbackText = defaultGenerateFallbackText,\n validateImage = true,\n loadingComponent: LoadingComponent,\n errorComponent: ErrorComponent\n}: EventLogoProps) {\n // Context awareness - detect if we're in a public page context\n // Move hook call to top level to avoid Rules of Hooks violation\n let isPublicPage = false;\n try {\n const { isPublicPage: publicContext } = usePublicPageContext();\n isPublicPage = publicContext === true;\n } catch {\n // Not in PublicPageProvider context\n isPublicPage = false;\n }\n\n // Check if we should avoid authentication context access\n const shouldAvoidAuthContext = useMemo(() => {\n if (isPublicPage) return true;\n \n // Check if we're in an authenticated context\n try {\n require('../../providers/UnifiedAuthProvider').useUnifiedAuth();\n return false; // We're in auth context, it's safe\n } catch {\n return true; // Not in auth context, avoid it\n }\n }, [isPublicPage]);\n // Validate UUID format for organisationId to prevent database errors\n const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n const hasValidOrganisationId = organisationId && uuidRegex.test(organisationId);\n\n // Get Supabase client from context\n const { supabase } = usePublicPageContext();\n\n // If no Supabase client is available, show fallback immediately\n if (!supabase) {\n return (\n <div className={`${sizeClasses[size]} ${className}`.trim()} title={`${eventName} logo (Supabase not configured)`}>\n {eventName ? defaultGenerateFallbackText(eventName) : 'EV'}\n </div>\n );\n }\n\n const {\n logoUrl,\n fallbackText,\n isLoading,\n error\n } = usePublicEventLogo(\n eventId, \n eventName, \n organisationId, // Always pass organisationId, let the hook handle validation\n {\n validateImage,\n generateFallbackText,\n supabase\n }\n );\n\n // Memoize the size classes\n const sizeClass = useMemo(() => sizeClasses[size], [size]);\n\n // Memoize the combined classes\n const combinedClasses = useMemo(() => {\n const baseClasses = 'flex items-center justify-center bg-gray-100 text-gray-600 font-semibold rounded';\n return `${baseClasses} ${sizeClass} ${className}`.trim();\n }, [sizeClass, className]);\n\n // Handle invalid organisation ID - show fallback immediately only if we have no data\n if (!hasValidOrganisationId && !isLoading && !logoUrl && showFallback) {\n return (\n <div className={combinedClasses} title={`${eventName} logo (invalid organisation ID)`}>\n {fallbackText}\n </div>\n );\n }\n\n // Handle loading state\n if (isLoading) {\n if (LoadingComponent) {\n return <LoadingComponent />;\n }\n \n return (\n <div className={`${combinedClasses} animate-pulse`}>\n <div className=\"w-3/4 h-3/4 bg-gray-300 rounded\"></div>\n </div>\n );\n }\n\n // Handle error state\n if (error) {\n if (ErrorComponent) {\n return <ErrorComponent error={error} />;\n }\n \n if (showFallback) {\n return (\n <div className={combinedClasses} title={`${eventName} (logo unavailable)`}>\n {fallbackText}\n </div>\n );\n }\n \n return null;\n }\n\n // Handle no logo available\n if (!logoUrl) {\n if (showFallback) {\n return (\n <div className={combinedClasses} title={`${eventName} logo`}>\n {fallbackText}\n </div>\n );\n }\n \n return null;\n }\n\n // Render the actual logo\n return (\n <img\n src={logoUrl}\n alt={`${eventName} logo`}\n className={`${sizeClass} ${className}`.trim()}\n onError={(e) => {\n // If image fails to load, hide it and show fallback\n const target = e.target as HTMLImageElement;\n target.style.display = 'none';\n \n // Create fallback element\n const fallback = document.createElement('div');\n fallback.className = combinedClasses;\n fallback.textContent = fallbackText;\n fallback.title = `${eventName} logo`;\n \n // Insert fallback after the image\n target.parentNode?.insertBefore(fallback, target.nextSibling);\n }}\n />\n );\n}\n\n/**\n * Compact event logo for small spaces\n */\nexport function EventLogoCompact(props: EventLogoProps) {\n return (\n <EventLogo\n {...props}\n size=\"sm\"\n className={`${props.className || ''} rounded-sm`}\n />\n );\n}\n\n/**\n * Large event logo for prominent display\n */\nexport function EventLogoLarge(props: EventLogoProps) {\n return (\n <EventLogo\n {...props}\n size=\"xl\"\n className={`${props.className || ''} rounded-lg`}\n />\n );\n}\n","/**\n * @file Public Page Header Component\n * @package @jmruthers/pace-core\n * @module Components/PublicLayout\n * @since 1.0.0\n *\n * A header component specifically designed for public pages with event-specific branding.\n * Displays app logo, event logo, and event information in a clean, accessible layout.\n *\n * Features:\n * - Event-specific branding\n * - App and event logo display\n * - Responsive design\n * - Print-friendly styling\n * - Accessibility compliant\n * - TypeScript support\n *\n * @example\n * ```tsx\n * import { PublicPageHeader, EventLogo } from '@jmruthers/pace-core';\n *\n * function PublicEventPage() {\n * return (\n * <PublicPageHeader \n * event={event}\n * title=\"Event Details\"\n * description=\"Public information about this event\"\n * showEventLogo={true}\n * />\n * );\n * }\n * ```\n *\n * @accessibility\n * - WCAG 2.1 AA compliant\n * - Proper semantic HTML structure\n * - Screen reader friendly\n * - High contrast support\n * - Clear content hierarchy\n *\n * @dependencies\n * - React 18+ - Component framework\n * - Event types - Type definitions\n * - EventLogo component - Logo display\n * - Tailwind CSS - Styling\n */\n\nimport React, { ReactNode } from 'react';\nimport type { Event } from '../../types/unified';\nimport { EventLogo } from './EventLogo';\nimport { useAppConfig } from '../../hooks/useAppConfig';\n\nexport interface PublicPageHeaderProps {\n /** The event data for this public page */\n event: Event;\n /** The event code for this public page */\n eventCode: string;\n /** Optional page title */\n title?: string;\n /** Optional page description */\n description?: string;\n /** Whether to show the event logo (default: true) */\n showEventLogo?: boolean;\n /** Whether to show the app logo (default: true) */\n showAppLogo?: boolean;\n /** Custom CSS classes for the header */\n className?: string;\n /** Custom content to display in the header */\n children?: ReactNode;\n /** Custom app logo component */\n customAppLogo?: ReactNode;\n /** Custom event logo component */\n customEventLogo?: ReactNode;\n}\n\n/**\n * Header component for public pages with event-specific branding\n * \n * This component displays the app logo, event logo, and event information\n * in a clean, accessible layout suitable for public pages.\n * \n * @param props - Header configuration and content\n * @returns React element with public page header\n */\nexport function PublicPageHeader({\n event,\n eventCode,\n title,\n description,\n showEventLogo = true,\n showAppLogo = true,\n className = '',\n children,\n customAppLogo,\n customEventLogo\n}: PublicPageHeaderProps) {\n const { appName } = useAppConfig();\n const headerClasses = `bg-white border-b border-gray-200 ${className}`.trim();\n\n return (\n <header className={headerClasses}>\n <div className=\"px-4 w-[min(var(--app-width),100%)] mx-auto\">\n {/* Top row with logos */}\n <div className=\"flex items-center justify-between py-4\">\n {/* App Logo */}\n {showAppLogo && (\n <div className=\"flex-shrink-0\">\n {customAppLogo || (\n <div className=\"flex items-center\">\n <img\n className=\"h-8 w-auto\"\n src={`/${appName.toLowerCase()}_logo_wide.svg`}\n alt={appName}\n />\n <span className=\"ml-2 text-lg font-semibold text-gray-900\">\n {appName}\n </span>\n </div>\n )}\n </div>\n )}\n\n {/* Event Logo */}\n {showEventLogo && (\n <div className=\"flex-shrink-0\">\n {customEventLogo || (\n <EventLogo\n eventId={event.event_id}\n eventName={event.event_name}\n organisationId={event.organisation_id}\n size=\"md\"\n className=\"h-12 w-12\"\n />\n )}\n </div>\n )}\n </div>\n\n {/* Event Information */}\n <div className=\"pb-4\">\n <div className=\"text-center\">\n <h1 className=\"text-3xl font-bold text-gray-900 mb-2\">\n {event.event_name}\n </h1>\n\n {event.event_venue && (\n <p className=\"text-md text-gray-500 mb-4\">\n {event.event_venue}\n </p>\n )}\n\n {/* Page Title and Description */}\n {title && (\n <div className=\"mt-6\">\n <h2 className=\"text-2xl font-semibold text-gray-800 mb-2\">\n {title}\n </h2>\n {description && (\n <p className=\"text-lg text-gray-600 max-w-3xl mx-auto\">\n {description}\n </p>\n )}\n </div>\n )}\n\n {/* Custom Content */}\n {children && (\n <div className=\"mt-4\">\n {children}\n </div>\n )}\n </div>\n </div>\n </div>\n </header>\n );\n}\n\n","/**\n * @file Public Page Footer Component\n * @package @jmruthers/pace-core\n * @module Components/PublicLayout\n * @since 1.0.0\n *\n * A footer component for public pages that matches the normal PaceAppLayout footer exactly.\n * Uses the same styling and structure as the main Footer component.\n *\n * Features:\n * - Identical to normal Footer component\n * - Consistent branding with main app\n * - Responsive design\n * - Accessibility compliant\n * - TypeScript support\n *\n * @example\n * ```tsx\n * import { PublicPageFooter } from '@jmruthers/pace-core';\n *\n * function PublicEventPage() {\n * return (\n * <PublicPageFooter \n * event={event}\n * companyName=\"My Company\"\n * />\n * );\n * }\n * ```\n *\n * @accessibility\n * - WCAG 2.1 AA compliant\n * - Proper semantic HTML structure\n * - Screen reader friendly\n * - High contrast support\n * - Clear content hierarchy\n *\n * @dependencies\n * - React 18+ - Component framework\n * - Event types - Type definitions\n * - Tailwind CSS - Styling\n */\n\nimport React from 'react';\nimport { cn } from '../../utils/cn';\nimport type { Event } from '../../types/unified';\n\nexport interface PublicPageFooterProps {\n /** The event data for this public page */\n event: Event;\n /** Company or organization name */\n companyName?: string;\n /** Current year or custom year for copyright */\n year?: number;\n /** Optional array of navigation links to display */\n links?: Array<{\n label: string;\n href: string;\n }>;\n /** Optional CSS class name */\n className?: string;\n /** Logo image URL */\n logo?: string;\n /** Copyright text */\n copyright?: string;\n /** Footer content - children to render inside footer */\n children?: React.ReactNode;\n}\n\n/**\n * Footer component for public pages that matches the normal Footer exactly\n * \n * This component uses the same styling and structure as the main Footer component\n * to ensure consistency across the application.\n * \n * @param props - Footer configuration and content\n * @returns React element with public page footer\n */\nexport function PublicPageFooter({\n event,\n companyName = 'Solvera Solutions Pty Ltd',\n year = new Date().getFullYear(),\n links,\n className = '',\n logo,\n copyright,\n children\n}: PublicPageFooterProps) {\n // Use custom copyright if provided, otherwise generate default\n const copyrightText = copyright || `© Copyright 2022–${year} all rights reserved, ${companyName}.`;\n\n return (\n <footer className={cn('mt-8 py-6 flex justify-center border-t border-border bg-main-100', className)}>\n <section className='px-4 w-[min(var(--app-width),100%)] mx-auto text-center'>\n {logo && (\n <img src={logo} alt=\"Logo\" className=\"h-8 w-auto\" />\n )}\n\n {children && (\n <>\n {children}\n </>\n )}\n\n <span className=\"text-muted-foreground\">\n {copyrightText}\n </span>\n\n {links && links.length > 0 && (\n <ul className=\"flex gap-4 mt-2 md:mt-0\">\n {links.map((link, index) => (\n <li key={index}>\n <a href={link.href} className=\"text-muted-foreground hover:text-foreground\">\n {link.label}\n </a>\n </li>\n ))}\n </ul>\n )}\n </section>\n </footer>\n );\n}\n\n","/**\n * @file Public Loading Spinner Component\n * @package @jmruthers/pace-core\n * @module Components/PublicLayout\n * @since 1.0.0\n *\n * A loading spinner component specifically designed for public pages.\n * Provides consistent loading states with event-specific branding.\n *\n * Features:\n * - Consistent loading design\n * - Event-specific branding\n * - Multiple size options\n * - Accessibility compliant\n * - TypeScript support\n *\n * @example\n * ```tsx\n * import { PublicLoadingSpinner } from '@jmruthers/pace-core';\n *\n * function PublicEventPage() {\n * if (isLoading) {\n * return <PublicLoadingSpinner message=\"Loading event details...\" />;\n * }\n * }\n * ```\n *\n * @accessibility\n * - WCAG 2.1 AA compliant\n * - Screen reader friendly\n * - Proper ARIA labels\n * - High contrast support\n *\n * @dependencies\n * - React 18+ - Component framework\n * - Tailwind CSS - Styling\n */\n\nimport React from 'react';\n\nexport interface PublicLoadingSpinnerProps {\n /** Loading message to display */\n message?: string;\n /** Size variant */\n size?: 'sm' | 'md' | 'lg' | 'xl';\n /** Custom CSS classes */\n className?: string;\n /** Whether to show the app logo */\n showLogo?: boolean;\n /** Custom loading message */\n customMessage?: string;\n /** Whether to center the spinner */\n centered?: boolean;\n}\n\n/**\n * Size classes for different spinner sizes\n */\nconst sizeClasses = {\n sm: 'h-4 w-4',\n md: 'h-8 w-8',\n lg: 'h-12 w-12',\n xl: 'h-16 w-16'\n};\n\n/**\n * Loading spinner component for public pages\n * \n * This component displays a consistent loading state with optional\n * branding and messaging for public pages.\n * \n * @param props - Spinner configuration and styling\n * @returns React element with loading spinner\n */\nexport function PublicLoadingSpinner({\n message = 'Loading...',\n size = 'md',\n className = '',\n showLogo = true,\n customMessage,\n centered = true\n}: PublicLoadingSpinnerProps) {\n const sizeClass = sizeClasses[size];\n const displayMessage = customMessage || message;\n\n const content = (\n <div className={`flex flex-col items-center ${className}`}>\n {/* App Logo */}\n {showLogo && (\n <div className=\"mb-4\">\n <img\n className=\"h-8 w-auto\"\n src=\"/pace_logo_wide.svg\"\n alt=\"PACE Core\"\n />\n </div>\n )}\n\n {/* Spinner */}\n <div className=\"relative\">\n <div\n className={`${sizeClass} border-2 border-gray-200 border-t-blue-600 rounded-full animate-spin`}\n role=\"status\"\n aria-label=\"Loading\"\n />\n <span className=\"sr-only\">{displayMessage}</span>\n </div>\n\n {/* Loading Message */}\n {displayMessage && (\n <p className=\"mt-4 text-sm text-gray-600 text-center\">\n {displayMessage}\n </p>\n )}\n </div>\n );\n\n if (centered) {\n return (\n <div className=\"min-h-screen bg-white flex items-center justify-center\">\n <div className=\"max-w-md mx-auto px-4\">\n {content}\n </div>\n </div>\n );\n }\n\n return content;\n}\n\n\n/**\n * Full page loading spinner with event branding\n */\nexport function PublicLoadingSpinnerFullPage({\n message = 'Loading event details...',\n eventName,\n className = ''\n}: Pick<PublicLoadingSpinnerProps, 'message' | 'className'> & {\n eventName?: string;\n}) {\n return (\n <div className={`min-h-screen bg-white flex items-center justify-center ${className}`}>\n <div className=\"max-w-md mx-auto text-center px-4\">\n {/* App Logo */}\n <div className=\"mb-8\">\n <img\n className=\"h-12 w-auto mx-auto\"\n src=\"/pace_logo_wide.svg\"\n alt=\"PACE Core\"\n />\n </div>\n\n {/* Event Name */}\n {eventName && (\n <h1 className=\"text-2xl font-bold text-gray-900 mb-4\">\n {eventName}\n </h1>\n )}\n\n {/* Spinner */}\n <div className=\"relative mb-6\">\n <div\n className=\"h-12 w-12 border-4 border-gray-200 border-t-blue-600 rounded-full animate-spin mx-auto\"\n role=\"status\"\n aria-label=\"Loading\"\n />\n </div>\n\n {/* Loading Message */}\n <p className=\"text-lg text-gray-600\">\n {message}\n </p>\n\n {/* Loading Dots Animation */}\n <div className=\"mt-4 flex justify-center space-x-1\">\n <div className=\"h-2 w-2 bg-blue-600 rounded-full animate-bounce\" style={{ animationDelay: '0ms' }} />\n <div className=\"h-2 w-2 bg-blue-600 rounded-full animate-bounce\" style={{ animationDelay: '150ms' }} />\n <div className=\"h-2 w-2 bg-blue-600 rounded-full animate-bounce\" style={{ animationDelay: '300ms' }} />\n </div>\n </div>\n </div>\n );\n}\n\n/**\n * Skeleton loading component for content placeholders\n */\nexport function PublicLoadingSkeleton({\n lines = 3,\n className = ''\n}: {\n lines?: number;\n className?: string;\n}) {\n return (\n <div className={`animate-pulse ${className}`}>\n {Array.from({ length: lines }).map((_, index) => (\n <div\n key={index}\n className={`h-4 bg-gray-200 rounded mb-2 ${\n index === lines - 1 ? 'w-3/4' : 'w-full'\n }`}\n />\n ))}\n </div>\n );\n}\n","/**\n * @file Public Page Layout Component\n * @package @jmruthers/pace-core\n * @module Components/PublicLayout\n * @since 1.0.0\n *\n * A layout component specifically designed for public pages that don't require authentication.\n * Provides a consistent structure for public event pages with event-specific branding.\n *\n * Features:\n * - No authentication required\n * - Event-specific header and branding\n * - Responsive design\n * - Print-friendly styling\n * - Error boundary integration\n * - Loading state management\n * - TypeScript support\n *\n * @example\n * ```tsx\n * import { PublicPageLayout, PublicPageHeader } from '@jmruthers/pace-core';\n *\n * function PublicEventPage() {\n * const { eventCode } = usePublicRouteParams();\n * \n * return (\n * <PublicPageLayout eventCode={eventCode}>\n * <PublicPageHeader \n * event={event}\n * title=\"Event Details\"\n * description=\"Public information about this event\"\n * />\n * <div className=\"content\">\n * Your public page content\n * </div>\n * </PublicPageLayout>\n * );\n * }\n * ```\n *\n * @accessibility\n * - WCAG 2.1 AA compliant\n * - Proper semantic HTML structure\n * - Screen reader friendly\n * - Keyboard navigation support\n * - High contrast support\n * - Clear content hierarchy\n *\n * @routing\n * - Works with React Router\n * - Supports public route patterns\n * - Event code validation\n * - Error handling for invalid routes\n *\n * @dependencies\n * - React 18+ - Component framework\n * - React Router - Routing integration\n * - Public hooks - Data access\n * - Tailwind CSS - Styling\n */\n\nimport React, { ReactNode, useMemo } from 'react';\nimport { PublicPageHeader } from './PublicPageHeader';\nimport { PublicPageFooter } from './PublicPageFooter';\nimport { PublicErrorBoundary } from './PublicErrorBoundary';\nimport { PublicLoadingSpinner } from './PublicLoadingSpinner';\nimport type { Event } from '../../types/unified';\n\nexport interface PublicPageLayoutProps {\n /** The event code for this public page */\n eventCode: string;\n /** Child components to render */\n children: ReactNode;\n /** Optional event data - if not provided, will be fetched by parent component */\n event?: Event | null;\n /** Whether to show the footer (default: true) */\n showFooter?: boolean;\n /** Custom CSS classes for the layout */\n className?: string;\n /** Custom error fallback component */\n errorFallback?: React.ComponentType<{ error: Error; retry: () => void }>;\n /** Custom loading fallback component */\n loadingFallback?: React.ComponentType;\n /** Custom header component */\n customHeader?: ReactNode;\n /** Custom footer component */\n customFooter?: ReactNode;\n /** Whether to show event validation errors (default: true) */\n showValidationErrors?: boolean;\n}\n\n/**\n * Layout component for public pages that don't require authentication\n * \n * This component provides a consistent structure for public event pages\n * with event-specific branding, error handling, and loading states.\n * \n * @param props - Layout configuration and content\n * @returns React element with complete public page layout\n */\nexport function PublicPageLayout({\n eventCode,\n children,\n event = null,\n showFooter = true,\n className = '',\n errorFallback: ErrorFallback,\n loadingFallback: LoadingFallback = PublicLoadingSpinner,\n customHeader,\n customFooter,\n showValidationErrors = true\n}: PublicPageLayoutProps) {\n // Don't automatically fetch event data - let the parent component handle this\n // This prevents authentication context conflicts\n const isLoading = false;\n const error = null;\n const refetch = async () => {};\n\n // Memoize the layout classes\n const layoutClasses = useMemo(() => {\n const baseClasses = 'min-h-screen bg-white flex flex-col';\n return `${baseClasses} ${className}`.trim();\n }, [className]);\n\n // Handle loading state\n if (isLoading) {\n return (\n <div className={layoutClasses}>\n <div className=\"flex-1 flex items-center justify-center\">\n <LoadingFallback />\n </div>\n </div>\n );\n }\n\n // Handle error state\n if (error && showValidationErrors) {\n return (\n <div className={layoutClasses}>\n <div className=\"flex-1 flex items-center justify-center\">\n {ErrorFallback ? (\n <ErrorFallback error={error} retry={refetch} />\n ) : (\n <div className=\"text-center p-8\">\n <h1 className=\"text-2xl font-bold text-gray-900 mb-4\">\n Event Not Found\n </h1>\n <p className=\"text-gray-600 mb-6\">\n The event code \"{eventCode}\" is invalid or the event is not available for public viewing.\n </p>\n <button\n onClick={refetch}\n className=\"px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 transition-colors\"\n >\n Try Again\n </button>\n </div>\n )}\n </div>\n </div>\n );\n }\n\n // Handle missing event\n if (!event) {\n return (\n <div className={layoutClasses}>\n <div className=\"flex-1 flex items-center justify-center\">\n <div className=\"text-center p-8\">\n <h1 className=\"text-2xl font-bold text-gray-900 mb-4\">\n Event Not Available\n </h1>\n <p className=\"text-gray-600 mb-6\">\n This event is not available for public viewing.\n </p>\n <button\n onClick={refetch}\n className=\"px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 transition-colors\"\n >\n Try Again\n </button>\n </div>\n </div>\n </div>\n );\n }\n\n return (\n <PublicErrorBoundary>\n <div className={layoutClasses}>\n {/* Header */}\n {customHeader || (\n <PublicPageHeader \n event={event}\n eventCode={eventCode}\n />\n )}\n\n {/* Main Content */}\n <main className=\"px-4 w-[min(var(--app-width),100%)] mx-auto py-8\">\n {children}\n </main>\n\n {/* Footer */}\n {showFooter && (\n customFooter || <PublicPageFooter event={event} />\n )}\n </div>\n </PublicErrorBoundary>\n );\n}\n\n/**\n * Hook for accessing public page context\n * Provides access to event data and layout state within public pages\n * \n * @deprecated This hook is no longer needed as PublicPageLayout no longer\n * automatically fetches event data. Use usePublicRouteParams and usePublicEvent\n * directly in your components instead.\n */\nexport function usePublicPageContext() {\n // This hook is deprecated - use usePublicRouteParams and usePublicEvent directly\n return {\n eventCode: null,\n eventId: null,\n event: null,\n isLoading: false,\n error: null,\n refetch: async () => {},\n isPublicPage: true\n };\n}\n","/**\n * @file Public Page Debugger\n * @package @jmruthers/pace-core\n * @module Components/PublicLayout\n * @since 1.0.0\n *\n * A debugging component that helps identify why authentication context\n * is being triggered in public pages.\n */\n\nimport React, { useEffect } from 'react';\nimport { usePublicPageContext } from './PublicPageProvider';\n\nexport interface PublicPageDebuggerProps {\n /** Whether to enable debugging */\n enabled?: boolean;\n /** Custom label for this debugger instance */\n label?: string;\n}\n\n/**\n * Debugger component that logs context information\n * \n * This component helps identify why authentication context\n * is being triggered in public pages.\n */\nexport function PublicPageDebugger({ enabled = true, label = 'PublicPage' }: PublicPageDebuggerProps) {\n useEffect(() => {\n if (!enabled) return;\n\n console.log(`[${label}] Component mounted`);\n \n // Check if we're in a public page context\n try {\n // This will throw if we're not in PublicPageProvider\n const { isPublicPage } = usePublicPageContext();\n console.log(`[${label}] Public page context detected:`, isPublicPage);\n } catch (error) {\n console.warn(`[${label}] Not in PublicPageProvider context:`, error instanceof Error ? error.message : String(error));\n }\n\n // Check for authentication context\n try {\n // This will throw if we're not in UnifiedAuthProvider\n const { isAuthenticated } = require('../../providers/UnifiedAuthProvider').useUnifiedAuth();\n console.warn(`[${label}] AUTHENTICATION CONTEXT DETECTED! This should not happen in public pages.`);\n console.warn(`[${label}] isAuthenticated:`, isAuthenticated);\n } catch (error) {\n console.log(`[${label}] No authentication context detected (good for public pages)`);\n }\n\n // Check for organisation context\n try {\n // This will throw if we're not in OrganisationProvider\n const { selectedOrganisation } = require('../../providers/OrganisationProvider').useOrganisations();\n console.warn(`[${label}] ORGANISATION CONTEXT DETECTED! This should not happen in public pages.`);\n console.warn(`[${label}] selectedOrganisation:`, selectedOrganisation);\n } catch (error) {\n console.log(`[${label}] No organisation context detected (good for public pages)`);\n }\n\n // Check for event context\n try {\n // This will throw if we're not in EventProvider\n const { events } = require('../../providers/EventProvider').useEvents();\n console.warn(`[${label}] EVENT CONTEXT DETECTED! This should not happen in public pages.`);\n console.warn(`[${label}] events:`, events);\n } catch (error) {\n console.log(`[${label}] No event context detected (good for public pages)`);\n }\n\n // Check environment variables\n const supabaseUrl = (import.meta as any).env?.VITE_SUPABASE_URL || process.env.VITE_SUPABASE_URL;\n const supabaseKey = (import.meta as any).env?.VITE_SUPABASE_ANON_KEY || process.env.VITE_SUPABASE_ANON_KEY;\n \n console.log(`[${label}] Environment variables:`, {\n supabaseUrl: supabaseUrl ? 'Present' : 'Missing',\n supabaseKey: supabaseKey ? 'Present' : 'Missing'\n });\n\n return () => {\n console.log(`[${label}] Component unmounted`);\n };\n }, [enabled, label]);\n\n if (!enabled) return null;\n\n return (\n <div style={{ \n position: 'fixed', \n top: 0, \n right: 0, \n background: 'rgba(0,0,0,0.8)', \n color: 'white', \n padding: '8px', \n fontSize: '12px',\n zIndex: 9999,\n fontFamily: 'monospace'\n }}>\n <div>Public Page Debugger</div>\n <div>Check console for context analysis</div>\n </div>\n );\n}\n","/**\n * @file Public Page Diagnostic Component\n * @package @jmruthers/pace-core\n * @module Components/PublicLayout\n * @since 1.0.0\n *\n * A diagnostic component that helps identify exactly where authentication\n * context is being triggered in public pages.\n */\n\nimport React, { useEffect, useState } from 'react';\nimport { usePublicPageContext } from './PublicPageProvider';\n\nexport interface PublicPageDiagnosticProps {\n /** Whether to enable diagnostics */\n enabled?: boolean;\n /** Custom label for this diagnostic instance */\n label?: string;\n}\n\n/**\n * Diagnostic component that identifies authentication context issues\n * \n * This component will help you identify exactly where the problem is\n * in your public page implementation.\n */\nexport function PublicPageDiagnostic({ enabled = true, label = 'PublicPage' }: PublicPageDiagnosticProps) {\n const [diagnostics, setDiagnostics] = useState<{\n hasPublicPageContext: boolean;\n hasAuthContext: boolean;\n hasOrgContext: boolean;\n hasEventContext: boolean;\n hasEnvironmentVars: boolean;\n routeParams: any;\n }>({\n hasPublicPageContext: false,\n hasAuthContext: false,\n hasOrgContext: false,\n hasEventContext: false,\n hasEnvironmentVars: false,\n routeParams: null\n });\n\n useEffect(() => {\n if (!enabled) return;\n\n const runDiagnostics = () => {\n const newDiagnostics = {\n hasPublicPageContext: false,\n hasAuthContext: false,\n hasOrgContext: false,\n hasEventContext: false,\n hasEnvironmentVars: false,\n routeParams: null\n };\n\n // Check for PublicPageProvider context\n try {\n const { isPublicPage } = usePublicPageContext();\n newDiagnostics.hasPublicPageContext = isPublicPage === true;\n } catch (error) {\n newDiagnostics.hasPublicPageContext = false;\n }\n\n // Check for authentication context\n try {\n const { isAuthenticated } = require('../../providers/UnifiedAuthProvider').useUnifiedAuth();\n newDiagnostics.hasAuthContext = true;\n } catch (error) {\n newDiagnostics.hasAuthContext = false;\n }\n\n // Check for organisation context\n try {\n const { selectedOrganisation } = require('../../providers/OrganisationProvider').useOrganisations();\n newDiagnostics.hasOrgContext = true;\n } catch (error) {\n newDiagnostics.hasOrgContext = false;\n }\n\n // Check for event context\n try {\n const { events } = require('../../providers/EventProvider').useEvents();\n newDiagnostics.hasEventContext = true;\n } catch (error) {\n newDiagnostics.hasEventContext = false;\n }\n\n // Check environment variables\n const supabaseUrl = (import.meta as any).env?.VITE_SUPABASE_URL || process.env.VITE_SUPABASE_URL;\n const supabaseKey = (import.meta as any).env?.VITE_SUPABASE_ANON_KEY || process.env.VITE_SUPABASE_ANON_KEY;\n newDiagnostics.hasEnvironmentVars = !!(supabaseUrl && supabaseKey);\n\n // Check route parameters\n try {\n const { useParams } = require('react-router-dom');\n const params = useParams();\n newDiagnostics.routeParams = params;\n } catch (error) {\n newDiagnostics.routeParams = null;\n }\n\n setDiagnostics(newDiagnostics);\n\n // Log results\n console.group(`🔍 [${label}] Public Page Diagnostics`);\n console.log('✅ Public Page Context:', newDiagnostics.hasPublicPageContext ? 'PRESENT' : 'MISSING');\n console.log('❌ Auth Context:', newDiagnostics.hasAuthContext ? 'PRESENT (BAD!)' : 'ABSENT (GOOD!)');\n console.log('❌ Org Context:', newDiagnostics.hasOrgContext ? 'PRESENT (BAD!)' : 'ABSENT (GOOD!)');\n console.log('❌ Event Context:', newDiagnostics.hasEventContext ? 'PRESENT (BAD!)' : 'ABSENT (GOOD!)');\n console.log('✅ Environment Vars:', newDiagnostics.hasEnvironmentVars ? 'PRESENT' : 'MISSING');\n console.log('✅ Route Params:', newDiagnostics.routeParams);\n console.groupEnd();\n\n // Provide specific guidance\n if (newDiagnostics.hasAuthContext || newDiagnostics.hasOrgContext || newDiagnostics.hasEventContext) {\n console.error(`🚨 [${label}] PROBLEM DETECTED: Public page is inside authentication context!`);\n console.error('🔧 SOLUTION: Move public routes outside of UnifiedAuthProvider, OrganisationProvider, and EventProvider');\n console.error('📖 See: packages/core/docs/emergency-public-pages-fix.md');\n } else if (!newDiagnostics.hasPublicPageContext) {\n console.warn(`⚠️ [${label}] WARNING: Not in PublicPageProvider context`);\n console.warn('🔧 SOLUTION: Wrap your public page component in <PublicPageProvider>');\n } else if (!newDiagnostics.hasEnvironmentVars) {\n console.warn(`⚠️ [${label}] WARNING: Missing environment variables`);\n console.warn('🔧 SOLUTION: Set VITE_SUPABASE_URL and VITE_SUPABASE_ANON_KEY in your environment');\n } else {\n console.log(`✅ [${label}] All diagnostics passed! Public page should work correctly.`);\n }\n };\n\n runDiagnostics();\n }, [enabled, label]);\n\n if (!enabled) return null;\n\n return (\n <div style={{ \n position: 'fixed', \n top: 0, \n left: 0, \n background: 'rgba(0,0,0,0.9)', \n color: 'white', \n padding: '12px', \n fontSize: '11px',\n zIndex: 9999,\n fontFamily: 'monospace',\n maxWidth: '300px',\n borderRadius: '0 0 8px 0'\n }}>\n <div style={{ fontWeight: 'bold', marginBottom: '8px' }}>🔍 Public Page Diagnostics</div>\n <div>Public Context: {diagnostics.hasPublicPageContext ? '✅' : '❌'}</div>\n <div>Auth Context: {diagnostics.hasAuthContext ? '❌ BAD' : '✅ GOOD'}</div>\n <div>Org Context: {diagnostics.hasOrgContext ? '❌ BAD' : '✅ GOOD'}</div>\n <div>Event Context: {diagnostics.hasEventContext ? '❌ BAD' : '✅ GOOD'}</div>\n <div>Env Vars: {diagnostics.hasEnvironmentVars ? '✅' : '❌'}</div>\n <div>Route Params: {diagnostics.routeParams ? '✅' : '❌'}</div>\n <div style={{ marginTop: '8px', fontSize: '10px', opacity: 0.8 }}>\n Check console for detailed analysis\n </div>\n </div>\n );\n}\n","/**\n * @file Public Page Context Checker\n * @package @jmruthers/pace-core\n * @module Components/PublicLayout\n * @since 1.0.0\n *\n * A simple component that immediately identifies if a public page\n * is being rendered inside authentication context.\n */\n\nimport React, { useEffect } from 'react';\nimport { usePublicPageContext } from './PublicPageProvider';\n\nexport interface PublicPageContextCheckerProps {\n /** Whether to enable checking */\n enabled?: boolean;\n /** Custom label for this checker instance */\n label?: string;\n}\n\n/**\n * Context checker component that immediately identifies authentication context issues\n * \n * This component will immediately log to console if authentication context\n * is being triggered in a public page.\n */\nexport function PublicPageContextChecker({ enabled = true, label = 'PublicPage' }: PublicPageContextCheckerProps) {\n useEffect(() => {\n if (!enabled) return;\n\n console.group(`🚨 [${label}] PUBLIC PAGE CONTEXT CHECK`);\n \n // Check for authentication context\n try {\n // This will throw if we're not in UnifiedAuthProvider\n const { isAuthenticated } = require('../../providers/UnifiedAuthProvider').useUnifiedAuth();\n console.error(`❌ [${label}] AUTHENTICATION CONTEXT DETECTED!`);\n console.error(`❌ [${label}] isAuthenticated:`, isAuthenticated);\n console.error(`❌ [${label}] This public page is inside UnifiedAuthProvider - THIS IS WRONG!`);\n console.error(`❌ [${label}] SOLUTION: Move public routes outside of authentication providers`);\n } catch (error) {\n console.log(`✅ [${label}] No authentication context detected (GOOD!)`);\n }\n\n // Check for organisation context\n try {\n // This will throw if we're not in OrganisationProvider\n const { selectedOrganisation } = require('../../providers/OrganisationProvider').useOrganisations();\n console.error(`❌ [${label}] ORGANISATION CONTEXT DETECTED!`);\n console.error(`❌ [${label}] selectedOrganisation:`, selectedOrganisation);\n console.error(`❌ [${label}] This public page is inside OrganisationProvider - THIS IS WRONG!`);\n console.error(`❌ [${label}] SOLUTION: Move public routes outside of authentication providers`);\n } catch (error) {\n console.log(`✅ [${label}] No organisation context detected (GOOD!)`);\n }\n\n // Check for event context\n try {\n // This will throw if we're not in EventProvider\n const { events } = require('../../providers/EventProvider').useEvents();\n console.error(`❌ [${label}] EVENT CONTEXT DETECTED!`);\n console.error(`❌ [${label}] events:`, events);\n console.error(`❌ [${label}] This public page is inside EventProvider - THIS IS WRONG!`);\n console.error(`❌ [${label}] SOLUTION: Move public routes outside of authentication providers`);\n } catch (error) {\n console.log(`✅ [${label}] No event context detected (GOOD!)`);\n }\n\n // Check for PublicPageProvider context\n try {\n const { isPublicPage } = usePublicPageContext();\n if (isPublicPage) {\n console.log(`✅ [${label}] Public page context detected (GOOD!)`);\n } else {\n console.warn(`⚠️ [${label}] Not in PublicPageProvider context`);\n console.warn(`⚠️ [${label}] SOLUTION: Wrap your public page in <PublicPageProvider>`);\n }\n } catch (error) {\n console.warn(`⚠️ [${label}] Not in PublicPageProvider context`);\n console.warn(`⚠️ [${label}] SOLUTION: Wrap your public page in <PublicPageProvider>`);\n }\n\n console.groupEnd();\n\n // Provide immediate guidance\n console.group(`📖 [${label}] IMMEDIATE ACTION REQUIRED`);\n console.log(`If you see any ❌ errors above, your public page is inside authentication context.`);\n console.log(`This will cause infinite loading loops and authentication errors.`);\n console.log(``);\n console.log(`🔧 SOLUTION:`);\n console.log(`1. Check your main App.tsx file`);\n console.log(`2. Make sure public routes are completely separate from authentication providers`);\n console.log(`3. Follow the architecture in: packages/core/docs/public-pages-guide.md`);\n console.log(``);\n console.log(`✅ CORRECT ARCHITECTURE:`);\n console.log(`<BrowserRouter>`);\n console.log(` <Routes>`);\n console.log(` <Route path=\"/events/*\" element={<PublicPageApp />} />`);\n console.log(` <Route path=\"/*\" element={<AuthenticatedApp />} />`);\n console.log(` </Routes>`);\n console.log(`</BrowserRouter>`);\n console.groupEnd();\n\n }, [enabled, label]);\n\n if (!enabled) return null;\n\n return (\n <div style={{ \n position: 'fixed', \n top: 0, \n left: 0, \n background: 'rgba(220, 38, 38, 0.95)', \n color: 'white', \n padding: '12px', \n fontSize: '12px',\n zIndex: 9999,\n fontFamily: 'monospace',\n maxWidth: '400px',\n borderRadius: '0 0 8px 0',\n border: '2px solid #dc2626'\n }}>\n <div style={{ fontWeight: 'bold', marginBottom: '8px' }}>🚨 PUBLIC PAGE CONTEXT CHECK</div>\n <div>Check console for authentication context analysis</div>\n <div style={{ marginTop: '8px', fontSize: '10px', opacity: 0.9 }}>\n If you see ❌ errors in console, your public page is inside auth context!\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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ACL,MAAM;AAAA,IACN,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,SAAS;AAAA,IACT,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,cAAc;AAAA,IACd,QAAQ;AAAA,EACV,GACE;AAAA,oBAAAD,MAAC,SAAI,OAAO,EAAE,YAAY,QAAQ,cAAc,MAAM,GAAG,iDAA4B;AAAA,IACrF,gBAAAA,MAAC,SAAI,+DAAiD;AAAA,IACtD,gBAAAA,MAAC,SAAI,OAAO,EAAE,WAAW,OAAO,UAAU,QAAQ,SAAS,IAAI,GAAG,2FAElE;AAAA,KACF;AAEJ;","names":["sizeClasses","React","jsx","React","jsx","React","jsx","React","jsx","jsx","React","jsx","jsxs","React","useMemo","jsx","jsxs","useState","jsx","jsxs","useState","React","useCallback","useMemo","useState","jsx","jsxs","React","UserMenu","useState","useMemo","useCallback","UserMenuLoading","React","ChevronDown","jsx","jsxs","ChevronDown","jsx","jsxs","React","Fragment","jsx","jsxs","useState","useEffect","useMemo","useCallback","Fragment","jsx","jsxs","useCallback","useState","useMemo","useEffect","useEffect","useState","useNavigate","jsx","jsxs","useNavigate","useState","useEffect","jsx","jsxs","useState","useCallback","RefreshCw","AlertCircle","jsx","jsxs","useState","useCallback","useState","jsx","jsxs","useState","useState","useCallback","useState","useCallback","useCallback","useState","jsx","jsxs","useState","useCallback","useMemo","jsx","useMemo","jsx","jsxs","Fragment","jsx","jsxs","jsx","jsxs","sizeClasses","useMemo","jsx","jsxs","useMemo","usePublicPageContext","useEffect","jsx","jsxs","useEffect","useEffect","useState","jsx","jsxs","useState","useEffect","useEffect","jsx","jsxs","useEffect"]}