PluginProbe
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News / 4.0.7
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News v4.0.7
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 4.0.2 4.0.1 2.3.5 2.3.6 2.4.0 2.4.1 2.4.10 2.4.11 2.4.12 2.4.13 2.4.14 2.4.15 2.4.16 2.4.17 2.4.18 2.4.19 2.4.2 2.4.20 2.4.21 All 88 releases
post-carousel / src / blocks / smart-image / generalTab.js

generalTab.js in Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News 4.0.7, at src/blocks/smart-image/generalTab.js

946 lines 24.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { __ } from "@wordpress/i18n";
2 import MediaPicker from "../../components/mediaUpload/image";
3 import SPFocalPointPicker from "../../components/focalPoint/focalPointPicker";
4 import {
5 Background,
6 Border,
7 ButtonSet,
8 Divider,
9 InputControl,
10 SelectField,
11 Spacing,
12 SpColorPicker,
13 SPRangeControl,
14 SPToggleGroupControl,
15 Toggle,
16 TypographyNew,
17 } from "../../components";
18 import { hoverEffectItems, hoverEffectShortItems, shapeButtonSet } from "./constant";
19 import { useState } from "@wordpress/element";
20 import ToggleGroupControl from "../../components/toggleGroupControl/toggleGroupControl";
21 import { solidGradientBgType } from "../../controls/constants";
22 import { AlignCenter, AlignLeft, AlignRight, FlexAlignCenter, FlexAlignEnd, FlexAlignStart } from "./icon";
23
24 // Smart Image general tab panel
25 export const SmartImageGeneralTab = ({ attributes, setAttributes }) => {
26 const {
27 selectImage,
28 imageSize,
29 selectImageSizes,
30 aspectRatio,
31 maxWidth,
32 imageFocalPoint,
33 enableLink,
34 linkType,
35 linkUrl,
36 buttonLabel,
37 buttonPosition,
38 imageAltText,
39 smartImageWidth,
40 smartImageHeight,
41 imgMaskingEnable,
42 imageShapeSet,
43 selectImageShape,
44 maskingShapedUpload,
45 maskSize,
46 // imageZoom,
47 openInTab,
48 // doubleResolutionRetina,
49 lazyLoad,
50 // selectImageId,
51 imgAlignment,
52 } = attributes;
53
54 const defaultSizes = [
55 { label: "Thumbnail", value: "thumbnail" },
56 { label: "Medium", value: "medium" },
57 { label: "Large", value: "large" },
58 { label: "Full", value: "full" },
59 ];
60
61 const imageSizeItems = selectImageSizes ? selectImageSizes : defaultSizes;
62
63 return (
64 <>
65 <MediaPicker
66 label={__("Select Image", "post-carousel")}
67 imageKey="selectImage"
68 enableImageSize={false}
69 setAttributes={setAttributes}
70 backgroundImage={selectImage}
71 onSelect={(media) => setAttributes({ selectImageId: media?.id })}
72 removeImage={() =>
73 setAttributes({
74 selectImageId: "",
75 imageAltText: "",
76 imgTitleLabel: "",
77 imgCaptionLabel: "",
78 selectImage: {},
79 })
80 }
81 />
82 <Toggle
83 label={__("Image Masking", "post-carousel")}
84 attributes={imgMaskingEnable}
85 attributesKey={"imgMaskingEnable"}
86 setAttributes={setAttributes}
87 pro={true}
88 />
89 {imgMaskingEnable && (
90 <>
91 <SPToggleGroupControl
92 attributes={imageShapeSet}
93 attributesKey={"imageShapeSet"}
94 setAttributes={setAttributes}
95 items={[
96 {
97 label: __("Shape Set", "post-carousel"),
98 value: "shape-set",
99 },
100 {
101 label: __("Custom", "post-carousel"),
102 value: "custom",
103 },
104 ]}
105 />
106 {"shape-set" === imageShapeSet && (
107 <ButtonSet
108 label={__("Image Masking", "post-carousel")}
109 attributes={selectImageShape}
110 attributesKey={"selectImageShape"}
111 setAttributes={setAttributes}
112 items={shapeButtonSet}
113 columns={4}
114 />
115 )}
116 {"custom" === imageShapeSet && (
117 <>
118 <MediaPicker
119 label={__("Select Image", "post-carousel")}
120 imageKey={"maskingShapedUpload"}
121 enableImageSize={false}
122 setAttributes={setAttributes}
123 backgroundImage={maskingShapedUpload}
124 />
125 <SelectField
126 label={__("Mask Size", "post-carousel")}
127 attributes={maskSize}
128 attributesKey={"maskSize"}
129 setAttributes={setAttributes}
130 items={[
131 {
132 label: __("Auto", "post-carousel"),
133 value: "auto",
134 },
135 {
136 label: __("Contain", "post-carousel"),
137 value: "contain",
138 },
139 {
140 label: __("Cover", "post-carousel"),
141 value: "cover",
142 },
143 ]}
144 />
145 </>
146 )}
147 </>
148 )}
149 <SelectField
150 label={__("Image Size", "post-carousel")}
151 attributes={imageSize}
152 attributesKey={"imageSize"}
153 setAttributes={setAttributes}
154 items={imageSizeItems}
155 />
156 <SelectField
157 label={__("Aspect Ratio", "post-carousel")}
158 attributes={aspectRatio}
159 attributesKey={"aspectRatio"}
160 setAttributes={setAttributes}
161 items={[
162 { label: "Original", value: "original" },
163 { label: "1:1", value: "1-1" },
164 { label: "4:3", value: "4-3" },
165 { label: "3:2", value: "3-2" },
166 { label: "16:9", value: "16-9" },
167 { label: "2:1", value: "2-1" },
168 { label: "3:1", value: "3-1" },
169 { label: "4:1", value: "4-1" },
170 { label: "3:4", value: "3-4" },
171 { label: "2:3", value: "2-3" },
172 { label: "9:16", value: "9-16" },
173 { label: "Custom (Pro)", value: "custom", disabled: true },
174 ]}
175 flexStyle={true}
176 />
177 {"custom" === aspectRatio ? (
178 <>
179 <SPRangeControl
180 label={__("Width", "post-carousel")}
181 attributes={smartImageWidth}
182 attributesKey={"smartImageWidth"}
183 setAttributes={setAttributes}
184 units={["px", "%", "em"]}
185 defaultValue={{ value: "", unit: "px" }}
186 max={1600}
187 />
188 <SPRangeControl
189 label={__("Height", "post-carousel")}
190 attributes={smartImageHeight}
191 attributesKey={"smartImageHeight"}
192 setAttributes={setAttributes}
193 units={["px", "%", "em"]}
194 defaultValue={{ value: "", unit: "px" }}
195 max={1600}
196 />
197 </>
198 ) : (
199 <SPRangeControl
200 label={__("Max Width", "post-carousel")}
201 attributes={maxWidth}
202 attributesKey={"maxWidth"}
203 setAttributes={setAttributes}
204 units={["px", "%", "em"]}
205 defaultValue={{ value: "", unit: "%" }}
206 max={1600}
207 />
208 )}
209 {/* TODO : Next Version */}
210 {/* <SPRangeControl
211 label={ __( "Image Zoom", "post-carousel" ) }
212 attributes={ imageZoom }
213 attributesKey={ "imageZoom" }
214 setAttributes={ setAttributes }
215 defaultValue={ { value: "1.1", unit: "px" } }
216 min={ 0 }
217 max={ 2 }
218 step={ 0.1 }
219 /> */}
220 {"original" !== aspectRatio && (
221 <SPFocalPointPicker
222 label={__("Focal Point", "post-carousel")}
223 attributes={imageFocalPoint}
224 url={selectImage.url}
225 attributesKey={"imageFocalPoint"}
226 setAttributes={setAttributes}
227 pro={true}
228 />
229 )}
230 <Toggle
231 label={ __( "Enable Link", "post-carousel" ) }
232 attributes={ enableLink }
233 attributesKey={ "enableLink" }
234 setAttributes={ setAttributes }
235 />
236 {enableLink && (
237 <>
238 <SelectField
239 label={__("Link Type", "post-carousel")}
240 attributes={linkType}
241 attributesKey={"linkType"}
242 setAttributes={setAttributes}
243 items={[
244 { label: "Full Image", value: "full-img" },
245 { label: "Button (Pro)", value: "button", disabled: true },
246 ]}
247 />
248 {"button" === linkType && (
249 <InputControl
250 label={__("Button Label", "post-carousel")}
251 attributes={buttonLabel}
252 attributesKey={"buttonLabel"}
253 setAttributes={setAttributes}
254 inputType="text"
255 flex={false}
256 />
257 )}
258 <InputControl
259 label={
260 "button" !== linkType
261 ? __("Image URL", "post-carousel")
262 : __("Button URL", "post-carousel")
263 }
264 attributes={linkUrl}
265 attributesKey={"linkUrl"}
266 setAttributes={setAttributes}
267 inputType="url"
268 placeholder={"#"}
269 flex={false}
270 />
271 {"button" === linkType && (
272 <SelectField
273 label={__("Button Position", "post-carousel")}
274 attributes={buttonPosition}
275 attributesKey={"buttonPosition"}
276 setAttributes={setAttributes}
277 items={[
278 { label: "Top Left", value: "top-left" },
279 { label: "Top Center", value: "top-center" },
280 { label: "Top Right", value: "top-right" },
281 {
282 label: "Center Center",
283 value: "center-center",
284 },
285 { label: "Bottom Left", value: "bottom-left" },
286 {
287 label: "Bottom Center",
288 value: "bottom-center",
289 },
290 {
291 label: "Bottom Right",
292 value: "bottom-right",
293 },
294 ]}
295 />
296 )}
297 <Toggle
298 label={ __( "Open In New Tab", "post-carousel" ) }
299 attributes={ openInTab }
300 attributesKey={ "openInTab" }
301 setAttributes={ setAttributes }
302 />
303 </>
304 )}
305 <InputControl
306 label={__("Image Alt Text", "post-carousel")}
307 attributes={imageAltText}
308 attributesKey={"imageAltText"}
309 setAttributes={setAttributes}
310 inputType="text"
311 flex={false}
312 />
313 {/* <Toggle
314 label={ __(
315 'Load 2x Image for Retina Display',
316 'post-carousel'
317 ) }
318 attributes={ doubleResolutionRetina }
319 attributesKey={ 'doubleResolutionRetina' }
320 setAttributes={ setAttributes }
321 /> */}
322 <Toggle
323 label={ __( "Lazy Load", "post-carousel" ) }
324 attributes={ lazyLoad }
325 attributesKey={ "lazyLoad" }
326 setAttributes={ setAttributes }
327 />
328 <SPToggleGroupControl
329 label={ __("Alignment", "post-carousel" ) }
330 attributes={ imgAlignment }
331 attributesKey={ "imgAlignment" }
332 setAttributes={ setAttributes }
333 items={ [
334 { label: <AlignLeft />, value: "left" },
335 { label: <AlignCenter />, value: "center" },
336 { label: <AlignRight />, value: "right" },
337 ] }
338 />
339 </>
340 );
341 };
342
343 // TODO: Image Masking Option for Next Version.
344 // export const SmartImageMaskingGeneralTab = ( {
345 // attributes,
346 // setAttributes,
347 // } ) => {
348 // const { imgMaskingEnable, imageShapeSet, selectImageShape, maskingShapedUpload, maskSize } =
349 // attributes;
350
351 // return (
352 // <>
353 // <SPToggleGroupControl
354 // attributes={ imageShapeSet }
355 // attributesKey={ 'imageShapeSet' }
356 // setAttributes={ setAttributes }
357 // items={ [
358 // {
359 // label: __( 'Shape Set', 'post-carousel' ),
360 // value: 'shape-set',
361 // },
362 // {
363 // label: __( 'Custom', 'post-carousel' ),
364 // value: 'custom',
365 // },
366 // ] }
367 // />
368 // { 'shape-set' === imageShapeSet && (
369 // <ButtonSet
370 // label={ __( 'Image Masking', 'post-carousel' ) }
371 // attributes={ selectImageShape }
372 // attributesKey={ 'selectImageShape' }
373 // setAttributes={ setAttributes }
374 // items={ shapeButtonSet }
375 // columns={ 4 }
376 // />
377 // ) }
378 // { 'custom' === imageShapeSet && (
379 // <>
380 // <MediaPicker
381 // label={ __( 'Select Image', 'post-carousel' ) }
382 // imageKey={ 'maskingShapedUpload' }
383 // enableImageSize={ false }
384 // setAttributes={ setAttributes }
385 // backgroundImage={ maskingShapedUpload }
386 // />
387 // <SelectField
388 // label={ __( 'Mask Size', 'post-carousel' ) }
389 // attributes={ maskSize }
390 // attributesKey={ 'maskSize' }
391 // setAttributes={ setAttributes }
392 // items={ [
393 // {
394 // label: __( 'Auto', 'post-carousel' ),
395 // value: 'auto',
396 // },
397 // {
398 // label: __( 'Contain', 'post-carousel' ),
399 // value: 'contain',
400 // },
401 // {
402 // label: __( 'Cover', 'post-carousel' ),
403 // value: 'cover',
404 // },
405 // ] }
406 // />
407 // </>
408 // ) }
409 // </>
410 // );
411 // };
412
413 export const SmartImageBackgroundTab = ({ attributes, setAttributes }) => {
414 const {
415 smartImgBgEnable,
416 smartImgBg,
417 smartBgImgBorder,
418 smartBgImgBorderWidth,
419 smartBgImgBorderRadius,
420 smartBgImgInnerPadding,
421 // smartImageBgImage, // TODO: for upcoming version.
422 // smartImgOverlayType,
423 // smartImgOverlayColor,
424 // smartBgImgOverlayBlandMode,
425 // smartBgImgOverlayBlandModeHover,
426 // smartBgImgBlurHover,
427 // smartBgImgBlur,
428 } = attributes;
429
430 const [hoverState, setHoverState] = useState("color");
431
432 const radiusHandler = ({ newValue, typeKey }) => {
433 const updateData = smartBgImgBorderRadius?.allChange
434 ? {
435 top: newValue,
436 right: newValue,
437 bottom: newValue,
438 left: newValue,
439 }
440 : { ...smartBgImgBorderRadius.value, [typeKey]: newValue };
441
442 setAttributes({
443 smartBgImgBorderRadius: {
444 ...smartBgImgBorderRadius,
445 value: updateData,
446 },
447 });
448 };
449
450 const bgToggleHandler = (newValue) => {
451 const padding = newValue
452 ? { top: 0, right: 0, bottom: 0, left: 0 }
453 : { top: 12, right: 12, bottom: 12, left: 12 };
454
455 setAttributes({
456 smartImgBgEnable: !smartImgBgEnable,
457 smartBgImgInnerPadding: {
458 ...smartBgImgInnerPadding,
459 device: {
460 Desktop: padding,
461 Tablet: padding,
462 Mobile: padding,
463 },
464 },
465 });
466 };
467
468 return (
469 <>
470 <Toggle
471 label={__("Enable Background", "post-carousel")}
472 attributes={smartImgBgEnable}
473 attributesKey={"smartImgBgEnable"}
474 setAttributes={setAttributes}
475 onChange={(newValue) => bgToggleHandler(newValue)}
476 />
477 {smartImgBgEnable && (
478 <>
479 <ToggleGroupControl
480 attributes={hoverState}
481 onClick={(newValue) => setHoverState(newValue)}
482 items={[
483 { label: "Normal", value: "color" },
484 { label: "Hover", value: "hover" },
485 ]}
486 />
487 <Background
488 label={__("Background Type", "post-carousel")}
489 attributes={smartImgBg}
490 attributesKey={"smartImgBg"}
491 setAttributes={setAttributes}
492 colorType={hoverState}
493 items={solidGradientBgType}
494 // TODO: Upcoming Version.
495 // items={ excludeVideoBgType }
496 // imageObj={ {
497 // imageKey: 'smartImageBgImage',
498 // backgroundImage: smartImageBgImage,
499 // } } // TODO: Upcoming Version.
500 />
501 {/* TODO: Upcoming Version. */}
502 {/* { 'image' === smartImgBg?.[ hoverState ]?.style && (
503 <>
504 <SelectField
505 label={ __( 'Overlay Color', 'post-carousel' ) }
506 attributes={ smartImgOverlayType }
507 attributesKey={ 'smartImgOverlayType' }
508 setAttributes={ setAttributes }
509 items={ imageOverlayTypeItems }
510 />
511 { 'custom' === smartImgOverlayType && (
512 <>
513 { 'color' === hoverState ? (
514 <>
515 <SpColorPicker
516 label={ __(
517 'Overlay Color',
518 'post-carousel'
519 ) }
520 value={ smartImgOverlayColor.color }
521 onChange={ ( newValue ) =>
522 setAttributes( {
523 smartImgOverlayColor: {
524 ...smartImgOverlayColor,
525 color: newValue,
526 },
527 } )
528 }
529 />
530 <SelectField
531 label={ __(
532 'Color Blend Mode',
533 'post-carousel'
534 ) }
535 attributes={
536 smartBgImgOverlayBlandMode
537 }
538 attributesKey={
539 'smartBgImgOverlayBlandMode'
540 }
541 setAttributes={ setAttributes }
542 flexStyle={ true }
543 items={ imageBlandMode }
544 />
545 <SPRangeControl
546 label={ __(
547 'Overlay Blend Mode',
548 'post-carousel'
549 ) }
550 attributes={ smartBgImgBlur }
551 attributesKey={ 'smartBgImgBlur' }
552 setAttributes={ setAttributes }
553 />
554 </>
555 ) : (
556 <>
557 <SpColorPicker
558 label={ __(
559 'Overlay Color',
560 'post-carousel'
561 ) }
562 value={ smartImgOverlayColor.hover }
563 onChange={ ( newValue ) =>
564 setAttributes( {
565 smartImgOverlayColor: {
566 ...smartImgOverlayColor,
567 hover: newValue,
568 },
569 } )
570 }
571 />
572 <SelectField
573 label={ __(
574 'Color Blend Mode',
575 'post-carousel'
576 ) }
577 attributes={
578 smartBgImgOverlayBlandModeHover
579 }
580 attributesKey={
581 'smartBgImgOverlayBlandModeHover'
582 }
583 setAttributes={ setAttributes }
584 flexStyle={ true }
585 items={ imageBlandMode }
586 />
587 <SPRangeControl
588 label={ __(
589 'Overlay Blend Mode',
590 'post-carousel'
591 ) }
592 attributes={ smartBgImgBlurHover }
593 attributesKey={ 'smartBgImgBlurHover' }
594 setAttributes={ setAttributes }
595 />
596 </>
597 ) }
598 </>
599 ) }
600 </>
601 ) } */}
602 <Border
603 attributes={{
604 border: smartBgImgBorder,
605 borderWidth: smartBgImgBorderWidth,
606 }}
607 attributesKey={{
608 border: "smartBgImgBorder",
609 borderWidth: "smartBgImgBorderWidth",
610 }}
611 setAttributes={setAttributes}
612 />
613 <Spacing
614 label={__("Border Radius", "post-carousel")}
615 attributes={smartBgImgBorderRadius}
616 attributesKey={"smartBgImgBorderRadius"}
617 setAttributes={setAttributes}
618 units={["px", "%", "em"]}
619 indicator="radius"
620 onChangeValue={radiusHandler}
621 />
622 </>
623 )}
624 <Spacing
625 label={__("Inner Padding", "post-carousel")}
626 attributes={smartBgImgInnerPadding}
627 attributesKey={"smartBgImgInnerPadding"}
628 setAttributes={setAttributes}
629 units={["px", "%", "em"]}
630 />
631 </>
632 );
633 };
634
635 export const SmartImageCaptionTab = ({ attributes, setAttributes }) => {
636 const {
637 imgTitleEnable,
638 imgTitleLabel,
639 imgTitleTypography,
640 imgTitleFontSize,
641 imgTitleLineHeight,
642 imgTitleLetterSpacing,
643 imgTitleWordSpacing,
644 imgCaptionEnable,
645 imgCaptionLabel,
646 imgCaptionTypography,
647 imgCapFontSize,
648 imgCapLineHeight,
649 imgCapLetterSpacing,
650 imgCapWordSpacing,
651 imgTextVisibility,
652 imgTextColor,
653 imgTextPosition,
654 imgTextHorizontal,
655 imgTextVertical,
656 imgTextPadding,
657 } = attributes;
658 const [hoverState, setHoverState] = useState("color");
659 const [titleCap, setTitleCap] = useState("title");
660
661 return (
662 <>
663 <SPToggleGroupControl
664 attributes={titleCap}
665 setAttributes={setAttributes}
666 onClick={(newValue) => setTitleCap(newValue)}
667 items={[
668 { label: "Title", value: "title" },
669 { label: "Caption (Pro)", value: "caption", disabled: true },
670 ]}
671 />
672 {"title" === titleCap ? (
673 <>
674 <Toggle
675 label={__("Enable Image Title", "post-carousel")}
676 attributes={imgTitleEnable}
677 attributesKey={"imgTitleEnable"}
678 setAttributes={setAttributes}
679 />
680 {imgTitleEnable && (
681 <>
682 <InputControl
683 label={__("Title Label", "post-carousel")}
684 attributes={imgTitleLabel}
685 attributesKey={"imgTitleLabel"}
686 setAttributes={setAttributes}
687 flex={false}
688 inputType={"text"}
689 onChange={(newValue) => setAttributes({ imgTitleLabel: newValue })}
690 />
691 <TypographyNew
692 attributes={{
693 family: imgTitleTypography,
694 familyKey: "imgTitleTypography",
695 fontSize: imgTitleFontSize,
696 fontSizeKey: "imgTitleFontSize",
697 lineHeight: imgTitleLineHeight,
698 lineHeightKey: "imgTitleLineHeight",
699 fontSpacing: imgTitleLetterSpacing,
700 fontSpacingKey: "imgTitleLetterSpacing",
701 wordSpacing: imgTitleWordSpacing,
702 wordSpacingKey: "imgTitleWordSpacing",
703 }}
704 setAttributes={setAttributes}
705 />
706 </>
707 )}
708 </>
709 ) : (
710 <>
711 <Toggle
712 label={__("Enable Image Caption", "post-carousel")}
713 attributes={imgCaptionEnable}
714 attributesKey={"imgCaptionEnable"}
715 setAttributes={setAttributes}
716 />
717 {imgCaptionEnable && (
718 <>
719 <InputControl
720 label={__("Caption Label", "post-carousel")}
721 attributes={imgCaptionLabel}
722 attributesKey={"imgCaptionLabel"}
723 setAttributes={setAttributes}
724 flex={false}
725 inputType={"text"}
726 />
727 <TypographyNew
728 attributes={{
729 family: imgCaptionTypography,
730 familyKey: "imgCaptionTypography",
731 fontSize: imgCapFontSize,
732 fontSizeKey: "imgCapFontSize",
733 lineHeight: imgCapLineHeight,
734 lineHeightKey: "imgCapLineHeight",
735 fontSpacing: imgCapLetterSpacing,
736 fontSpacingKey: "imgCapLetterSpacing",
737 wordSpacing: imgCapWordSpacing,
738 wordSpacingKey: "imgCapWordSpacing",
739 }}
740 setAttributes={setAttributes}
741 />
742 </>
743 )}
744 </>
745 )}
746 {(imgTitleEnable || imgCaptionEnable) && (
747 <>
748 <Divider position="sp-w-100pct bottom" />
749 {"over-img" === imgTextPosition && (
750 <SelectField
751 label={__("Visibility", "post-carousel")}
752 attributes={imgTextVisibility}
753 attributesKey={"imgTextVisibility"}
754 setAttributes={setAttributes}
755 items={[
756 { label: "Show Always", value: "show-always" },
757 { label: "Show on Hover (Pro)", value: "show-hover", disabled: true },
758 ]}
759 />
760 )}
761 <ToggleGroupControl
762 attributes={hoverState}
763 onClick={(newValue) => setHoverState(newValue)}
764 items={[
765 { label: "Normal", value: "color" },
766 { label: "Hover", value: "hover" },
767 ]}
768 />
769 {"color" === hoverState ? (
770 <>
771 <SpColorPicker
772 label={__("Color", "post-carousel")}
773 value={imgTextColor.color}
774 onChange={(newValue) =>
775 setAttributes({
776 imgTextColor: {
777 ...imgTextColor,
778 color: newValue,
779 },
780 })
781 }
782 />
783 </>
784 ) : (
785 <>
786 <SpColorPicker
787 label={__("Color", "post-carousel")}
788 value={imgTextColor.color}
789 onChange={(newValue) =>
790 setAttributes({
791 imgTextColor: {
792 ...imgTextColor,
793 color: newValue,
794 },
795 })
796 }
797 />
798 </>
799 )}
800 <Divider position={"sp-w-100pct bottom"} />
801 <SelectField
802 label={__("Position", "post-carousel")}
803 attributes={imgTextPosition}
804 attributesKey={"imgTextPosition"}
805 setAttributes={setAttributes}
806 items={[
807 { label: "Top", value: "top" },
808 { label: "Bottom", value: "bottom" },
809 { label: "Over the image (Pro)", value: "over-img", disabled: true },
810 ]}
811 />
812 <SPToggleGroupControl
813 label={__("Horizontal Alignment", "post-carousel")}
814 attributes={imgTextHorizontal}
815 attributesKey={"imgTextHorizontal"}
816 setAttributes={setAttributes}
817 items={[
818 { label: <AlignLeft />, value: "left" },
819 { label: <AlignCenter />, value: "center" },
820 { label: <AlignRight />, value: "right" },
821 ]}
822 />
823 {"over-img" === imgTextPosition && (
824 <SPToggleGroupControl
825 label={__("Vertical Alignment", "post-carousel")}
826 attributes={imgTextVertical}
827 attributesKey={"imgTextVertical"}
828 setAttributes={setAttributes}
829 extraClass={" sp-svg-rotate-90"}
830 items={[
831 { label: <FlexAlignStart />, value: "top" },
832 { label: <FlexAlignCenter />, value: "center" },
833 { label: <FlexAlignEnd />, value: "bottom" },
834 ]}
835 rotate={true}
836 />
837 )}
838 </>
839 )}
840 <Spacing
841 label={__("Padding", "post-carousel")}
842 attributes={imgTextPadding}
843 attributesKey={"imgTextPadding"}
844 setAttributes={setAttributes}
845 units={["px", "%", "em"]}
846 defaultValue={{ top: 20, right: 20, bottom: 20, left: 20 }}
847 />
848 </>
849 );
850 };
851
852 export const SmartImageEffectTab = ({ attributes, setAttributes }) => {
853 const {
854 // imgAnimationEffect,
855 // imgAnimationSpeed,
856 // imgAnimationLineWidth,
857 imgAnimationNormal,
858 imgHoverOverlayEnable,
859 imgHoverOverlayColor,
860 imgMaskingEnable,
861 imageShapeSet,
862 selectImageShape,
863 imgHoverEffectOpacity,
864 } = attributes;
865
866 const imageAnimAllItems =
867 !imgMaskingEnable || (imgMaskingEnable && "custom" !== imageShapeSet && "original" === selectImageShape);
868
869 return (
870 <>
871 {/* <SelectField
872 label={__("Animation Effect", "post-carousel")}
873 attributes={imgAnimationEffect}
874 attributesKey={"imgAnimationEffect"}
875 setAttributes={setAttributes}
876 items={[
877 { label: "Select an Effect", value: "" },
878 { label: "Jazz", value: "jazz" },
879 { label: "Apollo", value: "apollo" },
880 { label: "Selena", value: "selena" },
881 { label: "Oscar", value: "oscar" },
882 { label: "Layla", value: "layla" },
883 ]}
884 /> */}
885 {/* TODO: Upcoming Version. */}
886 {/* <SPRangeControl
887 label={__("Animation Speed", "post-carousel")}
888 attributes={imgAnimationSpeed}
889 attributesKey={"imgAnimationSpeed"}
890 setAttributes={setAttributes}
891 units={["px", "%", "em"]}
892 min={0}
893 max={5}
894 step={0.1}
895 />
896 <SPRangeControl
897 label={__("Line Width", "post-carousel")}
898 attributes={imgAnimationLineWidth}
899 attributesKey={"imgAnimationLineWidth"}
900 setAttributes={setAttributes}
901 units={["px", "%", "em"]}
902 min={0}
903 max={5}
904 step={0.1}
905 /> */}
906 <SelectField
907 label={__("Image Animation", "post-carousel")}
908 attributes={imgAnimationNormal}
909 attributesKey={"imgAnimationNormal"}
910 setAttributes={setAttributes}
911 items={imageAnimAllItems ? hoverEffectItems : hoverEffectShortItems}
912 />
913 <Toggle
914 label={__("Hover Overlay", "post-carousel")}
915 attributes={imgHoverOverlayEnable}
916 attributesKey={"imgHoverOverlayEnable"}
917 setAttributes={setAttributes}
918 pro={true}
919 />
920 {imgHoverOverlayEnable && (
921 <>
922 <Background
923 label={__("Overlay Type", "post-carousel")}
924 attributes={imgHoverOverlayColor}
925 attributesKey={"imgHoverOverlayColor"}
926 setAttributes={setAttributes}
927 items={solidGradientBgType}
928 colorType={"color"}
929 colorLabel={"Overlay Color"}
930 />
931 <SPRangeControl
932 label={__("Overlay Opacity", "post-carousel")}
933 attributes={imgHoverEffectOpacity}
934 attributesKey={"imgHoverEffectOpacity"}
935 setAttributes={setAttributes}
936 defaultValue={0.6}
937 min={0}
938 step={0.1}
939 max={1}
940 />
941 </>
942 )}
943 </>
944 );
945 };
946