@opensite/ui 2.1.9 → 2.2.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.
@@ -1,10 +1,9 @@
1
1
  "use client";
2
- import * as React from 'react';
3
- import React__default, { useMemo } from 'react';
4
- import { Form } from '@page-speed/forms';
5
- import { useFileUpload, useContactForm, getColumnSpanClass, DynamicFormField } from '@page-speed/forms/integration';
2
+ import { FormEngine } from '@page-speed/forms/integration';
6
3
  import { clsx } from 'clsx';
7
4
  import { twMerge } from 'tailwind-merge';
5
+ import * as React from 'react';
6
+ import React__default from 'react';
8
7
  import { cva } from 'class-variance-authority';
9
8
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
10
9
  import { Icon } from '@page-speed/icon';
@@ -810,32 +809,12 @@ var Section = React__default.forwardRef(
810
809
  }
811
810
  );
812
811
  Section.displayName = "Section";
813
- var DEFAULT_CONTACT_ITEMS = [
814
- {
815
- icon: "lucide/phone",
816
- title: "Critical Hotline",
817
- subtitle: "+1 (555) 911-0000",
818
- href: "tel:+15559110000"
819
- },
820
- {
821
- icon: "lucide/mail",
822
- title: "Email Support",
823
- subtitle: "emergency@support.com",
824
- href: "mailto:emergency@support.com"
825
- },
826
- {
827
- icon: "lucide/message-circle",
828
- title: "Live Chat",
829
- subtitle: "24/7 Available",
830
- href: "#chat"
831
- },
832
- {
833
- icon: "lucide/map-pin",
834
- title: "Visit Us",
835
- subtitle: "123 Support Lane",
836
- href: "#location"
837
- }
838
- ];
812
+ var DEFAULT_STYLE_RULES = {
813
+ formContainer: "",
814
+ fieldsContainer: "",
815
+ fieldClassName: "",
816
+ formClassName: "space-y-4"
817
+ };
839
818
  var PRIORITIES = [
840
819
  {
841
820
  value: "critical",
@@ -910,82 +889,20 @@ var DEFAULT_FORM_FIELDS = [
910
889
  function ContactEmergency({
911
890
  heading,
912
891
  description,
913
- contactItems = DEFAULT_CONTACT_ITEMS,
892
+ contactItems,
914
893
  buttonText = "Submit Emergency Request",
915
894
  buttonIcon,
916
- actions,
917
- actionsSlot,
918
- formFields = DEFAULT_FORM_FIELDS,
919
- successMessage = "Thank you! Your emergency request has been received.",
895
+ formEngineSetup,
920
896
  className,
921
897
  headerClassName,
922
898
  headingClassName,
923
899
  descriptionClassName,
924
- formClassName,
925
- submitClassName,
926
- successMessageClassName,
927
- errorMessageClassName,
928
- spacing = "py-8 md:py-32",
929
- containerClassName = "w-full max-w-full relative z-10 px-6 sm:px-6 md:px-8 lg:px-8",
900
+ spacing = "py-16 md:py-32",
901
+ containerClassName = "px-6 sm:px-6 md:px-8 lg:px-8",
930
902
  background,
931
903
  pattern,
932
- patternOpacity,
933
- formConfig,
934
- onSubmit,
935
- onSuccess,
936
- onError
904
+ patternOpacity
937
905
  }) {
938
- const {
939
- uploadTokens,
940
- uploadProgress,
941
- isUploading,
942
- uploadFiles,
943
- removeFile,
944
- resetUpload
945
- } = useFileUpload({ onError });
946
- const { form, submissionError, formMethod, resetSubmissionState } = useContactForm({
947
- formFields,
948
- formConfig,
949
- onSubmit,
950
- onSuccess: (data) => {
951
- resetUpload();
952
- onSuccess?.(data);
953
- },
954
- onError,
955
- resetOnSuccess: formConfig?.resetOnSuccess !== false,
956
- uploadTokens
957
- });
958
- const otherFields = formFields.filter((f) => f.name !== "priority");
959
- const actionsContent = useMemo(() => {
960
- if (actionsSlot) return actionsSlot;
961
- if (actions && actions.length > 0) {
962
- return actions.map((action, index) => {
963
- const {
964
- label,
965
- icon,
966
- iconAfter,
967
- children,
968
- className: actionClassName,
969
- ...pressableProps
970
- } = action;
971
- return /* @__PURE__ */ jsx(
972
- Pressable,
973
- {
974
- asButton: true,
975
- className: actionClassName,
976
- ...pressableProps,
977
- children: children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
978
- icon,
979
- label,
980
- iconAfter
981
- ] })
982
- },
983
- index
984
- );
985
- });
986
- }
987
- return null;
988
- }, [actionsSlot, actions]);
989
906
  return /* @__PURE__ */ jsx(
990
907
  Section,
991
908
  {
@@ -995,126 +912,89 @@ function ContactEmergency({
995
912
  patternOpacity,
996
913
  className,
997
914
  containerClassName,
998
- children: /* @__PURE__ */ jsx("div", { className: "relative", children: /* @__PURE__ */ jsxs(
999
- Form,
1000
- {
1001
- form,
1002
- notificationConfig: {
1003
- submissionError,
1004
- successMessage
1005
- },
1006
- styleConfig: {
1007
- formClassName,
1008
- successMessageClassName,
1009
- errorMessageClassName
1010
- },
1011
- formConfig: {
1012
- endpoint: formConfig?.endpoint,
1013
- method: formMethod,
1014
- submissionConfig: formConfig?.submissionConfig
1015
- },
1016
- onNewSubmission: () => {
1017
- resetUpload();
1018
- resetSubmissionState();
1019
- },
1020
- children: [
1021
- /* @__PURE__ */ jsx("div", { className: "flex", children: /* @__PURE__ */ jsxs("div", { className: cn("p-0 md:p-12"), children: [
1022
- /* @__PURE__ */ jsx("div", { className: "grid md:grid-cols-2 gap-12 md:gap-24", children: /* @__PURE__ */ jsx("div", { className: "border-b border-border/60 p-6 md:border-b-0 md:border-r md:border-border/60", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col items-start gap-8 md:gap-12", children: /* @__PURE__ */ jsxs(
1023
- "div",
1024
- {
1025
- className: cn(
1026
- "flex flex-col items-start gap-4 text-left",
1027
- headerClassName
1028
- ),
1029
- children: [
1030
- heading && (typeof heading === "string" ? /* @__PURE__ */ jsx(
1031
- "h2",
1032
- {
1033
- className: cn(
1034
- "text-4xl lg:text-5xl xl:text-6xl font-bold",
1035
- headingClassName
1036
- ),
1037
- children: heading
1038
- }
1039
- ) : heading),
1040
- description && (typeof description === "string" ? /* @__PURE__ */ jsx(
1041
- "p",
1042
- {
1043
- className: cn(
1044
- "leading-relaxed",
1045
- descriptionClassName
1046
- ),
1047
- children: description
1048
- }
1049
- ) : description)
1050
- ]
1051
- }
1052
- ) }) }) }),
1053
- contactItems && contactItems.length > 0 && /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4 md:gap-6 w-full", children: contactItems.map((item, index) => /* @__PURE__ */ jsx(
1054
- Pressable,
1055
- {
1056
- href: item.href,
1057
- className: cn(
1058
- "rounded-md border bg-muted ring-2",
1059
- "text-muted-foreground px-4 py-3 flex",
1060
- "justify-start items-start transition-shadow",
1061
- "duration-500 hover:shadow-xl",
1062
- item.className
1063
- ),
1064
- children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
1065
- item.icon ? /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center p-2 rounded-xl border bg-primary text-primary-foreground", children: /* @__PURE__ */ jsx(
1066
- DynamicIcon,
1067
- {
1068
- name: item.icon,
1069
- size: item.iconSize ?? 24
1070
- }
1071
- ) }) : null,
1072
- /* @__PURE__ */ jsxs("div", { children: [
1073
- /* @__PURE__ */ jsx("p", { className: "font-bold text-xs uppercase opacity-70", children: item.title }),
1074
- /* @__PURE__ */ jsx("p", { className: "text-md font-semibold", children: item.subtitle })
1075
- ] })
1076
- ] })
1077
- },
1078
- index
1079
- )) })
1080
- ] }) }),
1081
- /* @__PURE__ */ jsx("div", { className: "p-6", children: /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
1082
- /* @__PURE__ */ jsx("div", { className: "grid grid-cols-12 gap-4", children: otherFields.map((field) => /* @__PURE__ */ jsx(
1083
- "div",
1084
- {
1085
- className: getColumnSpanClass(field.columnSpan),
1086
- children: /* @__PURE__ */ jsx(
1087
- DynamicFormField,
1088
- {
1089
- field,
1090
- uploadProgress,
1091
- onFileUpload: uploadFiles,
1092
- onFileRemove: removeFile,
1093
- isUploading
1094
- }
1095
- )
1096
- },
1097
- field.name
1098
- )) }),
1099
- actionsSlot || actions && actions.length > 0 ? actionsContent : /* @__PURE__ */ jsxs(
1100
- Pressable,
1101
- {
1102
- componentType: "button",
1103
- type: "submit",
1104
- className: cn("w-full", submitClassName),
1105
- size: "lg",
1106
- asButton: true,
1107
- disabled: form.isSubmitting,
1108
- children: [
915
+ children: /* @__PURE__ */ jsxs("div", { className: "grid md:grid-cols-2 gap-12 md:gap-28", children: [
916
+ /* @__PURE__ */ jsx("div", { className: "h-full", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-start justify-between h-full gap-8 md:gap-12", children: [
917
+ /* @__PURE__ */ jsxs(
918
+ "div",
919
+ {
920
+ className: cn(
921
+ "flex flex-col items-start gap-4 text-left",
922
+ headerClassName
923
+ ),
924
+ children: [
925
+ heading && (typeof heading === "string" ? /* @__PURE__ */ jsx(
926
+ "h2",
927
+ {
928
+ className: cn(
929
+ "text-4xl lg:text-5xl xl:text-6xl font-bold text-pretty",
930
+ headingClassName
931
+ ),
932
+ children: heading
933
+ }
934
+ ) : heading),
935
+ description && (typeof description === "string" ? /* @__PURE__ */ jsx(
936
+ "p",
937
+ {
938
+ className: cn(
939
+ "leading-relaxed text-pretty md:text-balance text-lg",
940
+ descriptionClassName
941
+ ),
942
+ children: description
943
+ }
944
+ ) : description)
945
+ ]
946
+ }
947
+ ),
948
+ contactItems && contactItems.length > 0 && /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 gap-4 md:gap-6 w-full", children: contactItems.map((item, index) => /* @__PURE__ */ jsx(
949
+ Pressable,
950
+ {
951
+ href: item.href,
952
+ className: cn(
953
+ "rounded-xl border bg-transparent hover:bg-muted ring-2",
954
+ "px-4 py-4 flex",
955
+ "justify-start items-start transition-all",
956
+ "duration-500 hover:text-muted-foreground",
957
+ item.className
958
+ ),
959
+ children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
960
+ item.icon ? /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center p-2 rounded-xl border bg-primary text-primary-foreground", children: /* @__PURE__ */ jsx(
961
+ DynamicIcon,
962
+ {
963
+ name: item.icon,
964
+ size: item.iconSize ?? 24
965
+ }
966
+ ) }) : null,
967
+ /* @__PURE__ */ jsxs("div", { children: [
968
+ /* @__PURE__ */ jsx("p", { className: "font-bold text-xs uppercase opacity-70", children: item.title }),
969
+ /* @__PURE__ */ jsx("p", { className: "text-md font-medium", children: item.subtitle })
970
+ ] })
971
+ ] })
972
+ },
973
+ index
974
+ )) })
975
+ ] }) }),
976
+ /* @__PURE__ */ jsx("div", { className: "p-6", children: formEngineSetup ? /* @__PURE__ */ jsx(
977
+ FormEngine,
978
+ {
979
+ formEngineSetup: {
980
+ ...formEngineSetup,
981
+ formLayoutSettings: {
982
+ ...formEngineSetup.formLayoutSettings,
983
+ formLayout: "standard",
984
+ submitButtonSetup: {
985
+ ...formEngineSetup.formLayoutSettings?.submitButtonSetup,
986
+ submitLabel: /* @__PURE__ */ jsxs(Fragment, { children: [
1109
987
  buttonIcon,
1110
988
  buttonText
1111
- ]
989
+ ] })
1112
990
  }
1113
- )
1114
- ] }) })
1115
- ]
1116
- }
1117
- ) })
991
+ }
992
+ },
993
+ defaultFields: DEFAULT_FORM_FIELDS,
994
+ defaultStyleRules: DEFAULT_STYLE_RULES
995
+ }
996
+ ) : null })
997
+ ] })
1118
998
  }
