box-ui-elements 23.4.0-beta.6 → 23.4.0-beta.7

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 (35) hide show
  1. package/DEVELOPING.md +13 -29
  2. package/cypress.config.ts +1 -1
  3. package/dist/explorer.js +1 -1
  4. package/dist/preview.js +1 -1
  5. package/dist/sidebar.js +1 -1
  6. package/es/components/context-menu/ContextMenu.stories.js +3 -3
  7. package/es/components/context-menu/ContextMenu.stories.js.map +1 -1
  8. package/es/components/context-menu/ContextMenuExample.scss +4 -0
  9. package/es/components/context-menu/ContextMenuWithSubmenuExample.js +43 -0
  10. package/es/components/context-menu/ContextMenuWithSubmenuExample.js.map +1 -0
  11. package/es/components/selector-dropdown/SelectorDropdown.stories.js +2 -2
  12. package/es/components/selector-dropdown/SelectorDropdown.stories.js.flow +2 -2
  13. package/es/components/selector-dropdown/SelectorDropdown.stories.js.map +1 -1
  14. package/es/components/selector-dropdown/SelectorDropdownExample.js +126 -0
  15. package/es/components/selector-dropdown/SelectorDropdownExample.js.map +1 -0
  16. package/es/elements/content-sidebar/BoxAISidebarContent.js +6 -1
  17. package/es/elements/content-sidebar/BoxAISidebarContent.js.map +1 -1
  18. package/es/src/components/context-menu/ContextMenu.stories.d.ts +1 -1
  19. package/es/src/components/context-menu/ContextMenuWithSubmenuExample.d.ts +9 -0
  20. package/es/src/components/selector-dropdown/SelectorDropdownExample.d.ts +3 -0
  21. package/es/src/elements/content-sidebar/BoxAISidebarContent.d.ts +2 -0
  22. package/es/types.d.ts +0 -1
  23. package/eslint.config.js +0 -1
  24. package/i18n/pl-PL.js +2 -2
  25. package/i18n/pl-PL.properties +2 -2
  26. package/package.json +9 -16
  27. package/src/components/context-menu/ContextMenu.stories.tsx +3 -3
  28. package/src/components/context-menu/ContextMenuExample.scss +4 -0
  29. package/src/components/context-menu/ContextMenuWithSubmenuExample.tsx +61 -0
  30. package/src/components/progress-bar/README.md +1 -11
  31. package/src/components/selector-dropdown/SelectorDropdown.stories.js +2 -2
  32. package/src/components/selector-dropdown/SelectorDropdownExample.tsx +140 -0
  33. package/src/elements/content-sidebar/BoxAISidebarContent.tsx +13 -2
  34. package/src/elements/content-sidebar/__tests__/BoxAISidebar.test.tsx +21 -0
  35. package/types.ts +0 -1
@@ -3,12 +3,12 @@ import Menu from '../menu/Menu';
3
3
  import MenuItem from '../menu/MenuItem';
4
4
  import ContextMenu from './ContextMenu';
5
5
  import notes from './ContextMenu.stories.md';
6
- import ContextMenuWithSubmenuWithBoundariesElementExample from '../../../examples/src/ContextMenuWithSubmenuWithBoundariesElementExample';
7
- import '../../../examples/styles/ContextMenuExamples.scss';
6
+ import ContextMenuWithSubmenuExample from './ContextMenuWithSubmenuExample';
7
+ import './ContextMenuExample.scss';
8
8
  export const basic = () => /*#__PURE__*/React.createElement(ContextMenu, null, /*#__PURE__*/React.createElement("div", {
9
9
  className: "context-menu-example-target"
10
10
  }, "Target Component - right click me"), /*#__PURE__*/React.createElement(Menu, null, /*#__PURE__*/React.createElement(MenuItem, null, "View Profile"), /*#__PURE__*/React.createElement(MenuItem, null, "Help")));
