@jmruthers/pace-core 0.5.60 → 0.5.62

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. package/README.md +2 -2
  2. package/dist/{DataTable-5M6MV2VY.js → DataTable-7BER7PDS.js} +6 -6
  3. package/dist/{DataTable-DqDDvBfI.d.ts → DataTable-D15XipLZ.d.ts} +7 -0
  4. package/dist/{PublicLoadingSpinner-SL8WaQN7.d.ts → PublicLoadingSpinner-CXJ-W9wZ.d.ts} +3 -27
  5. package/dist/{chunk-SFMRBGGK.js → chunk-2LPYEFXI.js} +136 -137
  6. package/dist/chunk-2LPYEFXI.js.map +1 -0
  7. package/dist/{chunk-XMTHMOOM.js → chunk-BTCA3ENN.js} +4 -4
  8. package/dist/{chunk-ESXTFEE6.js → chunk-C7GUF747.js} +3 -3
  9. package/dist/{chunk-W7PPXKTZ.js → chunk-CKNY7HYS.js} +2 -2
  10. package/dist/{chunk-5MLDIGHB.js → chunk-FVDOEGGG.js} +3 -3
  11. package/dist/{chunk-NQ4TOOO6.js → chunk-L3RV2ALE.js} +1 -1
  12. package/dist/chunk-L3RV2ALE.js.map +1 -0
  13. package/dist/{chunk-NMNDTCOR.js → chunk-QVEOQVD4.js} +3 -3
  14. package/dist/{chunk-XDXG6QVH.js → chunk-S66AJVI2.js} +13 -6
  15. package/dist/chunk-S66AJVI2.js.map +1 -0
  16. package/dist/{chunk-E4FPK232.js → chunk-T2MQY57J.js} +2 -2
  17. package/dist/{chunk-ITPVFKDH.js → chunk-T6HVDA24.js} +129 -12
  18. package/dist/chunk-T6HVDA24.js.map +1 -0
  19. package/dist/{chunk-STT7INZR.js → chunk-ULBI5JGB.js} +2 -1
  20. package/dist/{chunk-CGSYCF2W.js → chunk-VTJ5HCZB.js} +2 -2
  21. package/dist/components.d.ts +81 -4
  22. package/dist/components.js +258 -11
  23. package/dist/components.js.map +1 -1
  24. package/dist/hooks.d.ts +2 -61
  25. package/dist/hooks.js +31 -146
  26. package/dist/hooks.js.map +1 -1
  27. package/dist/index.d.ts +4 -3
  28. package/dist/index.js +14 -14
  29. package/dist/index.js.map +1 -1
  30. package/dist/providers.js +4 -4
  31. package/dist/rbac/index.js +6 -6
  32. package/dist/styles/index.d.ts +1 -1
  33. package/dist/styles/index.js +1 -1
  34. package/dist/types.js +1 -1
  35. package/dist/useToast-Bm6TnSK-.d.ts +63 -0
  36. package/dist/utils.d.ts +1 -1
  37. package/dist/utils.js +1 -1
  38. package/docs/README.md +1 -1
  39. package/docs/api/README.md +2 -2
  40. package/docs/api/classes/ErrorBoundary.md +1 -1
  41. package/docs/api/classes/InvalidScopeError.md +1 -1
  42. package/docs/api/classes/MissingUserContextError.md +1 -1
  43. package/docs/api/classes/OrganisationContextRequiredError.md +1 -1
  44. package/docs/api/classes/PermissionDeniedError.md +1 -1
  45. package/docs/api/classes/PublicErrorBoundary.md +1 -1
  46. package/docs/api/classes/RBACAuditManager.md +1 -1
  47. package/docs/api/classes/RBACCache.md +1 -1
  48. package/docs/api/classes/RBACEngine.md +1 -1
  49. package/docs/api/classes/RBACError.md +1 -1
  50. package/docs/api/classes/RBACNotInitializedError.md +1 -1
  51. package/docs/api/classes/SecureSupabaseClient.md +1 -1
  52. package/docs/api/classes/StorageUtils.md +1 -1
  53. package/docs/api/interfaces/AggregateConfig.md +1 -1
  54. package/docs/api/interfaces/ButtonProps.md +1 -1
  55. package/docs/api/interfaces/CardProps.md +1 -1
  56. package/docs/api/interfaces/ColorPalette.md +1 -1
  57. package/docs/api/interfaces/ColorShade.md +1 -1
  58. package/docs/api/interfaces/DataAccessRecord.md +1 -1
  59. package/docs/api/interfaces/DataTableAction.md +1 -1
  60. package/docs/api/interfaces/DataTableColumn.md +1 -1
  61. package/docs/api/interfaces/DataTableProps.md +44 -18
  62. package/docs/api/interfaces/DataTableToolbarButton.md +1 -1
  63. package/docs/api/interfaces/EmptyStateConfig.md +1 -1
  64. package/docs/api/interfaces/EnhancedNavigationMenuProps.md +1 -1
  65. package/docs/api/interfaces/EventContextType.md +1 -1
  66. package/docs/api/interfaces/EventLogoProps.md +1 -1
  67. package/docs/api/interfaces/EventProviderProps.md +1 -1
  68. package/docs/api/interfaces/FileSizeLimits.md +1 -1
  69. package/docs/api/interfaces/FileUploadProps.md +1 -1
  70. package/docs/api/interfaces/FooterProps.md +1 -1
  71. package/docs/api/interfaces/InactivityWarningModalProps.md +1 -1
  72. package/docs/api/interfaces/InputProps.md +1 -1
  73. package/docs/api/interfaces/LabelProps.md +1 -1
  74. package/docs/api/interfaces/LoginFormProps.md +1 -1
  75. package/docs/api/interfaces/NavigationAccessRecord.md +1 -1
  76. package/docs/api/interfaces/NavigationContextType.md +1 -1
  77. package/docs/api/interfaces/NavigationGuardProps.md +1 -1
  78. package/docs/api/interfaces/NavigationItem.md +1 -1
  79. package/docs/api/interfaces/NavigationMenuProps.md +1 -1
  80. package/docs/api/interfaces/NavigationProviderProps.md +1 -1
  81. package/docs/api/interfaces/Organisation.md +1 -1
  82. package/docs/api/interfaces/OrganisationContextType.md +1 -1
  83. package/docs/api/interfaces/OrganisationMembership.md +1 -1
  84. package/docs/api/interfaces/OrganisationProviderProps.md +1 -1
  85. package/docs/api/interfaces/OrganisationSecurityError.md +1 -1
  86. package/docs/api/interfaces/PaceAppLayoutProps.md +1 -1
  87. package/docs/api/interfaces/PaceLoginPageProps.md +1 -1
  88. package/docs/api/interfaces/PageAccessRecord.md +1 -1
  89. package/docs/api/interfaces/PagePermissionContextType.md +1 -1
  90. package/docs/api/interfaces/PagePermissionGuardProps.md +1 -1
  91. package/docs/api/interfaces/PagePermissionProviderProps.md +1 -1
  92. package/docs/api/interfaces/PaletteData.md +1 -1
  93. package/docs/api/interfaces/PermissionEnforcerProps.md +1 -1
  94. package/docs/api/interfaces/PublicErrorBoundaryProps.md +1 -1
  95. package/docs/api/interfaces/PublicErrorBoundaryState.md +1 -1
  96. package/docs/api/interfaces/PublicLoadingSpinnerProps.md +1 -1
  97. package/docs/api/interfaces/PublicPageFooterProps.md +1 -1
  98. package/docs/api/interfaces/PublicPageHeaderProps.md +1 -1
  99. package/docs/api/interfaces/PublicPageLayoutProps.md +1 -1
  100. package/docs/api/interfaces/RBACConfig.md +1 -1
  101. package/docs/api/interfaces/RBACContextType.md +1 -1
  102. package/docs/api/interfaces/RBACLogger.md +1 -1
  103. package/docs/api/interfaces/RBACProviderProps.md +1 -1
  104. package/docs/api/interfaces/RoleBasedRouterContextType.md +1 -1
  105. package/docs/api/interfaces/RoleBasedRouterProps.md +1 -1
  106. package/docs/api/interfaces/RouteAccessRecord.md +1 -1
  107. package/docs/api/interfaces/RouteConfig.md +1 -1
  108. package/docs/api/interfaces/SecureDataContextType.md +1 -1
  109. package/docs/api/interfaces/SecureDataProviderProps.md +1 -1
  110. package/docs/api/interfaces/StorageConfig.md +1 -1
  111. package/docs/api/interfaces/StorageFileInfo.md +1 -1
  112. package/docs/api/interfaces/StorageFileMetadata.md +1 -1
  113. package/docs/api/interfaces/StorageListOptions.md +1 -1
  114. package/docs/api/interfaces/StorageListResult.md +1 -1
  115. package/docs/api/interfaces/StorageUploadOptions.md +1 -1
  116. package/docs/api/interfaces/StorageUploadResult.md +1 -1
  117. package/docs/api/interfaces/StorageUrlOptions.md +1 -1
  118. package/docs/api/interfaces/StyleImport.md +1 -1
  119. package/docs/api/interfaces/ToastActionElement.md +1 -1
  120. package/docs/api/interfaces/ToastProps.md +1 -1
  121. package/docs/api/interfaces/UnifiedAuthContextType.md +1 -1
  122. package/docs/api/interfaces/UnifiedAuthProviderProps.md +1 -1
  123. package/docs/api/interfaces/UseInactivityTrackerOptions.md +1 -1
  124. package/docs/api/interfaces/UseInactivityTrackerReturn.md +1 -1
  125. package/docs/api/interfaces/UsePublicEventLogoOptions.md +1 -1
  126. package/docs/api/interfaces/UsePublicEventLogoReturn.md +1 -1
  127. package/docs/api/interfaces/UsePublicEventOptions.md +1 -1
  128. package/docs/api/interfaces/UsePublicEventReturn.md +1 -1
  129. package/docs/api/interfaces/UsePublicRouteParamsReturn.md +1 -1
  130. package/docs/api/interfaces/UserEventAccess.md +1 -1
  131. package/docs/api/interfaces/UserMenuProps.md +1 -1
  132. package/docs/api/interfaces/UserProfile.md +1 -1
  133. package/docs/api/modules.md +38 -53
  134. package/docs/architecture/README.md +1 -3
  135. package/docs/consuming-app-example.md +3 -3
  136. package/docs/consuming-app-vite-config.md +1 -1
  137. package/docs/documentation-style-checklist.md +2 -2
  138. package/docs/getting-started/examples/basic-auth-app.md +2 -2
  139. package/docs/getting-started/installation.md +2 -2
  140. package/docs/getting-started/quick-start.md +1 -1
  141. package/docs/implementation-guides/data-tables.md +67 -0
  142. package/docs/migration/README.md +6 -6
  143. package/docs/migration/quick-migration-guide.md +3 -3
  144. package/docs/migration/v0.4.15-tailwind-scanning.md +1 -1
  145. package/docs/migration/v0.4.16-css-first-approach.md +1 -1
  146. package/docs/migration/v0.4.17-source-path-fix.md +4 -4
  147. package/docs/migration-guide.md +2 -2
  148. package/docs/quick-reference.md +4 -4
  149. package/docs/styles/README.md +3 -3
  150. package/docs/troubleshooting/README.md +2 -2
  151. package/docs/troubleshooting/common-issues.md +1 -1
  152. package/docs/troubleshooting/styling-issues.md +2 -2
  153. package/docs/troubleshooting/tailwind-content-scanning.md +2 -2
  154. package/docs/usage.md +2 -2
  155. package/package.json +2 -6
  156. package/src/components/DataTable/DataTable.tsx +13 -0
  157. package/src/components/DataTable/__tests__/DataTable.default-state.test.tsx +414 -0
  158. package/src/components/DataTable/components/DataTableCore.tsx +19 -2
  159. package/src/components/DataTable/types.ts +9 -0
  160. package/src/components/Dialog/examples/__tests__/SmartDialogExample.unit.test.tsx +151 -0
  161. package/src/components/Dialog/utils/__tests__/safeHtml.unit.test.ts +611 -0
  162. package/src/components/PaceAppLayout/__tests__/PaceAppLayout.accessibility.test.tsx +287 -0
  163. package/src/components/PaceAppLayout/__tests__/PaceAppLayout.integration.test.tsx +861 -0
  164. package/src/components/PaceAppLayout/__tests__/PaceAppLayout.performance.test.tsx +628 -0
  165. package/src/components/PaceAppLayout/__tests__/PaceAppLayout.security.test.tsx +777 -0
  166. package/src/components/PaceAppLayout/__tests__/PaceAppLayout.unit.test.tsx +901 -0
  167. package/src/components/Toast/Toast.test.tsx +51 -21
  168. package/src/components/Toast/Toast.tsx +13 -35
  169. package/src/components/Toast/index.ts +2 -1
  170. package/src/components/index.ts +15 -1
  171. package/src/hooks/useFileReference.ts +37 -0
  172. package/src/index.ts +1 -1
  173. package/src/rbac/__tests__/rbac-engine-core-logic.test.ts +1 -1
  174. package/src/rbac/__tests__/rbac-engine-simplified.test.ts +1 -1
  175. package/src/styles/core.css +32 -37
  176. package/src/styles/index.ts +1 -1
  177. package/dist/chunk-ITPVFKDH.js.map +0 -1
  178. package/dist/chunk-NQ4TOOO6.js.map +0 -1
  179. package/dist/chunk-SFMRBGGK.js.map +0 -1
  180. package/dist/chunk-XDXG6QVH.js.map +0 -1
  181. package/dist/styles/core.css +0 -242
  182. package/dist/styles/fonts/georama-italic.woff2 +0 -0
  183. package/dist/styles/fonts/georama.woff2 +0 -0
  184. package/dist/styles/fonts/open-sans-italic.woff2 +0 -0
  185. package/dist/styles/fonts/open-sans.woff2 +0 -0
  186. package/dist/styles/fonts/reddit-mono.woff2 +0 -0
  187. /package/dist/{DataTable-5M6MV2VY.js.map → DataTable-7BER7PDS.js.map} +0 -0
  188. /package/dist/{chunk-XMTHMOOM.js.map → chunk-BTCA3ENN.js.map} +0 -0
  189. /package/dist/{chunk-ESXTFEE6.js.map → chunk-C7GUF747.js.map} +0 -0
  190. /package/dist/{chunk-W7PPXKTZ.js.map → chunk-CKNY7HYS.js.map} +0 -0
  191. /package/dist/{chunk-5MLDIGHB.js.map → chunk-FVDOEGGG.js.map} +0 -0
  192. /package/dist/{chunk-NMNDTCOR.js.map → chunk-QVEOQVD4.js.map} +0 -0
  193. /package/dist/{chunk-E4FPK232.js.map → chunk-T2MQY57J.js.map} +0 -0
  194. /package/dist/{chunk-STT7INZR.js.map → chunk-ULBI5JGB.js.map} +0 -0
  195. /package/dist/{chunk-CGSYCF2W.js.map → chunk-VTJ5HCZB.js.map} +0 -0
