@atlaskit/editor-toolbar 2.8.50 → 2.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # @atlaskit/editor-toolbar
2
2
 
3
+ ## 2.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`2d08872dfd3da`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2d08872dfd3da) -
8
+ Add an optional product-supplied async AI credit decision accepting a typed Editor feature-name
9
+ context object and returning a content renderer, with the editor block menu as the first consumer.
10
+ Menu actions declare optional credit-check configuration. Editor owns popup activation and
11
+ lifecycle; Confluence owns credit state and experiment eligibility. Export the shared credit
12
+ content for host-owned popups.
13
+
14
+ Blocked decisions require product-supplied content. If the advisory check rejects, Editor allows
15
+ the action to proceed; its backend remains authoritative for enforcement.
16
+
17
+ Confluence selects the guard with `confluence_ubp_edit_with_rovo_afm` behind the
18
+ `rovo_credits_degradation_ui` prerequisite, recording both cohorts at registration.
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies
23
+
24
+ ## 2.8.51
25
+
26
+ ### Patch Changes
27
+
28
+ - Updated dependencies
29
+
3
30
  ## 2.8.50
4
31
 
5
32
  ### Patch Changes
@@ -19,8 +19,9 @@ var _anchor = require("@atlaskit/primitives/compiled/anchor");
19
19
  var _box = require("@atlaskit/primitives/compiled/box");
20
20
  var _pressable = require("@atlaskit/primitives/compiled/pressable");
21
21
  var _ToolbarDropdownMenuContext = require("./ToolbarDropdownMenuContext");
22
- var _excluded = ["children", "data-testid", "aria-haspopup", "aria-disabled", "aria-pressed", "aria-keyshortcuts", "onClick", "onBlur", "onFocus", "onMouseEnter", "onMouseLeave", "tabIndex", "href", "target", "rel", "title", "itemRole"],
23
- _excluded2 = ["onClick", "onBlur", "onFocus", "onMouseEnter", "onMouseLeave", "elemBefore", "elemAfter", "elemAfterText", "isSelected", "children", "isDisabled", "hasNestedDropdownMenu", "triggerRef", "title", "shouldTitleWrap", "testId", "ariaKeyshortcuts", "href", "target", "rel", "role"];
22
+ var _excluded = ["children", "data-testid", "aria-haspopup", "aria-disabled", "aria-pressed", "aria-keyshortcuts", "onClick", "onBlur", "onFocus", "onMouseEnter", "onMouseLeave", "tabIndex", "title", "data-extension-item-key", "itemRole"],
23
+ _excluded2 = ["children", "data-testid", "aria-haspopup", "aria-disabled", "aria-pressed", "aria-keyshortcuts", "onClick", "onBlur", "onFocus", "onMouseEnter", "onMouseLeave", "tabIndex", "href", "target", "rel", "title", "itemRole"],
24
+ _excluded3 = ["aria-haspopup", "onClick", "onBlur", "onFocus", "onMouseEnter", "onMouseLeave", "elemBefore", "elemAfter", "elemAfterText", "isSelected", "children", "isDisabled", "hasNestedDropdownMenu", "triggerRef", "title", "shouldTitleWrap", "testId", "ariaKeyshortcuts", "href", "target", "rel", "role"];
24
25
  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
26
  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
27
  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; }
