import { __ } from "@wordpress/i18n"; import { useState } from "@wordpress/element"; import { ensureHttps } from "../shared/helpFn"; import { Background, Border, Spacing, Toggle, BoxShadow, SPRangeControl, SelectField, SpColorPicker, TypographyNew, InputControl, MediaPicker, SpSVGIconPicker, } from "../../components"; import SPToggleGroupControl from "../../components/toggleGroupControl/toggleGroupControl"; import { AlignCenter, AlignLeft, AlignRight, AlignTop, AlignMiddle, AlignBottom } from "../../icons/icons"; import { BackgroundShapeCircle, BackgroundShapeSquare, BackgroundShapeHexagon, BackgroundShapeDiamond, BackgroundShapeStarburst, } from "./icons"; import { BgIcon, GradientIcon } from "../../components/background/svgIcon"; import IconsLibrary from "../../components/iconLibrary/iconLibrary"; 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 SmartListGeneralTab = ({ attributes, setAttributes }) => { const { linkURL, openInNewTab, noFollowLink, // listItemWidth } = attributes; const handleLinkURL = (newLink) => { const link = ensureHttps(newLink); setAttributes({ linkURL: link }); }; return ( <> {/* */} ); }; export const SmartListStyleTab = ({ attributes, setAttributes }) => { const { smartListBg, borderStyle, borderStyleWidth, borderRadius, boxShadowEnable, listBoxShadow, borderHoverStyle, borderHoverStyleWidth, borderHoverRadius, boxShadowHoverEnable, boxShadowHover, padding, } = attributes; const [smartListStyleType, setSmartListStyleType] = useState("color"); return ( <> setSmartListStyleType(val)} /> {smartListStyleType === "color" && ( <> , value: "bgColor", tooltip: "Solid", }, { label: , value: "gradient", tooltip: "Gradient", }, ]} /> {boxShadowEnable && ( )} )} {smartListStyleType === "hover" && ( <> , value: "bgColor", tooltip: "Solid", }, { label: , value: "gradient", tooltip: "Gradient", }, ]} // items={ BACKGROUND_ITEMS } /> {boxShadowHoverEnable && ( )} )} ); }; export const IconImageGeneralTab = ({ attributes, setAttributes }) => { const { iconEnable, iconSource, svgIconName, iconName, iconSize, iconSourceCustom, iconCustomWidth, iconCustomHeight, iconPosition, iconEnableParent, parentListsLayout, 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 ?? iconEnableParent) && ( <> {["iconSet", "library"].includes(iconSource) && ( <> {"iconSet" === iconSource && ( <> )} {"library" === iconSource && ( )} )} {iconSource === "custom" && ( <> )} {parentListsLayout !== "layout-five" && ( )} )} ); }; export const IconImageStyleTab = ({ attributes, setAttributes }) => { const { iconEnable, iconEnableParent, iconBackgroundEnable, backgroundShape, iconColor, iconBg, iconBgRadialShape, iconBgRadialPosition, iconBorderStyle, iconBorderStyleWidth, iconBorderRadius, iconBgHoverRadialShape, iconBgHoverRadialPosition, iconHoverBorderStyle, iconHoverBorderStyleWidth, iconHoverBorderRadius, iconPadding, } = attributes; const [iconStyleState, setIconStyleState] = useState("color"); return ( <> {(iconEnable ?? iconEnableParent) && ( <> {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) && ( <> )} )} )} {backgroundShape === "backgroundShapeSquare" && ( )} )} {iconStyleState === "hover" && ( <> setAttributes({ iconColor: { ...iconColor, hoverColor: newColor, }, }) } defaultColor="#757575" /> {iconBackgroundEnable && ( <> {iconBg[iconStyleState]?.style === "gradient" && ( <> {/^radial-gradient/.test(iconBg[iconStyleState]?.gradient) && ( <> )} )} )} {backgroundShape === "backgroundShapeSquare" && ( )} )} )} ); }; export const ContentGeneralTab = ({ attributes, setAttributes }) => { const { listTitleEnable, descriptionEnable, titleDescriptionGap } = attributes; return ( <> {listTitleEnable && descriptionEnable && ( )} ); }; export const ContentStyleTab = ({ attributes, setAttributes }) => { const { titleTypography, titleFontSize, titleLatterSpacing, titleLineHeight, titleWordSpacing, descriptionTypography, descriptionFontSize, descriptionLatterSpacing, descriptionLineHeight, descriptionWordSpacing, titleColor, descriptionColor, descriptionEnable, } = 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" /> )} )} ); }; export const BadgeGeneralTab = ({ attributes, setAttributes }) => { const { badgeEnable, badgeLabel } = attributes; return ( <> {badgeEnable && ( )} ); }; export const BadgeStyleTab = ({ attributes, setAttributes }) => { const { badgeTypography, badgeFontSize, badgeLatterSpacing, badgeLineHeight, badgeWordSpacing, badgeColor, badgeBgColor, badgeBorderStyle, badgeBorderStyleWidth, badgeBorderRadius, badgePadding, badgeMargin, badgeEnable, } = attributes; return ( <> {badgeEnable && ( <> setAttributes({ badgeColor: newColor })} defaultColor="#0255A7" /> setAttributes({ badgeBgColor: newColor })} defaultColor="#DFECFF" /> )} ); };