@elementor/editor-controls 4.3.0-998 → 4.3.0-beta1

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.mjs CHANGED
@@ -452,7 +452,7 @@ var ImageMediaControl = createControl(({ mediaTypes = ["image"] }) => {
452
452
  import * as React12 from "react";
453
453
  import { stringPropTypeUtil as stringPropTypeUtil2 } from "@elementor/editor-props";
454
454
  import { MenuListItem } from "@elementor/editor-ui";
455
- import { Select, Typography } from "@elementor/ui";
455
+ import { MenuSubheader, Select, Typography } from "@elementor/ui";
456
456
  var DEFAULT_MENU_PROPS = {
457
457
  MenuListProps: {
458
458
  sx: {
@@ -461,14 +461,15 @@ var DEFAULT_MENU_PROPS = {
461
461
  }
462
462
  };
463
463
  var SelectControl = createControl(
464
- ({ options, onChange, MenuProps = DEFAULT_MENU_PROPS, ariaLabel }) => {
464
+ ({ options = [], groups = [], onChange, MenuProps = DEFAULT_MENU_PROPS, ariaLabel }) => {
465
465
  const { value, setValue, disabled, placeholder } = useBoundProp(stringPropTypeUtil2);
466
466
  const handleChange = (event) => {
467
467
  const newValue = event.target.value || null;
468
468
  onChange?.(newValue, value);
469
469
  setValue(newValue);
470
470
  };
471
- const isDisabled = disabled || options.length === 0;
471
+ const flatOptions = flattenGroupedOptions(options, groups);
472
+ const isDisabled = disabled || flatOptions.length === 0;
472
473
  return /* @__PURE__ */ React12.createElement(ControlActions, null, /* @__PURE__ */ React12.createElement(
473
474
  Select,
474
475
  {
@@ -477,16 +478,41 @@ var SelectControl = createControl(
477
478
  size: "tiny",
478
479
  MenuProps,
479
480
  "aria-label": ariaLabel || placeholder,
480
- renderValue: (selectedValue) => getSelectRenderValue(options, placeholder, selectedValue),
481
+ renderValue: (selectedValue) => getSelectRenderValue(flatOptions, placeholder, selectedValue),
481
482
  value: value ?? "",
482
483
  onChange: handleChange,
483
484
  disabled: isDisabled,
484
485
  fullWidth: true
485
486
  },
486
- options.map(({ label, ...props }) => /* @__PURE__ */ React12.createElement(MenuListItem, { key: props.value, ...props, value: props.value ?? "" }, label))
487
+ groups.length ? groups.flatMap((group) => renderGroup(group)) : options.map((option) => renderOption(option))
487
488
  ));
488
489
  }
489
490
  );
491
+ var GROUPED_OPTION_INDENT = 3.5;
492
+ function renderGroup(group) {
493
+ return [
494
+ /* @__PURE__ */ React12.createElement(MenuSubheader, { key: `group-${group.label}`, sx: { fontWeight: 400, color: "text.tertiary" } }, group.label),
495
+ ...group.options.map((option) => renderOption(option, true))
496
+ ];
497
+ }
498
+ function renderOption({ label, ...props }, isGrouped = false) {
499
+ return /* @__PURE__ */ React12.createElement(
500
+ MenuListItem,
501
+ {
502
+ key: props.value,
503
+ ...props,
504
+ value: props.value ?? "",
505
+ sx: isGrouped ? { pl: GROUPED_OPTION_INDENT } : void 0
506
+ },
507
+ label
508
+ );
509
+ }
510
+ function flattenGroupedOptions(options, groups) {
511
+ if (!groups.length) {
512
+ return options;
513
+ }
514
+ return groups.flatMap((group) => group.options);
515
+ }
490
516
  function getSelectRenderValue(options, placeholder, selectedValue) {
491
517
  const optionWithValue = (v) => options.find(({ value }) => value === v);
492
518
  if (!isUnsetSelectValue(selectedValue)) {
@@ -5206,8 +5232,8 @@ var AspectRatioControl = createControl(({ label }) => {
5206
5232
  const isCustomValue = aspectRatioValue && !RATIO_OPTIONS.some((option) => option.value === aspectRatioValue);
5207
5233
  if (isCustomValue) {
5208
5234
  const [width, height] = aspectRatioValue.split("/");
5209
- setCustomWidth(width || "");
5210
- setCustomHeight(height || "");
5235
+ setCustomWidth(width.trim() || "");
5236
+ setCustomHeight(height.trim() || "");
5211
5237
  setSelectedValue(CUSTOM_RATIO);
5212
5238
  setIsCustom(true);
5213
5239
  } else {
@@ -5289,11 +5315,21 @@ var AspectRatioControl = createControl(({ label }) => {
5289
5315
 
5290
5316
  // src/controls/svg-media-control.tsx
5291
5317
  import * as React81 from "react";
5292
- import { useState as useState16 } from "react";
5318
+ import { useEffect as useEffect16, useState as useState16 } from "react";
5293
5319
  import { useCurrentUserCapabilities } from "@elementor/editor-current-user";
5294
- import { svgSrcPropTypeUtil, urlPropTypeUtil as urlPropTypeUtil4 } from "@elementor/editor-props";
5320
+ import { iconPropTypeUtil, svgSrcPropTypeUtil, urlPropTypeUtil as urlPropTypeUtil4 } from "@elementor/editor-props";
5295
5321
  import { UploadIcon as UploadIcon2 } from "@elementor/icons";
5296
- import { Button as Button5, Card as Card2, CardMedia as CardMedia2, CardOverlay as CardOverlay2, CircularProgress as CircularProgress3, Stack as Stack13, styled as styled9, ThemeProvider } from "@elementor/ui";
5322
+ import {
5323
+ Box as Box15,
5324
+ Button as Button5,
5325
+ Card as Card2,
5326
+ CardMedia as CardMedia2,
5327
+ CardOverlay as CardOverlay2,
5328
+ CircularProgress as CircularProgress3,
5329
+ Stack as Stack13,
5330
+ styled as styled9,
5331
+ ThemeProvider
5332
+ } from "@elementor/ui";
5297
5333
  import { useWpMediaAttachment as useWpMediaAttachment2, useWpMediaFrame as useWpMediaFrame2 } from "@elementor/wp-media";
5298
5334
  import { __ as __32 } from "@wordpress/i18n";
5299
5335
 
@@ -5357,10 +5393,49 @@ var AdminDialog = ({ open, onClose, handleEnable, isPending, isError }) => /* @_
5357
5393
  isPending ? /* @__PURE__ */ React80.createElement(CircularProgress2, { size: 24 }) : __31("Enable", "elementor")
5358
5394
  )));
5359
5395
 
5396
+ // src/controls/open-icon-library.ts
5397
+ import { stringPropTypeUtil as stringPropTypeUtil14 } from "@elementor/editor-props";
5398
+ var SVG_ICON_LIBRARY = "svg";
5399
+ function isSvgLibrarySelection(icon) {
5400
+ return icon.library === SVG_ICON_LIBRARY && typeof icon.value === "object" && icon.value !== null;
5401
+ }
5402
+ function openIconLibrary({ selected, onSelect } = {}) {
5403
+ const iconManager = window.elementor?.iconManager;
5404
+ if (!iconManager) {
5405
+ return;
5406
+ }
5407
+ iconManager.loadIconLibraries();
5408
+ iconManager.show({
5409
+ view: createIconManagerControlView(selected, onSelect)
5410
+ });
5411
+ }
5412
+ function enqueueIconFonts(library) {
5413
+ window.elementor?.helpers?.enqueueIconFonts?.(library);
5414
+ }
5415
+ function createIconManagerControlView(selected, onSelect) {
5416
+ return {
5417
+ model: {
5418
+ get: () => false
5419
+ },
5420
+ getControlValue: () => selected ?? { value: "", library: "" },
5421
+ setValue: (icon) => {
5422
+ onSelect?.(icon);
5423
+ },
5424
+ applySavedValue: () => void 0
5425
+ };
5426
+ }
5427
+ function createIconPropValue(icon, library) {
5428
+ return {
5429
+ value: stringPropTypeUtil14.create(icon),
5430
+ library: stringPropTypeUtil14.create(library)
5431
+ };
5432
+ }
5433
+
5360
5434
  // src/controls/svg-media-control.tsx
5361
5435
  var TILE_SIZE = 8;
5362
5436
  var TILE_WHITE = "transparent";
5363
5437
  var TILE_BLACK = "#c1c1c1";
5438
+ var ICON_PREVIEW_FONT_SIZE = 50;
5364
5439
  var TILES_GRADIENT_FORMULA = `linear-gradient(45deg, ${TILE_BLACK} 25%, ${TILE_WHITE} 0, ${TILE_WHITE} 75%, ${TILE_BLACK} 0, ${TILE_BLACK})`;
5365
5440
  var StyledCard = styled9(Card2)`
5366
5441
  background-color: white;
@@ -5382,21 +5457,24 @@ var StyledCardMediaContainer = styled9(Stack13)`
5382
5457
  `;
5383
5458
  var MODE_BROWSE = { mode: "browse" };
5384
5459
  var MODE_UPLOAD = { mode: "upload" };
5385
- var SvgMediaControl = createControl(() => {
5386
- const { value, setValue } = useBoundProp(svgSrcPropTypeUtil);
5387
- const id = value?.id;
5388
- const url = value?.url;
5460
+ var SvgMediaControl = createControl(({ showIconLibrary = false }) => {
5461
+ const { value: svgValue, setValue: setSvgValue } = useBoundProp(svgSrcPropTypeUtil);
5462
+ const { value: iconValue, setValue: setIconValue } = useBoundProp(iconPropTypeUtil);
5463
+ const id = svgValue?.id;
5464
+ const url = svgValue?.url;
5389
5465
  const { data: attachment, isFetching } = useWpMediaAttachment2(id?.value || null);
5390
5466
  const src = attachment?.url ?? url?.value ?? null;
5391
5467
  const { data: allowSvgUpload } = useUnfilteredFilesUpload();
5392
5468
  const [unfilteredModalOpenState, setUnfilteredModalOpenState] = useState16(false);
5393
5469
  const { isAdmin } = useCurrentUserCapabilities();
5470
+ const selectedIconClass = showIconLibrary && typeof iconValue?.value?.value === "string" ? iconValue.value.value : null;
5471
+ const selectedIconLibrary = showIconLibrary && typeof iconValue?.library?.value === "string" ? iconValue.library.value : null;
5394
5472
  const { open } = useWpMediaFrame2({
5395
5473
  mediaTypes: ["svg"],
5396
5474
  multiple: false,
5397
5475
  selected: id?.value || null,
5398
5476
  onSelect: (selectedAttachment) => {
5399
- setValue({
5477
+ setSvgValue({
5400
5478
  id: {
5401
5479
  $$type: "image-attachment-id",
5402
5480
  value: selectedAttachment.id
@@ -5418,18 +5496,36 @@ var SvgMediaControl = createControl(() => {
5418
5496
  open(openOptions);
5419
5497
  }
5420
5498
  };
5499
+ const handleIconLibrarySelect = (icon) => {
5500
+ if (!showIconLibrary) {
5501
+ return;
5502
+ }
5503
+ if (isSvgLibrarySelection(icon)) {
5504
+ setSvgValue({
5505
+ id: icon.value.id ? {
5506
+ $$type: "image-attachment-id",
5507
+ value: icon.value.id
5508
+ } : null,
5509
+ url: icon.value.url ? urlPropTypeUtil4.create(icon.value.url) : null
5510
+ });
5511
+ return;
5512
+ }
5513
+ if (typeof icon.value === "string") {
5514
+ setIconValue(createIconPropValue(icon.value, icon.library));
5515
+ }
5516
+ };
5421
5517
  const infotipProps = {
5422
5518
  title: __32("Sorry, you can't upload that file yet.", "elementor"),
5423
5519
  description: /* @__PURE__ */ React81.createElement(React81.Fragment, null, __32("To upload them anyway, ask the site administrator to enable unfiltered", "elementor"), /* @__PURE__ */ React81.createElement("br", null), __32("file uploads.", "elementor")),
5424
5520
  isEnabled: !isAdmin
5425
5521
  };
5426
- return /* @__PURE__ */ React81.createElement(Stack13, { gap: 1, "aria-label": "SVG Control" }, /* @__PURE__ */ React81.createElement(EnableUnfilteredModal, { open: unfilteredModalOpenState, onClose: onCloseUnfilteredModal }), /* @__PURE__ */ React81.createElement(ControlActions, null, /* @__PURE__ */ React81.createElement(StyledCard, { variant: "outlined" }, /* @__PURE__ */ React81.createElement(StyledCardMediaContainer, null, isFetching ? /* @__PURE__ */ React81.createElement(CircularProgress3, { role: "progressbar" }) : /* @__PURE__ */ React81.createElement(
5427
- CardMedia2,
5522
+ return /* @__PURE__ */ React81.createElement(Stack13, { gap: 1, "aria-label": "SVG Control" }, /* @__PURE__ */ React81.createElement(EnableUnfilteredModal, { open: unfilteredModalOpenState, onClose: onCloseUnfilteredModal }), /* @__PURE__ */ React81.createElement(ControlActions, null, /* @__PURE__ */ React81.createElement(StyledCard, { variant: "outlined" }, /* @__PURE__ */ React81.createElement(StyledCardMediaContainer, null, /* @__PURE__ */ React81.createElement(
5523
+ SvgMediaPreview,
5428
5524
  {
5429
- component: "img",
5430
- image: src,
5431
- alt: __32("Preview SVG", "elementor"),
5432
- sx: { maxHeight: "140px", width: "50px" }
5525
+ isFetching,
5526
+ src,
5527
+ iconClassName: selectedIconClass,
5528
+ iconLibrary: selectedIconLibrary
5433
5529
  }
5434
5530
  )), /* @__PURE__ */ React81.createElement(
5435
5531
  CardOverlay2,
@@ -5450,7 +5546,20 @@ var SvgMediaControl = createControl(() => {
5450
5546
  "aria-label": "Select SVG"
5451
5547
  },
5452
5548
  __32("Select SVG", "elementor")
5453
- ), /* @__PURE__ */ React81.createElement(ConditionalControlInfotip, { ...infotipProps }, /* @__PURE__ */ React81.createElement("span", null, /* @__PURE__ */ React81.createElement(ThemeProvider, { colorScheme: isAdmin ? "light" : "dark" }, /* @__PURE__ */ React81.createElement(
5549
+ ), showIconLibrary ? /* @__PURE__ */ React81.createElement(
5550
+ Button5,
5551
+ {
5552
+ size: "tiny",
5553
+ variant: "text",
5554
+ color: "inherit",
5555
+ onClick: () => openIconLibrary({
5556
+ selected: selectedIconClass && selectedIconLibrary ? { value: selectedIconClass, library: selectedIconLibrary } : void 0,
5557
+ onSelect: handleIconLibrarySelect
5558
+ }),
5559
+ "aria-label": __32("Icon library", "elementor")
5560
+ },
5561
+ __32("Icon library", "elementor")
5562
+ ) : null, /* @__PURE__ */ React81.createElement(ConditionalControlInfotip, { ...infotipProps }, /* @__PURE__ */ React81.createElement("span", null, /* @__PURE__ */ React81.createElement(ThemeProvider, { colorScheme: isAdmin ? "light" : "dark" }, /* @__PURE__ */ React81.createElement(
5454
5563
  Button5,
5455
5564
  {
5456
5565
  size: "tiny",
@@ -5465,24 +5574,62 @@ var SvgMediaControl = createControl(() => {
5465
5574
  )))))
5466
5575
  ))));
5467
5576
  });
5577
+ function SvgMediaPreview({
5578
+ isFetching,
5579
+ src,
5580
+ iconClassName,
5581
+ iconLibrary
5582
+ }) {
5583
+ useEffect16(() => {
5584
+ if (iconLibrary) {
5585
+ enqueueIconFonts(iconLibrary);
5586
+ }
5587
+ }, [iconLibrary]);
5588
+ if (isFetching) {
5589
+ return /* @__PURE__ */ React81.createElement(CircularProgress3, { role: "progressbar" });
5590
+ }
5591
+ if (iconClassName) {
5592
+ return /* @__PURE__ */ React81.createElement(
5593
+ Box15,
5594
+ {
5595
+ component: "i",
5596
+ className: iconClassName,
5597
+ "aria-label": __32("Preview icon", "elementor"),
5598
+ sx: { fontSize: ICON_PREVIEW_FONT_SIZE }
5599
+ }
5600
+ );
5601
+ }
5602
+ return /* @__PURE__ */ React81.createElement(
5603
+ CardMedia2,
5604
+ {
5605
+ component: "img",
5606
+ image: src,
5607
+ alt: __32("Preview SVG", "elementor"),
5608
+ sx: { maxHeight: "140px", width: `${ICON_PREVIEW_FONT_SIZE}px` }
5609
+ }
5610
+ );
5611
+ }
5468
5612
 
5469
5613
  // src/controls/video-media-control.tsx
5470
5614
  import * as React82 from "react";
5471
- import { videoSrcPropTypeUtil } from "@elementor/editor-props";
5615
+ import { urlPropTypeUtil as urlPropTypeUtil5, videoSrcPropTypeUtil } from "@elementor/editor-props";
5472
5616
  import { UploadIcon as UploadIcon3 } from "@elementor/icons";
5473
5617
  import { Button as Button6, Card as Card3, CardMedia as CardMedia3, CardOverlay as CardOverlay3, CircularProgress as CircularProgress4, Stack as Stack14 } from "@elementor/ui";
5474
5618
  import { useWpMediaAttachment as useWpMediaAttachment3, useWpMediaFrame as useWpMediaFrame3 } from "@elementor/wp-media";
5475
5619
  import { __ as __33 } from "@wordpress/i18n";
5476
5620
  var PLACEHOLDER_IMAGE = window.elementorCommon?.config?.urls?.assets + "/shapes/play-triangle.svg";
5477
5621
  var VideoMediaControl = createControl(() => {
5478
- const { value, setValue } = useBoundProp(videoSrcPropTypeUtil);
5622
+ const { value, setValue, propType } = useBoundProp(videoSrcPropTypeUtil);
5479
5623
  const { id, url } = value ?? {};
5480
5624
  const { data: attachment, isFetching } = useWpMediaAttachment3(id?.value || null);
5481
5625
  const videoUrl = attachment?.url ?? url?.value ?? null;
5626
+ const defaultUrl = videoSrcPropTypeUtil.extract(propType.default ?? null)?.url?.value;
5627
+ const currentUrlForModal = url?.value && url.value !== defaultUrl ? url.value : void 0;
5482
5628
  const { open } = useWpMediaFrame3({
5483
5629
  mediaTypes: ["video"],
5484
5630
  multiple: false,
5485
5631
  selected: id?.value || null,
5632
+ allowUrlImport: true,
5486
5633
  onSelect: (selectedAttachment) => {
5487
5634
  setValue({
5488
5635
  id: {
@@ -5491,6 +5638,12 @@ var VideoMediaControl = createControl(() => {
5491
5638
  },
5492
5639
  url: null
5493
5640
  });
5641
+ },
5642
+ onSelectUrl: (selectedUrl) => {
5643
+ setValue({
5644
+ id: null,
5645
+ url: urlPropTypeUtil5.create(selectedUrl)
5646
+ });
5494
5647
  }
5495
5648
  });
5496
5649
  return /* @__PURE__ */ React82.createElement(ControlActions, null, /* @__PURE__ */ React82.createElement(Card3, { variant: "outlined" }, /* @__PURE__ */ React82.createElement(
@@ -5528,6 +5681,15 @@ var VideoMediaControl = createControl(() => {
5528
5681
  onClick: () => open({ mode: "upload" })
5529
5682
  },
5530
5683
  __33("Upload", "elementor")
5684
+ ), /* @__PURE__ */ React82.createElement(
5685
+ Button6,
5686
+ {
5687
+ size: "tiny",
5688
+ variant: "text",
5689
+ color: "inherit",
5690
+ onClick: () => open({ mode: "url", currentUrl: currentUrlForModal })
5691
+ },
5692
+ __33("Insert from URL", "elementor")
5531
5693
  )))));
5532
5694
  });
5533
5695
  var VideoPreview = ({ isFetching = false, videoUrl }) => {
@@ -5538,6 +5700,7 @@ var VideoPreview = ({ isFetching = false, videoUrl }) => {
5538
5700
  return /* @__PURE__ */ React82.createElement(
5539
5701
  "video",
5540
5702
  {
5703
+ "aria-label": __33("Video preview", "elementor"),
5541
5704
  src: videoUrl,
5542
5705
  muted: true,
5543
5706
  preload: "metadata",
@@ -5567,7 +5730,7 @@ import {
5567
5730
  backgroundOverlayPropTypeUtil,
5568
5731
  colorPropTypeUtil as colorPropTypeUtil3
5569
5732
  } from "@elementor/editor-props";
5570
- import { Box as Box15, CardMedia as CardMedia4, styled as styled10, Tab, TabPanel, Tabs, UnstableColorIndicator as UnstableColorIndicator3 } from "@elementor/ui";
5733
+ import { Box as Box16, CardMedia as CardMedia4, styled as styled10, Tab, TabPanel, Tabs, UnstableColorIndicator as UnstableColorIndicator3 } from "@elementor/ui";
5571
5734
  import { useWpMediaAttachment as useWpMediaAttachment4 } from "@elementor/wp-media";
5572
5735
  import { __ as __38 } from "@wordpress/i18n";
5573
5736
 
@@ -5583,7 +5746,7 @@ import {
5583
5746
  colorStopPropTypeUtil,
5584
5747
  gradientColorStopPropTypeUtil,
5585
5748
  numberPropTypeUtil as numberPropTypeUtil5,
5586
- stringPropTypeUtil as stringPropTypeUtil14
5749
+ stringPropTypeUtil as stringPropTypeUtil15
5587
5750
  } from "@elementor/editor-props";
5588
5751
  import { UnstableGradientBox } from "@elementor/ui";
5589
5752
  var BackgroundGradientColorControl = createControl(() => {
@@ -5591,13 +5754,13 @@ var BackgroundGradientColorControl = createControl(() => {
5591
5754
  const handleChange = (newValue) => {
5592
5755
  const transformedValue = createTransformableValue(newValue);
5593
5756
  if (transformedValue.positions) {
5594
- transformedValue.positions = stringPropTypeUtil14.create(newValue.positions.join(" "));
5757
+ transformedValue.positions = stringPropTypeUtil15.create(newValue.positions.join(" "));
5595
5758
  }
5596
5759
  setValue(transformedValue);
5597
5760
  };
5598
5761
  const createTransformableValue = (newValue) => ({
5599
5762
  ...newValue,
5600
- type: stringPropTypeUtil14.create(newValue.type),
5763
+ type: stringPropTypeUtil15.create(newValue.type),
5601
5764
  angle: numberPropTypeUtil5.create(newValue.angle),
5602
5765
  stops: gradientColorStopPropTypeUtil.create(
5603
5766
  newValue.stops.map(
@@ -5616,9 +5779,9 @@ var BackgroundGradientColorControl = createControl(() => {
5616
5779
  return {
5617
5780
  type: type.value,
5618
5781
  angle: angle?.value || 0,
5619
- stops: stops.value.map(({ value: { color, offset } }) => ({
5782
+ stops: stops.value.map(({ value: { color, offset } }, index, arr) => ({
5620
5783
  color: color.value,
5621
- offset: offset.value
5784
+ offset: offset?.value ?? (arr.length > 1 ? index / (arr.length - 1) * 100 : 0)
5622
5785
  })),
5623
5786
  positions: positions?.value.split(" ")
5624
5787
  };
@@ -5633,7 +5796,7 @@ var BackgroundGradientColorControl = createControl(() => {
5633
5796
  );
5634
5797
  });
5635
5798
  var initialBackgroundGradientOverlay = backgroundGradientOverlayPropTypeUtil.create({
5636
- type: stringPropTypeUtil14.create("linear"),
5799
+ type: stringPropTypeUtil15.create("linear"),
5637
5800
  angle: numberPropTypeUtil5.create(180),
5638
5801
  stops: gradientColorStopPropTypeUtil.create([
5639
5802
  colorStopPropTypeUtil.create({
@@ -5673,7 +5836,7 @@ var BackgroundImageOverlayAttachment = () => {
5673
5836
  // src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-position.tsx
5674
5837
  import * as React85 from "react";
5675
5838
  import { useRef as useRef15 } from "react";
5676
- import { backgroundImagePositionOffsetPropTypeUtil, stringPropTypeUtil as stringPropTypeUtil15 } from "@elementor/editor-props";
5839
+ import { backgroundImagePositionOffsetPropTypeUtil, stringPropTypeUtil as stringPropTypeUtil16 } from "@elementor/editor-props";
5677
5840
  import { MenuListItem as MenuListItem6 } from "@elementor/editor-ui";
5678
5841
  import { LetterXIcon, LetterYIcon } from "@elementor/icons";
5679
5842
  import { Grid as Grid15, Select as Select4 } from "@elementor/ui";
@@ -5692,7 +5855,7 @@ var backgroundPositionOptions = [
5692
5855
  ];
5693
5856
  var BackgroundImageOverlayPosition = () => {
5694
5857
  const backgroundImageOffsetContext = useBoundProp(backgroundImagePositionOffsetPropTypeUtil);
5695
- const stringPropContext = useBoundProp(stringPropTypeUtil15);
5858
+ const stringPropContext = useBoundProp(stringPropTypeUtil16);
5696
5859
  const isCustom = !!backgroundImageOffsetContext.value;
5697
5860
  const rowRef = useRef15(null);
5698
5861
  const handlePositionChange = (event) => {
@@ -5768,7 +5931,7 @@ var BackgroundImageOverlayRepeat = () => {
5768
5931
  // src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-size.tsx
5769
5932
  import * as React87 from "react";
5770
5933
  import { useRef as useRef16 } from "react";
5771
- import { backgroundImageSizeScalePropTypeUtil, stringPropTypeUtil as stringPropTypeUtil16 } from "@elementor/editor-props";
5934
+ import { backgroundImageSizeScalePropTypeUtil, stringPropTypeUtil as stringPropTypeUtil17 } from "@elementor/editor-props";
5772
5935
  import {
5773
5936
  ArrowBarBothIcon,
5774
5937
  ArrowsMaximizeIcon,
@@ -5807,7 +5970,7 @@ var sizeControlOptions = [
5807
5970
  ];
5808
5971
  var BackgroundImageOverlaySize = () => {
5809
5972
  const backgroundImageScaleContext = useBoundProp(backgroundImageSizeScalePropTypeUtil);
5810
- const stringPropContext = useBoundProp(stringPropTypeUtil16);
5973
+ const stringPropContext = useBoundProp(stringPropTypeUtil17);
5811
5974
  const isCustom = !!backgroundImageScaleContext.value;
5812
5975
  const rowRef = useRef16(null);
5813
5976
  const handleSizeChange = (size) => {
@@ -5969,7 +6132,7 @@ var ItemContent2 = () => {
5969
6132
  gradient: initialBackgroundGradientOverlay.value
5970
6133
  });
5971
6134
  const { rowRef } = useRepeaterContext();
5972
- return /* @__PURE__ */ React88.createElement(Box15, { sx: { width: "100%" } }, /* @__PURE__ */ React88.createElement(Box15, { sx: { borderBottom: 1, borderColor: "divider" } }, /* @__PURE__ */ React88.createElement(
6135
+ return /* @__PURE__ */ React88.createElement(Box16, { sx: { width: "100%" } }, /* @__PURE__ */ React88.createElement(Box16, { sx: { borderBottom: 1, borderColor: "divider" } }, /* @__PURE__ */ React88.createElement(
5973
6136
  Tabs,
5974
6137
  {
5975
6138
  size: "small",
@@ -6085,7 +6248,9 @@ var getFileExtensionFromFilename = (filename) => {
6085
6248
  };
6086
6249
  var getGradientValue = (value) => {
6087
6250
  const gradient = value.value;
6088
- const stops = gradient.stops.value?.map(({ value: { color, offset } }) => `${color.value} ${offset.value ?? 0}%`)?.join(",");
6251
+ const stops = gradient.stops.value?.map(
6252
+ ({ value: { color, offset } }) => offset ? `${color.value} ${offset.value ?? 0}%` : `${color.value}`
6253
+ )?.join(",");
6089
6254
  if (gradient.type.value === "linear") {
6090
6255
  return `linear-gradient(${gradient.angle.value}deg, ${stops})`;
6091
6256
  }
@@ -6116,7 +6281,7 @@ var BackgroundClipField = () => {
6116
6281
  import * as React90 from "react";
6117
6282
  import { useMemo as useMemo12 } from "react";
6118
6283
  import { createArrayPropUtils as createArrayPropUtils2 } from "@elementor/editor-props";
6119
- import { Box as Box16 } from "@elementor/ui";
6284
+ import { Box as Box17 } from "@elementor/ui";
6120
6285
  var PLACEHOLDER_REGEX = /\$\{([^}]+)\}/g;
6121
6286
  var RepeatableControl = createControl(
6122
6287
  ({
@@ -6262,7 +6427,7 @@ var ItemLabel4 = ({ value }) => {
6262
6427
  const label = showPlaceholder ? placeholder : interpolate(patternLabel, value);
6263
6428
  const isReadOnly = !!childProps?.readOnly;
6264
6429
  const color = getTextColor(isReadOnly, showPlaceholder);
6265
- return /* @__PURE__ */ React90.createElement(Box16, { component: "span", color }, label);
6430
+ return /* @__PURE__ */ React90.createElement(Box17, { component: "span", color }, label);
6266
6431
  };
6267
6432
  var getAllProperties = (pattern) => {
6268
6433
  const properties = pattern.match(PLACEHOLDER_REGEX)?.map((match) => match.slice(2, -1)) || [];
@@ -6275,7 +6440,7 @@ import { useMemo as useMemo13, useState as useState17 } from "react";
6275
6440
  import {
6276
6441
  isTransformable,
6277
6442
  keyValuePropTypeUtil,
6278
- stringPropTypeUtil as stringPropTypeUtil17
6443
+ stringPropTypeUtil as stringPropTypeUtil18
6279
6444
  } from "@elementor/editor-props";
6280
6445
  import { FormHelperText, FormLabel as FormLabel3, Grid as Grid19 } from "@elementor/ui";
6281
6446
  import { __ as __40 } from "@wordpress/i18n";
@@ -6347,7 +6512,7 @@ var KeyValueControl = createControl((props = {}) => {
6347
6512
  });
6348
6513
  return;
6349
6514
  }
6350
- const extractedValue = stringPropTypeUtil17.extract(newChangedValue);
6515
+ const extractedValue = stringPropTypeUtil18.extract(newChangedValue);
6351
6516
  setSessionState((prev) => ({
6352
6517
  ...prev,
6353
6518
  [fieldType]: extractedValue
@@ -6387,7 +6552,7 @@ var KeyValueControl = createControl((props = {}) => {
6387
6552
 
6388
6553
  // src/controls/position-control.tsx
6389
6554
  import * as React92 from "react";
6390
- import { positionPropTypeUtil, stringPropTypeUtil as stringPropTypeUtil18 } from "@elementor/editor-props";
6555
+ import { positionPropTypeUtil, stringPropTypeUtil as stringPropTypeUtil19 } from "@elementor/editor-props";
6391
6556
  import { MenuListItem as MenuListItem7 } from "@elementor/editor-ui";
6392
6557
  import { LetterXIcon as LetterXIcon2, LetterYIcon as LetterYIcon2 } from "@elementor/icons";
6393
6558
  import { Grid as Grid20, Select as Select5 } from "@elementor/ui";
@@ -6406,7 +6571,7 @@ var positionOptions = [
6406
6571
  ];
6407
6572
  var PositionControl = () => {
6408
6573
  const positionContext = useBoundProp(positionPropTypeUtil);
6409
- const stringPropContext = useBoundProp(stringPropTypeUtil18);
6574
+ const stringPropContext = useBoundProp(stringPropTypeUtil19);
6410
6575
  const isCustom = !!positionContext.value;
6411
6576
  const placeholder = positionContext.placeholder ? "custom" : stringPropContext.placeholder ?? null;
6412
6577
  const handlePositionChange = (event) => {
@@ -6449,7 +6614,7 @@ import * as React105 from "react";
6449
6614
  import { useRef as useRef25 } from "react";
6450
6615
  import { transformFunctionsPropTypeUtil, transformPropTypeUtil } from "@elementor/editor-props";
6451
6616
  import { AdjustmentsIcon as AdjustmentsIcon2, InfoCircleFilledIcon as InfoCircleFilledIcon2 } from "@elementor/icons";
6452
- import { bindTrigger as bindTrigger5, Box as Box20, IconButton as IconButton8, Tooltip as Tooltip8, Typography as Typography7, usePopupState as usePopupState8 } from "@elementor/ui";
6617
+ import { bindTrigger as bindTrigger5, Box as Box21, IconButton as IconButton8, Tooltip as Tooltip8, Typography as Typography7, usePopupState as usePopupState8 } from "@elementor/ui";
6453
6618
  import { __ as __51 } from "@wordpress/i18n";
6454
6619
 
6455
6620
  // src/controls/transform-control/initial-values.ts
@@ -6505,7 +6670,7 @@ var initialSkewValue = skewTransformPropTypeUtil.create({
6505
6670
 
6506
6671
  // src/controls/transform-control/transform-content.tsx
6507
6672
  import * as React99 from "react";
6508
- import { Box as Box17, Tab as Tab2, TabPanel as TabPanel2, Tabs as Tabs2 } from "@elementor/ui";
6673
+ import { Box as Box18, Tab as Tab2, TabPanel as TabPanel2, Tabs as Tabs2 } from "@elementor/ui";
6509
6674
  import { __ as __46 } from "@wordpress/i18n";
6510
6675
 
6511
6676
  // src/controls/transform-control/functions/move.tsx
@@ -6776,7 +6941,7 @@ var TransformContent = () => {
6776
6941
  rotate: initialRotateValue.value,
6777
6942
  skew: initialSkewValue.value
6778
6943
  });
6779
- return /* @__PURE__ */ React99.createElement(PopoverContent, null, /* @__PURE__ */ React99.createElement(Box17, { sx: { width: "100%" } }, /* @__PURE__ */ React99.createElement(Box17, { sx: { borderBottom: 1, borderColor: "divider" } }, /* @__PURE__ */ React99.createElement(
6944
+ return /* @__PURE__ */ React99.createElement(PopoverContent, null, /* @__PURE__ */ React99.createElement(Box18, { sx: { width: "100%" } }, /* @__PURE__ */ React99.createElement(Box18, { sx: { borderBottom: 1, borderColor: "divider" } }, /* @__PURE__ */ React99.createElement(
6780
6945
  Tabs2,
6781
6946
  {
6782
6947
  size: "small",
@@ -6816,7 +6981,7 @@ var TransformIcon = ({ value }) => {
6816
6981
 
6817
6982
  // src/controls/transform-control/transform-label.tsx
6818
6983
  import * as React101 from "react";
6819
- import { Box as Box18 } from "@elementor/ui";
6984
+ import { Box as Box19 } from "@elementor/ui";
6820
6985
  import { __ as __47 } from "@wordpress/i18n";
6821
6986
  var orderedAxis = ["x", "y", "z"];
6822
6987
  var formatLabel = (value, functionType) => {
@@ -6847,14 +7012,14 @@ var TransformLabel = (props) => {
6847
7012
  }
6848
7013
  };
6849
7014
  var Label2 = ({ label, value }) => {
6850
- return /* @__PURE__ */ React101.createElement(Box18, { component: "span" }, label, ": ", value);
7015
+ return /* @__PURE__ */ React101.createElement(Box19, { component: "span" }, label, ": ", value);
6851
7016
  };
6852
7017
 
6853
7018
  // src/controls/transform-control/transform-settings-control.tsx
6854
7019
  import * as React104 from "react";
6855
7020
  import { PopoverHeader as PopoverHeader4 } from "@elementor/editor-ui";
6856
7021
  import { AdjustmentsIcon } from "@elementor/icons";
6857
- import { bindPopover as bindPopover6, Box as Box19, Divider as Divider4, Popover as Popover6 } from "@elementor/ui";
7022
+ import { bindPopover as bindPopover6, Box as Box20, Divider as Divider4, Popover as Popover6 } from "@elementor/ui";
6858
7023
  import { __ as __50 } from "@wordpress/i18n";
6859
7024
 
6860
7025
  // src/controls/transform-control/transform-base-controls/children-perspective-control.tsx
@@ -6964,7 +7129,7 @@ var TransformSettingsControl = ({
6964
7129
  }
6965
7130
  ),
6966
7131
  /* @__PURE__ */ React104.createElement(Divider4, null),
6967
- /* @__PURE__ */ React104.createElement(PopoverContent, { sx: { px: 2, py: 1.5 } }, /* @__PURE__ */ React104.createElement(PropKeyProvider, { bind: "transform-origin" }, /* @__PURE__ */ React104.createElement(TransformOriginControl, null)), showChildrenPerspective && /* @__PURE__ */ React104.createElement(React104.Fragment, null, /* @__PURE__ */ React104.createElement(Box19, { sx: { my: 0.5 } }, /* @__PURE__ */ React104.createElement(Divider4, null)), /* @__PURE__ */ React104.createElement(ChildrenPerspectiveControl, null)))
7132
+ /* @__PURE__ */ React104.createElement(PopoverContent, { sx: { px: 2, py: 1.5 } }, /* @__PURE__ */ React104.createElement(PropKeyProvider, { bind: "transform-origin" }, /* @__PURE__ */ React104.createElement(TransformOriginControl, null)), showChildrenPerspective && /* @__PURE__ */ React104.createElement(React104.Fragment, null, /* @__PURE__ */ React104.createElement(Box20, { sx: { my: 0.5 } }, /* @__PURE__ */ React104.createElement(Divider4, null)), /* @__PURE__ */ React104.createElement(ChildrenPerspectiveControl, null)))
6968
7133
  );
6969
7134
  };
6970
7135
 
@@ -6986,7 +7151,7 @@ var TransformRepeaterControl = createControl(
6986
7151
  }
6987
7152
  );
6988
7153
  var ToolTip = /* @__PURE__ */ React105.createElement(
6989
- Box20,
7154
+ Box21,
6990
7155
  {
6991
7156
  component: "span",
6992
7157
  "aria-label": void 0,
@@ -7053,13 +7218,13 @@ var TransformBasePopoverTrigger = ({
7053
7218
 
7054
7219
  // src/controls/transition-control/transition-repeater-control.tsx
7055
7220
  import * as React108 from "react";
7056
- import { useEffect as useEffect16, useMemo as useMemo16, useState as useState18 } from "react";
7221
+ import { useEffect as useEffect17, useMemo as useMemo16, useState as useState18 } from "react";
7057
7222
  import {
7058
7223
  createArrayPropUtils as createArrayPropUtils3,
7059
7224
  selectionSizePropTypeUtil as selectionSizePropTypeUtil2
7060
7225
  } from "@elementor/editor-props";
7061
7226
  import { InfoCircleFilledIcon as InfoCircleFilledIcon3 } from "@elementor/icons";
7062
- import { Alert as Alert2, AlertTitle as AlertTitle3, Box as Box22, Typography as Typography8 } from "@elementor/ui";
7227
+ import { Alert as Alert2, AlertTitle as AlertTitle3, Box as Box23, Typography as Typography8 } from "@elementor/ui";
7063
7228
  import { hasProInstalled as hasProInstalled2 } from "@elementor/utils";
7064
7229
  import { __ as __54 } from "@wordpress/i18n";
7065
7230
 
@@ -7290,7 +7455,7 @@ import { useMemo as useMemo15, useRef as useRef27 } from "react";
7290
7455
  import { keyValuePropTypeUtil as keyValuePropTypeUtil2 } from "@elementor/editor-props";
7291
7456
  import { PromotionAlert, PromotionChip } from "@elementor/editor-ui";
7292
7457
  import { ChevronDownIcon as ChevronDownIcon3, VariationsIcon } from "@elementor/icons";
7293
- import { bindPopover as bindPopover7, bindTrigger as bindTrigger6, Box as Box21, Popover as Popover7, UnstableTag as UnstableTag3, usePopupState as usePopupState9 } from "@elementor/ui";
7458
+ import { bindPopover as bindPopover7, bindTrigger as bindTrigger6, Box as Box22, Popover as Popover7, UnstableTag as UnstableTag3, usePopupState as usePopupState9 } from "@elementor/ui";
7294
7459
  import { __ as __53 } from "@wordpress/i18n";
7295
7460
 
7296
7461
  // src/utils/tracking.ts
@@ -7418,7 +7583,7 @@ var TransitionSelector = ({
7418
7583
  left: rect.right + 36
7419
7584
  };
7420
7585
  };
7421
- return /* @__PURE__ */ React107.createElement(Box21, { ref: defaultRef }, /* @__PURE__ */ React107.createElement(ControlActions, null, /* @__PURE__ */ React107.createElement(
7586
+ return /* @__PURE__ */ React107.createElement(Box22, { ref: defaultRef }, /* @__PURE__ */ React107.createElement(ControlActions, null, /* @__PURE__ */ React107.createElement(
7422
7587
  UnstableTag3,
7423
7588
  {
7424
7589
  variant: "outlined",
@@ -7450,7 +7615,7 @@ var TransitionSelector = ({
7450
7615
  icon: VariationsIcon,
7451
7616
  disabledItems: includeCurrentValueInOptions(value, disabledItems),
7452
7617
  categoryItemContentTemplate: (item) => /* @__PURE__ */ React107.createElement(
7453
- Box21,
7618
+ Box22,
7454
7619
  {
7455
7620
  sx: {
7456
7621
  display: "flex",
@@ -7592,7 +7757,7 @@ var disableAddItemTooltipContent = /* @__PURE__ */ React108.createElement(
7592
7757
  icon: /* @__PURE__ */ React108.createElement(InfoCircleFilledIcon3, null)
7593
7758
  },
7594
7759
  /* @__PURE__ */ React108.createElement(AlertTitle3, null, __54("Transitions", "elementor")),
7595
- /* @__PURE__ */ React108.createElement(Box22, { component: "span" }, /* @__PURE__ */ React108.createElement(Typography8, { variant: "body2" }, __54("Switch to 'Normal' state to add a transition.", "elementor")))
7760
+ /* @__PURE__ */ React108.createElement(Box23, { component: "span" }, /* @__PURE__ */ React108.createElement(Typography8, { variant: "body2" }, __54("Switch to 'Normal' state to add a transition.", "elementor")))
7596
7761
  );
7597
7762
  var TransitionRepeaterControl = createControl(
7598
7763
  ({
@@ -7618,7 +7783,7 @@ var TransitionRepeaterControl = createControl(
7618
7783
  });
7619
7784
  return set;
7620
7785
  }, [proInstalled]);
7621
- useEffect16(() => {
7786
+ useEffect17(() => {
7622
7787
  if (!value || value.length === 0) {
7623
7788
  return;
7624
7789
  }
@@ -7630,7 +7795,7 @@ var TransitionRepeaterControl = createControl(
7630
7795
  setValue(sanitized);
7631
7796
  }
7632
7797
  }, [allowedTransitionSet]);
7633
- useEffect16(() => {
7798
+ useEffect17(() => {
7634
7799
  recentlyUsedListGetter().then(setRecentlyUsedList);
7635
7800
  }, [recentlyUsedListGetter]);
7636
7801
  const allPropertiesUsed = useMemo16(() => areAllPropertiesUsed(value), [value]);
@@ -7664,9 +7829,9 @@ var TransitionRepeaterControl = createControl(
7664
7829
  // src/controls/date-time-control.tsx
7665
7830
  import * as React109 from "react";
7666
7831
  import * as dayjs from "dayjs";
7667
- import { isTransformable as isTransformable2, stringPropTypeUtil as stringPropTypeUtil19 } from "@elementor/editor-props";
7832
+ import { isTransformable as isTransformable2, stringPropTypeUtil as stringPropTypeUtil20 } from "@elementor/editor-props";
7668
7833
  import { DateTimePropTypeUtil } from "@elementor/editor-props";
7669
- import { Box as Box23, DatePicker, LocalizationProvider, TimePicker } from "@elementor/ui";
7834
+ import { Box as Box24, DatePicker, LocalizationProvider, TimePicker } from "@elementor/ui";
7670
7835
  var DATE_FORMAT = "YYYY-MM-DD";
7671
7836
  var TIME_FORMAT = "HH:mm";
7672
7837
  var DateTimeControl = createControl(({ inputDisabled }) => {
@@ -7710,10 +7875,10 @@ var DateTimeControl = createControl(({ inputDisabled }) => {
7710
7875
  const base = dayjs.default();
7711
7876
  return base.hour(h).minute(m).second(0).millisecond(0);
7712
7877
  };
7713
- return /* @__PURE__ */ React109.createElement(PropProvider, { ...propContext, value, setValue }, /* @__PURE__ */ React109.createElement(ControlActions, null, /* @__PURE__ */ React109.createElement(LocalizationProvider, null, /* @__PURE__ */ React109.createElement(Box23, { display: "flex", gap: 1, alignItems: "center" }, /* @__PURE__ */ React109.createElement(PropKeyProvider, { bind: "date" }, /* @__PURE__ */ React109.createElement(
7878
+ return /* @__PURE__ */ React109.createElement(PropProvider, { ...propContext, value, setValue }, /* @__PURE__ */ React109.createElement(ControlActions, null, /* @__PURE__ */ React109.createElement(LocalizationProvider, null, /* @__PURE__ */ React109.createElement(Box24, { display: "flex", gap: 1, alignItems: "center" }, /* @__PURE__ */ React109.createElement(PropKeyProvider, { bind: "date" }, /* @__PURE__ */ React109.createElement(
7714
7879
  DatePicker,
7715
7880
  {
7716
- value: parseDateValue(stringPropTypeUtil19.extract(value?.date)),
7881
+ value: parseDateValue(stringPropTypeUtil20.extract(value?.date)),
7717
7882
  onChange: (v) => handleChange({ date: v }, { bind: "date" }),
7718
7883
  disabled: inputDisabled,
7719
7884
  slotProps: {
@@ -7725,7 +7890,7 @@ var DateTimeControl = createControl(({ inputDisabled }) => {
7725
7890
  )), /* @__PURE__ */ React109.createElement(PropKeyProvider, { bind: "time" }, /* @__PURE__ */ React109.createElement(
7726
7891
  TimePicker,
7727
7892
  {
7728
- value: parseTimeValue(stringPropTypeUtil19.extract(value?.time)),
7893
+ value: parseTimeValue(stringPropTypeUtil20.extract(value?.time)),
7729
7894
  onChange: (v) => handleChange({ time: v }, { bind: "time" }),
7730
7895
  disabled: inputDisabled,
7731
7896
  slotProps: {
@@ -7915,16 +8080,15 @@ var BoundTimeStringControl = ({ bind, ariaLabel }) => {
7915
8080
  };
7916
8081
 
7917
8082
  // src/controls/inline-editing-control.tsx
7918
- import * as React115 from "react";
7919
- import { useCallback as useCallback4, useEffect as useEffect18, useMemo as useMemo17 } from "react";
7920
- import { htmlV3PropTypeUtil, parseHtmlChildren, stringPropTypeUtil as stringPropTypeUtil20 } from "@elementor/editor-props";
7921
- import { Box as Box25 } from "@elementor/ui";
7922
- import { debounce as debounce3 } from "@elementor/utils";
8083
+ import * as React117 from "react";
8084
+ import { useCallback as useCallback4, useState as useState20 } from "react";
8085
+ import { escapedHtmlPropTypeUtil as escapedHtmlPropTypeUtil2 } from "@elementor/editor-props";
8086
+ import { Box as Box27 } from "@elementor/ui";
7923
8087
 
7924
8088
  // src/components/inline-editor.tsx
7925
8089
  import * as React114 from "react";
7926
- import { useEffect as useEffect17, useRef as useRef28 } from "react";
7927
- import { Box as Box24 } from "@elementor/ui";
8090
+ import { useEffect as useEffect18, useRef as useRef28 } from "react";
8091
+ import { Box as Box25 } from "@elementor/ui";
7928
8092
  import Bold from "@tiptap/extension-bold";
7929
8093
  import Document from "@tiptap/extension-document";
7930
8094
  import HardBreak from "@tiptap/extension-hard-break";
@@ -7940,6 +8104,7 @@ import Underline from "@tiptap/extension-underline";
7940
8104
  import { EditorContent, useEditor } from "@tiptap/react";
7941
8105
 
7942
8106
  // src/utils/inline-editing.ts
8107
+ import { escapedHtmlPropTypeUtil, htmlV3PropTypeUtil, stringPropTypeUtil as stringPropTypeUtil21 } from "@elementor/editor-props";
7943
8108
  function isEmpty(value = "") {
7944
8109
  if (!value) {
7945
8110
  return true;
@@ -7956,6 +8121,13 @@ function htmlToPlainText(html) {
7956
8121
  const doc = new DOMParser().parseFromString(normalizedHtml, "text/html");
7957
8122
  return doc.body.textContent ?? "";
7958
8123
  }
8124
+ function extractInlineHtmlContent(propValue) {
8125
+ if (escapedHtmlPropTypeUtil.isValid(propValue)) {
8126
+ return escapedHtmlPropTypeUtil.extract(propValue) ?? "";
8127
+ }
8128
+ const htmlV3 = htmlV3PropTypeUtil.extract(propValue);
8129
+ return stringPropTypeUtil21.extract(htmlV3?.content ?? null) ?? "";
8130
+ }
7959
8131
 
7960
8132
  // src/components/inline-editor.tsx
7961
8133
  var ITALIC_KEYBOARD_SHORTCUT = "i";
@@ -7973,6 +8145,7 @@ var InlineEditor = React114.forwardRef((props, ref) => {
7973
8145
  onBlur = void 0,
7974
8146
  expectedTag = null,
7975
8147
  onEditorCreate,
8148
+ onEditorDestroy,
7976
8149
  wrapperClassName,
7977
8150
  onSelectionEnd,
7978
8151
  mountElement = null
@@ -8057,6 +8230,7 @@ var InlineEditor = React114.forwardRef((props, ref) => {
8057
8230
  }
8058
8231
  },
8059
8232
  onCreate: onEditorCreate ? ({ editor: mountedEditor }) => onEditorCreate(mountedEditor) : void 0,
8233
+ onDestroy: onEditorDestroy ? () => onEditorDestroy() : void 0,
8060
8234
  onBlur: mountElement ? void 0 : () => onBlurRef.current?.(),
8061
8235
  onSelectionUpdate: onSelectionEnd ? ({ editor: updatedEditor }) => onSelectionEnd(updatedEditor.view) : void 0
8062
8236
  });
@@ -8072,11 +8246,11 @@ var InlineEditor = React114.forwardRef((props, ref) => {
8072
8246
  if (mountElement) {
8073
8247
  return null;
8074
8248
  }
8075
- return /* @__PURE__ */ React114.createElement(Box24, { ref: containerRef, sx, className: wrapperClassName }, /* @__PURE__ */ React114.createElement(EditorContent, { ref, editor }));
8249
+ return /* @__PURE__ */ React114.createElement(Box25, { ref: containerRef, sx, className: wrapperClassName }, /* @__PURE__ */ React114.createElement(EditorContent, { ref, editor }));
8076
8250
  });
8077
8251
  var useOnUpdate = (callback, dependencies) => {
8078
8252
  const hasMounted = useRef28(false);
8079
- useEffect17(() => {
8253
+ useEffect18(() => {
8080
8254
  if (hasMounted.current) {
8081
8255
  callback();
8082
8256
  } else {
@@ -8085,111 +8259,428 @@ var useOnUpdate = (callback, dependencies) => {
8085
8259
  }, dependencies);
8086
8260
  };
8087
8261
 
8088
- // src/controls/inline-editing-control.tsx
8089
- var CHILDREN_PARSE_DEBOUNCE_MS = 300;
8090
- var InlineEditingControl = createControl(
8091
- ({
8092
- sx,
8093
- attributes,
8094
- props
8095
- }) => {
8096
- const { value, setValue, placeholder } = useBoundProp(htmlV3PropTypeUtil);
8097
- const content = stringPropTypeUtil20.extract(value?.content ?? null) ?? "";
8098
- const debouncedParse = useMemo17(
8099
- () => debounce3((html) => {
8100
- const parsed = parseHtmlChildren(html);
8101
- setValue({
8102
- content: parsed.content ? stringPropTypeUtil20.create(parsed.content) : null,
8103
- children: parsed.children
8104
- });
8105
- }, CHILDREN_PARSE_DEBOUNCE_MS),
8106
- [setValue]
8107
- );
8108
- const handleChange = useCallback4(
8109
- (newValue) => {
8110
- const html = newValue ?? "";
8111
- setValue({
8112
- content: html ? stringPropTypeUtil20.create(html) : null,
8113
- children: value?.children ?? []
8114
- });
8115
- debouncedParse(html);
8262
+ // src/components/inline-editor-toolbar.tsx
8263
+ import * as React116 from "react";
8264
+ import { useEffect as useEffect20, useMemo as useMemo17, useRef as useRef30, useState as useState19 } from "react";
8265
+ import { getContainer as getContainer2, getElementSetting } from "@elementor/editor-elements";
8266
+ import {
8267
+ BoldIcon,
8268
+ ItalicIcon,
8269
+ LinkIcon as LinkIcon3,
8270
+ MinusIcon as MinusIcon2,
8271
+ StrikethroughIcon,
8272
+ SubscriptIcon,
8273
+ SuperscriptIcon,
8274
+ UnderlineIcon
8275
+ } from "@elementor/icons";
8276
+ import {
8277
+ Box as Box26,
8278
+ IconButton as IconButton9,
8279
+ ToggleButton as ToggleButton3,
8280
+ ToggleButtonGroup as ToggleButtonGroup2,
8281
+ toggleButtonGroupClasses,
8282
+ Tooltip as Tooltip10,
8283
+ usePopupState as usePopupState10
8284
+ } from "@elementor/ui";
8285
+ import { useEditorState } from "@tiptap/react";
8286
+ import { __ as __58 } from "@wordpress/i18n";
8287
+
8288
+ // src/components/url-popover.tsx
8289
+ import * as React115 from "react";
8290
+ import { useEffect as useEffect19, useRef as useRef29 } from "react";
8291
+ import { ExternalLinkIcon } from "@elementor/icons";
8292
+ import { bindPopover as bindPopover8, Popover as Popover8, Stack as Stack19, TextField as TextField11, ToggleButton as ToggleButton2, Tooltip as Tooltip9 } from "@elementor/ui";
8293
+ import { __ as __57 } from "@wordpress/i18n";
8294
+ var UrlPopover = ({
8295
+ popupState,
8296
+ restoreValue,
8297
+ anchorRef,
8298
+ value,
8299
+ onChange,
8300
+ openInNewTab,
8301
+ onToggleNewTab
8302
+ }) => {
8303
+ const inputRef = useRef29(null);
8304
+ useEffect19(() => {
8305
+ if (popupState.isOpen) {
8306
+ requestAnimationFrame(() => inputRef.current?.focus());
8307
+ }
8308
+ }, [popupState.isOpen]);
8309
+ const handleClose = () => {
8310
+ restoreValue();
8311
+ popupState.close();
8312
+ };
8313
+ return /* @__PURE__ */ React115.createElement(
8314
+ Popover8,
8315
+ {
8316
+ slotProps: {
8317
+ paper: { sx: { borderRadius: "16px", width: anchorRef.current?.offsetWidth + "px", marginTop: -1 } }
8116
8318
  },
8117
- [setValue, value?.children, debouncedParse]
8118
- );
8119
- useEffect18(() => () => debouncedParse.cancel(), [debouncedParse]);
8120
- return /* @__PURE__ */ React115.createElement(ControlActions, null, /* @__PURE__ */ React115.createElement(
8121
- Box25,
8319
+ ...bindPopover8(popupState),
8320
+ anchorOrigin: { vertical: "top", horizontal: "left" },
8321
+ transformOrigin: { vertical: "top", horizontal: "left" },
8322
+ onClose: handleClose
8323
+ },
8324
+ /* @__PURE__ */ React115.createElement(Stack19, { direction: "row", alignItems: "center", gap: 1, sx: { p: 1.5 } }, /* @__PURE__ */ React115.createElement(
8325
+ TextField11,
8326
+ {
8327
+ value,
8328
+ onChange,
8329
+ size: "tiny",
8330
+ fullWidth: true,
8331
+ placeholder: __57("Type a URL", "elementor"),
8332
+ inputProps: { ref: inputRef },
8333
+ color: "secondary",
8334
+ InputProps: { sx: { borderRadius: "8px" } },
8335
+ onKeyUp: (event) => event.key === "Enter" && handleClose()
8336
+ }
8337
+ ), /* @__PURE__ */ React115.createElement(Tooltip9, { title: __57("Open in a new tab", "elementor") }, /* @__PURE__ */ React115.createElement(
8338
+ ToggleButton2,
8339
+ {
8340
+ size: "tiny",
8341
+ value: "newTab",
8342
+ selected: openInNewTab,
8343
+ onClick: onToggleNewTab,
8344
+ "aria-label": __57("Open in a new tab", "elementor"),
8345
+ sx: { borderRadius: "8px" }
8346
+ },
8347
+ /* @__PURE__ */ React115.createElement(ExternalLinkIcon, { fontSize: "tiny" })
8348
+ )))
8349
+ );
8350
+ };
8351
+
8352
+ // src/components/inline-editor-toolbar.tsx
8353
+ var InlineEditorToolbar = ({
8354
+ editor,
8355
+ elementId,
8356
+ sx = {},
8357
+ inControlPanel = false
8358
+ }) => {
8359
+ const [urlValue, setUrlValue] = useState19("");
8360
+ const [openInNewTab, setOpenInNewTab] = useState19(false);
8361
+ const toolbarRef = useRef30(null);
8362
+ const linkPopupState = usePopupState10({ variant: "popover" });
8363
+ const isElementClickable = elementId ? checkIfElementIsClickable(elementId) : false;
8364
+ const editorState = useEditorState({
8365
+ editor,
8366
+ selector: (ctx) => possibleFormats.filter((format) => ctx.editor.isActive(format))
8367
+ });
8368
+ const formatButtonsList = useMemo17(() => {
8369
+ const buttons = Object.values(formatButtons);
8370
+ if (isElementClickable) {
8371
+ return buttons.filter((button) => button.action !== "link");
8372
+ }
8373
+ return buttons;
8374
+ }, [isElementClickable]);
8375
+ const handleLinkClick = () => {
8376
+ const linkAttrs = editor.getAttributes("link");
8377
+ setUrlValue(linkAttrs.href || "");
8378
+ setOpenInNewTab(linkAttrs.target === "_blank");
8379
+ linkPopupState.open(toolbarRef.current);
8380
+ };
8381
+ const handleUrlChange = (event) => {
8382
+ setUrlValue(event.target.value);
8383
+ };
8384
+ const handleToggleNewTab = () => {
8385
+ setOpenInNewTab(!openInNewTab);
8386
+ };
8387
+ const handleUrlSubmit = () => {
8388
+ if (urlValue) {
8389
+ editor.chain().focus().setLink({
8390
+ href: urlValue,
8391
+ target: openInNewTab ? "_blank" : "_self"
8392
+ }).run();
8393
+ } else {
8394
+ editor.chain().focus().unsetLink().run();
8395
+ }
8396
+ if (elementId) {
8397
+ window.dispatchEvent(
8398
+ new CustomEvent("elementor:inline-link-changed", {
8399
+ detail: { elementId }
8400
+ })
8401
+ );
8402
+ }
8403
+ linkPopupState.close();
8404
+ };
8405
+ useEffect20(() => {
8406
+ if (!inControlPanel) {
8407
+ editor?.commands?.focus();
8408
+ }
8409
+ }, [editor, inControlPanel]);
8410
+ return /* @__PURE__ */ React116.createElement(
8411
+ Box26,
8412
+ {
8413
+ ref: toolbarRef,
8414
+ sx: {
8415
+ display: "inline-flex",
8416
+ gap: 0.5,
8417
+ padding: 0.5,
8418
+ borderRadius: "8px",
8419
+ backgroundColor: "background.paper",
8420
+ boxShadow: "0 2px 8px rgba(0, 0, 0, 0.2)",
8421
+ alignItems: "center",
8422
+ visibility: linkPopupState.isOpen ? "hidden" : "visible",
8423
+ pointerEvents: linkPopupState.isOpen ? "none" : "all",
8424
+ ...sx,
8425
+ ...inControlPanel && {
8426
+ width: "100%",
8427
+ justifyContent: "center",
8428
+ flexDirection: "row",
8429
+ backgroundColor: "transparent",
8430
+ boxShadow: "none",
8431
+ borderWidth: "0",
8432
+ borderBottom: "1px solid",
8433
+ borderBottomColor: (theme) => theme.palette.text.secondary,
8434
+ borderRadius: "0",
8435
+ position: "absolute",
8436
+ top: "0",
8437
+ left: "0",
8438
+ "&, & .MuiIconButton-root, & .MuiToggleButton-root": {
8439
+ color: (theme) => theme.palette.text.primary
8440
+ }
8441
+ }
8442
+ }
8443
+ },
8444
+ /* @__PURE__ */ React116.createElement(Tooltip10, { title: clearButton.label, placement: "top", sx: { borderRadius: "8px" } }, /* @__PURE__ */ React116.createElement(IconButton9, { "aria-label": clearButton.label, onClick: () => clearButton.method(editor), size: "tiny" }, clearButton.icon)),
8445
+ /* @__PURE__ */ React116.createElement(
8446
+ ToggleButtonGroup2,
8122
8447
  {
8448
+ value: editorState,
8449
+ size: "tiny",
8123
8450
  sx: {
8124
- p: 0.8,
8125
- border: "1px solid",
8126
- borderColor: "grey.200",
8127
- borderRadius: "8px",
8128
- transition: "border-color .2s ease, box-shadow .2s ease",
8129
- "&:hover": {
8130
- borderColor: "black"
8131
- },
8132
- "&:focus-within": {
8133
- borderColor: "black",
8134
- boxShadow: "0 0 0 1px black"
8135
- },
8136
- "& .ProseMirror:focus": {
8137
- outline: "none"
8138
- },
8139
- "& .ProseMirror": {
8140
- minHeight: "70px",
8141
- fontSize: "12px",
8142
- "& a": {
8143
- color: "inherit"
8144
- },
8145
- "& .elementor-inline-editor-reset": {
8146
- margin: 0,
8147
- padding: 0
8451
+ display: "flex",
8452
+ gap: 0.5,
8453
+ border: "none",
8454
+ [`& .${toggleButtonGroupClasses.firstButton}, & .${toggleButtonGroupClasses.middleButton}, & .${toggleButtonGroupClasses.lastButton}`]: {
8455
+ borderRadius: "8px",
8456
+ border: "none",
8457
+ marginLeft: 0,
8458
+ "&.Mui-selected": {
8459
+ marginLeft: 0
8148
8460
  },
8149
- "&.is-empty::before": {
8150
- content: "attr(data-placeholder)",
8151
- color: "text.tertiary",
8152
- pointerEvents: "none",
8153
- position: "absolute",
8154
- opacity: 0.6
8461
+ "& + &.Mui-selected": {
8462
+ marginLeft: 0
8155
8463
  }
8156
8464
  },
8157
- ".strip-styles *": {
8158
- all: "unset"
8159
- },
8160
- ...sx
8161
- },
8162
- ...attributes,
8163
- ...props
8465
+ ...inControlPanel && {
8466
+ justifyContent: "space-between",
8467
+ width: "100%",
8468
+ "& svg": {
8469
+ width: "0.7rem",
8470
+ height: "0.7rem"
8471
+ }
8472
+ }
8473
+ }
8164
8474
  },
8165
- /* @__PURE__ */ React115.createElement(
8166
- InlineEditor,
8475
+ formatButtonsList.map((button) => /* @__PURE__ */ React116.createElement(Tooltip10, { title: button.label, key: button.action, placement: "top" }, /* @__PURE__ */ React116.createElement(
8476
+ ToggleButton3,
8167
8477
  {
8168
- value: content,
8169
- setValue: handleChange,
8170
- placeholder: placeholder?.content?.value ?? null
8171
- }
8172
- )
8173
- ));
8478
+ value: button.action,
8479
+ "aria-label": button.label,
8480
+ size: "tiny",
8481
+ onClick: () => {
8482
+ if (button.action === "link") {
8483
+ handleLinkClick();
8484
+ } else {
8485
+ button.method?.(editor);
8486
+ }
8487
+ editor?.commands?.focus();
8488
+ }
8489
+ },
8490
+ button.icon
8491
+ )))
8492
+ ),
8493
+ /* @__PURE__ */ React116.createElement(
8494
+ UrlPopover,
8495
+ {
8496
+ popupState: linkPopupState,
8497
+ anchorRef: toolbarRef,
8498
+ restoreValue: handleUrlSubmit,
8499
+ value: urlValue,
8500
+ onChange: handleUrlChange,
8501
+ openInNewTab,
8502
+ onToggleNewTab: handleToggleNewTab
8503
+ }
8504
+ )
8505
+ );
8506
+ };
8507
+ var checkIfElementIsClickable = (elementId) => {
8508
+ const container = getContainer2(elementId);
8509
+ const type = container?.model.get("widgetType");
8510
+ const isButton = type === "e-button";
8511
+ const hasLink = !!getElementSetting(elementId, "link")?.value?.destination;
8512
+ return isButton || hasLink;
8513
+ };
8514
+ var toolbarButtons = {
8515
+ clear: {
8516
+ label: __58("Clear", "elementor"),
8517
+ icon: /* @__PURE__ */ React116.createElement(MinusIcon2, { fontSize: "tiny" }),
8518
+ action: "clear",
8519
+ method: (editor) => {
8520
+ editor.chain().focus().clearNodes().unsetAllMarks().run();
8521
+ }
8522
+ },
8523
+ bold: {
8524
+ label: __58("Bold", "elementor"),
8525
+ icon: /* @__PURE__ */ React116.createElement(BoldIcon, { fontSize: "tiny" }),
8526
+ action: "bold",
8527
+ method: (editor) => {
8528
+ editor.chain().focus().toggleBold().run();
8529
+ }
8530
+ },
8531
+ italic: {
8532
+ label: __58("Italic", "elementor"),
8533
+ icon: /* @__PURE__ */ React116.createElement(ItalicIcon, { fontSize: "tiny" }),
8534
+ action: "italic",
8535
+ method: (editor) => {
8536
+ editor.chain().focus().toggleItalic().run();
8537
+ }
8538
+ },
8539
+ underline: {
8540
+ label: __58("Underline", "elementor"),
8541
+ icon: /* @__PURE__ */ React116.createElement(UnderlineIcon, { fontSize: "tiny" }),
8542
+ action: "underline",
8543
+ method: (editor) => {
8544
+ editor.chain().focus().toggleUnderline().run();
8545
+ }
8546
+ },
8547
+ strike: {
8548
+ label: __58("Strikethrough", "elementor"),
8549
+ icon: /* @__PURE__ */ React116.createElement(StrikethroughIcon, { fontSize: "tiny" }),
8550
+ action: "strike",
8551
+ method: (editor) => {
8552
+ editor.chain().focus().toggleStrike().run();
8553
+ }
8554
+ },
8555
+ superscript: {
8556
+ label: __58("Superscript", "elementor"),
8557
+ icon: /* @__PURE__ */ React116.createElement(SuperscriptIcon, { fontSize: "tiny" }),
8558
+ action: "superscript",
8559
+ method: (editor) => {
8560
+ editor.chain().focus().toggleSuperscript().run();
8561
+ }
8562
+ },
8563
+ subscript: {
8564
+ label: __58("Subscript", "elementor"),
8565
+ icon: /* @__PURE__ */ React116.createElement(SubscriptIcon, { fontSize: "tiny" }),
8566
+ action: "subscript",
8567
+ method: (editor) => {
8568
+ editor.chain().focus().toggleSubscript().run();
8569
+ }
8570
+ },
8571
+ link: {
8572
+ label: __58("Link", "elementor"),
8573
+ icon: /* @__PURE__ */ React116.createElement(LinkIcon3, { fontSize: "tiny" }),
8574
+ action: "link",
8575
+ method: null
8174
8576
  }
8175
- );
8577
+ };
8578
+ var { clear: clearButton, ...formatButtons } = toolbarButtons;
8579
+ var possibleFormats = Object.keys(formatButtons);
8580
+
8581
+ // src/controls/inline-editing-control.tsx
8582
+ var InlineEditingControl = createControl(({ sx, attributes, props, context: { elementId } }) => {
8583
+ const { setValue, placeholder, value } = useBoundProp(escapedHtmlPropTypeUtil2);
8584
+ const { value: rawValue } = usePropKeyContext();
8585
+ const content = value ?? extractInlineHtmlContent(rawValue);
8586
+ const [editor, setEditor] = useState20(null);
8587
+ const handleChange = useCallback4(
8588
+ (newValue) => {
8589
+ const html = newValue ?? "";
8590
+ setValue(html);
8591
+ },
8592
+ [setValue]
8593
+ );
8594
+ return /* @__PURE__ */ React117.createElement(ControlActions, null, /* @__PURE__ */ React117.createElement(Box27, { sx: { position: "relative" } }, editor && editor.isEditable && /* @__PURE__ */ React117.createElement(
8595
+ InlineEditorToolbar,
8596
+ {
8597
+ editor,
8598
+ elementId,
8599
+ sx: (theme) => ({
8600
+ boxShadow: "none",
8601
+ border: "1px solid",
8602
+ borderColor: theme.palette.text.secondary,
8603
+ mb: 0.5
8604
+ }),
8605
+ inControlPanel: true
8606
+ }
8607
+ ), /* @__PURE__ */ React117.createElement(
8608
+ Box27,
8609
+ {
8610
+ sx: (theme) => ({
8611
+ p: 0.8,
8612
+ border: "1px solid",
8613
+ borderColor: theme.palette.text.secondary,
8614
+ borderRadius: "8px",
8615
+ transition: "border-color .2s ease, box-shadow .2s ease",
8616
+ "&:hover": {
8617
+ borderColor: theme.palette.text.primary
8618
+ },
8619
+ "&:focus-within": {
8620
+ borderColor: theme.palette.text.primary,
8621
+ boxShadow: `0 0 0 1px ${theme.palette.text.primary}`
8622
+ },
8623
+ "& .ProseMirror:focus": {
8624
+ outline: "none"
8625
+ },
8626
+ "& .ProseMirror": {
8627
+ minHeight: "100px",
8628
+ fontSize: "12px",
8629
+ "& a": {
8630
+ color: "inherit"
8631
+ },
8632
+ "& .elementor-inline-editor-reset": {
8633
+ margin: 0,
8634
+ padding: 0
8635
+ },
8636
+ "&.is-empty::before": {
8637
+ content: "attr(data-placeholder)",
8638
+ color: "text.tertiary",
8639
+ pointerEvents: "none",
8640
+ position: "absolute",
8641
+ opacity: 0.6
8642
+ }
8643
+ },
8644
+ ".strip-styles *": {
8645
+ all: "unset"
8646
+ },
8647
+ ...sx
8648
+ }),
8649
+ ...attributes,
8650
+ ...props
8651
+ },
8652
+ /* @__PURE__ */ React117.createElement(
8653
+ InlineEditor,
8654
+ {
8655
+ value: content,
8656
+ setValue: handleChange,
8657
+ placeholder: placeholder ?? null,
8658
+ onEditorCreate: setEditor,
8659
+ onEditorDestroy: () => setEditor(null),
8660
+ sx: {
8661
+ paddingBlockStart: 5
8662
+ }
8663
+ }
8664
+ )
8665
+ )));
8666
+ });
8176
8667
 
8177
8668
  // src/controls/email-form-action-control/index.tsx
8178
- import * as React119 from "react";
8669
+ import * as React121 from "react";
8179
8670
  import { emailsPropTypeUtil } from "@elementor/editor-props";
8180
8671
  import { CollapsibleContent } from "@elementor/editor-ui";
8181
- import { Box as Box26, Divider as Divider5, Stack as Stack20 } from "@elementor/ui";
8182
- import { __ as __58 } from "@wordpress/i18n";
8672
+ import { Box as Box28, Divider as Divider5, Stack as Stack21 } from "@elementor/ui";
8673
+ import { __ as __60 } from "@wordpress/i18n";
8183
8674
 
8184
8675
  // src/controls/email-form-action-control/fields.tsx
8185
- import * as React118 from "react";
8676
+ import * as React120 from "react";
8186
8677
  import { InfoAlert as InfoAlert2 } from "@elementor/editor-ui";
8187
- import { Grid as Grid34, Stack as Stack19 } from "@elementor/ui";
8188
- import { __ as __57 } from "@wordpress/i18n";
8678
+ import { Grid as Grid34, Stack as Stack20 } from "@elementor/ui";
8679
+ import { __ as __59 } from "@wordpress/i18n";
8189
8680
 
8190
8681
  // src/hooks/use-form-field-suggestions.ts
8191
- import { getContainer as getContainer2, getSelectedElements as getSelectedElements3, getWidgetsCache } from "@elementor/editor-elements";
8192
- import { stringPropTypeUtil as stringPropTypeUtil21 } from "@elementor/editor-props";
8682
+ import { getContainer as getContainer3, getSelectedElements as getSelectedElements3, getWidgetsCache } from "@elementor/editor-elements";
8683
+ import { stringPropTypeUtil as stringPropTypeUtil22 } from "@elementor/editor-props";
8193
8684
  import { __privateUseListenTo as useListenTo2, commandEndEvent as commandEndEvent2, v1ReadyEvent } from "@elementor/editor-v1-adapters";
8194
8685
  var FORM_FIELD_WIDGET_TYPES = [
8195
8686
  "e-form-input",
@@ -8206,7 +8697,7 @@ function isFormFieldWidgetType(widgetType) {
8206
8697
  return FORM_FIELD_WIDGET_TYPES.includes(widgetType);
8207
8698
  }
8208
8699
  function extractStringPropValue(value) {
8209
- return stringPropTypeUtil21.extract(value);
8700
+ return stringPropTypeUtil22.extract(value);
8210
8701
  }
8211
8702
  function getSettingWithDefault(child, widgetType, key) {
8212
8703
  const fromGet = child.settings.get(key);
@@ -8220,7 +8711,7 @@ function getFieldCssId(child, widgetType) {
8220
8711
  return extractStringPropValue(getSettingWithDefault(child, widgetType, CSS_ID_PROP_KEY));
8221
8712
  }
8222
8713
  function getFormContainer(elementId) {
8223
- let container = getContainer2(elementId);
8714
+ let container = getContainer3(elementId);
8224
8715
  while (container) {
8225
8716
  if (container.model.get("elType") === FORM_ELEMENT_TYPE) {
8226
8717
  return container;
@@ -8274,10 +8765,10 @@ function useFormFieldSuggestions(options) {
8274
8765
  }
8275
8766
 
8276
8767
  // src/controls/email-form-action-control/email-chips-field.tsx
8277
- import * as React116 from "react";
8278
- import { useState as useState19 } from "react";
8279
- import { stringArrayPropTypeUtil as stringArrayPropTypeUtil3, stringPropTypeUtil as stringPropTypeUtil22 } from "@elementor/editor-props";
8280
- import { Autocomplete as Autocomplete4, Grid as Grid32, TextField as TextField11 } from "@elementor/ui";
8768
+ import * as React118 from "react";
8769
+ import { useMemo as useMemo18, useState as useState21 } from "react";
8770
+ import { stringArrayPropTypeUtil as stringArrayPropTypeUtil3, stringPropTypeUtil as stringPropTypeUtil23 } from "@elementor/editor-props";
8771
+ import { Autocomplete as Autocomplete4, Grid as Grid32, TextField as TextField12 } from "@elementor/ui";
8281
8772
 
8282
8773
  // src/controls/email-form-action-control/utils.ts
8283
8774
  import { z } from "@elementor/schema";
@@ -8287,6 +8778,10 @@ var CHIP_TRIGGER_KEYS = /* @__PURE__ */ new Set([" ", ","]);
8287
8778
  function isValidEmail(email) {
8288
8779
  return z.string().email().safeParse(email).success;
8289
8780
  }
8781
+ var FORM_FIELD_SHORTCODE_PATTERN = /^\[[^[\]]+]$/;
8782
+ function isFormFieldShortcode(value) {
8783
+ return FORM_FIELD_SHORTCODE_PATTERN.test(value);
8784
+ }
8290
8785
  var shouldShowMentionsInfo = () => {
8291
8786
  if (!hasProInstalled3()) {
8292
8787
  return true;
@@ -8299,27 +8794,39 @@ var shouldShowMentionsInfo = () => {
8299
8794
  };
8300
8795
 
8301
8796
  // src/controls/email-form-action-control/email-chips-field.tsx
8302
- var EmailChipsControl = createControl(({ placeholder }) => {
8797
+ var isValidRecipient = (address) => isValidEmail(address) || isFormFieldShortcode(address);
8798
+ function resolveMention(raw, suggestions) {
8799
+ if (!raw.startsWith("@")) {
8800
+ return raw;
8801
+ }
8802
+ const match = suggestions.find((suggestion) => createMentionPattern(suggestion.value, "start").test(raw));
8803
+ return match ? `[${match.value}]` : raw;
8804
+ }
8805
+ var EmailChipsControl = createControl(({ placeholder, suggestions = [] }) => {
8303
8806
  const { value, setValue, disabled } = useBoundProp(stringArrayPropTypeUtil3);
8304
- const [inputValue, setInputValue] = useState19("");
8807
+ const [inputValue, setInputValue] = useState21("");
8305
8808
  const items2 = value || [];
8306
- const selectedValues = items2.map((item) => stringPropTypeUtil22.extract(item)).filter((val) => val !== null);
8809
+ const selectedValues = items2.map((item) => stringPropTypeUtil23.extract(item)).filter((val) => val !== null);
8810
+ const suggestionOptions = useMemo18(
8811
+ () => suggestions.map((suggestion) => `[${suggestion.value}]`),
8812
+ [suggestions]
8813
+ );
8307
8814
  const tryAddChip = (raw) => {
8308
- const address = raw.trim();
8309
- if (!address || selectedValues.includes(address) || !isValidEmail(address)) {
8815
+ const address = resolveMention(raw.trim(), suggestions);
8816
+ if (!address || selectedValues.includes(address) || !isValidRecipient(address)) {
8310
8817
  return;
8311
8818
  }
8312
- setValue([...items2, stringPropTypeUtil22.create(address)]);
8819
+ setValue([...items2, stringPropTypeUtil23.create(address)]);
8313
8820
  setInputValue("");
8314
8821
  };
8315
8822
  const handleChange = (_, newValue) => {
8316
8823
  const updated = [];
8317
8824
  for (const entry of newValue) {
8318
- const address = entry.trim();
8319
- if (!address || !isValidEmail(address)) {
8825
+ const address = resolveMention(entry.trim(), suggestions);
8826
+ if (!address || !isValidRecipient(address)) {
8320
8827
  continue;
8321
8828
  }
8322
- updated.push(stringPropTypeUtil22.create(address));
8829
+ updated.push(stringPropTypeUtil23.create(address));
8323
8830
  }
8324
8831
  setValue(updated);
8325
8832
  setInputValue("");
@@ -8335,7 +8842,7 @@ var EmailChipsControl = createControl(({ placeholder }) => {
8335
8842
  tryAddChip(inputValue);
8336
8843
  }
8337
8844
  };
8338
- return /* @__PURE__ */ React116.createElement(ControlActions, null, /* @__PURE__ */ React116.createElement(
8845
+ return /* @__PURE__ */ React118.createElement(ControlActions, null, /* @__PURE__ */ React118.createElement(
8339
8846
  Autocomplete4,
8340
8847
  {
8341
8848
  fullWidth: true,
@@ -8351,87 +8858,108 @@ var EmailChipsControl = createControl(({ placeholder }) => {
8351
8858
  },
8352
8859
  value: selectedValues,
8353
8860
  onChange: handleChange,
8354
- options: [],
8861
+ options: suggestionOptions,
8862
+ filterOptions: (options, state) => {
8863
+ const query = state.inputValue.trim().replace(/^@/, "").toLowerCase();
8864
+ return query ? options.filter((option) => option.toLowerCase().includes(query)) : options;
8865
+ },
8866
+ filterSelectedOptions: true,
8355
8867
  onBlur: handleBlur,
8356
8868
  getOptionLabel: (option) => option,
8357
8869
  isOptionEqualToValue: (option, val) => option === val,
8358
- renderInput: (params) => /* @__PURE__ */ React116.createElement(TextField11, { ...params, placeholder, onKeyDown: handleKeyDown }),
8359
- renderTags: (tagValues, getTagProps) => /* @__PURE__ */ React116.createElement(ChipsList, { getLabel: (option) => option, getTagProps, values: tagValues })
8870
+ renderInput: (params) => /* @__PURE__ */ React118.createElement(TextField12, { ...params, placeholder, onKeyDown: handleKeyDown }),
8871
+ renderTags: (tagValues, getTagProps) => /* @__PURE__ */ React118.createElement(ChipsList, { getLabel: (option) => option, getTagProps, values: tagValues })
8360
8872
  }
8361
8873
  ));
8362
8874
  });
8363
- var EmailChipsField = ({ fieldLabel, placeholder }) => /* @__PURE__ */ React116.createElement(Grid32, { container: true, direction: "column", gap: 0.5 }, /* @__PURE__ */ React116.createElement(Grid32, { item: true }, /* @__PURE__ */ React116.createElement(ControlFormLabel, null, fieldLabel)), /* @__PURE__ */ React116.createElement(Grid32, { item: true }, /* @__PURE__ */ React116.createElement(EmailChipsControl, { placeholder })));
8875
+ var EmailChipsField = ({ fieldLabel, placeholder, suggestions }) => /* @__PURE__ */ React118.createElement(Grid32, { container: true, direction: "column", gap: 0.5 }, /* @__PURE__ */ React118.createElement(Grid32, { item: true }, /* @__PURE__ */ React118.createElement(ControlFormLabel, null, fieldLabel)), /* @__PURE__ */ React118.createElement(Grid32, { item: true }, /* @__PURE__ */ React118.createElement(EmailChipsControl, { placeholder, suggestions })));
8364
8876
 
8365
8877
  // src/controls/email-form-action-control/email-field.tsx
8366
- import * as React117 from "react";
8878
+ import * as React119 from "react";
8367
8879
  import { Grid as Grid33 } from "@elementor/ui";
8368
- var EmailField = ({ bind, label, placeholder }) => /* @__PURE__ */ React117.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ React117.createElement(Grid33, { container: true, direction: "column", gap: 0.5 }, /* @__PURE__ */ React117.createElement(Grid33, { item: true }, /* @__PURE__ */ React117.createElement(ControlFormLabel, null, label)), /* @__PURE__ */ React117.createElement(Grid33, { item: true }, /* @__PURE__ */ React117.createElement(TextControl, { placeholder }))));
8880
+ var EmailField = ({ bind, label, placeholder }) => /* @__PURE__ */ React119.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ React119.createElement(Grid33, { container: true, direction: "column", gap: 0.5 }, /* @__PURE__ */ React119.createElement(Grid33, { item: true }, /* @__PURE__ */ React119.createElement(ControlFormLabel, null, label)), /* @__PURE__ */ React119.createElement(Grid33, { item: true }, /* @__PURE__ */ React119.createElement(TextControl, { placeholder }))));
8369
8881
 
8370
8882
  // src/controls/email-form-action-control/fields.tsx
8371
- var SendToField = ({ placeholder }) => /* @__PURE__ */ React118.createElement(PropKeyProvider, { bind: "to" }, /* @__PURE__ */ React118.createElement(EmailChipsField, { fieldLabel: __57("Send to", "elementor"), placeholder }));
8372
- var SubjectField = () => /* @__PURE__ */ React118.createElement(
8883
+ var SendToField = ({ placeholder }) => {
8884
+ const suggestions = useFormFieldSuggestions({ inputType: "email" });
8885
+ return /* @__PURE__ */ React120.createElement(PropKeyProvider, { bind: "to" }, /* @__PURE__ */ React120.createElement(Stack20, { gap: 0.5 }, /* @__PURE__ */ React120.createElement(
8886
+ EmailChipsField,
8887
+ {
8888
+ fieldLabel: __59("Send to", "elementor"),
8889
+ placeholder,
8890
+ suggestions
8891
+ }
8892
+ ), shouldShowMentionsInfo() && /* @__PURE__ */ React120.createElement(InfoAlert2, null, __59("Type @ or an email field name to insert its submitted value.", "elementor"))));
8893
+ };
8894
+ var SubjectField = () => /* @__PURE__ */ React120.createElement(
8373
8895
  EmailField,
8374
8896
  {
8375
8897
  bind: "subject",
8376
- label: __57("Email subject", "elementor"),
8377
- placeholder: __57("New form submission", "elementor")
8898
+ label: __59("Email subject", "elementor"),
8899
+ placeholder: __59("New form submission", "elementor")
8378
8900
  }
8379
8901
  );
8380
8902
  var MessageField = () => {
8381
8903
  const suggestions = useFormFieldSuggestions();
8382
- return /* @__PURE__ */ React118.createElement(PropKeyProvider, { bind: "message" }, /* @__PURE__ */ React118.createElement(Grid34, { container: true, direction: "column", gap: 0.5 }, /* @__PURE__ */ React118.createElement(Grid34, { item: true }, /* @__PURE__ */ React118.createElement(ControlFormLabel, null, __57("Message", "elementor"))), /* @__PURE__ */ React118.createElement(Grid34, { item: true }, /* @__PURE__ */ React118.createElement(MentionTextAreaControl, { suggestions })), /* @__PURE__ */ React118.createElement(Grid34, { item: true }, /* @__PURE__ */ React118.createElement(InfoAlert2, null, shouldShowMentionsInfo() ? __57(
8904
+ return /* @__PURE__ */ React120.createElement(PropKeyProvider, { bind: "message" }, /* @__PURE__ */ React120.createElement(Grid34, { container: true, direction: "column", gap: 0.5 }, /* @__PURE__ */ React120.createElement(Grid34, { item: true }, /* @__PURE__ */ React120.createElement(ControlFormLabel, null, __59("Message", "elementor"))), /* @__PURE__ */ React120.createElement(Grid34, { item: true }, /* @__PURE__ */ React120.createElement(MentionTextAreaControl, { suggestions })), /* @__PURE__ */ React120.createElement(Grid34, { item: true }, /* @__PURE__ */ React120.createElement(InfoAlert2, null, shouldShowMentionsInfo() ? __59(
8383
8905
  "[all-fields] shortcode sends all fields. Type @ to insert specific fields and customize your message.",
8384
8906
  "elementor"
8385
- ) : __57("[all-fields] shortcode sends all fields.", "elementor")))));
8907
+ ) : __59("[all-fields] shortcode sends all fields.", "elementor")))));
8386
8908
  };
8387
- var FromEmailField = () => /* @__PURE__ */ React118.createElement(
8909
+ var FromEmailField = () => /* @__PURE__ */ React120.createElement(
8388
8910
  EmailField,
8389
8911
  {
8390
8912
  bind: "from",
8391
- label: __57("From email", "elementor"),
8392
- placeholder: __57("What email should appear as the sender?", "elementor")
8913
+ label: __59("From email", "elementor"),
8914
+ placeholder: __59("What email should appear as the sender?", "elementor")
8393
8915
  }
8394
8916
  );
8395
- var FromNameField = () => /* @__PURE__ */ React118.createElement(
8917
+ var FromNameField = () => /* @__PURE__ */ React120.createElement(
8396
8918
  EmailField,
8397
8919
  {
8398
8920
  bind: "from-name",
8399
- label: __57("From name", "elementor"),
8400
- placeholder: __57("What name should appear as the sender?", "elementor")
8921
+ label: __59("From name", "elementor"),
8922
+ placeholder: __59("What name should appear as the sender?", "elementor")
8401
8923
  }
8402
8924
  );
8403
8925
  var ReplyToField = () => {
8404
8926
  const emailSuggestions = useFormFieldSuggestions({ inputType: "email" });
8405
- return /* @__PURE__ */ React118.createElement(PropKeyProvider, { bind: "reply-to" }, /* @__PURE__ */ React118.createElement(Grid34, { container: true, direction: "column", gap: 0.5 }, /* @__PURE__ */ React118.createElement(Grid34, { item: true }, /* @__PURE__ */ React118.createElement(ControlFormLabel, null, __57("Reply-to", "elementor"))), /* @__PURE__ */ React118.createElement(Grid34, { item: true }, /* @__PURE__ */ React118.createElement(
8927
+ return /* @__PURE__ */ React120.createElement(PropKeyProvider, { bind: "reply-to" }, /* @__PURE__ */ React120.createElement(Grid34, { container: true, direction: "column", gap: 0.5 }, /* @__PURE__ */ React120.createElement(Grid34, { item: true }, /* @__PURE__ */ React120.createElement(ControlFormLabel, null, __59("Reply-to", "elementor"))), /* @__PURE__ */ React120.createElement(Grid34, { item: true }, /* @__PURE__ */ React120.createElement(
8406
8928
  MentionTextAreaControl,
8407
8929
  {
8408
8930
  suggestions: emailSuggestions,
8409
8931
  rows: 1,
8410
8932
  triggerPosition: "start",
8411
- placeholder: __57("You can type @ to insert an email field", "elementor")
8933
+ placeholder: __59("You can type @ to insert an email field", "elementor")
8412
8934
  }
8413
8935
  ))));
8414
8936
  };
8415
- var CcField = () => /* @__PURE__ */ React118.createElement(PropKeyProvider, { bind: "cc" }, /* @__PURE__ */ React118.createElement(EmailChipsField, { fieldLabel: __57("Cc", "elementor") }));
8416
- var BccField = () => /* @__PURE__ */ React118.createElement(PropKeyProvider, { bind: "bcc" }, /* @__PURE__ */ React118.createElement(EmailChipsField, { fieldLabel: __57("Bcc", "elementor") }));
8417
- var MetaDataField = () => /* @__PURE__ */ React118.createElement(PropKeyProvider, { bind: "meta-data" }, /* @__PURE__ */ React118.createElement(Stack19, { gap: 0.5 }, /* @__PURE__ */ React118.createElement(ControlFormLabel, null, __57("Metadata", "elementor")), /* @__PURE__ */ React118.createElement(
8937
+ var CcField = () => {
8938
+ const suggestions = useFormFieldSuggestions({ inputType: "email" });
8939
+ return /* @__PURE__ */ React120.createElement(PropKeyProvider, { bind: "cc" }, /* @__PURE__ */ React120.createElement(EmailChipsField, { fieldLabel: __59("Cc", "elementor"), suggestions }));
8940
+ };
8941
+ var BccField = () => {
8942
+ const suggestions = useFormFieldSuggestions({ inputType: "email" });
8943
+ return /* @__PURE__ */ React120.createElement(PropKeyProvider, { bind: "bcc" }, /* @__PURE__ */ React120.createElement(EmailChipsField, { fieldLabel: __59("Bcc", "elementor"), suggestions }));
8944
+ };
8945
+ var MetaDataField = () => /* @__PURE__ */ React120.createElement(PropKeyProvider, { bind: "meta-data" }, /* @__PURE__ */ React120.createElement(Stack20, { gap: 0.5 }, /* @__PURE__ */ React120.createElement(ControlFormLabel, null, __59("Metadata", "elementor")), /* @__PURE__ */ React120.createElement(
8418
8946
  ChipsControl,
8419
8947
  {
8420
8948
  options: [
8421
- { label: __57("Date", "elementor"), value: "date" },
8422
- { label: __57("Time", "elementor"), value: "time" },
8423
- { label: __57("Page URL", "elementor"), value: "page-url" },
8424
- { label: __57("User agent", "elementor"), value: "user-agent" },
8425
- { label: __57("Credit", "elementor"), value: "credit" }
8949
+ { label: __59("Date", "elementor"), value: "date" },
8950
+ { label: __59("Time", "elementor"), value: "time" },
8951
+ { label: __59("Page URL", "elementor"), value: "page-url" },
8952
+ { label: __59("User agent", "elementor"), value: "user-agent" },
8953
+ { label: __59("Credit", "elementor"), value: "credit" }
8426
8954
  ]
8427
8955
  }
8428
8956
  )));
8429
- var SendAsField = () => /* @__PURE__ */ React118.createElement(PropKeyProvider, { bind: "send-as" }, /* @__PURE__ */ React118.createElement(Grid34, { container: true, direction: "column", gap: 0.5 }, /* @__PURE__ */ React118.createElement(Grid34, { item: true }, /* @__PURE__ */ React118.createElement(ControlFormLabel, null, __57("Send as", "elementor"))), /* @__PURE__ */ React118.createElement(Grid34, { item: true }, /* @__PURE__ */ React118.createElement(
8957
+ var SendAsField = () => /* @__PURE__ */ React120.createElement(PropKeyProvider, { bind: "send-as" }, /* @__PURE__ */ React120.createElement(Grid34, { container: true, direction: "column", gap: 0.5 }, /* @__PURE__ */ React120.createElement(Grid34, { item: true }, /* @__PURE__ */ React120.createElement(ControlFormLabel, null, __59("Send as", "elementor"))), /* @__PURE__ */ React120.createElement(Grid34, { item: true }, /* @__PURE__ */ React120.createElement(
8430
8958
  SelectControl,
8431
8959
  {
8432
8960
  options: [
8433
- { label: __57("HTML", "elementor"), value: "html" },
8434
- { label: __57("Plain Text", "elementor"), value: "plain" }
8961
+ { label: __59("HTML", "elementor"), value: "html" },
8962
+ { label: __59("Plain Text", "elementor"), value: "plain" }
8435
8963
  ]
8436
8964
  }
8437
8965
  ))));
@@ -8440,27 +8968,27 @@ var SendAsField = () => /* @__PURE__ */ React118.createElement(PropKeyProvider,
8440
8968
  var EmailFormActionControl = createControl(
8441
8969
  ({ toPlaceholder, label }) => {
8442
8970
  const { value, setValue, ...propContext } = useBoundProp(emailsPropTypeUtil);
8443
- return /* @__PURE__ */ React119.createElement(PropProvider, { ...propContext, value, setValue }, /* @__PURE__ */ React119.createElement(Stack20, { gap: 2 }, /* @__PURE__ */ React119.createElement(ControlLabel, null, label ? label + " " + __58("settings", "elementor") : __58("Email settings", "elementor")), /* @__PURE__ */ React119.createElement(SendToField, { placeholder: toPlaceholder }), /* @__PURE__ */ React119.createElement(SubjectField, null), /* @__PURE__ */ React119.createElement(MessageField, null), /* @__PURE__ */ React119.createElement(FromEmailField, null), /* @__PURE__ */ React119.createElement(AdvancedSettings, null)));
8971
+ return /* @__PURE__ */ React121.createElement(PropProvider, { ...propContext, value, setValue }, /* @__PURE__ */ React121.createElement(Stack21, { gap: 2 }, /* @__PURE__ */ React121.createElement(ControlLabel, null, label ? label + " " + __60("settings", "elementor") : __60("Email settings", "elementor")), /* @__PURE__ */ React121.createElement(SendToField, { placeholder: toPlaceholder }), /* @__PURE__ */ React121.createElement(SubjectField, null), /* @__PURE__ */ React121.createElement(MessageField, null), /* @__PURE__ */ React121.createElement(FromEmailField, null), /* @__PURE__ */ React121.createElement(AdvancedSettings, null)));
8444
8972
  }
8445
8973
  );
8446
- var AdvancedSettings = () => /* @__PURE__ */ React119.createElement(CollapsibleContent, { defaultOpen: false }, /* @__PURE__ */ React119.createElement(Box26, { sx: { pt: 2 } }, /* @__PURE__ */ React119.createElement(Stack20, { gap: 2 }, /* @__PURE__ */ React119.createElement(FromNameField, null), /* @__PURE__ */ React119.createElement(ReplyToField, null), /* @__PURE__ */ React119.createElement(CcField, null), /* @__PURE__ */ React119.createElement(BccField, null), /* @__PURE__ */ React119.createElement(Divider5, null), /* @__PURE__ */ React119.createElement(MetaDataField, null), /* @__PURE__ */ React119.createElement(SendAsField, null))));
8974
+ var AdvancedSettings = () => /* @__PURE__ */ React121.createElement(CollapsibleContent, { defaultOpen: false }, /* @__PURE__ */ React121.createElement(Box28, { sx: { pt: 2 } }, /* @__PURE__ */ React121.createElement(Stack21, { gap: 2 }, /* @__PURE__ */ React121.createElement(FromNameField, null), /* @__PURE__ */ React121.createElement(ReplyToField, null), /* @__PURE__ */ React121.createElement(CcField, null), /* @__PURE__ */ React121.createElement(BccField, null), /* @__PURE__ */ React121.createElement(Divider5, null), /* @__PURE__ */ React121.createElement(MetaDataField, null), /* @__PURE__ */ React121.createElement(SendAsField, null))));
8447
8975
 
8448
8976
  // src/controls/attachment-type-control.tsx
8449
- import * as React120 from "react";
8977
+ import * as React122 from "react";
8450
8978
  import { InfoAlert as InfoAlert3 } from "@elementor/editor-ui";
8451
8979
  import { Grid as Grid35 } from "@elementor/ui";
8452
- import { __ as __59 } from "@wordpress/i18n";
8980
+ import { __ as __61 } from "@wordpress/i18n";
8453
8981
  var AttachmentTypeControl = createControl(({ label, options }) => {
8454
- return /* @__PURE__ */ React120.createElement(Grid35, { container: true, direction: "column", gap: 1 }, label && /* @__PURE__ */ React120.createElement(Grid35, { item: true }, /* @__PURE__ */ React120.createElement(ControlFormLabel, null, label)), /* @__PURE__ */ React120.createElement(Grid35, { item: true }, /* @__PURE__ */ React120.createElement(SelectControl, { options })), /* @__PURE__ */ React120.createElement(Grid35, { item: true }, /* @__PURE__ */ React120.createElement(InfoAlert3, null, __59(
8982
+ return /* @__PURE__ */ React122.createElement(Grid35, { container: true, direction: "column", gap: 1 }, label && /* @__PURE__ */ React122.createElement(Grid35, { item: true }, /* @__PURE__ */ React122.createElement(ControlFormLabel, null, label)), /* @__PURE__ */ React122.createElement(Grid35, { item: true }, /* @__PURE__ */ React122.createElement(SelectControl, { options })), /* @__PURE__ */ React122.createElement(Grid35, { item: true }, /* @__PURE__ */ React122.createElement(InfoAlert3, null, __61(
8455
8983
  "Linked uploads are saved to the server. Direct attachments will not appear under Submissions.",
8456
8984
  "elementor"
8457
8985
  ))));
8458
8986
  });
8459
8987
 
8460
8988
  // src/controls/grid-span-control.tsx
8461
- import * as React121 from "react";
8989
+ import * as React123 from "react";
8462
8990
  import { spanPropTypeUtil } from "@elementor/editor-props";
8463
- import { TextField as TextField12 } from "@elementor/ui";
8991
+ import { TextField as TextField13 } from "@elementor/ui";
8464
8992
  var GridSpanControl = createControl(
8465
8993
  ({
8466
8994
  placeholder: propPlaceholder,
@@ -8477,8 +9005,8 @@ var GridSpanControl = createControl(
8477
9005
  setValue(next === "" ? null : next);
8478
9006
  };
8479
9007
  const placeholder = propPlaceholder ?? boundPlaceholder ?? `e.g: 'span 2' or '1 / 3'`;
8480
- return /* @__PURE__ */ React121.createElement(ControlActions, null, /* @__PURE__ */ React121.createElement(
8481
- TextField12,
9008
+ return /* @__PURE__ */ React123.createElement(ControlActions, null, /* @__PURE__ */ React123.createElement(
9009
+ TextField13,
8482
9010
  {
8483
9011
  size: "tiny",
8484
9012
  fullWidth: true,
@@ -8498,23 +9026,23 @@ var GridSpanControl = createControl(
8498
9026
  );
8499
9027
 
8500
9028
  // src/components/promotions/display-conditions-control.tsx
8501
- import * as React123 from "react";
8502
- import { useRef as useRef29 } from "react";
9029
+ import * as React125 from "react";
9030
+ import { useRef as useRef31 } from "react";
8503
9031
  import { SitemapIcon } from "@elementor/icons";
8504
- import { IconButton as IconButton9, Stack as Stack21, Tooltip as Tooltip9 } from "@elementor/ui";
8505
- import { __ as __60 } from "@wordpress/i18n";
9032
+ import { IconButton as IconButton10, Stack as Stack22, Tooltip as Tooltip11 } from "@elementor/ui";
9033
+ import { __ as __62 } from "@wordpress/i18n";
8506
9034
 
8507
9035
  // src/components/promotions/promotion-trigger.tsx
8508
- import * as React122 from "react";
8509
- import { forwardRef as forwardRef12, useCallback as useCallback5, useImperativeHandle, useState as useState20 } from "react";
9036
+ import * as React124 from "react";
9037
+ import { forwardRef as forwardRef12, useCallback as useCallback5, useImperativeHandle, useState as useState22 } from "react";
8510
9038
  import { PromotionChip as PromotionChip2, PromotionInfotip } from "@elementor/editor-ui";
8511
- import { Box as Box27 } from "@elementor/ui";
9039
+ import { Box as Box29 } from "@elementor/ui";
8512
9040
  function getV4Promotion(key) {
8513
9041
  return window.elementor?.config?.v4Promotions?.[key];
8514
9042
  }
8515
9043
  var PromotionTrigger = forwardRef12(
8516
9044
  ({ promotionKey, children, trackingData }, ref) => {
8517
- const [isOpen, setIsOpen] = useState20(false);
9045
+ const [isOpen, setIsOpen] = useState22(false);
8518
9046
  const promotion = getV4Promotion(promotionKey);
8519
9047
  const toggle = useCallback5(() => {
8520
9048
  setIsOpen((prev) => {
@@ -8525,7 +9053,7 @@ var PromotionTrigger = forwardRef12(
8525
9053
  });
8526
9054
  }, [trackingData]);
8527
9055
  useImperativeHandle(ref, () => ({ toggle }), [toggle]);
8528
- return /* @__PURE__ */ React122.createElement(React122.Fragment, null, promotion && /* @__PURE__ */ React122.createElement(
9056
+ return /* @__PURE__ */ React124.createElement(React124.Fragment, null, promotion && /* @__PURE__ */ React124.createElement(
8529
9057
  PromotionInfotip,
8530
9058
  {
8531
9059
  title: promotion.title,
@@ -8539,8 +9067,8 @@ var PromotionTrigger = forwardRef12(
8539
9067
  },
8540
9068
  onCtaClick: () => trackUpgradePromotionClick(trackingData)
8541
9069
  },
8542
- /* @__PURE__ */ React122.createElement(
8543
- Box27,
9070
+ /* @__PURE__ */ React124.createElement(
9071
+ Box29,
8544
9072
  {
8545
9073
  onClick: (e) => {
8546
9074
  e.stopPropagation();
@@ -8548,19 +9076,19 @@ var PromotionTrigger = forwardRef12(
8548
9076
  },
8549
9077
  sx: { cursor: "pointer", display: "inline-flex" }
8550
9078
  },
8551
- children ?? /* @__PURE__ */ React122.createElement(PromotionChip2, null)
9079
+ children ?? /* @__PURE__ */ React124.createElement(PromotionChip2, null)
8552
9080
  )
8553
9081
  ));
8554
9082
  }
8555
9083
  );
8556
9084
 
8557
9085
  // src/components/promotions/display-conditions-control.tsx
8558
- var ARIA_LABEL = __60("Display Conditions", "elementor");
9086
+ var ARIA_LABEL = __62("Display Conditions", "elementor");
8559
9087
  var TRACKING_DATA = { target_name: "display_conditions", location_l2: "general" };
8560
9088
  var DisplayConditionsControl = createControl(() => {
8561
- const triggerRef = useRef29(null);
8562
- return /* @__PURE__ */ React123.createElement(
8563
- Stack21,
9089
+ const triggerRef = useRef31(null);
9090
+ return /* @__PURE__ */ React125.createElement(
9091
+ Stack22,
8564
9092
  {
8565
9093
  direction: "row",
8566
9094
  spacing: 2,
@@ -8569,9 +9097,9 @@ var DisplayConditionsControl = createControl(() => {
8569
9097
  alignItems: "center"
8570
9098
  }
8571
9099
  },
8572
- /* @__PURE__ */ React123.createElement(PromotionTrigger, { ref: triggerRef, promotionKey: "displayConditions", trackingData: TRACKING_DATA }),
8573
- /* @__PURE__ */ React123.createElement(Tooltip9, { title: ARIA_LABEL, placement: "top" }, /* @__PURE__ */ React123.createElement(
8574
- IconButton9,
9100
+ /* @__PURE__ */ React125.createElement(PromotionTrigger, { ref: triggerRef, promotionKey: "displayConditions", trackingData: TRACKING_DATA }),
9101
+ /* @__PURE__ */ React125.createElement(Tooltip11, { title: ARIA_LABEL, placement: "top" }, /* @__PURE__ */ React125.createElement(
9102
+ IconButton10,
8575
9103
  {
8576
9104
  size: "tiny",
8577
9105
  "aria-label": ARIA_LABEL,
@@ -8583,23 +9111,23 @@ var DisplayConditionsControl = createControl(() => {
8583
9111
  borderRadius: 1
8584
9112
  }
8585
9113
  },
8586
- /* @__PURE__ */ React123.createElement(SitemapIcon, { fontSize: "tiny", color: "disabled" })
9114
+ /* @__PURE__ */ React125.createElement(SitemapIcon, { fontSize: "tiny", color: "disabled" })
8587
9115
  ))
8588
9116
  );
8589
9117
  });
8590
9118
 
8591
9119
  // src/components/promotions/attributes-control.tsx
8592
- import * as React124 from "react";
8593
- import { useRef as useRef30 } from "react";
9120
+ import * as React126 from "react";
9121
+ import { useRef as useRef32 } from "react";
8594
9122
  import { PlusIcon as PlusIcon4 } from "@elementor/icons";
8595
- import { Stack as Stack22, Tooltip as Tooltip10 } from "@elementor/ui";
8596
- import { __ as __61 } from "@wordpress/i18n";
8597
- var ARIA_LABEL2 = __61("Attributes", "elementor");
9123
+ import { Stack as Stack23, Tooltip as Tooltip12 } from "@elementor/ui";
9124
+ import { __ as __63 } from "@wordpress/i18n";
9125
+ var ARIA_LABEL2 = __63("Attributes", "elementor");
8598
9126
  var TRACKING_DATA2 = { target_name: "attributes", location_l2: "general" };
8599
9127
  var AttributesControl = createControl(() => {
8600
- const triggerRef = useRef30(null);
8601
- return /* @__PURE__ */ React124.createElement(
8602
- Stack22,
9128
+ const triggerRef = useRef32(null);
9129
+ return /* @__PURE__ */ React126.createElement(
9130
+ Stack23,
8603
9131
  {
8604
9132
  direction: "row",
8605
9133
  spacing: 2,
@@ -8608,8 +9136,8 @@ var AttributesControl = createControl(() => {
8608
9136
  alignItems: "center"
8609
9137
  }
8610
9138
  },
8611
- /* @__PURE__ */ React124.createElement(PromotionTrigger, { ref: triggerRef, promotionKey: "attributes", trackingData: TRACKING_DATA2 }),
8612
- /* @__PURE__ */ React124.createElement(Tooltip10, { title: ARIA_LABEL2, placement: "top" }, /* @__PURE__ */ React124.createElement(
9139
+ /* @__PURE__ */ React126.createElement(PromotionTrigger, { ref: triggerRef, promotionKey: "attributes", trackingData: TRACKING_DATA2 }),
9140
+ /* @__PURE__ */ React126.createElement(Tooltip12, { title: ARIA_LABEL2, placement: "top" }, /* @__PURE__ */ React126.createElement(
8613
9141
  PlusIcon4,
8614
9142
  {
8615
9143
  "aria-label": ARIA_LABEL2,
@@ -8623,29 +9151,29 @@ var AttributesControl = createControl(() => {
8623
9151
  });
8624
9152
 
8625
9153
  // src/components/icon-buttons/clear-icon-button.tsx
8626
- import * as React125 from "react";
9154
+ import * as React127 from "react";
8627
9155
  import { BrushBigIcon } from "@elementor/icons";
8628
- import { IconButton as IconButton10, styled as styled11, Tooltip as Tooltip11 } from "@elementor/ui";
8629
- var CustomIconButton = styled11(IconButton10)(({ theme }) => ({
9156
+ import { IconButton as IconButton11, styled as styled11, Tooltip as Tooltip13 } from "@elementor/ui";
9157
+ var CustomIconButton = styled11(IconButton11)(({ theme }) => ({
8630
9158
  width: theme.spacing(2.5),
8631
9159
  height: theme.spacing(2.5)
8632
9160
  }));
8633
- var ClearIconButton = ({ tooltipText, onClick, disabled, size = "tiny" }) => /* @__PURE__ */ React125.createElement(Tooltip11, { title: tooltipText, placement: "top", disableInteractive: true }, /* @__PURE__ */ React125.createElement(CustomIconButton, { "aria-label": tooltipText, size, onClick, disabled }, /* @__PURE__ */ React125.createElement(BrushBigIcon, { fontSize: size })));
9161
+ var ClearIconButton = ({ tooltipText, onClick, disabled, size = "tiny" }) => /* @__PURE__ */ React127.createElement(Tooltip13, { title: tooltipText, placement: "top", disableInteractive: true }, /* @__PURE__ */ React127.createElement(CustomIconButton, { "aria-label": tooltipText, size, onClick, disabled }, /* @__PURE__ */ React127.createElement(BrushBigIcon, { fontSize: size })));
8634
9162
 
8635
9163
  // src/components/repeater/repeater.tsx
8636
- import * as React126 from "react";
8637
- import { useEffect as useEffect19, useState as useState21 } from "react";
9164
+ import * as React128 from "react";
9165
+ import { useEffect as useEffect21, useState as useState23 } from "react";
8638
9166
  import { CopyIcon as CopyIcon2, EyeIcon as EyeIcon2, EyeOffIcon as EyeOffIcon2, PlusIcon as PlusIcon5, XIcon as XIcon4 } from "@elementor/icons";
8639
9167
  import {
8640
- bindPopover as bindPopover8,
9168
+ bindPopover as bindPopover9,
8641
9169
  bindTrigger as bindTrigger7,
8642
- Box as Box28,
8643
- IconButton as IconButton11,
9170
+ Box as Box30,
9171
+ IconButton as IconButton12,
8644
9172
  Infotip as Infotip4,
8645
- Tooltip as Tooltip12,
8646
- usePopupState as usePopupState10
9173
+ Tooltip as Tooltip14,
9174
+ usePopupState as usePopupState11
8647
9175
  } from "@elementor/ui";
8648
- import { __ as __62 } from "@wordpress/i18n";
9176
+ import { __ as __64 } from "@wordpress/i18n";
8649
9177
  var SIZE12 = "tiny";
8650
9178
  var EMPTY_OPEN_ITEM2 = -1;
8651
9179
  var Repeater3 = ({
@@ -8664,7 +9192,7 @@ var Repeater3 = ({
8664
9192
  isSortable = true,
8665
9193
  adornment = ControlAdornments
8666
9194
  }) => {
8667
- const [openItem, setOpenItem] = useState21(initialOpenItem);
9195
+ const [openItem, setOpenItem] = useState23(initialOpenItem);
8668
9196
  const uniqueKeys = items2.map(
8669
9197
  (item, index) => isSortable && "getId" in itemSettings ? itemSettings.getId({ item, index }) : String(index)
8670
9198
  );
@@ -8727,8 +9255,8 @@ var Repeater3 = ({
8727
9255
  };
8728
9256
  const isButtonDisabled = disabled || disableAddItemButton;
8729
9257
  const shouldShowInfotip = isButtonDisabled && addButtonInfotipContent;
8730
- const addButton = /* @__PURE__ */ React126.createElement(
8731
- IconButton11,
9258
+ const addButton = /* @__PURE__ */ React128.createElement(
9259
+ IconButton12,
8732
9260
  {
8733
9261
  size: SIZE12,
8734
9262
  sx: {
@@ -8736,11 +9264,11 @@ var Repeater3 = ({
8736
9264
  },
8737
9265
  disabled: isButtonDisabled,
8738
9266
  onClick: addRepeaterItem,
8739
- "aria-label": __62("Add item", "elementor")
9267
+ "aria-label": __64("Add item", "elementor")
8740
9268
  },
8741
- /* @__PURE__ */ React126.createElement(PlusIcon5, { fontSize: SIZE12 })
9269
+ /* @__PURE__ */ React128.createElement(PlusIcon5, { fontSize: SIZE12 })
8742
9270
  );
8743
- return /* @__PURE__ */ React126.createElement(SectionContent, { gap: 2 }, /* @__PURE__ */ React126.createElement(RepeaterHeader, { label, adornment }, shouldShowInfotip ? /* @__PURE__ */ React126.createElement(
9271
+ return /* @__PURE__ */ React128.createElement(SectionContent, { gap: 2 }, /* @__PURE__ */ React128.createElement(RepeaterHeader, { label, adornment }, shouldShowInfotip ? /* @__PURE__ */ React128.createElement(
8744
9272
  Infotip4,
8745
9273
  {
8746
9274
  placement: "right",
@@ -8748,20 +9276,20 @@ var Repeater3 = ({
8748
9276
  color: "secondary",
8749
9277
  slotProps: { popper: { sx: { width: 300 } } }
8750
9278
  },
8751
- /* @__PURE__ */ React126.createElement(Box28, { sx: { ...isButtonDisabled ? { cursor: "not-allowed" } : {} } }, addButton)
8752
- ) : addButton), 0 < uniqueKeys.length && /* @__PURE__ */ React126.createElement(SortableProvider, { value: uniqueKeys, onChange: onChangeOrder }, uniqueKeys.map((key) => {
9279
+ /* @__PURE__ */ React128.createElement(Box30, { sx: { ...isButtonDisabled ? { cursor: "not-allowed" } : {} } }, addButton)
9280
+ ) : addButton), 0 < uniqueKeys.length && /* @__PURE__ */ React128.createElement(SortableProvider, { value: uniqueKeys, onChange: onChangeOrder }, uniqueKeys.map((key) => {
8753
9281
  const index = uniqueKeys.indexOf(key);
8754
9282
  const value = items2[index];
8755
9283
  if (!value) {
8756
9284
  return null;
8757
9285
  }
8758
- return /* @__PURE__ */ React126.createElement(SortableItem, { id: key, key: `sortable-${key}`, disabled: !isSortable }, /* @__PURE__ */ React126.createElement(
9286
+ return /* @__PURE__ */ React128.createElement(SortableItem, { id: key, key: `sortable-${key}`, disabled: !isSortable }, /* @__PURE__ */ React128.createElement(
8759
9287
  RepeaterItem,
8760
9288
  {
8761
9289
  disabled,
8762
9290
  propDisabled: value?.disabled,
8763
- label: /* @__PURE__ */ React126.createElement(RepeaterItemLabelSlot, { value }, /* @__PURE__ */ React126.createElement(itemSettings.Label, { value, index })),
8764
- startIcon: /* @__PURE__ */ React126.createElement(RepeaterItemIconSlot, { value }, /* @__PURE__ */ React126.createElement(itemSettings.Icon, { value })),
9291
+ label: /* @__PURE__ */ React128.createElement(RepeaterItemLabelSlot, { value }, /* @__PURE__ */ React128.createElement(itemSettings.Label, { value, index })),
9292
+ startIcon: /* @__PURE__ */ React128.createElement(RepeaterItemIconSlot, { value }, /* @__PURE__ */ React128.createElement(itemSettings.Icon, { value })),
8765
9293
  removeItem: () => removeRepeaterItem(index),
8766
9294
  duplicateItem: () => duplicateRepeaterItem(index),
8767
9295
  toggleDisableItem: () => toggleDisableRepeaterItem(index),
@@ -8775,7 +9303,7 @@ var Repeater3 = ({
8775
9303
  actions: itemSettings.actions,
8776
9304
  value
8777
9305
  },
8778
- (props) => /* @__PURE__ */ React126.createElement(
9306
+ (props) => /* @__PURE__ */ React128.createElement(
8779
9307
  itemSettings.Content,
8780
9308
  {
8781
9309
  ...props,
@@ -8817,16 +9345,16 @@ var RepeaterItem = ({
8817
9345
  );
8818
9346
  const triggerProps = bindTrigger7(popoverState);
8819
9347
  usePopoverDismiss({ isOpen: popoverState.isOpen, onClose: popoverProps.onClose });
8820
- const duplicateLabel = __62("Duplicate", "elementor");
8821
- const toggleLabel = propDisabled ? __62("Show", "elementor") : __62("Hide", "elementor");
8822
- const removeLabel = __62("Remove", "elementor");
8823
- return /* @__PURE__ */ React126.createElement(Box28, { sx: { display: "contents" } }, /* @__PURE__ */ React126.createElement(
9348
+ const duplicateLabel = __64("Duplicate", "elementor");
9349
+ const toggleLabel = propDisabled ? __64("Show", "elementor") : __64("Hide", "elementor");
9350
+ const removeLabel = __64("Remove", "elementor");
9351
+ return /* @__PURE__ */ React128.createElement(Box30, { sx: { display: "contents" } }, /* @__PURE__ */ React128.createElement(
8824
9352
  RepeaterTag,
8825
9353
  {
8826
9354
  disabled,
8827
9355
  label,
8828
9356
  ref: setRef,
8829
- "aria-label": __62("Open item", "elementor"),
9357
+ "aria-label": __64("Open item", "elementor"),
8830
9358
  ...triggerProps,
8831
9359
  onClick: (e) => {
8832
9360
  triggerProps.onClick(e);
@@ -8835,15 +9363,15 @@ var RepeaterItem = ({
8835
9363
  }
8836
9364
  },
8837
9365
  startIcon,
8838
- actions: /* @__PURE__ */ React126.createElement(React126.Fragment, null, showDuplicate && /* @__PURE__ */ React126.createElement(Tooltip12, { title: duplicateLabel, placement: "top" }, /* @__PURE__ */ React126.createElement(IconButton11, { size: SIZE12, onClick: duplicateItem, "aria-label": duplicateLabel }, /* @__PURE__ */ React126.createElement(CopyIcon2, { fontSize: SIZE12 }))), showToggle && /* @__PURE__ */ React126.createElement(Tooltip12, { title: toggleLabel, placement: "top" }, /* @__PURE__ */ React126.createElement(IconButton11, { size: SIZE12, onClick: toggleDisableItem, "aria-label": toggleLabel }, propDisabled ? /* @__PURE__ */ React126.createElement(EyeOffIcon2, { fontSize: SIZE12 }) : /* @__PURE__ */ React126.createElement(EyeIcon2, { fontSize: SIZE12 }))), actions?.(value), showRemove && /* @__PURE__ */ React126.createElement(Tooltip12, { title: removeLabel, placement: "top" }, /* @__PURE__ */ React126.createElement(IconButton11, { size: SIZE12, onClick: removeItem, "aria-label": removeLabel }, /* @__PURE__ */ React126.createElement(XIcon4, { fontSize: SIZE12 }))))
9366
+ actions: /* @__PURE__ */ React128.createElement(React128.Fragment, null, showDuplicate && /* @__PURE__ */ React128.createElement(Tooltip14, { title: duplicateLabel, placement: "top" }, /* @__PURE__ */ React128.createElement(IconButton12, { size: SIZE12, onClick: duplicateItem, "aria-label": duplicateLabel }, /* @__PURE__ */ React128.createElement(CopyIcon2, { fontSize: SIZE12 }))), showToggle && /* @__PURE__ */ React128.createElement(Tooltip14, { title: toggleLabel, placement: "top" }, /* @__PURE__ */ React128.createElement(IconButton12, { size: SIZE12, onClick: toggleDisableItem, "aria-label": toggleLabel }, propDisabled ? /* @__PURE__ */ React128.createElement(EyeOffIcon2, { fontSize: SIZE12 }) : /* @__PURE__ */ React128.createElement(EyeIcon2, { fontSize: SIZE12 }))), actions?.(value), showRemove && /* @__PURE__ */ React128.createElement(Tooltip14, { title: removeLabel, placement: "top" }, /* @__PURE__ */ React128.createElement(IconButton12, { size: SIZE12, onClick: removeItem, "aria-label": removeLabel }, /* @__PURE__ */ React128.createElement(XIcon4, { fontSize: SIZE12 }))))
8839
9367
  }
8840
- ), /* @__PURE__ */ React126.createElement(RepeaterPopover, { width: ref?.getBoundingClientRect().width, ...popoverProps, anchorEl: ref }, /* @__PURE__ */ React126.createElement(Box28, null, children({ anchorEl: ref }))));
9368
+ ), /* @__PURE__ */ React128.createElement(RepeaterPopover, { width: ref?.getBoundingClientRect().width, ...popoverProps, anchorEl: ref }, /* @__PURE__ */ React128.createElement(Box30, null, children({ anchorEl: ref }))));
8841
9369
  };
8842
9370
  var usePopover = (openOnMount, onOpen, onPopoverClose) => {
8843
- const [ref, setRef] = useState21(null);
8844
- const popoverState = usePopupState10({ variant: "popover" });
8845
- const popoverProps = bindPopover8(popoverState);
8846
- useEffect19(() => {
9371
+ const [ref, setRef] = useState23(null);
9372
+ const popoverState = usePopupState11({ variant: "popover" });
9373
+ const popoverProps = bindPopover9(popoverState);
9374
+ useEffect21(() => {
8847
9375
  if (openOnMount && ref) {
8848
9376
  popoverState.open(ref);
8849
9377
  onOpen?.();
@@ -8861,293 +9389,6 @@ var usePopover = (openOnMount, onOpen, onPopoverClose) => {
8861
9389
  };
8862
9390
  };
8863
9391
 
8864
- // src/components/inline-editor-toolbar.tsx
8865
- import * as React128 from "react";
8866
- import { useEffect as useEffect21, useMemo as useMemo18, useRef as useRef32, useState as useState22 } from "react";
8867
- import { getContainer as getContainer3, getElementSetting } from "@elementor/editor-elements";
8868
- import {
8869
- BoldIcon,
8870
- ItalicIcon,
8871
- LinkIcon as LinkIcon3,
8872
- MinusIcon as MinusIcon2,
8873
- StrikethroughIcon,
8874
- SubscriptIcon,
8875
- SuperscriptIcon,
8876
- UnderlineIcon
8877
- } from "@elementor/icons";
8878
- import {
8879
- Box as Box29,
8880
- IconButton as IconButton12,
8881
- ToggleButton as ToggleButton3,
8882
- ToggleButtonGroup as ToggleButtonGroup2,
8883
- toggleButtonGroupClasses,
8884
- Tooltip as Tooltip14,
8885
- usePopupState as usePopupState11
8886
- } from "@elementor/ui";
8887
- import { useEditorState } from "@tiptap/react";
8888
- import { __ as __64 } from "@wordpress/i18n";
8889
-
8890
- // src/components/url-popover.tsx
8891
- import * as React127 from "react";
8892
- import { useEffect as useEffect20, useRef as useRef31 } from "react";
8893
- import { ExternalLinkIcon } from "@elementor/icons";
8894
- import { bindPopover as bindPopover9, Popover as Popover8, Stack as Stack23, TextField as TextField13, ToggleButton as ToggleButton2, Tooltip as Tooltip13 } from "@elementor/ui";
8895
- import { __ as __63 } from "@wordpress/i18n";
8896
- var UrlPopover = ({
8897
- popupState,
8898
- restoreValue,
8899
- anchorRef,
8900
- value,
8901
- onChange,
8902
- openInNewTab,
8903
- onToggleNewTab
8904
- }) => {
8905
- const inputRef = useRef31(null);
8906
- useEffect20(() => {
8907
- if (popupState.isOpen) {
8908
- requestAnimationFrame(() => inputRef.current?.focus());
8909
- }
8910
- }, [popupState.isOpen]);
8911
- const handleClose = () => {
8912
- restoreValue();
8913
- popupState.close();
8914
- };
8915
- return /* @__PURE__ */ React127.createElement(
8916
- Popover8,
8917
- {
8918
- slotProps: {
8919
- paper: { sx: { borderRadius: "16px", width: anchorRef.current?.offsetWidth + "px", marginTop: -1 } }
8920
- },
8921
- ...bindPopover9(popupState),
8922
- anchorOrigin: { vertical: "top", horizontal: "left" },
8923
- transformOrigin: { vertical: "top", horizontal: "left" },
8924
- onClose: handleClose
8925
- },
8926
- /* @__PURE__ */ React127.createElement(Stack23, { direction: "row", alignItems: "center", gap: 1, sx: { p: 1.5 } }, /* @__PURE__ */ React127.createElement(
8927
- TextField13,
8928
- {
8929
- value,
8930
- onChange,
8931
- size: "tiny",
8932
- fullWidth: true,
8933
- placeholder: __63("Type a URL", "elementor"),
8934
- inputProps: { ref: inputRef },
8935
- color: "secondary",
8936
- InputProps: { sx: { borderRadius: "8px" } },
8937
- onKeyUp: (event) => event.key === "Enter" && handleClose()
8938
- }
8939
- ), /* @__PURE__ */ React127.createElement(Tooltip13, { title: __63("Open in a new tab", "elementor") }, /* @__PURE__ */ React127.createElement(
8940
- ToggleButton2,
8941
- {
8942
- size: "tiny",
8943
- value: "newTab",
8944
- selected: openInNewTab,
8945
- onClick: onToggleNewTab,
8946
- "aria-label": __63("Open in a new tab", "elementor"),
8947
- sx: { borderRadius: "8px" }
8948
- },
8949
- /* @__PURE__ */ React127.createElement(ExternalLinkIcon, { fontSize: "tiny" })
8950
- )))
8951
- );
8952
- };
8953
-
8954
- // src/components/inline-editor-toolbar.tsx
8955
- var InlineEditorToolbar = ({ editor, elementId, sx = {} }) => {
8956
- const [urlValue, setUrlValue] = useState22("");
8957
- const [openInNewTab, setOpenInNewTab] = useState22(false);
8958
- const toolbarRef = useRef32(null);
8959
- const linkPopupState = usePopupState11({ variant: "popover" });
8960
- const isElementClickable = elementId ? checkIfElementIsClickable(elementId) : false;
8961
- const editorState = useEditorState({
8962
- editor,
8963
- selector: (ctx) => possibleFormats.filter((format) => ctx.editor.isActive(format))
8964
- });
8965
- const formatButtonsList = useMemo18(() => {
8966
- const buttons = Object.values(formatButtons);
8967
- if (isElementClickable) {
8968
- return buttons.filter((button) => button.action !== "link");
8969
- }
8970
- return buttons;
8971
- }, [isElementClickable]);
8972
- const handleLinkClick = () => {
8973
- const linkAttrs = editor.getAttributes("link");
8974
- setUrlValue(linkAttrs.href || "");
8975
- setOpenInNewTab(linkAttrs.target === "_blank");
8976
- linkPopupState.open(toolbarRef.current);
8977
- };
8978
- const handleUrlChange = (event) => {
8979
- setUrlValue(event.target.value);
8980
- };
8981
- const handleToggleNewTab = () => {
8982
- setOpenInNewTab(!openInNewTab);
8983
- };
8984
- const handleUrlSubmit = () => {
8985
- if (urlValue) {
8986
- editor.chain().focus().setLink({
8987
- href: urlValue,
8988
- target: openInNewTab ? "_blank" : "_self"
8989
- }).run();
8990
- } else {
8991
- editor.chain().focus().unsetLink().run();
8992
- }
8993
- if (elementId) {
8994
- window.dispatchEvent(
8995
- new CustomEvent("elementor:inline-link-changed", {
8996
- detail: { elementId }
8997
- })
8998
- );
8999
- }
9000
- linkPopupState.close();
9001
- };
9002
- useEffect21(() => {
9003
- editor?.commands?.focus();
9004
- }, [editor]);
9005
- return /* @__PURE__ */ React128.createElement(
9006
- Box29,
9007
- {
9008
- ref: toolbarRef,
9009
- sx: {
9010
- display: "inline-flex",
9011
- gap: 0.5,
9012
- padding: 0.5,
9013
- borderRadius: "8px",
9014
- backgroundColor: "background.paper",
9015
- boxShadow: "0 2px 8px rgba(0, 0, 0, 0.2)",
9016
- alignItems: "center",
9017
- visibility: linkPopupState.isOpen ? "hidden" : "visible",
9018
- pointerEvents: linkPopupState.isOpen ? "none" : "all",
9019
- ...sx
9020
- }
9021
- },
9022
- /* @__PURE__ */ React128.createElement(Tooltip14, { title: clearButton.label, placement: "top", sx: { borderRadius: "8px" } }, /* @__PURE__ */ React128.createElement(IconButton12, { "aria-label": clearButton.label, onClick: () => clearButton.method(editor), size: "tiny" }, clearButton.icon)),
9023
- /* @__PURE__ */ React128.createElement(
9024
- ToggleButtonGroup2,
9025
- {
9026
- value: editorState,
9027
- size: "tiny",
9028
- sx: {
9029
- display: "flex",
9030
- gap: 0.5,
9031
- border: "none",
9032
- [`& .${toggleButtonGroupClasses.firstButton}, & .${toggleButtonGroupClasses.middleButton}, & .${toggleButtonGroupClasses.lastButton}`]: {
9033
- borderRadius: "8px",
9034
- border: "none",
9035
- marginLeft: 0,
9036
- "&.Mui-selected": {
9037
- marginLeft: 0
9038
- },
9039
- "& + &.Mui-selected": {
9040
- marginLeft: 0
9041
- }
9042
- }
9043
- }
9044
- },
9045
- formatButtonsList.map((button) => /* @__PURE__ */ React128.createElement(Tooltip14, { title: button.label, key: button.action, placement: "top" }, /* @__PURE__ */ React128.createElement(
9046
- ToggleButton3,
9047
- {
9048
- value: button.action,
9049
- "aria-label": button.label,
9050
- size: "tiny",
9051
- onClick: () => {
9052
- if (button.action === "link") {
9053
- handleLinkClick();
9054
- } else {
9055
- button.method?.(editor);
9056
- }
9057
- editor?.commands?.focus();
9058
- }
9059
- },
9060
- button.icon
9061
- )))
9062
- ),
9063
- /* @__PURE__ */ React128.createElement(
9064
- UrlPopover,
9065
- {
9066
- popupState: linkPopupState,
9067
- anchorRef: toolbarRef,
9068
- restoreValue: handleUrlSubmit,
9069
- value: urlValue,
9070
- onChange: handleUrlChange,
9071
- openInNewTab,
9072
- onToggleNewTab: handleToggleNewTab
9073
- }
9074
- )
9075
- );
9076
- };
9077
- var checkIfElementIsClickable = (elementId) => {
9078
- const container = getContainer3(elementId);
9079
- const type = container?.model.get("widgetType");
9080
- const isButton = type === "e-button";
9081
- const hasLink = !!getElementSetting(elementId, "link")?.value?.destination;
9082
- return isButton || hasLink;
9083
- };
9084
- var toolbarButtons = {
9085
- clear: {
9086
- label: __64("Clear", "elementor"),
9087
- icon: /* @__PURE__ */ React128.createElement(MinusIcon2, { fontSize: "tiny" }),
9088
- action: "clear",
9089
- method: (editor) => {
9090
- editor.chain().focus().clearNodes().unsetAllMarks().run();
9091
- }
9092
- },
9093
- bold: {
9094
- label: __64("Bold", "elementor"),
9095
- icon: /* @__PURE__ */ React128.createElement(BoldIcon, { fontSize: "tiny" }),
9096
- action: "bold",
9097
- method: (editor) => {
9098
- editor.chain().focus().toggleBold().run();
9099
- }
9100
- },
9101
- italic: {
9102
- label: __64("Italic", "elementor"),
9103
- icon: /* @__PURE__ */ React128.createElement(ItalicIcon, { fontSize: "tiny" }),
9104
- action: "italic",
9105
- method: (editor) => {
9106
- editor.chain().focus().toggleItalic().run();
9107
- }
9108
- },
9109
- underline: {
9110
- label: __64("Underline", "elementor"),
9111
- icon: /* @__PURE__ */ React128.createElement(UnderlineIcon, { fontSize: "tiny" }),
9112
- action: "underline",
9113
- method: (editor) => {
9114
- editor.chain().focus().toggleUnderline().run();
9115
- }
9116
- },
9117
- strike: {
9118
- label: __64("Strikethrough", "elementor"),
9119
- icon: /* @__PURE__ */ React128.createElement(StrikethroughIcon, { fontSize: "tiny" }),
9120
- action: "strike",
9121
- method: (editor) => {
9122
- editor.chain().focus().toggleStrike().run();
9123
- }
9124
- },
9125
- superscript: {
9126
- label: __64("Superscript", "elementor"),
9127
- icon: /* @__PURE__ */ React128.createElement(SuperscriptIcon, { fontSize: "tiny" }),
9128
- action: "superscript",
9129
- method: (editor) => {
9130
- editor.chain().focus().toggleSuperscript().run();
9131
- }
9132
- },
9133
- subscript: {
9134
- label: __64("Subscript", "elementor"),
9135
- icon: /* @__PURE__ */ React128.createElement(SubscriptIcon, { fontSize: "tiny" }),
9136
- action: "subscript",
9137
- method: (editor) => {
9138
- editor.chain().focus().toggleSubscript().run();
9139
- }
9140
- },
9141
- link: {
9142
- label: __64("Link", "elementor"),
9143
- icon: /* @__PURE__ */ React128.createElement(LinkIcon3, { fontSize: "tiny" }),
9144
- action: "link",
9145
- method: null
9146
- }
9147
- };
9148
- var { clear: clearButton, ...formatButtons } = toolbarButtons;
9149
- var possibleFormats = Object.keys(formatButtons);
9150
-
9151
9392
  // src/components/size/unstable-size-field.tsx
9152
9393
  import * as React131 from "react";
9153
9394
  import { InputAdornment as InputAdornment6 } from "@elementor/ui";