@elementor/editor-controls 4.3.0-989 → 4.3.0-991
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.js +21 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -17
- package/dist/index.mjs.map +1 -1
- package/package.json +16 -16
- package/src/controls/chips-control.tsx +25 -13
package/dist/index.mjs
CHANGED
|
@@ -2527,16 +2527,27 @@ function ChipsList({ getLabel, getTagProps, values }) {
|
|
|
2527
2527
|
// src/controls/chips-control.tsx
|
|
2528
2528
|
var SIZE6 = "tiny";
|
|
2529
2529
|
var toChipsOption = (val, options) => options.find((opt) => opt.value === val) ?? { label: val, value: val };
|
|
2530
|
+
var optionValue = (option) => {
|
|
2531
|
+
if ("string" === typeof option) {
|
|
2532
|
+
return option;
|
|
2533
|
+
}
|
|
2534
|
+
return "string" === typeof option?.value ? option.value : "";
|
|
2535
|
+
};
|
|
2536
|
+
var optionLabel = (option) => {
|
|
2537
|
+
if ("string" === typeof option) {
|
|
2538
|
+
return option;
|
|
2539
|
+
}
|
|
2540
|
+
if ("string" === typeof option?.label) {
|
|
2541
|
+
return option.label;
|
|
2542
|
+
}
|
|
2543
|
+
return optionValue(option);
|
|
2544
|
+
};
|
|
2530
2545
|
var ChipsControl = createControl(({ options, freeChips }) => {
|
|
2531
2546
|
const { value, setValue, disabled } = useBoundProp(stringArrayPropTypeUtil);
|
|
2532
|
-
const selectedValues = (value || []).map((item) => stringPropTypeUtil6.extract(item)).filter((val) =>
|
|
2547
|
+
const selectedValues = (value || []).map((item) => stringPropTypeUtil6.extract(item)).filter((val) => "string" === typeof val);
|
|
2533
2548
|
const selectedOptions = selectedValues.map((val) => toChipsOption(val, options));
|
|
2534
2549
|
const handleChange = (_, newValue) => {
|
|
2535
|
-
setValue(
|
|
2536
|
-
newValue.map(
|
|
2537
|
-
(option) => stringPropTypeUtil6.create(typeof option === "string" ? option : option.value)
|
|
2538
|
-
)
|
|
2539
|
-
);
|
|
2550
|
+
setValue(newValue.map((option) => stringPropTypeUtil6.create(optionValue(option))));
|
|
2540
2551
|
};
|
|
2541
2552
|
return /* @__PURE__ */ React52.createElement(ControlActions, null, /* @__PURE__ */ React52.createElement(
|
|
2542
2553
|
Autocomplete,
|
|
@@ -2550,17 +2561,10 @@ var ChipsControl = createControl(({ options, freeChips }) => {
|
|
|
2550
2561
|
filterSelectedOptions: true,
|
|
2551
2562
|
onChange: handleChange,
|
|
2552
2563
|
options,
|
|
2553
|
-
getOptionLabel:
|
|
2554
|
-
isOptionEqualToValue: (option, val) => option
|
|
2564
|
+
getOptionLabel: optionLabel,
|
|
2565
|
+
isOptionEqualToValue: (option, val) => optionValue(option) === optionValue(val),
|
|
2555
2566
|
renderInput: (params) => /* @__PURE__ */ React52.createElement(TextField5, { ...params }),
|
|
2556
|
-
renderTags: (tagValues, getTagProps) => /* @__PURE__ */ React52.createElement(
|
|
2557
|
-
ChipsList,
|
|
2558
|
-
{
|
|
2559
|
-
getLabel: (option) => typeof option === "string" ? option : option.label,
|
|
2560
|
-
getTagProps,
|
|
2561
|
-
values: tagValues
|
|
2562
|
-
}
|
|
2563
|
-
)
|
|
2567
|
+
renderTags: (tagValues, getTagProps) => /* @__PURE__ */ React52.createElement(ChipsList, { getLabel: optionLabel, getTagProps, values: tagValues })
|
|
2564
2568
|
}
|
|
2565
2569
|
));
|
|
2566
2570
|
});
|
|
@@ -5256,7 +5260,7 @@ var AspectRatioControl = createControl(({ label }) => {
|
|
|
5256
5260
|
fullWidth: true
|
|
5257
5261
|
},
|
|
5258
5262
|
[...RATIO_OPTIONS, { label: __30("Custom", "elementor"), value: CUSTOM_RATIO }].map(
|
|
5259
|
-
({ label:
|
|
5263
|
+
({ label: optionLabel2, ...props }) => /* @__PURE__ */ React79.createElement(MenuListItem5, { key: props.value, ...props, value: props.value ?? "" }, optionLabel2)
|
|
5260
5264
|
)
|
|
5261
5265
|
))), isCustom && /* @__PURE__ */ React79.createElement(Grid13, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React79.createElement(Grid13, { item: true, xs: 6 }, /* @__PURE__ */ React79.createElement(
|
|
5262
5266
|
TextField10,
|