@elementor/editor-controls 4.3.0-998 → 4.4.0-1064

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,426 @@ 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: "grey.200",
8434
+ borderRadius: "0",
8435
+ position: "absolute",
8436
+ top: "0",
8437
+ left: "0"
8438
+ }
8439
+ }
8440
+ },
8441
+ /* @__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)),
8442
+ /* @__PURE__ */ React116.createElement(
8443
+ ToggleButtonGroup2,
8122
8444
  {
8445
+ value: editorState,
8446
+ size: "tiny",
8123
8447
  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
8448
+ display: "flex",
8449
+ gap: 0.5,
8450
+ border: "none",
8451
+ [`& .${toggleButtonGroupClasses.firstButton}, & .${toggleButtonGroupClasses.middleButton}, & .${toggleButtonGroupClasses.lastButton}`]: {
8452
+ borderRadius: "8px",
8453
+ border: "none",
8454
+ marginLeft: 0,
8455
+ "&.Mui-selected": {
8456
+ marginLeft: 0
8148
8457
  },
8149
- "&.is-empty::before": {
8150
- content: "attr(data-placeholder)",
8151
- color: "text.tertiary",
8152
- pointerEvents: "none",
8153
- position: "absolute",
8154
- opacity: 0.6
8458
+ "& + &.Mui-selected": {
8459
+ marginLeft: 0
8155
8460
  }
8156
8461
  },
8157
- ".strip-styles *": {
8158
- all: "unset"
8159
- },
8160
- ...sx
8161
- },
8162
- ...attributes,
8163
- ...props
8462
+ ...inControlPanel && {
8463
+ justifyContent: "space-between",
8464
+ width: "100%",
8465
+ "& svg": {
8466
+ width: "0.7rem",
8467
+ height: "0.7rem",
8468
+ fill: "black"
8469
+ }
8470
+ }
8471
+ }
8164
8472
  },
