import { useState } from "@wordpress/element"; import { __ } from "@wordpress/i18n"; import { Layouts, Background, Border, Spacing, Toggle, BoxShadow, SPRangeControl, SelectField, SpColorPicker, TypographyNew, MediaPicker, SpSVGIconPicker, } from "../../components"; import SPToggleGroupControl from "../../components/toggleGroupControl/toggleGroupControl"; import IconsLibrary from "../../components/iconLibrary/iconLibrary"; import { AlignCenter, AlignLeft, AlignRight, AlignTop, AlignMiddle, AlignBottom } from "../../icons/icons"; import { BgIcon, GradientIcon, Image } from "../../components/background/svgIcon"; import { LayoutOne, LayoutTwo, LayoutFour, LayoutFive, BackgroundShapeCircle, BackgroundShapeSquare, BackgroundShapeHexagon, BackgroundShapeDiamond, BackgroundShapeStarburst, } from "./icons"; import ProInfo from "../../components/proInfo/proInfo"; const RADIAL_SHAPES = [ { label: __("Circle", "post-carousel"), value: "circle" }, { label: __("Ellipse", "post-carousel"), value: "ellipse" }, ]; const RADIAL_POSITIONS = [ { label: __("Center Center", "post-carousel"), value: "center center" }, { label: __("Center Left", "post-carousel"), value: "center left" }, { label: __("Center Right", "post-carousel"), value: "center right" }, { label: __("Top Center", "post-carousel"), value: "top center" }, { label: __("Top Left", "post-carousel"), value: "top left" }, { label: __("Top Right", "post-carousel"), value: "top right" }, { label: __("Bottom Center", "post-carousel"), value: "bottom center" }, { label: __("Bottom Left", "post-carousel"), value: "bottom left" }, { label: __("Bottom Right", "post-carousel"), value: "bottom right" }, ]; const BACKGROUND_ITEMS = [ { label: , value: "bgColor", tooltip: __("Solid", "post-carousel"), }, { label: , value: "gradient", tooltip: __("Gradient", "post-carousel"), }, ]; const DEFAULT_SPACING = { unit: "px", value: { top: "0", right: "0", bottom: "0", left: "0" }, }; export const SmartListsGeneralTab = ({ attributes, setAttributes }) => { const { smartListsLayout, listOrientation, listsAlignment, spaceBetweenLists, iconContentGap, dividerEnable, dividerStyle, dividerWidth, dividerColor, listItemsWidth, } = attributes; // Default config for layouts const layoutConfigs = { "layout-one": { dividerEnable: false, descriptionEnable: false, iconBackgroundEnable: false, iconContentGap: { ...iconContentGap, device: { ...iconContentGap.device, Desktop: "10" }, }, spaceBetweenLists: { ...spaceBetweenLists, device: { ...spaceBetweenLists.device, Desktop: "24" }, }, listOrientation: "vertical", iconPosition: 0, }, "layout-two": { dividerEnable: true, descriptionEnable: true, iconBackgroundEnable: true, iconContentGap: { ...iconContentGap, device: { ...iconContentGap.device, Desktop: "10" }, }, spaceBetweenLists: { ...spaceBetweenLists, device: { ...spaceBetweenLists.device, Desktop: "24" }, }, listOrientation: "vertical", iconPosition: 0, }, "layout-three": { dividerEnable: false, descriptionEnable: true, iconBackgroundEnable: true, iconContentGap: { ...iconContentGap, device: { ...iconContentGap.device, Desktop: "10" }, }, spaceBetweenLists: { ...spaceBetweenLists, device: { ...spaceBetweenLists.device, Desktop: "24" }, }, listOrientation: "vertical", iconPosition: 0, }, "layout-four": { dividerEnable: false, descriptionEnable: true, iconBackgroundEnable: true, iconContentGap: { ...iconContentGap, device: { ...iconContentGap.device, Desktop: "10" }, }, spaceBetweenLists: { ...spaceBetweenLists, device: { ...spaceBetweenLists.device, Desktop: "12" }, }, listOrientation: "vertical", iconPosition: 0, }, "layout-five": { dividerEnable: false, descriptionEnable: true, iconBackgroundEnable: true, iconContentGap: { ...iconContentGap, device: { ...iconContentGap.device, Desktop: "18" }, }, listOrientation: "horizontal", iconPosition: "top", }, }; const layoutChange = (newValue) => { if (newValue === smartListsLayout) { return; } setAttributes({ smartListsLayout: newValue }); setAttributes({ smartListsLayout: newValue, ...(layoutConfigs[newValue] || {}), }); }; return (
, value: "layout-one", }, { icon: , value: "layout-two", type: "pro", demoLink: "https://wpsmartpost.com/blocks/#demoId3592" }, { icon: , value: "layout-four", type: "pro", demoLink: "https://wpsmartpost.com/blocks/#demoId3592" }, { icon: , value: "layout-five", type: "pro", demoLink: "https://wpsmartpost.com/blocks/#demoId3592" }, ]} />
{__("List Orientation", "post-carousel")}
setAttributes({ listOrientation: val })} /> , value: "start" }, { label: , value: "center" }, { label: , value: "end" }, ]} /> <> {dividerEnable && ( <> setAttributes({ dividerColor: newColor, }) } defaultColor="#D9D9D9" /> )}

