@elementor/editor-variables 3.32.0-49 → 3.32.0-50
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 +664 -457
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +603 -386
- package/dist/index.mjs.map +1 -1
- package/package.json +12 -12
- package/src/components/variable-selection-popover.tsx +2 -2
- package/src/components/variables-manager/variable-edit-menu.tsx +72 -0
- package/src/components/variables-manager/variable-table-cell.tsx +37 -0
- package/src/components/variables-manager/variables-manager-panel.tsx +15 -12
- package/src/components/variables-manager/variables-manager-table.tsx +172 -0
- package/src/hooks/use-prop-variables.ts +14 -6
package/dist/index.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { controlActionsMenu, registerControlReplacement } from "@elementor/edito
|
|
|
4
4
|
import { __registerPanel as registerPanel } from "@elementor/editor-panels";
|
|
5
5
|
|
|
6
6
|
// src/components/variables-manager/variables-manager-panel.tsx
|
|
7
|
-
import * as
|
|
7
|
+
import * as React6 from "react";
|
|
8
8
|
import { useEffect } from "react";
|
|
9
9
|
import {
|
|
10
10
|
__createPanel as createPanel,
|
|
@@ -16,92 +16,45 @@ import {
|
|
|
16
16
|
} from "@elementor/editor-panels";
|
|
17
17
|
import { ThemeProvider } from "@elementor/editor-ui";
|
|
18
18
|
import { changeEditMode } from "@elementor/editor-v1-adapters";
|
|
19
|
-
import {
|
|
20
|
-
import { Alert, Box, Button, Divider, ErrorBoundary, IconButton, Stack } from "@elementor/ui";
|
|
21
|
-
import { __ } from "@wordpress/i18n";
|
|
22
|
-
var id = "variables-manager";
|
|
23
|
-
var { panel, usePanelActions } = createPanel({
|
|
24
|
-
id,
|
|
25
|
-
component: VariablesManagerPanel,
|
|
26
|
-
allowedEditModes: ["edit", id],
|
|
27
|
-
onOpen: () => {
|
|
28
|
-
changeEditMode(id);
|
|
29
|
-
},
|
|
30
|
-
onClose: () => {
|
|
31
|
-
changeEditMode("edit");
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
function VariablesManagerPanel() {
|
|
35
|
-
const { close: closePanel } = usePanelActions();
|
|
36
|
-
const isDirty = false;
|
|
37
|
-
usePreventUnload(isDirty);
|
|
38
|
-
return /* @__PURE__ */ React.createElement(ThemeProvider, null, /* @__PURE__ */ React.createElement(ErrorBoundary, { fallback: /* @__PURE__ */ React.createElement(ErrorBoundaryFallback, null) }, /* @__PURE__ */ React.createElement(Panel, null, /* @__PURE__ */ React.createElement(PanelHeader, null, /* @__PURE__ */ React.createElement(Stack, { p: 1, pl: 2, width: "100%", direction: "row", alignItems: "center" }, /* @__PURE__ */ React.createElement(Stack, { width: "100%", direction: "row", gap: 1 }, /* @__PURE__ */ React.createElement(PanelHeaderTitle, { sx: { display: "flex", alignItems: "center", gap: 0.5 } }, /* @__PURE__ */ React.createElement(FilterIcon, { fontSize: "inherit" }), __("Variables Manager", "elementor"))), /* @__PURE__ */ React.createElement(
|
|
39
|
-
CloseButton,
|
|
40
|
-
{
|
|
41
|
-
sx: { marginLeft: "auto" },
|
|
42
|
-
onClose: () => {
|
|
43
|
-
closePanel();
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
))), /* @__PURE__ */ React.createElement(
|
|
47
|
-
PanelBody,
|
|
48
|
-
{
|
|
49
|
-
sx: {
|
|
50
|
-
display: "flex",
|
|
51
|
-
flexDirection: "column",
|
|
52
|
-
height: "100%"
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
/* @__PURE__ */ React.createElement(Divider, null),
|
|
56
|
-
/* @__PURE__ */ React.createElement(
|
|
57
|
-
Box,
|
|
58
|
-
{
|
|
59
|
-
px: 2,
|
|
60
|
-
sx: {
|
|
61
|
-
flexGrow: 1,
|
|
62
|
-
overflowY: "auto"
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
"List"
|
|
66
|
-
)
|
|
67
|
-
), /* @__PURE__ */ React.createElement(PanelFooter, null, /* @__PURE__ */ React.createElement(Button, { fullWidth: true, size: "small", color: "global", variant: "contained", disabled: !isDirty }, __("Save changes", "elementor"))))));
|
|
68
|
-
}
|
|
69
|
-
var CloseButton = ({ onClose, ...props }) => /* @__PURE__ */ React.createElement(IconButton, { size: "small", color: "secondary", onClick: onClose, "aria-label": "Close", ...props }, /* @__PURE__ */ React.createElement(XIcon, { fontSize: "small" }));
|
|
70
|
-
var ErrorBoundaryFallback = () => /* @__PURE__ */ React.createElement(Box, { role: "alert", sx: { minHeight: "100%", p: 2 } }, /* @__PURE__ */ React.createElement(Alert, { severity: "error", sx: { mb: 2, maxWidth: 400, textAlign: "center" } }, /* @__PURE__ */ React.createElement("strong", null, __("Something went wrong", "elementor"))));
|
|
71
|
-
var usePreventUnload = (isDirty) => {
|
|
72
|
-
useEffect(() => {
|
|
73
|
-
const handleBeforeUnload = (event) => {
|
|
74
|
-
if (isDirty) {
|
|
75
|
-
event.preventDefault();
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
window.addEventListener("beforeunload", handleBeforeUnload);
|
|
79
|
-
return () => {
|
|
80
|
-
window.removeEventListener("beforeunload", handleBeforeUnload);
|
|
81
|
-
};
|
|
82
|
-
}, [isDirty]);
|
|
83
|
-
};
|
|
19
|
+
import { ColorFilterIcon, TrashIcon, XIcon } from "@elementor/icons";
|
|
20
|
+
import { Alert, Box, Button, Divider, ErrorBoundary, IconButton as IconButton3, Stack as Stack3 } from "@elementor/ui";
|
|
21
|
+
import { __ as __4 } from "@wordpress/i18n";
|
|
84
22
|
|
|
85
|
-
// src/
|
|
86
|
-
import * as
|
|
87
|
-
import {
|
|
23
|
+
// src/components/variables-manager/variables-manager-table.tsx
|
|
24
|
+
import * as React5 from "react";
|
|
25
|
+
import { createElement as createElement7, useState } from "react";
|
|
26
|
+
import { EllipsisWithTooltip } from "@elementor/editor-ui";
|
|
27
|
+
import { GripVerticalIcon } from "@elementor/icons";
|
|
28
|
+
import {
|
|
29
|
+
IconButton as IconButton2,
|
|
30
|
+
Stack as Stack2,
|
|
31
|
+
Table,
|
|
32
|
+
TableBody,
|
|
33
|
+
TableContainer,
|
|
34
|
+
TableHead,
|
|
35
|
+
TableRow,
|
|
36
|
+
UnstableSortableItem,
|
|
37
|
+
UnstableSortableProvider
|
|
38
|
+
} from "@elementor/ui";
|
|
39
|
+
import { __ as __3 } from "@wordpress/i18n";
|
|
88
40
|
|
|
89
|
-
// src/
|
|
90
|
-
import {
|
|
91
|
-
import
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
import
|
|
41
|
+
// src/hooks/use-prop-variables.ts
|
|
42
|
+
import { useMemo } from "react";
|
|
43
|
+
import { useBoundProp } from "@elementor/editor-controls";
|
|
44
|
+
|
|
45
|
+
// src/context/variable-type-context.tsx
|
|
46
|
+
import * as React2 from "react";
|
|
47
|
+
import { createContext, useContext } from "react";
|
|
95
48
|
|
|
96
49
|
// src/variables-registry/create-variable-type-registry.ts
|
|
97
50
|
import { styleTransformersRegistry } from "@elementor/editor-canvas";
|
|
98
51
|
import { stylesInheritanceTransformersRegistry } from "@elementor/editor-editing-panel";
|
|
99
52
|
|
|
100
53
|
// src/transformers/inheritance-transformer.tsx
|
|
101
|
-
import * as
|
|
54
|
+
import * as React from "react";
|
|
102
55
|
import { createTransformer } from "@elementor/editor-canvas";
|
|
103
|
-
import { Stack
|
|
104
|
-
import { __ as
|
|
56
|
+
import { Stack, Typography } from "@elementor/ui";
|
|
57
|
+
import { __ as __2 } from "@wordpress/i18n";
|
|
105
58
|
|
|
106
59
|
// src/components/ui/color-indicator.tsx
|
|
107
60
|
import { styled, UnstableColorIndicator } from "@elementor/ui";
|
|
@@ -116,7 +69,7 @@ import { z } from "@elementor/schema";
|
|
|
116
69
|
var colorVariablePropTypeUtil = createPropUtils("global-color-variable", z.string());
|
|
117
70
|
|
|
118
71
|
// src/service.ts
|
|
119
|
-
import { __
|
|
72
|
+
import { __ } from "@wordpress/i18n";
|
|
120
73
|
|
|
121
74
|
// src/api.ts
|
|
122
75
|
import { httpService } from "@elementor/http-client";
|
|
@@ -315,7 +268,7 @@ var service = {
|
|
|
315
268
|
return apiClient.create(type, label, value).then((response) => {
|
|
316
269
|
const { success, data: payload } = response.data;
|
|
317
270
|
if (!success) {
|
|
318
|
-
const errorMessage = payload?.message ||
|
|
271
|
+
const errorMessage = payload?.message || __("Unexpected response from server", "elementor");
|
|
319
272
|
throw new Error(errorMessage);
|
|
320
273
|
}
|
|
321
274
|
return payload;
|
|
@@ -337,7 +290,7 @@ var service = {
|
|
|
337
290
|
return apiClient.update(id2, label, value).then((response) => {
|
|
338
291
|
const { success, data: payload } = response.data;
|
|
339
292
|
if (!success) {
|
|
340
|
-
const errorMessage = payload?.message ||
|
|
293
|
+
const errorMessage = payload?.message || __("Unexpected response from server", "elementor");
|
|
341
294
|
throw new Error(errorMessage);
|
|
342
295
|
}
|
|
343
296
|
return payload;
|
|
@@ -429,11 +382,11 @@ var inheritanceTransformer = createTransformer((id2) => {
|
|
|
429
382
|
const variables = service.variables();
|
|
430
383
|
const variable = variables[id2];
|
|
431
384
|
if (!variable) {
|
|
432
|
-
return /* @__PURE__ */
|
|
385
|
+
return /* @__PURE__ */ React.createElement("span", null, __2("Missing variable", "elementor"));
|
|
433
386
|
}
|
|
434
387
|
const showColorIndicator = variable.type === colorVariablePropTypeUtil.key;
|
|
435
388
|
const css = resolveCssVariable(id2, variable);
|
|
436
|
-
return /* @__PURE__ */
|
|
389
|
+
return /* @__PURE__ */ React.createElement(Stack, { direction: "row", spacing: 0.5, sx: { paddingInline: "1px" }, alignItems: "center" }, showColorIndicator && /* @__PURE__ */ React.createElement(ColorIndicator, { size: "inherit", value: variable.value }), /* @__PURE__ */ React.createElement(Typography, { variant: "caption", overflow: "hidden", whiteSpace: "nowrap", textOverflow: "ellipsis" }, css));
|
|
437
390
|
});
|
|
438
391
|
|
|
439
392
|
// src/transformers/variable-transformer.ts
|
|
@@ -497,88 +450,29 @@ function createVariableTypeRegistry() {
|
|
|
497
450
|
// src/variables-registry/variable-type-registry.ts
|
|
498
451
|
var { registerVariableType, getVariableType, hasVariableType } = createVariableTypeRegistry();
|
|
499
452
|
|
|
500
|
-
// src/utils/unlink-variable.ts
|
|
501
|
-
function transformValueBeforeUnlink(variable, propTypeKey) {
|
|
502
|
-
const { valueTransformer } = getVariableType(propTypeKey);
|
|
503
|
-
if (valueTransformer) {
|
|
504
|
-
return valueTransformer(variable.value);
|
|
505
|
-
}
|
|
506
|
-
return variable.value;
|
|
507
|
-
}
|
|
508
|
-
function createUnlinkHandler(variable, propTypeKey, setValue) {
|
|
509
|
-
return () => {
|
|
510
|
-
const { fallbackPropTypeUtil } = getVariableType(propTypeKey);
|
|
511
|
-
const transformedValue = transformValueBeforeUnlink(variable, propTypeKey);
|
|
512
|
-
setValue(fallbackPropTypeUtil.create(transformedValue));
|
|
513
|
-
};
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
// src/components/variable-selection-popover.tsx
|
|
517
|
-
import * as React15 from "react";
|
|
518
|
-
import { useState as useState7 } from "react";
|
|
519
|
-
import { isExperimentActive } from "@elementor/editor-v1-adapters";
|
|
520
|
-
|
|
521
|
-
// src/context/variable-selection-popover.context.tsx
|
|
522
|
-
import * as React3 from "react";
|
|
523
|
-
import { createContext, useContext, useState } from "react";
|
|
524
|
-
import { Box as Box2 } from "@elementor/ui";
|
|
525
|
-
var PopoverContentRefContext = createContext(null);
|
|
526
|
-
var PopoverContentRefContextProvider = ({ children }) => {
|
|
527
|
-
const [anchorRef, setAnchorRef] = useState(null);
|
|
528
|
-
return /* @__PURE__ */ React3.createElement(PopoverContentRefContext.Provider, { value: anchorRef }, /* @__PURE__ */ React3.createElement(Box2, { ref: setAnchorRef }, children));
|
|
529
|
-
};
|
|
530
|
-
var usePopoverContentRef = () => {
|
|
531
|
-
return useContext(PopoverContentRefContext);
|
|
532
|
-
};
|
|
533
|
-
|
|
534
453
|
// src/context/variable-type-context.tsx
|
|
535
|
-
|
|
536
|
-
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
537
|
-
var VariableTypeContext = createContext2(null);
|
|
454
|
+
var VariableTypeContext = createContext(null);
|
|
538
455
|
function VariableTypeProvider({ children, propTypeKey }) {
|
|
539
|
-
return /* @__PURE__ */
|
|
456
|
+
return /* @__PURE__ */ React2.createElement(VariableTypeContext.Provider, { value: propTypeKey }, children);
|
|
540
457
|
}
|
|
541
458
|
function useVariableType() {
|
|
542
|
-
const context =
|
|
459
|
+
const context = useContext(VariableTypeContext);
|
|
543
460
|
if (context === null) {
|
|
544
461
|
throw new Error("useVariableType must be used within a VariableTypeProvider");
|
|
545
462
|
}
|
|
546
463
|
return getVariableType(context);
|
|
547
464
|
}
|
|
548
465
|
|
|
549
|
-
// src/hooks/use-permissions.ts
|
|
550
|
-
import { useCurrentUserCapabilities } from "@elementor/editor-current-user";
|
|
551
|
-
var usePermissions = () => {
|
|
552
|
-
const { canUser } = useCurrentUserCapabilities();
|
|
553
|
-
return {
|
|
554
|
-
canAssign: () => canUser("edit_posts"),
|
|
555
|
-
canUnlink: () => canUser("edit_posts"),
|
|
556
|
-
canAdd: () => canUser("manage_options"),
|
|
557
|
-
canDelete: () => canUser("manage_options"),
|
|
558
|
-
canEdit: () => canUser("manage_options"),
|
|
559
|
-
canRestore: () => canUser("manage_options"),
|
|
560
|
-
canManageSettings: () => canUser("manage_options")
|
|
561
|
-
};
|
|
562
|
-
};
|
|
563
|
-
|
|
564
|
-
// src/components/variable-creation.tsx
|
|
565
|
-
import * as React7 from "react";
|
|
566
|
-
import { useState as useState3 } from "react";
|
|
567
|
-
import { PopoverContent, useBoundProp as useBoundProp3 } from "@elementor/editor-controls";
|
|
568
|
-
import { PopoverBody } from "@elementor/editor-editing-panel";
|
|
569
|
-
import { PopoverHeader } from "@elementor/editor-ui";
|
|
570
|
-
import { ArrowLeftIcon } from "@elementor/icons";
|
|
571
|
-
import { Button as Button2, CardActions, Divider as Divider2, FormHelperText as FormHelperText2, IconButton as IconButton2 } from "@elementor/ui";
|
|
572
|
-
import { __ as __6 } from "@wordpress/i18n";
|
|
573
|
-
|
|
574
|
-
// src/hooks/use-initial-value.ts
|
|
575
|
-
import { useBoundProp as useBoundProp2 } from "@elementor/editor-controls";
|
|
576
|
-
|
|
577
466
|
// src/hooks/use-prop-variables.ts
|
|
578
|
-
|
|
579
|
-
import { useBoundProp } from "@elementor/editor-controls";
|
|
580
|
-
var useVariable = (key) => {
|
|
467
|
+
var getVariables = (includeDeleted = true) => {
|
|
581
468
|
const variables = service.variables();
|
|
469
|
+
if (includeDeleted) {
|
|
470
|
+
return variables;
|
|
471
|
+
}
|
|
472
|
+
return Object.fromEntries(Object.entries(variables).filter(([, variable]) => !variable.deleted));
|
|
473
|
+
};
|
|
474
|
+
var useVariable = (key) => {
|
|
475
|
+
const variables = getVariables();
|
|
582
476
|
if (!variables?.[key]) {
|
|
583
477
|
return null;
|
|
584
478
|
}
|
|
@@ -609,10 +503,9 @@ var filterVariablesBySearchValue = (variables, searchValue) => {
|
|
|
609
503
|
var usePropVariables = (propKey) => {
|
|
610
504
|
return useMemo(() => normalizeVariables(propKey), [propKey]);
|
|
611
505
|
};
|
|
612
|
-
var isNotDeleted = ({ deleted }) => !deleted;
|
|
613
506
|
var normalizeVariables = (propKey) => {
|
|
614
|
-
const variables =
|
|
615
|
-
return Object.entries(variables).filter(([, variable]) => variable.type === propKey
|
|
507
|
+
const variables = getVariables(false);
|
|
508
|
+
return Object.entries(variables).filter(([, variable]) => variable.type === propKey).map(([key, { label, value }]) => ({
|
|
616
509
|
key,
|
|
617
510
|
label,
|
|
618
511
|
value
|
|
@@ -632,7 +525,331 @@ var restoreVariable = (restoreId, label, value) => {
|
|
|
632
525
|
return service.restore(restoreId, label, value).then(extractId);
|
|
633
526
|
};
|
|
634
527
|
|
|
528
|
+
// src/components/variables-manager/variable-edit-menu.tsx
|
|
529
|
+
import * as React3 from "react";
|
|
530
|
+
import { createElement as createElement4 } from "react";
|
|
531
|
+
import { DotsVerticalIcon } from "@elementor/icons";
|
|
532
|
+
import { bindMenu, bindTrigger, IconButton, Menu, MenuItem, usePopupState } from "@elementor/ui";
|
|
533
|
+
var VariableEditMenu = ({ menuActions, disabled }) => {
|
|
534
|
+
const menuState = usePopupState({
|
|
535
|
+
variant: "popover"
|
|
536
|
+
});
|
|
537
|
+
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(IconButton, { ...bindTrigger(menuState), disabled, size: "tiny" }, /* @__PURE__ */ React3.createElement(DotsVerticalIcon, { fontSize: "tiny" })), /* @__PURE__ */ React3.createElement(
|
|
538
|
+
Menu,
|
|
539
|
+
{
|
|
540
|
+
disablePortal: true,
|
|
541
|
+
MenuListProps: {
|
|
542
|
+
dense: true
|
|
543
|
+
},
|
|
544
|
+
PaperProps: {
|
|
545
|
+
elevation: 6
|
|
546
|
+
},
|
|
547
|
+
...bindMenu(menuState),
|
|
548
|
+
anchorEl: menuState.anchorEl,
|
|
549
|
+
anchorOrigin: {
|
|
550
|
+
vertical: "bottom",
|
|
551
|
+
horizontal: "right"
|
|
552
|
+
},
|
|
553
|
+
transformOrigin: {
|
|
554
|
+
vertical: "top",
|
|
555
|
+
horizontal: "right"
|
|
556
|
+
},
|
|
557
|
+
open: menuState.isOpen,
|
|
558
|
+
onClose: menuState.close
|
|
559
|
+
},
|
|
560
|
+
menuActions.map((action) => /* @__PURE__ */ React3.createElement(
|
|
561
|
+
MenuItem,
|
|
562
|
+
{
|
|
563
|
+
key: action.name,
|
|
564
|
+
onClick: () => {
|
|
565
|
+
action.onClick?.();
|
|
566
|
+
menuState.close();
|
|
567
|
+
},
|
|
568
|
+
sx: {
|
|
569
|
+
color: action.color,
|
|
570
|
+
gap: 1
|
|
571
|
+
}
|
|
572
|
+
},
|
|
573
|
+
action.icon && createElement4(action.icon, {
|
|
574
|
+
fontSize: "inherit"
|
|
575
|
+
}),
|
|
576
|
+
" ",
|
|
577
|
+
action.name
|
|
578
|
+
))
|
|
579
|
+
));
|
|
580
|
+
};
|
|
581
|
+
|
|
582
|
+
// src/components/variables-manager/variable-table-cell.tsx
|
|
583
|
+
import * as React4 from "react";
|
|
584
|
+
import { TableCell } from "@elementor/ui";
|
|
585
|
+
var VariableTableCell = ({
|
|
586
|
+
children,
|
|
587
|
+
isHeader,
|
|
588
|
+
width,
|
|
589
|
+
maxWidth,
|
|
590
|
+
align,
|
|
591
|
+
noPadding,
|
|
592
|
+
sx
|
|
593
|
+
}) => {
|
|
594
|
+
const baseSx = {
|
|
595
|
+
maxWidth: maxWidth ?? 150,
|
|
596
|
+
cursor: "initial",
|
|
597
|
+
typography: "caption",
|
|
598
|
+
...isHeader && { color: "text.primary", fontWeight: "bold" },
|
|
599
|
+
...width && { width },
|
|
600
|
+
...sx
|
|
601
|
+
};
|
|
602
|
+
return /* @__PURE__ */ React4.createElement(TableCell, { size: "small", padding: noPadding ? "none" : void 0, align, sx: baseSx }, children);
|
|
603
|
+
};
|
|
604
|
+
|
|
605
|
+
// src/components/variables-manager/variables-manager-table.tsx
|
|
606
|
+
var VariablesManagerTable = ({ menuActions }) => {
|
|
607
|
+
const variables = getVariables(false);
|
|
608
|
+
const [ids, setIds] = useState(Object.keys(variables));
|
|
609
|
+
const rows = ids.map((id2) => ({
|
|
610
|
+
id: id2,
|
|
611
|
+
name: variables[id2].label,
|
|
612
|
+
value: variables[id2].value,
|
|
613
|
+
type: variables[id2].type,
|
|
614
|
+
icon: getVariableType(variables[id2].type).icon,
|
|
615
|
+
startIcon: getVariableType(variables[id2].type).startIcon
|
|
616
|
+
}));
|
|
617
|
+
const tableSX = {
|
|
618
|
+
minWidth: 250,
|
|
619
|
+
tableLayout: "fixed"
|
|
620
|
+
};
|
|
621
|
+
return /* @__PURE__ */ React5.createElement(TableContainer, { sx: { overflow: "initial" } }, /* @__PURE__ */ React5.createElement(Table, { sx: tableSX, "aria-label": "Variables manager list with drag and drop reordering" }, /* @__PURE__ */ React5.createElement(TableHead, null, /* @__PURE__ */ React5.createElement(TableRow, null, /* @__PURE__ */ React5.createElement(VariableTableCell, { isHeader: true, noPadding: true, width: 10, maxWidth: 10 }), /* @__PURE__ */ React5.createElement(VariableTableCell, { isHeader: true }, __3("Name", "elementor")), /* @__PURE__ */ React5.createElement(VariableTableCell, { isHeader: true }, __3("Value", "elementor")), /* @__PURE__ */ React5.createElement(VariableTableCell, { isHeader: true, noPadding: true, width: 16, maxWidth: 16 }))), /* @__PURE__ */ React5.createElement(TableBody, null, /* @__PURE__ */ React5.createElement(
|
|
622
|
+
UnstableSortableProvider,
|
|
623
|
+
{
|
|
624
|
+
value: ids,
|
|
625
|
+
onChange: setIds,
|
|
626
|
+
variant: "static",
|
|
627
|
+
restrictAxis: true,
|
|
628
|
+
dragOverlay: ({ children: dragOverlayChildren, ...dragOverlayProps }) => /* @__PURE__ */ React5.createElement(Table, { sx: tableSX, ...dragOverlayProps }, /* @__PURE__ */ React5.createElement(TableBody, null, dragOverlayChildren))
|
|
629
|
+
},
|
|
630
|
+
rows.map((row) => /* @__PURE__ */ React5.createElement(
|
|
631
|
+
UnstableSortableItem,
|
|
632
|
+
{
|
|
633
|
+
key: row.id,
|
|
634
|
+
id: row.id,
|
|
635
|
+
render: ({
|
|
636
|
+
itemProps,
|
|
637
|
+
showDropIndication,
|
|
638
|
+
triggerProps,
|
|
639
|
+
itemStyle,
|
|
640
|
+
triggerStyle,
|
|
641
|
+
isDragged,
|
|
642
|
+
dropPosition,
|
|
643
|
+
setTriggerRef,
|
|
644
|
+
isDragOverlay,
|
|
645
|
+
isSorting,
|
|
646
|
+
index
|
|
647
|
+
}) => {
|
|
648
|
+
const showIndicationBefore = showDropIndication && dropPosition === "before";
|
|
649
|
+
const showIndicationAfter = showDropIndication && dropPosition === "after";
|
|
650
|
+
return /* @__PURE__ */ React5.createElement(
|
|
651
|
+
TableRow,
|
|
652
|
+
{
|
|
653
|
+
...itemProps,
|
|
654
|
+
selected: isDragged,
|
|
655
|
+
sx: {
|
|
656
|
+
...showIndicationBefore && {
|
|
657
|
+
"& td, & th": {
|
|
658
|
+
borderTop: "2px solid",
|
|
659
|
+
borderTopColor: "primary.main"
|
|
660
|
+
}
|
|
661
|
+
},
|
|
662
|
+
...showIndicationAfter && {
|
|
663
|
+
"& td, & th": {
|
|
664
|
+
borderBottom: "2px solid",
|
|
665
|
+
borderBottomColor: "primary.main"
|
|
666
|
+
}
|
|
667
|
+
},
|
|
668
|
+
'& [role="toolbar"], & [draggable]': {
|
|
669
|
+
opacity: 0
|
|
670
|
+
},
|
|
671
|
+
"&:hover, &:focus-within": {
|
|
672
|
+
backgroundColor: "action.hover",
|
|
673
|
+
'& [role="toolbar"], & [draggable]': {
|
|
674
|
+
opacity: 1
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
},
|
|
678
|
+
style: { ...itemStyle, ...triggerStyle },
|
|
679
|
+
disableDivider: isDragOverlay || index === rows.length - 1
|
|
680
|
+
},
|
|
681
|
+
/* @__PURE__ */ React5.createElement(VariableTableCell, { noPadding: true, width: 10, maxWidth: 10 }, /* @__PURE__ */ React5.createElement(
|
|
682
|
+
IconButton2,
|
|
683
|
+
{
|
|
684
|
+
size: "small",
|
|
685
|
+
ref: setTriggerRef,
|
|
686
|
+
...triggerProps,
|
|
687
|
+
disabled: isSorting,
|
|
688
|
+
draggable: true
|
|
689
|
+
},
|
|
690
|
+
/* @__PURE__ */ React5.createElement(GripVerticalIcon, { fontSize: "inherit" })
|
|
691
|
+
)),
|
|
692
|
+
/* @__PURE__ */ React5.createElement(VariableTableCell, null, /* @__PURE__ */ React5.createElement(Stack2, { direction: "row", alignItems: "center", gap: 1 }, createElement7(row.icon, { fontSize: "inherit" }), /* @__PURE__ */ React5.createElement(EllipsisWithTooltip, { title: row.name }, row.name))),
|
|
693
|
+
/* @__PURE__ */ React5.createElement(VariableTableCell, null, /* @__PURE__ */ React5.createElement(Stack2, { direction: "row", alignItems: "center", gap: 1 }, row.startIcon && row.startIcon({ value: row.value }), /* @__PURE__ */ React5.createElement(EllipsisWithTooltip, { title: row.value }, row.value))),
|
|
694
|
+
/* @__PURE__ */ React5.createElement(
|
|
695
|
+
VariableTableCell,
|
|
696
|
+
{
|
|
697
|
+
align: "right",
|
|
698
|
+
noPadding: true,
|
|
699
|
+
width: 16,
|
|
700
|
+
maxWidth: 16,
|
|
701
|
+
sx: { paddingInlineEnd: 1 }
|
|
702
|
+
},
|
|
703
|
+
/* @__PURE__ */ React5.createElement(Stack2, { role: "toolbar", direction: "row", justifyContent: "flex-end" }, /* @__PURE__ */ React5.createElement(
|
|
704
|
+
VariableEditMenu,
|
|
705
|
+
{
|
|
706
|
+
menuActions,
|
|
707
|
+
disabled: isSorting
|
|
708
|
+
}
|
|
709
|
+
))
|
|
710
|
+
)
|
|
711
|
+
);
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
))
|
|
715
|
+
))));
|
|
716
|
+
};
|
|
717
|
+
|
|
718
|
+
// src/components/variables-manager/variables-manager-panel.tsx
|
|
719
|
+
var id = "variables-manager";
|
|
720
|
+
var { panel, usePanelActions } = createPanel({
|
|
721
|
+
id,
|
|
722
|
+
component: VariablesManagerPanel,
|
|
723
|
+
allowedEditModes: ["edit", id],
|
|
724
|
+
onOpen: () => {
|
|
725
|
+
changeEditMode(id);
|
|
726
|
+
},
|
|
727
|
+
onClose: () => {
|
|
728
|
+
changeEditMode("edit");
|
|
729
|
+
}
|
|
730
|
+
});
|
|
731
|
+
function VariablesManagerPanel() {
|
|
732
|
+
const { close: closePanel } = usePanelActions();
|
|
733
|
+
const isDirty = false;
|
|
734
|
+
usePreventUnload(isDirty);
|
|
735
|
+
const menuActions = [
|
|
736
|
+
{
|
|
737
|
+
name: __4("Delete", "elementor"),
|
|
738
|
+
icon: TrashIcon,
|
|
739
|
+
color: "error.main",
|
|
740
|
+
onClick: () => {
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
];
|
|
744
|
+
return /* @__PURE__ */ React6.createElement(ThemeProvider, null, /* @__PURE__ */ React6.createElement(ErrorBoundary, { fallback: /* @__PURE__ */ React6.createElement(ErrorBoundaryFallback, null) }, /* @__PURE__ */ React6.createElement(Panel, null, /* @__PURE__ */ React6.createElement(PanelHeader, null, /* @__PURE__ */ React6.createElement(Stack3, { p: 1, pl: 2, width: "100%", direction: "row", alignItems: "center" }, /* @__PURE__ */ React6.createElement(Stack3, { width: "100%", direction: "row", gap: 1 }, /* @__PURE__ */ React6.createElement(PanelHeaderTitle, { sx: { display: "flex", alignItems: "center", gap: 0.5 } }, /* @__PURE__ */ React6.createElement(ColorFilterIcon, { fontSize: "inherit" }), __4("Variable Manager", "elementor"))), /* @__PURE__ */ React6.createElement(
|
|
745
|
+
CloseButton,
|
|
746
|
+
{
|
|
747
|
+
sx: { marginLeft: "auto" },
|
|
748
|
+
onClose: () => {
|
|
749
|
+
closePanel();
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
))), /* @__PURE__ */ React6.createElement(
|
|
753
|
+
PanelBody,
|
|
754
|
+
{
|
|
755
|
+
sx: {
|
|
756
|
+
display: "flex",
|
|
757
|
+
flexDirection: "column",
|
|
758
|
+
height: "100%"
|
|
759
|
+
}
|
|
760
|
+
},
|
|
761
|
+
/* @__PURE__ */ React6.createElement(Divider, null),
|
|
762
|
+
/* @__PURE__ */ React6.createElement(VariablesManagerTable, { menuActions })
|
|
763
|
+
), /* @__PURE__ */ React6.createElement(PanelFooter, null, /* @__PURE__ */ React6.createElement(Button, { fullWidth: true, size: "small", color: "global", variant: "contained", disabled: !isDirty }, __4("Save changes", "elementor"))))));
|
|
764
|
+
}
|
|
765
|
+
var CloseButton = ({ onClose, ...props }) => /* @__PURE__ */ React6.createElement(IconButton3, { size: "small", color: "secondary", onClick: onClose, "aria-label": "Close", ...props }, /* @__PURE__ */ React6.createElement(XIcon, { fontSize: "small" }));
|
|
766
|
+
var ErrorBoundaryFallback = () => /* @__PURE__ */ React6.createElement(Box, { 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, __4("Something went wrong", "elementor"))));
|
|
767
|
+
var usePreventUnload = (isDirty) => {
|
|
768
|
+
useEffect(() => {
|
|
769
|
+
const handleBeforeUnload = (event) => {
|
|
770
|
+
if (isDirty) {
|
|
771
|
+
event.preventDefault();
|
|
772
|
+
}
|
|
773
|
+
};
|
|
774
|
+
window.addEventListener("beforeunload", handleBeforeUnload);
|
|
775
|
+
return () => {
|
|
776
|
+
window.removeEventListener("beforeunload", handleBeforeUnload);
|
|
777
|
+
};
|
|
778
|
+
}, [isDirty]);
|
|
779
|
+
};
|
|
780
|
+
|
|
781
|
+
// src/controls/variable-control.tsx
|
|
782
|
+
import * as React28 from "react";
|
|
783
|
+
import { useBoundProp as useBoundProp10 } from "@elementor/editor-controls";
|
|
784
|
+
|
|
785
|
+
// src/components/ui/variable/assigned-variable.tsx
|
|
786
|
+
import { useId as useId2, useRef } from "react";
|
|
787
|
+
import * as React20 from "react";
|
|
788
|
+
import { useBoundProp as useBoundProp6 } from "@elementor/editor-controls";
|
|
789
|
+
import { ColorFilterIcon as ColorFilterIcon3 } from "@elementor/icons";
|
|
790
|
+
import { bindPopover, bindTrigger as bindTrigger2, Box as Box5, Popover, usePopupState as usePopupState2 } from "@elementor/ui";
|
|
791
|
+
|
|
792
|
+
// src/utils/unlink-variable.ts
|
|
793
|
+
function transformValueBeforeUnlink(variable, propTypeKey) {
|
|
794
|
+
const { valueTransformer } = getVariableType(propTypeKey);
|
|
795
|
+
if (valueTransformer) {
|
|
796
|
+
return valueTransformer(variable.value);
|
|
797
|
+
}
|
|
798
|
+
return variable.value;
|
|
799
|
+
}
|
|
800
|
+
function createUnlinkHandler(variable, propTypeKey, setValue) {
|
|
801
|
+
return () => {
|
|
802
|
+
const { fallbackPropTypeUtil } = getVariableType(propTypeKey);
|
|
803
|
+
const transformedValue = transformValueBeforeUnlink(variable, propTypeKey);
|
|
804
|
+
setValue(fallbackPropTypeUtil.create(transformedValue));
|
|
805
|
+
};
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
// src/components/variable-selection-popover.tsx
|
|
809
|
+
import * as React18 from "react";
|
|
810
|
+
import { useState as useState8 } from "react";
|
|
811
|
+
import { isExperimentActive } from "@elementor/editor-v1-adapters";
|
|
812
|
+
|
|
813
|
+
// src/context/variable-selection-popover.context.tsx
|
|
814
|
+
import * as React7 from "react";
|
|
815
|
+
import { createContext as createContext2, useContext as useContext2, useState as useState2 } from "react";
|
|
816
|
+
import { Box as Box2 } from "@elementor/ui";
|
|
817
|
+
var PopoverContentRefContext = createContext2(null);
|
|
818
|
+
var PopoverContentRefContextProvider = ({ children }) => {
|
|
819
|
+
const [anchorRef, setAnchorRef] = useState2(null);
|
|
820
|
+
return /* @__PURE__ */ React7.createElement(PopoverContentRefContext.Provider, { value: anchorRef }, /* @__PURE__ */ React7.createElement(Box2, { ref: setAnchorRef }, children));
|
|
821
|
+
};
|
|
822
|
+
var usePopoverContentRef = () => {
|
|
823
|
+
return useContext2(PopoverContentRefContext);
|
|
824
|
+
};
|
|
825
|
+
|
|
826
|
+
// src/hooks/use-permissions.ts
|
|
827
|
+
import { useCurrentUserCapabilities } from "@elementor/editor-current-user";
|
|
828
|
+
var usePermissions = () => {
|
|
829
|
+
const { canUser } = useCurrentUserCapabilities();
|
|
830
|
+
return {
|
|
831
|
+
canAssign: () => canUser("edit_posts"),
|
|
832
|
+
canUnlink: () => canUser("edit_posts"),
|
|
833
|
+
canAdd: () => canUser("manage_options"),
|
|
834
|
+
canDelete: () => canUser("manage_options"),
|
|
835
|
+
canEdit: () => canUser("manage_options"),
|
|
836
|
+
canRestore: () => canUser("manage_options"),
|
|
837
|
+
canManageSettings: () => canUser("manage_options")
|
|
838
|
+
};
|
|
839
|
+
};
|
|
840
|
+
|
|
841
|
+
// src/components/variable-creation.tsx
|
|
842
|
+
import * as React10 from "react";
|
|
843
|
+
import { useState as useState4 } from "react";
|
|
844
|
+
import { PopoverContent, useBoundProp as useBoundProp3 } from "@elementor/editor-controls";
|
|
845
|
+
import { PopoverBody } from "@elementor/editor-editing-panel";
|
|
846
|
+
import { PopoverHeader } from "@elementor/editor-ui";
|
|
847
|
+
import { ArrowLeftIcon } from "@elementor/icons";
|
|
848
|
+
import { Button as Button2, CardActions, Divider as Divider2, FormHelperText as FormHelperText2, IconButton as IconButton4 } from "@elementor/ui";
|
|
849
|
+
import { __ as __7 } from "@wordpress/i18n";
|
|
850
|
+
|
|
635
851
|
// src/hooks/use-initial-value.ts
|
|
852
|
+
import { useBoundProp as useBoundProp2 } from "@elementor/editor-controls";
|
|
636
853
|
var useInitialValue = () => {
|
|
637
854
|
const { value: initial } = useBoundProp2();
|
|
638
855
|
const hasAssignedVariable2 = hasVariableType(initial?.$$type) && Boolean(initial?.value);
|
|
@@ -662,15 +879,15 @@ var trackVariableEvent = ({ varType, controlPath, action }) => {
|
|
|
662
879
|
};
|
|
663
880
|
|
|
664
881
|
// src/utils/validations.ts
|
|
665
|
-
import { __ as
|
|
882
|
+
import { __ as __5 } from "@wordpress/i18n";
|
|
666
883
|
var ERROR_MESSAGES = {
|
|
667
|
-
MISSING_VARIABLE_NAME:
|
|
668
|
-
MISSING_VARIABLE_VALUE:
|
|
669
|
-
INVALID_CHARACTERS:
|
|
670
|
-
NO_NON_SPECIAL_CHARACTER:
|
|
671
|
-
VARIABLE_LABEL_MAX_LENGTH:
|
|
672
|
-
DUPLICATED_LABEL:
|
|
673
|
-
UNEXPECTED_ERROR:
|
|
884
|
+
MISSING_VARIABLE_NAME: __5("Give your variable a name.", "elementor"),
|
|
885
|
+
MISSING_VARIABLE_VALUE: __5("Add a value to complete your variable.", "elementor"),
|
|
886
|
+
INVALID_CHARACTERS: __5("Use letters, numbers, dashes (-), or underscores (_) for the name.", "elementor"),
|
|
887
|
+
NO_NON_SPECIAL_CHARACTER: __5("Names have to include at least one non-special character.", "elementor"),
|
|
888
|
+
VARIABLE_LABEL_MAX_LENGTH: __5("Keep names up to 50 characters.", "elementor"),
|
|
889
|
+
DUPLICATED_LABEL: __5("This variable name already exists. Please choose a unique name.", "elementor"),
|
|
890
|
+
UNEXPECTED_ERROR: __5("There was a glitch. Try saving your variable again.", "elementor")
|
|
674
891
|
};
|
|
675
892
|
var VARIABLE_LABEL_MAX_LENGTH = 50;
|
|
676
893
|
var mapServerError = (error) => {
|
|
@@ -714,16 +931,16 @@ var validateValue = (value) => {
|
|
|
714
931
|
};
|
|
715
932
|
|
|
716
933
|
// src/components/fields/label-field.tsx
|
|
717
|
-
import * as
|
|
718
|
-
import { useId, useState as
|
|
934
|
+
import * as React9 from "react";
|
|
935
|
+
import { useId, useState as useState3 } from "react";
|
|
719
936
|
import { TextField } from "@elementor/ui";
|
|
720
|
-
import { __ as
|
|
937
|
+
import { __ as __6 } from "@wordpress/i18n";
|
|
721
938
|
|
|
722
939
|
// src/components/ui/form-field.tsx
|
|
723
|
-
import * as
|
|
940
|
+
import * as React8 from "react";
|
|
724
941
|
import { FormHelperText, FormLabel, Grid } from "@elementor/ui";
|
|
725
942
|
var FormField = ({ id: id2, label, errorMsg, noticeMsg, children }) => {
|
|
726
|
-
return /* @__PURE__ */
|
|
943
|
+
return /* @__PURE__ */ React8.createElement(Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React8.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React8.createElement(FormLabel, { htmlFor: id2, size: "tiny" }, label)), /* @__PURE__ */ React8.createElement(Grid, { item: true, xs: 12 }, children, errorMsg && /* @__PURE__ */ React8.createElement(FormHelperText, { error: true }, errorMsg), noticeMsg && /* @__PURE__ */ React8.createElement(FormHelperText, null, noticeMsg)));
|
|
727
944
|
};
|
|
728
945
|
|
|
729
946
|
// src/components/fields/label-field.tsx
|
|
@@ -731,16 +948,16 @@ function isLabelEqual(a, b) {
|
|
|
731
948
|
return a.trim().toLowerCase() === b.trim().toLowerCase();
|
|
732
949
|
}
|
|
733
950
|
var useLabelError = (initialError) => {
|
|
734
|
-
const [error, setError] =
|
|
951
|
+
const [error, setError] = useState3(initialError ?? { value: "", message: "" });
|
|
735
952
|
return {
|
|
736
953
|
labelFieldError: error,
|
|
737
954
|
setLabelFieldError: setError
|
|
738
955
|
};
|
|
739
956
|
};
|
|
740
957
|
var LabelField = ({ value, error, onChange }) => {
|
|
741
|
-
const [label, setLabel] =
|
|
742
|
-
const [errorMessage, setErrorMessage] =
|
|
743
|
-
const [noticeMessage, setNoticeMessage] =
|
|
958
|
+
const [label, setLabel] = useState3(value);
|
|
959
|
+
const [errorMessage, setErrorMessage] = useState3("");
|
|
960
|
+
const [noticeMessage, setNoticeMessage] = useState3(() => labelHint(value));
|
|
744
961
|
const handleChange = (newValue) => {
|
|
745
962
|
setLabel(newValue);
|
|
746
963
|
const errorMsg2 = validateLabel(newValue);
|
|
@@ -755,7 +972,7 @@ var LabelField = ({ value, error, onChange }) => {
|
|
|
755
972
|
errorMsg = error.message;
|
|
756
973
|
}
|
|
757
974
|
const noticeMsg = errorMsg ? "" : noticeMessage;
|
|
758
|
-
return /* @__PURE__ */
|
|
975
|
+
return /* @__PURE__ */ React9.createElement(FormField, { id: id2, label: __6("Name", "elementor"), errorMsg, noticeMsg }, /* @__PURE__ */ React9.createElement(
|
|
759
976
|
TextField,
|
|
760
977
|
{
|
|
761
978
|
id: id2,
|
|
@@ -775,10 +992,10 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
775
992
|
const { icon: VariableIcon, valueField: ValueField, variableType, propTypeUtil } = useVariableType();
|
|
776
993
|
const { setValue: setVariable, path } = useBoundProp3(propTypeUtil);
|
|
777
994
|
const initialValue = useInitialValue();
|
|
778
|
-
const [value, setValue] =
|
|
779
|
-
const [label, setLabel] =
|
|
780
|
-
const [errorMessage, setErrorMessage] =
|
|
781
|
-
const [valueFieldError, setValueFieldError] =
|
|
995
|
+
const [value, setValue] = useState4(initialValue);
|
|
996
|
+
const [label, setLabel] = useState4("");
|
|
997
|
+
const [errorMessage, setErrorMessage] = useState4("");
|
|
998
|
+
const [valueFieldError, setValueFieldError] = useState4("");
|
|
782
999
|
const { labelFieldError, setLabelFieldError } = useLabelError();
|
|
783
1000
|
const resetFields = () => {
|
|
784
1001
|
setValue("");
|
|
@@ -829,14 +1046,14 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
829
1046
|
return !!errorMessage;
|
|
830
1047
|
};
|
|
831
1048
|
const isSubmitDisabled = hasEmptyFields() || hasErrors();
|
|
832
|
-
return /* @__PURE__ */
|
|
1049
|
+
return /* @__PURE__ */ React10.createElement(PopoverBody, { height: "auto" }, /* @__PURE__ */ React10.createElement(
|
|
833
1050
|
PopoverHeader,
|
|
834
1051
|
{
|
|
835
|
-
icon: /* @__PURE__ */
|
|
836
|
-
title:
|
|
1052
|
+
icon: /* @__PURE__ */ React10.createElement(React10.Fragment, null, onGoBack && /* @__PURE__ */ React10.createElement(IconButton4, { size: SIZE, "aria-label": __7("Go Back", "elementor"), onClick: onGoBack }, /* @__PURE__ */ React10.createElement(ArrowLeftIcon, { fontSize: SIZE })), /* @__PURE__ */ React10.createElement(VariableIcon, { fontSize: SIZE })),
|
|
1053
|
+
title: __7("Create variable", "elementor"),
|
|
837
1054
|
onClose: closePopover
|
|
838
1055
|
}
|
|
839
|
-
), /* @__PURE__ */
|
|
1056
|
+
), /* @__PURE__ */ React10.createElement(Divider2, null), /* @__PURE__ */ React10.createElement(PopoverContent, { p: 2 }, /* @__PURE__ */ React10.createElement(
|
|
840
1057
|
LabelField,
|
|
841
1058
|
{
|
|
842
1059
|
value: label,
|
|
@@ -846,7 +1063,7 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
846
1063
|
setErrorMessage("");
|
|
847
1064
|
}
|
|
848
1065
|
}
|
|
849
|
-
), /* @__PURE__ */
|
|
1066
|
+
), /* @__PURE__ */ React10.createElement(FormField, { errorMsg: valueFieldError, label: __7("Value", "elementor") }, /* @__PURE__ */ React10.createElement(
|
|
850
1067
|
ValueField,
|
|
851
1068
|
{
|
|
852
1069
|
value,
|
|
@@ -857,22 +1074,22 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
857
1074
|
},
|
|
858
1075
|
onValidationChange: setValueFieldError
|
|
859
1076
|
}
|
|
860
|
-
)), errorMessage && /* @__PURE__ */
|
|
1077
|
+
)), errorMessage && /* @__PURE__ */ React10.createElement(FormHelperText2, { error: true }, errorMessage)), /* @__PURE__ */ React10.createElement(CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React10.createElement(Button2, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleCreateAndTrack }, __7("Create", "elementor"))));
|
|
861
1078
|
};
|
|
862
1079
|
|
|
863
1080
|
// src/components/variable-edit.tsx
|
|
864
|
-
import * as
|
|
865
|
-
import { useEffect as useEffect2, useState as
|
|
1081
|
+
import * as React13 from "react";
|
|
1082
|
+
import { useEffect as useEffect2, useState as useState6 } from "react";
|
|
866
1083
|
import { PopoverContent as PopoverContent2, useBoundProp as useBoundProp4 } from "@elementor/editor-controls";
|
|
867
1084
|
import { useSuppressedMessage } from "@elementor/editor-current-user";
|
|
868
1085
|
import { PopoverBody as PopoverBody2 } from "@elementor/editor-editing-panel";
|
|
869
1086
|
import { PopoverHeader as PopoverHeader2 } from "@elementor/editor-ui";
|
|
870
|
-
import { ArrowLeftIcon as ArrowLeftIcon2, TrashIcon } from "@elementor/icons";
|
|
871
|
-
import { Button as Button5, CardActions as CardActions2, Divider as Divider3, FormHelperText as FormHelperText3, IconButton as
|
|
872
|
-
import { __ as
|
|
1087
|
+
import { ArrowLeftIcon as ArrowLeftIcon2, TrashIcon as TrashIcon2 } from "@elementor/icons";
|
|
1088
|
+
import { Button as Button5, CardActions as CardActions2, Divider as Divider3, FormHelperText as FormHelperText3, IconButton as IconButton5 } from "@elementor/ui";
|
|
1089
|
+
import { __ as __10 } from "@wordpress/i18n";
|
|
873
1090
|
|
|
874
1091
|
// src/components/ui/delete-confirmation-dialog.tsx
|
|
875
|
-
import * as
|
|
1092
|
+
import * as React11 from "react";
|
|
876
1093
|
import { AlertOctagonFilledIcon } from "@elementor/icons";
|
|
877
1094
|
import {
|
|
878
1095
|
Button as Button3,
|
|
@@ -883,7 +1100,7 @@ import {
|
|
|
883
1100
|
DialogTitle,
|
|
884
1101
|
Typography as Typography2
|
|
885
1102
|
} from "@elementor/ui";
|
|
886
|
-
import { __ as
|
|
1103
|
+
import { __ as __8 } from "@wordpress/i18n";
|
|
887
1104
|
var TITLE_ID = "delete-variable-dialog";
|
|
888
1105
|
var DeleteConfirmationDialog = ({
|
|
889
1106
|
open,
|
|
@@ -891,12 +1108,12 @@ var DeleteConfirmationDialog = ({
|
|
|
891
1108
|
closeDialog,
|
|
892
1109
|
onConfirm
|
|
893
1110
|
}) => {
|
|
894
|
-
return /* @__PURE__ */
|
|
1111
|
+
return /* @__PURE__ */ React11.createElement(Dialog, { open, onClose: closeDialog, "aria-labelledby": TITLE_ID, maxWidth: "xs" }, /* @__PURE__ */ React11.createElement(DialogTitle, { id: TITLE_ID, display: "flex", alignItems: "center", gap: 1, sx: { lineHeight: 1 } }, /* @__PURE__ */ React11.createElement(AlertOctagonFilledIcon, { color: "error" }), __8("Delete this variable?", "elementor")), /* @__PURE__ */ React11.createElement(DialogContent, null, /* @__PURE__ */ React11.createElement(DialogContentText, { variant: "body2", color: "textPrimary" }, __8("All elements using", "elementor"), /* @__PURE__ */ React11.createElement(Typography2, { variant: "subtitle2", component: "span" }, "\xA0", label, "\xA0"), __8("will keep their current values, but the variable itself will be removed.", "elementor"))), /* @__PURE__ */ React11.createElement(DialogActions, null, /* @__PURE__ */ React11.createElement(Button3, { color: "secondary", onClick: closeDialog }, __8("Not now", "elementor")), /* @__PURE__ */ React11.createElement(Button3, { variant: "contained", color: "error", onClick: onConfirm }, __8("Delete", "elementor"))));
|
|
895
1112
|
};
|
|
896
1113
|
|
|
897
1114
|
// src/components/ui/edit-confirmation-dialog.tsx
|
|
898
|
-
import * as
|
|
899
|
-
import { useState as
|
|
1115
|
+
import * as React12 from "react";
|
|
1116
|
+
import { useState as useState5 } from "react";
|
|
900
1117
|
import { AlertTriangleFilledIcon } from "@elementor/icons";
|
|
901
1118
|
import {
|
|
902
1119
|
Button as Button4,
|
|
@@ -909,27 +1126,27 @@ import {
|
|
|
909
1126
|
FormControlLabel,
|
|
910
1127
|
Typography as Typography3
|
|
911
1128
|
} from "@elementor/ui";
|
|
912
|
-
import { __ as
|
|
1129
|
+
import { __ as __9 } from "@wordpress/i18n";
|
|
913
1130
|
var EDIT_CONFIRMATION_DIALOG_ID = "edit-confirmation-dialog";
|
|
914
1131
|
var EditConfirmationDialog = ({
|
|
915
1132
|
closeDialog,
|
|
916
1133
|
onConfirm,
|
|
917
1134
|
onSuppressMessage
|
|
918
1135
|
}) => {
|
|
919
|
-
const [dontShowAgain, setDontShowAgain] =
|
|
1136
|
+
const [dontShowAgain, setDontShowAgain] = useState5(false);
|
|
920
1137
|
const handleSave = () => {
|
|
921
1138
|
if (dontShowAgain) {
|
|
922
1139
|
onSuppressMessage?.();
|
|
923
1140
|
}
|
|
924
1141
|
onConfirm?.();
|
|
925
1142
|
};
|
|
926
|
-
return /* @__PURE__ */
|
|
1143
|
+
return /* @__PURE__ */ React12.createElement(Dialog2, { open: true, onClose: closeDialog, maxWidth: "xs" }, /* @__PURE__ */ React12.createElement(DialogTitle2, { display: "flex", alignItems: "center", gap: 1 }, /* @__PURE__ */ React12.createElement(AlertTriangleFilledIcon, { color: "secondary" }), __9("Changes to variables go live right away.", "elementor")), /* @__PURE__ */ React12.createElement(DialogContent2, null, /* @__PURE__ */ React12.createElement(DialogContentText2, { variant: "body2", color: "textPrimary" }, __9(
|
|
927
1144
|
"Don't worry - all other changes you make will wait until you publish your site.",
|
|
928
1145
|
"elementor"
|
|
929
|
-
))), /* @__PURE__ */
|
|
1146
|
+
))), /* @__PURE__ */ React12.createElement(DialogActions2, { sx: { justifyContent: "space-between", alignItems: "center" } }, /* @__PURE__ */ React12.createElement(
|
|
930
1147
|
FormControlLabel,
|
|
931
1148
|
{
|
|
932
|
-
control: /* @__PURE__ */
|
|
1149
|
+
control: /* @__PURE__ */ React12.createElement(
|
|
933
1150
|
Checkbox,
|
|
934
1151
|
{
|
|
935
1152
|
checked: dontShowAgain,
|
|
@@ -937,9 +1154,9 @@ var EditConfirmationDialog = ({
|
|
|
937
1154
|
size: "small"
|
|
938
1155
|
}
|
|
939
1156
|
),
|
|
940
|
-
label: /* @__PURE__ */
|
|
1157
|
+
label: /* @__PURE__ */ React12.createElement(Typography3, { variant: "body2" }, __9("Don't show me again", "elementor"))
|
|
941
1158
|
}
|
|
942
|
-
), /* @__PURE__ */
|
|
1159
|
+
), /* @__PURE__ */ React12.createElement("div", null, /* @__PURE__ */ React12.createElement(Button4, { color: "secondary", onClick: closeDialog }, __9("Keep editing", "elementor")), /* @__PURE__ */ React12.createElement(Button4, { variant: "contained", color: "secondary", onClick: handleSave, sx: { ml: 1 } }, __9("Save", "elementor")))));
|
|
943
1160
|
};
|
|
944
1161
|
|
|
945
1162
|
// src/components/variable-edit.tsx
|
|
@@ -948,18 +1165,18 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
948
1165
|
const { icon: VariableIcon, valueField: ValueField, variableType, propTypeUtil } = useVariableType();
|
|
949
1166
|
const { setValue: notifyBoundPropChange, value: assignedValue } = useBoundProp4(propTypeUtil);
|
|
950
1167
|
const [isMessageSuppressed, suppressMessage] = useSuppressedMessage(EDIT_CONFIRMATION_DIALOG_ID);
|
|
951
|
-
const [deleteConfirmation, setDeleteConfirmation] =
|
|
952
|
-
const [editConfirmation, setEditConfirmation] =
|
|
953
|
-
const [errorMessage, setErrorMessage] =
|
|
954
|
-
const [valueFieldError, setValueFieldError] =
|
|
1168
|
+
const [deleteConfirmation, setDeleteConfirmation] = useState6(false);
|
|
1169
|
+
const [editConfirmation, setEditConfirmation] = useState6(false);
|
|
1170
|
+
const [errorMessage, setErrorMessage] = useState6("");
|
|
1171
|
+
const [valueFieldError, setValueFieldError] = useState6("");
|
|
955
1172
|
const { labelFieldError, setLabelFieldError } = useLabelError();
|
|
956
1173
|
const variable = useVariable(editId);
|
|
957
1174
|
if (!variable) {
|
|
958
1175
|
throw new Error(`Global ${variableType} variable not found`);
|
|
959
1176
|
}
|
|
960
1177
|
const userPermissions = usePermissions();
|
|
961
|
-
const [value, setValue] =
|
|
962
|
-
const [label, setLabel] =
|
|
1178
|
+
const [value, setValue] = useState6(() => variable.value);
|
|
1179
|
+
const [label, setLabel] = useState6(() => variable.label);
|
|
963
1180
|
useEffect2(() => {
|
|
964
1181
|
styleVariablesRepository.update({
|
|
965
1182
|
[editId]: {
|
|
@@ -1023,15 +1240,15 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
1023
1240
|
const actions = [];
|
|
1024
1241
|
if (userPermissions.canDelete()) {
|
|
1025
1242
|
actions.push(
|
|
1026
|
-
/* @__PURE__ */
|
|
1027
|
-
|
|
1243
|
+
/* @__PURE__ */ React13.createElement(
|
|
1244
|
+
IconButton5,
|
|
1028
1245
|
{
|
|
1029
1246
|
key: "delete",
|
|
1030
1247
|
size: SIZE2,
|
|
1031
|
-
"aria-label":
|
|
1248
|
+
"aria-label": __10("Delete", "elementor"),
|
|
1032
1249
|
onClick: handleDeleteConfirmation
|
|
1033
1250
|
},
|
|
1034
|
-
/* @__PURE__ */
|
|
1251
|
+
/* @__PURE__ */ React13.createElement(TrashIcon2, { fontSize: SIZE2 })
|
|
1035
1252
|
)
|
|
1036
1253
|
);
|
|
1037
1254
|
}
|
|
@@ -1051,23 +1268,23 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
1051
1268
|
return !!errorMessage;
|
|
1052
1269
|
};
|
|
1053
1270
|
const isSubmitDisabled = noValueChanged() || hasEmptyFields() || hasErrors();
|
|
1054
|
-
return /* @__PURE__ */
|
|
1271
|
+
return /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(PopoverBody2, { height: "auto" }, /* @__PURE__ */ React13.createElement(
|
|
1055
1272
|
PopoverHeader2,
|
|
1056
1273
|
{
|
|
1057
|
-
title:
|
|
1274
|
+
title: __10("Edit variable", "elementor"),
|
|
1058
1275
|
onClose,
|
|
1059
|
-
icon: /* @__PURE__ */
|
|
1060
|
-
|
|
1276
|
+
icon: /* @__PURE__ */ React13.createElement(React13.Fragment, null, onGoBack && /* @__PURE__ */ React13.createElement(
|
|
1277
|
+
IconButton5,
|
|
1061
1278
|
{
|
|
1062
1279
|
size: SIZE2,
|
|
1063
|
-
"aria-label":
|
|
1280
|
+
"aria-label": __10("Go Back", "elementor"),
|
|
1064
1281
|
onClick: onGoBack
|
|
1065
1282
|
},
|
|
1066
|
-
/* @__PURE__ */
|
|
1067
|
-
), /* @__PURE__ */
|
|
1283
|
+
/* @__PURE__ */ React13.createElement(ArrowLeftIcon2, { fontSize: SIZE2 })
|
|
1284
|
+
), /* @__PURE__ */ React13.createElement(VariableIcon, { fontSize: SIZE2 })),
|
|
1068
1285
|
actions
|
|
1069
1286
|
}
|
|
1070
|
-
), /* @__PURE__ */
|
|
1287
|
+
), /* @__PURE__ */ React13.createElement(Divider3, null), /* @__PURE__ */ React13.createElement(PopoverContent2, { p: 2 }, /* @__PURE__ */ React13.createElement(
|
|
1071
1288
|
LabelField,
|
|
1072
1289
|
{
|
|
1073
1290
|
value: label,
|
|
@@ -1077,7 +1294,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
1077
1294
|
setErrorMessage("");
|
|
1078
1295
|
}
|
|
1079
1296
|
}
|
|
1080
|
-
), /* @__PURE__ */
|
|
1297
|
+
), /* @__PURE__ */ React13.createElement(FormField, { errorMsg: valueFieldError, label: __10("Value", "elementor") }, /* @__PURE__ */ React13.createElement(
|
|
1081
1298
|
ValueField,
|
|
1082
1299
|
{
|
|
1083
1300
|
value,
|
|
@@ -1088,7 +1305,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
1088
1305
|
},
|
|
1089
1306
|
onValidationChange: setValueFieldError
|
|
1090
1307
|
}
|
|
1091
|
-
)), errorMessage && /* @__PURE__ */
|
|
1308
|
+
)), errorMessage && /* @__PURE__ */ React13.createElement(FormHelperText3, { error: true }, errorMessage)), /* @__PURE__ */ React13.createElement(CardActions2, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React13.createElement(Button5, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleUpdate }, __10("Save", "elementor")))), deleteConfirmation && /* @__PURE__ */ React13.createElement(
|
|
1092
1309
|
DeleteConfirmationDialog,
|
|
1093
1310
|
{
|
|
1094
1311
|
open: true,
|
|
@@ -1096,7 +1313,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
1096
1313
|
onConfirm: handleDelete,
|
|
1097
1314
|
closeDialog: closeDeleteDialog()
|
|
1098
1315
|
}
|
|
1099
|
-
), editConfirmation && !isMessageSuppressed && /* @__PURE__ */
|
|
1316
|
+
), editConfirmation && !isMessageSuppressed && /* @__PURE__ */ React13.createElement(
|
|
1100
1317
|
EditConfirmationDialog,
|
|
1101
1318
|
{
|
|
1102
1319
|
closeDialog: closeEditDialog(),
|
|
@@ -1107,25 +1324,25 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
1107
1324
|
};
|
|
1108
1325
|
|
|
1109
1326
|
// src/components/variables-selection.tsx
|
|
1110
|
-
import * as
|
|
1111
|
-
import { useState as
|
|
1327
|
+
import * as React17 from "react";
|
|
1328
|
+
import { useState as useState7 } from "react";
|
|
1112
1329
|
import { useBoundProp as useBoundProp5 } from "@elementor/editor-controls";
|
|
1113
1330
|
import { PopoverBody as PopoverBody3 } from "@elementor/editor-editing-panel";
|
|
1114
1331
|
import { PopoverHeader as PopoverHeader3, PopoverMenuList, PopoverSearch } from "@elementor/editor-ui";
|
|
1115
|
-
import { ColorFilterIcon, PlusIcon, SettingsIcon } from "@elementor/icons";
|
|
1116
|
-
import { Divider as Divider4, IconButton as
|
|
1117
|
-
import { __ as
|
|
1332
|
+
import { ColorFilterIcon as ColorFilterIcon2, PlusIcon, SettingsIcon } from "@elementor/icons";
|
|
1333
|
+
import { Divider as Divider4, IconButton as IconButton7 } from "@elementor/ui";
|
|
1334
|
+
import { __ as __14, sprintf } from "@wordpress/i18n";
|
|
1118
1335
|
|
|
1119
1336
|
// src/components/ui/menu-item-content.tsx
|
|
1120
|
-
import * as
|
|
1121
|
-
import { EllipsisWithTooltip } from "@elementor/editor-ui";
|
|
1337
|
+
import * as React14 from "react";
|
|
1338
|
+
import { EllipsisWithTooltip as EllipsisWithTooltip2 } from "@elementor/editor-ui";
|
|
1122
1339
|
import { EditIcon } from "@elementor/icons";
|
|
1123
|
-
import { Box as Box3, IconButton as
|
|
1124
|
-
import { __ as
|
|
1340
|
+
import { Box as Box3, IconButton as IconButton6, ListItemIcon, Typography as Typography4 } from "@elementor/ui";
|
|
1341
|
+
import { __ as __11 } from "@wordpress/i18n";
|
|
1125
1342
|
var SIZE3 = "tiny";
|
|
1126
1343
|
var MenuItemContent = ({ item }) => {
|
|
1127
1344
|
const onEdit = item.onEdit;
|
|
1128
|
-
return /* @__PURE__ */
|
|
1345
|
+
return /* @__PURE__ */ React14.createElement(React14.Fragment, null, /* @__PURE__ */ React14.createElement(ListItemIcon, null, item.icon), /* @__PURE__ */ React14.createElement(
|
|
1129
1346
|
Box3,
|
|
1130
1347
|
{
|
|
1131
1348
|
sx: {
|
|
@@ -1136,8 +1353,8 @@ var MenuItemContent = ({ item }) => {
|
|
|
1136
1353
|
gap: 1
|
|
1137
1354
|
}
|
|
1138
1355
|
},
|
|
1139
|
-
/* @__PURE__ */
|
|
1140
|
-
|
|
1356
|
+
/* @__PURE__ */ React14.createElement(
|
|
1357
|
+
EllipsisWithTooltip2,
|
|
1141
1358
|
{
|
|
1142
1359
|
title: item.label || item.value,
|
|
1143
1360
|
as: Typography4,
|
|
@@ -1147,8 +1364,8 @@ var MenuItemContent = ({ item }) => {
|
|
|
1147
1364
|
maxWidth: "50%"
|
|
1148
1365
|
}
|
|
1149
1366
|
),
|
|
1150
|
-
item.secondaryText && /* @__PURE__ */
|
|
1151
|
-
|
|
1367
|
+
item.secondaryText && /* @__PURE__ */ React14.createElement(
|
|
1368
|
+
EllipsisWithTooltip2,
|
|
1152
1369
|
{
|
|
1153
1370
|
title: item.secondaryText,
|
|
1154
1371
|
as: Typography4,
|
|
@@ -1158,27 +1375,27 @@ var MenuItemContent = ({ item }) => {
|
|
|
1158
1375
|
maxWidth: "50%"
|
|
1159
1376
|
}
|
|
1160
1377
|
)
|
|
1161
|
-
), !!onEdit && /* @__PURE__ */
|
|
1162
|
-
|
|
1378
|
+
), !!onEdit && /* @__PURE__ */ React14.createElement(
|
|
1379
|
+
IconButton6,
|
|
1163
1380
|
{
|
|
1164
1381
|
sx: { mx: 1, opacity: "0" },
|
|
1165
1382
|
onClick: (e) => {
|
|
1166
1383
|
e.stopPropagation();
|
|
1167
1384
|
onEdit(item.value);
|
|
1168
1385
|
},
|
|
1169
|
-
"aria-label":
|
|
1386
|
+
"aria-label": __11("Edit", "elementor")
|
|
1170
1387
|
},
|
|
1171
|
-
/* @__PURE__ */
|
|
1388
|
+
/* @__PURE__ */ React14.createElement(EditIcon, { color: "action", fontSize: SIZE3 })
|
|
1172
1389
|
));
|
|
1173
1390
|
};
|
|
1174
1391
|
|
|
1175
1392
|
// src/components/ui/no-search-results.tsx
|
|
1176
|
-
import * as
|
|
1177
|
-
import { Link, Stack as
|
|
1178
|
-
import { __ as
|
|
1393
|
+
import * as React15 from "react";
|
|
1394
|
+
import { Link, Stack as Stack4, Typography as Typography5 } from "@elementor/ui";
|
|
1395
|
+
import { __ as __12 } from "@wordpress/i18n";
|
|
1179
1396
|
var NoSearchResults = ({ searchValue, onClear, icon }) => {
|
|
1180
|
-
return /* @__PURE__ */
|
|
1181
|
-
|
|
1397
|
+
return /* @__PURE__ */ React15.createElement(
|
|
1398
|
+
Stack4,
|
|
1182
1399
|
{
|
|
1183
1400
|
gap: 1,
|
|
1184
1401
|
alignItems: "center",
|
|
@@ -1189,19 +1406,19 @@ var NoSearchResults = ({ searchValue, onClear, icon }) => {
|
|
|
1189
1406
|
sx: { pb: 3.5 }
|
|
1190
1407
|
},
|
|
1191
1408
|
icon,
|
|
1192
|
-
/* @__PURE__ */
|
|
1193
|
-
/* @__PURE__ */
|
|
1409
|
+
/* @__PURE__ */ React15.createElement(Typography5, { align: "center", variant: "subtitle2" }, __12("Sorry, nothing matched", "elementor"), /* @__PURE__ */ React15.createElement("br", null), "\u201C", searchValue, "\u201D."),
|
|
1410
|
+
/* @__PURE__ */ React15.createElement(Typography5, { align: "center", variant: "caption", sx: { display: "flex", flexDirection: "column" } }, __12("Try something else.", "elementor"), /* @__PURE__ */ React15.createElement(Link, { color: "text.secondary", variant: "caption", component: "button", onClick: onClear }, __12("Clear & try again", "elementor")))
|
|
1194
1411
|
);
|
|
1195
1412
|
};
|
|
1196
1413
|
|
|
1197
1414
|
// src/components/ui/no-variables.tsx
|
|
1198
|
-
import * as
|
|
1199
|
-
import { Button as Button6, Stack as
|
|
1200
|
-
import { __ as
|
|
1415
|
+
import * as React16 from "react";
|
|
1416
|
+
import { Button as Button6, Stack as Stack5, Typography as Typography6 } from "@elementor/ui";
|
|
1417
|
+
import { __ as __13 } from "@wordpress/i18n";
|
|
1201
1418
|
var NoVariables = ({ icon, title, onAdd }) => {
|
|
1202
1419
|
const canAdd = usePermissions().canAdd();
|
|
1203
|
-
return /* @__PURE__ */
|
|
1204
|
-
|
|
1420
|
+
return /* @__PURE__ */ React16.createElement(
|
|
1421
|
+
Stack5,
|
|
1205
1422
|
{
|
|
1206
1423
|
gap: 1,
|
|
1207
1424
|
alignItems: "center",
|
|
@@ -1211,26 +1428,26 @@ var NoVariables = ({ icon, title, onAdd }) => {
|
|
|
1211
1428
|
sx: { p: 2.5, pb: 5.5 }
|
|
1212
1429
|
},
|
|
1213
1430
|
icon,
|
|
1214
|
-
canAdd ? /* @__PURE__ */
|
|
1431
|
+
canAdd ? /* @__PURE__ */ React16.createElement(React16.Fragment, null, /* @__PURE__ */ React16.createElement(
|
|
1215
1432
|
NoVariablesContent,
|
|
1216
1433
|
{
|
|
1217
|
-
title: title ||
|
|
1218
|
-
message:
|
|
1434
|
+
title: title || __13("Create your first variable", "elementor"),
|
|
1435
|
+
message: __13(
|
|
1219
1436
|
"Variables are saved attributes that you can apply anywhere on your site.",
|
|
1220
1437
|
"elementor"
|
|
1221
1438
|
)
|
|
1222
1439
|
}
|
|
1223
|
-
), onAdd && /* @__PURE__ */
|
|
1440
|
+
), onAdd && /* @__PURE__ */ React16.createElement(Button6, { variant: "outlined", color: "secondary", size: "small", onClick: onAdd }, __13("Create a variable", "elementor"))) : /* @__PURE__ */ React16.createElement(
|
|
1224
1441
|
NoVariablesContent,
|
|
1225
1442
|
{
|
|
1226
|
-
title:
|
|
1227
|
-
message:
|
|
1443
|
+
title: __13("There are no variables", "elementor"),
|
|
1444
|
+
message: __13("With your current role, you can only connect and detach variables.", "elementor")
|
|
1228
1445
|
}
|
|
1229
1446
|
)
|
|
1230
1447
|
);
|
|
1231
1448
|
};
|
|
1232
1449
|
function NoVariablesContent({ title, message }) {
|
|
1233
|
-
return /* @__PURE__ */
|
|
1450
|
+
return /* @__PURE__ */ React16.createElement(React16.Fragment, null, /* @__PURE__ */ React16.createElement(Typography6, { align: "center", variant: "subtitle2" }, title), /* @__PURE__ */ React16.createElement(Typography6, { align: "center", variant: "caption", maxWidth: "180px" }, message));
|
|
1234
1451
|
}
|
|
1235
1452
|
|
|
1236
1453
|
// src/components/ui/styled-menu-list.tsx
|
|
@@ -1270,7 +1487,7 @@ var SIZE4 = "tiny";
|
|
|
1270
1487
|
var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
1271
1488
|
const { icon: VariableIcon, startIcon, variableType, propTypeUtil } = useVariableType();
|
|
1272
1489
|
const { value: variable, setValue: setVariable, path } = useBoundProp5(propTypeUtil);
|
|
1273
|
-
const [searchValue, setSearchValue] =
|
|
1490
|
+
const [searchValue, setSearchValue] = useState7("");
|
|
1274
1491
|
const {
|
|
1275
1492
|
list: variables,
|
|
1276
1493
|
hasMatches: hasSearchResults,
|
|
@@ -1296,20 +1513,20 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
1296
1513
|
const actions = [];
|
|
1297
1514
|
if (onAdd) {
|
|
1298
1515
|
actions.push(
|
|
1299
|
-
/* @__PURE__ */
|
|
1516
|
+
/* @__PURE__ */ React17.createElement(IconButton7, { key: "add", size: SIZE4, onClick: onAddAndTrack }, /* @__PURE__ */ React17.createElement(PlusIcon, { fontSize: SIZE4 }))
|
|
1300
1517
|
);
|
|
1301
1518
|
}
|
|
1302
1519
|
if (onSettings) {
|
|
1303
1520
|
actions.push(
|
|
1304
|
-
/* @__PURE__ */
|
|
1521
|
+
/* @__PURE__ */ React17.createElement(IconButton7, { key: "settings", size: SIZE4, onClick: onSettings }, /* @__PURE__ */ React17.createElement(SettingsIcon, { fontSize: SIZE4 }))
|
|
1305
1522
|
);
|
|
1306
1523
|
}
|
|
1307
|
-
const StartIcon = startIcon || (() => /* @__PURE__ */
|
|
1524
|
+
const StartIcon = startIcon || (() => /* @__PURE__ */ React17.createElement(VariableIcon, { fontSize: SIZE4 }));
|
|
1308
1525
|
const items = variables.map(({ value, label, key }) => ({
|
|
1309
1526
|
type: "item",
|
|
1310
1527
|
value: key,
|
|
1311
1528
|
label,
|
|
1312
|
-
icon: /* @__PURE__ */
|
|
1529
|
+
icon: /* @__PURE__ */ React17.createElement(StartIcon, { value }),
|
|
1313
1530
|
secondaryText: value,
|
|
1314
1531
|
onEdit: onEdit ? () => onEdit?.(key) : void 0
|
|
1315
1532
|
}));
|
|
@@ -1321,25 +1538,25 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
1321
1538
|
};
|
|
1322
1539
|
const noVariableTitle = sprintf(
|
|
1323
1540
|
/* translators: %s: Variable Type. */
|
|
1324
|
-
|
|
1541
|
+
__14("Create your first %s variable", "elementor"),
|
|
1325
1542
|
variableType
|
|
1326
1543
|
);
|
|
1327
|
-
return /* @__PURE__ */
|
|
1544
|
+
return /* @__PURE__ */ React17.createElement(PopoverBody3, null, /* @__PURE__ */ React17.createElement(
|
|
1328
1545
|
PopoverHeader3,
|
|
1329
1546
|
{
|
|
1330
|
-
title:
|
|
1331
|
-
icon: /* @__PURE__ */
|
|
1547
|
+
title: __14("Variables", "elementor"),
|
|
1548
|
+
icon: /* @__PURE__ */ React17.createElement(ColorFilterIcon2, { fontSize: SIZE4 }),
|
|
1332
1549
|
onClose: closePopover,
|
|
1333
1550
|
actions
|
|
1334
1551
|
}
|
|
1335
|
-
), hasVariables && /* @__PURE__ */
|
|
1552
|
+
), hasVariables && /* @__PURE__ */ React17.createElement(
|
|
1336
1553
|
PopoverSearch,
|
|
1337
1554
|
{
|
|
1338
1555
|
value: searchValue,
|
|
1339
1556
|
onSearch: handleSearch,
|
|
1340
|
-
placeholder:
|
|
1557
|
+
placeholder: __14("Search", "elementor")
|
|
1341
1558
|
}
|
|
1342
|
-
), /* @__PURE__ */
|
|
1559
|
+
), /* @__PURE__ */ React17.createElement(Divider4, null), hasVariables && hasSearchResults && /* @__PURE__ */ React17.createElement(
|
|
1343
1560
|
PopoverMenuList,
|
|
1344
1561
|
{
|
|
1345
1562
|
items,
|
|
@@ -1349,16 +1566,16 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
1349
1566
|
selectedValue: variable,
|
|
1350
1567
|
"data-testid": `${variableType}-variables-list`,
|
|
1351
1568
|
menuListTemplate: VariablesStyledMenuList,
|
|
1352
|
-
menuItemContentTemplate: (item) => /* @__PURE__ */
|
|
1569
|
+
menuItemContentTemplate: (item) => /* @__PURE__ */ React17.createElement(MenuItemContent, { item })
|
|
1353
1570
|
}
|
|
1354
|
-
), !hasSearchResults && hasVariables && /* @__PURE__ */
|
|
1571
|
+
), !hasSearchResults && hasVariables && /* @__PURE__ */ React17.createElement(
|
|
1355
1572
|
NoSearchResults,
|
|
1356
1573
|
{
|
|
1357
1574
|
searchValue,
|
|
1358
1575
|
onClear: handleClearSearch,
|
|
1359
|
-
icon: /* @__PURE__ */
|
|
1576
|
+
icon: /* @__PURE__ */ React17.createElement(VariableIcon, { fontSize: "large" })
|
|
1360
1577
|
}
|
|
1361
|
-
), !hasVariables && /* @__PURE__ */
|
|
1578
|
+
), !hasVariables && /* @__PURE__ */ React17.createElement(NoVariables, { title: noVariableTitle, icon: /* @__PURE__ */ React17.createElement(VariableIcon, { fontSize: "large" }), onAdd }));
|
|
1362
1579
|
};
|
|
1363
1580
|
|
|
1364
1581
|
// src/components/variable-selection-popover.tsx
|
|
@@ -1366,13 +1583,13 @@ var VIEW_LIST = "list";
|
|
|
1366
1583
|
var VIEW_ADD = "add";
|
|
1367
1584
|
var VIEW_EDIT = "edit";
|
|
1368
1585
|
var VariableSelectionPopover = ({ closePopover, propTypeKey, selectedVariable }) => {
|
|
1369
|
-
const [currentView, setCurrentView] =
|
|
1370
|
-
const [editId, setEditId] =
|
|
1586
|
+
const [currentView, setCurrentView] = useState8(VIEW_LIST);
|
|
1587
|
+
const [editId, setEditId] = useState8("");
|
|
1371
1588
|
const { open } = usePanelActions();
|
|
1372
|
-
const onSettingsAvailable = isExperimentActive("
|
|
1589
|
+
const onSettingsAvailable = isExperimentActive("e_variables_manager") ? () => {
|
|
1373
1590
|
open();
|
|
1374
1591
|
} : void 0;
|
|
1375
|
-
return /* @__PURE__ */
|
|
1592
|
+
return /* @__PURE__ */ React18.createElement(VariableTypeProvider, { propTypeKey }, /* @__PURE__ */ React18.createElement(PopoverContentRefContextProvider, null, RenderView({
|
|
1376
1593
|
propTypeKey,
|
|
1377
1594
|
currentView,
|
|
1378
1595
|
selectedVariable,
|
|
@@ -1406,8 +1623,8 @@ function RenderView(props) {
|
|
|
1406
1623
|
}
|
|
1407
1624
|
if (userPermissions.canManageSettings() && props.onSettings) {
|
|
1408
1625
|
handlers.onSettings = () => {
|
|
1409
|
-
props.onSettings?.();
|
|
1410
1626
|
props.closePopover();
|
|
1627
|
+
props.onSettings?.();
|
|
1411
1628
|
};
|
|
1412
1629
|
}
|
|
1413
1630
|
const handleSubmitOnEdit = () => {
|
|
@@ -1418,7 +1635,7 @@ function RenderView(props) {
|
|
|
1418
1635
|
}
|
|
1419
1636
|
};
|
|
1420
1637
|
if (VIEW_LIST === props.currentView) {
|
|
1421
|
-
return /* @__PURE__ */
|
|
1638
|
+
return /* @__PURE__ */ React18.createElement(
|
|
1422
1639
|
VariablesSelection,
|
|
1423
1640
|
{
|
|
1424
1641
|
closePopover: handlers.onClose,
|
|
@@ -1429,10 +1646,10 @@ function RenderView(props) {
|
|
|
1429
1646
|
);
|
|
1430
1647
|
}
|
|
1431
1648
|
if (VIEW_ADD === props.currentView) {
|
|
1432
|
-
return /* @__PURE__ */
|
|
1649
|
+
return /* @__PURE__ */ React18.createElement(VariableCreation, { onGoBack: handlers.onGoBack, onClose: handlers.onClose });
|
|
1433
1650
|
}
|
|
1434
1651
|
if (VIEW_EDIT === props.currentView) {
|
|
1435
|
-
return /* @__PURE__ */
|
|
1652
|
+
return /* @__PURE__ */ React18.createElement(
|
|
1436
1653
|
VariableEdit,
|
|
1437
1654
|
{
|
|
1438
1655
|
editId: props.editId,
|
|
@@ -1446,25 +1663,25 @@ function RenderView(props) {
|
|
|
1446
1663
|
}
|
|
1447
1664
|
|
|
1448
1665
|
// src/components/ui/tags/assigned-tag.tsx
|
|
1449
|
-
import * as
|
|
1666
|
+
import * as React19 from "react";
|
|
1450
1667
|
import { DetachIcon } from "@elementor/icons";
|
|
1451
|
-
import { Box as Box4, IconButton as
|
|
1452
|
-
import { __ as
|
|
1668
|
+
import { Box as Box4, IconButton as IconButton8, Stack as Stack6, Tooltip, Typography as Typography7, UnstableTag as Tag } from "@elementor/ui";
|
|
1669
|
+
import { __ as __15 } from "@wordpress/i18n";
|
|
1453
1670
|
var SIZE5 = "tiny";
|
|
1454
1671
|
var AssignedTag = ({ startIcon, label, onUnlink, ...props }) => {
|
|
1455
1672
|
const actions = [];
|
|
1456
1673
|
if (onUnlink) {
|
|
1457
1674
|
actions.push(
|
|
1458
|
-
/* @__PURE__ */
|
|
1675
|
+
/* @__PURE__ */ React19.createElement(IconButton8, { key: "unlink", size: SIZE5, onClick: onUnlink, "aria-label": __15("Unlink", "elementor") }, /* @__PURE__ */ React19.createElement(DetachIcon, { fontSize: SIZE5 }))
|
|
1459
1676
|
);
|
|
1460
1677
|
}
|
|
1461
|
-
return /* @__PURE__ */
|
|
1678
|
+
return /* @__PURE__ */ React19.createElement(Tooltip, { title: label, placement: "top" }, /* @__PURE__ */ React19.createElement(
|
|
1462
1679
|
Tag,
|
|
1463
1680
|
{
|
|
1464
1681
|
fullWidth: true,
|
|
1465
1682
|
showActionsOnHover: true,
|
|
1466
|
-
startIcon: /* @__PURE__ */
|
|
1467
|
-
label: /* @__PURE__ */
|
|
1683
|
+
startIcon: /* @__PURE__ */ React19.createElement(Stack6, { gap: 0.5, direction: "row", alignItems: "center" }, startIcon),
|
|
1684
|
+
label: /* @__PURE__ */ React19.createElement(Box4, { sx: { display: "inline-grid", minWidth: 0 } }, /* @__PURE__ */ React19.createElement(Typography7, { sx: { lineHeight: 1.34 }, variant: "caption", noWrap: true }, label)),
|
|
1468
1685
|
actions,
|
|
1469
1686
|
...props
|
|
1470
1687
|
}
|
|
@@ -1477,21 +1694,21 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
|
1477
1694
|
const { setValue } = useBoundProp6();
|
|
1478
1695
|
const anchorRef = useRef(null);
|
|
1479
1696
|
const popupId = useId2();
|
|
1480
|
-
const popupState =
|
|
1697
|
+
const popupState = usePopupState2({
|
|
1481
1698
|
variant: "popover",
|
|
1482
1699
|
popupId: `elementor-variables-list-${popupId}`
|
|
1483
1700
|
});
|
|
1484
1701
|
const unlinkVariable = createUnlinkHandler(variable, propTypeKey, setValue);
|
|
1485
1702
|
const StartIcon = startIcon || (() => null);
|
|
1486
|
-
return /* @__PURE__ */
|
|
1703
|
+
return /* @__PURE__ */ React20.createElement(Box5, { ref: anchorRef }, /* @__PURE__ */ React20.createElement(
|
|
1487
1704
|
AssignedTag,
|
|
1488
1705
|
{
|
|
1489
1706
|
label: variable.label,
|
|
1490
|
-
startIcon: /* @__PURE__ */
|
|
1707
|
+
startIcon: /* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement(ColorFilterIcon3, { fontSize: SIZE5 }), /* @__PURE__ */ React20.createElement(StartIcon, { value: variable.value })),
|
|
1491
1708
|
onUnlink: unlinkVariable,
|
|
1492
|
-
...
|
|
1709
|
+
...bindTrigger2(popupState)
|
|
1493
1710
|
}
|
|
1494
|
-
), /* @__PURE__ */
|
|
1711
|
+
), /* @__PURE__ */ React20.createElement(
|
|
1495
1712
|
Popover,
|
|
1496
1713
|
{
|
|
1497
1714
|
disableScrollLock: true,
|
|
@@ -1503,7 +1720,7 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
|
1503
1720
|
},
|
|
1504
1721
|
...bindPopover(popupState)
|
|
1505
1722
|
},
|
|
1506
|
-
/* @__PURE__ */
|
|
1723
|
+
/* @__PURE__ */ React20.createElement(
|
|
1507
1724
|
VariableSelectionPopover,
|
|
1508
1725
|
{
|
|
1509
1726
|
selectedVariable: variable,
|
|
@@ -1515,19 +1732,19 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
|
1515
1732
|
};
|
|
1516
1733
|
|
|
1517
1734
|
// src/components/ui/variable/deleted-variable.tsx
|
|
1518
|
-
import * as
|
|
1519
|
-
import { useId as useId3, useRef as useRef2, useState as
|
|
1735
|
+
import * as React24 from "react";
|
|
1736
|
+
import { useId as useId3, useRef as useRef2, useState as useState10 } from "react";
|
|
1520
1737
|
import { useBoundProp as useBoundProp8 } from "@elementor/editor-controls";
|
|
1521
|
-
import { Backdrop, bindPopover as bindPopover2, Box as Box7, Infotip, Popover as Popover2, usePopupState as
|
|
1738
|
+
import { Backdrop, bindPopover as bindPopover2, Box as Box7, Infotip, Popover as Popover2, usePopupState as usePopupState3 } from "@elementor/ui";
|
|
1522
1739
|
|
|
1523
1740
|
// src/components/variable-restore.tsx
|
|
1524
|
-
import * as
|
|
1525
|
-
import { useState as
|
|
1741
|
+
import * as React21 from "react";
|
|
1742
|
+
import { useState as useState9 } from "react";
|
|
1526
1743
|
import { PopoverContent as PopoverContent3, useBoundProp as useBoundProp7 } from "@elementor/editor-controls";
|
|
1527
1744
|
import { PopoverBody as PopoverBody4 } from "@elementor/editor-editing-panel";
|
|
1528
1745
|
import { PopoverHeader as PopoverHeader4 } from "@elementor/editor-ui";
|
|
1529
1746
|
import { Button as Button7, CardActions as CardActions3, Divider as Divider5, FormHelperText as FormHelperText4 } from "@elementor/ui";
|
|
1530
|
-
import { __ as
|
|
1747
|
+
import { __ as __16 } from "@wordpress/i18n";
|
|
1531
1748
|
var SIZE6 = "tiny";
|
|
1532
1749
|
var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
1533
1750
|
const { icon: VariableIcon, valueField: ValueField, variableType, propTypeUtil } = useVariableType();
|
|
@@ -1536,10 +1753,10 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
1536
1753
|
if (!variable) {
|
|
1537
1754
|
throw new Error(`Global ${variableType} variable not found`);
|
|
1538
1755
|
}
|
|
1539
|
-
const [errorMessage, setErrorMessage] =
|
|
1540
|
-
const [valueFieldError, setValueFieldError] =
|
|
1541
|
-
const [label, setLabel] =
|
|
1542
|
-
const [value, setValue] =
|
|
1756
|
+
const [errorMessage, setErrorMessage] = useState9("");
|
|
1757
|
+
const [valueFieldError, setValueFieldError] = useState9("");
|
|
1758
|
+
const [label, setLabel] = useState9(variable.label);
|
|
1759
|
+
const [value, setValue] = useState9(variable.value);
|
|
1543
1760
|
const { labelFieldError, setLabelFieldError } = useLabelError({
|
|
1544
1761
|
value: variable.label,
|
|
1545
1762
|
message: ERROR_MESSAGES.DUPLICATED_LABEL
|
|
@@ -1577,14 +1794,14 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
1577
1794
|
return !!errorMessage;
|
|
1578
1795
|
};
|
|
1579
1796
|
const isSubmitDisabled = noValueChanged() || hasEmptyFields() || hasErrors();
|
|
1580
|
-
return /* @__PURE__ */
|
|
1797
|
+
return /* @__PURE__ */ React21.createElement(PopoverContentRefContextProvider, null, /* @__PURE__ */ React21.createElement(PopoverBody4, { height: "auto" }, /* @__PURE__ */ React21.createElement(
|
|
1581
1798
|
PopoverHeader4,
|
|
1582
1799
|
{
|
|
1583
|
-
icon: /* @__PURE__ */
|
|
1584
|
-
title:
|
|
1800
|
+
icon: /* @__PURE__ */ React21.createElement(VariableIcon, { fontSize: SIZE6 }),
|
|
1801
|
+
title: __16("Restore variable", "elementor"),
|
|
1585
1802
|
onClose
|
|
1586
1803
|
}
|
|
1587
|
-
), /* @__PURE__ */
|
|
1804
|
+
), /* @__PURE__ */ React21.createElement(Divider5, null), /* @__PURE__ */ React21.createElement(PopoverContent3, { p: 2 }, /* @__PURE__ */ React21.createElement(
|
|
1588
1805
|
LabelField,
|
|
1589
1806
|
{
|
|
1590
1807
|
value: label,
|
|
@@ -1594,7 +1811,7 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
1594
1811
|
setErrorMessage("");
|
|
1595
1812
|
}
|
|
1596
1813
|
}
|
|
1597
|
-
), /* @__PURE__ */
|
|
1814
|
+
), /* @__PURE__ */ React21.createElement(FormField, { errorMsg: valueFieldError, label: __16("Value", "elementor") }, /* @__PURE__ */ React21.createElement(
|
|
1598
1815
|
ValueField,
|
|
1599
1816
|
{
|
|
1600
1817
|
value,
|
|
@@ -1605,32 +1822,32 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
1605
1822
|
},
|
|
1606
1823
|
onValidationChange: setValueFieldError
|
|
1607
1824
|
}
|
|
1608
|
-
)), errorMessage && /* @__PURE__ */
|
|
1825
|
+
)), errorMessage && /* @__PURE__ */ React21.createElement(FormHelperText4, { error: true }, errorMessage)), /* @__PURE__ */ React21.createElement(CardActions3, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React21.createElement(Button7, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleRestore }, __16("Restore", "elementor")))));
|
|
1609
1826
|
};
|
|
1610
1827
|
|
|
1611
1828
|
// src/components/ui/deleted-variable-alert.tsx
|
|
1612
|
-
import * as
|
|
1829
|
+
import * as React22 from "react";
|
|
1613
1830
|
import { useSectionWidth } from "@elementor/editor-editing-panel";
|
|
1614
1831
|
import { Alert as Alert2, AlertAction, AlertTitle, ClickAwayListener } from "@elementor/ui";
|
|
1615
|
-
import { __ as
|
|
1832
|
+
import { __ as __17 } from "@wordpress/i18n";
|
|
1616
1833
|
var DeletedVariableAlert = ({ onClose, onUnlink, onRestore, label }) => {
|
|
1617
1834
|
const sectionWidth = useSectionWidth();
|
|
1618
|
-
return /* @__PURE__ */
|
|
1835
|
+
return /* @__PURE__ */ React22.createElement(ClickAwayListener, { onClickAway: onClose }, /* @__PURE__ */ React22.createElement(
|
|
1619
1836
|
Alert2,
|
|
1620
1837
|
{
|
|
1621
1838
|
variant: "standard",
|
|
1622
1839
|
severity: "warning",
|
|
1623
1840
|
onClose,
|
|
1624
|
-
action: /* @__PURE__ */
|
|
1841
|
+
action: /* @__PURE__ */ React22.createElement(React22.Fragment, null, onUnlink && /* @__PURE__ */ React22.createElement(AlertAction, { variant: "contained", onClick: onUnlink }, __17("Unlink", "elementor")), onRestore && /* @__PURE__ */ React22.createElement(AlertAction, { variant: "outlined", onClick: onRestore }, __17("Restore", "elementor"))),
|
|
1625
1842
|
sx: { width: sectionWidth }
|
|
1626
1843
|
},
|
|
1627
|
-
/* @__PURE__ */
|
|
1628
|
-
|
|
1844
|
+
/* @__PURE__ */ React22.createElement(AlertTitle, null, __17("Deleted variable", "elementor")),
|
|
1845
|
+
__17("The variable", "elementor"),
|
|
1629
1846
|
" '",
|
|
1630
1847
|
label,
|
|
1631
1848
|
"'",
|
|
1632
1849
|
" ",
|
|
1633
|
-
|
|
1850
|
+
__17(
|
|
1634
1851
|
"has been deleted, but it is still referenced in this location. You may restore the variable or unlink it to assign a different value.",
|
|
1635
1852
|
"elementor"
|
|
1636
1853
|
)
|
|
@@ -1638,12 +1855,12 @@ var DeletedVariableAlert = ({ onClose, onUnlink, onRestore, label }) => {
|
|
|
1638
1855
|
};
|
|
1639
1856
|
|
|
1640
1857
|
// src/components/ui/tags/deleted-tag.tsx
|
|
1641
|
-
import * as
|
|
1858
|
+
import * as React23 from "react";
|
|
1642
1859
|
import { AlertTriangleFilledIcon as AlertTriangleFilledIcon2 } from "@elementor/icons";
|
|
1643
1860
|
import { Box as Box6, Chip, Tooltip as Tooltip2, Typography as Typography8 } from "@elementor/ui";
|
|
1644
|
-
import { __ as
|
|
1645
|
-
var DeletedTag =
|
|
1646
|
-
return /* @__PURE__ */
|
|
1861
|
+
import { __ as __18 } from "@wordpress/i18n";
|
|
1862
|
+
var DeletedTag = React23.forwardRef(({ label, onClick, ...props }, ref) => {
|
|
1863
|
+
return /* @__PURE__ */ React23.createElement(
|
|
1647
1864
|
Chip,
|
|
1648
1865
|
{
|
|
1649
1866
|
ref,
|
|
@@ -1652,8 +1869,8 @@ var DeletedTag = React20.forwardRef(({ label, onClick, ...props }, ref) => {
|
|
|
1652
1869
|
shape: "rounded",
|
|
1653
1870
|
variant: "standard",
|
|
1654
1871
|
onClick,
|
|
1655
|
-
icon: /* @__PURE__ */
|
|
1656
|
-
label: /* @__PURE__ */
|
|
1872
|
+
icon: /* @__PURE__ */ React23.createElement(AlertTriangleFilledIcon2, null),
|
|
1873
|
+
label: /* @__PURE__ */ React23.createElement(Tooltip2, { title: label, placement: "top" }, /* @__PURE__ */ React23.createElement(Box6, { sx: { display: "flex", gap: 0.5, alignItems: "center" } }, /* @__PURE__ */ React23.createElement(Typography8, { variant: "caption", noWrap: true }, label), /* @__PURE__ */ React23.createElement(Typography8, { variant: "caption", noWrap: true, sx: { textOverflow: "initial", overflow: "visible" } }, "(", __18("deleted", "elementor"), ")"))),
|
|
1657
1874
|
sx: {
|
|
1658
1875
|
height: (theme) => theme.spacing(3.5),
|
|
1659
1876
|
borderRadius: (theme) => theme.spacing(1),
|
|
@@ -1670,12 +1887,12 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
1670
1887
|
const { propTypeUtil } = getVariableType(propTypeKey);
|
|
1671
1888
|
const { setValue } = useBoundProp8();
|
|
1672
1889
|
const userPermissions = usePermissions();
|
|
1673
|
-
const [showInfotip, setShowInfotip] =
|
|
1890
|
+
const [showInfotip, setShowInfotip] = useState10(false);
|
|
1674
1891
|
const toggleInfotip = () => setShowInfotip((prev) => !prev);
|
|
1675
1892
|
const closeInfotip = () => setShowInfotip(false);
|
|
1676
1893
|
const deletedChipAnchorRef = useRef2(null);
|
|
1677
1894
|
const popupId = useId3();
|
|
1678
|
-
const popupState =
|
|
1895
|
+
const popupState = usePopupState3({
|
|
1679
1896
|
variant: "popover",
|
|
1680
1897
|
popupId: `elementor-variables-restore-${popupId}`
|
|
1681
1898
|
});
|
|
@@ -1701,7 +1918,7 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
1701
1918
|
const handleRestoreWithOverrides = () => {
|
|
1702
1919
|
popupState.close();
|
|
1703
1920
|
};
|
|
1704
|
-
return /* @__PURE__ */
|
|
1921
|
+
return /* @__PURE__ */ React24.createElement(React24.Fragment, null, /* @__PURE__ */ React24.createElement(Box7, { ref: deletedChipAnchorRef }, showInfotip && /* @__PURE__ */ React24.createElement(Backdrop, { open: true, onClick: closeInfotip, invisible: true }), /* @__PURE__ */ React24.createElement(
|
|
1705
1922
|
Infotip,
|
|
1706
1923
|
{
|
|
1707
1924
|
color: "warning",
|
|
@@ -1709,7 +1926,7 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
1709
1926
|
open: showInfotip,
|
|
1710
1927
|
disableHoverListener: true,
|
|
1711
1928
|
onClose: closeInfotip,
|
|
1712
|
-
content: /* @__PURE__ */
|
|
1929
|
+
content: /* @__PURE__ */ React24.createElement(
|
|
1713
1930
|
DeletedVariableAlert,
|
|
1714
1931
|
{
|
|
1715
1932
|
onClose: closeInfotip,
|
|
@@ -1729,8 +1946,8 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
1729
1946
|
}
|
|
1730
1947
|
}
|
|
1731
1948
|
},
|
|
1732
|
-
/* @__PURE__ */
|
|
1733
|
-
), /* @__PURE__ */
|
|
1949
|
+
/* @__PURE__ */ React24.createElement(DeletedTag, { label: variable.label, onClick: toggleInfotip })
|
|
1950
|
+
), /* @__PURE__ */ React24.createElement(
|
|
1734
1951
|
Popover2,
|
|
1735
1952
|
{
|
|
1736
1953
|
disableScrollLock: true,
|
|
@@ -1741,7 +1958,7 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
1741
1958
|
},
|
|
1742
1959
|
...bindPopover2(popupState)
|
|
1743
1960
|
},
|
|
1744
|
-
/* @__PURE__ */
|
|
1961
|
+
/* @__PURE__ */ React24.createElement(VariableTypeProvider, { propTypeKey }, /* @__PURE__ */ React24.createElement(
|
|
1745
1962
|
VariableRestore,
|
|
1746
1963
|
{
|
|
1747
1964
|
variableId: variable.key ?? "",
|
|
@@ -1753,30 +1970,30 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
1753
1970
|
};
|
|
1754
1971
|
|
|
1755
1972
|
// src/components/ui/variable/missing-variable.tsx
|
|
1756
|
-
import * as
|
|
1757
|
-
import { useState as
|
|
1973
|
+
import * as React27 from "react";
|
|
1974
|
+
import { useState as useState11 } from "react";
|
|
1758
1975
|
import { useBoundProp as useBoundProp9 } from "@elementor/editor-controls";
|
|
1759
1976
|
import { Backdrop as Backdrop2, Infotip as Infotip2 } from "@elementor/ui";
|
|
1760
|
-
import { __ as
|
|
1977
|
+
import { __ as __20 } from "@wordpress/i18n";
|
|
1761
1978
|
|
|
1762
1979
|
// src/components/ui/missing-variable-alert.tsx
|
|
1763
|
-
import * as
|
|
1980
|
+
import * as React25 from "react";
|
|
1764
1981
|
import { useSectionWidth as useSectionWidth2 } from "@elementor/editor-editing-panel";
|
|
1765
1982
|
import { Alert as Alert3, AlertAction as AlertAction2, AlertTitle as AlertTitle2, ClickAwayListener as ClickAwayListener2 } from "@elementor/ui";
|
|
1766
|
-
import { __ as
|
|
1983
|
+
import { __ as __19 } from "@wordpress/i18n";
|
|
1767
1984
|
var MissingVariableAlert = ({ onClose, onClear }) => {
|
|
1768
1985
|
const sectionWidth = useSectionWidth2();
|
|
1769
|
-
return /* @__PURE__ */
|
|
1986
|
+
return /* @__PURE__ */ React25.createElement(ClickAwayListener2, { onClickAway: onClose }, /* @__PURE__ */ React25.createElement(
|
|
1770
1987
|
Alert3,
|
|
1771
1988
|
{
|
|
1772
1989
|
variant: "standard",
|
|
1773
1990
|
severity: "warning",
|
|
1774
1991
|
onClose,
|
|
1775
|
-
action: /* @__PURE__ */
|
|
1992
|
+
action: /* @__PURE__ */ React25.createElement(React25.Fragment, null, onClear && /* @__PURE__ */ React25.createElement(AlertAction2, { variant: "contained", onClick: onClear }, __19("Clear", "elementor"))),
|
|
1776
1993
|
sx: { width: sectionWidth }
|
|
1777
1994
|
},
|
|
1778
|
-
/* @__PURE__ */
|
|
1779
|
-
|
|
1995
|
+
/* @__PURE__ */ React25.createElement(AlertTitle2, null, __19("This variable is missing", "elementor")),
|
|
1996
|
+
__19(
|
|
1780
1997
|
"It may have been deleted. Try clearing this field and select a different value or variable.",
|
|
1781
1998
|
"elementor"
|
|
1782
1999
|
)
|
|
@@ -1784,11 +2001,11 @@ var MissingVariableAlert = ({ onClose, onClear }) => {
|
|
|
1784
2001
|
};
|
|
1785
2002
|
|
|
1786
2003
|
// src/components/ui/tags/missing-tag.tsx
|
|
1787
|
-
import * as
|
|
2004
|
+
import * as React26 from "react";
|
|
1788
2005
|
import { AlertTriangleFilledIcon as AlertTriangleFilledIcon3 } from "@elementor/icons";
|
|
1789
2006
|
import { Chip as Chip2 } from "@elementor/ui";
|
|
1790
|
-
var MissingTag =
|
|
1791
|
-
return /* @__PURE__ */
|
|
2007
|
+
var MissingTag = React26.forwardRef(({ label, onClick, ...props }, ref) => {
|
|
2008
|
+
return /* @__PURE__ */ React26.createElement(
|
|
1792
2009
|
Chip2,
|
|
1793
2010
|
{
|
|
1794
2011
|
ref,
|
|
@@ -1797,7 +2014,7 @@ var MissingTag = React23.forwardRef(({ label, onClick, ...props }, ref) => {
|
|
|
1797
2014
|
shape: "rounded",
|
|
1798
2015
|
variant: "standard",
|
|
1799
2016
|
onClick,
|
|
1800
|
-
icon: /* @__PURE__ */
|
|
2017
|
+
icon: /* @__PURE__ */ React26.createElement(AlertTriangleFilledIcon3, null),
|
|
1801
2018
|
label,
|
|
1802
2019
|
sx: {
|
|
1803
2020
|
height: (theme) => theme.spacing(3.5),
|
|
@@ -1813,11 +2030,11 @@ var MissingTag = React23.forwardRef(({ label, onClick, ...props }, ref) => {
|
|
|
1813
2030
|
// src/components/ui/variable/missing-variable.tsx
|
|
1814
2031
|
var MissingVariable = () => {
|
|
1815
2032
|
const { setValue } = useBoundProp9();
|
|
1816
|
-
const [infotipVisible, setInfotipVisible] =
|
|
2033
|
+
const [infotipVisible, setInfotipVisible] = useState11(false);
|
|
1817
2034
|
const toggleInfotip = () => setInfotipVisible((prev) => !prev);
|
|
1818
2035
|
const closeInfotip = () => setInfotipVisible(false);
|
|
1819
2036
|
const clearValue = () => setValue(null);
|
|
1820
|
-
return /* @__PURE__ */
|
|
2037
|
+
return /* @__PURE__ */ React27.createElement(React27.Fragment, null, infotipVisible && /* @__PURE__ */ React27.createElement(Backdrop2, { open: true, onClick: closeInfotip, invisible: true }), /* @__PURE__ */ React27.createElement(
|
|
1821
2038
|
Infotip2,
|
|
1822
2039
|
{
|
|
1823
2040
|
color: "warning",
|
|
@@ -1825,7 +2042,7 @@ var MissingVariable = () => {
|
|
|
1825
2042
|
open: infotipVisible,
|
|
1826
2043
|
disableHoverListener: true,
|
|
1827
2044
|
onClose: closeInfotip,
|
|
1828
|
-
content: /* @__PURE__ */
|
|
2045
|
+
content: /* @__PURE__ */ React27.createElement(MissingVariableAlert, { onClose: closeInfotip, onClear: clearValue }),
|
|
1829
2046
|
slotProps: {
|
|
1830
2047
|
popper: {
|
|
1831
2048
|
modifiers: [
|
|
@@ -1837,7 +2054,7 @@ var MissingVariable = () => {
|
|
|
1837
2054
|
}
|
|
1838
2055
|
}
|
|
1839
2056
|
},
|
|
1840
|
-
/* @__PURE__ */
|
|
2057
|
+
/* @__PURE__ */ React27.createElement(MissingTag, { label: __20("Missing variable", "elementor"), onClick: toggleInfotip })
|
|
1841
2058
|
));
|
|
1842
2059
|
};
|
|
1843
2060
|
|
|
@@ -1846,33 +2063,33 @@ var VariableControl = () => {
|
|
|
1846
2063
|
const boundProp = useBoundProp10().value;
|
|
1847
2064
|
const assignedVariable = useVariable(boundProp?.value);
|
|
1848
2065
|
if (!assignedVariable) {
|
|
1849
|
-
return /* @__PURE__ */
|
|
2066
|
+
return /* @__PURE__ */ React28.createElement(MissingVariable, null);
|
|
1850
2067
|
}
|
|
1851
2068
|
const { $$type: propTypeKey } = boundProp;
|
|
1852
2069
|
if (assignedVariable?.deleted) {
|
|
1853
|
-
return /* @__PURE__ */
|
|
2070
|
+
return /* @__PURE__ */ React28.createElement(DeletedVariable, { variable: assignedVariable, propTypeKey });
|
|
1854
2071
|
}
|
|
1855
|
-
return /* @__PURE__ */
|
|
2072
|
+
return /* @__PURE__ */ React28.createElement(AssignedVariable, { variable: assignedVariable, propTypeKey });
|
|
1856
2073
|
};
|
|
1857
2074
|
|
|
1858
2075
|
// src/hooks/use-prop-variable-action.tsx
|
|
1859
|
-
import * as
|
|
2076
|
+
import * as React29 from "react";
|
|
1860
2077
|
import { useBoundProp as useBoundProp11 } from "@elementor/editor-editing-panel";
|
|
1861
|
-
import { ColorFilterIcon as
|
|
1862
|
-
import { __ as
|
|
2078
|
+
import { ColorFilterIcon as ColorFilterIcon4 } from "@elementor/icons";
|
|
2079
|
+
import { __ as __21 } from "@wordpress/i18n";
|
|
1863
2080
|
var usePropVariableAction = () => {
|
|
1864
2081
|
const { propType, path } = useBoundProp11();
|
|
1865
2082
|
const variable = resolveVariableFromPropType(propType);
|
|
1866
2083
|
return {
|
|
1867
2084
|
visible: Boolean(variable),
|
|
1868
|
-
icon:
|
|
1869
|
-
title:
|
|
2085
|
+
icon: ColorFilterIcon4,
|
|
2086
|
+
title: __21("Variables", "elementor"),
|
|
1870
2087
|
content: ({ close: closePopover }) => {
|
|
1871
2088
|
if (!variable) {
|
|
1872
2089
|
return null;
|
|
1873
2090
|
}
|
|
1874
2091
|
trackOpenVariablePopover(path, variable.variableType);
|
|
1875
|
-
return /* @__PURE__ */
|
|
2092
|
+
return /* @__PURE__ */ React29.createElement(VariableSelectionPopover, { closePopover, propTypeKey: variable.propTypeUtil.key });
|
|
1876
2093
|
}
|
|
1877
2094
|
};
|
|
1878
2095
|
};
|
|
@@ -1897,17 +2114,17 @@ var trackOpenVariablePopover = (path, variableType) => {
|
|
|
1897
2114
|
};
|
|
1898
2115
|
|
|
1899
2116
|
// src/register-variable-types.tsx
|
|
1900
|
-
import * as
|
|
2117
|
+
import * as React32 from "react";
|
|
1901
2118
|
import { colorPropTypeUtil, stringPropTypeUtil } from "@elementor/editor-props";
|
|
1902
2119
|
import { BrushIcon, TextIcon as TextIcon2 } from "@elementor/icons";
|
|
1903
2120
|
|
|
1904
2121
|
// src/components/fields/color-field.tsx
|
|
1905
|
-
import * as
|
|
1906
|
-
import { useRef as useRef3, useState as
|
|
2122
|
+
import * as React30 from "react";
|
|
2123
|
+
import { useRef as useRef3, useState as useState12 } from "react";
|
|
1907
2124
|
import { UnstableColorField } from "@elementor/ui";
|
|
1908
2125
|
var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
1909
|
-
const [color, setColor] =
|
|
1910
|
-
const [errorMessage, setErrorMessage] =
|
|
2126
|
+
const [color, setColor] = useState12(value);
|
|
2127
|
+
const [errorMessage, setErrorMessage] = useState12("");
|
|
1911
2128
|
const defaultRef = useRef3(null);
|
|
1912
2129
|
const anchorRef = usePopoverContentRef() ?? defaultRef.current;
|
|
1913
2130
|
const handleChange = (newValue) => {
|
|
@@ -1917,7 +2134,7 @@ var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
|
1917
2134
|
onValidationChange?.(errorMsg);
|
|
1918
2135
|
onChange(errorMsg ? "" : newValue);
|
|
1919
2136
|
};
|
|
1920
|
-
return /* @__PURE__ */
|
|
2137
|
+
return /* @__PURE__ */ React30.createElement(
|
|
1921
2138
|
UnstableColorField,
|
|
1922
2139
|
{
|
|
1923
2140
|
size: "tiny",
|
|
@@ -1937,21 +2154,21 @@ var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
|
1937
2154
|
};
|
|
1938
2155
|
|
|
1939
2156
|
// src/components/fields/font-field.tsx
|
|
1940
|
-
import * as
|
|
1941
|
-
import { useId as useId4, useRef as useRef4, useState as
|
|
2157
|
+
import * as React31 from "react";
|
|
2158
|
+
import { useId as useId4, useRef as useRef4, useState as useState13 } from "react";
|
|
1942
2159
|
import { enqueueFont as enqueueFont2, ItemSelector } from "@elementor/editor-controls";
|
|
1943
2160
|
import { useFontFamilies, useSectionWidth as useSectionWidth3 } from "@elementor/editor-editing-panel";
|
|
1944
2161
|
import { ChevronDownIcon, TextIcon } from "@elementor/icons";
|
|
1945
|
-
import { bindPopover as bindPopover3, bindTrigger as
|
|
1946
|
-
import { __ as
|
|
2162
|
+
import { bindPopover as bindPopover3, bindTrigger as bindTrigger3, Popover as Popover3, UnstableTag, usePopupState as usePopupState4 } from "@elementor/ui";
|
|
2163
|
+
import { __ as __22 } from "@wordpress/i18n";
|
|
1947
2164
|
var FontField = ({ value, onChange, onValidationChange }) => {
|
|
1948
|
-
const [fontFamily, setFontFamily] =
|
|
2165
|
+
const [fontFamily, setFontFamily] = useState13(value);
|
|
1949
2166
|
const defaultRef = useRef4(null);
|
|
1950
2167
|
const anchorRef = usePopoverContentRef() ?? defaultRef.current;
|
|
1951
|
-
const fontPopoverState =
|
|
2168
|
+
const fontPopoverState = usePopupState4({ variant: "popover" });
|
|
1952
2169
|
const fontFamilies = useFontFamilies();
|
|
1953
2170
|
const sectionWidth = useSectionWidth3();
|
|
1954
|
-
const mapFontSubs =
|
|
2171
|
+
const mapFontSubs = React31.useMemo(() => {
|
|
1955
2172
|
return fontFamilies.map(({ label, fonts }) => ({
|
|
1956
2173
|
label,
|
|
1957
2174
|
items: fonts
|
|
@@ -1968,17 +2185,17 @@ var FontField = ({ value, onChange, onValidationChange }) => {
|
|
|
1968
2185
|
fontPopoverState.close();
|
|
1969
2186
|
};
|
|
1970
2187
|
const id2 = useId4();
|
|
1971
|
-
return /* @__PURE__ */
|
|
2188
|
+
return /* @__PURE__ */ React31.createElement(React31.Fragment, null, /* @__PURE__ */ React31.createElement(
|
|
1972
2189
|
UnstableTag,
|
|
1973
2190
|
{
|
|
1974
2191
|
id: id2,
|
|
1975
2192
|
variant: "outlined",
|
|
1976
2193
|
label: fontFamily,
|
|
1977
|
-
endIcon: /* @__PURE__ */
|
|
1978
|
-
...
|
|
2194
|
+
endIcon: /* @__PURE__ */ React31.createElement(ChevronDownIcon, { fontSize: "tiny" }),
|
|
2195
|
+
...bindTrigger3(fontPopoverState),
|
|
1979
2196
|
fullWidth: true
|
|
1980
2197
|
}
|
|
1981
|
-
), /* @__PURE__ */
|
|
2198
|
+
), /* @__PURE__ */ React31.createElement(
|
|
1982
2199
|
Popover3,
|
|
1983
2200
|
{
|
|
1984
2201
|
disablePortal: true,
|
|
@@ -1988,7 +2205,7 @@ var FontField = ({ value, onChange, onValidationChange }) => {
|
|
|
1988
2205
|
transformOrigin: { vertical: "top", horizontal: -28 },
|
|
1989
2206
|
...bindPopover3(fontPopoverState)
|
|
1990
2207
|
},
|
|
1991
|
-
/* @__PURE__ */
|
|
2208
|
+
/* @__PURE__ */ React31.createElement(
|
|
1992
2209
|
ItemSelector,
|
|
1993
2210
|
{
|
|
1994
2211
|
itemsList: mapFontSubs,
|
|
@@ -1996,7 +2213,7 @@ var FontField = ({ value, onChange, onValidationChange }) => {
|
|
|
1996
2213
|
onItemChange: handleFontFamilyChange,
|
|
1997
2214
|
onClose: fontPopoverState.close,
|
|
1998
2215
|
sectionWidth,
|
|
1999
|
-
title:
|
|
2216
|
+
title: __22("Font Family", "elementor"),
|
|
2000
2217
|
itemStyle: (item) => ({ fontFamily: item.value }),
|
|
2001
2218
|
onDebounce: enqueueFont2,
|
|
2002
2219
|
icon: TextIcon
|
|
@@ -2013,7 +2230,7 @@ function registerVariableTypes() {
|
|
|
2013
2230
|
propTypeUtil: colorVariablePropTypeUtil,
|
|
2014
2231
|
fallbackPropTypeUtil: colorPropTypeUtil,
|
|
2015
2232
|
variableType: "color",
|
|
2016
|
-
startIcon: ({ value }) => /* @__PURE__ */
|
|
2233
|
+
startIcon: ({ value }) => /* @__PURE__ */ React32.createElement(ColorIndicator, { size: "inherit", component: "span", value })
|
|
2017
2234
|
});
|
|
2018
2235
|
registerVariableType({
|
|
2019
2236
|
valueField: FontField,
|
|
@@ -2025,8 +2242,8 @@ function registerVariableTypes() {
|
|
|
2025
2242
|
}
|
|
2026
2243
|
|
|
2027
2244
|
// src/renderers/style-variables-renderer.tsx
|
|
2028
|
-
import * as
|
|
2029
|
-
import { useEffect as useEffect3, useState as
|
|
2245
|
+
import * as React33 from "react";
|
|
2246
|
+
import { useEffect as useEffect3, useState as useState14 } from "react";
|
|
2030
2247
|
import { __privateUseListenTo as useListenTo, commandEndEvent } from "@elementor/editor-v1-adapters";
|
|
2031
2248
|
import { Portal } from "@elementor/ui";
|
|
2032
2249
|
|
|
@@ -2047,13 +2264,13 @@ function StyleVariablesRenderer() {
|
|
|
2047
2264
|
}
|
|
2048
2265
|
const cssVariables = convertToCssVariables(styleVariables);
|
|
2049
2266
|
const wrappedCss = `${VARIABLES_WRAPPER}{${cssVariables}}`;
|
|
2050
|
-
return /* @__PURE__ */
|
|
2267
|
+
return /* @__PURE__ */ React33.createElement(Portal, { container }, /* @__PURE__ */ React33.createElement("style", { "data-e-style-id": "e-variables", key: wrappedCss }, wrappedCss));
|
|
2051
2268
|
}
|
|
2052
2269
|
function usePortalContainer() {
|
|
2053
2270
|
return useListenTo(commandEndEvent("editor/documents/attach-preview"), () => getCanvasIframeDocument()?.head);
|
|
2054
2271
|
}
|
|
2055
2272
|
function useStyleVariables() {
|
|
2056
|
-
const [variables, setVariables] =
|
|
2273
|
+
const [variables, setVariables] = useState14({});
|
|
2057
2274
|
useEffect3(() => {
|
|
2058
2275
|
const unsubscribe = styleVariablesRepository.subscribe(setVariables);
|
|
2059
2276
|
return () => {
|
|
@@ -2077,22 +2294,22 @@ import { injectIntoRepeaterItemIcon, injectIntoRepeaterItemLabel } from "@elemen
|
|
|
2077
2294
|
import { backgroundColorOverlayPropTypeUtil, shadowPropTypeUtil } from "@elementor/editor-props";
|
|
2078
2295
|
|
|
2079
2296
|
// src/components/variables-repeater-item-slot.tsx
|
|
2080
|
-
import * as
|
|
2297
|
+
import * as React34 from "react";
|
|
2081
2298
|
var useColorVariable = (value) => {
|
|
2082
2299
|
const variableId = value?.value?.color?.value;
|
|
2083
2300
|
return useVariable(variableId || "");
|
|
2084
2301
|
};
|
|
2085
2302
|
var BackgroundRepeaterColorIndicator = ({ value }) => {
|
|
2086
2303
|
const colorVariable = useColorVariable(value);
|
|
2087
|
-
return /* @__PURE__ */
|
|
2304
|
+
return /* @__PURE__ */ React34.createElement(ColorIndicator, { component: "span", size: "inherit", value: colorVariable?.value });
|
|
2088
2305
|
};
|
|
2089
2306
|
var BackgroundRepeaterLabel = ({ value }) => {
|
|
2090
2307
|
const colorVariable = useColorVariable(value);
|
|
2091
|
-
return /* @__PURE__ */
|
|
2308
|
+
return /* @__PURE__ */ React34.createElement("span", null, colorVariable?.label);
|
|
2092
2309
|
};
|
|
2093
2310
|
var BoxShadowRepeaterColorIndicator = ({ value }) => {
|
|
2094
2311
|
const colorVariable = useColorVariable(value);
|
|
2095
|
-
return /* @__PURE__ */
|
|
2312
|
+
return /* @__PURE__ */ React34.createElement(ColorIndicator, { component: "span", size: "inherit", value: colorVariable?.value });
|
|
2096
2313
|
};
|
|
2097
2314
|
|
|
2098
2315
|
// src/repeater-injections.ts
|