@elementor/editor-controls 0.27.0 → 0.28.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @elementor/editor-controls
2
2
 
3
+ ## 0.28.0
4
+
5
+ ### Minor Changes
6
+
7
+ - f4deb05: Remove divider in Link Control and change Image Control showcases
8
+ - 9e7a3ee: Set Link Control label default empty string
9
+ - baf662e: Fixed when opening and closing link collapsible, publish will not activate
10
+
11
+ ### Patch Changes
12
+
13
+ - ca016cc: Elementor ui update to version 1.34.2, elementor icons update to 1.40.1
14
+ - Updated dependencies [ca016cc]
15
+ - @elementor/editor-ui@0.8.1
16
+
3
17
  ## 0.27.0
4
18
 
5
19
  ### Minor Changes
package/dist/index.d.mts CHANGED
@@ -9,8 +9,9 @@ type ImageControlProps = {
9
9
  value: string;
10
10
  }[];
11
11
  resolutionLabel?: string;
12
+ showMode?: 'all' | 'media' | 'sizes';
12
13
  };
13
- declare const ImageControl: ControlComponent<({ sizes, resolutionLabel }: ImageControlProps) => React.JSX.Element>;
14
+ declare const ImageControl: ControlComponent<({ sizes, resolutionLabel, showMode }: ImageControlProps) => React.JSX.Element>;
14
15
 
15
16
  declare const TextControl: ControlComponent<({ placeholder }: {
16
17
  placeholder?: string;
package/dist/index.d.ts CHANGED
@@ -9,8 +9,9 @@ type ImageControlProps = {
9
9
  value: string;
10
10
  }[];
11
11
  resolutionLabel?: string;
12
+ showMode?: 'all' | 'media' | 'sizes';
12
13
  };
13
- declare const ImageControl: ControlComponent<({ sizes, resolutionLabel }: ImageControlProps) => React.JSX.Element>;
14
+ declare const ImageControl: ControlComponent<({ sizes, resolutionLabel, showMode }: ImageControlProps) => React.JSX.Element>;
14
15
 
15
16
  declare const TextControl: ControlComponent<({ placeholder }: {
16
17
  placeholder?: string;
package/dist/index.js CHANGED
@@ -446,11 +446,11 @@ var SelectControl = createControl(({ options, onChange }) => {
446
446
 
447
447
  // src/controls/image-control.tsx
448
448
  var ImageControl = createControl(
449
- ({ sizes, resolutionLabel = (0, import_i18n2.__)("Image resolution", "elementor") }) => {
449
+ ({ sizes, resolutionLabel = (0, import_i18n2.__)("Image resolution", "elementor"), showMode = "all" }) => {
450
450
  const propContext = useBoundProp(import_editor_props3.imagePropTypeUtil);
451
451
  const { data: allowSvgUpload } = useUnfilteredFilesUpload();
452
452
  const mediaTypes = allowSvgUpload ? ["image", "svg"] : ["image"];
453
- return /* @__PURE__ */ React10.createElement(PropProvider, { ...propContext }, /* @__PURE__ */ React10.createElement(import_ui6.Stack, { gap: 1.5 }, /* @__PURE__ */ React10.createElement(PropKeyProvider, { bind: "src" }, /* @__PURE__ */ React10.createElement(ControlFormLabel, null, " ", (0, import_i18n2.__)("Image", "elementor"), " "), /* @__PURE__ */ React10.createElement(ImageMediaControl, { mediaTypes })), /* @__PURE__ */ React10.createElement(PropKeyProvider, { bind: "size" }, /* @__PURE__ */ React10.createElement(import_ui6.Grid, { container: true, gap: 1.5, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React10.createElement(import_ui6.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React10.createElement(ControlFormLabel, null, " ", resolutionLabel, " ")), /* @__PURE__ */ React10.createElement(import_ui6.Grid, { item: true, xs: 6, sx: { overflow: "hidden" } }, /* @__PURE__ */ React10.createElement(SelectControl, { options: sizes }))))));
453
+ return /* @__PURE__ */ React10.createElement(PropProvider, { ...propContext }, /* @__PURE__ */ React10.createElement(import_ui6.Stack, { gap: 1.5 }, ["all", "media"].includes(showMode) ? /* @__PURE__ */ React10.createElement(PropKeyProvider, { bind: "src" }, /* @__PURE__ */ React10.createElement(ControlFormLabel, null, " ", (0, import_i18n2.__)("Image", "elementor"), " "), /* @__PURE__ */ React10.createElement(ImageMediaControl, { mediaTypes })) : null, ["all", "sizes"].includes(showMode) ? /* @__PURE__ */ React10.createElement(PropKeyProvider, { bind: "size" }, /* @__PURE__ */ React10.createElement(import_ui6.Grid, { container: true, gap: 1.5, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React10.createElement(import_ui6.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React10.createElement(ControlFormLabel, null, " ", resolutionLabel, " ")), /* @__PURE__ */ React10.createElement(import_ui6.Grid, { item: true, xs: 6, sx: { overflow: "hidden" } }, /* @__PURE__ */ React10.createElement(SelectControl, { options: sizes })))) : null));
454
454
  }
455
455
  );
456
456
 
@@ -1879,9 +1879,18 @@ var LinkControl = createControl((props) => {
1879
1879
  if (linkInLinkRestriction.shouldRestrict && !isActive) {
1880
1880
  return;
1881
1881
  }
1882
- setIsActive((prevState) => !prevState);
1883
- setValue(isActive ? null : linkSessionValue?.value ?? null);
1884
- setLinkSessionValue({ value, meta: { isEnabled: !isActive } });
1882
+ const newState = !isActive;
1883
+ setIsActive(newState);
1884
+ if (!newState && value !== null) {
1885
+ setValue(null);
1886
+ }
1887
+ if (newState && linkSessionValue?.value) {
1888
+ setValue(linkSessionValue.value);
1889
+ }
1890
+ setLinkSessionValue({
1891
+ value: newState ? value : linkSessionValue?.value,
1892
+ meta: { isEnabled: newState }
1893
+ });
1885
1894
  };
1886
1895
  const onOptionChange = (newValue) => {
1887
1896
  const valueToSave = newValue ? {
@@ -1896,7 +1905,7 @@ var LinkControl = createControl((props) => {
1896
1905
  const valueToSave = newValue ? {
1897
1906
  ...value,
1898
1907
  destination: import_editor_props16.urlPropTypeUtil.create(newValue),
1899
- label: null
1908
+ label: import_editor_props16.stringPropTypeUtil.create("")
1900
1909
  } : null;
1901
1910
  onSaveNewValue(valueToSave);
1902
1911
  updateOptions(newValue);
@@ -1921,7 +1930,7 @@ var LinkControl = createControl((props) => {
1921
1930
  ),
1922
1931
  [endpoint]
1923
1932
  );
1924
- return /* @__PURE__ */ React34.createElement(PropProvider, { ...propContext, value, setValue }, /* @__PURE__ */ React34.createElement(import_ui27.Stack, { gap: 1.5 }, /* @__PURE__ */ React34.createElement(import_ui27.Divider, null), /* @__PURE__ */ React34.createElement(
1933
+ return /* @__PURE__ */ React34.createElement(PropProvider, { ...propContext, value, setValue }, /* @__PURE__ */ React34.createElement(import_ui27.Stack, { gap: 1.5 }, /* @__PURE__ */ React34.createElement(
1925
1934
  import_ui27.Stack,
1926
1935
  {
1927
1936
  direction: "row",