Unlock exclusive layouts and advanced display controls. Upgrade to Pro!
); }; export const SmartListsStyleTab = ({ attributes, setAttributes }) => { const { smartListsBg, smartListsBgImage, smartListsRadialShape, smartListsRadialPosition, smartListsBgImageScale, bgImageOverlayEnable, borderStyle, borderStyleWidth, borderRadius, boxShadowEnable, boxShadow, smartListsHoverBgImage, smartListsHoverRadialShape, smartListsHoverRadialPosition, smartListsBgHoverImageScale, bgImageOverlayHoverEnable, bgImageHoverOverlayOpacity, borderHoverStyle, borderHoverStyleWidth, borderHoverRadius, boxShadowHoverEnable, boxShadowHover, padding, margin, bgImageOverlayColor, bgImageOverlayOpacity, } = attributes; const [smartListsStyleType, setSmartListsStyleType] = useState("color"); return ( <> setSmartListsStyleType(val)} /> {smartListsStyleType === "color" && ( <> , value: "bgColor", tooltip: __("Solid", "post-carousel"), }, { label: , value: "gradient", tooltip: __("Gradient", "post-carousel"), }, { label: , value: "image", tooltip: __("Image", "post-carousel"), }, ]} imageObj={{ imageKey: "smartListsBgImage", backgroundImage: smartListsBgImage, }} /> {smartListsBg[smartListsStyleType]?.style === "gradient" && ( <> {/^radial-gradient/.test(smartListsBg[smartListsStyleType]?.gradient) && ( <> )} )} {smartListsBg[smartListsStyleType]?.style === "image" && ( <> {bgImageOverlayEnable && ( <> setAttributes({ bgImageOverlayColor: { ...bgImageOverlayColor, color: newColor, }, }) } defaultColor="#fff" /> )} )} {boxShadowEnable && ( )} )} {smartListsStyleType === "hover" && ( <> , value: "bgColor", tooltip: __("Solid", "post-carousel"), }, { label: , value: "gradient", tooltip: __("Gradient", "post-carousel"), }, { label: , value: "image", tooltip: __("Image", "post-carousel"), }, ]} imageObj={{ imageKey: "smartListsHoverBgImage", backgroundImage: smartListsHoverBgImage, }} /> {smartListsBg[smartListsStyleType]?.style === "gradient" && ( <> {/^radial-gradient/.test(smartListsBg[smartListsStyleType]?.gradient) && ( <> )} )} {smartListsBg[smartListsStyleType]?.style === "image" && ( <> {bgImageOverlayHoverEnable && ( <> setAttributes({ bgImageOverlayColor: { ...bgImageOverlayColor, hoverColor: newColor, }, }) } defaultColor="#fff" /> )} )} {boxShadowHoverEnable && ( )} )} ); }; export const IconImageGeneralTab = ({ attributes, setAttributes }) => { const { iconEnable, iconSource, svgIconName, iconName, iconSize, iconSourceCustom, iconCustomWidth, iconCustomHeight, iconPosition, smartListsLayout, iconAlignment, } = attributes; const iconAlignmentItems = iconPosition === "top" ? [ { label: , value: "start" }, { label: , value: "center" }, { label: , value: "end" }, ] : [ { label: , value: "start" }, { label: , value: "center" }, { label: , value: "end" }, ]; return ( <> {iconEnable && ( <> {["iconSet", "library"].includes(iconSource) && ( <> {"iconSet" === iconSource && ( <> )} {"library" === iconSource && ( )} )} {iconSource === "custom" && ( <> )} {smartListsLayout !== "layout-five" && ( )} )} ); }; export const IconImageStyleTab = ({ attributes, setAttributes }) => { const { iconEnable, iconBackgroundEnable, backgroundShape, iconColor, iconBg, iconBgRadialShape, iconBgRadialPosition, iconBorderStyle, iconBorderStyleWidth, iconBorderRadius, iconBgHoverRadialShape, iconBgHoverRadialPosition, iconHoverBorderStyle, iconHoverBorderStyleWidth, iconHoverBorderRadius, iconPadding, } = attributes; const [iconStyleState, setIconStyleState] = useState("color"); return ( <> {iconEnable && ( <> {iconBackgroundEnable && ( <>
{__("Choose Background Shape", "post-carousel")}
, value: "backgroundShapeSquare", }, { label: , value: "backgroundShapeCircle", }, { label: , value: "backgroundShapeHexagon", }, { label: , value: "backgroundShapeDiamond", }, { label: , value: "backgroundShapeStarburst", }, ]} onClick={(val) => setAttributes({ backgroundShape: val })} /> )} setIconStyleState(val)} /> {iconStyleState === "color" && ( <> setAttributes({ iconColor: { ...iconColor, color: newColor, }, }) } defaultColor="#757575" /> {iconBackgroundEnable && ( <> {iconBg[iconStyleState]?.style === "gradient" && ( <> {/^radial-gradient/.test(iconBg[iconStyleState]?.gradient) && ( <> )} )} )} )} {iconStyleState === "hover" && ( <> setAttributes({ iconColor: { ...iconColor, hoverColor: newColor, }, }) } defaultColor="#757575" /> {iconBackgroundEnable && ( <> {iconBg[iconStyleState]?.style === "gradient" && ( <> {/^radial-gradient/.test(iconBg[iconStyleState]?.gradient) && ( <> )} )} )} {iconBackgroundEnable && backgroundShape === "backgroundShapeSquare" && ( )} )} )} ); }; export const ContentGeneralTab = ({ attributes, setAttributes }) => { const { listTitleEnable, descriptionEnable, titleDescriptionGap, contentAlignment } = attributes; return ( <> {listTitleEnable && descriptionEnable && ( <> )} , value: "left" }, { label: , value: "center" }, { label: , value: "right" }, ]} /> ); }; export const ContentStyleTab = ({ attributes, setAttributes }) => { const { titleTypography, titleFontSize, titleLatterSpacing, titleLineHeight, titleWordSpacing, descriptionEnable, descriptionTypography, descriptionFontSize, descriptionLatterSpacing, descriptionLineHeight, descriptionWordSpacing, titleColor, descriptionColor, } = attributes; const [contentStyleType, setContentStyleType] = useState("color"); return ( <> {descriptionEnable && ( )} setContentStyleType(val)} /> {contentStyleType === "color" && ( <> setAttributes({ titleColor: { ...titleColor, color: newColor, }, }) } defaultColor="#2F2F2F" /> {descriptionEnable && ( setAttributes({ descriptionColor: { ...descriptionColor, color: newColor, }, }) } defaultColor="#757575" /> )} )} {contentStyleType === "hover" && ( <> setAttributes({ titleColor: { ...titleColor, hoverColor: newColor, }, }) } defaultColor="#2F2F2F" /> {descriptionEnable && ( setAttributes({ descriptionColor: { ...descriptionColor, hoverColor: newColor, }, }) } defaultColor="#757575" /> )} )} ); };