@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/dist/index.mjs
CHANGED
|
@@ -27,8 +27,8 @@ function useControl(defaultValue) {
|
|
|
27
27
|
import { __createPanel as createPanel } from "@elementor/editor-panels";
|
|
28
28
|
|
|
29
29
|
// src/components/editing-panel.tsx
|
|
30
|
-
import * as
|
|
31
|
-
import { __ as
|
|
30
|
+
import * as React37 from "react";
|
|
31
|
+
import { __ as __18 } from "@wordpress/i18n";
|
|
32
32
|
|
|
33
33
|
// src/hooks/use-selected-elements.ts
|
|
34
34
|
import { __privateUseListenTo as useListenTo, commandEndEvent } from "@elementor/editor-v1-adapters";
|
|
@@ -113,8 +113,8 @@ function useElementContext() {
|
|
|
113
113
|
|
|
114
114
|
// src/components/editing-panel-tabs.tsx
|
|
115
115
|
import { Stack as Stack11, Tabs, Tab, TabPanel, useTabs } from "@elementor/ui";
|
|
116
|
-
import * as
|
|
117
|
-
import { __ as
|
|
116
|
+
import * as React36 from "react";
|
|
117
|
+
import { __ as __17 } from "@wordpress/i18n";
|
|
118
118
|
|
|
119
119
|
// src/components/settings-tab.tsx
|
|
120
120
|
import * as React13 from "react";
|
|
@@ -360,7 +360,7 @@ var TextFieldInnerSelection = ({
|
|
|
360
360
|
);
|
|
361
361
|
};
|
|
362
362
|
var SelectionEndAdornment = ({
|
|
363
|
-
options:
|
|
363
|
+
options: options3,
|
|
364
364
|
onClick,
|
|
365
365
|
value
|
|
366
366
|
}) => {
|
|
@@ -369,7 +369,7 @@ var SelectionEndAdornment = ({
|
|
|
369
369
|
popupId: useId2()
|
|
370
370
|
});
|
|
371
371
|
const handleMenuItemClick = (index) => {
|
|
372
|
-
onClick(
|
|
372
|
+
onClick(options3[index]);
|
|
373
373
|
popupState.close();
|
|
374
374
|
};
|
|
375
375
|
return /* @__PURE__ */ React9.createElement(InputAdornment, { position: "end" }, /* @__PURE__ */ React9.createElement(
|
|
@@ -381,7 +381,7 @@ var SelectionEndAdornment = ({
|
|
|
381
381
|
...bindTrigger(popupState)
|
|
382
382
|
},
|
|
383
383
|
value.toUpperCase()
|
|
384
|
-
), /* @__PURE__ */ React9.createElement(Menu, { MenuListProps: { dense: true }, ...bindMenu(popupState) },
|
|
384
|
+
), /* @__PURE__ */ React9.createElement(Menu, { MenuListProps: { dense: true }, ...bindMenu(popupState) }, options3.map((option, index) => /* @__PURE__ */ React9.createElement(MenuItem, { key: option, onClick: () => handleMenuItemClick(index) }, option.toUpperCase()))));
|
|
385
385
|
};
|
|
386
386
|
|
|
387
387
|
// src/controls/control-types/size-control.tsx
|
|
@@ -432,12 +432,12 @@ var SizeControl = ({ units = defaultUnits, placeholder, startIcon }) => {
|
|
|
432
432
|
// src/controls/control-types/select-control.tsx
|
|
433
433
|
import * as React11 from "react";
|
|
434
434
|
import { MenuItem as MenuItem2, Select } from "@elementor/ui";
|
|
435
|
-
var SelectControl = ({ options:
|
|
435
|
+
var SelectControl = ({ options: options3 }) => {
|
|
436
436
|
const { value, setValue } = useControl();
|
|
437
437
|
const handleChange = (event) => {
|
|
438
438
|
setValue(event.target.value);
|
|
439
439
|
};
|
|
440
|
-
return /* @__PURE__ */ React11.createElement(Select, { size: "tiny", value: value ?? "", onChange: handleChange },
|
|
440
|
+
return /* @__PURE__ */ React11.createElement(Select, { size: "tiny", value: value ?? "", onChange: handleChange }, options3.map(({ label, ...props }) => /* @__PURE__ */ React11.createElement(MenuItem2, { key: props.value, ...props }, label)));
|
|
441
441
|
};
|
|
442
442
|
|
|
443
443
|
// src/controls/controls-registry.tsx
|
|
@@ -493,7 +493,7 @@ var Control2 = ({ control }) => {
|
|
|
493
493
|
};
|
|
494
494
|
|
|
495
495
|
// src/components/style-tab.tsx
|
|
496
|
-
import * as
|
|
496
|
+
import * as React35 from "react";
|
|
497
497
|
|
|
498
498
|
// src/contexts/style-context.tsx
|
|
499
499
|
import * as React14 from "react";
|
|
@@ -625,7 +625,7 @@ var Control3 = ({ label, bind }) => {
|
|
|
625
625
|
};
|
|
626
626
|
|
|
627
627
|
// src/components/style-sections/typography-section/typography-section.tsx
|
|
628
|
-
import * as
|
|
628
|
+
import * as React29 from "react";
|
|
629
629
|
import { Divider, Stack as Stack6 } from "@elementor/ui";
|
|
630
630
|
|
|
631
631
|
// src/components/style-sections/typography-section/text-style-control.tsx
|
|
@@ -693,7 +693,7 @@ var ToggleButton = ({ onChange, ...props }) => {
|
|
|
693
693
|
};
|
|
694
694
|
|
|
695
695
|
// src/components/style-sections/typography-section/typography-section.tsx
|
|
696
|
-
import { __ as
|
|
696
|
+
import { __ as __12 } from "@wordpress/i18n";
|
|
697
697
|
|
|
698
698
|
// src/components/style-sections/typography-section/font-size-control.tsx
|
|
699
699
|
import * as React18 from "react";
|
|
@@ -818,7 +818,7 @@ var ControlToggleButtonGroup = ({
|
|
|
818
818
|
};
|
|
819
819
|
|
|
820
820
|
// src/controls/control-types/toggle-control.tsx
|
|
821
|
-
var ToggleControl = ({ options:
|
|
821
|
+
var ToggleControl = ({ options: options3 }) => {
|
|
822
822
|
const { value, setValue } = useControl();
|
|
823
823
|
const handleToggle = (option) => {
|
|
824
824
|
setValue(option || void 0);
|
|
@@ -826,7 +826,7 @@ var ToggleControl = ({ options: options2 }) => {
|
|
|
826
826
|
return /* @__PURE__ */ React26.createElement(
|
|
827
827
|
ControlToggleButtonGroup,
|
|
828
828
|
{
|
|
829
|
-
items:
|
|
829
|
+
items: options3,
|
|
830
830
|
value: value || null,
|
|
831
831
|
onChange: handleToggle,
|
|
832
832
|
exclusive: true
|
|
@@ -845,21 +845,51 @@ var TransformControl = () => {
|
|
|
845
845
|
return /* @__PURE__ */ React27.createElement(ControlContainer, null, /* @__PURE__ */ React27.createElement(StyleControl.Label, null, __10("Transform", "elementor")), /* @__PURE__ */ React27.createElement(StyleControl, { bind: "text-transform" }, /* @__PURE__ */ React27.createElement(ToggleControl, { options })));
|
|
846
846
|
};
|
|
847
847
|
|
|
848
|
+
// src/components/style-sections/typography-section/text-alignment-control.tsx
|
|
849
|
+
import * as React28 from "react";
|
|
850
|
+
import { AlignLeftIcon, AlignCenterIcon, AlignRightIcon, AlignJustifiedIcon } from "@elementor/icons";
|
|
851
|
+
import { __ as __11 } from "@wordpress/i18n";
|
|
852
|
+
var options2 = [
|
|
853
|
+
{
|
|
854
|
+
value: "left",
|
|
855
|
+
label: __11("Left", "elementor"),
|
|
856
|
+
icon: AlignLeftIcon
|
|
857
|
+
},
|
|
858
|
+
{
|
|
859
|
+
value: "center",
|
|
860
|
+
label: __11("Center", "elementor"),
|
|
861
|
+
icon: AlignCenterIcon
|
|
862
|
+
},
|
|
863
|
+
{
|
|
864
|
+
value: "right",
|
|
865
|
+
label: __11("Right", "elementor"),
|
|
866
|
+
icon: AlignRightIcon
|
|
867
|
+
},
|
|
868
|
+
{
|
|
869
|
+
value: "justify",
|
|
870
|
+
label: __11("Justify", "elementor"),
|
|
871
|
+
icon: AlignJustifiedIcon
|
|
872
|
+
}
|
|
873
|
+
];
|
|
874
|
+
var TextAlignmentControl = () => {
|
|
875
|
+
return /* @__PURE__ */ React28.createElement(ControlContainer, null, /* @__PURE__ */ React28.createElement(StyleControl.Label, null, __11("Alignment", "elementor")), /* @__PURE__ */ React28.createElement(StyleControl, { bind: "text-align" }, /* @__PURE__ */ React28.createElement(ToggleControl, { options: options2 })));
|
|
876
|
+
};
|
|
877
|
+
|
|
848
878
|
// src/components/style-sections/typography-section/typography-section.tsx
|
|
849
879
|
var TypographySection = () => {
|
|
850
|
-
return /* @__PURE__ */
|
|
880
|
+
return /* @__PURE__ */ React29.createElement(AccordionSection, { title: __12("Typography", "elementor") }, /* @__PURE__ */ React29.createElement(Stack6, { gap: 1.5 }, /* @__PURE__ */ React29.createElement(FontWeightControl, null), /* @__PURE__ */ React29.createElement(FontSizeControl, null), /* @__PURE__ */ React29.createElement(Divider, null), /* @__PURE__ */ React29.createElement(TextColorControl, null), /* @__PURE__ */ React29.createElement(CollapsibleContent, null, /* @__PURE__ */ React29.createElement(Stack6, { gap: 1.5, sx: { pt: 1.5 } }, /* @__PURE__ */ React29.createElement(LetterSpacingControl, null), /* @__PURE__ */ React29.createElement(WordSpacingControl, null), /* @__PURE__ */ React29.createElement(Divider, null), /* @__PURE__ */ React29.createElement(TextAlignmentControl, null), /* @__PURE__ */ React29.createElement(TextStyleControl, null), /* @__PURE__ */ React29.createElement(TransformControl, null)))));
|
|
851
881
|
};
|
|
852
882
|
|
|
853
883
|
// src/components/style-sections/position-section/position-section.tsx
|
|
854
|
-
import * as
|
|
884
|
+
import * as React32 from "react";
|
|
855
885
|
import { Stack as Stack7 } from "@elementor/ui";
|
|
856
886
|
|
|
857
887
|
// src/components/style-sections/position-section/z-index-control.tsx
|
|
858
|
-
import * as
|
|
859
|
-
import { __ as
|
|
888
|
+
import * as React31 from "react";
|
|
889
|
+
import { __ as __13 } from "@wordpress/i18n";
|
|
860
890
|
|
|
861
891
|
// src/controls/control-types/number-control.tsx
|
|
862
|
-
import * as
|
|
892
|
+
import * as React30 from "react";
|
|
863
893
|
import { TextField as TextField4 } from "@elementor/ui";
|
|
864
894
|
var isEmptyOrNaN = (value) => value === void 0 || value === "" || Number.isNaN(Number(value));
|
|
865
895
|
var NumberControl = ({ placeholder }) => {
|
|
@@ -868,7 +898,7 @@ var NumberControl = ({ placeholder }) => {
|
|
|
868
898
|
const eventValue = event.target.value;
|
|
869
899
|
setValue(isEmptyOrNaN(eventValue) ? void 0 : Number(eventValue));
|
|
870
900
|
};
|
|
871
|
-
return /* @__PURE__ */
|
|
901
|
+
return /* @__PURE__ */ React30.createElement(
|
|
872
902
|
TextField4,
|
|
873
903
|
{
|
|
874
904
|
size: "tiny",
|
|
@@ -882,25 +912,25 @@ var NumberControl = ({ placeholder }) => {
|
|
|
882
912
|
|
|
883
913
|
// src/components/style-sections/position-section/z-index-control.tsx
|
|
884
914
|
var ZIndexControl = () => {
|
|
885
|
-
return /* @__PURE__ */
|
|
915
|
+
return /* @__PURE__ */ React31.createElement(StyleControl, { bind: "zIndex" }, /* @__PURE__ */ React31.createElement(ControlContainer, null, /* @__PURE__ */ React31.createElement(StyleControl.Label, null, __13("Z-Index", "elementor")), /* @__PURE__ */ React31.createElement(NumberControl, null)));
|
|
886
916
|
};
|
|
887
917
|
|
|
888
918
|
// src/components/style-sections/position-section/position-section.tsx
|
|
889
|
-
import { __ as
|
|
919
|
+
import { __ as __14 } from "@wordpress/i18n";
|
|
890
920
|
var PositionSection = () => {
|
|
891
|
-
return /* @__PURE__ */
|
|
921
|
+
return /* @__PURE__ */ React32.createElement(AccordionSection, { title: __14("Position", "elementor") }, /* @__PURE__ */ React32.createElement(Stack7, { gap: 1.5 }, /* @__PURE__ */ React32.createElement(ZIndexControl, null)));
|
|
892
922
|
};
|
|
893
923
|
|
|
894
924
|
// src/components/style-sections/spacing-section/spacing-section.tsx
|
|
895
|
-
import * as
|
|
925
|
+
import * as React34 from "react";
|
|
896
926
|
import { Divider as Divider2, Stack as Stack9 } from "@elementor/ui";
|
|
897
|
-
import { __ as
|
|
927
|
+
import { __ as __16 } from "@wordpress/i18n";
|
|
898
928
|
|
|
899
929
|
// src/components/style-sections/spacing-section/linked-dimensions-control.tsx
|
|
900
|
-
import * as
|
|
930
|
+
import * as React33 from "react";
|
|
901
931
|
import { Stack as Stack8, ToggleButton as ToggleButton3 } from "@elementor/ui";
|
|
902
932
|
import { DetachIcon, LinkIcon, SideBottomIcon, SideLeftIcon, SideRightIcon, SideTopIcon } from "@elementor/icons";
|
|
903
|
-
import { __ as
|
|
933
|
+
import { __ as __15 } from "@wordpress/i18n";
|
|
904
934
|
var LinkedDimensionsControl = ({ label }) => {
|
|
905
935
|
const { value, setValue } = useControl();
|
|
906
936
|
const { top, right, bottom, left, isLinked = false } = value?.value || {};
|
|
@@ -932,48 +962,48 @@ var LinkedDimensionsControl = ({ label }) => {
|
|
|
932
962
|
});
|
|
933
963
|
};
|
|
934
964
|
const LinkedIcon = isLinked ? LinkIcon : DetachIcon;
|
|
935
|
-
return /* @__PURE__ */
|
|
965
|
+
return /* @__PURE__ */ React33.createElement(React33.Fragment, null, /* @__PURE__ */ React33.createElement(Stack8, { direction: "row", gap: 2 }, /* @__PURE__ */ React33.createElement(ControlLabel, null, label), /* @__PURE__ */ React33.createElement(
|
|
936
966
|
ToggleButton3,
|
|
937
967
|
{
|
|
938
|
-
"aria-label":
|
|
968
|
+
"aria-label": __15("Link Inputs", "elementor"),
|
|
939
969
|
size: "tiny",
|
|
940
970
|
value: "check",
|
|
941
971
|
selected: isLinked,
|
|
942
972
|
sx: { marginLeft: "auto" },
|
|
943
973
|
onChange: toggleLinked
|
|
944
974
|
},
|
|
945
|
-
/* @__PURE__ */
|
|
946
|
-
)), /* @__PURE__ */
|
|
975
|
+
/* @__PURE__ */ React33.createElement(LinkedIcon, { fontSize: "tiny" })
|
|
976
|
+
)), /* @__PURE__ */ React33.createElement(Stack8, { direction: "row", gap: 2 }, /* @__PURE__ */ React33.createElement(ControlContainer, { direction: "column" }, /* @__PURE__ */ React33.createElement(ControlLabel, null, __15("Top", "elementor")), /* @__PURE__ */ React33.createElement(
|
|
947
977
|
Control4,
|
|
948
978
|
{
|
|
949
979
|
bind: "top",
|
|
950
980
|
value: top,
|
|
951
981
|
setValue: setLinkedValue,
|
|
952
|
-
startIcon: /* @__PURE__ */
|
|
982
|
+
startIcon: /* @__PURE__ */ React33.createElement(SideTopIcon, { fontSize: "tiny" })
|
|
953
983
|
}
|
|
954
|
-
)), /* @__PURE__ */
|
|
984
|
+
)), /* @__PURE__ */ React33.createElement(ControlContainer, { direction: "column" }, /* @__PURE__ */ React33.createElement(ControlLabel, null, __15("Right", "elementor")), /* @__PURE__ */ React33.createElement(
|
|
955
985
|
Control4,
|
|
956
986
|
{
|
|
957
987
|
bind: "right",
|
|
958
988
|
value: right,
|
|
959
989
|
setValue: setLinkedValue,
|
|
960
|
-
startIcon: /* @__PURE__ */
|
|
990
|
+
startIcon: /* @__PURE__ */ React33.createElement(SideRightIcon, { fontSize: "tiny" })
|
|
961
991
|
}
|
|
962
|
-
))), /* @__PURE__ */
|
|
992
|
+
))), /* @__PURE__ */ React33.createElement(Stack8, { direction: "row", gap: 2 }, /* @__PURE__ */ React33.createElement(ControlContainer, { direction: "column" }, /* @__PURE__ */ React33.createElement(ControlLabel, null, __15("Bottom", "elementor")), /* @__PURE__ */ React33.createElement(
|
|
963
993
|
Control4,
|
|
964
994
|
{
|
|
965
995
|
bind: "bottom",
|
|
966
996
|
value: bottom,
|
|
967
997
|
setValue: setLinkedValue,
|
|
968
|
-
startIcon: /* @__PURE__ */
|
|
998
|
+
startIcon: /* @__PURE__ */ React33.createElement(SideBottomIcon, { fontSize: "tiny" })
|
|
969
999
|
}
|
|
970
|
-
)), /* @__PURE__ */
|
|
1000
|
+
)), /* @__PURE__ */ React33.createElement(ControlContainer, { direction: "column" }, /* @__PURE__ */ React33.createElement(ControlLabel, null, __15("Left", "elementor")), /* @__PURE__ */ React33.createElement(
|
|
971
1001
|
Control4,
|
|
972
1002
|
{
|
|
973
1003
|
bind: "left",
|
|
974
1004
|
value: left,
|
|
975
1005
|
setValue: setLinkedValue,
|
|
976
|
-
startIcon: /* @__PURE__ */
|
|
1006
|
+
startIcon: /* @__PURE__ */ React33.createElement(SideLeftIcon, { fontSize: "tiny" })
|
|
977
1007
|
}
|
|
978
1008
|
))));
|
|
979
1009
|
};
|
|
@@ -982,7 +1012,7 @@ var Control4 = ({
|
|
|
982
1012
|
startIcon,
|
|
983
1013
|
value,
|
|
984
1014
|
setValue
|
|
985
|
-
}) => /* @__PURE__ */
|
|
1015
|
+
}) => /* @__PURE__ */ React33.createElement(
|
|
986
1016
|
ControlContext.Provider,
|
|
987
1017
|
{
|
|
988
1018
|
value: {
|
|
@@ -991,12 +1021,12 @@ var Control4 = ({
|
|
|
991
1021
|
value
|
|
992
1022
|
}
|
|
993
1023
|
},
|
|
994
|
-
/* @__PURE__ */
|
|
1024
|
+
/* @__PURE__ */ React33.createElement(SizeControl, { startIcon })
|
|
995
1025
|
);
|
|
996
1026
|
|
|
997
1027
|
// src/components/style-sections/spacing-section/spacing-section.tsx
|
|
998
1028
|
var SpacingSection = () => {
|
|
999
|
-
return /* @__PURE__ */
|
|
1029
|
+
return /* @__PURE__ */ React34.createElement(AccordionSection, { title: __16("Spacing", "elementor") }, /* @__PURE__ */ React34.createElement(Stack9, { gap: 1.5 }, /* @__PURE__ */ React34.createElement(StyleControl, { bind: "padding" }, /* @__PURE__ */ React34.createElement(LinkedDimensionsControl, { label: __16("Padding", "elementor") })), /* @__PURE__ */ React34.createElement(Divider2, null), /* @__PURE__ */ React34.createElement(StyleControl, { bind: "margin" }, /* @__PURE__ */ React34.createElement(LinkedDimensionsControl, { label: __16("Margin", "elementor") }))));
|
|
1000
1030
|
};
|
|
1001
1031
|
|
|
1002
1032
|
// src/components/style-tab.tsx
|
|
@@ -1004,7 +1034,7 @@ var CLASSES_PROP_KEY = "classes";
|
|
|
1004
1034
|
var StyleTab = () => {
|
|
1005
1035
|
const styleDefinition = useStyleDefinition();
|
|
1006
1036
|
const classesProp = useClassesProp();
|
|
1007
|
-
return /* @__PURE__ */
|
|
1037
|
+
return /* @__PURE__ */ React35.createElement(StyleContext, { selectedStyleDef: styleDefinition, selectedClassesProp: classesProp }, /* @__PURE__ */ React35.createElement(Stack10, null, /* @__PURE__ */ React35.createElement(SizeSection, null), /* @__PURE__ */ React35.createElement(PositionSection, null), /* @__PURE__ */ React35.createElement(TypographySection, null), /* @__PURE__ */ React35.createElement(SpacingSection, null)));
|
|
1008
1038
|
};
|
|
1009
1039
|
function useClassesProp() {
|
|
1010
1040
|
const { elementType } = useElementContext();
|
|
@@ -1023,7 +1053,7 @@ function useStyleDefinition() {
|
|
|
1023
1053
|
// src/components/editing-panel-tabs.tsx
|
|
1024
1054
|
var EditingPanelTabs = () => {
|
|
1025
1055
|
const { getTabProps, getTabPanelProps, getTabsProps } = useTabs("settings");
|
|
1026
|
-
return /* @__PURE__ */
|
|
1056
|
+
return /* @__PURE__ */ React36.createElement(Stack11, { direction: "column", sx: { width: "100%" } }, /* @__PURE__ */ React36.createElement(Tabs, { variant: "fullWidth", indicatorColor: "secondary", textColor: "inherit", ...getTabsProps() }, /* @__PURE__ */ React36.createElement(Tab, { label: __17("General", "elementor"), ...getTabProps("settings") }), /* @__PURE__ */ React36.createElement(Tab, { label: __17("Style", "elementor"), ...getTabProps("style") })), /* @__PURE__ */ React36.createElement(TabPanel, { ...getTabPanelProps("settings"), disablePadding: true }, /* @__PURE__ */ React36.createElement(SettingsTab, null)), /* @__PURE__ */ React36.createElement(TabPanel, { ...getTabPanelProps("style"), disablePadding: true }, /* @__PURE__ */ React36.createElement(StyleTab, null)));
|
|
1027
1057
|
};
|
|
1028
1058
|
|
|
1029
1059
|
// src/components/editing-panel.tsx
|
|
@@ -1034,8 +1064,8 @@ var EditingPanel = () => {
|
|
|
1034
1064
|
if (elements.length !== 1 || !elementType) {
|
|
1035
1065
|
return null;
|
|
1036
1066
|
}
|
|
1037
|
-
const panelTitle =
|
|
1038
|
-
return /* @__PURE__ */
|
|
1067
|
+
const panelTitle = __18("Edit %s", "elementor").replace("%s", elementType.title);
|
|
1068
|
+
return /* @__PURE__ */ React37.createElement(Panel, null, /* @__PURE__ */ React37.createElement(PanelHeader, null, /* @__PURE__ */ React37.createElement(PanelHeaderTitle, null, panelTitle)), /* @__PURE__ */ React37.createElement(PanelBody, null, /* @__PURE__ */ React37.createElement(ElementContext, { element: selectedElement, elementType }, /* @__PURE__ */ React37.createElement(EditingPanelTabs, null))));
|
|
1039
1069
|
};
|
|
1040
1070
|
|
|
1041
1071
|
// src/panel.ts
|
|
@@ -1082,11 +1112,11 @@ import { __registerPanel as registerPanel } from "@elementor/editor-panels";
|
|
|
1082
1112
|
import { __privateBlockDataCommand as blockDataCommand } from "@elementor/editor-v1-adapters";
|
|
1083
1113
|
|
|
1084
1114
|
// src/dynamics/components/dynamic-selection-control.tsx
|
|
1085
|
-
import * as
|
|
1115
|
+
import * as React40 from "react";
|
|
1086
1116
|
import { useId as useId3 } from "react";
|
|
1087
1117
|
|
|
1088
1118
|
// src/dynamics/dynamic-control.tsx
|
|
1089
|
-
import * as
|
|
1119
|
+
import * as React38 from "react";
|
|
1090
1120
|
|
|
1091
1121
|
// src/dynamics/hooks/use-prop-dynamic-tags.ts
|
|
1092
1122
|
import { useMemo } from "react";
|
|
@@ -1176,14 +1206,14 @@ var DynamicControl = ({ bind, children }) => {
|
|
|
1176
1206
|
}
|
|
1177
1207
|
});
|
|
1178
1208
|
};
|
|
1179
|
-
return /* @__PURE__ */
|
|
1209
|
+
return /* @__PURE__ */ React38.createElement(ControlContext.Provider, { value: { setValue: setDynamicValue, value: dynamicValue, bind } }, children);
|
|
1180
1210
|
};
|
|
1181
1211
|
|
|
1182
1212
|
// src/dynamics/components/dynamic-selection-control.tsx
|
|
1183
1213
|
import { DatabaseIcon, SettingsIcon, XIcon } from "@elementor/icons";
|
|
1184
1214
|
|
|
1185
1215
|
// src/dynamics/components/dynamic-selection.tsx
|
|
1186
|
-
import * as
|
|
1216
|
+
import * as React39 from "react";
|
|
1187
1217
|
import { useState as useState3, Fragment as Fragment2 } from "react";
|
|
1188
1218
|
import { SearchIcon, PhotoIcon } from "@elementor/icons";
|
|
1189
1219
|
import {
|
|
@@ -1198,45 +1228,72 @@ import {
|
|
|
1198
1228
|
TextField as TextField5,
|
|
1199
1229
|
Typography as Typography2
|
|
1200
1230
|
} from "@elementor/ui";
|
|
1201
|
-
import { __ as
|
|
1231
|
+
import { __ as __19 } from "@wordpress/i18n";
|
|
1232
|
+
|
|
1233
|
+
// src/dynamics/hooks/use-prop-value-history.ts
|
|
1234
|
+
var PROPS_VALUES_HISTORY_KEY = "elementor/dynamic/non-dynamic-values-history";
|
|
1235
|
+
var usePropValueHistory = (path) => {
|
|
1236
|
+
const valuesHistory = getValues();
|
|
1237
|
+
const { element } = useElementContext();
|
|
1238
|
+
const key = `${element.id}-${path}`;
|
|
1239
|
+
const value = valuesHistory[key] ?? null;
|
|
1240
|
+
const setValue = (newValue) => {
|
|
1241
|
+
setValues({ ...valuesHistory, [key]: newValue });
|
|
1242
|
+
};
|
|
1243
|
+
return [value, setValue];
|
|
1244
|
+
};
|
|
1245
|
+
var getValues = () => {
|
|
1246
|
+
return JSON.parse(sessionStorage.getItem(PROPS_VALUES_HISTORY_KEY) || "{}");
|
|
1247
|
+
};
|
|
1248
|
+
var setValues = (values) => {
|
|
1249
|
+
sessionStorage.setItem(PROPS_VALUES_HISTORY_KEY, JSON.stringify(values));
|
|
1250
|
+
};
|
|
1251
|
+
|
|
1252
|
+
// src/dynamics/components/dynamic-selection.tsx
|
|
1202
1253
|
var SIZE = "tiny";
|
|
1203
1254
|
var DynamicSelection = ({ onSelect }) => {
|
|
1204
1255
|
const [searchValue, setSearchValue] = useState3("");
|
|
1205
1256
|
const { groups: dynamicGroups } = getAtomicDynamicTags() || {};
|
|
1206
|
-
const { bind, value:
|
|
1207
|
-
const
|
|
1257
|
+
const { bind, value: currentValue, setValue } = useControl();
|
|
1258
|
+
const [, updatePropValueHistory] = usePropValueHistory(bind);
|
|
1259
|
+
const isCurrentValueDynamic = isDynamicPropValue(currentValue);
|
|
1260
|
+
const options3 = useFilteredOptions(bind, searchValue);
|
|
1208
1261
|
const handleSearch = (event) => {
|
|
1209
1262
|
setSearchValue(event.target.value);
|
|
1210
1263
|
};
|
|
1211
|
-
|
|
1264
|
+
const handleSetDynamicTag = (value) => {
|
|
1265
|
+
if (!isCurrentValueDynamic) {
|
|
1266
|
+
updatePropValueHistory(currentValue);
|
|
1267
|
+
}
|
|
1268
|
+
setValue({ $$type: "dynamic", value: { name: value } });
|
|
1269
|
+
onSelect?.();
|
|
1270
|
+
};
|
|
1271
|
+
return /* @__PURE__ */ React39.createElement(Stack12, null, /* @__PURE__ */ React39.createElement(Box, { px: 1.5, pb: 1 }, /* @__PURE__ */ React39.createElement(
|
|
1212
1272
|
TextField5,
|
|
1213
1273
|
{
|
|
1214
1274
|
fullWidth: true,
|
|
1215
1275
|
size: SIZE,
|
|
1216
1276
|
value: searchValue,
|
|
1217
1277
|
onChange: handleSearch,
|
|
1218
|
-
placeholder:
|
|
1278
|
+
placeholder: __19("Search dynamic tag", "elementor"),
|
|
1219
1279
|
InputProps: {
|
|
1220
|
-
startAdornment: /* @__PURE__ */
|
|
1280
|
+
startAdornment: /* @__PURE__ */ React39.createElement(InputAdornment3, { position: "start" }, /* @__PURE__ */ React39.createElement(SearchIcon, { fontSize: SIZE }))
|
|
1221
1281
|
}
|
|
1222
1282
|
}
|
|
1223
|
-
)), /* @__PURE__ */
|
|
1224
|
-
const isSelected = value ===
|
|
1225
|
-
return /* @__PURE__ */
|
|
1283
|
+
)), /* @__PURE__ */ React39.createElement(Divider3, null), /* @__PURE__ */ React39.createElement(Box, { sx: { overflowY: "auto", height: 260, width: 220 } }, options3.length > 0 ? /* @__PURE__ */ React39.createElement(MenuList, { role: "listbox", tabIndex: 0 }, options3.map(([category, items], index) => /* @__PURE__ */ React39.createElement(Fragment2, { key: index }, /* @__PURE__ */ React39.createElement(ListSubheader, { sx: { typography: "caption", color: "text.tertiary" } }, dynamicGroups?.[category]?.title || category), items.map(({ value, label: tagLabel }) => {
|
|
1284
|
+
const isSelected = isCurrentValueDynamic && value === currentValue?.value?.name;
|
|
1285
|
+
return /* @__PURE__ */ React39.createElement(
|
|
1226
1286
|
MenuItem3,
|
|
1227
1287
|
{
|
|
1228
1288
|
key: value,
|
|
1229
1289
|
selected: isSelected,
|
|
1230
1290
|
autoFocus: isSelected,
|
|
1231
1291
|
sx: { typography: "caption" },
|
|
1232
|
-
onClick: () =>
|
|
1233
|
-
setValue({ $$type: "dynamic", value: { name: value } });
|
|
1234
|
-
onSelect?.();
|
|
1235
|
-
}
|
|
1292
|
+
onClick: () => handleSetDynamicTag(value)
|
|
1236
1293
|
},
|
|
1237
1294
|
tagLabel
|
|
1238
1295
|
);
|
|
1239
|
-
})))) : /* @__PURE__ */
|
|
1296
|
+
})))) : /* @__PURE__ */ React39.createElement(Stack12, { alignItems: "center", p: 2.5, gap: 1.5 }, /* @__PURE__ */ React39.createElement(PhotoIcon, { fontSize: "large" }), /* @__PURE__ */ React39.createElement(Typography2, { align: "center", variant: "caption", color: "text.secondary" }, __19("Sorry, nothing matched", "elementor"), /* @__PURE__ */ React39.createElement("br", null), "\u201C", searchValue, "\u201D."), /* @__PURE__ */ React39.createElement(Typography2, { align: "center", variant: "caption", color: "text.secondary" }, /* @__PURE__ */ React39.createElement(
|
|
1240
1297
|
Link,
|
|
1241
1298
|
{
|
|
1242
1299
|
color: "secondary",
|
|
@@ -1244,12 +1301,12 @@ var DynamicSelection = ({ onSelect }) => {
|
|
|
1244
1301
|
component: "button",
|
|
1245
1302
|
onClick: () => setSearchValue("")
|
|
1246
1303
|
},
|
|
1247
|
-
|
|
1248
|
-
), "\xA0",
|
|
1304
|
+
__19("Clear the filters", "elementor")
|
|
1305
|
+
), "\xA0", __19("and try again.", "elementor")))));
|
|
1249
1306
|
};
|
|
1250
1307
|
var useFilteredOptions = (bind, searchValue) => {
|
|
1251
1308
|
const dynamicTags = usePropDynamicTags(bind);
|
|
1252
|
-
const
|
|
1309
|
+
const options3 = dynamicTags.reduce((categories, { name, label, group }) => {
|
|
1253
1310
|
const isVisible = label.toLowerCase().includes(searchValue.trim().toLowerCase());
|
|
1254
1311
|
if (!isVisible) {
|
|
1255
1312
|
return categories;
|
|
@@ -1260,7 +1317,7 @@ var useFilteredOptions = (bind, searchValue) => {
|
|
|
1260
1317
|
categories.get(group)?.push({ label, value: name });
|
|
1261
1318
|
return categories;
|
|
1262
1319
|
}, /* @__PURE__ */ new Map());
|
|
1263
|
-
return [...
|
|
1320
|
+
return [...options3];
|
|
1264
1321
|
};
|
|
1265
1322
|
|
|
1266
1323
|
// src/dynamics/components/dynamic-selection-control.tsx
|
|
@@ -1281,39 +1338,40 @@ import {
|
|
|
1281
1338
|
Tab as Tab2,
|
|
1282
1339
|
TabPanel as TabPanel2
|
|
1283
1340
|
} from "@elementor/ui";
|
|
1284
|
-
import { __ as
|
|
1341
|
+
import { __ as __20 } from "@wordpress/i18n";
|
|
1285
1342
|
var SIZE2 = "tiny";
|
|
1286
1343
|
var DynamicSelectionControl = () => {
|
|
1287
1344
|
const { bind, value, setValue } = useControl();
|
|
1345
|
+
const [propValueFromHistory] = usePropValueHistory(bind);
|
|
1288
1346
|
const { name: tagName = "" } = value?.value || {};
|
|
1289
1347
|
const selectionPopoverId = useId3();
|
|
1290
1348
|
const selectionPopoverState = usePopupState2({ variant: "popover", popupId: selectionPopoverId });
|
|
1291
1349
|
const dynamicTag = useDynamicTag(bind, tagName);
|
|
1292
1350
|
const removeDynamicTag = () => {
|
|
1293
|
-
setValue(null);
|
|
1351
|
+
setValue(propValueFromHistory ?? null);
|
|
1294
1352
|
};
|
|
1295
1353
|
if (!dynamicTag) {
|
|
1296
1354
|
throw new Error(`Dynamic tag ${tagName} not found`);
|
|
1297
1355
|
}
|
|
1298
|
-
return /* @__PURE__ */
|
|
1356
|
+
return /* @__PURE__ */ React40.createElement(Box2, { sx: { width: "100%" } }, /* @__PURE__ */ React40.createElement(
|
|
1299
1357
|
Tag,
|
|
1300
1358
|
{
|
|
1301
1359
|
fullWidth: true,
|
|
1302
1360
|
showActionsOnHover: true,
|
|
1303
1361
|
label: dynamicTag.label,
|
|
1304
|
-
startIcon: /* @__PURE__ */
|
|
1362
|
+
startIcon: /* @__PURE__ */ React40.createElement(DatabaseIcon, { fontSize: SIZE2 }),
|
|
1305
1363
|
...bindTrigger2(selectionPopoverState),
|
|
1306
|
-
actions: /* @__PURE__ */
|
|
1364
|
+
actions: /* @__PURE__ */ React40.createElement(React40.Fragment, null, /* @__PURE__ */ React40.createElement(DynamicSettingsPopover, { dynamicTag }), /* @__PURE__ */ React40.createElement(
|
|
1307
1365
|
IconButton,
|
|
1308
1366
|
{
|
|
1309
1367
|
size: SIZE2,
|
|
1310
1368
|
onClick: removeDynamicTag,
|
|
1311
|
-
"aria-label":
|
|
1369
|
+
"aria-label": __20("Remove dynamic value", "elementor")
|
|
1312
1370
|
},
|
|
1313
|
-
/* @__PURE__ */
|
|
1371
|
+
/* @__PURE__ */ React40.createElement(XIcon, { fontSize: SIZE2 })
|
|
1314
1372
|
))
|
|
1315
1373
|
}
|
|
1316
|
-
), /* @__PURE__ */
|
|
1374
|
+
), /* @__PURE__ */ React40.createElement(
|
|
1317
1375
|
Popover,
|
|
1318
1376
|
{
|
|
1319
1377
|
disablePortal: true,
|
|
@@ -1321,7 +1379,7 @@ var DynamicSelectionControl = () => {
|
|
|
1321
1379
|
anchorOrigin: { vertical: "bottom", horizontal: "left" },
|
|
1322
1380
|
...bindPopover(selectionPopoverState)
|
|
1323
1381
|
},
|
|
1324
|
-
/* @__PURE__ */
|
|
1382
|
+
/* @__PURE__ */ React40.createElement(Stack13, null, /* @__PURE__ */ React40.createElement(Stack13, { direction: "row", alignItems: "center", pl: 1.5, pr: 0.5, py: 1.5 }, /* @__PURE__ */ React40.createElement(DatabaseIcon, { fontSize: SIZE2, sx: { mr: 0.5 } }), /* @__PURE__ */ React40.createElement(Typography3, { variant: "subtitle2" }, __20("Dynamic Tags", "elementor")), /* @__PURE__ */ React40.createElement(IconButton, { size: SIZE2, sx: { ml: "auto" }, onClick: selectionPopoverState.close }, /* @__PURE__ */ React40.createElement(XIcon, { fontSize: SIZE2 }))), /* @__PURE__ */ React40.createElement(DynamicSelection, { onSelect: selectionPopoverState.close }))
|
|
1325
1383
|
));
|
|
1326
1384
|
};
|
|
1327
1385
|
var DynamicSettingsPopover = ({ dynamicTag }) => {
|
|
@@ -1331,22 +1389,22 @@ var DynamicSettingsPopover = ({ dynamicTag }) => {
|
|
|
1331
1389
|
if (!hasDynamicSettings) {
|
|
1332
1390
|
return null;
|
|
1333
1391
|
}
|
|
1334
|
-
return /* @__PURE__ */
|
|
1392
|
+
return /* @__PURE__ */ React40.createElement(React40.Fragment, null, /* @__PURE__ */ React40.createElement(
|
|
1335
1393
|
IconButton,
|
|
1336
1394
|
{
|
|
1337
1395
|
size: SIZE2,
|
|
1338
1396
|
...bindTrigger2(settingsPopupState),
|
|
1339
|
-
"aria-label":
|
|
1397
|
+
"aria-label": __20("Settings", "elementor")
|
|
1340
1398
|
},
|
|
1341
|
-
/* @__PURE__ */
|
|
1342
|
-
), /* @__PURE__ */
|
|
1399
|
+
/* @__PURE__ */ React40.createElement(SettingsIcon, { fontSize: SIZE2 })
|
|
1400
|
+
), /* @__PURE__ */ React40.createElement(
|
|
1343
1401
|
Popover,
|
|
1344
1402
|
{
|
|
1345
1403
|
disableScrollLock: true,
|
|
1346
1404
|
anchorOrigin: { vertical: "bottom", horizontal: "center" },
|
|
1347
1405
|
...bindPopover(settingsPopupState)
|
|
1348
1406
|
},
|
|
1349
|
-
/* @__PURE__ */
|
|
1407
|
+
/* @__PURE__ */ React40.createElement(Paper, { component: Stack13, sx: { minHeight: "300px", width: "220px" } }, /* @__PURE__ */ React40.createElement(Stack13, { direction: "row", alignItems: "center", px: 1.5, pt: 2, pb: 1 }, /* @__PURE__ */ React40.createElement(DatabaseIcon, { fontSize: SIZE2, sx: { mr: 0.5 } }), /* @__PURE__ */ React40.createElement(Typography3, { variant: "subtitle2" }, dynamicTag.label), /* @__PURE__ */ React40.createElement(IconButton, { sx: { ml: "auto" }, size: SIZE2, onClick: settingsPopupState.close }, /* @__PURE__ */ React40.createElement(XIcon, { fontSize: SIZE2 }))), /* @__PURE__ */ React40.createElement(DynamicSettings, { controls: dynamicTag.atomic_controls }))
|
|
1350
1408
|
));
|
|
1351
1409
|
};
|
|
1352
1410
|
var DynamicSettings = ({ controls }) => {
|
|
@@ -1355,10 +1413,10 @@ var DynamicSettings = ({ controls }) => {
|
|
|
1355
1413
|
if (!tabs.length) {
|
|
1356
1414
|
return null;
|
|
1357
1415
|
}
|
|
1358
|
-
return /* @__PURE__ */
|
|
1359
|
-
return /* @__PURE__ */
|
|
1416
|
+
return /* @__PURE__ */ React40.createElement(React40.Fragment, null, /* @__PURE__ */ React40.createElement(Tabs2, { indicatorColor: "secondary", textColor: "secondary", ...getTabsProps() }, tabs.map(({ value }, index) => /* @__PURE__ */ React40.createElement(Tab2, { key: index, label: value.label, sx: { px: 1, py: 0.5 }, ...getTabProps(index) }))), /* @__PURE__ */ React40.createElement(Divider4, null), tabs.map(({ value }, index) => {
|
|
1417
|
+
return /* @__PURE__ */ React40.createElement(TabPanel2, { key: index, sx: { flexGrow: 1 }, ...getTabPanelProps(index) }, /* @__PURE__ */ React40.createElement(Stack13, { gap: 1, px: 2 }, value.items.map((item) => {
|
|
1360
1418
|
if (item.type === "control") {
|
|
1361
|
-
return /* @__PURE__ */
|
|
1419
|
+
return /* @__PURE__ */ React40.createElement(Control5, { key: item.value.bind, control: item.value });
|
|
1362
1420
|
}
|
|
1363
1421
|
return null;
|
|
1364
1422
|
})));
|
|
@@ -1368,7 +1426,7 @@ var Control5 = ({ control }) => {
|
|
|
1368
1426
|
if (!getControlByType(control.type)) {
|
|
1369
1427
|
return null;
|
|
1370
1428
|
}
|
|
1371
|
-
return /* @__PURE__ */
|
|
1429
|
+
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 }));
|
|
1372
1430
|
};
|
|
1373
1431
|
|
|
1374
1432
|
// src/dynamics/init.ts
|