@jmruthers/pace-core 0.5.193 → 0.6.1

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 (191) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +7 -1
  3. package/cursor-rules/00-pace-core-compliance.mdc +372 -0
  4. package/cursor-rules/01-standards-compliance.mdc +275 -0
  5. package/cursor-rules/02-project-structure.mdc +200 -0
  6. package/cursor-rules/03-solid-principles.mdc +341 -0
  7. package/cursor-rules/04-testing-standards.mdc +315 -0
  8. package/cursor-rules/05-bug-reports-and-features.mdc +246 -0
  9. package/cursor-rules/06-code-quality.mdc +392 -0
  10. package/cursor-rules/07-tech-stack-compliance.mdc +309 -0
  11. package/cursor-rules/CHANGELOG.md +101 -0
  12. package/cursor-rules/README.md +191 -0
  13. package/dist/{DataTable-Be6dH_dR.d.ts → DataTable-CH1U5Tpy.d.ts} +1 -1
  14. package/dist/{DataTable-5FU7IESH.js → DataTable-DQ7RSOHE.js} +6 -6
  15. package/dist/{PublicPageProvider-C0Sm_e5k.d.ts → PublicPageProvider-ce4xlHYA.d.ts} +34 -155
  16. package/dist/{UnifiedAuthProvider-RGJTDE2C.js → UnifiedAuthProvider-ATAP5UTR.js} +2 -2
  17. package/dist/{chunk-6C4YBBJM 5.js → chunk-3QRJFVBR.js} +1 -1
  18. package/dist/chunk-3QRJFVBR.js.map +1 -0
  19. package/dist/{chunk-IIELH4DL.js → chunk-3XTALGJF.js} +2 -2
  20. package/dist/{chunk-IIELH4DL.js.map → chunk-3XTALGJF.js.map} +1 -1
  21. package/dist/{chunk-HWIIPPNI.js → chunk-4N5C5XZU.js} +20 -20
  22. package/dist/chunk-4N5C5XZU.js.map +1 -0
  23. package/dist/{chunk-7EQTDTTJ.js → chunk-4ZC4GX36.js} +5 -5
  24. package/dist/{chunk-7EQTDTTJ.js 2.map → chunk-4ZC4GX36.js.map} +1 -1
  25. package/dist/{chunk-7FLMSG37.js → chunk-BYFSK72L.js} +22 -22
  26. package/dist/chunk-BYFSK72L.js.map +1 -0
  27. package/dist/{chunk-LFNCN2SP.js → chunk-EXUD6RNJ.js} +46 -7
  28. package/dist/chunk-EXUD6RNJ.js.map +1 -0
  29. package/dist/{chunk-NOAYCWCX 5.js → chunk-GLK6VM3F.js} +167 -169
  30. package/dist/chunk-GLK6VM3F.js.map +1 -0
  31. package/dist/{chunk-HW3OVDUF.js → chunk-J36DSWQK.js} +1 -1
  32. package/dist/{chunk-HW3OVDUF.js.map → chunk-J36DSWQK.js.map} +1 -1
  33. package/dist/{chunk-BC4IJKSL.js → chunk-JBKQ3SAO.js} +2 -2
  34. package/dist/{chunk-QWWZ5CAQ.js → chunk-LXQLPRQ2.js} +2 -2
  35. package/dist/{chunk-E3SPN4VZ 5.js → chunk-T33XF5ZC.js} +119 -114
  36. package/dist/chunk-T33XF5ZC.js.map +1 -0
  37. package/dist/{chunk-XNXXZ43G.js → chunk-XM25TVIE.js} +27 -4
  38. package/dist/chunk-XM25TVIE.js.map +1 -0
  39. package/dist/components.d.ts +3 -3
  40. package/dist/components.js +8 -8
  41. package/dist/hooks.d.ts +6 -6
  42. package/dist/hooks.js +17 -22
  43. package/dist/hooks.js.map +1 -1
  44. package/dist/index.d.ts +7 -7
  45. package/dist/index.js +15 -16
  46. package/dist/index.js.map +1 -1
  47. package/dist/providers.js +1 -1
  48. package/dist/rbac/index.d.ts +1 -1
  49. package/dist/rbac/index.js +5 -5
  50. package/dist/{usePublicRouteParams-TZe0gy-4.d.ts → usePublicRouteParams-BJAlWfuJ.d.ts} +3 -3
  51. package/dist/{useToast-C8gR5ir4.d.ts → useToast-AyaT-x7p.d.ts} +2 -2
  52. package/dist/utils.d.ts +1 -1
  53. package/dist/utils.js +3 -3
  54. package/docs/getting-started/cursor-rules.md +262 -0
  55. package/docs/getting-started/installation-guide.md +6 -1
  56. package/docs/getting-started/quick-start.md +6 -1
  57. package/docs/migration/MIGRATION_GUIDE.md +4 -4
  58. package/docs/migration/REACT_19_MIGRATION.md +227 -0
  59. package/docs/standards/README.md +39 -0
  60. package/docs/troubleshooting/migration.md +4 -4
  61. package/examples/PublicPages/PublicEventPage.tsx +1 -1
  62. package/package.json +11 -6
  63. package/scripts/audit-consuming-app.cjs +961 -0
  64. package/scripts/check-pace-core-compliance.cjs +34 -15
  65. package/scripts/install-cursor-rules.cjs +236 -0
  66. package/src/__tests__/helpers/test-providers.tsx +1 -1
  67. package/src/__tests__/helpers/test-utils.tsx +1 -1
  68. package/src/components/Badge/Badge.tsx +2 -4
  69. package/src/components/Button/Button.tsx +5 -4
  70. package/src/components/Calendar/Calendar.tsx +1 -1
  71. package/src/components/DataTable/DataTable.test.tsx +57 -93
  72. package/src/components/DataTable/DataTable.tsx +2 -2
  73. package/src/components/DataTable/__tests__/pagination.modes.test.tsx +13 -5
  74. package/src/components/DataTable/__tests__/ssr.strict-mode.test.tsx +12 -12
  75. package/src/components/DataTable/components/AccessDeniedPage.tsx +1 -1
  76. package/src/components/DataTable/components/BulkOperationsDropdown.tsx +1 -1
  77. package/src/components/DataTable/components/DataTableCore.tsx +4 -7
  78. package/src/components/DataTable/components/DataTableModals.tsx +1 -1
  79. package/src/components/DataTable/components/EditableRow.tsx +1 -1
  80. package/src/components/DataTable/components/UnifiedTableBody.tsx +6 -8
  81. package/src/components/DataTable/components/__tests__/DataTableModals.test.tsx +23 -23
  82. package/src/components/DataTable/components/__tests__/EditableRow.test.tsx +11 -11
  83. package/src/components/DataTable/components/__tests__/ExpandButton.test.tsx +36 -36
  84. package/src/components/DataTable/components/__tests__/GroupHeader.test.tsx +27 -27
  85. package/src/components/DataTable/components/__tests__/ImportModal.test.tsx +39 -39
  86. package/src/components/DataTable/components/__tests__/UnifiedTableBody.test.tsx +33 -33
  87. package/src/components/DataTable/components/__tests__/ViewRowModal.test.tsx +29 -29
  88. package/src/components/DataTable/hooks/useColumnReordering.ts +2 -2
  89. package/src/components/DataTable/hooks/useKeyboardNavigation.ts +2 -2
  90. package/src/components/DatePickerWithTimezone/DatePickerWithTimezone.test.tsx +8 -14
  91. package/src/components/Dialog/Dialog.tsx +6 -5
  92. package/src/components/ErrorBoundary/ErrorBoundary.tsx +1 -1
  93. package/src/components/EventSelector/EventSelector.tsx +1 -1
  94. package/src/components/FileDisplay/FileDisplay.test.tsx +2 -2
  95. package/src/components/Footer/Footer.tsx +1 -1
  96. package/src/components/Form/Form.test.tsx +36 -15
  97. package/src/components/Form/Form.tsx +30 -26
  98. package/src/components/Header/Header.tsx +1 -1
  99. package/src/components/InactivityWarningModal/InactivityWarningModal.test.tsx +40 -40
  100. package/src/components/InactivityWarningModal/InactivityWarningModal.tsx +1 -1
  101. package/src/components/Input/Input.tsx +28 -30
  102. package/src/components/Label/Label.tsx +1 -1
  103. package/src/components/LoadingSpinner/LoadingSpinner.tsx +1 -1
  104. package/src/components/LoginForm/LoginForm.test.tsx +42 -42
  105. package/src/components/LoginForm/LoginForm.tsx +8 -8
  106. package/src/components/NavigationMenu/NavigationMenu.tsx +1 -1
  107. package/src/components/PaceAppLayout/PaceAppLayout.performance.test.tsx +1 -1
  108. package/src/components/PaceAppLayout/PaceAppLayout.test.tsx +50 -50
  109. package/src/components/PaceAppLayout/PaceAppLayout.tsx +1 -1
  110. package/src/components/PaceAppLayout/README.md +1 -1
  111. package/src/components/PaceLoginPage/PaceLoginPage.tsx +1 -1
  112. package/src/components/PasswordChange/PasswordChangeForm.test.tsx +33 -33
  113. package/src/components/PasswordChange/PasswordChangeForm.tsx +1 -1
  114. package/src/components/Progress/Progress.tsx +1 -1
  115. package/src/components/PublicLayout/PublicPageLayout.tsx +1 -1
  116. package/src/components/Select/Select.tsx +33 -22
  117. package/src/components/SessionRestorationLoader/SessionRestorationLoader.tsx +1 -1
  118. package/src/components/Table/Table.tsx +1 -1
  119. package/src/components/Textarea/Textarea.tsx +27 -29
  120. package/src/components/Toast/Toast.tsx +1 -1
  121. package/src/components/Tooltip/Tooltip.tsx +1 -1
  122. package/src/components/UserMenu/UserMenu.tsx +1 -1
  123. package/src/hooks/__tests__/hooks.integration.test.tsx +80 -55
  124. package/src/hooks/__tests__/useStorage.unit.test.ts +36 -36
  125. package/src/hooks/public/usePublicEvent.ts +1 -1
  126. package/src/hooks/public/usePublicEventLogo.ts +1 -1
  127. package/src/hooks/public/usePublicRouteParams.ts +1 -1
  128. package/src/hooks/useDataTableState.ts +8 -18
  129. package/src/hooks/useFocusManagement.ts +2 -2
  130. package/src/hooks/useFocusTrap.ts +4 -4
  131. package/src/hooks/useFormDialog.ts +8 -7
  132. package/src/hooks/useInactivityTracker.ts +1 -1
  133. package/src/hooks/usePermissionCache.ts +1 -1
  134. package/src/hooks/useSecureDataAccess.ts +19 -4
  135. package/src/hooks/useToast.ts +2 -2
  136. package/src/providers/__tests__/OrganisationProvider.test.tsx +57 -13
  137. package/src/providers/__tests__/ProviderLifecycle.test.tsx +21 -6
  138. package/src/providers/__tests__/UnifiedAuthProvider.test.tsx +10 -10
  139. package/src/providers/services/UnifiedAuthProvider.tsx +22 -22
  140. package/src/providers/services/__tests__/AuthServiceProvider.integration.test.tsx +13 -3
  141. package/src/rbac/__tests__/adapters.comprehensive.test.tsx +24 -24
  142. package/src/rbac/components/EnhancedNavigationMenu.tsx +1 -1
  143. package/src/rbac/components/NavigationGuard.tsx +1 -1
  144. package/src/rbac/components/NavigationProvider.tsx +1 -1
  145. package/src/rbac/components/PagePermissionGuard.tsx +1 -1
  146. package/src/rbac/components/PagePermissionProvider.tsx +1 -1
  147. package/src/rbac/components/PermissionEnforcer.tsx +1 -1
  148. package/src/rbac/components/RoleBasedRouter.tsx +1 -1
  149. package/src/rbac/components/SecureDataProvider.tsx +1 -1
  150. package/src/rbac/secureClient.ts +12 -0
  151. package/src/utils/security/secureDataAccess.test.ts +31 -20
  152. package/src/utils/security/secureDataAccess.ts +4 -3
  153. package/dist/chunk-6C4YBBJM.js +0 -628
  154. package/dist/chunk-6C4YBBJM.js.map +0 -1
  155. package/dist/chunk-7D4SUZUM.js 2.map +0 -1
  156. package/dist/chunk-7EQTDTTJ.js.map +0 -1
  157. package/dist/chunk-7FLMSG37.js 2.map +0 -1
  158. package/dist/chunk-7FLMSG37.js.map +0 -1
  159. package/dist/chunk-E3SPN4VZ.js +0 -12917
  160. package/dist/chunk-E3SPN4VZ.js.map +0 -1
  161. package/dist/chunk-E66EQZE6 5.js +0 -37
  162. package/dist/chunk-E66EQZE6.js 2.map +0 -1
  163. package/dist/chunk-HWIIPPNI.js.map +0 -1
  164. package/dist/chunk-I7PSE6JW 5.js +0 -191
  165. package/dist/chunk-I7PSE6JW.js 2.map +0 -1
  166. package/dist/chunk-KNC55RTG.js 5.map +0 -1
  167. package/dist/chunk-KQCRWDSA.js 5.map +0 -1
  168. package/dist/chunk-LFNCN2SP.js 2.map +0 -1
  169. package/dist/chunk-LFNCN2SP.js.map +0 -1
  170. package/dist/chunk-LMC26NLJ 2.js +0 -84
  171. package/dist/chunk-NOAYCWCX.js +0 -4993
  172. package/dist/chunk-NOAYCWCX.js.map +0 -1
  173. package/dist/chunk-QWWZ5CAQ.js.map +0 -1
  174. package/dist/chunk-QXHPKYJV 3.js +0 -113
  175. package/dist/chunk-R77UEZ4E 3.js +0 -68
  176. package/dist/chunk-VBXEHIUJ.js 6.map +0 -1
  177. package/dist/chunk-XNXXZ43G.js.map +0 -1
  178. package/dist/chunk-ZSAAAMVR 6.js +0 -25
  179. package/dist/components.js 5.map +0 -1
  180. package/dist/styles/index 2.js +0 -12
  181. package/dist/styles/index.js 5.map +0 -1
  182. package/dist/theming/runtime 5.js +0 -19
  183. package/dist/theming/runtime.js 5.map +0 -1
  184. /package/dist/{DataTable-5FU7IESH.js.map → DataTable-DQ7RSOHE.js.map} +0 -0
  185. /package/dist/{UnifiedAuthProvider-RGJTDE2C.js.map → UnifiedAuthProvider-ATAP5UTR.js.map} +0 -0
  186. /package/dist/{chunk-BC4IJKSL.js.map → chunk-JBKQ3SAO.js.map} +0 -0
  187. /package/dist/{chunk-QWWZ5CAQ.js 3.map → chunk-LXQLPRQ2.js.map} +0 -0
  188. /package/examples/{rbac → RBAC}/CompleteRBACExample.tsx +0 -0
  189. /package/examples/{rbac → RBAC}/EventBasedApp.tsx +0 -0
  190. /package/examples/{rbac → RBAC}/PermissionExample.tsx +0 -0
  191. /package/examples/{rbac → RBAC}/index.ts +0 -0
