@jmruthers/pace-core 0.5.64 → 0.5.67

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 (131) hide show
  1. package/dist/{DataTable-7BER7PDS.js → DataTable-MFUXNGPR.js} +2 -2
  2. package/dist/{DataTable-D15XipLZ.d.ts → DataTable-ntgmhO2W.d.ts} +1 -1
  3. package/dist/{PublicLoadingSpinner-CXJ-W9wZ.d.ts → PublicLoadingSpinner-DdKXTkCZ.d.ts} +94 -1
  4. package/dist/{chunk-S66AJVI2.js → chunk-4HQ5BOVZ.js} +97 -27
  5. package/dist/chunk-4HQ5BOVZ.js.map +1 -0
  6. package/dist/{chunk-2LPYEFXI.js → chunk-ZB6AEA7I.js} +309 -261
  7. package/dist/chunk-ZB6AEA7I.js.map +1 -0
  8. package/dist/components.d.ts +4 -3
  9. package/dist/components.js +4 -2
  10. package/dist/components.js.map +1 -1
  11. package/dist/hooks.d.ts +1 -1
  12. package/dist/index.d.ts +6 -5
  13. package/dist/index.js +4 -2
  14. package/dist/index.js.map +1 -1
  15. package/dist/{types-E5WSpEtz.d.ts → types-CGX9Vyf5.d.ts} +8 -0
  16. package/dist/types.js.map +1 -1
  17. package/dist/utils.d.ts +2 -2
  18. package/dist/utils.js +1 -1
  19. package/docs/api/classes/ColumnFactory.md +6 -6
  20. package/docs/api/classes/ErrorBoundary.md +1 -1
  21. package/docs/api/classes/InvalidScopeError.md +1 -1
  22. package/docs/api/classes/MissingUserContextError.md +1 -1
  23. package/docs/api/classes/OrganisationContextRequiredError.md +1 -1
  24. package/docs/api/classes/PermissionDeniedError.md +1 -1
  25. package/docs/api/classes/PublicErrorBoundary.md +1 -1
  26. package/docs/api/classes/RBACAuditManager.md +1 -1
  27. package/docs/api/classes/RBACCache.md +1 -1
  28. package/docs/api/classes/RBACEngine.md +1 -1
  29. package/docs/api/classes/RBACError.md +1 -1
  30. package/docs/api/classes/RBACNotInitializedError.md +1 -1
  31. package/docs/api/classes/SecureSupabaseClient.md +1 -1
  32. package/docs/api/classes/StorageUtils.md +1 -1
  33. package/docs/api/interfaces/AggregateConfig.md +4 -4
  34. package/docs/api/interfaces/ButtonProps.md +1 -1
  35. package/docs/api/interfaces/CardProps.md +1 -1
  36. package/docs/api/interfaces/ColorPalette.md +1 -1
  37. package/docs/api/interfaces/ColorShade.md +1 -1
  38. package/docs/api/interfaces/DataAccessRecord.md +1 -1
  39. package/docs/api/interfaces/DataTableAction.md +14 -14
  40. package/docs/api/interfaces/DataTableColumn.md +21 -21
  41. package/docs/api/interfaces/DataTableProps.md +1 -1
  42. package/docs/api/interfaces/DataTableToolbarButton.md +7 -7
  43. package/docs/api/interfaces/EmptyStateConfig.md +5 -5
  44. package/docs/api/interfaces/EnhancedNavigationMenuProps.md +1 -1
  45. package/docs/api/interfaces/EventContextType.md +1 -1
  46. package/docs/api/interfaces/EventLogoProps.md +1 -1
  47. package/docs/api/interfaces/EventProviderProps.md +1 -1
  48. package/docs/api/interfaces/FileSizeLimits.md +1 -1
  49. package/docs/api/interfaces/FileUploadProps.md +1 -1
  50. package/docs/api/interfaces/FooterProps.md +1 -1
  51. package/docs/api/interfaces/InactivityWarningModalProps.md +1 -1
  52. package/docs/api/interfaces/InputProps.md +1 -1
  53. package/docs/api/interfaces/LabelProps.md +1 -1
  54. package/docs/api/interfaces/LoginFormProps.md +1 -1
  55. package/docs/api/interfaces/NavigationAccessRecord.md +1 -1
  56. package/docs/api/interfaces/NavigationContextType.md +1 -1
  57. package/docs/api/interfaces/NavigationGuardProps.md +1 -1
  58. package/docs/api/interfaces/NavigationItem.md +1 -1
  59. package/docs/api/interfaces/NavigationMenuProps.md +1 -1
  60. package/docs/api/interfaces/NavigationProviderProps.md +1 -1
  61. package/docs/api/interfaces/Organisation.md +1 -1
  62. package/docs/api/interfaces/OrganisationContextType.md +1 -1
  63. package/docs/api/interfaces/OrganisationMembership.md +1 -1
  64. package/docs/api/interfaces/OrganisationProviderProps.md +1 -1
  65. package/docs/api/interfaces/OrganisationSecurityError.md +1 -1
  66. package/docs/api/interfaces/PaceAppLayoutProps.md +1 -1
  67. package/docs/api/interfaces/PaceLoginPageProps.md +1 -1
  68. package/docs/api/interfaces/PageAccessRecord.md +1 -1
  69. package/docs/api/interfaces/PagePermissionContextType.md +1 -1
  70. package/docs/api/interfaces/PagePermissionGuardProps.md +1 -1
  71. package/docs/api/interfaces/PagePermissionProviderProps.md +1 -1
  72. package/docs/api/interfaces/PaletteData.md +1 -1
  73. package/docs/api/interfaces/PermissionEnforcerProps.md +1 -1
  74. package/docs/api/interfaces/PublicErrorBoundaryProps.md +1 -1
  75. package/docs/api/interfaces/PublicErrorBoundaryState.md +1 -1
  76. package/docs/api/interfaces/PublicLoadingSpinnerProps.md +1 -1
  77. package/docs/api/interfaces/PublicPageFooterProps.md +1 -1
  78. package/docs/api/interfaces/PublicPageHeaderProps.md +1 -1
  79. package/docs/api/interfaces/PublicPageLayoutProps.md +1 -1
  80. package/docs/api/interfaces/RBACConfig.md +1 -1
  81. package/docs/api/interfaces/RBACContextType.md +1 -1
  82. package/docs/api/interfaces/RBACLogger.md +1 -1
  83. package/docs/api/interfaces/RBACProviderProps.md +1 -1
  84. package/docs/api/interfaces/RoleBasedRouterContextType.md +1 -1
  85. package/docs/api/interfaces/RoleBasedRouterProps.md +1 -1
  86. package/docs/api/interfaces/RouteAccessRecord.md +1 -1
  87. package/docs/api/interfaces/RouteConfig.md +1 -1
  88. package/docs/api/interfaces/SecureDataContextType.md +1 -1
  89. package/docs/api/interfaces/SecureDataProviderProps.md +1 -1
  90. package/docs/api/interfaces/StorageConfig.md +1 -1
  91. package/docs/api/interfaces/StorageFileInfo.md +1 -1
  92. package/docs/api/interfaces/StorageFileMetadata.md +1 -1
  93. package/docs/api/interfaces/StorageListOptions.md +1 -1
  94. package/docs/api/interfaces/StorageListResult.md +1 -1
  95. package/docs/api/interfaces/StorageUploadOptions.md +1 -1
  96. package/docs/api/interfaces/StorageUploadResult.md +1 -1
  97. package/docs/api/interfaces/StorageUrlOptions.md +1 -1
  98. package/docs/api/interfaces/StyleImport.md +1 -1
  99. package/docs/api/interfaces/SwitchProps.md +34 -0
  100. package/docs/api/interfaces/ToastActionElement.md +1 -1
  101. package/docs/api/interfaces/ToastProps.md +1 -1
  102. package/docs/api/interfaces/UnifiedAuthContextType.md +1 -1
  103. package/docs/api/interfaces/UnifiedAuthProviderProps.md +1 -1
  104. package/docs/api/interfaces/UseInactivityTrackerOptions.md +1 -1
  105. package/docs/api/interfaces/UseInactivityTrackerReturn.md +1 -1
  106. package/docs/api/interfaces/UsePublicEventLogoOptions.md +1 -1
  107. package/docs/api/interfaces/UsePublicEventLogoReturn.md +1 -1
  108. package/docs/api/interfaces/UsePublicEventOptions.md +1 -1
  109. package/docs/api/interfaces/UsePublicEventReturn.md +1 -1
  110. package/docs/api/interfaces/UsePublicRouteParamsReturn.md +1 -1
  111. package/docs/api/interfaces/UserEventAccess.md +1 -1
  112. package/docs/api/interfaces/UserMenuProps.md +1 -1
  113. package/docs/api/interfaces/UserProfile.md +1 -1
  114. package/docs/api/modules.md +38 -4
  115. package/package.json +2 -1
  116. package/src/components/DataTable/components/DataTableBody.tsx +27 -11
  117. package/src/components/DataTable/components/DataTableCore.tsx +13 -13
  118. package/src/components/DataTable/components/EditableRow.tsx +46 -28
  119. package/src/components/DataTable/components/UnifiedTableBody.tsx +86 -38
  120. package/src/components/DataTable/components/VirtualizedDataTable.tsx +5 -3
  121. package/src/components/DataTable/core/ColumnFactory.ts +4 -0
  122. package/src/components/DataTable/types.ts +10 -0
  123. package/src/components/Switch/Switch.test.tsx +438 -0
  124. package/src/components/Switch/Switch.tsx +140 -0
  125. package/src/components/Switch/index.ts +9 -0
  126. package/src/components/index.ts +2 -0
  127. package/src/index.ts +2 -0
  128. package/src/types/index.ts +2 -0
  129. package/dist/chunk-2LPYEFXI.js.map +0 -1
  130. package/dist/chunk-S66AJVI2.js.map +0 -1
  131. /package/dist/{DataTable-7BER7PDS.js.map → DataTable-MFUXNGPR.js.map} +0 -0
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/utils/secureDataAccess.ts","../src/components/FileUpload/FileUpload.tsx"],"sourcesContent":["/**\n * @file Complete Component Library Export\n * @package @jmruthers/pace-core\n * @module Core\n * @since 0.1.0\n * \n * This file exports the primary components, hooks, and utilities from the PACE Core library.\n * It is the main entry point for developers using the library.\n * \n * @example\n * // Import common components\n * import { Button, Card, useUnifiedAuth } from '@jmruthers/pace-core';\n * \n * // For specialized components, use the complete library import:\n * import { Dialog, NavigationMenu } from '@jmruthers/pace-core/components';\n */\n\n// AUTHENTICATION & AUTHORIZATION\nexport { UnifiedAuthProvider, useUnifiedAuth } from './providers/UnifiedAuthProvider';\nexport type { UnifiedAuthProviderProps, UnifiedAuthContextType, UserEventAccess } from './providers/UnifiedAuthProvider';\nexport { EventProvider, useEvents } from './providers/EventProvider';\nexport type { EventProviderProps, EventContextType } from './providers/EventProvider';\nexport { OrganisationProvider, useOrganisations } from './providers/OrganisationProvider';\nexport type { \n Organisation, \n OrganisationMembership, \n OrganisationContextType, \n OrganisationProviderProps,\n OrganisationSecurityError \n} from './types/organisation';\n\n// INACTIVITY TRACKING\nexport { InactivityWarningModal } from './components/InactivityWarningModal/InactivityWarningModal';\nexport type { InactivityWarningModalProps } from './components/InactivityWarningModal/InactivityWarningModal';\nexport { useInactivityTracker } from './hooks/useInactivityTracker';\nexport type { UseInactivityTrackerOptions, UseInactivityTrackerReturn } from './hooks/useInactivityTracker';\n\n// RBAC SYSTEM - Consolidated RBAC module\nexport * from './rbac';\n\n// BASIC UI COMPONENTS\nexport { Button } from './components/Button/Button';\nexport type { ButtonProps } from './components/Button/Button';\n\nexport { \n Card, \n CardHeader, \n CardFooter, \n CardTitle, \n CardDescription, \n CardContent,\n CardActions\n} from './components/Card/Card';\nexport type { CardProps } from './components/Card/Card';\n\nexport { Input } from './components/Input/Input';\nexport type { InputProps } from './components/Input/Input';\nexport { Label } from './components/Label/Label';\nexport type { LabelProps } from './components/Label/Label';\n\nexport { Alert, AlertTitle, AlertDescription } from './components/Alert/Alert';\nexport { Avatar, AvatarImage, AvatarFallback } from './components/Avatar/Avatar';\n\nexport { Checkbox } from './components/Checkbox/Checkbox';\nexport { Progress } from './components/Progress/Progress';\n\n// ADVANCED UI COMPONENTS\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 './components/Dialog/Dialog';\n\n// Dropdown Menu exports\n// DropdownMenu components have been merged into Select components\n\n// Select exports\nexport {\n Select,\n SelectGroup,\n SelectValue,\n SelectTrigger,\n SelectContent,\n SelectLabel,\n SelectItem,\n SelectSeparator,\n} from './components/Select';\n\n// Modal functionality is provided by Dialog components\n\nexport {\n Toast,\n Toaster,\n ToastAction,\n ToastProvider,\n ToastViewport,\n ToastTitle,\n ToastDescription,\n ToastClose,\n} from './components/Toast/Toast';\nexport { useToast } from './hooks/useToast';\nexport type { ToastActionElement, ToastProps } from './components/Toast/Toast';\n\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider, TooltipRoot } from './components/Tooltip/Tooltip';\n\n// DATA DISPLAY COMPONENTS\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 ColumnFactory\n} from './components/DataTable';\n\n// Re-export types from DataTable types\nexport type { DataRecord } from './components/DataTable/types';\n\n// FORM COMPONENTS\nexport { Form } from './components/Form/Form';\nexport { LoginForm } from './components/LoginForm/LoginForm';\nexport type { LoginFormProps } from './components/LoginForm/LoginForm';\n\n// LAYOUT COMPONENTS\nexport { Header } from './components/Header/Header';\nexport { Footer } from './components/Footer/Footer';\nexport type { FooterProps } from './components/Footer/Footer';\n\n// NAVIGATION COMPONENTS\nexport { NavigationMenu } from './components/NavigationMenu/NavigationMenu';\nexport type { NavigationMenuProps, NavigationItem } from './components/NavigationMenu/types';\nexport { UserMenu } from './components/UserMenu/UserMenu';\nexport type { UserMenuProps } from './components/UserMenu/UserMenu';\n\n// Reusable Page/Layout Components\nexport { PaceAppLayout } from './components/PaceAppLayout/PaceAppLayout';\nexport type { PaceAppLayoutProps } from './components/PaceAppLayout/PaceAppLayout';\nexport { PaceLoginPage } from './components/PaceLoginPage/PaceLoginPage';\nexport type { PaceLoginPageProps } from './components/PaceLoginPage/PaceLoginPage';\n\n// UTILITY COMPONENTS\nexport { ErrorBoundary } from './components/ErrorBoundary/ErrorBoundary';\nexport { LoadingSpinner } from './components/LoadingSpinner/LoadingSpinner';\n\n// EVENT MANAGEMENT\nexport { EventSelector } from './components/EventSelector/EventSelector';\n\n// ORGANISATION MANAGEMENT\nexport { OrganisationSelector } from './components/OrganisationSelector/OrganisationSelector';\nexport { useOrganisationPermissions } from './hooks/useOrganisationPermissions';\nexport { useOrganisationSecurity } from './hooks/useOrganisationSecurity';\nexport { createSecureDataAccess } from './utils/secureDataAccess';\n\n// TYPES\nexport type { UserProfile } from './types/organisation';\n\n// AUTHENTICATION FORMS\nexport { PasswordResetForm } from './components/PasswordReset/PasswordResetForm';\nexport { PasswordChangeForm } from './components/PasswordReset/PasswordChangeForm';\n\n// UTILS & HOOKS\nexport { useAppConfig } from './hooks/useAppConfig';\nexport { cn } from './utils/cn';\nexport { setAppConfig, getAppConfig, getCurrentAppName, getCurrentAppId } from './utils/appConfig';\n\n// FORMATTING UTILITIES\nexport { \n formatDate, \n formatCurrency, \n formatNumber,\n formatPercent,\n formatCompactNumber,\n formatFileSize\n} from './utils/formatting';\n\n// STORAGE UTILITIES\nexport { FileUpload } from './components/FileUpload/FileUpload';\nexport type { FileUploadProps } from './components/FileUpload/FileUpload';\nexport { useStorage, useFileUpload } from './hooks/useStorage';\nexport * from './utils/storage';\n\n// Table components\nexport {\n Table,\n TableHeader,\n TableBody,\n TableCaption,\n TableCell,\n TableFooter,\n TableHead,\n TableRow,\n} from './components/Table/Table';\n\n// STYLES\nexport * from './styles';\n\n// PUBLIC PAGES\nexport * from './hooks/public';\nexport * from './components/PublicLayout';\n","/**\n * @file Secure Data Access Utility\n * @package @jmruthers/pace-core\n * @module Utils/SecureDataAccess\n * @since 0.4.0\n *\n * Secure data access utilities that enforce organisation context for all database operations.\n * Prevents data leakage between organisations and ensures proper access validation.\n */\n\nimport type { SupabaseClient } from '@supabase/supabase-js';\n\n// Generic database record type\nexport interface DatabaseRecord {\n id: string;\n organisation_id: string;\n [key: string]: unknown;\n}\n\n// Generic data for insert/update operations\nexport interface DatabaseData {\n [key: string]: unknown;\n}\n\n// Generic filters for queries\nexport interface DatabaseFilters {\n [key: string]: unknown;\n}\n\n// Secure query options\nexport interface SecureQueryOptions {\n table: string;\n select: string;\n organisationId: string;\n filters?: DatabaseFilters;\n orderBy?: string;\n limit?: number;\n offset?: number;\n}\n\nexport interface SecureDataAccess {\n // Secure query methods\n secureQuery: <T extends DatabaseRecord = DatabaseRecord>(options: SecureQueryOptions) => Promise<T[]>;\n secureSingleQuery: <T extends DatabaseRecord = DatabaseRecord>(options: SecureQueryOptions) => Promise<T | null>;\n \n // Secure mutation methods\n secureInsert: <T extends DatabaseRecord = DatabaseRecord>(table: string, data: DatabaseData, organisationId: string) => Promise<T | null>;\n secureUpdate: <T extends DatabaseRecord = DatabaseRecord>(table: string, data: DatabaseData, filters: DatabaseFilters, organisationId: string) => Promise<T | null>;\n secureDelete: (table: string, filters: DatabaseFilters, organisationId: string) => Promise<boolean>;\n \n // Organisation-scoped queries\n queryByOrganisation: <T extends DatabaseRecord = DatabaseRecord>(table: string, select: string, organisationId: string, filters?: DatabaseFilters) => Promise<T[]>;\n \n // Validation helpers\n validateOrganisationContext: (organisationId: string) => void;\n ensureOrganisationColumn: (table: string) => boolean;\n}\n\nexport interface SecureQueryBuilder {\n table: string;\n select: string;\n organisationId: string;\n filters?: DatabaseFilters;\n orderBy?: string;\n limit?: number;\n offset?: number;\n}\n\n/**\n * Create a secure data access instance\n * @param supabase - Supabase client instance\n * @param organisationId - Current organisation context\n * @param isSuperAdmin - Whether user has super admin privileges\n * @returns Secure data access utilities\n */\nexport const createSecureDataAccess = (\n supabase: SupabaseClient,\n organisationId: string,\n isSuperAdmin: boolean = false\n): SecureDataAccess => {\n \n // Validate organisation context\n const validateOrganisationContext = (orgId: string): void => {\n if (!orgId) {\n throw new Error('Organisation context is required for secure data access');\n }\n \n if (!isSuperAdmin && !orgId) {\n throw new Error('Organisation context is mandatory for non-super admin users');\n }\n };\n\n // Check if table has organisation_id column\n const ensureOrganisationColumn = (table: string): boolean => {\n // This is a simplified check - in production you might want to cache this\n const tablesWithOrganisation = [\n 'event', 'organisation_settings',\n 'rbac_event_app_roles', 'rbac_organisation_roles',\n // SECURITY: Phase 2 additions - complete organisation table mapping\n 'organisation_audit_log', 'organisation_invitations', 'organisation_app_access',\n // SECURITY: Emergency additions for Phase 1 fixes\n 'cake_meal', 'cake_mealtype', 'pace_person', 'pace_member',\n // SECURITY: Phase 3A additions - medical and personal data\n 'medi_profile', 'medi_condition', 'medi_diet', 'medi_action_plan', 'medi_profile_versions',\n 'pace_consent', 'pace_contact', 'pace_id_documents', 'pace_qualifications',\n 'form_responses', 'form_response_values', 'forms',\n // SECURITY: Phase 3B additions - remaining critical tables\n 'invoice', 'line_item', 'credit_balance', 'payment_method',\n 'form_contexts', 'form_field_config', 'form_fields',\n 'cake_delivery', 'cake_diettype', 'cake_diner', 'cake_dish', 'cake_item', \n 'cake_logistics', 'cake_mealplan', 'cake_package', 'cake_recipe', 'cake_supplier', \n 'cake_supply', 'cake_unit', 'event_app_access', 'base_application', 'base_questions'\n ];\n \n return tablesWithOrganisation.includes(table);\n };\n\n // Build secure query with organisation context\n const buildSecureQuery = (options: SecureQueryBuilder) => {\n const { table, select, organisationId: orgId, filters, orderBy, limit, offset } = options;\n \n validateOrganisationContext(orgId);\n \n let query = supabase\n .from(table)\n .select(select);\n \n // Add organisation filter (unless super admin)\n if (!isSuperAdmin && ensureOrganisationColumn(table)) {\n query = query.eq('organisation_id', orgId);\n }\n \n // Add additional filters\n if (filters) {\n Object.entries(filters).forEach(([key, value]) => {\n if (value !== undefined && value !== null) {\n // Handle qualified column names (e.g., 'users.role')\n const columnName = key.includes('.') ? key.split('.').pop()! : key;\n query = query.eq(columnName, value);\n }\n });\n }\n \n // Add ordering\n if (orderBy) {\n // Only use the column name, not a qualified name\n const orderByColumn = orderBy.split('.').pop();\n if (orderByColumn) {\n query = query.order(orderByColumn);\n }\n }\n \n // Add pagination\n if (limit) {\n query = query.limit(limit);\n }\n \n if (offset) {\n query = query.range(offset, offset + (limit || 10) - 1);\n }\n \n return query;\n };\n\n // Secure query for multiple results\n const secureQuery = async <T extends DatabaseRecord = DatabaseRecord>(options: SecureQueryOptions): Promise<T[]> => {\n const { table, select, organisationId: orgId, filters, orderBy, limit, offset } = options;\n \n try {\n const query = buildSecureQuery({\n table,\n select,\n organisationId: orgId,\n filters,\n orderBy,\n limit,\n offset\n });\n \n const { data, error } = await query;\n \n if (error) {\n throw error;\n }\n \n // Ensure data is an array and not an error type\n if (Array.isArray(data)) {\n return data as unknown as T[];\n }\n \n return [];\n } catch (error) {\n throw error;\n }\n };\n\n // Secure query for single result\n const secureSingleQuery = async <T extends DatabaseRecord = DatabaseRecord>(options: SecureQueryOptions): Promise<T | null> => {\n const { table, select, organisationId: orgId, filters, orderBy, limit, offset } = options;\n \n try {\n const query = buildSecureQuery({\n table,\n select,\n organisationId: orgId,\n filters,\n orderBy,\n limit,\n offset\n });\n \n const { data, error } = await query.single();\n \n if (error) {\n if (error.code === 'PGRST116') {\n // No rows returned\n return null;\n }\n throw error;\n }\n \n // Ensure data is not an error type\n if (data && typeof data === 'object' && !('code' in data)) {\n return data as unknown as T;\n }\n \n return null;\n } catch (error) {\n throw error;\n }\n };\n\n // Secure insert with organisation context\n const secureInsert = async <T extends DatabaseRecord = DatabaseRecord>(\n table: string, \n data: DatabaseData, \n organisationId: string\n ): Promise<T | null> => {\n validateOrganisationContext(organisationId);\n \n try {\n const insertData = {\n ...data,\n organisation_id: organisationId\n };\n \n const { data: result, error } = await supabase\n .from(table)\n .insert(insertData)\n .select()\n .single();\n \n if (error) {\n throw error;\n }\n \n return result;\n } catch (error) {\n throw error;\n }\n };\n\n // Secure update with organisation context\n const secureUpdate = async <T extends DatabaseRecord = DatabaseRecord>(\n table: string, \n data: DatabaseData, \n filters: DatabaseFilters, \n organisationId: string\n ): Promise<T | null> => {\n validateOrganisationContext(organisationId);\n \n try {\n let query = supabase\n .from(table)\n .update(data);\n \n // Add organisation filter (unless super admin)\n if (!isSuperAdmin && ensureOrganisationColumn(table)) {\n query = query.eq('organisation_id', organisationId);\n }\n \n // Add additional filters\n if (filters) {\n Object.entries(filters).forEach(([key, value]) => {\n if (value !== undefined && value !== null) {\n query = query.eq(key, value);\n }\n });\n }\n \n const { data: result, error } = await query.select().single();\n \n if (error) {\n throw error;\n }\n \n return result;\n } catch (error) {\n throw error;\n }\n };\n\n // Secure delete with organisation context\n const secureDelete = async (\n table: string, \n filters: DatabaseFilters, \n organisationId: string\n ): Promise<boolean> => {\n validateOrganisationContext(organisationId);\n \n try {\n let query = supabase\n .from(table)\n .delete();\n \n // Add organisation filter (unless super admin)\n if (!isSuperAdmin && ensureOrganisationColumn(table)) {\n query = query.eq('organisation_id', organisationId);\n }\n \n // Add additional filters\n if (filters) {\n Object.entries(filters).forEach(([key, value]) => {\n if (value !== undefined && value !== null) {\n query = query.eq(key, value);\n }\n });\n }\n \n const { error } = await query;\n \n if (error) {\n throw error;\n }\n \n return true;\n } catch (error) {\n throw error;\n }\n };\n\n // Organisation-scoped query helper\n const queryByOrganisation = async <T extends DatabaseRecord = DatabaseRecord>(\n table: string, \n select: string, \n organisationId: string, \n filters?: DatabaseFilters\n ): Promise<T[]> => {\n return secureQuery<T>({\n table,\n select,\n organisationId,\n filters\n });\n };\n\n return {\n secureQuery,\n secureSingleQuery,\n secureInsert,\n secureUpdate,\n secureDelete,\n queryByOrganisation,\n validateOrganisationContext,\n ensureOrganisationColumn\n };\n};\n\n/**\n * Hook for secure data access\n * @returns Secure data access utilities\n */\nexport const useSecureDataAccess = (): SecureDataAccess => {\n // This would typically get the context from providers\n // For now, we'll create a placeholder that can be used with explicit parameters\n throw new Error('useSecureDataAccess must be used with explicit parameters. Use createSecureDataAccess instead.');\n}; ","/**\n * File upload component with app-segregated storage\n */\n\nimport React, { useCallback, useState } from 'react';\nimport { SupabaseClient } from '@supabase/supabase-js';\nimport { validateFileSize, formatFileSize } from '../../utils/storage';\nimport { useFileUpload } from '../../hooks/useStorage';\nimport { Button } from '../Button/Button';\nimport { Progress } from '../Progress/Progress';\nimport { Alert } from '../Alert/Alert';\n\nexport interface FileUploadProps {\n supabase: SupabaseClient;\n appName: string;\n orgId: string;\n onUploadComplete?: (result: { success: boolean; path?: string; error?: string }) => void;\n onUploadStart?: () => void;\n accept?: string;\n maxSize?: number;\n multiple?: boolean;\n disabled?: boolean;\n className?: string;\n children?: React.ReactNode;\n}\n\nexport function FileUpload({\n supabase,\n appName,\n orgId,\n onUploadComplete,\n onUploadStart,\n accept = '*/*',\n maxSize,\n multiple = false,\n disabled = false,\n className = '',\n children\n}: FileUploadProps) {\n const [dragActive, setDragActive] = useState(false);\n const [selectedFiles, setSelectedFiles] = useState<File[]>([]);\n const [validationErrors, setValidationErrors] = useState<string[]>([]);\n\n const { uploadWithProgress, uploadProgress, isUploading, uploadError } = useFileUpload({\n supabase,\n appName,\n orgId\n });\n\n // Validate files\n const validateFiles = useCallback((files: File[]): string[] => {\n const errors: string[] = [];\n\n files.forEach((file, index) => {\n // Check file size\n const sizeValidation = validateFileSize(file);\n if (!sizeValidation.isValid) {\n errors.push(`File ${index + 1}: ${sizeValidation.error}`);\n }\n\n // Check custom max size\n if (maxSize && file.size > maxSize) {\n const fileMB = Math.round(file.size / (1024 * 1024));\n const maxMB = Math.round(maxSize / (1024 * 1024));\n errors.push(`File ${index + 1}: Size (${fileMB}MB) exceeds limit (${maxMB}MB)`);\n }\n });\n\n return errors;\n }, [maxSize]);\n\n // Handle file selection\n const handleFileSelect = useCallback((files: FileList | null) => {\n if (!files) return;\n\n const fileArray = Array.from(files);\n const errors = validateFiles(fileArray);\n\n setValidationErrors(errors);\n setSelectedFiles(fileArray);\n }, [validateFiles]);\n\n // Handle drag events\n const handleDrag = useCallback((e: React.DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n if (e.type === 'dragenter' || e.type === 'dragover') {\n setDragActive(true);\n } else if (e.type === 'dragleave') {\n setDragActive(false);\n }\n }, []);\n\n const handleDrop = useCallback((e: React.DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n setDragActive(false);\n\n if (disabled) return;\n\n const files = e.dataTransfer.files;\n handleFileSelect(files);\n }, [disabled, handleFileSelect]);\n\n // Handle file input change\n const handleFileInputChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n handleFileSelect(e.target.files);\n }, [handleFileSelect]);\n\n // Handle upload\n const handleUpload = useCallback(async () => {\n if (selectedFiles.length === 0 || validationErrors.length > 0) return;\n\n onUploadStart?.();\n\n for (const file of selectedFiles) {\n const result = await uploadWithProgress(file);\n onUploadComplete?.(result);\n }\n\n // Reset selection\n setSelectedFiles([]);\n setValidationErrors([]);\n }, [selectedFiles, validationErrors, uploadWithProgress, onUploadComplete, onUploadStart]);\n\n // Handle clear\n const handleClear = useCallback(() => {\n setSelectedFiles([]);\n setValidationErrors([]);\n }, []);\n\n const canUpload = selectedFiles.length > 0 && validationErrors.length === 0 && !isUploading && !disabled;\n\n return (\n <div className={`file-upload ${className}`}>\n {/* Drop zone */}\n <div\n className={`file-upload__dropzone ${\n dragActive ? 'file-upload__dropzone--active' : ''\n } ${disabled ? 'file-upload__dropzone--disabled' : ''}`}\n onDragEnter={handleDrag}\n onDragLeave={handleDrag}\n onDragOver={handleDrag}\n onDrop={handleDrop}\n >\n <input\n type=\"file\"\n accept={accept}\n multiple={multiple}\n onChange={handleFileInputChange}\n disabled={disabled}\n className=\"file-upload__input\"\n />\n \n {children || (\n <div className=\"file-upload__content\">\n <p className=\"file-upload__text\">\n {dragActive ? 'Drop files here' : 'Drag and drop files here or click to select'}\n </p>\n <Button\n type=\"button\"\n variant=\"outline\"\n disabled={disabled}\n onClick={() => (document.querySelector('.file-upload__input') as HTMLInputElement)?.click()}\n >\n Select Files\n </Button>\n </div>\n )}\n </div>\n\n {/* Selected files */}\n {selectedFiles.length > 0 && (\n <div className=\"file-upload__files\">\n <h4 className=\"file-upload__files-title\">Selected Files:</h4>\n <ul className=\"file-upload__files-list\">\n {selectedFiles.map((file, index) => (\n <li key={index} className=\"file-upload__file-item\">\n <span className=\"file-upload__file-name\">{file.name}</span>\n <span className=\"file-upload__file-size\">{formatFileSize(file.size)}</span>\n </li>\n ))}\n </ul>\n </div>\n )}\n\n {/* Validation errors */}\n {validationErrors.length > 0 && (\n <Alert variant=\"destructive\" className=\"file-upload__errors\">\n <ul>\n {validationErrors.map((error, index) => (\n <li key={index}>{error}</li>\n ))}\n </ul>\n </Alert>\n )}\n\n {/* Upload progress */}\n {isUploading && (\n <div className=\"file-upload__progress\">\n <Progress value={uploadProgress} max={100} />\n <p className=\"file-upload__progress-text\">\n Uploading... {uploadProgress}%\n </p>\n </div>\n )}\n\n {/* Upload error */}\n {uploadError && (\n <Alert variant=\"destructive\" className=\"file-upload__error\">\n {uploadError}\n </Alert>\n )}\n\n {/* Actions */}\n {selectedFiles.length > 0 && (\n <div className=\"file-upload__actions\">\n <Button\n onClick={handleUpload}\n disabled={!canUpload}\n className=\"file-upload__upload-btn\"\n >\n {isUploading ? 'Uploading...' : `Upload ${selectedFiles.length} file${selectedFiles.length > 1 ? 's' : ''}`}\n </Button>\n <Button\n variant=\"outline\"\n onClick={handleClear}\n disabled={isUploading}\n className=\"file-upload__clear-btn\"\n >\n Clear\n </Button>\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;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BAAC,OAAE,WAAU,8BAA6B;AAAA;AAAA,QAC1B;AAAA,QAAe;AAAA,SAC/B;AAAA,OACF;AAAA,IAID,eACC,oBAAC,SAAM,SAAQ,eAAc,WAAU,sBACpC,uBACH;AAAA,IAID,cAAc,SAAS,KACtB,qBAAC,SAAI,WAAU,wBACb;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,SAAS;AAAA,UACT,UAAU,CAAC;AAAA,UACX,WAAU;AAAA,UAET,wBAAc,iBAAiB,UAAU,cAAc,MAAM,QAAQ,cAAc,SAAS,IAAI,MAAM,EAAE;AAAA;AAAA,MAC3G;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACC,SAAQ;AAAA,UACR,SAAS;AAAA,UACT,UAAU;AAAA,UACV,WAAU;AAAA,UACX;AAAA;AAAA,MAED;AAAA,OACF;AAAA,KAEJ;AAEJ;","names":["organisationId","formatFileSize"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/utils/secureDataAccess.ts","../src/components/FileUpload/FileUpload.tsx"],"sourcesContent":["/**\n * @file Complete Component Library Export\n * @package @jmruthers/pace-core\n * @module Core\n * @since 0.1.0\n * \n * This file exports the primary components, hooks, and utilities from the PACE Core library.\n * It is the main entry point for developers using the library.\n * \n * @example\n * // Import common components\n * import { Button, Card, useUnifiedAuth } from '@jmruthers/pace-core';\n * \n * // For specialized components, use the complete library import:\n * import { Dialog, NavigationMenu } from '@jmruthers/pace-core/components';\n */\n\n// AUTHENTICATION & AUTHORIZATION\nexport { UnifiedAuthProvider, useUnifiedAuth } from './providers/UnifiedAuthProvider';\nexport type { UnifiedAuthProviderProps, UnifiedAuthContextType, UserEventAccess } from './providers/UnifiedAuthProvider';\nexport { EventProvider, useEvents } from './providers/EventProvider';\nexport type { EventProviderProps, EventContextType } from './providers/EventProvider';\nexport { OrganisationProvider, useOrganisations } from './providers/OrganisationProvider';\nexport type { \n Organisation, \n OrganisationMembership, \n OrganisationContextType, \n OrganisationProviderProps,\n OrganisationSecurityError \n} from './types/organisation';\n\n// INACTIVITY TRACKING\nexport { InactivityWarningModal } from './components/InactivityWarningModal/InactivityWarningModal';\nexport type { InactivityWarningModalProps } from './components/InactivityWarningModal/InactivityWarningModal';\nexport { useInactivityTracker } from './hooks/useInactivityTracker';\nexport type { UseInactivityTrackerOptions, UseInactivityTrackerReturn } from './hooks/useInactivityTracker';\n\n// RBAC SYSTEM - Consolidated RBAC module\nexport * from './rbac';\n\n// BASIC UI COMPONENTS\nexport { Button } from './components/Button/Button';\nexport type { ButtonProps } from './components/Button/Button';\n\nexport { \n Card, \n CardHeader, \n CardFooter, \n CardTitle, \n CardDescription, \n CardContent,\n CardActions\n} from './components/Card/Card';\nexport type { CardProps } from './components/Card/Card';\n\nexport { Input } from './components/Input/Input';\nexport type { InputProps } from './components/Input/Input';\nexport { Label } from './components/Label/Label';\nexport type { LabelProps } from './components/Label/Label';\n\nexport { Alert, AlertTitle, AlertDescription } from './components/Alert/Alert';\nexport { Avatar, AvatarImage, AvatarFallback } from './components/Avatar/Avatar';\n\nexport { Checkbox } from './components/Checkbox/Checkbox';\nexport { Switch } from './components/Switch/Switch';\nexport type { SwitchProps } from './components/Switch/Switch';\nexport { Progress } from './components/Progress/Progress';\n\n// ADVANCED UI COMPONENTS\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 './components/Dialog/Dialog';\n\n// Dropdown Menu exports\n// DropdownMenu components have been merged into Select components\n\n// Select exports\nexport {\n Select,\n SelectGroup,\n SelectValue,\n SelectTrigger,\n SelectContent,\n SelectLabel,\n SelectItem,\n SelectSeparator,\n} from './components/Select';\n\n// Modal functionality is provided by Dialog components\n\nexport {\n Toast,\n Toaster,\n ToastAction,\n ToastProvider,\n ToastViewport,\n ToastTitle,\n ToastDescription,\n ToastClose,\n} from './components/Toast/Toast';\nexport { useToast } from './hooks/useToast';\nexport type { ToastActionElement, ToastProps } from './components/Toast/Toast';\n\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider, TooltipRoot } from './components/Tooltip/Tooltip';\n\n// DATA DISPLAY COMPONENTS\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 ColumnFactory\n} from './components/DataTable';\n\n// Re-export types from DataTable types\nexport type { DataRecord } from './components/DataTable/types';\n\n// FORM COMPONENTS\nexport { Form } from './components/Form/Form';\nexport { LoginForm } from './components/LoginForm/LoginForm';\nexport type { LoginFormProps } from './components/LoginForm/LoginForm';\n\n// LAYOUT COMPONENTS\nexport { Header } from './components/Header/Header';\nexport { Footer } from './components/Footer/Footer';\nexport type { FooterProps } from './components/Footer/Footer';\n\n// NAVIGATION COMPONENTS\nexport { NavigationMenu } from './components/NavigationMenu/NavigationMenu';\nexport type { NavigationMenuProps, NavigationItem } from './components/NavigationMenu/types';\nexport { UserMenu } from './components/UserMenu/UserMenu';\nexport type { UserMenuProps } from './components/UserMenu/UserMenu';\n\n// Reusable Page/Layout Components\nexport { PaceAppLayout } from './components/PaceAppLayout/PaceAppLayout';\nexport type { PaceAppLayoutProps } from './components/PaceAppLayout/PaceAppLayout';\nexport { PaceLoginPage } from './components/PaceLoginPage/PaceLoginPage';\nexport type { PaceLoginPageProps } from './components/PaceLoginPage/PaceLoginPage';\n\n// UTILITY COMPONENTS\nexport { ErrorBoundary } from './components/ErrorBoundary/ErrorBoundary';\nexport { LoadingSpinner } from './components/LoadingSpinner/LoadingSpinner';\n\n// EVENT MANAGEMENT\nexport { EventSelector } from './components/EventSelector/EventSelector';\n\n// ORGANISATION MANAGEMENT\nexport { OrganisationSelector } from './components/OrganisationSelector/OrganisationSelector';\nexport { useOrganisationPermissions } from './hooks/useOrganisationPermissions';\nexport { useOrganisationSecurity } from './hooks/useOrganisationSecurity';\nexport { createSecureDataAccess } from './utils/secureDataAccess';\n\n// TYPES\nexport type { UserProfile } from './types/organisation';\n\n// AUTHENTICATION FORMS\nexport { PasswordResetForm } from './components/PasswordReset/PasswordResetForm';\nexport { PasswordChangeForm } from './components/PasswordReset/PasswordChangeForm';\n\n// UTILS & HOOKS\nexport { useAppConfig } from './hooks/useAppConfig';\nexport { cn } from './utils/cn';\nexport { setAppConfig, getAppConfig, getCurrentAppName, getCurrentAppId } from './utils/appConfig';\n\n// FORMATTING UTILITIES\nexport { \n formatDate, \n formatCurrency, \n formatNumber,\n formatPercent,\n formatCompactNumber,\n formatFileSize\n} from './utils/formatting';\n\n// STORAGE UTILITIES\nexport { FileUpload } from './components/FileUpload/FileUpload';\nexport type { FileUploadProps } from './components/FileUpload/FileUpload';\nexport { useStorage, useFileUpload } from './hooks/useStorage';\nexport * from './utils/storage';\n\n// Table components\nexport {\n Table,\n TableHeader,\n TableBody,\n TableCaption,\n TableCell,\n TableFooter,\n TableHead,\n TableRow,\n} from './components/Table/Table';\n\n// STYLES\nexport * from './styles';\n\n// PUBLIC PAGES\nexport * from './hooks/public';\nexport * from './components/PublicLayout';\n","/**\n * @file Secure Data Access Utility\n * @package @jmruthers/pace-core\n * @module Utils/SecureDataAccess\n * @since 0.4.0\n *\n * Secure data access utilities that enforce organisation context for all database operations.\n * Prevents data leakage between organisations and ensures proper access validation.\n */\n\nimport type { SupabaseClient } from '@supabase/supabase-js';\n\n// Generic database record type\nexport interface DatabaseRecord {\n id: string;\n organisation_id: string;\n [key: string]: unknown;\n}\n\n// Generic data for insert/update operations\nexport interface DatabaseData {\n [key: string]: unknown;\n}\n\n// Generic filters for queries\nexport interface DatabaseFilters {\n [key: string]: unknown;\n}\n\n// Secure query options\nexport interface SecureQueryOptions {\n table: string;\n select: string;\n organisationId: string;\n filters?: DatabaseFilters;\n orderBy?: string;\n limit?: number;\n offset?: number;\n}\n\nexport interface SecureDataAccess {\n // Secure query methods\n secureQuery: <T extends DatabaseRecord = DatabaseRecord>(options: SecureQueryOptions) => Promise<T[]>;\n secureSingleQuery: <T extends DatabaseRecord = DatabaseRecord>(options: SecureQueryOptions) => Promise<T | null>;\n \n // Secure mutation methods\n secureInsert: <T extends DatabaseRecord = DatabaseRecord>(table: string, data: DatabaseData, organisationId: string) => Promise<T | null>;\n secureUpdate: <T extends DatabaseRecord = DatabaseRecord>(table: string, data: DatabaseData, filters: DatabaseFilters, organisationId: string) => Promise<T | null>;\n secureDelete: (table: string, filters: DatabaseFilters, organisationId: string) => Promise<boolean>;\n \n // Organisation-scoped queries\n queryByOrganisation: <T extends DatabaseRecord = DatabaseRecord>(table: string, select: string, organisationId: string, filters?: DatabaseFilters) => Promise<T[]>;\n \n // Validation helpers\n validateOrganisationContext: (organisationId: string) => void;\n ensureOrganisationColumn: (table: string) => boolean;\n}\n\nexport interface SecureQueryBuilder {\n table: string;\n select: string;\n organisationId: string;\n filters?: DatabaseFilters;\n orderBy?: string;\n limit?: number;\n offset?: number;\n}\n\n/**\n * Create a secure data access instance\n * @param supabase - Supabase client instance\n * @param organisationId - Current organisation context\n * @param isSuperAdmin - Whether user has super admin privileges\n * @returns Secure data access utilities\n */\nexport const createSecureDataAccess = (\n supabase: SupabaseClient,\n organisationId: string,\n isSuperAdmin: boolean = false\n): SecureDataAccess => {\n \n // Validate organisation context\n const validateOrganisationContext = (orgId: string): void => {\n if (!orgId) {\n throw new Error('Organisation context is required for secure data access');\n }\n \n if (!isSuperAdmin && !orgId) {\n throw new Error('Organisation context is mandatory for non-super admin users');\n }\n };\n\n // Check if table has organisation_id column\n const ensureOrganisationColumn = (table: string): boolean => {\n // This is a simplified check - in production you might want to cache this\n const tablesWithOrganisation = [\n 'event', 'organisation_settings',\n 'rbac_event_app_roles', 'rbac_organisation_roles',\n // SECURITY: Phase 2 additions - complete organisation table mapping\n 'organisation_audit_log', 'organisation_invitations', 'organisation_app_access',\n // SECURITY: Emergency additions for Phase 1 fixes\n 'cake_meal', 'cake_mealtype', 'pace_person', 'pace_member',\n // SECURITY: Phase 3A additions - medical and personal data\n 'medi_profile', 'medi_condition', 'medi_diet', 'medi_action_plan', 'medi_profile_versions',\n 'pace_consent', 'pace_contact', 'pace_id_documents', 'pace_qualifications',\n 'form_responses', 'form_response_values', 'forms',\n // SECURITY: Phase 3B additions - remaining critical tables\n 'invoice', 'line_item', 'credit_balance', 'payment_method',\n 'form_contexts', 'form_field_config', 'form_fields',\n 'cake_delivery', 'cake_diettype', 'cake_diner', 'cake_dish', 'cake_item', \n 'cake_logistics', 'cake_mealplan', 'cake_package', 'cake_recipe', 'cake_supplier', \n 'cake_supply', 'cake_unit', 'event_app_access', 'base_application', 'base_questions'\n ];\n \n return tablesWithOrganisation.includes(table);\n };\n\n // Build secure query with organisation context\n const buildSecureQuery = (options: SecureQueryBuilder) => {\n const { table, select, organisationId: orgId, filters, orderBy, limit, offset } = options;\n \n validateOrganisationContext(orgId);\n \n let query = supabase\n .from(table)\n .select(select);\n \n // Add organisation filter (unless super admin)\n if (!isSuperAdmin && ensureOrganisationColumn(table)) {\n query = query.eq('organisation_id', orgId);\n }\n \n // Add additional filters\n if (filters) {\n Object.entries(filters).forEach(([key, value]) => {\n if (value !== undefined && value !== null) {\n // Handle qualified column names (e.g., 'users.role')\n const columnName = key.includes('.') ? key.split('.').pop()! : key;\n query = query.eq(columnName, value);\n }\n });\n }\n \n // Add ordering\n if (orderBy) {\n // Only use the column name, not a qualified name\n const orderByColumn = orderBy.split('.').pop();\n if (orderByColumn) {\n query = query.order(orderByColumn);\n }\n }\n \n // Add pagination\n if (limit) {\n query = query.limit(limit);\n }\n \n if (offset) {\n query = query.range(offset, offset + (limit || 10) - 1);\n }\n \n return query;\n };\n\n // Secure query for multiple results\n const secureQuery = async <T extends DatabaseRecord = DatabaseRecord>(options: SecureQueryOptions): Promise<T[]> => {\n const { table, select, organisationId: orgId, filters, orderBy, limit, offset } = options;\n \n try {\n const query = buildSecureQuery({\n table,\n select,\n organisationId: orgId,\n filters,\n orderBy,\n limit,\n offset\n });\n \n const { data, error } = await query;\n \n if (error) {\n throw error;\n }\n \n // Ensure data is an array and not an error type\n if (Array.isArray(data)) {\n return data as unknown as T[];\n }\n \n return [];\n } catch (error) {\n throw error;\n }\n };\n\n // Secure query for single result\n const secureSingleQuery = async <T extends DatabaseRecord = DatabaseRecord>(options: SecureQueryOptions): Promise<T | null> => {\n const { table, select, organisationId: orgId, filters, orderBy, limit, offset } = options;\n \n try {\n const query = buildSecureQuery({\n table,\n select,\n organisationId: orgId,\n filters,\n orderBy,\n limit,\n offset\n });\n \n const { data, error } = await query.single();\n \n if (error) {\n if (error.code === 'PGRST116') {\n // No rows returned\n return null;\n }\n throw error;\n }\n \n // Ensure data is not an error type\n if (data && typeof data === 'object' && !('code' in data)) {\n return data as unknown as T;\n }\n \n return null;\n } catch (error) {\n throw error;\n }\n };\n\n // Secure insert with organisation context\n const secureInsert = async <T extends DatabaseRecord = DatabaseRecord>(\n table: string, \n data: DatabaseData, \n organisationId: string\n ): Promise<T | null> => {\n validateOrganisationContext(organisationId);\n \n try {\n const insertData = {\n ...data,\n organisation_id: organisationId\n };\n \n const { data: result, error } = await supabase\n .from(table)\n .insert(insertData)\n .select()\n .single();\n \n if (error) {\n throw error;\n }\n \n return result;\n } catch (error) {\n throw error;\n }\n };\n\n // Secure update with organisation context\n const secureUpdate = async <T extends DatabaseRecord = DatabaseRecord>(\n table: string, \n data: DatabaseData, \n filters: DatabaseFilters, \n organisationId: string\n ): Promise<T | null> => {\n validateOrganisationContext(organisationId);\n \n try {\n let query = supabase\n .from(table)\n .update(data);\n \n // Add organisation filter (unless super admin)\n if (!isSuperAdmin && ensureOrganisationColumn(table)) {\n query = query.eq('organisation_id', organisationId);\n }\n \n // Add additional filters\n if (filters) {\n Object.entries(filters).forEach(([key, value]) => {\n if (value !== undefined && value !== null) {\n query = query.eq(key, value);\n }\n });\n }\n \n const { data: result, error } = await query.select().single();\n \n if (error) {\n throw error;\n }\n \n return result;\n } catch (error) {\n throw error;\n }\n };\n\n // Secure delete with organisation context\n const secureDelete = async (\n table: string, \n filters: DatabaseFilters, \n organisationId: string\n ): Promise<boolean> => {\n validateOrganisationContext(organisationId);\n \n try {\n let query = supabase\n .from(table)\n .delete();\n \n // Add organisation filter (unless super admin)\n if (!isSuperAdmin && ensureOrganisationColumn(table)) {\n query = query.eq('organisation_id', organisationId);\n }\n \n // Add additional filters\n if (filters) {\n Object.entries(filters).forEach(([key, value]) => {\n if (value !== undefined && value !== null) {\n query = query.eq(key, value);\n }\n });\n }\n \n const { error } = await query;\n \n if (error) {\n throw error;\n }\n \n return true;\n } catch (error) {\n throw error;\n }\n };\n\n // Organisation-scoped query helper\n const queryByOrganisation = async <T extends DatabaseRecord = DatabaseRecord>(\n table: string, \n select: string, \n organisationId: string, \n filters?: DatabaseFilters\n ): Promise<T[]> => {\n return secureQuery<T>({\n table,\n select,\n organisationId,\n filters\n });\n };\n\n return {\n secureQuery,\n secureSingleQuery,\n secureInsert,\n secureUpdate,\n secureDelete,\n queryByOrganisation,\n validateOrganisationContext,\n ensureOrganisationColumn\n };\n};\n\n/**\n * Hook for secure data access\n * @returns Secure data access utilities\n */\nexport const useSecureDataAccess = (): SecureDataAccess => {\n // This would typically get the context from providers\n // For now, we'll create a placeholder that can be used with explicit parameters\n throw new Error('useSecureDataAccess must be used with explicit parameters. Use createSecureDataAccess instead.');\n}; ","/**\n * File upload component with app-segregated storage\n */\n\nimport React, { useCallback, useState } from 'react';\nimport { SupabaseClient } from '@supabase/supabase-js';\nimport { validateFileSize, formatFileSize } from '../../utils/storage';\nimport { useFileUpload } from '../../hooks/useStorage';\nimport { Button } from '../Button/Button';\nimport { Progress } from '../Progress/Progress';\nimport { Alert } from '../Alert/Alert';\n\nexport interface FileUploadProps {\n supabase: SupabaseClient;\n appName: string;\n orgId: string;\n onUploadComplete?: (result: { success: boolean; path?: string; error?: string }) => void;\n onUploadStart?: () => void;\n accept?: string;\n maxSize?: number;\n multiple?: boolean;\n disabled?: boolean;\n className?: string;\n children?: React.ReactNode;\n}\n\nexport function FileUpload({\n supabase,\n appName,\n orgId,\n onUploadComplete,\n onUploadStart,\n accept = '*/*',\n maxSize,\n multiple = false,\n disabled = false,\n className = '',\n children\n}: FileUploadProps) {\n const [dragActive, setDragActive] = useState(false);\n const [selectedFiles, setSelectedFiles] = useState<File[]>([]);\n const [validationErrors, setValidationErrors] = useState<string[]>([]);\n\n const { uploadWithProgress, uploadProgress, isUploading, uploadError } = useFileUpload({\n supabase,\n appName,\n orgId\n });\n\n // Validate files\n const validateFiles = useCallback((files: File[]): string[] => {\n const errors: string[] = [];\n\n files.forEach((file, index) => {\n // Check file size\n const sizeValidation = validateFileSize(file);\n if (!sizeValidation.isValid) {\n errors.push(`File ${index + 1}: ${sizeValidation.error}`);\n }\n\n // Check custom max size\n if (maxSize && file.size > maxSize) {\n const fileMB = Math.round(file.size / (1024 * 1024));\n const maxMB = Math.round(maxSize / (1024 * 1024));\n errors.push(`File ${index + 1}: Size (${fileMB}MB) exceeds limit (${maxMB}MB)`);\n }\n });\n\n return errors;\n }, [maxSize]);\n\n // Handle file selection\n const handleFileSelect = useCallback((files: FileList | null) => {\n if (!files) return;\n\n const fileArray = Array.from(files);\n const errors = validateFiles(fileArray);\n\n setValidationErrors(errors);\n setSelectedFiles(fileArray);\n }, [validateFiles]);\n\n // Handle drag events\n const handleDrag = useCallback((e: React.DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n if (e.type === 'dragenter' || e.type === 'dragover') {\n setDragActive(true);\n } else if (e.type === 'dragleave') {\n setDragActive(false);\n }\n }, []);\n\n const handleDrop = useCallback((e: React.DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n setDragActive(false);\n\n if (disabled) return;\n\n const files = e.dataTransfer.files;\n handleFileSelect(files);\n }, [disabled, handleFileSelect]);\n\n // Handle file input change\n const handleFileInputChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n handleFileSelect(e.target.files);\n }, [handleFileSelect]);\n\n // Handle upload\n const handleUpload = useCallback(async () => {\n if (selectedFiles.length === 0 || validationErrors.length > 0) return;\n\n onUploadStart?.();\n\n for (const file of selectedFiles) {\n const result = await uploadWithProgress(file);\n onUploadComplete?.(result);\n }\n\n // Reset selection\n setSelectedFiles([]);\n setValidationErrors([]);\n }, [selectedFiles, validationErrors, uploadWithProgress, onUploadComplete, onUploadStart]);\n\n // Handle clear\n const handleClear = useCallback(() => {\n setSelectedFiles([]);\n setValidationErrors([]);\n }, []);\n\n const canUpload = selectedFiles.length > 0 && validationErrors.length === 0 && !isUploading && !disabled;\n\n return (\n <div className={`file-upload ${className}`}>\n {/* Drop zone */}\n <div\n className={`file-upload__dropzone ${\n dragActive ? 'file-upload__dropzone--active' : ''\n } ${disabled ? 'file-upload__dropzone--disabled' : ''}`}\n onDragEnter={handleDrag}\n onDragLeave={handleDrag}\n onDragOver={handleDrag}\n onDrop={handleDrop}\n >\n <input\n type=\"file\"\n accept={accept}\n multiple={multiple}\n onChange={handleFileInputChange}\n disabled={disabled}\n className=\"file-upload__input\"\n />\n \n {children || (\n <div className=\"file-upload__content\">\n <p className=\"file-upload__text\">\n {dragActive ? 'Drop files here' : 'Drag and drop files here or click to select'}\n </p>\n <Button\n type=\"button\"\n variant=\"outline\"\n disabled={disabled}\n onClick={() => (document.querySelector('.file-upload__input') as HTMLInputElement)?.click()}\n >\n Select Files\n </Button>\n </div>\n )}\n </div>\n\n {/* Selected files */}\n {selectedFiles.length > 0 && (\n <div className=\"file-upload__files\">\n <h4 className=\"file-upload__files-title\">Selected Files:</h4>\n <ul className=\"file-upload__files-list\">\n {selectedFiles.map((file, index) => (\n <li key={index} className=\"file-upload__file-item\">\n <span className=\"file-upload__file-name\">{file.name}</span>\n <span className=\"file-upload__file-size\">{formatFileSize(file.size)}</span>\n </li>\n ))}\n </ul>\n </div>\n )}\n\n {/* Validation errors */}\n {validationErrors.length > 0 && (\n <Alert variant=\"destructive\" className=\"file-upload__errors\">\n <ul>\n {validationErrors.map((error, index) => (\n <li key={index}>{error}</li>\n ))}\n </ul>\n </Alert>\n )}\n\n {/* Upload progress */}\n {isUploading && (\n <div className=\"file-upload__progress\">\n <Progress value={uploadProgress} max={100} />\n <p className=\"file-upload__progress-text\">\n Uploading... {uploadProgress}%\n </p>\n </div>\n )}\n\n {/* Upload error */}\n {uploadError && (\n <Alert variant=\"destructive\" className=\"file-upload__error\">\n {uploadError}\n </Alert>\n )}\n\n {/* Actions */}\n {selectedFiles.length > 0 && (\n <div className=\"file-upload__actions\">\n <Button\n onClick={handleUpload}\n disabled={!canUpload}\n className=\"file-upload__upload-btn\"\n >\n {isUploading ? 'Uploading...' : `Upload ${selectedFiles.length} file${selectedFiles.length > 1 ? 's' : ''}`}\n </Button>\n <Button\n variant=\"outline\"\n onClick={handleClear}\n disabled={isUploading}\n className=\"file-upload__clear-btn\"\n >\n Clear\n </Button>\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA;AAEA;AAEA;AAUA;AAEA;AAOA;AA4BA;AA4CA;;;ACtCO,IAAM,yBAAyB,CACpC,UACA,gBACA,eAAwB,UACH;AAGrB,QAAM,8BAA8B,CAAC,UAAwB;AAC3D,QAAI,CAAC,OAAO;AACV,YAAM,IAAI,MAAM,yDAAyD;AAAA,IAC3E;AAEA,QAAI,CAAC,gBAAgB,CAAC,OAAO;AAC3B,YAAM,IAAI,MAAM,6DAA6D;AAAA,IAC/E;AAAA,EACF;AAGA,QAAM,2BAA2B,CAAC,UAA2B;AAE3D,UAAM,yBAAyB;AAAA,MAC7B;AAAA,MA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A,0BAAC,QAAG,WAAU,4BAA2B,6BAAe;AAAA,MACxD,oBAAC,QAAG,WAAU,2BACX,wBAAc,IAAI,CAAC,MAAM,UACxB,qBAAC,QAAe,WAAU,0BACxB;AAAA,4BAAC,UAAK,WAAU,0BAA0B,eAAK,MAAK;AAAA,QACpD,oBAAC,UAAK,WAAU,0BAA0B,UAAAC,gBAAe,KAAK,IAAI,GAAE;AAAA,WAF7D,KAGT,CACD,GACH;AAAA,OACF;AAAA,IAID,iBAAiB,SAAS,KACzB,oBAAC,SAAM,SAAQ,eAAc,WAAU,uBACrC,8BAAC,QACE,2BAAiB,IAAI,CAAC,OAAO,UAC5B,oBAAC,QAAgB,mBAAR,KAAc,CACxB,GACH,GACF;AAAA,IAID,eACC,qBAAC,SAAI,WAAU,yBACb;AAAA,0BAAC,YAAS,OAAO,gBAAgB,KAAK,KAAK;AAAA,MAC3C,qBAAC,OAAE,WAAU,8BAA6B;AAAA;AAAA,QAC1B;AAAA,QAAe;AAAA,SAC/B;AAAA,OACF;AAAA,IAID,eACC,oBAAC,SAAM,SAAQ,eAAc,WAAU,sBACpC,uBACH;AAAA,IAID,cAAc,SAAS,KACtB,qBAAC,SAAI,WAAU,wBACb;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,SAAS;AAAA,UACT,UAAU,CAAC;AAAA,UACX,WAAU;AAAA,UAET,wBAAc,iBAAiB,UAAU,cAAc,MAAM,QAAQ,cAAc,SAAS,IAAI,MAAM,EAAE;AAAA;AAAA,MAC3G;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACC,SAAQ;AAAA,UACR,SAAS;AAAA,UACT,UAAU;AAAA,UACV,WAAU;AAAA,UACX;AAAA;AAAA,MAED;AAAA,OACF;AAAA,KAEJ;AAEJ;","names":["organisationId","formatFileSize"]}
@@ -8,6 +8,14 @@ import { ColumnDef, SortingState, ColumnFiltersState, GroupingState } from '@tan
8
8
  * @since 0.2.0
