@elementor/editor-controls 3.35.0-337 → 3.35.0-338
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 +44 -35
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +44 -35
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/controls/select-control.tsx +58 -47
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
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
{
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
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
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
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
|
-
|
|
529
|
-
|
|
530
|
-
|
|
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" }) => {
|