@jmruthers/pace-core 0.5.67 → 0.5.69

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 (384) hide show
  1. package/README.md +26 -0
  2. package/dist/{DataTable-MFUXNGPR.js → DataTable-MPBSXUC6.js} +5 -6
  3. package/dist/{PublicLoadingSpinner-DdKXTkCZ.d.ts → PublicLoadingSpinner-BOdyU3u-.d.ts} +1 -1
  4. package/dist/{UnifiedAuthProvider-CQNiemcB.d.ts → UnifiedAuthProvider-D02AMXgO.d.ts} +3 -3
  5. package/dist/{chunk-CKNY7HYS.js → chunk-2ARQW6VX.js} +3 -3
  6. package/dist/{chunk-T2MQY57J.js → chunk-6JILXFEA.js} +335 -5
  7. package/dist/chunk-6JILXFEA.js.map +1 -0
  8. package/dist/{chunk-D7ARGIA3.js → chunk-6RBH67W7.js} +23 -6
  9. package/dist/chunk-6RBH67W7.js.map +1 -0
  10. package/dist/{chunk-C7GUF747.js → chunk-FJTAWPAQ.js} +3 -5
  11. package/dist/{chunk-C7GUF747.js.map → chunk-FJTAWPAQ.js.map} +1 -1
  12. package/dist/{chunk-4HQ5BOVZ.js → chunk-NO5QHMDX.js} +7 -6
  13. package/dist/chunk-NO5QHMDX.js.map +1 -0
  14. package/dist/{chunk-ZPK5656W.js → chunk-O3NWNXDY.js} +4 -5
  15. package/dist/chunk-O3NWNXDY.js.map +1 -0
  16. package/dist/{chunk-BTCA3ENN.js → chunk-Q2UP3ZWQ.js} +4 -4
  17. package/dist/{chunk-QVEOQVD4.js → chunk-RVYGJPOD.js} +173 -20
  18. package/dist/chunk-RVYGJPOD.js.map +1 -0
  19. package/dist/{chunk-FVDOEGGG.js → chunk-UCMHBF7Y.js} +3 -5
  20. package/dist/{chunk-FVDOEGGG.js.map → chunk-UCMHBF7Y.js.map} +1 -1
  21. package/dist/{chunk-T6HVDA24.js → chunk-V3QO3LL7.js} +5 -7
  22. package/dist/chunk-V3QO3LL7.js.map +1 -0
  23. package/dist/{chunk-ZB6AEA7I.js → chunk-ZXJGZLLO.js} +17 -17
  24. package/dist/{chunk-ZB6AEA7I.js.map → chunk-ZXJGZLLO.js.map} +1 -1
  25. package/dist/components.d.ts +2 -2
  26. package/dist/components.js +8 -9
  27. package/dist/components.js.map +1 -1
  28. package/dist/hooks.d.ts +1 -1
  29. package/dist/hooks.js +9 -6
  30. package/dist/hooks.js.map +1 -1
  31. package/dist/index.d.ts +4 -4
  32. package/dist/index.js +16 -16
  33. package/dist/index.js.map +1 -1
  34. package/dist/providers.d.ts +1 -1
  35. package/dist/providers.js +5 -7
  36. package/dist/rbac/index.js +5 -6
  37. package/dist/{usePublicRouteParams-CdoFxnJK.d.ts → usePublicRouteParams-Ua1Vz-HG.d.ts} +35 -1
  38. package/dist/utils.d.ts +4 -1
  39. package/dist/utils.js +3 -3
  40. package/docs/DOCUMENTATION_CHECKLIST.md +281 -0
  41. package/docs/README.md +22 -10
  42. package/docs/api/README.md +26 -0
  43. package/docs/api/classes/ColumnFactory.md +1 -1
  44. package/docs/api/classes/ErrorBoundary.md +1 -1
  45. package/docs/api/classes/InvalidScopeError.md +1 -1
  46. package/docs/api/classes/MissingUserContextError.md +1 -1
  47. package/docs/api/classes/OrganisationContextRequiredError.md +1 -1
  48. package/docs/api/classes/PermissionDeniedError.md +1 -1
  49. package/docs/api/classes/PublicErrorBoundary.md +1 -1
  50. package/docs/api/classes/RBACAuditManager.md +1 -1
  51. package/docs/api/classes/RBACCache.md +1 -1
  52. package/docs/api/classes/RBACEngine.md +1 -1
  53. package/docs/api/classes/RBACError.md +1 -1
  54. package/docs/api/classes/RBACNotInitializedError.md +1 -1
  55. package/docs/api/classes/SecureSupabaseClient.md +1 -1
  56. package/docs/api/classes/StorageUtils.md +1 -1
  57. package/docs/api/interfaces/AggregateConfig.md +1 -1
  58. package/docs/api/interfaces/ButtonProps.md +1 -1
  59. package/docs/api/interfaces/CardProps.md +1 -1
  60. package/docs/api/interfaces/ColorPalette.md +1 -1
  61. package/docs/api/interfaces/ColorShade.md +1 -1
  62. package/docs/api/interfaces/DataAccessRecord.md +1 -1
  63. package/docs/api/interfaces/DataTableAction.md +1 -1
  64. package/docs/api/interfaces/DataTableColumn.md +1 -1
  65. package/docs/api/interfaces/DataTableProps.md +1 -1
  66. package/docs/api/interfaces/DataTableToolbarButton.md +1 -1
  67. package/docs/api/interfaces/EmptyStateConfig.md +1 -1
  68. package/docs/api/interfaces/EnhancedNavigationMenuProps.md +1 -1
  69. package/docs/api/interfaces/EventContextType.md +1 -1
  70. package/docs/api/interfaces/EventLogoProps.md +1 -1
  71. package/docs/api/interfaces/EventProviderProps.md +1 -1
  72. package/docs/api/interfaces/FileSizeLimits.md +1 -1
  73. package/docs/api/interfaces/FileUploadProps.md +1 -1
  74. package/docs/api/interfaces/FooterProps.md +1 -1
  75. package/docs/api/interfaces/InactivityWarningModalProps.md +1 -1
  76. package/docs/api/interfaces/InputProps.md +1 -1
  77. package/docs/api/interfaces/LabelProps.md +1 -1
  78. package/docs/api/interfaces/LoginFormProps.md +1 -1
  79. package/docs/api/interfaces/NavigationAccessRecord.md +1 -1
  80. package/docs/api/interfaces/NavigationContextType.md +1 -1
  81. package/docs/api/interfaces/NavigationGuardProps.md +1 -1
  82. package/docs/api/interfaces/NavigationItem.md +1 -1
  83. package/docs/api/interfaces/NavigationMenuProps.md +1 -1
  84. package/docs/api/interfaces/NavigationProviderProps.md +1 -1
  85. package/docs/api/interfaces/Organisation.md +1 -1
  86. package/docs/api/interfaces/OrganisationContextType.md +1 -1
  87. package/docs/api/interfaces/OrganisationMembership.md +1 -1
  88. package/docs/api/interfaces/OrganisationProviderProps.md +1 -1
  89. package/docs/api/interfaces/OrganisationSecurityError.md +1 -1
  90. package/docs/api/interfaces/PaceAppLayoutProps.md +1 -1
  91. package/docs/api/interfaces/PaceLoginPageProps.md +1 -1
  92. package/docs/api/interfaces/PageAccessRecord.md +1 -1
  93. package/docs/api/interfaces/PagePermissionContextType.md +1 -1
  94. package/docs/api/interfaces/PagePermissionGuardProps.md +1 -1
  95. package/docs/api/interfaces/PagePermissionProviderProps.md +1 -1
  96. package/docs/api/interfaces/PaletteData.md +1 -1
  97. package/docs/api/interfaces/PermissionEnforcerProps.md +1 -1
  98. package/docs/api/interfaces/PublicErrorBoundaryProps.md +1 -1
  99. package/docs/api/interfaces/PublicErrorBoundaryState.md +1 -1
  100. package/docs/api/interfaces/PublicLoadingSpinnerProps.md +1 -1
  101. package/docs/api/interfaces/PublicPageFooterProps.md +1 -1
  102. package/docs/api/interfaces/PublicPageHeaderProps.md +2 -2
  103. package/docs/api/interfaces/PublicPageLayoutProps.md +1 -1
  104. package/docs/api/interfaces/RBACConfig.md +1 -1
  105. package/docs/api/interfaces/RBACContextType.md +1 -1
  106. package/docs/api/interfaces/RBACLogger.md +1 -1
  107. package/docs/api/interfaces/RBACProviderProps.md +1 -1
  108. package/docs/api/interfaces/RoleBasedRouterContextType.md +1 -1
  109. package/docs/api/interfaces/RoleBasedRouterProps.md +1 -1
  110. package/docs/api/interfaces/RouteAccessRecord.md +1 -1
  111. package/docs/api/interfaces/RouteConfig.md +1 -1
  112. package/docs/api/interfaces/SecureDataContextType.md +1 -1
  113. package/docs/api/interfaces/SecureDataProviderProps.md +1 -1
  114. package/docs/api/interfaces/StorageConfig.md +1 -1
  115. package/docs/api/interfaces/StorageFileInfo.md +1 -1
  116. package/docs/api/interfaces/StorageFileMetadata.md +1 -1
  117. package/docs/api/interfaces/StorageListOptions.md +1 -1
  118. package/docs/api/interfaces/StorageListResult.md +1 -1
  119. package/docs/api/interfaces/StorageUploadOptions.md +1 -1
  120. package/docs/api/interfaces/StorageUploadResult.md +1 -1
  121. package/docs/api/interfaces/StorageUrlOptions.md +1 -1
  122. package/docs/api/interfaces/StyleImport.md +1 -1
  123. package/docs/api/interfaces/SwitchProps.md +1 -1
  124. package/docs/api/interfaces/ToastActionElement.md +1 -1
  125. package/docs/api/interfaces/ToastProps.md +1 -1
  126. package/docs/api/interfaces/UnifiedAuthContextType.md +1 -1
  127. package/docs/api/interfaces/UnifiedAuthProviderProps.md +4 -4
  128. package/docs/api/interfaces/UseInactivityTrackerOptions.md +1 -1
  129. package/docs/api/interfaces/UseInactivityTrackerReturn.md +1 -1
  130. package/docs/api/interfaces/UsePublicEventLogoOptions.md +1 -1
  131. package/docs/api/interfaces/UsePublicEventLogoReturn.md +1 -1
  132. package/docs/api/interfaces/UsePublicEventOptions.md +1 -1
  133. package/docs/api/interfaces/UsePublicEventReturn.md +1 -1
  134. package/docs/api/interfaces/UsePublicRouteParamsReturn.md +1 -1
  135. package/docs/api/interfaces/UserEventAccess.md +1 -1
  136. package/docs/api/interfaces/UserMenuProps.md +1 -1
  137. package/docs/api/interfaces/UserProfile.md +1 -1
  138. package/docs/api/modules.md +39 -14
  139. package/docs/api-reference/providers.md +16 -7
  140. package/docs/architecture/services.md +374 -0
  141. package/docs/best-practices/README.md +1 -1
  142. package/docs/best-practices/testing.md +1 -1
  143. package/docs/breaking-changes.md +182 -0
  144. package/docs/common-patterns.md +445 -0
  145. package/docs/core-concepts/authentication.md +26 -11
  146. package/docs/core-concepts/events.md +2 -0
  147. package/docs/core-concepts/organisations.md +2 -0
  148. package/docs/core-concepts/permissions.md +2 -0
  149. package/docs/{INDEX.md → documentation-index.md} +26 -38
  150. package/docs/faq.md +286 -0
  151. package/docs/{FILE_REFERENCE_SYSTEM.md → file-reference-system.md} +1 -1
  152. package/docs/getting-started/installation-guide.md +284 -0
  153. package/docs/getting-started/quick-start.md +8 -1
  154. package/docs/implementation-guides/app-layout.md +3 -1
  155. package/docs/implementation-guides/data-tables.md +2 -0
  156. package/docs/implementation-guides/dynamic-colors.md +47 -2
  157. package/docs/implementation-guides/event-theming-summary.md +220 -0
  158. package/docs/implementation-guides/forms.md +9 -7
  159. package/docs/implementation-guides/navigation.md +2 -0
  160. package/docs/migration/service-architecture.md +351 -0
  161. package/docs/migration-guides/unified-auth-provider-mandatory-timeouts.md +226 -0
  162. package/docs/rbac/README-rbac-rls-integration.md +2 -2
  163. package/docs/rbac/README.md +1 -1
  164. package/docs/rbac/examples/rbac-rls-integration-example.md +3 -3
  165. package/docs/rbac/quick-start.md +2 -0
  166. package/docs/rbac/rbac-rls-integration.md +2 -2
  167. package/docs/security/README.md +5 -1
  168. package/docs/style-guide.md +136 -1
  169. package/docs/testing/README.md +1 -1
  170. package/docs/troubleshooting/authentication-issues.md +334 -0
  171. package/docs/troubleshooting/common-issues.md +2 -0
  172. package/docs/troubleshooting/styling-issues.md +199 -144
  173. package/docs/usage.md +23 -2
  174. package/package.json +1 -1
  175. package/src/__tests__/{TESTING_GUIDELINES.md → TEST_GUIDE_CURSOR.md} +20 -0
  176. package/src/__tests__/TEST_GUIDE_HUMAN.md +103 -0
  177. package/src/__tests__/fixtures/test-data.ts +90 -0
  178. package/src/__tests__/helpers/__tests__/component-test-utils.test.tsx +260 -0
  179. package/src/__tests__/helpers/__tests__/optimized-test-setup.test.ts +224 -0
  180. package/src/__tests__/helpers/__tests__/supabaseMock.test.ts +273 -0
  181. package/src/__tests__/helpers/__tests__/test-providers.test.tsx +98 -0
  182. package/src/__tests__/helpers/__tests__/test-utils.test.tsx +436 -0
  183. package/src/__tests__/helpers/__tests__/timer-utils.test.ts +371 -0
  184. package/src/__tests__/helpers/component-test-utils.tsx +14 -4
  185. package/src/__tests__/helpers/optimized-test-setup.ts +68 -0
  186. package/src/__tests__/helpers/test-providers.tsx +329 -0
  187. package/src/__tests__/helpers/test-utils.tsx +91 -45
  188. package/src/__tests__/helpers/timer-utils.ts +71 -0
  189. package/src/__tests__/hooks/usePermissions.test.ts +1 -5
  190. package/src/__tests__/integration/UserProfile.test.tsx +1 -5
  191. package/src/__tests__/rbac/PagePermissionGuard.test.tsx +42 -12
  192. package/src/__tests__/setup.ts +34 -28
  193. package/src/components/Alert/Alert.test.tsx +1 -5
  194. package/src/components/Avatar/Avatar.test.tsx +1 -5
  195. package/src/components/Button/Button.test.tsx +4 -20
  196. package/src/components/Card/Card.test.tsx +1 -5
  197. package/src/components/Checkbox/Checkbox.test.tsx +1 -5
  198. package/src/components/DataTable/__tests__/DataTable.comprehensive.test.tsx +1 -5
  199. package/src/components/DataTable/__tests__/DataTable.test.tsx +45 -49
  200. package/src/components/DataTable/__tests__/DataTableCore.test.tsx +1 -5
  201. package/src/components/DataTable/__tests__/styles.test.ts +382 -0
  202. package/src/components/DataTable/context/__tests__/DataTableContext.test.tsx +409 -0
  203. package/src/components/DataTable/core/__tests__/ActionManager.test.ts +634 -0
  204. package/src/components/DataTable/core/__tests__/DataManager.test.ts +519 -0
  205. package/src/components/DataTable/core/__tests__/StateManager.test.ts +714 -0
  206. package/src/components/DataTable/hooks/__tests__/useDataTableState.test.ts +592 -0
  207. package/src/components/DataTable/utils/__tests__/exportUtils.test.ts +354 -0
  208. package/src/components/DataTable/utils/__tests__/hierarchicalUtils.test.ts +539 -0
  209. package/src/components/Dialog/examples/__tests__/SmartDialogExample.unit.test.tsx +1 -5
  210. package/src/components/Dialog/utils/__tests__/safeHtml.unit.test.ts +1 -8
  211. package/src/components/ErrorBoundary/ErrorBoundary.test.tsx +34 -38
  212. package/src/components/Footer/Footer.test.tsx +1 -5
  213. package/src/components/Form/Form.test.tsx +22 -35
  214. package/src/components/Header/Header.test.tsx +1 -9
  215. package/src/components/InactivityWarningModal/InactivityWarningModal.test.tsx +1 -5
  216. package/src/components/Input/Input.test.tsx +2 -10
  217. package/src/components/LoginForm/LoginForm.test.tsx +1 -5
  218. package/src/components/NavigationMenu/NavigationMenu.test.tsx +24 -24
  219. package/src/components/PaceAppLayout/__tests__/PaceAppLayout.accessibility.test.tsx +1 -6
  220. package/src/components/PaceAppLayout/__tests__/PaceAppLayout.integration.test.tsx +6 -16
  221. package/src/components/PaceAppLayout/__tests__/PaceAppLayout.performance.test.tsx +1 -5
  222. package/src/components/PaceAppLayout/__tests__/PaceAppLayout.rbac.test.tsx +1 -5
  223. package/src/components/PaceLoginPage/PaceLoginPage.test.tsx +1 -7
  224. package/src/components/PasswordReset/PasswordChangeForm.test.tsx +1 -9
  225. package/src/components/PasswordReset/PasswordResetForm.test.tsx +1 -9
  226. package/src/components/PublicLayout/PublicErrorBoundary.tsx +4 -5
  227. package/src/components/PublicLayout/PublicPageHeader.tsx +13 -9
  228. package/src/components/PublicLayout/__tests__/EventLogo.test.tsx +666 -0
  229. package/src/components/PublicLayout/__tests__/PublicErrorBoundary.test.tsx +457 -0
  230. package/src/components/PublicLayout/__tests__/PublicLoadingSpinner.test.tsx +393 -0
  231. package/src/components/PublicLayout/__tests__/PublicPageFooter.test.tsx +351 -0
  232. package/src/components/PublicLayout/__tests__/PublicPageHeader.test.tsx +374 -0
  233. package/src/components/PublicLayout/__tests__/PublicPageLayout.test.tsx +388 -0
  234. package/src/components/Select/Select.bug-test.tsx +69 -0
  235. package/src/components/Select/Select.refactored.tsx +497 -0
  236. package/src/components/Select/Select.test.tsx +42 -49
  237. package/src/components/Select/Select.tsx +5 -2
  238. package/src/components/Select/hooks.ts +254 -0
  239. package/src/components/Switch/Switch.test.tsx +1 -5
  240. package/src/components/Table/__tests__/Table.test.tsx +775 -0
  241. package/src/components/Toast/Toast.test.tsx +15 -8
  242. package/src/components/Tooltip/Tooltip.test.tsx +1 -5
  243. package/src/components/UserMenu/UserMenu.test.tsx +3 -15
  244. package/src/components/__tests__/FileDisplay.test.tsx +575 -0
  245. package/src/components/__tests__/FileUpload.test.tsx +446 -0
  246. package/src/components/__tests__/SuperAdminGuard.test.tsx +422 -354
  247. package/src/hooks/__tests__/ServiceHooks.test.tsx +613 -0
  248. package/src/hooks/__tests__/hooks.integration.test.tsx +1 -10
  249. package/src/hooks/__tests__/useApiFetch.unit.test.ts +10 -14
  250. package/src/hooks/__tests__/useAppConfig.unit.test.ts +307 -0
  251. package/src/hooks/__tests__/useComponentPerformance.unit.test.tsx +1 -6
  252. package/src/hooks/__tests__/useFocusTrap.unit.test.tsx +1 -5
  253. package/src/hooks/__tests__/useOrganisationPermissions.unit.test.tsx +6 -9
  254. package/src/hooks/__tests__/usePublicEvent.simple.test.ts +321 -0
  255. package/src/hooks/__tests__/usePublicEvent.unit.test.ts +583 -0
  256. package/src/hooks/__tests__/usePublicEventLogo.unit.test.ts +640 -0
  257. package/src/hooks/__tests__/usePublicRouteParams.unit.test.ts +435 -0
  258. package/src/hooks/__tests__/useRBAC.unit.test.ts +10 -10
  259. package/src/hooks/__tests__/useStorage.unit.test.ts +751 -0
  260. package/src/hooks/index.ts +3 -0
  261. package/src/hooks/public/usePublicEvent.ts +181 -13
  262. package/src/hooks/public/usePublicRouteParams.ts +13 -3
  263. package/src/hooks/services/useAuth.ts +50 -0
  264. package/src/hooks/services/useAuthService.ts +30 -0
  265. package/src/hooks/services/useCurrentEvent.ts +36 -0
  266. package/src/hooks/services/useCurrentOrganisation.ts +52 -0
  267. package/src/hooks/services/useEventService.ts +30 -0
  268. package/src/hooks/services/useInactivityService.ts +30 -0
  269. package/src/hooks/services/useOrganisationService.ts +30 -0
  270. package/src/hooks/services/usePermissions.ts +70 -0
  271. package/src/hooks/services/useRBACService.ts +30 -0
  272. package/src/hooks/useCounter.test.ts +1 -5
  273. package/src/hooks/useEventTheme.ts +86 -0
  274. package/src/hooks/useOrganisationPermissions.test.ts +2 -5
  275. package/src/hooks/useOrganisationSecurity.test.ts +1 -5
  276. package/src/hooks/usePermissionCache.test.ts +1 -5
  277. package/src/hooks/usePermissionCheck.ts +150 -0
  278. package/src/hooks/useSecureDataAccess.test.ts +1 -5
  279. package/src/index.ts +1 -0
  280. package/src/providers/OrganisationProvider.test.tsx +1 -5
  281. package/src/providers/OrganisationProvider.tsx +56 -4
  282. package/src/providers/UnifiedAuthProvider.test.simple.tsx +42 -6
  283. package/src/providers/UnifiedAuthProvider.test.tsx +1 -5
  284. package/src/providers/UnifiedAuthProvider.tsx +4 -4
  285. package/src/providers/__tests__/AuthProvider.test.tsx +105 -439
  286. package/src/providers/__tests__/AuthProvider.test.tsx.backup +771 -0
  287. package/src/providers/__tests__/EventProvider.test.tsx +211 -110
  288. package/src/providers/__tests__/EventProvider.test.tsx.backup +824 -0
  289. package/src/providers/__tests__/InactivityProvider.test.tsx +1 -5
  290. package/src/providers/__tests__/OrganisationProvider.test.tsx +97 -261
  291. package/src/providers/__tests__/OrganisationProvider.test.tsx.backup +820 -0
  292. package/src/providers/__tests__/ServiceProviders.test.tsx +477 -0
  293. package/src/providers/__tests__/UnifiedAuthProvider.test.tsx +72 -504
  294. package/src/providers/__tests__/UnifiedAuthProvider.test.tsx.backup +911 -0
  295. package/src/providers/__tests__/UnifiedAuthProvider.test.tsx.backup2 +166 -0
  296. package/src/providers/services/AuthServiceProvider.tsx +65 -0
  297. package/src/providers/services/EventServiceProvider.tsx +83 -0
  298. package/src/providers/services/InactivityServiceProvider.tsx +83 -0
  299. package/src/providers/services/OrganisationServiceProvider.tsx +77 -0
  300. package/src/providers/services/RBACServiceProvider.tsx +79 -0
  301. package/src/providers/services/UnifiedAuthProvider.tsx +368 -0
  302. package/src/providers/services/__tests__/AuthServiceProvider.integration.test.tsx +210 -0
  303. package/src/providers/services/__tests__/UnifiedAuthProvider.integration.test.tsx +269 -0
  304. package/src/rbac/__tests__/adapters.comprehensive.test.tsx +892 -0
  305. package/src/rbac/__tests__/engine.comprehensive.test.ts +954 -0
  306. package/src/rbac/__tests__/integration.authflow.test.tsx +1 -5
  307. package/src/rbac/__tests__/integration.navigation.test.tsx +1 -4
  308. package/src/rbac/__tests__/rbac-core.test.tsx +2 -7
  309. package/src/rbac/__tests__/rbac-functions.test.ts +1 -9
  310. package/src/rbac/__tests__/rbac-integration.test.ts +1 -9
  311. package/src/rbac/api.test.ts +1 -9
  312. package/src/rbac/cache.test.ts +10 -8
  313. package/src/rbac/cli/__tests__/policy-manager.test.ts +339 -0
  314. package/src/rbac/components/EnhancedNavigationMenu.test.tsx +1 -5
  315. package/src/rbac/components/NavigationProvider.test.tsx +1 -5
  316. package/src/rbac/components/PagePermissionProvider.test.tsx +1 -5
  317. package/src/rbac/components/SecureDataProvider.test.tsx +1 -5
  318. package/src/rbac/components/__tests__/NavigationGuard.test.tsx +25 -29
  319. package/src/rbac/components/__tests__/PagePermissionGuard.test.tsx +27 -30
  320. package/src/rbac/components/__tests__/PermissionEnforcer.test.tsx +23 -27
  321. package/src/rbac/components/__tests__/RoleBasedRouter.test.tsx +18 -22
  322. package/src/rbac/config.test.ts +1 -5
  323. package/src/rbac/hooks/useCan.test.ts +262 -9
  324. package/src/rbac/hooks/usePermissions.test.ts +246 -6
  325. package/src/rbac/hooks/useRBAC.simple.test.ts +1 -5
  326. package/src/rbac/hooks/useRBAC.test.ts +472 -198
  327. package/src/rbac/providers/__tests__/RBACProvider.test.tsx +1 -9
  328. package/src/services/AuthService.ts +416 -0
  329. package/src/services/EventService.ts +366 -0
  330. package/src/services/InactivityService.ts +388 -0
  331. package/src/services/OrganisationService.ts +592 -0
  332. package/src/services/RBACService.ts +522 -0
  333. package/src/services/__tests__/AuthService.test.ts +356 -0
  334. package/src/services/__tests__/BaseService.test.ts +314 -0
  335. package/src/services/__tests__/EventService.test.ts +489 -0
  336. package/src/services/__tests__/InactivityService.test.ts +403 -0
  337. package/src/services/__tests__/OrganisationService.test.ts +660 -0
  338. package/src/services/__tests__/RBACService.test.ts +492 -0
  339. package/src/services/base/BaseService.ts +87 -0
  340. package/src/services/interfaces/IAuthService.ts +39 -0
  341. package/src/services/interfaces/IEventService.ts +30 -0
  342. package/src/services/interfaces/IInactivityService.ts +31 -0
  343. package/src/services/interfaces/IOrganisationService.ts +41 -0
  344. package/src/services/interfaces/IRBACService.ts +62 -0
  345. package/src/theming/__tests__/runtime.test.ts +540 -0
  346. package/src/types/__tests__/file-reference.test.ts +447 -0
  347. package/src/types/__tests__/organisation.test.ts +1133 -0
  348. package/src/types/__tests__/theme.test.ts +830 -0
  349. package/src/types/__tests__/type-validation.test.ts +527 -0
  350. package/src/utils/__tests__/bundleAnalysis.unit.test.ts +1 -5
  351. package/src/utils/__tests__/debugLogger.test.ts +417 -0
  352. package/src/utils/__tests__/deviceFingerprint.unit.test.ts +1 -6
  353. package/src/utils/__tests__/dynamicUtils.unit.test.ts +1 -5
  354. package/src/utils/__tests__/lazyLoad.unit.test.tsx +35 -35
  355. package/src/utils/__tests__/organisationContext.unit.test.ts +1 -5
  356. package/src/utils/__tests__/performanceBudgets.unit.test.ts +5 -11
  357. package/src/utils/__tests__/secureErrors.unit.test.ts +1 -6
  358. package/src/utils/__tests__/secureStorage.unit.test.ts +1 -5
  359. package/src/utils/__tests__/securityMonitor.unit.test.ts +1 -5
  360. package/src/utils/__tests__/sessionTracking.unit.test.ts +1 -5
  361. package/src/utils/appIdResolver.test.ts +6 -10
  362. package/src/utils/appNameResolver.simple.test.ts +142 -0
  363. package/src/utils/appNameResolver.test.ts +31 -458
  364. package/src/utils/appNameResolver.test.ts.backup +494 -0
  365. package/src/utils/debugLogger.ts +26 -5
  366. package/src/utils/formatDate.test.ts +1 -5
  367. package/src/utils/organisationContext.test.ts +1 -5
  368. package/src/utils/performanceBudgets.ts +3 -4
  369. package/src/utils/secureDataAccess.test.ts +1 -5
  370. package/src/utils/storage/__tests__/helpers.unit.test.ts +1 -5
  371. package/src/validation/__tests__/sqlInjectionProtection.unit.test.ts +1 -5
  372. package/dist/chunk-4HQ5BOVZ.js.map +0 -1
  373. package/dist/chunk-D7ARGIA3.js.map +0 -1
  374. package/dist/chunk-QVEOQVD4.js.map +0 -1
  375. package/dist/chunk-T2MQY57J.js.map +0 -1
  376. package/dist/chunk-T6HVDA24.js.map +0 -1
  377. package/dist/chunk-VTJ5HCZB.js +0 -315
  378. package/dist/chunk-VTJ5HCZB.js.map +0 -1
  379. package/dist/chunk-ZPK5656W.js.map +0 -1
  380. package/docs/getting-started/installation.md +0 -269
  381. package/src/__tests__/REBUILD_PLAN.md +0 -223
  382. /package/dist/{DataTable-MFUXNGPR.js.map → DataTable-MPBSXUC6.js.map} +0 -0
  383. /package/dist/{chunk-CKNY7HYS.js.map → chunk-2ARQW6VX.js.map} +0 -0
  384. /package/dist/{chunk-BTCA3ENN.js.map → chunk-Q2UP3ZWQ.js.map} +0 -0
