@jmruthers/pace-core 0.5.53 → 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/base.css +208 -0
- package/src/styles/core.css +0 -125
- package/src/styles/semantic.css +24 -0
- 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,230 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Print Components Showcase
|
|
3
|
-
* @package @jmruthers/pace-core
|
|
4
|
-
* @module PrintLayout
|
|
5
|
-
* @since 0.4.38
|
|
6
|
-
*
|
|
7
|
-
* Comprehensive showcase of print components with various use cases.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import React from 'react';
|
|
11
|
-
import {
|
|
12
|
-
PrintLayout,
|
|
13
|
-
PrintHeader,
|
|
14
|
-
PrintCoverHeader,
|
|
15
|
-
PrintText,
|
|
16
|
-
PrintPageBreak
|
|
17
|
-
} from '../../index';
|
|
18
|
-
import { Calendar, CheckCircle, User, Building } from 'lucide-react';
|
|
19
|
-
|
|
20
|
-
// Sample data for demonstration
|
|
21
|
-
const sampleData = [
|
|
22
|
-
{ id: 1, name: 'John Doe', department: 'Engineering', salary: 75000, status: 'Active' },
|
|
23
|
-
{ id: 2, name: 'Jane Smith', department: 'Marketing', salary: 65000, status: 'Active' },
|
|
24
|
-
{ id: 3, name: 'Bob Johnson', department: 'Sales', salary: 70000, status: 'Inactive' },
|
|
25
|
-
{ id: 4, name: 'Alice Brown', department: 'Engineering', salary: 80000, status: 'Active' },
|
|
26
|
-
];
|
|
27
|
-
|
|
28
|
-
export function PrintShowcase() {
|
|
29
|
-
return (
|
|
30
|
-
<div className="space-y-8">
|
|
31
|
-
<div className="mb-8">
|
|
32
|
-
<h1 className="text-3xl font-bold mb-4">Print Components Showcase</h1>
|
|
33
|
-
<p className="text-muted-foreground">
|
|
34
|
-
This page demonstrates the print-optimized layout components available in pace-core.
|
|
35
|
-
Use your browser's print function (Ctrl+P / Cmd+P) to see the print-optimized layouts.
|
|
36
|
-
</p>
|
|
37
|
-
</div>
|
|
38
|
-
|
|
39
|
-
{/* Basic Print Layout Example */}
|
|
40
|
-
<PrintLayout orientation="portrait" pageSize="A4">
|
|
41
|
-
<PrintHeader
|
|
42
|
-
title="Basic Print Layout"
|
|
43
|
-
subtitle="Simple report with standard header"
|
|
44
|
-
branding={{
|
|
45
|
-
companyName: "PACE Core",
|
|
46
|
-
projectName: "Print Components Demo",
|
|
47
|
-
version: "v0.4.38"
|
|
48
|
-
}}
|
|
49
|
-
metadata={[
|
|
50
|
-
{ label: "Status", value: "Complete", icon: CheckCircle },
|
|
51
|
-
{ label: "Generated", value: "2024-01-15", icon: Calendar },
|
|
52
|
-
{ label: "Author", value: "Development Team", icon: User }
|
|
53
|
-
]}
|
|
54
|
-
/>
|
|
55
|
-
|
|
56
|
-
<div className="space-y-4">
|
|
57
|
-
<PrintText variant="heading">Executive Summary</PrintText>
|
|
58
|
-
<PrintText variant="body">
|
|
59
|
-
This is a demonstration of the basic print layout with a standard header.
|
|
60
|
-
The layout is optimized for A4 portrait printing with proper margins and typography.
|
|
61
|
-
</PrintText>
|
|
62
|
-
|
|
63
|
-
<PrintText variant="subheading">Key Features</PrintText>
|
|
64
|
-
<PrintText variant="body">
|
|
65
|
-
• Print-optimized typography and spacing
|
|
66
|
-
• Responsive header with branding
|
|
67
|
-
• Metadata display with icons
|
|
68
|
-
• Automatic print date generation
|
|
69
|
-
</PrintText>
|
|
70
|
-
</div>
|
|
71
|
-
</PrintLayout>
|
|
72
|
-
|
|
73
|
-
<PrintPageBreak type="before" />
|
|
74
|
-
|
|
75
|
-
{/* Cover Page Example */}
|
|
76
|
-
<PrintLayout
|
|
77
|
-
orientation="portrait"
|
|
78
|
-
pageSize="A4"
|
|
79
|
-
firstPageHeader={
|
|
80
|
-
<PrintCoverHeader
|
|
81
|
-
title="Annual Report 2024"
|
|
82
|
-
subtitle="Financial Performance & Strategic Overview"
|
|
83
|
-
branding={{
|
|
84
|
-
logo: "/pace_logo_square.svg",
|
|
85
|
-
companyName: "PACE Corporation",
|
|
86
|
-
projectName: "Annual Report",
|
|
87
|
-
version: "v2024.1",
|
|
88
|
-
tagline: "Innovation Through Excellence"
|
|
89
|
-
}}
|
|
90
|
-
logoSize="large"
|
|
91
|
-
titleSize="xl"
|
|
92
|
-
showDivider={true}
|
|
93
|
-
backgroundColor="#f8f9fa"
|
|
94
|
-
metadata={[
|
|
95
|
-
{ label: "Period", value: "Jan 1 - Dec 31, 2024", icon: Calendar },
|
|
96
|
-
{ label: "Prepared by", value: "Finance Team", icon: User },
|
|
97
|
-
{ label: "Company", value: "PACE Corporation", icon: Building }
|
|
98
|
-
]}
|
|
99
|
-
/>
|
|
100
|
-
}
|
|
101
|
-
subsequentPageHeader={
|
|
102
|
-
<PrintHeader
|
|
103
|
-
title="Annual Report 2024"
|
|
104
|
-
branding={{
|
|
105
|
-
logo: "/pace_logo_square.svg",
|
|
106
|
-
companyName: "PACE Corp"
|
|
107
|
-
}}
|
|
108
|
-
/>
|
|
109
|
-
}
|
|
110
|
-
>
|
|
111
|
-
<div className="space-y-6">
|
|
112
|
-
<PrintText variant="heading">Financial Highlights</PrintText>
|
|
113
|
-
|
|
114
|
-
<PrintText variant="body">
|
|
115
|
-
This report demonstrates the cover page header style with enhanced branding,
|
|
116
|
-
large logo, and professional appearance suitable for formal documents.
|
|
117
|
-
</PrintText>
|
|
118
|
-
|
|
119
|
-
<PrintText variant="subheading">Revenue Growth</PrintText>
|
|
120
|
-
<PrintText variant="body">
|
|
121
|
-
Our company has experienced significant growth in 2024, with revenue increasing
|
|
122
|
-
by 25% compared to the previous year. This growth has been driven by strategic
|
|
123
|
-
investments in technology and expansion into new markets.
|
|
124
|
-
</PrintText>
|
|
125
|
-
|
|
126
|
-
<PrintText variant="subheading">Strategic Initiatives</PrintText>
|
|
127
|
-
<PrintText variant="body">
|
|
128
|
-
Key strategic initiatives implemented in 2024 include:
|
|
129
|
-
</PrintText>
|
|
130
|
-
|
|
131
|
-
<ul className="list-disc list-inside space-y-2 ml-4">
|
|
132
|
-
<li><PrintText variant="body">Digital transformation across all departments</PrintText></li>
|
|
133
|
-
<li><PrintText variant="body">Expansion into international markets</PrintText></li>
|
|
134
|
-
<li><PrintText variant="body">Investment in sustainable technologies</PrintText></li>
|
|
135
|
-
<li><PrintText variant="body">Enhanced customer experience programs</PrintText></li>
|
|
136
|
-
</ul>
|
|
137
|
-
</div>
|
|
138
|
-
</PrintLayout>
|
|
139
|
-
|
|
140
|
-
<PrintPageBreak type="before" />
|
|
141
|
-
|
|
142
|
-
{/* Landscape Layout Example */}
|
|
143
|
-
<PrintLayout orientation="landscape" pageSize="A4">
|
|
144
|
-
<PrintHeader
|
|
145
|
-
title="Data Analysis Report"
|
|
146
|
-
subtitle="Q4 Performance Metrics"
|
|
147
|
-
branding={{
|
|
148
|
-
companyName: "PACE Analytics",
|
|
149
|
-
projectName: "Q4 Report"
|
|
150
|
-
}}
|
|
151
|
-
metadata={[
|
|
152
|
-
{ label: "Period", value: "Q4 2024", icon: Calendar },
|
|
153
|
-
{ label: "Status", value: "Final", icon: CheckCircle }
|
|
154
|
-
]}
|
|
155
|
-
/>
|
|
156
|
-
|
|
157
|
-
<div className="space-y-4">
|
|
158
|
-
<PrintText variant="heading">Performance Summary</PrintText>
|
|
159
|
-
|
|
160
|
-
<div className="grid grid-cols-2 gap-8">
|
|
161
|
-
<div>
|
|
162
|
-
<PrintText variant="subheading">Revenue Metrics</PrintText>
|
|
163
|
-
<PrintText variant="body">
|
|
164
|
-
• Total Revenue: $2.5M (+15% YoY)
|
|
165
|
-
• Gross Margin: 68%
|
|
166
|
-
• Net Profit: $450K
|
|
167
|
-
</PrintText>
|
|
168
|
-
</div>
|
|
169
|
-
|
|
170
|
-
<div>
|
|
171
|
-
<PrintText variant="subheading">Operational Metrics</PrintText>
|
|
172
|
-
<PrintText variant="body">
|
|
173
|
-
• Customer Acquisition: 1,250 (+22% YoY)
|
|
174
|
-
• Customer Retention: 94%
|
|
175
|
-
• Average Deal Size: $2,000
|
|
176
|
-
</PrintText>
|
|
177
|
-
</div>
|
|
178
|
-
</div>
|
|
179
|
-
|
|
180
|
-
<PrintText variant="subheading">Key Insights</PrintText>
|
|
181
|
-
<PrintText variant="body">
|
|
182
|
-
The landscape layout is ideal for data-heavy reports and tables.
|
|
183
|
-
It provides more horizontal space for presenting information in columns
|
|
184
|
-
and makes better use of the available print area.
|
|
185
|
-
</PrintText>
|
|
186
|
-
</div>
|
|
187
|
-
</PrintLayout>
|
|
188
|
-
|
|
189
|
-
<PrintPageBreak type="before" />
|
|
190
|
-
|
|
191
|
-
{/* Typography Showcase */}
|
|
192
|
-
<PrintLayout orientation="portrait" pageSize="A4">
|
|
193
|
-
<PrintHeader
|
|
194
|
-
title="Typography Showcase"
|
|
195
|
-
subtitle="Print-optimized text styles and formatting"
|
|
196
|
-
/>
|
|
197
|
-
|
|
198
|
-
<div className="space-y-6">
|
|
199
|
-
<PrintText variant="heading">Heading Styles</PrintText>
|
|
200
|
-
|
|
201
|
-
<div className="space-y-4">
|
|
202
|
-
<PrintText variant="heading" weight="bold">Main Heading (Bold)</PrintText>
|
|
203
|
-
<PrintText variant="subheading" weight="semibold">Subheading (Semibold)</PrintText>
|
|
204
|
-
<PrintText variant="body" weight="medium">Body Text (Medium)</PrintText>
|
|
205
|
-
<PrintText variant="caption" color="muted">Caption Text (Muted)</PrintText>
|
|
206
|
-
<PrintText variant="small" color="muted">Small Text (Muted)</PrintText>
|
|
207
|
-
</div>
|
|
208
|
-
|
|
209
|
-
<PrintText variant="subheading">Color Variations</PrintText>
|
|
210
|
-
|
|
211
|
-
<div className="space-y-2">
|
|
212
|
-
<PrintText variant="body" color="primary">Primary Color Text</PrintText>
|
|
213
|
-
<PrintText variant="body" color="secondary">Secondary Color Text</PrintText>
|
|
214
|
-
<PrintText variant="body" color="muted">Muted Color Text</PrintText>
|
|
215
|
-
<PrintText variant="body" color="accent">Accent Color Text</PrintText>
|
|
216
|
-
</div>
|
|
217
|
-
|
|
218
|
-
<PrintText variant="subheading">Weight Variations</PrintText>
|
|
219
|
-
|
|
220
|
-
<div className="space-y-2">
|
|
221
|
-
<PrintText variant="body" weight="normal">Normal Weight</PrintText>
|
|
222
|
-
<PrintText variant="body" weight="medium">Medium Weight</PrintText>
|
|
223
|
-
<PrintText variant="body" weight="semibold">Semibold Weight</PrintText>
|
|
224
|
-
<PrintText variant="body" weight="bold">Bold Weight</PrintText>
|
|
225
|
-
</div>
|
|
226
|
-
</div>
|
|
227
|
-
</PrintLayout>
|
|
228
|
-
</div>
|
|
229
|
-
);
|
|
230
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file PrintLayout Component Exports
|
|
3
|
-
* @package @jmruthers/pace-core
|
|
4
|
-
* @module PrintLayout
|
|
5
|
-
* @since 0.4.38
|
|
6
|
-
*
|
|
7
|
-
* Exports for PrintLayout component and related utilities.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
export { PrintLayout } from './PrintLayout';
|
|
11
|
-
export { PrintPageBreak } from './PrintPageBreak';
|
|
12
|
-
export { PrintLayoutProvider, usePrintLayout } from './PrintLayoutContext';
|
|
13
|
-
export type {
|
|
14
|
-
PrintLayoutProps,
|
|
15
|
-
PrintLayoutContextType,
|
|
16
|
-
PrintPageBreakProps,
|
|
17
|
-
PageSize,
|
|
18
|
-
Orientation
|
|
19
|
-
} from './types';
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file PrintLayout Types
|
|
3
|
-
* @package @jmruthers/pace-core
|
|
4
|
-
* @module PrintLayout
|
|
5
|
-
* @since 0.4.38
|
|
6
|
-
*
|
|
7
|
-
* Type definitions for PrintLayout component and related utilities.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { ReactNode } from 'react';
|
|
11
|
-
|
|
12
|
-
export type PageSize = 'A4' | 'A3' | 'A5';
|
|
13
|
-
export type Orientation = 'portrait' | 'landscape';
|
|
14
|
-
|
|
15
|
-
export interface PrintLayoutProps {
|
|
16
|
-
children: ReactNode;
|
|
17
|
-
orientation?: Orientation;
|
|
18
|
-
pageSize?: PageSize;
|
|
19
|
-
showHeader?: boolean;
|
|
20
|
-
showFooter?: boolean;
|
|
21
|
-
firstPageHeader?: ReactNode;
|
|
22
|
-
subsequentPageHeader?: ReactNode;
|
|
23
|
-
className?: string;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface PrintLayoutContextType {
|
|
27
|
-
isFirstPage: boolean;
|
|
28
|
-
pageSize: PageSize;
|
|
29
|
-
orientation: Orientation;
|
|
30
|
-
hasFirstPageHeader: boolean;
|
|
31
|
-
hasSubsequentPageHeader: boolean;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export interface PrintPageBreakProps {
|
|
35
|
-
type?: 'before' | 'after' | 'avoid';
|
|
36
|
-
className?: string;
|
|
37
|
-
}
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file PrintPageBreak Component
|
|
3
|
-
* @package @jmruthers/pace-core
|
|
4
|
-
* @module PrintPageBreak
|
|
5
|
-
* @since 0.4.38
|
|
6
|
-
*
|
|
7
|
-
* Enhanced print page break component with visual indicators and controls.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import React, { ReactNode } from 'react';
|
|
11
|
-
import { cn } from '../../utils/cn';
|
|
12
|
-
import { PrintText } from '../PrintText';
|
|
13
|
-
import { PrintPageBreakIndicator } from './PrintPageBreakIndicator';
|
|
14
|
-
import { PrintPageBreakProps } from './types';
|
|
15
|
-
|
|
16
|
-
export function PrintPageBreak({
|
|
17
|
-
type = 'auto',
|
|
18
|
-
strength = 'normal',
|
|
19
|
-
showIndicator = false,
|
|
20
|
-
indicator,
|
|
21
|
-
label,
|
|
22
|
-
description,
|
|
23
|
-
printOptimized = true,
|
|
24
|
-
className,
|
|
25
|
-
...props
|
|
26
|
-
}: PrintPageBreakProps) {
|
|
27
|
-
const getBreakClass = (): string => {
|
|
28
|
-
const baseClass = 'print-page-break';
|
|
29
|
-
|
|
30
|
-
switch (type) {
|
|
31
|
-
case 'before':
|
|
32
|
-
return cn(baseClass, 'print-break-before');
|
|
33
|
-
case 'after':
|
|
34
|
-
return cn(baseClass, 'print-break-after');
|
|
35
|
-
case 'avoid':
|
|
36
|
-
return cn(baseClass, 'print-break-avoid');
|
|
37
|
-
case 'always':
|
|
38
|
-
return cn(baseClass, 'print-break-before print-break-after');
|
|
39
|
-
case 'left':
|
|
40
|
-
return cn(baseClass, 'print-break-before', 'print:page-break-before:left');
|
|
41
|
-
case 'right':
|
|
42
|
-
return cn(baseClass, 'print-break-before', 'print:page-break-before:right');
|
|
43
|
-
default:
|
|
44
|
-
return baseClass;
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const getStrengthClass = (): string => {
|
|
49
|
-
switch (strength) {
|
|
50
|
-
case 'weak':
|
|
51
|
-
return 'print:page-break-inside:avoid';
|
|
52
|
-
case 'strong':
|
|
53
|
-
return 'print:page-break-inside:avoid print:break-inside-avoid';
|
|
54
|
-
default:
|
|
55
|
-
return '';
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
const getPrintOptimizedClasses = (): string => {
|
|
60
|
-
if (!printOptimized) return '';
|
|
61
|
-
return cn(
|
|
62
|
-
'print:break-inside-avoid',
|
|
63
|
-
'print:mb-4'
|
|
64
|
-
);
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
const renderIndicator = (): ReactNode => {
|
|
68
|
-
if (!showIndicator) return null;
|
|
69
|
-
|
|
70
|
-
if (indicator) {
|
|
71
|
-
return indicator;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return (
|
|
75
|
-
<PrintPageBreakIndicator
|
|
76
|
-
type="line"
|
|
77
|
-
color="muted"
|
|
78
|
-
size="md"
|
|
79
|
-
printOptimized={printOptimized}
|
|
80
|
-
/>
|
|
81
|
-
);
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
const renderLabel = (): ReactNode => {
|
|
85
|
-
if (!label) return null;
|
|
86
|
-
|
|
87
|
-
return (
|
|
88
|
-
<PrintText variant="small" color="muted" className="text-center">
|
|
89
|
-
{label}
|
|
90
|
-
</PrintText>
|
|
91
|
-
);
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
const renderDescription = (): ReactNode => {
|
|
95
|
-
if (!description) return null;
|
|
96
|
-
|
|
97
|
-
return (
|
|
98
|
-
<PrintText variant="small" color="muted" className="text-center mt-1">
|
|
99
|
-
{description}
|
|
100
|
-
</PrintText>
|
|
101
|
-
);
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
return (
|
|
105
|
-
<div
|
|
106
|
-
className={cn(
|
|
107
|
-
getBreakClass(),
|
|
108
|
-
getStrengthClass(),
|
|
109
|
-
getPrintOptimizedClasses(),
|
|
110
|
-
className
|
|
111
|
-
)}
|
|
112
|
-
aria-hidden="true"
|
|
113
|
-
{...props}
|
|
114
|
-
>
|
|
115
|
-
{renderIndicator()}
|
|
116
|
-
{renderLabel()}
|
|
117
|
-
{renderDescription()}
|
|
118
|
-
</div>
|
|
119
|
-
);
|
|
120
|
-
}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file PrintPageBreakGroup Component
|
|
3
|
-
* @package @jmruthers/pace-core
|
|
4
|
-
* @module PrintPageBreakGroup
|
|
5
|
-
* @since 0.4.38
|
|
6
|
-
*
|
|
7
|
-
* Group component for managing page breaks across multiple elements.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import React from 'react';
|
|
11
|
-
import { cn } from '../../utils/cn';
|
|
12
|
-
import { PrintText } from '../PrintText';
|
|
13
|
-
import { PrintPageBreakGroupProps } from './types';
|
|
14
|
-
|
|
15
|
-
export function PrintPageBreakGroup({
|
|
16
|
-
children,
|
|
17
|
-
type = 'auto',
|
|
18
|
-
strength = 'normal',
|
|
19
|
-
label,
|
|
20
|
-
description,
|
|
21
|
-
printOptimized = true,
|
|
22
|
-
className,
|
|
23
|
-
...props
|
|
24
|
-
}: PrintPageBreakGroupProps) {
|
|
25
|
-
const getBreakClass = (): string => {
|
|
26
|
-
const baseClass = 'print-page-break-group';
|
|
27
|
-
|
|
28
|
-
switch (type) {
|
|
29
|
-
case 'before':
|
|
30
|
-
return cn(baseClass, 'print-break-before');
|
|
31
|
-
case 'after':
|
|
32
|
-
return cn(baseClass, 'print-break-after');
|
|
33
|
-
case 'avoid':
|
|
34
|
-
return cn(baseClass, 'print-break-avoid');
|
|
35
|
-
case 'always':
|
|
36
|
-
return cn(baseClass, 'print-break-before print-break-after');
|
|
37
|
-
case 'left':
|
|
38
|
-
return cn(baseClass, 'print-break-before', 'print:page-break-before:left');
|
|
39
|
-
case 'right':
|
|
40
|
-
return cn(baseClass, 'print-break-before', 'print:page-break-before:right');
|
|
41
|
-
default:
|
|
42
|
-
return baseClass;
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const getStrengthClass = (): string => {
|
|
47
|
-
switch (strength) {
|
|
48
|
-
case 'weak':
|
|
49
|
-
return 'print:page-break-inside:avoid';
|
|
50
|
-
case 'strong':
|
|
51
|
-
return 'print:page-break-inside:avoid print:break-inside-avoid';
|
|
52
|
-
default:
|
|
53
|
-
return '';
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const getPrintOptimizedClasses = (): string => {
|
|
58
|
-
if (!printOptimized) return '';
|
|
59
|
-
return cn(
|
|
60
|
-
'print:break-inside-avoid',
|
|
61
|
-
'print:mb-4'
|
|
62
|
-
);
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
return (
|
|
66
|
-
<div
|
|
67
|
-
className={cn(
|
|
68
|
-
getBreakClass(),
|
|
69
|
-
getStrengthClass(),
|
|
70
|
-
getPrintOptimizedClasses(),
|
|
71
|
-
className
|
|
72
|
-
)}
|
|
73
|
-
{...props}
|
|
74
|
-
>
|
|
75
|
-
{label && (
|
|
76
|
-
<PrintText variant="small" color="muted" className="mb-2">
|
|
77
|
-
{label}
|
|
78
|
-
</PrintText>
|
|
79
|
-
)}
|
|
80
|
-
|
|
81
|
-
{children}
|
|
82
|
-
|
|
83
|
-
{description && (
|
|
84
|
-
<PrintText variant="small" color="muted" className="mt-2">
|
|
85
|
-
{description}
|
|
86
|
-
</PrintText>
|
|
87
|
-
)}
|
|
88
|
-
</div>
|
|
89
|
-
);
|
|
90
|
-
}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file PrintPageBreakIndicator Component
|
|
3
|
-
* @package @jmruthers/pace-core
|
|
4
|
-
* @module PrintPageBreakIndicator
|
|
5
|
-
* @since 0.4.38
|
|
6
|
-
*
|
|
7
|
-
* Visual indicator component for page breaks.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import React, { ReactNode } from 'react';
|
|
11
|
-
import { cn } from '../../utils/cn';
|
|
12
|
-
import { PrintText } from '../PrintText';
|
|
13
|
-
import { PrintPageBreakIndicatorProps } from './types';
|
|
14
|
-
|
|
15
|
-
export function PrintPageBreakIndicator({
|
|
16
|
-
children,
|
|
17
|
-
type = 'line',
|
|
18
|
-
color = 'default',
|
|
19
|
-
size = 'md',
|
|
20
|
-
printOptimized = true,
|
|
21
|
-
className,
|
|
22
|
-
...props
|
|
23
|
-
}: PrintPageBreakIndicatorProps) {
|
|
24
|
-
const getTypeClasses = (): string => {
|
|
25
|
-
switch (type) {
|
|
26
|
-
case 'dotted':
|
|
27
|
-
return 'border-dotted';
|
|
28
|
-
case 'dashed':
|
|
29
|
-
return 'border-dashed';
|
|
30
|
-
case 'text':
|
|
31
|
-
return 'text-center';
|
|
32
|
-
case 'icon':
|
|
33
|
-
return 'text-center';
|
|
34
|
-
default:
|
|
35
|
-
return 'border-solid';
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const getColorClasses = (): string => {
|
|
40
|
-
switch (color) {
|
|
41
|
-
case 'primary':
|
|
42
|
-
return 'border-primary text-primary';
|
|
43
|
-
case 'secondary':
|
|
44
|
-
return 'border-secondary text-secondary';
|
|
45
|
-
case 'muted':
|
|
46
|
-
return 'border-muted-foreground text-muted-foreground';
|
|
47
|
-
case 'accent':
|
|
48
|
-
return 'border-accent text-accent';
|
|
49
|
-
default:
|
|
50
|
-
return 'border-border text-foreground';
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
const getSizeClasses = (): string => {
|
|
55
|
-
switch (size) {
|
|
56
|
-
case 'sm':
|
|
57
|
-
return 'h-1 text-xs';
|
|
58
|
-
case 'lg':
|
|
59
|
-
return 'h-3 text-lg';
|
|
60
|
-
default:
|
|
61
|
-
return 'h-2 text-sm';
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
const getPrintOptimizedClasses = (): string => {
|
|
66
|
-
if (!printOptimized) return '';
|
|
67
|
-
return cn(
|
|
68
|
-
'print:border-black',
|
|
69
|
-
'print:text-black'
|
|
70
|
-
);
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
const renderContent = (): ReactNode => {
|
|
74
|
-
if (children) {
|
|
75
|
-
return children;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
switch (type) {
|
|
79
|
-
case 'text':
|
|
80
|
-
return '--- Page Break ---';
|
|
81
|
-
case 'icon':
|
|
82
|
-
return '📄';
|
|
83
|
-
case 'line':
|
|
84
|
-
return '--- Page Break ---';
|
|
85
|
-
default:
|
|
86
|
-
return '--- Page Break ---';
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
const isLineType = type === 'line' || type === 'dotted' || type === 'dashed';
|
|
91
|
-
|
|
92
|
-
return (
|
|
93
|
-
<div
|
|
94
|
-
className={cn(
|
|
95
|
-
'print-page-break-indicator',
|
|
96
|
-
'flex',
|
|
97
|
-
'items-center',
|
|
98
|
-
'justify-center',
|
|
99
|
-
'w-full',
|
|
100
|
-
getTypeClasses(),
|
|
101
|
-
getColorClasses(),
|
|
102
|
-
getSizeClasses(),
|
|
103
|
-
isLineType && 'border-t',
|
|
104
|
-
getPrintOptimizedClasses(),
|
|
105
|
-
className
|
|
106
|
-
)}
|
|
107
|
-
{...props}
|
|
108
|
-
>
|
|
109
|
-
{renderContent()}
|
|
110
|
-
</div>
|
|
111
|
-
);
|
|
112
|
-
}
|