1119
999
  );
1120
1000
  }
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var React3 = require('react');
4
+ var React = require('react');
5
5
  var integration = require('@page-speed/forms/integration');
6
6
  var clsx = require('clsx');
7
7
  var tailwindMerge = require('tailwind-merge');
@@ -9,6 +9,8 @@ var jsxRuntime = require('react/jsx-runtime');
9
9
  var AccordionPrimitive = require('@radix-ui/react-accordion');
10
10
  var icon = require('@page-speed/icon');
11
11
 
12
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
13
+
12
14
  function _interopNamespace(e) {
13
15
  if (e && e.__esModule) return e;
14
16
  var n = Object.create(null);
@@ -27,7 +29,7 @@ function _interopNamespace(e) {
27
29
  return Object.freeze(n);
28
30
  }
29
31
 
30
- var React3__namespace = /*#__PURE__*/_interopNamespace(React3);
32
+ var React__default = /*#__PURE__*/_interopDefault(React);
31
33
  var AccordionPrimitive__namespace = /*#__PURE__*/_interopNamespace(AccordionPrimitive);
32
34
 
33
35
  // components/blocks/contact/contact-faq.tsx
@@ -130,7 +132,7 @@ var maxWidthStyles = {
130
132
  "4xl": "max-w-[1536px]",
131
133
  full: "max-w-full"
132
134
  };
133
- var Container = React3__namespace.default.forwardRef(
135
+ var Container = React__default.default.forwardRef(
134
136
  ({ children, maxWidth = "xl", className, as = "div", ...props }, ref) => {
135
137
  const Component = as;
136
138
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -435,7 +437,7 @@ var spacingStyles = {
435
437
  };
436
438
  var predefinedSpacings = ["none", "sm", "md", "lg", "xl"];
437
439
  var isPredefinedSpacing = (spacing) => predefinedSpacings.includes(spacing);
438
- var Section = React3__namespace.default.forwardRef(
440
+ var Section = React__default.default.forwardRef(
439
441
  ({
440
442
  id,
441
443
  title,
@@ -567,25 +569,8 @@ function ContactFaq({
567
569
  pattern,
568
570
  patternOpacity
569
571
  }) {
570
- const formStyleRules = React3__namespace.useMemo(() => {
571
- return {
572
- formContainer: formEngineSetup?.formLayoutSettings?.styleRules?.formContainer ?? DEFAULT_STYLE_RULES.formContainer,
573
- fieldsContainer: formEngineSetup?.formLayoutSettings?.styleRules?.fieldsContainer ?? DEFAULT_STYLE_RULES.fieldsContainer,
574
- fieldClassName: formEngineSetup?.formLayoutSettings?.styleRules?.fieldClassName ?? DEFAULT_STYLE_RULES.fieldClassName,
575
- formClassName: formEngineSetup?.formLayoutSettings?.styleRules?.formClassName ?? DEFAULT_STYLE_RULES.formClassName,
576
- successMessageClassName: formEngineSetup?.formLayoutSettings?.styleRules?.successMessageClassName ?? DEFAULT_STYLE_RULES.successMessageClassName,
577
- errorMessageClassName: formEngineSetup?.formLayoutSettings?.styleRules?.errorMessageClassName ?? DEFAULT_STYLE_RULES.errorMessageClassName
578
- };
579
- }, [formEngineSetup?.formLayoutSettings?.styleRules]);
580
- const formFields = React3__namespace.useMemo(() => {
581
- if (formEngineSetup && formEngineSetup?.fields && formEngineSetup?.fields?.length > 0) {
582
- return formEngineSetup.fields;
583
- } else {
584
- return DEFAULT_FORM_FIELDS;
585
- }
586
- }, [formEngineSetup?.fields]);
587
572
  const hasFaqItems = itemsSlot || items && items.length > 0;
588
- const faqContent = React3.useMemo(() => {
573
+ const faqContent = React.useMemo(() => {
589
574
  if (itemsSlot) return itemsSlot;
590
575
  if (!items || items.length === 0) return null;
591
576
  return /* @__PURE__ */ jsxRuntime.jsx(Accordion, { type: "single", collapsible: true, className: accordionClassName, children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsxs(
@@ -677,24 +662,26 @@ function ContactFaq({
677
662
  ),
678
663
  children: formHeading
679
664
  }
680
- ) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: formHeadingClassName, children: formHeading })),
665
+ ) : formHeading),
681
666
  formEngineSetup ? /* @__PURE__ */ jsxRuntime.jsx(
682
667
  integration.FormEngine,
683
668
  {
684
- ...formEngineSetup,
685
- formLayoutSettings: {
686
- ...formEngineSetup.formLayoutSettings,
687
- formLayout: "standard",
688
- submitButtonSetup: {
689
- ...formEngineSetup.formLayoutSettings?.submitButtonSetup,
690
- submitLabel: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
691
- buttonIcon,
692
- buttonText
693
- ] })
694
- },
695
- styleRules: formStyleRules
669
+ formEngineSetup: {
670
+ ...formEngineSetup,
671
+ formLayoutSettings: {
672
+ ...formEngineSetup.formLayoutSettings,
673
+ formLayout: "standard",
674
+ submitButtonSetup: {
675
+ ...formEngineSetup.formLayoutSettings?.submitButtonSetup,
676
+ submitLabel: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
677
+ buttonIcon,
678
+ buttonText
679
+ ] })
680
+ }
681
+ }
696
682
  },
697
- fields: formFields
683
+ defaultFields: DEFAULT_FORM_FIELDS,
684
+ defaultStyleRules: DEFAULT_STYLE_RULES
698
685
  }
699
686
  ) : null
700
687
  ] }) }),
