@elementor/editor-editing-panel 1.34.0 → 1.36.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 +39 -0
- package/dist/index.js +210 -148
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +159 -97
- package/dist/index.mjs.map +1 -1
- package/package.json +13 -13
- package/src/components/creatable-autocomplete/creatable-autocomplete.tsx +27 -15
- package/src/components/creatable-autocomplete/use-autocomplete-states.ts +15 -1
- package/src/components/css-classes/css-class-item.tsx +4 -1
- package/src/components/css-classes/css-class-selector.tsx +58 -44
- package/src/components/editing-panel-tabs.tsx +37 -20
- package/src/components/section.tsx +4 -3
- package/src/components/style-sections/layout-section/display-field.tsx +1 -1
- package/src/components/style-sections/position-section/position-section.tsx +1 -1
- package/src/hooks/use-state-by-element.ts +18 -0
- package/src/styles-inheritance/styles-inheritance-indicator.tsx +1 -1
- package/src/sync/get-elementor-globals.ts +0 -6
- package/src/sync/is-experiment-active.ts +0 -7
package/dist/index.mjs
CHANGED
|
@@ -7,6 +7,7 @@ var { registerControlReplacement, getControlReplacements } = createControlReplac
|
|
|
7
7
|
|
|
8
8
|
// src/components/css-classes/css-class-selector.tsx
|
|
9
9
|
import * as React7 from "react";
|
|
10
|
+
import { useRef, useState as useState4 } from "react";
|
|
10
11
|
import { getElementSetting, updateElementSettings as updateElementSettings2, useElementSetting as useElementSetting2 } from "@elementor/editor-elements";
|
|
11
12
|
import { classesPropTypeUtil } from "@elementor/editor-props";
|
|
12
13
|
import {
|
|
@@ -16,6 +17,7 @@ import {
|
|
|
16
17
|
useProviders,
|
|
17
18
|
validateStyleLabel as validateStyleLabel2
|
|
18
19
|
} from "@elementor/editor-styles-repository";
|
|
20
|
+
import { WarningInfotip } from "@elementor/editor-ui";
|
|
19
21
|
import { MapPinIcon } from "@elementor/icons";
|
|
20
22
|
import { createLocation } from "@elementor/locations";
|
|
21
23
|
import { Chip as Chip3, FormLabel, Stack as Stack3 } from "@elementor/ui";
|
|
@@ -186,7 +188,20 @@ function useInputState(validate) {
|
|
|
186
188
|
setError(errorMessage);
|
|
187
189
|
}
|
|
188
190
|
};
|
|
189
|
-
|
|
191
|
+
const handleInputBlur = () => {
|
|
192
|
+
setInputValue("");
|
|
193
|
+
setError(null);
|
|
194
|
+
};
|
|
195
|
+
return {
|
|
196
|
+
inputValue,
|
|
197
|
+
setInputValue,
|
|
198
|
+
error,
|
|
199
|
+
setError,
|
|
200
|
+
inputHandlers: {
|
|
201
|
+
onChange: handleInputChange,
|
|
202
|
+
onBlur: handleInputBlur
|
|
203
|
+
}
|
|
204
|
+
};
|
|
190
205
|
}
|
|
191
206
|
function useOpenState(initialOpen = false) {
|
|
192
207
|
const [open, setOpen] = useState(initialOpen);
|
|
@@ -253,7 +268,8 @@ function useFilterOptions(parameters) {
|
|
|
253
268
|
}
|
|
254
269
|
|
|
255
270
|
// src/components/creatable-autocomplete/creatable-autocomplete.tsx
|
|
256
|
-
|
|
271
|
+
var CreatableAutocomplete = React4.forwardRef(CreatableAutocompleteInner);
|
|
272
|
+
function CreatableAutocompleteInner({
|
|
257
273
|
selected,
|
|
258
274
|
options: options12,
|
|
259
275
|
entityName,
|
|
@@ -262,8 +278,8 @@ function CreatableAutocomplete({
|
|
|
262
278
|
onCreate,
|
|
263
279
|
validate,
|
|
264
280
|
...props
|
|
265
|
-
}) {
|
|
266
|
-
const { inputValue, setInputValue, error, setError,
|
|
281
|
+
}, ref) {
|
|
282
|
+
const { inputValue, setInputValue, error, setError, inputHandlers } = useInputState(validate);
|
|
267
283
|
const { open, openDropdown, closeDropdown } = useOpenState(props.open);
|
|
268
284
|
const { createOption, loading } = useCreateOption({ onCreate, validate, setInputValue, setError, closeDropdown });
|
|
269
285
|
const [internalOptions, internalSelected] = useMemo(
|
|
@@ -293,6 +309,7 @@ function CreatableAutocomplete({
|
|
|
293
309
|
));
|
|
294
310
|
},
|
|
295
311
|
...props,
|
|
312
|
+
ref,
|
|
296
313
|
freeSolo: true,
|
|
297
314
|
multiple: true,
|
|
298
315
|
clearOnBlur: true,
|
|
@@ -306,7 +323,7 @@ function CreatableAutocomplete({
|
|
|
306
323
|
disableCloseOnSelect: true,
|
|
307
324
|
value: internalSelected,
|
|
308
325
|
options: internalOptions,
|
|
309
|
-
ListboxComponent: error ? React4.forwardRef((_,
|
|
326
|
+
ListboxComponent: error ? React4.forwardRef((_, errorTextRef) => /* @__PURE__ */ React4.createElement(ErrorText, { ref: errorTextRef, error })) : void 0,
|
|
310
327
|
renderGroup: (params) => /* @__PURE__ */ React4.createElement(Group, { ...params }),
|
|
311
328
|
inputValue,
|
|
312
329
|
renderInput: (params) => {
|
|
@@ -316,7 +333,7 @@ function CreatableAutocomplete({
|
|
|
316
333
|
...params,
|
|
317
334
|
placeholder,
|
|
318
335
|
error: Boolean(error),
|
|
319
|
-
|
|
336
|
+
...inputHandlers,
|
|
320
337
|
sx: (theme) => ({
|
|
321
338
|
".MuiAutocomplete-inputRoot.MuiInputBase-adornedStart": {
|
|
322
339
|
paddingLeft: theme.spacing(0.25),
|
|
@@ -364,7 +381,7 @@ var ErrorText = React4.forwardRef(({ error = "error" }, ref) => {
|
|
|
364
381
|
padding: theme.spacing(2)
|
|
365
382
|
})
|
|
366
383
|
},
|
|
367
|
-
/* @__PURE__ */ React4.createElement(Typography, { variant: "caption", sx: { color: "error.main" } }, error)
|
|
384
|
+
/* @__PURE__ */ React4.createElement(Typography, { variant: "caption", sx: { color: "error.main", display: "inline-block" } }, error)
|
|
368
385
|
);
|
|
369
386
|
});
|
|
370
387
|
var StyledGroup = styled("li")`
|
|
@@ -613,7 +630,8 @@ function CssClassItem({
|
|
|
613
630
|
icon,
|
|
614
631
|
chipProps,
|
|
615
632
|
onClickActive,
|
|
616
|
-
renameLabel
|
|
633
|
+
renameLabel,
|
|
634
|
+
setError
|
|
617
635
|
}) {
|
|
618
636
|
const { meta, setMetaState } = useStyle();
|
|
619
637
|
const popupState = usePopupState({ variant: "popover" });
|
|
@@ -628,7 +646,8 @@ function CssClassItem({
|
|
|
628
646
|
} = useEditable({
|
|
629
647
|
value: label,
|
|
630
648
|
onSubmit: renameLabel,
|
|
631
|
-
validation: validateLabel
|
|
649
|
+
validation: validateLabel,
|
|
650
|
+
onError: setError
|
|
632
651
|
});
|
|
633
652
|
const color = error ? "error" : colorProp;
|
|
634
653
|
const providerActions = provider ? stylesRepository3.getProviderByKey(provider)?.actions : null;
|
|
@@ -649,7 +668,7 @@ function CssClassItem({
|
|
|
649
668
|
Chip2,
|
|
650
669
|
{
|
|
651
670
|
size: CHIP_SIZE,
|
|
652
|
-
label: isEditing ? /* @__PURE__ */ React6.createElement(EditableField, { ref,
|
|
671
|
+
label: isEditing ? /* @__PURE__ */ React6.createElement(EditableField, { ref, ...getEditableProps() }) : /* @__PURE__ */ React6.createElement(EllipsisWithTooltip, { maxWidth: "10ch", title: label, as: "div" }),
|
|
653
672
|
variant: isActive && !meta.state && !isEditing ? "filled" : "standard",
|
|
654
673
|
shape: "rounded",
|
|
655
674
|
icon,
|
|
@@ -730,51 +749,65 @@ function CssClassSelector() {
|
|
|
730
749
|
const options12 = useOptions();
|
|
731
750
|
const { value: appliedIds, setValue: setAppliedIds, pushValue: pushAppliedId } = useAppliedClassesIds();
|
|
732
751
|
const { id: activeId, setId: setActiveId } = useStyle();
|
|
752
|
+
const autocompleteRef = useRef(null);
|
|
753
|
+
const [renameError, setRenameError] = useState4(null);
|
|
733
754
|
const handleApply = useHandleApply(appliedIds, setAppliedIds);
|
|
734
755
|
const { create, validate, entityName } = useCreateAction({ pushAppliedId, setActiveId });
|
|
735
756
|
const applied = useAppliedOptions(options12, appliedIds);
|
|
736
757
|
const active = applied.find((option) => option.value === activeId) ?? EMPTY_OPTION;
|
|
737
758
|
const showPlaceholder = applied.every(({ fixed }) => fixed);
|
|
738
759
|
return /* @__PURE__ */ React7.createElement(Stack3, { p: 2 }, /* @__PURE__ */ React7.createElement(Stack3, { direction: "row", gap: 1, alignItems: "center", justifyContent: "space-between" }, /* @__PURE__ */ React7.createElement(FormLabel, { htmlFor: ID, size: "small" }, __3("Classes", "elementor")), /* @__PURE__ */ React7.createElement(Stack3, { direction: "row", gap: 1 }, /* @__PURE__ */ React7.createElement(ClassSelectorActionsSlot, null))), /* @__PURE__ */ React7.createElement(
|
|
739
|
-
|
|
760
|
+
WarningInfotip,
|
|
740
761
|
{
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
{
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
762
|
+
open: Boolean(renameError),
|
|
763
|
+
text: renameError ?? "",
|
|
764
|
+
placement: "bottom",
|
|
765
|
+
width: autocompleteRef.current?.getBoundingClientRect().width,
|
|
766
|
+
offset: [0, -15]
|
|
767
|
+
},
|
|
768
|
+
/* @__PURE__ */ React7.createElement(
|
|
769
|
+
CreatableAutocomplete,
|
|
770
|
+
{
|
|
771
|
+
id: ID,
|
|
772
|
+
ref: autocompleteRef,
|
|
773
|
+
size: "tiny",
|
|
774
|
+
placeholder: showPlaceholder ? __3("Type class name", "elementor") : void 0,
|
|
775
|
+
options: options12,
|
|
776
|
+
selected: applied,
|
|
777
|
+
entityName,
|
|
778
|
+
onSelect: handleApply,
|
|
779
|
+
onCreate: create ?? void 0,
|
|
780
|
+
validate: validate ?? void 0,
|
|
781
|
+
limitTags: TAGS_LIMIT,
|
|
782
|
+
getLimitTagsText: (more) => /* @__PURE__ */ React7.createElement(Chip3, { size: "tiny", variant: "standard", label: `+${more}`, clickable: true }),
|
|
783
|
+
renderTags: (values, getTagProps) => values.map((value, index) => {
|
|
784
|
+
const chipProps = getTagProps({ index });
|
|
785
|
+
const isActive = value.value === active?.value;
|
|
786
|
+
const renameLabel = (newLabel) => {
|
|
787
|
+
if (!value.value) {
|
|
788
|
+
throw new Error(`Cannot rename a class without style id`);
|
|
789
|
+
}
|
|
790
|
+
return updateClassByProvider(value.provider, { label: newLabel, id: value.value });
|
|
791
|
+
};
|
|
792
|
+
return /* @__PURE__ */ React7.createElement(
|
|
793
|
+
CssClassItem,
|
|
794
|
+
{
|
|
795
|
+
key: chipProps.key,
|
|
796
|
+
label: value.label,
|
|
797
|
+
provider: value.provider,
|
|
798
|
+
id: value.value,
|
|
799
|
+
isActive,
|
|
800
|
+
color: isActive && value.color ? value.color : "default",
|
|
801
|
+
icon: value.icon,
|
|
802
|
+
chipProps,
|
|
803
|
+
onClickActive: () => setActiveId(value.value),
|
|
804
|
+
renameLabel,
|
|
805
|
+
setError: setRenameError
|
|
806
|
+
}
|
|
807
|
+
);
|
|
808
|
+
})
|
|
809
|
+
}
|
|
810
|
+
)
|
|
778
811
|
));
|
|
779
812
|
}
|
|
780
813
|
var updateClassByProvider = (provider, data) => {
|
|
@@ -967,7 +1000,7 @@ import { __ as __45 } from "@wordpress/i18n";
|
|
|
967
1000
|
|
|
968
1001
|
// src/contexts/scroll-context.tsx
|
|
969
1002
|
import * as React10 from "react";
|
|
970
|
-
import { createContext as createContext4, useContext as useContext4, useEffect, useRef, useState as
|
|
1003
|
+
import { createContext as createContext4, useContext as useContext4, useEffect, useRef as useRef2, useState as useState5 } from "react";
|
|
971
1004
|
import { styled as styled3 } from "@elementor/ui";
|
|
972
1005
|
var ScrollContext = createContext4(void 0);
|
|
973
1006
|
var ScrollPanel = styled3("div")`
|
|
@@ -976,9 +1009,9 @@ var ScrollPanel = styled3("div")`
|
|
|
976
1009
|
`;
|
|
977
1010
|
var DEFAULT_SCROLL_DIRECTION = "up";
|
|
978
1011
|
function ScrollProvider({ children }) {
|
|
979
|
-
const [direction, setDirection] =
|
|
980
|
-
const ref =
|
|
981
|
-
const scrollPos =
|
|
1012
|
+
const [direction, setDirection] = useState5(DEFAULT_SCROLL_DIRECTION);
|
|
1013
|
+
const ref = useRef2(null);
|
|
1014
|
+
const scrollPos = useRef2(0);
|
|
982
1015
|
useEffect(() => {
|
|
983
1016
|
const scrollElement = ref.current;
|
|
984
1017
|
if (!scrollElement) {
|
|
@@ -1004,6 +1037,21 @@ function useScrollDirection() {
|
|
|
1004
1037
|
return useContext4(ScrollContext)?.direction ?? DEFAULT_SCROLL_DIRECTION;
|
|
1005
1038
|
}
|
|
1006
1039
|
|
|
1040
|
+
// src/hooks/use-state-by-element.ts
|
|
1041
|
+
import { useState as useState6 } from "react";
|
|
1042
|
+
import { getSessionStorageItem, setSessionStorageItem } from "@elementor/session";
|
|
1043
|
+
var useStateByElement = (key, initialValue) => {
|
|
1044
|
+
const { element } = useElement();
|
|
1045
|
+
const lookup = `elementor/editor-state/${element.id}/${key}`;
|
|
1046
|
+
const storedValue = getSessionStorageItem(lookup);
|
|
1047
|
+
const [value, setValue] = useState6(storedValue ?? initialValue);
|
|
1048
|
+
const doUpdate = (newValue) => {
|
|
1049
|
+
setSessionStorageItem(lookup, newValue);
|
|
1050
|
+
setValue(newValue);
|
|
1051
|
+
};
|
|
1052
|
+
return [value, doUpdate];
|
|
1053
|
+
};
|
|
1054
|
+
|
|
1007
1055
|
// src/components/settings-tab.tsx
|
|
1008
1056
|
import * as React16 from "react";
|
|
1009
1057
|
import { ControlFormLabel } from "@elementor/editor-controls";
|
|
@@ -1105,7 +1153,7 @@ var SettingsField = ({ bind, children }) => {
|
|
|
1105
1153
|
|
|
1106
1154
|
// src/components/section.tsx
|
|
1107
1155
|
import * as React14 from "react";
|
|
1108
|
-
import { useId as useId3
|
|
1156
|
+
import { useId as useId3 } from "react";
|
|
1109
1157
|
import { Collapse, Divider as Divider2, ListItemButton, ListItemText, Stack as Stack5 } from "@elementor/ui";
|
|
1110
1158
|
|
|
1111
1159
|
// src/components/collapse-icon.tsx
|
|
@@ -1122,7 +1170,7 @@ var CollapseIcon = styled5(ChevronDownIcon, {
|
|
|
1122
1170
|
|
|
1123
1171
|
// src/components/section.tsx
|
|
1124
1172
|
function Section({ title, children, defaultExpanded = false }) {
|
|
1125
|
-
const [isOpen, setIsOpen] =
|
|
1173
|
+
const [isOpen, setIsOpen] = useStateByElement(title, !!defaultExpanded);
|
|
1126
1174
|
const id = useId3();
|
|
1127
1175
|
const labelId = `label-${id}`;
|
|
1128
1176
|
const contentId = `content-${id}`;
|
|
@@ -1131,7 +1179,7 @@ function Section({ title, children, defaultExpanded = false }) {
|
|
|
1131
1179
|
{
|
|
1132
1180
|
id: labelId,
|
|
1133
1181
|
"aria-controls": contentId,
|
|
1134
|
-
onClick: () => setIsOpen(
|
|
1182
|
+
onClick: () => setIsOpen(!isOpen),
|
|
1135
1183
|
sx: { "&:hover": { backgroundColor: "transparent" } }
|
|
1136
1184
|
},
|
|
1137
1185
|
/* @__PURE__ */ React14.createElement(
|
|
@@ -1180,7 +1228,7 @@ var Control2 = ({ control }) => {
|
|
|
1180
1228
|
|
|
1181
1229
|
// src/components/style-tab.tsx
|
|
1182
1230
|
import * as React68 from "react";
|
|
1183
|
-
import { useState as
|
|
1231
|
+
import { useState as useState13 } from "react";
|
|
1184
1232
|
import { CLASSES_PROP_KEY } from "@elementor/editor-props";
|
|
1185
1233
|
import { useActiveBreakpoint } from "@elementor/editor-responsive";
|
|
1186
1234
|
import { SessionStorageProvider as SessionStorageProvider2 } from "@elementor/session";
|
|
@@ -1403,10 +1451,10 @@ var useBaseStyles = () => {
|
|
|
1403
1451
|
};
|
|
1404
1452
|
|
|
1405
1453
|
// src/hooks/use-active-style-def-id.ts
|
|
1406
|
-
import { useState as
|
|
1454
|
+
import { useState as useState7 } from "react";
|
|
1407
1455
|
import { getElementStyles, useElementSetting as useElementSetting5 } from "@elementor/editor-elements";
|
|
1408
1456
|
function useActiveStyleDefId(classProp) {
|
|
1409
|
-
const [activeStyledDefId, setActiveStyledDefId] =
|
|
1457
|
+
const [activeStyledDefId, setActiveStyledDefId] = useState7(null);
|
|
1410
1458
|
const appliedClassesIds = useAppliedClassesIds2(classProp)?.value || [];
|
|
1411
1459
|
const fallback = useFirstAppliedClass(appliedClassesIds);
|
|
1412
1460
|
const activeAndAppliedClassId = useActiveAndAppliedClassId(activeStyledDefId, appliedClassesIds);
|
|
@@ -1577,32 +1625,13 @@ function useStylesField(propName) {
|
|
|
1577
1625
|
|
|
1578
1626
|
// src/styles-inheritance/styles-inheritance-indicator.tsx
|
|
1579
1627
|
import * as React19 from "react";
|
|
1580
|
-
import { useState as
|
|
1628
|
+
import { useState as useState9 } from "react";
|
|
1581
1629
|
import { useBoundProp } from "@elementor/editor-controls";
|
|
1582
1630
|
import { ELEMENTS_BASE_STYLES_PROVIDER_KEY, isElementsStylesProvider as isElementsStylesProvider3 } from "@elementor/editor-styles-repository";
|
|
1631
|
+
import { isExperimentActive } from "@elementor/editor-v1-adapters";
|
|
1583
1632
|
import { IconButton as IconButton2, Infotip } from "@elementor/ui";
|
|
1584
1633
|
import { __ as __5 } from "@wordpress/i18n";
|
|
1585
1634
|
|
|
1586
|
-
// src/sync/get-elementor-globals.ts
|
|
1587
|
-
var getElementorConfig = () => {
|
|
1588
|
-
const extendedWindow = window;
|
|
1589
|
-
return extendedWindow.elementor?.config ?? {};
|
|
1590
|
-
};
|
|
1591
|
-
var getElementorFrontendConfig = () => {
|
|
1592
|
-
const extendedWindow = window;
|
|
1593
|
-
return extendedWindow.elementorFrontend?.config ?? {};
|
|
1594
|
-
};
|
|
1595
|
-
var getElementorCommonConfig = () => {
|
|
1596
|
-
const extendedWindow = window;
|
|
1597
|
-
return extendedWindow.elementorCommon?.config ?? {};
|
|
1598
|
-
};
|
|
1599
|
-
|
|
1600
|
-
// src/sync/is-experiment-active.ts
|
|
1601
|
-
var isExperimentActive = (experiment) => {
|
|
1602
|
-
const allFeatures = getElementorCommonConfig()?.experimentalFeatures ?? {};
|
|
1603
|
-
return !!allFeatures?.[experiment];
|
|
1604
|
-
};
|
|
1605
|
-
|
|
1606
1635
|
// src/styles-inheritance/styles-inheritance-infotip.tsx
|
|
1607
1636
|
import * as React18 from "react";
|
|
1608
1637
|
import { useMemo as useMemo3 } from "react";
|
|
@@ -1611,10 +1640,10 @@ import { getStylesSchema } from "@elementor/editor-styles";
|
|
|
1611
1640
|
import { Card, CardContent, List as List2, ListItem, ListItemText as ListItemText2 } from "@elementor/ui";
|
|
1612
1641
|
|
|
1613
1642
|
// src/hooks/use-normalized-inheritance-chain-items.tsx
|
|
1614
|
-
import { useEffect as useEffect3, useState as
|
|
1643
|
+
import { useEffect as useEffect3, useState as useState8 } from "react";
|
|
1615
1644
|
var MAXIMUM_ITEMS = 2;
|
|
1616
1645
|
var useNormalizedInheritanceChainItems = (inheritanceChain, bind, resolve) => {
|
|
1617
|
-
const [items3, setItems] =
|
|
1646
|
+
const [items3, setItems] = useState8([]);
|
|
1618
1647
|
useEffect3(() => {
|
|
1619
1648
|
(async () => {
|
|
1620
1649
|
const normalizedItems = await Promise.all(
|
|
@@ -1670,7 +1699,7 @@ var StyleIndicatorInfotip = ({ inheritanceChain, bind }) => {
|
|
|
1670
1699
|
|
|
1671
1700
|
// src/styles-inheritance/styles-inheritance-indicator.tsx
|
|
1672
1701
|
var StylesInheritanceIndicator = () => {
|
|
1673
|
-
const [open, setOpen] =
|
|
1702
|
+
const [open, setOpen] = useState9(false);
|
|
1674
1703
|
const { value, path } = useBoundProp();
|
|
1675
1704
|
const { id: currentStyleId, provider: currentStyleProvider, meta: currentStyleMeta } = useStyle();
|
|
1676
1705
|
const [bind] = path;
|
|
@@ -1852,6 +1881,18 @@ import { __ as __8 } from "@wordpress/i18n";
|
|
|
1852
1881
|
|
|
1853
1882
|
// src/hooks/use-direction.ts
|
|
1854
1883
|
import { useTheme } from "@elementor/ui";
|
|
1884
|
+
|
|
1885
|
+
// src/sync/get-elementor-globals.ts
|
|
1886
|
+
var getElementorConfig = () => {
|
|
1887
|
+
const extendedWindow = window;
|
|
1888
|
+
return extendedWindow.elementor?.config ?? {};
|
|
1889
|
+
};
|
|
1890
|
+
var getElementorFrontendConfig = () => {
|
|
1891
|
+
const extendedWindow = window;
|
|
1892
|
+
return extendedWindow.elementorFrontend?.config ?? {};
|
|
1893
|
+
};
|
|
1894
|
+
|
|
1895
|
+
// src/hooks/use-direction.ts
|
|
1855
1896
|
function useDirection() {
|
|
1856
1897
|
const theme = useTheme();
|
|
1857
1898
|
const isUiRtl = "rtl" === theme.direction, isSiteRtl = !!getElementorFrontendConfig()?.is_rtl;
|
|
@@ -2044,7 +2085,7 @@ import { __ as __11 } from "@wordpress/i18n";
|
|
|
2044
2085
|
|
|
2045
2086
|
// src/components/style-sections/layout-section/utils/rotated-icon.tsx
|
|
2046
2087
|
import * as React33 from "react";
|
|
2047
|
-
import { useRef as
|
|
2088
|
+
import { useRef as useRef3 } from "react";
|
|
2048
2089
|
import { useTheme as useTheme2 } from "@elementor/ui";
|
|
2049
2090
|
var CLOCKWISE_ANGLES = {
|
|
2050
2091
|
row: 0,
|
|
@@ -2065,7 +2106,7 @@ var RotatedIcon = ({
|
|
|
2065
2106
|
offset = 0,
|
|
2066
2107
|
disableRotationForReversed = false
|
|
2067
2108
|
}) => {
|
|
2068
|
-
const rotate =
|
|
2109
|
+
const rotate = useRef3(useGetTargetAngle(isClockwise, offset, disableRotationForReversed));
|
|
2069
2110
|
rotate.current = useGetTargetAngle(isClockwise, offset, disableRotationForReversed, rotate);
|
|
2070
2111
|
return /* @__PURE__ */ React33.createElement(Icon, { fontSize: size, sx: { transition: ".3s", rotate: `${rotate.current}deg` } });
|
|
2071
2112
|
};
|
|
@@ -2272,6 +2313,7 @@ var AlignSelfChild = ({ parentStyleDirection }) => {
|
|
|
2272
2313
|
// src/components/style-sections/layout-section/display-field.tsx
|
|
2273
2314
|
import * as React37 from "react";
|
|
2274
2315
|
import { ToggleControl as ToggleControl4 } from "@elementor/editor-controls";
|
|
2316
|
+
import { isExperimentActive as isExperimentActive2 } from "@elementor/editor-v1-adapters";
|
|
2275
2317
|
import { Stack as Stack10 } from "@elementor/ui";
|
|
2276
2318
|
import { __ as __14 } from "@wordpress/i18n";
|
|
2277
2319
|
var displayFieldItems = [
|
|
@@ -2295,7 +2337,7 @@ var displayFieldItems = [
|
|
|
2295
2337
|
}
|
|
2296
2338
|
];
|
|
2297
2339
|
var DisplayField = () => {
|
|
2298
|
-
const isDisplayNoneFeatureActive =
|
|
2340
|
+
const isDisplayNoneFeatureActive = isExperimentActive2("e_v_3_30");
|
|
2299
2341
|
const items3 = [...displayFieldItems];
|
|
2300
2342
|
if (isDisplayNoneFeatureActive) {
|
|
2301
2343
|
items3.push({
|
|
@@ -2361,7 +2403,7 @@ var FlexDirectionField = () => {
|
|
|
2361
2403
|
|
|
2362
2404
|
// src/components/style-sections/layout-section/flex-order-field.tsx
|
|
2363
2405
|
import * as React39 from "react";
|
|
2364
|
-
import { useState as
|
|
2406
|
+
import { useState as useState10 } from "react";
|
|
2365
2407
|
import { ControlToggleButtonGroup, NumberControl } from "@elementor/editor-controls";
|
|
2366
2408
|
import { ArrowDownSmallIcon as ArrowDownSmallIcon2, ArrowUpSmallIcon as ArrowUpSmallIcon2, PencilIcon } from "@elementor/icons";
|
|
2367
2409
|
import { DirectionProvider as DirectionProvider5, Grid as Grid6, ThemeProvider as ThemeProvider5 } from "@elementor/ui";
|
|
@@ -2397,7 +2439,7 @@ var items = [
|
|
|
2397
2439
|
];
|
|
2398
2440
|
var FlexOrderField = () => {
|
|
2399
2441
|
const { isSiteRtl } = useDirection(), [order, setOrder] = useStylesField("order");
|
|
2400
|
-
const [groupControlValue, setGroupControlValue] =
|
|
2442
|
+
const [groupControlValue, setGroupControlValue] = useState10(getGroupControlValue(order?.value || null));
|
|
2401
2443
|
const handleToggleButtonChange = (group) => {
|
|
2402
2444
|
setGroupControlValue(group);
|
|
2403
2445
|
if (!group || group === CUSTOM) {
|
|
@@ -2435,7 +2477,7 @@ var getGroupControlValue = (order) => {
|
|
|
2435
2477
|
|
|
2436
2478
|
// src/components/style-sections/layout-section/flex-size-field.tsx
|
|
2437
2479
|
import * as React40 from "react";
|
|
2438
|
-
import { useMemo as useMemo4, useState as
|
|
2480
|
+
import { useMemo as useMemo4, useState as useState11 } from "react";
|
|
2439
2481
|
import {
|
|
2440
2482
|
ControlToggleButtonGroup as ControlToggleButtonGroup2,
|
|
2441
2483
|
NumberControl as NumberControl2,
|
|
@@ -2472,7 +2514,7 @@ var FlexSizeField = () => {
|
|
|
2472
2514
|
const grow = fields?.["flex-grow"]?.value || null;
|
|
2473
2515
|
const shrink = fields?.["flex-shrink"]?.value || null;
|
|
2474
2516
|
const basis = fields?.["flex-basis"]?.value || null;
|
|
2475
|
-
const currentGroup = useMemo4(() => getActiveGroup({ grow, shrink, basis }), [grow, shrink, basis]), [activeGroup, setActiveGroup] =
|
|
2517
|
+
const currentGroup = useMemo4(() => getActiveGroup({ grow, shrink, basis }), [grow, shrink, basis]), [activeGroup, setActiveGroup] = useState11(currentGroup);
|
|
2476
2518
|
const onChangeGroup = (group = null) => {
|
|
2477
2519
|
setActiveGroup(group);
|
|
2478
2520
|
if (!group || group === "custom") {
|
|
@@ -2656,6 +2698,7 @@ var shouldDisplayFlexFields = (display, local) => {
|
|
|
2656
2698
|
|
|
2657
2699
|
// src/components/style-sections/position-section/position-section.tsx
|
|
2658
2700
|
import * as React49 from "react";
|
|
2701
|
+
import { isExperimentActive as isExperimentActive3 } from "@elementor/editor-v1-adapters";
|
|
2659
2702
|
import { useSessionStorage } from "@elementor/session";
|
|
2660
2703
|
|
|
2661
2704
|
// src/components/style-sections/position-section/dimensions-field.tsx
|
|
@@ -2726,7 +2769,7 @@ var PositionSection = () => {
|
|
|
2726
2769
|
"inset-inline-end"
|
|
2727
2770
|
]);
|
|
2728
2771
|
const [dimensionsValuesFromHistory, updateDimensionsHistory, clearDimensionsHistory] = usePersistDimensions();
|
|
2729
|
-
const isCssIdFeatureActive =
|
|
2772
|
+
const isCssIdFeatureActive = isExperimentActive3("e_v_3_30");
|
|
2730
2773
|
const onPositionChange = (newPosition, previousPosition) => {
|
|
2731
2774
|
if (newPosition === "static") {
|
|
2732
2775
|
if (dimensionsValues) {
|
|
@@ -2834,11 +2877,11 @@ import * as React67 from "react";
|
|
|
2834
2877
|
|
|
2835
2878
|
// src/components/collapsible-content.tsx
|
|
2836
2879
|
import * as React53 from "react";
|
|
2837
|
-
import { useState as
|
|
2880
|
+
import { useState as useState12 } from "react";
|
|
2838
2881
|
import { Button, Collapse as Collapse3, Stack as Stack15 } from "@elementor/ui";
|
|
2839
2882
|
import { __ as __29 } from "@wordpress/i18n";
|
|
2840
2883
|
var CollapsibleContent = ({ children, defaultOpen = false }) => {
|
|
2841
|
-
const [open, setOpen] =
|
|
2884
|
+
const [open, setOpen] = useState12(defaultOpen);
|
|
2842
2885
|
const handleToggle = () => {
|
|
2843
2886
|
setOpen((prevOpen) => !prevOpen);
|
|
2844
2887
|
};
|
|
@@ -3185,7 +3228,7 @@ var stickyHeaderStyles = {
|
|
|
3185
3228
|
var StyleTab = () => {
|
|
3186
3229
|
const currentClassesProp = useCurrentClassesProp();
|
|
3187
3230
|
const [activeStyleDefId, setActiveStyleDefId] = useActiveStyleDefId(currentClassesProp);
|
|
3188
|
-
const [activeStyleState, setActiveStyleState] =
|
|
3231
|
+
const [activeStyleState, setActiveStyleState] = useState13(null);
|
|
3189
3232
|
const breakpoint = useActiveBreakpoint();
|
|
3190
3233
|
return /* @__PURE__ */ React68.createElement(ClassesPropProvider, { prop: currentClassesProp }, /* @__PURE__ */ React68.createElement(
|
|
3191
3234
|
StyleProvider,
|
|
@@ -3219,13 +3262,32 @@ function useCurrentClassesProp() {
|
|
|
3219
3262
|
// src/components/editing-panel-tabs.tsx
|
|
3220
3263
|
var EditingPanelTabs = () => {
|
|
3221
3264
|
const { element } = useElement();
|
|
3222
|
-
const { getTabProps, getTabPanelProps, getTabsProps } = useTabs("settings");
|
|
3223
3265
|
return (
|
|
3224
3266
|
// When switching between elements, the local states should be reset. We are using key to rerender the tabs.
|
|
3225
3267
|
// Reference: https://react.dev/learn/preserving-and-resetting-state#resetting-a-form-with-a-key
|
|
3226
|
-
/* @__PURE__ */ React69.createElement(Fragment8, { key: element.id }, /* @__PURE__ */ React69.createElement(
|
|
3268
|
+
/* @__PURE__ */ React69.createElement(Fragment8, { key: element.id }, /* @__PURE__ */ React69.createElement(PanelTabContent, null))
|
|
3227
3269
|
);
|
|
3228
3270
|
};
|
|
3271
|
+
var PanelTabContent = () => {
|
|
3272
|
+
const defaultComponentTab = "settings";
|
|
3273
|
+
const [currentTab, setCurrentTab] = useStateByElement("tab", defaultComponentTab);
|
|
3274
|
+
const { getTabProps, getTabPanelProps, getTabsProps } = useTabs(currentTab);
|
|
3275
|
+
return /* @__PURE__ */ React69.createElement(ScrollProvider, null, /* @__PURE__ */ React69.createElement(Stack17, { direction: "column", sx: { width: "100%" } }, /* @__PURE__ */ React69.createElement(Stack17, { sx: { ...stickyHeaderStyles, top: 0 } }, /* @__PURE__ */ React69.createElement(
|
|
3276
|
+
Tabs,
|
|
3277
|
+
{
|
|
3278
|
+
variant: "fullWidth",
|
|
3279
|
+
size: "small",
|
|
3280
|
+
sx: { mt: 0.5 },
|
|
3281
|
+
...getTabsProps(),
|
|
3282
|
+
onChange: (_, newValue) => {
|
|
3283
|
+
getTabsProps().onChange(_, newValue);
|
|
3284
|
+
setCurrentTab(newValue);
|
|
3285
|
+
}
|
|
3286
|
+
},
|
|
3287
|
+
/* @__PURE__ */ React69.createElement(Tab, { label: __45("General", "elementor"), ...getTabProps("settings") }),
|
|
3288
|
+
/* @__PURE__ */ React69.createElement(Tab, { label: __45("Style", "elementor"), ...getTabProps("style") })
|
|
3289
|
+
), /* @__PURE__ */ React69.createElement(Divider6, null)), /* @__PURE__ */ React69.createElement(TabPanel, { ...getTabPanelProps("settings"), disablePadding: true }, /* @__PURE__ */ React69.createElement(SettingsTab, null)), /* @__PURE__ */ React69.createElement(TabPanel, { ...getTabPanelProps("style"), disablePadding: true }, /* @__PURE__ */ React69.createElement(StyleTab, null))));
|
|
3290
|
+
};
|
|
3229
3291
|
|
|
3230
3292
|
// src/components/editing-panel.tsx
|
|
3231
3293
|
var { useMenuItems } = controlActionsMenu;
|
|
@@ -3433,7 +3495,7 @@ var DynamicControl = ({ bind, children }) => {
|
|
|
3433
3495
|
|
|
3434
3496
|
// src/dynamics/components/dynamic-selection.tsx
|
|
3435
3497
|
import * as React73 from "react";
|
|
3436
|
-
import { Fragment as Fragment9, useState as
|
|
3498
|
+
import { Fragment as Fragment9, useState as useState14 } from "react";
|
|
3437
3499
|
import { useBoundProp as useBoundProp4 } from "@elementor/editor-controls";
|
|
3438
3500
|
import { DatabaseIcon, SearchIcon } from "@elementor/icons";
|
|
3439
3501
|
import {
|
|
@@ -3451,7 +3513,7 @@ import {
|
|
|
3451
3513
|
import { __ as __47 } from "@wordpress/i18n";
|
|
3452
3514
|
var SIZE3 = "tiny";
|
|
3453
3515
|
var DynamicSelection = ({ onSelect }) => {
|
|
3454
|
-
const [searchValue, setSearchValue] =
|
|
3516
|
+
const [searchValue, setSearchValue] = useState14("");
|
|
3455
3517
|
const { groups: dynamicGroups } = getAtomicDynamicTags() || {};
|
|
3456
3518
|
const { value: anyValue } = useBoundProp4();
|
|
3457
3519
|
const { bind, value: dynamicValue, setValue } = useBoundProp4(dynamicPropTypeUtil);
|