@atlaskit/editor-common 114.23.0 → 114.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 114.24.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`a9b1b25b3ec98`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a9b1b25b3ec98) -
8
+ [ux] CTD-6569 add vertical resize for database native embed in pages
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies
13
+
3
14
  ## 114.23.0
4
15
 
5
16
  ### Minor Changes
@@ -19,7 +19,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
19
19
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
20
20
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
21
21
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
22
- var packageVersion = "114.22.1";
22
+ var packageVersion = "114.23.0";
23
23
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
24
24
  // Remove URL as it has UGC
25
25
  // Ignored via go/ees007
@@ -20,7 +20,7 @@ var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
20
20
  var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
21
21
  var _breakout = require("../messages/breakout");
22
22
  var _resizer = require("../styles/shared/resizer");
23
- var _excluded = ["width", "children", "handleClassName", "className", "handleResize", "handleResizeStart", "handleResizeStop", "handleSize", "handleAlignmentMethod", "handlePositioning", "appearance", "handleStyles", "resizeRatio", "snap", "snapGap", "isHandleVisible", "handleHighlight", "handleTooltipContent", "needExtendedResizeZone", "childrenDOMRef", "labelComponent"]; // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
23
+ var _excluded = ["width", "height", "children", "handleClassName", "className", "handleResize", "handleResizeStart", "handleResizeStop", "handleSize", "handleAlignmentMethod", "handlePositioning", "appearance", "handleStyles", "resizeRatio", "snap", "snapGap", "isHandleVisible", "handleHighlight", "handleTooltipContent", "needExtendedResizeZone", "childrenDOMRef", "labelComponent"]; // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
24
24
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
25
25
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
26
26
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -36,6 +36,7 @@ var resizerLabelStyles = (0, _primitives.xcss)({
36
36
  zIndex: 'layer' // 400 same z-index as the floating toolbar
37
37
  });
38
38
  var SUPPORTED_HANDLES = ['left', 'right'];
39
+ var SUPPORTED_HANDLES_FOR_VERTICAL_RESIZE = ['left', 'right', 'bottom'];
39
40
  var inheritedCSS = {
40
41
  position: 'inherit',
41
42
  height: 'inherit',
@@ -60,6 +61,7 @@ var ResizerNext = function ResizerNext(props, ref) {
60
61
  };
61
62
  }, [resizeHandleThumbRef]);
62
63
  var width = props.width,
64
+ height = props.height,
63
65
  children = props.children,
64
66
  handleClassName = props.handleClassName,
65
67
  className = props.className,
