@elementor/editor-controls 0.2.0 → 0.3.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/dist/index.mjs CHANGED
@@ -176,9 +176,10 @@ var ImageMediaControl = createControl(() => {
176
176
  import * as React8 from "react";
177
177
  import { stringPropTypeUtil } from "@elementor/editor-props";
178
178
  import { MenuItem, Select } from "@elementor/ui";
179
- var SelectControl = createControl(({ options }) => {
179
+ var SelectControl = createControl(({ options, onChange }) => {
180
180
  const { value, setValue } = useBoundProp(stringPropTypeUtil);
181
181
  const handleChange = (event) => {
182
+ onChange?.(event.target.value, value);
182
183
  setValue(event.target.value);
183
184
  };
184
185
  return /* @__PURE__ */ React8.createElement(ControlActions, null, /* @__PURE__ */ React8.createElement(Select, { displayEmpty: true, size: "tiny", value: value ?? "", onChange: handleChange, fullWidth: true }, options.map(({ label, ...props }) => /* @__PURE__ */ React8.createElement(MenuItem, { key: props.value, ...props }, label))));
@@ -1368,6 +1369,63 @@ var LinkControl = createControl(() => {
1368
1369
  var SwitchControl = ({ value, onSwitch }) => {
1369
1370
  return /* @__PURE__ */ React26.createElement(Grid7, { container: true, alignItems: "center", flexWrap: "nowrap", justifyContent: "space-between" }, /* @__PURE__ */ React26.createElement(Grid7, { item: true }, /* @__PURE__ */ React26.createElement(ControlLabel, null, __11("Open in new tab", "elementor"))), /* @__PURE__ */ React26.createElement(Grid7, { item: true }, /* @__PURE__ */ React26.createElement(Switch, { checked: value, onChange: onSwitch })));
1370
1371
  };
1372
+
1373
+ // src/controls/gap-control.tsx
1374
+ import * as React27 from "react";
1375
+ import { gapPropTypeUtil } from "@elementor/editor-props";
1376
+ import { DetachIcon as DetachIcon2, LinkIcon as LinkIcon2 } from "@elementor/icons";
1377
+ import { Grid as Grid8, Stack as Stack11, ToggleButton as ToggleButton4 } from "@elementor/ui";
1378
+ import { __ as __12 } from "@wordpress/i18n";
1379
+ var GapControl = createControl(({ label }) => {
1380
+ const { value, setValue } = useBoundProp(gapPropTypeUtil);
1381
+ const { column, row, isLinked = true } = value || {};
1382
+ const setLinkedValue = (gap, newValue) => {
1383
+ const updatedValue = {
1384
+ isLinked,
1385
+ column: isLinked ? newValue : column,
1386
+ row: isLinked ? newValue : row,
1387
+ [gap]: newValue
1388
+ };
1389
+ setValue(updatedValue);
1390
+ };
1391
+ const toggleLinked = () => {
1392
+ const updatedValue = {
1393
+ isLinked: !isLinked,
1394
+ column,
1395
+ row: !isLinked ? column : row
1396
+ };
1397
+ setValue(updatedValue);
1398
+ };
1399
+ const LinkedIcon = isLinked ? LinkIcon2 : DetachIcon2;
1400
+ return /* @__PURE__ */ React27.createElement(React27.Fragment, null, /* @__PURE__ */ React27.createElement(Stack11, { direction: "row", gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React27.createElement(ControlLabel, null, label), /* @__PURE__ */ React27.createElement(
1401
+ ToggleButton4,
1402
+ {
1403
+ "aria-label": __12("Link Inputs", "elementor"),
1404
+ size: "tiny",
1405
+ value: "check",
1406
+ selected: isLinked,
1407
+ sx: { marginLeft: "auto" },
1408
+ onChange: toggleLinked
1409
+ },
1410
+ /* @__PURE__ */ React27.createElement(LinkedIcon, { fontSize: "tiny" })
1411
+ )), /* @__PURE__ */ React27.createElement(Stack11, { direction: "row", gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React27.createElement(Grid8, { container: true, gap: 1, alignItems: "center" }, /* @__PURE__ */ React27.createElement(Grid8, { item: true, xs: 12 }, /* @__PURE__ */ React27.createElement(ControlLabel, null, __12("Column", "elementor"))), /* @__PURE__ */ React27.createElement(Grid8, { item: true, xs: 12 }, /* @__PURE__ */ React27.createElement(
1412
+ BoundPropProvider,
1413
+ {
1414
+ setValue: (newValue) => setLinkedValue("column", newValue),
1415
+ value: column,
1416
+ bind: "column"
1417
+ },
1418
+ /* @__PURE__ */ React27.createElement(SizeControl, null)
1419
+ ))), /* @__PURE__ */ React27.createElement(Grid8, { container: true, gap: 1, alignItems: "center" }, /* @__PURE__ */ React27.createElement(Grid8, { item: true, xs: 12 }, /* @__PURE__ */ React27.createElement(ControlLabel, null, __12("Row", "elementor"))), /* @__PURE__ */ React27.createElement(Grid8, { item: true, xs: 12 }, /* @__PURE__ */ React27.createElement(
1420
+ BoundPropProvider,
1421
+ {
1422
+ setValue: (newValue) => setLinkedValue("row", newValue),
1423
+ value: row,
1424
+ bind: "row"
1425
+ },
1426
+ /* @__PURE__ */ React27.createElement(SizeControl, null)
1427
+ )))));
1428
+ });
1371
1429
  export {
1372
1430
  BackgroundOverlayRepeaterControl,
1373
1431
  BoundPropProvider,
@@ -1379,6 +1437,7 @@ export {
1379
1437
  ControlToggleButtonGroup,
1380
1438
  EqualUnequalSizesControl,
1381
1439
  FontFamilyControl,
1440
+ GapControl,
1382
1441
  ImageControl,
1383
1442
  LinkControl,
1384
1443
  LinkedDimensionsControl,