@vertesia/ui 1.5.0-dev.20260714.072725Z → 1.5.0-dev.20260722.120446Z
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/lib/core/components/SidePanel.js +1 -1
- package/lib/core/components/SidePanel.js.map +1 -1
- package/lib/core/components/shadcn/button.d.ts +10 -3
- package/lib/core/components/shadcn/button.d.ts.map +1 -1
- package/lib/core/components/shadcn/button.js +41 -9
- package/lib/core/components/shadcn/button.js.map +1 -1
- package/lib/core/components/shadcn/modal/dialog.js +1 -1
- package/lib/core/components/shadcn/modal/dialog.js.map +1 -1
- package/lib/core/components/shadcn/theme/ThemeSwitcher.js +1 -1
- package/lib/core/components/shadcn/theme/ThemeSwitcher.js.map +1 -1
- package/lib/env/index.d.ts +19 -0
- package/lib/env/index.d.ts.map +1 -1
- package/lib/env/index.js +6 -0
- package/lib/env/index.js.map +1 -1
- package/lib/features/agent/chat/AgentChatPlaybackControls.d.ts.map +1 -1
- package/lib/features/agent/chat/AgentChatPlaybackControls.js +2 -2
- package/lib/features/agent/chat/AgentChatPlaybackControls.js.map +1 -1
- package/lib/features/agent/chat/AgentRequestInputOverlay.d.ts.map +1 -1
- package/lib/features/agent/chat/AgentRequestInputOverlay.js +2 -2
- package/lib/features/agent/chat/AgentRequestInputOverlay.js.map +1 -1
- package/lib/features/agent/chat/ArtifactsTab.d.ts.map +1 -1
- package/lib/features/agent/chat/ArtifactsTab.js +68 -11
- package/lib/features/agent/chat/ArtifactsTab.js.map +1 -1
- package/lib/features/agent/chat/ImageLightbox.d.ts.map +1 -1
- package/lib/features/agent/chat/ImageLightbox.js +1 -1
- package/lib/features/agent/chat/ImageLightbox.js.map +1 -1
- package/lib/features/agent/chat/ModernAgentConversation.js +52 -49
- package/lib/features/agent/chat/ModernAgentConversation.js.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.d.ts.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js +5 -5
- package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/Header.d.ts.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/Header.js +4 -2
- package/lib/features/agent/chat/ModernAgentOutput/Header.js.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/MessageInput.d.ts.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/MessageInput.js +2 -2
- package/lib/features/agent/chat/ModernAgentOutput/MessageInput.js.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/MessageItem.d.ts.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/MessageItem.js +2 -1
- package/lib/features/agent/chat/ModernAgentOutput/MessageItem.js.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/requestInputMessages.d.ts +6 -0
- package/lib/features/agent/chat/ModernAgentOutput/requestInputMessages.d.ts.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/requestInputMessages.js +15 -1
- package/lib/features/agent/chat/ModernAgentOutput/requestInputMessages.js.map +1 -1
- package/lib/features/agent/chat/hooks/useArtifacts.d.ts +8 -1
- package/lib/features/agent/chat/hooks/useArtifacts.d.ts.map +1 -1
- package/lib/features/agent/chat/hooks/useArtifacts.js +28 -10
- package/lib/features/agent/chat/hooks/useArtifacts.js.map +1 -1
- package/lib/features/document-viewer/UniversalDocumentViewer.d.ts +73 -0
- package/lib/features/document-viewer/UniversalDocumentViewer.d.ts.map +1 -0
- package/lib/features/document-viewer/UniversalDocumentViewer.js +415 -0
- package/lib/features/document-viewer/UniversalDocumentViewer.js.map +1 -0
- package/lib/features/document-viewer/index.d.ts +2 -0
- package/lib/features/document-viewer/index.d.ts.map +1 -0
- package/lib/features/document-viewer/index.js +2 -0
- package/lib/features/document-viewer/index.js.map +1 -0
- package/lib/features/environment/SelectEnvironment.d.ts +28 -0
- package/lib/features/environment/SelectEnvironment.d.ts.map +1 -0
- package/lib/features/environment/SelectEnvironment.js +97 -0
- package/lib/features/environment/SelectEnvironment.js.map +1 -0
- package/lib/features/environment/index.d.ts +2 -0
- package/lib/features/environment/index.d.ts.map +1 -0
- package/lib/features/environment/index.js +2 -0
- package/lib/features/environment/index.js.map +1 -0
- package/lib/features/index.d.ts +3 -0
- package/lib/features/index.d.ts.map +1 -1
- package/lib/features/index.js +3 -0
- package/lib/features/index.js.map +1 -1
- package/lib/features/magic-pdf/AnnotatedImageSlider.js +12 -12
- package/lib/features/magic-pdf/AnnotatedImageSlider.js.map +1 -1
- package/lib/features/magic-pdf/DownloadPopover.d.ts.map +1 -1
- package/lib/features/magic-pdf/DownloadPopover.js +3 -17
- package/lib/features/magic-pdf/DownloadPopover.js.map +1 -1
- package/lib/features/magic-pdf/ExtractedContentView.js +2 -6
- package/lib/features/magic-pdf/ExtractedContentView.js.map +1 -1
- package/lib/features/magic-pdf/GroundedExtractionAssistantPanel.d.ts +25 -0
- package/lib/features/magic-pdf/GroundedExtractionAssistantPanel.d.ts.map +1 -0
- package/lib/features/magic-pdf/GroundedExtractionAssistantPanel.js +42 -0
- package/lib/features/magic-pdf/GroundedExtractionAssistantPanel.js.map +1 -0
- package/lib/features/magic-pdf/GroundedExtractionView.d.ts +27 -0
- package/lib/features/magic-pdf/GroundedExtractionView.d.ts.map +1 -0
- package/lib/features/magic-pdf/GroundedExtractionView.js +377 -0
- package/lib/features/magic-pdf/GroundedExtractionView.js.map +1 -0
- package/lib/features/magic-pdf/MagicPdfProvider.d.ts +0 -2
- package/lib/features/magic-pdf/MagicPdfProvider.d.ts.map +1 -1
- package/lib/features/magic-pdf/MagicPdfProvider.js +15 -42
- package/lib/features/magic-pdf/MagicPdfProvider.js.map +1 -1
- package/lib/features/magic-pdf/MagicPdfView.d.ts.map +1 -1
- package/lib/features/magic-pdf/MagicPdfView.js +2 -19
- package/lib/features/magic-pdf/MagicPdfView.js.map +1 -1
- package/lib/features/magic-pdf/index.d.ts +1 -0
- package/lib/features/magic-pdf/index.d.ts.map +1 -1
- package/lib/features/magic-pdf/index.js +1 -0
- package/lib/features/magic-pdf/index.js.map +1 -1
- package/lib/features/magic-pdf/types.d.ts +1 -1
- package/lib/features/magic-pdf/types.d.ts.map +1 -1
- package/lib/features/oauth/McpConnectionsButton.d.ts.map +1 -1
- package/lib/features/oauth/McpConnectionsButton.js +2 -2
- package/lib/features/oauth/McpConnectionsButton.js.map +1 -1
- package/lib/features/oauth/McpConnectionsDialog.d.ts.map +1 -1
- package/lib/features/oauth/McpConnectionsDialog.js +1 -1
- package/lib/features/oauth/McpConnectionsDialog.js.map +1 -1
- package/lib/features/oauth/RemoteMcpConnectionButton.d.ts.map +1 -1
- package/lib/features/oauth/RemoteMcpConnectionButton.js +1 -1
- package/lib/features/oauth/RemoteMcpConnectionButton.js.map +1 -1
- package/lib/features/pdf-viewer/PdfPageSlider.js +2 -2
- package/lib/features/pdf-viewer/PdfPageSlider.js.map +1 -1
- package/lib/features/pdf-viewer/SimplePdfViewer.d.ts.map +1 -1
- package/lib/features/pdf-viewer/SimplePdfViewer.js +3 -3
- package/lib/features/pdf-viewer/SimplePdfViewer.js.map +1 -1
- package/lib/features/permissions/UserPermissionsProvider.d.ts +2 -3
- package/lib/features/permissions/UserPermissionsProvider.d.ts.map +1 -1
- package/lib/features/permissions/UserPermissionsProvider.js +31 -38
- package/lib/features/permissions/UserPermissionsProvider.js.map +1 -1
- package/lib/features/store/objects/DocumentQuickFilter.d.ts.map +1 -1
- package/lib/features/store/objects/DocumentQuickFilter.js +5 -5
- package/lib/features/store/objects/DocumentQuickFilter.js.map +1 -1
- package/lib/features/store/objects/DocumentSearchResults.d.ts.map +1 -1
- package/lib/features/store/objects/DocumentSearchResults.js +2 -2
- package/lib/features/store/objects/DocumentSearchResults.js.map +1 -1
- package/lib/features/store/objects/components/ContentDispositionButton.d.ts.map +1 -1
- package/lib/features/store/objects/components/ContentDispositionButton.js +1 -1
- package/lib/features/store/objects/components/ContentDispositionButton.js.map +1 -1
- package/lib/features/store/objects/components/ContentOverview.d.ts.map +1 -1
- package/lib/features/store/objects/components/ContentOverview.js +148 -31
- package/lib/features/store/objects/components/ContentOverview.js.map +1 -1
- package/lib/features/store/objects/components/DocumentIcon.js +1 -1
- package/lib/features/store/objects/components/VectorSearchWidget.js +1 -1
- package/lib/features/store/objects/components/VectorSearchWidget.js.map +1 -1
- package/lib/features/store/objects/components/useContentPanelHooks.d.ts +1 -2
- package/lib/features/store/objects/components/useContentPanelHooks.d.ts.map +1 -1
- package/lib/features/store/objects/components/useContentPanelHooks.js +4 -8
- package/lib/features/store/objects/components/useContentPanelHooks.js.map +1 -1
- package/lib/features/store/objects/layout/renderers.d.ts.map +1 -1
- package/lib/features/store/objects/layout/renderers.js +2 -2
- package/lib/features/store/objects/layout/renderers.js.map +1 -1
- package/lib/features/store/objects/selection/SelectionActions.js +1 -1
- package/lib/features/store/objects/selection/SelectionActions.js.map +1 -1
- package/lib/features/store/types/ContentObjectTypesTable.d.ts.map +1 -1
- package/lib/features/store/types/ContentObjectTypesTable.js +4 -4
- package/lib/features/store/types/ContentObjectTypesTable.js.map +1 -1
- package/lib/features/store/types/IntakePolicyEditor.d.ts +15 -0
- package/lib/features/store/types/IntakePolicyEditor.d.ts.map +1 -0
- package/lib/features/store/types/IntakePolicyEditor.js +455 -0
- package/lib/features/store/types/IntakePolicyEditor.js.map +1 -0
- package/lib/features/store/types/IntakePolicyForm.d.ts +11 -0
- package/lib/features/store/types/IntakePolicyForm.d.ts.map +1 -0
- package/lib/features/store/types/IntakePolicyForm.js +91 -0
- package/lib/features/store/types/IntakePolicyForm.js.map +1 -0
- package/lib/features/store/types/SelectContentTypeModal.js +1 -1
- package/lib/features/store/types/SelectContentTypeModal.js.map +1 -1
- package/lib/features/store/types/index.d.ts +2 -0
- package/lib/features/store/types/index.d.ts.map +1 -1
- package/lib/features/store/types/index.js +2 -0
- package/lib/features/store/types/index.js.map +1 -1
- package/lib/features/store/types/intake-policy-editor.logic.d.ts +7 -0
- package/lib/features/store/types/intake-policy-editor.logic.d.ts.map +1 -0
- package/lib/features/store/types/intake-policy-editor.logic.js +60 -0
- package/lib/features/store/types/intake-policy-editor.logic.js.map +1 -0
- package/lib/features/store/types/typeCatalogCache.d.ts +5 -0
- package/lib/features/store/types/typeCatalogCache.d.ts.map +1 -0
- package/lib/features/store/types/typeCatalogCache.js +40 -0
- package/lib/features/store/types/typeCatalogCache.js.map +1 -0
- package/lib/features/user/UserInfo.js +7 -3
- package/lib/features/user/UserInfo.js.map +1 -1
- package/lib/features/views/ViewExperience.d.ts +20 -0
- package/lib/features/views/ViewExperience.d.ts.map +1 -0
- package/lib/features/views/ViewExperience.js +188 -0
- package/lib/features/views/ViewExperience.js.map +1 -0
- package/lib/features/views/ViewNavigation.d.ts +3 -0
- package/lib/features/views/ViewNavigation.d.ts.map +1 -0
- package/lib/features/views/ViewNavigation.js +36 -0
- package/lib/features/views/ViewNavigation.js.map +1 -0
- package/lib/features/views/ViewResults.d.ts +9 -0
- package/lib/features/views/ViewResults.d.ts.map +1 -0
- package/lib/features/views/ViewResults.js +229 -0
- package/lib/features/views/ViewResults.js.map +1 -0
- package/lib/features/views/ViewSearch.d.ts +3 -0
- package/lib/features/views/ViewSearch.d.ts.map +1 -0
- package/lib/features/views/ViewSearch.js +74 -0
- package/lib/features/views/ViewSearch.js.map +1 -0
- package/lib/features/views/index.d.ts +7 -0
- package/lib/features/views/index.d.ts.map +1 -0
- package/lib/features/views/index.js +7 -0
- package/lib/features/views/index.js.map +1 -0
- package/lib/features/views/types.d.ts +39 -0
- package/lib/features/views/types.d.ts.map +1 -0
- package/lib/features/views/types.js +2 -0
- package/lib/features/views/types.js.map +1 -0
- package/lib/features/views/viewState.d.ts +14 -0
- package/lib/features/views/viewState.d.ts.map +1 -0
- package/lib/features/views/viewState.js +117 -0
- package/lib/features/views/viewState.js.map +1 -0
- package/lib/i18n/locales/ar.json +18 -0
- package/lib/i18n/locales/de.json +14 -0
- package/lib/i18n/locales/en.json +246 -32
- package/lib/i18n/locales/es.json +15 -0
- package/lib/i18n/locales/fr.json +15 -0
- package/lib/i18n/locales/it.json +15 -0
- package/lib/i18n/locales/ja.json +13 -0
- package/lib/i18n/locales/ko.json +13 -0
- package/lib/i18n/locales/pt.json +15 -0
- package/lib/i18n/locales/ru.json +16 -0
- package/lib/i18n/locales/tr.json +14 -0
- package/lib/i18n/locales/zh-TW.json +13 -0
- package/lib/i18n/locales/zh.json +13 -0
- package/lib/router/HistoryNavigator.d.ts.map +1 -1
- package/lib/router/HistoryNavigator.js +27 -14
- package/lib/router/HistoryNavigator.js.map +1 -1
- package/lib/router/Nav.d.ts.map +1 -1
- package/lib/router/Nav.js +21 -6
- package/lib/router/Nav.js.map +1 -1
- package/lib/router/Router.d.ts.map +1 -1
- package/lib/router/Router.js +19 -4
- package/lib/router/Router.js.map +1 -1
- package/lib/router/path.d.ts +15 -0
- package/lib/router/path.d.ts.map +1 -1
- package/lib/router/path.js +43 -0
- package/lib/router/path.js.map +1 -1
- package/lib/session/UserSession.d.ts +6 -0
- package/lib/session/UserSession.d.ts.map +1 -1
- package/lib/session/UserSession.js +36 -12
- package/lib/session/UserSession.js.map +1 -1
- package/lib/session/UserSessionProvider.d.ts.map +1 -1
- package/lib/session/UserSessionProvider.js +111 -49
- package/lib/session/UserSessionProvider.js.map +1 -1
- package/lib/session/auth/composable.d.ts.map +1 -1
- package/lib/session/auth/composable.js +52 -3
- package/lib/session/auth/composable.js.map +1 -1
- package/lib/session/auth/domainRouting.d.ts +25 -0
- package/lib/session/auth/domainRouting.d.ts.map +1 -1
- package/lib/session/auth/domainRouting.js +36 -0
- package/lib/session/auth/domainRouting.js.map +1 -1
- package/lib/shell/login/SignInRestrictedEnvStep.d.ts +1 -1
- package/lib/shell/login/SignInRestrictedEnvStep.js +1 -1
- package/lib/shell/login/SigninScreen.js +9 -1
- package/lib/shell/login/SigninScreen.js.map +1 -1
- package/lib/shell/login/productionUrl.d.ts +0 -14
- package/lib/shell/login/productionUrl.d.ts.map +1 -1
- package/lib/shell/login/productionUrl.js +14 -5
- package/lib/shell/login/productionUrl.js.map +1 -1
- package/lib/vertesia-ui-core.js +4 -4
- package/lib/vertesia-ui-core.js.map +1 -1
- package/lib/vertesia-ui-env.js +1 -1
- package/lib/vertesia-ui-env.js.map +1 -1
- package/lib/vertesia-ui-features.js +35 -28
- package/lib/vertesia-ui-features.js.map +1 -1
- package/lib/vertesia-ui-i18n.js +15 -15
- package/lib/vertesia-ui-i18n.js.map +1 -1
- package/lib/vertesia-ui-router.js +1 -1
- package/lib/vertesia-ui-router.js.map +1 -1
- package/lib/vertesia-ui-session.js +1 -1
- package/lib/vertesia-ui-session.js.map +1 -1
- package/lib/vertesia-ui-shell.js +1 -1
- package/lib/vertesia-ui-shell.js.map +1 -1
- package/lib/vertesia-ui-widgets.js +7 -7
- package/lib/vertesia-ui-widgets.js.map +1 -1
- package/lib/widgets/form/Form.js +1 -1
- package/lib/widgets/form/Form.js.map +1 -1
- package/lib/widgets/json-view/JSONSwitcher.js +1 -1
- package/lib/widgets/json-view/JSONSwitcher.js.map +1 -1
- package/lib/widgets/json-view/JSONView.js +6 -6
- package/lib/widgets/json-view/JSONView.js.map +1 -1
- package/lib/widgets/monacoEditor/MonacoEditor.d.ts.map +1 -1
- package/lib/widgets/monacoEditor/MonacoEditor.js +29 -0
- package/lib/widgets/monacoEditor/MonacoEditor.js.map +1 -1
- package/lib/widgets/schema-editor/ManagedSchema.d.ts +8 -0
- package/lib/widgets/schema-editor/ManagedSchema.d.ts.map +1 -1
- package/lib/widgets/schema-editor/ManagedSchema.js +16 -0
- package/lib/widgets/schema-editor/ManagedSchema.js.map +1 -1
- package/lib/widgets/schema-editor/editor/EditableSchemaProperty.d.ts +2 -0
- package/lib/widgets/schema-editor/editor/EditableSchemaProperty.d.ts.map +1 -1
- package/lib/widgets/schema-editor/editor/EditableSchemaProperty.js +1 -0
- package/lib/widgets/schema-editor/editor/EditableSchemaProperty.js.map +1 -1
- package/lib/widgets/schema-editor/editor/PropertyViewer.d.ts.map +1 -1
- package/lib/widgets/schema-editor/editor/PropertyViewer.js +4 -1
- package/lib/widgets/schema-editor/editor/PropertyViewer.js.map +1 -1
- package/lib/widgets/schema-editor/editor/SchemaEditor.d.ts.map +1 -1
- package/lib/widgets/schema-editor/editor/SchemaEditor.js +22 -11
- package/lib/widgets/schema-editor/editor/SchemaEditor.js.map +1 -1
- package/llms.txt +70 -70
- package/package.json +33 -32
- package/src/__tests__/a11y.test.tsx +73 -0
- package/src/core/components/SidePanel.tsx +1 -1
- package/src/core/components/shadcn/button.tsx +67 -12
- package/src/core/components/shadcn/modal/dialog.tsx +1 -1
- package/src/core/components/shadcn/theme/ThemeSwitcher.tsx +1 -1
- package/src/env/index.ts +24 -0
- package/src/features/agent/chat/AgentChatPlaybackControls.tsx +0 -5
- package/src/features/agent/chat/AgentRequestInputOverlay.test.tsx +31 -0
- package/src/features/agent/chat/AgentRequestInputOverlay.tsx +6 -2
- package/src/features/agent/chat/ArtifactsTab.tsx +165 -21
- package/src/features/agent/chat/ImageLightbox.tsx +0 -1
- package/src/features/agent/chat/ModernAgentConversation.test.tsx +48 -0
- package/src/features/agent/chat/ModernAgentConversation.tsx +53 -51
- package/src/features/agent/chat/ModernAgentOutput/AllMessagesMixed.test.tsx +6 -1
- package/src/features/agent/chat/ModernAgentOutput/AllMessagesMixed.tsx +21 -15
- package/src/features/agent/chat/ModernAgentOutput/Header.tsx +3 -3
- package/src/features/agent/chat/ModernAgentOutput/MessageInput.tsx +0 -2
- package/src/features/agent/chat/ModernAgentOutput/MessageItem.tsx +4 -1
- package/src/features/agent/chat/ModernAgentOutput/requestInputMessages.test.ts +80 -0
- package/src/features/agent/chat/ModernAgentOutput/requestInputMessages.ts +21 -1
- package/src/features/agent/chat/hooks/useArtifacts.ts +44 -11
- package/src/features/document-viewer/UniversalDocumentViewer.test.tsx +123 -0
- package/src/features/document-viewer/UniversalDocumentViewer.tsx +746 -0
- package/src/features/document-viewer/index.ts +1 -0
- package/src/features/environment/SelectEnvironment.tsx +186 -0
- package/src/features/environment/index.ts +1 -0
- package/src/features/index.ts +3 -0
- package/src/features/magic-pdf/AnnotatedImageSlider.tsx +62 -66
- package/src/features/magic-pdf/DownloadPopover.tsx +5 -48
- package/src/features/magic-pdf/ExtractedContentView.tsx +2 -14
- package/src/features/magic-pdf/GroundedExtractionAssistantPanel.tsx +86 -0
- package/src/features/magic-pdf/GroundedExtractionView.test.tsx +65 -0
- package/src/features/magic-pdf/GroundedExtractionView.tsx +1055 -0
- package/src/features/magic-pdf/MagicPdfProvider.tsx +17 -47
- package/src/features/magic-pdf/MagicPdfView.tsx +3 -51
- package/src/features/magic-pdf/index.ts +1 -0
- package/src/features/magic-pdf/types.ts +1 -1
- package/src/features/oauth/McpConnectionsButton.tsx +0 -2
- package/src/features/oauth/McpConnectionsDialog.tsx +0 -1
- package/src/features/oauth/RemoteMcpConnectionButton.tsx +0 -1
- package/src/features/pdf-viewer/PdfPageSlider.tsx +5 -5
- package/src/features/pdf-viewer/SimplePdfViewer.tsx +11 -12
- package/src/features/permissions/UserPermissionsProvider.tsx +36 -39
- package/src/features/store/objects/DocumentQuickFilter.tsx +13 -15
- package/src/features/store/objects/DocumentSearchResults.tsx +3 -6
- package/src/features/store/objects/components/ContentDispositionButton.tsx +5 -1
- package/src/features/store/objects/components/ContentOverview.tsx +240 -67
- package/src/features/store/objects/components/DocumentIcon.tsx +1 -1
- package/src/features/store/objects/components/VectorSearchWidget.tsx +2 -2
- package/src/features/store/objects/components/useContentPanelHooks.ts +3 -15
- package/src/features/store/objects/layout/renderers.tsx +1 -2
- package/src/features/store/objects/selection/SelectionActions.tsx +1 -1
- package/src/features/store/types/ContentObjectTypesTable.tsx +12 -14
- package/src/features/store/types/IntakePolicyEditor.tsx +679 -0
- package/src/features/store/types/IntakePolicyForm.tsx +838 -0
- package/src/features/store/types/SelectContentTypeModal.tsx +2 -2
- package/src/features/store/types/index.ts +2 -0
- package/src/features/store/types/intake-policy-editor.logic.test.ts +109 -0
- package/src/features/store/types/intake-policy-editor.logic.ts +87 -0
- package/src/features/store/types/typeCatalogCache.ts +45 -0
- package/src/features/user/UserInfo.tsx +7 -7
- package/src/features/views/ViewExperience.test.tsx +273 -0
- package/src/features/views/ViewExperience.tsx +408 -0
- package/src/features/views/ViewNavigation.test.tsx +86 -0
- package/src/features/views/ViewNavigation.tsx +187 -0
- package/src/features/views/ViewResults.test.ts +82 -0
- package/src/features/views/ViewResults.tsx +609 -0
- package/src/features/views/ViewSearch.test.tsx +147 -0
- package/src/features/views/ViewSearch.tsx +205 -0
- package/src/features/views/index.ts +6 -0
- package/src/features/views/types.ts +57 -0
- package/src/features/views/viewState.test.ts +111 -0
- package/src/features/views/viewState.ts +132 -0
- package/src/i18n/locales/ar.json +18 -0
- package/src/i18n/locales/de.json +14 -0
- package/src/i18n/locales/en.json +965 -751
- package/src/i18n/locales/es.json +15 -0
- package/src/i18n/locales/fr.json +15 -0
- package/src/i18n/locales/it.json +15 -0
- package/src/i18n/locales/ja.json +13 -0
- package/src/i18n/locales/ko.json +13 -0
- package/src/i18n/locales/pt.json +15 -0
- package/src/i18n/locales/ru.json +16 -0
- package/src/i18n/locales/tr.json +14 -0
- package/src/i18n/locales/zh-TW.json +13 -0
- package/src/i18n/locales/zh.json +13 -0
- package/src/router/HistoryNavigator.test.ts +48 -0
- package/src/router/HistoryNavigator.ts +28 -14
- package/src/router/Nav.tsx +24 -8
- package/src/router/Router.tsx +18 -4
- package/src/router/path.test.ts +87 -0
- package/src/router/path.ts +38 -0
- package/src/session/UserSession.test.ts +39 -0
- package/src/session/UserSession.ts +37 -12
- package/src/session/UserSessionProvider.tsx +138 -62
- package/src/session/auth/composable.test.ts +111 -0
- package/src/session/auth/composable.ts +58 -3
- package/src/session/auth/domainRouting.test.ts +28 -1
- package/src/session/auth/domainRouting.ts +38 -0
- package/src/shell/login/SignInRestrictedEnvStep.tsx +1 -1
- package/src/shell/login/SigninScreen.tsx +9 -1
- package/src/shell/login/productionUrl.test.ts +8 -5
- package/src/shell/login/productionUrl.ts +15 -5
- package/src/widgets/form/Form.tsx +1 -1
- package/src/widgets/json-view/JSONSwitcher.tsx +2 -2
- package/src/widgets/json-view/JSONView.tsx +7 -7
- package/src/widgets/monacoEditor/MonacoEditor.tsx +29 -0
- package/src/widgets/schema-editor/ManagedSchema.ts +22 -0
- package/src/widgets/schema-editor/editor/EditableSchemaProperty.tsx +3 -0
- package/src/widgets/schema-editor/editor/PropertyViewer.tsx +14 -3
- package/src/widgets/schema-editor/editor/SchemaEditor.tsx +80 -29
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ExecuteViewRequest,
|
|
3
|
+
ViewDisplayConfiguration,
|
|
4
|
+
ViewExecutionResult,
|
|
5
|
+
ViewHit,
|
|
6
|
+
ViewNavigationItem,
|
|
7
|
+
ViewResultMedia,
|
|
8
|
+
} from '@vertesia/common';
|
|
9
|
+
import { ImageRenditionFormat } from '@vertesia/common';
|
|
10
|
+
import { Button, ErrorBox, MessageBox, SelectBox, Spinner } from '@vertesia/ui/core';
|
|
11
|
+
import { useUITranslation } from '@vertesia/ui/i18n';
|
|
12
|
+
import { FullHeightLayout } from '@vertesia/ui/layout';
|
|
13
|
+
import { useUserSession } from '@vertesia/ui/session';
|
|
14
|
+
import { ChevronLeft, ChevronRight } from 'lucide-react';
|
|
15
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
16
|
+
import { GenericPageNavHeader } from '../layout/GenericPageNavHeader.js';
|
|
17
|
+
import type { ViewExecutor, ViewExperienceRenderers, ViewMediaResolver } from './types.js';
|
|
18
|
+
import { DefaultViewNavigation } from './ViewNavigation.js';
|
|
19
|
+
import { DefaultViewResults } from './ViewResults.js';
|
|
20
|
+
import { DefaultViewSearch } from './ViewSearch.js';
|
|
21
|
+
import { canonicalizeViewState, parseViewState, replaceViewStateInUrl, resolveViewSort } from './viewState.js';
|
|
22
|
+
|
|
23
|
+
const FALLBACK_DISPLAY: ViewDisplayConfiguration = {
|
|
24
|
+
id: 'default',
|
|
25
|
+
label: 'Results',
|
|
26
|
+
type: 'list',
|
|
27
|
+
title: { field: 'name' },
|
|
28
|
+
subtitle: [
|
|
29
|
+
{ field: 'type.name', format: 'content_type' },
|
|
30
|
+
{ field: 'location', format: 'location' },
|
|
31
|
+
],
|
|
32
|
+
description: { field: 'description' },
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export interface ViewExperienceProps {
|
|
36
|
+
viewId: string;
|
|
37
|
+
/** Override execution for embedded apps or tests. Defaults to client.views.execute. */
|
|
38
|
+
execute?: ViewExecutor;
|
|
39
|
+
renderers?: ViewExperienceRenderers;
|
|
40
|
+
onOpenHit?: (hit: ViewHit) => void;
|
|
41
|
+
/** Override media resolution for embedded apps or custom storage backends. */
|
|
42
|
+
resolveMedia?: ViewMediaResolver;
|
|
43
|
+
syncUrl?: boolean;
|
|
44
|
+
showHeader?: boolean;
|
|
45
|
+
className?: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function initialRequest(syncUrl: boolean): ExecuteViewRequest {
|
|
49
|
+
if (!syncUrl || typeof window === 'undefined') return {};
|
|
50
|
+
return parseViewState(window.location.search);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function cleanRecord(values: Record<string, string[]>): Record<string, string[]> | undefined {
|
|
54
|
+
const filtered = Object.fromEntries(Object.entries(values).filter(([, entries]) => entries.length > 0));
|
|
55
|
+
return Object.keys(filtered).length > 0 ? filtered : undefined;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function ViewExperienceWithSession(props: Omit<ViewExperienceProps, 'execute'>) {
|
|
59
|
+
const { client } = useUserSession();
|
|
60
|
+
const execute = useCallback(
|
|
61
|
+
(request: ExecuteViewRequest) => client.views.execute(props.viewId, request),
|
|
62
|
+
[client, props.viewId],
|
|
63
|
+
);
|
|
64
|
+
const resolveMedia = useCallback<ViewMediaResolver>(
|
|
65
|
+
async (hit: ViewHit, media: ViewResultMedia) => {
|
|
66
|
+
if (media.source !== 'content_thumbnail') return undefined;
|
|
67
|
+
|
|
68
|
+
const content = hit.document.content;
|
|
69
|
+
try {
|
|
70
|
+
const rendition = await client.objects.getRenditionSafe(hit.id, content?.type, {
|
|
71
|
+
format: ImageRenditionFormat.jpeg,
|
|
72
|
+
max_hw: 512,
|
|
73
|
+
generate_if_missing: false,
|
|
74
|
+
sign_url: true,
|
|
75
|
+
});
|
|
76
|
+
if (rendition?.status === 'found' && rendition.renditions?.length) {
|
|
77
|
+
return rendition.renditions[0];
|
|
78
|
+
}
|
|
79
|
+
} catch {
|
|
80
|
+
// A missing optional rendition falls through to the original image.
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (content?.source && content.type?.startsWith('image/')) {
|
|
84
|
+
const download = await client.files.getDownloadUrl(content.source);
|
|
85
|
+
return download.url;
|
|
86
|
+
}
|
|
87
|
+
return undefined;
|
|
88
|
+
},
|
|
89
|
+
[client],
|
|
90
|
+
);
|
|
91
|
+
return <ViewExperienceRuntime {...props} execute={execute} resolveMedia={props.resolveMedia ?? resolveMedia} />;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Reusable renderer for stored and app-contributed View Experiences.
|
|
96
|
+
* Pass `execute` to use it outside Vertesia's session provider.
|
|
97
|
+
*/
|
|
98
|
+
export function ViewExperience({ execute, ...props }: ViewExperienceProps) {
|
|
99
|
+
return execute ? (
|
|
100
|
+
<ViewExperienceRuntime key={props.viewId} {...props} execute={execute} />
|
|
101
|
+
) : (
|
|
102
|
+
<ViewExperienceWithSession key={props.viewId} {...props} />
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
interface ViewExperienceRuntimeProps extends Omit<ViewExperienceProps, 'execute'> {
|
|
107
|
+
execute: ViewExecutor;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function ViewExperienceRuntime({
|
|
111
|
+
execute,
|
|
112
|
+
renderers,
|
|
113
|
+
onOpenHit,
|
|
114
|
+
resolveMedia,
|
|
115
|
+
syncUrl = true,
|
|
116
|
+
showHeader = true,
|
|
117
|
+
className,
|
|
118
|
+
}: ViewExperienceRuntimeProps) {
|
|
119
|
+
const { t } = useUITranslation();
|
|
120
|
+
const executeRef = useRef(execute);
|
|
121
|
+
executeRef.current = execute;
|
|
122
|
+
const generationRef = useRef(0);
|
|
123
|
+
const [request, setRequest] = useState<ExecuteViewRequest>(() => initialRequest(syncUrl));
|
|
124
|
+
const [draftQuery, setDraftQuery] = useState(request.query ?? '');
|
|
125
|
+
const [draftKeyTerms, setDraftKeyTerms] = useState<Record<string, string[]>>(request.key_terms ?? {});
|
|
126
|
+
const [result, setResult] = useState<ViewExecutionResult>();
|
|
127
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
128
|
+
const [error, setError] = useState<Error>();
|
|
129
|
+
|
|
130
|
+
const runRequest = useCallback(
|
|
131
|
+
(next: ExecuteViewRequest, updateUrl: boolean) => {
|
|
132
|
+
const generation = ++generationRef.current;
|
|
133
|
+
setRequest(next);
|
|
134
|
+
if (updateUrl && syncUrl) replaceViewStateInUrl(next);
|
|
135
|
+
setIsLoading(true);
|
|
136
|
+
setError(undefined);
|
|
137
|
+
return executeRef
|
|
138
|
+
.current(next)
|
|
139
|
+
.then((response) => {
|
|
140
|
+
if (generation === generationRef.current) {
|
|
141
|
+
const canonicalRequest = canonicalizeViewState(next, response);
|
|
142
|
+
setRequest(canonicalRequest);
|
|
143
|
+
if (syncUrl) replaceViewStateInUrl(canonicalRequest);
|
|
144
|
+
setResult(response);
|
|
145
|
+
}
|
|
146
|
+
})
|
|
147
|
+
.catch((cause: unknown) => {
|
|
148
|
+
if (generation === generationRef.current) {
|
|
149
|
+
setError(cause instanceof Error ? cause : new Error(String(cause)));
|
|
150
|
+
}
|
|
151
|
+
})
|
|
152
|
+
.finally(() => {
|
|
153
|
+
if (generation === generationRef.current) setIsLoading(false);
|
|
154
|
+
});
|
|
155
|
+
},
|
|
156
|
+
[syncUrl],
|
|
157
|
+
);
|
|
158
|
+
|
|
159
|
+
const loadUrlState = useCallback(() => {
|
|
160
|
+
const next = initialRequest(syncUrl);
|
|
161
|
+
setDraftQuery(next.query ?? '');
|
|
162
|
+
setDraftKeyTerms(next.key_terms ?? {});
|
|
163
|
+
return runRequest(next, false);
|
|
164
|
+
}, [runRequest, syncUrl]);
|
|
165
|
+
|
|
166
|
+
useEffect(() => {
|
|
167
|
+
void loadUrlState();
|
|
168
|
+
return () => {
|
|
169
|
+
generationRef.current += 1;
|
|
170
|
+
};
|
|
171
|
+
}, [loadUrlState]);
|
|
172
|
+
|
|
173
|
+
useEffect(() => {
|
|
174
|
+
if (!syncUrl || typeof window === 'undefined') return;
|
|
175
|
+
const onPopState = () => void loadUrlState();
|
|
176
|
+
window.addEventListener('popstate', onPopState);
|
|
177
|
+
return () => window.removeEventListener('popstate', onPopState);
|
|
178
|
+
}, [loadUrlState, syncUrl]);
|
|
179
|
+
|
|
180
|
+
const definition = result?.definition;
|
|
181
|
+
const navigation = useMemo(
|
|
182
|
+
() => [...(definition?.navigation ?? [])].sort((left, right) => (left.order ?? 0) - (right.order ?? 0)),
|
|
183
|
+
[definition?.navigation],
|
|
184
|
+
);
|
|
185
|
+
const resultsConfiguration = definition?.results;
|
|
186
|
+
const effectiveDisplayId = result?.display ?? request.display ?? resultsConfiguration?.default_display;
|
|
187
|
+
const display =
|
|
188
|
+
resultsConfiguration?.displays.find((candidate) => candidate.id === effectiveDisplayId) ?? FALLBACK_DISPLAY;
|
|
189
|
+
const effectiveSortId = result
|
|
190
|
+
? resolveViewSort(request, result, resultsConfiguration?.default_sort)
|
|
191
|
+
: request.sort;
|
|
192
|
+
|
|
193
|
+
const applyRequest = (next: ExecuteViewRequest) => {
|
|
194
|
+
void runRequest(next, true);
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
const updateNavigation = (item: ViewNavigationItem, values: string[]) => {
|
|
198
|
+
const nextNavigation = cleanRecord({ ...(request.navigation ?? {}), [item.id]: values });
|
|
199
|
+
applyRequest({ ...request, navigation: nextNavigation, offset: undefined });
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
const submitSearch = () => {
|
|
203
|
+
applyRequest({
|
|
204
|
+
...request,
|
|
205
|
+
query: draftQuery.trim() || undefined,
|
|
206
|
+
key_terms: cleanRecord(draftKeyTerms),
|
|
207
|
+
offset: undefined,
|
|
208
|
+
});
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
if (!result && isLoading) {
|
|
212
|
+
return (
|
|
213
|
+
<div className="flex h-full min-h-48 items-center justify-center">
|
|
214
|
+
<Spinner size="xl" />
|
|
215
|
+
</div>
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
if (!result || !definition) {
|
|
220
|
+
return (
|
|
221
|
+
<div className="flex h-full min-h-48 items-center justify-center p-4">
|
|
222
|
+
<ErrorBox
|
|
223
|
+
title={t('store.searchFailed')}
|
|
224
|
+
action={() => void loadUrlState()}
|
|
225
|
+
actionLabel={t('agent.retry')}
|
|
226
|
+
>
|
|
227
|
+
{t('store.searchFailed')}
|
|
228
|
+
</ErrorBox>
|
|
229
|
+
</div>
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
const SearchRenderer = definition.search?.renderer
|
|
234
|
+
? (renderers?.search?.[definition.search.renderer] ?? DefaultViewSearch)
|
|
235
|
+
: DefaultViewSearch;
|
|
236
|
+
const ResultsRenderer = display.renderer
|
|
237
|
+
? (renderers?.results?.[display.renderer] ?? DefaultViewResults)
|
|
238
|
+
: DefaultViewResults;
|
|
239
|
+
const hasSidebarNavigation = navigation.length > 0 && definition.layout?.navigation_position !== 'top';
|
|
240
|
+
const isWorklist = definition.layout?.mode === 'worklist';
|
|
241
|
+
const offset = request.offset ?? 0;
|
|
242
|
+
const pageStep = request.limit ?? display.page_size ?? 20;
|
|
243
|
+
const hasPrevious = offset > 0;
|
|
244
|
+
const hasNext = offset + result.hits.length < result.total;
|
|
245
|
+
|
|
246
|
+
const navigationWidgets = navigation.map((item) => {
|
|
247
|
+
const navigationResult = result.navigation[item.id] ?? { id: item.id, selected: [], nodes: [] };
|
|
248
|
+
const NavigationRenderer = item.renderer
|
|
249
|
+
? (renderers?.navigation?.[item.renderer] ?? DefaultViewNavigation)
|
|
250
|
+
: DefaultViewNavigation;
|
|
251
|
+
return (
|
|
252
|
+
<NavigationRenderer
|
|
253
|
+
key={item.id}
|
|
254
|
+
configuration={item}
|
|
255
|
+
result={navigationResult}
|
|
256
|
+
isLoading={isLoading}
|
|
257
|
+
onChange={(values) => updateNavigation(item, values)}
|
|
258
|
+
/>
|
|
259
|
+
);
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
return (
|
|
263
|
+
<FullHeightLayout className={className}>
|
|
264
|
+
{showHeader && <GenericPageNavHeader title={definition.name} description={definition.description} />}
|
|
265
|
+
<FullHeightLayout.Fixed heightClass="h-auto" className="space-y-3 border-b p-3">
|
|
266
|
+
{definition.search && (
|
|
267
|
+
<SearchRenderer
|
|
268
|
+
configuration={definition.search}
|
|
269
|
+
query={draftQuery}
|
|
270
|
+
keyTerms={draftKeyTerms}
|
|
271
|
+
isLoading={isLoading}
|
|
272
|
+
onQueryChange={setDraftQuery}
|
|
273
|
+
onKeyTermsChange={(id, values) => setDraftKeyTerms((current) => ({ ...current, [id]: values }))}
|
|
274
|
+
onSubmit={submitSearch}
|
|
275
|
+
/>
|
|
276
|
+
)}
|
|
277
|
+
{navigation.length > 0 && definition.layout?.navigation_position === 'top' && (
|
|
278
|
+
<div className="grid gap-4 md:grid-cols-2 xl:grid-cols-4">{navigationWidgets}</div>
|
|
279
|
+
)}
|
|
280
|
+
</FullHeightLayout.Fixed>
|
|
281
|
+
<FullHeightLayout.Body className="p-0">
|
|
282
|
+
<div
|
|
283
|
+
className={
|
|
284
|
+
hasSidebarNavigation
|
|
285
|
+
? isWorklist
|
|
286
|
+
? 'grid min-h-full lg:grid-cols-[minmax(0,1fr)_18rem]'
|
|
287
|
+
: 'grid min-h-full lg:grid-cols-[18rem_minmax(0,1fr)]'
|
|
288
|
+
: 'min-h-full'
|
|
289
|
+
}
|
|
290
|
+
>
|
|
291
|
+
{hasSidebarNavigation && (
|
|
292
|
+
<aside
|
|
293
|
+
className={
|
|
294
|
+
isWorklist
|
|
295
|
+
? 'space-y-5 border-b p-4 lg:order-2 lg:border-s lg:border-b-0'
|
|
296
|
+
: 'space-y-5 border-b p-4 lg:border-e lg:border-b-0'
|
|
297
|
+
}
|
|
298
|
+
>
|
|
299
|
+
{navigationWidgets}
|
|
300
|
+
</aside>
|
|
301
|
+
)}
|
|
302
|
+
<main className={`min-w-0 space-y-4 p-4 ${isWorklist ? 'lg:order-1' : ''}`}>
|
|
303
|
+
{error && (
|
|
304
|
+
<ErrorBox
|
|
305
|
+
title={t('store.searchFailed')}
|
|
306
|
+
action={() => void runRequest(request, false)}
|
|
307
|
+
actionLabel={t('agent.retry')}
|
|
308
|
+
>
|
|
309
|
+
{t('store.searchFailed')}
|
|
310
|
+
</ErrorBox>
|
|
311
|
+
)}
|
|
312
|
+
{result.search.warnings.length > 0 && (
|
|
313
|
+
<MessageBox status="warning" title={t('view.warning')}>
|
|
314
|
+
<ul className="list-disc space-y-1 ps-4">
|
|
315
|
+
{result.search.warnings.map((warning) => (
|
|
316
|
+
<li key={`${warning.code}-${warning.path ?? ''}`}>{warning.message}</li>
|
|
317
|
+
))}
|
|
318
|
+
</ul>
|
|
319
|
+
</MessageBox>
|
|
320
|
+
)}
|
|
321
|
+
<div className="flex flex-wrap items-center justify-between gap-3">
|
|
322
|
+
<div className="flex items-center gap-2 text-sm text-muted">
|
|
323
|
+
<span>{t('view.resultsCount', { count: result.total })}</span>
|
|
324
|
+
{isLoading && <Spinner size="sm" />}
|
|
325
|
+
</div>
|
|
326
|
+
<div className="flex flex-wrap items-center gap-3">
|
|
327
|
+
{resultsConfiguration?.allow_display_switch &&
|
|
328
|
+
resultsConfiguration.displays.length > 1 && (
|
|
329
|
+
<div className="flex items-center gap-2">
|
|
330
|
+
<span className="text-sm text-muted">{t('view.display')}</span>
|
|
331
|
+
<SelectBox
|
|
332
|
+
options={resultsConfiguration.displays}
|
|
333
|
+
value={display}
|
|
334
|
+
onChange={(option) =>
|
|
335
|
+
applyRequest({ ...request, display: option.id, offset: undefined })
|
|
336
|
+
}
|
|
337
|
+
optionLabel={(option) => option.label}
|
|
338
|
+
by="id"
|
|
339
|
+
disabled={isLoading}
|
|
340
|
+
aria-label={t('view.display')}
|
|
341
|
+
className="min-w-36"
|
|
342
|
+
/>
|
|
343
|
+
</div>
|
|
344
|
+
)}
|
|
345
|
+
{resultsConfiguration?.sort_options && resultsConfiguration.sort_options.length > 0 && (
|
|
346
|
+
<div className="flex items-center gap-2">
|
|
347
|
+
<span className="text-sm text-muted">{t('view.sort')}</span>
|
|
348
|
+
<SelectBox
|
|
349
|
+
options={resultsConfiguration.sort_options}
|
|
350
|
+
value={resultsConfiguration.sort_options.find(
|
|
351
|
+
(option) => option.id === effectiveSortId,
|
|
352
|
+
)}
|
|
353
|
+
onChange={(option) =>
|
|
354
|
+
applyRequest({ ...request, sort: option.id, offset: undefined })
|
|
355
|
+
}
|
|
356
|
+
optionLabel={(option) => option.label}
|
|
357
|
+
by="id"
|
|
358
|
+
disabled={isLoading}
|
|
359
|
+
aria-label={t('view.sort')}
|
|
360
|
+
className="min-w-44"
|
|
361
|
+
/>
|
|
362
|
+
</div>
|
|
363
|
+
)}
|
|
364
|
+
</div>
|
|
365
|
+
</div>
|
|
366
|
+
<ResultsRenderer
|
|
367
|
+
configuration={display}
|
|
368
|
+
definition={definition}
|
|
369
|
+
request={request}
|
|
370
|
+
result={result}
|
|
371
|
+
isLoading={isLoading}
|
|
372
|
+
onSortChange={(sort) => applyRequest({ ...request, sort, offset: undefined })}
|
|
373
|
+
onOpenHit={onOpenHit}
|
|
374
|
+
resolveMedia={resolveMedia}
|
|
375
|
+
/>
|
|
376
|
+
{(hasPrevious || hasNext) && (
|
|
377
|
+
<nav className="flex items-center justify-center gap-2" aria-label={t('view.pagination')}>
|
|
378
|
+
<Button
|
|
379
|
+
type="button"
|
|
380
|
+
variant="outline"
|
|
381
|
+
disabled={!hasPrevious || isLoading}
|
|
382
|
+
onClick={() =>
|
|
383
|
+
applyRequest({
|
|
384
|
+
...request,
|
|
385
|
+
offset: Math.max(0, offset - pageStep) || undefined,
|
|
386
|
+
})
|
|
387
|
+
}
|
|
388
|
+
>
|
|
389
|
+
<ChevronLeft className="size-4 cn-rtl-flip" />
|
|
390
|
+
{t('grounded.previousPage')}
|
|
391
|
+
</Button>
|
|
392
|
+
<Button
|
|
393
|
+
type="button"
|
|
394
|
+
variant="outline"
|
|
395
|
+
disabled={!hasNext || isLoading}
|
|
396
|
+
onClick={() => applyRequest({ ...request, offset: offset + pageStep })}
|
|
397
|
+
>
|
|
398
|
+
{t('grounded.nextPage')}
|
|
399
|
+
<ChevronRight className="size-4 cn-rtl-flip" />
|
|
400
|
+
</Button>
|
|
401
|
+
</nav>
|
|
402
|
+
)}
|
|
403
|
+
</main>
|
|
404
|
+
</div>
|
|
405
|
+
</FullHeightLayout.Body>
|
|
406
|
+
</FullHeightLayout>
|
|
407
|
+
);
|
|
408
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { cleanup, fireEvent, screen } from '@testing-library/react';
|
|
2
|
+
import { afterEach, describe, expect, it, vi } from 'vitest';
|
|
3
|
+
import { renderWithProviders } from '../../__tests__/test-utils.js';
|
|
4
|
+
import { DefaultViewNavigation } from './ViewNavigation.js';
|
|
5
|
+
|
|
6
|
+
describe('DefaultViewNavigation', () => {
|
|
7
|
+
afterEach(cleanup);
|
|
8
|
+
|
|
9
|
+
it('keeps selected collection labels visible above the available nodes', () => {
|
|
10
|
+
const onChange = vi.fn();
|
|
11
|
+
renderWithProviders(
|
|
12
|
+
<DefaultViewNavigation
|
|
13
|
+
configuration={{ id: 'collections', label: 'Collections', source: 'collection' }}
|
|
14
|
+
result={{
|
|
15
|
+
id: 'collections',
|
|
16
|
+
selected: ['selected-id'],
|
|
17
|
+
nodes: [
|
|
18
|
+
{ id: 'selected-id', label: 'Priority orders', count: 12, selected: true },
|
|
19
|
+
{ id: 'child-id', label: 'Escalated', count: 3 },
|
|
20
|
+
],
|
|
21
|
+
}}
|
|
22
|
+
isLoading={false}
|
|
23
|
+
onChange={onChange}
|
|
24
|
+
/>,
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
expect(screen.getAllByText('Priority orders')).toHaveLength(2);
|
|
28
|
+
expect(screen.queryByText('selected-id')).toBeNull();
|
|
29
|
+
fireEvent.click(screen.getByRole('checkbox', { name: /Priority orders/ }));
|
|
30
|
+
expect(onChange).toHaveBeenCalledWith([]);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('lets users remove a selected location after drill-down hides the parent node', () => {
|
|
34
|
+
const onChange = vi.fn();
|
|
35
|
+
renderWithProviders(
|
|
36
|
+
<DefaultViewNavigation
|
|
37
|
+
configuration={{ id: 'location', label: 'Location', source: 'location', multi_select: true }}
|
|
38
|
+
result={{
|
|
39
|
+
id: 'location',
|
|
40
|
+
selected: ['/Customers/Acme'],
|
|
41
|
+
nodes: [{ id: '/Customers/Acme/Orders', label: 'Orders', count: 8 }],
|
|
42
|
+
}}
|
|
43
|
+
isLoading={false}
|
|
44
|
+
onChange={onChange}
|
|
45
|
+
/>,
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
fireEvent.click(screen.getByRole('button', { name: 'Remove /Customers/Acme' }));
|
|
49
|
+
expect(onChange).toHaveBeenCalledWith([]);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('renders property hierarchy buckets as drill-down choices with clickable breadcrumbs', () => {
|
|
53
|
+
const onChange = vi.fn();
|
|
54
|
+
renderWithProviders(
|
|
55
|
+
<DefaultViewNavigation
|
|
56
|
+
configuration={{
|
|
57
|
+
id: 'geography',
|
|
58
|
+
label: 'Geography',
|
|
59
|
+
source: 'hierarchy',
|
|
60
|
+
levels: [
|
|
61
|
+
{ id: 'state', label: 'State', field: 'properties.state' },
|
|
62
|
+
{ id: 'city', label: 'City', field: 'properties.city' },
|
|
63
|
+
],
|
|
64
|
+
}}
|
|
65
|
+
result={{
|
|
66
|
+
id: 'geography',
|
|
67
|
+
selected: ['h1:florida'],
|
|
68
|
+
breadcrumbs: [{ id: 'h1:florida', label: 'FL', count: 0, selected: true }],
|
|
69
|
+
nodes: [
|
|
70
|
+
{ id: 'h1:miami', label: 'Miami', count: 8 },
|
|
71
|
+
{ id: 'h1:orlando', label: 'Orlando', count: 4 },
|
|
72
|
+
],
|
|
73
|
+
}}
|
|
74
|
+
isLoading={false}
|
|
75
|
+
onChange={onChange}
|
|
76
|
+
/>,
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
expect(screen.queryByText('h1:florida')).toBeNull();
|
|
80
|
+
expect(screen.getByRole('navigation', { name: 'Geography path' })).not.toBeNull();
|
|
81
|
+
fireEvent.click(screen.getByRole('button', { name: /Miami/ }));
|
|
82
|
+
expect(onChange).toHaveBeenLastCalledWith(['h1:miami']);
|
|
83
|
+
fireEvent.click(screen.getByRole('button', { name: 'FL' }));
|
|
84
|
+
expect(onChange).toHaveBeenLastCalledWith(['h1:florida']);
|
|
85
|
+
});
|
|
86
|
+
});
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import type { ViewNavigationNode } from '@vertesia/common';
|
|
2
|
+
import { Button, Checkbox, SelectBox } from '@vertesia/ui/core';
|
|
3
|
+
import { useUITranslation } from '@vertesia/ui/i18n';
|
|
4
|
+
import { ChevronRight, X } from 'lucide-react';
|
|
5
|
+
import { useId } from 'react';
|
|
6
|
+
import type { ViewNavigationRendererProps } from './types.js';
|
|
7
|
+
|
|
8
|
+
function nextSelection(current: string[], id: string, selected: boolean, multiSelect: boolean | undefined): string[] {
|
|
9
|
+
if (!selected) return current.filter((value) => value !== id);
|
|
10
|
+
if (multiSelect === false) return [id];
|
|
11
|
+
return current.includes(id) ? current : [...current, id];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function NodeLabel({ node }: { node: ViewNavigationNode }) {
|
|
15
|
+
return (
|
|
16
|
+
<span className="flex min-w-0 flex-1 items-center justify-between gap-2">
|
|
17
|
+
<span className="truncate">{node.label}</span>
|
|
18
|
+
<span className="text-xs tabular-nums text-muted">{node.count}</span>
|
|
19
|
+
</span>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function DefaultViewNavigation({ configuration, result, isLoading, onChange }: ViewNavigationRendererProps) {
|
|
24
|
+
const { t } = useUITranslation();
|
|
25
|
+
const idPrefix = useId();
|
|
26
|
+
const presentation =
|
|
27
|
+
configuration.presentation ??
|
|
28
|
+
(configuration.source === 'location' || configuration.source === 'hierarchy' ? 'tree' : 'list');
|
|
29
|
+
const multiSelect = configuration.source === 'hierarchy' ? false : configuration.multi_select;
|
|
30
|
+
const breadcrumbs = result.breadcrumbs ?? [];
|
|
31
|
+
|
|
32
|
+
const toggle = (id: string, selected: boolean) => {
|
|
33
|
+
onChange(nextSelection(result.selected, id, selected, multiSelect));
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<section className="space-y-2" aria-labelledby={`${idPrefix}-label`}>
|
|
38
|
+
<div className="flex items-center justify-between gap-2">
|
|
39
|
+
<h2 id={`${idPrefix}-label`} className="text-sm font-semibold">
|
|
40
|
+
{configuration.label}
|
|
41
|
+
</h2>
|
|
42
|
+
{result.selected.length > 0 && (
|
|
43
|
+
<Button
|
|
44
|
+
type="button"
|
|
45
|
+
variant="ghost"
|
|
46
|
+
size="sm"
|
|
47
|
+
disabled={isLoading}
|
|
48
|
+
onClick={() => onChange([])}
|
|
49
|
+
aria-label={`${t('filter.clearAll')}: ${configuration.label}`}
|
|
50
|
+
>
|
|
51
|
+
<X className="size-3.5" />
|
|
52
|
+
{t('filter.clearAll')}
|
|
53
|
+
</Button>
|
|
54
|
+
)}
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
{configuration.source === 'hierarchy' && breadcrumbs.length > 0 && (
|
|
58
|
+
<nav aria-label={`${configuration.label} path`}>
|
|
59
|
+
<ol className="flex flex-wrap items-center gap-1 text-sm">
|
|
60
|
+
{breadcrumbs.map((node, index) => (
|
|
61
|
+
<li key={node.id} className="flex items-center gap-1">
|
|
62
|
+
{index > 0 && <ChevronRight aria-hidden="true" className="size-3.5 text-muted" />}
|
|
63
|
+
<Button
|
|
64
|
+
type="button"
|
|
65
|
+
variant="ghost"
|
|
66
|
+
size="sm"
|
|
67
|
+
disabled={isLoading}
|
|
68
|
+
onClick={() => onChange([node.id])}
|
|
69
|
+
aria-current={index === breadcrumbs.length - 1 ? 'page' : undefined}
|
|
70
|
+
>
|
|
71
|
+
{node.label}
|
|
72
|
+
</Button>
|
|
73
|
+
</li>
|
|
74
|
+
))}
|
|
75
|
+
</ol>
|
|
76
|
+
</nav>
|
|
77
|
+
)}
|
|
78
|
+
|
|
79
|
+
{result.selected.length > 0 &&
|
|
80
|
+
(configuration.source === 'location' || configuration.source === 'collection') && (
|
|
81
|
+
<div className="flex flex-wrap gap-1">
|
|
82
|
+
{result.selected.map((value) => {
|
|
83
|
+
const node = result.nodes.find((candidate) => candidate.id === value);
|
|
84
|
+
const label = node?.label ?? value;
|
|
85
|
+
return (
|
|
86
|
+
<Button
|
|
87
|
+
key={value}
|
|
88
|
+
type="button"
|
|
89
|
+
variant="secondary"
|
|
90
|
+
size="sm"
|
|
91
|
+
disabled={isLoading}
|
|
92
|
+
onClick={() => toggle(value, false)}
|
|
93
|
+
aria-label={t('view.removeSelection', { value: label })}
|
|
94
|
+
>
|
|
95
|
+
{label}
|
|
96
|
+
<X aria-hidden="true" className="size-3.5" />
|
|
97
|
+
</Button>
|
|
98
|
+
);
|
|
99
|
+
})}
|
|
100
|
+
</div>
|
|
101
|
+
)}
|
|
102
|
+
|
|
103
|
+
{presentation === 'select' && multiSelect === false ? (
|
|
104
|
+
<SelectBox<ViewNavigationNode>
|
|
105
|
+
options={result.nodes}
|
|
106
|
+
value={result.nodes.find((node) => result.selected.includes(node.id))}
|
|
107
|
+
onChange={(node) => onChange([node.id])}
|
|
108
|
+
optionLabel={(node) => `${node.label} (${node.count})`}
|
|
109
|
+
by="id"
|
|
110
|
+
disabled={isLoading}
|
|
111
|
+
placeholder={configuration.label}
|
|
112
|
+
aria-label={configuration.label}
|
|
113
|
+
/>
|
|
114
|
+
) : presentation === 'select' ? (
|
|
115
|
+
<SelectBox<ViewNavigationNode>
|
|
116
|
+
multiple
|
|
117
|
+
options={result.nodes}
|
|
118
|
+
value={result.nodes.filter((node) => result.selected.includes(node.id))}
|
|
119
|
+
onChange={(nodes) => onChange(nodes.map((node) => node.id))}
|
|
120
|
+
optionLabel={(node) => `${node.label} (${node.count})`}
|
|
121
|
+
by="id"
|
|
122
|
+
disabled={isLoading}
|
|
123
|
+
placeholder={configuration.label}
|
|
124
|
+
aria-label={configuration.label}
|
|
125
|
+
/>
|
|
126
|
+
) : presentation === 'chips' ? (
|
|
127
|
+
<div className="flex flex-wrap gap-2">
|
|
128
|
+
{result.nodes.map((node) => (
|
|
129
|
+
<Button
|
|
130
|
+
type="button"
|
|
131
|
+
variant={result.selected.includes(node.id) ? 'secondary' : 'outline'}
|
|
132
|
+
size="sm"
|
|
133
|
+
key={node.id}
|
|
134
|
+
disabled={isLoading}
|
|
135
|
+
onClick={() => toggle(node.id, !result.selected.includes(node.id))}
|
|
136
|
+
>
|
|
137
|
+
{node.label}
|
|
138
|
+
<span className="text-xs tabular-nums text-muted">{node.count}</span>
|
|
139
|
+
</Button>
|
|
140
|
+
))}
|
|
141
|
+
</div>
|
|
142
|
+
) : configuration.source === 'hierarchy' ? (
|
|
143
|
+
<div className="space-y-1">
|
|
144
|
+
{result.nodes.map((node) => (
|
|
145
|
+
<Button
|
|
146
|
+
type="button"
|
|
147
|
+
variant={result.selected.includes(node.id) ? 'secondary' : 'ghost'}
|
|
148
|
+
className="w-full justify-start"
|
|
149
|
+
key={node.id}
|
|
150
|
+
disabled={isLoading}
|
|
151
|
+
onClick={() => onChange([node.id])}
|
|
152
|
+
>
|
|
153
|
+
<NodeLabel node={node} />
|
|
154
|
+
{node.expandable && (
|
|
155
|
+
<ChevronRight aria-hidden="true" className="size-4 shrink-0 text-muted" />
|
|
156
|
+
)}
|
|
157
|
+
</Button>
|
|
158
|
+
))}
|
|
159
|
+
</div>
|
|
160
|
+
) : (
|
|
161
|
+
<div className="space-y-1">
|
|
162
|
+
{result.nodes.map((node, index) => {
|
|
163
|
+
const nodeId = `${idPrefix}-${index}`;
|
|
164
|
+
return (
|
|
165
|
+
<div
|
|
166
|
+
key={node.id}
|
|
167
|
+
className="flex items-center gap-2 rounded-md px-2 py-1.5 hover:bg-muted"
|
|
168
|
+
>
|
|
169
|
+
<Checkbox
|
|
170
|
+
id={nodeId}
|
|
171
|
+
checked={result.selected.includes(node.id)}
|
|
172
|
+
disabled={isLoading}
|
|
173
|
+
onCheckedChange={(checked) => toggle(node.id, checked === true)}
|
|
174
|
+
/>
|
|
175
|
+
<label htmlFor={nodeId} className="flex min-w-0 flex-1 cursor-pointer text-sm">
|
|
176
|
+
<NodeLabel node={node} />
|
|
177
|
+
</label>
|
|
178
|
+
</div>
|
|
179
|
+
);
|
|
180
|
+
})}
|
|
181
|
+
</div>
|
|
182
|
+
)}
|
|
183
|
+
|
|
184
|
+
{result.nodes.length === 0 && <p className="text-sm text-muted">{t('filter.noAvailableFilters')}</p>}
|
|
185
|
+
</section>
|
|
186
|
+
);
|
|
187
|
+
}
|