PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 4.9.5
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v4.9.5
4.9.5 4.9.4 4.9.3 4.9.2 4.9.1 4.9.0 4.8.2 4.8.1 4.8.0 4.7.0 4.6.2 4.6.1 4.6.0 4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 4.5.1 4.5.0 4.4.1 4.4.0 3.3.4 3.4.0 3.4.1 All 203 releases
betterdocs / react-src / gutenberg / util / background-control / overlayControl.js

overlayControl.js in BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot 4.9.5, at react-src/gutenberg/util/background-control/overlayControl.js

2,196 lines 97.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 const { __ } = wp.i18n;
2 const { MediaUpload } = wp.blockEditor;
3 const {
4 SelectControl,
5 Button,
6 RangeControl,
7 BaseControl,
8 ButtonGroup,
9 ToggleControl,
10 } = wp.components;
11
12 /**
13 * Internal dependencies
14 */
15 import GradientColorControl from "../gradient-color-controller";
16 import UnitControl from "../unit-control";
17 import ColorControl from "../color-control";
18 import ImageAvatar from "../image-avatar";
19 import WithResButtons from "../withResButtons";
20 import ResetControl from "../reset-control";
21
22 export default function overlayControl({
23 resRequiredProps,
24 controlName,
25 noOverlayBgi,
26 noTransition,
27 }) {
28 const { setAttributes, attributes, resOption } = resRequiredProps;
29
30 const {
31 [`${controlName}ovl_hoverType`]: ovl_hoverType,
32 [`${controlName}ovl_bg_transition`]: ovl_bg_transition,
33 [`${controlName}ovl_filtersTransition`]: ovl_filtersTransition,
34 [`${controlName}ovl_opacityTransition`]: ovl_opacityTransition,
35
36 // attributes for ovl_hoverType normal start ⬇
37 [`${controlName}overlayType`]: overlayType,
38 [`${controlName}overlayColor`]: overlayColor,
39 [`${controlName}overlayGradient`]: overlayGradient,
40 [`${controlName}ovl_bgImageURL`]: ovl_bgImageURL,
41 [`${controlName}ovl_bgImageID`]: ovl_bgImageID,
42 [`${controlName}ovl_bgImgAttachment`]: ovl_bgImgAttachment,
43
44 [`${controlName}ovl_opacity`]: ovl_opacity,
45 [`${controlName}ovl_blendMode`]: ovl_blendMode,
46
47 [`${controlName}ovl_allowFilters`]: ovl_allowFilters,
48 [`${controlName}ovl_fltrBrightness`]: ovl_fltrBrightness,
49 [`${controlName}ovl_fltrContrast`]: ovl_fltrContrast,
50 [`${controlName}ovl_fltrSaturation`]: ovl_fltrSaturation,
51 [`${controlName}ovl_fltrBlur`]: ovl_fltrBlur,
52 [`${controlName}ovl_fltrHue`]: ovl_fltrHue,
53
54 [`${controlName}ovl_backgroundSize`]: ovl_backgroundSize,
55 [`${controlName}ovl_bgImgCustomSize`]: ovl_bgImgCustomSize,
56 [`${controlName}ovl_bgImgCustomSizeUnit`]: ovl_bgImgCustomSizeUnit,
57 [`${controlName}ovl_bgImgPos`]: ovl_bgImgPos,
58 [`${controlName}ovl_bgImgcustomPosX`]: ovl_bgImgcustomPosX,
59 [`${controlName}ovl_bgImgcustomPosXUnit`]: ovl_bgImgcustomPosXUnit,
60 [`${controlName}ovl_bgImgcustomPosY`]: ovl_bgImgcustomPosY,
61 [`${controlName}ovl_bgImgcustomPosYUnit`]: ovl_bgImgcustomPosYUnit,
62 [`${controlName}ovl_bgImgRepeat`]: ovl_bgImgRepeat,
63
64 [`TAB${controlName}ovl_backgroundSize`]: TABovl_backgroundSize,
65 [`TAB${controlName}ovl_bgImgCustomSize`]: TABovl_bgImgCustomSize,
66 [`TAB${controlName}ovl_bgImgCustomSizeUnit`]: TABovl_bgImgCustomSizeUnit,
67 [`TAB${controlName}ovl_bgImgPos`]: TABovl_bgImgPos,
68 [`TAB${controlName}ovl_bgImgcustomPosX`]: TABovl_bgImgcustomPosX,
69 [`TAB${controlName}ovl_bgImgcustomPosXUnit`]: TABovl_bgImgcustomPosXUnit,
70 [`TAB${controlName}ovl_bgImgcustomPosY`]: TABovl_bgImgcustomPosY,
71 [`TAB${controlName}ovl_bgImgcustomPosYUnit`]: TABovl_bgImgcustomPosYUnit,
72 [`TAB${controlName}ovl_bgImgRepeat`]: TABovl_bgImgRepeat,
73
74 [`MOB${controlName}ovl_backgroundSize`]: MOBovl_backgroundSize,
75 [`MOB${controlName}ovl_bgImgCustomSize`]: MOBovl_bgImgCustomSize,
76 [`MOB${controlName}ovl_bgImgCustomSizeUnit`]: MOBovl_bgImgCustomSizeUnit,
77 [`MOB${controlName}ovl_bgImgPos`]: MOBovl_bgImgPos,
78 [`MOB${controlName}ovl_bgImgcustomPosX`]: MOBovl_bgImgcustomPosX,
79 [`MOB${controlName}ovl_bgImgcustomPosXUnit`]: MOBovl_bgImgcustomPosXUnit,
80 [`MOB${controlName}ovl_bgImgcustomPosY`]: MOBovl_bgImgcustomPosY,
81 [`MOB${controlName}ovl_bgImgcustomPosYUnit`]: MOBovl_bgImgcustomPosYUnit,
82 [`MOB${controlName}ovl_bgImgRepeat`]: MOBovl_bgImgRepeat,
83 // attributes for ovl_hoverType normal end
84
85 // attributes for ovl_hoverType hover start ⬇
86 [`hov_${controlName}overlayType`]: hov_overlayType,
87 [`hov_${controlName}overlayColor`]: hov_overlayColor,
88 [`hov_${controlName}overlayGradient`]: hov_overlayGradient,
89 [`hov_${controlName}ovl_bgImageURL`]: hov_ovl_bgImageURL,
90 [`hov_${controlName}ovl_bgImageID`]: hov_ovl_bgImageID,
91 [`hov_${controlName}ovl_bgImgAttachment`]: hov_ovl_bgImgAttachment,
92
93 [`hov_${controlName}ovl_opacity`]: hov_ovl_opacity,
94 [`hov_${controlName}ovl_blendMode`]: hov_ovl_blendMode,
95
96 [`hov_${controlName}ovl_allowFilters`]: hov_ovl_allowFilters,
97 [`hov_${controlName}ovl_fltrBrightness`]: hov_ovl_fltrBrightness,
98 [`hov_${controlName}ovl_fltrContrast`]: hov_ovl_fltrContrast,
99 [`hov_${controlName}ovl_fltrSaturation`]: hov_ovl_fltrSaturation,
100 [`hov_${controlName}ovl_fltrBlur`]: hov_ovl_fltrBlur,
101 [`hov_${controlName}ovl_fltrHue`]: hov_ovl_fltrHue,
102
103 [`hov_${controlName}ovl_backgroundSize`]: hov_ovl_backgroundSize,
104 [`hov_${controlName}ovl_bgImgCustomSize`]: hov_ovl_bgImgCustomSize,
105 [`hov_${controlName}ovl_bgImgCustomSizeUnit`]: hov_ovl_bgImgCustomSizeUnit,
106 [`hov_${controlName}ovl_bgImgPos`]: hov_ovl_bgImgPos,
107 [`hov_${controlName}ovl_bgImgcustomPosX`]: hov_ovl_bgImgcustomPosX,
108 [`hov_${controlName}ovl_bgImgcustomPosXUnit`]: hov_ovl_bgImgcustomPosXUnit,
109 [`hov_${controlName}ovl_bgImgcustomPosY`]: hov_ovl_bgImgcustomPosY,
110 [`hov_${controlName}ovl_bgImgcustomPosYUnit`]: hov_ovl_bgImgcustomPosYUnit,
111 [`hov_${controlName}ovl_bgImgRepeat`]: hov_ovl_bgImgRepeat,
112
113 [`hov_TAB${controlName}ovl_backgroundSize`]: hov_TABovl_backgroundSize,
114 [`hov_TAB${controlName}ovl_bgImgCustomSize`]: hov_TABovl_bgImgCustomSize,
115 [`hov_TAB${controlName}ovl_bgImgCustomSizeUnit`]:
116 hov_TABovl_bgImgCustomSizeUnit,
117 [`hov_TAB${controlName}ovl_bgImgPos`]: hov_TABovl_bgImgPos,
118 [`hov_TAB${controlName}ovl_bgImgcustomPosX`]: hov_TABovl_bgImgcustomPosX,
119 [`hov_TAB${controlName}ovl_bgImgcustomPosXUnit`]:
120 hov_TABovl_bgImgcustomPosXUnit,
121 [`hov_TAB${controlName}ovl_bgImgcustomPosY`]: hov_TABovl_bgImgcustomPosY,
122 [`hov_TAB${controlName}ovl_bgImgcustomPosYUnit`]:
123 hov_TABovl_bgImgcustomPosYUnit,
124 [`hov_TAB${controlName}ovl_bgImgRepeat`]: hov_TABovl_bgImgRepeat,
125
126 [`hov_MOB${controlName}ovl_backgroundSize`]: hov_MOBovl_backgroundSize,
127 [`hov_MOB${controlName}ovl_bgImgCustomSize`]: hov_MOBovl_bgImgCustomSize,
128 [`hov_MOB${controlName}ovl_bgImgCustomSizeUnit`]:
129 hov_MOBovl_bgImgCustomSizeUnit,
130 [`hov_MOB${controlName}ovl_bgImgPos`]: hov_MOBovl_bgImgPos,
131 [`hov_MOB${controlName}ovl_bgImgcustomPosX`]: hov_MOBovl_bgImgcustomPosX,
132 [`hov_MOB${controlName}ovl_bgImgcustomPosXUnit`]:
133 hov_MOBovl_bgImgcustomPosXUnit,
134 [`hov_MOB${controlName}ovl_bgImgcustomPosY`]: hov_MOBovl_bgImgcustomPosY,
135 [`hov_MOB${controlName}ovl_bgImgcustomPosYUnit`]:
136 hov_MOBovl_bgImgcustomPosYUnit,
137 [`hov_MOB${controlName}ovl_bgImgRepeat`]: hov_MOBovl_bgImgRepeat,
138 } = attributes;
139
140 return (
141 <>
142 <BaseControl label={__("Background Overlay", "betterdocs")}></BaseControl>
143 <BaseControl>
144 <ButtonGroup>
145 {[
146 { label: __("Normal", "betterdocs"), value: "normal" },
147 { label: __("Hover", "betterdocs"), value: "hover" },
148 ].map(({ value, label }) => (
149 <Button
150 // isSmall
151 // isLarge
152 key={`ovl-${value}`}
153 isPrimary={ovl_hoverType === value}
154 isSecondary={ovl_hoverType !== value}
155 onClick={() =>
156 setAttributes({
157 [`${controlName}ovl_hoverType`]: value,
158 })
159 }
160 >
161 {label}
162 </Button>
163 ))}
164 </ButtonGroup>
165 </BaseControl>
166
167 {ovl_hoverType === "normal" && (
168 <>
169 <BaseControl label={__("Overlay Type", "betterdocs")}>
170 <ButtonGroup id="eb-background-control-new">
171 {[
172 { label: "Classic", value: "classic" },
173 { label: "Gradient", value: "gradient" },
174 ].map(({ value, label }) => (
175 <Button
176 isLarge
177 key={`ovl-${value}-normal`}
178 isPrimary={overlayType === value}
179 isSecondary={overlayType !== value}
180 onClick={() =>
181 setAttributes({
182 [`${controlName}overlayType`]: value,
183 })
184 }
185 >
186 {label}
187 </Button>
188 ))}
189 </ButtonGroup>
190 </BaseControl>
191
192 {overlayType === "classic" && (
193 <>
194 <ColorControl
195 label={__("Overlay Color", "betterdocs")}
196 color={overlayColor}
197 onChange={(overlayColor) =>
198 setAttributes({
199 [`${controlName}overlayColor`]: overlayColor,
200 })
201 }
202 />
203
204 {noOverlayBgi === false && (
205 <>
206 <BaseControl label={__("Overlay Image", "betterdocs")}></BaseControl>
207
208 <MediaUpload
209 onSelect={({ url, id }) =>
210 setAttributes({
211 [`${controlName}ovl_bgImageURL`]: url,
212 [`${controlName}ovl_bgImageID`]: id,
213 })
214 }
215 type="image"
216 value={ovl_bgImageID}
217 render={({ open }) =>
218 !ovl_bgImageURL && (
219 <>
220 <Button
221 className="eb-background-control-inspector-panel-img-btn components-button"
222 label={__("Upload Image", "betterdocs")}
223 icon="format-image"
224 onClick={open}
225 />
226 <span
227 style={{ padding: "10px 0", display: "block" }}
228 ></span>
229 </>
230 )
231 }
232 />
233
234 {ovl_bgImageURL && (
235 <>
236 <ImageAvatar
237 imageUrl={ovl_bgImageURL}
238 onDeleteImage={() =>
239 setAttributes({
240 [`${controlName}ovl_bgImageURL`]: null,
241 })
242 }
243 />
244
245 {resOption === "Desktop" && (
246 <>
247 <WithResButtons
248 resRequiredProps={resRequiredProps}
249 label="Position"
250 >
251 <SelectControl
252 value={ovl_bgImgPos}
253 options={[
254 { label: __("Default", "betterdocs"), value: "" },
255 {
256 label: __("Center Center", "betterdocs"),
257 value: "center center",
258 },
259 {
260 label: __("Center Left", "betterdocs"),
261 value: "center left",
262 },
263 {
264 label: __("Center Right", "betterdocs"),
265 value: "center right",
266 },
267 {
268 label: __("Top Center", "betterdocs"),
269 value: "top center",
270 },
271 { label: __("Top Left", "betterdocs"), value: "top left" },
272 {
273 label: __("Top Right", "betterdocs"),
274 value: "top right",
275 },
276 {
277 label: __("Bottom Center", "betterdocs"),
278 value: "bottom center",
279 },
280 {
281 label: __("Bottom Left", "betterdocs"),
282 value: "bottom left",
283 },
284 {
285 label: __("Bottom Right", "betterdocs"),
286 value: "bottom right",
287 },
288 { label: __("Custom", "betterdocs"), value: "custom" },
289 ]}
290 onChange={(ovl_bgImgPos) =>
291 setAttributes({
292 [`${controlName}ovl_bgImgPos`]: ovl_bgImgPos,
293 })
294 }
295 />
296 </WithResButtons>
297
298 {ovl_bgImgPos === "custom" && (
299 <>
300 <UnitControl
301 selectedUnit={ovl_bgImgcustomPosXUnit}
302 unitTypes={[
303 { label: "px", value: "px" },
304 { label: "em", value: "em" },
305 { label: "%", value: "%" },
306 ]}
307 onClick={(ovl_bgImgcustomPosXUnit) =>
308 setAttributes({
309 [`${controlName}ovl_bgImgcustomPosXUnit`]:
310 ovl_bgImgcustomPosXUnit,
311 })
312 }
313 />
314
315 <WithResButtons
316 resRequiredProps={resRequiredProps}
317 label="X Position"
318 >
319 <RangeControl
320 value={ovl_bgImgcustomPosX}
321 min={0}
322 max={
323 ovl_bgImgcustomPosXUnit === "px"
324 ? 2000
325 : 100
326 }
327 onChange={(ovl_bgImgcustomPosX) =>
328 setAttributes({
329 [`${controlName}ovl_bgImgcustomPosX`]:
330 ovl_bgImgcustomPosX,
331 })
332 }
333 />
334 </WithResButtons>
335
336 <UnitControl
337 selectedUnit={ovl_bgImgcustomPosYUnit}
338 unitTypes={[
339 { label: "px", value: "px" },
340 { label: "em", value: "em" },
341 { label: "%", value: "%" },
342 ]}
343 onClick={(ovl_bgImgcustomPosYUnit) =>
344 setAttributes({
345 [`${controlName}ovl_bgImgcustomPosYUnit`]:
346 ovl_bgImgcustomPosYUnit,
347 })
348 }
349 />
350
351 <WithResButtons
352 resRequiredProps={resRequiredProps}
353 label="Y Position"
354 >
355 <RangeControl
356 value={ovl_bgImgcustomPosY}
357 min={0}
358 max={
359 ovl_bgImgcustomPosYUnit === "px"
360 ? 2000
361 : 100
362 }
363 step={
364 ovl_bgImgcustomPosYUnit === "px" ? 1 : 0.1
365 }
366 onChange={(ovl_bgImgcustomPosY) =>
367 setAttributes({
368 [`${controlName}ovl_bgImgcustomPosY`]:
369 ovl_bgImgcustomPosY,
370 })
371 }
372 />
373 </WithResButtons>
374 </>
375 )}
376
377 <SelectControl
378 label="Attachment"
379 value={ovl_bgImgAttachment}
380 options={[
381 { label: __("Default", "betterdocs"), value: "" },
382 { label: __("Scroll", "betterdocs"), value: "scroll" },
383 { label: __("Fixed", "betterdocs"), value: "fixed" },
384 ]}
385 onChange={(ovl_bgImgAttachment) =>
386 setAttributes({
387 [`${controlName}ovl_bgImgAttachment`]:
388 ovl_bgImgAttachment,
389 })
390 }
391 />
392
393 {ovl_bgImgAttachment === "fixed" && (
394 <p
395 style={{
396 marginTop: "-10px",
397 paddingBottom: "10px",
398 }}
399 >
400 <i>
401 Note: Attachment Fixed works only on desktop.
402 </i>
403 </p>
404 )}
405
406 <WithResButtons
407 resRequiredProps={resRequiredProps}
408 label="Repeat"
409 >
410 <SelectControl
411 value={ovl_bgImgRepeat}
412 options={[
413 { label: __("Default", "betterdocs"), value: "" },
414 {
415 label: __("No-repeat", "betterdocs"),
416 value: "no-repeat",
417 },
418 { label: __("Repeat", "betterdocs"), value: "repeat" },
419 { label: __("Repeat-x", "betterdocs"), value: "repeat-x" },
420 { label: __("Repeat-y", "betterdocs"), value: "repeat-y" },
421 ]}
422 onChange={(ovl_bgImgRepeat) =>
423 setAttributes({
424 [`${controlName}ovl_bgImgRepeat`]:
425 ovl_bgImgRepeat,
426 })
427 }
428 />
429 </WithResButtons>
430
431 <WithResButtons
432 resRequiredProps={resRequiredProps}
433 label="Size"
434 >
435 <SelectControl
436 value={ovl_backgroundSize}
437 options={[
438 { label: __("Default", "betterdocs"), value: "" },
439 { label: __("Auto", "betterdocs"), value: "auto" },
440 { label: __("Cover", "betterdocs"), value: "cover" },
441 { label: __("Contain", "betterdocs"), value: "contain" },
442 { label: __("Custom", "betterdocs"), value: "custom" },
443 ]}
444 onChange={(ovl_backgroundSize) =>
445 setAttributes({
446 [`${controlName}ovl_backgroundSize`]:
447 ovl_backgroundSize,
448 })
449 }
450 />
451 </WithResButtons>
452
453 {ovl_backgroundSize === "custom" && (
454 <>
455 <UnitControl
456 selectedUnit={ovl_bgImgCustomSizeUnit}
457 unitTypes={[
458 { label: "px", value: "px" },
459 { label: "em", value: "em" },
460 { label: "%", value: "%" },
461 ]}
462 onClick={(ovl_bgImgCustomSizeUnit) =>
463 setAttributes({
464 [`${controlName}ovl_bgImgCustomSizeUnit`]:
465 ovl_bgImgCustomSizeUnit,
466 })
467 }
468 />
469
470 <WithResButtons
471 resRequiredProps={resRequiredProps}
472 label="Width"
473 >
474 <RangeControl
475 value={ovl_bgImgCustomSize}
476 min={0}
477 max={
478 ovl_bgImgCustomSizeUnit === "px"
479 ? 2000
480 : 100
481 }
482 step={
483 ovl_bgImgCustomSizeUnit === "px" ? 1 : 0.1
484 }
485 onChange={(ovl_bgImgCustomSize) =>
486 setAttributes({
487 [`${controlName}ovl_bgImgCustomSize`]:
488 ovl_bgImgCustomSize,
489 })
490 }
491 />
492 </WithResButtons>
493 </>
494 )}
495 </>
496 )}
497
498 {resOption === "Tablet" && (
499 <>
500 <WithResButtons
501 resRequiredProps={resRequiredProps}
502 label="Position"
503 >
504 <SelectControl
505 value={TABovl_bgImgPos}
506 options={[
507 { label: __("Default", "betterdocs"), value: "" },
508 {
509 label: __("Center Center", "betterdocs"),
510 value: "center center",
511 },
512 {
513 label: __("Center Left", "betterdocs"),
514 value: "center left",
515 },
516 {
517 label: __("Center Right", "betterdocs"),
518 value: "center right",
519 },
520 {
521 label: __("Top Center", "betterdocs"),
522 value: "top center",
523 },
524 { label: __("Top Left", "betterdocs"), value: "top left" },
525 {
526 label: __("Top Right", "betterdocs"),
527 value: "top right",
528 },
529 {
530 label: __("Bottom Center", "betterdocs"),
531 value: "bottom center",
532 },
533 {
534 label: __("Bottom Left", "betterdocs"),
535 value: "bottom left",
536 },
537 {
538 label: __("Bottom Right", "betterdocs"),
539 value: "bottom right",
540 },
541 { label: __("Custom", "betterdocs"), value: "custom" },
542 ]}
543 onChange={(TABovl_bgImgPos) =>
544 setAttributes({
545 [`TAB${controlName}ovl_bgImgPos`]:
546 TABovl_bgImgPos,
547 })
548 }
549 />
550 </WithResButtons>
551
552 {TABovl_bgImgPos === "custom" && (
553 <>
554 <UnitControl
555 selectedUnit={TABovl_bgImgcustomPosXUnit}
556 unitTypes={[
557 { label: "px", value: "px" },
558 { label: "em", value: "em" },
559 { label: "%", value: "%" },
560 ]}
561 onClick={(TABovl_bgImgcustomPosXUnit) =>
562 setAttributes({
563 [`TAB${controlName}ovl_bgImgcustomPosXUnit`]:
564 TABovl_bgImgcustomPosXUnit,
565 })
566 }
567 />
568
569 <WithResButtons
570 resRequiredProps={resRequiredProps}
571 label="X Position"
572 >
573 <RangeControl
574 value={TABovl_bgImgcustomPosX}
575 min={-2000}
576 max={
577 // TABovl_bgImgcustomPosXUnit === "px"
578 // ?
579 2000
580 // : 100
581 }
582 onChange={(TABovl_bgImgcustomPosX) =>
583 setAttributes({
584 [`TAB${controlName}ovl_bgImgcustomPosX`]:
585 TABovl_bgImgcustomPosX,
586 })
587 }
588 />
589 </WithResButtons>
590
591 <UnitControl
592 selectedUnit={TABovl_bgImgcustomPosYUnit}
593 unitTypes={[
594 { label: "px", value: "px" },
595 { label: "em", value: "em" },
596 { label: "%", value: "%" },
597 ]}
598 onClick={(TABovl_bgImgcustomPosYUnit) =>
599 setAttributes({
600 [`TAB${controlName}ovl_bgImgcustomPosYUnit`]:
601 TABovl_bgImgcustomPosYUnit,
602 })
603 }
604 />
605
606 <WithResButtons
607 resRequiredProps={resRequiredProps}
608 label="Y Position"
609 >
610 <RangeControl
611 value={TABovl_bgImgcustomPosY}
612 min={-2000}
613 max={
614 // TABovl_bgImgcustomPosYUnit === "px"
615 // ?
616 2000
617 // : 100
618 }
619 step={
620 TABovl_bgImgcustomPosYUnit === "px"
621 ? 1
622 : 0.1
623 }
624 onChange={(TABovl_bgImgcustomPosY) =>
625 setAttributes({
626 [`TAB${controlName}ovl_bgImgcustomPosY`]:
627 TABovl_bgImgcustomPosY,
628 })
629 }
630 />
631 </WithResButtons>
632 </>
633 )}
634
635 <SelectControl
636 label="Attachment"
637 value={ovl_bgImgAttachment}
638 options={[
639 { label: __("Default", "betterdocs"), value: "" },
640 { label: __("Scroll", "betterdocs"), value: "scroll" },
641 { label: __("Fixed", "betterdocs"), value: "fixed" },
642 ]}
643 onChange={(ovl_bgImgAttachment) =>
644 setAttributes({
645 [`${controlName}ovl_bgImgAttachment`]:
646 ovl_bgImgAttachment,
647 })
648 }
649 />
650
651 {ovl_bgImgAttachment === "fixed" && (
652 <p
653 style={{
654 marginTop: "-10px",
655 paddingBottom: "10px",
656 }}
657 >
658 <i>
659 Note: Attachment Fixed works only on desktop.
660 </i>
661 </p>
662 )}
663
664 <WithResButtons
665 resRequiredProps={resRequiredProps}
666 label="Repeat"
667 >
668 <SelectControl
669 value={TABovl_bgImgRepeat}
670 options={[
671 { label: __("Default", "betterdocs"), value: "" },
672 {
673 label: __("No-repeat", "betterdocs"),
674 value: "no-repeat",
675 },
676 { label: __("Repeat", "betterdocs"), value: "repeat" },
677 { label: __("Repeat-x", "betterdocs"), value: "repeat-x" },
678 { label: __("Repeat-y", "betterdocs"), value: "repeat-y" },
679 ]}
680 onChange={(TABovl_bgImgRepeat) =>
681 setAttributes({
682 [`TAB${controlName}ovl_bgImgRepeat`]:
683 TABovl_bgImgRepeat,
684 })
685 }
686 />
687 </WithResButtons>
688
689 <WithResButtons
690 resRequiredProps={resRequiredProps}
691 label="Size"
692 >
693 <SelectControl
694 value={TABovl_backgroundSize}
695 options={[
696 { label: __("Default", "betterdocs"), value: "" },
697 { label: __("Auto", "betterdocs"), value: "auto" },
698 { label: __("Cover", "betterdocs"), value: "cover" },
699 { label: __("Contain", "betterdocs"), value: "contain" },
700 { label: __("Custom", "betterdocs"), value: "custom" },
701 ]}
702 onChange={(TABovl_backgroundSize) =>
703 setAttributes({
704 [`TAB${controlName}ovl_backgroundSize`]:
705 TABovl_backgroundSize,
706 })
707 }
708 />
709 </WithResButtons>
710
711 {TABovl_backgroundSize === "custom" && (
712 <>
713 <UnitControl
714 selectedUnit={TABovl_bgImgCustomSizeUnit}
715 unitTypes={[
716 { label: "px", value: "px" },
717 { label: "em", value: "em" },
718 { label: "%", value: "%" },
719 ]}
720 onClick={(TABovl_bgImgCustomSizeUnit) =>
721 setAttributes({
722 [`TAB${controlName}ovl_bgImgCustomSizeUnit`]:
723 TABovl_bgImgCustomSizeUnit,
724 })
725 }
726 />
727
728 <WithResButtons
729 resRequiredProps={resRequiredProps}
730 label="Width"
731 >
732 <RangeControl
733 value={TABovl_bgImgCustomSize}
734 min={0}
735 max={
736 TABovl_bgImgCustomSizeUnit === "px"
737 ? 2000
738 : 100
739 }
740 step={
741 TABovl_bgImgCustomSizeUnit === "px"
742 ? 1
743 : 0.1
744 }
745 onChange={(TABovl_bgImgCustomSize) =>
746 setAttributes({
747 [`TAB${controlName}ovl_bgImgCustomSize`]:
748 TABovl_bgImgCustomSize,
749 })
750 }
751 />
752 </WithResButtons>
753 </>
754 )}
755 </>
756 )}
757
758 {resOption === "Mobile" && (
759 <>
760 <WithResButtons
761 resRequiredProps={resRequiredProps}
762 label="Position"
763 >
764 <SelectControl
765 value={MOBovl_bgImgPos}
766 options={[
767 { label: __("Default", "betterdocs"), value: "" },
768 {
769 label: __("Center Center", "betterdocs"),
770 value: "center center",
771 },
772 {
773 label: __("Center Left", "betterdocs"),
774 value: "center left",
775 },
776 {
777 label: __("Center Right", "betterdocs"),
778 value: "center right",
779 },
780 {
781 label: __("Top Center", "betterdocs"),
782 value: "top center",
783 },
784 { label: __("Top Left", "betterdocs"), value: "top left" },
785 {
786 label: __("Top Right", "betterdocs"),
787 value: "top right",
788 },
789 {
790 label: __("Bottom Center", "betterdocs"),
791 value: "bottom center",
792 },
793 {
794 label: __("Bottom Left", "betterdocs"),
795 value: "bottom left",
796 },
797 {
798 label: __("Bottom Right", "betterdocs"),
799 value: "bottom right",
800 },
801 { label: __("Custom", "betterdocs"), value: "custom" },
802 ]}
803 onChange={(MOBovl_bgImgPos) =>
804 setAttributes({
805 [`MOB${controlName}ovl_bgImgPos`]:
806 MOBovl_bgImgPos,
807 })
808 }
809 />
810 </WithResButtons>
811
812 {MOBovl_bgImgPos === "custom" && (
813 <>
814 <UnitControl
815 selectedUnit={MOBovl_bgImgcustomPosXUnit}
816 unitTypes={[
817 { label: "px", value: "px" },
818 { label: "em", value: "em" },
819 { label: "%", value: "%" },
820 ]}
821 onClick={(MOBovl_bgImgcustomPosXUnit) =>
822 setAttributes({
823 [`MOB${controlName}ovl_bgImgcustomPosXUnit`]:
824 MOBovl_bgImgcustomPosXUnit,
825 })
826 }
827 />
828
829 <WithResButtons
830 resRequiredProps={resRequiredProps}
831 label="X Position"
832 >
833 <RangeControl
834 value={MOBovl_bgImgcustomPosX}
835 min={0}
836 max={
837 MOBovl_bgImgcustomPosXUnit === "px"
838 ? 2000
839 : 100
840 }
841 onChange={(MOBovl_bgImgcustomPosX) =>
842 setAttributes({
843 [`MOB${controlName}ovl_bgImgcustomPosX`]:
844 MOBovl_bgImgcustomPosX,
845 })
846 }
847 />
848 </WithResButtons>
849
850 <UnitControl
851 selectedUnit={MOBovl_bgImgcustomPosYUnit}
852 unitTypes={[
853 { label: "px", value: "px" },
854 { label: "em", value: "em" },
855 { label: "%", value: "%" },
856 ]}
857 onClick={(MOBovl_bgImgcustomPosYUnit) =>
858 setAttributes({
859 [`MOB${controlName}ovl_bgImgcustomPosYUnit`]:
860 MOBovl_bgImgcustomPosYUnit,
861 })
862 }
863 />
864
865 <WithResButtons
866 resRequiredProps={resRequiredProps}
867 label="Y Position"
868 >
869 <RangeControl
870 value={MOBovl_bgImgcustomPosY}
871 min={0}
872 max={
873 MOBovl_bgImgcustomPosYUnit === "px"
874 ? 2000
875 : 100
876 }
877 step={
878 MOBovl_bgImgcustomPosYUnit === "px"
879 ? 1
880 : 0.1
881 }
882 onChange={(MOBovl_bgImgcustomPosY) =>
883 setAttributes({
884 [`MOB${controlName}ovl_bgImgcustomPosY`]:
885 MOBovl_bgImgcustomPosY,
886 })
887 }
888 />
889 </WithResButtons>
890 </>
891 )}
892
893 <SelectControl
894 label="Attachment"
895 value={ovl_bgImgAttachment}
896 options={[
897 { label: __("Default", "betterdocs"), value: "" },
898 { label: __("Scroll", "betterdocs"), value: "scroll" },
899 { label: __("Fixed", "betterdocs"), value: "fixed" },
900 ]}
901 onChange={(ovl_bgImgAttachment) =>
902 setAttributes({
903 [`${controlName}ovl_bgImgAttachment`]:
904 ovl_bgImgAttachment,
905 })
906 }
907 />
908
909 {ovl_bgImgAttachment === "fixed" && (
910 <p
911 style={{
912 marginTop: "-10px",
913 paddingBottom: "10px",
914 }}
915 >
916 <i>
917 Note: Attachment Fixed works only on desktop.
918 </i>
919 </p>
920 )}
921
922 <WithResButtons
923 resRequiredProps={resRequiredProps}
924 label="Repeat"
925 >
926 <SelectControl
927 value={MOBovl_bgImgRepeat}
928 options={[
929 { label: __("Default", "betterdocs"), value: "" },
930 {
931 label: __("No-repeat", "betterdocs"),
932 value: "no-repeat",
933 },
934 { label: __("Repeat", "betterdocs"), value: "repeat" },
935 { label: __("Repeat-x", "betterdocs"), value: "repeat-x" },
936 { label: __("Repeat-y", "betterdocs"), value: "repeat-y" },
937 ]}
938 onChange={(MOBovl_bgImgRepeat) =>
939 setAttributes({
940 [`MOB${controlName}ovl_bgImgRepeat`]:
941 MOBovl_bgImgRepeat,
942 })
943 }
944 />
945 </WithResButtons>
946
947 <WithResButtons
948 resRequiredProps={resRequiredProps}
949 label="Size"
950 >
951 <SelectControl
952 value={MOBovl_backgroundSize}
953 options={[
954 { label: __("Default", "betterdocs"), value: "" },
955 { label: __("Auto", "betterdocs"), value: "auto" },
956 { label: __("Cover", "betterdocs"), value: "cover" },
957 { label: __("Contain", "betterdocs"), value: "contain" },
958 { label: __("Custom", "betterdocs"), value: "custom" },
959 ]}
960 onChange={(MOBovl_backgroundSize) =>
961 setAttributes({
962 [`MOB${controlName}ovl_backgroundSize`]:
963 MOBovl_backgroundSize,
964 })
965 }
966 />
967 </WithResButtons>
968
969 {MOBovl_backgroundSize === "custom" && (
970 <>
971 <UnitControl
972 selectedUnit={MOBovl_bgImgCustomSizeUnit}
973 unitTypes={[
974 { label: "px", value: "px" },
975 { label: "em", value: "em" },
976 { label: "%", value: "%" },
977 ]}
978 onClick={(MOBovl_bgImgCustomSizeUnit) =>
979 setAttributes({
980 [`MOB${controlName}ovl_bgImgCustomSizeUnit`]:
981 MOBovl_bgImgCustomSizeUnit,
982 })
983 }
984 />
985
986 <WithResButtons
987 resRequiredProps={resRequiredProps}
988 label="Width"
989 >
990 <RangeControl
991 value={MOBovl_bgImgCustomSize}
992 min={0}
993 max={
994 MOBovl_bgImgCustomSizeUnit === "px"
995 ? 2000
996 : 100
997 }
998 step={
999 MOBovl_bgImgCustomSizeUnit === "px"
1000 ? 1
1001 : 0.1
1002 }
1003 onChange={(MOBovl_bgImgCustomSize) =>
1004 setAttributes({
1005 [`MOB${controlName}ovl_bgImgCustomSize`]:
1006 MOBovl_bgImgCustomSize,
1007 })
1008 }
1009 />
1010 </WithResButtons>
1011 </>
1012 )}
1013 </>
1014 )}
1015 </>
1016 )}
1017 </>
1018 )}
1019 </>
1020 )}
1021
1022 {overlayType === "gradient" && (
1023 <GradientColorControl
1024 gradientColor={overlayGradient}
1025 onChange={(overlayGradient) =>
1026 setAttributes({
1027 [`${controlName}overlayGradient`]: overlayGradient,
1028 })
1029 }
1030 />
1031 )}
1032
1033 <hr />
1034
1035 <RangeControl
1036 label={__("Opacity", "betterdocs")}
1037 value={ovl_opacity}
1038 onChange={(ovl_opacity) =>
1039 setAttributes({
1040 [`${controlName}ovl_opacity`]: ovl_opacity,
1041 })
1042 }
1043 step={0.01}
1044 min={0}
1045 max={1}
1046 />
1047
1048 <SelectControl
1049 label={__("Blend Mode", "betterdocs")}
1050 value={ovl_blendMode}
1051 options={[
1052 { label: __("Normal", "betterdocs"), value: "" },
1053 { label: __("Multiply", "betterdocs"), value: "multiply" },
1054 { label: __("Screen", "betterdocs"), value: "screen" },
1055 { label: __("Overlay", "betterdocs"), value: "overlay" },
1056 { label: __("Darken", "betterdocs"), value: "darken" },
1057 { label: __("Lighten", "betterdocs"), value: "lighten" },
1058 { label: __("Color Dodge", "betterdocs"), value: "color-dodge" },
1059 { label: __("Saturation", "betterdocs"), value: "saturation" },
1060 { label: __("Color", "betterdocs"), value: "color" },
1061 { label: __("Luminosity", "betterdocs"), value: "luminosity" },
1062 ]}
1063 onChange={(ovl_blendMode) =>
1064 setAttributes({
1065 [`${controlName}ovl_blendMode`]: ovl_blendMode,
1066 })
1067 }
1068 />
1069
1070 <ToggleControl
1071 label={__("CSS Filters", "betterdocs")}
1072 checked={ovl_allowFilters}
1073 onChange={() =>
1074 setAttributes({
1075 [`${controlName}ovl_allowFilters`]: !ovl_allowFilters,
1076 })
1077 }
1078 />
1079
1080 {ovl_allowFilters && (
1081 <>
1082 <RangeControl
1083 label={__("Blur", "betterdocs")}
1084 value={ovl_fltrBlur}
1085 onChange={(ovl_fltrBlur) =>
1086 setAttributes({
1087 [`${controlName}ovl_fltrBlur`]: ovl_fltrBlur,
1088 })
1089 }
1090 step={0.1}
1091 min={0}
1092 max={10}
1093 />
1094 <RangeControl
1095 label={__("Brightness", "betterdocs")}
1096 value={ovl_fltrBrightness}
1097 onChange={(ovl_fltrBrightness) =>
1098 setAttributes({
1099 [`${controlName}ovl_fltrBrightness`]: ovl_fltrBrightness,
1100 })
1101 }
1102 step={1}
1103 min={0}
1104 max={200}
1105 />
1106 <RangeControl
1107 label={__("Contrast", "betterdocs")}
1108 value={ovl_fltrContrast}
1109 onChange={(ovl_fltrContrast) =>
1110 setAttributes({
1111 [`${controlName}ovl_fltrContrast`]: ovl_fltrContrast,
1112 })
1113 }
1114 step={1}
1115 min={0}
1116 max={200}
1117 />
1118 <RangeControl
1119 label={__("Saturation", "betterdocs")}
1120 value={ovl_fltrSaturation}
1121 onChange={(ovl_fltrSaturation) =>
1122 setAttributes({
1123 [`${controlName}ovl_fltrSaturation`]: ovl_fltrSaturation,
1124 })
1125 }
1126 step={1}
1127 min={0}
1128 max={200}
1129 />
1130 <RangeControl
1131 label={__("Hue", "betterdocs")}
1132 value={ovl_fltrHue}
1133 onChange={(ovl_fltrHue) =>
1134 setAttributes({
1135 [`${controlName}ovl_fltrHue`]: ovl_fltrHue,
1136 })
1137 }
1138 step={1}
1139 min={0}
1140 max={360}
1141 />
1142 </>
1143 )}
1144 </>
1145 )}
1146
1147 {ovl_hoverType === "hover" && (
1148 <>
1149 <BaseControl label={__("Overlay Type", "betterdocs")}>
1150 <ButtonGroup id="eb-background-control-new">
1151 {[
1152 { label: "Classic", value: "classic" },
1153 { label: "Gradient", value: "gradient" },
1154 ].map(({ value, label }) => (
1155 <Button
1156 isLarge
1157 key={`ovl-${value}-hover`}
1158 isPrimary={hov_overlayType === value}
1159 isSecondary={hov_overlayType !== value}
1160 onClick={() =>
1161 setAttributes({
1162 [`hov_${controlName}overlayType`]: value,
1163 })
1164 }
1165 >
1166 {label}
1167 </Button>
1168 ))}
1169 </ButtonGroup>
1170 </BaseControl>
1171
1172 {hov_overlayType === "classic" && (
1173 <>
1174 <ColorControl
1175 label={__("Overlay Color", "betterdocs")}
1176 color={hov_overlayColor}
1177 onChange={(hov_overlayColor) =>
1178 setAttributes({
1179 [`hov_${controlName}overlayColor`]: hov_overlayColor,
1180 })
1181 }
1182 />
1183
1184 {noOverlayBgi === false && (
1185 <>
1186 <BaseControl label={__("Overlay Image", "betterdocs")}></BaseControl>
1187
1188 <MediaUpload
1189 onSelect={({ url, id }) =>
1190 setAttributes({
1191 [`hov_${controlName}ovl_bgImageURL`]: url,
1192 [`hov_${controlName}ovl_bgImageID`]: id,
1193 })
1194 }
1195 type="image"
1196 value={hov_ovl_bgImageID}
1197 render={({ open }) =>
1198 !hov_ovl_bgImageURL && (
1199 <>
1200 <Button
1201 className="eb-background-control-inspector-panel-img-btn components-button"
1202 label={__("Upload Image", "betterdocs")}
1203 icon="format-image"
1204 onClick={open}
1205 />
1206 <span
1207 style={{ padding: "10px 0", display: "block" }}
1208 ></span>
1209 </>
1210 )
1211 }
1212 />
1213
1214 {hov_ovl_bgImageURL && (
1215 <>
1216 <ImageAvatar
1217 imageUrl={hov_ovl_bgImageURL}
1218 onDeleteImage={() =>
1219 setAttributes({
1220 [`hov_${controlName}ovl_bgImageURL`]: null,
1221 })
1222 }
1223 />
1224
1225 {resOption === "Desktop" && (
1226 <>
1227 <WithResButtons
1228 resRequiredProps={resRequiredProps}
1229 label="Position"
1230 >
1231 <SelectControl
1232 value={hov_ovl_bgImgPos}
1233 options={[
1234 { label: __("Default", "betterdocs"), value: "" },
1235 {
1236 label: __("Center Center", "betterdocs"),
1237 value: "center center",
1238 },
1239 {
1240 label: __("Center Left", "betterdocs"),
1241 value: "center left",
1242 },
1243 {
1244 label: __("Center Right", "betterdocs"),
1245 value: "center right",
1246 },
1247 {
1248 label: __("Top Center", "betterdocs"),
1249 value: "top center",
1250 },
1251 { label: __("Top Left", "betterdocs"), value: "top left" },
1252 {
1253 label: __("Top Right", "betterdocs"),
1254 value: "top right",
1255 },
1256 {
1257 label: __("Bottom Center", "betterdocs"),
1258 value: "bottom center",
1259 },
1260 {
1261 label: __("Bottom Left", "betterdocs"),
1262 value: "bottom left",
1263 },
1264 {
1265 label: __("Bottom Right", "betterdocs"),
1266 value: "bottom right",
1267 },
1268 { label: __("Custom", "betterdocs"), value: "custom" },
1269 ]}
1270 onChange={(hov_ovl_bgImgPos) =>
1271 setAttributes({
1272 [`hov_${controlName}ovl_bgImgPos`]:
1273 hov_ovl_bgImgPos,
1274 })
1275 }
1276 />
1277 </WithResButtons>
1278
1279 {hov_ovl_bgImgPos === "custom" && (
1280 <>
1281 <UnitControl
1282 selectedUnit={hov_ovl_bgImgcustomPosXUnit}
1283 unitTypes={[
1284 { label: "px", value: "px" },
1285 { label: "em", value: "em" },
1286 { label: "%", value: "%" },
1287 ]}
1288 onClick={(hov_ovl_bgImgcustomPosXUnit) =>
1289 setAttributes({
1290 [`hov_${controlName}ovl_bgImgcustomPosXUnit`]:
1291 hov_ovl_bgImgcustomPosXUnit,
1292 })
1293 }
1294 />
1295
1296 <WithResButtons
1297 resRequiredProps={resRequiredProps}
1298 label="X Position"
1299 >
1300 <RangeControl
1301 value={hov_ovl_bgImgcustomPosX}
1302 min={0}
1303 max={
1304 hov_ovl_bgImgcustomPosXUnit === "px"
1305 ? 2000
1306 : 100
1307 }
1308 onChange={(hov_ovl_bgImgcustomPosX) =>
1309 setAttributes({
1310 [`hov_${controlName}ovl_bgImgcustomPosX`]:
1311 hov_ovl_bgImgcustomPosX,
1312 })
1313 }
1314 />
1315 </WithResButtons>
1316
1317 <UnitControl
1318 selectedUnit={hov_ovl_bgImgcustomPosYUnit}
1319 unitTypes={[
1320 { label: "px", value: "px" },
1321 { label: "em", value: "em" },
1322 { label: "%", value: "%" },
1323 ]}
1324 onClick={(hov_ovl_bgImgcustomPosYUnit) =>
1325 setAttributes({
1326 [`hov_${controlName}ovl_bgImgcustomPosYUnit`]:
1327 hov_ovl_bgImgcustomPosYUnit,
1328 })
1329 }
1330 />
1331
1332 <WithResButtons
1333 resRequiredProps={resRequiredProps}
1334 label="Y Position"
1335 >
1336 <RangeControl
1337 value={hov_ovl_bgImgcustomPosY}
1338 min={0}
1339 max={
1340 hov_ovl_bgImgcustomPosYUnit === "px"
1341 ? 2000
1342 : 100
1343 }
1344 step={
1345 hov_ovl_bgImgcustomPosYUnit === "px"
1346 ? 1
1347 : 0.1
1348 }
1349 onChange={(hov_ovl_bgImgcustomPosY) =>
1350 setAttributes({
1351 [`hov_${controlName}ovl_bgImgcustomPosY`]:
1352 hov_ovl_bgImgcustomPosY,
1353 })
1354 }
1355 />
1356 </WithResButtons>
1357 </>
1358 )}
1359
1360 <SelectControl
1361 label="Attachment"
1362 value={hov_ovl_bgImgAttachment}
1363 options={[
1364 { label: __("Default", "betterdocs"), value: "" },
1365 { label: __("Scroll", "betterdocs"), value: "scroll" },
1366 { label: __("Fixed", "betterdocs"), value: "fixed" },
1367 ]}
1368 onChange={(hov_ovl_bgImgAttachment) =>
1369 setAttributes({
1370 [`hov_${controlName}ovl_bgImgAttachment`]:
1371 hov_ovl_bgImgAttachment,
1372 })
1373 }
1374 />
1375
1376 {hov_ovl_bgImgAttachment === "fixed" && (
1377 <p
1378 style={{
1379 marginTop: "-10px",
1380 paddingBottom: "10px",
1381 }}
1382 >
1383 <i>
1384 Note: Attachment Fixed works only on desktop.
1385 </i>
1386 </p>
1387 )}
1388
1389 <WithResButtons
1390 resRequiredProps={resRequiredProps}
1391 label="Repeat"
1392 >
1393 <SelectControl
1394 value={hov_ovl_bgImgRepeat}
1395 options={[
1396 { label: __("Default", "betterdocs"), value: "" },
1397 {
1398 label: __("No-repeat", "betterdocs"),
1399 value: "no-repeat",
1400 },
1401 { label: __("Repeat", "betterdocs"), value: "repeat" },
1402 { label: __("Repeat-x", "betterdocs"), value: "repeat-x" },
1403 { label: __("Repeat-y", "betterdocs"), value: "repeat-y" },
1404 ]}
1405 onChange={(hov_ovl_bgImgRepeat) =>
1406 setAttributes({
1407 [`hov_${controlName}ovl_bgImgRepeat`]:
1408 hov_ovl_bgImgRepeat,
1409 })
1410 }
1411 />
1412 </WithResButtons>
1413
1414 <WithResButtons
1415 resRequiredProps={resRequiredProps}
1416 label="Size"
1417 >
1418 <SelectControl
1419 value={hov_ovl_backgroundSize}
1420 options={[
1421 { label: __("Default", "betterdocs"), value: "" },
1422 { label: __("Auto", "betterdocs"), value: "auto" },
1423 { label: __("Cover", "betterdocs"), value: "cover" },
1424 { label: __("Contain", "betterdocs"), value: "contain" },
1425 { label: __("Custom", "betterdocs"), value: "custom" },
1426 ]}
1427 onChange={(hov_ovl_backgroundSize) =>
1428 setAttributes({
1429 [`hov_${controlName}ovl_backgroundSize`]:
1430 hov_ovl_backgroundSize,
1431 })
1432 }
1433 />
1434 </WithResButtons>
1435
1436 {hov_ovl_backgroundSize === "custom" && (
1437 <>
1438 <UnitControl
1439 selectedUnit={hov_ovl_bgImgCustomSizeUnit}
1440 unitTypes={[
1441 { label: "px", value: "px" },
1442 { label: "em", value: "em" },
1443 { label: "%", value: "%" },
1444 ]}
1445 onClick={(hov_ovl_bgImgCustomSizeUnit) =>
1446 setAttributes({
1447 [`hov_${controlName}ovl_bgImgCustomSizeUnit`]:
1448 hov_ovl_bgImgCustomSizeUnit,
1449 })
1450 }
1451 />
1452
1453 <WithResButtons
1454 resRequiredProps={resRequiredProps}
1455 label="Width"
1456 >
1457 <RangeControl
1458 value={hov_ovl_bgImgCustomSize}
1459 min={0}
1460 max={
1461 hov_ovl_bgImgCustomSizeUnit === "px"
1462 ? 2000
1463 : 100
1464 }
1465 step={
1466 hov_ovl_bgImgCustomSizeUnit === "px"
1467 ? 1
1468 : 0.1
1469 }
1470 onChange={(hov_ovl_bgImgCustomSize) =>
1471 setAttributes({
1472 [`hov_${controlName}ovl_bgImgCustomSize`]:
1473 hov_ovl_bgImgCustomSize,
1474 })
1475 }
1476 />
1477 </WithResButtons>
1478 </>
1479 )}
1480 </>
1481 )}
1482
1483 {resOption === "Tablet" && (
1484 <>
1485 <WithResButtons
1486 resRequiredProps={resRequiredProps}
1487 label="Position"
1488 >
1489 <SelectControl
1490 value={hov_TABovl_bgImgPos}
1491 options={[
1492 { label: __("Default", "betterdocs"), value: "" },
1493 {
1494 label: __("Center Center", "betterdocs"),
1495 value: "center center",
1496 },
1497 {
1498 label: __("Center Left", "betterdocs"),
1499 value: "center left",
1500 },
1501 {
1502 label: __("Center Right", "betterdocs"),
1503 value: "center right",
1504 },
1505 {
1506 label: __("Top Center", "betterdocs"),
1507 value: "top center",
1508 },
1509 { label: __("Top Left", "betterdocs"), value: "top left" },
1510 {
1511 label: __("Top Right", "betterdocs"),
1512 value: "top right",
1513 },
1514 {
1515 label: __("Bottom Center", "betterdocs"),
1516 value: "bottom center",
1517 },
1518 {
1519 label: __("Bottom Left", "betterdocs"),
1520 value: "bottom left",
1521 },
1522 {
1523 label: __("Bottom Right", "betterdocs"),
1524 value: "bottom right",
1525 },
1526 { label: __("Custom", "betterdocs"), value: "custom" },
1527 ]}
1528 onChange={(hov_TABovl_bgImgPos) =>
1529 setAttributes({
1530 [`hov_TAB${controlName}ovl_bgImgPos`]:
1531 hov_TABovl_bgImgPos,
1532 })
1533 }
1534 />
1535 </WithResButtons>
1536
1537 {hov_TABovl_bgImgPos === "custom" && (
1538 <>
1539 <UnitControl
1540 selectedUnit={hov_TABovl_bgImgcustomPosXUnit}
1541 unitTypes={[
1542 { label: "px", value: "px" },
1543 { label: "em", value: "em" },
1544 { label: "%", value: "%" },
1545 ]}
1546 onClick={(hov_TABovl_bgImgcustomPosXUnit) =>
1547 setAttributes({
1548 [`hov_TAB${controlName}ovl_bgImgcustomPosXUnit`]:
1549 hov_TABovl_bgImgcustomPosXUnit,
1550 })
1551 }
1552 />
1553
1554 <WithResButtons
1555 resRequiredProps={resRequiredProps}
1556 label="X Position"
1557 >
1558 <RangeControl
1559 value={hov_TABovl_bgImgcustomPosX}
1560 min={0}
1561 max={
1562 hov_TABovl_bgImgcustomPosXUnit === "px"
1563 ? 2000
1564 : 100
1565 }
1566 onChange={(hov_TABovl_bgImgcustomPosX) =>
1567 setAttributes({
1568 [`hov_TAB${controlName}ovl_bgImgcustomPosX`]:
1569 hov_TABovl_bgImgcustomPosX,
1570 })
1571 }
1572 />
1573 </WithResButtons>
1574
1575 <UnitControl
1576 selectedUnit={hov_TABovl_bgImgcustomPosYUnit}
1577 unitTypes={[
1578 { label: "px", value: "px" },
1579 { label: "em", value: "em" },
1580 { label: "%", value: "%" },
1581 ]}
1582 onClick={(hov_TABovl_bgImgcustomPosYUnit) =>
1583 setAttributes({
1584 [`hov_TAB${controlName}ovl_bgImgcustomPosYUnit`]:
1585 hov_TABovl_bgImgcustomPosYUnit,
1586 })
1587 }
1588 />
1589
1590 <WithResButtons
1591 resRequiredProps={resRequiredProps}
1592 label="Y Position"
1593 >
1594 <RangeControl
1595 value={hov_TABovl_bgImgcustomPosY}
1596 min={0}
1597 max={
1598 hov_TABovl_bgImgcustomPosYUnit === "px"
1599 ? 2000
1600 : 100
1601 }
1602 step={
1603 hov_TABovl_bgImgcustomPosYUnit === "px"
1604 ? 1
1605 : 0.1
1606 }
1607 onChange={(hov_TABovl_bgImgcustomPosY) =>
1608 setAttributes({
1609 [`hov_TAB${controlName}ovl_bgImgcustomPosY`]:
1610 hov_TABovl_bgImgcustomPosY,
1611 })
1612 }
1613 />
1614 </WithResButtons>
1615 </>
1616 )}
1617
1618 <SelectControl
1619 label="Attachment"
1620 value={hov_ovl_bgImgAttachment}
1621 options={[
1622 { label: __("Default", "betterdocs"), value: "" },
1623 { label: __("Scroll", "betterdocs"), value: "scroll" },
1624 { label: __("Fixed", "betterdocs"), value: "fixed" },
1625 ]}
1626 onChange={(hov_ovl_bgImgAttachment) =>
1627 setAttributes({
1628 [`hov_${controlName}ovl_bgImgAttachment`]:
1629 hov_ovl_bgImgAttachment,
1630 })
1631 }
1632 />
1633
1634 {hov_ovl_bgImgAttachment === "fixed" && (
1635 <p
1636 style={{
1637 marginTop: "-10px",
1638 paddingBottom: "10px",
1639 }}
1640 >
1641 <i>
1642 Note: Attachment Fixed works only on desktop.
1643 </i>
1644 </p>
1645 )}
1646
1647 <WithResButtons
1648 resRequiredProps={resRequiredProps}
1649 label="Repeat"
1650 >
1651 <SelectControl
1652 value={hov_TABovl_bgImgRepeat}
1653 options={[
1654 { label: __("Default", "betterdocs"), value: "" },
1655 {
1656 label: __("No-repeat", "betterdocs"),
1657 value: "no-repeat",
1658 },
1659 { label: __("Repeat", "betterdocs"), value: "repeat" },
1660 { label: __("Repeat-x", "betterdocs"), value: "repeat-x" },
1661 { label: __("Repeat-y", "betterdocs"), value: "repeat-y" },
1662 ]}
1663 onChange={(hov_TABovl_bgImgRepeat) =>
1664 setAttributes({
1665 [`hov_TAB${controlName}ovl_bgImgRepeat`]:
1666 hov_TABovl_bgImgRepeat,
1667 })
1668 }
1669 />
1670 </WithResButtons>
1671
1672 <WithResButtons
1673 resRequiredProps={resRequiredProps}
1674 label="Size"
1675 >
1676 <SelectControl
1677 value={hov_TABovl_backgroundSize}
1678 options={[
1679 { label: __("Default", "betterdocs"), value: "" },
1680 { label: __("Auto", "betterdocs"), value: "auto" },
1681 { label: __("Cover", "betterdocs"), value: "cover" },
1682 { label: __("Contain", "betterdocs"), value: "contain" },
1683 { label: __("Custom", "betterdocs"), value: "custom" },
1684 ]}
1685 onChange={(hov_TABovl_backgroundSize) =>
1686 setAttributes({
1687 [`hov_TAB${controlName}ovl_backgroundSize`]:
1688 hov_TABovl_backgroundSize,
1689 })
1690 }
1691 />
1692 </WithResButtons>
1693
1694 {hov_TABovl_backgroundSize === "custom" && (
1695 <>
1696 <UnitControl
1697 selectedUnit={hov_TABovl_bgImgCustomSizeUnit}
1698 unitTypes={[
1699 { label: "px", value: "px" },
1700 { label: "em", value: "em" },
1701 { label: "%", value: "%" },
1702 ]}
1703 onClick={(hov_TABovl_bgImgCustomSizeUnit) =>
1704 setAttributes({
1705 [`hov_TAB${controlName}ovl_bgImgCustomSizeUnit`]:
1706 hov_TABovl_bgImgCustomSizeUnit,
1707 })
1708 }
1709 />
1710
1711 <WithResButtons
1712 resRequiredProps={resRequiredProps}
1713 label="Width"
1714 >
1715 <RangeControl
1716 value={hov_TABovl_bgImgCustomSize}
1717 min={0}
1718 max={
1719 hov_TABovl_bgImgCustomSizeUnit === "px"
1720 ? 2000
1721 : 100
1722 }
1723 step={
1724 hov_TABovl_bgImgCustomSizeUnit === "px"
1725 ? 1
1726 : 0.1
1727 }
1728 onChange={(hov_TABovl_bgImgCustomSize) =>
1729 setAttributes({
1730 [`hov_TAB${controlName}ovl_bgImgCustomSize`]:
1731 hov_TABovl_bgImgCustomSize,
1732 })
1733 }
1734 />
1735 </WithResButtons>
1736 </>
1737 )}
1738 </>
1739 )}
1740
1741 {resOption === "Mobile" && (
1742 <>
1743 <WithResButtons
1744 resRequiredProps={resRequiredProps}
1745 label="Position"
1746 >
1747 <SelectControl
1748 value={hov_MOBovl_bgImgPos}
1749 options={[
1750 { label: __("Default", "betterdocs"), value: "" },
1751 {
1752 label: __("Center Center", "betterdocs"),
1753 value: "center center",
1754 },
1755 {
1756 label: __("Center Left", "betterdocs"),
1757 value: "center left",
1758 },
1759 {
1760 label: __("Center Right", "betterdocs"),
1761 value: "center right",
1762 },
1763 {
1764 label: __("Top Center", "betterdocs"),
1765 value: "top center",
1766 },
1767 { label: __("Top Left", "betterdocs"), value: "top left" },
1768 {
1769 label: __("Top Right", "betterdocs"),
1770 value: "top right",
1771 },
1772 {
1773 label: __("Bottom Center", "betterdocs"),
1774 value: "bottom center",
1775 },
1776 {
1777 label: __("Bottom Left", "betterdocs"),
1778 value: "bottom left",
1779 },
1780 {
1781 label: __("Bottom Right", "betterdocs"),
1782 value: "bottom right",
1783 },
1784 { label: __("Custom", "betterdocs"), value: "custom" },
1785 ]}
1786 onChange={(hov_MOBovl_bgImgPos) =>
1787 setAttributes({
1788 [`hov_MOB${controlName}ovl_bgImgPos`]:
1789 hov_MOBovl_bgImgPos,
1790 })
1791 }
1792 />
1793 </WithResButtons>
1794
1795 {hov_MOBovl_bgImgPos === "custom" && (
1796 <>
1797 <UnitControl
1798 selectedUnit={hov_MOBovl_bgImgcustomPosXUnit}
1799 unitTypes={[
1800 { label: "px", value: "px" },
1801 { label: "em", value: "em" },
1802 { label: "%", value: "%" },
1803 ]}
1804 onClick={(hov_MOBovl_bgImgcustomPosXUnit) =>
1805 setAttributes({
1806 [`hov_MOB${controlName}ovl_bgImgcustomPosXUnit`]:
1807 hov_MOBovl_bgImgcustomPosXUnit,
1808 })
1809 }
1810 />
1811
1812 <WithResButtons
1813 resRequiredProps={resRequiredProps}
1814 label="X Position"
1815 >
1816 <RangeControl
1817 value={hov_MOBovl_bgImgcustomPosX}
1818 min={0}
1819 max={
1820 hov_MOBovl_bgImgcustomPosXUnit === "px"
1821 ? 2000
1822 : 100
1823 }
1824 onChange={(hov_MOBovl_bgImgcustomPosX) =>
1825 setAttributes({
1826 [`hov_MOB${controlName}ovl_bgImgcustomPosX`]:
1827 hov_MOBovl_bgImgcustomPosX,
1828 })
1829 }
1830 />
1831 </WithResButtons>
1832
1833 <UnitControl
1834 selectedUnit={hov_MOBovl_bgImgcustomPosYUnit}
1835 unitTypes={[
1836 { label: "px", value: "px" },
1837 { label: "em", value: "em" },
1838 { label: "%", value: "%" },
1839 ]}
1840 onClick={(hov_MOBovl_bgImgcustomPosYUnit) =>
1841 setAttributes({
1842 [`hov_MOB${controlName}ovl_bgImgcustomPosYUnit`]:
1843 hov_MOBovl_bgImgcustomPosYUnit,
1844 })
1845 }
1846 />
1847
1848 <WithResButtons
1849 resRequiredProps={resRequiredProps}
1850 label="Y Position"
1851 >
1852 <RangeControl
1853 value={hov_MOBovl_bgImgcustomPosY}
1854 min={0}
1855 max={
1856 hov_MOBovl_bgImgcustomPosYUnit === "px"
1857 ? 2000
1858 : 100
1859 }
1860 step={
1861 hov_MOBovl_bgImgcustomPosYUnit === "px"
1862 ? 1
1863 : 0.1
1864 }
1865 onChange={(hov_MOBovl_bgImgcustomPosY) =>
1866 setAttributes({
1867 [`hov_MOB${controlName}ovl_bgImgcustomPosY`]:
1868 hov_MOBovl_bgImgcustomPosY,
1869 })
1870 }
1871 />
1872 </WithResButtons>
1873 </>
1874 )}
1875
1876 <SelectControl
1877 label="Attachment"
1878 value={hov_ovl_bgImgAttachment}
1879 options={[
1880 { label: __("Default", "betterdocs"), value: "" },
1881 { label: __("Scroll", "betterdocs"), value: "scroll" },
1882 { label: __("Fixed", "betterdocs"), value: "fixed" },
1883 ]}
1884 onChange={(hov_ovl_bgImgAttachment) =>
1885 setAttributes({
1886 [`hov_${controlName}ovl_bgImgAttachment`]:
1887 hov_ovl_bgImgAttachment,
1888 })
1889 }
1890 />
1891
1892 {hov_ovl_bgImgAttachment === "fixed" && (
1893 <p
1894 style={{
1895 marginTop: "-10px",
1896 paddingBottom: "10px",
1897 }}
1898 >
1899 <i>
1900 Note: Attachment Fixed works only on desktop.
1901 </i>
1902 </p>
1903 )}
1904
1905 <WithResButtons
1906 resRequiredProps={resRequiredProps}
1907 label="Repeat"
1908 >
1909 <SelectControl
1910 value={hov_MOBovl_bgImgRepeat}
1911 options={[
1912 { label: __("Default", "betterdocs"), value: "" },
1913 {
1914 label: __("No-repeat", "betterdocs"),
1915 value: "no-repeat",
1916 },
1917 { label: __("Repeat", "betterdocs"), value: "repeat" },
1918 { label: __("Repeat-x", "betterdocs"), value: "repeat-x" },
1919 { label: __("Repeat-y", "betterdocs"), value: "repeat-y" },
1920 ]}
1921 onChange={(hov_MOBovl_bgImgRepeat) =>
1922 setAttributes({
1923 [`hov_MOB${controlName}ovl_bgImgRepeat`]:
1924 hov_MOBovl_bgImgRepeat,
1925 })
1926 }
1927 />
1928 </WithResButtons>
1929
1930 <WithResButtons
1931 resRequiredProps={resRequiredProps}
1932 label="Size"
1933 >
1934 <SelectControl
1935 value={hov_MOBovl_backgroundSize}
1936 options={[
1937 { label: __("Default", "betterdocs"), value: "" },
1938 { label: __("Auto", "betterdocs"), value: "auto" },
1939 { label: __("Cover", "betterdocs"), value: "cover" },
1940 { label: __("Contain", "betterdocs"), value: "contain" },
1941 { label: __("Custom", "betterdocs"), value: "custom" },
1942 ]}
1943 onChange={(hov_MOBovl_backgroundSize) =>
1944 setAttributes({
1945 [`hov_MOB${controlName}ovl_backgroundSize`]:
1946 hov_MOBovl_backgroundSize,
1947 })
1948 }
1949 />
1950 </WithResButtons>
1951
1952 {hov_MOBovl_backgroundSize === "custom" && (
1953 <>
1954 <UnitControl
1955 selectedUnit={hov_MOBovl_bgImgCustomSizeUnit}
1956 unitTypes={[
1957 { label: "px", value: "px" },
1958 { label: "em", value: "em" },
1959 { label: "%", value: "%" },
1960 ]}
1961 onClick={(hov_MOBovl_bgImgCustomSizeUnit) =>
1962 setAttributes({
1963 [`hov_MOB${controlName}ovl_bgImgCustomSizeUnit`]:
1964 hov_MOBovl_bgImgCustomSizeUnit,
1965 })
1966 }
1967 />
1968
1969 <WithResButtons
1970 resRequiredProps={resRequiredProps}
1971 label="Width"
1972 >
1973 <RangeControl
1974 value={hov_MOBovl_bgImgCustomSize}
1975 min={0}
1976 max={
1977 hov_MOBovl_bgImgCustomSizeUnit === "px"
1978 ? 2000
1979 : 100
1980 }
1981 step={
1982 hov_MOBovl_bgImgCustomSizeUnit === "px"
1983 ? 1
1984 : 0.1
1985 }
1986 onChange={(hov_MOBovl_bgImgCustomSize) =>
1987 setAttributes({
1988 [`hov_MOB${controlName}ovl_bgImgCustomSize`]:
1989 hov_MOBovl_bgImgCustomSize,
1990 })
1991 }
1992 />
1993 </WithResButtons>
1994 </>
1995 )}
1996 </>
1997 )}
1998 </>
1999 )}
2000 </>
2001 )}
2002 </>
2003 )}
2004
2005 {hov_overlayType === "gradient" && (
2006 <GradientColorControl
2007 gradientColor={hov_overlayGradient}
2008 onChange={(hov_overlayGradient) =>
2009 setAttributes({
2010 [`hov_${controlName}overlayGradient`]: hov_overlayGradient,
2011 })
2012 }
2013 />
2014 )}
2015
2016 <hr />
2017
2018 {!noTransition && (
2019 <RangeControl
2020 label={__("Overlay Transition", "betterdocs")}
2021 value={ovl_bg_transition}
2022 min={0}
2023 max={5}
2024 step={0.1}
2025 onChange={(ovl_bg_transition) =>
2026 setAttributes({
2027 [`${controlName}ovl_bg_transition`]: ovl_bg_transition,
2028 })
2029 }
2030 />
2031 )}
2032
2033 <hr />
2034
2035 <ResetControl
2036 onReset={() =>
2037 setAttributes({
2038 [`hov_${controlName}ovl_opacity`]: undefined,
2039 })
2040 }
2041 >
2042 <RangeControl
2043 label={__("Opacity", "betterdocs")}
2044 value={hov_ovl_opacity}
2045 onChange={(hov_ovl_opacity) =>
2046 setAttributes({
2047 [`hov_${controlName}ovl_opacity`]: hov_ovl_opacity,
2048 })
2049 }
2050 step={0.01}
2051 min={0}
2052 max={1}
2053 />
2054 </ResetControl>
2055
2056 {!noTransition && hov_ovl_opacity && (
2057 <RangeControl
2058 label={__("Opacity Transition", "betterdocs")}
2059 value={ovl_opacityTransition}
2060 onChange={(ovl_opacityTransition) =>
2061 setAttributes({
2062 [`${controlName}ovl_opacityTransition`]:
2063 ovl_opacityTransition,
2064 })
2065 }
2066 step={0.01}
2067 min={0}
2068 max={5}
2069 />
2070 )}
2071
2072 <hr />
2073
2074 <SelectControl
2075 label={__("Blend Mode", "betterdocs")}
2076 value={hov_ovl_blendMode}
2077 options={[
2078 { label: __("Normal", "betterdocs"), value: "" },
2079 { label: __("multiply", "betterdocs"), value: "multiply" },
2080 { label: __("screen", "betterdocs"), value: "screen" },
2081 { label: __("overlay", "betterdocs"), value: "overlay" },
2082 { label: __("darken", "betterdocs"), value: "darken" },
2083 { label: __("lighten", "betterdocs"), value: "lighten" },
2084 { label: __("color-dodge", "betterdocs"), value: "Color Dodge" },
2085 { label: __("saturation", "betterdocs"), value: "saturation" },
2086 { label: __("color", "betterdocs"), value: "color" },
2087 { label: __("luminosity", "betterdocs"), value: "luminosity" },
2088 ]}
2089 onChange={(hov_ovl_blendMode) =>
2090 setAttributes({
2091 [`hov_${controlName}ovl_blendMode`]: hov_ovl_blendMode,
2092 })
2093 }
2094 />
2095
2096 <ToggleControl
2097 label={__("CSS Filters", "betterdocs")}
2098 checked={hov_ovl_allowFilters}
2099 onChange={() =>
2100 setAttributes({
2101 [`hov_${controlName}ovl_allowFilters`]: !hov_ovl_allowFilters,
2102 })
2103 }
2104 />
2105
2106 {hov_ovl_allowFilters && (
2107 <>
2108 <RangeControl
2109 label={__("Blur", "betterdocs")}
2110 value={hov_ovl_fltrBlur}
2111 onChange={(hov_ovl_fltrBlur) =>
2112 setAttributes({
2113 [`hov_${controlName}ovl_fltrBlur`]: hov_ovl_fltrBlur,
2114 })
2115 }
2116 step={0.1}
2117 min={0}
2118 max={10}
2119 />
2120 <RangeControl
2121 label={__("Brightness", "betterdocs")}
2122 value={hov_ovl_fltrBrightness}
2123 onChange={(hov_ovl_fltrBrightness) =>
2124 setAttributes({
2125 [`hov_${controlName}ovl_fltrBrightness`]:
2126 hov_ovl_fltrBrightness,
2127 })
2128 }
2129 step={1}
2130 min={0}
2131 max={200}
2132 />
2133 <RangeControl
2134 label={__("Contrast", "betterdocs")}
2135 value={hov_ovl_fltrContrast}
2136 onChange={(hov_ovl_fltrContrast) =>
2137 setAttributes({
2138 [`hov_${controlName}ovl_fltrContrast`]:
2139 hov_ovl_fltrContrast,
2140 })
2141 }
2142 step={1}
2143 min={0}
2144 max={200}
2145 />
2146 <RangeControl
2147 label={__("Saturation", "betterdocs")}
2148 value={hov_ovl_fltrSaturation}
2149 onChange={(hov_ovl_fltrSaturation) =>
2150 setAttributes({
2151 [`hov_${controlName}ovl_fltrSaturation`]:
2152 hov_ovl_fltrSaturation,
2153 })
2154 }
2155 step={1}
2156 min={0}
2157 max={200}
2158 />
2159 <RangeControl
2160 label={__("Hue", "betterdocs")}
2161 value={hov_ovl_fltrHue}
2162 onChange={(hov_ovl_fltrHue) =>
2163 setAttributes({
2164 [`hov_${controlName}ovl_fltrHue`]: hov_ovl_fltrHue,
2165 })
2166 }
2167 step={1}
2168 min={0}
2169 max={360}
2170 />
2171
2172 <hr />
2173
2174 {!noTransition && (
2175 <RangeControl
2176 label={__("Css Filters Transition", "betterdocs")}
2177 value={ovl_filtersTransition}
2178 onChange={(ovl_filtersTransition) =>
2179 setAttributes({
2180 [`${controlName}ovl_filtersTransition`]:
2181 ovl_filtersTransition,
2182 })
2183 }
2184 step={0.01}
2185 min={0}
2186 max={5}
2187 />
2188 )}
2189 </>
2190 )}
2191 </>
2192 )}
2193 </>
2194 );
2195 }
2196