@@ -1,6 +1,7 @@
1
1
  import React, { useState, useEffect } from 'react';
2
2
  import { screen, fireEvent, waitFor, act } from '@testing-library/react';
3
3
  import { renderHook } from '@testing-library/react';
4
+ import userEvent from '@testing-library/user-event';
4
5
  import '@testing-library/jest-dom';
5
6
  import { vi, describe, it, beforeEach, afterEach } from 'vitest';
6
7
  import { renderWithProviders } from '../../__tests__/helpers/test-utils';
@@ -16,7 +17,7 @@ import { Button } from '../../components/Button/Button';
16
17
  import { Input } from '../../components/Input/Input';
17
18
  import { Form } from '../../components/Form/Form';
18
19
  import { z } from 'zod';
19
- import { useForm } from 'react-hook-form';
20
+ import { useForm, useFormState } from 'react-hook-form';
20
21
 
21
22
  // Mock the Logger module
22
23
  vi.mock('../../utils/core/logger', () => {
@@ -137,47 +138,57 @@ const ValidatedForm = ({ onSubmit }: ValidatedFormProps = {}) => {
137
138
  onSubmit={handleSubmit}
138
139
  >
139
140
  {(methods) => (
140
- <>
141
- <div>
142
- <Input
143
- {...methods.register('name')}
144
- data-testid="name-input"
145
- placeholder="Name"
146
- />
147
- {methods.formState.errors.name && (
148
- <div data-testid="name-error">{methods.formState.errors.name.message}</div>
149
- )}
150
- </div>
151
- <div>
152
- <Input
153
- {...methods.register('email')}
154
- data-testid="email-input"
155
- placeholder="Email"
156
- />
157
- {methods.formState.errors.email && (
158
- <div data-testid="email-error">{methods.formState.errors.email.message}</div>
159
- )}
160
- </div>
161
- <div>
162
- <Input
163
- {...methods.register('age', { valueAsNumber: true })}
164
- data-testid="age-input"
165
- type="number"
166
- placeholder="Age"
167
- />
168
- {methods.formState.errors.age && (
169
- <div data-testid="age-error">{methods.formState.errors.age.message}</div>
170
- )}
171
- </div>
172
- <Button type="submit" data-testid="submit-button">
173
- Submit
174
- </Button>
175
- </>
141
+ <ValidatedFormFields methods={methods} />
176
142
  )}
177
143
  </Form>
178
144
  );
179
145
  };
180
146
 
147
+ // Separate component to use useFormState hook for reactive error updates
148
+ const ValidatedFormFields = ({ methods }: { methods: ReturnType<typeof useForm> }) => {
149
+ // Use useFormState to subscribe to form state changes, including errors
150
+ const { errors } = useFormState({ control: methods.control });
151
+
152
+ return (
153
+ <>
154
+ <div>
155
+ <Input
156
+ {...methods.register('name')}
157
+ data-testid="name-input"
158
+ placeholder="Name"
159
+ />
160
+ {errors.name && (
161
+ <div data-testid="name-error">{errors.name.message}</div>
162
+ )}
163
+ </div>
164
+ <div>
165
+ <Input
166
+ {...methods.register('email')}
167
+ data-testid="email-input"
168
+ placeholder="Email"
169
+ />
170
+ {errors.email && (
171
+ <div data-testid="email-error">{errors.email.message}</div>
172
+ )}
173
+ </div>
174
+ <div>
175
+ <Input
176
+ {...methods.register('age', { valueAsNumber: true })}
177
+ data-testid="age-input"
178
+ type="number"
179
+ placeholder="Age"
180
+ />
181
+ {errors.age && (
182
+ <div data-testid="age-error">{errors.age.message}</div>
183
+ )}
184
+ </div>
185
+ <Button type="submit" data-testid="submit-button">
186
+ Submit
187
+ </Button>
188
+ </>
189
+ );
190
+ };
191
+
181
192
  // Test component for useKeyboardShortcuts integration
182
193
  const KeyboardShortcutsComponent = () => {
183
194
  const [isModalOpen, setIsModalOpen] = useState(false);
@@ -312,14 +323,13 @@ describe('Hooks Integration', () => {
312
323
  });
313
324
 
314
325
  it('handles rapid input changes correctly', async () => {
326
+ const user = userEvent.setup();
315
327
  renderWithProviders(<DebouncedSearch />);
316
328
 
317
329
  const searchInput = screen.getByTestId('search-input');
318
330
 
319
- // Type rapidly
320
- fireEvent.change(searchInput, { target: { value: 'a' } });
321
- fireEvent.change(searchInput, { target: { value: 'ab' } });
322
- fireEvent.change(searchInput, { target: { value: 'abc' } });
331
+ // Type rapidly using userEvent
332
+ await user.type(searchInput, 'abc');
323
333
 
324
334
  // Should not show results immediately
325
335
  expect(screen.queryByTestId('result-0')).not.toBeInTheDocument();
@@ -329,7 +339,10 @@ describe('Hooks Integration', () => {
329
339
  expect(screen.getByTestId('debounced-term')).toHaveTextContent('Debounced: abc');
330
340
  }, { timeout: 400 });
331
341
 
332
- expect(screen.getByTestId('result-0')).toHaveTextContent('Result for: abc');
342
+ // Wait for results to appear after debounced term updates
343
+ await waitFor(() => {
344
+ expect(screen.getByTestId('result-0')).toHaveTextContent('Result for: abc');
345
+ }, { timeout: 500 });
333
346
  });
334
347
  });
