@jmruthers/pace-core 0.5.87 → 0.5.89
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-Df3IozMG.d.ts → AuthService-DcTI5Ov4.d.ts} +9 -0
- package/dist/{DataTable-FA6EUX5M.js → DataTable-PWBMKMOG.js} +7 -7
- package/dist/{PublicLoadingSpinner-DecuJBX0.d.ts → PublicLoadingSpinner-BQXD1fbO.d.ts} +160 -130
- package/dist/{UnifiedAuthProvider-K2IZAY5F.js → UnifiedAuthProvider-5D3HEQND.js} +4 -4
- package/dist/{UnifiedAuthProvider-B391Aqum.d.ts → UnifiedAuthProvider-BVKmQd9u.d.ts} +4 -0
- package/dist/auth-DReDSLq9.d.ts +16 -0
- package/dist/{chunk-CBSD3BZ3.js → chunk-3RZBKQ5Y.js} +2 -6
- package/dist/{chunk-CBSD3BZ3.js.map → chunk-3RZBKQ5Y.js.map} +1 -1
- package/dist/{chunk-NTW3KGS4.js → chunk-6UHXQH7P.js} +5 -5
- package/dist/{chunk-ZFLOV3OM.js → chunk-7VJDS5QD.js} +401 -16
- package/dist/chunk-7VJDS5QD.js.map +1 -0
- package/dist/{chunk-YVUZWLQG.js → chunk-AQGF5OG7.js} +3 -3
- package/dist/{chunk-CVMVPYAL.js → chunk-BDZUMRBD.js} +3 -5
- package/dist/chunk-BDZUMRBD.js.map +1 -0
- package/dist/{chunk-KAY3K5TP.js → chunk-BNXBJOGL.js} +4 -4
- package/dist/{chunk-S3JKDMD5.js → chunk-CXKMRKRF.js} +4 -4
- package/dist/{chunk-5BN3YGNK.js → chunk-DP5X5ORK.js} +217 -27
- package/dist/chunk-DP5X5ORK.js.map +1 -0
- package/dist/{chunk-RIXPZJUB.js → chunk-KTPG5VCH.js} +2 -2
- package/dist/{chunk-2FQEQUJT.js → chunk-KWICIQVK.js} +4 -4
- package/dist/{chunk-WUXCWRL6.js → chunk-XJ2HZOBU.js} +6 -1
- package/dist/chunk-XJ2HZOBU.js.map +1 -0
- package/dist/{chunk-I7O3RSMN.js → chunk-YWAFPVJA.js} +1298 -769
- package/dist/chunk-YWAFPVJA.js.map +1 -0
- package/dist/{chunk-I2VVV5PQ.js → chunk-YY4YYM3E.js} +2 -2
- package/dist/components.d.ts +6 -55
- package/dist/components.js +24 -205
- package/dist/components.js.map +1 -1
- package/dist/{file-reference-9xUOnwyt.d.ts → file-reference-C9isKNPn.d.ts} +67 -2
- package/dist/hooks.js +9 -8
- package/dist/hooks.js.map +1 -1
- package/dist/index.d.ts +152 -26
- package/dist/index.js +64 -194
- package/dist/index.js.map +1 -1
- package/dist/providers.d.ts +5 -3
- package/dist/providers.js +3 -3
- package/dist/rbac/index.js +8 -8
- package/dist/types.d.ts +2 -1
- package/dist/types.js +3 -3
- package/dist/utils.js +2 -2
- package/docs/DOCUMENTATION_AUDIT.md +6 -6
- package/docs/DOCUMENTATION_STANDARD.md +137 -0
- package/docs/README.md +1 -1
- 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 +1 -1
- 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 +83 -40
- package/docs/api/enums/FileCategory.md +56 -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/EventLogoProps.md +11 -11
- package/docs/api/interfaces/FileDisplayProps.md +10 -10
- 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 +8 -8
- package/docs/api/interfaces/FileUploadProps.md +137 -42
- package/docs/api/interfaces/FooterProps.md +1 -1
- package/docs/api/interfaces/InactivityWarningModalProps.md +1 -1
- package/docs/api/interfaces/InputProps.md +1 -1
- package/docs/api/interfaces/LabelProps.md +1 -1
- package/docs/api/interfaces/LoginFormProps.md +1 -1
- package/docs/api/interfaces/NavigationAccessRecord.md +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 +1 -1
- package/docs/api/interfaces/PaceLoginPageProps.md +1 -1
- package/docs/api/interfaces/PageAccessRecord.md +1 -1
- package/docs/api/interfaces/PagePermissionContextType.md +1 -1
- package/docs/api/interfaces/PagePermissionGuardProps.md +1 -1
- package/docs/api/interfaces/PagePermissionProviderProps.md +1 -1
- package/docs/api/interfaces/PaletteData.md +1 -1
- package/docs/api/interfaces/PermissionEnforcerProps.md +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/RoleBasedRouterContextType.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterProps.md +1 -1
- 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 +83 -50
- package/docs/api/interfaces/UnifiedAuthProviderProps.md +13 -13
- package/docs/api/interfaces/UseEventLogoOptions.md +74 -0
- package/docs/api/interfaces/UseEventLogoReturn.md +81 -0
- package/docs/api/interfaces/UseInactivityTrackerOptions.md +1 -1
- package/docs/api/interfaces/UseInactivityTrackerReturn.md +1 -1
- package/docs/api/interfaces/UsePublicEventLogoOptions.md +6 -6
- package/docs/api/interfaces/UsePublicEventLogoReturn.md +6 -6
- package/docs/api/interfaces/UsePublicEventOptions.md +1 -1
- package/docs/api/interfaces/UsePublicEventReturn.md +1 -1
- package/docs/api/interfaces/UsePublicRouteParamsReturn.md +1 -1
- package/docs/api/interfaces/UseResolvedScopeOptions.md +1 -1
- package/docs/api/interfaces/UseResolvedScopeReturn.md +1 -1
- package/docs/api/interfaces/UserEventAccess.md +11 -11
- package/docs/api/interfaces/UserMenuProps.md +1 -1
- package/docs/api/interfaces/UserProfile.md +1 -1
- package/docs/api/modules.md +290 -95
- package/docs/api-reference/components.md +1 -18
- package/docs/api-reference/hooks.md +1 -4
- package/docs/best-practices/testing.md +2 -0
- package/docs/documentation-index.md +1 -1
- package/docs/getting-started/faq.md +1 -1
- package/docs/implementation-guides/file-reference-system.md +592 -58
- package/docs/implementation-guides/file-upload-storage.md +137 -73
- package/docs/implementation-guides/public-pages-advanced.md +10 -0
- package/docs/rbac/super-admin-guide.md +18 -70
- package/docs/testing/README.md +2 -0
- package/package.json +1 -1
- package/src/__tests__/TEST_STANDARD.md +674 -0
- package/src/__tests__/helpers/test-utils.tsx +3 -2
- package/src/components/DataTable/__tests__/{DataTable.comprehensive.test.tsx.skip → DataTable.comprehensive.test.tsx} +17 -18
- package/src/components/DataTable/__tests__/{DataTable.test.tsx.skip → DataTable.test.tsx} +14 -22
- package/src/components/DataTable/__tests__/{ssr.strict-mode.test.tsx.skip → ssr.strict-mode.test.tsx} +42 -47
- package/src/components/DataTable/components/__tests__/COVERAGE_NOTE.md +1 -1
- package/src/components/DataTable/examples/__tests__/PerformanceExample.test.tsx +13 -4
- package/src/components/DataTable/utils/__tests__/COVERAGE_NOTE.md +1 -1
- package/src/components/DataTable/utils/__tests__/performanceUtils.test.ts +10 -6
- package/src/components/FileDisplay/FileDisplay.test.tsx +257 -0
- package/src/components/{FileDisplay.tsx → FileDisplay/FileDisplay.tsx} +111 -10
- package/src/components/FileDisplay/index.tsx +4 -0
- package/src/components/FileUpload/FileUpload.test.tsx +171 -621
- package/src/components/FileUpload/FileUpload.tsx +512 -168
- package/src/components/FileUpload/index.tsx +4 -0
- package/src/components/Progress/Progress.test.tsx +38 -0
- package/src/components/PublicLayout/EventLogo.tsx +6 -4
- package/src/components/Select/Select.test.tsx +1 -1
- package/src/components/SessionRestorationLoader.tsx +48 -0
- package/src/components/Toast/Toast.tsx +13 -8
- package/src/components/index.ts +16 -16
- package/src/hooks/__tests__/ServiceHooks.test.tsx +615 -0
- package/src/hooks/public/usePublicEventLogo.ts +16 -20
- package/src/hooks/useEventLogo.ts +316 -0
- package/src/hooks/useEvents.ts +0 -5
- package/src/hooks/useFileReference.test.ts +659 -0
- package/src/hooks/useFileReference.ts +207 -3
- package/src/hooks/useSessionRestoration.ts +64 -0
- package/src/index.ts +17 -5
- package/src/providers/{UnifiedAuthProvider.test.simple.tsx → UnifiedAuthProvider.smoke.test.tsx} +81 -60
- package/src/providers/services/AuthServiceProvider.tsx +27 -3
- package/src/providers/services/UnifiedAuthProvider.tsx +34 -5
- package/src/rbac/{engine.test.simple.ts → RBACEngine.smoke.test.ts} +17 -12
- package/src/services/AuthService.ts +142 -20
- package/src/services/EventService.ts +0 -4
- package/src/types/auth.ts +15 -0
- package/src/types/file-reference.ts +73 -1
- package/src/types/index.ts +1 -0
- package/src/utils/__tests__/organisationContext.unit.test.ts +2 -4
- package/src/utils/appNameResolver.simple.test.ts +99 -29
- package/src/utils/file-reference.test.ts +535 -0
- package/src/utils/file-reference.ts +200 -30
- package/src/utils/organisationContext.test.ts +5 -19
- package/src/utils/organisationContext.ts +3 -5
- package/src/utils/storage/README.md +269 -262
- package/src/utils/storage/config.ts +9 -0
- package/src/utils/storage/helpers.test.ts +735 -0
- package/src/utils/storage/helpers.ts +189 -16
- package/src/utils/storage/index.ts +3 -0
- package/src/validation/__tests__/sanitization.unit.test.ts +1 -1
- package/src/validation/__tests__/schemaUtils.unit.test.ts +1 -1
- package/src/validation/__tests__/user.unit.test.ts +1 -1
- package/dist/chunk-5BN3YGNK.js.map +0 -1
- package/dist/chunk-CVMVPYAL.js.map +0 -1
- package/dist/chunk-I7O3RSMN.js.map +0 -1
- package/dist/chunk-WUXCWRL6.js.map +0 -1
- package/dist/chunk-ZFLOV3OM.js.map +0 -1
- package/docs/CONTENT_AUDIT_REPORT.md +0 -253
- package/docs/STYLE_GUIDE.md +0 -37
- package/examples/RBAC/__tests__/PermissionExample.test.tsx +0 -150
- package/examples/public-pages/__tests__/PublicPageUsageExample.test.tsx +0 -159
- package/src/__tests__/TEST_GUIDE_CURSOR.md +0 -1605
- package/src/__tests__/TEST_GUIDE_HUMAN.md +0 -103
- package/src/components/FileUpload/FileUpload.example.tsx +0 -218
- package/src/components/FileUpload/index.ts +0 -6
- package/src/components/FileUpload.tsx +0 -176
- package/src/components/Progress/index.ts +0 -3
- package/src/components/PublicLayout/__tests__/EventLogo.test.tsx +0 -666
- package/src/components/SuperAdminGuard.tsx +0 -116
- package/src/components/__tests__/FileDisplay.test.tsx +0 -575
- package/src/components/__tests__/FileUpload.test.tsx +0 -446
- package/src/components/__tests__/SuperAdminGuard.test.tsx +0 -627
- package/src/components/examples/PermissionExample.tsx +0 -173
- package/src/hooks/__tests__/usePublicEvent.unit.test.ts +0 -583
- package/src/hooks/__tests__/usePublicEventLogo.unit.test.ts +0 -640
- package/src/types/__tests__/file-reference.test.ts +0 -447
- package/src/utils/__tests__/file-reference.test.ts +0 -383
- /package/dist/{DataTable-FA6EUX5M.js.map → DataTable-PWBMKMOG.js.map} +0 -0
- /package/dist/{UnifiedAuthProvider-K2IZAY5F.js.map → UnifiedAuthProvider-5D3HEQND.js.map} +0 -0
- /package/dist/{chunk-NTW3KGS4.js.map → chunk-6UHXQH7P.js.map} +0 -0
- /package/dist/{chunk-YVUZWLQG.js.map → chunk-AQGF5OG7.js.map} +0 -0
- /package/dist/{chunk-KAY3K5TP.js.map → chunk-BNXBJOGL.js.map} +0 -0
- /package/dist/{chunk-S3JKDMD5.js.map → chunk-CXKMRKRF.js.map} +0 -0
- /package/dist/{chunk-RIXPZJUB.js.map → chunk-KTPG5VCH.js.map} +0 -0
- /package/dist/{chunk-2FQEQUJT.js.map → chunk-KWICIQVK.js.map} +0 -0
- /package/dist/{chunk-I2VVV5PQ.js.map → chunk-YY4YYM3E.js.map} +0 -0
- /package/src/providers/{OrganisationProvider.test.simple.tsx → OrganisationProvider.context.test.tsx} +0 -0
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
init_InactivityServiceProvider,
|
|
5
5
|
init_OrganisationServiceProvider,
|
|
6
6
|
init_UnifiedAuthProvider
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-DP5X5ORK.js";
|
|
8
8
|
|
|
9
9
|
// src/providers/index.ts
|
|
10
10
|
init_UnifiedAuthProvider();
|
|
@@ -12,4 +12,4 @@ init_EventServiceProvider();
|
|
|
12
12
|
init_OrganisationServiceProvider();
|
|
13
13
|
init_InactivityServiceProvider();
|
|
14
14
|
init_AuthServiceProvider();
|
|
15
|
-
//# sourceMappingURL=chunk-
|
|
15
|
+
//# sourceMappingURL=chunk-YY4YYM3E.js.map
|
package/dist/components.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
export { a as UnifiedAuthContextType, c as UnifiedAuthProvider, b as UnifiedAuthProviderProps, u as useUnifiedAuth } from './UnifiedAuthProvider-
|
|
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,
|
|
1
|
+
export { a as UnifiedAuthContextType, c as UnifiedAuthProvider, b as UnifiedAuthProviderProps, u as useUnifiedAuth } from './UnifiedAuthProvider-BVKmQd9u.js';
|
|
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, b9 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, az as ErrorBoundary, aA as ErrorBoundaryProps, aB as ErrorBoundaryState, b4 as EventLogo, b5 as EventLogoCompact, b6 as EventLogoLarge, bg as EventLogoProps, aE as EventSelector, aI as FileDisplay, aJ as FileDisplayProps, aG as FileUpload, aH 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, aC as LoadingSpinner, ao as LoginForm, ap as LoginFormProps, av as NavigationItem, at as NavigationMenu, au as NavigationMenuProps, aw as OrganisationSelector, ax as OrganisationSelectorProps, bl as PaceAppLayout, bk as PaceAppLayoutProps, bn as PaceLoginPage, bm as PaceLoginPageProps, aF as PasswordResetForm, P as Progress, b7 as PublicErrorBoundary, bh as PublicErrorBoundaryProps, bi as PublicErrorBoundaryState, bc as PublicLoadingSkeleton, ba as PublicLoadingSpinner, bb as PublicLoadingSpinnerFullPage, bj as PublicLoadingSpinnerProps, b3 as PublicPageContextChecker, b1 as PublicPageDebugger, b2 as PublicPageDiagnostic, b0 as PublicPageFooter, bf as PublicPageFooterProps, aY as PublicPageHeader, be as PublicPageHeaderProps, aW as PublicPageLayout, bd as PublicPageLayoutProps, aZ 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, aD 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, aV as UseEventLogoOptions, aU as UseEventLogoReturn, aQ as UseFileReferenceForRecordReturn, aO as UseFileReferenceOptions, aP as UseFileReferenceReturn, ay as UserMenu, aS as clearEventLogoCache, aT as getEventLogoCacheStats, b8 as useErrorBoundary, aR as useEventLogo, aK as useFileReference, aM as useFileReferenceById, aL as useFileReferenceForRecord, aN as useFilesByCategory, a$ as useIsPublicPage, aX as usePublicPageContext, a_ as usePublicPageProviderContext } from './PublicLoadingSpinner-BQXD1fbO.js';
|
|
3
3
|
export { u as useToast } from './useToast-Bm6TnSK-.js';
|
|
4
4
|
export { D as DataTable, a as DataTableProps } from './DataTable-BE0OXZKQ.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-BDg1mAGG.js';
|
|
6
6
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
7
7
|
import React__default from 'react';
|
|
8
8
|
import { FieldValues, FieldPath, UseFormReturn } from 'react-hook-form';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
import { SupabaseClient } from '@supabase/supabase-js';
|
|
9
|
+
export { b as FileCategory, a as FileMetadata, F as FileReference, c as FileUploadOptions } from './file-reference-C9isKNPn.js';
|
|
10
|
+
import '@supabase/supabase-js';
|
|
12
11
|
import './organisation-D6qRDtbF.js';
|
|
13
12
|
import './unified-DQ4VcT7H.js';
|
|
13
|
+
import './auth-DReDSLq9.js';
|
|
14
14
|
import '@radix-ui/react-label';
|
|
15
15
|
import '@radix-ui/react-avatar';
|
|
16
16
|
import '@radix-ui/react-checkbox';
|
|
@@ -382,53 +382,4 @@ interface FormFieldsetProps extends React__default.FieldsetHTMLAttributes<HTMLFi
|
|
|
382
382
|
*/
|
|
383
383
|
declare const FormFieldset: React__default.ForwardRefExoticComponent<FormFieldsetProps & React__default.RefAttributes<HTMLFieldSetElement>>;
|
|
384
384
|
|
|
385
|
-
|
|
386
|
-
children: React__default.ReactNode;
|
|
387
|
-
fallback?: React__default.ReactNode;
|
|
388
|
-
showDebugInfo?: boolean;
|
|
389
|
-
}
|
|
390
|
-
/**
|
|
391
|
-
* Super Admin Guard Component
|
|
392
|
-
*
|
|
393
|
-
* Renders children only if the current user is a super admin.
|
|
394
|
-
* Provides a fallback for non-super admin users.
|
|
395
|
-
*
|
|
396
|
-
* @param children - Content to render for super admins
|
|
397
|
-
* @param fallback - Content to render for non-super admins (optional)
|
|
398
|
-
* @param showDebugInfo - Whether to show debug information (optional)
|
|
399
|
-
*/
|
|
400
|
-
declare function SuperAdminGuard({ children, fallback, showDebugInfo }: SuperAdminGuardProps): react_jsx_runtime.JSX.Element;
|
|
401
|
-
/**
|
|
402
|
-
* Super Admin Badge Component
|
|
403
|
-
*
|
|
404
|
-
* Shows a visual indicator when the current user is a super admin.
|
|
405
|
-
*/
|
|
406
|
-
declare function SuperAdminBadge(): react_jsx_runtime.JSX.Element | null;
|
|
407
|
-
/**
|
|
408
|
-
* Super Admin Debug Panel
|
|
409
|
-
*
|
|
410
|
-
* Shows debug information about the current user's permissions.
|
|
411
|
-
* Only visible to super admins and in development mode.
|
|
412
|
-
*/
|
|
413
|
-
declare function SuperAdminDebugPanel(): react_jsx_runtime.JSX.Element | null;
|
|
414
|
-
|
|
415
|
-
interface FileUploadProps {
|
|
416
|
-
supabase: SupabaseClient;
|
|
417
|
-
table_name: string;
|
|
418
|
-
record_id: string;
|
|
419
|
-
organisation_id: string;
|
|
420
|
-
app_id: string;
|
|
421
|
-
category: FileCategory;
|
|
422
|
-
accept?: string;
|
|
423
|
-
maxSize?: number;
|
|
424
|
-
multiple?: boolean;
|
|
425
|
-
disabled?: boolean;
|
|
426
|
-
className?: string;
|
|
427
|
-
onUploadSuccess?: (result: any) => void;
|
|
428
|
-
onUploadError?: (error: string) => void;
|
|
429
|
-
children?: React__default.ReactNode;
|
|
430
|
-
}
|
|
431
|
-
declare function FileUpload({ supabase, table_name, record_id, organisation_id, app_id, category, accept, maxSize, // 10MB default
|
|
432
|
-
multiple, disabled, className, onUploadSuccess, onUploadError, children }: FileUploadProps): react_jsx_runtime.JSX.Element;
|
|
433
|
-
|
|
434
|
-
export { FileCategory, FileUpload, type FileUploadProps, FormErrorSummary, type FormErrorSummaryProps, FormField, type FormFieldProps, FormFieldset, type FormFieldsetProps, FormLiveRegion, type FormLiveRegionProps, SuperAdminBadge, SuperAdminDebugPanel, SuperAdminGuard, type SuperAdminGuardProps };
|
|
385
|
+
export { FormErrorSummary, type FormErrorSummaryProps, FormField, type FormFieldProps, FormFieldset, type FormFieldsetProps, FormLiveRegion, type FormLiveRegionProps };
|
package/dist/components.js
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
EventLogoLarge,
|
|
9
9
|
EventSelector,
|
|
10
10
|
FileDisplay,
|
|
11
|
+
FileUpload,
|
|
11
12
|
Footer,
|
|
12
13
|
Form,
|
|
13
14
|
Header,
|
|
@@ -28,6 +29,7 @@ import {
|
|
|
28
29
|
PublicPageFooter,
|
|
29
30
|
PublicPageHeader,
|
|
30
31
|
PublicPageLayout,
|
|
32
|
+
SessionRestorationLoader,
|
|
31
33
|
Switch,
|
|
32
34
|
Table,
|
|
33
35
|
TableBody,
|
|
@@ -46,12 +48,15 @@ import {
|
|
|
46
48
|
ToastViewport,
|
|
47
49
|
Toaster,
|
|
48
50
|
UserMenu,
|
|
51
|
+
clearEventLogoCache,
|
|
52
|
+
getEventLogoCacheStats,
|
|
53
|
+
useEventLogo,
|
|
49
54
|
useFileReference,
|
|
55
|
+
useFileReferenceById,
|
|
50
56
|
useFileReferenceForRecord,
|
|
51
|
-
|
|
52
|
-
usePublicPageContext as usePublicPageContext2
|
|
53
|
-
|
|
54
|
-
} from "./chunk-I7O3RSMN.js";
|
|
57
|
+
useFilesByCategory,
|
|
58
|
+
usePublicPageContext as usePublicPageContext2
|
|
59
|
+
} from "./chunk-YWAFPVJA.js";
|
|
55
60
|
import {
|
|
56
61
|
Alert,
|
|
57
62
|
AlertDescription,
|
|
@@ -91,10 +96,8 @@ import {
|
|
|
91
96
|
TooltipProvider,
|
|
92
97
|
TooltipRoot,
|
|
93
98
|
TooltipTrigger
|
|
94
|
-
} from "./chunk-
|
|
95
|
-
import
|
|
96
|
-
useRBAC
|
|
97
|
-
} from "./chunk-YVUZWLQG.js";
|
|
99
|
+
} from "./chunk-BNXBJOGL.js";
|
|
100
|
+
import "./chunk-AQGF5OG7.js";
|
|
98
101
|
import "./chunk-S63MFSY6.js";
|
|
99
102
|
import "./chunk-Q7APDV6H.js";
|
|
100
103
|
import {
|
|
@@ -104,22 +107,22 @@ import {
|
|
|
104
107
|
useErrorBoundary,
|
|
105
108
|
useIsPublicPage,
|
|
106
109
|
usePublicPageContext
|
|
107
|
-
} from "./chunk-
|
|
110
|
+
} from "./chunk-7VJDS5QD.js";
|
|
108
111
|
import {
|
|
109
112
|
useToast
|
|
110
113
|
} from "./chunk-QPCAGLUS.js";
|
|
111
|
-
import "./chunk-
|
|
114
|
+
import "./chunk-3RZBKQ5Y.js";
|
|
112
115
|
import {
|
|
113
116
|
init_UnifiedAuthProvider
|
|
114
|
-
} from "./chunk-
|
|
115
|
-
import "./chunk-
|
|
117
|
+
} from "./chunk-KTPG5VCH.js";
|
|
118
|
+
import "./chunk-YY4YYM3E.js";
|
|
116
119
|
import {
|
|
117
120
|
UnifiedAuthProvider,
|
|
118
121
|
useUnifiedAuth
|
|
119
|
-
} from "./chunk-
|
|
122
|
+
} from "./chunk-DP5X5ORK.js";
|
|
120
123
|
import {
|
|
121
124
|
FileCategory
|
|
122
|
-
} from "./chunk-
|
|
125
|
+
} from "./chunk-XJ2HZOBU.js";
|
|
123
126
|
import {
|
|
124
127
|
LoadingSpinner
|
|
125
128
|
} from "./chunk-CDQ3PX7L.js";
|
|
@@ -128,7 +131,7 @@ import {
|
|
|
128
131
|
} from "./chunk-PYUXFQJ3.js";
|
|
129
132
|
import "./chunk-JCQZ6LA7.js";
|
|
130
133
|
import "./chunk-O3NWNXDY.js";
|
|
131
|
-
import "./chunk-
|
|
134
|
+
import "./chunk-BDZUMRBD.js";
|
|
132
135
|
import "./chunk-PLDDJCW6.js";
|
|
133
136
|
|
|
134
137
|
// src/components/index.ts
|
|
@@ -317,191 +320,6 @@ var FormFieldset = React2.forwardRef(
|
|
|
317
320
|
}
|
|
318
321
|
);
|
|
319
322
|
FormFieldset.displayName = "FormFieldset";
|
|
320
|
-
|
|
321
|
-
// src/components/SuperAdminGuard.tsx
|
|
322
|
-
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
323
|
-
function SuperAdminGuard({
|
|
324
|
-
children,
|
|
325
|
-
fallback = null,
|
|
326
|
-
showDebugInfo = false
|
|
327
|
-
}) {
|
|
328
|
-
const { isSuperAdmin, hasGlobalPermission, isLoading } = useRBAC();
|
|
329
|
-
if (isLoading) {
|
|
330
|
-
return /* @__PURE__ */ jsxs4("div", { className: "super-admin-guard-loading", children: [
|
|
331
|
-
/* @__PURE__ */ jsx5("div", { className: "loading-spinner" }),
|
|
332
|
-
/* @__PURE__ */ jsx5("span", { children: "Checking permissions..." })
|
|
333
|
-
] });
|
|
334
|
-
}
|
|
335
|
-
if (showDebugInfo) {
|
|
336
|
-
console.log("[SuperAdminGuard] Debug Info:", {
|
|
337
|
-
isSuperAdmin,
|
|
338
|
-
isLoading
|
|
339
|
-
});
|
|
340
|
-
}
|
|
341
|
-
if (isSuperAdmin) {
|
|
342
|
-
return /* @__PURE__ */ jsx5("div", { className: "super-admin-content", children });
|
|
343
|
-
}
|
|
344
|
-
return /* @__PURE__ */ jsx5("div", { className: "super-admin-fallback", children: fallback });
|
|
345
|
-
}
|
|
346
|
-
function SuperAdminBadge() {
|
|
347
|
-
const { isSuperAdmin } = useRBAC();
|
|
348
|
-
if (!isSuperAdmin) {
|
|
349
|
-
return null;
|
|
350
|
-
}
|
|
351
|
-
return /* @__PURE__ */ jsx5("div", { className: "super-admin-badge", children: /* @__PURE__ */ jsx5("span", { className: "badge-text", children: "SUPER ADMIN" }) });
|
|
352
|
-
}
|
|
353
|
-
function SuperAdminDebugPanel() {
|
|
354
|
-
const { isSuperAdmin, isLoading } = useRBAC();
|
|
355
|
-
if (import.meta.env.MODE !== "development" && !isSuperAdmin) {
|
|
356
|
-
return null;
|
|
357
|
-
}
|
|
358
|
-
return /* @__PURE__ */ jsxs4("div", { className: "super-admin-debug-panel", children: [
|
|
359
|
-
/* @__PURE__ */ jsx5("h4", { children: "Super Admin Debug Info" }),
|
|
360
|
-
/* @__PURE__ */ jsxs4("div", { className: "debug-info", children: [
|
|
361
|
-
/* @__PURE__ */ jsxs4("p", { children: [
|
|
362
|
-
/* @__PURE__ */ jsx5("strong", { children: "Is Super Admin:" }),
|
|
363
|
-
" ",
|
|
364
|
-
isSuperAdmin ? "Yes" : "No"
|
|
365
|
-
] }),
|
|
366
|
-
/* @__PURE__ */ jsxs4("p", { children: [
|
|
367
|
-
/* @__PURE__ */ jsx5("strong", { children: "Is Loading:" }),
|
|
368
|
-
" ",
|
|
369
|
-
isLoading ? "Yes" : "No"
|
|
370
|
-
] }),
|
|
371
|
-
/* @__PURE__ */ jsxs4("p", { children: [
|
|
372
|
-
/* @__PURE__ */ jsx5("strong", { children: "Environment:" }),
|
|
373
|
-
" ",
|
|
374
|
-
import.meta.env.MODE
|
|
375
|
-
] })
|
|
376
|
-
] })
|
|
377
|
-
] });
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
// src/components/FileUpload.tsx
|
|
381
|
-
import { useState as useState2, useCallback, useRef } from "react";
|
|
382
|
-
import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
383
|
-
function FileUpload({
|
|
384
|
-
supabase,
|
|
385
|
-
table_name,
|
|
386
|
-
record_id,
|
|
387
|
-
organisation_id,
|
|
388
|
-
app_id,
|
|
389
|
-
category,
|
|
390
|
-
accept = "*/*",
|
|
391
|
-
maxSize = 10 * 1024 * 1024,
|
|
392
|
-
// 10MB default
|
|
393
|
-
multiple = false,
|
|
394
|
-
disabled = false,
|
|
395
|
-
className = "",
|
|
396
|
-
onUploadSuccess,
|
|
397
|
-
onUploadError,
|
|
398
|
-
children
|
|
399
|
-
}) {
|
|
400
|
-
const [isDragging, setIsDragging] = useState2(false);
|
|
401
|
-
const fileInputRef = useRef(null);
|
|
402
|
-
const { uploadFile, isLoading, error } = useFileReference(supabase);
|
|
403
|
-
const handleFileSelect = useCallback(async (files) => {
|
|
404
|
-
if (!files || files.length === 0) return;
|
|
405
|
-
const fileArray = Array.from(files);
|
|
406
|
-
const oversizedFiles = fileArray.filter((file) => file.size > maxSize);
|
|
407
|
-
if (oversizedFiles.length > 0) {
|
|
408
|
-
const errorMessage = `Files exceed maximum size of ${Math.round(maxSize / 1024 / 1024)}MB: ${oversizedFiles.map((f) => f.name).join(", ")}`;
|
|
409
|
-
onUploadError?.(errorMessage);
|
|
410
|
-
return;
|
|
411
|
-
}
|
|
412
|
-
for (const file of fileArray) {
|
|
413
|
-
try {
|
|
414
|
-
const result = await uploadFile({
|
|
415
|
-
table_name,
|
|
416
|
-
record_id,
|
|
417
|
-
organisation_id,
|
|
418
|
-
app_id,
|
|
419
|
-
category,
|
|
420
|
-
is_public: false
|
|
421
|
-
}, file);
|
|
422
|
-
if (result) {
|
|
423
|
-
onUploadSuccess?.(result);
|
|
424
|
-
} else {
|
|
425
|
-
onUploadError?.("Upload failed");
|
|
426
|
-
}
|
|
427
|
-
} catch (err) {
|
|
428
|
-
const errorMessage = err instanceof Error ? err.message : "Upload failed";
|
|
429
|
-
onUploadError?.(errorMessage);
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
}, [uploadFile, table_name, record_id, organisation_id, app_id, category, maxSize, onUploadSuccess, onUploadError]);
|
|
433
|
-
const handleDragOver = useCallback((e) => {
|
|
434
|
-
e.preventDefault();
|
|
435
|
-
e.stopPropagation();
|
|
436
|
-
if (!disabled) {
|
|
437
|
-
setIsDragging(true);
|
|
438
|
-
}
|
|
439
|
-
}, [disabled]);
|
|
440
|
-
const handleDragLeave = useCallback((e) => {
|
|
441
|
-
e.preventDefault();
|
|
442
|
-
e.stopPropagation();
|
|
443
|
-
setIsDragging(false);
|
|
444
|
-
}, []);
|
|
445
|
-
const handleDrop = useCallback((e) => {
|
|
446
|
-
e.preventDefault();
|
|
447
|
-
e.stopPropagation();
|
|
448
|
-
setIsDragging(false);
|
|
449
|
-
if (disabled) return;
|
|
450
|
-
const files = e.dataTransfer.files;
|
|
451
|
-
handleFileSelect(files);
|
|
452
|
-
}, [disabled, handleFileSelect]);
|
|
453
|
-
const handleFileInputChange = useCallback((e) => {
|
|
454
|
-
handleFileSelect(e.target.files);
|
|
455
|
-
if (e.target) {
|
|
456
|
-
e.target.value = "";
|
|
457
|
-
}
|
|
458
|
-
}, [handleFileSelect]);
|
|
459
|
-
const handleClick = useCallback(() => {
|
|
460
|
-
if (!disabled && fileInputRef.current) {
|
|
461
|
-
fileInputRef.current.click();
|
|
462
|
-
}
|
|
463
|
-
}, [disabled]);
|
|
464
|
-
const dragClasses = isDragging ? "border-main-500 bg-main-50" : "border-sec-300 hover:border-sec-400";
|
|
465
|
-
const disabledClasses = disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer hover:bg-sec-50";
|
|
466
|
-
return /* @__PURE__ */ jsxs5(
|
|
467
|
-
"div",
|
|
468
|
-
{
|
|
469
|
-
className: `relative border-2 border-dashed rounded-lg p-6 text-center transition-colors ${dragClasses} ${disabledClasses} ${className}`,
|
|
470
|
-
onDragOver: handleDragOver,
|
|
471
|
-
onDragLeave: handleDragLeave,
|
|
472
|
-
onDrop: handleDrop,
|
|
473
|
-
onClick: handleClick,
|
|
474
|
-
children: [
|
|
475
|
-
/* @__PURE__ */ jsx6(
|
|
476
|
-
"input",
|
|
477
|
-
{
|
|
478
|
-
ref: fileInputRef,
|
|
479
|
-
type: "file",
|
|
480
|
-
accept,
|
|
481
|
-
multiple,
|
|
482
|
-
onChange: handleFileInputChange,
|
|
483
|
-
className: "hidden",
|
|
484
|
-
disabled
|
|
485
|
-
}
|
|
486
|
-
),
|
|
487
|
-
children || /* @__PURE__ */ jsxs5("div", { className: "space-y-2", children: [
|
|
488
|
-
/* @__PURE__ */ jsx6("div", { className: "text-sec-600", children: isDragging ? "Drop files here..." : /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
489
|
-
/* @__PURE__ */ jsx6("span", { className: "font-medium", children: "Click to upload" }),
|
|
490
|
-
" ",
|
|
491
|
-
"or drag and drop"
|
|
492
|
-
] }) }),
|
|
493
|
-
/* @__PURE__ */ jsxs5("div", { className: "text-sm text-sec-500", children: [
|
|
494
|
-
accept !== "*/*" && `Accepted formats: ${accept}`,
|
|
495
|
-
maxSize && ` \u2022 Max size: ${Math.round(maxSize / 1024 / 1024)}MB`,
|
|
496
|
-
multiple && " \u2022 Multiple files allowed"
|
|
497
|
-
] })
|
|
498
|
-
] }),
|
|
499
|
-
isLoading && /* @__PURE__ */ jsx6("div", { className: "absolute inset-0 bg-white bg-opacity-75 flex items-center justify-center", children: /* @__PURE__ */ jsx6("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-main-500" }) }),
|
|
500
|
-
error && /* @__PURE__ */ jsx6("div", { className: "mt-2 text-sm text-acc-600", children: error })
|
|
501
|
-
]
|
|
502
|
-
}
|
|
503
|
-
);
|
|
504
|
-
}
|
|
505
323
|
export {
|
|
506
324
|
Alert,
|
|
507
325
|
AlertDescription,
|
|
@@ -575,9 +393,7 @@ export {
|
|
|
575
393
|
SelectSeparator,
|
|
576
394
|
SelectTrigger,
|
|
577
395
|
SelectValue,
|
|
578
|
-
|
|
579
|
-
SuperAdminDebugPanel,
|
|
580
|
-
SuperAdminGuard,
|
|
396
|
+
SessionRestorationLoader,
|
|
581
397
|
Switch,
|
|
582
398
|
Table,
|
|
583
399
|
TableBody,
|
|
@@ -602,14 +418,17 @@ export {
|
|
|
602
418
|
TooltipTrigger,
|
|
603
419
|
UnifiedAuthProvider,
|
|
604
420
|
UserMenu,
|
|
421
|
+
clearEventLogoCache,
|
|
422
|
+
getEventLogoCacheStats,
|
|
605
423
|
useErrorBoundary,
|
|
424
|
+
useEventLogo,
|
|
606
425
|
useFileReference,
|
|
426
|
+
useFileReferenceById,
|
|
607
427
|
useFileReferenceForRecord,
|
|
608
|
-
|
|
428
|
+
useFilesByCategory,
|
|
609
429
|
useIsPublicPage,
|
|
610
430
|
usePublicPageContext2 as usePublicPageContext,
|
|
611
431
|
usePublicPageContext as usePublicPageProviderContext,
|
|
612
|
-
useStorage,
|
|
613
432
|
useToast,
|
|
614
433
|
useUnifiedAuth
|
|
615
434
|
};
|
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","../src/components/SuperAdminGuard.tsx","../src/components/FileUpload.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';\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\n// Super Admin Guard components\nexport { \n SuperAdminGuard, \n SuperAdminBadge, \n SuperAdminDebugPanel \n} from './SuperAdminGuard';\nexport type { SuperAdminGuardProps } from './SuperAdminGuard';\n\n// Removed: Protected and AdminGuard components (unused)\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';\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\nexport { useStorage, useFileUpload } from '../hooks/useStorage';\nexport type { UseStorageOptions, UseStorageReturn } from '../hooks/useStorage';\n\nexport { useFileReference, useFileReferenceForRecord } from '../hooks/useFileReference';\nexport type { UseFileReferenceOptions, UseFileReferenceReturn, UseFileReferenceForRecordReturn } 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","/**\n * Super Admin Guard Component\n * @package @jmruthers/pace-core\n * @module Components/SuperAdminGuard\n * @since 1.0.0\n * \n * A reusable component for protecting content that should only be visible to super admins.\n */\n\nimport React from 'react';\nimport { useRBAC } from '../rbac/hooks/useRBAC';\n\nexport interface SuperAdminGuardProps {\n children: React.ReactNode;\n fallback?: React.ReactNode;\n showDebugInfo?: boolean;\n}\n\n/**\n * Super Admin Guard Component\n * \n * Renders children only if the current user is a super admin.\n * Provides a fallback for non-super admin users.\n * \n * @param children - Content to render for super admins\n * @param fallback - Content to render for non-super admins (optional)\n * @param showDebugInfo - Whether to show debug information (optional)\n */\nexport function SuperAdminGuard({ \n children, \n fallback = null, \n showDebugInfo = false \n}: SuperAdminGuardProps) {\n const { isSuperAdmin, hasGlobalPermission, isLoading } = useRBAC();\n\n // Show loading state\n if (isLoading) {\n return (\n <div className=\"super-admin-guard-loading\">\n <div className=\"loading-spinner\" />\n <span>Checking permissions...</span>\n </div>\n );\n }\n\n // Show debug info if enabled\n if (showDebugInfo) {\n console.log('[SuperAdminGuard] Debug Info:', {\n isSuperAdmin,\n isLoading\n });\n }\n\n // Render children for super admins\n if (isSuperAdmin) {\n return (\n <div className=\"super-admin-content\">\n {children}\n </div>\n );\n }\n\n // Render fallback for non-super admins\n return (\n <div className=\"super-admin-fallback\">\n {fallback}\n </div>\n );\n}\n\n/**\n * Super Admin Badge Component\n * \n * Shows a visual indicator when the current user is a super admin.\n */\nexport function SuperAdminBadge() {\n const { isSuperAdmin } = useRBAC();\n\n if (!isSuperAdmin) {\n return null;\n }\n\n return (\n <div className=\"super-admin-badge\">\n <span className=\"badge-text\">SUPER ADMIN</span>\n </div>\n );\n}\n\n/**\n * Super Admin Debug Panel\n * \n * Shows debug information about the current user's permissions.\n * Only visible to super admins and in development mode.\n */\nexport function SuperAdminDebugPanel() {\n const { isSuperAdmin, isLoading } = useRBAC();\n\n // Only show in development or for super admins\n if (import.meta.env.MODE !== 'development' && !isSuperAdmin) {\n return null;\n }\n\n return (\n <div className=\"super-admin-debug-panel\">\n <h4>Super Admin Debug Info</h4>\n <div className=\"debug-info\">\n <p><strong>Is Super Admin:</strong> {isSuperAdmin ? 'Yes' : 'No'}</p>\n <p><strong>Is Loading:</strong> {isLoading ? 'Yes' : 'No'}</p>\n <p><strong>Environment:</strong> {import.meta.env.MODE}</p>\n </div>\n </div>\n );\n}\n\nexport default SuperAdminGuard;\n","// File Upload Component\n// Provides a file upload interface using the file reference system\n\nimport React, { useState, useCallback, useRef } from 'react';\nimport { SupabaseClient } from '@supabase/supabase-js';\nimport { FileCategory } from '../types/file-reference';\nimport { useFileReference } from '../hooks/useFileReference';\n\nexport interface FileUploadProps {\n supabase: SupabaseClient;\n table_name: string;\n record_id: string;\n organisation_id: string;\n app_id: string;\n category: FileCategory;\n accept?: string;\n maxSize?: number;\n multiple?: boolean;\n disabled?: boolean;\n className?: string;\n onUploadSuccess?: (result: any) => void;\n onUploadError?: (error: string) => void;\n children?: React.ReactNode;\n}\n\nexport function FileUpload({\n supabase,\n table_name,\n record_id,\n organisation_id,\n app_id,\n category,\n accept = '*/*',\n maxSize = 10 * 1024 * 1024, // 10MB default\n multiple = false,\n disabled = false,\n className = '',\n onUploadSuccess,\n onUploadError,\n children\n}: FileUploadProps) {\n const [isDragging, setIsDragging] = useState(false);\n const fileInputRef = useRef<HTMLInputElement>(null);\n const { uploadFile, isLoading, error } = useFileReference(supabase);\n\n const handleFileSelect = useCallback(async (files: FileList | null) => {\n if (!files || files.length === 0) return;\n\n const fileArray = Array.from(files);\n \n // Validate file sizes\n const oversizedFiles = fileArray.filter(file => file.size > maxSize);\n if (oversizedFiles.length > 0) {\n const errorMessage = `Files exceed maximum size of ${Math.round(maxSize / 1024 / 1024)}MB: ${oversizedFiles.map(f => f.name).join(', ')}`;\n onUploadError?.(errorMessage);\n return;\n }\n\n // Upload files\n for (const file of fileArray) {\n try {\n const result = await uploadFile({\n table_name,\n record_id,\n organisation_id,\n app_id,\n category,\n is_public: false\n }, file);\n\n if (result) {\n onUploadSuccess?.(result);\n } else {\n onUploadError?.('Upload failed');\n }\n } catch (err) {\n const errorMessage = err instanceof Error ? err.message : 'Upload failed';\n onUploadError?.(errorMessage);\n }\n }\n }, [uploadFile, table_name, record_id, organisation_id, app_id, category, maxSize, onUploadSuccess, onUploadError]);\n\n const handleDragOver = useCallback((e: React.DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n if (!disabled) {\n setIsDragging(true);\n }\n }, [disabled]);\n\n const handleDragLeave = useCallback((e: React.DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n setIsDragging(false);\n }, []);\n\n const handleDrop = useCallback((e: React.DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n setIsDragging(false);\n \n if (disabled) return;\n \n const files = e.dataTransfer.files;\n handleFileSelect(files);\n }, [disabled, handleFileSelect]);\n\n const handleFileInputChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n handleFileSelect(e.target.files);\n // Reset input value to allow re-uploading the same file\n if (e.target) {\n e.target.value = '';\n }\n }, [handleFileSelect]);\n\n const handleClick = useCallback(() => {\n if (!disabled && fileInputRef.current) {\n fileInputRef.current.click();\n }\n }, [disabled]);\n\n const dragClasses = isDragging ? 'border-main-500 bg-main-50' : 'border-sec-300 hover:border-sec-400';\n const disabledClasses = disabled ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer hover:bg-sec-50';\n\n return (\n <div\n className={`relative border-2 border-dashed rounded-lg p-6 text-center transition-colors ${dragClasses} ${disabledClasses} ${className}`}\n onDragOver={handleDragOver}\n onDragLeave={handleDragLeave}\n onDrop={handleDrop}\n onClick={handleClick}\n >\n <input\n ref={fileInputRef}\n type=\"file\"\n accept={accept}\n multiple={multiple}\n onChange={handleFileInputChange}\n className=\"hidden\"\n disabled={disabled}\n />\n \n {children || (\n <div className=\"space-y-2\">\n <div className=\"text-sec-600\">\n {isDragging ? (\n 'Drop files here...'\n ) : (\n <>\n <span className=\"font-medium\">Click to upload</span>\n {' '}or drag and drop\n </>\n )}\n </div>\n <div className=\"text-sm text-sec-500\">\n {accept !== '*/*' && `Accepted formats: ${accept}`}\n {maxSize && ` • Max size: ${Math.round(maxSize / 1024 / 1024)}MB`}\n {multiple && ' • Multiple files allowed'}\n </div>\n </div>\n )}\n \n {isLoading && (\n <div className=\"absolute inset-0 bg-white bg-opacity-75 flex items-center justify-center\">\n <div className=\"animate-spin rounded-full h-8 w-8 border-b-2 border-main-500\"></div>\n </div>\n )}\n \n {error && (\n <div className=\"mt-2 text-sm text-acc-600\">\n {error}\n </div>\n )}\n </div>\n );\n}\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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x","jsxs","useState"]}
|
|
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 (none currently exported)\n// ============================================================================\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';\nexport { useEventLogo, clearEventLogoCache, getEventLogoCacheStats } from '../hooks/useEventLogo';\nexport type { UseEventLogoReturn, UseEventLogoOptions } from '../hooks/useEventLogo';\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,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