@@ -47,8 +48,11 @@ var CustomDropdownMenuItemButton = /*#__PURE__*/(0, _react.forwardRef)(function
47
48
  tabIndex = _ref.tabIndex,
48
49
  title = _ref.title,
49
50
  dataExtensionItemKey = _ref['data-extension-item-key'],
50
- itemRole = _ref.itemRole;
51
- return /*#__PURE__*/_react.default.createElement(_pressable.Pressable, {
51
+ itemRole = _ref.itemRole,
52
+ dataAttributes = (0, _objectWithoutProperties2.default)(_ref, _excluded);
53
+ return /*#__PURE__*/_react.default.createElement(_pressable.Pressable
54
+ // eslint-disable-next-line react/jsx-props-no-spreading -- Forward the native trigger relationship and data attributes.
55
+ , (0, _extends2.default)({}, dataAttributes, {
52
56
  role: itemRole || 'menuitem',
53
57
  testId: testId,
54
58
  xcss: (0, _css.cx)(styles.toolbarDropdownItem, ariaDisabled ? styles.disabled : ariaPressed ? styles.selected : styles.enabled),
@@ -67,7 +71,7 @@ var CustomDropdownMenuItemButton = /*#__PURE__*/(0, _react.forwardRef)(function
67
71
  ref: ref,
68
72
  title: title,
69
73
  "data-extension-item-key": dataExtensionItemKey
70
- }, children);
74
+ }), children);
71
75
  });
72
76
  var CustomDropdownMenuItemAnchor = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
73
77
  var children = _ref2.children,
@@ -87,7 +91,7 @@ var CustomDropdownMenuItemAnchor = /*#__PURE__*/(0, _react.forwardRef)(function
87
91
  rel = _ref2.rel,
88
92
  title = _ref2.title,
89
93
  itemRole = _ref2.itemRole,
90
- dataAttributes = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
94
+ dataAttributes = (0, _objectWithoutProperties2.default)(_ref2, _excluded2);
91
95
  return /*#__PURE__*/_react.default.createElement(_anchor.Anchor, (0, _extends2.default)({
92
96
  role: itemRole || 'menuitem',
93
97
  testId: testId,
@@ -113,7 +117,8 @@ var CustomDropdownMenuItemAnchor = /*#__PURE__*/(0, _react.forwardRef)(function
113
117
  }, dataAttributes), children);
114
118
  });
