@atlaskit/editor-plugin-toolbar 0.4.5 → 0.4.6

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/editor-plugin-toolbar
2
2
 
3
+ ## 0.4.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [`51f3f2db61f6e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/51f3f2db61f6e) -
8
+ Update toolbar config across plugins
9
+ - Updated dependencies
10
+
3
11
  ## 0.4.5
4
12
 
5
13
  ### Patch Changes
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.PrimaryToolbar = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _toolbar = require("@atlaskit/editor-common/toolbar");
10
+ var _editorToolbar = require("@atlaskit/editor-toolbar");
11
+ var PrimaryToolbar = exports.PrimaryToolbar = function PrimaryToolbar(_ref) {
12
+ var children = _ref.children;
13
+ var _useEditorToolbar = (0, _toolbar.useEditorToolbar)(),
14
+ editorAppearance = _useEditorToolbar.editorAppearance;
15
+ return /*#__PURE__*/_react.default.createElement(_editorToolbar.PrimaryToolbar, {
16
+ label: "Primary Toolbar",
17
+ reducedBreakpoints: editorAppearance !== 'full-page'
18
+ }, children);
19
+ };
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.TextCollapsedMenu = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _reactIntlNext = require("react-intl-next");
10
+ var _messages = require("@atlaskit/editor-common/messages");
11
+ var _editorToolbar = require("@atlaskit/editor-toolbar");
12
+ /**
13
+ * Basic version of existing 'Text Styles' Menu - which doesn't dynamically change icon
14
+ * and is also placeholder to render all other menus in the collapsed state.
15
+ */
16
+ var TextCollapsedMenu = exports.TextCollapsedMenu = function TextCollapsedMenu(_ref) {
17
+ var children = _ref.children;
18
+ var _useIntl = (0, _reactIntlNext.useIntl)(),
19
+ formatMessage = _useIntl.formatMessage;
20
+ return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarTooltip, {
21
+ content: formatMessage(_messages.toolbarMessages.textStylesTooltip)
22
+ }, /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownMenu, {
23
+ iconBefore: /*#__PURE__*/_react.default.createElement(_editorToolbar.TextIcon, {
24
+ label: formatMessage(_messages.toolbarMessages.textStylesTooltip),
25
+ size: "small"
26
+ }),
27
+ enableMaxHeight: true
28
+ }, children));
29
+ };
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.getToolbarComponents = void 0;
8
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
8
9
  var _react = _interopRequireDefault(require("react"));
9
10
  var _toolbar = require("@atlaskit/editor-common/toolbar");
10
11
  var _editorToolbar = require("@atlaskit/editor-toolbar");
@@ -12,7 +13,9 @@ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
12
13
  var _consts = require("./consts");
13
14
  var _OverflowMenu = require("./OverflowMenu");
14
15
  var _OverflowSection = require("./OverflowSection");
16
+ var _PrimaryToolbar = require("./PrimaryToolbar");
15
17
  var _Section = require("./Section");