@@ -88,13 +90,14 @@ var ResizerNext = function ResizerNext(props, ref) {
88
90
  childrenDOMRef = props.childrenDOMRef,
89
91
  labelComponent = props.labelComponent,
90
92
  otherProps = (0, _objectWithoutProperties2.default)(props, _excluded);
93
+ var supportedHandles = (0, _expValEquals.expValEquals)('databases-native-embeds-v2', 'isEnabled', true) ? SUPPORTED_HANDLES_FOR_VERTICAL_RESIZE : SUPPORTED_HANDLES;
91
94
  var onResizeStart = (0, _react.useCallback)(function (event) {
92
95
  // prevent creating a drag event on Firefox
93
96
  event.preventDefault();
94
97
  setIsResizing(true);
95
98
  handleResizeStart();
96
99
  }, [handleResizeStart]);
97
- var onResize = (0, _react.useCallback)(function (_event, _direction, _elementRef, delta) {
100
+ var onResize = (0, _react.useCallback)(function (_event, direction, _elementRef, delta) {
98
101
  if (!handleResize) {
99
102
  return;
100
103
  }
@@ -108,9 +111,13 @@ var ResizerNext = function ResizerNext(props, ref) {
108
111
  width: resizableCurrent.state.original.width,
109
112
  height: resizableCurrent.state.original.height
110
113
  };
111
- handleResize(originalState, delta);
114
+ if ((0, _expValEquals.expValEquals)('databases-native-embeds-v2', 'isEnabled', true)) {
115
+ handleResize(originalState, delta, direction);
116
+ } else {
117
+ handleResize(originalState, delta);
118
+ }
112
119
  }, [handleResize]);
113
- var onResizeStop = (0, _react.useCallback)(function (_event, _direction, _elementRef, delta) {
120
+ var onResizeStop = (0, _react.useCallback)(function (_event, direction, _elementRef, delta) {
114
121
  var resizableCurrent = resizable.current;
115
122
  if (!resizableCurrent || !resizableCurrent.state.original) {
116
123
  return;
@@ -122,20 +129,31 @@ var ResizerNext = function ResizerNext(props, ref) {
122
129
  height: resizableCurrent.state.original.height
123
130
  };
124
131
  setIsResizing(false);
125
- handleResizeStop(originalState, delta);
132
+ if ((0, _expValEquals.expValEquals)('databases-native-embeds-v2', 'isEnabled', true)) {
133
+ handleResizeStop(originalState, delta, direction);
134
+ } else {
135
+ handleResizeStop(originalState, delta);
136
+ }
126
137
  }, [handleResizeStop]);
127
- var handles = {
128
- left: (0, _classnames3.default)(handleClassName !== null && handleClassName !== void 0 ? handleClassName : _resizer.resizerHandleClassName, 'left', handleSize, handleAlignmentMethod),
129
- right: (0, _classnames3.default)(handleClassName !== null && handleClassName !== void 0 ? handleClassName : _resizer.resizerHandleClassName, 'right', handleSize, handleAlignmentMethod)
130
- };
138
+ var handles = (0, _react.useMemo)(function () {
139
+ return supportedHandles.reduce(function (result, position) {
140
+ return _objectSpread(_objectSpread({}, result), {}, (0, _defineProperty2.default)({}, position, (0, _classnames3.default)(handleClassName !== null && handleClassName !== void 0 ? handleClassName : _resizer.resizerHandleClassName, position, handleSize, position === 'bottom' && (0, _expValEquals.expValEquals)('databases-native-embeds-v2', 'isEnabled', true) ? undefined : handleAlignmentMethod)));
141
+ }, {});
142
+ }, [handleClassName, handleSize, handleAlignmentMethod, supportedHandles]);
131
143
  var handleWidth = handlePositioning === 'adjacent' ? "var(--ds-space-100, 8px)" : "var(--ds-space-300, 24px)";
132
- var baseHandleStyles = {
144
+ var baseHorizontalHandleStyles = {
133
145
  width: handleWidth,
134
146
  zIndex: _resizer.resizerHandleZIndex,
135
147
  pointerEvents: 'auto',
136
148
  alignItems: handlePositioning === 'adjacent' ? 'center' : undefined
137
149
  };
138
- var memoizedBaseHandleStyles = (0, _react.useMemo)(function () {
150
+ var baseBottomHandleStyles = {
151
+ height: handleWidth,
152
+ zIndex: _resizer.resizerHandleZIndex,
153
+ pointerEvents: 'auto',
154
+ justifyContent: handlePositioning === 'adjacent' ? 'center' : undefined
155
+ };
156
+ var memoizedBaseHorizontalHandleStyles = (0, _react.useMemo)(function () {
139
157
  return {
140
158
  width: handleWidth,
141
159
  zIndex: _resizer.resizerHandleZIndex,
@@ -143,16 +161,24 @@ var ResizerNext = function ResizerNext(props, ref) {
143
161
  alignItems: handlePositioning === 'adjacent' ? 'center' : undefined
144
162
  };
145
163
  }, [handleWidth, handlePositioning]);
164
+ var memoizedBaseBottomHandleStyles = (0, _react.useMemo)(function () {
165
+ return {
166
+ height: handleWidth,
167
+ zIndex: _resizer.resizerHandleZIndex,
168
+ pointerEvents: 'auto',
169
+ justifyContent: handlePositioning === 'adjacent' ? 'center' : undefined
170
+ };
171
+ }, [handleWidth, handlePositioning]);
146
172
  var offset = handlePositioning === 'adjacent' ? "calc(".concat(handleWidth, " * -1)") : "calc(".concat(handleWidth, " * -0.5)");
147
173
  var memoizedNextHandleStyles = (0, _react.useMemo)(function () {
148
- return SUPPORTED_HANDLES.reduce(function (result, position) {
149
- return _objectSpread(_objectSpread({}, result), {}, (0, _defineProperty2.default)({}, position, _objectSpread(_objectSpread({}, memoizedBaseHandleStyles), {}, (0, _defineProperty2.default)({}, position, offset), handleStyles === null || handleStyles === void 0 ? void 0 : handleStyles[position])));
174
+ return supportedHandles.reduce(function (result, position) {
175
+ return _objectSpread(_objectSpread({}, result), {}, (0, _defineProperty2.default)({}, position, _objectSpread(_objectSpread({}, position === 'bottom' ? memoizedBaseBottomHandleStyles : memoizedBaseHorizontalHandleStyles), {}, (0, _defineProperty2.default)({}, position, offset), handleStyles === null || handleStyles === void 0 ? void 0 : handleStyles[position])));
150
176
  }, {});
151
- }, [memoizedBaseHandleStyles, offset, handleStyles]);
177
+ }, [memoizedBaseBottomHandleStyles, memoizedBaseHorizontalHandleStyles, offset, handleStyles, supportedHandles]);
152
178
  var nextHandleStyles = (0, _expValEquals.expValEquals)('platform_editor_perf_lint_cleanup', 'isEnabled', true) ? memoizedNextHandleStyles :
153
179
  // eslint-disable-next-line @atlassian/perf-linting/no-expensive-computations-in-render -- intentional fallback for experiment off path
154
- SUPPORTED_HANDLES.reduce(function (result, position) {
155
- return _objectSpread(_objectSpread({}, result), {}, (0, _defineProperty2.default)({}, position, _objectSpread(_objectSpread({}, baseHandleStyles), {}, (0, _defineProperty2.default)({}, position, offset), handleStyles === null || handleStyles === void 0 ? void 0 : handleStyles[position])));
180
+ supportedHandles.reduce(function (result, position) {
181
+ return _objectSpread(_objectSpread({}, result), {}, (0, _defineProperty2.default)({}, position, _objectSpread(_objectSpread({}, position === 'bottom' ? baseBottomHandleStyles : baseHorizontalHandleStyles), {}, (0, _defineProperty2.default)({}, position, offset), handleStyles === null || handleStyles === void 0 ? void 0 : handleStyles[position])));
156
182
  }, {});
157
183
  var resizerClassName = (0, _classnames3.default)(className, _resizer.resizerItemClassName, (0, _defineProperty2.default)({
158
184
  'is-resizing': isResizing,
@@ -162,7 +188,7 @@ var ResizerNext = function ResizerNext(props, ref) {
162
188
  var _useIntl = (0, _reactIntl.useIntl)(),
163
189
  formatMessage = _useIntl.formatMessage;
164
190
  var handleComponent = (0, _react.useMemo)(function () {
165
- return SUPPORTED_HANDLES.reduce(function (result, position) {
191
+ return supportedHandles.reduce(function (result, position) {
166
192
  var thumb = /*#__PURE__*/_react.default.createElement("button", {
167
193
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
168
194
  className: _resizer.resizerHandleThumbClassName,
@@ -207,7 +233,7 @@ var ResizerNext = function ResizerNext(props, ref) {
207
233
  style: inheritedCSS
208
234
  }, thumbWithTrack)));
209
235
  }, {});
210
- }, [handleHighlight, handleTooltipContent, formatMessage]);
236
+ }, [handleHighlight, handleTooltipContent, formatMessage, supportedHandles]);
211
237
 
212
238
  // snapGap is usually a constant, if snap.x?.length is 0 and snapGap has a value resizer cannot be resized
213
239
  var snapGapActual = (0, _react.useMemo)(function () {
@@ -217,17 +243,18 @@ var ResizerNext = function ResizerNext(props, ref) {
217
243
  }
218
244
  return snapGap;
219
245
  }, [snap, snapGap]);
246
+ var resolvedHeight = (0, _expValEquals.expValEquals)('databases-native-embeds-v2', 'isEnabled', true) ? height !== null && height !== void 0 ? height : 'auto' : 'auto';
220
247
  var resizerAutoSize = (0, _react.useMemo)(function () {
221
248
  return {
222
249
  width: width !== null && width !== void 0 ? width : 'auto',
223
- height: 'auto'
250
+ height: resolvedHeight
224
251
  };
225
- }, [width]);
252
+ }, [resolvedHeight, width]);
226
253
  var resizerSize = (0, _expValEquals.expValEquals)('platform_editor_perf_lint_cleanup', 'isEnabled', true) ? resizerAutoSize :
227
254
  // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- intentional fallback for experiment off path
228
255
  {
229
256
  width: width !== null && width !== void 0 ? width : 'auto',
230
- height: 'auto'
257
+ height: resolvedHeight
231
258
  };
232
259
  return /*#__PURE__*/_react.default.createElement(_reResizable.Resizable, (0, _extends2.default)({
233
260
  ref: resizable,
@@ -1 +1,5 @@
1
- "use strict";
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -24,7 +24,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
24
24
  * @jsx jsx
25
25
  */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
26
26
  var packageName = "@atlaskit/editor-common";
27
- var packageVersion = "114.22.1";
27
+ var packageVersion = "114.23.0";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var fadeIn = (0, _react2.keyframes)({
@@ -4,7 +4,7 @@ import { isFedRamp } from './environment';
4
4
  import { normaliseSentryBreadcrumbs, SERIALIZABLE_ATTRIBUTES } from './normalise-sentry-breadcrumbs';
5
5
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
6
6
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
7
- const packageVersion = "114.22.1";
7
+ const packageVersion = "114.23.0";
8
8
  const sanitiseSentryEvents = (data, _hint) => {
9
9
  // Remove URL as it has UGC
10
10
  // Ignored via go/ees007
@@ -23,6 +23,7 @@ const resizerLabelStyles = xcss({
23
23
  zIndex: 'layer' // 400 same z-index as the floating toolbar
24
24
  });
25
25
  const SUPPORTED_HANDLES = ['left', 'right'];
26
+ const SUPPORTED_HANDLES_FOR_VERTICAL_RESIZE = ['left', 'right', 'bottom'];
26
27
  const inheritedCSS = {
27
28
  position: 'inherit',
28
29
  height: 'inherit',
@@ -45,6 +46,7 @@ const ResizerNext = (props, ref) => {
45
46
  }, [resizeHandleThumbRef]);
46
47
  const {
47
48
  width,
49
+ height,
48
50
  children,
49
51
  handleClassName,
50
52
  className,
@@ -67,13 +69,14 @@ const ResizerNext = (props, ref) => {
67
69
  labelComponent,
68
70
  ...otherProps
69
71
  } = props;
72
+ const supportedHandles = expValEquals('databases-native-embeds-v2', 'isEnabled', true) ? SUPPORTED_HANDLES_FOR_VERTICAL_RESIZE : SUPPORTED_HANDLES;
70
73
  const onResizeStart = useCallback(event => {
71
74
  // prevent creating a drag event on Firefox
72
75
  event.preventDefault();
73
76
  setIsResizing(true);
74
77
  handleResizeStart();
75
78
  }, [handleResizeStart]);
76
- const onResize = useCallback((_event, _direction, _elementRef, delta) => {
79
+ const onResize = useCallback((_event, direction, _elementRef, delta) => {
77
80
  if (!handleResize) {
78
81
  return;
79
82
  }
@@ -87,9 +90,13 @@ const ResizerNext = (props, ref) => {
87
90
  width: resizableCurrent.state.original.width,
88
91
  height: resizableCurrent.state.original.height
89
92
  };
90
- handleResize(originalState, delta);
93
+ if (expValEquals('databases-native-embeds-v2', 'isEnabled', true)) {
94
+ handleResize(originalState, delta, direction);
95
+ } else {
96
+ handleResize(originalState, delta);
97
+ }
91
98
  }, [handleResize]);
92
- const onResizeStop = useCallback((_event, _direction, _elementRef, delta) => {
99
+ const onResizeStop = useCallback((_event, direction, _elementRef, delta) => {
93
100
  const resizableCurrent = resizable.current;
94
101
  if (!resizableCurrent || !resizableCurrent.state.original) {
95
102
  return;
@@ -101,40 +108,56 @@ const ResizerNext = (props, ref) => {
101
108
  height: resizableCurrent.state.original.height
102
109
  };
103
110
  setIsResizing(false);
104
- handleResizeStop(originalState, delta);
111
+ if (expValEquals('databases-native-embeds-v2', 'isEnabled', true)) {
112
+ handleResizeStop(originalState, delta, direction);
113
+ } else {
114
+ handleResizeStop(originalState, delta);
115
+ }
105
116
  }, [handleResizeStop]);
106
- const handles = {
107
- left: classnames(handleClassName !== null && handleClassName !== void 0 ? handleClassName : resizerHandleClassName, 'left', handleSize, handleAlignmentMethod),
108
- right: classnames(handleClassName !== null && handleClassName !== void 0 ? handleClassName : resizerHandleClassName, 'right', handleSize, handleAlignmentMethod)
109
- };
117
+ const handles = useMemo(() => supportedHandles.reduce((result, position) => ({
118
+ ...result,
119
+ [position]: classnames(handleClassName !== null && handleClassName !== void 0 ? handleClassName : resizerHandleClassName, position, handleSize, position === 'bottom' && expValEquals('databases-native-embeds-v2', 'isEnabled', true) ? undefined : handleAlignmentMethod)
120
+ }), {}), [handleClassName, handleSize, handleAlignmentMethod, supportedHandles]);
110
121
  const handleWidth = handlePositioning === 'adjacent' ? "var(--ds-space-100, 8px)" : "var(--ds-space-300, 24px)";
111
- const baseHandleStyles = {
122
+ const baseHorizontalHandleStyles = {
112
123
  width: handleWidth,
113
124
  zIndex: resizerHandleZIndex,
114
125
  pointerEvents: 'auto',
115
126
  alignItems: handlePositioning === 'adjacent' ? 'center' : undefined
116
127
  };
117
- const memoizedBaseHandleStyles = useMemo(() => ({
128
+ const baseBottomHandleStyles = {
129
+ height: handleWidth,
130
+ zIndex: resizerHandleZIndex,
131
+ pointerEvents: 'auto',
132
+ justifyContent: handlePositioning === 'adjacent' ? 'center' : undefined
133
+ };
134
+ const memoizedBaseHorizontalHandleStyles = useMemo(() => ({
118
135
  width: handleWidth,
119
136
  zIndex: resizerHandleZIndex,
120
137
  pointerEvents: 'auto',
121
138
  alignItems: handlePositioning === 'adjacent' ? 'center' : undefined
122
139
  }), [handleWidth, handlePositioning]);
140
+ const memoizedBaseBottomHandleStyles = useMemo(() => ({
141
+ height: handleWidth,
142
+ zIndex: resizerHandleZIndex,
143
+ pointerEvents: 'auto',
144
+ justifyContent: handlePositioning === 'adjacent' ? 'center' : undefined
145
+ }), [handleWidth, handlePositioning]);
123
146
  const offset = handlePositioning === 'adjacent' ? `calc(${handleWidth} * -1)` : `calc(${handleWidth} * -0.5)`;
124
- const memoizedNextHandleStyles = useMemo(() => SUPPORTED_HANDLES.reduce((result, position) => ({
147
+ const memoizedNextHandleStyles = useMemo(() => supportedHandles.reduce((result, position) => ({
125
148
  ...result,
126
149
  [position]: {
127
- ...memoizedBaseHandleStyles,
150
+ ...(position === 'bottom' ? memoizedBaseBottomHandleStyles : memoizedBaseHorizontalHandleStyles),
128
151
  [position]: offset,
129
152
  ...(handleStyles === null || handleStyles === void 0 ? void 0 : handleStyles[position])
130
153
  }
131
- }), {}), [memoizedBaseHandleStyles, offset, handleStyles]);
154
+ }), {}), [memoizedBaseBottomHandleStyles, memoizedBaseHorizontalHandleStyles, offset, handleStyles, supportedHandles]);
132
155
  const nextHandleStyles = expValEquals('platform_editor_perf_lint_cleanup', 'isEnabled', true) ? memoizedNextHandleStyles :
133
156
  // eslint-disable-next-line @atlassian/perf-linting/no-expensive-computations-in-render -- intentional fallback for experiment off path
134
- SUPPORTED_HANDLES.reduce((result, position) => ({
157
+ supportedHandles.reduce((result, position) => ({
135
158
  ...result,
136
159
  [position]: {
137
- ...baseHandleStyles,
160
+ ...(position === 'bottom' ? baseBottomHandleStyles : baseHorizontalHandleStyles),
138
161
  [position]: offset,
139
162
  ...(handleStyles === null || handleStyles === void 0 ? void 0 : handleStyles[position])
140
163
  }
@@ -151,7 +174,7 @@ const ResizerNext = (props, ref) => {
151
174
  formatMessage
152
175
  } = useIntl();
153
176
  const handleComponent = useMemo(() => {
154
- return SUPPORTED_HANDLES.reduce((result, position) => {
177
+ return supportedHandles.reduce((result, position) => {
155
178
  const thumb = /*#__PURE__*/React.createElement("button", {
156
179
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
157
180
  className: resizerHandleThumbClassName,
@@ -205,7 +228,7 @@ const ResizerNext = (props, ref) => {
205
228
  }, thumbWithTrack)
206
229
  };
207
230
  }, {});
208
- }, [handleHighlight, handleTooltipContent, formatMessage]);
231
+ }, [handleHighlight, handleTooltipContent, formatMessage, supportedHandles]);
209
232
 
210
233
  // snapGap is usually a constant, if snap.x?.length is 0 and snapGap has a value resizer cannot be resized
211
234
  const snapGapActual = useMemo(() => {
@@ -215,15 +238,16 @@ const ResizerNext = (props, ref) => {
215
238
  }
216
239
  return snapGap;
217
240
  }, [snap, snapGap]);
241
+ const resolvedHeight = expValEquals('databases-native-embeds-v2', 'isEnabled', true) ? height !== null && height !== void 0 ? height : 'auto' : 'auto';
218
242
  const resizerAutoSize = useMemo(() => ({
219
243
  width: width !== null && width !== void 0 ? width : 'auto',
220
- height: 'auto'
221
- }), [width]);
244
+ height: resolvedHeight
245
+ }), [resolvedHeight, width]);
222
246
  const resizerSize = expValEquals('platform_editor_perf_lint_cleanup', 'isEnabled', true) ? resizerAutoSize :
223
247
  // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- intentional fallback for experiment off path
224
248
  {
225
249
  width: width !== null && width !== void 0 ? width : 'auto',
226
- height: 'auto'
250
+ height: resolvedHeight
227
251
  };
228
252
  return /*#__PURE__*/React.createElement(Resizable, _extends({
229
253
  ref: resizable,
@@ -0,0 +1 @@
1
+ export {};
@@ -14,7 +14,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
14
14
  import { fg } from '@atlaskit/platform-feature-flags';
15
15
  import Layer from '../Layer';
16
16
  const packageName = "@atlaskit/editor-common";
17
- const packageVersion = "114.22.1";
17
+ const packageVersion = "114.23.0";
18
18
  const halfFocusRing = 1;
19
19
  const dropOffset = '0, 8';
20
20
  const fadeIn = keyframes({
@@ -10,7 +10,7 @@ import { isFedRamp } from './environment';
10
10
  import { normaliseSentryBreadcrumbs, SERIALIZABLE_ATTRIBUTES } from './normalise-sentry-breadcrumbs';
11
11
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
12
12
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
13
- var packageVersion = "114.22.1";
13
+ var packageVersion = "114.23.0";
14
14
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
15
15
  // Remove URL as it has UGC
16
16
  // Ignored via go/ees007
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
4
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
5
- var _excluded = ["width", "children", "handleClassName", "className", "handleResize", "handleResizeStart", "handleResizeStop", "handleSize", "handleAlignmentMethod", "handlePositioning", "appearance", "handleStyles", "resizeRatio", "snap", "snapGap", "isHandleVisible", "handleHighlight", "handleTooltipContent", "needExtendedResizeZone", "childrenDOMRef", "labelComponent"];
5
+ var _excluded = ["width", "height", "children", "handleClassName", "className", "handleResize", "handleResizeStart", "handleResizeStop", "handleSize", "handleAlignmentMethod", "handlePositioning", "appearance", "handleStyles", "resizeRatio", "snap", "snapGap", "isHandleVisible", "handleHighlight", "handleTooltipContent", "needExtendedResizeZone", "childrenDOMRef", "labelComponent"];
6
6
  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; }
7
7
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
8
8
  import React, { forwardRef, useCallback, useImperativeHandle, useMemo, useRef, useState } from 'react';
@@ -29,6 +29,7 @@ var resizerLabelStyles = xcss({
29
29
  zIndex: 'layer' // 400 same z-index as the floating toolbar
30
30
  });
31
31
  var SUPPORTED_HANDLES = ['left', 'right'];
32
+ var SUPPORTED_HANDLES_FOR_VERTICAL_RESIZE = ['left', 'right', 'bottom'];
32
33
  var inheritedCSS = {
33
34
  position: 'inherit',
34
35
  height: 'inherit',
@@ -53,6 +54,7 @@ var ResizerNext = function ResizerNext(props, ref) {
53
54
  };
54
55
  }, [resizeHandleThumbRef]);
55
56
  var width = props.width,
57
+ height = props.height,
56
58
  children = props.children,
57
59
  handleClassName = props.handleClassName,
58
60
  className = props.className,
@@ -81,13 +83,14 @@ var ResizerNext = function ResizerNext(props, ref) {
81
83
  childrenDOMRef = props.childrenDOMRef,
82
84
  labelComponent = props.labelComponent,
83
85
  otherProps = _objectWithoutProperties(props, _excluded);
86
+ var supportedHandles = expValEquals('databases-native-embeds-v2', 'isEnabled', true) ? SUPPORTED_HANDLES_FOR_VERTICAL_RESIZE : SUPPORTED_HANDLES;
84
87
  var onResizeStart = useCallback(function (event) {
85
88
  // prevent creating a drag event on Firefox
86
89
  event.preventDefault();
87
90
  setIsResizing(true);
88
91
  handleResizeStart();
89
92
  }, [handleResizeStart]);
90
- var onResize = useCallback(function (_event, _direction, _elementRef, delta) {
93
+ var onResize = useCallback(function (_event, direction, _elementRef, delta) {
91
94
  if (!handleResize) {
92
95
  return;
93
96
  }
@@ -101,9 +104,13 @@ var ResizerNext = function ResizerNext(props, ref) {
101
104
  width: resizableCurrent.state.original.width,
102
105
  height: resizableCurrent.state.original.height
103
106
  };
104
- handleResize(originalState, delta);
107
+ if (expValEquals('databases-native-embeds-v2', 'isEnabled', true)) {
108
+ handleResize(originalState, delta, direction);
109
+ } else {
110
+ handleResize(originalState, delta);
111
+ }
105
112
  }, [handleResize]);
106
- var onResizeStop = useCallback(function (_event, _direction, _elementRef, delta) {
113
+ var onResizeStop = useCallback(function (_event, direction, _elementRef, delta) {
107
114
  var resizableCurrent = resizable.current;
108
115
  if (!resizableCurrent || !resizableCurrent.state.original) {
109
116
  return;
@@ -115,20 +122,31 @@ var ResizerNext = function ResizerNext(props, ref) {
115
122
  height: resizableCurrent.state.original.height
116
123
  };
117
124
  setIsResizing(false);
118
- handleResizeStop(originalState, delta);
125
+ if (expValEquals('databases-native-embeds-v2', 'isEnabled', true)) {
126
+ handleResizeStop(originalState, delta, direction);
127
+ } else {
128
+ handleResizeStop(originalState, delta);
129
+ }
119
130
  }, [handleResizeStop]);
120
- var handles = {
121
- left: classnames(handleClassName !== null && handleClassName !== void 0 ? handleClassName : resizerHandleClassName, 'left', handleSize, handleAlignmentMethod),
122
- right: classnames(handleClassName !== null && handleClassName !== void 0 ? handleClassName : resizerHandleClassName, 'right', handleSize, handleAlignmentMethod)
123
- };
131
+ var handles = useMemo(function () {
132
+ return supportedHandles.reduce(function (result, position) {
133
+ return _objectSpread(_objectSpread({}, result), {}, _defineProperty({}, position, classnames(handleClassName !== null && handleClassName !== void 0 ? handleClassName : resizerHandleClassName, position, handleSize, position === 'bottom' && expValEquals('databases-native-embeds-v2', 'isEnabled', true) ? undefined : handleAlignmentMethod)));
134
+ }, {});
135
+ }, [handleClassName, handleSize, handleAlignmentMethod, supportedHandles]);
124
136
  var handleWidth = handlePositioning === 'adjacent' ? "var(--ds-space-100, 8px)" : "var(--ds-space-300, 24px)";
125
- var baseHandleStyles = {
137
+ var baseHorizontalHandleStyles = {
126
138
  width: handleWidth,
127
139
  zIndex: resizerHandleZIndex,
128
140
  pointerEvents: 'auto',
129
141
  alignItems: handlePositioning === 'adjacent' ? 'center' : undefined
130
142
  };
131
- var memoizedBaseHandleStyles = useMemo(function () {
143
+ var baseBottomHandleStyles = {
144
+ height: handleWidth,
145
+ zIndex: resizerHandleZIndex,
146
+ pointerEvents: 'auto',
147
+ justifyContent: handlePositioning === 'adjacent' ? 'center' : undefined
148
+ };
149
+ var memoizedBaseHorizontalHandleStyles = useMemo(function () {
132
150
  return {
133
151
  width: handleWidth,
134
152
  zIndex: resizerHandleZIndex,
@@ -136,16 +154,24 @@ var ResizerNext = function ResizerNext(props, ref) {
136
154
  alignItems: handlePositioning === 'adjacent' ? 'center' : undefined
137
155
  };
138
156
  }, [handleWidth, handlePositioning]);
157
+ var memoizedBaseBottomHandleStyles = useMemo(function () {
158
+ return {
159
+ height: handleWidth,
160
+ zIndex: resizerHandleZIndex,
161
+ pointerEvents: 'auto',
162
+ justifyContent: handlePositioning === 'adjacent' ? 'center' : undefined
163
+ };
164
+ }, [handleWidth, handlePositioning]);
139
165
  var offset = handlePositioning === 'adjacent' ? "calc(".concat(handleWidth, " * -1)") : "calc(".concat(handleWidth, " * -0.5)");
140
166
  var memoizedNextHandleStyles = useMemo(function () {
141
- return SUPPORTED_HANDLES.reduce(function (result, position) {
142
- return _objectSpread(_objectSpread({}, result), {}, _defineProperty({}, position, _objectSpread(_objectSpread({}, memoizedBaseHandleStyles), {}, _defineProperty({}, position, offset), handleStyles === null || handleStyles === void 0 ? void 0 : handleStyles[position])));
167
+ return supportedHandles.reduce(function (result, position) {
168
+ return _objectSpread(_objectSpread({}, result), {}, _defineProperty({}, position, _objectSpread(_objectSpread({}, position === 'bottom' ? memoizedBaseBottomHandleStyles : memoizedBaseHorizontalHandleStyles), {}, _defineProperty({}, position, offset), handleStyles === null || handleStyles === void 0 ? void 0 : handleStyles[position])));
143
169
  }, {});
144
- }, [memoizedBaseHandleStyles, offset, handleStyles]);
170
+ }, [memoizedBaseBottomHandleStyles, memoizedBaseHorizontalHandleStyles, offset, handleStyles, supportedHandles]);
145
171
  var nextHandleStyles = expValEquals('platform_editor_perf_lint_cleanup', 'isEnabled', true) ? memoizedNextHandleStyles :
146
172
  // eslint-disable-next-line @atlassian/perf-linting/no-expensive-computations-in-render -- intentional fallback for experiment off path
147
- SUPPORTED_HANDLES.reduce(function (result, position) {
148
- return _objectSpread(_objectSpread({}, result), {}, _defineProperty({}, position, _objectSpread(_objectSpread({}, baseHandleStyles), {}, _defineProperty({}, position, offset), handleStyles === null || handleStyles === void 0 ? void 0 : handleStyles[position])));
173
+ supportedHandles.reduce(function (result, position) {
174
+ return _objectSpread(_objectSpread({}, result), {}, _defineProperty({}, position, _objectSpread(_objectSpread({}, position === 'bottom' ? baseBottomHandleStyles : baseHorizontalHandleStyles), {}, _defineProperty({}, position, offset), handleStyles === null || handleStyles === void 0 ? void 0 : handleStyles[position])));
149
175
  }, {});
150
176
  var resizerClassName = classnames(className, resizerItemClassName, _defineProperty({
151
177
  'is-resizing': isResizing,
@@ -155,7 +181,7 @@ var ResizerNext = function ResizerNext(props, ref) {
155
181
  var _useIntl = useIntl(),
156
182
  formatMessage = _useIntl.formatMessage;
157
183
  var handleComponent = useMemo(function () {
158
- return SUPPORTED_HANDLES.reduce(function (result, position) {
184
+ return supportedHandles.reduce(function (result, position) {
159
185
  var thumb = /*#__PURE__*/React.createElement("button", {
160
186
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
161
187
  className: resizerHandleThumbClassName,
@@ -200,7 +226,7 @@ var ResizerNext = function ResizerNext(props, ref) {
200
226
  style: inheritedCSS
201
227
  }, thumbWithTrack)));
202
228
  }, {});
203
- }, [handleHighlight, handleTooltipContent, formatMessage]);
229
+ }, [handleHighlight, handleTooltipContent, formatMessage, supportedHandles]);
204
230
 
205
231
  // snapGap is usually a constant, if snap.x?.length is 0 and snapGap has a value resizer cannot be resized
206
232
  var snapGapActual = useMemo(function () {
@@ -210,17 +236,18 @@ var ResizerNext = function ResizerNext(props, ref) {
210
236
  }
211
237
  return snapGap;
212
238
  }, [snap, snapGap]);
239
+ var resolvedHeight = expValEquals('databases-native-embeds-v2', 'isEnabled', true) ? height !== null && height !== void 0 ? height : 'auto' : 'auto';
213
240
  var resizerAutoSize = useMemo(function () {
214
241
  return {
215
242
  width: width !== null && width !== void 0 ? width : 'auto',
216
- height: 'auto'
243
+ height: resolvedHeight
217
244
  };
218
- }, [width]);
245
+ }, [resolvedHeight, width]);
219
246
  var resizerSize = expValEquals('platform_editor_perf_lint_cleanup', 'isEnabled', true) ? resizerAutoSize :
220
247
  // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- intentional fallback for experiment off path
221
248
  {
222
249
  width: width !== null && width !== void 0 ? width : 'auto',
223
- height: 'auto'
250
+ height: resolvedHeight
224
251
  };
225
252
  return /*#__PURE__*/React.createElement(Resizable, _extends({
226
253
  ref: resizable,
@@ -0,0 +1 @@
1
+ export {};
@@ -21,7 +21,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
21
21
  import { fg } from '@atlaskit/platform-feature-flags';
22
22
  import Layer from '../Layer';
23
23
  var packageName = "@atlaskit/editor-common";
24
- var packageVersion = "114.22.1";
24
+ var packageVersion = "114.23.0";
25
25
  var halfFocusRing = 1;
26
26
  var dropOffset = '0, 8';
27
27
  var fadeIn = keyframes({
@@ -48,13 +48,16 @@ export type ResizerProps = {
48
48
  * This is used to override the style of resize handles wrapper.
49
49
  */
50
50
  handleWrapperStyle?: CSSProperties;
51
+ height?: number | string;
51
52
  isHandleVisible?: boolean;
52
53
  /**
53
54
  * Children of the component, this is going to be display below the resizer
54
55
  * useful for displaying a label such as size or layout
55
56
  */
56
57
  labelComponent?: React.ReactNode;
58
+ maxHeight?: number | string;
57
59
  maxWidth?: number | string;
60
+ minHeight?: number | string;
58
61
  minWidth?: number | string;
59
62
  /**
60
63
  * control if extended resize zone is needed, by default we apply it to the resizer
@@ -1,4 +1,6 @@
1
+ import type { ResizeDirection } from 're-resizable';
1
2
  export type EnabledHandles = {
3
+ bottom?: boolean;
2
4
  left?: boolean;
3
5
  right?: boolean;
4
6
  };
@@ -14,9 +16,10 @@ export type Snap = {
14
16
  x?: Array<number>;
15
17
  y?: Array<number>;
16
18
  };
17
- export type HandleResize = (newWidth: Position & Dimensions, delta: Dimensions) => void;
19
+ export type HandleResize = (newWidth: Position & Dimensions, delta: Dimensions, direction?: ResizeDirection) => void;
18
20
  export type HandleResizeStart = () => void;
19
21
  export type HandleStyles = {
22
+ bottom?: React.CSSProperties;
20
23
  left?: React.CSSProperties;
21
24
  right?: React.CSSProperties;
22
25
  };
@@ -48,13 +48,16 @@ export type ResizerProps = {
48
48
  * This is used to override the style of resize handles wrapper.
49
49
  */
50
50
  handleWrapperStyle?: CSSProperties;
51
+ height?: number | string;
51
52
  isHandleVisible?: boolean;
52
53
  /**
53
54
  * Children of the component, this is going to be display below the resizer
54
55
  * useful for displaying a label such as size or layout
55
56
  */
56
57
  labelComponent?: React.ReactNode;
58
+ maxHeight?: number | string;
57
59
  maxWidth?: number | string;
60
+ minHeight?: number | string;
58
61
  minWidth?: number | string;
59
62
  /**
60
63
  * control if extended resize zone is needed, by default we apply it to the resizer
@@ -1,4 +1,6 @@
1
+ import type { ResizeDirection } from 're-resizable';
1
2
  export type EnabledHandles = {
3
+ bottom?: boolean;
2
4
  left?: boolean;
3
5
  right?: boolean;
4
6
  };
@@ -14,9 +16,10 @@ export type Snap = {
14
16
  x?: Array<number>;
15
17
  y?: Array<number>;
16
18
  };
17
- export type HandleResize = (newWidth: Position & Dimensions, delta: Dimensions) => void;
19
+ export type HandleResize = (newWidth: Position & Dimensions, delta: Dimensions, direction?: ResizeDirection) => void;
18
20
  export type HandleResizeStart = () => void;
19
21
  export type HandleStyles = {
22
+ bottom?: React.CSSProperties;
20
23
  left?: React.CSSProperties;
21
24
  right?: React.CSSProperties;
22
25
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "114.23.0",
3
+ "version": "114.24.0",
4
4
  "description": "A package that contains common classes and components for editor and renderer",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"