@elementor/editor-editing-panel 3.33.0-154 → 3.33.0-156

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
@@ -5227,6 +5227,7 @@ var usePersistDynamicValue = (propKey) => {
5227
5227
  // src/dynamics/dynamic-control.tsx
5228
5228
  var React92 = __toESM(require("react"));
5229
5229
  var import_editor_controls56 = require("@elementor/editor-controls");
5230
+ var import_editor_props18 = require("@elementor/editor-props");
5230
5231
  var DynamicControl = ({ bind, children }) => {
5231
5232
  const { value, setValue } = (0, import_editor_controls56.useBoundProp)(dynamicPropTypeUtil);
5232
5233
  const { name = "", settings } = value ?? {};
@@ -5247,7 +5248,28 @@ var DynamicControl = ({ bind, children }) => {
5247
5248
  });
5248
5249
  };
5249
5250
  const propType = createTopLevelObjectType({ schema: dynamicTag.props_schema });
5250
- return /* @__PURE__ */ React92.createElement(import_editor_controls56.PropProvider, { propType, setValue: setDynamicValue, value: { [bind]: dynamicValue } }, /* @__PURE__ */ React92.createElement(import_editor_controls56.PropKeyProvider, { bind }, children));
5251
+ const defaults = React92.useMemo(() => {
5252
+ const entries = Object.entries(dynamicTag.props_schema ?? {});
5253
+ return entries.reduce((result, [key, prop]) => {
5254
+ result[key] = prop?.default ?? null;
5255
+ return result;
5256
+ }, {});
5257
+ }, [dynamicTag.props_schema]);
5258
+ const effectiveSettings = { ...defaults, ...settings ?? {} };
5259
+ const isHidden = !(0, import_editor_props18.isDependencyMet)(dynamicPropType?.dependencies, effectiveSettings);
5260
+ if (isHidden) {
5261
+ return null;
5262
+ }
5263
+ return /* @__PURE__ */ React92.createElement(
5264
+ import_editor_controls56.PropProvider,
5265
+ {
5266
+ propType,
5267
+ setValue: setDynamicValue,
5268
+ value: { [bind]: dynamicValue },
5269
+ isDisabled: (prop) => !(0, import_editor_props18.isDependencyMet)(prop?.dependencies, effectiveSettings)
5270
+ },
5271
+ /* @__PURE__ */ React92.createElement(import_editor_controls56.PropKeyProvider, { bind }, children)
5272
+ );
5251
5273
  };
5252
5274
 
5253
5275
  // src/dynamics/components/dynamic-selection.tsx
@@ -5366,6 +5388,7 @@ var useFilteredOptions = (searchValue) => {
5366
5388
 
5367
5389
  // src/dynamics/components/dynamic-selection-control.tsx
5368
5390
  var SIZE7 = "tiny";
5391
+ var tagsWithoutTabs = ["popup"];
5369
5392
  var DynamicSelectionControl = () => {
5370
5393
  const { setValue: setAnyValue } = (0, import_editor_controls58.useBoundProp)();
5371
5394
  const { bind, value } = (0, import_editor_controls58.useBoundProp)(dynamicPropTypeUtil);
@@ -5437,15 +5460,19 @@ var DynamicSettingsPopover = ({ dynamicTag }) => {
5437
5460
  onClose: popupState.close,
5438
5461
  icon: /* @__PURE__ */ React94.createElement(import_icons27.DatabaseIcon, { fontSize: SIZE7 })
5439
5462
  }
5440
- ), /* @__PURE__ */ React94.createElement(DynamicSettings, { controls: dynamicTag.atomic_controls }))
5463
+ ), /* @__PURE__ */ React94.createElement(DynamicSettings, { controls: dynamicTag.atomic_controls, tagName: dynamicTag.name }))
5441
5464
  ));
5442
5465
  };