18
+ var _TextCollapsedMenu = require("./TextCollapsedMenu");
16
19
  var getToolbarComponents = exports.getToolbarComponents = function getToolbarComponents(api, disableSelectionToolbar) {
17
20
  var components = [{
18
21
  type: 'toolbar',
@@ -26,10 +29,10 @@ var getToolbarComponents = exports.getToolbarComponents = function getToolbarCom
26
29
  }, {
27
30
  type: 'toolbar',
28
31
  key: _toolbar.TOOLBARS.PRIMARY_TOOLBAR,
29
- component: function component(_ref2) {
32
+ component: (0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_responsive', 'isEnabled', true) ? _PrimaryToolbar.PrimaryToolbar : function (_ref2) {
30
33
  var children = _ref2.children;
31
34
  return /*#__PURE__*/_react.default.createElement(_editorToolbar.PrimaryToolbar, {
32
- label: 'Primary Toolbar'
35
+ label: "Primary Toolbar"
33
36
  }, children);
34
37
  }
35
38
  }, {
@@ -47,6 +50,16 @@ var getToolbarComponents = exports.getToolbarComponents = function getToolbarCom
47
50
  component: function component(_ref3) {
48
51
  var children = _ref3.children,
49
52
  parents = _ref3.parents;
53
+ if ((0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_responsive', 'isEnabled', true)) {
54
+ return /*#__PURE__*/_react.default.createElement(_editorToolbar.Show, {
55
+ above: "md"
56
+ }, /*#__PURE__*/_react.default.createElement(_Section.Section, {
57
+ parents: parents,
58
+ api: api,
59
+ disableSelectionToolbar: disableSelectionToolbar,
60
+ testId: "text-section"
61
+ }, children));
62
+ }
50
63
  return /*#__PURE__*/_react.default.createElement(_Section.Section, {
51
64
  parents: parents,
52
65
  api: api,
@@ -54,7 +67,48 @@ var getToolbarComponents = exports.getToolbarComponents = function getToolbarCom
54
67
  testId: "text-section"
55
68
  }, children);
56
69
  }
70
+ }].concat((0, _toConsumableArray2.default)((0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_responsive', 'isEnabled', true) ? [{
71
+ type: _toolbar.TEXT_SECTION_COLLAPSED.type,
72
+ key: _toolbar.TEXT_SECTION_COLLAPSED.key,
73
+ parents: [{
74
+ type: 'toolbar',
75
+ key: _toolbar.TOOLBARS.INLINE_TEXT_TOOLBAR,
76
+ rank: _toolbar.TOOLBAR_RANK[_toolbar.TEXT_SECTION_COLLAPSED.key]
77
+ }, {
78
+ type: 'toolbar',
79
+ key: _toolbar.TOOLBARS.PRIMARY_TOOLBAR,
80
+ rank: _toolbar.TOOLBAR_RANK[_toolbar.TEXT_SECTION_COLLAPSED.key]
81
+ }],
82
+ component: function component(_ref4) {
83
+ var children = _ref4.children,
84
+ parents = _ref4.parents;
85
+ return /*#__PURE__*/_react.default.createElement(_editorToolbar.Show, {
86
+ below: "md"
87
+ }, /*#__PURE__*/_react.default.createElement(_Section.Section, {
88
+ parents: parents,
89
+ api: api,
90
+ disableSelectionToolbar: disableSelectionToolbar,
91
+ testId: "text-section"
92
+ }, children));
93
+ }
94
+ }, {
95
+ type: _toolbar.TEXT_COLLAPSED_GROUP.type,
96
+ key: _toolbar.TEXT_COLLAPSED_GROUP.key,
97
+ parents: [{
98
+ type: _toolbar.TEXT_SECTION_COLLAPSED.type,
99
+ key: _toolbar.TEXT_SECTION_COLLAPSED.key,
100
+ rank: 100
101
+ }]
57
102
  }, {
103
+ type: _toolbar.TEXT_COLLAPSED_MENU.type,
104
+ key: _toolbar.TEXT_COLLAPSED_MENU.key,
105
+ parents: [{
106
+ type: _toolbar.TEXT_COLLAPSED_GROUP.type,
107
+ key: _toolbar.TEXT_COLLAPSED_GROUP.key,
108
+ rank: 100
109
+ }],
110
+ component: _TextCollapsedMenu.TextCollapsedMenu
111
+ }] : []), [{
58
112
  type: _toolbar.INSERT_BLOCK_SECTION.type,
59
113
  key: _toolbar.INSERT_BLOCK_SECTION.key,
60
114
  parents: [{
@@ -62,9 +116,9 @@ var getToolbarComponents = exports.getToolbarComponents = function getToolbarCom
62
116
  key: _toolbar.TOOLBARS.PRIMARY_TOOLBAR,
63
117
  rank: _toolbar.TOOLBAR_RANK[_toolbar.INSERT_BLOCK_SECTION.key]
64
118
  }],
65
- component: function component(_ref4) {
66
- var children = _ref4.children,
67
- parents = _ref4.parents;
119
+ component: function component(_ref5) {
120
+ var children = _ref5.children,
121
+ parents = _ref5.parents;
68
122
  return /*#__PURE__*/_react.default.createElement(_Section.Section, {
69
123
  testId: "insert-block-section",
70
124
  parents: parents,
@@ -85,9 +139,9 @@ var getToolbarComponents = exports.getToolbarComponents = function getToolbarCom
85
139
  key: _toolbar.TOOLBARS.PRIMARY_TOOLBAR,
86
140
  rank: _toolbar.TOOLBAR_RANK[_toolbar.LINKING_SECTION.key]
87
141
  }],
88
- component: function component(_ref5) {
89
- var children = _ref5.children,
90
- parents = _ref5.parents;
142
+ component: function component(_ref6) {
143
+ var children = _ref6.children,
144
+ parents = _ref6.parents;
91
145
  return /*#__PURE__*/_react.default.createElement(_Section.Section, {
92
146
  testId: "link-section",
93
147
  parents: parents,
@@ -119,8 +173,8 @@ var getToolbarComponents = exports.getToolbarComponents = function getToolbarCom
119
173
  key: _toolbar.OVERFLOW_GROUP.key,
120
174
  rank: _toolbar.OVERFLOW_GROUP_RANK[_toolbar.OVERFLOW_MENU.key]
121
175
  }],
122
- component: function component(_ref6) {
123
- var children = _ref6.children;
176
+ component: function component(_ref7) {
177
+ var children = _ref7.children;
124
178
  return /*#__PURE__*/_react.default.createElement(_OverflowMenu.OverflowMenu, null, children);
125
179
  }
126
180
  }, {
@@ -131,7 +185,7 @@ var getToolbarComponents = exports.getToolbarComponents = function getToolbarCom
131
185
  key: _toolbar.TOOLBARS.PRIMARY_TOOLBAR,
132
186
  rank: _toolbar.TOOLBAR_RANK[_toolbar.PIN_SECTION.key]
133
187
  }]
134
- }];
188
+ }]);
135
189
  if ((0, _expValEquals.expValEquals)('platform_editor_toolbar_migrate_loom', 'isEnabled', true)) {
136
190
  components.push({
137
191
  type: _toolbar.OVERFLOW_SECTION_PRIMARY_TOOLBAR.type,
@@ -141,8 +195,8 @@ var getToolbarComponents = exports.getToolbarComponents = function getToolbarCom
141
195
  key: _toolbar.TOOLBARS.PRIMARY_TOOLBAR,
142
196
  rank: _toolbar.TOOLBAR_RANK[_toolbar.OVERFLOW_SECTION_PRIMARY_TOOLBAR.key]
143
197
  }],
144
- component: function component(_ref7) {
145
- var children = _ref7.children;
198
+ component: function component(_ref8) {
199
+ var children = _ref8.children;
146
200
  return /*#__PURE__*/_react.default.createElement(_OverflowSection.OverflowSection, null, children);
147
201
  }
148
202
  }, {
@@ -161,8 +215,8 @@ var getToolbarComponents = exports.getToolbarComponents = function getToolbarCom
161
215
  key: _toolbar.OVERFLOW_GROUP_PRIMARY_TOOLBAR.key,
162
216
  rank: _toolbar.OVERFLOW_GROUP_PRIMARY_TOOLBAR_RANK[_toolbar.OVERFLOW_MENU_PRIMARY_TOOLBAR.key]
163
217
  }],
164
- component: function component(_ref8) {
165
- var children = _ref8.children;
218
+ component: function component(_ref9) {
219
+ var children = _ref9.children;
166
220
  return /*#__PURE__*/_react.default.createElement(_OverflowMenu.OverflowMenu, null, children);
167
221
  }
168
222
  });
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
3
+ import { PrimaryToolbar as PrimaryToolbarBase } from '@atlaskit/editor-toolbar';
4
+ export const PrimaryToolbar = ({
5
+ children
6
+ }) => {
7
+ const {
8
+ editorAppearance
9
+ } = useEditorToolbar();
10
+ return /*#__PURE__*/React.createElement(PrimaryToolbarBase, {
11
+ label: "Primary Toolbar",
12
+ reducedBreakpoints: editorAppearance !== 'full-page'
13
+ }, children);
14
+ };
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import { useIntl } from 'react-intl-next';
3
+ import { toolbarMessages } from '@atlaskit/editor-common/messages';
4
+ import { ToolbarDropdownMenu, ToolbarTooltip, TextIcon } from '@atlaskit/editor-toolbar';
5
+ /**
6
+ * Basic version of existing 'Text Styles' Menu - which doesn't dynamically change icon
7
+ * and is also placeholder to render all other menus in the collapsed state.
8
+ */
9
+ export const TextCollapsedMenu = ({
10
+ children
11
+ }) => {
12
+ const {
13
+ formatMessage
14
+ } = useIntl();
15
+ return /*#__PURE__*/React.createElement(ToolbarTooltip, {
16
+ content: formatMessage(toolbarMessages.textStylesTooltip)
17
+ }, /*#__PURE__*/React.createElement(ToolbarDropdownMenu, {
18
+ iconBefore: /*#__PURE__*/React.createElement(TextIcon, {
19
+ label: formatMessage(toolbarMessages.textStylesTooltip),
20
+ size: "small"
21
+ }),
22
+ enableMaxHeight: true
23
+ }, children));
24
+ };
@@ -1,11 +1,13 @@
1
1
  import React from 'react';
2
- import { INSERT_BLOCK_SECTION, LINKING_SECTION, OVERFLOW_GROUP, OVERFLOW_GROUP_PRIMARY_TOOLBAR, OVERFLOW_GROUP_PRIMARY_TOOLBAR_RANK, OVERFLOW_GROUP_RANK, OVERFLOW_MENU, OVERFLOW_MENU_PRIMARY_TOOLBAR, OVERFLOW_SECTION, OVERFLOW_SECTION_PRIMARY_TOOLBAR, OVERFLOW_SECTION_PRIMARY_TOOLBAR_RANK, OVERFLOW_SECTION_RANK, PIN_SECTION, TEXT_SECTION, TOOLBAR_RANK, TOOLBARS } from '@atlaskit/editor-common/toolbar';
3
- import { PrimaryToolbar, Toolbar } from '@atlaskit/editor-toolbar';
2
+ import { INSERT_BLOCK_SECTION, LINKING_SECTION, OVERFLOW_GROUP, OVERFLOW_GROUP_PRIMARY_TOOLBAR, OVERFLOW_GROUP_PRIMARY_TOOLBAR_RANK, OVERFLOW_GROUP_RANK, OVERFLOW_MENU, OVERFLOW_MENU_PRIMARY_TOOLBAR, OVERFLOW_SECTION, OVERFLOW_SECTION_PRIMARY_TOOLBAR, OVERFLOW_SECTION_PRIMARY_TOOLBAR_RANK, OVERFLOW_SECTION_RANK, PIN_SECTION, TEXT_COLLAPSED_GROUP, TEXT_SECTION, TEXT_SECTION_COLLAPSED, TEXT_COLLAPSED_MENU, TOOLBAR_RANK, TOOLBARS } from '@atlaskit/editor-common/toolbar';
3
+ import { PrimaryToolbar as PrimaryToolbarBase, Show, Toolbar } from '@atlaskit/editor-toolbar';
4
4
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
5
5
  import { SELECTION_TOOLBAR_LABEL } from './consts';
6
6
  import { OverflowMenu } from './OverflowMenu';
7
7
  import { OverflowSection } from './OverflowSection';
8
+ import { PrimaryToolbar } from './PrimaryToolbar';
8
9
  import { Section } from './Section';
10
+ import { TextCollapsedMenu } from './TextCollapsedMenu';
9
11
  export const getToolbarComponents = (api, disableSelectionToolbar) => {
10
12
  const components = [{
11
13
  type: 'toolbar',
@@ -20,10 +22,10 @@ export const getToolbarComponents = (api, disableSelectionToolbar) => {
20
22
  }, {
21
23
  type: 'toolbar',
22
24
  key: TOOLBARS.PRIMARY_TOOLBAR,
23
- component: ({
25
+ component: expValEquals('platform_editor_toolbar_aifc_responsive', 'isEnabled', true) ? PrimaryToolbar : ({
24
26
  children
25
- }) => /*#__PURE__*/React.createElement(PrimaryToolbar, {
26
- label: 'Primary Toolbar'
27
+ }) => /*#__PURE__*/React.createElement(PrimaryToolbarBase, {
28
+ label: "Primary Toolbar"
27
29
  }, children)
28
30
  }, {
29
31
  type: TEXT_SECTION.type,
@@ -41,6 +43,16 @@ export const getToolbarComponents = (api, disableSelectionToolbar) => {
41
43
  children,
42
44
  parents
43
45
  }) => {
46
+ if (expValEquals('platform_editor_toolbar_aifc_responsive', 'isEnabled', true)) {
47
+ return /*#__PURE__*/React.createElement(Show, {
48
+ above: "md"
49
+ }, /*#__PURE__*/React.createElement(Section, {
50
+ parents: parents,
51
+ api: api,
52
+ disableSelectionToolbar: disableSelectionToolbar,
53
+ testId: "text-section"
54
+ }, children));
55
+ }
44
56
  return /*#__PURE__*/React.createElement(Section, {
45
57
  parents: parents,
46
58
  api: api,
@@ -48,7 +60,49 @@ export const getToolbarComponents = (api, disableSelectionToolbar) => {
48
60
  testId: "text-section"
49
61
  }, children);
50
62
  }
63
+ }, ...(expValEquals('platform_editor_toolbar_aifc_responsive', 'isEnabled', true) ? [{
64
+ type: TEXT_SECTION_COLLAPSED.type,
65
+ key: TEXT_SECTION_COLLAPSED.key,
66
+ parents: [{
67
+ type: 'toolbar',
68
+ key: TOOLBARS.INLINE_TEXT_TOOLBAR,
69
+ rank: TOOLBAR_RANK[TEXT_SECTION_COLLAPSED.key]
70
+ }, {
71
+ type: 'toolbar',
72
+ key: TOOLBARS.PRIMARY_TOOLBAR,
73
+ rank: TOOLBAR_RANK[TEXT_SECTION_COLLAPSED.key]
74
+ }],
75
+ component: ({
76
+ children,
77
+ parents
78
+ }) => {
79
+ return /*#__PURE__*/React.createElement(Show, {
80
+ below: "md"
81
+ }, /*#__PURE__*/React.createElement(Section, {
82
+ parents: parents,
83
+ api: api,
84
+ disableSelectionToolbar: disableSelectionToolbar,
85
+ testId: "text-section"
86
+ }, children));
87
+ }
51
88
  }, {
89
+ type: TEXT_COLLAPSED_GROUP.type,
90
+ key: TEXT_COLLAPSED_GROUP.key,
91
+ parents: [{
92
+ type: TEXT_SECTION_COLLAPSED.type,
93
+ key: TEXT_SECTION_COLLAPSED.key,
94
+ rank: 100
95
+ }]
96
+ }, {
97
+ type: TEXT_COLLAPSED_MENU.type,
98
+ key: TEXT_COLLAPSED_MENU.key,
99
+ parents: [{
100
+ type: TEXT_COLLAPSED_GROUP.type,
101
+ key: TEXT_COLLAPSED_GROUP.key,
102
+ rank: 100
103
+ }],
104
+ component: TextCollapsedMenu
105
+ }] : []), {
52
106
  type: INSERT_BLOCK_SECTION.type,
53
107
  key: INSERT_BLOCK_SECTION.key,
54
108
  parents: [{
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
3
+ import { PrimaryToolbar as PrimaryToolbarBase } from '@atlaskit/editor-toolbar';
4
+ export var PrimaryToolbar = function PrimaryToolbar(_ref) {
5
+ var children = _ref.children;
6
+ var _useEditorToolbar = useEditorToolbar(),
7
+ editorAppearance = _useEditorToolbar.editorAppearance;
8
+ return /*#__PURE__*/React.createElement(PrimaryToolbarBase, {
9
+ label: "Primary Toolbar",
10
+ reducedBreakpoints: editorAppearance !== 'full-page'
11
+ }, children);
12
+ };
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import { useIntl } from 'react-intl-next';
3
+ import { toolbarMessages } from '@atlaskit/editor-common/messages';
4
+ import { ToolbarDropdownMenu, ToolbarTooltip, TextIcon } from '@atlaskit/editor-toolbar';
5
+ /**
6
+ * Basic version of existing 'Text Styles' Menu - which doesn't dynamically change icon
7
+ * and is also placeholder to render all other menus in the collapsed state.
8
+ */
9
+ export var TextCollapsedMenu = function TextCollapsedMenu(_ref) {
10
+ var children = _ref.children;
11
+ var _useIntl = useIntl(),
12
+ formatMessage = _useIntl.formatMessage;
13
+ return /*#__PURE__*/React.createElement(ToolbarTooltip, {
14
+ content: formatMessage(toolbarMessages.textStylesTooltip)
15
+ }, /*#__PURE__*/React.createElement(ToolbarDropdownMenu, {
16
+ iconBefore: /*#__PURE__*/React.createElement(TextIcon, {
17
+ label: formatMessage(toolbarMessages.textStylesTooltip),
18
+ size: "small"
19
+ }),
20
+ enableMaxHeight: true
21
+ }, children));
22
+ };
@@ -1,11 +1,14 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
1
2
  import React from 'react';
2
- import { INSERT_BLOCK_SECTION, LINKING_SECTION, OVERFLOW_GROUP, OVERFLOW_GROUP_PRIMARY_TOOLBAR, OVERFLOW_GROUP_PRIMARY_TOOLBAR_RANK, OVERFLOW_GROUP_RANK, OVERFLOW_MENU, OVERFLOW_MENU_PRIMARY_TOOLBAR, OVERFLOW_SECTION, OVERFLOW_SECTION_PRIMARY_TOOLBAR, OVERFLOW_SECTION_PRIMARY_TOOLBAR_RANK, OVERFLOW_SECTION_RANK, PIN_SECTION, TEXT_SECTION, TOOLBAR_RANK, TOOLBARS } from '@atlaskit/editor-common/toolbar';
3
- import { PrimaryToolbar, Toolbar } from '@atlaskit/editor-toolbar';
3
+ import { INSERT_BLOCK_SECTION, LINKING_SECTION, OVERFLOW_GROUP, OVERFLOW_GROUP_PRIMARY_TOOLBAR, OVERFLOW_GROUP_PRIMARY_TOOLBAR_RANK, OVERFLOW_GROUP_RANK, OVERFLOW_MENU, OVERFLOW_MENU_PRIMARY_TOOLBAR, OVERFLOW_SECTION, OVERFLOW_SECTION_PRIMARY_TOOLBAR, OVERFLOW_SECTION_PRIMARY_TOOLBAR_RANK, OVERFLOW_SECTION_RANK, PIN_SECTION, TEXT_COLLAPSED_GROUP, TEXT_SECTION, TEXT_SECTION_COLLAPSED, TEXT_COLLAPSED_MENU, TOOLBAR_RANK, TOOLBARS } from '@atlaskit/editor-common/toolbar';
4
+ import { PrimaryToolbar as PrimaryToolbarBase, Show, Toolbar } from '@atlaskit/editor-toolbar';
4
5
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
5
6
  import { SELECTION_TOOLBAR_LABEL } from './consts';
6
7
  import { OverflowMenu } from './OverflowMenu';
7
8
  import { OverflowSection } from './OverflowSection';
9
+ import { PrimaryToolbar } from './PrimaryToolbar';
8
10
  import { Section } from './Section';
11
+ import { TextCollapsedMenu } from './TextCollapsedMenu';
9
12
  export var getToolbarComponents = function getToolbarComponents(api, disableSelectionToolbar) {
10
13
  var components = [{
11
14
  type: 'toolbar',
@@ -19,10 +22,10 @@ export var getToolbarComponents = function getToolbarComponents(api, disableSele
19
22
  }, {
20
23
  type: 'toolbar',
21
24
  key: TOOLBARS.PRIMARY_TOOLBAR,
22
- component: function component(_ref2) {
25
+ component: expValEquals('platform_editor_toolbar_aifc_responsive', 'isEnabled', true) ? PrimaryToolbar : function (_ref2) {
23
26
  var children = _ref2.children;
24
- return /*#__PURE__*/React.createElement(PrimaryToolbar, {
25
- label: 'Primary Toolbar'
27
+ return /*#__PURE__*/React.createElement(PrimaryToolbarBase, {
28
+ label: "Primary Toolbar"
26
29
  }, children);
27
30
  }
28
31
  }, {
@@ -40,6 +43,16 @@ export var getToolbarComponents = function getToolbarComponents(api, disableSele
40
43
  component: function component(_ref3) {
41
44
  var children = _ref3.children,
42
45
  parents = _ref3.parents;
46
+ if (expValEquals('platform_editor_toolbar_aifc_responsive', 'isEnabled', true)) {
47
+ return /*#__PURE__*/React.createElement(Show, {
48
+ above: "md"
49
+ }, /*#__PURE__*/React.createElement(Section, {
50
+ parents: parents,
51
+ api: api,
52
+ disableSelectionToolbar: disableSelectionToolbar,
53
+ testId: "text-section"
54
+ }, children));
55
+ }
43
56
  return /*#__PURE__*/React.createElement(Section, {
44
57
  parents: parents,
45
58
  api: api,
@@ -47,7 +60,48 @@ export var getToolbarComponents = function getToolbarComponents(api, disableSele
47
60
  testId: "text-section"
48
61
  }, children);
49
62
  }
63
+ }].concat(_toConsumableArray(expValEquals('platform_editor_toolbar_aifc_responsive', 'isEnabled', true) ? [{
64
+ type: TEXT_SECTION_COLLAPSED.type,
65
+ key: TEXT_SECTION_COLLAPSED.key,
66
+ parents: [{
67
+ type: 'toolbar',
68
+ key: TOOLBARS.INLINE_TEXT_TOOLBAR,
69
+ rank: TOOLBAR_RANK[TEXT_SECTION_COLLAPSED.key]
70
+ }, {
71
+ type: 'toolbar',
72
+ key: TOOLBARS.PRIMARY_TOOLBAR,
73
+ rank: TOOLBAR_RANK[TEXT_SECTION_COLLAPSED.key]
74
+ }],
75
+ component: function component(_ref4) {
76
+ var children = _ref4.children,
77
+ parents = _ref4.parents;
78
+ return /*#__PURE__*/React.createElement(Show, {
79
+ below: "md"
80
+ }, /*#__PURE__*/React.createElement(Section, {
81
+ parents: parents,
82
+ api: api,
83
+ disableSelectionToolbar: disableSelectionToolbar,
84
+ testId: "text-section"
85
+ }, children));
86
+ }
87
+ }, {
88
+ type: TEXT_COLLAPSED_GROUP.type,
89
+ key: TEXT_COLLAPSED_GROUP.key,
90
+ parents: [{
91
+ type: TEXT_SECTION_COLLAPSED.type,
92
+ key: TEXT_SECTION_COLLAPSED.key,
93
+ rank: 100
94
+ }]
50
95
  }, {
96
+ type: TEXT_COLLAPSED_MENU.type,
97
+ key: TEXT_COLLAPSED_MENU.key,
98
+ parents: [{
99
+ type: TEXT_COLLAPSED_GROUP.type,
100
+ key: TEXT_COLLAPSED_GROUP.key,
101
+ rank: 100
102
+ }],
103
+ component: TextCollapsedMenu
104
+ }] : []), [{
51
105
  type: INSERT_BLOCK_SECTION.type,
52
106
  key: INSERT_BLOCK_SECTION.key,
53
107
  parents: [{
@@ -55,9 +109,9 @@ export var getToolbarComponents = function getToolbarComponents(api, disableSele
55
109
  key: TOOLBARS.PRIMARY_TOOLBAR,
56
110
  rank: TOOLBAR_RANK[INSERT_BLOCK_SECTION.key]
57
111
  }],
58
- component: function component(_ref4) {
59
- var children = _ref4.children,
60
- parents = _ref4.parents;
112
+ component: function component(_ref5) {
113
+ var children = _ref5.children,
114
+ parents = _ref5.parents;
61
115
  return /*#__PURE__*/React.createElement(Section, {
62
116
  testId: "insert-block-section",
63
117
  parents: parents,
@@ -78,9 +132,9 @@ export var getToolbarComponents = function getToolbarComponents(api, disableSele
78
132
  key: TOOLBARS.PRIMARY_TOOLBAR,
79
133
  rank: TOOLBAR_RANK[LINKING_SECTION.key]
80
134
  }],
81
- component: function component(_ref5) {
82
- var children = _ref5.children,
83
- parents = _ref5.parents;
135
+ component: function component(_ref6) {
136
+ var children = _ref6.children,
137
+ parents = _ref6.parents;
84
138
  return /*#__PURE__*/React.createElement(Section, {
85
139
  testId: "link-section",
86
140
  parents: parents,
@@ -112,8 +166,8 @@ export var getToolbarComponents = function getToolbarComponents(api, disableSele
112
166
  key: OVERFLOW_GROUP.key,
113
167
  rank: OVERFLOW_GROUP_RANK[OVERFLOW_MENU.key]
114
168
  }],
115
- component: function component(_ref6) {
116
- var children = _ref6.children;
169
+ component: function component(_ref7) {
170
+ var children = _ref7.children;
117
171
  return /*#__PURE__*/React.createElement(OverflowMenu, null, children);
118
172
  }
119
173
  }, {
@@ -124,7 +178,7 @@ export var getToolbarComponents = function getToolbarComponents(api, disableSele
124
178
  key: TOOLBARS.PRIMARY_TOOLBAR,
125
179
  rank: TOOLBAR_RANK[PIN_SECTION.key]
126
180
  }]
127
- }];
181
+ }]);
128
182
  if (expValEquals('platform_editor_toolbar_migrate_loom', 'isEnabled', true)) {
129
183
  components.push({
130
184
  type: OVERFLOW_SECTION_PRIMARY_TOOLBAR.type,
@@ -134,8 +188,8 @@ export var getToolbarComponents = function getToolbarComponents(api, disableSele
134
188
  key: TOOLBARS.PRIMARY_TOOLBAR,
135
189
  rank: TOOLBAR_RANK[OVERFLOW_SECTION_PRIMARY_TOOLBAR.key]
136
190
  }],
137
- component: function component(_ref7) {
138
- var children = _ref7.children;
191
+ component: function component(_ref8) {
192
+ var children = _ref8.children;
139
193
  return /*#__PURE__*/React.createElement(OverflowSection, null, children);
140
194
  }
141
195
  }, {
@@ -154,8 +208,8 @@ export var getToolbarComponents = function getToolbarComponents(api, disableSele
154
208
  key: OVERFLOW_GROUP_PRIMARY_TOOLBAR.key,
155
209
  rank: OVERFLOW_GROUP_PRIMARY_TOOLBAR_RANK[OVERFLOW_MENU_PRIMARY_TOOLBAR.key]
156
210
  }],
157
- component: function component(_ref8) {
158
- var children = _ref8.children;
211
+ component: function component(_ref9) {
212
+ var children = _ref9.children;
159
213
  return /*#__PURE__*/React.createElement(OverflowMenu, null, children);
160
214
  }
161
215
  });
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ type PrimaryToolbarProps = {
3
+ children: React.ReactNode;
4
+ };
5
+ export declare const PrimaryToolbar: ({ children }: PrimaryToolbarProps) => React.JSX.Element;
6
+ export {};
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ type TextStylesMenuButtonProps = {
3
+ children: React.ReactNode;
4
+ };
5
+ /**
6
+ * Basic version of existing 'Text Styles' Menu - which doesn't dynamically change icon
7
+ * and is also placeholder to render all other menus in the collapsed state.
8
+ */
9
+ export declare const TextCollapsedMenu: ({ children }: TextStylesMenuButtonProps) => React.JSX.Element;
10
+ export {};
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ type PrimaryToolbarProps = {
3
+ children: React.ReactNode;
4
+ };
5
+ export declare const PrimaryToolbar: ({ children }: PrimaryToolbarProps) => React.JSX.Element;
6
+ export {};
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ type TextStylesMenuButtonProps = {
3
+ children: React.ReactNode;
4
+ };
5
+ /**
6
+ * Basic version of existing 'Text Styles' Menu - which doesn't dynamically change icon
7
+ * and is also placeholder to render all other menus in the collapsed state.
8
+ */
9
+ export declare const TextCollapsedMenu: ({ children }: TextStylesMenuButtonProps) => React.JSX.Element;
10
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-toolbar",
3
- "version": "0.4.5",
3
+ "version": "0.4.6",
4
4
  "description": "Toolbar plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -34,15 +34,15 @@
34
34
  "@atlaskit/editor-plugin-user-intent": "^1.1.0",
35
35
  "@atlaskit/editor-plugin-user-preferences": "^1.2.0",
36
36
  "@atlaskit/editor-prosemirror": "7.0.0",
37
- "@atlaskit/editor-toolbar": "^0.5.0",
38
- "@atlaskit/editor-toolbar-model": "^0.1.0",
39
- "@atlaskit/tmp-editor-statsig": "^11.9.0",
37
+ "@atlaskit/editor-toolbar": "^0.6.0",
38
+ "@atlaskit/editor-toolbar-model": "^0.2.0",
39
+ "@atlaskit/tmp-editor-statsig": "^11.11.0",
40
40
  "@babel/runtime": "^7.0.0",
41
41
  "bind-event-listener": "^3.0.0",
42
42
  "react-intl-next": "npm:react-intl@^5.18.1"
43
43
  },
44
44
  "peerDependencies": {
45
- "@atlaskit/editor-common": "^107.33.0",
45
+ "@atlaskit/editor-common": "^107.34.0",
46
46
  "react": "^18.2.0"
47
47
  },
48
48
  "techstack": {