@elementor/editor-editing-panel 1.27.0 → 1.29.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 +52 -0
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +176 -155
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +172 -157
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -10
- package/src/components/add-or-remove-content.tsx +1 -0
- package/src/components/css-classes/css-class-item.tsx +8 -10
- package/src/components/css-classes/css-class-menu.tsx +7 -5
- package/src/components/css-classes/css-class-selector.tsx +22 -22
- package/src/components/multi-combobox.tsx +7 -42
- package/src/components/style-sections/layout-section/display-field.tsx +34 -28
- package/src/components/style-sections/layout-section/layout-section.tsx +14 -2
- package/src/components/style-tab.tsx +2 -19
- package/src/contexts/style-context.tsx +1 -1
- package/src/controls-registry/styles-field.tsx +9 -2
- package/src/hooks/use-active-style-def-id.ts +36 -0
- package/src/hooks/use-styles-fields.ts +7 -7
- package/src/index.ts +1 -3
- package/src/init.ts +1 -1
- package/src/styles-inheritance/create-snapshots-manager.ts +8 -1
- package/src/styles-inheritance/create-styles-inheritance.ts +1 -1
- package/src/styles-inheritance/styles-inheritance-indicator.tsx +2 -2
package/dist/index.js
CHANGED
|
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
+
init: () => init2,
|
|
33
34
|
injectIntoClassSelectorActions: () => injectIntoClassSelectorActions,
|
|
34
35
|
replaceControl: () => replaceControl,
|
|
35
36
|
useBoundProp: () => import_editor_controls50.useBoundProp,
|
|
@@ -125,7 +126,7 @@ function useStyle() {
|
|
|
125
126
|
}
|
|
126
127
|
function getProviderByStyleId(styleId) {
|
|
127
128
|
const styleProvider = import_editor_styles_repository.stylesRepository.getProviders().find((provider) => {
|
|
128
|
-
return provider.actions.
|
|
129
|
+
return provider.actions.all().find((style) => style.id === styleId);
|
|
129
130
|
});
|
|
130
131
|
return styleProvider ?? null;
|
|
131
132
|
}
|
|
@@ -139,6 +140,7 @@ function MultiCombobox({
|
|
|
139
140
|
selected,
|
|
140
141
|
options: options13,
|
|
141
142
|
onSelect,
|
|
143
|
+
placeholder,
|
|
142
144
|
...props
|
|
143
145
|
}) {
|
|
144
146
|
const filter = useFilterOptions();
|
|
@@ -156,11 +158,11 @@ function MultiCombobox({
|
|
|
156
158
|
disabled: loading,
|
|
157
159
|
value: selected,
|
|
158
160
|
options: options13,
|
|
159
|
-
renderGroup: (params) => /* @__PURE__ */ React4.createElement(Group, { ...params }),
|
|
160
161
|
renderInput: (params) => /* @__PURE__ */ React4.createElement(
|
|
161
162
|
import_ui.TextField,
|
|
162
163
|
{
|
|
163
164
|
...params,
|
|
165
|
+
placeholder,
|
|
164
166
|
sx: (theme) => ({
|
|
165
167
|
".MuiAutocomplete-inputRoot.MuiInputBase-adornedStart": {
|
|
166
168
|
paddingLeft: theme.spacing(0.25),
|
|
@@ -203,28 +205,10 @@ function MultiCombobox({
|
|
|
203
205
|
];
|
|
204
206
|
},
|
|
205
207
|
groupBy: (option) => option.group ?? "",
|
|
206
|
-
renderOption: (optionProps, { label }) => /* @__PURE__ */ React4.createElement("li", { ...optionProps, style: { display: "block", textOverflow: "ellipsis" } }, label)
|
|
208
|
+
renderOption: (optionProps, { label, group }) => /* @__PURE__ */ React4.createElement("li", { ...optionProps, style: { display: "block", textOverflow: "ellipsis" }, "data-group": group }, label)
|
|
207
209
|
}
|
|
208
210
|
);
|
|
209
211
|
}
|
|
210
|
-
var Group = (params) => {
|
|
211
|
-
const id = `combobox-group-${(0, import_react4.useId)().replace(/:/g, "_")}`;
|
|
212
|
-
return /* @__PURE__ */ React4.createElement(StyledGroup, { role: "group", "aria-labelledby": id }, /* @__PURE__ */ React4.createElement(StyledGroupHeader, { id }, " ", params.group), /* @__PURE__ */ React4.createElement(StyledGroupItems, { role: "listbox" }, params.children));
|
|
213
|
-
};
|
|
214
|
-
var StyledGroup = (0, import_ui.styled)("li")`
|
|
215
|
-
&:not( :last-of-type ) {
|
|
216
|
-
border-bottom: 1px solid ${({ theme }) => theme.palette.divider};
|
|
217
|
-
}
|
|
218
|
-
`;
|
|
219
|
-
var StyledGroupHeader = (0, import_ui.styled)(import_ui.Box)(({ theme }) => ({
|
|
220
|
-
position: "sticky",
|
|
221
|
-
top: "-8px",
|
|
222
|
-
padding: theme.spacing(1, 2),
|
|
223
|
-
color: theme.palette.text.tertiary
|
|
224
|
-
}));
|
|
225
|
-
var StyledGroupItems = (0, import_ui.styled)("ul")`
|
|
226
|
-
padding: 0;
|
|
227
|
-
`;
|
|
228
212
|
function useFilterOptions() {
|
|
229
213
|
return (0, import_react4.useState)(() => (0, import_ui.createFilterOptions)())[0];
|
|
230
214
|
}
|
|
@@ -318,7 +302,7 @@ var StyleIndicator = (0, import_ui2.styled)("div", {
|
|
|
318
302
|
var STATES = ["hover", "focus", "active"];
|
|
319
303
|
function CssClassMenu({ styleId, provider, popupState, handleRename, anchorEl }) {
|
|
320
304
|
const styledStates = useStyledStates(styleId);
|
|
321
|
-
const indicatorVariant = provider
|
|
305
|
+
const indicatorVariant = !provider || (0, import_editor_styles_repository2.isElementsStylesProvider)(provider) ? "local" : "global";
|
|
322
306
|
const handleKeyDown = (e) => {
|
|
323
307
|
e.stopPropagation();
|
|
324
308
|
};
|
|
@@ -336,7 +320,8 @@ function CssClassMenu({ styleId, provider, popupState, handleRename, anchorEl })
|
|
|
336
320
|
horizontal: "left",
|
|
337
321
|
vertical: -4
|
|
338
322
|
},
|
|
339
|
-
onKeyDown: handleKeyDown
|
|
323
|
+
onKeyDown: handleKeyDown,
|
|
324
|
+
disableAutoFocusItem: true
|
|
340
325
|
},
|
|
341
326
|
getMenuItemsByProvider({ provider, styleId, handleRename, closeMenu: popupState.close }),
|
|
342
327
|
/* @__PURE__ */ React5.createElement(import_ui3.MenuSubheader, { sx: { typography: "caption", color: "text.secondary", pb: 0.5, pt: 1 } }, (0, import_i18n.__)("States", "elementor")),
|
|
@@ -379,7 +364,7 @@ function getMenuItemsByProvider({
|
|
|
379
364
|
handleRename,
|
|
380
365
|
closeMenu
|
|
381
366
|
}) {
|
|
382
|
-
if (!styleId) {
|
|
367
|
+
if (!styleId || !provider) {
|
|
383
368
|
return [];
|
|
384
369
|
}
|
|
385
370
|
const providerInstance = import_editor_styles_repository2.stylesRepository.getProviderByKey(provider);
|
|
@@ -469,8 +454,8 @@ function RenameClassMenuItem({
|
|
|
469
454
|
var CHIP_SIZE = "tiny";
|
|
470
455
|
function CssClassItem({
|
|
471
456
|
id,
|
|
472
|
-
label,
|
|
473
457
|
provider,
|
|
458
|
+
label,
|
|
474
459
|
isActive,
|
|
475
460
|
color: colorProp,
|
|
476
461
|
icon,
|
|
@@ -494,7 +479,7 @@ function CssClassItem({
|
|
|
494
479
|
validation: validateLabel
|
|
495
480
|
});
|
|
496
481
|
const color = error ? "error" : colorProp;
|
|
497
|
-
const providerActions = import_editor_styles_repository3.stylesRepository.getProviderByKey(provider)?.actions;
|
|
482
|
+
const providerActions = provider ? import_editor_styles_repository3.stylesRepository.getProviderByKey(provider)?.actions : null;
|
|
498
483
|
const allowRename = Boolean(providerActions?.update);
|
|
499
484
|
const isShowingState = isActive && meta.state;
|
|
500
485
|
return /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(
|
|
@@ -569,13 +554,11 @@ function CssClassItem({
|
|
|
569
554
|
));
|
|
570
555
|
}
|
|
571
556
|
var validateLabel = (newLabel) => {
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
if (import_editor_styles_repository3.stylesRepository.isLabelExist(newLabel)) {
|
|
576
|
-
return (0, import_i18n2.__)("Name exists", "elementor");
|
|
557
|
+
const result = (0, import_editor_styles_repository3.validateStyleLabel)(newLabel);
|
|
558
|
+
if (result.isValid) {
|
|
559
|
+
return null;
|
|
577
560
|
}
|
|
578
|
-
return
|
|
561
|
+
return result.error;
|
|
579
562
|
};
|
|
580
563
|
|
|
581
564
|
// src/components/css-classes/css-class-selector.tsx
|
|
@@ -587,7 +570,7 @@ var EMPTY_OPTION = {
|
|
|
587
570
|
fixed: true,
|
|
588
571
|
color: "accent",
|
|
589
572
|
icon: /* @__PURE__ */ React7.createElement(import_icons2.MapPinIcon, null),
|
|
590
|
-
provider:
|
|
573
|
+
provider: null
|
|
591
574
|
};
|
|
592
575
|
var { Slot: ClassSelectorActionsSlot, inject: injectIntoClassSelectorActions } = (0, import_locations.createLocation)();
|
|
593
576
|
function CssClassSelector() {
|
|
@@ -598,11 +581,13 @@ function CssClassSelector() {
|
|
|
598
581
|
const handleApply = useHandleApply(appliedIds, setAppliedIds);
|
|
599
582
|
const applied = useAppliedOptions(options13, appliedIds);
|
|
600
583
|
const active = applied.find((option) => option.value === activeId) ?? EMPTY_OPTION;
|
|
601
|
-
|
|
584
|
+
const showPlaceholder = applied.every(({ fixed }) => fixed);
|
|
585
|
+
return /* @__PURE__ */ React7.createElement(import_ui5.Stack, { p: 2 }, /* @__PURE__ */ React7.createElement(import_ui5.Stack, { direction: "row", gap: 1, alignItems: "center", justifyContent: "space-between" }, /* @__PURE__ */ React7.createElement(import_ui5.FormLabel, { htmlFor: ID, size: "small" }, (0, import_i18n3.__)("Classes", "elementor")), /* @__PURE__ */ React7.createElement(import_ui5.Stack, { direction: "row", gap: 1 }, /* @__PURE__ */ React7.createElement(ClassSelectorActionsSlot, null))), /* @__PURE__ */ React7.createElement(
|
|
602
586
|
MultiCombobox,
|
|
603
587
|
{
|
|
604
588
|
id: ID,
|
|
605
589
|
size: "tiny",
|
|
590
|
+
placeholder: showPlaceholder ? (0, import_i18n3.__)("Type to search/add global classes", "elementor") : void 0,
|
|
606
591
|
options: options13,
|
|
607
592
|
selected: applied,
|
|
608
593
|
onSelect: handleApply,
|
|
@@ -638,6 +623,9 @@ function CssClassSelector() {
|
|
|
638
623
|
));
|
|
639
624
|
}
|
|
640
625
|
var updateClassByProvider = (provider, data) => {
|
|
626
|
+
if (!provider) {
|
|
627
|
+
return;
|
|
628
|
+
}
|
|
641
629
|
const providerInstance = import_editor_styles_repository4.stylesRepository.getProviderByKey(provider);
|
|
642
630
|
if (!providerInstance) {
|
|
643
631
|
return;
|
|
@@ -648,8 +636,8 @@ function useOptions() {
|
|
|
648
636
|
const { element } = useElement();
|
|
649
637
|
const isProviderEditable = (provider) => !!provider.actions.updateProps;
|
|
650
638
|
return (0, import_editor_styles_repository4.useProviders)().filter(isProviderEditable).flatMap((provider) => {
|
|
651
|
-
const isElements =
|
|
652
|
-
const styleDefs = provider.actions.
|
|
639
|
+
const isElements = (0, import_editor_styles_repository4.isElementsStylesProvider)(provider.getKey());
|
|
640
|
+
const styleDefs = provider.actions.all({ elementId: element.id });
|
|
653
641
|
if (isElements && styleDefs.length === 0) {
|
|
654
642
|
return [EMPTY_OPTION];
|
|
655
643
|
}
|
|
@@ -660,7 +648,7 @@ function useOptions() {
|
|
|
660
648
|
fixed: isElements,
|
|
661
649
|
color: isElements ? "accent" : "global",
|
|
662
650
|
icon: isElements ? /* @__PURE__ */ React7.createElement(import_icons2.MapPinIcon, null) : null,
|
|
663
|
-
provider: provider.
|
|
651
|
+
provider: provider.getKey(),
|
|
664
652
|
// translators: %s is the plural label of the provider (e.g "Existing classes").
|
|
665
653
|
group: (0, import_i18n3.__)("Existing %s", "elementor").replace("%s", provider.labels?.plural ?? "")
|
|
666
654
|
};
|
|
@@ -677,7 +665,7 @@ function useCreateActions({
|
|
|
677
665
|
label: (value) => (0, import_i18n3.__)('Create "%s"', "elementor").replace("%s", value),
|
|
678
666
|
// translators: %s is the singular label of css class provider (e.g "CSS Class").
|
|
679
667
|
group: (0, import_i18n3.__)("Create a new %s", "elementor").replace("%s", provider.labels?.singular ?? ""),
|
|
680
|
-
condition: (_, inputValue) =>
|
|
668
|
+
condition: (_, inputValue) => (0, import_editor_styles_repository4.validateStyleLabel)(inputValue).isValid && !hasReachedLimit(provider),
|
|
681
669
|
apply: (label) => {
|
|
682
670
|
const createdId = create(label);
|
|
683
671
|
if (!createdId) {
|
|
@@ -690,18 +678,12 @@ function useCreateActions({
|
|
|
690
678
|
});
|
|
691
679
|
}
|
|
692
680
|
function hasReachedLimit(provider) {
|
|
693
|
-
|
|
694
|
-
return false;
|
|
695
|
-
}
|
|
696
|
-
return provider.actions.get().length >= provider.limit;
|
|
697
|
-
}
|
|
698
|
-
function isLabelValid(newLabel) {
|
|
699
|
-
return import_editor_styles_repository4.stylesRepository.isLabelValid(newLabel) && !import_editor_styles_repository4.stylesRepository.isLabelExist(newLabel);
|
|
681
|
+
return provider.actions.all().length >= provider.limit;
|
|
700
682
|
}
|
|
701
683
|
function useAppliedOptions(options13, appliedIds) {
|
|
702
684
|
const applied = options13.filter((option) => option.value && appliedIds.includes(option.value));
|
|
703
685
|
const hasElementsProviderStyleApplied = applied.some(
|
|
704
|
-
(option) => option.provider
|
|
686
|
+
(option) => option.provider && (0, import_editor_styles_repository4.isElementsStylesProvider)(option.provider)
|
|
705
687
|
);
|
|
706
688
|
if (!hasElementsProviderStyleApplied) {
|
|
707
689
|
applied.unshift(EMPTY_OPTION);
|
|
@@ -820,7 +802,7 @@ function EditorPanelErrorFallback() {
|
|
|
820
802
|
|
|
821
803
|
// src/components/editing-panel-tabs.tsx
|
|
822
804
|
var React66 = __toESM(require("react"));
|
|
823
|
-
var
|
|
805
|
+
var import_react18 = require("react");
|
|
824
806
|
var import_ui51 = require("@elementor/ui");
|
|
825
807
|
var import_i18n44 = require("@wordpress/i18n");
|
|
826
808
|
|
|
@@ -993,9 +975,8 @@ var Control2 = ({ control }) => {
|
|
|
993
975
|
|
|
994
976
|
// src/components/style-tab.tsx
|
|
995
977
|
var React65 = __toESM(require("react"));
|
|
996
|
-
var
|
|
997
|
-
var
|
|
998
|
-
var import_editor_props6 = require("@elementor/editor-props");
|
|
978
|
+
var import_react17 = require("react");
|
|
979
|
+
var import_editor_props7 = require("@elementor/editor-props");
|
|
999
980
|
var import_editor_responsive2 = require("@elementor/editor-responsive");
|
|
1000
981
|
var import_session3 = require("@elementor/session");
|
|
1001
982
|
var import_ui50 = require("@elementor/ui");
|
|
@@ -1005,7 +986,7 @@ var import_i18n43 = require("@wordpress/i18n");
|
|
|
1005
986
|
var React16 = __toESM(require("react"));
|
|
1006
987
|
var import_react9 = require("react");
|
|
1007
988
|
var import_editor_elements4 = require("@elementor/editor-elements");
|
|
1008
|
-
var
|
|
989
|
+
var import_editor_props3 = require("@elementor/editor-props");
|
|
1009
990
|
var import_editor_responsive = require("@elementor/editor-responsive");
|
|
1010
991
|
var import_editor_styles_repository5 = require("@elementor/editor-styles-repository");
|
|
1011
992
|
|
|
@@ -1017,6 +998,9 @@ var useStylesRerender = () => {
|
|
|
1017
998
|
(0, import_react8.useEffect)(() => provider?.subscribe(reRender), [provider]);
|
|
1018
999
|
};
|
|
1019
1000
|
|
|
1001
|
+
// src/styles-inheritance/create-snapshots-manager.ts
|
|
1002
|
+
var import_editor_props2 = require("@elementor/editor-props");
|
|
1003
|
+
|
|
1020
1004
|
// src/styles-inheritance/utils.ts
|
|
1021
1005
|
var DEFAULT_STATE = "normal";
|
|
1022
1006
|
var DEFAULT_BREAKPOINT = "desktop";
|
|
@@ -1107,12 +1091,16 @@ function buildInitialSnapshotFromStyles(styles) {
|
|
|
1107
1091
|
variant: { props }
|
|
1108
1092
|
} = styleData;
|
|
1109
1093
|
Object.entries(props).forEach(([key, value]) => {
|
|
1094
|
+
const filteredValue = (0, import_editor_props2.filterEmptyValues)(value);
|
|
1095
|
+
if (filteredValue === null) {
|
|
1096
|
+
return;
|
|
1097
|
+
}
|
|
1110
1098
|
if (!snapshot[key]) {
|
|
1111
1099
|
snapshot[key] = [];
|
|
1112
1100
|
}
|
|
1113
1101
|
const snapshotPropValue = {
|
|
1114
1102
|
...styleData,
|
|
1115
|
-
value
|
|
1103
|
+
value: filteredValue
|
|
1116
1104
|
};
|
|
1117
1105
|
snapshot[key].push(snapshotPropValue);
|
|
1118
1106
|
});
|
|
@@ -1144,7 +1132,7 @@ function createStylesInheritance(styleDefs, breakpointsRoot) {
|
|
|
1144
1132
|
function buildStyleVariantsByMetaMapping(styleDefs) {
|
|
1145
1133
|
const breakpointStateSlots = {};
|
|
1146
1134
|
styleDefs.forEach((styleDef) => {
|
|
1147
|
-
const provider = getProviderByStyleId(styleDef.id)?.
|
|
1135
|
+
const provider = getProviderByStyleId(styleDef.id)?.getKey() ?? null;
|
|
1148
1136
|
styleDef.variants.forEach((variant) => {
|
|
1149
1137
|
const { meta } = variant;
|
|
1150
1138
|
const { state, breakpoint } = meta;
|
|
@@ -1199,7 +1187,7 @@ var useAppliedStyles = () => {
|
|
|
1199
1187
|
const baseStyles = useBaseStyles();
|
|
1200
1188
|
useStylesRerender();
|
|
1201
1189
|
const classesProp = (0, import_editor_elements4.useElementSetting)(element.id, currentClassesProp);
|
|
1202
|
-
const appliedStyles =
|
|
1190
|
+
const appliedStyles = import_editor_props3.classesPropTypeUtil.extract(classesProp);
|
|
1203
1191
|
return import_editor_styles_repository5.stylesRepository.all().filter((style) => appliedStyles?.includes(style.id)).concat(baseStyles);
|
|
1204
1192
|
};
|
|
1205
1193
|
var useBaseStyles = () => {
|
|
@@ -1209,6 +1197,30 @@ var useBaseStyles = () => {
|
|
|
1209
1197
|
return Object.values(widgetCache?.base_styles ?? {});
|
|
1210
1198
|
};
|
|
1211
1199
|
|
|
1200
|
+
// src/hooks/use-active-style-def-id.ts
|
|
1201
|
+
var import_react10 = require("react");
|
|
1202
|
+
var import_editor_elements5 = require("@elementor/editor-elements");
|
|
1203
|
+
function useActiveStyleDefId(classProp) {
|
|
1204
|
+
const [activeStyledDefId, setActiveStyledDefId] = (0, import_react10.useState)(null);
|
|
1205
|
+
const appliedClassesIds = useAppliedClassesIds2(classProp)?.value || [];
|
|
1206
|
+
const fallback = useFirstAppliedClass(appliedClassesIds);
|
|
1207
|
+
const activeAndAppliedClassId = useActiveAndAppliedClassId(activeStyledDefId, appliedClassesIds);
|
|
1208
|
+
return [activeAndAppliedClassId || fallback?.id || null, setActiveStyledDefId];
|
|
1209
|
+
}
|
|
1210
|
+
function useFirstAppliedClass(appliedClassesIds) {
|
|
1211
|
+
const { element } = useElement();
|
|
1212
|
+
const stylesDefs = (0, import_editor_elements5.getElementStyles)(element.id) ?? {};
|
|
1213
|
+
return Object.values(stylesDefs).find((styleDef) => appliedClassesIds.includes(styleDef.id));
|
|
1214
|
+
}
|
|
1215
|
+
function useAppliedClassesIds2(classProp) {
|
|
1216
|
+
const { element } = useElement();
|
|
1217
|
+
return (0, import_editor_elements5.useElementSetting)(element.id, classProp);
|
|
1218
|
+
}
|
|
1219
|
+
function useActiveAndAppliedClassId(id, appliedClassesIds) {
|
|
1220
|
+
const isClassApplied = !!id && appliedClassesIds.includes(id);
|
|
1221
|
+
return isClassApplied ? id : null;
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1212
1224
|
// src/components/style-sections/background-section/background-section.tsx
|
|
1213
1225
|
var React19 = __toESM(require("react"));
|
|
1214
1226
|
var import_editor_controls7 = require("@elementor/editor-controls");
|
|
@@ -1219,8 +1231,8 @@ var import_editor_controls6 = require("@elementor/editor-controls");
|
|
|
1219
1231
|
var import_editor_styles2 = require("@elementor/editor-styles");
|
|
1220
1232
|
|
|
1221
1233
|
// src/hooks/use-styles-fields.ts
|
|
1222
|
-
var
|
|
1223
|
-
var
|
|
1234
|
+
var import_react11 = require("react");
|
|
1235
|
+
var import_editor_elements6 = require("@elementor/editor-elements");
|
|
1224
1236
|
var import_editor_styles = require("@elementor/editor-styles");
|
|
1225
1237
|
var import_editor_styles_repository6 = require("@elementor/editor-styles-repository");
|
|
1226
1238
|
var import_editor_v1_adapters = require("@elementor/editor-v1-adapters");
|
|
@@ -1263,9 +1275,9 @@ function getProps({ styleId, elementId, provider, meta, propNames }) {
|
|
|
1263
1275
|
if (!provider || !styleId) {
|
|
1264
1276
|
return null;
|
|
1265
1277
|
}
|
|
1266
|
-
const style = provider.actions.
|
|
1278
|
+
const style = provider.actions.get(styleId, { elementId });
|
|
1267
1279
|
if (!style) {
|
|
1268
|
-
throw new StyleNotFoundUnderProviderError({ context: { styleId, providerKey: provider.
|
|
1280
|
+
throw new StyleNotFoundUnderProviderError({ context: { styleId, providerKey: provider.getKey() } });
|
|
1269
1281
|
}
|
|
1270
1282
|
const variant = (0, import_editor_styles.getVariantByMeta)(style, meta);
|
|
1271
1283
|
return Object.fromEntries(
|
|
@@ -1273,44 +1285,44 @@ function getProps({ styleId, elementId, provider, meta, propNames }) {
|
|
|
1273
1285
|
);
|
|
1274
1286
|
}
|
|
1275
1287
|
function useUndoableCreateElementStyle() {
|
|
1276
|
-
return (0,
|
|
1288
|
+
return (0, import_react11.useMemo)(() => {
|
|
1277
1289
|
return (0, import_editor_v1_adapters.undoable)(
|
|
1278
1290
|
{
|
|
1279
1291
|
do: (payload) => {
|
|
1280
|
-
return (0,
|
|
1292
|
+
return (0, import_editor_elements6.createElementStyle)({
|
|
1281
1293
|
...payload,
|
|
1282
|
-
label: import_editor_styles_repository6.
|
|
1294
|
+
label: import_editor_styles_repository6.ELEMENTS_STYLES_RESERVED_LABEL
|
|
1283
1295
|
});
|
|
1284
1296
|
},
|
|
1285
1297
|
undo: ({ elementId }, styleId) => {
|
|
1286
|
-
(0,
|
|
1298
|
+
(0, import_editor_elements6.deleteElementStyle)(elementId, styleId);
|
|
1287
1299
|
},
|
|
1288
1300
|
redo: (payload, styleId) => {
|
|
1289
|
-
return (0,
|
|
1301
|
+
return (0, import_editor_elements6.createElementStyle)({
|
|
1290
1302
|
...payload,
|
|
1291
1303
|
styleId,
|
|
1292
|
-
label: import_editor_styles_repository6.
|
|
1304
|
+
label: import_editor_styles_repository6.ELEMENTS_STYLES_RESERVED_LABEL
|
|
1293
1305
|
});
|
|
1294
1306
|
}
|
|
1295
1307
|
},
|
|
1296
1308
|
{
|
|
1297
|
-
title: ({ elementId }) => (0,
|
|
1309
|
+
title: ({ elementId }) => (0, import_editor_elements6.getElementLabel)(elementId),
|
|
1298
1310
|
subtitle: (0, import_i18n4.__)("Style edited", "elementor")
|
|
1299
1311
|
}
|
|
1300
1312
|
);
|
|
1301
1313
|
}, []);
|
|
1302
1314
|
}
|
|
1303
1315
|
function useUndoableUpdateStyle() {
|
|
1304
|
-
return (0,
|
|
1316
|
+
return (0, import_react11.useMemo)(() => {
|
|
1305
1317
|
return (0, import_editor_v1_adapters.undoable)(
|
|
1306
1318
|
{
|
|
1307
1319
|
do: ({ elementId, styleId, provider, meta, props }) => {
|
|
1308
1320
|
if (!provider.actions.updateProps) {
|
|
1309
1321
|
throw new StylesProviderCannotUpdatePropsError({
|
|
1310
|
-
context: { providerKey: provider.
|
|
1322
|
+
context: { providerKey: provider.getKey() }
|
|
1311
1323
|
});
|
|
1312
1324
|
}
|
|
1313
|
-
const style = provider.actions.
|
|
1325
|
+
const style = provider.actions.get(styleId, { elementId });
|
|
1314
1326
|
const prevProps = getCurrentProps(style, meta);
|
|
1315
1327
|
provider.actions.updateProps(
|
|
1316
1328
|
{
|
|
@@ -1327,7 +1339,7 @@ function useUndoableUpdateStyle() {
|
|
|
1327
1339
|
}
|
|
1328
1340
|
},
|
|
1329
1341
|
{
|
|
1330
|
-
title: ({ elementId }) => (0,
|
|
1342
|
+
title: ({ elementId }) => (0, import_editor_elements6.getElementLabel)(elementId),
|
|
1331
1343
|
subtitle: (0, import_i18n4.__)("Style edited", "elementor")
|
|
1332
1344
|
}
|
|
1333
1345
|
);
|
|
@@ -1377,7 +1389,7 @@ var StylesInheritanceIndicator = () => {
|
|
|
1377
1389
|
StyleIndicator,
|
|
1378
1390
|
{
|
|
1379
1391
|
"aria-label": (0, import_i18n5.__)("This is the final value", "elementor"),
|
|
1380
|
-
variant:
|
|
1392
|
+
variant: (0, import_editor_styles_repository7.isElementsStylesProvider)(currentStyleProvider?.getKey()) ? "local" : "global"
|
|
1381
1393
|
}
|
|
1382
1394
|
);
|
|
1383
1395
|
}
|
|
@@ -1394,11 +1406,12 @@ var StylesInheritanceIndicator = () => {
|
|
|
1394
1406
|
};
|
|
1395
1407
|
|
|
1396
1408
|
// src/controls-registry/styles-field.tsx
|
|
1397
|
-
var StylesField = ({ bind, children }) => {
|
|
1409
|
+
var StylesField = ({ bind, placeholder, children }) => {
|
|
1398
1410
|
const [value, setValue] = useStylesField(bind);
|
|
1399
1411
|
const stylesSchema = (0, import_editor_styles2.getStylesSchema)();
|
|
1400
1412
|
const propType = createTopLevelOjectType({ schema: stylesSchema });
|
|
1401
1413
|
const values = { [bind]: value };
|
|
1414
|
+
const placeholderValues = { [bind]: placeholder };
|
|
1402
1415
|
const setValues = (newValue) => {
|
|
1403
1416
|
setValue(newValue[bind]);
|
|
1404
1417
|
};
|
|
@@ -1412,7 +1425,16 @@ var StylesField = ({ bind, children }) => {
|
|
|
1412
1425
|
}
|
|
1413
1426
|
]
|
|
1414
1427
|
},
|
|
1415
|
-
/* @__PURE__ */ React18.createElement(
|
|
1428
|
+
/* @__PURE__ */ React18.createElement(
|
|
1429
|
+
import_editor_controls6.PropProvider,
|
|
1430
|
+
{
|
|
1431
|
+
propType,
|
|
1432
|
+
value: values,
|
|
1433
|
+
setValue: setValues,
|
|
1434
|
+
placeholder: placeholderValues
|
|
1435
|
+
},
|
|
1436
|
+
/* @__PURE__ */ React18.createElement(import_editor_controls6.PropKeyProvider, { bind }, children)
|
|
1437
|
+
)
|
|
1416
1438
|
);
|
|
1417
1439
|
};
|
|
1418
1440
|
|
|
@@ -1460,7 +1482,8 @@ var AddOrRemoveContent = ({ isAdded, label, onAdd, onRemove, children }) => {
|
|
|
1460
1482
|
direction: "row",
|
|
1461
1483
|
sx: {
|
|
1462
1484
|
justifyContent: "space-between",
|
|
1463
|
-
alignItems: "center"
|
|
1485
|
+
alignItems: "center",
|
|
1486
|
+
marginInlineEnd: -0.75
|
|
1464
1487
|
}
|
|
1465
1488
|
},
|
|
1466
1489
|
/* @__PURE__ */ React23.createElement(ControlLabel, null, label),
|
|
@@ -1500,7 +1523,7 @@ var BorderStyleField = () => {
|
|
|
1500
1523
|
// src/components/style-sections/border-section/border-width-field.tsx
|
|
1501
1524
|
var React26 = __toESM(require("react"));
|
|
1502
1525
|
var import_editor_controls11 = require("@elementor/editor-controls");
|
|
1503
|
-
var
|
|
1526
|
+
var import_editor_props4 = require("@elementor/editor-props");
|
|
1504
1527
|
var import_icons6 = require("@elementor/icons");
|
|
1505
1528
|
var import_ui19 = require("@elementor/ui");
|
|
1506
1529
|
var import_i18n8 = require("@wordpress/i18n");
|
|
@@ -1547,7 +1570,7 @@ var BorderWidthField = () => {
|
|
|
1547
1570
|
label: (0, import_i18n8.__)("Border width", "elementor"),
|
|
1548
1571
|
icon: /* @__PURE__ */ React26.createElement(import_icons6.SideAllIcon, { fontSize: "tiny" }),
|
|
1549
1572
|
tooltipLabel: (0, import_i18n8.__)("Adjust borders", "elementor"),
|
|
1550
|
-
multiSizePropTypeUtil:
|
|
1573
|
+
multiSizePropTypeUtil: import_editor_props4.borderWidthPropTypeUtil
|
|
1551
1574
|
}
|
|
1552
1575
|
));
|
|
1553
1576
|
};
|
|
@@ -1588,7 +1611,7 @@ var BorderField = () => {
|
|
|
1588
1611
|
// src/components/style-sections/border-section/border-radius-field.tsx
|
|
1589
1612
|
var React28 = __toESM(require("react"));
|
|
1590
1613
|
var import_editor_controls12 = require("@elementor/editor-controls");
|
|
1591
|
-
var
|
|
1614
|
+
var import_editor_props5 = require("@elementor/editor-props");
|
|
1592
1615
|
var import_icons7 = require("@elementor/icons");
|
|
1593
1616
|
var import_ui20 = require("@elementor/ui");
|
|
1594
1617
|
var import_i18n10 = require("@wordpress/i18n");
|
|
@@ -1631,7 +1654,7 @@ var BorderRadiusField = () => {
|
|
|
1631
1654
|
label: (0, import_i18n10.__)("Border radius", "elementor"),
|
|
1632
1655
|
icon: /* @__PURE__ */ React28.createElement(import_icons7.BorderCornersIcon, { fontSize: "tiny" }),
|
|
1633
1656
|
tooltipLabel: (0, import_i18n10.__)("Adjust corners", "elementor"),
|
|
1634
|
-
multiSizePropTypeUtil:
|
|
1657
|
+
multiSizePropTypeUtil: import_editor_props5.borderRadiusPropTypeUtil
|
|
1635
1658
|
}
|
|
1636
1659
|
));
|
|
1637
1660
|
};
|
|
@@ -1649,7 +1672,7 @@ var EffectsSection = () => {
|
|
|
1649
1672
|
// src/components/style-sections/layout-section/layout-section.tsx
|
|
1650
1673
|
var React42 = __toESM(require("react"));
|
|
1651
1674
|
var import_editor_controls24 = require("@elementor/editor-controls");
|
|
1652
|
-
var
|
|
1675
|
+
var import_editor_elements7 = require("@elementor/editor-elements");
|
|
1653
1676
|
var import_i18n21 = require("@wordpress/i18n");
|
|
1654
1677
|
|
|
1655
1678
|
// src/hooks/use-computed-style.ts
|
|
@@ -1686,7 +1709,7 @@ var import_i18n11 = require("@wordpress/i18n");
|
|
|
1686
1709
|
|
|
1687
1710
|
// src/components/style-sections/layout-section/utils/rotated-icon.tsx
|
|
1688
1711
|
var React31 = __toESM(require("react"));
|
|
1689
|
-
var
|
|
1712
|
+
var import_react12 = require("react");
|
|
1690
1713
|
var import_ui21 = require("@elementor/ui");
|
|
1691
1714
|
var CLOCKWISE_ANGLES = {
|
|
1692
1715
|
row: 0,
|
|
@@ -1707,7 +1730,7 @@ var RotatedIcon = ({
|
|
|
1707
1730
|
offset = 0,
|
|
1708
1731
|
disableRotationForReversed = false
|
|
1709
1732
|
}) => {
|
|
1710
|
-
const rotate = (0,
|
|
1733
|
+
const rotate = (0, import_react12.useRef)(useGetTargetAngle(isClockwise, offset, disableRotationForReversed));
|
|
1711
1734
|
rotate.current = useGetTargetAngle(isClockwise, offset, disableRotationForReversed, rotate);
|
|
1712
1735
|
return /* @__PURE__ */ React31.createElement(Icon, { fontSize: size, sx: { transition: ".3s", rotate: `${rotate.current}deg` } });
|
|
1713
1736
|
};
|
|
@@ -1869,35 +1892,37 @@ var React35 = __toESM(require("react"));
|
|
|
1869
1892
|
var import_editor_controls17 = require("@elementor/editor-controls");
|
|
1870
1893
|
var import_ui25 = require("@elementor/ui");
|
|
1871
1894
|
var import_i18n14 = require("@wordpress/i18n");
|
|
1895
|
+
var displayFieldOptions = [
|
|
1896
|
+
{
|
|
1897
|
+
value: "block",
|
|
1898
|
+
renderContent: () => (0, import_i18n14.__)("Block", "elementor"),
|
|
1899
|
+
label: (0, import_i18n14.__)("Block", "elementor"),
|
|
1900
|
+
showTooltip: true
|
|
1901
|
+
},
|
|
1902
|
+
{
|
|
1903
|
+
value: "flex",
|
|
1904
|
+
renderContent: () => (0, import_i18n14.__)("Flex", "elementor"),
|
|
1905
|
+
label: (0, import_i18n14.__)("Flex", "elementor"),
|
|
1906
|
+
showTooltip: true
|
|
1907
|
+
},
|
|
1908
|
+
{
|
|
1909
|
+
value: "inline-block",
|
|
1910
|
+
renderContent: () => (0, import_i18n14.__)("In-blk", "elementor"),
|
|
1911
|
+
label: (0, import_i18n14.__)("Inline-block", "elementor"),
|
|
1912
|
+
showTooltip: true
|
|
1913
|
+
},
|
|
1914
|
+
{
|
|
1915
|
+
value: "inline-flex",
|
|
1916
|
+
renderContent: () => (0, import_i18n14.__)("In-flx", "elementor"),
|
|
1917
|
+
label: (0, import_i18n14.__)("Inline-flex", "elementor"),
|
|
1918
|
+
showTooltip: true
|
|
1919
|
+
}
|
|
1920
|
+
];
|
|
1872
1921
|
var DisplayField = () => {
|
|
1873
|
-
const
|
|
1874
|
-
|
|
1875
|
-
value: "block",
|
|
1876
|
-
renderContent: () => (0, import_i18n14.__)("Block", "elementor"),
|
|
1877
|
-
label: (0, import_i18n14.__)("Block", "elementor"),
|
|
1878
|
-
showTooltip: true
|
|
1879
|
-
},
|
|
1880
|
-
{
|
|
1881
|
-
value: "flex",
|
|
1882
|
-
renderContent: () => (0, import_i18n14.__)("Flex", "elementor"),
|
|
1883
|
-
label: (0, import_i18n14.__)("Flex", "elementor"),
|
|
1884
|
-
showTooltip: true
|
|
1885
|
-
},
|
|
1886
|
-
{
|
|
1887
|
-
value: "inline-block",
|
|
1888
|
-
renderContent: () => (0, import_i18n14.__)("In-blk", "elementor"),
|
|
1889
|
-
label: (0, import_i18n14.__)("Inline-block", "elementor"),
|
|
1890
|
-
showTooltip: true
|
|
1891
|
-
},
|
|
1892
|
-
{
|
|
1893
|
-
value: "inline-flex",
|
|
1894
|
-
renderContent: () => (0, import_i18n14.__)("In-flx", "elementor"),
|
|
1895
|
-
label: (0, import_i18n14.__)("Inline-flex", "elementor"),
|
|
1896
|
-
showTooltip: true
|
|
1897
|
-
}
|
|
1898
|
-
];
|
|
1899
|
-
return /* @__PURE__ */ React35.createElement(StylesField, { bind: "display" }, /* @__PURE__ */ React35.createElement(import_ui25.Stack, { gap: 0.75 }, /* @__PURE__ */ React35.createElement(ControlLabel, null, (0, import_i18n14.__)("Display", "elementor")), /* @__PURE__ */ React35.createElement(import_editor_controls17.ToggleControl, { options: options13, fullWidth: true })));
|
|
1922
|
+
const placeholder = useDisplayPlaceholderValue();
|
|
1923
|
+
return /* @__PURE__ */ React35.createElement(StylesField, { bind: "display", placeholder }, /* @__PURE__ */ React35.createElement(import_ui25.Stack, { gap: 0.75 }, /* @__PURE__ */ React35.createElement(ControlLabel, null, (0, import_i18n14.__)("Display", "elementor")), /* @__PURE__ */ React35.createElement(import_editor_controls17.ToggleControl, { options: displayFieldOptions, fullWidth: true })));
|
|
1900
1924
|
};
|
|
1925
|
+
var useDisplayPlaceholderValue = () => useStylesInheritanceField("display")[0]?.value ?? void 0;
|
|
1901
1926
|
|
|
1902
1927
|
// src/components/style-sections/layout-section/flex-direction-field.tsx
|
|
1903
1928
|
var React36 = __toESM(require("react"));
|
|
@@ -1944,7 +1969,7 @@ var FlexDirectionField = () => {
|
|
|
1944
1969
|
|
|
1945
1970
|
// src/components/style-sections/layout-section/flex-order-field.tsx
|
|
1946
1971
|
var React37 = __toESM(require("react"));
|
|
1947
|
-
var
|
|
1972
|
+
var import_react13 = require("react");
|
|
1948
1973
|
var import_editor_controls19 = require("@elementor/editor-controls");
|
|
1949
1974
|
var import_icons12 = require("@elementor/icons");
|
|
1950
1975
|
var import_ui27 = require("@elementor/ui");
|
|
@@ -1980,7 +2005,7 @@ var items = [
|
|
|
1980
2005
|
];
|
|
1981
2006
|
var FlexOrderField = () => {
|
|
1982
2007
|
const { isSiteRtl } = useDirection(), [order, setOrder] = useStylesField("order");
|
|
1983
|
-
const [groupControlValue, setGroupControlValue] = (0,
|
|
2008
|
+
const [groupControlValue, setGroupControlValue] = (0, import_react13.useState)(getGroupControlValue(order?.value || null));
|
|
1984
2009
|
const handleToggleButtonChange = (group) => {
|
|
1985
2010
|
setGroupControlValue(group);
|
|
1986
2011
|
if (!group || group === CUSTOM) {
|
|
@@ -2018,9 +2043,9 @@ var getGroupControlValue = (order) => {
|
|
|
2018
2043
|
|
|
2019
2044
|
// src/components/style-sections/layout-section/flex-size-field.tsx
|
|
2020
2045
|
var React38 = __toESM(require("react"));
|
|
2021
|
-
var
|
|
2046
|
+
var import_react14 = require("react");
|
|
2022
2047
|
var import_editor_controls20 = require("@elementor/editor-controls");
|
|
2023
|
-
var
|
|
2048
|
+
var import_editor_props6 = require("@elementor/editor-props");
|
|
2024
2049
|
var import_icons13 = require("@elementor/icons");
|
|
2025
2050
|
var import_ui28 = require("@elementor/ui");
|
|
2026
2051
|
var import_i18n17 = require("@wordpress/i18n");
|
|
@@ -2051,7 +2076,7 @@ var FlexSizeField = () => {
|
|
|
2051
2076
|
const grow = fields?.["flex-grow"]?.value || null;
|
|
2052
2077
|
const shrink = fields?.["flex-shrink"]?.value || null;
|
|
2053
2078
|
const basis = fields?.["flex-basis"]?.value || null;
|
|
2054
|
-
const currentGroup = (0,
|
|
2079
|
+
const currentGroup = (0, import_react14.useMemo)(() => getActiveGroup({ grow, shrink, basis }), [grow, shrink, basis]), [activeGroup, setActiveGroup] = (0, import_react14.useState)(currentGroup);
|
|
2055
2080
|
const onChangeGroup = (group = null) => {
|
|
2056
2081
|
setActiveGroup(group);
|
|
2057
2082
|
if (!group || group === "custom") {
|
|
@@ -2065,7 +2090,7 @@ var FlexSizeField = () => {
|
|
|
2065
2090
|
if (group === "flex-grow") {
|
|
2066
2091
|
setFields({
|
|
2067
2092
|
"flex-basis": null,
|
|
2068
|
-
"flex-grow":
|
|
2093
|
+
"flex-grow": import_editor_props6.numberPropTypeUtil.create(DEFAULT),
|
|
2069
2094
|
"flex-shrink": null
|
|
2070
2095
|
});
|
|
2071
2096
|
return;
|
|
@@ -2073,7 +2098,7 @@ var FlexSizeField = () => {
|
|
|
2073
2098
|
setFields({
|
|
2074
2099
|
"flex-basis": null,
|
|
2075
2100
|
"flex-grow": null,
|
|
2076
|
-
"flex-shrink":
|
|
2101
|
+
"flex-shrink": import_editor_props6.numberPropTypeUtil.create(DEFAULT)
|
|
2077
2102
|
});
|
|
2078
2103
|
};
|
|
2079
2104
|
return /* @__PURE__ */ React38.createElement(import_ui28.DirectionProvider, { rtl: isSiteRtl }, /* @__PURE__ */ React38.createElement(import_ui28.ThemeProvider, null, /* @__PURE__ */ React38.createElement(SectionContent, null, /* @__PURE__ */ React38.createElement(import_ui28.Grid, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React38.createElement(import_ui28.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React38.createElement(StylesField, { bind: activeGroup ?? "" }, /* @__PURE__ */ React38.createElement(ControlLabel, null, (0, import_i18n17.__)("Size", "elementor")))), /* @__PURE__ */ React38.createElement(import_ui28.Grid, { item: true, xs: 6, sx: { display: "flex", justifyContent: "end" } }, /* @__PURE__ */ React38.createElement(
|
|
@@ -2205,16 +2230,25 @@ var WrapField = () => {
|
|
|
2205
2230
|
// src/components/style-sections/layout-section/layout-section.tsx
|
|
2206
2231
|
var LayoutSection = () => {
|
|
2207
2232
|
const [display] = useStylesField("display");
|
|
2233
|
+
const displayPlaceholder = useDisplayPlaceholderValue();
|
|
2234
|
+
const isDisplayFlex = shouldDisplayFlexFields(display, displayPlaceholder);
|
|
2208
2235
|
const { element } = useElement();
|
|
2209
|
-
const parent = (0,
|
|
2236
|
+
const parent = (0, import_editor_elements7.useParentElement)(element.id);
|
|
2210
2237
|
const parentStyle = useComputedStyle(parent?.id || null);
|
|
2211
|
-
return /* @__PURE__ */ React42.createElement(SectionContent, null, /* @__PURE__ */ React42.createElement(DisplayField, null),
|
|
2238
|
+
return /* @__PURE__ */ React42.createElement(SectionContent, null, /* @__PURE__ */ React42.createElement(DisplayField, null), isDisplayFlex && /* @__PURE__ */ React42.createElement(FlexFields, null), "flex" === parentStyle?.display && /* @__PURE__ */ React42.createElement(FlexChildFields, null));
|
|
2212
2239
|
};
|
|
2213
2240
|
var FlexFields = () => {
|
|
2214
2241
|
const [flexWrap] = useStylesField("flex-wrap");
|
|
2215
2242
|
return /* @__PURE__ */ React42.createElement(React42.Fragment, null, /* @__PURE__ */ React42.createElement(FlexDirectionField, null), /* @__PURE__ */ React42.createElement(JustifyContentField, null), /* @__PURE__ */ React42.createElement(AlignItemsField, null), /* @__PURE__ */ React42.createElement(PanelDivider, null), /* @__PURE__ */ React42.createElement(GapControlField, null), /* @__PURE__ */ React42.createElement(WrapField, null), ["wrap", "wrap-reverse"].includes(flexWrap?.value) && /* @__PURE__ */ React42.createElement(AlignContentField, null));
|
|
2216
2243
|
};
|
|
2217
2244
|
var FlexChildFields = () => /* @__PURE__ */ React42.createElement(React42.Fragment, null, /* @__PURE__ */ React42.createElement(PanelDivider, null), /* @__PURE__ */ React42.createElement(import_editor_controls24.ControlFormLabel, null, (0, import_i18n21.__)("Flex child", "elementor")), /* @__PURE__ */ React42.createElement(AlignSelfChild, null), /* @__PURE__ */ React42.createElement(FlexOrderField, null), /* @__PURE__ */ React42.createElement(FlexSizeField, null));
|
|
2245
|
+
var shouldDisplayFlexFields = (display, local) => {
|
|
2246
|
+
const value = display?.value ?? local?.value;
|
|
2247
|
+
if (!value) {
|
|
2248
|
+
return false;
|
|
2249
|
+
}
|
|
2250
|
+
return "flex" === value || "inline-flex" === value;
|
|
2251
|
+
};
|
|
2218
2252
|
|
|
2219
2253
|
// src/components/style-sections/position-section/position-section.tsx
|
|
2220
2254
|
var React46 = __toESM(require("react"));
|
|
@@ -2386,11 +2420,11 @@ var React64 = __toESM(require("react"));
|
|
|
2386
2420
|
|
|
2387
2421
|
// src/components/collapsible-content.tsx
|
|
2388
2422
|
var React50 = __toESM(require("react"));
|
|
2389
|
-
var
|
|
2423
|
+
var import_react15 = require("react");
|
|
2390
2424
|
var import_ui37 = require("@elementor/ui");
|
|
2391
2425
|
var import_i18n28 = require("@wordpress/i18n");
|
|
2392
2426
|
var CollapsibleContent = ({ children, defaultOpen = false }) => {
|
|
2393
|
-
const [open, setOpen] = (0,
|
|
2427
|
+
const [open, setOpen] = (0, import_react15.useState)(defaultOpen);
|
|
2394
2428
|
const handleToggle = () => {
|
|
2395
2429
|
setOpen((prevOpen) => !prevOpen);
|
|
2396
2430
|
};
|
|
@@ -2416,7 +2450,7 @@ var import_ui38 = require("@elementor/ui");
|
|
|
2416
2450
|
var import_i18n30 = require("@wordpress/i18n");
|
|
2417
2451
|
|
|
2418
2452
|
// src/components/style-sections/typography-section/hooks/use-font-families.ts
|
|
2419
|
-
var
|
|
2453
|
+
var import_react16 = require("react");
|
|
2420
2454
|
var import_i18n29 = require("@wordpress/i18n");
|
|
2421
2455
|
|
|
2422
2456
|
// src/sync/get-elementor-config.ts
|
|
@@ -2441,7 +2475,7 @@ var getFontFamilies = () => {
|
|
|
2441
2475
|
};
|
|
2442
2476
|
var useFontFamilies = () => {
|
|
2443
2477
|
const fontFamilies = getFontFamilies();
|
|
2444
|
-
return (0,
|
|
2478
|
+
return (0, import_react16.useMemo)(() => {
|
|
2445
2479
|
const categoriesOrder = ["system", "custom", "googlefonts"];
|
|
2446
2480
|
return Object.entries(fontFamilies || {}).reduce((acc, [font, category]) => {
|
|
2447
2481
|
if (!supportedCategories[category]) {
|
|
@@ -2737,7 +2771,7 @@ var TypographySection = () => {
|
|
|
2737
2771
|
var StyleTab = () => {
|
|
2738
2772
|
const currentClassesProp = useCurrentClassesProp();
|
|
2739
2773
|
const [activeStyleDefId, setActiveStyleDefId] = useActiveStyleDefId(currentClassesProp);
|
|
2740
|
-
const [activeStyleState, setActiveStyleState] = (0,
|
|
2774
|
+
const [activeStyleState, setActiveStyleState] = (0, import_react17.useState)(null);
|
|
2741
2775
|
const breakpoint = (0, import_editor_responsive2.useActiveBreakpoint)();
|
|
2742
2776
|
return /* @__PURE__ */ React65.createElement(ClassesPropProvider, { prop: currentClassesProp }, /* @__PURE__ */ React65.createElement(
|
|
2743
2777
|
StyleProvider,
|
|
@@ -2753,21 +2787,10 @@ var StyleTab = () => {
|
|
|
2753
2787
|
/* @__PURE__ */ React65.createElement(import_session3.SessionStorageProvider, { prefix: activeStyleDefId ?? "" }, /* @__PURE__ */ React65.createElement(StyleInheritanceProvider, null, /* @__PURE__ */ React65.createElement(CssClassSelector, null), /* @__PURE__ */ React65.createElement(import_ui50.Divider, null), /* @__PURE__ */ React65.createElement(SectionsList, null, /* @__PURE__ */ React65.createElement(Section, { title: (0, import_i18n43.__)("Layout", "elementor") }, /* @__PURE__ */ React65.createElement(LayoutSection, null)), /* @__PURE__ */ React65.createElement(Section, { title: (0, import_i18n43.__)("Spacing", "elementor") }, /* @__PURE__ */ React65.createElement(SpacingSection, null)), /* @__PURE__ */ React65.createElement(Section, { title: (0, import_i18n43.__)("Size", "elementor") }, /* @__PURE__ */ React65.createElement(SizeSection, null)), /* @__PURE__ */ React65.createElement(Section, { title: (0, import_i18n43.__)("Position", "elementor") }, /* @__PURE__ */ React65.createElement(PositionSection, null)), /* @__PURE__ */ React65.createElement(Section, { title: (0, import_i18n43.__)("Typography", "elementor") }, /* @__PURE__ */ React65.createElement(TypographySection, null)), /* @__PURE__ */ React65.createElement(Section, { title: (0, import_i18n43.__)("Background", "elementor") }, /* @__PURE__ */ React65.createElement(BackgroundSection, null)), /* @__PURE__ */ React65.createElement(Section, { title: (0, import_i18n43.__)("Border", "elementor") }, /* @__PURE__ */ React65.createElement(BorderSection, null)), /* @__PURE__ */ React65.createElement(Section, { title: (0, import_i18n43.__)("Effects", "elementor") }, /* @__PURE__ */ React65.createElement(EffectsSection, null)))))
|
|
2754
2788
|
));
|
|
2755
2789
|
};
|
|
2756
|
-
function useActiveStyleDefId(currentClassesProp) {
|
|
2757
|
-
const [activeStyledDefId, setActiveStyledDefId] = (0, import_react16.useState)(null);
|
|
2758
|
-
const fallback = useFirstElementStyleDef(currentClassesProp);
|
|
2759
|
-
return [activeStyledDefId || fallback?.id || null, setActiveStyledDefId];
|
|
2760
|
-
}
|
|
2761
|
-
function useFirstElementStyleDef(currentClassesProp) {
|
|
2762
|
-
const { element } = useElement();
|
|
2763
|
-
const classesIds = (0, import_editor_elements7.useElementSetting)(element.id, currentClassesProp)?.value || [];
|
|
2764
|
-
const stylesDefs = (0, import_editor_elements7.getElementStyles)(element.id) ?? {};
|
|
2765
|
-
return Object.values(stylesDefs).find((styleDef) => classesIds.includes(styleDef.id));
|
|
2766
|
-
}
|
|
2767
2790
|
function useCurrentClassesProp() {
|
|
2768
2791
|
const { elementType } = useElement();
|
|
2769
2792
|
const prop = Object.entries(elementType.propsSchema).find(
|
|
2770
|
-
([, propType]) => propType.kind === "plain" && propType.key ===
|
|
2793
|
+
([, propType]) => propType.kind === "plain" && propType.key === import_editor_props7.CLASSES_PROP_KEY
|
|
2771
2794
|
);
|
|
2772
2795
|
if (!prop) {
|
|
2773
2796
|
throw new Error("Element does not have a classes prop");
|
|
@@ -2782,7 +2805,7 @@ var EditingPanelTabs = () => {
|
|
|
2782
2805
|
return (
|
|
2783
2806
|
// When switching between elements, the local states should be reset. We are using key to rerender the tabs.
|
|
2784
2807
|
// Reference: https://react.dev/learn/preserving-and-resetting-state#resetting-a-form-with-a-key
|
|
2785
|
-
/* @__PURE__ */ React66.createElement(
|
|
2808
|
+
/* @__PURE__ */ React66.createElement(import_react18.Fragment, { key: element.id }, /* @__PURE__ */ React66.createElement(import_ui51.Stack, { direction: "column", sx: { width: "100%" } }, /* @__PURE__ */ React66.createElement(import_ui51.Tabs, { variant: "fullWidth", size: "small", sx: { mt: 0.5 }, ...getTabsProps() }, /* @__PURE__ */ React66.createElement(import_ui51.Tab, { label: (0, import_i18n44.__)("General", "elementor"), ...getTabProps("settings") }), /* @__PURE__ */ React66.createElement(import_ui51.Tab, { label: (0, import_i18n44.__)("Style", "elementor"), ...getTabProps("style") })), /* @__PURE__ */ React66.createElement(import_ui51.Divider, null), /* @__PURE__ */ React66.createElement(import_ui51.TabPanel, { ...getTabPanelProps("settings"), disablePadding: true }, /* @__PURE__ */ React66.createElement(SettingsTab, null)), /* @__PURE__ */ React66.createElement(import_ui51.TabPanel, { ...getTabPanelProps("style"), disablePadding: true }, /* @__PURE__ */ React66.createElement(StyleTab, null))))
|
|
2786
2809
|
);
|
|
2787
2810
|
};
|
|
2788
2811
|
|
|
@@ -2812,7 +2835,7 @@ var import_editor_panels3 = require("@elementor/editor-panels");
|
|
|
2812
2835
|
var import_editor_v1_adapters4 = require("@elementor/editor-v1-adapters");
|
|
2813
2836
|
|
|
2814
2837
|
// src/hooks/use-open-editor-panel.ts
|
|
2815
|
-
var
|
|
2838
|
+
var import_react19 = require("react");
|
|
2816
2839
|
var import_editor_v1_adapters3 = require("@elementor/editor-v1-adapters");
|
|
2817
2840
|
|
|
2818
2841
|
// src/sync/is-atomic-widget-selected.ts
|
|
@@ -2829,7 +2852,7 @@ var isAtomicWidgetSelected = () => {
|
|
|
2829
2852
|
// src/hooks/use-open-editor-panel.ts
|
|
2830
2853
|
var useOpenEditorPanel = () => {
|
|
2831
2854
|
const { open } = usePanelActions();
|
|
2832
|
-
(0,
|
|
2855
|
+
(0, import_react19.useEffect)(() => {
|
|
2833
2856
|
return (0, import_editor_v1_adapters3.__privateListenTo)((0, import_editor_v1_adapters3.commandStartEvent)("panel/editor/open"), () => {
|
|
2834
2857
|
if (isAtomicWidgetSelected()) {
|
|
2835
2858
|
open();
|
|
@@ -2849,7 +2872,7 @@ var import_editor_canvas2 = require("@elementor/editor-canvas");
|
|
|
2849
2872
|
|
|
2850
2873
|
// src/dynamics/components/dynamic-selection-control.tsx
|
|
2851
2874
|
var React71 = __toESM(require("react"));
|
|
2852
|
-
var
|
|
2875
|
+
var import_react23 = require("react");
|
|
2853
2876
|
var import_editor_controls48 = require("@elementor/editor-controls");
|
|
2854
2877
|
var import_icons25 = require("@elementor/icons");
|
|
2855
2878
|
var import_ui55 = require("@elementor/ui");
|
|
@@ -2873,10 +2896,10 @@ var React69 = __toESM(require("react"));
|
|
|
2873
2896
|
var import_editor_controls46 = require("@elementor/editor-controls");
|
|
2874
2897
|
|
|
2875
2898
|
// src/dynamics/hooks/use-dynamic-tag.ts
|
|
2876
|
-
var
|
|
2899
|
+
var import_react21 = require("react");
|
|
2877
2900
|
|
|
2878
2901
|
// src/dynamics/hooks/use-prop-dynamic-tags.ts
|
|
2879
|
-
var
|
|
2902
|
+
var import_react20 = require("react");
|
|
2880
2903
|
var import_editor_controls45 = require("@elementor/editor-controls");
|
|
2881
2904
|
|
|
2882
2905
|
// src/dynamics/sync/get-elementor-config.ts
|
|
@@ -2898,7 +2921,7 @@ var getAtomicDynamicTags = () => {
|
|
|
2898
2921
|
};
|
|
2899
2922
|
|
|
2900
2923
|
// src/dynamics/utils.ts
|
|
2901
|
-
var
|
|
2924
|
+
var import_editor_props8 = require("@elementor/editor-props");
|
|
2902
2925
|
var import_schema = require("@elementor/schema");
|
|
2903
2926
|
var DYNAMIC_PROP_TYPE_KEY = "dynamic";
|
|
2904
2927
|
var isDynamicPropType = (prop) => prop.key === DYNAMIC_PROP_TYPE_KEY;
|
|
@@ -2907,12 +2930,12 @@ var getDynamicPropType = (propType) => {
|
|
|
2907
2930
|
return dynamicPropType && isDynamicPropType(dynamicPropType) ? dynamicPropType : null;
|
|
2908
2931
|
};
|
|
2909
2932
|
var isDynamicPropValue = (prop) => {
|
|
2910
|
-
return (0,
|
|
2933
|
+
return (0, import_editor_props8.isTransformable)(prop) && prop.$$type === DYNAMIC_PROP_TYPE_KEY;
|
|
2911
2934
|
};
|
|
2912
2935
|
var supportsDynamic = (propType) => {
|
|
2913
2936
|
return !!getDynamicPropType(propType);
|
|
2914
2937
|
};
|
|
2915
|
-
var dynamicPropTypeUtil = (0,
|
|
2938
|
+
var dynamicPropTypeUtil = (0, import_editor_props8.createPropUtils)(
|
|
2916
2939
|
DYNAMIC_PROP_TYPE_KEY,
|
|
2917
2940
|
import_schema.z.strictObject({
|
|
2918
2941
|
name: import_schema.z.string(),
|
|
@@ -2928,7 +2951,7 @@ var usePropDynamicTags = () => {
|
|
|
2928
2951
|
const propDynamicType = getDynamicPropType(propType);
|
|
2929
2952
|
categories = propDynamicType?.settings.categories || [];
|
|
2930
2953
|
}
|
|
2931
|
-
return (0,
|
|
2954
|
+
return (0, import_react20.useMemo)(() => getDynamicTagsByCategories(categories), [categories.join()]);
|
|
2932
2955
|
};
|
|
2933
2956
|
var getDynamicTagsByCategories = (categories) => {
|
|
2934
2957
|
const dynamicTags = getAtomicDynamicTags();
|
|
@@ -2944,7 +2967,7 @@ var getDynamicTagsByCategories = (categories) => {
|
|
|
2944
2967
|
// src/dynamics/hooks/use-dynamic-tag.ts
|
|
2945
2968
|
var useDynamicTag = (tagName) => {
|
|
2946
2969
|
const dynamicTags = usePropDynamicTags();
|
|
2947
|
-
return (0,
|
|
2970
|
+
return (0, import_react21.useMemo)(() => dynamicTags.find((tag) => tag.name === tagName) ?? null, [dynamicTags, tagName]);
|
|
2948
2971
|
};
|
|
2949
2972
|
|
|
2950
2973
|
// src/dynamics/dynamic-control.tsx
|
|
@@ -2973,14 +2996,14 @@ var DynamicControl = ({ bind, children }) => {
|
|
|
2973
2996
|
|
|
2974
2997
|
// src/dynamics/components/dynamic-selection.tsx
|
|
2975
2998
|
var React70 = __toESM(require("react"));
|
|
2976
|
-
var
|
|
2999
|
+
var import_react22 = require("react");
|
|
2977
3000
|
var import_editor_controls47 = require("@elementor/editor-controls");
|
|
2978
3001
|
var import_icons24 = require("@elementor/icons");
|
|
2979
3002
|
var import_ui54 = require("@elementor/ui");
|
|
2980
3003
|
var import_i18n46 = require("@wordpress/i18n");
|
|
2981
3004
|
var SIZE3 = "tiny";
|
|
2982
3005
|
var DynamicSelection = ({ onSelect }) => {
|
|
2983
|
-
const [searchValue, setSearchValue] = (0,
|
|
3006
|
+
const [searchValue, setSearchValue] = (0, import_react22.useState)("");
|
|
2984
3007
|
const { groups: dynamicGroups } = getAtomicDynamicTags() || {};
|
|
2985
3008
|
const { value: anyValue } = (0, import_editor_controls47.useBoundProp)();
|
|
2986
3009
|
const { bind, value: dynamicValue, setValue } = (0, import_editor_controls47.useBoundProp)(dynamicPropTypeUtil);
|
|
@@ -2998,7 +3021,7 @@ var DynamicSelection = ({ onSelect }) => {
|
|
|
2998
3021
|
setValue({ name: value, settings: { label } });
|
|
2999
3022
|
onSelect?.();
|
|
3000
3023
|
};
|
|
3001
|
-
return /* @__PURE__ */ React70.createElement(import_ui54.Stack, null, hasNoDynamicTags ? /* @__PURE__ */ React70.createElement(NoDynamicTags, null) : /* @__PURE__ */ React70.createElement(
|
|
3024
|
+
return /* @__PURE__ */ React70.createElement(import_ui54.Stack, null, hasNoDynamicTags ? /* @__PURE__ */ React70.createElement(NoDynamicTags, null) : /* @__PURE__ */ React70.createElement(import_react22.Fragment, null, /* @__PURE__ */ React70.createElement(import_ui54.Box, { px: 1.5, pb: 1 }, /* @__PURE__ */ React70.createElement(
|
|
3002
3025
|
import_ui54.TextField,
|
|
3003
3026
|
{
|
|
3004
3027
|
fullWidth: true,
|
|
@@ -3010,7 +3033,7 @@ var DynamicSelection = ({ onSelect }) => {
|
|
|
3010
3033
|
startAdornment: /* @__PURE__ */ React70.createElement(import_ui54.InputAdornment, { position: "start" }, /* @__PURE__ */ React70.createElement(import_icons24.SearchIcon, { fontSize: SIZE3 }))
|
|
3011
3034
|
}
|
|
3012
3035
|
}
|
|
3013
|
-
)), /* @__PURE__ */ React70.createElement(import_ui54.Divider, null), /* @__PURE__ */ React70.createElement(import_ui54.Box, { sx: { overflowY: "auto", height: 260, width: 220 } }, options13.length > 0 ? /* @__PURE__ */ React70.createElement(import_ui54.MenuList, { role: "listbox", tabIndex: 0 }, options13.map(([category, items3], index) => /* @__PURE__ */ React70.createElement(
|
|
3036
|
+
)), /* @__PURE__ */ React70.createElement(import_ui54.Divider, null), /* @__PURE__ */ React70.createElement(import_ui54.Box, { sx: { overflowY: "auto", height: 260, width: 220 } }, options13.length > 0 ? /* @__PURE__ */ React70.createElement(import_ui54.MenuList, { role: "listbox", tabIndex: 0 }, options13.map(([category, items3], index) => /* @__PURE__ */ React70.createElement(import_react22.Fragment, { key: index }, /* @__PURE__ */ React70.createElement(
|
|
3014
3037
|
import_ui54.MenuSubheader,
|
|
3015
3038
|
{
|
|
3016
3039
|
sx: { px: 1.5, typography: "caption", color: "text.tertiary" }
|
|
@@ -3084,7 +3107,7 @@ var DynamicSelectionControl = () => {
|
|
|
3084
3107
|
const { bind, value } = (0, import_editor_controls48.useBoundProp)(dynamicPropTypeUtil);
|
|
3085
3108
|
const [propValueFromHistory] = usePersistDynamicValue(bind);
|
|
3086
3109
|
const { name: tagName = "" } = value;
|
|
3087
|
-
const selectionPopoverId = (0,
|
|
3110
|
+
const selectionPopoverId = (0, import_react23.useId)();
|
|
3088
3111
|
const selectionPopoverState = (0, import_ui55.usePopupState)({ variant: "popover", popupId: selectionPopoverId });
|
|
3089
3112
|
const dynamicTag = useDynamicTag(tagName);
|
|
3090
3113
|
const removeDynamicTag = () => {
|
|
@@ -3123,7 +3146,7 @@ var DynamicSelectionControl = () => {
|
|
|
3123
3146
|
));
|
|
3124
3147
|
};
|
|
3125
3148
|
var DynamicSettingsPopover = ({ dynamicTag }) => {
|
|
3126
|
-
const popupId = (0,
|
|
3149
|
+
const popupId = (0, import_react23.useId)();
|
|
3127
3150
|
const settingsPopupState = (0, import_ui55.usePopupState)({ variant: "popover", popupId });
|
|
3128
3151
|
const hasDynamicSettings = !!dynamicTag.atomic_controls.length;
|
|
3129
3152
|
if (!hasDynamicSettings) {
|
|
@@ -3171,7 +3194,7 @@ var Control3 = ({ control }) => {
|
|
|
3171
3194
|
|
|
3172
3195
|
// src/dynamics/dynamic-transformer.ts
|
|
3173
3196
|
var import_editor_canvas = require("@elementor/editor-canvas");
|
|
3174
|
-
var
|
|
3197
|
+
var import_editor_props9 = require("@elementor/editor-props");
|
|
3175
3198
|
|
|
3176
3199
|
// src/dynamics/errors.ts
|
|
3177
3200
|
var import_utils8 = require("@elementor/utils");
|
|
@@ -3189,7 +3212,7 @@ var dynamicTransformer = (0, import_editor_canvas.createTransformer)((value) =>
|
|
|
3189
3212
|
});
|
|
3190
3213
|
function simpleTransform(props) {
|
|
3191
3214
|
const transformed = Object.entries(props).map(([settingKey, settingValue]) => {
|
|
3192
|
-
const value = (0,
|
|
3215
|
+
const value = (0, import_editor_props9.isTransformable)(settingValue) ? settingValue.value : settingValue;
|
|
3193
3216
|
return [settingKey, value];
|
|
3194
3217
|
});
|
|
3195
3218
|
return Object.fromEntries(transformed);
|
|
@@ -3269,11 +3292,9 @@ var blockV1Panel = () => {
|
|
|
3269
3292
|
condition: isAtomicWidgetSelected
|
|
3270
3293
|
});
|
|
3271
3294
|
};
|
|
3272
|
-
|
|
3273
|
-
// src/index.ts
|
|
3274
|
-
init2();
|
|
3275
3295
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3276
3296
|
0 && (module.exports = {
|
|
3297
|
+
init,
|
|
3277
3298
|
injectIntoClassSelectorActions,
|
|
3278
3299
|
replaceControl,
|
|
3279
3300
|
useBoundProp,
|