@elementor/editor-controls 0.27.0 → 0.28.1

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,28 @@
1
1
  # @elementor/editor-controls
2
2
 
3
+ ## 0.28.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 7daaa99: Rename `http` package to `http-client`
8
+ - Updated dependencies [7daaa99]
9
+ - @elementor/http-client@0.2.0
10
+ - @elementor/editor-current-user@0.3.1
11
+
12
+ ## 0.28.0
13
+
14
+ ### Minor Changes
15
+
16
+ - f4deb05: Remove divider in Link Control and change Image Control showcases
17
+ - 9e7a3ee: Set Link Control label default empty string
18
+ - baf662e: Fixed when opening and closing link collapsible, publish will not activate
19
+
20
+ ### Patch Changes
21
+
22
+ - ca016cc: Elementor ui update to version 1.34.2, elementor icons update to 1.40.1
23
+ - Updated dependencies [ca016cc]
24
+ - @elementor/editor-ui@0.8.1
25
+
3
26
  ## 0.27.0
4
27
 
5
28
  ### Minor Changes
@@ -202,7 +225,7 @@
202
225
  - Updated dependencies [f6a4d4f]
203
226
  - @elementor/editor-props@0.9.4
204
227
  - @elementor/wp-media@0.5.0
205
- - @elementor/http@0.1.4
228
+ - @elementor/http-client@0.1.4
206
229
 
207
230
  ## 0.14.0
208
231
 
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
@@ -299,11 +299,11 @@ function createControl(Control5) {
299
299
  var import_query = require("@elementor/query");
300
300
 
301
301
  // src/api.ts
302
- var import_http = require("@elementor/http");
302
+ var import_http_client = require("@elementor/http-client");
303
303
  var ELEMENTOR_SETTING_URL = "elementor/v1/settings";
304
304
  var apiClient = {
305
- getElementorSetting: (key) => (0, import_http.httpService)().get(`${ELEMENTOR_SETTING_URL}/${key}`).then((res) => formatSettingResponse(res.data)),
306
- updateElementorSetting: (key, value) => (0, import_http.httpService)().put(`${ELEMENTOR_SETTING_URL}/${key}`, { value })
305
+ getElementorSetting: (key) => (0, import_http_client.httpService)().get(`${ELEMENTOR_SETTING_URL}/${key}`).then((res) => formatSettingResponse(res.data)),
306
+ updateElementorSetting: (key, value) => (0, import_http_client.httpService)().put(`${ELEMENTOR_SETTING_URL}/${key}`, { value })
307
307
  };
308
308
  var formatSettingResponse = (response) => response.data.value;
309
309
 
@@ -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
 
@@ -1739,7 +1739,7 @@ var import_react13 = require("react");
1739
1739
  var import_editor_elements = require("@elementor/editor-elements");
1740
1740
  var import_editor_props16 = require("@elementor/editor-props");
1741
1741
  var import_editor_ui3 = require("@elementor/editor-ui");
1742
- var import_http2 = require("@elementor/http");
1742
+ var import_http_client2 = require("@elementor/http-client");
1743
1743
  var import_icons7 = require("@elementor/icons");
1744
1744
  var import_session = require("@elementor/session");
1745
1745
  var import_ui27 = require("@elementor/ui");
@@ -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",
@@ -1974,7 +1983,7 @@ async function fetchOptions(ajaxUrl, params) {
1974
1983
  return [];
1975
1984
  }
1976
1985
  try {
1977
- const { data: response } = await (0, import_http2.httpService)().get(ajaxUrl, { params });
1986
+ const { data: response } = await (0, import_http_client2.httpService)().get(ajaxUrl, { params });
1978
1987
  return response.data.value;
1979
1988
  } catch {
1980
1989
  return [];