8165
- /* @__PURE__ */ React115.createElement(
8166
- InlineEditor,
8473
+ formatButtonsList.map((button) => /* @__PURE__ */ React116.createElement(Tooltip10, { title: button.label, key: button.action, placement: "top" }, /* @__PURE__ */ React116.createElement(
8474
+ ToggleButton3,
8167
8475
  {
8168
- value: content,
8169
- setValue: handleChange,
8170
- placeholder: placeholder?.content?.value ?? null
8171
- }
8172
- )
8173
- ));
8174
- }
8175
- );
8476
+ value: button.action,
8477
+ "aria-label": button.label,
8478
+ size: "tiny",
8479
+ onClick: () => {
8480
+ if (button.action === "link") {
8481
+ handleLinkClick();
8482
+ } else {
8483
+ button.method?.(editor);
8484
+ }
8485
+ editor?.commands?.focus();
8486
+ }
8487
+ },
8488
+ button.icon
8489
+ )))
8490
+ ),
8491
+ /* @__PURE__ */ React116.createElement(
8492
+ UrlPopover,
8493
+ {
8494
+ popupState: linkPopupState,
8495
+ anchorRef: toolbarRef,
8496
+ restoreValue: handleUrlSubmit,
8497
+ value: urlValue,
8498
+ onChange: handleUrlChange,
8499
+ openInNewTab,
8500
+ onToggleNewTab: handleToggleNewTab
8501
+ }
8502
+ )
8503
+ );
8504
+ };
8505
+ var checkIfElementIsClickable = (elementId) => {
8506
+ const container = getContainer2(elementId);
8507
+ const type = container?.model.get("widgetType");
8508
+ const isButton = type === "e-button";
8509
+ const hasLink = !!getElementSetting(elementId, "link")?.value?.destination;
8510
+ return isButton || hasLink;
8511
+ };
8512
+ var toolbarButtons = {
8513
+ clear: {
8514
+ label: __58("Clear", "elementor"),
8515
+ icon: /* @__PURE__ */ React116.createElement(MinusIcon2, { fontSize: "tiny" }),
8516
+ action: "clear",
8517
+ method: (editor) => {
8518
+ editor.chain().focus().clearNodes().unsetAllMarks().run();
8519
+ }
8520
+ },
8521
+ bold: {
8522
+ label: __58("Bold", "elementor"),
8523
+ icon: /* @__PURE__ */ React116.createElement(BoldIcon, { fontSize: "tiny" }),
8524
+ action: "bold",
8525
+ method: (editor) => {
8526
+ editor.chain().focus().toggleBold().run();
8527
+ }
8528
+ },
8529
+ italic: {
8530
+ label: __58("Italic", "elementor"),
8531
+ icon: /* @__PURE__ */ React116.createElement(ItalicIcon, { fontSize: "tiny" }),
8532
+ action: "italic",
8533
+ method: (editor) => {
8534
+ editor.chain().focus().toggleItalic().run();
8535
+ }
8536
+ },
8537
+ underline: {
8538
+ label: __58("Underline", "elementor"),
8539
+ icon: /* @__PURE__ */ React116.createElement(UnderlineIcon, { fontSize: "tiny" }),
8540
+ action: "underline",
8541
+ method: (editor) => {
8542
+ editor.chain().focus().toggleUnderline().run();
8543
+ }
8544
+ },
8545
+ strike: {
8546
+ label: __58("Strikethrough", "elementor"),
8547
+ icon: /* @__PURE__ */ React116.createElement(StrikethroughIcon, { fontSize: "tiny" }),
8548
+ action: "strike",
8549
+ method: (editor) => {
8550
+ editor.chain().focus().toggleStrike().run();
8551
+ }
8552
+ },
8553
+ superscript: {
8554
+ label: __58("Superscript", "elementor"),
8555
+ icon: /* @__PURE__ */ React116.createElement(SuperscriptIcon, { fontSize: "tiny" }),
8556
+ action: "superscript",
8557
+ method: (editor) => {
8558
+ editor.chain().focus().toggleSuperscript().run();
8559
+ }
8560
+ },
8561
+ subscript: {
8562
+ label: __58("Subscript", "elementor"),
8563
+ icon: /* @__PURE__ */ React116.createElement(SubscriptIcon, { fontSize: "tiny" }),
8564
+ action: "subscript",
8565
+ method: (editor) => {
8566
+ editor.chain().focus().toggleSubscript().run();
8567
+ }
8568
+ },
8569
+ link: {
8570
+ label: __58("Link", "elementor"),
8571
+ icon: /* @__PURE__ */ React116.createElement(LinkIcon3, { fontSize: "tiny" }),
8572
+ action: "link",
8573
+ method: null
8574
+ }
8575
+ };
8576
+ var { clear: clearButton, ...formatButtons } = toolbarButtons;
8577
+ var possibleFormats = Object.keys(formatButtons);
8578
+
8579
+ // src/controls/inline-editing-control.tsx
8580
+ var InlineEditingControl = createControl(({ sx, attributes, props, context: { elementId } }) => {
8581
+ const { setValue, placeholder, value } = useBoundProp(escapedHtmlPropTypeUtil2);
8582
+ const { value: rawValue } = usePropKeyContext();
8583
+ const content = value ?? extractInlineHtmlContent(rawValue);
8584
+ const [editor, setEditor] = useState20(null);
8585
+ const handleChange = useCallback4(
8586
+ (newValue) => {
8587
+ const html = newValue ?? "";
8588
+ setValue(html);
8589
+ },
8590
+ [setValue]
8591
+ );
8592
+ return /* @__PURE__ */ React117.createElement(ControlActions, null, /* @__PURE__ */ React117.createElement(Box27, { sx: { position: "relative" } }, editor && editor.isEditable && /* @__PURE__ */ React117.createElement(
8593
+ InlineEditorToolbar,
8594
+ {
8595
+ editor,
8596
+ elementId,
8597
+ sx: {
8598
+ boxShadow: "none",
8599
+ border: "1px solid",
8600
+ borderColor: "grey.200",
8601
+ mb: 0.5
8602
+ },
8603
+ inControlPanel: true
8604
+ }
8605
+ ), /* @__PURE__ */ React117.createElement(
8606
+ Box27,
8607
+ {
8608
+ sx: {
8609
+ p: 0.8,
8610
+ border: "1px solid",
8611
+ borderColor: "grey.200",
8612
+ borderRadius: "8px",
8613
+ transition: "border-color .2s ease, box-shadow .2s ease",
8614
+ "&:hover": {
8615
+ borderColor: "black"
8616
+ },
8617
+ "&:focus-within": {
8618
+ borderColor: "black",
8619
+ boxShadow: "0 0 0 1px black"
8620
+ },
8621
+ "& .ProseMirror:focus": {
8622
+ outline: "none"
8623
+ },
8624
+ "& .ProseMirror": {
8625
+ minHeight: "100px",
8626
+ fontSize: "12px",
8627
+ "& a": {
8628
+ color: "inherit"
8629
+ },
8630
+ "& .elementor-inline-editor-reset": {
8631
+ margin: 0,
8632
+ padding: 0
8633
+ },
8634
+ "&.is-empty::before": {
8635
+ content: "attr(data-placeholder)",
8636
+ color: "text.tertiary",
8637
+ pointerEvents: "none",
8638
+ position: "absolute",
8639
+ opacity: 0.6
8640
+ }
8641
+ },
8642
+ ".strip-styles *": {
8643
+ all: "unset"
8644
+ },
8645
+ ...sx
8646
+ },
8647
+ ...attributes,
8648
+ ...props
8649
+ },
8650
+ /* @__PURE__ */ React117.createElement(
8651
+ InlineEditor,
8652
+ {
8653
+ value: content,
8654
+ setValue: handleChange,
8655
+ placeholder: placeholder ?? null,
8656
+ onEditorCreate: setEditor,
8657
+ onEditorDestroy: () => setEditor(null),
8658
+ sx: {
8659
+ paddingBlockStart: 5
8660
+ }
8661
+ }
8662
+ )
8663
+ )));
8664
+ });
8176
8665
 
8177
8666
  // src/controls/email-form-action-control/index.tsx
8178
- import * as React119 from "react";
8667
+ import * as React121 from "react";
8179
8668
  import { emailsPropTypeUtil } from "@elementor/editor-props";
8180
8669
  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";
8670
+ import { Box as Box28, Divider as Divider5, Stack as Stack21 } from "@elementor/ui";
8671
+ import { __ as __60 } from "@wordpress/i18n";
8183
8672
 
8184
8673
  // src/controls/email-form-action-control/fields.tsx
8185
- import * as React118 from "react";
8674
+ import * as React120 from "react";
8186
8675
  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";