@@ -0,0 +1,151 @@
1
+ /**
2
+ * @file SmartDialogExample Unit Tests
3
+ * @package @jmruthers/pace-core
4
+ * @module Components/Dialog/Examples/Tests
5
+ * @since 0.1.0
6
+ */
7
+
8
+ import React from 'react';
9
+ import { screen, waitFor } from '@testing-library/react';
10
+ import userEvent from '@testing-library/user-event';
11
+ import { describe, it, expect, beforeEach, vi } from 'vitest';
12
+ import '@testing-library/jest-dom';
13
+ import { renderWithProviders } from '../../../../__tests__/shared';
14
+ import { SmartDialogExample } from '../SmartDialogExample';
15
+
16
+ // Note: We test the actual component without mocking to ensure real behavior works
17
+ // This means we test what's visible by default (triggers, main content) rather than dialog internals
18
+
19
+ describe('SmartDialogExample Component', () => {
20
+ const user = userEvent.setup();
21
+
22
+ beforeEach(() => {
23
+ vi.clearAllMocks();
24
+ });
25
+
26
+ describe('Rendering', () => {
27
+ it('renders without crashing', () => {
28
+ renderWithProviders(<SmartDialogExample />);
29
+ expect(screen.getByText('Enhanced Dialog Examples')).toBeInTheDocument();
30
+ });
31
+
32
+ it('renders the main heading and description', () => {
33
+ renderWithProviders(<SmartDialogExample />);
34
+ expect(screen.getByText('Enhanced Dialog Examples')).toBeInTheDocument();
35
+ expect(screen.getByText(/Demonstrating all the advanced features of the Dialog component including smart height management/)).toBeInTheDocument();
36
+ });
37
+
38
+ it('renders all dialog trigger buttons', () => {
39
+ renderWithProviders(<SmartDialogExample />);
40
+
41
+ expect(screen.getByText('Basic Dialog')).toBeInTheDocument();
42
+ expect(screen.getByText('Scrollable Dialog')).toBeInTheDocument();
43
+ expect(screen.getByText('Custom Height')).toBeInTheDocument();
44
+ expect(screen.getByText('Full Screen')).toBeInTheDocument();
45
+ });
46
+
47
+ it('renders the key features summary', () => {
48
+ renderWithProviders(<SmartDialogExample />);
49
+
50
+ expect(screen.getByText('Key Features Demonstrated:')).toBeInTheDocument();
51
+ expect(screen.getByText(/Smart Height Management/)).toBeInTheDocument();
52
+ expect(screen.getByText(/Scrollable Content/)).toBeInTheDocument();
53
+ expect(screen.getByText(/Sticky Headers\/Footers/)).toBeInTheDocument();
54
+ });
55
+ });
56
+
57
+ describe('Component Structure', () => {
58
+ it('renders all trigger buttons with correct labels', () => {
59
+ renderWithProviders(<SmartDialogExample />);
60
+
61
+ // Check all dialog trigger buttons are present
62
+ expect(screen.getByRole('button', { name: 'Basic Dialog' })).toBeInTheDocument();
63
+ expect(screen.getByRole('button', { name: 'Scrollable Dialog' })).toBeInTheDocument();
64
+ expect(screen.getByRole('button', { name: 'Custom Height' })).toBeInTheDocument();
65
+ expect(screen.getByRole('button', { name: 'Full Screen' })).toBeInTheDocument();
66
+ });
67
+
68
+ it('renders dialog triggers with proper ARIA attributes', () => {
69
+ renderWithProviders(<SmartDialogExample />);
70
+
71
+ const buttons = screen.getAllByRole('button');
72
+
73
+ // Each trigger button should have dialog-related ARIA attributes
74
+ buttons.forEach(button => {
75
+ expect(button).toHaveAttribute('aria-haspopup', 'dialog');
76
+ expect(button).toHaveAttribute('data-state', 'closed');
77
+ });
78
+ });
79
+ });
80
+
81
+ describe('Interactive Elements', () => {
82
+ it('renders trigger buttons that are clickable', () => {
83
+ renderWithProviders(<SmartDialogExample />);
84
+
85
+ // Test that all trigger buttons are interactive
86
+ const buttons = screen.getAllByRole('button');
87
+ expect(buttons.length).toBe(7); // Seven dialog triggers
88
+
89
+ buttons.forEach(button => {
90
+ expect(button).toBeEnabled();
91
+ expect(button).toHaveAttribute('type', 'button');
92
+ });
93
+ });
94
+
95
+ it('handles button interactions without errors', async () => {
96
+ renderWithProviders(<SmartDialogExample />);
97
+
98
+ const basicDialogButton = screen.getByRole('button', { name: 'Basic Dialog' });
99
+
100
+ // Should not throw errors when clicked
101
+ await user.click(basicDialogButton);
102
+ expect(basicDialogButton).toBeInTheDocument();
103
+ });
104
+ });
105
+
106
+ describe('Accessibility', () => {
107
+ it('has proper heading structure', () => {
108
+ renderWithProviders(<SmartDialogExample />);
109
+
110
+ // Main heading should be present and properly structured
111
+ expect(screen.getByRole('heading', { level: 2, name: 'Enhanced Dialog Examples' })).toBeInTheDocument();
112
+ expect(screen.getByRole('heading', { level: 3, name: 'Key Features Demonstrated:' })).toBeInTheDocument();
113
+ });
114
+
115
+ it('provides semantic button labeling', () => {
116
+ renderWithProviders(<SmartDialogExample />);
117
+
118
+ // All buttons should have accessible names
119
+ const buttons = screen.getAllByRole('button');
120
+ buttons.forEach(button => {
121
+ expect(button.textContent?.length).toBeGreaterThan(3);
122
+ });
123
+ });
124
+
125
+ it('follows proper ARIA patterns for dialog triggers', () => {
126
+ renderWithProviders(<SmartDialogExample />);
127
+
128
+ const buttons = screen.getAllByRole('button');
129
+
130
+ // Each trigger should have proper ARIA attributes for dialogs
131
+ buttons.forEach(button => {
132
+ expect(button).toHaveAttribute('aria-haspopup', 'dialog');
133
+ expect(button).toHaveAttribute('aria-expanded', 'false');
134
+ expect(button).toHaveAttribute('aria-controls');
135
+ });
136
+ });
137
+ });
138
+
139
+ describe('Error Handling', () => {
140
+ it('handles missing content gracefully', () => {
141
+ // This test ensures the component doesn't crash with edge cases
142
+ expect(() => renderWithProviders(<SmartDialogExample />)).not.toThrow();
143
+ });
144
+
145
+ it('renders even if some props are undefined', () => {
146
+ // The component should be resilient to missing optional props
147
+ renderWithProviders(<SmartDialogExample />);
148
+ expect(screen.getByText('Enhanced Dialog Examples')).toBeInTheDocument();
149
+ });
150
+ });
151
+ });