@elementor/editor-controls 4.1.0-755 → 4.1.0-757

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.mjs CHANGED
@@ -457,19 +457,7 @@ var SelectControl = createControl(
457
457
  size: "tiny",
458
458
  MenuProps,
459
459
  "aria-label": ariaLabel || placeholder,
460
- renderValue: (selectedValue) => {
461
- const findOptionByValue = (searchValue) => options.find((opt) => opt.value === searchValue);
462
- if (!selectedValue || selectedValue === "") {
463
- if (placeholder) {
464
- const placeholderOption = findOptionByValue(placeholder);
465
- const displayText = placeholderOption?.label || placeholder;
466
- return /* @__PURE__ */ React12.createElement(Typography, { component: "span", variant: "caption", color: "text.tertiary" }, displayText);
467
- }
468
- return "";
469
- }
470
- const option = findOptionByValue(selectedValue);
471
- return option?.label || selectedValue;
472
- },
460
+ renderValue: (selectedValue) => getSelectRenderValue(options, placeholder, selectedValue),
473
461
  value: value ?? "",
474
462
  onChange: handleChange,
475
463
  disabled: isDisabled,
@@ -479,6 +467,20 @@ var SelectControl = createControl(
479
467
  ));
480
468
  }
481
469
  );
470
+ function getSelectRenderValue(options, placeholder, selectedValue) {
471
+ const optionWithValue = (v) => options.find(({ value }) => value === v);
472
+ if (!isUnsetSelectValue(selectedValue)) {
473
+ return optionWithValue(selectedValue)?.label ?? selectedValue;
474
+ }
475
+ if (placeholder) {
476
+ const text = optionWithValue(placeholder)?.label ?? placeholder;
477
+ return /* @__PURE__ */ React12.createElement(Typography, { component: "span", variant: "inherit", color: "text.tertiary" }, text);
478
+ }
479
+ return options.find(({ value }) => isUnsetSelectValue(value))?.label ?? "";
480
+ }
481
+ function isUnsetSelectValue(value) {
482
+ return value === null || value === void 0 || value === "";
483
+ }
482
484
 
483
485
  // src/controls/image-control.tsx
484
486
  var ImageControl = createControl(({ sizes, label = __2("Image", "elementor") }) => {