+ { __( 'These blocks can be enabled in the Stackable settings page. Do you want to keep the disabled blocks or substitute them with other Stackable or core blocks?', i18n ) }
+
+
+
+
+
+
+
+
+
+ }
)
}
diff --git a/src/block/icon-list/substitute.js b/src/block/icon-list/substitute.js
index ac1c1da6c1..ae4eecb46e 100644
--- a/src/block/icon-list/substitute.js
+++ b/src/block/icon-list/substitute.js
@@ -1,14 +1,16 @@
export const substitute = {
from: 'stackable/icon-list',
- transform: () => {
+ transform: ( oldAttributes, innerBlocks ) => {
+ const newInnerBlocks = innerBlocks.reduce( ( newInnerBlocks, innerBlock ) => {
+ const attributes = innerBlock[ 1 ]
+
+ newInnerBlocks.push( [ 'core/list-item', { content: attributes.text } ] )
+ return newInnerBlocks
+ }, [] )
return [
'core/list',
{},
- [
- [ 'core/list-item', { content: 'First item list' } ],
- [ 'core/list-item', { content: 'Second item list' } ],
- [ 'core/list-item', { content: 'Third item list' } ],
- ],
+ newInnerBlocks,
]
},
}
diff --git a/src/compatibility/tove/style.scss b/src/compatibility/tove/style.scss
new file mode 100644
index 0000000000..d625512032
--- /dev/null
+++ b/src/compatibility/tove/style.scss
@@ -0,0 +1,4 @@
+:where(.stk-has-block-style-inheritance.stk--is-tove-theme) :is(.stk-block-button, .stk-block-icon-button, .stk-block-pagination):is(.is-style-plain) .stk-button {
+ border-width: 0;
+ box-shadow: none;
+}
diff --git a/src/components/color-scheme-preview/editor.scss b/src/components/color-scheme-preview/editor.scss
index 3960c92a55..6f7347181d 100644
--- a/src/components/color-scheme-preview/editor.scss
+++ b/src/components/color-scheme-preview/editor.scss
@@ -76,3 +76,15 @@
.stk-scheme--is-disabled {
opacity: 0.1;
}
+
+.stk-scheme--is-collapsed {
+ flex-direction: row;
+ gap: 4px;
+ align-items: center;
+ max-height: 30px;
+
+ .stk-global-color-scheme__preview__typography {
+ margin-bottom: 0;
+ font-size: 12px;
+ }
+}
diff --git a/src/components/color-scheme-preview/index.js b/src/components/color-scheme-preview/index.js
index 2389b92799..3dcff64a4b 100644
--- a/src/components/color-scheme-preview/index.js
+++ b/src/components/color-scheme-preview/index.js
@@ -14,13 +14,18 @@ export const DEFAULT_COLOR_SCHEME_COLORS = {
const NOOP = () => {}
const ColorSchemePreview = ( {
- colors, withWrapper = false, onClick = NOOP, isDisabled = false,
+ colors,
+ withWrapper = false,
+ onClick = NOOP,
+ isDisabled = false,
+ isCollapsed = false,
} ) => {
const TagName = onClick === NOOP ? 'div' : Button
const additionalProps = onClick === NOOP ? {} : { onClick }
const classNames = classnames( 'stk-global-color-scheme__preview__background', {
'stk-scheme--is-disabled': isDisabled,
+ 'stk-scheme--is-collapsed': isCollapsed,
} )
return (
diff --git a/src/components/color-schemes-help/index.js b/src/components/color-schemes-help/index.js
index caeef807a1..8401d9fb9f 100644
--- a/src/components/color-schemes-help/index.js
+++ b/src/components/color-schemes-help/index.js
@@ -4,8 +4,20 @@ import { Link } from '~stackable/components'
import { __ } from '@wordpress/i18n'
import { dispatch } from '@wordpress/data'
-export const ColorSchemesHelp = () => {
+export const ColorSchemesHelp = props => {
+ const {
+ customText, callback, className,
+ } = props
const onClick = () => {
+ let cancelOnClick = false
+ if ( callback ) {
+ cancelOnClick = callback()
+ }
+
+ if ( cancelOnClick ) {
+ return
+ }
+
// Open the global settings sidebar.
dispatch( 'core/edit-post' )?.openGeneralSidebar( 'stackable-global-settings/sidebar' ) // For Block Editor
dispatch( 'core/edit-site' )?.openGeneralSidebar( 'stackable-global-settings/sidebar' ) // For Site Editor
@@ -31,9 +43,10 @@ export const ColorSchemesHelp = () => {
}
return <>
- { __( 'Change the color scheme.', i18n ) }
-
- { __( 'Manage your color schemes.', i18n ) }
+ { customText || customText === '' ? customText
+ : { __( 'Change the color scheme.', i18n ) } }
+ { customText !== '' && <> > }
+ { __( 'Manage your color schemes.', i18n ) }
>
}
diff --git a/src/components/design-library-list/default.json b/src/components/design-library-list/default.json
new file mode 100644
index 0000000000..10acad68b6
--- /dev/null
+++ b/src/components/design-library-list/default.json
@@ -0,0 +1,502 @@
+{
+ "Call to Action": {
+ "heading_placeholder": "Transform Your Business Today",
+ "description_placeholder": "Unlock your full potential with our cutting-edge solutions. We empower businesses of all sizes to achieve their goals through innovative technology and unparalleled support.",
+ "kicker_placeholder": "Seize the Opportunity",
+ "btn-1_placeholder": "Get Started Now",
+ "btn-2_placeholder": "Learn More",
+ "item-1_placeholder": "Streamline your operations and boost efficiency.",
+ "item-2_placeholder": "Gain actionable insights with advanced analytics."
+ },
+ "Card": {
+ "heading_placeholder": "Unlock Your Full Potential",
+ "long-description_placeholder": "At XYZ Company, we partner for your growth. Our solutions leverage cutting-edge technology, provide expert guidance, and ensure seamless integration for measurable results. We empower you with the tools and support to confidently navigate challenges, building your success on innovation and reliability.",
+ "description_placeholder": "Discover how our comprehensive solutions empower your journey.",
+ "subtitle_placeholder": "Your Path to Innovation and Growth",
+ "title_placeholder": "Solutions Designed to Propel You Forward",
+ "c-btn_placeholder": "Learn More",
+ "c-title-1_placeholder": "Innovative Solutions",
+ "c-subtitle-1_placeholder": "Cutting-Edge Technology",
+ "c-description-1_placeholder": "Discover how our advanced solutions can revolutionize your approach, providing efficiency and unprecedented growth.",
+ "c-title-2_placeholder": "Expert Guidance",
+ "c-subtitle-2_placeholder": "Personalized Support",
+ "c-description-2_placeholder": "Benefit from our team's extensive knowledge and receive tailored advice to meet your unique challenges.",
+ "c-title-3_placeholder": "Seamless Integration",
+ "c-subtitle-3_placeholder": "Effortless Setup",
+ "c-description-3_placeholder": "Our products are designed for easy integration, ensuring a smooth transition and immediate productivity.",
+ "c-title-4_placeholder": "Measurable Results",
+ "c-subtitle-4_placeholder": "Data-Driven Outcomes",
+ "c-description-4_placeholder": "Track your progress with comprehensive analytics and see the tangible impact of our services on your goals.",
+ "c-title-5_placeholder": "Community & Support",
+ "c-subtitle-5_placeholder": "Connect and Collaborate",
+ "c-description-5_placeholder": "Join a thriving community of users and access dedicated support to help you every step of the way.",
+ "c-title-6_placeholder": "Future-Proof Design",
+ "c-subtitle-6_placeholder": "Scalable and Adaptable",
+ "c-description-6_placeholder": "Invest in solutions built for tomorrow, with the flexibility to grow and evolve with your needs."
+ },
+ "Carousel": {
+ "subheading_placeholder": "Learn and Grow",
+ "heading_placeholder": "Explore Our Featured Resources",
+ "description_placeholder": "Get inspired, sharpen your skills, and stay ahead with curated content from our team and industry experts.",
+ "kicker_placeholder": "Learn and Grow",
+ "btn_placeholder": "View All Resources",
+ "title-1_placeholder": "The Beginner's Guide to UX Design",
+ "text-1_placeholder": "A friendly introduction to core UX principles and design thinking.",
+ "title-2_placeholder": "Scaling Your App Without the Stress",
+ "text-2_placeholder": "Best practices for growing your platform while keeping performance sharp.",
+ "title-3_placeholder": "Building a Brand That Connects",
+ "text-3_placeholder": "Learn how to craft a brand identity that resonates with real people.",
+ "title-4_placeholder": "Marketing Trends You Can't Ignore",
+ "text-4_placeholder": "Stay updated with actionable insights from today's digital landscape."
+ },
+ "Contact": {
+ "heading_placeholder": "Get in Touch With Us",
+ "kicker_placeholder": "Contact Us",
+ "description_placeholder": "Whether you have questions, need support, or want to explore opportunities—our team is just a message away.",
+ "btn_placeholder": "Learn More",
+ "title-1_placeholder": "Job Opportunities",
+ "text-1_placeholder": "Join our growing team and help us build the future—one line of code at a time.",
+ "title-2_placeholder": "Support",
+ "text-2_placeholder": "Reach out to our friendly support team for quick assistance with any technical or service-related concerns.",
+ "title-3_placeholder": "Sales",
+ "text-3_placeholder": "Discuss your goals with our sales team and discover how our solutions can meet your business needs.",
+ "cta_placeholder": "Contact Us"
+ },
+ "FAQ": {
+ "heading_placeholder": "Frequently Asked Questions (FAQs)",
+ "description_placeholder": "Find answers to the most common questions about [Your Product/Service]. If you can't find what you're looking for here, please contact us.",
+ "kicker_placeholder": "Quick Answers to Your Top Questions",
+
+ "question-1_placeholder": "What features does your service offer?",
+ "answer-1_placeholder": "Our service offers a comprehensive set of features designed to help you manage your tasks. Key features include Feature A, Feature B, and Feature C. You can find a full list and details on our Features Page.",
+
+ "question-2_placeholder": "Is our Service integrated with other products?",
+ "answer-2_placeholder": "Yes, our Service offers integrations with various popular products and services to streamline your workflow. We currently integrate with Product A, Product B, and Product C. You can find more information about our current integrations and how to set them up on our [Integrations Page Link]. We are continuously working on adding more integrations.",
+
+ "question-3_placeholder": "What are the pricing options involved?",
+ "answer-3_placeholder": "We offer several pricing options to suit different needs. You can view a detailed breakdown of our plans and features on our Pricing Page. We have a free tier, monthly subscriptions, and annual plans.",
+
+ "question-4_placeholder": "What payment methods do you accept?",
+ "answer-4_placeholder": "We accept various convenient payment methods, including major credit cards (Visa, MasterCard, American Express), and in some cases, bank transfers. You can select your preferred payment method during the checkout or subscription process.",
+
+ "question-5_placeholder": "What is your cancellation/refund policy?",
+ "answer-5_placeholder": "Our cancellation policy allows you to cancel your subscription at any time through your account settings. Regarding refunds, our policy is we offer a 30-day money-back guarantee. Please refer to our Terms of Service Page for complete details.",
+
+ "question-6_placeholder": "What are your hours of operation?",
+ "answer-6_placeholder": "Our standard hours of operation are Monday to Friday, 9:00 AM to 5:00 PM in Pacific Standard Time (PST).",
+
+ "question-7_placeholder": "How can I contact customer support?",
+ "answer-7_placeholder": "You can contact our customer support team through several channels: Submit a request via our Support Contact Form. Email us directly at support@email.com. Use our live chat feature available on our website during business hours. Our support hours are Monday-Friday, 9 AM - 5 PM Pacific Standard Time (PST).",
+
+ "question-8_placeholder": "How can I provide feedback?",
+ "answer-8_placeholder": "We highly value your feedback as it helps us improve. You can provide feedback through several methods: Use the feedback form on our website, or email your suggestions or comments to feedback@email.com. You can also participate in surveys. We review all feedback submitted."
+ },
+ "Featured Product": {
+ "kicker_placeholder": "Discover Innovation",
+ "product-name-1_placeholder": "Smart Lamp",
+ "product-description-1_placeholder": "An intelligent lamp that adapts to your mood and environment with customizable ambiance and smart home integration.",
+ "feature-1_placeholder": "Adaptive Lighting",
+ "feature-description-1_placeholder": "Adjusts brightness and color automatically.",
+ "feature-2_placeholder": "Voice Control",
+ "feature-description-2_placeholder": "Hands-free operation with smart assistants.",
+ "feature-3_placeholder": "Personalized Scenes",
+ "feature-description-3_placeholder": "Create and save custom lighting presets.",
+ "feature-4_placeholder": "Energy Efficient",
+ "feature-description-4_placeholder": "Low power consumption with LED technology.",
+ "feature-5_placeholder": "Sleek Design",
+ "feature-description-5_placeholder": "Modern aesthetic to complement any decor.",
+ "feature-6_placeholder": "Smart Connectivity",
+ "feature-description-6_placeholder": "Connects to Wi-Fi for remote control.",
+ "product-name-2_placeholder": "Ergonomic Chair",
+ "product-description-2_placeholder": "A chair designed for ultimate comfort and posture support, enhancing productivity.",
+ "product-name-3_placeholder": "Portable Projector",
+ "product-description-3_placeholder": "A compact and powerful projector for cinematic quality anywhere.",
+ "btn-1_placeholder": "Buy now",
+ "btn-2_placeholder": "Add to Favorites"
+ },
+ "Footer": {
+ "heading_placeholder": "Contact us",
+ "kicker_placeholder": "Stay connected",
+ "company-description_placeholder": "InnovateCo creates cutting-edge solutions for modern living.",
+ "company_placeholder": "InnovateCo",
+ "tagline_placeholder": "Innovation for a Better Tomorrow",
+ "cta_placeholder": "Join our Community",
+ "cta-btn_placeholder": "Sign up now",
+ "btn-1_placeholder": "Subscribe",
+ "btn-2_placeholder": "Watch Demo",
+ "menu-1_placeholder": "Main",
+ "menu-2_placeholder": "About",
+ "link-1_placeholder": "Our Story",
+ "link-2_placeholder": "Team",
+ "link-3_placeholder": "Careers",
+ "menu-3_placeholder": "Products",
+ "link-4_placeholder": "Shop All",
+ "link-5_placeholder": "Bestsellers",
+ "link-6_placeholder": "New Releases",
+ "menu-4_placeholder": "Blog",
+ "link-7_placeholder": "Latest Articles",
+ "link-8_placeholder": "Categories",
+ "link-9_placeholder": "Archives",
+ "menu-5_placeholder": "Support",
+ "link-10_placeholder": "FAQs",
+ "link-11_placeholder": "Contact Us",
+ "link-12_placeholder": "Shipping & Returns"
+ },
+ "Gallery": {
+ "heading_placeholder": "Nature's Grand Canvas",
+ "description_placeholder": "Explore breathtaking landscapes and the serene beauty of our planet. Each image unveils a unique story from the heart of nature.",
+ "kicker_placeholder": "Earth's Masterpieces",
+ "btn_placeholder": "Explore More",
+ "img-subtitle-1_placeholder": "Dolomite Majesty",
+ "img-title-1_placeholder": "Peaks of Tre Cime di Lavaredo",
+ "img-description-1_placeholder": "Towering rock formations of the Dolomites, including the formidable Tre Cime di Lavaredo, emerge through a misty sky, showcasing raw geological power.",
+
+ "img-subtitle-2_placeholder": "Alpine Valleys",
+ "img-title-2_placeholder": "South Tyrol's Autumn Embrace",
+ "img-description-2_placeholder": "A tranquil scene in South Tyrol, Italy, where golden larch trees dot verdant hillsides, backed by snow-dusted mountains under a soft light.",
+
+ "img-subtitle-3_placeholder": "Winter Wonderland",
+ "img-title-3_placeholder": "Phelps Lake Winter Reflection",
+ "img-description-3_placeholder": "A serene winter landscape featuring Phelps Lake, perfectly mirroring snow-covered mountains and frost-dusted pine trees under a clear, crisp sky.",
+
+ "img-subtitle-4_placeholder": "Twilight Glow",
+ "img-title-4_placeholder": "Valley Lights at Dusk",
+ "img-description-4_placeholder": "As twilight settles, a valley below glows with the golden lights of a town, nestled against dark, silhouetted mountains under a streaked sky.",
+
+ "img-subtitle-5_placeholder": "Ethereal Forest",
+ "img-title-5_placeholder": "Misty Woodland Pathways",
+ "img-description-5_placeholder": "A hauntingly beautiful forest shrouded in mist, where tall, bare trees stand solemnly above a carpet of rust-colored ferns, creating a sense of deep mystery.",
+
+ "img-subtitle-6_placeholder": "Autumn Slopes",
+ "img-title-6_placeholder": "Golden Larches of the Alps",
+ "img-description-6_placeholder": "A stunning view across a mountain valley where vibrant golden larch trees cascade down slopes, contrasting with darker evergreens and distant peaks.",
+ "img-subtitle-7_placeholder": "Dolomite Grandeur",
+ "img-title-7_placeholder": "Pale di San Martino's Fiery Peaks",
+ "img-description-7_placeholder": "The dramatic, sun-kissed peaks of the Pale di San Martino in the Dolomites catch the warm light, revealing their rugged textures and imposing scale.",
+ "img-subtitle-8_placeholder": "Reflective Waters",
+ "img-title-8_placeholder": "Lago di Limides Mirror",
+ "img-description-8_placeholder": "The still, clear waters of Lago di Limides flawlessly reflect the cloudy sky and distant, mist-shrouded Dolomites, framed by pine trees along the shore."
+ },
+ "Header": {
+ "company_placeholder": "InnovateCo",
+ "link-1_placeholder": "About",
+ "link-2_placeholder": "Products",
+ "link-3_placeholder": "Blog",
+ "link-4_placeholder": "Support",
+ "btn_placeholder": "Login"
+ },
+ "Hero": {
+ "heading_placeholder": "Elevate Your Digital Future",
+ "long-description_placeholder": "At XYZ Company, we don't just build products; we forge partnerships. Our dedicated team works tirelessly to understand your unique challenges, crafting tailored strategies for sustainable growth. From concept to execution, we ensure a seamless and transformative experience.",
+ "description_placeholder": "Driving global business growth through innovative solutions and unparalleled expertise.",
+ "kicker_placeholder": "Future-Ready Solutions",
+ "btn-1_placeholder": "Get Started Today",
+ "btn-2_placeholder": "Learn More",
+ "item-1_placeholder": "Scalable Solutions",
+ "item-2_placeholder": "Expert Guidance",
+ "item-3_placeholder": "Proven Impact",
+ "metric-1_placeholder": "10M",
+ "metric-label-1_placeholder": "Users Engaged",
+ "metric-2_placeholder": "250",
+ "metric-label-2_placeholder": "Solutions",
+ "metric-3_placeholder": "20",
+ "metric-label-3_placeholder": "Years of Expertise"
+ },
+ "List": {
+ "heading_placeholder": "Solutions for Your Growth",
+ "long-description_placeholder": "We offer tailored solutions designed to meet your unique needs, from initial consultation to ongoing support. Our team of experts is dedicated to delivering high-quality results and ensuring your satisfaction.",
+ "description_placeholder": "Here's a glimpse into the comprehensive services we provide to help you succeed. ",
+ "kicker_placeholder": "Our Offerings",
+ "btn_placeholder": "Learn More",
+ "group-title-1_placeholder": "Core Services",
+ "group-title-2_placeholder": "Specialized Solutions",
+ "title-1_placeholder": "Strategic Planning",
+ "item-1_placeholder": "Develop a clear roadmap for your business with our expert strategic planning services.",
+ "title-2_placeholder": "Market Research",
+ "item-2_placeholder": "Gain valuable insights into your target audience and industry trends through our in-depth market research.",
+ "title-3_placeholder": "Brand Development",
+ "item-3_placeholder": "Build a strong and recognizable brand identity that resonates with your customers.",
+ "title-4_placeholder": "Digital Marketing",
+ "item-4_placeholder": "Expand your online reach and engage with your audience through our comprehensive digital marketing strategies.",
+ "title-5_placeholder": "Financial Consulting",
+ "item-5_placeholder": "Optimize your financial performance and make informed decisions with our expert financial guidance.",
+ "title-6_placeholder": "Operational Efficiency",
+ "item-6_placeholder": "Streamline your processes and boost productivity with our operational efficiency consulting."
+ },
+ "Logo Farm": {
+ "heading_placeholder": "Trusted by Industry Leaders",
+ "description_placeholder": "We're proud to collaborate with a diverse range of companies that trust us to deliver exceptional results. Our partnerships are built on mutual success and shared innovation, driving progress across various sectors.",
+ "kicker_placeholder": "Our Valued Partners",
+ "btn_placeholder": "Learn More"
+ },
+ "Maps": {
+ "heading_placeholder": "Find us",
+ "description_placeholder": "Our main office is conveniently located and easily accessible for all your inquiries.",
+ "location-1_placeholder": "Main Office",
+ "location-2_placeholder": "Downtown Location",
+ "location-3_placeholder": "Headquarters Annex",
+ "location-4_placeholder": "Northside Hub"
+ },
+ "Media and Text": {
+ "long-subheading_placeholder": "Revolutionizing how we interact with the world.",
+ "heading_placeholder": "Future of Connectivity",
+ "long-description_placeholder": "Discover seamless integration and enhanced experiences designed to elevate your daily life. Our innovations transcend traditional boundaries, creating a more interconnected and intuitive world for everyone.",
+ "description_placeholder": "Explore groundbreaking advancements that are shaping tomorrow's digital landscape.",
+ "kicker_placeholder": "Tech Spotlight",
+ "btn_placeholder": "Learn More",
+ "title-1_placeholder": "Seamless Integration",
+ "text-1_placeholder": "Experience unparalleled ease as our technology effortlessly blends into your existing systems, enhancing productivity without disruption.",
+ "title-2_placeholder": "Intuitive Design",
+ "text-2_placeholder": "Crafted with the user in mind, our interfaces are simple, elegant, and exceptionally easy to navigate, ensuring a smooth experience for everyone.",
+ "title-3_placeholder": "Robust Security",
+ "text-3_placeholder": "Your data's safety is our top priority. Benefit from multi-layered security protocols and advanced encryption that keep your information protected around the clock.",
+ "title-4_placeholder": "Scalable Solutions",
+ "text-4_placeholder": "Whether you're a small startup or a large enterprise, our flexible solutions are designed to grow with your needs, adapting to future demands seamlessly.",
+ "title-5_placeholder": "Global Reach",
+ "text-5_placeholder": "Connect with confidence. Our services extend worldwide, providing reliable and high-performance access no matter where you are.",
+ "title-6_placeholder": "Dedicated Support",
+ "text-6_placeholder": "Our expert team is always ready to assist you. Enjoy comprehensive support and resources designed to ensure your success."
+ },
+ "Post Loop": {
+ "heading_placeholder": "Our Latest Insights",
+ "post-btn_placeholder": "Read more",
+ "btn_placeholder": "View all",
+ "tag_placeholder": "Editor's Picks",
+ "posts_placeholder": [
+ {
+ "title_placeholder": "Future of AI in Everyday Life",
+ "text_placeholder": "Explore how AI is transforming daily routines and what's next."
+ },
+ {
+ "title_placeholder": "Sustainable Living",
+ "text_placeholder": "Discover easy ways to adopt eco-friendly habits."
+ },
+ {
+ "title_placeholder": "Mastering Remote Work: Tips for Productivity",
+ "text_placeholder": "Boost your efficiency with these essential remote work strategies."
+ },
+ {
+ "title_placeholder": "Rise of Wearable Technology",
+ "text_placeholder": "Learn about the latest advancements in wearable devices."
+ },
+ {
+ "title_placeholder": "Cybersecurity Essentials",
+ "text_placeholder": "Protect your digital life with these crucial security tips."
+ },
+ {
+ "title_placeholder": "Mindful Photography",
+ "text_placeholder": "Enhance your photography skills through a mindful approach."
+ },
+ {
+ "title_placeholder": "Storytelling in Brand Building",
+ "text_placeholder": "Learn how compelling narratives can elevate your brand."
+ }
+ ]
+ },
+ "Pricing Table": {
+ "heading_placeholder": "Our Pricing Plans",
+ "description_placeholder": "Choose the perfect plan to fit your needs, from individuals to large organizations. All plans include dedicated support and a commitment to your success.",
+ "btn-1_placeholder": "Get Started",
+ "btn-2_placeholder": "Buy Now",
+ "tag_placeholder": "Best Value",
+ "title-1_placeholder": "Flexible Scaling",
+ "text-1_placeholder": "Easily upgrade or downgrade as your needs evolve.",
+ "title-2_placeholder": "24/7 Customer Support",
+ "text-2_placeholder": "Our team is always ready to assist you.",
+ "title-3_placeholder": "Secure and Reliable Platform",
+ "text-3_placeholder": "We prioritize your data's security and stability.",
+ "title-4_placeholder": "Regular Feature Updates",
+ "text-4_placeholder": "Benefit from continuous improvements and new functionalities.",
+ "plan-1_placeholder": "Free",
+ "plan-description-1_placeholder": "Perfect for individuals.",
+ "plan-1-item-1_placeholder": "Limited Storage (e.g., 500MB)",
+ "plan-1-item-2_placeholder": "Basic Analytics",
+ "plan-1-item-3_placeholder": "Email Support",
+ "plan-1-item-4_placeholder": "1 User Account",
+ "plan-2_placeholder": "Basic",
+ "plan-description-2_placeholder": "Ideal for small teams.",
+ "plan-2-item-1_placeholder": "2GB Storage",
+ "plan-2-item-2_placeholder": "Standard Analytics",
+ "plan-2-item-3_placeholder": "Priority Email Support",
+ "plan-2-item-4_placeholder": "Up to 3 User Accounts",
+ "plan-3_placeholder": "Pro",
+ "plan-description-3_placeholder": "Great for growing businesses.",
+ "plan-3-item-1_placeholder": "10GB Storage",
+ "plan-3-item-2_placeholder": "Advanced Analytics",
+ "plan-3-item-3_placeholder": "Chat & Phone Support",
+ "plan-3-item-4_placeholder": "Up to 10 User Accounts",
+ "plan-4_placeholder": "Premium",
+ "plan-description-4_placeholder": "Designed for established businesses.",
+ "plan-4-item-1_placeholder": "Unlimited Storage",
+ "plan-4-item-2_placeholder": "Real-time Advanced Analytics",
+ "plan-4-item-3_placeholder": "Dedicated Account Manager",
+ "plan-4-item-4_placeholder": "Unlimited User Accounts",
+ "plan-5_placeholder": "Enterprise",
+ "plan-description-5_placeholder": "Tailored for large organizations with unique demands.",
+ "plan-5-details_placeholder": "For customized solutions including specialized features, dedicated infrastructure, and personalized support, please contact us to discuss an Enterprise plan."
+ },
+ "Quote": {
+ "text-1_placeholder": "The journey of a thousand miles begins with a single step.",
+ "name-1_placeholder": "A. B. Johnson",
+ "position-1_placeholder": "Thought Leader",
+ "text-2_placeholder": "Innovation distinguishes between a leader and a follower.",
+ "name-2_placeholder": "C. D. Williams",
+ "position-2_placeholder": "Forward Thinker"
+ },
+ "Service Menu": {
+ "heading_placeholder": "Our Signature Menu",
+ "description_placeholder": "Crafted with fresh ingredients and bold flavors—perfect for any time of day.",
+ "category-1_placeholder": "Customer Favorites",
+ "category-2_placeholder": "Brunch & Bowls",
+ "category-3_placeholder": "Add-ons & Sides",
+ "title-1_placeholder": "Grilled Herb Chicken",
+ "text-1_placeholder": "Tender chicken breast marinated in herbs, served with charred vegetables.",
+ "title-2_placeholder": "Smoked Salmon Bowl",
+ "text-2_placeholder": "Cured salmon, quinoa, avocado, and lemon-dill dressing in one refreshing bowl.",
+ "title-3_placeholder": "Creamy Mushroom Pasta",
+ "text-3_placeholder": "Fresh pasta tossed in a garlic parmesan cream with sautéed mushrooms.",
+ "title-4_placeholder": "Avocado Toast Stack",
+ "text-4_placeholder": "Crispy sourdough topped with smashed avocado, egg, and house seasoning.",
+ "title-5_placeholder": "Spiced Beef Rice Bowl",
+ "text-5_placeholder": "Slow-braised beef, jasmine rice, and tangy slaw with a touch of heat.",
+ "title-6_placeholder": "Breakfast Burrito",
+ "text-6_placeholder": "Fluffy eggs, chorizo, potatoes, and cheese wrapped in a warm tortilla."
+ },
+ "Stats": {
+ "heading_placeholder": "Trusted by Teams, Loved by Customers",
+ "description_placeholder": "Our impact speaks for itself—from satisfied clients to successful projects delivered across industries.",
+ "kicker_placeholder": "By the Numbers",
+ "btn_placeholder": "See Our Impact",
+ "stat-title-1_placeholder": "Active Users",
+ "stat-title-2_placeholder": "Installs",
+ "stat-title-3_placeholder": "Websites",
+ "stat-title-4_placeholder": "New Users"
+ },
+ "Table of Contents": {
+ "heading_placeholder": "Table of Contents",
+ "subtitle-1_placeholder": "Setting Up Your Account",
+ "subtitle-2_placeholder": "Navigating the Interface",
+ "subtitle-3_placeholder": "Personalizing Your Profile",
+ "subtitle-4_placeholder": "Discovering New Tools",
+ "subtitle-5_placeholder": "Customizing Your Workspace",
+ "subtitle-6_placeholder": "Collaborating with Others",
+ "subtitle-7_placeholder": "Maximizing Productivity",
+ "subtitle-8_placeholder": "Saving Time with Shortcuts",
+ "title-1_placeholder": "Getting Started",
+ "title-2_placeholder": "Exploring Features",
+ "title-3_placeholder": "Tips and Tricks",
+ "title-4_placeholder": "Our Community",
+ "title-5_placeholder": "Frequently Asked Questions",
+ "title-6_placeholder": "Glossary of Terms"
+ },
+ "Tabs": {
+ "tab-1_placeholder": "All",
+ "tab-2_placeholder": "News",
+ "tab-3_placeholder": "Trending",
+ "tab-4_placeholder": "For You",
+ "tab-5_placeholder": "Favorites",
+ "title-1_placeholder": "Our Vision for the Future",
+ "text-1_placeholder": "We envision a world where innovation drives progress, and technology empowers individuals. Our commitment lies in fostering solutions that are not only groundbreaking but also accessible and sustainable, contributing to a brighter tomorrow for everyone.",
+ "title-2_placeholder": "Unlocking Your Potential",
+ "text-2_placeholder": "Discover the tools and resources designed to help you achieve your goals. We believe in providing comprehensive support and personalized guidance, enabling you to navigate challenges and seize opportunities with confidence."
+ },
+ "Team Members": {
+ "heading_placeholder": "Meet Our Team",
+ "description_placeholder": "We're a passionate group dedicated to innovation and excellence. Get to know the individuals who drive our success.",
+ "name-1_placeholder": "Eleanor Vance",
+ "position-1_placeholder": "CEO",
+ "text-1_placeholder": "leads our vision and strategy, guiding the company toward new horizons",
+ "name-2_placeholder": "Marcus Thorne",
+ "position-2_placeholder": "Chief Technology Officer",
+ "text-2_placeholder": "oversees all technological advancements and product development",
+ "name-3_placeholder": "Sophia Chen",
+ "position-3_placeholder": "Head of Marketing",
+ "text-3_placeholder": "crafts our brand story and connects us with our audience",
+ "name-4_placeholder": "David Miller",
+ "position-4_placeholder": "Lead Product Designer",
+ "text-4_placeholder": "responsible for the intuitive and user-friendly design of our products",
+ "name-5_placeholder": "Alexander Gray",
+ "position-5_placeholder": "Director of Operations",
+ "text-5_placeholder": "ensures our daily operations run smoothly and efficiently",
+ "name-6_placeholder": "Samuel Green",
+ "position-6_placeholder": "Senior Software Engineer",
+ "text-6_placeholder": " a key architect behind our robust software solutions"
+ },
+ "Text": {
+ "heading_placeholder": "Innovating for a Sustainable Future",
+ "long-subtitle_placeholder": "Pioneering Global Solutions for a Greener Tomorrow's Challenges",
+ "long-description-1_placeholder": "We invest in cutting-edge research to create tangible solutions for environmental challenges, integrating sustainable practices across our operations. Our holistic approach aims for long-term benefits for the planet and its inhabitants. True innovation stems from understanding ecological principles and technological advancement.",
+ "long-description-2_placeholder": "By fostering collaborations globally, we build a robust framework for environmental stewardship. Our efforts empower communities to embrace sustainability and thrive in harmony with nature. This ensures solutions are groundbreaking, scalable, and adaptable.",
+ "description_placeholder": "We are dedicated to creating a sustainable future through innovative solutions and responsible practices.",
+ "kicker_placeholder": "Driving Global Change",
+ "btn_placeholder": "Learn More",
+ "title-1_placeholder": "Renewable Energy",
+ "text-1_placeholder": "Developing advanced solar, wind, and hydro technologies to reduce reliance on fossil fuels.",
+ "title-2_placeholder": "Circular Economy",
+ "text-2_placeholder": "Implementing waste reduction, resource recovery, and product lifecycle optimization strategies.",
+ "title-3_placeholder": "Sustainable Agriculture",
+ "text-3_placeholder": "Promoting eco-friendly farming methods and resilient food systems.",
+ "title-4_placeholder": "Biodiversity Conservation",
+ "text-4_placeholder": "Protecting habitats, supporting endangered species, and promoting ecological balance.",
+ "title-5_placeholder": "Smart Cities",
+ "text-5_placeholder": "Designing urban environments with green spaces and efficient infrastructure.",
+ "title-6_placeholder": "Environmental Education",
+ "text-6_placeholder": "Empowering communities with knowledge to adopt sustainable lifestyles."
+ },
+ "Testimonials": {
+ "heading_placeholder": "What Our Clients Say",
+ "description_placeholder": "Here's a look at what people are saying about working with us. We're proud to have helped so many achieve their goals.",
+ "kicker_placeholder": "Testimonials",
+ "name-1_placeholder": "Emily Johnson",
+ "position-1_placeholder": "Marketing Manager",
+ "text-1_placeholder": "XYZ Company has been a game-changer. Our online engagement and conversions significantly increased, leading to a 30% rise in leads in three months!",
+ "name-2_placeholder": "David Smith",
+ "position-2_placeholder": "Small Business Owner",
+ "text-2_placeholder": "Struggling to grow online, XYZ Company provided the perfect solution. Their tailored approach made a huge difference; my sales have doubled.",
+ "name-3_placeholder": "Sophia Miller",
+ "position-3_placeholder": "E-commerce Specialist",
+ "text-3_placeholder": "XYZ Company transformed our platform. Their expertise boosted traffic and improved satisfaction, consistently giving us higher average order values.",
+ "name-4_placeholder": "William Brown",
+ "position-4_placeholder": "Tech Startup Founder",
+ "text-4_placeholder": "XYZ Company delivered exceptional value. They helped us develop a strong brand and launch our product effectively. We've gained valuable traction.",
+ "name-5_placeholder": "James Wilson",
+ "position-5_placeholder": "Non-profit Director",
+ "text-5_placeholder": "XYZ Company exceeded our expectations. Their dedication significantly increased our donations and volunteer sign-ups by improving our online presence.",
+ "name-6_placeholder": "Olivia Davis",
+ "position-6_placeholder": "Real Estate Broker",
+ "text-6_placeholder": "XYZ Company gave me the edge. Their innovative digital advertising brought consistent, qualified leads, directly leading to more property sales."
+ },
+ "Timeline": {
+ "heading_placeholder": "Our Journey Through Time",
+ "kicker_placeholder": "A Legacy of Progress",
+ "description_placeholder": "Explore the key milestones that have shaped our story, from our humble beginnings to our latest achievements.",
+ "btn_placeholder": "Discover more",
+ "title-1_placeholder": "Founding Vision",
+ "text-1_placeholder": "Our journey began with a bold idea to revolutionize the industry.",
+ "title-2_placeholder": "First Product Launch",
+ "text-2_placeholder": "We introduced our inaugural product to critical acclaim.",
+ "title-3_placeholder": "Global Expansion",
+ "text-3_placeholder": "Our reach extended to new international markets.",
+ "title-4_placeholder": "Innovation Award Received",
+ "text-4_placeholder": "Recognized for our groundbreaking technological advancements.",
+ "title-5_placeholder": "Community Initiative Launched",
+ "text-5_placeholder": "A new program dedicated to giving back to society.",
+ "title-6_placeholder": "Future Forward Summit",
+ "text-6_placeholder": "Hosting an event to discuss the next era of innovation."
+
+ },
+ "Videos": {
+ "heading_placeholder": "Our Story",
+ "kicker_placeholder": "See Us in Action",
+ "description_placeholder" : "Dive deep into the heart of InnovateCo, exploring our origins, values, and the future we're building.",
+ "btn-1_placeholder": "Watch Later",
+ "btn-2_placeholder": "Find Related Videos",
+ "title-1_placeholder": "Our Story",
+ "title-2_placeholder": "Lamp Features",
+ "title-3_placeholder": "Behind the Scenes",
+ "title-4_placeholder": "Customer Success",
+ "title-5_placeholder": "Expert Interview",
+ "title-6_placeholder": "Sustainability Efforts",
+ "title-7_placeholder": "Future Innovations"
+ }
+}
\ No newline at end of file
diff --git a/src/components/design-library-list/design-library-list-item.js b/src/components/design-library-list/design-library-list-item.js
index e079b9ce86..2fa4f179e3 100644
--- a/src/components/design-library-list/design-library-list-item.js
+++ b/src/components/design-library-list/design-library-list-item.js
@@ -2,71 +2,292 @@
* Internal dependencies.
*/
import ProControl from '../pro-control'
+import DEFAULT from './default.json'
+import {
+ addBackgroundScheme, addContainerScheme,
+ addPlaceholderForPostsBlock, cleanParse,
+ getAdditionalStylesForPreview,
+ parseDisabledBlocks,
+} from './util'
/**
* External dependencies.
*/
-import { getDesign } from '~stackable/design-library'
-import { isPro, i18n } from 'stackable'
+import { createRoot } from '~stackable/util'
+import {
+ isPro, i18n, wpGlobalStylesInlineCss,
+} from 'stackable'
import classnames from 'classnames'
+import { Tooltip } from '~stackable/components'
/**
* WordPress dependencies.
*/
-import { useState } from '@wordpress/element'
-import { Spinner } from '@wordpress/components'
+import {
+ forwardRef, useEffect, useRef, useState,
+} from '@wordpress/element'
+import { select, useSelect } from '@wordpress/data'
+import { Dashicon } from '@wordpress/components'
import { __ } from '@wordpress/i18n'
+import { serialize } from '@wordpress/blocks'
+import { applyFilters } from '@wordpress/hooks'
+import { cloneDeep } from 'lodash'
-const DesignLibraryListItem = props => {
+const DEFAULT_CONTENT = { ...DEFAULT }
+
+const DesignLibraryListItem = forwardRef( ( props, ref ) => {
const {
designId,
- image,
label,
onClick,
+ template = '',
+ category = '',
plan,
- isPro,
- apiVersion,
- isMultiSelectMode = false,
selectedNum = false,
+ selectedData = null,
+ containerScheme,
+ backgroundScheme,
+ enableBackground,
+ cardHeight,
+ setCardHeight,
+ previewSize,
+ setPreviewSize,
} = props
- const [ isBusy, setIsBusy ] = useState( false )
- // const [ isFavorite, setIsFavorite ] = useState( props.isFavorite )
+ const [ parsedBlocks, setParsedBlocks ] = useState( null )
+ const [ content, setContent ] = useState( '' )
+
+ const hostRef = useRef( null )
+ const previewRef = useRef( null )
+ const blocksForSubstitutionRef = useRef( false )
+ const hasBackgroundTargetRef = useRef( false )
+ const initialRenderRef = useRef( null )
+
+ const { getEditorDom } = useSelect( 'stackable/editor-dom' )
+ const editorDom = getEditorDom()
+
+ const siteTitle = useSelect( select => select( 'core' ).getEntityRecord( 'root', 'site' )?.title || 'InnovateCo', [] )
const mainClasses = classnames( [
'ugb-design-library-item',
+ 'ugb-design-library-item--toggle',
], {
- 'ugb--is-busy': isBusy,
[ `ugb--is-${ plan }` ]: ! isPro && plan !== 'free',
- 'ugb-design-library-item--toggle': isMultiSelectMode,
- 'ugb--is-toggled': isMultiSelectMode && selectedNum,
+ 'ugb--is-toggled': selectedNum,
} )
+ const STYLE_IDS = applyFilters( 'stackable.global-styles.ids', [
+ 'ugb-dep-native-global-style-css-nodep-inline-css',
+ 'ugb-style-css-css',
+ 'ugb-style-css-responsive-css',
+ 'ugb-block-style-inheritance-nodep-inline-css',
+ 'ugb-style-css-premium-css',
+ ] )
+
+ const adjustScale = () => {
+ if ( ref.current && hostRef.current?.shadowRoot && ! selectedNum ) {
+ const newPreviewSize = { ...previewSize }
+ const newCardHeight = { ...cardHeight }
+ const cardRect = ref.current.getBoundingClientRect()
+
+ const shadowBody = hostRef.current.shadowRoot.querySelector( 'body' )
+ if ( shadowBody ) {
+ const cardWidth = cardRect.width // Get width of the card
+ const scaleFactor = cardWidth > 0 ? cardWidth / shadowBody.offsetWidth : 1 // Divide by 1200, which is the width of preview in the shadow DOM
+ newPreviewSize.scale = scaleFactor
+
+ const _height = parseFloat( shadowBody.offsetHeight ) * scaleFactor // Also adjust the height
+
+ if ( Object.keys( newPreviewSize ).length === 1 ) {
+ newPreviewSize.heightBackground = _height
+ newPreviewSize.heightNoBackground = _height
+ } else {
+ const heightKey = enableBackground ? 'heightBackground' : 'heightNoBackground'
+ newPreviewSize[ heightKey ] = _height
+ }
+
+ setPreviewSize( newPreviewSize )
+ }
+
+ if ( ! Object.keys( newCardHeight ).length ) {
+ newCardHeight.background = cardRect.height
+ newCardHeight.noBackground = cardRect.height
+ } else {
+ const CardHeightKey = enableBackground ? 'background' : 'noBackground'
+ newCardHeight[ CardHeightKey ] = cardRect.height
+ }
+
+ setTimeout( () => setCardHeight( newCardHeight ), 500 )
+ }
+ }
+
+ const renderPreview = ( blockContent = content ) => {
+ let blocks = cloneDeep( selectedData?.designData || blockContent )
+
+ // No need to add the color scheme attribute if the selected scheme is the default
+ if ( containerScheme !== '' && ! selectedNum ) {
+ blocks = addContainerScheme( blocks, containerScheme )
+ }
+
+ // Only add a background scheme if it is enabled
+ if ( enableBackground && ! selectedNum ) {
+ blocks = addBackgroundScheme( blocks, enableBackground, backgroundScheme )
+ }
+
+ setParsedBlocks( blocks )
+
+ let preview = serialize( blocks )
+
+ // The block `wp/site-title` is a dynamic block, so we need to manually replace it for the preview
+ if ( category === 'Header' ) {
+ preview = preview.replace( //g, siteTitle )
+ } else if ( category === 'Tabs' ) {
+ // Add a class for the first tab to be the active tab in the preview
+ preview = preview.replace( '"stk-block-tabs__tab"', '"stk-block-tabs__tab stk-block-tabs__tab--active"' )
+ } else if ( category === 'Post Loop' ) {
+ const defaultValues = DEFAULT_CONTENT[ category ]
+ preview = addPlaceholderForPostsBlock( preview, defaultValues[ 'posts_placeholder' ], defaultValues )
+ }
+
+ const cleanedBlock = preview.replace( //g, '' ) // removes comment
+
+ previewRef.current.render( )
+ }
+
+ // Replace the placeholders with the default content
+ useEffect( () => {
+ const defaultValues = DEFAULT_CONTENT[ category ]
+ let _content = template
+ if ( defaultValues ) {
+ Object.keys( defaultValues ).forEach( key => {
+ _content = _content.replaceAll( key, defaultValues[ key ] )
+ } )
+ }
+
+ if ( _content.includes( 'stk-design-library__bg-target="true"' ) ) {
+ hasBackgroundTargetRef.current = true
+ }
+
+ // We need to parse the content because this is what we use to insert the blocks in the Editor
+ const _block = cleanParse( _content )[ 0 ]
+ const { block, blocksForSubstitution } = parseDisabledBlocks( _block )
+ blocksForSubstitutionRef.current = blocksForSubstitution
+
+ const shadowRoot = hostRef.current.shadowRoot || hostRef.current.attachShadow( { mode: 'open' } )
+
+ // Initialize the shadow DOM for the first time
+ if ( ! previewRef.current ) {
+ // Get all styles needed and make a copy for the shadow DOM
+ const styleNodes = STYLE_IDS.map( id => {
+ let style = null
+ let node = document?.head?.querySelector( `#${ id }` )
+ if ( ! node && editorDom ) {
+ const editorBody = editorDom?.closest( 'body' )
+ const editorHead = editorBody?.ownerDocument?.head
+ node = editorHead.querySelector( `#${ id }` )
+ }
+
+ if ( node ) {
+ style = node.cloneNode( true )
+ }
+
+ return style
+ } ).filter( node => node !== null )
+
+ // Add global and theme styles
+ const globalStylesNode = document.createElement( 'style' )
+ globalStylesNode.setAttribute( 'id', 'global-styles-inline-css' )
+ globalStylesNode.innerHTML = wpGlobalStylesInlineCss
+ styleNodes.push( globalStylesNode )
+
+ const hostStyles = document.createElement( 'style' )
+ hostStyles.setAttribute( 'id', 'stk-design-library-styles' )
+
+ const blockLayouts = select( 'stackable/global-spacing-and-borders' ).getBlockLayouts()
+ hostStyles.innerHTML = ! hasBackgroundTargetRef.current ? 'body > .stk-block-columns { padding: 75px; }' : '[stk-design-library__bg-target="true"] { padding: 50px; }'
+
+ if ( ( Array.isArray( blockLayouts ) && ! blockLayouts.length ) ||
+ ( typeof blockLayouts === 'object' && ! blockLayouts[ 'block-background-padding' ] )
+ ) {
+ hostStyles.innerHTML += ! hasBackgroundTargetRef.current
+ ? ` body > .stk-block-background:not(.stk--no-padding) { padding: calc(75px + var(--stk-block-background-padding)); }`
+ : ` [stk-design-library__bg-target="true"].stk-block-background:not(.stk--no-padding) { padding: calc(26px + var(--stk-block-background-padding)); }`
+ }
+
+ // Additional styles for blocks to render properly in the preview
+ hostStyles.innerHTML += getAdditionalStylesForPreview()
+
+ styleNodes.push( hostStyles )
+
+ styleNodes.forEach( node => {
+ if ( node.textContent ) {
+ // we use :host in the shadow DOM to target the root
+ node.textContent = node.textContent.replace( /:root/g, ':host' )
+ }
+ shadowRoot.appendChild( node )
+ } )
+
+ previewRef.current = createRoot( shadowRoot )
+ }
+
+ renderPreview( block )
+ setContent( block )
+ }, [ template ] )
+
+ useEffect( () => {
+ if ( ! initialRenderRef.current ) {
+ initialRenderRef.current = true
+ return
+ }
+
+ if ( ! content ||
+ ! previewRef.current ||
+ selectedNum
+ ) {
+ return
+ }
+
+ renderPreview()
+ }, [ content, containerScheme, backgroundScheme, enableBackground ] )
+
+ useEffect( () => {
+ if ( selectedNum === 0 && content && previewRef.current ) {
+ renderPreview()
+ adjustScale()
+ }
+ }, [ selectedNum ] )
+
+ const getDesignPreviewSize = () => {
+ return selectedNum && selectedData ? selectedData.selectedPreviewSize.preview
+ : ( enableBackground ? previewSize.heightBackground : previewSize.heightNoBackground )
+ }
+
return (
-