@elementor/editor-editing-panel 3.35.0-461 → 3.35.0-463

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/dist/index.js CHANGED
@@ -6220,6 +6220,14 @@ var ActionIcons = () => /* @__PURE__ */ React97.createElement(import_ui46.Box, {
6220
6220
 
6221
6221
  // src/styles-inheritance/components/styles-inheritance-infotip.tsx
6222
6222
  var SECTION_PADDING_INLINE = 32;
6223
+ var INFOTIP_MAX_WIDTH = 496;
6224
+ var calculatePopoverOffset = (triggerRect, cardWidth, isSiteRtl) => {
6225
+ if (!triggerRect) {
6226
+ return 0;
6227
+ }
6228
+ const triggerWidth = triggerRect.width;
6229
+ return isSiteRtl ? triggerWidth - cardWidth : -(cardWidth / 2) + triggerWidth / 2;
6230
+ };
6223
6231
  var StylesInheritanceInfotip = ({
6224
6232
  inheritanceChain,
6225
6233
  propType,
@@ -6229,6 +6237,7 @@ var StylesInheritanceInfotip = ({
6229
6237
  isDisabled
6230
6238
  }) => {
6231
6239
  const [showInfotip, setShowInfotip] = (0, import_react43.useState)(false);
6240
+ const triggerRef = (0, import_react43.useRef)(null);
6232
6241
  const toggleInfotip = () => {
6233
6242
  if (isDisabled) {
6234
6243
  return;
@@ -6256,7 +6265,7 @@ var StylesInheritanceInfotip = ({
6256
6265
  elevation: 0,
6257
6266
  sx: {
6258
6267
  width: `${sectionWidth - SECTION_PADDING_INLINE}px`,
6259
- maxWidth: 496,
6268
+ maxWidth: INFOTIP_MAX_WIDTH,
6260
6269
  maxHeight: 268,
6261
6270
  overflowX: "hidden",
6262
6271
  display: "flex",
@@ -6321,31 +6330,46 @@ var StylesInheritanceInfotip = ({
6321
6330
  if (isDisabled) {
6322
6331
  return /* @__PURE__ */ React98.createElement(import_ui47.Box, { sx: { display: "inline-flex" } }, children);
6323
6332
  }
6324
- return /* @__PURE__ */ React98.createElement(
6333
+ return /* @__PURE__ */ React98.createElement(import_ui47.Box, { ref: triggerRef, sx: { display: "inline-flex" } }, /* @__PURE__ */ React98.createElement(
6325
6334
  TooltipOrInfotip,
6326
6335
  {
6327
6336
  showInfotip,
6328
6337
  onClose: closeInfotip,
6329
6338
  infotipContent,
6330
- isDisabled
6339
+ isDisabled,
6340
+ triggerRef,
6341
+ sectionWidth
6331
6342
  },
6332
- /* @__PURE__ */ React98.createElement(import_ui47.IconButton, { onClick: toggleInfotip, "aria-label": label, sx: { my: "-1px" }, disabled: isDisabled }, children)
6333
- );
6343
+ /* @__PURE__ */ React98.createElement(
6344
+ import_ui47.IconButton,
6345
+ {
6346
+ onClick: toggleInfotip,
6347
+ "aria-label": label,
6348
+ sx: { my: "-1px" },
6349
+ disabled: isDisabled
6350
+ },
6351
+ children
6352
+ )
6353
+ ));
6334
6354
  };
6335
6355
  function TooltipOrInfotip({
6336
6356
  children,
6337
6357
  showInfotip,
6338
6358
  onClose,
6339
6359
  infotipContent,
6340
- isDisabled
6360
+ isDisabled,
6361
+ triggerRef,
6362
+ sectionWidth
6341
6363
  }) {
6342
6364
  const direction = useDirection();
6343
6365
  const isSiteRtl = direction.isSiteRtl;
6344
- const forceInfotipAlignLeft = isSiteRtl ? 9999999 : -9999999;
6345
6366
  if (isDisabled) {
6346
6367
  return /* @__PURE__ */ React98.createElement(import_ui47.Box, { sx: { display: "inline-flex" } }, children);
6347
6368
  }
6348
6369
  if (showInfotip) {
6370
+ const triggerRect = triggerRef.current?.getBoundingClientRect();
6371
+ const cardWidth = Math.min(sectionWidth - SECTION_PADDING_INLINE, INFOTIP_MAX_WIDTH);
6372
+ const offsetX = calculatePopoverOffset(triggerRect, cardWidth, isSiteRtl);
6349
6373
  return /* @__PURE__ */ React98.createElement(React98.Fragment, null, /* @__PURE__ */ React98.createElement(
6350
6374
  import_ui47.Backdrop,
6351
6375
  {
@@ -6374,7 +6398,7 @@ function TooltipOrInfotip({
6374
6398
  modifiers: [
6375
6399
  {
6376
6400
  name: "offset",
6377
- options: { offset: [forceInfotipAlignLeft, 0] }
6401
+ options: { offset: [offsetX, 0] }
6378
6402
  }
6379
6403
  ]
6380
6404
  }