@jmruthers/pace-core 0.5.183 → 0.5.185
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/CHANGELOG.md +38 -0
- package/README.md +60 -1
- package/core-usage-manifest.json +312 -0
- package/dist/{DataTable-QAB34V6K.js → DataTable-IX2NBUTP.js} +6 -6
- package/dist/{DataTable-Bz8ffqyA.d.ts → DataTable-Z9NLVJh0.d.ts} +1 -1
- package/dist/{index-Bl--n7-T.d.ts → PublicPageProvider-BABf6JCh.d.ts} +21 -10
- package/dist/{UnifiedAuthProvider-7F6T4B6K.js → UnifiedAuthProvider-A4BCQRJY.js} +4 -2
- package/dist/{UnifiedAuthProvider-F86d7dSi.d.ts → UnifiedAuthProvider-BG0AL5eE.d.ts} +2 -1
- package/dist/{api-ROMBCNKU.js → api-BMFCXVQX.js} +2 -2
- package/dist/{chunk-RA3JUFMW.js → chunk-445GEP27.js} +154 -4
- package/dist/{chunk-RA3JUFMW.js.map → chunk-445GEP27.js.map} +1 -1
- package/dist/{chunk-CSOFYHAG.js → chunk-AISXLWGZ.js} +374 -60
- package/dist/chunk-AISXLWGZ.js.map +1 -0
- package/dist/{chunk-FUEYYMX5.js → chunk-FXFJRTKI.js} +24 -3
- package/dist/chunk-FXFJRTKI.js.map +1 -0
- package/dist/{chunk-QETLRQI6.js → chunk-HC67NW5K.js} +380 -360
- package/dist/chunk-HC67NW5K.js.map +1 -0
- package/dist/chunk-HESYZWZW.js +388 -0
- package/dist/chunk-HESYZWZW.js.map +1 -0
- package/dist/{chunk-QUVSNGIP.js → chunk-HGPQUCBC.js} +34 -9
- package/dist/{chunk-QUVSNGIP.js.map → chunk-HGPQUCBC.js.map} +1 -1
- package/dist/{chunk-UHNYIBXL.js → chunk-IXSNYUCT.js} +1 -1
- package/dist/chunk-IXSNYUCT.js.map +1 -0
- package/dist/{chunk-MI7HBHN3.js → chunk-MX3EIJGQ.js} +4 -3
- package/dist/{chunk-MI7HBHN3.js.map → chunk-MX3EIJGQ.js.map} +1 -1
- package/dist/{chunk-PWAHJW4G.js → chunk-OKI34GZD.js} +86 -33
- package/dist/chunk-OKI34GZD.js.map +1 -0
- package/dist/{chunk-W22JP75J.js → chunk-STTZQK2I.js} +3 -3
- package/dist/chunk-THRPYOFK.js +215 -0
- package/dist/chunk-THRPYOFK.js.map +1 -0
- package/dist/{chunk-M7W4CP3M.js → chunk-U6WNSFX5.js} +2 -1
- package/dist/chunk-U6WNSFX5.js.map +1 -0
- package/dist/{chunk-QCDXODCA.js → chunk-XAUHJD3L.js} +2 -2
- package/dist/components.d.ts +182 -6
- package/dist/components.js +157 -11
- package/dist/components.js.map +1 -1
- package/dist/eslint-rules/pace-core-compliance.cjs +406 -0
- package/dist/{file-reference-D06mEEWW.d.ts → file-reference-BjR39ktt.d.ts} +7 -1
- package/dist/hooks.d.ts +7 -14
- package/dist/hooks.js +10 -22
- package/dist/hooks.js.map +1 -1
- package/dist/index.d.ts +11 -11
- package/dist/index.js +79 -16
- package/dist/index.js.map +1 -1
- package/dist/providers.d.ts +1 -1
- package/dist/providers.js +3 -1
- package/dist/rbac/index.d.ts +205 -14
- package/dist/rbac/index.js +28 -6
- package/dist/timezone-_pgH8qrY.d.ts +530 -0
- package/dist/{types-_x1f4QBF.d.ts → types-DUyCRSTj.d.ts} +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -1
- package/dist/{usePublicRouteParams-JJczomYq.d.ts → usePublicRouteParams-CvnC3d-e.d.ts} +113 -2
- package/dist/utils.d.ts +109 -151
- package/dist/utils.js +128 -138
- package/dist/utils.js.map +1 -1
- package/docs/api/README.md +60 -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/Logger.md +178 -0
- 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/RBACAuditManager.md +2 -2
- package/docs/api/classes/RBACCache.md +1 -1
- package/docs/api/classes/RBACEngine.md +2 -2
- package/docs/api/classes/RBACError.md +1 -1
- package/docs/api/classes/RBACNotInitializedError.md +1 -1
- package/docs/api/classes/SecureSupabaseClient.md +5 -5
- package/docs/api/classes/StorageUtils.md +1 -1
- package/docs/api/enums/FileCategory.md +1 -1
- package/docs/api/enums/LogLevel.md +54 -0
- package/docs/api/enums/RBACErrorCode.md +1 -1
- package/docs/api/enums/RPCFunction.md +1 -1
- package/docs/api/interfaces/AggregateConfig.md +1 -1
- package/docs/api/interfaces/BadgeProps.md +1 -1
- package/docs/api/interfaces/ButtonProps.md +1 -1
- package/docs/api/interfaces/CalendarProps.md +18 -2
- 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/ComplianceResult.md +30 -0
- 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/DatabaseComplianceResult.md +85 -0
- package/docs/api/interfaces/DatabaseIssue.md +41 -0
- package/docs/api/interfaces/EmptyStateConfig.md +1 -1
- package/docs/api/interfaces/EnhancedNavigationMenuProps.md +1 -1
- package/docs/api/interfaces/EventAppRoleData.md +6 -6
- package/docs/api/interfaces/ExportColumn.md +1 -1
- package/docs/api/interfaces/ExportOptions.md +1 -1
- package/docs/api/interfaces/FileDisplayProps.md +1 -1
- package/docs/api/interfaces/FileMetadata.md +1 -1
- package/docs/api/interfaces/FileReference.md +1 -1
- package/docs/api/interfaces/FileSizeLimits.md +1 -1
- package/docs/api/interfaces/FileUploadOptions.md +24 -8
- package/docs/api/interfaces/FileUploadProps.md +24 -13
- package/docs/api/interfaces/FooterProps.md +1 -1
- package/docs/api/interfaces/FormFieldProps.md +1 -1
- package/docs/api/interfaces/FormProps.md +1 -1
- package/docs/api/interfaces/GrantEventAppRoleParams.md +9 -9
- 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/LoggerConfig.md +62 -0
- 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 +36 -23
- 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 +11 -11
- 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/ProgressProps.md +1 -1
- package/docs/api/interfaces/ProtectedRouteProps.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/QuickFix.md +52 -0
- package/docs/api/interfaces/RBACAccessValidateParams.md +1 -1
- package/docs/api/interfaces/RBACAccessValidateResult.md +1 -1
- package/docs/api/interfaces/RBACAuditLogParams.md +1 -1
- package/docs/api/interfaces/RBACAuditLogResult.md +1 -1
- package/docs/api/interfaces/RBACConfig.md +4 -4
- package/docs/api/interfaces/RBACContext.md +1 -1
- package/docs/api/interfaces/RBACLogger.md +1 -1
- package/docs/api/interfaces/RBACPageAccessCheckParams.md +1 -1
- package/docs/api/interfaces/RBACPermissionCheckParams.md +1 -1
- package/docs/api/interfaces/RBACPermissionCheckResult.md +1 -1
- package/docs/api/interfaces/RBACPermissionsGetParams.md +1 -1
- package/docs/api/interfaces/RBACPermissionsGetResult.md +1 -1
- package/docs/api/interfaces/RBACResult.md +1 -1
- package/docs/api/interfaces/RBACRoleGrantParams.md +1 -1
- package/docs/api/interfaces/RBACRoleGrantResult.md +1 -1
- package/docs/api/interfaces/RBACRoleRevokeParams.md +1 -1
- package/docs/api/interfaces/RBACRoleRevokeResult.md +1 -1
- package/docs/api/interfaces/RBACRoleValidateParams.md +1 -1
- package/docs/api/interfaces/RBACRoleValidateResult.md +1 -1
- package/docs/api/interfaces/RBACRolesListParams.md +1 -1
- package/docs/api/interfaces/RBACRolesListResult.md +1 -1
- package/docs/api/interfaces/RBACSessionTrackParams.md +1 -1
- package/docs/api/interfaces/RBACSessionTrackResult.md +1 -1
- package/docs/api/interfaces/ResourcePermissions.md +1 -1
- package/docs/api/interfaces/RevokeEventAppRoleParams.md +7 -7
- package/docs/api/interfaces/RoleBasedRouterContextType.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterProps.md +1 -1
- package/docs/api/interfaces/RoleManagementResult.md +5 -5
- package/docs/api/interfaces/RouteAccessRecord.md +1 -1
- package/docs/api/interfaces/RouteConfig.md +1 -1
- package/docs/api/interfaces/RuntimeComplianceResult.md +55 -0
- package/docs/api/interfaces/SecureDataContextType.md +1 -1
- package/docs/api/interfaces/SecureDataProviderProps.md +1 -1
- package/docs/api/interfaces/SessionRestorationLoaderProps.md +1 -1
- package/docs/api/interfaces/SetupIssue.md +41 -0
- 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/TabsContentProps.md +1 -1
- package/docs/api/interfaces/TabsListProps.md +1 -1
- package/docs/api/interfaces/TabsProps.md +1 -1
- package/docs/api/interfaces/TabsTriggerProps.md +1 -1
- package/docs/api/interfaces/TextareaProps.md +1 -1
- package/docs/api/interfaces/ToastActionElement.md +1 -1
- package/docs/api/interfaces/ToastProps.md +1 -1
- package/docs/api/interfaces/UnifiedAuthContextType.md +1 -1
- package/docs/api/interfaces/UnifiedAuthProviderProps.md +1 -1
- package/docs/api/interfaces/UseFormDialogOptions.md +62 -0
- package/docs/api/interfaces/UseFormDialogReturn.md +117 -0
- package/docs/api/interfaces/UseInactivityTrackerOptions.md +1 -1
- package/docs/api/interfaces/UseInactivityTrackerReturn.md +1 -1
- package/docs/api/interfaces/UsePublicEventLogoOptions.md +2 -2
- package/docs/api/interfaces/UsePublicEventLogoReturn.md +1 -1
- package/docs/api/interfaces/UsePublicEventOptions.md +1 -1
- package/docs/api/interfaces/UsePublicEventReturn.md +1 -1
- package/docs/api/interfaces/UsePublicFileDisplayOptions.md +2 -2
- package/docs/api/interfaces/UsePublicFileDisplayReturn.md +1 -1
- package/docs/api/interfaces/UsePublicRouteParamsReturn.md +1 -1
- package/docs/api/interfaces/UseResolvedScopeOptions.md +2 -2
- package/docs/api/interfaces/UseResolvedScopeReturn.md +1 -1
- package/docs/api/interfaces/UseResourcePermissionsOptions.md +1 -1
- package/docs/api/interfaces/UserEventAccess.md +1 -1
- package/docs/api/interfaces/UserMenuProps.md +1 -1
- package/docs/api/interfaces/UserProfile.md +1 -1
- package/docs/api/modules.md +738 -42
- package/docs/api-reference/hooks.md +111 -0
- package/docs/api-reference/rpc-functions.md +1 -1
- package/docs/api-reference/utilities.md +184 -0
- package/docs/getting-started/installation-guide.md +75 -16
- package/docs/getting-started/quick-start.md +61 -11
- package/docs/implementation-guides/authentication.md +88 -12
- package/docs/implementation-guides/file-reference-system.md +2 -1
- package/docs/implementation-guides/file-upload-storage.md +21 -0
- package/docs/rbac/README.md +1 -0
- package/docs/rbac/compliance/compliance-guide.md +544 -0
- package/docs/rbac/getting-started.md +158 -33
- package/docs/standards/pace-core-compliance.md +432 -0
- package/eslint-config-pace-core.cjs +93 -0
- package/package.json +15 -3
- package/scripts/analyze-bundle.js +232 -0
- package/scripts/build-css.js +56 -0
- package/scripts/build-docs-incremental.js +1015 -0
- package/scripts/check-pace-core-compliance.cjs +2353 -0
- package/scripts/generate-docs.js +157 -0
- package/scripts/setup-build-cache.js +73 -0
- package/scripts/utils/command-runner.js +131 -0
- package/scripts/utils/env.js +33 -0
- package/scripts/utils/index.js +10 -0
- package/scripts/utils/logger.js +88 -0
- package/scripts/utils/path-helpers.js +37 -0
- package/scripts/validate-formats.js +133 -0
- package/scripts/validate-master.js +155 -0
- package/scripts/validate-pre-publish.js +140 -0
- package/scripts/validate-theme.js +142 -0
- package/src/components/Calendar/Calendar.tsx +8 -1
- package/src/components/Card/Card.tsx +47 -8
- package/src/components/DatePickerWithTimezone/DatePickerWithTimezone.test.tsx +314 -0
- package/src/components/DatePickerWithTimezone/DatePickerWithTimezone.tsx +126 -0
- package/src/components/DatePickerWithTimezone/README.md +135 -0
- package/src/components/DatePickerWithTimezone/index.ts +10 -0
- package/src/components/DateTimeField/DateTimeField.test.tsx +358 -0
- package/src/components/DateTimeField/DateTimeField.tsx +232 -0
- package/src/components/DateTimeField/README.md +148 -0
- package/src/components/DateTimeField/index.ts +10 -0
- package/src/components/FileUpload/FileUpload.tsx +3 -0
- package/src/components/Header/Header.test.tsx +47 -18
- package/src/components/Header/Header.tsx +24 -6
- package/src/components/PaceAppLayout/PaceAppLayout.tsx +29 -20
- package/src/components/PaceAppLayout/README.md +9 -0
- package/src/components/PaceLoginPage/PaceLoginPage.tsx +1 -1
- package/src/components/ProtectedRoute/ProtectedRoute.test.tsx +37 -8
- package/src/components/ProtectedRoute/ProtectedRoute.tsx +12 -4
- package/src/components/index.ts +8 -0
- package/src/eslint-rules/pace-core-compliance.cjs +406 -0
- package/src/eslint-rules/pace-core-compliance.js +640 -0
- package/src/hooks/__tests__/useFormDialog.test.ts +478 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useFileReference.test.ts +1 -0
- package/src/hooks/useFormDialog.ts +147 -0
- package/src/index.ts +27 -0
- package/src/providers/services/OrganisationServiceProvider.tsx +6 -5
- package/src/providers/services/UnifiedAuthProvider.tsx +24 -3
- package/src/rbac/__tests__/scenarios.user-role.test.tsx +3 -0
- package/src/rbac/compliance/database-validator.ts +165 -0
- package/src/rbac/compliance/index.ts +38 -0
- package/src/rbac/compliance/quick-fix-suggestions.ts +209 -0
- package/src/rbac/compliance/runtime-compliance.ts +77 -0
- package/src/rbac/compliance/setup-validator.ts +131 -0
- package/src/rbac/components/PagePermissionGuard.tsx +8 -64
- package/src/rbac/components/__tests__/PagePermissionGuard.test.tsx +35 -21
- package/src/rbac/docs/event-based-apps.md +285 -0
- package/src/rbac/errors.ts +11 -0
- package/src/rbac/hooks/useRoleManagement.ts +292 -12
- package/src/rbac/index.ts +30 -0
- package/src/services/OrganisationService.ts +4 -0
- package/src/types/file-reference.ts +6 -0
- package/src/utils/__tests__/timezone.test.ts +345 -0
- package/src/utils/file-reference/__tests__/file-reference.test.ts +2 -0
- package/src/utils/file-reference/index.ts +1 -0
- package/src/utils/formatting/formatDateTimeTimezone.test.ts +167 -0
- package/src/utils/formatting/formatting.ts +179 -0
- package/src/utils/index.ts +27 -1
- package/src/utils/location/index.ts +16 -0
- package/src/utils/location/location.test.ts +286 -0
- package/src/utils/location/location.ts +175 -0
- package/src/utils/timezone/index.ts +17 -0
- package/src/utils/timezone/timezone.test.ts +349 -0
- package/src/utils/timezone/timezone.ts +281 -0
- package/dist/chunk-CSOFYHAG.js.map +0 -1
- package/dist/chunk-FUEYYMX5.js.map +0 -1
- package/dist/chunk-HKIT6O7W.js +0 -198
- package/dist/chunk-HKIT6O7W.js.map +0 -1
- package/dist/chunk-KUEN3HFB.js +0 -94
- package/dist/chunk-KUEN3HFB.js.map +0 -1
- package/dist/chunk-M7W4CP3M.js.map +0 -1
- package/dist/chunk-PWAHJW4G.js.map +0 -1
- package/dist/chunk-QETLRQI6.js.map +0 -1
- package/dist/chunk-UHNYIBXL.js.map +0 -1
- package/dist/formatting-5wETwiGF.d.ts +0 -162
- /package/dist/{DataTable-QAB34V6K.js.map → DataTable-IX2NBUTP.js.map} +0 -0
- /package/dist/{UnifiedAuthProvider-7F6T4B6K.js.map → UnifiedAuthProvider-A4BCQRJY.js.map} +0 -0
- /package/dist/{api-ROMBCNKU.js.map → api-BMFCXVQX.js.map} +0 -0
- /package/dist/{chunk-W22JP75J.js.map → chunk-STTZQK2I.js.map} +0 -0
- /package/dist/{chunk-QCDXODCA.js.map → chunk-XAUHJD3L.js.map} +0 -0
package/dist/components.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { a as UnifiedAuthContextType,
|
|
2
|
-
export { A as Alert,
|
|
1
|
+
export { a as UnifiedAuthContextType, d as UnifiedAuthProvider, c as UnifiedAuthProviderProps, u as useUnifiedAuth } from './UnifiedAuthProvider-BG0AL5eE.js';
|
|
2
|
+
export { A as Alert, n as AlertDescription, m as AlertTitle, o as Avatar, q as AvatarFallback, p as AvatarImage, r as Badge, s as BadgeProps, t as BadgeVariant, B as Button, a as ButtonProps, al as Calendar, am as CalendarProps, 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, u as Checkbox, J as Dialog, U as DialogBody, O as DialogClose, Q as DialogContent, _ as DialogContentProps, X as DialogDescription, a3 as DialogDescriptionProps, V as DialogFooter, a1 as DialogFooterProps, R as DialogHeader, a0 as DialogHeaderProps, M as DialogOverlay, $ as DialogOverlayProps, K as DialogPortal, Y as DialogProps, a4 as DialogSize, W as DialogTitle, a2 as DialogTitleProps, N as DialogTrigger, Z as DialogTriggerProps, aT as ErrorBoundary, aU as ErrorBoundaryProps, aV as ErrorBoundaryState, aZ as EventSelector, b0 as FileDisplay, b1 as FileDisplayProps, a_ as FileUpload, a$ as FileUploadProps, aJ as Footer, aK as FooterProps, aC as Form, aD as FormField, aF as FormFieldProps, aE as FormProps, aI as Header, I as Input, j as InputProps, L as Label, k as LabelProps, aW as LoadingSpinner, aG as LoginForm, aH as LoginFormProps, aP as NavigationItem, aN as NavigationMenu, aO as NavigationMenuProps, aQ as OrganisationSelector, aR as OrganisationSelectorProps, bj as PaceAppLayout, bi as PaceAppLayoutProps, bl as PaceLoginPage, bk as PaceLoginPageProps, P as Progress, w as ProgressProps, aL as ProtectedRoute, aM as ProtectedRouteProps, bb as PublicPageFooter, bh as PublicPageFooterProps, ba as PublicPageHeader, bg as PublicPageHeaderProps, b9 as PublicPageLayout, bf as PublicPageLayoutProps, bc as PublicPageProvider, a5 as Select, a9 as SelectContent, a6 as SelectGroup, ab as SelectItem, aa as SelectLabel, ac as SelectSeparator, a8 as SelectTrigger, a7 as SelectValue, aX as SessionRestorationLoader, aY as SessionRestorationLoaderProps, S as Switch, v as SwitchProps, x as Table, z as TableBody, D as TableCaption, E as TableCell, F as TableFooter, G as TableHead, y as TableHeader, H as TableRow, ad as Tabs, ag as TabsContent, ak as TabsContentProps, ae as TabsList, ai as TabsListProps, ah as TabsProps, af as TabsTrigger, aj as TabsTriggerProps, T as Textarea, l as TextareaProps, an as Toast, ap as ToastAction, av as ToastActionElement, au as ToastClose, at as ToastDescription, aw as ToastProps, aq as ToastProvider, as as ToastTitle, ar as ToastViewport, ao as Toaster, ax as Tooltip, az as TooltipContent, aA as TooltipProvider, aB as TooltipRoot, ay as TooltipTrigger, b8 as UseFileReferenceForRecordReturn, b6 as UseFileReferenceOptions, b7 as UseFileReferenceReturn, aS as UserMenu, b2 as useFileReference, b4 as useFileReferenceById, b3 as useFileReferenceForRecord, b5 as useFilesByCategory, be as useIsPublicPage, bd as usePublicPageContext } from './PublicPageProvider-BABf6JCh.js';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
4
|
export { u as useToast } from './useToast-C8gR5ir4.js';
|
|
4
|
-
export { D as DataTable, a as DataTableProps } from './DataTable-
|
|
5
|
-
export { A as AggregateConfig,
|
|
6
|
-
export {
|
|
7
|
-
import 'react/jsx-runtime';
|
|
5
|
+
export { D as DataTable, a as DataTableProps } from './DataTable-Z9NLVJh0.js';
|
|
6
|
+
export { A as AggregateConfig, c as DataRecord, a as DataTableAction, D as DataTableColumn, b as DataTableToolbarButton, E as EmptyStateConfig, G as GetRowId } from './types-DUyCRSTj.js';
|
|
7
|
+
export { F as FileCategory, b as FileMetadata, a as FileReference, c as FileUploadOptions } from './file-reference-BjR39ktt.js';
|
|
8
8
|
import 'react';
|
|
9
9
|
import '@supabase/supabase-js';
|
|
10
10
|
import './event-CW5YB_2p.js';
|
|
@@ -24,3 +24,179 @@ import 'react-hook-form';
|
|
|
24
24
|
import 'zod';
|
|
25
25
|
import './types-UU913iLA.js';
|
|
26
26
|
import '@tanstack/react-table';
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @file DateTimeField Component
|
|
30
|
+
* @package @jmruthers/pace-core
|
|
31
|
+
* @module Components/DateTimeField
|
|
32
|
+
* @since 0.1.0
|
|
33
|
+
*
|
|
34
|
+
* Form input component for datetime values with timezone support.
|
|
35
|
+
* Handles UTC ↔ timezone conversion automatically.
|
|
36
|
+
*
|
|
37
|
+
* Features:
|
|
38
|
+
* - Automatic UTC ↔ timezone conversion
|
|
39
|
+
* - Prevents unwanted conversions during user editing
|
|
40
|
+
* - Shows timezone information when not UTC
|
|
41
|
+
* - Supports both ISO string and Date object values
|
|
42
|
+
* - Uses native datetime-local input type
|
|
43
|
+
* - Accessible form field with proper labels
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```tsx
|
|
47
|
+
* import { DateTimeField } from '@jmruthers/pace-core/components';
|
|
48
|
+
* import { useState } from 'react';
|
|
49
|
+
*
|
|
50
|
+
* function EventForm() {
|
|
51
|
+
* const [startTime, setStartTime] = useState<string>();
|
|
52
|
+
*
|
|
53
|
+
* return (
|
|
54
|
+
* <DateTimeField
|
|
55
|
+
* label="Start Time"
|
|
56
|
+
* value={startTime}
|
|
57
|
+
* onChange={setStartTime}
|
|
58
|
+
* timezone="America/New_York"
|
|
59
|
+
* required
|
|
60
|
+
* />
|
|
61
|
+
* );
|
|
62
|
+
* }
|
|
63
|
+
* ```
|
|
64
|
+
*
|
|
65
|
+
* @accessibility
|
|
66
|
+
* - Proper label association with htmlFor
|
|
67
|
+
* - Required field indicators
|
|
68
|
+
* - Screen reader friendly
|
|
69
|
+
* - Keyboard navigation support
|
|
70
|
+
* - Focus management
|
|
71
|
+
*/
|
|
72
|
+
/**
|
|
73
|
+
* Props for the DateTimeField component
|
|
74
|
+
*/
|
|
75
|
+
interface DateTimeFieldProps {
|
|
76
|
+
/**
|
|
77
|
+
* Field label
|
|
78
|
+
*/
|
|
79
|
+
label: string;
|
|
80
|
+
/**
|
|
81
|
+
* UTC date value (ISO string, Date object, or undefined)
|
|
82
|
+
*/
|
|
83
|
+
value: string | Date | undefined;
|
|
84
|
+
/**
|
|
85
|
+
* Change handler that receives UTC value (ISO string or Date object)
|
|
86
|
+
*/
|
|
87
|
+
onChange: (value: string | Date | undefined) => void;
|
|
88
|
+
/**
|
|
89
|
+
* Target timezone for display (default: 'UTC')
|
|
90
|
+
*/
|
|
91
|
+
timezone?: string;
|
|
92
|
+
/**
|
|
93
|
+
* Whether the field is required
|
|
94
|
+
*/
|
|
95
|
+
required?: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Additional CSS classes
|
|
98
|
+
*/
|
|
99
|
+
className?: string;
|
|
100
|
+
/**
|
|
101
|
+
* If true, onChange returns Date object instead of ISO string
|
|
102
|
+
*/
|
|
103
|
+
returnAsDate?: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Input id (auto-generated if not provided)
|
|
106
|
+
*/
|
|
107
|
+
id?: string;
|
|
108
|
+
/**
|
|
109
|
+
* Helper text to display below the label
|
|
110
|
+
*/
|
|
111
|
+
helperText?: string;
|
|
112
|
+
/**
|
|
113
|
+
* Error message to display
|
|
114
|
+
*/
|
|
115
|
+
error?: string;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* DateTimeField component
|
|
119
|
+
* Form input for datetime values with automatic timezone conversion
|
|
120
|
+
*
|
|
121
|
+
* @param props - DateTimeField configuration
|
|
122
|
+
* @returns JSX.Element - The rendered datetime field
|
|
123
|
+
*/
|
|
124
|
+
declare function DateTimeField({ label, value, onChange, timezone, required, className, returnAsDate, id, helperText, error }: DateTimeFieldProps): react_jsx_runtime.JSX.Element;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* @file DatePickerWithTimezone Component
|
|
128
|
+
* @package @jmruthers/pace-core
|
|
129
|
+
* @module Components/DatePickerWithTimezone
|
|
130
|
+
* @since 0.1.0
|
|
131
|
+
*
|
|
132
|
+
* Date picker component that displays timezone information alongside the calendar.
|
|
133
|
+
* Provides a calendar interface with timezone context for date selection.
|
|
134
|
+
*
|
|
135
|
+
* Features:
|
|
136
|
+
* - Calendar date selection
|
|
137
|
+
* - Timezone display (shows "Local" when matches user timezone)
|
|
138
|
+
* - Optional "Done" button
|
|
139
|
+
* - Accessible date selection
|
|
140
|
+
* - Keyboard navigation support
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* ```tsx
|
|
144
|
+
* import { DatePickerWithTimezone } from '@jmruthers/pace-core/components';
|
|
145
|
+
* import { useState } from 'react';
|
|
146
|
+
*
|
|
147
|
+
* function DateSelector() {
|
|
148
|
+
* const [date, setDate] = useState<Date>();
|
|
149
|
+
*
|
|
150
|
+
* return (
|
|
151
|
+
* <DatePickerWithTimezone
|
|
152
|
+
* selected={date}
|
|
153
|
+
* onSelect={setDate}
|
|
154
|
+
* timezone="America/New_York"
|
|
155
|
+
* onDone={() => console.log('Date selected')}
|
|
156
|
+
* />
|
|
157
|
+
* );
|
|
158
|
+
* }
|
|
159
|
+
* ```
|
|
160
|
+
*
|
|
161
|
+
* @accessibility
|
|
162
|
+
* - WCAG 2.1 AA compliant
|
|
163
|
+
* - Keyboard navigation support
|
|
164
|
+
* - Screen reader friendly
|
|
165
|
+
* - Focus management
|
|
166
|
+
* - Proper ARIA attributes
|
|
167
|
+
*/
|
|
168
|
+
/**
|
|
169
|
+
* Props for the DatePickerWithTimezone component
|
|
170
|
+
*/
|
|
171
|
+
interface DatePickerWithTimezoneProps {
|
|
172
|
+
/**
|
|
173
|
+
* Currently selected date
|
|
174
|
+
*/
|
|
175
|
+
selected?: Date;
|
|
176
|
+
/**
|
|
177
|
+
* Date selection handler
|
|
178
|
+
*/
|
|
179
|
+
onSelect: (date: Date | undefined) => void;
|
|
180
|
+
/**
|
|
181
|
+
* Optional callback when "Done" button is clicked
|
|
182
|
+
*/
|
|
183
|
+
onDone?: () => void;
|
|
184
|
+
/**
|
|
185
|
+
* Timezone to display (defaults to user's timezone)
|
|
186
|
+
*/
|
|
187
|
+
timezone?: string;
|
|
188
|
+
/**
|
|
189
|
+
* Additional CSS classes
|
|
190
|
+
*/
|
|
191
|
+
className?: string;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* DatePickerWithTimezone component
|
|
195
|
+
* Date picker with timezone information display
|
|
196
|
+
*
|
|
197
|
+
* @param props - DatePickerWithTimezone configuration
|
|
198
|
+
* @returns JSX.Element - The rendered date picker with timezone
|
|
199
|
+
*/
|
|
200
|
+
declare function DatePickerWithTimezone({ selected, onSelect, onDone, timezone, className }: DatePickerWithTimezoneProps): react_jsx_runtime.JSX.Element;
|
|
201
|
+
|
|
202
|
+
export { DatePickerWithTimezone, type DatePickerWithTimezoneProps, DateTimeField, type DateTimeFieldProps };
|
package/dist/components.js
CHANGED
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
useFileReferenceById,
|
|
50
50
|
useFileReferenceForRecord,
|
|
51
51
|
useFilesByCategory
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-HC67NW5K.js";
|
|
53
53
|
import {
|
|
54
54
|
Alert,
|
|
55
55
|
AlertDescription,
|
|
@@ -90,39 +90,183 @@ import {
|
|
|
90
90
|
TooltipProvider,
|
|
91
91
|
TooltipRoot,
|
|
92
92
|
TooltipTrigger
|
|
93
|
-
} from "./chunk-
|
|
94
|
-
import "./chunk-
|
|
95
|
-
import "./chunk-
|
|
93
|
+
} from "./chunk-HGPQUCBC.js";
|
|
94
|
+
import "./chunk-445GEP27.js";
|
|
95
|
+
import "./chunk-U6WNSFX5.js";
|
|
96
96
|
import "./chunk-FSFQFJCU.js";
|
|
97
97
|
import {
|
|
98
98
|
ErrorBoundary,
|
|
99
99
|
PublicPageProvider,
|
|
100
100
|
useIsPublicPage,
|
|
101
101
|
usePublicPageContext
|
|
102
|
-
} from "./chunk-
|
|
102
|
+
} from "./chunk-MX3EIJGQ.js";
|
|
103
103
|
import {
|
|
104
104
|
useToast
|
|
105
105
|
} from "./chunk-6C4YBBJM.js";
|
|
106
|
-
import "./chunk-
|
|
106
|
+
import "./chunk-XAUHJD3L.js";
|
|
107
107
|
import "./chunk-KQCRWDSA.js";
|
|
108
108
|
import {
|
|
109
109
|
UnifiedAuthProvider,
|
|
110
110
|
useUnifiedAuth
|
|
111
|
-
} from "./chunk-
|
|
111
|
+
} from "./chunk-FXFJRTKI.js";
|
|
112
112
|
import {
|
|
113
113
|
FileCategory
|
|
114
|
-
} from "./chunk-
|
|
114
|
+
} from "./chunk-IXSNYUCT.js";
|
|
115
115
|
import "./chunk-QXHPKYJV.js";
|
|
116
116
|
import {
|
|
117
|
-
LoadingSpinner
|
|
118
|
-
|
|
119
|
-
|
|
117
|
+
LoadingSpinner,
|
|
118
|
+
fromZonedTime,
|
|
119
|
+
getUserTimeZone,
|
|
120
|
+
toZonedTime
|
|
121
|
+
} from "./chunk-THRPYOFK.js";
|
|
122
|
+
import {
|
|
123
|
+
cn
|
|
124
|
+
} from "./chunk-R77UEZ4E.js";
|
|
120
125
|
import "./chunk-F2IMUDXZ.js";
|
|
121
126
|
import "./chunk-FMUCXFII.js";
|
|
122
127
|
import "./chunk-VBXEHIUJ.js";
|
|
123
128
|
import "./chunk-SQGMNID3.js";
|
|
124
129
|
import "./chunk-PWLANIRT.js";
|
|
125
130
|
import "./chunk-7D4SUZUM.js";
|
|
131
|
+
|
|
132
|
+
// src/components/DateTimeField/DateTimeField.tsx
|
|
133
|
+
import * as React from "react";
|
|
134
|
+
import { format, parse } from "date-fns";
|
|
135
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
136
|
+
function DateTimeField({
|
|
137
|
+
label,
|
|
138
|
+
value,
|
|
139
|
+
onChange,
|
|
140
|
+
timezone = "UTC",
|
|
141
|
+
required = false,
|
|
142
|
+
className,
|
|
143
|
+
returnAsDate = false,
|
|
144
|
+
id,
|
|
145
|
+
helperText,
|
|
146
|
+
error
|
|
147
|
+
}) {
|
|
148
|
+
const [isEditing, setIsEditing] = React.useState(false);
|
|
149
|
+
const inputRef = React.useRef(null);
|
|
150
|
+
const fieldId = id || `datetime-field-${React.useId()}`;
|
|
151
|
+
const getDisplayValue = React.useCallback(() => {
|
|
152
|
+
if (!value) {
|
|
153
|
+
return "";
|
|
154
|
+
}
|
|
155
|
+
try {
|
|
156
|
+
let dateObj;
|
|
157
|
+
if (typeof value === "string") {
|
|
158
|
+
dateObj = new Date(value);
|
|
159
|
+
} else {
|
|
160
|
+
dateObj = value;
|
|
161
|
+
}
|
|
162
|
+
if (!dateObj || isNaN(dateObj.getTime())) {
|
|
163
|
+
return "";
|
|
164
|
+
}
|
|
165
|
+
const zonedDate = toZonedTime(dateObj, timezone);
|
|
166
|
+
return format(zonedDate, "yyyy-MM-dd'T'HH:mm");
|
|
167
|
+
} catch {
|
|
168
|
+
return "";
|
|
169
|
+
}
|
|
170
|
+
}, [value, timezone]);
|
|
171
|
+
const displayValue = isEditing ? void 0 : getDisplayValue();
|
|
172
|
+
const handleChange = React.useCallback((e) => {
|
|
173
|
+
setIsEditing(true);
|
|
174
|
+
const inputValue = e.target.value;
|
|
175
|
+
if (!inputValue) {
|
|
176
|
+
onChange(void 0);
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
try {
|
|
180
|
+
const localDate = parse(inputValue, "yyyy-MM-dd'T'HH:mm", /* @__PURE__ */ new Date());
|
|
181
|
+
if (isNaN(localDate.getTime())) {
|
|
182
|
+
onChange(void 0);
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
const utcDate = fromZonedTime(localDate, timezone);
|
|
186
|
+
if (returnAsDate) {
|
|
187
|
+
onChange(utcDate);
|
|
188
|
+
} else {
|
|
189
|
+
onChange(utcDate.toISOString());
|
|
190
|
+
}
|
|
191
|
+
} catch {
|
|
192
|
+
onChange(void 0);
|
|
193
|
+
}
|
|
194
|
+
}, [timezone, returnAsDate, onChange]);
|
|
195
|
+
const handleBlur = React.useCallback(() => {
|
|
196
|
+
setIsEditing(false);
|
|
197
|
+
}, []);
|
|
198
|
+
const getTimezoneDisplay = React.useCallback(() => {
|
|
199
|
+
if (timezone === "UTC") {
|
|
200
|
+
return "";
|
|
201
|
+
}
|
|
202
|
+
const userTz = getUserTimeZone();
|
|
203
|
+
if (timezone === userTz) {
|
|
204
|
+
return "Local";
|
|
205
|
+
}
|
|
206
|
+
return timezone;
|
|
207
|
+
}, [timezone]);
|
|
208
|
+
const timezoneDisplay = getTimezoneDisplay();
|
|
209
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("space-y-2", className), children: [
|
|
210
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: fieldId, required, helperText, error, children: label }),
|
|
211
|
+
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
212
|
+
/* @__PURE__ */ jsx(
|
|
213
|
+
Input,
|
|
214
|
+
{
|
|
215
|
+
ref: inputRef,
|
|
216
|
+
id: fieldId,
|
|
217
|
+
type: "datetime-local",
|
|
218
|
+
value: displayValue,
|
|
219
|
+
onChange: handleChange,
|
|
220
|
+
onBlur: handleBlur,
|
|
221
|
+
required,
|
|
222
|
+
error: !!error,
|
|
223
|
+
className: "w-full"
|
|
224
|
+
}
|
|
225
|
+
),
|
|
226
|
+
timezoneDisplay && /* @__PURE__ */ jsx("span", { className: "absolute right-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground pointer-events-none", children: timezoneDisplay })
|
|
227
|
+
] })
|
|
228
|
+
] });
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// src/components/DatePickerWithTimezone/DatePickerWithTimezone.tsx
|
|
232
|
+
import { Clock } from "lucide-react";
|
|
233
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
234
|
+
function DatePickerWithTimezone({
|
|
235
|
+
selected,
|
|
236
|
+
onSelect,
|
|
237
|
+
onDone,
|
|
238
|
+
timezone,
|
|
239
|
+
className
|
|
240
|
+
}) {
|
|
241
|
+
const userTimezone = getUserTimeZone();
|
|
242
|
+
const displayTimezone = timezone || userTimezone;
|
|
243
|
+
const timezoneDisplay = displayTimezone === userTimezone ? "Local" : displayTimezone;
|
|
244
|
+
return /* @__PURE__ */ jsxs2("div", { className: cn("flex flex-col", className), children: [
|
|
245
|
+
/* @__PURE__ */ jsx2("div", { className: "p-3", children: /* @__PURE__ */ jsx2(
|
|
246
|
+
Calendar,
|
|
247
|
+
{
|
|
248
|
+
mode: "single",
|
|
249
|
+
selected,
|
|
250
|
+
onSelect,
|
|
251
|
+
initialFocus: true,
|
|
252
|
+
captionLayout: "dropdown-buttons",
|
|
253
|
+
fromYear: 1900,
|
|
254
|
+
toYear: 2100,
|
|
255
|
+
className: "p-0"
|
|
256
|
+
}
|
|
257
|
+
) }),
|
|
258
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-between border-t border-border px-3 py-2", children: [
|
|
259
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
260
|
+
/* @__PURE__ */ jsx2(Clock, { className: "h-4 w-4", "aria-hidden": "true" }),
|
|
261
|
+
/* @__PURE__ */ jsxs2("span", { children: [
|
|
262
|
+
"Timezone: ",
|
|
263
|
+
/* @__PURE__ */ jsx2("span", { "aria-label": `Timezone ${timezoneDisplay}`, children: timezoneDisplay })
|
|
264
|
+
] })
|
|
265
|
+
] }),
|
|
266
|
+
onDone && /* @__PURE__ */ jsx2(Button, { onClick: onDone, size: "sm", className: "h-8", children: "Done" })
|
|
267
|
+
] })
|
|
268
|
+
] });
|
|
269
|
+
}
|
|
126
270
|
export {
|
|
127
271
|
Alert,
|
|
128
272
|
AlertDescription,
|
|
@@ -142,6 +286,8 @@ export {
|
|
|
142
286
|
CardTitle,
|
|
143
287
|
Checkbox,
|
|
144
288
|
DataTable,
|
|
289
|
+
DatePickerWithTimezone,
|
|
290
|
+
DateTimeField,
|
|
145
291
|
Dialog,
|
|
146
292
|
DialogBody,
|
|
147
293
|
DialogClose,
|
package/dist/components.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/components/DateTimeField/DateTimeField.tsx","../src/components/DatePickerWithTimezone/DatePickerWithTimezone.tsx"],"sourcesContent":["/**\n * @file DateTimeField Component\n * @package @jmruthers/pace-core\n * @module Components/DateTimeField\n * @since 0.1.0\n *\n * Form input component for datetime values with timezone support.\n * Handles UTC ↔ timezone conversion automatically.\n *\n * Features:\n * - Automatic UTC ↔ timezone conversion\n * - Prevents unwanted conversions during user editing\n * - Shows timezone information when not UTC\n * - Supports both ISO string and Date object values\n * - Uses native datetime-local input type\n * - Accessible form field with proper labels\n *\n * @example\n * ```tsx\n * import { DateTimeField } from '@jmruthers/pace-core/components';\n * import { useState } from 'react';\n *\n * function EventForm() {\n * const [startTime, setStartTime] = useState<string>();\n *\n * return (\n * <DateTimeField\n * label=\"Start Time\"\n * value={startTime}\n * onChange={setStartTime}\n * timezone=\"America/New_York\"\n * required\n * />\n * );\n * }\n * ```\n *\n * @accessibility\n * - Proper label association with htmlFor\n * - Required field indicators\n * - Screen reader friendly\n * - Keyboard navigation support\n * - Focus management\n */\n\nimport * as React from 'react';\nimport { format, parse } from 'date-fns';\nimport { Label } from '../Label';\nimport { Input } from '../Input';\nimport { cn } from '../../utils/core/cn';\nimport { toZonedTime, fromZonedTime, getUserTimeZone } from '../../utils/timezone';\n\n/**\n * Props for the DateTimeField component\n */\nexport interface DateTimeFieldProps {\n /**\n * Field label\n */\n label: string;\n /**\n * UTC date value (ISO string, Date object, or undefined)\n */\n value: string | Date | undefined;\n /**\n * Change handler that receives UTC value (ISO string or Date object)\n */\n onChange: (value: string | Date | undefined) => void;\n /**\n * Target timezone for display (default: 'UTC')\n */\n timezone?: string;\n /**\n * Whether the field is required\n */\n required?: boolean;\n /**\n * Additional CSS classes\n */\n className?: string;\n /**\n * If true, onChange returns Date object instead of ISO string\n */\n returnAsDate?: boolean;\n /**\n * Input id (auto-generated if not provided)\n */\n id?: string;\n /**\n * Helper text to display below the label\n */\n helperText?: string;\n /**\n * Error message to display\n */\n error?: string;\n}\n\n/**\n * DateTimeField component\n * Form input for datetime values with automatic timezone conversion\n *\n * @param props - DateTimeField configuration\n * @returns JSX.Element - The rendered datetime field\n */\nexport function DateTimeField({\n label,\n value,\n onChange,\n timezone = 'UTC',\n required = false,\n className,\n returnAsDate = false,\n id,\n helperText,\n error\n}: DateTimeFieldProps) {\n const [isEditing, setIsEditing] = React.useState(false);\n const inputRef = React.useRef<HTMLInputElement>(null);\n const fieldId = id || `datetime-field-${React.useId()}`;\n\n // Convert UTC value to timezone for display\n const getDisplayValue = React.useCallback((): string => {\n if (!value) {\n return '';\n }\n\n try {\n let dateObj: Date;\n if (typeof value === 'string') {\n dateObj = new Date(value);\n } else {\n dateObj = value;\n }\n\n if (!dateObj || isNaN(dateObj.getTime())) {\n return '';\n }\n\n // Convert UTC to timezone\n const zonedDate = toZonedTime(dateObj, timezone);\n\n // Format for datetime-local input (YYYY-MM-DDTHH:mm)\n return format(zonedDate, \"yyyy-MM-dd'T'HH:mm\");\n } catch {\n return '';\n }\n }, [value, timezone]);\n\n const displayValue = isEditing ? undefined : getDisplayValue();\n\n // Handle input change\n const handleChange = React.useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n setIsEditing(true);\n const inputValue = e.target.value;\n\n if (!inputValue) {\n onChange(undefined);\n return;\n }\n\n try {\n // Parse the datetime-local value (in timezone)\n const localDate = parse(inputValue, \"yyyy-MM-dd'T'HH:mm\", new Date());\n\n if (isNaN(localDate.getTime())) {\n onChange(undefined);\n return;\n }\n\n // Convert from timezone to UTC\n const utcDate = fromZonedTime(localDate, timezone);\n\n // Return as ISO string or Date object\n if (returnAsDate) {\n onChange(utcDate);\n } else {\n onChange(utcDate.toISOString());\n }\n } catch {\n onChange(undefined);\n }\n }, [timezone, returnAsDate, onChange]);\n\n // Handle blur to stop editing mode\n const handleBlur = React.useCallback(() => {\n setIsEditing(false);\n }, []);\n\n // Get timezone display text\n const getTimezoneDisplay = React.useCallback((): string => {\n if (timezone === 'UTC') {\n return '';\n }\n\n const userTz = getUserTimeZone();\n if (timezone === userTz) {\n return 'Local';\n }\n\n return timezone;\n }, [timezone]);\n\n const timezoneDisplay = getTimezoneDisplay();\n\n return (\n <div className={cn('space-y-2', className)}>\n <Label htmlFor={fieldId} required={required} helperText={helperText} error={error}>\n {label}\n </Label>\n <div className=\"relative\">\n <Input\n ref={inputRef}\n id={fieldId}\n type=\"datetime-local\"\n value={displayValue}\n onChange={handleChange}\n onBlur={handleBlur}\n required={required}\n error={!!error}\n className=\"w-full\"\n />\n {timezoneDisplay && (\n <span className=\"absolute right-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground pointer-events-none\">\n {timezoneDisplay}\n </span>\n )}\n </div>\n </div>\n );\n}\n\n","/**\n * @file DatePickerWithTimezone Component\n * @package @jmruthers/pace-core\n * @module Components/DatePickerWithTimezone\n * @since 0.1.0\n *\n * Date picker component that displays timezone information alongside the calendar.\n * Provides a calendar interface with timezone context for date selection.\n *\n * Features:\n * - Calendar date selection\n * - Timezone display (shows \"Local\" when matches user timezone)\n * - Optional \"Done\" button\n * - Accessible date selection\n * - Keyboard navigation support\n *\n * @example\n * ```tsx\n * import { DatePickerWithTimezone } from '@jmruthers/pace-core/components';\n * import { useState } from 'react';\n *\n * function DateSelector() {\n * const [date, setDate] = useState<Date>();\n *\n * return (\n * <DatePickerWithTimezone\n * selected={date}\n * onSelect={setDate}\n * timezone=\"America/New_York\"\n * onDone={() => console.log('Date selected')}\n * />\n * );\n * }\n * ```\n *\n * @accessibility\n * - WCAG 2.1 AA compliant\n * - Keyboard navigation support\n * - Screen reader friendly\n * - Focus management\n * - Proper ARIA attributes\n */\n\nimport * as React from 'react';\nimport { Calendar } from '../Calendar';\nimport { Button } from '../Button';\nimport { Clock } from 'lucide-react';\nimport { getUserTimeZone } from '../../utils/timezone';\nimport { cn } from '../../utils/core/cn';\n\n/**\n * Props for the DatePickerWithTimezone component\n */\nexport interface DatePickerWithTimezoneProps {\n /**\n * Currently selected date\n */\n selected?: Date;\n /**\n * Date selection handler\n */\n onSelect: (date: Date | undefined) => void;\n /**\n * Optional callback when \"Done\" button is clicked\n */\n onDone?: () => void;\n /**\n * Timezone to display (defaults to user's timezone)\n */\n timezone?: string;\n /**\n * Additional CSS classes\n */\n className?: string;\n}\n\n/**\n * DatePickerWithTimezone component\n * Date picker with timezone information display\n *\n * @param props - DatePickerWithTimezone configuration\n * @returns JSX.Element - The rendered date picker with timezone\n */\nexport function DatePickerWithTimezone({\n selected,\n onSelect,\n onDone,\n timezone,\n className\n}: DatePickerWithTimezoneProps) {\n const userTimezone = getUserTimeZone();\n const displayTimezone = timezone || userTimezone;\n const timezoneDisplay = displayTimezone === userTimezone ? 'Local' : displayTimezone;\n\n return (\n <div className={cn('flex flex-col', className)}>\n <div className=\"p-3\">\n <Calendar\n mode=\"single\"\n selected={selected}\n onSelect={onSelect}\n initialFocus\n captionLayout=\"dropdown-buttons\"\n fromYear={1900}\n toYear={2100}\n className=\"p-0\"\n />\n </div>\n\n <div className=\"flex items-center justify-between border-t border-border px-3 py-2\">\n <div className=\"flex items-center gap-2 text-sm text-muted-foreground\">\n <Clock className=\"h-4 w-4\" aria-hidden=\"true\" />\n <span>\n Timezone: <span aria-label={`Timezone ${timezoneDisplay}`}>{timezoneDisplay}</span>\n </span>\n </div>\n {onDone && (\n <Button onClick={onDone} size=\"sm\" className=\"h-8\">\n Done\n </Button>\n )}\n </div>\n </div>\n );\n}\n\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,YAAY,WAAW;AACvB,SAAS,QAAQ,aAAa;AAiKxB,cAGA,YAHA;AAtGC,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,WAAW;AAAA,EACX;AAAA,EACA,eAAe;AAAA,EACf;AAAA,EACA;AAAA,EACA;AACF,GAAuB;AACrB,QAAM,CAAC,WAAW,YAAY,IAAU,eAAS,KAAK;AACtD,QAAM,WAAiB,aAAyB,IAAI;AACpD,QAAM,UAAU,MAAM,kBAAwB,YAAM,CAAC;AAGrD,QAAM,kBAAwB,kBAAY,MAAc;AACtD,QAAI,CAAC,OAAO;AACV,aAAO;AAAA,IACT;AAEA,QAAI;AACF,UAAI;AACJ,UAAI,OAAO,UAAU,UAAU;AAC7B,kBAAU,IAAI,KAAK,KAAK;AAAA,MAC1B,OAAO;AACL,kBAAU;AAAA,MACZ;AAEA,UAAI,CAAC,WAAW,MAAM,QAAQ,QAAQ,CAAC,GAAG;AACxC,eAAO;AAAA,MACT;AAGA,YAAM,YAAY,YAAY,SAAS,QAAQ;AAG/C,aAAO,OAAO,WAAW,oBAAoB;AAAA,IAC/C,QAAQ;AACN,aAAO;AAAA,IACT;AAAA,EACF,GAAG,CAAC,OAAO,QAAQ,CAAC;AAEpB,QAAM,eAAe,YAAY,SAAY,gBAAgB;AAG7D,QAAM,eAAqB,kBAAY,CAAC,MAA2C;AACjF,iBAAa,IAAI;AACjB,UAAM,aAAa,EAAE,OAAO;AAE5B,QAAI,CAAC,YAAY;AACf,eAAS,MAAS;AAClB;AAAA,IACF;AAEA,QAAI;AAEF,YAAM,YAAY,MAAM,YAAY,sBAAsB,oBAAI,KAAK,CAAC;AAEpE,UAAI,MAAM,UAAU,QAAQ,CAAC,GAAG;AAC9B,iBAAS,MAAS;AAClB;AAAA,MACF;AAGA,YAAM,UAAU,cAAc,WAAW,QAAQ;AAGjD,UAAI,cAAc;AAChB,iBAAS,OAAO;AAAA,MAClB,OAAO;AACL,iBAAS,QAAQ,YAAY,CAAC;AAAA,MAChC;AAAA,IACF,QAAQ;AACN,eAAS,MAAS;AAAA,IACpB;AAAA,EACF,GAAG,CAAC,UAAU,cAAc,QAAQ,CAAC;AAGrC,QAAM,aAAmB,kBAAY,MAAM;AACzC,iBAAa,KAAK;AAAA,EACpB,GAAG,CAAC,CAAC;AAGL,QAAM,qBAA2B,kBAAY,MAAc;AACzD,QAAI,aAAa,OAAO;AACtB,aAAO;AAAA,IACT;AAEA,UAAM,SAAS,gBAAgB;AAC/B,QAAI,aAAa,QAAQ;AACvB,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT,GAAG,CAAC,QAAQ,CAAC;AAEb,QAAM,kBAAkB,mBAAmB;AAE3C,SACE,qBAAC,SAAI,WAAW,GAAG,aAAa,SAAS,GACvC;AAAA,wBAAC,SAAM,SAAS,SAAS,UAAoB,YAAwB,OAClE,iBACH;AAAA,IACA,qBAAC,SAAI,WAAU,YACb;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,KAAK;AAAA,UACL,IAAI;AAAA,UACJ,MAAK;AAAA,UACL,OAAO;AAAA,UACP,UAAU;AAAA,UACV,QAAQ;AAAA,UACR;AAAA,UACA,OAAO,CAAC,CAAC;AAAA,UACT,WAAU;AAAA;AAAA,MACZ;AAAA,MACC,mBACC,oBAAC,UAAK,WAAU,+FACb,2BACH;AAAA,OAEJ;AAAA,KACF;AAEJ;;;ACxLA,SAAS,aAAa;AAmDd,gBAAAA,MAeE,QAAAC,aAfF;AAdD,SAAS,uBAAuB;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAgC;AAC9B,QAAM,eAAe,gBAAgB;AACrC,QAAM,kBAAkB,YAAY;AACpC,QAAM,kBAAkB,oBAAoB,eAAe,UAAU;AAErE,SACE,gBAAAA,MAAC,SAAI,WAAW,GAAG,iBAAiB,SAAS,GAC3C;AAAA,oBAAAD,KAAC,SAAI,WAAU,OACb,0BAAAA;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL;AAAA,QACA;AAAA,QACA,cAAY;AAAA,QACZ,eAAc;AAAA,QACd,UAAU;AAAA,QACV,QAAQ;AAAA,QACR,WAAU;AAAA;AAAA,IACZ,GACF;AAAA,IAEA,gBAAAC,MAAC,SAAI,WAAU,sEACb;AAAA,sBAAAA,MAAC,SAAI,WAAU,yDACb;AAAA,wBAAAD,KAAC,SAAM,WAAU,WAAU,eAAY,QAAO;AAAA,QAC9C,gBAAAC,MAAC,UAAK;AAAA;AAAA,UACM,gBAAAD,KAAC,UAAK,cAAY,YAAY,eAAe,IAAK,2BAAgB;AAAA,WAC9E;AAAA,SACF;AAAA,MACC,UACC,gBAAAA,KAAC,UAAO,SAAS,QAAQ,MAAK,MAAK,WAAU,OAAM,kBAEnD;AAAA,OAEJ;AAAA,KACF;AAEJ;","names":["jsx","jsxs"]}
|