@@ -0,0 +1,284 @@
1
+ # PACE Core Installation Guide
2
+
3
+ > **📚 Complete Setup Instructions** | [← Back to Documentation](../README.md) | [Quick Start](./quick-start.md)
4
+
5
+ **This is the single authoritative source for PACE Core installation.** Follow this guide exactly to ensure proper functionality.
6
+
7
+ ## Quick Start (TL;DR)
8
+
9
+ ```bash
10
+ # 1. Install the package
11
+ npm install @jmruthers/pace-core
12
+
13
+ # 2. Install peer dependencies
14
+ npm install @tanstack/react-table @radix-ui/react-checkbox @radix-ui/react-dialog @radix-ui/react-dropdown-menu @radix-ui/react-label @radix-ui/react-slot lucide-react class-variance-authority clsx tailwind-merge
15
+
16
+ # 3. Install Tailwind v4
17
+ npm install -D @tailwindcss/vite tailwindcss@^4.0.0
18
+
19
+ # 4. Import CSS in your app
20
+ import '@jmruthers/pace-core/src/styles/core.css';
21
+ ```
22
+
23
+ ## Complete Installation Steps
24
+
25
+ ### Step 1: Install PACE Core Package
26
+
27
+ ```bash
28
+ npm install @jmruthers/pace-core
29
+ ```
30
+
31
+ **Required Peer Dependencies:**
32
+ ```bash
33
+ npm install @tanstack/react-table @radix-ui/react-checkbox @radix-ui/react-dialog @radix-ui/react-dropdown-menu @radix-ui/react-label @radix-ui/react-slot lucide-react class-variance-authority clsx tailwind-merge
34
+ ```
35
+
36
+ ### Step 2: Install Tailwind CSS v4
37
+
38
+ **CRITICAL**: PACE Core requires Tailwind CSS v4 with the Vite plugin.
39
+
40
+ ```bash
41
+ npm install -D @tailwindcss/vite tailwindcss@^4.0.0
42
+ ```
43
+
44
+ **Remove Tailwind v3 if present:**
45
+ ```bash
46
+ npm uninstall tailwindcss@^3.0.0 postcss autoprefixer
47
+ ```
48
+
49
+ ### Step 3: Configure Vite
50
+
51
+ **⚠️ CRITICAL**: Without this configuration, PACE Core components will not be styled.
52
+
53
+ Create or update `vite.config.ts`:
54
+
55
+ ```typescript
56
+ import { defineConfig } from 'vite'
57
+ import react from '@vitejs/plugin-react'
58
+ import tailwindcss from '@tailwindcss/vite'
59
+
60
+ export default defineConfig({
61
+ plugins: [
62
+ react(),
63
+ tailwindcss({
64
+ // CRITICAL: Include pace-core source files for Tailwind scanning
65
+ content: [
66
+ './src/**/*.{js,ts,jsx,tsx}',
67
+ './node_modules/@jmruthers/pace-core/src/**/*.{js,ts,jsx,tsx}'
68
+ ]
69
+ })
70
+ ],
71
+ server: {
72
+ port: 3000,
73
+ open: true,
74
+ },
75
+ })
76
+ ```
77
+
78
+ **Why This Configuration is Critical:**
79
+
80
+ - Tailwind v4 scans TypeScript files to detect utility classes
81
+ - Without scanning `pace-core` source files, components will be unstyled
82
+ - Only ~292 CSS rules will be generated instead of 800+ needed
83
+ - The entire purpose of using this UI library will be defeated
84
+
85
+ ### Step 4: Import Core Styles
86
+
87
+ **⚠️ CRITICAL**: Import the CSS file in your app's entry point.
88
+
89
+ ```tsx
90
+ // src/main.tsx (or your app's entry point)
91
+ import '@jmruthers/pace-core/src/styles/core.css';
92
+ import React from 'react';
93
+ import ReactDOM from 'react-dom/client';
94
+ import App from './App';
95
+
96
+ const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement);
97
+ root.render(
98
+ <React.StrictMode>
99
+ <App />
100
+ </React.StrictMode>
101
+ );
102
+ ```
103
+
104
+ **What the CSS file includes:**
105
+ - Complete color palettes (main, secondary, accent)
106
+ - Font definitions with system font fallbacks
107
+ - Base element styles and resets
108
+ - Tailwind v4 utility classes
109
+ - Component styling foundation
110
+
111
+ ### Step 5: Verify Installation
112
+
113
+ Create a test component to verify everything works:
114
+
115
+ ```tsx
116
+ // src/App.tsx
117
+ import { Button, Card, Input } from '@jmruthers/pace-core';
118
+
119
+ function App() {
120
+ return (
121
+ <div className="p-8 space-y-4">
122
+ <h1 className="text-2xl font-bold text-main-900">PACE Core Test</h1>
123
+
124
+ <Card className="p-4">
125
+ <h2 className="text-lg font-semibold text-sec-800 mb-2">Components Test</h2>
126
+ <div className="space-y-2">
127
+ <Button variant="primary" className="bg-main-600 text-main-50">
128
+ Primary Button
129
+ </Button>
130
+ <Button variant="secondary" className="bg-sec-500 text-main-50">
131
+ Secondary Button
132
+ </Button>
133
+ <Input placeholder="Test input field" className="border-main-300" />
134
+ </div>
135
+ </Card>
136
+ </div>
137
+ );
138
+ }
139
+
140
+ export default App;
141
+ ```
142
+
143
+ **Expected Result**: You should see properly styled components with PACE Core's design system colors, typography, and spacing.
144
+
145
+ ### Step 6: Optional - Supabase Authentication Setup
146
+
147
+ If you're using PACE Core's authentication features:
148
+
149
+ ```bash
150
+ npm install @supabase/supabase-js
151
+ ```
152
+
153
+ Create `src/lib/supabase.ts`:
154
+
155
+ ```typescript
156
+ import { createClient } from '@supabase/supabase-js'
157
+
158
+ const supabaseUrl = process.env.VITE_SUPABASE_URL!
159
+ const supabaseAnonKey = process.env.VITE_SUPABASE_ANON_KEY!
160
+
161
+ export const supabase = createClient(supabaseUrl, supabaseAnonKey)
162
+ ```
163
+
164
+ Set environment variables in `.env.local`:
165
+
166
+ ```bash
167
+ VITE_SUPABASE_URL=https://your-project.supabase.co
168
+ VITE_SUPABASE_ANON_KEY=your-anon-key-here
169
+ ```
170
+
171
+ Wrap your app with providers:
172
+
173
+ ```tsx
174
+ import { UnifiedAuthProvider } from '@jmruthers/pace-core';
175
+ import { supabase } from './lib/supabase';
176
+
177
+ function App() {
178
+ return (
179
+ <UnifiedAuthProvider
180
+ supabaseClient={supabase}
181
+ appName="my-app"
182
+ idleTimeoutMs={30 * 60 * 1000}
183
+ warnBeforeMs={5 * 60 * 1000}
184
+ onIdleLogout={() => window.location.href = '/login'}
185
+ >
186
+ <YourApp />
187
+ </UnifiedAuthProvider>
188
+ );
189
+ }
190
+ ```
191
+
192
+ ## 🚨 Breaking Changes (v0.5.65+)
193
+
194
+ **CRITICAL**: As of v0.5.65+, inactivity timeouts are **mandatory** in `UnifiedAuthProvider`.
195
+
196
+ ### Required Configuration
197
+
198
+ ```tsx
199
+ // ❌ BEFORE (will cause TypeScript errors)
200
+ <UnifiedAuthProvider supabaseClient={supabase} appName="my-app">
201
+ <App />
202
+ </UnifiedAuthProvider>
203
+
204
+ // ✅ AFTER (required configuration)
205
+ <UnifiedAuthProvider
206
+ supabaseClient={supabase}
207
+ appName="my-app"
208
+ idleTimeoutMs={30 * 60 * 1000} // Required
209
+ warnBeforeMs={5 * 60 * 1000} // Required
210
+ onIdleLogout={() => navigate('/login')} // Required
211
+ >
212
+ <App />
213
+ </UnifiedAuthProvider>
214
+ ```
215
+
216
+ See [Migration Guide](../migration-guides/unified-auth-provider-mandatory-timeouts.md) for details.
217
+
218
+ ## Troubleshooting
219
+
220
+ ### Issue: Components appear unstyled
221
+
222
+ **Causes:**
223
+ 1. Missing Vite configuration for pace-core source scanning
224
+ 2. CSS file not imported
225
+ 3. Using Tailwind v3 instead of v4
226
+
227
+ **Solution**:
228
+ 1. Verify your `vite.config.ts` includes pace-core in content scanning
229
+ 2. Ensure `import '@jmruthers/pace-core/src/styles/core.css';` is in your entry point
230
+ 3. Confirm you're using Tailwind v4: `npm list tailwindcss`
231
+
232
+ ### Issue: Build errors about missing classes
233
+
234
+ **Cause**: Tailwind not scanning pace-core source files
235
+
236
+ **Solution**: Update Vite config to include:
237
+ ```typescript
238
+ content: [
239
+ './src/**/*.{js,ts,jsx,tsx}',
240
+ './node_modules/@jmruthers/pace-core/src/**/*.{js,ts,jsx,tsx}'
241
+ ]
242
+ ```
243
+
244
+ ### Issue: TypeScript errors with unified auth
245
+
246
+ **Cause**: Breaking changes in v0.5.65+ requiring mandatory inactivity timeout configuration
247
+
248
+ **Solution**: Add required timeout props as shown in Breaking Changes section above
249
+
250
+ ### Verification Checklist
251
+
252
+ Before asking for help, verify:
253
+ - [ ] CSS file is imported: `import '@jmruthers/pace-core/src/styles/core.css'`
254
+ - [ ] Vite config includes pace-core in content scanning
255
+ - [ ] Using Tailwind v4 (not v3)
256
+ - [ ] Dev server restarted after config changes
257
+ - [ ] All required peer dependencies installed
258
+ - [ ] Test component renders with proper styling
259
+
260
+ ---
261
+
262
+ **Last Updated:** 2025-01-XX | **Version:** v0.5.65+
263
+
264
+ ## Next Steps
265
+
266
+ - **[Quick Start Guide](./quick-start.md)** - Build your first app
267
+ - **[API Reference](../api-reference/components.md)** - Explore all components
268
+ - **[Styling Guide](../styles/README.md)** - Understand the design system
269
+ - **[Troubleshooting](../troubleshooting/styling-issues.md)** - Fix common problems
270
+ - **[Examples](./examples/)** - Complete working applications
271
+
272
+ ## Additional Resources
273
+
274
+ - **Tailwind v4 Docs**: https://tailwindcss.com/docs
275
+ - **Supabase Docs**: https://supabase.com/docs
276
+ - **React Router**: https://reactrouter.com
277
+
278
+ ## Need Help?
279
+
280
+ If you're still having issues:
281
+ 1. Check the [Troubleshooting Guide](../troubleshooting/README.md)
282
+ 2. Verify your setup matches this guide exactly
283
+ 3. Test with a minimal example to isolate the issue
284
+ 4. Check your package versions for compatibility
@@ -1,5 +1,7 @@
1
1
  # Quick Start - Build Your First App