5443
- var DynamicSettings = ({ controls }) => {
5466
+ var DynamicSettings = ({ controls, tagName }) => {
5444
5467
  const tabs = controls.filter(({ type }) => type === "section");
5445
5468
  const { getTabsProps, getTabProps, getTabPanelProps } = (0, import_ui47.useTabs)(0);
5446
5469
  if (!tabs.length) {
5447
5470
  return null;
5448
5471
  }
5472
+ if (tagsWithoutTabs.includes(tagName)) {
5473
+ const singleTab = tabs[0];
5474
+ return /* @__PURE__ */ React94.createElement(React94.Fragment, null, /* @__PURE__ */ React94.createElement(import_ui47.Divider, null), /* @__PURE__ */ React94.createElement(ControlsItemsStack, { items: singleTab.value.items }));
5475
+ }
5449
5476
  return /* @__PURE__ */ React94.createElement(React94.Fragment, null, tabs.length > 1 && /* @__PURE__ */ React94.createElement(import_ui47.Tabs, { size: "small", variant: "fullWidth", ...getTabsProps() }, tabs.map(({ value }, index) => /* @__PURE__ */ React94.createElement(
5450
5477
  import_ui47.Tab,
5451
5478
  {
@@ -5462,12 +5489,7 @@ var DynamicSettings = ({ controls }) => {
5462
5489
  sx: { flexGrow: 1, py: 0, overflowY: "auto" },
5463
5490
  ...getTabPanelProps(index)
5464
5491
  },
5465
- /* @__PURE__ */ React94.createElement(import_ui47.Stack, { p: 2, gap: 2 }, value.items.map((item) => {
5466
- if (item.type === "control") {
5467
- return /* @__PURE__ */ React94.createElement(Control3, { key: item.value.bind, control: item.value });
5468
- }
5469
- return null;
5470
- }))
5492
+ /* @__PURE__ */ React94.createElement(ControlsItemsStack, { items: value.items })
5471
5493
  );
5472
5494
  }));
5473
5495
  };
@@ -5476,7 +5498,14 @@ var LAYOUT_OVERRIDE_FIELDS = {
5476
5498
  action: "full",
5477
5499
  off_canvas: "full"
5478
5500
  };
5501
+ var DYNAMIC_TAG_LAYOUT_OVERRIDES = {
5502
+ select: "full"
5503
+ };
5479
5504
  var getLayout = (control) => {
5505
+ const dynamicOverride = DYNAMIC_TAG_LAYOUT_OVERRIDES[control.type];
5506
+ if (dynamicOverride) {
5507
+ return dynamicOverride;
5508
+ }
5480
5509
  return LAYOUT_OVERRIDE_FIELDS[control.bind] ?? controlsRegistry.getLayout(control.type);
5481
5510
  };
5482
5511
  var Control3 = ({ control }) => {
@@ -5484,21 +5513,24 @@ var Control3 = ({ control }) => {
5484
5513
  return null;
5485
5514
  }
5486
5515
  const layout = getLayout(control);
5487
- return /* @__PURE__ */ React94.createElement(DynamicControl, { bind: control.bind }, /* @__PURE__ */ React94.createElement(
5488
- import_ui47.Grid,
5489
- {
5490
- container: true,
5491
- gap: 0.75,
5492
- sx: layout === "two-columns" ? { display: "grid", gridTemplateColumns: "1fr 1fr" } : {}
5493
- },
5494
- control.label ? /* @__PURE__ */ React94.createElement(import_ui47.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React94.createElement(import_editor_controls58.ControlFormLabel, null, control.label)) : null,
5495
- /* @__PURE__ */ React94.createElement(import_ui47.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React94.createElement(Control, { type: control.type, props: control.props }))
5516
+ const shouldDisablePortal = control.type === "select";
5517
+ const controlProps = shouldDisablePortal ? { ...control.props, MenuProps: { ...control.props?.MenuProps ?? {}, disablePortal: true } } : control.props;
5518
+ const isSwitchControl = control.type === "switch";
5519
+ const layoutStyleProps = layout === "two-columns" ? {
5520
+ display: "grid",
5521
+ gridTemplateColumns: isSwitchControl ? "minmax(0, 1fr) max-content" : "1fr 1fr"
5522
+ } : {};
5523
+ return /* @__PURE__ */ React94.createElement(DynamicControl, { bind: control.bind }, /* @__PURE__ */ React94.createElement(import_ui47.Grid, { container: true, gap: 0.75, sx: layoutStyleProps }, control.label ? /* @__PURE__ */ React94.createElement(import_ui47.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React94.createElement(import_editor_controls58.ControlFormLabel, null, control.label)) : null, /* @__PURE__ */ React94.createElement(import_ui47.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React94.createElement(Control, { type: control.type, props: controlProps }))));
5524
+ };
5525
+ function ControlsItemsStack({ items: items3 }) {
5526
+ return /* @__PURE__ */ React94.createElement(import_ui47.Stack, { p: 2, gap: 2, sx: { overflowY: "auto" } }, items3.map(
5527
+ (item) => item.type === "control" ? /* @__PURE__ */ React94.createElement(Control3, { key: item.value.bind, control: item.value }) : null
5496
5528
  ));
5497
- };
5529
+ }
5498
5530
 
5499
5531
  // src/dynamics/dynamic-transformer.ts
5500
5532
  var import_editor_canvas4 = require("@elementor/editor-canvas");
5501
- var import_editor_props18 = require("@elementor/editor-props");
5533
+ var import_editor_props19 = require("@elementor/editor-props");
5502
5534
 
5503
5535
  // src/dynamics/errors.ts
5504
5536
  var import_utils10 = require("@elementor/utils");
@@ -5516,7 +5548,7 @@ var dynamicTransformer = (0, import_editor_canvas4.createTransformer)((value) =>
5516
5548
  });
5517
5549
  function simpleTransform(props) {
5518
5550
  const transformed = Object.entries(props).map(([settingKey, settingValue]) => {
5519
- const value = (0, import_editor_props18.isTransformable)(settingValue) ? settingValue.value : settingValue;
5551
+ const value = (0, import_editor_props19.isTransformable)(settingValue) ? settingValue.value : settingValue;
5520
5552
  return [settingKey, value];
5521
5553
  });
5522
5554
  return Object.fromEntries(transformed);