@elementor/editor-components 3.35.0-420 → 3.35.0-422
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/dist/index.js +397 -298
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +322 -212
- package/dist/index.mjs.map +1 -1
- package/package.json +22 -22
- package/src/components/components-tab/angie-promotion-modal.tsx +72 -0
- package/src/components/components-tab/components-list.tsx +91 -32
- package/src/components/components-tab/components.tsx +14 -2
- package/src/store/actions/rename-component.ts +42 -0
package/dist/index.mjs
CHANGED
|
@@ -17,7 +17,7 @@ import { __registerPanel as registerPanel } from "@elementor/editor-panels";
|
|
|
17
17
|
import { stylesRepository } from "@elementor/editor-styles-repository";
|
|
18
18
|
import { registerDataHook as registerDataHook2 } from "@elementor/editor-v1-adapters";
|
|
19
19
|
import { __registerSlice as registerSlice } from "@elementor/store";
|
|
20
|
-
import { __ as
|
|
20
|
+
import { __ as __27 } from "@wordpress/i18n";
|
|
21
21
|
|
|
22
22
|
// src/component-instance-transformer.ts
|
|
23
23
|
import { createTransformer } from "@elementor/editor-canvas";
|
|
@@ -1628,9 +1628,17 @@ function getComponentName() {
|
|
|
1628
1628
|
}
|
|
1629
1629
|
|
|
1630
1630
|
// src/components/components-tab/components.tsx
|
|
1631
|
-
import * as
|
|
1631
|
+
import * as React17 from "react";
|
|
1632
1632
|
import { ThemeProvider as ThemeProvider2 } from "@elementor/editor-ui";
|
|
1633
1633
|
|
|
1634
|
+
// src/hooks/use-components.ts
|
|
1635
|
+
import { __useSelector as useSelector4 } from "@elementor/store";
|
|
1636
|
+
var useComponents = () => {
|
|
1637
|
+
const components = useSelector4(selectComponents);
|
|
1638
|
+
const isLoading = useSelector4(selectLoadIsPending);
|
|
1639
|
+
return { components, isLoading };
|
|
1640
|
+
};
|
|
1641
|
+
|
|
1634
1642
|
// src/components/components-tab/component-search.tsx
|
|
1635
1643
|
import * as React12 from "react";
|
|
1636
1644
|
import { SearchIcon } from "@elementor/icons";
|
|
@@ -1680,62 +1688,17 @@ var ComponentSearch = () => {
|
|
|
1680
1688
|
};
|
|
1681
1689
|
|
|
1682
1690
|
// src/components/components-tab/components-list.tsx
|
|
1683
|
-
import * as
|
|
1684
|
-
import {
|
|
1685
|
-
import {
|
|
1686
|
-
import {
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
import { __useSelector as useSelector4 } from "@elementor/store";
|
|
1690
|
-
var useComponents = () => {
|
|
1691
|
-
const components = useSelector4(selectComponents);
|
|
1692
|
-
const isLoading = useSelector4(selectLoadIsPending);
|
|
1693
|
-
return { components, isLoading };
|
|
1694
|
-
};
|
|
1691
|
+
import * as React16 from "react";
|
|
1692
|
+
import { useState as useState6 } from "react";
|
|
1693
|
+
import { getAngieSdk } from "@elementor/editor-mcp";
|
|
1694
|
+
import { AIIcon, ComponentsIcon as ComponentsIcon2 } from "@elementor/icons";
|
|
1695
|
+
import { Box as Box11, Button as Button4, Divider as Divider3, Link as Link3, List as List3, Stack as Stack10, Typography as Typography9 } from "@elementor/ui";
|
|
1696
|
+
import { __ as __17 } from "@wordpress/i18n";
|
|
1695
1697
|
|
|
1696
1698
|
// src/store/actions/rename-component.ts
|
|
1699
|
+
import { getV1DocumentsManager as getV1DocumentsManager4, setDocumentModifiedStatus as setDocumentModifiedStatus3 } from "@elementor/editor-documents";
|
|
1700
|
+
import { getAllDescendants } from "@elementor/editor-elements";
|
|
1697
1701
|
import { __dispatch as dispatch8 } from "@elementor/store";
|
|
1698
|
-
var renameComponent = (componentUid, newName) => {
|
|
1699
|
-
dispatch8(slice.actions.rename({ componentUid, name: newName }));
|
|
1700
|
-
};
|
|
1701
|
-
|
|
1702
|
-
// src/components/components-tab/components-item.tsx
|
|
1703
|
-
import * as React13 from "react";
|
|
1704
|
-
import { useRef as useRef4 } from "react";
|
|
1705
|
-
import { endDragElementFromPanel, startDragElementFromPanel } from "@elementor/editor-canvas";
|
|
1706
|
-
import { dropElement } from "@elementor/editor-elements";
|
|
1707
|
-
import { EditableField as EditableField2, EllipsisWithTooltip, MenuListItem as MenuListItem3, useEditable as useEditable2, WarningInfotip } from "@elementor/editor-ui";
|
|
1708
|
-
import { ComponentsIcon, DotsVerticalIcon as DotsVerticalIcon2 } from "@elementor/icons";
|
|
1709
|
-
import {
|
|
1710
|
-
bindMenu as bindMenu2,
|
|
1711
|
-
bindTrigger as bindTrigger3,
|
|
1712
|
-
Box as Box9,
|
|
1713
|
-
IconButton as IconButton5,
|
|
1714
|
-
ListItemButton,
|
|
1715
|
-
ListItemIcon,
|
|
1716
|
-
Menu as Menu2,
|
|
1717
|
-
Stack as Stack8,
|
|
1718
|
-
styled as styled3,
|
|
1719
|
-
Typography as Typography7,
|
|
1720
|
-
usePopupState as usePopupState3
|
|
1721
|
-
} from "@elementor/ui";
|
|
1722
|
-
import { __ as __15 } from "@wordpress/i18n";
|
|
1723
|
-
|
|
1724
|
-
// src/store/actions/archive-component.ts
|
|
1725
|
-
import { setDocumentModifiedStatus as setDocumentModifiedStatus3 } from "@elementor/editor-documents";
|
|
1726
|
-
import { __getStore as getStore } from "@elementor/store";
|
|
1727
|
-
var archiveComponent = (componentId) => {
|
|
1728
|
-
const store = getStore();
|
|
1729
|
-
const dispatch18 = store?.dispatch;
|
|
1730
|
-
if (!dispatch18) {
|
|
1731
|
-
return;
|
|
1732
|
-
}
|
|
1733
|
-
dispatch18(slice.actions.archive(componentId));
|
|
1734
|
-
setDocumentModifiedStatus3(true);
|
|
1735
|
-
};
|
|
1736
|
-
|
|
1737
|
-
// src/store/actions/load-components-assets.ts
|
|
1738
|
-
import { isDocumentDirty, setDocumentModifiedStatus as setDocumentModifiedStatus4 } from "@elementor/editor-documents";
|
|
1739
1702
|
|
|
1740
1703
|
// src/create-component-type.ts
|
|
1741
1704
|
import {
|
|
@@ -2010,6 +1973,121 @@ function createComponentModel() {
|
|
|
2010
1973
|
});
|
|
2011
1974
|
}
|
|
2012
1975
|
|
|
1976
|
+
// src/store/actions/rename-component.ts
|
|
1977
|
+
var TITLE_EXTERNAL_CHANGE_COMMAND = "title_external_change";
|
|
1978
|
+
var renameComponent = (componentUid, newName) => {
|
|
1979
|
+
dispatch8(slice.actions.rename({ componentUid, name: newName }));
|
|
1980
|
+
setDocumentModifiedStatus3(true);
|
|
1981
|
+
refreshComponentInstanceTitles(componentUid);
|
|
1982
|
+
};
|
|
1983
|
+
function refreshComponentInstanceTitles(componentUid) {
|
|
1984
|
+
const documentContainer = getDocumentContainer();
|
|
1985
|
+
if (!documentContainer) {
|
|
1986
|
+
return;
|
|
1987
|
+
}
|
|
1988
|
+
const componentInstances = findComponentInstancesByUid(documentContainer, componentUid);
|
|
1989
|
+
componentInstances.forEach((element) => {
|
|
1990
|
+
element.model.trigger?.(TITLE_EXTERNAL_CHANGE_COMMAND);
|
|
1991
|
+
});
|
|
1992
|
+
}
|
|
1993
|
+
function getDocumentContainer() {
|
|
1994
|
+
const documentsManager = getV1DocumentsManager4();
|
|
1995
|
+
return documentsManager?.getCurrent()?.container;
|
|
1996
|
+
}
|
|
1997
|
+
function findComponentInstancesByUid(documentContainer, componentUid) {
|
|
1998
|
+
const allDescendants = getAllDescendants(documentContainer);
|
|
1999
|
+
return allDescendants.filter((element) => {
|
|
2000
|
+
const widgetType = element.model.get("widgetType");
|
|
2001
|
+
const editorSettings = element.model.get("editor_settings");
|
|
2002
|
+
const isMatch = widgetType === COMPONENT_WIDGET_TYPE && editorSettings?.component_uid === componentUid;
|
|
2003
|
+
return isMatch;
|
|
2004
|
+
});
|
|
2005
|
+
}
|
|
2006
|
+
|
|
2007
|
+
// src/components/components-tab/angie-promotion-modal.tsx
|
|
2008
|
+
import * as React13 from "react";
|
|
2009
|
+
import {
|
|
2010
|
+
Button as Button3,
|
|
2011
|
+
Card,
|
|
2012
|
+
CardActions,
|
|
2013
|
+
CardContent,
|
|
2014
|
+
CardHeader,
|
|
2015
|
+
CardMedia,
|
|
2016
|
+
ClickAwayListener,
|
|
2017
|
+
CloseButton,
|
|
2018
|
+
Infotip,
|
|
2019
|
+
Typography as Typography7
|
|
2020
|
+
} from "@elementor/ui";
|
|
2021
|
+
import { __ as __14 } from "@wordpress/i18n";
|
|
2022
|
+
var ANGIE_INSTALL_URL = "/wp-admin/plugin-install.php?tab=plugin-information&plugin=angie";
|
|
2023
|
+
var PLACEHOLDER_IMAGE_URL = "https://assets.elementor.com/packages/v1/images/components-angie-promo.svg";
|
|
2024
|
+
var AngiePromotionModal = ({ children, open, onClose }) => {
|
|
2025
|
+
return /* @__PURE__ */ React13.createElement(Infotip, { placement: "right-end", arrow: true, content: /* @__PURE__ */ React13.createElement(AngiePromotionCard, { onClose }), open }, children);
|
|
2026
|
+
};
|
|
2027
|
+
function AngiePromotionCard({ onClose }) {
|
|
2028
|
+
const handleCtaClick = () => {
|
|
2029
|
+
window.open(ANGIE_INSTALL_URL, "_blank");
|
|
2030
|
+
onClose();
|
|
2031
|
+
};
|
|
2032
|
+
return /* @__PURE__ */ React13.createElement(ClickAwayListener, { disableReactTree: true, mouseEvent: "onMouseDown", touchEvent: "onTouchStart", onClickAway: onClose }, /* @__PURE__ */ React13.createElement(Card, { elevation: 0, sx: { maxWidth: 296 } }, /* @__PURE__ */ React13.createElement(
|
|
2033
|
+
CardHeader,
|
|
2034
|
+
{
|
|
2035
|
+
title: __14("Add new component with AI", "elementor"),
|
|
2036
|
+
titleTypographyProps: { variant: "subtitle2" },
|
|
2037
|
+
action: /* @__PURE__ */ React13.createElement(CloseButton, { slotProps: { icon: { fontSize: "tiny" } }, onClick: onClose })
|
|
2038
|
+
}
|
|
2039
|
+
), /* @__PURE__ */ React13.createElement(
|
|
2040
|
+
CardMedia,
|
|
2041
|
+
{
|
|
2042
|
+
component: "img",
|
|
2043
|
+
image: PLACEHOLDER_IMAGE_URL,
|
|
2044
|
+
alt: "",
|
|
2045
|
+
sx: { width: "100%", aspectRatio: "16 / 9" }
|
|
2046
|
+
}
|
|
2047
|
+
), /* @__PURE__ */ React13.createElement(CardContent, null, /* @__PURE__ */ React13.createElement(Typography7, { variant: "body2", color: "text.secondary" }, __14(
|
|
2048
|
+
"Angie our AI assistant can easily create new components and save you the hassle of doing it yourself",
|
|
2049
|
+
"elementor"
|
|
2050
|
+
))), /* @__PURE__ */ React13.createElement(CardActions, { sx: { justifyContent: "flex-end" } }, /* @__PURE__ */ React13.createElement(Button3, { size: "medium", variant: "contained", color: "accent", onClick: handleCtaClick }, __14("Get Angie", "elementor")))));
|
|
2051
|
+
}
|
|
2052
|
+
|
|
2053
|
+
// src/components/components-tab/components-item.tsx
|
|
2054
|
+
import * as React14 from "react";
|
|
2055
|
+
import { useRef as useRef4 } from "react";
|
|
2056
|
+
import { endDragElementFromPanel, startDragElementFromPanel } from "@elementor/editor-canvas";
|
|
2057
|
+
import { dropElement } from "@elementor/editor-elements";
|
|
2058
|
+
import { EditableField as EditableField2, EllipsisWithTooltip, MenuListItem as MenuListItem3, useEditable as useEditable2, WarningInfotip } from "@elementor/editor-ui";
|
|
2059
|
+
import { ComponentsIcon, DotsVerticalIcon as DotsVerticalIcon2 } from "@elementor/icons";
|
|
2060
|
+
import {
|
|
2061
|
+
bindMenu as bindMenu2,
|
|
2062
|
+
bindTrigger as bindTrigger3,
|
|
2063
|
+
Box as Box9,
|
|
2064
|
+
IconButton as IconButton5,
|
|
2065
|
+
ListItemButton,
|
|
2066
|
+
ListItemIcon,
|
|
2067
|
+
Menu as Menu2,
|
|
2068
|
+
Stack as Stack8,
|
|
2069
|
+
styled as styled3,
|
|
2070
|
+
Typography as Typography8,
|
|
2071
|
+
usePopupState as usePopupState3
|
|
2072
|
+
} from "@elementor/ui";
|
|
2073
|
+
import { __ as __16 } from "@wordpress/i18n";
|
|
2074
|
+
|
|
2075
|
+
// src/store/actions/archive-component.ts
|
|
2076
|
+
import { setDocumentModifiedStatus as setDocumentModifiedStatus4 } from "@elementor/editor-documents";
|
|
2077
|
+
import { __getStore as getStore } from "@elementor/store";
|
|
2078
|
+
var archiveComponent = (componentId) => {
|
|
2079
|
+
const store = getStore();
|
|
2080
|
+
const dispatch18 = store?.dispatch;
|
|
2081
|
+
if (!dispatch18) {
|
|
2082
|
+
return;
|
|
2083
|
+
}
|
|
2084
|
+
dispatch18(slice.actions.archive(componentId));
|
|
2085
|
+
setDocumentModifiedStatus4(true);
|
|
2086
|
+
};
|
|
2087
|
+
|
|
2088
|
+
// src/store/actions/load-components-assets.ts
|
|
2089
|
+
import { isDocumentDirty, setDocumentModifiedStatus as setDocumentModifiedStatus5 } from "@elementor/editor-documents";
|
|
2090
|
+
|
|
2013
2091
|
// src/utils/is-component-instance.ts
|
|
2014
2092
|
function isComponentInstance(elementModel) {
|
|
2015
2093
|
return [elementModel.widgetType, elementModel.elType].includes(COMPONENT_WIDGET_TYPE);
|
|
@@ -2111,7 +2189,7 @@ async function updateDocumentState(componentIds) {
|
|
|
2111
2189
|
);
|
|
2112
2190
|
const isDrafted = components.some(isDocumentDirty);
|
|
2113
2191
|
if (isDrafted) {
|
|
2114
|
-
|
|
2192
|
+
setDocumentModifiedStatus5(true);
|
|
2115
2193
|
}
|
|
2116
2194
|
}
|
|
2117
2195
|
|
|
@@ -2120,14 +2198,14 @@ import { __getState as getState14 } from "@elementor/store";
|
|
|
2120
2198
|
|
|
2121
2199
|
// src/components/create-component-form/utils/component-form-schema.ts
|
|
2122
2200
|
import { z } from "@elementor/schema";
|
|
2123
|
-
import { __ as
|
|
2201
|
+
import { __ as __15 } from "@wordpress/i18n";
|
|
2124
2202
|
var MIN_NAME_LENGTH = 2;
|
|
2125
2203
|
var MAX_NAME_LENGTH = 50;
|
|
2126
|
-
var baseComponentSchema = z.string().trim().max(MAX_NAME_LENGTH,
|
|
2204
|
+
var baseComponentSchema = z.string().trim().max(MAX_NAME_LENGTH, __15("Component name is too long. Please keep it under 50 characters.", "elementor"));
|
|
2127
2205
|
var createBaseComponentSchema = (existingNames) => {
|
|
2128
2206
|
return z.object({
|
|
2129
2207
|
componentName: baseComponentSchema.refine((value) => !existingNames.includes(value), {
|
|
2130
|
-
message:
|
|
2208
|
+
message: __15("Component name already exists", "elementor")
|
|
2131
2209
|
})
|
|
2132
2210
|
});
|
|
2133
2211
|
};
|
|
@@ -2135,9 +2213,9 @@ var createSubmitComponentSchema = (existingNames) => {
|
|
|
2135
2213
|
const baseSchema = createBaseComponentSchema(existingNames);
|
|
2136
2214
|
return baseSchema.extend({
|
|
2137
2215
|
componentName: baseSchema.shape.componentName.refine((value) => value.length > 0, {
|
|
2138
|
-
message:
|
|
2216
|
+
message: __15("Component name is required.", "elementor")
|
|
2139
2217
|
}).refine((value) => value.length >= MIN_NAME_LENGTH, {
|
|
2140
|
-
message:
|
|
2218
|
+
message: __15("Component name is too short. Please enter at least 2 characters.", "elementor")
|
|
2141
2219
|
})
|
|
2142
2220
|
});
|
|
2143
2221
|
};
|
|
@@ -2265,7 +2343,7 @@ var ComponentItem = ({ component, renameComponent: renameComponent2 }) => {
|
|
|
2265
2343
|
}
|
|
2266
2344
|
archiveComponent(component.id);
|
|
2267
2345
|
};
|
|
2268
|
-
return /* @__PURE__ */
|
|
2346
|
+
return /* @__PURE__ */ React14.createElement(Stack8, null, /* @__PURE__ */ React14.createElement(
|
|
2269
2347
|
WarningInfotip,
|
|
2270
2348
|
{
|
|
2271
2349
|
open: Boolean(error),
|
|
@@ -2274,7 +2352,7 @@ var ComponentItem = ({ component, renameComponent: renameComponent2 }) => {
|
|
|
2274
2352
|
width: itemRef.current?.getBoundingClientRect().width,
|
|
2275
2353
|
offset: [0, -15]
|
|
2276
2354
|
},
|
|
2277
|
-
/* @__PURE__ */
|
|
2355
|
+
/* @__PURE__ */ React14.createElement(
|
|
2278
2356
|
ListItemButton,
|
|
2279
2357
|
{
|
|
2280
2358
|
draggable: true,
|
|
@@ -2293,7 +2371,7 @@ var ComponentItem = ({ component, renameComponent: renameComponent2 }) => {
|
|
|
2293
2371
|
gap: 1
|
|
2294
2372
|
}
|
|
2295
2373
|
},
|
|
2296
|
-
/* @__PURE__ */
|
|
2374
|
+
/* @__PURE__ */ React14.createElement(
|
|
2297
2375
|
Box9,
|
|
2298
2376
|
{
|
|
2299
2377
|
display: "flex",
|
|
@@ -2303,28 +2381,28 @@ var ComponentItem = ({ component, renameComponent: renameComponent2 }) => {
|
|
|
2303
2381
|
flexGrow: 1,
|
|
2304
2382
|
onClick: handleClick
|
|
2305
2383
|
},
|
|
2306
|
-
/* @__PURE__ */
|
|
2307
|
-
/* @__PURE__ */
|
|
2384
|
+
/* @__PURE__ */ React14.createElement(ListItemIcon, { size: "tiny" }, /* @__PURE__ */ React14.createElement(ComponentsIcon, { fontSize: "tiny" })),
|
|
2385
|
+
/* @__PURE__ */ React14.createElement(Indicator, { isActive: isEditing, isError: !!error }, /* @__PURE__ */ React14.createElement(Box9, { display: "flex", flex: 1, minWidth: 0, flexGrow: 1 }, isEditing ? /* @__PURE__ */ React14.createElement(
|
|
2308
2386
|
EditableField2,
|
|
2309
2387
|
{
|
|
2310
2388
|
ref: editableRef,
|
|
2311
|
-
as:
|
|
2389
|
+
as: Typography8,
|
|
2312
2390
|
variant: "caption",
|
|
2313
2391
|
...getEditableProps()
|
|
2314
2392
|
}
|
|
2315
|
-
) : /* @__PURE__ */
|
|
2393
|
+
) : /* @__PURE__ */ React14.createElement(
|
|
2316
2394
|
EllipsisWithTooltip,
|
|
2317
2395
|
{
|
|
2318
2396
|
title: component.name,
|
|
2319
|
-
as:
|
|
2397
|
+
as: Typography8,
|
|
2320
2398
|
variant: "caption",
|
|
2321
2399
|
color: "text.primary"
|
|
2322
2400
|
}
|
|
2323
2401
|
)))
|
|
2324
2402
|
),
|
|
2325
|
-
/* @__PURE__ */
|
|
2403
|
+
/* @__PURE__ */ React14.createElement(IconButton5, { size: "tiny", ...bindTrigger3(popupState), "aria-label": "More actions" }, /* @__PURE__ */ React14.createElement(DotsVerticalIcon2, { fontSize: "tiny" }))
|
|
2326
2404
|
)
|
|
2327
|
-
), /* @__PURE__ */
|
|
2405
|
+
), /* @__PURE__ */ React14.createElement(
|
|
2328
2406
|
Menu2,
|
|
2329
2407
|
{
|
|
2330
2408
|
...bindMenu2(popupState),
|
|
@@ -2337,7 +2415,7 @@ var ComponentItem = ({ component, renameComponent: renameComponent2 }) => {
|
|
|
2337
2415
|
horizontal: "right"
|
|
2338
2416
|
}
|
|
2339
2417
|
},
|
|
2340
|
-
/* @__PURE__ */
|
|
2418
|
+
/* @__PURE__ */ React14.createElement(
|
|
2341
2419
|
MenuListItem3,
|
|
2342
2420
|
{
|
|
2343
2421
|
sx: { minWidth: "160px" },
|
|
@@ -2346,9 +2424,9 @@ var ComponentItem = ({ component, renameComponent: renameComponent2 }) => {
|
|
|
2346
2424
|
openEditMode();
|
|
2347
2425
|
}
|
|
2348
2426
|
},
|
|
2349
|
-
|
|
2427
|
+
__16("Rename", "elementor")
|
|
2350
2428
|
),
|
|
2351
|
-
/* @__PURE__ */
|
|
2429
|
+
/* @__PURE__ */ React14.createElement(MenuListItem3, { sx: { minWidth: "160px" }, onClick: handleArchiveClick }, /* @__PURE__ */ React14.createElement(Typography8, { variant: "caption", sx: { color: "error.light" } }, __16("Archive", "elementor")))
|
|
2352
2430
|
));
|
|
2353
2431
|
};
|
|
2354
2432
|
var addComponentToPage = (model) => {
|
|
@@ -2393,12 +2471,12 @@ var getIndicatorBorder = ({ isActive, isError, theme }) => {
|
|
|
2393
2471
|
};
|
|
2394
2472
|
|
|
2395
2473
|
// src/components/components-tab/loading-components.tsx
|
|
2396
|
-
import * as
|
|
2474
|
+
import * as React15 from "react";
|
|
2397
2475
|
import { Box as Box10, ListItemButton as ListItemButton2, Skeleton, Stack as Stack9 } from "@elementor/ui";
|
|
2398
2476
|
var ROWS_COUNT = 6;
|
|
2399
2477
|
var rows = Array.from({ length: ROWS_COUNT }, (_, index) => index);
|
|
2400
2478
|
var LoadingComponents = () => {
|
|
2401
|
-
return /* @__PURE__ */
|
|
2479
|
+
return /* @__PURE__ */ React15.createElement(
|
|
2402
2480
|
Stack9,
|
|
2403
2481
|
{
|
|
2404
2482
|
"aria-label": "Loading components",
|
|
@@ -2420,32 +2498,37 @@ var LoadingComponents = () => {
|
|
|
2420
2498
|
}
|
|
2421
2499
|
}
|
|
2422
2500
|
},
|
|
2423
|
-
rows.map((row) => /* @__PURE__ */
|
|
2501
|
+
rows.map((row) => /* @__PURE__ */ React15.createElement(
|
|
2424
2502
|
ListItemButton2,
|
|
2425
2503
|
{
|
|
2426
2504
|
key: row,
|
|
2427
2505
|
sx: { border: "solid 1px", borderColor: "divider", py: 0.5, px: 1 },
|
|
2428
2506
|
shape: "rounded"
|
|
2429
2507
|
},
|
|
2430
|
-
/* @__PURE__ */
|
|
2508
|
+
/* @__PURE__ */ React15.createElement(Box10, { display: "flex", gap: 1, width: "100%" }, /* @__PURE__ */ React15.createElement(Skeleton, { variant: "text", width: "24px", height: "36px" }), /* @__PURE__ */ React15.createElement(Skeleton, { variant: "text", width: "100%", height: "36px" }))
|
|
2431
2509
|
))
|
|
2432
2510
|
);
|
|
2433
2511
|
};
|
|
2434
2512
|
|
|
2435
2513
|
// src/components/components-tab/components-list.tsx
|
|
2514
|
+
var LEARN_MORE_URL = "http://go.elementor.com/components-guide-article";
|
|
2515
|
+
var SUBTITLE_OVERRIDE_SX = {
|
|
2516
|
+
fontSize: "0.875rem !important",
|
|
2517
|
+
fontWeight: "500 !important"
|
|
2518
|
+
};
|
|
2436
2519
|
function ComponentsList() {
|
|
2437
2520
|
const { components, isLoading, searchValue } = useFilteredComponents();
|
|
2438
2521
|
if (isLoading) {
|
|
2439
|
-
return /* @__PURE__ */
|
|
2522
|
+
return /* @__PURE__ */ React16.createElement(LoadingComponents, null);
|
|
2440
2523
|
}
|
|
2441
2524
|
const isEmpty = !components || components.length === 0;
|
|
2442
2525
|
if (isEmpty) {
|
|
2443
2526
|
if (searchValue.length > 0) {
|
|
2444
|
-
return /* @__PURE__ */
|
|
2527
|
+
return /* @__PURE__ */ React16.createElement(EmptySearchResult, null);
|
|
2445
2528
|
}
|
|
2446
|
-
return /* @__PURE__ */
|
|
2529
|
+
return /* @__PURE__ */ React16.createElement(EmptyState, null);
|
|
2447
2530
|
}
|
|
2448
|
-
return /* @__PURE__ */
|
|
2531
|
+
return /* @__PURE__ */ React16.createElement(List3, { sx: { display: "flex", flexDirection: "column", gap: 1, px: 2 } }, components.map((component) => /* @__PURE__ */ React16.createElement(
|
|
2449
2532
|
ComponentItem,
|
|
2450
2533
|
{
|
|
2451
2534
|
key: component.uid,
|
|
@@ -2457,41 +2540,62 @@ function ComponentsList() {
|
|
|
2457
2540
|
)));
|
|
2458
2541
|
}
|
|
2459
2542
|
var EmptyState = () => {
|
|
2460
|
-
|
|
2543
|
+
const [isAngieModalOpen, setIsAngieModalOpen] = useState6(false);
|
|
2544
|
+
const handleCreateWithAI = () => {
|
|
2545
|
+
const sdk = getAngieSdk();
|
|
2546
|
+
if (sdk.isAngieReady()) {
|
|
2547
|
+
sdk.triggerAngie({
|
|
2548
|
+
prompt: __17(
|
|
2549
|
+
"Create a [hero/testimonial/product card/CTA/feature] component for my [business type]. Include [describe what you want]",
|
|
2550
|
+
"elementor"
|
|
2551
|
+
),
|
|
2552
|
+
context: { source: "components-panel-empty-state" }
|
|
2553
|
+
});
|
|
2554
|
+
} else {
|
|
2555
|
+
setIsAngieModalOpen(true);
|
|
2556
|
+
}
|
|
2557
|
+
};
|
|
2558
|
+
return /* @__PURE__ */ React16.createElement(
|
|
2461
2559
|
Stack10,
|
|
2462
2560
|
{
|
|
2463
2561
|
alignItems: "center",
|
|
2464
|
-
justifyContent: "
|
|
2562
|
+
justifyContent: "start",
|
|
2465
2563
|
height: "100%",
|
|
2466
|
-
sx: { px: 2
|
|
2467
|
-
gap:
|
|
2564
|
+
sx: { px: 2, py: 4 },
|
|
2565
|
+
gap: 2,
|
|
2468
2566
|
overflow: "hidden"
|
|
2469
2567
|
},
|
|
2470
|
-
/* @__PURE__ */
|
|
2471
|
-
|
|
2472
|
-
/* @__PURE__ */ React15.createElement(Typography8, { variant: "caption", align: "center", color: "text.secondary" }, __16(
|
|
2473
|
-
"Once you have Components, this is where you can manage them\u2014rearrange, duplicate, rename and delete irrelevant classes.",
|
|
2474
|
-
"elementor"
|
|
2475
|
-
)),
|
|
2476
|
-
/* @__PURE__ */ React15.createElement(Divider3, { sx: { width: "100%" }, color: "text.secondary" }),
|
|
2477
|
-
/* @__PURE__ */ React15.createElement(Typography8, { align: "left", variant: "caption", color: "text.secondary" }, __16("To create a component, first design it, then choose one of three options:", "elementor")),
|
|
2478
|
-
/* @__PURE__ */ React15.createElement(
|
|
2479
|
-
Typography8,
|
|
2568
|
+
/* @__PURE__ */ React16.createElement(Stack10, { alignItems: "center", gap: 1 }, /* @__PURE__ */ React16.createElement(ComponentsIcon2, { fontSize: "large", sx: { color: "text.secondary" } }), /* @__PURE__ */ React16.createElement(Typography9, { align: "center", variant: "subtitle2", color: "text.secondary", sx: SUBTITLE_OVERRIDE_SX }, __17("No components yet", "elementor")), /* @__PURE__ */ React16.createElement(Typography9, { align: "center", variant: "caption", color: "secondary", sx: { maxWidth: 200 } }, __17("Components are reusable blocks that sync across your site.", "elementor"), /* @__PURE__ */ React16.createElement("br", null), __17("Create once, use everywhere.", "elementor")), /* @__PURE__ */ React16.createElement(
|
|
2569
|
+
Link3,
|
|
2480
2570
|
{
|
|
2481
|
-
|
|
2571
|
+
href: LEARN_MORE_URL,
|
|
2572
|
+
target: "_blank",
|
|
2573
|
+
rel: "noopener noreferrer",
|
|
2482
2574
|
variant: "caption",
|
|
2483
|
-
color: "
|
|
2484
|
-
sx: { display: "flex", flexDirection: "column" }
|
|
2575
|
+
color: "info.main"
|
|
2485
2576
|
},
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
)
|
|
2577
|
+
__17("Learn more about components", "elementor")
|
|
2578
|
+
)),
|
|
2579
|
+
/* @__PURE__ */ React16.createElement(Divider3, { sx: { width: "100%" } }),
|
|
2580
|
+
/* @__PURE__ */ React16.createElement(Stack10, { alignItems: "center", gap: 1, width: "100%" }, /* @__PURE__ */ React16.createElement(Typography9, { align: "center", variant: "subtitle2", color: "text.secondary", sx: SUBTITLE_OVERRIDE_SX }, __17("Create your first one:", "elementor")), /* @__PURE__ */ React16.createElement(Typography9, { align: "center", variant: "caption", color: "secondary", sx: { maxWidth: 228 } }, __17(
|
|
2581
|
+
'Right-click any div-block or flexbox on your canvas or structure and select "Create component"',
|
|
2582
|
+
"elementor"
|
|
2583
|
+
)), /* @__PURE__ */ React16.createElement(Typography9, { align: "center", variant: "caption", color: "secondary" }, __17("Or", "elementor")), /* @__PURE__ */ React16.createElement(AngiePromotionModal, { open: isAngieModalOpen, onClose: () => setIsAngieModalOpen(false) }, /* @__PURE__ */ React16.createElement(
|
|
2584
|
+
Button4,
|
|
2585
|
+
{
|
|
2586
|
+
color: "secondary",
|
|
2587
|
+
variant: "outlined",
|
|
2588
|
+
size: "small",
|
|
2589
|
+
onClick: handleCreateWithAI,
|
|
2590
|
+
endIcon: /* @__PURE__ */ React16.createElement(AIIcon, null)
|
|
2591
|
+
},
|
|
2592
|
+
__17("Create component with AI", "elementor")
|
|
2593
|
+
)))
|
|
2490
2594
|
);
|
|
2491
2595
|
};
|
|
2492
2596
|
var EmptySearchResult = () => {
|
|
2493
2597
|
const { searchValue, clearSearch } = useSearch();
|
|
2494
|
-
return /* @__PURE__ */
|
|
2598
|
+
return /* @__PURE__ */ React16.createElement(
|
|
2495
2599
|
Stack10,
|
|
2496
2600
|
{
|
|
2497
2601
|
color: "text.secondary",
|
|
@@ -2501,28 +2605,29 @@ var EmptySearchResult = () => {
|
|
|
2501
2605
|
overflow: "hidden",
|
|
2502
2606
|
justifySelf: "center"
|
|
2503
2607
|
},
|
|
2504
|
-
/* @__PURE__ */
|
|
2505
|
-
/* @__PURE__ */
|
|
2608
|
+
/* @__PURE__ */ React16.createElement(ComponentsIcon2, null),
|
|
2609
|
+
/* @__PURE__ */ React16.createElement(
|
|
2506
2610
|
Box11,
|
|
2507
2611
|
{
|
|
2508
2612
|
sx: {
|
|
2509
2613
|
width: "100%"
|
|
2510
2614
|
}
|
|
2511
2615
|
},
|
|
2512
|
-
/* @__PURE__ */
|
|
2513
|
-
searchValue && /* @__PURE__ */
|
|
2514
|
-
|
|
2616
|
+
/* @__PURE__ */ React16.createElement(Typography9, { align: "center", variant: "subtitle2", color: "inherit", sx: SUBTITLE_OVERRIDE_SX }, __17("Sorry, nothing matched", "elementor")),
|
|
2617
|
+
searchValue && /* @__PURE__ */ React16.createElement(
|
|
2618
|
+
Typography9,
|
|
2515
2619
|
{
|
|
2516
2620
|
variant: "subtitle2",
|
|
2517
2621
|
color: "inherit",
|
|
2518
2622
|
sx: {
|
|
2623
|
+
...SUBTITLE_OVERRIDE_SX,
|
|
2519
2624
|
display: "flex",
|
|
2520
2625
|
width: "100%",
|
|
2521
2626
|
justifyContent: "center"
|
|
2522
2627
|
}
|
|
2523
2628
|
},
|
|
2524
|
-
/* @__PURE__ */
|
|
2525
|
-
/* @__PURE__ */
|
|
2629
|
+
/* @__PURE__ */ React16.createElement("span", null, "\u201C"),
|
|
2630
|
+
/* @__PURE__ */ React16.createElement(
|
|
2526
2631
|
"span",
|
|
2527
2632
|
{
|
|
2528
2633
|
style: {
|
|
@@ -2533,11 +2638,11 @@ var EmptySearchResult = () => {
|
|
|
2533
2638
|
},
|
|
2534
2639
|
searchValue
|
|
2535
2640
|
),
|
|
2536
|
-
/* @__PURE__ */
|
|
2641
|
+
/* @__PURE__ */ React16.createElement("span", null, "\u201D.")
|
|
2537
2642
|
)
|
|
2538
2643
|
),
|
|
2539
|
-
/* @__PURE__ */
|
|
2540
|
-
/* @__PURE__ */
|
|
2644
|
+
/* @__PURE__ */ React16.createElement(Typography9, { align: "center", variant: "caption", color: "inherit" }, __17("Try something else.", "elementor")),
|
|
2645
|
+
/* @__PURE__ */ React16.createElement(Typography9, { align: "center", variant: "caption", color: "inherit" }, /* @__PURE__ */ React16.createElement(Link3, { color: "secondary", variant: "caption", component: "button", onClick: clearSearch }, __17("Clear & try again", "elementor")))
|
|
2541
2646
|
);
|
|
2542
2647
|
};
|
|
2543
2648
|
var useFilteredComponents = () => {
|
|
@@ -2553,34 +2658,39 @@ var useFilteredComponents = () => {
|
|
|
2553
2658
|
};
|
|
2554
2659
|
|
|
2555
2660
|
// src/components/components-tab/components.tsx
|
|
2661
|
+
var ComponentsContent = () => {
|
|
2662
|
+
const { components, isLoading } = useComponents();
|
|
2663
|
+
const hasComponents = !isLoading && components.length > 0;
|
|
2664
|
+
return /* @__PURE__ */ React17.createElement(React17.Fragment, null, hasComponents && /* @__PURE__ */ React17.createElement(ComponentSearch, null), /* @__PURE__ */ React17.createElement(ComponentsList, null));
|
|
2665
|
+
};
|
|
2556
2666
|
var Components = () => {
|
|
2557
|
-
return /* @__PURE__ */
|
|
2667
|
+
return /* @__PURE__ */ React17.createElement(ThemeProvider2, null, /* @__PURE__ */ React17.createElement(SearchProvider, { localStorageKey: "elementor-components-search" }, /* @__PURE__ */ React17.createElement(ComponentsContent, null)));
|
|
2558
2668
|
};
|
|
2559
2669
|
|
|
2560
2670
|
// src/components/consts.ts
|
|
2561
2671
|
var COMPONENT_DOCUMENT_TYPE = "elementor_component";
|
|
2562
2672
|
|
|
2563
2673
|
// src/components/create-component-form/create-component-form.tsx
|
|
2564
|
-
import * as
|
|
2565
|
-
import { useEffect as useEffect2, useMemo as useMemo3, useRef as useRef5, useState as
|
|
2674
|
+
import * as React18 from "react";
|
|
2675
|
+
import { useEffect as useEffect2, useMemo as useMemo3, useRef as useRef5, useState as useState8 } from "react";
|
|
2566
2676
|
import { getElementLabel } from "@elementor/editor-elements";
|
|
2567
2677
|
import { notify as notify2 } from "@elementor/editor-notifications";
|
|
2568
2678
|
import { Form as FormElement, ThemeProvider as ThemeProvider3 } from "@elementor/editor-ui";
|
|
2569
2679
|
import { StarIcon } from "@elementor/icons";
|
|
2570
2680
|
import { __getState as getState15 } from "@elementor/store";
|
|
2571
|
-
import { Alert as Alert2, Button as
|
|
2572
|
-
import { __ as
|
|
2681
|
+
import { Alert as Alert2, Button as Button5, FormLabel as FormLabel2, Grid as Grid2, Popover as Popover3, Snackbar, Stack as Stack11, TextField as TextField3, Typography as Typography10 } from "@elementor/ui";
|
|
2682
|
+
import { __ as __19 } from "@wordpress/i18n";
|
|
2573
2683
|
|
|
2574
2684
|
// src/prevent-non-atomic-nesting.ts
|
|
2575
2685
|
import { isAtomicWidget } from "@elementor/editor-canvas";
|
|
2576
|
-
import { getAllDescendants, getElementType } from "@elementor/editor-elements";
|
|
2686
|
+
import { getAllDescendants as getAllDescendants2, getElementType } from "@elementor/editor-elements";
|
|
2577
2687
|
import { notify } from "@elementor/editor-notifications";
|
|
2578
2688
|
import { blockCommand } from "@elementor/editor-v1-adapters";
|
|
2579
2689
|
import { __getStore as getStore2 } from "@elementor/store";
|
|
2580
|
-
import { __ as
|
|
2690
|
+
import { __ as __18 } from "@wordpress/i18n";
|
|
2581
2691
|
var NON_ATOMIC_ELEMENT_ALERT = {
|
|
2582
2692
|
type: "default",
|
|
2583
|
-
message:
|
|
2693
|
+
message: __18("This widget isn't compatible with components. Use atomic elements instead.", "elementor"),
|
|
2584
2694
|
id: "non-atomic-element-blocked"
|
|
2585
2695
|
};
|
|
2586
2696
|
function initNonAtomicNestingPrevention() {
|
|
@@ -2631,7 +2741,7 @@ function blockNonAtomicMove(args) {
|
|
|
2631
2741
|
if (!container) {
|
|
2632
2742
|
return false;
|
|
2633
2743
|
}
|
|
2634
|
-
const allElements =
|
|
2744
|
+
const allElements = getAllDescendants2(container);
|
|
2635
2745
|
return allElements.some((element) => !isAtomicWidget(element));
|
|
2636
2746
|
});
|
|
2637
2747
|
if (hasNonAtomicElement) {
|
|
@@ -2711,10 +2821,10 @@ async function createUnpublishedComponent(name, element, eventData, overridableP
|
|
|
2711
2821
|
}
|
|
2712
2822
|
|
|
2713
2823
|
// src/components/create-component-form/hooks/use-form.ts
|
|
2714
|
-
import { useMemo as useMemo2, useState as
|
|
2824
|
+
import { useMemo as useMemo2, useState as useState7 } from "react";
|
|
2715
2825
|
var useForm = (initialValues) => {
|
|
2716
|
-
const [values, setValues] =
|
|
2717
|
-
const [errors, setErrors] =
|
|
2826
|
+
const [values, setValues] = useState7(initialValues);
|
|
2827
|
+
const [errors, setErrors] = useState7({});
|
|
2718
2828
|
const isValid = useMemo2(() => {
|
|
2719
2829
|
return !Object.values(errors).some((error) => error);
|
|
2720
2830
|
}, [errors]);
|
|
@@ -2790,9 +2900,9 @@ function countNestedElements(container) {
|
|
|
2790
2900
|
|
|
2791
2901
|
// src/components/create-component-form/create-component-form.tsx
|
|
2792
2902
|
function CreateComponentForm() {
|
|
2793
|
-
const [element, setElement] =
|
|
2794
|
-
const [anchorPosition, setAnchorPosition] =
|
|
2795
|
-
const [resultNotification, setResultNotification] =
|
|
2903
|
+
const [element, setElement] = useState8(null);
|
|
2904
|
+
const [anchorPosition, setAnchorPosition] = useState8();
|
|
2905
|
+
const [resultNotification, setResultNotification] = useState8(null);
|
|
2796
2906
|
const eventData = useRef5(null);
|
|
2797
2907
|
useEffect2(() => {
|
|
2798
2908
|
const OPEN_SAVE_AS_COMPONENT_FORM_EVENT = "elementor/editor/open-save-as-component-form";
|
|
@@ -2801,7 +2911,7 @@ function CreateComponentForm() {
|
|
|
2801
2911
|
if (nonAtomicElements.length > 0) {
|
|
2802
2912
|
notify2({
|
|
2803
2913
|
type: "default",
|
|
2804
|
-
message:
|
|
2914
|
+
message: __19(
|
|
2805
2915
|
"Components require atomic elements only. Remove widgets to create this component.",
|
|
2806
2916
|
"elementor"
|
|
2807
2917
|
),
|
|
@@ -2841,12 +2951,12 @@ function CreateComponentForm() {
|
|
|
2841
2951
|
setResultNotification({
|
|
2842
2952
|
show: true,
|
|
2843
2953
|
// Translators: %1$s: Component name, %2$s: Component UID
|
|
2844
|
-
message:
|
|
2954
|
+
message: __19("Component saved successfully as: %1$s (UID: %2$s)", "elementor").replace("%1$s", values.componentName).replace("%2$s", uid),
|
|
2845
2955
|
type: "success"
|
|
2846
2956
|
});
|
|
2847
2957
|
resetAndClosePopup();
|
|
2848
2958
|
} catch {
|
|
2849
|
-
const errorMessage =
|
|
2959
|
+
const errorMessage = __19("Failed to save component. Please try again.", "elementor");
|
|
2850
2960
|
setResultNotification({
|
|
2851
2961
|
show: true,
|
|
2852
2962
|
message: errorMessage,
|
|
@@ -2865,7 +2975,7 @@ function CreateComponentForm() {
|
|
|
2865
2975
|
...eventData.current
|
|
2866
2976
|
});
|
|
2867
2977
|
};
|
|
2868
|
-
return /* @__PURE__ */
|
|
2978
|
+
return /* @__PURE__ */ React18.createElement(ThemeProvider3, null, /* @__PURE__ */ React18.createElement(
|
|
2869
2979
|
Popover3,
|
|
2870
2980
|
{
|
|
2871
2981
|
open: element !== null,
|
|
@@ -2873,7 +2983,7 @@ function CreateComponentForm() {
|
|
|
2873
2983
|
anchorReference: "anchorPosition",
|
|
2874
2984
|
anchorPosition
|
|
2875
2985
|
},
|
|
2876
|
-
element !== null && /* @__PURE__ */
|
|
2986
|
+
element !== null && /* @__PURE__ */ React18.createElement(
|
|
2877
2987
|
Form2,
|
|
2878
2988
|
{
|
|
2879
2989
|
initialValues: { componentName: element.elementLabel },
|
|
@@ -2881,7 +2991,7 @@ function CreateComponentForm() {
|
|
|
2881
2991
|
closePopup: cancelSave
|
|
2882
2992
|
}
|
|
2883
2993
|
)
|
|
2884
|
-
), /* @__PURE__ */
|
|
2994
|
+
), /* @__PURE__ */ React18.createElement(Snackbar, { open: resultNotification?.show, onClose: () => setResultNotification(null) }, /* @__PURE__ */ React18.createElement(
|
|
2885
2995
|
Alert2,
|
|
2886
2996
|
{
|
|
2887
2997
|
onClose: () => setResultNotification(null),
|
|
@@ -2917,13 +3027,13 @@ var Form2 = ({
|
|
|
2917
3027
|
}
|
|
2918
3028
|
};
|
|
2919
3029
|
const texts = {
|
|
2920
|
-
heading:
|
|
2921
|
-
name:
|
|
2922
|
-
cancel:
|
|
2923
|
-
create:
|
|
3030
|
+
heading: __19("Save as a component", "elementor"),
|
|
3031
|
+
name: __19("Name", "elementor"),
|
|
3032
|
+
cancel: __19("Cancel", "elementor"),
|
|
3033
|
+
create: __19("Create", "elementor")
|
|
2924
3034
|
};
|
|
2925
3035
|
const nameInputId = "component-name";
|
|
2926
|
-
return /* @__PURE__ */
|
|
3036
|
+
return /* @__PURE__ */ React18.createElement(FormElement, { onSubmit: handleSubmit }, /* @__PURE__ */ React18.createElement(Stack11, { alignItems: "start", width: "268px" }, /* @__PURE__ */ React18.createElement(
|
|
2927
3037
|
Stack11,
|
|
2928
3038
|
{
|
|
2929
3039
|
direction: "row",
|
|
@@ -2932,9 +3042,9 @@ var Form2 = ({
|
|
|
2932
3042
|
px: 1.5,
|
|
2933
3043
|
sx: { columnGap: 0.5, borderBottom: "1px solid", borderColor: "divider", width: "100%" }
|
|
2934
3044
|
},
|
|
2935
|
-
/* @__PURE__ */
|
|
2936
|
-
/* @__PURE__ */
|
|
2937
|
-
), /* @__PURE__ */
|
|
3045
|
+
/* @__PURE__ */ React18.createElement(StarIcon, { fontSize: FONT_SIZE }),
|
|
3046
|
+
/* @__PURE__ */ React18.createElement(Typography10, { variant: "caption", sx: { color: "text.primary", fontWeight: "500", lineHeight: 1 } }, texts.heading)
|
|
3047
|
+
), /* @__PURE__ */ React18.createElement(Grid2, { container: true, gap: 0.75, alignItems: "start", p: 1.5 }, /* @__PURE__ */ React18.createElement(Grid2, { item: true, xs: 12 }, /* @__PURE__ */ React18.createElement(FormLabel2, { htmlFor: nameInputId, size: "tiny" }, texts.name)), /* @__PURE__ */ React18.createElement(Grid2, { item: true, xs: 12 }, /* @__PURE__ */ React18.createElement(
|
|
2938
3048
|
TextField3,
|
|
2939
3049
|
{
|
|
2940
3050
|
id: nameInputId,
|
|
@@ -2946,19 +3056,19 @@ var Form2 = ({
|
|
|
2946
3056
|
error: Boolean(errors.componentName),
|
|
2947
3057
|
helperText: errors.componentName
|
|
2948
3058
|
}
|
|
2949
|
-
))), /* @__PURE__ */
|
|
3059
|
+
))), /* @__PURE__ */ React18.createElement(Stack11, { direction: "row", justifyContent: "flex-end", alignSelf: "end", py: 1, px: 1.5 }, /* @__PURE__ */ React18.createElement(Button5, { onClick: closePopup, color: "secondary", variant: "text", size: "small" }, texts.cancel), /* @__PURE__ */ React18.createElement(Button5, { type: "submit", disabled: !isValid, variant: "contained", color: "primary", size: "small" }, texts.create))));
|
|
2950
3060
|
};
|
|
2951
3061
|
|
|
2952
3062
|
// src/components/edit-component/edit-component.tsx
|
|
2953
|
-
import * as
|
|
3063
|
+
import * as React20 from "react";
|
|
2954
3064
|
import { useEffect as useEffect5 } from "react";
|
|
2955
|
-
import { getV1DocumentsManager as
|
|
3065
|
+
import { getV1DocumentsManager as getV1DocumentsManager5 } from "@elementor/editor-documents";
|
|
2956
3066
|
import { __privateListenTo as listenTo, commandEndEvent as commandEndEvent2 } from "@elementor/editor-v1-adapters";
|
|
2957
3067
|
import { __useSelector as useSelector5 } from "@elementor/store";
|
|
2958
3068
|
import { throttle as throttle2 } from "@elementor/utils";
|
|
2959
3069
|
|
|
2960
3070
|
// src/store/actions/update-current-component.ts
|
|
2961
|
-
import { setDocumentModifiedStatus as
|
|
3071
|
+
import { setDocumentModifiedStatus as setDocumentModifiedStatus6 } from "@elementor/editor-documents";
|
|
2962
3072
|
import { __getStore as getStore3 } from "@elementor/store";
|
|
2963
3073
|
function updateCurrentComponent({
|
|
2964
3074
|
path,
|
|
@@ -2973,10 +3083,10 @@ function updateCurrentComponent({
|
|
|
2973
3083
|
}
|
|
2974
3084
|
|
|
2975
3085
|
// src/components/edit-component/component-modal.tsx
|
|
2976
|
-
import * as
|
|
3086
|
+
import * as React19 from "react";
|
|
2977
3087
|
import { useEffect as useEffect4 } from "react";
|
|
2978
3088
|
import { createPortal } from "react-dom";
|
|
2979
|
-
import { __ as
|
|
3089
|
+
import { __ as __20 } from "@wordpress/i18n";
|
|
2980
3090
|
|
|
2981
3091
|
// src/hooks/use-canvas-document.ts
|
|
2982
3092
|
import { getCanvasIframeDocument } from "@elementor/editor-canvas";
|
|
@@ -2986,10 +3096,10 @@ function useCanvasDocument() {
|
|
|
2986
3096
|
}
|
|
2987
3097
|
|
|
2988
3098
|
// src/hooks/use-element-rect.ts
|
|
2989
|
-
import { useEffect as useEffect3, useState as
|
|
3099
|
+
import { useEffect as useEffect3, useState as useState9 } from "react";
|
|
2990
3100
|
import { throttle } from "@elementor/utils";
|
|
2991
3101
|
function useElementRect(element) {
|
|
2992
|
-
const [rect, setRect] =
|
|
3102
|
+
const [rect, setRect] = useState9(new DOMRect(0, 0, 0, 0));
|
|
2993
3103
|
const onChange = throttle(
|
|
2994
3104
|
() => {
|
|
2995
3105
|
setRect(element?.getBoundingClientRect() ?? new DOMRect(0, 0, 0, 0));
|
|
@@ -3066,7 +3176,7 @@ function ComponentModal({ element, onClose }) {
|
|
|
3066
3176
|
return null;
|
|
3067
3177
|
}
|
|
3068
3178
|
return createPortal(
|
|
3069
|
-
/* @__PURE__ */
|
|
3179
|
+
/* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(BlockEditPage, null), /* @__PURE__ */ React19.createElement(Backdrop, { canvas: canvasDocument, element, onClose })),
|
|
3070
3180
|
canvasDocument.body
|
|
3071
3181
|
);
|
|
3072
3182
|
}
|
|
@@ -3090,7 +3200,7 @@ function Backdrop({ canvas, element, onClose }) {
|
|
|
3090
3200
|
onClose();
|
|
3091
3201
|
}
|
|
3092
3202
|
};
|
|
3093
|
-
return /* @__PURE__ */
|
|
3203
|
+
return /* @__PURE__ */ React19.createElement(
|
|
3094
3204
|
"div",
|
|
3095
3205
|
{
|
|
3096
3206
|
style: backdropStyle,
|
|
@@ -3098,7 +3208,7 @@ function Backdrop({ canvas, element, onClose }) {
|
|
|
3098
3208
|
onKeyDown: handleKeyDown,
|
|
3099
3209
|
role: "button",
|
|
3100
3210
|
tabIndex: 0,
|
|
3101
|
-
"aria-label":
|
|
3211
|
+
"aria-label": __20("Exit component editing mode", "elementor")
|
|
3102
3212
|
}
|
|
3103
3213
|
);
|
|
3104
3214
|
}
|
|
@@ -3148,7 +3258,7 @@ function BlockEditPage() {
|
|
|
3148
3258
|
}
|
|
3149
3259
|
}
|
|
3150
3260
|
`;
|
|
3151
|
-
return /* @__PURE__ */
|
|
3261
|
+
return /* @__PURE__ */ React19.createElement("style", { "data-e-style-id": "e-block-v3-document-handles-styles" }, blockV3DocumentHandlesStyles);
|
|
3152
3262
|
}
|
|
3153
3263
|
|
|
3154
3264
|
// src/components/edit-component/edit-component.tsx
|
|
@@ -3161,10 +3271,10 @@ function EditComponent() {
|
|
|
3161
3271
|
if (!elementDom) {
|
|
3162
3272
|
return null;
|
|
3163
3273
|
}
|
|
3164
|
-
return /* @__PURE__ */
|
|
3274
|
+
return /* @__PURE__ */ React20.createElement(ComponentModal, { element: elementDom, onClose });
|
|
3165
3275
|
}
|
|
3166
3276
|
function useHandleDocumentSwitches() {
|
|
3167
|
-
const documentsManager =
|
|
3277
|
+
const documentsManager = getV1DocumentsManager5();
|
|
3168
3278
|
const currentComponentId = useCurrentComponentId();
|
|
3169
3279
|
const path = useSelector5(selectPath);
|
|
3170
3280
|
useEffect5(() => {
|
|
@@ -3208,7 +3318,7 @@ function getInstanceTitle(instanceId, path) {
|
|
|
3208
3318
|
if (!instanceId) {
|
|
3209
3319
|
return void 0;
|
|
3210
3320
|
}
|
|
3211
|
-
const documentsManager =
|
|
3321
|
+
const documentsManager = getV1DocumentsManager5();
|
|
3212
3322
|
const parentDocId = path.at(-1)?.componentId ?? documentsManager.getInitialId();
|
|
3213
3323
|
const parentDoc = documentsManager.get(parentDocId);
|
|
3214
3324
|
const parentContainer = parentDoc?.container;
|
|
@@ -3222,7 +3332,7 @@ function getComponentDOMElement(id2) {
|
|
|
3222
3332
|
if (!id2) {
|
|
3223
3333
|
return null;
|
|
3224
3334
|
}
|
|
3225
|
-
const documentsManager =
|
|
3335
|
+
const documentsManager = getV1DocumentsManager5();
|
|
3226
3336
|
const currentComponent = documentsManager.get(id2);
|
|
3227
3337
|
const widget = currentComponent?.container;
|
|
3228
3338
|
const container = widget?.view?.el?.children?.[0] ?? null;
|
|
@@ -3231,33 +3341,33 @@ function getComponentDOMElement(id2) {
|
|
|
3231
3341
|
}
|
|
3232
3342
|
|
|
3233
3343
|
// src/components/in-edit-mode.tsx
|
|
3234
|
-
import * as
|
|
3344
|
+
import * as React21 from "react";
|
|
3235
3345
|
import { closeDialog, openDialog } from "@elementor/editor-ui";
|
|
3236
3346
|
import { InfoCircleFilledIcon } from "@elementor/icons";
|
|
3237
|
-
import { Box as Box12, Button as
|
|
3238
|
-
import { __ as
|
|
3347
|
+
import { Box as Box12, Button as Button6, DialogActions, DialogContent, DialogHeader, Icon, Stack as Stack12, Typography as Typography11 } from "@elementor/ui";
|
|
3348
|
+
import { __ as __21 } from "@wordpress/i18n";
|
|
3239
3349
|
var openEditModeDialog = (lockedBy) => {
|
|
3240
3350
|
openDialog({
|
|
3241
|
-
component: /* @__PURE__ */
|
|
3351
|
+
component: /* @__PURE__ */ React21.createElement(EditModeDialog, { lockedBy })
|
|
3242
3352
|
});
|
|
3243
3353
|
};
|
|
3244
3354
|
var EditModeDialog = ({ lockedBy }) => {
|
|
3245
|
-
const content =
|
|
3246
|
-
return /* @__PURE__ */
|
|
3355
|
+
const content = __21("%s is currently editing this document", "elementor").replace("%s", lockedBy);
|
|
3356
|
+
return /* @__PURE__ */ React21.createElement(React21.Fragment, null, /* @__PURE__ */ React21.createElement(DialogHeader, { logo: false }, /* @__PURE__ */ React21.createElement(Box12, { display: "flex", alignItems: "center", gap: 1 }, /* @__PURE__ */ React21.createElement(Icon, { color: "secondary" }, /* @__PURE__ */ React21.createElement(InfoCircleFilledIcon, { fontSize: "medium" })), /* @__PURE__ */ React21.createElement(Typography11, { variant: "subtitle1" }, content))), /* @__PURE__ */ React21.createElement(DialogContent, null, /* @__PURE__ */ React21.createElement(Stack12, { spacing: 2, direction: "column" }, /* @__PURE__ */ React21.createElement(Typography11, { variant: "body2" }, __21(
|
|
3247
3357
|
"You can wait for them to finish or reach out to coordinate your changes together.",
|
|
3248
3358
|
"elementor"
|
|
3249
|
-
)), /* @__PURE__ */
|
|
3359
|
+
)), /* @__PURE__ */ React21.createElement(DialogActions, null, /* @__PURE__ */ React21.createElement(Button6, { color: "secondary", variant: "contained", onClick: closeDialog }, __21("Close", "elementor"))))));
|
|
3250
3360
|
};
|
|
3251
3361
|
|
|
3252
3362
|
// src/components/instance-editing-panel/instance-editing-panel.tsx
|
|
3253
|
-
import * as
|
|
3363
|
+
import * as React26 from "react";
|
|
3254
3364
|
import { ControlAdornmentsProvider } from "@elementor/editor-controls";
|
|
3255
3365
|
import { getFieldIndicators } from "@elementor/editor-editing-panel";
|
|
3256
3366
|
import { useSelectedElement as useSelectedElement2 } from "@elementor/editor-elements";
|
|
3257
3367
|
import { PanelBody as PanelBody2, PanelHeader as PanelHeader2, PanelHeaderTitle as PanelHeaderTitle2 } from "@elementor/editor-panels";
|
|
3258
3368
|
import { ComponentsIcon as ComponentsIcon3, PencilIcon as PencilIcon2 } from "@elementor/icons";
|
|
3259
3369
|
import { IconButton as IconButton6, Stack as Stack17, Tooltip as Tooltip4 } from "@elementor/ui";
|
|
3260
|
-
import { __ as
|
|
3370
|
+
import { __ as __23 } from "@wordpress/i18n";
|
|
3261
3371
|
|
|
3262
3372
|
// src/hooks/use-component-instance-settings.ts
|
|
3263
3373
|
import { useElement } from "@elementor/editor-editing-panel";
|
|
@@ -3323,12 +3433,12 @@ function useComponentInstanceSettings() {
|
|
|
3323
3433
|
}
|
|
3324
3434
|
|
|
3325
3435
|
// src/components/instance-editing-panel/empty-state.tsx
|
|
3326
|
-
import * as
|
|
3436
|
+
import * as React22 from "react";
|
|
3327
3437
|
import { ComponentPropListIcon as ComponentPropListIcon4, PencilIcon } from "@elementor/icons";
|
|
3328
|
-
import { Button as
|
|
3329
|
-
import { __ as
|
|
3438
|
+
import { Button as Button7, Stack as Stack13, Typography as Typography12 } from "@elementor/ui";
|
|
3439
|
+
import { __ as __22 } from "@wordpress/i18n";
|
|
3330
3440
|
var EmptyState2 = ({ onEditComponent }) => {
|
|
3331
|
-
return /* @__PURE__ */
|
|
3441
|
+
return /* @__PURE__ */ React22.createElement(
|
|
3332
3442
|
Stack13,
|
|
3333
3443
|
{
|
|
3334
3444
|
alignItems: "center",
|
|
@@ -3338,25 +3448,25 @@ var EmptyState2 = ({ onEditComponent }) => {
|
|
|
3338
3448
|
sx: { p: 2.5, pt: 8, pb: 5.5, mt: 1 },
|
|
3339
3449
|
gap: 1.5
|
|
3340
3450
|
},
|
|
3341
|
-
/* @__PURE__ */
|
|
3342
|
-
/* @__PURE__ */
|
|
3343
|
-
/* @__PURE__ */
|
|
3451
|
+
/* @__PURE__ */ React22.createElement(ComponentPropListIcon4, { fontSize: "large" }),
|
|
3452
|
+
/* @__PURE__ */ React22.createElement(Typography12, { align: "center", variant: "subtitle2" }, __22("No properties yet", "elementor")),
|
|
3453
|
+
/* @__PURE__ */ React22.createElement(Typography12, { align: "center", variant: "caption", maxWidth: "170px" }, __22(
|
|
3344
3454
|
"Edit the component to add properties, manage them or update the design across all instances.",
|
|
3345
3455
|
"elementor"
|
|
3346
3456
|
)),
|
|
3347
|
-
/* @__PURE__ */
|
|
3457
|
+
/* @__PURE__ */ React22.createElement(Button7, { variant: "outlined", color: "secondary", size: "small", sx: { mt: 1 }, onClick: onEditComponent }, /* @__PURE__ */ React22.createElement(PencilIcon, { fontSize: "small" }), __22("Edit component", "elementor"))
|
|
3348
3458
|
);
|
|
3349
3459
|
};
|
|
3350
3460
|
|
|
3351
3461
|
// src/components/instance-editing-panel/override-props-group.tsx
|
|
3352
|
-
import * as
|
|
3462
|
+
import * as React25 from "react";
|
|
3353
3463
|
import { useId } from "react";
|
|
3354
3464
|
import { useStateByElement } from "@elementor/editor-editing-panel";
|
|
3355
3465
|
import { CollapseIcon } from "@elementor/editor-ui";
|
|
3356
3466
|
import { Box as Box13, Collapse, ListItemButton as ListItemButton3, ListItemText, Stack as Stack16 } from "@elementor/ui";
|
|
3357
3467
|
|
|
3358
3468
|
// src/components/instance-editing-panel/override-prop-control.tsx
|
|
3359
|
-
import * as
|
|
3469
|
+
import * as React24 from "react";
|
|
3360
3470
|
import { PropKeyProvider, PropProvider, useBoundProp } from "@elementor/editor-controls";
|
|
3361
3471
|
import {
|
|
3362
3472
|
controlsRegistry,
|
|
@@ -3450,16 +3560,16 @@ function getPropType({ widgetType, propKey }) {
|
|
|
3450
3560
|
}
|
|
3451
3561
|
|
|
3452
3562
|
// src/components/control-label.tsx
|
|
3453
|
-
import * as
|
|
3563
|
+
import * as React23 from "react";
|
|
3454
3564
|
import { ControlAdornments, ControlFormLabel } from "@elementor/editor-controls";
|
|
3455
3565
|
import { Stack as Stack14 } from "@elementor/ui";
|
|
3456
3566
|
var ControlLabel = ({ children, ...props }) => {
|
|
3457
|
-
return /* @__PURE__ */
|
|
3567
|
+
return /* @__PURE__ */ React23.createElement(Stack14, { direction: "row", alignItems: "center", justifyItems: "start", gap: 0.25 }, /* @__PURE__ */ React23.createElement(ControlFormLabel, { ...props }, children), /* @__PURE__ */ React23.createElement(ControlAdornments, null));
|
|
3458
3568
|
};
|
|
3459
3569
|
|
|
3460
3570
|
// src/components/instance-editing-panel/override-prop-control.tsx
|
|
3461
3571
|
function OverridePropControl({ overridableProp, overrides }) {
|
|
3462
|
-
return /* @__PURE__ */
|
|
3572
|
+
return /* @__PURE__ */ React24.createElement(SettingsField, { bind: "component_instance", propDisplayName: overridableProp.label }, /* @__PURE__ */ React24.createElement(OverrideControl, { overridableProp, overrides }));
|
|
3463
3573
|
}
|
|
3464
3574
|
function OverrideControl({ overridableProp, overrides }) {
|
|
3465
3575
|
const componentId = useCurrentComponentId();
|
|
@@ -3506,7 +3616,7 @@ function OverrideControl({ overridableProp, overrides }) {
|
|
|
3506
3616
|
updateOverridableProp(componentId, overridableValue, { elType, widgetType, propKey });
|
|
3507
3617
|
}
|
|
3508
3618
|
};
|
|
3509
|
-
return /* @__PURE__ */
|
|
3619
|
+
return /* @__PURE__ */ React24.createElement(
|
|
3510
3620
|
PropProvider,
|
|
3511
3621
|
{
|
|
3512
3622
|
propType: propTypeSchema,
|
|
@@ -3516,7 +3626,7 @@ function OverrideControl({ overridableProp, overrides }) {
|
|
|
3516
3626
|
return false;
|
|
3517
3627
|
}
|
|
3518
3628
|
},
|
|
3519
|
-
/* @__PURE__ */
|
|
3629
|
+
/* @__PURE__ */ React24.createElement(PropKeyProvider, { bind: overridableProp.overrideKey }, /* @__PURE__ */ React24.createElement(Stack15, { direction: "column", gap: 1, mb: 1.5 }, /* @__PURE__ */ React24.createElement(ControlLabel, null, overridableProp.label), getControl(controls, overridableProp?.originPropFields ?? overridableProp)))
|
|
3520
3630
|
);
|
|
3521
3631
|
}
|
|
3522
3632
|
function getPropValue(value) {
|
|
@@ -3569,7 +3679,7 @@ function createOverrideValue(overrideKey, overrideValue, componentId) {
|
|
|
3569
3679
|
function getControl(controls, originPropFields) {
|
|
3570
3680
|
const ControlComponent = controlsRegistry.get(controls[originPropFields.propKey].value.type);
|
|
3571
3681
|
const controlProps = controls[originPropFields.propKey].value.props;
|
|
3572
|
-
return /* @__PURE__ */
|
|
3682
|
+
return /* @__PURE__ */ React24.createElement(ControlComponent, { ...controlProps });
|
|
3573
3683
|
}
|
|
3574
3684
|
|
|
3575
3685
|
// src/components/instance-editing-panel/override-props-group.tsx
|
|
@@ -3582,7 +3692,7 @@ function OverridePropsGroup({ group, props, overrides }) {
|
|
|
3582
3692
|
const labelId = `label-${id2}`;
|
|
3583
3693
|
const contentId = `content-${id2}`;
|
|
3584
3694
|
const title = group.label;
|
|
3585
|
-
return /* @__PURE__ */
|
|
3695
|
+
return /* @__PURE__ */ React25.createElement(Box13, { "aria-label": `${title} section` }, /* @__PURE__ */ React25.createElement(
|
|
3586
3696
|
ListItemButton3,
|
|
3587
3697
|
{
|
|
3588
3698
|
id: labelId,
|
|
@@ -3592,7 +3702,7 @@ function OverridePropsGroup({ group, props, overrides }) {
|
|
|
3592
3702
|
p: 0,
|
|
3593
3703
|
sx: { "&:hover": { backgroundColor: "transparent" } }
|
|
3594
3704
|
},
|
|
3595
|
-
/* @__PURE__ */
|
|
3705
|
+
/* @__PURE__ */ React25.createElement(Stack16, { direction: "row", alignItems: "center", justifyItems: "start", flexGrow: 1, gap: 0.5 }, /* @__PURE__ */ React25.createElement(
|
|
3596
3706
|
ListItemText,
|
|
3597
3707
|
{
|
|
3598
3708
|
secondary: title,
|
|
@@ -3600,8 +3710,8 @@ function OverridePropsGroup({ group, props, overrides }) {
|
|
|
3600
3710
|
sx: { flexGrow: 0, flexShrink: 1, marginInlineEnd: 1 }
|
|
3601
3711
|
}
|
|
3602
3712
|
)),
|
|
3603
|
-
/* @__PURE__ */
|
|
3604
|
-
), /* @__PURE__ */
|
|
3713
|
+
/* @__PURE__ */ React25.createElement(CollapseIcon, { open: isOpen, color: "secondary", fontSize: "tiny" })
|
|
3714
|
+
), /* @__PURE__ */ React25.createElement(Collapse, { id: contentId, "aria-labelledby": labelId, in: isOpen, timeout: "auto" }, /* @__PURE__ */ React25.createElement(Stack16, { direction: "column", gap: 1, p: 2 }, group.props.map((overrideKey) => /* @__PURE__ */ React25.createElement(
|
|
3605
3715
|
OverridePropControl,
|
|
3606
3716
|
{
|
|
3607
3717
|
key: overrideKey,
|
|
@@ -3622,12 +3732,12 @@ function InstanceEditingPanel() {
|
|
|
3622
3732
|
if (!componentId || !overridableProps || !component) {
|
|
3623
3733
|
return null;
|
|
3624
3734
|
}
|
|
3625
|
-
const panelTitle =
|
|
3735
|
+
const panelTitle = __23("Edit %s", "elementor").replace("%s", component.name);
|
|
3626
3736
|
const handleEditComponent = () => switchToComponent(componentId, componentInstanceId);
|
|
3627
3737
|
const isNonEmptyGroup = (group) => group !== null && group.props.length > 0;
|
|
3628
3738
|
const groups = overridableProps.groups.order.map((groupId) => overridableProps.groups.items[groupId] ?? null).filter(isNonEmptyGroup);
|
|
3629
3739
|
const isEmpty = groups.length === 0 || Object.keys(overridableProps.props).length === 0;
|
|
3630
|
-
return /* @__PURE__ */
|
|
3740
|
+
return /* @__PURE__ */ React26.createElement(React26.Fragment, null, /* @__PURE__ */ React26.createElement(PanelHeader2, { sx: { justifyContent: "start", px: 2 } }, /* @__PURE__ */ React26.createElement(Stack17, { direction: "row", alignContent: "space-between", flexGrow: 1 }, /* @__PURE__ */ React26.createElement(Stack17, { direction: "row", alignItems: "center", justifyContent: "start", gap: 1, flexGrow: 1 }, /* @__PURE__ */ React26.createElement(ComponentsIcon3, { fontSize: "small", sx: { color: "text.tertiary" } }), /* @__PURE__ */ React26.createElement(PanelHeaderTitle2, null, component.name)), /* @__PURE__ */ React26.createElement(Tooltip4, { title: panelTitle }, /* @__PURE__ */ React26.createElement(IconButton6, { size: "tiny", onClick: handleEditComponent, "aria-label": panelTitle }, /* @__PURE__ */ React26.createElement(PencilIcon2, { fontSize: "tiny" }))))), /* @__PURE__ */ React26.createElement(PanelBody2, null, /* @__PURE__ */ React26.createElement(ControlAdornmentsProvider, { items: getFieldIndicators("settings") }, isEmpty ? /* @__PURE__ */ React26.createElement(EmptyState2, { onEditComponent: handleEditComponent }) : /* @__PURE__ */ React26.createElement(Stack17, { direction: "column", alignItems: "stretch" }, groups.map((group) => /* @__PURE__ */ React26.createElement(
|
|
3631
3741
|
OverridePropsGroup,
|
|
3632
3742
|
{
|
|
3633
3743
|
key: group.id,
|
|
@@ -3639,16 +3749,16 @@ function InstanceEditingPanel() {
|
|
|
3639
3749
|
}
|
|
3640
3750
|
|
|
3641
3751
|
// src/components/overridable-props/overridable-prop-control.tsx
|
|
3642
|
-
import * as
|
|
3752
|
+
import * as React28 from "react";
|
|
3643
3753
|
import { ControlReplacementsProvider, PropKeyProvider as PropKeyProvider2, PropProvider as PropProvider2, useBoundProp as useBoundProp2 } from "@elementor/editor-controls";
|
|
3644
3754
|
import { createTopLevelObjectType as createTopLevelObjectType2, useElement as useElement2 } from "@elementor/editor-editing-panel";
|
|
3645
3755
|
|
|
3646
3756
|
// src/provider/overridable-prop-context.tsx
|
|
3647
|
-
import * as
|
|
3757
|
+
import * as React27 from "react";
|
|
3648
3758
|
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
3649
3759
|
var OverridablePropContext = createContext2(null);
|
|
3650
3760
|
function OverridablePropProvider({ children, ...props }) {
|
|
3651
|
-
return /* @__PURE__ */
|
|
3761
|
+
return /* @__PURE__ */ React27.createElement(OverridablePropContext.Provider, { value: props }, children);
|
|
3652
3762
|
}
|
|
3653
3763
|
var useOverridablePropValue = () => useContext2(OverridablePropContext)?.value;
|
|
3654
3764
|
|
|
@@ -3687,7 +3797,7 @@ function OverridablePropControl({
|
|
|
3687
3797
|
});
|
|
3688
3798
|
const propValue = isComponentInstance2 ? (value.origin_value?.value).override_value : value.origin_value;
|
|
3689
3799
|
const objectPlaceholder = placeholder ? { [bind]: placeholder } : void 0;
|
|
3690
|
-
return /* @__PURE__ */
|
|
3800
|
+
return /* @__PURE__ */ React28.createElement(OverridablePropProvider, { value }, /* @__PURE__ */ React28.createElement(
|
|
3691
3801
|
PropProvider2,
|
|
3692
3802
|
{
|
|
3693
3803
|
...propContext,
|
|
@@ -3698,17 +3808,17 @@ function OverridablePropControl({
|
|
|
3698
3808
|
},
|
|
3699
3809
|
placeholder: objectPlaceholder
|
|
3700
3810
|
},
|
|
3701
|
-
/* @__PURE__ */
|
|
3811
|
+
/* @__PURE__ */ React28.createElement(PropKeyProvider2, { bind }, /* @__PURE__ */ React28.createElement(ControlReplacementsProvider, { replacements: [] }, /* @__PURE__ */ React28.createElement(OriginalControl, { ...props })))
|
|
3702
3812
|
));
|
|
3703
3813
|
}
|
|
3704
3814
|
|
|
3705
3815
|
// src/components/overridable-props/overridable-prop-indicator.tsx
|
|
3706
|
-
import * as
|
|
3816
|
+
import * as React30 from "react";
|
|
3707
3817
|
import { useBoundProp as useBoundProp3 } from "@elementor/editor-controls";
|
|
3708
3818
|
import { useElement as useElement3 } from "@elementor/editor-editing-panel";
|
|
3709
3819
|
import { getWidgetsCache as getWidgetsCache3 } from "@elementor/editor-elements";
|
|
3710
3820
|
import { bindPopover as bindPopover2, bindTrigger as bindTrigger4, Popover as Popover4, Tooltip as Tooltip5, usePopupState as usePopupState4 } from "@elementor/ui";
|
|
3711
|
-
import { __ as
|
|
3821
|
+
import { __ as __25 } from "@wordpress/i18n";
|
|
3712
3822
|
|
|
3713
3823
|
// src/store/actions/set-overridable-prop.ts
|
|
3714
3824
|
import { __dispatch as dispatch13, __getState as getState17 } from "@elementor/store";
|
|
@@ -3775,11 +3885,11 @@ function setOverridableProp({
|
|
|
3775
3885
|
}
|
|
3776
3886
|
|
|
3777
3887
|
// src/components/overridable-props/indicator.tsx
|
|
3778
|
-
import * as
|
|
3888
|
+
import * as React29 from "react";
|
|
3779
3889
|
import { forwardRef as forwardRef2 } from "react";
|
|
3780
3890
|
import { CheckIcon, PlusIcon } from "@elementor/icons";
|
|
3781
3891
|
import { Box as Box14, styled as styled4 } from "@elementor/ui";
|
|
3782
|
-
import { __ as
|
|
3892
|
+
import { __ as __24 } from "@wordpress/i18n";
|
|
3783
3893
|
var SIZE2 = "tiny";
|
|
3784
3894
|
var IconContainer = styled4(Box14)`
|
|
3785
3895
|
pointer-events: none;
|
|
@@ -3835,13 +3945,13 @@ var Content = styled4(Box14)`
|
|
|
3835
3945
|
}
|
|
3836
3946
|
}
|
|
3837
3947
|
`;
|
|
3838
|
-
var Indicator2 = forwardRef2(({ isOpen, isOverridable, ...props }, ref) => /* @__PURE__ */
|
|
3948
|
+
var Indicator2 = forwardRef2(({ isOpen, isOverridable, ...props }, ref) => /* @__PURE__ */ React29.createElement(Content, { ref, ...props, className: isOpen || isOverridable ? "enlarged" : "" }, /* @__PURE__ */ React29.createElement(
|
|
3839
3949
|
IconContainer,
|
|
3840
3950
|
{
|
|
3841
3951
|
className: "icon",
|
|
3842
|
-
"aria-label": isOverridable ?
|
|
3952
|
+
"aria-label": isOverridable ? __24("Overridable property", "elementor") : __24("Make prop overridable", "elementor")
|
|
3843
3953
|
},
|
|
3844
|
-
isOverridable ? /* @__PURE__ */
|
|
3954
|
+
isOverridable ? /* @__PURE__ */ React29.createElement(CheckIcon, { fontSize: SIZE2 }) : /* @__PURE__ */ React29.createElement(PlusIcon, { fontSize: SIZE2 })
|
|
3845
3955
|
)));
|
|
3846
3956
|
|
|
3847
3957
|
// src/components/overridable-props/utils/get-overridable-prop.ts
|
|
@@ -3866,7 +3976,7 @@ function OverridablePropIndicator() {
|
|
|
3866
3976
|
if (!isPropAllowed(bind) || !componentId || !overridableProps) {
|
|
3867
3977
|
return null;
|
|
3868
3978
|
}
|
|
3869
|
-
return /* @__PURE__ */
|
|
3979
|
+
return /* @__PURE__ */ React30.createElement(Content2, { componentId, overridableProps });
|
|
3870
3980
|
}
|
|
3871
3981
|
function Content2({ componentId, overridableProps }) {
|
|
3872
3982
|
const {
|
|
@@ -3910,7 +4020,7 @@ function Content2({ componentId, overridableProps }) {
|
|
|
3910
4020
|
popupState.close();
|
|
3911
4021
|
};
|
|
3912
4022
|
const overridableConfig = overridableValue ? getOverridableProp({ componentId, overrideKey: overridableValue.override_key }) : void 0;
|
|
3913
|
-
return /* @__PURE__ */
|
|
4023
|
+
return /* @__PURE__ */ React30.createElement(React30.Fragment, null, /* @__PURE__ */ React30.createElement(Tooltip5, { placement: "top", title: __25("Override Property", "elementor") }, /* @__PURE__ */ React30.createElement(Indicator2, { ...triggerProps, isOpen: !!popoverProps.open, isOverridable: !!overridableValue })), /* @__PURE__ */ React30.createElement(
|
|
3914
4024
|
Popover4,
|
|
3915
4025
|
{
|
|
3916
4026
|
disableScrollLock: true,
|
|
@@ -3927,7 +4037,7 @@ function Content2({ componentId, overridableProps }) {
|
|
|
3927
4037
|
},
|
|
3928
4038
|
...popoverProps
|
|
3929
4039
|
},
|
|
3930
|
-
/* @__PURE__ */
|
|
4040
|
+
/* @__PURE__ */ React30.createElement(
|
|
3931
4041
|
OverridablePropForm,
|
|
3932
4042
|
{
|
|
3933
4043
|
onSubmit: handleSubmit,
|
|
@@ -3945,7 +4055,7 @@ function isPropAllowed(bind) {
|
|
|
3945
4055
|
}
|
|
3946
4056
|
|
|
3947
4057
|
// src/hooks/regenerate-override-keys.ts
|
|
3948
|
-
import { getAllDescendants as
|
|
4058
|
+
import { getAllDescendants as getAllDescendants3, getContainer as getContainer3, updateElementSettings as updateElementSettings2 } from "@elementor/editor-elements";
|
|
3949
4059
|
import { registerDataHook } from "@elementor/editor-v1-adapters";
|
|
3950
4060
|
import { generateUniqueId as generateUniqueId5 } from "@elementor/utils";
|
|
3951
4061
|
function initRegenerateOverrideKeys() {
|
|
@@ -3970,7 +4080,7 @@ function regenerateOverrideKeysRecursive(elementId) {
|
|
|
3970
4080
|
if (!container) {
|
|
3971
4081
|
return;
|
|
3972
4082
|
}
|
|
3973
|
-
|
|
4083
|
+
getAllDescendants3(container).forEach(regenerateOverrideKeys);
|
|
3974
4084
|
}
|
|
3975
4085
|
function regenerateOverrideKeys(element) {
|
|
3976
4086
|
if (!isComponentInstance(element.model.toJSON())) {
|
|
@@ -4369,15 +4479,15 @@ function PopulateStore() {
|
|
|
4369
4479
|
}
|
|
4370
4480
|
|
|
4371
4481
|
// src/prevent-circular-nesting.ts
|
|
4372
|
-
import { getAllDescendants as
|
|
4482
|
+
import { getAllDescendants as getAllDescendants4 } from "@elementor/editor-elements";
|
|
4373
4483
|
import { notify as notify3 } from "@elementor/editor-notifications";
|
|
4374
4484
|
import { blockCommand as blockCommand2 } from "@elementor/editor-v1-adapters";
|
|
4375
4485
|
import { __getState as getState19 } from "@elementor/store";
|
|
4376
|
-
import { __ as
|
|
4486
|
+
import { __ as __26 } from "@wordpress/i18n";
|
|
4377
4487
|
var COMPONENT_TYPE = "e-component";
|
|
4378
4488
|
var COMPONENT_CIRCULAR_NESTING_ALERT = {
|
|
4379
4489
|
type: "default",
|
|
4380
|
-
message:
|
|
4490
|
+
message: __26("Can't add this component - components that contain each other can't be nested.", "elementor"),
|
|
4381
4491
|
id: "circular-component-nesting-blocked"
|
|
4382
4492
|
};
|
|
4383
4493
|
function initCircularNestingPrevention() {
|
|
@@ -4464,7 +4574,7 @@ function blockCircularMove(args) {
|
|
|
4464
4574
|
if (!container) {
|
|
4465
4575
|
return false;
|
|
4466
4576
|
}
|
|
4467
|
-
const allElements =
|
|
4577
|
+
const allElements = getAllDescendants4(container);
|
|
4468
4578
|
return allElements.some((element) => {
|
|
4469
4579
|
const componentId = extractComponentIdFromContainer(element);
|
|
4470
4580
|
if (componentId === null) {
|
|
@@ -4718,7 +4828,7 @@ function init() {
|
|
|
4718
4828
|
window.elementorCommon.__beforeSave = beforeSave;
|
|
4719
4829
|
injectTab({
|
|
4720
4830
|
id: "components",
|
|
4721
|
-
label:
|
|
4831
|
+
label: __27("Components", "elementor"),
|
|
4722
4832
|
component: Components
|
|
4723
4833
|
});
|
|
4724
4834
|
injectIntoTop({
|