@elementor/editor-editing-panel 3.33.0-237 → 3.33.0-239

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
@@ -5275,7 +5275,7 @@ var EditingPanelHooks = () => {
5275
5275
  var React91 = __toESM(require("react"));
5276
5276
  var import_editor_controls53 = require("@elementor/editor-controls");
5277
5277
  var import_editor_elements17 = require("@elementor/editor-elements");
5278
- var import_editor_props17 = require("@elementor/editor-props");
5278
+ var import_editor_props16 = require("@elementor/editor-props");
5279
5279
  var import_icons25 = require("@elementor/icons");
5280
5280
  var import_ui46 = require("@elementor/ui");
5281
5281
  var import_i18n63 = require("@wordpress/i18n");
@@ -5299,40 +5299,23 @@ var getElementByType = (elementId, type) => {
5299
5299
 
5300
5300
  // src/controls-registry/element-controls/tabs-control/actions.ts
5301
5301
  var import_editor_elements16 = require("@elementor/editor-elements");
5302
- var import_editor_props16 = require("@elementor/editor-props");
5303
5302
  var import_i18n62 = require("@wordpress/i18n");
5304
5303
  var TAB_ELEMENT_TYPE = "e-tab";
5305
5304
  var TAB_CONTENT_ELEMENT_TYPE = "e-tab-content";
5306
- var duplicateItem = ({ items: items3 }) => {
5307
- items3.forEach(({ item }) => {
5305
+ var duplicateItem = ({
5306
+ items: items3,
5307
+ tabContentAreaId
5308
+ }) => {
5309
+ items3.forEach(({ item, index }) => {
5308
5310
  const tabId = item.id;
5309
- const { value: tabContentId } = (0, import_editor_elements16.getElementSetting)(tabId, "tab-content-id") ?? {};
5311
+ const tabContentAreaContainer = (0, import_editor_elements16.getContainer)(tabContentAreaId);
5312
+ const tabContentId = tabContentAreaContainer?.children?.[index]?.id;
5310
5313
  if (!tabContentId) {
5311
5314
  throw new Error("Original content ID is required for duplication");
5312
5315
  }
5313
5316
  (0, import_editor_elements16.duplicateElements)({
5314
5317
  elementIds: [tabId, tabContentId],
5315
- title: (0, import_i18n62.__)("Duplicate Tab", "elementor"),
5316
- onCreate: (duplicatedElements) => {
5317
- const tab = duplicatedElements.find((element) => element.originalElementId === tabId);
5318
- const tabContent = duplicatedElements.find((element) => element.originalElementId === tabContentId);
5319
- if (tabContent && tab) {
5320
- (0, import_editor_elements16.updateElementSettings)({
5321
- withHistory: false,
5322
- id: tab.id,
5323
- props: {
5324
- "tab-content-id": import_editor_props16.stringPropTypeUtil.create(tabContent.id)
5325
- }
5326
- });
5327
- (0, import_editor_elements16.updateElementSettings)({
5328
- withHistory: false,
5329
- id: tabContent.id,
5330
- props: {
5331
- "tab-id": import_editor_props16.stringPropTypeUtil.create(tab.id)
5332
- }
5333
- });
5334
- }
5335
- }
5318
+ title: (0, import_i18n62.__)("Duplicate Tab", "elementor")
5336
5319
  });
5337
5320
  });
5338
5321
  };
@@ -5340,11 +5323,13 @@ var moveItem = ({
5340
5323
  toIndex,
5341
5324
  tabsMenuId,
5342
5325
  tabContentAreaId,
5343
- movedElementId
5326
+ movedElementId,
5327
+ movedElementIndex
5344
5328
  }) => {
5345
- const { value: tabContentId } = (0, import_editor_elements16.getElementSetting)(movedElementId, "tab-content-id") ?? {};
5329
+ const tabContentContainer = (0, import_editor_elements16.getContainer)(tabContentAreaId);
5330
+ const tabContentId = tabContentContainer?.children?.[movedElementIndex]?.id;
5346
5331
  if (!tabContentId) {
5347
- throw new Error("Required tab elements not found for reordering");
5332
+ throw new Error("Content ID is required");
5348
5333
  }
5349
5334
  (0, import_editor_elements16.moveElements)({
5350
5335
  title: (0, import_i18n62.__)("Reorder Tabs", "elementor"),
@@ -5362,12 +5347,16 @@ var moveItem = ({
5362
5347
  ]
5363
5348
  });
5364
5349
  };
5365
- var removeItem = ({ items: items3 }) => {
5350
+ var removeItem = ({
5351
+ items: items3,
5352
+ tabContentAreaId
5353
+ }) => {
5366
5354
  (0, import_editor_elements16.removeElements)({
5367
5355
  title: (0, import_i18n62.__)("Tabs", "elementor"),
5368
- elementIds: items3.flatMap(({ item }) => {
5356
+ elementIds: items3.flatMap(({ item, index }) => {
5369
5357
  const tabId = item.id;
5370
- const { value: tabContentId } = (0, import_editor_elements16.getElementSetting)(tabId, "tab-content-id") ?? {};
5358
+ const tabContentContainer = (0, import_editor_elements16.getContainer)(tabContentAreaId);
5359
+ const tabContentId = tabContentContainer?.children?.[index]?.id;
5371
5360
  if (!tabContentId) {
5372
5361
  throw new Error("Content ID is required");
5373
5362
  }
@@ -5380,32 +5369,21 @@ var addItem = ({
5380
5369
  tabsMenuId,
5381
5370
  items: items3
5382
5371
  }) => {
5383
- items3.forEach(({ item, index }) => {
5384
- const newTabContentId = (0, import_editor_elements16.generateElementId)();
5385
- const newTabId = (0, import_editor_elements16.generateElementId)();
5372
+ items3.forEach(({ index }) => {
5386
5373
  (0, import_editor_elements16.createElements)({
5387
5374
  title: (0, import_i18n62.__)("Tabs", "elementor"),
5388
5375
  elements: [
5389
5376
  {
5390
5377
  containerId: tabContentAreaId,
5391
5378
  model: {
5392
- id: newTabContentId,
5393
5379
  elType: TAB_CONTENT_ELEMENT_TYPE,
5394
- settings: {
5395
- "tab-id": import_editor_props16.stringPropTypeUtil.create(newTabId)
5396
- },
5397
5380
  editor_settings: { title: `Tab ${index + 1} content` }
5398
5381
  }
5399
5382
  },
5400
5383
  {
5401
5384
  containerId: tabsMenuId,
5402
5385
  model: {
5403
- id: newTabId,
5404
5386
  elType: TAB_ELEMENT_TYPE,
5405
- settings: {
5406
- ...item,
5407
- "tab-content-id": import_editor_props16.stringPropTypeUtil.create(newTabContentId)
5408
- },
5409
5387
  editor_settings: { title: `Tab ${index + 1} trigger` }
5410
5388
  }
5411
5389
  }
@@ -5425,11 +5403,12 @@ var TabsControl = ({ label }) => {
5425
5403
  ]);
5426
5404
  const tabList = getElementByType(element.id, TAB_MENU_ELEMENT_TYPE);
5427
5405
  const tabContentArea = getElementByType(element.id, TAB_CONTENT_AREA_ELEMENT_TYPE);
5428
- const repeaterValues = tabLinks.map((tabLink) => {
5406
+ const repeaterValues = tabLinks.map((tabLink, index) => {
5429
5407
  const { title: titleSetting } = (0, import_editor_elements17.getElementEditorSettings)(tabLink.id) ?? {};
5430
5408
  return {
5431
5409
  id: tabLink.id,
5432
- title: titleSetting
5410
+ title: titleSetting,
5411
+ index
5433
5412
  };
5434
5413
  });
5435
5414
  const setValue = (_newValues, _options, meta) => {
@@ -5439,11 +5418,11 @@ var TabsControl = ({ label }) => {
5439
5418
  }
5440
5419
  if (meta?.action?.type === "remove") {
5441
5420
  const items3 = meta.action.payload;
5442
- return removeItem({ items: items3 });
5421
+ return removeItem({ items: items3, tabContentAreaId: tabContentArea.id });
5443
5422
  }
5444
5423
  if (meta?.action?.type === "duplicate") {
5445
5424
  const items3 = meta.action.payload;
5446
- return duplicateItem({ items: items3 });
5425
+ return duplicateItem({ items: items3, tabContentAreaId: tabContentArea.id });
5447
5426
  }
5448
5427
  if (meta?.action?.type === "reorder") {
5449
5428
  const { from, to } = meta.action.payload;
@@ -5451,7 +5430,8 @@ var TabsControl = ({ label }) => {
5451
5430
  toIndex: to,
5452
5431
  tabsMenuId: tabList.id,
5453
5432
  tabContentAreaId: tabContentArea.id,
5454
- movedElementId: tabLinks[from].id
5433
+ movedElementId: tabLinks[from].id,
5434
+ movedElementIndex: from
5455
5435
  });
5456
5436
  }
5457
5437
  };
@@ -5473,30 +5453,29 @@ var TabsControl = ({ label }) => {
5473
5453
  }
5474
5454
  );
5475
5455
  };
5476
- var ItemLabel = ({ value }) => {
5456
+ var ItemLabel = ({ value, index }) => {
5477
5457
  const id = value.id ?? "";
5478
5458
  const editorSettings = (0, import_editor_elements17.useElementEditorSettings)(id);
5479
5459
  const elementTitle = editorSettings?.title;
5480
- return /* @__PURE__ */ React91.createElement(import_ui46.Stack, { sx: { minHeight: 20 }, direction: "row", alignItems: "center", gap: 1.5 }, /* @__PURE__ */ React91.createElement("span", null, elementTitle), /* @__PURE__ */ React91.createElement(SettingsField, { bind: "default-active-tab", propDisplayName: (0, import_i18n63.__)("Tabs", "elementor") }, /* @__PURE__ */ React91.createElement(ItemDefaultTab, { value })));
5460
+ return /* @__PURE__ */ React91.createElement(import_ui46.Stack, { sx: { minHeight: 20 }, direction: "row", alignItems: "center", gap: 1.5 }, /* @__PURE__ */ React91.createElement("span", null, elementTitle), /* @__PURE__ */ React91.createElement(SettingsField, { bind: "default-active-tab", propDisplayName: (0, import_i18n63.__)("Tabs", "elementor") }, /* @__PURE__ */ React91.createElement(ItemDefaultTab, { index })));
5481
5461
  };
5482
- var ItemDefaultTab = ({ value }) => {
5483
- const id = value.id ?? "";
5484
- const { value: defaultItem } = (0, import_editor_controls53.useBoundProp)(import_editor_props17.stringPropTypeUtil);
5485
- const isDefault = defaultItem === id;
5462
+ var ItemDefaultTab = ({ index }) => {
5463
+ const { value: defaultItem } = (0, import_editor_controls53.useBoundProp)(import_editor_props16.numberPropTypeUtil);
5464
+ const isDefault = defaultItem === index;
5486
5465
  if (!isDefault) {
5487
5466
  return null;
5488
5467
  }
5489
5468
  return /* @__PURE__ */ React91.createElement(import_ui46.Chip, { size: "tiny", shape: "rounded", label: (0, import_i18n63.__)("Default", "elementor") });
5490
5469
  };
5491
- var ItemContent = ({ value }) => {
5470
+ var ItemContent = ({ value, index }) => {
5492
5471
  if (!value.id) {
5493
5472
  return null;
5494
5473
  }
5495
- return /* @__PURE__ */ React91.createElement(import_ui46.Stack, { p: 2, gap: 1.5 }, /* @__PURE__ */ React91.createElement(TabLabelControl, { elementId: value.id }), /* @__PURE__ */ React91.createElement(SettingsField, { bind: "default-active-tab", propDisplayName: (0, import_i18n63.__)("Tabs", "elementor") }, /* @__PURE__ */ React91.createElement(DefaultTabControl, { elementId: value.id })));
5474
+ return /* @__PURE__ */ React91.createElement(import_ui46.Stack, { p: 2, gap: 1.5 }, /* @__PURE__ */ React91.createElement(TabLabelControl, { elementId: value.id }), /* @__PURE__ */ React91.createElement(SettingsField, { bind: "default-active-tab", propDisplayName: (0, import_i18n63.__)("Tabs", "elementor") }, /* @__PURE__ */ React91.createElement(DefaultTabControl, { tabIndex: index })));
5496
5475
  };
5497
- var DefaultTabControl = ({ elementId }) => {
5498
- const { value, setValue } = (0, import_editor_controls53.useBoundProp)(import_editor_props17.stringPropTypeUtil);
5499
- const isDefault = value === elementId;
5476
+ var DefaultTabControl = ({ tabIndex }) => {
5477
+ const { value, setValue } = (0, import_editor_controls53.useBoundProp)(import_editor_props16.numberPropTypeUtil);
5478
+ const isDefault = value === tabIndex;
5500
5479
  return /* @__PURE__ */ React91.createElement(import_ui46.Stack, { direction: "row", alignItems: "center", justifyContent: "space-between", gap: 2 }, /* @__PURE__ */ React91.createElement(import_editor_controls53.ControlFormLabel, null, (0, import_i18n63.__)("Set as default tab", "elementor")), /* @__PURE__ */ React91.createElement(ConditionalTooltip, { showTooltip: isDefault, placement: "right" }, /* @__PURE__ */ React91.createElement(
5501
5480
  import_ui46.Switch,
5502
5481
  {
@@ -5504,7 +5483,7 @@ var DefaultTabControl = ({ elementId }) => {
5504
5483
  checked: isDefault,
5505
5484
  disabled: isDefault,
5506
5485
  onChange: ({ target }) => {
5507
- setValue(target.checked ? elementId : null);
5486
+ setValue(target.checked ? tabIndex : null);
5508
5487
  },
5509
5488
  inputProps: {
5510
5489
  ...isDefault ? { style: { opacity: 0, cursor: "not-allowed" } } : {}
@@ -5574,7 +5553,7 @@ var import_editor_controls60 = require("@elementor/editor-controls");
5574
5553
  // src/dynamics/components/background-control-dynamic-tag.tsx
5575
5554
  var React92 = __toESM(require("react"));
5576
5555
  var import_editor_controls55 = require("@elementor/editor-controls");
5577
- var import_editor_props19 = require("@elementor/editor-props");
5556
+ var import_editor_props18 = require("@elementor/editor-props");
5578
5557
  var import_icons26 = require("@elementor/icons");
5579
5558
 
5580
5559
  // src/dynamics/hooks/use-dynamic-tag.ts
@@ -5603,7 +5582,7 @@ var getAtomicDynamicTags = () => {
5603
5582
  };
5604
5583
 
5605
5584
  // src/dynamics/utils.ts
5606
- var import_editor_props18 = require("@elementor/editor-props");
5585
+ var import_editor_props17 = require("@elementor/editor-props");
5607
5586
  var import_schema = require("@elementor/schema");
5608
5587
  var DYNAMIC_PROP_TYPE_KEY = "dynamic";
5609
5588
  var isDynamicPropType = (prop) => prop.key === DYNAMIC_PROP_TYPE_KEY;
@@ -5612,12 +5591,12 @@ var getDynamicPropType = (propType) => {
5612
5591
  return dynamicPropType && isDynamicPropType(dynamicPropType) ? dynamicPropType : null;
5613
5592
  };
5614
5593
  var isDynamicPropValue = (prop) => {
5615
- return (0, import_editor_props18.isTransformable)(prop) && prop.$$type === DYNAMIC_PROP_TYPE_KEY;
5594
+ return (0, import_editor_props17.isTransformable)(prop) && prop.$$type === DYNAMIC_PROP_TYPE_KEY;
5616
5595
  };
5617
5596
  var supportsDynamic = (propType) => {
5618
5597
  return !!getDynamicPropType(propType);
5619
5598
  };
5620
- var dynamicPropTypeUtil = (0, import_editor_props18.createPropUtils)(
5599
+ var dynamicPropTypeUtil = (0, import_editor_props17.createPropUtils)(
5621
5600
  DYNAMIC_PROP_TYPE_KEY,
5622
5601
  import_schema.z.strictObject({
5623
5602
  name: import_schema.z.string(),
@@ -5669,7 +5648,7 @@ var useDynamicTag = (tagName) => {
5669
5648
  // src/dynamics/components/background-control-dynamic-tag.tsx
5670
5649
  var BackgroundControlDynamicTagIcon = () => /* @__PURE__ */ React92.createElement(import_icons26.DatabaseIcon, { fontSize: "tiny" });
5671
5650
  var BackgroundControlDynamicTagLabel = ({ value }) => {
5672
- const context = (0, import_editor_controls55.useBoundProp)(import_editor_props19.backgroundImageOverlayPropTypeUtil);
5651
+ const context = (0, import_editor_controls55.useBoundProp)(import_editor_props18.backgroundImageOverlayPropTypeUtil);
5673
5652
  return /* @__PURE__ */ React92.createElement(import_editor_controls55.PropProvider, { ...context, value: value.value }, /* @__PURE__ */ React92.createElement(import_editor_controls55.PropKeyProvider, { bind: "image" }, /* @__PURE__ */ React92.createElement(Wrapper, { rawValue: value.value })));
5674
5653
  };
5675
5654
  var Wrapper = ({ rawValue }) => {
@@ -5705,7 +5684,7 @@ var import_editor_controls56 = require("@elementor/editor-controls");
5705
5684
 
5706
5685
  // src/dynamics/components/dynamic-conditional-control.tsx
5707
5686
  var React93 = __toESM(require("react"));
5708
- var import_editor_props20 = require("@elementor/editor-props");
5687
+ var import_editor_props19 = require("@elementor/editor-props");
5709
5688
  var DynamicConditionalControl = ({
5710
5689
  children,
5711
5690
  propType,
@@ -5747,7 +5726,7 @@ var DynamicConditionalControl = ({
5747
5726
  if (!propType?.dependencies?.terms.length) {
5748
5727
  return /* @__PURE__ */ React93.createElement(React93.Fragment, null, children);
5749
5728
  }
5750
- const isHidden = !(0, import_editor_props20.isDependencyMet)(propType?.dependencies, effectiveSettings).isMet;
5729
+ const isHidden = !(0, import_editor_props19.isDependencyMet)(propType?.dependencies, effectiveSettings).isMet;
5751
5730
  return isHidden ? null : /* @__PURE__ */ React93.createElement(React93.Fragment, null, children);
5752
5731
  };
5753
5732
 
@@ -6060,7 +6039,7 @@ function ControlsItemsStack({ items: items3 }) {
6060
6039
 
6061
6040
  // src/dynamics/dynamic-transformer.ts
6062
6041
  var import_editor_canvas4 = require("@elementor/editor-canvas");
6063
- var import_editor_props21 = require("@elementor/editor-props");
6042
+ var import_editor_props20 = require("@elementor/editor-props");
6064
6043
 
6065
6044
  // src/dynamics/errors.ts
6066
6045
  var import_utils10 = require("@elementor/utils");
@@ -6078,7 +6057,7 @@ var dynamicTransformer = (0, import_editor_canvas4.createTransformer)((value) =>
6078
6057
  });
6079
6058
  function simpleTransform(props) {
6080
6059
  const transformed = Object.entries(props).map(([settingKey, settingValue]) => {
6081
- const value = (0, import_editor_props21.isTransformable)(settingValue) ? settingValue.value : settingValue;
6060
+ const value = (0, import_editor_props20.isTransformable)(settingValue) ? settingValue.value : settingValue;
6082
6061
  return [settingKey, value];
6083
6062
  });
6084
6063
  return Object.fromEntries(transformed);