@elementor/editor-controls 4.3.0-989 → 4.3.0-990

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 CHANGED
@@ -2625,16 +2625,27 @@ function ChipsList({ getLabel, getTagProps, values }) {
2625
2625
  // src/controls/chips-control.tsx
2626
2626
  var SIZE6 = "tiny";
2627
2627
  var toChipsOption = (val, options) => options.find((opt) => opt.value === val) ?? { label: val, value: val };
2628
+ var optionValue = (option) => {
2629
+ if ("string" === typeof option) {
2630
+ return option;
2631
+ }
2632
+ return "string" === typeof option?.value ? option.value : "";
2633
+ };
2634
+ var optionLabel = (option) => {
2635
+ if ("string" === typeof option) {
2636
+ return option;
2637
+ }
2638
+ if ("string" === typeof option?.label) {
2639
+ return option.label;
2640
+ }
2641
+ return optionValue(option);
2642
+ };
2628
2643
  var ChipsControl = createControl(({ options, freeChips }) => {
2629
2644
  const { value, setValue, disabled } = useBoundProp(import_editor_props17.stringArrayPropTypeUtil);
2630
- const selectedValues = (value || []).map((item) => import_editor_props17.stringPropTypeUtil.extract(item)).filter((val) => val !== null);
2645
+ const selectedValues = (value || []).map((item) => import_editor_props17.stringPropTypeUtil.extract(item)).filter((val) => "string" === typeof val);
2631
2646
  const selectedOptions = selectedValues.map((val) => toChipsOption(val, options));
2632
2647
  const handleChange = (_, newValue) => {
2633
- setValue(
2634
- newValue.map(
2635
- (option) => import_editor_props17.stringPropTypeUtil.create(typeof option === "string" ? option : option.value)
2636
- )
2637
- );
2648
+ setValue(newValue.map((option) => import_editor_props17.stringPropTypeUtil.create(optionValue(option))));
2638
2649
  };
2639
2650
  return /* @__PURE__ */ React52.createElement(ControlActions, null, /* @__PURE__ */ React52.createElement(
2640
2651
  import_ui39.Autocomplete,
@@ -2648,17 +2659,10 @@ var ChipsControl = createControl(({ options, freeChips }) => {
2648
2659
  filterSelectedOptions: true,
2649
2660
  onChange: handleChange,
2650
2661
  options,
2651
- getOptionLabel: (option) => typeof option === "string" ? option : option.label,
2652
- isOptionEqualToValue: (option, val) => option.value === val.value,
2662
+ getOptionLabel: optionLabel,
2663
+ isOptionEqualToValue: (option, val) => optionValue(option) === optionValue(val),
2653
2664
  renderInput: (params) => /* @__PURE__ */ React52.createElement(import_ui39.TextField, { ...params }),
2654
- renderTags: (tagValues, getTagProps) => /* @__PURE__ */ React52.createElement(
2655
- ChipsList,
2656
- {
2657
- getLabel: (option) => typeof option === "string" ? option : option.label,
2658
- getTagProps,
2659
- values: tagValues
2660
- }
2661
- )
2665
+ renderTags: (tagValues, getTagProps) => /* @__PURE__ */ React52.createElement(ChipsList, { getLabel: optionLabel, getTagProps, values: tagValues })
2662
2666
  }
2663
2667
  ));
2664
2668
  });
@@ -5318,7 +5322,7 @@ var AspectRatioControl = createControl(({ label }) => {
5318
5322
  fullWidth: true
5319
5323
  },
5320
5324
  [...RATIO_OPTIONS, { label: (0, import_i18n30.__)("Custom", "elementor"), value: CUSTOM_RATIO }].map(
5321
- ({ label: optionLabel, ...props }) => /* @__PURE__ */ React79.createElement(import_editor_ui10.MenuListItem, { key: props.value, ...props, value: props.value ?? "" }, optionLabel)
5325
+ ({ label: optionLabel2, ...props }) => /* @__PURE__ */ React79.createElement(import_editor_ui10.MenuListItem, { key: props.value, ...props, value: props.value ?? "" }, optionLabel2)
5322
5326
  )
5323
5327
  ))), isCustom && /* @__PURE__ */ React79.createElement(import_ui62.Grid, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React79.createElement(import_ui62.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React79.createElement(
5324
5328
  import_ui62.TextField,