2
2
 
3
+ > **🎯 Build Your First App** | [← Back to Documentation](../README.md) | [Installation Guide](./installation-guide.md) | [Examples](./examples/)
4
+
3
5
  Build a complete PACE Core application with authentication, permissions, and a modern UI in under 10 minutes.
4
6
 
5
7
  > **⏱️ Time to Complete**: ~10 minutes
@@ -33,8 +35,13 @@ Your app will have:
33
35
  If you don't have a project yet:
34
36
 
35
37
  ```bash
36
- npx create-react-app meal-manager --template typescript
38
+ # Using Vite (recommended)
39
+ npm create vite@latest meal-manager -- --template react-ts
37
40
  cd meal-manager
41
+
42
+ # Or using Create React App (legacy)
43
+ # npx create-react-app meal-manager --template typescript
44
+ # cd meal-manager
38
45
  ```
39
46
 
40
47
  ### 2. Install Dependencies
@@ -1,4 +1,6 @@
1
- # App Layout Implementation Guide
1
+ # App Layout
2
+
3
+ > **📚 Implementation Guides** | [← Back to Documentation](../README.md) | [Navigation](./navigation.md) | [Data Tables](./data-tables.md) Implementation Guide
2
4
 
3
5
  This guide covers how to implement application layouts using PACE Core's layout components with permission enforcement and responsive design.
