@elementor/editor-components 4.4.0-1136 → 4.4.0-1138

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
@@ -479,8 +479,8 @@ var componentOverridableTransformer = (0, import_editor_canvas2.createTransforme
479
479
  }
480
480
  );
481
481
  function normalizeOriginValue(originValue) {
482
- const isEmpty = !!originValue && Object.keys(originValue).length === 0;
483
- return isEmpty ? null : originValue;
482
+ const isEmpty2 = !!originValue && Object.keys(originValue).length === 0;
483
+ return isEmpty2 ? null : originValue;
484
484
  }
485
485
  function transformOverride(originValue, options, overrideValue) {
486
486
  const transformer = import_editor_canvas2.settingsTransformersRegistry.get("override");
@@ -737,8 +737,8 @@ function ComponentsList() {
737
737
  if (isLoading) {
738
738
  return /* @__PURE__ */ React5.createElement(LoadingComponents, null);
739
739
  }
740
- const isEmpty = !components?.length;
741
- if (isEmpty) {
740
+ const isEmpty2 = !components?.length;
741
+ if (isEmpty2) {
742
742
  if (searchValue.length) {
743
743
  return /* @__PURE__ */ React5.createElement(EmptySearchResult, null);
744
744
  }
@@ -1644,6 +1644,7 @@ var import_ui13 = require("@elementor/ui");
1644
1644
  var React19 = __toESM(require("react"));
1645
1645
  var import_editor_controls2 = require("@elementor/editor-controls");
1646
1646
  var import_editor_editing_panel3 = require("@elementor/editor-editing-panel");
1647
+ var import_editor_props6 = require("@elementor/editor-props");
1647
1648
  var import_ui12 = require("@elementor/ui");
1648
1649
 
1649
1650
  // src/hooks/use-controls-by-widget-type.ts
@@ -2247,6 +2248,7 @@ function OverrideControl({ overridableProp }) {
2247
2248
  overridableProp.originPropFields ?? overridableProp,
2248
2249
  overridableProp.label
2249
2250
  );
2251
+ const effectiveControlProps = hasInheritedValue(resolvedBaseValue) ? omitPlaceholder(controlProps) : controlProps;
2250
2252
  const propTypeSchema = (0, import_editor_editing_panel3.createTopLevelObjectType)({
2251
2253
  schema: { [overridableProp.overrideKey]: propType }
2252
2254
  });
@@ -2312,7 +2314,7 @@ function OverrideControl({ overridableProp }) {
2312
2314
  baseValue,
2313
2315
  isDisabled
2314
2316
  },
2315
- /* @__PURE__ */ React19.createElement(import_editor_controls2.PropKeyProvider, { bind: overridableProp.overrideKey }, /* @__PURE__ */ React19.createElement(import_editor_controls2.ControlReplacementsProvider, { replacements: controlReplacements }, /* @__PURE__ */ React19.createElement(import_ui12.Box, { mb: 1.5 }, /* @__PURE__ */ React19.createElement(import_editor_editing_panel3.ControlTypeContainer, { layout }, layout !== "custom" && /* @__PURE__ */ React19.createElement(ControlLabel, null, overridableProp.label), /* @__PURE__ */ React19.createElement(OriginalControl, { control, controlProps })))))
2317
+ /* @__PURE__ */ React19.createElement(import_editor_controls2.PropKeyProvider, { bind: overridableProp.overrideKey }, /* @__PURE__ */ React19.createElement(import_editor_controls2.ControlReplacementsProvider, { replacements: controlReplacements }, /* @__PURE__ */ React19.createElement(import_ui12.Box, { mb: 1.5 }, /* @__PURE__ */ React19.createElement(import_editor_editing_panel3.ControlTypeContainer, { layout }, layout !== "custom" && /* @__PURE__ */ React19.createElement(ControlLabel, null, overridableProp.label), /* @__PURE__ */ React19.createElement(OriginalControl, { control, controlProps: effectiveControlProps })))))
2316
2318
  )
2317
2319
  )
2318
2320
  );
@@ -2326,6 +2328,13 @@ function resolveOverrideValues(overrideValue, resolvedOriginValues, propKey) {
2326
2328
  const baseValue = overrideValue || isInheritedDynamic ? null : inheritedValue;
2327
2329
  return { propValue, baseValue };
2328
2330
  }
2331
+ function hasInheritedValue(baseValue) {
2332
+ return !!baseValue && !(0, import_editor_props6.isEmpty)(baseValue);
2333
+ }
2334
+ function omitPlaceholder(controlProps) {
2335
+ const { placeholder: _placeholder, ...rest } = controlProps;
2336
+ return rest;
2337
+ }
2329
2338
  function getTempNewValueForDynamicProp(propType, propValue, newPropValue) {
2330
2339
  const isRemovingOverride = newPropValue === null;
2331
2340
  if (isRemovingOverride && (0, import_editor_editing_panel3.isDynamicPropValue)(propValue)) {
@@ -2406,6 +2415,9 @@ function isValidOverride(overridableProps, override) {
2406
2415
  return !!overridableProps.props[overridableKey];
2407
2416
  }
2408
2417
 
2418
+ // src/components/instance-editing-panel/override-props-group-constants.ts
2419
+ var OVERRIDE_PROPS_GROUP_CONTENT_CLASS = "e-override-props-group__content";
2420
+
2409
2421
  // src/components/instance-editing-panel/override-props-group.tsx
2410
2422
  function OverridePropsGroup({ group }) {
2411
2423
  const [isOpen, setIsOpen] = (0, import_editor_editing_panel4.useStateByElement)(group.id, true);
@@ -2416,31 +2428,39 @@ function OverridePropsGroup({ group }) {
2416
2428
  const labelId = `label-${id}`;
2417
2429
  const contentId = `content-${id}`;
2418
2430
  const title = group.label;
2419
- return /* @__PURE__ */ React20.createElement(import_ui13.Box, { "aria-label": `${title} section` }, /* @__PURE__ */ React20.createElement(
2420
- import_ui13.ListItemButton,
2431
+ return /* @__PURE__ */ React20.createElement(
2432
+ import_ui13.Box,
2421
2433
  {
2422
- id: labelId,
2423
- "aria-controls": contentId,
2424
2434
  "aria-label": `${title} section`,
2425
- onClick: handleClick,
2426
- p: 0,
2427
- sx: { "&:hover": { backgroundColor: "transparent" } }
2435
+ sx: { [`&:has(.${OVERRIDE_PROPS_GROUP_CONTENT_CLASS}:empty)`]: { display: "none" } }
2428
2436
  },
2429
- /* @__PURE__ */ React20.createElement(import_ui13.Stack, { direction: "row", alignItems: "center", justifyItems: "start", flexGrow: 1, gap: 0.5 }, /* @__PURE__ */ React20.createElement(
2430
- import_ui13.ListItemText,
2437
+ /* @__PURE__ */ React20.createElement(
2438
+ import_ui13.ListItemButton,
2431
2439
  {
2432
- secondary: title,
2433
- secondaryTypographyProps: { color: "text.primary", variant: "caption", fontWeight: "bold" },
2434
- sx: { flexGrow: 0, flexShrink: 1, marginInlineEnd: 1 }
2435
- }
2436
- )),
2437
- /* @__PURE__ */ React20.createElement(import_editor_ui6.CollapseIcon, { open: isOpen, color: "secondary", fontSize: "tiny" })
2438
- ), /* @__PURE__ */ React20.createElement(import_ui13.Collapse, { id: contentId, "aria-labelledby": labelId, in: isOpen, timeout: "auto" }, /* @__PURE__ */ React20.createElement(import_ui13.Stack, { direction: "column", gap: 1, p: 2 }, group.props.map((overrideKey) => /* @__PURE__ */ React20.createElement(OverridePropControl, { key: overrideKey, overrideKey })))));
2440
+ id: labelId,
2441
+ "aria-controls": contentId,
2442
+ "aria-label": `${title} section`,
2443
+ onClick: handleClick,
2444
+ p: 0,
2445
+ sx: { "&:hover": { backgroundColor: "transparent" } }
2446
+ },
2447
+ /* @__PURE__ */ React20.createElement(import_ui13.Stack, { direction: "row", alignItems: "center", justifyItems: "start", flexGrow: 1, gap: 0.5 }, /* @__PURE__ */ React20.createElement(
2448
+ import_ui13.ListItemText,
2449
+ {
2450
+ secondary: title,
2451
+ secondaryTypographyProps: { color: "text.primary", variant: "caption", fontWeight: "bold" },
2452
+ sx: { flexGrow: 0, flexShrink: 1, marginInlineEnd: 1 }
2453
+ }
2454
+ )),
2455
+ /* @__PURE__ */ React20.createElement(import_editor_ui6.CollapseIcon, { open: isOpen, color: "secondary", fontSize: "tiny" })
2456
+ ),
2457
+ /* @__PURE__ */ React20.createElement(import_ui13.Collapse, { id: contentId, "aria-labelledby": labelId, in: isOpen, timeout: "auto" }, /* @__PURE__ */ React20.createElement(import_ui13.Stack, { className: OVERRIDE_PROPS_GROUP_CONTENT_CLASS, direction: "column", gap: 1, p: 2 }, group.props.map((overrideKey) => /* @__PURE__ */ React20.createElement(OverridePropControl, { key: overrideKey, overrideKey }))))
2458
+ );
2439
2459
  }
2440
2460
 
2441
2461
  // src/components/instance-editing-panel/instance-panel-body.tsx
2442
- function InstancePanelBody({ groups, isEmpty, emptyState, componentInstanceId }) {
2443
- return /* @__PURE__ */ React21.createElement(import_editor_panels2.PanelBody, null, /* @__PURE__ */ React21.createElement(import_editor_controls3.ControlAdornmentsProvider, { items: (0, import_editor_editing_panel5.getFieldIndicators)("settings") }, isEmpty ? emptyState : /* @__PURE__ */ React21.createElement(import_ui14.Stack, { direction: "column", alignItems: "stretch" }, groups.map((group) => /* @__PURE__ */ React21.createElement(React21.Fragment, { key: group.id + componentInstanceId }, /* @__PURE__ */ React21.createElement(OverridePropsGroup, { group }), /* @__PURE__ */ React21.createElement(import_ui14.Divider, null))))));
2462
+ function InstancePanelBody({ groups, isEmpty: isEmpty2, emptyState, componentInstanceId }) {
2463
+ return /* @__PURE__ */ React21.createElement(import_editor_panels2.PanelBody, null, /* @__PURE__ */ React21.createElement(import_editor_controls3.ControlAdornmentsProvider, { items: (0, import_editor_editing_panel5.getFieldIndicators)("settings") }, isEmpty2 ? emptyState : /* @__PURE__ */ React21.createElement(import_ui14.Stack, { direction: "column", alignItems: "stretch" }, groups.map((group) => /* @__PURE__ */ React21.createElement(React21.Fragment, { key: group.id + componentInstanceId }, /* @__PURE__ */ React21.createElement(OverridePropsGroup, { group }), /* @__PURE__ */ React21.createElement(import_ui14.Divider, null))))));
2444
2464
  }
2445
2465
 
2446
2466
  // src/components/instance-editing-panel/use-instance-panel-data.ts
@@ -2500,8 +2520,8 @@ function useInstancePanelData() {
2500
2520
  }
2501
2521
  const isNonEmptyGroup = (group) => group !== null && group.props.length > 0;
2502
2522
  const groups = overridableProps.groups.order.map((groupId) => overridableProps.groups.items[groupId] ?? null).filter(isNonEmptyGroup);
2503
- const isEmpty = groups.length === 0 || Object.keys(overridableProps.props).length === 0;
2504
- return { componentId, component, overrides, overridableProps, groups, isEmpty, componentInstanceId };
2523
+ const isEmpty2 = groups.length === 0 || Object.keys(overridableProps.props).length === 0;
2524
+ return { componentId, component, overrides, overridableProps, groups, isEmpty: isEmpty2, componentInstanceId };
2505
2525
  }
2506
2526
  function useComponentInstanceSettings() {
2507
2527
  const { element, settings } = (0, import_editor_editing_panel6.useElement)();
@@ -2516,7 +2536,7 @@ function InstanceEditingPanel() {
2516
2536
  if (!data) {
2517
2537
  return null;
2518
2538
  }
2519
- const { componentId, component, overrides, overridableProps, groups, isEmpty, componentInstanceId } = data;
2539
+ const { componentId, component, overrides, overridableProps, groups, isEmpty: isEmpty2, componentInstanceId } = data;
2520
2540
  const panelTitle = (0, import_i18n12.__)("Edit %s", "elementor").replace("%s", component.name);
2521
2541
  const actions = /* @__PURE__ */ React22.createElement(import_ui15.Stack, { direction: "row", gap: 0.5 }, /* @__PURE__ */ React22.createElement(DetachAction, { componentInstanceId, componentId }), canEdit && /* @__PURE__ */ React22.createElement(EditComponentAction, { disabled: true, label: panelTitle, icon: import_icons11.PencilIcon }));
2522
2542
  return /* @__PURE__ */ React22.createElement(import_ui15.Box, { "data-testid": "instance-editing-panel", sx: { display: "flex", flexDirection: "column", height: "100%" } }, /* @__PURE__ */ React22.createElement(
@@ -2531,7 +2551,7 @@ function InstanceEditingPanel() {
2531
2551
  InstancePanelBody,
2532
2552
  {
2533
2553
  groups,
2534
- isEmpty,
2554
+ isEmpty: isEmpty2,
2535
2555
  emptyState: /* @__PURE__ */ React22.createElement(EmptyState2, null),
2536
2556
  componentInstanceId
2537
2557
  }