@elementor/editor-controls 3.35.0-337 → 3.35.0-339

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
@@ -495,43 +495,52 @@ var React10 = __toESM(require("react"));
495
495
  var import_editor_props2 = require("@elementor/editor-props");
496
496
  var import_editor_ui = require("@elementor/editor-ui");
497
497
  var import_ui5 = require("@elementor/ui");
498
- var SelectControl = createControl(({ options, onChange, MenuProps, ariaLabel }) => {
499
- const { value, setValue, disabled, placeholder } = useBoundProp(import_editor_props2.stringPropTypeUtil);
500
- const handleChange = (event) => {
501
- const newValue = event.target.value || null;
502
- onChange?.(newValue, value);
503
- setValue(newValue);
504
- };
505
- const isDisabled = disabled || options.length === 0;
506
- return /* @__PURE__ */ React10.createElement(ControlActions, null, /* @__PURE__ */ React10.createElement(
507
- import_ui5.Select,
508
- {
509
- sx: { overflow: "hidden" },
510
- displayEmpty: true,
511
- size: "tiny",
512
- MenuProps,
513
- "aria-label": ariaLabel || placeholder,
514
- renderValue: (selectedValue) => {
515
- const findOptionByValue = (searchValue) => options.find((opt) => opt.value === searchValue);
516
- if (!selectedValue || selectedValue === "") {
517
- if (placeholder) {
518
- const placeholderOption = findOptionByValue(placeholder);
519
- const displayText = placeholderOption?.label || placeholder;
520
- return /* @__PURE__ */ React10.createElement(import_ui5.Typography, { component: "span", variant: "caption", color: "text.tertiary" }, displayText);
498
+ var DEFAULT_MENU_PROPS = {
499
+ MenuListProps: {
500
+ sx: {
501
+ maxHeight: "160px"
502
+ }
503
+ }
504
+ };
505
+ var SelectControl = createControl(
506
+ ({ options, onChange, MenuProps = DEFAULT_MENU_PROPS, ariaLabel }) => {
507
+ const { value, setValue, disabled, placeholder } = useBoundProp(import_editor_props2.stringPropTypeUtil);
508
+ const handleChange = (event) => {
509
+ const newValue = event.target.value || null;
510
+ onChange?.(newValue, value);
511
+ setValue(newValue);
512
+ };
513
+ const isDisabled = disabled || options.length === 0;
514
+ return /* @__PURE__ */ React10.createElement(ControlActions, null, /* @__PURE__ */ React10.createElement(
515
+ import_ui5.Select,
516
+ {
517
+ sx: { overflow: "hidden" },
518
+ displayEmpty: true,
519
+ size: "tiny",
520
+ MenuProps,
521
+ "aria-label": ariaLabel || placeholder,
522
+ renderValue: (selectedValue) => {
523
+ const findOptionByValue = (searchValue) => options.find((opt) => opt.value === searchValue);
524
+ if (!selectedValue || selectedValue === "") {
525
+ if (placeholder) {
526
+ const placeholderOption = findOptionByValue(placeholder);
527
+ const displayText = placeholderOption?.label || placeholder;
528
+ return /* @__PURE__ */ React10.createElement(import_ui5.Typography, { component: "span", variant: "caption", color: "text.tertiary" }, displayText);
529
+ }
530
+ return "";
521
531
  }
522
- return "";
523
- }
524
- const option = findOptionByValue(selectedValue);
525
- return option?.label || selectedValue;
532
+ const option = findOptionByValue(selectedValue);
533
+ return option?.label || selectedValue;
534
+ },
535
+ value: value ?? "",
536
+ onChange: handleChange,
537
+ disabled: isDisabled,
538
+ fullWidth: true
526
539
  },
527
- value: value ?? "",
528
- onChange: handleChange,
529
- disabled: isDisabled,
530
- fullWidth: true
531
- },
532
- options.map(({ label, ...props }) => /* @__PURE__ */ React10.createElement(import_editor_ui.MenuListItem, { key: props.value, ...props, value: props.value ?? "" }, label))
533
- ));
534
- });
540
+ options.map(({ label, ...props }) => /* @__PURE__ */ React10.createElement(import_editor_ui.MenuListItem, { key: props.value, ...props, value: props.value ?? "" }, label))
541
+ ));
542
+ }
543
+ );
535
544
 
536
545
  // src/controls/image-control.tsx
537
546
  var ImageControl = createControl(({ sizes, showMode = "all" }) => {