@processfocus/runtime-local 0.1.0-next.0
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/LICENSE.md +28 -0
- package/README.md +290 -0
- package/dist/authentication-server.mjs +188 -0
- package/dist/chunk-2sb4v2sx.js +70 -0
- package/dist/chunk-9weqs8n8.js +56031 -0
- package/dist/chunk-mvkr77wp.js +54113 -0
- package/dist/chunk-tkn4cnc8.js +453 -0
- package/dist/chunk-vpsm84e8.js +85 -0
- package/dist/dashboard-source/apps/frontend/app/%5Fpf/app-icons/[...path]/route.ts +63 -0
- package/dist/dashboard-source/apps/frontend/app/%5Fpf/health/page.tsx +19 -0
- package/dist/dashboard-source/apps/frontend/app/%5Fpf/public-form-branding/[...path]/route.ts +95 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/act-on-behalf/actions.ts +248 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/act-on-behalf/delegations-client.tsx +751 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/act-on-behalf/page.tsx +46 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/client-index.tsx +375 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/client.tsx +14 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/client.tsx +73 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/page.tsx +20 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/process-state/page.tsx +22 -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 +11 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/[executionId]/process-state/page.tsx +23 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/abandon-execution-dialog.tsx +137 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/execution-card-menu.tsx +233 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/layout.tsx +19 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/page.tsx +1549 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/process-state-dialog.tsx +91 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/process-state-modal-client.tsx +33 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/process-state-page-client.tsx +31 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/process-state-route-fallback.tsx +18 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/restart-execution-feedback.tsx +40 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/layout.tsx +129 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/@modal/(.)item/[id]/client.tsx +215 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/@modal/(.)item/[id]/page.tsx +23 -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 +678 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/[...listPath]/loading.tsx +10 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/[...listPath]/page.tsx +228 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-create-form.tsx +147 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-item-edit-form.tsx +246 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/metric-control-url-state.ts +71 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/use-list-deleted-callback.ts +22 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/use-list-item-detail.ts +315 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/item/[id]/client.tsx +259 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/item/[id]/page.tsx +46 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/layout.tsx +14 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/lib/list-detail-title.ts +20 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/lib/list-refresh.ts +26 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/utils.ts +20 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/loading.tsx +5 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/org-chart/org-chart-client.tsx +74 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/org-chart/page.tsx +120 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/page.tsx +13 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/actions.ts +188 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/page.tsx +33 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/passkeys-client.tsx +320 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/(.)start/[...startStepPath]/client.tsx +152 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/(.)start/[...startStepPath]/page.tsx +41 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/default.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/client.tsx +33 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/components/process-form-actions.tsx +105 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/components/process-submit-button.tsx +81 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/components/start-process-form.tsx +282 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/layout.tsx +21 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/lib/mobile-process-catalog.ts +28 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/lib/start-process-actions.ts +13 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/loading.tsx +10 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/page.tsx +5 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/processes-client.tsx +504 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/start/[...startStepPath]/client.tsx +153 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/start/[...startStepPath]/page.tsx +39 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/loading.tsx +20 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/page.tsx +131 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/process-documentation.tsx +209 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/use-workflow-auto-refresh.ts +120 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/workflow-flow.tsx +319 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/workflow-form-preview-sheet.tsx +98 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/[[...tab]]/loading.tsx +1 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/[[...tab]]/page.tsx +100 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/access-handbook.tsx +110 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/authorization-loading.tsx +25 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/authorization-tabs.tsx +47 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/cedar-authorize.ts +261 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/cedar-helpers.ts +17 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/cedar-source.tsx +34 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/cedar-types.ts +79 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/evaluate-cedar.ts +43 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/explorer.tsx +526 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/layout.tsx +23 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/load-cedar.ts +174 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/load-handbook.ts +390 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/org-data.ts +70 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/[invitationId]/page.tsx +22 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/invitation-detail-client.tsx +594 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/invitation-detail-skeleton.tsx +48 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/new/page.tsx +5 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations-table.tsx +186 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/page.tsx +69 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/providers-table.tsx +48 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/roles-table.tsx +62 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/settings-client.tsx +244 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/client.tsx +329 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/page.tsx +21 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/tokens/page.tsx +39 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users-table.tsx +82 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/stats/[...statsPath]/error.tsx +34 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/stats/[...statsPath]/not-found.tsx +13 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/stats/[...statsPath]/page.tsx +84 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/stats/[...statsPath]/stats-data-fetcher.tsx +93 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/@modal/(.)complete/[...stepPath]/client.tsx +143 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/@modal/(.)complete/[...stepPath]/page.tsx +50 -0
- 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 +131 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/complete/[...stepPath]/page.tsx +50 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/complete-todo-form.tsx +172 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/public-completion-correction-form.tsx +233 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/todo-form-actions.tsx +26 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/correct/[...stepPath]/page.tsx +58 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/layout.tsx +14 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/lib/mobile-todo-list.ts +154 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/page.tsx +1317 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/callback/route.ts +259 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/delegation/route.ts +127 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/login/route.ts +49 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/logout/route.ts +33 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/passkey/auth-options/route.ts +79 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/passkey/auth-verify/route.ts +142 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/passkey/register/route.ts +103 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/passkey/register-verify/route.ts +136 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/passkey/registration-session/route.ts +129 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/passkey/start/route.ts +153 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/refresh/route.ts +122 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/switch-role/route.ts +177 -0
- package/dist/dashboard-source/apps/frontend/app/api/dev/import-completed/route.ts +22 -0
- package/dist/dashboard-source/apps/frontend/app/api/dev/import-events/route.ts +38 -0
- package/dist/dashboard-source/apps/frontend/app/api/embed/lookup/route.ts +266 -0
- package/dist/dashboard-source/apps/frontend/app/api/embed/submit/route.ts +118 -0
- package/dist/dashboard-source/apps/frontend/app/api/embed/test-host/route.ts +125 -0
- package/dist/dashboard-source/apps/frontend/app/api/public/to-dos/calendar-slots/route.ts +44 -0
- package/dist/dashboard-source/apps/frontend/app/api/public/to-dos/complete/route.ts +56 -0
- package/dist/dashboard-source/apps/frontend/app/api/public/to-dos/lookup/route.ts +61 -0
- package/dist/dashboard-source/apps/frontend/app/api/public/to-dos/request-fresh-link/route.ts +41 -0
- package/dist/dashboard-source/apps/frontend/app/api/revalidate/route.ts +61 -0
- package/dist/dashboard-source/apps/frontend/app/app-shell.tsx +100 -0
- package/dist/dashboard-source/apps/frontend/app/cli-auth/route.ts +261 -0
- package/dist/dashboard-source/apps/frontend/app/embed/[...startStepPath]/embed-client.tsx +393 -0
- package/dist/dashboard-source/apps/frontend/app/embed/[...startStepPath]/loading.tsx +13 -0
- package/dist/dashboard-source/apps/frontend/app/embed/[...startStepPath]/page.tsx +51 -0
- package/dist/dashboard-source/apps/frontend/app/embed/embedded.css +48 -0
- package/dist/dashboard-source/apps/frontend/app/embed/layout.tsx +15 -0
- package/dist/dashboard-source/apps/frontend/app/global.css +13 -0
- package/dist/dashboard-source/apps/frontend/app/layout.tsx +102 -0
- package/dist/dashboard-source/apps/frontend/app/login/layout.tsx +9 -0
- package/dist/dashboard-source/apps/frontend/app/login/login-button.tsx +35 -0
- package/dist/dashboard-source/apps/frontend/app/login/login-form-content.tsx +117 -0
- package/dist/dashboard-source/apps/frontend/app/login/login-form.tsx +30 -0
- package/dist/dashboard-source/apps/frontend/app/login/page.tsx +52 -0
- package/dist/dashboard-source/apps/frontend/app/login/passkey-button.tsx +226 -0
- package/dist/dashboard-source/apps/frontend/app/login/secret-login-form.tsx +91 -0
- package/dist/dashboard-source/apps/frontend/app/manifest.ts +7 -0
- package/dist/dashboard-source/apps/frontend/app/public/form/[token]/error.tsx +63 -0
- package/dist/dashboard-source/apps/frontend/app/public/form/[token]/layout.tsx +34 -0
- package/dist/dashboard-source/apps/frontend/app/public/form/[token]/page.tsx +129 -0
- package/dist/dashboard-source/apps/frontend/app/public/form/[token]/public-form-branding-card.tsx +42 -0
- package/dist/dashboard-source/apps/frontend/app/public/form/[token]/public-form-branding-context.tsx +27 -0
- package/dist/dashboard-source/apps/frontend/app/public/form/[token]/public-form-branding-html.tsx +40 -0
- package/dist/dashboard-source/apps/frontend/app/public/form/[token]/public-todo-client.tsx +553 -0
- package/dist/dashboard-source/apps/frontend/app/public/form/[token]/public-todo-state-content.tsx +27 -0
- package/dist/dashboard-source/apps/frontend/app/public.css +33 -0
- package/dist/dashboard-source/apps/frontend/app/register/passkey/layout.tsx +49 -0
- package/dist/dashboard-source/apps/frontend/app/register/passkey/page.tsx +36 -0
- package/dist/dashboard-source/apps/frontend/app/register/passkey/register-passkey-client.tsx +292 -0
- package/dist/dashboard-source/apps/frontend/app/theme.css +117 -0
- package/dist/dashboard-source/apps/frontend/components/DashboardSection.tsx +693 -0
- package/dist/dashboard-source/apps/frontend/components/Header.tsx +481 -0
- package/dist/dashboard-source/apps/frontend/components/OrgUnitNode.tsx +41 -0
- package/dist/dashboard-source/apps/frontend/components/app-sidebar.tsx +245 -0
- package/dist/dashboard-source/apps/frontend/components/auth-provider.tsx +158 -0
- package/dist/dashboard-source/apps/frontend/components/collections/collection-table-card.tsx +218 -0
- package/dist/dashboard-source/apps/frontend/components/collections/collection-table-header-row.tsx +97 -0
- package/dist/dashboard-source/apps/frontend/components/config-provider.tsx +27 -0
- package/dist/dashboard-source/apps/frontend/components/copy-button.tsx +40 -0
- package/dist/dashboard-source/apps/frontend/components/dashboard-activity.tsx +35 -0
- package/dist/dashboard-source/apps/frontend/components/dashboard-skeleton.tsx +17 -0
- package/dist/dashboard-source/apps/frontend/components/delegation-expiry.tsx +21 -0
- package/dist/dashboard-source/apps/frontend/components/feature-permissions-provider.tsx +28 -0
- package/dist/dashboard-source/apps/frontend/components/form-dialog-content.tsx +66 -0
- package/dist/dashboard-source/apps/frontend/components/frontend-client-plugin-host.tsx +27 -0
- package/dist/dashboard-source/apps/frontend/components/frontend-client-plugin-identify.tsx +33 -0
- package/dist/dashboard-source/apps/frontend/components/frontend-client-plugin-provider.tsx +55 -0
- package/dist/dashboard-source/apps/frontend/components/journey-timeline.tsx +378 -0
- package/dist/dashboard-source/apps/frontend/components/mobile-home-switchboard.tsx +98 -0
- package/dist/dashboard-source/apps/frontend/components/mocks-provider.tsx +27 -0
- package/dist/dashboard-source/apps/frontend/components/notification-bell.tsx +137 -0
- package/dist/dashboard-source/apps/frontend/components/org-settings-provider.tsx +26 -0
- package/dist/dashboard-source/apps/frontend/components/process-workflow-link.tsx +36 -0
- package/dist/dashboard-source/apps/frontend/components/session-reissue.tsx +48 -0
- package/dist/dashboard-source/apps/frontend/components/sidebar-lists.tsx +89 -0
- package/dist/dashboard-source/apps/frontend/components/sidebar-stats-views.tsx +65 -0
- package/dist/dashboard-source/apps/frontend/components/theme-provider.tsx +132 -0
- package/dist/dashboard-source/apps/frontend/components/todo-count-badge.tsx +59 -0
- package/dist/dashboard-source/apps/frontend/components/token-refresh-scheduler.tsx +304 -0
- package/dist/dashboard-source/apps/frontend/components/ui/checkbox.tsx +31 -0
- package/dist/dashboard-source/apps/frontend/components/ui/dialog.tsx +142 -0
- package/dist/dashboard-source/apps/frontend/components/ui/dropdown-menu.tsx +256 -0
- package/dist/dashboard-source/apps/frontend/components/ui/input.tsx +20 -0
- package/dist/dashboard-source/apps/frontend/components/ui/pagination.tsx +59 -0
- package/dist/dashboard-source/apps/frontend/components/ui/sheet.tsx +138 -0
- package/dist/dashboard-source/apps/frontend/components/ui/sidebar.tsx +741 -0
- package/dist/dashboard-source/apps/frontend/components/ui/skeleton.tsx +13 -0
- package/dist/dashboard-source/apps/frontend/components/ui/tab-pill.tsx +30 -0
- package/dist/dashboard-source/apps/frontend/components/ui/table.tsx +115 -0
- package/dist/dashboard-source/apps/frontend/components/ui/tooltip.tsx +60 -0
- package/dist/dashboard-source/apps/frontend/components/without-waiting-badge.tsx +24 -0
- package/dist/dashboard-source/apps/frontend/components/workflow/step-node.tsx +116 -0
- package/dist/dashboard-source/apps/frontend/components/workflow/swimlane-node.tsx +46 -0
- package/dist/dashboard-source/apps/frontend/components/workflow/workflow-edge.tsx +172 -0
- package/dist/dashboard-source/apps/frontend/hooks/use-draft-process-save.ts +189 -0
- package/dist/dashboard-source/apps/frontend/hooks/use-draft-state.ts +79 -0
- package/dist/dashboard-source/apps/frontend/hooks/use-form-metadata.ts +74 -0
- package/dist/dashboard-source/apps/frontend/hooks/use-mobile.ts +27 -0
- package/dist/dashboard-source/apps/frontend/hooks/use-notification-preference.ts +246 -0
- package/dist/dashboard-source/apps/frontend/hooks/use-processes-query.ts +56 -0
- package/dist/dashboard-source/apps/frontend/hooks/use-weekly-execution-stats.ts +101 -0
- package/dist/dashboard-source/apps/frontend/index.d.ts +12 -0
- package/dist/dashboard-source/apps/frontend/instrumentation.node.ts +25 -0
- package/dist/dashboard-source/apps/frontend/instrumentation.ts +19 -0
- package/dist/dashboard-source/apps/frontend/lib/app-icons-metadata.ts +66 -0
- package/dist/dashboard-source/apps/frontend/lib/appsync-events/adapter.ts +128 -0
- package/dist/dashboard-source/apps/frontend/lib/appsync-events/client.ts +355 -0
- package/dist/dashboard-source/apps/frontend/lib/appsync-events/config.ts +18 -0
- package/dist/dashboard-source/apps/frontend/lib/appsync-events/reconnect-registry.ts +34 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/act-on-behalf-menu.ts +9 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/callback-error.ts +26 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/client-session.ts +32 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/client.ts +46 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/config.ts +48 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/delegations.ts +62 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/issuer.ts +164 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/jwt.ts +17 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/logout.ts +35 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/passkeys-menu.ts +9 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/passkeys.ts +117 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/providers.ts +52 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/realtime-session-token.ts +62 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/reauthentication-state.ts +16 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/redirect.ts +105 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/secret-login-presentation.ts +33 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/session-cache-scope.ts +1 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/session-role.ts +6 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/session.ts +277 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/ssr-session.ts +76 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/verify-passkey.ts +95 -0
- package/dist/dashboard-source/apps/frontend/lib/authorization-tabs.ts +19 -0
- package/dist/dashboard-source/apps/frontend/lib/cedar-highlight.ts +116 -0
- package/dist/dashboard-source/apps/frontend/lib/client-plugin-error-reporting.ts +28 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/collection-provider-factory.tsx +1119 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/collection-provider-scope.ts +48 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/database-error-ui.tsx +61 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/draft-process-execution-collection-provider.tsx +32 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/draft-process-execution.ts +161 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/execution-collection-provider.tsx +42 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/execution.ts +215 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/graphql-stream.ts +123 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/process-collection-provider.tsx +30 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/process.ts +123 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/replication-factory.ts +394 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/replication-registry.ts +196 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/rxdb-database-name.ts +19 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/rxdb-lifecycle.ts +368 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/rxdb-provider.tsx +577 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/todo-collection-provider.tsx +30 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/todo.ts +133 -0
- package/dist/dashboard-source/apps/frontend/lib/current-provider-user.ts +30 -0
- package/dist/dashboard-source/apps/frontend/lib/dev/frontend-port-file.ts +41 -0
- package/dist/dashboard-source/apps/frontend/lib/dev/import-completed-events.ts +21 -0
- package/dist/dashboard-source/apps/frontend/lib/dev/import-completed-query-invalidation.tsx +62 -0
- package/dist/dashboard-source/apps/frontend/lib/dev/import-completed-refresh.ts +40 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/error-boundary.tsx +84 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/index.ts +31 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/params.ts +57 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/run-effect.ts +17 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/runtime.ts +168 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/services/access-token.ts +48 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/services/authorization.ts +206 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/services/form-validation.ts +36 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/services/graphql.ts +94 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/services/index.ts +21 -0
- package/dist/dashboard-source/apps/frontend/lib/embed-manifest-store.ts +20 -0
- package/dist/dashboard-source/apps/frontend/lib/embed-manifest.ts +152 -0
- package/dist/dashboard-source/apps/frontend/lib/embed-request-origin.ts +39 -0
- package/dist/dashboard-source/apps/frontend/lib/errors/get-display-error-message.ts +22 -0
- package/dist/dashboard-source/apps/frontend/lib/execution-menu-actions-registry.ts +26 -0
- package/dist/dashboard-source/apps/frontend/lib/feature-permissions.ts +13 -0
- package/dist/dashboard-source/apps/frontend/lib/frontend-boot-health.tsx +161 -0
- package/dist/dashboard-source/apps/frontend/lib/frontend-client-plugin-registry.ts +45 -0
- package/dist/dashboard-source/apps/frontend/lib/frontend-manifest-store.ts +214 -0
- package/dist/dashboard-source/apps/frontend/lib/frontend-manifest.ts +74 -0
- package/dist/dashboard-source/apps/frontend/lib/frontend-plugin-loaders.ts +191 -0
- package/dist/dashboard-source/apps/frontend/lib/generated/gql/fragment-masking.ts +87 -0
- package/dist/dashboard-source/apps/frontend/lib/generated/gql/gql.ts +292 -0
- package/dist/dashboard-source/apps/frontend/lib/generated/gql/graphql.ts +443 -0
- package/dist/dashboard-source/apps/frontend/lib/generated/gql/index.ts +2 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/client-consumer.tsx +23 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/client-error-reporting.ts +268 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/client-provider.tsx +59 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/dashboard-activity.ts +7 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/dependent-lookup-query.ts +78 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/endpoint.ts +26 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/execution-queries.ts +70 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/file-upload-provider.tsx +82 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/graphql-identifiers.ts +10 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/list-queries.ts +327 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/lookup-provider.tsx +81 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/org-chart-operations.ts +63 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/org-chart-queries.ts +67 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/provider-user-queries.ts +65 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/queries.ts +80 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/server-client.ts +15 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/settings-queries.ts +634 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/stats-views-server.ts +16 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/stats-views.ts +33 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/user-queries.ts +138 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/workflow-operations.ts +54 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/workflow-queries.ts +50 -0
- package/dist/dashboard-source/apps/frontend/lib/mobile-home-view-model.ts +74 -0
- package/dist/dashboard-source/apps/frontend/lib/mobile-shell-policy.ts +124 -0
- package/dist/dashboard-source/apps/frontend/lib/mock-data.ts +364 -0
- package/dist/dashboard-source/apps/frontend/lib/notifications/notification-preference.ts +251 -0
- package/dist/dashboard-source/apps/frontend/lib/notifications/todo-notification-observer.ts +178 -0
- package/dist/dashboard-source/apps/frontend/lib/notifications/todo-notifications-runtime.tsx +14 -0
- package/dist/dashboard-source/apps/frontend/lib/notifications/use-todo-notifications.tsx +103 -0
- package/dist/dashboard-source/apps/frontend/lib/org-chart-data.ts +50 -0
- package/dist/dashboard-source/apps/frontend/lib/org-chart-depth-config.ts +71 -0
- package/dist/dashboard-source/apps/frontend/lib/org-chart-layout.ts +149 -0
- package/dist/dashboard-source/apps/frontend/lib/org-chart-types.ts +17 -0
- package/dist/dashboard-source/apps/frontend/lib/org-identity.ts +57 -0
- package/dist/dashboard-source/apps/frontend/lib/organisation-plugin-loaders.ts +13 -0
- package/dist/dashboard-source/apps/frontend/lib/organisation-plugin-preparation.ts +2 -0
- package/dist/dashboard-source/apps/frontend/lib/plugins-client.tsx +99 -0
- package/dist/dashboard-source/apps/frontend/lib/plugins.ts +1 -0
- package/dist/dashboard-source/apps/frontend/lib/public-todo-form-runtime.ts +9 -0
- package/dist/dashboard-source/apps/frontend/lib/public-todo-graphql-errors.ts +45 -0
- package/dist/dashboard-source/apps/frontend/lib/public-todo-model.ts +200 -0
- package/dist/dashboard-source/apps/frontend/lib/public-todo-server.ts +209 -0
- package/dist/dashboard-source/apps/frontend/lib/query-client.ts +41 -0
- package/dist/dashboard-source/apps/frontend/lib/restart-execution-action.ts +76 -0
- package/dist/dashboard-source/apps/frontend/lib/runtime-config.ts +23 -0
- package/dist/dashboard-source/apps/frontend/lib/telemetry/constants.ts +5 -0
- package/dist/dashboard-source/apps/frontend/lib/telemetry/otlp-config.ts +16 -0
- package/dist/dashboard-source/apps/frontend/lib/telemetry/register-otel.ts +308 -0
- package/dist/dashboard-source/apps/frontend/lib/theme.ts +9 -0
- package/dist/dashboard-source/apps/frontend/lib/todo-types.ts +64 -0
- package/dist/dashboard-source/apps/frontend/lib/todo-utils.ts +144 -0
- package/dist/dashboard-source/apps/frontend/lib/types/org-identity.ts +7 -0
- package/dist/dashboard-source/apps/frontend/lib/utils.ts +16 -0
- package/dist/dashboard-source/apps/frontend/lib/workflow/constants.ts +118 -0
- package/dist/dashboard-source/apps/frontend/lib/workflow/edge-routing.ts +195 -0
- package/dist/dashboard-source/apps/frontend/lib/workflow/form-preview.ts +8 -0
- package/dist/dashboard-source/apps/frontend/lib/workflow/layout.ts +878 -0
- package/dist/dashboard-source/apps/frontend/lib/workflow/types.ts +63 -0
- package/dist/dashboard-source/apps/frontend/next.config.ts +238 -0
- package/dist/dashboard-source/apps/frontend/package.json +71 -0
- package/dist/dashboard-source/apps/frontend/postcss.config.mjs +5 -0
- package/dist/dashboard-source/apps/frontend/proxy.ts +293 -0
- package/dist/dashboard-source/apps/frontend/public/.gitkeep +0 -0
- package/dist/dashboard-source/apps/frontend/public/favicon.ico +0 -0
- package/dist/dashboard-source/apps/frontend/public/processfocus-embed.js +553 -0
- package/dist/dashboard-source/apps/frontend/tsconfig.json +35 -0
- package/dist/dashboard-source/modules/auth-local-cedar/src/index.ts +7 -0
- package/dist/dashboard-source/modules/auth-local-cedar/src/lib/auth-local-cedar.ts +1397 -0
- package/dist/dashboard-source/modules/auth-local-cedar/src/lib/cedar-reload-notifier.ts +18 -0
- package/dist/dashboard-source/modules/auth-local-cedar/src/lib/config-base.ts +346 -0
- package/dist/dashboard-source/modules/auth-local-cedar/src/lib/policy-watcher.ts +172 -0
- package/dist/dashboard-source/modules/auth-policy/src/index.ts +4 -0
- package/dist/dashboard-source/modules/auth-policy/src/lib/auth-policy.ts +263 -0
- package/dist/dashboard-source/modules/auth-policy/src/lib/current-principal.ts +34 -0
- package/dist/dashboard-source/modules/auth-policy/src/lib/errors.ts +47 -0
- package/dist/dashboard-source/modules/auth-policy/src/lib/types.ts +595 -0
- package/dist/dashboard-source/modules/auth-session/src/index.ts +22 -0
- package/dist/dashboard-source/modules/auth-session/src/lib/issuer-url.ts +192 -0
- package/dist/dashboard-source/modules/auth-session/src/lib/realtime-recipient.ts +76 -0
- package/dist/dashboard-source/modules/auth-session/src/lib/session-cache-scope.ts +24 -0
- package/dist/dashboard-source/modules/auth-session/src/lib/subjects.ts +54 -0
- package/dist/dashboard-source/modules/auth-session/src/lib/url.ts +2 -0
- package/dist/dashboard-source/modules/aws-common/src/index.ts +3 -0
- package/dist/dashboard-source/modules/aws-common/src/lib/acm.ts +50 -0
- package/dist/dashboard-source/modules/aws-common/src/lib/otlp-config.ts +66 -0
- package/dist/dashboard-source/modules/aws-common/src/lib/runtime-ssm.ts +28 -0
- package/dist/dashboard-source/modules/effect-json-logger/src/index.ts +1 -0
- package/dist/dashboard-source/modules/effect-json-logger/src/lib/effect-json-logger.ts +65 -0
- package/dist/dashboard-source/modules/form/src/hooks/use-local-storage.ts +78 -0
- package/dist/dashboard-source/modules/form/src/index.ts +20 -0
- package/dist/dashboard-source/modules/form/src/lib/ajv-standard-schema.ts +152 -0
- package/dist/dashboard-source/modules/form/src/lib/client-components-to-form.tsx +1421 -0
- package/dist/dashboard-source/modules/form/src/lib/friendly-validation-message.ts +85 -0
- package/dist/dashboard-source/modules/form/src/lib/lookup-context.tsx +58 -0
- package/dist/dashboard-source/modules/form/src/lib/plugin-registry.ts +34 -0
- package/dist/dashboard-source/modules/form/src/lib/walker.tsx +1554 -0
- package/dist/dashboard-source/modules/form-client-representation/src/lib/client-form-definition.ts +440 -0
- package/dist/dashboard-source/modules/form-client-representation/src/lib/plugin-registry.ts +13 -0
- package/dist/dashboard-source/modules/form-client-representation/src/lib/types.ts +336 -0
- package/dist/dashboard-source/modules/form-rule/src/index.ts +21 -0
- package/dist/dashboard-source/modules/form-rule/src/lib/evaluator.ts +531 -0
- package/dist/dashboard-source/modules/form-rule/src/lib/paths.ts +102 -0
- package/dist/dashboard-source/modules/form-rule/src/lib/types.ts +121 -0
- package/dist/dashboard-source/modules/form-schema/src/index.ts +8 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/annotation-helpers.ts +44 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/deferred-value.ts +21 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/email.ts +50 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/field-count.ts +82 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/form-annotations.ts +58 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/form-schema.ts +975 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/phone.ts +60 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/property-signature.ts +45 -0
- package/dist/dashboard-source/modules/frontend-endpoints/src/endpoint.ts +137 -0
- package/dist/dashboard-source/modules/frontend-endpoints/src/index.ts +11 -0
- package/dist/dashboard-source/modules/frontend-endpoints/src/port-files.ts +219 -0
- package/dist/dashboard-source/modules/frontend-manifest/src/index.ts +2 -0
- package/dist/dashboard-source/modules/frontend-manifest/src/lib/browser-plugin-artifact.ts +201 -0
- package/dist/dashboard-source/modules/frontend-manifest/src/lib/frontend-manifest.ts +408 -0
- package/dist/dashboard-source/modules/frontend-plugin-host/src/index.ts +29 -0
- package/dist/dashboard-source/modules/frontend-plugin-host/src/lib/frontend-plugin-host.ts +288 -0
- package/dist/dashboard-source/modules/openauth/src/client.ts +1045 -0
- package/dist/dashboard-source/modules/openauth/src/error.ts +140 -0
- package/dist/dashboard-source/modules/openauth/src/pkce.ts +40 -0
- package/dist/dashboard-source/modules/openauth/src/random.ts +24 -0
- package/dist/dashboard-source/modules/openauth/src/subject.ts +132 -0
- package/dist/dashboard-source/modules/openauth/src/util.ts +13 -0
- package/dist/dashboard-source/modules/request-time/src/index.ts +1 -0
- package/dist/dashboard-source/modules/request-time/src/lib/request-time.ts +30 -0
- package/dist/dashboard-source/modules/rxdb-collections/generated/draft-process-execution-schema.json +45 -0
- package/dist/dashboard-source/modules/rxdb-collections/generated/execution-schema.json +217 -0
- package/dist/dashboard-source/modules/rxdb-collections/generated/process-schema.json +77 -0
- package/dist/dashboard-source/modules/rxdb-collections/generated/todo-schema.json +94 -0
- package/dist/dashboard-source/modules/rxdb-collections/src/index.ts +2 -0
- package/dist/dashboard-source/modules/rxdb-collections/src/lib/rxdb-collections.ts +181 -0
- package/dist/dashboard-source/modules/rxdb-collections/src/lib/to-rxdb-schema.ts +166 -0
- package/dist/dashboard-source/modules/shadcn-components/src/index.ts +60 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/boolean-field.tsx +73 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/calendar-slot-field.tsx +808 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/date-field.tsx +127 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/field-set.tsx +14 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/file-field.tsx +321 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/file-upload-context.tsx +45 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/form-context.tsx +19 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/lookup-field.tsx +394 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/radio-field.tsx +96 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/select-field.tsx +106 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/text-field.tsx +245 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/button.tsx +63 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/checkbox.tsx +31 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/command.tsx +101 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/field.tsx +275 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/input.tsx +29 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/label.tsx +23 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/popover.tsx +31 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/separator.tsx +27 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/textarea.tsx +19 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/utils/utils.ts +4 -0
- package/dist/dashboard-source.json +70 -0
- package/dist/graphql-server.mjs +1319 -0
- package/dist/job-worker.mjs +989 -0
- package/dist/main.mjs +495 -0
- package/dist/prepare-dashboard.mjs +35 -0
- package/dist/resources/cedar/policies.cedar +315 -0
- package/dist/resources/cedar/schema.cedarschema +276 -0
- package/dist/resources/graphql-schema/rxdb.graphql +401 -0
- package/dist/resources/graphql-schema/system.graphql +1200 -0
- package/package.json +98 -0
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import type { StandardSchemaV1Issue } from "@tanstack/react-form"
|
|
4
|
+
import { Check, ChevronsUpDown } from "lucide-react"
|
|
5
|
+
import { useCallback, useRef, useState } from "react"
|
|
6
|
+
import { useFieldContext, useFormContext } from "./form-context.tsx"
|
|
7
|
+
import { Button } from "./ui/button.tsx"
|
|
8
|
+
import {
|
|
9
|
+
Command,
|
|
10
|
+
CommandEmpty,
|
|
11
|
+
CommandGroup,
|
|
12
|
+
CommandInput,
|
|
13
|
+
CommandItem,
|
|
14
|
+
CommandList,
|
|
15
|
+
} from "./ui/command.tsx"
|
|
16
|
+
import { Field, FieldDescription, FieldError, FieldLabel } from "./ui/field.tsx"
|
|
17
|
+
import { Input } from "./ui/input.tsx"
|
|
18
|
+
import { Popover, PopoverContent, PopoverTrigger } from "./ui/popover.tsx"
|
|
19
|
+
import { cn } from "./utils/utils.ts"
|
|
20
|
+
|
|
21
|
+
export interface LookupFieldItem {
|
|
22
|
+
readonly value: string
|
|
23
|
+
readonly label: string
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function LookupField({
|
|
27
|
+
label,
|
|
28
|
+
descriptionHtml,
|
|
29
|
+
items,
|
|
30
|
+
onSearch,
|
|
31
|
+
loading,
|
|
32
|
+
error,
|
|
33
|
+
readOnly,
|
|
34
|
+
autoFocus,
|
|
35
|
+
allowFreeText,
|
|
36
|
+
}: {
|
|
37
|
+
label: string
|
|
38
|
+
descriptionHtml?: string | undefined | null
|
|
39
|
+
items: LookupFieldItem[]
|
|
40
|
+
onSearch: (filter: string) => void
|
|
41
|
+
loading: boolean
|
|
42
|
+
error?: string | undefined
|
|
43
|
+
readOnly?: boolean | undefined
|
|
44
|
+
autoFocus?: boolean | undefined
|
|
45
|
+
allowFreeText?: boolean | undefined
|
|
46
|
+
}) {
|
|
47
|
+
if (allowFreeText) {
|
|
48
|
+
return (
|
|
49
|
+
<SuggestionLookupField
|
|
50
|
+
label={label}
|
|
51
|
+
descriptionHtml={descriptionHtml}
|
|
52
|
+
items={items}
|
|
53
|
+
onSearch={onSearch}
|
|
54
|
+
loading={loading}
|
|
55
|
+
error={error}
|
|
56
|
+
readOnly={readOnly}
|
|
57
|
+
autoFocus={autoFocus}
|
|
58
|
+
/>
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<SelectLookupField
|
|
64
|
+
label={label}
|
|
65
|
+
descriptionHtml={descriptionHtml}
|
|
66
|
+
items={items}
|
|
67
|
+
onSearch={onSearch}
|
|
68
|
+
loading={loading}
|
|
69
|
+
error={error}
|
|
70
|
+
readOnly={readOnly}
|
|
71
|
+
autoFocus={autoFocus}
|
|
72
|
+
/>
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function useLookupFieldState() {
|
|
77
|
+
const field = useFieldContext<string>()
|
|
78
|
+
const form = useFormContext()
|
|
79
|
+
const validationErrors = field.state.meta
|
|
80
|
+
.errors as unknown as StandardSchemaV1Issue[]
|
|
81
|
+
const serverError = field.state.meta.errorMap?.onSubmit
|
|
82
|
+
const allErrors: Array<{ message?: string }> = [
|
|
83
|
+
...validationErrors,
|
|
84
|
+
...(serverError ? [{ message: serverError as string }] : []),
|
|
85
|
+
]
|
|
86
|
+
const { isTouched, isDefaultValue } = field.state.meta
|
|
87
|
+
const afterSubmission = form.state.submissionAttempts > 0
|
|
88
|
+
const isInvalid =
|
|
89
|
+
(afterSubmission && allErrors.length > 0) ||
|
|
90
|
+
(isTouched && !isDefaultValue && allErrors.length > 0)
|
|
91
|
+
|
|
92
|
+
return {
|
|
93
|
+
field,
|
|
94
|
+
isInvalid,
|
|
95
|
+
allErrors,
|
|
96
|
+
errorId: `${field.name}-error`,
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function SelectLookupField({
|
|
101
|
+
label,
|
|
102
|
+
descriptionHtml,
|
|
103
|
+
items,
|
|
104
|
+
onSearch,
|
|
105
|
+
loading,
|
|
106
|
+
error,
|
|
107
|
+
readOnly,
|
|
108
|
+
autoFocus,
|
|
109
|
+
}: {
|
|
110
|
+
label: string
|
|
111
|
+
descriptionHtml?: string | undefined | null
|
|
112
|
+
items: LookupFieldItem[]
|
|
113
|
+
onSearch: (filter: string) => void
|
|
114
|
+
loading: boolean
|
|
115
|
+
error?: string | undefined
|
|
116
|
+
readOnly?: boolean | undefined
|
|
117
|
+
autoFocus?: boolean | undefined
|
|
118
|
+
}) {
|
|
119
|
+
const { field, isInvalid, allErrors, errorId } = useLookupFieldState()
|
|
120
|
+
const [open, setOpen] = useState(false)
|
|
121
|
+
|
|
122
|
+
const selectedItem = items.find((item) => item.value === field.state.value)
|
|
123
|
+
const displayLabel =
|
|
124
|
+
selectedItem?.label || (field.state.value ? field.state.value : undefined)
|
|
125
|
+
|
|
126
|
+
return (
|
|
127
|
+
<Field>
|
|
128
|
+
<FieldLabel htmlFor={field.name}>{label}</FieldLabel>
|
|
129
|
+
<Popover modal open={open} onOpenChange={setOpen}>
|
|
130
|
+
<PopoverTrigger asChild>
|
|
131
|
+
<Button
|
|
132
|
+
type="button"
|
|
133
|
+
variant="outline"
|
|
134
|
+
role="combobox"
|
|
135
|
+
aria-expanded={open}
|
|
136
|
+
aria-invalid={isInvalid}
|
|
137
|
+
aria-describedby={isInvalid ? errorId : undefined}
|
|
138
|
+
className={cn(
|
|
139
|
+
"w-full justify-between font-normal",
|
|
140
|
+
!displayLabel && "text-muted-foreground",
|
|
141
|
+
)}
|
|
142
|
+
disabled={readOnly}
|
|
143
|
+
autoFocus={autoFocus}
|
|
144
|
+
>
|
|
145
|
+
{displayLabel ?? `Select ${label.toLowerCase()}...`}
|
|
146
|
+
<ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
|
|
147
|
+
</Button>
|
|
148
|
+
</PopoverTrigger>
|
|
149
|
+
<PopoverContent>
|
|
150
|
+
<Command shouldFilter={false}>
|
|
151
|
+
<CommandInput
|
|
152
|
+
placeholder={`Search ${label.toLowerCase()}...`}
|
|
153
|
+
onValueChange={(value) => {
|
|
154
|
+
onSearch(value)
|
|
155
|
+
}}
|
|
156
|
+
/>
|
|
157
|
+
<CommandList className="max-h-[240px]">
|
|
158
|
+
<CommandEmpty>
|
|
159
|
+
{error
|
|
160
|
+
? "Failed to load suggestions. Please try again."
|
|
161
|
+
: loading
|
|
162
|
+
? "Searching..."
|
|
163
|
+
: "No results found."}
|
|
164
|
+
</CommandEmpty>
|
|
165
|
+
<CommandGroup>
|
|
166
|
+
{items.map((item) => (
|
|
167
|
+
<CommandItem
|
|
168
|
+
key={item.value}
|
|
169
|
+
value={item.value}
|
|
170
|
+
onSelect={() => {
|
|
171
|
+
field.handleChange(
|
|
172
|
+
item.value === field.state.value ? "" : item.value,
|
|
173
|
+
)
|
|
174
|
+
setOpen(false)
|
|
175
|
+
}}
|
|
176
|
+
>
|
|
177
|
+
<Check
|
|
178
|
+
className={cn(
|
|
179
|
+
"mr-2 h-4 w-4",
|
|
180
|
+
field.state.value === item.value
|
|
181
|
+
? "opacity-100"
|
|
182
|
+
: "opacity-0",
|
|
183
|
+
)}
|
|
184
|
+
/>
|
|
185
|
+
{item.label}
|
|
186
|
+
</CommandItem>
|
|
187
|
+
))}
|
|
188
|
+
</CommandGroup>
|
|
189
|
+
</CommandList>
|
|
190
|
+
</Command>
|
|
191
|
+
</PopoverContent>
|
|
192
|
+
</Popover>
|
|
193
|
+
{isInvalid && allErrors.length > 0 && (
|
|
194
|
+
<FieldError errors={allErrors} id={errorId} />
|
|
195
|
+
)}
|
|
196
|
+
{descriptionHtml && <FieldDescription trustedHtml={descriptionHtml} />}
|
|
197
|
+
</Field>
|
|
198
|
+
)
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function SuggestionLookupField({
|
|
202
|
+
label,
|
|
203
|
+
descriptionHtml,
|
|
204
|
+
items,
|
|
205
|
+
onSearch,
|
|
206
|
+
loading,
|
|
207
|
+
error,
|
|
208
|
+
readOnly,
|
|
209
|
+
autoFocus,
|
|
210
|
+
}: {
|
|
211
|
+
label: string
|
|
212
|
+
descriptionHtml?: string | undefined | null
|
|
213
|
+
items: LookupFieldItem[]
|
|
214
|
+
onSearch: (filter: string) => void
|
|
215
|
+
loading: boolean
|
|
216
|
+
error?: string | undefined
|
|
217
|
+
readOnly?: boolean | undefined
|
|
218
|
+
autoFocus?: boolean | undefined
|
|
219
|
+
}) {
|
|
220
|
+
const { field, isInvalid, allErrors, errorId } = useLookupFieldState()
|
|
221
|
+
const [open, setOpen] = useState(false)
|
|
222
|
+
const [activeIndex, setActiveIndex] = useState(0)
|
|
223
|
+
const activeOptionRef = useRef<HTMLButtonElement | null>(null)
|
|
224
|
+
const listboxId = `${field.name}-suggestions`
|
|
225
|
+
const clampedActiveIndex = Math.min(
|
|
226
|
+
activeIndex,
|
|
227
|
+
Math.max(0, items.length - 1),
|
|
228
|
+
)
|
|
229
|
+
// Free-text fields should not show an empty popup on focus before the user
|
|
230
|
+
// types; once there is text, the empty state confirms there are no matches.
|
|
231
|
+
const showSuggestions =
|
|
232
|
+
open &&
|
|
233
|
+
!readOnly &&
|
|
234
|
+
(items.length > 0 ||
|
|
235
|
+
loading ||
|
|
236
|
+
error !== undefined ||
|
|
237
|
+
Boolean(field.state.value))
|
|
238
|
+
const activeDescendantId =
|
|
239
|
+
showSuggestions && items[clampedActiveIndex]
|
|
240
|
+
? `${listboxId}-${clampedActiveIndex}`
|
|
241
|
+
: undefined
|
|
242
|
+
|
|
243
|
+
const setActiveOptionRef = useCallback(
|
|
244
|
+
(element: HTMLButtonElement | null) => {
|
|
245
|
+
activeOptionRef.current = element
|
|
246
|
+
element?.scrollIntoView({ block: "nearest" })
|
|
247
|
+
},
|
|
248
|
+
[],
|
|
249
|
+
)
|
|
250
|
+
|
|
251
|
+
const closeSuggestions = () => {
|
|
252
|
+
setOpen(false)
|
|
253
|
+
setActiveIndex(0)
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
const selectItem = (item: LookupFieldItem) => {
|
|
257
|
+
field.handleChange(item.value)
|
|
258
|
+
closeSuggestions()
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
return (
|
|
262
|
+
<Field>
|
|
263
|
+
<FieldLabel htmlFor={field.name}>{label}</FieldLabel>
|
|
264
|
+
<div
|
|
265
|
+
className="relative"
|
|
266
|
+
onBlurCapture={(event) => {
|
|
267
|
+
if (event.currentTarget.contains(event.relatedTarget)) return
|
|
268
|
+
closeSuggestions()
|
|
269
|
+
}}
|
|
270
|
+
>
|
|
271
|
+
<Input
|
|
272
|
+
id={field.name}
|
|
273
|
+
name={field.name}
|
|
274
|
+
value={field.state.value ?? ""}
|
|
275
|
+
onChange={(event) => {
|
|
276
|
+
const value = event.target.value
|
|
277
|
+
field.handleChange(value)
|
|
278
|
+
onSearch(value)
|
|
279
|
+
setActiveIndex(0)
|
|
280
|
+
setOpen(true)
|
|
281
|
+
}}
|
|
282
|
+
onFocus={() => {
|
|
283
|
+
if (readOnly) return
|
|
284
|
+
setActiveIndex(0)
|
|
285
|
+
onSearch(field.state.value ?? "")
|
|
286
|
+
setOpen(true)
|
|
287
|
+
}}
|
|
288
|
+
onBlur={() => field.handleBlur()}
|
|
289
|
+
onKeyDown={(event) => {
|
|
290
|
+
if (readOnly) return
|
|
291
|
+
|
|
292
|
+
if (
|
|
293
|
+
!open &&
|
|
294
|
+
(event.key === "ArrowDown" || event.key === "ArrowUp")
|
|
295
|
+
) {
|
|
296
|
+
setActiveIndex(0)
|
|
297
|
+
onSearch(field.state.value ?? "")
|
|
298
|
+
setOpen(true)
|
|
299
|
+
return
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
if (event.key === "ArrowDown") {
|
|
303
|
+
event.preventDefault()
|
|
304
|
+
setActiveIndex((index) =>
|
|
305
|
+
items.length === 0 ? 0 : Math.min(index + 1, items.length - 1),
|
|
306
|
+
)
|
|
307
|
+
return
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
if (event.key === "ArrowUp") {
|
|
311
|
+
event.preventDefault()
|
|
312
|
+
setActiveIndex((index) => Math.max(index - 1, 0))
|
|
313
|
+
return
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
if (event.key === "Enter" && open && items[clampedActiveIndex]) {
|
|
317
|
+
event.preventDefault()
|
|
318
|
+
selectItem(items[clampedActiveIndex])
|
|
319
|
+
return
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
if (event.key === "Escape") {
|
|
323
|
+
closeSuggestions()
|
|
324
|
+
return
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
if (event.key === "Tab") {
|
|
328
|
+
closeSuggestions()
|
|
329
|
+
}
|
|
330
|
+
}}
|
|
331
|
+
placeholder={`Enter ${label.toLowerCase()}...`}
|
|
332
|
+
autoFocus={autoFocus}
|
|
333
|
+
readOnly={readOnly}
|
|
334
|
+
role="combobox"
|
|
335
|
+
aria-autocomplete="list"
|
|
336
|
+
aria-activedescendant={activeDescendantId}
|
|
337
|
+
aria-expanded={open}
|
|
338
|
+
aria-haspopup="listbox"
|
|
339
|
+
aria-controls={showSuggestions ? listboxId : undefined}
|
|
340
|
+
aria-invalid={isInvalid}
|
|
341
|
+
aria-describedby={isInvalid ? errorId : undefined}
|
|
342
|
+
/>
|
|
343
|
+
{showSuggestions && (
|
|
344
|
+
<div
|
|
345
|
+
id={listboxId}
|
|
346
|
+
role="listbox"
|
|
347
|
+
aria-label={label}
|
|
348
|
+
className="bg-popover text-popover-foreground absolute z-50 mt-1 max-h-[240px] w-full overflow-y-auto rounded-md border p-1 shadow-md"
|
|
349
|
+
>
|
|
350
|
+
{error ? (
|
|
351
|
+
<div className="text-muted-foreground px-2 py-3 text-sm">
|
|
352
|
+
Failed to load suggestions. Please try again.
|
|
353
|
+
</div>
|
|
354
|
+
) : loading ? (
|
|
355
|
+
<div className="text-muted-foreground px-2 py-3 text-sm">
|
|
356
|
+
Searching...
|
|
357
|
+
</div>
|
|
358
|
+
) : items.length === 0 ? (
|
|
359
|
+
<div className="text-muted-foreground px-2 py-3 text-sm">
|
|
360
|
+
No suggestions found.
|
|
361
|
+
</div>
|
|
362
|
+
) : (
|
|
363
|
+
items.map((item, index) => (
|
|
364
|
+
<button
|
|
365
|
+
key={item.value}
|
|
366
|
+
id={`${listboxId}-${index}`}
|
|
367
|
+
ref={index === clampedActiveIndex ? setActiveOptionRef : null}
|
|
368
|
+
type="button"
|
|
369
|
+
role="option"
|
|
370
|
+
aria-selected={index === clampedActiveIndex}
|
|
371
|
+
tabIndex={-1}
|
|
372
|
+
className={cn(
|
|
373
|
+
"relative flex w-full cursor-default select-none items-center rounded-sm px-2 py-1.5 text-left text-sm outline-none",
|
|
374
|
+
index === clampedActiveIndex &&
|
|
375
|
+
"bg-accent text-accent-foreground",
|
|
376
|
+
)}
|
|
377
|
+
onMouseDown={(event) => event.preventDefault()}
|
|
378
|
+
onMouseEnter={() => setActiveIndex(index)}
|
|
379
|
+
onClick={() => selectItem(item)}
|
|
380
|
+
>
|
|
381
|
+
{item.label}
|
|
382
|
+
</button>
|
|
383
|
+
))
|
|
384
|
+
)}
|
|
385
|
+
</div>
|
|
386
|
+
)}
|
|
387
|
+
</div>
|
|
388
|
+
{isInvalid && allErrors.length > 0 && (
|
|
389
|
+
<FieldError errors={allErrors} id={errorId} />
|
|
390
|
+
)}
|
|
391
|
+
{descriptionHtml && <FieldDescription trustedHtml={descriptionHtml} />}
|
|
392
|
+
</Field>
|
|
393
|
+
)
|
|
394
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { StandardSchemaV1Issue } from "@tanstack/react-form"
|
|
2
|
+
import { useEffect, useRef } from "react"
|
|
3
|
+
import type { RadioFieldOption as FormSchemaRadioFieldOption } from "../../../form-schema/src/index.ts"
|
|
4
|
+
import { useFieldContext, useFormContext } from "./form-context.tsx"
|
|
5
|
+
import {
|
|
6
|
+
Field,
|
|
7
|
+
FieldDescription,
|
|
8
|
+
FieldError,
|
|
9
|
+
FieldLabel,
|
|
10
|
+
FieldLegend,
|
|
11
|
+
FieldSet,
|
|
12
|
+
} from "./ui/field.tsx"
|
|
13
|
+
|
|
14
|
+
export type { RadioFieldOption } from "../../../form-schema/src/index.ts"
|
|
15
|
+
|
|
16
|
+
export function RadioField({
|
|
17
|
+
label,
|
|
18
|
+
descriptionHtml,
|
|
19
|
+
options,
|
|
20
|
+
autoFocus,
|
|
21
|
+
readOnly,
|
|
22
|
+
}: {
|
|
23
|
+
readonly label: string
|
|
24
|
+
readonly descriptionHtml?: string | undefined | null
|
|
25
|
+
readonly options: readonly [
|
|
26
|
+
FormSchemaRadioFieldOption,
|
|
27
|
+
...FormSchemaRadioFieldOption[],
|
|
28
|
+
]
|
|
29
|
+
readonly autoFocus?: boolean
|
|
30
|
+
readonly readOnly?: boolean
|
|
31
|
+
}) {
|
|
32
|
+
const field = useFieldContext<string>()
|
|
33
|
+
const form = useFormContext()
|
|
34
|
+
const firstOptionRef = useRef<HTMLInputElement>(null)
|
|
35
|
+
const validationErrors = field.state.meta
|
|
36
|
+
.errors as unknown as StandardSchemaV1Issue[]
|
|
37
|
+
const serverError = field.state.meta.errorMap?.onSubmit
|
|
38
|
+
const allErrors: Array<{ message?: string }> = [
|
|
39
|
+
...validationErrors,
|
|
40
|
+
...(serverError ? [{ message: serverError as string }] : []),
|
|
41
|
+
]
|
|
42
|
+
const { isTouched, isDefaultValue } = field.state.meta
|
|
43
|
+
const afterSubmission = form.state.submissionAttempts > 0
|
|
44
|
+
const isInvalid =
|
|
45
|
+
(afterSubmission && allErrors.length > 0) ||
|
|
46
|
+
(isTouched && !isDefaultValue && allErrors.length > 0)
|
|
47
|
+
const errorId = `${field.name}-error`
|
|
48
|
+
const descriptionId = `${field.name}-description`
|
|
49
|
+
const describedBy = [
|
|
50
|
+
descriptionHtml ? descriptionId : undefined,
|
|
51
|
+
isInvalid ? errorId : undefined,
|
|
52
|
+
]
|
|
53
|
+
.filter((id): id is string => id !== undefined)
|
|
54
|
+
.join(" ")
|
|
55
|
+
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
if (autoFocus === true && readOnly !== true) {
|
|
58
|
+
firstOptionRef.current?.focus()
|
|
59
|
+
}
|
|
60
|
+
}, [autoFocus, readOnly])
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<FieldSet
|
|
64
|
+
aria-describedby={describedBy.length > 0 ? describedBy : undefined}
|
|
65
|
+
aria-invalid={isInvalid}
|
|
66
|
+
>
|
|
67
|
+
<FieldLegend>{label}</FieldLegend>
|
|
68
|
+
{descriptionHtml && (
|
|
69
|
+
<FieldDescription id={descriptionId} trustedHtml={descriptionHtml} />
|
|
70
|
+
)}
|
|
71
|
+
<div data-slot="radio-group" className="flex flex-col gap-3">
|
|
72
|
+
{options.map((option, index) => {
|
|
73
|
+
const id = `${field.name}-${option.value}`
|
|
74
|
+
return (
|
|
75
|
+
<Field key={option.value} orientation="horizontal">
|
|
76
|
+
<input
|
|
77
|
+
ref={index === 0 ? firstOptionRef : undefined}
|
|
78
|
+
id={id}
|
|
79
|
+
name={field.name}
|
|
80
|
+
type="radio"
|
|
81
|
+
value={option.value}
|
|
82
|
+
checked={field.state.value === option.value}
|
|
83
|
+
onChange={() => field.handleChange(option.value)}
|
|
84
|
+
onBlur={() => field.handleBlur()}
|
|
85
|
+
disabled={readOnly}
|
|
86
|
+
className="size-4 shrink-0 rounded-full border border-input accent-primary"
|
|
87
|
+
/>
|
|
88
|
+
<FieldLabel htmlFor={id}>{option.label}</FieldLabel>
|
|
89
|
+
</Field>
|
|
90
|
+
)
|
|
91
|
+
})}
|
|
92
|
+
</div>
|
|
93
|
+
{isInvalid && <FieldError errors={allErrors} id={errorId} />}
|
|
94
|
+
</FieldSet>
|
|
95
|
+
)
|
|
96
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { useStore } from "@tanstack/react-form"
|
|
2
|
+
import { useEffect, useRef } from "react"
|
|
3
|
+
import { useFieldContext, useFormContext } from "./form-context.tsx"
|
|
4
|
+
import { Field, FieldDescription, FieldError, FieldLabel } from "./ui/field.tsx"
|
|
5
|
+
|
|
6
|
+
/** Fixed string choices, projected from the authoritative submission schema. */
|
|
7
|
+
export function SelectField({
|
|
8
|
+
label,
|
|
9
|
+
descriptionHtml,
|
|
10
|
+
options,
|
|
11
|
+
emptyValue,
|
|
12
|
+
autoFocus,
|
|
13
|
+
readOnly,
|
|
14
|
+
}: {
|
|
15
|
+
readonly label: string
|
|
16
|
+
readonly descriptionHtml?: string | null | undefined
|
|
17
|
+
readonly options: readonly string[]
|
|
18
|
+
readonly emptyValue?: "null" | "undefined"
|
|
19
|
+
readonly autoFocus?: boolean
|
|
20
|
+
readonly readOnly?: boolean
|
|
21
|
+
}) {
|
|
22
|
+
const ref = useRef<HTMLSelectElement>(null)
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (autoFocus && !readOnly) ref.current?.focus()
|
|
25
|
+
}, [autoFocus, readOnly])
|
|
26
|
+
const field = useFieldContext<string | null | undefined>()
|
|
27
|
+
const selectedIndex =
|
|
28
|
+
field.state.value == null ? -1 : options.indexOf(field.state.value)
|
|
29
|
+
const form = useFormContext()
|
|
30
|
+
const afterSubmission = useStore(
|
|
31
|
+
form.store,
|
|
32
|
+
(state) => state.submissionAttempts > 0,
|
|
33
|
+
)
|
|
34
|
+
const errors: Array<{ message: string }> = field.state.meta.errors.flatMap(
|
|
35
|
+
(error: unknown) => {
|
|
36
|
+
if (typeof error === "string") return [{ message: error }]
|
|
37
|
+
if (
|
|
38
|
+
typeof error === "object" &&
|
|
39
|
+
error !== null &&
|
|
40
|
+
"message" in error &&
|
|
41
|
+
typeof error.message === "string"
|
|
42
|
+
)
|
|
43
|
+
return [{ message: error.message }]
|
|
44
|
+
return []
|
|
45
|
+
},
|
|
46
|
+
)
|
|
47
|
+
const serverError: unknown = field.state.meta.errorMap?.onSubmit
|
|
48
|
+
if (
|
|
49
|
+
typeof serverError === "string" &&
|
|
50
|
+
!errors.some((error) => error.message === serverError)
|
|
51
|
+
) {
|
|
52
|
+
errors.push({ message: serverError })
|
|
53
|
+
}
|
|
54
|
+
const invalid =
|
|
55
|
+
errors.length > 0 &&
|
|
56
|
+
(afterSubmission ||
|
|
57
|
+
(field.state.meta.isTouched && !field.state.meta.isDefaultValue))
|
|
58
|
+
const errorId = `${field.name}-error`
|
|
59
|
+
const descriptionId = `${field.name}-description`
|
|
60
|
+
const describedBy = [
|
|
61
|
+
descriptionHtml ? descriptionId : null,
|
|
62
|
+
invalid ? errorId : null,
|
|
63
|
+
]
|
|
64
|
+
.filter(Boolean)
|
|
65
|
+
.join(" ")
|
|
66
|
+
return (
|
|
67
|
+
<Field>
|
|
68
|
+
<FieldLabel htmlFor={field.name}>{label}</FieldLabel>
|
|
69
|
+
<select
|
|
70
|
+
id={field.name}
|
|
71
|
+
name={field.name}
|
|
72
|
+
// An unmatched value would make the browser display the first enabled
|
|
73
|
+
// option even though the form has not selected it.
|
|
74
|
+
value={selectedIndex < 0 ? "" : String(selectedIndex)}
|
|
75
|
+
ref={ref}
|
|
76
|
+
disabled={readOnly}
|
|
77
|
+
onChange={(event) =>
|
|
78
|
+
field.handleChange(
|
|
79
|
+
event.target.value === ""
|
|
80
|
+
? emptyValue === "null"
|
|
81
|
+
? null
|
|
82
|
+
: undefined
|
|
83
|
+
: options[Number(event.target.value)],
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
onBlur={() => field.handleBlur()}
|
|
87
|
+
aria-invalid={invalid}
|
|
88
|
+
aria-describedby={describedBy || undefined}
|
|
89
|
+
className="h-9 w-full rounded-md border border-input bg-background px-3 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] disabled:opacity-50"
|
|
90
|
+
>
|
|
91
|
+
<option value="" disabled={emptyValue === undefined}>
|
|
92
|
+
{emptyValue === undefined ? "Select an option" : "No selection"}
|
|
93
|
+
</option>
|
|
94
|
+
{options.map((option, index) => (
|
|
95
|
+
<option key={option} value={String(index)}>
|
|
96
|
+
{option || "No value"}
|
|
97
|
+
</option>
|
|
98
|
+
))}
|
|
99
|
+
</select>
|
|
100
|
+
{descriptionHtml ? (
|
|
101
|
+
<FieldDescription id={descriptionId} trustedHtml={descriptionHtml} />
|
|
102
|
+
) : null}
|
|
103
|
+
{invalid ? <FieldError errors={errors} id={errorId} /> : null}
|
|
104
|
+
</Field>
|
|
105
|
+
)
|
|
106
|
+
}
|