@atlaskit/editor-toolbar 0.8.6 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/cjs/hooks/ui-context.js +6 -3
  3. package/dist/cjs/index.js +14 -0
  4. package/dist/cjs/ui/Toolbar.js +7 -2
  5. package/dist/cjs/ui/ToolbarButton.js +4 -2
  6. package/dist/cjs/ui/ToolbarDropdownItem.js +4 -1
  7. package/dist/cjs/ui/ToolbarDropdownItemSection.js +4 -2
  8. package/dist/cjs/ui/ToolbarDropdownMenu.js +1 -1
  9. package/dist/cjs/ui/ToolbarNestedDropdownMenu.js +6 -2
  10. package/dist/cjs/ui/ToolbarTooltip.js +4 -2
  11. package/dist/cjs/ui/ViewEventEmitter.js +33 -0
  12. package/dist/cjs/ui/icons/DefineIcon.js +13 -0
  13. package/dist/cjs/ui/icons/PlusIcon.js +13 -0
  14. package/dist/es2019/hooks/ui-context.js +6 -3
  15. package/dist/es2019/index.js +2 -0
  16. package/dist/es2019/ui/Toolbar.js +7 -2
  17. package/dist/es2019/ui/ToolbarButton.js +4 -2
  18. package/dist/es2019/ui/ToolbarDropdownItem.js +3 -1
  19. package/dist/es2019/ui/ToolbarDropdownItemSection.js +4 -2
  20. package/dist/es2019/ui/ToolbarDropdownMenu.js +1 -1
  21. package/dist/es2019/ui/ToolbarNestedDropdownMenu.js +6 -2
  22. package/dist/es2019/ui/ToolbarTooltip.js +4 -2
  23. package/dist/es2019/ui/ViewEventEmitter.js +29 -0
  24. package/dist/es2019/ui/icons/DefineIcon.js +2 -0
  25. package/dist/es2019/ui/icons/PlusIcon.js +2 -0
  26. package/dist/esm/hooks/ui-context.js +6 -3
  27. package/dist/esm/index.js +2 -0
  28. package/dist/esm/ui/Toolbar.js +7 -2
  29. package/dist/esm/ui/ToolbarButton.js +4 -2
  30. package/dist/esm/ui/ToolbarDropdownItem.js +4 -1
  31. package/dist/esm/ui/ToolbarDropdownItemSection.js +4 -2
  32. package/dist/esm/ui/ToolbarDropdownMenu.js +1 -1
  33. package/dist/esm/ui/ToolbarNestedDropdownMenu.js +6 -2
  34. package/dist/esm/ui/ToolbarTooltip.js +4 -2
  35. package/dist/esm/ui/ViewEventEmitter.js +27 -0
  36. package/dist/esm/ui/icons/DefineIcon.js +2 -0
  37. package/dist/esm/ui/icons/PlusIcon.js +2 -0
  38. package/dist/types/hooks/ui-context.d.ts +9 -1
  39. package/dist/types/index.d.ts +2 -0
  40. package/dist/types/ui/Toolbar.d.ts +3 -2
  41. package/dist/types/ui/ToolbarButton.d.ts +1 -0
  42. package/dist/types/ui/ToolbarDropdownItem.d.ts +2 -1
  43. package/dist/types/ui/ToolbarDropdownItemSection.d.ts +2 -1
  44. package/dist/types/ui/ToolbarDropdownMenu.d.ts +1 -1
  45. package/dist/types/ui/ToolbarNestedDropdownMenu.d.ts +2 -1
  46. package/dist/types/ui/ToolbarTooltip.d.ts +2 -1
  47. package/dist/types/ui/ViewEventEmitter.d.ts +12 -0
  48. package/dist/types/ui/icons/DefineIcon.d.ts +1 -0
  49. package/dist/types/ui/icons/PlusIcon.d.ts +1 -0
  50. package/dist/types-ts4.5/hooks/ui-context.d.ts +9 -1
  51. package/dist/types-ts4.5/index.d.ts +2 -0
  52. package/dist/types-ts4.5/ui/Toolbar.d.ts +3 -2
  53. package/dist/types-ts4.5/ui/ToolbarButton.d.ts +1 -0
  54. package/dist/types-ts4.5/ui/ToolbarDropdownItem.d.ts +2 -1
  55. package/dist/types-ts4.5/ui/ToolbarDropdownItemSection.d.ts +2 -1
  56. package/dist/types-ts4.5/ui/ToolbarDropdownMenu.d.ts +1 -1
  57. package/dist/types-ts4.5/ui/ToolbarNestedDropdownMenu.d.ts +2 -1
  58. package/dist/types-ts4.5/ui/ToolbarTooltip.d.ts +2 -1
  59. package/dist/types-ts4.5/ui/ViewEventEmitter.d.ts +12 -0
  60. package/dist/types-ts4.5/ui/icons/DefineIcon.d.ts +1 -0
  61. package/dist/types-ts4.5/ui/icons/PlusIcon.d.ts +1 -0
  62. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @atlaskit/editor-toolbar
2
2
 
