@jmruthers/pace-core 0.5.73 → 0.5.75

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 (283) hide show
  1. package/dist/{DataTable-INW5YIFV.js → DataTable-HWZQGASI.js} +8 -8
  2. package/dist/{PublicLoadingSpinner-DLpF5bbs.d.ts → PublicLoadingSpinner-BKNBT6b6.d.ts} +2 -2
  3. package/dist/RBACService-C4udt_Zp.d.ts +528 -0
  4. package/dist/{UnifiedAuthProvider-6SYT5WFN.js → UnifiedAuthProvider-3NKDOSOK.js} +6 -4
  5. package/dist/UnifiedAuthProvider-Bj6YCf7c.d.ts +113 -0
  6. package/dist/{chunk-2PRPDH66.js → chunk-2CHATWBF.js} +5 -7
  7. package/dist/chunk-2CHATWBF.js.map +1 -0
  8. package/dist/{chunk-43C63KLH.js → chunk-2DFZ432F.js} +496 -30
  9. package/dist/chunk-2DFZ432F.js.map +1 -0
  10. package/dist/{chunk-M4UMXYNK.js → chunk-33PHABLB.js} +36 -3
  11. package/dist/chunk-33PHABLB.js.map +1 -0
  12. package/dist/chunk-5F3NDPJV.js +232 -0
  13. package/dist/chunk-5F3NDPJV.js.map +1 -0
  14. package/dist/chunk-A4FUBC7B.js +17 -0
  15. package/dist/chunk-A4FUBC7B.js.map +1 -0
  16. package/dist/{chunk-SMJZMKYN.js → chunk-A6HBIY5P.js} +2 -11
  17. package/dist/{chunk-SMJZMKYN.js.map → chunk-A6HBIY5P.js.map} +1 -1
  18. package/dist/{chunk-GBC5PC3N.js → chunk-CY3AHGO4.js} +6256 -1937
  19. package/dist/chunk-CY3AHGO4.js.map +1 -0
  20. package/dist/{chunk-BYG6OSTC.js → chunk-DAXLNIDY.js} +48 -50
  21. package/dist/chunk-DAXLNIDY.js.map +1 -0
  22. package/dist/{chunk-VKOCWWVY.js → chunk-L3RV2ALE.js} +1 -6
  23. package/dist/{chunk-VKOCWWVY.js.map → chunk-L3RV2ALE.js.map} +1 -1
  24. package/dist/chunk-LW7MMEAQ.js +59 -0
  25. package/dist/chunk-LW7MMEAQ.js.map +1 -0
  26. package/dist/{chunk-LANO5IFV.js → chunk-NTNILOBC.js} +7 -9
  27. package/dist/chunk-NTNILOBC.js.map +1 -0
  28. package/dist/chunk-PYUXFQJ3.js +11 -0
  29. package/dist/chunk-PYUXFQJ3.js.map +1 -0
  30. package/dist/chunk-URUTVZ7N.js +27 -0
  31. package/dist/chunk-URUTVZ7N.js.map +1 -0
  32. package/dist/chunk-WN6XJWOS.js +2468 -0
  33. package/dist/chunk-WN6XJWOS.js.map +1 -0
  34. package/dist/{chunk-3SP4P7NS.js → chunk-XLZ7U46Z.js} +59 -1
  35. package/dist/chunk-XLZ7U46Z.js.map +1 -0
  36. package/dist/{chunk-UC2BWIK7.js → chunk-ZTT2AXMX.js} +9 -14
  37. package/dist/chunk-ZTT2AXMX.js.map +1 -0
  38. package/dist/components.d.ts +4 -5
  39. package/dist/components.js +32 -39
  40. package/dist/components.js.map +1 -1
  41. package/dist/hooks.d.ts +3 -3
  42. package/dist/hooks.js +9 -8
  43. package/dist/hooks.js.map +1 -1
  44. package/dist/index.d.ts +156 -10
  45. package/dist/index.js +188 -93
  46. package/dist/index.js.map +1 -1
  47. package/dist/{organisation-t-vvQC3g.d.ts → organisation-BtshODVF.d.ts} +4 -3
  48. package/dist/providers.d.ts +27 -38
  49. package/dist/providers.js +33 -23
  50. package/dist/rbac/index.d.ts +61 -5
  51. package/dist/rbac/index.js +13 -14
  52. package/dist/styles/index.js +2 -2
  53. package/dist/theming/runtime.js +1 -3
  54. package/dist/types.d.ts +3 -3
  55. package/dist/types.js +1 -1
  56. package/dist/types.js.map +1 -1
  57. package/dist/{unified-CMPjE_fv.d.ts → unified-CM7T0aTK.d.ts} +1 -1
  58. package/dist/useInactivityTracker-MRUU55XI.js +10 -0
  59. package/dist/useInactivityTracker-MRUU55XI.js.map +1 -0
  60. package/dist/{usePublicRouteParams-Ua1Vz-HG.d.ts → usePublicRouteParams-B-CumWRc.d.ts} +3 -3
  61. package/dist/utils.js +7 -9
  62. package/dist/utils.js.map +1 -1
  63. package/dist/validation.d.ts +1 -1
  64. package/docs/api/classes/ColumnFactory.md +1 -1
  65. package/docs/api/classes/ErrorBoundary.md +1 -1
  66. package/docs/api/classes/InvalidScopeError.md +1 -1
  67. package/docs/api/classes/MissingUserContextError.md +1 -1
  68. package/docs/api/classes/OrganisationContextRequiredError.md +1 -1
  69. package/docs/api/classes/PermissionDeniedError.md +1 -1
  70. package/docs/api/classes/PublicErrorBoundary.md +1 -1
  71. package/docs/api/classes/RBACAuditManager.md +1 -1
  72. package/docs/api/classes/RBACCache.md +1 -1
  73. package/docs/api/classes/RBACEngine.md +1 -1
  74. package/docs/api/classes/RBACError.md +1 -1
  75. package/docs/api/classes/RBACNotInitializedError.md +1 -1
  76. package/docs/api/classes/SecureSupabaseClient.md +1 -1
  77. package/docs/api/classes/StorageUtils.md +1 -1
  78. package/docs/api/enums/FileCategory.md +1 -1
  79. package/docs/api/interfaces/AggregateConfig.md +1 -1
  80. package/docs/api/interfaces/ButtonProps.md +3 -3
  81. package/docs/api/interfaces/CardProps.md +2 -2
  82. package/docs/api/interfaces/ColorPalette.md +1 -1
  83. package/docs/api/interfaces/ColorShade.md +1 -1
  84. package/docs/api/interfaces/DataAccessRecord.md +1 -1
  85. package/docs/api/interfaces/DataTableAction.md +1 -1
  86. package/docs/api/interfaces/DataTableColumn.md +1 -1
  87. package/docs/api/interfaces/DataTableProps.md +1 -1
  88. package/docs/api/interfaces/DataTableToolbarButton.md +1 -1
  89. package/docs/api/interfaces/EmptyStateConfig.md +1 -1
  90. package/docs/api/interfaces/EnhancedNavigationMenuProps.md +1 -1
  91. package/docs/api/interfaces/EventLogoProps.md +2 -2
  92. package/docs/api/interfaces/FileDisplayProps.md +1 -1
  93. package/docs/api/interfaces/FileMetadata.md +1 -1
  94. package/docs/api/interfaces/FileReference.md +1 -1
  95. package/docs/api/interfaces/FileSizeLimits.md +1 -1
  96. package/docs/api/interfaces/FileUploadOptions.md +1 -1
  97. package/docs/api/interfaces/FileUploadProps.md +1 -1
  98. package/docs/api/interfaces/FooterProps.md +1 -1
  99. package/docs/api/interfaces/InactivityWarningModalProps.md +1 -1
  100. package/docs/api/interfaces/InputProps.md +2 -2
  101. package/docs/api/interfaces/LabelProps.md +1 -1
  102. package/docs/api/interfaces/LoginFormProps.md +1 -1
  103. package/docs/api/interfaces/NavigationAccessRecord.md +1 -1
  104. package/docs/api/interfaces/NavigationContextType.md +1 -1
  105. package/docs/api/interfaces/NavigationGuardProps.md +1 -1
  106. package/docs/api/interfaces/NavigationItem.md +1 -1
  107. package/docs/api/interfaces/NavigationMenuProps.md +1 -1
  108. package/docs/api/interfaces/NavigationProviderProps.md +1 -1
  109. package/docs/api/interfaces/Organisation.md +1 -1
  110. package/docs/api/interfaces/OrganisationContextType.md +28 -17
  111. package/docs/api/interfaces/OrganisationMembership.md +1 -1
  112. package/docs/api/interfaces/OrganisationProviderProps.md +2 -2
  113. package/docs/api/interfaces/OrganisationSecurityError.md +1 -1
  114. package/docs/api/interfaces/PaceAppLayoutProps.md +1 -1
  115. package/docs/api/interfaces/PaceLoginPageProps.md +1 -1
  116. package/docs/api/interfaces/PageAccessRecord.md +1 -1
  117. package/docs/api/interfaces/PagePermissionContextType.md +1 -1
  118. package/docs/api/interfaces/PagePermissionGuardProps.md +1 -1
  119. package/docs/api/interfaces/PagePermissionProviderProps.md +1 -1
  120. package/docs/api/interfaces/PaletteData.md +1 -1
  121. package/docs/api/interfaces/PermissionEnforcerProps.md +1 -1
  122. package/docs/api/interfaces/PublicErrorBoundaryProps.md +1 -1
  123. package/docs/api/interfaces/PublicErrorBoundaryState.md +1 -1
  124. package/docs/api/interfaces/PublicLoadingSpinnerProps.md +2 -2
  125. package/docs/api/interfaces/PublicPageFooterProps.md +1 -1
  126. package/docs/api/interfaces/PublicPageHeaderProps.md +1 -1
  127. package/docs/api/interfaces/PublicPageLayoutProps.md +1 -1
  128. package/docs/api/interfaces/RBACConfig.md +1 -1
  129. package/docs/api/interfaces/RBACContextType.md +5 -11
  130. package/docs/api/interfaces/RBACLogger.md +1 -1
  131. package/docs/api/interfaces/RBACProviderProps.md +1 -1
  132. package/docs/api/interfaces/RoleBasedRouterContextType.md +1 -1
  133. package/docs/api/interfaces/RoleBasedRouterProps.md +1 -1
  134. package/docs/api/interfaces/RouteAccessRecord.md +1 -1
  135. package/docs/api/interfaces/RouteConfig.md +1 -1
  136. package/docs/api/interfaces/SecureDataContextType.md +1 -1
  137. package/docs/api/interfaces/SecureDataProviderProps.md +1 -1
  138. package/docs/api/interfaces/StorageConfig.md +1 -1
  139. package/docs/api/interfaces/StorageFileInfo.md +1 -1
  140. package/docs/api/interfaces/StorageFileMetadata.md +1 -1
  141. package/docs/api/interfaces/StorageListOptions.md +1 -1
  142. package/docs/api/interfaces/StorageListResult.md +1 -1
  143. package/docs/api/interfaces/StorageUploadOptions.md +1 -1
  144. package/docs/api/interfaces/StorageUploadResult.md +1 -1
  145. package/docs/api/interfaces/StorageUrlOptions.md +1 -1
  146. package/docs/api/interfaces/StyleImport.md +1 -1
  147. package/docs/api/interfaces/SwitchProps.md +1 -1
  148. package/docs/api/interfaces/ToastActionElement.md +1 -1
  149. package/docs/api/interfaces/ToastProps.md +1 -1
  150. package/docs/api/interfaces/UnifiedAuthContextType.md +524 -440
  151. package/docs/api/interfaces/UnifiedAuthProviderProps.md +14 -14
  152. package/docs/api/interfaces/UseInactivityTrackerOptions.md +1 -1
  153. package/docs/api/interfaces/UseInactivityTrackerReturn.md +1 -1
  154. package/docs/api/interfaces/UsePublicEventLogoOptions.md +1 -1
  155. package/docs/api/interfaces/UsePublicEventLogoReturn.md +1 -1
  156. package/docs/api/interfaces/UsePublicEventOptions.md +1 -1
  157. package/docs/api/interfaces/UsePublicEventReturn.md +1 -1
  158. package/docs/api/interfaces/UsePublicRouteParamsReturn.md +1 -1
  159. package/docs/api/interfaces/UserEventAccess.md +11 -11
  160. package/docs/api/interfaces/UserMenuProps.md +1 -1
  161. package/docs/api/interfaces/UserProfile.md +1 -1
  162. package/docs/api/modules.md +179 -52
  163. package/docs/architecture/services.md +30 -32
  164. package/docs/breaking-changes.md +2 -5
  165. package/docs/implementation-guides/data-tables.md +82 -1
  166. package/docs/migration/service-architecture.md +121 -260
  167. package/docs/rbac/README-rbac-rls-integration.md +48 -38
  168. package/{src/rbac/examples → examples/RBAC}/CompleteRBACExample.tsx +3 -2
  169. package/{src/rbac/examples → examples/RBAC}/EventBasedApp.tsx +5 -4
  170. package/{src/components/examples → examples/RBAC}/PermissionExample.tsx +7 -6
  171. package/examples/RBAC/__tests__/PermissionExample.test.tsx +150 -0
  172. package/examples/RBAC/index.ts +13 -0
  173. package/examples/README.md +37 -0
  174. package/examples/index.ts +22 -0
  175. package/{src/examples → examples/public-pages}/CorrectPublicPageImplementation.tsx +1 -1
  176. package/{src/examples → examples/public-pages}/PublicEventPage.tsx +1 -1
  177. package/{src/examples → examples/public-pages}/PublicPageApp.tsx +1 -1
  178. package/{src/examples → examples/public-pages}/PublicPageUsageExample.tsx +1 -1
  179. package/examples/public-pages/__tests__/PublicPageUsageExample.test.tsx +159 -0
  180. package/examples/public-pages/index.ts +14 -0
  181. package/package.json +22 -18
  182. package/src/__tests__/TEST_GUIDE_CURSOR.md +650 -9
  183. package/src/__tests__/helpers/README.md +255 -0
  184. package/src/__tests__/helpers/index.ts +62 -0
  185. package/src/__tests__/helpers/supabaseMock.ts +27 -3
  186. package/src/__tests__/rbac/PagePermissionGuard.test.tsx +6 -8
  187. package/src/components/DataTable/components/DataTableCore.tsx +37 -3
  188. package/src/components/DataTable/components/__tests__/COVERAGE_NOTE.md +55 -0
  189. package/src/components/DataTable/core/ColumnManager.ts +10 -0
  190. package/src/components/DataTable/core/__tests__/ColumnFactory.test.ts +254 -0
  191. package/src/components/DataTable/core/__tests__/ColumnManager.test.ts +193 -0
  192. package/src/components/DataTable/examples/__tests__/HierarchicalExample.test.tsx +45 -0
  193. package/src/components/DataTable/examples/__tests__/PerformanceExample.test.tsx +117 -0
  194. package/src/components/Dialog/Dialog.tsx +2 -2
  195. package/src/components/Dialog/examples/__tests__/HtmlDialogExample.test.tsx +71 -0
  196. package/src/components/Dialog/examples/__tests__/SimpleHtmlTest.test.tsx +122 -0
  197. package/src/components/EventSelector/EventSelector.tsx +1 -1
  198. package/src/components/Header/Header.test.tsx +35 -1
  199. package/src/components/Header/Header.tsx +3 -1
  200. package/src/components/OrganisationSelector/OrganisationSelector.tsx +3 -3
  201. package/src/components/PaceAppLayout/__tests__/PaceAppLayout.rbac.test.tsx +24 -4
  202. package/src/components/PaceLoginPage/PaceLoginPage.test.tsx +3 -2
  203. package/src/components/Toast/Toast.test.tsx +1 -1
  204. package/src/components/Toast/Toast.tsx +1 -1
  205. package/src/hooks/__tests__/useFocusManagement.unit.test.ts +220 -0
  206. package/src/hooks/__tests__/useIsMobile.unit.test.ts +117 -0
  207. package/src/hooks/__tests__/useKeyboardShortcuts.unit.test.ts +295 -0
  208. package/src/hooks/__tests__/useOrganisationSecurity.unit.test.tsx +29 -19
  209. package/src/hooks/__tests__/useRBAC.unit.test.ts +7 -3
  210. package/src/hooks/__tests__/useSecureDataAccess.unit.test.tsx +115 -19
  211. package/src/hooks/useEventTheme.test.ts +350 -0
  212. package/src/hooks/useEventTheme.ts +1 -1
  213. package/src/hooks/useEvents.ts +61 -0
  214. package/src/hooks/useOrganisationSecurity.test.ts +4 -4
  215. package/src/hooks/useOrganisationSecurity.ts +2 -2
  216. package/src/hooks/useOrganisations.ts +64 -0
  217. package/src/hooks/useSecureDataAccess.test.ts +9 -5
  218. package/src/hooks/useSecureDataAccess.ts +2 -2
  219. package/src/index.ts +18 -3
  220. package/src/providers/AuthProvider.tsx +8 -292
  221. package/src/providers/EventProvider.tsx +15 -425
  222. package/src/providers/InactivityProvider.tsx +8 -231
  223. package/src/providers/OrganisationProvider.test.simple.tsx +3 -2
  224. package/src/providers/OrganisationProvider.tsx +11 -890
  225. package/src/providers/UnifiedAuthProvider.tsx +8 -320
  226. package/src/providers/__tests__/AuthProvider.test.tsx +18 -17
  227. package/src/providers/__tests__/EventProvider.test.tsx +253 -2
  228. package/src/providers/__tests__/InactivityProvider.test-helper.tsx +65 -0
  229. package/src/providers/__tests__/InactivityProvider.test.tsx +46 -114
  230. package/src/providers/__tests__/OrganisationProvider.test.tsx +313 -3
  231. package/src/providers/__tests__/UnifiedAuthProvider.test.tsx +383 -2
  232. package/src/providers/index.ts +8 -7
  233. package/src/providers/services/EventServiceProvider.tsx +3 -0
  234. package/src/providers/services/UnifiedAuthProvider.tsx +3 -0
  235. package/src/rbac/hooks/usePermissions.test.ts +296 -0
  236. package/src/rbac/hooks/useRBAC.test.ts +9 -5
  237. package/src/rbac/hooks/useRBAC.ts +3 -3
  238. package/src/rbac/providers/__tests__/RBACProvider.integration.test.tsx +688 -0
  239. package/src/rbac/providers/__tests__/RBACProvider.test.tsx +507 -0
  240. package/src/services/AuthService.ts +19 -4
  241. package/src/services/__tests__/AuthService.test.ts +288 -0
  242. package/src/styles/core.css +2 -0
  243. package/src/types/__tests__/guards.test.ts +246 -0
  244. package/src/types/guards.ts +1 -0
  245. package/src/types/organisation.ts +3 -2
  246. package/src/validation/__tests__/sanitization.unit.test.ts +250 -0
  247. package/src/validation/__tests__/schemaUtils.unit.test.ts +451 -0
  248. package/src/validation/__tests__/user.unit.test.ts +440 -0
  249. package/dist/RBACProvider-BO4ilsQB.d.ts +0 -63
  250. package/dist/UnifiedAuthProvider-D02AMXgO.d.ts +0 -103
  251. package/dist/chunk-2PRPDH66.js.map +0 -1
  252. package/dist/chunk-3SP4P7NS.js.map +0 -1
  253. package/dist/chunk-43C63KLH.js.map +0 -1
  254. package/dist/chunk-5A4RL4BC.js +0 -5670
  255. package/dist/chunk-5A4RL4BC.js.map +0 -1
  256. package/dist/chunk-BYG6OSTC.js.map +0 -1
  257. package/dist/chunk-CDDYJCYU.js +0 -79
  258. package/dist/chunk-CDDYJCYU.js.map +0 -1
  259. package/dist/chunk-F24P24TZ.js +0 -17
  260. package/dist/chunk-F24P24TZ.js.map +0 -1
  261. package/dist/chunk-GBC5PC3N.js.map +0 -1
  262. package/dist/chunk-LANO5IFV.js.map +0 -1
  263. package/dist/chunk-M4UMXYNK.js.map +0 -1
  264. package/dist/chunk-RJNE764D.js +0 -953
  265. package/dist/chunk-RJNE764D.js.map +0 -1
  266. package/dist/chunk-UC2BWIK7.js.map +0 -1
  267. package/dist/rbac/cli/policy-manager.js +0 -278
  268. package/dist/rbac/cli/policy-manager.js.map +0 -1
  269. package/docs/api/interfaces/EventContextType.md +0 -96
  270. package/docs/api/interfaces/EventProviderProps.md +0 -19
  271. package/src/providers/OrganisationProvider.test.tsx +0 -164
  272. package/src/providers/UnifiedAuthProvider.test.tsx +0 -124
  273. package/src/providers/__tests__/AuthProvider.test.tsx.backup +0 -771
  274. package/src/providers/__tests__/EventProvider.test.tsx.backup +0 -824
  275. package/src/providers/__tests__/OrganisationProvider.test.tsx.backup +0 -820
  276. package/src/providers/__tests__/UnifiedAuthProvider.test.tsx.backup +0 -911
  277. package/src/providers/__tests__/UnifiedAuthProvider.test.tsx.backup2 +0 -166
  278. package/src/rbac/cli/__tests__/policy-manager.test.ts +0 -339
  279. package/src/rbac/cli/policy-manager.ts +0 -443
  280. package/dist/{DataTable-INW5YIFV.js.map → DataTable-HWZQGASI.js.map} +0 -0
  281. package/dist/{UnifiedAuthProvider-6SYT5WFN.js.map → UnifiedAuthProvider-3NKDOSOK.js.map} +0 -0
  282. package/dist/{validation-PM_iOaTI.d.ts → validation-D8VcbTzC.d.ts} +2 -2
  283. /package/src/utils/{appNameResolver.test.ts.backup → appNameResolver.test 2.ts} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/hooks/useOrganisationPermissions.ts","../src/hooks/useOrganisationSecurity.ts","../src/hooks/useEventTheme.ts","../src/hooks/public/usePublicEvent.ts","../src/hooks/public/usePublicRouteParams.ts"],"sourcesContent":["/**\n * @file useOrganisationPermissions Hook\n * @package @jmruthers/pace-core\n * @module Hooks/useOrganisationPermissions\n * @since 0.4.0\n *\n * Hook for managing organisation-specific permissions and role validation.\n * Provides secure access to user's role and permissions within organisations.\n *\n * @example\n * ```tsx\n * function OrganisationComponent() {\n * const { \n * isOrgAdmin, \n * canManageMembers,\n * userRole,\n * hasOrganisationAccess\n * } = useOrganisationPermissions();\n * \n * return (\n * <div>\n * {isOrgAdmin && <AdminPanel />}\n * {canManageMembers && <MemberManagement />}\n * <p>Your role: {userRole}</p>\n * </div>\n * );\n * }\n * \n * // For specific organisation\n * function MultiOrgComponent() {\n * const permissions = useOrganisationPermissions('org-123');\n * \n * if (!permissions.hasOrganisationAccess) {\n * return <div>No access to this organisation</div>;\n * }\n * \n * return <div>Role in org-123: {permissions.userRole}</div>;\n * }\n * ```\n *\n * @security\n * - Validates user membership in organisation\n * - Provides role-based permission checks\n * - Ensures secure access to organisation data\n * - Real-time permission validation\n */\n\nimport { useMemo } from 'react';\nimport { useOrganisations } from '../providers/OrganisationProvider';\nimport type { OrganisationRole, OrganisationPermission } from '../types/organisation';\n\nexport interface UseOrganisationPermissionsReturn {\n /** User's role in the organisation */\n userRole: OrganisationRole | 'no_access';\n \n /** Whether user has organisation admin role */\n isOrgAdmin: boolean;\n \n /** Whether user is a super admin */\n isSuperAdmin: boolean;\n \n /** Whether user can moderate content */\n canModerate: boolean;\n \n /** Whether user can manage members */\n canManageMembers: boolean;\n \n /** Whether user can manage organisation settings */\n canManageSettings: boolean;\n \n /** Whether user can manage events */\n canManageEvents: boolean;\n \n /** Whether user has any admin privileges */\n hasAdminPrivileges: boolean;\n \n /** Whether user has access to the organisation */\n hasOrganisationAccess: boolean;\n \n /** Check if user has specific permission */\n hasPermission: (permission: OrganisationPermission) => boolean;\n \n /** Get all permissions for the user */\n getAllPermissions: () => OrganisationPermission[];\n \n /** Organisation ID being checked */\n organisationId: string;\n}\n\n/**\n * Hook to access organisation-specific permissions and roles\n * \n * @param orgId - Optional organisation ID. Defaults to currently selected organisation\n * @returns Organisation permissions and role information\n */\nexport function useOrganisationPermissions(orgId?: string): UseOrganisationPermissionsReturn {\n const { \n selectedOrganisation, \n getUserRole, \n validateOrganisationAccess,\n ensureOrganisationContext\n } = useOrganisations();\n\n const organisationId = useMemo(() => {\n if (orgId) {\n return orgId;\n }\n try {\n const currentOrg = ensureOrganisationContext();\n return currentOrg.id;\n } catch {\n return '';\n }\n }, [orgId, ensureOrganisationContext]);\n\n const userRole = useMemo(() => {\n if (!organisationId) return 'no_access';\n const role = getUserRole(organisationId);\n // Map to valid OrganisationRole or 'no_access'\n if (role === 'org_admin' || role === 'leader' || role === 'member' || role === 'supporter') {\n return role as OrganisationRole;\n }\n return 'no_access';\n }, [organisationId, getUserRole]);\n\n const hasOrganisationAccess = useMemo(() => {\n if (!organisationId) return false;\n return validateOrganisationAccess(organisationId);\n }, [organisationId, validateOrganisationAccess]);\n\n const permissions = useMemo(() => {\n if (!hasOrganisationAccess || userRole === 'no_access') {\n return {\n isOrgAdmin: false,\n isSuperAdmin: false,\n canModerate: false,\n canManageMembers: false,\n canManageSettings: false,\n canManageEvents: false,\n hasAdminPrivileges: false\n };\n }\n\n const isOrgAdmin = userRole === 'org_admin';\n const isLeader = userRole === 'leader';\n const isMember = userRole === 'member';\n const isSupporter = userRole === 'supporter';\n\n // Super admin is handled separately via user profile context\n // Check global user context for super admin status\n const globalUser = (globalThis as any).__PACE_USER__;\n const isSuperAdmin = globalUser?.app_metadata?.globalRole === 'super_admin' || \n globalUser?.user_metadata?.globalRole === 'super_admin' ||\n isOrgAdmin; // Fallback to org_admin for backward compatibility\n\n return {\n isOrgAdmin,\n isSuperAdmin,\n canModerate: isSuperAdmin || isOrgAdmin || isLeader,\n canManageMembers: isSuperAdmin || isOrgAdmin || isLeader, // Leaders can manage members\n canManageSettings: isSuperAdmin || isOrgAdmin,\n canManageEvents: isSuperAdmin || isOrgAdmin || isLeader,\n hasAdminPrivileges: isSuperAdmin || isOrgAdmin || isLeader // Leaders have admin privileges\n };\n }, [hasOrganisationAccess, userRole]);\n\n const hasPermission = useMemo(() => {\n return (permission: OrganisationPermission): boolean => {\n if (!hasOrganisationAccess || userRole === 'no_access') {\n return false;\n }\n\n // Super admin has all permissions (org_admin acts as super admin within org)\n if (userRole === 'org_admin' || permission === '*') {\n return true;\n }\n\n // Map permissions to roles using the defined permissions from organisation types\n const rolePermissions: Record<OrganisationRole, OrganisationPermission[]> = {\n supporter: ['view_basic'],\n member: ['view_basic', 'view_details'],\n leader: ['view_basic', 'view_details', 'moderate_content', 'manage_events'],\n org_admin: ['view_basic', 'view_details', 'moderate_content', 'manage_events', 'manage_members', 'manage_settings']\n };\n\n const userPermissions = rolePermissions[userRole as OrganisationRole] || [];\n return userPermissions.includes(permission) || userPermissions.includes('*');\n };\n }, [hasOrganisationAccess, userRole]);\n\n const getAllPermissions = useMemo(() => {\n return (): OrganisationPermission[] => {\n if (!hasOrganisationAccess || userRole === 'no_access') {\n return [];\n }\n\n const rolePermissions: Record<OrganisationRole, OrganisationPermission[]> = {\n supporter: ['view_basic'],\n member: ['view_basic', 'view_details'],\n leader: ['view_basic', 'view_details', 'moderate_content', 'manage_events'],\n org_admin: ['view_basic', 'view_details', 'moderate_content', 'manage_events', 'manage_members', 'manage_settings']\n };\n\n return rolePermissions[userRole as OrganisationRole] || [];\n };\n }, [hasOrganisationAccess, userRole]);\n\n return useMemo(() => ({\n userRole,\n organisationId,\n hasOrganisationAccess,\n hasPermission,\n getAllPermissions,\n ...permissions\n }), [userRole, organisationId, hasOrganisationAccess, hasPermission, getAllPermissions, permissions]);\n} ","/**\n * @file Organisation Security Hook\n * @package @jmruthers/pace-core\n * @module Hooks/OrganisationSecurity\n * @since 0.4.0\n *\n * Security-focused hook for organisation access validation and super admin functionality.\n * Provides utilities for validating user access to organisations and checking permissions.\n */\n\nimport { useCallback, useMemo } from 'react';\nimport { useUnifiedAuth } from '../providers';\nimport { useOrganisations } from './useOrganisations';\n// Legacy useRBAC hook removed - use new RBAC system instead\nimport type { OrganisationSecurityError, SuperAdminContext } from '../types/organisation';\nimport type { Permission } from '../rbac/types';\n\nexport interface OrganisationSecurityHook {\n // Super admin context\n superAdminContext: SuperAdminContext;\n \n // Access validation\n validateOrganisationAccess: (orgId: string) => Promise<boolean>;\n hasMinimumRole: (minRole: string, orgId?: string) => boolean;\n canAccessChildOrganisations: (orgId?: string) => boolean;\n \n // Permission checks\n hasPermission: (permission: string, orgId?: string) => Promise<boolean>;\n getUserPermissions: (orgId?: string) => Promise<string[]>;\n \n // Audit logging\n logOrganisationAccess: (action: string, details?: any) => Promise<void>;\n \n // Security utilities\n ensureOrganisationAccess: (orgId: string) => Promise<void>;\n validateUserAccess: (userId: string, orgId: string) => Promise<boolean>;\n}\n\nexport const useOrganisationSecurity = (): OrganisationSecurityHook => {\n const { user, session, supabase } = useUnifiedAuth();\n const { selectedOrganisation, getUserRole, validateOrganisationAccess: validateAccess } = useOrganisations();\n // Get global role directly from user metadata\n const globalRole = useMemo(() => {\n if (!user) return null;\n return user.app_metadata?.globalRole === 'super_admin' || \n user.user_metadata?.globalRole === 'super_admin' ? 'super_admin' : null;\n }, [user]);\n\n // Super admin context\n const superAdminContext = useMemo((): SuperAdminContext => {\n const isSuperAdmin = globalRole === 'super_admin';\n return {\n isSuperAdmin,\n hasGlobalAccess: isSuperAdmin,\n canManageAllOrganisations: isSuperAdmin\n };\n }, [globalRole]);\n\n // Validate organisation access with database check\n const validateOrganisationAccess = useCallback(async (orgId: string): Promise<boolean> => {\n if (!user || !session || !supabase) return false;\n \n try {\n // Super admin has access to all organisations\n if (superAdminContext.isSuperAdmin) {\n return true;\n }\n\n // Check organisation membership using consolidated rbac_organisation_roles table\n const { data, error } = await supabase\n .from('rbac_organisation_roles')\n .select('id')\n .eq('user_id', user.id)\n .eq('organisation_id', orgId)\n .eq('status', 'active')\n .is('revoked_at', null)\n .in('role', ['org_admin', 'leader', 'member']) // Only actual members, not supporters\n .single();\n\n if (error) {\n console.error('[useOrganisationSecurity] Error validating organisation access:', error);\n return false;\n }\n\n return !!data;\n } catch (error) {\n console.error('[useOrganisationSecurity] Exception validating organisation access:', error);\n return false;\n }\n }, [user, session, supabase, superAdminContext.isSuperAdmin]);\n\n // Check if user has minimum role\n const hasMinimumRole = useCallback((minRole: string, orgId?: string): boolean => {\n // Super admin has all roles\n if (superAdminContext.isSuperAdmin) {\n return true;\n }\n\n const targetOrgId = orgId || selectedOrganisation?.id;\n if (!targetOrgId) return false;\n\n const userRole = getUserRole(targetOrgId);\n const roleHierarchy = ['supporter', 'member', 'leader', 'org_admin'];\n \n const userRoleIndex = roleHierarchy.indexOf(userRole);\n const minRoleIndex = roleHierarchy.indexOf(minRole);\n \n return userRoleIndex >= minRoleIndex;\n }, [selectedOrganisation, getUserRole, superAdminContext.isSuperAdmin]);\n\n // Check if user can access child organisations\n const canAccessChildOrganisations = useCallback((orgId?: string): boolean => {\n // Super admin can access all organisations\n if (superAdminContext.isSuperAdmin) {\n return true;\n }\n\n const targetOrgId = orgId || selectedOrganisation?.id;\n if (!targetOrgId) return false;\n\n const userRole = getUserRole(targetOrgId);\n return userRole === 'org_admin';\n }, [selectedOrganisation, getUserRole, superAdminContext.isSuperAdmin]);\n\n // Check specific permission using the new RBAC system\n const hasPermission = useCallback(async (permission: string, orgId?: string): Promise<boolean> => {\n // Super admin has all permissions\n if (superAdminContext.isSuperAdmin) {\n return true;\n }\n\n const targetOrgId = orgId || selectedOrganisation?.id;\n if (!targetOrgId || !user) return false;\n\n try {\n // Use the new RBAC system\n const { isPermitted } = await import('../rbac/api');\n \n const scope = {\n organisationId: targetOrgId,\n eventId: user.user_metadata?.eventId || user.app_metadata?.eventId,\n appId: user.user_metadata?.appId || user.app_metadata?.appId,\n };\n\n return await isPermitted({\n userId: user.id,\n scope,\n permission: permission as Permission\n });\n } catch (error) {\n console.error('[useOrganisationSecurity] Exception checking permission:', error);\n return false;\n }\n }, [selectedOrganisation, user, superAdminContext.isSuperAdmin]);\n\n // Get user's permissions for organisation using the new RBAC system\n const getUserPermissions = useCallback(async (orgId?: string): Promise<string[]> => {\n // Super admin has all permissions\n if (superAdminContext.isSuperAdmin) {\n return ['*']; // All permissions\n }\n\n const targetOrgId = orgId || selectedOrganisation?.id;\n if (!targetOrgId || !user) return [];\n\n try {\n // Use the new RBAC system\n const { getPermissionMap } = await import('../rbac/api');\n \n const scope = {\n organisationId: targetOrgId,\n eventId: user.user_metadata?.eventId || user.app_metadata?.eventId,\n appId: user.user_metadata?.appId || user.app_metadata?.appId,\n };\n\n const permissionMap = await getPermissionMap({\n userId: user.id,\n scope\n });\n \n // Flatten all permissions from all pages\n const allPermissions = Object.values(permissionMap).flat();\n return [...new Set(allPermissions)]; // Remove duplicates\n } catch (error) {\n console.error('[useOrganisationSecurity] Exception getting user permissions:', error);\n return [];\n }\n }, [selectedOrganisation, user, getUserRole, superAdminContext.isSuperAdmin]);\n\n // Log organisation access for audit using the new RBAC audit system\n const logOrganisationAccess = useCallback(async (action: string, details?: any): Promise<void> => {\n if (!user || !selectedOrganisation) return;\n\n try {\n // Use the new RBAC audit system - only if we have a valid organisation ID\n if (selectedOrganisation.id) {\n const { emitAuditEvent } = await import('../rbac/audit');\n \n await emitAuditEvent({\n type: 'permission_check',\n userId: user.id,\n organisationId: selectedOrganisation.id,\n permission: action,\n decision: true, // Assume access was granted if we're logging it\n source: 'api',\n duration_ms: 0, // No actual permission check performed here\n metadata: details || {}\n });\n }\n } catch (error) {\n console.error('[useOrganisationSecurity] Error logging organisation access:', error);\n }\n }, [user, selectedOrganisation]);\n\n // Ensure organisation access (throws if no access)\n const ensureOrganisationAccess = useCallback(async (orgId: string): Promise<void> => {\n const hasAccess = await validateOrganisationAccess(orgId);\n \n if (!hasAccess) {\n const error = new Error(`User does not have access to organisation ${orgId}`) as OrganisationSecurityError;\n error.name = 'OrganisationSecurityError';\n error.code = 'ACCESS_DENIED';\n error.organisationId = orgId;\n error.userId = user?.id;\n throw error;\n }\n }, [validateOrganisationAccess, user]);\n\n // Validate user access (for admin functions)\n const validateUserAccess = useCallback(async (userId: string, orgId: string): Promise<boolean> => {\n if (!supabase) return false;\n\n try {\n // Super admin can validate any user\n if (superAdminContext.isSuperAdmin) {\n return true;\n }\n\n // Regular users can only validate their own access\n if (userId !== user?.id) {\n return false;\n }\n\n return await validateOrganisationAccess(orgId);\n } catch (error) {\n console.error('[useOrganisationSecurity] Exception validating user access:', error);\n return false;\n }\n }, [supabase, superAdminContext.isSuperAdmin, user, validateOrganisationAccess]);\n\n return {\n superAdminContext,\n validateOrganisationAccess,\n hasMinimumRole,\n canAccessChildOrganisations,\n hasPermission,\n getUserPermissions,\n logOrganisationAccess,\n ensureOrganisationAccess,\n validateUserAccess\n };\n}; ","/**\n * @file Event Theme Hook\n * @package @jmruthers/pace-core\n * @module Hooks/EventTheme\n * @since 2.0.0\n * \n * Hook that automatically applies event-specific theming when an event is selected.\n * This ensures consistent UX across all apps in the pace suite.\n * \n * @example\n * ```tsx\n * import { useEventTheme } from '@jmruthers/pace-core/hooks';\n * \n * function MyApp() {\n * // Automatically applies event colors when event is selected\n * useEventTheme();\n * \n * return <div>Your app content</div>;\n * }\n * ```\n */\n\nimport { useEffect } from 'react';\nimport { useEvents } from './useEvents';\nimport { applyPalette, clearPalette } from '../theming/runtime';\nimport type { PaletteData, ColorPalette } from '../theming/runtime';\n\n/**\n * Hook that automatically applies event-specific theming\n * \n * This hook watches the selected event and applies its colors using the theming system.\n * It will:\n * - Apply event colors when an event with `event_colours` is selected\n * - Clear theming when no event is selected\n * - Handle cleanup when the component unmounts\n * \n * @returns void - This is an effect hook with no return value\n */\nexport function useEventTheme(): void {\n const { selectedEvent } = useEvents();\n\n useEffect(() => {\n // If there's no selected event, clear any dynamic theming\n if (!selectedEvent) {\n clearPalette();\n return;\n }\n\n // Check if the event has theme colors\n const eventColours = selectedEvent.event_colours;\n\n if (!eventColours || typeof eventColours !== 'object') {\n clearPalette();\n return;\n }\n\n // Validate that event_colours has the expected structure\n const palette = eventColours as Partial<PaletteData>;\n \n // Check if we have at least one valid palette (main, sec, or acc)\n if (!palette.main && !palette.sec && !palette.acc) {\n clearPalette();\n return;\n }\n\n // Apply the palette\n // The system expects main, sec, and acc, so we ensure all are present (empty if needed)\n const fullPalette: PaletteData = {\n main: (palette.main as ColorPalette) || {},\n sec: (palette.sec as ColorPalette) || {},\n acc: (palette.acc as ColorPalette) || {},\n };\n\n try {\n applyPalette(fullPalette);\n } catch (error) {\n console.error('[useEventTheme] Failed to apply event palette:', error);\n }\n\n // Cleanup function to clear palette when component unmounts or event changes\n return () => {\n // Don't clear on unmount since we want the theme to persist\n // The next event selection will update it\n };\n }, [selectedEvent]);\n}\n","/**\n * @file Public Event Hook\n * @package @jmruthers/pace-core\n * @module Hooks/Public\n * @since 1.0.0\n *\n * A React hook for accessing public event data without authentication.\n * Provides event information by event_code for public pages.\n *\n * Features:\n * - No authentication required\n * - Caching for performance\n * - Error handling and loading states\n * - TypeScript support\n * - Automatic refetch capabilities\n *\n * @example\n * ```tsx\n * import { usePublicEvent } from '@jmruthers/pace-core';\n *\n * function PublicEventPage() {\n * const { eventCode } = usePublicRouteParams();\n * const { event, isLoading, error, refetch } = usePublicEvent(eventCode);\n *\n * if (isLoading) return <div>Loading event...</div>;\n * if (error) return <div>Error: {error.message}</div>;\n * if (!event) return <div>Event not found</div>;\n *\n * return (\n * <div>\n * <h1>{event.event_name}</h1>\n * <p>Date: {event.event_date}</p>\n * <p>Venue: {event.event_venue}</p>\n * </div>\n * );\n * }\n * ```\n *\n * @accessibility\n * - No direct accessibility concerns (hook)\n * - Enables accessible public event display\n * - Supports screen reader friendly loading states\n *\n * @security\n * - Only returns public-safe event data\n * - Validates event_code before querying\n * - No sensitive information exposed\n * - Rate limiting applied at database level\n *\n * @performance\n * - Built-in caching with TTL\n * - Minimal re-renders with stable references\n * - Lazy loading support\n * - Error boundary integration\n *\n * @dependencies\n * - React 18+ - Hooks and effects\n * - @supabase/supabase-js - Database integration\n * - Event types - Type definitions\n */\n\nimport { useState, useEffect, useCallback, useMemo } from 'react';\nimport { createClient } from '@supabase/supabase-js';\nimport type { Event } from '../../types/unified';\nimport type { Database } from '../../types/database';\nimport { usePublicPageContext } from '../../components/PublicLayout/PublicPageProvider';\n\n// Simple in-memory cache for public data\nconst publicDataCache = new Map<string, { data: any; timestamp: number; ttl: number }>();\n\nexport interface UsePublicEventReturn {\n /** The event data, null if not loaded or not found */\n event: Event | null;\n /** Whether the data is currently loading */\n isLoading: boolean;\n /** Any error that occurred during loading */\n error: Error | null;\n /** Function to manually refetch the data */\n refetch: () => Promise<void>;\n}\n\nexport interface UsePublicEventOptions {\n /** Cache TTL in milliseconds (default: 5 minutes) */\n cacheTtl?: number;\n /** Whether to enable caching (default: true) */\n enableCache?: boolean;\n}\n\n/**\n * Hook for accessing public event data by event_code\n * \n * This hook provides access to public event information without requiring\n * authentication. It includes caching, error handling, and loading states.\n * \n * @param eventCode - The event code to look up\n * @param options - Configuration options for caching and behavior\n * @returns Object containing event data, loading state, error, and refetch function\n */\nexport function usePublicEvent(\n eventCode: string,\n options: UsePublicEventOptions = {}\n): UsePublicEventReturn {\n const {\n cacheTtl = 5 * 60 * 1000, // 5 minutes\n enableCache = true\n } = options;\n\n const [event, setEvent] = useState<Event | null>(null);\n const [isLoading, setIsLoading] = useState<boolean>(true);\n const [error, setError] = useState<Error | null>(null);\n\n // Get environment variables from public page context or fallback to direct access\n let environment: { supabaseUrl: string | null; supabaseKey: string | null };\n \n try {\n environment = usePublicPageContext().environment;\n } catch {\n // Fallback to direct environment variable access if not in PublicPageProvider\n environment = {\n supabaseUrl: (import.meta as any).env?.VITE_SUPABASE_URL || (import.meta as any).env?.NEXT_PUBLIC_SUPABASE_URL || null,\n supabaseKey: (import.meta as any).env?.VITE_SUPABASE_ANON_KEY || (import.meta as any).env?.NEXT_PUBLIC_SUPABASE_ANON_KEY || null\n };\n }\n \n // Create a simple Supabase client for public access\n const supabase = useMemo(() => {\n if (typeof window === 'undefined') return null;\n \n if (!environment.supabaseUrl || !environment.supabaseKey) {\n console.warn('[usePublicEvent] Missing Supabase environment variables. Please ensure VITE_SUPABASE_URL and VITE_SUPABASE_ANON_KEY are set in your environment.');\n return null;\n }\n\n return createClient<Database>(environment.supabaseUrl, environment.supabaseKey);\n }, [environment.supabaseUrl, environment.supabaseKey]);\n\n // Helper function to try refreshing schema cache\n const refreshSchemaCache = useCallback(async () => {\n try {\n // Try to trigger a schema refresh by querying a system table\n await (supabase as any).from('information_schema.routines').select('routine_name').limit(1);\n } catch (error) {\n // Ignore errors, this is just an attempt to refresh cache\n console.debug('[usePublicEvent] Schema cache refresh attempt failed:', error);\n }\n }, [supabase]);\n\n const fetchEvent = useCallback(async (): Promise<void> => {\n if (!eventCode || !supabase) {\n setError(new Error('Invalid event code or Supabase client not available'));\n setIsLoading(false);\n return;\n }\n\n // Check cache first\n const cacheKey = `public_event_${eventCode}`;\n if (enableCache) {\n const cached = publicDataCache.get(cacheKey);\n if (cached && Date.now() - cached.timestamp < cached.ttl) {\n setEvent(cached.data);\n setIsLoading(false);\n setError(null);\n return;\n }\n }\n\n try {\n setIsLoading(true);\n setError(null);\n\n let eventData: any = null;\n\n try {\n // Try to call the public event RPC function first\n const response = await (supabase as any).rpc('get_public_event_by_code', {\n event_code_param: eventCode\n });\n \n const data = response?.data;\n const rpcError = response?.error;\n\n if (rpcError) {\n // If RPC function doesn't exist or schema cache issue, try refresh first, then fallback\n if (rpcError.message?.includes('Could not find the function') || \n rpcError.message?.includes('does not exist') ||\n rpcError.message?.includes('schema cache')) {\n console.warn('[usePublicEvent] RPC function not found or schema cache issue, attempting refresh:', rpcError.message);\n \n // Try to refresh schema cache first\n await refreshSchemaCache();\n \n // Try RPC call one more time after refresh\n try {\n const retryResponse = await (supabase as any).rpc('get_public_event_by_code', {\n event_code_param: eventCode\n });\n \n const retryData = retryResponse?.data;\n const retryError = retryResponse?.error;\n \n if (!retryError && retryData && retryData.length > 0) {\n eventData = retryData[0];\n } else {\n throw new Error('RPC still failing after cache refresh');\n }\n } catch (retryError) {\n console.warn('[usePublicEvent] RPC still failing after cache refresh, falling back to direct table access');\n \n // Fallback: Direct table access with public RLS policy\n const tableResponse2 = await (supabase as any)\n .from('event')\n .select(`\n event_id,\n event_name,\n event_date,\n event_venue,\n event_participants,\n event_colours,\n organisation_id,\n event_days,\n event_typicalunit,\n event_rounddown,\n event_youthmultiplier,\n event_catering_email,\n event_news,\n event_billing,\n event_footer,\n event_email\n `)\n .eq('event_code', eventCode)\n .eq('is_visible', true)\n .not('organisation_id', 'is', null)\n .limit(1)\n .single();\n\n const tableData = tableResponse2?.data;\n const tableError = tableResponse2?.error;\n\n if (tableError) {\n throw new Error(tableError?.message || 'Failed to fetch event from table');\n }\n\n if (!tableData) {\n setEvent(null);\n setError(new Error('Event not found'));\n return;\n }\n\n // Get event logo from file_references\n const logoResponse = await (supabase as any)\n .from('file_references')\n .select('file_path')\n .eq('table_name', 'event')\n .eq('record_id', tableData.event_id)\n .eq('is_public', true)\n .eq('file_metadata->>category', 'event_logos')\n .limit(1)\n .single();\n \n const logoData = logoResponse?.data;\n\n eventData = {\n ...tableData,\n event_logo: logoData?.file_path || null\n };\n }\n } else {\n // For RPC errors that aren't schema cache issues, throw immediately without fallback\n const errorMessage = rpcError?.message || rpcError?.toString() || 'Failed to fetch event';\n setEvent(null);\n setError(new Error(errorMessage));\n setIsLoading(false);\n return;\n }\n } else {\n if (!data || data.length === 0 || !data[0]) {\n setEvent(null);\n setError(new Error('Event not found'));\n return;\n }\n eventData = data[0];\n }\n } catch (rpcError) {\n // If RPC call fails for any reason (including schema cache issues), try direct table access\n console.warn('[usePublicEvent] RPC call failed, falling back to direct table access:', rpcError);\n \n const tableResponse = await (supabase as any)\n .from('event')\n .select(`\n event_id,\n event_name,\n event_date,\n event_venue,\n event_participants,\n event_colours,\n organisation_id,\n event_days,\n event_typicalunit,\n event_rounddown,\n event_youthmultiplier,\n event_catering_email,\n event_news,\n event_billing,\n event_footer,\n event_email\n `)\n .eq('event_code', eventCode)\n .eq('is_visible', true)\n .not('organisation_id', 'is', null)\n .limit(1)\n .single();\n\n const tableData = tableResponse?.data;\n const tableError = tableResponse?.error;\n\n if (tableError) {\n throw new Error(tableError?.message || 'Failed to fetch event from table');\n }\n\n if (!tableData) {\n setEvent(null);\n setError(new Error('Event not found'));\n return;\n }\n\n // Get event logo from file_references\n const logoResponse = await (supabase as any)\n .from('file_references')\n .select('file_path')\n .eq('table_name', 'event')\n .eq('record_id', tableData.event_id)\n .eq('is_public', true)\n .eq('file_metadata->>category', 'event_logos')\n .limit(1)\n .single();\n \n const logoData = logoResponse?.data;\n\n eventData = {\n ...tableData,\n event_logo: logoData?.file_path || null\n };\n }\n \n // Transform to Event type\n const transformedEvent: Event = {\n id: eventData.event_id,\n event_id: eventData.event_id,\n event_name: eventData.event_name,\n event_code: eventCode,\n event_date: eventData.event_date,\n event_venue: eventData.event_venue,\n event_participants: eventData.event_participants,\n event_logo: eventData.event_logo,\n event_colours: eventData.event_colours,\n organisation_id: eventData.organisation_id,\n is_visible: true,\n created_at: new Date().toISOString(),\n updated_at: new Date().toISOString(),\n // Legacy compatibility\n name: eventData.event_name,\n start_date: eventData.event_date\n };\n\n setEvent(transformedEvent);\n\n // Cache the result\n if (enableCache) {\n publicDataCache.set(cacheKey, {\n data: transformedEvent,\n timestamp: Date.now(),\n ttl: cacheTtl\n });\n }\n\n } catch (err) {\n console.error('[usePublicEvent] Error fetching event:', err);\n const error = err instanceof Error ? err : new Error('Unknown error occurred');\n setError(error);\n setEvent(null);\n } finally {\n setIsLoading(false);\n }\n }, [eventCode, supabase, cacheTtl, enableCache]);\n\n // Fetch event when eventCode changes\n useEffect(() => {\n fetchEvent();\n }, [fetchEvent]);\n\n const refetch = useCallback(async (): Promise<void> => {\n // Clear cache for this event\n if (enableCache) {\n const cacheKey = `public_event_${eventCode}`;\n publicDataCache.delete(cacheKey);\n }\n await fetchEvent();\n }, [fetchEvent, eventCode, enableCache]);\n\n return {\n event,\n isLoading,\n error,\n refetch\n };\n}\n\n/**\n * Clear all cached public event data\n * Useful for testing or when you need to force refresh all data\n */\nexport function clearPublicEventCache(): void {\n for (const [key] of publicDataCache) {\n if (key.startsWith('public_event_')) {\n publicDataCache.delete(key);\n }\n }\n}\n\n/**\n * Get cache statistics for debugging\n */\nexport function getPublicEventCacheStats(): { size: number; keys: string[] } {\n const keys = Array.from(publicDataCache.keys()).filter(key => key.startsWith('public_event_'));\n return {\n size: keys.length,\n keys\n };\n}\n","/**\n * @file Public Route Params Hook\n * @package @jmruthers/pace-core\n * @module Hooks/Public\n * @since 1.0.0\n *\n * A React hook for extracting and validating public route parameters.\n * Provides event code extraction and validation for public pages.\n *\n * Features:\n * - URL parameter extraction\n * - Event code validation\n * - TypeScript support\n * - Error handling\n * - Route pattern support\n *\n * @example\n * ```tsx\n * import { usePublicRouteParams } from '@jmruthers/pace-core';\n *\n * function PublicEventPage() {\n * const { eventCode, eventId, event, error, isLoading } = usePublicRouteParams();\n *\n * if (isLoading) return <div>Loading...</div>;\n * if (error) return <div>Error: {error.message}</div>;\n * if (!event) return <div>Event not found</div>;\n *\n * return (\n * <div>\n * <h1>{event.event_name}</h1>\n * <p>Event Code: {eventCode}</p>\n * </div>\n * );\n * }\n * ```\n *\n * @accessibility\n * - No direct accessibility concerns (hook)\n * - Enables accessible route parameter handling\n * - Supports screen reader friendly error states\n *\n * @security\n * - Validates event codes before processing\n * - Sanitizes URL parameters\n * - No sensitive information exposed\n * - Rate limiting applied at route level\n *\n * @performance\n * - Minimal re-renders with stable references\n * - Efficient parameter extraction\n * - Caching integration\n *\n * @dependencies\n * - React 18+ - Hooks and effects\n * - React Router - URL parameter extraction\n * - Event types - Type definitions\n */\n\nimport { useState, useEffect, useCallback, useMemo } from 'react';\nimport { useParams, useLocation } from 'react-router-dom';\nimport type { Event } from '../../types/unified';\nimport { usePublicEvent } from './usePublicEvent';\n\nexport interface UsePublicRouteParamsReturn {\n /** The event code from the URL */\n eventCode: string | null;\n /** The event ID (resolved from event code) */\n eventId: string | null;\n /** The full event object */\n event: Event | null;\n /** Whether the route parameters are being processed */\n isLoading: boolean;\n /** Any error that occurred during processing */\n error: Error | null;\n /** Function to manually refetch the event data */\n refetch: () => Promise<void>;\n}\n\ninterface UsePublicRouteParamsOptions {\n /** Whether to automatically fetch event data (default: true) */\n fetchEventData?: boolean;\n /** Custom event code parameter name (default: 'eventCode') */\n eventCodeParam?: string;\n /** Whether to validate event code format (default: true) */\n validateEventCode?: boolean;\n}\n\n/**\n * Validate event code format\n * Event codes should be alphanumeric with optional hyphens/underscores in the middle\n */\nfunction validateEventCodeFormat(eventCode: string): boolean {\n if (!eventCode || typeof eventCode !== 'string') return false;\n \n // Allow alphanumeric characters, hyphens, and underscores\n // Length between 3 and 50 characters\n // Must not start or end with hyphen/underscore\n const eventCodeRegex = /^[a-zA-Z0-9][a-zA-Z0-9_-]{1,48}[a-zA-Z0-9]$/;\n const matchesFormat = eventCodeRegex.test(eventCode);\n \n if (!matchesFormat) return false;\n \n // Additional check: no consecutive hyphens or underscores\n if (eventCode.includes('--') || eventCode.includes('__') || eventCode.includes('-_') || eventCode.includes('_-')) {\n return false;\n }\n \n return true;\n}\n\n/**\n * Hook for extracting and validating public route parameters\n * \n * This hook extracts event codes from URL parameters and optionally\n * fetches the corresponding event data. It provides validation and\n * error handling for public routes.\n * \n * @param options - Configuration options for behavior\n * @returns Object containing route parameters, event data, loading state, error, and refetch function\n */\nexport function usePublicRouteParams(\n options: UsePublicRouteParamsOptions = {}\n): UsePublicRouteParamsReturn {\n const {\n fetchEventData = true,\n eventCodeParam = 'eventCode',\n validateEventCode = true\n } = options;\n\n const params = useParams();\n const location = useLocation();\n \n const [error, setError] = useState<Error | null>(null);\n\n // Extract event code from URL parameters\n const eventCode = useMemo(() => {\n const code = params[eventCodeParam] as string;\n \n if (!code) {\n // Don't set error immediately - let the component handle missing eventCode gracefully\n return null;\n }\n\n // Validate event code format if requested\n if (validateEventCode && !validateEventCodeFormat(code)) {\n setError(new Error(`Invalid event code format: ${code}`));\n return null;\n }\n\n setError(null);\n return code;\n }, [params, eventCodeParam, validateEventCode]);\n\n // Use the public event hook to fetch event data\n const {\n event,\n isLoading: eventLoading,\n error: eventError,\n refetch: refetchEvent\n } = usePublicEvent(eventCode || '', {\n enableCache: true,\n cacheTtl: 5 * 60 * 1000 // 5 minutes\n });\n\n // Determine if we should show loading state\n const isLoading = useMemo(() => {\n if (!fetchEventData) return false;\n return eventLoading;\n }, [fetchEventData, eventLoading]);\n\n // Determine the final error state\n const finalError = useMemo(() => {\n if (error) return error;\n if (eventError) return eventError;\n return null;\n }, [error, eventError]);\n\n // Extract event ID from event data\n const eventId = useMemo(() => {\n if (!event) return null;\n return event.event_id || event.id;\n }, [event]);\n\n // Refetch function\n const refetch = useCallback(async (): Promise<void> => {\n if (!fetchEventData) return;\n await refetchEvent();\n }, [fetchEventData, refetchEvent]);\n\n // Log route access for debugging\n useEffect(() => {\n if (eventCode && event) {\n console.log('[usePublicRouteParams] Public route accessed:', {\n eventCode,\n eventId: event.event_id,\n eventName: event.event_name,\n path: location.pathname\n });\n }\n }, [eventCode, event, location.pathname]);\n\n return {\n eventCode,\n eventId,\n event: fetchEventData ? event : null,\n isLoading,\n error: finalError,\n refetch\n };\n}\n\n/**\n * Hook for extracting just the event code without fetching event data\n * Useful when you only need the event code and will fetch data separately\n */\nexport function usePublicEventCode(\n eventCodeParam: string = 'eventCode'\n): { eventCode: string | null; error: Error | null } {\n const params = useParams();\n \n const eventCode = useMemo(() => {\n const code = params[eventCodeParam] as string;\n \n if (!code) {\n return null;\n }\n\n // Validate event code format\n if (!validateEventCodeFormat(code)) {\n return null;\n }\n\n return code;\n }, [params, eventCodeParam]);\n\n const error = useMemo(() => {\n if (!eventCode) {\n return new Error(`Event code parameter '${eventCodeParam}' not found or invalid`);\n }\n return null;\n }, [eventCode, eventCodeParam]);\n\n return {\n eventCode,\n error\n };\n}\n\n/**\n * Utility function to generate public route paths\n */\nexport function generatePublicRoutePath(\n eventCode: string,\n pageName: string = 'index'\n): string {\n if (!eventCode || !validateEventCodeFormat(eventCode)) {\n throw new Error('Invalid event code for route generation');\n }\n \n return `/public/event/${eventCode}/${pageName}`;\n}\n\n/**\n * Utility function to extract event code from a public route path\n */\nexport function extractEventCodeFromPath(path: string): string | null {\n const match = path.match(/^\\/public\\/event\\/([a-zA-Z0-9_-]{3,50})(?:\\/.*)?$/);\n return match ? match[1] : null;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAgDA;AADA,SAAS,eAAe;AAgDjB,SAAS,2BAA2B,OAAkD;AAC3F,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,iBAAiB;AAErB,QAAM,iBAAiB,QAAQ,MAAM;AACnC,QAAI,OAAO;AACT,aAAO;AAAA,IACT;AACA,QAAI;AACF,YAAM,aAAa,0BAA0B;AAC7C,aAAO,WAAW;AAAA,IACpB,QAAQ;AACN,aAAO;AAAA,IACT;AAAA,EACF,GAAG,CAAC,OAAO,yBAAyB,CAAC;AAErC,QAAM,WAAW,QAAQ,MAAM;AAC7B,QAAI,CAAC,eAAgB,QAAO;AAC5B,UAAM,OAAO,YAAY,cAAc;AAEvC,QAAI,SAAS,eAAe,SAAS,YAAY,SAAS,YAAY,SAAS,aAAa;AAC1F,aAAO;AAAA,IACT;AACA,WAAO;AAAA,EACT,GAAG,CAAC,gBAAgB,WAAW,CAAC;AAEhC,QAAM,wBAAwB,QAAQ,MAAM;AAC1C,QAAI,CAAC,eAAgB,QAAO;AAC5B,WAAO,2BAA2B,cAAc;AAAA,EAClD,GAAG,CAAC,gBAAgB,0BAA0B,CAAC;AAE/C,QAAM,cAAc,QAAQ,MAAM;AAChC,QAAI,CAAC,yBAAyB,aAAa,aAAa;AACtD,aAAO;AAAA,QACL,YAAY;AAAA,QACZ,cAAc;AAAA,QACd,aAAa;AAAA,QACb,kBAAkB;AAAA,QAClB,mBAAmB;AAAA,QACnB,iBAAiB;A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AAEzB,QAAM,YAAYF,SAAQ,MAAM;AAC9B,UAAM,OAAO,OAAO,cAAc;AAElC,QAAI,CAAC,MAAM;AACT,aAAO;AAAA,IACT;AAGA,QAAI,CAAC,wBAAwB,IAAI,GAAG;AAClC,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT,GAAG,CAAC,QAAQ,cAAc,CAAC;AAE3B,QAAM,QAAQA,SAAQ,MAAM;AAC1B,QAAI,CAAC,WAAW;AACd,aAAO,IAAI,MAAM,yBAAyB,cAAc,wBAAwB;AAAA,IAClF;AACA,WAAO;AAAA,EACT,GAAG,CAAC,WAAW,cAAc,CAAC;AAE9B,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;AAKO,SAAS,wBACd,WACA,WAAmB,SACX;AACR,MAAI,CAAC,aAAa,CAAC,wBAAwB,SAAS,GAAG;AACrD,UAAM,IAAI,MAAM,yCAAyC;AAAA,EAC3D;AAEA,SAAO,iBAAiB,SAAS,IAAI,QAAQ;AAC/C;AAKO,SAAS,yBAAyB,MAA6B;AACpE,QAAM,QAAQ,KAAK,MAAM,mDAAmD;AAC5E,SAAO,QAAQ,MAAM,CAAC,IAAI;AAC5B;","names":["useMemo","useMemo","useEffect","useCallback","useMemo","useMemo","useCallback","error","useEffect","useState","useEffect","useCallback","useMemo","useState","useMemo","useCallback","useEffect"]}
@@ -1,5 +1,5 @@
1
- export { b as UnifiedAuthContextType, U as UnifiedAuthProvider, a as UnifiedAuthProviderProps, u as useUnifiedAuth } from './UnifiedAuthProvider-D02AMXgO.js';
2
- export { A as Alert, m as AlertDescription, l as AlertTitle, n as Avatar, p as AvatarFallback, o as AvatarImage, B as Button, a as ButtonProps, C as Card, g as CardActions, i as CardActionsProps, f as CardContent, e as CardDescription, c as CardFooter, b as CardHeader, h as CardProps, d as CardTitle, q as Checkbox, b3 as DefaultPublicErrorFallback, D as Dialog, K as DialogBody, G as DialogClose, H as DialogContent, U as DialogContentProps, O as DialogDescription, Z as DialogDescriptionProps, M as DialogFooter, X as DialogFooterProps, J as DialogHeader, W as DialogHeaderProps, E as DialogOverlay, V as DialogOverlayProps, z as DialogPortal, Q as DialogProps, _ as DialogSize, N as DialogTitle, Y as DialogTitleProps, F as DialogTrigger, R as DialogTriggerProps, az as ErrorBoundary, aA as ErrorBoundaryProps, aB as ErrorBoundaryState, a_ as EventLogo, a$ as EventLogoCompact, b0 as EventLogoLarge, ba as EventLogoProps, aD as EventSelector, aF as FileDisplay, aG as FileDisplayProps, ar as Footer, as as FooterProps, am as Form, an as FormProps, aq as Header, I as Input, j as InputProps, L as Label, k as LabelProps, aC as LoadingSpinner, ao as LoginForm, ap as LoginFormProps, av as NavigationItem, at as NavigationMenu, au as NavigationMenuProps, aw as OrganisationSelector, ax as OrganisationSelectorProps, bf as PaceAppLayout, be as PaceAppLayoutProps, bh as PaceLoginPage, bg as PaceLoginPageProps, aE as PasswordResetForm, P as Progress, b1 as PublicErrorBoundary, bb as PublicErrorBoundaryProps, bc as PublicErrorBoundaryState, b6 as PublicLoadingSkeleton, b4 as PublicLoadingSpinner, b5 as PublicLoadingSpinnerFullPage, bd as PublicLoadingSpinnerProps, aZ as PublicPageContextChecker, aX as PublicPageDebugger, aY as PublicPageDiagnostic, aW as PublicPageFooter, b9 as PublicPageFooterProps, aS as PublicPageHeader, b8 as PublicPageHeaderProps, aQ as PublicPageLayout, b7 as PublicPageLayoutProps, aT as PublicPageProvider, $ as Select, a3 as SelectContent, a0 as SelectGroup, a5 as SelectItem, a4 as SelectLabel, a6 as SelectSeparator, a2 as SelectTrigger, a1 as SelectValue, S as Switch, r as SwitchProps, T as Table, t as TableBody, u as TableCaption, v as TableCell, w as TableFooter, x as TableHead, s as TableHeader, y as TableRow, a7 as Toast, a9 as ToastAction, af as ToastActionElement, ae as ToastClose, ad as ToastDescription, ag as ToastProps, aa as ToastProvider, ac as ToastTitle, ab as ToastViewport, a8 as Toaster, ah as Tooltip, aj as TooltipContent, ak as TooltipProvider, al as TooltipRoot, ai as TooltipTrigger, aP as UseFileReferenceForRecordReturn, aN as UseFileReferenceOptions, aO as UseFileReferenceReturn, aJ as UseStorageOptions, aK as UseStorageReturn, ay as UserMenu, b2 as useErrorBoundary, aL as useFileReference, aM as useFileReferenceForRecord, aI as useFileUpload, aV as useIsPublicPage, aR as usePublicPageContext, aU as usePublicPageProviderContext, aH as useStorage } from './PublicLoadingSpinner-DLpF5bbs.js';
1
+ export { U as UnifiedAuthContextType, b as UnifiedAuthProvider, a as UnifiedAuthProviderProps, u as useUnifiedAuth } from './UnifiedAuthProvider-Bj6YCf7c.js';
2
+ export { A as Alert, m as AlertDescription, l as AlertTitle, n as Avatar, p as AvatarFallback, o as AvatarImage, B as Button, a as ButtonProps, C as Card, g as CardActions, i as CardActionsProps, f as CardContent, e as CardDescription, c as CardFooter, b as CardHeader, h as CardProps, d as CardTitle, q as Checkbox, b3 as DefaultPublicErrorFallback, D as Dialog, K as DialogBody, G as DialogClose, H as DialogContent, U as DialogContentProps, O as DialogDescription, Z as DialogDescriptionProps, M as DialogFooter, X as DialogFooterProps, J as DialogHeader, W as DialogHeaderProps, E as DialogOverlay, V as DialogOverlayProps, z as DialogPortal, Q as DialogProps, _ as DialogSize, N as DialogTitle, Y as DialogTitleProps, F as DialogTrigger, R as DialogTriggerProps, az as ErrorBoundary, aA as ErrorBoundaryProps, aB as ErrorBoundaryState, a_ as EventLogo, a$ as EventLogoCompact, b0 as EventLogoLarge, ba as EventLogoProps, aD as EventSelector, aF as FileDisplay, aG as FileDisplayProps, ar as Footer, as as FooterProps, am as Form, an as FormProps, aq as Header, I as Input, j as InputProps, L as Label, k as LabelProps, aC as LoadingSpinner, ao as LoginForm, ap as LoginFormProps, av as NavigationItem, at as NavigationMenu, au as NavigationMenuProps, aw as OrganisationSelector, ax as OrganisationSelectorProps, bf as PaceAppLayout, be as PaceAppLayoutProps, bh as PaceLoginPage, bg as PaceLoginPageProps, aE as PasswordResetForm, P as Progress, b1 as PublicErrorBoundary, bb as PublicErrorBoundaryProps, bc as PublicErrorBoundaryState, b6 as PublicLoadingSkeleton, b4 as PublicLoadingSpinner, b5 as PublicLoadingSpinnerFullPage, bd as PublicLoadingSpinnerProps, aZ as PublicPageContextChecker, aX as PublicPageDebugger, aY as PublicPageDiagnostic, aW as PublicPageFooter, b9 as PublicPageFooterProps, aS as PublicPageHeader, b8 as PublicPageHeaderProps, aQ as PublicPageLayout, b7 as PublicPageLayoutProps, aT as PublicPageProvider, $ as Select, a3 as SelectContent, a0 as SelectGroup, a5 as SelectItem, a4 as SelectLabel, a6 as SelectSeparator, a2 as SelectTrigger, a1 as SelectValue, S as Switch, r as SwitchProps, T as Table, t as TableBody, u as TableCaption, v as TableCell, w as TableFooter, x as TableHead, s as TableHeader, y as TableRow, a7 as Toast, a9 as ToastAction, af as ToastActionElement, ae as ToastClose, ad as ToastDescription, ag as ToastProps, aa as ToastProvider, ac as ToastTitle, ab as ToastViewport, a8 as Toaster, ah as Tooltip, aj as TooltipContent, ak as TooltipProvider, al as TooltipRoot, ai as TooltipTrigger, aP as UseFileReferenceForRecordReturn, aN as UseFileReferenceOptions, aO as UseFileReferenceReturn, aJ as UseStorageOptions, aK as UseStorageReturn, ay as UserMenu, b2 as useErrorBoundary, aL as useFileReference, aM as useFileReferenceForRecord, aI as useFileUpload, aV as useIsPublicPage, aR as usePublicPageContext, aU as usePublicPageProviderContext, aH as useStorage } from './PublicLoadingSpinner-BKNBT6b6.js';
3
3
  export { u as useToast } from './useToast-Bm6TnSK-.js';
4
4
  export { D as DataTable, a as DataTableProps } from './DataTable-ntgmhO2W.js';
5
5
  export { A as AggregateConfig, D as DataRecord, f as DataTableAction, a as DataTableColumn, g as DataTableToolbarButton, E as EmptyStateConfig, G as GetRowId } from './types-CGX9Vyf5.js';
@@ -9,8 +9,6 @@ import { FieldValues, FieldPath, UseFormReturn } from 'react-hook-form';
9
9
  import { b as FileCategory } from './file-reference-9xUOnwyt.js';
10
10
  export { a as FileMetadata, F as FileReference, c as FileUploadOptions } from './file-reference-9xUOnwyt.js';
11
11
  import { SupabaseClient } from '@supabase/supabase-js';
12
- import './RBACProvider-BO4ilsQB.js';
13
- import './unified-CMPjE_fv.js';
14
12
  import '@radix-ui/react-label';
15
13
  import '@radix-ui/react-avatar';
16
14
  import '@radix-ui/react-checkbox';
@@ -20,7 +18,8 @@ import '@radix-ui/react-dialog';
20
18
  import '@radix-ui/react-toast';
21
19
  import '@radix-ui/react-tooltip';
22
20
  import 'zod';
23
- import './organisation-t-vvQC3g.js';
21
+ import './unified-CM7T0aTK.js';
22
+ import './organisation-BtshODVF.js';
24
23
  import '@tanstack/react-table';
25
24
 
26
25
  interface FormFieldProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> {
@@ -51,11 +51,12 @@ import {
51
51
  useFileUpload,
52
52
  usePublicPageContext as usePublicPageContext2,
53
53
  useStorage
54
- } from "./chunk-BYG6OSTC.js";
54
+ } from "./chunk-DAXLNIDY.js";
55
55
  import {
56
56
  Alert,
57
57
  AlertDescription,
58
58
  AlertTitle,
59
+ Button,
59
60
  Card,
60
61
  CardActions,
61
62
  CardContent,
@@ -65,6 +66,17 @@ import {
65
66
  CardTitle,
66
67
  Checkbox,
67
68
  DataTable,
69
+ Dialog,
70
+ DialogBody,
71
+ DialogClose,
72
+ DialogContent,
73
+ DialogDescription,
74
+ DialogFooter,
75
+ DialogHeader,
76
+ DialogOverlay,
77
+ DialogPortal,
78
+ DialogTitle,
79
+ DialogTrigger,
68
80
  Input,
69
81
  Select,
70
82
  SelectContent,
@@ -73,14 +85,18 @@ import {
73
85
  SelectLabel,
74
86
  SelectSeparator,
75
87
  SelectTrigger,
76
- SelectValue
77
- } from "./chunk-5A4RL4BC.js";
88
+ SelectValue,
89
+ Tooltip,
90
+ TooltipContent,
91
+ TooltipProvider,
92
+ TooltipRoot,
93
+ TooltipTrigger
94
+ } from "./chunk-CY3AHGO4.js";
78
95
  import {
79
96
  useRBAC
80
- } from "./chunk-2PRPDH66.js";
97
+ } from "./chunk-2CHATWBF.js";
81
98
  import "./chunk-FGMFQSHX.js";
82
99
  import "./chunk-B2WTCLCV.js";
83
- import "./chunk-F24P24TZ.js";
84
100
  import {
85
101
  DefaultPublicErrorFallback,
86
102
  PublicErrorBoundary,
@@ -89,33 +105,17 @@ import {
89
105
  useIsPublicPage,
90
106
  usePublicPageContext,
91
107
  useToast
92
- } from "./chunk-M4UMXYNK.js";
108
+ } from "./chunk-33PHABLB.js";
93
109
  import "./chunk-YNUBMSMV.js";
94
- import "./chunk-RJNE764D.js";
110
+ import "./chunk-LW7MMEAQ.js";
111
+ import {
112
+ init_UnifiedAuthProvider
113
+ } from "./chunk-URUTVZ7N.js";
114
+ import "./chunk-A4FUBC7B.js";
95
115
  import {
96
- Button,
97
- Dialog,
98
- DialogBody,
99
- DialogClose,
100
- DialogContent,
101
- DialogDescription,
102
- DialogFooter,
103
- DialogHeader,
104
- DialogOverlay,
105
- DialogPortal,
106
- DialogTitle,
107
- DialogTrigger,
108
- Tooltip,
109
- TooltipContent,
110
- TooltipProvider,
111
- TooltipRoot,
112
- TooltipTrigger,
113
116
  UnifiedAuthProvider,
114
- init_Dialog,
115
- init_Tooltip2 as init_Tooltip,
116
- init_UnifiedAuthProvider,
117
117
  useUnifiedAuth
118
- } from "./chunk-GBC5PC3N.js";
118
+ } from "./chunk-WN6XJWOS.js";
119
119
  import {
120
120
  FileCategory,
121
121
  init_file_reference
@@ -123,23 +123,18 @@ import {
123
123
  import {
124
124
  LoadingSpinner
125
125
  } from "./chunk-CDQ3PX7L.js";
126
+ import {
127
+ cn
128
+ } from "./chunk-PYUXFQJ3.js";
126
129
  import "./chunk-5BSLGBYI.js";
127
130
  import "./chunk-O3NWNXDY.js";
128
- import "./chunk-3SP4P7NS.js";
129
- import {
130
- cn,
131
- init_cn
132
- } from "./chunk-CDDYJCYU.js";
133
- import "./chunk-SMJZMKYN.js";
131
+ import "./chunk-XLZ7U46Z.js";
134
132
  import "./chunk-PLDDJCW6.js";
135
133
 
136
134
  // src/components/index.ts
137
135
  init_UnifiedAuthProvider();
138
- init_Dialog();
139
- init_Tooltip();
140
136
 
141
137
  // src/components/Form/FormField.tsx
142
- init_cn();
143
138
  import { useFormContext, Controller } from "react-hook-form";
144
139
  import { jsx, jsxs } from "react/jsx-runtime";
145
140
  function FormField({
@@ -214,7 +209,6 @@ function FormErrorSummary({
214
209
  }
215
210
 
216
211
  // src/components/Form/FormLiveRegion.tsx
217
- init_cn();
218
212
  import { useEffect, useState } from "react";
219
213
  import { Fragment, jsx as jsx3 } from "react/jsx-runtime";
220
214
  function FormLiveRegion({
@@ -298,7 +292,6 @@ function FormLiveRegion({
298
292
  }
299
293
 
300
294
  // src/components/Form/FormFieldset.tsx
301
- init_cn();
302
295
  import React2 from "react";
303
296
  import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
304
297
  var FormFieldset = React2.forwardRef(
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/index.ts","../src/components/Form/FormField.tsx","../src/components/Form/FormErrorSummary.tsx","../src/components/Form/FormLiveRegion.tsx","../src/components/Form/FormFieldset.tsx","../src/components/SuperAdminGuard.tsx","../src/components/FileUpload.tsx"],"sourcesContent":["/**\n * @file Complete Components Library Export\n * @package @jmruthers/pace-core\n * @module Components\n * @since 0.1.0\n * \n * This file exports ALL components, providers, and utilities in the PACE Core library.\n * Use this import path when you need access to specialized components not included in the main export.\n * \n * @example\n * // Complete library access\n * import { Dialog, NavigationMenu } from '@jmruthers/pace-core/components';\n * \n * // For common components, prefer the main export:\n * import { Button, Card } from '@jmruthers/pace-core';\n */\n\n// ============================================================================\n// AUTHENTICATION & AUTHORIZATION\n// ============================================================================\n\n// Unified auth provider (replaces individual providers)\nexport { UnifiedAuthProvider, useUnifiedAuth } from '../providers/UnifiedAuthProvider';\nexport type { UnifiedAuthProviderProps, UnifiedAuthContextType } from '../providers/UnifiedAuthProvider';\n\n// ============================================================================\n// BASIC UI COMPONENTS\n// ============================================================================\n\nexport { Button } from './Button';\nexport type { ButtonProps } from './Button';\n\nexport { \n Card, \n CardHeader, \n CardFooter, \n CardTitle, \n CardDescription, \n CardContent,\n CardActions\n} from './Card';\nexport type { CardProps, CardActionsProps } from './Card';\n\nexport { Input } from './Input';\nexport type { InputProps } from './Input';\nexport { Label } from './Label';\nexport type { LabelProps } from './Label';\n\nexport { Alert, AlertTitle, AlertDescription } from './Alert';\nexport { Avatar, AvatarImage, AvatarFallback } from './Avatar';\n\nexport { Checkbox } from './Checkbox';\nexport { Switch } from './Switch';\nexport type { SwitchProps } from './Switch';\nexport { Progress } from './Progress';\n\n// Table components\nexport {\n Table,\n TableHeader,\n TableBody,\n TableCaption,\n TableCell,\n TableFooter,\n TableHead,\n TableRow,\n} from './Table/Table';\n\n// ============================================================================\n// ADVANCED UI COMPONENTS\n// ============================================================================\n\n// Dialog exports\nexport {\n Dialog,\n DialogPortal,\n DialogOverlay,\n DialogTrigger,\n DialogClose,\n DialogContent,\n DialogHeader,\n DialogBody,\n DialogFooter,\n DialogTitle,\n DialogDescription,\n} from './Dialog/Dialog';\nexport type {\n DialogProps,\n DialogTriggerProps,\n DialogContentProps,\n DialogOverlayProps,\n DialogHeaderProps,\n DialogFooterProps,\n DialogTitleProps,\n DialogDescriptionProps,\n DialogSize\n} from './Dialog/Dialog';\n\n// Dropdown Menu exports\n// DropdownMenu components have been merged into Select components\n\n// Select exports (includes all dropdown functionality)\nexport {\n Select,\n SelectGroup,\n SelectValue,\n SelectTrigger,\n SelectContent,\n SelectLabel,\n SelectItem,\n SelectSeparator,\n} from './Select';\n\n// Toast exports\nexport {\n Toast,\n Toaster,\n ToastAction,\n ToastProvider,\n ToastViewport,\n ToastTitle,\n ToastDescription,\n ToastClose,\n} from './Toast';\nexport type { ToastActionElement, ToastProps } from './Toast';\n\n// Tooltip exports\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider, TooltipRoot } from './Tooltip';\n\n// ============================================================================\n// DATA DISPLAY COMPONENTS\n// ============================================================================\n\nexport {\n DataTable,\n type DataTableProps,\n type DataTableColumn,\n type DataTableAction,\n type DataTableToolbarButton,\n type AggregateConfig,\n type EmptyStateConfig,\n type GetRowId\n} from './DataTable';\n\n// Re-export types from DataTable types\nexport type { DataRecord } from './DataTable/types';\n\n// ============================================================================\n// FORM COMPONENTS\n// ============================================================================\n\nexport { \n Form, \n FormField, \n FormErrorSummary, \n FormLiveRegion, \n FormFieldset \n} from './Form';\nexport type { \n FormProps, \n FormFieldProps, \n FormErrorSummaryProps, \n FormLiveRegionProps, \n FormFieldsetProps \n} from './Form';\n\n// LoginForm - ensure it's exported\nexport { LoginForm } from './LoginForm';\nexport type { LoginFormProps } from './LoginForm';\n\n// ============================================================================\n// LAYOUT COMPONENTS\n// ============================================================================\n\nexport { Header } from './Header';\nexport { Footer } from './Footer';\nexport type { FooterProps } from './Footer';\n\n// Public Layout Components\nexport * from './PublicLayout';\n\n// ============================================================================\n// SECURITY COMPONENTS\n// ============================================================================\n\n// Super Admin Guard components\nexport { \n SuperAdminGuard, \n SuperAdminBadge, \n SuperAdminDebugPanel \n} from './SuperAdminGuard';\nexport type { SuperAdminGuardProps } from './SuperAdminGuard';\n\n// Removed: Protected and AdminGuard components (unused)\n\n// ============================================================================\n// NAVIGATION COMPONENTS\n// ============================================================================\n\nexport {\n NavigationMenu,\n} from './NavigationMenu';\nexport type { NavigationMenuProps, NavigationItem } from './NavigationMenu';\n\nexport { OrganisationSelector } from './OrganisationSelector';\nexport type { OrganisationSelectorProps } from './OrganisationSelector';\n\nexport { UserMenu } from './UserMenu';\n\n// Reusable Page/Layout Components\nexport * from './PaceAppLayout';\nexport * from './PaceLoginPage';\n\n// ============================================================================\n// UTILITY COMPONENTS\n// ============================================================================\n\nexport { ErrorBoundary } from './ErrorBoundary';\nexport type { ErrorBoundaryProps, ErrorBoundaryState } from './ErrorBoundary';\nexport { LoadingSpinner } from './LoadingSpinner';\n\n// ============================================================================\n// EVENT MANAGEMENT\n// ============================================================================\n\nexport { EventSelector } from './EventSelector';\n\n// ============================================================================\n// AUTHENTICATION FORMS\n// ============================================================================\n\n// Password Component exports\nexport { PasswordResetForm } from './PasswordReset';\n\n// ============================================================================\n// STORAGE COMPONENTS\n// ============================================================================\n\nexport { FileUpload } from './FileUpload';\nexport type { FileUploadProps } from './FileUpload';\n\nexport { FileDisplay } from './FileDisplay';\nexport type { FileDisplayProps } from './FileDisplay';\n\n\n// ============================================================================\n// TYPES\n// ============================================================================\n\nexport { FileCategory } from '../types/file-reference';\nexport type { FileReference, FileMetadata, FileUploadOptions } from '../types/file-reference';\n\n// ============================================================================\n// HOOKS\n// ============================================================================\n\nexport { useStorage, useFileUpload } from '../hooks/useStorage';\nexport type { UseStorageOptions, UseStorageReturn } from '../hooks/useStorage';\n\nexport { useFileReference, useFileReferenceForRecord } from '../hooks/useFileReference';\nexport type { UseFileReferenceOptions, UseFileReferenceReturn, UseFileReferenceForRecordReturn } from '../hooks/useFileReference';\n\nexport { useToast } from '../hooks/useToast';\n\n// RBAC Components - Use the new RBAC system\n// For RBAC functionality, import from @jmruthers/pace-core/rbac\n// export { PermissionGuard, AccessLevelGuard } from '@jmruthers/pace-core/rbac';\n","/**\n * @file FormField Component\n * @package @jmruthers/pace-core\n * @module Components/Form\n * @since 0.1.0\n *\n * A flexible form field component that integrates with React Hook Form and provides\n * built-in validation, error handling, and accessibility features.\n *\n * Features:\n * - React Hook Form integration with Controller\n * - Built-in validation with error display\n * - Accessible labels and error messages\n * - Custom render function support\n * - TypeScript support with generic field paths\n * - Consistent styling with error states\n * - Test ID support for testing\n * - Flexible input types and props\n *\n * @example\n * ```tsx\n * // Basic text field\n * <FormField\n * name=\"username\"\n * label=\"Username\"\n * placeholder=\"Enter your username\"\n * validation={{ required: true }}\n * />\n * \n * // Email field with custom validation\n * <FormField\n * name=\"email\"\n * label=\"Email Address\"\n * type=\"email\"\n * validation={{\n * required: true,\n * pattern: {\n * value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,}$/i,\n * message: \"Invalid email address\"\n * }\n * }}\n * />\n * \n * // Custom render function\n * <FormField\n * name=\"avatar\"\n * label=\"Profile Picture\"\n * render={({ field }) => (\n * <input\n * {...field}\n * type=\"file\"\n * accept=\"image/*\"\n * className=\"file:mr-4 file:py-2 file:px-4 file:rounded-full file:border-0 file:text-sm file:font-semibold file:bg-sec-50 file:text-sec-700 hover:file:bg-sec-100\"\n * />\n * )}\n * />\n * \n * // With test ID for testing\n * <FormField\n * name=\"password\"\n * label=\"Password\"\n * type=\"password\"\n * data-testid=\"password-field\"\n * validation={{\n * required: true,\n * minLength: {\n * value: 8,\n * message: \"Password must be at least 8 characters\"\n * }\n * }}\n * />\n * ```\n *\n * @accessibility\n * - Proper label association with htmlFor\n * - Error messages with role=\"alert\"\n * - Required field indicators\n * - Focus management\n * - Screen reader friendly error announcements\n * - Keyboard navigation support\n *\n * @dependencies\n * - react-hook-form - Form integration\n * - React 18+ - Hooks and context\n * - Tailwind CSS - Styling\n */\n\nimport React from 'react';\nimport { useFormContext, Controller, FieldPath, FieldValues } from 'react-hook-form';\nimport { cn } from '../../utils/cn';\nimport { Label } from '../Label';\n\nexport interface FormFieldProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n> {\n /**\n * Field name\n */\n name: TName;\n \n /**\n * Field label\n */\n label?: string;\n \n /**\n * Field type\n */\n type?: string;\n \n /**\n * Placeholder text\n */\n placeholder?: string;\n \n /**\n * Additional props for the input\n */\n inputProps?: React.InputHTMLAttributes<HTMLInputElement>;\n \n /**\n * Validation rules\n */\n validation?: {\n required?: boolean;\n pattern?: {\n value: RegExp;\n message: string;\n };\n minLength?: {\n value: number;\n message: string;\n };\n maxLength?: {\n value: number;\n message: string;\n };\n };\n \n /**\n * Custom render function\n */\n render?: ({ field }: { field: any }) => React.ReactElement;\n \n /**\n * Test ID\n */\n 'data-testid'?: string;\n \n /**\n * Class name\n */\n className?: string;\n}\n\n/**\n * FormField component for React Hook Form integration\n * \n * @template TFieldValues - The type of form field values\n * @template TName - The type of the field name (must be a valid field path)\n * @param props - Form field configuration and validation\n * @returns JSX.Element - The rendered form field with validation\n * \n * @example\n * ```tsx\n * <FormField\n * name=\"email\"\n * label=\"Email\"\n * type=\"email\"\n * validation={{\n * required: true,\n * pattern: {\n * value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,}$/i,\n * message: \"Please enter a valid email address\"\n * }\n * }}\n * />\n * ```\n */\nexport function FormField<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n>({\n name,\n label,\n type = \"text\",\n placeholder,\n inputProps,\n validation,\n render,\n 'data-testid': testId,\n className,\n}: FormFieldProps<TFieldValues, TName>) {\n const { control, formState: { errors } } = useFormContext<TFieldValues>();\n const fieldError = errors[name];\n\n // Safely extract error message\n const errorMessage = fieldError && typeof fieldError === 'object' && 'message' in fieldError \n ? String(fieldError.message) \n : undefined;\n\n return (\n <div className={cn(\"space-y-2\", className)}>\n {label && (\n <Label htmlFor={name}>\n {label}\n {validation?.required && (\n <span className=\"text-destructive ml-1\" aria-label=\"required\">\n *\n </span>\n )}\n </Label>\n )}\n \n <Controller\n name={name}\n control={control}\n rules={validation}\n render={({ field }) => {\n if (render) {\n return render({ field });\n }\n \n return (\n <input\n {...field}\n id={name}\n type={type}\n placeholder={placeholder}\n data-testid={testId}\n className={cn(\n \"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50\",\n fieldError && \"border-destructive focus-visible:ring-destructive\"\n )}\n {...inputProps}\n />\n );\n }}\n />\n \n {errorMessage && (\n <p className=\"text-destructive\" role=\"alert\">\n {errorMessage}\n </p>\n )}\n </div>\n );\n}\n","\n/**\n * @file FormErrorSummary Component\n * @package @jmruthers/pace-core\n * @module Components/Form\n * @since 0.1.0\n *\n * A form error summary component that displays validation errors in a user-friendly format.\n * Provides a centralized location for users to see all form errors at once.\n *\n * Features:\n * - Displays all form errors in one place\n * - Configurable error display format\n * - Optional field name display\n * - Accessible error presentation\n * - Consistent styling with Alert component\n * - Automatic error filtering\n * - Responsive design\n *\n * @example\n * ```tsx\n * // Basic error summary\n * <FormErrorSummary errors={formErrors} />\n * \n * // With custom title\n * <FormErrorSummary \n * errors={formErrors}\n * title=\"Please correct the following issues:\"\n * />\n * \n * // Show field names with errors\n * <FormErrorSummary \n * errors={formErrors}\n * showFieldNames={true}\n * />\n * \n * // In a form with React Hook Form\n * const { formState: { errors } } = useForm();\n * \n * <Form onSubmit={handleSubmit}>\n * <FormField name=\"email\" label=\"Email\" />\n * <FormField name=\"password\" label=\"Password\" />\n * <FormErrorSummary errors={errors} />\n * <Button type=\"submit\">Submit</Button>\n * </Form>\n * ```\n *\n * @accessibility\n * - Uses Alert component for consistent accessibility\n * - Proper heading hierarchy with h3\n * - List structure for error items\n * - Screen reader friendly error announcements\n * - High contrast support via Alert component\n *\n * @dependencies\n * - Alert component for consistent styling\n * - React 18+ - Component framework\n * - Tailwind CSS - Styling\n */\n\nimport { Alert } from '../Alert';\n\nexport interface FormErrorSummaryProps {\n /** Form validation errors object */\n errors?: Record<string, any>;\n /** Title displayed above the error list */\n title?: string;\n /** Whether to show field names alongside error messages */\n showFieldNames?: boolean;\n}\n\n/**\n * FormErrorSummary component for displaying form validation errors\n * \n * This component provides a user-friendly way to display all form errors\n * in one centralized location, improving the user experience by making\n * it clear what needs to be fixed.\n * \n * @param props - Component configuration\n * @param props.errors - Form validation errors object\n * @param props.title - Title displayed above the error list\n * @param props.showFieldNames - Whether to show field names with errors\n * @returns JSX.Element - The rendered error summary or null if no errors\n */\nexport function FormErrorSummary({ \n errors = {}, \n title = \"Please fix the following errors:\",\n showFieldNames = false \n}: FormErrorSummaryProps) {\n const errorEntries = Object.entries(errors).filter(([, value]) => Boolean(value));\n\n if (errorEntries.length === 0) {\n return null;\n }\n\n return (\n <Alert variant=\"destructive\" className=\"mb-4\">\n <div>\n <h3>{title}</h3>\n <ul className=\"list-disc list-inside space-y-1\">\n {errorEntries.map(([field, error], index) => {\n const message = typeof error === 'object' && error.message ? error.message : String(error);\n return (\n <li key={index} className=\"text-sm\">\n {showFieldNames ? `${field}: ${message}` : message}\n </li>\n );\n })}\n </ul>\n </div>\n </Alert>\n );\n}\n","/**\n * @file FormLiveRegion Component\n * @package @jmruthers/pace-core\n * @module Components/Form\n * @since 0.1.0\n *\n * An accessible live region component for form validation announcements.\n * Provides real-time feedback to screen readers about form validation states\n * and error messages, improving accessibility for users with assistive technologies.\n *\n * Features:\n * - Real-time form validation announcements\n * - Configurable politeness levels (polite/assertive)\n * - Customizable delay timing\n * - Field-level and form-level announcements\n * - Success message customization\n * - Automatic error counting and field identification\n * - Accessibility compliant with ARIA live regions\n * - Integration with React Hook Form\n *\n * @example\n * ```tsx\n * // Basic live region\n * const { control, formState } = useForm();\n * \n * <Form onSubmit={handleSubmit}>\n * <FormField name=\"email\" label=\"Email\" />\n * <FormField name=\"password\" label=\"Password\" />\n * <FormLiveRegion form={{ control, formState }} />\n * <Button type=\"submit\">Submit</Button>\n * </Form>\n * \n * // With custom configuration\n * <FormLiveRegion\n * form={{ control, formState }}\n * politeness=\"assertive\"\n * delay={1000}\n * successMessage=\"Your form was submitted successfully!\"\n * enableFieldAnnouncements={true}\n * />\n * \n * // In a complex form\n * function ComplexForm() {\n * const methods = useForm({\n * defaultValues: { name: '', email: '', message: '' }\n * });\n * \n * return (\n * <FormProvider {...methods}>\n * <form onSubmit={methods.handleSubmit(onSubmit)}>\n * <FormField name=\"name\" label=\"Name\" />\n * <FormField name=\"email\" label=\"Email\" />\n * <FormField name=\"message\" label=\"Message\" />\n * <FormLiveRegion \n * form={methods}\n * politeness=\"polite\"\n * delay={300}\n * />\n * <Button type=\"submit\">Send Message</Button>\n * </form>\n * </FormProvider>\n * );\n * }\n * ```\n *\n * @accessibility\n * - ARIA live region for screen reader announcements\n * - Configurable politeness levels for different message types\n * - Automatic error counting and field identification\n * - Non-intrusive validation feedback\n * - WCAG 2.1 AA compliant\n * - Screen reader friendly error announcements\n *\n * @dependencies\n * - react-hook-form - Form state management\n * - React 18+ - Hooks and effects\n * - Tailwind CSS - Styling\n */\n\nimport React, { useEffect, useState } from 'react';\nimport { UseFormReturn, FieldValues } from 'react-hook-form';\nimport { cn } from '../../utils/cn';\n\n/**\n * Props for the FormLiveRegion component\n */\nexport interface FormLiveRegionProps<T extends FieldValues> {\n /** React Hook Form instance */\n form: UseFormReturn<T>;\n /** ARIA live region politeness level */\n politeness?: 'polite' | 'assertive';\n /** Delay before announcing messages (in ms) */\n delay?: number;\n /** Custom success message */\n successMessage?: string;\n /** Custom class name */\n className?: string;\n /** Enable field-level validation announcements */\n enableFieldAnnouncements?: boolean;\n}\n\n/**\n * FormLiveRegion component for accessible form validation announcements\n */\nexport function FormLiveRegion<T extends FieldValues>({\n form,\n politeness = 'polite',\n delay = 500,\n successMessage = 'Form submitted successfully',\n className,\n enableFieldAnnouncements = true\n}: FormLiveRegionProps<T>): React.ReactElement {\n const [message, setMessage] = useState<string>('');\n const { formState } = form;\n\n // Handle form-level announcements\n useEffect(() => {\n let timeoutId: NodeJS.Timeout;\n\n if (formState.isSubmitting) {\n setMessage('Submitting form...');\n } else if (formState.isSubmitSuccessful) {\n timeoutId = setTimeout(() => {\n setMessage(successMessage);\n }, delay);\n } else if (formState.errors && Object.keys(formState.errors).length > 0) {\n const errorCount = Object.keys(formState.errors).length;\n const errorFields = Object.keys(formState.errors).join(', ');\n setMessage(`Form has ${errorCount} error${errorCount === 1 ? '' : 's'} in: ${errorFields}`);\n } else if (formState.isValid && formState.isDirty) {\n setMessage('Form is valid');\n } else {\n setMessage('');\n }\n\n return () => {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n };\n }, [formState, delay, successMessage]);\n\n // Handle field-level announcements\n useEffect(() => {\n if (!enableFieldAnnouncements) return;\n\n let timeoutId: NodeJS.Timeout;\n \n const fieldErrors = formState.errors;\n const touchedFields = formState.touchedFields;\n \n // Find newly touched fields with errors\n const newErrors = Object.keys(fieldErrors).filter(field => {\n // Type-safe access to touchedFields\n const touchedField = touchedFields as Record<string, boolean>;\n return touchedField[field] && fieldErrors[field as keyof typeof fieldErrors];\n });\n\n if (newErrors.length > 0) {\n timeoutId = setTimeout(() => {\n const errorField = newErrors[0];\n const errorData = fieldErrors[errorField as keyof typeof fieldErrors];\n const errorMessage = errorData?.message;\n if (errorMessage) {\n setMessage(`${errorField}: ${errorMessage}`);\n }\n }, delay);\n }\n\n return () => {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n };\n }, [formState.errors, formState.touchedFields, enableFieldAnnouncements, delay]);\n\n if (!message) {\n return <></>;\n }\n\n return (\n <div\n role=\"status\"\n aria-live={politeness}\n aria-atomic=\"true\"\n className={cn('sr-only', className)}\n style={{\n position: 'absolute',\n left: '-10000px',\n width: '1px',\n height: '1px',\n overflow: 'hidden'\n }}\n >\n {message}\n </div>\n );\n}\n","/**\n * @file FormFieldset Component\n * @package @jmruthers/pace-core\n * @module Components/Form\n * @since 0.1.0\n *\n * A form fieldset component that groups related form fields together with a legend\n * and optional description. Provides semantic structure and accessibility for form sections.\n *\n * Features:\n * - Semantic fieldset grouping for related form fields\n * - Accessible legend with required indicator\n * - Optional description text with proper ARIA association\n * - Consistent styling with design system\n * - Forwarded ref support\n * - Customizable styling via className\n * - Required field indication\n * - Responsive design\n *\n * @example\n * ```tsx\n * // Basic fieldset\n * <FormFieldset legend=\"Personal Information\">\n * <FormField name=\"firstName\" label=\"First Name\" />\n * <FormField name=\"lastName\" label=\"Last Name\" />\n * <FormField name=\"email\" label=\"Email\" />\n * </FormFieldset>\n * \n * // Fieldset with description\n * <FormFieldset \n * legend=\"Contact Details\" \n * description=\"We'll use this information to contact you about your order\"\n * >\n * <FormField name=\"phone\" label=\"Phone Number\" />\n * <FormField name=\"address\" label=\"Address\" />\n * </FormFieldset>\n * \n * // Required fieldset\n * <FormFieldset \n * legend=\"Account Settings\" \n * required={true}\n * description=\"These settings are required for account creation\"\n * >\n * <FormField name=\"username\" label=\"Username\" required />\n * <FormField name=\"password\" label=\"Password\" type=\"password\" required />\n * </FormFieldset>\n * \n * // With custom styling\n * <FormFieldset \n * legend=\"Preferences\"\n * className=\"bg-sec-50 border-sec-200\"\n * >\n * <FormField name=\"newsletter\" label=\"Subscribe to newsletter\" type=\"checkbox\" />\n * <FormField name=\"notifications\" label=\"Enable notifications\" type=\"checkbox\" />\n * </FormFieldset>\n * ```\n *\n * @accessibility\n * - Proper semantic HTML with fieldset and legend\n * - ARIA describedby association for descriptions\n * - Required field indication with asterisk\n * - Screen reader friendly structure\n * - Keyboard navigation support\n * - WCAG 2.1 AA compliant\n *\n * @dependencies\n * - React 18+ - Component framework and hooks\n * - Tailwind CSS - Styling\n * - cn utility - Class name merging\n */\n\nimport React from 'react';\nimport { cn } from '../../utils/cn';\n\nexport interface FormFieldsetProps extends React.FieldsetHTMLAttributes<HTMLFieldSetElement> {\n /** The legend text for the fieldset */\n legend: string;\n /** Optional description text below the legend */\n description?: string;\n /** Whether the fieldset contains required fields */\n required?: boolean;\n /** Form fields to group within the fieldset */\n children: React.ReactNode;\n}\n\n/**\n * FormFieldset component for grouping related form fields\n * \n * This component provides semantic grouping for form fields with proper\n * accessibility support and consistent styling. Use it to organize\n * related form inputs into logical sections.\n * \n * @param props - Component configuration\n * @param props.legend - The legend text for the fieldset\n * @param props.description - Optional description text\n * @param props.required - Whether the fieldset contains required fields\n * @param props.children - Form fields to group\n * @param ref - Forwarded ref to the fieldset element\n * @returns JSX.Element - The rendered fieldset with legend and fields\n */\nexport const FormFieldset = React.forwardRef<HTMLFieldSetElement, FormFieldsetProps>(\n ({ legend, description, required, className, children, ...props }, ref) => {\n const descriptionId = React.useId();\n \n return (\n <fieldset\n ref={ref}\n className={cn(\"space-y-4 border border-input rounded-lg p-4\", className)}\n aria-describedby={description ? descriptionId : undefined}\n {...props}\n >\n <legend className=\"px-2\">\n {legend}\n {required && <span className=\"text-destructive ml-1\">*</span>}\n </legend>\n {description && (\n <p id={descriptionId} className=\"text-muted-foreground\">\n {description}\n </p>\n )}\n {children}\n </fieldset>\n );\n }\n);\n\nFormFieldset.displayName = \"FormFieldset\";\n","/**\n * Super Admin Guard Component\n * @package @jmruthers/pace-core\n * @module Components/SuperAdminGuard\n * @since 1.0.0\n * \n * A reusable component for protecting content that should only be visible to super admins.\n */\n\nimport React from 'react';\nimport { useRBAC } from '../rbac/hooks/useRBAC';\n\nexport interface SuperAdminGuardProps {\n children: React.ReactNode;\n fallback?: React.ReactNode;\n showDebugInfo?: boolean;\n}\n\n/**\n * Super Admin Guard Component\n * \n * Renders children only if the current user is a super admin.\n * Provides a fallback for non-super admin users.\n * \n * @param children - Content to render for super admins\n * @param fallback - Content to render for non-super admins (optional)\n * @param showDebugInfo - Whether to show debug information (optional)\n */\nexport function SuperAdminGuard({ \n children, \n fallback = null, \n showDebugInfo = false \n}: SuperAdminGuardProps) {\n const { isSuperAdmin, hasGlobalPermission, isLoading } = useRBAC();\n\n // Show loading state\n if (isLoading) {\n return (\n <div className=\"super-admin-guard-loading\">\n <div className=\"loading-spinner\" />\n <span>Checking permissions...</span>\n </div>\n );\n }\n\n // Show debug info if enabled\n if (showDebugInfo) {\n console.log('[SuperAdminGuard] Debug Info:', {\n isSuperAdmin,\n isLoading\n });\n }\n\n // Render children for super admins\n if (isSuperAdmin) {\n return (\n <div className=\"super-admin-content\">\n {children}\n </div>\n );\n }\n\n // Render fallback for non-super admins\n return (\n <div className=\"super-admin-fallback\">\n {fallback}\n </div>\n );\n}\n\n/**\n * Super Admin Badge Component\n * \n * Shows a visual indicator when the current user is a super admin.\n */\nexport function SuperAdminBadge() {\n const { isSuperAdmin } = useRBAC();\n\n if (!isSuperAdmin) {\n return null;\n }\n\n return (\n <div className=\"super-admin-badge\">\n <span className=\"badge-text\">SUPER ADMIN</span>\n </div>\n );\n}\n\n/**\n * Super Admin Debug Panel\n * \n * Shows debug information about the current user's permissions.\n * Only visible to super admins and in development mode.\n */\nexport function SuperAdminDebugPanel() {\n const { isSuperAdmin, isLoading } = useRBAC();\n\n // Only show in development or for super admins\n if (import.meta.env.MODE !== 'development' && !isSuperAdmin) {\n return null;\n }\n\n return (\n <div className=\"super-admin-debug-panel\">\n <h4>Super Admin Debug Info</h4>\n <div className=\"debug-info\">\n <p><strong>Is Super Admin:</strong> {isSuperAdmin ? 'Yes' : 'No'}</p>\n <p><strong>Is Loading:</strong> {isLoading ? 'Yes' : 'No'}</p>\n <p><strong>Environment:</strong> {import.meta.env.MODE}</p>\n </div>\n </div>\n );\n}\n\nexport default SuperAdminGuard;\n","// File Upload Component\n// Provides a file upload interface using the file reference system\n\nimport React, { useState, useCallback, useRef } from 'react';\nimport { SupabaseClient } from '@supabase/supabase-js';\nimport { FileCategory } from '../types/file-reference';\nimport { useFileReference } from '../hooks/useFileReference';\n\nexport interface FileUploadProps {\n supabase: SupabaseClient;\n table_name: string;\n record_id: string;\n organisation_id: string;\n app_id: string;\n category: FileCategory;\n accept?: string;\n maxSize?: number;\n multiple?: boolean;\n disabled?: boolean;\n className?: string;\n onUploadSuccess?: (result: any) => void;\n onUploadError?: (error: string) => void;\n children?: React.ReactNode;\n}\n\nexport function FileUpload({\n supabase,\n table_name,\n record_id,\n organisation_id,\n app_id,\n category,\n accept = '*/*',\n maxSize = 10 * 1024 * 1024, // 10MB default\n multiple = false,\n disabled = false,\n className = '',\n onUploadSuccess,\n onUploadError,\n children\n}: FileUploadProps) {\n const [isDragging, setIsDragging] = useState(false);\n const fileInputRef = useRef<HTMLInputElement>(null);\n const { uploadFile, isLoading, error } = useFileReference(supabase);\n\n const handleFileSelect = useCallback(async (files: FileList | null) => {\n if (!files || files.length === 0) return;\n\n const fileArray = Array.from(files);\n \n // Validate file sizes\n const oversizedFiles = fileArray.filter(file => file.size > maxSize);\n if (oversizedFiles.length > 0) {\n const errorMessage = `Files exceed maximum size of ${Math.round(maxSize / 1024 / 1024)}MB: ${oversizedFiles.map(f => f.name).join(', ')}`;\n onUploadError?.(errorMessage);\n return;\n }\n\n // Upload files\n for (const file of fileArray) {\n try {\n const result = await uploadFile({\n table_name,\n record_id,\n organisation_id,\n app_id,\n category,\n is_public: false\n }, file);\n\n if (result) {\n onUploadSuccess?.(result);\n } else {\n onUploadError?.('Upload failed');\n }\n } catch (err) {\n const errorMessage = err instanceof Error ? err.message : 'Upload failed';\n onUploadError?.(errorMessage);\n }\n }\n }, [uploadFile, table_name, record_id, organisation_id, app_id, category, maxSize, onUploadSuccess, onUploadError]);\n\n const handleDragOver = useCallback((e: React.DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n if (!disabled) {\n setIsDragging(true);\n }\n }, [disabled]);\n\n const handleDragLeave = useCallback((e: React.DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n setIsDragging(false);\n }, []);\n\n const handleDrop = useCallback((e: React.DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n setIsDragging(false);\n \n if (disabled) return;\n \n const files = e.dataTransfer.files;\n handleFileSelect(files);\n }, [disabled, handleFileSelect]);\n\n const handleFileInputChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n handleFileSelect(e.target.files);\n // Reset input value to allow re-uploading the same file\n if (e.target) {\n e.target.value = '';\n }\n }, [handleFileSelect]);\n\n const handleClick = useCallback(() => {\n if (!disabled && fileInputRef.current) {\n fileInputRef.current.click();\n }\n }, [disabled]);\n\n const dragClasses = isDragging ? 'border-main-500 bg-main-50' : 'border-sec-300 hover:border-sec-400';\n const disabledClasses = disabled ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer hover:bg-sec-50';\n\n return (\n <div\n className={`relative border-2 border-dashed rounded-lg p-6 text-center transition-colors ${dragClasses} ${disabledClasses} ${className}`}\n onDragOver={handleDragOver}\n onDragLeave={handleDragLeave}\n onDrop={handleDrop}\n onClick={handleClick}\n >\n <input\n ref={fileInputRef}\n type=\"file\"\n accept={accept}\n multiple={multiple}\n onChange={handleFileInputChange}\n className=\"hidden\"\n disabled={disabled}\n />\n \n {children || (\n <div className=\"space-y-2\">\n <div className=\"text-sec-600\">\n {isDragging ? (\n 'Drop files here...'\n ) : (\n <>\n <span className=\"font-medium\">Click to upload</span>\n {' '}or drag and drop\n </>\n )}\n </div>\n <div className=\"text-sm text-sec-500\">\n {accept !== '*/*' && `Accepted formats: ${accept}`}\n {maxSize && ` • Max size: ${Math.round(maxSize / 1024 / 1024)}MB`}\n {multiple && ' • Multiple files allowed'}\n </div>\n </div>\n )}\n \n {isLoading && (\n <div className=\"absolute inset-0 bg-white bg-opacity-75 flex items-center justify-center\">\n <div className=\"animate-spin rounded-full h-8 w-8 border-b-2 border-main-500\"></div>\n </div>\n )}\n \n {error && (\n <div className=\"mt-2 text-sm text-acc-600\">\n {error}\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA;AAmDA;AAsDA;;;ACtCA;AADA,SAAS,gBAAgB,kBAA0C;AAqH3D,SAGI,KAHJ;AAzBD,SAAS,UAGd;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf;AACF,GAAwC;AACtC,QAAM,EAAE,SAAS,WAAW,EAAE,OAAO,EAAE,IAAI,eAA6B;AACxE,QAAM,aAAa,OAAO,IAAI;AAG9B,QAAM,eAAe,cAAc,OAAO,eAAe,YAAY,aAAa,aAC9E,OAAO,WAAW,OAAO,IACzB;AAEJ,SACE,qBAAC,SAAI,WAAW,GAAG,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F,GAAG,CAAC,QAAQ,CAAC;AAEb,QAAM,cAAc,aAAa,+BAA+B;AAChE,QAAM,kBAAkB,WAAW,kCAAkC;AAErE,SACE,gBAAAD;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,gFAAgF,WAAW,IAAI,eAAe,IAAI,SAAS;AAAA,MACtI,YAAY;AAAA,MACZ,aAAa;AAAA,MACb,QAAQ;AAAA,MACR,SAAS;AAAA,MAET;AAAA,wBAAAD;AAAA,UAAC;AAAA;AAAA,YACC,KAAK;AAAA,YACL,MAAK;AAAA,YACL;AAAA,YACA;AAAA,YACA,UAAU;AAAA,YACV,WAAU;AAAA,YACV;AAAA;AAAA,QACF;AAAA,QAEC,YACC,gBAAAC,MAAC,SAAI,WAAU,aACb;AAAA,0BAAAD,KAAC,SAAI,WAAU,gBACZ,uBACC,uBAEA,gBAAAC,MAAAF,WAAA,EACE;AAAA,4BAAAC,KAAC,UAAK,WAAU,eAAc,6BAAe;AAAA,YAC5C;AAAA,YAAI;AAAA,aACP,GAEJ;AAAA,UACA,gBAAAC,MAAC,SAAI,WAAU,wBACZ;AAAA,uBAAW,SAAS,qBAAqB,MAAM;AAAA,YAC/C,WAAW,qBAAgB,KAAK,MAAM,UAAU,OAAO,IAAI,CAAC;AAAA,YAC5D,YAAY;AAAA,aACf;AAAA,WACF;AAAA,QAGD,aACC,gBAAAD,KAAC,SAAI,WAAU,4EACb,0BAAAA,KAAC,SAAI,WAAU,gEAA+D,GAChF;AAAA,QAGD,SACC,gBAAAA,KAAC,SAAI,WAAU,6BACZ,iBACH;AAAA;AAAA;AAAA,EAEJ;AAEJ;;;AN0EA;","names":["jsx","jsxs","jsx","React","jsx","jsxs","jsx","jsxs","useState","Fragment","jsx","jsxs","useState"]}
1
+ {"version":3,"sources":["../src/components/index.ts","../src/components/Form/FormField.tsx","../src/components/Form/FormErrorSummary.tsx","../src/components/Form/FormLiveRegion.tsx","../src/components/Form/FormFieldset.tsx","../src/components/SuperAdminGuard.tsx","../src/components/FileUpload.tsx"],"sourcesContent":["/**\n * @file Complete Components Library Export\n * @package @jmruthers/pace-core\n * @module Components\n * @since 0.1.0\n * \n * This file exports ALL components, providers, and utilities in the PACE Core library.\n * Use this import path when you need access to specialized components not included in the main export.\n * \n * @example\n * // Complete library access\n * import { Dialog, NavigationMenu } from '@jmruthers/pace-core/components';\n * \n * // For common components, prefer the main export:\n * import { Button, Card } from '@jmruthers/pace-core';\n */\n\n// ============================================================================\n// AUTHENTICATION & AUTHORIZATION\n// ============================================================================\n\n// Unified auth provider (replaces individual providers)\nexport { UnifiedAuthProvider, useUnifiedAuth } from '../providers/UnifiedAuthProvider';\nexport type { UnifiedAuthProviderProps, UnifiedAuthContextType } from '../providers/UnifiedAuthProvider';\n\n// ============================================================================\n// BASIC UI COMPONENTS\n// ============================================================================\n\nexport { Button } from './Button';\nexport type { ButtonProps } from './Button';\n\nexport { \n Card, \n CardHeader, \n CardFooter, \n CardTitle, \n CardDescription, \n CardContent,\n CardActions\n} from './Card';\nexport type { CardProps, CardActionsProps } from './Card';\n\nexport { Input } from './Input';\nexport type { InputProps } from './Input';\nexport { Label } from './Label';\nexport type { LabelProps } from './Label';\n\nexport { Alert, AlertTitle, AlertDescription } from './Alert';\nexport { Avatar, AvatarImage, AvatarFallback } from './Avatar';\n\nexport { Checkbox } from './Checkbox';\nexport { Switch } from './Switch';\nexport type { SwitchProps } from './Switch';\nexport { Progress } from './Progress';\n\n// Table components\nexport {\n Table,\n TableHeader,\n TableBody,\n TableCaption,\n TableCell,\n TableFooter,\n TableHead,\n TableRow,\n} from './Table/Table';\n\n// ============================================================================\n// ADVANCED UI COMPONENTS\n// ============================================================================\n\n// Dialog exports\nexport {\n Dialog,\n DialogPortal,\n DialogOverlay,\n DialogTrigger,\n DialogClose,\n DialogContent,\n DialogHeader,\n DialogBody,\n DialogFooter,\n DialogTitle,\n DialogDescription,\n} from './Dialog/Dialog';\nexport type {\n DialogProps,\n DialogTriggerProps,\n DialogContentProps,\n DialogOverlayProps,\n DialogHeaderProps,\n DialogFooterProps,\n DialogTitleProps,\n DialogDescriptionProps,\n DialogSize\n} from './Dialog/Dialog';\n\n// Dropdown Menu exports\n// DropdownMenu components have been merged into Select components\n\n// Select exports (includes all dropdown functionality)\nexport {\n Select,\n SelectGroup,\n SelectValue,\n SelectTrigger,\n SelectContent,\n SelectLabel,\n SelectItem,\n SelectSeparator,\n} from './Select';\n\n// Toast exports\nexport {\n Toast,\n Toaster,\n ToastAction,\n ToastProvider,\n ToastViewport,\n ToastTitle,\n ToastDescription,\n ToastClose,\n} from './Toast';\nexport type { ToastActionElement, ToastProps } from './Toast';\n\n// Tooltip exports\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider, TooltipRoot } from './Tooltip';\n\n// ============================================================================\n// DATA DISPLAY COMPONENTS\n// ============================================================================\n\nexport {\n DataTable,\n type DataTableProps,\n type DataTableColumn,\n type DataTableAction,\n type DataTableToolbarButton,\n type AggregateConfig,\n type EmptyStateConfig,\n type GetRowId\n} from './DataTable';\n\n// Re-export types from DataTable types\nexport type { DataRecord } from './DataTable/types';\n\n// ============================================================================\n// FORM COMPONENTS\n// ============================================================================\n\nexport { \n Form, \n FormField, \n FormErrorSummary, \n FormLiveRegion, \n FormFieldset \n} from './Form';\nexport type { \n FormProps, \n FormFieldProps, \n FormErrorSummaryProps, \n FormLiveRegionProps, \n FormFieldsetProps \n} from './Form';\n\n// LoginForm - ensure it's exported\nexport { LoginForm } from './LoginForm';\nexport type { LoginFormProps } from './LoginForm';\n\n// ============================================================================\n// LAYOUT COMPONENTS\n// ============================================================================\n\nexport { Header } from './Header';\nexport { Footer } from './Footer';\nexport type { FooterProps } from './Footer';\n\n// Public Layout Components\nexport * from './PublicLayout';\n\n// ============================================================================\n// SECURITY COMPONENTS\n// ============================================================================\n\n// Super Admin Guard components\nexport { \n SuperAdminGuard, \n SuperAdminBadge, \n SuperAdminDebugPanel \n} from './SuperAdminGuard';\nexport type { SuperAdminGuardProps } from './SuperAdminGuard';\n\n// Removed: Protected and AdminGuard components (unused)\n\n// ============================================================================\n// NAVIGATION COMPONENTS\n// ============================================================================\n\nexport {\n NavigationMenu,\n} from './NavigationMenu';\nexport type { NavigationMenuProps, NavigationItem } from './NavigationMenu';\n\nexport { OrganisationSelector } from './OrganisationSelector';\nexport type { OrganisationSelectorProps } from './OrganisationSelector';\n\nexport { UserMenu } from './UserMenu';\n\n// Reusable Page/Layout Components\nexport * from './PaceAppLayout';\nexport * from './PaceLoginPage';\n\n// ============================================================================\n// UTILITY COMPONENTS\n// ============================================================================\n\nexport { ErrorBoundary } from './ErrorBoundary';\nexport type { ErrorBoundaryProps, ErrorBoundaryState } from './ErrorBoundary';\nexport { LoadingSpinner } from './LoadingSpinner';\n\n// ============================================================================\n// EVENT MANAGEMENT\n// ============================================================================\n\nexport { EventSelector } from './EventSelector';\n\n// ============================================================================\n// AUTHENTICATION FORMS\n// ============================================================================\n\n// Password Component exports\nexport { PasswordResetForm } from './PasswordReset';\n\n// ============================================================================\n// STORAGE COMPONENTS\n// ============================================================================\n\nexport { FileUpload } from './FileUpload';\nexport type { FileUploadProps } from './FileUpload';\n\nexport { FileDisplay } from './FileDisplay';\nexport type { FileDisplayProps } from './FileDisplay';\n\n\n// ============================================================================\n// TYPES\n// ============================================================================\n\nexport { FileCategory } from '../types/file-reference';\nexport type { FileReference, FileMetadata, FileUploadOptions } from '../types/file-reference';\n\n// ============================================================================\n// HOOKS\n// ============================================================================\n\nexport { useStorage, useFileUpload } from '../hooks/useStorage';\nexport type { UseStorageOptions, UseStorageReturn } from '../hooks/useStorage';\n\nexport { useFileReference, useFileReferenceForRecord } from '../hooks/useFileReference';\nexport type { UseFileReferenceOptions, UseFileReferenceReturn, UseFileReferenceForRecordReturn } from '../hooks/useFileReference';\n\nexport { useToast } from '../hooks/useToast';\n\n// RBAC Components - Use the new RBAC system\n// For RBAC functionality, import from @jmruthers/pace-core/rbac\n// export { PermissionGuard, AccessLevelGuard } from '@jmruthers/pace-core/rbac';\n","/**\n * @file FormField Component\n * @package @jmruthers/pace-core\n * @module Components/Form\n * @since 0.1.0\n *\n * A flexible form field component that integrates with React Hook Form and provides\n * built-in validation, error handling, and accessibility features.\n *\n * Features:\n * - React Hook Form integration with Controller\n * - Built-in validation with error display\n * - Accessible labels and error messages\n * - Custom render function support\n * - TypeScript support with generic field paths\n * - Consistent styling with error states\n * - Test ID support for testing\n * - Flexible input types and props\n *\n * @example\n * ```tsx\n * // Basic text field\n * <FormField\n * name=\"username\"\n * label=\"Username\"\n * placeholder=\"Enter your username\"\n * validation={{ required: true }}\n * />\n * \n * // Email field with custom validation\n * <FormField\n * name=\"email\"\n * label=\"Email Address\"\n * type=\"email\"\n * validation={{\n * required: true,\n * pattern: {\n * value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,}$/i,\n * message: \"Invalid email address\"\n * }\n * }}\n * />\n * \n * // Custom render function\n * <FormField\n * name=\"avatar\"\n * label=\"Profile Picture\"\n * render={({ field }) => (\n * <input\n * {...field}\n * type=\"file\"\n * accept=\"image/*\"\n * className=\"file:mr-4 file:py-2 file:px-4 file:rounded-full file:border-0 file:text-sm file:font-semibold file:bg-sec-50 file:text-sec-700 hover:file:bg-sec-100\"\n * />\n * )}\n * />\n * \n * // With test ID for testing\n * <FormField\n * name=\"password\"\n * label=\"Password\"\n * type=\"password\"\n * data-testid=\"password-field\"\n * validation={{\n * required: true,\n * minLength: {\n * value: 8,\n * message: \"Password must be at least 8 characters\"\n * }\n * }}\n * />\n * ```\n *\n * @accessibility\n * - Proper label association with htmlFor\n * - Error messages with role=\"alert\"\n * - Required field indicators\n * - Focus management\n * - Screen reader friendly error announcements\n * - Keyboard navigation support\n *\n * @dependencies\n * - react-hook-form - Form integration\n * - React 18+ - Hooks and context\n * - Tailwind CSS - Styling\n */\n\nimport React from 'react';\nimport { useFormContext, Controller, FieldPath, FieldValues } from 'react-hook-form';\nimport { cn } from '../../utils/cn';\nimport { Label } from '../Label';\n\nexport interface FormFieldProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n> {\n /**\n * Field name\n */\n name: TName;\n \n /**\n * Field label\n */\n label?: string;\n \n /**\n * Field type\n */\n type?: string;\n \n /**\n * Placeholder text\n */\n placeholder?: string;\n \n /**\n * Additional props for the input\n */\n inputProps?: React.InputHTMLAttributes<HTMLInputElement>;\n \n /**\n * Validation rules\n */\n validation?: {\n required?: boolean;\n pattern?: {\n value: RegExp;\n message: string;\n };\n minLength?: {\n value: number;\n message: string;\n };\n maxLength?: {\n value: number;\n message: string;\n };\n };\n \n /**\n * Custom render function\n */\n render?: ({ field }: { field: any }) => React.ReactElement;\n \n /**\n * Test ID\n */\n 'data-testid'?: string;\n \n /**\n * Class name\n */\n className?: string;\n}\n\n/**\n * FormField component for React Hook Form integration\n * \n * @template TFieldValues - The type of form field values\n * @template TName - The type of the field name (must be a valid field path)\n * @param props - Form field configuration and validation\n * @returns JSX.Element - The rendered form field with validation\n * \n * @example\n * ```tsx\n * <FormField\n * name=\"email\"\n * label=\"Email\"\n * type=\"email\"\n * validation={{\n * required: true,\n * pattern: {\n * value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,}$/i,\n * message: \"Please enter a valid email address\"\n * }\n * }}\n * />\n * ```\n */\nexport function FormField<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n>({\n name,\n label,\n type = \"text\",\n placeholder,\n inputProps,\n validation,\n render,\n 'data-testid': testId,\n className,\n}: FormFieldProps<TFieldValues, TName>) {\n const { control, formState: { errors } } = useFormContext<TFieldValues>();\n const fieldError = errors[name];\n\n // Safely extract error message\n const errorMessage = fieldError && typeof fieldError === 'object' && 'message' in fieldError \n ? String(fieldError.message) \n : undefined;\n\n return (\n <div className={cn(\"space-y-2\", className)}>\n {label && (\n <Label htmlFor={name}>\n {label}\n {validation?.required && (\n <span className=\"text-destructive ml-1\" aria-label=\"required\">\n *\n </span>\n )}\n </Label>\n )}\n \n <Controller\n name={name}\n control={control}\n rules={validation}\n render={({ field }) => {\n if (render) {\n return render({ field });\n }\n \n return (\n <input\n {...field}\n id={name}\n type={type}\n placeholder={placeholder}\n data-testid={testId}\n className={cn(\n \"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50\",\n fieldError && \"border-destructive focus-visible:ring-destructive\"\n )}\n {...inputProps}\n />\n );\n }}\n />\n \n {errorMessage && (\n <p className=\"text-destructive\" role=\"alert\">\n {errorMessage}\n </p>\n )}\n </div>\n );\n}\n","\n/**\n * @file FormErrorSummary Component\n * @package @jmruthers/pace-core\n * @module Components/Form\n * @since 0.1.0\n *\n * A form error summary component that displays validation errors in a user-friendly format.\n * Provides a centralized location for users to see all form errors at once.\n *\n * Features:\n * - Displays all form errors in one place\n * - Configurable error display format\n * - Optional field name display\n * - Accessible error presentation\n * - Consistent styling with Alert component\n * - Automatic error filtering\n * - Responsive design\n *\n * @example\n * ```tsx\n * // Basic error summary\n * <FormErrorSummary errors={formErrors} />\n * \n * // With custom title\n * <FormErrorSummary \n * errors={formErrors}\n * title=\"Please correct the following issues:\"\n * />\n * \n * // Show field names with errors\n * <FormErrorSummary \n * errors={formErrors}\n * showFieldNames={true}\n * />\n * \n * // In a form with React Hook Form\n * const { formState: { errors } } = useForm();\n * \n * <Form onSubmit={handleSubmit}>\n * <FormField name=\"email\" label=\"Email\" />\n * <FormField name=\"password\" label=\"Password\" />\n * <FormErrorSummary errors={errors} />\n * <Button type=\"submit\">Submit</Button>\n * </Form>\n * ```\n *\n * @accessibility\n * - Uses Alert component for consistent accessibility\n * - Proper heading hierarchy with h3\n * - List structure for error items\n * - Screen reader friendly error announcements\n * - High contrast support via Alert component\n *\n * @dependencies\n * - Alert component for consistent styling\n * - React 18+ - Component framework\n * - Tailwind CSS - Styling\n */\n\nimport { Alert } from '../Alert';\n\nexport interface FormErrorSummaryProps {\n /** Form validation errors object */\n errors?: Record<string, any>;\n /** Title displayed above the error list */\n title?: string;\n /** Whether to show field names alongside error messages */\n showFieldNames?: boolean;\n}\n\n/**\n * FormErrorSummary component for displaying form validation errors\n * \n * This component provides a user-friendly way to display all form errors\n * in one centralized location, improving the user experience by making\n * it clear what needs to be fixed.\n * \n * @param props - Component configuration\n * @param props.errors - Form validation errors object\n * @param props.title - Title displayed above the error list\n * @param props.showFieldNames - Whether to show field names with errors\n * @returns JSX.Element - The rendered error summary or null if no errors\n */\nexport function FormErrorSummary({ \n errors = {}, \n title = \"Please fix the following errors:\",\n showFieldNames = false \n}: FormErrorSummaryProps) {\n const errorEntries = Object.entries(errors).filter(([, value]) => Boolean(value));\n\n if (errorEntries.length === 0) {\n return null;\n }\n\n return (\n <Alert variant=\"destructive\" className=\"mb-4\">\n <div>\n <h3>{title}</h3>\n <ul className=\"list-disc list-inside space-y-1\">\n {errorEntries.map(([field, error], index) => {\n const message = typeof error === 'object' && error.message ? error.message : String(error);\n return (\n <li key={index} className=\"text-sm\">\n {showFieldNames ? `${field}: ${message}` : message}\n </li>\n );\n })}\n </ul>\n </div>\n </Alert>\n );\n}\n","/**\n * @file FormLiveRegion Component\n * @package @jmruthers/pace-core\n * @module Components/Form\n * @since 0.1.0\n *\n * An accessible live region component for form validation announcements.\n * Provides real-time feedback to screen readers about form validation states\n * and error messages, improving accessibility for users with assistive technologies.\n *\n * Features:\n * - Real-time form validation announcements\n * - Configurable politeness levels (polite/assertive)\n * - Customizable delay timing\n * - Field-level and form-level announcements\n * - Success message customization\n * - Automatic error counting and field identification\n * - Accessibility compliant with ARIA live regions\n * - Integration with React Hook Form\n *\n * @example\n * ```tsx\n * // Basic live region\n * const { control, formState } = useForm();\n * \n * <Form onSubmit={handleSubmit}>\n * <FormField name=\"email\" label=\"Email\" />\n * <FormField name=\"password\" label=\"Password\" />\n * <FormLiveRegion form={{ control, formState }} />\n * <Button type=\"submit\">Submit</Button>\n * </Form>\n * \n * // With custom configuration\n * <FormLiveRegion\n * form={{ control, formState }}\n * politeness=\"assertive\"\n * delay={1000}\n * successMessage=\"Your form was submitted successfully!\"\n * enableFieldAnnouncements={true}\n * />\n * \n * // In a complex form\n * function ComplexForm() {\n * const methods = useForm({\n * defaultValues: { name: '', email: '', message: '' }\n * });\n * \n * return (\n * <FormProvider {...methods}>\n * <form onSubmit={methods.handleSubmit(onSubmit)}>\n * <FormField name=\"name\" label=\"Name\" />\n * <FormField name=\"email\" label=\"Email\" />\n * <FormField name=\"message\" label=\"Message\" />\n * <FormLiveRegion \n * form={methods}\n * politeness=\"polite\"\n * delay={300}\n * />\n * <Button type=\"submit\">Send Message</Button>\n * </form>\n * </FormProvider>\n * );\n * }\n * ```\n *\n * @accessibility\n * - ARIA live region for screen reader announcements\n * - Configurable politeness levels for different message types\n * - Automatic error counting and field identification\n * - Non-intrusive validation feedback\n * - WCAG 2.1 AA compliant\n * - Screen reader friendly error announcements\n *\n * @dependencies\n * - react-hook-form - Form state management\n * - React 18+ - Hooks and effects\n * - Tailwind CSS - Styling\n */\n\nimport React, { useEffect, useState } from 'react';\nimport { UseFormReturn, FieldValues } from 'react-hook-form';\nimport { cn } from '../../utils/cn';\n\n/**\n * Props for the FormLiveRegion component\n */\nexport interface FormLiveRegionProps<T extends FieldValues> {\n /** React Hook Form instance */\n form: UseFormReturn<T>;\n /** ARIA live region politeness level */\n politeness?: 'polite' | 'assertive';\n /** Delay before announcing messages (in ms) */\n delay?: number;\n /** Custom success message */\n successMessage?: string;\n /** Custom class name */\n className?: string;\n /** Enable field-level validation announcements */\n enableFieldAnnouncements?: boolean;\n}\n\n/**\n * FormLiveRegion component for accessible form validation announcements\n */\nexport function FormLiveRegion<T extends FieldValues>({\n form,\n politeness = 'polite',\n delay = 500,\n successMessage = 'Form submitted successfully',\n className,\n enableFieldAnnouncements = true\n}: FormLiveRegionProps<T>): React.ReactElement {\n const [message, setMessage] = useState<string>('');\n const { formState } = form;\n\n // Handle form-level announcements\n useEffect(() => {\n let timeoutId: NodeJS.Timeout;\n\n if (formState.isSubmitting) {\n setMessage('Submitting form...');\n } else if (formState.isSubmitSuccessful) {\n timeoutId = setTimeout(() => {\n setMessage(successMessage);\n }, delay);\n } else if (formState.errors && Object.keys(formState.errors).length > 0) {\n const errorCount = Object.keys(formState.errors).length;\n const errorFields = Object.keys(formState.errors).join(', ');\n setMessage(`Form has ${errorCount} error${errorCount === 1 ? '' : 's'} in: ${errorFields}`);\n } else if (formState.isValid && formState.isDirty) {\n setMessage('Form is valid');\n } else {\n setMessage('');\n }\n\n return () => {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n };\n }, [formState, delay, successMessage]);\n\n // Handle field-level announcements\n useEffect(() => {\n if (!enableFieldAnnouncements) return;\n\n let timeoutId: NodeJS.Timeout;\n \n const fieldErrors = formState.errors;\n const touchedFields = formState.touchedFields;\n \n // Find newly touched fields with errors\n const newErrors = Object.keys(fieldErrors).filter(field => {\n // Type-safe access to touchedFields\n const touchedField = touchedFields as Record<string, boolean>;\n return touchedField[field] && fieldErrors[field as keyof typeof fieldErrors];\n });\n\n if (newErrors.length > 0) {\n timeoutId = setTimeout(() => {\n const errorField = newErrors[0];\n const errorData = fieldErrors[errorField as keyof typeof fieldErrors];\n const errorMessage = errorData?.message;\n if (errorMessage) {\n setMessage(`${errorField}: ${errorMessage}`);\n }\n }, delay);\n }\n\n return () => {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n };\n }, [formState.errors, formState.touchedFields, enableFieldAnnouncements, delay]);\n\n if (!message) {\n return <></>;\n }\n\n return (\n <div\n role=\"status\"\n aria-live={politeness}\n aria-atomic=\"true\"\n className={cn('sr-only', className)}\n style={{\n position: 'absolute',\n left: '-10000px',\n width: '1px',\n height: '1px',\n overflow: 'hidden'\n }}\n >\n {message}\n </div>\n );\n}\n","/**\n * @file FormFieldset Component\n * @package @jmruthers/pace-core\n * @module Components/Form\n * @since 0.1.0\n *\n * A form fieldset component that groups related form fields together with a legend\n * and optional description. Provides semantic structure and accessibility for form sections.\n *\n * Features:\n * - Semantic fieldset grouping for related form fields\n * - Accessible legend with required indicator\n * - Optional description text with proper ARIA association\n * - Consistent styling with design system\n * - Forwarded ref support\n * - Customizable styling via className\n * - Required field indication\n * - Responsive design\n *\n * @example\n * ```tsx\n * // Basic fieldset\n * <FormFieldset legend=\"Personal Information\">\n * <FormField name=\"firstName\" label=\"First Name\" />\n * <FormField name=\"lastName\" label=\"Last Name\" />\n * <FormField name=\"email\" label=\"Email\" />\n * </FormFieldset>\n * \n * // Fieldset with description\n * <FormFieldset \n * legend=\"Contact Details\" \n * description=\"We'll use this information to contact you about your order\"\n * >\n * <FormField name=\"phone\" label=\"Phone Number\" />\n * <FormField name=\"address\" label=\"Address\" />\n * </FormFieldset>\n * \n * // Required fieldset\n * <FormFieldset \n * legend=\"Account Settings\" \n * required={true}\n * description=\"These settings are required for account creation\"\n * >\n * <FormField name=\"username\" label=\"Username\" required />\n * <FormField name=\"password\" label=\"Password\" type=\"password\" required />\n * </FormFieldset>\n * \n * // With custom styling\n * <FormFieldset \n * legend=\"Preferences\"\n * className=\"bg-sec-50 border-sec-200\"\n * >\n * <FormField name=\"newsletter\" label=\"Subscribe to newsletter\" type=\"checkbox\" />\n * <FormField name=\"notifications\" label=\"Enable notifications\" type=\"checkbox\" />\n * </FormFieldset>\n * ```\n *\n * @accessibility\n * - Proper semantic HTML with fieldset and legend\n * - ARIA describedby association for descriptions\n * - Required field indication with asterisk\n * - Screen reader friendly structure\n * - Keyboard navigation support\n * - WCAG 2.1 AA compliant\n *\n * @dependencies\n * - React 18+ - Component framework and hooks\n * - Tailwind CSS - Styling\n * - cn utility - Class name merging\n */\n\nimport React from 'react';\nimport { cn } from '../../utils/cn';\n\nexport interface FormFieldsetProps extends React.FieldsetHTMLAttributes<HTMLFieldSetElement> {\n /** The legend text for the fieldset */\n legend: string;\n /** Optional description text below the legend */\n description?: string;\n /** Whether the fieldset contains required fields */\n required?: boolean;\n /** Form fields to group within the fieldset */\n children: React.ReactNode;\n}\n\n/**\n * FormFieldset component for grouping related form fields\n * \n * This component provides semantic grouping for form fields with proper\n * accessibility support and consistent styling. Use it to organize\n * related form inputs into logical sections.\n * \n * @param props - Component configuration\n * @param props.legend - The legend text for the fieldset\n * @param props.description - Optional description text\n * @param props.required - Whether the fieldset contains required fields\n * @param props.children - Form fields to group\n * @param ref - Forwarded ref to the fieldset element\n * @returns JSX.Element - The rendered fieldset with legend and fields\n */\nexport const FormFieldset = React.forwardRef<HTMLFieldSetElement, FormFieldsetProps>(\n ({ legend, description, required, className, children, ...props }, ref) => {\n const descriptionId = React.useId();\n \n return (\n <fieldset\n ref={ref}\n className={cn(\"space-y-4 border border-input rounded-lg p-4\", className)}\n aria-describedby={description ? descriptionId : undefined}\n {...props}\n >\n <legend className=\"px-2\">\n {legend}\n {required && <span className=\"text-destructive ml-1\">*</span>}\n </legend>\n {description && (\n <p id={descriptionId} className=\"text-muted-foreground\">\n {description}\n </p>\n )}\n {children}\n </fieldset>\n );\n }\n);\n\nFormFieldset.displayName = \"FormFieldset\";\n","/**\n * Super Admin Guard Component\n * @package @jmruthers/pace-core\n * @module Components/SuperAdminGuard\n * @since 1.0.0\n * \n * A reusable component for protecting content that should only be visible to super admins.\n */\n\nimport React from 'react';\nimport { useRBAC } from '../rbac/hooks/useRBAC';\n\nexport interface SuperAdminGuardProps {\n children: React.ReactNode;\n fallback?: React.ReactNode;\n showDebugInfo?: boolean;\n}\n\n/**\n * Super Admin Guard Component\n * \n * Renders children only if the current user is a super admin.\n * Provides a fallback for non-super admin users.\n * \n * @param children - Content to render for super admins\n * @param fallback - Content to render for non-super admins (optional)\n * @param showDebugInfo - Whether to show debug information (optional)\n */\nexport function SuperAdminGuard({ \n children, \n fallback = null, \n showDebugInfo = false \n}: SuperAdminGuardProps) {\n const { isSuperAdmin, hasGlobalPermission, isLoading } = useRBAC();\n\n // Show loading state\n if (isLoading) {\n return (\n <div className=\"super-admin-guard-loading\">\n <div className=\"loading-spinner\" />\n <span>Checking permissions...</span>\n </div>\n );\n }\n\n // Show debug info if enabled\n if (showDebugInfo) {\n console.log('[SuperAdminGuard] Debug Info:', {\n isSuperAdmin,\n isLoading\n });\n }\n\n // Render children for super admins\n if (isSuperAdmin) {\n return (\n <div className=\"super-admin-content\">\n {children}\n </div>\n );\n }\n\n // Render fallback for non-super admins\n return (\n <div className=\"super-admin-fallback\">\n {fallback}\n </div>\n );\n}\n\n/**\n * Super Admin Badge Component\n * \n * Shows a visual indicator when the current user is a super admin.\n */\nexport function SuperAdminBadge() {\n const { isSuperAdmin } = useRBAC();\n\n if (!isSuperAdmin) {\n return null;\n }\n\n return (\n <div className=\"super-admin-badge\">\n <span className=\"badge-text\">SUPER ADMIN</span>\n </div>\n );\n}\n\n/**\n * Super Admin Debug Panel\n * \n * Shows debug information about the current user's permissions.\n * Only visible to super admins and in development mode.\n */\nexport function SuperAdminDebugPanel() {\n const { isSuperAdmin, isLoading } = useRBAC();\n\n // Only show in development or for super admins\n if (import.meta.env.MODE !== 'development' && !isSuperAdmin) {\n return null;\n }\n\n return (\n <div className=\"super-admin-debug-panel\">\n <h4>Super Admin Debug Info</h4>\n <div className=\"debug-info\">\n <p><strong>Is Super Admin:</strong> {isSuperAdmin ? 'Yes' : 'No'}</p>\n <p><strong>Is Loading:</strong> {isLoading ? 'Yes' : 'No'}</p>\n <p><strong>Environment:</strong> {import.meta.env.MODE}</p>\n </div>\n </div>\n );\n}\n\nexport default SuperAdminGuard;\n","// File Upload Component\n// Provides a file upload interface using the file reference system\n\nimport React, { useState, useCallback, useRef } from 'react';\nimport { SupabaseClient } from '@supabase/supabase-js';\nimport { FileCategory } from '../types/file-reference';\nimport { useFileReference } from '../hooks/useFileReference';\n\nexport interface FileUploadProps {\n supabase: SupabaseClient;\n table_name: string;\n record_id: string;\n organisation_id: string;\n app_id: string;\n category: FileCategory;\n accept?: string;\n maxSize?: number;\n multiple?: boolean;\n disabled?: boolean;\n className?: string;\n onUploadSuccess?: (result: any) => void;\n onUploadError?: (error: string) => void;\n children?: React.ReactNode;\n}\n\nexport function FileUpload({\n supabase,\n table_name,\n record_id,\n organisation_id,\n app_id,\n category,\n accept = '*/*',\n maxSize = 10 * 1024 * 1024, // 10MB default\n multiple = false,\n disabled = false,\n className = '',\n onUploadSuccess,\n onUploadError,\n children\n}: FileUploadProps) {\n const [isDragging, setIsDragging] = useState(false);\n const fileInputRef = useRef<HTMLInputElement>(null);\n const { uploadFile, isLoading, error } = useFileReference(supabase);\n\n const handleFileSelect = useCallback(async (files: FileList | null) => {\n if (!files || files.length === 0) return;\n\n const fileArray = Array.from(files);\n \n // Validate file sizes\n const oversizedFiles = fileArray.filter(file => file.size > maxSize);\n if (oversizedFiles.length > 0) {\n const errorMessage = `Files exceed maximum size of ${Math.round(maxSize / 1024 / 1024)}MB: ${oversizedFiles.map(f => f.name).join(', ')}`;\n onUploadError?.(errorMessage);\n return;\n }\n\n // Upload files\n for (const file of fileArray) {\n try {\n const result = await uploadFile({\n table_name,\n record_id,\n organisation_id,\n app_id,\n category,\n is_public: false\n }, file);\n\n if (result) {\n onUploadSuccess?.(result);\n } else {\n onUploadError?.('Upload failed');\n }\n } catch (err) {\n const errorMessage = err instanceof Error ? err.message : 'Upload failed';\n onUploadError?.(errorMessage);\n }\n }\n }, [uploadFile, table_name, record_id, organisation_id, app_id, category, maxSize, onUploadSuccess, onUploadError]);\n\n const handleDragOver = useCallback((e: React.DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n if (!disabled) {\n setIsDragging(true);\n }\n }, [disabled]);\n\n const handleDragLeave = useCallback((e: React.DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n setIsDragging(false);\n }, []);\n\n const handleDrop = useCallback((e: React.DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n setIsDragging(false);\n \n if (disabled) return;\n \n const files = e.dataTransfer.files;\n handleFileSelect(files);\n }, [disabled, handleFileSelect]);\n\n const handleFileInputChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n handleFileSelect(e.target.files);\n // Reset input value to allow re-uploading the same file\n if (e.target) {\n e.target.value = '';\n }\n }, [handleFileSelect]);\n\n const handleClick = useCallback(() => {\n if (!disabled && fileInputRef.current) {\n fileInputRef.current.click();\n }\n }, [disabled]);\n\n const dragClasses = isDragging ? 'border-main-500 bg-main-50' : 'border-sec-300 hover:border-sec-400';\n const disabledClasses = disabled ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer hover:bg-sec-50';\n\n return (\n <div\n className={`relative border-2 border-dashed rounded-lg p-6 text-center transition-colors ${dragClasses} ${disabledClasses} ${className}`}\n onDragOver={handleDragOver}\n onDragLeave={handleDragLeave}\n onDrop={handleDrop}\n onClick={handleClick}\n >\n <input\n ref={fileInputRef}\n type=\"file\"\n accept={accept}\n multiple={multiple}\n onChange={handleFileInputChange}\n className=\"hidden\"\n disabled={disabled}\n />\n \n {children || (\n <div className=\"space-y-2\">\n <div className=\"text-sec-600\">\n {isDragging ? (\n 'Drop files here...'\n ) : (\n <>\n <span className=\"font-medium\">Click to upload</span>\n {' '}or drag and drop\n </>\n )}\n </div>\n <div className=\"text-sm text-sec-500\">\n {accept !== '*/*' && `Accepted formats: ${accept}`}\n {maxSize && ` • Max size: ${Math.round(maxSize / 1024 / 1024)}MB`}\n {multiple && ' • Multiple files allowed'}\n </div>\n </div>\n )}\n \n {isLoading && (\n <div className=\"absolute inset-0 bg-white bg-opacity-75 flex items-center justify-center\">\n <div className=\"animate-spin rounded-full h-8 w-8 border-b-2 border-main-500\"></div>\n </div>\n )}\n \n {error && (\n <div className=\"mt-2 text-sm text-acc-600\">\n {error}\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,IAAI,CAAC;AAAA,YAC5D,YAAY;AAAA,aACf;AAAA,WACF;AAAA,QAGD,aACC,gBAAAD,KAAC,SAAI,WAAU,4EACb,0BAAAA,KAAC,SAAI,WAAU,gEAA+D,GAChF;AAAA,QAGD,SACC,gBAAAA,KAAC,SAAI,WAAU,6BACZ,iBACH;AAAA;AAAA;AAAA,EAEJ;AAEJ;;;AN0EA;","names":["jsx","jsxs","jsx","React","jsx","jsxs","React","jsx","jsxs","useState","Fragment","jsx","jsxs","useState"]}
package/dist/hooks.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  export { u as useToast } from './useToast-Bm6TnSK-.js';
2
- export { O as OrganisationSecurityHook, s as UseAppConfigReturn, r as UseOrganisationPermissionsReturn, p as UsePublicEventLogoOptions, o as UsePublicEventLogoReturn, n as UsePublicEventOptions, U as UsePublicEventReturn, q as UsePublicRouteParamsReturn, e as clearPublicEventCache, h as clearPublicLogoCache, m as extractEventCodeFromPath, l as generatePublicRoutePath, g as getPublicEventCacheStats, i as getPublicLogoCacheStats, b as useAppConfig, c as useEventTheme, u as useOrganisationPermissions, a as useOrganisationSecurity, d as usePublicEvent, k as usePublicEventCode, f as usePublicEventLogo, j as usePublicRouteParams } from './usePublicRouteParams-Ua1Vz-HG.js';
2
+ export { O as OrganisationSecurityHook, d as UseAppConfigReturn, U as UseOrganisationPermissionsReturn, r as UsePublicEventLogoOptions, q as UsePublicEventLogoReturn, p as UsePublicEventOptions, o as UsePublicEventReturn, s as UsePublicRouteParamsReturn, f as clearPublicEventCache, i as clearPublicLogoCache, n as extractEventCodeFromPath, m as generatePublicRoutePath, g as getPublicEventCacheStats, j as getPublicLogoCacheStats, c as useAppConfig, u as useEventTheme, a as useOrganisationPermissions, b as useOrganisationSecurity, e as usePublicEvent, l as usePublicEventCode, h as usePublicEventLogo, k as usePublicRouteParams } from './usePublicRouteParams-B-CumWRc.js';
3
3
  import * as React$1 from 'react';
4
4
  import { SortingState, ColumnFiltersState, ExpandedState } from '@tanstack/react-table';
5
5
  import * as react_hook_form from 'react-hook-form';
6
6
  import { z } from 'zod';
7
7
  export { u as useComponentPerformance } from './useComponentPerformance-DE9l5RkL.js';
8
8
  import { d as PaginationMode, D as DataRecord, P as PerformanceConfig, S as ServerSideConfig, C as ChunkingConfig, e as SearchIndexConfig, h as ServerSideParams, i as ServerSideResponse } from './types-CGX9Vyf5.js';
9
- import './organisation-t-vvQC3g.js';
10
- import './unified-CMPjE_fv.js';
9
+ import './organisation-BtshODVF.js';
10
+ import './unified-CM7T0aTK.js';
11
11
  import '@supabase/supabase-js';
12
12
  import './database-C3Szpi5J.js';
13
13
 
package/dist/hooks.js CHANGED
@@ -9,22 +9,24 @@ import {
9
9
  usePublicEvent,
10
10
  usePublicEventCode,
11
11
  usePublicRouteParams
12
- } from "./chunk-UC2BWIK7.js";
12
+ } from "./chunk-ZTT2AXMX.js";
13
13
  import {
14
14
  useSecureDataAccess
15
- } from "./chunk-LANO5IFV.js";
15
+ } from "./chunk-NTNILOBC.js";
16
16
  import {
17
17
  clearPublicLogoCache,
18
18
  getPublicLogoCacheStats,
19
19
  useAppConfig,
20
20
  usePublicEventLogo,
21
21
  useToast
22
- } from "./chunk-M4UMXYNK.js";
22
+ } from "./chunk-33PHABLB.js";
23
23
  import {
24
24
  useDataTablePerformance
25
25
  } from "./chunk-YNUBMSMV.js";
26
- import "./chunk-RJNE764D.js";
27
- import "./chunk-GBC5PC3N.js";
26
+ import "./chunk-LW7MMEAQ.js";
27
+ import "./chunk-URUTVZ7N.js";
28
+ import "./chunk-A4FUBC7B.js";
29
+ import "./chunk-WN6XJWOS.js";
28
30
  import "./chunk-ULBI5JGB.js";
29
31
  import {
30
32
  useComponentPerformance
@@ -33,9 +35,8 @@ import {
33
35
  PERFORMANCE_BUDGETS,
34
36
  performanceBudgetMonitor
35
37
  } from "./chunk-O3NWNXDY.js";
36
- import "./chunk-3SP4P7NS.js";
37
- import "./chunk-CDDYJCYU.js";
38
- import "./chunk-SMJZMKYN.js";
38
+ import "./chunk-XLZ7U46Z.js";
39
+ import "./chunk-A6HBIY5P.js";
39
40
  import "./chunk-PLDDJCW6.js";
40
41
 
41
42
  // src/hooks/useFocusManagement.ts