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