@atlaskit/editor-toolbar 1.4.0 → 1.4.1

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,23 @@
1
1
  # @atlaskit/editor-toolbar
2
2
 
3
+ ## 1.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`434b508cc2368`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/434b508cc2368) -
8
+ EDITOR-7104: Add `featured-section` placement to block menu selection extension API
9
+ - Add `featured-section` to `BlockMenuPlacement` type which registers a top-level section with a
10
+ separator
11
+ - Add `BLOCK_ACTIONS_TEMPLATE_SECTION` and `BLOCK_ACTIONS_FEATURED_EXTENSION_SECTION_KEYS`
12
+ constants to `editor-common`
13
+ - Render lozenge inline next to label text (not pushed to far right) for dropdown and nested
14
+ dropdown items
15
+ - Move "New" lozenge next to label for synced block dropdown items
16
+ - Block template/menu behaviour gated behind `platform_editor_block_menu_v2_patch_2`; synced-block
17
+ lozenge placement behaviour gated behind `platform_synced_block_patch_12`
18
+
19
+ - Updated dependencies
20
+
3
21
  ## 1.4.0
4
22
 
5
23
  ### Minor Changes
@@ -2,6 +2,7 @@
2
2
  ._11c8fhey{font:var(--ds-font-body,normal 400 14px/20px "Atlassian Sans",ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
3
3
  ._18zrutpp{padding-inline:var(--ds-space-150,9pt)}
4
4
  ._1rjc1b66{padding-block:var(--ds-space-050,4px)}
5
+ ._18u012x7{margin-left:var(--ds-space-075,6px)}
5
6
  ._1bsb1osq{width:100%}
6
7
  ._1e0c1txw{display:flex}
7
8
  ._1hmsglyw{text-decoration-line:none}
@@ -20,7 +20,7 @@ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
20
20
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
21
21
  var _ToolbarDropdownMenuContext = require("./ToolbarDropdownMenuContext");
22
22
  var _excluded = ["children", "data-testid", "aria-haspopup", "aria-disabled", "aria-pressed", "aria-keyshortcuts", "onClick", "tabIndex", "href", "target", "rel", "title"],
23
- _excluded2 = ["onClick", "elemBefore", "elemAfter", "isSelected", "children", "isDisabled", "hasNestedDropdownMenu", "triggerRef", "title", "shouldTitleWrap", "testId", "ariaKeyshortcuts", "href", "target", "rel"];
23
+ _excluded2 = ["onClick", "elemBefore", "elemAfter", "elemAfterText", "isSelected", "children", "isDisabled", "hasNestedDropdownMenu", "triggerRef", "title", "shouldTitleWrap", "testId", "ariaKeyshortcuts", "href", "target", "rel"];
24
24
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
25
25
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
26
26
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -29,7 +29,8 @@ var styles = {
29
29
  anchor: "_4bfu1r31 _1hmsglyw _ajmmnqa1 _1053azsu _9oik1r31 _1bnxglyw _jf4cnqa1 _30l3azsu",
30
30
  enabled: "_irr31dpa _1di6fcek",
31
31
  disabled: "_syaz1gmx _80om13gf",
32
- selected: "_bfhk15s3 _syaz6x5g _irr3ufnl _1di6nozp"
32
+ selected: "_bfhk15s3 _syaz6x5g _irr3ufnl _1di6nozp",
33
+ elemAfterText: "_18u012x7"
33
34
  };
34
35
  var CustomDropdownMenuItemButton = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
35
36
  var children = _ref.children,
@@ -99,6 +100,7 @@ var ToolbarDropdownItem = exports.ToolbarDropdownItem = function ToolbarDropdown
99
100
  var _onClick = _ref3.onClick,
100
101
  elemBefore = _ref3.elemBefore,
101
102
  elemAfter = _ref3.elemAfter,
103
+ elemAfterText = _ref3.elemAfterText,
102
104
  isSelected = _ref3.isSelected,
103
105
  children = _ref3.children,
104
106
  isDisabled = _ref3.isDisabled,
@@ -154,5 +156,8 @@ var ToolbarDropdownItem = exports.ToolbarDropdownItem = function ToolbarDropdown
154
156
  title: title,
155
157
  shouldTitleWrap: shouldTitleWrap
156
158
  // eslint-disable-next-line react/jsx-props-no-spreading
157
- }, (0, _expValEquals.expValEquals)('platform_editor_renderer_toolbar_updates', 'isEnabled', true) ? dataAttributes : {}), children);
159
+ }, (0, _expValEquals.expValEquals)('platform_editor_renderer_toolbar_updates', 'isEnabled', true) ? dataAttributes : {}), children, elemAfterText ? /*#__PURE__*/_react.default.createElement(_compiled.Box, {
160
+ as: "span",
161
+ xcss: styles.elemAfterText
162
+ }, elemAfterText) : null);
158
163
  };
