box-ui-elements 23.3.0-beta.6 → 23.3.0-beta.8

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.
Files changed (69) hide show
  1. package/dist/explorer.css +1 -1
  2. package/dist/explorer.js +1 -1
  3. package/dist/preview.css +1 -1
  4. package/dist/preview.js +1 -1
  5. package/dist/sidebar.css +1 -1
  6. package/dist/sidebar.js +1 -1
  7. package/es/components/flyout/Flyout.js +3 -2
  8. package/es/components/flyout/Flyout.js.flow +3 -2
  9. package/es/components/flyout/Flyout.js.map +1 -1
  10. package/es/features/metadata-instance-editor/CascadePolicy.js +20 -2
  11. package/es/features/metadata-instance-editor/CascadePolicy.js.flow +27 -1
  12. package/es/features/metadata-instance-editor/CascadePolicy.js.map +1 -1
  13. package/es/features/metadata-instance-editor/CascadePolicy.scss +4 -0
  14. package/i18n/bn-IN.js +212 -212
  15. package/i18n/bn-IN.properties +10 -0
  16. package/i18n/da-DK.js +212 -212
  17. package/i18n/da-DK.properties +10 -0
  18. package/i18n/de-DE.js +212 -212
  19. package/i18n/de-DE.properties +10 -0
  20. package/i18n/en-AU.js +211 -211
  21. package/i18n/en-AU.properties +10 -0
  22. package/i18n/en-CA.js +211 -211
  23. package/i18n/en-CA.properties +10 -0
  24. package/i18n/en-GB.js +211 -211
  25. package/i18n/en-GB.properties +10 -0
  26. package/i18n/en-x-pseudo.js +1017 -1017
  27. package/i18n/en-x-pseudo.properties +1021 -1011
  28. package/i18n/es-419.js +212 -212
  29. package/i18n/es-419.properties +10 -0
  30. package/i18n/es-ES.js +212 -212
  31. package/i18n/es-ES.properties +10 -0
  32. package/i18n/fi-FI.js +212 -212
  33. package/i18n/fi-FI.properties +10 -0
  34. package/i18n/fr-CA.js +212 -212
  35. package/i18n/fr-CA.properties +10 -0
  36. package/i18n/fr-FR.js +212 -212
  37. package/i18n/fr-FR.properties +10 -0
  38. package/i18n/hi-IN.js +212 -212
  39. package/i18n/hi-IN.properties +10 -0
  40. package/i18n/it-IT.js +212 -212
  41. package/i18n/it-IT.properties +10 -0
  42. package/i18n/ja-JP.js +212 -212
  43. package/i18n/ja-JP.properties +10 -0
  44. package/i18n/ko-KR.js +212 -212
  45. package/i18n/ko-KR.properties +10 -0
  46. package/i18n/nb-NO.js +212 -212
  47. package/i18n/nb-NO.properties +10 -0
  48. package/i18n/nl-NL.js +212 -212
  49. package/i18n/nl-NL.properties +10 -0
  50. package/i18n/pl-PL.js +212 -212
  51. package/i18n/pl-PL.properties +10 -0
  52. package/i18n/pt-BR.js +212 -212
  53. package/i18n/pt-BR.properties +10 -0
  54. package/i18n/ru-RU.js +212 -212
  55. package/i18n/ru-RU.properties +10 -0
  56. package/i18n/sv-SE.js +212 -212
  57. package/i18n/sv-SE.properties +10 -0
  58. package/i18n/tr-TR.js +212 -212
  59. package/i18n/tr-TR.properties +10 -0
  60. package/i18n/zh-CN.js +212 -212
  61. package/i18n/zh-CN.properties +10 -0
  62. package/i18n/zh-TW.js +212 -212
  63. package/i18n/zh-TW.properties +10 -0
  64. package/package.json +1 -1
  65. package/src/components/flyout/Flyout.js +3 -2
  66. package/src/components/flyout/__tests__/Flyout.test.js +31 -20
  67. package/src/features/metadata-instance-editor/CascadePolicy.js +27 -1
  68. package/src/features/metadata-instance-editor/CascadePolicy.scss +4 -0
  69. package/src/features/metadata-instance-editor/__tests__/CascadePolicy.test.js +7 -0
@@ -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'),
@@ -2,7 +2,8 @@
2
2
  import * as React from 'react';
3
3
  import { FormattedMessage } from 'react-intl';
4
4
 
5
- import { InlineNotice } from '@box/blueprint-web';
5
+ import { BoxAiAgentSelector } from '@box/box-ai-agent-selector';
6
+ import { InlineNotice, TooltipProvider } from '@box/blueprint-web';
6
7
  import BoxAiLogo from '@box/blueprint-web-assets/icons/Logo/BoxAiLogo';
7
8
 
8
9
  import Toggle from '../../components/toggle';
@@ -15,6 +16,20 @@ import './CascadePolicy.scss';
15
16
  const COMMUNITY_LINK = 'https://support.box.com/hc/en-us/articles/360044195873-Cascading-metadata-in-folders';
16
17
  const AI_LINK = 'https://www.box.com/ai';
17
18
  const PRICING_LINK = 'https://www.box.com/pricing';
19
+
20
+ const agents = [
21
+ {
22
+ id: '1',
23
+ name: 'Basic',
24
+ isEnterpriseDefault: true,
25
+ },
26
+ {
27
+ id: '2',
28
+ name: 'Enhanced (Gemini 2.5 Pro)',
29
+ isEnterpriseDefault: false,
30
+ },
31
+ ];
32
+
18
33
  type Props = {
19
34
  canEdit: boolean,
20
35
  canUseAIFolderExtraction: boolean,
@@ -126,6 +141,17 @@ const CascadePolicy = ({
126
141
  <FormattedMessage {...messages.aiAutofillLearnMore} />
127
142
  </Link>
128
143
  </div>
144
+ <div className="metadata-cascade-ai-agent-selector">
145
+ <TooltipProvider>
146
+ <BoxAiAgentSelector
147
+ agents={agents}
148
+ onErrorAction={() => {}}
149
+ requestState="success"
150
+ selectedAgent={agents[0]}
151
+ variant="sidebar"
152
+ />
153
+ </TooltipProvider>
154
+ </div>
129
155
  <InlineNotice className="metadata-cascade-ai-notice" variant="info">
130
156
  <FormattedMessage
131
157
  {...messages.aiAutofillNotice}
@@ -78,3 +78,7 @@ $cascade-policy-background: #f1e2fd;
78
78
  }
79
79
  }
80
80
  }
81
+
82
+ .metadata-cascade-ai-agent-selector {
83
+ margin-top: 4px;
84
+ }
@@ -92,4 +92,11 @@ describe('features/metadata-instance-editor/CascadePolicy', () => {
92
92
  expect(pricingLink.closest('a')).toHaveAttribute('target', '_blank');
93
93
  });
94
94
  });
95
+
96
+ describe('AI Agent Selector', () => {
97
+ test('should render AI agent selector with default to basic when AI features are enabled', () => {
98
+ render(<CascadePolicy canEdit canUseAIFolderExtraction shouldShowCascadeOptions />);
99
+ expect(screen.getByRole('button', { name: 'Agent Basic' })).toBeInTheDocument();
100
+ });
101
+ });
95
102
  });