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.
Files changed (227) hide show
  1. package/dist/components/puck-base/article-card.js +1 -1
  2. package/dist/components/puck-base/button.js +2 -1
  3. package/dist/components/puck-base/container.d.ts +7 -1
  4. package/dist/components/puck-base/container.js +2 -1
  5. package/dist/components/puck-base/content.d.ts +1 -4
  6. package/dist/components/puck-base/content.js +15 -17
  7. package/dist/components/puck-base/core/fields.d.ts +1 -127
  8. package/dist/components/puck-base/core/fields.js +1 -76
  9. package/dist/components/puck-base/core/styles.d.ts +1877 -0
  10. package/dist/components/puck-base/core/styles.js +286 -0
  11. package/dist/components/puck-base/core/types.d.ts +2 -2
  12. package/dist/components/puck-base/core/with-editable.d.ts +4 -1
  13. package/dist/components/puck-base/core/with-editable.js +51 -27
  14. package/dist/components/puck-base/editor-context.d.ts +8 -0
  15. package/dist/components/puck-base/fields/auto-field.d.ts +1 -0
  16. package/dist/components/puck-base/fields/auto-field.js +131 -49
  17. package/dist/components/puck-base/gradient-text.js +12 -3
  18. package/dist/components/puck-block/banner-sections/announcement-banner-1/announcement-banner.d.ts +9 -7
  19. package/dist/components/puck-block/banner-sections/announcement-banner-1/announcement-banner.js +11 -8
  20. package/dist/components/puck-block/banner-sections/announcement-banner-1/index.js +19 -37
  21. package/dist/components/puck-block/banner-sections/marquee-1/index.js +26 -24
  22. package/dist/components/puck-block/banner-sections/marquee-1/marquee.d.ts +9 -9
  23. package/dist/components/puck-block/banner-sections/marquee-1/marquee.js +28 -21
  24. package/dist/components/puck-block/banner-sections/props.d.ts +22 -0
  25. package/dist/components/puck-block/contact-sections/api/form-leads.d.ts +16 -0
  26. package/dist/components/puck-block/contact-sections/api/form-leads.js +25 -0
  27. package/dist/components/puck-block/contact-sections/contact-us-1/contact-us.d.ts +13 -4
  28. package/dist/components/puck-block/contact-sections/contact-us-1/contact-us.js +122 -121
  29. package/dist/components/puck-block/contact-sections/contact-us-1/index.js +87 -7
  30. package/dist/components/puck-block/contact-sections/contact-us-2/contact-us-2.d.ts +30 -0
  31. package/dist/components/puck-block/contact-sections/contact-us-2/contact-us-2.js +234 -0
  32. package/dist/components/puck-block/contact-sections/contact-us-2/index.d.ts +5 -0
  33. package/dist/components/puck-block/contact-sections/contact-us-2/index.js +74 -0
  34. package/dist/components/puck-block/contact-sections/contact-us-3/contact-us-3.d.ts +32 -0
  35. package/dist/components/puck-block/contact-sections/contact-us-3/contact-us-3.js +250 -0
  36. package/dist/components/puck-block/contact-sections/contact-us-3/index.d.ts +5 -0
  37. package/dist/components/puck-block/contact-sections/contact-us-3/index.js +114 -0
  38. package/dist/components/puck-block/contact-sections/props.d.ts +65 -0
  39. package/dist/components/puck-block/cta-sections/banner-cta-1/banner-cta.d.ts +12 -9
  40. package/dist/components/puck-block/cta-sections/banner-cta-1/banner-cta.js +28 -30
  41. package/dist/components/puck-block/cta-sections/banner-cta-1/index.js +23 -25
  42. package/dist/components/puck-block/cta-sections/cta-1/cta.d.ts +6 -4
  43. package/dist/components/puck-block/cta-sections/cta-1/cta.js +5 -7
  44. package/dist/components/puck-block/cta-sections/cta-1/index.js +5 -9
  45. package/dist/components/puck-block/cta-sections/gradient-cta-1/gradient-cta.d.ts +10 -10
  46. package/dist/components/puck-block/cta-sections/gradient-cta-1/gradient-cta.js +24 -20
  47. package/dist/components/puck-block/cta-sections/gradient-cta-1/index.js +36 -29
  48. package/dist/components/puck-block/cta-sections/newsletter-signup-1/index.js +13 -5
  49. package/dist/components/puck-block/cta-sections/newsletter-signup-1/newsletter-signup.d.ts +7 -3
  50. package/dist/components/puck-block/cta-sections/newsletter-signup-1/newsletter-signup.js +36 -32
  51. package/dist/components/puck-block/cta-sections/promo-section-1/index.js +4 -5
  52. package/dist/components/puck-block/cta-sections/promo-section-1/promo-section.d.ts +6 -4
  53. package/dist/components/puck-block/cta-sections/promo-section-1/promo-section.js +94 -79
  54. package/dist/components/puck-block/cta-sections/props.d.ts +47 -0
  55. package/dist/components/puck-block/faq-sections/accordion-1/accordion.d.ts +6 -4
  56. package/dist/components/puck-block/faq-sections/accordion-1/accordion.js +39 -33
  57. package/dist/components/puck-block/faq-sections/accordion-1/index.js +3 -5
  58. package/dist/components/puck-block/faq-sections/faq-1/faq.d.ts +9 -7
  59. package/dist/components/puck-block/faq-sections/faq-1/faq.js +50 -44
  60. package/dist/components/puck-block/faq-sections/faq-1/index.js +12 -14
  61. package/dist/components/puck-block/faq-sections/faq-2/faq-2.d.ts +18 -0
  62. package/dist/components/puck-block/faq-sections/faq-2/faq-2.js +54 -0
  63. package/dist/components/puck-block/faq-sections/faq-2/index.d.ts +5 -0
  64. package/dist/components/puck-block/faq-sections/faq-2/index.js +61 -0
  65. package/dist/components/puck-block/faq-sections/props.d.ts +30 -0
  66. package/dist/components/puck-block/feature-sections/bento-1/bento.d.ts +6 -4
  67. package/dist/components/puck-block/feature-sections/bento-1/bento.js +2 -4
  68. package/dist/components/puck-block/feature-sections/bento-1/index.js +4 -5
  69. package/dist/components/puck-block/feature-sections/feature-cards-1/feature-cards.d.ts +8 -7
  70. package/dist/components/puck-block/feature-sections/feature-cards-1/feature-cards.js +15 -7
  71. package/dist/components/puck-block/feature-sections/feature-cards-1/index.js +37 -18
  72. package/dist/components/puck-block/feature-sections/feature-showcase-1/feature-showcase.d.ts +6 -4
  73. package/dist/components/puck-block/feature-sections/feature-showcase-1/feature-showcase.js +4 -12
  74. package/dist/components/puck-block/feature-sections/feature-showcase-1/index.js +4 -5
  75. package/dist/components/puck-block/feature-sections/icon-grid-1/icon-grid.d.ts +6 -4
  76. package/dist/components/puck-block/feature-sections/icon-grid-1/icon-grid.js +59 -53
  77. package/dist/components/puck-block/feature-sections/icon-grid-1/index.js +7 -8
  78. package/dist/components/puck-block/feature-sections/product-features-1/index.js +4 -5
  79. package/dist/components/puck-block/feature-sections/product-features-1/product-features.d.ts +6 -4
  80. package/dist/components/puck-block/feature-sections/product-features-1/product-features.js +7 -29
  81. package/dist/components/puck-block/feature-sections/props.d.ts +48 -0
  82. package/dist/components/puck-block/footer-sections/footer-1/footer.d.ts +5 -3
  83. package/dist/components/puck-block/footer-sections/footer-1/footer.js +6 -6
  84. package/dist/components/puck-block/footer-sections/footer-1/index.js +3 -5
  85. package/dist/components/puck-block/footer-sections/props.d.ts +31 -0
  86. package/dist/components/puck-block/gallery-sections/gallery-1/gallery.d.ts +9 -7
  87. package/dist/components/puck-block/gallery-sections/gallery-1/gallery.js +49 -40
  88. package/dist/components/puck-block/gallery-sections/gallery-1/index.js +32 -34
  89. package/dist/components/puck-block/gallery-sections/gallery-2/gallery-2.d.ts +16 -0
  90. package/dist/components/puck-block/gallery-sections/gallery-2/gallery-2.js +86 -0
  91. package/dist/components/puck-block/gallery-sections/gallery-2/index.d.ts +5 -0
  92. package/dist/components/puck-block/gallery-sections/gallery-2/index.js +42 -0
  93. package/dist/components/puck-block/gallery-sections/gallery-3/gallery-3.d.ts +19 -0
  94. package/dist/components/puck-block/gallery-sections/gallery-3/gallery-3.js +119 -0
  95. package/dist/components/puck-block/gallery-sections/gallery-3/index.d.ts +5 -0
  96. package/dist/components/puck-block/gallery-sections/gallery-3/index.js +59 -0
  97. package/dist/components/puck-block/gallery-sections/props.d.ts +26 -0
  98. package/dist/components/puck-block/header-sections/header-1/header.d.ts +7 -5
  99. package/dist/components/puck-block/header-sections/header-1/header.js +8 -9
  100. package/dist/components/puck-block/header-sections/header-1/index.d.ts +1 -1
  101. package/dist/components/puck-block/header-sections/header-1/index.js +13 -12
  102. package/dist/components/puck-block/header-sections/props.d.ts +41 -0
  103. package/dist/components/puck-block/header-sections/sticky-nav-1/index.js +12 -12
  104. package/dist/components/puck-block/header-sections/sticky-nav-1/sticky-nav.d.ts +8 -6
  105. package/dist/components/puck-block/header-sections/sticky-nav-1/sticky-nav.js +5 -5
  106. package/dist/components/puck-block/hero-sections/fullscreen-hero-1/fullscreen-hero.d.ts +11 -4
  107. package/dist/components/puck-block/hero-sections/fullscreen-hero-1/fullscreen-hero.js +60 -23
  108. package/dist/components/puck-block/hero-sections/fullscreen-hero-1/index.js +18 -6
  109. package/dist/components/puck-block/hero-sections/gradient-hero-1/gradient-hero.d.ts +9 -5
  110. package/dist/components/puck-block/hero-sections/gradient-hero-1/gradient-hero.js +37 -24
  111. package/dist/components/puck-block/hero-sections/gradient-hero-1/index.js +18 -15
  112. package/dist/components/puck-block/hero-sections/grid-hero-1/grid-hero.d.ts +7 -6
  113. package/dist/components/puck-block/hero-sections/grid-hero-1/grid-hero.js +7 -10
  114. package/dist/components/puck-block/hero-sections/grid-hero-1/index.js +43 -11
  115. package/dist/components/puck-block/hero-sections/hero-1/hero.d.ts +6 -4
  116. package/dist/components/puck-block/hero-sections/hero-1/hero.js +5 -7
  117. package/dist/components/puck-block/hero-sections/hero-1/index.js +4 -4
  118. package/dist/components/puck-block/hero-sections/image-hero-1/image-hero.d.ts +14 -8
  119. package/dist/components/puck-block/hero-sections/image-hero-1/image-hero.js +64 -60
  120. package/dist/components/puck-block/hero-sections/image-hero-1/index.js +16 -34
  121. package/dist/components/puck-block/hero-sections/props.d.ts +71 -0
  122. package/dist/components/puck-block/hero-sections/split-hero-1/index.js +6 -5
  123. package/dist/components/puck-block/hero-sections/split-hero-1/split-hero.d.ts +8 -8
  124. package/dist/components/puck-block/hero-sections/split-hero-1/split-hero.js +48 -47
  125. package/dist/components/puck-block/hero-sections/video-hero-1/index.js +4 -3
  126. package/dist/components/puck-block/hero-sections/video-hero-1/video-hero.d.ts +6 -2
  127. package/dist/components/puck-block/hero-sections/video-hero-1/video-hero.js +30 -22
  128. package/dist/components/puck-block/index.d.ts +15 -0
  129. package/dist/components/puck-block/location-sections/location-1/index.d.ts +5 -0
  130. package/dist/components/puck-block/location-sections/location-1/index.js +108 -0
  131. package/dist/components/puck-block/location-sections/location-1/location.d.ts +28 -0
  132. package/dist/components/puck-block/location-sections/location-1/location.js +137 -0
  133. package/dist/components/puck-block/location-sections/location-2/index.d.ts +5 -0
  134. package/dist/components/puck-block/location-sections/location-2/index.js +123 -0
  135. package/dist/components/puck-block/location-sections/location-2/location.d.ts +30 -0
  136. package/dist/components/puck-block/location-sections/location-2/location.js +131 -0
  137. package/dist/components/puck-block/location-sections/location-3/index.d.ts +5 -0
  138. package/dist/components/puck-block/location-sections/location-3/index.js +84 -0
  139. package/dist/components/puck-block/location-sections/location-3/location.d.ts +24 -0
  140. package/dist/components/puck-block/location-sections/location-3/location.js +127 -0
  141. package/dist/components/puck-block/location-sections/props.d.ts +45 -0
  142. package/dist/components/puck-block/metrics-sections/props.d.ts +43 -0
  143. package/dist/components/puck-block/metrics-sections/stats-1/index.js +6 -7
  144. package/dist/components/puck-block/metrics-sections/stats-1/stats.d.ts +7 -5
  145. package/dist/components/puck-block/metrics-sections/stats-1/stats.js +61 -55
  146. package/dist/components/puck-block/metrics-sections/stats-2/index.d.ts +5 -0
  147. package/dist/components/puck-block/metrics-sections/stats-2/index.js +76 -0
  148. package/dist/components/puck-block/metrics-sections/stats-2/stats-2.d.ts +18 -0
  149. package/dist/components/puck-block/metrics-sections/stats-2/stats-2.js +57 -0
  150. package/dist/components/puck-block/metrics-sections/stats-3/index.d.ts +5 -0
  151. package/dist/components/puck-block/metrics-sections/stats-3/index.js +86 -0
  152. package/dist/components/puck-block/metrics-sections/stats-3/stats-3.d.ts +18 -0
  153. package/dist/components/puck-block/metrics-sections/stats-3/stats-3.js +56 -0
  154. package/dist/components/puck-block/pricing-sections/comparison-1/comparison.d.ts +7 -5
  155. package/dist/components/puck-block/pricing-sections/comparison-1/comparison.js +45 -39
  156. package/dist/components/puck-block/pricing-sections/comparison-1/index.js +5 -7
  157. package/dist/components/puck-block/pricing-sections/pricing-1/index.js +10 -11
  158. package/dist/components/puck-block/pricing-sections/pricing-1/pricing.d.ts +8 -6
  159. package/dist/components/puck-block/pricing-sections/pricing-1/pricing.js +47 -35
  160. package/dist/components/puck-block/pricing-sections/pricing-2/index.d.ts +5 -0
  161. package/dist/components/puck-block/pricing-sections/pricing-2/index.js +151 -0
  162. package/dist/components/puck-block/pricing-sections/pricing-2/pricing-2.d.ts +26 -0
  163. package/dist/components/puck-block/pricing-sections/pricing-2/pricing-2.js +71 -0
  164. package/dist/components/puck-block/pricing-sections/props.d.ts +46 -0
  165. package/dist/components/puck-block/showcase-sections/before-after-1/before-after.d.ts +22 -0
  166. package/dist/components/puck-block/showcase-sections/before-after-1/before-after.js +71 -0
  167. package/dist/components/puck-block/showcase-sections/before-after-1/index.d.ts +5 -0
  168. package/dist/components/puck-block/showcase-sections/before-after-1/index.js +73 -0
  169. package/dist/components/puck-block/showcase-sections/case-study-1/case-study.d.ts +6 -2
  170. package/dist/components/puck-block/showcase-sections/case-study-1/case-study.js +30 -28
  171. package/dist/components/puck-block/showcase-sections/case-study-1/index.js +4 -3
  172. package/dist/components/puck-block/showcase-sections/props.d.ts +48 -0
  173. package/dist/components/puck-block/showcase-sections/step-by-step-1/index.js +3 -5
  174. package/dist/components/puck-block/showcase-sections/step-by-step-1/step-by-step.d.ts +6 -4
  175. package/dist/components/puck-block/showcase-sections/step-by-step-1/step-by-step.js +38 -41
  176. package/dist/components/puck-block/team-sections/props.d.ts +39 -0
  177. package/dist/components/puck-block/team-sections/team-grid-1/index.js +4 -5
  178. package/dist/components/puck-block/team-sections/team-grid-1/team-grid.d.ts +6 -4
  179. package/dist/components/puck-block/team-sections/team-grid-1/team-grid.js +27 -41
  180. package/dist/components/puck-block/team-sections/team-grid-2/index.d.ts +5 -0
  181. package/dist/components/puck-block/team-sections/team-grid-2/index.js +62 -0
  182. package/dist/components/puck-block/team-sections/team-grid-2/team-grid-2.d.ts +23 -0
  183. package/dist/components/puck-block/team-sections/team-grid-2/team-grid-2.js +44 -0
  184. package/dist/components/puck-block/team-sections/team-profiles-1/index.d.ts +5 -0
  185. package/dist/components/puck-block/team-sections/team-profiles-1/index.js +53 -0
  186. package/dist/components/puck-block/team-sections/team-profiles-1/team-profiles.d.ts +23 -0
  187. package/dist/components/puck-block/team-sections/team-profiles-1/team-profiles.js +105 -0
  188. package/dist/components/puck-block/testimonial-sections/customers-1/customers.d.ts +9 -7
  189. package/dist/components/puck-block/testimonial-sections/customers-1/customers.js +8 -11
  190. package/dist/components/puck-block/testimonial-sections/customers-1/index.js +17 -17
  191. package/dist/components/puck-block/testimonial-sections/logo-marquee-1/index.js +15 -12
  192. package/dist/components/puck-block/testimonial-sections/logo-marquee-1/logo-marquee.d.ts +7 -3
  193. package/dist/components/puck-block/testimonial-sections/logo-marquee-1/logo-marquee.js +34 -24
  194. package/dist/components/puck-block/testimonial-sections/logo-wall-1/index.d.ts +5 -0
  195. package/dist/components/puck-block/testimonial-sections/logo-wall-1/index.js +51 -0
  196. package/dist/components/puck-block/testimonial-sections/logo-wall-1/logo-wall.d.ts +17 -0
  197. package/dist/components/puck-block/testimonial-sections/logo-wall-1/logo-wall.js +55 -0
  198. package/dist/components/puck-block/testimonial-sections/props.d.ts +34 -0
  199. package/dist/components/puck-block/testimonial-sections/review-section-1/index.js +16 -15
  200. package/dist/components/puck-block/testimonial-sections/review-section-1/review-section.d.ts +8 -6
  201. package/dist/components/puck-block/testimonial-sections/review-section-1/review-section.js +25 -19
  202. package/dist/components/puck-block/testimonial-sections/testimonials-1/index.js +17 -17
  203. package/dist/components/puck-block/testimonial-sections/testimonials-1/testimonials.d.ts +8 -6
  204. package/dist/components/puck-block/testimonial-sections/testimonials-1/testimonials.js +76 -63
  205. package/dist/components/puck-block/text-sections/articles-1/articles.d.ts +7 -4
  206. package/dist/components/puck-block/text-sections/articles-1/articles.js +42 -22
  207. package/dist/components/puck-block/text-sections/articles-1/index.js +31 -19
  208. package/dist/components/puck-block/text-sections/content-section-1/content-section.d.ts +7 -5
  209. package/dist/components/puck-block/text-sections/content-section-1/content-section.js +11 -12
  210. package/dist/components/puck-block/text-sections/content-section-1/index.js +14 -14
  211. package/dist/components/puck-block/text-sections/props.d.ts +58 -0
  212. package/dist/components/puck-block/text-sections/rich-text-1/index.js +13 -15
  213. package/dist/components/puck-block/text-sections/rich-text-1/rich-text.d.ts +7 -5
  214. package/dist/components/puck-block/text-sections/rich-text-1/rich-text.js +11 -11
  215. package/dist/components/puck-block/text-sections/tab-section-1/index.js +4 -5
  216. package/dist/components/puck-block/text-sections/tab-section-1/tab-section.d.ts +6 -4
  217. package/dist/components/puck-block/text-sections/tab-section-1/tab-section.js +6 -7
  218. package/dist/components/puck-block/text-sections/timeline-1/index.js +3 -5
  219. package/dist/components/puck-block/text-sections/timeline-1/timeline.d.ts +6 -4
  220. package/dist/components/puck-block/text-sections/timeline-1/timeline.js +3 -5
  221. package/dist/components/puck-block/text-sections/two-column-1/index.js +4 -6
  222. package/dist/components/puck-block/text-sections/two-column-1/two-column.d.ts +6 -4
  223. package/dist/components/puck-block/text-sections/two-column-1/two-column.js +5 -7
  224. package/dist/components/shadcn/navigation-menu.d.ts +1 -1
  225. package/dist/components/shadcn/navigation-menu.js +33 -0
  226. package/dist/index.js +106 -75
  227. package/package.json +1 -1
