@opensite/ui 2.5.0 → 2.5.2

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.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: "",
@@ -6369,6 +6301,7 @@ function FooterNewsletterMinimal({
6369
6301
  socialLinksClassName,
6370
6302
  socialLinkClassName,
6371
6303
  newsletterSectionClassName,
6304
+ newsletterLabelClassName,
6372
6305
  newsletterFormClassName,
6373
6306
  bottomGridClassName,
6374
6307
  locationClassName,
@@ -6454,9 +6387,9 @@ function FooterNewsletterMinimal({
6454
6387
  },
6455
6388
  defaultFields: DEFAULT_FORM_FIELDS2,
6456
6389
  defaultStyleRules: {
6457
- ...DEFAULT_STYLE_RULES,
6390
+ ...DEFAULT_STYLE_RULES2,
6458
6391
  formContainer: cn(
6459
- DEFAULT_STYLE_RULES.formContainer,
6392
+ DEFAULT_STYLE_RULES2.formContainer,
6460
6393
  newsletterFormClassName
6461
6394
  )
6462
6395
  }
@@ -6482,29 +6415,41 @@ function FooterNewsletterMinimal({
6482
6415
  ),
6483
6416
  children: [
6484
6417
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-10", children: [
6485
- heading && /* @__PURE__ */ jsx(
6486
- "p",
6487
- {
6488
- className: cn(
6489
- "relative text-4xl font-medium tracking-tight lg:text-5xl",
6490
- headingClassName
6491
- ),
6492
- children: heading
6493
- }
6494
- ),
6495
- (supportLabel || supportEmail) && /* @__PURE__ */ jsxs(
6418
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", children: [
6419
+ heading && /* @__PURE__ */ jsx(
6420
+ "h2",
6421
+ {
6422
+ className: cn(
6423
+ "relative text-4xl font-semibold tracking-tight lg:text-5xl text-balance",
6424
+ headingClassName
6425
+ ),
6426
+ children: heading
6427
+ }
6428
+ ),
6429
+ location && /* @__PURE__ */ jsx(
6430
+ "div",
6431
+ {
6432
+ className: cn(
6433
+ "font-semibold text-lg opacity-75",
6434
+ locationClassName
6435
+ ),
6436
+ children: location
6437
+ }
6438
+ )
6439
+ ] }),
6440
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-4", children: (supportLabel || supportEmail) && /* @__PURE__ */ jsxs(
6496
6441
  "div",
6497
6442
  {
6498
6443
  className: cn(
6499
- "space-y-1 text-sm font-light tracking-tight lg:text-base",
6444
+ "space-y-1 text-sm tracking-tight lg:text-base",
6500
6445
  supportClassName
6501
6446
  ),
6502
6447
  children: [
6503
- supportLabel && /* @__PURE__ */ jsx("p", { children: supportLabel }),
6504
- supportEmail && /* @__PURE__ */ jsx(Pressable, { href: `mailto:${supportEmail}`, children: supportEmail })
6448
+ supportLabel && /* @__PURE__ */ jsx("p", { className: "font-light opacity-75", children: supportLabel }),
6449
+ supportEmail && /* @__PURE__ */ jsx(Pressable, { className: "font-semibold", href: supportEmail, children: supportEmail })
6505
6450
  ]
6506
6451
  }
6507
- )
6452
+ ) })
6508
6453
  ] }),
6509
6454
  /* @__PURE__ */ jsxs(
6510
6455
  "div",
@@ -6522,41 +6467,35 @@ function FooterNewsletterMinimal({
6522
6467
  ]
6523
6468
  }
6524
6469
  ),
