@elementor/editor-editing-panel 4.1.0-717 → 4.1.0-718

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.mjs CHANGED
@@ -3925,6 +3925,7 @@ var shouldDisplayFlexFields = (display, local) => {
3925
3925
 
3926
3926
  // src/components/style-sections/position-section/position-section.tsx
3927
3927
  import * as React54 from "react";
3928
+ import { useCallback as useCallback2, useEffect as useEffect6, useRef as useRef9 } from "react";
3928
3929
  import { useSessionStorage as useSessionStorage3 } from "@elementor/session";
3929
3930
  import { __ as __32 } from "@wordpress/i18n";
3930
3931
 
@@ -4016,42 +4017,65 @@ var ZIndexField = () => {
4016
4017
  };
4017
4018
 
4018
4019
  // src/components/style-sections/position-section/position-section.tsx
4020
+ var POSITION_STATIC = "static";
4019
4021
  var POSITION_LABEL2 = __32("Position", "elementor");
4020
4022
  var DIMENSIONS_LABEL = __32("Dimensions", "elementor");
4023
+ var POSITION_DEPENDENT_PROP_NAMES = [
4024
+ "inset-block-start",
4025
+ "inset-block-end",
4026
+ "inset-inline-start",
4027
+ "inset-inline-end",
4028
+ "z-index"
4029
+ ];
4030
+ var CLEARED_POSITION_DEPENDENT_VALUES = {
4031
+ "inset-block-start": void 0,
4032
+ "inset-block-end": void 0,
4033
+ "inset-inline-start": void 0,
4034
+ "inset-inline-end": void 0,
4035
+ "z-index": void 0
4036
+ };
4021
4037
  var PositionSection = () => {
4022
4038
  const { value: positionValue } = useStylesField("position", {
4023
4039
  history: { propDisplayName: POSITION_LABEL2 }
4024
4040
  });
4025
- const { values: dimensions, setValues: setDimensions } = useStylesFields([
4026
- "inset-block-start",
4027
- "inset-block-end",
4028
- "inset-inline-start",
4029
- "inset-inline-end"
4030
- ]);
4041
+ const { values: positionDependentValues, setValues: setPositionDependentValues } = useStylesFields([...POSITION_DEPENDENT_PROP_NAMES]);
4031
4042
  const [dimensionsValuesFromHistory, updateDimensionsHistory, clearDimensionsHistory] = usePersistDimensions();
4043
+ const clearPositionDependentProps = useCallback2(() => {
4044
+ const dimensions = {
4045
+ "inset-block-start": positionDependentValues?.["inset-block-start"],
4046
+ "inset-block-end": positionDependentValues?.["inset-block-end"],
4047
+ "inset-inline-start": positionDependentValues?.["inset-inline-start"],
4048
+ "inset-inline-end": positionDependentValues?.["inset-inline-end"]
4049
+ };
4050
+ const meta = { history: { propDisplayName: DIMENSIONS_LABEL } };
4051
+ const hasValuesToClear = Object.values(dimensions).some((v) => v !== null) || positionDependentValues?.["z-index"] !== null;
4052
+ if (hasValuesToClear) {
4053
+ updateDimensionsHistory(dimensions);
4054
+ setPositionDependentValues(CLEARED_POSITION_DEPENDENT_VALUES, meta);
4055
+ }
4056
+ }, [positionDependentValues, updateDimensionsHistory, setPositionDependentValues]);
4057
+ const clearPositionDependentPropsRef = useRef9(clearPositionDependentProps);
4058
+ clearPositionDependentPropsRef.current = clearPositionDependentProps;
4059
+ useEffect6(() => {
4060
+ if (positionValue?.value === POSITION_STATIC || positionValue === null) {
4061
+ clearPositionDependentPropsRef.current();
4062
+ }
4063
+ }, [positionValue]);
4032
4064
  const onPositionChange = (newPosition, previousPosition) => {
4033
4065
  const meta = { history: { propDisplayName: DIMENSIONS_LABEL } };
4034
- if (newPosition === "static") {
4035
- if (dimensions) {
4036
- updateDimensionsHistory(dimensions);
4037
- setDimensions(
4038
- {
4039
- "inset-block-start": void 0,
4040
- "inset-block-end": void 0,
4041
- "inset-inline-start": void 0,
4042
- "inset-inline-end": void 0
4043
- },
4066
+ if (newPosition === POSITION_STATIC) {
4067
+ clearPositionDependentProps();
4068
+ } else if (previousPosition === POSITION_STATIC) {
4069
+ if (dimensionsValuesFromHistory) {
4070
+ setPositionDependentValues(
4071
+ { ...dimensionsValuesFromHistory, "z-index": void 0 },
4044
4072
  meta
4045
4073
  );
4046
- }
4047
- } else if (previousPosition === "static") {
4048
- if (dimensionsValuesFromHistory) {
4049
- setDimensions(dimensionsValuesFromHistory, meta);
4050
4074
  clearDimensionsHistory();
4051
4075
  }
4052
4076
  }
4053
4077
  };
4054
- const isNotStatic = positionValue && positionValue?.value !== "static";
4078
+ const isNotStatic = positionValue && positionValue?.value !== POSITION_STATIC;
4055
4079
  return /* @__PURE__ */ React54.createElement(SectionContent, null, /* @__PURE__ */ React54.createElement(PositionField, { onChange: onPositionChange }), isNotStatic ? /* @__PURE__ */ React54.createElement(React54.Fragment, null, /* @__PURE__ */ React54.createElement(DimensionsField, null), /* @__PURE__ */ React54.createElement(ZIndexField, null)) : null, /* @__PURE__ */ React54.createElement(PanelDivider, null), /* @__PURE__ */ React54.createElement(OffsetField, null));
4056
4080
  };
4057
4081
  var usePersistDimensions = () => {
@@ -4063,7 +4087,7 @@ var usePersistDimensions = () => {
4063
4087
 
4064
4088
  // src/components/style-sections/size-section/size-section.tsx
4065
4089
  import * as React59 from "react";
4066
- import { useRef as useRef9 } from "react";
4090
+ import { useRef as useRef10 } from "react";
4067
4091
  import { AspectRatioControl, PositionControl, SizeControl as SizeControl6 } from "@elementor/editor-controls";
4068
4092
  import { Grid as Grid4, Stack as Stack10 } from "@elementor/ui";
4069
4093
  import { __ as __36 } from "@wordpress/i18n";
@@ -4230,7 +4254,7 @@ var CssSizeProps = [
4230
4254
  ];
4231
4255
  var ASPECT_RATIO_LABEL = __36("Aspect Ratio", "elementor");
4232
4256
  var SizeSection = () => {
4233
- const gridRowRefs = [useRef9(null), useRef9(null), useRef9(null)];
4257
+ const gridRowRefs = [useRef10(null), useRef10(null), useRef10(null)];
4234
4258
  return /* @__PURE__ */ React59.createElement(SectionContent, null, CssSizeProps.map((row, rowIndex) => /* @__PURE__ */ React59.createElement(Grid4, { key: rowIndex, container: true, gap: 2, flexWrap: "nowrap", ref: gridRowRefs[rowIndex] }, row.map((props) => /* @__PURE__ */ React59.createElement(Grid4, { item: true, xs: 6, key: props.bind }, /* @__PURE__ */ React59.createElement(SizeField, { ...props, rowRef: gridRowRefs[rowIndex], extendedOptions: ["auto"] }))))), /* @__PURE__ */ React59.createElement(PanelDivider, null), /* @__PURE__ */ React59.createElement(Stack10, null, /* @__PURE__ */ React59.createElement(OverflowField, null)), /* @__PURE__ */ React59.createElement(StyleTabCollapsibleContent, { fields: ["aspect-ratio", "object-fit"] }, /* @__PURE__ */ React59.createElement(Stack10, { gap: 2, pt: 2 }, /* @__PURE__ */ React59.createElement(StylesField, { bind: "aspect-ratio", propDisplayName: ASPECT_RATIO_LABEL }, /* @__PURE__ */ React59.createElement(AspectRatioControl, { label: ASPECT_RATIO_LABEL })), /* @__PURE__ */ React59.createElement(PanelDivider, null), /* @__PURE__ */ React59.createElement(ObjectFitField, null), /* @__PURE__ */ React59.createElement(StylesField, { bind: "object-position", propDisplayName: __36("Object position", "elementor") }, /* @__PURE__ */ React59.createElement(Grid4, { item: true, xs: 6 }, /* @__PURE__ */ React59.createElement(PositionControl, null))))));
4235
4259
  };
4236
4260
  var SizeField = ({ label, bind, rowRef, extendedOptions }) => {
@@ -4270,12 +4294,12 @@ var ColumnCountField = () => {
4270
4294
 
4271
4295
  // src/components/style-sections/typography-section/column-gap-field.tsx
4272
4296
  import * as React62 from "react";
4273
- import { useRef as useRef10 } from "react";
4297
+ import { useRef as useRef11 } from "react";
4274
4298
  import { SizeControl as SizeControl7 } from "@elementor/editor-controls";
4275
4299
  import { __ as __39 } from "@wordpress/i18n";
4276
4300
  var COLUMN_GAP_LABEL = __39("Column gap", "elementor");
4277
4301
  var ColumnGapField = () => {
4278
- const rowRef = useRef10(null);
4302
+ const rowRef = useRef11(null);
4279
4303
  return /* @__PURE__ */ React62.createElement(StylesField, { bind: "column-gap", propDisplayName: COLUMN_GAP_LABEL }, /* @__PURE__ */ React62.createElement(StylesFieldLayout, { label: COLUMN_GAP_LABEL, ref: rowRef }, /* @__PURE__ */ React62.createElement(SizeControl7, { anchorRef: rowRef })));
4280
4304
  };
4281
4305
 
@@ -4303,12 +4327,12 @@ var FontFamilyField = () => {
4303
4327
 
4304
4328
  // src/components/style-sections/typography-section/font-size-field.tsx
4305
4329
  import * as React64 from "react";
4306
- import { useRef as useRef11 } from "react";
4330
+ import { useRef as useRef12 } from "react";
4307
4331
  import { SizeControl as SizeControl8 } from "@elementor/editor-controls";
4308
4332
  import { __ as __41 } from "@wordpress/i18n";
4309
4333
  var FONT_SIZE_LABEL = __41("Font size", "elementor");
4310
4334
  var FontSizeField = () => {
4311
- const rowRef = useRef11(null);
4335
+ const rowRef = useRef12(null);
4312
4336
  return /* @__PURE__ */ React64.createElement(StylesField, { bind: "font-size", propDisplayName: FONT_SIZE_LABEL }, /* @__PURE__ */ React64.createElement(StylesFieldLayout, { label: FONT_SIZE_LABEL, ref: rowRef }, /* @__PURE__ */ React64.createElement(SizeControl8, { anchorRef: rowRef, ariaLabel: FONT_SIZE_LABEL })));
4313
4337
  };
4314
4338
 
@@ -4358,23 +4382,23 @@ var FontWeightField = () => {
4358
4382
 
4359
4383
  // src/components/style-sections/typography-section/letter-spacing-field.tsx
4360
4384
  import * as React67 from "react";
4361
- import { useRef as useRef12 } from "react";
4385
+ import { useRef as useRef13 } from "react";
4362
4386
  import { SizeControl as SizeControl9 } from "@elementor/editor-controls";
4363
4387
  import { __ as __44 } from "@wordpress/i18n";
4364
4388
  var LETTER_SPACING_LABEL = __44("Letter spacing", "elementor");
4365
4389
  var LetterSpacingField = () => {
4366
- const rowRef = useRef12(null);
4390
+ const rowRef = useRef13(null);
4367
4391
  return /* @__PURE__ */ React67.createElement(StylesField, { bind: "letter-spacing", propDisplayName: LETTER_SPACING_LABEL }, /* @__PURE__ */ React67.createElement(StylesFieldLayout, { label: LETTER_SPACING_LABEL, ref: rowRef }, /* @__PURE__ */ React67.createElement(SizeControl9, { anchorRef: rowRef, min: -Number.MAX_SAFE_INTEGER })));
4368
4392
  };
4369
4393
 
4370
4394
  // src/components/style-sections/typography-section/line-height-field.tsx
4371
4395
  import * as React68 from "react";
4372
- import { useRef as useRef13 } from "react";
4396
+ import { useRef as useRef14 } from "react";
4373
4397
  import { SizeControl as SizeControl10 } from "@elementor/editor-controls";
4374
4398
  import { __ as __45 } from "@wordpress/i18n";
4375
4399
  var LINE_HEIGHT_LABEL = __45("Line height", "elementor");
4376
4400
  var LineHeightField = () => {
4377
- const rowRef = useRef13(null);
4401
+ const rowRef = useRef14(null);
4378
4402
  return /* @__PURE__ */ React68.createElement(StylesField, { bind: "line-height", propDisplayName: LINE_HEIGHT_LABEL }, /* @__PURE__ */ React68.createElement(StylesFieldLayout, { label: LINE_HEIGHT_LABEL, ref: rowRef }, /* @__PURE__ */ React68.createElement(SizeControl10, { anchorRef: rowRef })));
4379
4403
  };
4380
4404
 
@@ -4596,12 +4620,12 @@ var TransformField = () => /* @__PURE__ */ React75.createElement(StylesField, {
4596
4620
 
4597
4621
  // src/components/style-sections/typography-section/word-spacing-field.tsx
4598
4622
  import * as React76 from "react";
4599
- import { useRef as useRef14 } from "react";
4623
+ import { useRef as useRef15 } from "react";
4600
4624
  import { SizeControl as SizeControl11 } from "@elementor/editor-controls";
4601
4625
  import { __ as __52 } from "@wordpress/i18n";
4602
4626
  var WORD_SPACING_LABEL = __52("Word spacing", "elementor");
4603
4627
  var WordSpacingField = () => {
4604
- const rowRef = useRef14(null);
4628
+ const rowRef = useRef15(null);
4605
4629
  return /* @__PURE__ */ React76.createElement(StylesField, { bind: "word-spacing", propDisplayName: WORD_SPACING_LABEL }, /* @__PURE__ */ React76.createElement(StylesFieldLayout, { label: WORD_SPACING_LABEL, ref: rowRef }, /* @__PURE__ */ React76.createElement(SizeControl11, { anchorRef: rowRef, min: -Number.MAX_SAFE_INTEGER })));
4606
4630
  };
4607
4631
 
@@ -4874,7 +4898,7 @@ import { __registerPanel as registerPanel } from "@elementor/editor-panels";
4874
4898
  import { blockCommand } from "@elementor/editor-v1-adapters";
4875
4899
 
4876
4900
  // src/hooks/use-open-editor-panel.ts
4877
- import { useEffect as useEffect6 } from "react";
4901
+ import { useEffect as useEffect7 } from "react";
4878
4902
  import { __privateListenTo as listenTo, commandStartEvent } from "@elementor/editor-v1-adapters";
4879
4903
 
4880
4904
  // src/panel.ts
@@ -4898,7 +4922,7 @@ var isAtomicWidgetSelected = () => {
4898
4922
  // src/hooks/use-open-editor-panel.ts
4899
4923
  var useOpenEditorPanel = () => {
4900
4924
  const { open } = usePanelActions();
4901
- useEffect6(() => {
4925
+ useEffect7(() => {
4902
4926
  return listenTo(commandStartEvent("panel/editor/open"), () => {
4903
4927
  if (isAtomicWidgetSelected()) {
4904
4928
  open();
@@ -4918,12 +4942,12 @@ import { AttributesControl, DisplayConditionsControl } from "@elementor/editor-c
4918
4942
 
4919
4943
  // src/components/promotions/custom-css.tsx
4920
4944
  import * as React82 from "react";
4921
- import { useRef as useRef15 } from "react";
4945
+ import { useRef as useRef16 } from "react";
4922
4946
  import { PromotionTrigger } from "@elementor/editor-controls";
4923
4947
  import { __ as __56 } from "@wordpress/i18n";
4924
4948
  var TRACKING_DATA = { target_name: "custom_css", location_l2: "style" };
4925
4949
  var CustomCssSection = () => {
4926
- const triggerRef = useRef15(null);
4950
+ const triggerRef = useRef16(null);
4927
4951
  return /* @__PURE__ */ React82.createElement(
4928
4952
  StyleTabSection,
4929
4953
  {
@@ -5635,7 +5659,7 @@ var DynamicControl = ({ bind, children }) => {
5635
5659
 
5636
5660
  // src/dynamics/components/dynamic-selection.tsx
5637
5661
  import * as React87 from "react";
5638
- import { Fragment as Fragment14, useEffect as useEffect7, useState as useState10 } from "react";
5662
+ import { Fragment as Fragment14, useEffect as useEffect8, useState as useState10 } from "react";
5639
5663
  import { trackUpgradePromotionClick, trackViewPromotion, useBoundProp as useBoundProp9 } from "@elementor/editor-controls";
5640
5664
  import { CtaButton, PopoverHeader, PopoverMenuList, SearchField, SectionPopoverBody } from "@elementor/editor-ui";
5641
5665
  import { DatabaseIcon as DatabaseIcon2 } from "@elementor/icons";
@@ -5655,7 +5679,7 @@ var DynamicSelection = ({ close: closePopover, expired = false }) => {
5655
5679
  const isCurrentValueDynamic = !!dynamicValue;
5656
5680
  const options12 = useFilteredOptions(searchValue);
5657
5681
  const hasNoDynamicTags = !options12.length && !searchValue.trim();
5658
- useEffect7(() => {
5682
+ useEffect8(() => {
5659
5683
  if (hasNoDynamicTags) {
5660
5684
  trackViewPromotion({ target_name: "dynamic_tags" });
5661
5685
  } else if (expired) {
@@ -6158,7 +6182,7 @@ import { __ as __66 } from "@wordpress/i18n";
6158
6182
 
6159
6183
  // src/styles-inheritance/components/styles-inheritance-infotip.tsx
6160
6184
  import * as React94 from "react";
6161
- import { useMemo as useMemo13, useRef as useRef16, useState as useState12 } from "react";
6185
+ import { useMemo as useMemo13, useRef as useRef17, useState as useState12 } from "react";
6162
6186
  import {
6163
6187
  createPropsResolver as createPropsResolver2,
6164
6188
  stylesInheritanceTransformersRegistry
@@ -6178,7 +6202,7 @@ import {
6178
6202
  import { __ as __65 } from "@wordpress/i18n";
6179
6203
 
6180
6204
  // src/styles-inheritance/hooks/use-normalized-inheritance-chain-items.tsx
6181
- import { isValidElement, useEffect as useEffect8, useState as useState11 } from "react";
6205
+ import { isValidElement, useEffect as useEffect9, useState as useState11 } from "react";
6182
6206
  import { UnknownStyleStateError } from "@elementor/editor-canvas";
6183
6207
  import {
6184
6208
  isClassState as isClassState2,
@@ -6189,7 +6213,7 @@ import { __ as __63 } from "@wordpress/i18n";
6189
6213
  var MAXIMUM_ITEMS = 2;
6190
6214
  var useNormalizedInheritanceChainItems = (inheritanceChain, bind, resolve) => {
6191
6215
  const [items3, setItems] = useState11([]);
6192
- useEffect8(() => {
6216
+ useEffect9(() => {
6193
6217
  (async () => {
6194
6218
  const normalizedItems = await Promise.all(
6195
6219
  inheritanceChain.filter(({ style }) => style).map((item, index) => normalizeInheritanceItem(item, index, bind, resolve))
@@ -6370,7 +6394,7 @@ var StylesInheritanceInfotip = ({
6370
6394
  isDisabled
6371
6395
  }) => {
6372
6396
  const [showInfotip, setShowInfotip] = useState12(false);
6373
- const triggerRef = useRef16(null);
6397
+ const triggerRef = useRef17(null);
6374
6398
  const toggleInfotip = () => {
6375
6399
  if (isDisabled) {
6376
6400
  return;