@@ -9,6 +9,7 @@ import { Input } from "../../../shadcn/input.js";
9
9
  import { Label } from "../../../shadcn/label.js";
10
10
  import { Textarea } from "../../../shadcn/textarea.js";
11
11
  import { useEditorContext } from "../../../puck-base/editor-context.js";
12
+ import { submitFormLead } from "../api/form-leads.js";
12
13
  const DEFAULT_FIELDS = [
13
14
  { label: "Name", name: "name", type: "text", required: true },
14
15
  { label: "Email", name: "email", type: "email", required: true },
@@ -17,9 +18,9 @@ const DEFAULT_FIELDS = [
17
18
  { label: "Message", name: "message", type: "textarea", required: true }
18
19
  ];
19
20
  const ContactUs = (props) => {
20
- var _a, _b, _c, _d, _e, _f;
21
+ var _a, _b, _c, _d;
21
22
  const { isEditor: isEditorMode, siteId, domain } = useEditorContext();
22
- const formFields = ((_b = (_a = props.form) == null ? void 0 : _a.fields) == null ? void 0 : _b.length) ? props.form.fields : DEFAULT_FIELDS;
23
+ const formFields = ((_a = props.fields) == null ? void 0 : _a.length) ? props.fields : DEFAULT_FIELDS;
23
24
  const [values, setValues] = useState({});
24
25
  const [submitting, setSubmitting] = useState(false);
25
26
  const setValue = (name, value) => setValues((prev) => ({ ...prev, [name]: value }));
@@ -28,23 +29,14 @@ const ContactUs = (props) => {
28
29
  if (isEditorMode) return;
29
30
  setSubmitting(true);
30
31
  try {
31
- const baseUrl = (domain || "").replace(/\/$/, "");
32
- const res = await fetch(`${baseUrl}/api/form-leads`, {
33
- method: "POST",
34
- headers: { "Content-Type": "application/json" },
35
- body: JSON.stringify({
36
- site_id: siteId,
37
- name: values.name || "",
38
- email: values.email || "",
39
- phone: values.phone || "",
40
- message: values.message || "",
41
- source_page: typeof window !== "undefined" ? window.location.pathname : ""
42
- })
32
+ await submitFormLead(domain, {
33
+ site_id: siteId,
34
+ name: values.name || "",
35
+ email: values.email || "",
36
+ phone: values.phone || "",
37
+ message: values.message || "",
38
+ source_page: typeof window !== "undefined" ? window.location.pathname : ""
43
39
  });
44
- const data = await res.json().catch(() => null);
45
- if (!res.ok || !(data == null ? void 0 : data.success)) {
46
- throw new Error((data == null ? void 0 : data.errMsg) || `HTTP ${res.status}`);
47
- }
48
40
  toast.success("Message sent successfully!");
49
41
  setValues({});
50
42
  } catch (err) {
@@ -54,114 +46,123 @@ const ContactUs = (props) => {
54
46
  setSubmitting(false);
55
47
  }
56
48
  };
57
- const submitLabel = ((_d = (_c = props.form) == null ? void 0 : _c.button) == null ? void 0 : _d.label) ?? "Send Message";
58
- const submitIcon = ((_f = (_e = props.form) == null ? void 0 : _e.button) == null ? void 0 : _f.icon) ?? "send";
59
- return /* @__PURE__ */ jsx(CompoundContainer, { padding: props.padding, sectionStyle: props.sectionStyle, backgroundColor: props.backgroundColor, className: props.className, children: /* @__PURE__ */ jsxs("div", { className: "grid lg:grid-cols-2 gap-10", children: [
60
- /* @__PURE__ */ jsx(
61
- CompoundContent,
62
- {
63
- badge: props.badge,
64
- heading: props.heading,
65
- description: props.description,
66
- features: props.features,
67
- buttons: props.buttons,
68
- alignContent: "start",
69
- spacing: "normal"
70
- }
71
- ),
72
- /* @__PURE__ */ jsx("div", { className: "justify-center flex items-center", children: /* @__PURE__ */ jsxs(
73
- "form",
74
- {
75
- className: "rounded-md max-w-md w-full flex flex-col border p-8 gap-4",
76
- onSubmit: handleSubmit,
77
- children: [
78
- formFields.reduce((rows, field, i) => {
79
- var _a2, _b2, _c2;
80
- const fieldEl = /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
81
- /* @__PURE__ */ jsxs(Label, { htmlFor: `contact-${field.name}`, children: [
82
- field.label,
83
- field.required ? " *" : ""
84
- ] }),
85
- field.type === "textarea" ? /* @__PURE__ */ jsx(
86
- Textarea,
87
- {
88
- id: `contact-${field.name}`,
89
- value: values[field.name] ?? "",
90
- onChange: (e) => setValue(field.name, e.target.value),
91
- rows: 4,
92
- required: field.required
49
+ const submitLabel = props.submitLabel ?? "Send Message";
50
+ const submitIcon = props.submitIcon ?? "send";
51
+ return /* @__PURE__ */ jsx(
52
+ CompoundContainer,
53
+ {
54
+ padding: (_b = props.styles) == null ? void 0 : _b.padding,
55
+ sectionStyle: (_c = props.styles) == null ? void 0 : _c.sectionStyle,
56
+ backgroundColor: (_d = props.styles) == null ? void 0 : _d.backgroundColor,
57
+ className: props.className,
58
+ children: /* @__PURE__ */ jsxs("div", { className: "grid lg:grid-cols-2 gap-10", children: [
59
+ /* @__PURE__ */ jsx(
60
+ CompoundContent,
61
+ {
62
+ badge: props.badge,
63
+ heading: props.heading,
64
+ description: props.description,
65
+ features: props.features,
66
+ buttons: props.buttons,
67
+ alignContent: "start",
68
+ spacing: "normal"
69
+ }
70
+ ),
71
+ /* @__PURE__ */ jsx("div", { className: "justify-center flex items-center", children: /* @__PURE__ */ jsxs(
72
+ "form",
73
+ {
74
+ className: "rounded-md max-w-md w-full flex flex-col border p-8 gap-4",
75
+ onSubmit: handleSubmit,
76
+ children: [
77
+ formFields.reduce((rows, field, i) => {
78
+ var _a2, _b2, _c2;
79
+ const fieldEl = /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
80
+ /* @__PURE__ */ jsxs(Label, { htmlFor: `contact-${field.name}`, children: [
81
+ field.label,
82
+ field.required ? " *" : ""
83
+ ] }),
84
+ field.type === "textarea" ? /* @__PURE__ */ jsx(
85
+ Textarea,
86
+ {
87
+ id: `contact-${field.name}`,
88
+ value: values[field.name] ?? "",
89
+ onChange: (e) => setValue(field.name, e.target.value),
90
+ rows: 4,
91
+ required: field.required
92
+ }
93
+ ) : field.type === "select" ? /* @__PURE__ */ jsxs(
94
+ "select",
95
+ {
96
+ id: `contact-${field.name}`,
97
+ value: values[field.name] ?? "",
98
+ onChange: (e) => setValue(field.name, e.target.value),
99
+ className: "border-input bg-background ring-offset-background placeholder:text-muted-foreground focus-visible:ring-ring flex h-10 w-full rounded-md border px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",
100
+ required: field.required,
101
+ children: [
102
+ /* @__PURE__ */ jsx("option", { value: "", children: "Select..." }),
103
+ (_a2 = field.options) == null ? void 0 : _a2.map((opt) => /* @__PURE__ */ jsx("option", { value: opt, children: opt }, opt))
104
+ ]
105
+ }
106
+ ) : /* @__PURE__ */ jsx(
107
+ Input,
108
+ {
109
+ id: `contact-${field.name}`,
110
+ type: field.type,
111
+ value: values[field.name] ?? "",
112
+ onChange: (e) => setValue(field.name, e.target.value),
113
+ required: field.required
114
+ }
115
+ )
116
+ ] }, field.name);
117
+ if (field.half && ((_b2 = formFields[i + 1]) == null ? void 0 : _b2.half)) {
118
+ return rows;
93
119
  }
94
- ) : field.type === "select" ? /* @__PURE__ */ jsxs(
95
- "select",
96
- {
97
- id: `contact-${field.name}`,
98
- value: values[field.name] ?? "",
99
- onChange: (e) => setValue(field.name, e.target.value),
100
- className: "border-input bg-background ring-offset-background placeholder:text-muted-foreground focus-visible:ring-ring flex h-10 w-full rounded-md border px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",
101
- required: field.required,
102
- children: [
103
- /* @__PURE__ */ jsx("option", { value: "", children: "Select..." }),
104
- (_a2 = field.options) == null ? void 0 : _a2.map((opt) => /* @__PURE__ */ jsx("option", { value: opt, children: opt }, opt))
105
- ]
120
+ if (field.half && i > 0 && ((_c2 = formFields[i - 1]) == null ? void 0 : _c2.half)) {
121
+ const prevField = formFields[i - 1];
122
+ const prevEl = /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
123
+ /* @__PURE__ */ jsxs(Label, { htmlFor: `contact-${prevField.name}`, children: [
124
+ prevField.label,
125
+ prevField.required ? " *" : ""
126
+ ] }),
127
+ /* @__PURE__ */ jsx(
128
+ Input,
129
+ {
130
+ id: `contact-${prevField.name}`,
131
+ type: prevField.type,
132
+ value: values[prevField.name] ?? "",
133
+ onChange: (e) => setValue(prevField.name, e.target.value),
134
+ required: prevField.required
135
+ }
136
+ )
137
+ ] }, prevField.name);
138
+ rows.push(
139
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
140
+ prevEl,
141
+ fieldEl
142
+ ] }, `row-${prevField.name}-${field.name}`)
143
+ );
144
+ return rows;
106
145
  }
107
- ) : /* @__PURE__ */ jsx(
108
- Input,
146
+ rows.push(fieldEl);
147
+ return rows;
148
+ }, []),
149
+ /* @__PURE__ */ jsx(
150
+ CompoundButton,
109
151
  {
110
- id: `contact-${field.name}`,
111
- type: field.type,
112
- value: values[field.name] ?? "",
113
- onChange: (e) => setValue(field.name, e.target.value),
114
- required: field.required
152
+ label: submitting ? "Sending..." : submitLabel,
153
+ variant: props.submitVariant ?? "default",
154
+ size: props.submitSize ?? "default",
155
+ icon: submitting ? "loader" : submitIcon,
156
+ type: "submit",
157
+ disabled: submitting
115
158
  }
116
159
  )
117
- ] }, field.name);
118
- if (field.half && ((_b2 = formFields[i + 1]) == null ? void 0 : _b2.half)) {
119
- return rows;
120
- }
121
- if (field.half && i > 0 && ((_c2 = formFields[i - 1]) == null ? void 0 : _c2.half)) {
122
- const prevField = formFields[i - 1];
123
- const prevEl = /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
124
- /* @__PURE__ */ jsxs(Label, { htmlFor: `contact-${prevField.name}`, children: [
125
- prevField.label,
126
- prevField.required ? " *" : ""
127
- ] }),
128
- /* @__PURE__ */ jsx(
129
- Input,
130
- {
131
- id: `contact-${prevField.name}`,
132
- type: prevField.type,
133
- value: values[prevField.name] ?? "",
134
- onChange: (e) => setValue(prevField.name, e.target.value),
135
- required: prevField.required
136
- }
137
- )
138
- ] }, prevField.name);
139
- rows.push(
140
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
141
- prevEl,
142
- fieldEl
143
- ] }, `row-${prevField.name}-${field.name}`)
144
- );
145
- return rows;
146
- }
147
- rows.push(fieldEl);
148
- return rows;
149
- }, []),
150
- /* @__PURE__ */ jsx(
151
- CompoundButton,
152
- {
153
- label: submitting ? "Sending..." : submitLabel,
154
- variant: "default",
155
- size: "default",
156
- icon: submitting ? "loader" : submitIcon,
157
- type: "submit",
158
- disabled: submitting
159
- }
160
- )
161
- ]
162
- }
163
- ) })
164
- ] }) });
160
+ ]
161
+ }
162
+ ) })
163
+ ] })
164
+ }
165
+ );
165
166
  };
