@jmruthers/pace-core 0.5.135 → 0.5.137
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/dist/{DataTable-A36PJG6N.js → DataTable-6M4L6BI2.js} +26 -13
- package/dist/{DataTable-C7GaRZye.d.ts → DataTable-CWAZZcXC.d.ts} +1 -1
- package/dist/{PublicLoadingSpinner-CUAnTvcg.d.ts → EventLogo-rFL_kRjk.d.ts} +123 -135
- package/dist/{UnifiedAuthProvider-BVKmQd9u.d.ts → UnifiedAuthProvider-DJxGTftH.d.ts} +1 -1
- package/dist/{UnifiedAuthProvider-CQDZRJIS.js → UnifiedAuthProvider-XIQQ7LVU.js} +5 -5
- package/dist/{api-TNIBJWLM.js → api-45XYYO2A.js} +4 -3
- package/dist/{audit-T36HM7IM.js → audit-64X3VJXB.js} +3 -2
- package/dist/{chunk-F64FFPOZ.js → chunk-22WKWKRX.js} +26 -20
- package/dist/chunk-22WKWKRX.js.map +1 -0
- package/dist/{chunk-VZ5OR6HD.js → chunk-4C7EXCAR.js} +62 -150
- package/dist/chunk-4C7EXCAR.js.map +1 -0
- package/dist/{chunk-PYUXFQJ3.js → chunk-56XJ3TU6.js} +2 -2
- package/dist/chunk-56XJ3TU6.js.map +1 -0
- package/dist/{chunk-CTJRBUX2.js → chunk-6LAAY47Q.js} +2 -2
- package/dist/{chunk-UJI6WSMD.js → chunk-7QCC6MCP.js} +90 -3
- package/dist/chunk-7QCC6MCP.js.map +1 -0
- package/dist/{chunk-66C4BSAY.js → chunk-ANBQRTPX.js} +9 -2
- package/dist/chunk-ANBQRTPX.js.map +1 -0
- package/dist/{chunk-CQZU6TFE.js → chunk-BCIBECNB.js} +100 -62
- package/dist/chunk-BCIBECNB.js.map +1 -0
- package/dist/{chunk-GKHF54DI.js → chunk-BESYRHQM.js} +10 -4
- package/dist/chunk-BESYRHQM.js.map +1 -0
- package/dist/chunk-BJPBT3CU.js +21 -0
- package/dist/chunk-BJPBT3CU.js.map +1 -0
- package/dist/{chunk-BYXRHAIF.js → chunk-BLCXZEYF.js} +23 -14
- package/dist/chunk-BLCXZEYF.js.map +1 -0
- package/dist/{chunk-WP5I5GLN.js → chunk-BVYWGZVV.js} +112 -97
- package/dist/chunk-BVYWGZVV.js.map +1 -0
- package/dist/{chunk-GEVIB2UB.js → chunk-ERISIBYU.js} +14 -5
- package/dist/chunk-ERISIBYU.js.map +1 -0
- package/dist/{chunk-O3NWNXDY.js → chunk-FMUCXFII.js} +2 -2
- package/dist/chunk-FMUCXFII.js.map +1 -0
- package/dist/{chunk-GVDR7WNV.js → chunk-HAWZXGR2.js} +334 -614
- package/dist/chunk-HAWZXGR2.js.map +1 -0
- package/dist/{chunk-ZV77RZMU.js → chunk-INQLMHPF.js} +2 -2
- package/dist/chunk-JISYG63F.js +70 -0
- package/dist/chunk-JISYG63F.js.map +1 -0
- package/dist/{chunk-HMNOSGVA.js → chunk-KYRHUBIU.js} +576 -767
- package/dist/chunk-KYRHUBIU.js.map +1 -0
- package/dist/{chunk-M6DDYFUD.js → chunk-LS353YLY.js} +19 -16
- package/dist/chunk-LS353YLY.js.map +1 -0
- package/dist/{chunk-TGIY2AR2.js → chunk-MA6EPSGZ.js} +4 -3
- package/dist/{chunk-TGIY2AR2.js.map → chunk-MA6EPSGZ.js.map} +1 -1
- package/dist/chunk-OWAG3GSU.js +58 -0
- package/dist/chunk-OWAG3GSU.js.map +1 -0
- package/dist/{chunk-JCQZ6LA7.js → chunk-Q5QRDWKI.js} +9 -3
- package/dist/chunk-Q5QRDWKI.js.map +1 -0
- package/dist/chunk-S5OFRT4M.js +94 -0
- package/dist/chunk-S5OFRT4M.js.map +1 -0
- package/dist/{chunk-3DBFLLLU.js → chunk-SBVILCCA.js} +14 -9
- package/dist/chunk-SBVILCCA.js.map +1 -0
- package/dist/{chunk-ZYZCRSBD.js → chunk-T6JN6LH6.js} +16 -11
- package/dist/chunk-T6JN6LH6.js.map +1 -0
- package/dist/chunk-XDNLUEXI.js +138 -0
- package/dist/chunk-XDNLUEXI.js.map +1 -0
- package/dist/{chunk-3CG5L6RN.js → chunk-YCWDTTUK.js} +90 -75
- package/dist/chunk-YCWDTTUK.js.map +1 -0
- package/dist/{chunk-5F3NDPJV.js → chunk-ZZ2SS7NI.js} +10 -5
- package/dist/chunk-ZZ2SS7NI.js.map +1 -0
- package/dist/components.d.ts +7 -287
- package/dist/components.js +27 -157
- package/dist/components.js.map +1 -1
- package/dist/{file-reference-C9isKNPn.d.ts → file-reference-C6Gkn77H.d.ts} +1 -1
- package/dist/{formatting-DFcCxUEk.d.ts → formatting-CvUXy2mF.d.ts} +1 -1
- package/dist/hooks.d.ts +3 -3
- package/dist/hooks.js +21 -16
- package/dist/hooks.js.map +1 -1
- package/dist/index.d.ts +101 -9
- package/dist/index.js +44 -31
- package/dist/index.js.map +1 -1
- package/dist/providers.d.ts +1 -1
- package/dist/providers.js +4 -4
- package/dist/rbac/index.js +12 -12
- package/dist/schema-DTDZQe2u.d.ts +28 -0
- package/dist/styles/index.js +2 -1
- package/dist/theming/runtime.d.ts +2 -19
- package/dist/theming/runtime.js +2 -1
- package/dist/{types-D5rqZQXk.d.ts → types-Dfz9dmVH.d.ts} +12 -1
- package/dist/types.d.ts +153 -4
- package/dist/types.js +51 -16
- package/dist/types.js.map +1 -1
- package/dist/{useInactivityTracker-MRUU55XI.js → useInactivityTracker-TO6ZOF35.js} +3 -2
- package/dist/{usePublicRouteParams-Dyt1tzI9.d.ts → usePublicRouteParams-B7PabvuH.d.ts} +1 -1
- package/dist/utils.d.ts +221 -173
- package/dist/utils.js +185 -225
- package/dist/utils.js.map +1 -1
- package/dist/validation.d.ts +24 -115
- package/dist/validation.js +19 -474
- package/dist/validation.js.map +1 -1
- package/docs/api/classes/ColumnFactory.md +1 -1
- package/docs/api/classes/ErrorBoundary.md +6 -6
- 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 +1 -1
- package/docs/api/classes/PublicErrorBoundary.md +1 -1
- package/docs/api/classes/RBACAuditManager.md +6 -6
- package/docs/api/classes/RBACCache.md +1 -1
- package/docs/api/classes/RBACEngine.md +7 -7
- 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 +1 -1
- package/docs/api/enums/FileCategory.md +1 -1
- package/docs/api/interfaces/AggregateConfig.md +4 -4
- package/docs/api/interfaces/BadgeProps.md +27 -0
- 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 +29 -4
- package/docs/api/interfaces/DataAccessRecord.md +9 -9
- package/docs/api/interfaces/DataRecord.md +1 -1
- package/docs/api/interfaces/DataTableAction.md +18 -18
- package/docs/api/interfaces/DataTableColumn.md +61 -1
- package/docs/api/interfaces/DataTableProps.md +1 -1
- package/docs/api/interfaces/DataTableToolbarButton.md +7 -7
- package/docs/api/interfaces/EmptyStateConfig.md +5 -5
- package/docs/api/interfaces/EnhancedNavigationMenuProps.md +14 -14
- package/docs/api/interfaces/EventAppRoleData.md +1 -1
- package/docs/api/interfaces/EventLogoProps.md +152 -0
- package/docs/api/interfaces/ExportColumn.md +1 -1
- package/docs/api/interfaces/ExportOptions.md +8 -8
- package/docs/api/interfaces/FileDisplayProps.md +15 -15
- package/docs/api/interfaces/FileMetadata.md +1 -1
- package/docs/api/interfaces/FileReference.md +1 -1
- package/docs/api/interfaces/FileSizeLimits.md +1 -1
- package/docs/api/interfaces/FileUploadOptions.md +1 -1
- package/docs/api/interfaces/FileUploadProps.md +1 -1
- package/docs/api/interfaces/FooterProps.md +1 -1
- package/docs/api/interfaces/GrantEventAppRoleParams.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 +10 -10
- package/docs/api/interfaces/NavigationContextType.md +9 -9
- package/docs/api/interfaces/NavigationGuardProps.md +10 -10
- package/docs/api/interfaces/NavigationItem.md +1 -1
- package/docs/api/interfaces/NavigationMenuProps.md +1 -1
- package/docs/api/interfaces/NavigationProviderProps.md +7 -7
- 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 +27 -27
- package/docs/api/interfaces/PaceLoginPageProps.md +4 -4
- package/docs/api/interfaces/PageAccessRecord.md +8 -8
- package/docs/api/interfaces/PagePermissionContextType.md +8 -8
- package/docs/api/interfaces/PagePermissionGuardProps.md +11 -11
- package/docs/api/interfaces/PagePermissionProviderProps.md +7 -7
- package/docs/api/interfaces/PaletteData.md +4 -4
- package/docs/api/interfaces/PermissionEnforcerProps.md +11 -11
- package/docs/api/interfaces/ProtectedRouteProps.md +6 -6
- 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/RBACLogger.md +1 -1
- package/docs/api/interfaces/RevokeEventAppRoleParams.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterContextType.md +8 -8
- package/docs/api/interfaces/RoleBasedRouterProps.md +10 -10
- package/docs/api/interfaces/RoleManagementResult.md +1 -1
- package/docs/api/interfaces/RouteAccessRecord.md +10 -10
- package/docs/api/interfaces/RouteConfig.md +10 -10
- package/docs/api/interfaces/SecureDataContextType.md +9 -9
- package/docs/api/interfaces/SecureDataProviderProps.md +8 -8
- package/docs/api/interfaces/SessionRestorationLoaderProps.md +21 -0
- 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/SwitchProps.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 +53 -53
- package/docs/api/interfaces/UnifiedAuthProviderProps.md +13 -13
- package/docs/api/interfaces/UseInactivityTrackerOptions.md +9 -9
- package/docs/api/interfaces/UseInactivityTrackerReturn.md +8 -8
- package/docs/api/interfaces/UsePublicEventOptions.md +3 -3
- package/docs/api/interfaces/UsePublicEventReturn.md +5 -5
- package/docs/api/interfaces/UsePublicFileDisplayOptions.md +4 -4
- package/docs/api/interfaces/UsePublicFileDisplayReturn.md +9 -9
- package/docs/api/interfaces/UsePublicRouteParamsReturn.md +1 -1
- package/docs/api/interfaces/UseResolvedScopeOptions.md +4 -4
- package/docs/api/interfaces/UseResolvedScopeReturn.md +4 -4
- package/docs/api/interfaces/UserEventAccess.md +11 -11
- package/docs/api/interfaces/UserMenuProps.md +1 -1
- package/docs/api/interfaces/UserProfile.md +1 -1
- package/docs/api/modules.md +591 -220
- package/docs/api-reference/components.md +106 -26
- package/docs/architecture/README.md +0 -3
- package/docs/implementation-guides/data-tables.md +277 -13
- package/docs/implementation-guides/forms.md +1 -16
- package/docs/implementation-guides/permission-enforcement.md +8 -2
- package/docs/styles/README.md +0 -2
- package/examples/README.md +30 -14
- package/examples/STRUCTURE.md +125 -0
- package/examples/components 2/DataTable/HierarchicalActionsExample.tsx +421 -0
- package/examples/components 2/DataTable/HierarchicalExample.tsx +475 -0
- package/examples/components 2/DataTable/InitialPageSizeExample.tsx +177 -0
- package/examples/components 2/DataTable/PerformanceExample.tsx +506 -0
- package/examples/components 2/DataTable/index.ts +13 -0
- package/examples/components 2/Dialog/BasicHtmlTest.tsx +55 -0
- package/examples/components 2/Dialog/DebugHtmlExample.tsx +68 -0
- package/examples/components 2/Dialog/HtmlDialogExample.tsx +202 -0
- package/examples/components 2/Dialog/ScrollableDialogExample.tsx +290 -0
- package/examples/components 2/Dialog/SimpleHtmlTest.tsx +61 -0
- package/examples/components 2/Dialog/SmartDialogExample.tsx +322 -0
- package/examples/components 2/Dialog/index.ts +15 -0
- package/examples/components 2/index.ts +11 -0
- package/examples/features/index.ts +12 -0
- package/{src/examples → examples/features/public-pages}/CorrectPublicPageImplementation.tsx +14 -17
- package/{src/examples → examples/features/public-pages}/PublicEventPage.tsx +14 -27
- package/{src/examples → examples/features/public-pages}/PublicPageApp.tsx +15 -28
- package/{src/examples → examples/features/public-pages}/PublicPageUsageExample.tsx +8 -10
- package/examples/features/public-pages/index.ts +14 -0
- package/examples/features/rbac/CompleteRBACExample.tsx +324 -0
- package/examples/features/rbac/EventBasedApp.tsx +239 -0
- package/examples/features/rbac/PermissionExample.tsx +151 -0
- package/examples/features/rbac/index.ts +13 -0
- package/examples/index.ts +11 -3
- package/package.json +30 -19
- package/src/__tests__/TEST_STANDARD.md +92 -0
- package/src/components/Alert/Alert.tsx +1 -1
- package/src/components/Avatar/Avatar.tsx +1 -1
- package/src/components/Badge/Badge.test.tsx +314 -0
- package/src/components/Badge/Badge.tsx +304 -0
- package/src/components/Badge/index.ts +3 -0
- package/src/components/Button/Button.tsx +1 -1
- package/src/components/Card/Card.tsx +1 -1
- package/src/components/Checkbox/Checkbox.tsx +1 -1
- package/src/components/DataTable/DataTable.test.tsx +1 -1
- package/src/components/DataTable/DataTable.tsx +1 -30
- package/src/components/DataTable/__tests__/DataTable.grouping-aggregation.test.tsx +562 -0
- package/src/components/DataTable/__tests__/DataTableCore.test-setup.ts +217 -0
- package/src/components/DataTable/__tests__/styles.test.ts +3 -3
- package/src/components/DataTable/components/ActionButtons.tsx +0 -15
- package/src/components/DataTable/components/ColumnFilter.tsx +8 -4
- package/src/components/DataTable/components/DataTableBody.tsx +461 -0
- package/src/components/DataTable/components/DataTableCore.tsx +4 -185
- package/src/components/DataTable/components/DataTableErrorBoundary.tsx +1 -1
- package/src/components/DataTable/components/DataTableModals.tsx +1 -27
- package/src/components/DataTable/components/DraggableColumnHeader.tsx +144 -0
- package/src/components/DataTable/components/EditableRow.tsx +1 -1
- package/src/components/DataTable/components/FilterRow.tsx +9 -3
- package/src/components/DataTable/components/ImportModal.tsx +2 -14
- package/src/components/DataTable/components/PaginationControls.tsx +2 -1
- package/src/components/DataTable/components/UnifiedTableBody.tsx +109 -82
- package/src/components/DataTable/components/VirtualizedDataTable.tsx +513 -0
- package/src/components/DataTable/components/__tests__/AccessDeniedPage.test.tsx +14 -68
- package/src/components/DataTable/components/__tests__/ActionButtons.test.tsx +1 -1
- package/src/components/DataTable/components/__tests__/ColumnFilter.test.tsx +62 -0
- package/src/components/DataTable/components/__tests__/DataTableErrorBoundary.test.tsx +1 -1
- package/src/components/DataTable/components/__tests__/DataTableModals.test.tsx +1 -1
- package/src/components/DataTable/components/__tests__/FilterRow.test.tsx +43 -0
- package/src/components/DataTable/components/__tests__/ImportModal.test.tsx +1 -1
- package/src/components/DataTable/core/ActionManager.ts +235 -0
- package/src/components/DataTable/core/ColumnManager.ts +205 -0
- package/src/components/DataTable/core/DataManager.ts +188 -0
- package/src/components/DataTable/core/DataTableContext.tsx +181 -0
- package/src/components/DataTable/core/LocalDataAdapter.ts +273 -0
- package/src/components/DataTable/core/PluginRegistry.ts +229 -0
- package/src/components/DataTable/core/StateManager.ts +311 -0
- package/src/components/DataTable/core/interfaces.ts +338 -0
- package/src/components/DataTable/examples/GroupingAggregationExample.tsx +273 -0
- package/src/components/DataTable/examples/HierarchicalActionsExample.tsx +1 -1
- package/src/components/DataTable/examples/__tests__/HierarchicalActionsExample.test.tsx +1 -1
- package/src/components/DataTable/hooks/useColumnOrderPersistence.ts +1 -1
- package/src/components/DataTable/hooks/useColumnVisibilityPersistence.ts +1 -1
- package/src/components/DataTable/hooks/useDataTablePermissions.ts +2 -23
- package/src/components/DataTable/index.ts +4 -0
- package/src/components/DataTable/styles.ts +28 -7
- package/src/components/DataTable/types.ts +13 -0
- package/src/components/DataTable/utils/__tests__/columnUtils.test.ts +94 -0
- package/src/components/DataTable/utils/__tests__/exportUtils.test.ts +1 -1
- package/src/components/DataTable/utils/aggregationUtils.ts +161 -0
- package/src/components/DataTable/utils/columnUtils.ts +40 -0
- package/src/components/DataTable/utils/debugTools.ts +609 -0
- package/src/components/DataTable/utils/exportUtils.ts +1 -1
- package/src/components/DataTable/utils/flexibleImport.ts +1 -11
- package/src/components/DataTable/utils/index.ts +2 -0
- package/src/components/DataTable/utils/paginationUtils.ts +1 -1
- package/src/components/Dialog/Dialog.tsx +2 -2
- package/src/components/Dialog/utils/__tests__/safeHtml.unit.test.ts +8 -1
- package/src/components/ErrorBoundary/ErrorBoundary.test.tsx +35 -7
- package/src/components/ErrorBoundary/ErrorBoundary.tsx +5 -4
- package/src/components/EventSelector/EventSelector.tsx +3 -2
- package/src/components/FileDisplay/FileDisplay.tsx +2 -36
- package/src/components/FileUpload/FileUpload.test.tsx +2 -2
- package/src/components/FileUpload/FileUpload.tsx +2 -2
- package/src/components/Footer/Footer.test.tsx +1 -1
- package/src/components/Footer/Footer.tsx +1 -1
- package/src/components/Form/Form.test.tsx +5 -510
- package/src/components/Form/Form.tsx +1 -1
- package/src/components/Form/FormField.tsx +1 -1
- package/src/components/Form/index.ts +0 -12
- package/src/components/Header/Header.tsx +1 -1
- package/src/components/Input/Input.tsx +1 -1
- package/src/components/Label/Label.tsx +1 -1
- package/src/components/LoginForm/LoginForm.test.tsx +1 -1
- package/src/components/LoginForm/LoginForm.tsx +1 -1
- package/src/components/NavigationMenu/NavigationMenu.test.tsx +19 -3
- package/src/components/NavigationMenu/NavigationMenu.tsx +9 -8
- package/src/components/OrganisationSelector/OrganisationSelector.tsx +4 -3
- package/src/components/PaceAppLayout/PaceAppLayout.tsx +14 -12
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.integration.test.tsx +0 -16
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.performance.test.tsx +76 -10
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.security.test.tsx +0 -1
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.unit.test.tsx +0 -9
- package/src/components/PaceLoginPage/PaceLoginPage.test.tsx +35 -3
- package/src/components/PaceLoginPage/PaceLoginPage.tsx +14 -13
- package/src/components/PasswordReset/PasswordChangeForm.tsx +1 -1
- package/src/components/PasswordReset/index.ts +0 -2
- package/src/components/Progress/Progress.tsx +1 -1
- package/src/components/ProtectedRoute/ProtectedRoute.test.tsx +35 -8
- package/src/components/ProtectedRoute/ProtectedRoute.tsx +3 -2
- package/src/components/PublicLayout/PublicErrorBoundary.tsx +1 -1
- package/src/components/PublicLayout/PublicLoadingSpinner.tsx +1 -1
- package/src/components/PublicLayout/PublicPageContextChecker.tsx +44 -43
- package/src/components/PublicLayout/PublicPageFooter.tsx +1 -1
- package/src/components/PublicLayout/PublicPageHeader.tsx +1 -15
- package/src/components/PublicLayout/PublicPageProvider.tsx +3 -2
- package/src/components/PublicLayout/__tests__/PublicPageContextChecker.test.tsx +2 -0
- package/src/components/PublicLayout/__tests__/PublicPageFooter.test.tsx +1 -1
- package/src/components/PublicLayout/index.ts +4 -2
- package/src/components/Select/Select.test.tsx +1 -1
- package/src/components/Select/Select.tsx +21 -9
- package/src/components/{SessionRestorationLoader.tsx → SessionRestorationLoader/SessionRestorationLoader.tsx} +3 -2
- package/src/components/SessionRestorationLoader/index.ts +3 -0
- package/src/components/Switch/Switch.tsx +1 -1
- package/src/components/Table/Table.tsx +1 -1
- package/src/components/Table/__tests__/Table.test.tsx +1 -1
- package/src/components/Toast/Toast.tsx +1 -1
- package/src/components/Tooltip/Tooltip.tsx +1 -1
- package/src/components/index.ts +7 -10
- package/src/hooks/__tests__/hooks.integration.test.tsx +37 -22
- package/src/hooks/__tests__/useComponentPerformance.unit.test.tsx +33 -17
- package/src/hooks/__tests__/useDataTablePerformance.unit.test.ts +28 -3
- package/src/hooks/__tests__/useFileDisplay.unit.test.ts +36 -9
- package/src/hooks/__tests__/useFileUrl.unit.test.ts +83 -85
- package/src/hooks/__tests__/useInactivityTracker.unit.test.ts +26 -2
- package/src/hooks/__tests__/usePerformanceMonitor.unit.test.ts +19 -6
- package/src/hooks/__tests__/usePermissionCache.simple.test.ts +17 -4
- package/src/hooks/__tests__/usePermissionCache.unit.test.ts +17 -4
- package/src/hooks/__tests__/usePublicEvent.simple.test.ts +26 -6
- package/src/hooks/__tests__/usePublicFileDisplay.test.ts +16 -6
- package/src/hooks/__tests__/useSecureDataAccess.unit.test.tsx +3 -3
- package/src/hooks/__tests__/useSessionRestoration.unit.test.tsx +17 -3
- package/src/hooks/public/usePublicEvent.ts +7 -6
- package/src/hooks/public/usePublicEventLogo.ts +7 -4
- package/src/hooks/public/usePublicFileDisplay.ts +6 -150
- package/src/hooks/useComponentPerformance.ts +4 -1
- package/src/hooks/useDataTablePerformance.ts +4 -3
- package/src/hooks/useEventTheme.test.ts +18 -5
- package/src/hooks/useEventTheme.ts +4 -1
- package/src/hooks/useEvents.ts +2 -0
- package/src/hooks/useFileDisplay.ts +9 -8
- package/src/hooks/useFileReference.ts +4 -1
- package/src/hooks/useFileUrl.ts +4 -1
- package/src/hooks/useInactivityTracker.ts +5 -4
- package/src/hooks/useOrganisationSecurity.test.ts +33 -12
- package/src/hooks/useOrganisationSecurity.ts +8 -7
- package/src/hooks/usePerformanceMonitor.ts +6 -3
- package/src/hooks/usePermissionCache.ts +13 -6
- package/src/hooks/useSecureDataAccess.test.ts +2 -2
- package/src/hooks/useSecureDataAccess.ts +9 -8
- package/src/hooks/useSessionRestoration.ts +4 -1
- package/src/hooks/useStorage.ts +4 -1
- package/src/index.ts +20 -7
- package/src/providers/services/AuthServiceProvider.tsx +3 -2
- package/src/providers/services/EventServiceProvider.tsx +2 -1
- package/src/providers/services/InactivityServiceProvider.tsx +2 -1
- package/src/providers/services/OrganisationServiceProvider.tsx +2 -1
- package/src/providers/services/UnifiedAuthProvider.tsx +4 -3
- package/src/providers/services/__tests__/AuthServiceProvider.integration.test.tsx +22 -2
- package/src/providers/services/__tests__/UnifiedAuthProvider.integration.test.tsx +24 -2
- package/src/rbac/__tests__/cache-invalidation.test.ts +20 -6
- package/src/rbac/api.ts +5 -2
- package/src/rbac/audit-enhanced.ts +6 -6
- package/src/rbac/audit.test.ts +60 -38
- package/src/rbac/audit.ts +8 -8
- package/src/rbac/cache-invalidation.ts +7 -4
- package/src/rbac/components/EnhancedNavigationMenu.tsx +11 -5
- package/src/rbac/components/NavigationGuard.tsx +7 -3
- package/src/rbac/components/NavigationProvider.tsx +6 -3
- package/src/rbac/components/PagePermissionGuard.tsx +28 -16
- package/src/rbac/components/PagePermissionProvider.tsx +4 -1
- package/src/rbac/components/PermissionEnforcer.tsx +9 -3
- package/src/rbac/components/RoleBasedRouter.tsx +3 -1
- package/src/rbac/components/SecureDataProvider.tsx +7 -3
- package/src/rbac/components/__tests__/EnhancedNavigationMenu.test.tsx +87 -61
- package/src/rbac/components/__tests__/NavigationGuard.test.tsx +83 -33
- package/src/rbac/components/__tests__/NavigationProvider.test.tsx +36 -13
- package/src/rbac/components/__tests__/PagePermissionGuard.test.tsx +2 -2
- package/src/rbac/components/__tests__/PagePermissionProvider.test.tsx +22 -8
- package/src/rbac/components/__tests__/PermissionEnforcer.test.tsx +19 -6
- package/src/rbac/components/__tests__/SecureDataProvider.fixed.test.tsx +43 -17
- package/src/rbac/components/__tests__/SecureDataProvider.test.tsx +42 -17
- package/src/rbac/engine.ts +15 -7
- package/src/rbac/hooks/usePermissions.ts +7 -3
- package/src/rbac/hooks/useResolvedScope.test.ts +2 -2
- package/src/rbac/hooks/useResolvedScope.ts +10 -7
- package/src/rbac/permissions.ts +5 -2
- package/src/rbac/security.test.ts +27 -16
- package/src/rbac/security.ts +5 -4
- package/src/services/AuthService.ts +22 -21
- package/src/services/EventService.ts +12 -12
- package/src/services/InactivityService.ts +5 -4
- package/src/services/OrganisationService.ts +26 -25
- package/src/services/__tests__/AuthService.test.ts +51 -19
- package/src/services/__tests__/EventService.test.ts +37 -5
- package/src/services/__tests__/InactivityService.test.ts +38 -4
- package/src/services/__tests__/OrganisationService.test.ts +3 -8
- package/src/services/base/BaseService.ts +3 -1
- package/src/styles/core.css +3 -0
- package/src/theming/__tests__/runtime.test.ts +21 -12
- package/src/theming/parseEventColours.ts +5 -19
- package/src/theming/runtime.ts +8 -4
- package/src/types/validation.ts +2 -29
- package/src/utils/__tests__/appConfig.unit.test.ts +1 -1
- package/src/utils/__tests__/audit.unit.test.ts +1 -1
- package/src/utils/__tests__/auth-utils.unit.test.ts +1 -1
- package/src/utils/__tests__/bundleAnalysis.unit.test.ts +19 -19
- package/src/utils/__tests__/cn.unit.test.ts +1 -1
- package/src/utils/__tests__/debugLogger.test.ts +1 -1
- package/src/utils/__tests__/deviceFingerprint.unit.test.ts +1 -1
- package/src/utils/__tests__/dynamicUtils.unit.test.ts +1 -1
- package/src/utils/__tests__/formatting.unit.test.ts +1 -1
- package/src/utils/__tests__/lazyLoad.unit.test.tsx +1 -1
- package/src/utils/__tests__/logger.unit.test.ts +1 -1
- package/src/utils/__tests__/organisationContext.unit.test.ts +1 -1
- package/src/utils/__tests__/performanceBenchmark.test.ts +1 -1
- package/src/utils/__tests__/performanceBudgets.unit.test.ts +1 -1
- package/src/utils/__tests__/permissionTypes.unit.test.ts +1 -1
- package/src/utils/__tests__/permissionUtils.unit.test.ts +1 -1
- package/src/utils/__tests__/sanitization.unit.test.ts +1 -1
- package/src/utils/__tests__/schemaUtils.unit.test.ts +1 -1
- package/src/utils/__tests__/secureDataAccess.unit.test.ts +1 -1
- package/src/utils/__tests__/secureErrors.unit.test.ts +33 -15
- package/src/utils/__tests__/secureStorage.unit.test.ts +1 -1
- package/src/utils/__tests__/security.unit.test.ts +40 -18
- package/src/utils/__tests__/securityMonitor.unit.test.ts +1 -1
- package/src/utils/__tests__/sessionTracking.unit.test.ts +40 -29
- package/src/utils/__tests__/validationUtils.unit.test.ts +19 -6
- package/src/utils/app/appConfig.ts +47 -0
- package/src/utils/app/appIdResolver.test.ts +497 -0
- package/src/utils/app/appIdResolver.ts +133 -0
- package/src/utils/app/appNameResolver.simple.test.ts +212 -0
- package/src/utils/app/appNameResolver.test.ts +121 -0
- package/src/utils/app/appNameResolver.ts +195 -0
- package/src/utils/audit/audit.ts +127 -0
- package/src/utils/context/organisationContext.test.ts +322 -0
- package/src/utils/context/organisationContext.ts +156 -0
- package/src/utils/context/sessionTracking.ts +125 -0
- package/src/utils/core/cn.ts +7 -0
- package/src/utils/core/debugLogger.ts +67 -0
- package/src/utils/core/logger.ts +181 -0
- package/src/utils/device/deviceFingerprint.ts +215 -0
- package/src/utils/dynamic/dynamicUtils.ts +105 -0
- package/src/utils/dynamic/lazyLoad.tsx +44 -0
- package/src/utils/file-reference/__tests__/file-reference.test.ts +788 -0
- package/src/utils/file-reference/index.ts +501 -0
- package/src/utils/formatting/formatDate.test.ts +237 -0
- package/src/utils/formatting/formatting.ts +133 -0
- package/src/utils/index.ts +39 -54
- package/src/utils/performance/bundleAnalysis.ts +129 -0
- package/src/utils/performance/performanceBenchmark.ts +64 -0
- package/src/utils/performance/performanceBudgets.ts +110 -0
- package/src/utils/permissions/permissionTypes.ts +37 -0
- package/src/utils/permissions/permissionUtils.test.ts +393 -0
- package/src/utils/permissions/permissionUtils.ts +34 -0
- package/src/utils/security/auth-utils.ts +96 -0
- package/src/utils/security/secureDataAccess.test.ts +711 -0
- package/src/utils/security/secureDataAccess.ts +377 -0
- package/src/utils/security/secureErrors.ts +82 -0
- package/src/utils/security/secureStorage.ts +244 -0
- package/src/utils/security/security.ts +159 -0
- package/src/utils/security/securityMonitor.ts +45 -0
- package/src/utils/storage/__tests__/helpers.unit.test.ts +1 -4
- package/src/utils/storage/helpers.ts +15 -8
- package/src/utils/validation/__tests__/htmlSanitization.unit.test.ts +598 -0
- package/src/{validation → utils/validation}/csrf.ts +1 -1
- package/src/utils/validation/htmlSanitization.ts +184 -0
- package/src/utils/validation/index.ts +79 -0
- package/src/utils/validation/sanitization.ts +333 -0
- package/src/{validation/schemaUtils.ts → utils/validation/schema.ts} +11 -6
- package/src/{validation → utils/validation}/sqlInjectionProtection.ts +2 -0
- package/src/utils/validation/validation.ts +111 -0
- package/src/utils/validation/validationUtils.ts +123 -0
- package/src/validation/index.ts +3 -34
- package/dist/chunk-24MKLB7U.js +0 -81
- package/dist/chunk-24MKLB7U.js.map +0 -1
- package/dist/chunk-3CG5L6RN.js.map +0 -1
- package/dist/chunk-3DBFLLLU.js.map +0 -1
- package/dist/chunk-5F3NDPJV.js.map +0 -1
- package/dist/chunk-66C4BSAY.js.map +0 -1
- package/dist/chunk-BDZUMRBD.js +0 -87
- package/dist/chunk-BDZUMRBD.js.map +0 -1
- package/dist/chunk-BYXRHAIF.js.map +0 -1
- package/dist/chunk-CDQ3PX7L.js +0 -18
- package/dist/chunk-CDQ3PX7L.js.map +0 -1
- package/dist/chunk-CQZU6TFE.js.map +0 -1
- package/dist/chunk-F64FFPOZ.js.map +0 -1
- package/dist/chunk-GEVIB2UB.js.map +0 -1
- package/dist/chunk-GKHF54DI.js.map +0 -1
- package/dist/chunk-GVDR7WNV.js.map +0 -1
- package/dist/chunk-HMNOSGVA.js.map +0 -1
- package/dist/chunk-JCQZ6LA7.js.map +0 -1
- package/dist/chunk-M6DDYFUD.js.map +0 -1
- package/dist/chunk-O3NWNXDY.js.map +0 -1
- package/dist/chunk-PYUXFQJ3.js.map +0 -1
- package/dist/chunk-UJI6WSMD.js.map +0 -1
- package/dist/chunk-VZ5OR6HD.js.map +0 -1
- package/dist/chunk-WP5I5GLN.js.map +0 -1
- package/dist/chunk-ZYZCRSBD.js.map +0 -1
- package/dist/validation-DnhrNMju.d.ts +0 -159
- package/src/components/PublicLayout/__tests__/PublicPageDebugger.test.tsx +0 -185
- package/src/validation/__tests__/common.unit.test.ts +0 -101
- package/src/validation/__tests__/csrf.unit.test.ts +0 -365
- package/src/validation/__tests__/passwordSchema.unit.test.ts +0 -203
- package/src/validation/__tests__/sanitization.unit.test.ts +0 -250
- package/src/validation/__tests__/schemaUtils.unit.test.ts +0 -451
- package/src/validation/__tests__/sqlInjectionProtection.unit.test.ts +0 -462
- package/src/validation/__tests__/user.unit.test.ts +0 -440
- package/src/validation/sanitization.ts +0 -96
- /package/dist/{DataTable-A36PJG6N.js.map → DataTable-6M4L6BI2.js.map} +0 -0
- /package/dist/{UnifiedAuthProvider-CQDZRJIS.js.map → UnifiedAuthProvider-XIQQ7LVU.js.map} +0 -0
- /package/dist/{api-TNIBJWLM.js.map → api-45XYYO2A.js.map} +0 -0
- /package/dist/{audit-T36HM7IM.js.map → audit-64X3VJXB.js.map} +0 -0
- /package/dist/{chunk-CTJRBUX2.js.map → chunk-6LAAY47Q.js.map} +0 -0
- /package/dist/{chunk-ZV77RZMU.js.map → chunk-INQLMHPF.js.map} +0 -0
- /package/dist/{useInactivityTracker-MRUU55XI.js.map → useInactivityTracker-TO6ZOF35.js.map} +0 -0
- /package/src/{validation → utils/validation}/common.ts +0 -0
- /package/src/{validation → utils/validation}/passwordSchema.ts +0 -0
- /package/src/{validation → utils/validation}/user.ts +0 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file HTML Dialog Example
|
|
3
|
+
* @package @jmruthers/pace-core
|
|
4
|
+
* @module Components/Dialog/Examples
|
|
5
|
+
* @since 0.4.36
|
|
6
|
+
*
|
|
7
|
+
* Example demonstrating HTML content rendering in Dialog components.
|
|
8
|
+
* Shows how to use htmlContent prop for rich text formatting.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import React from 'react';
|
|
12
|
+
import {
|
|
13
|
+
Dialog,
|
|
14
|
+
DialogTrigger,
|
|
15
|
+
DialogContent,
|
|
16
|
+
DialogHeader,
|
|
17
|
+
DialogTitle,
|
|
18
|
+
DialogDescription,
|
|
19
|
+
DialogBody,
|
|
20
|
+
DialogFooter
|
|
21
|
+
} from '../Dialog';
|
|
22
|
+
import { Button } from '../../Button';
|
|
23
|
+
|
|
24
|
+
export function HtmlDialogExample() {
|
|
25
|
+
const importInstructionsHtml = `
|
|
26
|
+
<h2>Import Dishes or Recipes</h2>
|
|
27
|
+
<p>Upload a CSV file with dish or recipe data. The system will automatically detect the format based on your column headers.</p>
|
|
28
|
+
|
|
29
|
+
<h3>DISH FORMAT (3 columns):</h3>
|
|
30
|
+
<ul>
|
|
31
|
+
<li><strong>Required:</strong> <code>dish_code</code>, <code>dish_name</code>, <code>mealtype_name</code></li>
|
|
32
|
+
<li><strong>Optional:</strong> <code>dish_description</code></li>
|
|
33
|
+
</ul>
|
|
34
|
+
|
|
35
|
+
<h4>Examples:</h4>
|
|
36
|
+
<ul>
|
|
37
|
+
<li><code>dish_code</code>: BBQ, PC, CTY</li>
|
|
38
|
+
<li><code>dish_name</code>: BBQ hamburgers and potato salad</li>
|
|
39
|
+
<li><code>mealtype_name</code>: Breakfast, Lunch, Dinner</li>
|
|
40
|
+
</ul>
|
|
41
|
+
|
|
42
|
+
<h3>RECIPE FORMAT (8 columns):</h3>
|
|
43
|
+
<ul>
|
|
44
|
+
<li><strong>Required:</strong> <code>dish_code</code>, <code>dish_name</code>, <code>mealtype_name</code>, <code>diettype_name</code>, <code>item_name</code>, <code>recipe_qtypp</code>, <code>recipe_uptake</code></li>
|
|
45
|
+
<li><strong>Optional:</strong> <code>item_brand</code></li>
|
|
46
|
+
</ul>
|
|
47
|
+
|
|
48
|
+
<h4>Examples:</h4>
|
|
49
|
+
<ul>
|
|
50
|
+
<li><code>dish_code</code>: BBQ</li>
|
|
51
|
+
<li><code>dish_name</code>: BBQ hamburgers and potato salad</li>
|
|
52
|
+
<li><code>mealtype_name</code>: Dinner</li>
|
|
53
|
+
<li><code>diettype_name</code>: Standard, Gluten Free, Vegan</li>
|
|
54
|
+
<li><code>item_name</code>: Lettuce iceberg shredded</li>
|
|
55
|
+
<li><code>item_brand</code>: Masterfoods, Coles</li>
|
|
56
|
+
<li><code>recipe_qtypp</code>: 35, 1.66</li>
|
|
57
|
+
<li><code>recipe_uptake</code>: 1.0, 0.75</li>
|
|
58
|
+
</ul>
|
|
59
|
+
|
|
60
|
+
<div style="background-color: #fef3c7; padding: 12px; border-radius: 6px; margin: 16px 0;">
|
|
61
|
+
<strong>⚠️ IMPORTANT:</strong> Recipe imports will replace all existing recipe data for dishes in the file.
|
|
62
|
+
</div>
|
|
63
|
+
`;
|
|
64
|
+
|
|
65
|
+
const welcomeMessageHtml = `
|
|
66
|
+
<h1>Welcome to <strong>PACE Core</strong>!</h1>
|
|
67
|
+
<p>This dialog demonstrates the new <em>HTML content rendering</em> feature.</p>
|
|
68
|
+
|
|
69
|
+
<h2>Features:</h2>
|
|
70
|
+
<ul>
|
|
71
|
+
<li>✅ <strong>Safe HTML rendering</strong> with automatic sanitization</li>
|
|
72
|
+
<li>✅ <strong>Rich text formatting</strong> (bold, italic, lists, etc.)</li>
|
|
73
|
+
<li>✅ <strong>Code highlighting</strong> with <code><code></code> tags</li>
|
|
74
|
+
<li>✅ <strong>Custom styling</strong> with inline styles</li>
|
|
75
|
+
<li>✅ <strong>Security first</strong> - dangerous content is automatically removed</li>
|
|
76
|
+
</ul>
|
|
77
|
+
|
|
78
|
+
<h3>Supported HTML Elements:</h3>
|
|
79
|
+
<p>You can use most common HTML elements including:</p>
|
|
80
|
+
<ul>
|
|
81
|
+
<li>Headings: <code>h1</code> through <code>h6</code></li>
|
|
82
|
+
<li>Text formatting: <strong>strong</strong>, <em>em</em>, <u>underline</u></li>
|
|
83
|
+
<li>Lists: <code>ul</code>, <code>ol</code>, <code>li</code></li>
|
|
84
|
+
<li>Code: <code>code</code>, <code>pre</code></li>
|
|
85
|
+
<li>Links: <a href="#" onclick="return false;">example link</a></li>
|
|
86
|
+
<li>Tables: <code>table</code>, <code>tr</code>, <code>td</code></li>
|
|
87
|
+
</ul>
|
|
88
|
+
`;
|
|
89
|
+
|
|
90
|
+
return (
|
|
91
|
+
<div className="space-y-4">
|
|
92
|
+
<h2 className="text-2xl font-bold">HTML Dialog Examples</h2>
|
|
93
|
+
|
|
94
|
+
{/* Example 1: Import Instructions Dialog */}
|
|
95
|
+
<Dialog>
|
|
96
|
+
<DialogTrigger asChild>
|
|
97
|
+
<Button variant="outline">Import Instructions</Button>
|
|
98
|
+
</DialogTrigger>
|
|
99
|
+
<DialogContent size="lg" enableScrolling={true} maxHeightPercent={80}>
|
|
100
|
+
<DialogHeader>
|
|
101
|
+
<DialogTitle htmlContent="Import Dishes or Recipes" />
|
|
102
|
+
<DialogDescription htmlContent="Follow the instructions below to upload your CSV file with the correct format." />
|
|
103
|
+
</DialogHeader>
|
|
104
|
+
<DialogBody
|
|
105
|
+
htmlContent={importInstructionsHtml}
|
|
106
|
+
allowHtml={true}
|
|
107
|
+
strictSanitization={true}
|
|
108
|
+
logWarnings={true}
|
|
109
|
+
/>
|
|
110
|
+
<DialogFooter>
|
|
111
|
+
<Button variant="outline">Cancel</Button>
|
|
112
|
+
<Button>Select CSV File</Button>
|
|
113
|
+
</DialogFooter>
|
|
114
|
+
</DialogContent>
|
|
115
|
+
</Dialog>
|
|
116
|
+
|
|
117
|
+
{/* Example 2: Welcome Message Dialog */}
|
|
118
|
+
<Dialog>
|
|
119
|
+
<DialogTrigger asChild>
|
|
120
|
+
<Button>Welcome Message</Button>
|
|
121
|
+
</DialogTrigger>
|
|
122
|
+
<DialogContent size="md">
|
|
123
|
+
<DialogHeader>
|
|
124
|
+
<DialogTitle htmlContent="🎉 New Feature Available!" />
|
|
125
|
+
<DialogDescription htmlContent="Learn about the new HTML content rendering capabilities." />
|
|
126
|
+
</DialogHeader>
|
|
127
|
+
<DialogBody
|
|
128
|
+
htmlContent={welcomeMessageHtml}
|
|
129
|
+
allowHtml={true}
|
|
130
|
+
/>
|
|
131
|
+
<DialogFooter>
|
|
132
|
+
<Button variant="outline">Learn More</Button>
|
|
133
|
+
<Button>Get Started</Button>
|
|
134
|
+
</DialogFooter>
|
|
135
|
+
</DialogContent>
|
|
136
|
+
</Dialog>
|
|
137
|
+
|
|
138
|
+
{/* Example 3: Mixed Content Dialog */}
|
|
139
|
+
<Dialog>
|
|
140
|
+
<DialogTrigger asChild>
|
|
141
|
+
<Button variant="secondary">Mixed Content</Button>
|
|
142
|
+
</DialogTrigger>
|
|
143
|
+
<DialogContent size="lg">
|
|
144
|
+
<DialogHeader>
|
|
145
|
+
<DialogTitle>Mixed Content Example</DialogTitle>
|
|
146
|
+
<DialogDescription htmlContent="This dialog shows <strong>HTML in the description</strong> and <em>React children</em> in the body." />
|
|
147
|
+
</DialogHeader>
|
|
148
|
+
<DialogBody>
|
|
149
|
+
<div className="space-y-4">
|
|
150
|
+
<h3 className="text-lg font-semibold">React Children Content</h3>
|
|
151
|
+
<p>This content is rendered using React children, not HTML strings.</p>
|
|
152
|
+
<div className="bg-main-50 p-4 rounded-lg">
|
|
153
|
+
<p className="text-main-800">
|
|
154
|
+
You can mix HTML content (via <code>htmlContent</code> prop)
|
|
155
|
+
with React children for maximum flexibility.
|
|
156
|
+
</p>
|
|
157
|
+
</div>
|
|
158
|
+
</div>
|
|
159
|
+
</DialogBody>
|
|
160
|
+
<DialogFooter>
|
|
161
|
+
<Button variant="outline">Cancel</Button>
|
|
162
|
+
<Button>Continue</Button>
|
|
163
|
+
</DialogFooter>
|
|
164
|
+
</DialogContent>
|
|
165
|
+
</Dialog>
|
|
166
|
+
|
|
167
|
+
{/* Example 4: Security Demo */}
|
|
168
|
+
<Dialog>
|
|
169
|
+
<DialogTrigger asChild>
|
|
170
|
+
<Button variant="destructive">Security Demo</Button>
|
|
171
|
+
</DialogTrigger>
|
|
172
|
+
<DialogContent size="md">
|
|
173
|
+
<DialogHeader>
|
|
174
|
+
<DialogTitle>Security Demonstration</DialogTitle>
|
|
175
|
+
<DialogDescription>This shows how dangerous HTML is automatically sanitized.</DialogDescription>
|
|
176
|
+
</DialogHeader>
|
|
177
|
+
<DialogBody
|
|
178
|
+
htmlContent={`
|
|
179
|
+
<h3>Safe Content</h3>
|
|
180
|
+
<p>This content is safe and will be rendered normally.</p>
|
|
181
|
+
|
|
182
|
+
<h3>Dangerous Content (Will Be Removed)</h3>
|
|
183
|
+
<p>The following dangerous elements will be automatically removed:</p>
|
|
184
|
+
<ul>
|
|
185
|
+
<li>Script tags: <script>alert('This will be removed')</script></li>
|
|
186
|
+
<li>Event handlers: <span onclick="alert('This will be removed')">Click me</span></li>
|
|
187
|
+
<li>JavaScript protocols: <a href="javascript:alert('This will be removed')">Dangerous link</a></li>
|
|
188
|
+
</ul>
|
|
189
|
+
|
|
190
|
+
<p><strong>Result:</strong> Only the safe content above will be displayed!</p>
|
|
191
|
+
`}
|
|
192
|
+
allowHtml={true}
|
|
193
|
+
logWarnings={true}
|
|
194
|
+
/>
|
|
195
|
+
<DialogFooter>
|
|
196
|
+
<Button>Got it!</Button>
|
|
197
|
+
</DialogFooter>
|
|
198
|
+
</DialogContent>
|
|
199
|
+
</Dialog>
|
|
200
|
+
</div>
|
|
201
|
+
);
|
|
202
|
+
}
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Scrollable Dialog Example with Height and Width Constraints
|
|
3
|
+
* @package @jmruthers/pace-core
|
|
4
|
+
* @module Components/Dialog/Examples
|
|
5
|
+
* @since 0.1.0
|
|
6
|
+
*
|
|
7
|
+
* Complete example demonstrating Dialog component with:
|
|
8
|
+
* - Scrolling enabled
|
|
9
|
+
* - Height constraints (percentage and fixed)
|
|
10
|
+
* - Width constraints (percentage and fixed)
|
|
11
|
+
* - Sticky headers and footers
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import React from 'react';
|
|
15
|
+
import {
|
|
16
|
+
Dialog,
|
|
17
|
+
DialogTrigger,
|
|
18
|
+
DialogContent,
|
|
19
|
+
DialogHeader,
|
|
20
|
+
DialogBody,
|
|
21
|
+
DialogFooter,
|
|
22
|
+
DialogTitle,
|
|
23
|
+
DialogDescription,
|
|
24
|
+
Button,
|
|
25
|
+
Card,
|
|
26
|
+
} from '../../../index';
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Example demonstrating Dialog with scrolling, height, and width constraints
|
|
30
|
+
*/
|
|
31
|
+
export function ScrollableDialogExample() {
|
|
32
|
+
// Generate long content for scrolling demonstration
|
|
33
|
+
const generateLongContent = (count: number) => {
|
|
34
|
+
return Array.from({ length: count }, (_, i) => (
|
|
35
|
+
<Card key={i} className="p-4">
|
|
36
|
+
<h4>Content Section {i + 1}</h4>
|
|
37
|
+
<p>
|
|
38
|
+
This is content section {i + 1}. In a real application, this could be form fields,
|
|
39
|
+
data displays, tables, or any other content that might make the dialog tall.
|
|
40
|
+
The dialog will automatically show a scrollbar when content exceeds the height constraints.
|
|
41
|
+
</p>
|
|
42
|
+
<p>
|
|
43
|
+
You can scroll through all the content while the header and footer remain visible
|
|
44
|
+
at the top and bottom of the dialog.
|
|
45
|
+
</p>
|
|
46
|
+
</Card>
|
|
47
|
+
));
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<div className="p-6 space-y-6">
|
|
52
|
+
<div>
|
|
53
|
+
<h2>Scrollable Dialog with Constraints</h2>
|
|
54
|
+
<p>Examples demonstrating dialogs with scrolling, height, and width constraints.</p>
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
58
|
+
{/* Example 1: Percentage-based constraints */}
|
|
59
|
+
<Dialog>
|
|
60
|
+
<DialogTrigger asChild>
|
|
61
|
+
<Button variant="outline" className="w-full">
|
|
62
|
+
Percentage Constraints
|
|
63
|
+
</Button>
|
|
64
|
+
</DialogTrigger>
|
|
65
|
+
<DialogContent
|
|
66
|
+
enableScrolling={true}
|
|
67
|
+
maxHeightPercent={80}
|
|
68
|
+
maxWidthPercent={90}
|
|
69
|
+
>
|
|
70
|
+
<DialogHeader sticky={true}>
|
|
71
|
+
<DialogTitle>Percentage-Based Constraints</DialogTitle>
|
|
72
|
+
<DialogDescription>
|
|
73
|
+
This dialog uses 90% of viewport width and 80% of viewport height.
|
|
74
|
+
Content will scroll when it exceeds these constraints.
|
|
75
|
+
</DialogDescription>
|
|
76
|
+
</DialogHeader>
|
|
77
|
+
<DialogBody>
|
|
78
|
+
<div className="space-y-4">
|
|
79
|
+
{generateLongContent(25)}
|
|
80
|
+
</div>
|
|
81
|
+
</DialogBody>
|
|
82
|
+
<DialogFooter sticky={true}>
|
|
83
|
+
<Button variant="outline">Cancel</Button>
|
|
84
|
+
<Button>Save Changes</Button>
|
|
85
|
+
</DialogFooter>
|
|
86
|
+
</DialogContent>
|
|
87
|
+
</Dialog>
|
|
88
|
+
|
|
89
|
+
{/* Example 2: Fixed pixel constraints */}
|
|
90
|
+
<Dialog>
|
|
91
|
+
<DialogTrigger asChild>
|
|
92
|
+
<Button variant="outline" className="w-full">
|
|
93
|
+
Fixed Pixel Constraints
|
|
94
|
+
</Button>
|
|
95
|
+
</DialogTrigger>
|
|
96
|
+
<DialogContent
|
|
97
|
+
enableScrolling={true}
|
|
98
|
+
maxHeight="600px"
|
|
99
|
+
maxWidth="800px"
|
|
100
|
+
>
|
|
101
|
+
<DialogHeader sticky={true}>
|
|
102
|
+
<DialogTitle>Fixed Pixel Constraints</DialogTitle>
|
|
103
|
+
<DialogDescription>
|
|
104
|
+
This dialog has a fixed maximum height of 600px and width of 800px.
|
|
105
|
+
Perfect for consistent sizing regardless of viewport size.
|
|
106
|
+
</DialogDescription>
|
|
107
|
+
</DialogHeader>
|
|
108
|
+
<DialogBody>
|
|
109
|
+
<div className="space-y-4">
|
|
110
|
+
{generateLongContent(20)}
|
|
111
|
+
</div>
|
|
112
|
+
</DialogBody>
|
|
113
|
+
<DialogFooter sticky={true}>
|
|
114
|
+
<Button variant="outline">Cancel</Button>
|
|
115
|
+
<Button>Confirm</Button>
|
|
116
|
+
</DialogFooter>
|
|
117
|
+
</DialogContent>
|
|
118
|
+
</Dialog>
|
|
119
|
+
|
|
120
|
+
{/* Example 3: Mixed constraints (percentage height, fixed width) */}
|
|
121
|
+
<Dialog>
|
|
122
|
+
<DialogTrigger asChild>
|
|
123
|
+
<Button variant="outline" className="w-full">
|
|
124
|
+
Mixed Constraints
|
|
125
|
+
</Button>
|
|
126
|
+
</DialogTrigger>
|
|
127
|
+
<DialogContent
|
|
128
|
+
enableScrolling={true}
|
|
129
|
+
maxHeightPercent={75}
|
|
130
|
+
maxWidth="700px"
|
|
131
|
+
>
|
|
132
|
+
<DialogHeader sticky={true}>
|
|
133
|
+
<DialogTitle>Mixed Constraints</DialogTitle>
|
|
134
|
+
<DialogDescription>
|
|
135
|
+
This dialog uses 75% of viewport height but has a fixed width of 700px.
|
|
136
|
+
You can mix percentage and fixed constraints as needed.
|
|
137
|
+
</DialogDescription>
|
|
138
|
+
</DialogHeader>
|
|
139
|
+
<DialogBody>
|
|
140
|
+
<div className="space-y-4">
|
|
141
|
+
{generateLongContent(30)}
|
|
142
|
+
</div>
|
|
143
|
+
</DialogBody>
|
|
144
|
+
<DialogFooter sticky={true}>
|
|
145
|
+
<Button variant="outline">Close</Button>
|
|
146
|
+
<Button>Apply</Button>
|
|
147
|
+
</DialogFooter>
|
|
148
|
+
</DialogContent>
|
|
149
|
+
</Dialog>
|
|
150
|
+
|
|
151
|
+
{/* Example 4: Minimum and maximum constraints */}
|
|
152
|
+
<Dialog>
|
|
153
|
+
<DialogTrigger asChild>
|
|
154
|
+
<Button variant="outline" className="w-full">
|
|
155
|
+
Min/Max Constraints
|
|
156
|
+
</Button>
|
|
157
|
+
</DialogTrigger>
|
|
158
|
+
<DialogContent
|
|
159
|
+
enableScrolling={true}
|
|
160
|
+
maxHeightPercent={85}
|
|
161
|
+
maxWidthPercent={80}
|
|
162
|
+
minHeight="400px"
|
|
163
|
+
minWidth="500px"
|
|
164
|
+
>
|
|
165
|
+
<DialogHeader sticky={true}>
|
|
166
|
+
<DialogTitle>Min/Max Constraints</DialogTitle>
|
|
167
|
+
<DialogDescription>
|
|
168
|
+
This dialog has both minimum (400px height, 500px width) and maximum
|
|
169
|
+
(85% height, 80% width) constraints. It will never be smaller than
|
|
170
|
+
the minimums or larger than the maximums.
|
|
171
|
+
</DialogDescription>
|
|
172
|
+
</DialogHeader>
|
|
173
|
+
<DialogBody>
|
|
174
|
+
<div className="space-y-4">
|
|
175
|
+
{generateLongContent(15)}
|
|
176
|
+
</div>
|
|
177
|
+
</DialogBody>
|
|
178
|
+
<DialogFooter sticky={true}>
|
|
179
|
+
<Button variant="outline">Cancel</Button>
|
|
180
|
+
<Button>Save</Button>
|
|
181
|
+
</DialogFooter>
|
|
182
|
+
</DialogContent>
|
|
183
|
+
</Dialog>
|
|
184
|
+
|
|
185
|
+
{/* Example 5: Narrow dialog with tall content */}
|
|
186
|
+
<Dialog>
|
|
187
|
+
<DialogTrigger asChild>
|
|
188
|
+
<Button variant="outline" className="w-full">
|
|
189
|
+
Narrow & Tall
|
|
190
|
+
</Button>
|
|
191
|
+
</DialogTrigger>
|
|
192
|
+
<DialogContent
|
|
193
|
+
enableScrolling={true}
|
|
194
|
+
maxHeightPercent={90}
|
|
195
|
+
maxWidth="500px"
|
|
196
|
+
>
|
|
197
|
+
<DialogHeader sticky={true}>
|
|
198
|
+
<DialogTitle>Narrow Dialog with Tall Content</DialogTitle>
|
|
199
|
+
<DialogDescription>
|
|
200
|
+
A narrow dialog (500px) that uses 90% of viewport height.
|
|
201
|
+
Great for side panels or detail views.
|
|
202
|
+
</DialogDescription>
|
|
203
|
+
</DialogHeader>
|
|
204
|
+
<DialogBody>
|
|
205
|
+
<div className="space-y-4">
|
|
206
|
+
{generateLongContent(40)}
|
|
207
|
+
</div>
|
|
208
|
+
</DialogBody>
|
|
209
|
+
<DialogFooter sticky={true}>
|
|
210
|
+
<Button variant="outline">Close</Button>
|
|
211
|
+
<Button>Done</Button>
|
|
212
|
+
</DialogFooter>
|
|
213
|
+
</DialogContent>
|
|
214
|
+
</Dialog>
|
|
215
|
+
|
|
216
|
+
{/* Example 6: Wide dialog with moderate height */}
|
|
217
|
+
<Dialog>
|
|
218
|
+
<DialogTrigger asChild>
|
|
219
|
+
<Button variant="outline" className="w-full">
|
|
220
|
+
Wide & Moderate Height
|
|
221
|
+
</Button>
|
|
222
|
+
</DialogTrigger>
|
|
223
|
+
<DialogContent
|
|
224
|
+
enableScrolling={true}
|
|
225
|
+
maxHeight="500px"
|
|
226
|
+
maxWidthPercent={95}
|
|
227
|
+
>
|
|
228
|
+
<DialogHeader sticky={true}>
|
|
229
|
+
<DialogTitle>Wide Dialog with Moderate Height</DialogTitle>
|
|
230
|
+
<DialogDescription>
|
|
231
|
+
A wide dialog (95% width) with a fixed height of 500px.
|
|
232
|
+
Perfect for data tables or wide forms.
|
|
233
|
+
</DialogDescription>
|
|
234
|
+
</DialogHeader>
|
|
235
|
+
<DialogBody>
|
|
236
|
+
<div className="space-y-4">
|
|
237
|
+
{generateLongContent(18)}
|
|
238
|
+
</div>
|
|
239
|
+
</DialogBody>
|
|
240
|
+
<DialogFooter sticky={true}>
|
|
241
|
+
<Button variant="outline">Cancel</Button>
|
|
242
|
+
<Button>Submit</Button>
|
|
243
|
+
</DialogFooter>
|
|
244
|
+
</DialogContent>
|
|
245
|
+
</Dialog>
|
|
246
|
+
</div>
|
|
247
|
+
|
|
248
|
+
<Card className="p-6">
|
|
249
|
+
<h3>Key Features Demonstrated:</h3>
|
|
250
|
+
<ul className="list-disc list-inside space-y-2">
|
|
251
|
+
<li>
|
|
252
|
+
<strong>enableScrolling={true}:</strong> Enables the flex layout and scrolling
|
|
253
|
+
functionality. Required for proper scroll behavior.
|
|
254
|
+
</li>
|
|
255
|
+
<li>
|
|
256
|
+
<strong>maxHeightPercent:</strong> Maximum height as a percentage of viewport
|
|
257
|
+
height (0-100). Automatically capped at 95% to ensure margins.
|
|
258
|
+
</li>
|
|
259
|
+
<li>
|
|
260
|
+
<strong>maxWidthPercent:</strong> Maximum width as a percentage of viewport
|
|
261
|
+
width (0-100). Automatically capped at 95% to ensure margins.
|
|
262
|
+
</li>
|
|
263
|
+
<li>
|
|
264
|
+
<strong>maxHeight:</strong> Fixed maximum height in CSS units (e.g., "600px",
|
|
265
|
+
"50vh", "20rem"). Overrides maxHeightPercent if both are provided.
|
|
266
|
+
</li>
|
|
267
|
+
<li>
|
|
268
|
+
<strong>maxWidth:</strong> Fixed maximum width in CSS units. Overrides
|
|
269
|
+
maxWidthPercent and size prop if provided.
|
|
270
|
+
</li>
|
|
271
|
+
<li>
|
|
272
|
+
<strong>minHeight:</strong> Minimum height in CSS units. Ensures dialog
|
|
273
|
+
never gets smaller than this value.
|
|
274
|
+
</li>
|
|
275
|
+
<li>
|
|
276
|
+
<strong>minWidth:</strong> Minimum width in CSS units. Ensures dialog
|
|
277
|
+
never gets smaller than this value.
|
|
278
|
+
</li>
|
|
279
|
+
<li>
|
|
280
|
+
<strong>sticky={true}:</strong> On DialogHeader and DialogFooter, keeps
|
|
281
|
+
these elements visible while scrolling through content.
|
|
282
|
+
</li>
|
|
283
|
+
</ul>
|
|
284
|
+
</Card>
|
|
285
|
+
</div>
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
export default ScrollableDialogExample;
|
|
290
|
+
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Simple HTML Test
|
|
3
|
+
* @package @jmruthers/pace-core
|
|
4
|
+
* @module Components/Dialog/Examples
|
|
5
|
+
* @since 0.4.37
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React, { useState } from 'react';
|
|
9
|
+
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogBody, DialogFooter } from '../Dialog';
|
|
10
|
+
import { Button } from '../../Button';
|
|
11
|
+
|
|
12
|
+
export function SimpleHtmlTest() {
|
|
13
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
14
|
+
|
|
15
|
+
// Very simple HTML test
|
|
16
|
+
const simpleHtml = '<p>Hello <strong>world</strong>!</p>';
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<div className="p-4">
|
|
20
|
+
<h2 className="text-xl font-bold mb-4">Simple HTML Test</h2>
|
|
21
|
+
|
|
22
|
+
<div className="mb-4">
|
|
23
|
+
<h3 className="font-semibold mb-2">Test HTML:</h3>
|
|
24
|
+
<pre className="bg-sec-100 p-2 rounded text-xs">
|
|
25
|
+
{simpleHtml}
|
|
26
|
+
</pre>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
<div className="mb-4">
|
|
30
|
+
<h3 className="font-semibold mb-2">Expected Result:</h3>
|
|
31
|
+
<div className="bg-main-50 p-2 rounded">
|
|
32
|
+
Hello <strong>world</strong>!
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<Button onClick={() => setIsOpen(true)}>
|
|
37
|
+
Test HTML Rendering
|
|
38
|
+
</Button>
|
|
39
|
+
|
|
40
|
+
<Dialog open={isOpen} onOpenChange={setIsOpen}>
|
|
41
|
+
<DialogContent size="md">
|
|
42
|
+
<DialogHeader>
|
|
43
|
+
<DialogTitle>HTML Test</DialogTitle>
|
|
44
|
+
</DialogHeader>
|
|
45
|
+
|
|
46
|
+
<DialogBody htmlContent={simpleHtml} allowHtml={true}>
|
|
47
|
+
<div className="text-acc-500">
|
|
48
|
+
HTML content failed to render. This is fallback content.
|
|
49
|
+
</div>
|
|
50
|
+
</DialogBody>
|
|
51
|
+
|
|
52
|
+
<DialogFooter>
|
|
53
|
+
<Button variant="outline" onClick={() => setIsOpen(false)}>
|
|
54
|
+
Close
|
|
55
|
+
</Button>
|
|
56
|
+
</DialogFooter>
|
|
57
|
+
</DialogContent>
|
|
58
|
+
</Dialog>
|
|
59
|
+
</div>
|
|
60
|
+
);
|
|
61
|
+
}
|