@atlaskit/editor-common 75.5.2 → 75.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/cjs/analytics/fire-analytics-event.js +2 -1
- package/dist/cjs/analytics/index.js +6 -0
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui-menu/ColorPickerButton/index.js +204 -0
- package/dist/cjs/ui-menu/DropdownContainer/index.js +33 -0
- package/dist/cjs/ui-menu/index.js +14 -0
- package/dist/cjs/utils/index.js +12 -0
- package/dist/cjs/utils/nodes.js +13 -2
- package/dist/es2019/analytics/fire-analytics-event.js +1 -1
- package/dist/es2019/analytics/index.js +1 -1
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui-menu/ColorPickerButton/index.js +212 -0
- package/dist/es2019/ui-menu/DropdownContainer/index.js +21 -0
- package/dist/es2019/ui-menu/index.js +3 -1
- package/dist/es2019/utils/index.js +2 -1
- package/dist/es2019/utils/nodes.js +9 -1
- package/dist/esm/analytics/fire-analytics-event.js +1 -1
- package/dist/esm/analytics/index.js +1 -1
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui-menu/ColorPickerButton/index.js +197 -0
- package/dist/esm/ui-menu/DropdownContainer/index.js +23 -0
- package/dist/esm/ui-menu/index.js +3 -1
- package/dist/esm/utils/index.js +2 -1
- package/dist/esm/utils/nodes.js +9 -1
- package/dist/types/analytics/fire-analytics-event.d.ts +2 -0
- package/dist/types/analytics/index.d.ts +1 -1
- package/dist/types/ui/DropList/index.d.ts +1 -1
- package/dist/types/ui/index.d.ts +1 -0
- package/dist/types/ui-menu/ColorPickerButton/index.d.ts +28 -0
- package/dist/types/ui-menu/DropdownContainer/index.d.ts +3 -0
- package/dist/types/ui-menu/index.d.ts +2 -0
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/utils/nodes.d.ts +3 -0
- package/dist/types-ts4.5/analytics/fire-analytics-event.d.ts +2 -0
- package/dist/types-ts4.5/analytics/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/DropList/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/index.d.ts +1 -0
- package/dist/types-ts4.5/ui-menu/ColorPickerButton/index.d.ts +28 -0
- package/dist/types-ts4.5/ui-menu/DropdownContainer/index.d.ts +3 -0
- package/dist/types-ts4.5/ui-menu/index.d.ts +2 -0
- package/dist/types-ts4.5/utils/index.d.ts +1 -0
- package/dist/types-ts4.5/utils/nodes.d.ts +3 -0
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.fireAnalyticsEvent = void 0;
|
|
6
|
+
exports.fireAnalyticsEvent = exports.editorAnalyticsChannel = void 0;
|
|
7
7
|
var _analyticsListeners = require("@atlaskit/analytics-listeners");
|
|
8
8
|
var _analyticsQueue = require("./analytics-queue");
|
|
9
9
|
var editorAnalyticsChannel = _analyticsListeners.FabricChannel.editor;
|
|
10
|
+
exports.editorAnalyticsChannel = editorAnalyticsChannel;
|
|
10
11
|
var fireAnalyticsEvent = function fireAnalyticsEvent(createAnalyticsEvent) {
|
|
11
12
|
return function (_ref) {
|
|
12
13
|
var payload = _ref.payload,
|
|
@@ -255,6 +255,12 @@ Object.defineProperty(exports, "buildVisitedLinkPayload", {
|
|
|
255
255
|
return _linkingUtils.buildVisitedLinkPayload;
|
|
256
256
|
}
|
|
257
257
|
});
|
|
258
|
+
Object.defineProperty(exports, "editorAnalyticsChannel", {
|
|
259
|
+
enumerable: true,
|
|
260
|
+
get: function get() {
|
|
261
|
+
return _fireAnalyticsEvent.editorAnalyticsChannel;
|
|
262
|
+
}
|
|
263
|
+
});
|
|
258
264
|
Object.defineProperty(exports, "fireAnalyticsEvent", {
|
|
259
265
|
enumerable: true,
|
|
260
266
|
get: function get() {
|
|
@@ -16,7 +16,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
16
16
|
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; }
|
|
17
17
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
18
18
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
19
|
-
var packageVersion = "75.
|
|
19
|
+
var packageVersion = "75.6.0";
|
|
20
20
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
21
21
|
// Remove URL as it has UGC
|
|
22
22
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -24,7 +24,7 @@ var _templateObject, _templateObject2, _templateObject3;
|
|
|
24
24
|
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); }; }
|
|
25
25
|
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 */
|
|
26
26
|
var packageName = "@atlaskit/editor-common";
|
|
27
|
-
var packageVersion = "75.
|
|
27
|
+
var packageVersion = "75.6.0";
|
|
28
28
|
var halfFocusRing = 1;
|
|
29
29
|
var dropOffset = '0, 8';
|
|
30
30
|
var DropList = /*#__PURE__*/function (_Component) {
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
var _react2 = require("@emotion/react");
|
|
12
|
+
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
13
|
+
var _button = _interopRequireDefault(require("@atlaskit/button"));
|
|
14
|
+
var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/glyph/chevron-down"));
|
|
15
|
+
var _colors = require("@atlaskit/theme/colors");
|
|
16
|
+
var _components = require("@atlaskit/theme/components");
|
|
17
|
+
var _constants = require("@atlaskit/theme/constants");
|
|
18
|
+
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
19
|
+
var _analytics = require("../../analytics");
|
|
20
|
+
var _uiColor = require("../../ui-color");
|
|
21
|
+
var _Popup = _interopRequireDefault(require("../../ui/Popup"));
|
|
22
|
+
var _withOuterListeners = _interopRequireDefault(require("../../ui/with-outer-listeners"));
|
|
23
|
+
var _ArrowKeyNavigationProvider = require("../ArrowKeyNavigationProvider");
|
|
24
|
+
var _types = require("../ArrowKeyNavigationProvider/types");
|
|
25
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
26
|
+
/** @jsx jsx */
|
|
27
|
+
// helps adjusts position of popup
|
|
28
|
+
var colorPickerButtonWrapper = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n position: relative;\n"])));
|
|
29
|
+
var colorPickerExpandContainer = (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n margin: 0px ", ";\n"])), "var(--ds-space-negative-050, -4px)");
|
|
30
|
+
|
|
31
|
+
// Control the size of color picker buttons and preview
|
|
32
|
+
// TODO: https://product-fabric.atlassian.net/browse/DSP-4134
|
|
33
|
+
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
34
|
+
var colorPickerWrapper = function colorPickerWrapper(theme) {
|
|
35
|
+
return (0, _react2.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n border-radius: ", "px;\n background-color: ", ";\n box-shadow: 0 4px 8px -2px ", ", 0 0 1px ", ";\n padding: ", " 0px;\n"])), (0, _constants.borderRadius)(), (0, _components.themed)({
|
|
36
|
+
light: "var(--ds-surface-overlay, ".concat(_colors.N0, ")"),
|
|
37
|
+
dark: "var(--ds-surface-overlay, ".concat(_colors.DN50, ")")
|
|
38
|
+
})(theme), _colors.N60A, _colors.N60A, "var(--ds-space-100, 8px)");
|
|
39
|
+
};
|
|
40
|
+
/* eslint-enable @atlaskit/design-system/ensure-design-token-usage */
|
|
41
|
+
|
|
42
|
+
var ColorPaletteWithListeners = (0, _withOuterListeners.default)(_uiColor.ColorPalette);
|
|
43
|
+
var ColorPickerButton = function ColorPickerButton(props) {
|
|
44
|
+
var buttonRef = _react.default.useRef(null);
|
|
45
|
+
var _React$useState = _react.default.useState(false),
|
|
46
|
+
_React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2),
|
|
47
|
+
isPopupOpen = _React$useState2[0],
|
|
48
|
+
setIsPopupOpen = _React$useState2[1];
|
|
49
|
+
var _React$useState3 = _react.default.useState(false),
|
|
50
|
+
_React$useState4 = (0, _slicedToArray2.default)(_React$useState3, 2),
|
|
51
|
+
isPopupPositioned = _React$useState4[0],
|
|
52
|
+
setIsPopupPositioned = _React$useState4[1];
|
|
53
|
+
var _React$useState5 = _react.default.useState(false),
|
|
54
|
+
_React$useState6 = (0, _slicedToArray2.default)(_React$useState5, 2),
|
|
55
|
+
isOpenedByKeyboard = _React$useState6[0],
|
|
56
|
+
setIsOpenedByKeyboard = _React$useState6[1];
|
|
57
|
+
var togglePopup = function togglePopup() {
|
|
58
|
+
setIsPopupOpen(!isPopupOpen);
|
|
59
|
+
if (!isPopupOpen) {
|
|
60
|
+
setIsOpenedByKeyboard(false);
|
|
61
|
+
setIsPopupPositioned(false);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
_react.default.useEffect(function () {
|
|
65
|
+
if (props.setDisableParentScroll) {
|
|
66
|
+
props.setDisableParentScroll(isPopupOpen);
|
|
67
|
+
}
|
|
68
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
69
|
+
}, [isPopupOpen]);
|
|
70
|
+
var focusButton = function focusButton() {
|
|
71
|
+
var _buttonRef$current;
|
|
72
|
+
(_buttonRef$current = buttonRef.current) === null || _buttonRef$current === void 0 ? void 0 : _buttonRef$current.focus();
|
|
73
|
+
};
|
|
74
|
+
var handleEsc = _react.default.useCallback(function () {
|
|
75
|
+
setIsOpenedByKeyboard(false);
|
|
76
|
+
setIsPopupPositioned(false);
|
|
77
|
+
setIsPopupOpen(false);
|
|
78
|
+
focusButton();
|
|
79
|
+
}, []);
|
|
80
|
+
var onPositionCalculated = _react.default.useCallback(function (position) {
|
|
81
|
+
setIsPopupPositioned(true);
|
|
82
|
+
return position;
|
|
83
|
+
}, []);
|
|
84
|
+
var onChange = props.onChange,
|
|
85
|
+
createAnalyticsEvent = props.createAnalyticsEvent,
|
|
86
|
+
colorPalette = props.colorPalette,
|
|
87
|
+
placement = props.placement,
|
|
88
|
+
skipFocusButtonAfterPick = props.skipFocusButtonAfterPick;
|
|
89
|
+
var onColorSelected = _react.default.useCallback(function (color, label) {
|
|
90
|
+
setIsOpenedByKeyboard(false);
|
|
91
|
+
setIsPopupOpen(false);
|
|
92
|
+
setIsPopupPositioned(false);
|
|
93
|
+
if (onChange) {
|
|
94
|
+
if (createAnalyticsEvent) {
|
|
95
|
+
// fire analytics
|
|
96
|
+
var payload = {
|
|
97
|
+
action: _analytics.ACTION.UPDATED,
|
|
98
|
+
actionSubject: _analytics.ACTION_SUBJECT.PICKER,
|
|
99
|
+
actionSubjectId: _analytics.ACTION_SUBJECT_ID.PICKER_COLOR,
|
|
100
|
+
attributes: {
|
|
101
|
+
color: color,
|
|
102
|
+
label: label,
|
|
103
|
+
placement: placement
|
|
104
|
+
},
|
|
105
|
+
eventType: _analytics.EVENT_TYPE.TRACK
|
|
106
|
+
};
|
|
107
|
+
createAnalyticsEvent(payload).fire(_analytics.editorAnalyticsChannel);
|
|
108
|
+
}
|
|
109
|
+
var newPalette = colorPalette.find(function (colorPalette) {
|
|
110
|
+
return colorPalette.value === color;
|
|
111
|
+
});
|
|
112
|
+
newPalette && onChange(newPalette);
|
|
113
|
+
}
|
|
114
|
+
if (!skipFocusButtonAfterPick) {
|
|
115
|
+
focusButton();
|
|
116
|
+
}
|
|
117
|
+
}, [colorPalette, onChange, createAnalyticsEvent, placement, skipFocusButtonAfterPick]);
|
|
118
|
+
var renderPopup = function renderPopup() {
|
|
119
|
+
if (!isPopupOpen || !buttonRef.current) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
var selectedColor = props.currentColor || null;
|
|
123
|
+
var _getSelectedRowAndCol = (0, _uiColor.getSelectedRowAndColumnFromPalette)(props.colorPalette, selectedColor, props.cols),
|
|
124
|
+
selectedRowIndex = _getSelectedRowAndCol.selectedRowIndex,
|
|
125
|
+
selectedColumnIndex = _getSelectedRowAndCol.selectedColumnIndex;
|
|
126
|
+
return (0, _react2.jsx)(_Popup.default, {
|
|
127
|
+
target: buttonRef.current,
|
|
128
|
+
fitHeight: 350,
|
|
129
|
+
fitWidth: 350,
|
|
130
|
+
offset: [0, 10],
|
|
131
|
+
alignX: props.alignX,
|
|
132
|
+
mountTo: props.setDisableParentScroll ? props.mountPoint : undefined
|
|
133
|
+
// Confluence inline comment editor has z-index: 500
|
|
134
|
+
// if the toolbar is scrollable, this will be mounted in the root editor
|
|
135
|
+
// we need an index of > 500 to display over it
|
|
136
|
+
,
|
|
137
|
+
zIndex: props.setDisableParentScroll ? 600 : undefined,
|
|
138
|
+
ariaLabel: "Color picker popup",
|
|
139
|
+
onPositionCalculated: onPositionCalculated
|
|
140
|
+
}, (0, _react2.jsx)("div", {
|
|
141
|
+
css: colorPickerWrapper,
|
|
142
|
+
"data-test-id": "color-picker-menu"
|
|
143
|
+
}, (0, _react2.jsx)(_ArrowKeyNavigationProvider.ArrowKeyNavigationProvider, {
|
|
144
|
+
type: _types.ArrowKeyNavigationType.COLOR,
|
|
145
|
+
selectedRowIndex: selectedRowIndex,
|
|
146
|
+
selectedColumnIndex: selectedColumnIndex,
|
|
147
|
+
closeOnTab: true,
|
|
148
|
+
handleClose: function handleClose() {
|
|
149
|
+
return setIsPopupOpen(false);
|
|
150
|
+
},
|
|
151
|
+
isOpenedByKeyboard: isOpenedByKeyboard,
|
|
152
|
+
isPopupPositioned: isPopupPositioned
|
|
153
|
+
}, (0, _react2.jsx)(ColorPaletteWithListeners, {
|
|
154
|
+
cols: props.cols,
|
|
155
|
+
selectedColor: selectedColor,
|
|
156
|
+
onClick: onColorSelected,
|
|
157
|
+
handleClickOutside: togglePopup,
|
|
158
|
+
handleEscapeKeydown: handleEsc,
|
|
159
|
+
paletteOptions: {
|
|
160
|
+
palette: props.colorPalette,
|
|
161
|
+
hexToPaletteColor: props.hexToPaletteColor,
|
|
162
|
+
paletteColorTooltipMessages: props.paletteColorTooltipMessages
|
|
163
|
+
}
|
|
164
|
+
}))));
|
|
165
|
+
};
|
|
166
|
+
var title = props.title || '';
|
|
167
|
+
var currentColor = props.currentColor && props.hexToPaletteColor ? props.hexToPaletteColor(props.currentColor) : props.currentColor;
|
|
168
|
+
var buttonStyle = function buttonStyle(theme) {
|
|
169
|
+
var _props$size, _props$size2, _props$size3;
|
|
170
|
+
return (0, _react2.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n padding: 0 10px;\n background-color: ", ";\n ", "\n &:before {\n display: flex;\n justify-content: center;\n align-items: center;\n align-self: center;\n content: '';\n border: 1px solid ", ";\n border-radius: ", "px;\n background-color: ", ";\n width: ", ";\n height: ", ";\n padding: 0;\n margin: 0px ", ";\n }\n &:hover {\n background: ", ";\n }\n "])), "var(--ds-background-neutral-subtle, transparent)", /* If custom props size height, override the button base height property */
|
|
171
|
+
!!((_props$size = props.size) !== null && _props$size !== void 0 && _props$size.height) && "height: inherit;", _uiColor.DEFAULT_BORDER_COLOR, (0, _constants.borderRadius)(), currentColor || 'transparent', ((_props$size2 = props.size) === null || _props$size2 === void 0 ? void 0 : _props$size2.width) || '14px', ((_props$size3 = props.size) === null || _props$size3 === void 0 ? void 0 : _props$size3.height) || '14px', "var(--ds-space-025, 2px)", (0, _components.themed)({
|
|
172
|
+
light: "var(--ds-background-neutral-subtle-hovered, ".concat(_colors.N30A, ")"),
|
|
173
|
+
dark: "var(--ds-background-neutral-subtle-hovered, ".concat(_colors.N30A, ")")
|
|
174
|
+
})(theme));
|
|
175
|
+
};
|
|
176
|
+
return (0, _react2.jsx)("div", {
|
|
177
|
+
css: colorPickerButtonWrapper
|
|
178
|
+
}, (0, _react2.jsx)(_tooltip.default, {
|
|
179
|
+
content: title,
|
|
180
|
+
position: "top"
|
|
181
|
+
}, (0, _react2.jsx)(_button.default, {
|
|
182
|
+
ref: buttonRef,
|
|
183
|
+
"aria-label": title,
|
|
184
|
+
spacing: "compact",
|
|
185
|
+
onClick: togglePopup,
|
|
186
|
+
onKeyDown: function onKeyDown(event) {
|
|
187
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
188
|
+
event.preventDefault();
|
|
189
|
+
togglePopup();
|
|
190
|
+
setIsOpenedByKeyboard(true);
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
css: buttonStyle,
|
|
194
|
+
iconAfter: (0, _react2.jsx)("span", {
|
|
195
|
+
css: colorPickerExpandContainer
|
|
196
|
+
}, (0, _react2.jsx)(_chevronDown.default, {
|
|
197
|
+
label: ""
|
|
198
|
+
}))
|
|
199
|
+
})), renderPopup());
|
|
200
|
+
};
|
|
201
|
+
var _default = (0, _analyticsNext.withAnalyticsContext)({
|
|
202
|
+
source: 'ConfigPanel'
|
|
203
|
+
})((0, _analyticsNext.withAnalyticsEvents)()(ColorPickerButton));
|
|
204
|
+
exports.default = _default;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.DropdownContainer = void 0;
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _objectDestructuringEmpty2 = _interopRequireDefault(require("@babel/runtime/helpers/objectDestructuringEmpty"));
|
|
11
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
12
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
+
var _react2 = require("@emotion/react");
|
|
14
|
+
var _Dropdown = _interopRequireDefault(require("../Dropdown"));
|
|
15
|
+
var _ToolbarArrowKeyNavigationProvider = require("../ToolbarArrowKeyNavigationProvider");
|
|
16
|
+
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); }
|
|
17
|
+
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; }
|
|
18
|
+
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; }
|
|
19
|
+
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; } /** @jsx jsx */
|
|
20
|
+
var DropdownContainer = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
21
|
+
var props = (0, _extends2.default)({}, ((0, _objectDestructuringEmpty2.default)(_ref), _ref));
|
|
22
|
+
var keyDownHandlerContext = (0, _react.useContext)(_ToolbarArrowKeyNavigationProvider.KeyDownHandlerContext);
|
|
23
|
+
return (
|
|
24
|
+
//This context is to handle the tab, Arrow Right/Left key events for dropdown.
|
|
25
|
+
//Default context has the void callbacks for above key events
|
|
26
|
+
(0, _react2.jsx)(_Dropdown.default, (0, _extends2.default)({
|
|
27
|
+
arrowKeyNavigationProviderOptions: _objectSpread(_objectSpread({}, props.arrowKeyNavigationProviderOptions), {}, {
|
|
28
|
+
keyDownHandlerContext: keyDownHandlerContext
|
|
29
|
+
})
|
|
30
|
+
}, props))
|
|
31
|
+
);
|
|
32
|
+
});
|
|
33
|
+
exports.DropdownContainer = DropdownContainer;
|
|
@@ -23,12 +23,24 @@ Object.defineProperty(exports, "ColorPaletteArrowKeyNavigationProvider", {
|
|
|
23
23
|
return _ColorPaletteArrowKeyNavigationProvider.ColorPaletteArrowKeyNavigationProvider;
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
|
+
Object.defineProperty(exports, "ColorPickerButton", {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function get() {
|
|
29
|
+
return _ColorPickerButton.default;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
26
32
|
Object.defineProperty(exports, "Dropdown", {
|
|
27
33
|
enumerable: true,
|
|
28
34
|
get: function get() {
|
|
29
35
|
return _Dropdown.default;
|
|
30
36
|
}
|
|
31
37
|
});
|
|
38
|
+
Object.defineProperty(exports, "DropdownContainer", {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: function get() {
|
|
41
|
+
return _DropdownContainer.DropdownContainer;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
32
44
|
Object.defineProperty(exports, "DropdownMenu", {
|
|
33
45
|
enumerable: true,
|
|
34
46
|
get: function get() {
|
|
@@ -72,5 +84,7 @@ var _ToolbarArrowKeyNavigationProvider = require("./ToolbarArrowKeyNavigationPro
|
|
|
72
84
|
var _types = require("./ArrowKeyNavigationProvider/types");
|
|
73
85
|
var _ColorPaletteArrowKeyNavigationProvider = require("./ArrowKeyNavigationProvider/ColorPaletteArrowKeyNavigationProvider");
|
|
74
86
|
var _Dropdown = _interopRequireDefault(require("./Dropdown"));
|
|
87
|
+
var _ColorPickerButton = _interopRequireDefault(require("./ColorPickerButton"));
|
|
88
|
+
var _DropdownContainer = require("./DropdownContainer");
|
|
75
89
|
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); }
|
|
76
90
|
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; }
|
package/dist/cjs/utils/index.js
CHANGED
|
@@ -792,6 +792,12 @@ Object.defineProperty(exports, "measureTTI", {
|
|
|
792
792
|
return _measureTti.measureTTI;
|
|
793
793
|
}
|
|
794
794
|
});
|
|
795
|
+
Object.defineProperty(exports, "nodeToJSON", {
|
|
796
|
+
enumerable: true,
|
|
797
|
+
get: function get() {
|
|
798
|
+
return _nodes.nodeToJSON;
|
|
799
|
+
}
|
|
800
|
+
});
|
|
795
801
|
Object.defineProperty(exports, "nodesBetweenChanged", {
|
|
796
802
|
enumerable: true,
|
|
797
803
|
get: function get() {
|
|
@@ -950,6 +956,12 @@ Object.defineProperty(exports, "timestampToUTCDate", {
|
|
|
950
956
|
return _date.timestampToUTCDate;
|
|
951
957
|
}
|
|
952
958
|
});
|
|
959
|
+
Object.defineProperty(exports, "toJSON", {
|
|
960
|
+
enumerable: true,
|
|
961
|
+
get: function get() {
|
|
962
|
+
return _nodes.toJSON;
|
|
963
|
+
}
|
|
964
|
+
});
|
|
953
965
|
Object.defineProperty(exports, "todayTimestampInUTC", {
|
|
954
966
|
enumerable: true,
|
|
955
967
|
get: function get() {
|
package/dist/cjs/utils/nodes.js
CHANGED
|
@@ -3,7 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.isType = exports.isText = exports.isSupportedInParent = exports.isParagraph = exports.isNodeSelectedOrInRange = exports.isNodeBeforeMediaNode = exports.isMediaNode = exports.isLinkMark = exports.findChangedNodesFromTransaction = exports.SelectedState = void 0;
|
|
7
|
+
exports.nodeToJSON = nodeToJSON;
|
|
8
|
+
exports.toJSON = toJSON;
|
|
9
|
+
exports.validateNodes = exports.validNode = void 0;
|
|
10
|
+
var _editorJsonTransformer = require("@atlaskit/editor-json-transformer");
|
|
7
11
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
8
12
|
/**
|
|
9
13
|
* Finds all top level nodes affected by the transaction
|
|
@@ -144,4 +148,11 @@ var isNodeBeforeMediaNode = function isNodeBeforeMediaNode($pos, state) {
|
|
|
144
148
|
}
|
|
145
149
|
return false;
|
|
146
150
|
};
|
|
147
|
-
exports.isNodeBeforeMediaNode = isNodeBeforeMediaNode;
|
|
151
|
+
exports.isNodeBeforeMediaNode = isNodeBeforeMediaNode;
|
|
152
|
+
var transformer = new _editorJsonTransformer.JSONTransformer();
|
|
153
|
+
function toJSON(node) {
|
|
154
|
+
return transformer.encode(node);
|
|
155
|
+
}
|
|
156
|
+
function nodeToJSON(node) {
|
|
157
|
+
return transformer.encodeNode(node);
|
|
158
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FabricChannel } from '@atlaskit/analytics-listeners';
|
|
2
2
|
import { AnalyticsQueue } from './analytics-queue';
|
|
3
|
-
const editorAnalyticsChannel = FabricChannel.editor;
|
|
3
|
+
export const editorAnalyticsChannel = FabricChannel.editor;
|
|
4
4
|
export const fireAnalyticsEvent = createAnalyticsEvent => ({
|
|
5
5
|
payload,
|
|
6
6
|
channel = editorAnalyticsChannel
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, BROWSER_FREEZE_INTERACTION_TYPE, CONTENT_COMPONENT, DELETE_DIRECTION, EVENT_TYPE, FLOATING_CONTROLS_TITLE, FULL_WIDTH_MODE, GAP_CURSOR_POSITION, INDENT_DIRECTION, INDENT_TYPE, INPUT_METHOD, LAYOUT_TYPE, LINK_REPRESENTATION, LINK_RESOURCE, LINK_STATUS, LIST_TEXT_SCENARIOS, JOIN_SCENARIOS_WHEN_TYPING_TO_INSERT_LIST, OUTDENT_SCENARIOS, MODE, PLATFORMS, PUNC, PasteContents, PasteSources, PasteTypes, RESOLVE_METHOD, SELECTION_TYPE, SELECTION_POSITION, SMART_LINK_TYPE, SYMBOL, SmartLinkNodeContexts, TABLE_ACTION, TABLE_BREAKOUT, TABLE_OVERFLOW_CHANGE_TRIGGER, TARGET_SELECTION_SOURCE, TOOLBAR_ACTION_SUBJECT_ID, TRIGGER_METHOD, USER_CONTEXT } from './types';
|
|
2
|
-
export { fireAnalyticsEvent } from './fire-analytics-event';
|
|
2
|
+
export { editorAnalyticsChannel, fireAnalyticsEvent } from './fire-analytics-event';
|
|
3
3
|
export { getAnalyticsEventsFromTransaction } from './utils';
|
|
4
4
|
export { buildEditLinkPayload, buildVisitedLinkPayload, buildOpenedSettingsPayload, unlinkPayload } from './linking-utils';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
2
2
|
const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
3
|
-
const packageVersion = "75.
|
|
3
|
+
const packageVersion = "75.6.0";
|
|
4
4
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
5
5
|
// Remove URL as it has UGC
|
|
6
6
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -9,7 +9,7 @@ import { themed } from '@atlaskit/theme/components';
|
|
|
9
9
|
import { borderRadius } from '@atlaskit/theme/constants';
|
|
10
10
|
import Layer from '../Layer';
|
|
11
11
|
const packageName = "@atlaskit/editor-common";
|
|
12
|
-
const packageVersion = "75.
|
|
12
|
+
const packageVersion = "75.6.0";
|
|
13
13
|
const halfFocusRing = 1;
|
|
14
14
|
const dropOffset = '0, 8';
|
|
15
15
|
class DropList extends Component {
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { css, jsx } from '@emotion/react';
|
|
4
|
+
import { withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
5
|
+
import Button from '@atlaskit/button';
|
|
6
|
+
import ExpandIcon from '@atlaskit/icon/glyph/chevron-down';
|
|
7
|
+
import { DN50, N0, N30A, N60A } from '@atlaskit/theme/colors';
|
|
8
|
+
import { themed } from '@atlaskit/theme/components';
|
|
9
|
+
import { borderRadius } from '@atlaskit/theme/constants';
|
|
10
|
+
import Tooltip from '@atlaskit/tooltip';
|
|
11
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, editorAnalyticsChannel, EVENT_TYPE } from '../../analytics';
|
|
12
|
+
import { ColorPalette, DEFAULT_BORDER_COLOR, getSelectedRowAndColumnFromPalette } from '../../ui-color';
|
|
13
|
+
import { default as Popup } from '../../ui/Popup';
|
|
14
|
+
import { default as withOuterListeners } from '../../ui/with-outer-listeners';
|
|
15
|
+
import { ArrowKeyNavigationProvider } from '../ArrowKeyNavigationProvider';
|
|
16
|
+
import { ArrowKeyNavigationType } from '../ArrowKeyNavigationProvider/types';
|
|
17
|
+
|
|
18
|
+
// helps adjusts position of popup
|
|
19
|
+
const colorPickerButtonWrapper = css`
|
|
20
|
+
position: relative;
|
|
21
|
+
`;
|
|
22
|
+
const colorPickerExpandContainer = css`
|
|
23
|
+
margin: 0px ${"var(--ds-space-negative-050, -4px)"};
|
|
24
|
+
`;
|
|
25
|
+
|
|
26
|
+
// Control the size of color picker buttons and preview
|
|
27
|
+
// TODO: https://product-fabric.atlassian.net/browse/DSP-4134
|
|
28
|
+
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
29
|
+
const colorPickerWrapper = theme => css`
|
|
30
|
+
border-radius: ${borderRadius()}px;
|
|
31
|
+
background-color: ${themed({
|
|
32
|
+
light: `var(--ds-surface-overlay, ${N0})`,
|
|
33
|
+
dark: `var(--ds-surface-overlay, ${DN50})`
|
|
34
|
+
})(theme)};
|
|
35
|
+
box-shadow: 0 4px 8px -2px ${N60A}, 0 0 1px ${N60A};
|
|
36
|
+
padding: ${"var(--ds-space-100, 8px)"} 0px;
|
|
37
|
+
`;
|
|
38
|
+
/* eslint-enable @atlaskit/design-system/ensure-design-token-usage */
|
|
39
|
+
|
|
40
|
+
const ColorPaletteWithListeners = withOuterListeners(ColorPalette);
|
|
41
|
+
const ColorPickerButton = props => {
|
|
42
|
+
const buttonRef = React.useRef(null);
|
|
43
|
+
const [isPopupOpen, setIsPopupOpen] = React.useState(false);
|
|
44
|
+
const [isPopupPositioned, setIsPopupPositioned] = React.useState(false);
|
|
45
|
+
const [isOpenedByKeyboard, setIsOpenedByKeyboard] = React.useState(false);
|
|
46
|
+
const togglePopup = () => {
|
|
47
|
+
setIsPopupOpen(!isPopupOpen);
|
|
48
|
+
if (!isPopupOpen) {
|
|
49
|
+
setIsOpenedByKeyboard(false);
|
|
50
|
+
setIsPopupPositioned(false);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
React.useEffect(() => {
|
|
54
|
+
if (props.setDisableParentScroll) {
|
|
55
|
+
props.setDisableParentScroll(isPopupOpen);
|
|
56
|
+
}
|
|
57
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
58
|
+
}, [isPopupOpen]);
|
|
59
|
+
const focusButton = () => {
|
|
60
|
+
var _buttonRef$current;
|
|
61
|
+
(_buttonRef$current = buttonRef.current) === null || _buttonRef$current === void 0 ? void 0 : _buttonRef$current.focus();
|
|
62
|
+
};
|
|
63
|
+
const handleEsc = React.useCallback(() => {
|
|
64
|
+
setIsOpenedByKeyboard(false);
|
|
65
|
+
setIsPopupPositioned(false);
|
|
66
|
+
setIsPopupOpen(false);
|
|
67
|
+
focusButton();
|
|
68
|
+
}, []);
|
|
69
|
+
const onPositionCalculated = React.useCallback(position => {
|
|
70
|
+
setIsPopupPositioned(true);
|
|
71
|
+
return position;
|
|
72
|
+
}, []);
|
|
73
|
+
const {
|
|
74
|
+
onChange,
|
|
75
|
+
createAnalyticsEvent,
|
|
76
|
+
colorPalette,
|
|
77
|
+
placement,
|
|
78
|
+
skipFocusButtonAfterPick
|
|
79
|
+
} = props;
|
|
80
|
+
const onColorSelected = React.useCallback((color, label) => {
|
|
81
|
+
setIsOpenedByKeyboard(false);
|
|
82
|
+
setIsPopupOpen(false);
|
|
83
|
+
setIsPopupPositioned(false);
|
|
84
|
+
if (onChange) {
|
|
85
|
+
if (createAnalyticsEvent) {
|
|
86
|
+
// fire analytics
|
|
87
|
+
const payload = {
|
|
88
|
+
action: ACTION.UPDATED,
|
|
89
|
+
actionSubject: ACTION_SUBJECT.PICKER,
|
|
90
|
+
actionSubjectId: ACTION_SUBJECT_ID.PICKER_COLOR,
|
|
91
|
+
attributes: {
|
|
92
|
+
color,
|
|
93
|
+
label,
|
|
94
|
+
placement: placement
|
|
95
|
+
},
|
|
96
|
+
eventType: EVENT_TYPE.TRACK
|
|
97
|
+
};
|
|
98
|
+
createAnalyticsEvent(payload).fire(editorAnalyticsChannel);
|
|
99
|
+
}
|
|
100
|
+
const newPalette = colorPalette.find(colorPalette => colorPalette.value === color);
|
|
101
|
+
newPalette && onChange(newPalette);
|
|
102
|
+
}
|
|
103
|
+
if (!skipFocusButtonAfterPick) {
|
|
104
|
+
focusButton();
|
|
105
|
+
}
|
|
106
|
+
}, [colorPalette, onChange, createAnalyticsEvent, placement, skipFocusButtonAfterPick]);
|
|
107
|
+
const renderPopup = () => {
|
|
108
|
+
if (!isPopupOpen || !buttonRef.current) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
const selectedColor = props.currentColor || null;
|
|
112
|
+
const {
|
|
113
|
+
selectedRowIndex,
|
|
114
|
+
selectedColumnIndex
|
|
115
|
+
} = getSelectedRowAndColumnFromPalette(props.colorPalette, selectedColor, props.cols);
|
|
116
|
+
return jsx(Popup, {
|
|
117
|
+
target: buttonRef.current,
|
|
118
|
+
fitHeight: 350,
|
|
119
|
+
fitWidth: 350,
|
|
120
|
+
offset: [0, 10],
|
|
121
|
+
alignX: props.alignX,
|
|
122
|
+
mountTo: props.setDisableParentScroll ? props.mountPoint : undefined
|
|
123
|
+
// Confluence inline comment editor has z-index: 500
|
|
124
|
+
// if the toolbar is scrollable, this will be mounted in the root editor
|
|
125
|
+
// we need an index of > 500 to display over it
|
|
126
|
+
,
|
|
127
|
+
zIndex: props.setDisableParentScroll ? 600 : undefined,
|
|
128
|
+
ariaLabel: "Color picker popup",
|
|
129
|
+
onPositionCalculated: onPositionCalculated
|
|
130
|
+
}, jsx("div", {
|
|
131
|
+
css: colorPickerWrapper,
|
|
132
|
+
"data-test-id": "color-picker-menu"
|
|
133
|
+
}, jsx(ArrowKeyNavigationProvider, {
|
|
134
|
+
type: ArrowKeyNavigationType.COLOR,
|
|
135
|
+
selectedRowIndex: selectedRowIndex,
|
|
136
|
+
selectedColumnIndex: selectedColumnIndex,
|
|
137
|
+
closeOnTab: true,
|
|
138
|
+
handleClose: () => setIsPopupOpen(false),
|
|
139
|
+
isOpenedByKeyboard: isOpenedByKeyboard,
|
|
140
|
+
isPopupPositioned: isPopupPositioned
|
|
141
|
+
}, jsx(ColorPaletteWithListeners, {
|
|
142
|
+
cols: props.cols,
|
|
143
|
+
selectedColor: selectedColor,
|
|
144
|
+
onClick: onColorSelected,
|
|
145
|
+
handleClickOutside: togglePopup,
|
|
146
|
+
handleEscapeKeydown: handleEsc,
|
|
147
|
+
paletteOptions: {
|
|
148
|
+
palette: props.colorPalette,
|
|
149
|
+
hexToPaletteColor: props.hexToPaletteColor,
|
|
150
|
+
paletteColorTooltipMessages: props.paletteColorTooltipMessages
|
|
151
|
+
}
|
|
152
|
+
}))));
|
|
153
|
+
};
|
|
154
|
+
const title = props.title || '';
|
|
155
|
+
const currentColor = props.currentColor && props.hexToPaletteColor ? props.hexToPaletteColor(props.currentColor) : props.currentColor;
|
|
156
|
+
const buttonStyle = theme => {
|
|
157
|
+
var _props$size, _props$size2, _props$size3;
|
|
158
|
+
return css`
|
|
159
|
+
padding: 0 10px;
|
|
160
|
+
background-color: ${"var(--ds-background-neutral-subtle, transparent)"};
|
|
161
|
+
${
|
|
162
|
+
/* If custom props size height, override the button base height property */!!((_props$size = props.size) !== null && _props$size !== void 0 && _props$size.height) && `height: inherit;`}
|
|
163
|
+
&:before {
|
|
164
|
+
display: flex;
|
|
165
|
+
justify-content: center;
|
|
166
|
+
align-items: center;
|
|
167
|
+
align-self: center;
|
|
168
|
+
content: '';
|
|
169
|
+
border: 1px solid ${DEFAULT_BORDER_COLOR};
|
|
170
|
+
border-radius: ${borderRadius()}px;
|
|
171
|
+
background-color: ${currentColor || 'transparent'};
|
|
172
|
+
width: ${((_props$size2 = props.size) === null || _props$size2 === void 0 ? void 0 : _props$size2.width) || '14px'};
|
|
173
|
+
height: ${((_props$size3 = props.size) === null || _props$size3 === void 0 ? void 0 : _props$size3.height) || '14px'};
|
|
174
|
+
padding: 0;
|
|
175
|
+
margin: 0px ${"var(--ds-space-025, 2px)"};
|
|
176
|
+
}
|
|
177
|
+
&:hover {
|
|
178
|
+
background: ${themed({
|
|
179
|
+
light: `var(--ds-background-neutral-subtle-hovered, ${N30A})`,
|
|
180
|
+
dark: `var(--ds-background-neutral-subtle-hovered, ${N30A})`
|
|
181
|
+
})(theme)};
|
|
182
|
+
}
|
|
183
|
+
`;
|
|
184
|
+
};
|
|
185
|
+
return jsx("div", {
|
|
186
|
+
css: colorPickerButtonWrapper
|
|
187
|
+
}, jsx(Tooltip, {
|
|
188
|
+
content: title,
|
|
189
|
+
position: "top"
|
|
190
|
+
}, jsx(Button, {
|
|
191
|
+
ref: buttonRef,
|
|
192
|
+
"aria-label": title,
|
|
193
|
+
spacing: "compact",
|
|
194
|
+
onClick: togglePopup,
|
|
195
|
+
onKeyDown: event => {
|
|
196
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
197
|
+
event.preventDefault();
|
|
198
|
+
togglePopup();
|
|
199
|
+
setIsOpenedByKeyboard(true);
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
css: buttonStyle,
|
|
203
|
+
iconAfter: jsx("span", {
|
|
204
|
+
css: colorPickerExpandContainer
|
|
205
|
+
}, jsx(ExpandIcon, {
|
|
206
|
+
label: ""
|
|
207
|
+
}))
|
|
208
|
+
})), renderPopup());
|
|
209
|
+
};
|
|
210
|
+
export default withAnalyticsContext({
|
|
211
|
+
source: 'ConfigPanel'
|
|
212
|
+
})(withAnalyticsEvents()(ColorPickerButton));
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
/** @jsx jsx */
|
|
3
|
+
import React, { useContext } from 'react';
|
|
4
|
+
import { jsx } from '@emotion/react';
|
|
5
|
+
import DropdownComponent from '../Dropdown';
|
|
6
|
+
import { KeyDownHandlerContext } from '../ToolbarArrowKeyNavigationProvider';
|
|
7
|
+
export const DropdownContainer = /*#__PURE__*/React.memo(({
|
|
8
|
+
...props
|
|
9
|
+
}) => {
|
|
10
|
+
const keyDownHandlerContext = useContext(KeyDownHandlerContext);
|
|
11
|
+
return (
|
|
12
|
+
//This context is to handle the tab, Arrow Right/Left key events for dropdown.
|
|
13
|
+
//Default context has the void callbacks for above key events
|
|
14
|
+
jsx(DropdownComponent, _extends({
|
|
15
|
+
arrowKeyNavigationProviderOptions: {
|
|
16
|
+
...props.arrowKeyNavigationProviderOptions,
|
|
17
|
+
keyDownHandlerContext
|
|
18
|
+
}
|
|
19
|
+
}, props))
|
|
20
|
+
);
|
|
21
|
+
});
|