8676
+ import { Grid as Grid34, Stack as Stack20 } from "@elementor/ui";
8677
+ import { __ as __59 } from "@wordpress/i18n";
8189
8678
 
8190
8679
  // 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";
8680
+ import { getContainer as getContainer3, getSelectedElements as getSelectedElements3, getWidgetsCache } from "@elementor/editor-elements";
8681
+ import { stringPropTypeUtil as stringPropTypeUtil22 } from "@elementor/editor-props";
8193
8682
  import { __privateUseListenTo as useListenTo2, commandEndEvent as commandEndEvent2, v1ReadyEvent } from "@elementor/editor-v1-adapters";
8194
8683
  var FORM_FIELD_WIDGET_TYPES = [
8195
8684
  "e-form-input",
@@ -8206,7 +8695,7 @@ function isFormFieldWidgetType(widgetType) {
8206
8695
  return FORM_FIELD_WIDGET_TYPES.includes(widgetType);
8207
8696
  }
8208
8697
  function extractStringPropValue(value) {
8209
- return stringPropTypeUtil21.extract(value);
8698
+ return stringPropTypeUtil22.extract(value);
8210
8699
  }
8211
8700
  function getSettingWithDefault(child, widgetType, key) {
8212
8701
  const fromGet = child.settings.get(key);
@@ -8220,7 +8709,7 @@ function getFieldCssId(child, widgetType) {
8220
8709
  return extractStringPropValue(getSettingWithDefault(child, widgetType, CSS_ID_PROP_KEY));
8221
8710
  }
8222
8711
  function getFormContainer(elementId) {
8223
- let container = getContainer2(elementId);
8712
+ let container = getContainer3(elementId);
8224
8713
  while (container) {
8225
8714
  if (container.model.get("elType") === FORM_ELEMENT_TYPE) {
8226
8715
  return container;
@@ -8274,10 +8763,10 @@ function useFormFieldSuggestions(options) {
8274
8763
  }
8275
8764
 
8276
8765
  // 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";
8766
+ import * as React118 from "react";
8767
+ import { useMemo as useMemo18, useState as useState21 } from "react";
8768
+ import { stringArrayPropTypeUtil as stringArrayPropTypeUtil3, stringPropTypeUtil as stringPropTypeUtil23 } from "@elementor/editor-props";
8769
+ import { Autocomplete as Autocomplete4, Grid as Grid32, TextField as TextField12 } from "@elementor/ui";
8281
8770
 
8282
8771
  // src/controls/email-form-action-control/utils.ts
8283
8772
  import { z } from "@elementor/schema";
@@ -8287,6 +8776,10 @@ var CHIP_TRIGGER_KEYS = /* @__PURE__ */ new Set([" ", ","]);
8287
8776
  function isValidEmail(email) {
8288
8777
  return z.string().email().safeParse(email).success;
8289
8778
  }
8779
+ var FORM_FIELD_SHORTCODE_PATTERN = /^\[[^[\]]+]$/;
8780
+ function isFormFieldShortcode(value) {
8781
+ return FORM_FIELD_SHORTCODE_PATTERN.test(value);
8782
+ }
8290
8783
  var shouldShowMentionsInfo = () => {
8291
8784
  if (!hasProInstalled3()) {
8292
8785
  return true;
@@ -8299,27 +8792,39 @@ var shouldShowMentionsInfo = () => {
8299
8792
  };
8300
8793
 
8301
8794
  // src/controls/email-form-action-control/email-chips-field.tsx
8302
- var EmailChipsControl = createControl(({ placeholder }) => {
8795
+ var isValidRecipient = (address) => isValidEmail(address) || isFormFieldShortcode(address);
8796
+ function resolveMention(raw, suggestions) {
8797
+ if (!raw.startsWith("@")) {
8798
+ return raw;
8799
+ }
8800
+ const match = suggestions.find((suggestion) => createMentionPattern(suggestion.value, "start").test(raw));
8801
+ return match ? `[${match.value}]` : raw;
8802
+ }
8803
+ var EmailChipsControl = createControl(({ placeholder, suggestions = [] }) => {
8303
8804
  const { value, setValue, disabled } = useBoundProp(stringArrayPropTypeUtil3);
8304
- const [inputValue, setInputValue] = useState19("");
8805
+ const [inputValue, setInputValue] = useState21("");
8305
8806
  const items2 = value || [];
8306
- const selectedValues = items2.map((item) => stringPropTypeUtil22.extract(item)).filter((val) => val !== null);
8807
+ const selectedValues = items2.map((item) => stringPropTypeUtil23.extract(item)).filter((val) => val !== null);
8808
+ const suggestionOptions = useMemo18(
8809
+ () => suggestions.map((suggestion) => `[${suggestion.value}]`),
8810
+ [suggestions]
8811
+ );
8307
8812
  const tryAddChip = (raw) => {
8308
- const address = raw.trim();
8309
- if (!address || selectedValues.includes(address) || !isValidEmail(address)) {
8813
+ const address = resolveMention(raw.trim(), suggestions);
8814
+ if (!address || selectedValues.includes(address) || !isValidRecipient(address)) {
8310
8815
  return;
8311
8816
  }
8312
- setValue([...items2, stringPropTypeUtil22.create(address)]);
8817
+ setValue([...items2, stringPropTypeUtil23.create(address)]);
8313
8818
  setInputValue("");
8314
8819
  };
8315
8820
  const handleChange = (_, newValue) => {
8316
8821
  const updated = [];
8317
8822
  for (const entry of newValue) {
8318
- const address = entry.trim();
8319
- if (!address || !isValidEmail(address)) {
8823
+ const address = resolveMention(entry.trim(), suggestions);
8824
+ if (!address || !isValidRecipient(address)) {
8320
8825
  continue;
8321
8826
  }
8322
- updated.push(stringPropTypeUtil22.create(address));
8827
+ updated.push(stringPropTypeUtil23.create(address));
8323
8828
  }
8324
8829
  setValue(updated);
8325
8830
  setInputValue("");
@@ -8335,7 +8840,7 @@ var EmailChipsControl = createControl(({ placeholder }) => {
8335
8840
  tryAddChip(inputValue);
8336
8841
  }
8337
8842
  };
8338
- return /* @__PURE__ */ React116.createElement(ControlActions, null, /* @__PURE__ */ React116.createElement(
8843
+ return /* @__PURE__ */ React118.createElement(ControlActions, null, /* @__PURE__ */ React118.createElement(
8339
8844
  Autocomplete4,
8340
8845
  {
8341
8846
  fullWidth: true,
@@ -8351,87 +8856,108 @@ var EmailChipsControl = createControl(({ placeholder }) => {
8351
8856
  },
8352
8857
  value: selectedValues,
8353
8858
  onChange: handleChange,
8354
- options: [],
8859
+ options: suggestionOptions,
8860
+ filterOptions: (options, state) => {
8861
+ const query = state.inputValue.trim().replace(/^@/, "").toLowerCase();
8862
+ return query ? options.filter((option) => option.toLowerCase().includes(query)) : options;
8863
+ },
8864
+ filterSelectedOptions: true,
8355
8865
  onBlur: handleBlur,
8356
8866
  getOptionLabel: (option) => option,
8357
8867
  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 })
8868
+ renderInput: (params) => /* @__PURE__ */ React118.createElement(TextField12, { ...params, placeholder, onKeyDown: handleKeyDown }),
8869
+ renderTags: (tagValues, getTagProps) => /* @__PURE__ */ React118.createElement(ChipsList, { getLabel: (option) => option, getTagProps, values: tagValues })
8360
8870
  }
8361
8871
  ));
8362
8872
  });
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 })));
8873
+ 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
8874
 
8365
8875
  // src/controls/email-form-action-control/email-field.tsx
8366
- import * as React117 from "react";
8876
+ import * as React119 from "react";
8367
8877
  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 }))));
8878
+ 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
8879
 
8370
8880
  // 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(
8881
+ var SendToField = ({ placeholder }) => {
8882
+ const suggestions = useFormFieldSuggestions({ inputType: "email" });
8883
+ return /* @__PURE__ */ React120.createElement(PropKeyProvider, { bind: "to" }, /* @__PURE__ */ React120.createElement(Stack20, { gap: 0.5 }, /* @__PURE__ */ React120.createElement(
8884
+ EmailChipsField,
8885
+ {
8886
+ fieldLabel: __59("Send to", "elementor"),
8887
+ placeholder,
8888
+ suggestions
8889
+ }
8890
+ ), shouldShowMentionsInfo() && /* @__PURE__ */ React120.createElement(InfoAlert2, null, __59("Type @ or an email field name to insert its submitted value.", "elementor"))));
8891
+ };
8892
+ var SubjectField = () => /* @__PURE__ */ React120.createElement(
8373
8893
  EmailField,
8374
8894
  {
8375
8895
  bind: "subject",
8376
- label: __57("Email subject", "elementor"),
8377
- placeholder: __57("New form submission", "elementor")
8896
+ label: __59("Email subject", "elementor"),
8897
+ placeholder: __59("New form submission", "elementor")
8378
8898
  }
8379
8899
  );
8380
8900
  var MessageField = () => {
8381
8901
  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(
8902
+ 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
8903
  "[all-fields] shortcode sends all fields. Type @ to insert specific fields and customize your message.",
8384
8904
  "elementor"
8385
- ) : __57("[all-fields] shortcode sends all fields.", "elementor")))));
8905
+ ) : __59("[all-fields] shortcode sends all fields.", "elementor")))));
8386
8906
  };
