@elementor/editor-controls 3.32.0-27 → 3.32.0-28

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
@@ -4881,7 +4881,15 @@ var toTransitionSelectorValue = (label) => {
4881
4881
  }
4882
4882
  return null;
4883
4883
  };
4884
- var TransitionSelector = () => {
4884
+ var findByValue = (value) => {
4885
+ for (const category of transitionProperties) {
4886
+ const property = category.properties.find((prop) => prop.value === value);
4887
+ if (property) {
4888
+ return property.label;
4889
+ }
4890
+ }
4891
+ };
4892
+ var TransitionSelector = ({ recentlyUsedList }) => {
4885
4893
  const { value, setValue } = useBoundProp(keyValuePropTypeUtil2);
4886
4894
  const {
4887
4895
  value: { value: transitionValue },
@@ -4889,6 +4897,25 @@ var TransitionSelector = () => {
4889
4897
  } = value;
4890
4898
  const defaultRef = useRef20(null);
4891
4899
  const popoverState = usePopupState7({ variant: "popover" });
4900
+ const getItemList = () => {
4901
+ const recentItems = recentlyUsedList.map((item) => findByValue(item)).filter((item) => !!item);
4902
+ const filteredItems = transitionsItemsList.map((category) => {
4903
+ return {
4904
+ ...category,
4905
+ items: category.items.filter((item) => !recentItems.includes(item))
4906
+ };
4907
+ });
4908
+ if (recentItems.length === 0) {
4909
+ return filteredItems;
4910
+ }
4911
+ return [
4912
+ {
4913
+ label: __39("Recent", "elementor"),
4914
+ items: recentItems
4915
+ },
4916
+ ...filteredItems
4917
+ ];
4918
+ };
4892
4919
  const handleTransitionPropertyChange = (newLabel) => {
4893
4920
  const newValue = toTransitionSelectorValue(newLabel);
4894
4921
  if (!newValue) {
@@ -4930,7 +4957,7 @@ var TransitionSelector = () => {
4930
4957
  /* @__PURE__ */ React80.createElement(
4931
4958
  ItemSelector,
4932
4959
  {
4933
- itemsList: transitionsItemsList,
4960
+ itemsList: getItemList(),
4934
4961
  selectedItem: transitionValue,
4935
4962
  onItemChange: handleTransitionPropertyChange,
4936
4963
  onClose: popoverState.close,
@@ -4948,13 +4975,15 @@ var DURATION_CONFIG = {
4948
4975
  units: ["s", "ms"],
4949
4976
  defaultUnit: "ms"
4950
4977
  };
4951
- var getSelectionSizeProps = () => {
4978
+ var getSelectionSizeProps = (recentlyUsedList) => {
4952
4979
  return {
4953
4980
  selectionLabel: __40("Type", "elementor"),
4954
4981
  sizeLabel: __40("Duration", "elementor"),
4955
4982
  selectionConfig: {
4956
4983
  component: TransitionSelector,
4957
- props: {}
4984
+ props: {
4985
+ recentlyUsedList
4986
+ }
4958
4987
  },
4959
4988
  sizeConfigMap: {
4960
4989
  ...transitionProperties.reduce(
@@ -4969,14 +4998,14 @@ var getSelectionSizeProps = () => {
4969
4998
  }
4970
4999
  };
4971
5000
  };
4972
- function getChildControlConfig() {
5001
+ function getChildControlConfig(recentlyUsedList) {
4973
5002
  return {
4974
5003
  propTypeUtil: selectionSizePropTypeUtil2,
4975
5004
  component: SelectionSizeControl,
4976
- props: getSelectionSizeProps()
5005
+ props: getSelectionSizeProps(recentlyUsedList)
4977
5006
  };
4978
5007
  }
4979
- var TransitionRepeaterControl = createControl(() => {
5008
+ var TransitionRepeaterControl = createControl((props) => {
4980
5009
  return /* @__PURE__ */ React81.createElement(
4981
5010
  RepeatableControl,
4982
5011
  {
@@ -4987,7 +5016,7 @@ var TransitionRepeaterControl = createControl(() => {
4987
5016
  showDuplicate: false,
4988
5017
  showToggle: true,
4989
5018
  initialValues: initialTransitionValue,
4990
- childControlConfig: getChildControlConfig(),
5019
+ childControlConfig: getChildControlConfig(props.recentlyUsedList),
4991
5020
  propKey: "transition"
4992
5021
  }
4993
5022
  );