@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,11 +1,10 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var React = require('react');
5
- var forms = require('@page-speed/forms');
6
4
  var integration = require('@page-speed/forms/integration');
7
5
  var clsx = require('clsx');
8
6
  var tailwindMerge = require('tailwind-merge');
7
+ var React = require('react');
9
8
  var classVarianceAuthority = require('class-variance-authority');
10
9
  var jsxRuntime = require('react/jsx-runtime');
11
10
  var icon = require('@page-speed/icon');
@@ -831,32 +830,12 @@ var Section = React__namespace.default.forwardRef(
831
830
  }
832
831
  );
833
832
  Section.displayName = "Section";
834
- var DEFAULT_CONTACT_ITEMS = [
835
- {
836
- icon: "lucide/phone",
837
- title: "Critical Hotline",
838
- subtitle: "+1 (555) 911-0000",
839
- href: "tel:+15559110000"
840
- },
841
- {
842
- icon: "lucide/mail",
843
- title: "Email Support",
844
- subtitle: "emergency@support.com",
845
- href: "mailto:emergency@support.com"
846
- },
847
- {
848
- icon: "lucide/message-circle",
849
- title: "Live Chat",
850
- subtitle: "24/7 Available",
851
- href: "#chat"
852
- },
853
- {
854
- icon: "lucide/map-pin",
855
- title: "Visit Us",
856
- subtitle: "123 Support Lane",
857
- href: "#location"
858
- }
859
- ];
833
+ var DEFAULT_STYLE_RULES = {
834
+ formContainer: "",
835
+ fieldsContainer: "",
836
+ fieldClassName: "",
837
+ formClassName: "space-y-4"
838
+ };
860
839
  var PRIORITIES = [
861
840
  {
862
841
  value: "critical",
@@ -931,82 +910,20 @@ var DEFAULT_FORM_FIELDS = [
931
910
  function ContactEmergency({
932
911
  heading,
933
912
  description,
934
- contactItems = DEFAULT_CONTACT_ITEMS,
913
+ contactItems,
935
914
  buttonText = "Submit Emergency Request",
936
915
  buttonIcon,
937
- actions,
938
- actionsSlot,
939
- formFields = DEFAULT_FORM_FIELDS,
940
- successMessage = "Thank you! Your emergency request has been received.",
916
+ formEngineSetup,
941
917
  className,
942
918
  headerClassName,
943
919
  headingClassName,
944
920
  descriptionClassName,
945
- formClassName,
946
- submitClassName,
947
- successMessageClassName,
948
- errorMessageClassName,
949
- spacing = "py-8 md:py-32",
950
- containerClassName = "w-full max-w-full relative z-10 px-6 sm:px-6 md:px-8 lg:px-8",
921
+ spacing = "py-16 md:py-32",
922
+ containerClassName = "px-6 sm:px-6 md:px-8 lg:px-8",
951
923
  background,
952
924
  pattern,
953
- patternOpacity,
954
- formConfig,
955
- onSubmit,
956
- onSuccess,
957
- onError
925
+ patternOpacity
958
926
  }) {
959
- const {
960
- uploadTokens,
961
- uploadProgress,
962
- isUploading,
963
- uploadFiles,
964
- removeFile,
965
- resetUpload
966
- } = integration.useFileUpload({ onError });
967
- const { form, submissionError, formMethod, resetSubmissionState } = integration.useContactForm({
968
- formFields,
969
- formConfig,
970
- onSubmit,
971
- onSuccess: (data) => {
972
- resetUpload();
973
- onSuccess?.(data);
974
- },
975
- onError,
976
- resetOnSuccess: formConfig?.resetOnSuccess !== false,
977
- uploadTokens
978
- });
979
- const otherFields = formFields.filter((f) => f.name !== "priority");
980
- const actionsContent = React.useMemo(() => {
981
- if (actionsSlot) return actionsSlot;
982
- if (actions && actions.length > 0) {
983
- return actions.map((action, index) => {
984
- const {
985
- label,
986
- icon,
987
- iconAfter,
988
- children,
989
- className: actionClassName,
990
- ...pressableProps
991
- } = action;
992
- return /* @__PURE__ */ jsxRuntime.jsx(
993
- Pressable,
994
- {
995
- asButton: true,
996
- className: actionClassName,
997
- ...pressableProps,
998
- children: children ?? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
999
- icon,
1000
- label,
1001
- iconAfter
1002
- ] })
1003
- },
1004
- index
1005
- );
1006
- });
1007
- }
1008
- return null;
1009
- }, [actionsSlot, actions]);
1010
927
  return /* @__PURE__ */ jsxRuntime.jsx(
1011
928
  Section,
1012
929
  {
@@ -1016,126 +933,89 @@ function ContactEmergency({
1016
933
  patternOpacity,
1017
934
  className,
1018
935
  containerClassName,
1019
- children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative", children: /* @__PURE__ */ jsxRuntime.jsxs(
1020
- forms.Form,
1021
- {
1022
- form,
1023
- notificationConfig: {
1024
- submissionError,
1025
- successMessage
1026
- },
1027
- styleConfig: {
1028
- formClassName,
1029
- successMessageClassName,
1030
- errorMessageClassName
1031
- },
1032
- formConfig: {
1033
- endpoint: formConfig?.endpoint,
1034
- method: formMethod,
1035
- submissionConfig: formConfig?.submissionConfig
1036
- },
1037
- onNewSubmission: () => {
1038
- resetUpload();
1039
- resetSubmissionState();
1040
- },
1041
- children: [
1042
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("p-0 md:p-12"), children: [
1043
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid md:grid-cols-2 gap-12 md:gap-24", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-b border-border/60 p-6 md:border-b-0 md:border-r md:border-border/60", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col items-start gap-8 md:gap-12", children: /* @__PURE__ */ jsxRuntime.jsxs(
1044
- "div",
1045
- {
1046
- className: cn(
1047
- "flex flex-col items-start gap-4 text-left",
1048
- headerClassName
1049
- ),
1050
- children: [
1051
- heading && (typeof heading === "string" ? /* @__PURE__ */ jsxRuntime.jsx(
1052
- "h2",
1053
- {
1054
- className: cn(
1055
- "text-4xl lg:text-5xl xl:text-6xl font-bold",
1056
- headingClassName
1057
- ),
1058
- children: heading
1059
- }
1060
- ) : heading),
1061
- description && (typeof description === "string" ? /* @__PURE__ */ jsxRuntime.jsx(
1062
- "p",
1063
- {
1064
- className: cn(
1065
- "leading-relaxed",
1066
- descriptionClassName
1067
- ),
1068
- children: description
1069
- }
1070
- ) : description)
1071
- ]
1072
- }
1073
- ) }) }) }),
1074
- contactItems && contactItems.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4 md:gap-6 w-full", children: contactItems.map((item, index) => /* @__PURE__ */ jsxRuntime.jsx(
1075
- Pressable,
1076
- {
1077
- href: item.href,
1078
- className: cn(
1079
- "rounded-md border bg-muted ring-2",
1080
- "text-muted-foreground px-4 py-3 flex",
1081
- "justify-start items-start transition-shadow",
1082
- "duration-500 hover:shadow-xl",
1083
- item.className
1084
- ),
1085
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
1086
- item.icon ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center p-2 rounded-xl border bg-primary text-primary-foreground", children: /* @__PURE__ */ jsxRuntime.jsx(
1087
- DynamicIcon,
1088
- {
1089
- name: item.icon,
1090
- size: item.iconSize ?? 24
1091
- }
1092
- ) }) : null,
1093
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1094
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-bold text-xs uppercase opacity-70", children: item.title }),
1095
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-md font-semibold", children: item.subtitle })
1096
- ] })
1097
- ] })
1098
- },
1099
- index
1100
- )) })
1101
- ] }) }),
1102
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-6", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
1103
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-12 gap-4", children: otherFields.map((field) => /* @__PURE__ */ jsxRuntime.jsx(
1104
- "div",
1105
- {
1106
- className: integration.getColumnSpanClass(field.columnSpan),
1107
- children: /* @__PURE__ */ jsxRuntime.jsx(
1108
- integration.DynamicFormField,
1109
- {
1110
- field,
1111
- uploadProgress,
1112
- onFileUpload: uploadFiles,
1113
- onFileRemove: removeFile,
1114
- isUploading
1115
- }
1116
- )
1117
- },
1118
- field.name
1119
- )) }),
1120
- actionsSlot || actions && actions.length > 0 ? actionsContent : /* @__PURE__ */ jsxRuntime.jsxs(
1121
- Pressable,
1122
- {
1123
- componentType: "button",
1124
- type: "submit",
1125
- className: cn("w-full", submitClassName),
1126
- size: "lg",
1127
- asButton: true,
1128
- disabled: form.isSubmitting,
1129
- children: [
936
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid md:grid-cols-2 gap-12 md:gap-28", children: [
937
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-start justify-between h-full gap-8 md:gap-12", children: [
938
+ /* @__PURE__ */ jsxRuntime.jsxs(
939
+ "div",
940
+ {
941
+ className: cn(
942
+ "flex flex-col items-start gap-4 text-left",
943
+ headerClassName
944
+ ),
945
+ children: [
946
+ heading && (typeof heading === "string" ? /* @__PURE__ */ jsxRuntime.jsx(
947
+ "h2",
948
+ {
949
+ className: cn(
950
+ "text-4xl lg:text-5xl xl:text-6xl font-bold text-pretty",
951
+ headingClassName
952
+ ),
953
+ children: heading
954
+ }
955
+ ) : heading),
956
+ description && (typeof description === "string" ? /* @__PURE__ */ jsxRuntime.jsx(
957
+ "p",
958
+ {
959
+ className: cn(
960
+ "leading-relaxed text-pretty md:text-balance text-lg",
961
+ descriptionClassName
962
+ ),
963
+ children: description
964
+ }
965
+ ) : description)
966
+ ]
967
+ }
968
+ ),
969
+ contactItems && contactItems.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-1 gap-4 md:gap-6 w-full", children: contactItems.map((item, index) => /* @__PURE__ */ jsxRuntime.jsx(
970
+ Pressable,
971
+ {
972
+ href: item.href,
973
+ className: cn(
974
+ "rounded-xl border bg-transparent hover:bg-muted ring-2",
975
+ "px-4 py-4 flex",
976
+ "justify-start items-start transition-all",
977
+ "duration-500 hover:text-muted-foreground",
978
+ item.className
979
+ ),
980
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-4", children: [
981
+ item.icon ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center p-2 rounded-xl border bg-primary text-primary-foreground", children: /* @__PURE__ */ jsxRuntime.jsx(
982
+ DynamicIcon,
983
+ {
984
+ name: item.icon,
985
+ size: item.iconSize ?? 24
986
+ }
987
+ ) }) : null,
988
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
989
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-bold text-xs uppercase opacity-70", children: item.title }),
990
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-md font-medium", children: item.subtitle })
991
+ ] })
992
+ ] })
993
+ },
994
+ index
995
+ )) })
996
+ ] }) }),
997
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-6", children: formEngineSetup ? /* @__PURE__ */ jsxRuntime.jsx(
998
+ integration.FormEngine,
999
+ {
1000
+ formEngineSetup: {
1001
+ ...formEngineSetup,
1002
+ formLayoutSettings: {
1003
+ ...formEngineSetup.formLayoutSettings,
1004
+ formLayout: "standard",
1005
+ submitButtonSetup: {
1006
+ ...formEngineSetup.formLayoutSettings?.submitButtonSetup,
1007
+ submitLabel: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1130
1008
  buttonIcon,
1131
1009
  buttonText
1132
- ]
1010
+ ] })
1133
1011
  }
