@jmruthers/pace-core 0.6.6 → 0.6.8
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/{scripts/audit/audit-dependencies.cjs → audit-tool/00-dependencies.cjs} +227 -22
- package/audit-tool/audits/01-pace-core-compliance.cjs +556 -0
- package/audit-tool/audits/02-project-structure.cjs +240 -0
- package/audit-tool/audits/03-architecture.cjs +224 -0
- package/audit-tool/audits/04-code-quality.cjs +149 -0
- package/audit-tool/audits/05-styling.cjs +224 -0
- package/audit-tool/audits/06-security-rbac.cjs +554 -0
- package/audit-tool/audits/07-api-tech-stack.cjs +355 -0
- package/audit-tool/audits/08-testing-documentation.cjs +202 -0
- package/audit-tool/audits/09-operations.cjs +208 -0
- package/audit-tool/index.cjs +295 -0
- package/audit-tool/utils/code-utils.cjs +218 -0
- package/audit-tool/utils/file-utils.cjs +230 -0
- package/audit-tool/utils/report-utils.cjs +380 -0
- package/cursor-rules/00-standards-overview.mdc +156 -0
- package/cursor-rules/{00-pace-core-compliance.mdc → 01-pace-core-compliance.mdc} +187 -34
- package/cursor-rules/02-project-structure.mdc +37 -5
- package/cursor-rules/{03-solid-principles.mdc → 03-architecture.mdc} +125 -11
- package/cursor-rules/04-code-quality.mdc +419 -0
- package/cursor-rules/{08-markup-quality.mdc → 05-styling.mdc} +55 -10
- package/cursor-rules/{09-rbac-compliance.mdc → 06-security-rbac.mdc} +62 -6
- package/cursor-rules/07-api-tech-stack.mdc +377 -0
- package/cursor-rules/08-testing-documentation.mdc +324 -0
- package/cursor-rules/09-operations.mdc +365 -0
- package/dist/DataTable-6RMSCQJ6.js +15 -0
- package/dist/{DataTable-2N_tqbfq.d.ts → DataTable-DRUIgtUH.d.ts} +1 -1
- package/dist/{PublicPageProvider-BBH6Vqg7.d.ts → PublicPageProvider-CIGSujI2.d.ts} +40 -24
- package/dist/{UnifiedAuthProvider-ZT6TIGM7.js → UnifiedAuthProvider-7SNDOWYD.js} +2 -2
- package/dist/{api-Y4MQWOFW.js → api-7P7DI652.js} +1 -1
- package/dist/{chunk-MAGBIDNS.js → chunk-4DDCYDQ3.js} +8 -7
- package/dist/{chunk-BVP2BCJF.js → chunk-5W2A3DRC.js} +10 -9
- package/dist/{chunk-SD6WQY43.js → chunk-7ILTDCL2.js} +9 -1
- package/dist/{chunk-3QC3KRHK.js → chunk-A3W6LW53.js} +16 -1
- package/dist/{chunk-3O3WHILE.js → chunk-EF2UGZWY.js} +239 -63
- package/dist/{chunk-LAZMKTTF.js → chunk-EURB7QFZ.js} +341 -337
- package/dist/{chunk-2HGJFNAH.js → chunk-FEJLJNWA.js} +1 -15
- package/dist/{chunk-7TYHROIV.js → chunk-GS5672WG.js} +55 -13
- package/dist/{chunk-UIYSCEV7.js → chunk-IUBRCBSY.js} +1 -1
- package/dist/{chunk-ZFYPMX46.js → chunk-LX6U42O3.js} +1 -1
- package/dist/{chunk-FENMYN2U.js → chunk-MPBLMWVR.js} +3 -3
- package/dist/{chunk-ZS5VO5JB.js → chunk-NKHKXPI4.js} +408 -453
- package/dist/{chunk-A55DK444.js → chunk-OJ4SKRSV.js} +1 -7
- package/dist/{chunk-4T7OBVTU.js → chunk-S6ZQKDY6.js} +1 -1
- package/dist/{chunk-FTCRZOG2.js → chunk-T5CVK4R3.js} +5 -5
- package/dist/{chunk-OHIK3MIO.js → chunk-Z2FNRKF3.js} +13 -13
- package/dist/components.d.ts +5 -4
- package/dist/components.js +29 -34
- package/dist/eslint-rules/index.cjs +22 -9
- package/{src/eslint-rules/rules/compliance.cjs → dist/eslint-rules/rules/01-pace-core-compliance.cjs} +184 -23
- package/dist/eslint-rules/rules/04-code-quality.cjs +346 -0
- package/dist/eslint-rules/rules/05-styling.cjs +61 -0
- package/dist/eslint-rules/rules/{rbac.cjs → 06-security-rbac.cjs} +34 -13
- package/dist/eslint-rules/rules/07-api-tech-stack.cjs +385 -0
- package/dist/eslint-rules/rules/08-testing.cjs +94 -0
- package/dist/{functions-DHebl8-F.d.ts → functions-lBy5L2ry.d.ts} +1 -1
- package/dist/hooks.d.ts +5 -5
- package/dist/hooks.js +8 -8
- package/dist/index.d.ts +7 -7
- package/dist/index.js +21 -20
- package/dist/providers.js +2 -2
- package/dist/rbac/index.d.ts +1 -1
- package/dist/rbac/index.js +8 -8
- package/dist/theming/runtime.d.ts +61 -1
- package/dist/theming/runtime.js +1 -1
- package/dist/{types-B-K_5VnO.d.ts → types-DXstZpNI.d.ts} +0 -17
- package/dist/types.d.ts +2 -2
- package/dist/{usePublicRouteParams-COZ28Mvq.d.ts → usePublicRouteParams-MamNgwqe.d.ts} +19 -19
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +8 -8
- package/docs/README.md +1 -1
- package/docs/api/modules.md +106 -41
- package/docs/api-reference/components.md +18 -20
- package/docs/api-reference/hooks.md +80 -80
- package/docs/api-reference/types.md +1 -1
- package/docs/api-reference/utilities.md +1 -1
- package/docs/architecture/README.md +1 -1
- package/docs/core-concepts/events.md +3 -3
- package/docs/core-concepts/organisations.md +6 -6
- package/docs/core-concepts/permissions.md +6 -6
- package/docs/documentation-index.md +12 -18
- package/docs/getting-started/dependencies.md +23 -0
- package/docs/getting-started/documentation-index.md +1 -1
- package/docs/getting-started/examples/README.md +4 -4
- package/docs/getting-started/examples/full-featured-app.md +1 -1
- package/docs/getting-started/faq.md +2 -2
- package/docs/getting-started/quick-reference.md +4 -4
- package/docs/implementation-guides/app-layout.md +1 -1
- package/docs/implementation-guides/authentication.md +15 -15
- package/docs/implementation-guides/component-styling.md +1 -1
- package/docs/implementation-guides/data-tables.md +127 -34
- package/docs/implementation-guides/datatable-rbac-usage.md +1 -1
- package/docs/implementation-guides/dynamic-colors.md +3 -3
- package/docs/implementation-guides/file-upload-storage.md +2 -2
- package/docs/implementation-guides/hierarchical-datatable.md +40 -60
- package/docs/implementation-guides/inactivity-tracking.md +3 -3
- package/docs/implementation-guides/large-datasets.md +3 -2
- package/docs/implementation-guides/organisation-security.md +2 -2
- package/docs/implementation-guides/performance.md +2 -2
- package/docs/implementation-guides/permission-enforcement.md +1 -1
- package/docs/migration/V0.3.44_organisation-context-timing-fix.md +1 -1
- package/docs/migration/V0.4.0_rbac-migration.md +6 -6
- package/docs/rbac/README.md +5 -5
- package/docs/rbac/advanced-patterns.md +6 -6
- package/docs/rbac/api-reference.md +20 -20
- package/docs/rbac/event-based-apps.md +3 -3
- package/docs/rbac/examples.md +41 -41
- package/docs/rbac/getting-started.md +37 -37
- package/docs/rbac/performance.md +1 -1
- package/docs/rbac/quick-start.md +52 -52
- package/docs/rbac/secure-client-protection.md +1 -1
- package/docs/rbac/troubleshooting.md +1 -1
- package/docs/security/README.md +5 -5
- package/docs/standards/0-standards-overview.md +220 -0
- package/docs/standards/{00-pace-core-compliance.md → 1-pace-core-compliance-standards.md} +241 -185
- package/docs/standards/{02-project-structure.md → 2-project-structure-standards.md} +11 -47
- package/docs/standards/3-architecture-standards.md +606 -0
- package/docs/standards/4-code-quality-standards.md +728 -0
- package/docs/standards/{08-markup-quality.md → 5-styling-standards.md} +12 -9
- package/docs/standards/{09-rbac-compliance.md → 6-security-rbac-standards.md} +126 -18
- package/docs/standards/7-api-tech-stack-standards.md +662 -0
- package/docs/standards/8-testing-documentation-standards.md +401 -0
- package/docs/standards/9-operations-standards.md +1102 -0
- package/docs/standards/README.md +203 -104
- package/docs/troubleshooting/README.md +4 -4
- package/docs/troubleshooting/common-issues.md +2 -2
- package/docs/troubleshooting/debugging.md +9 -9
- package/docs/troubleshooting/migration.md +4 -4
- package/eslint-config-pace-core.cjs +50 -20
- package/package.json +50 -19
- package/scripts/eslint-audit.cjs +123 -0
- package/scripts/install-cursor-rules.cjs +11 -243
- package/scripts/install-eslint-config.cjs +349 -0
- package/scripts/validate-dependencies.cjs +248 -0
- package/src/__tests__/helpers/__tests__/component-test-utils.test.tsx +2 -2
- package/src/__tests__/helpers/__tests__/test-providers.test.tsx +2 -2
- package/src/__tests__/helpers/__tests__/test-utils.test.tsx +30 -18
- package/src/__tests__/integration/UserProfile.test.tsx +14 -14
- package/src/__tests__/rbac/PagePermissionGuard.test.tsx +6 -6
- package/src/__tests__/templates/accessibility.test.template.tsx +10 -9
- package/src/__tests__/templates/component.test.template.tsx +18 -15
- package/src/components/AddressField/AddressField.tsx +26 -1
- package/src/components/Alert/Alert.test.tsx +86 -22
- package/src/components/Alert/Alert.tsx +19 -11
- package/src/components/Badge/Badge.tsx +1 -1
- package/src/components/Calendar/Calendar.tsx +201 -47
- package/src/components/Checkbox/Checkbox.test.tsx +2 -1
- package/src/components/ContextSelector/ContextSelector.tsx +108 -126
- package/src/components/DataTable/AUDIT_REPORT.md +293 -0
- package/src/components/DataTable/DataTable.tsx +1 -19
- package/src/components/DataTable/__tests__/DataTableCore.test.tsx +6 -2
- package/src/components/DataTable/__tests__/a11y.basic.test.tsx +21 -6
- package/src/components/DataTable/__tests__/pagination.modes.test.tsx +3 -2
- package/src/components/DataTable/__tests__/test-utils/sharedTestUtils.tsx +9 -9
- package/src/components/DataTable/components/ColumnFilter.tsx +63 -74
- package/src/components/DataTable/components/ColumnVisibilityDropdown.tsx +43 -41
- package/src/components/DataTable/components/DataTableErrorBoundary.tsx +9 -11
- package/src/components/DataTable/components/DataTableLayout.tsx +5 -16
- package/src/components/DataTable/components/EditableRow.tsx +5 -7
- package/src/components/DataTable/components/EmptyState.tsx +11 -10
- package/src/components/DataTable/components/FilterRow.tsx +2 -4
- package/src/components/DataTable/components/ImportModal.tsx +124 -126
- package/src/components/DataTable/components/LoadingState.tsx +5 -6
- package/src/components/DataTable/components/SortIndicator.tsx +50 -0
- package/src/components/DataTable/components/__tests__/COVERAGE_NOTE.md +4 -4
- package/src/components/DataTable/components/__tests__/ColumnFilter.test.tsx +23 -82
- package/src/components/DataTable/components/__tests__/DataTableErrorBoundary.test.tsx +37 -9
- package/src/components/DataTable/components/__tests__/EmptyState.test.tsx +7 -4
- package/src/components/DataTable/components/__tests__/FilterRow.test.tsx +12 -4
- package/src/components/DataTable/components/__tests__/LoadingState.test.tsx +45 -27
- package/src/components/DataTable/components/index.ts +2 -1
- package/src/components/DataTable/types.ts +0 -18
- package/src/components/DataTable/utils/a11yUtils.ts +17 -0
- package/src/components/DatePickerWithTimezone/DatePickerWithTimezone.test.tsx +1 -1
- package/src/components/DatePickerWithTimezone/DatePickerWithTimezone.tsx +11 -15
- package/src/components/DateTimeField/DateTimeField.tsx +7 -8
- package/src/components/Dialog/Dialog.test.tsx +1 -0
- package/src/components/Dialog/Dialog.tsx +25 -8
- package/src/components/ErrorBoundary/ErrorBoundary.tsx +77 -79
- package/src/components/FileUpload/FileUpload.test.tsx +45 -16
- package/src/components/FileUpload/FileUpload.tsx +141 -130
- package/src/components/NavigationMenu/NavigationMenu.test.tsx +48 -12
- package/src/components/PaceAppLayout/PaceAppLayout.performance.test.tsx +9 -9
- package/src/components/PaceAppLayout/PaceAppLayout.security.test.tsx +30 -30
- package/src/components/PaceAppLayout/PaceAppLayout.test.tsx +4 -4
- package/src/components/PaceLoginPage/PaceLoginPage.test.tsx +7 -1
- package/src/components/Progress/Progress.tsx +2 -4
- package/src/components/ProtectedRoute/ProtectedRoute.tsx +8 -8
- package/src/components/Select/Select.tsx +86 -77
- package/src/components/Select/types.ts +3 -0
- package/src/hooks/__tests__/ServiceHooks.test.tsx +16 -16
- package/src/hooks/__tests__/hooks.integration.test.tsx +49 -49
- package/src/hooks/__tests__/useDataTablePerformance.unit.test.ts +8 -5
- package/src/hooks/__tests__/useFileUrl.unit.test.ts +4 -0
- package/src/hooks/__tests__/useFocusTrap.unit.test.tsx +99 -99
- package/src/hooks/__tests__/useInactivityTracker.unit.test.ts +45 -8
- package/src/hooks/__tests__/usePerformanceMonitor.unit.test.ts +22 -2
- package/src/hooks/public/usePublicEvent.ts +5 -5
- package/src/hooks/public/usePublicEventLogo.ts +5 -5
- package/src/hooks/public/usePublicFileDisplay.ts +2 -2
- package/src/hooks/public/usePublicRouteParams.ts +13 -9
- package/src/hooks/useAddressAutocomplete.test.ts +18 -18
- package/src/hooks/useAppConfig.ts +2 -2
- package/src/hooks/useEventTheme.test.ts +7 -7
- package/src/hooks/useEventTheme.ts +2 -1
- package/src/hooks/useFileDisplay.ts +2 -2
- package/src/hooks/useFileUrl.ts +52 -8
- package/src/hooks/useOrganisationSecurity.test.ts +2 -1
- package/src/providers/UnifiedAuthProvider.smoke.test.tsx +21 -21
- package/src/providers/__tests__/AuthProvider.test.tsx +21 -21
- package/src/providers/__tests__/EventProvider.test.tsx +61 -61
- package/src/providers/__tests__/InactivityProvider.test.tsx +56 -56
- package/src/providers/__tests__/OrganisationProvider.test.tsx +75 -75
- package/src/providers/__tests__/ProviderLifecycle.test.tsx +38 -38
- package/src/providers/__tests__/UnifiedAuthProvider.test.tsx +103 -103
- package/src/providers/services/__tests__/AuthServiceProvider.integration.test.tsx +7 -7
- package/src/providers/services/__tests__/UnifiedAuthProvider.integration.test.tsx +10 -10
- package/src/rbac/__tests__/auth-rbac.e2e.test.tsx +15 -6
- package/src/rbac/__tests__/rbac-functions.test.ts +3 -3
- package/src/rbac/api.test.ts +104 -0
- package/src/rbac/engine.ts +1 -1
- package/src/rbac/hooks/useCan.test.ts +2 -2
- package/src/rbac/secureClient.ts +1 -1
- package/src/rbac/types/functions.ts +1 -1
- package/src/styles/core.css +7 -0
- package/src/theming/__tests__/parseEventColours.test.ts +118 -3
- package/src/theming/parseEventColours.ts +77 -11
- package/src/types/supabase.ts +2 -3
- package/src/utils/__tests__/bundleAnalysis.unit.test.ts +9 -9
- package/src/utils/__tests__/lazyLoad.unit.test.tsx +42 -39
- package/src/utils/file-reference/__tests__/file-reference.test.ts +4 -0
- package/src/utils/formatting/formatDate.test.ts +3 -2
- package/src/utils/formatting/formatDateTime.test.ts +2 -2
- package/src/utils/google-places/googlePlacesUtils.test.ts +36 -24
- package/src/utils/storage/README.md +1 -1
- package/src/utils/storage/__tests__/helpers.unit.test.ts +19 -12
- package/src/utils/storage/helpers.test.ts +69 -3
- package/cursor-rules/01-standards-compliance.mdc +0 -285
- package/cursor-rules/04-testing-standards.mdc +0 -270
- package/cursor-rules/05-bug-reports-and-features.mdc +0 -248
- package/cursor-rules/06-code-quality.mdc +0 -311
- package/cursor-rules/07-tech-stack-compliance.mdc +0 -216
- package/cursor-rules/10-error-handling-patterns.mdc +0 -179
- package/cursor-rules/11-performance-optimization.mdc +0 -169
- package/cursor-rules/12-ci-cd-integration.mdc +0 -150
- package/dist/DataTable-LRJL4IRV.js +0 -15
- package/dist/eslint-rules/rules/compliance.cjs +0 -348
- package/dist/eslint-rules/rules/components.cjs +0 -113
- package/dist/eslint-rules/rules/imports.cjs +0 -102
- package/docs/best-practices/README.md +0 -472
- package/docs/best-practices/accessibility.md +0 -604
- package/docs/best-practices/common-patterns.md +0 -516
- package/docs/best-practices/deployment.md +0 -1103
- package/docs/best-practices/performance.md +0 -1328
- package/docs/best-practices/security.md +0 -940
- package/docs/best-practices/testing.md +0 -1034
- package/docs/rbac/compliance/compliance-guide.md +0 -544
- package/docs/standards/01-standards-compliance.md +0 -188
- package/docs/standards/03-solid-principles.md +0 -39
- package/docs/standards/04-testing-standards.md +0 -36
- package/docs/standards/05-bug-reports-and-features.md +0 -27
- package/docs/standards/06-code-quality.md +0 -34
- package/docs/standards/07-tech-stack-compliance.md +0 -30
- package/docs/standards/10-error-handling-patterns.md +0 -401
- package/docs/standards/11-performance-optimization.md +0 -348
- package/docs/standards/12-ci-cd-integration.md +0 -370
- package/docs/standards/ALIGNMENT_REVIEW_SUMMARY.md +0 -192
- package/scripts/audit/audit-compliance.cjs +0 -1295
- package/scripts/audit/audit-components.cjs +0 -260
- package/scripts/audit/audit-rbac.cjs +0 -954
- package/scripts/audit/audit-standards.cjs +0 -1268
- package/scripts/audit/index.cjs +0 -1927
- package/src/components/DataTable/components/DataTableBody.tsx +0 -478
- package/src/components/DataTable/components/DraggableColumnHeader.tsx +0 -156
- package/src/components/DataTable/components/ExpandButton.tsx +0 -113
- package/src/components/DataTable/components/GroupHeader.tsx +0 -54
- package/src/components/DataTable/components/ViewRowModal.tsx +0 -68
- package/src/components/DataTable/components/VirtualizedDataTable.tsx +0 -525
- package/src/components/DataTable/components/__tests__/ExpandButton.test.tsx +0 -462
- package/src/components/DataTable/components/__tests__/GroupHeader.test.tsx +0 -393
- package/src/components/DataTable/components/__tests__/ViewRowModal.test.tsx +0 -476
- package/src/components/DataTable/components/__tests__/VirtualizedDataTable.test.tsx +0 -128
- package/src/components/DataTable/core/DataTableContext.tsx +0 -216
- package/src/components/DataTable/core/__tests__/DataTableContext.test.tsx +0 -136
- package/src/components/DataTable/hooks/__tests__/useColumnReordering.test.ts +0 -570
- package/src/components/DataTable/hooks/useColumnReordering.ts +0 -123
- package/src/components/DataTable/utils/debugTools.ts +0 -514
- package/src/eslint-rules/index.cjs +0 -22
- package/src/eslint-rules/rules/components.cjs +0 -113
- package/src/eslint-rules/rules/imports.cjs +0 -102
- package/src/eslint-rules/rules/rbac.cjs +0 -790
- package/src/eslint-rules/utils/helpers.cjs +0 -42
- package/src/eslint-rules/utils/manifest-loader.cjs +0 -75
|
@@ -1,31 +1,33 @@
|
|
|
1
|
-
import { AccessDenied } from './chunk-
|
|
2
|
-
import { Input, Dialog, DialogContent, DialogHeader, DialogBody, DialogFooter,
|
|
3
|
-
import { Button, useRBAC, useResolvedScope, usePermissions, useEvents, useCan } from './chunk-
|
|
4
|
-
import { useAddressAutocomplete, createFileReferenceService, uploadFileWithReference, usePublicFileDisplay, useFileDisplay, getPublicUrl, getSignedUrl, generateFileUrlsBatch, useEventTheme, usePreventTabReload } from './chunk-
|
|
5
|
-
import { clearPalette } from './chunk-
|
|
1
|
+
import { AccessDenied } from './chunk-S6ZQKDY6.js';
|
|
2
|
+
import { Input, Dialog, DialogContent, DialogHeader, DialogBody, DialogFooter, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, Alert, AlertDescription, Label, SelectLabel, SelectSeparator, DialogTitle, deriveFormKey, useSessionDraft, filterSensitiveFields, isSensitiveField, SelectGroup, AlertTitle, Progress } from './chunk-NKHKXPI4.js';
|
|
3
|
+
import { Button, useRBAC, useResolvedScope, usePermissions, useEvents, useCan } from './chunk-GS5672WG.js';
|
|
4
|
+
import { useAddressAutocomplete, createFileReferenceService, uploadFileWithReference, usePublicFileDisplay, useFileDisplay, getPublicUrl, getSignedUrl, generateFileUrlsBatch, useEventTheme, usePreventTabReload } from './chunk-MPBLMWVR.js';
|
|
5
|
+
import { clearPalette } from './chunk-5W2A3DRC.js';
|
|
6
6
|
import { useToast } from './chunk-S7DKJPLT.js';
|
|
7
|
-
import { useIsPublicPage, PublicPageContext, useAppConfig, ErrorBoundary } from './chunk-
|
|
8
|
-
import { useUnifiedAuth, useOrganisations, UnifiedAuthContext, EventServiceContext, useSessionRestoration } from './chunk-
|
|
9
|
-
import { EventContextRequiredError, OrganisationContextRequiredError, isSuperAdmin } from './chunk-
|
|
7
|
+
import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter, useIsPublicPage, PublicPageContext, useAppConfig, ErrorBoundary } from './chunk-EF2UGZWY.js';
|
|
8
|
+
import { useUnifiedAuth, useOrganisations, UnifiedAuthContext, EventServiceContext, useSessionRestoration } from './chunk-T5CVK4R3.js';
|
|
9
|
+
import { EventContextRequiredError, OrganisationContextRequiredError, isSuperAdmin } from './chunk-LX6U42O3.js';
|
|
10
10
|
import { assertAppId } from './chunk-4SXLQIZO.js';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
11
|
+
import { getAppId } from './chunk-FEJLJNWA.js';
|
|
12
|
+
import { LoadingSpinner } from './chunk-A3W6LW53.js';
|
|
13
|
+
import { getCurrentAppName } from './chunk-OJ4SKRSV.js';
|
|
14
|
+
import { cn } from './chunk-7ILTDCL2.js';
|
|
13
15
|
import { createLogger, logger } from './chunk-TTRFSOKR.js';
|
|
14
|
-
import * as
|
|
15
|
-
import
|
|
16
|
+
import * as React6 from 'react';
|
|
17
|
+
import React6__default, { useState, useRef, useMemo, useCallback, useEffect, useContext } from 'react';
|
|
16
18
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
17
|
-
import
|
|
18
|
-
import { FileText, ExternalLink, X, ChevronDown, KeyRound, LogOut, Calendar as Calendar$1, Building2, AlertCircle, RefreshCw } from 'lucide-react';
|
|
19
|
+
import { FileText, ExternalLink, X, ChevronDown, KeyRound, LogOut, Calendar as Calendar$1, Building2, AlertCircle, RefreshCw, File, Check } from 'lucide-react';
|
|
19
20
|
import * as SwitchPrimitive from '@radix-ui/react-switch';
|
|
20
21
|
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
21
22
|
import { useDayPicker, DayPicker } from 'react-day-picker';
|
|
22
23
|
import { enAU } from 'date-fns/locale';
|
|
24
|
+
import { format } from 'date-fns';
|
|
23
25
|
import * as ToastPrimitives from '@radix-ui/react-toast';
|
|
24
26
|
import { useForm, useWatch, FormProvider, useFormContext, Controller } from 'react-hook-form';
|
|
25
27
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
26
28
|
import { useLocation, Link, useNavigate, Outlet, Navigate } from 'react-router-dom';
|
|
27
29
|
|
|
28
|
-
var AddressField =
|
|
30
|
+
var AddressField = React6.forwardRef(
|
|
29
31
|
({
|
|
30
32
|
apiKey,
|
|
31
33
|
value: controlledValue,
|
|
@@ -44,13 +46,14 @@ var AddressField = React7.forwardRef(
|
|
|
44
46
|
cacheTTL,
|
|
45
47
|
...props
|
|
46
48
|
}, ref) => {
|
|
47
|
-
const [internalValue, setInternalValue] =
|
|
48
|
-
const [isOpen, setIsOpen] =
|
|
49
|
-
const [selectedIndex, setSelectedIndex] =
|
|
50
|
-
const [inputFocused, setInputFocused] =
|
|
51
|
-
const inputRef =
|
|
52
|
-
const suggestionsRef =
|
|
53
|
-
const containerRef =
|
|
49
|
+
const [internalValue, setInternalValue] = React6.useState(defaultValue);
|
|
50
|
+
const [isOpen, setIsOpen] = React6.useState(false);
|
|
51
|
+
const [selectedIndex, setSelectedIndex] = React6.useState(-1);
|
|
52
|
+
const [inputFocused, setInputFocused] = React6.useState(false);
|
|
53
|
+
const inputRef = React6.useRef(null);
|
|
54
|
+
const suggestionsRef = React6.useRef(null);
|
|
55
|
+
const containerRef = React6.useRef(null);
|
|
56
|
+
const blurTimeoutRef = React6.useRef(null);
|
|
54
57
|
const value = controlledValue !== void 0 ? controlledValue : internalValue;
|
|
55
58
|
const { suggestions, isLoading, error: autocompleteError, selectAddress, clearSuggestions } = useAddressAutocomplete(apiKey, value, {
|
|
56
59
|
autocompleteOptions,
|
|
@@ -58,14 +61,14 @@ var AddressField = React7.forwardRef(
|
|
|
58
61
|
cacheEnabled,
|
|
59
62
|
cacheTTL
|
|
60
63
|
});
|
|
61
|
-
|
|
64
|
+
React6.useEffect(() => {
|
|
62
65
|
if (suggestions.length > 0 && inputFocused && value.trim()) {
|
|
63
66
|
setIsOpen(true);
|
|
64
67
|
} else if (suggestions.length === 0 || !value.trim()) {
|
|
65
68
|
setIsOpen(false);
|
|
66
69
|
}
|
|
67
70
|
}, [suggestions, inputFocused, value]);
|
|
68
|
-
const handleInputChange =
|
|
71
|
+
const handleInputChange = React6.useCallback(
|
|
69
72
|
(e) => {
|
|
70
73
|
const newValue = e.target.value;
|
|
71
74
|
if (controlledValue === void 0) {
|
|
@@ -80,7 +83,7 @@ var AddressField = React7.forwardRef(
|
|
|
80
83
|
},
|
|
81
84
|
[controlledValue, onInputChange, onChange, clearSuggestions]
|
|
82
85
|
);
|
|
83
|
-
const handleSelectAddress =
|
|
86
|
+
const handleSelectAddress = React6.useCallback(
|
|
84
87
|
async (placeId) => {
|
|
85
88
|
setIsOpen(false);
|
|
86
89
|
setSelectedIndex(-1);
|
|
@@ -97,7 +100,7 @@ var AddressField = React7.forwardRef(
|
|
|
97
100
|
},
|
|
98
101
|
[selectAddress, onChange, onInputChange, controlledValue]
|
|
99
102
|
);
|
|
100
|
-
const handleKeyDown =
|
|
103
|
+
const handleKeyDown = React6.useCallback(
|
|
101
104
|
(e) => {
|
|
102
105
|
if (!isOpen || suggestions.length === 0) {
|
|
103
106
|
if (e.key === "Escape") {
|
|
@@ -135,25 +138,42 @@ var AddressField = React7.forwardRef(
|
|
|
135
138
|
},
|
|
136
139
|
[isOpen, suggestions, selectedIndex, handleSelectAddress]
|
|
137
140
|
);
|
|
138
|
-
const handleFocus =
|
|
141
|
+
const handleFocus = React6.useCallback(() => {
|
|
139
142
|
setInputFocused(true);
|
|
140
143
|
if (suggestions.length > 0 && value.trim()) {
|
|
141
144
|
setIsOpen(true);
|
|
142
145
|
}
|
|
143
146
|
}, [suggestions, value]);
|
|
144
|
-
const handleBlur =
|
|
147
|
+
const handleBlur = React6.useCallback(
|
|
145
148
|
(e) => {
|
|
146
|
-
|
|
149
|
+
if (blurTimeoutRef.current) {
|
|
150
|
+
clearTimeout(blurTimeoutRef.current);
|
|
151
|
+
blurTimeoutRef.current = null;
|
|
152
|
+
}
|
|
153
|
+
blurTimeoutRef.current = setTimeout(() => {
|
|
154
|
+
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
155
|
+
blurTimeoutRef.current = null;
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
147
158
|
if (!containerRef.current?.contains(document.activeElement)) {
|
|
148
159
|
setInputFocused(false);
|
|
149
160
|
setIsOpen(false);
|
|
150
161
|
setSelectedIndex(-1);
|
|
151
162
|
}
|
|
163
|
+
blurTimeoutRef.current = null;
|
|
152
164
|
}, 200);
|
|
153
165
|
},
|
|
154
166
|
[]
|
|
155
167
|
);
|
|
156
|
-
|
|
168
|
+
React6.useEffect(() => {
|
|
169
|
+
return () => {
|
|
170
|
+
if (blurTimeoutRef.current) {
|
|
171
|
+
clearTimeout(blurTimeoutRef.current);
|
|
172
|
+
blurTimeoutRef.current = null;
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
}, []);
|
|
176
|
+
React6.useEffect(() => {
|
|
157
177
|
const handleClickOutside = (event) => {
|
|
158
178
|
if (containerRef.current && !containerRef.current.contains(event.target)) {
|
|
159
179
|
setIsOpen(false);
|
|
@@ -167,8 +187,8 @@ var AddressField = React7.forwardRef(
|
|
|
167
187
|
};
|
|
168
188
|
}
|
|
169
189
|
}, [isOpen]);
|
|
170
|
-
const suggestionsId =
|
|
171
|
-
|
|
190
|
+
const suggestionsId = React6.useId();
|
|
191
|
+
React6.useEffect(() => {
|
|
172
192
|
if (selectedIndex >= 0) {
|
|
173
193
|
const selectedItem = document.getElementById(
|
|
174
194
|
`${suggestionsId}-item-${selectedIndex}`
|
|
@@ -178,7 +198,7 @@ var AddressField = React7.forwardRef(
|
|
|
178
198
|
}
|
|
179
199
|
}
|
|
180
200
|
}, [selectedIndex, suggestionsId]);
|
|
181
|
-
|
|
201
|
+
React6.useImperativeHandle(ref, () => inputRef.current);
|
|
182
202
|
const hasError = error || !!autocompleteError;
|
|
183
203
|
return /* @__PURE__ */ jsxs("form", { ref: containerRef, className: cn("relative w-full", className), children: [
|
|
184
204
|
/* @__PURE__ */ jsx(
|
|
@@ -218,7 +238,7 @@ var AddressField = React7.forwardRef(
|
|
|
218
238
|
"list-none p-0 m-0"
|
|
219
239
|
),
|
|
220
240
|
"data-testid": "address-suggestions",
|
|
221
|
-
children: suggestions.map((suggestion, index) => /* @__PURE__ */ jsxs(
|
|
241
|
+
children: suggestions.map((suggestion, index) => /* @__PURE__ */ jsxs(React6.Fragment, { children: [
|
|
222
242
|
/* @__PURE__ */ jsx(
|
|
223
243
|
"dt",
|
|
224
244
|
{
|
|
@@ -247,65 +267,6 @@ var AddressField = React7.forwardRef(
|
|
|
247
267
|
}
|
|
248
268
|
);
|
|
249
269
|
AddressField.displayName = "AddressField";
|
|
250
|
-
var getLabelClasses = () => {
|
|
251
|
-
return "font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70";
|
|
252
|
-
};
|
|
253
|
-
var Label = React7.forwardRef(({
|
|
254
|
-
className,
|
|
255
|
-
required = false,
|
|
256
|
-
requiredIndicator,
|
|
257
|
-
hideRequiredIndicator = false,
|
|
258
|
-
helperText,
|
|
259
|
-
helperTextClassName,
|
|
260
|
-
error,
|
|
261
|
-
errorClassName,
|
|
262
|
-
children,
|
|
263
|
-
htmlFor,
|
|
264
|
-
...props
|
|
265
|
-
}, ref) => {
|
|
266
|
-
const hasError = !!error;
|
|
267
|
-
const showHelperText = helperText && !hasError;
|
|
268
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
269
|
-
/* @__PURE__ */ jsxs(
|
|
270
|
-
LabelPrimitive.Root,
|
|
271
|
-
{
|
|
272
|
-
ref,
|
|
273
|
-
className: cn(
|
|
274
|
-
getLabelClasses(),
|
|
275
|
-
hasError && "text-destructive",
|
|
276
|
-
className
|
|
277
|
-
),
|
|
278
|
-
htmlFor,
|
|
279
|
-
...props,
|
|
280
|
-
children: [
|
|
281
|
-
children,
|
|
282
|
-
required && /* @__PURE__ */ jsx(
|
|
283
|
-
"span",
|
|
284
|
-
{
|
|
285
|
-
"aria-label": "required",
|
|
286
|
-
className: cn(
|
|
287
|
-
"text-destructive ml-1",
|
|
288
|
-
hideRequiredIndicator && "sr-only"
|
|
289
|
-
),
|
|
290
|
-
children: requiredIndicator || "*"
|
|
291
|
-
}
|
|
292
|
-
)
|
|
293
|
-
]
|
|
294
|
-
}
|
|
295
|
-
),
|
|
296
|
-
showHelperText && /* @__PURE__ */ jsx("p", { className: cn("text-muted-foreground", helperTextClassName), children: helperText }),
|
|
297
|
-
hasError && /* @__PURE__ */ jsx(
|
|
298
|
-
"p",
|
|
299
|
-
{
|
|
300
|
-
role: "alert",
|
|
301
|
-
"aria-live": "polite",
|
|
302
|
-
className: cn("text-destructive", errorClassName),
|
|
303
|
-
children: error
|
|
304
|
-
}
|
|
305
|
-
)
|
|
306
|
-
] });
|
|
307
|
-
});
|
|
308
|
-
Label.displayName = LabelPrimitive.Root.displayName;
|
|
309
270
|
function Textarea({ className, variant = "default", size = "md", error, ref, ...props }) {
|
|
310
271
|
return /* @__PURE__ */ jsx(
|
|
311
272
|
"textarea",
|
|
@@ -339,20 +300,28 @@ function useFileUrl(fileReference, options) {
|
|
|
339
300
|
const [isLoading, setIsLoading] = useState(false);
|
|
340
301
|
const [error, setError] = useState(null);
|
|
341
302
|
const fileReferenceIdRef = useRef(null);
|
|
303
|
+
const isLoadingRef = useRef(false);
|
|
304
|
+
const urlRef = useRef(null);
|
|
305
|
+
useEffect(() => {
|
|
306
|
+
isLoadingRef.current = isLoading;
|
|
307
|
+
urlRef.current = url;
|
|
308
|
+
}, [isLoading, url]);
|
|
342
309
|
const loadUrl = useCallback(async () => {
|
|
343
310
|
if (!fileReference) {
|
|
344
311
|
setUrl(null);
|
|
345
312
|
setIsLoading(false);
|
|
346
313
|
setError(null);
|
|
314
|
+
fileReferenceIdRef.current = null;
|
|
347
315
|
return;
|
|
348
316
|
}
|
|
349
317
|
if (!supabase) {
|
|
350
318
|
setUrl(null);
|
|
351
319
|
setIsLoading(false);
|
|
352
320
|
setError(new Error("Supabase client is required for URL generation"));
|
|
321
|
+
fileReferenceIdRef.current = null;
|
|
353
322
|
return;
|
|
354
323
|
}
|
|
355
|
-
if (
|
|
324
|
+
if (isLoadingRef.current || urlRef.current && fileReferenceIdRef.current === fileReference.id) {
|
|
356
325
|
return;
|
|
357
326
|
}
|
|
358
327
|
setIsLoading(true);
|
|
@@ -380,24 +349,49 @@ function useFileUrl(fileReference, options) {
|
|
|
380
349
|
} finally {
|
|
381
350
|
setIsLoading(false);
|
|
382
351
|
}
|
|
383
|
-
}, [fileReference, supabase, organisation_id
|
|
352
|
+
}, [fileReference, supabase, organisation_id]);
|
|
384
353
|
const clear = useCallback(() => {
|
|
385
354
|
setUrl(null);
|
|
386
355
|
setError(null);
|
|
387
356
|
setIsLoading(false);
|
|
388
357
|
fileReferenceIdRef.current = null;
|
|
358
|
+
urlRef.current = null;
|
|
389
359
|
}, []);
|
|
390
360
|
useEffect(() => {
|
|
391
|
-
if (autoLoad) {
|
|
392
|
-
|
|
361
|
+
if (!autoLoad) {
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
const currentFileId = fileReference?.id ?? null;
|
|
365
|
+
const previousFileId = fileReferenceIdRef.current;
|
|
366
|
+
if (!fileReference) {
|
|
367
|
+
if (previousFileId !== null) {
|
|
393
368
|
setUrl(null);
|
|
394
369
|
setError(null);
|
|
370
|
+
fileReferenceIdRef.current = null;
|
|
371
|
+
urlRef.current = null;
|
|
395
372
|
}
|
|
396
|
-
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
if (previousFileId !== null && previousFileId !== currentFileId) {
|
|
376
|
+
setUrl(null);
|
|
377
|
+
setError(null);
|
|
378
|
+
fileReferenceIdRef.current = null;
|
|
379
|
+
urlRef.current = null;
|
|
380
|
+
loadUrl();
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
if (previousFileId === null && currentFileId !== null) {
|
|
384
|
+
fileReferenceIdRef.current = currentFileId;
|
|
385
|
+
if (!isLoading && !url) {
|
|
397
386
|
loadUrl();
|
|
398
387
|
}
|
|
388
|
+
} else if (previousFileId === currentFileId && !url && !isLoading) {
|
|
389
|
+
if (fileReferenceIdRef.current !== currentFileId) {
|
|
390
|
+
fileReferenceIdRef.current = currentFileId;
|
|
391
|
+
}
|
|
392
|
+
loadUrl();
|
|
399
393
|
}
|
|
400
|
-
}, [fileReference
|
|
394
|
+
}, [fileReference, autoLoad, loadUrl, url, isLoading]);
|
|
401
395
|
return {
|
|
402
396
|
url,
|
|
403
397
|
isLoading,
|
|
@@ -426,7 +420,7 @@ function defaultGenerateFallbackText(fileName) {
|
|
|
426
420
|
if (words.length === 0) return "FL";
|
|
427
421
|
return words.map((word) => word.charAt(0).toUpperCase()).join("").substring(0, 3);
|
|
428
422
|
}
|
|
429
|
-
var FileDisplayContent =
|
|
423
|
+
var FileDisplayContent = React6__default.memo(function FileDisplayContent2({
|
|
430
424
|
isLoading,
|
|
431
425
|
error,
|
|
432
426
|
fileUrl,
|
|
@@ -1449,7 +1443,7 @@ var sizeClasses = {
|
|
|
1449
1443
|
xl: "size-16 text-xl",
|
|
1450
1444
|
"2xl": "size-20 text-2xl"
|
|
1451
1445
|
};
|
|
1452
|
-
var Avatar =
|
|
1446
|
+
var Avatar = React6.forwardRef(
|
|
1453
1447
|
({
|
|
1454
1448
|
table_name,
|
|
1455
1449
|
record_id,
|
|
@@ -1463,7 +1457,7 @@ var Avatar = React7.forwardRef(
|
|
|
1463
1457
|
size = "md",
|
|
1464
1458
|
...props
|
|
1465
1459
|
}, ref) => {
|
|
1466
|
-
const [imageError, setImageError] =
|
|
1460
|
+
const [imageError, setImageError] = React6.useState(false);
|
|
1467
1461
|
const { supabase } = useUnifiedAuth();
|
|
1468
1462
|
const canFetchFileId = Boolean(fileId && organisation_id && supabase);
|
|
1469
1463
|
const { fileReference, fileUrl: fileIdUrl, isLoading: fileIdLoading } = useFileReferenceById(
|
|
@@ -1480,10 +1474,10 @@ var Avatar = React7.forwardRef(
|
|
|
1480
1474
|
const fallbackClasses = "size-full grid place-items-center text-center text-sec-50 bg-sec-500";
|
|
1481
1475
|
const imageClasses = "object-cover size-full";
|
|
1482
1476
|
const containerClasses = cn(baseClasses, className);
|
|
1483
|
-
const handleImageError =
|
|
1477
|
+
const handleImageError = React6.useCallback(() => {
|
|
1484
1478
|
setImageError(true);
|
|
1485
1479
|
}, []);
|
|
1486
|
-
|
|
1480
|
+
React6.useEffect(() => {
|
|
1487
1481
|
if (src) {
|
|
1488
1482
|
setImageError(false);
|
|
1489
1483
|
}
|
|
@@ -1632,7 +1626,7 @@ function Badge({ className, variant = "solid-main-normal", ref, ...props }) {
|
|
|
1632
1626
|
);
|
|
1633
1627
|
}
|
|
1634
1628
|
Badge.displayName = "Badge";
|
|
1635
|
-
var Switch =
|
|
1629
|
+
var Switch = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1636
1630
|
SwitchPrimitive.Root,
|
|
1637
1631
|
{
|
|
1638
1632
|
className: cn(
|
|
@@ -1673,9 +1667,9 @@ var Switch = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
|
1673
1667
|
}
|
|
1674
1668
|
));
|
|
1675
1669
|
Switch.displayName = SwitchPrimitive.Root.displayName;
|
|
1676
|
-
var Tabs =
|
|
1670
|
+
var Tabs = React6.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx(TabsPrimitive.Root, { asChild: true, ...props, children: /* @__PURE__ */ jsx("section", { ref, className, children }) }));
|
|
1677
1671
|
Tabs.displayName = TabsPrimitive.Root.displayName || "Tabs";
|
|
1678
|
-
var TabsList =
|
|
1672
|
+
var TabsList = React6.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx(TabsPrimitive.List, { asChild: true, ...props, children: /* @__PURE__ */ jsx(
|
|
1679
1673
|
"nav",
|
|
1680
1674
|
{
|
|
1681
1675
|
ref,
|
|
@@ -1687,7 +1681,7 @@ var TabsList = React7.forwardRef(({ className, children, ...props }, ref) => /*
|
|
|
1687
1681
|
}
|
|
1688
1682
|
) }));
|
|
1689
1683
|
TabsList.displayName = TabsPrimitive.List.displayName || "TabsList";
|
|
1690
|
-
var TabsTrigger =
|
|
1684
|
+
var TabsTrigger = React6.forwardRef(({ className, variant, size, children, ...props }, ref) => {
|
|
1691
1685
|
return /* @__PURE__ */ jsx(TabsPrimitive.Trigger, { asChild: true, ...props, children: /* @__PURE__ */ jsx(
|
|
1692
1686
|
Button,
|
|
1693
1687
|
{
|
|
@@ -1706,7 +1700,7 @@ var TabsTrigger = React7.forwardRef(({ className, variant, size, children, ...pr
|
|
|
1706
1700
|
) });
|
|
1707
1701
|
});
|
|
1708
1702
|
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName || "TabsTrigger";
|
|
1709
|
-
var TabsContent =
|
|
1703
|
+
var TabsContent = React6.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx(TabsPrimitive.Content, { asChild: true, ...props, children: /* @__PURE__ */ jsx(
|
|
1710
1704
|
"aside",
|
|
1711
1705
|
{
|
|
1712
1706
|
ref,
|
|
@@ -1728,10 +1722,10 @@ var assignToRef = (ref, value) => {
|
|
|
1728
1722
|
}
|
|
1729
1723
|
ref.current = value;
|
|
1730
1724
|
};
|
|
1731
|
-
var Calendar =
|
|
1732
|
-
({ className, classNames, mode, components, locale, month: controlledMonth, onMonthChange: controlledOnMonthChange, onSelect, ...props }, ref) => {
|
|
1733
|
-
const tableRef =
|
|
1734
|
-
const setForwardedRef =
|
|
1725
|
+
var Calendar = React6.forwardRef(
|
|
1726
|
+
({ className, classNames, mode, components, locale, month: controlledMonth, onMonthChange: controlledOnMonthChange, onSelect, captionLayout, startMonth, endMonth, ...props }, ref) => {
|
|
1727
|
+
const tableRef = React6.useRef(null);
|
|
1728
|
+
const setForwardedRef = React6.useCallback(
|
|
1735
1729
|
(node) => {
|
|
1736
1730
|
tableRef.current = node;
|
|
1737
1731
|
if (!ref) {
|
|
@@ -1745,14 +1739,14 @@ var Calendar = React7.forwardRef(
|
|
|
1745
1739
|
},
|
|
1746
1740
|
[ref]
|
|
1747
1741
|
);
|
|
1748
|
-
const rootPropsRef =
|
|
1742
|
+
const rootPropsRef = React6.useRef(null);
|
|
1749
1743
|
const selected = props.selected;
|
|
1750
1744
|
const isMonthControlled = controlledMonth !== void 0;
|
|
1751
|
-
const [internalMonth, setInternalMonth] =
|
|
1745
|
+
const [internalMonth, setInternalMonth] = React6.useState(() => {
|
|
1752
1746
|
const now = /* @__PURE__ */ new Date();
|
|
1753
1747
|
return new Date(now.getFullYear(), now.getMonth(), 1);
|
|
1754
1748
|
});
|
|
1755
|
-
const month =
|
|
1749
|
+
const month = React6.useMemo(() => {
|
|
1756
1750
|
const monthToUse = isMonthControlled ? controlledMonth : internalMonth;
|
|
1757
1751
|
if (!monthToUse) {
|
|
1758
1752
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -1761,16 +1755,16 @@ var Calendar = React7.forwardRef(
|
|
|
1761
1755
|
const normalized = new Date(monthToUse.getFullYear(), monthToUse.getMonth(), 1);
|
|
1762
1756
|
return normalized;
|
|
1763
1757
|
}, [isMonthControlled, controlledMonth, internalMonth]);
|
|
1764
|
-
const handleMonthChange =
|
|
1758
|
+
const handleMonthChange = React6.useCallback((newMonth) => {
|
|
1765
1759
|
if (!isMonthControlled) {
|
|
1766
1760
|
setInternalMonth(newMonth);
|
|
1767
1761
|
}
|
|
1768
1762
|
controlledOnMonthChange?.(newMonth);
|
|
1769
1763
|
}, [isMonthControlled, controlledOnMonthChange]);
|
|
1770
|
-
const wrappedHandleMonthChange =
|
|
1764
|
+
const wrappedHandleMonthChange = React6.useCallback((newMonth) => {
|
|
1771
1765
|
handleMonthChange(newMonth);
|
|
1772
1766
|
}, [handleMonthChange]);
|
|
1773
|
-
const CustomRoot =
|
|
1767
|
+
const CustomRoot = React6.memo(({ children, rootRef: dayPickerRootRef, ...rootProps }) => {
|
|
1774
1768
|
const {
|
|
1775
1769
|
className: rootClassName,
|
|
1776
1770
|
style: rootStyle,
|
|
@@ -1786,29 +1780,100 @@ var Calendar = React7.forwardRef(
|
|
|
1786
1780
|
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
1787
1781
|
});
|
|
1788
1782
|
CustomRoot.displayName = "CustomRoot";
|
|
1789
|
-
const CustomMonths =
|
|
1790
|
-
|
|
1783
|
+
const CustomMonths = React6.memo(({ children }) => {
|
|
1784
|
+
const childrenArray = React6.Children.toArray(children);
|
|
1785
|
+
const filteredChildren = childrenArray.filter((child) => {
|
|
1786
|
+
if (!React6.isValidElement(child)) return true;
|
|
1787
|
+
const childType = child.type;
|
|
1788
|
+
const displayName = childType?.displayName || childType?.name;
|
|
1789
|
+
if (displayName === "MonthCaption" || displayName === "Dropdown" || displayName === "DropdownMonth" || displayName === "DropdownYear" || typeof childType === "string" && childType.includes("dropdown")) {
|
|
1790
|
+
return false;
|
|
1791
|
+
}
|
|
1792
|
+
if (childType === "div") {
|
|
1793
|
+
const childProps = child.props;
|
|
1794
|
+
if (childProps?.children) {
|
|
1795
|
+
const childChildren = React6.Children.toArray(childProps.children);
|
|
1796
|
+
const hasCaptionSpan = childChildren.some((cc) => {
|
|
1797
|
+
if (!React6.isValidElement(cc) || cc.type !== "span") return false;
|
|
1798
|
+
const spanProps = cc.props;
|
|
1799
|
+
return spanProps?.role === "status" && spanProps?.["aria-live"] === "polite";
|
|
1800
|
+
});
|
|
1801
|
+
if (hasCaptionSpan) {
|
|
1802
|
+
return false;
|
|
1803
|
+
}
|
|
1804
|
+
}
|
|
1805
|
+
}
|
|
1806
|
+
return true;
|
|
1807
|
+
});
|
|
1808
|
+
return /* @__PURE__ */ jsx(Fragment, { children: filteredChildren });
|
|
1791
1809
|
});
|
|
1792
1810
|
CustomMonths.displayName = "CustomMonths";
|
|
1793
|
-
const CustomMonthGrid =
|
|
1811
|
+
const CustomMonthGrid = React6.forwardRef((props2, forwardedRef) => {
|
|
1794
1812
|
return /* @__PURE__ */ jsx("table", { ref: forwardedRef, ...props2 });
|
|
1795
1813
|
});
|
|
1796
1814
|
CustomMonthGrid.displayName = "CustomMonthGrid";
|
|
1797
|
-
const
|
|
1815
|
+
const CustomMonthCaption = React6.memo(({ displayMonth, startMonth: captionStartMonth, endMonth: captionEndMonth, locale: captionLocale }) => {
|
|
1816
|
+
const { goToMonth } = useDayPicker();
|
|
1817
|
+
const calendarLocale = captionLocale || enAU;
|
|
1818
|
+
const fromDate = captionStartMonth || new Date(1900, 0);
|
|
1819
|
+
const toDate = captionEndMonth || new Date(2100, 11);
|
|
1820
|
+
const monthOptions = React6.useMemo(() => {
|
|
1821
|
+
const months = [];
|
|
1822
|
+
for (let i = 0; i < 12; i++) {
|
|
1823
|
+
const monthDate = new Date(displayMonth.getFullYear(), i, 1);
|
|
1824
|
+
const label = format(monthDate, "MMMM", { locale: calendarLocale });
|
|
1825
|
+
months.push({ value: i.toString(), label });
|
|
1826
|
+
}
|
|
1827
|
+
return months;
|
|
1828
|
+
}, [calendarLocale, displayMonth]);
|
|
1829
|
+
const yearOptions = React6.useMemo(() => {
|
|
1830
|
+
const years = [];
|
|
1831
|
+
const startYear = fromDate.getFullYear();
|
|
1832
|
+
const endYear = toDate.getFullYear();
|
|
1833
|
+
for (let year = startYear; year <= endYear; year++) {
|
|
1834
|
+
years.push({ value: year.toString(), label: year.toString() });
|
|
1835
|
+
}
|
|
1836
|
+
return years;
|
|
1837
|
+
}, [fromDate, toDate]);
|
|
1838
|
+
const currentMonth = displayMonth.getMonth();
|
|
1839
|
+
const currentYear = displayMonth.getFullYear();
|
|
1840
|
+
const handleMonthChange2 = React6.useCallback((value) => {
|
|
1841
|
+
const newMonth = parseInt(value, 10);
|
|
1842
|
+
const newDate = new Date(currentYear, newMonth, 1);
|
|
1843
|
+
goToMonth(newDate);
|
|
1844
|
+
}, [currentYear, goToMonth]);
|
|
1845
|
+
const handleYearChange = React6.useCallback((value) => {
|
|
1846
|
+
const newYear = parseInt(value, 10);
|
|
1847
|
+
const newDate = new Date(newYear, currentMonth, 1);
|
|
1848
|
+
goToMonth(newDate);
|
|
1849
|
+
}, [currentMonth, goToMonth]);
|
|
1850
|
+
return /* @__PURE__ */ jsxs("nav", { className: "relative flex items-center justify-center gap-2", children: [
|
|
1851
|
+
/* @__PURE__ */ jsxs(Select, { value: currentMonth.toString(), onValueChange: handleMonthChange2, children: [
|
|
1852
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: "w-auto min-w-[120px]", children: /* @__PURE__ */ jsx(SelectValue, {}) }),
|
|
1853
|
+
/* @__PURE__ */ jsx(SelectContent, { children: monthOptions.map((option) => /* @__PURE__ */ jsx(SelectItem, { value: option.value, children: option.label }, option.value)) })
|
|
1854
|
+
] }),
|
|
1855
|
+
/* @__PURE__ */ jsxs(Select, { value: currentYear.toString(), onValueChange: handleYearChange, children: [
|
|
1856
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: "w-auto min-w-[100px]", children: /* @__PURE__ */ jsx(SelectValue, {}) }),
|
|
1857
|
+
/* @__PURE__ */ jsx(SelectContent, { children: yearOptions.map((option) => /* @__PURE__ */ jsx(SelectItem, { value: option.value, children: option.label }, option.value)) })
|
|
1858
|
+
] })
|
|
1859
|
+
] });
|
|
1860
|
+
});
|
|
1861
|
+
CustomMonthCaption.displayName = "CustomMonthCaption";
|
|
1862
|
+
const CustomMonth = React6.memo(({ calendarMonth, displayIndex, className: className2, children, captionLayout: monthCaptionLayout, startMonth: monthStartMonth, endMonth: monthEndMonth }) => {
|
|
1798
1863
|
const { formatters, components: components2, labels, classNames: classNames2, previousMonth, nextMonth, goToMonth } = useDayPicker();
|
|
1799
1864
|
const caption = formatters.formatCaption(calendarMonth.date, {});
|
|
1800
1865
|
const Chevron = components2?.Chevron;
|
|
1801
|
-
const childrenArray =
|
|
1866
|
+
const childrenArray = React6.Children.toArray(children);
|
|
1802
1867
|
const monthGridIndex = childrenArray.findIndex((child) => {
|
|
1803
|
-
if (!
|
|
1868
|
+
if (!React6.isValidElement(child)) return false;
|
|
1804
1869
|
const childType = child.type;
|
|
1805
1870
|
return typeof childType === "function" && childType.displayName === "MonthGrid" || child.type === "table";
|
|
1806
1871
|
});
|
|
1807
1872
|
return /* @__PURE__ */ jsx(Fragment, { children: childrenArray.map((child, index) => {
|
|
1808
|
-
if (
|
|
1873
|
+
if (React6.isValidElement(child) && child.type?.displayName === "MonthCaption") {
|
|
1809
1874
|
return null;
|
|
1810
1875
|
}
|
|
1811
|
-
if (index === monthGridIndex &&
|
|
1876
|
+
if (index === monthGridIndex && React6.isValidElement(child)) {
|
|
1812
1877
|
const monthGridChild = child;
|
|
1813
1878
|
const applyRootProps = displayIndex === 0 && index === monthGridIndex;
|
|
1814
1879
|
const storedRootProps = applyRootProps ? rootPropsRef.current : null;
|
|
@@ -1858,7 +1923,8 @@ var Calendar = React7.forwardRef(
|
|
|
1858
1923
|
}
|
|
1859
1924
|
assignToRef(monthGridElement.ref, node);
|
|
1860
1925
|
} : void 0;
|
|
1861
|
-
|
|
1926
|
+
const isDropdownLayout = monthCaptionLayout === "dropdown";
|
|
1927
|
+
return React6.cloneElement(
|
|
1862
1928
|
monthGridElement,
|
|
1863
1929
|
{
|
|
1864
1930
|
key: child.key ?? `month-grid-${displayIndex}`,
|
|
@@ -1866,7 +1932,15 @@ var Calendar = React7.forwardRef(
|
|
|
1866
1932
|
...mergedRef ? { ref: mergedRef } : {}
|
|
1867
1933
|
},
|
|
1868
1934
|
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1869
|
-
/* @__PURE__ */ jsx("caption", { className: "relative", children: /* @__PURE__ */
|
|
1935
|
+
/* @__PURE__ */ jsx("caption", { className: "relative", children: isDropdownLayout ? /* @__PURE__ */ jsx(
|
|
1936
|
+
CustomMonthCaption,
|
|
1937
|
+
{
|
|
1938
|
+
displayMonth: calendarMonth.date,
|
|
1939
|
+
startMonth: monthStartMonth,
|
|
1940
|
+
endMonth: monthEndMonth,
|
|
1941
|
+
locale
|
|
1942
|
+
}
|
|
1943
|
+
) : /* @__PURE__ */ jsxs("nav", { className: "relative flex items-center justify-center gap-1", children: [
|
|
1870
1944
|
/* @__PURE__ */ jsx(
|
|
1871
1945
|
"button",
|
|
1872
1946
|
{
|
|
@@ -1913,24 +1987,40 @@ var Calendar = React7.forwardRef(
|
|
|
1913
1987
|
] })
|
|
1914
1988
|
);
|
|
1915
1989
|
}
|
|
1916
|
-
return
|
|
1990
|
+
return React6.isValidElement(child) ? React6.cloneElement(child, { key: child.key ?? `calendar-child-${index}` }) : child;
|
|
1917
1991
|
}) });
|
|
1918
1992
|
});
|
|
1919
1993
|
CustomMonth.displayName = "CustomMonth";
|
|
1920
|
-
const CustomWeekdays =
|
|
1994
|
+
const CustomWeekdays = React6.memo(({ className: className2, children, ...props2 }) => {
|
|
1921
1995
|
return /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", { className: cn("text-xs text-sec-500", className2), ...props2, children }) });
|
|
1922
1996
|
});
|
|
1923
1997
|
CustomWeekdays.displayName = "CustomWeekdays";
|
|
1924
|
-
const
|
|
1998
|
+
const CustomMonthWithProps = React6.useCallback((props2) => {
|
|
1999
|
+
return /* @__PURE__ */ jsx(
|
|
2000
|
+
CustomMonth,
|
|
2001
|
+
{
|
|
2002
|
+
...props2,
|
|
2003
|
+
captionLayout,
|
|
2004
|
+
startMonth,
|
|
2005
|
+
endMonth
|
|
2006
|
+
}
|
|
2007
|
+
);
|
|
2008
|
+
}, [captionLayout, startMonth, endMonth]);
|
|
2009
|
+
const CustomMonthCaptionWrapper = React6.memo((_props) => {
|
|
2010
|
+
return null;
|
|
2011
|
+
});
|
|
2012
|
+
CustomMonthCaptionWrapper.displayName = "CustomMonthCaptionWrapper";
|
|
2013
|
+
const defaultComponents = React6.useMemo(() => ({
|
|
1925
2014
|
Root: CustomRoot,
|
|
1926
2015
|
Months: CustomMonths,
|
|
1927
|
-
Month:
|
|
2016
|
+
Month: CustomMonthWithProps,
|
|
1928
2017
|
MonthGrid: CustomMonthGrid,
|
|
1929
|
-
// MonthCaption is
|
|
2018
|
+
// MonthCaption returns null - actual caption is rendered in CustomMonth inside <caption>
|
|
2019
|
+
MonthCaption: CustomMonthCaptionWrapper,
|
|
1930
2020
|
Weekdays: CustomWeekdays,
|
|
1931
2021
|
// Spread user components AFTER ours so ours take precedence
|
|
1932
2022
|
...components || {}
|
|
1933
|
-
}), [components, CustomRoot, CustomMonths,
|
|
2023
|
+
}), [components, CustomRoot, CustomMonths, CustomMonthWithProps, CustomMonthCaptionWrapper, CustomWeekdays]);
|
|
1934
2024
|
return /* @__PURE__ */ jsx(
|
|
1935
2025
|
DayPicker,
|
|
1936
2026
|
{
|
|
@@ -2008,7 +2098,7 @@ var Calendar = React7.forwardRef(
|
|
|
2008
2098
|
);
|
|
2009
2099
|
Calendar.displayName = "Calendar";
|
|
2010
2100
|
var ToastProvider = ToastPrimitives.Provider;
|
|
2011
|
-
var ToastViewport =
|
|
2101
|
+
var ToastViewport = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
2012
2102
|
ToastPrimitives.Viewport,
|
|
2013
2103
|
{
|
|
2014
2104
|
ref,
|
|
@@ -2021,7 +2111,7 @@ var ToastViewport = React7.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
2021
2111
|
}
|
|
2022
2112
|
));
|
|
2023
2113
|
ToastViewport.displayName = ToastPrimitives.Viewport.displayName;
|
|
2024
|
-
var Toast =
|
|
2114
|
+
var Toast = React6.forwardRef(({ className, ...props }, ref) => {
|
|
2025
2115
|
return /* @__PURE__ */ jsx(
|
|
2026
2116
|
ToastPrimitives.Root,
|
|
2027
2117
|
{
|
|
@@ -2036,7 +2126,7 @@ var Toast = React7.forwardRef(({ className, ...props }, ref) => {
|
|
|
2036
2126
|
);
|
|
2037
2127
|
});
|
|
2038
2128
|
Toast.displayName = ToastPrimitives.Root.displayName;
|
|
2039
|
-
var ToastAction =
|
|
2129
|
+
var ToastAction = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
2040
2130
|
ToastPrimitives.Action,
|
|
2041
2131
|
{
|
|
2042
2132
|
ref,
|
|
@@ -2049,7 +2139,7 @@ var ToastAction = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
2049
2139
|
}
|
|
2050
2140
|
));
|
|
2051
2141
|
ToastAction.displayName = ToastPrimitives.Action.displayName;
|
|
2052
|
-
var ToastClose =
|
|
2142
|
+
var ToastClose = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
2053
2143
|
ToastPrimitives.Close,
|
|
2054
2144
|
{
|
|
2055
2145
|
ref,
|
|
@@ -2064,7 +2154,7 @@ var ToastClose = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE_
|
|
|
2064
2154
|
}
|
|
2065
2155
|
));
|
|
2066
2156
|
ToastClose.displayName = ToastPrimitives.Close.displayName;
|
|
2067
|
-
var ToastTitle =
|
|
2157
|
+
var ToastTitle = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
2068
2158
|
ToastPrimitives.Title,
|
|
2069
2159
|
{
|
|
2070
2160
|
ref,
|
|
@@ -2074,7 +2164,7 @@ var ToastTitle = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE_
|
|
|
2074
2164
|
}
|
|
2075
2165
|
));
|
|
2076
2166
|
ToastTitle.displayName = ToastPrimitives.Title.displayName;
|
|
2077
|
-
var ToastDescription =
|
|
2167
|
+
var ToastDescription = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
2078
2168
|
ToastPrimitives.Description,
|
|
2079
2169
|
{
|
|
2080
2170
|
ref,
|
|
@@ -2438,7 +2528,7 @@ function FormField({
|
|
|
2438
2528
|
)
|
|
2439
2529
|
] });
|
|
2440
2530
|
}
|
|
2441
|
-
var LoginForm =
|
|
2531
|
+
var LoginForm = React6__default.memo(({
|
|
2442
2532
|
onSignIn,
|
|
2443
2533
|
onSuccess,
|
|
2444
2534
|
onError,
|
|
@@ -2565,7 +2655,6 @@ function ContextSelector({
|
|
|
2565
2655
|
error: eventError,
|
|
2566
2656
|
refreshEvents
|
|
2567
2657
|
} = useEvents();
|
|
2568
|
-
const { isSuperAdmin: isSuperAdmin2 } = useRBAC();
|
|
2569
2658
|
const isLoading = showOrganisations && orgLoading || showEvents && eventLoading;
|
|
2570
2659
|
const hasError = showOrganisations && orgError || showEvents && eventError;
|
|
2571
2660
|
const hasItems = showOrganisations && (organisations?.length || 0) > 0 || showEvents && (events?.length || 0) > 0;
|
|
@@ -2580,14 +2669,14 @@ function ContextSelector({
|
|
|
2580
2669
|
}, [showOrganisations, showEvents, selectedOrganisation?.id, selectedEvent]);
|
|
2581
2670
|
const displayValue = useMemo(() => {
|
|
2582
2671
|
if (showEvents && selectedEvent) {
|
|
2583
|
-
return /* @__PURE__ */ jsxs(
|
|
2584
|
-
/* @__PURE__ */ jsx(Calendar$1, { className: "size-4
|
|
2672
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2673
|
+
/* @__PURE__ */ jsx(Calendar$1, { className: "inline-block size-4 mr-2" }),
|
|
2585
2674
|
/* @__PURE__ */ jsx("span", { className: "truncate", children: selectedEvent.event_name })
|
|
2586
2675
|
] });
|
|
2587
2676
|
}
|
|
2588
2677
|
if (showOrganisations && selectedOrganisation) {
|
|
2589
|
-
return /* @__PURE__ */ jsxs(
|
|
2590
|
-
/* @__PURE__ */ jsx(Building2, { className: "size-4
|
|
2678
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2679
|
+
/* @__PURE__ */ jsx(Building2, { className: "inline-block size-4 mr-2" }),
|
|
2591
2680
|
/* @__PURE__ */ jsx("span", { className: "truncate", children: selectedOrganisation.display_name })
|
|
2592
2681
|
] });
|
|
2593
2682
|
}
|
|
@@ -2638,8 +2727,9 @@ function ContextSelector({
|
|
|
2638
2727
|
};
|
|
2639
2728
|
if (isLoading && !hasItems) {
|
|
2640
2729
|
const loadingText = compact ? "Loading..." : showOrganisations && showEvents ? "Loading organisations and events..." : showOrganisations ? "Loading organisations..." : "Loading events...";
|
|
2641
|
-
return /* @__PURE__ */ jsxs("
|
|
2730
|
+
return /* @__PURE__ */ jsxs("p", { className, children: [
|
|
2642
2731
|
/* @__PURE__ */ jsx(LoadingSpinner, { size: "sm" }),
|
|
2732
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
2643
2733
|
/* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: loadingText })
|
|
2644
2734
|
] });
|
|
2645
2735
|
}
|
|
@@ -2651,11 +2741,9 @@ function ContextSelector({
|
|
|
2651
2741
|
if (showEvents && eventError) {
|
|
2652
2742
|
errorMessages.push(`Failed to load events: ${eventError.message}`);
|
|
2653
2743
|
}
|
|
2654
|
-
return /* @__PURE__ */ jsxs("
|
|
2655
|
-
/* @__PURE__ */
|
|
2656
|
-
|
|
2657
|
-
/* @__PURE__ */ jsx(AlertDescription, { children: errorMessages.join(" ") })
|
|
2658
|
-
] }),
|
|
2744
|
+
return /* @__PURE__ */ jsxs(Alert, { variant: "destructive", className: `space-y-2 ${className}`, children: [
|
|
2745
|
+
/* @__PURE__ */ jsx(AlertCircle, { className: "size-4" }),
|
|
2746
|
+
/* @__PURE__ */ jsx(AlertDescription, { children: errorMessages.join(" ") }),
|
|
2659
2747
|
showRetryButton && /* @__PURE__ */ jsxs(
|
|
2660
2748
|
Button,
|
|
2661
2749
|
{
|
|
@@ -2675,11 +2763,9 @@ function ContextSelector({
|
|
|
2675
2763
|
if (!hasItems) {
|
|
2676
2764
|
if (showNoItemsMessage) {
|
|
2677
2765
|
const noItemsText = showOrganisations && showEvents ? "No organisations or events available. Please contact your administrator." : showOrganisations ? "No organisations available. Please contact your administrator." : "No events available. Please contact your administrator.";
|
|
2678
|
-
return /* @__PURE__ */ jsxs(
|
|
2679
|
-
/* @__PURE__ */
|
|
2680
|
-
|
|
2681
|
-
/* @__PURE__ */ jsx(AlertDescription, { children: noItemsText })
|
|
2682
|
-
] }),
|
|
2766
|
+
return /* @__PURE__ */ jsxs(Alert, { className: `space-y-2 ${className}`, children: [
|
|
2767
|
+
/* @__PURE__ */ jsx(AlertCircle, { className: "size-4" }),
|
|
2768
|
+
/* @__PURE__ */ jsx(AlertDescription, { children: noItemsText }),
|
|
2683
2769
|
showRetryButton && /* @__PURE__ */ jsxs(
|
|
2684
2770
|
Button,
|
|
2685
2771
|
{
|
|
@@ -2698,12 +2784,14 @@ function ContextSelector({
|
|
|
2698
2784
|
}
|
|
2699
2785
|
return null;
|
|
2700
2786
|
}
|
|
2701
|
-
return /* @__PURE__ */
|
|
2787
|
+
return /* @__PURE__ */ jsxs(
|
|
2702
2788
|
Select,
|
|
2703
2789
|
{
|
|
2704
2790
|
value: currentValue,
|
|
2705
2791
|
onValueChange: handleValueChange,
|
|
2706
2792
|
disabled: disabled || isLoading,
|
|
2793
|
+
className,
|
|
2794
|
+
"data-testid": "context-selector",
|
|
2707
2795
|
children: [
|
|
2708
2796
|
/* @__PURE__ */ jsx(
|
|
2709
2797
|
SelectTrigger,
|
|
@@ -2717,17 +2805,16 @@ function ContextSelector({
|
|
|
2717
2805
|
showOrganisations && organisations && organisations.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2718
2806
|
/* @__PURE__ */ jsxs(SelectGroup, { children: [
|
|
2719
2807
|
/* @__PURE__ */ jsx(SelectLabel, { children: "Organisations" }),
|
|
2720
|
-
organisations.map((org) => /* @__PURE__ */
|
|
2808
|
+
organisations.map((org) => /* @__PURE__ */ jsxs(
|
|
2721
2809
|
SelectItem,
|
|
2722
2810
|
{
|
|
2723
2811
|
value: `org:${org.id}`,
|
|
2724
|
-
children:
|
|
2725
|
-
/* @__PURE__ */ jsx(Building2, { className: "size-4" }),
|
|
2726
|
-
/* @__PURE__ */
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
] })
|
|
2812
|
+
children: [
|
|
2813
|
+
/* @__PURE__ */ jsx(Building2, { className: "inline-block size-4 mr-2" }),
|
|
2814
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: org.display_name }),
|
|
2815
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
2816
|
+
!compact && org.description && /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: org.description })
|
|
2817
|
+
]
|
|
2731
2818
|
},
|
|
2732
2819
|
org.id
|
|
2733
2820
|
))
|
|
@@ -2736,17 +2823,16 @@ function ContextSelector({
|
|
|
2736
2823
|
] }),
|
|
2737
2824
|
showEvents && events && events.length > 0 && /* @__PURE__ */ jsxs(SelectGroup, { children: [
|
|
2738
2825
|
/* @__PURE__ */ jsx(SelectLabel, { children: "Events" }),
|
|
2739
|
-
events.map((event) => /* @__PURE__ */
|
|
2826
|
+
events.map((event) => /* @__PURE__ */ jsxs(
|
|
2740
2827
|
SelectItem,
|
|
2741
2828
|
{
|
|
2742
2829
|
value: `event:${event.event_id || event.id}`,
|
|
2743
|
-
children:
|
|
2744
|
-
/* @__PURE__ */ jsx(Calendar$1, { className: "size-4" }),
|
|
2745
|
-
/* @__PURE__ */
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
] })
|
|
2830
|
+
children: [
|
|
2831
|
+
/* @__PURE__ */ jsx(Calendar$1, { className: " inline-block size-4 mr-2" }),
|
|
2832
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: event.event_name }),
|
|
2833
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
2834
|
+
!compact && event.event_date && /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: new Date(event.event_date).toLocaleDateString() })
|
|
2835
|
+
]
|
|
2750
2836
|
},
|
|
2751
2837
|
event.event_id || event.id
|
|
2752
2838
|
))
|
|
@@ -2754,7 +2840,7 @@ function ContextSelector({
|
|
|
2754
2840
|
] })
|
|
2755
2841
|
]
|
|
2756
2842
|
}
|
|
2757
|
-
)
|
|
2843
|
+
);
|
|
2758
2844
|
}
|
|
2759
2845
|
function PasswordChangeForm({ onSubmit, onSuccess, className }) {
|
|
2760
2846
|
const [newPassword, setNewPassword] = useState("");
|
|
@@ -2830,7 +2916,7 @@ function PasswordChangeForm({ onSubmit, onSuccess, className }) {
|
|
|
2830
2916
|
)
|
|
2831
2917
|
] });
|
|
2832
2918
|
}
|
|
2833
|
-
var UserMenu =
|
|
2919
|
+
var UserMenu = React6__default.memo(function UserMenu2({
|
|
2834
2920
|
user,
|
|
2835
2921
|
onSignOut,
|
|
2836
2922
|
onChangePassword,
|
|
@@ -2912,7 +2998,7 @@ var UserMenu = React7__default.memo(function UserMenu2({
|
|
|
2912
2998
|
] }) })
|
|
2913
2999
|
] });
|
|
2914
3000
|
});
|
|
2915
|
-
var UserMenuLoading =
|
|
3001
|
+
var UserMenuLoading = React6__default.memo(function UserMenuLoading2() {
|
|
2916
3002
|
return /* @__PURE__ */ jsxs(
|
|
2917
3003
|
Button,
|
|
2918
3004
|
{
|
|
@@ -2935,8 +3021,8 @@ function useNavigationFiltering({
|
|
|
2935
3021
|
itemsPreFiltered = false,
|
|
2936
3022
|
auditLog = true
|
|
2937
3023
|
}) {
|
|
2938
|
-
const [resolvedAppId, setResolvedAppId] =
|
|
2939
|
-
const previousFilteredItemsRef =
|
|
3024
|
+
const [resolvedAppId, setResolvedAppId] = React6.useState(void 0);
|
|
3025
|
+
const previousFilteredItemsRef = React6.useRef([]);
|
|
2940
3026
|
const authContext = useUnifiedAuth();
|
|
2941
3027
|
const rbacContext = useRBAC();
|
|
2942
3028
|
const eventLoadingRaw = authContext?.eventLoading;
|
|
@@ -2951,14 +3037,14 @@ function useNavigationFiltering({
|
|
|
2951
3037
|
selectedEventId: itemsPreFiltered ? null : selectedEvent?.event_id || null,
|
|
2952
3038
|
selectedEventOrganisationId: itemsPreFiltered ? null : selectedEvent?.organisation_id || null
|
|
2953
3039
|
});
|
|
2954
|
-
|
|
3040
|
+
React6.useEffect(() => {
|
|
2955
3041
|
if (!scopeLoading && !resolvedScope?.appId && selectedOrganisation?.id && authContext?.appName && authContext?.user?.id && !resolvedAppId) {
|
|
2956
3042
|
if (!authContext.user || !authContext.appName) {
|
|
2957
3043
|
return;
|
|
2958
3044
|
}
|
|
2959
3045
|
const userId2 = authContext.user.id;
|
|
2960
3046
|
const appName = authContext.appName;
|
|
2961
|
-
import('./api-
|
|
3047
|
+
import('./api-7P7DI652.js').then(({ resolveAppContext }) => {
|
|
2962
3048
|
resolveAppContext({
|
|
2963
3049
|
userId: userId2,
|
|
2964
3050
|
appName
|
|
@@ -2979,7 +3065,7 @@ function useNavigationFiltering({
|
|
|
2979
3065
|
authContext?.user?.id,
|
|
2980
3066
|
resolvedAppId
|
|
2981
3067
|
]);
|
|
2982
|
-
const effectiveScope =
|
|
3068
|
+
const effectiveScope = React6.useMemo(() => {
|
|
2983
3069
|
if (resolvedScope?.organisationId) {
|
|
2984
3070
|
return resolvedScope;
|
|
2985
3071
|
}
|
|
@@ -2994,7 +3080,7 @@ function useNavigationFiltering({
|
|
|
2994
3080
|
return null;
|
|
2995
3081
|
}, [resolvedScope, selectedOrganisation?.id, selectedEvent?.event_id, resolvedAppId]);
|
|
2996
3082
|
const scopeKey = effectiveScope ? `${effectiveScope.organisationId || ""}-${effectiveScope.eventId || ""}-${effectiveScope.appId || ""}` : "empty";
|
|
2997
|
-
const stableScope =
|
|
3083
|
+
const stableScope = React6.useMemo(() => {
|
|
2998
3084
|
if (effectiveScope?.organisationId) {
|
|
2999
3085
|
return {
|
|
3000
3086
|
organisationId: effectiveScope.organisationId,
|
|
@@ -3020,7 +3106,7 @@ function useNavigationFiltering({
|
|
|
3020
3106
|
itemsPreFiltered ? void 0 : stableScope.eventId,
|
|
3021
3107
|
itemsPreFiltered ? void 0 : stableScope.appId
|
|
3022
3108
|
);
|
|
3023
|
-
const filteredItems =
|
|
3109
|
+
const filteredItems = React6.useMemo(() => {
|
|
3024
3110
|
if (itemsPreFiltered && items && items.length > 0) {
|
|
3025
3111
|
const visibleItems = (items || []).filter((item) => !item.meta?.hidden);
|
|
3026
3112
|
previousFilteredItemsRef.current = visibleItems;
|
|
@@ -3199,7 +3285,7 @@ function useNavigationFiltering({
|
|
|
3199
3285
|
hasAnyPermission: hasAnyPermission || null
|
|
3200
3286
|
};
|
|
3201
3287
|
}
|
|
3202
|
-
var NavigationMenu =
|
|
3288
|
+
var NavigationMenu = React6.forwardRef(({
|
|
3203
3289
|
items,
|
|
3204
3290
|
mode = "dropdown",
|
|
3205
3291
|
currentPath,
|
|
@@ -3217,8 +3303,8 @@ var NavigationMenu = React7.forwardRef(({
|
|
|
3217
3303
|
itemsPreFiltered = false,
|
|
3218
3304
|
...props
|
|
3219
3305
|
}, ref) => {
|
|
3220
|
-
const [expandedItems, setExpandedItems] =
|
|
3221
|
-
const buttonRef =
|
|
3306
|
+
const [expandedItems, setExpandedItems] = React6.useState(/* @__PURE__ */ new Set());
|
|
3307
|
+
const buttonRef = React6.useRef(null);
|
|
3222
3308
|
const { authContext, rbacContext, filteredItems, permissionMap, hasAnyPermission } = useNavigationFiltering({ items, itemsPreFiltered, auditLog });
|
|
3223
3309
|
const handleHierarchicalKeyDown = (event, item) => {
|
|
3224
3310
|
switch (event.key) {
|
|
@@ -3360,7 +3446,7 @@ var NavigationMenu = React7.forwardRef(({
|
|
|
3360
3446
|
id: `submenu-${item.id}`,
|
|
3361
3447
|
role: "menu",
|
|
3362
3448
|
"aria-label": `${item.label} submenu`,
|
|
3363
|
-
children: item.children.map((child) => /* @__PURE__ */ jsx(
|
|
3449
|
+
children: item.children.map((child) => /* @__PURE__ */ jsx(React6.Fragment, { children: renderHierarchicalItem(child, level + 1) }, child.id))
|
|
3364
3450
|
}
|
|
3365
3451
|
)
|
|
3366
3452
|
] }) : /* @__PURE__ */ jsx(
|
|
@@ -3422,7 +3508,7 @@ var NavigationMenu = React7.forwardRef(({
|
|
|
3422
3508
|
className,
|
|
3423
3509
|
"aria-label": navigationLabel,
|
|
3424
3510
|
...props,
|
|
3425
|
-
children: /* @__PURE__ */ jsx("ul", { role: "menubar", children: filteredItems.map((item) => /* @__PURE__ */ jsx(
|
|
3511
|
+
children: /* @__PURE__ */ jsx("ul", { role: "menubar", children: filteredItems.map((item) => /* @__PURE__ */ jsx(React6.Fragment, { children: renderHierarchicalItem(item, 0) }, item.id)) })
|
|
3426
3512
|
}
|
|
3427
3513
|
);
|
|
3428
3514
|
});
|
|
@@ -3545,7 +3631,7 @@ var FooterComponent = ({
|
|
|
3545
3631
|
] }) });
|
|
3546
3632
|
};
|
|
3547
3633
|
FooterComponent.displayName = "Footer";
|
|
3548
|
-
var Footer =
|
|
3634
|
+
var Footer = React6__default.memo(FooterComponent);
|
|
3549
3635
|
Footer.displayName = "Footer";
|
|
3550
3636
|
var EMPTY_PAGE_ID_MAPPING = {};
|
|
3551
3637
|
var EMPTY_ROUTE_PERMISSIONS = {};
|
|
@@ -3747,7 +3833,7 @@ function PaceAppLayout({
|
|
|
3747
3833
|
return;
|
|
3748
3834
|
}
|
|
3749
3835
|
try {
|
|
3750
|
-
const { isSuperAdmin: checkSuperAdminDynamic } = await import('./api-
|
|
3836
|
+
const { isSuperAdmin: checkSuperAdminDynamic } = await import('./api-7P7DI652.js');
|
|
3751
3837
|
const isSuper = await checkSuperAdminDynamic(user.id);
|
|
3752
3838
|
if (isSuper) {
|
|
3753
3839
|
if (isMounted) {
|
|
@@ -3761,7 +3847,7 @@ function PaceAppLayout({
|
|
|
3761
3847
|
}
|
|
3762
3848
|
}
|
|
3763
3849
|
try {
|
|
3764
|
-
const { getPermissionMap } = await import('./api-
|
|
3850
|
+
const { getPermissionMap } = await import('./api-7P7DI652.js');
|
|
3765
3851
|
const permissionScope = {
|
|
3766
3852
|
organisationId: currentScope.organisationId,
|
|
3767
3853
|
eventId: currentScope.eventId,
|
|
@@ -3772,7 +3858,7 @@ function PaceAppLayout({
|
|
|
3772
3858
|
userId: user.id,
|
|
3773
3859
|
scope: permissionScope
|
|
3774
3860
|
});
|
|
3775
|
-
const { getPageScopeType } = await import('./api-
|
|
3861
|
+
const { getPageScopeType } = await import('./api-7P7DI652.js');
|
|
3776
3862
|
const effectiveAppId = currentScope.appId || resolvedAppId;
|
|
3777
3863
|
const effectiveAppName = appName;
|
|
3778
3864
|
const hasEventContext = !!currentScope.eventId;
|
|
@@ -3881,7 +3967,7 @@ function PaceAppLayout({
|
|
|
3881
3967
|
let hasAccess = true;
|
|
3882
3968
|
if (currentRoute.pageId && currentRoute.permissions && currentRoute.permissions.length > 0) {
|
|
3883
3969
|
try {
|
|
3884
|
-
const { isPermittedCached } = await import('./api-
|
|
3970
|
+
const { isPermittedCached } = await import('./api-7P7DI652.js');
|
|
3885
3971
|
const hasPagePermission = await isPermittedCached({
|
|
3886
3972
|
userId: user?.id || "",
|
|
3887
3973
|
scope,
|
|
@@ -3897,7 +3983,7 @@ function PaceAppLayout({
|
|
|
3897
3983
|
}
|
|
3898
3984
|
}
|
|
3899
3985
|
if (hasAccess && currentRoute.roles && currentRoute.roles.length > 0 && user?.id) {
|
|
3900
|
-
const { useUnifiedAuth: useUnifiedAuth2 } = await import('./UnifiedAuthProvider-
|
|
3986
|
+
const { useUnifiedAuth: useUnifiedAuth2 } = await import('./UnifiedAuthProvider-7SNDOWYD.js');
|
|
3901
3987
|
hasAccess = true;
|
|
3902
3988
|
}
|
|
3903
3989
|
if (!isMounted) return;
|
|
@@ -4311,7 +4397,7 @@ function ProtectedRoute({
|
|
|
4311
4397
|
return /* @__PURE__ */ jsx(Outlet, {});
|
|
4312
4398
|
}
|
|
4313
4399
|
if (isLoading && !sessionRestoration.hasTimedOut) {
|
|
4314
|
-
return loadingFallback || /* @__PURE__ */ jsx("
|
|
4400
|
+
return loadingFallback || /* @__PURE__ */ jsx("main", { className: "grid place-items-center size-full", children: /* @__PURE__ */ jsx(LoadingSpinner, {}) });
|
|
4315
4401
|
}
|
|
4316
4402
|
if (!isAuthenticated) {
|
|
4317
4403
|
if (sessionRestoration.hasTimedOut || sessionRestoration.restorationError) {
|
|
@@ -4326,13 +4412,13 @@ function ProtectedRoute({
|
|
|
4326
4412
|
}
|
|
4327
4413
|
const isTabVisible = typeof document !== "undefined" && !document.hidden;
|
|
4328
4414
|
if (tabJustBecameVisibleRef.current || isTabVisible && wasAuthenticatedRef.current && isLoading) {
|
|
4329
|
-
return loadingFallback || /* @__PURE__ */ jsx("
|
|
4415
|
+
return loadingFallback || /* @__PURE__ */ jsx("main", { className: "grid place-items-center size-full", children: /* @__PURE__ */ jsx(LoadingSpinner, {}) });
|
|
4330
4416
|
}
|
|
4331
4417
|
if (shouldRedirect) {
|
|
4332
4418
|
return /* @__PURE__ */ jsx(Navigate, { to: loginPath, replace: true });
|
|
4333
4419
|
}
|
|
4334
4420
|
if (isLoading) {
|
|
4335
|
-
return loadingFallback || /* @__PURE__ */ jsx("
|
|
4421
|
+
return loadingFallback || /* @__PURE__ */ jsx("main", { className: "grid place-items-center size-full", children: /* @__PURE__ */ jsx(LoadingSpinner, {}) });
|
|
4336
4422
|
}
|
|
4337
4423
|
return /* @__PURE__ */ jsx(Navigate, { to: loginPath, replace: true });
|
|
4338
4424
|
}
|
|
@@ -4340,7 +4426,7 @@ function ProtectedRoute({
|
|
|
4340
4426
|
return /* @__PURE__ */ jsx(Outlet, {});
|
|
4341
4427
|
}
|
|
4342
4428
|
if (!events || events.length === 0) {
|
|
4343
|
-
return noEventsFallback || /* @__PURE__ */ jsx("
|
|
4429
|
+
return noEventsFallback || /* @__PURE__ */ jsx("main", { className: "grid place-items-center text-center min-h-screen p-8", children: /* @__PURE__ */ jsxs(Alert, { variant: "destructive", className: "max-w-md", children: [
|
|
4344
4430
|
/* @__PURE__ */ jsx(AlertTitle, { children: "No Events Available" }),
|
|
4345
4431
|
/* @__PURE__ */ jsx(AlertDescription, { children: "You don't have access to any events. Please contact your administrator if you believe this is an error." })
|
|
4346
4432
|
] }) });
|
|
@@ -4388,7 +4474,16 @@ function FileUpload({
|
|
|
4388
4474
|
const [isResolvingAppId, setIsResolvingAppId] = useState(!app_id);
|
|
4389
4475
|
const [appIdError, setAppIdError] = useState(null);
|
|
4390
4476
|
const fileInputRef = useRef(null);
|
|
4477
|
+
const progressIntervalsRef = useRef(/* @__PURE__ */ new Map());
|
|
4391
4478
|
const { uploadFile, isLoading, error } = useFileReference(supabase);
|
|
4479
|
+
useEffect(() => {
|
|
4480
|
+
return () => {
|
|
4481
|
+
progressIntervalsRef.current.forEach((interval) => {
|
|
4482
|
+
clearInterval(interval);
|
|
4483
|
+
});
|
|
4484
|
+
progressIntervalsRef.current.clear();
|
|
4485
|
+
};
|
|
4486
|
+
}, []);
|
|
4392
4487
|
useEffect(() => {
|
|
4393
4488
|
if (app_id) {
|
|
4394
4489
|
setResolvedAppId(app_id);
|
|
@@ -4543,11 +4638,16 @@ function FileUpload({
|
|
|
4543
4638
|
return updated;
|
|
4544
4639
|
});
|
|
4545
4640
|
}, 200);
|
|
4641
|
+
progressIntervalsRef.current.set(fileId, progressInterval);
|
|
4546
4642
|
if (!resolvedAppId) {
|
|
4643
|
+
clearInterval(progressInterval);
|
|
4644
|
+
progressIntervalsRef.current.delete(fileId);
|
|
4547
4645
|
const errorMsg = appIdError || "App ID not available. Please provide app_id prop or set app name.";
|
|
4548
4646
|
throw new Error(errorMsg);
|
|
4549
4647
|
}
|
|
4550
4648
|
if (!pageContext) {
|
|
4649
|
+
clearInterval(progressInterval);
|
|
4650
|
+
progressIntervalsRef.current.delete(fileId);
|
|
4551
4651
|
const errorMsg = "pageContext is required for file upload. This is used for permission checks.";
|
|
4552
4652
|
throw new Error(errorMsg);
|
|
4553
4653
|
}
|
|
@@ -4565,6 +4665,7 @@ function FileUpload({
|
|
|
4565
4665
|
is_public: isPublic
|
|
4566
4666
|
}, file);
|
|
4567
4667
|
clearInterval(progressInterval);
|
|
4668
|
+
progressIntervalsRef.current.delete(fileId);
|
|
4568
4669
|
if (result) {
|
|
4569
4670
|
setUploadStates((prev) => {
|
|
4570
4671
|
const updated = new Map(prev);
|
|
@@ -4620,6 +4721,11 @@ function FileUpload({
|
|
|
4620
4721
|
onUploadError?.("Upload failed", file);
|
|
4621
4722
|
}
|
|
4622
4723
|
} catch (err) {
|
|
4724
|
+
const interval = progressIntervalsRef.current.get(fileId);
|
|
4725
|
+
if (interval) {
|
|
4726
|
+
clearInterval(interval);
|
|
4727
|
+
progressIntervalsRef.current.delete(fileId);
|
|
4728
|
+
}
|
|
4623
4729
|
const errorMessage = err instanceof Error ? err.message : "Upload failed";
|
|
4624
4730
|
setUploadStates((prev) => {
|
|
4625
4731
|
const updated = new Map(prev);
|
|
@@ -4689,9 +4795,9 @@ function FileUpload({
|
|
|
4689
4795
|
};
|
|
4690
4796
|
const dragClasses = isDragging ? "border-main-500 bg-main-50" : "border-sec-300 hover:border-sec-400";
|
|
4691
4797
|
const disabledClasses = isDisabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer hover:bg-sec-50";
|
|
4692
|
-
return /* @__PURE__ */ jsxs(
|
|
4798
|
+
return /* @__PURE__ */ jsxs(Card, { className, children: [
|
|
4693
4799
|
/* @__PURE__ */ jsxs(
|
|
4694
|
-
|
|
4800
|
+
CardHeader,
|
|
4695
4801
|
{
|
|
4696
4802
|
role: "button",
|
|
4697
4803
|
tabIndex: isDisabled ? -1 : 0,
|
|
@@ -4709,7 +4815,7 @@ function FileUpload({
|
|
|
4709
4815
|
}
|
|
4710
4816
|
} : void 0,
|
|
4711
4817
|
children: [
|
|
4712
|
-
children || /* @__PURE__ */ jsxs(
|
|
4818
|
+
children || /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4713
4819
|
/* @__PURE__ */ jsx(
|
|
4714
4820
|
"input",
|
|
4715
4821
|
{
|
|
@@ -4724,64 +4830,58 @@ function FileUpload({
|
|
|
4724
4830
|
"aria-label": accept ? `Upload file${multiple ? "s" : ""} (${accept})` : `Upload file${multiple ? "s" : ""}`
|
|
4725
4831
|
}
|
|
4726
4832
|
),
|
|
4727
|
-
/* @__PURE__ */ jsx("
|
|
4728
|
-
|
|
4833
|
+
/* @__PURE__ */ jsx("p", { className: "text-sec-600", children: isResolvingAppId ? "Resolving app configuration..." : isDragging ? "Drop files here..." : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4834
|
+
"Click to upload",
|
|
4729
4835
|
" ",
|
|
4730
4836
|
"or drag and drop"
|
|
4731
4837
|
] }) }),
|
|
4732
|
-
/* @__PURE__ */ jsxs("
|
|
4838
|
+
/* @__PURE__ */ jsxs("p", { className: "text-sm text-sec-500", children: [
|
|
4733
4839
|
!isResolvingAppId && accept !== "*/*" && `Accepted formats: ${accept}`,
|
|
4734
4840
|
!isResolvingAppId && maxSize && ` \u2022 Max size: ${Math.round(maxSize / 1024 / 1024)}MB`,
|
|
4735
4841
|
!isResolvingAppId && multiple && " \u2022 Multiple files allowed"
|
|
4736
4842
|
] })
|
|
4737
4843
|
] }),
|
|
4738
|
-
isUploading && !showProgress && /* @__PURE__ */ jsx(
|
|
4739
|
-
"div",
|
|
4740
|
-
{
|
|
4741
|
-
className: "absolute inset-0 bg-white bg-opacity-75 flex items-center justify-center",
|
|
4742
|
-
role: "status",
|
|
4743
|
-
"aria-live": "polite",
|
|
4744
|
-
"aria-label": "Uploading file",
|
|
4745
|
-
children: /* @__PURE__ */ jsx("div", { className: "animate-spin rounded-full size-8 border-b-2 border-main-500", "aria-hidden": "true" })
|
|
4746
|
-
}
|
|
4747
|
-
)
|
|
4844
|
+
isUploading && !showProgress && /* @__PURE__ */ jsx(LoadingSpinner, { size: "lg", className: "text-main-500" })
|
|
4748
4845
|
]
|
|
4749
4846
|
}
|
|
4750
4847
|
),
|
|
4751
|
-
showProgress && uploadStates.size > 0 && /* @__PURE__ */ jsx(
|
|
4848
|
+
showProgress && uploadStates.size > 0 && /* @__PURE__ */ jsx(CardContent, { children: Array.from(uploadStates.entries()).map(([fileId, uploadState]) => {
|
|
4752
4849
|
const { file, progress, preview, result } = uploadState;
|
|
4753
4850
|
const isError = progress.status === "error";
|
|
4754
4851
|
const isCompleted = progress.status === "completed";
|
|
4755
4852
|
const isUploading2 = progress.status === "uploading" || progress.status === "processing";
|
|
4756
4853
|
return /* @__PURE__ */ jsxs(
|
|
4757
|
-
|
|
4854
|
+
Card,
|
|
4758
4855
|
{
|
|
4759
|
-
className: `
|
|
4856
|
+
className: `grid grid-cols-[auto_1fr_auto] items-center gap-3 ${isError ? "bg-acc-50 border-acc-200" : isCompleted ? "bg-success-50 border-success-200" : "bg-sec-50 border-sec-200"}`,
|
|
4760
4857
|
children: [
|
|
4761
|
-
/* @__PURE__ */ jsx(
|
|
4858
|
+
/* @__PURE__ */ jsx(CardHeader, { className: "p-0", children: preview ? /* @__PURE__ */ jsx(
|
|
4762
4859
|
"img",
|
|
4763
4860
|
{
|
|
4764
4861
|
src: preview,
|
|
4765
4862
|
alt: file.name,
|
|
4766
|
-
className: "
|
|
4863
|
+
className: "size-12 object-cover rounded"
|
|
4767
4864
|
}
|
|
4768
|
-
) : /* @__PURE__ */ jsx(
|
|
4769
|
-
/* @__PURE__ */ jsxs(
|
|
4770
|
-
/* @__PURE__ */ jsx(
|
|
4771
|
-
/* @__PURE__ */ jsxs(
|
|
4865
|
+
) : /* @__PURE__ */ jsx(File, { className: "size-12 text-sec-600" }) }),
|
|
4866
|
+
/* @__PURE__ */ jsxs(CardContent, { className: "p-0 min-w-0", children: [
|
|
4867
|
+
/* @__PURE__ */ jsx(CardTitle, { className: "text-base truncate", children: file.name }),
|
|
4868
|
+
/* @__PURE__ */ jsxs(CardDescription, { children: [
|
|
4772
4869
|
formatFileSize(file.size),
|
|
4773
4870
|
isCompleted && result && " \u2022 Uploaded",
|
|
4774
4871
|
isError && progress.error && ` \u2022 ${progress.error}`
|
|
4775
4872
|
] }),
|
|
4776
|
-
showProgress && (isUploading2 || isError) && /* @__PURE__ */ jsxs(
|
|
4777
|
-
/* @__PURE__ */ jsx(
|
|
4778
|
-
|
|
4873
|
+
showProgress && (isUploading2 || isError) && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4874
|
+
/* @__PURE__ */ jsx(
|
|
4875
|
+
Progress,
|
|
4779
4876
|
{
|
|
4780
|
-
|
|
4781
|
-
|
|
4877
|
+
value: progress.percentage,
|
|
4878
|
+
max: 100,
|
|
4879
|
+
style: {
|
|
4880
|
+
accentColor: isError ? "var(--color-acc-500)" : "var(--color-main-500)"
|
|
4881
|
+
}
|
|
4782
4882
|
}
|
|
4783
|
-
)
|
|
4784
|
-
isUploading2 && /* @__PURE__ */ jsxs("
|
|
4883
|
+
),
|
|
4884
|
+
isUploading2 && /* @__PURE__ */ jsxs("p", { children: [
|
|
4785
4885
|
progress.percentage,
|
|
4786
4886
|
"% \u2022 ",
|
|
4787
4887
|
formatFileSize(progress.loaded),
|
|
@@ -4790,118 +4890,22 @@ function FileUpload({
|
|
|
4790
4890
|
] })
|
|
4791
4891
|
] })
|
|
4792
4892
|
] }),
|
|
4793
|
-
/* @__PURE__ */ jsxs(
|
|
4794
|
-
isCompleted && /* @__PURE__ */ jsx(
|
|
4795
|
-
isError && /* @__PURE__ */ jsx(
|
|
4796
|
-
isUploading2 && /* @__PURE__ */ jsx(
|
|
4797
|
-
"div",
|
|
4798
|
-
{
|
|
4799
|
-
className: "animate-spin rounded-full size-5 border-b-2 border-main-500",
|
|
4800
|
-
role: "status",
|
|
4801
|
-
"aria-label": "Uploading",
|
|
4802
|
-
"aria-hidden": "true"
|
|
4803
|
-
}
|
|
4804
|
-
)
|
|
4893
|
+
/* @__PURE__ */ jsxs(CardFooter, { className: "p-0", children: [
|
|
4894
|
+
isCompleted && /* @__PURE__ */ jsx(Check, { className: "text-success-500 size-5" }),
|
|
4895
|
+
isError && /* @__PURE__ */ jsx(X, { className: "text-acc-500 size-5" }),
|
|
4896
|
+
isUploading2 && /* @__PURE__ */ jsx(LoadingSpinner, { size: "sm", className: "text-main-500" })
|
|
4805
4897
|
] })
|
|
4806
4898
|
]
|
|
4807
4899
|
},
|
|
4808
4900
|
fileId
|
|
4809
4901
|
);
|
|
4810
4902
|
}) }),
|
|
4811
|
-
appIdError && /* @__PURE__ */
|
|
4812
|
-
"
|
|
4813
|
-
{
|
|
4814
|
-
|
|
4815
|
-
role: "alert",
|
|
4816
|
-
"aria-live": "assertive",
|
|
4817
|
-
children: appIdError
|
|
4818
|
-
}
|
|
4819
|
-
),
|
|
4820
|
-
error && /* @__PURE__ */ jsx(
|
|
4821
|
-
"div",
|
|
4822
|
-
{
|
|
4823
|
-
className: "p-3 bg-acc-50 border border-acc-200 rounded-lg text-sm text-acc-600",
|
|
4824
|
-
role: "alert",
|
|
4825
|
-
"aria-live": "assertive",
|
|
4826
|
-
children: error
|
|
4827
|
-
}
|
|
4828
|
-
)
|
|
4903
|
+
(appIdError || error) && /* @__PURE__ */ jsxs(CardFooter, { children: [
|
|
4904
|
+
appIdError && /* @__PURE__ */ jsx("p", { className: "grid place-items-center text-center size-full", role: "alert", "aria-live": "assertive", children: appIdError }),
|
|
4905
|
+
error && /* @__PURE__ */ jsx("p", { className: "grid place-items-center text-center size-full", role: "alert", "aria-live": "assertive", children: error })
|
|
4906
|
+
] })
|
|
4829
4907
|
] });
|
|
4830
4908
|
}
|
|
4831
|
-
var Table = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
4832
|
-
"table",
|
|
4833
|
-
{
|
|
4834
|
-
ref,
|
|
4835
|
-
className: cn("w-full caption-bottom text-sm", className),
|
|
4836
|
-
...props
|
|
4837
|
-
}
|
|
4838
|
-
));
|
|
4839
|
-
Table.displayName = "Table";
|
|
4840
|
-
var TableHeader = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("thead", { ref, className: cn("[&_tr]:border-b", className), ...props }));
|
|
4841
|
-
TableHeader.displayName = "TableHeader";
|
|
4842
|
-
var TableBody = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
4843
|
-
"tbody",
|
|
4844
|
-
{
|
|
4845
|
-
ref,
|
|
4846
|
-
className: cn("[&_tr:last-child]:border-0", className),
|
|
4847
|
-
...props
|
|
4848
|
-
}
|
|
4849
|
-
));
|
|
4850
|
-
TableBody.displayName = "TableBody";
|
|
4851
|
-
var TableFooter = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
4852
|
-
"tfoot",
|
|
4853
|
-
{
|
|
4854
|
-
ref,
|
|
4855
|
-
className: cn(
|
|
4856
|
-
"border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",
|
|
4857
|
-
className
|
|
4858
|
-
),
|
|
4859
|
-
...props
|
|
4860
|
-
}
|
|
4861
|
-
));
|
|
4862
|
-
TableFooter.displayName = "TableFooter";
|
|
4863
|
-
var TableRow = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
4864
|
-
"tr",
|
|
4865
|
-
{
|
|
4866
|
-
ref,
|
|
4867
|
-
className: cn(
|
|
4868
|
-
"border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",
|
|
4869
|
-
className
|
|
4870
|
-
),
|
|
4871
|
-
...props
|
|
4872
|
-
}
|
|
4873
|
-
));
|
|
4874
|
-
TableRow.displayName = "TableRow";
|
|
4875
|
-
var TableHead = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
4876
|
-
"th",
|
|
4877
|
-
{
|
|
4878
|
-
ref,
|
|
4879
|
-
className: cn(
|
|
4880
|
-
"h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",
|
|
4881
|
-
className
|
|
4882
|
-
),
|
|
4883
|
-
...props
|
|
4884
|
-
}
|
|
4885
|
-
));
|
|
4886
|
-
TableHead.displayName = "TableHead";
|
|
4887
|
-
var TableCell = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
4888
|
-
"td",
|
|
4889
|
-
{
|
|
4890
|
-
ref,
|
|
4891
|
-
className: cn("p-4 align-middle [&:has([role=checkbox])]:pr-0", className),
|
|
4892
|
-
...props
|
|
4893
|
-
}
|
|
4894
|
-
));
|
|
4895
|
-
TableCell.displayName = "TableCell";
|
|
4896
|
-
var TableCaption = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
4897
|
-
"caption",
|
|
4898
|
-
{
|
|
4899
|
-
ref,
|
|
4900
|
-
className: cn("mt-4 text-sm text-muted-foreground", className),
|
|
4901
|
-
...props
|
|
4902
|
-
}
|
|
4903
|
-
));
|
|
4904
|
-
TableCaption.displayName = "TableCaption";
|
|
4905
4909
|
function PublicPageHeader({
|
|
4906
4910
|
event,
|
|
4907
4911
|
eventCode,
|
|
@@ -5039,4 +5043,4 @@ function PublicPageLayout({
|
|
|
5039
5043
|
] }) });
|
|
5040
5044
|
}
|
|
5041
5045
|
|
|
5042
|
-
export { AddressField, Avatar, Badge, Calendar, ContextSelector, FileDisplay, FileUpload, Footer, Form, FormField, Header,
|
|
5046
|
+
export { AddressField, Avatar, Badge, Calendar, ContextSelector, FileDisplay, FileUpload, Footer, Form, FormField, Header, LoginForm, NavigationMenu, PaceAppLayout, PaceLoginPage, PasswordChangeForm, ProtectedRoute, PublicPageFooter, PublicPageHeader, PublicPageLayout, SessionRestorationLoader, Switch, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toast, ToastAction, ToastClose, ToastDescription, ToastProvider, ToastTitle, ToastViewport, Toaster, UserMenu, useFileReference, useFileReferenceById, useFileReferenceForRecord, useFilesByCategory };
|