@processfocus/runtime-local 0.1.0-next.1 → 0.1.0-next.3
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/README.md +48 -253
- package/dist/authentication-server.mjs +52 -84
- package/dist/{chunk-fn7b5pxw.js → chunk-04r0t2mb.js} +19364 -34104
- package/dist/chunk-727y6qkb.js +156 -0
- package/dist/chunk-bg5r4wpv.js +4755 -0
- package/dist/chunk-cbd36jq1.js +512 -0
- package/dist/chunk-d4ctj079.js +241 -0
- package/dist/{chunk-cq9xscgb.js → chunk-r5s2v669.js} +49079 -33564
- package/dist/dashboard-source/apps/frontend/app/(protected)/act-on-behalf/actions.ts +12 -12
- package/dist/dashboard-source/apps/frontend/app/(protected)/act-on-behalf/delegations-client.tsx +31 -21
- package/dist/dashboard-source/apps/frontend/app/(protected)/act-on-behalf/page.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/client-index.tsx +1 -12
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/client.tsx +1 -1
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/page.tsx +2 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/process-state/page.tsx +2 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/default.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/[executionId]/page.tsx +3 -1
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/[executionId]/process-state/page.tsx +2 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/client-layout.tsx +19 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/default.tsx +6 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/executions-client.tsx +1637 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/layout.tsx +5 -7
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/page.tsx +4 -1589
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/process-state-page-client.tsx +1 -1
- package/dist/dashboard-source/apps/frontend/app/(protected)/layout.tsx +41 -33
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/@modal/(.)item/[id]/client.tsx +11 -17
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/@modal/(.)item/[id]/page.tsx +2 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/@modal/default.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/[...listPath]/list-page-client.tsx +153 -16
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/[...listPath]/page.tsx +10 -2
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-create-form.tsx +29 -13
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-item-edit-form.tsx +22 -28
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-item-load-error.tsx +49 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-schema-form.tsx +28 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/default.tsx +6 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/metric-control-url-state.ts +7 -16
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/use-list-deleted-callback.ts +4 -6
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/use-list-item-detail.ts +45 -142
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/item/[id]/client.tsx +10 -20
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/item/[id]/page.tsx +2 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/layout.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/lib/list-process-dialog.tsx +72 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/lib/list-refresh-provider.tsx +65 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/lib/list-refresh.ts +162 -16
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/utils.tsx +19 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/org-chart/page.tsx +4 -9
- package/dist/dashboard-source/apps/frontend/app/(protected)/page.tsx +4 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/actions.ts +15 -18
- package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/page.tsx +12 -6
- package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/passkeys-client.tsx +7 -16
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/(.)start/[...startStepPath]/client.tsx +26 -48
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/(.)start/[...startStepPath]/page.tsx +4 -7
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/default.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/client-layout.tsx +28 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/client.tsx +1 -3
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/components/start-process-form.tsx +193 -117
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/default.tsx +6 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/layout.tsx +7 -9
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/page.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/processes-client.tsx +60 -204
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/start/[...startStepPath]/client.tsx +12 -51
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/start/[...startStepPath]/page.tsx +27 -4
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/page.tsx +5 -4
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/workflow-flow.tsx +0 -5
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/workflow-form-preview-sheet.tsx +26 -19
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/[[...tab]]/page.tsx +5 -2
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/cedar-authorize.ts +85 -9
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/cedar-types.ts +12 -1
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/explorer.tsx +66 -4
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/layout.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/load-handbook.ts +41 -13
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/[invitationId]/page.tsx +2 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/invitation-detail-client.tsx +442 -365
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/new/page.tsx +8 -2
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/page.tsx +7 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations-table.tsx +61 -43
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/page.tsx +6 -67
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/providers/page.tsx +7 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/roles/page.tsx +7 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/settings-client.tsx +111 -189
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/settings-page.tsx +86 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/client.tsx +141 -256
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/page.tsx +2 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/tokens/page.tsx +2 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/page.tsx +7 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users-table.tsx +6 -4
- package/dist/dashboard-source/apps/frontend/app/(protected)/stats/[...statsPath]/page.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/@modal/(.)complete/[...stepPath]/client.tsx +30 -9
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/@modal/(.)complete/[...stepPath]/page.tsx +3 -1
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/@modal/default.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/complete/[...stepPath]/client.tsx +2 -4
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/complete/[...stepPath]/page.tsx +3 -1
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/complete-todo-form.tsx +47 -54
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/public-completion-correction-form.tsx +37 -54
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/todo-form-actions.tsx +1 -1
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/correct/[...stepPath]/page.tsx +3 -1
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/default.tsx +6 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/layout.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/lib/mobile-todo-list.ts +4 -25
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/page.tsx +4 -1315
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/to-dos-client.tsx +1282 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/callback/route.ts +81 -65
- package/dist/dashboard-source/apps/frontend/app/api/auth/delegation/route.ts +8 -2
- package/dist/dashboard-source/apps/frontend/app/api/auth/login/route.ts +0 -1
- package/dist/dashboard-source/apps/frontend/app/api/auth/logout/route.ts +10 -5
- package/dist/dashboard-source/apps/frontend/app/api/auth/passkey/start/route.ts +1 -3
- package/dist/dashboard-source/apps/frontend/app/api/auth/refresh/route.ts +0 -1
- package/dist/dashboard-source/apps/frontend/app/api/auth/revalidate-google/route.ts +68 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/switch-role/route.ts +1 -3
- package/dist/dashboard-source/apps/frontend/app/api/embed/lookup/route.ts +25 -7
- package/dist/dashboard-source/apps/frontend/app/api/embed/submit/route.ts +1 -2
- package/dist/dashboard-source/apps/frontend/app/api/public/start/[address]/route.ts +49 -0
- package/dist/dashboard-source/apps/frontend/app/api/public/to-dos/lookup/route.ts +4 -3
- package/dist/dashboard-source/apps/frontend/app/api/revalidate/route.ts +15 -4
- package/dist/dashboard-source/apps/frontend/app/app-shell.tsx +11 -4
- package/dist/dashboard-source/apps/frontend/app/cli-auth/route.ts +2 -1
- package/dist/dashboard-source/apps/frontend/app/embed/[...startStepPath]/embed-client.tsx +31 -18
- package/dist/dashboard-source/apps/frontend/app/embed/[...startStepPath]/page.tsx +5 -1
- package/dist/dashboard-source/apps/frontend/app/login/page.tsx +4 -4
- package/dist/dashboard-source/apps/frontend/app/login/passkey-button.tsx +11 -6
- package/dist/dashboard-source/apps/frontend/app/login/passkey-help/page.tsx +67 -0
- package/dist/dashboard-source/apps/frontend/app/mcp/[[...endpoint]]/route.ts +47 -0
- package/dist/dashboard-source/apps/frontend/app/public/form/[token]/public-todo-client.tsx +44 -25
- package/dist/dashboard-source/apps/frontend/app/public/start/[address]/form/page.tsx +10 -0
- package/dist/dashboard-source/apps/frontend/app/public/start/[address]/layout.tsx +32 -0
- package/dist/dashboard-source/apps/frontend/app/public/start/[address]/page-client.tsx +319 -0
- package/dist/dashboard-source/apps/frontend/app/public/start/[address]/page-content.tsx +41 -0
- package/dist/dashboard-source/apps/frontend/app/public/start/[address]/page.tsx +10 -0
- package/dist/dashboard-source/apps/frontend/app/public.css +1 -1
- package/dist/dashboard-source/apps/frontend/app/register/passkey/register-passkey-client.tsx +17 -0
- package/dist/dashboard-source/apps/frontend/components/DashboardSection.tsx +9 -15
- package/dist/dashboard-source/apps/frontend/components/Header.tsx +4 -8
- package/dist/dashboard-source/apps/frontend/components/anonymous-page-link.tsx +57 -0
- package/dist/dashboard-source/apps/frontend/components/anonymous-start-form.tsx +24 -0
- package/dist/dashboard-source/apps/frontend/components/app-sidebar.tsx +21 -7
- package/dist/dashboard-source/apps/frontend/components/auth-provider.tsx +12 -7
- package/dist/dashboard-source/apps/frontend/components/browser-only.tsx +19 -0
- package/dist/dashboard-source/apps/frontend/components/config-provider.tsx +0 -1
- package/dist/dashboard-source/apps/frontend/components/delegation-expiry.tsx +24 -13
- package/dist/dashboard-source/apps/frontend/components/form-dialog-content.tsx +22 -2
- package/dist/dashboard-source/apps/frontend/components/journey-timeline.tsx +52 -45
- package/dist/dashboard-source/apps/frontend/components/notification-bell.tsx +0 -1
- package/dist/dashboard-source/apps/frontend/components/sidebar-lists.tsx +0 -1
- package/dist/dashboard-source/apps/frontend/components/token-refresh-scheduler.tsx +38 -11
- package/dist/dashboard-source/apps/frontend/components/ui/sidebar.tsx +0 -1
- package/dist/dashboard-source/apps/frontend/components/ui/tab-pill.tsx +26 -15
- package/dist/dashboard-source/apps/frontend/components/workflow/step-node.tsx +0 -1
- package/dist/dashboard-source/apps/frontend/components/workflow/workflow-edge.tsx +5 -0
- package/dist/dashboard-source/apps/frontend/hooks/use-form-metadata.ts +21 -10
- package/dist/dashboard-source/apps/frontend/hooks/use-process-draft.ts +173 -0
- package/dist/dashboard-source/apps/frontend/hooks/use-weekly-execution-stats.ts +1 -3
- package/dist/dashboard-source/apps/frontend/lib/anonymous-page-form-values.ts +6 -0
- package/dist/dashboard-source/apps/frontend/lib/anonymous-page-server.ts +65 -0
- package/dist/dashboard-source/apps/frontend/lib/appsync-events/adapter.ts +9 -3
- package/dist/dashboard-source/apps/frontend/lib/appsync-events/client.ts +7 -340
- package/dist/dashboard-source/apps/frontend/lib/auth/client-session.ts +2 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/delegations.ts +9 -7
- package/dist/dashboard-source/apps/frontend/lib/auth/google-revalidation.ts +111 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/logout.ts +1 -1
- package/dist/dashboard-source/apps/frontend/lib/auth/passkeys.ts +28 -30
- package/dist/dashboard-source/apps/frontend/lib/auth/providers.ts +10 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/realtime-session-token.ts +1 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/reauthentication-state.ts +4 -4
- package/dist/dashboard-source/apps/frontend/lib/auth/session-admission.ts +11 -7
- package/dist/dashboard-source/apps/frontend/lib/auth/session.ts +27 -10
- package/dist/dashboard-source/apps/frontend/lib/auth/ssr-session.ts +76 -9
- package/dist/dashboard-source/apps/frontend/lib/auth/verify-passkey.ts +25 -3
- package/dist/dashboard-source/apps/frontend/lib/collections/collection-provider-factory.tsx +112 -21
- package/dist/dashboard-source/apps/frontend/lib/collections/draft-process-execution.ts +1 -8
- package/dist/dashboard-source/apps/frontend/lib/collections/execution.ts +6 -2
- package/dist/dashboard-source/apps/frontend/lib/collections/process-collection-provider.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/process.ts +8 -2
- package/dist/dashboard-source/apps/frontend/lib/collections/replication-factory.ts +16 -4
- package/dist/dashboard-source/apps/frontend/lib/collections/todo.ts +1 -1
- package/dist/dashboard-source/apps/frontend/lib/effect/navigation.ts +4 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/page-runtime.ts +29 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/params.ts +18 -12
- package/dist/dashboard-source/apps/frontend/lib/effect/run-effect.ts +1 -1
- package/dist/dashboard-source/apps/frontend/lib/effect/runtime.ts +19 -23
- package/dist/dashboard-source/apps/frontend/lib/effect/services/access-token.ts +9 -12
- package/dist/dashboard-source/apps/frontend/lib/effect/services/authorization.ts +12 -12
- package/dist/dashboard-source/apps/frontend/lib/effect/services/form-validation.ts +20 -18
- package/dist/dashboard-source/apps/frontend/lib/effect/services/graphql.ts +32 -16
- package/dist/dashboard-source/apps/frontend/lib/embed-form-server.ts +35 -0
- package/dist/dashboard-source/apps/frontend/lib/embed-manifest.ts +10 -103
- package/dist/dashboard-source/apps/frontend/lib/forms/invitation.ts +43 -0
- package/dist/dashboard-source/apps/frontend/lib/forms/provider-user.ts +64 -0
- package/dist/dashboard-source/apps/frontend/lib/frontend-form-loaders.ts +40 -0
- package/dist/dashboard-source/apps/frontend/lib/frontend-manifest.ts +1 -33
- package/dist/dashboard-source/apps/frontend/lib/generated/gql/gql.ts +123 -33
- package/dist/dashboard-source/apps/frontend/lib/generated/gql/graphql.ts +169 -30
- package/dist/dashboard-source/apps/frontend/lib/generated/gql/index.ts +1 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/anonymous-page.ts +27 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/dependent-lookup-query.ts +1 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/list-queries.ts +38 -29
- package/dist/dashboard-source/apps/frontend/lib/graphql/lookup-provider.tsx +82 -10
- package/dist/dashboard-source/apps/frontend/lib/graphql/org-chart-operations.ts +2 -5
- package/dist/dashboard-source/apps/frontend/lib/graphql/queries.ts +25 -4
- package/dist/dashboard-source/apps/frontend/lib/graphql/server-client.ts +11 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/settings-queries.ts +13 -104
- package/dist/dashboard-source/apps/frontend/lib/graphql/user-queries.ts +11 -4
- package/dist/dashboard-source/apps/frontend/lib/graphql/workflow-operations.ts +1 -3
- package/dist/dashboard-source/apps/frontend/lib/graphql/workflow-queries.ts +1 -0
- package/dist/dashboard-source/apps/frontend/lib/list-detail-selection.ts +54 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/executions.ts +110 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/list-writes.ts +395 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/lists.ts +263 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/oauth.ts +900 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/origin.ts +42 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/processes.ts +436 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/read-tool.ts +72 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/result.ts +4 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/server.ts +71 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/store.ts +193 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/todos.ts +237 -0
- package/dist/dashboard-source/apps/frontend/lib/notifications/notification-preference.ts +0 -1
- package/dist/dashboard-source/apps/frontend/lib/notifications/todo-notification-observer.ts +0 -5
- package/dist/dashboard-source/apps/frontend/lib/org-chart-data.ts +0 -2
- package/dist/dashboard-source/apps/frontend/lib/org-identity.ts +6 -4
- package/dist/dashboard-source/apps/frontend/lib/organisation-form-loaders.ts +4 -0
- package/dist/dashboard-source/apps/frontend/lib/public-todo-form-runtime.ts +0 -1
- package/dist/dashboard-source/apps/frontend/lib/public-todo-model.ts +39 -139
- package/dist/dashboard-source/apps/frontend/lib/public-todo-server.ts +17 -16
- package/dist/dashboard-source/apps/frontend/lib/query-client.ts +0 -1
- package/dist/dashboard-source/apps/frontend/lib/todo-utils.ts +1 -77
- package/dist/dashboard-source/apps/frontend/lib/workflow/layout.ts +3 -7
- package/dist/dashboard-source/apps/frontend/next.config.ts +33 -13
- package/dist/dashboard-source/apps/frontend/package.json +48 -47
- package/dist/dashboard-source/apps/frontend/proxy.ts +72 -14
- package/dist/dashboard-source/modules/auth-local-cedar/src/index.ts +0 -3
- package/dist/dashboard-source/modules/auth-local-cedar/src/lib/auth-local-cedar.ts +165 -233
- package/dist/dashboard-source/modules/auth-local-cedar/src/lib/cedar-reload-notifier.ts +4 -3
- package/dist/dashboard-source/modules/auth-local-cedar/src/lib/config-base.ts +111 -75
- package/dist/dashboard-source/modules/auth-local-cedar/src/lib/policy-watcher.ts +14 -18
- package/dist/dashboard-source/modules/auth-policy/src/index.ts +1 -0
- package/dist/dashboard-source/modules/auth-policy/src/lib/auth-policy.ts +19 -37
- package/dist/dashboard-source/modules/auth-policy/src/lib/current-principal.ts +33 -29
- package/dist/dashboard-source/modules/auth-policy/src/lib/policy-revision.ts +23 -0
- package/dist/dashboard-source/modules/auth-policy/src/lib/types.ts +24 -49
- package/dist/dashboard-source/modules/auth-session/src/index.ts +4 -0
- package/dist/dashboard-source/modules/auth-session/src/lib/project-subscription.ts +13 -0
- package/dist/dashboard-source/modules/auth-session/src/lib/realtime-recipient.ts +10 -2
- package/dist/dashboard-source/modules/auth-session/src/lib/subjects.ts +82 -8
- package/dist/dashboard-source/modules/auth-session/src/lib/workload-access.ts +48 -0
- package/dist/dashboard-source/modules/auth-session/src/lib/workload-audit.ts +52 -0
- package/dist/dashboard-source/modules/aws-common/src/index.ts +0 -1
- package/dist/dashboard-source/modules/effect-json-logger/src/lib/effect-json-logger.ts +6 -9
- package/dist/dashboard-source/modules/form/src/hooks/use-local-storage.ts +5 -3
- package/dist/dashboard-source/modules/form/src/index.ts +1 -10
- package/dist/dashboard-source/modules/form/src/lib/effect-schema-form.tsx +1271 -0
- package/dist/dashboard-source/modules/form/src/lib/form-actions.ts +26 -0
- package/dist/dashboard-source/modules/form/src/lib/form-prefill.tsx +79 -0
- package/dist/dashboard-source/modules/form/src/lib/initial-focus.ts +31 -0
- package/dist/dashboard-source/modules/form/src/lib/lookup-context.tsx +18 -0
- package/dist/dashboard-source/modules/form/src/lib/plugin-registry.ts +4 -0
- package/dist/dashboard-source/modules/form/src/lib/plugin-scripts.ts +26 -0
- package/dist/dashboard-source/modules/form/src/lib/registered-plugin-field.tsx +57 -0
- package/dist/dashboard-source/modules/form/src/lib/schema-lookup.tsx +124 -0
- package/dist/dashboard-source/modules/form/src/lib/schema-typeahead.tsx +522 -0
- package/dist/dashboard-source/modules/form/src/lib/validation-logic.ts +172 -0
- package/dist/dashboard-source/modules/form-schema/src/index.ts +4 -1
- package/dist/dashboard-source/modules/form-schema/src/lib/annotation-helpers.ts +19 -14
- package/dist/dashboard-source/modules/form-schema/src/lib/email.ts +13 -11
- package/dist/dashboard-source/modules/form-schema/src/lib/field-count.ts +15 -13
- package/dist/dashboard-source/modules/form-schema/src/lib/form-annotations.ts +14 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/form-presentation.ts +33 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/form-schema.ts +186 -80
- package/dist/dashboard-source/modules/form-schema/src/lib/number-from-string.ts +26 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/phone.ts +8 -7
- package/dist/dashboard-source/modules/form-schema/src/lib/public-completion-correction.ts +7 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/search-lookup-items.ts +27 -0
- package/dist/dashboard-source/modules/form-submission-schema/src/index.ts +5 -0
- package/dist/dashboard-source/modules/form-submission-schema/src/lib/executable-rules.ts +379 -0
- package/dist/dashboard-source/modules/form-submission-schema/src/lib/form-submission-schema.ts +475 -0
- package/dist/dashboard-source/modules/form-submission-schema/src/lib/json-schema.ts +58 -0
- package/dist/dashboard-source/modules/form-submission-schema/src/lib/schema-defaults.ts +158 -0
- package/dist/dashboard-source/modules/form-submission-schema/src/lib/submission-utils.ts +75 -0
- package/dist/dashboard-source/modules/frontend-manifest/src/lib/browser-plugin-artifact.ts +46 -0
- package/dist/dashboard-source/modules/frontend-manifest/src/lib/frontend-manifest.ts +37 -30
- package/dist/dashboard-source/modules/frontend-plugin-host/src/lib/frontend-plugin-host.ts +9 -1
- package/dist/dashboard-source/modules/openauth/src/client.ts +25 -17
- package/dist/dashboard-source/modules/openauth/src/util.ts +16 -0
- package/dist/dashboard-source/modules/{aws-common/src/lib/project-balance-admission.ts → project-accounting/src/admission.ts} +4 -8
- package/dist/dashboard-source/modules/realtime-client/src/appsync-client.ts +377 -0
- package/dist/dashboard-source/modules/realtime-client/src/index.ts +5 -0
- package/dist/dashboard-source/modules/realtime-client/src/subscription-presence.ts +163 -0
- package/dist/dashboard-source/modules/request-time/src/lib/request-time.ts +6 -24
- package/dist/dashboard-source/modules/rxdb-collections/generated/execution-schema.json +28 -21
- package/dist/dashboard-source/modules/rxdb-collections/src/lib/rxdb-collections.ts +25 -18
- package/dist/dashboard-source/modules/rxdb-collections/src/lib/to-rxdb-schema.ts +60 -10
- package/dist/dashboard-source/modules/shadcn-components/src/index.ts +18 -2
- package/dist/dashboard-source/modules/shadcn-components/src/lib/date-calendar.tsx +93 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/date-field.tsx +147 -48
- package/dist/dashboard-source/modules/shadcn-components/src/lib/date-time-display.tsx +272 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/local-date-time-input.tsx +108 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/lookup-field.tsx +237 -351
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/popover.tsx +2 -1
- package/dist/dashboard-source.json +48 -47
- package/dist/graphql-server.mjs +245 -200
- package/dist/job-worker-supervisor.mjs +262 -0
- package/dist/job-worker.mjs +234 -133
- package/dist/main.mjs +23 -4
- package/dist/prepare-dashboard.mjs +8 -8
- package/dist/resources/cedar/policies.cedar +80 -38
- package/dist/resources/cedar/schema.cedarschema +39 -21
- package/dist/resources/graphql-schema/rxdb.graphql +2 -0
- package/dist/resources/graphql-schema/system.graphql +204 -51
- package/package.json +64 -62
- package/dist/chunk-6b6t8tyq.js +0 -85
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/utils.ts +0 -20
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/components/process-form-actions.tsx +0 -105
- package/dist/dashboard-source/apps/frontend/hooks/use-draft-process-save.ts +0 -189
- package/dist/dashboard-source/apps/frontend/hooks/use-draft-state.ts +0 -79
- package/dist/dashboard-source/apps/frontend/hooks/use-processes-query.ts +0 -56
- package/dist/dashboard-source/modules/form/src/lib/ajv-standard-schema.ts +0 -152
- package/dist/dashboard-source/modules/form/src/lib/client-components-to-form.tsx +0 -1421
- package/dist/dashboard-source/modules/form/src/lib/friendly-validation-message.ts +0 -85
- package/dist/dashboard-source/modules/form/src/lib/walker.tsx +0 -1549
- package/dist/dashboard-source/modules/form-client-representation/src/lib/client-form-definition.ts +0 -440
- package/dist/dashboard-source/modules/form-client-representation/src/lib/plugin-registry.ts +0 -13
- package/dist/dashboard-source/modules/form-client-representation/src/lib/types.ts +0 -336
- package/dist/dashboard-source/modules/form-rule/src/index.ts +0 -21
- package/dist/dashboard-source/modules/form-rule/src/lib/evaluator.ts +0 -531
- package/dist/dashboard-source/modules/form-rule/src/lib/paths.ts +0 -102
- package/dist/dashboard-source/modules/form-rule/src/lib/types.ts +0 -121
- package/dist/dashboard-source/modules/form-schema/src/lib/property-signature.ts +0 -45
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as Tooltip from "@radix-ui/react-tooltip"
|
|
4
|
+
import {
|
|
5
|
+
type ReactNode,
|
|
6
|
+
createContext,
|
|
7
|
+
useContext,
|
|
8
|
+
useEffect,
|
|
9
|
+
useState,
|
|
10
|
+
} from "react"
|
|
11
|
+
import { cn } from "./utils/utils.ts"
|
|
12
|
+
|
|
13
|
+
export type DateTimeDisplayMode =
|
|
14
|
+
| "relative"
|
|
15
|
+
| "browser-local"
|
|
16
|
+
| "event-local"
|
|
17
|
+
| "utc"
|
|
18
|
+
export type DateTimeDisplayProps = { className?: string } & (
|
|
19
|
+
| { kind: "calendar-date"; value: string }
|
|
20
|
+
| {
|
|
21
|
+
kind: "timestamp"
|
|
22
|
+
value: string | Date | number
|
|
23
|
+
initialMode?: DateTimeDisplayMode
|
|
24
|
+
eventTimeZone?: string
|
|
25
|
+
seconds?: boolean
|
|
26
|
+
}
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
type DisplayEnvironment = {
|
|
30
|
+
now: number
|
|
31
|
+
locale: string
|
|
32
|
+
timeZone: string
|
|
33
|
+
hydrated: boolean
|
|
34
|
+
}
|
|
35
|
+
const Environment = createContext<DisplayEnvironment | null>(null)
|
|
36
|
+
|
|
37
|
+
/** Serialize one server reference with the tree, rather than reading two clocks during hydration. */
|
|
38
|
+
export function DateTimeDisplayProvider({
|
|
39
|
+
initialNow,
|
|
40
|
+
children,
|
|
41
|
+
}: {
|
|
42
|
+
initialNow: number
|
|
43
|
+
children: ReactNode
|
|
44
|
+
}) {
|
|
45
|
+
const [environment, setEnvironment] = useState<DisplayEnvironment>({
|
|
46
|
+
now: initialNow,
|
|
47
|
+
locale: "en-US",
|
|
48
|
+
timeZone: "UTC",
|
|
49
|
+
hydrated: false,
|
|
50
|
+
})
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
const refresh = () => {
|
|
53
|
+
if (document.visibilityState === "hidden") return
|
|
54
|
+
const { locale, timeZone } = new Intl.DateTimeFormat().resolvedOptions()
|
|
55
|
+
setEnvironment({ now: Date.now(), locale, timeZone, hydrated: true })
|
|
56
|
+
}
|
|
57
|
+
refresh()
|
|
58
|
+
const timer = setInterval(refresh, 10_000)
|
|
59
|
+
document.addEventListener("visibilitychange", refresh)
|
|
60
|
+
return () => {
|
|
61
|
+
clearInterval(timer)
|
|
62
|
+
document.removeEventListener("visibilitychange", refresh)
|
|
63
|
+
}
|
|
64
|
+
}, [])
|
|
65
|
+
return (
|
|
66
|
+
<Environment value={environment}>
|
|
67
|
+
<Tooltip.Provider delayDuration={0}>{children}</Tooltip.Provider>
|
|
68
|
+
</Environment>
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function calendarDate(value: string): Date | null {
|
|
73
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(value)) return null
|
|
74
|
+
const date = new Date(`${value}T00:00:00.000Z`)
|
|
75
|
+
return Number.isFinite(date.getTime()) &&
|
|
76
|
+
date.toISOString().slice(0, 10) === value
|
|
77
|
+
? date
|
|
78
|
+
: null
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function parseValue(props: DateTimeDisplayProps): Date | null {
|
|
82
|
+
if (props.kind === "calendar-date") return calendarDate(props.value)
|
|
83
|
+
// Strings must identify an instant, not rely on the server/viewer's local zone.
|
|
84
|
+
if (
|
|
85
|
+
typeof props.value === "string" &&
|
|
86
|
+
(!/^\d{4}-\d{2}-\d{2}T(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z|[+-]\d{2}:\d{2})$/i.test(
|
|
87
|
+
props.value,
|
|
88
|
+
) ||
|
|
89
|
+
!calendarDate(props.value.slice(0, 10)))
|
|
90
|
+
)
|
|
91
|
+
return null
|
|
92
|
+
const date = new Date(props.value)
|
|
93
|
+
return Number.isFinite(date.getTime()) ? date : null
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function validatedZone(zone: string): string | null {
|
|
97
|
+
try {
|
|
98
|
+
return new Intl.DateTimeFormat("en", { timeZone: zone }).resolvedOptions()
|
|
99
|
+
.timeZone
|
|
100
|
+
} catch {
|
|
101
|
+
return null
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Modern Intl preserves supplied aliases in resolvedOptions. Generic names
|
|
106
|
+
// identify equivalent zone displays without conflating UTC with winter London.
|
|
107
|
+
function zoneKey(zone: string, date: Date) {
|
|
108
|
+
return new Intl.DateTimeFormat("en-US", {
|
|
109
|
+
timeZone: zone,
|
|
110
|
+
timeZoneName: "longGeneric",
|
|
111
|
+
hour: "numeric",
|
|
112
|
+
minute: "numeric",
|
|
113
|
+
}).format(date)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function absolute(
|
|
117
|
+
date: Date,
|
|
118
|
+
locale: string,
|
|
119
|
+
timeZone: string,
|
|
120
|
+
seconds: boolean,
|
|
121
|
+
calendar = false,
|
|
122
|
+
) {
|
|
123
|
+
return new Intl.DateTimeFormat(locale, {
|
|
124
|
+
year: "numeric",
|
|
125
|
+
month: "short",
|
|
126
|
+
day: "numeric",
|
|
127
|
+
timeZone,
|
|
128
|
+
...(calendar
|
|
129
|
+
? {}
|
|
130
|
+
: ({
|
|
131
|
+
hour: "numeric",
|
|
132
|
+
minute: "2-digit",
|
|
133
|
+
...(seconds ? { second: "2-digit" } : {}),
|
|
134
|
+
timeZoneName: "short",
|
|
135
|
+
} satisfies Intl.DateTimeFormatOptions)),
|
|
136
|
+
}).format(date)
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function relative(date: Date, now: number, locale: string) {
|
|
140
|
+
const seconds = (date.getTime() - now) / 1000
|
|
141
|
+
if (Math.abs(seconds) < 10) return "just now"
|
|
142
|
+
const units: readonly [Intl.RelativeTimeFormatUnit, number][] = [
|
|
143
|
+
["year", 31_536_000],
|
|
144
|
+
["month", 2_592_000],
|
|
145
|
+
["day", 86_400],
|
|
146
|
+
["hour", 3600],
|
|
147
|
+
["minute", 60],
|
|
148
|
+
["second", 1],
|
|
149
|
+
]
|
|
150
|
+
const [unit, size] = units.find(([, size]) => Math.abs(seconds) >= size) ?? [
|
|
151
|
+
"second",
|
|
152
|
+
1,
|
|
153
|
+
]
|
|
154
|
+
return new Intl.RelativeTimeFormat(locale, { numeric: "always" }).format(
|
|
155
|
+
Math.round(seconds / size),
|
|
156
|
+
unit,
|
|
157
|
+
)
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const modeNames: Record<DateTimeDisplayMode, string> = {
|
|
161
|
+
relative: "Relative time",
|
|
162
|
+
"browser-local": "Browser-local time",
|
|
163
|
+
"event-local": "Event-local time",
|
|
164
|
+
utc: "UTC",
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export function DateTimeDisplay(props: DateTimeDisplayProps) {
|
|
168
|
+
const environment = useContext(Environment)
|
|
169
|
+
const [mode, setMode] = useState<DateTimeDisplayMode>(
|
|
170
|
+
props.kind === "timestamp" ? (props.initialMode ?? "relative") : "relative",
|
|
171
|
+
)
|
|
172
|
+
const date = parseValue(props)
|
|
173
|
+
const eventZone =
|
|
174
|
+
props.kind === "timestamp" && props.eventTimeZone !== undefined
|
|
175
|
+
? validatedZone(props.eventTimeZone)
|
|
176
|
+
: undefined
|
|
177
|
+
const invalid = !date || eventZone === null
|
|
178
|
+
useEffect(() => {
|
|
179
|
+
if (!invalid) return
|
|
180
|
+
const error = new Error(
|
|
181
|
+
`DateTimeDisplay: Invalid date (${props.kind}, ${eventZone === null ? "invalid-time-zone" : "invalid-value"})`,
|
|
182
|
+
)
|
|
183
|
+
// The browser error channel is collected by the host's error-reporting plugin.
|
|
184
|
+
if (typeof globalThis.reportError === "function")
|
|
185
|
+
globalThis.reportError(error)
|
|
186
|
+
else console.error(error)
|
|
187
|
+
}, [invalid, props.kind, eventZone])
|
|
188
|
+
if (!environment)
|
|
189
|
+
throw new Error(
|
|
190
|
+
"DateTimeDisplay requires DateTimeDisplayProvider with a serialized initialNow",
|
|
191
|
+
)
|
|
192
|
+
if (invalid || !date)
|
|
193
|
+
return <span className={props.className}>Invalid date</span>
|
|
194
|
+
const { locale, timeZone, now, hydrated } = environment
|
|
195
|
+
if (props.kind === "calendar-date") {
|
|
196
|
+
return (
|
|
197
|
+
<time className={props.className} dateTime={props.value}>
|
|
198
|
+
{absolute(date, locale, "UTC", false, true)}
|
|
199
|
+
</time>
|
|
200
|
+
)
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const zones: Record<DateTimeDisplayMode, string> = {
|
|
204
|
+
relative: timeZone,
|
|
205
|
+
"browser-local": timeZone,
|
|
206
|
+
"event-local": eventZone ?? timeZone,
|
|
207
|
+
utc: "UTC",
|
|
208
|
+
}
|
|
209
|
+
const cycle: DateTimeDisplayMode[] = ["relative", "browser-local"]
|
|
210
|
+
const seen = new Set([zoneKey(timeZone, date)])
|
|
211
|
+
if (eventZone && !seen.has(zoneKey(eventZone, date))) {
|
|
212
|
+
cycle.push("event-local")
|
|
213
|
+
seen.add(zoneKey(eventZone, date))
|
|
214
|
+
}
|
|
215
|
+
if (!seen.has(zoneKey("UTC", date))) cycle.push("utc")
|
|
216
|
+
const current = cycle.includes(mode)
|
|
217
|
+
? mode
|
|
218
|
+
: (cycle.find(
|
|
219
|
+
(candidate) =>
|
|
220
|
+
candidate !== "relative" &&
|
|
221
|
+
zoneKey(zones[candidate], date) === zoneKey(zones[mode], date),
|
|
222
|
+
) ?? "browser-local")
|
|
223
|
+
const next = cycle[(cycle.indexOf(current) + 1) % cycle.length] ?? "relative"
|
|
224
|
+
const seconds = props.seconds ?? false
|
|
225
|
+
const text =
|
|
226
|
+
current === "relative"
|
|
227
|
+
? relative(date, now, locale)
|
|
228
|
+
: absolute(date, locale, zones[current], seconds)
|
|
229
|
+
const exact = absolute(date, locale, timeZone, seconds)
|
|
230
|
+
const currentName =
|
|
231
|
+
current === "browser-local" && !hydrated
|
|
232
|
+
? "UTC (browser-local time pending)"
|
|
233
|
+
: modeNames[current]
|
|
234
|
+
return (
|
|
235
|
+
<Tooltip.Root>
|
|
236
|
+
<Tooltip.Trigger asChild>
|
|
237
|
+
<button
|
|
238
|
+
type="button"
|
|
239
|
+
className={cn(
|
|
240
|
+
"rounded-sm text-left underline decoration-dotted underline-offset-4 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring",
|
|
241
|
+
props.className,
|
|
242
|
+
)}
|
|
243
|
+
aria-label={`${text}. ${currentName}. Show ${modeNames[next]}.`}
|
|
244
|
+
onClick={(event) => {
|
|
245
|
+
event.stopPropagation()
|
|
246
|
+
setMode(next)
|
|
247
|
+
}}
|
|
248
|
+
onKeyDown={(event) => {
|
|
249
|
+
event.stopPropagation()
|
|
250
|
+
}}
|
|
251
|
+
onKeyUp={(event) => {
|
|
252
|
+
event.stopPropagation()
|
|
253
|
+
}}
|
|
254
|
+
>
|
|
255
|
+
<time dateTime={date.toISOString()}>{text}</time>
|
|
256
|
+
</button>
|
|
257
|
+
</Tooltip.Trigger>
|
|
258
|
+
<Tooltip.Portal>
|
|
259
|
+
<Tooltip.Content
|
|
260
|
+
side="top"
|
|
261
|
+
align="start"
|
|
262
|
+
sideOffset={4}
|
|
263
|
+
collisionPadding={8}
|
|
264
|
+
className="z-50 max-w-[min(20rem,var(--radix-tooltip-content-available-width))] rounded-md bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md"
|
|
265
|
+
>
|
|
266
|
+
{hydrated ? "Browser-local" : "UTC (browser-local time pending)"}:{" "}
|
|
267
|
+
{exact}
|
|
268
|
+
</Tooltip.Content>
|
|
269
|
+
</Tooltip.Portal>
|
|
270
|
+
</Tooltip.Root>
|
|
271
|
+
)
|
|
272
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { CalendarIcon } from "lucide-react"
|
|
2
|
+
import { useRef, useState } from "react"
|
|
3
|
+
import {
|
|
4
|
+
DateCalendar,
|
|
5
|
+
formatCalendarDay,
|
|
6
|
+
parseCalendarDay,
|
|
7
|
+
} from "./date-calendar.tsx"
|
|
8
|
+
import { formatDateInputDay } from "./date-field.tsx"
|
|
9
|
+
import { Button } from "./ui/button.tsx"
|
|
10
|
+
import { Input } from "./ui/input.tsx"
|
|
11
|
+
import { Popover, PopoverContent, PopoverTrigger } from "./ui/popover.tsx"
|
|
12
|
+
|
|
13
|
+
export function LocalDateTimeInput({
|
|
14
|
+
id,
|
|
15
|
+
label,
|
|
16
|
+
value,
|
|
17
|
+
disabled,
|
|
18
|
+
required,
|
|
19
|
+
invalid,
|
|
20
|
+
describedBy,
|
|
21
|
+
onChange,
|
|
22
|
+
onBlur,
|
|
23
|
+
}: {
|
|
24
|
+
id: string
|
|
25
|
+
label: string
|
|
26
|
+
value: string
|
|
27
|
+
disabled: boolean
|
|
28
|
+
required: boolean
|
|
29
|
+
invalid: boolean
|
|
30
|
+
describedBy: string
|
|
31
|
+
onChange: (value: string) => void
|
|
32
|
+
onBlur: () => void
|
|
33
|
+
}) {
|
|
34
|
+
const [open, setOpen] = useState(false)
|
|
35
|
+
const triggerRef = useRef<HTMLButtonElement>(null)
|
|
36
|
+
// Keep even a partial value in form state so drafts retain either input.
|
|
37
|
+
const [day = "", time = ""] = value.split(" ")
|
|
38
|
+
const selected = parseCalendarDay(day)
|
|
39
|
+
const displayDay = selected ? formatDateInputDay(selected) : "Choose date"
|
|
40
|
+
const change = (nextDay: string, nextTime: string) =>
|
|
41
|
+
onChange(nextDay || nextTime ? `${nextDay} ${nextTime}` : "")
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<fieldset className="space-y-1" disabled={disabled}>
|
|
45
|
+
<legend className="text-sm font-medium">{label}</legend>
|
|
46
|
+
<div className="flex flex-wrap items-end gap-2">
|
|
47
|
+
<Popover open={!disabled && open} onOpenChange={setOpen}>
|
|
48
|
+
<PopoverTrigger asChild>
|
|
49
|
+
<Button
|
|
50
|
+
ref={triggerRef}
|
|
51
|
+
type="button"
|
|
52
|
+
variant="outline"
|
|
53
|
+
aria-label={`${label}: ${displayDay}`}
|
|
54
|
+
aria-invalid={invalid}
|
|
55
|
+
aria-describedby={describedBy}
|
|
56
|
+
>
|
|
57
|
+
<CalendarIcon />
|
|
58
|
+
{displayDay}
|
|
59
|
+
</Button>
|
|
60
|
+
</PopoverTrigger>
|
|
61
|
+
<PopoverContent
|
|
62
|
+
className="w-auto p-3"
|
|
63
|
+
align="start"
|
|
64
|
+
aria-label={`${label}: calendar`}
|
|
65
|
+
>
|
|
66
|
+
<DateCalendar
|
|
67
|
+
selected={selected}
|
|
68
|
+
defaultMonth={selected}
|
|
69
|
+
onSelect={(date) => {
|
|
70
|
+
if (!date) return
|
|
71
|
+
change(formatCalendarDay(date), time)
|
|
72
|
+
onBlur()
|
|
73
|
+
setOpen(false)
|
|
74
|
+
}}
|
|
75
|
+
/>
|
|
76
|
+
</PopoverContent>
|
|
77
|
+
</Popover>
|
|
78
|
+
<Input
|
|
79
|
+
id={id}
|
|
80
|
+
name={id}
|
|
81
|
+
type="time"
|
|
82
|
+
step={1}
|
|
83
|
+
value={time}
|
|
84
|
+
className="w-auto"
|
|
85
|
+
aria-label={`${label}: time`}
|
|
86
|
+
aria-required={required}
|
|
87
|
+
aria-invalid={invalid}
|
|
88
|
+
aria-describedby={describedBy}
|
|
89
|
+
onBlur={onBlur}
|
|
90
|
+
onChange={(event) => change(day, event.target.value)}
|
|
91
|
+
/>
|
|
92
|
+
{!required && value !== "" && (
|
|
93
|
+
<Button
|
|
94
|
+
type="button"
|
|
95
|
+
variant="ghost"
|
|
96
|
+
aria-label={`Clear ${label}`}
|
|
97
|
+
onClick={() => {
|
|
98
|
+
onChange("")
|
|
99
|
+
triggerRef.current?.focus()
|
|
100
|
+
}}
|
|
101
|
+
>
|
|
102
|
+
Clear
|
|
103
|
+
</Button>
|
|
104
|
+
)}
|
|
105
|
+
</div>
|
|
106
|
+
</fieldset>
|
|
107
|
+
)
|
|
108
|
+
}
|