8387
- var FromEmailField = () => /* @__PURE__ */ React118.createElement(
8907
+ var FromEmailField = () => /* @__PURE__ */ React120.createElement(
8388
8908
  EmailField,
8389
8909
  {
8390
8910
  bind: "from",
8391
- label: __57("From email", "elementor"),
8392
- placeholder: __57("What email should appear as the sender?", "elementor")
8911
+ label: __59("From email", "elementor"),
8912
+ placeholder: __59("What email should appear as the sender?", "elementor")
8393
8913
  }
8394
8914
  );
8395
- var FromNameField = () => /* @__PURE__ */ React118.createElement(
8915
+ var FromNameField = () => /* @__PURE__ */ React120.createElement(
8396
8916
  EmailField,
8397
8917
  {
8398
8918
  bind: "from-name",
8399
- label: __57("From name", "elementor"),
8400
- placeholder: __57("What name should appear as the sender?", "elementor")
8919
+ label: __59("From name", "elementor"),
8920
+ placeholder: __59("What name should appear as the sender?", "elementor")
8401
8921
  }
8402
8922
  );
8403
8923
  var ReplyToField = () => {
8404
8924
  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(
8925
+ 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
8926
  MentionTextAreaControl,
8407
8927
  {
8408
8928
  suggestions: emailSuggestions,
8409
8929
  rows: 1,
8410
8930
  triggerPosition: "start",
8411
- placeholder: __57("You can type @ to insert an email field", "elementor")
8931
+ placeholder: __59("You can type @ to insert an email field", "elementor")
8412
8932
  }
8413
8933
  ))));