3
+ ## 0.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`553afc302139b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/553afc302139b) -
8
+ Add analytic emitter component which fires an event when dropdowns are viewed
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies
13
+
14
+ ## 0.8.7
15
+
16
+ ### Patch Changes
17
+
18
+ - [`08039ab948fd7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/08039ab948fd7) -
19
+ [ux] [ED-28824] add optional props to support confluence renderer toolbar implementation
20
+ - Updated dependencies
21
+
3
22
  ## 0.8.6
4
23
 
5
24
  ### Patch Changes
@@ -11,7 +11,8 @@ var ToolbarUIContext = /*#__PURE__*/(0, _react.createContext)({
11
11
  onDropdownOpenChanged: function onDropdownOpenChanged() {},
12
12
  preventDefaultOnMouseDown: false,
13
13
  isDisabled: false,
14
- popupsMountPoint: undefined
14
+ popupsMountPoint: undefined,
15
+ fireAnalyticsEvent: undefined
15
16
  });
16
17
 
17
18
  /**
@@ -31,7 +32,8 @@ var ToolbarUIProvider = exports.ToolbarUIProvider = function ToolbarUIProvider(_
31
32
  isDisabled = _ref.isDisabled,
32
33
  popupsMountPoint = _ref.popupsMountPoint,
33
34
  popupsBoundariesElement = _ref.popupsBoundariesElement,
34
- popupsScrollableElement = _ref.popupsScrollableElement;
35
+ popupsScrollableElement = _ref.popupsScrollableElement,
36
+ fireAnalyticsEvent = _ref.fireAnalyticsEvent;
35
37
  return /*#__PURE__*/_react.default.createElement(ToolbarUIContext.Provider, {
36
38
  value: {
37
39
  onDropdownOpenChanged: onDropdownOpenChanged,
@@ -39,7 +41,8 @@ var ToolbarUIProvider = exports.ToolbarUIProvider = function ToolbarUIProvider(_
39
41
  isDisabled: isDisabled,
40
42
  popupsMountPoint: popupsMountPoint,
41
43
  popupsBoundariesElement: popupsBoundariesElement,
42
- popupsScrollableElement: popupsScrollableElement
44
+ popupsScrollableElement: popupsScrollableElement,
45
+ fireAnalyticsEvent: fireAnalyticsEvent
43
46
  }
44
47
  }, children);
45
48
  };
package/dist/cjs/index.js CHANGED
@@ -136,6 +136,12 @@ Object.defineProperty(exports, "CommentIcon", {
136
136
  return _CommentIcon.CommentIcon;
137
137
  }
138
138
  });
139
+ Object.defineProperty(exports, "DefineIcon", {
140
+ enumerable: true,
141
+ get: function get() {
142
+ return _DefineIcon.DefineIcon;
143
+ }
144
+ });
139
145
  Object.defineProperty(exports, "EmojiIcon", {
140
146
  enumerable: true,
141
147
  get: function get() {
@@ -268,6 +274,12 @@ Object.defineProperty(exports, "PinnedIcon", {
268
274
  return _PinnedIcon.PinnedIcon;
269
275
  }
270
276
  });
277
+ Object.defineProperty(exports, "PlusIcon", {
278
+ enumerable: true,
279
+ get: function get() {
280
+ return _PlusIcon.PlusIcon;
281
+ }
282
+ });
271
283
  Object.defineProperty(exports, "PrimaryToolbar", {
272
284
  enumerable: true,
273
285
  get: function get() {
@@ -485,6 +497,7 @@ var _AddIcon = require("./ui/icons/AddIcon");
485
497
  var _AppsIcon = require("./ui/icons/AppsIcon");
486
498
  var _BoldIcon = require("./ui/icons/BoldIcon");
487
499
  var _CommentIcon = require("./ui/icons/CommentIcon");
500
+ var _DefineIcon = require("./ui/icons/DefineIcon");
488
501
  var _HeadingFiveIcon = require("./ui/icons/HeadingFiveIcon");
489
502
  var _HeadingFourIcon = require("./ui/icons/HeadingFourIcon");
490
503
  var _HeadingOneIcon = require("./ui/icons/HeadingOneIcon");
@@ -523,6 +536,7 @@ var _UndoIcon = require("./ui/icons/UndoIcon");
523
536
  var _RedoIcon = require("./ui/icons/RedoIcon");
524
537
  var _HistoryIcon = require("./ui/icons/HistoryIcon");
525
538
  var _LoomIcon = require("./ui/icons/LoomIcon");
539
+ var _PlusIcon = require("./ui/icons/PlusIcon");
526
540
  var _ColorPalette = _interopRequireDefault(require("./ui/ColorPalette"));
527
541
  var _utils = require("./ui/ColorPalette/utils");
528
542
  var _uiContext = require("./hooks/ui-context");
@@ -15,6 +15,7 @@ var _css = require("@atlaskit/css");
15
15
  var _compiled = require("@atlaskit/primitives/compiled");
16
16
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
17
17
  var _ResponsiveContainer = require("./ResponsiveContainer");
18
+ var _ViewEventEmitter = require("./ViewEventEmitter");
18
19
  var styles = {
19
20
  toolbarBase: "_2rko1qi0 _zulp1b66 _1e0c1txw _4cvr1h6o",
20
21
  toolbar: "_bfhk1bhr _4t3i14no _u5f31b66 _19bv1b66 _16qs1cd0",
@@ -29,13 +30,17 @@ var styles = {
29
30
  */
30
31
  var Toolbar = exports.Toolbar = function Toolbar(_ref) {
31
32
  var children = _ref.children,
32
- label = _ref.label;
33
+ label = _ref.label,
34
+ actionSubjectId = _ref.actionSubjectId;
33
35
  var isResponsiveEnabled = (0, _expValEquals.expValEquals)('platform_editor_aifc_selection_toolbar_responsive', 'isEnabled', true);
34
36
  var toolbar = /*#__PURE__*/_react.default.createElement(_compiled.Box, {
35
37
  xcss: (0, _css.cx)(styles.toolbarBase, styles.toolbar, isResponsiveEnabled && styles.toolbarResponsive, (0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_responsive', 'isEnabled', true) && styles.hiddenSelectors),
36
38
  role: "toolbar",
37
39
  "aria-label": label
38
- }, children);
40
+ }, (0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_toolbar_analytic', 'isEnabled', true) ? /*#__PURE__*/_react.default.createElement(_ViewEventEmitter.ViewEventEmitter, {
41
+ actionSubject: _ViewEventEmitter.ACTION_SUBJECT.TOOLBAR,
42
+ actionSubjectId: actionSubjectId
43
+ }) : null, children);
39
44
  if (isResponsiveEnabled) {
40
45
  return /*#__PURE__*/_react.default.createElement(_ResponsiveContainer.ResponsiveWrapper, null, toolbar);
41
46
  } else {
@@ -33,7 +33,8 @@ var ToolbarButton = exports.ToolbarButton = /*#__PURE__*/(0, _react.forwardRef)(
33
33
  testId = _ref.testId,
34
34
  isDisabled = _ref.isDisabled,
35
35
  ariaKeyshortcuts = _ref.ariaKeyshortcuts,
36
- label = _ref.label;
36
+ label = _ref.label,
37
+ interactionName = _ref.interactionName;
37
38
  var _useToolbarUI = (0, _uiContext.useToolbarUI)(),
38
39
  preventDefaultOnMouseDown = _useToolbarUI.preventDefaultOnMouseDown,
39
40
  ctxDisabled = _useToolbarUI.isDisabled;
@@ -58,6 +59,7 @@ var ToolbarButton = exports.ToolbarButton = /*#__PURE__*/(0, _react.forwardRef)(
58
59
  event.preventDefault();
59
60
  }
60
61
  },
61
- "data-toolbar-component": "button"
62
+ "data-toolbar-component": "button",
63
+ interactionName: interactionName
62
64
  }, iconBefore, children);
63
65
  });
@@ -52,6 +52,8 @@ var ToolbarDropdownItem = exports.ToolbarDropdownItem = function ToolbarDropdown
52
52
  isDisabled = _ref2.isDisabled,
53
53
  hasNestedDropdownMenu = _ref2.hasNestedDropdownMenu,
54
54
  triggerRef = _ref2.triggerRef,
55
+ _ref2$shouldTitleWrap = _ref2.shouldTitleWrap,
56
+ shouldTitleWrap = _ref2$shouldTitleWrap === void 0 ? true : _ref2$shouldTitleWrap,
55
57
  testId = _ref2.testId,
56
58
  ariaKeyshortcuts = _ref2.ariaKeyshortcuts,
57
59
  href = _ref2.href,
@@ -78,6 +80,7 @@ var ToolbarDropdownItem = exports.ToolbarDropdownItem = function ToolbarDropdown
78
80
  rel: rel,
79
81
  component: href && (0, _expValEquals.expValEquals)('platform_editor_toolbar_migrate_loom', 'isEnabled', true) ? undefined : CustomDropdownMenuItemButton,
80
82
  testId: testId,
81
- "data-toolbar-component": "menu-item"
83
+ "data-toolbar-component": "menu-item",
84
+ shouldTitleWrap: shouldTitleWrap
82
85
  }, children);
83
86
  };
@@ -10,10 +10,12 @@ var _dropdownMenu = require("@atlaskit/dropdown-menu");
10
10
  var ToolbarDropdownItemSection = exports.ToolbarDropdownItemSection = function ToolbarDropdownItemSection(_ref) {
11
11
  var children = _ref.children,
12
12
  hasSeparator = _ref.hasSeparator,
13
- title = _ref.title;
13
+ title = _ref.title,
14
+ testId = _ref.testId;
14
15
  return /*#__PURE__*/_react.default.createElement(_dropdownMenu.DropdownItemGroup, {
15
16
  hasSeparator: hasSeparator,
16
17
  title: title,
17
- "data-toolbar-component": "menu-section"
18
+ "data-toolbar-component": "menu-section",
19
+ testId: testId
18
20
  }, children);
19
21
  };
@@ -56,9 +56,9 @@ var ToolbarDropdownMenuContent = function ToolbarDropdownMenuContent(_ref) {
56
56
  "aria-controls": triggerProps['aria-controls'],
57
57
  onBlur: triggerProps.onBlur,
58
58
  onClick: function onClick(e) {
59
+ _onClick && _onClick(e, !(menuContext !== null && menuContext !== void 0 && menuContext.isOpen));
59
60
  handleClick();
60
61
  triggerProps.onClick && triggerProps.onClick(e);
61
- _onClick && _onClick(e);
62
62
  },
63
63
  onFocus: triggerProps.onFocus,
64
64
  testId: testId,
@@ -27,7 +27,8 @@ var ToolbarNestedDropdownMenu = exports.ToolbarNestedDropdownMenu = function Too
27
27
  isDisabled = _ref.isDisabled,
28
28
  testId = _ref.testId,
29
29
  _ref$enableMaxHeight = _ref.enableMaxHeight,
30
- enableMaxHeight = _ref$enableMaxHeight === void 0 ? false : _ref$enableMaxHeight;
30
+ enableMaxHeight = _ref$enableMaxHeight === void 0 ? false : _ref$enableMaxHeight,
31
+ _onClick = _ref.onClick;
31
32
  return /*#__PURE__*/React.createElement(_dropdownMenu.default, {
32
33
  placement: "right-start",
33
34
  trigger: function trigger(triggerProps) {
@@ -35,7 +36,10 @@ var ToolbarNestedDropdownMenu = exports.ToolbarNestedDropdownMenu = function Too
35
36
  elemBefore: elemBefore,
36
37
  elemAfter: elemAfter,
37
38
  isSelected: triggerProps.isSelected,
38
- onClick: triggerProps.onClick,
39
+ onClick: function onClick(e) {
40
+ _onClick && _onClick(e);
41
+ triggerProps.onClick && triggerProps.onClick(e);
42
+ },
39
43
  testId: testId,
40
44
  triggerRef: triggerProps.triggerRef,
41
45
  hasNestedDropdownMenu: true,
@@ -11,9 +11,11 @@ var ToolbarTooltip = exports.ToolbarTooltip = function ToolbarTooltip(_ref) {
11
11
  var content = _ref.content,
12
12
  children = _ref.children,
13
13
  _ref$position = _ref.position,
14
- position = _ref$position === void 0 ? 'top' : _ref$position;
14
+ position = _ref$position === void 0 ? 'top' : _ref$position,
15
+ delay = _ref.delay;
15
16
  return /*#__PURE__*/_react.default.createElement(_tooltip.default, {
16
17
  content: content,
17
- position: position
18
+ position: position,
19
+ delay: delay
18
20
  }, children);
19
21
  };
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ViewEventEmitter = exports.ACTION_SUBJECT = void 0;
7
+ var _react = require("react");
8
+ var _uiContext = require("../hooks/ui-context");
9
+ var ACTION_SUBJECT = exports.ACTION_SUBJECT = {
10
+ TOOLBAR: 'toolbar',
11
+ TOOLBAR_DROPDOWN_MENU: 'toolbarDropdownMenu'
12
+ };
13
+ var ViewEventEmitter = exports.ViewEventEmitter = function ViewEventEmitter(_ref) {
14
+ var actionSubjectId = _ref.actionSubjectId,
15
+ actionSubject = _ref.actionSubject;
16
+ var isMountedRef = (0, _react.useRef)(false);
17
+ var _useToolbarUI = (0, _uiContext.useToolbarUI)(),
18
+ fireAnalyticsEvent = _useToolbarUI.fireAnalyticsEvent;
19
+ (0, _react.useEffect)(function () {
20
+ if (isMountedRef.current) {
21
+ return;
22
+ }
23
+ isMountedRef.current = true;
24
+ var payload = {
25
+ action: 'viewed',
26
+ actionSubject: actionSubject,
27
+ actionSubjectId: actionSubjectId,
28
+ eventType: 'ui'
29
+ };
30
+ fireAnalyticsEvent && fireAnalyticsEvent(payload);
31
+ }, [actionSubjectId, actionSubject, fireAnalyticsEvent]);
32
+ return null;
33
+ };
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ Object.defineProperty(exports, "DefineIcon", {
8
+ enumerable: true,
9
+ get: function get() {
10
+ return _informationCircle.default;
11
+ }
12
+ });
13
+ var _informationCircle = _interopRequireDefault(require("@atlaskit/icon/core/information-circle"));
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ Object.defineProperty(exports, "PlusIcon", {
8
+ enumerable: true,
9
+ get: function get() {
10
+ return _plusSquare.default;
11
+ }
12
+ });
13
+ var _plusSquare = _interopRequireDefault(require("@atlaskit/icon/core/plus-square"));
@@ -3,7 +3,8 @@ const ToolbarUIContext = /*#__PURE__*/createContext({
3
3
  onDropdownOpenChanged: () => {},
4
4
  preventDefaultOnMouseDown: false,
5
5
  isDisabled: false,
6
- popupsMountPoint: undefined
6
+ popupsMountPoint: undefined,
7
+ fireAnalyticsEvent: undefined
7
8
  });
8
9
 
9
10
  /**
@@ -23,7 +24,8 @@ export const ToolbarUIProvider = ({
23
24
  isDisabled,
24
25
  popupsMountPoint,
25
26
  popupsBoundariesElement,
26
- popupsScrollableElement
27
+ popupsScrollableElement,
28
+ fireAnalyticsEvent
27
29
  }) => {
28
30
  return /*#__PURE__*/React.createElement(ToolbarUIContext.Provider, {
29
31
  value: {
@@ -32,7 +34,8 @@ export const ToolbarUIProvider = ({
32
34
  isDisabled,
33
35
  popupsMountPoint,
34
36
  popupsBoundariesElement,
35
- popupsScrollableElement
37
+ popupsScrollableElement,
38
+ fireAnalyticsEvent
36
39
  }
37
40
  }, children);
38
41
  };
@@ -30,6 +30,7 @@ export { AddIcon } from './ui/icons/AddIcon';
30
30
  export { AppsIcon } from './ui/icons/AppsIcon';
31
31
  export { BoldIcon } from './ui/icons/BoldIcon';
32
32
  export { CommentIcon } from './ui/icons/CommentIcon';
33
+ export { DefineIcon } from './ui/icons/DefineIcon';
33
34
  export { HeadingFiveIcon } from './ui/icons/HeadingFiveIcon';
34
35
  export { HeadingFourIcon } from './ui/icons/HeadingFourIcon';
35
36
  export { HeadingOneIcon } from './ui/icons/HeadingOneIcon';
@@ -68,6 +69,7 @@ export { UndoIcon } from './ui/icons/UndoIcon';
68
69
  export { RedoIcon } from './ui/icons/RedoIcon';
69
70
  export { HistoryIcon } from './ui/icons/HistoryIcon';
70
71
  export { LoomIcon } from './ui/icons/LoomIcon';
72
+ export { PlusIcon } from './ui/icons/PlusIcon';
71
73
  export { default as ColorPalette } from './ui/ColorPalette';
72
74
  export { getContrastingBackgroundColor } from './ui/ColorPalette/utils';
73
75
  export { useToolbarUI, ToolbarUIProvider } from './hooks/ui-context';
@@ -8,6 +8,7 @@ import { cx } from '@atlaskit/css';
8
8
  import { Box } from '@atlaskit/primitives/compiled';
9
9
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
10
10
  import { ResponsiveContainer, ResponsiveWrapper } from './ResponsiveContainer';
11
+ import { ACTION_SUBJECT, ViewEventEmitter } from './ViewEventEmitter';
11
12
  const styles = {
12
13
  toolbarBase: "_2rko1qi0 _zulp1b66 _1e0c1txw _4cvr1h6o",
13
14
  toolbar: "_bfhk1bhr _4t3i14no _u5f31b66 _19bv1b66 _16qs1cd0",
@@ -22,14 +23,18 @@ const styles = {
22
23
  */
23
24
  export const Toolbar = ({
24
25
  children,
25
- label
26
+ label,
27
+ actionSubjectId
26
28
  }) => {
27
29
  const isResponsiveEnabled = expValEquals('platform_editor_aifc_selection_toolbar_responsive', 'isEnabled', true);
28
30
  const toolbar = /*#__PURE__*/React.createElement(Box, {
29
31
  xcss: cx(styles.toolbarBase, styles.toolbar, isResponsiveEnabled && styles.toolbarResponsive, expValEquals('platform_editor_toolbar_aifc_responsive', 'isEnabled', true) && styles.hiddenSelectors),
30
32
  role: "toolbar",
31
33
  "aria-label": label
32
- }, children);
34
+ }, expValEquals('platform_editor_toolbar_aifc_toolbar_analytic', 'isEnabled', true) ? /*#__PURE__*/React.createElement(ViewEventEmitter, {
35
+ actionSubject: ACTION_SUBJECT.TOOLBAR,
36
+ actionSubjectId: actionSubjectId
37
+ }) : null, children);
33
38
  if (isResponsiveEnabled) {
34
39
  return /*#__PURE__*/React.createElement(ResponsiveWrapper, null, toolbar);
35
40
  } else {
@@ -25,7 +25,8 @@ export const ToolbarButton = /*#__PURE__*/forwardRef(({
25
25
  testId,
26
26
  isDisabled,
27
27
  ariaKeyshortcuts,
28
- label
28
+ label,
29
+ interactionName
29
30
  }, ref) => {
30
31
  const {
31
32
  preventDefaultOnMouseDown,
@@ -52,6 +53,7 @@ export const ToolbarButton = /*#__PURE__*/forwardRef(({
52
53
  event.preventDefault();
53
54
  }
54
55
  },
55
- "data-toolbar-component": "button"
56
+ "data-toolbar-component": "button",
57
+ interactionName: interactionName
56
58
  }, iconBefore, children);
57
59
  });
@@ -43,6 +43,7 @@ export const ToolbarDropdownItem = ({
43
43
  isDisabled,
44
44
  hasNestedDropdownMenu,
45
45
  triggerRef,
46
+ shouldTitleWrap = true,
46
47
  testId,
47
48
  ariaKeyshortcuts,
48
49
  href,
@@ -70,6 +71,7 @@ export const ToolbarDropdownItem = ({
70
71
  rel: rel,
71
72
  component: href && expValEquals('platform_editor_toolbar_migrate_loom', 'isEnabled', true) ? undefined : CustomDropdownMenuItemButton,
72
73
  testId: testId,
73
- "data-toolbar-component": "menu-item"
74
+ "data-toolbar-component": "menu-item",
75
+ shouldTitleWrap: shouldTitleWrap
74
76
  }, children);
75
77
  };
@@ -3,11 +3,13 @@ import { DropdownItemGroup } from '@atlaskit/dropdown-menu';
3
3
  export const ToolbarDropdownItemSection = ({
4
4
  children,
5
5
  hasSeparator,
6
- title
6
+ title,
7
+ testId
7
8
  }) => {
8
9
  return /*#__PURE__*/React.createElement(DropdownItemGroup, {
9
10
  hasSeparator: hasSeparator,
10
11
  title: title,
11
- "data-toolbar-component": "menu-section"
12
+ "data-toolbar-component": "menu-section",
13
+ testId: testId
12
14
  }, children);
13
15
  };
@@ -48,9 +48,9 @@ const ToolbarDropdownMenuContent = ({
48
48
  "aria-controls": triggerProps['aria-controls'],
49
49
  onBlur: triggerProps.onBlur,
50
50
  onClick: e => {
51
+ onClick && onClick(e, !(menuContext !== null && menuContext !== void 0 && menuContext.isOpen));
51
52
  handleClick();
52
53
  triggerProps.onClick && triggerProps.onClick(e);
53
- onClick && onClick(e);
54
54
  },
55
55
  onFocus: triggerProps.onFocus,
56
56
  testId: testId,
@@ -17,7 +17,8 @@ export const ToolbarNestedDropdownMenu = ({
17
17
  children,
18
18
  isDisabled,
19
19
  testId,
20
- enableMaxHeight = false
20
+ enableMaxHeight = false,
21
+ onClick
21
22
  }) => {
22
23
  return /*#__PURE__*/React.createElement(DropdownMenu, {
23
24
  placement: "right-start",
@@ -25,7 +26,10 @@ export const ToolbarNestedDropdownMenu = ({
25
26
  elemBefore: elemBefore,
26
27
  elemAfter: elemAfter,
27
28
  isSelected: triggerProps.isSelected,
28
- onClick: triggerProps.onClick,
29
+ onClick: e => {
30
+ onClick && onClick(e);
31
+ triggerProps.onClick && triggerProps.onClick(e);
32
+ },
29
33
  testId: testId,
30
34
  triggerRef: triggerProps.triggerRef,
31
35
  hasNestedDropdownMenu: true,
@@ -3,10 +3,12 @@ import Tooltip from '@atlaskit/tooltip';
3
3
  export const ToolbarTooltip = ({
4
4
  content,
5
5
  children,
6
- position = 'top'
6
+ position = 'top',
7
+ delay
7
8
  }) => {
8
9
  return /*#__PURE__*/React.createElement(Tooltip, {
9
10
  content: content,
10
- position: position
11
+ position: position,
12
+ delay: delay
11
13
  }, children);
12
14
  };
@@ -0,0 +1,29 @@
1
+ import { useEffect, useRef } from 'react';
2
+ import { useToolbarUI } from '../hooks/ui-context';
3
+ export const ACTION_SUBJECT = {
4
+ TOOLBAR: 'toolbar',
5
+ TOOLBAR_DROPDOWN_MENU: 'toolbarDropdownMenu'
6
+ };
7
+ export const ViewEventEmitter = ({
8
+ actionSubjectId,
9
+ actionSubject
10
+ }) => {
11
+ const isMountedRef = useRef(false);
12
+ const {
13
+ fireAnalyticsEvent
14
+ } = useToolbarUI();
15
+ useEffect(() => {
16
+ if (isMountedRef.current) {
17
+ return;
18
+ }
19
+ isMountedRef.current = true;
20
+ const payload = {
21
+ action: 'viewed',
22
+ actionSubject,
23
+ actionSubjectId,
24
+ eventType: 'ui'
25
+ };
26
+ fireAnalyticsEvent && fireAnalyticsEvent(payload);
27
+ }, [actionSubjectId, actionSubject, fireAnalyticsEvent]);
28
+ return null;
29
+ };
@@ -0,0 +1,2 @@
1
+ /* eslint-disable @atlaskit/editor/no-re-export */
2
+ export { default as DefineIcon } from '@atlaskit/icon/core/information-circle';
@@ -0,0 +1,2 @@
1
+ /* eslint-disable @atlaskit/editor/no-re-export */
2
+ export { default as PlusIcon } from '@atlaskit/icon/core/plus-square';
@@ -3,7 +3,8 @@ var ToolbarUIContext = /*#__PURE__*/createContext({
3
3
  onDropdownOpenChanged: function onDropdownOpenChanged() {},
4
4
  preventDefaultOnMouseDown: false,
5
5
  isDisabled: false,
6
- popupsMountPoint: undefined
6
+ popupsMountPoint: undefined,
7
+ fireAnalyticsEvent: undefined
7
8
  });
8
9
 
9
10
  /**
@@ -23,7 +24,8 @@ export var ToolbarUIProvider = function ToolbarUIProvider(_ref) {
23
24
  isDisabled = _ref.isDisabled,
24
25
  popupsMountPoint = _ref.popupsMountPoint,
25
26
  popupsBoundariesElement = _ref.popupsBoundariesElement,
26
- popupsScrollableElement = _ref.popupsScrollableElement;
27
+ popupsScrollableElement = _ref.popupsScrollableElement,
28
+ fireAnalyticsEvent = _ref.fireAnalyticsEvent;
27
29
  return /*#__PURE__*/React.createElement(ToolbarUIContext.Provider, {
28
30
  value: {
29
31
  onDropdownOpenChanged: onDropdownOpenChanged,
@@ -31,7 +33,8 @@ export var ToolbarUIProvider = function ToolbarUIProvider(_ref) {
31
33
  isDisabled: isDisabled,
32
34
  popupsMountPoint: popupsMountPoint,
33
35
  popupsBoundariesElement: popupsBoundariesElement,
34
- popupsScrollableElement: popupsScrollableElement
36
+ popupsScrollableElement: popupsScrollableElement,
37
+ fireAnalyticsEvent: fireAnalyticsEvent
35
38
  }
36
39
  }, children);
37
40
  };
package/dist/esm/index.js CHANGED
@@ -30,6 +30,7 @@ export { AddIcon } from './ui/icons/AddIcon';
30
30
  export { AppsIcon } from './ui/icons/AppsIcon';
31
31
  export { BoldIcon } from './ui/icons/BoldIcon';
32
32
  export { CommentIcon } from './ui/icons/CommentIcon';
33
+ export { DefineIcon } from './ui/icons/DefineIcon';
33
34
  export { HeadingFiveIcon } from './ui/icons/HeadingFiveIcon';
34
35
  export { HeadingFourIcon } from './ui/icons/HeadingFourIcon';
35
36
  export { HeadingOneIcon } from './ui/icons/HeadingOneIcon';
@@ -68,6 +69,7 @@ export { UndoIcon } from './ui/icons/UndoIcon';
68
69
  export { RedoIcon } from './ui/icons/RedoIcon';
69
70
  export { HistoryIcon } from './ui/icons/HistoryIcon';
70
71
  export { LoomIcon } from './ui/icons/LoomIcon';
72
+ export { PlusIcon } from './ui/icons/PlusIcon';
71
73
  export { default as ColorPalette } from './ui/ColorPalette';
72
74
  export { getContrastingBackgroundColor } from './ui/ColorPalette/utils';
73
75
  export { useToolbarUI, ToolbarUIProvider } from './hooks/ui-context';
@@ -8,6 +8,7 @@ import { cx } from '@atlaskit/css';
8
8
  import { Box } from '@atlaskit/primitives/compiled';
9
9
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
10
10
  import { ResponsiveContainer, ResponsiveWrapper } from './ResponsiveContainer';
11
+ import { ACTION_SUBJECT, ViewEventEmitter } from './ViewEventEmitter';
11
12
  var styles = {
12
13
  toolbarBase: "_2rko1qi0 _zulp1b66 _1e0c1txw _4cvr1h6o",
13
14
  toolbar: "_bfhk1bhr _4t3i14no _u5f31b66 _19bv1b66 _16qs1cd0",
@@ -22,13 +23,17 @@ var styles = {
22
23
  */
23
24
  export var Toolbar = function Toolbar(_ref) {
24
25
  var children = _ref.children,
25
- label = _ref.label;
26
+ label = _ref.label,
27
+ actionSubjectId = _ref.actionSubjectId;
26
28
  var isResponsiveEnabled = expValEquals('platform_editor_aifc_selection_toolbar_responsive', 'isEnabled', true);
27
29
  var toolbar = /*#__PURE__*/React.createElement(Box, {
28
30
  xcss: cx(styles.toolbarBase, styles.toolbar, isResponsiveEnabled && styles.toolbarResponsive, expValEquals('platform_editor_toolbar_aifc_responsive', 'isEnabled', true) && styles.hiddenSelectors),
29
31
  role: "toolbar",
30
32
  "aria-label": label
31
- }, children);
33
+ }, expValEquals('platform_editor_toolbar_aifc_toolbar_analytic', 'isEnabled', true) ? /*#__PURE__*/React.createElement(ViewEventEmitter, {
34
+ actionSubject: ACTION_SUBJECT.TOOLBAR,
35
+ actionSubjectId: actionSubjectId
36
+ }) : null, children);
32
37
  if (isResponsiveEnabled) {
33
38
  return /*#__PURE__*/React.createElement(ResponsiveWrapper, null, toolbar);
34
39
  } else {
@@ -25,7 +25,8 @@ export var ToolbarButton = /*#__PURE__*/forwardRef(function (_ref, ref) {
25
25
  testId = _ref.testId,
26
26
  isDisabled = _ref.isDisabled,
27
27
  ariaKeyshortcuts = _ref.ariaKeyshortcuts,
28
- label = _ref.label;
28
+ label = _ref.label,
29
+ interactionName = _ref.interactionName;
29
30
  var _useToolbarUI = useToolbarUI(),
30
31
  preventDefaultOnMouseDown = _useToolbarUI.preventDefaultOnMouseDown,
31
32
  ctxDisabled = _useToolbarUI.isDisabled;
@@ -50,6 +51,7 @@ export var ToolbarButton = /*#__PURE__*/forwardRef(function (_ref, ref) {
50
51
  event.preventDefault();
51
52
  }
52
53
  },
53
- "data-toolbar-component": "button"
54
+ "data-toolbar-component": "button",
55
+ interactionName: interactionName
54
56
  }, iconBefore, children);
55
57
  });
@@ -44,6 +44,8 @@ export var ToolbarDropdownItem = function ToolbarDropdownItem(_ref2) {
44
44
  isDisabled = _ref2.isDisabled,
45
45
  hasNestedDropdownMenu = _ref2.hasNestedDropdownMenu,
46
46
  triggerRef = _ref2.triggerRef,
47
+ _ref2$shouldTitleWrap = _ref2.shouldTitleWrap,
48
+ shouldTitleWrap = _ref2$shouldTitleWrap === void 0 ? true : _ref2$shouldTitleWrap,
47
49
  testId = _ref2.testId,
48
50
  ariaKeyshortcuts = _ref2.ariaKeyshortcuts,
49
51
  href = _ref2.href,
@@ -70,6 +72,7 @@ export var ToolbarDropdownItem = function ToolbarDropdownItem(_ref2) {
70
72
  rel: rel,
71
73
  component: href && expValEquals('platform_editor_toolbar_migrate_loom', 'isEnabled', true) ? undefined : CustomDropdownMenuItemButton,
72
74
  testId: testId,
73
- "data-toolbar-component": "menu-item"
75
+ "data-toolbar-component": "menu-item",
76
+ shouldTitleWrap: shouldTitleWrap
74
77
  }, children);
75
78
  };
@@ -3,10 +3,12 @@ import { DropdownItemGroup } from '@atlaskit/dropdown-menu';
3
3
  export var ToolbarDropdownItemSection = function ToolbarDropdownItemSection(_ref) {
4
4
  var children = _ref.children,
5
5
  hasSeparator = _ref.hasSeparator,
6
- title = _ref.title;
6
+ title = _ref.title,
7
+ testId = _ref.testId;
7
8
  return /*#__PURE__*/React.createElement(DropdownItemGroup, {
8
9
  hasSeparator: hasSeparator,
9
10
  title: title,
10
- "data-toolbar-component": "menu-section"
11
+ "data-toolbar-component": "menu-section",
12
+ testId: testId
11
13
  }, children);
12
14
  };
@@ -47,9 +47,9 @@ var ToolbarDropdownMenuContent = function ToolbarDropdownMenuContent(_ref) {
47
47
  "aria-controls": triggerProps['aria-controls'],
48
48
  onBlur: triggerProps.onBlur,
49
49
  onClick: function onClick(e) {
50
+ _onClick && _onClick(e, !(menuContext !== null && menuContext !== void 0 && menuContext.isOpen));
50
51
  handleClick();
51
52
  triggerProps.onClick && triggerProps.onClick(e);
52
- _onClick && _onClick(e);
53
53
  },
54
54
  onFocus: triggerProps.onFocus,
55
55
  testId: testId,
@@ -18,7 +18,8 @@ export var ToolbarNestedDropdownMenu = function ToolbarNestedDropdownMenu(_ref)
18
18
  isDisabled = _ref.isDisabled,
19
19
  testId = _ref.testId,
20
20
  _ref$enableMaxHeight = _ref.enableMaxHeight,
21
- enableMaxHeight = _ref$enableMaxHeight === void 0 ? false : _ref$enableMaxHeight;
21
+ enableMaxHeight = _ref$enableMaxHeight === void 0 ? false : _ref$enableMaxHeight,
22
+ _onClick = _ref.onClick;
22
23
  return /*#__PURE__*/React.createElement(DropdownMenu, {
23
24
  placement: "right-start",
24
25
  trigger: function trigger(triggerProps) {
@@ -26,7 +27,10 @@ export var ToolbarNestedDropdownMenu = function ToolbarNestedDropdownMenu(_ref)
26
27
  elemBefore: elemBefore,
27
28
  elemAfter: elemAfter,
28
29
  isSelected: triggerProps.isSelected,
29
- onClick: triggerProps.onClick,
30
+ onClick: function onClick(e) {
31
+ _onClick && _onClick(e);
32
+ triggerProps.onClick && triggerProps.onClick(e);
33
+ },
30
34
  testId: testId,
31
35
  triggerRef: triggerProps.triggerRef,
32
36
  hasNestedDropdownMenu: true,
@@ -4,9 +4,11 @@ export var ToolbarTooltip = function ToolbarTooltip(_ref) {
4
4
  var content = _ref.content,
5
5
  children = _ref.children,
6
6
  _ref$position = _ref.position,
7
- position = _ref$position === void 0 ? 'top' : _ref$position;
7
+ position = _ref$position === void 0 ? 'top' : _ref$position,
8
+ delay = _ref.delay;
8
9
  return /*#__PURE__*/React.createElement(Tooltip, {
9
10
  content: content,
10
- position: position
11
+ position: position,
12
+ delay: delay
11
13
  }, children);
12
14
  };
@@ -0,0 +1,27 @@
1
+ import { useEffect, useRef } from 'react';
2
+ import { useToolbarUI } from '../hooks/ui-context';
3
+ export var ACTION_SUBJECT = {
4
+ TOOLBAR: 'toolbar',
5
+ TOOLBAR_DROPDOWN_MENU: 'toolbarDropdownMenu'
6
+ };
7
+ export var ViewEventEmitter = function ViewEventEmitter(_ref) {
8
+ var actionSubjectId = _ref.actionSubjectId,
9
+ actionSubject = _ref.actionSubject;
10
+ var isMountedRef = useRef(false);
11
+ var _useToolbarUI = useToolbarUI(),
12
+ fireAnalyticsEvent = _useToolbarUI.fireAnalyticsEvent;
13
+ useEffect(function () {
14
+ if (isMountedRef.current) {
15
+ return;
16
+ }
17
+ isMountedRef.current = true;
18
+ var payload = {
19
+ action: 'viewed',
20
+ actionSubject: actionSubject,
21
+ actionSubjectId: actionSubjectId,
22
+ eventType: 'ui'
23
+ };
24
+ fireAnalyticsEvent && fireAnalyticsEvent(payload);
25
+ }, [actionSubjectId, actionSubject, fireAnalyticsEvent]);
26
+ return null;
27
+ };
@@ -0,0 +1,2 @@
1
+ /* eslint-disable @atlaskit/editor/no-re-export */
2
+ export { default as DefineIcon } from '@atlaskit/icon/core/information-circle';
@@ -0,0 +1,2 @@
1
+ /* eslint-disable @atlaskit/editor/no-re-export */
2
+ export { default as PlusIcon } from '@atlaskit/icon/core/plus-square';
@@ -1,6 +1,14 @@
1
1
  import React from 'react';
2
2
  import type { OnOpenChangeArgs } from '@atlaskit/dropdown-menu';
3
+ type AnalyticsEventPayload = {
4
+ action: string;
5
+ actionSubject?: string;
6
+ actionSubjectId?: string;
7
+ eventType: string;
8
+ };
9
+ type FireAnalyticsEvent = (payload: AnalyticsEventPayload) => void | undefined;
3
10
  export type ToolbarUIContextType = {
11
+ fireAnalyticsEvent?: FireAnalyticsEvent;
4
12
  /**
5
13
  * Indicates whether the toolbar is disabled when the editor is offline.
6
14
  */
@@ -26,5 +34,5 @@ export declare const useToolbarUI: () => ToolbarUIContextType;
26
34
  type ToolbarUIProviderProps = {
27
35
  children: React.ReactNode;
28
36
  } & ToolbarUIContextType;
29
- export declare const ToolbarUIProvider: ({ children, onDropdownOpenChanged, preventDefaultOnMouseDown, isDisabled, popupsMountPoint, popupsBoundariesElement, popupsScrollableElement, }: ToolbarUIProviderProps) => React.JSX.Element;
37
+ export declare const ToolbarUIProvider: ({ children, onDropdownOpenChanged, preventDefaultOnMouseDown, isDisabled, popupsMountPoint, popupsBoundariesElement, popupsScrollableElement, fireAnalyticsEvent, }: ToolbarUIProviderProps) => React.JSX.Element;
30
38
  export {};
@@ -29,6 +29,7 @@ export { AddIcon } from './ui/icons/AddIcon';
29
29
  export { AppsIcon } from './ui/icons/AppsIcon';
30
30
  export { BoldIcon } from './ui/icons/BoldIcon';
31
31
  export { CommentIcon } from './ui/icons/CommentIcon';
32
+ export { DefineIcon } from './ui/icons/DefineIcon';
32
33
  export { HeadingFiveIcon } from './ui/icons/HeadingFiveIcon';
33
34
  export { HeadingFourIcon } from './ui/icons/HeadingFourIcon';
34
35
  export { HeadingOneIcon } from './ui/icons/HeadingOneIcon';
@@ -67,6 +68,7 @@ export { UndoIcon } from './ui/icons/UndoIcon';
67
68
  export { RedoIcon } from './ui/icons/RedoIcon';
68
69
  export { HistoryIcon } from './ui/icons/HistoryIcon';
69
70
  export { LoomIcon } from './ui/icons/LoomIcon';
71
+ export { PlusIcon } from './ui/icons/PlusIcon';
70
72
  export { default as ColorPalette } from './ui/ColorPalette';
71
73
  export { getContrastingBackgroundColor } from './ui/ColorPalette/utils';
72
74
  export type { IconComponent } from './types';
@@ -1,5 +1,6 @@
1
1
  import React, { type ReactNode } from 'react';
2
2
  import type { ResponsiveContainerProps } from './ResponsiveContainer';
3
+ import { type ViewEventEmitterProps } from './ViewEventEmitter';
3
4
  type ToolbarProps = {
4
5
  children?: ReactNode;
5
6
  /**
@@ -8,13 +9,13 @@ type ToolbarProps = {
8
9
  * use case: query select the toolbar to position floating toolbar
9
10
  */
10
11
  label: string;
11
- };
12
+ } & ViewEventEmitterProps;
12
13
  /**
13
14
  * A simple component representing a toolbar with box shadows - used to represent a secondary/floating toolbar
14
15
  *
15
16
  * @note: Responsiveness support replies on container query with container editor-area and media query
16
17
  */
17
- export declare const Toolbar: ({ children, label }: ToolbarProps) => React.JSX.Element;
18
+ export declare const Toolbar: ({ children, label, actionSubjectId }: ToolbarProps) => React.JSX.Element;
18
19
  type PrimaryToolbarProps = ToolbarProps & ResponsiveContainerProps;
19
20
  /**
20
21
  * A simple component representing a toolbar without box shadows - used to represent a primary toolbar
@@ -4,6 +4,7 @@ type ToolbarButtonProps = Partial<TriggerProps> & {
4
4
  ariaKeyshortcuts?: string;
5
5
  children?: ReactNode;
6
6
  iconBefore: React.ReactNode;
7
+ interactionName?: string;
7
8
  isDisabled?: boolean;
8
9
  isSelected?: boolean;
9
10
  label?: string;
@@ -18,10 +18,11 @@ type ToolbarDropdownItemProps = {
18
18
  isSelected?: boolean;
19
19
  onClick?: (e: React.MouseEvent | React.KeyboardEvent) => void;
20
20
  rel?: string;
21
+ shouldTitleWrap?: boolean;
21
22
  target?: string;
22
23
  testId?: string;
23
24
  textStyle?: TextStyle;
24
25
  triggerRef?: Ref<HTMLButtonElement>;
25
26
  };
26
- export declare const ToolbarDropdownItem: ({ onClick, elemBefore, elemAfter, isSelected, children, isDisabled, hasNestedDropdownMenu, triggerRef, testId, ariaKeyshortcuts, href, target, rel, }: ToolbarDropdownItemProps) => React.JSX.Element;
27
+ export declare const ToolbarDropdownItem: ({ onClick, elemBefore, elemAfter, isSelected, children, isDisabled, hasNestedDropdownMenu, triggerRef, shouldTitleWrap, testId, ariaKeyshortcuts, href, target, rel, }: ToolbarDropdownItemProps) => React.JSX.Element;
27
28
  export {};
@@ -2,7 +2,8 @@ import React, { type ReactNode } from 'react';
2
2
  type ToolbarDropdownItemSectionProps = {
3
3
  children?: ReactNode;
4
4
  hasSeparator?: boolean;
5
+ testId?: string;
5
6
  title?: string;
6
7
  };
7
- export declare const ToolbarDropdownItemSection: ({ children, hasSeparator, title, }: ToolbarDropdownItemSectionProps) => React.JSX.Element;
8
+ export declare const ToolbarDropdownItemSection: ({ children, hasSeparator, title, testId, }: ToolbarDropdownItemSectionProps) => React.JSX.Element;
8
9
  export {};
@@ -16,7 +16,7 @@ type ToolbarDropdownMenuProps = {
16
16
  iconBefore: React.ReactNode;
17
17
  isDisabled?: boolean;
18
18
  label?: string;
19
- onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
19
+ onClick?: (event: React.MouseEvent<HTMLButtonElement>, isOpen: boolean) => void;
20
20
  testId?: string;
21
21
  };
22
22
  export declare const ToolbarDropdownMenu: ({ iconBefore, children, isDisabled, testId, label, hasSectionMargin, enableMaxHeight, onClick, }: ToolbarDropdownMenuProps) => JSX.Element;
@@ -12,8 +12,9 @@ type ToolbarNestedDropdownMenuProps = {
12
12
  */
13
13
  enableMaxHeight?: boolean;
14
14
  isDisabled?: boolean;
15
+ onClick?: (e: React.MouseEvent | React.KeyboardEvent) => void;
15
16
  testId?: string;
16
17
  text?: string;
17
18
  };
18
- export declare const ToolbarNestedDropdownMenu: ({ elemBefore, text, elemAfter, children, isDisabled, testId, enableMaxHeight, }: ToolbarNestedDropdownMenuProps) => JSX.Element;
19
+ export declare const ToolbarNestedDropdownMenu: ({ elemBefore, text, elemAfter, children, isDisabled, testId, enableMaxHeight, onClick, }: ToolbarNestedDropdownMenuProps) => JSX.Element;
19
20
  export {};
@@ -3,7 +3,8 @@ import type { PositionType } from '@atlaskit/tooltip';
3
3
  type ToolbarTooltipProps = {
4
4
  children: React.ReactNode;
5
5
  content: React.ReactNode;
6
+ delay?: number;
6
7
  position?: PositionType;
7
8
  };
8
- export declare const ToolbarTooltip: ({ content, children, position }: ToolbarTooltipProps) => React.JSX.Element;
9
+ export declare const ToolbarTooltip: ({ content, children, position, delay, }: ToolbarTooltipProps) => React.JSX.Element;
9
10
  export {};
@@ -0,0 +1,12 @@
1
+ export declare const ACTION_SUBJECT: {
2
+ TOOLBAR: string;
3
+ TOOLBAR_DROPDOWN_MENU: string;
4
+ };
5
+ export type ViewEventEmitterProps = {
6
+ actionSubject?: string;
7
+ /**
8
+ * Name of dropdown to identify in analytic events
9
+ */
10
+ actionSubjectId?: string;
11
+ };
12
+ export declare const ViewEventEmitter: ({ actionSubjectId, actionSubject }: ViewEventEmitterProps) => null;
@@ -0,0 +1 @@
1
+ export { default as DefineIcon } from '@atlaskit/icon/core/information-circle';
@@ -0,0 +1 @@
1
+ export { default as PlusIcon } from '@atlaskit/icon/core/plus-square';
@@ -1,6 +1,14 @@
1
1
  import React from 'react';
2
2
  import type { OnOpenChangeArgs } from '@atlaskit/dropdown-menu';
3
+ type AnalyticsEventPayload = {
4
+ action: string;
5
+ actionSubject?: string;
6
+ actionSubjectId?: string;
7
+ eventType: string;
8
+ };
9
+ type FireAnalyticsEvent = (payload: AnalyticsEventPayload) => void | undefined;
3
10
  export type ToolbarUIContextType = {
11
+ fireAnalyticsEvent?: FireAnalyticsEvent;
4
12
  /**
5
13
  * Indicates whether the toolbar is disabled when the editor is offline.
6
14
  */
@@ -26,5 +34,5 @@ export declare const useToolbarUI: () => ToolbarUIContextType;
26
34
  type ToolbarUIProviderProps = {
27
35
  children: React.ReactNode;
28
36
  } & ToolbarUIContextType;
29
- export declare const ToolbarUIProvider: ({ children, onDropdownOpenChanged, preventDefaultOnMouseDown, isDisabled, popupsMountPoint, popupsBoundariesElement, popupsScrollableElement, }: ToolbarUIProviderProps) => React.JSX.Element;
37
+ export declare const ToolbarUIProvider: ({ children, onDropdownOpenChanged, preventDefaultOnMouseDown, isDisabled, popupsMountPoint, popupsBoundariesElement, popupsScrollableElement, fireAnalyticsEvent, }: ToolbarUIProviderProps) => React.JSX.Element;
30
38
  export {};
@@ -29,6 +29,7 @@ export { AddIcon } from './ui/icons/AddIcon';
29
29
  export { AppsIcon } from './ui/icons/AppsIcon';
30
30
  export { BoldIcon } from './ui/icons/BoldIcon';
31
31
  export { CommentIcon } from './ui/icons/CommentIcon';
32
+ export { DefineIcon } from './ui/icons/DefineIcon';
32
33
  export { HeadingFiveIcon } from './ui/icons/HeadingFiveIcon';
33
34
  export { HeadingFourIcon } from './ui/icons/HeadingFourIcon';
34
35
  export { HeadingOneIcon } from './ui/icons/HeadingOneIcon';
@@ -67,6 +68,7 @@ export { UndoIcon } from './ui/icons/UndoIcon';
67
68
  export { RedoIcon } from './ui/icons/RedoIcon';
68
69
  export { HistoryIcon } from './ui/icons/HistoryIcon';
69
70
  export { LoomIcon } from './ui/icons/LoomIcon';
71
+ export { PlusIcon } from './ui/icons/PlusIcon';
70
72
  export { default as ColorPalette } from './ui/ColorPalette';
71
73
  export { getContrastingBackgroundColor } from './ui/ColorPalette/utils';
72
74
  export type { IconComponent } from './types';
@@ -1,5 +1,6 @@
1
1
  import React, { type ReactNode } from 'react';
2
2
  import type { ResponsiveContainerProps } from './ResponsiveContainer';
3
+ import { type ViewEventEmitterProps } from './ViewEventEmitter';
3
4
  type ToolbarProps = {
4
5
  children?: ReactNode;
5
6
  /**
@@ -8,13 +9,13 @@ type ToolbarProps = {
8
9
  * use case: query select the toolbar to position floating toolbar
9
10
  */
10
11
  label: string;
11
- };
12
+ } & ViewEventEmitterProps;
12
13
  /**
13
14
  * A simple component representing a toolbar with box shadows - used to represent a secondary/floating toolbar
14
15
  *
15
16
  * @note: Responsiveness support replies on container query with container editor-area and media query
16
17
  */
17
- export declare const Toolbar: ({ children, label }: ToolbarProps) => React.JSX.Element;
18
+ export declare const Toolbar: ({ children, label, actionSubjectId }: ToolbarProps) => React.JSX.Element;
18
19
  type PrimaryToolbarProps = ToolbarProps & ResponsiveContainerProps;
19
20
  /**
20
21
  * A simple component representing a toolbar without box shadows - used to represent a primary toolbar
@@ -4,6 +4,7 @@ type ToolbarButtonProps = Partial<TriggerProps> & {
4
4
  ariaKeyshortcuts?: string;
5
5
  children?: ReactNode;
6
6
  iconBefore: React.ReactNode;
7
+ interactionName?: string;
7
8
  isDisabled?: boolean;
8
9
  isSelected?: boolean;
9
10
  label?: string;
@@ -18,10 +18,11 @@ type ToolbarDropdownItemProps = {
18
18
  isSelected?: boolean;
19
19
  onClick?: (e: React.MouseEvent | React.KeyboardEvent) => void;
20
20
  rel?: string;
21
+ shouldTitleWrap?: boolean;
21
22
  target?: string;
22
23
  testId?: string;
23
24
  textStyle?: TextStyle;
24
25
  triggerRef?: Ref<HTMLButtonElement>;
25
26
  };
26
- export declare const ToolbarDropdownItem: ({ onClick, elemBefore, elemAfter, isSelected, children, isDisabled, hasNestedDropdownMenu, triggerRef, testId, ariaKeyshortcuts, href, target, rel, }: ToolbarDropdownItemProps) => React.JSX.Element;
27
+ export declare const ToolbarDropdownItem: ({ onClick, elemBefore, elemAfter, isSelected, children, isDisabled, hasNestedDropdownMenu, triggerRef, shouldTitleWrap, testId, ariaKeyshortcuts, href, target, rel, }: ToolbarDropdownItemProps) => React.JSX.Element;
27
28
  export {};
@@ -2,7 +2,8 @@ import React, { type ReactNode } from 'react';
2
2
  type ToolbarDropdownItemSectionProps = {
3
3
  children?: ReactNode;
4
4
  hasSeparator?: boolean;
5
+ testId?: string;
5
6
  title?: string;
6
7
  };
7
- export declare const ToolbarDropdownItemSection: ({ children, hasSeparator, title, }: ToolbarDropdownItemSectionProps) => React.JSX.Element;
8
+ export declare const ToolbarDropdownItemSection: ({ children, hasSeparator, title, testId, }: ToolbarDropdownItemSectionProps) => React.JSX.Element;
8
9
  export {};
@@ -16,7 +16,7 @@ type ToolbarDropdownMenuProps = {
16
16
  iconBefore: React.ReactNode;
17
17
  isDisabled?: boolean;
18
18
  label?: string;
19
- onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
19
+ onClick?: (event: React.MouseEvent<HTMLButtonElement>, isOpen: boolean) => void;
20
20
  testId?: string;
21
21
  };
22
22
  export declare const ToolbarDropdownMenu: ({ iconBefore, children, isDisabled, testId, label, hasSectionMargin, enableMaxHeight, onClick, }: ToolbarDropdownMenuProps) => JSX.Element;
@@ -12,8 +12,9 @@ type ToolbarNestedDropdownMenuProps = {
12
12
  */
13
13
  enableMaxHeight?: boolean;
14
14
  isDisabled?: boolean;
15
+ onClick?: (e: React.MouseEvent | React.KeyboardEvent) => void;
15
16
  testId?: string;
16
17
  text?: string;
17
18
  };
18
- export declare const ToolbarNestedDropdownMenu: ({ elemBefore, text, elemAfter, children, isDisabled, testId, enableMaxHeight, }: ToolbarNestedDropdownMenuProps) => JSX.Element;
19
+ export declare const ToolbarNestedDropdownMenu: ({ elemBefore, text, elemAfter, children, isDisabled, testId, enableMaxHeight, onClick, }: ToolbarNestedDropdownMenuProps) => JSX.Element;
19
20
  export {};
@@ -3,7 +3,8 @@ import type { PositionType } from '@atlaskit/tooltip';
3
3
  type ToolbarTooltipProps = {
4
4
  children: React.ReactNode;
5
5
  content: React.ReactNode;
6
+ delay?: number;
6
7
  position?: PositionType;
7
8
  };
8
- export declare const ToolbarTooltip: ({ content, children, position }: ToolbarTooltipProps) => React.JSX.Element;
9
+ export declare const ToolbarTooltip: ({ content, children, position, delay, }: ToolbarTooltipProps) => React.JSX.Element;
9
10
  export {};
@@ -0,0 +1,12 @@
1
+ export declare const ACTION_SUBJECT: {
2
+ TOOLBAR: string;
3
+ TOOLBAR_DROPDOWN_MENU: string;
4
+ };
5
+ export type ViewEventEmitterProps = {
6
+ actionSubject?: string;
7
+ /**
8
+ * Name of dropdown to identify in analytic events
9
+ */
10
+ actionSubjectId?: string;
11
+ };
12
+ export declare const ViewEventEmitter: ({ actionSubjectId, actionSubject }: ViewEventEmitterProps) => null;
@@ -0,0 +1 @@
1
+ export { default as DefineIcon } from '@atlaskit/icon/core/information-circle';
@@ -0,0 +1 @@
1
+ export { default as PlusIcon } from '@atlaskit/icon/core/plus-square';
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "registry": "https://registry.npmjs.org/"
5
5
  },
6
- "version": "0.8.6",
6
+ "version": "0.9.0",
7
7
  "description": "Common UI for Toolbars across the platform",
8
8
  "atlassian": {
9
9
  "team": "Editor: Jenga",
@@ -31,7 +31,7 @@
31
31
  "@atlaskit/platform-feature-flags-react": "^0.3.0",
32
32
  "@atlaskit/popup": "^4.3.0",
33
33
  "@atlaskit/primitives": "^14.14.0",
34
- "@atlaskit/tmp-editor-statsig": "^12.14.0",
34
+ "@atlaskit/tmp-editor-statsig": "^12.21.0",
35
35
  "@atlaskit/tokens": "^6.3.0",
36
36
  "@atlaskit/tooltip": "^20.4.0",
37
37
  "@babel/runtime": "^7.0.0",