4
6
 
@@ -1,5 +1,7 @@
1
1
  # Data Tables
2
2
 
3
+ > **📚 Implementation Guides** | [← Back to Documentation](../README.md) | [Forms](./forms.md) | [RBAC Usage](./datatable-rbac-usage.md)
4
+
3
5
  This guide covers implementing data tables with PACE Core's DataTable component, including basic usage, advanced features, and best practices.
4
6
 
5
7
  ## Overview
@@ -74,9 +74,32 @@ const themeCSS = generateSSRThemeCSS(paletteData);
74
74
  // Inject into your HTML head
75
75
  ```
76
76
 
77
- ### Integration with React
77
+ ### Automatic Event Theming
78
78
 
79
- Here's how to integrate with React components:
79
+ **Recommended approach for event-based theming:**
80
+
81
+ If your app uses events with the `EventProvider`, simply call the `useEventTheme()` hook at the top level of your app:
82
+
83
+ ```tsx
84
+ import { useEventTheme } from '@jmruthers/pace-core';
85
+
86
+ function MyApp() {
87
+ // Automatically applies event colors when an event is selected
88
+ useEventTheme();
89
+
90
+ return <div>Your app content</div>;
91
+ }
92
+ ```
93
+
94
+ This hook will:
95
+ - Automatically apply event colors when an event is selected
96
+ - Clear theming when no event is selected
97
+ - Handle cleanup and error handling
98
+ - Work consistently across all apps in the pace suite
99
+
100
+ ### Manual Integration with React
101
+
102
+ For custom logic or organisation-based theming:
80
103
 
81
104
  ```tsx
