@atlaskit/editor-plugin-floating-toolbar 1.1.0 → 1.2.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/.eslintrc.js +18 -0
- package/CHANGELOG.md +16 -0
- package/dist/cjs/ui/DropdownMenu.js +28 -17
- package/dist/cjs/ui/Select.js +2 -0
- package/dist/cjs/ui/Toolbar.js +68 -7
- package/dist/es2019/ui/DropdownMenu.js +24 -29
- package/dist/es2019/ui/Input.js +1 -2
- package/dist/es2019/ui/Select.js +2 -0
- package/dist/es2019/ui/Toolbar.js +67 -11
- package/dist/esm/ui/DropdownMenu.js +27 -15
- package/dist/esm/ui/Input.js +1 -2
- package/dist/esm/ui/Select.js +2 -0
- package/dist/esm/ui/Toolbar.js +69 -11
- package/dist/types/ui/ExtensionsPlaceholder.d.ts +1 -2
- package/dist/types/ui/Input.d.ts +1 -2
- package/dist/types/ui/Toolbar.d.ts +2 -0
- package/dist/types-ts4.5/ui/ExtensionsPlaceholder.d.ts +1 -2
- package/dist/types-ts4.5/ui/Input.d.ts +1 -2
- package/dist/types-ts4.5/ui/Toolbar.d.ts +2 -0
- package/package.json +11 -6
- package/dist/cjs/ui/styles.js +0 -77
- package/dist/es2019/ui/styles.js +0 -64
- package/dist/esm/ui/styles.js +0 -68
- package/dist/types/ui/styles.d.ts +0 -20
- package/dist/types-ts4.5/ui/styles.d.ts +0 -20
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
rules: {
|
|
3
|
+
'@typescript-eslint/no-duplicate-imports': 'error',
|
|
4
|
+
'@typescript-eslint/no-explicit-any': 'warn',
|
|
5
|
+
'@atlaskit/design-system/ensure-design-token-usage/preview': [
|
|
6
|
+
'error',
|
|
7
|
+
{ domains: ['spacing'], shouldEnforceFallbacks: false },
|
|
8
|
+
],
|
|
9
|
+
},
|
|
10
|
+
overrides: [
|
|
11
|
+
{
|
|
12
|
+
files: ['**/__tests__/**/*.{js,ts,tsx}', '**/examples/**/*.{js,ts,tsx}'],
|
|
13
|
+
rules: {
|
|
14
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
};
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-floating-toolbar
|
|
2
2
|
|
|
3
|
+
## 1.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#70153](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/70153) [`3a34e7545f18`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3a34e7545f18) - ECA11Y-36: Flaoting toolbar group buttons into radiogroup buttons structure
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
13
|
+
## 1.1.1
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [#73177](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/73177) [`22452599ed8f`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/22452599ed8f) - Move styling for certain packages to tokens.
|
|
18
|
+
|
|
3
19
|
## 1.1.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
|
@@ -11,7 +11,6 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
|
|
|
11
11
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
12
12
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
13
13
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
14
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
15
14
|
var _react = require("react");
|
|
16
15
|
var _react2 = require("@emotion/react");
|
|
17
16
|
var _reactIntlNext = require("react-intl-next");
|
|
@@ -21,25 +20,37 @@ var _menu = require("@atlaskit/menu");
|
|
|
21
20
|
var _colors = require("@atlaskit/theme/colors");
|
|
22
21
|
var _constants = require("@atlaskit/theme/constants");
|
|
23
22
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
24
|
-
var _templateObject, _templateObject2, _templateObject3;
|
|
25
|
-
/** @jsx jsx */
|
|
26
|
-
// eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
|
|
27
|
-
// eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
|
|
28
23
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
29
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
24
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /** @jsx jsx */ // eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
|
|
25
|
+
// eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
|
|
30
26
|
var menuItemDimensions = exports.menuItemDimensions = {
|
|
31
27
|
width: 175,
|
|
32
28
|
height: 32
|
|
33
29
|
};
|
|
30
|
+
var spacerStyles = (0, _react2.css)({
|
|
31
|
+
display: 'flex',
|
|
32
|
+
flex: 1,
|
|
33
|
+
padding: "var(--ds-space-100, 8px)"
|
|
34
|
+
});
|
|
34
35
|
|
|
35
|
-
// eslint-disable-next-line @atlaskit/design-system/
|
|
36
|
-
var
|
|
37
|
-
|
|
38
|
-
//
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
var
|
|
36
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
37
|
+
var menuContainerStyles = (0, _react2.css)({
|
|
38
|
+
minWidth: "".concat(menuItemDimensions.width, "px"),
|
|
39
|
+
// temporary solution to retain spacing defined by @atlaskit/Item
|
|
40
|
+
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
41
|
+
'& button': {
|
|
42
|
+
minHeight: "var(--ds-space-400, 32px)",
|
|
43
|
+
padding: "var(--ds-space-100, 8px)".concat(" ", "var(--ds-space-100, 8px)", " 7px"),
|
|
44
|
+
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
45
|
+
'& > [data-item-elem-before]': {
|
|
46
|
+
marginRight: "var(--ds-space-050, 4px)"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
var labelStyles = (0, _react2.css)({
|
|
51
|
+
display: 'inline-block',
|
|
52
|
+
width: '100%'
|
|
53
|
+
});
|
|
43
54
|
|
|
44
55
|
// TODO: Migrate away from gridSize
|
|
45
56
|
// Recommendation: Replace with 4 as itemSpacing is used in calculations expecting a number
|
|
@@ -150,7 +161,7 @@ var DropdownMenuItem = function DropdownMenuItem(_ref) {
|
|
|
150
161
|
onBlur: handleItemOnBlur
|
|
151
162
|
}, (0, _react2.jsx)("span", {
|
|
152
163
|
ref: labelRef,
|
|
153
|
-
css:
|
|
164
|
+
css: labelStyles
|
|
154
165
|
}, item.title));
|
|
155
166
|
if (tooltipContent) {
|
|
156
167
|
return (0, _react2.jsx)(_tooltip.default, {
|
|
@@ -179,7 +190,7 @@ var Dropdown = /*#__PURE__*/function (_Component) {
|
|
|
179
190
|
intl = _this$props.intl,
|
|
180
191
|
editorView = _this$props.editorView;
|
|
181
192
|
return (0, _react2.jsx)("div", {
|
|
182
|
-
css:
|
|
193
|
+
css: menuContainerStyles
|
|
183
194
|
}, items.filter(function (item) {
|
|
184
195
|
return !item.hidden;
|
|
185
196
|
}).map(function (item, idx) {
|
|
@@ -207,7 +218,7 @@ var Dropdown = /*#__PURE__*/function (_Component) {
|
|
|
207
218
|
});
|
|
208
219
|
}
|
|
209
220
|
return (0, _react2.jsx)("span", {
|
|
210
|
-
css:
|
|
221
|
+
css: spacerStyles
|
|
211
222
|
});
|
|
212
223
|
}
|
|
213
224
|
}]);
|
package/dist/cjs/ui/Select.js
CHANGED
|
@@ -34,7 +34,9 @@ function Search(props) {
|
|
|
34
34
|
var controlWrapper = (selectRef === null || selectRef === void 0 || (_selectRef$current = selectRef.current) === null || _selectRef$current === void 0 || (_selectRef$current = _selectRef$current.select) === null || _selectRef$current === void 0 || (_selectRef$current = _selectRef$current.controlRef) === null || _selectRef$current === void 0 ? void 0 : _selectRef$current.parentNode) || (selectRef === null || selectRef === void 0 || (_selectRef$current2 = selectRef.current) === null || _selectRef$current2 === void 0 || (_selectRef$current2 = _selectRef$current2.select) === null || _selectRef$current2 === void 0 || (_selectRef$current2 = _selectRef$current2.select) === null || _selectRef$current2 === void 0 || (_selectRef$current2 = _selectRef$current2.controlRef) === null || _selectRef$current2 === void 0 ? void 0 : _selectRef$current2.parentNode);
|
|
35
35
|
var menuPortalStyles = controlWrapper && props.setDisableParentScroll ? {
|
|
36
36
|
// since the portal is now outside, we need to position it as before
|
|
37
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
37
38
|
top: controlWrapper.offsetTop,
|
|
39
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
38
40
|
left: controlWrapper.offsetLeft,
|
|
39
41
|
height: controlWrapper.offsetHeight,
|
|
40
42
|
width: width
|
package/dist/cjs/ui/Toolbar.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
|
+
exports.groupItems = groupItems;
|
|
9
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
11
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
12
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
@@ -25,6 +26,7 @@ var _uiColor = require("@atlaskit/editor-common/ui-color");
|
|
|
25
26
|
var _uiMenu = require("@atlaskit/editor-common/ui-menu");
|
|
26
27
|
var _editorPalette = require("@atlaskit/editor-palette");
|
|
27
28
|
var _commands = require("@atlaskit/editor-plugin-table/commands");
|
|
29
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
28
30
|
var _forceFocus = require("../pm-plugins/force-focus");
|
|
29
31
|
var _commands2 = require("../pm-plugins/toolbar-data/commands");
|
|
30
32
|
var _Dropdown = _interopRequireDefault(require("./Dropdown"));
|
|
@@ -34,12 +36,41 @@ var _Input = _interopRequireDefault(require("./Input"));
|
|
|
34
36
|
var _ScrollButtons = require("./ScrollButtons");
|
|
35
37
|
var _Select = _interopRequireDefault(require("./Select"));
|
|
36
38
|
var _Separator = _interopRequireDefault(require("./Separator"));
|
|
37
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12
|
|
39
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12;
|
|
38
40
|
/** @jsx jsx */
|
|
39
41
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
40
42
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
41
43
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
42
44
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
45
|
+
function groupItems(items) {
|
|
46
|
+
var groupItems = items.reduce(function (accumulator, item, i) {
|
|
47
|
+
var finalOutput = accumulator.finalOutput,
|
|
48
|
+
buttonGroup = accumulator.buttonGroup;
|
|
49
|
+
if (item.type === 'button') {
|
|
50
|
+
var notLastItem = i < items.length - 1;
|
|
51
|
+
var nextItemIsButton = items[i + 1] && items[i + 1].type === 'button';
|
|
52
|
+
var wasPreviousButton = items[i - 1] && items[i - 1].type === 'button';
|
|
53
|
+
var isRadioButton = notLastItem && nextItemIsButton || wasPreviousButton;
|
|
54
|
+
if (isRadioButton) {
|
|
55
|
+
item.isRadioButton = true;
|
|
56
|
+
buttonGroup.push(item);
|
|
57
|
+
if (!nextItemIsButton && wasPreviousButton) {
|
|
58
|
+
finalOutput.push(buttonGroup);
|
|
59
|
+
accumulator.buttonGroup = [];
|
|
60
|
+
}
|
|
61
|
+
} else {
|
|
62
|
+
finalOutput.push(item);
|
|
63
|
+
}
|
|
64
|
+
} else {
|
|
65
|
+
finalOutput.push(item);
|
|
66
|
+
}
|
|
67
|
+
return accumulator;
|
|
68
|
+
}, {
|
|
69
|
+
buttonGroup: [],
|
|
70
|
+
finalOutput: []
|
|
71
|
+
});
|
|
72
|
+
return groupItems.finalOutput;
|
|
73
|
+
}
|
|
43
74
|
var ToolbarItems = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
44
75
|
var items = _ref.items,
|
|
45
76
|
dispatchCommand = _ref.dispatchCommand,
|
|
@@ -56,9 +87,7 @@ var ToolbarItems = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
|
56
87
|
mountRef = _ref.mountRef,
|
|
57
88
|
api = _ref.api;
|
|
58
89
|
var emojiAndColourPickerMountPoint = scrollable ? popupsMountPoint || (editorView === null || editorView === void 0 ? void 0 : editorView.dom.closest('.fabric-editor-popup-scroll-parent')) || (editorView === null || editorView === void 0 ? void 0 : editorView.dom.closest('.ak-editor-content-area')) || undefined : popupsMountPoint;
|
|
59
|
-
|
|
60
|
-
return !item.hidden;
|
|
61
|
-
}).map(function (item, idx) {
|
|
90
|
+
var renderItem = function renderItem(item, idx) {
|
|
62
91
|
var _api$contextPanel, _api$extension;
|
|
63
92
|
switch (item.type) {
|
|
64
93
|
case 'button':
|
|
@@ -102,7 +131,8 @@ var ToolbarItems = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
|
102
131
|
testId: item.testId,
|
|
103
132
|
hideTooltipOnClick: item.hideTooltipOnClick,
|
|
104
133
|
ariaHasPopup: item.ariaHasPopup,
|
|
105
|
-
tabIndex: item.tabIndex
|
|
134
|
+
tabIndex: item.tabIndex,
|
|
135
|
+
isRadioButton: item.isRadioButton
|
|
106
136
|
}, item.showTitle && item.title);
|
|
107
137
|
case 'input':
|
|
108
138
|
return (0, _react2.jsx)(_Input.default, {
|
|
@@ -229,7 +259,32 @@ var ToolbarItems = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
|
229
259
|
key: idx
|
|
230
260
|
});
|
|
231
261
|
}
|
|
232
|
-
}
|
|
262
|
+
};
|
|
263
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-floating-toolbar-markup_vexmo')) {
|
|
264
|
+
var groupedItems = groupItems(items.filter(function (item) {
|
|
265
|
+
return !item.hidden;
|
|
266
|
+
}));
|
|
267
|
+
return (0, _react2.jsx)(_buttonGroup.default, null, groupedItems.map(function (element, index) {
|
|
268
|
+
var isGroup = Array.isArray(element);
|
|
269
|
+
if (isGroup) {
|
|
270
|
+
return (0, _react2.jsx)("div", {
|
|
271
|
+
key: index,
|
|
272
|
+
css: buttonGroupStyles,
|
|
273
|
+
role: "radiogroup"
|
|
274
|
+
}, element.map(function (item, idx) {
|
|
275
|
+
return renderItem(item, idx);
|
|
276
|
+
}));
|
|
277
|
+
} else {
|
|
278
|
+
return renderItem(element, index);
|
|
279
|
+
}
|
|
280
|
+
}));
|
|
281
|
+
} else {
|
|
282
|
+
return (0, _react2.jsx)(_buttonGroup.default, null, items.filter(function (item) {
|
|
283
|
+
return !item.hidden;
|
|
284
|
+
}).map(function (item, index) {
|
|
285
|
+
return renderItem(item, index);
|
|
286
|
+
}));
|
|
287
|
+
}
|
|
233
288
|
}, function (prevProps, nextProps) {
|
|
234
289
|
if (!nextProps.node) {
|
|
235
290
|
return false;
|
|
@@ -238,6 +293,10 @@ var ToolbarItems = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
|
238
293
|
// otherwise it causes an issue where multiple popups stays open
|
|
239
294
|
return !(prevProps.node.type !== nextProps.node.type || prevProps.node.attrs.localId !== nextProps.node.attrs.localId || !(0, _floatingToolbar.areSameItems)(prevProps.items, nextProps.items) || !prevProps.mounted !== !nextProps.mounted);
|
|
240
295
|
});
|
|
296
|
+
var buttonGroupStyles = (0, _react2.css)({
|
|
297
|
+
display: 'flex',
|
|
298
|
+
gap: "var(--ds-space-050, 4px)"
|
|
299
|
+
});
|
|
241
300
|
|
|
242
301
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
243
302
|
var toolbarContainer = function toolbarContainer(scrollable, hasSelect, firstElementIsSelect) {
|
|
@@ -246,7 +305,9 @@ var toolbarContainer = function toolbarContainer(scrollable, hasSelect, firstEle
|
|
|
246
305
|
|
|
247
306
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
248
307
|
var toolbarOverflow = function toolbarOverflow(scrollable, scrollDisabled, firstElementIsSelect) {
|
|
249
|
-
return (0, _react2.css)(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n ", "\n"])), scrollable ? (0, _react2.css)(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2.default)(["\n ", "\n -webkit-overflow-scrolling: touch;\n padding: ", " 0
|
|
308
|
+
return (0, _react2.css)(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n ", "\n"])), scrollable ? (0, _react2.css)(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2.default)(["\n ", "\n -webkit-overflow-scrolling: touch;\n padding: ", " 0 ", ";\n > div {\n > div:first-child {\n ", "\n }\n > div:last-child {\n margin-right: ", ";\n }\n }\n "])), scrollDisabled ? (0, _react2.css)(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2.default)(["\n overflow: hidden;\n "]))) : (0, _react2.css)(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2.default)(["\n overflow-x: auto;\n overflow-y: hidden;\n "]))), "var(--ds-space-050, 4px)", "var(--ds-space-600, 48px)", firstElementIsSelect ? (0, _react2.css)(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2.default)(["\n margin-left: ", ";\n "])), "var(--ds-space-050, 4px)") : (0, _react2.css)(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2.default)(["\n margin-left: ", ";\n "])), "var(--ds-space-100, 8px)"), "var(--ds-space-100, 8px)") : (0, _react2.css)({
|
|
309
|
+
display: 'flex'
|
|
310
|
+
}));
|
|
250
311
|
};
|
|
251
312
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
252
313
|
var Toolbar = /*#__PURE__*/function (_Component) {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import { createRef, useCallback, useEffect, useState } from 'react';
|
|
3
|
-
import { Component } from 'react';
|
|
2
|
+
import { Component, createRef, useCallback, useEffect, useState } from 'react';
|
|
4
3
|
import { css, jsx } from '@emotion/react';
|
|
5
4
|
// eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
|
|
6
5
|
|
|
@@ -16,34 +15,30 @@ export const menuItemDimensions = {
|
|
|
16
15
|
width: 175,
|
|
17
16
|
height: 32
|
|
18
17
|
};
|
|
18
|
+
const spacerStyles = css({
|
|
19
|
+
display: 'flex',
|
|
20
|
+
flex: 1,
|
|
21
|
+
padding: "var(--ds-space-100, 8px)"
|
|
22
|
+
});
|
|
19
23
|
|
|
20
|
-
// eslint-disable-next-line @atlaskit/design-system/
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
flex: 1;
|
|
24
|
-
padding: ${"var(--ds-space-100, 8px)"};
|
|
25
|
-
`;
|
|
26
|
-
|
|
27
|
-
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
28
|
-
const menuContainer = css`
|
|
29
|
-
min-width: ${menuItemDimensions.width}px;
|
|
30
|
-
|
|
24
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
25
|
+
const menuContainerStyles = css({
|
|
26
|
+
minWidth: `${menuItemDimensions.width}px`,
|
|
31
27
|
// temporary solution to retain spacing defined by @atlaskit/Item
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
28
|
+
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
29
|
+
'& button': {
|
|
30
|
+
minHeight: "var(--ds-space-400, 32px)",
|
|
31
|
+
padding: `${"var(--ds-space-100, 8px)"} ${"var(--ds-space-100, 8px)"} 7px`,
|
|
32
|
+
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
33
|
+
'& > [data-item-elem-before]': {
|
|
34
|
+
marginRight: "var(--ds-space-050, 4px)"
|
|
38
35
|
}
|
|
39
36
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
width: 100%;
|
|
46
|
-
`;
|
|
37
|
+
});
|
|
38
|
+
const labelStyles = css({
|
|
39
|
+
display: 'inline-block',
|
|
40
|
+
width: '100%'
|
|
41
|
+
});
|
|
47
42
|
|
|
48
43
|
// TODO: Migrate away from gridSize
|
|
49
44
|
// Recommendation: Replace with 4 as itemSpacing is used in calculations expecting a number
|
|
@@ -152,7 +147,7 @@ const DropdownMenuItem = ({
|
|
|
152
147
|
onBlur: handleItemOnBlur
|
|
153
148
|
}, jsx("span", {
|
|
154
149
|
ref: labelRef,
|
|
155
|
-
css:
|
|
150
|
+
css: labelStyles
|
|
156
151
|
}, item.title));
|
|
157
152
|
if (tooltipContent) {
|
|
158
153
|
return jsx(Tooltip, {
|
|
@@ -173,7 +168,7 @@ class Dropdown extends Component {
|
|
|
173
168
|
editorView
|
|
174
169
|
} = this.props;
|
|
175
170
|
return jsx("div", {
|
|
176
|
-
css:
|
|
171
|
+
css: menuContainerStyles
|
|
177
172
|
}, items.filter(item => !item.hidden).map((item, idx) => jsx(DropdownMenuItem, {
|
|
178
173
|
key: idx,
|
|
179
174
|
item: item,
|
|
@@ -198,7 +193,7 @@ class Dropdown extends Component {
|
|
|
198
193
|
});
|
|
199
194
|
}
|
|
200
195
|
return jsx("span", {
|
|
201
|
-
css:
|
|
196
|
+
css: spacerStyles
|
|
202
197
|
});
|
|
203
198
|
}
|
|
204
199
|
}
|
package/dist/es2019/ui/Input.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
/** @jsx jsx */
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { Component } from 'react';
|
|
3
|
+
import React, { Component } from 'react';
|
|
5
4
|
import { jsx } from '@emotion/react';
|
|
6
5
|
import { panelTextInput } from '@atlaskit/editor-common/ui';
|
|
7
6
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
package/dist/es2019/ui/Select.js
CHANGED
|
@@ -20,7 +20,9 @@ export default function Search(props) {
|
|
|
20
20
|
const controlWrapper = (selectRef === null || selectRef === void 0 ? void 0 : (_selectRef$current = selectRef.current) === null || _selectRef$current === void 0 ? void 0 : (_selectRef$current$se = _selectRef$current.select) === null || _selectRef$current$se === void 0 ? void 0 : (_selectRef$current$se2 = _selectRef$current$se.controlRef) === null || _selectRef$current$se2 === void 0 ? void 0 : _selectRef$current$se2.parentNode) || (selectRef === null || selectRef === void 0 ? void 0 : (_selectRef$current2 = selectRef.current) === null || _selectRef$current2 === void 0 ? void 0 : (_selectRef$current2$s = _selectRef$current2.select) === null || _selectRef$current2$s === void 0 ? void 0 : (_selectRef$current2$s2 = _selectRef$current2$s.select) === null || _selectRef$current2$s2 === void 0 ? void 0 : (_selectRef$current2$s3 = _selectRef$current2$s2.controlRef) === null || _selectRef$current2$s3 === void 0 ? void 0 : _selectRef$current2$s3.parentNode);
|
|
21
21
|
const menuPortalStyles = controlWrapper && props.setDisableParentScroll ? {
|
|
22
22
|
// since the portal is now outside, we need to position it as before
|
|
23
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
23
24
|
top: controlWrapper.offsetTop,
|
|
25
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
24
26
|
left: controlWrapper.offsetLeft,
|
|
25
27
|
height: controlWrapper.offsetHeight,
|
|
26
28
|
width
|
|
@@ -5,14 +5,13 @@ import React, { Component } from 'react';
|
|
|
5
5
|
import { css, jsx } from '@emotion/react';
|
|
6
6
|
import { injectIntl } from 'react-intl-next';
|
|
7
7
|
import ButtonGroup from '@atlaskit/button/button-group';
|
|
8
|
-
import { areSameItems } from '@atlaskit/editor-common/floating-toolbar';
|
|
9
|
-
import { messages } from '@atlaskit/editor-common/floating-toolbar';
|
|
8
|
+
import { areSameItems, messages } from '@atlaskit/editor-common/floating-toolbar';
|
|
10
9
|
import { Announcer, FloatingToolbarButton as Button } from '@atlaskit/editor-common/ui';
|
|
11
10
|
import { backgroundPaletteTooltipMessages } from '@atlaskit/editor-common/ui-color';
|
|
12
|
-
import { ToolbarArrowKeyNavigationProvider } from '@atlaskit/editor-common/ui-menu';
|
|
13
|
-
import { ColorPickerButton } from '@atlaskit/editor-common/ui-menu';
|
|
11
|
+
import { ColorPickerButton, ToolbarArrowKeyNavigationProvider } from '@atlaskit/editor-common/ui-menu';
|
|
14
12
|
import { hexToEditorBackgroundPaletteColor } from '@atlaskit/editor-palette';
|
|
15
13
|
import { clearHoverSelection } from '@atlaskit/editor-plugin-table/commands';
|
|
14
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
16
15
|
import { checkShouldForceFocusAndApply, forceFocusSelector } from '../pm-plugins/force-focus';
|
|
17
16
|
import { showConfirmDialog } from '../pm-plugins/toolbar-data/commands';
|
|
18
17
|
import Dropdown from './Dropdown';
|
|
@@ -22,6 +21,37 @@ import Input from './Input';
|
|
|
22
21
|
import { ScrollButtons } from './ScrollButtons';
|
|
23
22
|
import Select from './Select';
|
|
24
23
|
import Separator from './Separator';
|
|
24
|
+
export function groupItems(items) {
|
|
25
|
+
const groupItems = items.reduce((accumulator, item, i) => {
|
|
26
|
+
let {
|
|
27
|
+
finalOutput,
|
|
28
|
+
buttonGroup
|
|
29
|
+
} = accumulator;
|
|
30
|
+
if (item.type === 'button') {
|
|
31
|
+
const notLastItem = i < items.length - 1;
|
|
32
|
+
const nextItemIsButton = items[i + 1] && items[i + 1].type === 'button';
|
|
33
|
+
const wasPreviousButton = items[i - 1] && items[i - 1].type === 'button';
|
|
34
|
+
const isRadioButton = notLastItem && nextItemIsButton || wasPreviousButton;
|
|
35
|
+
if (isRadioButton) {
|
|
36
|
+
item.isRadioButton = true;
|
|
37
|
+
buttonGroup.push(item);
|
|
38
|
+
if (!nextItemIsButton && wasPreviousButton) {
|
|
39
|
+
finalOutput.push(buttonGroup);
|
|
40
|
+
accumulator.buttonGroup = [];
|
|
41
|
+
}
|
|
42
|
+
} else {
|
|
43
|
+
finalOutput.push(item);
|
|
44
|
+
}
|
|
45
|
+
} else {
|
|
46
|
+
finalOutput.push(item);
|
|
47
|
+
}
|
|
48
|
+
return accumulator;
|
|
49
|
+
}, {
|
|
50
|
+
buttonGroup: [],
|
|
51
|
+
finalOutput: []
|
|
52
|
+
});
|
|
53
|
+
return groupItems.finalOutput;
|
|
54
|
+
}
|
|
25
55
|
const ToolbarItems = /*#__PURE__*/React.memo(({
|
|
26
56
|
items,
|
|
27
57
|
dispatchCommand,
|
|
@@ -39,7 +69,7 @@ const ToolbarItems = /*#__PURE__*/React.memo(({
|
|
|
39
69
|
api
|
|
40
70
|
}) => {
|
|
41
71
|
const emojiAndColourPickerMountPoint = scrollable ? popupsMountPoint || (editorView === null || editorView === void 0 ? void 0 : editorView.dom.closest('.fabric-editor-popup-scroll-parent')) || (editorView === null || editorView === void 0 ? void 0 : editorView.dom.closest('.ak-editor-content-area')) || undefined : popupsMountPoint;
|
|
42
|
-
|
|
72
|
+
const renderItem = (item, idx) => {
|
|
43
73
|
var _api$contextPanel, _api$extension;
|
|
44
74
|
switch (item.type) {
|
|
45
75
|
case 'button':
|
|
@@ -75,7 +105,8 @@ const ToolbarItems = /*#__PURE__*/React.memo(({
|
|
|
75
105
|
testId: item.testId,
|
|
76
106
|
hideTooltipOnClick: item.hideTooltipOnClick,
|
|
77
107
|
ariaHasPopup: item.ariaHasPopup,
|
|
78
|
-
tabIndex: item.tabIndex
|
|
108
|
+
tabIndex: item.tabIndex,
|
|
109
|
+
isRadioButton: item.isRadioButton
|
|
79
110
|
}, item.showTitle && item.title);
|
|
80
111
|
case 'input':
|
|
81
112
|
return jsx(Input, {
|
|
@@ -194,7 +225,28 @@ const ToolbarItems = /*#__PURE__*/React.memo(({
|
|
|
194
225
|
key: idx
|
|
195
226
|
});
|
|
196
227
|
}
|
|
197
|
-
}
|
|
228
|
+
};
|
|
229
|
+
if (getBooleanFF('platform.editor.a11y-floating-toolbar-markup_vexmo')) {
|
|
230
|
+
const groupedItems = groupItems(items.filter(item => !item.hidden));
|
|
231
|
+
return jsx(ButtonGroup, null, groupedItems.map((element, index) => {
|
|
232
|
+
const isGroup = Array.isArray(element);
|
|
233
|
+
if (isGroup) {
|
|
234
|
+
return jsx("div", {
|
|
235
|
+
key: index,
|
|
236
|
+
css: buttonGroupStyles,
|
|
237
|
+
role: "radiogroup"
|
|
238
|
+
}, element.map((item, idx) => {
|
|
239
|
+
return renderItem(item, idx);
|
|
240
|
+
}));
|
|
241
|
+
} else {
|
|
242
|
+
return renderItem(element, index);
|
|
243
|
+
}
|
|
244
|
+
}));
|
|
245
|
+
} else {
|
|
246
|
+
return jsx(ButtonGroup, null, items.filter(item => !item.hidden).map((item, index) => {
|
|
247
|
+
return renderItem(item, index);
|
|
248
|
+
}));
|
|
249
|
+
}
|
|
198
250
|
}, (prevProps, nextProps) => {
|
|
199
251
|
if (!nextProps.node) {
|
|
200
252
|
return false;
|
|
@@ -203,6 +255,10 @@ const ToolbarItems = /*#__PURE__*/React.memo(({
|
|
|
203
255
|
// otherwise it causes an issue where multiple popups stays open
|
|
204
256
|
return !(prevProps.node.type !== nextProps.node.type || prevProps.node.attrs.localId !== nextProps.node.attrs.localId || !areSameItems(prevProps.items, nextProps.items) || !prevProps.mounted !== !nextProps.mounted);
|
|
205
257
|
});
|
|
258
|
+
const buttonGroupStyles = css({
|
|
259
|
+
display: 'flex',
|
|
260
|
+
gap: "var(--ds-space-050, 4px)"
|
|
261
|
+
});
|
|
206
262
|
|
|
207
263
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
208
264
|
const toolbarContainer = (scrollable, hasSelect, firstElementIsSelect) => css`
|
|
@@ -241,7 +297,7 @@ const toolbarOverflow = (scrollable, scrollDisabled, firstElementIsSelect) => cs
|
|
|
241
297
|
overflow-y: hidden;
|
|
242
298
|
`}
|
|
243
299
|
-webkit-overflow-scrolling: touch;
|
|
244
|
-
padding: ${"var(--ds-space-050, 4px)"} 0
|
|
300
|
+
padding: ${"var(--ds-space-050, 4px)"} 0 ${"var(--ds-space-600, 48px)"};
|
|
245
301
|
> div {
|
|
246
302
|
> div:first-child {
|
|
247
303
|
${firstElementIsSelect ? css`
|
|
@@ -254,9 +310,9 @@ const toolbarOverflow = (scrollable, scrollDisabled, firstElementIsSelect) => cs
|
|
|
254
310
|
margin-right: ${"var(--ds-space-100, 8px)"};
|
|
255
311
|
}
|
|
256
312
|
}
|
|
257
|
-
` : css
|
|
258
|
-
|
|
259
|
-
|
|
313
|
+
` : css({
|
|
314
|
+
display: 'flex'
|
|
315
|
+
})}
|
|
260
316
|
`;
|
|
261
317
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
262
318
|
class Toolbar extends Component {
|
|
@@ -4,13 +4,10 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
4
4
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
5
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
6
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
7
|
-
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
8
|
-
var _templateObject, _templateObject2, _templateObject3;
|
|
9
7
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
10
8
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
11
9
|
/** @jsx jsx */
|
|
12
|
-
import { createRef, useCallback, useEffect, useState } from 'react';
|
|
13
|
-
import { Component } from 'react';
|
|
10
|
+
import { Component, createRef, useCallback, useEffect, useState } from 'react';
|
|
14
11
|
import { css, jsx } from '@emotion/react';
|
|
15
12
|
// eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
|
|
16
13
|
|
|
@@ -26,15 +23,30 @@ export var menuItemDimensions = {
|
|
|
26
23
|
width: 175,
|
|
27
24
|
height: 32
|
|
28
25
|
};
|
|
26
|
+
var spacerStyles = css({
|
|
27
|
+
display: 'flex',
|
|
28
|
+
flex: 1,
|
|
29
|
+
padding: "var(--ds-space-100, 8px)"
|
|
30
|
+
});
|
|
29
31
|
|
|
30
|
-
// eslint-disable-next-line @atlaskit/design-system/
|
|
31
|
-
var
|
|
32
|
-
|
|
33
|
-
//
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
var
|
|
32
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
33
|
+
var menuContainerStyles = css({
|
|
34
|
+
minWidth: "".concat(menuItemDimensions.width, "px"),
|
|
35
|
+
// temporary solution to retain spacing defined by @atlaskit/Item
|
|
36
|
+
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
37
|
+
'& button': {
|
|
38
|
+
minHeight: "var(--ds-space-400, 32px)",
|
|
39
|
+
padding: "var(--ds-space-100, 8px)".concat(" ", "var(--ds-space-100, 8px)", " 7px"),
|
|
40
|
+
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
41
|
+
'& > [data-item-elem-before]': {
|
|
42
|
+
marginRight: "var(--ds-space-050, 4px)"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
var labelStyles = css({
|
|
47
|
+
display: 'inline-block',
|
|
48
|
+
width: '100%'
|
|
49
|
+
});
|
|
38
50
|
|
|
39
51
|
// TODO: Migrate away from gridSize
|
|
40
52
|
// Recommendation: Replace with 4 as itemSpacing is used in calculations expecting a number
|
|
@@ -145,7 +157,7 @@ var DropdownMenuItem = function DropdownMenuItem(_ref) {
|
|
|
145
157
|
onBlur: handleItemOnBlur
|
|
146
158
|
}, jsx("span", {
|
|
147
159
|
ref: labelRef,
|
|
148
|
-
css:
|
|
160
|
+
css: labelStyles
|
|
149
161
|
}, item.title));
|
|
150
162
|
if (tooltipContent) {
|
|
151
163
|
return jsx(Tooltip, {
|
|
@@ -174,7 +186,7 @@ var Dropdown = /*#__PURE__*/function (_Component) {
|
|
|
174
186
|
intl = _this$props.intl,
|
|
175
187
|
editorView = _this$props.editorView;
|
|
176
188
|
return jsx("div", {
|
|
177
|
-
css:
|
|
189
|
+
css: menuContainerStyles
|
|
178
190
|
}, items.filter(function (item) {
|
|
179
191
|
return !item.hidden;
|
|
180
192
|
}).map(function (item, idx) {
|
|
@@ -202,7 +214,7 @@ var Dropdown = /*#__PURE__*/function (_Component) {
|
|
|
202
214
|
});
|
|
203
215
|
}
|
|
204
216
|
return jsx("span", {
|
|
205
|
-
css:
|
|
217
|
+
css: spacerStyles
|
|
206
218
|
});
|
|
207
219
|
}
|
|
208
220
|
}]);
|
package/dist/esm/ui/Input.js
CHANGED
|
@@ -8,8 +8,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
8
8
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
9
9
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
10
10
|
/** @jsx jsx */
|
|
11
|
-
import React from 'react';
|
|
12
|
-
import { Component } from 'react';
|
|
11
|
+
import React, { Component } from 'react';
|
|
13
12
|
import { jsx } from '@emotion/react';
|
|
14
13
|
import { panelTextInput } from '@atlaskit/editor-common/ui';
|
|
15
14
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
package/dist/esm/ui/Select.js
CHANGED
|
@@ -24,7 +24,9 @@ export default function Search(props) {
|
|
|
24
24
|
var controlWrapper = (selectRef === null || selectRef === void 0 || (_selectRef$current = selectRef.current) === null || _selectRef$current === void 0 || (_selectRef$current = _selectRef$current.select) === null || _selectRef$current === void 0 || (_selectRef$current = _selectRef$current.controlRef) === null || _selectRef$current === void 0 ? void 0 : _selectRef$current.parentNode) || (selectRef === null || selectRef === void 0 || (_selectRef$current2 = selectRef.current) === null || _selectRef$current2 === void 0 || (_selectRef$current2 = _selectRef$current2.select) === null || _selectRef$current2 === void 0 || (_selectRef$current2 = _selectRef$current2.select) === null || _selectRef$current2 === void 0 || (_selectRef$current2 = _selectRef$current2.controlRef) === null || _selectRef$current2 === void 0 ? void 0 : _selectRef$current2.parentNode);
|
|
25
25
|
var menuPortalStyles = controlWrapper && props.setDisableParentScroll ? {
|
|
26
26
|
// since the portal is now outside, we need to position it as before
|
|
27
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
27
28
|
top: controlWrapper.offsetTop,
|
|
29
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
28
30
|
left: controlWrapper.offsetLeft,
|
|
29
31
|
height: controlWrapper.offsetHeight,
|
|
30
32
|
width: width
|
package/dist/esm/ui/Toolbar.js
CHANGED
|
@@ -7,7 +7,7 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
|
|
|
7
7
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
8
8
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
9
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
10
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12
|
|
10
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12;
|
|
11
11
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
12
12
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
13
13
|
/** @jsx jsx */
|
|
@@ -15,14 +15,13 @@ import React, { Component } from 'react';
|
|
|
15
15
|
import { css, jsx } from '@emotion/react';
|
|
16
16
|
import { injectIntl } from 'react-intl-next';
|
|
17
17
|
import ButtonGroup from '@atlaskit/button/button-group';
|
|
18
|
-
import { areSameItems } from '@atlaskit/editor-common/floating-toolbar';
|
|
19
|
-
import { messages } from '@atlaskit/editor-common/floating-toolbar';
|
|
18
|
+
import { areSameItems, messages } from '@atlaskit/editor-common/floating-toolbar';
|
|
20
19
|
import { Announcer, FloatingToolbarButton as Button } from '@atlaskit/editor-common/ui';
|
|
21
20
|
import { backgroundPaletteTooltipMessages } from '@atlaskit/editor-common/ui-color';
|
|
22
|
-
import { ToolbarArrowKeyNavigationProvider } from '@atlaskit/editor-common/ui-menu';
|
|
23
|
-
import { ColorPickerButton } from '@atlaskit/editor-common/ui-menu';
|
|
21
|
+
import { ColorPickerButton, ToolbarArrowKeyNavigationProvider } from '@atlaskit/editor-common/ui-menu';
|
|
24
22
|
import { hexToEditorBackgroundPaletteColor } from '@atlaskit/editor-palette';
|
|
25
23
|
import { clearHoverSelection } from '@atlaskit/editor-plugin-table/commands';
|
|
24
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
26
25
|
import { checkShouldForceFocusAndApply, forceFocusSelector } from '../pm-plugins/force-focus';
|
|
27
26
|
import { showConfirmDialog } from '../pm-plugins/toolbar-data/commands';
|
|
28
27
|
import Dropdown from './Dropdown';
|
|
@@ -32,6 +31,35 @@ import Input from './Input';
|
|
|
32
31
|
import { ScrollButtons } from './ScrollButtons';
|
|
33
32
|
import Select from './Select';
|
|
34
33
|
import Separator from './Separator';
|
|
34
|
+
export function groupItems(items) {
|
|
35
|
+
var groupItems = items.reduce(function (accumulator, item, i) {
|
|
36
|
+
var finalOutput = accumulator.finalOutput,
|
|
37
|
+
buttonGroup = accumulator.buttonGroup;
|
|
38
|
+
if (item.type === 'button') {
|
|
39
|
+
var notLastItem = i < items.length - 1;
|
|
40
|
+
var nextItemIsButton = items[i + 1] && items[i + 1].type === 'button';
|
|
41
|
+
var wasPreviousButton = items[i - 1] && items[i - 1].type === 'button';
|
|
42
|
+
var isRadioButton = notLastItem && nextItemIsButton || wasPreviousButton;
|
|
43
|
+
if (isRadioButton) {
|
|
44
|
+
item.isRadioButton = true;
|
|
45
|
+
buttonGroup.push(item);
|
|
46
|
+
if (!nextItemIsButton && wasPreviousButton) {
|
|
47
|
+
finalOutput.push(buttonGroup);
|
|
48
|
+
accumulator.buttonGroup = [];
|
|
49
|
+
}
|
|
50
|
+
} else {
|
|
51
|
+
finalOutput.push(item);
|
|
52
|
+
}
|
|
53
|
+
} else {
|
|
54
|
+
finalOutput.push(item);
|
|
55
|
+
}
|
|
56
|
+
return accumulator;
|
|
57
|
+
}, {
|
|
58
|
+
buttonGroup: [],
|
|
59
|
+
finalOutput: []
|
|
60
|
+
});
|
|
61
|
+
return groupItems.finalOutput;
|
|
62
|
+
}
|
|
35
63
|
var ToolbarItems = /*#__PURE__*/React.memo(function (_ref) {
|
|
36
64
|
var items = _ref.items,
|
|
37
65
|
dispatchCommand = _ref.dispatchCommand,
|
|
@@ -48,9 +76,7 @@ var ToolbarItems = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
48
76
|
mountRef = _ref.mountRef,
|
|
49
77
|
api = _ref.api;
|
|
50
78
|
var emojiAndColourPickerMountPoint = scrollable ? popupsMountPoint || (editorView === null || editorView === void 0 ? void 0 : editorView.dom.closest('.fabric-editor-popup-scroll-parent')) || (editorView === null || editorView === void 0 ? void 0 : editorView.dom.closest('.ak-editor-content-area')) || undefined : popupsMountPoint;
|
|
51
|
-
|
|
52
|
-
return !item.hidden;
|
|
53
|
-
}).map(function (item, idx) {
|
|
79
|
+
var renderItem = function renderItem(item, idx) {
|
|
54
80
|
var _api$contextPanel, _api$extension;
|
|
55
81
|
switch (item.type) {
|
|
56
82
|
case 'button':
|
|
@@ -94,7 +120,8 @@ var ToolbarItems = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
94
120
|
testId: item.testId,
|
|
95
121
|
hideTooltipOnClick: item.hideTooltipOnClick,
|
|
96
122
|
ariaHasPopup: item.ariaHasPopup,
|
|
97
|
-
tabIndex: item.tabIndex
|
|
123
|
+
tabIndex: item.tabIndex,
|
|
124
|
+
isRadioButton: item.isRadioButton
|
|
98
125
|
}, item.showTitle && item.title);
|
|
99
126
|
case 'input':
|
|
100
127
|
return jsx(Input, {
|
|
@@ -221,7 +248,32 @@ var ToolbarItems = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
221
248
|
key: idx
|
|
222
249
|
});
|
|
223
250
|
}
|
|
224
|
-
}
|
|
251
|
+
};
|
|
252
|
+
if (getBooleanFF('platform.editor.a11y-floating-toolbar-markup_vexmo')) {
|
|
253
|
+
var groupedItems = groupItems(items.filter(function (item) {
|
|
254
|
+
return !item.hidden;
|
|
255
|
+
}));
|
|
256
|
+
return jsx(ButtonGroup, null, groupedItems.map(function (element, index) {
|
|
257
|
+
var isGroup = Array.isArray(element);
|
|
258
|
+
if (isGroup) {
|
|
259
|
+
return jsx("div", {
|
|
260
|
+
key: index,
|
|
261
|
+
css: buttonGroupStyles,
|
|
262
|
+
role: "radiogroup"
|
|
263
|
+
}, element.map(function (item, idx) {
|
|
264
|
+
return renderItem(item, idx);
|
|
265
|
+
}));
|
|
266
|
+
} else {
|
|
267
|
+
return renderItem(element, index);
|
|
268
|
+
}
|
|
269
|
+
}));
|
|
270
|
+
} else {
|
|
271
|
+
return jsx(ButtonGroup, null, items.filter(function (item) {
|
|
272
|
+
return !item.hidden;
|
|
273
|
+
}).map(function (item, index) {
|
|
274
|
+
return renderItem(item, index);
|
|
275
|
+
}));
|
|
276
|
+
}
|
|
225
277
|
}, function (prevProps, nextProps) {
|
|
226
278
|
if (!nextProps.node) {
|
|
227
279
|
return false;
|
|
@@ -230,6 +282,10 @@ var ToolbarItems = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
230
282
|
// otherwise it causes an issue where multiple popups stays open
|
|
231
283
|
return !(prevProps.node.type !== nextProps.node.type || prevProps.node.attrs.localId !== nextProps.node.attrs.localId || !areSameItems(prevProps.items, nextProps.items) || !prevProps.mounted !== !nextProps.mounted);
|
|
232
284
|
});
|
|
285
|
+
var buttonGroupStyles = css({
|
|
286
|
+
display: 'flex',
|
|
287
|
+
gap: "var(--ds-space-050, 4px)"
|
|
288
|
+
});
|
|
233
289
|
|
|
234
290
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
235
291
|
var toolbarContainer = function toolbarContainer(scrollable, hasSelect, firstElementIsSelect) {
|
|
@@ -238,7 +294,9 @@ var toolbarContainer = function toolbarContainer(scrollable, hasSelect, firstEle
|
|
|
238
294
|
|
|
239
295
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
240
296
|
var toolbarOverflow = function toolbarOverflow(scrollable, scrollDisabled, firstElementIsSelect) {
|
|
241
|
-
return css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n ", "\n"])), scrollable ? css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n ", "\n -webkit-overflow-scrolling: touch;\n padding: ", " 0
|
|
297
|
+
return css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n ", "\n"])), scrollable ? css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n ", "\n -webkit-overflow-scrolling: touch;\n padding: ", " 0 ", ";\n > div {\n > div:first-child {\n ", "\n }\n > div:last-child {\n margin-right: ", ";\n }\n }\n "])), scrollDisabled ? css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n overflow: hidden;\n "]))) : css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n overflow-x: auto;\n overflow-y: hidden;\n "]))), "var(--ds-space-050, 4px)", "var(--ds-space-600, 48px)", firstElementIsSelect ? css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n margin-left: ", ";\n "])), "var(--ds-space-050, 4px)") : css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n margin-left: ", ";\n "])), "var(--ds-space-100, 8px)"), "var(--ds-space-100, 8px)") : css({
|
|
298
|
+
display: 'flex'
|
|
299
|
+
}));
|
|
242
300
|
};
|
|
243
301
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
244
302
|
var Toolbar = /*#__PURE__*/function (_Component) {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { ExtensionProvider } from '@atlaskit/editor-common/extensions';
|
|
3
|
-
import type { ExtensionAPI } from '@atlaskit/editor-common/extensions';
|
|
2
|
+
import type { ExtensionAPI, ExtensionProvider } from '@atlaskit/editor-common/extensions';
|
|
4
3
|
import type { ApplyChangeHandler } from '@atlaskit/editor-plugin-context-panel';
|
|
5
4
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
6
5
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
package/dist/types/ui/Input.d.ts
CHANGED
|
@@ -34,6 +34,8 @@ export interface Props {
|
|
|
34
34
|
]> | undefined;
|
|
35
35
|
mediaAssistiveMessage?: string;
|
|
36
36
|
}
|
|
37
|
+
type GroupedItems = (Item | Item[])[];
|
|
38
|
+
export declare function groupItems(items: Item[]): GroupedItems;
|
|
37
39
|
export interface State {
|
|
38
40
|
scrollDisabled: boolean;
|
|
39
41
|
mounted: boolean;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { ExtensionProvider } from '@atlaskit/editor-common/extensions';
|
|
3
|
-
import type { ExtensionAPI } from '@atlaskit/editor-common/extensions';
|
|
2
|
+
import type { ExtensionAPI, ExtensionProvider } from '@atlaskit/editor-common/extensions';
|
|
4
3
|
import type { ApplyChangeHandler } from '@atlaskit/editor-plugin-context-panel';
|
|
5
4
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
6
5
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
@@ -34,6 +34,8 @@ export interface Props {
|
|
|
34
34
|
]> | undefined;
|
|
35
35
|
mediaAssistiveMessage?: string;
|
|
36
36
|
}
|
|
37
|
+
type GroupedItems = (Item | Item[])[];
|
|
38
|
+
export declare function groupItems(items: Item[]): GroupedItems;
|
|
37
39
|
export interface State {
|
|
38
40
|
scrollDisabled: boolean;
|
|
39
41
|
mounted: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-floating-toolbar",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Floating toolbar plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -24,11 +24,10 @@
|
|
|
24
24
|
".": "./src/index.ts"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@atlaskit/adf-schema": "^35.5.1",
|
|
28
27
|
"@atlaskit/adf-utils": "^19.0.0",
|
|
29
28
|
"@atlaskit/button": "^17.4.0",
|
|
30
29
|
"@atlaskit/checkbox": "^13.0.0",
|
|
31
|
-
"@atlaskit/editor-common": "^78.
|
|
30
|
+
"@atlaskit/editor-common": "^78.4.0",
|
|
32
31
|
"@atlaskit/editor-palette": "1.5.2",
|
|
33
32
|
"@atlaskit/editor-plugin-context-panel": "^1.0.0",
|
|
34
33
|
"@atlaskit/editor-plugin-copy-button": "^1.0.0",
|
|
@@ -39,12 +38,13 @@
|
|
|
39
38
|
"@atlaskit/editor-plugin-table": "^7.3.0",
|
|
40
39
|
"@atlaskit/editor-prosemirror": "3.0.0",
|
|
41
40
|
"@atlaskit/emoji": "^67.6.0",
|
|
42
|
-
"@atlaskit/icon": "^22.
|
|
41
|
+
"@atlaskit/icon": "^22.1.0",
|
|
43
42
|
"@atlaskit/menu": "^2.1.0",
|
|
44
43
|
"@atlaskit/modal-dialog": "^12.10.0",
|
|
44
|
+
"@atlaskit/platform-feature-flags": "^0.2.5",
|
|
45
45
|
"@atlaskit/select": "^17.1.0",
|
|
46
46
|
"@atlaskit/theme": "^12.6.0",
|
|
47
|
-
"@atlaskit/tokens": "^1.
|
|
47
|
+
"@atlaskit/tokens": "^1.38.0",
|
|
48
48
|
"@atlaskit/tooltip": "^18.1.0",
|
|
49
49
|
"@babel/runtime": "^7.0.0",
|
|
50
50
|
"@emotion/react": "^11.7.1",
|
|
@@ -107,5 +107,10 @@
|
|
|
107
107
|
]
|
|
108
108
|
}
|
|
109
109
|
},
|
|
110
|
-
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0"
|
|
110
|
+
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0",
|
|
111
|
+
"platform-feature-flags": {
|
|
112
|
+
"platform.editor.a11y-floating-toolbar-markup_vexmo": {
|
|
113
|
+
"type": "boolean"
|
|
114
|
+
}
|
|
115
|
+
}
|
|
111
116
|
}
|
package/dist/cjs/ui/styles.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.iconOnlySpacing = exports.getButtonStyles = void 0;
|
|
8
|
-
var _adfSchema = require("@atlaskit/adf-schema");
|
|
9
|
-
var colors = _interopRequireWildcard(require("@atlaskit/theme/colors"));
|
|
10
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
11
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
12
|
-
var background = {
|
|
13
|
-
danger: {
|
|
14
|
-
default: {
|
|
15
|
-
light: 'inherit',
|
|
16
|
-
dark: 'inherit'
|
|
17
|
-
},
|
|
18
|
-
hover: {
|
|
19
|
-
light: "var(--ds-background-neutral-subtle-hovered, ".concat(colors.N30A, ")"),
|
|
20
|
-
dark: "var(--ds-background-neutral-subtle-hovered, ".concat(colors.N30A, ")")
|
|
21
|
-
},
|
|
22
|
-
active: {
|
|
23
|
-
light: "var(--ds-background-neutral-pressed, ".concat("".concat((0, _adfSchema.hexToRgba)(colors.B75, 0.6)), ")"),
|
|
24
|
-
dark: "var(--ds-background-neutral-pressed, ".concat("".concat((0, _adfSchema.hexToRgba)(colors.B75, 0.6)), ")")
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
var color = {
|
|
29
|
-
danger: {
|
|
30
|
-
default: {
|
|
31
|
-
light: "var(--ds-icon, ".concat(colors.N400, ")"),
|
|
32
|
-
dark: "var(--ds-icon, ".concat(colors.DN400, ")")
|
|
33
|
-
},
|
|
34
|
-
hover: {
|
|
35
|
-
light: "var(--ds-icon-danger, ".concat(colors.R400, ")"),
|
|
36
|
-
dark: "var(--ds-icon-danger, ".concat(colors.R400, ")")
|
|
37
|
-
},
|
|
38
|
-
active: {
|
|
39
|
-
light: "var(--ds-icon-danger, ".concat(colors.R400, ")"),
|
|
40
|
-
dark: "var(--ds-icon-danger, ".concat(colors.R400, ")")
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
var getStyles = function getStyles(property, _ref) {
|
|
45
|
-
var _ref$appearance = _ref.appearance,
|
|
46
|
-
appearance = _ref$appearance === void 0 ? 'default' : _ref$appearance,
|
|
47
|
-
_ref$state = _ref.state,
|
|
48
|
-
state = _ref$state === void 0 ? 'default' : _ref$state,
|
|
49
|
-
_ref$mode = _ref.mode,
|
|
50
|
-
mode = _ref$mode === void 0 ? 'light' : _ref$mode;
|
|
51
|
-
if (!property[appearance] || !property[appearance][state]) {
|
|
52
|
-
return 'initial';
|
|
53
|
-
}
|
|
54
|
-
return property[appearance][state][mode];
|
|
55
|
-
};
|
|
56
|
-
var iconOnlySpacing = exports.iconOnlySpacing = {
|
|
57
|
-
'&&': {
|
|
58
|
-
padding: '0px',
|
|
59
|
-
/**
|
|
60
|
-
Increased specificity here because css for .hyperlink-open-link defined in
|
|
61
|
-
packages/editor/editor-core/src/ui/ContentStyles/index.tsx file
|
|
62
|
-
overrides padding left-right 2px with 4px.
|
|
63
|
-
*/
|
|
64
|
-
'&&[href]': {
|
|
65
|
-
padding: '0 2px'
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
'& > span': {
|
|
69
|
-
margin: '0px'
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
var getButtonStyles = exports.getButtonStyles = function getButtonStyles(props) {
|
|
73
|
-
return {
|
|
74
|
-
background: getStyles(background, props),
|
|
75
|
-
color: getStyles(color, props)
|
|
76
|
-
};
|
|
77
|
-
};
|
package/dist/es2019/ui/styles.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { hexToRgba } from '@atlaskit/adf-schema';
|
|
2
|
-
import * as colors from '@atlaskit/theme/colors';
|
|
3
|
-
const background = {
|
|
4
|
-
danger: {
|
|
5
|
-
default: {
|
|
6
|
-
light: 'inherit',
|
|
7
|
-
dark: 'inherit'
|
|
8
|
-
},
|
|
9
|
-
hover: {
|
|
10
|
-
light: `var(--ds-background-neutral-subtle-hovered, ${colors.N30A})`,
|
|
11
|
-
dark: `var(--ds-background-neutral-subtle-hovered, ${colors.N30A})`
|
|
12
|
-
},
|
|
13
|
-
active: {
|
|
14
|
-
light: `var(--ds-background-neutral-pressed, ${`${hexToRgba(colors.B75, 0.6)}`})`,
|
|
15
|
-
dark: `var(--ds-background-neutral-pressed, ${`${hexToRgba(colors.B75, 0.6)}`})`
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
const color = {
|
|
20
|
-
danger: {
|
|
21
|
-
default: {
|
|
22
|
-
light: `var(--ds-icon, ${colors.N400})`,
|
|
23
|
-
dark: `var(--ds-icon, ${colors.DN400})`
|
|
24
|
-
},
|
|
25
|
-
hover: {
|
|
26
|
-
light: `var(--ds-icon-danger, ${colors.R400})`,
|
|
27
|
-
dark: `var(--ds-icon-danger, ${colors.R400})`
|
|
28
|
-
},
|
|
29
|
-
active: {
|
|
30
|
-
light: `var(--ds-icon-danger, ${colors.R400})`,
|
|
31
|
-
dark: `var(--ds-icon-danger, ${colors.R400})`
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
const getStyles = (property, {
|
|
36
|
-
appearance = 'default',
|
|
37
|
-
state = 'default',
|
|
38
|
-
mode = 'light'
|
|
39
|
-
}) => {
|
|
40
|
-
if (!property[appearance] || !property[appearance][state]) {
|
|
41
|
-
return 'initial';
|
|
42
|
-
}
|
|
43
|
-
return property[appearance][state][mode];
|
|
44
|
-
};
|
|
45
|
-
export const iconOnlySpacing = {
|
|
46
|
-
'&&': {
|
|
47
|
-
padding: '0px',
|
|
48
|
-
/**
|
|
49
|
-
Increased specificity here because css for .hyperlink-open-link defined in
|
|
50
|
-
packages/editor/editor-core/src/ui/ContentStyles/index.tsx file
|
|
51
|
-
overrides padding left-right 2px with 4px.
|
|
52
|
-
*/
|
|
53
|
-
'&&[href]': {
|
|
54
|
-
padding: '0 2px'
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
'& > span': {
|
|
58
|
-
margin: '0px'
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
export const getButtonStyles = props => ({
|
|
62
|
-
background: getStyles(background, props),
|
|
63
|
-
color: getStyles(color, props)
|
|
64
|
-
});
|
package/dist/esm/ui/styles.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { hexToRgba } from '@atlaskit/adf-schema';
|
|
2
|
-
import * as colors from '@atlaskit/theme/colors';
|
|
3
|
-
var background = {
|
|
4
|
-
danger: {
|
|
5
|
-
default: {
|
|
6
|
-
light: 'inherit',
|
|
7
|
-
dark: 'inherit'
|
|
8
|
-
},
|
|
9
|
-
hover: {
|
|
10
|
-
light: "var(--ds-background-neutral-subtle-hovered, ".concat(colors.N30A, ")"),
|
|
11
|
-
dark: "var(--ds-background-neutral-subtle-hovered, ".concat(colors.N30A, ")")
|
|
12
|
-
},
|
|
13
|
-
active: {
|
|
14
|
-
light: "var(--ds-background-neutral-pressed, ".concat("".concat(hexToRgba(colors.B75, 0.6)), ")"),
|
|
15
|
-
dark: "var(--ds-background-neutral-pressed, ".concat("".concat(hexToRgba(colors.B75, 0.6)), ")")
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
var color = {
|
|
20
|
-
danger: {
|
|
21
|
-
default: {
|
|
22
|
-
light: "var(--ds-icon, ".concat(colors.N400, ")"),
|
|
23
|
-
dark: "var(--ds-icon, ".concat(colors.DN400, ")")
|
|
24
|
-
},
|
|
25
|
-
hover: {
|
|
26
|
-
light: "var(--ds-icon-danger, ".concat(colors.R400, ")"),
|
|
27
|
-
dark: "var(--ds-icon-danger, ".concat(colors.R400, ")")
|
|
28
|
-
},
|
|
29
|
-
active: {
|
|
30
|
-
light: "var(--ds-icon-danger, ".concat(colors.R400, ")"),
|
|
31
|
-
dark: "var(--ds-icon-danger, ".concat(colors.R400, ")")
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
var getStyles = function getStyles(property, _ref) {
|
|
36
|
-
var _ref$appearance = _ref.appearance,
|
|
37
|
-
appearance = _ref$appearance === void 0 ? 'default' : _ref$appearance,
|
|
38
|
-
_ref$state = _ref.state,
|
|
39
|
-
state = _ref$state === void 0 ? 'default' : _ref$state,
|
|
40
|
-
_ref$mode = _ref.mode,
|
|
41
|
-
mode = _ref$mode === void 0 ? 'light' : _ref$mode;
|
|
42
|
-
if (!property[appearance] || !property[appearance][state]) {
|
|
43
|
-
return 'initial';
|
|
44
|
-
}
|
|
45
|
-
return property[appearance][state][mode];
|
|
46
|
-
};
|
|
47
|
-
export var iconOnlySpacing = {
|
|
48
|
-
'&&': {
|
|
49
|
-
padding: '0px',
|
|
50
|
-
/**
|
|
51
|
-
Increased specificity here because css for .hyperlink-open-link defined in
|
|
52
|
-
packages/editor/editor-core/src/ui/ContentStyles/index.tsx file
|
|
53
|
-
overrides padding left-right 2px with 4px.
|
|
54
|
-
*/
|
|
55
|
-
'&&[href]': {
|
|
56
|
-
padding: '0 2px'
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
'& > span': {
|
|
60
|
-
margin: '0px'
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
export var getButtonStyles = function getButtonStyles(props) {
|
|
64
|
-
return {
|
|
65
|
-
background: getStyles(background, props),
|
|
66
|
-
color: getStyles(color, props)
|
|
67
|
-
};
|
|
68
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export declare const iconOnlySpacing: {
|
|
2
|
-
'&&': {
|
|
3
|
-
padding: string;
|
|
4
|
-
/**
|
|
5
|
-
Increased specificity here because css for .hyperlink-open-link defined in
|
|
6
|
-
packages/editor/editor-core/src/ui/ContentStyles/index.tsx file
|
|
7
|
-
overrides padding left-right 2px with 4px.
|
|
8
|
-
*/
|
|
9
|
-
'&&[href]': {
|
|
10
|
-
padding: string;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
'& > span': {
|
|
14
|
-
margin: string;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
export declare const getButtonStyles: (props: any) => {
|
|
18
|
-
background: any;
|
|
19
|
-
color: any;
|
|
20
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export declare const iconOnlySpacing: {
|
|
2
|
-
'&&': {
|
|
3
|
-
padding: string;
|
|
4
|
-
/**
|
|
5
|
-
Increased specificity here because css for .hyperlink-open-link defined in
|
|
6
|
-
packages/editor/editor-core/src/ui/ContentStyles/index.tsx file
|
|
7
|
-
overrides padding left-right 2px with 4px.
|
|
8
|
-
*/
|
|
9
|
-
'&&[href]': {
|
|
10
|
-
padding: string;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
'& > span': {
|
|
14
|
-
margin: string;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
export declare const getButtonStyles: (props: any) => {
|
|
18
|
-
background: any;
|
|
19
|
-
color: any;
|
|
20
|
-
};
|