@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.js
CHANGED
|
@@ -5920,100 +5920,200 @@ var DateTimeControl = createControl(({ inputDisabled }) => {
|
|
|
5920
5920
|
});
|
|
5921
5921
|
|
|
5922
5922
|
// src/controls/inline-editing-control.tsx
|
|
5923
|
-
var
|
|
5923
|
+
var React102 = __toESM(require("react"));
|
|
5924
5924
|
var import_editor_props52 = require("@elementor/editor-props");
|
|
5925
5925
|
|
|
5926
5926
|
// src/components/inline-editor.tsx
|
|
5927
|
-
var
|
|
5928
|
-
var
|
|
5929
|
-
var
|
|
5927
|
+
var React101 = __toESM(require("react"));
|
|
5928
|
+
var import_react55 = require("react");
|
|
5929
|
+
var import_ui87 = require("@elementor/ui");
|
|
5930
5930
|
var import_extension_bold = __toESM(require("@tiptap/extension-bold"));
|
|
5931
5931
|
var import_extension_document = __toESM(require("@tiptap/extension-document"));
|
|
5932
5932
|
var import_extension_hard_break = __toESM(require("@tiptap/extension-hard-break"));
|
|
5933
5933
|
var import_extension_italic = __toESM(require("@tiptap/extension-italic"));
|
|
5934
|
+
var import_extension_link = __toESM(require("@tiptap/extension-link"));
|
|
5934
5935
|
var import_extension_strike = __toESM(require("@tiptap/extension-strike"));
|
|
5935
5936
|
var import_extension_subscript = __toESM(require("@tiptap/extension-subscript"));
|
|
5936
5937
|
var import_extension_superscript = __toESM(require("@tiptap/extension-superscript"));
|
|
5937
5938
|
var import_extension_text = __toESM(require("@tiptap/extension-text"));
|
|
5938
5939
|
var import_extension_underline = __toESM(require("@tiptap/extension-underline"));
|
|
5939
|
-
var
|
|
5940
|
+
var import_react56 = require("@tiptap/react");
|
|
5940
5941
|
|
|
5941
5942
|
// src/components/inline-editor-toolbar.tsx
|
|
5943
|
+
var React100 = __toESM(require("react"));
|
|
5944
|
+
var import_react53 = require("react");
|
|
5945
|
+
var import_icons34 = require("@elementor/icons");
|
|
5946
|
+
var import_ui86 = require("@elementor/ui");
|
|
5947
|
+
var import_react54 = require("@tiptap/react");
|
|
5948
|
+
var import_i18n51 = require("@wordpress/i18n");
|
|
5949
|
+
|
|
5950
|
+
// src/components/url-popover.tsx
|
|
5942
5951
|
var React99 = __toESM(require("react"));
|
|
5943
5952
|
var import_react52 = require("react");
|
|
5944
5953
|
var import_icons33 = require("@elementor/icons");
|
|
5945
5954
|
var import_ui85 = require("@elementor/ui");
|
|
5946
|
-
var import_react53 = require("@tiptap/react");
|
|
5947
5955
|
var import_i18n50 = require("@wordpress/i18n");
|
|
5956
|
+
var UrlPopover = ({
|
|
5957
|
+
popupState,
|
|
5958
|
+
restoreValue,
|
|
5959
|
+
anchorRef,
|
|
5960
|
+
value,
|
|
5961
|
+
onChange,
|
|
5962
|
+
openInNewTab,
|
|
5963
|
+
onToggleNewTab
|
|
5964
|
+
}) => {
|
|
5965
|
+
const inputRef = (0, import_react52.useRef)(null);
|
|
5966
|
+
(0, import_react52.useEffect)(() => {
|
|
5967
|
+
if (popupState.isOpen) {
|
|
5968
|
+
requestAnimationFrame(() => inputRef.current?.focus());
|
|
5969
|
+
}
|
|
5970
|
+
}, [popupState.isOpen]);
|
|
5971
|
+
const handleClose = () => {
|
|
5972
|
+
restoreValue();
|
|
5973
|
+
popupState.close();
|
|
5974
|
+
};
|
|
5975
|
+
return /* @__PURE__ */ React99.createElement(
|
|
5976
|
+
import_ui85.Popover,
|
|
5977
|
+
{
|
|
5978
|
+
slotProps: {
|
|
5979
|
+
paper: { sx: { borderRadius: "16px", width: anchorRef.current?.offsetWidth + "px", marginTop: -1 } }
|
|
5980
|
+
},
|
|
5981
|
+
...(0, import_ui85.bindPopover)(popupState),
|
|
5982
|
+
anchorOrigin: { vertical: "top", horizontal: "left" },
|
|
5983
|
+
transformOrigin: { vertical: "top", horizontal: "left" },
|
|
5984
|
+
onClose: handleClose
|
|
5985
|
+
},
|
|
5986
|
+
/* @__PURE__ */ React99.createElement(import_ui85.Stack, { direction: "row", alignItems: "center", gap: 1, sx: { p: 1.5 } }, /* @__PURE__ */ React99.createElement(
|
|
5987
|
+
import_ui85.TextField,
|
|
5988
|
+
{
|
|
5989
|
+
value,
|
|
5990
|
+
onChange,
|
|
5991
|
+
size: "tiny",
|
|
5992
|
+
fullWidth: true,
|
|
5993
|
+
placeholder: (0, import_i18n50.__)("Type a URL", "elementor"),
|
|
5994
|
+
inputProps: { ref: inputRef },
|
|
5995
|
+
color: "secondary",
|
|
5996
|
+
InputProps: { sx: { borderRadius: "8px" } }
|
|
5997
|
+
}
|
|
5998
|
+
), /* @__PURE__ */ React99.createElement(
|
|
5999
|
+
import_ui85.ToggleButton,
|
|
6000
|
+
{
|
|
6001
|
+
size: "tiny",
|
|
6002
|
+
value: "newTab",
|
|
6003
|
+
selected: openInNewTab,
|
|
6004
|
+
onClick: onToggleNewTab,
|
|
6005
|
+
"aria-label": (0, import_i18n50.__)("Open in a new tab", "elementor"),
|
|
6006
|
+
sx: { borderRadius: "8px" }
|
|
6007
|
+
},
|
|
6008
|
+
/* @__PURE__ */ React99.createElement(import_icons33.ExternalLinkIcon, { fontSize: "tiny" })
|
|
6009
|
+
))
|
|
6010
|
+
);
|
|
6011
|
+
};
|
|
6012
|
+
|
|
6013
|
+
// src/components/inline-editor-toolbar.tsx
|
|
5948
6014
|
var toolbarButtons = {
|
|
5949
6015
|
clear: {
|
|
5950
|
-
label: (0,
|
|
5951
|
-
icon: /* @__PURE__ */
|
|
6016
|
+
label: (0, import_i18n51.__)("Clear", "elementor"),
|
|
6017
|
+
icon: /* @__PURE__ */ React100.createElement(import_icons34.MinusIcon, { fontSize: "tiny" }),
|
|
5952
6018
|
action: "clear",
|
|
5953
6019
|
method: (editor) => {
|
|
5954
6020
|
editor.chain().focus().clearNodes().unsetAllMarks().run();
|
|
5955
6021
|
}
|
|
5956
6022
|
},
|
|
5957
6023
|
bold: {
|
|
5958
|
-
label: (0,
|
|
5959
|
-
icon: /* @__PURE__ */
|
|
6024
|
+
label: (0, import_i18n51.__)("Bold", "elementor"),
|
|
6025
|
+
icon: /* @__PURE__ */ React100.createElement(import_icons34.BoldIcon, { fontSize: "tiny" }),
|
|
5960
6026
|
action: "bold",
|
|
5961
6027
|
method: (editor) => {
|
|
5962
6028
|
editor.chain().focus().toggleBold().run();
|
|
5963
6029
|
}
|
|
5964
6030
|
},
|
|
5965
6031
|
italic: {
|
|
5966
|
-
label: (0,
|
|
5967
|
-
icon: /* @__PURE__ */
|
|
6032
|
+
label: (0, import_i18n51.__)("Italic", "elementor"),
|
|
6033
|
+
icon: /* @__PURE__ */ React100.createElement(import_icons34.ItalicIcon, { fontSize: "tiny" }),
|
|
5968
6034
|
action: "italic",
|
|
5969
6035
|
method: (editor) => {
|
|
5970
6036
|
editor.chain().focus().toggleItalic().run();
|
|
5971
6037
|
}
|
|
5972
6038
|
},
|
|
5973
6039
|
underline: {
|
|
5974
|
-
label: (0,
|
|
5975
|
-
icon: /* @__PURE__ */
|
|
6040
|
+
label: (0, import_i18n51.__)("Underline", "elementor"),
|
|
6041
|
+
icon: /* @__PURE__ */ React100.createElement(import_icons34.UnderlineIcon, { fontSize: "tiny" }),
|
|
5976
6042
|
action: "underline",
|
|
5977
6043
|
method: (editor) => {
|
|
5978
6044
|
editor.chain().focus().toggleUnderline().run();
|
|
5979
6045
|
}
|
|
5980
6046
|
},
|
|
5981
6047
|
strike: {
|
|
5982
|
-
label: (0,
|
|
5983
|
-
icon: /* @__PURE__ */
|
|
6048
|
+
label: (0, import_i18n51.__)("Strikethrough", "elementor"),
|
|
6049
|
+
icon: /* @__PURE__ */ React100.createElement(import_icons34.StrikethroughIcon, { fontSize: "tiny" }),
|
|
5984
6050
|
action: "strike",
|
|
5985
6051
|
method: (editor) => {
|
|
5986
6052
|
editor.chain().focus().toggleStrike().run();
|
|
5987
6053
|
}
|
|
5988
6054
|
},
|
|
5989
6055
|
superscript: {
|
|
5990
|
-
label: (0,
|
|
5991
|
-
icon: /* @__PURE__ */
|
|
6056
|
+
label: (0, import_i18n51.__)("Superscript", "elementor"),
|
|
6057
|
+
icon: /* @__PURE__ */ React100.createElement(import_icons34.SuperscriptIcon, { fontSize: "tiny" }),
|
|
5992
6058
|
action: "superscript",
|
|
5993
6059
|
method: (editor) => {
|
|
5994
6060
|
editor.chain().focus().toggleSuperscript().run();
|
|
5995
6061
|
}
|
|
5996
6062
|
},
|
|
5997
6063
|
subscript: {
|
|
5998
|
-
label: (0,
|
|
5999
|
-
icon: /* @__PURE__ */
|
|
6064
|
+
label: (0, import_i18n51.__)("Subscript", "elementor"),
|
|
6065
|
+
icon: /* @__PURE__ */ React100.createElement(import_icons34.SubscriptIcon, { fontSize: "tiny" }),
|
|
6000
6066
|
action: "subscript",
|
|
6001
6067
|
method: (editor) => {
|
|
6002
6068
|
editor.chain().focus().toggleSubscript().run();
|
|
6003
6069
|
}
|
|
6070
|
+
},
|
|
6071
|
+
link: {
|
|
6072
|
+
label: (0, import_i18n51.__)("Link", "elementor"),
|
|
6073
|
+
icon: /* @__PURE__ */ React100.createElement(import_icons34.LinkIcon, { fontSize: "tiny" }),
|
|
6074
|
+
action: "link",
|
|
6075
|
+
method: null
|
|
6004
6076
|
}
|
|
6005
6077
|
};
|
|
6006
6078
|
var { clear: clearButton, ...formatButtons } = toolbarButtons;
|
|
6007
6079
|
var possibleFormats = Object.keys(formatButtons);
|
|
6008
6080
|
var InlineEditorToolbar = ({ editor }) => {
|
|
6009
|
-
const
|
|
6081
|
+
const [urlValue, setUrlValue] = (0, import_react53.useState)("");
|
|
6082
|
+
const [openInNewTab, setOpenInNewTab] = (0, import_react53.useState)(false);
|
|
6083
|
+
const toolbarRef = (0, import_react53.useRef)(null);
|
|
6084
|
+
const popupState = (0, import_ui86.usePopupState)({ variant: "popover" });
|
|
6085
|
+
const editorState = (0, import_react54.useEditorState)({
|
|
6010
6086
|
editor,
|
|
6011
6087
|
selector: (ctx) => possibleFormats.filter((format) => ctx.editor.isActive(format))
|
|
6012
6088
|
});
|
|
6013
|
-
const formatButtonsList = (0,
|
|
6014
|
-
|
|
6015
|
-
|
|
6089
|
+
const formatButtonsList = (0, import_react53.useMemo)(() => Object.values(formatButtons), []);
|
|
6090
|
+
const handleLinkClick = () => {
|
|
6091
|
+
const linkAttrs = editor.getAttributes("link");
|
|
6092
|
+
setUrlValue(linkAttrs.href || "");
|
|
6093
|
+
setOpenInNewTab(linkAttrs.target === "_blank");
|
|
6094
|
+
popupState.open(toolbarRef.current);
|
|
6095
|
+
};
|
|
6096
|
+
const handleUrlChange = (event) => {
|
|
6097
|
+
setUrlValue(event.target.value);
|
|
6098
|
+
};
|
|
6099
|
+
const handleToggleNewTab = () => {
|
|
6100
|
+
setOpenInNewTab(!openInNewTab);
|
|
6101
|
+
};
|
|
6102
|
+
const handleUrlSubmit = () => {
|
|
6103
|
+
if (urlValue) {
|
|
6104
|
+
editor.chain().focus().setLink({
|
|
6105
|
+
href: urlValue,
|
|
6106
|
+
target: openInNewTab ? "_blank" : "_self"
|
|
6107
|
+
}).run();
|
|
6108
|
+
} else {
|
|
6109
|
+
editor.chain().focus().unsetLink().run();
|
|
6110
|
+
}
|
|
6111
|
+
popupState.close();
|
|
6112
|
+
};
|
|
6113
|
+
return /* @__PURE__ */ React100.createElement(
|
|
6114
|
+
import_ui86.Box,
|
|
6016
6115
|
{
|
|
6116
|
+
ref: toolbarRef,
|
|
6017
6117
|
sx: {
|
|
6018
6118
|
position: "absolute",
|
|
6019
6119
|
top: -40,
|
|
@@ -6023,12 +6123,13 @@ var InlineEditorToolbar = ({ editor }) => {
|
|
|
6023
6123
|
borderRadius: 1,
|
|
6024
6124
|
backgroundColor: "background.paper",
|
|
6025
6125
|
boxShadow: "0 2px 8px rgba(0, 0, 0, 0.2)",
|
|
6026
|
-
alignItems: "center"
|
|
6126
|
+
alignItems: "center",
|
|
6127
|
+
visibility: popupState.isOpen ? "hidden" : "visible"
|
|
6027
6128
|
}
|
|
6028
6129
|
},
|
|
6029
|
-
/* @__PURE__ */
|
|
6030
|
-
/* @__PURE__ */
|
|
6031
|
-
|
|
6130
|
+
/* @__PURE__ */ React100.createElement(import_ui86.Tooltip, { title: clearButton.label, placement: "top" }, /* @__PURE__ */ React100.createElement(import_ui86.IconButton, { "aria-label": clearButton.label, onClick: () => clearButton.method(editor), size: "tiny" }, clearButton.icon)),
|
|
6131
|
+
/* @__PURE__ */ React100.createElement(
|
|
6132
|
+
import_ui86.ToggleButtonGroup,
|
|
6032
6133
|
{
|
|
6033
6134
|
value: editorState,
|
|
6034
6135
|
size: "tiny",
|
|
@@ -6037,24 +6138,36 @@ var InlineEditorToolbar = ({ editor }) => {
|
|
|
6037
6138
|
gap: 0.5
|
|
6038
6139
|
}
|
|
6039
6140
|
},
|
|
6040
|
-
formatButtonsList.map((button) => /* @__PURE__ */
|
|
6041
|
-
|
|
6141
|
+
formatButtonsList.map((button) => /* @__PURE__ */ React100.createElement(import_ui86.Tooltip, { title: button.label, key: button.action, placement: "top" }, /* @__PURE__ */ React100.createElement(
|
|
6142
|
+
import_ui86.ToggleButton,
|
|
6042
6143
|
{
|
|
6043
6144
|
value: button.action,
|
|
6044
6145
|
"aria-label": button.label,
|
|
6045
6146
|
size: "tiny",
|
|
6046
|
-
onClick: () => button.method(editor)
|
|
6147
|
+
onClick: () => button.action === "link" ? handleLinkClick() : button.method?.(editor)
|
|
6047
6148
|
},
|
|
6048
6149
|
button.icon
|
|
6049
6150
|
)))
|
|
6151
|
+
),
|
|
6152
|
+
/* @__PURE__ */ React100.createElement(
|
|
6153
|
+
UrlPopover,
|
|
6154
|
+
{
|
|
6155
|
+
popupState,
|
|
6156
|
+
anchorRef: toolbarRef,
|
|
6157
|
+
restoreValue: handleUrlSubmit,
|
|
6158
|
+
value: urlValue,
|
|
6159
|
+
onChange: handleUrlChange,
|
|
6160
|
+
openInNewTab,
|
|
6161
|
+
onToggleNewTab: handleToggleNewTab
|
|
6162
|
+
}
|
|
6050
6163
|
)
|
|
6051
6164
|
);
|
|
6052
6165
|
};
|
|
6053
6166
|
|
|
6054
6167
|
// src/components/inline-editor.tsx
|
|
6055
6168
|
var useOnUpdate = (callback, dependencies) => {
|
|
6056
|
-
const hasMounted = (0,
|
|
6057
|
-
(0,
|
|
6169
|
+
const hasMounted = (0, import_react55.useRef)(false);
|
|
6170
|
+
(0, import_react55.useEffect)(() => {
|
|
6058
6171
|
if (hasMounted.current) {
|
|
6059
6172
|
callback();
|
|
6060
6173
|
} else {
|
|
@@ -6062,9 +6175,9 @@ var useOnUpdate = (callback, dependencies) => {
|
|
|
6062
6175
|
}
|
|
6063
6176
|
}, dependencies);
|
|
6064
6177
|
};
|
|
6065
|
-
var InlineEditor =
|
|
6178
|
+
var InlineEditor = React101.forwardRef(
|
|
6066
6179
|
({ value, setValue, attributes = {}, showToolbar = false, sx }, ref) => {
|
|
6067
|
-
const editor = (0,
|
|
6180
|
+
const editor = (0, import_react56.useEditor)({
|
|
6068
6181
|
extensions: [
|
|
6069
6182
|
import_extension_document.default.extend({
|
|
6070
6183
|
content: "inline*"
|
|
@@ -6076,6 +6189,9 @@ var InlineEditor = React100.forwardRef(
|
|
|
6076
6189
|
import_extension_underline.default,
|
|
6077
6190
|
import_extension_superscript.default,
|
|
6078
6191
|
import_extension_subscript.default,
|
|
6192
|
+
import_extension_link.default.configure({
|
|
6193
|
+
openOnClick: false
|
|
6194
|
+
}),
|
|
6079
6195
|
import_extension_hard_break.default.extend({
|
|
6080
6196
|
addKeyboardShortcuts() {
|
|
6081
6197
|
return {
|
|
@@ -6096,8 +6212,8 @@ var InlineEditor = React100.forwardRef(
|
|
|
6096
6212
|
editor.commands.setContent(value, { emitUpdate: false });
|
|
6097
6213
|
}
|
|
6098
6214
|
}, [editor, value]);
|
|
6099
|
-
return /* @__PURE__ */
|
|
6100
|
-
|
|
6215
|
+
return /* @__PURE__ */ React101.createElement(
|
|
6216
|
+
import_ui87.Box,
|
|
6101
6217
|
{
|
|
6102
6218
|
ref,
|
|
6103
6219
|
sx: {
|
|
@@ -6118,14 +6234,17 @@ var InlineEditor = React100.forwardRef(
|
|
|
6118
6234
|
},
|
|
6119
6235
|
"& .ProseMirror": {
|
|
6120
6236
|
minHeight: "70px",
|
|
6121
|
-
fontSize: "12px"
|
|
6237
|
+
fontSize: "12px",
|
|
6238
|
+
"& a": {
|
|
6239
|
+
color: "inherit"
|
|
6240
|
+
}
|
|
6122
6241
|
},
|
|
6123
6242
|
...sx
|
|
6124
6243
|
},
|
|
6125
6244
|
...attributes
|
|
6126
6245
|
},
|
|
6127
|
-
showToolbar && /* @__PURE__ */
|
|
6128
|
-
/* @__PURE__ */
|
|
6246
|
+
showToolbar && /* @__PURE__ */ React101.createElement(InlineEditorToolbar, { editor }),
|
|
6247
|
+
/* @__PURE__ */ React101.createElement(import_react56.EditorContent, { editor })
|
|
6129
6248
|
);
|
|
6130
6249
|
}
|
|
6131
6250
|
);
|
|
@@ -6134,25 +6253,25 @@ var InlineEditor = React100.forwardRef(
|
|
|
6134
6253
|
var InlineEditingControl = createControl(() => {
|
|
6135
6254
|
const { value, setValue } = useBoundProp(import_editor_props52.htmlPropTypeUtil);
|
|
6136
6255
|
const handleChange = (newValue) => setValue(newValue);
|
|
6137
|
-
return /* @__PURE__ */
|
|
6256
|
+
return /* @__PURE__ */ React102.createElement(ControlActions, null, /* @__PURE__ */ React102.createElement(InlineEditor, { value: value || "", setValue: handleChange }));
|
|
6138
6257
|
});
|
|
6139
6258
|
|
|
6140
6259
|
// src/components/icon-buttons/clear-icon-button.tsx
|
|
6141
|
-
var
|
|
6142
|
-
var
|
|
6143
|
-
var
|
|
6144
|
-
var CustomIconButton = (0,
|
|
6260
|
+
var React103 = __toESM(require("react"));
|
|
6261
|
+
var import_icons35 = require("@elementor/icons");
|
|
6262
|
+
var import_ui88 = require("@elementor/ui");
|
|
6263
|
+
var CustomIconButton = (0, import_ui88.styled)(import_ui88.IconButton)(({ theme }) => ({
|
|
6145
6264
|
width: theme.spacing(2.5),
|
|
6146
6265
|
height: theme.spacing(2.5)
|
|
6147
6266
|
}));
|
|
6148
|
-
var ClearIconButton = ({ tooltipText, onClick, disabled, size = "tiny" }) => /* @__PURE__ */
|
|
6267
|
+
var ClearIconButton = ({ tooltipText, onClick, disabled, size = "tiny" }) => /* @__PURE__ */ React103.createElement(import_ui88.Tooltip, { title: tooltipText, placement: "top", disableInteractive: true }, /* @__PURE__ */ React103.createElement(CustomIconButton, { "aria-label": tooltipText, size, onClick, disabled }, /* @__PURE__ */ React103.createElement(import_icons35.BrushBigIcon, { fontSize: size })));
|
|
6149
6268
|
|
|
6150
6269
|
// src/components/repeater/repeater.tsx
|
|
6151
|
-
var
|
|
6152
|
-
var
|
|
6153
|
-
var
|
|
6154
|
-
var
|
|
6155
|
-
var
|
|
6270
|
+
var React104 = __toESM(require("react"));
|
|
6271
|
+
var import_react57 = require("react");
|
|
6272
|
+
var import_icons36 = require("@elementor/icons");
|
|
6273
|
+
var import_ui89 = require("@elementor/ui");
|
|
6274
|
+
var import_i18n52 = require("@wordpress/i18n");
|
|
6156
6275
|
var SIZE9 = "tiny";
|
|
6157
6276
|
var EMPTY_OPEN_ITEM2 = -1;
|
|
6158
6277
|
var Repeater3 = ({
|
|
@@ -6170,7 +6289,7 @@ var Repeater3 = ({
|
|
|
6170
6289
|
openItem: initialOpenItem = EMPTY_OPEN_ITEM2,
|
|
6171
6290
|
isSortable = true
|
|
6172
6291
|
}) => {
|
|
6173
|
-
const [openItem, setOpenItem] = (0,
|
|
6292
|
+
const [openItem, setOpenItem] = (0, import_react57.useState)(initialOpenItem);
|
|
6174
6293
|
const uniqueKeys = items2.map(
|
|
6175
6294
|
(item, index) => isSortable && "getId" in itemSettings ? itemSettings.getId({ item, index }) : String(index)
|
|
6176
6295
|
);
|
|
@@ -6233,8 +6352,8 @@ var Repeater3 = ({
|
|
|
6233
6352
|
};
|
|
6234
6353
|
const isButtonDisabled = disabled || disableAddItemButton;
|
|
6235
6354
|
const shouldShowInfotip = isButtonDisabled && addButtonInfotipContent;
|
|
6236
|
-
const addButton = /* @__PURE__ */
|
|
6237
|
-
|
|
6355
|
+
const addButton = /* @__PURE__ */ React104.createElement(
|
|
6356
|
+
import_ui89.IconButton,
|
|
6238
6357
|
{
|
|
6239
6358
|
size: SIZE9,
|
|
6240
6359
|
sx: {
|
|
@@ -6242,32 +6361,32 @@ var Repeater3 = ({
|
|
|
6242
6361
|
},
|
|
6243
6362
|
disabled: isButtonDisabled,
|
|
6244
6363
|
onClick: addRepeaterItem,
|
|
6245
|
-
"aria-label": (0,
|
|
6364
|
+
"aria-label": (0, import_i18n52.__)("Add item", "elementor")
|
|
6246
6365
|
},
|
|
6247
|
-
/* @__PURE__ */
|
|
6366
|
+
/* @__PURE__ */ React104.createElement(import_icons36.PlusIcon, { fontSize: SIZE9 })
|
|
6248
6367
|
);
|
|
6249
|
-
return /* @__PURE__ */
|
|
6250
|
-
|
|
6368
|
+
return /* @__PURE__ */ React104.createElement(SectionContent, { gap: 2 }, /* @__PURE__ */ React104.createElement(RepeaterHeader, { label, adornment: ControlAdornments }, shouldShowInfotip ? /* @__PURE__ */ React104.createElement(
|
|
6369
|
+
import_ui89.Infotip,
|
|
6251
6370
|
{
|
|
6252
6371
|
placement: "right",
|
|
6253
6372
|
content: addButtonInfotipContent,
|
|
6254
6373
|
color: "secondary",
|
|
6255
6374
|
slotProps: { popper: { sx: { width: 300 } } }
|
|
6256
6375
|
},
|
|
6257
|
-
/* @__PURE__ */
|
|
6258
|
-
) : addButton), 0 < uniqueKeys.length && /* @__PURE__ */
|
|
6376
|
+
/* @__PURE__ */ React104.createElement(import_ui89.Box, { sx: { ...isButtonDisabled ? { cursor: "not-allowed" } : {} } }, addButton)
|
|
6377
|
+
) : addButton), 0 < uniqueKeys.length && /* @__PURE__ */ React104.createElement(SortableProvider, { value: uniqueKeys, onChange: onChangeOrder }, uniqueKeys.map((key) => {
|
|
6259
6378
|
const index = uniqueKeys.indexOf(key);
|
|
6260
6379
|
const value = items2[index];
|
|
6261
6380
|
if (!value) {
|
|
6262
6381
|
return null;
|
|
6263
6382
|
}
|
|
6264
|
-
return /* @__PURE__ */
|
|
6383
|
+
return /* @__PURE__ */ React104.createElement(SortableItem, { id: key, key: `sortable-${key}`, disabled: !isSortable }, /* @__PURE__ */ React104.createElement(
|
|
6265
6384
|
RepeaterItem,
|
|
6266
6385
|
{
|
|
6267
6386
|
disabled,
|
|
6268
6387
|
propDisabled: value?.disabled,
|
|
6269
|
-
label: /* @__PURE__ */
|
|
6270
|
-
startIcon: /* @__PURE__ */
|
|
6388
|
+
label: /* @__PURE__ */ React104.createElement(RepeaterItemLabelSlot, { value }, /* @__PURE__ */ React104.createElement(itemSettings.Label, { value, index })),
|
|
6389
|
+
startIcon: /* @__PURE__ */ React104.createElement(RepeaterItemIconSlot, { value }, /* @__PURE__ */ React104.createElement(itemSettings.Icon, { value })),
|
|
6271
6390
|
removeItem: () => removeRepeaterItem(index),
|
|
6272
6391
|
duplicateItem: () => duplicateRepeaterItem(index),
|
|
6273
6392
|
toggleDisableItem: () => toggleDisableRepeaterItem(index),
|
|
@@ -6279,7 +6398,7 @@ var Repeater3 = ({
|
|
|
6279
6398
|
actions: itemSettings.actions,
|
|
6280
6399
|
value
|
|
6281
6400
|
},
|
|
6282
|
-
(props) => /* @__PURE__ */
|
|
6401
|
+
(props) => /* @__PURE__ */ React104.createElement(
|
|
6283
6402
|
itemSettings.Content,
|
|
6284
6403
|
{
|
|
6285
6404
|
...props,
|
|
@@ -6309,27 +6428,27 @@ var RepeaterItem = ({
|
|
|
6309
6428
|
value
|
|
6310
6429
|
}) => {
|
|
6311
6430
|
const { popoverState, popoverProps, ref, setRef } = usePopover(openOnMount, onOpen);
|
|
6312
|
-
const duplicateLabel = (0,
|
|
6313
|
-
const toggleLabel = propDisabled ? (0,
|
|
6314
|
-
const removeLabel = (0,
|
|
6315
|
-
return /* @__PURE__ */
|
|
6431
|
+
const duplicateLabel = (0, import_i18n52.__)("Duplicate", "elementor");
|
|
6432
|
+
const toggleLabel = propDisabled ? (0, import_i18n52.__)("Show", "elementor") : (0, import_i18n52.__)("Hide", "elementor");
|
|
6433
|
+
const removeLabel = (0, import_i18n52.__)("Remove", "elementor");
|
|
6434
|
+
return /* @__PURE__ */ React104.createElement(React104.Fragment, null, /* @__PURE__ */ React104.createElement(
|
|
6316
6435
|
RepeaterTag,
|
|
6317
6436
|
{
|
|
6318
6437
|
disabled,
|
|
6319
6438
|
label,
|
|
6320
6439
|
ref: setRef,
|
|
6321
|
-
"aria-label": (0,
|
|
6322
|
-
...(0,
|
|
6440
|
+
"aria-label": (0, import_i18n52.__)("Open item", "elementor"),
|
|
6441
|
+
...(0, import_ui89.bindTrigger)(popoverState),
|
|
6323
6442
|
startIcon,
|
|
6324
|
-
actions: /* @__PURE__ */
|
|
6443
|
+
actions: /* @__PURE__ */ React104.createElement(React104.Fragment, null, showDuplicate && /* @__PURE__ */ React104.createElement(import_ui89.Tooltip, { title: duplicateLabel, placement: "top" }, /* @__PURE__ */ React104.createElement(import_ui89.IconButton, { size: SIZE9, onClick: duplicateItem, "aria-label": duplicateLabel }, /* @__PURE__ */ React104.createElement(import_icons36.CopyIcon, { fontSize: SIZE9 }))), showToggle && /* @__PURE__ */ React104.createElement(import_ui89.Tooltip, { title: toggleLabel, placement: "top" }, /* @__PURE__ */ React104.createElement(import_ui89.IconButton, { size: SIZE9, onClick: toggleDisableItem, "aria-label": toggleLabel }, propDisabled ? /* @__PURE__ */ React104.createElement(import_icons36.EyeOffIcon, { fontSize: SIZE9 }) : /* @__PURE__ */ React104.createElement(import_icons36.EyeIcon, { fontSize: SIZE9 }))), actions?.(value), showRemove && /* @__PURE__ */ React104.createElement(import_ui89.Tooltip, { title: removeLabel, placement: "top" }, /* @__PURE__ */ React104.createElement(import_ui89.IconButton, { size: SIZE9, onClick: removeItem, "aria-label": removeLabel }, /* @__PURE__ */ React104.createElement(import_icons36.XIcon, { fontSize: SIZE9 }))))
|
|
6325
6444
|
}
|
|
6326
|
-
), /* @__PURE__ */
|
|
6445
|
+
), /* @__PURE__ */ React104.createElement(RepeaterPopover, { width: ref?.getBoundingClientRect().width, ...popoverProps, anchorEl: ref }, /* @__PURE__ */ React104.createElement(import_ui89.Box, null, children({ anchorEl: ref }))));
|
|
6327
6446
|
};
|
|
6328
6447
|
var usePopover = (openOnMount, onOpen) => {
|
|
6329
|
-
const [ref, setRef] = (0,
|
|
6330
|
-
const popoverState = (0,
|
|
6331
|
-
const popoverProps = (0,
|
|
6332
|
-
(0,
|
|
6448
|
+
const [ref, setRef] = (0, import_react57.useState)(null);
|
|
6449
|
+
const popoverState = (0, import_ui89.usePopupState)({ variant: "popover" });
|
|
6450
|
+
const popoverProps = (0, import_ui89.bindPopover)(popoverState);
|
|
6451
|
+
(0, import_react57.useEffect)(() => {
|
|
6333
6452
|
if (openOnMount && ref) {
|
|
6334
6453
|
popoverState.open(ref);
|
|
6335
6454
|
onOpen?.();
|