@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.
package/dist/index.cjs CHANGED
@@ -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) {
@@ -4663,12 +4662,18 @@ function FooterLinksGrid({
4663
4662
  }
4664
4663
  );
4665
4664
  }
4665
+ var DEFAULT_STYLE_RULES = {
4666
+ formContainer: "flex items-stretch w-full",
4667
+ fieldsContainer: "",
4668
+ fieldClassName: "",
4669
+ formClassName: ""
4670
+ };
4666
4671
  var DEFAULT_FORM_FIELDS = [
4667
4672
  {
4668
4673
  name: "email",
4669
4674
  type: "email",
4670
4675
  label: "Email Address",
4671
- placeholder: "Enter your email",
4676
+ placeholder: "Email Address",
4672
4677
  required: true,
4673
4678
  columnSpan: 12
4674
4679
  }
@@ -4681,7 +4686,6 @@ function FooterSocialNewsletter({
4681
4686
  className,
4682
4687
  contentClassName,
4683
4688
  logoWrapperClassName,
4684
- logoClassName,
4685
4689
  gridClassName,
4686
4690
  navSectionClassName,
4687
4691
  navTitleClassName,
@@ -4690,16 +4694,7 @@ function FooterSocialNewsletter({
4690
4694
  socialColumnClassName,
4691
4695
  socialLinksClassName,
4692
4696
  socialLinkClassName,
4693
- formFields = DEFAULT_FORM_FIELDS,
4694
- formConfig,
4695
- onSubmit,
4696
- onSuccess,
4697
- onError,
4698
- successMessage,
4699
- buttonAction,
4700
- helperText,
4701
- formSlot,
4702
- privacyClassName,
4697
+ formEngineSetup,
4703
4698
  bottomClassName,
4704
4699
  copyrightClassName,
4705
4700
  background,
@@ -4709,104 +4704,36 @@ function FooterSocialNewsletter({
4709
4704
  patternOpacity,
4710
4705
  optixFlowConfig
4711
4706
  }) {
4712
- const {
4713
- uploadTokens,
4714
- uploadProgress,
4715
- isUploading,
4716
- uploadFiles,
4717
- removeFile,
4718
- resetUpload
4719
- } = integration.useFileUpload({ onError });
4720
- const { form, submissionError, formMethod, resetSubmissionState } = integration.useContactForm({
4721
- formFields,
4722
- formConfig,
4723
- onSubmit,
4724
- onSuccess: (data) => {
4725
- resetUpload();
4726
- onSuccess?.(data);
4727
- },
4728
- onError,
4729
- uploadTokens
4730
- });
4731
4707
  const renderForm = React4__namespace.useMemo(() => {
4732
- if (formSlot) return formSlot;
4733
- const defaultButtonAction = {
4734
- label: "Subscribe",
4708
+ if (!formEngineSetup) return null;
4709
+ const action = {
4735
4710
  variant: "default",
4736
- className: "h-12"
4711
+ icon: /* @__PURE__ */ jsxRuntime.jsx(DynamicIcon, { name: "lucide/arrow-right", size: 16 })
4737
4712
  };
4738
- const action = buttonAction || defaultButtonAction;
4739
- return /* @__PURE__ */ jsxRuntime.jsxs(
4740
- forms.Form,
4713
+ return /* @__PURE__ */ jsxRuntime.jsx(
4714
+ integration.FormEngine,
4741
4715
  {
4742
- form,
4743
- fields: formFields,
4744
- notificationConfig: {
4745
- submissionError,
4746
- successMessage
4747
- },
4748
- formConfig: {
4749
- endpoint: formConfig?.endpoint,
4750
- method: formMethod,
4751
- submissionConfig: formConfig?.submissionConfig,
4752
- formLayout: "button-group",
4753
- buttonGroupSize: "sm",
4754
- submitLabel: action.label,
4755
- submitVariant: action.variant || "default",
4756
- submitIconComponent: action.icon || /* @__PURE__ */ jsxRuntime.jsx(DynamicIcon, { name: "lucide/send" })
4757
- },
4758
- onNewSubmission: () => {
4759
- resetUpload();
4760
- resetSubmissionState();
4716
+ formEngineSetup: {
4717
+ ...formEngineSetup,
4718
+ formLayoutSettings: {
4719
+ ...formEngineSetup.formLayoutSettings,
4720
+ formLayout: "button-group",
4721
+ buttonGroupSetup: {
4722
+ ...formEngineSetup.formLayoutSettings?.buttonGroupSetup,
4723
+ size: "default",
4724
+ submitLabel: action.icon || action.label,
4725
+ submitVariant: action.variant
4726
+ }
4727
+ }
4761
4728
  },
4762
- children: [
4763
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-4 sm:flex-row", children: [
4764
- formFields.map((field) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(
4765
- integration.DynamicFormField,
4766
- {
4767
- field,
4768
- uploadProgress,
4769
- onFileUpload: uploadFiles,
4770
- onFileRemove: removeFile,
4771
- isUploading
4772
- }
4773
- ) }, field.name)),
4774
- /* @__PURE__ */ jsxRuntime.jsxs(
4775
- Pressable,
4776
- {
4777
- onClick: form.handleSubmit,
4778
- asButton: true,
4779
- variant: action.variant,
4780
- className: cn("h-12", action.className),
4781
- disabled: form.isSubmitting,
4782
- children: [
4783
- action.label,
4784
- action.iconAfter
4785
- ]
4786
- }
4787
- )
4788
- ] }),
4789
- helperText && (typeof helperText === "string" ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: cn("text-sm mt-2"), children: helperText }) : helperText)
4790
- ]
4729
+ defaultFields: DEFAULT_FORM_FIELDS,
4730
+ defaultStyleRules: {
4731
+ ...DEFAULT_STYLE_RULES,
4732
+ formContainer: cn(DEFAULT_STYLE_RULES.formContainer)
4733
+ }
4791
4734
  }
4792
4735
  );
4793
- }, [
4794
- formSlot,
4795
- formFields,
4796
- form,
4797
- formConfig,
4798
- formMethod,
4799
- buttonAction,
4800
- uploadProgress,
4801
- uploadFiles,
4802
- removeFile,
4803
- isUploading,
4804
- submissionError,
4805
- successMessage,
4806
- helperText,
4807
- resetUpload,
4808
- resetSubmissionState
4809
- ]);
4736
+ }, [formEngineSetup]);
4810
4737
  return /* @__PURE__ */ jsxRuntime.jsx(
4811
4738
  Section,
4812
4739
  {
@@ -4814,20 +4741,26 @@ function FooterSocialNewsletter({
4814
4741
  spacing,
4815
4742
  pattern,
4816
4743
  patternOpacity,
4817
- className: cn(className),
4744
+ className,
4818
4745
  containerClassName,
4819
4746
  children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(contentClassName), children: /* @__PURE__ */ jsxRuntime.jsxs("footer", { children: [
4820
4747
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-20", children: [
4821
4748
  logo && /* @__PURE__ */ jsxRuntime.jsx(
4822
- FooterLogo,
4749
+ Pressable,
4823
4750
  {
4824
- logo,
4825
- logoClassName: cn(
4826
- "flex items-center gap-2",
4827
- logoWrapperClassName
4828
- ),
4829
- logoImageClassName: cn("h-10", logoClassName),
4830
- optixFlowConfig
4751
+ href: logo.url || "/",
4752
+ className: cn("block mb-8 md:mb-12", logoWrapperClassName),
4753
+ children: /* @__PURE__ */ jsxRuntime.jsx(
4754
+ img.Img,
4755
+ {
4756
+ src: logo.src,
4757
+ className: cn(
4758
+ "h-16 object-contain w-auto max-w-full",
4759
+ logo.className
4760
+ ),
4761
+ optixFlowConfig
4762
+ }
4763
+ )
4831
4764
  }
4832
4765
  ),
4833
4766
  socialLinks && socialLinks.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("mt-6", socialColumnClassName), children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -4840,10 +4773,9 @@ function FooterSocialNewsletter({
4840
4773
  children: socialLinks.map((social, idx) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsx(
4841
4774
  SocialLinkIcon,
4842
4775
  {
4843
- href: social.href,
4844
- label: social.label,
4845
- iconNameOverride: social.iconNameOverride,
4846
- iconSize: 20,
4776
+ size: "icon-lg",
4777
+ variant: "ghost",
4778
+ ...social,
4847
4779
  className: cn(
4848
4780
  "opacity-80 transition-colors hover:opacity-100",
4849
4781
  socialLinkClassName
@@ -6353,7 +6285,7 @@ function FooterAnimatedSocial({
6353
6285
  }
6354
6286
  );
6355
6287
  }
6356
- var DEFAULT_STYLE_RULES = {
6288
+ var DEFAULT_STYLE_RULES2 = {
6357
6289
  formContainer: "flex w-full items-end border-b border-b-foreground/10",
6358
6290
  fieldsContainer: "",
6359
6291
  fieldClassName: "",
@@ -6476,9 +6408,9 @@ function FooterNewsletterMinimal({
6476
6408
  },
6477
6409
  defaultFields: DEFAULT_FORM_FIELDS2,
6478
6410
  defaultStyleRules: {
6479
- ...DEFAULT_STYLE_RULES,
6411
+ ...DEFAULT_STYLE_RULES2,
6480
6412
  formContainer: cn(
6481
- DEFAULT_STYLE_RULES.formContainer,
6413
+ DEFAULT_STYLE_RULES2.formContainer,
6482
6414
  newsletterFormClassName
6483
6415
  )
6484
6416
  }
package/dist/index.js CHANGED
@@ -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
  export { PageSpeedFormSubmissionError, generateInitialValues, generateValidationSchema, getColumnSpanClass, isValidEmail, submitPageSpeedForm, useContactForm, useFileUpload } from '@page-speed/forms/integration';
20
19
 
21
20
  // components/ui/container.tsx
@@ -4641,12 +4640,18 @@ function FooterLinksGrid({
4641
4640
  }
4642
4641
  );
4643
4642
  }
4643
+ var DEFAULT_STYLE_RULES = {
4644
+ formContainer: "flex items-stretch w-full",
4645
+ fieldsContainer: "",
4646
+ fieldClassName: "",
4647
+ formClassName: ""
4648
+ };
4644
4649
  var DEFAULT_FORM_FIELDS = [
4645
4650
  {
4646
4651
  name: "email",
4647
4652
  type: "email",
4648
4653
  label: "Email Address",
4649
- placeholder: "Enter your email",
4654
+ placeholder: "Email Address",
4650
4655
  required: true,
4651
4656
  columnSpan: 12
4652
4657
  }
@@ -4659,7 +4664,6 @@ function FooterSocialNewsletter({
4659
4664
  className,
4660
4665
  contentClassName,
4661
4666
  logoWrapperClassName,
4662
- logoClassName,
4663
4667
  gridClassName,
4664
4668
  navSectionClassName,
4665
4669
  navTitleClassName,
@@ -4668,16 +4672,7 @@ function FooterSocialNewsletter({
4668
4672
  socialColumnClassName,
4669
4673
  socialLinksClassName,
4670
4674
  socialLinkClassName,
4671
- formFields = DEFAULT_FORM_FIELDS,
4672
- formConfig,
4673
- onSubmit,
4674
- onSuccess,
4675
- onError,
4676
- successMessage,
4677
- buttonAction,
4678
- helperText,
4679
- formSlot,
4680
- privacyClassName,
4675
+ formEngineSetup,
4681
4676
  bottomClassName,
4682
4677
  copyrightClassName,
4683
4678
  background,
@@ -4687,104 +4682,36 @@ function FooterSocialNewsletter({
4687
4682
  patternOpacity,
4688
4683
  optixFlowConfig
4689
4684
  }) {
4690
- const {
4691
- uploadTokens,
4692
- uploadProgress,
4693
- isUploading,
4694
- uploadFiles,
4695
- removeFile,
4696
- resetUpload
4697
- } = useFileUpload({ onError });
4698
- const { form, submissionError, formMethod, resetSubmissionState } = useContactForm({
4699
- formFields,
4700
- formConfig,
4701
- onSubmit,
4702
- onSuccess: (data) => {
4703
- resetUpload();
4704
- onSuccess?.(data);
4705
- },
4706
- onError,
4707
- uploadTokens
4708
- });
4709
4685
  const renderForm = React4.useMemo(() => {
4710
- if (formSlot) return formSlot;
4711
- const defaultButtonAction = {
4712
- label: "Subscribe",
4686
+ if (!formEngineSetup) return null;
4687
+ const action = {
4713
4688
  variant: "default",
4714
- className: "h-12"
4689
+ icon: /* @__PURE__ */ jsx(DynamicIcon, { name: "lucide/arrow-right", size: 16 })
4715
4690
  };
4716
- const action = buttonAction || defaultButtonAction;
4717
- return /* @__PURE__ */ jsxs(
4718
- Form,
4691
+ return /* @__PURE__ */ jsx(
4692
+ FormEngine,
4719
4693
  {
4720
- form,
4721
- fields: formFields,
4722
- notificationConfig: {
4723
- submissionError,
4724
- successMessage
4725
- },
4726
- formConfig: {
4727
- endpoint: formConfig?.endpoint,
4728
- method: formMethod,
4729
- submissionConfig: formConfig?.submissionConfig,
4730
- formLayout: "button-group",
4731
- buttonGroupSize: "sm",
4732
- submitLabel: action.label,
4733
- submitVariant: action.variant || "default",
4734
- submitIconComponent: action.icon || /* @__PURE__ */ jsx(DynamicIcon, { name: "lucide/send" })
4735
- },
4736
- onNewSubmission: () => {
4737
- resetUpload();
4738
- resetSubmissionState();
4694
+ formEngineSetup: {
4695
+ ...formEngineSetup,
4696
+ formLayoutSettings: {
4697
+ ...formEngineSetup.formLayoutSettings,
4698
+ formLayout: "button-group",
4699
+ buttonGroupSetup: {
4700
+ ...formEngineSetup.formLayoutSettings?.buttonGroupSetup,
4701
+ size: "default",
4702
+ submitLabel: action.icon || action.label,
4703
+ submitVariant: action.variant
4704
+ }
4705
+ }
4739
4706
  },
4740
- children: [
4741
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4 sm:flex-row", children: [
4742
- formFields.map((field) => /* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsx(
4743
- DynamicFormField,
4744
- {
4745
- field,
4746
- uploadProgress,
4747
- onFileUpload: uploadFiles,
4748
- onFileRemove: removeFile,
4749
- isUploading
4750
- }
4751
- ) }, field.name)),
4752
- /* @__PURE__ */ jsxs(
4753
- Pressable,
4754
- {
4755
- onClick: form.handleSubmit,
4756
- asButton: true,
4757
- variant: action.variant,
4758
- className: cn("h-12", action.className),
4759
- disabled: form.isSubmitting,
4760
- children: [
4761
- action.label,
4762
- action.iconAfter
4763
- ]
4764
- }
4765
- )
4766
- ] }),
4767
- helperText && (typeof helperText === "string" ? /* @__PURE__ */ jsx("p", { className: cn("text-sm mt-2"), children: helperText }) : helperText)
4768
- ]
4707
+ defaultFields: DEFAULT_FORM_FIELDS,
4708
+ defaultStyleRules: {
4709
+ ...DEFAULT_STYLE_RULES,
4710
+ formContainer: cn(DEFAULT_STYLE_RULES.formContainer)
4711
+ }
4769
4712
  }
4770
4713
  );
4771
- }, [
4772
- formSlot,
4773
- formFields,
4774
- form,
4775
- formConfig,
4776
- formMethod,
4777
- buttonAction,
4778
- uploadProgress,
4779
- uploadFiles,
4780
- removeFile,
4781
- isUploading,
4782
- submissionError,
4783
- successMessage,
4784
- helperText,
4785
- resetUpload,
4786
- resetSubmissionState
4787
- ]);
4714
+ }, [formEngineSetup]);
4788
4715
  return /* @__PURE__ */ jsx(
4789
4716
  Section,
4790
4717
  {
@@ -4792,20 +4719,26 @@ function FooterSocialNewsletter({
4792
4719
  spacing,
4793
4720
  pattern,
4794
4721
  patternOpacity,
4795
- className: cn(className),
4722
+ className,
4796
4723
  containerClassName,
4797
4724
  children: /* @__PURE__ */ jsx("div", { className: cn(contentClassName), children: /* @__PURE__ */ jsxs("footer", { children: [
4798
4725
  /* @__PURE__ */ jsxs("div", { className: "mb-20", children: [
4799
4726
  logo && /* @__PURE__ */ jsx(
4800
- FooterLogo,
4727
+ Pressable,
4801
4728
  {
4802
- logo,
4803
- logoClassName: cn(
4804
- "flex items-center gap-2",
4805
- logoWrapperClassName
4806
- ),
4807
- logoImageClassName: cn("h-10", logoClassName),
4808
- optixFlowConfig
4729
+ href: logo.url || "/",
4730
+ className: cn("block mb-8 md:mb-12", logoWrapperClassName),
4731
+ children: /* @__PURE__ */ jsx(
4732
+ Img,
4733
+ {
4734
+ src: logo.src,
4735
+ className: cn(
4736
+ "h-16 object-contain w-auto max-w-full",
4737
+ logo.className
4738
+ ),
4739
+ optixFlowConfig
4740
+ }
4741
+ )
4809
4742
  }
4810
4743
  ),
4811
4744
  socialLinks && socialLinks.length > 0 && /* @__PURE__ */ jsx("div", { className: cn("mt-6", socialColumnClassName), children: /* @__PURE__ */ jsx(
@@ -4818,10 +4751,9 @@ function FooterSocialNewsletter({
4818
4751
  children: socialLinks.map((social, idx) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
4819
4752
  SocialLinkIcon,
4820
4753
  {
4821
- href: social.href,
4822
- label: social.label,
4823
- iconNameOverride: social.iconNameOverride,
4824
- iconSize: 20,
4754
+ size: "icon-lg",
4755
+ variant: "ghost",
4756
+ ...social,
4825
4757
  className: cn(
4826
4758
  "opacity-80 transition-colors hover:opacity-100",
4827
4759
  socialLinkClassName
@@ -6331,7 +6263,7 @@ function FooterAnimatedSocial({
6331
6263
  }
6332
6264
  );
6333
6265
  }
6334
- var DEFAULT_STYLE_RULES = {
6266
+ var DEFAULT_STYLE_RULES2 = {
6335
6267
  formContainer: "flex w-full items-end border-b border-b-foreground/10",
6336
6268
  fieldsContainer: "",
6337
6269
  fieldClassName: "",
@@ -6454,9 +6386,9 @@ function FooterNewsletterMinimal({
6454
6386
  },
6455
6387
  defaultFields: DEFAULT_FORM_FIELDS2,
6456
6388
  defaultStyleRules: {
6457
- ...DEFAULT_STYLE_RULES,
6389
+ ...DEFAULT_STYLE_RULES2,
6458
6390
  formContainer: cn(
6459
- DEFAULT_STYLE_RULES.formContainer,
6391
+ DEFAULT_STYLE_RULES2.formContainer,
6460
6392
  newsletterFormClassName
6461
6393
  )
6462
6394
  }