@elementor/editor-controls 0.2.0 → 0.3.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,17 @@
1
1
  # @elementor/editor-controls
2
2
 
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - ff35b95: Added Gaps field with a control, proptype and a transformer
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [8943189]
12
+ - Updated dependencies [ff35b95]
13
+ - @elementor/editor-props@0.5.0
14
+
3
15
  ## 0.2.0
4
16
 
5
17
  ### Minor Changes
package/dist/index.d.mts CHANGED
@@ -120,6 +120,10 @@ declare const UrlControl: ControlComponent<({ placeholder }: {
120
120
 
121
121
  declare const LinkControl: ControlComponent<() => React.JSX.Element>;
122
122
 
123
+ declare const GapControl: ControlComponent<({ label }: {
124
+ label: string;
125
+ }) => React.JSX.Element>;
126
+
123
127
  declare const ControlLabel: ({ children }: {
124
128
  children: React.ReactNode;
125
129
  }) => React.JSX.Element;
@@ -174,4 +178,4 @@ type UseInternalStateOptions<TValue> = {
174
178
  };
175
179
  declare const useSyncExternalState: <TValue>({ external, setExternal, persistWhen, fallback, }: UseInternalStateOptions<TValue>) => readonly [TValue, (setter: ((value: TValue) => TValue) | TValue) => void];
176
180
 
177
- export { BackgroundOverlayRepeaterControl, BoundPropProvider, BoxShadowRepeaterControl, ColorControl, ControlActionsProvider, type ControlComponent, ControlLabel, ControlReplacementProvider, ControlToggleButtonGroup, type EqualUnequalItems, EqualUnequalSizesControl, FontFamilyControl, ImageControl, LinkControl, LinkedDimensionsControl, NumberControl, SelectControl, SizeControl, StrokeControl, TextAreaControl, TextControl, type ToggleButtonGroupItem, ToggleControl, UrlControl, createControlReplacement, useBoundProp, useControlActions, useSyncExternalState };
181
+ export { BackgroundOverlayRepeaterControl, BoundPropProvider, BoxShadowRepeaterControl, ColorControl, ControlActionsProvider, type ControlComponent, ControlLabel, ControlReplacementProvider, ControlToggleButtonGroup, type EqualUnequalItems, EqualUnequalSizesControl, FontFamilyControl, GapControl, ImageControl, LinkControl, LinkedDimensionsControl, NumberControl, SelectControl, SizeControl, StrokeControl, TextAreaControl, TextControl, type ToggleButtonGroupItem, ToggleControl, UrlControl, createControlReplacement, useBoundProp, useControlActions, useSyncExternalState };
package/dist/index.d.ts CHANGED
@@ -120,6 +120,10 @@ declare const UrlControl: ControlComponent<({ placeholder }: {
120
120
 
121
121
  declare const LinkControl: ControlComponent<() => React.JSX.Element>;
122
122
 
123
+ declare const GapControl: ControlComponent<({ label }: {
124
+ label: string;
125
+ }) => React.JSX.Element>;
126
+
123
127
  declare const ControlLabel: ({ children }: {
124
128
  children: React.ReactNode;
125
129
  }) => React.JSX.Element;
@@ -174,4 +178,4 @@ type UseInternalStateOptions<TValue> = {
174
178
  };
175
179
  declare const useSyncExternalState: <TValue>({ external, setExternal, persistWhen, fallback, }: UseInternalStateOptions<TValue>) => readonly [TValue, (setter: ((value: TValue) => TValue) | TValue) => void];
176
180
 
177
- export { BackgroundOverlayRepeaterControl, BoundPropProvider, BoxShadowRepeaterControl, ColorControl, ControlActionsProvider, type ControlComponent, ControlLabel, ControlReplacementProvider, ControlToggleButtonGroup, type EqualUnequalItems, EqualUnequalSizesControl, FontFamilyControl, ImageControl, LinkControl, LinkedDimensionsControl, NumberControl, SelectControl, SizeControl, StrokeControl, TextAreaControl, TextControl, type ToggleButtonGroupItem, ToggleControl, UrlControl, createControlReplacement, useBoundProp, useControlActions, useSyncExternalState };
181
+ export { BackgroundOverlayRepeaterControl, BoundPropProvider, BoxShadowRepeaterControl, ColorControl, ControlActionsProvider, type ControlComponent, ControlLabel, ControlReplacementProvider, ControlToggleButtonGroup, type EqualUnequalItems, EqualUnequalSizesControl, FontFamilyControl, GapControl, ImageControl, LinkControl, LinkedDimensionsControl, NumberControl, SelectControl, SizeControl, StrokeControl, TextAreaControl, TextControl, type ToggleButtonGroupItem, ToggleControl, UrlControl, createControlReplacement, useBoundProp, useControlActions, useSyncExternalState };
package/dist/index.js CHANGED
@@ -28,8 +28,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
 
30
30
  // src/index.ts
31
- var src_exports = {};
32
- __export(src_exports, {
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
33
  BackgroundOverlayRepeaterControl: () => BackgroundOverlayRepeaterControl,
34
34
  BoundPropProvider: () => BoundPropProvider,
35
35
  BoxShadowRepeaterControl: () => BoxShadowRepeaterControl,
@@ -40,6 +40,7 @@ __export(src_exports, {
40
40
  ControlToggleButtonGroup: () => ControlToggleButtonGroup,
41
41
  EqualUnequalSizesControl: () => EqualUnequalSizesControl,
42
42
  FontFamilyControl: () => FontFamilyControl,
43
+ GapControl: () => GapControl,
43
44
  ImageControl: () => ImageControl,
44
45
  LinkControl: () => LinkControl,
45
46
  LinkedDimensionsControl: () => LinkedDimensionsControl,
@@ -56,7 +57,7 @@ __export(src_exports, {
56
57
  useControlActions: () => useControlActions,
57
58
  useSyncExternalState: () => useSyncExternalState
58
59
  });
59
- module.exports = __toCommonJS(src_exports);
60
+ module.exports = __toCommonJS(index_exports);
60
61
 
61
62
  // src/controls/image-control.tsx
62
63
  var React9 = __toESM(require("react"));
@@ -1389,6 +1390,63 @@ var LinkControl = createControl(() => {
1389
1390
  var SwitchControl = ({ value, onSwitch }) => {
1390
1391
  return /* @__PURE__ */ React26.createElement(import_ui22.Grid, { container: true, alignItems: "center", flexWrap: "nowrap", justifyContent: "space-between" }, /* @__PURE__ */ React26.createElement(import_ui22.Grid, { item: true }, /* @__PURE__ */ React26.createElement(ControlLabel, null, (0, import_i18n11.__)("Open in new tab", "elementor"))), /* @__PURE__ */ React26.createElement(import_ui22.Grid, { item: true }, /* @__PURE__ */ React26.createElement(import_ui22.Switch, { checked: value, onChange: onSwitch })));
1391
1392
  };
1393
+
1394
+ // src/controls/gap-control.tsx
1395
+ var React27 = __toESM(require("react"));
1396
+ var import_editor_props16 = require("@elementor/editor-props");
1397
+ var import_icons6 = require("@elementor/icons");
1398
+ var import_ui23 = require("@elementor/ui");
1399
+ var import_i18n12 = require("@wordpress/i18n");
1400
+ var GapControl = createControl(({ label }) => {
1401
+ const { value, setValue } = useBoundProp(import_editor_props16.gapPropTypeUtil);
1402
+ const { column, row, isLinked = true } = value || {};
1403
+ const setLinkedValue = (gap, newValue) => {
1404
+ const updatedValue = {
1405
+ isLinked,
1406
+ column: isLinked ? newValue : column,
1407
+ row: isLinked ? newValue : row,
1408
+ [gap]: newValue
1409
+ };
1410
+ setValue(updatedValue);
1411
+ };
1412
+ const toggleLinked = () => {
1413
+ const updatedValue = {
1414
+ isLinked: !isLinked,
1415
+ column,
1416
+ row: !isLinked ? column : row
1417
+ };
1418
+ setValue(updatedValue);
1419
+ };
1420
+ const LinkedIcon = isLinked ? import_icons6.LinkIcon : import_icons6.DetachIcon;
1421
+ return /* @__PURE__ */ React27.createElement(React27.Fragment, null, /* @__PURE__ */ React27.createElement(import_ui23.Stack, { direction: "row", gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React27.createElement(ControlLabel, null, label), /* @__PURE__ */ React27.createElement(
1422
+ import_ui23.ToggleButton,
1423
+ {
1424
+ "aria-label": (0, import_i18n12.__)("Link Inputs", "elementor"),
1425
+ size: "tiny",
1426
+ value: "check",
1427
+ selected: isLinked,
1428
+ sx: { marginLeft: "auto" },
1429
+ onChange: toggleLinked
1430
+ },
1431
+ /* @__PURE__ */ React27.createElement(LinkedIcon, { fontSize: "tiny" })
1432
+ )), /* @__PURE__ */ React27.createElement(import_ui23.Stack, { direction: "row", gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React27.createElement(import_ui23.Grid, { container: true, gap: 1, alignItems: "center" }, /* @__PURE__ */ React27.createElement(import_ui23.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React27.createElement(ControlLabel, null, (0, import_i18n12.__)("Column", "elementor"))), /* @__PURE__ */ React27.createElement(import_ui23.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React27.createElement(
1433
+ BoundPropProvider,
1434
+ {
1435
+ setValue: (newValue) => setLinkedValue("column", newValue),
1436
+ value: column,
1437
+ bind: "column"
1438
+ },
1439
+ /* @__PURE__ */ React27.createElement(SizeControl, null)
1440
+ ))), /* @__PURE__ */ React27.createElement(import_ui23.Grid, { container: true, gap: 1, alignItems: "center" }, /* @__PURE__ */ React27.createElement(import_ui23.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React27.createElement(ControlLabel, null, (0, import_i18n12.__)("Row", "elementor"))), /* @__PURE__ */ React27.createElement(import_ui23.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React27.createElement(
1441
+ BoundPropProvider,
1442
+ {
1443
+ setValue: (newValue) => setLinkedValue("row", newValue),
1444
+ value: row,
1445
+ bind: "row"
1446
+ },
1447
+ /* @__PURE__ */ React27.createElement(SizeControl, null)
1448
+ )))));
1449
+ });
1392
1450
  // Annotate the CommonJS export names for ESM import in node:
1393
1451
  0 && (module.exports = {
1394
1452
  BackgroundOverlayRepeaterControl,
@@ -1401,6 +1459,7 @@ var SwitchControl = ({ value, onSwitch }) => {
1401
1459
  ControlToggleButtonGroup,
1402
1460
  EqualUnequalSizesControl,
1403
1461
  FontFamilyControl,
1462
+ GapControl,
1404
1463
  ImageControl,
1405
1464
  LinkControl,
1406
1465
  LinkedDimensionsControl,