@opensite/ui 2.5.0 → 2.5.1

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.
@@ -15,7 +15,6 @@ var PopoverPrimitive = require('@radix-ui/react-popover');
15
15
  var icon = require('@page-speed/icon');
16
16
  var usePlatformFromUrl = require('@opensite/hooks/usePlatformFromUrl');
17
17
  var TabsPrimitive = require('@radix-ui/react-tabs');
18
- var forms = require('@page-speed/forms');
19
18
  var integration = require('@page-speed/forms/integration');
20
19
 
21
20
  function _interopNamespace(e) {
@@ -4602,12 +4601,18 @@ function FooterLinksGrid({
4602
4601
  }
4603
4602
  );
4604
4603
  }
4604
+ var DEFAULT_STYLE_RULES = {
4605
+ formContainer: "flex items-stretch w-full",
4606
+ fieldsContainer: "",
4607
+ fieldClassName: "",
4608
+ formClassName: ""
4609
+ };
4605
4610
  var DEFAULT_FORM_FIELDS = [
4606
4611
  {
4607
4612
  name: "email",
4608
4613
  type: "email",
4609
4614
  label: "Email Address",
4610
- placeholder: "Enter your email",
4615
+ placeholder: "Email Address",
4611
4616
  required: true,
4612
4617
  columnSpan: 12
4613
4618
  }
@@ -4620,7 +4625,6 @@ function FooterSocialNewsletter({
4620
4625
  className,
4621
4626
  contentClassName,
4622
4627
  logoWrapperClassName,
4623
- logoClassName,
4624
4628
  gridClassName,
4625
4629
  navSectionClassName,
4626
4630
  navTitleClassName,
@@ -4629,16 +4633,7 @@ function FooterSocialNewsletter({
4629
4633
  socialColumnClassName,
4630
4634
  socialLinksClassName,
4631
4635
  socialLinkClassName,
4632
- formFields = DEFAULT_FORM_FIELDS,
4633
- formConfig,
4634
- onSubmit,
4635
- onSuccess,
4636
- onError,
4637
- successMessage,
4638
- buttonAction,
4639
- helperText,
4640
- formSlot,
4641
- privacyClassName,
4636
+ formEngineSetup,
4642
4637
  bottomClassName,
4643
4638
  copyrightClassName,
4644
4639
  background,
@@ -4648,104 +4643,36 @@ function FooterSocialNewsletter({
4648
4643
  patternOpacity,
4649
4644
  optixFlowConfig
4650
4645
  }) {
4651
- const {
4652
- uploadTokens,
4653
- uploadProgress,
4654
- isUploading,
4655
- uploadFiles,
4656
- removeFile,
4657
- resetUpload
4658
- } = integration.useFileUpload({ onError });
4659
- const { form, submissionError, formMethod, resetSubmissionState } = integration.useContactForm({
4660
- formFields,
4661
- formConfig,
4662
- onSubmit,
4663
- onSuccess: (data) => {
4664
- resetUpload();
4665
- onSuccess?.(data);
4666
- },
4667
- onError,
4668
- uploadTokens
4669
- });
4670
4646
  const renderForm = React4__namespace.useMemo(() => {
4671
- if (formSlot) return formSlot;
4672
- const defaultButtonAction = {
4673
- label: "Subscribe",
4647
+ if (!formEngineSetup) return null;
4648
+ const action = {
4674
4649
  variant: "default",
4675
- className: "h-12"
4650
+ icon: /* @__PURE__ */ jsxRuntime.jsx(DynamicIcon, { name: "lucide/arrow-right", size: 16 })
4676
4651
  };
4677
- const action = buttonAction || defaultButtonAction;
4678
- return /* @__PURE__ */ jsxRuntime.jsxs(
4679
- forms.Form,
4652
+ return /* @__PURE__ */ jsxRuntime.jsx(
4653
+ integration.FormEngine,
4680
4654
  {
4681
- form,
4682
- fields: formFields,
4683
- notificationConfig: {
4684
- submissionError,
4685
- successMessage
4686
- },
4687
- formConfig: {
4688
- endpoint: formConfig?.endpoint,
4689
- method: formMethod,
4690
- submissionConfig: formConfig?.submissionConfig,
4691
- formLayout: "button-group",
4692
- buttonGroupSize: "sm",
4693
- submitLabel: action.label,
4694
- submitVariant: action.variant || "default",
4695
- submitIconComponent: action.icon || /* @__PURE__ */ jsxRuntime.jsx(DynamicIcon, { name: "lucide/send" })
4696
- },
4697
- onNewSubmission: () => {
4698
- resetUpload();
4699
- resetSubmissionState();
4655
+ formEngineSetup: {
4656
+ ...formEngineSetup,
4657
+ formLayoutSettings: {
4658
+ ...formEngineSetup.formLayoutSettings,
4659
+ formLayout: "button-group",
4660
+ buttonGroupSetup: {
4661
+ ...formEngineSetup.formLayoutSettings?.buttonGroupSetup,
4662
+ size: "default",
4663
+ submitLabel: action.icon || action.label,
4664
+ submitVariant: action.variant
4665
+ }
4666
+ }
4700
4667
  },
4701
- children: [
4702
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-4 sm:flex-row", children: [
4703
- formFields.map((field) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(
4704
- integration.DynamicFormField,
4705
- {
4706
- field,
4707
- uploadProgress,
4708
- onFileUpload: uploadFiles,
4709
- onFileRemove: removeFile,
4710
- isUploading
4711
- }
4712
- ) }, field.name)),
4713
- /* @__PURE__ */ jsxRuntime.jsxs(
4714
- Pressable,
4715
- {
4716
- onClick: form.handleSubmit,
4717
- asButton: true,
4718
- variant: action.variant,
4719
- className: cn("h-12", action.className),
4720
- disabled: form.isSubmitting,
4721
- children: [
4722
- action.label,
4723
- action.iconAfter
4724
- ]
4725
- }
4726
- )
4727
- ] }),
4728
- helperText && (typeof helperText === "string" ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: cn("text-sm mt-2"), children: helperText }) : helperText)
4729
- ]
4668
+ defaultFields: DEFAULT_FORM_FIELDS,
4669
+ defaultStyleRules: {
4670
+ ...DEFAULT_STYLE_RULES,
4671
+ formContainer: cn(DEFAULT_STYLE_RULES.formContainer)
4672
+ }
4730
4673
  }
4731
4674
  );
4732
- }, [
4733
- formSlot,
4734
- formFields,
4735
- form,
4736
- formConfig,
4737
- formMethod,
4738
- buttonAction,
4739
- uploadProgress,
4740
- uploadFiles,
4741
- removeFile,
4742
- isUploading,
4743
- submissionError,
4744
- successMessage,
4745
- helperText,
4746
- resetUpload,
4747
- resetSubmissionState
4748
- ]);
4675
+ }, [formEngineSetup]);
4749
4676
  return /* @__PURE__ */ jsxRuntime.jsx(
4750
4677
  Section,
4751
4678
  {
@@ -4753,20 +4680,26 @@ function FooterSocialNewsletter({
4753
4680
  spacing,
4754
4681
  pattern,
4755
4682
  patternOpacity,
4756
- className: cn(className),
4683
+ className,
4757
4684
  containerClassName,
4758
4685
  children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(contentClassName), children: /* @__PURE__ */ jsxRuntime.jsxs("footer", { children: [
4759
4686
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-20", children: [
4760
4687
  logo && /* @__PURE__ */ jsxRuntime.jsx(
4761
- FooterLogo,
4688
+ Pressable,
4762
4689
  {
4763
- logo,
4764
- logoClassName: cn(
4765
- "flex items-center gap-2",
4766
- logoWrapperClassName
4767
- ),
4768
- logoImageClassName: cn("h-10", logoClassName),
4769
- optixFlowConfig
4690
+ href: logo.url || "/",
4691
+ className: cn("block mb-8 md:mb-12", logoWrapperClassName),
4692
+ children: /* @__PURE__ */ jsxRuntime.jsx(
4693
+ img.Img,
4694
+ {
4695
+ src: logo.src,
4696
+ className: cn(
4697
+ "h-16 object-contain w-auto max-w-full",
4698
+ logo.className
4699
+ ),
4700
+ optixFlowConfig
4701
+ }
4702
+ )
4770
4703
  }
4771
4704
  ),
4772
4705
  socialLinks && socialLinks.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("mt-6", socialColumnClassName), children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -4779,10 +4712,9 @@ function FooterSocialNewsletter({
4779
4712
  children: socialLinks.map((social, idx) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsx(
4780
4713
  SocialLinkIcon,
4781
4714
  {
4782
- href: social.href,
4783
- label: social.label,
4784
- iconNameOverride: social.iconNameOverride,
4785
- iconSize: 20,
4715
+ size: "icon-lg",
4716
+ variant: "ghost",
4717
+ ...social,
4786
4718
  className: cn(
4787
4719
  "opacity-80 transition-colors hover:opacity-100",
4788
4720
  socialLinkClassName
@@ -6292,7 +6224,7 @@ function FooterAnimatedSocial({
6292
6224
  }
6293
6225
  );
6294
6226
  }
6295
- var DEFAULT_STYLE_RULES = {
6227
+ var DEFAULT_STYLE_RULES2 = {
6296
6228
  formContainer: "flex w-full items-end border-b border-b-foreground/10",
6297
6229
  fieldsContainer: "",
6298
6230
  fieldClassName: "",
@@ -6415,9 +6347,9 @@ function FooterNewsletterMinimal({
6415
6347
  },
6416
6348
  defaultFields: DEFAULT_FORM_FIELDS2,
6417
6349
  defaultStyleRules: {
6418
- ...DEFAULT_STYLE_RULES,
6350
+ ...DEFAULT_STYLE_RULES2,
6419
6351
  formContainer: cn(
6420
- DEFAULT_STYLE_RULES.formContainer,
6352
+ DEFAULT_STYLE_RULES2.formContainer,
6421
6353
  newsletterFormClassName
6422
6354
  )
6423
6355
  }
@@ -14,8 +14,7 @@ import * as PopoverPrimitive from '@radix-ui/react-popover';
14
14
  import { Icon } from '@page-speed/icon';
15
15
  import { usePlatformFromUrl } from '@opensite/hooks/usePlatformFromUrl';
16
16
  import * as TabsPrimitive from '@radix-ui/react-tabs';
17
- import { Form } from '@page-speed/forms';
18
- import { useFileUpload, useContactForm, DynamicFormField, FormEngine } from '@page-speed/forms/integration';
17
+ import { FormEngine } from '@page-speed/forms/integration';
19
18
 
20
19
  // components/ui/container.tsx
21
20
  function cn(...inputs) {
@@ -4579,12 +4578,18 @@ function FooterLinksGrid({
4579
4578
  }
4580
4579
  );
4581
4580
  }
4581
+ var DEFAULT_STYLE_RULES = {
4582
+ formContainer: "flex items-stretch w-full",
4583
+ fieldsContainer: "",
4584
+ fieldClassName: "",
4585
+ formClassName: ""
4586
+ };
4582
4587
  var DEFAULT_FORM_FIELDS = [
4583
4588
  {
4584
4589
  name: "email",
4585
4590
  type: "email",
4586
4591
  label: "Email Address",
4587
- placeholder: "Enter your email",
4592
+ placeholder: "Email Address",
4588
4593
  required: true,
4589
4594
  columnSpan: 12
4590
4595
  }
@@ -4597,7 +4602,6 @@ function FooterSocialNewsletter({
4597
4602
  className,
4598
4603
  contentClassName,
4599
4604
  logoWrapperClassName,
4600
- logoClassName,
4601
4605
  gridClassName,
4602
4606
  navSectionClassName,
4603
4607
  navTitleClassName,
@@ -4606,16 +4610,7 @@ function FooterSocialNewsletter({
4606
4610
  socialColumnClassName,
4607
4611
  socialLinksClassName,
4608
4612
  socialLinkClassName,
4609
- formFields = DEFAULT_FORM_FIELDS,
4610
- formConfig,
4611
- onSubmit,
4612
- onSuccess,
4613
- onError,
4614
- successMessage,
4615
- buttonAction,
4616
- helperText,
4617
- formSlot,
4618
- privacyClassName,
4613
+ formEngineSetup,
4619
4614
  bottomClassName,
4620
4615
  copyrightClassName,
4621
4616
  background,
@@ -4625,104 +4620,36 @@ function FooterSocialNewsletter({
4625
4620
  patternOpacity,
4626
4621
  optixFlowConfig
4627
4622
  }) {
4628
- const {
4629
- uploadTokens,
4630
- uploadProgress,
4631
- isUploading,
4632
- uploadFiles,
4633
- removeFile,
4634
- resetUpload
4635
- } = useFileUpload({ onError });
4636
- const { form, submissionError, formMethod, resetSubmissionState } = useContactForm({
4637
- formFields,
4638
- formConfig,
4639
- onSubmit,
4640
- onSuccess: (data) => {
4641
- resetUpload();
4642
- onSuccess?.(data);
4643
- },
4644
- onError,
4645
- uploadTokens
4646
- });
4647
4623
  const renderForm = React4.useMemo(() => {
4648
- if (formSlot) return formSlot;
4649
- const defaultButtonAction = {
4650
- label: "Subscribe",
4624
+ if (!formEngineSetup) return null;
4625
+ const action = {
4651
4626
  variant: "default",
4652
- className: "h-12"
4627
+ icon: /* @__PURE__ */ jsx(DynamicIcon, { name: "lucide/arrow-right", size: 16 })
4653
4628
  };
4654
- const action = buttonAction || defaultButtonAction;
4655
- return /* @__PURE__ */ jsxs(
4656
- Form,
4629
+ return /* @__PURE__ */ jsx(
4630
+ FormEngine,
4657
4631
  {
4658
- form,
4659
- fields: formFields,
4660
- notificationConfig: {
4661
- submissionError,
4662
- successMessage
4663
- },
4664
- formConfig: {
4665
- endpoint: formConfig?.endpoint,
4666
- method: formMethod,
4667
- submissionConfig: formConfig?.submissionConfig,
4668
- formLayout: "button-group",
4669
- buttonGroupSize: "sm",
4670
- submitLabel: action.label,
4671
- submitVariant: action.variant || "default",
4672
- submitIconComponent: action.icon || /* @__PURE__ */ jsx(DynamicIcon, { name: "lucide/send" })
4673
- },
4674
- onNewSubmission: () => {
4675
- resetUpload();
4676
- resetSubmissionState();
4632
+ formEngineSetup: {
4633
+ ...formEngineSetup,
4634
+ formLayoutSettings: {
4635
+ ...formEngineSetup.formLayoutSettings,
4636
+ formLayout: "button-group",
4637
+ buttonGroupSetup: {
4638
+ ...formEngineSetup.formLayoutSettings?.buttonGroupSetup,
4639
+ size: "default",
4640
+ submitLabel: action.icon || action.label,
4641
+ submitVariant: action.variant
4642
+ }
4643
+ }
4677
4644
  },
4678
- children: [
4679
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4 sm:flex-row", children: [
4680
- formFields.map((field) => /* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsx(
4681
- DynamicFormField,
4682
- {
4683
- field,
4684
- uploadProgress,
4685
- onFileUpload: uploadFiles,
4686
- onFileRemove: removeFile,
4687
- isUploading
4688
- }
4689
- ) }, field.name)),
4690
- /* @__PURE__ */ jsxs(
4691
- Pressable,
4692
- {
4693
- onClick: form.handleSubmit,
4694
- asButton: true,
4695
- variant: action.variant,
4696
- className: cn("h-12", action.className),
4697
- disabled: form.isSubmitting,
4698
- children: [
4699
- action.label,
4700
- action.iconAfter
4701
- ]
4702
- }
4703
- )
4704
- ] }),
4705
- helperText && (typeof helperText === "string" ? /* @__PURE__ */ jsx("p", { className: cn("text-sm mt-2"), children: helperText }) : helperText)
4706
- ]
4645
+ defaultFields: DEFAULT_FORM_FIELDS,
4646
+ defaultStyleRules: {
4647
+ ...DEFAULT_STYLE_RULES,
4648
+ formContainer: cn(DEFAULT_STYLE_RULES.formContainer)
4649
+ }
4707
4650
  }
4708
4651
  );
4709
- }, [
4710
- formSlot,
4711
- formFields,
4712
- form,
4713
- formConfig,
4714
- formMethod,
4715
- buttonAction,
4716
- uploadProgress,
4717
- uploadFiles,
4718
- removeFile,
4719
- isUploading,
4720
- submissionError,
4721
- successMessage,
4722
- helperText,
4723
- resetUpload,
4724
- resetSubmissionState
4725
- ]);
4652
+ }, [formEngineSetup]);
4726
4653
  return /* @__PURE__ */ jsx(
4727
4654
  Section,
4728
4655
  {
@@ -4730,20 +4657,26 @@ function FooterSocialNewsletter({
4730
4657
  spacing,
4731
4658
  pattern,
4732
4659
  patternOpacity,
4733
- className: cn(className),
4660
+ className,
4734
4661
  containerClassName,
4735
4662
  children: /* @__PURE__ */ jsx("div", { className: cn(contentClassName), children: /* @__PURE__ */ jsxs("footer", { children: [
4736
4663
  /* @__PURE__ */ jsxs("div", { className: "mb-20", children: [
4737
4664
  logo && /* @__PURE__ */ jsx(
4738
- FooterLogo,
4665
+ Pressable,
4739
4666
  {
4740
- logo,
4741
- logoClassName: cn(
4742
- "flex items-center gap-2",
4743
- logoWrapperClassName
4744
- ),
4745
- logoImageClassName: cn("h-10", logoClassName),
4746
- optixFlowConfig
4667
+ href: logo.url || "/",
4668
+ className: cn("block mb-8 md:mb-12", logoWrapperClassName),
4669
+ children: /* @__PURE__ */ jsx(
4670
+ Img,
4671
+ {
4672
+ src: logo.src,
4673
+ className: cn(
4674
+ "h-16 object-contain w-auto max-w-full",
4675
+ logo.className
4676
+ ),
4677
+ optixFlowConfig
4678
+ }
4679
+ )
4747
4680
  }
4748
4681
  ),
4749
4682
  socialLinks && socialLinks.length > 0 && /* @__PURE__ */ jsx("div", { className: cn("mt-6", socialColumnClassName), children: /* @__PURE__ */ jsx(
@@ -4756,10 +4689,9 @@ function FooterSocialNewsletter({
4756
4689
  children: socialLinks.map((social, idx) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
4757
4690
  SocialLinkIcon,
4758
4691
  {
4759
- href: social.href,
4760
- label: social.label,
4761
- iconNameOverride: social.iconNameOverride,
4762
- iconSize: 20,
4692
+ size: "icon-lg",
4693
+ variant: "ghost",
4694
+ ...social,
4763
4695
  className: cn(
4764
4696
  "opacity-80 transition-colors hover:opacity-100",
4765
4697
  socialLinkClassName
@@ -6269,7 +6201,7 @@ function FooterAnimatedSocial({
6269
6201
  }
6270
6202
  );
6271
6203
  }
6272
- var DEFAULT_STYLE_RULES = {
6204
+ var DEFAULT_STYLE_RULES2 = {
6273
6205
  formContainer: "flex w-full items-end border-b border-b-foreground/10",
6274
6206
  fieldsContainer: "",
6275
6207
  fieldClassName: "",
@@ -6392,9 +6324,9 @@ function FooterNewsletterMinimal({
6392
6324
  },
6393
6325
  defaultFields: DEFAULT_FORM_FIELDS2,
6394
6326
  defaultStyleRules: {
6395
- ...DEFAULT_STYLE_RULES,
6327
+ ...DEFAULT_STYLE_RULES2,
6396
6328
  formContainer: cn(
6397
- DEFAULT_STYLE_RULES.formContainer,
6329
+ DEFAULT_STYLE_RULES2.formContainer,
6398
6330
  newsletterFormClassName
6399
6331
  )
6400
6332
  }