@elementor/editor-editing-panel 0.16.0 → 0.17.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 +12 -0
- package/dist/index.js +147 -89
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +143 -85
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/components/style-sections/typography-section/text-alignment-control.tsx +43 -0
- package/src/components/style-sections/typography-section/typography-section.tsx +2 -0
- package/src/dynamics/components/dynamic-selection-control.tsx +3 -2
- package/src/dynamics/components/dynamic-selection.tsx +19 -8
- package/src/dynamics/hooks/use-prop-value-history.ts +26 -0
- package/src/dynamics/utils.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 0.17.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- e4f30e9: Restore previous value from session when removing the dynamic value.
|
|
8
|
+
- 658f569: added `TextAlignmentControl`
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies [59c991b]
|
|
13
|
+
- @elementor/editor-style@0.4.0
|
|
14
|
+
|
|
3
15
|
## 0.16.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/dist/index.js
CHANGED
|
@@ -64,8 +64,8 @@ function useControl(defaultValue) {
|
|
|
64
64
|
var import_editor_panels2 = require("@elementor/editor-panels");
|
|
65
65
|
|
|
66
66
|
// src/components/editing-panel.tsx
|
|
67
|
-
var
|
|
68
|
-
var
|
|
67
|
+
var React37 = __toESM(require("react"));
|
|
68
|
+
var import_i18n18 = require("@wordpress/i18n");
|
|
69
69
|
|
|
70
70
|
// src/hooks/use-selected-elements.ts
|
|
71
71
|
var import_editor_v1_adapters = require("@elementor/editor-v1-adapters");
|
|
@@ -150,8 +150,8 @@ function useElementContext() {
|
|
|
150
150
|
|
|
151
151
|
// src/components/editing-panel-tabs.tsx
|
|
152
152
|
var import_ui22 = require("@elementor/ui");
|
|
153
|
-
var
|
|
154
|
-
var
|
|
153
|
+
var React36 = __toESM(require("react"));
|
|
154
|
+
var import_i18n17 = require("@wordpress/i18n");
|
|
155
155
|
|
|
156
156
|
// src/components/settings-tab.tsx
|
|
157
157
|
var React13 = __toESM(require("react"));
|
|
@@ -397,7 +397,7 @@ var TextFieldInnerSelection = ({
|
|
|
397
397
|
);
|
|
398
398
|
};
|
|
399
399
|
var SelectionEndAdornment = ({
|
|
400
|
-
options:
|
|
400
|
+
options: options3,
|
|
401
401
|
onClick,
|
|
402
402
|
value
|
|
403
403
|
}) => {
|
|
@@ -406,7 +406,7 @@ var SelectionEndAdornment = ({
|
|
|
406
406
|
popupId: (0, import_react5.useId)()
|
|
407
407
|
});
|
|
408
408
|
const handleMenuItemClick = (index) => {
|
|
409
|
-
onClick(
|
|
409
|
+
onClick(options3[index]);
|
|
410
410
|
popupState.close();
|
|
411
411
|
};
|
|
412
412
|
return /* @__PURE__ */ React9.createElement(import_ui7.InputAdornment, { position: "end" }, /* @__PURE__ */ React9.createElement(
|
|
@@ -418,7 +418,7 @@ var SelectionEndAdornment = ({
|
|
|
418
418
|
...(0, import_ui7.bindTrigger)(popupState)
|
|
419
419
|
},
|
|
420
420
|
value.toUpperCase()
|
|
421
|
-
), /* @__PURE__ */ React9.createElement(import_ui7.Menu, { MenuListProps: { dense: true }, ...(0, import_ui7.bindMenu)(popupState) },
|
|
421
|
+
), /* @__PURE__ */ React9.createElement(import_ui7.Menu, { MenuListProps: { dense: true }, ...(0, import_ui7.bindMenu)(popupState) }, options3.map((option, index) => /* @__PURE__ */ React9.createElement(import_ui7.MenuItem, { key: option, onClick: () => handleMenuItemClick(index) }, option.toUpperCase()))));
|
|
422
422
|
};
|
|
423
423
|
|
|
424
424
|
// src/controls/control-types/size-control.tsx
|
|
@@ -469,12 +469,12 @@ var SizeControl = ({ units = defaultUnits, placeholder, startIcon }) => {
|
|
|
469
469
|
// src/controls/control-types/select-control.tsx
|
|
470
470
|
var React11 = __toESM(require("react"));
|
|
471
471
|
var import_ui9 = require("@elementor/ui");
|
|
472
|
-
var SelectControl = ({ options:
|
|
472
|
+
var SelectControl = ({ options: options3 }) => {
|
|
473
473
|
const { value, setValue } = useControl();
|
|
474
474
|
const handleChange = (event) => {
|
|
475
475
|
setValue(event.target.value);
|
|
476
476
|
};
|
|
477
|
-
return /* @__PURE__ */ React11.createElement(import_ui9.Select, { size: "tiny", value: value ?? "", onChange: handleChange },
|
|
477
|
+
return /* @__PURE__ */ React11.createElement(import_ui9.Select, { size: "tiny", value: value ?? "", onChange: handleChange }, options3.map(({ label, ...props }) => /* @__PURE__ */ React11.createElement(import_ui9.MenuItem, { key: props.value, ...props }, label)));
|
|
478
478
|
};
|
|
479
479
|
|
|
480
480
|
// src/controls/controls-registry.tsx
|
|
@@ -530,7 +530,7 @@ var Control2 = ({ control }) => {
|
|
|
530
530
|
};
|
|
531
531
|
|
|
532
532
|
// src/components/style-tab.tsx
|
|
533
|
-
var
|
|
533
|
+
var React35 = __toESM(require("react"));
|
|
534
534
|
|
|
535
535
|
// src/contexts/style-context.tsx
|
|
536
536
|
var React14 = __toESM(require("react"));
|
|
@@ -662,7 +662,7 @@ var Control3 = ({ label, bind }) => {
|
|
|
662
662
|
};
|
|
663
663
|
|
|
664
664
|
// src/components/style-sections/typography-section/typography-section.tsx
|
|
665
|
-
var
|
|
665
|
+
var React29 = __toESM(require("react"));
|
|
666
666
|
var import_ui16 = require("@elementor/ui");
|
|
667
667
|
|
|
668
668
|
// src/components/style-sections/typography-section/text-style-control.tsx
|
|
@@ -730,7 +730,7 @@ var ToggleButton = ({ onChange, ...props }) => {
|
|
|
730
730
|
};
|
|
731
731
|
|
|
732
732
|
// src/components/style-sections/typography-section/typography-section.tsx
|
|
733
|
-
var
|
|
733
|
+
var import_i18n12 = require("@wordpress/i18n");
|
|
734
734
|
|
|
735
735
|
// src/components/style-sections/typography-section/font-size-control.tsx
|
|
736
736
|
var React18 = __toESM(require("react"));
|
|
@@ -855,7 +855,7 @@ var ControlToggleButtonGroup = ({
|
|
|
855
855
|
};
|
|
856
856
|
|
|
857
857
|
// src/controls/control-types/toggle-control.tsx
|
|
858
|
-
var ToggleControl = ({ options:
|
|
858
|
+
var ToggleControl = ({ options: options3 }) => {
|
|
859
859
|
const { value, setValue } = useControl();
|
|
860
860
|
const handleToggle = (option) => {
|
|
861
861
|
setValue(option || void 0);
|
|
@@ -863,7 +863,7 @@ var ToggleControl = ({ options: options2 }) => {
|
|
|
863
863
|
return /* @__PURE__ */ React26.createElement(
|
|
864
864
|
ControlToggleButtonGroup,
|
|
865
865
|
{
|
|
866
|
-
items:
|
|
866
|
+
items: options3,
|
|
867
867
|
value: value || null,
|
|
868
868
|
onChange: handleToggle,
|
|
869
869
|
exclusive: true
|
|
@@ -882,21 +882,51 @@ var TransformControl = () => {
|
|
|
882
882
|
return /* @__PURE__ */ React27.createElement(ControlContainer, null, /* @__PURE__ */ React27.createElement(StyleControl.Label, null, (0, import_i18n10.__)("Transform", "elementor")), /* @__PURE__ */ React27.createElement(StyleControl, { bind: "text-transform" }, /* @__PURE__ */ React27.createElement(ToggleControl, { options })));
|
|
883
883
|
};
|
|
884
884
|
|
|
885
|
+
// src/components/style-sections/typography-section/text-alignment-control.tsx
|
|
886
|
+
var React28 = __toESM(require("react"));
|
|
887
|
+
var import_icons5 = require("@elementor/icons");
|
|
888
|
+
var import_i18n11 = require("@wordpress/i18n");
|
|
889
|
+
var options2 = [
|
|
890
|
+
{
|
|
891
|
+
value: "left",
|
|
892
|
+
label: (0, import_i18n11.__)("Left", "elementor"),
|
|
893
|
+
icon: import_icons5.AlignLeftIcon
|
|
894
|
+
},
|
|
895
|
+
{
|
|
896
|
+
value: "center",
|
|
897
|
+
label: (0, import_i18n11.__)("Center", "elementor"),
|
|
898
|
+
icon: import_icons5.AlignCenterIcon
|
|
899
|
+
},
|
|
900
|
+
{
|
|
901
|
+
value: "right",
|
|
902
|
+
label: (0, import_i18n11.__)("Right", "elementor"),
|
|
903
|
+
icon: import_icons5.AlignRightIcon
|
|
904
|
+
},
|
|
905
|
+
{
|
|
906
|
+
value: "justify",
|
|
907
|
+
label: (0, import_i18n11.__)("Justify", "elementor"),
|
|
908
|
+
icon: import_icons5.AlignJustifiedIcon
|
|
909
|
+
}
|
|
910
|
+
];
|
|
911
|
+
var TextAlignmentControl = () => {
|
|
912
|
+
return /* @__PURE__ */ React28.createElement(ControlContainer, null, /* @__PURE__ */ React28.createElement(StyleControl.Label, null, (0, import_i18n11.__)("Alignment", "elementor")), /* @__PURE__ */ React28.createElement(StyleControl, { bind: "text-align" }, /* @__PURE__ */ React28.createElement(ToggleControl, { options: options2 })));
|
|
913
|
+
};
|
|
914
|
+
|
|
885
915
|
// src/components/style-sections/typography-section/typography-section.tsx
|
|
886
916
|
var TypographySection = () => {
|
|
887
|
-
return /* @__PURE__ */
|
|
917
|
+
return /* @__PURE__ */ React29.createElement(AccordionSection, { title: (0, import_i18n12.__)("Typography", "elementor") }, /* @__PURE__ */ React29.createElement(import_ui16.Stack, { gap: 1.5 }, /* @__PURE__ */ React29.createElement(FontWeightControl, null), /* @__PURE__ */ React29.createElement(FontSizeControl, null), /* @__PURE__ */ React29.createElement(import_ui16.Divider, null), /* @__PURE__ */ React29.createElement(TextColorControl, null), /* @__PURE__ */ React29.createElement(CollapsibleContent, null, /* @__PURE__ */ React29.createElement(import_ui16.Stack, { gap: 1.5, sx: { pt: 1.5 } }, /* @__PURE__ */ React29.createElement(LetterSpacingControl, null), /* @__PURE__ */ React29.createElement(WordSpacingControl, null), /* @__PURE__ */ React29.createElement(import_ui16.Divider, null), /* @__PURE__ */ React29.createElement(TextAlignmentControl, null), /* @__PURE__ */ React29.createElement(TextStyleControl, null), /* @__PURE__ */ React29.createElement(TransformControl, null)))));
|
|
888
918
|
};
|
|
889
919
|
|
|
890
920
|
// src/components/style-sections/position-section/position-section.tsx
|
|
891
|
-
var
|
|
921
|
+
var React32 = __toESM(require("react"));
|
|
892
922
|
var import_ui18 = require("@elementor/ui");
|
|
893
923
|
|
|
894
924
|
// src/components/style-sections/position-section/z-index-control.tsx
|
|
895
|
-
var
|
|
896
|
-
var
|
|
925
|
+
var React31 = __toESM(require("react"));
|
|
926
|
+
var import_i18n13 = require("@wordpress/i18n");
|
|
897
927
|
|
|
898
928
|
// src/controls/control-types/number-control.tsx
|
|
899
|
-
var
|
|
929
|
+
var React30 = __toESM(require("react"));
|
|
900
930
|
var import_ui17 = require("@elementor/ui");
|
|
901
931
|
var isEmptyOrNaN = (value) => value === void 0 || value === "" || Number.isNaN(Number(value));
|
|
902
932
|
var NumberControl = ({ placeholder }) => {
|
|
@@ -905,7 +935,7 @@ var NumberControl = ({ placeholder }) => {
|
|
|
905
935
|
const eventValue = event.target.value;
|
|
906
936
|
setValue(isEmptyOrNaN(eventValue) ? void 0 : Number(eventValue));
|
|
907
937
|
};
|
|
908
|
-
return /* @__PURE__ */
|
|
938
|
+
return /* @__PURE__ */ React30.createElement(
|
|
909
939
|
import_ui17.TextField,
|
|
910
940
|
{
|
|
911
941
|
size: "tiny",
|
|
@@ -919,25 +949,25 @@ var NumberControl = ({ placeholder }) => {
|
|
|
919
949
|
|
|
920
950
|
// src/components/style-sections/position-section/z-index-control.tsx
|
|
921
951
|
var ZIndexControl = () => {
|
|
922
|
-
return /* @__PURE__ */
|
|
952
|
+
return /* @__PURE__ */ React31.createElement(StyleControl, { bind: "zIndex" }, /* @__PURE__ */ React31.createElement(ControlContainer, null, /* @__PURE__ */ React31.createElement(StyleControl.Label, null, (0, import_i18n13.__)("Z-Index", "elementor")), /* @__PURE__ */ React31.createElement(NumberControl, null)));
|
|
923
953
|
};
|
|
924
954
|
|
|
925
955
|
// src/components/style-sections/position-section/position-section.tsx
|
|
926
|
-
var
|
|
956
|
+
var import_i18n14 = require("@wordpress/i18n");
|
|
927
957
|
var PositionSection = () => {
|
|
928
|
-
return /* @__PURE__ */
|
|
958
|
+
return /* @__PURE__ */ React32.createElement(AccordionSection, { title: (0, import_i18n14.__)("Position", "elementor") }, /* @__PURE__ */ React32.createElement(import_ui18.Stack, { gap: 1.5 }, /* @__PURE__ */ React32.createElement(ZIndexControl, null)));
|
|
929
959
|
};
|
|
930
960
|
|
|
931
961
|
// src/components/style-sections/spacing-section/spacing-section.tsx
|
|
932
|
-
var
|
|
962
|
+
var React34 = __toESM(require("react"));
|
|
933
963
|
var import_ui20 = require("@elementor/ui");
|
|
934
|
-
var
|
|
964
|
+
var import_i18n16 = require("@wordpress/i18n");
|
|
935
965
|
|
|
936
966
|
// src/components/style-sections/spacing-section/linked-dimensions-control.tsx
|
|
937
|
-
var
|
|
967
|
+
var React33 = __toESM(require("react"));
|
|
938
968
|
var import_ui19 = require("@elementor/ui");
|
|
939
|
-
var
|
|
940
|
-
var
|
|
969
|
+
var import_icons6 = require("@elementor/icons");
|
|
970
|
+
var import_i18n15 = require("@wordpress/i18n");
|
|
941
971
|
var LinkedDimensionsControl = ({ label }) => {
|
|
942
972
|
const { value, setValue } = useControl();
|
|
943
973
|
const { top, right, bottom, left, isLinked = false } = value?.value || {};
|
|
@@ -968,49 +998,49 @@ var LinkedDimensionsControl = ({ label }) => {
|
|
|
968
998
|
value: updatedValue
|
|
969
999
|
});
|
|
970
1000
|
};
|
|
971
|
-
const LinkedIcon = isLinked ?
|
|
972
|
-
return /* @__PURE__ */
|
|
1001
|
+
const LinkedIcon = isLinked ? import_icons6.LinkIcon : import_icons6.DetachIcon;
|
|
1002
|
+
return /* @__PURE__ */ React33.createElement(React33.Fragment, null, /* @__PURE__ */ React33.createElement(import_ui19.Stack, { direction: "row", gap: 2 }, /* @__PURE__ */ React33.createElement(ControlLabel, null, label), /* @__PURE__ */ React33.createElement(
|
|
973
1003
|
import_ui19.ToggleButton,
|
|
974
1004
|
{
|
|
975
|
-
"aria-label": (0,
|
|
1005
|
+
"aria-label": (0, import_i18n15.__)("Link Inputs", "elementor"),
|
|
976
1006
|
size: "tiny",
|
|
977
1007
|
value: "check",
|
|
978
1008
|
selected: isLinked,
|
|
979
1009
|
sx: { marginLeft: "auto" },
|
|
980
1010
|
onChange: toggleLinked
|
|
981
1011
|
},
|
|
982
|
-
/* @__PURE__ */
|
|
983
|
-
)), /* @__PURE__ */
|
|
1012
|
+
/* @__PURE__ */ React33.createElement(LinkedIcon, { fontSize: "tiny" })
|
|
1013
|
+
)), /* @__PURE__ */ React33.createElement(import_ui19.Stack, { direction: "row", gap: 2 }, /* @__PURE__ */ React33.createElement(ControlContainer, { direction: "column" }, /* @__PURE__ */ React33.createElement(ControlLabel, null, (0, import_i18n15.__)("Top", "elementor")), /* @__PURE__ */ React33.createElement(
|
|
984
1014
|
Control4,
|
|
985
1015
|
{
|
|
986
1016
|
bind: "top",
|
|
987
1017
|
value: top,
|
|
988
1018
|
setValue: setLinkedValue,
|
|
989
|
-
startIcon: /* @__PURE__ */
|
|
1019
|
+
startIcon: /* @__PURE__ */ React33.createElement(import_icons6.SideTopIcon, { fontSize: "tiny" })
|
|
990
1020
|
}
|
|
991
|
-
)), /* @__PURE__ */
|
|
1021
|
+
)), /* @__PURE__ */ React33.createElement(ControlContainer, { direction: "column" }, /* @__PURE__ */ React33.createElement(ControlLabel, null, (0, import_i18n15.__)("Right", "elementor")), /* @__PURE__ */ React33.createElement(
|
|
992
1022
|
Control4,
|
|
993
1023
|
{
|
|
994
1024
|
bind: "right",
|
|
995
1025
|
value: right,
|
|
996
1026
|
setValue: setLinkedValue,
|
|
997
|
-
startIcon: /* @__PURE__ */
|
|
1027
|
+
startIcon: /* @__PURE__ */ React33.createElement(import_icons6.SideRightIcon, { fontSize: "tiny" })
|
|
998
1028
|
}
|
|
999
|
-
))), /* @__PURE__ */
|
|
1029
|
+
))), /* @__PURE__ */ React33.createElement(import_ui19.Stack, { direction: "row", gap: 2 }, /* @__PURE__ */ React33.createElement(ControlContainer, { direction: "column" }, /* @__PURE__ */ React33.createElement(ControlLabel, null, (0, import_i18n15.__)("Bottom", "elementor")), /* @__PURE__ */ React33.createElement(
|
|
1000
1030
|
Control4,
|
|
1001
1031
|
{
|
|
1002
1032
|
bind: "bottom",
|
|
1003
1033
|
value: bottom,
|
|
1004
1034
|
setValue: setLinkedValue,
|
|
1005
|
-
startIcon: /* @__PURE__ */
|
|
1035
|
+
startIcon: /* @__PURE__ */ React33.createElement(import_icons6.SideBottomIcon, { fontSize: "tiny" })
|
|
1006
1036
|
}
|
|
1007
|
-
)), /* @__PURE__ */
|
|
1037
|
+
)), /* @__PURE__ */ React33.createElement(ControlContainer, { direction: "column" }, /* @__PURE__ */ React33.createElement(ControlLabel, null, (0, import_i18n15.__)("Left", "elementor")), /* @__PURE__ */ React33.createElement(
|
|
1008
1038
|
Control4,
|
|
1009
1039
|
{
|
|
1010
1040
|
bind: "left",
|
|
1011
1041
|
value: left,
|
|
1012
1042
|
setValue: setLinkedValue,
|
|
1013
|
-
startIcon: /* @__PURE__ */
|
|
1043
|
+
startIcon: /* @__PURE__ */ React33.createElement(import_icons6.SideLeftIcon, { fontSize: "tiny" })
|
|
1014
1044
|
}
|
|
1015
1045
|
))));
|
|
1016
1046
|
};
|
|
@@ -1019,7 +1049,7 @@ var Control4 = ({
|
|
|
1019
1049
|
startIcon,
|
|
1020
1050
|
value,
|
|
1021
1051
|
setValue
|
|
1022
|
-
}) => /* @__PURE__ */
|
|
1052
|
+
}) => /* @__PURE__ */ React33.createElement(
|
|
1023
1053
|
ControlContext.Provider,
|
|
1024
1054
|
{
|
|
1025
1055
|
value: {
|
|
@@ -1028,12 +1058,12 @@ var Control4 = ({
|
|
|
1028
1058
|
value
|
|
1029
1059
|
}
|
|
1030
1060
|
},
|
|
1031
|
-
/* @__PURE__ */
|
|
1061
|
+
/* @__PURE__ */ React33.createElement(SizeControl, { startIcon })
|
|
1032
1062
|
);
|
|
1033
1063
|
|
|
1034
1064
|
// src/components/style-sections/spacing-section/spacing-section.tsx
|
|
1035
1065
|
var SpacingSection = () => {
|
|
1036
|
-
return /* @__PURE__ */
|
|
1066
|
+
return /* @__PURE__ */ React34.createElement(AccordionSection, { title: (0, import_i18n16.__)("Spacing", "elementor") }, /* @__PURE__ */ React34.createElement(import_ui20.Stack, { gap: 1.5 }, /* @__PURE__ */ React34.createElement(StyleControl, { bind: "padding" }, /* @__PURE__ */ React34.createElement(LinkedDimensionsControl, { label: (0, import_i18n16.__)("Padding", "elementor") })), /* @__PURE__ */ React34.createElement(import_ui20.Divider, null), /* @__PURE__ */ React34.createElement(StyleControl, { bind: "margin" }, /* @__PURE__ */ React34.createElement(LinkedDimensionsControl, { label: (0, import_i18n16.__)("Margin", "elementor") }))));
|
|
1037
1067
|
};
|
|
1038
1068
|
|
|
1039
1069
|
// src/components/style-tab.tsx
|
|
@@ -1041,7 +1071,7 @@ var CLASSES_PROP_KEY = "classes";
|
|
|
1041
1071
|
var StyleTab = () => {
|
|
1042
1072
|
const styleDefinition = useStyleDefinition();
|
|
1043
1073
|
const classesProp = useClassesProp();
|
|
1044
|
-
return /* @__PURE__ */
|
|
1074
|
+
return /* @__PURE__ */ React35.createElement(StyleContext, { selectedStyleDef: styleDefinition, selectedClassesProp: classesProp }, /* @__PURE__ */ React35.createElement(import_ui21.Stack, null, /* @__PURE__ */ React35.createElement(SizeSection, null), /* @__PURE__ */ React35.createElement(PositionSection, null), /* @__PURE__ */ React35.createElement(TypographySection, null), /* @__PURE__ */ React35.createElement(SpacingSection, null)));
|
|
1045
1075
|
};
|
|
1046
1076
|
function useClassesProp() {
|
|
1047
1077
|
const { elementType } = useElementContext();
|
|
@@ -1060,7 +1090,7 @@ function useStyleDefinition() {
|
|
|
1060
1090
|
// src/components/editing-panel-tabs.tsx
|
|
1061
1091
|
var EditingPanelTabs = () => {
|
|
1062
1092
|
const { getTabProps, getTabPanelProps, getTabsProps } = (0, import_ui22.useTabs)("settings");
|
|
1063
|
-
return /* @__PURE__ */
|
|
1093
|
+
return /* @__PURE__ */ React36.createElement(import_ui22.Stack, { direction: "column", sx: { width: "100%" } }, /* @__PURE__ */ React36.createElement(import_ui22.Tabs, { variant: "fullWidth", indicatorColor: "secondary", textColor: "inherit", ...getTabsProps() }, /* @__PURE__ */ React36.createElement(import_ui22.Tab, { label: (0, import_i18n17.__)("General", "elementor"), ...getTabProps("settings") }), /* @__PURE__ */ React36.createElement(import_ui22.Tab, { label: (0, import_i18n17.__)("Style", "elementor"), ...getTabProps("style") })), /* @__PURE__ */ React36.createElement(import_ui22.TabPanel, { ...getTabPanelProps("settings"), disablePadding: true }, /* @__PURE__ */ React36.createElement(SettingsTab, null)), /* @__PURE__ */ React36.createElement(import_ui22.TabPanel, { ...getTabPanelProps("style"), disablePadding: true }, /* @__PURE__ */ React36.createElement(StyleTab, null)));
|
|
1064
1094
|
};
|
|
1065
1095
|
|
|
1066
1096
|
// src/components/editing-panel.tsx
|
|
@@ -1071,8 +1101,8 @@ var EditingPanel = () => {
|
|
|
1071
1101
|
if (elements.length !== 1 || !elementType) {
|
|
1072
1102
|
return null;
|
|
1073
1103
|
}
|
|
1074
|
-
const panelTitle = (0,
|
|
1075
|
-
return /* @__PURE__ */
|
|
1104
|
+
const panelTitle = (0, import_i18n18.__)("Edit %s", "elementor").replace("%s", elementType.title);
|
|
1105
|
+
return /* @__PURE__ */ React37.createElement(import_editor_panels.Panel, null, /* @__PURE__ */ React37.createElement(import_editor_panels.PanelHeader, null, /* @__PURE__ */ React37.createElement(import_editor_panels.PanelHeaderTitle, null, panelTitle)), /* @__PURE__ */ React37.createElement(import_editor_panels.PanelBody, null, /* @__PURE__ */ React37.createElement(ElementContext, { element: selectedElement, elementType }, /* @__PURE__ */ React37.createElement(EditingPanelTabs, null))));
|
|
1076
1106
|
};
|
|
1077
1107
|
|
|
1078
1108
|
// src/panel.ts
|
|
@@ -1119,11 +1149,11 @@ var import_editor_panels3 = require("@elementor/editor-panels");
|
|
|
1119
1149
|
var import_editor_v1_adapters9 = require("@elementor/editor-v1-adapters");
|
|
1120
1150
|
|
|
1121
1151
|
// src/dynamics/components/dynamic-selection-control.tsx
|
|
1122
|
-
var
|
|
1152
|
+
var React40 = __toESM(require("react"));
|
|
1123
1153
|
var import_react12 = require("react");
|
|
1124
1154
|
|
|
1125
1155
|
// src/dynamics/dynamic-control.tsx
|
|
1126
|
-
var
|
|
1156
|
+
var React38 = __toESM(require("react"));
|
|
1127
1157
|
|
|
1128
1158
|
// src/dynamics/hooks/use-prop-dynamic-tags.ts
|
|
1129
1159
|
var import_react9 = require("react");
|
|
@@ -1213,56 +1243,83 @@ var DynamicControl = ({ bind, children }) => {
|
|
|
1213
1243
|
}
|
|
1214
1244
|
});
|
|
1215
1245
|
};
|
|
1216
|
-
return /* @__PURE__ */
|
|
1246
|
+
return /* @__PURE__ */ React38.createElement(ControlContext.Provider, { value: { setValue: setDynamicValue, value: dynamicValue, bind } }, children);
|
|
1217
1247
|
};
|
|
1218
1248
|
|
|
1219
1249
|
// src/dynamics/components/dynamic-selection-control.tsx
|
|
1220
|
-
var
|
|
1250
|
+
var import_icons8 = require("@elementor/icons");
|
|
1221
1251
|
|
|
1222
1252
|
// src/dynamics/components/dynamic-selection.tsx
|
|
1223
|
-
var
|
|
1253
|
+
var React39 = __toESM(require("react"));
|
|
1224
1254
|
var import_react11 = require("react");
|
|
1225
|
-
var
|
|
1255
|
+
var import_icons7 = require("@elementor/icons");
|
|
1226
1256
|
var import_ui23 = require("@elementor/ui");
|
|
1227
|
-
var
|
|
1257
|
+
var import_i18n19 = require("@wordpress/i18n");
|
|
1258
|
+
|
|
1259
|
+
// src/dynamics/hooks/use-prop-value-history.ts
|
|
1260
|
+
var PROPS_VALUES_HISTORY_KEY = "elementor/dynamic/non-dynamic-values-history";
|
|
1261
|
+
var usePropValueHistory = (path) => {
|
|
1262
|
+
const valuesHistory = getValues();
|
|
1263
|
+
const { element } = useElementContext();
|
|
1264
|
+
const key = `${element.id}-${path}`;
|
|
1265
|
+
const value = valuesHistory[key] ?? null;
|
|
1266
|
+
const setValue = (newValue) => {
|
|
1267
|
+
setValues({ ...valuesHistory, [key]: newValue });
|
|
1268
|
+
};
|
|
1269
|
+
return [value, setValue];
|
|
1270
|
+
};
|
|
1271
|
+
var getValues = () => {
|
|
1272
|
+
return JSON.parse(sessionStorage.getItem(PROPS_VALUES_HISTORY_KEY) || "{}");
|
|
1273
|
+
};
|
|
1274
|
+
var setValues = (values) => {
|
|
1275
|
+
sessionStorage.setItem(PROPS_VALUES_HISTORY_KEY, JSON.stringify(values));
|
|
1276
|
+
};
|
|
1277
|
+
|
|
1278
|
+
// src/dynamics/components/dynamic-selection.tsx
|
|
1228
1279
|
var SIZE = "tiny";
|
|
1229
1280
|
var DynamicSelection = ({ onSelect }) => {
|
|
1230
1281
|
const [searchValue, setSearchValue] = (0, import_react11.useState)("");
|
|
1231
1282
|
const { groups: dynamicGroups } = getAtomicDynamicTags() || {};
|
|
1232
|
-
const { bind, value:
|
|
1233
|
-
const
|
|
1283
|
+
const { bind, value: currentValue, setValue } = useControl();
|
|
1284
|
+
const [, updatePropValueHistory] = usePropValueHistory(bind);
|
|
1285
|
+
const isCurrentValueDynamic = isDynamicPropValue(currentValue);
|
|
1286
|
+
const options3 = useFilteredOptions(bind, searchValue);
|
|
1234
1287
|
const handleSearch = (event) => {
|
|
1235
1288
|
setSearchValue(event.target.value);
|
|
1236
1289
|
};
|
|
1237
|
-
|
|
1290
|
+
const handleSetDynamicTag = (value) => {
|
|
1291
|
+
if (!isCurrentValueDynamic) {
|
|
1292
|
+
updatePropValueHistory(currentValue);
|
|
1293
|
+
}
|
|
1294
|
+
setValue({ $$type: "dynamic", value: { name: value } });
|
|
1295
|
+
onSelect?.();
|
|
1296
|
+
};
|
|
1297
|
+
return /* @__PURE__ */ React39.createElement(import_ui23.Stack, null, /* @__PURE__ */ React39.createElement(import_ui23.Box, { px: 1.5, pb: 1 }, /* @__PURE__ */ React39.createElement(
|
|
1238
1298
|
import_ui23.TextField,
|
|
1239
1299
|
{
|
|
1240
1300
|
fullWidth: true,
|
|
1241
1301
|
size: SIZE,
|
|
1242
1302
|
value: searchValue,
|
|
1243
1303
|
onChange: handleSearch,
|
|
1244
|
-
placeholder: (0,
|
|
1304
|
+
placeholder: (0, import_i18n19.__)("Search dynamic tag", "elementor"),
|
|
1245
1305
|
InputProps: {
|
|
1246
|
-
startAdornment: /* @__PURE__ */
|
|
1306
|
+
startAdornment: /* @__PURE__ */ React39.createElement(import_ui23.InputAdornment, { position: "start" }, /* @__PURE__ */ React39.createElement(import_icons7.SearchIcon, { fontSize: SIZE }))
|
|
1247
1307
|
}
|
|
1248
1308
|
}
|
|
1249
|
-
)), /* @__PURE__ */
|
|
1250
|
-
const isSelected = value ===
|
|
1251
|
-
return /* @__PURE__ */
|
|
1309
|
+
)), /* @__PURE__ */ React39.createElement(import_ui23.Divider, null), /* @__PURE__ */ React39.createElement(import_ui23.Box, { sx: { overflowY: "auto", height: 260, width: 220 } }, options3.length > 0 ? /* @__PURE__ */ React39.createElement(import_ui23.MenuList, { role: "listbox", tabIndex: 0 }, options3.map(([category, items], index) => /* @__PURE__ */ React39.createElement(import_react11.Fragment, { key: index }, /* @__PURE__ */ React39.createElement(import_ui23.ListSubheader, { sx: { typography: "caption", color: "text.tertiary" } }, dynamicGroups?.[category]?.title || category), items.map(({ value, label: tagLabel }) => {
|
|
1310
|
+
const isSelected = isCurrentValueDynamic && value === currentValue?.value?.name;
|
|
1311
|
+
return /* @__PURE__ */ React39.createElement(
|
|
1252
1312
|
import_ui23.MenuItem,
|
|
1253
1313
|
{
|
|
1254
1314
|
key: value,
|
|
1255
1315
|
selected: isSelected,
|
|
1256
1316
|
autoFocus: isSelected,
|
|
1257
1317
|
sx: { typography: "caption" },
|
|
1258
|
-
onClick: () =>
|
|
1259
|
-
setValue({ $$type: "dynamic", value: { name: value } });
|
|
1260
|
-
onSelect?.();
|
|
1261
|
-
}
|
|
1318
|
+
onClick: () => handleSetDynamicTag(value)
|
|
1262
1319
|
},
|
|
1263
1320
|
tagLabel
|
|
1264
1321
|
);
|
|
1265
|
-
})))) : /* @__PURE__ */
|
|
1322
|
+
})))) : /* @__PURE__ */ React39.createElement(import_ui23.Stack, { alignItems: "center", p: 2.5, gap: 1.5 }, /* @__PURE__ */ React39.createElement(import_icons7.PhotoIcon, { fontSize: "large" }), /* @__PURE__ */ React39.createElement(import_ui23.Typography, { align: "center", variant: "caption", color: "text.secondary" }, (0, import_i18n19.__)("Sorry, nothing matched", "elementor"), /* @__PURE__ */ React39.createElement("br", null), "\u201C", searchValue, "\u201D."), /* @__PURE__ */ React39.createElement(import_ui23.Typography, { align: "center", variant: "caption", color: "text.secondary" }, /* @__PURE__ */ React39.createElement(
|
|
1266
1323
|
import_ui23.Link,
|
|
1267
1324
|
{
|
|
1268
1325
|
color: "secondary",
|
|
@@ -1270,12 +1327,12 @@ var DynamicSelection = ({ onSelect }) => {
|
|
|
1270
1327
|
component: "button",
|
|
1271
1328
|
onClick: () => setSearchValue("")
|
|
1272
1329
|
},
|
|
1273
|
-
(0,
|
|
1274
|
-
), "\xA0", (0,
|
|
1330
|
+
(0, import_i18n19.__)("Clear the filters", "elementor")
|
|
1331
|
+
), "\xA0", (0, import_i18n19.__)("and try again.", "elementor")))));
|
|
1275
1332
|
};
|
|
1276
1333
|
var useFilteredOptions = (bind, searchValue) => {
|
|
1277
1334
|
const dynamicTags = usePropDynamicTags(bind);
|
|
1278
|
-
const
|
|
1335
|
+
const options3 = dynamicTags.reduce((categories, { name, label, group }) => {
|
|
1279
1336
|
const isVisible = label.toLowerCase().includes(searchValue.trim().toLowerCase());
|
|
1280
1337
|
if (!isVisible) {
|
|
1281
1338
|
return categories;
|
|
@@ -1286,44 +1343,45 @@ var useFilteredOptions = (bind, searchValue) => {
|
|
|
1286
1343
|
categories.get(group)?.push({ label, value: name });
|
|
1287
1344
|
return categories;
|
|
1288
1345
|
}, /* @__PURE__ */ new Map());
|
|
1289
|
-
return [...
|
|
1346
|
+
return [...options3];
|
|
1290
1347
|
};
|
|
1291
1348
|
|
|
1292
1349
|
// src/dynamics/components/dynamic-selection-control.tsx
|
|
1293
1350
|
var import_ui24 = require("@elementor/ui");
|
|
1294
|
-
var
|
|
1351
|
+
var import_i18n20 = require("@wordpress/i18n");
|
|
1295
1352
|
var SIZE2 = "tiny";
|
|
1296
1353
|
var DynamicSelectionControl = () => {
|
|
1297
1354
|
const { bind, value, setValue } = useControl();
|
|
1355
|
+
const [propValueFromHistory] = usePropValueHistory(bind);
|
|
1298
1356
|
const { name: tagName = "" } = value?.value || {};
|
|
1299
1357
|
const selectionPopoverId = (0, import_react12.useId)();
|
|
1300
1358
|
const selectionPopoverState = (0, import_ui24.usePopupState)({ variant: "popover", popupId: selectionPopoverId });
|
|
1301
1359
|
const dynamicTag = useDynamicTag(bind, tagName);
|
|
1302
1360
|
const removeDynamicTag = () => {
|
|
1303
|
-
setValue(null);
|
|
1361
|
+
setValue(propValueFromHistory ?? null);
|
|
1304
1362
|
};
|
|
1305
1363
|
if (!dynamicTag) {
|
|
1306
1364
|
throw new Error(`Dynamic tag ${tagName} not found`);
|
|
1307
1365
|
}
|
|
1308
|
-
return /* @__PURE__ */
|
|
1366
|
+
return /* @__PURE__ */ React40.createElement(import_ui24.Box, { sx: { width: "100%" } }, /* @__PURE__ */ React40.createElement(
|
|
1309
1367
|
import_ui24.UnstableTag,
|
|
1310
1368
|
{
|
|
1311
1369
|
fullWidth: true,
|
|
1312
1370
|
showActionsOnHover: true,
|
|
1313
1371
|
label: dynamicTag.label,
|
|
1314
|
-
startIcon: /* @__PURE__ */
|
|
1372
|
+
startIcon: /* @__PURE__ */ React40.createElement(import_icons8.DatabaseIcon, { fontSize: SIZE2 }),
|
|
1315
1373
|
...(0, import_ui24.bindTrigger)(selectionPopoverState),
|
|
1316
|
-
actions: /* @__PURE__ */
|
|
1374
|
+
actions: /* @__PURE__ */ React40.createElement(React40.Fragment, null, /* @__PURE__ */ React40.createElement(DynamicSettingsPopover, { dynamicTag }), /* @__PURE__ */ React40.createElement(
|
|
1317
1375
|
import_ui24.IconButton,
|
|
1318
1376
|
{
|
|
1319
1377
|
size: SIZE2,
|
|
1320
1378
|
onClick: removeDynamicTag,
|
|
1321
|
-
"aria-label": (0,
|
|
1379
|
+
"aria-label": (0, import_i18n20.__)("Remove dynamic value", "elementor")
|
|
1322
1380
|
},
|
|
1323
|
-
/* @__PURE__ */
|
|
1381
|
+
/* @__PURE__ */ React40.createElement(import_icons8.XIcon, { fontSize: SIZE2 })
|
|
1324
1382
|
))
|
|
1325
1383
|
}
|
|
1326
|
-
), /* @__PURE__ */
|
|
1384
|
+
), /* @__PURE__ */ React40.createElement(
|
|
1327
1385
|
import_ui24.Popover,
|
|
1328
1386
|
{
|
|
1329
1387
|
disablePortal: true,
|
|
@@ -1331,7 +1389,7 @@ var DynamicSelectionControl = () => {
|
|
|
1331
1389
|
anchorOrigin: { vertical: "bottom", horizontal: "left" },
|
|
1332
1390
|
...(0, import_ui24.bindPopover)(selectionPopoverState)
|
|
1333
1391
|
},
|
|
1334
|
-
/* @__PURE__ */
|
|
1392
|
+
/* @__PURE__ */ React40.createElement(import_ui24.Stack, null, /* @__PURE__ */ React40.createElement(import_ui24.Stack, { direction: "row", alignItems: "center", pl: 1.5, pr: 0.5, py: 1.5 }, /* @__PURE__ */ React40.createElement(import_icons8.DatabaseIcon, { fontSize: SIZE2, sx: { mr: 0.5 } }), /* @__PURE__ */ React40.createElement(import_ui24.Typography, { variant: "subtitle2" }, (0, import_i18n20.__)("Dynamic Tags", "elementor")), /* @__PURE__ */ React40.createElement(import_ui24.IconButton, { size: SIZE2, sx: { ml: "auto" }, onClick: selectionPopoverState.close }, /* @__PURE__ */ React40.createElement(import_icons8.XIcon, { fontSize: SIZE2 }))), /* @__PURE__ */ React40.createElement(DynamicSelection, { onSelect: selectionPopoverState.close }))
|
|
1335
1393
|
));
|
|
1336
1394
|
};
|
|
1337
1395
|
var DynamicSettingsPopover = ({ dynamicTag }) => {
|
|
@@ -1341,22 +1399,22 @@ var DynamicSettingsPopover = ({ dynamicTag }) => {
|
|
|
1341
1399
|
if (!hasDynamicSettings) {
|
|
1342
1400
|
return null;
|
|
1343
1401
|
}
|
|
1344
|
-
return /* @__PURE__ */
|
|
1402
|
+
return /* @__PURE__ */ React40.createElement(React40.Fragment, null, /* @__PURE__ */ React40.createElement(
|
|
1345
1403
|
import_ui24.IconButton,
|
|
1346
1404
|
{
|
|
1347
1405
|
size: SIZE2,
|
|
1348
1406
|
...(0, import_ui24.bindTrigger)(settingsPopupState),
|
|
1349
|
-
"aria-label": (0,
|
|
1407
|
+
"aria-label": (0, import_i18n20.__)("Settings", "elementor")
|
|
1350
1408
|
},
|
|
1351
|
-
/* @__PURE__ */
|
|
1352
|
-
), /* @__PURE__ */
|
|
1409
|
+
/* @__PURE__ */ React40.createElement(import_icons8.SettingsIcon, { fontSize: SIZE2 })
|
|
1410
|
+
), /* @__PURE__ */ React40.createElement(
|
|
1353
1411
|
import_ui24.Popover,
|
|
1354
1412
|
{
|
|
1355
1413
|
disableScrollLock: true,
|
|
1356
1414
|
anchorOrigin: { vertical: "bottom", horizontal: "center" },
|
|
1357
1415
|
...(0, import_ui24.bindPopover)(settingsPopupState)
|
|
1358
1416
|
},
|
|
1359
|
-
/* @__PURE__ */
|
|
1417
|
+
/* @__PURE__ */ React40.createElement(import_ui24.Paper, { component: import_ui24.Stack, sx: { minHeight: "300px", width: "220px" } }, /* @__PURE__ */ React40.createElement(import_ui24.Stack, { direction: "row", alignItems: "center", px: 1.5, pt: 2, pb: 1 }, /* @__PURE__ */ React40.createElement(import_icons8.DatabaseIcon, { fontSize: SIZE2, sx: { mr: 0.5 } }), /* @__PURE__ */ React40.createElement(import_ui24.Typography, { variant: "subtitle2" }, dynamicTag.label), /* @__PURE__ */ React40.createElement(import_ui24.IconButton, { sx: { ml: "auto" }, size: SIZE2, onClick: settingsPopupState.close }, /* @__PURE__ */ React40.createElement(import_icons8.XIcon, { fontSize: SIZE2 }))), /* @__PURE__ */ React40.createElement(DynamicSettings, { controls: dynamicTag.atomic_controls }))
|
|
1360
1418
|
));
|
|
1361
1419
|
};
|
|
1362
1420
|
var DynamicSettings = ({ controls }) => {
|
|
@@ -1365,10 +1423,10 @@ var DynamicSettings = ({ controls }) => {
|
|
|
1365
1423
|
if (!tabs.length) {
|
|
1366
1424
|
return null;
|
|
1367
1425
|
}
|
|
1368
|
-
return /* @__PURE__ */
|
|
1369
|
-
return /* @__PURE__ */
|
|
1426
|
+
return /* @__PURE__ */ React40.createElement(React40.Fragment, null, /* @__PURE__ */ React40.createElement(import_ui24.Tabs, { indicatorColor: "secondary", textColor: "secondary", ...getTabsProps() }, tabs.map(({ value }, index) => /* @__PURE__ */ React40.createElement(import_ui24.Tab, { key: index, label: value.label, sx: { px: 1, py: 0.5 }, ...getTabProps(index) }))), /* @__PURE__ */ React40.createElement(import_ui24.Divider, null), tabs.map(({ value }, index) => {
|
|
1427
|
+
return /* @__PURE__ */ React40.createElement(import_ui24.TabPanel, { key: index, sx: { flexGrow: 1 }, ...getTabPanelProps(index) }, /* @__PURE__ */ React40.createElement(import_ui24.Stack, { gap: 1, px: 2 }, value.items.map((item) => {
|
|
1370
1428
|
if (item.type === "control") {
|
|
1371
|
-
return /* @__PURE__ */
|
|
1429
|
+
return /* @__PURE__ */ React40.createElement(Control5, { key: item.value.bind, control: item.value });
|
|
1372
1430
|
}
|
|
1373
1431
|
return null;
|
|
1374
1432
|
})));
|
|
@@ -1378,7 +1436,7 @@ var Control5 = ({ control }) => {
|
|
|
1378
1436
|
if (!getControlByType(control.type)) {
|
|
1379
1437
|
return null;
|
|
1380
1438
|
}
|
|
1381
|
-
return /* @__PURE__ */
|
|
1439
|
+
return /* @__PURE__ */ React40.createElement(DynamicControl, { bind: control.bind }, control.label ? /* @__PURE__ */ React40.createElement(ControlLabel, null, control.label) : null, /* @__PURE__ */ React40.createElement(Control, { type: control.type, props: control.props }));
|
|
1382
1440
|
};
|
|
1383
1441
|
|
|
1384
1442
|
// src/dynamics/init.ts
|