11
- export const withSubmenu = () => /*#__PURE__*/React.createElement(ContextMenuWithSubmenuWithBoundariesElementExample, null);
11
+ export const withSubmenu = () => /*#__PURE__*/React.createElement(ContextMenuWithSubmenuExample, null);
12
12
  export default {
13
13
  title: 'Components/ContextMenu',
14
14
  component: ContextMenu,
@@ -1 +1 @@
1
- {"version":3,"file":"ContextMenu.stories.js","names":["React","Menu","MenuItem","ContextMenu","notes","ContextMenuWithSubmenuWithBoundariesElementExample","basic","createElement","className","withSubmenu","title","component","parameters"],"sources":["../../../src/components/context-menu/ContextMenu.stories.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport Menu from '../menu/Menu';\nimport MenuItem from '../menu/MenuItem';\n\nimport ContextMenu from './ContextMenu';\nimport notes from './ContextMenu.stories.md';\n\nimport ContextMenuWithSubmenuWithBoundariesElementExample from '../../../examples/src/ContextMenuWithSubmenuWithBoundariesElementExample';\n\nimport '../../../examples/styles/ContextMenuExamples.scss';\n\nexport const basic = () => (\n <ContextMenu>\n <div className=\"context-menu-example-target\">Target Component - right click me</div>\n <Menu>\n <MenuItem>View Profile</MenuItem>\n <MenuItem>Help</MenuItem>\n </Menu>\n </ContextMenu>\n);\n\nexport const withSubmenu = () => <ContextMenuWithSubmenuWithBoundariesElementExample />;\n\nexport default {\n title: 'Components/ContextMenu',\n component: ContextMenu,\n parameters: {\n notes,\n },\n};\n"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAE9B,OAAOC,IAAI,MAAM,cAAc;AAC/B,OAAOC,QAAQ,MAAM,kBAAkB;AAEvC,OAAOC,WAAW,MAAM,eAAe;AACvC,OAAOC,KAAK,MAAM,0BAA0B;AAE5C,OAAOC,kDAAkD,MAAM,0EAA0E;AAEzI,OAAO,mDAAmD;AAE1D,OAAO,MAAMC,KAAK,GAAGA,CAAA,kBACjBN,KAAA,CAAAO,aAAA,CAACJ,WAAW,qBACRH,KAAA,CAAAO,aAAA;EAAKC,SAAS,EAAC;AAA6B,GAAC,mCAAsC,CAAC,eACpFR,KAAA,CAAAO,aAAA,CAACN,IAAI,qBACDD,KAAA,CAAAO,aAAA,CAACL,QAAQ,QAAC,cAAsB,CAAC,eACjCF,KAAA,CAAAO,aAAA,CAACL,QAAQ,QAAC,MAAc,CACtB,CACG,CAChB;AAED,OAAO,MAAMO,WAAW,GAAGA,CAAA,kBAAMT,KAAA,CAAAO,aAAA,CAACF,kDAAkD,MAAE,CAAC;AAEvF,eAAe;EACXK,KAAK,EAAE,wBAAwB;EAC/BC,SAAS,EAAER,WAAW;EACtBS,UAAU,EAAE;IACRR;EACJ;AACJ,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"ContextMenu.stories.js","names":["React","Menu","MenuItem","ContextMenu","notes","ContextMenuWithSubmenuExample","basic","createElement","className","withSubmenu","title","component","parameters"],"sources":["../../../src/components/context-menu/ContextMenu.stories.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport Menu from '../menu/Menu';\nimport MenuItem from '../menu/MenuItem';\n\nimport ContextMenu from './ContextMenu';\nimport notes from './ContextMenu.stories.md';\n\nimport ContextMenuWithSubmenuExample from './ContextMenuWithSubmenuExample';\n\nimport './ContextMenuExample.scss';\n\nexport const basic = () => (\n <ContextMenu>\n <div className=\"context-menu-example-target\">Target Component - right click me</div>\n <Menu>\n <MenuItem>View Profile</MenuItem>\n <MenuItem>Help</MenuItem>\n </Menu>\n </ContextMenu>\n);\n\nexport const withSubmenu = () => <ContextMenuWithSubmenuExample />;\n\nexport default {\n title: 'Components/ContextMenu',\n component: ContextMenu,\n parameters: {\n notes,\n },\n};\n"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAE9B,OAAOC,IAAI,MAAM,cAAc;AAC/B,OAAOC,QAAQ,MAAM,kBAAkB;AAEvC,OAAOC,WAAW,MAAM,eAAe;AACvC,OAAOC,KAAK,MAAM,0BAA0B;AAE5C,OAAOC,6BAA6B,MAAM,iCAAiC;AAE3E,OAAO,2BAA2B;AAElC,OAAO,MAAMC,KAAK,GAAGA,CAAA,kBACjBN,KAAA,CAAAO,aAAA,CAACJ,WAAW,qBACRH,KAAA,CAAAO,aAAA;EAAKC,SAAS,EAAC;AAA6B,GAAC,mCAAsC,CAAC,eACpFR,KAAA,CAAAO,aAAA,CAACN,IAAI,qBACDD,KAAA,CAAAO,aAAA,CAACL,QAAQ,QAAC,cAAsB,CAAC,eACjCF,KAAA,CAAAO,aAAA,CAACL,QAAQ,QAAC,MAAc,CACtB,CACG,CAChB;AAED,OAAO,MAAMO,WAAW,GAAGA,CAAA,kBAAMT,KAAA,CAAAO,aAAA,CAACF,6BAA6B,MAAE,CAAC;AAElE,eAAe;EACXK,KAAK,EAAE,wBAAwB;EAC/BC,SAAS,EAAER,WAAW;EACtBS,UAAU,EAAE;IACRR;EACJ;AACJ,CAAC","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ .context-menu-example-target {
2
+ border: 1px solid black;
3
+ padding: 10px;
4
+ }
@@ -0,0 +1,43 @@
1
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4
+ import * as React from 'react';
5
+ import { Menu, SubmenuItem, MenuItem } from '../menu';
6
+ import ContextMenu from './ContextMenu';
7
+ class ContextMenuWithSubmenuExample extends React.Component {
8
+ constructor(...args) {
9
+ super(...args);
10
+ _defineProperty(this, "state", {
11
+ rightBoundaryElement: undefined,
12
+ bottomBoundaryElement: undefined
13
+ });
14
+ }
15
+ render() {
16
+ return /*#__PURE__*/React.createElement(ContextMenu, null, /*#__PURE__*/React.createElement("div", {
17
+ ref: ref => {
18
+ if (!this.state.rightBoundaryElement) {
19
+ this.setState({
20
+ rightBoundaryElement: ref
21
+ });
22
+ }
23
+ },
24
+ className: "context-menu-example-target",
25
+ style: {
26
+ height: 200
27
+ }
28
+ }, "Target Component - right click me"), /*#__PURE__*/React.createElement(Menu, {
29
+ setRef: ref => {
30
+ if (!this.state.bottomBoundaryElement) {
31
+ this.setState({
32
+ bottomBoundaryElement: ref
33
+ });
34
+ }
35
+ }
36
+ }, /*#__PURE__*/React.createElement(MenuItem, null, "View Profile"), /*#__PURE__*/React.createElement(MenuItem, null, "View Profile"), this.state.rightBoundaryElement && /*#__PURE__*/React.createElement(SubmenuItem, {
37
+ bottomBoundaryElement: this.state.bottomBoundaryElement,
38
+ rightBoundaryElement: this.state.rightBoundaryElement
39
+ }, "Submenu", /*#__PURE__*/React.createElement(Menu, null, /*#__PURE__*/React.createElement(MenuItem, null, "View Profile"), /*#__PURE__*/React.createElement(MenuItem, null, "View Profile"), /*#__PURE__*/React.createElement(MenuItem, null, "View Profile"))), /*#__PURE__*/React.createElement(MenuItem, null, "Help")));
40
+ }
41
+ }
42
+ export default ContextMenuWithSubmenuExample;
43
+ //# sourceMappingURL=ContextMenuWithSubmenuExample.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContextMenuWithSubmenuExample.js","names":["React","Menu","SubmenuItem","MenuItem","ContextMenu","ContextMenuWithSubmenuExample","Component","constructor","args","_defineProperty","rightBoundaryElement","undefined","bottomBoundaryElement","render","createElement","ref","state","setState","className","style","height","setRef"],"sources":["../../../src/components/context-menu/ContextMenuWithSubmenuExample.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Menu, SubmenuItem, MenuItem } from '../menu';\nimport ContextMenu from './ContextMenu';\n\nclass ContextMenuWithSubmenuExample extends React.Component {\n state = {\n rightBoundaryElement: undefined,\n bottomBoundaryElement: undefined,\n };\n\n render() {\n return (\n <ContextMenu>\n <div\n ref={ref => {\n if (!this.state.rightBoundaryElement) {\n this.setState({\n rightBoundaryElement: ref,\n });\n }\n }}\n className=\"context-menu-example-target\"\n style={{\n height: 200,\n }}\n >\n Target Component - right click me\n </div>\n <Menu\n setRef={(ref: React.RefObject<HTMLDivElement>) => {\n if (!this.state.bottomBoundaryElement) {\n this.setState({\n bottomBoundaryElement: ref,\n });\n }\n }}\n >\n <MenuItem>View Profile</MenuItem>\n <MenuItem>View Profile</MenuItem>\n {this.state.rightBoundaryElement && (\n <SubmenuItem\n bottomBoundaryElement={this.state.bottomBoundaryElement}\n rightBoundaryElement={this.state.rightBoundaryElement}\n >\n Submenu\n <Menu>\n <MenuItem>View Profile</MenuItem>\n <MenuItem>View Profile</MenuItem>\n <MenuItem>View Profile</MenuItem>\n </Menu>\n </SubmenuItem>\n )}\n <MenuItem>Help</MenuItem>\n </Menu>\n </ContextMen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AE,IAAI,CAACM,KAAK,CAACN;IAAqB,GACzD,SAEG,eAAAV,KAAA,CAAAc,aAAA,CAACb,IAAI,qBACDD,KAAA,CAAAc,aAAA,CAACX,QAAQ,QAAC,cAAsB,CAAC,eACjCH,KAAA,CAAAc,aAAA,CAACX,QAAQ,QAAC,cAAsB,CAAC,eACjCH,KAAA,CAAAc,aAAA,CAACX,QAAQ,QAAC,cAAsB,CAC9B,CACG,CAChB,eACDH,KAAA,CAAAc,aAAA,CAACX,QAAQ,QAAC,MAAc,CACtB,CACG,CAAC;EAEtB;AACJ;AAEA,eAAeE,6BAA6B","ignoreList":[]}
@@ -1,8 +1,8 @@
1
1
  import * as React from 'react';
2
- import SelectorDropdownExamples from '../../../examples/src/SelectorDropdownExamples';
2
+ import SelectorDropdownExample from './SelectorDropdownExample';
3
3
  import SelectorDropdown from './SelectorDropdown';
4
4
  import notes from './SelectorDropdown.stories.md';
5
- export const basic = () => /*#__PURE__*/React.createElement(SelectorDropdownExamples, null);
5
+ export const basic = () => /*#__PURE__*/React.createElement(SelectorDropdownExample, null);
6
6
  export default {
7
7
  title: 'Components/SelectorDropdown',
8
8
  component: SelectorDropdown,
@@ -1,11 +1,11 @@
1
1
  // @flow
2
2
  import * as React from 'react';
3
3
 
4
- import SelectorDropdownExamples from '../../../examples/src/SelectorDropdownExamples';
4
+ import SelectorDropdownExample from './SelectorDropdownExample';
5
5
  import SelectorDropdown from './SelectorDropdown';
6
6
  import notes from './SelectorDropdown.stories.md';
7
7
 
8
- export const basic = () => <SelectorDropdownExamples />;
8
+ export const basic = () => <SelectorDropdownExample />;
9
9
 
10
10
  export default {
11
11
  title: 'Components/SelectorDropdown',
@@ -1 +1 @@
1
- {"version":3,"file":"SelectorDropdown.stories.js","names":["React","SelectorDropdownExamples","SelectorDropdown","notes","basic","createElement","title","component","parameters"],"sources":["../../../src/components/selector-dropdown/SelectorDropdown.stories.js"],"sourcesContent":["// @flow\nimport * as React from 'react';\n\nimport SelectorDropdownExamples from '../../../examples/src/SelectorDropdownExamples';\nimport SelectorDropdown from './SelectorDropdown';\nimport notes from './SelectorDropdown.stories.md';\n\nexport const basic = () => <SelectorDropdownExamples />;\n\nexport default {\n title: 'Components/SelectorDropdown',\n component: SelectorDropdown,\n parameters: {\n notes,\n },\n};\n"],"mappings":"AACA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAE9B,OAAOC,wBAAwB,MAAM,gDAAgD;AACrF,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,KAAK,MAAM,+BAA+B;AAEjD,OAAO,MAAMC,KAAK,GAAGA,CAAA,kBAAMJ,KAAA,CAAAK,aAAA,CAACJ,wBAAwB,MAAE,CAAC;AAEvD,eAAe;EACXK,KAAK,EAAE,6BAA6B;EACpCC,SAAS,EAAEL,gBAAgB;EAC3BM,UAAU,EAAE;IACRL;EACJ;AACJ,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"SelectorDropdown.stories.js","names":["React","SelectorDropdownExample","SelectorDropdown","notes","basic","createElement","title","component","parameters"],"sources":["../../../src/components/selector-dropdown/SelectorDropdown.stories.js"],"sourcesContent":["// @flow\nimport * as React from 'react';\n\nimport SelectorDropdownExample from './SelectorDropdownExample';\nimport SelectorDropdown from './SelectorDropdown';\nimport notes from './SelectorDropdown.stories.md';\n\nexport const basic = () => <SelectorDropdownExample />;\n\nexport default {\n title: 'Components/SelectorDropdown',\n component: SelectorDropdown,\n parameters: {\n notes,\n },\n};\n"],"mappings":"AACA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAE9B,OAAOC,uBAAuB,MAAM,2BAA2B;AAC/D,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,KAAK,MAAM,+BAA+B;AAEjD,OAAO,MAAMC,KAAK,GAAGA,CAAA,kBAAMJ,KAAA,CAAAK,aAAA,CAACJ,uBAAuB,MAAE,CAAC;AAEtD,eAAe;EACXK,KAAK,EAAE,6BAA6B;EACpCC,SAAS,EAAEL,gBAAgB;EAC3BM,UAAU,EAAE;IACRL;EACJ;AACJ,CAAC","ignoreList":[]}
@@ -0,0 +1,126 @@
1
+ const _excluded = ["inputProps"];
2
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
3
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
4
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
5
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
6
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
7
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
8
+ import React, { Children, Component } from 'react';
9
+ import DatalistItem from '../datalist-item';
10
+ import SelectorDropdown from './SelectorDropdown';
11
+ import TextInput from '../text-input';
12
+ const InputContainer = _ref => {
13
+ let {
14
+ inputProps = {}
15
+ } = _ref,
16
+ rest = _objectWithoutProperties(_ref, _excluded);
17
+ return /*#__PURE__*/React.createElement(TextInput, _extends({}, inputProps, rest));
18
+ };
19
+ class SelectorDropdownContainer extends Component {
20
+ constructor(props) {
21
+ super(props);
22
+ _defineProperty(this, "handleShowTitle", () => {
23
+ this.setState({
24
+ showTitle: !this.state.showTitle
25
+ });
26
+ });
27
+ _defineProperty(this, "handleRemainOpen", () => {
28
+ this.setState({
29
+ remainOpen: !this.state.remainOpen
30
+ });
31
+ });
32
+ _defineProperty(this, "handleUserInput", event => {
33
+ this.filterByItem(event.target.value);
34
+ });
35
+ _defineProperty(this, "handleItemSelection", i => {
36
+ this.setState({
37
+ filterText: this.state.items[i]
38
+ });
39
+ });
40
+ this.state = {
41
+ filterText: '',
42
+ items: props.initialItems,
43
+ showTitle: false,
44
+ remainOpen: false
45
+ };
46
+ }
47
+ filterByItem(item) {
48
+ this.setState({
49
+ filterText: item
50
+ });
51
+ this.filterItems(item);
52
+ }
53
+ filterItems(filterText) {
54
+ const {
55
+ initialItems
56
+ } = this.props;
57
+ const filterTextLowerCase = filterText.toLowerCase();
58
+ const items = initialItems.filter(item => item.toLowerCase().includes(filterTextLowerCase));
59
+ this.setState({
60
+ items
61
+ });
62
+ }
63
+ render() {
64
+ const {
65
+ placeholder,
66
+ title
67
+ } = this.props;
68
+ const {
69
+ filterText,
70
+ items,
71
+ showTitle,
72
+ remainOpen
73
+ } = this.state;
74
+ const dropdownTitle = /*#__PURE__*/React.createElement("div", null, "This is a Title");
75
+ return /*#__PURE__*/React.createElement("div", {
76
+ style: {
77
+ paddingBottom: '330px'
78
+ }
79
+ }, /*#__PURE__*/React.createElement("label", {
80
+ htmlFor: "title-check"
81
+ }, /*#__PURE__*/React.createElement("input", {
82
+ type: "checkbox",
83
+ name: "title-check",
84
+ id: "title-check",
85
+ checked: showTitle,
86
+ onChange: this.handleShowTitle
87
+ }), /*#__PURE__*/React.createElement("span", {
88
+ style: {
89
+ paddingLeft: '4px'
90
+ }
91
+ }, "Add title to overlay")), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("label", {
92
+ htmlFor: "remain-open-check"
93
+ }, /*#__PURE__*/React.createElement("input", {
94
+ type: "checkbox",
95
+ name: "remain-open-check",
96
+ id: "remain-open-check",
97
+ checked: remainOpen,
98
+ onChange: this.handleRemainOpen
99
+ }), /*#__PURE__*/React.createElement("span", {
100
+ style: {
101
+ paddingLeft: '4px'
102
+ }
103
+ }, "Overlay should remain open")), /*#__PURE__*/React.createElement("hr", null), /*#__PURE__*/React.createElement(SelectorDropdown, {
104
+ isAlwaysOpen: remainOpen,
105
+ onSelect: this.handleItemSelection,
106
+ selector: /*#__PURE__*/React.createElement(InputContainer, {
107
+ label: title,
108
+ name: "selectorDropdownInput",
109
+ onInput: this.handleUserInput,
110
+ placeholder: placeholder,
111
+ type: "text",
112
+ value: filterText
113
+ }),
114
+ title: showTitle ? dropdownTitle : undefined
115
+ }, Children.map(items, item => /*#__PURE__*/React.createElement(DatalistItem, {
116
+ key: item
117
+ }, item))));
118
+ }
119
+ }
120
+ const SelectorDropdownExample = () => /*#__PURE__*/React.createElement(SelectorDropdownContainer, {
121
+ initialItems: ['Illmatic', 'The Marshall Mathers LP', 'All Eyez on Me', 'Ready To Die', 'Enter the Wu-Tang', 'The Eminem Show', 'The Chronic', 'Straight Outta Compton', 'Reasonable Doubt', 'Super long name that should be truncated, we should see the dots at the very end, adding some more text here, should truncate at any second now, please truncate soon'],
122
+ placeholder: "Select an album",
123
+ title: "Album"
124
+ });
125
+ export default SelectorDropdownExample;
126
+ //# sourceMappingURL=SelectorDropdownExample.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectorDropdownExample.js","names":["React","Children","Component","DatalistItem","SelectorDropdown","TextInput","InputContainer","_ref","inputProps","rest","_objectWithoutProperties","_excluded","createElement","_extends","SelectorDropdownContainer","constructor","props","_defineProperty","setState","showTitle","state","remainOpen","event","filterByItem","target","value","i","filterText","items","initialItems","item","filterItems","filterTextLowerCase","toLowerCase","filter","includes","render","placeholder","title","dropdownTitle","style","paddingBottom","htmlFor","type","name","id","checked","onChange","handleShowTitle","paddingLeft","handleRemainOpen","isAlwaysOpen","onSelect","handleItemSelection","selector","label","onInput","handleUserInput","undefined","map","key","SelectorDropdownExample"],"sources":["../../../src/components/selector-dropdown/SelectorDropdownExample.tsx"],"sourcesContent":["import React, { Children, Component } from 'react';\n\nimport DatalistItem from '../datalist-item';\nimport SelectorDropdown from './SelectorDropdown';\nimport TextInput, { TextInputProps } from '../text-input';\n\ninterface InputContainerProps extends Omit<TextInputProps, 'onInput'> {\n inputProps?: Partial<TextInputProps>;\n onInput: (event: React.ChangeEvent<HTMLInputElement>) => void;\n}\n\nconst InputContainer: React.FC<InputContainerProps> = ({ inputProps = {}, ...rest }) => (\n <TextInput {...inputProps} {...rest} />\n);\n\ninterface SelectorDropdownContainerProps {\n initialItems: string[];\n placeholder: string;\n title: string;\n}\n\ninterface SelectorDropdownContainerState {\n filterText: string;\n items: string[];\n showTitle: boolean;\n remainOpen: boolean;\n}\n\nclass SelectorDropdownContainer extends Component<SelectorDropdownContainerProps, SelectorDropdownContainerState> {\n constructor(props: SelectorDropdownContainerProps) {\n super(props);\n this.state = {\n filterText: '',\n items: props.initialItems,\n showTitle: false,\n remainOpen: false,\n };\n }\n\n handleShowTitle = () => {\n this.setState({ showTitle: !this.state.showTitle });\n };\n\n handleRemainOpen = () => {\n this.setState({ remainOpen: !this.state.remainOpen });\n };\n\n handleUserInput = (event: React.ChangeEvent<HTMLInputElement>) => {\n this.filterByItem(event.target.value);\n };\n\n handleItemSelection = (i: number) => {\n this.setState({ filterText: this.state.items[i] });\n };\n\n filterByItem(item: string) {\n this.setState({ filterText: item });\n this.filterItems(item);\n }\n\n filterItems(filterText: string) {\n const { initialItems } = this.props;\n const filterTextLowerCase = filterText.toLowerCase();\n const items = initialItems.filter(item => item.toLowerCase().includes(filterTextLowerCase));\n this.setState({ items });\n }\n\n render() {\n const { placeholder, title } = this.props;\n const { filterText, items, showTitle, remainOpen } = this.state;\n const dropdownTitle = <div>This is a Title</div>;\n\n return (\n <div style={{ paddingBottom: '330px' }}>\n <label htmlFor=\"title-check\">\n <input\n type=\"checkbox\"\n name=\"title-check\"\n id=\"title-check\"\n checked={showTitle}\n onChange={this.handleShowTitle}\n />\n <span style={{ paddingLeft: '4px' }}>Add title to overlay</span>\n </label>\n <br />\n <label htmlFor=\"remain-open-check\">\n <input\n type=\"checkbox\"\n name=\"remain-open-check\"\n id=\"remain-open-check\"\n checked={remainOpen}\n onChange={this.handleRemainOpen}\n />\n <span style={{ paddingLeft: '4px' }}>Overlay should remain open</span>\n </label>\n <hr />\n <SelectorDropdown\n isAlwaysOpen={remainOpen}\n onSelect={this.handleItemSelection}\n selector={\n <InputContainer\n label={title}\n name=\"selectorDropdownInput\"\n onInput={this.handleUserInput}\n placeholder={placeholder}\n type=\"text\"\n value={filterText}\n />\n }\n title={showTitle ? dropdownTitle : undefined}\n >\n {Children.map(items, item => (\n <DatalistItem key={item}>{item}</DatalistItem>\n ))}\n </SelectorDropdown>\n </div>\n );\n }\n}\n\nconst SelectorDropdownExample: React.FC = () => (\n <SelectorDropdownContainer\n initialItems={[\n 'Illmatic',\n 'The Marshall Mathers LP',\n 'All Eyez on Me',\n 'Ready To Die',\n 'Enter the Wu-Tang',\n 'The Eminem Show',\n 'The Chronic',\n 'Straight Outta Compton',\n 'Reasonable Doubt',\n 'Super long name that should be truncated, we should see the dots at the very end, adding some more text here, should truncate at any second now, please truncate soon',\n ]}\n placeholder=\"Select an album\"\n title=\"Album\"\n />\n);\n\nexport default SelectorDropdownExample;\n"],"mappings":";;;;;;;AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,SAAS,QAAQ,OAAO;AAElD,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,SAAS,MAA0B,eAAe;AAOzD,MAAMC,cAA6C,GAAGC,IAAA;EAAA,IAAC;MAAEC,UAAU,GAAG,CAAC;IAAW,CAAC,GAAAD,IAAA;IAANE,IAAI,GAAAC,wBAAA,CAAAH,IAAA,EAAAI,SAAA;EAAA,oBAC7EX,KAAA,CAAAY,aAAA,CAACP,SAAS,EAAAQ,QAAA,KAA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AAA,WAAK,CAAC,eACNZ,KAAA,CAAAY,aAAA,CAACR,gBAAgB;MACb+C,YAAY,EAAE9B,UAAW;MACzB+B,QAAQ,EAAE,IAAI,CAACC,mBAAoB;MACnCC,QAAQ,eACJtD,KAAA,CAAAY,aAAA,CAACN,cAAc;QACXiD,KAAK,EAAEjB,KAAM;QACbM,IAAI,EAAC,uBAAuB;QAC5BY,OAAO,EAAE,IAAI,CAACC,eAAgB;QAC9BpB,WAAW,EAAEA,WAAY;QACzBM,IAAI,EAAC,MAAM;QACXlB,KAAK,EAAEE;MAAW,CACrB,CACJ;MACDW,KAAK,EAAEnB,SAAS,GAAGoB,aAAa,GAAGmB;IAAU,GAE5CzD,QAAQ,CAAC0D,GAAG,CAAC/B,KAAK,EAAEE,IAAI,iBACrB9B,KAAA,CAAAY,aAAA,CAACT,YAAY;MAACyD,GAAG,EAAE9B;IAAK,GAAEA,IAAmB,CAChD,CACa,CACjB,CAAC;EAEd;AACJ;AAEA,MAAM+B,uBAAiC,GAAGA,CAAA,kBACtC7D,KAAA,CAAAY,aAAA,CAACE,yBAAyB;EACtBe,YAAY,EAAE,CACV,UAAU,EACV,yBAAyB,EACzB,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,wBAAwB,EACxB,kBAAkB,EAClB,uKAAuK,CACzK;EACFQ,WAAW,EAAC,iBAAiB;EAC7BC,KAAK,EAAC;AAAO,CAChB,CACJ;AAED,eAAeuB,uBAAuB","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- const _excluded = ["createSession", "encodedSession", "onClearAction", "getAIStudioAgents", "hasRequestInProgress", "hostAppName", "isAIStudioAgentSelectorEnabled", "isLoading", "isResetChatEnabled", "onSelectAgent", "questions", "shouldShowLandingPage", "sendQuestion", "stopQuestion"];
1
+ const _excluded = ["createSession", "encodedSession", "onClearAction", "onSelectedAgentCallback", "getAIStudioAgents", "hasRequestInProgress", "hostAppName", "isAIStudioAgentSelectorEnabled", "isLoading", "isResetChatEnabled", "onSelectAgent", "questions", "shouldShowLandingPage", "sendQuestion", "stopQuestion"];
2
2
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
3
3
  function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
4
4
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
@@ -32,6 +32,7 @@ function BoxAISidebarContent(props) {
32
32
  createSession,
33
33
  encodedSession,
34
34
  onClearAction,
35
+ onSelectedAgentCallback,
35
36
  getAIStudioAgents,
36
37
  hasRequestInProgress,
37
38
  hostAppName,
@@ -149,6 +150,10 @@ function BoxAISidebarContent(props) {
149
150
  }
150
151
  // eslint-disable-next-line react-hooks/exhaustive-deps
151
152
  }, [encodedSession]);
153
+ React.useEffect(() => {
154
+ onSelectedAgentCallback?.(selectedAgent);
155
+ // eslint-disable-next-line react-hooks/exhaustive-deps
156
+ }, [selectedAgent?.id]);
152
157
  const renderBoxAISidebarTitle = () => {
153
158
  return /*#__PURE__*/React.createElement("div", {
154
159
  className: "bcs-BoxAISidebar-title-part"
@@ -1 +1 @@
1
- {"version":3,"file":"BoxAISidebarContent.js","names":["React","flow","useIntl","classNames","BoxAiAgentSelectorWithApi","useAgents","IconButton","Tooltip","ArrowsExpand","BoxAiContentAnswers","ClearConversationButton","IntelligenceModal","withApiWrapper","SidebarContent","withAPIContext","withErrorBoundary","withLogger","ORIGIN_BOXAI_SIDEBAR","SIDEBAR_VIEW_BOXAI","EVENT_JS_READY","mark","BoxAISidebarContext","BoxAISidebarTitle","messages","MARK_NAME_JS_READY","BoxAISidebarContent","props","createSession","encodedSession","onClearAction","getAIStudioAgents","hasRequestInProgress","hostAppName","isAIStudioAgentSelectorEnabled","isLoading","isResetChatEnabled","onSelectAgent","questions","shouldShowLandingPage","sendQuestion","stopQuestion","rest","_objectWithoutProperties","_excluded","formatMessage","isSessionInitiated","useRef","isModalOpen","setIsModalOpen","useState","cache","contentName","elementId","fileExtension","isFeedbackEnabled","isFeedbackFormEnabled","isStopResponseEnabled","items","itemSize","onFeedbackFormSubmit","onUserInteraction","recordAction","setCacheValue","shouldFeedbackFormIncludeFeedbackText","shouldPreinitSession","useContext","agents","requestState","selectedAgent","cacheQuestions","handleUserIntentToUseAI","userHasInteracted","handleModalClose","handleSwitchToModalClick","useEffect","length","isCompleted","prompt","action","component","feature","target","data","map","item","status","fileType","lastQuestion","current","renderBoxAISidebarTitle","createElement","className","disabled","fetcher","onAgentsListOpen","shouldHideAgentSelectorOnLoad","variant","renderActions","Fragment","onClick","content","sidebarBoxAISwitchToModalView","icon","size","actions","sidebarView","_extends","contentType","sidebarBoxAIContent","onUserIntentToUseAI","showLoadingIndicator","submitQuestion","extension","onOpenChange","open","undefined","stopPropagationOnEsc","shouldRenderProviders","BoxAISidebarComponent","BoxAISidebarContentDefaultExport"],"sources":["../../../src/elements/content-sidebar/BoxAISidebarContent.tsx"],"sourcesContent":["/**\n * @file Box AI sidebar component\n * @author Box\n */\nimport * as React from 'react';\nimport flow from 'lodash/flow';\nimport { useIntl } from 'react-intl';\nimport classNames from 'classnames';\nimport { BoxAiAgentSelectorWithApi, useAgents } from '@box/box-ai-agent-selector';\nimport { IconButton, Tooltip } from '@box/blueprint-web';\nimport { ArrowsExpand } from '@box/blueprint-web-assets/icons/Fill';\nimport {\n BoxAiContentAnswers,\n ClearConversationButton,\n IntelligenceModal,\n withApiWrapper,\n type ApiWrapperWithInjectedProps,\n} from '@box/box-ai-content-answers';\nimport SidebarContent from './SidebarContent';\nimport { withAPIContext } from '../common/api-context';\nimport { withErrorBoundary } from '../common/error-boundary';\nimport { withLogger } from '../common/logger';\nimport { ORIGIN_BOXAI_SIDEBAR, SIDEBAR_VIEW_BOXAI } from '../../constants';\nimport { EVENT_JS_READY } from '../common/logger/constants';\nimport { mark } from '../../utils/performance';\nimport { BoxAISidebarContext } from './context/BoxAISidebarContext';\nimport BoxAISidebarTitle from './BoxAISidebarTitle';\n\nimport messages from '../common/messages';\n\nimport './BoxAISidebar.scss';\n\nconst MARK_NAME_JS_READY: string = `${ORIGIN_BOXAI_SIDEBAR}_${EVENT_JS_READY}`;\n\nmark(MARK_NAME_JS_READY);\n\nfunction BoxAISidebarContent(props: ApiWrapperWithInjectedProps & { shouldShowLandingPage: boolean }) {\n const {\n createSession,\n encodedSession,\n onClearAction,\n getAIStudioAgents,\n hasRequestInProgress,\n hostAppName,\n isAIStudioAgentSelectorEnabled,\n isLoading,\n isResetChatEnabled,\n onSelectAgent,\n questions,\n shouldShowLandingPage,\n sendQuestion,\n stopQuestion,\n ...rest\n } = props;\n const { formatMessage } = useIntl();\n const isSessionInitiated = React.useRef<boolean>(false);\n const [isModalOpen, setIsModalOpen] = React.useState(false);\n const {\n cache,\n contentName,\n elementId,\n fileExtension,\n isFeedbackEnabled,\n isFeedbackFormEnabled,\n isStopResponseEnabled,\n items,\n itemSize,\n onFeedbackFormSubmit,\n onUserInteraction,\n recordAction,\n setCacheValue,\n shouldFeedbackFormIncludeFeedbackText,\n shouldPreinitSession,\n } = React.useContext(BoxAISidebarContext);\n const { agents, requestState, selectedAgent } = useAgents();\n const { questions: cacheQuestions } = cache;\n\n if (cache.shouldShowLandingPage !== shouldShowLandingPage) {\n setCacheValue('shouldShowLandingPage', shouldShowLandingPage);\n }\n\n if (cache.encodedSession !== encodedSession) {\n setCacheValue('encodedSession', encodedSession);\n }\n\n if (cache.questions !== questions) {\n setCacheValue('questions', questions);\n }\n\n if (cache.agents.selectedAgent !== selectedAgent) {\n setCacheValue('agents', { agents, requestState, selectedAgent });\n }\n\n const handleUserIntentToUseAI = (userHasInteracted: boolean = false) => {\n // Create session if not already created or loading\n if (!shouldPreinitSession && !encodedSession && !isLoading && createSession) {\n createSession(true, false);\n }\n if (userHasInteracted && onUserInteraction) {\n onUserInteraction();\n }\n };\n\n const handleModalClose = () => {\n setIsModalOpen(false);\n };\n\n const handleSwitchToModalClick = () => {\n handleUserIntentToUseAI();\n setIsModalOpen(true);\n };\n\n React.useEffect(() => {\n if (shouldPreinitSession && !encodedSession && createSession) {\n createSession(true, true);\n }\n\n if (\n encodedSession &&\n cacheQuestions.length > 0 &&\n cacheQuestions[cacheQuestions.length - 1].isCompleted === false\n ) {\n // if we have cache with question that is not completed resend it to trigger an API\n sendQuestion({ prompt: cacheQuestions[cacheQuestions.length - 1].prompt });\n }\n\n if (recordAction) {\n recordAction({\n action: 'programmatic',\n component: 'sidebar',\n feature: 'answers',\n target: 'loaded',\n data: {\n items: items.map(item => {\n return { status: item.status, fileType: item.fileType };\n }),\n },\n });\n }\n\n return () => {\n // stop API request on unmount (e.g. during switching to another tab)\n stopQuestion();\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // Resend the last question (if it was sent before session loaded) after (re-)initializing session\n React.useEffect(() => {\n const lastQuestion = cacheQuestions[cacheQuestions.length - 1];\n if (!shouldPreinitSession && !isSessionInitiated.current && encodedSession && lastQuestion?.isLoading) {\n sendQuestion(lastQuestion, selectedAgent, false);\n isSessionInitiated.current = true;\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [encodedSession]);\n\n const renderBoxAISidebarTitle = () => {\n return (\n <div className=\"bcs-BoxAISidebar-title-part\">\n <BoxAISidebarTitle isAIStudioAgentSelectorEnabled={isAIStudioAgentSelectorEnabled} />\n {isAIStudioAgentSelectorEnabled && (\n <div className=\"bcs-BoxAISidebar-agentSelector\">\n <BoxAiAgentSelectorWithApi\n disabled={hasRequestInProgress}\n fetcher={getAIStudioAgents}\n hostAppName={hostAppName}\n onAgentsListOpen={handleUserIntentToUseAI}\n onSelectAgent={onSelectAgent}\n recordAction={recordAction}\n shouldHideAgentSelectorOnLoad\n variant=\"sidebar\"\n />\n </div>\n )}\n </div>\n );\n };\n\n const renderActions = () => (\n <>\n {renderBoxAISidebarTitle()}\n {isResetChatEnabled && <ClearConversationButton onClick={onClearAction} />}\n <Tooltip content={formatMessage(messages.sidebarBoxAISwitchToModalView)} variant=\"standard\">\n <IconButton\n aria-label={formatMessage(messages.sidebarBoxAISwitchToModalView)}\n className=\"bcs-BoxAISidebar-expand\"\n data-target-id=\"IconButton-expandBoxAISidebar\"\n icon={ArrowsExpand}\n onClick={handleSwitchToModalClick}\n size=\"small\"\n />\n </Tooltip>\n </>\n );\n\n return (\n <>\n <SidebarContent\n actions={renderActions()}\n className={classNames('bcs-BoxAISidebar', { 'with-modal-open': isModalOpen })}\n elementId={elementId}\n sidebarView={SIDEBAR_VIEW_BOXAI}\n >\n <div className=\"bcs-BoxAISidebar-content\">\n <BoxAiContentAnswers\n className=\"bcs-BoxAISidebar-contentAnswers\"\n contentName={contentName}\n contentType={formatMessage(messages.sidebarBoxAIContent)}\n hostAppName={hostAppName}\n isAIStudioAgentSelectorEnabled={isAIStudioAgentSelectorEnabled}\n isFeedbackEnabled={isFeedbackEnabled}\n isFeedbackFormEnabled={isFeedbackFormEnabled}\n isStopResponseEnabled={isStopResponseEnabled}\n items={items}\n questions={questions}\n onFeedbackFormSubmit={onFeedbackFormSubmit}\n onUserIntentToUseAI={handleUserIntentToUseAI}\n shouldFeedbackFormIncludeFeedbackText={shouldFeedbackFormIncludeFeedbackText}\n shouldShowLandingPage={cache.shouldShowLandingPage}\n showLoadingIndicator={isLoading && shouldPreinitSession}\n stopQuestion={stopQuestion}\n submitQuestion={sendQuestion}\n variant=\"sidebar\"\n recordAction={recordAction}\n {...rest}\n />\n </div>\n </SidebarContent>\n <IntelligenceModal\n contentName={contentName}\n contentType={formatMessage(messages.sidebarBoxAIContent)}\n extension={fileExtension}\n getAIStudioAgents={getAIStudioAgents}\n hasRequestInProgress={hasRequestInProgress}\n hostAppName={hostAppName}\n isAIStudioAgentSelectorEnabled={isAIStudioAgentSelectorEnabled}\n isFeedbackEnabled={isFeedbackEnabled}\n isFeedbackFormEnabled={isFeedbackFormEnabled}\n isResetChatEnabled={isResetChatEnabled}\n isStopResponseEnabled={isStopResponseEnabled}\n items={items}\n itemSize={itemSize}\n onClearAction={onClearAction}\n onFeedbackFormSubmit={onFeedbackFormSubmit}\n onOpenChange={handleModalClose}\n onSelectAgent={onSelectAgent}\n onUserIntentToUseAI={handleUserIntentToUseAI}\n open={isModalOpen}\n questions={questions}\n recordAction={isModalOpen ? recordAction : undefined}\n shouldFeedbackFormIncludeFeedbackText={shouldFeedbackFormIncludeFeedbackText}\n shouldShowLandingPage={cache.shouldShowLandingPage}\n showLoadingIndicator={false}\n stopPropagationOnEsc\n stopQuestion={stopQuestion}\n submitQuestion={sendQuestion}\n variant=\"collapsible\"\n {...rest}\n shouldRenderProviders={false}\n />\n </>\n );\n}\n\nexport { BoxAISidebarContent as BoxAISidebarComponent };\n\nconst BoxAISidebarContentDefaultExport: typeof withAPIContext = flow([\n withLogger(ORIGIN_BOXAI_SIDEBAR),\n withErrorBoundary(ORIGIN_BOXAI_SIDEBAR),\n withAPIContext,\n withApiWrapper, // returns only props for Box AI, keep it at the end\n])(BoxAISidebarContent);\n\nexport default BoxAISidebarContentDefaultExport;\n"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,OAAOC,IAAI,MAAM,aAAa;AAC9B,SAASC,OAAO,QAAQ,YAAY;AACpC,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,yBAAyB,EAAEC,SAAS,QAAQ,4BAA4B;AACjF,SAASC,UAAU,EAAEC,OAAO,QAAQ,oBAAoB;AACxD,SAASC,YAAY,QAAQ,sCAAsC;AACnE,SACIC,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SAAS,EAAE3D,aAAc;IACzBvB,iBAAiB,EAAEA,iBAAkB;IACrCC,oBAAoB,EAAEA,oBAAqB;IAC3CC,WAAW,EAAEA,WAAY;IACzBC,8BAA8B,EAAEA,8BAA+B;IAC/DqB,iBAAiB,EAAEA,iBAAkB;IACrCC,qBAAqB,EAAEA,qBAAsB;IAC7CpB,kBAAkB,EAAEA,kBAAmB;IACvCqB,qBAAqB,EAAEA,qBAAsB;IAC7CC,KAAK,EAAEA,KAAM;IACbC,QAAQ,EAAEA,QAAS;IACnB7B,aAAa,EAAEA,aAAc;IAC7B8B,oBAAoB,EAAEA,oBAAqB;IAC3CsD,YAAY,EAAEzC,gBAAiB;IAC/BpC,aAAa,EAAEA,aAAc;IAC7ByE,mBAAmB,EAAEvC,uBAAwB;IAC7C4C,IAAI,EAAEnE,WAAY;IAClBV,SAAS,EAAEA,SAAU;IACrBwB,YAAY,EAAEd,WAAW,GAAGc,YAAY,GAAGsD,SAAU;IACrDpD,qCAAqC,EAAEA,qCAAsC;IAC7EzB,qBAAqB,EAAEY,KAAK,CAACZ,qBAAsB;IACnDwE,oBAAoB,EAAE,KAAM;IAC5BM,oBAAoB;IACpB5E,YAAY,EAAEA,YAAa;IAC3BuE,cAAc,EAAExE,YAAa;IAC7ByD,OAAO,EAAC;EAAa,GACjBvD,IAAI;IACR4E,qBAAqB,EAAE;EAAM,EAChC,CACH,CAAC;AAEX;AAEA,SAAS5F,mBAAmB,IAAI6F,qBAAqB;AAErD,MAAMC,gCAAuD,GAAGtH,IAAI,CAAC,CACjEe,UAAU,CAACC,oBAAoB,CAAC,EAChCF,iBAAiB,CAACE,oBAAoB,CAAC,EACvCH,cAAc,EACdF,cAAc,CAAE;AAAA,CACnB,CAAC,CAACa,mBAAmB,CAAC;AAEvB,eAAe8F,gCAAgC","ignoreList":[]}
1
+ {"version":3,"file":"BoxAISidebarContent.js","names":["React","flow","useIntl","classNames","BoxAiAgentSelectorWithApi","useAgents","IconButton","Tooltip","ArrowsExpand","BoxAiContentAnswers","ClearConversationButton","IntelligenceModal","withApiWrapper","SidebarContent","withAPIContext","withErrorBoundary","withLogger","ORIGIN_BOXAI_SIDEBAR","SIDEBAR_VIEW_BOXAI","EVENT_JS_READY","mark","BoxAISidebarContext","BoxAISidebarTitle","messages","MARK_NAME_JS_READY","BoxAISidebarContent","props","createSession","encodedSession","onClearAction","onSelectedAgentCallback","getAIStudioAgents","hasRequestInProgress","hostAppName","isAIStudioAgentSelectorEnabled","isLoading","isResetChatEnabled","onSelectAgent","questions","shouldShowLandingPage","sendQuestion","stopQuestion","rest","_objectWithoutProperties","_excluded","formatMessage","isSessionInitiated","useRef","isModalOpen","setIsModalOpen","useState","cache","contentName","elementId","fileExtension","isFeedbackEnabled","isFeedbackFormEnabled","isStopResponseEnabled","items","itemSize","onFeedbackFormSubmit","onUserInteraction","recordAction","setCacheValue","shouldFeedbackFormIncludeFeedbackText","shouldPreinitSession","useContext","agents","requestState","selectedAgent","cacheQuestions","handleUserIntentToUseAI","userHasInteracted","handleModalClose","handleSwitchToModalClick","useEffect","length","isCompleted","prompt","action","component","feature","target","data","map","item","status","fileType","lastQuestion","current","id","renderBoxAISidebarTitle","createElement","className","disabled","fetcher","onAgentsListOpen","shouldHideAgentSelectorOnLoad","variant","renderActions","Fragment","onClick","content","sidebarBoxAISwitchToModalView","icon","size","actions","sidebarView","_extends","contentType","sidebarBoxAIContent","onUserIntentToUseAI","showLoadingIndicator","submitQuestion","extension","onOpenChange","open","undefined","stopPropagationOnEsc","shouldRenderProviders","BoxAISidebarComponent","BoxAISidebarContentDefaultExport"],"sources":["../../../src/elements/content-sidebar/BoxAISidebarContent.tsx"],"sourcesContent":["/**\n * @file Box AI sidebar component\n * @author Box\n */\nimport * as React from 'react';\nimport flow from 'lodash/flow';\nimport { useIntl } from 'react-intl';\nimport classNames from 'classnames';\nimport { BoxAiAgentSelectorWithApi, useAgents, type AgentType } from '@box/box-ai-agent-selector';\nimport { IconButton, Tooltip } from '@box/blueprint-web';\nimport { ArrowsExpand } from '@box/blueprint-web-assets/icons/Fill';\nimport {\n BoxAiContentAnswers,\n ClearConversationButton,\n IntelligenceModal,\n withApiWrapper,\n type ApiWrapperWithInjectedProps,\n} from '@box/box-ai-content-answers';\nimport SidebarContent from './SidebarContent';\nimport { withAPIContext } from '../common/api-context';\nimport { withErrorBoundary } from '../common/error-boundary';\nimport { withLogger } from '../common/logger';\nimport { ORIGIN_BOXAI_SIDEBAR, SIDEBAR_VIEW_BOXAI } from '../../constants';\nimport { EVENT_JS_READY } from '../common/logger/constants';\nimport { mark } from '../../utils/performance';\nimport { BoxAISidebarContext } from './context/BoxAISidebarContext';\nimport BoxAISidebarTitle from './BoxAISidebarTitle';\n\nimport messages from '../common/messages';\n\nimport './BoxAISidebar.scss';\n\nconst MARK_NAME_JS_READY: string = `${ORIGIN_BOXAI_SIDEBAR}_${EVENT_JS_READY}`;\n\nmark(MARK_NAME_JS_READY);\n\nfunction BoxAISidebarContent(\n props: ApiWrapperWithInjectedProps & {\n onSelectedAgentCallback: (selectedAgent: AgentType) => void;\n shouldShowLandingPage: boolean;\n },\n) {\n const {\n createSession,\n encodedSession,\n onClearAction,\n onSelectedAgentCallback,\n getAIStudioAgents,\n hasRequestInProgress,\n hostAppName,\n isAIStudioAgentSelectorEnabled,\n isLoading,\n isResetChatEnabled,\n onSelectAgent,\n questions,\n shouldShowLandingPage,\n sendQuestion,\n stopQuestion,\n ...rest\n } = props;\n const { formatMessage } = useIntl();\n const isSessionInitiated = React.useRef<boolean>(false);\n const [isModalOpen, setIsModalOpen] = React.useState(false);\n const {\n cache,\n contentName,\n elementId,\n fileExtension,\n isFeedbackEnabled,\n isFeedbackFormEnabled,\n isStopResponseEnabled,\n items,\n itemSize,\n onFeedbackFormSubmit,\n onUserInteraction,\n recordAction,\n setCacheValue,\n shouldFeedbackFormIncludeFeedbackText,\n shouldPreinitSession,\n } = React.useContext(BoxAISidebarContext);\n const { agents, requestState, selectedAgent } = useAgents();\n const { questions: cacheQuestions } = cache;\n\n if (cache.shouldShowLandingPage !== shouldShowLandingPage) {\n setCacheValue('shouldShowLandingPage', shouldShowLandingPage);\n }\n\n if (cache.encodedSession !== encodedSession) {\n setCacheValue('encodedSession', encodedSession);\n }\n\n if (cache.questions !== questions) {\n setCacheValue('questions', questions);\n }\n\n if (cache.agents.selectedAgent !== selectedAgent) {\n setCacheValue('agents', { agents, requestState, selectedAgent });\n }\n\n const handleUserIntentToUseAI = (userHasInteracted: boolean = false) => {\n // Create session if not already created or loading\n if (!shouldPreinitSession && !encodedSession && !isLoading && createSession) {\n createSession(true, false);\n }\n if (userHasInteracted && onUserInteraction) {\n onUserInteraction();\n }\n };\n\n const handleModalClose = () => {\n setIsModalOpen(false);\n };\n\n const handleSwitchToModalClick = () => {\n handleUserIntentToUseAI();\n setIsModalOpen(true);\n };\n\n React.useEffect(() => {\n if (shouldPreinitSession && !encodedSession && createSession) {\n createSession(true, true);\n }\n\n if (\n encodedSession &&\n cacheQuestions.length > 0 &&\n cacheQuestions[cacheQuestions.length - 1].isCompleted === false\n ) {\n // if we have cache with question that is not completed resend it to trigger an API\n sendQuestion({ prompt: cacheQuestions[cacheQuestions.length - 1].prompt });\n }\n\n if (recordAction) {\n recordAction({\n action: 'programmatic',\n component: 'sidebar',\n feature: 'answers',\n target: 'loaded',\n data: {\n items: items.map(item => {\n return { status: item.status, fileType: item.fileType };\n }),\n },\n });\n }\n\n return () => {\n // stop API request on unmount (e.g. during switching to another tab)\n stopQuestion();\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // Resend the last question (if it was sent before session loaded) after (re-)initializing session\n React.useEffect(() => {\n const lastQuestion = cacheQuestions[cacheQuestions.length - 1];\n if (!shouldPreinitSession && !isSessionInitiated.current && encodedSession && lastQuestion?.isLoading) {\n sendQuestion(lastQuestion, selectedAgent, false);\n isSessionInitiated.current = true;\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [encodedSession]);\n\n React.useEffect(() => {\n onSelectedAgentCallback?.(selectedAgent);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [selectedAgent?.id]);\n\n const renderBoxAISidebarTitle = () => {\n return (\n <div className=\"bcs-BoxAISidebar-title-part\">\n <BoxAISidebarTitle isAIStudioAgentSelectorEnabled={isAIStudioAgentSelectorEnabled} />\n {isAIStudioAgentSelectorEnabled && (\n <div className=\"bcs-BoxAISidebar-agentSelector\">\n <BoxAiAgentSelectorWithApi\n disabled={hasRequestInProgress}\n fetcher={getAIStudioAgents}\n hostAppName={hostAppName}\n onAgentsListOpen={handleUserIntentToUseAI}\n onSelectAgent={onSelectAgent}\n recordAction={recordAction}\n shouldHideAgentSelectorOnLoad\n variant=\"sidebar\"\n />\n </div>\n )}\n </div>\n );\n };\n\n const renderActions = () => (\n <>\n {renderBoxAISidebarTitle()}\n {isResetChatEnabled && <ClearConversationButton onClick={onClearAction} />}\n <Tooltip content={formatMessage(messages.sidebarBoxAISwitchToModalView)} variant=\"standard\">\n <IconButton\n aria-label={formatMessage(messages.sidebarBoxAISwitchToModalView)}\n className=\"bcs-BoxAISidebar-expand\"\n data-target-id=\"IconButton-expandBoxAISidebar\"\n icon={ArrowsExpand}\n onClick={handleSwitchToModalClick}\n size=\"small\"\n />\n </Tooltip>\n </>\n );\n\n return (\n <>\n <SidebarContent\n actions={renderActions()}\n className={classNames('bcs-BoxAISidebar', { 'with-modal-open': isModalOpen })}\n elementId={elementId}\n sidebarView={SIDEBAR_VIEW_BOXAI}\n >\n <div className=\"bcs-BoxAISidebar-content\">\n <BoxAiContentAnswers\n className=\"bcs-BoxAISidebar-contentAnswers\"\n contentName={contentName}\n contentType={formatMessage(messages.sidebarBoxAIContent)}\n hostAppName={hostAppName}\n isAIStudioAgentSelectorEnabled={isAIStudioAgentSelectorEnabled}\n isFeedbackEnabled={isFeedbackEnabled}\n isFeedbackFormEnabled={isFeedbackFormEnabled}\n isStopResponseEnabled={isStopResponseEnabled}\n items={items}\n questions={questions}\n onFeedbackFormSubmit={onFeedbackFormSubmit}\n onUserIntentToUseAI={handleUserIntentToUseAI}\n shouldFeedbackFormIncludeFeedbackText={shouldFeedbackFormIncludeFeedbackText}\n shouldShowLandingPage={cache.shouldShowLandingPage}\n showLoadingIndicator={isLoading && shouldPreinitSession}\n stopQuestion={stopQuestion}\n submitQuestion={sendQuestion}\n variant=\"sidebar\"\n recordAction={recordAction}\n {...rest}\n />\n </div>\n </SidebarContent>\n <IntelligenceModal\n contentName={contentName}\n contentType={formatMessage(messages.sidebarBoxAIContent)}\n extension={fileExtension}\n getAIStudioAgents={getAIStudioAgents}\n hasRequestInProgress={hasRequestInProgress}\n hostAppName={hostAppName}\n isAIStudioAgentSelectorEnabled={isAIStudioAgentSelectorEnabled}\n isFeedbackEnabled={isFeedbackEnabled}\n isFeedbackFormEnabled={isFeedbackFormEnabled}\n isResetChatEnabled={isResetChatEnabled}\n isStopResponseEnabled={isStopResponseEnabled}\n items={items}\n itemSize={itemSize}\n onClearAction={onClearAction}\n onFeedbackFormSubmit={onFeedbackFormSubmit}\n onOpenChange={handleModalClose}\n onSelectAgent={onSelectAgent}\n onUserIntentToUseAI={handleUserIntentToUseAI}\n open={isModalOpen}\n questions={questions}\n recordAction={isModalOpen ? recordAction : undefined}\n shouldFeedbackFormIncludeFeedbackText={shouldFeedbackFormIncludeFeedbackText}\n shouldShowLandingPage={cache.shouldShowLandingPage}\n showLoadingIndicator={false}\n stopPropagationOnEsc\n stopQuestion={stopQuestion}\n submitQuestion={sendQuestion}\n variant=\"collapsible\"\n {...rest}\n shouldRenderProviders={false}\n />\n </>\n );\n}\n\nexport { BoxAISidebarContent as BoxAISidebarComponent };\n\nconst BoxAISidebarContentDefaultExport: typeof withAPIContext = flow([\n withLogger(ORIGIN_BOXAI_SIDEBAR),\n withErrorBoundary(ORIGIN_BOXAI_SIDEBAR),\n withAPIContext,\n withApiWrapper, // returns only props for Box AI, keep it at the end\n])(BoxAISidebarContent);\n\nexport default BoxAISidebarContentDefaultExport;\n"],"mapp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AAa;IAC7B0D,OAAO,EAAC;EAAa,GACjBxD,IAAI;IACR6E,qBAAqB,EAAE;EAAM,EAChC,CACH,CAAC;AAEX;AAEA,SAAS9F,mBAAmB,IAAI+F,qBAAqB;AAErD,MAAMC,gCAAuD,GAAGxH,IAAI,CAAC,CACjEe,UAAU,CAACC,oBAAoB,CAAC,EAChCF,iBAAiB,CAACE,oBAAoB,CAAC,EACvCH,cAAc,EACdF,cAAc,CAAE;AAAA,CACnB,CAAC,CAACa,mBAAmB,CAAC;AAEvB,eAAegG,gCAAgC","ignoreList":[]}
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import ContextMenu from './ContextMenu';
3
- import '../../../examples/styles/ContextMenuExamples.scss';
3
+ import './ContextMenuExample.scss';
4
4
  export declare const basic: () => React.JSX.Element;
5
5
  export declare const withSubmenu: () => React.JSX.Element;
6
6
  declare const _default: {
@@ -0,0 +1,9 @@
1
+ import * as React from 'react';
2
+ declare class ContextMenuWithSubmenuExample extends React.Component {
3
+ state: {
4
+ rightBoundaryElement: any;
5
+ bottomBoundaryElement: any;
6
+ };
7
+ render(): React.JSX.Element;
8
+ }
9
+ export default ContextMenuWithSubmenuExample;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const SelectorDropdownExample: React.FC;
3
+ export default SelectorDropdownExample;
@@ -3,10 +3,12 @@
3
3
  * @author Box
4
4
  */
5
5
  import * as React from 'react';
6
+ import { type AgentType } from '@box/box-ai-agent-selector';
6
7
  import { type ApiWrapperWithInjectedProps } from '@box/box-ai-content-answers';
7
8
  import { withAPIContext } from '../common/api-context';
8
9
  import './BoxAISidebar.scss';
9
10
  declare function BoxAISidebarContent(props: ApiWrapperWithInjectedProps & {
11
+ onSelectedAgentCallback: (selectedAgent: AgentType) => void;
10
12
  shouldShowLandingPage: boolean;
11
13
  }): React.JSX.Element;
12
14
  export { BoxAISidebarContent as BoxAISidebarComponent };
package/es/types.d.ts CHANGED
@@ -1,2 +1 @@
1
1
  export * from './src/types';
2
- export * from './examples/types';
package/eslint.config.js CHANGED
@@ -17,7 +17,6 @@ module.exports = [
17
17
  'i18n/',
18
18
  'node_modules/',
19
19
  'reports/',
20
- 'styleguide/',
21
20
  '**/__snapshots__/',
22
21
  '**/*.json',
23
22
  '**/*.png',
package/i18n/pl-PL.js CHANGED
@@ -963,10 +963,10 @@ export default {
963
963
  "boxui.unifiedShare.peopleInEnterpriseName": "Osoby w przedsiębiorstwie {enterpriseName}",
964
964
  "boxui.unifiedShare.peopleInItemCanAccessFile": "Tylko zaproszeni użytkownicy mogą uzyskać dostęp do tego pliku",
965
965
  "boxui.unifiedShare.peopleInItemCanAccessFolder": "Tylko zaproszeni użytkownicy mogą uzyskać dostęp do tego folderu",
966
- "boxui.unifiedShare.peopleInItemCanAccessHub": "Tylko zaproszone osoby mogą uzyskać dostęp do tego centrum",
966
+ "boxui.unifiedShare.peopleInItemCanAccessHub": "Only invited people can access this hub",
967
967
  "boxui.unifiedShare.peopleInSpecifiedCompanyCanAccessFile": "Wszyscy użytkownicy w firmie {company} dysponujący łączem lub użytkownicy zaproszeni do tego pliku mogą uzyskać dostęp",
968
968
  "boxui.unifiedShare.peopleInSpecifiedCompanyCanAccessFolder": "Wszyscy użytkownicy w firmie {company} dysponujący łączem lub użytkownicy zaproszeni do tego folderu mogą uzyskać dostęp",
969
- "boxui.unifiedShare.peopleInSpecifiedCompanyCanAccessHub": "Każda osoba w {company} posiadająca łącze lub osoby zaproszone do tego centrum mogą uzyskać dostęp",
969
+ "boxui.unifiedShare.peopleInSpecifiedCompanyCanAccessHub": "Anyone at {company} with the link or people invited to this hub can access",
970
970
  "boxui.unifiedShare.peopleInThisFile": "Tylko zaproszeni użytkownicy",
971
971
  "boxui.unifiedShare.peopleInThisFolder": "Tylko zaproszeni użytkownicy",
972
972
  "boxui.unifiedShare.peopleInYourCompany": "Osoby w Twojej firmie",
@@ -1927,13 +1927,13 @@ boxui.unifiedShare.peopleInItemCanAccessFile = Tylko zaproszeni użytkownicy mog
1927
1927
  # Description of a collaborator-only shared link for a folder
1928
1928
  boxui.unifiedShare.peopleInItemCanAccessFolder = Tylko zaproszeni użytkownicy mogą uzyskać dostęp do tego folderu
1929
1929
  # Description of a collaborator-only shared link for a hub
1930
- boxui.unifiedShare.peopleInItemCanAccessHub = Tylko zaproszone osoby mogą uzyskać dostęp do tego centrum
1930
+ boxui.unifiedShare.peopleInItemCanAccessHub = Only invited people can access this hub
1931
1931
  # Description of a specific company shared link for a file. {company} is the company name
1932
1932
  boxui.unifiedShare.peopleInSpecifiedCompanyCanAccessFile = Wszyscy użytkownicy w firmie {company} dysponujący łączem lub użytkownicy zaproszeni do tego pliku mogą uzyskać dostęp
1933
1933
  # Description of a specific company shared link for a folder. {company} is the company name
1934
1934
  boxui.unifiedShare.peopleInSpecifiedCompanyCanAccessFolder = Wszyscy użytkownicy w firmie {company} dysponujący łączem lub użytkownicy zaproszeni do tego folderu mogą uzyskać dostęp
1935
1935
  # Description of a specific company shared link for a hub. {company} is the company name
1936
- boxui.unifiedShare.peopleInSpecifiedCompanyCanAccessHub = Każda osoba w {company} posiadająca łącze lub osoby zaproszone do tego centrum mogą uzyskać dostęp
1936
+ boxui.unifiedShare.peopleInSpecifiedCompanyCanAccessHub = Anyone at {company} with the link or people invited to this hub can access
1937
1937
  # Label for "People in this file" option
1938
1938
  boxui.unifiedShare.peopleInThisFile = Tylko zaproszeni użytkownicy
1939
1939
  # Label for "People in this folder" option
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "box-ui-elements",
3
- "version": "23.4.0-beta.6",
3
+ "version": "23.4.0-beta.7",
4
4
  "description": "Box UI Elements",
5
5
  "author": "Box (https://www.box.com/)",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -50,20 +50,16 @@
50
50
  "build:prod:analyze": "BUNDLE_ANALYSIS=true npm-run-all setup build:prod:npm",
51
51
  "build:prod:es": "BABEL_ENV=npm NODE_ENV=production yarn build:es --source-maps --ignore \"**/*.d.ts,**/__tests__/**,**/__mocks__/**\"",
52
52
  "build:prod:dist": "NODE_ENV=production webpack --config scripts/webpack.config.js --mode production",
53
- "build:prod:examples": "LANGUAGE=en-US REACT=true NODE_ENV=production node --max_old_space_size=8192 node_modules/.bin/styleguidist build --config scripts/styleguide.config.js --mode production",
54
53
  "build:prod:npm": "BABEL_ENV=production OUTPUT=dist LANGUAGE=en-US REACT=true yarn build:prod:dist",
55
54
  "build:prod:storybook": "LANGUAGE=en-US REACT=true BROWSERSLIST_ENV=production BABEL_ENV=development NODE_ENV=development storybook build -c .storybook -o storybook",
56
55
  "build:sync": "LANGUAGE=en-US BABEL_ENV=development NODE_ENV=development RSYNC=true webpack --config scripts/webpack.config.js --mode development",
57
56
  "chromatic": "chromatic",
58
- "clean": "rm -rf dist es i18n/json i18n/*.js reports styleguide",
57
+ "clean": "rm -rf dist es i18n/json i18n/*.js reports storybook",
59
58
  "copy:flow": "flow-copy-source --ignore \"**/__tests__/**\" --ignore \"**/__mocks__/**\" --ignore \"**/*.ts\" ./src ./es && copyfiles './src/**/*.js.flow' es --up 1",
60
59
  "copy:styles": "copyfiles './src/**/*.scss' es --up 1",
61
60
  "cy:open": "yarn cy:wait; yarn cypress open",
62
- "cy:open:sbk": "yarn cy:wait:sbk; yarn cypress open",
63
- "cy:run": "yarn cy:wait; yarn cypress run --spec \"test/integration/**/*.cy.js\"",
64
- "cy:run:sbk": "yarn cy:wait:sbk; yarn cypress run --spec \"test/integration/**/*.e2e.cy.js\"",
65
- "cy:wait": "wait-on http-get://localhost:6060/#",
66
- "cy:wait:sbk": "wait-on http-get://localhost:6061/iframe.html",
61
+ "cy:run": "yarn cy:wait; yarn cypress run --spec \"test/integration/**/*.e2e.cy.js\"",
62
+ "cy:wait": "wait-on http-get://localhost:6060/iframe.html",
67
63
  "lint": "npm-run-all lint:*",
68
64
  "lint:js": "eslint --max-warnings=0 .",
69
65
  "lint:ts": "tsc",
@@ -76,15 +72,13 @@
76
72
  "release:next": "DIST=next BRANCH=next ./scripts/release.sh",
77
73
  "release:cdn": "yarn setup; node ./scripts/prod.js",
78
74
  "setup": "yarn install --frozen-lockfile; npm-run-all clean build:i18n",
79
- "start": "npm-run-all setup start:examples",
80
- "start:dev": "yarn setup; LANGUAGE=en-US BABEL_ENV=development NODE_ENV=development node --max_old_space_size=8192 node_modules/.bin/webpack-dev-server --config scripts/webpack.config.js --mode development",
81
- "start:examples": "EXAMPLES=true LANGUAGE=en-US REACT=true BABEL_ENV=development NODE_ENV=development node --max_old_space_size=8192 node_modules/.bin/styleguidist server --config scripts/styleguide.config.js --mode development",
75
+ "start": "npm-run-all setup start:storybook",
82
76
  "start:npm": "yarn setup; yarn build:dev:es",
83
- "start:storybook": "LANGUAGE=en-US REACT=true BABEL_ENV=development NODE_ENV=development storybook dev -p 6061",
77
+ "start:storybook": "LANGUAGE=en-US REACT=true BABEL_ENV=development NODE_ENV=development storybook dev -p 6060",
84
78
  "start:storybook:ci": "yarn start:storybook --ci",
85
79
  "test": "BABEL_ENV=test NODE_ENV=test yarn jest -c scripts/jest/jest.config.js",
86
- "test:e2e": "BROWSERSLIST_ENV=test npm-run-all -p -r start:storybook cy:run:sbk",
87
- "test:e2e:open": "BROWSERSLIST_ENV=test npm-run-all -p -r start:examples cy:open",
80
+ "test:e2e": "BROWSERSLIST_ENV=test npm-run-all -p -r start cy:run",
81
+ "test:e2e:open": "BROWSERSLIST_ENV=test npm-run-all -p -r start cy:open",
88
82
  "ts:defs": "tsc --declaration --emitDeclarationOnly --declarationDir es --noEmit false"
89
83
  },
90
84
  "browserslist": {
@@ -271,7 +265,6 @@
271
265
  "react-responsive": "^10.0.0",
272
266
  "react-router-dom": "^5.3.4",
273
267
  "react-scrollbars-custom": "^4.0.21",
274
- "react-styleguidist": "^13.1.3",
275
268
  "react-tether": "^1.0.5",
276
269
  "react-textarea-autosize": "^8.5.3",
277
270
  "regenerator-runtime": "^0.14.1",
@@ -299,7 +292,7 @@
299
292
  "webpack": "^5.92.0",
300
293
  "webpack-bundle-analyzer": "^4.10.2",
301
294
  "webpack-cli": "^5.1.4",
302
- "webpack-dev-server": "^5.0.4",
295
+ "webpack-dev-server": "^5.2.1",
303
296
  "worker-farm": "^1.7.0"
304
297
  },
305
298
  "peerDependencies": {
@@ -6,9 +6,9 @@ import MenuItem from '../menu/MenuItem';
6
6
  import ContextMenu from './ContextMenu';
7
7
  import notes from './ContextMenu.stories.md';
8
8
 
9
- import ContextMenuWithSubmenuWithBoundariesElementExample from '../../../examples/src/ContextMenuWithSubmenuWithBoundariesElementExample';
9
+ import ContextMenuWithSubmenuExample from './ContextMenuWithSubmenuExample';
10
10
 
11
- import '../../../examples/styles/ContextMenuExamples.scss';
11
+ import './ContextMenuExample.scss';
12
12
 
13
13
  export const basic = () => (
14
14
  <ContextMenu>
@@ -20,7 +20,7 @@ export const basic = () => (
20
20
  </ContextMenu>
21
21
  );
22
22
 
23
- export const withSubmenu = () => <ContextMenuWithSubmenuWithBoundariesElementExample />;
23
+ export const withSubmenu = () => <ContextMenuWithSubmenuExample />;
24
24
 
25
25
  export default {
26
26
  title: 'Components/ContextMenu',
@@ -0,0 +1,4 @@
1
+ .context-menu-example-target {
2
+ border: 1px solid black;
3
+ padding: 10px;
4
+ }