const { __ } = wp.i18n; const { MediaUpload } = wp.blockEditor; const { SelectControl, Button, RangeControl, BaseControl, ButtonGroup, ToggleControl, } = wp.components; /** * Internal dependencies */ import GradientColorControl from "../gradient-color-controller"; import UnitControl from "../unit-control"; import ColorControl from "../color-control"; import ImageAvatar from "../image-avatar"; import WithResButtons from "../withResButtons"; import ResetControl from "../reset-control"; export default function overlayControl({ resRequiredProps, controlName, noOverlayBgi, noTransition, }) { const { setAttributes, attributes, resOption } = resRequiredProps; const { [`${controlName}ovl_hoverType`]: ovl_hoverType, [`${controlName}ovl_bg_transition`]: ovl_bg_transition, [`${controlName}ovl_filtersTransition`]: ovl_filtersTransition, [`${controlName}ovl_opacityTransition`]: ovl_opacityTransition, // attributes for ovl_hoverType normal start ⬇ [`${controlName}overlayType`]: overlayType, [`${controlName}overlayColor`]: overlayColor, [`${controlName}overlayGradient`]: overlayGradient, [`${controlName}ovl_bgImageURL`]: ovl_bgImageURL, [`${controlName}ovl_bgImageID`]: ovl_bgImageID, [`${controlName}ovl_bgImgAttachment`]: ovl_bgImgAttachment, [`${controlName}ovl_opacity`]: ovl_opacity, [`${controlName}ovl_blendMode`]: ovl_blendMode, [`${controlName}ovl_allowFilters`]: ovl_allowFilters, [`${controlName}ovl_fltrBrightness`]: ovl_fltrBrightness, [`${controlName}ovl_fltrContrast`]: ovl_fltrContrast, [`${controlName}ovl_fltrSaturation`]: ovl_fltrSaturation, [`${controlName}ovl_fltrBlur`]: ovl_fltrBlur, [`${controlName}ovl_fltrHue`]: ovl_fltrHue, [`${controlName}ovl_backgroundSize`]: ovl_backgroundSize, [`${controlName}ovl_bgImgCustomSize`]: ovl_bgImgCustomSize, [`${controlName}ovl_bgImgCustomSizeUnit`]: ovl_bgImgCustomSizeUnit, [`${controlName}ovl_bgImgPos`]: ovl_bgImgPos, [`${controlName}ovl_bgImgcustomPosX`]: ovl_bgImgcustomPosX, [`${controlName}ovl_bgImgcustomPosXUnit`]: ovl_bgImgcustomPosXUnit, [`${controlName}ovl_bgImgcustomPosY`]: ovl_bgImgcustomPosY, [`${controlName}ovl_bgImgcustomPosYUnit`]: ovl_bgImgcustomPosYUnit, [`${controlName}ovl_bgImgRepeat`]: ovl_bgImgRepeat, [`TAB${controlName}ovl_backgroundSize`]: TABovl_backgroundSize, [`TAB${controlName}ovl_bgImgCustomSize`]: TABovl_bgImgCustomSize, [`TAB${controlName}ovl_bgImgCustomSizeUnit`]: TABovl_bgImgCustomSizeUnit, [`TAB${controlName}ovl_bgImgPos`]: TABovl_bgImgPos, [`TAB${controlName}ovl_bgImgcustomPosX`]: TABovl_bgImgcustomPosX, [`TAB${controlName}ovl_bgImgcustomPosXUnit`]: TABovl_bgImgcustomPosXUnit, [`TAB${controlName}ovl_bgImgcustomPosY`]: TABovl_bgImgcustomPosY, [`TAB${controlName}ovl_bgImgcustomPosYUnit`]: TABovl_bgImgcustomPosYUnit, [`TAB${controlName}ovl_bgImgRepeat`]: TABovl_bgImgRepeat, [`MOB${controlName}ovl_backgroundSize`]: MOBovl_backgroundSize, [`MOB${controlName}ovl_bgImgCustomSize`]: MOBovl_bgImgCustomSize, [`MOB${controlName}ovl_bgImgCustomSizeUnit`]: MOBovl_bgImgCustomSizeUnit, [`MOB${controlName}ovl_bgImgPos`]: MOBovl_bgImgPos, [`MOB${controlName}ovl_bgImgcustomPosX`]: MOBovl_bgImgcustomPosX, [`MOB${controlName}ovl_bgImgcustomPosXUnit`]: MOBovl_bgImgcustomPosXUnit, [`MOB${controlName}ovl_bgImgcustomPosY`]: MOBovl_bgImgcustomPosY, [`MOB${controlName}ovl_bgImgcustomPosYUnit`]: MOBovl_bgImgcustomPosYUnit, [`MOB${controlName}ovl_bgImgRepeat`]: MOBovl_bgImgRepeat, // attributes for ovl_hoverType normal end // attributes for ovl_hoverType hover start ⬇ [`hov_${controlName}overlayType`]: hov_overlayType, [`hov_${controlName}overlayColor`]: hov_overlayColor, [`hov_${controlName}overlayGradient`]: hov_overlayGradient, [`hov_${controlName}ovl_bgImageURL`]: hov_ovl_bgImageURL, [`hov_${controlName}ovl_bgImageID`]: hov_ovl_bgImageID, [`hov_${controlName}ovl_bgImgAttachment`]: hov_ovl_bgImgAttachment, [`hov_${controlName}ovl_opacity`]: hov_ovl_opacity, [`hov_${controlName}ovl_blendMode`]: hov_ovl_blendMode, [`hov_${controlName}ovl_allowFilters`]: hov_ovl_allowFilters, [`hov_${controlName}ovl_fltrBrightness`]: hov_ovl_fltrBrightness, [`hov_${controlName}ovl_fltrContrast`]: hov_ovl_fltrContrast, [`hov_${controlName}ovl_fltrSaturation`]: hov_ovl_fltrSaturation, [`hov_${controlName}ovl_fltrBlur`]: hov_ovl_fltrBlur, [`hov_${controlName}ovl_fltrHue`]: hov_ovl_fltrHue, [`hov_${controlName}ovl_backgroundSize`]: hov_ovl_backgroundSize, [`hov_${controlName}ovl_bgImgCustomSize`]: hov_ovl_bgImgCustomSize, [`hov_${controlName}ovl_bgImgCustomSizeUnit`]: hov_ovl_bgImgCustomSizeUnit, [`hov_${controlName}ovl_bgImgPos`]: hov_ovl_bgImgPos, [`hov_${controlName}ovl_bgImgcustomPosX`]: hov_ovl_bgImgcustomPosX, [`hov_${controlName}ovl_bgImgcustomPosXUnit`]: hov_ovl_bgImgcustomPosXUnit, [`hov_${controlName}ovl_bgImgcustomPosY`]: hov_ovl_bgImgcustomPosY, [`hov_${controlName}ovl_bgImgcustomPosYUnit`]: hov_ovl_bgImgcustomPosYUnit, [`hov_${controlName}ovl_bgImgRepeat`]: hov_ovl_bgImgRepeat, [`hov_TAB${controlName}ovl_backgroundSize`]: hov_TABovl_backgroundSize, [`hov_TAB${controlName}ovl_bgImgCustomSize`]: hov_TABovl_bgImgCustomSize, [`hov_TAB${controlName}ovl_bgImgCustomSizeUnit`]: hov_TABovl_bgImgCustomSizeUnit, [`hov_TAB${controlName}ovl_bgImgPos`]: hov_TABovl_bgImgPos, [`hov_TAB${controlName}ovl_bgImgcustomPosX`]: hov_TABovl_bgImgcustomPosX, [`hov_TAB${controlName}ovl_bgImgcustomPosXUnit`]: hov_TABovl_bgImgcustomPosXUnit, [`hov_TAB${controlName}ovl_bgImgcustomPosY`]: hov_TABovl_bgImgcustomPosY, [`hov_TAB${controlName}ovl_bgImgcustomPosYUnit`]: hov_TABovl_bgImgcustomPosYUnit, [`hov_TAB${controlName}ovl_bgImgRepeat`]: hov_TABovl_bgImgRepeat, [`hov_MOB${controlName}ovl_backgroundSize`]: hov_MOBovl_backgroundSize, [`hov_MOB${controlName}ovl_bgImgCustomSize`]: hov_MOBovl_bgImgCustomSize, [`hov_MOB${controlName}ovl_bgImgCustomSizeUnit`]: hov_MOBovl_bgImgCustomSizeUnit, [`hov_MOB${controlName}ovl_bgImgPos`]: hov_MOBovl_bgImgPos, [`hov_MOB${controlName}ovl_bgImgcustomPosX`]: hov_MOBovl_bgImgcustomPosX, [`hov_MOB${controlName}ovl_bgImgcustomPosXUnit`]: hov_MOBovl_bgImgcustomPosXUnit, [`hov_MOB${controlName}ovl_bgImgcustomPosY`]: hov_MOBovl_bgImgcustomPosY, [`hov_MOB${controlName}ovl_bgImgcustomPosYUnit`]: hov_MOBovl_bgImgcustomPosYUnit, [`hov_MOB${controlName}ovl_bgImgRepeat`]: hov_MOBovl_bgImgRepeat, } = attributes; return ( <> {[ { label: __("Normal", "betterdocs"), value: "normal" }, { label: __("Hover", "betterdocs"), value: "hover" }, ].map(({ value, label }) => ( ))} {ovl_hoverType === "normal" && ( <> {[ { label: "Classic", value: "classic" }, { label: "Gradient", value: "gradient" }, ].map(({ value, label }) => ( ))} {overlayType === "classic" && ( <> setAttributes({ [`${controlName}overlayColor`]: overlayColor, }) } /> {noOverlayBgi === false && ( <> setAttributes({ [`${controlName}ovl_bgImageURL`]: url, [`${controlName}ovl_bgImageID`]: id, }) } type="image" value={ovl_bgImageID} render={({ open }) => !ovl_bgImageURL && ( <> ))} {hov_overlayType === "classic" && ( <> setAttributes({ [`hov_${controlName}overlayColor`]: hov_overlayColor, }) } /> {noOverlayBgi === false && ( <> setAttributes({ [`hov_${controlName}ovl_bgImageURL`]: url, [`hov_${controlName}ovl_bgImageID`]: id, }) } type="image" value={hov_ovl_bgImageID} render={({ open }) => !hov_ovl_bgImageURL && ( <>