@elementor/editor-controls 3.33.0-100 → 3.33.0-102
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 +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +29 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +14 -14
- package/src/components/item-selector.tsx +4 -1
- package/src/controls/transition-control/transition-repeater-control.tsx +24 -6
- package/src/controls/transition-control/transition-selector.tsx +8 -1
- package/src/hooks/use-filtered-items-list.ts +3 -2
package/dist/index.d.mts
CHANGED
|
@@ -179,6 +179,7 @@ declare const FontFamilyControl: ControlComponent<({ fontFamilies, sectionWidth
|
|
|
179
179
|
type SelectableItem = {
|
|
180
180
|
type: 'item' | 'category';
|
|
181
181
|
value: string;
|
|
182
|
+
disabled?: boolean;
|
|
182
183
|
};
|
|
183
184
|
|
|
184
185
|
type Category = {
|
|
@@ -197,8 +198,9 @@ type ItemSelectorProps = {
|
|
|
197
198
|
icon: React$1.ElementType<{
|
|
198
199
|
fontSize: string;
|
|
199
200
|
}>;
|
|
201
|
+
disabledItems?: string[];
|
|
200
202
|
};
|
|
201
|
-
declare const ItemSelector: ({ itemsList, selectedItem, onItemChange, onClose, sectionWidth, title, itemStyle, onDebounce, icon, }: ItemSelectorProps) => React$1.JSX.Element;
|
|
203
|
+
declare const ItemSelector: ({ itemsList, selectedItem, onItemChange, onClose, sectionWidth, title, itemStyle, onDebounce, icon, disabledItems, }: ItemSelectorProps) => React$1.JSX.Element;
|
|
202
204
|
|
|
203
205
|
declare const UrlControl: ControlComponent<({ placeholder }: {
|
|
204
206
|
placeholder?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -179,6 +179,7 @@ declare const FontFamilyControl: ControlComponent<({ fontFamilies, sectionWidth
|
|
|
179
179
|
type SelectableItem = {
|
|
180
180
|
type: 'item' | 'category';
|
|
181
181
|
value: string;
|
|
182
|
+
disabled?: boolean;
|
|
182
183
|
};
|
|
183
184
|
|
|
184
185
|
type Category = {
|
|
@@ -197,8 +198,9 @@ type ItemSelectorProps = {
|
|
|
197
198
|
icon: React$1.ElementType<{
|
|
198
199
|
fontSize: string;
|
|
199
200
|
}>;
|
|
201
|
+
disabledItems?: string[];
|
|
200
202
|
};
|
|
201
|
-
declare const ItemSelector: ({ itemsList, selectedItem, onItemChange, onClose, sectionWidth, title, itemStyle, onDebounce, icon, }: ItemSelectorProps) => React$1.JSX.Element;
|
|
203
|
+
declare const ItemSelector: ({ itemsList, selectedItem, onItemChange, onClose, sectionWidth, title, itemStyle, onDebounce, icon, disabledItems, }: ItemSelectorProps) => React$1.JSX.Element;
|
|
202
204
|
|
|
203
205
|
declare const UrlControl: ControlComponent<({ placeholder }: {
|
|
204
206
|
placeholder?: string;
|
package/dist/index.js
CHANGED
|
@@ -2756,7 +2756,7 @@ var import_utils3 = require("@elementor/utils");
|
|
|
2756
2756
|
var import_i18n19 = require("@wordpress/i18n");
|
|
2757
2757
|
|
|
2758
2758
|
// src/hooks/use-filtered-items-list.ts
|
|
2759
|
-
var useFilteredItemsList = (itemsList, searchValue) => {
|
|
2759
|
+
var useFilteredItemsList = (itemsList, searchValue, disabledItems) => {
|
|
2760
2760
|
return itemsList.reduce((acc, category) => {
|
|
2761
2761
|
const filteredItems = category.items.filter(
|
|
2762
2762
|
(item) => item.toLowerCase().includes(searchValue.toLowerCase())
|
|
@@ -2764,7 +2764,7 @@ var useFilteredItemsList = (itemsList, searchValue) => {
|
|
|
2764
2764
|
if (filteredItems.length) {
|
|
2765
2765
|
acc.push({ type: "category", value: category.label });
|
|
2766
2766
|
filteredItems.forEach((item) => {
|
|
2767
|
-
acc.push({ type: "item", value: item });
|
|
2767
|
+
acc.push({ type: "item", value: item, disabled: disabledItems?.includes(item) ?? false });
|
|
2768
2768
|
});
|
|
2769
2769
|
}
|
|
2770
2770
|
return acc;
|
|
@@ -2782,10 +2782,11 @@ var ItemSelector = ({
|
|
|
2782
2782
|
itemStyle = () => ({}),
|
|
2783
2783
|
onDebounce = () => {
|
|
2784
2784
|
},
|
|
2785
|
-
icon
|
|
2785
|
+
icon,
|
|
2786
|
+
disabledItems
|
|
2786
2787
|
}) => {
|
|
2787
2788
|
const [searchValue, setSearchValue] = (0, import_react25.useState)("");
|
|
2788
|
-
const filteredItemsList = useFilteredItemsList(itemsList, searchValue);
|
|
2789
|
+
const filteredItemsList = useFilteredItemsList(itemsList, searchValue, disabledItems);
|
|
2789
2790
|
const IconComponent = icon;
|
|
2790
2791
|
const handleSearch = (value) => {
|
|
2791
2792
|
setSearchValue(value);
|
|
@@ -5155,7 +5156,10 @@ var findByValue = (value) => {
|
|
|
5155
5156
|
}
|
|
5156
5157
|
}
|
|
5157
5158
|
};
|
|
5158
|
-
var TransitionSelector = ({
|
|
5159
|
+
var TransitionSelector = ({
|
|
5160
|
+
recentlyUsedList = [],
|
|
5161
|
+
disabledItems = []
|
|
5162
|
+
}) => {
|
|
5159
5163
|
const { value, setValue } = useBoundProp(import_editor_props46.keyValuePropTypeUtil);
|
|
5160
5164
|
const {
|
|
5161
5165
|
key: { value: transitionLabel }
|
|
@@ -5230,7 +5234,8 @@ var TransitionSelector = ({ recentlyUsedList = [] }) => {
|
|
|
5230
5234
|
onClose: popoverState.close,
|
|
5231
5235
|
sectionWidth: 268,
|
|
5232
5236
|
title: (0, import_i18n46.__)("Transition Property", "elementor"),
|
|
5233
|
-
icon: import_icons30.VariationsIcon
|
|
5237
|
+
icon: import_icons30.VariationsIcon,
|
|
5238
|
+
disabledItems
|
|
5234
5239
|
}
|
|
5235
5240
|
)
|
|
5236
5241
|
));
|
|
@@ -5242,14 +5247,15 @@ var DURATION_CONFIG = {
|
|
|
5242
5247
|
units: ["s", "ms"],
|
|
5243
5248
|
defaultUnit: "ms"
|
|
5244
5249
|
};
|
|
5245
|
-
var getSelectionSizeProps = (recentlyUsedList) => {
|
|
5250
|
+
var getSelectionSizeProps = (recentlyUsedList, disabledItems) => {
|
|
5246
5251
|
return {
|
|
5247
5252
|
selectionLabel: (0, import_i18n47.__)("Type", "elementor"),
|
|
5248
5253
|
sizeLabel: (0, import_i18n47.__)("Duration", "elementor"),
|
|
5249
5254
|
selectionConfig: {
|
|
5250
5255
|
component: TransitionSelector,
|
|
5251
5256
|
props: {
|
|
5252
|
-
recentlyUsedList
|
|
5257
|
+
recentlyUsedList,
|
|
5258
|
+
disabledItems
|
|
5253
5259
|
}
|
|
5254
5260
|
},
|
|
5255
5261
|
sizeConfigMap: {
|
|
@@ -5265,11 +5271,11 @@ var getSelectionSizeProps = (recentlyUsedList) => {
|
|
|
5265
5271
|
}
|
|
5266
5272
|
};
|
|
5267
5273
|
};
|
|
5268
|
-
function getChildControlConfig(recentlyUsedList) {
|
|
5274
|
+
function getChildControlConfig(recentlyUsedList, disabledItems) {
|
|
5269
5275
|
return {
|
|
5270
5276
|
propTypeUtil: import_editor_props47.selectionSizePropTypeUtil,
|
|
5271
5277
|
component: SelectionSizeControl,
|
|
5272
|
-
props: getSelectionSizeProps(recentlyUsedList)
|
|
5278
|
+
props: getSelectionSizeProps(recentlyUsedList, disabledItems)
|
|
5273
5279
|
};
|
|
5274
5280
|
}
|
|
5275
5281
|
var disableAddItemTooltipContent = /* @__PURE__ */ React90.createElement(
|
|
@@ -5286,6 +5292,12 @@ var disableAddItemTooltipContent = /* @__PURE__ */ React90.createElement(
|
|
|
5286
5292
|
/* @__PURE__ */ React90.createElement(import_ui78.Box, { component: "span" }, /* @__PURE__ */ React90.createElement(import_ui78.Typography, { variant: "body2" }, (0, import_i18n47.__)("Switch to 'Normal' state to add a transition.", "elementor")))
|
|
5287
5293
|
);
|
|
5288
5294
|
subscribeToTransitionEvent();
|
|
5295
|
+
var getTransitionLabel = (item) => {
|
|
5296
|
+
return item.value.selection.value?.key?.value ?? "";
|
|
5297
|
+
};
|
|
5298
|
+
var getDisabledItems = (value) => {
|
|
5299
|
+
return value?.map(getTransitionLabel) ?? [];
|
|
5300
|
+
};
|
|
5289
5301
|
var TransitionRepeaterControl = createControl(
|
|
5290
5302
|
({
|
|
5291
5303
|
recentlyUsedListGetter,
|
|
@@ -5293,6 +5305,12 @@ var TransitionRepeaterControl = createControl(
|
|
|
5293
5305
|
}) => {
|
|
5294
5306
|
const currentStyleIsNormal = currentStyleState === null;
|
|
5295
5307
|
const [recentlyUsedList, setRecentlyUsedList] = (0, import_react46.useState)([]);
|
|
5308
|
+
const childArrayPropTypeUtil = (0, import_react46.useMemo)(
|
|
5309
|
+
() => (0, import_editor_props47.createArrayPropUtils)(import_editor_props47.selectionSizePropTypeUtil.key, import_editor_props47.selectionSizePropTypeUtil.schema, "transition"),
|
|
5310
|
+
[]
|
|
5311
|
+
);
|
|
5312
|
+
const { value } = useBoundProp(childArrayPropTypeUtil);
|
|
5313
|
+
const disabledItems = (0, import_react46.useMemo)(() => getDisabledItems(value), [value]);
|
|
5296
5314
|
(0, import_react46.useEffect)(() => {
|
|
5297
5315
|
recentlyUsedListGetter().then(setRecentlyUsedList);
|
|
5298
5316
|
}, [recentlyUsedListGetter]);
|
|
@@ -5306,7 +5324,7 @@ var TransitionRepeaterControl = createControl(
|
|
|
5306
5324
|
showDuplicate: false,
|
|
5307
5325
|
showToggle: true,
|
|
5308
5326
|
initialValues: initialTransitionValue,
|
|
5309
|
-
childControlConfig: getChildControlConfig(recentlyUsedList),
|
|
5327
|
+
childControlConfig: getChildControlConfig(recentlyUsedList, disabledItems),
|
|
5310
5328
|
propKey: "transition",
|
|
5311
5329
|
addItemTooltipProps: {
|
|
5312
5330
|
disabled: !currentStyleIsNormal,
|