dune-react 0.0.8 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/puck-base/article-card.js +1 -1
- package/dist/components/puck-base/button.js +2 -1
- package/dist/components/puck-base/container.d.ts +7 -1
- package/dist/components/puck-base/container.js +2 -1
- package/dist/components/puck-base/content.d.ts +1 -4
- package/dist/components/puck-base/content.js +15 -17
- package/dist/components/puck-base/core/fields.d.ts +1 -127
- package/dist/components/puck-base/core/fields.js +1 -76
- package/dist/components/puck-base/core/styles.d.ts +1877 -0
- package/dist/components/puck-base/core/styles.js +286 -0
- package/dist/components/puck-base/core/types.d.ts +2 -2
- package/dist/components/puck-base/core/with-editable.d.ts +4 -1
- package/dist/components/puck-base/core/with-editable.js +51 -27
- package/dist/components/puck-base/editor-context.d.ts +8 -0
- package/dist/components/puck-base/fields/auto-field.d.ts +1 -0
- package/dist/components/puck-base/fields/auto-field.js +131 -49
- package/dist/components/puck-base/gradient-text.js +12 -3
- package/dist/components/puck-block/banner-sections/announcement-banner-1/announcement-banner.d.ts +9 -7
- package/dist/components/puck-block/banner-sections/announcement-banner-1/announcement-banner.js +11 -8
- package/dist/components/puck-block/banner-sections/announcement-banner-1/index.js +19 -37
- package/dist/components/puck-block/banner-sections/marquee-1/index.js +26 -24
- package/dist/components/puck-block/banner-sections/marquee-1/marquee.d.ts +9 -9
- package/dist/components/puck-block/banner-sections/marquee-1/marquee.js +28 -21
- package/dist/components/puck-block/banner-sections/props.d.ts +22 -0
- package/dist/components/puck-block/contact-sections/api/form-leads.d.ts +16 -0
- package/dist/components/puck-block/contact-sections/api/form-leads.js +25 -0
- package/dist/components/puck-block/contact-sections/contact-us-1/contact-us.d.ts +13 -4
- package/dist/components/puck-block/contact-sections/contact-us-1/contact-us.js +122 -121
- package/dist/components/puck-block/contact-sections/contact-us-1/index.js +87 -7
- package/dist/components/puck-block/contact-sections/contact-us-2/contact-us-2.d.ts +30 -0
- package/dist/components/puck-block/contact-sections/contact-us-2/contact-us-2.js +234 -0
- package/dist/components/puck-block/contact-sections/contact-us-2/index.d.ts +5 -0
- package/dist/components/puck-block/contact-sections/contact-us-2/index.js +74 -0
- package/dist/components/puck-block/contact-sections/contact-us-3/contact-us-3.d.ts +32 -0
- package/dist/components/puck-block/contact-sections/contact-us-3/contact-us-3.js +250 -0
- package/dist/components/puck-block/contact-sections/contact-us-3/index.d.ts +5 -0
- package/dist/components/puck-block/contact-sections/contact-us-3/index.js +114 -0
- package/dist/components/puck-block/contact-sections/props.d.ts +65 -0
- package/dist/components/puck-block/cta-sections/banner-cta-1/banner-cta.d.ts +12 -9
- package/dist/components/puck-block/cta-sections/banner-cta-1/banner-cta.js +28 -30
- package/dist/components/puck-block/cta-sections/banner-cta-1/index.js +23 -25
- package/dist/components/puck-block/cta-sections/cta-1/cta.d.ts +6 -4
- package/dist/components/puck-block/cta-sections/cta-1/cta.js +5 -7
- package/dist/components/puck-block/cta-sections/cta-1/index.js +5 -9
- package/dist/components/puck-block/cta-sections/gradient-cta-1/gradient-cta.d.ts +10 -10
- package/dist/components/puck-block/cta-sections/gradient-cta-1/gradient-cta.js +24 -20
- package/dist/components/puck-block/cta-sections/gradient-cta-1/index.js +36 -29
- package/dist/components/puck-block/cta-sections/newsletter-signup-1/index.js +13 -5
- package/dist/components/puck-block/cta-sections/newsletter-signup-1/newsletter-signup.d.ts +7 -3
- package/dist/components/puck-block/cta-sections/newsletter-signup-1/newsletter-signup.js +36 -32
- package/dist/components/puck-block/cta-sections/promo-section-1/index.js +4 -5
- package/dist/components/puck-block/cta-sections/promo-section-1/promo-section.d.ts +6 -4
- package/dist/components/puck-block/cta-sections/promo-section-1/promo-section.js +94 -79
- package/dist/components/puck-block/cta-sections/props.d.ts +47 -0
- package/dist/components/puck-block/faq-sections/accordion-1/accordion.d.ts +6 -4
- package/dist/components/puck-block/faq-sections/accordion-1/accordion.js +39 -33
- package/dist/components/puck-block/faq-sections/accordion-1/index.js +3 -5
- package/dist/components/puck-block/faq-sections/faq-1/faq.d.ts +9 -7
- package/dist/components/puck-block/faq-sections/faq-1/faq.js +50 -44
- package/dist/components/puck-block/faq-sections/faq-1/index.js +12 -14
- package/dist/components/puck-block/faq-sections/faq-2/faq-2.d.ts +18 -0
- package/dist/components/puck-block/faq-sections/faq-2/faq-2.js +54 -0
- package/dist/components/puck-block/faq-sections/faq-2/index.d.ts +5 -0
- package/dist/components/puck-block/faq-sections/faq-2/index.js +61 -0
- package/dist/components/puck-block/faq-sections/props.d.ts +30 -0
- package/dist/components/puck-block/feature-sections/bento-1/bento.d.ts +6 -4
- package/dist/components/puck-block/feature-sections/bento-1/bento.js +2 -4
- package/dist/components/puck-block/feature-sections/bento-1/index.js +4 -5
- package/dist/components/puck-block/feature-sections/feature-cards-1/feature-cards.d.ts +8 -7
- package/dist/components/puck-block/feature-sections/feature-cards-1/feature-cards.js +15 -7
- package/dist/components/puck-block/feature-sections/feature-cards-1/index.js +37 -18
- package/dist/components/puck-block/feature-sections/feature-showcase-1/feature-showcase.d.ts +6 -4
- package/dist/components/puck-block/feature-sections/feature-showcase-1/feature-showcase.js +4 -12
- package/dist/components/puck-block/feature-sections/feature-showcase-1/index.js +4 -5
- package/dist/components/puck-block/feature-sections/icon-grid-1/icon-grid.d.ts +6 -4
- package/dist/components/puck-block/feature-sections/icon-grid-1/icon-grid.js +59 -53
- package/dist/components/puck-block/feature-sections/icon-grid-1/index.js +7 -8
- package/dist/components/puck-block/feature-sections/product-features-1/index.js +4 -5
- package/dist/components/puck-block/feature-sections/product-features-1/product-features.d.ts +6 -4
- package/dist/components/puck-block/feature-sections/product-features-1/product-features.js +7 -29
- package/dist/components/puck-block/feature-sections/props.d.ts +48 -0
- package/dist/components/puck-block/footer-sections/footer-1/footer.d.ts +5 -3
- package/dist/components/puck-block/footer-sections/footer-1/footer.js +6 -6
- package/dist/components/puck-block/footer-sections/footer-1/index.js +3 -5
- package/dist/components/puck-block/footer-sections/props.d.ts +31 -0
- package/dist/components/puck-block/gallery-sections/gallery-1/gallery.d.ts +9 -7
- package/dist/components/puck-block/gallery-sections/gallery-1/gallery.js +49 -40
- package/dist/components/puck-block/gallery-sections/gallery-1/index.js +32 -34
- package/dist/components/puck-block/gallery-sections/gallery-2/gallery-2.d.ts +16 -0
- package/dist/components/puck-block/gallery-sections/gallery-2/gallery-2.js +86 -0
- package/dist/components/puck-block/gallery-sections/gallery-2/index.d.ts +5 -0
- package/dist/components/puck-block/gallery-sections/gallery-2/index.js +42 -0
- package/dist/components/puck-block/gallery-sections/gallery-3/gallery-3.d.ts +19 -0
- package/dist/components/puck-block/gallery-sections/gallery-3/gallery-3.js +119 -0
- package/dist/components/puck-block/gallery-sections/gallery-3/index.d.ts +5 -0
- package/dist/components/puck-block/gallery-sections/gallery-3/index.js +59 -0
- package/dist/components/puck-block/gallery-sections/props.d.ts +26 -0
- package/dist/components/puck-block/header-sections/header-1/header.d.ts +7 -5
- package/dist/components/puck-block/header-sections/header-1/header.js +8 -9
- package/dist/components/puck-block/header-sections/header-1/index.d.ts +1 -1
- package/dist/components/puck-block/header-sections/header-1/index.js +13 -12
- package/dist/components/puck-block/header-sections/props.d.ts +41 -0
- package/dist/components/puck-block/header-sections/sticky-nav-1/index.js +12 -12
- package/dist/components/puck-block/header-sections/sticky-nav-1/sticky-nav.d.ts +8 -6
- package/dist/components/puck-block/header-sections/sticky-nav-1/sticky-nav.js +5 -5
- package/dist/components/puck-block/hero-sections/fullscreen-hero-1/fullscreen-hero.d.ts +11 -4
- package/dist/components/puck-block/hero-sections/fullscreen-hero-1/fullscreen-hero.js +60 -23
- package/dist/components/puck-block/hero-sections/fullscreen-hero-1/index.js +18 -6
- package/dist/components/puck-block/hero-sections/gradient-hero-1/gradient-hero.d.ts +9 -5
- package/dist/components/puck-block/hero-sections/gradient-hero-1/gradient-hero.js +37 -24
- package/dist/components/puck-block/hero-sections/gradient-hero-1/index.js +18 -15
- package/dist/components/puck-block/hero-sections/grid-hero-1/grid-hero.d.ts +7 -6
- package/dist/components/puck-block/hero-sections/grid-hero-1/grid-hero.js +7 -10
- package/dist/components/puck-block/hero-sections/grid-hero-1/index.js +43 -11
- package/dist/components/puck-block/hero-sections/hero-1/hero.d.ts +6 -4
- package/dist/components/puck-block/hero-sections/hero-1/hero.js +5 -7
- package/dist/components/puck-block/hero-sections/hero-1/index.js +4 -4
- package/dist/components/puck-block/hero-sections/image-hero-1/image-hero.d.ts +14 -8
- package/dist/components/puck-block/hero-sections/image-hero-1/image-hero.js +64 -60
- package/dist/components/puck-block/hero-sections/image-hero-1/index.js +16 -34
- package/dist/components/puck-block/hero-sections/props.d.ts +71 -0
- package/dist/components/puck-block/hero-sections/split-hero-1/index.js +6 -5
- package/dist/components/puck-block/hero-sections/split-hero-1/split-hero.d.ts +8 -8
- package/dist/components/puck-block/hero-sections/split-hero-1/split-hero.js +48 -47
- package/dist/components/puck-block/hero-sections/video-hero-1/index.js +4 -3
- package/dist/components/puck-block/hero-sections/video-hero-1/video-hero.d.ts +6 -2
- package/dist/components/puck-block/hero-sections/video-hero-1/video-hero.js +30 -22
- package/dist/components/puck-block/index.d.ts +15 -0
- package/dist/components/puck-block/location-sections/location-1/index.d.ts +5 -0
- package/dist/components/puck-block/location-sections/location-1/index.js +108 -0
- package/dist/components/puck-block/location-sections/location-1/location.d.ts +28 -0
- package/dist/components/puck-block/location-sections/location-1/location.js +137 -0
- package/dist/components/puck-block/location-sections/location-2/index.d.ts +5 -0
- package/dist/components/puck-block/location-sections/location-2/index.js +123 -0
- package/dist/components/puck-block/location-sections/location-2/location.d.ts +30 -0
- package/dist/components/puck-block/location-sections/location-2/location.js +131 -0
- package/dist/components/puck-block/location-sections/location-3/index.d.ts +5 -0
- package/dist/components/puck-block/location-sections/location-3/index.js +84 -0
- package/dist/components/puck-block/location-sections/location-3/location.d.ts +24 -0
- package/dist/components/puck-block/location-sections/location-3/location.js +127 -0
- package/dist/components/puck-block/location-sections/props.d.ts +45 -0
- package/dist/components/puck-block/metrics-sections/props.d.ts +43 -0
- package/dist/components/puck-block/metrics-sections/stats-1/index.js +6 -7
- package/dist/components/puck-block/metrics-sections/stats-1/stats.d.ts +7 -5
- package/dist/components/puck-block/metrics-sections/stats-1/stats.js +61 -55
- package/dist/components/puck-block/metrics-sections/stats-2/index.d.ts +5 -0
- package/dist/components/puck-block/metrics-sections/stats-2/index.js +76 -0
- package/dist/components/puck-block/metrics-sections/stats-2/stats-2.d.ts +18 -0
- package/dist/components/puck-block/metrics-sections/stats-2/stats-2.js +57 -0
- package/dist/components/puck-block/metrics-sections/stats-3/index.d.ts +5 -0
- package/dist/components/puck-block/metrics-sections/stats-3/index.js +86 -0
- package/dist/components/puck-block/metrics-sections/stats-3/stats-3.d.ts +18 -0
- package/dist/components/puck-block/metrics-sections/stats-3/stats-3.js +56 -0
- package/dist/components/puck-block/pricing-sections/comparison-1/comparison.d.ts +7 -5
- package/dist/components/puck-block/pricing-sections/comparison-1/comparison.js +45 -39
- package/dist/components/puck-block/pricing-sections/comparison-1/index.js +5 -7
- package/dist/components/puck-block/pricing-sections/pricing-1/index.js +10 -11
- package/dist/components/puck-block/pricing-sections/pricing-1/pricing.d.ts +8 -6
- package/dist/components/puck-block/pricing-sections/pricing-1/pricing.js +47 -35
- package/dist/components/puck-block/pricing-sections/pricing-2/index.d.ts +5 -0
- package/dist/components/puck-block/pricing-sections/pricing-2/index.js +151 -0
- package/dist/components/puck-block/pricing-sections/pricing-2/pricing-2.d.ts +26 -0
- package/dist/components/puck-block/pricing-sections/pricing-2/pricing-2.js +71 -0
- package/dist/components/puck-block/pricing-sections/props.d.ts +46 -0
- package/dist/components/puck-block/showcase-sections/before-after-1/before-after.d.ts +22 -0
- package/dist/components/puck-block/showcase-sections/before-after-1/before-after.js +71 -0
- package/dist/components/puck-block/showcase-sections/before-after-1/index.d.ts +5 -0
- package/dist/components/puck-block/showcase-sections/before-after-1/index.js +73 -0
- package/dist/components/puck-block/showcase-sections/case-study-1/case-study.d.ts +6 -2
- package/dist/components/puck-block/showcase-sections/case-study-1/case-study.js +30 -28
- package/dist/components/puck-block/showcase-sections/case-study-1/index.js +4 -3
- package/dist/components/puck-block/showcase-sections/props.d.ts +48 -0
- package/dist/components/puck-block/showcase-sections/step-by-step-1/index.js +3 -5
- package/dist/components/puck-block/showcase-sections/step-by-step-1/step-by-step.d.ts +6 -4
- package/dist/components/puck-block/showcase-sections/step-by-step-1/step-by-step.js +38 -41
- package/dist/components/puck-block/team-sections/props.d.ts +39 -0
- package/dist/components/puck-block/team-sections/team-grid-1/index.js +4 -5
- package/dist/components/puck-block/team-sections/team-grid-1/team-grid.d.ts +6 -4
- package/dist/components/puck-block/team-sections/team-grid-1/team-grid.js +27 -41
- package/dist/components/puck-block/team-sections/team-grid-2/index.d.ts +5 -0
- package/dist/components/puck-block/team-sections/team-grid-2/index.js +62 -0
- package/dist/components/puck-block/team-sections/team-grid-2/team-grid-2.d.ts +23 -0
- package/dist/components/puck-block/team-sections/team-grid-2/team-grid-2.js +44 -0
- package/dist/components/puck-block/team-sections/team-profiles-1/index.d.ts +5 -0
- package/dist/components/puck-block/team-sections/team-profiles-1/index.js +53 -0
- package/dist/components/puck-block/team-sections/team-profiles-1/team-profiles.d.ts +23 -0
- package/dist/components/puck-block/team-sections/team-profiles-1/team-profiles.js +105 -0
- package/dist/components/puck-block/testimonial-sections/customers-1/customers.d.ts +9 -7
- package/dist/components/puck-block/testimonial-sections/customers-1/customers.js +8 -11
- package/dist/components/puck-block/testimonial-sections/customers-1/index.js +17 -17
- package/dist/components/puck-block/testimonial-sections/logo-marquee-1/index.js +15 -12
- package/dist/components/puck-block/testimonial-sections/logo-marquee-1/logo-marquee.d.ts +7 -3
- package/dist/components/puck-block/testimonial-sections/logo-marquee-1/logo-marquee.js +34 -24
- package/dist/components/puck-block/testimonial-sections/logo-wall-1/index.d.ts +5 -0
- package/dist/components/puck-block/testimonial-sections/logo-wall-1/index.js +51 -0
- package/dist/components/puck-block/testimonial-sections/logo-wall-1/logo-wall.d.ts +17 -0
- package/dist/components/puck-block/testimonial-sections/logo-wall-1/logo-wall.js +55 -0
- package/dist/components/puck-block/testimonial-sections/props.d.ts +34 -0
- package/dist/components/puck-block/testimonial-sections/review-section-1/index.js +16 -15
- package/dist/components/puck-block/testimonial-sections/review-section-1/review-section.d.ts +8 -6
- package/dist/components/puck-block/testimonial-sections/review-section-1/review-section.js +25 -19
- package/dist/components/puck-block/testimonial-sections/testimonials-1/index.js +17 -17
- package/dist/components/puck-block/testimonial-sections/testimonials-1/testimonials.d.ts +8 -6
- package/dist/components/puck-block/testimonial-sections/testimonials-1/testimonials.js +76 -63
- package/dist/components/puck-block/text-sections/articles-1/articles.d.ts +7 -4
- package/dist/components/puck-block/text-sections/articles-1/articles.js +42 -22
- package/dist/components/puck-block/text-sections/articles-1/index.js +31 -19
- package/dist/components/puck-block/text-sections/content-section-1/content-section.d.ts +7 -5
- package/dist/components/puck-block/text-sections/content-section-1/content-section.js +11 -12
- package/dist/components/puck-block/text-sections/content-section-1/index.js +14 -14
- package/dist/components/puck-block/text-sections/props.d.ts +58 -0
- package/dist/components/puck-block/text-sections/rich-text-1/index.js +13 -15
- package/dist/components/puck-block/text-sections/rich-text-1/rich-text.d.ts +7 -5
- package/dist/components/puck-block/text-sections/rich-text-1/rich-text.js +11 -11
- package/dist/components/puck-block/text-sections/tab-section-1/index.js +4 -5
- package/dist/components/puck-block/text-sections/tab-section-1/tab-section.d.ts +6 -4
- package/dist/components/puck-block/text-sections/tab-section-1/tab-section.js +6 -7
- package/dist/components/puck-block/text-sections/timeline-1/index.js +3 -5
- package/dist/components/puck-block/text-sections/timeline-1/timeline.d.ts +6 -4
- package/dist/components/puck-block/text-sections/timeline-1/timeline.js +3 -5
- package/dist/components/puck-block/text-sections/two-column-1/index.js +4 -6
- package/dist/components/puck-block/text-sections/two-column-1/two-column.d.ts +6 -4
- package/dist/components/puck-block/text-sections/two-column-1/two-column.js +5 -7
- package/dist/components/shadcn/navigation-menu.d.ts +1 -1
- package/dist/components/shadcn/navigation-menu.js +33 -0
- package/dist/index.js +106 -75
- package/package.json +1 -1
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
const paddingLevel = {
|
|
2
|
+
type: "select",
|
|
3
|
+
options: [
|
|
4
|
+
{ label: "none", value: "none" },
|
|
5
|
+
{ label: "small", value: "small" },
|
|
6
|
+
{ label: "medium", value: "medium" },
|
|
7
|
+
{ label: "large", value: "large" }
|
|
8
|
+
],
|
|
9
|
+
ai: {
|
|
10
|
+
instructions: "Never select none as an option"
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
const padding = {
|
|
14
|
+
type: "object",
|
|
15
|
+
objectFields: {
|
|
16
|
+
top: paddingLevel,
|
|
17
|
+
bottom: paddingLevel
|
|
18
|
+
},
|
|
19
|
+
ai: {
|
|
20
|
+
exclude: true
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const paddingDefaults = {
|
|
24
|
+
top: "medium",
|
|
25
|
+
bottom: "medium"
|
|
26
|
+
};
|
|
27
|
+
const sectionStyle = {
|
|
28
|
+
type: "select",
|
|
29
|
+
label: "Section Style",
|
|
30
|
+
options: [
|
|
31
|
+
{ label: "Default", value: "default" },
|
|
32
|
+
{ label: "Dark", value: "dark" },
|
|
33
|
+
{ label: "Muted", value: "muted" },
|
|
34
|
+
{ label: "Inverted", value: "inverted" },
|
|
35
|
+
{ label: "Custom", value: "custom" }
|
|
36
|
+
],
|
|
37
|
+
ai: {
|
|
38
|
+
instructions: "Match the section's background tone: use 'dark' for dark/black backgrounds, 'muted' for gray/subtle backgrounds, 'inverted' for full contrast reversal. Default for standard light backgrounds."
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
const sectionOverlay = {
|
|
42
|
+
type: "select",
|
|
43
|
+
label: "Overlay",
|
|
44
|
+
options: [
|
|
45
|
+
{ label: "None", value: "none" },
|
|
46
|
+
{ label: "Gradient Top", value: "gradient-top" },
|
|
47
|
+
{ label: "Gradient Bottom", value: "gradient-bottom" },
|
|
48
|
+
{ label: "Noise", value: "noise" }
|
|
49
|
+
],
|
|
50
|
+
ai: {
|
|
51
|
+
instructions: "Use gradient overlays when the section has a background image that needs text contrast. Use noise for subtle texture."
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
const backgroundColor = {
|
|
55
|
+
type: "text",
|
|
56
|
+
label: "Background Color",
|
|
57
|
+
ai: {
|
|
58
|
+
instructions: "Set a custom background color in oklch format (e.g. 'oklch(0.2 0.05 260)'). Only use when sectionStyle is 'custom'."
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
const backgroundImage = {
|
|
62
|
+
type: "text",
|
|
63
|
+
label: "Background Image URL",
|
|
64
|
+
ai: {
|
|
65
|
+
instructions: "URL for a full-width background image behind the section.",
|
|
66
|
+
stream: false
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
const sectionBaseStyleFields = {
|
|
70
|
+
sectionStyle,
|
|
71
|
+
backgroundColor,
|
|
72
|
+
padding
|
|
73
|
+
};
|
|
74
|
+
const sectionBaseStyleDefaults = {
|
|
75
|
+
padding: paddingDefaults
|
|
76
|
+
};
|
|
77
|
+
function createStylesField(extraFields) {
|
|
78
|
+
return {
|
|
79
|
+
type: "object",
|
|
80
|
+
label: "Styles",
|
|
81
|
+
objectFields: {
|
|
82
|
+
...sectionBaseStyleFields,
|
|
83
|
+
...extraFields
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
function createStylesDefaults(extraDefaults) {
|
|
88
|
+
return {
|
|
89
|
+
...sectionBaseStyleDefaults,
|
|
90
|
+
...extraDefaults
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
const bannerExtraFields = {
|
|
94
|
+
textColor: {
|
|
95
|
+
type: "text",
|
|
96
|
+
label: "Text Color"
|
|
97
|
+
},
|
|
98
|
+
align: {
|
|
99
|
+
type: "radio",
|
|
100
|
+
options: [
|
|
101
|
+
{ label: "Left", value: "left" },
|
|
102
|
+
{ label: "Center", value: "center" },
|
|
103
|
+
{ label: "Right", value: "right" }
|
|
104
|
+
]
|
|
105
|
+
},
|
|
106
|
+
size: {
|
|
107
|
+
type: "radio",
|
|
108
|
+
options: [
|
|
109
|
+
{ label: "Small", value: "small" },
|
|
110
|
+
{ label: "Default", value: "default" }
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
const bannerStylesField = createStylesField(bannerExtraFields);
|
|
115
|
+
const bannerStylesDefaults = createStylesDefaults();
|
|
116
|
+
const heroExtraFields = {
|
|
117
|
+
backgroundImage,
|
|
118
|
+
overlay: sectionOverlay,
|
|
119
|
+
align: {
|
|
120
|
+
type: "radio",
|
|
121
|
+
options: [
|
|
122
|
+
{ label: "Left", value: "left" },
|
|
123
|
+
{ label: "Center", value: "center" }
|
|
124
|
+
]
|
|
125
|
+
},
|
|
126
|
+
minHeight: {
|
|
127
|
+
type: "select",
|
|
128
|
+
label: "Min Height",
|
|
129
|
+
options: [
|
|
130
|
+
{ label: "Medium", value: "medium" },
|
|
131
|
+
{ label: "Large", value: "large" },
|
|
132
|
+
{ label: "Full", value: "full" }
|
|
133
|
+
]
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
const heroStylesField = createStylesField(heroExtraFields);
|
|
137
|
+
const heroStylesDefaults = createStylesDefaults();
|
|
138
|
+
const ctaExtraFields = {
|
|
139
|
+
layout: {
|
|
140
|
+
type: "radio",
|
|
141
|
+
label: "Layout",
|
|
142
|
+
options: [
|
|
143
|
+
{ label: "Contained", value: "contained" },
|
|
144
|
+
{ label: "Full Bleed", value: "full-bleed" }
|
|
145
|
+
]
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
createStylesField(ctaExtraFields);
|
|
149
|
+
createStylesDefaults();
|
|
150
|
+
const featureExtraFields = {
|
|
151
|
+
columns: {
|
|
152
|
+
type: "select",
|
|
153
|
+
label: "Columns",
|
|
154
|
+
options: [
|
|
155
|
+
{ label: "2", value: 2 },
|
|
156
|
+
{ label: "3", value: 3 },
|
|
157
|
+
{ label: "4", value: 4 }
|
|
158
|
+
]
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
createStylesField(featureExtraFields);
|
|
162
|
+
createStylesDefaults();
|
|
163
|
+
const faqExtraFields = {
|
|
164
|
+
layout: {
|
|
165
|
+
type: "radio",
|
|
166
|
+
label: "Layout",
|
|
167
|
+
options: [
|
|
168
|
+
{ label: "Single Column", value: "single-col" },
|
|
169
|
+
{ label: "Two Columns", value: "two-col" }
|
|
170
|
+
]
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
createStylesField(faqExtraFields);
|
|
174
|
+
createStylesDefaults();
|
|
175
|
+
const galleryExtraFields = {
|
|
176
|
+
gap: {
|
|
177
|
+
type: "select",
|
|
178
|
+
label: "Gap",
|
|
179
|
+
options: [
|
|
180
|
+
{ label: "Small", value: "sm" },
|
|
181
|
+
{ label: "Medium", value: "md" },
|
|
182
|
+
{ label: "Large", value: "lg" }
|
|
183
|
+
]
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
createStylesField(galleryExtraFields);
|
|
187
|
+
createStylesDefaults();
|
|
188
|
+
const testimonialExtraFields = {
|
|
189
|
+
layout: {
|
|
190
|
+
type: "radio",
|
|
191
|
+
label: "Layout",
|
|
192
|
+
options: [
|
|
193
|
+
{ label: "Cards", value: "cards" },
|
|
194
|
+
{ label: "Quote", value: "quote" }
|
|
195
|
+
]
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
createStylesField(
|
|
199
|
+
testimonialExtraFields
|
|
200
|
+
);
|
|
201
|
+
createStylesDefaults();
|
|
202
|
+
const showcaseExtraFields = {
|
|
203
|
+
layout: {
|
|
204
|
+
type: "select",
|
|
205
|
+
label: "Layout",
|
|
206
|
+
options: [
|
|
207
|
+
{ label: "Horizontal", value: "horizontal" },
|
|
208
|
+
{ label: "Vertical", value: "vertical" },
|
|
209
|
+
{ label: "Numbered", value: "numbered" }
|
|
210
|
+
]
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
createStylesField(showcaseExtraFields);
|
|
214
|
+
createStylesDefaults();
|
|
215
|
+
const textExtraFields = {
|
|
216
|
+
maxWidth: {
|
|
217
|
+
type: "select",
|
|
218
|
+
label: "Max Width",
|
|
219
|
+
options: [
|
|
220
|
+
{ label: "Small", value: "sm" },
|
|
221
|
+
{ label: "Medium", value: "md" },
|
|
222
|
+
{ label: "Large", value: "lg" },
|
|
223
|
+
{ label: "Full", value: "full" }
|
|
224
|
+
]
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
createStylesField(textExtraFields);
|
|
228
|
+
createStylesDefaults();
|
|
229
|
+
const contactExtraFields = {
|
|
230
|
+
panelStyle: {
|
|
231
|
+
type: "select",
|
|
232
|
+
label: "Panel Style",
|
|
233
|
+
options: [
|
|
234
|
+
{ label: "Default", value: "default" },
|
|
235
|
+
{ label: "Card", value: "card" },
|
|
236
|
+
{ label: "Flat", value: "flat" }
|
|
237
|
+
]
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
createStylesField(contactExtraFields);
|
|
241
|
+
createStylesDefaults();
|
|
242
|
+
const locationExtraFields = {
|
|
243
|
+
mapHeight: {
|
|
244
|
+
type: "number",
|
|
245
|
+
label: "Map Height",
|
|
246
|
+
min: 200,
|
|
247
|
+
max: 800
|
|
248
|
+
},
|
|
249
|
+
mapFilter: {
|
|
250
|
+
type: "text",
|
|
251
|
+
label: "Map Filter (CSS)"
|
|
252
|
+
},
|
|
253
|
+
mapTintColor: {
|
|
254
|
+
type: "text",
|
|
255
|
+
label: "Map Tint Color"
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
createStylesField(locationExtraFields);
|
|
259
|
+
createStylesDefaults();
|
|
260
|
+
createStylesField();
|
|
261
|
+
createStylesDefaults();
|
|
262
|
+
createStylesField();
|
|
263
|
+
createStylesDefaults();
|
|
264
|
+
createStylesField();
|
|
265
|
+
createStylesDefaults();
|
|
266
|
+
createStylesField();
|
|
267
|
+
createStylesDefaults();
|
|
268
|
+
createStylesField();
|
|
269
|
+
createStylesDefaults();
|
|
270
|
+
export {
|
|
271
|
+
backgroundColor,
|
|
272
|
+
backgroundImage,
|
|
273
|
+
bannerStylesDefaults,
|
|
274
|
+
bannerStylesField,
|
|
275
|
+
createStylesDefaults,
|
|
276
|
+
createStylesField,
|
|
277
|
+
heroStylesDefaults,
|
|
278
|
+
heroStylesField,
|
|
279
|
+
padding,
|
|
280
|
+
paddingDefaults,
|
|
281
|
+
paddingLevel,
|
|
282
|
+
sectionBaseStyleDefaults,
|
|
283
|
+
sectionBaseStyleFields,
|
|
284
|
+
sectionOverlay,
|
|
285
|
+
sectionStyle
|
|
286
|
+
};
|
|
@@ -5,12 +5,12 @@ export type Feature = {
|
|
|
5
5
|
name: string;
|
|
6
6
|
description?: string;
|
|
7
7
|
};
|
|
8
|
-
export type ActionType = "page" | "external" | "email" | "phone" | "section" | "download" | "none";
|
|
8
|
+
export type ActionType = "page" | "external" | "scroll" | "email" | "phone" | "section" | "download" | "none";
|
|
9
9
|
export type Action = {
|
|
10
10
|
type: ActionType;
|
|
11
11
|
pageUrl?: string;
|
|
12
12
|
externalUrl?: string;
|
|
13
|
-
openInNewTab?:
|
|
13
|
+
openInNewTab?: string;
|
|
14
14
|
email?: string;
|
|
15
15
|
subject?: string;
|
|
16
16
|
phone?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ComponentType } from
|
|
1
|
+
import { type ComponentType } from "react";
|
|
2
2
|
interface EditableConfig {
|
|
3
3
|
type: string;
|
|
4
4
|
fields: Record<string, any>;
|
|
@@ -11,6 +11,9 @@ interface EditableConfig {
|
|
|
11
11
|
* 2. 编辑模式下渲染原组件 + hover overlay
|
|
12
12
|
* 3. 点击打开 Dialog,传递 onSave 回调
|
|
13
13
|
* 4. 保存时用 dispatch 更新 Puck data
|
|
14
|
+
*
|
|
15
|
+
* Puck hooks (usePuckDispatch / usePuckAppState) 仅在 EditableInner 中调用,
|
|
16
|
+
* 确保非编辑模式(如 Storybook / 前台渲染)不会触发 "usePuck must be used inside <Puck>" 错误。
|
|
14
17
|
*/
|
|
15
18
|
export declare function withEditable<P extends Record<string, any>>(Component: ComponentType<P>, config: EditableConfig): (props: P & {
|
|
16
19
|
onEdit?: (props: P, onSave: (updated: Partial<P>) => void) => void;
|
|
@@ -8,20 +8,19 @@ import { useEditorContext } from "../editor-context.js";
|
|
|
8
8
|
import set from "../../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/set.js";
|
|
9
9
|
const BLOCK_LEVEL_TYPES = /* @__PURE__ */ new Set(["image"]);
|
|
10
10
|
function withEditable(Component, config) {
|
|
11
|
-
|
|
12
|
-
const { isEditor: isEditorMode } = useEditorContext();
|
|
11
|
+
function EditableInner(props) {
|
|
13
12
|
const dispatch = usePuckDispatch();
|
|
14
13
|
const appState = usePuckAppState();
|
|
15
14
|
const wrapperRef = useRef(null);
|
|
16
15
|
const isBlock = BLOCK_LEVEL_TYPES.has(config.type);
|
|
17
16
|
useEffect(() => {
|
|
18
|
-
if (!
|
|
17
|
+
if (!wrapperRef.current) return;
|
|
19
18
|
return registerOverlayPortal(wrapperRef.current, { disableDrag: true });
|
|
20
|
-
}, [
|
|
19
|
+
}, []);
|
|
21
20
|
const location = useMemo(() => {
|
|
22
|
-
if (!
|
|
21
|
+
if (!(appState == null ? void 0 : appState.data)) return null;
|
|
23
22
|
return findPropsLocation(appState.data, props, config.fields);
|
|
24
|
-
}, [
|
|
23
|
+
}, [appState == null ? void 0 : appState.data, props]);
|
|
25
24
|
const handleSave = useCallback(
|
|
26
25
|
(updated) => {
|
|
27
26
|
if (!location) return;
|
|
@@ -52,34 +51,55 @@ function withEditable(Component, config) {
|
|
|
52
51
|
},
|
|
53
52
|
[props, handleSave]
|
|
54
53
|
);
|
|
54
|
+
return /* @__PURE__ */ jsxs(
|
|
55
|
+
"span",
|
|
56
|
+
{
|
|
57
|
+
ref: wrapperRef,
|
|
58
|
+
className: isBlock ? "group relative block h-full w-full" : "group relative inline-flex",
|
|
59
|
+
children: [
|
|
60
|
+
/* @__PURE__ */ jsx(Component, { ...props }),
|
|
61
|
+
/* @__PURE__ */ jsx(
|
|
62
|
+
"span",
|
|
63
|
+
{
|
|
64
|
+
onClick: handleEdit,
|
|
65
|
+
className: "absolute inset-0 z-40 flex items-center justify-center opacity-0 transition-opacity group-hover:opacity-100",
|
|
66
|
+
children: /* @__PURE__ */ jsx("span", { className: "flex h-8 w-8 items-center justify-center rounded-full bg-black/50 shadow-md backdrop-blur-sm", children: /* @__PURE__ */ jsx(Pencil, { className: "h-4 w-4 text-white" }) })
|
|
67
|
+
}
|
|
68
|
+
)
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
return function EditableComponent(props) {
|
|
74
|
+
const { isEditor: isEditorMode } = useEditorContext();
|
|
55
75
|
if (!isEditorMode) {
|
|
56
76
|
return /* @__PURE__ */ jsx(Component, { ...props });
|
|
57
77
|
}
|
|
58
|
-
return /* @__PURE__ */
|
|
59
|
-
/* @__PURE__ */ jsx(Component, { ...props }),
|
|
60
|
-
/* @__PURE__ */ jsx(
|
|
61
|
-
"span",
|
|
62
|
-
{
|
|
63
|
-
onClick: handleEdit,
|
|
64
|
-
className: "absolute inset-0 z-40 flex items-center justify-center opacity-0 transition-opacity group-hover:opacity-100",
|
|
65
|
-
children: /* @__PURE__ */ jsx("span", { className: "flex h-8 w-8 items-center justify-center rounded-full bg-black/50 shadow-md backdrop-blur-sm", children: /* @__PURE__ */ jsx(Pencil, { className: "h-4 w-4 text-white" }) })
|
|
66
|
-
}
|
|
67
|
-
)
|
|
68
|
-
] });
|
|
78
|
+
return /* @__PURE__ */ jsx(EditableInner, { ...props });
|
|
69
79
|
};
|
|
70
80
|
}
|
|
71
81
|
function findPropsLocation(data, targetProps, fields) {
|
|
72
82
|
if (!data) return null;
|
|
73
83
|
const content = Array.isArray(data.content) ? data.content : [];
|
|
74
84
|
for (const component of content) {
|
|
75
|
-
const result = searchInObject(
|
|
85
|
+
const result = searchInObject(
|
|
86
|
+
component.props,
|
|
87
|
+
targetProps,
|
|
88
|
+
fields,
|
|
89
|
+
component.props.id
|
|
90
|
+
);
|
|
76
91
|
if (result) return result;
|
|
77
92
|
}
|
|
78
93
|
const zones = data.zones && typeof data.zones === "object" ? data.zones : {};
|
|
79
94
|
for (const zoneKey of Object.keys(zones)) {
|
|
80
95
|
const zoneComponents = Array.isArray(zones[zoneKey]) ? zones[zoneKey] : [];
|
|
81
96
|
for (const component of zoneComponents) {
|
|
82
|
-
const result = searchInObject(
|
|
97
|
+
const result = searchInObject(
|
|
98
|
+
component.props,
|
|
99
|
+
targetProps,
|
|
100
|
+
fields,
|
|
101
|
+
component.props.id
|
|
102
|
+
);
|
|
83
103
|
if (result) return result;
|
|
84
104
|
}
|
|
85
105
|
}
|
|
@@ -117,18 +137,22 @@ function searchInObject(obj, targetProps, fields, componentId, currentPath = "")
|
|
|
117
137
|
}
|
|
118
138
|
function findComponentById(data, componentId) {
|
|
119
139
|
const content = Array.isArray(data == null ? void 0 : data.content) ? data.content : [];
|
|
120
|
-
const contentMatch = content.find(
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
140
|
+
const contentMatch = content.find(
|
|
141
|
+
(component) => {
|
|
142
|
+
var _a;
|
|
143
|
+
return ((_a = component == null ? void 0 : component.props) == null ? void 0 : _a.id) === componentId;
|
|
144
|
+
}
|
|
145
|
+
);
|
|
124
146
|
if (contentMatch) return contentMatch;
|
|
125
147
|
const zones = (data == null ? void 0 : data.zones) && typeof data.zones === "object" ? data.zones : {};
|
|
126
148
|
for (const zoneKey of Object.keys(zones)) {
|
|
127
149
|
const zoneComponents = Array.isArray(zones[zoneKey]) ? zones[zoneKey] : [];
|
|
128
|
-
const zoneMatch = zoneComponents.find(
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
150
|
+
const zoneMatch = zoneComponents.find(
|
|
151
|
+
(component) => {
|
|
152
|
+
var _a;
|
|
153
|
+
return ((_a = component == null ? void 0 : component.props) == null ? void 0 : _a.id) === componentId;
|
|
154
|
+
}
|
|
155
|
+
);
|
|
132
156
|
if (zoneMatch) return zoneMatch;
|
|
133
157
|
}
|
|
134
158
|
return null;
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { type RefObject } from "react";
|
|
2
|
+
export type SitePage = {
|
|
3
|
+
/** 页面 slug,如 "about"、"pricing",用作路由值 */
|
|
4
|
+
slug: string;
|
|
5
|
+
/** 页面显示名,如 "关于我们"、"定价" */
|
|
6
|
+
label: string;
|
|
7
|
+
};
|
|
2
8
|
type EditorContextValue = {
|
|
3
9
|
openFieldsPanel: (componentId: string, componentType: string) => void;
|
|
4
10
|
openAddSection: (index: number, zone: string) => void;
|
|
@@ -9,6 +15,8 @@ type EditorContextValue = {
|
|
|
9
15
|
siteId?: string;
|
|
10
16
|
/** 后台 API 域名,如 https://api.example.com */
|
|
11
17
|
domain?: string;
|
|
18
|
+
/** 站内可选页面列表,用于 url 字段快捷选择 */
|
|
19
|
+
sitePages?: SitePage[];
|
|
12
20
|
};
|
|
13
21
|
export declare const EditorContextProvider: import("react").Provider<EditorContextValue>;
|
|
14
22
|
export declare const useEditorContext: () => EditorContextValue;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { memo, useState, useRef, useMemo,
|
|
2
|
+
import { memo, useCallback, useState, useRef, useMemo, useEffect } from "react";
|
|
3
3
|
import { Input } from "../../shadcn/input.js";
|
|
4
4
|
import { Textarea } from "../../shadcn/textarea.js";
|
|
5
5
|
import { Label } from "../../shadcn/label.js";
|
|
@@ -8,7 +8,8 @@ import { Button } from "../../shadcn/button.js";
|
|
|
8
8
|
import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from "../../shadcn/select.js";
|
|
9
9
|
import { Popover, PopoverTrigger, PopoverContent } from "../../shadcn/popover.js";
|
|
10
10
|
import { ToggleGroup, ToggleGroupItem } from "../../shadcn/toggle-group.js";
|
|
11
|
-
import { ChevronDownIcon, CheckIcon } from "lucide-react";
|
|
11
|
+
import { LinkIcon, XIcon, ClipboardIcon, GlobeIcon, ChevronDownIcon, CheckIcon } from "lucide-react";
|
|
12
|
+
import { useEditorContext } from "../editor-context.js";
|
|
12
13
|
const LARGE_SELECT_THRESHOLD = 200;
|
|
13
14
|
const VIRTUAL_ITEM_HEIGHT = 32;
|
|
14
15
|
const VIRTUAL_VIEWPORT_HEIGHT = 256;
|
|
@@ -159,62 +160,131 @@ const VirtualizedSelectField = memo(function VirtualizedSelectField2({
|
|
|
159
160
|
]
|
|
160
161
|
}
|
|
161
162
|
) }),
|
|
162
|
-
/* @__PURE__ */ jsxs(
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
163
|
+
/* @__PURE__ */ jsxs(PopoverContent, { className: "w-(--radix-popover-trigger-width) p-2", children: [
|
|
164
|
+
/* @__PURE__ */ jsx(
|
|
165
|
+
Input,
|
|
166
|
+
{
|
|
167
|
+
value: search,
|
|
168
|
+
onChange: (e) => setSearch(e.target.value),
|
|
169
|
+
placeholder: "Search options...",
|
|
170
|
+
className: "mb-2"
|
|
171
|
+
}
|
|
172
|
+
),
|
|
173
|
+
/* @__PURE__ */ jsx(
|
|
174
|
+
"div",
|
|
175
|
+
{
|
|
176
|
+
ref: viewportRef,
|
|
177
|
+
className: "relative touch-pan-y overflow-y-auto overscroll-contain rounded-md border",
|
|
178
|
+
style: {
|
|
179
|
+
height: VIRTUAL_VIEWPORT_HEIGHT,
|
|
180
|
+
WebkitOverflowScrolling: "touch"
|
|
181
|
+
},
|
|
182
|
+
onScroll: (e) => setScrollTop(e.currentTarget.scrollTop),
|
|
183
|
+
children: filteredOptions.length === 0 ? /* @__PURE__ */ jsx("div", { className: "text-muted-foreground p-3 text-sm", children: "No options found." }) : /* @__PURE__ */ jsx("div", { style: { height: totalHeight, position: "relative" }, children: /* @__PURE__ */ jsx(
|
|
177
184
|
"div",
|
|
178
185
|
{
|
|
179
|
-
ref: viewportRef,
|
|
180
|
-
className: "relative touch-pan-y overflow-y-auto overscroll-contain rounded-md border",
|
|
181
186
|
style: {
|
|
182
|
-
|
|
183
|
-
|
|
187
|
+
position: "absolute",
|
|
188
|
+
top: startIndex * VIRTUAL_ITEM_HEIGHT,
|
|
189
|
+
left: 0,
|
|
190
|
+
right: 0
|
|
184
191
|
},
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
192
|
+
children: visibleOptions.map((opt) => {
|
|
193
|
+
const isSelected = opt.stringValue === selectedString;
|
|
194
|
+
return /* @__PURE__ */ jsxs(
|
|
195
|
+
"button",
|
|
196
|
+
{
|
|
197
|
+
type: "button",
|
|
198
|
+
className: "hover:bg-accent hover:text-accent-foreground flex h-8 w-full items-center justify-between px-2 text-left text-sm",
|
|
199
|
+
onClick: () => handleSelect(opt.stringValue),
|
|
200
|
+
children: [
|
|
201
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: opt.label }),
|
|
202
|
+
isSelected ? /* @__PURE__ */ jsx(CheckIcon, { className: "text-primary ml-2 size-4 shrink-0" }) : null
|
|
203
|
+
]
|
|
194
204
|
},
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
"button",
|
|
199
|
-
{
|
|
200
|
-
type: "button",
|
|
201
|
-
className: "hover:bg-accent hover:text-accent-foreground flex h-8 w-full items-center justify-between px-2 text-left text-sm",
|
|
202
|
-
onClick: () => handleSelect(opt.stringValue),
|
|
203
|
-
children: [
|
|
204
|
-
/* @__PURE__ */ jsx("span", { className: "truncate", children: opt.label }),
|
|
205
|
-
isSelected ? /* @__PURE__ */ jsx(CheckIcon, { className: "text-primary ml-2 size-4 shrink-0" }) : null
|
|
206
|
-
]
|
|
207
|
-
},
|
|
208
|
-
opt.stringValue
|
|
209
|
-
);
|
|
210
|
-
})
|
|
211
|
-
}
|
|
212
|
-
) })
|
|
205
|
+
opt.stringValue
|
|
206
|
+
);
|
|
207
|
+
})
|
|
213
208
|
}
|
|
214
|
-
)
|
|
209
|
+
) })
|
|
210
|
+
}
|
|
211
|
+
)
|
|
212
|
+
] })
|
|
213
|
+
] })
|
|
214
|
+
] });
|
|
215
|
+
});
|
|
216
|
+
const UrlField = memo(function UrlField2({
|
|
217
|
+
label,
|
|
218
|
+
value,
|
|
219
|
+
onChange,
|
|
220
|
+
sitePages
|
|
221
|
+
}) {
|
|
222
|
+
const currentValue = value ?? "";
|
|
223
|
+
const selectedSlug = currentValue.startsWith("/") ? currentValue.slice(1) : null;
|
|
224
|
+
const handlePaste = useCallback(async () => {
|
|
225
|
+
try {
|
|
226
|
+
const text = await navigator.clipboard.readText();
|
|
227
|
+
if (text) onChange(text.trim());
|
|
228
|
+
} catch {
|
|
229
|
+
}
|
|
230
|
+
}, [onChange]);
|
|
231
|
+
return /* @__PURE__ */ jsxs("div", { className: "mb-4 space-y-3", children: [
|
|
232
|
+
/* @__PURE__ */ jsx(Label, { children: label }),
|
|
233
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
234
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-1 items-center gap-2 rounded-lg border px-3 py-2", children: [
|
|
235
|
+
/* @__PURE__ */ jsx(LinkIcon, { className: "text-muted-foreground size-4 shrink-0" }),
|
|
236
|
+
/* @__PURE__ */ jsx(
|
|
237
|
+
"input",
|
|
238
|
+
{
|
|
239
|
+
className: "w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground",
|
|
240
|
+
placeholder: "https:// or /page-slug",
|
|
241
|
+
value: currentValue,
|
|
242
|
+
onChange: (e) => onChange(e.target.value)
|
|
243
|
+
}
|
|
244
|
+
),
|
|
245
|
+
currentValue && /* @__PURE__ */ jsx(
|
|
246
|
+
"button",
|
|
247
|
+
{
|
|
248
|
+
type: "button",
|
|
249
|
+
className: "text-muted-foreground hover:text-foreground shrink-0",
|
|
250
|
+
onClick: () => onChange(""),
|
|
251
|
+
children: /* @__PURE__ */ jsx(XIcon, { className: "size-3.5" })
|
|
252
|
+
}
|
|
253
|
+
)
|
|
254
|
+
] }),
|
|
255
|
+
/* @__PURE__ */ jsxs(
|
|
256
|
+
Button,
|
|
257
|
+
{
|
|
258
|
+
type: "button",
|
|
259
|
+
variant: "outline",
|
|
260
|
+
size: "sm",
|
|
261
|
+
className: "shrink-0 gap-1.5",
|
|
262
|
+
onClick: handlePaste,
|
|
263
|
+
children: [
|
|
264
|
+
/* @__PURE__ */ jsx(ClipboardIcon, { className: "size-3.5" }),
|
|
265
|
+
"Paste"
|
|
215
266
|
]
|
|
216
267
|
}
|
|
217
268
|
)
|
|
269
|
+
] }),
|
|
270
|
+
sitePages.length > 0 && /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
271
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-xs font-medium", children: "Site pages" }),
|
|
272
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: sitePages.map((page) => {
|
|
273
|
+
const isSelected = selectedSlug === page.slug;
|
|
274
|
+
return /* @__PURE__ */ jsxs(
|
|
275
|
+
"button",
|
|
276
|
+
{
|
|
277
|
+
type: "button",
|
|
278
|
+
className: `inline-flex items-center gap-1.5 rounded-full border px-3 py-1 text-xs font-medium transition-colors ${isSelected ? "border-primary bg-primary text-primary-foreground" : "border-border bg-background text-foreground hover:bg-accent"}`,
|
|
279
|
+
onClick: () => onChange(isSelected ? "" : `${page.slug}`),
|
|
280
|
+
children: [
|
|
281
|
+
/* @__PURE__ */ jsx(GlobeIcon, { className: "size-3" }),
|
|
282
|
+
page.label
|
|
283
|
+
]
|
|
284
|
+
},
|
|
285
|
+
page.slug
|
|
286
|
+
);
|
|
287
|
+
}) })
|
|
218
288
|
] })
|
|
219
289
|
] });
|
|
220
290
|
});
|
|
@@ -226,6 +296,18 @@ const AutoField = memo(function AutoField2({
|
|
|
226
296
|
}) {
|
|
227
297
|
var _a, _b;
|
|
228
298
|
const label = field.label || name;
|
|
299
|
+
const { sitePages } = useEditorContext();
|
|
300
|
+
if (name === "url" && field.type === "text") {
|
|
301
|
+
return /* @__PURE__ */ jsx(
|
|
302
|
+
UrlField,
|
|
303
|
+
{
|
|
304
|
+
label,
|
|
305
|
+
value,
|
|
306
|
+
onChange,
|
|
307
|
+
sitePages: sitePages ?? []
|
|
308
|
+
}
|
|
309
|
+
);
|
|
310
|
+
}
|
|
229
311
|
switch (field.type) {
|
|
230
312
|
case "text":
|
|
231
313
|
return /* @__PURE__ */ jsxs("div", { className: "mb-4 space-y-1.5", children: [
|