@elementor/editor-controls 3.35.0-327 → 3.35.0-328
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 +195 -76
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +184 -64
- package/dist/index.mjs.map +1 -1
- package/package.json +16 -15
- package/src/components/inline-editor-toolbar.tsx +61 -3
- package/src/components/inline-editor.tsx +7 -0
- package/src/components/url-popover.tsx +73 -0
package/dist/index.mjs
CHANGED
|
@@ -5914,17 +5914,18 @@ var DateTimeControl = createControl(({ inputDisabled }) => {
|
|
|
5914
5914
|
});
|
|
5915
5915
|
|
|
5916
5916
|
// src/controls/inline-editing-control.tsx
|
|
5917
|
-
import * as
|
|
5917
|
+
import * as React102 from "react";
|
|
5918
5918
|
import { htmlPropTypeUtil } from "@elementor/editor-props";
|
|
5919
5919
|
|
|
5920
5920
|
// src/components/inline-editor.tsx
|
|
5921
|
-
import * as
|
|
5922
|
-
import { useEffect as
|
|
5921
|
+
import * as React101 from "react";
|
|
5922
|
+
import { useEffect as useEffect10, useRef as useRef26 } from "react";
|
|
5923
5923
|
import { Box as Box22 } from "@elementor/ui";
|
|
5924
5924
|
import Bold from "@tiptap/extension-bold";
|
|
5925
5925
|
import Document from "@tiptap/extension-document";
|
|
5926
5926
|
import HardBreak from "@tiptap/extension-hard-break";
|
|
5927
5927
|
import Italic from "@tiptap/extension-italic";
|
|
5928
|
+
import Link3 from "@tiptap/extension-link";
|
|
5928
5929
|
import Strike from "@tiptap/extension-strike";
|
|
5929
5930
|
import Subscript from "@tiptap/extension-subscript";
|
|
5930
5931
|
import Superscript from "@tiptap/extension-superscript";
|
|
@@ -5933,89 +5934,189 @@ import Underline from "@tiptap/extension-underline";
|
|
|
5933
5934
|
import { EditorContent, useEditor } from "@tiptap/react";
|
|
5934
5935
|
|
|
5935
5936
|
// src/components/inline-editor-toolbar.tsx
|
|
5936
|
-
import * as
|
|
5937
|
-
import { useMemo as useMemo12 } from "react";
|
|
5937
|
+
import * as React100 from "react";
|
|
5938
|
+
import { useMemo as useMemo12, useRef as useRef25, useState as useState16 } from "react";
|
|
5938
5939
|
import {
|
|
5939
5940
|
BoldIcon,
|
|
5940
5941
|
ItalicIcon,
|
|
5942
|
+
LinkIcon as LinkIcon3,
|
|
5941
5943
|
MinusIcon as MinusIcon2,
|
|
5942
5944
|
StrikethroughIcon,
|
|
5943
5945
|
SubscriptIcon,
|
|
5944
5946
|
SuperscriptIcon,
|
|
5945
5947
|
UnderlineIcon
|
|
5946
5948
|
} from "@elementor/icons";
|
|
5947
|
-
import { Box as Box21, IconButton as IconButton8, ToggleButton as
|
|
5949
|
+
import { Box as Box21, IconButton as IconButton8, ToggleButton as ToggleButton5, ToggleButtonGroup as ToggleButtonGroup2, Tooltip as Tooltip9, usePopupState as usePopupState8 } from "@elementor/ui";
|
|
5948
5950
|
import { useEditorState } from "@tiptap/react";
|
|
5951
|
+
import { __ as __51 } from "@wordpress/i18n";
|
|
5952
|
+
|
|
5953
|
+
// src/components/url-popover.tsx
|
|
5954
|
+
import * as React99 from "react";
|
|
5955
|
+
import { useEffect as useEffect9, useRef as useRef24 } from "react";
|
|
5956
|
+
import { ExternalLinkIcon } from "@elementor/icons";
|
|
5957
|
+
import { bindPopover as bindPopover7, Popover as Popover7, Stack as Stack16, TextField as TextField8, ToggleButton as ToggleButton4 } from "@elementor/ui";
|
|
5949
5958
|
import { __ as __50 } from "@wordpress/i18n";
|
|
5959
|
+
var UrlPopover = ({
|
|
5960
|
+
popupState,
|
|
5961
|
+
restoreValue,
|
|
5962
|
+
anchorRef,
|
|
5963
|
+
value,
|
|
5964
|
+
onChange,
|
|
5965
|
+
openInNewTab,
|
|
5966
|
+
onToggleNewTab
|
|
5967
|
+
}) => {
|
|
5968
|
+
const inputRef = useRef24(null);
|
|
5969
|
+
useEffect9(() => {
|
|
5970
|
+
if (popupState.isOpen) {
|
|
5971
|
+
requestAnimationFrame(() => inputRef.current?.focus());
|
|
5972
|
+
}
|
|
5973
|
+
}, [popupState.isOpen]);
|
|
5974
|
+
const handleClose = () => {
|
|
5975
|
+
restoreValue();
|
|
5976
|
+
popupState.close();
|
|
5977
|
+
};
|
|
5978
|
+
return /* @__PURE__ */ React99.createElement(
|
|
5979
|
+
Popover7,
|
|
5980
|
+
{
|
|
5981
|
+
slotProps: {
|
|
5982
|
+
paper: { sx: { borderRadius: "16px", width: anchorRef.current?.offsetWidth + "px", marginTop: -1 } }
|
|
5983
|
+
},
|
|
5984
|
+
...bindPopover7(popupState),
|
|
5985
|
+
anchorOrigin: { vertical: "top", horizontal: "left" },
|
|
5986
|
+
transformOrigin: { vertical: "top", horizontal: "left" },
|
|
5987
|
+
onClose: handleClose
|
|
5988
|
+
},
|
|
5989
|
+
/* @__PURE__ */ React99.createElement(Stack16, { direction: "row", alignItems: "center", gap: 1, sx: { p: 1.5 } }, /* @__PURE__ */ React99.createElement(
|
|
5990
|
+
TextField8,
|
|
5991
|
+
{
|
|
5992
|
+
value,
|
|
5993
|
+
onChange,
|
|
5994
|
+
size: "tiny",
|
|
5995
|
+
fullWidth: true,
|
|
5996
|
+
placeholder: __50("Type a URL", "elementor"),
|
|
5997
|
+
inputProps: { ref: inputRef },
|
|
5998
|
+
color: "secondary",
|
|
5999
|
+
InputProps: { sx: { borderRadius: "8px" } }
|
|
6000
|
+
}
|
|
6001
|
+
), /* @__PURE__ */ React99.createElement(
|
|
6002
|
+
ToggleButton4,
|
|
6003
|
+
{
|
|
6004
|
+
size: "tiny",
|
|
6005
|
+
value: "newTab",
|
|
6006
|
+
selected: openInNewTab,
|
|
6007
|
+
onClick: onToggleNewTab,
|
|
6008
|
+
"aria-label": __50("Open in a new tab", "elementor"),
|
|
6009
|
+
sx: { borderRadius: "8px" }
|
|
6010
|
+
},
|
|
6011
|
+
/* @__PURE__ */ React99.createElement(ExternalLinkIcon, { fontSize: "tiny" })
|
|
6012
|
+
))
|
|
6013
|
+
);
|
|
6014
|
+
};
|
|
6015
|
+
|
|
6016
|
+
// src/components/inline-editor-toolbar.tsx
|
|
5950
6017
|
var toolbarButtons = {
|
|
5951
6018
|
clear: {
|
|
5952
|
-
label:
|
|
5953
|
-
icon: /* @__PURE__ */
|
|
6019
|
+
label: __51("Clear", "elementor"),
|
|
6020
|
+
icon: /* @__PURE__ */ React100.createElement(MinusIcon2, { fontSize: "tiny" }),
|
|
5954
6021
|
action: "clear",
|
|
5955
6022
|
method: (editor) => {
|
|
5956
6023
|
editor.chain().focus().clearNodes().unsetAllMarks().run();
|
|
5957
6024
|
}
|
|
5958
6025
|
},
|
|
5959
6026
|
bold: {
|
|
5960
|
-
label:
|
|
5961
|
-
icon: /* @__PURE__ */
|
|
6027
|
+
label: __51("Bold", "elementor"),
|
|
6028
|
+
icon: /* @__PURE__ */ React100.createElement(BoldIcon, { fontSize: "tiny" }),
|
|
5962
6029
|
action: "bold",
|
|
5963
6030
|
method: (editor) => {
|
|
5964
6031
|
editor.chain().focus().toggleBold().run();
|
|
5965
6032
|
}
|
|
5966
6033
|
},
|
|
5967
6034
|
italic: {
|
|
5968
|
-
label:
|
|
5969
|
-
icon: /* @__PURE__ */
|
|
6035
|
+
label: __51("Italic", "elementor"),
|
|
6036
|
+
icon: /* @__PURE__ */ React100.createElement(ItalicIcon, { fontSize: "tiny" }),
|
|
5970
6037
|
action: "italic",
|
|
5971
6038
|
method: (editor) => {
|
|
5972
6039
|
editor.chain().focus().toggleItalic().run();
|
|
5973
6040
|
}
|
|
5974
6041
|
},
|
|
5975
6042
|
underline: {
|
|
5976
|
-
label:
|
|
5977
|
-
icon: /* @__PURE__ */
|
|
6043
|
+
label: __51("Underline", "elementor"),
|
|
6044
|
+
icon: /* @__PURE__ */ React100.createElement(UnderlineIcon, { fontSize: "tiny" }),
|
|
5978
6045
|
action: "underline",
|
|
5979
6046
|
method: (editor) => {
|
|
5980
6047
|
editor.chain().focus().toggleUnderline().run();
|
|
5981
6048
|
}
|
|
5982
6049
|
},
|
|
5983
6050
|
strike: {
|
|
5984
|
-
label:
|
|
5985
|
-
icon: /* @__PURE__ */
|
|
6051
|
+
label: __51("Strikethrough", "elementor"),
|
|
6052
|
+
icon: /* @__PURE__ */ React100.createElement(StrikethroughIcon, { fontSize: "tiny" }),
|
|
5986
6053
|
action: "strike",
|
|
5987
6054
|
method: (editor) => {
|
|
5988
6055
|
editor.chain().focus().toggleStrike().run();
|
|
5989
6056
|
}
|
|
5990
6057
|
},
|
|
5991
6058
|
superscript: {
|
|
5992
|
-
label:
|
|
5993
|
-
icon: /* @__PURE__ */
|
|
6059
|
+
label: __51("Superscript", "elementor"),
|
|
6060
|
+
icon: /* @__PURE__ */ React100.createElement(SuperscriptIcon, { fontSize: "tiny" }),
|
|
5994
6061
|
action: "superscript",
|
|
5995
6062
|
method: (editor) => {
|
|
5996
6063
|
editor.chain().focus().toggleSuperscript().run();
|
|
5997
6064
|
}
|
|
5998
6065
|
},
|
|
5999
6066
|
subscript: {
|
|
6000
|
-
label:
|
|
6001
|
-
icon: /* @__PURE__ */
|
|
6067
|
+
label: __51("Subscript", "elementor"),
|
|
6068
|
+
icon: /* @__PURE__ */ React100.createElement(SubscriptIcon, { fontSize: "tiny" }),
|
|
6002
6069
|
action: "subscript",
|
|
6003
6070
|
method: (editor) => {
|
|
6004
6071
|
editor.chain().focus().toggleSubscript().run();
|
|
6005
6072
|
}
|
|
6073
|
+
},
|
|
6074
|
+
link: {
|
|
6075
|
+
label: __51("Link", "elementor"),
|
|
6076
|
+
icon: /* @__PURE__ */ React100.createElement(LinkIcon3, { fontSize: "tiny" }),
|
|
6077
|
+
action: "link",
|
|
6078
|
+
method: null
|
|
6006
6079
|
}
|
|
6007
6080
|
};
|
|
6008
6081
|
var { clear: clearButton, ...formatButtons } = toolbarButtons;
|
|
6009
6082
|
var possibleFormats = Object.keys(formatButtons);
|
|
6010
6083
|
var InlineEditorToolbar = ({ editor }) => {
|
|
6084
|
+
const [urlValue, setUrlValue] = useState16("");
|
|
6085
|
+
const [openInNewTab, setOpenInNewTab] = useState16(false);
|
|
6086
|
+
const toolbarRef = useRef25(null);
|
|
6087
|
+
const popupState = usePopupState8({ variant: "popover" });
|
|
6011
6088
|
const editorState = useEditorState({
|
|
6012
6089
|
editor,
|
|
6013
6090
|
selector: (ctx) => possibleFormats.filter((format) => ctx.editor.isActive(format))
|
|
6014
6091
|
});
|
|
6015
6092
|
const formatButtonsList = useMemo12(() => Object.values(formatButtons), []);
|
|
6016
|
-
|
|
6093
|
+
const handleLinkClick = () => {
|
|
6094
|
+
const linkAttrs = editor.getAttributes("link");
|
|
6095
|
+
setUrlValue(linkAttrs.href || "");
|
|
6096
|
+
setOpenInNewTab(linkAttrs.target === "_blank");
|
|
6097
|
+
popupState.open(toolbarRef.current);
|
|
6098
|
+
};
|
|
6099
|
+
const handleUrlChange = (event) => {
|
|
6100
|
+
setUrlValue(event.target.value);
|
|
6101
|
+
};
|
|
6102
|
+
const handleToggleNewTab = () => {
|
|
6103
|
+
setOpenInNewTab(!openInNewTab);
|
|
6104
|
+
};
|
|
6105
|
+
const handleUrlSubmit = () => {
|
|
6106
|
+
if (urlValue) {
|
|
6107
|
+
editor.chain().focus().setLink({
|
|
6108
|
+
href: urlValue,
|
|
6109
|
+
target: openInNewTab ? "_blank" : "_self"
|
|
6110
|
+
}).run();
|
|
6111
|
+
} else {
|
|
6112
|
+
editor.chain().focus().unsetLink().run();
|
|
6113
|
+
}
|
|
6114
|
+
popupState.close();
|
|
6115
|
+
};
|
|
6116
|
+
return /* @__PURE__ */ React100.createElement(
|
|
6017
6117
|
Box21,
|
|
6018
6118
|
{
|
|
6119
|
+
ref: toolbarRef,
|
|
6019
6120
|
sx: {
|
|
6020
6121
|
position: "absolute",
|
|
6021
6122
|
top: -40,
|
|
@@ -6025,11 +6126,12 @@ var InlineEditorToolbar = ({ editor }) => {
|
|
|
6025
6126
|
borderRadius: 1,
|
|
6026
6127
|
backgroundColor: "background.paper",
|
|
6027
6128
|
boxShadow: "0 2px 8px rgba(0, 0, 0, 0.2)",
|
|
6028
|
-
alignItems: "center"
|
|
6129
|
+
alignItems: "center",
|
|
6130
|
+
visibility: popupState.isOpen ? "hidden" : "visible"
|
|
6029
6131
|
}
|
|
6030
6132
|
},
|
|
6031
|
-
/* @__PURE__ */
|
|
6032
|
-
/* @__PURE__ */
|
|
6133
|
+
/* @__PURE__ */ React100.createElement(Tooltip9, { title: clearButton.label, placement: "top" }, /* @__PURE__ */ React100.createElement(IconButton8, { "aria-label": clearButton.label, onClick: () => clearButton.method(editor), size: "tiny" }, clearButton.icon)),
|
|
6134
|
+
/* @__PURE__ */ React100.createElement(
|
|
6033
6135
|
ToggleButtonGroup2,
|
|
6034
6136
|
{
|
|
6035
6137
|
value: editorState,
|
|
@@ -6039,24 +6141,36 @@ var InlineEditorToolbar = ({ editor }) => {
|
|
|
6039
6141
|
gap: 0.5
|
|
6040
6142
|
}
|
|
6041
6143
|
},
|
|
6042
|
-
formatButtonsList.map((button) => /* @__PURE__ */
|
|
6043
|
-
|
|
6144
|
+
formatButtonsList.map((button) => /* @__PURE__ */ React100.createElement(Tooltip9, { title: button.label, key: button.action, placement: "top" }, /* @__PURE__ */ React100.createElement(
|
|
6145
|
+
ToggleButton5,
|
|
6044
6146
|
{
|
|
6045
6147
|
value: button.action,
|
|
6046
6148
|
"aria-label": button.label,
|
|
6047
6149
|
size: "tiny",
|
|
6048
|
-
onClick: () => button.method(editor)
|
|
6150
|
+
onClick: () => button.action === "link" ? handleLinkClick() : button.method?.(editor)
|
|
6049
6151
|
},
|
|
6050
6152
|
button.icon
|
|
6051
6153
|
)))
|
|
6154
|
+
),
|
|
6155
|
+
/* @__PURE__ */ React100.createElement(
|
|
6156
|
+
UrlPopover,
|
|
6157
|
+
{
|
|
6158
|
+
popupState,
|
|
6159
|
+
anchorRef: toolbarRef,
|
|
6160
|
+
restoreValue: handleUrlSubmit,
|
|
6161
|
+
value: urlValue,
|
|
6162
|
+
onChange: handleUrlChange,
|
|
6163
|
+
openInNewTab,
|
|
6164
|
+
onToggleNewTab: handleToggleNewTab
|
|
6165
|
+
}
|
|
6052
6166
|
)
|
|
6053
6167
|
);
|
|
6054
6168
|
};
|
|
6055
6169
|
|
|
6056
6170
|
// src/components/inline-editor.tsx
|
|
6057
6171
|
var useOnUpdate = (callback, dependencies) => {
|
|
6058
|
-
const hasMounted =
|
|
6059
|
-
|
|
6172
|
+
const hasMounted = useRef26(false);
|
|
6173
|
+
useEffect10(() => {
|
|
6060
6174
|
if (hasMounted.current) {
|
|
6061
6175
|
callback();
|
|
6062
6176
|
} else {
|
|
@@ -6064,7 +6178,7 @@ var useOnUpdate = (callback, dependencies) => {
|
|
|
6064
6178
|
}
|
|
6065
6179
|
}, dependencies);
|
|
6066
6180
|
};
|
|
6067
|
-
var InlineEditor =
|
|
6181
|
+
var InlineEditor = React101.forwardRef(
|
|
6068
6182
|
({ value, setValue, attributes = {}, showToolbar = false, sx }, ref) => {
|
|
6069
6183
|
const editor = useEditor({
|
|
6070
6184
|
extensions: [
|
|
@@ -6078,6 +6192,9 @@ var InlineEditor = React100.forwardRef(
|
|
|
6078
6192
|
Underline,
|
|
6079
6193
|
Superscript,
|
|
6080
6194
|
Subscript,
|
|
6195
|
+
Link3.configure({
|
|
6196
|
+
openOnClick: false
|
|
6197
|
+
}),
|
|
6081
6198
|
HardBreak.extend({
|
|
6082
6199
|
addKeyboardShortcuts() {
|
|
6083
6200
|
return {
|
|
@@ -6098,7 +6215,7 @@ var InlineEditor = React100.forwardRef(
|
|
|
6098
6215
|
editor.commands.setContent(value, { emitUpdate: false });
|
|
6099
6216
|
}
|
|
6100
6217
|
}, [editor, value]);
|
|
6101
|
-
return /* @__PURE__ */
|
|
6218
|
+
return /* @__PURE__ */ React101.createElement(
|
|
6102
6219
|
Box22,
|
|
6103
6220
|
{
|
|
6104
6221
|
ref,
|
|
@@ -6120,14 +6237,17 @@ var InlineEditor = React100.forwardRef(
|
|
|
6120
6237
|
},
|
|
6121
6238
|
"& .ProseMirror": {
|
|
6122
6239
|
minHeight: "70px",
|
|
6123
|
-
fontSize: "12px"
|
|
6240
|
+
fontSize: "12px",
|
|
6241
|
+
"& a": {
|
|
6242
|
+
color: "inherit"
|
|
6243
|
+
}
|
|
6124
6244
|
},
|
|
6125
6245
|
...sx
|
|
6126
6246
|
},
|
|
6127
6247
|
...attributes
|
|
6128
6248
|
},
|
|
6129
|
-
showToolbar && /* @__PURE__ */
|
|
6130
|
-
/* @__PURE__ */
|
|
6249
|
+
showToolbar && /* @__PURE__ */ React101.createElement(InlineEditorToolbar, { editor }),
|
|
6250
|
+
/* @__PURE__ */ React101.createElement(EditorContent, { editor })
|
|
6131
6251
|
);
|
|
6132
6252
|
}
|
|
6133
6253
|
);
|
|
@@ -6136,33 +6256,33 @@ var InlineEditor = React100.forwardRef(
|
|
|
6136
6256
|
var InlineEditingControl = createControl(() => {
|
|
6137
6257
|
const { value, setValue } = useBoundProp(htmlPropTypeUtil);
|
|
6138
6258
|
const handleChange = (newValue) => setValue(newValue);
|
|
6139
|
-
return /* @__PURE__ */
|
|
6259
|
+
return /* @__PURE__ */ React102.createElement(ControlActions, null, /* @__PURE__ */ React102.createElement(InlineEditor, { value: value || "", setValue: handleChange }));
|
|
6140
6260
|
});
|
|
6141
6261
|
|
|
6142
6262
|
// src/components/icon-buttons/clear-icon-button.tsx
|
|
6143
|
-
import * as
|
|
6263
|
+
import * as React103 from "react";
|
|
6144
6264
|
import { BrushBigIcon } from "@elementor/icons";
|
|
6145
6265
|
import { IconButton as IconButton9, styled as styled10, Tooltip as Tooltip10 } from "@elementor/ui";
|
|
6146
6266
|
var CustomIconButton = styled10(IconButton9)(({ theme }) => ({
|
|
6147
6267
|
width: theme.spacing(2.5),
|
|
6148
6268
|
height: theme.spacing(2.5)
|
|
6149
6269
|
}));
|
|
6150
|
-
var ClearIconButton = ({ tooltipText, onClick, disabled, size = "tiny" }) => /* @__PURE__ */
|
|
6270
|
+
var ClearIconButton = ({ tooltipText, onClick, disabled, size = "tiny" }) => /* @__PURE__ */ React103.createElement(Tooltip10, { title: tooltipText, placement: "top", disableInteractive: true }, /* @__PURE__ */ React103.createElement(CustomIconButton, { "aria-label": tooltipText, size, onClick, disabled }, /* @__PURE__ */ React103.createElement(BrushBigIcon, { fontSize: size })));
|
|
6151
6271
|
|
|
6152
6272
|
// src/components/repeater/repeater.tsx
|
|
6153
|
-
import * as
|
|
6154
|
-
import { useEffect as
|
|
6273
|
+
import * as React104 from "react";
|
|
6274
|
+
import { useEffect as useEffect11, useState as useState17 } from "react";
|
|
6155
6275
|
import { CopyIcon as CopyIcon2, EyeIcon as EyeIcon2, EyeOffIcon as EyeOffIcon2, PlusIcon as PlusIcon3, XIcon as XIcon4 } from "@elementor/icons";
|
|
6156
6276
|
import {
|
|
6157
|
-
bindPopover as
|
|
6277
|
+
bindPopover as bindPopover8,
|
|
6158
6278
|
bindTrigger as bindTrigger6,
|
|
6159
6279
|
Box as Box23,
|
|
6160
6280
|
IconButton as IconButton10,
|
|
6161
6281
|
Infotip as Infotip4,
|
|
6162
6282
|
Tooltip as Tooltip11,
|
|
6163
|
-
usePopupState as
|
|
6283
|
+
usePopupState as usePopupState9
|
|
6164
6284
|
} from "@elementor/ui";
|
|
6165
|
-
import { __ as
|
|
6285
|
+
import { __ as __52 } from "@wordpress/i18n";
|
|
6166
6286
|
var SIZE9 = "tiny";
|
|
6167
6287
|
var EMPTY_OPEN_ITEM2 = -1;
|
|
6168
6288
|
var Repeater3 = ({
|
|
@@ -6180,7 +6300,7 @@ var Repeater3 = ({
|
|
|
6180
6300
|
openItem: initialOpenItem = EMPTY_OPEN_ITEM2,
|
|
6181
6301
|
isSortable = true
|
|
6182
6302
|
}) => {
|
|
6183
|
-
const [openItem, setOpenItem] =
|
|
6303
|
+
const [openItem, setOpenItem] = useState17(initialOpenItem);
|
|
6184
6304
|
const uniqueKeys = items2.map(
|
|
6185
6305
|
(item, index) => isSortable && "getId" in itemSettings ? itemSettings.getId({ item, index }) : String(index)
|
|
6186
6306
|
);
|
|
@@ -6243,7 +6363,7 @@ var Repeater3 = ({
|
|
|
6243
6363
|
};
|
|
6244
6364
|
const isButtonDisabled = disabled || disableAddItemButton;
|
|
6245
6365
|
const shouldShowInfotip = isButtonDisabled && addButtonInfotipContent;
|
|
6246
|
-
const addButton = /* @__PURE__ */
|
|
6366
|
+
const addButton = /* @__PURE__ */ React104.createElement(
|
|
6247
6367
|
IconButton10,
|
|
6248
6368
|
{
|
|
6249
6369
|
size: SIZE9,
|
|
@@ -6252,11 +6372,11 @@ var Repeater3 = ({
|
|
|
6252
6372
|
},
|
|
6253
6373
|
disabled: isButtonDisabled,
|
|
6254
6374
|
onClick: addRepeaterItem,
|
|
6255
|
-
"aria-label":
|
|
6375
|
+
"aria-label": __52("Add item", "elementor")
|
|
6256
6376
|
},
|
|
6257
|
-
/* @__PURE__ */
|
|
6377
|
+
/* @__PURE__ */ React104.createElement(PlusIcon3, { fontSize: SIZE9 })
|
|
6258
6378
|
);
|
|
6259
|
-
return /* @__PURE__ */
|
|
6379
|
+
return /* @__PURE__ */ React104.createElement(SectionContent, { gap: 2 }, /* @__PURE__ */ React104.createElement(RepeaterHeader, { label, adornment: ControlAdornments }, shouldShowInfotip ? /* @__PURE__ */ React104.createElement(
|
|
6260
6380
|
Infotip4,
|
|
6261
6381
|
{
|
|
6262
6382
|
placement: "right",
|
|
@@ -6264,20 +6384,20 @@ var Repeater3 = ({
|
|
|
6264
6384
|
color: "secondary",
|
|
6265
6385
|
slotProps: { popper: { sx: { width: 300 } } }
|
|
6266
6386
|
},
|
|
6267
|
-
/* @__PURE__ */
|
|
6268
|
-
) : addButton), 0 < uniqueKeys.length && /* @__PURE__ */
|
|
6387
|
+
/* @__PURE__ */ React104.createElement(Box23, { sx: { ...isButtonDisabled ? { cursor: "not-allowed" } : {} } }, addButton)
|
|
6388
|
+
) : addButton), 0 < uniqueKeys.length && /* @__PURE__ */ React104.createElement(SortableProvider, { value: uniqueKeys, onChange: onChangeOrder }, uniqueKeys.map((key) => {
|
|
6269
6389
|
const index = uniqueKeys.indexOf(key);
|
|
6270
6390
|
const value = items2[index];
|
|
6271
6391
|
if (!value) {
|
|
6272
6392
|
return null;
|
|
6273
6393
|
}
|
|
6274
|
-
return /* @__PURE__ */
|
|
6394
|
+
return /* @__PURE__ */ React104.createElement(SortableItem, { id: key, key: `sortable-${key}`, disabled: !isSortable }, /* @__PURE__ */ React104.createElement(
|
|
6275
6395
|
RepeaterItem,
|
|
6276
6396
|
{
|
|
6277
6397
|
disabled,
|
|
6278
6398
|
propDisabled: value?.disabled,
|
|
6279
|
-
label: /* @__PURE__ */
|
|
6280
|
-
startIcon: /* @__PURE__ */
|
|
6399
|
+
label: /* @__PURE__ */ React104.createElement(RepeaterItemLabelSlot, { value }, /* @__PURE__ */ React104.createElement(itemSettings.Label, { value, index })),
|
|
6400
|
+
startIcon: /* @__PURE__ */ React104.createElement(RepeaterItemIconSlot, { value }, /* @__PURE__ */ React104.createElement(itemSettings.Icon, { value })),
|
|
6281
6401
|
removeItem: () => removeRepeaterItem(index),
|
|
6282
6402
|
duplicateItem: () => duplicateRepeaterItem(index),
|
|
6283
6403
|
toggleDisableItem: () => toggleDisableRepeaterItem(index),
|
|
@@ -6289,7 +6409,7 @@ var Repeater3 = ({
|
|
|
6289
6409
|
actions: itemSettings.actions,
|
|
6290
6410
|
value
|
|
6291
6411
|
},
|
|
6292
|
-
(props) => /* @__PURE__ */
|
|
6412
|
+
(props) => /* @__PURE__ */ React104.createElement(
|
|
6293
6413
|
itemSettings.Content,
|
|
6294
6414
|
{
|
|
6295
6415
|
...props,
|
|
@@ -6319,27 +6439,27 @@ var RepeaterItem = ({
|
|
|
6319
6439
|
value
|
|
6320
6440
|
}) => {
|
|
6321
6441
|
const { popoverState, popoverProps, ref, setRef } = usePopover(openOnMount, onOpen);
|
|
6322
|
-
const duplicateLabel =
|
|
6323
|
-
const toggleLabel = propDisabled ?
|
|
6324
|
-
const removeLabel =
|
|
6325
|
-
return /* @__PURE__ */
|
|
6442
|
+
const duplicateLabel = __52("Duplicate", "elementor");
|
|
6443
|
+
const toggleLabel = propDisabled ? __52("Show", "elementor") : __52("Hide", "elementor");
|
|
6444
|
+
const removeLabel = __52("Remove", "elementor");
|
|
6445
|
+
return /* @__PURE__ */ React104.createElement(React104.Fragment, null, /* @__PURE__ */ React104.createElement(
|
|
6326
6446
|
RepeaterTag,
|
|
6327
6447
|
{
|
|
6328
6448
|
disabled,
|
|
6329
6449
|
label,
|
|
6330
6450
|
ref: setRef,
|
|
6331
|
-
"aria-label":
|
|
6451
|
+
"aria-label": __52("Open item", "elementor"),
|
|
6332
6452
|
...bindTrigger6(popoverState),
|
|
6333
6453
|
startIcon,
|
|
6334
|
-
actions: /* @__PURE__ */
|
|
6454
|
+
actions: /* @__PURE__ */ React104.createElement(React104.Fragment, null, showDuplicate && /* @__PURE__ */ React104.createElement(Tooltip11, { title: duplicateLabel, placement: "top" }, /* @__PURE__ */ React104.createElement(IconButton10, { size: SIZE9, onClick: duplicateItem, "aria-label": duplicateLabel }, /* @__PURE__ */ React104.createElement(CopyIcon2, { fontSize: SIZE9 }))), showToggle && /* @__PURE__ */ React104.createElement(Tooltip11, { title: toggleLabel, placement: "top" }, /* @__PURE__ */ React104.createElement(IconButton10, { size: SIZE9, onClick: toggleDisableItem, "aria-label": toggleLabel }, propDisabled ? /* @__PURE__ */ React104.createElement(EyeOffIcon2, { fontSize: SIZE9 }) : /* @__PURE__ */ React104.createElement(EyeIcon2, { fontSize: SIZE9 }))), actions?.(value), showRemove && /* @__PURE__ */ React104.createElement(Tooltip11, { title: removeLabel, placement: "top" }, /* @__PURE__ */ React104.createElement(IconButton10, { size: SIZE9, onClick: removeItem, "aria-label": removeLabel }, /* @__PURE__ */ React104.createElement(XIcon4, { fontSize: SIZE9 }))))
|
|
6335
6455
|
}
|
|
6336
|
-
), /* @__PURE__ */
|
|
6456
|
+
), /* @__PURE__ */ React104.createElement(RepeaterPopover, { width: ref?.getBoundingClientRect().width, ...popoverProps, anchorEl: ref }, /* @__PURE__ */ React104.createElement(Box23, null, children({ anchorEl: ref }))));
|
|
6337
6457
|
};
|
|
6338
6458
|
var usePopover = (openOnMount, onOpen) => {
|
|
6339
|
-
const [ref, setRef] =
|
|
6340
|
-
const popoverState =
|
|
6341
|
-
const popoverProps =
|
|
6342
|
-
|
|
6459
|
+
const [ref, setRef] = useState17(null);
|
|
6460
|
+
const popoverState = usePopupState9({ variant: "popover" });
|
|
6461
|
+
const popoverProps = bindPopover8(popoverState);
|
|
6462
|
+
useEffect11(() => {
|
|
6343
6463
|
if (openOnMount && ref) {
|
|
6344
6464
|
popoverState.open(ref);
|
|
6345
6465
|
onOpen?.();
|