@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.mjs
CHANGED
|
@@ -10,14 +10,15 @@ import * as React7 from "react";
|
|
|
10
10
|
import { getElementSetting, updateElementSettings as updateElementSettings2, useElementSetting as useElementSetting2 } from "@elementor/editor-elements";
|
|
11
11
|
import { classesPropTypeUtil } from "@elementor/editor-props";
|
|
12
12
|
import {
|
|
13
|
-
|
|
13
|
+
isElementsStylesProvider as isElementsStylesProvider2,
|
|
14
14
|
stylesRepository as stylesRepository4,
|
|
15
15
|
useCreateActionsByProvider,
|
|
16
|
-
useProviders
|
|
16
|
+
useProviders,
|
|
17
|
+
validateStyleLabel as validateStyleLabel2
|
|
17
18
|
} from "@elementor/editor-styles-repository";
|
|
18
19
|
import { MapPinIcon } from "@elementor/icons";
|
|
19
20
|
import { createLocation } from "@elementor/locations";
|
|
20
|
-
import { Chip as Chip2, Stack as Stack3
|
|
21
|
+
import { Chip as Chip2, FormLabel, Stack as Stack3 } from "@elementor/ui";
|
|
21
22
|
import { __ as __3 } from "@wordpress/i18n";
|
|
22
23
|
|
|
23
24
|
// src/contexts/classes-prop-context.tsx
|
|
@@ -92,26 +93,21 @@ function useStyle() {
|
|
|
92
93
|
}
|
|
93
94
|
function getProviderByStyleId(styleId) {
|
|
94
95
|
const styleProvider = stylesRepository.getProviders().find((provider) => {
|
|
95
|
-
return provider.actions.
|
|
96
|
+
return provider.actions.all().find((style) => style.id === styleId);
|
|
96
97
|
});
|
|
97
98
|
return styleProvider ?? null;
|
|
98
99
|
}
|
|
99
100
|
|
|
100
101
|
// src/components/multi-combobox.tsx
|
|
101
102
|
import * as React4 from "react";
|
|
102
|
-
import {
|
|
103
|
-
import {
|
|
104
|
-
Autocomplete,
|
|
105
|
-
Box,
|
|
106
|
-
createFilterOptions,
|
|
107
|
-
styled,
|
|
108
|
-
TextField
|
|
109
|
-
} from "@elementor/ui";
|
|
103
|
+
import { useState } from "react";
|
|
104
|
+
import { Autocomplete, createFilterOptions, TextField } from "@elementor/ui";
|
|
110
105
|
function MultiCombobox({
|
|
111
106
|
actions = [],
|
|
112
107
|
selected,
|
|
113
108
|
options: options13,
|
|
114
109
|
onSelect,
|
|
110
|
+
placeholder,
|
|
115
111
|
...props
|
|
116
112
|
}) {
|
|
117
113
|
const filter = useFilterOptions();
|
|
@@ -129,11 +125,11 @@ function MultiCombobox({
|
|
|
129
125
|
disabled: loading,
|
|
130
126
|
value: selected,
|
|
131
127
|
options: options13,
|
|
132
|
-
renderGroup: (params) => /* @__PURE__ */ React4.createElement(Group, { ...params }),
|
|
133
128
|
renderInput: (params) => /* @__PURE__ */ React4.createElement(
|
|
134
129
|
TextField,
|
|
135
130
|
{
|
|
136
131
|
...params,
|
|
132
|
+
placeholder,
|
|
137
133
|
sx: (theme) => ({
|
|
138
134
|
".MuiAutocomplete-inputRoot.MuiInputBase-adornedStart": {
|
|
139
135
|
paddingLeft: theme.spacing(0.25),
|
|
@@ -176,28 +172,10 @@ function MultiCombobox({
|
|
|
176
172
|
];
|
|
177
173
|
},
|
|
178
174
|
groupBy: (option) => option.group ?? "",
|
|
179
|
-
renderOption: (optionProps, { label }) => /* @__PURE__ */ React4.createElement("li", { ...optionProps, style: { display: "block", textOverflow: "ellipsis" } }, label)
|
|
175
|
+
renderOption: (optionProps, { label, group }) => /* @__PURE__ */ React4.createElement("li", { ...optionProps, style: { display: "block", textOverflow: "ellipsis" }, "data-group": group }, label)
|
|
180
176
|
}
|
|
181
177
|
);
|
|
182
178
|
}
|
|
183
|
-
var Group = (params) => {
|
|
184
|
-
const id = `combobox-group-${useId().replace(/:/g, "_")}`;
|
|
185
|
-
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));
|
|
186
|
-
};
|
|
187
|
-
var StyledGroup = styled("li")`
|
|
188
|
-
&:not( :last-of-type ) {
|
|
189
|
-
border-bottom: 1px solid ${({ theme }) => theme.palette.divider};
|
|
190
|
-
}
|
|
191
|
-
`;
|
|
192
|
-
var StyledGroupHeader = styled(Box)(({ theme }) => ({
|
|
193
|
-
position: "sticky",
|
|
194
|
-
top: "-8px",
|
|
195
|
-
padding: theme.spacing(1, 2),
|
|
196
|
-
color: theme.palette.text.tertiary
|
|
197
|
-
}));
|
|
198
|
-
var StyledGroupItems = styled("ul")`
|
|
199
|
-
padding: 0;
|
|
200
|
-
`;
|
|
201
179
|
function useFilterOptions() {
|
|
202
180
|
return useState(() => createFilterOptions())[0];
|
|
203
181
|
}
|
|
@@ -230,7 +208,7 @@ function isAction(option) {
|
|
|
230
208
|
// src/components/css-classes/css-class-item.tsx
|
|
231
209
|
import * as React6 from "react";
|
|
232
210
|
import { useState as useState2 } from "react";
|
|
233
|
-
import { stylesRepository as stylesRepository3 } from "@elementor/editor-styles-repository";
|
|
211
|
+
import { stylesRepository as stylesRepository3, validateStyleLabel } from "@elementor/editor-styles-repository";
|
|
234
212
|
import { EditableField, EllipsisWithTooltip, useEditable } from "@elementor/editor-ui";
|
|
235
213
|
import { DotsVerticalIcon } from "@elementor/icons";
|
|
236
214
|
import {
|
|
@@ -245,7 +223,7 @@ import { __ as __2 } from "@wordpress/i18n";
|
|
|
245
223
|
|
|
246
224
|
// src/components/css-classes/css-class-menu.tsx
|
|
247
225
|
import * as React5 from "react";
|
|
248
|
-
import {
|
|
226
|
+
import { isElementsStylesProvider, stylesRepository as stylesRepository2 } from "@elementor/editor-styles-repository";
|
|
249
227
|
import { MenuListItem } from "@elementor/editor-ui";
|
|
250
228
|
import { bindMenu, Divider, Menu, MenuSubheader, Stack } from "@elementor/ui";
|
|
251
229
|
import { __ } from "@wordpress/i18n";
|
|
@@ -273,8 +251,8 @@ var useUnapplyClass = (classId) => {
|
|
|
273
251
|
};
|
|
274
252
|
|
|
275
253
|
// src/components/style-indicator.tsx
|
|
276
|
-
import { styled
|
|
277
|
-
var StyleIndicator =
|
|
254
|
+
import { styled } from "@elementor/ui";
|
|
255
|
+
var StyleIndicator = styled("div", {
|
|
278
256
|
shouldForwardProp: (prop) => prop !== "variant"
|
|
279
257
|
})`
|
|
280
258
|
width: 5px;
|
|
@@ -298,7 +276,7 @@ var StyleIndicator = styled2("div", {
|
|
|
298
276
|
var STATES = ["hover", "focus", "active"];
|
|
299
277
|
function CssClassMenu({ styleId, provider, popupState, handleRename, anchorEl }) {
|
|
300
278
|
const styledStates = useStyledStates(styleId);
|
|
301
|
-
const indicatorVariant = provider
|
|
279
|
+
const indicatorVariant = !provider || isElementsStylesProvider(provider) ? "local" : "global";
|
|
302
280
|
const handleKeyDown = (e) => {
|
|
303
281
|
e.stopPropagation();
|
|
304
282
|
};
|
|
@@ -316,7 +294,8 @@ function CssClassMenu({ styleId, provider, popupState, handleRename, anchorEl })
|
|
|
316
294
|
horizontal: "left",
|
|
317
295
|
vertical: -4
|
|
318
296
|
},
|
|
319
|
-
onKeyDown: handleKeyDown
|
|
297
|
+
onKeyDown: handleKeyDown,
|
|
298
|
+
disableAutoFocusItem: true
|
|
320
299
|
},
|
|
321
300
|
getMenuItemsByProvider({ provider, styleId, handleRename, closeMenu: popupState.close }),
|
|
322
301
|
/* @__PURE__ */ React5.createElement(MenuSubheader, { sx: { typography: "caption", color: "text.secondary", pb: 0.5, pt: 1 } }, __("States", "elementor")),
|
|
@@ -359,7 +338,7 @@ function getMenuItemsByProvider({
|
|
|
359
338
|
handleRename,
|
|
360
339
|
closeMenu
|
|
361
340
|
}) {
|
|
362
|
-
if (!styleId) {
|
|
341
|
+
if (!styleId || !provider) {
|
|
363
342
|
return [];
|
|
364
343
|
}
|
|
365
344
|
const providerInstance = stylesRepository2.getProviderByKey(provider);
|
|
@@ -449,8 +428,8 @@ function RenameClassMenuItem({
|
|
|
449
428
|
var CHIP_SIZE = "tiny";
|
|
450
429
|
function CssClassItem({
|
|
451
430
|
id,
|
|
452
|
-
label,
|
|
453
431
|
provider,
|
|
432
|
+
label,
|
|
454
433
|
isActive,
|
|
455
434
|
color: colorProp,
|
|
456
435
|
icon,
|
|
@@ -474,7 +453,7 @@ function CssClassItem({
|
|
|
474
453
|
validation: validateLabel
|
|
475
454
|
});
|
|
476
455
|
const color = error ? "error" : colorProp;
|
|
477
|
-
const providerActions = stylesRepository3.getProviderByKey(provider)?.actions;
|
|
456
|
+
const providerActions = provider ? stylesRepository3.getProviderByKey(provider)?.actions : null;
|
|
478
457
|
const allowRename = Boolean(providerActions?.update);
|
|
479
458
|
const isShowingState = isActive && meta.state;
|
|
480
459
|
return /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(
|
|
@@ -549,13 +528,11 @@ function CssClassItem({
|
|
|
549
528
|
));
|
|
550
529
|
}
|
|
551
530
|
var validateLabel = (newLabel) => {
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
if (stylesRepository3.isLabelExist(newLabel)) {
|
|
556
|
-
return __2("Name exists", "elementor");
|
|
531
|
+
const result = validateStyleLabel(newLabel);
|
|
532
|
+
if (result.isValid) {
|
|
533
|
+
return null;
|
|
557
534
|
}
|
|
558
|
-
return
|
|
535
|
+
return result.error;
|
|
559
536
|
};
|
|
560
537
|
|
|
561
538
|
// src/components/css-classes/css-class-selector.tsx
|
|
@@ -567,7 +544,7 @@ var EMPTY_OPTION = {
|
|
|
567
544
|
fixed: true,
|
|
568
545
|
color: "accent",
|
|
569
546
|
icon: /* @__PURE__ */ React7.createElement(MapPinIcon, null),
|
|
570
|
-
provider:
|
|
547
|
+
provider: null
|
|
571
548
|
};
|
|
572
549
|
var { Slot: ClassSelectorActionsSlot, inject: injectIntoClassSelectorActions } = createLocation();
|
|
573
550
|
function CssClassSelector() {
|
|
@@ -578,11 +555,13 @@ function CssClassSelector() {
|
|
|
578
555
|
const handleApply = useHandleApply(appliedIds, setAppliedIds);
|
|
579
556
|
const applied = useAppliedOptions(options13, appliedIds);
|
|
580
557
|
const active = applied.find((option) => option.value === activeId) ?? EMPTY_OPTION;
|
|
581
|
-
|
|
558
|
+
const showPlaceholder = applied.every(({ fixed }) => fixed);
|
|
559
|
+
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(
|
|
582
560
|
MultiCombobox,
|
|
583
561
|
{
|
|
584
562
|
id: ID,
|
|
585
563
|
size: "tiny",
|
|
564
|
+
placeholder: showPlaceholder ? __3("Type to search/add global classes", "elementor") : void 0,
|
|
586
565
|
options: options13,
|
|
587
566
|
selected: applied,
|
|
588
567
|
onSelect: handleApply,
|
|
@@ -618,6 +597,9 @@ function CssClassSelector() {
|
|
|
618
597
|
));
|
|
619
598
|
}
|
|
620
599
|
var updateClassByProvider = (provider, data) => {
|
|
600
|
+
if (!provider) {
|
|
601
|
+
return;
|
|
602
|
+
}
|
|
621
603
|
const providerInstance = stylesRepository4.getProviderByKey(provider);
|
|
622
604
|
if (!providerInstance) {
|
|
623
605
|
return;
|
|
@@ -628,8 +610,8 @@ function useOptions() {
|
|
|
628
610
|
const { element } = useElement();
|
|
629
611
|
const isProviderEditable = (provider) => !!provider.actions.updateProps;
|
|
630
612
|
return useProviders().filter(isProviderEditable).flatMap((provider) => {
|
|
631
|
-
const isElements = provider.
|
|
632
|
-
const styleDefs = provider.actions.
|
|
613
|
+
const isElements = isElementsStylesProvider2(provider.getKey());
|
|
614
|
+
const styleDefs = provider.actions.all({ elementId: element.id });
|
|
633
615
|
if (isElements && styleDefs.length === 0) {
|
|
634
616
|
return [EMPTY_OPTION];
|
|
635
617
|
}
|
|
@@ -640,7 +622,7 @@ function useOptions() {
|
|
|
640
622
|
fixed: isElements,
|
|
641
623
|
color: isElements ? "accent" : "global",
|
|
642
624
|
icon: isElements ? /* @__PURE__ */ React7.createElement(MapPinIcon, null) : null,
|
|
643
|
-
provider: provider.
|
|
625
|
+
provider: provider.getKey(),
|
|
644
626
|
// translators: %s is the plural label of the provider (e.g "Existing classes").
|
|
645
627
|
group: __3("Existing %s", "elementor").replace("%s", provider.labels?.plural ?? "")
|
|
646
628
|
};
|
|
@@ -657,7 +639,7 @@ function useCreateActions({
|
|
|
657
639
|
label: (value) => __3('Create "%s"', "elementor").replace("%s", value),
|
|
658
640
|
// translators: %s is the singular label of css class provider (e.g "CSS Class").
|
|
659
641
|
group: __3("Create a new %s", "elementor").replace("%s", provider.labels?.singular ?? ""),
|
|
660
|
-
condition: (_, inputValue) =>
|
|
642
|
+
condition: (_, inputValue) => validateStyleLabel2(inputValue).isValid && !hasReachedLimit(provider),
|
|
661
643
|
apply: (label) => {
|
|
662
644
|
const createdId = create(label);
|
|
663
645
|
if (!createdId) {
|
|
@@ -670,18 +652,12 @@ function useCreateActions({
|
|
|
670
652
|
});
|
|
671
653
|
}
|
|
672
654
|
function hasReachedLimit(provider) {
|
|
673
|
-
|
|
674
|
-
return false;
|
|
675
|
-
}
|
|
676
|
-
return provider.actions.get().length >= provider.limit;
|
|
677
|
-
}
|
|
678
|
-
function isLabelValid(newLabel) {
|
|
679
|
-
return stylesRepository4.isLabelValid(newLabel) && !stylesRepository4.isLabelExist(newLabel);
|
|
655
|
+
return provider.actions.all().length >= provider.limit;
|
|
680
656
|
}
|
|
681
657
|
function useAppliedOptions(options13, appliedIds) {
|
|
682
658
|
const applied = options13.filter((option) => option.value && appliedIds.includes(option.value));
|
|
683
659
|
const hasElementsProviderStyleApplied = applied.some(
|
|
684
|
-
(option) => option.provider
|
|
660
|
+
(option) => option.provider && isElementsStylesProvider2(option.provider)
|
|
685
661
|
);
|
|
686
662
|
if (!hasElementsProviderStyleApplied) {
|
|
687
663
|
applied.unshift(EMPTY_OPTION);
|
|
@@ -750,9 +726,9 @@ import { createMenu } from "@elementor/menus";
|
|
|
750
726
|
|
|
751
727
|
// src/popover-action.tsx
|
|
752
728
|
import * as React8 from "react";
|
|
753
|
-
import { useId
|
|
729
|
+
import { useId } from "react";
|
|
754
730
|
import { XIcon } from "@elementor/icons";
|
|
755
|
-
import { bindPopover, bindToggle, IconButton, Popover, Stack as Stack4, Tooltip, Typography as
|
|
731
|
+
import { bindPopover, bindToggle, IconButton, Popover, Stack as Stack4, Tooltip, Typography as Typography2, usePopupState as usePopupState2 } from "@elementor/ui";
|
|
756
732
|
var SIZE = "tiny";
|
|
757
733
|
function PopoverAction({
|
|
758
734
|
title,
|
|
@@ -760,7 +736,7 @@ function PopoverAction({
|
|
|
760
736
|
icon: Icon,
|
|
761
737
|
popoverContent: PopoverContent2
|
|
762
738
|
}) {
|
|
763
|
-
const id =
|
|
739
|
+
const id = useId();
|
|
764
740
|
const popupState = usePopupState2({
|
|
765
741
|
variant: "popover",
|
|
766
742
|
popupId: `elementor-popover-action-${id}`
|
|
@@ -779,7 +755,7 @@ function PopoverAction({
|
|
|
779
755
|
},
|
|
780
756
|
...bindPopover(popupState)
|
|
781
757
|
},
|
|
782
|
-
/* @__PURE__ */ React8.createElement(Stack4, { direction: "row", alignItems: "center", pl: 1.5, pr: 0.5, py: 1.5 }, /* @__PURE__ */ React8.createElement(Icon, { fontSize: SIZE, sx: { mr: 0.5 } }), /* @__PURE__ */ React8.createElement(
|
|
758
|
+
/* @__PURE__ */ React8.createElement(Stack4, { direction: "row", alignItems: "center", pl: 1.5, pr: 0.5, py: 1.5 }, /* @__PURE__ */ React8.createElement(Icon, { fontSize: SIZE, sx: { mr: 0.5 } }), /* @__PURE__ */ React8.createElement(Typography2, { variant: "subtitle2" }, title), /* @__PURE__ */ React8.createElement(IconButton, { sx: { ml: "auto" }, size: SIZE, onClick: popupState.close }, /* @__PURE__ */ React8.createElement(XIcon, { fontSize: SIZE }))),
|
|
783
759
|
/* @__PURE__ */ React8.createElement(PopoverContent2, { closePopover: popupState.close })
|
|
784
760
|
));
|
|
785
761
|
}
|
|
@@ -793,9 +769,9 @@ var controlActionsMenu = createMenu({
|
|
|
793
769
|
|
|
794
770
|
// src/components/editing-panel-error-fallback.tsx
|
|
795
771
|
import * as React9 from "react";
|
|
796
|
-
import { Alert, Box
|
|
772
|
+
import { Alert, Box } from "@elementor/ui";
|
|
797
773
|
function EditorPanelErrorFallback() {
|
|
798
|
-
return /* @__PURE__ */ React9.createElement(
|
|
774
|
+
return /* @__PURE__ */ React9.createElement(Box, { role: "alert", sx: { minHeight: "100%", p: 2 } }, /* @__PURE__ */ React9.createElement(Alert, { severity: "error", sx: { mb: 2, maxWidth: 400, textAlign: "center" } }, /* @__PURE__ */ React9.createElement("strong", null, "Something went wrong")));
|
|
799
775
|
}
|
|
800
776
|
|
|
801
777
|
// src/components/editing-panel-tabs.tsx
|
|
@@ -850,7 +826,7 @@ var Control = ({ props, type }) => {
|
|
|
850
826
|
|
|
851
827
|
// src/controls-registry/control-type-container.tsx
|
|
852
828
|
import * as React11 from "react";
|
|
853
|
-
import { Box as
|
|
829
|
+
import { Box as Box2, styled as styled2 } from "@elementor/ui";
|
|
854
830
|
var ControlTypeContainer = ({
|
|
855
831
|
controlType,
|
|
856
832
|
children
|
|
@@ -858,7 +834,7 @@ var ControlTypeContainer = ({
|
|
|
858
834
|
const layout = getLayoutByType(controlType);
|
|
859
835
|
return /* @__PURE__ */ React11.createElement(StyledContainer, { layout }, children);
|
|
860
836
|
};
|
|
861
|
-
var StyledContainer =
|
|
837
|
+
var StyledContainer = styled2(Box2, {
|
|
862
838
|
shouldForwardProp: (prop) => !["layout"].includes(prop)
|
|
863
839
|
})(({ layout, theme }) => ({
|
|
864
840
|
display: "grid",
|
|
@@ -908,13 +884,13 @@ var SettingsField = ({ bind, children }) => {
|
|
|
908
884
|
|
|
909
885
|
// src/components/section.tsx
|
|
910
886
|
import * as React13 from "react";
|
|
911
|
-
import { useId as
|
|
887
|
+
import { useId as useId2, useState as useState3 } from "react";
|
|
912
888
|
import { Collapse, Divider as Divider2, ListItemButton, ListItemText, Stack as Stack5 } from "@elementor/ui";
|
|
913
889
|
|
|
914
890
|
// src/components/collapse-icon.tsx
|
|
915
891
|
import { ChevronDownIcon } from "@elementor/icons";
|
|
916
|
-
import { styled as
|
|
917
|
-
var CollapseIcon =
|
|
892
|
+
import { styled as styled3 } from "@elementor/ui";
|
|
893
|
+
var CollapseIcon = styled3(ChevronDownIcon, {
|
|
918
894
|
shouldForwardProp: (prop) => prop !== "open"
|
|
919
895
|
})(({ theme, open }) => ({
|
|
920
896
|
transform: open ? "rotate(180deg)" : "rotate(0deg)",
|
|
@@ -926,7 +902,7 @@ var CollapseIcon = styled4(ChevronDownIcon, {
|
|
|
926
902
|
// src/components/section.tsx
|
|
927
903
|
function Section({ title, children, defaultExpanded = false }) {
|
|
928
904
|
const [isOpen, setIsOpen] = useState3(!!defaultExpanded);
|
|
929
|
-
const id =
|
|
905
|
+
const id = useId2();
|
|
930
906
|
const labelId = `label-${id}`;
|
|
931
907
|
const contentId = `content-${id}`;
|
|
932
908
|
return /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(
|
|
@@ -982,8 +958,7 @@ var Control2 = ({ control }) => {
|
|
|
982
958
|
|
|
983
959
|
// src/components/style-tab.tsx
|
|
984
960
|
import * as React65 from "react";
|
|
985
|
-
import { useState as
|
|
986
|
-
import { getElementStyles, useElementSetting as useElementSetting5 } from "@elementor/editor-elements";
|
|
961
|
+
import { useState as useState8 } from "react";
|
|
987
962
|
import { CLASSES_PROP_KEY } from "@elementor/editor-props";
|
|
988
963
|
import { useActiveBreakpoint } from "@elementor/editor-responsive";
|
|
989
964
|
import { SessionStorageProvider as SessionStorageProvider2 } from "@elementor/session";
|
|
@@ -1006,6 +981,9 @@ var useStylesRerender = () => {
|
|
|
1006
981
|
useEffect(() => provider?.subscribe(reRender), [provider]);
|
|
1007
982
|
};
|
|
1008
983
|
|
|
984
|
+
// src/styles-inheritance/create-snapshots-manager.ts
|
|
985
|
+
import { filterEmptyValues } from "@elementor/editor-props";
|
|
986
|
+
|
|
1009
987
|
// src/styles-inheritance/utils.ts
|
|
1010
988
|
var DEFAULT_STATE = "normal";
|
|
1011
989
|
var DEFAULT_BREAKPOINT = "desktop";
|
|
@@ -1096,12 +1074,16 @@ function buildInitialSnapshotFromStyles(styles) {
|
|
|
1096
1074
|
variant: { props }
|
|
1097
1075
|
} = styleData;
|
|
1098
1076
|
Object.entries(props).forEach(([key, value]) => {
|
|
1077
|
+
const filteredValue = filterEmptyValues(value);
|
|
1078
|
+
if (filteredValue === null) {
|
|
1079
|
+
return;
|
|
1080
|
+
}
|
|
1099
1081
|
if (!snapshot[key]) {
|
|
1100
1082
|
snapshot[key] = [];
|
|
1101
1083
|
}
|
|
1102
1084
|
const snapshotPropValue = {
|
|
1103
1085
|
...styleData,
|
|
1104
|
-
value
|
|
1086
|
+
value: filteredValue
|
|
1105
1087
|
};
|
|
1106
1088
|
snapshot[key].push(snapshotPropValue);
|
|
1107
1089
|
});
|
|
@@ -1133,7 +1115,7 @@ function createStylesInheritance(styleDefs, breakpointsRoot) {
|
|
|
1133
1115
|
function buildStyleVariantsByMetaMapping(styleDefs) {
|
|
1134
1116
|
const breakpointStateSlots = {};
|
|
1135
1117
|
styleDefs.forEach((styleDef) => {
|
|
1136
|
-
const provider = getProviderByStyleId(styleDef.id)?.
|
|
1118
|
+
const provider = getProviderByStyleId(styleDef.id)?.getKey() ?? null;
|
|
1137
1119
|
styleDef.variants.forEach((variant) => {
|
|
1138
1120
|
const { meta } = variant;
|
|
1139
1121
|
const { state, breakpoint } = meta;
|
|
@@ -1198,6 +1180,30 @@ var useBaseStyles = () => {
|
|
|
1198
1180
|
return Object.values(widgetCache?.base_styles ?? {});
|
|
1199
1181
|
};
|
|
1200
1182
|
|
|
1183
|
+
// src/hooks/use-active-style-def-id.ts
|
|
1184
|
+
import { useState as useState4 } from "react";
|
|
1185
|
+
import { getElementStyles, useElementSetting as useElementSetting5 } from "@elementor/editor-elements";
|
|
1186
|
+
function useActiveStyleDefId(classProp) {
|
|
1187
|
+
const [activeStyledDefId, setActiveStyledDefId] = useState4(null);
|
|
1188
|
+
const appliedClassesIds = useAppliedClassesIds2(classProp)?.value || [];
|
|
1189
|
+
const fallback = useFirstAppliedClass(appliedClassesIds);
|
|
1190
|
+
const activeAndAppliedClassId = useActiveAndAppliedClassId(activeStyledDefId, appliedClassesIds);
|
|
1191
|
+
return [activeAndAppliedClassId || fallback?.id || null, setActiveStyledDefId];
|
|
1192
|
+
}
|
|
1193
|
+
function useFirstAppliedClass(appliedClassesIds) {
|
|
1194
|
+
const { element } = useElement();
|
|
1195
|
+
const stylesDefs = getElementStyles(element.id) ?? {};
|
|
1196
|
+
return Object.values(stylesDefs).find((styleDef) => appliedClassesIds.includes(styleDef.id));
|
|
1197
|
+
}
|
|
1198
|
+
function useAppliedClassesIds2(classProp) {
|
|
1199
|
+
const { element } = useElement();
|
|
1200
|
+
return useElementSetting5(element.id, classProp);
|
|
1201
|
+
}
|
|
1202
|
+
function useActiveAndAppliedClassId(id, appliedClassesIds) {
|
|
1203
|
+
const isClassApplied = !!id && appliedClassesIds.includes(id);
|
|
1204
|
+
return isClassApplied ? id : null;
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1201
1207
|
// src/components/style-sections/background-section/background-section.tsx
|
|
1202
1208
|
import * as React19 from "react";
|
|
1203
1209
|
import { BackgroundControl } from "@elementor/editor-controls";
|
|
@@ -1215,7 +1221,7 @@ import {
|
|
|
1215
1221
|
getElementLabel
|
|
1216
1222
|
} from "@elementor/editor-elements";
|
|
1217
1223
|
import { getVariantByMeta } from "@elementor/editor-styles";
|
|
1218
|
-
import {
|
|
1224
|
+
import { ELEMENTS_STYLES_RESERVED_LABEL } from "@elementor/editor-styles-repository";
|
|
1219
1225
|
import { undoable } from "@elementor/editor-v1-adapters";
|
|
1220
1226
|
import { __ as __4 } from "@wordpress/i18n";
|
|
1221
1227
|
function useStylesFields(propNames) {
|
|
@@ -1256,9 +1262,9 @@ function getProps({ styleId, elementId, provider, meta, propNames }) {
|
|
|
1256
1262
|
if (!provider || !styleId) {
|
|
1257
1263
|
return null;
|
|
1258
1264
|
}
|
|
1259
|
-
const style = provider.actions.
|
|
1265
|
+
const style = provider.actions.get(styleId, { elementId });
|
|
1260
1266
|
if (!style) {
|
|
1261
|
-
throw new StyleNotFoundUnderProviderError({ context: { styleId, providerKey: provider.
|
|
1267
|
+
throw new StyleNotFoundUnderProviderError({ context: { styleId, providerKey: provider.getKey() } });
|
|
1262
1268
|
}
|
|
1263
1269
|
const variant = getVariantByMeta(style, meta);
|
|
1264
1270
|
return Object.fromEntries(
|
|
@@ -1272,7 +1278,7 @@ function useUndoableCreateElementStyle() {
|
|
|
1272
1278
|
do: (payload) => {
|
|
1273
1279
|
return createElementStyle({
|
|
1274
1280
|
...payload,
|
|
1275
|
-
label:
|
|
1281
|
+
label: ELEMENTS_STYLES_RESERVED_LABEL
|
|
1276
1282
|
});
|
|
1277
1283
|
},
|
|
1278
1284
|
undo: ({ elementId }, styleId) => {
|
|
@@ -1282,7 +1288,7 @@ function useUndoableCreateElementStyle() {
|
|
|
1282
1288
|
return createElementStyle({
|
|
1283
1289
|
...payload,
|
|
1284
1290
|
styleId,
|
|
1285
|
-
label:
|
|
1291
|
+
label: ELEMENTS_STYLES_RESERVED_LABEL
|
|
1286
1292
|
});
|
|
1287
1293
|
}
|
|
1288
1294
|
},
|
|
@@ -1300,10 +1306,10 @@ function useUndoableUpdateStyle() {
|
|
|
1300
1306
|
do: ({ elementId, styleId, provider, meta, props }) => {
|
|
1301
1307
|
if (!provider.actions.updateProps) {
|
|
1302
1308
|
throw new StylesProviderCannotUpdatePropsError({
|
|
1303
|
-
context: { providerKey: provider.
|
|
1309
|
+
context: { providerKey: provider.getKey() }
|
|
1304
1310
|
});
|
|
1305
1311
|
}
|
|
1306
|
-
const style = provider.actions.
|
|
1312
|
+
const style = provider.actions.get(styleId, { elementId });
|
|
1307
1313
|
const prevProps = getCurrentProps(style, meta);
|
|
1308
1314
|
provider.actions.updateProps(
|
|
1309
1315
|
{
|
|
@@ -1350,7 +1356,7 @@ function useStylesField(propName) {
|
|
|
1350
1356
|
// src/styles-inheritance/styles-inheritance-indicator.tsx
|
|
1351
1357
|
import * as React17 from "react";
|
|
1352
1358
|
import { useBoundProp } from "@elementor/editor-controls";
|
|
1353
|
-
import { ELEMENTS_BASE_STYLES_PROVIDER_KEY,
|
|
1359
|
+
import { ELEMENTS_BASE_STYLES_PROVIDER_KEY, isElementsStylesProvider as isElementsStylesProvider3 } from "@elementor/editor-styles-repository";
|
|
1354
1360
|
import { __ as __5 } from "@wordpress/i18n";
|
|
1355
1361
|
var StylesInheritanceIndicator = () => {
|
|
1356
1362
|
const { value, path } = useBoundProp();
|
|
@@ -1370,7 +1376,7 @@ var StylesInheritanceIndicator = () => {
|
|
|
1370
1376
|
StyleIndicator,
|
|
1371
1377
|
{
|
|
1372
1378
|
"aria-label": __5("This is the final value", "elementor"),
|
|
1373
|
-
variant: currentStyleProvider?.
|
|
1379
|
+
variant: isElementsStylesProvider3(currentStyleProvider?.getKey()) ? "local" : "global"
|
|
1374
1380
|
}
|
|
1375
1381
|
);
|
|
1376
1382
|
}
|
|
@@ -1387,11 +1393,12 @@ var StylesInheritanceIndicator = () => {
|
|
|
1387
1393
|
};
|
|
1388
1394
|
|
|
1389
1395
|
// src/controls-registry/styles-field.tsx
|
|
1390
|
-
var StylesField = ({ bind, children }) => {
|
|
1396
|
+
var StylesField = ({ bind, placeholder, children }) => {
|
|
1391
1397
|
const [value, setValue] = useStylesField(bind);
|
|
1392
1398
|
const stylesSchema = getStylesSchema();
|
|
1393
1399
|
const propType = createTopLevelOjectType({ schema: stylesSchema });
|
|
1394
1400
|
const values = { [bind]: value };
|
|
1401
|
+
const placeholderValues = { [bind]: placeholder };
|
|
1395
1402
|
const setValues = (newValue) => {
|
|
1396
1403
|
setValue(newValue[bind]);
|
|
1397
1404
|
};
|
|
@@ -1405,7 +1412,16 @@ var StylesField = ({ bind, children }) => {
|
|
|
1405
1412
|
}
|
|
1406
1413
|
]
|
|
1407
1414
|
},
|
|
1408
|
-
/* @__PURE__ */ React18.createElement(
|
|
1415
|
+
/* @__PURE__ */ React18.createElement(
|
|
1416
|
+
PropProvider2,
|
|
1417
|
+
{
|
|
1418
|
+
propType,
|
|
1419
|
+
value: values,
|
|
1420
|
+
setValue: setValues,
|
|
1421
|
+
placeholder: placeholderValues
|
|
1422
|
+
},
|
|
1423
|
+
/* @__PURE__ */ React18.createElement(PropKeyProvider2, { bind }, children)
|
|
1424
|
+
)
|
|
1409
1425
|
);
|
|
1410
1426
|
};
|
|
1411
1427
|
|
|
@@ -1453,7 +1469,8 @@ var AddOrRemoveContent = ({ isAdded, label, onAdd, onRemove, children }) => {
|
|
|
1453
1469
|
direction: "row",
|
|
1454
1470
|
sx: {
|
|
1455
1471
|
justifyContent: "space-between",
|
|
1456
|
-
alignItems: "center"
|
|
1472
|
+
alignItems: "center",
|
|
1473
|
+
marginInlineEnd: -0.75
|
|
1457
1474
|
}
|
|
1458
1475
|
},
|
|
1459
1476
|
/* @__PURE__ */ React23.createElement(ControlLabel, null, label),
|
|
@@ -1885,35 +1902,37 @@ import * as React35 from "react";
|
|
|
1885
1902
|
import { ToggleControl as ToggleControl4 } from "@elementor/editor-controls";
|
|
1886
1903
|
import { Stack as Stack10 } from "@elementor/ui";
|
|
1887
1904
|
import { __ as __14 } from "@wordpress/i18n";
|
|
1905
|
+
var displayFieldOptions = [
|
|
1906
|
+
{
|
|
1907
|
+
value: "block",
|
|
1908
|
+
renderContent: () => __14("Block", "elementor"),
|
|
1909
|
+
label: __14("Block", "elementor"),
|
|
1910
|
+
showTooltip: true
|
|
1911
|
+
},
|
|
1912
|
+
{
|
|
1913
|
+
value: "flex",
|
|
1914
|
+
renderContent: () => __14("Flex", "elementor"),
|
|
1915
|
+
label: __14("Flex", "elementor"),
|
|
1916
|
+
showTooltip: true
|
|
1917
|
+
},
|
|
1918
|
+
{
|
|
1919
|
+
value: "inline-block",
|
|
1920
|
+
renderContent: () => __14("In-blk", "elementor"),
|
|
1921
|
+
label: __14("Inline-block", "elementor"),
|
|
1922
|
+
showTooltip: true
|
|
1923
|
+
},
|
|
1924
|
+
{
|
|
1925
|
+
value: "inline-flex",
|
|
1926
|
+
renderContent: () => __14("In-flx", "elementor"),
|
|
1927
|
+
label: __14("Inline-flex", "elementor"),
|
|
1928
|
+
showTooltip: true
|
|
1929
|
+
}
|
|
1930
|
+
];
|
|
1888
1931
|
var DisplayField = () => {
|
|
1889
|
-
const
|
|
1890
|
-
|
|
1891
|
-
value: "block",
|
|
1892
|
-
renderContent: () => __14("Block", "elementor"),
|
|
1893
|
-
label: __14("Block", "elementor"),
|
|
1894
|
-
showTooltip: true
|
|
1895
|
-
},
|
|
1896
|
-
{
|
|
1897
|
-
value: "flex",
|
|
1898
|
-
renderContent: () => __14("Flex", "elementor"),
|
|
1899
|
-
label: __14("Flex", "elementor"),
|
|
1900
|
-
showTooltip: true
|
|
1901
|
-
},
|
|
1902
|
-
{
|
|
1903
|
-
value: "inline-block",
|
|
1904
|
-
renderContent: () => __14("In-blk", "elementor"),
|
|
1905
|
-
label: __14("Inline-block", "elementor"),
|
|
1906
|
-
showTooltip: true
|
|
1907
|
-
},
|
|
1908
|
-
{
|
|
1909
|
-
value: "inline-flex",
|
|
1910
|
-
renderContent: () => __14("In-flx", "elementor"),
|
|
1911
|
-
label: __14("Inline-flex", "elementor"),
|
|
1912
|
-
showTooltip: true
|
|
1913
|
-
}
|
|
1914
|
-
];
|
|
1915
|
-
return /* @__PURE__ */ React35.createElement(StylesField, { bind: "display" }, /* @__PURE__ */ React35.createElement(Stack10, { gap: 0.75 }, /* @__PURE__ */ React35.createElement(ControlLabel, null, __14("Display", "elementor")), /* @__PURE__ */ React35.createElement(ToggleControl4, { options: options13, fullWidth: true })));
|
|
1932
|
+
const placeholder = useDisplayPlaceholderValue();
|
|
1933
|
+
return /* @__PURE__ */ React35.createElement(StylesField, { bind: "display", placeholder }, /* @__PURE__ */ React35.createElement(Stack10, { gap: 0.75 }, /* @__PURE__ */ React35.createElement(ControlLabel, null, __14("Display", "elementor")), /* @__PURE__ */ React35.createElement(ToggleControl4, { options: displayFieldOptions, fullWidth: true })));
|
|
1916
1934
|
};
|
|
1935
|
+
var useDisplayPlaceholderValue = () => useStylesInheritanceField("display")[0]?.value ?? void 0;
|
|
1917
1936
|
|
|
1918
1937
|
// src/components/style-sections/layout-section/flex-direction-field.tsx
|
|
1919
1938
|
import * as React36 from "react";
|
|
@@ -1960,7 +1979,7 @@ var FlexDirectionField = () => {
|
|
|
1960
1979
|
|
|
1961
1980
|
// src/components/style-sections/layout-section/flex-order-field.tsx
|
|
1962
1981
|
import * as React37 from "react";
|
|
1963
|
-
import { useState as
|
|
1982
|
+
import { useState as useState5 } from "react";
|
|
1964
1983
|
import { ControlToggleButtonGroup, NumberControl } from "@elementor/editor-controls";
|
|
1965
1984
|
import { ArrowDownSmallIcon as ArrowDownSmallIcon2, ArrowUpSmallIcon as ArrowUpSmallIcon2, PencilIcon } from "@elementor/icons";
|
|
1966
1985
|
import { DirectionProvider as DirectionProvider5, Grid as Grid6, ThemeProvider as ThemeProvider5 } from "@elementor/ui";
|
|
@@ -1996,7 +2015,7 @@ var items = [
|
|
|
1996
2015
|
];
|
|
1997
2016
|
var FlexOrderField = () => {
|
|
1998
2017
|
const { isSiteRtl } = useDirection(), [order, setOrder] = useStylesField("order");
|
|
1999
|
-
const [groupControlValue, setGroupControlValue] =
|
|
2018
|
+
const [groupControlValue, setGroupControlValue] = useState5(getGroupControlValue(order?.value || null));
|
|
2000
2019
|
const handleToggleButtonChange = (group) => {
|
|
2001
2020
|
setGroupControlValue(group);
|
|
2002
2021
|
if (!group || group === CUSTOM) {
|
|
@@ -2034,7 +2053,7 @@ var getGroupControlValue = (order) => {
|
|
|
2034
2053
|
|
|
2035
2054
|
// src/components/style-sections/layout-section/flex-size-field.tsx
|
|
2036
2055
|
import * as React38 from "react";
|
|
2037
|
-
import { useMemo as useMemo2, useState as
|
|
2056
|
+
import { useMemo as useMemo2, useState as useState6 } from "react";
|
|
2038
2057
|
import {
|
|
2039
2058
|
ControlToggleButtonGroup as ControlToggleButtonGroup2,
|
|
2040
2059
|
NumberControl as NumberControl2,
|
|
@@ -2071,7 +2090,7 @@ var FlexSizeField = () => {
|
|
|
2071
2090
|
const grow = fields?.["flex-grow"]?.value || null;
|
|
2072
2091
|
const shrink = fields?.["flex-shrink"]?.value || null;
|
|
2073
2092
|
const basis = fields?.["flex-basis"]?.value || null;
|
|
2074
|
-
const currentGroup = useMemo2(() => getActiveGroup({ grow, shrink, basis }), [grow, shrink, basis]), [activeGroup, setActiveGroup] =
|
|
2093
|
+
const currentGroup = useMemo2(() => getActiveGroup({ grow, shrink, basis }), [grow, shrink, basis]), [activeGroup, setActiveGroup] = useState6(currentGroup);
|
|
2075
2094
|
const onChangeGroup = (group = null) => {
|
|
2076
2095
|
setActiveGroup(group);
|
|
2077
2096
|
if (!group || group === "custom") {
|
|
@@ -2232,16 +2251,25 @@ var WrapField = () => {
|
|
|
2232
2251
|
// src/components/style-sections/layout-section/layout-section.tsx
|
|
2233
2252
|
var LayoutSection = () => {
|
|
2234
2253
|
const [display] = useStylesField("display");
|
|
2254
|
+
const displayPlaceholder = useDisplayPlaceholderValue();
|
|
2255
|
+
const isDisplayFlex = shouldDisplayFlexFields(display, displayPlaceholder);
|
|
2235
2256
|
const { element } = useElement();
|
|
2236
2257
|
const parent = useParentElement(element.id);
|
|
2237
2258
|
const parentStyle = useComputedStyle(parent?.id || null);
|
|
2238
|
-
return /* @__PURE__ */ React42.createElement(SectionContent, null, /* @__PURE__ */ React42.createElement(DisplayField, null),
|
|
2259
|
+
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));
|
|
2239
2260
|
};
|
|
2240
2261
|
var FlexFields = () => {
|
|
2241
2262
|
const [flexWrap] = useStylesField("flex-wrap");
|
|
2242
2263
|
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));
|
|
2243
2264
|
};
|
|
2244
2265
|
var FlexChildFields = () => /* @__PURE__ */ React42.createElement(React42.Fragment, null, /* @__PURE__ */ React42.createElement(PanelDivider, null), /* @__PURE__ */ React42.createElement(ControlFormLabel3, null, __21("Flex child", "elementor")), /* @__PURE__ */ React42.createElement(AlignSelfChild, null), /* @__PURE__ */ React42.createElement(FlexOrderField, null), /* @__PURE__ */ React42.createElement(FlexSizeField, null));
|
|
2266
|
+
var shouldDisplayFlexFields = (display, local) => {
|
|
2267
|
+
const value = display?.value ?? local?.value;
|
|
2268
|
+
if (!value) {
|
|
2269
|
+
return false;
|
|
2270
|
+
}
|
|
2271
|
+
return "flex" === value || "inline-flex" === value;
|
|
2272
|
+
};
|
|
2245
2273
|
|
|
2246
2274
|
// src/components/style-sections/position-section/position-section.tsx
|
|
2247
2275
|
import * as React46 from "react";
|
|
@@ -2413,11 +2441,11 @@ import * as React64 from "react";
|
|
|
2413
2441
|
|
|
2414
2442
|
// src/components/collapsible-content.tsx
|
|
2415
2443
|
import * as React50 from "react";
|
|
2416
|
-
import { useState as
|
|
2444
|
+
import { useState as useState7 } from "react";
|
|
2417
2445
|
import { Button, Collapse as Collapse3, Stack as Stack15 } from "@elementor/ui";
|
|
2418
2446
|
import { __ as __28 } from "@wordpress/i18n";
|
|
2419
2447
|
var CollapsibleContent = ({ children, defaultOpen = false }) => {
|
|
2420
|
-
const [open, setOpen] =
|
|
2448
|
+
const [open, setOpen] = useState7(defaultOpen);
|
|
2421
2449
|
const handleToggle = () => {
|
|
2422
2450
|
setOpen((prevOpen) => !prevOpen);
|
|
2423
2451
|
};
|
|
@@ -2764,7 +2792,7 @@ var TypographySection = () => {
|
|
|
2764
2792
|
var StyleTab = () => {
|
|
2765
2793
|
const currentClassesProp = useCurrentClassesProp();
|
|
2766
2794
|
const [activeStyleDefId, setActiveStyleDefId] = useActiveStyleDefId(currentClassesProp);
|
|
2767
|
-
const [activeStyleState, setActiveStyleState] =
|
|
2795
|
+
const [activeStyleState, setActiveStyleState] = useState8(null);
|
|
2768
2796
|
const breakpoint = useActiveBreakpoint();
|
|
2769
2797
|
return /* @__PURE__ */ React65.createElement(ClassesPropProvider, { prop: currentClassesProp }, /* @__PURE__ */ React65.createElement(
|
|
2770
2798
|
StyleProvider,
|
|
@@ -2780,17 +2808,6 @@ var StyleTab = () => {
|
|
|
2780
2808
|
/* @__PURE__ */ React65.createElement(SessionStorageProvider2, { prefix: activeStyleDefId ?? "" }, /* @__PURE__ */ React65.createElement(StyleInheritanceProvider, null, /* @__PURE__ */ React65.createElement(CssClassSelector, null), /* @__PURE__ */ React65.createElement(Divider4, null), /* @__PURE__ */ React65.createElement(SectionsList, null, /* @__PURE__ */ React65.createElement(Section, { title: __43("Layout", "elementor") }, /* @__PURE__ */ React65.createElement(LayoutSection, null)), /* @__PURE__ */ React65.createElement(Section, { title: __43("Spacing", "elementor") }, /* @__PURE__ */ React65.createElement(SpacingSection, null)), /* @__PURE__ */ React65.createElement(Section, { title: __43("Size", "elementor") }, /* @__PURE__ */ React65.createElement(SizeSection, null)), /* @__PURE__ */ React65.createElement(Section, { title: __43("Position", "elementor") }, /* @__PURE__ */ React65.createElement(PositionSection, null)), /* @__PURE__ */ React65.createElement(Section, { title: __43("Typography", "elementor") }, /* @__PURE__ */ React65.createElement(TypographySection, null)), /* @__PURE__ */ React65.createElement(Section, { title: __43("Background", "elementor") }, /* @__PURE__ */ React65.createElement(BackgroundSection, null)), /* @__PURE__ */ React65.createElement(Section, { title: __43("Border", "elementor") }, /* @__PURE__ */ React65.createElement(BorderSection, null)), /* @__PURE__ */ React65.createElement(Section, { title: __43("Effects", "elementor") }, /* @__PURE__ */ React65.createElement(EffectsSection, null)))))
|
|
2781
2809
|
));
|
|
2782
2810
|
};
|
|
2783
|
-
function useActiveStyleDefId(currentClassesProp) {
|
|
2784
|
-
const [activeStyledDefId, setActiveStyledDefId] = useState7(null);
|
|
2785
|
-
const fallback = useFirstElementStyleDef(currentClassesProp);
|
|
2786
|
-
return [activeStyledDefId || fallback?.id || null, setActiveStyledDefId];
|
|
2787
|
-
}
|
|
2788
|
-
function useFirstElementStyleDef(currentClassesProp) {
|
|
2789
|
-
const { element } = useElement();
|
|
2790
|
-
const classesIds = useElementSetting5(element.id, currentClassesProp)?.value || [];
|
|
2791
|
-
const stylesDefs = getElementStyles(element.id) ?? {};
|
|
2792
|
-
return Object.values(stylesDefs).find((styleDef) => classesIds.includes(styleDef.id));
|
|
2793
|
-
}
|
|
2794
2811
|
function useCurrentClassesProp() {
|
|
2795
2812
|
const { elementType } = useElement();
|
|
2796
2813
|
const prop = Object.entries(elementType.propsSchema).find(
|
|
@@ -2876,13 +2893,13 @@ import { settingsTransformersRegistry, styleTransformersRegistry } from "@elemen
|
|
|
2876
2893
|
|
|
2877
2894
|
// src/dynamics/components/dynamic-selection-control.tsx
|
|
2878
2895
|
import * as React71 from "react";
|
|
2879
|
-
import { useId as
|
|
2896
|
+
import { useId as useId3 } from "react";
|
|
2880
2897
|
import { ControlFormLabel as ControlFormLabel5, useBoundProp as useBoundProp5 } from "@elementor/editor-controls";
|
|
2881
2898
|
import { DatabaseIcon as DatabaseIcon2, SettingsIcon, XIcon as XIcon2 } from "@elementor/icons";
|
|
2882
2899
|
import {
|
|
2883
2900
|
bindPopover as bindPopover2,
|
|
2884
2901
|
bindTrigger as bindTrigger2,
|
|
2885
|
-
Box as
|
|
2902
|
+
Box as Box4,
|
|
2886
2903
|
Divider as Divider7,
|
|
2887
2904
|
Grid as Grid26,
|
|
2888
2905
|
IconButton as IconButton3,
|
|
@@ -2892,7 +2909,7 @@ import {
|
|
|
2892
2909
|
Tab as Tab2,
|
|
2893
2910
|
TabPanel as TabPanel2,
|
|
2894
2911
|
Tabs as Tabs2,
|
|
2895
|
-
Typography as
|
|
2912
|
+
Typography as Typography4,
|
|
2896
2913
|
UnstableTag as Tag,
|
|
2897
2914
|
usePopupState as usePopupState3,
|
|
2898
2915
|
useTabs as useTabs2
|
|
@@ -3020,11 +3037,11 @@ var DynamicControl = ({ bind, children }) => {
|
|
|
3020
3037
|
|
|
3021
3038
|
// src/dynamics/components/dynamic-selection.tsx
|
|
3022
3039
|
import * as React70 from "react";
|
|
3023
|
-
import { Fragment as Fragment9, useState as
|
|
3040
|
+
import { Fragment as Fragment9, useState as useState9 } from "react";
|
|
3024
3041
|
import { useBoundProp as useBoundProp4 } from "@elementor/editor-controls";
|
|
3025
3042
|
import { DatabaseIcon, SearchIcon } from "@elementor/icons";
|
|
3026
3043
|
import {
|
|
3027
|
-
Box as
|
|
3044
|
+
Box as Box3,
|
|
3028
3045
|
Divider as Divider6,
|
|
3029
3046
|
InputAdornment,
|
|
3030
3047
|
Link,
|
|
@@ -3033,12 +3050,12 @@ import {
|
|
|
3033
3050
|
MenuSubheader as MenuSubheader2,
|
|
3034
3051
|
Stack as Stack18,
|
|
3035
3052
|
TextField as TextField2,
|
|
3036
|
-
Typography as
|
|
3053
|
+
Typography as Typography3
|
|
3037
3054
|
} from "@elementor/ui";
|
|
3038
3055
|
import { __ as __46 } from "@wordpress/i18n";
|
|
3039
3056
|
var SIZE3 = "tiny";
|
|
3040
3057
|
var DynamicSelection = ({ onSelect }) => {
|
|
3041
|
-
const [searchValue, setSearchValue] =
|
|
3058
|
+
const [searchValue, setSearchValue] = useState9("");
|
|
3042
3059
|
const { groups: dynamicGroups } = getAtomicDynamicTags() || {};
|
|
3043
3060
|
const { value: anyValue } = useBoundProp4();
|
|
3044
3061
|
const { bind, value: dynamicValue, setValue } = useBoundProp4(dynamicPropTypeUtil);
|
|
@@ -3056,7 +3073,7 @@ var DynamicSelection = ({ onSelect }) => {
|
|
|
3056
3073
|
setValue({ name: value, settings: { label } });
|
|
3057
3074
|
onSelect?.();
|
|
3058
3075
|
};
|
|
3059
|
-
return /* @__PURE__ */ React70.createElement(Stack18, null, hasNoDynamicTags ? /* @__PURE__ */ React70.createElement(NoDynamicTags, null) : /* @__PURE__ */ React70.createElement(Fragment9, null, /* @__PURE__ */ React70.createElement(
|
|
3076
|
+
return /* @__PURE__ */ React70.createElement(Stack18, null, hasNoDynamicTags ? /* @__PURE__ */ React70.createElement(NoDynamicTags, null) : /* @__PURE__ */ React70.createElement(Fragment9, null, /* @__PURE__ */ React70.createElement(Box3, { px: 1.5, pb: 1 }, /* @__PURE__ */ React70.createElement(
|
|
3060
3077
|
TextField2,
|
|
3061
3078
|
{
|
|
3062
3079
|
fullWidth: true,
|
|
@@ -3068,7 +3085,7 @@ var DynamicSelection = ({ onSelect }) => {
|
|
|
3068
3085
|
startAdornment: /* @__PURE__ */ React70.createElement(InputAdornment, { position: "start" }, /* @__PURE__ */ React70.createElement(SearchIcon, { fontSize: SIZE3 }))
|
|
3069
3086
|
}
|
|
3070
3087
|
}
|
|
3071
|
-
)), /* @__PURE__ */ React70.createElement(Divider6, null), /* @__PURE__ */ React70.createElement(
|
|
3088
|
+
)), /* @__PURE__ */ React70.createElement(Divider6, null), /* @__PURE__ */ React70.createElement(Box3, { sx: { overflowY: "auto", height: 260, width: 220 } }, options13.length > 0 ? /* @__PURE__ */ React70.createElement(MenuList, { role: "listbox", tabIndex: 0 }, options13.map(([category, items3], index) => /* @__PURE__ */ React70.createElement(Fragment9, { key: index }, /* @__PURE__ */ React70.createElement(
|
|
3072
3089
|
MenuSubheader2,
|
|
3073
3090
|
{
|
|
3074
3091
|
sx: { px: 1.5, typography: "caption", color: "text.tertiary" }
|
|
@@ -3101,10 +3118,10 @@ var NoResults = ({ searchValue, onClear }) => /* @__PURE__ */ React70.createElem
|
|
|
3101
3118
|
sx: { pb: 3.5 }
|
|
3102
3119
|
},
|
|
3103
3120
|
/* @__PURE__ */ React70.createElement(DatabaseIcon, { fontSize: "large" }),
|
|
3104
|
-
/* @__PURE__ */ React70.createElement(
|
|
3105
|
-
/* @__PURE__ */ React70.createElement(
|
|
3121
|
+
/* @__PURE__ */ React70.createElement(Typography3, { align: "center", variant: "subtitle2" }, __46("Sorry, nothing matched", "elementor"), /* @__PURE__ */ React70.createElement("br", null), "\u201C", searchValue, "\u201D."),
|
|
3122
|
+
/* @__PURE__ */ React70.createElement(Typography3, { align: "center", variant: "caption" }, __46("Try something else.", "elementor"), "\xA0", /* @__PURE__ */ React70.createElement(Link, { color: "text.secondary", variant: "caption", component: "button", onClick: onClear }, __46("Clear & try again", "elementor")))
|
|
3106
3123
|
);
|
|
3107
|
-
var NoDynamicTags = () => /* @__PURE__ */ React70.createElement(
|
|
3124
|
+
var NoDynamicTags = () => /* @__PURE__ */ React70.createElement(Box3, { sx: { overflowY: "hidden", height: 297, width: 220 } }, /* @__PURE__ */ React70.createElement(Divider6, null), /* @__PURE__ */ React70.createElement(
|
|
3108
3125
|
Stack18,
|
|
3109
3126
|
{
|
|
3110
3127
|
gap: 1,
|
|
@@ -3116,8 +3133,8 @@ var NoDynamicTags = () => /* @__PURE__ */ React70.createElement(Box4, { sx: { ov
|
|
|
3116
3133
|
sx: { pb: 3.5 }
|
|
3117
3134
|
},
|
|
3118
3135
|
/* @__PURE__ */ React70.createElement(DatabaseIcon, { fontSize: "large" }),
|
|
3119
|
-
/* @__PURE__ */ React70.createElement(
|
|
3120
|
-
/* @__PURE__ */ React70.createElement(
|
|
3136
|
+
/* @__PURE__ */ React70.createElement(Typography3, { align: "center", variant: "subtitle2" }, __46("Streamline your workflow with dynamic tags", "elementor")),
|
|
3137
|
+
/* @__PURE__ */ React70.createElement(Typography3, { align: "center", variant: "caption" }, __46("You\u2019ll need Elementor Pro to use this feature.", "elementor"))
|
|
3121
3138
|
));
|
|
3122
3139
|
var useFilteredOptions = (searchValue) => {
|
|
3123
3140
|
const dynamicTags = usePropDynamicTags();
|
|
@@ -3142,7 +3159,7 @@ var DynamicSelectionControl = () => {
|
|
|
3142
3159
|
const { bind, value } = useBoundProp5(dynamicPropTypeUtil);
|
|
3143
3160
|
const [propValueFromHistory] = usePersistDynamicValue(bind);
|
|
3144
3161
|
const { name: tagName = "" } = value;
|
|
3145
|
-
const selectionPopoverId =
|
|
3162
|
+
const selectionPopoverId = useId3();
|
|
3146
3163
|
const selectionPopoverState = usePopupState3({ variant: "popover", popupId: selectionPopoverId });
|
|
3147
3164
|
const dynamicTag = useDynamicTag(tagName);
|
|
3148
3165
|
const removeDynamicTag = () => {
|
|
@@ -3151,7 +3168,7 @@ var DynamicSelectionControl = () => {
|
|
|
3151
3168
|
if (!dynamicTag) {
|
|
3152
3169
|
throw new Error(`Dynamic tag ${tagName} not found`);
|
|
3153
3170
|
}
|
|
3154
|
-
return /* @__PURE__ */ React71.createElement(
|
|
3171
|
+
return /* @__PURE__ */ React71.createElement(Box4, null, /* @__PURE__ */ React71.createElement(
|
|
3155
3172
|
Tag,
|
|
3156
3173
|
{
|
|
3157
3174
|
fullWidth: true,
|
|
@@ -3177,11 +3194,11 @@ var DynamicSelectionControl = () => {
|
|
|
3177
3194
|
anchorOrigin: { vertical: "bottom", horizontal: "left" },
|
|
3178
3195
|
...bindPopover2(selectionPopoverState)
|
|
3179
3196
|
},
|
|
3180
|
-
/* @__PURE__ */ React71.createElement(Stack19, null, /* @__PURE__ */ React71.createElement(Stack19, { direction: "row", alignItems: "center", pl: 1.5, pr: 0.5, py: 1.5 }, /* @__PURE__ */ React71.createElement(DatabaseIcon2, { fontSize: SIZE4, sx: { mr: 0.5 } }), /* @__PURE__ */ React71.createElement(
|
|
3197
|
+
/* @__PURE__ */ React71.createElement(Stack19, null, /* @__PURE__ */ React71.createElement(Stack19, { direction: "row", alignItems: "center", pl: 1.5, pr: 0.5, py: 1.5 }, /* @__PURE__ */ React71.createElement(DatabaseIcon2, { fontSize: SIZE4, sx: { mr: 0.5 } }), /* @__PURE__ */ React71.createElement(Typography4, { variant: "subtitle2" }, __47("Dynamic tags", "elementor")), /* @__PURE__ */ React71.createElement(IconButton3, { size: SIZE4, sx: { ml: "auto" }, onClick: selectionPopoverState.close }, /* @__PURE__ */ React71.createElement(XIcon2, { fontSize: SIZE4 }))), /* @__PURE__ */ React71.createElement(DynamicSelection, { onSelect: selectionPopoverState.close }))
|
|
3181
3198
|
));
|
|
3182
3199
|
};
|
|
3183
3200
|
var DynamicSettingsPopover = ({ dynamicTag }) => {
|
|
3184
|
-
const popupId =
|
|
3201
|
+
const popupId = useId3();
|
|
3185
3202
|
const settingsPopupState = usePopupState3({ variant: "popover", popupId });
|
|
3186
3203
|
const hasDynamicSettings = !!dynamicTag.atomic_controls.length;
|
|
3187
3204
|
if (!hasDynamicSettings) {
|
|
@@ -3202,7 +3219,7 @@ var DynamicSettingsPopover = ({ dynamicTag }) => {
|
|
|
3202
3219
|
anchorOrigin: { vertical: "bottom", horizontal: "center" },
|
|
3203
3220
|
...bindPopover2(settingsPopupState)
|
|
3204
3221
|
},
|
|
3205
|
-
/* @__PURE__ */ React71.createElement(Paper, { component: Stack19, sx: { minHeight: "300px", width: "220px" } }, /* @__PURE__ */ React71.createElement(Stack19, { direction: "row", alignItems: "center", px: 1.5, pt: 2, pb: 1 }, /* @__PURE__ */ React71.createElement(DatabaseIcon2, { fontSize: SIZE4, sx: { mr: 0.5 } }), /* @__PURE__ */ React71.createElement(
|
|
3222
|
+
/* @__PURE__ */ React71.createElement(Paper, { component: Stack19, sx: { minHeight: "300px", width: "220px" } }, /* @__PURE__ */ React71.createElement(Stack19, { direction: "row", alignItems: "center", px: 1.5, pt: 2, pb: 1 }, /* @__PURE__ */ React71.createElement(DatabaseIcon2, { fontSize: SIZE4, sx: { mr: 0.5 } }), /* @__PURE__ */ React71.createElement(Typography4, { variant: "subtitle2" }, dynamicTag.label), /* @__PURE__ */ React71.createElement(IconButton3, { sx: { ml: "auto" }, size: SIZE4, onClick: settingsPopupState.close }, /* @__PURE__ */ React71.createElement(XIcon2, { fontSize: SIZE4 }))), /* @__PURE__ */ React71.createElement(DynamicSettings, { controls: dynamicTag.atomic_controls }))
|
|
3206
3223
|
));
|
|
3207
3224
|
};
|
|
3208
3225
|
var DynamicSettings = ({ controls }) => {
|
|
@@ -3327,10 +3344,8 @@ var blockV1Panel = () => {
|
|
|
3327
3344
|
condition: isAtomicWidgetSelected
|
|
3328
3345
|
});
|
|
3329
3346
|
};
|
|
3330
|
-
|
|
3331
|
-
// src/index.ts
|
|
3332
|
-
init2();
|
|
3333
3347
|
export {
|
|
3348
|
+
init2 as init,
|
|
3334
3349
|
injectIntoClassSelectorActions,
|
|
3335
3350
|
replaceControl,
|
|
3336
3351
|
useBoundProp7 as useBoundProp,
|