@atlaskit/editor-plugin-status 17.2.1 → 17.2.3
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 +15 -0
- package/dist/cjs/ui/ContentComponent.js +1 -0
- package/dist/cjs/ui/getSuggestedStatuses.js +4 -2
- package/dist/cjs/ui/statusPicker.js +79 -25
- package/dist/es2019/ui/ContentComponent.js +2 -1
- package/dist/es2019/ui/getSuggestedStatuses.js +3 -1
- package/dist/es2019/ui/statusPicker.js +78 -24
- package/dist/esm/ui/ContentComponent.js +2 -1
- package/dist/esm/ui/getSuggestedStatuses.js +3 -1
- package/dist/esm/ui/statusPicker.js +79 -25
- package/dist/types/ui/getSuggestedStatuses.d.ts +2 -1
- package/package.json +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-status
|
|
2
2
|
|
|
3
|
+
## 17.2.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 17.2.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`501b7257aaa6d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/501b7257aaa6d) -
|
|
14
|
+
Add a capped, scrollable status suggestion list with parent-constrained labels behind
|
|
15
|
+
platform_editor_status_popup_suggestions_patch_1.
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 17.2.1
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -95,6 +95,7 @@ function ContentComponent(_ref) {
|
|
|
95
95
|
text: text
|
|
96
96
|
},
|
|
97
97
|
doc: editorView.state.doc,
|
|
98
|
+
limit: (0, _fg.fg)('platform_editor_status_popup_suggestions_patch_1') ? _getSuggestedStatuses.MAX_SUGGESTED_STATUSES : _getSuggestedStatuses.MAX_SUGGESTED_STATUSES_OLD,
|
|
98
99
|
shouldUppercaseText: (0, _fg.fg)('platform-dst-lozenge-tag-badge-visual-uplifts')
|
|
99
100
|
});
|
|
100
101
|
}, [showStatusPickerAt, editorView.state.doc]);
|
|
@@ -4,13 +4,15 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.getSuggestedStatuses = exports.MAX_SUGGESTED_STATUSES = void 0;
|
|
7
|
+
exports.getSuggestedStatuses = exports.MAX_SUGGESTED_STATUSES_OLD = exports.MAX_SUGGESTED_STATUSES = void 0;
|
|
8
8
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _excluded = ["distance"];
|
|
11
11
|
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; }
|
|
12
12
|
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; }
|
|
13
|
-
var MAX_SUGGESTED_STATUSES = exports.MAX_SUGGESTED_STATUSES =
|
|
13
|
+
var MAX_SUGGESTED_STATUSES = exports.MAX_SUGGESTED_STATUSES = 20;
|
|
14
|
+
// Remove when cleaning up `platform_editor_status_popup_suggestions_patch_1`.
|
|
15
|
+
var MAX_SUGGESTED_STATUSES_OLD = exports.MAX_SUGGESTED_STATUSES_OLD = 7;
|
|
14
16
|
var getStatusKey = function getStatusKey(_ref) {
|
|
15
17
|
var color = _ref.color,
|
|
16
18
|
text = _ref.text;
|
|
@@ -78,21 +78,68 @@ var suggestedStatusesContainerStyles = (0, _react2.css)({
|
|
|
78
78
|
margin: 0,
|
|
79
79
|
padding: "var(--ds-space-100, 8px)".concat(" ", "var(--ds-space-150, 12px)", " ", "var(--ds-space-050, 4px)")
|
|
80
80
|
});
|
|
81
|
+
|
|
82
|
+
// Fixed input plus capped scrolling color controls and suggestions.
|
|
83
|
+
var STATUS_PICKER_FIT_HEIGHT = 288;
|
|
84
|
+
// Seven suggestions fit below the color palette before the content starts scrolling.
|
|
85
|
+
var MAX_SUGGESTIONS_WITHOUT_SCROLLBAR = 7;
|
|
86
|
+
var STATUS_PICKER_CONTENT_WIDTH = 208;
|
|
87
|
+
var STATUS_PICKER_SCROLLBAR_WIDTH = 16;
|
|
88
|
+
var statusPickerWidthStyles = (0, _react2.css)({
|
|
89
|
+
width: "".concat(STATUS_PICKER_CONTENT_WIDTH, "px")
|
|
90
|
+
});
|
|
91
|
+
var statusPickerWithScrollbarWidthStyles = (0, _react2.css)({
|
|
92
|
+
// Reserve space for the native scrollbar without reducing the picker content width.
|
|
93
|
+
width: "".concat(STATUS_PICKER_CONTENT_WIDTH + STATUS_PICKER_SCROLLBAR_WIDTH, "px")
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
// When cleaning up `platform_editor_status_popup_suggestions_patch_1`, merge this into
|
|
97
|
+
// `suggestedStatusesContainerStyles` and remove its conditional style array.
|
|
98
|
+
var suggestedStatusesContainerPatchStyles = (0, _react2.css)({
|
|
99
|
+
gap: "var(--ds-space-050, 4px)",
|
|
100
|
+
paddingLeft: "var(--ds-space-100, 8px)"
|
|
101
|
+
});
|
|
81
102
|
var suggestedStatusButtonStyles = (0, _react2.css)({
|
|
82
103
|
background: 'transparent',
|
|
83
104
|
border: 0,
|
|
84
105
|
borderRadius: "var(--ds-radius-small, 3px)",
|
|
85
106
|
cursor: 'pointer',
|
|
86
|
-
display: 'flex',
|
|
87
107
|
justifyContent: 'flex-start',
|
|
88
108
|
padding: 0,
|
|
89
|
-
width: '100%',
|
|
90
109
|
'&:focus-visible': {
|
|
91
110
|
outline: "2px solid ".concat("var(--ds-border-focused, #0C66E4)"),
|
|
92
111
|
outlineOffset: "var(--ds-space-025, 2px)"
|
|
93
112
|
}
|
|
94
113
|
});
|
|
95
114
|
|
|
115
|
+
// Remove when cleaning up `platform_editor_status_popup_suggestions_patch_1`.
|
|
116
|
+
var suggestedStatusButtonOldStyles = (0, _react2.css)({
|
|
117
|
+
display: 'flex',
|
|
118
|
+
width: '100%'
|
|
119
|
+
});
|
|
120
|
+
var suggestedStatusButtonWrapperStyles = (0, _react2.css)({
|
|
121
|
+
alignSelf: 'flex-start',
|
|
122
|
+
borderWidth: "var(--ds-border-width, 1px)",
|
|
123
|
+
borderStyle: 'solid',
|
|
124
|
+
borderColor: 'transparent',
|
|
125
|
+
borderRadius: "var(--ds-space-075, 6px)",
|
|
126
|
+
display: 'flex',
|
|
127
|
+
marginLeft: "var(--ds-space-025, 2px)",
|
|
128
|
+
maxWidth: '100%',
|
|
129
|
+
paddingBlock: "var(--ds-border-width, 1px)",
|
|
130
|
+
paddingInline: "var(--ds-border-width, 1px)",
|
|
131
|
+
'&:hover': {
|
|
132
|
+
borderColor: "var(--ds-border, #091E4224)"
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
// When cleaning up `platform_editor_status_popup_suggestions_patch_1`, merge this into
|
|
137
|
+
// `suggestedStatusButtonStyles` and remove its conditional style array.
|
|
138
|
+
var suggestedStatusButtonPatchStyles = (0, _react2.css)({
|
|
139
|
+
// Allow this flex item to shrink so long statuses can truncate.
|
|
140
|
+
minWidth: 0
|
|
141
|
+
});
|
|
142
|
+
|
|
96
143
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
97
144
|
var StatusPickerWithIntl = /*#__PURE__*/function (_React$Component) {
|
|
98
145
|
function StatusPickerWithIntl(props) {
|
|
@@ -393,7 +440,8 @@ var StatusPickerWithIntl = /*#__PURE__*/function (_React$Component) {
|
|
|
393
440
|
}, {
|
|
394
441
|
key: "renderWithSetOutsideClickTargetRef",
|
|
395
442
|
value: function renderWithSetOutsideClickTargetRef(setOutsideClickTargetRef) {
|
|
396
|
-
var _this3 = this
|
|
443
|
+
var _this3 = this,
|
|
444
|
+
_suggestedStatuses$le;
|
|
397
445
|
var _this$props = this.props,
|
|
398
446
|
isNew = _this$props.isNew,
|
|
399
447
|
focusStatusInput = _this$props.focusStatusInput,
|
|
@@ -402,32 +450,17 @@ var StatusPickerWithIntl = /*#__PURE__*/function (_React$Component) {
|
|
|
402
450
|
var _this$state3 = this.state,
|
|
403
451
|
color = _this$state3.color,
|
|
404
452
|
text = _this$state3.text;
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
}, (0, _react2.jsx)("div", {
|
|
409
|
-
css: (0, _fg.fg)('platform-dst-lozenge-tag-badge-visual-uplifts') ? pickerContainerStylesTeam26 : pickerContainerStyles,
|
|
410
|
-
role: "none",
|
|
411
|
-
ref: this.setRef(setOutsideClickTargetRef),
|
|
412
|
-
onClick: this.handlePopupClick,
|
|
413
|
-
onKeyDown: this.onKeyDown
|
|
414
|
-
}, (0, _react2.jsx)(_picker.StatusPicker, {
|
|
415
|
-
autoFocus: isNew || focusStatusInput,
|
|
416
|
-
selectedColor: color,
|
|
417
|
-
text: text,
|
|
418
|
-
onColorClick: this.onColorClick,
|
|
419
|
-
onColorHover: this.onColorHover,
|
|
420
|
-
onTextChanged: this.onTextChanged,
|
|
421
|
-
onEnter: this.onEnter
|
|
422
|
-
}), suggestedStatuses !== null && suggestedStatuses !== void 0 && suggestedStatuses.length && (0, _expValEquals.expValEquals)('platform_editor_status_popup_suggestions', 'isEnabled', true) ? (0, _react2.jsx)("div", {
|
|
423
|
-
css: suggestedStatusesContainerStyles,
|
|
453
|
+
var suggestionsPatchEnabled = (0, _expValEquals.expValEquals)('platform_editor_status_popup_suggestions', 'isEnabled', true) && (0, _fg.fg)('platform_editor_status_popup_suggestions_patch_1');
|
|
454
|
+
var suggestedStatusList = suggestedStatuses !== null && suggestedStatuses !== void 0 && suggestedStatuses.length && (0, _expValEquals.expValEquals)('platform_editor_status_popup_suggestions', 'isEnabled', true) ? (0, _react2.jsx)("div", {
|
|
455
|
+
css: [suggestedStatusesContainerStyles, suggestionsPatchEnabled ? suggestedStatusesContainerPatchStyles : undefined],
|
|
424
456
|
"data-suggested-status-list": true
|
|
425
457
|
}, suggestedStatuses.map(function (suggestedStatus, index) {
|
|
426
458
|
return (0, _react2.jsx)("div", {
|
|
459
|
+
css: suggestionsPatchEnabled ? suggestedStatusButtonWrapperStyles : undefined,
|
|
427
460
|
key: "".concat(suggestedStatus.color, ":").concat(suggestedStatus.text)
|
|
428
461
|
}, (0, _react2.jsx)("button", {
|
|
429
462
|
type: "button",
|
|
430
|
-
css: suggestedStatusButtonStyles,
|
|
463
|
+
css: [suggestedStatusButtonStyles, suggestionsPatchEnabled ? suggestedStatusButtonPatchStyles : suggestedStatusButtonOldStyles],
|
|
431
464
|
onClick: function onClick() {
|
|
432
465
|
return _this3.onSuggestedStatusClick(suggestedStatus, index + 1);
|
|
433
466
|
},
|
|
@@ -436,9 +469,30 @@ var StatusPickerWithIntl = /*#__PURE__*/function (_React$Component) {
|
|
|
436
469
|
"data-suggested-status-button": true
|
|
437
470
|
}, (0, _react2.jsx)(_element.Status, {
|
|
438
471
|
color: suggestedStatus.color,
|
|
472
|
+
isConstrainedToParent: true,
|
|
439
473
|
text: suggestedStatus.displayText
|
|
440
474
|
})));
|
|
441
|
-
})) : null
|
|
475
|
+
})) : null;
|
|
476
|
+
var pickerContent = (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)(_picker.StatusPicker, {
|
|
477
|
+
autoFocus: isNew || focusStatusInput,
|
|
478
|
+
selectedColor: color,
|
|
479
|
+
text: text,
|
|
480
|
+
onColorClick: this.onColorClick,
|
|
481
|
+
onColorHover: this.onColorHover,
|
|
482
|
+
onTextChanged: this.onTextChanged,
|
|
483
|
+
onEnter: this.onEnter,
|
|
484
|
+
scrollableContent: suggestionsPatchEnabled ? suggestedStatusList : undefined
|
|
485
|
+
}), suggestionsPatchEnabled ? null : suggestedStatusList);
|
|
486
|
+
return (0, _react2.jsx)(_userIntent.UserIntentPopupWrapper, {
|
|
487
|
+
api: api,
|
|
488
|
+
userIntent: "statusPickerOpen"
|
|
489
|
+
}, (0, _react2.jsx)("div", {
|
|
490
|
+
css: [(0, _fg.fg)('platform-dst-lozenge-tag-badge-visual-uplifts') ? pickerContainerStylesTeam26 : pickerContainerStyles, suggestionsPatchEnabled ? statusPickerWidthStyles : undefined, suggestionsPatchEnabled && ((_suggestedStatuses$le = suggestedStatuses === null || suggestedStatuses === void 0 ? void 0 : suggestedStatuses.length) !== null && _suggestedStatuses$le !== void 0 ? _suggestedStatuses$le : 0) > MAX_SUGGESTIONS_WITHOUT_SCROLLBAR ? statusPickerWithScrollbarWidthStyles : undefined],
|
|
491
|
+
role: "none",
|
|
492
|
+
ref: this.setRef(setOutsideClickTargetRef),
|
|
493
|
+
onClick: this.handlePopupClick,
|
|
494
|
+
onKeyDown: this.onKeyDown
|
|
495
|
+
}, pickerContent));
|
|
442
496
|
}
|
|
443
497
|
}, {
|
|
444
498
|
key: "render",
|
|
@@ -462,7 +516,7 @@ var StatusPickerWithIntl = /*#__PURE__*/function (_React$Component) {
|
|
|
462
516
|
handleClickOutside: this.handleClickOutside,
|
|
463
517
|
handleEscapeKeydown: this.handleEscapeKeydown,
|
|
464
518
|
zIndex: _editorSharedStyles.akEditorFloatingDialogZIndex,
|
|
465
|
-
fitHeight: 40,
|
|
519
|
+
fitHeight: (0, _expValEquals.expValEquals)('platform_editor_status_popup_suggestions', 'isEnabled', true) && (0, _fg.fg)('platform_editor_status_popup_suggestions_patch_1') ? STATUS_PICKER_FIT_HEIGHT : 40,
|
|
466
520
|
mountTo: mountTo,
|
|
467
521
|
boundariesElement: boundariesElement,
|
|
468
522
|
scrollableElement: scrollableElement,
|
|
@@ -4,7 +4,7 @@ import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
|
4
4
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
5
5
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
6
6
|
import { commitStatusPicker, updateStatus } from '../pm-plugins/actions';
|
|
7
|
-
import { getSuggestedStatuses } from './getSuggestedStatuses';
|
|
7
|
+
import { getSuggestedStatuses, MAX_SUGGESTED_STATUSES, MAX_SUGGESTED_STATUSES_OLD } from './getSuggestedStatuses';
|
|
8
8
|
import StatusPicker from './statusPicker';
|
|
9
9
|
/** Renders the status picker popup for the currently selected status node. */
|
|
10
10
|
export function ContentComponent({
|
|
@@ -83,6 +83,7 @@ export function ContentComponent({
|
|
|
83
83
|
text
|
|
84
84
|
},
|
|
85
85
|
doc: editorView.state.doc,
|
|
86
|
+
limit: fg('platform_editor_status_popup_suggestions_patch_1') ? MAX_SUGGESTED_STATUSES : MAX_SUGGESTED_STATUSES_OLD,
|
|
86
87
|
shouldUppercaseText: fg('platform-dst-lozenge-tag-badge-visual-uplifts')
|
|
87
88
|
});
|
|
88
89
|
}, [showStatusPickerAt, editorView.state.doc]);
|
|
@@ -68,21 +68,68 @@ const suggestedStatusesContainerStyles = css({
|
|
|
68
68
|
margin: 0,
|
|
69
69
|
padding: `${"var(--ds-space-100, 8px)"} ${"var(--ds-space-150, 12px)"} ${"var(--ds-space-050, 4px)"}`
|
|
70
70
|
});
|
|
71
|
+
|
|
72
|
+
// Fixed input plus capped scrolling color controls and suggestions.
|
|
73
|
+
const STATUS_PICKER_FIT_HEIGHT = 288;
|
|
74
|
+
// Seven suggestions fit below the color palette before the content starts scrolling.
|
|
75
|
+
const MAX_SUGGESTIONS_WITHOUT_SCROLLBAR = 7;
|
|
76
|
+
const STATUS_PICKER_CONTENT_WIDTH = 208;
|
|
77
|
+
const STATUS_PICKER_SCROLLBAR_WIDTH = 16;
|
|
78
|
+
const statusPickerWidthStyles = css({
|
|
79
|
+
width: `${STATUS_PICKER_CONTENT_WIDTH}px`
|
|
80
|
+
});
|
|
81
|
+
const statusPickerWithScrollbarWidthStyles = css({
|
|
82
|
+
// Reserve space for the native scrollbar without reducing the picker content width.
|
|
83
|
+
width: `${STATUS_PICKER_CONTENT_WIDTH + STATUS_PICKER_SCROLLBAR_WIDTH}px`
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
// When cleaning up `platform_editor_status_popup_suggestions_patch_1`, merge this into
|
|
87
|
+
// `suggestedStatusesContainerStyles` and remove its conditional style array.
|
|
88
|
+
const suggestedStatusesContainerPatchStyles = css({
|
|
89
|
+
gap: "var(--ds-space-050, 4px)",
|
|
90
|
+
paddingLeft: "var(--ds-space-100, 8px)"
|
|
91
|
+
});
|
|
71
92
|
const suggestedStatusButtonStyles = css({
|
|
72
93
|
background: 'transparent',
|
|
73
94
|
border: 0,
|
|
74
95
|
borderRadius: "var(--ds-radius-small, 3px)",
|
|
75
96
|
cursor: 'pointer',
|
|
76
|
-
display: 'flex',
|
|
77
97
|
justifyContent: 'flex-start',
|
|
78
98
|
padding: 0,
|
|
79
|
-
width: '100%',
|
|
80
99
|
'&:focus-visible': {
|
|
81
100
|
outline: `2px solid ${"var(--ds-border-focused, #0C66E4)"}`,
|
|
82
101
|
outlineOffset: "var(--ds-space-025, 2px)"
|
|
83
102
|
}
|
|
84
103
|
});
|
|
85
104
|
|
|
105
|
+
// Remove when cleaning up `platform_editor_status_popup_suggestions_patch_1`.
|
|
106
|
+
const suggestedStatusButtonOldStyles = css({
|
|
107
|
+
display: 'flex',
|
|
108
|
+
width: '100%'
|
|
109
|
+
});
|
|
110
|
+
const suggestedStatusButtonWrapperStyles = css({
|
|
111
|
+
alignSelf: 'flex-start',
|
|
112
|
+
borderWidth: "var(--ds-border-width, 1px)",
|
|
113
|
+
borderStyle: 'solid',
|
|
114
|
+
borderColor: 'transparent',
|
|
115
|
+
borderRadius: "var(--ds-space-075, 6px)",
|
|
116
|
+
display: 'flex',
|
|
117
|
+
marginLeft: "var(--ds-space-025, 2px)",
|
|
118
|
+
maxWidth: '100%',
|
|
119
|
+
paddingBlock: "var(--ds-border-width, 1px)",
|
|
120
|
+
paddingInline: "var(--ds-border-width, 1px)",
|
|
121
|
+
'&:hover': {
|
|
122
|
+
borderColor: "var(--ds-border, #091E4224)"
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
// When cleaning up `platform_editor_status_popup_suggestions_patch_1`, merge this into
|
|
127
|
+
// `suggestedStatusButtonStyles` and remove its conditional style array.
|
|
128
|
+
const suggestedStatusButtonPatchStyles = css({
|
|
129
|
+
// Allow this flex item to shrink so long statuses can truncate.
|
|
130
|
+
minWidth: 0
|
|
131
|
+
});
|
|
132
|
+
|
|
86
133
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
87
134
|
class StatusPickerWithIntl extends React.Component {
|
|
88
135
|
constructor(props) {
|
|
@@ -366,6 +413,7 @@ class StatusPickerWithIntl extends React.Component {
|
|
|
366
413
|
};
|
|
367
414
|
}
|
|
368
415
|
renderWithSetOutsideClickTargetRef(setOutsideClickTargetRef) {
|
|
416
|
+
var _suggestedStatuses$le;
|
|
369
417
|
const {
|
|
370
418
|
isNew,
|
|
371
419
|
focusStatusInput,
|
|
@@ -376,39 +424,45 @@ class StatusPickerWithIntl extends React.Component {
|
|
|
376
424
|
color,
|
|
377
425
|
text
|
|
378
426
|
} = this.state;
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
}, jsx("div", {
|
|
383
|
-
css: fg('platform-dst-lozenge-tag-badge-visual-uplifts') ? pickerContainerStylesTeam26 : pickerContainerStyles,
|
|
384
|
-
role: "none",
|
|
385
|
-
ref: this.setRef(setOutsideClickTargetRef),
|
|
386
|
-
onClick: this.handlePopupClick,
|
|
387
|
-
onKeyDown: this.onKeyDown
|
|
388
|
-
}, jsx(AkStatusPicker, {
|
|
389
|
-
autoFocus: isNew || focusStatusInput,
|
|
390
|
-
selectedColor: color,
|
|
391
|
-
text: text,
|
|
392
|
-
onColorClick: this.onColorClick,
|
|
393
|
-
onColorHover: this.onColorHover,
|
|
394
|
-
onTextChanged: this.onTextChanged,
|
|
395
|
-
onEnter: this.onEnter
|
|
396
|
-
}), suggestedStatuses !== null && suggestedStatuses !== void 0 && suggestedStatuses.length && expValEquals('platform_editor_status_popup_suggestions', 'isEnabled', true) ? jsx("div", {
|
|
397
|
-
css: suggestedStatusesContainerStyles,
|
|
427
|
+
const suggestionsPatchEnabled = expValEquals('platform_editor_status_popup_suggestions', 'isEnabled', true) && fg('platform_editor_status_popup_suggestions_patch_1');
|
|
428
|
+
const suggestedStatusList = suggestedStatuses !== null && suggestedStatuses !== void 0 && suggestedStatuses.length && expValEquals('platform_editor_status_popup_suggestions', 'isEnabled', true) ? jsx("div", {
|
|
429
|
+
css: [suggestedStatusesContainerStyles, suggestionsPatchEnabled ? suggestedStatusesContainerPatchStyles : undefined],
|
|
398
430
|
"data-suggested-status-list": true
|
|
399
431
|
}, suggestedStatuses.map((suggestedStatus, index) => jsx("div", {
|
|
432
|
+
css: suggestionsPatchEnabled ? suggestedStatusButtonWrapperStyles : undefined,
|
|
400
433
|
key: `${suggestedStatus.color}:${suggestedStatus.text}`
|
|
401
434
|
}, jsx("button", {
|
|
402
435
|
type: "button",
|
|
403
|
-
css: suggestedStatusButtonStyles,
|
|
436
|
+
css: [suggestedStatusButtonStyles, suggestionsPatchEnabled ? suggestedStatusButtonPatchStyles : suggestedStatusButtonOldStyles],
|
|
404
437
|
onClick: () => this.onSuggestedStatusClick(suggestedStatus, index + 1),
|
|
405
438
|
onKeyDown: this.handleSuggestedStatusKeyDown,
|
|
406
439
|
"aria-label": suggestedStatus.displayText,
|
|
407
440
|
"data-suggested-status-button": true
|
|
408
441
|
}, jsx(Status, {
|
|
409
442
|
color: suggestedStatus.color,
|
|
443
|
+
isConstrainedToParent: true,
|
|
410
444
|
text: suggestedStatus.displayText
|
|
411
|
-
}))))) : null
|
|
445
|
+
}))))) : null;
|
|
446
|
+
const pickerContent = jsx(React.Fragment, null, jsx(AkStatusPicker, {
|
|
447
|
+
autoFocus: isNew || focusStatusInput,
|
|
448
|
+
selectedColor: color,
|
|
449
|
+
text: text,
|
|
450
|
+
onColorClick: this.onColorClick,
|
|
451
|
+
onColorHover: this.onColorHover,
|
|
452
|
+
onTextChanged: this.onTextChanged,
|
|
453
|
+
onEnter: this.onEnter,
|
|
454
|
+
scrollableContent: suggestionsPatchEnabled ? suggestedStatusList : undefined
|
|
455
|
+
}), suggestionsPatchEnabled ? null : suggestedStatusList);
|
|
456
|
+
return jsx(UserIntentPopupWrapper, {
|
|
457
|
+
api: api,
|
|
458
|
+
userIntent: "statusPickerOpen"
|
|
459
|
+
}, jsx("div", {
|
|
460
|
+
css: [fg('platform-dst-lozenge-tag-badge-visual-uplifts') ? pickerContainerStylesTeam26 : pickerContainerStyles, suggestionsPatchEnabled ? statusPickerWidthStyles : undefined, suggestionsPatchEnabled && ((_suggestedStatuses$le = suggestedStatuses === null || suggestedStatuses === void 0 ? void 0 : suggestedStatuses.length) !== null && _suggestedStatuses$le !== void 0 ? _suggestedStatuses$le : 0) > MAX_SUGGESTIONS_WITHOUT_SCROLLBAR ? statusPickerWithScrollbarWidthStyles : undefined],
|
|
461
|
+
role: "none",
|
|
462
|
+
ref: this.setRef(setOutsideClickTargetRef),
|
|
463
|
+
onClick: this.handlePopupClick,
|
|
464
|
+
onKeyDown: this.onKeyDown
|
|
465
|
+
}, pickerContent));
|
|
412
466
|
}
|
|
413
467
|
render() {
|
|
414
468
|
const {
|
|
@@ -431,7 +485,7 @@ class StatusPickerWithIntl extends React.Component {
|
|
|
431
485
|
handleClickOutside: this.handleClickOutside,
|
|
432
486
|
handleEscapeKeydown: this.handleEscapeKeydown,
|
|
433
487
|
zIndex: akEditorFloatingDialogZIndex,
|
|
434
|
-
fitHeight: 40,
|
|
488
|
+
fitHeight: expValEquals('platform_editor_status_popup_suggestions', 'isEnabled', true) && fg('platform_editor_status_popup_suggestions_patch_1') ? STATUS_PICKER_FIT_HEIGHT : 40,
|
|
435
489
|
mountTo: mountTo,
|
|
436
490
|
boundariesElement: boundariesElement,
|
|
437
491
|
scrollableElement: scrollableElement,
|
|
@@ -7,7 +7,7 @@ import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
|
7
7
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
8
8
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
9
9
|
import { commitStatusPicker, updateStatus } from '../pm-plugins/actions';
|
|
10
|
-
import { getSuggestedStatuses } from './getSuggestedStatuses';
|
|
10
|
+
import { getSuggestedStatuses, MAX_SUGGESTED_STATUSES, MAX_SUGGESTED_STATUSES_OLD } from './getSuggestedStatuses';
|
|
11
11
|
import StatusPicker from './statusPicker';
|
|
12
12
|
/** Renders the status picker popup for the currently selected status node. */
|
|
13
13
|
export function ContentComponent(_ref) {
|
|
@@ -86,6 +86,7 @@ export function ContentComponent(_ref) {
|
|
|
86
86
|
text: text
|
|
87
87
|
},
|
|
88
88
|
doc: editorView.state.doc,
|
|
89
|
+
limit: fg('platform_editor_status_popup_suggestions_patch_1') ? MAX_SUGGESTED_STATUSES : MAX_SUGGESTED_STATUSES_OLD,
|
|
89
90
|
shouldUppercaseText: fg('platform-dst-lozenge-tag-badge-visual-uplifts')
|
|
90
91
|
});
|
|
91
92
|
}, [showStatusPickerAt, editorView.state.doc]);
|
|
@@ -3,7 +3,9 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
3
3
|
var _excluded = ["distance"];
|
|
4
4
|
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; }
|
|
5
5
|
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) { _defineProperty(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; }
|
|
6
|
-
export var MAX_SUGGESTED_STATUSES =
|
|
6
|
+
export var MAX_SUGGESTED_STATUSES = 20;
|
|
7
|
+
// Remove when cleaning up `platform_editor_status_popup_suggestions_patch_1`.
|
|
8
|
+
export var MAX_SUGGESTED_STATUSES_OLD = 7;
|
|
7
9
|
var getStatusKey = function getStatusKey(_ref) {
|
|
8
10
|
var color = _ref.color,
|
|
9
11
|
text = _ref.text;
|
|
@@ -75,21 +75,68 @@ var suggestedStatusesContainerStyles = css({
|
|
|
75
75
|
margin: 0,
|
|
76
76
|
padding: "var(--ds-space-100, 8px)".concat(" ", "var(--ds-space-150, 12px)", " ", "var(--ds-space-050, 4px)")
|
|
77
77
|
});
|
|
78
|
+
|
|
79
|
+
// Fixed input plus capped scrolling color controls and suggestions.
|
|
80
|
+
var STATUS_PICKER_FIT_HEIGHT = 288;
|
|
81
|
+
// Seven suggestions fit below the color palette before the content starts scrolling.
|
|
82
|
+
var MAX_SUGGESTIONS_WITHOUT_SCROLLBAR = 7;
|
|
83
|
+
var STATUS_PICKER_CONTENT_WIDTH = 208;
|
|
84
|
+
var STATUS_PICKER_SCROLLBAR_WIDTH = 16;
|
|
85
|
+
var statusPickerWidthStyles = css({
|
|
86
|
+
width: "".concat(STATUS_PICKER_CONTENT_WIDTH, "px")
|
|
87
|
+
});
|
|
88
|
+
var statusPickerWithScrollbarWidthStyles = css({
|
|
89
|
+
// Reserve space for the native scrollbar without reducing the picker content width.
|
|
90
|
+
width: "".concat(STATUS_PICKER_CONTENT_WIDTH + STATUS_PICKER_SCROLLBAR_WIDTH, "px")
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
// When cleaning up `platform_editor_status_popup_suggestions_patch_1`, merge this into
|
|
94
|
+
// `suggestedStatusesContainerStyles` and remove its conditional style array.
|
|
95
|
+
var suggestedStatusesContainerPatchStyles = css({
|
|
96
|
+
gap: "var(--ds-space-050, 4px)",
|
|
97
|
+
paddingLeft: "var(--ds-space-100, 8px)"
|
|
98
|
+
});
|
|
78
99
|
var suggestedStatusButtonStyles = css({
|
|
79
100
|
background: 'transparent',
|
|
80
101
|
border: 0,
|
|
81
102
|
borderRadius: "var(--ds-radius-small, 3px)",
|
|
82
103
|
cursor: 'pointer',
|
|
83
|
-
display: 'flex',
|
|
84
104
|
justifyContent: 'flex-start',
|
|
85
105
|
padding: 0,
|
|
86
|
-
width: '100%',
|
|
87
106
|
'&:focus-visible': {
|
|
88
107
|
outline: "2px solid ".concat("var(--ds-border-focused, #0C66E4)"),
|
|
89
108
|
outlineOffset: "var(--ds-space-025, 2px)"
|
|
90
109
|
}
|
|
91
110
|
});
|
|
92
111
|
|
|
112
|
+
// Remove when cleaning up `platform_editor_status_popup_suggestions_patch_1`.
|
|
113
|
+
var suggestedStatusButtonOldStyles = css({
|
|
114
|
+
display: 'flex',
|
|
115
|
+
width: '100%'
|
|
116
|
+
});
|
|
117
|
+
var suggestedStatusButtonWrapperStyles = css({
|
|
118
|
+
alignSelf: 'flex-start',
|
|
119
|
+
borderWidth: "var(--ds-border-width, 1px)",
|
|
120
|
+
borderStyle: 'solid',
|
|
121
|
+
borderColor: 'transparent',
|
|
122
|
+
borderRadius: "var(--ds-space-075, 6px)",
|
|
123
|
+
display: 'flex',
|
|
124
|
+
marginLeft: "var(--ds-space-025, 2px)",
|
|
125
|
+
maxWidth: '100%',
|
|
126
|
+
paddingBlock: "var(--ds-border-width, 1px)",
|
|
127
|
+
paddingInline: "var(--ds-border-width, 1px)",
|
|
128
|
+
'&:hover': {
|
|
129
|
+
borderColor: "var(--ds-border, #091E4224)"
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
// When cleaning up `platform_editor_status_popup_suggestions_patch_1`, merge this into
|
|
134
|
+
// `suggestedStatusButtonStyles` and remove its conditional style array.
|
|
135
|
+
var suggestedStatusButtonPatchStyles = css({
|
|
136
|
+
// Allow this flex item to shrink so long statuses can truncate.
|
|
137
|
+
minWidth: 0
|
|
138
|
+
});
|
|
139
|
+
|
|
93
140
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
94
141
|
var StatusPickerWithIntl = /*#__PURE__*/function (_React$Component) {
|
|
95
142
|
function StatusPickerWithIntl(props) {
|
|
@@ -390,7 +437,8 @@ var StatusPickerWithIntl = /*#__PURE__*/function (_React$Component) {
|
|
|
390
437
|
}, {
|
|
391
438
|
key: "renderWithSetOutsideClickTargetRef",
|
|
392
439
|
value: function renderWithSetOutsideClickTargetRef(setOutsideClickTargetRef) {
|
|
393
|
-
var _this3 = this
|
|
440
|
+
var _this3 = this,
|
|
441
|
+
_suggestedStatuses$le;
|
|
394
442
|
var _this$props = this.props,
|
|
395
443
|
isNew = _this$props.isNew,
|
|
396
444
|
focusStatusInput = _this$props.focusStatusInput,
|
|
@@ -399,32 +447,17 @@ var StatusPickerWithIntl = /*#__PURE__*/function (_React$Component) {
|
|
|
399
447
|
var _this$state3 = this.state,
|
|
400
448
|
color = _this$state3.color,
|
|
401
449
|
text = _this$state3.text;
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
}, jsx("div", {
|
|
406
|
-
css: fg('platform-dst-lozenge-tag-badge-visual-uplifts') ? pickerContainerStylesTeam26 : pickerContainerStyles,
|
|
407
|
-
role: "none",
|
|
408
|
-
ref: this.setRef(setOutsideClickTargetRef),
|
|
409
|
-
onClick: this.handlePopupClick,
|
|
410
|
-
onKeyDown: this.onKeyDown
|
|
411
|
-
}, jsx(AkStatusPicker, {
|
|
412
|
-
autoFocus: isNew || focusStatusInput,
|
|
413
|
-
selectedColor: color,
|
|
414
|
-
text: text,
|
|
415
|
-
onColorClick: this.onColorClick,
|
|
416
|
-
onColorHover: this.onColorHover,
|
|
417
|
-
onTextChanged: this.onTextChanged,
|
|
418
|
-
onEnter: this.onEnter
|
|
419
|
-
}), suggestedStatuses !== null && suggestedStatuses !== void 0 && suggestedStatuses.length && expValEquals('platform_editor_status_popup_suggestions', 'isEnabled', true) ? jsx("div", {
|
|
420
|
-
css: suggestedStatusesContainerStyles,
|
|
450
|
+
var suggestionsPatchEnabled = expValEquals('platform_editor_status_popup_suggestions', 'isEnabled', true) && fg('platform_editor_status_popup_suggestions_patch_1');
|
|
451
|
+
var suggestedStatusList = suggestedStatuses !== null && suggestedStatuses !== void 0 && suggestedStatuses.length && expValEquals('platform_editor_status_popup_suggestions', 'isEnabled', true) ? jsx("div", {
|
|
452
|
+
css: [suggestedStatusesContainerStyles, suggestionsPatchEnabled ? suggestedStatusesContainerPatchStyles : undefined],
|
|
421
453
|
"data-suggested-status-list": true
|
|
422
454
|
}, suggestedStatuses.map(function (suggestedStatus, index) {
|
|
423
455
|
return jsx("div", {
|
|
456
|
+
css: suggestionsPatchEnabled ? suggestedStatusButtonWrapperStyles : undefined,
|
|
424
457
|
key: "".concat(suggestedStatus.color, ":").concat(suggestedStatus.text)
|
|
425
458
|
}, jsx("button", {
|
|
426
459
|
type: "button",
|
|
427
|
-
css: suggestedStatusButtonStyles,
|
|
460
|
+
css: [suggestedStatusButtonStyles, suggestionsPatchEnabled ? suggestedStatusButtonPatchStyles : suggestedStatusButtonOldStyles],
|
|
428
461
|
onClick: function onClick() {
|
|
429
462
|
return _this3.onSuggestedStatusClick(suggestedStatus, index + 1);
|
|
430
463
|
},
|
|
@@ -433,9 +466,30 @@ var StatusPickerWithIntl = /*#__PURE__*/function (_React$Component) {
|
|
|
433
466
|
"data-suggested-status-button": true
|
|
434
467
|
}, jsx(Status, {
|
|
435
468
|
color: suggestedStatus.color,
|
|
469
|
+
isConstrainedToParent: true,
|
|
436
470
|
text: suggestedStatus.displayText
|
|
437
471
|
})));
|
|
438
|
-
})) : null
|
|
472
|
+
})) : null;
|
|
473
|
+
var pickerContent = jsx(React.Fragment, null, jsx(AkStatusPicker, {
|
|
474
|
+
autoFocus: isNew || focusStatusInput,
|
|
475
|
+
selectedColor: color,
|
|
476
|
+
text: text,
|
|
477
|
+
onColorClick: this.onColorClick,
|
|
478
|
+
onColorHover: this.onColorHover,
|
|
479
|
+
onTextChanged: this.onTextChanged,
|
|
480
|
+
onEnter: this.onEnter,
|
|
481
|
+
scrollableContent: suggestionsPatchEnabled ? suggestedStatusList : undefined
|
|
482
|
+
}), suggestionsPatchEnabled ? null : suggestedStatusList);
|
|
483
|
+
return jsx(UserIntentPopupWrapper, {
|
|
484
|
+
api: api,
|
|
485
|
+
userIntent: "statusPickerOpen"
|
|
486
|
+
}, jsx("div", {
|
|
487
|
+
css: [fg('platform-dst-lozenge-tag-badge-visual-uplifts') ? pickerContainerStylesTeam26 : pickerContainerStyles, suggestionsPatchEnabled ? statusPickerWidthStyles : undefined, suggestionsPatchEnabled && ((_suggestedStatuses$le = suggestedStatuses === null || suggestedStatuses === void 0 ? void 0 : suggestedStatuses.length) !== null && _suggestedStatuses$le !== void 0 ? _suggestedStatuses$le : 0) > MAX_SUGGESTIONS_WITHOUT_SCROLLBAR ? statusPickerWithScrollbarWidthStyles : undefined],
|
|
488
|
+
role: "none",
|
|
489
|
+
ref: this.setRef(setOutsideClickTargetRef),
|
|
490
|
+
onClick: this.handlePopupClick,
|
|
491
|
+
onKeyDown: this.onKeyDown
|
|
492
|
+
}, pickerContent));
|
|
439
493
|
}
|
|
440
494
|
}, {
|
|
441
495
|
key: "render",
|
|
@@ -459,7 +513,7 @@ var StatusPickerWithIntl = /*#__PURE__*/function (_React$Component) {
|
|
|
459
513
|
handleClickOutside: this.handleClickOutside,
|
|
460
514
|
handleEscapeKeydown: this.handleEscapeKeydown,
|
|
461
515
|
zIndex: akEditorFloatingDialogZIndex,
|
|
462
|
-
fitHeight: 40,
|
|
516
|
+
fitHeight: expValEquals('platform_editor_status_popup_suggestions', 'isEnabled', true) && fg('platform_editor_status_popup_suggestions_patch_1') ? STATUS_PICKER_FIT_HEIGHT : 40,
|
|
463
517
|
mountTo: mountTo,
|
|
464
518
|
boundariesElement: boundariesElement,
|
|
465
519
|
scrollableElement: scrollableElement,
|
|
@@ -10,6 +10,7 @@ type GetSuggestedStatusesArgs = {
|
|
|
10
10
|
limit?: number;
|
|
11
11
|
shouldUppercaseText?: boolean;
|
|
12
12
|
};
|
|
13
|
-
export declare const MAX_SUGGESTED_STATUSES =
|
|
13
|
+
export declare const MAX_SUGGESTED_STATUSES = 20;
|
|
14
|
+
export declare const MAX_SUGGESTED_STATUSES_OLD = 7;
|
|
14
15
|
export declare const getSuggestedStatuses: ({ currentPos, currentStatus, doc, limit, shouldUppercaseText, }: GetSuggestedStatusesArgs) => SuggestedStatus[];
|
|
15
16
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-status",
|
|
3
|
-
"version": "17.2.
|
|
3
|
+
"version": "17.2.3",
|
|
4
4
|
"description": "Status plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"@atlaskit/platform-feature-experiments": "^0.3.0",
|
|
35
35
|
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
36
36
|
"@atlaskit/status": "^5.9.0",
|
|
37
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
38
|
-
"@atlaskit/tokens": "^16.
|
|
37
|
+
"@atlaskit/tmp-editor-statsig": "^171.0.0",
|
|
38
|
+
"@atlaskit/tokens": "^16.11.0",
|
|
39
39
|
"@atlaskit/visually-hidden": "^4.4.0",
|
|
40
40
|
"@babel/runtime": "^7.0.0",
|
|
41
41
|
"@emotion/react": "^11.7.1"
|
|
@@ -98,6 +98,9 @@
|
|
|
98
98
|
},
|
|
99
99
|
"platform-dst-lozenge-tag-badge-visual-uplifts": {
|
|
100
100
|
"type": "boolean"
|
|
101
|
+
},
|
|
102
|
+
"platform_editor_status_popup_suggestions_patch_1": {
|
|
103
|
+
"type": "boolean"
|
|
101
104
|
}
|
|
102
105
|
}
|
|
103
106
|
}
|