@jmruthers/pace-core 0.5.115 → 0.5.117
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/{AuthService-CVgsgtaZ.d.ts → AuthService-D4646R4b.d.ts} +9 -4
- package/dist/{DataTable-H5KJCAIS.js → DataTable-ZOAKQ3SU.js} +10 -9
- package/dist/{UnifiedAuthProvider-KZZUO27W.js → UnifiedAuthProvider-YFN7YGVN.js} +4 -3
- package/dist/{api-PKU4PUBO.js → api-TNIBJWLM.js} +3 -3
- package/dist/{audit-H4YJJF7R.js → audit-T36HM7IM.js} +2 -2
- package/dist/{chunk-SYXOZQ4P.js → chunk-2GJ5GL77.js} +1 -1
- package/dist/chunk-2GJ5GL77.js.map +1 -0
- package/dist/{chunk-XYRZV7R5.js → chunk-2LM4QQGH.js} +30 -34
- package/dist/chunk-2LM4QQGH.js.map +1 -0
- package/dist/{chunk-3OGQLOJM.js → chunk-3DBFLLLU.js} +30 -1
- package/dist/chunk-3DBFLLLU.js.map +1 -0
- package/dist/{chunk-KTHLNIMA.js → chunk-ECOVPXYS.js} +13 -62
- package/dist/chunk-ECOVPXYS.js.map +1 -0
- package/dist/{chunk-HKWQN44G.js → chunk-IZXS7RZK.js} +15 -15
- package/dist/{chunk-OO3V7W4H.js → chunk-KA3PSVNV.js} +87 -40
- package/dist/chunk-KA3PSVNV.js.map +1 -0
- package/dist/{chunk-L36JW4KV.js → chunk-LFS45U62.js} +2 -2
- package/dist/{chunk-BUN7NMV7.js → chunk-O3FTRYEU.js} +2 -2
- package/dist/{chunk-F6QB26OS.js → chunk-P3PUOL6B.js} +80 -8
- package/dist/chunk-P3PUOL6B.js.map +1 -0
- package/dist/{chunk-ZPXWJA4H.js → chunk-PHDAXDHB.js} +131 -5
- package/dist/chunk-PHDAXDHB.js.map +1 -0
- package/dist/chunk-UJI6WSMD.js +201 -0
- package/dist/{chunk-5CDJCTOO.js.map → chunk-UJI6WSMD.js.map} +1 -1
- package/dist/{chunk-OUU3SP6I.js → chunk-UKZWNQMB.js} +50 -7
- package/dist/{chunk-OUU3SP6I.js.map → chunk-UKZWNQMB.js.map} +1 -1
- package/dist/{chunk-7H75SHXZ.js → chunk-VN3OOE35.js} +2 -2
- package/dist/{chunk-QKIVSZ2O.js → chunk-WP5I5GLN.js} +2 -2
- package/dist/{chunk-NEONKMTU.js → chunk-XN2LYHDI.js} +47 -6
- package/dist/chunk-XN2LYHDI.js.map +1 -0
- package/dist/components.d.ts +1 -1
- package/dist/components.js +12 -11
- package/dist/components.js.map +1 -1
- package/dist/hooks.d.ts +1 -1
- package/dist/hooks.js +10 -9
- package/dist/hooks.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +19 -16
- package/dist/index.js.map +1 -1
- package/dist/providers.d.ts +2 -2
- package/dist/providers.js +3 -2
- package/dist/rbac/index.d.ts +82 -1
- package/dist/rbac/index.js +13 -10
- package/dist/{useToast-DVT4dMtf.d.ts → useToast-Cs_g32bg.d.ts} +1 -1
- package/dist/utils.js +6 -4
- package/dist/utils.js.map +1 -1
- package/dist/validation.js +3 -1
- package/dist/validation.js.map +1 -1
- package/docs/README.md +4 -0
- package/docs/api/classes/ColumnFactory.md +1 -1
- package/docs/api/classes/ErrorBoundary.md +1 -1
- package/docs/api/classes/InvalidScopeError.md +1 -1
- package/docs/api/classes/MissingUserContextError.md +1 -1
- package/docs/api/classes/OrganisationContextRequiredError.md +1 -1
- package/docs/api/classes/PermissionDeniedError.md +1 -1
- package/docs/api/classes/PublicErrorBoundary.md +1 -1
- package/docs/api/classes/RBACAuditManager.md +35 -12
- package/docs/api/classes/RBACCache.md +1 -1
- package/docs/api/classes/RBACEngine.md +1 -1
- 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 +1 -1
- package/docs/api/interfaces/ButtonProps.md +1 -1
- package/docs/api/interfaces/CardProps.md +1 -1
- package/docs/api/interfaces/ColorPalette.md +1 -1
- package/docs/api/interfaces/ColorShade.md +1 -1
- package/docs/api/interfaces/DataAccessRecord.md +1 -1
- package/docs/api/interfaces/DataRecord.md +1 -1
- package/docs/api/interfaces/DataTableAction.md +1 -1
- package/docs/api/interfaces/DataTableColumn.md +1 -1
- package/docs/api/interfaces/DataTableProps.md +1 -1
- package/docs/api/interfaces/DataTableToolbarButton.md +1 -1
- package/docs/api/interfaces/EmptyStateConfig.md +1 -1
- package/docs/api/interfaces/EnhancedNavigationMenuProps.md +1 -1
- package/docs/api/interfaces/EventAppRoleData.md +71 -0
- package/docs/api/interfaces/FileDisplayProps.md +1 -1
- 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 +122 -0
- 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 +1 -1
- package/docs/api/interfaces/NavigationContextType.md +1 -1
- package/docs/api/interfaces/NavigationGuardProps.md +1 -1
- package/docs/api/interfaces/NavigationItem.md +1 -1
- package/docs/api/interfaces/NavigationMenuProps.md +1 -1
- package/docs/api/interfaces/NavigationProviderProps.md +1 -1
- package/docs/api/interfaces/Organisation.md +1 -1
- package/docs/api/interfaces/OrganisationContextType.md +1 -1
- package/docs/api/interfaces/OrganisationMembership.md +1 -1
- package/docs/api/interfaces/OrganisationProviderProps.md +1 -1
- package/docs/api/interfaces/OrganisationSecurityError.md +1 -1
- package/docs/api/interfaces/PaceAppLayoutProps.md +27 -27
- package/docs/api/interfaces/PaceLoginPageProps.md +1 -1
- package/docs/api/interfaces/PageAccessRecord.md +1 -1
- package/docs/api/interfaces/PagePermissionContextType.md +1 -1
- package/docs/api/interfaces/PagePermissionGuardProps.md +1 -1
- package/docs/api/interfaces/PagePermissionProviderProps.md +1 -1
- package/docs/api/interfaces/PaletteData.md +1 -1
- package/docs/api/interfaces/PermissionEnforcerProps.md +1 -1
- package/docs/api/interfaces/ProtectedRouteProps.md +1 -1
- 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 +100 -0
- package/docs/api/interfaces/RoleBasedRouterContextType.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterProps.md +1 -1
- package/docs/api/interfaces/RoleManagementResult.md +52 -0
- package/docs/api/interfaces/RouteAccessRecord.md +1 -1
- package/docs/api/interfaces/RouteConfig.md +1 -1
- package/docs/api/interfaces/SecureDataContextType.md +1 -1
- package/docs/api/interfaces/SecureDataProviderProps.md +1 -1
- package/docs/api/interfaces/StorageConfig.md +1 -1
- package/docs/api/interfaces/StorageFileInfo.md +1 -1
- package/docs/api/interfaces/StorageFileMetadata.md +1 -1
- package/docs/api/interfaces/StorageListOptions.md +1 -1
- package/docs/api/interfaces/StorageListResult.md +1 -1
- package/docs/api/interfaces/StorageUploadOptions.md +1 -1
- package/docs/api/interfaces/StorageUploadResult.md +1 -1
- package/docs/api/interfaces/StorageUrlOptions.md +1 -1
- package/docs/api/interfaces/StyleImport.md +1 -1
- package/docs/api/interfaces/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 +1 -1
- package/docs/api/interfaces/UnifiedAuthProviderProps.md +1 -1
- package/docs/api/interfaces/UseInactivityTrackerOptions.md +1 -1
- package/docs/api/interfaces/UseInactivityTrackerReturn.md +1 -1
- package/docs/api/interfaces/UsePublicEventOptions.md +1 -1
- package/docs/api/interfaces/UsePublicEventReturn.md +1 -1
- package/docs/api/interfaces/UsePublicFileDisplayOptions.md +1 -1
- package/docs/api/interfaces/UsePublicFileDisplayReturn.md +1 -1
- package/docs/api/interfaces/UsePublicRouteParamsReturn.md +1 -1
- package/docs/api/interfaces/UseResolvedScopeOptions.md +1 -1
- package/docs/api/interfaces/UseResolvedScopeReturn.md +1 -1
- package/docs/api/interfaces/UserEventAccess.md +1 -1
- package/docs/api/interfaces/UserMenuProps.md +1 -1
- package/docs/api/interfaces/UserProfile.md +1 -1
- package/docs/api/modules.md +41 -14
- package/docs/architecture/rpc-function-standards.md +193 -0
- package/package.json +1 -1
- package/src/__tests__/TEST_STANDARD.md +244 -2
- package/src/components/DataTable/__tests__/a11y.basic.test.tsx +46 -16
- package/src/components/DataTable/__tests__/keyboard.test.tsx +276 -217
- package/src/components/DataTable/components/DataTableCore.tsx +29 -2
- package/src/components/DataTable/components/DataTableToolbar.tsx +3 -2
- package/src/components/DataTable/components/EditableRow.tsx +18 -1
- package/src/components/DataTable/components/ViewRowModal.tsx +1 -1
- package/src/components/DataTable/components/__tests__/AccessDeniedPage.test.tsx +735 -0
- package/src/components/DataTable/components/__tests__/BulkOperationsDropdown.test.tsx +572 -0
- package/src/components/DataTable/components/__tests__/ColumnVisibilityDropdown.test.tsx +708 -0
- package/src/components/DataTable/components/__tests__/DataTableErrorBoundary.test.tsx +451 -0
- package/src/components/DataTable/components/__tests__/DataTableModals.test.tsx +456 -0
- package/src/components/DataTable/components/__tests__/EditableRow.test.tsx +454 -0
- package/src/components/DataTable/components/__tests__/ExpandButton.test.tsx +462 -0
- package/src/components/DataTable/components/__tests__/FilterRow.test.tsx +423 -0
- package/src/components/DataTable/components/__tests__/GroupHeader.test.tsx +393 -0
- package/src/components/DataTable/components/__tests__/GroupingDropdown.test.tsx +617 -0
- package/src/components/DataTable/components/__tests__/ImportModal.test.tsx +734 -0
- package/src/components/DataTable/components/__tests__/ViewRowModal.test.tsx +412 -0
- package/src/components/DataTable/hooks/useTableHandlers.ts +4 -0
- package/src/components/EventSelector/EventSelector.tsx +5 -25
- package/src/components/PaceAppLayout/PaceAppLayout.test.tsx +12 -7
- package/src/components/PaceAppLayout/PaceAppLayout.tsx +4 -0
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.accessibility.test.tsx +7 -2
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.integration.test.tsx +13 -8
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.performance.test.tsx +109 -100
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.security.test.tsx +18 -13
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.unit.test.tsx +17 -12
- package/src/components/PaceLoginPage/PaceLoginPage.test.tsx +2 -0
- package/src/components/PaceLoginPage/PaceLoginPage.tsx +11 -1
- package/src/components/PasswordReset/PasswordChangeForm.test.tsx +2 -2
- package/src/components/ProtectedRoute/ProtectedRoute.test.tsx +648 -0
- package/src/components/ProtectedRoute/ProtectedRoute.tsx +10 -7
- package/src/components/PublicLayout/__tests__/PublicErrorBoundary.test.tsx +4 -12
- package/src/components/Select/Select.tsx +8 -0
- package/src/components/Toast/Toast.tsx +1 -1
- package/src/hooks/__tests__/usePublicEvent.simple.test.ts +367 -3
- package/src/hooks/__tests__/usePublicFileDisplay.test.ts +916 -0
- package/src/hooks/useEventTheme.ts +49 -18
- package/src/hooks/usePermissionCache.ts +5 -3
- package/src/hooks/useSecureDataAccess.ts +56 -3
- package/src/hooks/useToast.ts +1 -1
- package/src/providers/services/EventServiceProvider.tsx +15 -8
- package/src/rbac/__tests__/cache-invalidation.test.ts +385 -0
- package/src/rbac/audit.test.ts +206 -0
- package/src/rbac/audit.ts +37 -2
- package/src/rbac/components/__tests__/PagePermissionGuard.test.tsx +26 -23
- package/src/rbac/errors.test.ts +340 -0
- package/src/rbac/hooks/index.ts +9 -0
- package/src/rbac/hooks/useResolvedScope.test.ts +1063 -0
- package/src/rbac/hooks/useRoleManagement.test.ts +908 -0
- package/src/rbac/hooks/useRoleManagement.ts +255 -0
- package/src/services/AuthService.ts +10 -0
- package/src/services/EventService.ts +111 -50
- package/src/services/__tests__/AuthService.test.ts +1 -1
- package/src/services/__tests__/EventService.test.ts +60 -45
- package/src/services/interfaces/IEventService.ts +1 -1
- package/src/utils/__tests__/deviceFingerprint.unit.test.ts +320 -0
- package/src/utils/__tests__/logger.unit.test.ts +398 -0
- package/src/utils/__tests__/validation.unit.test.ts +225 -1
- package/src/utils/file-reference.test.ts +214 -0
- package/dist/chunk-3OGQLOJM.js.map +0 -1
- package/dist/chunk-5CDJCTOO.js +0 -190
- package/dist/chunk-F6QB26OS.js.map +0 -1
- package/dist/chunk-KTHLNIMA.js.map +0 -1
- package/dist/chunk-NEONKMTU.js.map +0 -1
- package/dist/chunk-OO3V7W4H.js.map +0 -1
- package/dist/chunk-SYXOZQ4P.js.map +0 -1
- package/dist/chunk-XYRZV7R5.js.map +0 -1
- package/dist/chunk-ZPXWJA4H.js.map +0 -1
- package/src/rbac/audit-enhanced.ts +0 -351
- /package/dist/{DataTable-H5KJCAIS.js.map → DataTable-ZOAKQ3SU.js.map} +0 -0
- /package/dist/{UnifiedAuthProvider-KZZUO27W.js.map → UnifiedAuthProvider-YFN7YGVN.js.map} +0 -0
- /package/dist/{api-PKU4PUBO.js.map → api-TNIBJWLM.js.map} +0 -0
- /package/dist/{audit-H4YJJF7R.js.map → audit-T36HM7IM.js.map} +0 -0
- /package/dist/{chunk-HKWQN44G.js.map → chunk-IZXS7RZK.js.map} +0 -0
- /package/dist/{chunk-L36JW4KV.js.map → chunk-LFS45U62.js.map} +0 -0
- /package/dist/{chunk-BUN7NMV7.js.map → chunk-O3FTRYEU.js.map} +0 -0
- /package/dist/{chunk-7H75SHXZ.js.map → chunk-VN3OOE35.js.map} +0 -0
- /package/dist/{chunk-QKIVSZ2O.js.map → chunk-WP5I5GLN.js.map} +0 -0
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
UnifiedAuthProvider,
|
|
3
3
|
init_UnifiedAuthProvider,
|
|
4
4
|
useUnifiedAuth
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-KA3PSVNV.js";
|
|
6
6
|
import {
|
|
7
7
|
__esm,
|
|
8
8
|
__export
|
|
@@ -24,4 +24,4 @@ export {
|
|
|
24
24
|
UnifiedAuthProvider_exports,
|
|
25
25
|
init_UnifiedAuthProvider2 as init_UnifiedAuthProvider
|
|
26
26
|
};
|
|
27
|
-
//# sourceMappingURL=chunk-
|
|
27
|
+
//# sourceMappingURL=chunk-VN3OOE35.js.map
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
createAuditManager,
|
|
3
3
|
emitAuditEvent,
|
|
4
4
|
setGlobalAuditManager
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-3DBFLLLU.js";
|
|
6
6
|
|
|
7
7
|
// src/rbac/types.ts
|
|
8
8
|
var RBACError = class extends Error {
|
|
@@ -1561,4 +1561,4 @@ export {
|
|
|
1561
1561
|
invalidateAppCache,
|
|
1562
1562
|
clearCache
|
|
1563
1563
|
};
|
|
1564
|
-
//# sourceMappingURL=chunk-
|
|
1564
|
+
//# sourceMappingURL=chunk-WP5I5GLN.js.map
|
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
import {
|
|
2
2
|
init_useOrganisations,
|
|
3
3
|
useOrganisations
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-LFS45U62.js";
|
|
5
5
|
import {
|
|
6
|
+
EventServiceContext,
|
|
7
|
+
init_EventServiceProvider,
|
|
6
8
|
useUnifiedAuth
|
|
7
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-KA3PSVNV.js";
|
|
8
10
|
import {
|
|
9
11
|
init_organisationContext,
|
|
10
12
|
setOrganisationContext
|
|
11
13
|
} from "./chunk-BDZUMRBD.js";
|
|
12
14
|
|
|
13
15
|
// src/hooks/useSecureDataAccess.ts
|
|
14
|
-
import { useCallback, useState } from "react";
|
|
16
|
+
import { useCallback, useState, useContext } from "react";
|
|
15
17
|
init_useOrganisations();
|
|
18
|
+
init_EventServiceProvider();
|
|
16
19
|
init_organisationContext();
|
|
17
20
|
function useSecureDataAccess() {
|
|
18
21
|
const { supabase, user, session } = useUnifiedAuth();
|
|
19
22
|
const { ensureOrganisationContext } = useOrganisations();
|
|
23
|
+
const eventServiceContext = useContext(EventServiceContext);
|
|
24
|
+
const selectedEvent = eventServiceContext?.eventService?.getSelectedEvent() || null;
|
|
20
25
|
const validateContext = useCallback(() => {
|
|
21
26
|
if (!supabase) {
|
|
22
27
|
throw new Error("No Supabase client available");
|
|
@@ -290,10 +295,46 @@ function useSecureDataAccess() {
|
|
|
290
295
|
organisationId
|
|
291
296
|
});
|
|
292
297
|
await setOrganisationContextInSession(organisationId);
|
|
298
|
+
const functionsWithPOrganisationId = [
|
|
299
|
+
"data_cake_diners_list",
|
|
300
|
+
"data_cake_mealplans_list"
|
|
301
|
+
];
|
|
302
|
+
const paramName = functionsWithPOrganisationId.includes(functionName) ? "p_organisation_id" : "organisation_id";
|
|
303
|
+
const functionsNeedingEventId = [
|
|
304
|
+
"data_cake_items_list",
|
|
305
|
+
"data_cake_packages_list",
|
|
306
|
+
"data_cake_suppliers_list",
|
|
307
|
+
"data_cake_diettypes_list",
|
|
308
|
+
"data_cake_mealtypes_list",
|
|
309
|
+
"data_cake_diners_list",
|
|
310
|
+
"data_cake_mealplans_list",
|
|
311
|
+
"data_cake_dishes_list",
|
|
312
|
+
"data_cake_recipes_list",
|
|
313
|
+
"data_cake_meals_list",
|
|
314
|
+
"data_cake_units_list",
|
|
315
|
+
"data_cake_orders_list",
|
|
316
|
+
"app_cake_item_create",
|
|
317
|
+
"app_cake_item_update",
|
|
318
|
+
"app_cake_package_create",
|
|
319
|
+
"app_cake_package_update",
|
|
320
|
+
"app_cake_supplier_create",
|
|
321
|
+
"app_cake_supplier_update",
|
|
322
|
+
"app_cake_supplier_delete",
|
|
323
|
+
"app_cake_meal_create",
|
|
324
|
+
"app_cake_meal_update",
|
|
325
|
+
"app_cake_meal_delete",
|
|
326
|
+
"app_cake_unit_create",
|
|
327
|
+
"app_cake_unit_update",
|
|
328
|
+
"app_cake_unit_delete",
|
|
329
|
+
"app_cake_delivery_upsert"
|
|
330
|
+
];
|
|
293
331
|
const secureParams = {
|
|
294
332
|
...params,
|
|
295
|
-
|
|
333
|
+
[paramName]: organisationId
|
|
296
334
|
};
|
|
335
|
+
if (functionsNeedingEventId.includes(functionName) && selectedEvent?.event_id) {
|
|
336
|
+
secureParams.p_event_id = selectedEvent.event_id;
|
|
337
|
+
}
|
|
297
338
|
const { data, error } = await supabase.rpc(functionName, secureParams);
|
|
298
339
|
if (error) {
|
|
299
340
|
console.error("[useSecureDataAccess] RPC failed:", error);
|
|
@@ -303,7 +344,7 @@ function useSecureDataAccess() {
|
|
|
303
344
|
functionName
|
|
304
345
|
});
|
|
305
346
|
return data;
|
|
306
|
-
}, [validateContext, getCurrentOrganisationId, setOrganisationContextInSession, supabase]);
|
|
347
|
+
}, [validateContext, getCurrentOrganisationId, setOrganisationContextInSession, supabase, selectedEvent?.event_id]);
|
|
307
348
|
const [dataAccessHistory, setDataAccessHistory] = useState([]);
|
|
308
349
|
const [isStrictMode] = useState(true);
|
|
309
350
|
const [isAuditLogEnabled] = useState(true);
|
|
@@ -380,4 +421,4 @@ function useSecureDataAccess() {
|
|
|
380
421
|
export {
|
|
381
422
|
useSecureDataAccess
|
|
382
423
|
};
|
|
383
|
-
//# sourceMappingURL=chunk-
|
|
424
|
+
//# sourceMappingURL=chunk-XN2LYHDI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/hooks/useSecureDataAccess.ts"],"sourcesContent":["/**\n * @file useSecureDataAccess Hook\n * @package @jmruthers/pace-core\n * @module Hooks/useSecureDataAccess\n * @since 0.4.0\n *\n * Hook for secure database operations with mandatory organisation context.\n * Ensures all data access is properly scoped to the user's current organisation.\n *\n * @example\n * ```tsx\n * function DataComponent() {\n * const { secureQuery, secureInsert, secureUpdate, secureDelete } = useSecureDataAccess();\n * \n * const loadData = async () => {\n * try {\n * // Automatically includes organisation_id filter\n * const events = await secureQuery('event', '*', { is_visible: true });\n * console.log('Organisation events:', events);\n * } catch (error) {\n * console.error('Failed to load data:', error);\n * }\n * };\n * \n * const createEvent = async (eventData) => {\n * try {\n * // Automatically sets organisation_id\n * const newEvent = await secureInsert('event', eventData);\n * console.log('Created event:', newEvent);\n * } catch (error) {\n * console.error('Failed to create event:', error);\n * }\n * };\n * \n * return (\n * <div>\n * <button onClick={loadData}>Load Data</button>\n * <button onClick={() => createEvent({ event_name: 'New Event' })}>\n * Create Event\n * </button>\n * </div>\n * );\n * }\n * ```\n *\n * @security\n * - All queries automatically include organisation_id filter\n * - Validates organisation context before any operation\n * - Prevents data leaks between organisations\n * - Error handling for security violations\n * - Type-safe database operations\n */\n\nimport { useCallback, useState, useContext } from 'react';\nimport { useUnifiedAuth } from '../providers';\nimport { useOrganisations } from './useOrganisations';\nimport { EventServiceContext } from '../providers/services/EventServiceProvider';\nimport { setOrganisationContext } from '../utils/organisationContext';\nimport type { Permission } from '../rbac/types';\nimport type { OrganisationSecurityError } from '../types/organisation';\n\nexport interface SecureDataAccessReturn {\n /** Execute a secure query with organisation filtering */\n secureQuery: <T = any>(\n table: string,\n columns: string,\n filters?: Record<string, any>,\n options?: {\n orderBy?: string;\n ascending?: boolean;\n limit?: number;\n offset?: number;\n }\n ) => Promise<T[]>;\n \n /** Execute a secure insert with organisation context */\n secureInsert: <T = any>(\n table: string,\n data: Record<string, any>\n ) => Promise<T>;\n \n /** Execute a secure update with organisation filtering */\n secureUpdate: <T = any>(\n table: string,\n data: Record<string, any>,\n filters: Record<string, any>\n ) => Promise<T[]>;\n \n /** Execute a secure delete with organisation filtering */\n secureDelete: (\n table: string,\n filters: Record<string, any>\n ) => Promise<void>;\n \n /** Execute a secure RPC call with organisation context */\n secureRpc: <T = any>(\n functionName: string,\n params?: Record<string, any>\n ) => Promise<T>;\n \n /** Get current organisation ID */\n getCurrentOrganisationId: () => string;\n \n /** Validate organisation context */\n validateContext: () => void;\n \n // NEW: Phase 1 - Enhanced Security Features\n /** Check if data access is allowed for a table and operation */\n isDataAccessAllowed: (table: string, operation: string) => boolean;\n \n /** Get all data access permissions for current user */\n getDataAccessPermissions: () => Record<string, string[]>;\n \n /** Check if strict mode is enabled */\n isStrictMode: boolean;\n \n /** Check if audit logging is enabled */\n isAuditLogEnabled: boolean;\n \n /** Get data access history */\n getDataAccessHistory: () => DataAccessRecord[];\n \n /** Clear data access history */\n clearDataAccessHistory: () => void;\n \n /** Validate data access attempt */\n validateDataAccess: (table: string, operation: string) => boolean;\n}\n\nexport interface DataAccessRecord {\n table: string;\n operation: string;\n userId: string;\n organisationId: string;\n allowed: boolean;\n timestamp: string;\n query?: string;\n filters?: Record<string, any>;\n}\n\n/**\n * Hook for secure data access with automatic organisation filtering\n * \n * All database operations automatically include organisation context:\n * - Queries filter by organisation_id\n * - Inserts include organisation_id\n * - Updates/deletes are scoped to organisation\n * - RPC calls include organisation_id parameter\n */\nexport function useSecureDataAccess(): SecureDataAccessReturn {\n const { supabase, user, session } = useUnifiedAuth();\n const { ensureOrganisationContext } = useOrganisations();\n \n // Get selected event for event-scoped RPC calls\n // Use useContext directly to safely check if EventServiceProvider is available\n const eventServiceContext = useContext(EventServiceContext);\n const selectedEvent = eventServiceContext?.eventService?.getSelectedEvent() || null;\n\n const validateContext = useCallback((): void => {\n if (!supabase) {\n throw new Error('No Supabase client available') as OrganisationSecurityError;\n }\n if (!user || !session) {\n throw new Error('User must be authenticated with valid session') as OrganisationSecurityError;\n }\n \n try {\n ensureOrganisationContext();\n } catch (error) {\n throw new Error('Organisation context is required for data access') as OrganisationSecurityError;\n }\n }, [supabase, user, session, ensureOrganisationContext]);\n\n const getCurrentOrganisationId = useCallback((): string => {\n validateContext();\n const currentOrg = ensureOrganisationContext();\n return currentOrg.id;\n }, [validateContext, ensureOrganisationContext]);\n\n // Set organisation context in database session\n const setOrganisationContextInSession = useCallback(async (organisationId: string): Promise<void> => {\n if (!supabase) {\n throw new Error('No Supabase client available') as OrganisationSecurityError;\n }\n\n await setOrganisationContext(supabase, organisationId);\n }, [supabase]);\n\n const secureQuery = useCallback(async <T = any>(\n table: string,\n columns: string,\n filters: Record<string, any> = {},\n options: {\n orderBy?: string;\n ascending?: boolean;\n limit?: number;\n offset?: number;\n } = {}\n ): Promise<T[]> => {\n validateContext();\n const organisationId = getCurrentOrganisationId();\n \n console.log('[useSecureDataAccess] Executing secure query:', {\n table,\n organisationId,\n filters\n });\n\n // Set organisation context in database session\n await setOrganisationContextInSession(organisationId);\n\n // Build query with organisation filter\n let query = supabase!\n .from(table)\n .select(columns);\n\n // Add organisation filter only if table has organisation_id column\n const tablesWithOrganisation = [\n 'event', 'organisation_settings',\n 'rbac_event_app_roles', 'rbac_organisation_roles',\n // SECURITY: Phase 2 additions - complete organisation table mapping\n 'organisation_audit_log', 'organisation_invitations', 'organisation_app_access',\n // SECURITY: Emergency additions for Phase 1 fixes\n 'cake_meal', 'cake_mealtype', 'pace_person', 'pace_member',\n // SECURITY: Phase 3A additions - medical and personal data\n 'medi_profile', 'medi_condition', 'medi_diet', 'medi_action_plan', 'medi_profile_versions',\n 'pace_consent', 'pace_contact', 'pace_id_documents', 'pace_qualifications',\n 'form_responses', 'form_response_values', 'forms',\n // SECURITY: Phase 3B additions - remaining critical tables\n 'invoice', 'line_item', 'credit_balance', 'payment_method',\n 'form_contexts', 'form_field_config', 'form_fields',\n 'cake_delivery', 'cake_diettype', 'cake_diner', 'cake_dish', 'cake_item', \n 'cake_logistics', 'cake_mealplan', 'cake_package', 'cake_recipe', 'cake_supplier', \n 'cake_supply', 'cake_unit', 'event_app_access', 'base_application', 'base_questions'\n ];\n \n if (tablesWithOrganisation.includes(table)) {\n query = query.eq('organisation_id', organisationId);\n }\n\n // Apply additional filters\n Object.entries(filters).forEach(([key, value]) => {\n if (value !== undefined && value !== null) {\n // Handle qualified column names (e.g., 'users.role')\n const columnName = key.includes('.') ? key.split('.').pop()! : key;\n query = query.eq(columnName, value);\n }\n });\n\n // Apply options\n if (options.orderBy) {\n // Only use the column name, not a qualified name\n const orderByColumn = options.orderBy.split('.').pop();\n if (orderByColumn) {\n query = query.order(orderByColumn, { ascending: options.ascending ?? true });\n }\n }\n \n if (options.limit) {\n query = query.limit(options.limit);\n }\n \n if (options.offset) {\n query = query.range(options.offset, options.offset + (options.limit || 100) - 1);\n }\n\n const { data, error } = await query;\n \n if (error) {\n console.error('[useSecureDataAccess] Query failed:', error);\n // NEW: Phase 1 - Record failed data access attempt\n recordDataAccess(table, 'read', false, `SELECT ${columns} FROM ${table}`, filters);\n throw error;\n }\n\n console.log('[useSecureDataAccess] Query successful:', {\n table,\n resultCount: data?.length || 0\n });\n\n // NEW: Phase 1 - Record successful data access attempt\n recordDataAccess(table, 'read', true, `SELECT ${columns} FROM ${table}`, filters);\n\n return (data as T[]) || [];\n }, [validateContext, getCurrentOrganisationId, setOrganisationContextInSession, supabase]);\n\n const secureInsert = useCallback(async <T = any>(\n table: string,\n data: Record<string, any>\n ): Promise<T> => {\n validateContext();\n const organisationId = getCurrentOrganisationId();\n \n console.log('[useSecureDataAccess] Executing secure insert:', {\n table,\n organisationId\n });\n\n // Set organisation context in database session\n await setOrganisationContextInSession(organisationId);\n\n // Ensure organisation_id is set\n const secureData = {\n ...data,\n organisation_id: organisationId\n };\n\n const { data: insertData, error } = await supabase!\n .from(table)\n .insert(secureData)\n .select()\n .single();\n\n if (error) {\n console.error('[useSecureDataAccess] Insert failed:', error);\n throw error;\n }\n\n console.log('[useSecureDataAccess] Insert successful:', {\n table,\n id: insertData?.id\n });\n\n return insertData as T;\n }, [validateContext, getCurrentOrganisationId, setOrganisationContextInSession, supabase]);\n\n const secureUpdate = useCallback(async <T = any>(\n table: string,\n data: Record<string, any>,\n filters: Record<string, any>\n ): Promise<T[]> => {\n validateContext();\n const organisationId = getCurrentOrganisationId();\n \n console.log('[useSecureDataAccess] Executing secure update:', {\n table,\n organisationId,\n filters\n });\n\n // Set organisation context in database session\n await setOrganisationContextInSession(organisationId);\n\n // Filter out organisation_id from data to prevent manipulation\n const { organisation_id, ...secureData } = data;\n \n // Build update query with organisation filter\n let query = supabase!\n .from(table)\n .update(secureData);\n\n // Add organisation filter only if table has organisation_id column\n const tablesWithOrganisation = [\n 'event', 'organisation_settings',\n 'rbac_event_app_roles', 'rbac_organisation_roles',\n // SECURITY: Phase 2 additions - complete organisation table mapping\n 'organisation_audit_log', 'organisation_invitations', 'organisation_app_access',\n // SECURITY: Emergency additions for Phase 1 fixes\n 'cake_meal', 'cake_mealtype', 'pace_person', 'pace_member'\n ];\n \n if (tablesWithOrganisation.includes(table)) {\n query = query.eq('organisation_id', organisationId);\n }\n\n // Apply filters\n Object.entries(filters).forEach(([key, value]) => {\n if (value !== undefined && value !== null) {\n query = query.eq(key, value);\n }\n });\n\n const { data: updateData, error } = await query.select();\n\n if (error) {\n console.error('[useSecureDataAccess] Update failed:', error);\n throw error;\n }\n\n console.log('[useSecureDataAccess] Update successful:', {\n table,\n updatedCount: updateData?.length || 0\n });\n\n return (updateData as T[]) || [];\n }, [validateContext, getCurrentOrganisationId, setOrganisationContextInSession, supabase]);\n\n const secureDelete = useCallback(async (\n table: string,\n filters: Record<string, any>\n ): Promise<void> => {\n validateContext();\n const organisationId = getCurrentOrganisationId();\n \n console.log('[useSecureDataAccess] Executing secure delete:', {\n table,\n organisationId,\n filters\n });\n\n // Set organisation context in database session\n await setOrganisationContextInSession(organisationId);\n\n // Build delete query with organisation filter\n let query = supabase!\n .from(table)\n .delete();\n\n // Add organisation filter only if table has organisation_id column\n const tablesWithOrganisation = [\n 'event', 'organisation_settings',\n 'rbac_event_app_roles', 'rbac_organisation_roles',\n // SECURITY: Phase 2 additions - complete organisation table mapping\n 'organisation_audit_log', 'organisation_invitations', 'organisation_app_access',\n // SECURITY: Emergency additions for Phase 1 fixes\n 'cake_meal', 'cake_mealtype', 'pace_person', 'pace_member',\n // SECURITY: Phase 3A additions - medical and personal data\n 'medi_profile', 'medi_condition', 'medi_diet', 'medi_action_plan', 'medi_profile_versions',\n 'pace_consent', 'pace_contact', 'pace_id_documents', 'pace_qualifications',\n 'form_responses', 'form_response_values', 'forms',\n // SECURITY: Phase 3B additions - remaining critical tables\n 'invoice', 'line_item', 'credit_balance', 'payment_method',\n 'form_contexts', 'form_field_config', 'form_fields',\n 'cake_delivery', 'cake_diettype', 'cake_diner', 'cake_dish', 'cake_item', \n 'cake_logistics', 'cake_mealplan', 'cake_package', 'cake_recipe', 'cake_supplier', \n 'cake_supply', 'cake_unit', 'event_app_access', 'base_application', 'base_questions'\n ];\n \n if (tablesWithOrganisation.includes(table)) {\n query = query.eq('organisation_id', organisationId);\n }\n\n // Apply filters\n Object.entries(filters).forEach(([key, value]) => {\n if (value !== undefined && value !== null) {\n query = query.eq(key, value);\n }\n });\n\n const { error } = await query;\n\n if (error) {\n console.error('[useSecureDataAccess] Delete failed:', error);\n throw error;\n }\n\n console.log('[useSecureDataAccess] Delete successful:', {\n table\n });\n }, [validateContext, getCurrentOrganisationId, setOrganisationContextInSession, supabase]);\n\n const secureRpc = useCallback(async <T = any>(\n functionName: string,\n params: Record<string, any> = {}\n ): Promise<T> => {\n validateContext();\n const organisationId = getCurrentOrganisationId();\n \n console.log('[useSecureDataAccess] Executing secure RPC:', {\n functionName,\n organisationId\n });\n\n // Set organisation context in database session\n await setOrganisationContextInSession(organisationId);\n\n // Include organisation_id in RPC parameters\n // Some functions use p_organisation_id instead of organisation_id (to avoid conflicts with RETURNS TABLE columns)\n const functionsWithPOrganisationId = [\n 'data_cake_diners_list',\n 'data_cake_mealplans_list'\n ];\n \n const paramName = functionsWithPOrganisationId.includes(functionName) \n ? 'p_organisation_id' \n : 'organisation_id';\n \n // Functions that need p_event_id for event-app role permission checks\n // Note: Even org-scoped functions (like items, packages, suppliers) need event_id\n // for permission checks when users have event-app roles\n const functionsNeedingEventId = [\n 'data_cake_items_list',\n 'data_cake_packages_list',\n 'data_cake_suppliers_list',\n 'data_cake_diettypes_list',\n 'data_cake_mealtypes_list',\n 'data_cake_diners_list',\n 'data_cake_mealplans_list',\n 'data_cake_dishes_list',\n 'data_cake_recipes_list',\n 'data_cake_meals_list',\n 'data_cake_units_list',\n 'data_cake_orders_list',\n 'app_cake_item_create',\n 'app_cake_item_update',\n 'app_cake_package_create',\n 'app_cake_package_update',\n 'app_cake_supplier_create',\n 'app_cake_supplier_update',\n 'app_cake_supplier_delete',\n 'app_cake_meal_create',\n 'app_cake_meal_update',\n 'app_cake_meal_delete',\n 'app_cake_unit_create',\n 'app_cake_unit_update',\n 'app_cake_unit_delete',\n 'app_cake_delivery_upsert'\n ];\n \n const secureParams = {\n ...params,\n [paramName]: organisationId\n };\n \n // Add p_event_id if function needs it and event is selected\n if (functionsNeedingEventId.includes(functionName) && selectedEvent?.event_id) {\n secureParams.p_event_id = selectedEvent.event_id;\n }\n\n const { data, error } = await supabase!.rpc(functionName, secureParams);\n\n if (error) {\n console.error('[useSecureDataAccess] RPC failed:', error);\n throw error;\n }\n\n console.log('[useSecureDataAccess] RPC successful:', {\n functionName\n });\n\n return data as T;\n }, [validateContext, getCurrentOrganisationId, setOrganisationContextInSession, supabase, selectedEvent?.event_id]);\n\n // NEW: Phase 1 - Enhanced Security Features\n const [dataAccessHistory, setDataAccessHistory] = useState<DataAccessRecord[]>([]);\n const [isStrictMode] = useState(true); // Always enabled in Phase 1\n const [isAuditLogEnabled] = useState(true); // Always enabled in Phase 1\n\n // Check if data access is allowed for a table and operation\n const isDataAccessAllowed = useCallback((table: string, operation: string): boolean => {\n if (!user?.id) return false;\n \n // Use the existing RBAC system to check data access permissions\n // This is a synchronous check for the context - actual permission checking\n // happens in the secure data operations using the RBAC engine\n const permission = `${operation}:data.${table}` as Permission;\n \n // For now, we'll return true and let the secure data operations\n // handle the actual permission checking asynchronously\n // This context is mainly for tracking and audit purposes\n return true;\n }, [user?.id]);\n\n // Get all data access permissions for current user\n const getDataAccessPermissions = useCallback((): Record<string, string[]> => {\n if (!user?.id) return {};\n \n // For now, return empty object - this will be enhanced with actual permission checking\n // when we integrate with the existing RBAC system\n return {};\n }, [user?.id]);\n\n // Get data access history\n const getDataAccessHistory = useCallback((): DataAccessRecord[] => {\n return [...dataAccessHistory];\n }, [dataAccessHistory]);\n\n // Clear data access history\n const clearDataAccessHistory = useCallback(() => {\n setDataAccessHistory([]);\n }, []);\n\n // Validate data access attempt\n const validateDataAccess = useCallback((table: string, operation: string): boolean => {\n if (!user?.id) return false;\n \n // Validate organisation context\n try {\n validateContext();\n } catch (error) {\n console.error(`[useSecureDataAccess] Organisation context validation failed:`, error);\n return false;\n }\n \n return isDataAccessAllowed(table, operation);\n }, [user?.id, validateContext, isDataAccessAllowed]);\n\n // Record data access attempt\n const recordDataAccess = useCallback((\n table: string,\n operation: string,\n allowed: boolean,\n query?: string,\n filters?: Record<string, any>\n ) => {\n if (!isAuditLogEnabled || !user?.id) return;\n \n const record: DataAccessRecord = {\n table,\n operation,\n userId: user.id,\n organisationId: getCurrentOrganisationId(),\n allowed,\n timestamp: new Date().toISOString(),\n query,\n filters\n };\n \n setDataAccessHistory(prev => {\n const newHistory = [record, ...prev];\n return newHistory.slice(0, 1000); // Keep last 1000 records\n });\n \n if (isStrictMode && !allowed) {\n console.error(`[useSecureDataAccess] STRICT MODE VIOLATION: User attempted data access without permission`, {\n table,\n operation,\n userId: user.id,\n organisationId: getCurrentOrganisationId(),\n timestamp: new Date().toISOString()\n });\n }\n }, [isAuditLogEnabled, isStrictMode, user?.id, getCurrentOrganisationId]);\n\n return {\n secureQuery,\n secureInsert,\n secureUpdate,\n secureDelete,\n secureRpc,\n getCurrentOrganisationId,\n validateContext,\n // NEW: Phase 1 - Enhanced Security Features\n isDataAccessAllowed,\n getDataAccessPermissions,\n isStrictMode,\n isAuditLogEnabled,\n getDataAccessHistory,\n clearDataAccessHistory,\n validateDataAccess\n };\n} "],"mappings":";;;;;;;;;;;;;;;AAqDA,SAAS,aAAa,UAAU,kBAAkB;AAElD;AACA;AACA;AA4FO,SAAS,sBAA8C;AAC5D,QAAM,EAAE,UAAU,MAAM,QAAQ,IAAI,eAAe;AACnD,QAAM,EAAE,0BAA0B,IAAI,iBAAiB;AAIvD,QAAM,sBAAsB,WAAW,mBAAmB;AAC1D,QAAM,gBAAgB,qBAAqB,cAAc,iBAAiB,KAAK;AAE/E,QAAM,kBAAkB,YAAY,MAAY;AAC9C,QAAI,CAAC,UAAU;AACb,YAAM,IAAI,MAAM,8BAA8B;AAAA,IAChD;AACA,QAAI,CAAC,QAAQ,CAAC,SAAS;AACrB,YAAM,IAAI,MAAM,+CAA+C;AAAA,IACjE;AAEA,QAAI;AACF,gCAA0B;AAAA,IAC5B,SAAS,OAAO;AACd,YAAM,IAAI,MAAM,kDAAkD;AAAA,IACpE;AAAA,EACF,GAAG,CAAC,UAAU,MAAM,SAAS,yBAAyB,CAAC;AAEvD,QAAM,2BAA2B,YAAY,MAAc;AACzD,oBAAgB;AAChB,UAAM,aAAa,0BAA0B;AAC7C,WAAO,WAAW;AAAA,EACpB,GAAG,CAAC,iBAAiB,yBAAyB,CAAC;AAG/C,QAAM,kCAAkC,YAAY,OAAO,mBAA0C;AACnG,QAAI,CAAC,UAAU;AACb,YAAM,IAAI,MAAM,8BAA8B;AAAA,IAChD;AAEA,UAAM,uBAAuB,UAAU,cAAc;AAAA,EACvD,GAAG,CAAC,QAAQ,CAA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qB,UAAQ;AAC3B,YAAM,aAAa,CAAC,QAAQ,GAAG,IAAI;AACnC,aAAO,WAAW,MAAM,GAAG,GAAI;AAAA,IACjC,CAAC;AAED,QAAI,gBAAgB,CAAC,SAAS;AAC5B,cAAQ,MAAM,8FAA8F;AAAA,QAC1G;AAAA,QACA;AAAA,QACA,QAAQ,KAAK;AAAA,QACb,gBAAgB,yBAAyB;AAAA,QACzC,YAAW,oBAAI,KAAK,GAAE,YAAY;AAAA,MACpC,CAAC;AAAA,IACH;AAAA,EACF,GAAG,CAAC,mBAAmB,cAAc,MAAM,IAAI,wBAAwB,CAAC;AAExE,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
|
package/dist/components.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { a as UnifiedAuthContextType, c as UnifiedAuthProvider, b as UnifiedAuthProviderProps, u as useUnifiedAuth } from './UnifiedAuthProvider-BVKmQd9u.js';
|
|
2
2
|
export { A as Alert, m as AlertDescription, l as AlertTitle, n as Avatar, p as AvatarFallback, o as AvatarImage, B as Button, a as ButtonProps, C as Card, g as CardActions, i as CardActionsProps, f as CardContent, e as CardDescription, c as CardFooter, b as CardHeader, h as CardProps, d as CardTitle, q as Checkbox, b3 as DefaultPublicErrorFallback, D as Dialog, K as DialogBody, G as DialogClose, H as DialogContent, U as DialogContentProps, O as DialogDescription, Z as DialogDescriptionProps, M as DialogFooter, X as DialogFooterProps, J as DialogHeader, W as DialogHeaderProps, E as DialogOverlay, V as DialogOverlayProps, z as DialogPortal, Q as DialogProps, _ as DialogSize, N as DialogTitle, Y as DialogTitleProps, F as DialogTrigger, R as DialogTriggerProps, aB as ErrorBoundary, aC as ErrorBoundaryProps, aD as ErrorBoundaryState, aG as EventSelector, aK as FileDisplay, aL as FileDisplayProps, aI as FileUpload, aJ as FileUploadProps, ar as Footer, as as FooterProps, am as Form, an as FormProps, aq as Header, I as Input, j as InputProps, L as Label, k as LabelProps, aE as LoadingSpinner, ao as LoginForm, ap as LoginFormProps, ax as NavigationItem, av as NavigationMenu, aw as NavigationMenuProps, ay as OrganisationSelector, az as OrganisationSelectorProps, be as PaceAppLayout, bd as PaceAppLayoutProps, bg as PaceLoginPage, bf as PaceLoginPageProps, aH as PasswordResetForm, P as Progress, at as ProtectedRoute, au as ProtectedRouteProps, b1 as PublicErrorBoundary, ba as PublicErrorBoundaryProps, bb as PublicErrorBoundaryState, b6 as PublicLoadingSkeleton, b4 as PublicLoadingSpinner, b5 as PublicLoadingSpinnerFullPage, bc as PublicLoadingSpinnerProps, b0 as PublicPageContextChecker, a_ as PublicPageDebugger, a$ as PublicPageDiagnostic, aZ as PublicPageFooter, b9 as PublicPageFooterProps, aV as PublicPageHeader, b8 as PublicPageHeaderProps, aT as PublicPageLayout, b7 as PublicPageLayoutProps, aW as PublicPageProvider, $ as Select, a3 as SelectContent, a0 as SelectGroup, a5 as SelectItem, a4 as SelectLabel, a6 as SelectSeparator, a2 as SelectTrigger, a1 as SelectValue, aF as SessionRestorationLoader, S as Switch, r as SwitchProps, T as Table, t as TableBody, u as TableCaption, v as TableCell, w as TableFooter, x as TableHead, s as TableHeader, y as TableRow, a7 as Toast, a9 as ToastAction, af as ToastActionElement, ae as ToastClose, ad as ToastDescription, ag as ToastProps, aa as ToastProvider, ac as ToastTitle, ab as ToastViewport, a8 as Toaster, ah as Tooltip, aj as TooltipContent, ak as TooltipProvider, al as TooltipRoot, ai as TooltipTrigger, aS as UseFileReferenceForRecordReturn, aQ as UseFileReferenceOptions, aR as UseFileReferenceReturn, aA as UserMenu, b2 as useErrorBoundary, aM as useFileReference, aO as useFileReferenceById, aN as useFileReferenceForRecord, aP as useFilesByCategory, aY as useIsPublicPage, aU as usePublicPageContext, aX as usePublicPageProviderContext } from './PublicLoadingSpinner-DgDWTFqn.js';
|
|
3
|
-
export { u as useToast } from './useToast-
|
|
3
|
+
export { u as useToast } from './useToast-Cs_g32bg.js';
|
|
4
4
|
export { D as DataTable, a as DataTableProps } from './DataTable-D5cBRca8.js';
|
|
5
5
|
export { A as AggregateConfig, D as DataRecord, f as DataTableAction, a as DataTableColumn, g as DataTableToolbarButton, E as EmptyStateConfig, G as GetRowId } from './types-D4TVpDa1.js';
|
|
6
6
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
package/dist/components.js
CHANGED
|
@@ -51,7 +51,7 @@ import {
|
|
|
51
51
|
useFileReferenceForRecord,
|
|
52
52
|
useFilesByCategory,
|
|
53
53
|
usePublicPageContext as usePublicPageContext2
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-2LM4QQGH.js";
|
|
55
55
|
import {
|
|
56
56
|
Alert,
|
|
57
57
|
AlertDescription,
|
|
@@ -91,10 +91,10 @@ import {
|
|
|
91
91
|
TooltipProvider,
|
|
92
92
|
TooltipRoot,
|
|
93
93
|
TooltipTrigger
|
|
94
|
-
} from "./chunk-
|
|
95
|
-
import "./chunk-
|
|
96
|
-
import "./chunk-
|
|
97
|
-
import "./chunk-
|
|
94
|
+
} from "./chunk-UKZWNQMB.js";
|
|
95
|
+
import "./chunk-PHDAXDHB.js";
|
|
96
|
+
import "./chunk-WP5I5GLN.js";
|
|
97
|
+
import "./chunk-3DBFLLLU.js";
|
|
98
98
|
import {
|
|
99
99
|
DefaultPublicErrorFallback,
|
|
100
100
|
PublicErrorBoundary,
|
|
@@ -102,19 +102,19 @@ import {
|
|
|
102
102
|
useErrorBoundary,
|
|
103
103
|
useIsPublicPage,
|
|
104
104
|
usePublicPageContext
|
|
105
|
-
} from "./chunk-
|
|
105
|
+
} from "./chunk-P3PUOL6B.js";
|
|
106
106
|
import {
|
|
107
107
|
useToast
|
|
108
|
-
} from "./chunk-
|
|
109
|
-
import "./chunk-
|
|
108
|
+
} from "./chunk-2GJ5GL77.js";
|
|
109
|
+
import "./chunk-LFS45U62.js";
|
|
110
110
|
import {
|
|
111
111
|
init_UnifiedAuthProvider
|
|
112
|
-
} from "./chunk-
|
|
113
|
-
import "./chunk-
|
|
112
|
+
} from "./chunk-VN3OOE35.js";
|
|
113
|
+
import "./chunk-O3FTRYEU.js";
|
|
114
114
|
import {
|
|
115
115
|
UnifiedAuthProvider,
|
|
116
116
|
useUnifiedAuth
|
|
117
|
-
} from "./chunk-
|
|
117
|
+
} from "./chunk-KA3PSVNV.js";
|
|
118
118
|
import {
|
|
119
119
|
FileCategory
|
|
120
120
|
} from "./chunk-XJ2HZOBU.js";
|
|
@@ -127,6 +127,7 @@ import {
|
|
|
127
127
|
import "./chunk-JCQZ6LA7.js";
|
|
128
128
|
import "./chunk-O3NWNXDY.js";
|
|
129
129
|
import "./chunk-BDZUMRBD.js";
|
|
130
|
+
import "./chunk-UJI6WSMD.js";
|
|
130
131
|
import "./chunk-SMJZMKYN.js";
|
|
131
132
|
import "./chunk-PLDDJCW6.js";
|
|
132
133
|
|
package/dist/components.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/index.ts","../src/components/Form/FormField.tsx","../src/components/Form/FormErrorSummary.tsx","../src/components/Form/FormLiveRegion.tsx","../src/components/Form/FormFieldset.tsx"],"sourcesContent":["/**\n * @file Complete Components Library Export\n * @package @jmruthers/pace-core\n * @module Components\n * @since 0.1.0\n * \n * This file exports ALL components, providers, and utilities in the PACE Core library.\n * Use this import path when you need access to specialized components not included in the main export.\n * \n * @example\n * // Complete library access\n * import { Dialog, NavigationMenu } from '@jmruthers/pace-core/components';\n * \n * // For common components, prefer the main export:\n * import { Button, Card } from '@jmruthers/pace-core';\n */\n\n// ============================================================================\n// AUTHENTICATION & AUTHORIZATION\n// ============================================================================\n\n// Unified auth provider (replaces individual providers)\nexport { UnifiedAuthProvider, useUnifiedAuth } from '../providers/UnifiedAuthProvider';\nexport type { UnifiedAuthProviderProps, UnifiedAuthContextType } from '../providers/UnifiedAuthProvider';\n\n// ============================================================================\n// BASIC UI COMPONENTS\n// ============================================================================\n\nexport { Button } from './Button';\nexport type { ButtonProps } from './Button';\n\nexport { \n Card, \n CardHeader, \n CardFooter, \n CardTitle, \n CardDescription, \n CardContent,\n CardActions\n} from './Card';\nexport type { CardProps, CardActionsProps } from './Card';\n\nexport { Input } from './Input';\nexport type { InputProps } from './Input';\nexport { Label } from './Label';\nexport type { LabelProps } from './Label';\n\nexport { Alert, AlertTitle, AlertDescription } from './Alert';\nexport { Avatar, AvatarImage, AvatarFallback } from './Avatar';\n\nexport { Checkbox } from './Checkbox';\nexport { Switch } from './Switch';\nexport type { SwitchProps } from './Switch';\nexport { Progress } from './Progress/Progress';\n\n// Table components\nexport {\n Table,\n TableHeader,\n TableBody,\n TableCaption,\n TableCell,\n TableFooter,\n TableHead,\n TableRow,\n} from './Table/Table';\n\n// ============================================================================\n// ADVANCED UI COMPONENTS\n// ============================================================================\n\n// Dialog exports\nexport {\n Dialog,\n DialogPortal,\n DialogOverlay,\n DialogTrigger,\n DialogClose,\n DialogContent,\n DialogHeader,\n DialogBody,\n DialogFooter,\n DialogTitle,\n DialogDescription,\n} from './Dialog/Dialog';\nexport type {\n DialogProps,\n DialogTriggerProps,\n DialogContentProps,\n DialogOverlayProps,\n DialogHeaderProps,\n DialogFooterProps,\n DialogTitleProps,\n DialogDescriptionProps,\n DialogSize\n} from './Dialog/Dialog';\n\n// Dropdown Menu exports\n// DropdownMenu components have been merged into Select components\n\n// Select exports (includes all dropdown functionality)\nexport {\n Select,\n SelectGroup,\n SelectValue,\n SelectTrigger,\n SelectContent,\n SelectLabel,\n SelectItem,\n SelectSeparator,\n} from './Select';\n\n// Toast exports\nexport {\n Toast,\n Toaster,\n ToastAction,\n ToastProvider,\n ToastViewport,\n ToastTitle,\n ToastDescription,\n ToastClose,\n} from './Toast';\nexport type { ToastActionElement, ToastProps } from './Toast';\n\n// Tooltip exports\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider, TooltipRoot } from './Tooltip';\n\n// ============================================================================\n// DATA DISPLAY COMPONENTS\n// ============================================================================\n\nexport {\n DataTable,\n type DataTableProps,\n type DataTableColumn,\n type DataTableAction,\n type DataTableToolbarButton,\n type AggregateConfig,\n type EmptyStateConfig,\n type GetRowId\n} from './DataTable';\n\n// Re-export types from DataTable types\nexport type { DataRecord } from './DataTable/types';\n\n// ============================================================================\n// FORM COMPONENTS\n// ============================================================================\n\nexport { \n Form, \n FormField, \n FormErrorSummary, \n FormLiveRegion, \n FormFieldset \n} from './Form';\nexport type { \n FormProps, \n FormFieldProps, \n FormErrorSummaryProps, \n FormLiveRegionProps, \n FormFieldsetProps \n} from './Form';\n\n// LoginForm - ensure it's exported\nexport { LoginForm } from './LoginForm';\nexport type { LoginFormProps } from './LoginForm';\n\n// ============================================================================\n// LAYOUT COMPONENTS\n// ============================================================================\n\nexport { Header } from './Header';\nexport { Footer } from './Footer';\nexport type { FooterProps } from './Footer';\n\n// Public Layout Components\nexport * from './PublicLayout';\n\n// ============================================================================\n// SECURITY COMPONENTS\n// ============================================================================\n\nexport { ProtectedRoute } from './ProtectedRoute';\nexport type { ProtectedRouteProps } from './ProtectedRoute';\n\n// ============================================================================\n// NAVIGATION COMPONENTS\n// ============================================================================\n\nexport {\n NavigationMenu,\n} from './NavigationMenu';\nexport type { NavigationMenuProps, NavigationItem } from './NavigationMenu';\n\nexport { OrganisationSelector } from './OrganisationSelector';\nexport type { OrganisationSelectorProps } from './OrganisationSelector';\n\nexport { UserMenu } from './UserMenu';\n\n// Reusable Page/Layout Components\nexport * from './PaceAppLayout';\nexport * from './PaceLoginPage';\n\n// ============================================================================\n// UTILITY COMPONENTS\n// ============================================================================\n\nexport { ErrorBoundary } from './ErrorBoundary';\nexport type { ErrorBoundaryProps, ErrorBoundaryState } from './ErrorBoundary';\nexport { LoadingSpinner } from './LoadingSpinner';\nexport { SessionRestorationLoader } from './SessionRestorationLoader';\n\n// ============================================================================\n// EVENT MANAGEMENT\n// ============================================================================\n\nexport { EventSelector } from './EventSelector';\n\n// ============================================================================\n// AUTHENTICATION FORMS\n// ============================================================================\n\n// Password Component exports\nexport { PasswordResetForm } from './PasswordReset';\n\n// ============================================================================\n// STORAGE COMPONENTS\n// ============================================================================\n\nexport { FileUpload } from './FileUpload';\nexport type { FileUploadProps } from './FileUpload';\n\nexport { FileDisplay } from './FileDisplay';\nexport type { FileDisplayProps } from './FileDisplay';\n\n\n// ============================================================================\n// TYPES\n// ============================================================================\n\nexport { FileCategory } from '../types/file-reference';\nexport type { FileReference, FileMetadata, FileUploadOptions } from '../types/file-reference';\n\n// ============================================================================\n// HOOKS\n// ============================================================================\n\n\nexport { \n useFileReference, \n useFileReferenceForRecord,\n useFileReferenceById,\n useFilesByCategory\n} from '../hooks/useFileReference';\nexport type { \n UseFileReferenceOptions, \n UseFileReferenceReturn, \n UseFileReferenceForRecordReturn \n} from '../hooks/useFileReference';\n\nexport { useToast } from '../hooks/useToast';\n\n// RBAC Components - Use the new RBAC system\n// For RBAC functionality, import from @jmruthers/pace-core/rbac\n// export { PermissionGuard, AccessLevelGuard } from '@jmruthers/pace-core/rbac';\n","/**\n * @file FormField Component\n * @package @jmruthers/pace-core\n * @module Components/Form\n * @since 0.1.0\n *\n * A flexible form field component that integrates with React Hook Form and provides\n * built-in validation, error handling, and accessibility features.\n *\n * Features:\n * - React Hook Form integration with Controller\n * - Built-in validation with error display\n * - Accessible labels and error messages\n * - Custom render function support\n * - TypeScript support with generic field paths\n * - Consistent styling with error states\n * - Test ID support for testing\n * - Flexible input types and props\n *\n * @example\n * ```tsx\n * // Basic text field\n * <FormField\n * name=\"username\"\n * label=\"Username\"\n * placeholder=\"Enter your username\"\n * validation={{ required: true }}\n * />\n * \n * // Email field with custom validation\n * <FormField\n * name=\"email\"\n * label=\"Email Address\"\n * type=\"email\"\n * validation={{\n * required: true,\n * pattern: {\n * value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,}$/i,\n * message: \"Invalid email address\"\n * }\n * }}\n * />\n * \n * // Custom render function\n * <FormField\n * name=\"avatar\"\n * label=\"Profile Picture\"\n * render={({ field }) => (\n * <input\n * {...field}\n * type=\"file\"\n * accept=\"image/*\"\n * className=\"file:mr-4 file:py-2 file:px-4 file:rounded-full file:border-0 file:text-sm file:font-semibold file:bg-sec-50 file:text-sec-700 hover:file:bg-sec-100\"\n * />\n * )}\n * />\n * \n * // With test ID for testing\n * <FormField\n * name=\"password\"\n * label=\"Password\"\n * type=\"password\"\n * data-testid=\"password-field\"\n * validation={{\n * required: true,\n * minLength: {\n * value: 8,\n * message: \"Password must be at least 8 characters\"\n * }\n * }}\n * />\n * ```\n *\n * @accessibility\n * - Proper label association with htmlFor\n * - Error messages with role=\"alert\"\n * - Required field indicators\n * - Focus management\n * - Screen reader friendly error announcements\n * - Keyboard navigation support\n *\n * @dependencies\n * - react-hook-form - Form integration\n * - React 18+ - Hooks and context\n * - Tailwind CSS - Styling\n */\n\nimport React from 'react';\nimport { useFormContext, Controller, FieldPath, FieldValues } from 'react-hook-form';\nimport { cn } from '../../utils/cn';\nimport { Label } from '../Label';\n\nexport interface FormFieldProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n> {\n /**\n * Field name\n */\n name: TName;\n \n /**\n * Field label\n */\n label?: string;\n \n /**\n * Field type\n */\n type?: string;\n \n /**\n * Placeholder text\n */\n placeholder?: string;\n \n /**\n * Additional props for the input\n */\n inputProps?: React.InputHTMLAttributes<HTMLInputElement>;\n \n /**\n * Validation rules\n */\n validation?: {\n required?: boolean;\n pattern?: {\n value: RegExp;\n message: string;\n };\n minLength?: {\n value: number;\n message: string;\n };\n maxLength?: {\n value: number;\n message: string;\n };\n };\n \n /**\n * Custom render function\n */\n render?: ({ field }: { field: any }) => React.ReactElement;\n \n /**\n * Test ID\n */\n 'data-testid'?: string;\n \n /**\n * Class name\n */\n className?: string;\n}\n\n/**\n * FormField component for React Hook Form integration\n * \n * @template TFieldValues - The type of form field values\n * @template TName - The type of the field name (must be a valid field path)\n * @param props - Form field configuration and validation\n * @returns JSX.Element - The rendered form field with validation\n * \n * @example\n * ```tsx\n * <FormField\n * name=\"email\"\n * label=\"Email\"\n * type=\"email\"\n * validation={{\n * required: true,\n * pattern: {\n * value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,}$/i,\n * message: \"Please enter a valid email address\"\n * }\n * }}\n * />\n * ```\n */\nexport function FormField<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n>({\n name,\n label,\n type = \"text\",\n placeholder,\n inputProps,\n validation,\n render,\n 'data-testid': testId,\n className,\n}: FormFieldProps<TFieldValues, TName>) {\n const { control, formState: { errors } } = useFormContext<TFieldValues>();\n const fieldError = errors[name];\n\n // Safely extract error message\n const errorMessage = fieldError && typeof fieldError === 'object' && 'message' in fieldError \n ? String(fieldError.message) \n : undefined;\n\n return (\n <div className={cn(\"space-y-2\", className)}>\n {label && (\n <Label htmlFor={name}>\n {label}\n {validation?.required && (\n <span className=\"text-destructive ml-1\" aria-label=\"required\">\n *\n </span>\n )}\n </Label>\n )}\n \n <Controller\n name={name}\n control={control}\n rules={validation}\n render={({ field }) => {\n if (render) {\n return render({ field });\n }\n \n return (\n <input\n {...field}\n id={name}\n type={type}\n placeholder={placeholder}\n data-testid={testId}\n className={cn(\n \"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50\",\n fieldError && \"border-destructive focus-visible:ring-destructive\"\n )}\n {...inputProps}\n />\n );\n }}\n />\n \n {errorMessage && (\n <p className=\"text-destructive\" role=\"alert\">\n {errorMessage}\n </p>\n )}\n </div>\n );\n}\n","\n/**\n * @file FormErrorSummary Component\n * @package @jmruthers/pace-core\n * @module Components/Form\n * @since 0.1.0\n *\n * A form error summary component that displays validation errors in a user-friendly format.\n * Provides a centralized location for users to see all form errors at once.\n *\n * Features:\n * - Displays all form errors in one place\n * - Configurable error display format\n * - Optional field name display\n * - Accessible error presentation\n * - Consistent styling with Alert component\n * - Automatic error filtering\n * - Responsive design\n *\n * @example\n * ```tsx\n * // Basic error summary\n * <FormErrorSummary errors={formErrors} />\n * \n * // With custom title\n * <FormErrorSummary \n * errors={formErrors}\n * title=\"Please correct the following issues:\"\n * />\n * \n * // Show field names with errors\n * <FormErrorSummary \n * errors={formErrors}\n * showFieldNames={true}\n * />\n * \n * // In a form with React Hook Form\n * const { formState: { errors } } = useForm();\n * \n * <Form onSubmit={handleSubmit}>\n * <FormField name=\"email\" label=\"Email\" />\n * <FormField name=\"password\" label=\"Password\" />\n * <FormErrorSummary errors={errors} />\n * <Button type=\"submit\">Submit</Button>\n * </Form>\n * ```\n *\n * @accessibility\n * - Uses Alert component for consistent accessibility\n * - Proper heading hierarchy with h3\n * - List structure for error items\n * - Screen reader friendly error announcements\n * - High contrast support via Alert component\n *\n * @dependencies\n * - Alert component for consistent styling\n * - React 18+ - Component framework\n * - Tailwind CSS - Styling\n */\n\nimport { Alert } from '../Alert';\n\nexport interface FormErrorSummaryProps {\n /** Form validation errors object */\n errors?: Record<string, any>;\n /** Title displayed above the error list */\n title?: string;\n /** Whether to show field names alongside error messages */\n showFieldNames?: boolean;\n}\n\n/**\n * FormErrorSummary component for displaying form validation errors\n * \n * This component provides a user-friendly way to display all form errors\n * in one centralized location, improving the user experience by making\n * it clear what needs to be fixed.\n * \n * @param props - Component configuration\n * @param props.errors - Form validation errors object\n * @param props.title - Title displayed above the error list\n * @param props.showFieldNames - Whether to show field names with errors\n * @returns JSX.Element - The rendered error summary or null if no errors\n */\nexport function FormErrorSummary({ \n errors = {}, \n title = \"Please fix the following errors:\",\n showFieldNames = false \n}: FormErrorSummaryProps) {\n const errorEntries = Object.entries(errors).filter(([, value]) => Boolean(value));\n\n if (errorEntries.length === 0) {\n return null;\n }\n\n return (\n <Alert variant=\"destructive\" className=\"mb-4\">\n <div>\n <h3>{title}</h3>\n <ul className=\"list-disc list-inside space-y-1\">\n {errorEntries.map(([field, error], index) => {\n const message = typeof error === 'object' && error.message ? error.message : String(error);\n return (\n <li key={index} className=\"text-sm\">\n {showFieldNames ? `${field}: ${message}` : message}\n </li>\n );\n })}\n </ul>\n </div>\n </Alert>\n );\n}\n","/**\n * @file FormLiveRegion Component\n * @package @jmruthers/pace-core\n * @module Components/Form\n * @since 0.1.0\n *\n * An accessible live region component for form validation announcements.\n * Provides real-time feedback to screen readers about form validation states\n * and error messages, improving accessibility for users with assistive technologies.\n *\n * Features:\n * - Real-time form validation announcements\n * - Configurable politeness levels (polite/assertive)\n * - Customizable delay timing\n * - Field-level and form-level announcements\n * - Success message customization\n * - Automatic error counting and field identification\n * - Accessibility compliant with ARIA live regions\n * - Integration with React Hook Form\n *\n * @example\n * ```tsx\n * // Basic live region\n * const { control, formState } = useForm();\n * \n * <Form onSubmit={handleSubmit}>\n * <FormField name=\"email\" label=\"Email\" />\n * <FormField name=\"password\" label=\"Password\" />\n * <FormLiveRegion form={{ control, formState }} />\n * <Button type=\"submit\">Submit</Button>\n * </Form>\n * \n * // With custom configuration\n * <FormLiveRegion\n * form={{ control, formState }}\n * politeness=\"assertive\"\n * delay={1000}\n * successMessage=\"Your form was submitted successfully!\"\n * enableFieldAnnouncements={true}\n * />\n * \n * // In a complex form\n * function ComplexForm() {\n * const methods = useForm({\n * defaultValues: { name: '', email: '', message: '' }\n * });\n * \n * return (\n * <FormProvider {...methods}>\n * <form onSubmit={methods.handleSubmit(onSubmit)}>\n * <FormField name=\"name\" label=\"Name\" />\n * <FormField name=\"email\" label=\"Email\" />\n * <FormField name=\"message\" label=\"Message\" />\n * <FormLiveRegion \n * form={methods}\n * politeness=\"polite\"\n * delay={300}\n * />\n * <Button type=\"submit\">Send Message</Button>\n * </form>\n * </FormProvider>\n * );\n * }\n * ```\n *\n * @accessibility\n * - ARIA live region for screen reader announcements\n * - Configurable politeness levels for different message types\n * - Automatic error counting and field identification\n * - Non-intrusive validation feedback\n * - WCAG 2.1 AA compliant\n * - Screen reader friendly error announcements\n *\n * @dependencies\n * - react-hook-form - Form state management\n * - React 18+ - Hooks and effects\n * - Tailwind CSS - Styling\n */\n\nimport React, { useEffect, useState } from 'react';\nimport { UseFormReturn, FieldValues } from 'react-hook-form';\nimport { cn } from '../../utils/cn';\n\n/**\n * Props for the FormLiveRegion component\n */\nexport interface FormLiveRegionProps<T extends FieldValues> {\n /** React Hook Form instance */\n form: UseFormReturn<T>;\n /** ARIA live region politeness level */\n politeness?: 'polite' | 'assertive';\n /** Delay before announcing messages (in ms) */\n delay?: number;\n /** Custom success message */\n successMessage?: string;\n /** Custom class name */\n className?: string;\n /** Enable field-level validation announcements */\n enableFieldAnnouncements?: boolean;\n}\n\n/**\n * FormLiveRegion component for accessible form validation announcements\n */\nexport function FormLiveRegion<T extends FieldValues>({\n form,\n politeness = 'polite',\n delay = 500,\n successMessage = 'Form submitted successfully',\n className,\n enableFieldAnnouncements = true\n}: FormLiveRegionProps<T>): React.ReactElement {\n const [message, setMessage] = useState<string>('');\n const { formState } = form;\n\n // Handle form-level announcements\n useEffect(() => {\n let timeoutId: NodeJS.Timeout;\n\n if (formState.isSubmitting) {\n setMessage('Submitting form...');\n } else if (formState.isSubmitSuccessful) {\n timeoutId = setTimeout(() => {\n setMessage(successMessage);\n }, delay);\n } else if (formState.errors && Object.keys(formState.errors).length > 0) {\n const errorCount = Object.keys(formState.errors).length;\n const errorFields = Object.keys(formState.errors).join(', ');\n setMessage(`Form has ${errorCount} error${errorCount === 1 ? '' : 's'} in: ${errorFields}`);\n } else if (formState.isValid && formState.isDirty) {\n setMessage('Form is valid');\n } else {\n setMessage('');\n }\n\n return () => {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n };\n }, [formState, delay, successMessage]);\n\n // Handle field-level announcements\n useEffect(() => {\n if (!enableFieldAnnouncements) return;\n\n let timeoutId: NodeJS.Timeout;\n \n const fieldErrors = formState.errors;\n const touchedFields = formState.touchedFields;\n \n // Find newly touched fields with errors\n const newErrors = Object.keys(fieldErrors).filter(field => {\n // Type-safe access to touchedFields\n const touchedField = touchedFields as Record<string, boolean>;\n return touchedField[field] && fieldErrors[field as keyof typeof fieldErrors];\n });\n\n if (newErrors.length > 0) {\n timeoutId = setTimeout(() => {\n const errorField = newErrors[0];\n const errorData = fieldErrors[errorField as keyof typeof fieldErrors];\n const errorMessage = errorData?.message;\n if (errorMessage) {\n setMessage(`${errorField}: ${errorMessage}`);\n }\n }, delay);\n }\n\n return () => {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n };\n }, [formState.errors, formState.touchedFields, enableFieldAnnouncements, delay]);\n\n if (!message) {\n return <></>;\n }\n\n return (\n <div\n role=\"status\"\n aria-live={politeness}\n aria-atomic=\"true\"\n className={cn('sr-only', className)}\n style={{\n position: 'absolute',\n left: '-10000px',\n width: '1px',\n height: '1px',\n overflow: 'hidden'\n }}\n >\n {message}\n </div>\n );\n}\n","/**\n * @file FormFieldset Component\n * @package @jmruthers/pace-core\n * @module Components/Form\n * @since 0.1.0\n *\n * A form fieldset component that groups related form fields together with a legend\n * and optional description. Provides semantic structure and accessibility for form sections.\n *\n * Features:\n * - Semantic fieldset grouping for related form fields\n * - Accessible legend with required indicator\n * - Optional description text with proper ARIA association\n * - Consistent styling with design system\n * - Forwarded ref support\n * - Customizable styling via className\n * - Required field indication\n * - Responsive design\n *\n * @example\n * ```tsx\n * // Basic fieldset\n * <FormFieldset legend=\"Personal Information\">\n * <FormField name=\"firstName\" label=\"First Name\" />\n * <FormField name=\"lastName\" label=\"Last Name\" />\n * <FormField name=\"email\" label=\"Email\" />\n * </FormFieldset>\n * \n * // Fieldset with description\n * <FormFieldset \n * legend=\"Contact Details\" \n * description=\"We'll use this information to contact you about your order\"\n * >\n * <FormField name=\"phone\" label=\"Phone Number\" />\n * <FormField name=\"address\" label=\"Address\" />\n * </FormFieldset>\n * \n * // Required fieldset\n * <FormFieldset \n * legend=\"Account Settings\" \n * required={true}\n * description=\"These settings are required for account creation\"\n * >\n * <FormField name=\"username\" label=\"Username\" required />\n * <FormField name=\"password\" label=\"Password\" type=\"password\" required />\n * </FormFieldset>\n * \n * // With custom styling\n * <FormFieldset \n * legend=\"Preferences\"\n * className=\"bg-sec-50 border-sec-200\"\n * >\n * <FormField name=\"newsletter\" label=\"Subscribe to newsletter\" type=\"checkbox\" />\n * <FormField name=\"notifications\" label=\"Enable notifications\" type=\"checkbox\" />\n * </FormFieldset>\n * ```\n *\n * @accessibility\n * - Proper semantic HTML with fieldset and legend\n * - ARIA describedby association for descriptions\n * - Required field indication with asterisk\n * - Screen reader friendly structure\n * - Keyboard navigation support\n * - WCAG 2.1 AA compliant\n *\n * @dependencies\n * - React 18+ - Component framework and hooks\n * - Tailwind CSS - Styling\n * - cn utility - Class name merging\n */\n\nimport React from 'react';\nimport { cn } from '../../utils/cn';\n\nexport interface FormFieldsetProps extends React.FieldsetHTMLAttributes<HTMLFieldSetElement> {\n /** The legend text for the fieldset */\n legend: string;\n /** Optional description text below the legend */\n description?: string;\n /** Whether the fieldset contains required fields */\n required?: boolean;\n /** Form fields to group within the fieldset */\n children: React.ReactNode;\n}\n\n/**\n * FormFieldset component for grouping related form fields\n * \n * This component provides semantic grouping for form fields with proper\n * accessibility support and consistent styling. Use it to organize\n * related form inputs into logical sections.\n * \n * @param props - Component configuration\n * @param props.legend - The legend text for the fieldset\n * @param props.description - Optional description text\n * @param props.required - Whether the fieldset contains required fields\n * @param props.children - Form fields to group\n * @param ref - Forwarded ref to the fieldset element\n * @returns JSX.Element - The rendered fieldset with legend and fields\n */\nexport const FormFieldset = React.forwardRef<HTMLFieldSetElement, FormFieldsetProps>(\n ({ legend, description, required, className, children, ...props }, ref) => {\n const descriptionId = React.useId();\n \n return (\n <fieldset\n ref={ref}\n className={cn(\"space-y-4 border border-input rounded-lg p-4\", className)}\n aria-describedby={description ? descriptionId : undefined}\n {...props}\n >\n <legend className=\"px-2\">\n {legend}\n {required && <span className=\"text-destructive ml-1\">*</span>}\n </legend>\n {description && (\n <p id={descriptionId} className=\"text-muted-foreground\">\n {description}\n </p>\n )}\n {children}\n </fieldset>\n );\n }\n);\n\nFormFieldset.displayName = \"FormFieldset\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA;;;ACkEA,SAAS,gBAAgB,kBAA0C;AAqH3D,SAGI,KAHJ;AAzBD,SAAS,UAGd;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf;AACF,GAAwC;AACtC,QAAM,EAAE,SAAS,WAAW,EAAE,OAAO,EAAE,IAAI,eAA6B;AACxE,QAAM,aAAa,OAAO,IAAI;AAG9B,QAAM,eAAe,cAAc,OAAO,eAAe,YAAY,aAAa,aAC9E,OAAO,WAAW,OAAO,IACzB;AAEJ,SACE,qBAAC,SAAI,WAAW,GAAG,aAAa,SAAS,GACtC;AAAA,aACC,qBAAC,SAAM,SAAS,MACb;AAAA;AAAA,MACA,YAAY,YACX,oBAAC,UAAK,WAAU,yBAAwB,cAAW,YAAW,eAE9D;AAAA,OAEJ;AAAA,IAGF;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA,OAAO;AAAA,QACP,QAAQ,CAAC,EAAE,MAAM,MAAM;AACrB,cAAI,QAAQ;AACV,mBAAO,OAAO,EAAE,MAAM,CAAC;AAAA,UACzB;AAEA,iBACE;AAAA,YAAC;AAAA;AAAA,cACE,GAAG;AAAA,cACJ,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,IACF;AAAA,EACF,GAAG,CAAC,UAAU,QAAQ,UAAU,eAAe,0BAA0B,KAAK,CAAC;AAE/E,MAAI,CAAC,SAAS;AACZ,WAAO,gBAAAA,KAAA,YAAE;AAAA,EACX;AAEA,SACE,gBAAAA;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL,aAAW;AAAA,MACX,eAAY;AAAA,MACZ,WAAW,GAAG,WAAW,SAAS;AAAA,MAClC,OAAO;AAAA,QACL,UAAU;AAAA,QACV,MAAM;AAAA,QACN,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,UAAU;AAAA,MACZ;AAAA,MAEC;AAAA;AAAA,EACH;AAEJ;;;AC9HA,OAAOC,YAAW;AAwCV,SAEe,OAAAC,MAFf,QAAAC,aAAA;AAXD,IAAM,eAAeC,OAAM;AAAA,EAChC,CAAC,EAAE,QAAQ,aAAa,UAAU,WAAW,UAAU,GAAG,MAAM,GAAG,QAAQ;AACzE,UAAM,gBAAgBA,OAAM,MAAM;AAElC,WACE,gBAAAD;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,WAAW,GAAG,gDAAgD,SAAS;AAAA,QACvE,oBAAkB,cAAc,gBAAgB;AAAA,QAC/C,GAAG;AAAA,QAEJ;AAAA,0BAAAA,MAAC,YAAO,WAAU,QACf;AAAA;AAAA,YACA,YAAY,gBAAAD,KAAC,UAAK,WAAU,yBAAwB,eAAC;AAAA,aACxD;AAAA,UACC,eACC,gBAAAA,KAAC,OAAE,IAAI,eAAe,WAAU,yBAC7B,uBACH;AAAA,UAED;AAAA;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AAEA,aAAa,cAAc;","names":["jsx","jsxs","jsx","React","jsx","jsxs","React"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/index.ts","../src/components/Form/FormField.tsx","../src/components/Form/FormErrorSummary.tsx","../src/components/Form/FormLiveRegion.tsx","../src/components/Form/FormFieldset.tsx"],"sourcesContent":["/**\n * @file Complete Components Library Export\n * @package @jmruthers/pace-core\n * @module Components\n * @since 0.1.0\n * \n * This file exports ALL components, providers, and utilities in the PACE Core library.\n * Use this import path when you need access to specialized components not included in the main export.\n * \n * @example\n * // Complete library access\n * import { Dialog, NavigationMenu } from '@jmruthers/pace-core/components';\n * \n * // For common components, prefer the main export:\n * import { Button, Card } from '@jmruthers/pace-core';\n */\n\n// ============================================================================\n// AUTHENTICATION & AUTHORIZATION\n// ============================================================================\n\n// Unified auth provider (replaces individual providers)\nexport { UnifiedAuthProvider, useUnifiedAuth } from '../providers/UnifiedAuthProvider';\nexport type { UnifiedAuthProviderProps, UnifiedAuthContextType } from '../providers/UnifiedAuthProvider';\n\n// ============================================================================\n// BASIC UI COMPONENTS\n// ============================================================================\n\nexport { Button } from './Button';\nexport type { ButtonProps } from './Button';\n\nexport { \n Card, \n CardHeader, \n CardFooter, \n CardTitle, \n CardDescription, \n CardContent,\n CardActions\n} from './Card';\nexport type { CardProps, CardActionsProps } from './Card';\n\nexport { Input } from './Input';\nexport type { InputProps } from './Input';\nexport { Label } from './Label';\nexport type { LabelProps } from './Label';\n\nexport { Alert, AlertTitle, AlertDescription } from './Alert';\nexport { Avatar, AvatarImage, AvatarFallback } from './Avatar';\n\nexport { Checkbox } from './Checkbox';\nexport { Switch } from './Switch';\nexport type { SwitchProps } from './Switch';\nexport { Progress } from './Progress/Progress';\n\n// Table components\nexport {\n Table,\n TableHeader,\n TableBody,\n TableCaption,\n TableCell,\n TableFooter,\n TableHead,\n TableRow,\n} from './Table/Table';\n\n// ============================================================================\n// ADVANCED UI COMPONENTS\n// ============================================================================\n\n// Dialog exports\nexport {\n Dialog,\n DialogPortal,\n DialogOverlay,\n DialogTrigger,\n DialogClose,\n DialogContent,\n DialogHeader,\n DialogBody,\n DialogFooter,\n DialogTitle,\n DialogDescription,\n} from './Dialog/Dialog';\nexport type {\n DialogProps,\n DialogTriggerProps,\n DialogContentProps,\n DialogOverlayProps,\n DialogHeaderProps,\n DialogFooterProps,\n DialogTitleProps,\n DialogDescriptionProps,\n DialogSize\n} from './Dialog/Dialog';\n\n// Dropdown Menu exports\n// DropdownMenu components have been merged into Select components\n\n// Select exports (includes all dropdown functionality)\nexport {\n Select,\n SelectGroup,\n SelectValue,\n SelectTrigger,\n SelectContent,\n SelectLabel,\n SelectItem,\n SelectSeparator,\n} from './Select';\n\n// Toast exports\nexport {\n Toast,\n Toaster,\n ToastAction,\n ToastProvider,\n ToastViewport,\n ToastTitle,\n ToastDescription,\n ToastClose,\n} from './Toast';\nexport type { ToastActionElement, ToastProps } from './Toast';\n\n// Tooltip exports\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider, TooltipRoot } from './Tooltip';\n\n// ============================================================================\n// DATA DISPLAY COMPONENTS\n// ============================================================================\n\nexport {\n DataTable,\n type DataTableProps,\n type DataTableColumn,\n type DataTableAction,\n type DataTableToolbarButton,\n type AggregateConfig,\n type EmptyStateConfig,\n type GetRowId\n} from './DataTable';\n\n// Re-export types from DataTable types\nexport type { DataRecord } from './DataTable/types';\n\n// ============================================================================\n// FORM COMPONENTS\n// ============================================================================\n\nexport { \n Form, \n FormField, \n FormErrorSummary, \n FormLiveRegion, \n FormFieldset \n} from './Form';\nexport type { \n FormProps, \n FormFieldProps, \n FormErrorSummaryProps, \n FormLiveRegionProps, \n FormFieldsetProps \n} from './Form';\n\n// LoginForm - ensure it's exported\nexport { LoginForm } from './LoginForm';\nexport type { LoginFormProps } from './LoginForm';\n\n// ============================================================================\n// LAYOUT COMPONENTS\n// ============================================================================\n\nexport { Header } from './Header';\nexport { Footer } from './Footer';\nexport type { FooterProps } from './Footer';\n\n// Public Layout Components\nexport * from './PublicLayout';\n\n// ============================================================================\n// SECURITY COMPONENTS\n// ============================================================================\n\nexport { ProtectedRoute } from './ProtectedRoute';\nexport type { ProtectedRouteProps } from './ProtectedRoute';\n\n// ============================================================================\n// NAVIGATION COMPONENTS\n// ============================================================================\n\nexport {\n NavigationMenu,\n} from './NavigationMenu';\nexport type { NavigationMenuProps, NavigationItem } from './NavigationMenu';\n\nexport { OrganisationSelector } from './OrganisationSelector';\nexport type { OrganisationSelectorProps } from './OrganisationSelector';\n\nexport { UserMenu } from './UserMenu';\n\n// Reusable Page/Layout Components\nexport * from './PaceAppLayout';\nexport * from './PaceLoginPage';\n\n// ============================================================================\n// UTILITY COMPONENTS\n// ============================================================================\n\nexport { ErrorBoundary } from './ErrorBoundary';\nexport type { ErrorBoundaryProps, ErrorBoundaryState } from './ErrorBoundary';\nexport { LoadingSpinner } from './LoadingSpinner';\nexport { SessionRestorationLoader } from './SessionRestorationLoader';\n\n// ============================================================================\n// EVENT MANAGEMENT\n// ============================================================================\n\nexport { EventSelector } from './EventSelector';\n\n// ============================================================================\n// AUTHENTICATION FORMS\n// ============================================================================\n\n// Password Component exports\nexport { PasswordResetForm } from './PasswordReset';\n\n// ============================================================================\n// STORAGE COMPONENTS\n// ============================================================================\n\nexport { FileUpload } from './FileUpload';\nexport type { FileUploadProps } from './FileUpload';\n\nexport { FileDisplay } from './FileDisplay';\nexport type { FileDisplayProps } from './FileDisplay';\n\n\n// ============================================================================\n// TYPES\n// ============================================================================\n\nexport { FileCategory } from '../types/file-reference';\nexport type { FileReference, FileMetadata, FileUploadOptions } from '../types/file-reference';\n\n// ============================================================================\n// HOOKS\n// ============================================================================\n\n\nexport { \n useFileReference, \n useFileReferenceForRecord,\n useFileReferenceById,\n useFilesByCategory\n} from '../hooks/useFileReference';\nexport type { \n UseFileReferenceOptions, \n UseFileReferenceReturn, \n UseFileReferenceForRecordReturn \n} from '../hooks/useFileReference';\n\nexport { useToast } from '../hooks/useToast';\n\n// RBAC Components - Use the new RBAC system\n// For RBAC functionality, import from @jmruthers/pace-core/rbac\n// export { PermissionGuard, AccessLevelGuard } from '@jmruthers/pace-core/rbac';\n","/**\n * @file FormField Component\n * @package @jmruthers/pace-core\n * @module Components/Form\n * @since 0.1.0\n *\n * A flexible form field component that integrates with React Hook Form and provides\n * built-in validation, error handling, and accessibility features.\n *\n * Features:\n * - React Hook Form integration with Controller\n * - Built-in validation with error display\n * - Accessible labels and error messages\n * - Custom render function support\n * - TypeScript support with generic field paths\n * - Consistent styling with error states\n * - Test ID support for testing\n * - Flexible input types and props\n *\n * @example\n * ```tsx\n * // Basic text field\n * <FormField\n * name=\"username\"\n * label=\"Username\"\n * placeholder=\"Enter your username\"\n * validation={{ required: true }}\n * />\n * \n * // Email field with custom validation\n * <FormField\n * name=\"email\"\n * label=\"Email Address\"\n * type=\"email\"\n * validation={{\n * required: true,\n * pattern: {\n * value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,}$/i,\n * message: \"Invalid email address\"\n * }\n * }}\n * />\n * \n * // Custom render function\n * <FormField\n * name=\"avatar\"\n * label=\"Profile Picture\"\n * render={({ field }) => (\n * <input\n * {...field}\n * type=\"file\"\n * accept=\"image/*\"\n * className=\"file:mr-4 file:py-2 file:px-4 file:rounded-full file:border-0 file:text-sm file:font-semibold file:bg-sec-50 file:text-sec-700 hover:file:bg-sec-100\"\n * />\n * )}\n * />\n * \n * // With test ID for testing\n * <FormField\n * name=\"password\"\n * label=\"Password\"\n * type=\"password\"\n * data-testid=\"password-field\"\n * validation={{\n * required: true,\n * minLength: {\n * value: 8,\n * message: \"Password must be at least 8 characters\"\n * }\n * }}\n * />\n * ```\n *\n * @accessibility\n * - Proper label association with htmlFor\n * - Error messages with role=\"alert\"\n * - Required field indicators\n * - Focus management\n * - Screen reader friendly error announcements\n * - Keyboard navigation support\n *\n * @dependencies\n * - react-hook-form - Form integration\n * - React 18+ - Hooks and context\n * - Tailwind CSS - Styling\n */\n\nimport React from 'react';\nimport { useFormContext, Controller, FieldPath, FieldValues } from 'react-hook-form';\nimport { cn } from '../../utils/cn';\nimport { Label } from '../Label';\n\nexport interface FormFieldProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n> {\n /**\n * Field name\n */\n name: TName;\n \n /**\n * Field label\n */\n label?: string;\n \n /**\n * Field type\n */\n type?: string;\n \n /**\n * Placeholder text\n */\n placeholder?: string;\n \n /**\n * Additional props for the input\n */\n inputProps?: React.InputHTMLAttributes<HTMLInputElement>;\n \n /**\n * Validation rules\n */\n validation?: {\n required?: boolean;\n pattern?: {\n value: RegExp;\n message: string;\n };\n minLength?: {\n value: number;\n message: string;\n };\n maxLength?: {\n value: number;\n message: string;\n };\n };\n \n /**\n * Custom render function\n */\n render?: ({ field }: { field: any }) => React.ReactElement;\n \n /**\n * Test ID\n */\n 'data-testid'?: string;\n \n /**\n * Class name\n */\n className?: string;\n}\n\n/**\n * FormField component for React Hook Form integration\n * \n * @template TFieldValues - The type of form field values\n * @template TName - The type of the field name (must be a valid field path)\n * @param props - Form field configuration and validation\n * @returns JSX.Element - The rendered form field with validation\n * \n * @example\n * ```tsx\n * <FormField\n * name=\"email\"\n * label=\"Email\"\n * type=\"email\"\n * validation={{\n * required: true,\n * pattern: {\n * value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,}$/i,\n * message: \"Please enter a valid email address\"\n * }\n * }}\n * />\n * ```\n */\nexport function FormField<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n>({\n name,\n label,\n type = \"text\",\n placeholder,\n inputProps,\n validation,\n render,\n 'data-testid': testId,\n className,\n}: FormFieldProps<TFieldValues, TName>) {\n const { control, formState: { errors } } = useFormContext<TFieldValues>();\n const fieldError = errors[name];\n\n // Safely extract error message\n const errorMessage = fieldError && typeof fieldError === 'object' && 'message' in fieldError \n ? String(fieldError.message) \n : undefined;\n\n return (\n <div className={cn(\"space-y-2\", className)}>\n {label && (\n <Label htmlFor={name}>\n {label}\n {validation?.required && (\n <span className=\"text-destructive ml-1\" aria-label=\"required\">\n *\n </span>\n )}\n </Label>\n )}\n \n <Controller\n name={name}\n control={control}\n rules={validation}\n render={({ field }) => {\n if (render) {\n return render({ field });\n }\n \n return (\n <input\n {...field}\n id={name}\n type={type}\n placeholder={placeholder}\n data-testid={testId}\n className={cn(\n \"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50\",\n fieldError && \"border-destructive focus-visible:ring-destructive\"\n )}\n {...inputProps}\n />\n );\n }}\n />\n \n {errorMessage && (\n <p className=\"text-destructive\" role=\"alert\">\n {errorMessage}\n </p>\n )}\n </div>\n );\n}\n","\n/**\n * @file FormErrorSummary Component\n * @package @jmruthers/pace-core\n * @module Components/Form\n * @since 0.1.0\n *\n * A form error summary component that displays validation errors in a user-friendly format.\n * Provides a centralized location for users to see all form errors at once.\n *\n * Features:\n * - Displays all form errors in one place\n * - Configurable error display format\n * - Optional field name display\n * - Accessible error presentation\n * - Consistent styling with Alert component\n * - Automatic error filtering\n * - Responsive design\n *\n * @example\n * ```tsx\n * // Basic error summary\n * <FormErrorSummary errors={formErrors} />\n * \n * // With custom title\n * <FormErrorSummary \n * errors={formErrors}\n * title=\"Please correct the following issues:\"\n * />\n * \n * // Show field names with errors\n * <FormErrorSummary \n * errors={formErrors}\n * showFieldNames={true}\n * />\n * \n * // In a form with React Hook Form\n * const { formState: { errors } } = useForm();\n * \n * <Form onSubmit={handleSubmit}>\n * <FormField name=\"email\" label=\"Email\" />\n * <FormField name=\"password\" label=\"Password\" />\n * <FormErrorSummary errors={errors} />\n * <Button type=\"submit\">Submit</Button>\n * </Form>\n * ```\n *\n * @accessibility\n * - Uses Alert component for consistent accessibility\n * - Proper heading hierarchy with h3\n * - List structure for error items\n * - Screen reader friendly error announcements\n * - High contrast support via Alert component\n *\n * @dependencies\n * - Alert component for consistent styling\n * - React 18+ - Component framework\n * - Tailwind CSS - Styling\n */\n\nimport { Alert } from '../Alert';\n\nexport interface FormErrorSummaryProps {\n /** Form validation errors object */\n errors?: Record<string, any>;\n /** Title displayed above the error list */\n title?: string;\n /** Whether to show field names alongside error messages */\n showFieldNames?: boolean;\n}\n\n/**\n * FormErrorSummary component for displaying form validation errors\n * \n * This component provides a user-friendly way to display all form errors\n * in one centralized location, improving the user experience by making\n * it clear what needs to be fixed.\n * \n * @param props - Component configuration\n * @param props.errors - Form validation errors object\n * @param props.title - Title displayed above the error list\n * @param props.showFieldNames - Whether to show field names with errors\n * @returns JSX.Element - The rendered error summary or null if no errors\n */\nexport function FormErrorSummary({ \n errors = {}, \n title = \"Please fix the following errors:\",\n showFieldNames = false \n}: FormErrorSummaryProps) {\n const errorEntries = Object.entries(errors).filter(([, value]) => Boolean(value));\n\n if (errorEntries.length === 0) {\n return null;\n }\n\n return (\n <Alert variant=\"destructive\" className=\"mb-4\">\n <div>\n <h3>{title}</h3>\n <ul className=\"list-disc list-inside space-y-1\">\n {errorEntries.map(([field, error], index) => {\n const message = typeof error === 'object' && error.message ? error.message : String(error);\n return (\n <li key={index} className=\"text-sm\">\n {showFieldNames ? `${field}: ${message}` : message}\n </li>\n );\n })}\n </ul>\n </div>\n </Alert>\n );\n}\n","/**\n * @file FormLiveRegion Component\n * @package @jmruthers/pace-core\n * @module Components/Form\n * @since 0.1.0\n *\n * An accessible live region component for form validation announcements.\n * Provides real-time feedback to screen readers about form validation states\n * and error messages, improving accessibility for users with assistive technologies.\n *\n * Features:\n * - Real-time form validation announcements\n * - Configurable politeness levels (polite/assertive)\n * - Customizable delay timing\n * - Field-level and form-level announcements\n * - Success message customization\n * - Automatic error counting and field identification\n * - Accessibility compliant with ARIA live regions\n * - Integration with React Hook Form\n *\n * @example\n * ```tsx\n * // Basic live region\n * const { control, formState } = useForm();\n * \n * <Form onSubmit={handleSubmit}>\n * <FormField name=\"email\" label=\"Email\" />\n * <FormField name=\"password\" label=\"Password\" />\n * <FormLiveRegion form={{ control, formState }} />\n * <Button type=\"submit\">Submit</Button>\n * </Form>\n * \n * // With custom configuration\n * <FormLiveRegion\n * form={{ control, formState }}\n * politeness=\"assertive\"\n * delay={1000}\n * successMessage=\"Your form was submitted successfully!\"\n * enableFieldAnnouncements={true}\n * />\n * \n * // In a complex form\n * function ComplexForm() {\n * const methods = useForm({\n * defaultValues: { name: '', email: '', message: '' }\n * });\n * \n * return (\n * <FormProvider {...methods}>\n * <form onSubmit={methods.handleSubmit(onSubmit)}>\n * <FormField name=\"name\" label=\"Name\" />\n * <FormField name=\"email\" label=\"Email\" />\n * <FormField name=\"message\" label=\"Message\" />\n * <FormLiveRegion \n * form={methods}\n * politeness=\"polite\"\n * delay={300}\n * />\n * <Button type=\"submit\">Send Message</Button>\n * </form>\n * </FormProvider>\n * );\n * }\n * ```\n *\n * @accessibility\n * - ARIA live region for screen reader announcements\n * - Configurable politeness levels for different message types\n * - Automatic error counting and field identification\n * - Non-intrusive validation feedback\n * - WCAG 2.1 AA compliant\n * - Screen reader friendly error announcements\n *\n * @dependencies\n * - react-hook-form - Form state management\n * - React 18+ - Hooks and effects\n * - Tailwind CSS - Styling\n */\n\nimport React, { useEffect, useState } from 'react';\nimport { UseFormReturn, FieldValues } from 'react-hook-form';\nimport { cn } from '../../utils/cn';\n\n/**\n * Props for the FormLiveRegion component\n */\nexport interface FormLiveRegionProps<T extends FieldValues> {\n /** React Hook Form instance */\n form: UseFormReturn<T>;\n /** ARIA live region politeness level */\n politeness?: 'polite' | 'assertive';\n /** Delay before announcing messages (in ms) */\n delay?: number;\n /** Custom success message */\n successMessage?: string;\n /** Custom class name */\n className?: string;\n /** Enable field-level validation announcements */\n enableFieldAnnouncements?: boolean;\n}\n\n/**\n * FormLiveRegion component for accessible form validation announcements\n */\nexport function FormLiveRegion<T extends FieldValues>({\n form,\n politeness = 'polite',\n delay = 500,\n successMessage = 'Form submitted successfully',\n className,\n enableFieldAnnouncements = true\n}: FormLiveRegionProps<T>): React.ReactElement {\n const [message, setMessage] = useState<string>('');\n const { formState } = form;\n\n // Handle form-level announcements\n useEffect(() => {\n let timeoutId: NodeJS.Timeout;\n\n if (formState.isSubmitting) {\n setMessage('Submitting form...');\n } else if (formState.isSubmitSuccessful) {\n timeoutId = setTimeout(() => {\n setMessage(successMessage);\n }, delay);\n } else if (formState.errors && Object.keys(formState.errors).length > 0) {\n const errorCount = Object.keys(formState.errors).length;\n const errorFields = Object.keys(formState.errors).join(', ');\n setMessage(`Form has ${errorCount} error${errorCount === 1 ? '' : 's'} in: ${errorFields}`);\n } else if (formState.isValid && formState.isDirty) {\n setMessage('Form is valid');\n } else {\n setMessage('');\n }\n\n return () => {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n };\n }, [formState, delay, successMessage]);\n\n // Handle field-level announcements\n useEffect(() => {\n if (!enableFieldAnnouncements) return;\n\n let timeoutId: NodeJS.Timeout;\n \n const fieldErrors = formState.errors;\n const touchedFields = formState.touchedFields;\n \n // Find newly touched fields with errors\n const newErrors = Object.keys(fieldErrors).filter(field => {\n // Type-safe access to touchedFields\n const touchedField = touchedFields as Record<string, boolean>;\n return touchedField[field] && fieldErrors[field as keyof typeof fieldErrors];\n });\n\n if (newErrors.length > 0) {\n timeoutId = setTimeout(() => {\n const errorField = newErrors[0];\n const errorData = fieldErrors[errorField as keyof typeof fieldErrors];\n const errorMessage = errorData?.message;\n if (errorMessage) {\n setMessage(`${errorField}: ${errorMessage}`);\n }\n }, delay);\n }\n\n return () => {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n };\n }, [formState.errors, formState.touchedFields, enableFieldAnnouncements, delay]);\n\n if (!message) {\n return <></>;\n }\n\n return (\n <div\n role=\"status\"\n aria-live={politeness}\n aria-atomic=\"true\"\n className={cn('sr-only', className)}\n style={{\n position: 'absolute',\n left: '-10000px',\n width: '1px',\n height: '1px',\n overflow: 'hidden'\n }}\n >\n {message}\n </div>\n );\n}\n","/**\n * @file FormFieldset Component\n * @package @jmruthers/pace-core\n * @module Components/Form\n * @since 0.1.0\n *\n * A form fieldset component that groups related form fields together with a legend\n * and optional description. Provides semantic structure and accessibility for form sections.\n *\n * Features:\n * - Semantic fieldset grouping for related form fields\n * - Accessible legend with required indicator\n * - Optional description text with proper ARIA association\n * - Consistent styling with design system\n * - Forwarded ref support\n * - Customizable styling via className\n * - Required field indication\n * - Responsive design\n *\n * @example\n * ```tsx\n * // Basic fieldset\n * <FormFieldset legend=\"Personal Information\">\n * <FormField name=\"firstName\" label=\"First Name\" />\n * <FormField name=\"lastName\" label=\"Last Name\" />\n * <FormField name=\"email\" label=\"Email\" />\n * </FormFieldset>\n * \n * // Fieldset with description\n * <FormFieldset \n * legend=\"Contact Details\" \n * description=\"We'll use this information to contact you about your order\"\n * >\n * <FormField name=\"phone\" label=\"Phone Number\" />\n * <FormField name=\"address\" label=\"Address\" />\n * </FormFieldset>\n * \n * // Required fieldset\n * <FormFieldset \n * legend=\"Account Settings\" \n * required={true}\n * description=\"These settings are required for account creation\"\n * >\n * <FormField name=\"username\" label=\"Username\" required />\n * <FormField name=\"password\" label=\"Password\" type=\"password\" required />\n * </FormFieldset>\n * \n * // With custom styling\n * <FormFieldset \n * legend=\"Preferences\"\n * className=\"bg-sec-50 border-sec-200\"\n * >\n * <FormField name=\"newsletter\" label=\"Subscribe to newsletter\" type=\"checkbox\" />\n * <FormField name=\"notifications\" label=\"Enable notifications\" type=\"checkbox\" />\n * </FormFieldset>\n * ```\n *\n * @accessibility\n * - Proper semantic HTML with fieldset and legend\n * - ARIA describedby association for descriptions\n * - Required field indication with asterisk\n * - Screen reader friendly structure\n * - Keyboard navigation support\n * - WCAG 2.1 AA compliant\n *\n * @dependencies\n * - React 18+ - Component framework and hooks\n * - Tailwind CSS - Styling\n * - cn utility - Class name merging\n */\n\nimport React from 'react';\nimport { cn } from '../../utils/cn';\n\nexport interface FormFieldsetProps extends React.FieldsetHTMLAttributes<HTMLFieldSetElement> {\n /** The legend text for the fieldset */\n legend: string;\n /** Optional description text below the legend */\n description?: string;\n /** Whether the fieldset contains required fields */\n required?: boolean;\n /** Form fields to group within the fieldset */\n children: React.ReactNode;\n}\n\n/**\n * FormFieldset component for grouping related form fields\n * \n * This component provides semantic grouping for form fields with proper\n * accessibility support and consistent styling. Use it to organize\n * related form inputs into logical sections.\n * \n * @param props - Component configuration\n * @param props.legend - The legend text for the fieldset\n * @param props.description - Optional description text\n * @param props.required - Whether the fieldset contains required fields\n * @param props.children - Form fields to group\n * @param ref - Forwarded ref to the fieldset element\n * @returns JSX.Element - The rendered fieldset with legend and fields\n */\nexport const FormFieldset = React.forwardRef<HTMLFieldSetElement, FormFieldsetProps>(\n ({ legend, description, required, className, children, ...props }, ref) => {\n const descriptionId = React.useId();\n \n return (\n <fieldset\n ref={ref}\n className={cn(\"space-y-4 border border-input rounded-lg p-4\", className)}\n aria-describedby={description ? descriptionId : undefined}\n {...props}\n >\n <legend className=\"px-2\">\n {legend}\n {required && <span className=\"text-destructive ml-1\">*</span>}\n </legend>\n {description && (\n <p id={descriptionId} className=\"text-muted-foreground\">\n {description}\n </p>\n )}\n {children}\n </fieldset>\n );\n }\n);\n\nFormFieldset.displayName = \"FormFieldset\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA;;;ACkEA,SAAS,gBAAgB,kBAA0C;AAqH3D,SAGI,KAHJ;AAzBD,SAAS,UAGd;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf;AACF,GAAwC;AACtC,QAAM,EAAE,SAAS,WAAW,EAAE,OAAO,EAAE,IAAI,eAA6B;AACxE,QAAM,aAAa,OAAO,IAAI;AAG9B,QAAM,eAAe,cAAc,OAAO,eAAe,YAAY,aAAa,aAC9E,OAAO,WAAW,OAAO,IACzB;AAEJ,SACE,qBAAC,SAAI,WAAW,GAAG,aAAa,SAAS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wB,eAAC;AAAA,aACxD;AAAA,UACC,eACC,gBAAAA,KAAC,OAAE,IAAI,eAAe,WAAU,yBAC7B,uBACH;AAAA,UAED;AAAA;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AAEA,aAAa,cAAc;","names":["jsx","jsxs","jsx","React","jsx","jsxs","React"]}
|
package/dist/hooks.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { u as useToast } from './useToast-
|
|
1
|
+
export { u as useToast } from './useToast-Cs_g32bg.js';
|
|
2
2
|
export { O as OrganisationSecurityHook, d as UseAppConfigReturn, U as UseOrganisationPermissionsReturn, p as UsePublicEventOptions, o as UsePublicEventReturn, r as UsePublicFileDisplayOptions, q as UsePublicFileDisplayReturn, s as UsePublicRouteParamsReturn, f as clearPublicEventCache, i as clearPublicFileDisplayCache, n as extractEventCodeFromPath, m as generatePublicRoutePath, g as getPublicEventCacheStats, j as getPublicFileDisplayCacheStats, c as useAppConfig, u as useEventTheme, a as useOrganisationPermissions, b as useOrganisationSecurity, e as usePublicEvent, l as usePublicEventCode, h as usePublicFileDisplay, k as usePublicRouteParams } from './usePublicRouteParams-BdF8bZgs.js';
|
|
3
3
|
import * as React$1 from 'react';
|
|
4
4
|
import { SortingState, ColumnFiltersState, ExpandedState } from '@tanstack/react-table';
|
package/dist/hooks.js
CHANGED
|
@@ -3,16 +3,15 @@ import {
|
|
|
3
3
|
extractEventCodeFromPath,
|
|
4
4
|
generatePublicRoutePath,
|
|
5
5
|
getPublicEventCacheStats,
|
|
6
|
-
useEventTheme,
|
|
7
6
|
useOrganisationPermissions,
|
|
8
7
|
useOrganisationSecurity,
|
|
9
8
|
usePublicEvent,
|
|
10
9
|
usePublicEventCode,
|
|
11
10
|
usePublicRouteParams
|
|
12
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-ECOVPXYS.js";
|
|
13
12
|
import {
|
|
14
13
|
useSecureDataAccess
|
|
15
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-XN2LYHDI.js";
|
|
16
15
|
import {
|
|
17
16
|
clearFileDisplayCache,
|
|
18
17
|
clearPublicFileDisplayCache,
|
|
@@ -20,17 +19,18 @@ import {
|
|
|
20
19
|
getPublicFileDisplayCacheStats,
|
|
21
20
|
invalidateFileDisplayCache,
|
|
22
21
|
useAppConfig,
|
|
22
|
+
useEventTheme,
|
|
23
23
|
useFileDisplay,
|
|
24
24
|
usePublicFileDisplay
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-P3PUOL6B.js";
|
|
26
26
|
import {
|
|
27
27
|
useDataTablePerformance,
|
|
28
28
|
useToast
|
|
29
|
-
} from "./chunk-
|
|
30
|
-
import "./chunk-
|
|
31
|
-
import "./chunk-
|
|
32
|
-
import "./chunk-
|
|
33
|
-
import "./chunk-
|
|
29
|
+
} from "./chunk-2GJ5GL77.js";
|
|
30
|
+
import "./chunk-LFS45U62.js";
|
|
31
|
+
import "./chunk-VN3OOE35.js";
|
|
32
|
+
import "./chunk-O3FTRYEU.js";
|
|
33
|
+
import "./chunk-KA3PSVNV.js";
|
|
34
34
|
import {
|
|
35
35
|
useComponentPerformance
|
|
36
36
|
} from "./chunk-66C4BSAY.js";
|
|
@@ -39,6 +39,7 @@ import {
|
|
|
39
39
|
performanceBudgetMonitor
|
|
40
40
|
} from "./chunk-O3NWNXDY.js";
|
|
41
41
|
import "./chunk-BDZUMRBD.js";
|
|
42
|
+
import "./chunk-UJI6WSMD.js";
|
|
42
43
|
import "./chunk-SMJZMKYN.js";
|
|
43
44
|
import "./chunk-PLDDJCW6.js";
|
|
44
45
|
|