8414
8934
  };
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(
8935
+ var CcField = () => {
8936
+ const suggestions = useFormFieldSuggestions({ inputType: "email" });
8937
+ return /* @__PURE__ */ React120.createElement(PropKeyProvider, { bind: "cc" }, /* @__PURE__ */ React120.createElement(EmailChipsField, { fieldLabel: __59("Cc", "elementor"), suggestions }));
8938
+ };
8939
+ var BccField = () => {
8940
+ const suggestions = useFormFieldSuggestions({ inputType: "email" });
8941
+ return /* @__PURE__ */ React120.createElement(PropKeyProvider, { bind: "bcc" }, /* @__PURE__ */ React120.createElement(EmailChipsField, { fieldLabel: __59("Bcc", "elementor"), suggestions }));
8942
+ };
8943
+ 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
8944
  ChipsControl,
8419
8945
  {
8420
8946
  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" }
8947
+ { label: __59("Date", "elementor"), value: "date" },
8948
+ { label: __59("Time", "elementor"), value: "time" },
8949
+ { label: __59("Page URL", "elementor"), value: "page-url" },
8950
+ { label: __59("User agent", "elementor"), value: "user-agent" },
8951
+ { label: __59("Credit", "elementor"), value: "credit" }
8426
8952
  ]
8427
8953
  }
8428
8954
  )));
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(
8955
+ 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
8956
  SelectControl,
8431
8957
  {
8432
8958
  options: [
8433
- { label: __57("HTML", "elementor"), value: "html" },
8434
- { label: __57("Plain Text", "elementor"), value: "plain" }
8959
+ { label: __59("HTML", "elementor"), value: "html" },
8960
+ { label: __59("Plain Text", "elementor"), value: "plain" }
8435
8961
  ]
8436
8962
  }
8437
8963
  ))));
@@ -8440,27 +8966,27 @@ var SendAsField = () => /* @__PURE__ */ React118.createElement(PropKeyProvider,
8440
8966
  var EmailFormActionControl = createControl(
8441
8967
  ({ toPlaceholder, label }) => {
8442
8968
  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)));
8969
+ 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
8970
  }
8445
8971
  );
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))));
8972
+ 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
8973
 
8448
8974
  // src/controls/attachment-type-control.tsx
8449
- import * as React120 from "react";
8975
+ import * as React122 from "react";
8450
8976
  import { InfoAlert as InfoAlert3 } from "@elementor/editor-ui";
8451
8977
  import { Grid as Grid35 } from "@elementor/ui";
8452
- import { __ as __59 } from "@wordpress/i18n";
8978
+ import { __ as __61 } from "@wordpress/i18n";
8453
8979
  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(
8980
+ 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
8981
  "Linked uploads are saved to the server. Direct attachments will not appear under Submissions.",
8456
8982
  "elementor"
8457
8983
  ))));
8458
8984
  });
8459
8985
 
8460
8986
  // src/controls/grid-span-control.tsx
8461
- import * as React121 from "react";
8987
+ import * as React123 from "react";
8462
8988
  import { spanPropTypeUtil } from "@elementor/editor-props";