115
119
  var ToolbarDropdownItem = exports.ToolbarDropdownItem = function ToolbarDropdownItem(_ref3) {
116
- var _onClick = _ref3.onClick,
120
+ var ariaHasPopup = _ref3['aria-haspopup'],
121
+ _onClick = _ref3.onClick,
117
122
  onBlur = _ref3.onBlur,
118
123
  onFocus = _ref3.onFocus,
119
124
  onMouseEnter = _ref3.onMouseEnter,
@@ -135,7 +140,7 @@ var ToolbarDropdownItem = exports.ToolbarDropdownItem = function ToolbarDropdown
135
140
  target = _ref3.target,
136
141
  rel = _ref3.rel,
137
142
  role = _ref3.role,
138
- dataAttributes = (0, _objectWithoutProperties2.default)(_ref3, _excluded2);
143
+ dataAttributes = (0, _objectWithoutProperties2.default)(_ref3, _excluded3);
139
144
  var parentContext = (0, _ToolbarDropdownMenuContext.useToolbarDropdownMenu)();
140
145
  var injectedElemAfter = function () {
141
146
  if (! /*#__PURE__*/(0, _react.isValidElement)(elemAfter)) {
@@ -166,7 +171,7 @@ var ToolbarDropdownItem = exports.ToolbarDropdownItem = function ToolbarDropdown
166
171
  elemAfter: injectedElemAfter,
167
172
  isSelected: isSelected,
168
173
  isDisabled: isDisabled,
169
- "aria-haspopup": hasNestedDropdownMenu,
174
+ "aria-haspopup": ariaHasPopup !== null && ariaHasPopup !== void 0 ? ariaHasPopup : hasNestedDropdownMenu,
170
175
  "aria-pressed": isSelected,
171
176
  "aria-keyshortcuts": ariaKeyshortcuts,
172
177
  itemRole: role,
@@ -32,8 +32,11 @@ const CustomDropdownMenuItemButton = /*#__PURE__*/forwardRef(({
32
32
  tabIndex,
33
33
  title,
34
34
  'data-extension-item-key': dataExtensionItemKey,
35
- itemRole
36
- }, ref) => /*#__PURE__*/React.createElement(Pressable, {
35
+ itemRole,
36
+ ...dataAttributes
37
+ }, ref) => /*#__PURE__*/React.createElement(Pressable
38
+ // eslint-disable-next-line react/jsx-props-no-spreading -- Forward the native trigger relationship and data attributes.
39
+ , _extends({}, dataAttributes, {
37
40
  role: itemRole || 'menuitem',
38
41
  testId: testId,
39
42
  xcss: cx(styles.toolbarDropdownItem, ariaDisabled ? styles.disabled : ariaPressed ? styles.selected : styles.enabled),
@@ -52,7 +55,7 @@ const CustomDropdownMenuItemButton = /*#__PURE__*/forwardRef(({
52
55
  ref: ref,
53
56
  title: title,
54
57
  "data-extension-item-key": dataExtensionItemKey
55
- }, children));
58
+ }), children));
56
59
  const CustomDropdownMenuItemAnchor = /*#__PURE__*/forwardRef(({
57
60
  children,
58
61
  'data-testid': testId,
@@ -96,6 +99,7 @@ const CustomDropdownMenuItemAnchor = /*#__PURE__*/forwardRef(({
96
99
  // eslint-disable-next-line react/jsx-props-no-spreading
97
100
  }, dataAttributes), children));
98
101
  export const ToolbarDropdownItem = ({
102
+ 'aria-haspopup': ariaHasPopup,
99
103
  onClick,
100
104
  onBlur,
101
105
  onFocus,
@@ -150,7 +154,7 @@ export const ToolbarDropdownItem = ({
150
154
  elemAfter: injectedElemAfter,
151
155
  isSelected: isSelected,
152
156
  isDisabled: isDisabled,
153
- "aria-haspopup": hasNestedDropdownMenu,
157
+ "aria-haspopup": ariaHasPopup !== null && ariaHasPopup !== void 0 ? ariaHasPopup : hasNestedDropdownMenu,
154
158
  "aria-pressed": isSelected,
155
159
  "aria-keyshortcuts": ariaKeyshortcuts,
156
160
  itemRole: role,
@@ -2,8 +2,9 @@
2
2
  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
- var _excluded = ["children", "data-testid", "aria-haspopup", "aria-disabled", "aria-pressed", "aria-keyshortcuts", "onClick", "onBlur", "onFocus", "onMouseEnter", "onMouseLeave", "tabIndex", "href", "target", "rel", "title", "itemRole"],
6
- _excluded2 = ["onClick", "onBlur", "onFocus", "onMouseEnter", "onMouseLeave", "elemBefore", "elemAfter", "elemAfterText", "isSelected", "children", "isDisabled", "hasNestedDropdownMenu", "triggerRef", "title", "shouldTitleWrap", "testId", "ariaKeyshortcuts", "href", "target", "rel", "role"];
5
+ var _excluded = ["children", "data-testid", "aria-haspopup", "aria-disabled", "aria-pressed", "aria-keyshortcuts", "onClick", "onBlur", "onFocus", "onMouseEnter", "onMouseLeave", "tabIndex", "title", "data-extension-item-key", "itemRole"],
6
+ _excluded2 = ["children", "data-testid", "aria-haspopup", "aria-disabled", "aria-pressed", "aria-keyshortcuts", "onClick", "onBlur", "onFocus", "onMouseEnter", "onMouseLeave", "tabIndex", "href", "target", "rel", "title", "itemRole"],
7
+ _excluded3 = ["aria-haspopup", "onClick", "onBlur", "onFocus", "onMouseEnter", "onMouseLeave", "elemBefore", "elemAfter", "elemAfterText", "isSelected", "children", "isDisabled", "hasNestedDropdownMenu", "triggerRef", "title", "shouldTitleWrap", "testId", "ariaKeyshortcuts", "href", "target", "rel", "role"];
7
8
  import "./ToolbarDropdownItem.compiled.css";
8
9
  import { ax, ix } from "@compiled/react/runtime";
9
10
  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; }
@@ -38,8 +39,11 @@ var CustomDropdownMenuItemButton = /*#__PURE__*/forwardRef(function (_ref, ref)
38
39
  tabIndex = _ref.tabIndex,
39
40
  title = _ref.title,
40
41
  dataExtensionItemKey = _ref['data-extension-item-key'],
41
- itemRole = _ref.itemRole;
42
- return /*#__PURE__*/React.createElement(Pressable, {
42
+ itemRole = _ref.itemRole,
43
+ dataAttributes = _objectWithoutProperties(_ref, _excluded);
44
+ return /*#__PURE__*/React.createElement(Pressable
45
+ // eslint-disable-next-line react/jsx-props-no-spreading -- Forward the native trigger relationship and data attributes.
46
+ , _extends({}, dataAttributes, {
43
47
  role: itemRole || 'menuitem',
44
48
  testId: testId,
45
49
  xcss: cx(styles.toolbarDropdownItem, ariaDisabled ? styles.disabled : ariaPressed ? styles.selected : styles.enabled),
@@ -58,7 +62,7 @@ var CustomDropdownMenuItemButton = /*#__PURE__*/forwardRef(function (_ref, ref)
58
62
  ref: ref,
59
63
  title: title,
60
64
  "data-extension-item-key": dataExtensionItemKey
61
- }, children);
65
+ }), children);
62
66
  });
63
67
  var CustomDropdownMenuItemAnchor = /*#__PURE__*/forwardRef(function (_ref2, ref) {
64
68
  var children = _ref2.children,
@@ -78,7 +82,7 @@ var CustomDropdownMenuItemAnchor = /*#__PURE__*/forwardRef(function (_ref2, ref)
78
82
  rel = _ref2.rel,
79
83
  title = _ref2.title,
80
84
  itemRole = _ref2.itemRole,
81
- dataAttributes = _objectWithoutProperties(_ref2, _excluded);
85
+ dataAttributes = _objectWithoutProperties(_ref2, _excluded2);
82
86
  return /*#__PURE__*/React.createElement(Anchor, _extends({
83
87
  role: itemRole || 'menuitem',
84
88
  testId: testId,
@@ -104,7 +108,8 @@ var CustomDropdownMenuItemAnchor = /*#__PURE__*/forwardRef(function (_ref2, ref)
104
108
  }, dataAttributes), children);
105
109
  });
106
110
  export var ToolbarDropdownItem = function ToolbarDropdownItem(_ref3) {
107
- var _onClick = _ref3.onClick,
111
+ var ariaHasPopup = _ref3['aria-haspopup'],
112
+ _onClick = _ref3.onClick,
108
113
  onBlur = _ref3.onBlur,
109
114
  onFocus = _ref3.onFocus,
110
115
  onMouseEnter = _ref3.onMouseEnter,
@@ -126,7 +131,7 @@ export var ToolbarDropdownItem = function ToolbarDropdownItem(_ref3) {
126
131
  target = _ref3.target,
127
132
  rel = _ref3.rel,
128
133
  role = _ref3.role,
129
- dataAttributes = _objectWithoutProperties(_ref3, _excluded2);
134
+ dataAttributes = _objectWithoutProperties(_ref3, _excluded3);
130
135
  var parentContext = useToolbarDropdownMenu();
131
136
  var injectedElemAfter = function () {
132
137
  if (! /*#__PURE__*/isValidElement(elemAfter)) {
@@ -157,7 +162,7 @@ export var ToolbarDropdownItem = function ToolbarDropdownItem(_ref3) {
157
162
  elemAfter: injectedElemAfter,
158
163
  isSelected: isSelected,
159
164
  isDisabled: isDisabled,
160
- "aria-haspopup": hasNestedDropdownMenu,
165
+ "aria-haspopup": ariaHasPopup !== null && ariaHasPopup !== void 0 ? ariaHasPopup : hasNestedDropdownMenu,
161
166
  "aria-pressed": isSelected,
162
167
  "aria-keyshortcuts": ariaKeyshortcuts,
163
168
  itemRole: role,
@@ -11,15 +11,20 @@ export type ToolbarDropdownItemInteractionProps = {
11
11
  };
12
12
  export type ToolbarDropdownItemRole = 'menuitem' | 'menuitemcheckbox' | 'menuitemradio';
13
13
  export type CustomDropdownMenuItemButtonProps = CustomItemComponentProps & ToolbarDropdownItemInteractionProps & {
14
+ 'aria-controls'?: string;
14
15
  'aria-disabled'?: boolean;
15
- 'aria-haspopup'?: boolean;
16
+ 'aria-haspopup'?: React.AriaAttributes['aria-haspopup'];
16
17
  'aria-keyshortcuts'?: string;
17
18
  'aria-pressed'?: boolean;
18
19
  'data-extension-item-key'?: string;
20
+ id?: string;
19
21
  itemRole?: ToolbarDropdownItemRole;
20
22
  title?: string;
21
23
  };
22
24
  type ToolbarDropdownItemProps = ToolbarDropdownItemInteractionProps & {
25
+ 'aria-controls'?: string;
26
+ /** Accessible relationship for items that open a nested popup. */
27
+ 'aria-haspopup'?: React.AriaAttributes['aria-haspopup'];
23
28
  ariaKeyshortcuts?: string;
24
29
  children?: React.ReactNode;
25
30
  elemAfter?: ReactNode;
@@ -27,6 +32,7 @@ type ToolbarDropdownItemProps = ToolbarDropdownItemInteractionProps & {
27
32
  elemBefore?: ReactNode;
28
33
  hasNestedDropdownMenu?: boolean;
29
34
  href?: string;
35
+ id?: string;
30
36
  isDisabled?: boolean;
31
37
  isSelected?: boolean;
32
38
  onClick?: (e: React.MouseEvent | React.KeyboardEvent) => void;
@@ -39,5 +45,5 @@ type ToolbarDropdownItemProps = ToolbarDropdownItemInteractionProps & {
39
45
  title?: string;
40
46
  triggerRef?: Ref<HTMLButtonElement>;
41
47
  } & DataAttributes;
42
- export declare const ToolbarDropdownItem: ({ onClick, onBlur, onFocus, onMouseEnter, onMouseLeave, elemBefore, elemAfter, elemAfterText, isSelected, children, isDisabled, hasNestedDropdownMenu, triggerRef, title, shouldTitleWrap, testId, ariaKeyshortcuts, href, target, rel, role, ...dataAttributes }: ToolbarDropdownItemProps) => React.JSX.Element;
48
+ export declare const ToolbarDropdownItem: ({ 'aria-haspopup': ariaHasPopup, onClick, onBlur, onFocus, onMouseEnter, onMouseLeave, elemBefore, elemAfter, elemAfterText, isSelected, children, isDisabled, hasNestedDropdownMenu, triggerRef, title, shouldTitleWrap, testId, ariaKeyshortcuts, href, target, rel, role, ...dataAttributes }: ToolbarDropdownItemProps) => React.JSX.Element;
43
49
  export {};
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "registry": "https://registry.npmjs.org/"
5
5
  },
6
- "version": "2.8.50",
6
+ "version": "2.9.0",
7
7
  "description": "Common UI for Toolbars across the platform",
8
8
  "atlassian": {
9
9
  "website": {
@@ -45,7 +45,7 @@
45
45
  "@atlaskit/popup": "^10.2.0",
46
46
  "@atlaskit/primitives": "^22.6.0",
47
47
  "@atlaskit/react-compiler-gating": "^0.2.0",
48
- "@atlaskit/tmp-editor-statsig": "^253.0.0",
48
+ "@atlaskit/tmp-editor-statsig": "^255.0.0",
49
49
  "@atlaskit/tokens": "^20.9.0",
50
50
  "@atlaskit/tooltip": "^24.4.0",
51
51
  "@babel/runtime": "^7.0.0",