@@ -23,6 +23,7 @@ var styles = {
23
23
  var ToolbarNestedDropdownMenu = exports.ToolbarNestedDropdownMenu = function ToolbarNestedDropdownMenu(_ref) {
24
24
  var elemBefore = _ref.elemBefore,
25
25
  text = _ref.text,
26
+ elemAfterText = _ref.elemAfterText,
26
27
  elemAfter = _ref.elemAfter,
27
28
  children = _ref.children,
28
29
  isDisabled = _ref.isDisabled,
@@ -57,7 +58,7 @@ var ToolbarNestedDropdownMenu = exports.ToolbarNestedDropdownMenu = function Too
57
58
  hasNestedDropdownMenu: true,
58
59
  isDisabled: isDisabled,
59
60
  shouldTitleWrap: shouldTitleWrap
60
- }, text);
61
+ }, text, elemAfterText);
61
62
  if (tooltipContent) {
62
63
  return /*#__PURE__*/React.createElement(_ToolbarTooltip.ToolbarTooltip, {
63
64
  content: tooltipContent,
@@ -2,6 +2,7 @@
2
2
  ._11c8fhey{font:var(--ds-font-body,normal 400 14px/20px "Atlassian Sans",ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
3
3
  ._18zrutpp{padding-inline:var(--ds-space-150,9pt)}
4
4
  ._1rjc1b66{padding-block:var(--ds-space-050,4px)}
5
+ ._18u012x7{margin-left:var(--ds-space-075,6px)}
5
6
  ._1bsb1osq{width:100%}
6
7
  ._1e0c1txw{display:flex}
7
8
  ._1hmsglyw{text-decoration-line:none}
@@ -5,7 +5,7 @@ import { ax, ix } from "@compiled/react/runtime";
5
5
  import React, { forwardRef, isValidElement, cloneElement } from 'react';
6
6
  import { cx } from '@atlaskit/css';
7
7
  import { DropdownItem } from '@atlaskit/dropdown-menu';
8
- import { Anchor, Pressable } from '@atlaskit/primitives/compiled';
8
+ import { Anchor, Box, Pressable } from '@atlaskit/primitives/compiled';
9
9
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
10
10
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
11
11
  import { useToolbarDropdownMenu } from './ToolbarDropdownMenuContext';
@@ -14,7 +14,8 @@ const styles = {
14
14
  anchor: "_4bfu1r31 _1hmsglyw _ajmmnqa1 _1053azsu _9oik1r31 _1bnxglyw _jf4cnqa1 _30l3azsu",
15
15
  enabled: "_irr31dpa _1di6fcek",
16
16
  disabled: "_syaz1gmx _80om13gf",
17
- selected: "_bfhk15s3 _syaz6x5g _irr3ufnl _1di6nozp"
17
+ selected: "_bfhk15s3 _syaz6x5g _irr3ufnl _1di6nozp",
18
+ elemAfterText: "_18u012x7"
18
19
  };
19
20
  const CustomDropdownMenuItemButton = /*#__PURE__*/forwardRef(({
20
21
  children,
@@ -82,6 +83,7 @@ export const ToolbarDropdownItem = ({
82
83
  onClick,
83
84
  elemBefore,
84
85
  elemAfter,
86
+ elemAfterText,
85
87
  isSelected,
86
88
  children,
87
89
  isDisabled,
@@ -138,5 +140,8 @@ export const ToolbarDropdownItem = ({
138
140
  title: title,
139
141
  shouldTitleWrap: shouldTitleWrap
140
142
  // eslint-disable-next-line react/jsx-props-no-spreading
141
- }, expValEquals('platform_editor_renderer_toolbar_updates', 'isEnabled', true) ? dataAttributes : {}), children);
143
+ }, expValEquals('platform_editor_renderer_toolbar_updates', 'isEnabled', true) ? dataAttributes : {}), children, elemAfterText ? /*#__PURE__*/React.createElement(Box, {
144
+ as: "span",
145
+ xcss: styles.elemAfterText
146
+ }, elemAfterText) : null);
142
147
  };
@@ -14,6 +14,7 @@ const styles = {
14
14
  export const ToolbarNestedDropdownMenu = ({
15
15
  elemBefore,
16
16
  text,
17
+ elemAfterText,
17
18
  elemAfter,
18
19
  children,
19
20
  isDisabled,
@@ -47,7 +48,7 @@ export const ToolbarNestedDropdownMenu = ({
47
48
  hasNestedDropdownMenu: true,
48
49
  isDisabled: isDisabled,
49
50
  shouldTitleWrap: shouldTitleWrap
50
- }, text);
51
+ }, text, elemAfterText);
51
52
  if (tooltipContent) {
52
53
  return /*#__PURE__*/React.createElement(ToolbarTooltip, {
53
54
  content: tooltipContent,
@@ -2,6 +2,7 @@
2
2
  ._11c8fhey{font:var(--ds-font-body,normal 400 14px/20px "Atlassian Sans",ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
3
3
  ._18zrutpp{padding-inline:var(--ds-space-150,9pt)}
4
4
  ._1rjc1b66{padding-block:var(--ds-space-050,4px)}
5
+ ._18u012x7{margin-left:var(--ds-space-075,6px)}
5
6
  ._1bsb1osq{width:100%}
6
7
  ._1e0c1txw{display:flex}
7
8
  ._1hmsglyw{text-decoration-line:none}
@@ -3,7 +3,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import _extends from "@babel/runtime/helpers/extends";
4
4
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
5
5
  var _excluded = ["children", "data-testid", "aria-haspopup", "aria-disabled", "aria-pressed", "aria-keyshortcuts", "onClick", "tabIndex", "href", "target", "rel", "title"],
6
- _excluded2 = ["onClick", "elemBefore", "elemAfter", "isSelected", "children", "isDisabled", "hasNestedDropdownMenu", "triggerRef", "title", "shouldTitleWrap", "testId", "ariaKeyshortcuts", "href", "target", "rel"];
6
+ _excluded2 = ["onClick", "elemBefore", "elemAfter", "elemAfterText", "isSelected", "children", "isDisabled", "hasNestedDropdownMenu", "triggerRef", "title", "shouldTitleWrap", "testId", "ariaKeyshortcuts", "href", "target", "rel"];
7
7
  import "./ToolbarDropdownItem.compiled.css";
8
8
  import { ax, ix } from "@compiled/react/runtime";
9
9
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
@@ -11,7 +11,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
11
11
  import React, { forwardRef, isValidElement, cloneElement } from 'react';
12
12
  import { cx } from '@atlaskit/css';
13
13
  import { DropdownItem } from '@atlaskit/dropdown-menu';
14
- import { Anchor, Pressable } from '@atlaskit/primitives/compiled';
14
+ import { Anchor, Box, Pressable } from '@atlaskit/primitives/compiled';
15
15
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
16
16
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
17
17
  import { useToolbarDropdownMenu } from './ToolbarDropdownMenuContext';
@@ -20,7 +20,8 @@ var styles = {
20
20
  anchor: "_4bfu1r31 _1hmsglyw _ajmmnqa1 _1053azsu _9oik1r31 _1bnxglyw _jf4cnqa1 _30l3azsu",
21
21
  enabled: "_irr31dpa _1di6fcek",
22
22
  disabled: "_syaz1gmx _80om13gf",
23
- selected: "_bfhk15s3 _syaz6x5g _irr3ufnl _1di6nozp"
23
+ selected: "_bfhk15s3 _syaz6x5g _irr3ufnl _1di6nozp",
24
+ elemAfterText: "_18u012x7"
24
25
  };
25
26
  var CustomDropdownMenuItemButton = /*#__PURE__*/forwardRef(function (_ref, ref) {
26
27
  var children = _ref.children,
@@ -90,6 +91,7 @@ export var ToolbarDropdownItem = function ToolbarDropdownItem(_ref3) {
90
91
  var _onClick = _ref3.onClick,
91
92
  elemBefore = _ref3.elemBefore,
92
93
  elemAfter = _ref3.elemAfter,
94
+ elemAfterText = _ref3.elemAfterText,
93
95
  isSelected = _ref3.isSelected,
94
96
  children = _ref3.children,
95
97
  isDisabled = _ref3.isDisabled,
@@ -145,5 +147,8 @@ export var ToolbarDropdownItem = function ToolbarDropdownItem(_ref3) {
145
147
  title: title,
146
148
  shouldTitleWrap: shouldTitleWrap
147
149
  // eslint-disable-next-line react/jsx-props-no-spreading
148
- }, expValEquals('platform_editor_renderer_toolbar_updates', 'isEnabled', true) ? dataAttributes : {}), children);
150
+ }, expValEquals('platform_editor_renderer_toolbar_updates', 'isEnabled', true) ? dataAttributes : {}), children, elemAfterText ? /*#__PURE__*/React.createElement(Box, {
151
+ as: "span",
152
+ xcss: styles.elemAfterText
153
+ }, elemAfterText) : null);
149
154
  };
@@ -14,6 +14,7 @@ var styles = {
14
14
  export var ToolbarNestedDropdownMenu = function ToolbarNestedDropdownMenu(_ref) {
15
15
  var elemBefore = _ref.elemBefore,
16
16
  text = _ref.text,
17
+ elemAfterText = _ref.elemAfterText,
17
18
  elemAfter = _ref.elemAfter,
18
19
  children = _ref.children,
19
20
  isDisabled = _ref.isDisabled,
@@ -48,7 +49,7 @@ export var ToolbarNestedDropdownMenu = function ToolbarNestedDropdownMenu(_ref)
48
49
  hasNestedDropdownMenu: true,
49
50
  isDisabled: isDisabled,
50
51
  shouldTitleWrap: shouldTitleWrap
51
- }, text);
52
+ }, text, elemAfterText);
52
53
  if (tooltipContent) {
53
54
  return /*#__PURE__*/React.createElement(ToolbarTooltip, {
54
55
  content: tooltipContent,
@@ -14,6 +14,7 @@ type ToolbarDropdownItemProps = {
14
14
  ariaKeyshortcuts?: string;
15
15
  children?: React.ReactNode;
16
16
  elemAfter?: ReactNode;
17
+ elemAfterText?: ReactNode;
17
18
  elemBefore?: ReactNode;
18
19
  hasNestedDropdownMenu?: boolean;
19
20
  href?: string;
@@ -28,5 +29,5 @@ type ToolbarDropdownItemProps = {
28
29
  title?: string;
29
30
  triggerRef?: Ref<HTMLButtonElement>;
30
31
  } & DataAttributes;
31
- export declare const ToolbarDropdownItem: ({ onClick, elemBefore, elemAfter, isSelected, children, isDisabled, hasNestedDropdownMenu, triggerRef, title, shouldTitleWrap, testId, ariaKeyshortcuts, href, target, rel, ...dataAttributes }: ToolbarDropdownItemProps) => React.JSX.Element;
32
+ export declare const ToolbarDropdownItem: ({ onClick, elemBefore, elemAfter, elemAfterText, isSelected, children, isDisabled, hasNestedDropdownMenu, triggerRef, title, shouldTitleWrap, testId, ariaKeyshortcuts, href, target, rel, ...dataAttributes }: ToolbarDropdownItemProps) => React.JSX.Element;
32
33
  export {};
@@ -7,6 +7,7 @@ type ToolbarNestedDropdownMenuProps = {
7
7
  children?: ReactNode;
8
8
  dropdownTestId?: string;
9
9
  elemAfter: ReactNode;
10
+ elemAfterText?: ReactNode;
10
11
  elemBefore: ReactNode;
11
12
  /**
12
13
  * Enforeces a max height of 320px for menus - when menu is larger a scroll is introduced
@@ -20,5 +21,5 @@ type ToolbarNestedDropdownMenuProps = {
20
21
  text?: string;
21
22
  tooltipContent?: ReactNode;
22
23
  };
23
- export declare const ToolbarNestedDropdownMenu: ({ elemBefore, text, elemAfter, children, isDisabled, testId, dropdownTestId, enableMaxHeight, onClick, shouldFitContainer, shouldTitleWrap, tooltipContent, }: ToolbarNestedDropdownMenuProps) => JSX.Element;
24
+ export declare const ToolbarNestedDropdownMenu: ({ elemBefore, text, elemAfterText, elemAfter, children, isDisabled, testId, dropdownTestId, enableMaxHeight, onClick, shouldFitContainer, shouldTitleWrap, tooltipContent, }: ToolbarNestedDropdownMenuProps) => JSX.Element;
24
25
  export {};
@@ -14,6 +14,7 @@ type ToolbarDropdownItemProps = {
14
14
  ariaKeyshortcuts?: string;
15
15
  children?: React.ReactNode;
16
16
  elemAfter?: ReactNode;
17
+ elemAfterText?: ReactNode;
17
18
  elemBefore?: ReactNode;
18
19
  hasNestedDropdownMenu?: boolean;
19
20
  href?: string;
@@ -28,5 +29,5 @@ type ToolbarDropdownItemProps = {
28
29
  title?: string;
29
30
  triggerRef?: Ref<HTMLButtonElement>;
30
31
  } & DataAttributes;
31
- export declare const ToolbarDropdownItem: ({ onClick, elemBefore, elemAfter, isSelected, children, isDisabled, hasNestedDropdownMenu, triggerRef, title, shouldTitleWrap, testId, ariaKeyshortcuts, href, target, rel, ...dataAttributes }: ToolbarDropdownItemProps) => React.JSX.Element;
32
+ export declare const ToolbarDropdownItem: ({ onClick, elemBefore, elemAfter, elemAfterText, isSelected, children, isDisabled, hasNestedDropdownMenu, triggerRef, title, shouldTitleWrap, testId, ariaKeyshortcuts, href, target, rel, ...dataAttributes }: ToolbarDropdownItemProps) => React.JSX.Element;
32
33
  export {};
@@ -7,6 +7,7 @@ type ToolbarNestedDropdownMenuProps = {
7
7
  children?: ReactNode;
8
8
  dropdownTestId?: string;
9
9
  elemAfter: ReactNode;
10
+ elemAfterText?: ReactNode;
10
11
  elemBefore: ReactNode;
11
12
  /**
12
13
  * Enforeces a max height of 320px for menus - when menu is larger a scroll is introduced
@@ -20,5 +21,5 @@ type ToolbarNestedDropdownMenuProps = {
20
21
  text?: string;
21
22
  tooltipContent?: ReactNode;
22
23
  };
23
- export declare const ToolbarNestedDropdownMenu: ({ elemBefore, text, elemAfter, children, isDisabled, testId, dropdownTestId, enableMaxHeight, onClick, shouldFitContainer, shouldTitleWrap, tooltipContent, }: ToolbarNestedDropdownMenuProps) => JSX.Element;
24
+ export declare const ToolbarNestedDropdownMenu: ({ elemBefore, text, elemAfterText, elemAfter, children, isDisabled, testId, dropdownTestId, enableMaxHeight, onClick, shouldFitContainer, shouldTitleWrap, tooltipContent, }: ToolbarNestedDropdownMenuProps) => JSX.Element;
24
25
  export {};
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "registry": "https://registry.npmjs.org/"
5
5
  },
6
- "version": "1.4.0",
6
+ "version": "1.4.1",
7
7
  "description": "Common UI for Toolbars across the platform",
8
8
  "atlassian": {
9
9
  "react-compiler": {
@@ -37,7 +37,7 @@
37
37
  "@atlaskit/platform-feature-flags": "^1.1.0",
38
38
  "@atlaskit/popup": "^4.19.0",
39
39
  "@atlaskit/primitives": "^19.0.0",
40
- "@atlaskit/tmp-editor-statsig": "^80.2.0",
40
+ "@atlaskit/tmp-editor-statsig": "^80.3.0",
41
41
  "@atlaskit/tokens": "^13.0.0",
42
42
  "@atlaskit/tooltip": "^22.2.0",
43
43
  "@babel/runtime": "^7.0.0",