8463
- import { TextField as TextField12 } from "@elementor/ui";
8989
+ import { TextField as TextField13 } from "@elementor/ui";
8464
8990
  var GridSpanControl = createControl(
8465
8991
  ({
8466
8992
  placeholder: propPlaceholder,
@@ -8477,8 +9003,8 @@ var GridSpanControl = createControl(
8477
9003
  setValue(next === "" ? null : next);
8478
9004
  };
8479
9005
  const placeholder = propPlaceholder ?? boundPlaceholder ?? `e.g: 'span 2' or '1 / 3'`;
8480
- return /* @__PURE__ */ React121.createElement(ControlActions, null, /* @__PURE__ */ React121.createElement(
8481
- TextField12,
9006
+ return /* @__PURE__ */ React123.createElement(ControlActions, null, /* @__PURE__ */ React123.createElement(
9007
+ TextField13,
8482
9008
  {
8483
9009
  size: "tiny",
8484
9010
  fullWidth: true,
@@ -8498,23 +9024,23 @@ var GridSpanControl = createControl(
8498
9024
  );
8499
9025
 
8500
9026
  // src/components/promotions/display-conditions-control.tsx
8501
- import * as React123 from "react";
8502
- import { useRef as useRef29 } from "react";
9027
+ import * as React125 from "react";
9028
+ import { useRef as useRef31 } from "react";
8503
9029
  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";
9030
+ import { IconButton as IconButton10, Stack as Stack22, Tooltip as Tooltip11 } from "@elementor/ui";
9031
+ import { __ as __62 } from "@wordpress/i18n";
8506
9032
 
8507
9033
  // 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";
9034
+ import * as React124 from "react";
9035
+ import { forwardRef as forwardRef12, useCallback as useCallback5, useImperativeHandle, useState as useState22 } from "react";
8510
9036
  import { PromotionChip as PromotionChip2, PromotionInfotip } from "@elementor/editor-ui";
8511
- import { Box as Box27 } from "@elementor/ui";
9037
+ import { Box as Box29 } from "@elementor/ui";
8512
9038
  function getV4Promotion(key) {
8513
9039
  return window.elementor?.config?.v4Promotions?.[key];
8514
9040
  }
8515
9041
  var PromotionTrigger = forwardRef12(
8516
9042
  ({ promotionKey, children, trackingData }, ref) => {
8517
- const [isOpen, setIsOpen] = useState20(false);
9043
+ const [isOpen, setIsOpen] = useState22(false);
8518
9044
  const promotion = getV4Promotion(promotionKey);
8519
9045
  const toggle = useCallback5(() => {
8520
9046
  setIsOpen((prev) => {
@@ -8525,7 +9051,7 @@ var PromotionTrigger = forwardRef12(
8525
9051
  });
8526
9052
  }, [trackingData]);
8527
9053
  useImperativeHandle(ref, () => ({ toggle }), [toggle]);
8528
- return /* @__PURE__ */ React122.createElement(React122.Fragment, null, promotion && /* @__PURE__ */ React122.createElement(
9054
+ return /* @__PURE__ */ React124.createElement(React124.Fragment, null, promotion && /* @__PURE__ */ React124.createElement(
8529
9055
  PromotionInfotip,
8530
9056
  {
8531
9057
  title: promotion.title,
@@ -8539,8 +9065,8 @@ var PromotionTrigger = forwardRef12(
8539
9065
  },
8540
9066
  onCtaClick: () => trackUpgradePromotionClick(trackingData)
8541
9067
  },
8542
- /* @__PURE__ */ React122.createElement(
8543
- Box27,
9068
+ /* @__PURE__ */ React124.createElement(
9069
+ Box29,
8544
9070
  {
8545
9071
  onClick: (e) => {
8546
9072
  e.stopPropagation();
@@ -8548,19 +9074,19 @@ var PromotionTrigger = forwardRef12(
8548
9074
  },
8549
9075
  sx: { cursor: "pointer", display: "inline-flex" }
8550
9076
  },
8551
- children ?? /* @__PURE__ */ React122.createElement(PromotionChip2, null)
9077
+ children ?? /* @__PURE__ */ React124.createElement(PromotionChip2, null)
8552
9078
  )
8553
9079
  ));
8554
9080
  }
8555
9081
  );
8556
9082
 
8557
9083
  // src/components/promotions/display-conditions-control.tsx
8558
- var ARIA_LABEL = __60("Display Conditions", "elementor");
9084
+ var ARIA_LABEL = __62("Display Conditions", "elementor");
8559
9085
  var TRACKING_DATA = { target_name: "display_conditions", location_l2: "general" };
8560
9086
  var DisplayConditionsControl = createControl(() => {
8561
- const triggerRef = useRef29(null);
8562
- return /* @__PURE__ */ React123.createElement(
8563
- Stack21,
9087
+ const triggerRef = useRef31(null);
9088
+ return /* @__PURE__ */ React125.createElement(
9089
+ Stack22,
8564
9090
  {
8565
9091
  direction: "row",
8566
9092
  spacing: 2,
@@ -8569,9 +9095,9 @@ var DisplayConditionsControl = createControl(() => {
8569
9095
  alignItems: "center"
8570
9096
  }
8571
9097
  },
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,
9098
+ /* @__PURE__ */ React125.createElement(PromotionTrigger, { ref: triggerRef, promotionKey: "displayConditions", trackingData: TRACKING_DATA }),
9099
+ /* @__PURE__ */ React125.createElement(Tooltip11, { title: ARIA_LABEL, placement: "top" }, /* @__PURE__ */ React125.createElement(
9100
+ IconButton10,
8575
9101
  {
8576
9102
  size: "tiny",
8577
9103
  "aria-label": ARIA_LABEL,
@@ -8583,23 +9109,23 @@ var DisplayConditionsControl = createControl(() => {
8583
9109
  borderRadius: 1
8584
9110
  }
8585
9111
  },
8586
- /* @__PURE__ */ React123.createElement(SitemapIcon, { fontSize: "tiny", color: "disabled" })
9112
+ /* @__PURE__ */ React125.createElement(SitemapIcon, { fontSize: "tiny", color: "disabled" })
8587
9113
  ))
8588
9114
  );
8589
9115
  });
8590
9116
 
8591
9117
  // src/components/promotions/attributes-control.tsx
8592
- import * as React124 from "react";
8593
- import { useRef as useRef30 } from "react";
9118
+ import * as React126 from "react";
9119
+ import { useRef as useRef32 } from "react";
8594
9120
  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");
9121
+ import { Stack as Stack23, Tooltip as Tooltip12 } from "@elementor/ui";
9122
+ import { __ as __63 } from "@wordpress/i18n";
9123
+ var ARIA_LABEL2 = __63("Attributes", "elementor");
8598
9124
  var TRACKING_DATA2 = { target_name: "attributes", location_l2: "general" };
8599
9125
  var AttributesControl = createControl(() => {
8600
- const triggerRef = useRef30(null);
8601
- return /* @__PURE__ */ React124.createElement(
8602
- Stack22,
9126
+ const triggerRef = useRef32(null);
9127
+ return /* @__PURE__ */ React126.createElement(
9128
+ Stack23,
8603
9129
  {
8604
9130
  direction: "row",
8605
9131
  spacing: 2,
@@ -8608,8 +9134,8 @@ var AttributesControl = createControl(() => {
8608
9134
  alignItems: "center"
8609
9135
  }
8610
9136
  },
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(
9137
+ /* @__PURE__ */ React126.createElement(PromotionTrigger, { ref: triggerRef, promotionKey: "attributes", trackingData: TRACKING_DATA2 }),
9138
+ /* @__PURE__ */ React126.createElement(Tooltip12, { title: ARIA_LABEL2, placement: "top" }, /* @__PURE__ */ React126.createElement(
8613
9139
  PlusIcon4,
8614
9140
  {
8615
9141
  "aria-label": ARIA_LABEL2,
@@ -8623,29 +9149,29 @@ var AttributesControl = createControl(() => {
8623
9149
  });
8624
9150
 
8625
9151
  // src/components/icon-buttons/clear-icon-button.tsx
8626
- import * as React125 from "react";
9152
+ import * as React127 from "react";
8627
9153
  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 }) => ({
9154
+ import { IconButton as IconButton11, styled as styled11, Tooltip as Tooltip13 } from "@elementor/ui";
9155
+ var CustomIconButton = styled11(IconButton11)(({ theme }) => ({
8630
9156
  width: theme.spacing(2.5),
8631
9157
  height: theme.spacing(2.5)
8632
9158
  }));
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 })));
9159
+ 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
9160
 
8635
9161
  // src/components/repeater/repeater.tsx
8636
- import * as React126 from "react";
8637
- import { useEffect as useEffect19, useState as useState21 } from "react";
9162
+ import * as React128 from "react";
9163
+ import { useEffect as useEffect21, useState as useState23 } from "react";
8638
9164
  import { CopyIcon as CopyIcon2, EyeIcon as EyeIcon2, EyeOffIcon as EyeOffIcon2, PlusIcon as PlusIcon5, XIcon as XIcon4 } from "@elementor/icons";
8639
9165
  import {
8640
- bindPopover as bindPopover8,
9166
+ bindPopover as bindPopover9,
8641
9167
  bindTrigger as bindTrigger7,
8642
- Box as Box28,
8643
- IconButton as IconButton11,
9168
+ Box as Box30,
9169
+ IconButton as IconButton12,
8644
9170
  Infotip as Infotip4,
8645
- Tooltip as Tooltip12,
8646
- usePopupState as usePopupState10
9171
+ Tooltip as Tooltip14,
9172
+ usePopupState as usePopupState11
8647
9173
  } from "@elementor/ui";
8648
- import { __ as __62 } from "@wordpress/i18n";
9174
+ import { __ as __64 } from "@wordpress/i18n";
8649
9175
  var SIZE12 = "tiny";
8650
9176
  var EMPTY_OPEN_ITEM2 = -1;
8651
9177
  var Repeater3 = ({
@@ -8664,7 +9190,7 @@ var Repeater3 = ({
8664
9190
  isSortable = true,
8665
9191
  adornment = ControlAdornments
8666
9192
  }) => {
8667
- const [openItem, setOpenItem] = useState21(initialOpenItem);
9193
+ const [openItem, setOpenItem] = useState23(initialOpenItem);
8668
9194
  const uniqueKeys = items2.map(
8669
9195
  (item, index) => isSortable && "getId" in itemSettings ? itemSettings.getId({ item, index }) : String(index)
8670
9196
  );
@@ -8727,8 +9253,8 @@ var Repeater3 = ({
8727
9253
  };
8728
9254
  const isButtonDisabled = disabled || disableAddItemButton;
8729
9255
  const shouldShowInfotip = isButtonDisabled && addButtonInfotipContent;
8730
- const addButton = /* @__PURE__ */ React126.createElement(
8731
- IconButton11,
9256
+ const addButton = /* @__PURE__ */ React128.createElement(
9257
+ IconButton12,
8732
9258
  {
8733
9259
  size: SIZE12,
8734
9260
  sx: {
@@ -8736,11 +9262,11 @@ var Repeater3 = ({
8736
9262
  },
8737
9263
  disabled: isButtonDisabled,
8738
9264
  onClick: addRepeaterItem,
8739
- "aria-label": __62("Add item", "elementor")
9265
+ "aria-label": __64("Add item", "elementor")
8740
9266
  },
8741
- /* @__PURE__ */ React126.createElement(PlusIcon5, { fontSize: SIZE12 })
9267
+ /* @__PURE__ */ React128.createElement(PlusIcon5, { fontSize: SIZE12 })
8742
9268
  );
8743
- return /* @__PURE__ */ React126.createElement(SectionContent, { gap: 2 }, /* @__PURE__ */ React126.createElement(RepeaterHeader, { label, adornment }, shouldShowInfotip ? /* @__PURE__ */ React126.createElement(
9269
+ return /* @__PURE__ */ React128.createElement(SectionContent, { gap: 2 }, /* @__PURE__ */ React128.createElement(RepeaterHeader, { label, adornment }, shouldShowInfotip ? /* @__PURE__ */ React128.createElement(
8744
9270
  Infotip4,
8745
9271
  {
8746
9272
  placement: "right",
@@ -8748,20 +9274,20 @@ var Repeater3 = ({
8748
9274
  color: "secondary",
8749
9275
  slotProps: { popper: { sx: { width: 300 } } }
8750
9276
  },
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) => {
9277
+ /* @__PURE__ */ React128.createElement(Box30, { sx: { ...isButtonDisabled ? { cursor: "not-allowed" } : {} } }, addButton)
9278
+ ) : addButton), 0 < uniqueKeys.length && /* @__PURE__ */ React128.createElement(SortableProvider, { value: uniqueKeys, onChange: onChangeOrder }, uniqueKeys.map((key) => {
8753
9279
  const index = uniqueKeys.indexOf(key);
8754
9280
  const value = items2[index];
8755
9281
  if (!value) {
8756
9282
  return null;
8757
9283
  }
8758
- return /* @__PURE__ */ React126.createElement(SortableItem, { id: key, key: `sortable-${key}`, disabled: !isSortable }, /* @__PURE__ */ React126.createElement(
9284
+ return /* @__PURE__ */ React128.createElement(SortableItem, { id: key, key: `sortable-${key}`, disabled: !isSortable }, /* @__PURE__ */ React128.createElement(
8759
9285
  RepeaterItem,
8760
9286
  {
8761
9287
  disabled,
8762
9288
  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 })),
9289
+ label: /* @__PURE__ */ React128.createElement(RepeaterItemLabelSlot, { value }, /* @__PURE__ */ React128.createElement(itemSettings.Label, { value, index })),
9290
+ startIcon: /* @__PURE__ */ React128.createElement(RepeaterItemIconSlot, { value }, /* @__PURE__ */ React128.createElement(itemSettings.Icon, { value })),
8765
9291
  removeItem: () => removeRepeaterItem(index),
8766
9292
  duplicateItem: () => duplicateRepeaterItem(index),
8767
9293
  toggleDisableItem: () => toggleDisableRepeaterItem(index),
@@ -8775,7 +9301,7 @@ var Repeater3 = ({
8775
9301
  actions: itemSettings.actions,
8776
9302
  value
8777
9303
  },
8778
- (props) => /* @__PURE__ */ React126.createElement(
9304
+ (props) => /* @__PURE__ */ React128.createElement(
8779
9305
  itemSettings.Content,
8780
9306
  {
8781
9307
  ...props,
@@ -8817,16 +9343,16 @@ var RepeaterItem = ({
8817
9343
  );
8818
9344
  const triggerProps = bindTrigger7(popoverState);
8819
9345
  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(
9346
+ const duplicateLabel = __64("Duplicate", "elementor");
9347
+ const toggleLabel = propDisabled ? __64("Show", "elementor") : __64("Hide", "elementor");
9348
+ const removeLabel = __64("Remove", "elementor");
9349
+ return /* @__PURE__ */ React128.createElement(Box30, { sx: { display: "contents" } }, /* @__PURE__ */ React128.createElement(
8824
9350
  RepeaterTag,
8825
9351
  {
8826
9352
  disabled,
8827
9353
  label,
8828
9354
  ref: setRef,
8829
- "aria-label": __62("Open item", "elementor"),
9355
+ "aria-label": __64("Open item", "elementor"),
8830
9356
  ...triggerProps,
8831
9357
  onClick: (e) => {
8832
9358
  triggerProps.onClick(e);
@@ -8835,15 +9361,15 @@ var RepeaterItem = ({
8835
9361
  }
8836
9362
  },
8837
9363
  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 }))))
9364
+ 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
9365
  }
8840
- ), /* @__PURE__ */ React126.createElement(RepeaterPopover, { width: ref?.getBoundingClientRect().width, ...popoverProps, anchorEl: ref }, /* @__PURE__ */ React126.createElement(Box28, null, children({ anchorEl: ref }))));
9366
+ ), /* @__PURE__ */ React128.createElement(RepeaterPopover, { width: ref?.getBoundingClientRect().width, ...popoverProps, anchorEl: ref }, /* @__PURE__ */ React128.createElement(Box30, null, children({ anchorEl: ref }))));
8841
9367
  };
8842
9368
  var usePopover = (openOnMount, onOpen, onPopoverClose) => {
8843
- const [ref, setRef] = useState21(null);
8844
- const popoverState = usePopupState10({ variant: "popover" });
8845
- const popoverProps = bindPopover8(popoverState);
8846
- useEffect19(() => {
9369
+ const [ref, setRef] = useState23(null);
9370
+ const popoverState = usePopupState11({ variant: "popover" });
9371
+ const popoverProps = bindPopover9(popoverState);
9372
+ useEffect21(() => {
8847
9373
  if (openOnMount && ref) {
8848
9374
  popoverState.open(ref);
8849
9375
  onOpen?.();
@@ -8861,293 +9387,6 @@ var usePopover = (openOnMount, onOpen, onPopoverClose) => {
8861
9387
  };
8862
9388
  };
8863
9389
 
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
9390
  // src/components/size/unstable-size-field.tsx
9152
9391
  import * as React131 from "react";
9153
9392
  import { InputAdornment as InputAdornment6 } from "@elementor/ui";