@@ -1,6 +1,5 @@
1
1
  "use client";
2
- import * as React3 from 'react';
3
- import React3__default, { useMemo } from 'react';
2
+ import React, { useMemo } from 'react';
4
3
  import { FormEngine } from '@page-speed/forms/integration';
5
4
  import { clsx } from 'clsx';
6
5
  import { twMerge } from 'tailwind-merge';
@@ -108,7 +107,7 @@ var maxWidthStyles = {
108
107
  "4xl": "max-w-[1536px]",
109
108
  full: "max-w-full"
110
109
  };
111
- var Container = React3__default.forwardRef(
110
+ var Container = React.forwardRef(
112
111
  ({ children, maxWidth = "xl", className, as = "div", ...props }, ref) => {
113
112
  const Component = as;
114
113
  return /* @__PURE__ */ jsx(
@@ -413,7 +412,7 @@ var spacingStyles = {
413
412
  };
414
413
  var predefinedSpacings = ["none", "sm", "md", "lg", "xl"];
415
414
  var isPredefinedSpacing = (spacing) => predefinedSpacings.includes(spacing);
416
- var Section = React3__default.forwardRef(
415
+ var Section = React.forwardRef(
417
416
  ({
418
417
  id,
419
418
  title,
@@ -545,23 +544,6 @@ function ContactFaq({
545
544
  pattern,
546
545
  patternOpacity
547
546
  }) {
548
- const formStyleRules = React3.useMemo(() => {
549
- return {
550
- formContainer: formEngineSetup?.formLayoutSettings?.styleRules?.formContainer ?? DEFAULT_STYLE_RULES.formContainer,
551
- fieldsContainer: formEngineSetup?.formLayoutSettings?.styleRules?.fieldsContainer ?? DEFAULT_STYLE_RULES.fieldsContainer,
552
- fieldClassName: formEngineSetup?.formLayoutSettings?.styleRules?.fieldClassName ?? DEFAULT_STYLE_RULES.fieldClassName,
553
- formClassName: formEngineSetup?.formLayoutSettings?.styleRules?.formClassName ?? DEFAULT_STYLE_RULES.formClassName,
554
- successMessageClassName: formEngineSetup?.formLayoutSettings?.styleRules?.successMessageClassName ?? DEFAULT_STYLE_RULES.successMessageClassName,
555
- errorMessageClassName: formEngineSetup?.formLayoutSettings?.styleRules?.errorMessageClassName ?? DEFAULT_STYLE_RULES.errorMessageClassName
556
- };
557
- }, [formEngineSetup?.formLayoutSettings?.styleRules]);
558
- const formFields = React3.useMemo(() => {
559
- if (formEngineSetup && formEngineSetup?.fields && formEngineSetup?.fields?.length > 0) {
560
- return formEngineSetup.fields;
561
- } else {
562
- return DEFAULT_FORM_FIELDS;
563
- }
564
- }, [formEngineSetup?.fields]);
565
547
  const hasFaqItems = itemsSlot || items && items.length > 0;
566
548
  const faqContent = useMemo(() => {
567
549
  if (itemsSlot) return itemsSlot;
@@ -655,24 +637,26 @@ function ContactFaq({
655
637
  ),
656
638
  children: formHeading
657
639
  }
658
- ) : /* @__PURE__ */ jsx("div", { className: formHeadingClassName, children: formHeading })),
640
+ ) : formHeading),
659
641
  formEngineSetup ? /* @__PURE__ */ jsx(
660
642
  FormEngine,
661
643
  {
662
- ...formEngineSetup,
663
- formLayoutSettings: {
664
- ...formEngineSetup.formLayoutSettings,
665
- formLayout: "standard",
666
- submitButtonSetup: {
667
- ...formEngineSetup.formLayoutSettings?.submitButtonSetup,
668
- submitLabel: /* @__PURE__ */ jsxs(Fragment, { children: [
669
- buttonIcon,
670
- buttonText
671
- ] })
672
- },
673
- styleRules: formStyleRules
644
+ formEngineSetup: {
645
+ ...formEngineSetup,
646
+ formLayoutSettings: {
647
+ ...formEngineSetup.formLayoutSettings,
648
+ formLayout: "standard",
649
+ submitButtonSetup: {
650
+ ...formEngineSetup.formLayoutSettings?.submitButtonSetup,
651
+ submitLabel: /* @__PURE__ */ jsxs(Fragment, { children: [
652
+ buttonIcon,
653
+ buttonText
654
+ ] })
655
+ }
656
+ }
674
657
  },
675
- fields: formFields
658
+ defaultFields: DEFAULT_FORM_FIELDS,
659
+ defaultStyleRules: DEFAULT_STYLE_RULES
676
660
  }
677
661
  ) : null
678
662
  ] }) }),