1134
- )
1135
- ] }) })
1136
- ]
1137
- }
1138
- ) })
1012
+ }
1013
+ },
1014
+ defaultFields: DEFAULT_FORM_FIELDS,
1015
+ defaultStyleRules: DEFAULT_STYLE_RULES
1016
+ }
1017
+ ) : null })
1018
+ ] })
1139
1019
  }
1140
1020
  );
1141
1021
  }
@@ -1,8 +1,8 @@
1
1
  import * as React from 'react';
2
- import { FormFieldConfig, PageSpeedFormConfig } from '@page-speed/forms/integration';
2
+ import { FormEngineProps } from '@page-speed/forms/integration';
3
3
  import { f as SectionBackground, g as SectionSpacing, t as PatternName } from './community-initiatives-Bz_A5vLU.cjs';
4
- import { A as ActionConfig } from './blocks-Cohq4eio.cjs';
5
4
  import 'react/jsx-runtime';
5
+ import './blocks-Cohq4eio.cjs';
6
6
  import 'class-variance-authority';
7
7
  import './button-variants-lRElsmTc.cjs';
8
8
  import 'class-variance-authority/types';
@@ -59,23 +59,9 @@ interface ContactEmergencyProps {
59
59
  */
60
60
  buttonIcon?: React.ReactNode;
61
61
  /**
62
- * Array of action configurations for custom buttons
62
+ * Full form engine setup and props
63
63
  */
64
- actions?: ActionConfig[];
65
- /**
66
- * Custom slot for rendering actions (overrides actions array)
67
- */
68
- actionsSlot?: React.ReactNode;
69
- /**
70
- * Array of form field configurations
71
- * If not provided, defaults to: priority, name, email, phone, subject, description
72
- */
73
- formFields?: FormFieldConfig[];
74
- /**
75
- * Success message to display after form submission
76
- * @default "Thank you! Your emergency request has been received."
77
- */
78
- successMessage?: React.ReactNode;
64
+ formEngineSetup?: FormEngineProps;
79
65
  /**
80
66
  * Additional CSS classes for the section
81
67
  */
@@ -96,22 +82,6 @@ interface ContactEmergencyProps {
96
82
  * Additional CSS classes for the description
97
83
  */
98
84
  descriptionClassName?: string;
99
- /**
100
- * Additional CSS classes for the form
101
- */
102
- formClassName?: string;
103
- /**
104
- * Additional CSS classes for the submit button
105
- */
106
- submitClassName?: string;
107
- /**
108
- * Additional CSS classes for the success message
109
- */
110
- successMessageClassName?: string;
111
- /**
112
- * Additional CSS classes for the error message
113
- */
114
- errorMessageClassName?: string;
115
85
  /**
116
86
  * Background style for the section
117
87
  */
@@ -128,22 +98,6 @@ interface ContactEmergencyProps {
128
98
  * Pattern overlay opacity (0-1)
129
99
  */
130
100
  patternOpacity?: number;
131
- /**
132
- * Form configuration for PageSpeed forms
133
- */
134
- formConfig?: PageSpeedFormConfig;
135
- /**
136
- * Custom submit handler
137
- */
138
- onSubmit?: (values: Record<string, any>) => void | Promise<void>;
139
- /**
140
- * Success callback
141
- */
142
- onSuccess?: (data: unknown) => void;
143
- /**
144
- * Error callback
145
- */
146
- onError?: (error: Error) => void;
147
101
  }
148
102
  /**
149
103
  * ContactEmergency - Urgent support form with priority level selection.
@@ -153,10 +107,10 @@ interface ContactEmergencyProps {
153
107
  * ```tsx
154
108
  * <ContactEmergency
155
109
  * heading="Urgent Support"
156
- * formConfig={{ endpoint: "/api/emergency", format: "json" }}
110
+ * formEngineSetup={{ formConfig: { endpoint: "/api/emergency", format: "json" } }}
157
111
  * />
158
112
  * ```
159
113
  */
160
- declare function ContactEmergency({ heading, description, contactItems, buttonText, buttonIcon, actions, actionsSlot, formFields, successMessage, className, headerClassName, headingClassName, descriptionClassName, formClassName, submitClassName, successMessageClassName, errorMessageClassName, spacing, containerClassName, background, pattern, patternOpacity, formConfig, onSubmit, onSuccess, onError, }: ContactEmergencyProps): React.JSX.Element;
114
+ declare function ContactEmergency({ heading, description, contactItems, buttonText, buttonIcon, formEngineSetup, className, headerClassName, headingClassName, descriptionClassName, spacing, containerClassName, background, pattern, patternOpacity, }: ContactEmergencyProps): React.JSX.Element;
161
115
 
162
116
  export { ContactEmergency, type ContactEmergencyProps };
@@ -1,8 +1,8 @@
1
1
  import * as React from 'react';
2
- import { FormFieldConfig, PageSpeedFormConfig } from '@page-speed/forms/integration';
2
+ import { FormEngineProps } from '@page-speed/forms/integration';
3
3
  import { f as SectionBackground, g as SectionSpacing, t as PatternName } from './community-initiatives-Bi_ClKrO.js';
4
- import { A as ActionConfig } from './blocks-k17uluAz.js';
5
4
  import 'react/jsx-runtime';
5
+ import './blocks-k17uluAz.js';
6
6
  import 'class-variance-authority';
7
7
  import './button-variants-lRElsmTc.js';
8
8
  import 'class-variance-authority/types';
@@ -59,23 +59,9 @@ interface ContactEmergencyProps {
59
59
  */
60
60
  buttonIcon?: React.ReactNode;
61
61
  /**
62
- * Array of action configurations for custom buttons
62
+ * Full form engine setup and props
63
63
  */
64
- actions?: ActionConfig[];
65
- /**
66
- * Custom slot for rendering actions (overrides actions array)
67
- */
68
- actionsSlot?: React.ReactNode;
69
- /**
70
- * Array of form field configurations
71
- * If not provided, defaults to: priority, name, email, phone, subject, description
72
- */
73
- formFields?: FormFieldConfig[];
74
- /**
75
- * Success message to display after form submission
76
- * @default "Thank you! Your emergency request has been received."
77
- */
78
- successMessage?: React.ReactNode;
64
+ formEngineSetup?: FormEngineProps;
79
65
  /**
80
66
  * Additional CSS classes for the section
81
67
  */
@@ -96,22 +82,6 @@ interface ContactEmergencyProps {
96
82
  * Additional CSS classes for the description
97
83
  */
98
84
  descriptionClassName?: string;
99
- /**
100
- * Additional CSS classes for the form
101
- */
102
- formClassName?: string;
103
- /**
104
- * Additional CSS classes for the submit button
105
- */
106
- submitClassName?: string;
107
- /**
108
- * Additional CSS classes for the success message
109
- */
110
- successMessageClassName?: string;
111
- /**
112
- * Additional CSS classes for the error message
113
- */
114
- errorMessageClassName?: string;
115
85
  /**
116
86
  * Background style for the section
117
87
  */
@@ -128,22 +98,6 @@ interface ContactEmergencyProps {
128
98
  * Pattern overlay opacity (0-1)
129
99
  */
130
100
  patternOpacity?: number;
131
- /**
132
- * Form configuration for PageSpeed forms
133
- */
134
- formConfig?: PageSpeedFormConfig;
135
- /**
136
- * Custom submit handler
137
- */
138
- onSubmit?: (values: Record<string, any>) => void | Promise<void>;
139
- /**
140
- * Success callback
141
- */
142
- onSuccess?: (data: unknown) => void;
143
- /**
144
- * Error callback
145
- */
146
- onError?: (error: Error) => void;
147
101
  }
148
102
  /**
149
103
  * ContactEmergency - Urgent support form with priority level selection.
@@ -153,10 +107,10 @@ interface ContactEmergencyProps {
153
107
  * ```tsx
154
108
  * <ContactEmergency
155
109
  * heading="Urgent Support"
156
- * formConfig={{ endpoint: "/api/emergency", format: "json" }}
110
+ * formEngineSetup={{ formConfig: { endpoint: "/api/emergency", format: "json" } }}
157
111
  * />
158
112
  * ```
159
113
  */
160
- declare function ContactEmergency({ heading, description, contactItems, buttonText, buttonIcon, actions, actionsSlot, formFields, successMessage, className, headerClassName, headingClassName, descriptionClassName, formClassName, submitClassName, successMessageClassName, errorMessageClassName, spacing, containerClassName, background, pattern, patternOpacity, formConfig, onSubmit, onSuccess, onError, }: ContactEmergencyProps): React.JSX.Element;
114
+ declare function ContactEmergency({ heading, description, contactItems, buttonText, buttonIcon, formEngineSetup, className, headerClassName, headingClassName, descriptionClassName, spacing, containerClassName, background, pattern, patternOpacity, }: ContactEmergencyProps): React.JSX.Element;
161
115
 
162
116
  export { ContactEmergency, type ContactEmergencyProps };