@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.d.mts CHANGED
@@ -262,7 +262,9 @@ declare const PositionControl: () => React$1.JSX.Element;
262
262
 
263
263
  declare const TransformRepeaterControl: ControlComponent<() => React$1.JSX.Element>;
264
264
 
265
- declare const TransitionRepeaterControl: ControlComponent<() => React$1.JSX.Element>;
265
+ declare const TransitionRepeaterControl: ControlComponent<(props: {
266
+ recentlyUsedList: string[];
267
+ }) => React$1.JSX.Element>;
266
268
 
267
269
  declare const PopoverContent: FC<PropsWithChildren<StackProps>>;
268
270
 
package/dist/index.d.ts CHANGED
@@ -262,7 +262,9 @@ declare const PositionControl: () => React$1.JSX.Element;
262
262
 
263
263
  declare const TransformRepeaterControl: ControlComponent<() => React$1.JSX.Element>;
264
264
 
265
- declare const TransitionRepeaterControl: ControlComponent<() => React$1.JSX.Element>;
265
+ declare const TransitionRepeaterControl: ControlComponent<(props: {
266
+ recentlyUsedList: string[];
267
+ }) => React$1.JSX.Element>;
266
268
 
267
269
  declare const PopoverContent: FC<PropsWithChildren<StackProps>>;
268
270
 
package/dist/index.js CHANGED
@@ -4869,7 +4869,15 @@ var toTransitionSelectorValue = (label) => {
4869
4869
  }
4870
4870
  return null;
4871
4871
  };
4872
- var TransitionSelector = () => {
4872
+ var findByValue = (value) => {
4873
+ for (const category of transitionProperties) {
4874
+ const property = category.properties.find((prop) => prop.value === value);
4875
+ if (property) {
4876
+ return property.label;
4877
+ }
4878
+ }
4879
+ };
4880
+ var TransitionSelector = ({ recentlyUsedList }) => {
4873
4881
  const { value, setValue } = useBoundProp(import_editor_props42.keyValuePropTypeUtil);
4874
4882
  const {
4875
4883
  value: { value: transitionValue },
@@ -4877,6 +4885,25 @@ var TransitionSelector = () => {
4877
4885
  } = value;
4878
4886
  const defaultRef = (0, import_react45.useRef)(null);
4879
4887
  const popoverState = (0, import_ui70.usePopupState)({ variant: "popover" });
4888
+ const getItemList = () => {
4889
+ const recentItems = recentlyUsedList.map((item) => findByValue(item)).filter((item) => !!item);
4890
+ const filteredItems = transitionsItemsList.map((category) => {
4891
+ return {
4892
+ ...category,
4893
+ items: category.items.filter((item) => !recentItems.includes(item))
4894
+ };
4895
+ });
4896
+ if (recentItems.length === 0) {
4897
+ return filteredItems;
4898
+ }
4899
+ return [
4900
+ {
4901
+ label: (0, import_i18n39.__)("Recent", "elementor"),
4902
+ items: recentItems
4903
+ },
4904
+ ...filteredItems
4905
+ ];
4906
+ };
4880
4907
  const handleTransitionPropertyChange = (newLabel) => {
4881
4908
  const newValue = toTransitionSelectorValue(newLabel);
4882
4909
  if (!newValue) {
@@ -4918,7 +4945,7 @@ var TransitionSelector = () => {
4918
4945
  /* @__PURE__ */ React80.createElement(
4919
4946
  ItemSelector,
4920
4947
  {
4921
- itemsList: transitionsItemsList,
4948
+ itemsList: getItemList(),
4922
4949
  selectedItem: transitionValue,
4923
4950
  onItemChange: handleTransitionPropertyChange,
4924
4951
  onClose: popoverState.close,
@@ -4936,13 +4963,15 @@ var DURATION_CONFIG = {
4936
4963
  units: ["s", "ms"],
4937
4964
  defaultUnit: "ms"
4938
4965
  };
4939
- var getSelectionSizeProps = () => {
4966
+ var getSelectionSizeProps = (recentlyUsedList) => {
4940
4967
  return {
4941
4968
  selectionLabel: (0, import_i18n40.__)("Type", "elementor"),
4942
4969
  sizeLabel: (0, import_i18n40.__)("Duration", "elementor"),
4943
4970
  selectionConfig: {
4944
4971
  component: TransitionSelector,
4945
- props: {}
4972
+ props: {
4973
+ recentlyUsedList
4974
+ }
4946
4975
  },
4947
4976
  sizeConfigMap: {
4948
4977
  ...transitionProperties.reduce(
@@ -4957,14 +4986,14 @@ var getSelectionSizeProps = () => {
4957
4986
  }
4958
4987
  };
4959
4988
  };
4960
- function getChildControlConfig() {
4989
+ function getChildControlConfig(recentlyUsedList) {
4961
4990
  return {
4962
4991
  propTypeUtil: import_editor_props43.selectionSizePropTypeUtil,
4963
4992
  component: SelectionSizeControl,
4964
- props: getSelectionSizeProps()
4993
+ props: getSelectionSizeProps(recentlyUsedList)
4965
4994
  };
4966
4995
  }
4967
- var TransitionRepeaterControl = createControl(() => {
4996
+ var TransitionRepeaterControl = createControl((props) => {
4968
4997
  return /* @__PURE__ */ React81.createElement(
4969
4998
  RepeatableControl,
4970
4999
  {
@@ -4975,7 +5004,7 @@ var TransitionRepeaterControl = createControl(() => {
4975
5004
  showDuplicate: false,
4976
5005
  showToggle: true,
4977
5006
  initialValues: initialTransitionValue,
4978
- childControlConfig: getChildControlConfig(),
5007
+ childControlConfig: getChildControlConfig(props.recentlyUsedList),
4979
5008
  propKey: "transition"
4980
5009
  }
4981
5010
  );