box-ui-elements 23.5.0-beta.3 → 24.0.0-beta.1
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/dist/explorer.css +1 -1
- package/dist/explorer.js +1 -1
- package/dist/picker.js +1 -1
- package/dist/preview.css +1 -1
- package/dist/preview.js +1 -1
- package/dist/sidebar.css +1 -1
- package/dist/sidebar.js +1 -1
- package/es/constants.js +13 -0
- package/es/constants.js.flow +13 -0
- package/es/constants.js.map +1 -1
- package/es/elements/common/content-answers/ContentAnswersModal.js +1 -3
- package/es/elements/common/content-answers/ContentAnswersModal.js.map +1 -1
- package/es/elements/common/sub-header/SubHeader.js +3 -0
- package/es/elements/common/sub-header/SubHeader.js.map +1 -1
- package/es/elements/common/sub-header/SubHeaderLeftV2.js +3 -23
- package/es/elements/common/sub-header/SubHeaderLeftV2.js.map +1 -1
- package/es/elements/common/sub-header/SubHeaderRight.js +6 -2
- package/es/elements/common/sub-header/SubHeaderRight.js.map +1 -1
- package/es/elements/content-explorer/ContentExplorer.js +55 -10
- package/es/elements/content-explorer/ContentExplorer.js.map +1 -1
- package/es/elements/content-explorer/ContentExplorer.scss +12 -0
- package/es/elements/content-explorer/MetadataSidePanel.js +92 -0
- package/es/elements/content-explorer/MetadataSidePanel.js.map +1 -0
- package/es/elements/content-explorer/MetadataSidePanel.scss +12 -0
- package/es/elements/content-explorer/stories/tests/MetadataView-visual.stories.js +54 -3
- package/es/elements/content-explorer/stories/tests/MetadataView-visual.stories.js.map +1 -1
- package/es/elements/content-explorer/utils.js +67 -0
- package/es/elements/content-explorer/utils.js.map +1 -0
- package/es/elements/content-sidebar/BoxAISidebar.js.map +1 -1
- package/es/elements/content-sidebar/BoxAISidebarContent.js +2 -4
- package/es/elements/content-sidebar/BoxAISidebarContent.js.map +1 -1
- package/es/elements/content-sidebar/stories/BoxAISidebar.stories.js +0 -1
- package/es/elements/content-sidebar/stories/BoxAISidebar.stories.js.map +1 -1
- package/es/elements/content-sidebar/stories/tests/BoxAISidebar-visual.stories.js +0 -1
- package/es/elements/content-sidebar/stories/tests/BoxAISidebar-visual.stories.js.map +1 -1
- package/es/src/elements/common/content-answers/ContentAnswersModal.d.ts +0 -1
- package/es/src/elements/common/sub-header/SubHeader.d.ts +2 -1
- package/es/src/elements/common/sub-header/SubHeaderLeftV2.d.ts +1 -1
- package/es/src/elements/common/sub-header/SubHeaderRight.d.ts +4 -1
- package/es/src/elements/content-explorer/ContentExplorer.d.ts +15 -0
- package/es/src/elements/content-explorer/MetadataSidePanel.d.ts +13 -0
- package/es/src/elements/content-explorer/__tests__/MetadataSidePanel.test.d.ts +1 -0
- package/es/src/elements/content-explorer/stories/tests/MetadataView-visual.stories.d.ts +2 -0
- package/es/src/elements/content-explorer/utils.d.ts +22 -0
- package/es/src/elements/content-sidebar/BoxAISidebar.d.ts +0 -1
- package/es/src/elements/content-sidebar/stories/BoxAISidebar.stories.d.ts +0 -1
- package/package.json +2 -2
- package/src/constants.js +13 -0
- package/src/elements/common/content-answers/ContentAnswersModal.tsx +0 -3
- package/src/elements/common/content-answers/__tests__/ContentAnswersModal.test.tsx +7 -2
- package/src/elements/common/sub-header/SubHeader.tsx +4 -0
- package/src/elements/common/sub-header/SubHeaderLeftV2.tsx +3 -22
- package/src/elements/common/sub-header/SubHeaderRight.tsx +8 -2
- package/src/elements/content-explorer/ContentExplorer.scss +12 -0
- package/src/elements/content-explorer/ContentExplorer.tsx +135 -77
- package/src/elements/content-explorer/MetadataSidePanel.scss +12 -0
- package/src/elements/content-explorer/MetadataSidePanel.tsx +126 -0
- package/src/elements/content-explorer/__tests__/ContentExplorer.test.tsx +80 -16
- package/src/elements/content-explorer/__tests__/MetadataSidePanel.test.tsx +127 -0
- package/src/elements/content-explorer/stories/tests/MetadataView-visual.stories.tsx +43 -3
- package/src/elements/content-explorer/utils.ts +58 -0
- package/src/elements/content-sidebar/BoxAISidebar.tsx +0 -1
- package/src/elements/content-sidebar/BoxAISidebarContent.tsx +1 -3
- package/src/elements/content-sidebar/__tests__/BoxAISidebar.test.tsx +0 -8
- package/src/elements/content-sidebar/stories/BoxAISidebar.stories.tsx +0 -1
- package/src/elements/content-sidebar/stories/tests/BoxAISidebar-visual.stories.tsx +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BoxAISidebar-visual.stories.js","names":["expect","within","http","HttpResponse","ContentSidebar","mockFileRequest","mockUserRequest","mockFeatures","basic","play","canvasElement","canvas","clearButton","findByRole","name","toBeInTheDocument","findByText","findByPlaceholderText","meta","title","component","args","features","fileId","global","FILE_ID","token","TOKEN","boxAISidebarProps","createSessionRequest","encodedSession","fetchTimeout","initial","getAgentConfig","getAIStudioAgents","getAnswer","getAnswerStreaming","getSuggestedQuestions","hostAppName","isAgentSelectorEnabled","isAIStudioAgentSelectorEnabled","isCitationsEnabled","isFeedbackEnabled","isDebugModeEnabled","isIntelligentQueryMode","isMarkdownEnabled","
|
|
1
|
+
{"version":3,"file":"BoxAISidebar-visual.stories.js","names":["expect","within","http","HttpResponse","ContentSidebar","mockFileRequest","mockUserRequest","mockFeatures","basic","play","canvasElement","canvas","clearButton","findByRole","name","toBeInTheDocument","findByText","findByPlaceholderText","meta","title","component","args","features","fileId","global","FILE_ID","token","TOKEN","boxAISidebarProps","createSessionRequest","encodedSession","fetchTimeout","initial","getAgentConfig","getAIStudioAgents","getAnswer","getAnswerStreaming","getSuggestedQuestions","hostAppName","isAgentSelectorEnabled","isAIStudioAgentSelectorEnabled","isCitationsEnabled","isFeedbackEnabled","isDebugModeEnabled","isIntelligentQueryMode","isMarkdownEnabled","isStopResponseEnabled","isStreamingEnabled","items","id","type","fileType","status","localizedQuestions","label","prompt","recordAction","parameters","msw","handlers","get","url","json","response"],"sources":["../../../../../src/elements/content-sidebar/stories/tests/BoxAISidebar-visual.stories.tsx"],"sourcesContent":["import { type StoryObj, type Meta } from '@storybook/react';\nimport { expect, within } from 'storybook/test';\nimport { http, HttpResponse } from 'msw';\nimport type { HttpHandler } from 'msw';\nimport ContentSidebar from '../../ContentSidebar';\nimport BoxAISidebar from '../../BoxAISidebar';\nimport { mockFileRequest, mockUserRequest } from '../../../common/__mocks__/mockRequests';\n\nconst mockFeatures = {\n 'boxai.sidebar.enabled': true,\n};\n\nexport const basic: StoryObj<typeof BoxAISidebar> = {\n play: async ({ canvasElement }) => {\n const canvas = within(canvasElement);\n const clearButton = await canvas.findByRole('button', { name: 'Clear conversation' });\n expect(clearButton).toBeInTheDocument();\n\n expect(await canvas.findByText(/Welcome to Box AI/i)).toBeInTheDocument();\n expect(await canvas.findByText('Chat cleared when you close content')).toBeInTheDocument();\n expect(await canvas.findByPlaceholderText('Ask Box AI')).toBeInTheDocument();\n expect(await canvas.findByText('Summarize this document')).toBeInTheDocument();\n expect(await canvas.findByText('What are the key takeaways?')).toBeInTheDocument();\n expect(await canvas.findByText('How can this document be improved?')).toBeInTheDocument();\n expect(await canvas.findByText('Are there any next steps defined?')).toBeInTheDocument();\n },\n};\n\nconst meta: Meta<typeof ContentSidebar> & { parameters: { msw: { handlers: HttpHandler[] } } } = {\n title: 'Elements/ContentSidebar/BoxAISidebar/tests/visual-regression-tests',\n component: ContentSidebar,\n args: {\n features: mockFeatures,\n fileId: global.FILE_ID,\n token: global.TOKEN,\n boxAISidebarProps: {\n createSessionRequest: () => ({ encodedSession: '1234' }),\n fetchTimeout: { initial: 20000 },\n getAgentConfig: () => ({}),\n getAIStudioAgents: () => ({}),\n getAnswer: () => ({}),\n getAnswerStreaming: () => ({}),\n getSuggestedQuestions: null,\n hostAppName: 'storybook-test',\n isAgentSelectorEnabled: false,\n isAIStudioAgentSelectorEnabled: true,\n isCitationsEnabled: true,\n isFeedbackEnabled: true,\n isDebugModeEnabled: true,\n isIntelligentQueryMode: false,\n isMarkdownEnabled: true,\n isStopResponseEnabled: true,\n isStreamingEnabled: false,\n items: [{ id: '123', name: 'Document (PDF).pdf', type: 'file', fileType: 'pdf', status: 'supported' }],\n localizedQuestions: [\n {\n id: 'suggested-question-1',\n label: 'Summarize this document',\n prompt: 'Summarize this document',\n },\n {\n id: 'suggested-question-2',\n label: 'What are the key takeaways?',\n prompt: 'What are the key takeaways?',\n },\n {\n id: 'suggested-question-3',\n label: 'How can this document be improved?',\n prompt: 'How can this document be improved?',\n },\n {\n id: 'suggested-question-4',\n label: 'Are there any next steps defined?',\n prompt: 'Are there any next steps defined?',\n },\n ],\n recordAction: () => ({}),\n },\n },\n parameters: {\n msw: {\n handlers: [\n http.get(mockUserRequest.url, () => {\n return HttpResponse.json(mockUserRequest.response);\n }),\n http.get(mockFileRequest.url, () => {\n return HttpResponse.json(mockFileRequest.response);\n }),\n ],\n },\n },\n};\n\nexport default meta;\n"],"mappings":"AACA,SAASA,MAAM,EAAEC,MAAM,QAAQ,gBAAgB;AAC/C,SAASC,IAAI,EAAEC,YAAY,QAAQ,KAAK;AAExC,OAAOC,cAAc,MAAM,sBAAsB;AAEjD,SAASC,eAAe,EAAEC,eAAe,QAAQ,wCAAwC;AAEzF,MAAMC,YAAY,GAAG;EACjB,uBAAuB,EAAE;AAC7B,CAAC;AAED,OAAO,MAAMC,KAAoC,GAAG;EAChDC,IAAI,EAAE,MAAAA,CAAO;IAAEC;EAAc,CAAC,KAAK;IAC/B,MAAMC,MAAM,GAAGV,MAAM,CAACS,aAAa,CAAC;IACpC,MAAME,WAAW,GAAG,MAAMD,MAAM,CAACE,UAAU,CAAC,QAAQ,EAAE;MAAEC,IAAI,EAAE;IAAqB,CAAC,CAAC;IACrFd,MAAM,CAACY,WAAW,CAAC,CAACG,iBAAiB,CAAC,CAAC;IAEvCf,MAAM,CAAC,MAAMW,MAAM,CAACK,UAAU,CAAC,oBAAoB,CAAC,CAAC,CAACD,iBAAiB,CAAC,CAAC;IACzEf,MAAM,CAAC,MAAMW,MAAM,CAACK,UAAU,CAAC,qCAAqC,CAAC,CAAC,CAACD,iBAAiB,CAAC,CAAC;IAC1Ff,MAAM,CAAC,MAAMW,MAAM,CAACM,qBAAqB,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
5
5
|
isCitationsEnabled?: boolean;
|
|
6
6
|
isMarkdownEnabled?: boolean;
|
|
7
|
-
isResetChatEnabled?: boolean;
|
|
8
7
|
onAsk?: () => void;
|
|
9
8
|
onClearConversation?: () => void;
|
|
10
9
|
onRequestClose?: () => void;
|
|
@@ -17,6 +17,7 @@ export interface SubHeaderProps {
|
|
|
17
17
|
onGridViewSliderChange?: (newSliderValue: number) => void;
|
|
18
18
|
onItemClick: (id: string | null, triggerNavigationEvent: boolean | null) => void;
|
|
19
19
|
onSortChange: (sortBy: string, sortDirection: string) => void;
|
|
20
|
+
onMetadataSidePanelToggle?: () => void;
|
|
20
21
|
onUpload: () => void;
|
|
21
22
|
onViewModeChange?: (viewMode: ViewMode) => void;
|
|
22
23
|
portalElement?: HTMLElement;
|
|
@@ -27,5 +28,5 @@ export interface SubHeaderProps {
|
|
|
27
28
|
view: View;
|
|
28
29
|
viewMode?: ViewMode;
|
|
29
30
|
}
|
|
30
|
-
declare const SubHeader: ({ canCreateNewFolder, canUpload, currentCollection, gridColumnCount, gridMaxColumns, gridMinColumns, maxGridColumnCountForWidth, onGridViewSliderChange, isSmall, onClearSelectedItemIds, onCreate, onItemClick, onSortChange, onUpload, onViewModeChange, portalElement, rootId, rootName, selectedItemIds, title, view, viewMode, }: SubHeaderProps) => React.JSX.Element;
|
|
31
|
+
declare const SubHeader: ({ canCreateNewFolder, canUpload, currentCollection, gridColumnCount, gridMaxColumns, gridMinColumns, maxGridColumnCountForWidth, onGridViewSliderChange, isSmall, onClearSelectedItemIds, onCreate, onItemClick, onSortChange, onMetadataSidePanelToggle, onUpload, onViewModeChange, portalElement, rootId, rootName, selectedItemIds, title, view, viewMode, }: SubHeaderProps) => React.JSX.Element;
|
|
31
32
|
export default SubHeader;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import type { Selection } from 'react-aria-components';
|
|
2
3
|
import type { ViewMode } from '../flowTypes';
|
|
3
4
|
import type { SortBy, SortDirection, View, Collection } from '../../../common/types/core';
|
|
4
5
|
import './SubHeaderRight.scss';
|
|
@@ -13,11 +14,13 @@ export interface SubHeaderRightProps {
|
|
|
13
14
|
onCreate: () => void;
|
|
14
15
|
onGridViewSliderChange: (newSliderValue: number) => void;
|
|
15
16
|
onSortChange: (sortBy: SortBy, sortDirection: SortDirection) => void;
|
|
17
|
+
onMetadataSidePanelToggle?: () => void;
|
|
16
18
|
onUpload: () => void;
|
|
17
19
|
onViewModeChange?: (viewMode: ViewMode) => void;
|
|
18
20
|
portalElement?: HTMLElement;
|
|
21
|
+
selectedItemIds?: Selection;
|
|
19
22
|
view: View;
|
|
20
23
|
viewMode: ViewMode;
|
|
21
24
|
}
|
|
22
|
-
declare const SubHeaderRight: ({ canCreateNewFolder, canUpload, currentCollection, gridColumnCount, gridMaxColumns, gridMinColumns, maxGridColumnCountForWidth, onCreate, onGridViewSliderChange, onSortChange, onUpload, onViewModeChange, portalElement, view, viewMode, }: SubHeaderRightProps) => React.JSX.Element;
|
|
25
|
+
declare const SubHeaderRight: ({ canCreateNewFolder, canUpload, currentCollection, gridColumnCount, gridMaxColumns, gridMinColumns, maxGridColumnCountForWidth, onCreate, onGridViewSliderChange, onSortChange, onMetadataSidePanelToggle, onUpload, onViewModeChange, portalElement, selectedItemIds, view, viewMode, }: SubHeaderRightProps) => React.JSX.Element;
|
|
23
26
|
export default SubHeaderRight;
|
|
@@ -86,6 +86,7 @@ type State = {
|
|
|
86
86
|
isCreateFolderModalOpen: boolean;
|
|
87
87
|
isDeleteModalOpen: boolean;
|
|
88
88
|
isLoading: boolean;
|
|
89
|
+
isMetadataSidePanelOpen: boolean;
|
|
89
90
|
isPreviewModalOpen: boolean;
|
|
90
91
|
isRenameModalOpen: boolean;
|
|
91
92
|
isShareModalOpen: boolean;
|
|
@@ -546,6 +547,20 @@ declare class ContentExplorer extends Component<ContentExplorerProps, State> {
|
|
|
546
547
|
updateMetadata: (item: BoxItem, field: string, oldValue?: MetadataFieldValue | null, newValue?: MetadataFieldValue | null) => void;
|
|
547
548
|
updateMetadataSuccessCallback: (item: BoxItem, field: string, newValue?: MetadataFieldValue | null) => void;
|
|
548
549
|
clearSelectedItemIds: () => void;
|
|
550
|
+
/**
|
|
551
|
+
* Toggle metadata side panel visibility
|
|
552
|
+
*
|
|
553
|
+
* @private
|
|
554
|
+
* @return {void}
|
|
555
|
+
*/
|
|
556
|
+
onMetadataSidePanelToggle: () => void;
|
|
557
|
+
/**
|
|
558
|
+
* Close metadata side panel
|
|
559
|
+
*
|
|
560
|
+
* @private
|
|
561
|
+
* @return {void}
|
|
562
|
+
*/
|
|
563
|
+
closeMetadataSidePanel: () => void;
|
|
549
564
|
/**
|
|
550
565
|
* Renders the file picker
|
|
551
566
|
*
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Selection } from 'react-aria-components';
|
|
3
|
+
import type { Collection } from '../../common/types/core';
|
|
4
|
+
import type { MetadataTemplate } from '../../common/types/metadata';
|
|
5
|
+
import './MetadataSidePanel.scss';
|
|
6
|
+
export interface MetadataSidePanelProps {
|
|
7
|
+
currentCollection: Collection;
|
|
8
|
+
onClose: () => void;
|
|
9
|
+
metadataTemplate: MetadataTemplate;
|
|
10
|
+
selectedItemIds: Selection;
|
|
11
|
+
}
|
|
12
|
+
declare const MetadataSidePanel: ({ currentCollection, onClose, selectedItemIds, metadataTemplate, }: MetadataSidePanelProps) => React.JSX.Element;
|
|
13
|
+
export default MetadataSidePanel;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -3,7 +3,9 @@ import ContentExplorer from '../../ContentExplorer';
|
|
|
3
3
|
type Story = StoryObj<typeof ContentExplorer>;
|
|
4
4
|
export declare const metadataView: Story;
|
|
5
5
|
export declare const metadataViewV2: Story;
|
|
6
|
+
export declare const metadataViewV2SortsFromHeader: Story;
|
|
6
7
|
export declare const metadataViewV2WithCustomActions: Story;
|
|
7
8
|
export declare const metadataViewV2WithInitialFilterValues: Story;
|
|
9
|
+
export declare const sidePanelOpenWithSingleItemSelected: Story;
|
|
8
10
|
declare const meta: Meta<typeof ContentExplorer>;
|
|
9
11
|
export default meta;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { MetadataTemplate } from '@box/metadata-editor';
|
|
2
|
+
import type { Selection } from 'react-aria-components';
|
|
3
|
+
import type { BoxItem, Collection } from '../../common/types/core';
|
|
4
|
+
export declare function useSelectedItemText(currentCollection: Collection, selectedItemIds: Selection): string;
|
|
5
|
+
export declare function getTemplateInstance(metadataTemplate: MetadataTemplate, selectedItems: BoxItem[]): {
|
|
6
|
+
canEdit: boolean;
|
|
7
|
+
displayName: string;
|
|
8
|
+
hidden: boolean;
|
|
9
|
+
id: string;
|
|
10
|
+
fields: {
|
|
11
|
+
displayName: string;
|
|
12
|
+
hidden: boolean;
|
|
13
|
+
id: string;
|
|
14
|
+
key: string;
|
|
15
|
+
options: import("@box/metadata-editor").MetadataTemplateFieldOption[];
|
|
16
|
+
type: import("@box/metadata-editor").MetadataTemplateFieldType;
|
|
17
|
+
value: any;
|
|
18
|
+
}[];
|
|
19
|
+
scope: string;
|
|
20
|
+
templateKey: string;
|
|
21
|
+
type: string;
|
|
22
|
+
};
|
|
@@ -28,7 +28,6 @@ export interface BoxAISidebarProps {
|
|
|
28
28
|
isFeedbackFormEnabled: boolean;
|
|
29
29
|
isIntelligentQueryMode: boolean;
|
|
30
30
|
isMarkdownEnabled: boolean;
|
|
31
|
-
isResetChatEnabled: boolean;
|
|
32
31
|
isStopResponseEnabled?: boolean;
|
|
33
32
|
isStreamingEnabled: boolean;
|
|
34
33
|
items: Array<ItemType>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "box-ui-elements",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "24.0.0-beta.1",
|
|
4
4
|
"description": "Box UI Elements",
|
|
5
5
|
"author": "Box (https://www.box.com/)",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
"@box/blueprint-web": "12.43.0",
|
|
132
132
|
"@box/blueprint-web-assets": "4.61.5",
|
|
133
133
|
"@box/box-ai-agent-selector": "^0.53.0",
|
|
134
|
-
"@box/box-ai-content-answers": "^0.
|
|
134
|
+
"@box/box-ai-content-answers": "^0.139.0",
|
|
135
135
|
"@box/box-item-type-selector": "^0.63.12",
|
|
136
136
|
"@box/cldr-data": "^34.2.0",
|
|
137
137
|
"@box/combobox-with-api": "^0.34.9",
|
package/src/constants.js
CHANGED
|
@@ -168,6 +168,19 @@ export const FIELD_CLASSIFICATION: 'classification' = 'classification';
|
|
|
168
168
|
export const FIELD_ENTERPRISE: 'enterprise' = 'enterprise';
|
|
169
169
|
export const FIELD_HOSTNAME: 'hostname' = 'hostname';
|
|
170
170
|
|
|
171
|
+
/* ----------------------- Item-Prefixed Fields for MD Query API --------------------------- */
|
|
172
|
+
const ITEM_PREFIX = 'item.';
|
|
173
|
+
export const FIELD_ITEM_TYPE = `${ITEM_PREFIX}${FIELD_TYPE}`;
|
|
174
|
+
export const FIELD_ITEM_NAME = `${ITEM_PREFIX}${FIELD_NAME}`;
|
|
175
|
+
export const FIELD_ITEM_DESCRIPTION = `${ITEM_PREFIX}${FIELD_DESCRIPTION}`;
|
|
176
|
+
export const FIELD_ITEM_EXTENSION = `${ITEM_PREFIX}${FIELD_EXTENSION}`;
|
|
177
|
+
export const FIELD_ITEM_OWNED_BY = `${ITEM_PREFIX}${FIELD_OWNED_BY}`;
|
|
178
|
+
export const FIELD_ITEM_CREATED_AT = `${ITEM_PREFIX}${FIELD_CREATED_AT}`;
|
|
179
|
+
export const FIELD_ITEM_MODIFIED_AT = `${ITEM_PREFIX}${FIELD_MODIFIED_AT}`;
|
|
180
|
+
export const FIELD_ITEM_CONTENT_CREATED_AT = `${ITEM_PREFIX}${FIELD_CONTENT_CREATED_AT}`;
|
|
181
|
+
export const FIELD_ITEM_CONTENT_MODIFIED_AT = `${ITEM_PREFIX}${FIELD_CONTENT_MODIFIED_AT}`;
|
|
182
|
+
export const FIELD_ITEM_QUICK_SEARCH_CONTENT = `${ITEM_PREFIX}quick_search_content`;
|
|
183
|
+
|
|
171
184
|
/* ----------------------- Permissions --------------------------- */
|
|
172
185
|
export const PERMISSION_CAN_COMMENT = 'can_comment';
|
|
173
186
|
export const PERMISSION_CAN_CREATE_ANNOTATIONS = 'can_create_annotations';
|
|
@@ -27,7 +27,6 @@ import messages from './messages';
|
|
|
27
27
|
export interface ExternalProps {
|
|
28
28
|
isCitationsEnabled?: boolean;
|
|
29
29
|
isMarkdownEnabled?: boolean;
|
|
30
|
-
isResetChatEnabled?: boolean;
|
|
31
30
|
onAsk?: () => void;
|
|
32
31
|
onClearConversation?: () => void;
|
|
33
32
|
onRequestClose?: () => void;
|
|
@@ -50,7 +49,6 @@ const ContentAnswersModal = ({
|
|
|
50
49
|
suggestedQuestions,
|
|
51
50
|
isCitationsEnabled = true,
|
|
52
51
|
isMarkdownEnabled = true,
|
|
53
|
-
isResetChatEnabled = true,
|
|
54
52
|
}: ContentAnswersModalProps) => {
|
|
55
53
|
const { formatMessage } = useIntl();
|
|
56
54
|
const [isLoading, setIsLoading] = useState<boolean>(false);
|
|
@@ -176,7 +174,6 @@ const ContentAnswersModal = ({
|
|
|
176
174
|
hasRequestInProgress={isLoading}
|
|
177
175
|
isCitationsEnabled={isCitationsEnabled}
|
|
178
176
|
isMarkdownEnabled={isMarkdownEnabled}
|
|
179
|
-
isResetChatEnabled={isResetChatEnabled}
|
|
180
177
|
onClearAction={handleClearConversation}
|
|
181
178
|
onOpenChange={handleOnRequestClose}
|
|
182
179
|
open={isOpen}
|
|
@@ -16,7 +16,12 @@ import {
|
|
|
16
16
|
import APIContext from '../../api-context';
|
|
17
17
|
|
|
18
18
|
describe('elements/common/content-answers/ContentAnswersModal', () => {
|
|
19
|
-
const mockQuestion = {
|
|
19
|
+
const mockQuestion = {
|
|
20
|
+
isCompleted: false,
|
|
21
|
+
isLoading: true,
|
|
22
|
+
prompt: 'summarize another question',
|
|
23
|
+
promptType: 'user_input',
|
|
24
|
+
};
|
|
20
25
|
const renderComponent = (api = mockApi, props?: {}) => {
|
|
21
26
|
render(
|
|
22
27
|
<Notification.Provider>
|
|
@@ -137,7 +142,7 @@ describe('elements/common/content-answers/ContentAnswersModal', () => {
|
|
|
137
142
|
await userEvent.click(submitButton);
|
|
138
143
|
|
|
139
144
|
expect(mockApi.getIntelligenceAPI().ask).lastCalledWith(
|
|
140
|
-
{ isCompleted: false, isLoading: true, prompt: 'Another question?' },
|
|
145
|
+
{ isCompleted: false, isLoading: true, prompt: 'Another question?', promptType: 'user_input' },
|
|
141
146
|
[{ id: mockFile.id, type: 'file' }],
|
|
142
147
|
[{ answer: 'summarize answer', created_at: '', prompt: 'summarize another question' }],
|
|
143
148
|
{
|
|
@@ -28,6 +28,7 @@ export interface SubHeaderProps {
|
|
|
28
28
|
onGridViewSliderChange?: (newSliderValue: number) => void;
|
|
29
29
|
onItemClick: (id: string | null, triggerNavigationEvent: boolean | null) => void;
|
|
30
30
|
onSortChange: (sortBy: string, sortDirection: string) => void;
|
|
31
|
+
onMetadataSidePanelToggle?: () => void;
|
|
31
32
|
onUpload: () => void;
|
|
32
33
|
onViewModeChange?: (viewMode: ViewMode) => void;
|
|
33
34
|
portalElement?: HTMLElement;
|
|
@@ -53,6 +54,7 @@ const SubHeader = ({
|
|
|
53
54
|
onCreate,
|
|
54
55
|
onItemClick,
|
|
55
56
|
onSortChange,
|
|
57
|
+
onMetadataSidePanelToggle,
|
|
56
58
|
onUpload,
|
|
57
59
|
onViewModeChange,
|
|
58
60
|
portalElement,
|
|
@@ -109,9 +111,11 @@ const SubHeader = ({
|
|
|
109
111
|
onCreate={onCreate}
|
|
110
112
|
onGridViewSliderChange={onGridViewSliderChange}
|
|
111
113
|
onSortChange={onSortChange}
|
|
114
|
+
onMetadataSidePanelToggle={onMetadataSidePanelToggle}
|
|
112
115
|
onUpload={onUpload}
|
|
113
116
|
onViewModeChange={onViewModeChange}
|
|
114
117
|
portalElement={portalElement}
|
|
118
|
+
selectedItemIds={selectedItemIds}
|
|
115
119
|
view={view}
|
|
116
120
|
viewMode={viewMode}
|
|
117
121
|
/>
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
3
|
import { XMark } from '@box/blueprint-web-assets/icons/Fill/index';
|
|
4
4
|
import { IconButton, PageHeader, Text } from '@box/blueprint-web';
|
|
5
5
|
import type { Selection } from 'react-aria-components';
|
|
6
|
+
import { useSelectedItemText } from '../../content-explorer/utils';
|
|
6
7
|
import type { Collection } from '../../../common/types/core';
|
|
7
8
|
import messages from '../messages';
|
|
8
9
|
|
|
@@ -20,27 +21,7 @@ const SubHeaderLeftV2 = (props: SubHeaderLeftV2Props) => {
|
|
|
20
21
|
const { currentCollection, onClearSelectedItemIds, rootName, selectedItemIds, title } = props;
|
|
21
22
|
const { formatMessage } = useIntl();
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
const selectedItemText: string = useMemo(() => {
|
|
25
|
-
const selectedCount = selectedItemIds === 'all' ? currentCollection.items.length : selectedItemIds.size;
|
|
26
|
-
|
|
27
|
-
if (selectedCount === 0) {
|
|
28
|
-
return '';
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// Case 1: Single selected item - show item name
|
|
32
|
-
if (selectedCount === 1) {
|
|
33
|
-
const selectedKey =
|
|
34
|
-
selectedItemIds === 'all' ? currentCollection.items[0].id : selectedItemIds.values().next().value;
|
|
35
|
-
const selectedItem = currentCollection.items.find(item => item.id === selectedKey);
|
|
36
|
-
return selectedItem?.name ?? '';
|
|
37
|
-
}
|
|
38
|
-
// Case 2: Multiple selected items - show count
|
|
39
|
-
if (selectedCount > 1) {
|
|
40
|
-
return formatMessage(messages.numFilesSelected, { numSelected: selectedCount });
|
|
41
|
-
}
|
|
42
|
-
return '';
|
|
43
|
-
}, [currentCollection.items, formatMessage, selectedItemIds]);
|
|
24
|
+
const selectedItemText = useSelectedItemText(currentCollection, selectedItemIds);
|
|
44
25
|
|
|
45
26
|
// Case 1 and 2: selected item text with X button
|
|
46
27
|
if (selectedItemText) {
|
|
@@ -2,6 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { Button } from '@box/blueprint-web';
|
|
3
3
|
import { Pencil } from '@box/blueprint-web-assets/icons/Fill';
|
|
4
4
|
import { useIntl } from 'react-intl';
|
|
5
|
+
import type { Selection } from 'react-aria-components';
|
|
5
6
|
import Sort from './Sort';
|
|
6
7
|
import Add from './Add';
|
|
7
8
|
import GridViewSlider from '../../../components/grid-view/GridViewSlider';
|
|
@@ -27,9 +28,11 @@ export interface SubHeaderRightProps {
|
|
|
27
28
|
onCreate: () => void;
|
|
28
29
|
onGridViewSliderChange: (newSliderValue: number) => void;
|
|
29
30
|
onSortChange: (sortBy: SortBy, sortDirection: SortDirection) => void;
|
|
31
|
+
onMetadataSidePanelToggle?: () => void;
|
|
30
32
|
onUpload: () => void;
|
|
31
33
|
onViewModeChange?: (viewMode: ViewMode) => void;
|
|
32
34
|
portalElement?: HTMLElement;
|
|
35
|
+
selectedItemIds?: Selection;
|
|
33
36
|
view: View;
|
|
34
37
|
viewMode: ViewMode;
|
|
35
38
|
}
|
|
@@ -45,9 +48,11 @@ const SubHeaderRight = ({
|
|
|
45
48
|
onCreate,
|
|
46
49
|
onGridViewSliderChange,
|
|
47
50
|
onSortChange,
|
|
51
|
+
onMetadataSidePanelToggle,
|
|
48
52
|
onUpload,
|
|
49
53
|
onViewModeChange,
|
|
50
54
|
portalElement,
|
|
55
|
+
selectedItemIds,
|
|
51
56
|
view,
|
|
52
57
|
viewMode,
|
|
53
58
|
}: SubHeaderRightProps) => {
|
|
@@ -60,6 +65,7 @@ const SubHeaderRight = ({
|
|
|
60
65
|
const showSort: boolean = isFolder && hasItems;
|
|
61
66
|
const showAdd: boolean = (!!canUpload || !!canCreateNewFolder) && isFolder;
|
|
62
67
|
const isMetadataView: boolean = view === VIEW_METADATA;
|
|
68
|
+
const hasSelectedItems: boolean = !!(selectedItemIds && (selectedItemIds === 'all' || selectedItemIds.size > 0));
|
|
63
69
|
return (
|
|
64
70
|
<div className="be-sub-header-right">
|
|
65
71
|
{!isMetadataView && (
|
|
@@ -90,8 +96,8 @@ const SubHeaderRight = ({
|
|
|
90
96
|
</>
|
|
91
97
|
)}
|
|
92
98
|
|
|
93
|
-
{isMetadataView && isMetadataViewV2Feature && (
|
|
94
|
-
<Button icon={Pencil} size="large" variant="primary">
|
|
99
|
+
{isMetadataView && isMetadataViewV2Feature && hasSelectedItems && (
|
|
100
|
+
<Button icon={Pencil} size="large" variant="primary" onClick={onMetadataSidePanelToggle}>
|
|
95
101
|
{formatMessage(messages.metadata)}
|
|
96
102
|
</Button>
|
|
97
103
|
)}
|
|
@@ -7,5 +7,17 @@
|
|
|
7
7
|
.bcpr {
|
|
8
8
|
z-index: 1; // Prevents overlay issues with list-item when a file is previewed
|
|
9
9
|
}
|
|
10
|
+
|
|
11
|
+
.be-app-element {
|
|
12
|
+
flex-direction: row;
|
|
13
|
+
gap: var(--space-4);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.bce-ContentExplorer-main {
|
|
17
|
+
display: flex;
|
|
18
|
+
flex: 1;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
min-width: 0;
|
|
21
|
+
}
|
|
10
22
|
}
|
|
11
23
|
}
|