335
348
 
@@ -362,6 +375,7 @@ describe('Hooks Integration', () => {
362
375
 
363
376
  describe('useZodForm Integration', () => {
364
377
  it('validates form with real-time feedback', async () => {
378
+ const user = userEvent.setup();
365
379
  renderWithProviders(<ValidatedForm />);
366
380
 
367
381
  const nameInput = screen.getByTestId('name-input');
@@ -369,21 +383,32 @@ describe('Hooks Integration', () => {
369
383
  const ageInput = screen.getByTestId('age-input');
370
384
  const submitButton = screen.getByTestId('submit-button');
371
385
 
372
- // Test validation errors
373
- await act(async () => {
374
- fireEvent.change(nameInput, { target: { value: 'a' } });
375
- fireEvent.change(emailInput, { target: { value: 'invalid-email' } });
376
- fireEvent.change(ageInput, { target: { value: '15' } });
377
- });
378
- await act(async () => {
379
- fireEvent.click(submitButton);
380
- });
386
+ // Test validation errors - use userEvent for proper async handling
387
+ await user.clear(nameInput);
388
+ await user.type(nameInput, 'a');
389
+ await user.clear(emailInput);
390
+ await user.type(emailInput, 'invalid-email');
391
+ await user.clear(ageInput);
392
+ await user.type(ageInput, '15');
393
+
394
+ // Submit the form to trigger validation
395
+ await user.click(submitButton);
381
396
 
397
+ // Wait for validation errors to appear after form submission
398
+ // The render prop function needs to re-render when formState.errors changes
399
+ // Wait for all errors to appear together
382
400
  await waitFor(() => {
383
- expect(screen.getByTestId('name-error')).toHaveTextContent('Name must be at least 2 characters');
384
- expect(screen.getByTestId('email-error')).toHaveTextContent('Invalid email address');
385
- expect(screen.getByTestId('age-error')).toHaveTextContent('Must be at least 18 years old');
386
- });
401
+ const nameError = screen.queryByTestId('name-error');
402
+ const emailError = screen.queryByTestId('email-error');
403
+ const ageError = screen.queryByTestId('age-error');
404
+
405
+ expect(nameError).toBeInTheDocument();
406
+ expect(nameError).toHaveTextContent('Name must be at least 2 characters');
407
+ expect(emailError).toBeInTheDocument();
408
+ expect(emailError).toHaveTextContent('Invalid email address');
409
+ expect(ageError).toBeInTheDocument();
410
+ expect(ageError).toHaveTextContent('Must be at least 18 years old');
411
+ }, { timeout: 5000 });
387
412
  });
388
413
 
389
414
  it('submits form with valid data', async () => {
@@ -38,7 +38,7 @@ const mockSupabase = {
38
38
  const mockFile = new File(['test content'], 'test.txt', { type: 'text/plain' });
39
39
 
40
40
  describe('useStorage Hook', () => {
41
- const defaultProps = {
41
+ const baseProps = {
42
42
  supabase: mockSupabase,
43
43
  appName: 'test-app',
44
44
  orgId: 'test-org',
@@ -46,7 +46,7 @@ describe('useStorage Hook', () => {
46
46
 
47
47
  describe('Initial State', () => {
48
48
  it('should initialize with correct default values', () => {
49
- const { result } = renderHook(() => useStorage(defaultProps));
49
+ const { result } = renderHook(() => useStorage(baseProps));
50
50
 
51
51
  expect(result.current.isUploading).toBe(false);
52
52
  expect(result.current.uploadError).toBe(null);
@@ -58,7 +58,7 @@ describe('useStorage Hook', () => {
58
58
  });
59
59
 
60
60
  it('should provide all required functions', () => {
61
- const { result } = renderHook(() => useStorage(defaultProps));
61
+ const { result } = renderHook(() => useStorage(baseProps));
62
62
 
63
63
  expect(typeof result.current.uploadFile).toBe('function');
64
64
  expect(typeof result.current.getPublicUrl).toBe('function');
@@ -106,7 +106,7 @@ describe('useStorage Hook', () => {
106
106
  vi.mocked(uploadFile).mockResolvedValue(mockUploadResult);
107
107
  vi.mocked(listFiles).mockResolvedValue(mockListResult);
108
108
 
109
- const { result } = renderHook(() => useStorage(defaultProps));
109
+ const { result } = renderHook(() => useStorage(baseProps));
110
110
 
111
111
  let uploadResult: any;
112
112
  await act(async () => {
@@ -132,7 +132,7 @@ describe('useStorage Hook', () => {
132
132
 
133
133
  vi.mocked(uploadFile).mockResolvedValue(mockUploadResult);
134
134
 
135
- const { result } = renderHook(() => useStorage(defaultProps));
135
+ const { result } = renderHook(() => useStorage(baseProps));
136
136
 
137
137
  let uploadResult: any;
138
138
  await act(async () => {
@@ -153,7 +153,7 @@ describe('useStorage Hook', () => {
153
153
  vi.mocked(uploadFile).mockResolvedValue(mockUploadResult);
154
154
  vi.mocked(listFiles).mockResolvedValue({ files: [], totalCount: 0, hasMore: false });
155
155
 
156
- const { result } = renderHook(() => useStorage(defaultProps));
156
+ const { result } = renderHook(() => useStorage(baseProps));
157
157
 
158
158
  const customOptions = {
159
159
  isPublic: true,
@@ -179,7 +179,7 @@ describe('useStorage Hook', () => {
179
179
  it('should handle upload exception', async () => {
180
180
  vi.mocked(uploadFile).mockRejectedValue(new Error('Network error'));
181
181
 
182
- const { result } = renderHook(() => useStorage(defaultProps));
182
+ const { result } = renderHook(() => useStorage(baseProps));
183
183
 
184
184
  let uploadResult: any;
185
185
  await act(async () => {
@@ -197,7 +197,7 @@ describe('useStorage Hook', () => {
197
197
  it('should handle upload exception with non-Error object', async () => {
198
198
  vi.mocked(uploadFile).mockRejectedValue('String error');
199
199
 
200
- const { result } = renderHook(() => useStorage(defaultProps));
200
+ const { result } = renderHook(() => useStorage(baseProps));
201
201
 
202
202
  let uploadResult: any;
203
203
  await act(async () => {
@@ -217,7 +217,7 @@ describe('useStorage Hook', () => {
217
217
  const mockUrl = 'https://example.com/public/test-file.txt';
218
218
  vi.mocked(getPublicUrl).mockReturnValue(mockUrl);
219
219
 
220
- const { result } = renderHook(() => useStorage(defaultProps));
220
+ const { result } = renderHook(() => useStorage(baseProps));
221
221
 
222
222
  const url = result.current.getPublicUrl('test-org/public/test-file.txt');
223
223
 
@@ -229,7 +229,7 @@ describe('useStorage Hook', () => {
229
229
  const mockUrl = 'https://example.com/public/test-file.txt';
230
230
  vi.mocked(getPublicUrl).mockReturnValue(mockUrl);
231
231
 
232
- const { result } = renderHook(() => useStorage(defaultProps));
232
+ const { result } = renderHook(() => useStorage(baseProps));
233
233
 
234
234
  const url = result.current.getFileUrl('test-org/public/test-file.txt');
235
235
 
@@ -245,7 +245,7 @@ describe('useStorage Hook', () => {
245
245
 
246
246
  vi.mocked(getSignedUrl).mockResolvedValue(mockSignedUrl);
247
247
 
248
- const { result } = renderHook(() => useStorage(defaultProps));
248
+ const { result } = renderHook(() => useStorage(baseProps));
249
249
 
250
250
  let signedUrl: string | null = null;
251
251
  await act(async () => {
@@ -263,7 +263,7 @@ describe('useStorage Hook', () => {
263
263
  it('should handle signed URL failure', async () => {
264
264
  vi.mocked(getSignedUrl).mockRejectedValue(new Error('Signing failed'));
265
265
 
266
- const { result } = renderHook(() => useStorage(defaultProps));
266
+ const { result } = renderHook(() => useStorage(baseProps));
267
267
 
268
268
  let signedUrl: string | null = null;
269
269
  await act(async () => {
@@ -276,7 +276,7 @@ describe('useStorage Hook', () => {
276
276
  it('should handle signed URL with null result', async () => {
277
277
  vi.mocked(getSignedUrl).mockResolvedValue(null);
278
278
 
279
- const { result } = renderHook(() => useStorage(defaultProps));
279
+ const { result } = renderHook(() => useStorage(baseProps));
280
280
 
281
281
  let signedUrl: string | null = null;
282
282
  await act(async () => {
@@ -295,7 +295,7 @@ describe('useStorage Hook', () => {
295
295
  vi.mocked(deleteFile).mockResolvedValue(mockDeleteResult);
296
296
  vi.mocked(listFiles).mockResolvedValue(mockListResult);
297
297
 
298
- const { result } = renderHook(() => useStorage(defaultProps));
298
+ const { result } = renderHook(() => useStorage(baseProps));
299
299
 
300
300
  let deleteResult: any;
301
301
  await act(async () => {
@@ -311,7 +311,7 @@ describe('useStorage Hook', () => {
311
311
 
312
312
  vi.mocked(deleteFile).mockResolvedValue(mockDeleteResult);
313
313
 
314
- const { result } = renderHook(() => useStorage(defaultProps));
314
+ const { result } = renderHook(() => useStorage(baseProps));
315
315
 
316
316
  let deleteResult: any;
317
317
  await act(async () => {
@@ -324,7 +324,7 @@ describe('useStorage Hook', () => {
324
324
  it('should handle delete file exception', async () => {
325
325
  vi.mocked(deleteFile).mockRejectedValue(new Error('Network error'));
326
326
 
327
- const { result } = renderHook(() => useStorage(defaultProps));
327
+ const { result } = renderHook(() => useStorage(baseProps));
328
328
 
329
329
  let deleteResult: any;
330
330
  await act(async () => {
@@ -344,7 +344,7 @@ describe('useStorage Hook', () => {
344
344
  vi.mocked(archiveFile).mockResolvedValue(mockArchiveResult);
345
345
  vi.mocked(listFiles).mockResolvedValue(mockListResult);
346
346
 
347
- const { result } = renderHook(() => useStorage(defaultProps));
347
+ const { result } = renderHook(() => useStorage(baseProps));
348
348
 
349
349
  let archiveResult: any;
350
350
  await act(async () => {
@@ -363,7 +363,7 @@ describe('useStorage Hook', () => {
363
363
 
364
364
  vi.mocked(archiveFile).mockResolvedValue(mockArchiveResult);
365
365
 
366
- const { result } = renderHook(() => useStorage(defaultProps));
366
+ const { result } = renderHook(() => useStorage(baseProps));
367
367
 
368
368
  let archiveResult: any;
369
369
  await act(async () => {
@@ -376,7 +376,7 @@ describe('useStorage Hook', () => {
376
376
  it('should handle archive file exception', async () => {
377
377
  vi.mocked(archiveFile).mockRejectedValue(new Error('Network error'));
378
378
 
379
- const { result } = renderHook(() => useStorage(defaultProps));
379
+ const { result } = renderHook(() => useStorage(baseProps));
380
380
 
381
381
  let archiveResult: any;
382
382
  await act(async () => {
@@ -417,7 +417,7 @@ describe('useStorage Hook', () => {
417
417
 
418
418
  vi.mocked(listFiles).mockResolvedValue(mockListResult);
419
419
 
420
- const { result } = renderHook(() => useStorage(defaultProps));
420
+ const { result } = renderHook(() => useStorage(baseProps));
421
421
 
422
422
  let listResult: any;
423
423
  await act(async () => {
@@ -439,7 +439,7 @@ describe('useStorage Hook', () => {
439
439
 
440
440
  vi.mocked(listFiles).mockResolvedValue(mockListResult);
441
441
 
442
- const { result } = renderHook(() => useStorage(defaultProps));
442
+ const { result } = renderHook(() => useStorage(baseProps));
443
443
 
444
444
  const customOptions = {
445
445
  pathPrefix: 'documents',
@@ -465,7 +465,7 @@ describe('useStorage Hook', () => {
465
465
  it('should handle list files failure', async () => {
466
466
  vi.mocked(listFiles).mockRejectedValue(new Error('List failed'));
467
467
 
468
- const { result } = renderHook(() => useStorage(defaultProps));
468
+ const { result } = renderHook(() => useStorage(baseProps));
469
469
 
470
470
  let listResult: any;
471
471
  await act(async () => {
@@ -481,7 +481,7 @@ describe('useStorage Hook', () => {
481
481
  it('should handle list files exception with non-Error object', async () => {
482
482
  vi.mocked(listFiles).mockRejectedValue('String error');
483
483
 
484
- const { result } = renderHook(() => useStorage(defaultProps));
484
+ const { result } = renderHook(() => useStorage(baseProps));
485
485
 
486
486
  let listResult: any;
487
487
  await act(async () => {
@@ -497,7 +497,7 @@ describe('useStorage Hook', () => {
497
497
 
498
498
  vi.mocked(listFiles).mockResolvedValue(mockListResult);
499
499
 
500
- const { result } = renderHook(() => useStorage(defaultProps));
500
+ const { result } = renderHook(() => useStorage(baseProps));
501
501
 
502
502
  await act(async () => {
503
503
  await result.current.refreshFiles();
@@ -519,7 +519,7 @@ describe('useStorage Hook', () => {
519
519
 
520
520
  vi.mocked(uploadFile).mockReturnValue(uploadPromise);
521
521
 
522
- const { result } = renderHook(() => useStorage(defaultProps));
522
+ const { result } = renderHook(() => useStorage(baseProps));
523
523
 
524
524
  expect(result.current.isUploading).toBe(false);
525
525
 
@@ -545,7 +545,7 @@ describe('useStorage Hook', () => {
545
545
 
546
546
  vi.mocked(listFiles).mockReturnValue(listPromise);
547
547
 
548
- const { result } = renderHook(() => useStorage(defaultProps));
548
+ const { result } = renderHook(() => useStorage(baseProps));
549
549
 
550
550
  expect(result.current.isListing).toBe(false);
551
551
 
@@ -566,13 +566,13 @@ describe('useStorage Hook', () => {
566
566
 
567
567
  describe('Aliases', () => {
568
568
  it('should provide isLoading alias for isListing', () => {
569
- const { result } = renderHook(() => useStorage(defaultProps));
569
+ const { result } = renderHook(() => useStorage(baseProps));
570
570
 
571
571
  expect(result.current.isLoading).toBe(result.current.isListing);
572
572
  });
573
573
 
574
574
  it('should provide error alias for listError', () => {
575
- const { result } = renderHook(() => useStorage(defaultProps));
575
+ const { result } = renderHook(() => useStorage(baseProps));
576
576
 
577
577
  expect(result.current.error).toBe(result.current.listError);
578
578
  });
@@ -580,7 +580,7 @@ describe('useStorage Hook', () => {
580
580
  });
581
581
 
582
582
  describe('useFileUpload Hook', () => {
583
- const defaultProps = {
583
+ const baseProps = {
584
584
  supabase: mockSupabase,
585
585
  appName: 'test-app',
586
586
  orgId: 'test-org',
@@ -588,7 +588,7 @@ describe('useFileUpload Hook', () => {
588
588
 
589
589
  describe('Initial State', () => {
590
590
  it('should initialize with correct default values', () => {
591
- const { result } = renderHook(() => useFileUpload(defaultProps));
591
+ const { result } = renderHook(() => useFileUpload(baseProps));
592
592
 
593
593
  expect(result.current.uploadProgress).toBe(0);
594
594
  expect(result.current.isUploading).toBe(false);
@@ -605,7 +605,7 @@ describe('useFileUpload Hook', () => {
605
605
 
606
606
  vi.mocked(uploadFile).mockResolvedValue(mockUploadResult);
607
607
 
608
- const { result } = renderHook(() => useFileUpload(defaultProps));
608
+ const { result } = renderHook(() => useFileUpload(baseProps));
609
609
 
610
610
  let uploadResult: any;
611
611
  await act(async () => {
@@ -628,7 +628,7 @@ describe('useFileUpload Hook', () => {
628
628
 
629
629
  vi.mocked(uploadFile).mockReturnValue(uploadPromise);
630
630
 
631
- const { result } = renderHook(() => useFileUpload(defaultProps));
631
+ const { result } = renderHook(() => useFileUpload(baseProps));
632
632
 
633
633
  act(() => {
634
634
  result.current.uploadWithProgress(mockFile);
@@ -670,7 +670,7 @@ describe('useFileUpload Hook', () => {
670
670
 
671
671
  vi.mocked(uploadFile).mockResolvedValue(mockUploadResult);
672
672
 
673
- const { result } = renderHook(() => useFileUpload(defaultProps));
673
+ const { result } = renderHook(() => useFileUpload(baseProps));
674
674
 
675
675
  let uploadResult: any;
676
676
  await act(async () => {
@@ -686,7 +686,7 @@ describe('useFileUpload Hook', () => {
686
686
  it('should handle upload exception', async () => {
687
687
  vi.mocked(uploadFile).mockRejectedValue(new Error('Network error'));
688
688
 
689
- const { result } = renderHook(() => useFileUpload(defaultProps));
689
+ const { result } = renderHook(() => useFileUpload(baseProps));
690
690
 
691
691
  let uploadResult: any;
692
692
  await act(async () => {
@@ -707,7 +707,7 @@ describe('useFileUpload Hook', () => {
707
707
 
708
708
  vi.mocked(uploadFile).mockResolvedValue(mockUploadResult);
709
709
 
710
- const { result } = renderHook(() => useFileUpload(defaultProps));
710
+ const { result } = renderHook(() => useFileUpload(baseProps));
711
711
 
712
712
  await act(async () => {
713
713
  await result.current.uploadWithProgress(mockFile);
@@ -729,7 +729,7 @@ describe('useFileUpload Hook', () => {
729
729
 
730
730
  vi.mocked(uploadFile).mockResolvedValue(mockUploadResult);
731
731
 
732
- const { result } = renderHook(() => useFileUpload(defaultProps));
732
+ const { result } = renderHook(() => useFileUpload(baseProps));
733
733
 
734
734
  const customOptions = {
735
735
  isPublic: true,
@@ -54,7 +54,7 @@
54
54
  * - Error boundary integration
55
55
  *
56
56
  * @dependencies
57
- * - React 18+ - Hooks and effects
57
+ * - React 19+ - Hooks and effects
58
58
  * - @supabase/supabase-js - Database integration
59
59
  * - Event types - Type definitions
60
60
  */
@@ -59,7 +59,7 @@
59
59
  * - Lazy loading support
60
60
  *
61
61
  * @dependencies
62
- * - React 18+ - Hooks and effects
62
+ * - React 19+ - Hooks and effects
63
63
  * - @supabase/supabase-js - Storage integration
64
64
  * - Event types - Type definitions
65
65
  */
@@ -51,7 +51,7 @@
51
51
  * - Caching integration
52
52
  *
53
53
  * @dependencies
54
- * - React 18+ - Hooks and effects
54
+ * - React 19+ - Hooks and effects
55
55
  * - React Router - URL parameter extraction
56
56
  * - Event types - Type definitions
57
57
  */
@@ -3,7 +3,7 @@
3
3
  * @description Hook for managing DataTable state
4
4
  */
5
5
 
6
- import { useState, useCallback, useMemo } from 'react';
6
+ import { useState, useCallback } from 'react';
7
7
  import type { SortingState, ColumnFiltersState, ExpandedState } from '@tanstack/react-table';
8
8
 
9
9
  export interface DataTableState {
@@ -63,24 +63,14 @@ export function useDataTableState(options: UseDataTableStateOptions) {
63
63
  setSelectedRows([]);
64
64
  }, [initialPageSize]);
65
65
 
66
- // Computed values
67
- const paginatedData = useMemo(() => {
68
- const start = pageIndex * pageSize;
69
- const end = start + pageSize;
70
- return data.slice(start, end);
71
- }, [data, pageIndex, pageSize]);
66
+ // Computed values - React Compiler handles memoization automatically
67
+ const start = pageIndex * pageSize;
68
+ const end = start + pageSize;
69
+ const paginatedData = data.slice(start, end);
72
70
 
73
- const totalPages = useMemo(() => {
74
- return Math.ceil(data.length / pageSize);
75
- }, [data.length, pageSize]);
76
-
77
- const hasNextPage = useMemo(() => {
78
- return pageIndex < totalPages - 1;
79
- }, [pageIndex, totalPages]);
80
-
81
- const hasPreviousPage = useMemo(() => {
82
- return pageIndex > 0;
83
- }, [pageIndex]);
71
+ const totalPages = Math.ceil(data.length / pageSize);
72
+ const hasNextPage = pageIndex < totalPages - 1;
73
+ const hasPreviousPage = pageIndex > 0;
84
74
 
85
75
  return {
86
76
  state: {
@@ -11,8 +11,8 @@ export interface FocusManagementOptions {
11
11
  }
12
12
 
13
13
  export interface FocusManagementReturn {
14
- containerRef: React.RefObject<HTMLDivElement>;
15
- focusRef: React.RefObject<HTMLElement>;
14
+ containerRef: React.RefObject<HTMLDivElement | null>;
15
+ focusRef: React.RefObject<HTMLElement | null>;
16
16
  setFocus: (element: HTMLElement | null) => void;
17
17
  focusFirst: () => void;
18
18
  focusLast: () => void;
@@ -16,7 +16,7 @@ export interface FocusTrapOptions {
16
16
 
17
17
  export interface FocusTrapReturn {
18
18
  /** Ref to attach to the container element */
19
- containerRef: React.RefObject<HTMLElement>;
19
+ containerRef: React.RefObject<HTMLElement | null>;
20
20
  /** Focus the first focusable element */
21
21
  focusFirst: () => void;
22
22
  /** Focus the last focusable element */
@@ -58,9 +58,9 @@ export function useFocusTrap(options: FocusTrapOptions = {}): FocusTrapReturn {
58
58
  containerRef.current.querySelectorAll<HTMLElement>(focusableSelector)
59
59
  ).filter((element) => {
60
60
  return (
61
- !element.hasAttribute('disabled') &&
62
- !element.hasAttribute('hidden') &&
63
- element.offsetParent !== null // visible check
61
+ // visible check
62
+ (!element.hasAttribute('disabled') &&
63
+ !element.hasAttribute('hidden') && element.offsetParent !== null)
64
64
  );
65
65
  });
66
66
  }, [focusableSelector]);
@@ -23,7 +23,7 @@
23
23
  * ```
24
24
  */
25
25
 
26
- import { useState, useCallback } from 'react';
26
+ import { useState } from 'react';
27
27
 
28
28
  /**
29
29
  * Options for configuring the useFormDialog hook behavior
@@ -115,27 +115,28 @@ export function useFormDialog<T = unknown>({
115
115
  const [isOpen, setIsOpen] = useState(false);
116
116
  const [formData, setFormData] = useState<T | null>(null);
117
117
 
118
- const openDialog = useCallback((data: T | null = null) => {
118
+ // React Compiler handles memoization automatically
119
+ const openDialog = (data: T | null = null) => {
119
120
  setFormData(data);
120
121
  setIsOpen(true);
121
122
  onOpenChange?.(true);
122
- }, [onOpenChange]);
123
+ };
123
124
 
124
- const closeDialog = useCallback(() => {
125
+ const closeDialog = () => {
125
126
  setIsOpen(false);
126
127
  if (resetOnClose) {
127
128
  setFormData(null);
128
129
  }
129
130
  onOpenChange?.(false);
130
- }, [resetOnClose, onOpenChange]);
131
+ };
131
132
 
132
- const handleOpenChange = useCallback((open: boolean) => {
133
+ const handleOpenChange = (open: boolean) => {
133
134
  setIsOpen(open);
134
135
  if (!open && resetOnClose) {
135
136
  setFormData(null);
136
137
  }
137
138
  onOpenChange?.(open);
138
- }, [resetOnClose, onOpenChange]);
139
+ };
139
140
 
140
141
  return {
141
142
  isOpen,
@@ -48,7 +48,7 @@
48
48
  * - Cross-tab optimization
49
49
  *
50
50
  * @dependencies
51
- * - React 18+ - Hooks and effects
51
+ * - React 19+ - Hooks and effects
52
52
  * - Browser APIs - BroadcastChannel, localStorage, timers
53
53
  */
54
54
 
@@ -46,7 +46,7 @@
46
46
  * - Memory-efficient storage
47
47
  *
48
48
  * @dependencies
49
- * - React 18+ - Hooks and effects
49
+ * - React 19+ - Hooks and effects
50
50
  * - RBAC API functions - isPermittedCached for permission checking
51
51
  * - RBAC types - Type definitions
52
52
  *