6525
- /* @__PURE__ */ jsxs(
6470
+ /* @__PURE__ */ jsx(
6526
6471
  "div",
6527
6472
  {
6528
6473
  className: cn(
6529
6474
  "mt-20 flex flex-col justify-between gap-15 lg:flex-row",
6530
6475
  newsletterSectionClassName
6531
6476
  ),
6532
- children: [
6533
- formEngineSetup && /* @__PURE__ */ jsx("div", { className: "flex w-full max-w-md flex-col gap-10", children: /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-sm font-light tracking-tight lg:text-base", children: [
6534
- newsletterLabel && /* @__PURE__ */ jsx("p", { children: newsletterLabel }),
6535
- renderForm
6536
- ] }) }),
6537
- /* @__PURE__ */ jsxs(
6538
- "div",
6477
+ children: formEngineSetup && /* @__PURE__ */ jsx("div", { className: "flex w-full max-w-md flex-col gap-10", children: /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
6478
+ newsletterLabel && /* @__PURE__ */ jsx(
6479
+ "p",
6539
6480
  {
6540
6481
  className: cn(
6541
- "grid w-full max-w-xs grid-cols-2 gap-10 text-sm font-light lg:text-base",
6542
- bottomGridClassName
6482
+ "text-xl font-light tracking-tight",
6483
+ newsletterLabelClassName
6543
6484
  ),
6544
- children: [
6545
- location && /* @__PURE__ */ jsx("div", { className: cn("w-32", locationClassName), children: location }),
6546
- /* @__PURE__ */ jsx("ul", { className: cn("space-y-1", footerLinksClassName), children: footerLinksContent })
6547
- ]
6485
+ children: newsletterLabel
6548
6486
  }
6549
- )
6550
- ]
6487
+ ),
6488
+ renderForm
6489
+ ] }) })
6551
6490
  }
6552
6491
  ),
6553
6492
  brandText && /* @__PURE__ */ jsx("div", { className: cn("mt-20 w-full lg:mt-32", brandSectionClassName), children: /* @__PURE__ */ jsx(
6554
6493
  motion.div,
6555
6494
  {
6556
- initial: { opacity: 0, y: 20 },
6495
+ initial: { opacity: 0, y: 80 },
6557
6496
  whileInView: { opacity: 1, y: 0 },
6558
- viewport: { once: true },
6559
- transition: { duration: 0.6 },
6497
+ viewport: { once: true, amount: 0.5 },
6498
+ transition: { duration: 0.9, ease: [0.16, 1, 0.3, 1] },
6560
6499
  className: "text-center",
6561
6500
  children: /* @__PURE__ */ jsx(
6562
6501
  "span",
@@ -6574,19 +6513,51 @@ function FooterNewsletterMinimal({
6574
6513
  "div",
6575
6514
  {
6576
6515
  className: cn(
6577
- "mt-8 text-center text-sm opacity-80",
6516
+ "flex flex-col items-center space-y-6",
6517
+ brandText ? "mb-24" : "mt-8",
6578
6518
  copyrightClassName
6579
6519
  ),
6580
6520
  children: [
6581
- /* @__PURE__ */ jsx(FooterCopyright, { copyright }),
6582
6521
  /* @__PURE__ */ jsx(
6583
- BrandAttribution,
6522
+ "div",
6523
+ {
6524
+ className: cn(
6525
+ "flex items-center justify-center",
6526
+ bottomGridClassName
6527
+ ),
6528
+ children: /* @__PURE__ */ jsx(
6529
+ "div",
6530
+ {
6531
+ className: cn(
6532
+ "flex gap-4 md:gap-6 text-sm font-light lg:text-base",
6533
+ "text-center items-center justify-center flex-wrap",
6534
+ footerLinksClassName
6535
+ ),
6536
+ children: footerLinksContent
6537
+ }
6538
+ )
6539
+ }
6540
+ ),
6541
+ /* @__PURE__ */ jsxs(
6542
+ "div",
6584
6543
  {
6585
- internalBrandSlug: "open_site_ai",
6586
- optionIndex: 4,
6587
- variant: "div",
6588
- containerClassName: "mt-2",
6589
- linkClassName: "underline underline-offset-4 transition-colors hover:opacity-100"
6544
+ className: cn(
6545
+ "mt-8 text-center text-sm opacity-50",
6546
+ copyrightClassName
6547
+ ),
6548
+ children: [
6549
+ /* @__PURE__ */ jsx(FooterCopyright, { copyright }),
6550
+ /* @__PURE__ */ jsx(
6551
+ BrandAttribution,
6552
+ {
6553
+ internalBrandSlug: "open_site_ai",
6554
+ optionIndex: 4,
6555
+ variant: "div",
6556
+ containerClassName: "mt-2",
6557
+ linkClassName: "underline underline-offset-4 transition-colors hover:opacity-100"
6558
+ }
6559
+ )
6560
+ ]
6590
6561
  }
6591
6562
  )
6592
6563
  ]