166
167
  export {
167
168
  ContactUs
@@ -1,12 +1,82 @@
1
- import { paddingDefaults, formDefaults, backgroundColor, sectionStyle, padding, form, contentFieldsWithFeatures } from "../../../puck-base/core/fields.js";
1
+ import { icon, contentFieldsWithFeatures } from "../../../puck-base/core/fields.js";
2
2
  import { ContactUs } from "./contact-us.js";
3
+ import { createStylesDefaults, createStylesField } from "../../../puck-base/core/styles.js";
4
+ const fieldTypeOptions = [
5
+ "text",
6
+ "email",
7
+ "tel",
8
+ "number",
9
+ "date",
10
+ "url",
11
+ "file",
12
+ "textarea",
13
+ "select"
14
+ ].map((t) => ({ label: t, value: t }));
3
15
  const conf = {
4
16
  fields: {
5
17
  ...contentFieldsWithFeatures,
6
- form,
7
- padding,
8
- sectionStyle,
9
- backgroundColor
18
+ formTitle: { type: "text", contentEditable: true },
19
+ fields: {
20
+ type: "array",
21
+ max: 10,
22
+ getItemSummary: (item, i = 0) => item.label || `Field ${i + 1}`,
23
+ arrayFields: {
24
+ label: { type: "text", contentEditable: true },
25
+ name: { type: "text" },
26
+ type: { type: "select", options: fieldTypeOptions },
27
+ required: {
28
+ type: "radio",
29
+ options: [
30
+ { label: "Yes", value: true },
31
+ { label: "No", value: false }
32
+ ]
33
+ },
34
+ half: {
35
+ type: "radio",
36
+ options: [
37
+ { label: "Yes", value: true },
38
+ { label: "No", value: false }
39
+ ]
40
+ }
41
+ },
42
+ defaultItemProps: {
43
+ label: "Field",
44
+ name: "field",
45
+ type: "text"
46
+ }
47
+ },
48
+ action: { type: "text", label: "Submit URL" },
49
+ method: {
50
+ type: "select",
51
+ label: "Submit Method",
52
+ options: [
53
+ { label: "GET", value: "get" },
54
+ { label: "POST", value: "post" },
55
+ { label: "Dialog", value: "dialog" }
56
+ ]
57
+ },
58
+ submitLabel: { type: "text" },
59
+ submitVariant: {
60
+ type: "select",
61
+ options: [
62
+ { label: "Primary", value: "default" },
63
+ { label: "Secondary", value: "secondary" },
64
+ { label: "Outline", value: "outline" },
65
+ { label: "Ghost", value: "ghost" },
66
+ { label: "Link", value: "link" },
67
+ { label: "Destructive", value: "destructive" }
68
+ ]
69
+ },
70
+ submitSize: {
71
+ type: "select",
72
+ options: [
73
+ { label: "Default", value: "default" },
74
+ { label: "Small", value: "sm" },
75
+ { label: "Large", value: "lg" }
76
+ ]
77
+ },
78
+ submitIcon: icon,
79
+ styles: createStylesField()
10
80
  },
11
81
  defaultProps: {
12
82
  badge: {
@@ -24,8 +94,18 @@ const conf = {
24
94
  description: "We've made it easy to use and understand."
25
95
  })
26
96
  ),
27
- form: formDefaults,
28
- padding: paddingDefaults
97
+ fields: [
98
+ { label: "Name", name: "name", type: "text", required: true },
99
+ { label: "Email", name: "email", type: "email", required: true },
100
+ { label: "Phone", name: "phone", type: "tel" },
101
+ { label: "Company", name: "company", type: "text" },
102
+ { label: "Message", name: "message", type: "textarea", required: true }
103
+ ],
104
+ submitLabel: "Send Message",
105
+ submitVariant: "default",
106
+ submitSize: "default",
107
+ submitIcon: "send",
108
+ styles: createStylesDefaults()
29
109
  },
30
110
  render: ContactUs
31
111
  };
