@elementor/editor-editing-panel 1.8.1 → 1.9.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 +42 -0
- package/dist/index.d.mts +15 -3
- package/dist/index.d.ts +15 -3
- package/dist/index.js +392 -369
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +378 -358
- package/dist/index.mjs.map +1 -1
- package/package.json +12 -11
- package/src/components/css-class-menu.tsx +2 -2
- package/src/components/css-class-selector.tsx +13 -5
- package/src/components/editable-field.tsx +10 -2
- package/src/components/style-sections/layout-section/flex-size-field.tsx +3 -2
- package/src/components/style-tab.tsx +2 -2
- package/src/contexts/css-class-item-context.tsx +2 -2
- package/src/contexts/style-context.tsx +3 -3
- package/src/controls-registry/settings-field.tsx +2 -2
- package/src/css-classes.ts +2 -2
- package/src/hooks/use-styles-fields.ts +18 -8
- package/src/hooks/use-unapply-class.ts +3 -3
- package/src/index.ts +2 -0
package/dist/index.mjs
CHANGED
|
@@ -23,7 +23,7 @@ import { __ } from "@wordpress/i18n";
|
|
|
23
23
|
|
|
24
24
|
// src/contexts/css-class-item-context.tsx
|
|
25
25
|
import * as React from "react";
|
|
26
|
-
import { createContext } from "react";
|
|
26
|
+
import { createContext, useContext } from "react";
|
|
27
27
|
var ClassItemContext = createContext({
|
|
28
28
|
styleId: "",
|
|
29
29
|
isGlobal: false,
|
|
@@ -33,7 +33,7 @@ function CssClassItemProvider({ styleId, isGlobal, isActive, children }) {
|
|
|
33
33
|
return /* @__PURE__ */ React.createElement(ClassItemContext.Provider, { value: { styleId, isGlobal, isActive } }, children);
|
|
34
34
|
}
|
|
35
35
|
function useCssClassItem() {
|
|
36
|
-
const context =
|
|
36
|
+
const context = useContext(ClassItemContext);
|
|
37
37
|
if (!context) {
|
|
38
38
|
throw new Error("useCssClassItem must be used within a CssClassItemProvider");
|
|
39
39
|
}
|
|
@@ -123,301 +123,10 @@ var StyledMenuItem = styled(MenuItem)({
|
|
|
123
123
|
}
|
|
124
124
|
});
|
|
125
125
|
|
|
126
|
-
// src/init.ts
|
|
127
|
-
import { injectIntoLogic } from "@elementor/editor";
|
|
128
|
-
import { __registerPanel as registerPanel } from "@elementor/editor-panels";
|
|
129
|
-
import { __privateBlockDataCommand as blockDataCommand } from "@elementor/editor-v1-adapters";
|
|
130
|
-
|
|
131
|
-
// src/hooks/use-close-editor-panel.ts
|
|
132
|
-
import { useEffect as useEffect4 } from "react";
|
|
133
|
-
import { getSelectedElements as getSelectedElements2, isElementInContainer } from "@elementor/editor-elements";
|
|
134
|
-
import { __privateListenTo as listenTo, commandStartEvent } from "@elementor/editor-v1-adapters";
|
|
135
|
-
|
|
136
|
-
// src/panel.ts
|
|
137
|
-
import { __createPanel as createPanel } from "@elementor/editor-panels";
|
|
138
|
-
|
|
139
|
-
// src/components/editing-panel.tsx
|
|
140
|
-
import * as React62 from "react";
|
|
141
|
-
import { ControlActionsProvider, ControlReplacementProvider } from "@elementor/editor-controls";
|
|
142
|
-
import { useSelectedElement } from "@elementor/editor-elements";
|
|
143
|
-
import { Panel, PanelBody, PanelHeader, PanelHeaderTitle } from "@elementor/editor-panels";
|
|
144
|
-
import { SessionStorageProvider as SessionStorageProvider3 } from "@elementor/session";
|
|
145
|
-
import { ErrorBoundary } from "@elementor/ui";
|
|
146
|
-
import { __ as __40 } from "@wordpress/i18n";
|
|
147
|
-
|
|
148
|
-
// src/contexts/element-context.tsx
|
|
149
|
-
import * as React4 from "react";
|
|
150
|
-
import { createContext as createContext3, useContext as useContext3 } from "react";
|
|
151
|
-
var Context2 = createContext3(null);
|
|
152
|
-
function ElementProvider({ children, element, elementType }) {
|
|
153
|
-
return /* @__PURE__ */ React4.createElement(Context2.Provider, { value: { element, elementType } }, children);
|
|
154
|
-
}
|
|
155
|
-
function useElement() {
|
|
156
|
-
const context = useContext3(Context2);
|
|
157
|
-
if (!context) {
|
|
158
|
-
throw new Error("useElement must be used within a ElementProvider");
|
|
159
|
-
}
|
|
160
|
-
return context;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
// src/controls-actions.ts
|
|
164
|
-
import { createMenu as createMenu2 } from "@elementor/menus";
|
|
165
|
-
|
|
166
|
-
// src/popover-action.tsx
|
|
167
|
-
import * as React5 from "react";
|
|
168
|
-
import { useId } from "react";
|
|
169
|
-
import { XIcon } from "@elementor/icons";
|
|
170
|
-
import { bindPopover, bindToggle, IconButton, Popover, Stack, Tooltip, Typography, usePopupState } from "@elementor/ui";
|
|
171
|
-
var SIZE = "tiny";
|
|
172
|
-
function PopoverAction({
|
|
173
|
-
title,
|
|
174
|
-
visible = true,
|
|
175
|
-
icon: Icon,
|
|
176
|
-
popoverContent: PopoverContent
|
|
177
|
-
}) {
|
|
178
|
-
const id = useId();
|
|
179
|
-
const popupState = usePopupState({
|
|
180
|
-
variant: "popover",
|
|
181
|
-
popupId: `elementor-popover-action-${id}`
|
|
182
|
-
});
|
|
183
|
-
if (!visible) {
|
|
184
|
-
return null;
|
|
185
|
-
}
|
|
186
|
-
return /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement(Tooltip, { placement: "top", title }, /* @__PURE__ */ React5.createElement(IconButton, { "aria-label": title, key: id, size: SIZE, ...bindToggle(popupState) }, /* @__PURE__ */ React5.createElement(Icon, { fontSize: SIZE }))), /* @__PURE__ */ React5.createElement(
|
|
187
|
-
Popover,
|
|
188
|
-
{
|
|
189
|
-
disablePortal: true,
|
|
190
|
-
disableScrollLock: true,
|
|
191
|
-
anchorOrigin: {
|
|
192
|
-
vertical: "bottom",
|
|
193
|
-
horizontal: "center"
|
|
194
|
-
},
|
|
195
|
-
...bindPopover(popupState)
|
|
196
|
-
},
|
|
197
|
-
/* @__PURE__ */ React5.createElement(Stack, { direction: "row", alignItems: "center", pl: 1.5, pr: 0.5, py: 1.5 }, /* @__PURE__ */ React5.createElement(Icon, { fontSize: SIZE, sx: { mr: 0.5 } }), /* @__PURE__ */ React5.createElement(Typography, { variant: "subtitle2" }, title), /* @__PURE__ */ React5.createElement(IconButton, { sx: { ml: "auto" }, size: SIZE, onClick: popupState.close }, /* @__PURE__ */ React5.createElement(XIcon, { fontSize: SIZE }))),
|
|
198
|
-
/* @__PURE__ */ React5.createElement(PopoverContent, { closePopover: popupState.close })
|
|
199
|
-
));
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
// src/controls-actions.ts
|
|
203
|
-
var controlActionsMenu = createMenu2({
|
|
204
|
-
components: {
|
|
205
|
-
PopoverAction
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
// src/components/editing-panel-error-fallback.tsx
|
|
210
|
-
import * as React6 from "react";
|
|
211
|
-
import { Alert, Box as Box2 } from "@elementor/ui";
|
|
212
|
-
function EditorPanelErrorFallback() {
|
|
213
|
-
return /* @__PURE__ */ React6.createElement(Box2, { role: "alert", sx: { minHeight: "100%", p: 2 } }, /* @__PURE__ */ React6.createElement(Alert, { severity: "error", sx: { mb: 2, maxWidth: 400, textAlign: "center" } }, /* @__PURE__ */ React6.createElement("strong", null, "Something went wrong")));
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
// src/components/editing-panel-tabs.tsx
|
|
217
|
-
import * as React61 from "react";
|
|
218
|
-
import { Fragment as Fragment7 } from "react";
|
|
219
|
-
import { Divider as Divider8, Stack as Stack19, Tab, TabPanel, Tabs, useTabs } from "@elementor/ui";
|
|
220
|
-
import { __ as __39 } from "@wordpress/i18n";
|
|
221
|
-
|
|
222
|
-
// src/components/settings-tab.tsx
|
|
223
|
-
import * as React12 from "react";
|
|
224
|
-
import { ControlLabel } from "@elementor/editor-controls";
|
|
225
|
-
import { SessionStorageProvider } from "@elementor/session";
|
|
226
|
-
|
|
227
|
-
// src/controls-registry/control.tsx
|
|
228
|
-
import * as React7 from "react";
|
|
229
|
-
import { createError } from "@elementor/utils";
|
|
230
|
-
|
|
231
|
-
// src/controls-registry/controls-registry.tsx
|
|
232
|
-
import {
|
|
233
|
-
ImageControl,
|
|
234
|
-
LinkControl,
|
|
235
|
-
SelectControl,
|
|
236
|
-
SizeControl,
|
|
237
|
-
TextAreaControl,
|
|
238
|
-
TextControl,
|
|
239
|
-
UrlControl
|
|
240
|
-
} from "@elementor/editor-controls";
|
|
241
|
-
var controlTypes = {
|
|
242
|
-
image: { component: ImageControl, layout: "full" },
|
|
243
|
-
text: { component: TextControl, layout: "two-columns" },
|
|
244
|
-
textarea: { component: TextAreaControl, layout: "full" },
|
|
245
|
-
size: { component: SizeControl, layout: "two-columns" },
|
|
246
|
-
select: { component: SelectControl, layout: "two-columns" },
|
|
247
|
-
link: { component: LinkControl, layout: "full" },
|
|
248
|
-
url: { component: UrlControl, layout: "full" }
|
|
249
|
-
};
|
|
250
|
-
var getControlByType = (type) => controlTypes[type]?.component;
|
|
251
|
-
var getLayoutByType = (type) => controlTypes[type].layout;
|
|
252
|
-
|
|
253
|
-
// src/controls-registry/control.tsx
|
|
254
|
-
var ControlTypeError = createError({
|
|
255
|
-
code: "CONTROL_TYPE_NOT_FOUND",
|
|
256
|
-
message: `Control type not found.`
|
|
257
|
-
});
|
|
258
|
-
var Control = ({ props, type }) => {
|
|
259
|
-
const ControlByType = getControlByType(type);
|
|
260
|
-
if (!ControlByType) {
|
|
261
|
-
throw new ControlTypeError({
|
|
262
|
-
context: { type }
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
return /* @__PURE__ */ React7.createElement(ControlByType, { ...props });
|
|
266
|
-
};
|
|
267
|
-
|
|
268
|
-
// src/controls-registry/control-type-container.tsx
|
|
269
|
-
import * as React8 from "react";
|
|
270
|
-
import { Box as Box3, styled as styled2 } from "@elementor/ui";
|
|
271
|
-
var ControlTypeContainer = ({
|
|
272
|
-
controlType,
|
|
273
|
-
children
|
|
274
|
-
}) => {
|
|
275
|
-
const layout = getLayoutByType(controlType);
|
|
276
|
-
return /* @__PURE__ */ React8.createElement(StyledContainer, { layout }, children);
|
|
277
|
-
};
|
|
278
|
-
var StyledContainer = styled2(Box3, {
|
|
279
|
-
shouldForwardProp: (prop) => !["layout"].includes(prop)
|
|
280
|
-
})(({ layout, theme }) => ({
|
|
281
|
-
display: "grid",
|
|
282
|
-
gridGap: theme.spacing(1),
|
|
283
|
-
...getGridLayout(layout)
|
|
284
|
-
}));
|
|
285
|
-
var getGridLayout = (layout) => ({
|
|
286
|
-
justifyContent: "space-between",
|
|
287
|
-
gridTemplateColumns: {
|
|
288
|
-
full: "1fr",
|
|
289
|
-
"two-columns": "repeat(2, 1fr)"
|
|
290
|
-
}[layout]
|
|
291
|
-
});
|
|
292
|
-
|
|
293
|
-
// src/controls-registry/settings-field.tsx
|
|
294
|
-
import * as React9 from "react";
|
|
295
|
-
import { PropKeyProvider, PropProvider } from "@elementor/editor-controls";
|
|
296
|
-
import { updateSettings, useElementSetting } from "@elementor/editor-elements";
|
|
297
|
-
|
|
298
|
-
// src/controls-registry/create-top-level-object-type.ts
|
|
299
|
-
var createTopLevelOjectType = ({ schema }) => {
|
|
300
|
-
const schemaPropType = {
|
|
301
|
-
key: "",
|
|
302
|
-
kind: "object",
|
|
303
|
-
meta: {},
|
|
304
|
-
settings: {},
|
|
305
|
-
default: null,
|
|
306
|
-
shape: schema
|
|
307
|
-
};
|
|
308
|
-
return schemaPropType;
|
|
309
|
-
};
|
|
310
|
-
|
|
311
|
-
// src/controls-registry/settings-field.tsx
|
|
312
|
-
var SettingsField = ({ bind, children }) => {
|
|
313
|
-
const { element, elementType } = useElement();
|
|
314
|
-
const settingsValue = useElementSetting(element.id, bind);
|
|
315
|
-
const value = { [bind]: settingsValue };
|
|
316
|
-
const propType = createTopLevelOjectType({ schema: elementType.propsSchema });
|
|
317
|
-
const setValue = (newValue) => {
|
|
318
|
-
updateSettings({
|
|
319
|
-
id: element.id,
|
|
320
|
-
props: { ...newValue }
|
|
321
|
-
});
|
|
322
|
-
};
|
|
323
|
-
return /* @__PURE__ */ React9.createElement(PropProvider, { propType, value, setValue }, /* @__PURE__ */ React9.createElement(PropKeyProvider, { bind }, children));
|
|
324
|
-
};
|
|
325
|
-
|
|
326
|
-
// src/components/section.tsx
|
|
327
|
-
import * as React10 from "react";
|
|
328
|
-
import { useId as useId2, useState } from "react";
|
|
329
|
-
import { Collapse, Divider, ListItemButton, ListItemText as ListItemText2, Stack as Stack2 } from "@elementor/ui";
|
|
330
|
-
|
|
331
|
-
// src/components/collapse-icon.tsx
|
|
332
|
-
import { ChevronDownIcon } from "@elementor/icons";
|
|
333
|
-
import { styled as styled3 } from "@elementor/ui";
|
|
334
|
-
var CollapseIcon = styled3(ChevronDownIcon, {
|
|
335
|
-
shouldForwardProp: (prop) => prop !== "open"
|
|
336
|
-
})(({ theme, open }) => ({
|
|
337
|
-
transform: open ? "rotate(180deg)" : "rotate(0deg)",
|
|
338
|
-
transition: theme.transitions.create("transform", {
|
|
339
|
-
duration: theme.transitions.duration.standard
|
|
340
|
-
})
|
|
341
|
-
}));
|
|
342
|
-
|
|
343
|
-
// src/components/section.tsx
|
|
344
|
-
function Section({ title, children, defaultExpanded = false }) {
|
|
345
|
-
const [isOpen, setIsOpen] = useState(!!defaultExpanded);
|
|
346
|
-
const id = useId2();
|
|
347
|
-
const labelId = `label-${id}`;
|
|
348
|
-
const contentId = `content-${id}`;
|
|
349
|
-
return /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement(
|
|
350
|
-
ListItemButton,
|
|
351
|
-
{
|
|
352
|
-
id: labelId,
|
|
353
|
-
"aria-controls": contentId,
|
|
354
|
-
onClick: () => setIsOpen((prev) => !prev)
|
|
355
|
-
},
|
|
356
|
-
/* @__PURE__ */ React10.createElement(ListItemText2, { secondary: title }),
|
|
357
|
-
/* @__PURE__ */ React10.createElement(CollapseIcon, { open: isOpen, color: "secondary" })
|
|
358
|
-
), /* @__PURE__ */ React10.createElement(Collapse, { id: contentId, "aria-labelledby": labelId, in: isOpen, timeout: "auto", unmountOnExit: true }, /* @__PURE__ */ React10.createElement(Stack2, { gap: 2.5, p: 2 }, children)), /* @__PURE__ */ React10.createElement(Divider, null));
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
// src/components/sections-list.tsx
|
|
362
|
-
import * as React11 from "react";
|
|
363
|
-
import { List } from "@elementor/ui";
|
|
364
|
-
function SectionsList(props) {
|
|
365
|
-
return /* @__PURE__ */ React11.createElement(List, { disablePadding: true, component: "div", ...props });
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
// src/components/settings-tab.tsx
|
|
369
|
-
var SettingsTab = () => {
|
|
370
|
-
const { elementType, element } = useElement();
|
|
371
|
-
return /* @__PURE__ */ React12.createElement(SessionStorageProvider, { prefix: element.id }, /* @__PURE__ */ React12.createElement(SectionsList, null, elementType.controls.map(({ type, value }, index) => {
|
|
372
|
-
if (type === "control") {
|
|
373
|
-
return /* @__PURE__ */ React12.createElement(Control2, { key: value.bind, control: value });
|
|
374
|
-
}
|
|
375
|
-
if (type === "section") {
|
|
376
|
-
return /* @__PURE__ */ React12.createElement(Section, { title: value.label, key: type + "." + index, defaultExpanded: true }, value.items?.map((item) => {
|
|
377
|
-
if (item.type === "control") {
|
|
378
|
-
return /* @__PURE__ */ React12.createElement(Control2, { key: item.value.bind, control: item.value });
|
|
379
|
-
}
|
|
380
|
-
return null;
|
|
381
|
-
}));
|
|
382
|
-
}
|
|
383
|
-
return null;
|
|
384
|
-
})));
|
|
385
|
-
};
|
|
386
|
-
var Control2 = ({ control }) => {
|
|
387
|
-
if (!getControlByType(control.type)) {
|
|
388
|
-
return null;
|
|
389
|
-
}
|
|
390
|
-
return /* @__PURE__ */ React12.createElement(SettingsField, { bind: control.bind }, /* @__PURE__ */ React12.createElement(ControlTypeContainer, { controlType: control.type }, control.label ? /* @__PURE__ */ React12.createElement(ControlLabel, null, control.label) : null, /* @__PURE__ */ React12.createElement(Control, { type: control.type, props: control.props })));
|
|
391
|
-
};
|
|
392
|
-
|
|
393
|
-
// src/components/style-tab.tsx
|
|
394
|
-
import * as React60 from "react";
|
|
395
|
-
import { useState as useState9 } from "react";
|
|
396
|
-
import { useElementSetting as useElementSetting3, useElementStyles } from "@elementor/editor-elements";
|
|
397
|
-
import { useActiveBreakpoint } from "@elementor/editor-responsive";
|
|
398
|
-
import { SessionStorageProvider as SessionStorageProvider2 } from "@elementor/session";
|
|
399
|
-
import { Divider as Divider7 } from "@elementor/ui";
|
|
400
|
-
import { __ as __38 } from "@wordpress/i18n";
|
|
401
|
-
|
|
402
|
-
// src/contexts/classes-prop-context.tsx
|
|
403
|
-
import * as React13 from "react";
|
|
404
|
-
import { createContext as createContext4, useContext as useContext4 } from "react";
|
|
405
|
-
var Context3 = createContext4(null);
|
|
406
|
-
function ClassesPropProvider({ children, prop }) {
|
|
407
|
-
return /* @__PURE__ */ React13.createElement(Context3.Provider, { value: { prop } }, children);
|
|
408
|
-
}
|
|
409
|
-
function useClassesProp() {
|
|
410
|
-
const context = useContext4(Context3);
|
|
411
|
-
if (!context) {
|
|
412
|
-
throw new Error("useClassesProp must be used within a ClassesPropProvider");
|
|
413
|
-
}
|
|
414
|
-
return context.prop;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
126
|
// src/components/css-class-selector.tsx
|
|
418
|
-
import * as
|
|
419
|
-
import { useId as
|
|
420
|
-
import { getElementSetting,
|
|
127
|
+
import * as React9 from "react";
|
|
128
|
+
import { useId as useId2, useRef as useRef3 } from "react";
|
|
129
|
+
import { getElementSetting, updateElementSettings, useElementSetting } from "@elementor/editor-elements";
|
|
421
130
|
import { classesPropTypeUtil } from "@elementor/editor-props";
|
|
422
131
|
import {
|
|
423
132
|
ELEMENTS_STYLES_PROVIDER_KEY,
|
|
@@ -426,23 +135,54 @@ import {
|
|
|
426
135
|
useCreateActionsByProvider
|
|
427
136
|
} from "@elementor/editor-styles-repository";
|
|
428
137
|
import { DotsVerticalIcon } from "@elementor/icons";
|
|
138
|
+
import { createLocation } from "@elementor/locations";
|
|
429
139
|
import {
|
|
430
140
|
bindTrigger,
|
|
431
141
|
Chip,
|
|
432
|
-
Stack
|
|
433
|
-
Typography
|
|
142
|
+
Stack,
|
|
143
|
+
Typography,
|
|
434
144
|
UnstableChipGroup,
|
|
435
|
-
usePopupState
|
|
145
|
+
usePopupState
|
|
436
146
|
} from "@elementor/ui";
|
|
437
147
|
import { __ as __2 } from "@wordpress/i18n";
|
|
438
148
|
|
|
149
|
+
// src/contexts/classes-prop-context.tsx
|
|
150
|
+
import * as React4 from "react";
|
|
151
|
+
import { createContext as createContext3, useContext as useContext3 } from "react";
|
|
152
|
+
var Context2 = createContext3(null);
|
|
153
|
+
function ClassesPropProvider({ children, prop }) {
|
|
154
|
+
return /* @__PURE__ */ React4.createElement(Context2.Provider, { value: { prop } }, children);
|
|
155
|
+
}
|
|
156
|
+
function useClassesProp() {
|
|
157
|
+
const context = useContext3(Context2);
|
|
158
|
+
if (!context) {
|
|
159
|
+
throw new Error("useClassesProp must be used within a ClassesPropProvider");
|
|
160
|
+
}
|
|
161
|
+
return context.prop;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// src/contexts/element-context.tsx
|
|
165
|
+
import * as React5 from "react";
|
|
166
|
+
import { createContext as createContext4, useContext as useContext4 } from "react";
|
|
167
|
+
var Context3 = createContext4(null);
|
|
168
|
+
function ElementProvider({ children, element, elementType }) {
|
|
169
|
+
return /* @__PURE__ */ React5.createElement(Context3.Provider, { value: { element, elementType } }, children);
|
|
170
|
+
}
|
|
171
|
+
function useElement() {
|
|
172
|
+
const context = useContext4(Context3);
|
|
173
|
+
if (!context) {
|
|
174
|
+
throw new Error("useElement must be used within a ElementProvider");
|
|
175
|
+
}
|
|
176
|
+
return context;
|
|
177
|
+
}
|
|
178
|
+
|
|
439
179
|
// src/components/conditional-tooltip-wrapper.tsx
|
|
440
|
-
import { useEffect, useRef, useState
|
|
441
|
-
import * as
|
|
442
|
-
import { Box as
|
|
180
|
+
import { useEffect, useRef, useState } from "react";
|
|
181
|
+
import * as React6 from "react";
|
|
182
|
+
import { Box as Box2, Tooltip } from "@elementor/ui";
|
|
443
183
|
var ConditionalTooltipWrapper = ({ maxWidth, title }) => {
|
|
444
184
|
const elRef = useRef(null);
|
|
445
|
-
const [isOverflown, setIsOverflown] =
|
|
185
|
+
const [isOverflown, setIsOverflown] = useState(false);
|
|
446
186
|
useEffect(() => {
|
|
447
187
|
const onResize = () => {
|
|
448
188
|
const element = elRef.current;
|
|
@@ -457,12 +197,12 @@ var ConditionalTooltipWrapper = ({ maxWidth, title }) => {
|
|
|
457
197
|
};
|
|
458
198
|
}, []);
|
|
459
199
|
if (isOverflown) {
|
|
460
|
-
return /* @__PURE__ */
|
|
200
|
+
return /* @__PURE__ */ React6.createElement(Tooltip, { title, placement: "top" }, /* @__PURE__ */ React6.createElement(Content, { maxWidth, ref: elRef }, title));
|
|
461
201
|
}
|
|
462
|
-
return /* @__PURE__ */
|
|
202
|
+
return /* @__PURE__ */ React6.createElement(Content, { maxWidth, ref: elRef }, title);
|
|
463
203
|
};
|
|
464
|
-
var Content =
|
|
465
|
-
|
|
204
|
+
var Content = React6.forwardRef(({ maxWidth, ...tooltipProps }, ref) => /* @__PURE__ */ React6.createElement(
|
|
205
|
+
Box2,
|
|
466
206
|
{
|
|
467
207
|
ref,
|
|
468
208
|
position: "relative",
|
|
@@ -472,9 +212,9 @@ var Content = React14.forwardRef(({ maxWidth, ...tooltipProps }, ref) => /* @__P
|
|
|
472
212
|
));
|
|
473
213
|
|
|
474
214
|
// src/components/editable-field.tsx
|
|
475
|
-
import * as
|
|
476
|
-
import { createContext as createContext5, useContext as useContext5, useEffect as useEffect2, useRef as useRef2, useState as
|
|
477
|
-
import { Tooltip as
|
|
215
|
+
import * as React7 from "react";
|
|
216
|
+
import { createContext as createContext5, useContext as useContext5, useEffect as useEffect2, useRef as useRef2, useState as useState2 } from "react";
|
|
217
|
+
import { Tooltip as Tooltip2 } from "@elementor/ui";
|
|
478
218
|
var Context4 = createContext5(null);
|
|
479
219
|
var EditableFieldProvider = ({
|
|
480
220
|
children,
|
|
@@ -483,9 +223,9 @@ var EditableFieldProvider = ({
|
|
|
483
223
|
validation,
|
|
484
224
|
editable
|
|
485
225
|
}) => {
|
|
486
|
-
const [isEditing, setIsEditing] =
|
|
487
|
-
const [submitting, setSubmitting] =
|
|
488
|
-
const [error, setError] =
|
|
226
|
+
const [isEditing, setIsEditing] = useState2(false);
|
|
227
|
+
const [submitting, setSubmitting] = useState2(false);
|
|
228
|
+
const [error, setError] = useState2(null);
|
|
489
229
|
const openEditMode = () => {
|
|
490
230
|
setIsEditing(true);
|
|
491
231
|
};
|
|
@@ -510,7 +250,7 @@ var EditableFieldProvider = ({
|
|
|
510
250
|
setError(validation(newValue));
|
|
511
251
|
}
|
|
512
252
|
};
|
|
513
|
-
return /* @__PURE__ */
|
|
253
|
+
return /* @__PURE__ */ React7.createElement(
|
|
514
254
|
Context4.Provider,
|
|
515
255
|
{
|
|
516
256
|
value: {
|
|
@@ -528,7 +268,7 @@ var EditableFieldProvider = ({
|
|
|
528
268
|
children
|
|
529
269
|
);
|
|
530
270
|
};
|
|
531
|
-
var EditableField = ({ children, ...props }) => {
|
|
271
|
+
var EditableField = ({ children, onClick, ...props }) => {
|
|
532
272
|
const ref = useRef2(null);
|
|
533
273
|
const { isEditing, closeEditMode, value, onChange, error, submit, editable } = useEditableField();
|
|
534
274
|
useEffect2(() => {
|
|
@@ -547,6 +287,12 @@ var EditableField = ({ children, ...props }) => {
|
|
|
547
287
|
return submit(event.target.innerText);
|
|
548
288
|
}
|
|
549
289
|
};
|
|
290
|
+
const handleClick = (event) => {
|
|
291
|
+
if (isEditing) {
|
|
292
|
+
event.stopPropagation();
|
|
293
|
+
}
|
|
294
|
+
onClick?.(event);
|
|
295
|
+
};
|
|
550
296
|
const selectAll = () => {
|
|
551
297
|
const selection = getSelection();
|
|
552
298
|
if (!selection || !ref.current) {
|
|
@@ -560,7 +306,7 @@ var EditableField = ({ children, ...props }) => {
|
|
|
560
306
|
if (!editable) {
|
|
561
307
|
return children;
|
|
562
308
|
}
|
|
563
|
-
return /* @__PURE__ */
|
|
309
|
+
return /* @__PURE__ */ React7.createElement(Tooltip2, { open: !!error, title: error, placement: "top" }, /* @__PURE__ */ React7.createElement("div", { onKeyDown: handleKeyDown, onClick: handleClick, ...props }, /* @__PURE__ */ React7.createElement(
|
|
564
310
|
"span",
|
|
565
311
|
{
|
|
566
312
|
ref,
|
|
@@ -582,13 +328,13 @@ var useEditableField = () => {
|
|
|
582
328
|
};
|
|
583
329
|
|
|
584
330
|
// src/components/multi-combobox.tsx
|
|
585
|
-
import * as
|
|
586
|
-
import { useId
|
|
331
|
+
import * as React8 from "react";
|
|
332
|
+
import { useId, useState as useState3 } from "react";
|
|
587
333
|
import {
|
|
588
334
|
Autocomplete,
|
|
589
|
-
Box as
|
|
335
|
+
Box as Box3,
|
|
590
336
|
createFilterOptions,
|
|
591
|
-
styled as
|
|
337
|
+
styled as styled2,
|
|
592
338
|
TextField
|
|
593
339
|
} from "@elementor/ui";
|
|
594
340
|
function MultiCombobox({
|
|
@@ -600,7 +346,7 @@ function MultiCombobox({
|
|
|
600
346
|
}) {
|
|
601
347
|
const filter = useFilterOptions();
|
|
602
348
|
const { run, loading } = useActionRunner();
|
|
603
|
-
return /* @__PURE__ */
|
|
349
|
+
return /* @__PURE__ */ React8.createElement(
|
|
604
350
|
Autocomplete,
|
|
605
351
|
{
|
|
606
352
|
...props,
|
|
@@ -613,8 +359,8 @@ function MultiCombobox({
|
|
|
613
359
|
disabled: loading,
|
|
614
360
|
value: selected,
|
|
615
361
|
options: options10,
|
|
616
|
-
renderGroup: (params) => /* @__PURE__ */
|
|
617
|
-
renderInput: (params) => /* @__PURE__ */
|
|
362
|
+
renderGroup: (params) => /* @__PURE__ */ React8.createElement(Group, { ...params }),
|
|
363
|
+
renderInput: (params) => /* @__PURE__ */ React8.createElement(TextField, { ...params }),
|
|
618
364
|
onChange: (_, selectedOrInputValue, reason) => {
|
|
619
365
|
const inputValue = selectedOrInputValue.find((option) => typeof option === "string");
|
|
620
366
|
const optionsAndActions = selectedOrInputValue.filter((option) => typeof option !== "string");
|
|
@@ -653,28 +399,28 @@ function MultiCombobox({
|
|
|
653
399
|
);
|
|
654
400
|
}
|
|
655
401
|
var Group = (params) => {
|
|
656
|
-
const id = `combobox-group-${
|
|
657
|
-
return /* @__PURE__ */
|
|
402
|
+
const id = `combobox-group-${useId().replace(/:/g, "_")}`;
|
|
403
|
+
return /* @__PURE__ */ React8.createElement(StyledGroup, { role: "group", "aria-labelledby": id }, /* @__PURE__ */ React8.createElement(StyledGroupHeader, { id }, " ", params.group), /* @__PURE__ */ React8.createElement(StyledGroupItems, { role: "listbox" }, params.children));
|
|
658
404
|
};
|
|
659
|
-
var StyledGroup =
|
|
405
|
+
var StyledGroup = styled2("li")`
|
|
660
406
|
&:not( :last-of-type ) {
|
|
661
407
|
border-bottom: 1px solid ${({ theme }) => theme.palette.divider};
|
|
662
408
|
}
|
|
663
409
|
`;
|
|
664
|
-
var StyledGroupHeader =
|
|
410
|
+
var StyledGroupHeader = styled2(Box3)(({ theme }) => ({
|
|
665
411
|
position: "sticky",
|
|
666
412
|
top: "-8px",
|
|
667
413
|
padding: theme.spacing(1, 2),
|
|
668
414
|
color: theme.palette.text.tertiary
|
|
669
415
|
}));
|
|
670
|
-
var StyledGroupItems =
|
|
416
|
+
var StyledGroupItems = styled2("ul")`
|
|
671
417
|
padding: 0;
|
|
672
418
|
`;
|
|
673
419
|
function useFilterOptions() {
|
|
674
|
-
return
|
|
420
|
+
return useState3(() => createFilterOptions())[0];
|
|
675
421
|
}
|
|
676
422
|
function useActionRunner() {
|
|
677
|
-
const [loading, setLoading] =
|
|
423
|
+
const [loading, setLoading] = useState3(false);
|
|
678
424
|
const run = async (apply, value) => {
|
|
679
425
|
setLoading(true);
|
|
680
426
|
try {
|
|
@@ -709,6 +455,7 @@ var EMPTY_OPTION = {
|
|
|
709
455
|
color: "primary",
|
|
710
456
|
provider: ELEMENTS_STYLES_PROVIDER_KEY
|
|
711
457
|
};
|
|
458
|
+
var { Slot: ClassSelectorActionsSlot, inject: injectIntoClassSelectorActions } = createLocation();
|
|
712
459
|
function CssClassSelector() {
|
|
713
460
|
const options10 = useOptions();
|
|
714
461
|
const { value: appliedIds, setValue: setAppliedIds, pushValue: pushAppliedId } = useAppliedClassesIds();
|
|
@@ -718,7 +465,7 @@ function CssClassSelector() {
|
|
|
718
465
|
const handleActivate = ({ value }) => setActiveId(value);
|
|
719
466
|
const applied = useAppliedOptions(options10, appliedIds);
|
|
720
467
|
const active = applied.find((option) => option.value === activeId) ?? EMPTY_OPTION;
|
|
721
|
-
return /* @__PURE__ */
|
|
468
|
+
return /* @__PURE__ */ React9.createElement(Stack, { gap: 1, p: 2 }, /* @__PURE__ */ React9.createElement(Stack, { direction: "row", gap: 1, alignItems: "baseline", justifyContent: "space-between" }, /* @__PURE__ */ React9.createElement(Typography, { component: "label", variant: "caption", htmlFor: ID }, __2("CSS Classes", "elementor")), /* @__PURE__ */ React9.createElement(Stack, { direction: "row", gap: 1 }, /* @__PURE__ */ React9.createElement(ClassSelectorActionsSlot, null))), /* @__PURE__ */ React9.createElement(
|
|
722
469
|
MultiCombobox,
|
|
723
470
|
{
|
|
724
471
|
id: ID,
|
|
@@ -728,14 +475,14 @@ function CssClassSelector() {
|
|
|
728
475
|
onSelect: handleApply,
|
|
729
476
|
limitTags: TAGS_LIMIT,
|
|
730
477
|
actions,
|
|
731
|
-
getLimitTagsText: (more) => /* @__PURE__ */
|
|
478
|
+
getLimitTagsText: (more) => /* @__PURE__ */ React9.createElement(Chip, { size: "tiny", variant: "standard", label: `+${more}`, clickable: true }),
|
|
732
479
|
renderTags: (values, getTagProps) => values.map((value, index) => {
|
|
733
480
|
const chipProps = getTagProps({ index });
|
|
734
481
|
const isActive = value.value === active?.value;
|
|
735
482
|
const renameLabel = (newLabel) => {
|
|
736
483
|
return updateClassByProvider(value.provider, { label: newLabel, id: value.value });
|
|
737
484
|
};
|
|
738
|
-
return /* @__PURE__ */
|
|
485
|
+
return /* @__PURE__ */ React9.createElement(
|
|
739
486
|
EditableFieldProvider,
|
|
740
487
|
{
|
|
741
488
|
key: chipProps.key,
|
|
@@ -747,7 +494,7 @@ function CssClassSelector() {
|
|
|
747
494
|
options10.filter((option) => option.value !== value.value)
|
|
748
495
|
)
|
|
749
496
|
},
|
|
750
|
-
/* @__PURE__ */
|
|
497
|
+
/* @__PURE__ */ React9.createElement(
|
|
751
498
|
CssClassItem,
|
|
752
499
|
{
|
|
753
500
|
label: value.label,
|
|
@@ -775,18 +522,18 @@ function CssClassItem({
|
|
|
775
522
|
onClickActive
|
|
776
523
|
}) {
|
|
777
524
|
const { meta } = useStyle();
|
|
778
|
-
const popupId =
|
|
779
|
-
const popupState =
|
|
525
|
+
const popupId = useId2().replace(/:/g, "_");
|
|
526
|
+
const popupState = usePopupState({ variant: "popover", popupId });
|
|
780
527
|
const chipRef = useRef3(null);
|
|
781
528
|
const { onDelete, ...chipGroupProps } = chipProps;
|
|
782
529
|
const { isEditing, openEditMode, error, submitting } = useEditableField();
|
|
783
530
|
const color = error ? "error" : colorProp;
|
|
784
|
-
return /* @__PURE__ */
|
|
531
|
+
return /* @__PURE__ */ React9.createElement(CssClassItemProvider, { styleId: id, isActive, isGlobal }, /* @__PURE__ */ React9.createElement(UnstableChipGroup, { ref: chipRef, ...chipGroupProps, "aria-label": `Edit ${label}`, role: "group" }, /* @__PURE__ */ React9.createElement(
|
|
785
532
|
Chip,
|
|
786
533
|
{
|
|
787
534
|
disabled: submitting,
|
|
788
535
|
size: CHIP_SIZE,
|
|
789
|
-
label: /* @__PURE__ */
|
|
536
|
+
label: /* @__PURE__ */ React9.createElement(
|
|
790
537
|
EditableField,
|
|
791
538
|
{
|
|
792
539
|
onDoubleClick: () => {
|
|
@@ -800,7 +547,7 @@ function CssClassItem({
|
|
|
800
547
|
}
|
|
801
548
|
}
|
|
802
549
|
},
|
|
803
|
-
/* @__PURE__ */
|
|
550
|
+
/* @__PURE__ */ React9.createElement(ConditionalTooltipWrapper, { maxWidth: "10ch", title: label })
|
|
804
551
|
),
|
|
805
552
|
variant: isActive && !meta.state ? "filled" : "standard",
|
|
806
553
|
color,
|
|
@@ -812,18 +559,18 @@ function CssClassItem({
|
|
|
812
559
|
}
|
|
813
560
|
}
|
|
814
561
|
}
|
|
815
|
-
), !isEditing && /* @__PURE__ */
|
|
562
|
+
), !isEditing && /* @__PURE__ */ React9.createElement(
|
|
816
563
|
Chip,
|
|
817
564
|
{
|
|
818
565
|
disabled: submitting,
|
|
819
566
|
size: CHIP_SIZE,
|
|
820
|
-
label: /* @__PURE__ */
|
|
567
|
+
label: /* @__PURE__ */ React9.createElement(Stack, { direction: "row", gap: 0.5, alignItems: "center" }, isActive && meta.state && /* @__PURE__ */ React9.createElement(Typography, { variant: "inherit" }, meta.state), /* @__PURE__ */ React9.createElement(DotsVerticalIcon, { fontSize: "inherit" })),
|
|
821
568
|
variant: "filled",
|
|
822
569
|
color,
|
|
823
570
|
...bindTrigger(popupState),
|
|
824
571
|
"aria-label": __2("Open CSS Class Menu", "elementor")
|
|
825
572
|
}
|
|
826
|
-
)), /* @__PURE__ */
|
|
573
|
+
)), /* @__PURE__ */ React9.createElement(CssClassMenu, { popupState, containerRef: chipRef }));
|
|
827
574
|
}
|
|
828
575
|
var updateClassByProvider = (provider, data) => {
|
|
829
576
|
const providerInstance = stylesRepository.getProviderByKey(provider);
|
|
@@ -909,9 +656,9 @@ function useAppliedOptions(options10, appliedIds) {
|
|
|
909
656
|
function useAppliedClassesIds() {
|
|
910
657
|
const { element } = useElement();
|
|
911
658
|
const currentClassesProp = useClassesProp();
|
|
912
|
-
const value =
|
|
659
|
+
const value = useElementSetting(element.id, currentClassesProp)?.value || [];
|
|
913
660
|
const setValue = (ids) => {
|
|
914
|
-
|
|
661
|
+
updateElementSettings({
|
|
915
662
|
id: element.id,
|
|
916
663
|
props: {
|
|
917
664
|
[currentClassesProp]: classesPropTypeUtil.create(ids)
|
|
@@ -949,6 +696,257 @@ function useHandleApply(appliedIds, setAppliedIds) {
|
|
|
949
696
|
};
|
|
950
697
|
}
|
|
951
698
|
|
|
699
|
+
// src/panel.ts
|
|
700
|
+
import { __createPanel as createPanel } from "@elementor/editor-panels";
|
|
701
|
+
|
|
702
|
+
// src/components/editing-panel.tsx
|
|
703
|
+
import * as React62 from "react";
|
|
704
|
+
import { ControlActionsProvider, ControlReplacementProvider } from "@elementor/editor-controls";
|
|
705
|
+
import { useSelectedElement } from "@elementor/editor-elements";
|
|
706
|
+
import { Panel, PanelBody, PanelHeader, PanelHeaderTitle } from "@elementor/editor-panels";
|
|
707
|
+
import { SessionStorageProvider as SessionStorageProvider3 } from "@elementor/session";
|
|
708
|
+
import { ErrorBoundary } from "@elementor/ui";
|
|
709
|
+
import { __ as __40 } from "@wordpress/i18n";
|
|
710
|
+
|
|
711
|
+
// src/controls-actions.ts
|
|
712
|
+
import { createMenu as createMenu2 } from "@elementor/menus";
|
|
713
|
+
|
|
714
|
+
// src/popover-action.tsx
|
|
715
|
+
import * as React10 from "react";
|
|
716
|
+
import { useId as useId3 } from "react";
|
|
717
|
+
import { XIcon } from "@elementor/icons";
|
|
718
|
+
import { bindPopover, bindToggle, IconButton, Popover, Stack as Stack2, Tooltip as Tooltip3, Typography as Typography2, usePopupState as usePopupState2 } from "@elementor/ui";
|
|
719
|
+
var SIZE = "tiny";
|
|
720
|
+
function PopoverAction({
|
|
721
|
+
title,
|
|
722
|
+
visible = true,
|
|
723
|
+
icon: Icon,
|
|
724
|
+
popoverContent: PopoverContent
|
|
725
|
+
}) {
|
|
726
|
+
const id = useId3();
|
|
727
|
+
const popupState = usePopupState2({
|
|
728
|
+
variant: "popover",
|
|
729
|
+
popupId: `elementor-popover-action-${id}`
|
|
730
|
+
});
|
|
731
|
+
if (!visible) {
|
|
732
|
+
return null;
|
|
733
|
+
}
|
|
734
|
+
return /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement(Tooltip3, { placement: "top", title }, /* @__PURE__ */ React10.createElement(IconButton, { "aria-label": title, key: id, size: SIZE, ...bindToggle(popupState) }, /* @__PURE__ */ React10.createElement(Icon, { fontSize: SIZE }))), /* @__PURE__ */ React10.createElement(
|
|
735
|
+
Popover,
|
|
736
|
+
{
|
|
737
|
+
disablePortal: true,
|
|
738
|
+
disableScrollLock: true,
|
|
739
|
+
anchorOrigin: {
|
|
740
|
+
vertical: "bottom",
|
|
741
|
+
horizontal: "center"
|
|
742
|
+
},
|
|
743
|
+
...bindPopover(popupState)
|
|
744
|
+
},
|
|
745
|
+
/* @__PURE__ */ React10.createElement(Stack2, { direction: "row", alignItems: "center", pl: 1.5, pr: 0.5, py: 1.5 }, /* @__PURE__ */ React10.createElement(Icon, { fontSize: SIZE, sx: { mr: 0.5 } }), /* @__PURE__ */ React10.createElement(Typography2, { variant: "subtitle2" }, title), /* @__PURE__ */ React10.createElement(IconButton, { sx: { ml: "auto" }, size: SIZE, onClick: popupState.close }, /* @__PURE__ */ React10.createElement(XIcon, { fontSize: SIZE }))),
|
|
746
|
+
/* @__PURE__ */ React10.createElement(PopoverContent, { closePopover: popupState.close })
|
|
747
|
+
));
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
// src/controls-actions.ts
|
|
751
|
+
var controlActionsMenu = createMenu2({
|
|
752
|
+
components: {
|
|
753
|
+
PopoverAction
|
|
754
|
+
}
|
|
755
|
+
});
|
|
756
|
+
|
|
757
|
+
// src/components/editing-panel-error-fallback.tsx
|
|
758
|
+
import * as React11 from "react";
|
|
759
|
+
import { Alert, Box as Box4 } from "@elementor/ui";
|
|
760
|
+
function EditorPanelErrorFallback() {
|
|
761
|
+
return /* @__PURE__ */ React11.createElement(Box4, { role: "alert", sx: { minHeight: "100%", p: 2 } }, /* @__PURE__ */ React11.createElement(Alert, { severity: "error", sx: { mb: 2, maxWidth: 400, textAlign: "center" } }, /* @__PURE__ */ React11.createElement("strong", null, "Something went wrong")));
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
// src/components/editing-panel-tabs.tsx
|
|
765
|
+
import * as React61 from "react";
|
|
766
|
+
import { Fragment as Fragment7 } from "react";
|
|
767
|
+
import { Divider as Divider8, Stack as Stack19, Tab, TabPanel, Tabs, useTabs } from "@elementor/ui";
|
|
768
|
+
import { __ as __39 } from "@wordpress/i18n";
|
|
769
|
+
|
|
770
|
+
// src/components/settings-tab.tsx
|
|
771
|
+
import * as React17 from "react";
|
|
772
|
+
import { ControlLabel } from "@elementor/editor-controls";
|
|
773
|
+
import { SessionStorageProvider } from "@elementor/session";
|
|
774
|
+
|
|
775
|
+
// src/controls-registry/control.tsx
|
|
776
|
+
import * as React12 from "react";
|
|
777
|
+
import { createError } from "@elementor/utils";
|
|
778
|
+
|
|
779
|
+
// src/controls-registry/controls-registry.tsx
|
|
780
|
+
import {
|
|
781
|
+
ImageControl,
|
|
782
|
+
LinkControl,
|
|
783
|
+
SelectControl,
|
|
784
|
+
SizeControl,
|
|
785
|
+
TextAreaControl,
|
|
786
|
+
TextControl,
|
|
787
|
+
UrlControl
|
|
788
|
+
} from "@elementor/editor-controls";
|
|
789
|
+
var controlTypes = {
|
|
790
|
+
image: { component: ImageControl, layout: "full" },
|
|
791
|
+
text: { component: TextControl, layout: "two-columns" },
|
|
792
|
+
textarea: { component: TextAreaControl, layout: "full" },
|
|
793
|
+
size: { component: SizeControl, layout: "two-columns" },
|
|
794
|
+
select: { component: SelectControl, layout: "two-columns" },
|
|
795
|
+
link: { component: LinkControl, layout: "full" },
|
|
796
|
+
url: { component: UrlControl, layout: "full" }
|
|
797
|
+
};
|
|
798
|
+
var getControlByType = (type) => controlTypes[type]?.component;
|
|
799
|
+
var getLayoutByType = (type) => controlTypes[type].layout;
|
|
800
|
+
|
|
801
|
+
// src/controls-registry/control.tsx
|
|
802
|
+
var ControlTypeError = createError({
|
|
803
|
+
code: "CONTROL_TYPE_NOT_FOUND",
|
|
804
|
+
message: `Control type not found.`
|
|
805
|
+
});
|
|
806
|
+
var Control = ({ props, type }) => {
|
|
807
|
+
const ControlByType = getControlByType(type);
|
|
808
|
+
if (!ControlByType) {
|
|
809
|
+
throw new ControlTypeError({
|
|
810
|
+
context: { type }
|
|
811
|
+
});
|
|
812
|
+
}
|
|
813
|
+
return /* @__PURE__ */ React12.createElement(ControlByType, { ...props });
|
|
814
|
+
};
|
|
815
|
+
|
|
816
|
+
// src/controls-registry/control-type-container.tsx
|
|
817
|
+
import * as React13 from "react";
|
|
818
|
+
import { Box as Box5, styled as styled3 } from "@elementor/ui";
|
|
819
|
+
var ControlTypeContainer = ({
|
|
820
|
+
controlType,
|
|
821
|
+
children
|
|
822
|
+
}) => {
|
|
823
|
+
const layout = getLayoutByType(controlType);
|
|
824
|
+
return /* @__PURE__ */ React13.createElement(StyledContainer, { layout }, children);
|
|
825
|
+
};
|
|
826
|
+
var StyledContainer = styled3(Box5, {
|
|
827
|
+
shouldForwardProp: (prop) => !["layout"].includes(prop)
|
|
828
|
+
})(({ layout, theme }) => ({
|
|
829
|
+
display: "grid",
|
|
830
|
+
gridGap: theme.spacing(1),
|
|
831
|
+
...getGridLayout(layout)
|
|
832
|
+
}));
|
|
833
|
+
var getGridLayout = (layout) => ({
|
|
834
|
+
justifyContent: "space-between",
|
|
835
|
+
gridTemplateColumns: {
|
|
836
|
+
full: "1fr",
|
|
837
|
+
"two-columns": "repeat(2, 1fr)"
|
|
838
|
+
}[layout]
|
|
839
|
+
});
|
|
840
|
+
|
|
841
|
+
// src/controls-registry/settings-field.tsx
|
|
842
|
+
import * as React14 from "react";
|
|
843
|
+
import { PropKeyProvider, PropProvider } from "@elementor/editor-controls";
|
|
844
|
+
import { updateElementSettings as updateElementSettings2, useElementSetting as useElementSetting2 } from "@elementor/editor-elements";
|
|
845
|
+
|
|
846
|
+
// src/controls-registry/create-top-level-object-type.ts
|
|
847
|
+
var createTopLevelOjectType = ({ schema }) => {
|
|
848
|
+
const schemaPropType = {
|
|
849
|
+
key: "",
|
|
850
|
+
kind: "object",
|
|
851
|
+
meta: {},
|
|
852
|
+
settings: {},
|
|
853
|
+
default: null,
|
|
854
|
+
shape: schema
|
|
855
|
+
};
|
|
856
|
+
return schemaPropType;
|
|
857
|
+
};
|
|
858
|
+
|
|
859
|
+
// src/controls-registry/settings-field.tsx
|
|
860
|
+
var SettingsField = ({ bind, children }) => {
|
|
861
|
+
const { element, elementType } = useElement();
|
|
862
|
+
const settingsValue = useElementSetting2(element.id, bind);
|
|
863
|
+
const value = { [bind]: settingsValue };
|
|
864
|
+
const propType = createTopLevelOjectType({ schema: elementType.propsSchema });
|
|
865
|
+
const setValue = (newValue) => {
|
|
866
|
+
updateElementSettings2({
|
|
867
|
+
id: element.id,
|
|
868
|
+
props: { ...newValue }
|
|
869
|
+
});
|
|
870
|
+
};
|
|
871
|
+
return /* @__PURE__ */ React14.createElement(PropProvider, { propType, value, setValue }, /* @__PURE__ */ React14.createElement(PropKeyProvider, { bind }, children));
|
|
872
|
+
};
|
|
873
|
+
|
|
874
|
+
// src/components/section.tsx
|
|
875
|
+
import * as React15 from "react";
|
|
876
|
+
import { useId as useId4, useState as useState4 } from "react";
|
|
877
|
+
import { Collapse, Divider, ListItemButton, ListItemText as ListItemText2, Stack as Stack3 } from "@elementor/ui";
|
|
878
|
+
|
|
879
|
+
// src/components/collapse-icon.tsx
|
|
880
|
+
import { ChevronDownIcon } from "@elementor/icons";
|
|
881
|
+
import { styled as styled4 } from "@elementor/ui";
|
|
882
|
+
var CollapseIcon = styled4(ChevronDownIcon, {
|
|
883
|
+
shouldForwardProp: (prop) => prop !== "open"
|
|
884
|
+
})(({ theme, open }) => ({
|
|
885
|
+
transform: open ? "rotate(180deg)" : "rotate(0deg)",
|
|
886
|
+
transition: theme.transitions.create("transform", {
|
|
887
|
+
duration: theme.transitions.duration.standard
|
|
888
|
+
})
|
|
889
|
+
}));
|
|
890
|
+
|
|
891
|
+
// src/components/section.tsx
|
|
892
|
+
function Section({ title, children, defaultExpanded = false }) {
|
|
893
|
+
const [isOpen, setIsOpen] = useState4(!!defaultExpanded);
|
|
894
|
+
const id = useId4();
|
|
895
|
+
const labelId = `label-${id}`;
|
|
896
|
+
const contentId = `content-${id}`;
|
|
897
|
+
return /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(
|
|
898
|
+
ListItemButton,
|
|
899
|
+
{
|
|
900
|
+
id: labelId,
|
|
901
|
+
"aria-controls": contentId,
|
|
902
|
+
onClick: () => setIsOpen((prev) => !prev)
|
|
903
|
+
},
|
|
904
|
+
/* @__PURE__ */ React15.createElement(ListItemText2, { secondary: title }),
|
|
905
|
+
/* @__PURE__ */ React15.createElement(CollapseIcon, { open: isOpen, color: "secondary" })
|
|
906
|
+
), /* @__PURE__ */ React15.createElement(Collapse, { id: contentId, "aria-labelledby": labelId, in: isOpen, timeout: "auto", unmountOnExit: true }, /* @__PURE__ */ React15.createElement(Stack3, { gap: 2.5, p: 2 }, children)), /* @__PURE__ */ React15.createElement(Divider, null));
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
// src/components/sections-list.tsx
|
|
910
|
+
import * as React16 from "react";
|
|
911
|
+
import { List } from "@elementor/ui";
|
|
912
|
+
function SectionsList(props) {
|
|
913
|
+
return /* @__PURE__ */ React16.createElement(List, { disablePadding: true, component: "div", ...props });
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
// src/components/settings-tab.tsx
|
|
917
|
+
var SettingsTab = () => {
|
|
918
|
+
const { elementType, element } = useElement();
|
|
919
|
+
return /* @__PURE__ */ React17.createElement(SessionStorageProvider, { prefix: element.id }, /* @__PURE__ */ React17.createElement(SectionsList, null, elementType.controls.map(({ type, value }, index) => {
|
|
920
|
+
if (type === "control") {
|
|
921
|
+
return /* @__PURE__ */ React17.createElement(Control2, { key: value.bind, control: value });
|
|
922
|
+
}
|
|
923
|
+
if (type === "section") {
|
|
924
|
+
return /* @__PURE__ */ React17.createElement(Section, { title: value.label, key: type + "." + index, defaultExpanded: true }, value.items?.map((item) => {
|
|
925
|
+
if (item.type === "control") {
|
|
926
|
+
return /* @__PURE__ */ React17.createElement(Control2, { key: item.value.bind, control: item.value });
|
|
927
|
+
}
|
|
928
|
+
return null;
|
|
929
|
+
}));
|
|
930
|
+
}
|
|
931
|
+
return null;
|
|
932
|
+
})));
|
|
933
|
+
};
|
|
934
|
+
var Control2 = ({ control }) => {
|
|
935
|
+
if (!getControlByType(control.type)) {
|
|
936
|
+
return null;
|
|
937
|
+
}
|
|
938
|
+
return /* @__PURE__ */ React17.createElement(SettingsField, { bind: control.bind }, /* @__PURE__ */ React17.createElement(ControlTypeContainer, { controlType: control.type }, control.label ? /* @__PURE__ */ React17.createElement(ControlLabel, null, control.label) : null, /* @__PURE__ */ React17.createElement(Control, { type: control.type, props: control.props })));
|
|
939
|
+
};
|
|
940
|
+
|
|
941
|
+
// src/components/style-tab.tsx
|
|
942
|
+
import * as React60 from "react";
|
|
943
|
+
import { useState as useState9 } from "react";
|
|
944
|
+
import { useElementSetting as useElementSetting3, useElementStyles } from "@elementor/editor-elements";
|
|
945
|
+
import { useActiveBreakpoint } from "@elementor/editor-responsive";
|
|
946
|
+
import { SessionStorageProvider as SessionStorageProvider2 } from "@elementor/session";
|
|
947
|
+
import { Divider as Divider7 } from "@elementor/ui";
|
|
948
|
+
import { __ as __38 } from "@wordpress/i18n";
|
|
949
|
+
|
|
952
950
|
// src/components/style-sections/background-section/background-section.tsx
|
|
953
951
|
import * as React19 from "react";
|
|
954
952
|
import { BackgroundControl } from "@elementor/editor-controls";
|
|
@@ -959,7 +957,7 @@ import { PropKeyProvider as PropKeyProvider2, PropProvider as PropProvider2 } fr
|
|
|
959
957
|
import { getStylesSchema } from "@elementor/editor-styles";
|
|
960
958
|
|
|
961
959
|
// src/hooks/use-styles-fields.ts
|
|
962
|
-
import {
|
|
960
|
+
import { createElementStyle, updateElementStyle, useElementStyleProps } from "@elementor/editor-elements";
|
|
963
961
|
import { __ as __3 } from "@wordpress/i18n";
|
|
964
962
|
function useStylesFields(propNames) {
|
|
965
963
|
const { element } = useElement();
|
|
@@ -971,14 +969,22 @@ function useStylesFields(propNames) {
|
|
|
971
969
|
meta,
|
|
972
970
|
propNames
|
|
973
971
|
});
|
|
974
|
-
const setValue = (
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
972
|
+
const setValue = (props) => {
|
|
973
|
+
if (id === null) {
|
|
974
|
+
createElementStyle({
|
|
975
|
+
elementId: element.id,
|
|
976
|
+
classesProp,
|
|
977
|
+
meta,
|
|
978
|
+
props,
|
|
979
|
+
label: __3("local", "elementor")
|
|
980
|
+
});
|
|
981
|
+
return;
|
|
982
|
+
}
|
|
983
|
+
updateElementStyle({
|
|
984
|
+
elementId: element.id,
|
|
985
|
+
styleId: id,
|
|
986
|
+
props,
|
|
987
|
+
meta
|
|
982
988
|
});
|
|
983
989
|
};
|
|
984
990
|
return [value, setValue];
|
|
@@ -1516,6 +1522,7 @@ var getGroupControlValue = (order) => {
|
|
|
1516
1522
|
|
|
1517
1523
|
// src/components/style-sections/layout-section/flex-size-field.tsx
|
|
1518
1524
|
import * as React34 from "react";
|
|
1525
|
+
import { useMemo, useState as useState6 } from "react";
|
|
1519
1526
|
import {
|
|
1520
1527
|
ControlLabel as ControlLabel10,
|
|
1521
1528
|
ControlToggleButtonGroup as ControlToggleButtonGroup2,
|
|
@@ -1549,7 +1556,7 @@ var items2 = [
|
|
|
1549
1556
|
var FlexSizeField = () => {
|
|
1550
1557
|
const { isSiteRtl } = useDirection(), [growField, setGrowField] = useStylesField("flex-grow"), [shrinkField, setShrinkField] = useStylesField("flex-shrink"), [basisField, setBasisField] = useStylesField("flex-basis");
|
|
1551
1558
|
const grow = growField?.value || null, shrink = shrinkField?.value || null, basis = basisField?.value || null;
|
|
1552
|
-
const currentGroup =
|
|
1559
|
+
const currentGroup = useMemo(() => getActiveGroup({ grow, shrink, basis }), [grow, shrink, basis]), [activeGroup, setActiveGroup] = useState6(currentGroup);
|
|
1553
1560
|
const onChangeGroup = (group = null) => {
|
|
1554
1561
|
setActiveGroup(group);
|
|
1555
1562
|
setBasisField(null);
|
|
@@ -2285,6 +2292,16 @@ var { panel, usePanelActions, usePanelStatus } = createPanel({
|
|
|
2285
2292
|
component: EditingPanel
|
|
2286
2293
|
});
|
|
2287
2294
|
|
|
2295
|
+
// src/init.ts
|
|
2296
|
+
import { injectIntoLogic } from "@elementor/editor";
|
|
2297
|
+
import { __registerPanel as registerPanel } from "@elementor/editor-panels";
|
|
2298
|
+
import { __privateBlockDataCommand as blockDataCommand } from "@elementor/editor-v1-adapters";
|
|
2299
|
+
|
|
2300
|
+
// src/hooks/use-close-editor-panel.ts
|
|
2301
|
+
import { useEffect as useEffect4 } from "react";
|
|
2302
|
+
import { getSelectedElements as getSelectedElements2, isElementInContainer } from "@elementor/editor-elements";
|
|
2303
|
+
import { __privateListenTo as listenTo, commandStartEvent } from "@elementor/editor-v1-adapters";
|
|
2304
|
+
|
|
2288
2305
|
// src/sync/is-atomic-widget-selected.ts
|
|
2289
2306
|
import { getSelectedElements, getWidgetsCache } from "@elementor/editor-elements";
|
|
2290
2307
|
var isAtomicWidgetSelected = () => {
|
|
@@ -2333,14 +2350,14 @@ var EditingPanelHooks = () => {
|
|
|
2333
2350
|
};
|
|
2334
2351
|
|
|
2335
2352
|
// src/hooks/use-unapply-class.ts
|
|
2336
|
-
import {
|
|
2353
|
+
import { updateElementSettings as updateElementSettings3, useElementSetting as useElementSetting4 } from "@elementor/editor-elements";
|
|
2337
2354
|
var useUnapplyClass = (classId) => {
|
|
2338
2355
|
const { element } = useElement();
|
|
2339
2356
|
const classesProp = useClassesProp();
|
|
2340
2357
|
const classes = useElementSetting4(element.id, classesProp);
|
|
2341
|
-
const filteredClasses = classes?.value.filter((className) => className !== classId);
|
|
2358
|
+
const filteredClasses = classes?.value.filter((className) => className !== classId) ?? [];
|
|
2342
2359
|
return () => {
|
|
2343
|
-
|
|
2360
|
+
updateElementSettings3({
|
|
2344
2361
|
id: element.id,
|
|
2345
2362
|
props: {
|
|
2346
2363
|
[classesProp]: {
|
|
@@ -2756,9 +2773,12 @@ var blockV1Panel = () => {
|
|
|
2756
2773
|
// src/index.ts
|
|
2757
2774
|
init2();
|
|
2758
2775
|
export {
|
|
2776
|
+
injectIntoClassSelectorActions,
|
|
2759
2777
|
registerGlobalClassMenuItem,
|
|
2760
2778
|
registerStateMenuItem,
|
|
2761
2779
|
replaceControl,
|
|
2762
|
-
useBoundProp6 as useBoundProp
|
|
2780
|
+
useBoundProp6 as useBoundProp,
|
|
2781
|
+
usePanelActions,
|
|
2782
|
+
usePanelStatus
|
|
2763
2783
|
};
|
|
2764
2784
|
//# sourceMappingURL=index.mjs.map
|