@elementor/editor-controls 3.35.0-487 → 3.35.0-488

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
@@ -2907,7 +2907,9 @@ var ItemSelector = ({
2907
2907
  },
2908
2908
  icon,
2909
2909
  disabledItems,
2910
- id = "item-selector"
2910
+ id = "item-selector",
2911
+ footer,
2912
+ categoryItemContentTemplate
2911
2913
  }) => {
2912
2914
  const [searchValue, setSearchValue] = useState9("");
2913
2915
  const filteredItemsList = useFilteredItemsList(itemsList, searchValue, disabledItems);
@@ -2927,7 +2929,7 @@ var ItemSelector = ({
2927
2929
  placeholder: __19("Search", "elementor"),
2928
2930
  id: id + "-search"
2929
2931
  }
2930
- ), /* @__PURE__ */ React58.createElement(Divider2, null), filteredItemsList.length > 0 ? /* @__PURE__ */ React58.createElement(
2932
+ ), /* @__PURE__ */ React58.createElement(Divider2, null), /* @__PURE__ */ React58.createElement(Box8, { sx: { flex: 1, overflow: "auto", minHeight: 0 } }, filteredItemsList.length > 0 ? /* @__PURE__ */ React58.createElement(
2931
2933
  ItemList,
2932
2934
  {
2933
2935
  itemListItems: filteredItemsList,
@@ -2935,7 +2937,8 @@ var ItemSelector = ({
2935
2937
  handleClose,
2936
2938
  selectedItem,
2937
2939
  itemStyle,
2938
- onDebounce
2940
+ onDebounce,
2941
+ categoryItemContentTemplate
2939
2942
  }
2940
2943
  ) : /* @__PURE__ */ React58.createElement(
2941
2944
  Stack9,
@@ -2986,7 +2989,7 @@ var ItemSelector = ({
2986
2989
  __19("Clear & try again", "elementor")
2987
2990
  )
2988
2991
  )
2989
- ));
2992
+ )), footer);
2990
2993
  };
