box-ui-elements 23.3.0-beta.7 → 23.3.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/dist/explorer.css +1 -1
- package/dist/explorer.js +1 -1
- package/dist/openwith.js +1 -1
- package/dist/picker.css +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/dist/uploader.css +1 -1
- package/dist/uploader.js +1 -1
- package/es/components/flyout/Flyout.js +3 -2
- package/es/components/flyout/Flyout.js.flow +3 -2
- package/es/components/flyout/Flyout.js.map +1 -1
- package/es/elements/content-explorer/stories/tests/MetadataView-visual.stories.js +2 -1
- package/es/elements/content-explorer/stories/tests/MetadataView-visual.stories.js.map +1 -1
- package/es/elements/content-sidebar/MetadataInstanceEditor.js.map +1 -1
- package/es/elements/content-sidebar/SidebarNav.js +2 -0
- package/es/elements/content-sidebar/SidebarNav.js.flow +2 -0
- package/es/elements/content-sidebar/SidebarNav.js.map +1 -1
- package/es/elements/content-sidebar/stories/MetadataSidebarRedesign.stories.js +2 -1
- package/es/elements/content-sidebar/stories/MetadataSidebarRedesign.stories.js.map +1 -1
- package/es/elements/content-sidebar/stories/tests/BoxAISidebar-visual.stories.js +2 -1
- package/es/elements/content-sidebar/stories/tests/BoxAISidebar-visual.stories.js.map +1 -1
- package/es/elements/content-sidebar/stories/tests/ContentSidebar-e2e.stories.js +2 -1
- package/es/elements/content-sidebar/stories/tests/ContentSidebar-e2e.stories.js.map +1 -1
- package/es/elements/content-sidebar/stories/tests/MetadataSidebarRedesign-visual.stories.js +2 -1
- package/es/elements/content-sidebar/stories/tests/MetadataSidebarRedesign-visual.stories.js.map +1 -1
- package/es/elements/content-uploader/IconInProgress.js +3 -2
- package/es/elements/content-uploader/IconInProgress.js.map +1 -1
- package/es/elements/content-uploader/ItemAction.js +4 -4
- package/es/elements/content-uploader/ItemAction.js.map +1 -1
- package/es/features/metadata-instance-editor/CascadePolicy.js +1 -0
- package/es/features/metadata-instance-editor/CascadePolicy.js.flow +1 -0
- package/es/features/metadata-instance-editor/CascadePolicy.js.map +1 -1
- package/es/icons/file-icon/FileIcon.js.map +1 -1
- package/es/src/elements/content-explorer/stories/tests/MetadataView-visual.stories.d.ts +7 -58
- package/es/src/elements/content-sidebar/MetadataInstanceEditor.d.ts +1 -1
- package/es/src/elements/content-sidebar/stories/MetadataSidebarRedesign.stories.d.ts +6 -22
- package/es/src/elements/content-sidebar/stories/__mocks__/TaxonomyMocks.d.ts +2 -1
- package/es/src/elements/content-sidebar/stories/tests/BoxAISidebar-visual.stories.d.ts +6 -50
- package/es/src/elements/content-sidebar/stories/tests/ContentSidebar-e2e.stories.d.ts +6 -21
- package/es/src/elements/content-sidebar/stories/tests/MetadataSidebarRedesign-visual.stories.d.ts +6 -25
- package/es/src/elements/content-uploader/IconInProgress.d.ts +2 -2
- package/package.json +5 -5
- package/src/components/flyout/Flyout.js +3 -2
- package/src/components/flyout/__tests__/Flyout.test.js +31 -20
- package/src/elements/content-explorer/stories/tests/MetadataView-visual.stories.tsx +8 -3
- package/src/elements/content-sidebar/MetadataInstanceEditor.tsx +1 -1
- package/src/elements/content-sidebar/SidebarNav.js +2 -0
- package/src/elements/content-sidebar/additional-tabs/__tests__/__snapshots__/AdditionalTab.test.js.snap +1 -1
- package/src/elements/content-sidebar/stories/MetadataSidebarRedesign.stories.tsx +5 -2
- package/src/elements/content-sidebar/stories/__mocks__/TaxonomyMocks.ts +2 -1
- package/src/elements/content-sidebar/stories/tests/BoxAISidebar-visual.stories.tsx +5 -2
- package/src/elements/content-sidebar/stories/tests/ContentSidebar-e2e.stories.tsx +5 -1
- package/src/elements/content-sidebar/stories/tests/MetadataSidebarRedesign-visual.stories.tsx +5 -2
- package/src/elements/content-uploader/IconInProgress.tsx +13 -9
- package/src/elements/content-uploader/ItemAction.tsx +9 -6
- package/src/features/metadata-instance-editor/CascadePolicy.js +1 -0
- package/src/icons/file-icon/FileIcon.tsx +4 -1
|
@@ -1,58 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
fieldsToShow: ({
|
|
9
|
-
key: string;
|
|
10
|
-
canEdit: boolean;
|
|
11
|
-
displayName: string;
|
|
12
|
-
} | {
|
|
13
|
-
key: string;
|
|
14
|
-
canEdit: boolean;
|
|
15
|
-
displayName?: undefined;
|
|
16
|
-
})[];
|
|
17
|
-
defaultView: string;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
export declare const withNewMetadataView: {
|
|
21
|
-
args: {
|
|
22
|
-
metadataQuery: {
|
|
23
|
-
from: string;
|
|
24
|
-
ancestor_folder_id: string;
|
|
25
|
-
fields: string[];
|
|
26
|
-
};
|
|
27
|
-
fieldsToShow: ({
|
|
28
|
-
key: string;
|
|
29
|
-
canEdit: boolean;
|
|
30
|
-
displayName: string;
|
|
31
|
-
} | {
|
|
32
|
-
key: string;
|
|
33
|
-
canEdit: boolean;
|
|
34
|
-
displayName?: undefined;
|
|
35
|
-
})[];
|
|
36
|
-
defaultView: string;
|
|
37
|
-
features: {
|
|
38
|
-
contentExplorer: {
|
|
39
|
-
metadataViewV2: boolean;
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
declare const _default: {
|
|
45
|
-
title: string;
|
|
46
|
-
component: any;
|
|
47
|
-
args: {
|
|
48
|
-
features: Record<string, boolean>;
|
|
49
|
-
rootFolderId: string;
|
|
50
|
-
token: string;
|
|
51
|
-
};
|
|
52
|
-
parameters: {
|
|
53
|
-
msw: {
|
|
54
|
-
handlers: import("msw/lib/core/handlers/HttpHandler").HttpHandler[];
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
export default _default;
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import ContentExplorer from '../../ContentExplorer';
|
|
3
|
+
type Story = StoryObj<typeof ContentExplorer>;
|
|
4
|
+
export declare const metadataView: Story;
|
|
5
|
+
export declare const withNewMetadataView: Story;
|
|
6
|
+
declare const meta: Meta<typeof ContentExplorer>;
|
|
7
|
+
export default meta;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type FormValues, type JSONPatchOperations, type MetadataTemplateInstance } from '@box/metadata-editor';
|
|
2
|
-
import {
|
|
2
|
+
import { TaxonomyOptionsFetcher } from '@box/metadata-editor/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/types.js';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { ERROR_CODE_METADATA_AUTOFILL_TIMEOUT, ERROR_CODE_UNKNOWN, ERROR_CODE_METADATA_PRECONDITION_FAILED } from '../../constants';
|
|
5
5
|
export interface MetadataInstanceEditorProps {
|
|
@@ -1,29 +1,13 @@
|
|
|
1
|
-
import { type StoryObj } from '@storybook/react';
|
|
2
|
-
import
|
|
1
|
+
import { type StoryObj, Meta } from '@storybook/react';
|
|
2
|
+
import type { HttpHandler } from 'msw';
|
|
3
3
|
import MetadataSidebarRedesign from '../MetadataSidebarRedesign';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
component: any;
|
|
7
|
-
args: {
|
|
8
|
-
fileId: string;
|
|
9
|
-
features: {
|
|
10
|
-
'metadata.redesign.enabled': boolean;
|
|
11
|
-
};
|
|
12
|
-
logger: {
|
|
13
|
-
onReadyMetric: ({ endMarkName }: {
|
|
14
|
-
endMarkName: any;
|
|
15
|
-
}) => void;
|
|
16
|
-
};
|
|
17
|
-
hasMetadata: boolean;
|
|
18
|
-
token: string;
|
|
19
|
-
metadataSidebarProps: any;
|
|
20
|
-
};
|
|
4
|
+
import ContentSidebar from '../ContentSidebar';
|
|
5
|
+
declare const meta: Meta<typeof ContentSidebar> & {
|
|
21
6
|
parameters: {
|
|
22
7
|
msw: {
|
|
23
|
-
handlers:
|
|
8
|
+
handlers: HttpHandler[];
|
|
24
9
|
};
|
|
25
10
|
};
|
|
26
|
-
render: (args: any) => React.JSX.Element;
|
|
27
11
|
};
|
|
28
|
-
export default
|
|
12
|
+
export default meta;
|
|
29
13
|
export declare const Basic: StoryObj<typeof MetadataSidebarRedesign>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { HttpHandler } from 'msw';
|
|
1
2
|
export declare const multilevelTaxonomyLevels: ({
|
|
2
3
|
display_name: string;
|
|
3
4
|
description: string;
|
|
@@ -287,4 +288,4 @@ export declare const mockSinglelevelTaxonomyNodes: {
|
|
|
287
288
|
node_path: any[];
|
|
288
289
|
};
|
|
289
290
|
};
|
|
290
|
-
export declare const taxonomyMockHandlers:
|
|
291
|
+
export declare const taxonomyMockHandlers: HttpHandler[];
|
|
@@ -1,57 +1,13 @@
|
|
|
1
|
-
import { type StoryObj } from '@storybook/react';
|
|
1
|
+
import { type StoryObj, type Meta } from '@storybook/react';
|
|
2
|
+
import type { HttpHandler } from 'msw';
|
|
3
|
+
import ContentSidebar from '../../ContentSidebar';
|
|
2
4
|
import BoxAISidebar from '../../BoxAISidebar';
|
|
3
5
|
export declare const basic: StoryObj<typeof BoxAISidebar>;
|
|
4
|
-
declare const
|
|
5
|
-
title: string;
|
|
6
|
-
component: any;
|
|
7
|
-
args: {
|
|
8
|
-
features: {
|
|
9
|
-
'boxai.sidebar.enabled': boolean;
|
|
10
|
-
};
|
|
11
|
-
fileId: string;
|
|
12
|
-
token: string;
|
|
13
|
-
boxAISidebarProps: {
|
|
14
|
-
createSessionRequest: () => {
|
|
15
|
-
encodedSession: string;
|
|
16
|
-
};
|
|
17
|
-
fetchTimeout: {
|
|
18
|
-
initial: number;
|
|
19
|
-
};
|
|
20
|
-
getAgentConfig: () => {};
|
|
21
|
-
getAIStudioAgents: () => {};
|
|
22
|
-
getAnswer: () => {};
|
|
23
|
-
getAnswerStreaming: () => {};
|
|
24
|
-
getSuggestedQuestions: any;
|
|
25
|
-
hostAppName: string;
|
|
26
|
-
isAgentSelectorEnabled: boolean;
|
|
27
|
-
isAIStudioAgentSelectorEnabled: boolean;
|
|
28
|
-
isCitationsEnabled: boolean;
|
|
29
|
-
isFeedbackEnabled: boolean;
|
|
30
|
-
isDebugModeEnabled: boolean;
|
|
31
|
-
isIntelligentQueryMode: boolean;
|
|
32
|
-
isMarkdownEnabled: boolean;
|
|
33
|
-
isResetChatEnabled: boolean;
|
|
34
|
-
isStopResponseEnabled: boolean;
|
|
35
|
-
isStreamingEnabled: boolean;
|
|
36
|
-
items: {
|
|
37
|
-
id: string;
|
|
38
|
-
name: string;
|
|
39
|
-
type: string;
|
|
40
|
-
fileType: string;
|
|
41
|
-
status: string;
|
|
42
|
-
}[];
|
|
43
|
-
localizedQuestions: {
|
|
44
|
-
id: string;
|
|
45
|
-
label: string;
|
|
46
|
-
prompt: string;
|
|
47
|
-
}[];
|
|
48
|
-
recordAction: () => {};
|
|
49
|
-
};
|
|
50
|
-
};
|
|
6
|
+
declare const meta: Meta<typeof ContentSidebar> & {
|
|
51
7
|
parameters: {
|
|
52
8
|
msw: {
|
|
53
|
-
handlers:
|
|
9
|
+
handlers: HttpHandler[];
|
|
54
10
|
};
|
|
55
11
|
};
|
|
56
12
|
};
|
|
57
|
-
export default
|
|
13
|
+
export default meta;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import type { HttpHandler } from 'msw';
|
|
2
|
+
import type { Meta } from '@storybook/react';
|
|
3
|
+
import ContentSidebar from '../../ContentSidebar';
|
|
1
4
|
export declare const basic: {
|
|
2
5
|
args: {
|
|
3
6
|
fileId: any;
|
|
@@ -8,29 +11,11 @@ export declare const fileVersion: {
|
|
|
8
11
|
fileId: any;
|
|
9
12
|
};
|
|
10
13
|
};
|
|
11
|
-
declare const
|
|
12
|
-
title: string;
|
|
13
|
-
component: any;
|
|
14
|
-
args: {
|
|
15
|
-
detailsSidebarProps: {
|
|
16
|
-
hasAccessStats: boolean;
|
|
17
|
-
hasClassification: boolean;
|
|
18
|
-
hasNotices: boolean;
|
|
19
|
-
hasProperties: boolean;
|
|
20
|
-
hasRetentionPolicy: boolean;
|
|
21
|
-
};
|
|
22
|
-
features: Record<string, boolean>;
|
|
23
|
-
fileId: string;
|
|
24
|
-
hasActivityFeed: boolean;
|
|
25
|
-
hasMetadata: boolean;
|
|
26
|
-
hasSkills: boolean;
|
|
27
|
-
hasVersions: boolean;
|
|
28
|
-
token: string;
|
|
29
|
-
};
|
|
14
|
+
declare const meta: Meta<typeof ContentSidebar> & {
|
|
30
15
|
parameters: {
|
|
31
16
|
msw: {
|
|
32
|
-
handlers:
|
|
17
|
+
handlers: HttpHandler[];
|
|
33
18
|
};
|
|
34
19
|
};
|
|
35
20
|
};
|
|
36
|
-
export default
|
|
21
|
+
export default meta;
|
package/es/src/elements/content-sidebar/stories/tests/MetadataSidebarRedesign-visual.stories.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { type StoryObj } from '@storybook/react';
|
|
1
|
+
import { type StoryObj, Meta } from '@storybook/react';
|
|
2
|
+
import type { HttpHandler } from 'msw';
|
|
3
|
+
import ContentSidebar from '../../ContentSidebar';
|
|
2
4
|
import MetadataSidebarRedesign from '../../MetadataSidebarRedesign';
|
|
3
5
|
export declare const AddTemplateDropdownMenuOn: {
|
|
4
6
|
play: ({ canvasElement }: {
|
|
@@ -45,32 +47,11 @@ export declare const ViewMultilevelTaxonomy: StoryObj<typeof MetadataSidebarRede
|
|
|
45
47
|
export declare const ViewSinglelevelTaxonomy: StoryObj<typeof MetadataSidebarRedesign>;
|
|
46
48
|
export declare const EditMultilevelTaxonomy: StoryObj<typeof MetadataSidebarRedesign>;
|
|
47
49
|
export declare const EditSinglelevelTaxonomy: StoryObj<typeof MetadataSidebarRedesign>;
|
|
48
|
-
declare const
|
|
49
|
-
title: string;
|
|
50
|
-
component: any;
|
|
51
|
-
args: {
|
|
52
|
-
token: string;
|
|
53
|
-
metadataSidebarProps: {
|
|
54
|
-
fileId: string;
|
|
55
|
-
isFeatureEnabled: boolean;
|
|
56
|
-
onError: import("@vitest/spy").Mock<any, any>;
|
|
57
|
-
onSuccess: import("@vitest/spy").Mock<any, any>;
|
|
58
|
-
};
|
|
59
|
-
hasMetadata: boolean;
|
|
60
|
-
features: {
|
|
61
|
-
'metadata.redesign.enabled': boolean;
|
|
62
|
-
};
|
|
63
|
-
fileId: string;
|
|
64
|
-
logger: {
|
|
65
|
-
onReadyMetric: ({ endMarkName }: {
|
|
66
|
-
endMarkName: any;
|
|
67
|
-
}) => void;
|
|
68
|
-
};
|
|
69
|
-
};
|
|
50
|
+
declare const meta: Meta<typeof ContentSidebar> & {
|
|
70
51
|
parameters: {
|
|
71
52
|
msw: {
|
|
72
|
-
handlers:
|
|
53
|
+
handlers: HttpHandler[];
|
|
73
54
|
};
|
|
74
55
|
};
|
|
75
56
|
};
|
|
76
|
-
export default
|
|
57
|
+
export default meta;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
declare const IconInProgress:
|
|
1
|
+
import type { ForwardRefExoticComponent, RefAttributes, SVGProps } from 'react';
|
|
2
|
+
declare const IconInProgress: ForwardRefExoticComponent<SVGProps<SVGSVGElement> & RefAttributes<SVGSVGElement>>;
|
|
3
3
|
export default IconInProgress;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "box-ui-elements",
|
|
3
|
-
"version": "23.3.0
|
|
3
|
+
"version": "23.3.0",
|
|
4
4
|
"description": "Box UI Elements",
|
|
5
5
|
"author": "Box (https://www.box.com/)",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -129,8 +129,8 @@
|
|
|
129
129
|
"@babel/preset-typescript": "^7.24.7",
|
|
130
130
|
"@babel/template": "^7.24.7",
|
|
131
131
|
"@babel/types": "^7.24.7",
|
|
132
|
-
"@box/blueprint-web": "^
|
|
133
|
-
"@box/blueprint-web-assets": "4.
|
|
132
|
+
"@box/blueprint-web": "^11.12.0",
|
|
133
|
+
"@box/blueprint-web-assets": "^4.44.1",
|
|
134
134
|
"@box/box-ai-agent-selector": "^0.31.0",
|
|
135
135
|
"@box/box-ai-content-answers": "^0.124.1",
|
|
136
136
|
"@box/cldr-data": "^34.2.0",
|
|
@@ -303,8 +303,8 @@
|
|
|
303
303
|
"worker-farm": "^1.7.0"
|
|
304
304
|
},
|
|
305
305
|
"peerDependencies": {
|
|
306
|
-
"@box/blueprint-web": "^
|
|
307
|
-
"@box/blueprint-web-assets": "^4.
|
|
306
|
+
"@box/blueprint-web": "^11.12.0",
|
|
307
|
+
"@box/blueprint-web-assets": "^4.44.1",
|
|
308
308
|
"@box/box-ai-agent-selector": "^0.31.0",
|
|
309
309
|
"@box/box-ai-content-answers": "^0.124.1",
|
|
310
310
|
"@box/cldr-data": ">=34.2.0",
|
|
@@ -305,8 +305,9 @@ class Flyout extends React.Component<Props, State> {
|
|
|
305
305
|
}
|
|
306
306
|
};
|
|
307
307
|
|
|
308
|
-
handleKeyPress = () => {
|
|
309
|
-
if (KEYS.enter) {
|
|
308
|
+
handleKeyPress = (event: SyntheticKeyboardEvent<>) => {
|
|
309
|
+
if (event.key === KEYS.enter) {
|
|
310
|
+
event.preventDefault();
|
|
310
311
|
this.openOverlay();
|
|
311
312
|
this.focusButton();
|
|
312
313
|
}
|
|
@@ -336,10 +336,7 @@ describe('components/flyout/Flyout', () => {
|
|
|
336
336
|
if (shouldCloseOverlay) {
|
|
337
337
|
sandbox.mock(instance).expects('handleOverlayClose');
|
|
338
338
|
} else {
|
|
339
|
-
sandbox
|
|
340
|
-
.mock(instance)
|
|
341
|
-
.expects('handleOverlayClose')
|
|
342
|
-
.never();
|
|
339
|
+
sandbox.mock(instance).expects('handleOverlayClose').never();
|
|
343
340
|
}
|
|
344
341
|
act(() => {
|
|
345
342
|
instance.handleOverlayClick(event);
|
|
@@ -432,10 +429,7 @@ describe('components/flyout/Flyout', () => {
|
|
|
432
429
|
|
|
433
430
|
const instance = wrapper.instance();
|
|
434
431
|
setTimeout(() => {
|
|
435
|
-
sandbox
|
|
436
|
-
.mock(instance)
|
|
437
|
-
.expects('openOverlay')
|
|
438
|
-
.never();
|
|
432
|
+
sandbox.mock(instance).expects('openOverlay').never();
|
|
439
433
|
}, 310); // default timeout is 300ms
|
|
440
434
|
|
|
441
435
|
instance.handleButtonHover(event);
|
|
@@ -452,10 +446,7 @@ describe('components/flyout/Flyout', () => {
|
|
|
452
446
|
|
|
453
447
|
const instance = wrapper.instance();
|
|
454
448
|
setTimeout(() => {
|
|
455
|
-
sandbox
|
|
456
|
-
.mock(instance)
|
|
457
|
-
.expects('openOverlay')
|
|
458
|
-
.never();
|
|
449
|
+
sandbox.mock(instance).expects('openOverlay').never();
|
|
459
450
|
}, timeout - 10);
|
|
460
451
|
|
|
461
452
|
setTimeout(() => {
|
|
@@ -485,6 +476,32 @@ describe('components/flyout/Flyout', () => {
|
|
|
485
476
|
});
|
|
486
477
|
});
|
|
487
478
|
|
|
479
|
+
describe('handleKeyPress()', () => {
|
|
480
|
+
test('should call openOverlay() and focusButton() when enter key is pressed', () => {
|
|
481
|
+
const wrapper = shallow(
|
|
482
|
+
<Flyout>
|
|
483
|
+
<FakeButton />
|
|
484
|
+
<FakeOverlay />
|
|
485
|
+
</Flyout>,
|
|
486
|
+
);
|
|
487
|
+
|
|
488
|
+
const instance = wrapper.instance();
|
|
489
|
+
const openOverlaySpy = sandbox.spy(instance, 'openOverlay');
|
|
490
|
+
const focusButtonSpy = sandbox.spy(instance, 'focusButton');
|
|
491
|
+
|
|
492
|
+
const event = {
|
|
493
|
+
key: 'Enter',
|
|
494
|
+
preventDefault: sandbox.spy(),
|
|
495
|
+
};
|
|
496
|
+
|
|
497
|
+
instance.handleKeyPress(event);
|
|
498
|
+
|
|
499
|
+
expect(openOverlaySpy.calledOnce).toBe(true);
|
|
500
|
+
expect(focusButtonSpy.calledOnce).toBe(true);
|
|
501
|
+
expect(event.preventDefault.calledOnce).toBe(true);
|
|
502
|
+
});
|
|
503
|
+
});
|
|
504
|
+
|
|
488
505
|
describe('closeOverlay()', () => {
|
|
489
506
|
[
|
|
490
507
|
{
|
|
@@ -803,10 +820,7 @@ describe('components/flyout/Flyout', () => {
|
|
|
803
820
|
if (shouldCallCloseOverlay) {
|
|
804
821
|
sandbox.mock(instance).expects('closeOverlay');
|
|
805
822
|
} else {
|
|
806
|
-
sandbox
|
|
807
|
-
.mock(instance)
|
|
808
|
-
.expects('closeOverlay')
|
|
809
|
-
.never();
|
|
823
|
+
sandbox.mock(instance).expects('closeOverlay').never();
|
|
810
824
|
}
|
|
811
825
|
|
|
812
826
|
if (isInsideToggleButton) {
|
|
@@ -833,10 +847,7 @@ describe('components/flyout/Flyout', () => {
|
|
|
833
847
|
const el = document.createElement('div');
|
|
834
848
|
el.innerHTML = '<div class="class"><div class="target"></div></div>';
|
|
835
849
|
|
|
836
|
-
sandbox
|
|
837
|
-
.mock(instance)
|
|
838
|
-
.expects('closeOverlay')
|
|
839
|
-
.never();
|
|
850
|
+
sandbox.mock(instance).expects('closeOverlay').never();
|
|
840
851
|
|
|
841
852
|
instance.handleDocumentClickOrWindowBlur({
|
|
842
853
|
target: el.querySelector('.target'),
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { http, HttpResponse } from 'msw';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
3
|
import ContentExplorer from '../../ContentExplorer';
|
|
3
4
|
import { DEFAULT_HOSTNAME_API } from '../../../../constants';
|
|
4
5
|
import { mockMetadata, mockSchema } from '../../../common/__mocks__/mockMetadata';
|
|
@@ -34,7 +35,9 @@ const fieldsToShow = [
|
|
|
34
35
|
];
|
|
35
36
|
const defaultView = 'metadata'; // Required prop to paint the metadata view. If not provided, you'll get regular folder view.
|
|
36
37
|
|
|
37
|
-
|
|
38
|
+
type Story = StoryObj<typeof ContentExplorer>;
|
|
39
|
+
|
|
40
|
+
export const metadataView: Story = {
|
|
38
41
|
args: {
|
|
39
42
|
metadataQuery,
|
|
40
43
|
fieldsToShow,
|
|
@@ -42,7 +45,7 @@ export const metadataView = {
|
|
|
42
45
|
},
|
|
43
46
|
};
|
|
44
47
|
|
|
45
|
-
export const withNewMetadataView = {
|
|
48
|
+
export const withNewMetadataView: Story = {
|
|
46
49
|
args: {
|
|
47
50
|
metadataQuery,
|
|
48
51
|
fieldsToShow,
|
|
@@ -55,7 +58,7 @@ export const withNewMetadataView = {
|
|
|
55
58
|
},
|
|
56
59
|
};
|
|
57
60
|
|
|
58
|
-
|
|
61
|
+
const meta: Meta<typeof ContentExplorer> = {
|
|
59
62
|
title: 'Elements/ContentExplorer/tests/ContentExplorer/visual/MetadataView',
|
|
60
63
|
component: ContentExplorer,
|
|
61
64
|
args: {
|
|
@@ -76,3 +79,5 @@ export default {
|
|
|
76
79
|
},
|
|
77
80
|
},
|
|
78
81
|
};
|
|
82
|
+
|
|
83
|
+
export default meta;
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
type JSONPatchOperations,
|
|
5
5
|
type MetadataTemplateInstance,
|
|
6
6
|
} from '@box/metadata-editor';
|
|
7
|
-
import {
|
|
7
|
+
import { TaxonomyOptionsFetcher } from '@box/metadata-editor/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/types.js';
|
|
8
8
|
import React from 'react';
|
|
9
9
|
import {
|
|
10
10
|
ERROR_CODE_METADATA_AUTOFILL_TIMEOUT,
|
|
@@ -8,7 +8,9 @@ import * as React from 'react';
|
|
|
8
8
|
import { injectIntl } from 'react-intl';
|
|
9
9
|
import type { IntlShape } from 'react-intl';
|
|
10
10
|
import noop from 'lodash/noop';
|
|
11
|
+
// $FlowFixMe
|
|
11
12
|
import { BoxAiLogo } from '@box/blueprint-web-assets/icons/Logo';
|
|
13
|
+
// $FlowFixMe
|
|
12
14
|
import { Size6 } from '@box/blueprint-web-assets/tokens/tokens';
|
|
13
15
|
import { usePromptFocus } from '@box/box-ai-content-answers';
|
|
14
16
|
import AdditionalTabs from './additional-tabs';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { type StoryObj } from '@storybook/react';
|
|
1
|
+
import { type StoryObj, Meta } from '@storybook/react';
|
|
2
2
|
import { fn, userEvent, within } from '@storybook/test';
|
|
3
3
|
import React, { type ComponentProps } from 'react';
|
|
4
4
|
import { http, HttpResponse } from 'msw';
|
|
5
|
+
import type { HttpHandler } from 'msw';
|
|
5
6
|
import MetadataSidebarRedesign from '../MetadataSidebarRedesign';
|
|
6
7
|
import ContentSidebar from '../ContentSidebar';
|
|
7
8
|
import {
|
|
@@ -32,7 +33,7 @@ const defaultMetadataSidebarProps: ComponentProps<typeof MetadataSidebarRedesign
|
|
|
32
33
|
onSuccess: fn(),
|
|
33
34
|
};
|
|
34
35
|
|
|
35
|
-
|
|
36
|
+
const meta: Meta<typeof ContentSidebar> & { parameters: { msw: { handlers: HttpHandler[] } } } = {
|
|
36
37
|
title: 'Elements/ContentSidebar/MetadataSidebarRedesign',
|
|
37
38
|
component: ContentSidebar,
|
|
38
39
|
args: {
|
|
@@ -66,6 +67,8 @@ export default {
|
|
|
66
67
|
},
|
|
67
68
|
};
|
|
68
69
|
|
|
70
|
+
export default meta;
|
|
71
|
+
|
|
69
72
|
export const Basic: StoryObj<typeof MetadataSidebarRedesign> = {
|
|
70
73
|
play: async ({ canvasElement }) => {
|
|
71
74
|
const canvas = within(canvasElement);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { http, HttpResponse } from 'msw';
|
|
2
|
+
import type { HttpHandler } from 'msw';
|
|
2
3
|
|
|
3
4
|
import { DEFAULT_HOSTNAME_API } from '../../../../constants';
|
|
4
5
|
import { fileIdWithMetadata, mockFileRequest } from './MetadataSidebarRedesignedMocks';
|
|
@@ -395,7 +396,7 @@ export const mockSinglelevelTaxonomyNodes = {
|
|
|
395
396
|
},
|
|
396
397
|
};
|
|
397
398
|
|
|
398
|
-
export const taxonomyMockHandlers = [
|
|
399
|
+
export const taxonomyMockHandlers: HttpHandler[] = [
|
|
399
400
|
http.get(mockFileRequest.url, () => {
|
|
400
401
|
return HttpResponse.json(mockFileRequest.response);
|
|
401
402
|
}),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { expect, within } from '@storybook/test';
|
|
2
|
-
import { type StoryObj } from '@storybook/react';
|
|
2
|
+
import { type StoryObj, type Meta } from '@storybook/react';
|
|
3
3
|
import { http, HttpResponse } from 'msw';
|
|
4
|
+
import type { HttpHandler } from 'msw';
|
|
4
5
|
import ContentSidebar from '../../ContentSidebar';
|
|
5
6
|
import BoxAISidebar from '../../BoxAISidebar';
|
|
6
7
|
import { mockFileRequest, mockUserRequest } from '../../../common/__mocks__/mockRequests';
|
|
@@ -25,7 +26,7 @@ export const basic: StoryObj<typeof BoxAISidebar> = {
|
|
|
25
26
|
},
|
|
26
27
|
};
|
|
27
28
|
|
|
28
|
-
|
|
29
|
+
const meta: Meta<typeof ContentSidebar> & { parameters: { msw: { handlers: HttpHandler[] } } } = {
|
|
29
30
|
title: 'Elements/ContentSidebar/BoxAISidebar/tests/visual-regression-tests',
|
|
30
31
|
component: ContentSidebar,
|
|
31
32
|
args: {
|
|
@@ -90,3 +91,5 @@ export default {
|
|
|
90
91
|
},
|
|
91
92
|
},
|
|
92
93
|
};
|
|
94
|
+
|
|
95
|
+
export default meta;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import { http, HttpResponse } from 'msw';
|
|
3
|
+
import type { HttpHandler } from 'msw';
|
|
4
|
+
import type { Meta } from '@storybook/react';
|
|
3
5
|
import ContentSidebar from '../../ContentSidebar';
|
|
4
6
|
import { mockFileRequest } from '../__mocks__/ContentSidebarMocks';
|
|
5
7
|
import { testFileIds } from '../../../../../test/support/constants';
|
|
@@ -33,7 +35,7 @@ export const fileVersion = {
|
|
|
33
35
|
},
|
|
34
36
|
};
|
|
35
37
|
|
|
36
|
-
|
|
38
|
+
const meta: Meta<typeof ContentSidebar> & { parameters: { msw: { handlers: HttpHandler[] } } } = {
|
|
37
39
|
title: 'Elements/ContentSidebar/tests/e2e',
|
|
38
40
|
component: ContentSidebar,
|
|
39
41
|
args: defaultArgs,
|
|
@@ -47,3 +49,5 @@ export default {
|
|
|
47
49
|
},
|
|
48
50
|
},
|
|
49
51
|
};
|
|
52
|
+
|
|
53
|
+
export default meta;
|
package/src/elements/content-sidebar/stories/tests/MetadataSidebarRedesign-visual.stories.tsx
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { act, type ComponentProps } from 'react';
|
|
2
2
|
import { http, HttpResponse } from 'msw';
|
|
3
3
|
import { expect, userEvent, waitFor, within, fn, screen } from '@storybook/test';
|
|
4
|
-
import { type StoryObj } from '@storybook/react';
|
|
4
|
+
import { type StoryObj, Meta } from '@storybook/react';
|
|
5
|
+
import type { HttpHandler } from 'msw';
|
|
5
6
|
import ContentSidebar from '../../ContentSidebar';
|
|
6
7
|
import MetadataSidebarRedesign from '../../MetadataSidebarRedesign';
|
|
7
8
|
import {
|
|
@@ -720,7 +721,7 @@ export const EditSinglelevelTaxonomy: StoryObj<typeof MetadataSidebarRedesign> =
|
|
|
720
721
|
},
|
|
721
722
|
};
|
|
722
723
|
|
|
723
|
-
|
|
724
|
+
const meta: Meta<typeof ContentSidebar> & { parameters: { msw: { handlers: HttpHandler[] } } } = {
|
|
724
725
|
title: 'Elements/ContentSidebar/MetadataSidebarRedesign/tests/visual-regression-tests',
|
|
725
726
|
component: ContentSidebar,
|
|
726
727
|
args: {
|
|
@@ -739,3 +740,5 @@ export default {
|
|
|
739
740
|
},
|
|
740
741
|
},
|
|
741
742
|
};
|
|
743
|
+
|
|
744
|
+
export default meta;
|
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import type { ForwardRefExoticComponent, RefAttributes, SVGProps } from 'react';
|
|
2
3
|
import { useIntl } from 'react-intl';
|
|
3
4
|
import { LoadingIndicator } from '@box/blueprint-web';
|
|
4
5
|
import { IconCtaIconHover, Size5 } from '@box/blueprint-web-assets/tokens/tokens';
|
|
5
6
|
import { XMark } from '@box/blueprint-web-assets/icons/Fill';
|
|
6
7
|
import messages from '../common/messages';
|
|
7
8
|
|
|
8
|
-
const IconInProgress
|
|
9
|
-
|
|
9
|
+
const IconInProgress: ForwardRefExoticComponent<SVGProps<SVGSVGElement> & RefAttributes<SVGSVGElement>> =
|
|
10
|
+
React.forwardRef(() => {
|
|
11
|
+
const { formatMessage } = useIntl();
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
};
|
|
13
|
+
return (
|
|
14
|
+
<div className="bcu-IconInProgress">
|
|
15
|
+
<XMark color={IconCtaIconHover} height={Size5} width={Size5} />
|
|
16
|
+
<LoadingIndicator aria-label={formatMessage(messages.loading)} className="bcu-IconInProgress-loading" />
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
IconInProgress.displayName = 'IconInProgress';
|
|
18
22
|
|
|
19
23
|
export default IconInProgress;
|