@@ -0,0 +1,30 @@
1
+ import { CompoundContainerProps } from "@/components/puck-base/container";
2
+ export interface ContactUs2Button {
3
+ label: string;
4
+ variant?: string;
5
+ size?: string;
6
+ icon?: string;
7
+ }
8
+ export interface ContactUs2Props {
9
+ heading?: string;
10
+ description?: string;
11
+ fields?: Array<{
12
+ label: string;
13
+ name: string;
14
+ }>;
15
+ submitLabel?: string;
16
+ submitVariant?: string;
17
+ submitSize?: string;
18
+ submitIcon?: string;
19
+ image?: {
20
+ src: string;
21
+ alt: string;
22
+ };
23
+ styles?: {
24
+ imagePosition?: "start" | "end";
25
+ padding?: CompoundContainerProps["padding"];
26
+ sectionStyle?: CompoundContainerProps["sectionStyle"];
27
+ backgroundColor?: string;
28
+ };
29
+ }
30
+ export declare const ContactUs2: ({ heading, description, fields, submitLabel, submitVariant, submitSize, submitIcon, image, styles, }: ContactUs2Props) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,234 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useState } from "react";
4
+ import { toast } from "sonner";
5
+ import { cn } from "../../../../utils/css-utils.js";
6
+ import { CompoundContainer } from "../../../puck-base/container.js";
7
+ import { CompoundImage } from "../../../puck-base/image.js";
8
+ import { CompoundButton } from "../../../puck-base/button.js";
9
+ import { Input } from "../../../shadcn/input.js";
10
+ import { Label } from "../../../shadcn/label.js";
11
+ import { Textarea } from "../../../shadcn/textarea.js";
12
+ import { useEditorContext } from "../../../puck-base/editor-context.js";
13
+ import { submitFormLead } from "../api/form-leads.js";
14
+ const ContactUs2 = ({
15
+ heading,
16
+ description,
17
+ fields = [],
18
+ submitLabel,
19
+ submitVariant,
20
+ submitSize,
21
+ submitIcon,
22
+ image,
23
+ styles
24
+ }) => {
25
+ var _a, _b, _c, _d, _e;
26
+ const labels = {
27
+ name: ((_a = fields.find((field) => field.name === "name")) == null ? void 0 : _a.label) ?? "Your Name",
28
+ email: ((_b = fields.find((field) => field.name === "email")) == null ? void 0 : _b.label) ?? "Email Address",
29
+ phone: ((_c = fields.find((field) => field.name === "phone")) == null ? void 0 : _c.label) ?? "Phone",
30
+ company: ((_d = fields.find((field) => field.name === "company")) == null ? void 0 : _d.label) ?? "Company",
31
+ message: ((_e = fields.find((field) => field.name === "message")) == null ? void 0 : _e.label) ?? "Tell us about your fitness goals"
32
+ };
33
+ const imagePosition = (styles == null ? void 0 : styles.imagePosition) ?? "end";
34
+ const { isEditor: isEditorMode, siteId, domain } = useEditorContext();
35
+ const [name, setName] = useState("");
36
+ const [email, setEmail] = useState("");
37
+ const [phone, setPhone] = useState("");
38
+ const [company, setCompany] = useState("");
39
+ const [message, setMessage] = useState("");
40
+ const [submitting, setSubmitting] = useState(false);
41
+ const handleSubmit = async (e) => {
42
+ e.preventDefault();
43
+ if (isEditorMode) return;
44
+ setSubmitting(true);
45
+ try {
46
+ await submitFormLead(domain, {
47
+ site_id: siteId,
48
+ name: name || "",
49
+ email: email || "",
50
+ phone: phone || "",
51
+ message: message || "",
52
+ source_page: typeof window !== "undefined" ? window.location.pathname : ""
53
+ });
54
+ toast.success("Message sent successfully!");
55
+ setName("");
56
+ setEmail("");
57
+ setPhone("");
58
+ setCompany("");
59
+ setMessage("");
60
+ } catch (err) {
61
+ const msg = err instanceof Error ? err.message : "Failed to send message";
62
+ toast.error(msg);
63
+ } finally {
64
+ setSubmitting(false);
65
+ }
66
+ };
67
+ const contentCol = /* @__PURE__ */ jsx("div", { className: "flex w-full flex-col justify-center lg:basis-1/2", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col gap-8", children: [
68
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", children: [
69
+ heading && /* @__PURE__ */ jsx("h2", { className: "text-3xl font-bold leading-tight text-foreground lg:text-4xl", children: heading }),
70
+ description && /* @__PURE__ */ jsx("p", { className: "text-base text-muted-foreground", children: description })
71
+ ] }),
72
+ /* @__PURE__ */ jsxs("form", { className: "w-full space-y-4", onSubmit: handleSubmit, children: [
73
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
74
+ /* @__PURE__ */ jsx(
75
+ Label,
76
+ {
77
+ htmlFor: "contact2-name",
78
+ className: "text-sm font-medium text-foreground",
79
+ children: labels.name
80
+ }
81
+ ),
82
+ /* @__PURE__ */ jsx(
83
+ Input,
84
+ {
85
+ id: "contact2-name",
86
+ type: "text",
87
+ name: "name",
88
+ required: true,
89
+ className: "rounded-3xl",
90
+ value: name,
91
+ onChange: (e) => setName(e.target.value)
92
+ }
93
+ )
94
+ ] }),
95
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
96
+ /* @__PURE__ */ jsx(
97
+ Label,
98
+ {
99
+ htmlFor: "contact2-email",
100
+ className: "text-sm font-medium text-foreground",
101
+ children: labels.email
102
+ }
103
+ ),
104
+ /* @__PURE__ */ jsx(
105
+ Input,
106
+ {
107
+ id: "contact2-email",
108
+ type: "email",
109
+ name: "email",
110
+ required: true,
111
+ className: "rounded-3xl",
112
+ value: email,
113
+ onChange: (e) => setEmail(e.target.value)
114
+ }
115
+ )
116
+ ] }),
117
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
118
+ /* @__PURE__ */ jsx(
119
+ Label,
120
+ {
121
+ htmlFor: "contact2-phone",
122
+ className: "text-sm font-medium text-foreground",
123
+ children: labels.phone
124
+ }
125
+ ),
126
+ /* @__PURE__ */ jsx(
127
+ Input,
128
+ {
129
+ id: "contact2-phone",
130
+ type: "tel",
131
+ name: "phone",
132
+ className: "rounded-3xl",
133
+ value: phone,
134
+ onChange: (e) => setPhone(e.target.value)
135
+ }
136
+ )
137
+ ] }),
138
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
139
+ /* @__PURE__ */ jsx(
140
+ Label,
141
+ {
142
+ htmlFor: "contact2-company",
143
+ className: "text-sm font-medium text-foreground",
144
+ children: labels.company
145
+ }
146
+ ),
147
+ /* @__PURE__ */ jsx(
148
+ Input,
149
+ {
150
+ id: "contact2-company",
151
+ type: "text",
152
+ name: "company",
153
+ className: "rounded-3xl",
154
+ value: company,
155
+ onChange: (e) => setCompany(e.target.value)
156
+ }
157
+ )
158
+ ] }),
159
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
160
+ /* @__PURE__ */ jsx(
161
+ Label,
162
+ {
163
+ htmlFor: "contact2-message",
164
+ className: "text-sm font-medium text-foreground",
165
+ children: labels.message
166
+ }
167
+ ),
168
+ /* @__PURE__ */ jsx(
169
+ Textarea,
170
+ {
171
+ id: "contact2-message",
172
+ name: "message",
173
+ required: true,
174
+ className: "min-h-40 resize-y rounded-3xl",
175
+ value: message,
176
+ onChange: (e) => setMessage(e.target.value)
177
+ }
178
+ )
179
+ ] }),
180
+ /* @__PURE__ */ jsx(
181
+ CompoundButton,
182
+ {
183
+ label: submitting ? "Sending..." : submitLabel ?? "Send Message",
184
+ variant: submitVariant ?? "default",
185
+ size: submitSize ?? "default",
186
+ icon: submitting ? "loader" : submitIcon ?? "none",
187
+ type: "submit",
188
+ disabled: submitting
189
+ }
190
+ )
191
+ ] })
192
+ ] }) });
193
+ const imageCol = /* @__PURE__ */ jsx(
194
+ "div",
195
+ {
196
+ className: cn(
197
+ "relative w-full overflow-hidden rounded-3xl lg:basis-1/2 lg:self-stretch",
198
+ "aspect-square lg:aspect-auto"
199
+ ),
200
+ children: (image == null ? void 0 : image.src) ? /* @__PURE__ */ jsx(
201
+ CompoundImage,
202
+ {
203
+ src: image.src,
204
+ alt: image.alt ?? "",
205
+ className: "absolute inset-0 h-full w-full object-cover"
206
+ }
207
+ ) : /* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center justify-center bg-muted", children: /* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-sm", children: "Image" }) })
208
+ }
209
+ );
210
+ return /* @__PURE__ */ jsx(
211
+ CompoundContainer,
212
+ {
213
+ padding: styles == null ? void 0 : styles.padding,
214
+ sectionStyle: styles == null ? void 0 : styles.sectionStyle,
215
+ backgroundColor: styles == null ? void 0 : styles.backgroundColor,
216
+ children: /* @__PURE__ */ jsxs(
217
+ "div",
218
+ {
219
+ className: cn("flex flex-col gap-12 lg:items-stretch", {
220
+ "lg:flex-row": imagePosition === "end",
221
+ "lg:flex-row-reverse": imagePosition === "start"
222
+ }),
223
+ children: [
224
+ contentCol,
225
+ imageCol
226
+ ]
227
+ }
228
+ )
229
+ }
230
+ );
231
+ };
232
+ export {
233
+ ContactUs2
234
+ };
@@ -0,0 +1,5 @@
1
+ import { ComponentConfig } from "@puckeditor/core";
2
+ import { ContactUs2Props } from "./contact-us-2";
3
+ export type { ContactUs2Props };
4
+ export declare const conf: ComponentConfig<ContactUs2Props>;
5
+ export default conf;