@elementor/editor-editing-panel 0.17.0 → 0.19.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 +45 -0
- package/dist/index.d.mts +28 -10
- package/dist/index.d.ts +28 -10
- package/dist/index.js +941 -398
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +918 -366
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -7
- package/src/components/editing-panel-error-fallback.tsx +12 -0
- package/src/components/editing-panel.tsx +23 -12
- package/src/components/settings-tab.tsx +8 -5
- package/src/components/style-sections/background-section/background-color-control.tsx +20 -0
- package/src/components/style-sections/background-section/background-section.tsx +15 -0
- package/src/components/style-sections/effects-section/box-shadow-repeater.tsx +224 -0
- package/src/components/style-sections/effects-section/effects-section.tsx +18 -0
- package/src/components/style-sections/position-section/z-index-control.tsx +11 -7
- package/src/components/style-sections/size-section.tsx +23 -20
- package/src/components/style-sections/spacing-section/linked-dimensions-control.tsx +62 -47
- package/src/components/style-sections/typography-section/font-size-control.tsx +10 -6
- package/src/components/style-sections/typography-section/font-weight-control.tsx +16 -12
- package/src/components/style-sections/typography-section/letter-spacing-control.tsx +10 -6
- package/src/components/style-sections/typography-section/text-alignment-control.tsx +12 -8
- package/src/components/style-sections/typography-section/text-color-control.tsx +10 -6
- package/src/components/style-sections/typography-section/text-direction-control.tsx +37 -0
- package/src/components/style-sections/typography-section/text-style-control.tsx +37 -34
- package/src/components/style-sections/typography-section/transform-control.tsx +14 -12
- package/src/components/style-sections/typography-section/typography-section.tsx +2 -0
- package/src/components/style-sections/typography-section/word-spacing-control.tsx +10 -6
- package/src/components/style-tab.tsx +10 -4
- package/src/control-replacement.tsx +3 -0
- package/src/controls/components/control-type-container.tsx +28 -0
- package/src/controls/components/repeater.tsx +197 -0
- package/src/controls/components/text-field-inner-selection.tsx +2 -2
- package/src/controls/control-actions/actions/popover-action.tsx +58 -0
- package/src/controls/control-actions/control-actions-menu.ts +8 -0
- package/src/controls/control-actions/control-actions.tsx +43 -0
- package/src/controls/control-context.tsx +1 -1
- package/src/controls/control-replacement.ts +16 -8
- package/src/controls/control-types/color-control.tsx +21 -18
- package/src/controls/control-types/image-control.tsx +56 -59
- package/src/controls/control-types/image-media-control.tsx +73 -0
- package/src/controls/control-types/number-control.tsx +13 -9
- package/src/controls/control-types/select-control.tsx +14 -10
- package/src/controls/control-types/size-control.tsx +18 -14
- package/src/controls/control-types/text-area-control.tsx +15 -11
- package/src/controls/control-types/text-control.tsx +9 -3
- package/src/controls/control-types/toggle-control.tsx +4 -3
- package/src/controls/control.tsx +1 -7
- package/src/controls/controls-registry.tsx +19 -10
- package/src/controls/create-control-replacement.tsx +53 -0
- package/src/controls/create-control.tsx +40 -0
- package/src/controls/hooks/use-style-control.ts +3 -3
- package/src/{hooks → controls/hooks}/use-widget-settings.ts +1 -1
- package/src/{props → controls/props}/is-transformable.ts +1 -2
- package/src/controls/props/types.ts +51 -0
- package/src/{contexts/element-context.tsx → controls/providers/element-provider.tsx} +4 -4
- package/src/controls/settings-control.tsx +7 -14
- package/src/controls/style-control.tsx +1 -1
- package/src/{sync → controls/sync}/get-container.ts +1 -1
- package/src/{sync → controls/sync}/update-settings.ts +1 -1
- package/src/controls/types.ts +39 -0
- package/src/dynamics/components/dynamic-selection-control.tsx +2 -2
- package/src/dynamics/components/dynamic-selection.tsx +6 -6
- package/src/dynamics/dynamic-control.tsx +2 -2
- package/src/dynamics/hooks/use-dynamic-tag.ts +2 -2
- package/src/dynamics/hooks/use-prop-dynamic-action.tsx +23 -0
- package/src/dynamics/hooks/use-prop-dynamic-tags.ts +7 -7
- package/src/dynamics/hooks/use-prop-value-history.ts +3 -3
- package/src/dynamics/init.ts +10 -1
- package/src/dynamics/types.ts +7 -3
- package/src/dynamics/utils.ts +17 -4
- package/src/hooks/use-element-style-prop.ts +3 -2
- package/src/hooks/use-element-styles.ts +1 -1
- package/src/hooks/use-element-type.ts +1 -1
- package/src/index.ts +3 -1
- package/src/sync/get-element-styles.ts +2 -2
- package/src/sync/get-selected-elements.ts +1 -1
- package/src/sync/types.ts +2 -1
- package/src/sync/update-style.ts +3 -2
- package/src/controls/components/control-container.tsx +0 -18
- package/src/types.ts +0 -68
package/dist/index.mjs
CHANGED
|
@@ -1,16 +1,6 @@
|
|
|
1
|
-
// src/controls/control-replacement.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
controlReplacement = { component, condition };
|
|
5
|
-
};
|
|
6
|
-
var getControlReplacement = ({ value }) => {
|
|
7
|
-
let shouldReplace = false;
|
|
8
|
-
try {
|
|
9
|
-
shouldReplace = !!controlReplacement?.condition({ value });
|
|
10
|
-
} catch {
|
|
11
|
-
}
|
|
12
|
-
return shouldReplace ? controlReplacement?.component : void 0;
|
|
13
|
-
};
|
|
1
|
+
// src/controls/create-control-replacement.tsx
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
14
4
|
|
|
15
5
|
// src/controls/control-context.tsx
|
|
16
6
|
import { createContext, useContext } from "react";
|
|
@@ -23,12 +13,89 @@ function useControl(defaultValue) {
|
|
|
23
13
|
return { ...controlContext, value: controlContext.value ?? defaultValue };
|
|
24
14
|
}
|
|
25
15
|
|
|
16
|
+
// src/controls/create-control-replacement.tsx
|
|
17
|
+
var ControlReplacementContext = createContext2(void 0);
|
|
18
|
+
var ControlReplacementProvider = ({
|
|
19
|
+
component,
|
|
20
|
+
condition,
|
|
21
|
+
children
|
|
22
|
+
}) => {
|
|
23
|
+
return /* @__PURE__ */ React.createElement(ControlReplacementContext.Provider, { value: { component, condition } }, children);
|
|
24
|
+
};
|
|
25
|
+
var useControlReplacement = () => {
|
|
26
|
+
const { value } = useControl();
|
|
27
|
+
const controlReplacement = useContext2(ControlReplacementContext);
|
|
28
|
+
let shouldReplace = false;
|
|
29
|
+
try {
|
|
30
|
+
shouldReplace = !!controlReplacement?.condition({ value }) && !!controlReplacement.component;
|
|
31
|
+
} catch {
|
|
32
|
+
}
|
|
33
|
+
return shouldReplace ? controlReplacement?.component : void 0;
|
|
34
|
+
};
|
|
35
|
+
var createControlReplacement = () => {
|
|
36
|
+
let controlReplacement;
|
|
37
|
+
function replaceControl2({ component, condition }) {
|
|
38
|
+
controlReplacement = { component, condition };
|
|
39
|
+
}
|
|
40
|
+
function getControlReplacement2() {
|
|
41
|
+
return controlReplacement;
|
|
42
|
+
}
|
|
43
|
+
return { replaceControl: replaceControl2, getControlReplacement: getControlReplacement2 };
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// src/control-replacement.tsx
|
|
47
|
+
var { replaceControl, getControlReplacement } = createControlReplacement();
|
|
48
|
+
|
|
49
|
+
// src/controls/control-actions/actions/popover-action.tsx
|
|
50
|
+
import * as React2 from "react";
|
|
51
|
+
import { bindPopover, bindToggle, IconButton, Popover, Stack, Tooltip, Typography, usePopupState } from "@elementor/ui";
|
|
52
|
+
import { useId } from "react";
|
|
53
|
+
import { XIcon } from "@elementor/icons";
|
|
54
|
+
var SIZE = "tiny";
|
|
55
|
+
function PopoverAction({
|
|
56
|
+
title,
|
|
57
|
+
visible = true,
|
|
58
|
+
icon: Icon,
|
|
59
|
+
popoverContent: PopoverContent
|
|
60
|
+
}) {
|
|
61
|
+
const id = useId();
|
|
62
|
+
const popupState = usePopupState({
|
|
63
|
+
variant: "popover",
|
|
64
|
+
popupId: `elementor-popover-action-${id}`
|
|
65
|
+
});
|
|
66
|
+
if (!visible) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(Tooltip, { placement: "top", title }, /* @__PURE__ */ React2.createElement(IconButton, { "aria-label": title, key: id, size: SIZE, ...bindToggle(popupState) }, /* @__PURE__ */ React2.createElement(Icon, { fontSize: SIZE }))), /* @__PURE__ */ React2.createElement(
|
|
70
|
+
Popover,
|
|
71
|
+
{
|
|
72
|
+
disablePortal: true,
|
|
73
|
+
disableScrollLock: true,
|
|
74
|
+
anchorOrigin: {
|
|
75
|
+
vertical: "bottom",
|
|
76
|
+
horizontal: "center"
|
|
77
|
+
},
|
|
78
|
+
...bindPopover(popupState)
|
|
79
|
+
},
|
|
80
|
+
/* @__PURE__ */ React2.createElement(Stack, { direction: "row", alignItems: "center", pl: 1.5, pr: 0.5, py: 1.5 }, /* @__PURE__ */ React2.createElement(Icon, { fontSize: SIZE, sx: { mr: 0.5 } }), /* @__PURE__ */ React2.createElement(Typography, { variant: "subtitle2" }, title), /* @__PURE__ */ React2.createElement(IconButton, { sx: { ml: "auto" }, size: SIZE, onClick: popupState.close }, /* @__PURE__ */ React2.createElement(XIcon, { fontSize: SIZE }))),
|
|
81
|
+
/* @__PURE__ */ React2.createElement(PopoverContent, { closePopover: popupState.close })
|
|
82
|
+
));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// src/controls/control-actions/control-actions-menu.ts
|
|
86
|
+
import { createMenu } from "@elementor/menus";
|
|
87
|
+
var controlActionsMenu = createMenu({
|
|
88
|
+
components: {
|
|
89
|
+
PopoverAction
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
|
|
26
93
|
// src/panel.ts
|
|
27
94
|
import { __createPanel as createPanel } from "@elementor/editor-panels";
|
|
28
95
|
|
|
29
96
|
// src/components/editing-panel.tsx
|
|
30
|
-
import * as
|
|
31
|
-
import { __ as
|
|
97
|
+
import * as React49 from "react";
|
|
98
|
+
import { __ as __25 } from "@wordpress/i18n";
|
|
32
99
|
|
|
33
100
|
// src/hooks/use-selected-elements.ts
|
|
34
101
|
import { __privateUseListenTo as useListenTo, commandEndEvent } from "@elementor/editor-v1-adapters";
|
|
@@ -57,6 +124,24 @@ function useSelectedElements() {
|
|
|
57
124
|
);
|
|
58
125
|
}
|
|
59
126
|
|
|
127
|
+
// src/components/editing-panel.tsx
|
|
128
|
+
import { Panel, PanelBody, PanelHeader, PanelHeaderTitle } from "@elementor/editor-panels";
|
|
129
|
+
|
|
130
|
+
// src/controls/providers/element-provider.tsx
|
|
131
|
+
import * as React3 from "react";
|
|
132
|
+
import { createContext as createContext3, useContext as useContext3 } from "react";
|
|
133
|
+
var Context = createContext3(null);
|
|
134
|
+
function ElementProvider({ children, element, elementType }) {
|
|
135
|
+
return /* @__PURE__ */ React3.createElement(Context.Provider, { value: { element, elementType } }, children);
|
|
136
|
+
}
|
|
137
|
+
function useElement() {
|
|
138
|
+
const context = useContext3(Context);
|
|
139
|
+
if (!context) {
|
|
140
|
+
throw new Error("useElement must be used within a ElementProvider");
|
|
141
|
+
}
|
|
142
|
+
return context;
|
|
143
|
+
}
|
|
144
|
+
|
|
60
145
|
// src/hooks/use-element-type.ts
|
|
61
146
|
import { __privateUseListenTo as useListenTo2, commandEndEvent as commandEndEvent2 } from "@elementor/editor-v1-adapters";
|
|
62
147
|
|
|
@@ -93,47 +178,29 @@ function useElementType(type) {
|
|
|
93
178
|
);
|
|
94
179
|
}
|
|
95
180
|
|
|
96
|
-
// src/components/editing-panel.tsx
|
|
97
|
-
import { Panel, PanelBody, PanelHeader, PanelHeaderTitle } from "@elementor/editor-panels";
|
|
98
|
-
|
|
99
|
-
// src/contexts/element-context.tsx
|
|
100
|
-
import * as React from "react";
|
|
101
|
-
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
102
|
-
var Context = createContext2(null);
|
|
103
|
-
function ElementContext({ children, element, elementType }) {
|
|
104
|
-
return /* @__PURE__ */ React.createElement(Context.Provider, { value: { element, elementType } }, children);
|
|
105
|
-
}
|
|
106
|
-
function useElementContext() {
|
|
107
|
-
const context = useContext2(Context);
|
|
108
|
-
if (!context) {
|
|
109
|
-
throw new Error("useElementContext must be used within a ElementContextProvider");
|
|
110
|
-
}
|
|
111
|
-
return context;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
181
|
// src/components/editing-panel-tabs.tsx
|
|
115
|
-
import { Stack as
|
|
116
|
-
import * as
|
|
117
|
-
import { __ as
|
|
182
|
+
import { Stack as Stack17, Tabs, Tab, TabPanel, useTabs } from "@elementor/ui";
|
|
183
|
+
import * as React47 from "react";
|
|
184
|
+
import { __ as __24 } from "@wordpress/i18n";
|
|
118
185
|
|
|
119
186
|
// src/components/settings-tab.tsx
|
|
120
|
-
import * as
|
|
121
|
-
import { Stack as
|
|
187
|
+
import * as React18 from "react";
|
|
188
|
+
import { Stack as Stack5 } from "@elementor/ui";
|
|
122
189
|
|
|
123
190
|
// src/controls/settings-control.tsx
|
|
124
|
-
import * as
|
|
191
|
+
import * as React5 from "react";
|
|
125
192
|
|
|
126
|
-
// src/hooks/use-widget-settings.ts
|
|
193
|
+
// src/controls/hooks/use-widget-settings.ts
|
|
127
194
|
import { commandEndEvent as commandEndEvent3, __privateUseListenTo as useListenTo3 } from "@elementor/editor-v1-adapters";
|
|
128
195
|
|
|
129
|
-
// src/sync/get-container.ts
|
|
196
|
+
// src/controls/sync/get-container.ts
|
|
130
197
|
function getContainer(id) {
|
|
131
198
|
const extendedWindow = window;
|
|
132
199
|
const container = extendedWindow.elementor?.getContainer?.(id);
|
|
133
200
|
return container ?? null;
|
|
134
201
|
}
|
|
135
202
|
|
|
136
|
-
// src/hooks/use-widget-settings.ts
|
|
203
|
+
// src/controls/hooks/use-widget-settings.ts
|
|
137
204
|
var useWidgetSettings = ({ id, bind }) => {
|
|
138
205
|
return useListenTo3(
|
|
139
206
|
commandEndEvent3("document/elements/settings"),
|
|
@@ -146,7 +213,7 @@ var useWidgetSettings = ({ id, bind }) => {
|
|
|
146
213
|
);
|
|
147
214
|
};
|
|
148
215
|
|
|
149
|
-
// src/sync/update-settings.ts
|
|
216
|
+
// src/controls/sync/update-settings.ts
|
|
150
217
|
import { __privateRunCommand as runCommand } from "@elementor/editor-v1-adapters";
|
|
151
218
|
var updateSettings = ({ id, props }) => {
|
|
152
219
|
const container = getContainer(id);
|
|
@@ -159,32 +226,16 @@ var updateSettings = ({ id, props }) => {
|
|
|
159
226
|
};
|
|
160
227
|
|
|
161
228
|
// src/components/control-label.tsx
|
|
162
|
-
import * as
|
|
163
|
-
import { Typography } from "@elementor/ui";
|
|
229
|
+
import * as React4 from "react";
|
|
230
|
+
import { Typography as Typography2 } from "@elementor/ui";
|
|
164
231
|
var ControlLabel = ({ children }) => {
|
|
165
|
-
return /* @__PURE__ */
|
|
232
|
+
return /* @__PURE__ */ React4.createElement(Typography2, { component: "label", variant: "caption", color: "text.secondary" }, children);
|
|
166
233
|
};
|
|
167
234
|
|
|
168
|
-
// src/controls/components/control-container.tsx
|
|
169
|
-
import * as React3 from "react";
|
|
170
|
-
import { Stack, styled } from "@elementor/ui";
|
|
171
|
-
var StyledStack = styled(Stack)(({ theme, gap, direction }) => ({
|
|
172
|
-
"> :only-child": {
|
|
173
|
-
width: "100%"
|
|
174
|
-
},
|
|
175
|
-
"&:where( :has( > :nth-child( 2 ):last-child ) ) > :where( * )": {
|
|
176
|
-
width: direction === "column" ? "100%" : `calc( 50% - ${theme.spacing(gap / 2)})`
|
|
177
|
-
},
|
|
178
|
-
"&:where( :has( > :nth-child( 3 ):last-child ) ) > :where( * )": {
|
|
179
|
-
width: direction === "column" ? "100%" : `calc( 33.3333% - ${theme.spacing(gap * 2)} / 3)`
|
|
180
|
-
}
|
|
181
|
-
}));
|
|
182
|
-
var ControlContainer = (props) => /* @__PURE__ */ React3.createElement(StyledStack, { gap: 1, direction: "row", alignItems: "center", justifyContent: "space-between", ...props });
|
|
183
|
-
|
|
184
235
|
// src/controls/settings-control.tsx
|
|
185
|
-
var
|
|
186
|
-
const { element, elementType } =
|
|
187
|
-
const defaultValue = elementType.propsSchema[bind]?.
|
|
236
|
+
var SettingsControl = ({ bind, children }) => {
|
|
237
|
+
const { element, elementType } = useElement();
|
|
238
|
+
const defaultValue = elementType.propsSchema[bind]?.default;
|
|
188
239
|
const settingsValue = useWidgetSettings({ id: element.id, bind });
|
|
189
240
|
const value = settingsValue ?? defaultValue ?? null;
|
|
190
241
|
const setValue = (newValue) => {
|
|
@@ -195,93 +246,180 @@ var SettingsControlProvider = ({ bind, children }) => {
|
|
|
195
246
|
}
|
|
196
247
|
});
|
|
197
248
|
};
|
|
198
|
-
return /* @__PURE__ */
|
|
249
|
+
return /* @__PURE__ */ React5.createElement(ControlContext.Provider, { value: { setValue, value, bind } }, children);
|
|
199
250
|
};
|
|
200
|
-
var SettingsControl = ({ children, bind }) => /* @__PURE__ */ React4.createElement(SettingsControlProvider, { bind }, /* @__PURE__ */ React4.createElement(ControlContainer, { flexWrap: "wrap" }, children));
|
|
201
251
|
SettingsControl.Label = ControlLabel;
|
|
202
252
|
|
|
203
253
|
// src/components/accordion-section.tsx
|
|
204
|
-
import * as
|
|
205
|
-
import { useId } from "react";
|
|
254
|
+
import * as React6 from "react";
|
|
255
|
+
import { useId as useId2 } from "react";
|
|
206
256
|
import { Accordion, AccordionSummary, AccordionDetails, AccordionSummaryText, Stack as Stack2 } from "@elementor/ui";
|
|
207
257
|
var AccordionSection = ({ title, children }) => {
|
|
208
|
-
const uid =
|
|
258
|
+
const uid = useId2();
|
|
209
259
|
const labelId = `label-${uid}`;
|
|
210
260
|
const contentId = `content-${uid}`;
|
|
211
|
-
return /* @__PURE__ */
|
|
261
|
+
return /* @__PURE__ */ React6.createElement(Accordion, { disableGutters: true, defaultExpanded: true }, /* @__PURE__ */ React6.createElement(AccordionSummary, { "aria-controls": contentId, id: labelId }, /* @__PURE__ */ React6.createElement(AccordionSummaryText, { primaryTypographyProps: { variant: "caption" } }, title)), /* @__PURE__ */ React6.createElement(AccordionDetails, { id: contentId, "aria-labelledby": labelId }, /* @__PURE__ */ React6.createElement(Stack2, { gap: 2.5 }, children)));
|
|
212
262
|
};
|
|
213
263
|
|
|
214
264
|
// src/controls/control.tsx
|
|
215
|
-
import * as
|
|
265
|
+
import * as React16 from "react";
|
|
216
266
|
import { createError } from "@elementor/utils";
|
|
217
267
|
|
|
218
268
|
// src/controls/control-types/image-control.tsx
|
|
219
|
-
import * as
|
|
220
|
-
import {
|
|
269
|
+
import * as React11 from "react";
|
|
270
|
+
import { Grid, Stack as Stack4 } from "@elementor/ui";
|
|
271
|
+
import { __ as __2 } from "@wordpress/i18n";
|
|
272
|
+
|
|
273
|
+
// src/controls/control-types/image-media-control.tsx
|
|
274
|
+
import * as React9 from "react";
|
|
275
|
+
import { Button, Card, CardMedia, CardOverlay, Stack as Stack3 } from "@elementor/ui";
|
|
221
276
|
import { UploadIcon } from "@elementor/icons";
|
|
222
|
-
import { __ } from "@wordpress/i18n";
|
|
223
277
|
import { useWpMediaAttachment, useWpMediaFrame } from "@elementor/wp-media";
|
|
224
|
-
|
|
278
|
+
import { __ } from "@wordpress/i18n";
|
|
279
|
+
|
|
280
|
+
// src/controls/control-actions/control-actions.tsx
|
|
281
|
+
import * as React7 from "react";
|
|
282
|
+
import { styled, UnstableFloatingActionBar } from "@elementor/ui";
|
|
283
|
+
var { useMenuItems } = controlActionsMenu;
|
|
284
|
+
var FloatingBar = styled(UnstableFloatingActionBar)`
|
|
285
|
+
& .MuiPaper-root:empty {
|
|
286
|
+
display: none;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
// this is for a fix which would be added later on - to force the width externally
|
|
290
|
+
width: 100%;
|
|
291
|
+
& > :first-of-type {
|
|
292
|
+
width: 100%;
|
|
293
|
+
}
|
|
294
|
+
`;
|
|
295
|
+
function ControlActions({ fullWidth = false, children }) {
|
|
296
|
+
const items = useMenuItems().default;
|
|
297
|
+
if (items.length === 0) {
|
|
298
|
+
return children;
|
|
299
|
+
}
|
|
300
|
+
return /* @__PURE__ */ React7.createElement(
|
|
301
|
+
FloatingBar,
|
|
302
|
+
{
|
|
303
|
+
actions: items.map(({ MenuItem: MenuItem4, id }) => /* @__PURE__ */ React7.createElement(MenuItem4, { key: id })),
|
|
304
|
+
sx: fullWidth ? { width: "100%" } : void 0
|
|
305
|
+
},
|
|
306
|
+
children
|
|
307
|
+
);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// src/controls/create-control.tsx
|
|
311
|
+
import * as React8 from "react";
|
|
312
|
+
import { ErrorBoundary } from "@elementor/ui";
|
|
313
|
+
var brandSymbol = Symbol("control");
|
|
314
|
+
function createControl(Component, { supportsReplacements = true } = {}) {
|
|
315
|
+
return (props) => {
|
|
316
|
+
const ControlReplacement = useControlReplacement();
|
|
317
|
+
if (ControlReplacement && supportsReplacements) {
|
|
318
|
+
return /* @__PURE__ */ React8.createElement(ErrorBoundary, { fallback: null }, /* @__PURE__ */ React8.createElement(ControlReplacement, { ...props }));
|
|
319
|
+
}
|
|
320
|
+
return /* @__PURE__ */ React8.createElement(ErrorBoundary, { fallback: null }, /* @__PURE__ */ React8.createElement(Component, { ...props }));
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
// src/controls/control-types/image-media-control.tsx
|
|
325
|
+
var ImageMediaControl = createControl(() => {
|
|
225
326
|
const { value, setValue } = useControl();
|
|
226
|
-
const {
|
|
227
|
-
const
|
|
327
|
+
const { id, url } = value?.value ?? {};
|
|
328
|
+
const { data: attachment } = useWpMediaAttachment(id?.value || null);
|
|
329
|
+
const src = attachment?.url ?? url;
|
|
228
330
|
const { open } = useWpMediaFrame({
|
|
229
331
|
types: ["image"],
|
|
230
332
|
multiple: false,
|
|
231
|
-
selected:
|
|
333
|
+
selected: id?.value || null,
|
|
232
334
|
onSelect: (selectedAttachment) => {
|
|
233
335
|
setValue({
|
|
234
|
-
$$type: "image",
|
|
336
|
+
$$type: "image-src",
|
|
235
337
|
value: {
|
|
236
|
-
|
|
338
|
+
id: {
|
|
339
|
+
$$type: "image-attachment-id",
|
|
340
|
+
value: selectedAttachment.id
|
|
341
|
+
},
|
|
342
|
+
url: null
|
|
237
343
|
}
|
|
238
344
|
});
|
|
239
345
|
}
|
|
240
346
|
});
|
|
241
|
-
return /* @__PURE__ */
|
|
347
|
+
return /* @__PURE__ */ React9.createElement(Card, { variant: "outlined" }, /* @__PURE__ */ React9.createElement(CardMedia, { image: src, sx: { height: 150 } }), /* @__PURE__ */ React9.createElement(CardOverlay, null, /* @__PURE__ */ React9.createElement(ControlActions, null, /* @__PURE__ */ React9.createElement(Stack3, { gap: 0.5 }, /* @__PURE__ */ React9.createElement(
|
|
242
348
|
Button,
|
|
243
349
|
{
|
|
350
|
+
size: "tiny",
|
|
244
351
|
color: "inherit",
|
|
245
|
-
size: "small",
|
|
246
352
|
variant: "outlined",
|
|
247
|
-
onClick: () => {
|
|
248
|
-
open({ mode: "browse" });
|
|
249
|
-
}
|
|
353
|
+
onClick: () => open({ mode: "browse" })
|
|
250
354
|
},
|
|
251
355
|
__("Select Image", "elementor")
|
|
252
|
-
), /* @__PURE__ */
|
|
356
|
+
), /* @__PURE__ */ React9.createElement(
|
|
253
357
|
Button,
|
|
254
358
|
{
|
|
255
|
-
|
|
256
|
-
size: "small",
|
|
359
|
+
size: "tiny",
|
|
257
360
|
variant: "text",
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
}
|
|
361
|
+
color: "inherit",
|
|
362
|
+
startIcon: /* @__PURE__ */ React9.createElement(UploadIcon, null),
|
|
363
|
+
onClick: () => open({ mode: "upload" })
|
|
262
364
|
},
|
|
263
365
|
__("Upload Image", "elementor")
|
|
264
|
-
)));
|
|
265
|
-
};
|
|
366
|
+
)))));
|
|
367
|
+
});
|
|
368
|
+
|
|
369
|
+
// src/controls/control-types/select-control.tsx
|
|
370
|
+
import * as React10 from "react";
|
|
371
|
+
import { MenuItem, Select } from "@elementor/ui";
|
|
372
|
+
var SelectControl = createControl(({ options: options4 }) => {
|
|
373
|
+
const { value, setValue } = useControl();
|
|
374
|
+
const handleChange = (event) => {
|
|
375
|
+
setValue(event.target.value);
|
|
376
|
+
};
|
|
377
|
+
return /* @__PURE__ */ React10.createElement(ControlActions, null, /* @__PURE__ */ React10.createElement(Select, { size: "tiny", value: value ?? "", onChange: handleChange }, options4.map(({ label, ...props }) => /* @__PURE__ */ React10.createElement(MenuItem, { key: props.value, ...props }, label))));
|
|
378
|
+
});
|
|
379
|
+
|
|
380
|
+
// src/controls/control-types/image-control.tsx
|
|
381
|
+
var ImageControl = createControl((props) => {
|
|
382
|
+
const { value, setValue } = useControl();
|
|
383
|
+
const { src, size } = value?.value || {};
|
|
384
|
+
const setImageSrc = (newValue) => {
|
|
385
|
+
setValue({
|
|
386
|
+
$$type: "image",
|
|
387
|
+
value: {
|
|
388
|
+
src: newValue,
|
|
389
|
+
size
|
|
390
|
+
}
|
|
391
|
+
});
|
|
392
|
+
};
|
|
393
|
+
const setImageSize = (newValue) => {
|
|
394
|
+
setValue({
|
|
395
|
+
$$type: "image",
|
|
396
|
+
value: {
|
|
397
|
+
src,
|
|
398
|
+
size: newValue
|
|
399
|
+
}
|
|
400
|
+
});
|
|
401
|
+
};
|
|
402
|
+
return /* @__PURE__ */ React11.createElement(Stack4, { gap: 2 }, /* @__PURE__ */ React11.createElement(ControlContext.Provider, { value: { setValue: setImageSrc, value: src, bind: "src" } }, /* @__PURE__ */ React11.createElement(ImageMediaControl, null)), /* @__PURE__ */ React11.createElement(ControlContext.Provider, { value: { setValue: setImageSize, value: size, bind: "size" } }, /* @__PURE__ */ React11.createElement(Grid, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React11.createElement(Grid, { item: true, xs: 6 }, /* @__PURE__ */ React11.createElement(SettingsControl.Label, null, " ", __2("Image Resolution", "elementor"))), /* @__PURE__ */ React11.createElement(Grid, { item: true, xs: 6 }, /* @__PURE__ */ React11.createElement(SelectControl, { options: props.sizes })))));
|
|
403
|
+
});
|
|
266
404
|
|
|
267
405
|
// src/controls/control-types/text-control.tsx
|
|
268
|
-
import * as
|
|
406
|
+
import * as React12 from "react";
|
|
269
407
|
import { TextField } from "@elementor/ui";
|
|
270
|
-
var TextControl = ({ placeholder }) => {
|
|
408
|
+
var TextControl = createControl(({ placeholder }) => {
|
|
271
409
|
const { value, setValue } = useControl("");
|
|
272
410
|
const handleChange = (event) => setValue(event.target.value);
|
|
273
|
-
return /* @__PURE__ */
|
|
274
|
-
};
|
|
411
|
+
return /* @__PURE__ */ React12.createElement(ControlActions, { fullWidth: true }, /* @__PURE__ */ React12.createElement(TextField, { type: "text", size: "tiny", value, onChange: handleChange, placeholder }));
|
|
412
|
+
});
|
|
275
413
|
|
|
276
414
|
// src/controls/control-types/text-area-control.tsx
|
|
277
|
-
import * as
|
|
415
|
+
import * as React13 from "react";
|
|
278
416
|
import { TextField as TextField2 } from "@elementor/ui";
|
|
279
|
-
var TextAreaControl = ({ placeholder }) => {
|
|
417
|
+
var TextAreaControl = createControl(({ placeholder }) => {
|
|
280
418
|
const { value, setValue } = useControl();
|
|
281
419
|
const handleChange = (event) => {
|
|
282
420
|
setValue(event.target.value);
|
|
283
421
|
};
|
|
284
|
-
return /* @__PURE__ */
|
|
422
|
+
return /* @__PURE__ */ React13.createElement(ControlActions, { fullWidth: true }, /* @__PURE__ */ React13.createElement(
|
|
285
423
|
TextField2,
|
|
286
424
|
{
|
|
287
425
|
size: "tiny",
|
|
@@ -292,11 +430,11 @@ var TextAreaControl = ({ placeholder }) => {
|
|
|
292
430
|
onChange: handleChange,
|
|
293
431
|
placeholder
|
|
294
432
|
}
|
|
295
|
-
);
|
|
296
|
-
};
|
|
433
|
+
));
|
|
434
|
+
});
|
|
297
435
|
|
|
298
436
|
// src/controls/control-types/size-control.tsx
|
|
299
|
-
import * as
|
|
437
|
+
import * as React15 from "react";
|
|
300
438
|
import { InputAdornment as InputAdornment2 } from "@elementor/ui";
|
|
301
439
|
|
|
302
440
|
// src/controls/hooks/use-sync-external-state.tsx
|
|
@@ -333,9 +471,9 @@ var useSyncExternalState = ({
|
|
|
333
471
|
};
|
|
334
472
|
|
|
335
473
|
// src/controls/components/text-field-inner-selection.tsx
|
|
336
|
-
import * as
|
|
337
|
-
import {
|
|
338
|
-
import {
|
|
474
|
+
import * as React14 from "react";
|
|
475
|
+
import { useId as useId3 } from "react";
|
|
476
|
+
import { bindMenu, bindTrigger, Button as Button2, InputAdornment, Menu, MenuItem as MenuItem2, TextField as TextField3, usePopupState as usePopupState2 } from "@elementor/ui";
|
|
339
477
|
var TextFieldInnerSelection = ({
|
|
340
478
|
placeholder,
|
|
341
479
|
type,
|
|
@@ -344,7 +482,7 @@ var TextFieldInnerSelection = ({
|
|
|
344
482
|
endAdornment,
|
|
345
483
|
startAdornment
|
|
346
484
|
}) => {
|
|
347
|
-
return /* @__PURE__ */
|
|
485
|
+
return /* @__PURE__ */ React14.createElement(
|
|
348
486
|
TextField3,
|
|
349
487
|
{
|
|
350
488
|
size: "tiny",
|
|
@@ -360,19 +498,19 @@ var TextFieldInnerSelection = ({
|
|
|
360
498
|
);
|
|
361
499
|
};
|
|
362
500
|
var SelectionEndAdornment = ({
|
|
363
|
-
options:
|
|
501
|
+
options: options4,
|
|
364
502
|
onClick,
|
|
365
503
|
value
|
|
366
504
|
}) => {
|
|
367
|
-
const popupState =
|
|
505
|
+
const popupState = usePopupState2({
|
|
368
506
|
variant: "popover",
|
|
369
|
-
popupId:
|
|
507
|
+
popupId: useId3()
|
|
370
508
|
});
|
|
371
509
|
const handleMenuItemClick = (index) => {
|
|
372
|
-
onClick(
|
|
510
|
+
onClick(options4[index]);
|
|
373
511
|
popupState.close();
|
|
374
512
|
};
|
|
375
|
-
return /* @__PURE__ */
|
|
513
|
+
return /* @__PURE__ */ React14.createElement(InputAdornment, { position: "end" }, /* @__PURE__ */ React14.createElement(
|
|
376
514
|
Button2,
|
|
377
515
|
{
|
|
378
516
|
size: "small",
|
|
@@ -381,12 +519,12 @@ var SelectionEndAdornment = ({
|
|
|
381
519
|
...bindTrigger(popupState)
|
|
382
520
|
},
|
|
383
521
|
value.toUpperCase()
|
|
384
|
-
), /* @__PURE__ */
|
|
522
|
+
), /* @__PURE__ */ React14.createElement(Menu, { MenuListProps: { dense: true }, ...bindMenu(popupState) }, options4.map((option, index) => /* @__PURE__ */ React14.createElement(MenuItem2, { key: option, onClick: () => handleMenuItemClick(index) }, option.toUpperCase()))));
|
|
385
523
|
};
|
|
386
524
|
|
|
387
525
|
// src/controls/control-types/size-control.tsx
|
|
388
526
|
var defaultUnits = ["px", "%", "em", "rem", "vw"];
|
|
389
|
-
var SizeControl = ({ units = defaultUnits, placeholder, startIcon }) => {
|
|
527
|
+
var SizeControl = createControl(({ units = defaultUnits, placeholder, startIcon }) => {
|
|
390
528
|
const { value, setValue } = useControl();
|
|
391
529
|
const [state, setState] = useSyncExternalState({
|
|
392
530
|
external: value,
|
|
@@ -416,39 +554,29 @@ var SizeControl = ({ units = defaultUnits, placeholder, startIcon }) => {
|
|
|
416
554
|
}
|
|
417
555
|
}));
|
|
418
556
|
};
|
|
419
|
-
return /* @__PURE__ */
|
|
557
|
+
return /* @__PURE__ */ React15.createElement(ControlActions, null, /* @__PURE__ */ React15.createElement(
|
|
420
558
|
TextFieldInnerSelection,
|
|
421
559
|
{
|
|
422
|
-
endAdornment: /* @__PURE__ */
|
|
560
|
+
endAdornment: /* @__PURE__ */ React15.createElement(SelectionEndAdornment, { options: units, onClick: handleUnitChange, value: state.value.unit }),
|
|
423
561
|
placeholder,
|
|
424
|
-
startAdornment: startIcon ?? /* @__PURE__ */
|
|
562
|
+
startAdornment: startIcon ?? /* @__PURE__ */ React15.createElement(InputAdornment2, { position: "start" }, startIcon),
|
|
425
563
|
type: "number",
|
|
426
564
|
value: Number.isNaN(state.value.size) ? "" : state.value.size,
|
|
427
565
|
onChange: handleSizeChange
|
|
428
566
|
}
|
|
429
|
-
);
|
|
430
|
-
};
|
|
431
|
-
|
|
432
|
-
// src/controls/control-types/select-control.tsx
|
|
433
|
-
import * as React11 from "react";
|
|
434
|
-
import { MenuItem as MenuItem2, Select } from "@elementor/ui";
|
|
435
|
-
var SelectControl = ({ options: options3 }) => {
|
|
436
|
-
const { value, setValue } = useControl();
|
|
437
|
-
const handleChange = (event) => {
|
|
438
|
-
setValue(event.target.value);
|
|
439
|
-
};
|
|
440
|
-
return /* @__PURE__ */ React11.createElement(Select, { size: "tiny", value: value ?? "", onChange: handleChange }, options3.map(({ label, ...props }) => /* @__PURE__ */ React11.createElement(MenuItem2, { key: props.value, ...props }, label)));
|
|
441
|
-
};
|
|
567
|
+
));
|
|
568
|
+
});
|
|
442
569
|
|
|
443
570
|
// src/controls/controls-registry.tsx
|
|
444
571
|
var controlTypes = {
|
|
445
|
-
image: ImageControl,
|
|
446
|
-
text: TextControl,
|
|
447
|
-
textarea: TextAreaControl,
|
|
448
|
-
size: SizeControl,
|
|
449
|
-
select: SelectControl
|
|
572
|
+
image: { component: ImageControl, layout: "full" },
|
|
573
|
+
text: { component: TextControl, layout: "two-columns" },
|
|
574
|
+
textarea: { component: TextAreaControl, layout: "full" },
|
|
575
|
+
size: { component: SizeControl, layout: "two-columns" },
|
|
576
|
+
select: { component: SelectControl, layout: "two-columns" }
|
|
450
577
|
};
|
|
451
|
-
var getControlByType = (type) => controlTypes[type];
|
|
578
|
+
var getControlByType = (type) => controlTypes[type]?.component;
|
|
579
|
+
var getLayoutByType = (type) => controlTypes[type].layout;
|
|
452
580
|
|
|
453
581
|
// src/controls/control.tsx
|
|
454
582
|
var ControlTypeError = createError({
|
|
@@ -456,28 +584,51 @@ var ControlTypeError = createError({
|
|
|
456
584
|
message: `Control type not found.`
|
|
457
585
|
});
|
|
458
586
|
var Control = ({ props, type }) => {
|
|
459
|
-
const { value } = useControl();
|
|
460
587
|
const ControlByType = getControlByType(type);
|
|
461
588
|
if (!ControlByType) {
|
|
462
589
|
throw new ControlTypeError({
|
|
463
590
|
context: { type }
|
|
464
591
|
});
|
|
465
592
|
}
|
|
466
|
-
|
|
467
|
-
return /* @__PURE__ */ React12.createElement(ControlComponent, { ...props });
|
|
593
|
+
return /* @__PURE__ */ React16.createElement(ControlByType, { ...props });
|
|
468
594
|
};
|
|
469
595
|
|
|
596
|
+
// src/controls/components/control-type-container.tsx
|
|
597
|
+
import * as React17 from "react";
|
|
598
|
+
import { styled as styled2, Box } from "@elementor/ui";
|
|
599
|
+
var ControlTypeContainer = ({
|
|
600
|
+
controlType,
|
|
601
|
+
children
|
|
602
|
+
}) => {
|
|
603
|
+
const layout = getLayoutByType(controlType);
|
|
604
|
+
return /* @__PURE__ */ React17.createElement(StyledContainer, { layout }, children);
|
|
605
|
+
};
|
|
606
|
+
var StyledContainer = styled2(Box, {
|
|
607
|
+
shouldForwardProp: (prop) => !["layout"].includes(prop)
|
|
608
|
+
})(({ layout, theme }) => ({
|
|
609
|
+
display: "grid",
|
|
610
|
+
gridGap: theme.spacing(1),
|
|
611
|
+
...getGridLayout(layout)
|
|
612
|
+
}));
|
|
613
|
+
var getGridLayout = (layout) => ({
|
|
614
|
+
justifyContent: "space-between",
|
|
615
|
+
gridTemplateColumns: {
|
|
616
|
+
full: "1fr",
|
|
617
|
+
"two-columns": "repeat(2, 1fr)"
|
|
618
|
+
}[layout]
|
|
619
|
+
});
|
|
620
|
+
|
|
470
621
|
// src/components/settings-tab.tsx
|
|
471
622
|
var SettingsTab = () => {
|
|
472
|
-
const { elementType } =
|
|
473
|
-
return /* @__PURE__ */
|
|
623
|
+
const { elementType } = useElement();
|
|
624
|
+
return /* @__PURE__ */ React18.createElement(Stack5, null, elementType.controls.map(({ type, value }, index) => {
|
|
474
625
|
if (type === "control") {
|
|
475
|
-
return /* @__PURE__ */
|
|
626
|
+
return /* @__PURE__ */ React18.createElement(Control2, { key: value.bind, control: value });
|
|
476
627
|
}
|
|
477
628
|
if (type === "section") {
|
|
478
|
-
return /* @__PURE__ */
|
|
629
|
+
return /* @__PURE__ */ React18.createElement(AccordionSection, { key: type + "." + index, title: value.label }, value.items?.map((item) => {
|
|
479
630
|
if (item.type === "control") {
|
|
480
|
-
return /* @__PURE__ */
|
|
631
|
+
return /* @__PURE__ */ React18.createElement(Control2, { key: item.value.bind, control: item.value });
|
|
481
632
|
}
|
|
482
633
|
return null;
|
|
483
634
|
}));
|
|
@@ -489,24 +640,24 @@ var Control2 = ({ control }) => {
|
|
|
489
640
|
if (!getControlByType(control.type)) {
|
|
490
641
|
return null;
|
|
491
642
|
}
|
|
492
|
-
return /* @__PURE__ */
|
|
643
|
+
return /* @__PURE__ */ React18.createElement(SettingsControl, { bind: control.bind }, /* @__PURE__ */ React18.createElement(ControlTypeContainer, { controlType: control.type }, control.label ? /* @__PURE__ */ React18.createElement(SettingsControl.Label, null, control.label) : null, /* @__PURE__ */ React18.createElement(Control, { type: control.type, props: control.props })));
|
|
493
644
|
};
|
|
494
645
|
|
|
495
646
|
// src/components/style-tab.tsx
|
|
496
|
-
import * as
|
|
647
|
+
import * as React46 from "react";
|
|
497
648
|
|
|
498
649
|
// src/contexts/style-context.tsx
|
|
499
|
-
import * as
|
|
500
|
-
import { createContext as
|
|
650
|
+
import * as React19 from "react";
|
|
651
|
+
import { createContext as createContext4, useContext as useContext4 } from "react";
|
|
501
652
|
import { useActiveBreakpoint } from "@elementor/editor-responsive";
|
|
502
|
-
var Context2 =
|
|
653
|
+
var Context2 = createContext4(null);
|
|
503
654
|
function StyleContext({ children, selectedStyleDef, selectedClassesProp }) {
|
|
504
655
|
const breakpoint = useActiveBreakpoint();
|
|
505
656
|
const selectedMeta = { breakpoint, state: null };
|
|
506
|
-
return /* @__PURE__ */
|
|
657
|
+
return /* @__PURE__ */ React19.createElement(Context2.Provider, { value: { selectedStyleDef, selectedMeta, selectedClassesProp } }, children);
|
|
507
658
|
}
|
|
508
659
|
function useStyleContext() {
|
|
509
|
-
const context =
|
|
660
|
+
const context = useContext4(Context2);
|
|
510
661
|
if (!context) {
|
|
511
662
|
throw new Error("UseStyleContext must be used within a StyleContextProvider");
|
|
512
663
|
}
|
|
@@ -534,13 +685,13 @@ var useElementStyles = (elementID) => {
|
|
|
534
685
|
};
|
|
535
686
|
|
|
536
687
|
// src/components/style-tab.tsx
|
|
537
|
-
import { Stack as
|
|
688
|
+
import { Stack as Stack16 } from "@elementor/ui";
|
|
538
689
|
|
|
539
690
|
// src/components/style-sections/size-section.tsx
|
|
540
|
-
import * as
|
|
691
|
+
import * as React21 from "react";
|
|
541
692
|
|
|
542
693
|
// src/controls/style-control.tsx
|
|
543
|
-
import * as
|
|
694
|
+
import * as React20 from "react";
|
|
544
695
|
|
|
545
696
|
// src/hooks/use-element-style-prop.ts
|
|
546
697
|
import { commandEndEvent as commandEndEvent5, __privateUseListenTo as useListenTo5 } from "@elementor/editor-v1-adapters";
|
|
@@ -587,7 +738,7 @@ var updateStyle = ({ elementID, styleDefID, meta, props, bind }) => {
|
|
|
587
738
|
|
|
588
739
|
// src/controls/hooks/use-style-control.ts
|
|
589
740
|
var useStyleControl = (propName) => {
|
|
590
|
-
const { element } =
|
|
741
|
+
const { element } = useElement();
|
|
591
742
|
const { selectedStyleDef, selectedMeta, selectedClassesProp } = useStyleContext();
|
|
592
743
|
const value = useElementStyleProp({
|
|
593
744
|
elementID: element.id,
|
|
@@ -610,35 +761,35 @@ var useStyleControl = (propName) => {
|
|
|
610
761
|
// src/controls/style-control.tsx
|
|
611
762
|
var StyleControl = ({ bind, children }) => {
|
|
612
763
|
const [value, setValue] = useStyleControl(bind);
|
|
613
|
-
return /* @__PURE__ */
|
|
764
|
+
return /* @__PURE__ */ React20.createElement(ControlContext.Provider, { value: { bind, value, setValue } }, children);
|
|
614
765
|
};
|
|
615
766
|
StyleControl.Label = ControlLabel;
|
|
616
767
|
|
|
617
768
|
// src/components/style-sections/size-section.tsx
|
|
618
|
-
import { Stack as
|
|
619
|
-
import { __ as
|
|
769
|
+
import { Grid as Grid2, Stack as Stack6 } from "@elementor/ui";
|
|
770
|
+
import { __ as __3 } from "@wordpress/i18n";
|
|
620
771
|
var SizeSection = () => {
|
|
621
|
-
return /* @__PURE__ */
|
|
772
|
+
return /* @__PURE__ */ React21.createElement(AccordionSection, { title: __3("Size", "elementor") }, /* @__PURE__ */ React21.createElement(Stack6, { gap: 1.5 }, /* @__PURE__ */ React21.createElement(Grid2, { container: true, spacing: 2 }, /* @__PURE__ */ React21.createElement(Control3, { bind: "width", label: __3("Width", "elementor") }), /* @__PURE__ */ React21.createElement(Control3, { bind: "height", label: __3("Height", "elementor") })), /* @__PURE__ */ React21.createElement(Grid2, { container: true, spacing: 2 }, /* @__PURE__ */ React21.createElement(Control3, { bind: "min-width", label: __3("Min. Width", "elementor") }), /* @__PURE__ */ React21.createElement(Control3, { bind: "min-height", label: __3("Min. Height", "elementor") })), /* @__PURE__ */ React21.createElement(Grid2, { container: true, spacing: 2 }, /* @__PURE__ */ React21.createElement(Control3, { bind: "max-width", label: __3("Max. Width", "elementor") }), /* @__PURE__ */ React21.createElement(Control3, { bind: "max-height", label: __3("Max. Height", "elementor") }))));
|
|
622
773
|
};
|
|
623
774
|
var Control3 = ({ label, bind }) => {
|
|
624
|
-
return /* @__PURE__ */
|
|
775
|
+
return /* @__PURE__ */ React21.createElement(Grid2, { item: true, xs: 6 }, /* @__PURE__ */ React21.createElement(StyleControl, { bind }, /* @__PURE__ */ React21.createElement(Grid2, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React21.createElement(Grid2, { item: true, xs: 12 }, /* @__PURE__ */ React21.createElement(StyleControl.Label, null, label)), /* @__PURE__ */ React21.createElement(Grid2, { item: true, xs: 12 }, /* @__PURE__ */ React21.createElement(Control, { type: "size" })))));
|
|
625
776
|
};
|
|
626
777
|
|
|
627
778
|
// src/components/style-sections/typography-section/typography-section.tsx
|
|
628
|
-
import * as
|
|
629
|
-
import { Divider, Stack as
|
|
779
|
+
import * as React35 from "react";
|
|
780
|
+
import { Divider, Stack as Stack8 } from "@elementor/ui";
|
|
630
781
|
|
|
631
782
|
// src/components/style-sections/typography-section/text-style-control.tsx
|
|
632
|
-
import * as
|
|
633
|
-
import {
|
|
783
|
+
import * as React22 from "react";
|
|
784
|
+
import { __ as __4 } from "@wordpress/i18n";
|
|
785
|
+
import { Grid as Grid3, ToggleButton as ToggleButtonBase, ToggleButtonGroup } from "@elementor/ui";
|
|
634
786
|
import { ItalicIcon, StrikethroughIcon, UnderlineIcon } from "@elementor/icons";
|
|
635
|
-
import { __ as __3 } from "@wordpress/i18n";
|
|
636
787
|
var buttonSize = "tiny";
|
|
637
788
|
var TextStyleControl = () => {
|
|
638
|
-
const [fontStyle, setFontStyle] = useStyleControl("
|
|
639
|
-
const [textDecoration, setTextDecoration] = useStyleControl("
|
|
789
|
+
const [fontStyle, setFontStyle] = useStyleControl("font-style");
|
|
790
|
+
const [textDecoration, setTextDecoration] = useStyleControl("text-decoration");
|
|
640
791
|
const formats = [fontStyle, ...(textDecoration || "").split(" ")];
|
|
641
|
-
return /* @__PURE__ */
|
|
792
|
+
return /* @__PURE__ */ React22.createElement(Grid3, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React22.createElement(Grid3, { item: true, xs: 6 }, /* @__PURE__ */ React22.createElement(ControlLabel, null, __4("Style", "elementor"))), /* @__PURE__ */ React22.createElement(Grid3, { item: true, xs: 6, display: "flex", justifyContent: "end" }, /* @__PURE__ */ React22.createElement(ToggleButtonGroup, { value: formats }, /* @__PURE__ */ React22.createElement(
|
|
642
793
|
ToggleButton,
|
|
643
794
|
{
|
|
644
795
|
value: "italic",
|
|
@@ -646,8 +797,8 @@ var TextStyleControl = () => {
|
|
|
646
797
|
"aria-label": "italic",
|
|
647
798
|
sx: { marginLeft: "auto" }
|
|
648
799
|
},
|
|
649
|
-
/* @__PURE__ */
|
|
650
|
-
), /* @__PURE__ */
|
|
800
|
+
/* @__PURE__ */ React22.createElement(ItalicIcon, { fontSize: buttonSize })
|
|
801
|
+
), /* @__PURE__ */ React22.createElement(
|
|
651
802
|
ShorthandControl,
|
|
652
803
|
{
|
|
653
804
|
value: "line-through",
|
|
@@ -655,8 +806,8 @@ var TextStyleControl = () => {
|
|
|
655
806
|
updateValues: setTextDecoration,
|
|
656
807
|
"aria-label": "line-through"
|
|
657
808
|
},
|
|
658
|
-
/* @__PURE__ */
|
|
659
|
-
), /* @__PURE__ */
|
|
809
|
+
/* @__PURE__ */ React22.createElement(StrikethroughIcon, { fontSize: buttonSize })
|
|
810
|
+
), /* @__PURE__ */ React22.createElement(
|
|
660
811
|
ShorthandControl,
|
|
661
812
|
{
|
|
662
813
|
value: "underline",
|
|
@@ -664,8 +815,8 @@ var TextStyleControl = () => {
|
|
|
664
815
|
updateValues: setTextDecoration,
|
|
665
816
|
"aria-label": "underline"
|
|
666
817
|
},
|
|
667
|
-
/* @__PURE__ */
|
|
668
|
-
)));
|
|
818
|
+
/* @__PURE__ */ React22.createElement(UnderlineIcon, { fontSize: buttonSize })
|
|
819
|
+
))));
|
|
669
820
|
};
|
|
670
821
|
var ShorthandControl = ({
|
|
671
822
|
children,
|
|
@@ -683,92 +834,95 @@ var ShorthandControl = ({
|
|
|
683
834
|
updateValues([...valuesArr, newValue].join(" "));
|
|
684
835
|
}
|
|
685
836
|
};
|
|
686
|
-
return /* @__PURE__ */
|
|
837
|
+
return /* @__PURE__ */ React22.createElement(ToggleButton, { value, onChange: toggleValue, selected, "aria-label": ariaLabel }, children);
|
|
687
838
|
};
|
|
688
839
|
var ToggleButton = ({ onChange, ...props }) => {
|
|
689
840
|
const handleChange = (_e, newValue) => {
|
|
690
841
|
onChange(newValue);
|
|
691
842
|
};
|
|
692
|
-
return /* @__PURE__ */
|
|
843
|
+
return /* @__PURE__ */ React22.createElement(ToggleButtonBase, { ...props, onChange: handleChange, size: buttonSize });
|
|
693
844
|
};
|
|
694
845
|
|
|
695
846
|
// src/components/style-sections/typography-section/typography-section.tsx
|
|
696
|
-
import { __ as
|
|
847
|
+
import { __ as __14 } from "@wordpress/i18n";
|
|
697
848
|
|
|
698
849
|
// src/components/style-sections/typography-section/font-size-control.tsx
|
|
699
|
-
import * as
|
|
700
|
-
import { __ as
|
|
850
|
+
import * as React23 from "react";
|
|
851
|
+
import { __ as __5 } from "@wordpress/i18n";
|
|
852
|
+
import { Grid as Grid4 } from "@elementor/ui";
|
|
701
853
|
var FontSizeControl = () => {
|
|
702
|
-
return /* @__PURE__ */
|
|
854
|
+
return /* @__PURE__ */ React23.createElement(StyleControl, { bind: "font-size" }, /* @__PURE__ */ React23.createElement(Grid4, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React23.createElement(Grid4, { item: true, xs: 6 }, /* @__PURE__ */ React23.createElement(StyleControl.Label, null, __5("Font Size", "elementor"))), /* @__PURE__ */ React23.createElement(Grid4, { item: true, xs: 6 }, /* @__PURE__ */ React23.createElement(SizeControl, null))));
|
|
703
855
|
};
|
|
704
856
|
|
|
705
857
|
// src/components/style-sections/typography-section/font-weight-control.tsx
|
|
706
|
-
import * as
|
|
707
|
-
import { __ as
|
|
858
|
+
import * as React24 from "react";
|
|
859
|
+
import { __ as __6 } from "@wordpress/i18n";
|
|
860
|
+
import { Grid as Grid5 } from "@elementor/ui";
|
|
708
861
|
var fontWeightOptions = [
|
|
709
|
-
{ label:
|
|
710
|
-
{ label:
|
|
711
|
-
{ label:
|
|
712
|
-
{ label:
|
|
713
|
-
{ label:
|
|
862
|
+
{ label: __6("Light - 400", "elementor"), value: "400" },
|
|
863
|
+
{ label: __6("Regular - 500", "elementor"), value: "500" },
|
|
864
|
+
{ label: __6("Semi Bold - 600", "elementor"), value: "600" },
|
|
865
|
+
{ label: __6("Bold - 700", "elementor"), value: "700" },
|
|
866
|
+
{ label: __6("Black - 900", "elementor"), value: "900" }
|
|
714
867
|
];
|
|
715
868
|
var FontWeightControl = () => {
|
|
716
|
-
return /* @__PURE__ */
|
|
869
|
+
return /* @__PURE__ */ React24.createElement(StyleControl, { bind: "font-weight" }, /* @__PURE__ */ React24.createElement(Grid5, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React24.createElement(Grid5, { item: true, xs: 6 }, /* @__PURE__ */ React24.createElement(StyleControl.Label, null, __6("Font Weight", "elementor"))), /* @__PURE__ */ React24.createElement(Grid5, { item: true, xs: 6 }, /* @__PURE__ */ React24.createElement(SelectControl, { options: fontWeightOptions }))));
|
|
717
870
|
};
|
|
718
871
|
|
|
719
872
|
// src/components/style-sections/typography-section/text-color-control.tsx
|
|
720
|
-
import * as
|
|
721
|
-
import { __ as
|
|
873
|
+
import * as React26 from "react";
|
|
874
|
+
import { __ as __7 } from "@wordpress/i18n";
|
|
875
|
+
import { Grid as Grid6 } from "@elementor/ui";
|
|
722
876
|
|
|
723
877
|
// src/controls/control-types/color-control.tsx
|
|
724
|
-
import * as
|
|
878
|
+
import * as React25 from "react";
|
|
725
879
|
import { UnstableColorPicker } from "@elementor/ui";
|
|
726
|
-
var ColorControl = (
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
};
|
|
739
|
-
};
|
|
880
|
+
var ColorControl = createControl(
|
|
881
|
+
(props) => {
|
|
882
|
+
const { value, setValue } = useControl();
|
|
883
|
+
const handleChange = (selectedColor) => {
|
|
884
|
+
setValue({
|
|
885
|
+
$$type: "color",
|
|
886
|
+
value: selectedColor
|
|
887
|
+
});
|
|
888
|
+
};
|
|
889
|
+
return /* @__PURE__ */ React25.createElement(ControlActions, null, /* @__PURE__ */ React25.createElement(UnstableColorPicker, { size: "tiny", ...props, value: value?.value, onChange: handleChange }));
|
|
890
|
+
}
|
|
891
|
+
);
|
|
740
892
|
|
|
741
893
|
// src/components/style-sections/typography-section/text-color-control.tsx
|
|
742
894
|
var TextColorControl = () => {
|
|
743
|
-
return /* @__PURE__ */
|
|
895
|
+
return /* @__PURE__ */ React26.createElement(StyleControl, { bind: "color" }, /* @__PURE__ */ React26.createElement(Grid6, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React26.createElement(Grid6, { item: true, xs: 6 }, /* @__PURE__ */ React26.createElement(StyleControl.Label, null, __7("Text Color", "elementor"))), /* @__PURE__ */ React26.createElement(Grid6, { item: true, xs: 6 }, /* @__PURE__ */ React26.createElement(ColorControl, null))));
|
|
744
896
|
};
|
|
745
897
|
|
|
746
898
|
// src/components/style-sections/typography-section/letter-spacing-control.tsx
|
|
747
|
-
import * as
|
|
748
|
-
import { __ as
|
|
899
|
+
import * as React27 from "react";
|
|
900
|
+
import { __ as __8 } from "@wordpress/i18n";
|
|
901
|
+
import { Grid as Grid7 } from "@elementor/ui";
|
|
749
902
|
var LetterSpacingControl = () => {
|
|
750
|
-
return /* @__PURE__ */
|
|
903
|
+
return /* @__PURE__ */ React27.createElement(StyleControl, { bind: "letter-spacing" }, /* @__PURE__ */ React27.createElement(Grid7, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React27.createElement(Grid7, { item: true, xs: 6 }, /* @__PURE__ */ React27.createElement(StyleControl.Label, null, __8("Letter Spacing", "elementor"))), /* @__PURE__ */ React27.createElement(Grid7, { item: true, xs: 6 }, /* @__PURE__ */ React27.createElement(SizeControl, null))));
|
|
751
904
|
};
|
|
752
905
|
|
|
753
906
|
// src/components/style-sections/typography-section/word-spacing-control.tsx
|
|
754
|
-
import * as
|
|
755
|
-
import { __ as
|
|
907
|
+
import * as React28 from "react";
|
|
908
|
+
import { __ as __9 } from "@wordpress/i18n";
|
|
909
|
+
import { Grid as Grid8 } from "@elementor/ui";
|
|
756
910
|
var WordSpacingControl = () => {
|
|
757
|
-
return /* @__PURE__ */
|
|
911
|
+
return /* @__PURE__ */ React28.createElement(StyleControl, { bind: "word-spacing" }, /* @__PURE__ */ React28.createElement(Grid8, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React28.createElement(Grid8, { item: true, xs: 6 }, /* @__PURE__ */ React28.createElement(StyleControl.Label, null, __9("Word Spacing", "elementor"))), /* @__PURE__ */ React28.createElement(Grid8, { item: true, xs: 6 }, /* @__PURE__ */ React28.createElement(SizeControl, null))));
|
|
758
912
|
};
|
|
759
913
|
|
|
760
914
|
// src/components/collapsible-content.tsx
|
|
761
|
-
import * as
|
|
915
|
+
import * as React29 from "react";
|
|
762
916
|
import { useState as useState2 } from "react";
|
|
763
917
|
import { ChevronDownIcon } from "@elementor/icons";
|
|
764
|
-
import { Button as Button3, Collapse, Stack as
|
|
765
|
-
import { __ as
|
|
918
|
+
import { Button as Button3, Collapse, Stack as Stack7, styled as styled3 } from "@elementor/ui";
|
|
919
|
+
import { __ as __10 } from "@wordpress/i18n";
|
|
766
920
|
var CollapsibleContent = ({ children, defaultOpen = false }) => {
|
|
767
921
|
const [open, setOpen] = useState2(defaultOpen);
|
|
768
922
|
const handleToggle = () => {
|
|
769
923
|
setOpen((prevOpen) => !prevOpen);
|
|
770
924
|
};
|
|
771
|
-
return /* @__PURE__ */
|
|
925
|
+
return /* @__PURE__ */ React29.createElement(Stack7, { sx: { py: 0.5 } }, /* @__PURE__ */ React29.createElement(
|
|
772
926
|
Button3,
|
|
773
927
|
{
|
|
774
928
|
fullWidth: true,
|
|
@@ -776,12 +930,12 @@ var CollapsibleContent = ({ children, defaultOpen = false }) => {
|
|
|
776
930
|
color: "secondary",
|
|
777
931
|
variant: "outlined",
|
|
778
932
|
onClick: handleToggle,
|
|
779
|
-
endIcon: /* @__PURE__ */
|
|
933
|
+
endIcon: /* @__PURE__ */ React29.createElement(ChevronIcon, { open })
|
|
780
934
|
},
|
|
781
|
-
open ?
|
|
782
|
-
), /* @__PURE__ */
|
|
935
|
+
open ? __10("Show less", "elementor") : __10("Show more", "elementor")
|
|
936
|
+
), /* @__PURE__ */ React29.createElement(Collapse, { in: open, timeout: "auto" }, children));
|
|
783
937
|
};
|
|
784
|
-
var ChevronIcon =
|
|
938
|
+
var ChevronIcon = styled3(ChevronDownIcon, {
|
|
785
939
|
shouldForwardProp: (prop) => prop !== "open"
|
|
786
940
|
})(({ theme, open }) => ({
|
|
787
941
|
transform: open ? "rotate(180deg)" : "rotate(0)",
|
|
@@ -791,16 +945,18 @@ var ChevronIcon = styled2(ChevronDownIcon, {
|
|
|
791
945
|
}));
|
|
792
946
|
|
|
793
947
|
// src/components/style-sections/typography-section/transform-control.tsx
|
|
794
|
-
import * as
|
|
795
|
-
import { __ as
|
|
948
|
+
import * as React32 from "react";
|
|
949
|
+
import { __ as __11 } from "@wordpress/i18n";
|
|
950
|
+
import { Grid as Grid9 } from "@elementor/ui";
|
|
951
|
+
import { LetterCaseIcon, LetterCaseLowerIcon, LetterCaseUpperIcon } from "@elementor/icons";
|
|
796
952
|
|
|
797
953
|
// src/controls/control-types/toggle-control.tsx
|
|
798
|
-
import * as
|
|
954
|
+
import * as React31 from "react";
|
|
799
955
|
|
|
800
956
|
// src/controls/components/control-toggle-button-group.tsx
|
|
801
|
-
import * as
|
|
802
|
-
import { styled as
|
|
803
|
-
var StyledToggleButtonGroup =
|
|
957
|
+
import * as React30 from "react";
|
|
958
|
+
import { styled as styled4, ToggleButton as ToggleButton2, ToggleButtonGroup as ToggleButtonGroup2 } from "@elementor/ui";
|
|
959
|
+
var StyledToggleButtonGroup = styled4(ToggleButtonGroup2)`
|
|
804
960
|
${({ justify }) => `justify-content: ${justify};`}
|
|
805
961
|
`;
|
|
806
962
|
var ControlToggleButtonGroup = ({
|
|
@@ -814,91 +970,111 @@ var ControlToggleButtonGroup = ({
|
|
|
814
970
|
const handleChange = (_, newValue) => {
|
|
815
971
|
onChange(newValue);
|
|
816
972
|
};
|
|
817
|
-
return /* @__PURE__ */
|
|
973
|
+
return /* @__PURE__ */ React30.createElement(StyledToggleButtonGroup, { justify, value, onChange: handleChange, exclusive }, items.map(({ label, value: buttonValue, icon: Icon }) => /* @__PURE__ */ React30.createElement(ToggleButton2, { key: buttonValue, value: buttonValue, "aria-label": label, size }, /* @__PURE__ */ React30.createElement(Icon, { fontSize: size }))));
|
|
818
974
|
};
|
|
819
975
|
|
|
820
976
|
// src/controls/control-types/toggle-control.tsx
|
|
821
|
-
var ToggleControl = ({ options:
|
|
977
|
+
var ToggleControl = createControl(({ options: options4 }) => {
|
|
822
978
|
const { value, setValue } = useControl();
|
|
823
979
|
const handleToggle = (option) => {
|
|
824
980
|
setValue(option || void 0);
|
|
825
981
|
};
|
|
826
|
-
return /* @__PURE__ */
|
|
982
|
+
return /* @__PURE__ */ React31.createElement(
|
|
827
983
|
ControlToggleButtonGroup,
|
|
828
984
|
{
|
|
829
|
-
items:
|
|
985
|
+
items: options4,
|
|
830
986
|
value: value || null,
|
|
831
987
|
onChange: handleToggle,
|
|
832
988
|
exclusive: true
|
|
833
989
|
}
|
|
834
990
|
);
|
|
835
|
-
};
|
|
991
|
+
});
|
|
836
992
|
|
|
837
993
|
// src/components/style-sections/typography-section/transform-control.tsx
|
|
838
|
-
import { LetterCaseIcon, LetterCaseLowerIcon, LetterCaseUpperIcon } from "@elementor/icons";
|
|
839
994
|
var options = [
|
|
840
|
-
{ value: "capitalize", label:
|
|
841
|
-
{ value: "uppercase", label:
|
|
842
|
-
{ value: "lowercase", label:
|
|
995
|
+
{ value: "capitalize", label: __11("Capitalize", "elementor"), icon: LetterCaseIcon },
|
|
996
|
+
{ value: "uppercase", label: __11("Uppercase", "elementor"), icon: LetterCaseUpperIcon },
|
|
997
|
+
{ value: "lowercase", label: __11("Lowercase", "elementor"), icon: LetterCaseLowerIcon }
|
|
843
998
|
];
|
|
844
|
-
var TransformControl = () => {
|
|
845
|
-
return /* @__PURE__ */ React27.createElement(ControlContainer, null, /* @__PURE__ */ React27.createElement(StyleControl.Label, null, __10("Transform", "elementor")), /* @__PURE__ */ React27.createElement(StyleControl, { bind: "text-transform" }, /* @__PURE__ */ React27.createElement(ToggleControl, { options })));
|
|
846
|
-
};
|
|
999
|
+
var TransformControl = () => /* @__PURE__ */ React32.createElement(StyleControl, { bind: "text-transform" }, /* @__PURE__ */ React32.createElement(Grid9, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React32.createElement(Grid9, { item: true, xs: 6 }, /* @__PURE__ */ React32.createElement(StyleControl.Label, null, __11("Transform", "elementor"))), /* @__PURE__ */ React32.createElement(Grid9, { item: true, xs: 6, display: "flex", justifyContent: "end" }, /* @__PURE__ */ React32.createElement(ToggleControl, { options }))));
|
|
847
1000
|
|
|
848
1001
|
// src/components/style-sections/typography-section/text-alignment-control.tsx
|
|
849
|
-
import * as
|
|
1002
|
+
import * as React33 from "react";
|
|
1003
|
+
import { __ as __12 } from "@wordpress/i18n";
|
|
1004
|
+
import { Grid as Grid10 } from "@elementor/ui";
|
|
850
1005
|
import { AlignLeftIcon, AlignCenterIcon, AlignRightIcon, AlignJustifiedIcon } from "@elementor/icons";
|
|
851
|
-
import { __ as __11 } from "@wordpress/i18n";
|
|
852
1006
|
var options2 = [
|
|
853
1007
|
{
|
|
854
1008
|
value: "left",
|
|
855
|
-
label:
|
|
1009
|
+
label: __12("Left", "elementor"),
|
|
856
1010
|
icon: AlignLeftIcon
|
|
857
1011
|
},
|
|
858
1012
|
{
|
|
859
1013
|
value: "center",
|
|
860
|
-
label:
|
|
1014
|
+
label: __12("Center", "elementor"),
|
|
861
1015
|
icon: AlignCenterIcon
|
|
862
1016
|
},
|
|
863
1017
|
{
|
|
864
1018
|
value: "right",
|
|
865
|
-
label:
|
|
1019
|
+
label: __12("Right", "elementor"),
|
|
866
1020
|
icon: AlignRightIcon
|
|
867
1021
|
},
|
|
868
1022
|
{
|
|
869
1023
|
value: "justify",
|
|
870
|
-
label:
|
|
1024
|
+
label: __12("Justify", "elementor"),
|
|
871
1025
|
icon: AlignJustifiedIcon
|
|
872
1026
|
}
|
|
873
1027
|
];
|
|
874
1028
|
var TextAlignmentControl = () => {
|
|
875
|
-
return /* @__PURE__ */
|
|
1029
|
+
return /* @__PURE__ */ React33.createElement(StyleControl, { bind: "text-align" }, /* @__PURE__ */ React33.createElement(Grid10, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React33.createElement(Grid10, { item: true, xs: 6 }, /* @__PURE__ */ React33.createElement(StyleControl.Label, null, __12("Alignment", "elementor"))), /* @__PURE__ */ React33.createElement(Grid10, { item: true, xs: 6, display: "flex", justifyContent: "end" }, /* @__PURE__ */ React33.createElement(ToggleControl, { options: options2 }))));
|
|
1030
|
+
};
|
|
1031
|
+
|
|
1032
|
+
// src/components/style-sections/typography-section/text-direction-control.tsx
|
|
1033
|
+
import * as React34 from "react";
|
|
1034
|
+
import { __ as __13 } from "@wordpress/i18n";
|
|
1035
|
+
import { Grid as Grid11 } from "@elementor/ui";
|
|
1036
|
+
import { TextDirectionLtrIcon, TextDirectionRtlIcon } from "@elementor/icons";
|
|
1037
|
+
var options3 = [
|
|
1038
|
+
{
|
|
1039
|
+
value: "ltr",
|
|
1040
|
+
label: __13("Left to Right", "elementor"),
|
|
1041
|
+
icon: TextDirectionLtrIcon
|
|
1042
|
+
},
|
|
1043
|
+
{
|
|
1044
|
+
value: "rtl",
|
|
1045
|
+
label: __13("Right to Left", "elementor"),
|
|
1046
|
+
icon: TextDirectionRtlIcon
|
|
1047
|
+
}
|
|
1048
|
+
];
|
|
1049
|
+
var TextDirectionControl = () => {
|
|
1050
|
+
return /* @__PURE__ */ React34.createElement(StyleControl, { bind: "direction" }, /* @__PURE__ */ React34.createElement(Grid11, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React34.createElement(Grid11, { item: true, xs: 6 }, /* @__PURE__ */ React34.createElement(StyleControl.Label, null, __13("Direction", "elementor"))), /* @__PURE__ */ React34.createElement(Grid11, { item: true, xs: 6, display: "flex", justifyContent: "end" }, /* @__PURE__ */ React34.createElement(ToggleControl, { options: options3 }))));
|
|
876
1051
|
};
|
|
877
1052
|
|
|
878
1053
|
// src/components/style-sections/typography-section/typography-section.tsx
|
|
879
1054
|
var TypographySection = () => {
|
|
880
|
-
return /* @__PURE__ */
|
|
1055
|
+
return /* @__PURE__ */ React35.createElement(AccordionSection, { title: __14("Typography", "elementor") }, /* @__PURE__ */ React35.createElement(Stack8, { gap: 1.5 }, /* @__PURE__ */ React35.createElement(FontWeightControl, null), /* @__PURE__ */ React35.createElement(FontSizeControl, null), /* @__PURE__ */ React35.createElement(Divider, null), /* @__PURE__ */ React35.createElement(TextColorControl, null), /* @__PURE__ */ React35.createElement(CollapsibleContent, null, /* @__PURE__ */ React35.createElement(Stack8, { gap: 1.5, sx: { pt: 1.5 } }, /* @__PURE__ */ React35.createElement(LetterSpacingControl, null), /* @__PURE__ */ React35.createElement(WordSpacingControl, null), /* @__PURE__ */ React35.createElement(Divider, null), /* @__PURE__ */ React35.createElement(TextAlignmentControl, null), /* @__PURE__ */ React35.createElement(TextStyleControl, null), /* @__PURE__ */ React35.createElement(TransformControl, null), /* @__PURE__ */ React35.createElement(TextDirectionControl, null)))));
|
|
881
1056
|
};
|
|
882
1057
|
|
|
883
1058
|
// src/components/style-sections/position-section/position-section.tsx
|
|
884
|
-
import * as
|
|
885
|
-
import { Stack as
|
|
1059
|
+
import * as React38 from "react";
|
|
1060
|
+
import { Stack as Stack9 } from "@elementor/ui";
|
|
886
1061
|
|
|
887
1062
|
// src/components/style-sections/position-section/z-index-control.tsx
|
|
888
|
-
import * as
|
|
889
|
-
import { __ as
|
|
1063
|
+
import * as React37 from "react";
|
|
1064
|
+
import { __ as __15 } from "@wordpress/i18n";
|
|
1065
|
+
import { Grid as Grid12 } from "@elementor/ui";
|
|
890
1066
|
|
|
891
1067
|
// src/controls/control-types/number-control.tsx
|
|
892
|
-
import * as
|
|
1068
|
+
import * as React36 from "react";
|
|
893
1069
|
import { TextField as TextField4 } from "@elementor/ui";
|
|
894
1070
|
var isEmptyOrNaN = (value) => value === void 0 || value === "" || Number.isNaN(Number(value));
|
|
895
|
-
var NumberControl = ({ placeholder }) => {
|
|
1071
|
+
var NumberControl = createControl(({ placeholder }) => {
|
|
896
1072
|
const { value, setValue } = useControl();
|
|
897
1073
|
const handleChange = (event) => {
|
|
898
1074
|
const eventValue = event.target.value;
|
|
899
1075
|
setValue(isEmptyOrNaN(eventValue) ? void 0 : Number(eventValue));
|
|
900
1076
|
};
|
|
901
|
-
return /* @__PURE__ */
|
|
1077
|
+
return /* @__PURE__ */ React36.createElement(ControlActions, null, /* @__PURE__ */ React36.createElement(
|
|
902
1078
|
TextField4,
|
|
903
1079
|
{
|
|
904
1080
|
size: "tiny",
|
|
@@ -907,33 +1083,33 @@ var NumberControl = ({ placeholder }) => {
|
|
|
907
1083
|
onChange: handleChange,
|
|
908
1084
|
placeholder
|
|
909
1085
|
}
|
|
910
|
-
);
|
|
911
|
-
};
|
|
1086
|
+
));
|
|
1087
|
+
});
|
|
912
1088
|
|
|
913
1089
|
// src/components/style-sections/position-section/z-index-control.tsx
|
|
914
1090
|
var ZIndexControl = () => {
|
|
915
|
-
return /* @__PURE__ */
|
|
1091
|
+
return /* @__PURE__ */ React37.createElement(StyleControl, { bind: "z-index" }, /* @__PURE__ */ React37.createElement(Grid12, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React37.createElement(Grid12, { item: true, xs: 6 }, /* @__PURE__ */ React37.createElement(StyleControl.Label, null, __15("Z-Index", "elementor"))), /* @__PURE__ */ React37.createElement(Grid12, { item: true, xs: 6 }, /* @__PURE__ */ React37.createElement(NumberControl, null))));
|
|
916
1092
|
};
|
|
917
1093
|
|
|
918
1094
|
// src/components/style-sections/position-section/position-section.tsx
|
|
919
|
-
import { __ as
|
|
1095
|
+
import { __ as __16 } from "@wordpress/i18n";
|
|
920
1096
|
var PositionSection = () => {
|
|
921
|
-
return /* @__PURE__ */
|
|
1097
|
+
return /* @__PURE__ */ React38.createElement(AccordionSection, { title: __16("Position", "elementor") }, /* @__PURE__ */ React38.createElement(Stack9, { gap: 1.5 }, /* @__PURE__ */ React38.createElement(ZIndexControl, null)));
|
|
922
1098
|
};
|
|
923
1099
|
|
|
924
1100
|
// src/components/style-sections/spacing-section/spacing-section.tsx
|
|
925
|
-
import * as
|
|
926
|
-
import { Divider as Divider2, Stack as
|
|
927
|
-
import { __ as
|
|
1101
|
+
import * as React40 from "react";
|
|
1102
|
+
import { Divider as Divider2, Stack as Stack11 } from "@elementor/ui";
|
|
1103
|
+
import { __ as __18 } from "@wordpress/i18n";
|
|
928
1104
|
|
|
929
1105
|
// src/components/style-sections/spacing-section/linked-dimensions-control.tsx
|
|
930
|
-
import * as
|
|
931
|
-
import {
|
|
1106
|
+
import * as React39 from "react";
|
|
1107
|
+
import { __ as __17 } from "@wordpress/i18n";
|
|
1108
|
+
import { Grid as Grid13, Stack as Stack10, ToggleButton as ToggleButton3 } from "@elementor/ui";
|
|
932
1109
|
import { DetachIcon, LinkIcon, SideBottomIcon, SideLeftIcon, SideRightIcon, SideTopIcon } from "@elementor/icons";
|
|
933
|
-
import { __ as __15 } from "@wordpress/i18n";
|
|
934
1110
|
var LinkedDimensionsControl = ({ label }) => {
|
|
935
1111
|
const { value, setValue } = useControl();
|
|
936
|
-
const { top, right, bottom, left, isLinked =
|
|
1112
|
+
const { top, right, bottom, left, isLinked = true } = value?.value || {};
|
|
937
1113
|
const setLinkedValue = (position, newValue) => {
|
|
938
1114
|
const updatedValue = {
|
|
939
1115
|
isLinked,
|
|
@@ -962,57 +1138,57 @@ var LinkedDimensionsControl = ({ label }) => {
|
|
|
962
1138
|
});
|
|
963
1139
|
};
|
|
964
1140
|
const LinkedIcon = isLinked ? LinkIcon : DetachIcon;
|
|
965
|
-
return /* @__PURE__ */
|
|
1141
|
+
return /* @__PURE__ */ React39.createElement(React39.Fragment, null, /* @__PURE__ */ React39.createElement(Stack10, { direction: "row", gap: 2 }, /* @__PURE__ */ React39.createElement(ControlLabel, null, label), /* @__PURE__ */ React39.createElement(
|
|
966
1142
|
ToggleButton3,
|
|
967
1143
|
{
|
|
968
|
-
"aria-label":
|
|
1144
|
+
"aria-label": __17("Link Inputs", "elementor"),
|
|
969
1145
|
size: "tiny",
|
|
970
1146
|
value: "check",
|
|
971
1147
|
selected: isLinked,
|
|
972
1148
|
sx: { marginLeft: "auto" },
|
|
973
1149
|
onChange: toggleLinked
|
|
974
1150
|
},
|
|
975
|
-
/* @__PURE__ */
|
|
976
|
-
)), /* @__PURE__ */
|
|
1151
|
+
/* @__PURE__ */ React39.createElement(LinkedIcon, { fontSize: "tiny" })
|
|
1152
|
+
)), /* @__PURE__ */ React39.createElement(Stack10, { direction: "row", gap: 2 }, /* @__PURE__ */ React39.createElement(Grid13, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React39.createElement(Grid13, { item: true, xs: 12 }, /* @__PURE__ */ React39.createElement(ControlLabel, null, __17("Top", "elementor"))), /* @__PURE__ */ React39.createElement(Grid13, { item: true, xs: 12 }, /* @__PURE__ */ React39.createElement(
|
|
977
1153
|
Control4,
|
|
978
1154
|
{
|
|
979
1155
|
bind: "top",
|
|
980
1156
|
value: top,
|
|
981
1157
|
setValue: setLinkedValue,
|
|
982
|
-
startIcon: /* @__PURE__ */
|
|
1158
|
+
startIcon: /* @__PURE__ */ React39.createElement(SideTopIcon, { fontSize: "tiny" })
|
|
983
1159
|
}
|
|
984
|
-
)), /* @__PURE__ */
|
|
1160
|
+
))), /* @__PURE__ */ React39.createElement(Grid13, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React39.createElement(Grid13, { item: true, xs: 12 }, /* @__PURE__ */ React39.createElement(ControlLabel, null, __17("Right", "elementor"))), /* @__PURE__ */ React39.createElement(Grid13, { item: true, xs: 12 }, /* @__PURE__ */ React39.createElement(
|
|
985
1161
|
Control4,
|
|
986
1162
|
{
|
|
987
1163
|
bind: "right",
|
|
988
1164
|
value: right,
|
|
989
1165
|
setValue: setLinkedValue,
|
|
990
|
-
startIcon: /* @__PURE__ */
|
|
1166
|
+
startIcon: /* @__PURE__ */ React39.createElement(SideRightIcon, { fontSize: "tiny" })
|
|
991
1167
|
}
|
|
992
|
-
))), /* @__PURE__ */
|
|
1168
|
+
)))), /* @__PURE__ */ React39.createElement(Stack10, { direction: "row", gap: 2 }, /* @__PURE__ */ React39.createElement(Grid13, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React39.createElement(Grid13, { item: true, xs: 12 }, /* @__PURE__ */ React39.createElement(ControlLabel, null, __17("Bottom", "elementor"))), /* @__PURE__ */ React39.createElement(Grid13, { item: true, xs: 12 }, /* @__PURE__ */ React39.createElement(
|
|
993
1169
|
Control4,
|
|
994
1170
|
{
|
|
995
1171
|
bind: "bottom",
|
|
996
1172
|
value: bottom,
|
|
997
1173
|
setValue: setLinkedValue,
|
|
998
|
-
startIcon: /* @__PURE__ */
|
|
1174
|
+
startIcon: /* @__PURE__ */ React39.createElement(SideBottomIcon, { fontSize: "tiny" })
|
|
999
1175
|
}
|
|
1000
|
-
)), /* @__PURE__ */
|
|
1176
|
+
))), /* @__PURE__ */ React39.createElement(Grid13, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React39.createElement(Grid13, { item: true, xs: 12 }, /* @__PURE__ */ React39.createElement(ControlLabel, null, __17("Left", "elementor"))), /* @__PURE__ */ React39.createElement(Grid13, { item: true, xs: 12 }, /* @__PURE__ */ React39.createElement(
|
|
1001
1177
|
Control4,
|
|
1002
1178
|
{
|
|
1003
1179
|
bind: "left",
|
|
1004
1180
|
value: left,
|
|
1005
1181
|
setValue: setLinkedValue,
|
|
1006
|
-
startIcon: /* @__PURE__ */
|
|
1182
|
+
startIcon: /* @__PURE__ */ React39.createElement(SideLeftIcon, { fontSize: "tiny" })
|
|
1007
1183
|
}
|
|
1008
|
-
))));
|
|
1184
|
+
)))));
|
|
1009
1185
|
};
|
|
1010
1186
|
var Control4 = ({
|
|
1011
1187
|
bind,
|
|
1012
1188
|
startIcon,
|
|
1013
1189
|
value,
|
|
1014
1190
|
setValue
|
|
1015
|
-
}) => /* @__PURE__ */
|
|
1191
|
+
}) => /* @__PURE__ */ React39.createElement(
|
|
1016
1192
|
ControlContext.Provider,
|
|
1017
1193
|
{
|
|
1018
1194
|
value: {
|
|
@@ -1021,12 +1197,342 @@ var Control4 = ({
|
|
|
1021
1197
|
value
|
|
1022
1198
|
}
|
|
1023
1199
|
},
|
|
1024
|
-
/* @__PURE__ */
|
|
1200
|
+
/* @__PURE__ */ React39.createElement(SizeControl, { startIcon })
|
|
1025
1201
|
);
|
|
1026
1202
|
|
|
1027
1203
|
// src/components/style-sections/spacing-section/spacing-section.tsx
|
|
1028
1204
|
var SpacingSection = () => {
|
|
1029
|
-
return /* @__PURE__ */
|
|
1205
|
+
return /* @__PURE__ */ React40.createElement(AccordionSection, { title: __18("Spacing", "elementor") }, /* @__PURE__ */ React40.createElement(Stack11, { gap: 1.5 }, /* @__PURE__ */ React40.createElement(StyleControl, { bind: "padding" }, /* @__PURE__ */ React40.createElement(LinkedDimensionsControl, { label: __18("Padding", "elementor") })), /* @__PURE__ */ React40.createElement(Divider2, null), /* @__PURE__ */ React40.createElement(StyleControl, { bind: "margin" }, /* @__PURE__ */ React40.createElement(LinkedDimensionsControl, { label: __18("Margin", "elementor") }))));
|
|
1206
|
+
};
|
|
1207
|
+
|
|
1208
|
+
// src/components/style-sections/effects-section/effects-section.tsx
|
|
1209
|
+
import * as React43 from "react";
|
|
1210
|
+
import { __ as __21 } from "@wordpress/i18n";
|
|
1211
|
+
import { Stack as Stack14 } from "@elementor/ui";
|
|
1212
|
+
|
|
1213
|
+
// src/components/style-sections/effects-section/box-shadow-repeater.tsx
|
|
1214
|
+
import * as React42 from "react";
|
|
1215
|
+
import { __ as __20 } from "@wordpress/i18n";
|
|
1216
|
+
import { Grid as Grid14, Stack as Stack13, UnstableColorIndicator } from "@elementor/ui";
|
|
1217
|
+
|
|
1218
|
+
// src/controls/components/repeater.tsx
|
|
1219
|
+
import * as React41 from "react";
|
|
1220
|
+
import { useId as useId4, useRef, useState as useState3 } from "react";
|
|
1221
|
+
import { __ as __19 } from "@wordpress/i18n";
|
|
1222
|
+
import { PlusIcon, XIcon as XIcon2, CopyIcon, EyeIcon, EyeOffIcon } from "@elementor/icons";
|
|
1223
|
+
import {
|
|
1224
|
+
Box as Box2,
|
|
1225
|
+
Stack as Stack12,
|
|
1226
|
+
Popover as Popover2,
|
|
1227
|
+
IconButton as IconButton2,
|
|
1228
|
+
bindTrigger as bindTrigger2,
|
|
1229
|
+
bindPopover as bindPopover2,
|
|
1230
|
+
usePopupState as usePopupState3,
|
|
1231
|
+
UnstableTag,
|
|
1232
|
+
Typography as Typography3
|
|
1233
|
+
} from "@elementor/ui";
|
|
1234
|
+
var SIZE2 = "tiny";
|
|
1235
|
+
var Repeater = ({
|
|
1236
|
+
label,
|
|
1237
|
+
itemSettings,
|
|
1238
|
+
values: repeaterValues = [],
|
|
1239
|
+
setValues: setRepeaterValues
|
|
1240
|
+
}) => {
|
|
1241
|
+
const addRepeaterItem = () => {
|
|
1242
|
+
const newItem = structuredClone(itemSettings.initialValues);
|
|
1243
|
+
setRepeaterValues([...repeaterValues, newItem]);
|
|
1244
|
+
};
|
|
1245
|
+
const duplicateRepeaterItem = (index) => {
|
|
1246
|
+
setRepeaterValues([
|
|
1247
|
+
...repeaterValues.slice(0, index),
|
|
1248
|
+
structuredClone(repeaterValues[index]),
|
|
1249
|
+
...repeaterValues.slice(index)
|
|
1250
|
+
]);
|
|
1251
|
+
};
|
|
1252
|
+
const removeRepeaterItem = (index) => {
|
|
1253
|
+
setRepeaterValues(repeaterValues.filter((_, i) => i !== index));
|
|
1254
|
+
};
|
|
1255
|
+
const toggleDisableRepeaterItem = (index) => {
|
|
1256
|
+
setRepeaterValues(
|
|
1257
|
+
repeaterValues.map((value, i) => {
|
|
1258
|
+
if (i === index) {
|
|
1259
|
+
const { disabled, ...rest } = value;
|
|
1260
|
+
return { ...rest, ...disabled ? {} : { disabled: true } };
|
|
1261
|
+
}
|
|
1262
|
+
return value;
|
|
1263
|
+
})
|
|
1264
|
+
);
|
|
1265
|
+
};
|
|
1266
|
+
return /* @__PURE__ */ React41.createElement(Stack12, null, /* @__PURE__ */ React41.createElement(Stack12, { direction: "row", justifyContent: "space-between", sx: { py: 0.5 } }, /* @__PURE__ */ React41.createElement(Typography3, { component: "label", variant: "caption", color: "text.secondary" }, label), /* @__PURE__ */ React41.createElement(IconButton2, { size: SIZE2, onClick: addRepeaterItem, "aria-label": __19("Add item", "elementor") }, /* @__PURE__ */ React41.createElement(PlusIcon, { fontSize: SIZE2 }))), /* @__PURE__ */ React41.createElement(Stack12, { gap: 1 }, repeaterValues.map((value, index) => /* @__PURE__ */ React41.createElement(
|
|
1267
|
+
RepeaterItem,
|
|
1268
|
+
{
|
|
1269
|
+
key: index,
|
|
1270
|
+
disabled: value.disabled,
|
|
1271
|
+
label: /* @__PURE__ */ React41.createElement(itemSettings.Label, { value }),
|
|
1272
|
+
startIcon: /* @__PURE__ */ React41.createElement(itemSettings.Icon, { value }),
|
|
1273
|
+
removeItem: () => removeRepeaterItem(index),
|
|
1274
|
+
duplicateItem: () => duplicateRepeaterItem(index),
|
|
1275
|
+
toggleDisableItem: () => toggleDisableRepeaterItem(index)
|
|
1276
|
+
},
|
|
1277
|
+
(props) => /* @__PURE__ */ React41.createElement(
|
|
1278
|
+
itemSettings.Content,
|
|
1279
|
+
{
|
|
1280
|
+
...props,
|
|
1281
|
+
value,
|
|
1282
|
+
setValue: (newValue) => setRepeaterValues(
|
|
1283
|
+
repeaterValues.map((item, i) => i === index ? newValue : item)
|
|
1284
|
+
)
|
|
1285
|
+
}
|
|
1286
|
+
)
|
|
1287
|
+
))));
|
|
1288
|
+
};
|
|
1289
|
+
var RepeaterItem = ({
|
|
1290
|
+
label,
|
|
1291
|
+
disabled,
|
|
1292
|
+
startIcon,
|
|
1293
|
+
children,
|
|
1294
|
+
removeItem,
|
|
1295
|
+
duplicateItem,
|
|
1296
|
+
toggleDisableItem
|
|
1297
|
+
}) => {
|
|
1298
|
+
const popupId = useId4();
|
|
1299
|
+
const tagRef = useRef(null);
|
|
1300
|
+
const [anchorEl, setAnchorEl] = useState3(null);
|
|
1301
|
+
const popoverState = usePopupState3({ popupId, variant: "popover" });
|
|
1302
|
+
const popoverProps = bindPopover2(popoverState);
|
|
1303
|
+
return /* @__PURE__ */ React41.createElement(React41.Fragment, null, /* @__PURE__ */ React41.createElement(
|
|
1304
|
+
UnstableTag,
|
|
1305
|
+
{
|
|
1306
|
+
ref: tagRef,
|
|
1307
|
+
label,
|
|
1308
|
+
showActionsOnHover: true,
|
|
1309
|
+
variant: "outlined",
|
|
1310
|
+
"aria-label": __19("Open item", "elementor"),
|
|
1311
|
+
...bindTrigger2(popoverState),
|
|
1312
|
+
startIcon,
|
|
1313
|
+
actions: /* @__PURE__ */ React41.createElement(React41.Fragment, null, /* @__PURE__ */ React41.createElement(
|
|
1314
|
+
IconButton2,
|
|
1315
|
+
{
|
|
1316
|
+
size: SIZE2,
|
|
1317
|
+
onClick: duplicateItem,
|
|
1318
|
+
"aria-label": __19("Duplicate item", "elementor")
|
|
1319
|
+
},
|
|
1320
|
+
/* @__PURE__ */ React41.createElement(CopyIcon, { fontSize: SIZE2 })
|
|
1321
|
+
), /* @__PURE__ */ React41.createElement(
|
|
1322
|
+
IconButton2,
|
|
1323
|
+
{
|
|
1324
|
+
size: SIZE2,
|
|
1325
|
+
onClick: toggleDisableItem,
|
|
1326
|
+
"aria-label": disabled ? __19("Enable item", "elementor") : __19("Disable item", "elementor")
|
|
1327
|
+
},
|
|
1328
|
+
disabled ? /* @__PURE__ */ React41.createElement(EyeOffIcon, { fontSize: SIZE2 }) : /* @__PURE__ */ React41.createElement(EyeIcon, { fontSize: SIZE2 })
|
|
1329
|
+
), /* @__PURE__ */ React41.createElement(
|
|
1330
|
+
IconButton2,
|
|
1331
|
+
{
|
|
1332
|
+
size: SIZE2,
|
|
1333
|
+
onClick: removeItem,
|
|
1334
|
+
"aria-label": __19("Remove item", "elementor")
|
|
1335
|
+
},
|
|
1336
|
+
/* @__PURE__ */ React41.createElement(XIcon2, { fontSize: SIZE2 })
|
|
1337
|
+
))
|
|
1338
|
+
}
|
|
1339
|
+
), /* @__PURE__ */ React41.createElement(
|
|
1340
|
+
Popover2,
|
|
1341
|
+
{
|
|
1342
|
+
disablePortal: true,
|
|
1343
|
+
slotProps: {
|
|
1344
|
+
paper: { ref: setAnchorEl, sx: { width: tagRef.current?.getBoundingClientRect().width } }
|
|
1345
|
+
},
|
|
1346
|
+
anchorOrigin: { vertical: "bottom", horizontal: "left" },
|
|
1347
|
+
...popoverProps
|
|
1348
|
+
},
|
|
1349
|
+
/* @__PURE__ */ React41.createElement(Box2, { p: 2 }, children({ anchorEl }))
|
|
1350
|
+
));
|
|
1351
|
+
};
|
|
1352
|
+
|
|
1353
|
+
// src/components/style-sections/effects-section/box-shadow-repeater.tsx
|
|
1354
|
+
var BoxShadowRepeater = () => {
|
|
1355
|
+
const { value, setValue } = useControl();
|
|
1356
|
+
const boxShadowValues = value?.value;
|
|
1357
|
+
const setBoxShadow = (newValue) => {
|
|
1358
|
+
setValue({
|
|
1359
|
+
$$type: "box-shadow",
|
|
1360
|
+
value: newValue
|
|
1361
|
+
});
|
|
1362
|
+
};
|
|
1363
|
+
return /* @__PURE__ */ React42.createElement(
|
|
1364
|
+
Repeater,
|
|
1365
|
+
{
|
|
1366
|
+
values: boxShadowValues,
|
|
1367
|
+
setValues: setBoxShadow,
|
|
1368
|
+
label: __20("Box shadow", "elementor"),
|
|
1369
|
+
itemSettings: {
|
|
1370
|
+
Icon: ItemIcon,
|
|
1371
|
+
Label: ItemLabel,
|
|
1372
|
+
Content: ItemContent,
|
|
1373
|
+
initialValues: initialShadow
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
);
|
|
1377
|
+
};
|
|
1378
|
+
var ItemIcon = ({ value }) => /* @__PURE__ */ React42.createElement(UnstableColorIndicator, { size: "inherit", component: "span", value: value.value.color.value });
|
|
1379
|
+
var ItemContent = ({
|
|
1380
|
+
anchorEl,
|
|
1381
|
+
value,
|
|
1382
|
+
setValue
|
|
1383
|
+
}) => {
|
|
1384
|
+
const setShadow = (newValue) => {
|
|
1385
|
+
setValue({
|
|
1386
|
+
$$type: "shadow",
|
|
1387
|
+
value: newValue
|
|
1388
|
+
});
|
|
1389
|
+
};
|
|
1390
|
+
return /* @__PURE__ */ React42.createElement(Stack13, { gap: 1.5 }, /* @__PURE__ */ React42.createElement(Grid14, { container: true, spacing: 1 }, /* @__PURE__ */ React42.createElement(
|
|
1391
|
+
Control5,
|
|
1392
|
+
{
|
|
1393
|
+
bind: "color",
|
|
1394
|
+
value: value.value.color,
|
|
1395
|
+
label: __20("Color", "elementor"),
|
|
1396
|
+
setValue: (v) => setShadow({ ...value.value, color: v })
|
|
1397
|
+
},
|
|
1398
|
+
/* @__PURE__ */ React42.createElement(
|
|
1399
|
+
ColorControl,
|
|
1400
|
+
{
|
|
1401
|
+
anchorEl,
|
|
1402
|
+
anchorOrigin: {
|
|
1403
|
+
vertical: "top",
|
|
1404
|
+
horizontal: "right"
|
|
1405
|
+
},
|
|
1406
|
+
transformOrigin: {
|
|
1407
|
+
vertical: "top",
|
|
1408
|
+
horizontal: -10
|
|
1409
|
+
}
|
|
1410
|
+
}
|
|
1411
|
+
)
|
|
1412
|
+
), /* @__PURE__ */ React42.createElement(
|
|
1413
|
+
Control5,
|
|
1414
|
+
{
|
|
1415
|
+
bind: "position",
|
|
1416
|
+
value: value.value.position,
|
|
1417
|
+
label: __20("Position", "elementor"),
|
|
1418
|
+
setValue: (v) => setShadow({ ...value.value, position: v })
|
|
1419
|
+
},
|
|
1420
|
+
/* @__PURE__ */ React42.createElement(
|
|
1421
|
+
SelectControl,
|
|
1422
|
+
{
|
|
1423
|
+
options: [
|
|
1424
|
+
{ label: "Inset", value: "inset" },
|
|
1425
|
+
{ label: "Outset", value: "outset" }
|
|
1426
|
+
]
|
|
1427
|
+
}
|
|
1428
|
+
)
|
|
1429
|
+
)), /* @__PURE__ */ React42.createElement(Grid14, { container: true, spacing: 1 }, /* @__PURE__ */ React42.createElement(
|
|
1430
|
+
Control5,
|
|
1431
|
+
{
|
|
1432
|
+
bind: "hOffset",
|
|
1433
|
+
label: __20("Horizontal", "elementor"),
|
|
1434
|
+
value: value.value.hOffset,
|
|
1435
|
+
setValue: (v) => setShadow({ ...value.value, hOffset: v })
|
|
1436
|
+
},
|
|
1437
|
+
/* @__PURE__ */ React42.createElement(SizeControl, null)
|
|
1438
|
+
), /* @__PURE__ */ React42.createElement(
|
|
1439
|
+
Control5,
|
|
1440
|
+
{
|
|
1441
|
+
label: __20("Vertical", "elementor"),
|
|
1442
|
+
bind: "vOffset",
|
|
1443
|
+
value: value.value.vOffset,
|
|
1444
|
+
setValue: (v) => setShadow({ ...value.value, vOffset: v })
|
|
1445
|
+
},
|
|
1446
|
+
/* @__PURE__ */ React42.createElement(SizeControl, null)
|
|
1447
|
+
)), /* @__PURE__ */ React42.createElement(Grid14, { container: true, spacing: 1 }, /* @__PURE__ */ React42.createElement(
|
|
1448
|
+
Control5,
|
|
1449
|
+
{
|
|
1450
|
+
bind: "blur",
|
|
1451
|
+
value: value.value.blur,
|
|
1452
|
+
label: __20("Blur", "elementor"),
|
|
1453
|
+
setValue: (v) => setShadow({ ...value.value, blur: v })
|
|
1454
|
+
},
|
|
1455
|
+
/* @__PURE__ */ React42.createElement(SizeControl, null)
|
|
1456
|
+
), /* @__PURE__ */ React42.createElement(
|
|
1457
|
+
Control5,
|
|
1458
|
+
{
|
|
1459
|
+
bind: "spread",
|
|
1460
|
+
label: __20("Spread", "elementor"),
|
|
1461
|
+
value: value.value.spread,
|
|
1462
|
+
setValue: (v) => setShadow({ ...value.value, spread: v })
|
|
1463
|
+
},
|
|
1464
|
+
/* @__PURE__ */ React42.createElement(SizeControl, null)
|
|
1465
|
+
)));
|
|
1466
|
+
};
|
|
1467
|
+
var Control5 = ({
|
|
1468
|
+
value,
|
|
1469
|
+
setValue,
|
|
1470
|
+
label,
|
|
1471
|
+
bind,
|
|
1472
|
+
children
|
|
1473
|
+
}) => /* @__PURE__ */ React42.createElement(ControlContext.Provider, { value: { value, setValue, bind } }, /* @__PURE__ */ React42.createElement(Grid14, { item: true, xs: 6 }, /* @__PURE__ */ React42.createElement(Grid14, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React42.createElement(Grid14, { item: true, xs: 12 }, /* @__PURE__ */ React42.createElement(ControlLabel, null, label)), /* @__PURE__ */ React42.createElement(Grid14, { item: true, xs: 12 }, children))));
|
|
1474
|
+
var ItemLabel = ({ value }) => {
|
|
1475
|
+
const { position, hOffset, vOffset, blur, spread } = value.value;
|
|
1476
|
+
const { size: hOffsetSize, unit: hOffsetUnit } = hOffset.value;
|
|
1477
|
+
const { size: vOffsetSize, unit: vOffsetUnit } = vOffset.value;
|
|
1478
|
+
const { size: blurSize, unit: blurUnit } = blur.value;
|
|
1479
|
+
const { size: spreadSize, unit: spreadUnit } = spread.value;
|
|
1480
|
+
const sizes = [
|
|
1481
|
+
hOffsetSize + hOffsetUnit,
|
|
1482
|
+
vOffsetSize + vOffsetUnit,
|
|
1483
|
+
blurSize + blurUnit,
|
|
1484
|
+
spreadSize + spreadUnit
|
|
1485
|
+
].join(" ");
|
|
1486
|
+
return /* @__PURE__ */ React42.createElement("span", { style: { textTransform: "capitalize" } }, position, ": ", sizes);
|
|
1487
|
+
};
|
|
1488
|
+
var initialShadow = {
|
|
1489
|
+
$$type: "shadow",
|
|
1490
|
+
value: {
|
|
1491
|
+
hOffset: {
|
|
1492
|
+
$$type: "size",
|
|
1493
|
+
value: { unit: "px", size: 0 }
|
|
1494
|
+
},
|
|
1495
|
+
vOffset: {
|
|
1496
|
+
$$type: "size",
|
|
1497
|
+
value: { unit: "px", size: 0 }
|
|
1498
|
+
},
|
|
1499
|
+
blur: {
|
|
1500
|
+
$$type: "size",
|
|
1501
|
+
value: { unit: "px", size: 0 }
|
|
1502
|
+
},
|
|
1503
|
+
spread: {
|
|
1504
|
+
$$type: "size",
|
|
1505
|
+
value: { unit: "px", size: 0 }
|
|
1506
|
+
},
|
|
1507
|
+
color: {
|
|
1508
|
+
$$type: "color",
|
|
1509
|
+
value: "rgba(0, 0, 0, 0)"
|
|
1510
|
+
},
|
|
1511
|
+
position: "inset"
|
|
1512
|
+
}
|
|
1513
|
+
};
|
|
1514
|
+
|
|
1515
|
+
// src/components/style-sections/effects-section/effects-section.tsx
|
|
1516
|
+
var EffectsSection = () => {
|
|
1517
|
+
return /* @__PURE__ */ React43.createElement(AccordionSection, { title: __21("Effects", "elementor") }, /* @__PURE__ */ React43.createElement(Stack14, { gap: 1.5 }, /* @__PURE__ */ React43.createElement(StyleControl, { bind: "box-shadow" }, /* @__PURE__ */ React43.createElement(BoxShadowRepeater, null))));
|
|
1518
|
+
};
|
|
1519
|
+
|
|
1520
|
+
// src/components/style-sections/background-section/background-section.tsx
|
|
1521
|
+
import * as React45 from "react";
|
|
1522
|
+
import { __ as __23 } from "@wordpress/i18n";
|
|
1523
|
+
import { Stack as Stack15 } from "@elementor/ui";
|
|
1524
|
+
|
|
1525
|
+
// src/components/style-sections/background-section/background-color-control.tsx
|
|
1526
|
+
import * as React44 from "react";
|
|
1527
|
+
import { __ as __22 } from "@wordpress/i18n";
|
|
1528
|
+
import { Grid as Grid15 } from "@elementor/ui";
|
|
1529
|
+
var BackgroundColorControl = () => {
|
|
1530
|
+
return /* @__PURE__ */ React44.createElement(StyleControl, { bind: "background-color" }, /* @__PURE__ */ React44.createElement(Grid15, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React44.createElement(Grid15, { item: true, xs: 6 }, /* @__PURE__ */ React44.createElement(StyleControl.Label, null, __22("Color", "elementor"))), /* @__PURE__ */ React44.createElement(Grid15, { item: true, xs: 6 }, /* @__PURE__ */ React44.createElement(ColorControl, null))));
|
|
1531
|
+
};
|
|
1532
|
+
|
|
1533
|
+
// src/components/style-sections/background-section/background-section.tsx
|
|
1534
|
+
var BackgroundSection = () => {
|
|
1535
|
+
return /* @__PURE__ */ React45.createElement(AccordionSection, { title: __23("Background", "elementor") }, /* @__PURE__ */ React45.createElement(Stack15, { gap: 1.5 }, /* @__PURE__ */ React45.createElement(BackgroundColorControl, null)));
|
|
1030
1536
|
};
|
|
1031
1537
|
|
|
1032
1538
|
// src/components/style-tab.tsx
|
|
@@ -1034,18 +1540,20 @@ var CLASSES_PROP_KEY = "classes";
|
|
|
1034
1540
|
var StyleTab = () => {
|
|
1035
1541
|
const styleDefinition = useStyleDefinition();
|
|
1036
1542
|
const classesProp = useClassesProp();
|
|
1037
|
-
return /* @__PURE__ */
|
|
1543
|
+
return /* @__PURE__ */ React46.createElement(StyleContext, { selectedStyleDef: styleDefinition, selectedClassesProp: classesProp }, /* @__PURE__ */ React46.createElement(Stack16, null, /* @__PURE__ */ React46.createElement(SizeSection, null), /* @__PURE__ */ React46.createElement(PositionSection, null), /* @__PURE__ */ React46.createElement(TypographySection, null), /* @__PURE__ */ React46.createElement(BackgroundSection, null), /* @__PURE__ */ React46.createElement(SpacingSection, null), /* @__PURE__ */ React46.createElement(EffectsSection, null)));
|
|
1038
1544
|
};
|
|
1039
1545
|
function useClassesProp() {
|
|
1040
|
-
const { elementType } =
|
|
1041
|
-
const prop = Object.entries(elementType.propsSchema).find(
|
|
1546
|
+
const { elementType } = useElement();
|
|
1547
|
+
const prop = Object.entries(elementType.propsSchema).find(
|
|
1548
|
+
([, propType]) => propType.kind === "array" && propType.key === CLASSES_PROP_KEY
|
|
1549
|
+
);
|
|
1042
1550
|
if (!prop) {
|
|
1043
1551
|
throw new Error("Element does not have a classes prop");
|
|
1044
1552
|
}
|
|
1045
1553
|
return prop[0];
|
|
1046
1554
|
}
|
|
1047
1555
|
function useStyleDefinition() {
|
|
1048
|
-
const { element } =
|
|
1556
|
+
const { element } = useElement();
|
|
1049
1557
|
const elementStyles = useElementStyles(element.id);
|
|
1050
1558
|
return Object.values(elementStyles || {})[0] ?? null;
|
|
1051
1559
|
}
|
|
@@ -1053,9 +1561,19 @@ function useStyleDefinition() {
|
|
|
1053
1561
|
// src/components/editing-panel-tabs.tsx
|
|
1054
1562
|
var EditingPanelTabs = () => {
|
|
1055
1563
|
const { getTabProps, getTabPanelProps, getTabsProps } = useTabs("settings");
|
|
1056
|
-
return /* @__PURE__ */
|
|
1564
|
+
return /* @__PURE__ */ React47.createElement(Stack17, { direction: "column", sx: { width: "100%" } }, /* @__PURE__ */ React47.createElement(Tabs, { variant: "fullWidth", indicatorColor: "secondary", textColor: "inherit", ...getTabsProps() }, /* @__PURE__ */ React47.createElement(Tab, { label: __24("General", "elementor"), ...getTabProps("settings") }), /* @__PURE__ */ React47.createElement(Tab, { label: __24("Style", "elementor"), ...getTabProps("style") })), /* @__PURE__ */ React47.createElement(TabPanel, { ...getTabPanelProps("settings"), disablePadding: true }, /* @__PURE__ */ React47.createElement(SettingsTab, null)), /* @__PURE__ */ React47.createElement(TabPanel, { ...getTabPanelProps("style"), disablePadding: true }, /* @__PURE__ */ React47.createElement(StyleTab, null)));
|
|
1057
1565
|
};
|
|
1058
1566
|
|
|
1567
|
+
// src/components/editing-panel.tsx
|
|
1568
|
+
import { ErrorBoundary as ErrorBoundary2 } from "@elementor/ui";
|
|
1569
|
+
|
|
1570
|
+
// src/components/editing-panel-error-fallback.tsx
|
|
1571
|
+
import * as React48 from "react";
|
|
1572
|
+
import { Alert, Box as Box3 } from "@elementor/ui";
|
|
1573
|
+
function EditorPanelErrorFallback() {
|
|
1574
|
+
return /* @__PURE__ */ React48.createElement(Box3, { role: "alert", sx: { minHeight: "100%", p: 2 } }, /* @__PURE__ */ React48.createElement(Alert, { severity: "error", sx: { mb: 2, maxWidth: 400, textAlign: "center" } }, /* @__PURE__ */ React48.createElement("strong", null, "Something went wrong")));
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1059
1577
|
// src/components/editing-panel.tsx
|
|
1060
1578
|
var EditingPanel = () => {
|
|
1061
1579
|
const elements = useSelectedElements();
|
|
@@ -1064,8 +1582,9 @@ var EditingPanel = () => {
|
|
|
1064
1582
|
if (elements.length !== 1 || !elementType) {
|
|
1065
1583
|
return null;
|
|
1066
1584
|
}
|
|
1067
|
-
const
|
|
1068
|
-
|
|
1585
|
+
const controlReplacement = getControlReplacement();
|
|
1586
|
+
const panelTitle = __25("Edit %s", "elementor").replace("%s", elementType.title);
|
|
1587
|
+
return /* @__PURE__ */ React49.createElement(ErrorBoundary2, { fallback: /* @__PURE__ */ React49.createElement(EditorPanelErrorFallback, null) }, /* @__PURE__ */ React49.createElement(Panel, null, /* @__PURE__ */ React49.createElement(PanelHeader, null, /* @__PURE__ */ React49.createElement(PanelHeaderTitle, null, panelTitle)), /* @__PURE__ */ React49.createElement(PanelBody, null, /* @__PURE__ */ React49.createElement(ControlReplacementProvider, { ...controlReplacement }, /* @__PURE__ */ React49.createElement(ElementProvider, { element: selectedElement, elementType }, /* @__PURE__ */ React49.createElement(EditingPanelTabs, null))))));
|
|
1069
1588
|
};
|
|
1070
1589
|
|
|
1071
1590
|
// src/panel.ts
|
|
@@ -1112,11 +1631,14 @@ import { __registerPanel as registerPanel } from "@elementor/editor-panels";
|
|
|
1112
1631
|
import { __privateBlockDataCommand as blockDataCommand } from "@elementor/editor-v1-adapters";
|
|
1113
1632
|
|
|
1114
1633
|
// src/dynamics/components/dynamic-selection-control.tsx
|
|
1115
|
-
import * as
|
|
1116
|
-
import { useId as
|
|
1634
|
+
import * as React52 from "react";
|
|
1635
|
+
import { useId as useId5 } from "react";
|
|
1117
1636
|
|
|
1118
1637
|
// src/dynamics/dynamic-control.tsx
|
|
1119
|
-
import * as
|
|
1638
|
+
import * as React50 from "react";
|
|
1639
|
+
|
|
1640
|
+
// src/dynamics/hooks/use-dynamic-tag.ts
|
|
1641
|
+
import { useMemo as useMemo2 } from "react";
|
|
1120
1642
|
|
|
1121
1643
|
// src/dynamics/hooks/use-prop-dynamic-tags.ts
|
|
1122
1644
|
import { useMemo } from "react";
|
|
@@ -1139,7 +1661,7 @@ var getAtomicDynamicTags = () => {
|
|
|
1139
1661
|
};
|
|
1140
1662
|
};
|
|
1141
1663
|
|
|
1142
|
-
// src/props/is-transformable.ts
|
|
1664
|
+
// src/controls/props/is-transformable.ts
|
|
1143
1665
|
import { z } from "@elementor/schema";
|
|
1144
1666
|
var transformableSchema = z.object({
|
|
1145
1667
|
$$type: z.string(),
|
|
@@ -1150,18 +1672,26 @@ var isTransformable = (value) => {
|
|
|
1150
1672
|
};
|
|
1151
1673
|
|
|
1152
1674
|
// src/dynamics/utils.ts
|
|
1153
|
-
var
|
|
1675
|
+
var DYNAMIC_PROP_TYPE_KEY = "dynamic";
|
|
1676
|
+
var isDynamicPropType = (prop) => prop.key === DYNAMIC_PROP_TYPE_KEY;
|
|
1677
|
+
var getDynamicPropType = (propType) => {
|
|
1678
|
+
const dynamicPropType = propType.kind === "union" && propType.prop_types[DYNAMIC_PROP_TYPE_KEY];
|
|
1679
|
+
return dynamicPropType && isDynamicPropType(dynamicPropType) ? dynamicPropType : null;
|
|
1680
|
+
};
|
|
1154
1681
|
var isDynamicPropValue = (prop) => {
|
|
1155
|
-
return isTransformable(prop) && prop.$$type ===
|
|
1682
|
+
return isTransformable(prop) && prop.$$type === DYNAMIC_PROP_TYPE_KEY;
|
|
1683
|
+
};
|
|
1684
|
+
var supportsDynamic = (propType) => {
|
|
1685
|
+
return !!getDynamicPropType(propType);
|
|
1156
1686
|
};
|
|
1157
1687
|
|
|
1158
1688
|
// src/dynamics/hooks/use-prop-dynamic-tags.ts
|
|
1159
1689
|
var usePropDynamicTags = (propName) => {
|
|
1160
1690
|
let categories = [];
|
|
1161
|
-
const { elementType } =
|
|
1162
|
-
const
|
|
1163
|
-
if (
|
|
1164
|
-
const propDynamicType =
|
|
1691
|
+
const { elementType } = useElement();
|
|
1692
|
+
const propType = elementType.propsSchema?.[propName];
|
|
1693
|
+
if (propType) {
|
|
1694
|
+
const propDynamicType = getDynamicPropType(propType);
|
|
1165
1695
|
categories = propDynamicType?.settings.categories || [];
|
|
1166
1696
|
}
|
|
1167
1697
|
return useMemo(() => getDynamicTagsByCategories(categories), [categories.join()]);
|
|
@@ -1178,7 +1708,6 @@ var getDynamicTagsByCategories = (categories) => {
|
|
|
1178
1708
|
};
|
|
1179
1709
|
|
|
1180
1710
|
// src/dynamics/hooks/use-dynamic-tag.ts
|
|
1181
|
-
import { useMemo as useMemo2 } from "react";
|
|
1182
1711
|
var useDynamicTag = (propName, tagName) => {
|
|
1183
1712
|
const dynamicTags = usePropDynamicTags(propName);
|
|
1184
1713
|
return useMemo2(() => dynamicTags.find((tag) => tag.name === tagName) ?? null, [dynamicTags, tagName]);
|
|
@@ -1192,7 +1721,7 @@ var DynamicControl = ({ bind, children }) => {
|
|
|
1192
1721
|
if (!dynamicTag) {
|
|
1193
1722
|
throw new Error(`Dynamic tag ${name} not found`);
|
|
1194
1723
|
}
|
|
1195
|
-
const defaultValue = dynamicTag.props_schema[bind]?.
|
|
1724
|
+
const defaultValue = dynamicTag.props_schema[bind]?.default;
|
|
1196
1725
|
const dynamicValue = settings?.[bind] ?? defaultValue;
|
|
1197
1726
|
const setDynamicValue = (newValue) => {
|
|
1198
1727
|
setValue({
|
|
@@ -1206,35 +1735,35 @@ var DynamicControl = ({ bind, children }) => {
|
|
|
1206
1735
|
}
|
|
1207
1736
|
});
|
|
1208
1737
|
};
|
|
1209
|
-
return /* @__PURE__ */
|
|
1738
|
+
return /* @__PURE__ */ React50.createElement(ControlContext.Provider, { value: { setValue: setDynamicValue, value: dynamicValue, bind } }, children);
|
|
1210
1739
|
};
|
|
1211
1740
|
|
|
1212
1741
|
// src/dynamics/components/dynamic-selection-control.tsx
|
|
1213
|
-
import { DatabaseIcon, SettingsIcon, XIcon } from "@elementor/icons";
|
|
1742
|
+
import { DatabaseIcon, SettingsIcon, XIcon as XIcon3 } from "@elementor/icons";
|
|
1214
1743
|
|
|
1215
1744
|
// src/dynamics/components/dynamic-selection.tsx
|
|
1216
|
-
import * as
|
|
1217
|
-
import { useState as
|
|
1745
|
+
import * as React51 from "react";
|
|
1746
|
+
import { useState as useState4, Fragment as Fragment4 } from "react";
|
|
1218
1747
|
import { SearchIcon, PhotoIcon } from "@elementor/icons";
|
|
1219
1748
|
import {
|
|
1220
|
-
Box,
|
|
1749
|
+
Box as Box4,
|
|
1221
1750
|
Divider as Divider3,
|
|
1222
1751
|
InputAdornment as InputAdornment3,
|
|
1223
1752
|
Link,
|
|
1224
1753
|
ListSubheader,
|
|
1225
1754
|
MenuItem as MenuItem3,
|
|
1226
1755
|
MenuList,
|
|
1227
|
-
Stack as
|
|
1756
|
+
Stack as Stack18,
|
|
1228
1757
|
TextField as TextField5,
|
|
1229
|
-
Typography as
|
|
1758
|
+
Typography as Typography4
|
|
1230
1759
|
} from "@elementor/ui";
|
|
1231
|
-
import { __ as
|
|
1760
|
+
import { __ as __26 } from "@wordpress/i18n";
|
|
1232
1761
|
|
|
1233
1762
|
// src/dynamics/hooks/use-prop-value-history.ts
|
|
1234
1763
|
var PROPS_VALUES_HISTORY_KEY = "elementor/dynamic/non-dynamic-values-history";
|
|
1235
1764
|
var usePropValueHistory = (path) => {
|
|
1236
1765
|
const valuesHistory = getValues();
|
|
1237
|
-
const { element } =
|
|
1766
|
+
const { element } = useElement();
|
|
1238
1767
|
const key = `${element.id}-${path}`;
|
|
1239
1768
|
const value = valuesHistory[key] ?? null;
|
|
1240
1769
|
const setValue = (newValue) => {
|
|
@@ -1250,14 +1779,14 @@ var setValues = (values) => {
|
|
|
1250
1779
|
};
|
|
1251
1780
|
|
|
1252
1781
|
// src/dynamics/components/dynamic-selection.tsx
|
|
1253
|
-
var
|
|
1782
|
+
var SIZE3 = "tiny";
|
|
1254
1783
|
var DynamicSelection = ({ onSelect }) => {
|
|
1255
|
-
const [searchValue, setSearchValue] =
|
|
1784
|
+
const [searchValue, setSearchValue] = useState4("");
|
|
1256
1785
|
const { groups: dynamicGroups } = getAtomicDynamicTags() || {};
|
|
1257
1786
|
const { bind, value: currentValue, setValue } = useControl();
|
|
1258
1787
|
const [, updatePropValueHistory] = usePropValueHistory(bind);
|
|
1259
1788
|
const isCurrentValueDynamic = isDynamicPropValue(currentValue);
|
|
1260
|
-
const
|
|
1789
|
+
const options4 = useFilteredOptions(bind, searchValue);
|
|
1261
1790
|
const handleSearch = (event) => {
|
|
1262
1791
|
setSearchValue(event.target.value);
|
|
1263
1792
|
};
|
|
@@ -1265,24 +1794,24 @@ var DynamicSelection = ({ onSelect }) => {
|
|
|
1265
1794
|
if (!isCurrentValueDynamic) {
|
|
1266
1795
|
updatePropValueHistory(currentValue);
|
|
1267
1796
|
}
|
|
1268
|
-
setValue({ $$type: "dynamic", value: { name: value } });
|
|
1797
|
+
setValue({ $$type: "dynamic", value: { name: value, settings: {} } });
|
|
1269
1798
|
onSelect?.();
|
|
1270
1799
|
};
|
|
1271
|
-
return /* @__PURE__ */
|
|
1800
|
+
return /* @__PURE__ */ React51.createElement(Stack18, null, /* @__PURE__ */ React51.createElement(Box4, { px: 1.5, pb: 1 }, /* @__PURE__ */ React51.createElement(
|
|
1272
1801
|
TextField5,
|
|
1273
1802
|
{
|
|
1274
1803
|
fullWidth: true,
|
|
1275
|
-
size:
|
|
1804
|
+
size: SIZE3,
|
|
1276
1805
|
value: searchValue,
|
|
1277
1806
|
onChange: handleSearch,
|
|
1278
|
-
placeholder:
|
|
1807
|
+
placeholder: __26("Search dynamic tag", "elementor"),
|
|
1279
1808
|
InputProps: {
|
|
1280
|
-
startAdornment: /* @__PURE__ */
|
|
1809
|
+
startAdornment: /* @__PURE__ */ React51.createElement(InputAdornment3, { position: "start" }, /* @__PURE__ */ React51.createElement(SearchIcon, { fontSize: SIZE3 }))
|
|
1281
1810
|
}
|
|
1282
1811
|
}
|
|
1283
|
-
)), /* @__PURE__ */
|
|
1812
|
+
)), /* @__PURE__ */ React51.createElement(Divider3, null), /* @__PURE__ */ React51.createElement(Box4, { sx: { overflowY: "auto", height: 260, width: 220 } }, options4.length > 0 ? /* @__PURE__ */ React51.createElement(MenuList, { role: "listbox", tabIndex: 0 }, options4.map(([category, items], index) => /* @__PURE__ */ React51.createElement(Fragment4, { key: index }, /* @__PURE__ */ React51.createElement(ListSubheader, { sx: { typography: "caption", color: "text.tertiary" } }, dynamicGroups?.[category]?.title || category), items.map(({ value, label: tagLabel }) => {
|
|
1284
1813
|
const isSelected = isCurrentValueDynamic && value === currentValue?.value?.name;
|
|
1285
|
-
return /* @__PURE__ */
|
|
1814
|
+
return /* @__PURE__ */ React51.createElement(
|
|
1286
1815
|
MenuItem3,
|
|
1287
1816
|
{
|
|
1288
1817
|
key: value,
|
|
@@ -1293,7 +1822,7 @@ var DynamicSelection = ({ onSelect }) => {
|
|
|
1293
1822
|
},
|
|
1294
1823
|
tagLabel
|
|
1295
1824
|
);
|
|
1296
|
-
})))) : /* @__PURE__ */
|
|
1825
|
+
})))) : /* @__PURE__ */ React51.createElement(Stack18, { alignItems: "center", p: 2.5, gap: 1.5 }, /* @__PURE__ */ React51.createElement(PhotoIcon, { fontSize: "large" }), /* @__PURE__ */ React51.createElement(Typography4, { align: "center", variant: "caption", color: "text.secondary" }, __26("Sorry, nothing matched", "elementor"), /* @__PURE__ */ React51.createElement("br", null), "\u201C", searchValue, "\u201D."), /* @__PURE__ */ React51.createElement(Typography4, { align: "center", variant: "caption", color: "text.secondary" }, /* @__PURE__ */ React51.createElement(
|
|
1297
1826
|
Link,
|
|
1298
1827
|
{
|
|
1299
1828
|
color: "secondary",
|
|
@@ -1301,12 +1830,12 @@ var DynamicSelection = ({ onSelect }) => {
|
|
|
1301
1830
|
component: "button",
|
|
1302
1831
|
onClick: () => setSearchValue("")
|
|
1303
1832
|
},
|
|
1304
|
-
|
|
1305
|
-
), "\xA0",
|
|
1833
|
+
__26("Clear the filters", "elementor")
|
|
1834
|
+
), "\xA0", __26("and try again.", "elementor")))));
|
|
1306
1835
|
};
|
|
1307
1836
|
var useFilteredOptions = (bind, searchValue) => {
|
|
1308
1837
|
const dynamicTags = usePropDynamicTags(bind);
|
|
1309
|
-
const
|
|
1838
|
+
const options4 = dynamicTags.reduce((categories, { name, label, group }) => {
|
|
1310
1839
|
const isVisible = label.toLowerCase().includes(searchValue.trim().toLowerCase());
|
|
1311
1840
|
if (!isVisible) {
|
|
1312
1841
|
return categories;
|
|
@@ -1317,35 +1846,35 @@ var useFilteredOptions = (bind, searchValue) => {
|
|
|
1317
1846
|
categories.get(group)?.push({ label, value: name });
|
|
1318
1847
|
return categories;
|
|
1319
1848
|
}, /* @__PURE__ */ new Map());
|
|
1320
|
-
return [...
|
|
1849
|
+
return [...options4];
|
|
1321
1850
|
};
|
|
1322
1851
|
|
|
1323
1852
|
// src/dynamics/components/dynamic-selection-control.tsx
|
|
1324
1853
|
import {
|
|
1325
|
-
bindPopover,
|
|
1326
|
-
bindTrigger as
|
|
1327
|
-
Box as
|
|
1328
|
-
IconButton,
|
|
1854
|
+
bindPopover as bindPopover3,
|
|
1855
|
+
bindTrigger as bindTrigger3,
|
|
1856
|
+
Box as Box5,
|
|
1857
|
+
IconButton as IconButton3,
|
|
1329
1858
|
Paper,
|
|
1330
|
-
Popover,
|
|
1331
|
-
Stack as
|
|
1332
|
-
Typography as
|
|
1859
|
+
Popover as Popover3,
|
|
1860
|
+
Stack as Stack19,
|
|
1861
|
+
Typography as Typography5,
|
|
1333
1862
|
UnstableTag as Tag,
|
|
1334
|
-
usePopupState as
|
|
1863
|
+
usePopupState as usePopupState4,
|
|
1335
1864
|
Tabs as Tabs2,
|
|
1336
1865
|
Divider as Divider4,
|
|
1337
1866
|
useTabs as useTabs2,
|
|
1338
1867
|
Tab as Tab2,
|
|
1339
1868
|
TabPanel as TabPanel2
|
|
1340
1869
|
} from "@elementor/ui";
|
|
1341
|
-
import { __ as
|
|
1342
|
-
var
|
|
1870
|
+
import { __ as __27 } from "@wordpress/i18n";
|
|
1871
|
+
var SIZE4 = "tiny";
|
|
1343
1872
|
var DynamicSelectionControl = () => {
|
|
1344
1873
|
const { bind, value, setValue } = useControl();
|
|
1345
1874
|
const [propValueFromHistory] = usePropValueHistory(bind);
|
|
1346
1875
|
const { name: tagName = "" } = value?.value || {};
|
|
1347
|
-
const selectionPopoverId =
|
|
1348
|
-
const selectionPopoverState =
|
|
1876
|
+
const selectionPopoverId = useId5();
|
|
1877
|
+
const selectionPopoverState = usePopupState4({ variant: "popover", popupId: selectionPopoverId });
|
|
1349
1878
|
const dynamicTag = useDynamicTag(bind, tagName);
|
|
1350
1879
|
const removeDynamicTag = () => {
|
|
1351
1880
|
setValue(propValueFromHistory ?? null);
|
|
@@ -1353,58 +1882,58 @@ var DynamicSelectionControl = () => {
|
|
|
1353
1882
|
if (!dynamicTag) {
|
|
1354
1883
|
throw new Error(`Dynamic tag ${tagName} not found`);
|
|
1355
1884
|
}
|
|
1356
|
-
return /* @__PURE__ */
|
|
1885
|
+
return /* @__PURE__ */ React52.createElement(Box5, null, /* @__PURE__ */ React52.createElement(
|
|
1357
1886
|
Tag,
|
|
1358
1887
|
{
|
|
1359
1888
|
fullWidth: true,
|
|
1360
1889
|
showActionsOnHover: true,
|
|
1361
1890
|
label: dynamicTag.label,
|
|
1362
|
-
startIcon: /* @__PURE__ */
|
|
1363
|
-
...
|
|
1364
|
-
actions: /* @__PURE__ */
|
|
1365
|
-
|
|
1891
|
+
startIcon: /* @__PURE__ */ React52.createElement(DatabaseIcon, { fontSize: SIZE4 }),
|
|
1892
|
+
...bindTrigger3(selectionPopoverState),
|
|
1893
|
+
actions: /* @__PURE__ */ React52.createElement(React52.Fragment, null, /* @__PURE__ */ React52.createElement(DynamicSettingsPopover, { dynamicTag }), /* @__PURE__ */ React52.createElement(
|
|
1894
|
+
IconButton3,
|
|
1366
1895
|
{
|
|
1367
|
-
size:
|
|
1896
|
+
size: SIZE4,
|
|
1368
1897
|
onClick: removeDynamicTag,
|
|
1369
|
-
"aria-label":
|
|
1898
|
+
"aria-label": __27("Remove dynamic value", "elementor")
|
|
1370
1899
|
},
|
|
1371
|
-
/* @__PURE__ */
|
|
1900
|
+
/* @__PURE__ */ React52.createElement(XIcon3, { fontSize: SIZE4 })
|
|
1372
1901
|
))
|
|
1373
1902
|
}
|
|
1374
|
-
), /* @__PURE__ */
|
|
1375
|
-
|
|
1903
|
+
), /* @__PURE__ */ React52.createElement(
|
|
1904
|
+
Popover3,
|
|
1376
1905
|
{
|
|
1377
1906
|
disablePortal: true,
|
|
1378
1907
|
disableScrollLock: true,
|
|
1379
1908
|
anchorOrigin: { vertical: "bottom", horizontal: "left" },
|
|
1380
|
-
...
|
|
1909
|
+
...bindPopover3(selectionPopoverState)
|
|
1381
1910
|
},
|
|
1382
|
-
/* @__PURE__ */
|
|
1911
|
+
/* @__PURE__ */ React52.createElement(Stack19, null, /* @__PURE__ */ React52.createElement(Stack19, { direction: "row", alignItems: "center", pl: 1.5, pr: 0.5, py: 1.5 }, /* @__PURE__ */ React52.createElement(DatabaseIcon, { fontSize: SIZE4, sx: { mr: 0.5 } }), /* @__PURE__ */ React52.createElement(Typography5, { variant: "subtitle2" }, __27("Dynamic Tags", "elementor")), /* @__PURE__ */ React52.createElement(IconButton3, { size: SIZE4, sx: { ml: "auto" }, onClick: selectionPopoverState.close }, /* @__PURE__ */ React52.createElement(XIcon3, { fontSize: SIZE4 }))), /* @__PURE__ */ React52.createElement(DynamicSelection, { onSelect: selectionPopoverState.close }))
|
|
1383
1912
|
));
|
|
1384
1913
|
};
|
|
1385
1914
|
var DynamicSettingsPopover = ({ dynamicTag }) => {
|
|
1386
|
-
const popupId =
|
|
1387
|
-
const settingsPopupState =
|
|
1915
|
+
const popupId = useId5();
|
|
1916
|
+
const settingsPopupState = usePopupState4({ variant: "popover", popupId });
|
|
1388
1917
|
const hasDynamicSettings = !!dynamicTag.atomic_controls.length;
|
|
1389
1918
|
if (!hasDynamicSettings) {
|
|
1390
1919
|
return null;
|
|
1391
1920
|
}
|
|
1392
|
-
return /* @__PURE__ */
|
|
1393
|
-
|
|
1921
|
+
return /* @__PURE__ */ React52.createElement(React52.Fragment, null, /* @__PURE__ */ React52.createElement(
|
|
1922
|
+
IconButton3,
|
|
1394
1923
|
{
|
|
1395
|
-
size:
|
|
1396
|
-
...
|
|
1397
|
-
"aria-label":
|
|
1924
|
+
size: SIZE4,
|
|
1925
|
+
...bindTrigger3(settingsPopupState),
|
|
1926
|
+
"aria-label": __27("Settings", "elementor")
|
|
1398
1927
|
},
|
|
1399
|
-
/* @__PURE__ */
|
|
1400
|
-
), /* @__PURE__ */
|
|
1401
|
-
|
|
1928
|
+
/* @__PURE__ */ React52.createElement(SettingsIcon, { fontSize: SIZE4 })
|
|
1929
|
+
), /* @__PURE__ */ React52.createElement(
|
|
1930
|
+
Popover3,
|
|
1402
1931
|
{
|
|
1403
1932
|
disableScrollLock: true,
|
|
1404
1933
|
anchorOrigin: { vertical: "bottom", horizontal: "center" },
|
|
1405
|
-
...
|
|
1934
|
+
...bindPopover3(settingsPopupState)
|
|
1406
1935
|
},
|
|
1407
|
-
/* @__PURE__ */
|
|
1936
|
+
/* @__PURE__ */ React52.createElement(Paper, { component: Stack19, sx: { minHeight: "300px", width: "220px" } }, /* @__PURE__ */ React52.createElement(Stack19, { direction: "row", alignItems: "center", px: 1.5, pt: 2, pb: 1 }, /* @__PURE__ */ React52.createElement(DatabaseIcon, { fontSize: SIZE4, sx: { mr: 0.5 } }), /* @__PURE__ */ React52.createElement(Typography5, { variant: "subtitle2" }, dynamicTag.label), /* @__PURE__ */ React52.createElement(IconButton3, { sx: { ml: "auto" }, size: SIZE4, onClick: settingsPopupState.close }, /* @__PURE__ */ React52.createElement(XIcon3, { fontSize: SIZE4 }))), /* @__PURE__ */ React52.createElement(DynamicSettings, { controls: dynamicTag.atomic_controls }))
|
|
1408
1937
|
));
|
|
1409
1938
|
};
|
|
1410
1939
|
var DynamicSettings = ({ controls }) => {
|
|
@@ -1413,28 +1942,50 @@ var DynamicSettings = ({ controls }) => {
|
|
|
1413
1942
|
if (!tabs.length) {
|
|
1414
1943
|
return null;
|
|
1415
1944
|
}
|
|
1416
|
-
return /* @__PURE__ */
|
|
1417
|
-
return /* @__PURE__ */
|
|
1945
|
+
return /* @__PURE__ */ React52.createElement(React52.Fragment, null, /* @__PURE__ */ React52.createElement(Tabs2, { indicatorColor: "secondary", textColor: "secondary", ...getTabsProps() }, tabs.map(({ value }, index) => /* @__PURE__ */ React52.createElement(Tab2, { key: index, label: value.label, sx: { px: 1, py: 0.5 }, ...getTabProps(index) }))), /* @__PURE__ */ React52.createElement(Divider4, null), tabs.map(({ value }, index) => {
|
|
1946
|
+
return /* @__PURE__ */ React52.createElement(TabPanel2, { key: index, sx: { flexGrow: 1 }, ...getTabPanelProps(index) }, /* @__PURE__ */ React52.createElement(Stack19, { gap: 1, px: 2 }, value.items.map((item) => {
|
|
1418
1947
|
if (item.type === "control") {
|
|
1419
|
-
return /* @__PURE__ */
|
|
1948
|
+
return /* @__PURE__ */ React52.createElement(Control6, { key: item.value.bind, control: item.value });
|
|
1420
1949
|
}
|
|
1421
1950
|
return null;
|
|
1422
1951
|
})));
|
|
1423
1952
|
}));
|
|
1424
1953
|
};
|
|
1425
|
-
var
|
|
1954
|
+
var Control6 = ({ control }) => {
|
|
1426
1955
|
if (!getControlByType(control.type)) {
|
|
1427
1956
|
return null;
|
|
1428
1957
|
}
|
|
1429
|
-
return /* @__PURE__ */
|
|
1958
|
+
return /* @__PURE__ */ React52.createElement(DynamicControl, { bind: control.bind }, control.label ? /* @__PURE__ */ React52.createElement(ControlLabel, null, control.label) : null, /* @__PURE__ */ React52.createElement(Control, { type: control.type, props: control.props }));
|
|
1959
|
+
};
|
|
1960
|
+
|
|
1961
|
+
// src/dynamics/hooks/use-prop-dynamic-action.tsx
|
|
1962
|
+
import * as React53 from "react";
|
|
1963
|
+
import { DatabaseIcon as DatabaseIcon2 } from "@elementor/icons";
|
|
1964
|
+
import { __ as __28 } from "@wordpress/i18n";
|
|
1965
|
+
var usePropDynamicAction = () => {
|
|
1966
|
+
const { bind } = useControl();
|
|
1967
|
+
const { elementType } = useElement();
|
|
1968
|
+
const propType = elementType.propsSchema[bind];
|
|
1969
|
+
const visible = !!propType && supportsDynamic(propType);
|
|
1970
|
+
return {
|
|
1971
|
+
visible,
|
|
1972
|
+
icon: DatabaseIcon2,
|
|
1973
|
+
title: __28("Dynamic Tags", "elementor"),
|
|
1974
|
+
popoverContent: ({ closePopover }) => /* @__PURE__ */ React53.createElement(DynamicSelection, { onSelect: closePopover })
|
|
1975
|
+
};
|
|
1430
1976
|
};
|
|
1431
1977
|
|
|
1432
1978
|
// src/dynamics/init.ts
|
|
1979
|
+
var { registerPopoverAction } = controlActionsMenu;
|
|
1433
1980
|
var init = () => {
|
|
1434
1981
|
replaceControl({
|
|
1435
1982
|
component: DynamicSelectionControl,
|
|
1436
1983
|
condition: ({ value }) => isDynamicPropValue(value)
|
|
1437
1984
|
});
|
|
1985
|
+
registerPopoverAction({
|
|
1986
|
+
id: "dynamic-tags",
|
|
1987
|
+
useProps: usePropDynamicAction
|
|
1988
|
+
});
|
|
1438
1989
|
};
|
|
1439
1990
|
|
|
1440
1991
|
// src/init.ts
|
|
@@ -1457,6 +2008,7 @@ var blockV1Panel = () => {
|
|
|
1457
2008
|
// src/index.ts
|
|
1458
2009
|
init2();
|
|
1459
2010
|
export {
|
|
2011
|
+
controlActionsMenu,
|
|
1460
2012
|
replaceControl,
|
|
1461
2013
|
useControl
|
|
1462
2014
|
};
|