@jmruthers/pace-core 0.5.54 → 0.5.55
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.
- package/README.md +0 -4
- package/dist/{DataTable-7FMFXA7A.js → DataTable-4T627QFJ.js} +11 -11
- package/dist/{PublicLoadingSpinner-Bq_-BeK-.d.ts → PublicLoadingSpinner-SL8WaQN7.d.ts} +2 -21
- package/dist/{api-H5A3H4IR.js → api-LUNF5O6M.js} +3 -3
- package/dist/{appConfig-BVGyuvI7.d.ts → appConfig-DjpeG6P-.d.ts} +9 -1
- package/dist/{appNameResolver-7GHF5ED2.js → appNameResolver-UURKN7NF.js} +2 -2
- package/dist/{audit-BUW3LMJB.js → audit-6TOCAMKO.js} +2 -2
- package/dist/{chunk-MZBUOP4P.js → chunk-5BSLGBYI.js} +4 -3
- package/dist/chunk-5BSLGBYI.js.map +1 -0
- package/dist/{chunk-I5Z3QH5X.js → chunk-66C4BSAY.js} +2 -2
- package/dist/{chunk-I5Z3QH5X.js.map → chunk-66C4BSAY.js.map} +1 -1
- package/dist/{chunk-MYP2EGHX.js → chunk-AJ2KMES7.js} +21 -14
- package/dist/chunk-AJ2KMES7.js.map +1 -0
- package/dist/{chunk-EL2O4IUX.js → chunk-AQFRLC7K.js} +16 -24
- package/dist/{chunk-EL2O4IUX.js.map → chunk-AQFRLC7K.js.map} +1 -1
- package/dist/{chunk-7BNPOCLL.js → chunk-B2WTCLCV.js} +6 -2
- package/dist/chunk-B2WTCLCV.js.map +1 -0
- package/dist/{chunk-WJARTBCT.js → chunk-D7ARGIA3.js} +16 -7
- package/dist/chunk-D7ARGIA3.js.map +1 -0
- package/dist/{chunk-NRK4AIHQ.js → chunk-KBRACSJI.js} +3 -3
- package/dist/{chunk-NYUJ4FJR.js → chunk-KJDPSM64.js} +7 -7
- package/dist/chunk-KJDPSM64.js.map +1 -0
- package/dist/{chunk-GWSBHC4J.js → chunk-KLPVOPRI.js} +261 -38
- package/dist/chunk-KLPVOPRI.js.map +1 -0
- package/dist/{chunk-TRIZ7IB7.js → chunk-MPQDF75X.js} +148 -288
- package/dist/chunk-MPQDF75X.js.map +1 -0
- package/dist/{chunk-MSFACPQQ.js → chunk-PAEM3OWN.js} +11 -11
- package/dist/{chunk-MSFACPQQ.js.map → chunk-PAEM3OWN.js.map} +1 -1
- package/dist/{chunk-GIO7BFE7.js → chunk-RQD3D2CO.js} +66 -169
- package/dist/{chunk-GIO7BFE7.js.map → chunk-RQD3D2CO.js.map} +1 -1
- package/dist/{chunk-YDJW5XTN.js → chunk-STT7INZR.js} +25 -1
- package/dist/chunk-STT7INZR.js.map +1 -0
- package/dist/{chunk-6MTY77WU.js → chunk-TNMXZLDR.js} +3 -3
- package/dist/{chunk-BC3S53OZ.js → chunk-UQE2Y64H.js} +30 -14
- package/dist/chunk-UQE2Y64H.js.map +1 -0
- package/dist/{chunk-22KLBHPS.js → chunk-W66AZIOH.js} +2 -2
- package/dist/chunk-W66AZIOH.js.map +1 -0
- package/dist/{chunk-SS3E6QLB.js → chunk-YNUBMSMV.js} +2 -2
- package/dist/chunk-YNUBMSMV.js.map +1 -0
- package/dist/{chunk-NZ655MWE.js → chunk-ZOD2ZY6X.js} +5 -4
- package/dist/chunk-ZOD2ZY6X.js.map +1 -0
- package/dist/{chunk-74C6SNEC.js → chunk-ZPK5656W.js} +3 -3
- package/dist/{chunk-74C6SNEC.js.map → chunk-ZPK5656W.js.map} +1 -1
- package/dist/components.d.ts +22 -899
- package/dist/components.js +436 -3118
- package/dist/components.js.map +1 -1
- package/dist/file-reference-9xUOnwyt.d.ts +70 -0
- package/dist/hooks.d.ts +2 -2
- package/dist/hooks.js +10 -10
- package/dist/hooks.js.map +1 -1
- package/dist/index.d.ts +49 -9
- package/dist/index.js +190 -25
- package/dist/index.js.map +1 -1
- package/dist/{organisation-CO3Sh3_D.d.ts → organisation-t-vvQC3g.d.ts} +1 -8
- package/dist/providers.d.ts +2 -2
- package/dist/providers.js +5 -5
- package/dist/rbac/index.d.ts +65 -46
- package/dist/rbac/index.js +10 -12
- package/dist/styles/core.css +0 -125
- package/dist/types.d.ts +2 -1
- package/dist/types.js +3 -1
- package/dist/types.js.map +1 -1
- package/dist/{usePublicRouteParams-B2OcAsur.d.ts → usePublicRouteParams-CdoFxnJK.d.ts} +1 -1
- package/dist/utils.d.ts +3 -4
- package/dist/utils.js +44 -13
- package/dist/utils.js.map +1 -1
- package/docs/FILE_REFERENCE_SYSTEM.md +440 -0
- package/docs/INDEX.md +7 -5
- package/docs/README.md +0 -1
- package/docs/api/README.md +0 -4
- package/docs/api/classes/ErrorBoundary.md +1 -1
- package/docs/api/classes/InvalidScopeError.md +1 -1
- package/docs/api/classes/MissingUserContextError.md +1 -1
- package/docs/api/classes/OrganisationContextRequiredError.md +1 -1
- package/docs/api/classes/PermissionDeniedError.md +2 -2
- package/docs/api/classes/PublicErrorBoundary.md +1 -1
- package/docs/api/classes/RBACAuditManager.md +12 -12
- package/docs/api/classes/RBACCache.md +1 -1
- package/docs/api/classes/RBACEngine.md +6 -6
- package/docs/api/classes/RBACError.md +1 -1
- package/docs/api/classes/RBACNotInitializedError.md +1 -1
- package/docs/api/classes/SecureSupabaseClient.md +1 -1
- package/docs/api/classes/StorageUtils.md +281 -0
- package/docs/api/interfaces/AggregateConfig.md +1 -1
- package/docs/api/interfaces/ButtonProps.md +1 -1
- package/docs/api/interfaces/CardProps.md +1 -1
- package/docs/api/interfaces/ColorPalette.md +1 -1
- package/docs/api/interfaces/ColorShade.md +1 -1
- package/docs/api/interfaces/DataAccessRecord.md +1 -1
- package/docs/api/interfaces/DataTableAction.md +1 -1
- package/docs/api/interfaces/DataTableColumn.md +1 -1
- package/docs/api/interfaces/DataTableProps.md +1 -1
- package/docs/api/interfaces/DataTableToolbarButton.md +1 -1
- package/docs/api/interfaces/EmptyStateConfig.md +1 -1
- package/docs/api/interfaces/EnhancedNavigationMenuProps.md +1 -1
- package/docs/api/interfaces/EventContextType.md +1 -1
- package/docs/api/interfaces/EventLogoProps.md +1 -1
- package/docs/api/interfaces/EventProviderProps.md +1 -1
- package/docs/api/interfaces/FileSizeLimits.md +1 -1
- package/docs/api/interfaces/FileUploadProps.md +1 -1
- package/docs/api/interfaces/FooterProps.md +1 -1
- package/docs/api/interfaces/InactivityWarningModalProps.md +1 -1
- package/docs/api/interfaces/InputProps.md +1 -1
- package/docs/api/interfaces/LabelProps.md +1 -1
- package/docs/api/interfaces/LoginFormProps.md +1 -1
- package/docs/api/interfaces/NavigationAccessRecord.md +2 -2
- package/docs/api/interfaces/NavigationContextType.md +1 -1
- package/docs/api/interfaces/NavigationGuardProps.md +1 -1
- package/docs/api/interfaces/NavigationItem.md +1 -1
- package/docs/api/interfaces/NavigationMenuProps.md +1 -1
- package/docs/api/interfaces/NavigationProviderProps.md +1 -1
- package/docs/api/interfaces/Organisation.md +1 -1
- package/docs/api/interfaces/OrganisationContextType.md +1 -1
- package/docs/api/interfaces/OrganisationMembership.md +1 -1
- package/docs/api/interfaces/OrganisationProviderProps.md +1 -1
- package/docs/api/interfaces/OrganisationSecurityError.md +1 -1
- package/docs/api/interfaces/PaceAppLayoutProps.md +1 -1
- package/docs/api/interfaces/PaceLoginPageProps.md +1 -1
- package/docs/api/interfaces/PageAccessRecord.md +1 -1
- package/docs/api/interfaces/PagePermissionContextType.md +1 -1
- package/docs/api/interfaces/PagePermissionGuardProps.md +1 -1
- package/docs/api/interfaces/PagePermissionProviderProps.md +1 -1
- package/docs/api/interfaces/PaletteData.md +1 -1
- package/docs/api/interfaces/PermissionEnforcerProps.md +4 -4
- package/docs/api/interfaces/PublicErrorBoundaryProps.md +1 -1
- package/docs/api/interfaces/PublicErrorBoundaryState.md +1 -1
- package/docs/api/interfaces/PublicLoadingSpinnerProps.md +1 -1
- package/docs/api/interfaces/PublicPageFooterProps.md +1 -1
- package/docs/api/interfaces/PublicPageHeaderProps.md +1 -1
- package/docs/api/interfaces/PublicPageLayoutProps.md +1 -1
- package/docs/api/interfaces/RBACConfig.md +1 -1
- package/docs/api/interfaces/RBACContextType.md +1 -1
- package/docs/api/interfaces/RBACLogger.md +1 -1
- package/docs/api/interfaces/RBACProviderProps.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterContextType.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterProps.md +1 -1
- package/docs/api/interfaces/RouteAccessRecord.md +2 -2
- package/docs/api/interfaces/RouteConfig.md +2 -2
- package/docs/api/interfaces/SecureDataContextType.md +1 -1
- package/docs/api/interfaces/SecureDataProviderProps.md +1 -1
- package/docs/api/interfaces/StorageConfig.md +1 -1
- package/docs/api/interfaces/StorageFileInfo.md +1 -1
- package/docs/api/interfaces/StorageFileMetadata.md +1 -1
- package/docs/api/interfaces/StorageListOptions.md +1 -1
- package/docs/api/interfaces/StorageListResult.md +1 -1
- package/docs/api/interfaces/StorageUploadOptions.md +1 -1
- package/docs/api/interfaces/StorageUploadResult.md +1 -1
- package/docs/api/interfaces/StorageUrlOptions.md +1 -1
- package/docs/api/interfaces/StyleImport.md +1 -1
- package/docs/api/interfaces/ToastActionElement.md +1 -1
- package/docs/api/interfaces/ToastProps.md +1 -1
- package/docs/api/interfaces/UnifiedAuthContextType.md +1 -1
- package/docs/api/interfaces/UnifiedAuthProviderProps.md +1 -1
- package/docs/api/interfaces/UseInactivityTrackerOptions.md +1 -1
- package/docs/api/interfaces/UseInactivityTrackerReturn.md +1 -1
- package/docs/api/interfaces/UsePublicEventLogoOptions.md +1 -1
- package/docs/api/interfaces/UsePublicEventLogoReturn.md +1 -1
- package/docs/api/interfaces/UsePublicEventOptions.md +1 -1
- package/docs/api/interfaces/UsePublicEventReturn.md +1 -1
- package/docs/api/interfaces/UsePublicRouteParamsReturn.md +1 -1
- package/docs/api/interfaces/UserEventAccess.md +1 -1
- package/docs/api/interfaces/UserMenuProps.md +1 -1
- package/docs/api/interfaces/UserProfile.md +1 -1
- package/docs/api/modules.md +204 -200
- package/docs/api-reference/components.md +141 -163
- package/docs/api-reference/hooks.md +347 -0
- package/docs/core-concepts/rbac-system.md +69 -16
- package/docs/getting-started/examples/basic-auth-app.md +0 -1
- package/docs/implementation-guides/datatable-rbac-usage.md +12 -11
- package/docs/implementation-guides/file-upload-storage.md +733 -0
- package/docs/implementation-guides/inactivity-tracking.md +779 -0
- package/docs/implementation-guides/organisation-security.md +748 -0
- package/docs/implementation-guides/public-pages-advanced.md +1022 -0
- package/docs/migration/MIGRATION_GUIDE.md +684 -0
- package/docs/migration/README.md +13 -2
- package/docs/migration/rbac-migration.md +73 -0
- package/docs/rbac/examples/rbac-rls-integration-example.md +11 -13
- package/docs/style-guide.md +269 -1
- package/package.json +1 -1
- package/src/__tests__/TESTING_GUIDELINES.md +331 -18
- package/src/__tests__/helpers/supabaseMock.ts +99 -0
- package/src/__tests__/rbac/PagePermissionGuard.test.tsx +10 -7
- package/src/__tests__/shared.ts +6 -0
- package/src/components/DataTable/components/ActionButtons.tsx +2 -2
- package/src/components/DataTable/components/DataTableCore.tsx +2 -2
- package/src/components/DataTable/components/UnifiedTableBody.tsx +1 -1
- package/src/components/DataTable/utils/debugTools.ts +2 -2
- package/src/components/Dialog/Dialog.test.tsx +12 -2
- package/src/components/ErrorBoundary/ErrorBoundary.test.tsx +6 -6
- package/src/components/ErrorBoundary/ErrorBoundary.tsx +2 -2
- package/src/components/FileDisplay.tsx +233 -0
- package/src/components/FileUpload.tsx +176 -0
- package/src/components/Footer/Footer.test.tsx +7 -7
- package/src/components/NavigationMenu/NavigationMenu.test.tsx +13 -6
- package/src/components/OrganisationSelector/OrganisationSelector.test.tsx +30 -3
- package/src/components/OrganisationSelector/OrganisationSelector.tsx +1 -1
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.rbac.test.tsx +558 -0
- package/src/components/PublicLayout/PublicErrorBoundary.tsx +1 -1
- package/src/components/PublicLayout/PublicPageDebugger.tsx +2 -2
- package/src/components/PublicLayout/PublicPageDiagnostic.tsx +2 -2
- package/src/components/PublicLayout/PublicPageProvider.tsx +2 -2
- package/src/components/Select/Select.test.tsx +50 -15
- package/src/components/SuperAdminGuard.tsx +2 -2
- package/src/components/__tests__/SuperAdminGuard.test.tsx +559 -0
- package/src/components/index.ts +0 -183
- package/src/hooks/__tests__/useOrganisationPermissions.unit.test.tsx +2 -2
- package/src/hooks/__tests__/usePermissionCache.unit.test.ts +1 -1
- package/src/hooks/__tests__/useRBAC.unit.test.ts +191 -138
- package/src/hooks/public/usePublicEvent.ts +2 -2
- package/src/hooks/useAppConfig.ts +3 -3
- package/src/hooks/useComponentPerformance.ts +1 -1
- package/src/hooks/useDataTablePerformance.ts +1 -1
- package/src/hooks/useFileReference.ts +232 -0
- package/src/hooks/useOrganisationPermissions.test.ts +254 -344
- package/src/hooks/useOrganisationPermissions.ts +15 -7
- package/src/hooks/useOrganisationSecurity.test.ts +390 -402
- package/src/hooks/usePerformanceMonitor.ts +1 -1
- package/src/hooks/usePermissionCache.test.ts +264 -395
- package/src/hooks/usePermissionCache.ts +34 -4
- package/src/hooks/useSecureDataAccess.test.ts +486 -0
- package/src/hooks/useSecureDataAccess.ts +4 -1
- package/src/providers/InactivityProvider.tsx +2 -2
- package/src/providers/OrganisationProvider.test.simple.tsx +168 -0
- package/src/providers/OrganisationProvider.test.tsx +168 -0
- package/src/providers/OrganisationProvider.tsx +18 -31
- package/src/providers/UnifiedAuthProvider.test.simple.tsx +205 -0
- package/src/providers/UnifiedAuthProvider.test.tsx +128 -0
- package/src/providers/__tests__/InactivityProvider.test.tsx +3 -4
- package/src/providers/__tests__/OrganisationProvider.test.tsx +19 -14
- package/src/rbac/__tests__/integration.authflow.test.tsx +123 -0
- package/src/rbac/__tests__/integration.navigation.test.tsx +72 -0
- package/src/rbac/__tests__/integration.securedata.test.tsx +92 -0
- package/src/rbac/__tests__/integration.smoke.test.tsx +73 -0
- package/src/rbac/__tests__/rbac-core.test.tsx +26 -22
- package/src/rbac/__tests__/rbac-engine-core-logic.test.ts +411 -0
- package/src/rbac/__tests__/rbac-engine-simplified.test.ts +285 -0
- package/src/rbac/__tests__/rbac-functions.test.ts +655 -0
- package/src/rbac/__tests__/rbac-integration.test.ts +532 -0
- package/src/rbac/__tests__/scenarios.user-role.test.tsx +196 -0
- package/src/rbac/api.test.ts +6 -6
- package/src/rbac/api.ts +2 -2
- package/src/rbac/audit.test.ts +485 -0
- package/src/rbac/audit.ts +7 -1
- package/src/rbac/cache-invalidation.ts +318 -0
- package/src/rbac/cache.test.ts +286 -0
- package/src/rbac/components/EnhancedNavigationMenu.test.tsx +559 -0
- package/src/rbac/components/EnhancedNavigationMenu.tsx +29 -23
- package/src/rbac/components/NavigationProvider.test.tsx +449 -0
- package/src/rbac/components/PagePermissionGuard.tsx +4 -4
- package/src/rbac/components/PagePermissionProvider.test.tsx +479 -0
- package/src/rbac/components/SecureDataProvider.test.tsx +511 -0
- package/src/rbac/components/__tests__/PagePermissionGuard.race-condition.test.tsx +159 -430
- package/src/rbac/components/__tests__/PagePermissionGuard.test.tsx +4 -5
- package/src/rbac/components/__tests__/PagePermissionGuard.verification.test.tsx +112 -118
- package/src/rbac/config.test.ts +410 -0
- package/src/rbac/engine.test.simple.ts +237 -0
- package/src/rbac/engine.test.ts +233 -0
- package/src/rbac/engine.ts +37 -41
- package/src/rbac/examples/CompleteRBACExample.tsx +3 -3
- package/src/rbac/examples/EventBasedApp.tsx +4 -4
- package/src/rbac/hooks/useRBAC.simple.test.ts +16 -0
- package/src/rbac/hooks/useRBAC.test.ts +207 -455
- package/src/rbac/hooks/useRBAC.ts +30 -22
- package/src/rbac/permissions.test.ts +128 -0
- package/src/rbac/permissions.ts +56 -141
- package/src/rbac/providers/RBACProvider.tsx +1 -1
- package/src/rbac/secureClient.test.ts +444 -0
- package/src/rbac/security.test.ts +390 -0
- package/src/rbac/security.ts +1 -1
- package/src/rbac/types.test.ts +382 -0
- package/src/rbac/types.ts +2 -2
- package/src/styles/core.css +0 -125
- package/src/types/file-reference.ts +77 -0
- package/src/types/rbac-functions.ts +290 -0
- package/src/types/supabase.ts +10 -28
- package/src/types/unified.ts +4 -1
- package/src/utils/__tests__/bundleAnalysis.unit.test.ts +81 -55
- package/src/utils/__tests__/lazyLoad.unit.test.tsx +21 -12
- package/src/utils/__tests__/organisationContext.unit.test.ts +13 -7
- package/src/utils/__tests__/performanceBudgets.unit.test.ts +3 -3
- package/src/utils/__tests__/sessionTracking.unit.test.ts +32 -12
- package/src/utils/appConfig.ts +1 -1
- package/src/utils/appIdResolver.test.ts +503 -0
- package/src/utils/appIdResolver.ts +1 -1
- package/src/utils/appNameResolver.test.ts +494 -0
- package/src/utils/appNameResolver.ts +3 -2
- package/src/utils/bundleAnalysis.ts +3 -3
- package/src/utils/debugLogger.ts +1 -1
- package/src/utils/file-reference.ts +263 -0
- package/src/utils/formatDate.test.ts +2 -2
- package/src/utils/organisationContext.test.ts +340 -0
- package/src/utils/organisationContext.ts +19 -6
- package/src/utils/performanceBudgets.ts +2 -2
- package/src/utils/permissionUtils.test.ts +393 -0
- package/src/utils/permissionUtils.ts +5 -2
- package/src/utils/secureDataAccess.test.ts +715 -0
- package/src/utils/secureDataAccess.ts +21 -5
- package/src/utils/sessionTracking.ts +34 -4
- package/src/utils/storage/__tests__/helpers.unit.test.ts +328 -0
- package/src/utils/storage/__tests__/index.unit.test.ts +16 -0
- package/src/utils/storage/helpers.ts +20 -25
- package/src/utils/storage/index.ts +29 -1
- package/src/vite-env.d.ts +17 -0
- package/dist/chunk-22KLBHPS.js.map +0 -1
- package/dist/chunk-7BNPOCLL.js.map +0 -1
- package/dist/chunk-BC3S53OZ.js.map +0 -1
- package/dist/chunk-GWSBHC4J.js.map +0 -1
- package/dist/chunk-MYP2EGHX.js.map +0 -1
- package/dist/chunk-MZBUOP4P.js.map +0 -1
- package/dist/chunk-NYUJ4FJR.js.map +0 -1
- package/dist/chunk-NZ655MWE.js.map +0 -1
- package/dist/chunk-SS3E6QLB.js.map +0 -1
- package/dist/chunk-TRIZ7IB7.js.map +0 -1
- package/dist/chunk-WJARTBCT.js.map +0 -1
- package/dist/chunk-YDJW5XTN.js.map +0 -1
- package/docs/print-components/README.md +0 -258
- package/docs/print-components/api-reference.md +0 -636
- package/docs/print-components/examples/README.md +0 -204
- package/docs/print-components/examples/basic-report.tsx +0 -92
- package/docs/print-components/examples/card-catalog.tsx +0 -149
- package/docs/print-components/examples/cover-page-report.tsx +0 -163
- package/docs/print-components/quick-start.md +0 -363
- package/src/components/PrintButton/PrintButton.tsx +0 -321
- package/src/components/PrintButton/PrintButtonGroup.tsx +0 -84
- package/src/components/PrintButton/PrintToolbar.tsx +0 -94
- package/src/components/PrintButton/__tests__/PrintButton.test.tsx +0 -271
- package/src/components/PrintButton/examples/PrintButtonShowcase.tsx +0 -438
- package/src/components/PrintButton/index.ts +0 -33
- package/src/components/PrintButton/types.ts +0 -173
- package/src/components/PrintCard/PrintCard.tsx +0 -154
- package/src/components/PrintCard/PrintCardContent.tsx +0 -57
- package/src/components/PrintCard/PrintCardFooter.tsx +0 -60
- package/src/components/PrintCard/PrintCardGrid.tsx +0 -91
- package/src/components/PrintCard/PrintCardHeader.tsx +0 -78
- package/src/components/PrintCard/PrintCardImage.tsx +0 -81
- package/src/components/PrintCard/examples/PrintCardShowcase.tsx +0 -239
- package/src/components/PrintCard/index.ts +0 -34
- package/src/components/PrintCard/types.ts +0 -171
- package/src/components/PrintDataTable/PrintDataTable.tsx +0 -215
- package/src/components/PrintDataTable/PrintTableGroup.tsx +0 -90
- package/src/components/PrintDataTable/PrintTableRow.tsx +0 -76
- package/src/components/PrintDataTable/index.ts +0 -25
- package/src/components/PrintDataTable/types.ts +0 -67
- package/src/components/PrintFooter/PrintFooter.tsx +0 -183
- package/src/components/PrintFooter/PrintFooterContent.tsx +0 -71
- package/src/components/PrintFooter/PrintFooterInfo.tsx +0 -86
- package/src/components/PrintFooter/PrintPageNumber.tsx +0 -90
- package/src/components/PrintFooter/examples/PrintFooterShowcase.tsx +0 -390
- package/src/components/PrintFooter/index.ts +0 -30
- package/src/components/PrintFooter/types.ts +0 -149
- package/src/components/PrintGrid/PrintGrid.tsx +0 -180
- package/src/components/PrintGrid/PrintGridBreakpoint.tsx +0 -109
- package/src/components/PrintGrid/PrintGridContainer.tsx +0 -128
- package/src/components/PrintGrid/PrintGridItem.tsx +0 -220
- package/src/components/PrintGrid/examples/PrintGridShowcase.tsx +0 -359
- package/src/components/PrintGrid/index.ts +0 -31
- package/src/components/PrintGrid/types.ts +0 -159
- package/src/components/PrintHeader/PrintCoverHeader.tsx +0 -230
- package/src/components/PrintHeader/PrintHeader.tsx +0 -150
- package/src/components/PrintHeader/index.ts +0 -17
- package/src/components/PrintHeader/types.ts +0 -42
- package/src/components/PrintLayout/PrintLayout.tsx +0 -122
- package/src/components/PrintLayout/PrintLayoutContext.tsx +0 -66
- package/src/components/PrintLayout/PrintPageBreak.tsx +0 -52
- package/src/components/PrintLayout/examples/PrintShowcase.tsx +0 -230
- package/src/components/PrintLayout/index.ts +0 -19
- package/src/components/PrintLayout/types.ts +0 -37
- package/src/components/PrintPageBreak/PrintPageBreak.tsx +0 -120
- package/src/components/PrintPageBreak/PrintPageBreakGroup.tsx +0 -90
- package/src/components/PrintPageBreak/PrintPageBreakIndicator.tsx +0 -112
- package/src/components/PrintPageBreak/examples/PrintPageBreakShowcase.tsx +0 -279
- package/src/components/PrintPageBreak/index.ts +0 -23
- package/src/components/PrintPageBreak/types.ts +0 -94
- package/src/components/PrintSection/PrintColumn.tsx +0 -104
- package/src/components/PrintSection/PrintDivider.tsx +0 -101
- package/src/components/PrintSection/PrintSection.tsx +0 -129
- package/src/components/PrintSection/PrintSectionContent.tsx +0 -75
- package/src/components/PrintSection/PrintSectionHeader.tsx +0 -97
- package/src/components/PrintSection/examples/PrintSectionShowcase.tsx +0 -258
- package/src/components/PrintSection/index.ts +0 -33
- package/src/components/PrintSection/types.ts +0 -155
- package/src/components/PrintText/PrintText.tsx +0 -116
- package/src/components/PrintText/index.ts +0 -16
- package/src/components/PrintText/types.ts +0 -24
- package/src/rbac/__tests__/integration.test.tsx +0 -218
- package/src/utils/print/PrintDataProcessor.ts +0 -390
- package/src/utils/print/examples/PrintUtilitiesShowcase.tsx +0 -397
- package/src/utils/print/index.ts +0 -29
- package/src/utils/print/types.ts +0 -196
- package/src/utils/print/usePrintOptimization.ts +0 -272
- /package/dist/{DataTable-7FMFXA7A.js.map → DataTable-4T627QFJ.js.map} +0 -0
- /package/dist/{api-H5A3H4IR.js.map → api-LUNF5O6M.js.map} +0 -0
- /package/dist/{appNameResolver-7GHF5ED2.js.map → appNameResolver-UURKN7NF.js.map} +0 -0
- /package/dist/{audit-BUW3LMJB.js.map → audit-6TOCAMKO.js.map} +0 -0
- /package/dist/{chunk-NRK4AIHQ.js.map → chunk-KBRACSJI.js.map} +0 -0
- /package/dist/{chunk-6MTY77WU.js.map → chunk-TNMXZLDR.js.map} +0 -0
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file PrintCard Showcase Example
|
|
3
|
-
* @package @jmruthers/pace-core
|
|
4
|
-
* @module PrintCardShowcase
|
|
5
|
-
* @since 0.4.38
|
|
6
|
-
*
|
|
7
|
-
* Example showcasing PrintCard components usage.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import React from 'react';
|
|
11
|
-
import {
|
|
12
|
-
PrintLayout,
|
|
13
|
-
PrintHeader,
|
|
14
|
-
PrintText,
|
|
15
|
-
PrintCard,
|
|
16
|
-
PrintCardHeader,
|
|
17
|
-
PrintCardContent,
|
|
18
|
-
PrintCardFooter,
|
|
19
|
-
PrintCardImage,
|
|
20
|
-
PrintCardGrid
|
|
21
|
-
} from '../../index';
|
|
22
|
-
|
|
23
|
-
export function PrintCardShowcase() {
|
|
24
|
-
return (
|
|
25
|
-
<PrintLayout
|
|
26
|
-
orientation="portrait"
|
|
27
|
-
pageSize="A4"
|
|
28
|
-
firstPageHeader={
|
|
29
|
-
<PrintHeader
|
|
30
|
-
title="Print Card Components Showcase"
|
|
31
|
-
subtitle="Demonstrating various card layouts and configurations"
|
|
32
|
-
branding={{
|
|
33
|
-
logo: "/pace_logo_square.svg",
|
|
34
|
-
companyName: "Pace Core"
|
|
35
|
-
}}
|
|
36
|
-
metadata={[
|
|
37
|
-
{ label: 'Date', value: new Date().toLocaleDateString() },
|
|
38
|
-
{ label: 'Page', value: "1" }
|
|
39
|
-
]}
|
|
40
|
-
/>
|
|
41
|
-
}
|
|
42
|
-
>
|
|
43
|
-
<div className="space-y-8">
|
|
44
|
-
{/* Basic Card Examples */}
|
|
45
|
-
<section>
|
|
46
|
-
<PrintText variant="heading" className="mb-4">
|
|
47
|
-
Basic Card Examples
|
|
48
|
-
</PrintText>
|
|
49
|
-
|
|
50
|
-
<PrintCardGrid columns={2} gap="md">
|
|
51
|
-
<PrintCard title="Default Card" variant="default">
|
|
52
|
-
<PrintCardContent>
|
|
53
|
-
<PrintText>
|
|
54
|
-
This is a default card with standard styling and padding.
|
|
55
|
-
</PrintText>
|
|
56
|
-
</PrintCardContent>
|
|
57
|
-
</PrintCard>
|
|
58
|
-
|
|
59
|
-
<PrintCard title="Outlined Card" variant="outlined">
|
|
60
|
-
<PrintCardContent>
|
|
61
|
-
<PrintText>
|
|
62
|
-
This card uses the outlined variant with a border and transparent background.
|
|
63
|
-
</PrintText>
|
|
64
|
-
</PrintCardContent>
|
|
65
|
-
</PrintCard>
|
|
66
|
-
|
|
67
|
-
<PrintCard title="Filled Card" variant="filled" backgroundColor="gray">
|
|
68
|
-
<PrintCardContent>
|
|
69
|
-
<PrintText>
|
|
70
|
-
This card uses the filled variant with a muted background.
|
|
71
|
-
</PrintText>
|
|
72
|
-
</PrintCardContent>
|
|
73
|
-
</PrintCard>
|
|
74
|
-
|
|
75
|
-
<PrintCard title="Elevated Card" variant="elevated">
|
|
76
|
-
<PrintCardContent>
|
|
77
|
-
<PrintText>
|
|
78
|
-
This card uses the elevated variant with a shadow effect.
|
|
79
|
-
</PrintText>
|
|
80
|
-
</PrintCardContent>
|
|
81
|
-
</PrintCard>
|
|
82
|
-
</PrintCardGrid>
|
|
83
|
-
</section>
|
|
84
|
-
|
|
85
|
-
{/* Card with Image */}
|
|
86
|
-
<section>
|
|
87
|
-
<PrintText variant="heading" className="mb-4">
|
|
88
|
-
Card with Image
|
|
89
|
-
</PrintText>
|
|
90
|
-
|
|
91
|
-
<PrintCardGrid columns={2} gap="md">
|
|
92
|
-
<PrintCard title="Product Card" layout="vertical">
|
|
93
|
-
<PrintCardImage
|
|
94
|
-
src="/pace_logo_square.svg"
|
|
95
|
-
alt="Product Image"
|
|
96
|
-
aspectRatio="square"
|
|
97
|
-
objectFit="contain"
|
|
98
|
-
/>
|
|
99
|
-
<PrintCardContent>
|
|
100
|
-
<PrintText variant="subheading" weight="semibold">
|
|
101
|
-
Premium Product
|
|
102
|
-
</PrintText>
|
|
103
|
-
<PrintText variant="caption" color="muted">
|
|
104
|
-
High-quality item with excellent features
|
|
105
|
-
</PrintText>
|
|
106
|
-
<PrintText className="mt-2">
|
|
107
|
-
$99.99
|
|
108
|
-
</PrintText>
|
|
109
|
-
</PrintCardContent>
|
|
110
|
-
</PrintCard>
|
|
111
|
-
|
|
112
|
-
<PrintCard title="Profile Card" layout="horizontal">
|
|
113
|
-
<PrintCardImage
|
|
114
|
-
src="/pace_logo_square.svg"
|
|
115
|
-
alt="Profile Picture"
|
|
116
|
-
aspectRatio="square"
|
|
117
|
-
width="80"
|
|
118
|
-
height="80"
|
|
119
|
-
/>
|
|
120
|
-
<PrintCardContent>
|
|
121
|
-
<PrintText variant="subheading" weight="semibold">
|
|
122
|
-
John Doe
|
|
123
|
-
</PrintText>
|
|
124
|
-
<PrintText variant="caption" color="muted">
|
|
125
|
-
Software Engineer
|
|
126
|
-
</PrintText>
|
|
127
|
-
<PrintText className="mt-2">
|
|
128
|
-
john.doe@example.com
|
|
129
|
-
</PrintText>
|
|
130
|
-
</PrintCardContent>
|
|
131
|
-
</PrintCard>
|
|
132
|
-
</PrintCardGrid>
|
|
133
|
-
</section>
|
|
134
|
-
|
|
135
|
-
{/* Card with Header and Footer */}
|
|
136
|
-
<section>
|
|
137
|
-
<PrintText variant="heading" className="mb-4">
|
|
138
|
-
Card with Header and Footer
|
|
139
|
-
</PrintText>
|
|
140
|
-
|
|
141
|
-
<PrintCardGrid columns={1} gap="md">
|
|
142
|
-
<PrintCard>
|
|
143
|
-
<PrintCardHeader
|
|
144
|
-
title="Project Status"
|
|
145
|
-
subtitle="Current project progress and updates"
|
|
146
|
-
actions={<PrintText variant="caption">Last updated: Today</PrintText>}
|
|
147
|
-
>
|
|
148
|
-
<PrintText variant="heading">Project Status</PrintText>
|
|
149
|
-
</PrintCardHeader>
|
|
150
|
-
<PrintCardContent>
|
|
151
|
-
<PrintText>
|
|
152
|
-
The project is progressing well with all major milestones completed on time.
|
|
153
|
-
The team has been working diligently to ensure quality deliverables.
|
|
154
|
-
</PrintText>
|
|
155
|
-
<PrintText className="mt-2">
|
|
156
|
-
<strong>Next Steps:</strong> Final testing and deployment preparation.
|
|
157
|
-
</PrintText>
|
|
158
|
-
</PrintCardContent>
|
|
159
|
-
<PrintCardFooter align="right">
|
|
160
|
-
<PrintText variant="caption" color="muted">
|
|
161
|
-
Project Manager: Jane Smith
|
|
162
|
-
</PrintText>
|
|
163
|
-
</PrintCardFooter>
|
|
164
|
-
</PrintCard>
|
|
165
|
-
</PrintCardGrid>
|
|
166
|
-
</section>
|
|
167
|
-
|
|
168
|
-
{/* Compact Cards */}
|
|
169
|
-
<section>
|
|
170
|
-
<PrintText variant="heading" className="mb-4">
|
|
171
|
-
Compact Cards
|
|
172
|
-
</PrintText>
|
|
173
|
-
|
|
174
|
-
<PrintCardGrid columns={3} gap="sm">
|
|
175
|
-
<PrintCard layout="compact" size="sm" variant="outlined">
|
|
176
|
-
<PrintText variant="small" weight="semibold">
|
|
177
|
-
Quick Stats
|
|
178
|
-
</PrintText>
|
|
179
|
-
<PrintText variant="small">
|
|
180
|
-
1,234 items
|
|
181
|
-
</PrintText>
|
|
182
|
-
</PrintCard>
|
|
183
|
-
|
|
184
|
-
<PrintCard layout="compact" size="sm" variant="outlined">
|
|
185
|
-
<PrintText variant="small" weight="semibold">
|
|
186
|
-
Status
|
|
187
|
-
</PrintText>
|
|
188
|
-
<PrintText variant="small" color="accent">
|
|
189
|
-
Active
|
|
190
|
-
</PrintText>
|
|
191
|
-
</PrintCard>
|
|
192
|
-
|
|
193
|
-
<PrintCard layout="compact" size="sm" variant="outlined">
|
|
194
|
-
<PrintText variant="small" weight="semibold">
|
|
195
|
-
Priority
|
|
196
|
-
</PrintText>
|
|
197
|
-
<PrintText variant="small" color="primary">
|
|
198
|
-
High
|
|
199
|
-
</PrintText>
|
|
200
|
-
</PrintCard>
|
|
201
|
-
</PrintCardGrid>
|
|
202
|
-
</section>
|
|
203
|
-
|
|
204
|
-
{/* Color Variations */}
|
|
205
|
-
<section>
|
|
206
|
-
<PrintText variant="heading" className="mb-4">
|
|
207
|
-
Color Variations
|
|
208
|
-
</PrintText>
|
|
209
|
-
|
|
210
|
-
<PrintCardGrid columns={2} gap="md">
|
|
211
|
-
<PrintCard
|
|
212
|
-
backgroundColor="primary"
|
|
213
|
-
textColor="primary"
|
|
214
|
-
title="Primary Card"
|
|
215
|
-
>
|
|
216
|
-
<PrintCardContent>
|
|
217
|
-
<PrintText>
|
|
218
|
-
This card uses the primary color scheme.
|
|
219
|
-
</PrintText>
|
|
220
|
-
</PrintCardContent>
|
|
221
|
-
</PrintCard>
|
|
222
|
-
|
|
223
|
-
<PrintCard
|
|
224
|
-
backgroundColor="accent"
|
|
225
|
-
textColor="accent"
|
|
226
|
-
title="Accent Card"
|
|
227
|
-
>
|
|
228
|
-
<PrintCardContent>
|
|
229
|
-
<PrintText>
|
|
230
|
-
This card uses the accent color scheme.
|
|
231
|
-
</PrintText>
|
|
232
|
-
</PrintCardContent>
|
|
233
|
-
</PrintCard>
|
|
234
|
-
</PrintCardGrid>
|
|
235
|
-
</section>
|
|
236
|
-
</div>
|
|
237
|
-
</PrintLayout>
|
|
238
|
-
);
|
|
239
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file PrintCard Exports
|
|
3
|
-
* @package @jmruthers/pace-core
|
|
4
|
-
* @module PrintCard
|
|
5
|
-
* @since 0.4.38
|
|
6
|
-
*
|
|
7
|
-
* Exports for PrintCard components.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
export { PrintCard } from './PrintCard';
|
|
11
|
-
export { PrintCardHeader } from './PrintCardHeader';
|
|
12
|
-
export { PrintCardContent } from './PrintCardContent';
|
|
13
|
-
export { PrintCardFooter } from './PrintCardFooter';
|
|
14
|
-
export { PrintCardImage } from './PrintCardImage';
|
|
15
|
-
export { PrintCardGrid } from './PrintCardGrid';
|
|
16
|
-
|
|
17
|
-
export type {
|
|
18
|
-
PrintCardProps,
|
|
19
|
-
PrintCardHeaderProps,
|
|
20
|
-
PrintCardContentProps,
|
|
21
|
-
PrintCardFooterProps,
|
|
22
|
-
PrintCardImageProps,
|
|
23
|
-
PrintCardGridProps,
|
|
24
|
-
PrintCardVariant,
|
|
25
|
-
PrintCardSize,
|
|
26
|
-
PrintCardLayout,
|
|
27
|
-
PrintCardBackgroundColor,
|
|
28
|
-
PrintCardTextColor,
|
|
29
|
-
PrintCardAlignment,
|
|
30
|
-
PrintCardPadding,
|
|
31
|
-
PrintCardAspectRatio,
|
|
32
|
-
PrintCardObjectFit,
|
|
33
|
-
PrintCardGap,
|
|
34
|
-
} from './types';
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file PrintCard Types
|
|
3
|
-
* @package @jmruthers/pace-core
|
|
4
|
-
* @module PrintCard
|
|
5
|
-
* @since 0.4.38
|
|
6
|
-
*
|
|
7
|
-
* Type definitions for PrintCard component.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { ReactNode } from 'react';
|
|
11
|
-
|
|
12
|
-
export interface PrintCardProps {
|
|
13
|
-
/** Card content */
|
|
14
|
-
children: ReactNode;
|
|
15
|
-
|
|
16
|
-
/** Card title */
|
|
17
|
-
title?: string;
|
|
18
|
-
|
|
19
|
-
/** Card subtitle */
|
|
20
|
-
subtitle?: string;
|
|
21
|
-
|
|
22
|
-
/** Card variant */
|
|
23
|
-
variant?: 'default' | 'outlined' | 'filled' | 'elevated';
|
|
24
|
-
|
|
25
|
-
/** Card size */
|
|
26
|
-
size?: 'sm' | 'md' | 'lg' | 'xl';
|
|
27
|
-
|
|
28
|
-
/** Card layout */
|
|
29
|
-
layout?: 'vertical' | 'horizontal' | 'compact';
|
|
30
|
-
|
|
31
|
-
/** Show card border */
|
|
32
|
-
showBorder?: boolean;
|
|
33
|
-
|
|
34
|
-
/** Card background color */
|
|
35
|
-
backgroundColor?: 'white' | 'gray' | 'primary' | 'secondary' | 'accent';
|
|
36
|
-
|
|
37
|
-
/** Card text color */
|
|
38
|
-
textColor?: 'primary' | 'secondary' | 'muted' | 'accent' | 'destructive';
|
|
39
|
-
|
|
40
|
-
/** Print optimization */
|
|
41
|
-
printOptimized?: boolean;
|
|
42
|
-
|
|
43
|
-
/** Custom CSS classes */
|
|
44
|
-
className?: string;
|
|
45
|
-
|
|
46
|
-
/** Additional props */
|
|
47
|
-
[key: string]: any;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export interface PrintCardHeaderProps {
|
|
51
|
-
/** Header content */
|
|
52
|
-
children: ReactNode;
|
|
53
|
-
|
|
54
|
-
/** Header title */
|
|
55
|
-
title?: string;
|
|
56
|
-
|
|
57
|
-
/** Header subtitle */
|
|
58
|
-
subtitle?: string;
|
|
59
|
-
|
|
60
|
-
/** Header actions */
|
|
61
|
-
actions?: ReactNode;
|
|
62
|
-
|
|
63
|
-
/** Header alignment */
|
|
64
|
-
align?: 'left' | 'center' | 'right';
|
|
65
|
-
|
|
66
|
-
/** Print optimization */
|
|
67
|
-
printOptimized?: boolean;
|
|
68
|
-
|
|
69
|
-
/** Custom CSS classes */
|
|
70
|
-
className?: string;
|
|
71
|
-
|
|
72
|
-
/** Additional props */
|
|
73
|
-
[key: string]: any;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export interface PrintCardContentProps {
|
|
77
|
-
/** Content */
|
|
78
|
-
children: ReactNode;
|
|
79
|
-
|
|
80
|
-
/** Content padding */
|
|
81
|
-
padding?: 'none' | 'sm' | 'md' | 'lg';
|
|
82
|
-
|
|
83
|
-
/** Print optimization */
|
|
84
|
-
printOptimized?: boolean;
|
|
85
|
-
|
|
86
|
-
/** Custom CSS classes */
|
|
87
|
-
className?: string;
|
|
88
|
-
|
|
89
|
-
/** Additional props */
|
|
90
|
-
[key: string]: any;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export interface PrintCardFooterProps {
|
|
94
|
-
/** Footer content */
|
|
95
|
-
children: ReactNode;
|
|
96
|
-
|
|
97
|
-
/** Footer alignment */
|
|
98
|
-
align?: 'left' | 'center' | 'right';
|
|
99
|
-
|
|
100
|
-
/** Print optimization */
|
|
101
|
-
printOptimized?: boolean;
|
|
102
|
-
|
|
103
|
-
/** Custom CSS classes */
|
|
104
|
-
className?: string;
|
|
105
|
-
|
|
106
|
-
/** Additional props */
|
|
107
|
-
[key: string]: any;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
export interface PrintCardImageProps {
|
|
111
|
-
/** Image source */
|
|
112
|
-
src: string;
|
|
113
|
-
|
|
114
|
-
/** Image alt text */
|
|
115
|
-
alt: string;
|
|
116
|
-
|
|
117
|
-
/** Image width */
|
|
118
|
-
width?: string | number;
|
|
119
|
-
|
|
120
|
-
/** Image height */
|
|
121
|
-
height?: string | number;
|
|
122
|
-
|
|
123
|
-
/** Image aspect ratio */
|
|
124
|
-
aspectRatio?: 'square' | 'portrait' | 'landscape' | 'auto';
|
|
125
|
-
|
|
126
|
-
/** Image object fit */
|
|
127
|
-
objectFit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
|
|
128
|
-
|
|
129
|
-
/** Print optimization */
|
|
130
|
-
printOptimized?: boolean;
|
|
131
|
-
|
|
132
|
-
/** Custom CSS classes */
|
|
133
|
-
className?: string;
|
|
134
|
-
|
|
135
|
-
/** Additional props */
|
|
136
|
-
[key: string]: any;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
export interface PrintCardGridProps {
|
|
140
|
-
/** Grid items */
|
|
141
|
-
children: ReactNode;
|
|
142
|
-
|
|
143
|
-
/** Number of columns */
|
|
144
|
-
columns?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
145
|
-
|
|
146
|
-
/** Column gap */
|
|
147
|
-
gap?: 'sm' | 'md' | 'lg' | 'xl';
|
|
148
|
-
|
|
149
|
-
/** Row gap */
|
|
150
|
-
rowGap?: 'sm' | 'md' | 'lg' | 'xl';
|
|
151
|
-
|
|
152
|
-
/** Print optimization */
|
|
153
|
-
printOptimized?: boolean;
|
|
154
|
-
|
|
155
|
-
/** Custom CSS classes */
|
|
156
|
-
className?: string;
|
|
157
|
-
|
|
158
|
-
/** Additional props */
|
|
159
|
-
[key: string]: any;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
export type PrintCardVariant = 'default' | 'outlined' | 'filled' | 'elevated';
|
|
163
|
-
export type PrintCardSize = 'sm' | 'md' | 'lg' | 'xl';
|
|
164
|
-
export type PrintCardLayout = 'vertical' | 'horizontal' | 'compact';
|
|
165
|
-
export type PrintCardBackgroundColor = 'white' | 'gray' | 'primary' | 'secondary' | 'accent';
|
|
166
|
-
export type PrintCardTextColor = 'primary' | 'secondary' | 'muted' | 'accent' | 'destructive';
|
|
167
|
-
export type PrintCardAlignment = 'left' | 'center' | 'right';
|
|
168
|
-
export type PrintCardPadding = 'none' | 'sm' | 'md' | 'lg';
|
|
169
|
-
export type PrintCardAspectRatio = 'square' | 'portrait' | 'landscape' | 'auto';
|
|
170
|
-
export type PrintCardObjectFit = 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
|
|
171
|
-
export type PrintCardGap = 'sm' | 'md' | 'lg' | 'xl';
|
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file PrintDataTable Component
|
|
3
|
-
* @package @jmruthers/pace-core
|
|
4
|
-
* @module PrintDataTable
|
|
5
|
-
* @since 0.4.38
|
|
6
|
-
*
|
|
7
|
-
* Print-optimized data table component with grouping and styling options.
|
|
8
|
-
*
|
|
9
|
-
* Features:
|
|
10
|
-
* - Print-optimized table rendering
|
|
11
|
-
* - Column grouping with custom headers
|
|
12
|
-
* - Page break controls per column
|
|
13
|
-
* - Print-specific styling options
|
|
14
|
-
* - Integration with existing theme system
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```tsx
|
|
18
|
-
* <PrintDataTable
|
|
19
|
-
* data={reportData}
|
|
20
|
-
* columns={columns}
|
|
21
|
-
* title="Analytics Summary"
|
|
22
|
-
* grouping={{
|
|
23
|
-
* enabled: true,
|
|
24
|
-
* groupBy: 'category',
|
|
25
|
-
* groupHeader: (group) => <CategoryGroupHeader group={group} />
|
|
26
|
-
* }}
|
|
27
|
-
* printOptimized={true}
|
|
28
|
-
* />
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
import React from 'react';
|
|
33
|
-
import { cn } from '../../utils/cn';
|
|
34
|
-
import { PrintText } from '../PrintText';
|
|
35
|
-
import { PrintTableGroup } from './PrintTableGroup';
|
|
36
|
-
import type { PrintDataTableProps, PrintColumn } from './types';
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* PrintDataTable component provides print-optimized table rendering with grouping support.
|
|
40
|
-
*/
|
|
41
|
-
export function PrintDataTable({
|
|
42
|
-
data,
|
|
43
|
-
columns,
|
|
44
|
-
title,
|
|
45
|
-
showTitle = true,
|
|
46
|
-
grouping,
|
|
47
|
-
styling = {
|
|
48
|
-
headerStyle: 'solid',
|
|
49
|
-
rowStyle: 'striped',
|
|
50
|
-
cellPadding: 'normal'
|
|
51
|
-
},
|
|
52
|
-
printOptimized = true,
|
|
53
|
-
className,
|
|
54
|
-
...props
|
|
55
|
-
}: PrintDataTableProps) {
|
|
56
|
-
const getTableClasses = () => {
|
|
57
|
-
const baseClasses = 'w-full border-collapse';
|
|
58
|
-
|
|
59
|
-
if (printOptimized) {
|
|
60
|
-
return cn(
|
|
61
|
-
baseClasses,
|
|
62
|
-
'print:text-xs print:leading-tight',
|
|
63
|
-
'print:border-black print:border-solid'
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return baseClasses;
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
const getHeaderClasses = () => {
|
|
71
|
-
const baseClasses = 'text-left font-semibold';
|
|
72
|
-
|
|
73
|
-
switch (styling.headerStyle) {
|
|
74
|
-
case 'solid':
|
|
75
|
-
return cn(baseClasses, 'bg-primary text-primary-foreground');
|
|
76
|
-
case 'outline':
|
|
77
|
-
return cn(baseClasses, 'border-2 border-primary text-primary');
|
|
78
|
-
default:
|
|
79
|
-
return baseClasses;
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
const getRowClasses = (isEven: boolean) => {
|
|
84
|
-
const baseClasses = 'border-b border-border';
|
|
85
|
-
|
|
86
|
-
switch (styling.rowStyle) {
|
|
87
|
-
case 'striped':
|
|
88
|
-
return cn(baseClasses, isEven ? 'bg-muted/30' : 'bg-background');
|
|
89
|
-
case 'solid':
|
|
90
|
-
return cn(baseClasses, 'bg-background');
|
|
91
|
-
case 'bordered':
|
|
92
|
-
return cn(baseClasses, 'border border-border bg-background');
|
|
93
|
-
default:
|
|
94
|
-
return baseClasses;
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
const getCellPaddingClasses = () => {
|
|
99
|
-
switch (styling.cellPadding) {
|
|
100
|
-
case 'compact':
|
|
101
|
-
return 'px-2 py-1 print:px-1 print:py-0.5';
|
|
102
|
-
case 'spacious':
|
|
103
|
-
return 'px-6 py-4 print:px-4 print:py-2';
|
|
104
|
-
case 'normal':
|
|
105
|
-
default:
|
|
106
|
-
return 'px-4 py-2 print:px-2 print:py-1';
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
const renderTableHeader = () => (
|
|
111
|
-
<thead>
|
|
112
|
-
<tr className={getHeaderClasses()}>
|
|
113
|
-
{columns.map((column) => (
|
|
114
|
-
<th
|
|
115
|
-
key={column.key}
|
|
116
|
-
className={cn(
|
|
117
|
-
getCellPaddingClasses(),
|
|
118
|
-
'text-left',
|
|
119
|
-
column.align === 'center' && 'text-center',
|
|
120
|
-
column.align === 'right' && 'text-right',
|
|
121
|
-
column.printBreak === 'avoid' && 'print-break-avoid',
|
|
122
|
-
column.printBreak === 'always' && 'print-break-before'
|
|
123
|
-
)}
|
|
124
|
-
style={{ width: column.width }}
|
|
125
|
-
>
|
|
126
|
-
<PrintText variant="small" weight="semibold">
|
|
127
|
-
{column.header}
|
|
128
|
-
</PrintText>
|
|
129
|
-
</th>
|
|
130
|
-
))}
|
|
131
|
-
</tr>
|
|
132
|
-
</thead>
|
|
133
|
-
);
|
|
134
|
-
|
|
135
|
-
const renderTableBody = () => {
|
|
136
|
-
if (grouping?.enabled) {
|
|
137
|
-
const groupedData = groupDataByField(data, grouping.groupBy);
|
|
138
|
-
|
|
139
|
-
return (
|
|
140
|
-
<tbody>
|
|
141
|
-
{Object.entries(groupedData).map(([groupKey, groupData], groupIndex) => (
|
|
142
|
-
<PrintTableGroup
|
|
143
|
-
key={groupKey}
|
|
144
|
-
groupKey={groupKey}
|
|
145
|
-
groupData={groupData}
|
|
146
|
-
columns={columns}
|
|
147
|
-
groupHeader={grouping.groupHeader}
|
|
148
|
-
styling={styling}
|
|
149
|
-
printOptimized={printOptimized}
|
|
150
|
-
/>
|
|
151
|
-
))}
|
|
152
|
-
</tbody>
|
|
153
|
-
);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
return (
|
|
157
|
-
<tbody>
|
|
158
|
-
{data.map((row, index) => (
|
|
159
|
-
<tr
|
|
160
|
-
key={index}
|
|
161
|
-
className={getRowClasses(index % 2 === 0)}
|
|
162
|
-
>
|
|
163
|
-
{columns.map((column) => (
|
|
164
|
-
<td
|
|
165
|
-
key={column.key}
|
|
166
|
-
className={cn(
|
|
167
|
-
getCellPaddingClasses(),
|
|
168
|
-
'text-left',
|
|
169
|
-
column.align === 'center' && 'text-center',
|
|
170
|
-
column.align === 'right' && 'text-right',
|
|
171
|
-
column.printBreak === 'avoid' && 'print-break-avoid'
|
|
172
|
-
)}
|
|
173
|
-
>
|
|
174
|
-
<PrintText variant="small">
|
|
175
|
-
{column.render ? column.render(row[column.key], row) : row[column.key]}
|
|
176
|
-
</PrintText>
|
|
177
|
-
</td>
|
|
178
|
-
))}
|
|
179
|
-
</tr>
|
|
180
|
-
))}
|
|
181
|
-
</tbody>
|
|
182
|
-
);
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
return (
|
|
186
|
-
<div className={cn('print-data-table', className)} {...props}>
|
|
187
|
-
{title && showTitle && (
|
|
188
|
-
<div className="mb-4">
|
|
189
|
-
<PrintText variant="subheading" weight="semibold">
|
|
190
|
-
{title}
|
|
191
|
-
</PrintText>
|
|
192
|
-
</div>
|
|
193
|
-
)}
|
|
194
|
-
|
|
195
|
-
<div className="overflow-x-auto print:overflow-visible">
|
|
196
|
-
<table className={getTableClasses()}>
|
|
197
|
-
{renderTableHeader()}
|
|
198
|
-
{renderTableBody()}
|
|
199
|
-
</table>
|
|
200
|
-
</div>
|
|
201
|
-
</div>
|
|
202
|
-
);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
// Helper function to group data by field
|
|
206
|
-
function groupDataByField(data: any[], field: string): Record<string, any[]> {
|
|
207
|
-
return data.reduce((groups, item) => {
|
|
208
|
-
const key = item[field] || 'Unknown';
|
|
209
|
-
if (!groups[key]) {
|
|
210
|
-
groups[key] = [];
|
|
211
|
-
}
|
|
212
|
-
groups[key].push(item);
|
|
213
|
-
return groups;
|
|
214
|
-
}, {} as Record<string, any[]>);
|
|
215
|
-
}
|