82
105
  import { useEffect } from 'react';
@@ -169,6 +192,28 @@ const currentTheme = getCurrentThemeData();
169
192
  console.log('Current theme:', currentTheme);
170
193
  ```
171
194
 
195
+ ### useEventTheme()
196
+
197
+ **Automatic event-based theming hook.**
198
+
199
+ This hook automatically applies event colors when an event is selected and clears them when no event is selected.
200
+
201
+ **Usage:**
202
+ ```tsx
203
+ import { useEventTheme } from '@jmruthers/pace-core';
204
+
205
+ function App() {
206
+ useEventTheme();
207
+ // Rest of your app
208
+ }
209
+ ```
210
+
211
+ **Benefits:**
212
+ - Zero configuration - automatically works with `EventProvider`
213
+ - Consistent UX across all apps
214
+ - Handles cleanup and error cases
215
+ - No manual event watching needed
216
+
172
217
  ## Benefits
173
218
 
174
219
  - **Simple API** - Just two functions: `applyPalette()` and `clearPalette()`
@@ -0,0 +1,220 @@
1
+ # Event Theming Implementation Summary
2
+
3
+ ## What Exists in pace-core
4
+
5
+ ### Database Schema
6
+ Events have an `event_colours` JSONB field that stores theme colors in OKLCH format:
7
+
8
+ ```typescript
9
+ interface Event {
10
+ event_colours?: Record<string, unknown> | null; // JSONB field for theme colors
11
+ }
12
+ ```
13
+
14
+ The expected format:
15
+ ```json
16
+ {
17
+ "main": {
18
+ "50": {"L": 0.98, "C": 0.007, "H": 29.203},
19
+ "100": {"L": 0.96, "C": 0.018, "H": 29.203},
20
+ // ... all Tailwind shades 50-950
21
+ "raw": {"L": 0.587, "C": 0.24, "H": 29.203}
22
+ },
23
+ "sec": { /* secondary palette */ },
24
+ "acc": { /* accent palette */ }
25
+ }
26
+ ```
27
+
28
+ ### Runtime Theming System
29
+ Located in `packages/core/src/theming/runtime.ts`:
30
+
31
+ - **`applyPalette(palette)`** - Applies event colors dynamically
32
+ - **`clearPalette()`** - Clears dynamic theming, returns to app defaults
33
+ - **`generateSSRThemeCSS(palette)`** - SSR support
34
+ - **`isDynamicThemingActive()`** - Debug helper
35
+
36
+ ### EventProvider
37
+ `packages/core/src/providers/EventProvider.tsx`:
38
+ - Fetches events from database via RPC `data_user_events_get`
39
+ - Stores `event_colours` in the event object
40
+ - Manages event selection state
41
+ - Auto-selects next upcoming event
42
+
43
+ ## What Was Missing
44
+
45
+ ### Automatic Event Theming Integration
46
+ There was **no automatic connection** between event selection and theming application. Consuming apps would need to manually:
47
+ 1. Watch for selectedEvent changes
48
+ 2. Extract event_colours
49
+ 3. Call applyPalette()
50
+ 4. Handle cleanup
51
+
52
+ ## What I Added
53
+
54
+ ### New Hook: `useEventTheme()`
55
+
56
+ **Location:** `packages/core/src/hooks/useEventTheme.ts`
57
+
58
+ **What it does:**
59
+ - Automatically watches selectedEvent from EventProvider
60
+ - Applies event colors when an event with `event_colours` is selected
61
+ - Clears theming when no event is selected
62
+ - Handles validation, errors, and cleanup
63
+ - Works consistently across all apps
64
+
65
+ **Usage:**
66
+ ```tsx
67
+ import { useEventTheme } from '@jmruthers/pace-core';
68
+
69
+ function MyApp() {
70
+ useEventTheme(); // Just call it!
71
+
72
+ return <div>Your app</div>;
73
+ }
74
+ ```
75
+
76
+ **Exports:**
77
+ - Available from `@jmruthers/pace-core` (main export)
78
+ - Available from `@jmruthers/pace-core/hooks` (hooks export)
79
+
80
+ ## Why This in pace-core?
81
+
82
+ This follows the pace-core principles:
83
+
84
+ ### 1. **Consistency Across App Suite**
85
+ Every app (CAKE, TRACE, ADMIN, etc.) needs event theming. By having it in pace-core, all apps get the same behavior, UX, and error handling.
86
+
87
+ ### 2. **Maximum Code Reuse**
88
+ Instead of every app implementing this logic, it's once in pace-core:
89
+ - No duplicated `useEffect` logic
90
+ - No duplicated event watching
91
+ - No duplicated error handling
92
+ - Centralized improvements benefit all apps
93
+
94
+ ### 3. **Opt-in Design**
95
+ The hook is opt-in - apps call `useEventTheme()` if they want automatic theming. Apps can still use manual `applyPalette()` if they need custom logic.
96
+
97
+ ## Architecture Decision
98
+
99
+ ### What's in pace-core:
100
+ - ✅ Event theming infrastructure (runtime APIs)
101
+ - ✅ Automatic event theming hook (`useEventTheme`)
102
+ - ✅ Documentation and examples
103
+ - ✅ Type definitions
104
+
105
+ ### What's in consuming apps:
106
+ - ✅ Calling `useEventTheme()` in the app component
107
+ - ✅ ADMIN app: Palette picker UI to set colors
108
+ - ✅ ADMIN app: Save colors to database via `event_colours` field
109
+
110
+ ## How It Works
111
+
112
+ 1. **ADMIN app** sets event colors via a palette picker and saves to `event.event_colours` in the database
113
+ 2. **Consuming apps** (CAKE, TRACE) call `useEventTheme()` hook
114
+ 3. When user selects an event via `EventSelector`, the hook detects the change
115
+ 4. Hook extracts `event_colours` from selected event
116
+ 5. Hook calls `applyPalette()` with the colors
117
+ 6. CSS variables update dynamically → UI colors change
118
+ 7. When event is deselected, hook calls `clearPalette()`
119
+
120
+ ## Database Flow
121
+
122
+ ```
123
+ ADMIN App
124
+ ↓ (User sets colors in palette picker)
125
+ ↓ (Save to database)
126
+ event.event_colours = {
127
+ main: { 50: {...}, 100: {...}, ... },
128
+ sec: { 50: {...}, 100: {...}, ... },
129
+ acc: { 50: {...}, 100: {...}, ... }
130
+ }
131
+ ↓ (RPC fetches events)
132
+ EventProvider loads events
133
+ ↓ (User selects event)
134
+ useEventTheme() detects change
135
+ ↓ (Applies colors)
136
+ applyPalette() → CSS variables update
137
+
138
+ UI colors change in CAKE/TRACE
139
+ ```
140
+
141
+ ## Usage Example
142
+
143
+ ```tsx
144
+ // In your consuming app (e.g., CAKE or TRACE)
145
+
146
+ import {
147
+ UnifiedAuthProvider,
148
+ EventProvider,
149
+ OrganisationProvider,
150
+ useEventTheme
151
+ } from '@jmruthers/pace-core';
152
+
153
+ function App() {
154
+ // Enable automatic event theming
155
+ useEventTheme();
156
+
157
+ return (
158
+ <div>
159
+ <EventSelector />
160
+ {/* Rest of your app */}
161
+ </div>
162
+ );
163
+ }
164
+
165
+ function RootLayout() {
166
+ return (
167
+ <UnifiedAuthProvider supabaseClient={supabase} appName="CAKE">
168
+ <OrganisationProvider>
169
+ <EventProvider>
170
+ <App />
171
+ </EventProvider>
172
+ </OrganisationProvider>
173
+ </UnifiedAuthProvider>
174
+ );
175
+ }
176
+ ```
177
+
178
+ ## Migration Guide
179
+
180
+ If you're already manually applying event colors in your consuming apps:
181
+
182
+ ### Before:
183
+ ```tsx
184
+ function App() {
185
+ const { selectedEvent } = useEvents();
186
+
187
+ useEffect(() => {
188
+ if (selectedEvent?.event_colours) {
189
+ applyPalette(selectedEvent.event_colours);
190
+ } else {
191
+ clearPalette();
192
+ }
193
+ }, [selectedEvent]);
194
+ }
195
+ ```
196
+
197
+ ### After:
198
+ ```tsx
199
+ function App() {
200
+ useEventTheme(); // Replaces the above useEffect
201
+
202
+ return <div>Your app</div>;
203
+ }
204
+ ```
205
+
206
+ ## Benefits
207
+
208
+ - **Zero boilerplate** - One line to enable automatic theming
209
+ - **Consistent UX** - All apps behave the same way
210
+ - **Less code** - No duplication across apps
211
+ - **Type safe** - Full TypeScript support
212
+ - **Maintainable** - Centralized improvements
213
+ - **Flexible** - Can still use manual API if needed
214
+
215
+ ## Documentation
216
+
217
+ Full documentation available at:
218
+ - **Implementation Guide:** `packages/core/docs/implementation-guides/dynamic-colors.md`
219
+ - **Usage Guide:** `packages/core/docs/usage.md`
220
+ - **API Reference:** Available in code docs and type definitions
@@ -1,4 +1,6 @@
1
- # Forms Implementation Guide
1
+ # Forms
2
+
3
+ > **📚 Implementation Guides** | [← Back to Documentation](../README.md) | [Data Tables](./data-tables.md) | [Validation](./forms.md) Implementation Guide
2
4
 
3
5
  This guide covers how to implement forms using PACE Core's form components and validation system.
4
6
 
@@ -175,7 +177,7 @@ const conditionalSchema = z.object({
175
177
  }
176
178
  return true;
177
179
  }, {
178
- message: "Organization details are required for organization accounts",
180
+ message: "Organisation details are required for organization accounts",
179
181
  path: ["organizationName"]
180
182
  });
181
183
 
@@ -191,7 +193,7 @@ function ConditionalForm() {
191
193
  type="select"
192
194
  options={[
193
195
  { value: 'individual', label: 'Individual' },
194
- { value: 'organization', label: 'Organization' }
196
+ { value: 'organization', label: 'Organisation' }
195
197
  ]}
196
198
  />
197
199
 
@@ -200,11 +202,11 @@ function ConditionalForm() {
200
202
 
201
203
  {userType === 'organization' && (
202
204
  <Card className="p-4 space-y-4">
203
- <h3 className="text-lg font-semibold">Organization Details</h3>
204
- <FormField name="organizationName" label="Organization Name" />
205
+ <h3 className="text-lg font-semibold">Organisation Details</h3>
206
+ <FormField name="organizationName" label="Organisation Name" />
205
207
  <FormField
206
208
  name="organizationSize"
207
- label="Organization Size"
209
+ label="Organisation Size"
208
210
  type="select"
209
211
  options={[
210
212
  { value: 'small', label: 'Small (1-50 employees)' },
@@ -361,7 +363,7 @@ function CustomFormField({ name, label, ...props }) {
361
363
 
362
364
  ## Best Practices
363
365
 
364
- ### 1. Schema Organization
366
+ ### 1. Schema Organisation
365
367
 
366
368
  ```typescript
367
369
  // schemas/user.ts
@@ -1,5 +1,7 @@
1
1
  # Navigation Implementation Guide
2
2
 
3
+ > **📚 Implementation Guides** | [← Back to Documentation](../README.md) | [App Layout](./app-layout.md) | [Permission Enforcement](./permission-enforcement.md)
4
+
3
5
  This guide covers how to implement navigation systems using PACE Core's navigation components with permission-based filtering and RBAC integration.
4
6
 
5
7
  ## Overview