2991
2994
  var ItemList = ({
2992
2995
  itemListItems,
@@ -2995,7 +2998,8 @@ var ItemList = ({
2995
2998
  selectedItem,
2996
2999
  itemStyle = () => ({}),
2997
3000
  onDebounce = () => {
2998
- }
3001
+ },
3002
+ categoryItemContentTemplate
2999
3003
  }) => {
3000
3004
  const selectedItemFound = itemListItems.find((item) => item.value === selectedItem);
3001
3005
  const debouncedVirtualizeChange = useDebounce((visibleItems) => {
@@ -3015,7 +3019,8 @@ var ItemList = ({
3015
3019
  onSelect: setSelectedItem,
3016
3020
  onClose: handleClose,
3017
3021
  itemStyle: memoizedItemStyle,
3018
- "data-testid": "item-list"
3022
+ "data-testid": "item-list",
3023
+ categoryItemContentTemplate
3019
3024
  }
3020
3025
  );
3021
3026
  };
@@ -5568,13 +5573,13 @@ var TransformBasePopoverTrigger = ({
5568
5573
 
5569
5574
  // src/controls/transition-control/transition-repeater-control.tsx
5570
5575
  import * as React97 from "react";
5571
- import { useEffect as useEffect10, useMemo as useMemo13, useState as useState17 } from "react";
5576
+ import { useEffect as useEffect10, useMemo as useMemo14, useState as useState17 } from "react";
5572
5577
  import {
5573
5578
  createArrayPropUtils as createArrayPropUtils2,
5574
5579
  selectionSizePropTypeUtil as selectionSizePropTypeUtil2
5575
5580
  } from "@elementor/editor-props";
5576
5581
  import { InfoCircleFilledIcon as InfoCircleFilledIcon3 } from "@elementor/icons";
5577
- import { Alert as Alert2, AlertTitle as AlertTitle3, Box as Box20, Typography as Typography7 } from "@elementor/ui";
5582
+ import { Alert as Alert3, AlertTitle as AlertTitle3, Box as Box20, Typography as Typography7 } from "@elementor/ui";
5578
5583
  import { __ as __49 } from "@wordpress/i18n";
5579
5584
 
5580
5585
  // src/controls/selection-size-control.tsx
@@ -5612,6 +5617,7 @@ var SelectionSizeControl = createControl(
5612
5617
  );
5613
5618
 
5614
5619
  // src/controls/transition-control/data.ts
5620
+ import { isVersionGreaterOrEqual } from "@elementor/utils";
5615
5621
  import { __ as __47 } from "@wordpress/i18n";
5616
5622
  var initialTransitionValue = {
5617
5623
  selection: {
@@ -5623,13 +5629,125 @@ var initialTransitionValue = {
5623
5629
  },
5624
5630
  size: { $$type: "size", value: { size: 200, unit: "ms" } }
5625
5631
  };
5626
- var transitionProperties = [
5627
- {
5628
- label: __47("Default", "elementor"),
5629
- type: "category",
5630
- properties: [{ label: __47("All properties", "elementor"), value: "all" }]
5632
+ var MIN_PRO_VERSION = "3.35";
5633
+ var shouldExtendTransitionProperties = () => {
5634
+ const hasProInstalled = !!window.elementorPro;
5635
+ if (!hasProInstalled) {
5636
+ return true;
5631
5637
  }
5632
- ];
5638
+ const proVersion = window.elementorPro?.config?.version;
5639
+ if (!proVersion) {
5640
+ return false;
5641
+ }
5642
+ return isVersionGreaterOrEqual(proVersion, MIN_PRO_VERSION);
5643
+ };
5644
+ var createTransitionPropertiesList = () => {
5645
+ const baseProperties = [
5646
+ {
5647
+ label: __47("Default", "elementor"),
5648
+ type: "category",
5649
+ properties: [{ label: __47("All properties", "elementor"), value: "all" }]
5650
+ },
5651
+ {
5652
+ label: __47("Margin", "elementor"),
5653
+ type: "category",
5654
+ properties: [
5655
+ { label: __47("Margin (all)", "elementor"), value: "margin", isDisabled: true },
5656
+ { label: __47("Margin bottom", "elementor"), value: "margin-block-end", isDisabled: true },
5657
+ { label: __47("Margin left", "elementor"), value: "margin-inline-start", isDisabled: true },
5658
+ { label: __47("Margin right", "elementor"), value: "margin-inline-end", isDisabled: true },
5659
+ { label: __47("Margin top", "elementor"), value: "margin-block-start", isDisabled: true }
5660
+ ]
5661
+ },
5662
+ {
5663
+ label: __47("Padding", "elementor"),
5664
+ type: "category",
5665
+ properties: [
5666
+ { label: __47("Padding (all)", "elementor"), value: "padding", isDisabled: true },
5667
+ { label: __47("Padding bottom", "elementor"), value: "padding-block-end", isDisabled: true },
5668
+ { label: __47("Padding left", "elementor"), value: "padding-inline-start", isDisabled: true },
5669
+ { label: __47("Padding right", "elementor"), value: "padding-inline-end", isDisabled: true },
5670
+ { label: __47("Padding top", "elementor"), value: "padding-block-start", isDisabled: true }
5671
+ ]
5672
+ },
5673
+ {
5674
+ label: __47("Flex", "elementor"),
5675
+ type: "category",
5676
+ properties: [
5677
+ { label: __47("Flex (all)", "elementor"), value: "flex", isDisabled: true },
5678
+ { label: __47("Flex grow", "elementor"), value: "flex-grow", isDisabled: true },
5679
+ { label: __47("Flex shrink", "elementor"), value: "flex-shrink", isDisabled: true },
5680
+ { label: __47("Flex basis", "elementor"), value: "flex-basis", isDisabled: true }
5681
+ ]
5682
+ },
5683
+ {
5684
+ label: __47("Size", "elementor"),
5685
+ type: "category",
5686
+ properties: [
5687
+ { label: __47("Width", "elementor"), value: "width", isDisabled: true },
5688
+ { label: __47("Height", "elementor"), value: "height", isDisabled: true },
5689
+ { label: __47("Max height", "elementor"), value: "max-height", isDisabled: true },
5690
+ { label: __47("Max width", "elementor"), value: "max-width", isDisabled: true },
5691
+ { label: __47("Min height", "elementor"), value: "min-height", isDisabled: true },
5692
+ { label: __47("Min width", "elementor"), value: "min-width", isDisabled: true }
5693
+ ]
5694
+ },
5695
+ {
5696
+ label: __47("Position", "elementor"),
5697
+ type: "category",
5698
+ properties: [
5699
+ { label: __47("Top", "elementor"), value: "inset-block-start", isDisabled: true },
5700
+ { label: __47("Left", "elementor"), value: "inset-inline-start", isDisabled: true },
5701
+ { label: __47("Right", "elementor"), value: "inset-inline-end", isDisabled: true },
5702
+ { label: __47("Bottom", "elementor"), value: "inset-block-end", isDisabled: true },
5703
+ { label: __47("Z-index", "elementor"), value: "z-index", isDisabled: true }
5704
+ ]
5705
+ },
5706
+ {
5707
+ label: __47("Typography", "elementor"),
5708
+ type: "category",
5709
+ properties: [
5710
+ { label: __47("Font color", "elementor"), value: "color", isDisabled: true },
5711
+ { label: __47("Font size", "elementor"), value: "font-size", isDisabled: true },
5712
+ { label: __47("Line height", "elementor"), value: "line-height", isDisabled: true },
5713
+ { label: __47("Letter spacing", "elementor"), value: "letter-spacing", isDisabled: true },
5714
+ { label: __47("Word spacing", "elementor"), value: "word-spacing", isDisabled: true },
5715
+ { label: __47("Font variations", "elementor"), value: "font-variation-settings", isDisabled: true },
5716
+ { label: __47("Text stroke color", "elementor"), value: "-webkit-text-stroke-color", isDisabled: true }
5717
+ ]
5718
+ },
5719
+ {
5720
+ label: __47("Background", "elementor"),
5721
+ type: "category",
5722
+ properties: [
5723
+ { label: __47("Background color", "elementor"), value: "background-color", isDisabled: true },
5724
+ { label: __47("Background position", "elementor"), value: "background-position", isDisabled: true },
5725
+ { label: __47("Box shadow", "elementor"), value: "box-shadow", isDisabled: true }
5726
+ ]
5727
+ },
5728
+ {
5729
+ label: __47("Border", "elementor"),
5730
+ type: "category",
5731
+ properties: [
5732
+ { label: __47("Border (all)", "elementor"), value: "border", isDisabled: true },
5733
+ { label: __47("Border radius", "elementor"), value: "border-radius", isDisabled: true },
5734
+ { label: __47("Border color", "elementor"), value: "border-color", isDisabled: true },
5735
+ { label: __47("Border width", "elementor"), value: "border-width", isDisabled: true }
5736
+ ]
5737
+ },
5738
+ {
5739
+ label: __47("Effects", "elementor"),
5740
+ type: "category",
5741
+ properties: [
5742
+ { label: __47("Opacity", "elementor"), value: "opacity", isDisabled: true },
5743
+ { label: __47("Transform (all)", "elementor"), value: "transform", isDisabled: true },
5744
+ { label: __47("Filter (all)", "elementor"), value: "filter", isDisabled: true }
5745
+ ]
5746
+ }
5747
+ ];
5748
+ return shouldExtendTransitionProperties() ? baseProperties : [baseProperties[0]];
5749
+ };
5750
+ var transitionProperties = createTransitionPropertiesList();
5633
5751
  var transitionsItemsList = transitionProperties.map((category) => ({
5634
5752
  label: category.label,
5635
5753
  items: category.properties.map((property) => property.label)
@@ -5660,10 +5778,11 @@ function subscribeToTransitionEvent() {
5660
5778
 
5661
5779
  // src/controls/transition-control/transition-selector.tsx
5662
5780
  import * as React96 from "react";
5663
- import { useRef as useRef23 } from "react";
5781
+ import { useMemo as useMemo13, useRef as useRef23 } from "react";
5664
5782
  import { keyValuePropTypeUtil as keyValuePropTypeUtil2 } from "@elementor/editor-props";
5665
- import { ChevronDownIcon as ChevronDownIcon3, VariationsIcon } from "@elementor/icons";
5666
- import { bindPopover as bindPopover6, bindTrigger as bindTrigger5, Box as Box19, Popover as Popover6, UnstableTag as UnstableTag3, usePopupState as usePopupState7 } from "@elementor/ui";
5783
+ import { PromotionChip } from "@elementor/editor-ui";
5784
+ import { ChevronDownIcon as ChevronDownIcon3, CrownFilledIcon, VariationsIcon } from "@elementor/icons";
5785
+ import { Alert as Alert2, bindPopover as bindPopover6, bindTrigger as bindTrigger5, Box as Box19, Popover as Popover6, UnstableTag as UnstableTag3, usePopupState as usePopupState7 } from "@elementor/ui";
5667
5786
  import { __ as __48 } from "@wordpress/i18n";
5668
5787
  var toTransitionSelectorValue = (label) => {
5669
5788
  for (const category of transitionProperties) {
@@ -5695,9 +5814,11 @@ var includeCurrentValueInOptions = (value, disabledItems) => {
5695
5814
  return item !== value.key.value;
5696
5815
  });
5697
5816
  };
5817
+ var PRO_UPGRADE_URL = "https://go.elementor.com/go-pro-transitions-modal/";
5698
5818
  var TransitionSelector = ({
5699
5819
  recentlyUsedList = [],
5700
- disabledItems = []
5820
+ disabledItems = [],
5821
+ showPromotion = false
5701
5822
  }) => {
5702
5823
  const { value, setValue } = useBoundProp(keyValuePropTypeUtil2);
5703
5824
  const {
@@ -5705,6 +5826,11 @@ var TransitionSelector = ({
5705
5826
  } = value;
5706
5827
  const defaultRef = useRef23(null);
5707
5828
  const popoverState = usePopupState7({ variant: "popover" });
5829
+ const disabledCategories = useMemo13(() => {
5830
+ return new Set(
5831
+ transitionProperties.filter((cat) => cat.properties.some((prop) => prop.isDisabled)).map((cat) => cat.label)
5832
+ );
5833
+ }, []);
5708
5834
  const getItemList = () => {
5709
5835
  const recentItems = recentlyUsedList.map((item) => getTransitionPropertyByValue({ value: item, $$type: "string" })?.label).filter((item) => !!item);
5710
5836
  const filteredItems = transitionsItemsList.map((category) => {
@@ -5774,7 +5900,50 @@ var TransitionSelector = ({
5774
5900
  sectionWidth: 268,
5775
5901
  title: __48("Transition Property", "elementor"),
5776
5902
  icon: VariationsIcon,
5777
- disabledItems: includeCurrentValueInOptions(value, disabledItems)
5903
+ disabledItems: includeCurrentValueInOptions(value, disabledItems),
5904
+ categoryItemContentTemplate: (item) => /* @__PURE__ */ React96.createElement(
5905
+ Box19,
5906
+ {
5907
+ sx: {
5908
+ display: "flex",
5909
+ alignItems: "center",
5910
+ justifyContent: "space-between",
5911
+ width: "100%"
5912
+ }
5913
+ },
5914
+ /* @__PURE__ */ React96.createElement("span", null, item.value),
5915
+ showPromotion && disabledCategories.has(item.value) && /* @__PURE__ */ React96.createElement(PromotionChip, null)
5916
+ ),
5917
+ footer: showPromotion ? /* @__PURE__ */ React96.createElement(
5918
+ Alert2,
5919
+ {
5920
+ variant: "standard",
5921
+ color: "promotion",
5922
+ icon: false,
5923
+ role: "dialog",
5924
+ "aria-label": "promotion-alert",
5925
+ size: "small",
5926
+ sx: { m: 1.5, mt: 0 }
5927
+ },
5928
+ __48("Upgrade to customize transition properties and control effects.", "elementor"),
5929
+ /* @__PURE__ */ React96.createElement(
5930
+ Box19,
5931
+ {
5932
+ component: "a",
5933
+ href: PRO_UPGRADE_URL,
5934
+ target: "_blank",
5935
+ rel: "noopener noreferrer",
5936
+ sx: {
5937
+ display: "flex",
5938
+ alignItems: "center",
5939
+ gap: 0.5,
5940
+ color: "promotion.main"
5941
+ }
5942
+ },
5943
+ /* @__PURE__ */ React96.createElement(CrownFilledIcon, { fontSize: "tiny" }),
5944
+ __48("Upgrade now", "elementor")
5945
+ )
5946
+ ) : null
5778
5947
  }
5779
5948
  )
5780
5949
  ));
@@ -5801,7 +5970,7 @@ var areAllPropertiesUsed = (value = []) => {
5801
5970
  });
5802
5971
  }) : false;
5803
5972
  };
5804
- var getSelectionSizeProps = (recentlyUsedList, disabledItems) => {
5973
+ var getSelectionSizeProps = (recentlyUsedList, disabledItems, showPromotion) => {
5805
5974
  return {
5806
5975
  selectionLabel: __49("Type", "elementor"),
5807
5976
  sizeLabel: __49("Duration", "elementor"),
@@ -5809,7 +5978,8 @@ var getSelectionSizeProps = (recentlyUsedList, disabledItems) => {
5809
5978
  component: TransitionSelector,
5810
5979
  props: {
5811
5980
  recentlyUsedList,
5812
- disabledItems
5981
+ disabledItems,
5982
+ showPromotion
5813
5983
  }
5814
5984
  },
5815
5985
  sizeConfigMap: {
@@ -5829,11 +5999,11 @@ var isItemDisabled = (item) => {
5829
5999
  const property = getTransitionPropertyByValue(item.value.selection.value?.value);
5830
6000
  return !property ? false : !!property.isDisabled;
5831
6001
  };
5832
- var getChildControlConfig = (recentlyUsedList, disabledItems) => {
6002
+ var getChildControlConfig = (recentlyUsedList, disabledItems, showPromotion) => {
5833
6003
  return {
5834
6004
  propTypeUtil: selectionSizePropTypeUtil2,
5835
6005
  component: SelectionSizeControl,
5836
- props: getSelectionSizeProps(recentlyUsedList, disabledItems),
6006
+ props: getSelectionSizeProps(recentlyUsedList, disabledItems, showPromotion),
5837
6007
  isItemDisabled
5838
6008
  };
5839
6009
  };
@@ -5843,14 +6013,18 @@ var isPropertyUsed = (value, property) => {
5843
6013
  });
5844
6014
  };
5845
6015
  var getDisabledItemLabels = (values = []) => {
5846
- const disabledLabels = (values || []).map(
6016
+ const selectedLabels = (values || []).map(
5847
6017
  (item) => item.value?.selection?.value?.key?.value
5848
6018
  );
6019
+ const proDisabledLabels = [];
5849
6020
  transitionProperties.forEach((category) => {
5850
- const disabledProperties = category.properties.filter((property) => property.isDisabled && !disabledLabels.includes(property.label)).map((property) => property.label);
5851
- disabledLabels.push(...disabledProperties);
6021
+ const disabledProperties = category.properties.filter((property) => property.isDisabled && !selectedLabels.includes(property.label)).map((property) => property.label);
6022
+ proDisabledLabels.push(...disabledProperties);
5852
6023
  });
5853
- return disabledLabels;
6024
+ return {
6025
+ allDisabled: [...selectedLabels, ...proDisabledLabels],
6026
+ proDisabled: proDisabledLabels
6027
+ };
5854
6028
  };
5855
6029
  var getInitialValue = (values = []) => {
5856
6030
  if (!values?.length) {
@@ -5876,7 +6050,7 @@ var getInitialValue = (values = []) => {
5876
6050
  return initialTransitionValue;
5877
6051
  };
5878
6052
  var disableAddItemTooltipContent = /* @__PURE__ */ React97.createElement(
5879
- Alert2,
6053
+ Alert3,
5880
6054
  {
5881
6055
  sx: {
5882
6056
  width: 280,
@@ -5896,8 +6070,11 @@ var TransitionRepeaterControl = createControl(
5896
6070
  const currentStyleIsNormal = currentStyleState === null;
5897
6071
  const [recentlyUsedList, setRecentlyUsedList] = useState17([]);
5898
6072
  const { value, setValue } = useBoundProp(childArrayPropTypeUtil);
5899
- const disabledItems = useMemo13(() => getDisabledItemLabels(value), [value]);
5900
- const allowedTransitionSet = useMemo13(() => {
6073
+ const { allDisabled: disabledItems, proDisabled: proDisabledItems } = useMemo14(
6074
+ () => getDisabledItemLabels(value),
6075
+ [value]
6076
+ );
6077
+ const allowedTransitionSet = useMemo14(() => {
5901
6078
  const set = /* @__PURE__ */ new Set();
5902
6079
  transitionProperties.forEach((category) => {
5903
6080
  category.properties.forEach((prop) => set.add(prop.value));
@@ -5919,7 +6096,7 @@ var TransitionRepeaterControl = createControl(
5919
6096
  useEffect10(() => {
5920
6097
  recentlyUsedListGetter().then(setRecentlyUsedList);
5921
6098
  }, [recentlyUsedListGetter]);
5922
- const allPropertiesUsed = useMemo13(() => areAllPropertiesUsed(value), [value]);
6099
+ const allPropertiesUsed = useMemo14(() => areAllPropertiesUsed(value), [value]);
5923
6100
  const isAddItemDisabled = !currentStyleIsNormal || allPropertiesUsed;
5924
6101
  return /* @__PURE__ */ React97.createElement(
5925
6102
  RepeatableControl,
@@ -5931,7 +6108,11 @@ var TransitionRepeaterControl = createControl(
5931
6108
  showDuplicate: false,
5932
6109
  showToggle: true,
5933
6110
  initialValues: getInitialValue(value),
5934
- childControlConfig: getChildControlConfig(recentlyUsedList, disabledItems),
6111
+ childControlConfig: getChildControlConfig(
6112
+ recentlyUsedList,
6113
+ disabledItems,
6114
+ proDisabledItems.length > 0
6115
+ ),
5935
6116
  propKey: "transition",
5936
6117
  addItemTooltipProps: {
5937
6118
  disabled: isAddItemDisabled,
@@ -6059,7 +6240,7 @@ function isEmpty(value = "") {
6059
6240
 
6060
6241
  // src/components/inline-editor-toolbar.tsx
6061
6242
  import * as React100 from "react";
6062
- import { useMemo as useMemo14, useRef as useRef25, useState as useState18 } from "react";
6243
+ import { useMemo as useMemo15, useRef as useRef25, useState as useState18 } from "react";
6063
6244
  import { getElementSetting } from "@elementor/editor-elements";
6064
6245
  import {
6065
6246
  BoldIcon,
@@ -6225,7 +6406,7 @@ var InlineEditorToolbar = ({ editor, elementId }) => {
6225
6406
  editor,
6226
6407
  selector: (ctx) => possibleFormats.filter((format) => ctx.editor.isActive(format))
6227
6408
  });
6228
- const formatButtonsList = useMemo14(() => {
6409
+ const formatButtonsList = useMemo15(() => {
6229
6410
  const buttons = Object.values(formatButtons);
6230
6411
  if (hasLinkOnElement) {
6231
6412
  return buttons.filter((button) => button.action !== "link");