9
9
  */
10
10
 
11
+ declare module '@tanstack/react-table' {
12
+ interface ColumnMeta<TData, TValue> {
13
+ /** Text alignment for the column content */
14
+ align?: 'left' | 'right' | 'center';
15
+ /** Column type for styling purposes */
16
+ type?: 'text' | 'number' | 'date' | 'boolean' | 'custom';
17
+ }
18
+ }
11
19
  /**
12
20
  * Generic data record type - all DataTable data must extend this
13
21
  */
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types/index.ts","../src/types/guards.ts"],"sourcesContent":["/**\n * @file Types Module Exports\n * @package @jmruthers/pace-core\n * @module Types\n * @since 0.1.0\n * \n * Complete collection of type definitions for the PACE Core library.\n * Use this import path when you need access to types not included in the main export.\n * \n * @example\n * // Specialized type imports\n * import { User, Event, AccessLevel } from '@jmruthers/pace-core/types';\n * \n * // For common types, prefer the main export:\n * import { ButtonProps, CardProps } from '@jmruthers/pace-core';\n */\n\n// Core type exports\nexport * from './unified';\nexport * from './supabase';\nexport * from './database';\nexport * from './guards';\nexport * from './validation';\nexport * from './theme';\nexport * from './security';\n","\n/**\n * @file Type Guards\n */\n\nimport { AuthErrorCode, User, Session } from './unified';\n\nexport function isAuthErrorCode(code: string): code is AuthErrorCode {\n return Object.values(AuthErrorCode).includes(code as AuthErrorCode);\n}\n\nexport function isUser(obj: unknown): obj is User {\n const candidate = obj as Partial<User> | null | undefined;\n return (\n candidate != null &&\n typeof candidate === 'object' &&\n typeof candidate.id === 'string' &&\n typeof candidate.created_at === 'string'\n );\n}\n\nexport function isSession(obj: unknown): obj is Session {\n const candidate = obj as Partial<Session> | null | undefined;\n return (\n candidate != null &&\n typeof candidate === 'object' &&\n typeof candidate.access_token === 'string' &&\n typeof candidate.user === 'object'\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA;;;ACbA;AAEO,SAAS,gBAAgB,MAAqC;AACnE,SAAO,OAAO,OAAO,aAAa,EAAE,SAAS,IAAqB;AACpE;AAEO,SAAS,OAAO,KAA2B;AAChD,QAAM,YAAY;AAClB,SACE,aAAa,QACb,OAAO,cAAc,YACrB,OAAO,UAAU,OAAO,YACxB,OAAO,UAAU,eAAe;AAEpC;AAEO,SAAS,UAAU,KAA8B;AACtD,QAAM,YAAY;AAClB,SACE,aAAa,QACb,OAAO,cAAc,YACrB,OAAO,UAAU,iBAAiB,YAClC,OAAO,UAAU,SAAS;AAE9B;","names":[]}
1
+ {"version":3,"sources":["../src/types/index.ts","../src/types/guards.ts"],"sourcesContent":["/**\n * @file Types Module Exports\n * @package @jmruthers/pace-core\n * @module Types\n * @since 0.1.0\n * \n * Complete collection of type definitions for the PACE Core library.\n * Use this import path when you need access to types not included in the main export.\n * \n * @example\n * // Specialized type imports\n * import { User, Event, AccessLevel } from '@jmruthers/pace-core/types';\n * \n * // For common types, prefer the main export:\n * import { ButtonProps, CardProps } from '@jmruthers/pace-core';\n */\n\n// Core type exports\nexport * from './unified';\nexport * from './supabase';\nexport * from './database';\nexport * from './guards';\nexport * from './validation';\nexport * from './theme';\nexport * from './security';\n\n// Type declarations are handled via module augmentation in individual files\n","\n/**\n * @file Type Guards\n */\n\nimport { AuthErrorCode, User, Session } from './unified';\n\nexport function isAuthErrorCode(code: string): code is AuthErrorCode {\n return Object.values(AuthErrorCode).includes(code as AuthErrorCode);\n}\n\nexport function isUser(obj: unknown): obj is User {\n const candidate = obj as Partial<User> | null | undefined;\n return (\n candidate != null &&\n typeof candidate === 'object' &&\n typeof candidate.id === 'string' &&\n typeof candidate.created_at === 'string'\n );\n}\n\nexport function isSession(obj: unknown): obj is Session {\n const candidate = obj as Partial<Session> | null | undefined;\n return (\n candidate != null &&\n typeof candidate === 'object' &&\n typeof candidate.access_token === 'string' &&\n typeof candidate.user === 'object'\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA;;;ACbA;AAEO,SAAS,gBAAgB,MAAqC;AACnE,SAAO,OAAO,OAAO,aAAa,EAAE,SAAS,IAAqB;AACpE;AAEO,SAAS,OAAO,KAA2B;AAChD,QAAM,YAAY;AAClB,SACE,aAAa,QACb,OAAO,cAAc,YACrB,OAAO,UAAU,OAAO,YACxB,OAAO,UAAU,eAAe;AAEpC;AAEO,SAAS,UAAU,KAA8B;AACtD,QAAM,YAAY;AAClB,SACE,aAAa,QACb,OAAO,cAAc,YACrB,OAAO,UAAU,iBAAiB,YAClC,OAAO,UAAU,SAAS;AAE9B;","names":[]}
package/dist/utils.d.ts CHANGED
@@ -2,12 +2,12 @@ export { A as AppConfig, S as SecureDataAccess, a as cn, j as formatCompactNumbe
2
2
  import { z } from 'zod';
3
3
  export { u as useComponentPerformance } from './useComponentPerformance-DE9l5RkL.js';
4
4
  import * as date_fns from 'date-fns';
5
- import { D as DataTable } from './DataTable-D15XipLZ.js';
5
+ import { D as DataTable } from './DataTable-ntgmhO2W.js';
6
6
  import React__default, { ComponentType } from 'react';
7
+ import './types-CGX9Vyf5.js';
7
8
  import { SupabaseClient } from '@supabase/supabase-js';
8
9
  import 'clsx';
9
10
  import 'react/jsx-runtime';
10
- import './types-E5WSpEtz.js';
11
11
  import '@tanstack/react-table';
12
12
 
13
13
  /**
package/dist/utils.js CHANGED
@@ -551,7 +551,7 @@ function createLazyComponent(importFn, componentName, options = {}) {
551
551
  return WrappedComponent;
552
552
  }
553
553
  var LazyDataTable = createLazyComponent(
554
- () => import("./DataTable-7BER7PDS.js").then((module) => ({ default: module.DataTable })),
554
+ () => import("./DataTable-MFUXNGPR.js").then((module) => ({ default: module.DataTable })),
555
555
  "DataTable"
556
556
  );
557
557
 
@@ -1,4 +1,4 @@
1
- [@jmruthers/pace-core - v0.5.64](../README.md) / [Exports](../modules.md) / ColumnFactory
1
+ [@jmruthers/pace-core - v0.5.67](../README.md) / [Exports](../modules.md) / ColumnFactory
2
2
 
3
3
  # Class: ColumnFactory\<TData\>
4
4
 
@@ -125,7 +125,7 @@ Create a date column
125
125
 
126
126
  #### Defined in
127
127
 
128
- [packages/core/src/components/DataTable/core/ColumnFactory.ts:129](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/DataTable/core/ColumnFactory.ts#L129)
128
+ [packages/core/src/components/DataTable/core/ColumnFactory.ts:133](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/DataTable/core/ColumnFactory.ts#L133)
129
129
 
130
130
  ___
131
131
 
@@ -154,7 +154,7 @@ Create a boolean column
154
154
 
155
155
  #### Defined in
156
156
 
157
- [packages/core/src/components/DataTable/core/ColumnFactory.ts:164](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/DataTable/core/ColumnFactory.ts#L164)
157
+ [packages/core/src/components/DataTable/core/ColumnFactory.ts:168](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/DataTable/core/ColumnFactory.ts#L168)
158
158
 
159
159
  ___
160
160
 
@@ -183,7 +183,7 @@ Create an action column
183
183
 
184
184
  #### Defined in
185
185
 
186
- [packages/core/src/components/DataTable/core/ColumnFactory.ts:193](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/DataTable/core/ColumnFactory.ts#L193)
186
+ [packages/core/src/components/DataTable/core/ColumnFactory.ts:197](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/DataTable/core/ColumnFactory.ts#L197)
187
187
 
188
188
  ___
189
189
 
@@ -212,7 +212,7 @@ Create a custom column
212
212
 
213
213
  #### Defined in
214
214
 
215
- [packages/core/src/components/DataTable/core/ColumnFactory.ts:225](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/DataTable/core/ColumnFactory.ts#L225)
215
+ [packages/core/src/components/DataTable/core/ColumnFactory.ts:229](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/DataTable/core/ColumnFactory.ts#L229)
216
216
 
217
217
  ___
218
218
 
@@ -240,4 +240,4 @@ Create columns from simple configuration
240
240
 
241
241
  #### Defined in
242
242
 
243
- [packages/core/src/components/DataTable/core/ColumnFactory.ts:248](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/DataTable/core/ColumnFactory.ts#L248)
243
+ [packages/core/src/components/DataTable/core/ColumnFactory.ts:252](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/DataTable/core/ColumnFactory.ts#L252)
@@ -1,4 +1,4 @@
1
- [@jmruthers/pace-core - v0.5.64](../README.md) / [Exports](../modules.md) / ErrorBoundary
1
+ [@jmruthers/pace-core - v0.5.67](../README.md) / [Exports](../modules.md) / ErrorBoundary
2
2
 
3
3
  # Class: ErrorBoundary
4
4
 
@@ -1,4 +1,4 @@
1
- [@jmruthers/pace-core - v0.5.64](../README.md) / [Exports](../modules.md) / InvalidScopeError
1
+ [@jmruthers/pace-core - v0.5.67](../README.md) / [Exports](../modules.md) / InvalidScopeError
2
2
 
3
3
  # Class: InvalidScopeError
4
4
 
@@ -1,4 +1,4 @@
1
- [@jmruthers/pace-core - v0.5.64](../README.md) / [Exports](../modules.md) / MissingUserContextError
1
+ [@jmruthers/pace-core - v0.5.67](../README.md) / [Exports](../modules.md) / MissingUserContextError
2
2
 
3
3
  # Class: MissingUserContextError
4
4
 
@@ -1,4 +1,4 @@
1
- [@jmruthers/pace-core - v0.5.64](../README.md) / [Exports](../modules.md) / OrganisationContextRequiredError
1
+ [@jmruthers/pace-core - v0.5.67](../README.md) / [Exports](../modules.md) / OrganisationContextRequiredError
2
2
 
3
3
  # Class: OrganisationContextRequiredError
4
4
 
@@ -1,4 +1,4 @@
1
- [@jmruthers/pace-core - v0.5.64](../README.md) / [Exports](../modules.md) / PermissionDeniedError
1
+ [@jmruthers/pace-core - v0.5.67](../README.md) / [Exports](../modules.md) / PermissionDeniedError
2
2
 
3
3
  # Class: PermissionDeniedError
4
4
 
@@ -1,4 +1,4 @@
1
- [@jmruthers/pace-core - v0.5.64](../README.md) / [Exports](../modules.md) / PublicErrorBoundary
1
+ [@jmruthers/pace-core - v0.5.67](../README.md) / [Exports](../modules.md) / PublicErrorBoundary
2
2
 
3
3
  # Class: PublicErrorBoundary
4
4
 
@@ -1,4 +1,4 @@
1
- [@jmruthers/pace-core - v0.5.64](../README.md) / [Exports](../modules.md) / RBACAuditManager
1
+ [@jmruthers/pace-core - v0.5.67](../README.md) / [Exports](../modules.md) / RBACAuditManager
2
2
 
3
3
  # Class: RBACAuditManager
4
4
 
@@ -1,4 +1,4 @@
1
- [@jmruthers/pace-core - v0.5.64](../README.md) / [Exports](../modules.md) / RBACCache
1
+ [@jmruthers/pace-core - v0.5.67](../README.md) / [Exports](../modules.md) / RBACCache
2
2
 
3
3
  # Class: RBACCache
4
4
 
@@ -1,4 +1,4 @@
1
- [@jmruthers/pace-core - v0.5.64](../README.md) / [Exports](../modules.md) / RBACEngine
1
+ [@jmruthers/pace-core - v0.5.67](../README.md) / [Exports](../modules.md) / RBACEngine
2
2
 
3
3
  # Class: RBACEngine
4
4
 
@@ -1,4 +1,4 @@
1
- [@jmruthers/pace-core - v0.5.64](../README.md) / [Exports](../modules.md) / RBACError
1
+ [@jmruthers/pace-core - v0.5.67](../README.md) / [Exports](../modules.md) / RBACError
2
2
 
3
3
  # Class: RBACError
4
4
 
@@ -1,4 +1,4 @@
1
- [@jmruthers/pace-core - v0.5.64](../README.md) / [Exports](../modules.md) / RBACNotInitializedError
1
+ [@jmruthers/pace-core - v0.5.67](../README.md) / [Exports](../modules.md) / RBACNotInitializedError
2
2
 
3
3
  # Class: RBACNotInitializedError
4
4
 
@@ -1,4 +1,4 @@
1
- [@jmruthers/pace-core - v0.5.64](../README.md) / [Exports](../modules.md) / SecureSupabaseClient
1
+ [@jmruthers/pace-core - v0.5.67](../README.md) / [Exports](../modules.md) / SecureSupabaseClient
2
2
 
3
3
  # Class: SecureSupabaseClient
4
4
 
@@ -1,4 +1,4 @@
1
- [@jmruthers/pace-core - v0.5.64](../README.md) / [Exports](../modules.md) / StorageUtils
1
+ [@jmruthers/pace-core - v0.5.67](../README.md) / [Exports](../modules.md) / StorageUtils
2
2
 
3
3
  # Class: StorageUtils
4
4
 
@@ -1,4 +1,4 @@
1
- [@jmruthers/pace-core - v0.5.64](../README.md) / [Exports](../modules.md) / AggregateConfig
1
+ [@jmruthers/pace-core - v0.5.67](../README.md) / [Exports](../modules.md) / AggregateConfig
2
2
 
3
3
  # Interface: AggregateConfig
4
4
 
@@ -20,7 +20,7 @@ Aggregate configuration
20
20
 
21
21
  #### Defined in
22
22
 
23
- [packages/core/src/components/DataTable/types.ts:329](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/DataTable/types.ts#L329)
23
+ [packages/core/src/components/DataTable/types.ts:339](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/DataTable/types.ts#L339)
24
24
 
25
25
  ___
26
26
 
@@ -30,7 +30,7 @@ ___
30
30
 
31
31
  #### Defined in
32
32
 
33
- [packages/core/src/components/DataTable/types.ts:330](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/DataTable/types.ts#L330)
33
+ [packages/core/src/components/DataTable/types.ts:340](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/DataTable/types.ts#L340)
34
34
 
35
35
  ___
36
36
 
@@ -40,4 +40,4 @@ ___
40
40
 
41
41
  #### Defined in
42
42
 
43
- [packages/core/src/components/DataTable/types.ts:331](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/DataTable/types.ts#L331)
43
+ [packages/core/src/components/DataTable/types.ts:341](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/DataTable/types.ts#L341)
@@ -1,4 +1,4 @@
1
- [@jmruthers/pace-core - v0.5.64](../README.md) / [Exports](../modules.md) / ButtonProps
1
+ [@jmruthers/pace-core - v0.5.67](../README.md) / [Exports](../modules.md) / ButtonProps
2
2
 
3
3
  # Interface: ButtonProps
4
4
 
@@ -1,4 +1,4 @@
1
- [@jmruthers/pace-core - v0.5.64](../README.md) / [Exports](../modules.md) / CardProps
1
+ [@jmruthers/pace-core - v0.5.67](../README.md) / [Exports](../modules.md) / CardProps
2
2
 
3
3
  # Interface: CardProps
4
4
 
@@ -1,4 +1,4 @@
1
- [@jmruthers/pace-core - v0.5.64](../README.md) / [Exports](../modules.md) / ColorPalette
1
+ [@jmruthers/pace-core - v0.5.67](../README.md) / [Exports](../modules.md) / ColorPalette
2
2
 
3
3
  # Interface: ColorPalette
4
4
 
@@ -1,4 +1,4 @@
1
- [@jmruthers/pace-core - v0.5.64](../README.md) / [Exports](../modules.md) / ColorShade
1
+ [@jmruthers/pace-core - v0.5.67](../README.md) / [Exports](../modules.md) / ColorShade
2
2
 
3
3
  # Interface: ColorShade
4
4
 
@@ -1,4 +1,4 @@
1
- [@jmruthers/pace-core - v0.5.64](../README.md) / [Exports](../modules.md) / DataAccessRecord
1
+ [@jmruthers/pace-core - v0.5.67](../README.md) / [Exports](../modules.md) / DataAccessRecord
2
2
 
3
3
  # Interface: DataAccessRecord
4
4
 
@@ -1,4 +1,4 @@
1
- [@jmruthers/pace-core - v0.5.64](../README.md) / [Exports](../modules.md) / DataTableAction
1
+ [@jmruthers/pace-core - v0.5.67](../README.md) / [Exports](../modules.md) / DataTableAction
2
2
 
3
3
  # Interface: DataTableAction\<TData\>
4
4
 
@@ -38,7 +38,7 @@ Display label for the action
38
38
 
39
39
  #### Defined in
40
40
 
41
- [packages/core/src/components/DataTable/types.ts:276](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/DataTable/types.ts#L276)
41
+ [packages/core/src/components/DataTable/types.ts:286](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/DataTable/types.ts#L286)
42
42
 
43
43
  ___
44
44
 
@@ -50,7 +50,7 @@ Icon component
50
50
 
51
51
  #### Defined in
52
52
 
53
- [packages/core/src/components/DataTable/types.ts:278](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/DataTable/types.ts#L278)
53
+ [packages/core/src/components/DataTable/types.ts:288](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/DataTable/types.ts#L288)
54
54
 
55
55
  ___
56
56
 
@@ -76,7 +76,7 @@ Action handler
76
76
 
77
77
  #### Defined in
78
78
 
79
- [packages/core/src/components/DataTable/types.ts:280](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/DataTable/types.ts#L280)
79
+ [packages/core/src/components/DataTable/types.ts:290](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/DataTable/types.ts#L290)
80
80
 
81
81
  ___
82
82
 
@@ -88,7 +88,7 @@ Visual variant
88
88
 
89
89
  #### Defined in
90
90
 
91
- [packages/core/src/components/DataTable/types.ts:282](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/DataTable/types.ts#L282)
91
+ [packages/core/src/components/DataTable/types.ts:292](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/DataTable/types.ts#L292)
92
92
 
93
93
  ___
94
94
 
@@ -114,7 +114,7 @@ Whether action is disabled
114
114
 
115
115
  #### Defined in
116
116
 
117
- [packages/core/src/components/DataTable/types.ts:284](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/DataTable/types.ts#L284)
117
+ [packages/core/src/components/DataTable/types.ts:294](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/DataTable/types.ts#L294)
118
118
 
119
119
  ___
120
120
 
@@ -126,7 +126,7 @@ Whether action is hidden (for RBAC)
126
126
 
127
127
  #### Defined in
128
128
 
129
- [packages/core/src/components/DataTable/types.ts:286](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/DataTable/types.ts#L286)
129
+ [packages/core/src/components/DataTable/types.ts:296](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/DataTable/types.ts#L296)
130
130
 
131
131
  ___
132
132
 
@@ -138,7 +138,7 @@ Test ID for testing
138
138
 
139
139
  #### Defined in
140
140
 
141
- [packages/core/src/components/DataTable/types.ts:288](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/DataTable/types.ts#L288)
141
+ [packages/core/src/components/DataTable/types.ts:298](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/DataTable/types.ts#L298)
142
142
 
143
143
  ___
144
144
 
@@ -150,7 +150,7 @@ Whether this action should only show for parent rows (hierarchical mode)
150
150
 
151
151
  #### Defined in
152
152
 
153
- [packages/core/src/components/DataTable/types.ts:290](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/DataTable/types.ts#L290)
153
+ [packages/core/src/components/DataTable/types.ts:300](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/DataTable/types.ts#L300)
154
154
 
155
155
  ___
156
156
 
@@ -162,7 +162,7 @@ Whether this action should only show for child rows (hierarchical mode)
162
162
 
163
163
  #### Defined in
164
164
 
165
- [packages/core/src/components/DataTable/types.ts:292](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/DataTable/types.ts#L292)
165
+ [packages/core/src/components/DataTable/types.ts:302](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/DataTable/types.ts#L302)
166
166
 
167
167
  ___
168
168
 
@@ -174,7 +174,7 @@ Icon component for parent rows (overrides icon when showForParent is true)
174
174
 
175
175
  #### Defined in
176
176
 
177
- [packages/core/src/components/DataTable/types.ts:294](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/DataTable/types.ts#L294)
177
+ [packages/core/src/components/DataTable/types.ts:304](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/DataTable/types.ts#L304)
178
178
 
179
179
  ___
180
180
 
@@ -186,7 +186,7 @@ Icon component for child rows (overrides icon when showForChild is true)
186
186
 
187
187
  #### Defined in
188
188
 
189
- [packages/core/src/components/DataTable/types.ts:296](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/DataTable/types.ts#L296)
189
+ [packages/core/src/components/DataTable/types.ts:306](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/DataTable/types.ts#L306)
190
190
 
191
191
  ___
192
192
 
@@ -198,7 +198,7 @@ Label for parent rows (overrides label when showForParent is true)
198
198
 
199
199
  #### Defined in
200
200
 
201
- [packages/core/src/components/DataTable/types.ts:298](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/DataTable/types.ts#L298)
201
+ [packages/core/src/components/DataTable/types.ts:308](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/DataTable/types.ts#L308)
202
202
 
203
203
  ___
204
204
 
@@ -210,4 +210,4 @@ Label for child rows (overrides label when showForChild is true)
210
210
 
211
211
  #### Defined in
212
212
 
213
- [packages/core/src/components/DataTable/types.ts:300](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/DataTable/types.ts#L300)
213
+ [packages/core/src/components/DataTable/types.ts:310](https://github.com/jmruthers/pace-core/blob/main/packages/core/src/components/DataTable/types.ts#L310)