import { __ } from "@wordpress/i18n"; import { useEffect, useState, useRef } from "@wordpress/element"; import { ensureHttps, priceLink } from "../shared/helpFn"; import { Layouts, Background, Border, Spacing, Toggle, BoxShadow, SPRangeControl, SelectField, SpColorPicker, TypographyNew, InputControl, MediaPicker, Divider, } from "../../components"; import SPToggleGroupControl from "../../components/toggleGroupControl/toggleGroupControl"; import { AlignCenter, AlignLeft, AlignRight } from "../../icons/icons"; import { LayoutOne, LayoutTwo, LayoutThree, LayoutFour, LayoutFive } from "./icons"; import { BgIcon, GradientIcon, Image, TransparentIcon } from "../../components/background/svgIcon"; import useDefaultValue from "../../hooks/useDefaultValue"; import IconsLibrary from "../../components/iconLibrary/iconLibrary"; import ProInfo from "../../components/proInfo/proInfo"; export const InfoBoxGeneralTab = ({ attributes, setAttributes }) => { const { infoBoxLayout, contentAlignment, separatorMargin, titleMargin, caMargin, iconPositionLayoutFive } = attributes; const layoutNameRef = useRef(infoBoxLayout); const layoutChange = (newValue) => { if (newValue === infoBoxLayout) { return; } setAttributes({ infoBoxLayout: newValue }); if (newValue === "smart-info-box-layout-five" && iconPositionLayoutFive === "top-content") { setAttributes({ titleMargin: { ...titleMargin, device: { ...titleMargin.device, Desktop: { ...titleMargin.device.Desktop, top: 25, }, }, }, }); } if (newValue === "smart-info-box-layout-five" && iconPositionLayoutFive === "bottom-content") { setAttributes({ caMargin: { ...caMargin, device: { ...caMargin.device, Desktop: { ...caMargin.device.Desktop, bottom: 25, }, }, }, }); } if (newValue !== "smart-info-box-layout-five") { setAttributes({ titleMargin: { ...titleMargin, device: { ...titleMargin.device, Desktop: { ...titleMargin.device.Desktop, bottom: 8, top: 0, }, }, }, }); setAttributes({ caMargin: { ...caMargin, device: { ...caMargin.device, Desktop: { ...caMargin.device.Desktop, bottom: 0, }, }, }, }); } }; useEffect(() => { if (layoutNameRef.current === infoBoxLayout) { return; } layoutNameRef.current = infoBoxLayout; if (infoBoxLayout === "smart-info-box-layout-one" || infoBoxLayout === "smart-info-box-layout-five") { setAttributes({ contentAlignment: "center" }); } if ( infoBoxLayout === "smart-info-box-layout-two" || infoBoxLayout === "smart-info-box-layout-three" || infoBoxLayout === "smart-info-box-layout-four" ) { setAttributes({ contentAlignment: "left" }); } }, [infoBoxLayout]); return ( <>
, value: "smart-info-box-layout-one", }, { icon: , value: "smart-info-box-layout-two", type: "pro", demoLink: priceLink }, { icon: , value: "smart-info-box-layout-three", type: "pro", demoLink: priceLink }, { icon: , value: "smart-info-box-layout-four", type: "pro", demoLink: priceLink }, { icon: , value: "smart-info-box-layout-five", type: "pro", demoLink: priceLink }, ]} />
, value: "left" }, { label: , value: "center" }, { label: , value: "right" }, ]} /> Unlock exclusive layouts and advanced display controls. Upgrade to Pro! ); }; export const InfoBoxStyleTab = ({ attributes, setAttributes }) => { const { infoBoxBg, borderStyle, borderStyleWidth, borderRadius, boxShadowEnable, boxShadow, borderHoverStyle, borderHoverStyleWidth, borderHoverRadius, boxShadowHoverEnable, boxShadowHover, margin, padding, infoBoxBgImage, imageScale, imageOverlayColor, imageOverlayOpacity, infoBoxRadialShape, infoBoxRadialPosition, infoBoxHoverBgImage, infoBoxHoverRadialShape, infoBoxHoverRadialPosition, imageHoverScale, imageHoverOverlayOpacity, infoBoxStyleType, imageOverlayEnable, imageOverlayHoverEnable, } = attributes; return ( <> setAttributes({ infoBoxStyleType: val })} /> {infoBoxStyleType === "color" && ( <> , value: "transparent", tooltip: __("Transparent", "post-carousel"), }, { label: , value: "bgColor", tooltip: __("Solid", "post-carousel"), }, { label: , value: "gradient", tooltip: __("Gradient", "post-carousel"), }, { label: , value: "image", tooltip: __("Image", "post-carousel"), }, ]} imageObj={{ imageKey: "infoBoxBgImage", backgroundImage: infoBoxBgImage, }} /> {infoBoxBg[infoBoxStyleType]?.style === "gradient" && ( <> {/^radial-gradient/.test(infoBoxBg[infoBoxStyleType]?.gradient) && ( <> )} )} {infoBoxBg[infoBoxStyleType]?.style === "image" && ( <> {imageOverlayEnable && ( <> setAttributes({ imageOverlayColor: { ...imageOverlayColor, color: newColor, }, }) } defaultColor="#fff" /> )} )} {boxShadowEnable && ( )} )} {infoBoxStyleType === "hover" && ( <> , value: "transparent", tooltip: __("Transparent", "post-carousel"), }, { label: , value: "bgColor", tooltip: __("Solid", "post-carousel"), }, { label: , value: "gradient", tooltip: __("Gradient", "post-carousel"), }, { label: , value: "image", tooltip: __("Image", "post-carousel"), }, ]} imageObj={{ imageKey: "infoBoxHoverBgImage", backgroundImage: infoBoxHoverBgImage, }} /> {infoBoxBg[infoBoxStyleType]?.style === "gradient" && ( <> {/^radial-gradient/.test(infoBoxBg[infoBoxStyleType]?.gradient) && ( <> )} )} {infoBoxBg[infoBoxStyleType]?.style === "image" && ( <> {imageOverlayHoverEnable && ( <> setAttributes({ imageOverlayColor: { ...imageOverlayColor, hoverColor: newColor, }, }) } defaultColor="#fff" /> )} )} {boxShadowHoverEnable && ( )} )} ); }; export const IconImageGeneralTab = ({ attributes, setAttributes }) => { const { iconEnable, iconSize, iconPosition, iconSource, iconSourceCustom, iconCustomWidth, iconCustomHeight, infoBoxLayout, verticalAlignment, iconName, iconPositionLayoutFive, iconHorizontalAlignment, iconVerticalAlignment, separatorMargin, caMargin, titleMargin, iconMargin, } = attributes; const iconPositionOptions = { "smart-info-box-layout-one": [ { label: __("Above Title", "post-carousel"), value: "above-title" }, { label: __("Below Title", "post-carousel"), value: "below-title" }, { label: __("Bottom of Content", "post-carousel"), value: "bottom-content" }, ], "smart-info-box-layout-two": [ { label: __("Select Position", "post-carousel"), value: null }, { label: __("Left of Title", "post-carousel"), value: "left-title" }, { label: __("Right of Title", "post-carousel"), value: "right-title" }, ], "smart-info-box-layout-three": [ { label: __("Select Position", "post-carousel"), value: null }, { label: __("Left of Content", "post-carousel"), value: "left-content" }, { label: __("Right of Content", "post-carousel"), value: "right-content" }, ], }; const handleIconPositionLayoutFive = (position) => { setAttributes({ iconPositionLayoutFive: position }); if (position === "top-content") { setAttributes({ titleMargin: { ...titleMargin, device: { ...titleMargin.device, Desktop: { ...titleMargin.device.Desktop, top: 25, }, }, }, }); } else { setAttributes({ titleMargin: { ...titleMargin, device: { ...titleMargin.device, Desktop: { ...titleMargin.device.Desktop, top: 8, }, }, }, }); } if (position === "bottom-content") { setAttributes({ caMargin: { ...caMargin, device: { ...caMargin.device, Desktop: { ...caMargin.device.Desktop, bottom: 25, }, }, }, }); setAttributes({ separatorMargin: { ...separatorMargin, device: { ...separatorMargin.device, Desktop: { ...separatorMargin.device.Desktop, top: 8, }, }, }, }); } else { setAttributes({ caMargin: { ...caMargin, device: { ...caMargin.device, Desktop: { ...caMargin.device.Desktop, bottom: 0, }, }, }, }); } }; const handleIconPositionChange = (val) => { setAttributes({ iconPosition: val }); if (val === "bottom-content") { setAttributes({ iconMargin: { ...iconMargin, device: { ...iconMargin.device, Desktop: { ...iconMargin.device.Desktop, top: "24", bottom: "0", }, }, }, }); } else { setAttributes({ iconMargin: { ...iconMargin, device: { ...iconMargin.device, Desktop: { ...iconMargin.device.Desktop, top: "0", bottom: "24", }, }, }, }); } }; return ( <> {iconEnable && ( <> {iconSource === "library" && ( <> )} {iconSource === "custom" && ( <> )} {["smart-info-box-layout-one", "smart-info-box-layout-two", "smart-info-box-layout-three"].includes( infoBoxLayout ) && ( )} {infoBoxLayout === "smart-info-box-layout-five" && ( <> {["top-content", "bottom-content"].includes(iconPositionLayoutFive) && ( )} {["left-content", "right-content"].includes(iconPositionLayoutFive) && ( )} )} {infoBoxLayout === "smart-info-box-layout-three" && ( )} )} ); }; export const IconImageStyleTab = ({ attributes, setAttributes }) => { const { iconHoverEffects, iconBorderStyle, iconBorderHoverStyle, iconBorderStyleWidth, iconBorderStyleHoverWidth, iconBorderRadius, iconBoxShadowEnable, iconBoxShadow, iconBorderHoverRadius, iconBoxShadowHoverEnable, iconBoxShadowHover, iconMargin, iconPadding, iconColor, iconOverlayColor, iconOverlayEnable, iconBg, iconOverlayOpacity, iconRadialShape, iconRadialPosition, iconHoverRadialPosition, iconHoverRadialShape, iconSource, iconEnable, infoBoxLayout, gapBetweenDescription, iconHoverEffectOpacity, } = attributes; const [iconStyleType, setIconStyleType] = useState("color"); return ( <> {iconEnable && ( <> {iconHoverEffects === "opacity" && ( )} )} {iconEnable && iconSource === "custom" && ( <> {iconOverlayEnable && ( <> setAttributes({ iconOverlayColor: newColor, }) } defaultColor="#333333" /> )} )} {iconEnable && ( <> setIconStyleType(val)} /> {iconStyleType === "color" && ( <> {iconSource === "library" && ( setAttributes({ iconColor: { ...iconColor, color: newColor, }, }) } defaultColor="#fff" /> )} , value: "bgColor", tooltip: __("Solid", "post-carousel"), }, { label: , value: "gradient", tooltip: __("Gradient", "post-carousel"), }, ]} /> {/* {iconBg[iconStyleType]?.style === "gradient" && ( <> {/^radial-gradient/.test(iconBg[iconStyleType]?.gradient) && ( <> )} )} */} {iconBoxShadowEnable && ( )} )} {iconStyleType === "hover" && ( <> {iconSource === "library" && ( setAttributes({ iconColor: { ...iconColor, hoverColor: newColor, }, }) } defaultColor="#fff" /> )} , value: "bgColor", tooltip: __("Solid", "post-carousel"), }, { label: , value: "gradient", tooltip: __("Gradient", "post-carousel"), }, ]} /> {iconBg[iconStyleType]?.style === "gradient" && ( <> {/^radial-gradient/.test(iconBg[iconStyleType]?.gradient) && ( <> )} )} {iconBoxShadowHoverEnable && ( )} )} {infoBoxLayout === "smart-info-box-layout-one" && ( )} {infoBoxLayout === "smart-info-box-layout-two" && ( )} )} ); }; export const TitleGeneralTab = ({ attributes, setAttributes }) => { const { titleEnable, titleTag, subTitleEnable, subTitleTag, subTitlePosition, subTitleGap } = attributes; return ( <> {titleEnable && ( <> <> {subTitleEnable && ( <> )} )} ); }; export const TitleStyleTab = ({ attributes, setAttributes }) => { const { titleHoverEffects, titleColor, subTitleColor, titleMargin, titleTypography, titleFontSize, titleLatterSpacing, titleLineHeight, subTitleTypography, subTitleFontSize, subTitleLatterSpacing, subTitleLineHeight, subTitleEnable, titleEnable, titleWordSpacing, subTitleWordSpacing, hoverEffectsColor, titleGlobalTypography, subTitleGlobalTypography, } = attributes; const [iconStyleType, setIconStyleType] = useState("color"); return ( <> {titleEnable && ( <> {titleHoverEffects !== "none" && ( setAttributes({ hoverEffectsColor: newColor })} defaultColor="#2F2F2F" /> )} {subTitleEnable && ( )} setIconStyleType(val)} /> {iconStyleType === "color" && ( <> setAttributes({ titleColor: { ...titleColor, color: newColor, }, }) } defaultColor="#2F2F2F" /> {subTitleEnable && ( setAttributes({ subTitleColor: { ...subTitleColor, color: newColor, }, }) } defaultColor="#333333" /> )} )} {iconStyleType === "hover" && ( <> setAttributes({ titleColor: { ...titleColor, hoverColor: newColor, }, }) } defaultColor="#2F2F2F" /> {subTitleEnable && ( setAttributes({ subTitleColor: { ...subTitleColor, hoverColor: newColor, }, }) } defaultColor="#333333" /> )} )} )} ); }; export const DescriptionGeneralTab = ({ attributes, setAttributes }) => { const { descriptionEnable, dropCapsEnable } = attributes; return ( <> {descriptionEnable && ( )} ); }; export const DescriptionStyleTab = ({ attributes, setAttributes }) => { const { descriptionMargin, descriptionTypography, descriptionFontSize, descriptionLatterSpacing, descriptionLineHeight, blockName, descriptionColor, dropCapsColor, descriptionEnable, dropCapsEnable, descriptionWordSpacing, desGlobalTypography, } = attributes; const [iconStyleType, setIconStyleType] = useState("color"); return ( <> {descriptionEnable && ( <> setIconStyleType(val)} /> {iconStyleType === "color" && ( <> setAttributes({ descriptionColor: { ...descriptionColor, color: newColor, }, }) } defaultColor="#fff" /> {dropCapsEnable && ( setAttributes({ dropCapsColor: newColor, }) } defaultColor="#333333" /> )} )} {iconStyleType === "hover" && ( <> setAttributes({ descriptionColor: { ...descriptionColor, hoverColor: newColor, }, }) } defaultColor="#fff" /> )} )} ); }; export const BadgeGeneralTab = ({ attributes, setAttributes }) => { const { badgeEnable, badgePosition, badgeLabel } = attributes; return ( <> {badgeEnable && ( <> )} Highlight important content with custom badges and flexible positioning. Upgrade to Pro! ); }; export const BadgeStyleTab = ({ attributes, setAttributes }) => { const { blockName, badgeTypography, badgeFontSize, badgeLatterSpacing, badgeLineHeight, badgeColor, badgeBg, badgeBorderStyle, badgeBorderStyleWidth, badgeBorderRadius, badgeBoxShadowEnable, badgeBoxShadow, badgeBorderHoverStyle, badgeBorderStyleHoverWidth, badgeBorderHoverRadius, badgeBoxShadowHoverEnable, badgeBoxShadowHover, badgePadding, badgeMargin, badgeRadialShape, badgeRadialPosition, badgeHoverRadialShape, badgeHoverRadialPosition, badgeEnable, badgeWordSpacing, badgeGlobalTypography, } = attributes; const [iconStyleType, setIconStyleType] = useState("color"); return ( <> {badgeEnable && ( <> setIconStyleType(val)} /> {iconStyleType === "color" && ( <> setAttributes({ badgeColor: { ...badgeColor, color: newColor, }, }) } defaultColor="#2F2F2F" /> <> , value: "bgColor", tooltip: __("Solid", "post-carousel"), }, { label: , value: "gradient", tooltip: __("Gradient", "post-carousel"), }, ]} /> {badgeBg[iconStyleType]?.style === "gradient" && ( <> {/^radial-gradient/.test(badgeBg[iconStyleType]?.gradient) && ( <> )} )} {badgeBoxShadowEnable && ( )} )} {iconStyleType === "hover" && ( <> setAttributes({ badgeColor: { ...badgeColor, hoverColor: newColor, }, }) } defaultColor="#2F2F2F" /> <> , value: "bgColor", tooltip: __("Solid", "post-carousel"), }, { label: , value: "gradient", tooltip: __("Gradient", "post-carousel"), }, ]} /> {badgeBg[iconStyleType]?.style === "gradient" && ( <> {/^radial-gradient/.test(badgeBg[iconStyleType]?.gradient) && ( <> )} )} {badgeBoxShadowHoverEnable && ( )} )} )} ); }; export const RatingGeneralTab = ({ attributes, setAttributes }) => { const { ratingEnable, scale, ratingIconSize, ratingValueEnable, ratingValuePosition, ratingIconSourceLibrary, ratingGap, } = attributes; return ( <> {ratingEnable && ( <>

{__("Icon Source", "post-carousel")}

{ratingValueEnable && ( <> )} )}

Premium Only

Highlight content with customizable rating controls.

  • — Enable star ratings display
  • — Adjustable rating scale
  • — Custom icon selection
  • — Icon size control
  • — Control Rating value
  • — Flexible position and spacing
Upgrade to Pro
); }; export const RatingStyleTab = ({ attributes, setAttributes }) => { const { ratingTypography, ratingFontSize, ratingLatterSpacing, ratingLineHeight, ratingMargin, filledColor, emptyColor, ratingNumberColor, ratingEnable, ratingWordSpacing, ratingGlobalTypography, } = attributes; const [iconStyleType, setIconStyleType] = useState("color"); return ( <> {ratingEnable && ( <> setIconStyleType(val)} /> {iconStyleType === "color" && ( <> setAttributes({ filledColor: { ...filledColor, color: newColor, }, }) } defaultColor="#F0B849" /> setAttributes({ emptyColor: { ...emptyColor, color: newColor, }, }) } defaultColor="#ddd" /> setAttributes({ ratingNumberColor: { ...ratingNumberColor, color: newColor, }, }) } defaultColor="#757575" /> )} {iconStyleType === "hover" && ( <> setAttributes({ filledColor: { ...filledColor, hoverColor: newColor, }, }) } defaultColor="#e79a00ff" /> setAttributes({ emptyColor: { ...emptyColor, hoverColor: newColor, }, }) } defaultColor="#757575" /> setAttributes({ ratingNumberColor: { ...ratingNumberColor, hoverColor: newColor, }, }) } defaultColor="#757575" /> )} )} ); }; export const CallToActionGeneralTab = ({ attributes, setAttributes }) => { const { callActionEnable, linkingType, fullWidthButton, cAIconSize, cAIconPosition, iconTextGap, buttonLink, openNewTab, overlayOnHover, externalLinkIcon, cAIconSource, cAIconSourceLibrary, cAIconCustomWidth, cAIconCustomHeight, cAIconSourceCustom, buttonIconEnable, infoBoxLayout, } = attributes; const handleButtonLink = (newLink) => { const link = ensureHttps(newLink); setAttributes({ buttonLink: link }); }; return ( <> {callActionEnable && ( <> {linkingType === "button" && ( <> {infoBoxLayout !== "smart-info-box-layout-four" && ( )} )} {(linkingType === "button" || linkingType === "text") && ( )} {linkingType === "fullBox" && ( )} {linkingType === "fullBox" && overlayOnHover && ( )} {buttonIconEnable && ( <> {linkingType !== "fullBox" && ( <> {cAIconSource === "library" && ( <> )} {cAIconSource === "custom" && ( <> )} )} {linkingType !== "fullBox" && ( <> )} )} )}

Premium Only

Enhance your buttons with customizable icons

  • — Add icons to buttons
  • — Icon size and spacing control
  • — Flexible icon positioning
  • — Normal and hover color styling
Upgrade to Pro
); }; export const CallToActionStyleTab = ({ attributes, setAttributes }) => { const { caBorderRadius, caHoverBorderStyle, caHoverBorderStyleWidth, caPadding, caMargin, caIconColor, cABg, cATypography, caRadialShape, cAFontSize, cALatterSpacing, caHoverRadialPosition, cALineHeight, cAOverlayColor, externalLinkIconColor, caRadialPosition, cAOverlayOpacity, caHoverRadialShape, linkingType, caBorderStyle, caBorderStyleWidth, caHoverBorderRadius, callActionEnable, cAWordSpacing, callToActionGlobalTypography, } = attributes; const [caStyleType, setCaStyleType] = useState("color"); return ( <> {callActionEnable && ( <> {linkingType === "fullBox" && ( <> setAttributes({ cAOverlayColor: newColor, }) } defaultColor="#333333" /> setAttributes({ externalLinkIconColor: newColor, }) } defaultColor="#fff" /> )} {linkingType !== "fullBox" && ( <> setCaStyleType(val)} /> {caStyleType === "color" && ( <> {(linkingType === "button" || linkingType === "text") && ( setAttributes({ caIconColor: { ...caIconColor, color: newColor, }, }) } defaultColor="#2F2F2F" /> )} {linkingType === "button" && ( <> , value: "bgColor", tooltip: __("Solid", "post-carousel"), }, { label: , value: "gradient", tooltip: __("Gradient", "post-carousel"), }, ]} /> {cABg[caStyleType]?.style === "gradient" && ( <> {/^radial-gradient/.test(cABg[caStyleType]?.gradient) && ( <> )} )} )} )} {caStyleType === "hover" && ( <> {(linkingType === "button" || linkingType === "text") && ( setAttributes({ caIconColor: { ...caIconColor, hoverColor: newColor, }, }) } defaultColor="#2F2F2F" /> )} {linkingType === "button" && ( <> , value: "bgColor", tooltip: __("Solid", "post-carousel"), }, { label: , value: "gradient", tooltip: __("Gradient", "post-carousel"), }, ]} /> {cABg[caStyleType]?.style === "gradient" && ( <> {/^radial-gradient/.test(cABg[caStyleType]?.gradient) && ( <> )} )} )} )} {linkingType === "button" && ( )} )} )} ); }; export const SeparatorTab = ({ attributes, setAttributes }) => { const { separatorWidth, separatorThinkness, separatorEnable, separatorStyle, separatorPosition, separatorColor, infoBoxLayout, separatorMargin, } = attributes; const separatorItems = infoBoxLayout === "smart-info-box-layout-four" ? [ { label: __("After Title", "post-carousel"), value: "after-title", }, { label: __("After Description", "post-carousel"), value: "after-description", }, ] : [ { label: __("After Title", "post-carousel"), value: "after-title", }, { label: __("After Description", "post-carousel"), value: "after-description", }, { label: __("After Call to Action", "post-carousel"), value: "after-call-Action", }, ]; return ( <> {separatorEnable && ( <> setAttributes({ separatorColor: newColor })} defaultColor="#ddd" /> )} ); };