@opensite/ui 2.1.9 → 2.2.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.
@@ -0,0 +1,152 @@
1
+ import * as React from 'react';
2
+ import { FormEngineProps } from '@page-speed/forms/integration';
3
+ import { f as SectionBackground, g as SectionSpacing, t as PatternName } from './community-initiatives-Bz_A5vLU.cjs';
4
+
5
+ interface ContactDarkOption {
6
+ /**
7
+ * Icon name for the contact option
8
+ */
9
+ icon: string;
10
+ /**
11
+ * Contact information text
12
+ */
13
+ info: string;
14
+ /**
15
+ * Optional href for the contact option
16
+ */
17
+ href?: string;
18
+ }
19
+ interface ContactDarkSocialLink {
20
+ /**
21
+ * Icon name for the social platform
22
+ */
23
+ icon: string;
24
+ /**
25
+ * Link href
26
+ */
27
+ href: string;
28
+ /**
29
+ * Accessible label for the link
30
+ */
31
+ label: string;
32
+ }
33
+ interface ContactDarkProps {
34
+ /**
35
+ * Main heading content
36
+ */
37
+ heading?: React.ReactNode;
38
+ /**
39
+ * Description text below the heading
40
+ */
41
+ description?: React.ReactNode;
42
+ /**
43
+ * Contact information heading
44
+ */
45
+ contactHeading?: React.ReactNode;
46
+ /**
47
+ * Contact information description
48
+ */
49
+ contactDescription?: React.ReactNode;
50
+ /**
51
+ * Submit button text
52
+ */
53
+ buttonText?: string;
54
+ /**
55
+ * Submit button icon (displayed before text)
56
+ */
57
+ buttonIcon?: React.ReactNode;
58
+ /**
59
+ * Contact options to display
60
+ */
61
+ contactOptions?: ContactDarkOption[];
62
+ /**
63
+ * Custom slot for rendering contact options (overrides contactOptions array)
64
+ */
65
+ contactOptionsSlot?: React.ReactNode;
66
+ /**
67
+ * Social media links to display
68
+ */
69
+ socialLinks?: ContactDarkSocialLink[];
70
+ /**
71
+ * Custom slot for rendering social links (overrides socialLinks array)
72
+ */
73
+ socialLinksSlot?: React.ReactNode;
74
+ /**
75
+ * Full form engine setup and props
76
+ */
77
+ formEngineSetup?: FormEngineProps;
78
+ /**
79
+ * Additional CSS classes for the section
80
+ */
81
+ className?: string;
82
+ /**
83
+ * Additional CSS classes for the container
84
+ */
85
+ containerClassName?: string;
86
+ /**
87
+ * Additional CSS classes for the header wrapper
88
+ */
89
+ headerClassName?: string;
90
+ /**
91
+ * Additional CSS classes for the heading
92
+ */
93
+ headingClassName?: string;
94
+ /**
95
+ * Additional CSS classes for the description
96
+ */
97
+ descriptionClassName?: string;
98
+ /**
99
+ * Additional CSS classes for the card
100
+ */
101
+ cardClassName?: string;
102
+ /**
103
+ * Additional CSS classes for the form panel
104
+ */
105
+ formPanelClassName?: string;
106
+ /**
107
+ * Additional CSS classes for the info panel
108
+ */
109
+ infoPanelClassName?: string;
110
+ /**
111
+ * Additional CSS classes for the contact options container
112
+ */
113
+ contactOptionsClassName?: string;
114
+ /**
115
+ * Additional CSS classes for the social links container
116
+ */
117
+ socialLinksClassName?: string;
118
+ /**
119
+ * Background style for the section
120
+ */
121
+ background?: SectionBackground;
122
+ /**
123
+ * Vertical spacing for the section
124
+ */
125
+ spacing?: SectionSpacing;
126
+ /**
127
+ * Optional background pattern name or URL
128
+ */
129
+ pattern?: PatternName | undefined;
130
+ /**
131
+ * Pattern overlay opacity (0-1)
132
+ */
133
+ patternOpacity?: number;
134
+ }
135
+ /**
136
+ * ContactDark - A dark-themed contact form with split layout featuring a form
137
+ * on one side and contact information with social links on a dark background.
138
+ * Perfect for modern, high-contrast designs.
139
+ *
140
+ * @example
141
+ * ```tsx
142
+ * <ContactDark
143
+ * heading="Contact Us"
144
+ * description="Any questions or remarks? Just write us a message!"
145
+ * buttonText="Send Message"
146
+ * formEngineSetup={{ formConfig: { endpoint: "/api/contact", format: "json" } }}
147
+ * />
148
+ * ```
149
+ */
150
+ declare function ContactDark({ heading, description, contactHeading, contactDescription, buttonText, buttonIcon, contactOptions, contactOptionsSlot, socialLinks, socialLinksSlot, formEngineSetup, className, headerClassName, headingClassName, descriptionClassName, cardClassName, formPanelClassName, infoPanelClassName, contactOptionsClassName, socialLinksClassName, background, spacing, containerClassName, pattern, patternOpacity, }: ContactDarkProps): React.JSX.Element;
151
+
152
+ export { type ContactDarkSocialLink as C, ContactDark as a, type ContactDarkProps as b };
@@ -0,0 +1,152 @@
1
+ import * as React from 'react';
2
+ import { FormEngineProps } from '@page-speed/forms/integration';
3
+ import { f as SectionBackground, g as SectionSpacing, t as PatternName } from './community-initiatives-Bi_ClKrO.js';
4
+
5
+ interface ContactDarkOption {
6
+ /**
7
+ * Icon name for the contact option
8
+ */
9
+ icon: string;
10
+ /**
11
+ * Contact information text
12
+ */
13
+ info: string;
14
+ /**
15
+ * Optional href for the contact option
16
+ */
17
+ href?: string;
18
+ }
19
+ interface ContactDarkSocialLink {
20
+ /**
21
+ * Icon name for the social platform
22
+ */
23
+ icon: string;
24
+ /**
25
+ * Link href
26
+ */
27
+ href: string;
28
+ /**
29
+ * Accessible label for the link
30
+ */
31
+ label: string;
32
+ }
33
+ interface ContactDarkProps {
34
+ /**
35
+ * Main heading content
36
+ */
37
+ heading?: React.ReactNode;
38
+ /**
39
+ * Description text below the heading
40
+ */
41
+ description?: React.ReactNode;
42
+ /**
43
+ * Contact information heading
44
+ */
45
+ contactHeading?: React.ReactNode;
46
+ /**
47
+ * Contact information description
48
+ */
49
+ contactDescription?: React.ReactNode;
50
+ /**
51
+ * Submit button text
52
+ */
53
+ buttonText?: string;
54
+ /**
55
+ * Submit button icon (displayed before text)
56
+ */
57
+ buttonIcon?: React.ReactNode;
58
+ /**
59
+ * Contact options to display
60
+ */
61
+ contactOptions?: ContactDarkOption[];
62
+ /**
63
+ * Custom slot for rendering contact options (overrides contactOptions array)
64
+ */
65
+ contactOptionsSlot?: React.ReactNode;
66
+ /**
67
+ * Social media links to display
68
+ */
69
+ socialLinks?: ContactDarkSocialLink[];
70
+ /**
71
+ * Custom slot for rendering social links (overrides socialLinks array)
72
+ */
73
+ socialLinksSlot?: React.ReactNode;
74
+ /**
75
+ * Full form engine setup and props
76
+ */
77
+ formEngineSetup?: FormEngineProps;
78
+ /**
79
+ * Additional CSS classes for the section
80
+ */
81
+ className?: string;
82
+ /**
83
+ * Additional CSS classes for the container
84
+ */
85
+ containerClassName?: string;
86
+ /**
87
+ * Additional CSS classes for the header wrapper
88
+ */
89
+ headerClassName?: string;
90
+ /**
91
+ * Additional CSS classes for the heading
92
+ */
93
+ headingClassName?: string;
94
+ /**
95
+ * Additional CSS classes for the description
96
+ */
97
+ descriptionClassName?: string;
98
+ /**
99
+ * Additional CSS classes for the card
100
+ */
101
+ cardClassName?: string;
102
+ /**
103
+ * Additional CSS classes for the form panel
104
+ */
105
+ formPanelClassName?: string;
106
+ /**
107
+ * Additional CSS classes for the info panel
108
+ */
109
+ infoPanelClassName?: string;
110
+ /**
111
+ * Additional CSS classes for the contact options container
112
+ */
113
+ contactOptionsClassName?: string;
114
+ /**
115
+ * Additional CSS classes for the social links container
116
+ */
117
+ socialLinksClassName?: string;
118
+ /**
119
+ * Background style for the section
120
+ */
121
+ background?: SectionBackground;
122
+ /**
123
+ * Vertical spacing for the section
124
+ */
125
+ spacing?: SectionSpacing;
126
+ /**
127
+ * Optional background pattern name or URL
128
+ */
129
+ pattern?: PatternName | undefined;
130
+ /**
131
+ * Pattern overlay opacity (0-1)
132
+ */
133
+ patternOpacity?: number;
134
+ }
135
+ /**
136
+ * ContactDark - A dark-themed contact form with split layout featuring a form
137
+ * on one side and contact information with social links on a dark background.
138
+ * Perfect for modern, high-contrast designs.
139
+ *
140
+ * @example
141
+ * ```tsx
142
+ * <ContactDark
143
+ * heading="Contact Us"
144
+ * description="Any questions or remarks? Just write us a message!"
145
+ * buttonText="Send Message"
146
+ * formEngineSetup={{ formConfig: { endpoint: "/api/contact", format: "json" } }}
147
+ * />
148
+ * ```
149
+ */
150
+ declare function ContactDark({ heading, description, contactHeading, contactDescription, buttonText, buttonIcon, contactOptions, contactOptionsSlot, socialLinks, socialLinksSlot, formEngineSetup, className, headerClassName, headingClassName, descriptionClassName, cardClassName, formPanelClassName, infoPanelClassName, contactOptionsClassName, socialLinksClassName, background, spacing, containerClassName, pattern, patternOpacity, }: ContactDarkProps): React.JSX.Element;
151
+
152
+ export { type ContactDarkSocialLink as C, ContactDark as a, type ContactDarkProps as b };
@@ -2,7 +2,6 @@
2
2
  'use strict';
3
3
 
4
4
  var React = require('react');
5
- var forms = require('@page-speed/forms');
6
5
  var integration = require('@page-speed/forms/integration');
7
6
  var clsx = require('clsx');
8
7
  var tailwindMerge = require('tailwind-merge');
@@ -844,6 +843,12 @@ var Section = React__namespace.default.forwardRef(
844
843
  }
845
844
  );
846
845
  Section.displayName = "Section";
846
+ var DEFAULT_STYLE_RULES = {
847
+ formContainer: "",
848
+ fieldsContainer: "",
849
+ fieldClassName: "",
850
+ formClassName: "space-y-6"
851
+ };
847
852
  var DEFAULT_FORM_FIELDS = [
848
853
  {
849
854
  name: "firstName",
@@ -886,87 +891,42 @@ function ContactDark({
886
891
  contactDescription = "Fill up the form and our team will get back to you within 24 hours.",
887
892
  buttonText = "Submit",
888
893
  buttonIcon,
889
- actions,
890
- actionsSlot,
891
894
  contactOptions,
892
895
  contactOptionsSlot,
893
896
  socialLinks,
894
897
  socialLinksSlot,
895
- formFields = DEFAULT_FORM_FIELDS,
896
- successMessage = "Thank you! Your message has been sent successfully.",
898
+ formEngineSetup,
897
899
  className,
898
900
  headerClassName,
899
901
  headingClassName,
900
902
  descriptionClassName,
901
903
  cardClassName,
902
904
  formPanelClassName,
903
- formClassName,
904
- submitClassName,
905
905
  infoPanelClassName,
906
906
  contactOptionsClassName,
907
907
  socialLinksClassName,
908
- successMessageClassName,
909
- errorMessageClassName,
910
908
  background,
911
909
  spacing = "py-8 md:py-32",
912
910
  containerClassName = "px-6 sm:px-6 md:px-8 lg:px-8",
913
911
  pattern,
914
- patternOpacity,
915
- formConfig,
916
- onSubmit,
917
- onSuccess,
918
- onError
912
+ patternOpacity
919
913
  }) {
920
- const {
921
- uploadTokens,
922
- uploadProgress,
923
- isUploading,
924
- uploadFiles,
925
- removeFile,
926
- resetUpload
927
- } = integration.useFileUpload({ onError });
928
- const { form, submissionError, formMethod, resetSubmissionState } = integration.useContactForm({
929
- formFields,
930
- formConfig,
931
- onSubmit,
932
- onSuccess: (data) => {
933
- resetUpload();
934
- onSuccess?.(data);
935
- },
936
- onError,
937
- resetOnSuccess: formConfig?.resetOnSuccess !== false,
938
- uploadTokens
939
- });
940
- const actionsContent = React__namespace.useMemo(() => {
941
- if (actionsSlot) return actionsSlot;
942
- if (actions && actions.length > 0) {
943
- return actions.map((action, index) => {
944
- const {
945
- label,
946
- icon,
947
- iconAfter,
948
- children,
949
- className: actionClassName,
950
- ...pressableProps
951
- } = action;
952
- return /* @__PURE__ */ jsxRuntime.jsx(
953
- Pressable,
954
- {
955
- asButton: true,
956
- className: actionClassName,
957
- ...pressableProps,
958
- children: children ?? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
959
- icon,
960
- label,
961
- iconAfter
962
- ] })
963
- },
964
- index
965
- );
966
- });
914
+ const formStyleRules = React__namespace.useMemo(() => {
915
+ return {
916
+ formContainer: formEngineSetup?.formLayoutSettings?.styleRules?.formContainer ?? DEFAULT_STYLE_RULES.formContainer,
917
+ fieldsContainer: formEngineSetup?.formLayoutSettings?.styleRules?.fieldsContainer ?? DEFAULT_STYLE_RULES.fieldsContainer,
918
+ fieldClassName: formEngineSetup?.formLayoutSettings?.styleRules?.fieldClassName ?? DEFAULT_STYLE_RULES.fieldClassName,
919
+ formClassName: formEngineSetup?.formLayoutSettings?.styleRules?.formClassName ?? DEFAULT_STYLE_RULES.formClassName,
920
+ successMessageClassName: formEngineSetup?.formLayoutSettings?.styleRules?.successMessageClassName ?? DEFAULT_STYLE_RULES.successMessageClassName,
921
+ errorMessageClassName: formEngineSetup?.formLayoutSettings?.styleRules?.errorMessageClassName ?? DEFAULT_STYLE_RULES.errorMessageClassName
922
+ };
923
+ }, [formEngineSetup?.formLayoutSettings?.styleRules]);
924
+ const formFields = React__namespace.useMemo(() => {
925
+ if (formEngineSetup?.fields && formEngineSetup.fields.length > 0) {
926
+ return formEngineSetup.fields;
967
927
  }
968
- return null;
969
- }, [actionsSlot, actions]);
928
+ return DEFAULT_FORM_FIELDS;
929
+ }, [formEngineSetup?.fields]);
970
930
  const contactOptionsContent = React__namespace.useMemo(() => {
971
931
  if (contactOptionsSlot) return contactOptionsSlot;
972
932
  if (contactOptions && contactOptions.length > 0) {
@@ -1021,124 +981,102 @@ function ContactDark({
1021
981
  patternOpacity,
1022
982
  className,
1023
983
  containerClassName,
1024
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
1025
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("mb-10 text-center", headerClassName), children: [
1026
- heading && (typeof heading === "string" ? /* @__PURE__ */ jsxRuntime.jsx(
1027
- "h2",
1028
- {
1029
- className: cn(
1030
- "mb-3 text-3xl font-bold tracking-tight text-balance",
1031
- headingClassName
1032
- ),
1033
- children: heading
1034
- }
1035
- ) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: headingClassName, children: heading })),
1036
- description && (typeof description === "string" ? /* @__PURE__ */ jsxRuntime.jsx(
1037
- "p",
1038
- {
1039
- className: cn(
1040
- "leading-relaxed text-balance",
1041
- descriptionClassName
1042
- ),
1043
- children: description
1044
- }
1045
- ) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: descriptionClassName, children: description }))
1046
- ] }),
1047
- /* @__PURE__ */ jsxRuntime.jsxs(
1048
- Card,
1049
- {
1050
- className: cn(
1051
- "grid gap-0 overflow-hidden grid-cols-1 lg:grid-cols-2 pt-0 pb-0",
1052
- cardClassName
1053
- ),
1054
- children: [
1055
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("p-6 lg:p-12", formPanelClassName), children: /* @__PURE__ */ jsxRuntime.jsxs(
1056
- forms.Form,
1057
- {
1058
- form,
1059
- notificationConfig: {
1060
- submissionError,
1061
- successMessage
1062
- },
1063
- styleConfig: {
1064
- formClassName: cn("space-y-6", formClassName),
1065
- successMessageClassName,
1066
- errorMessageClassName
1067
- },
1068
- formConfig: {
1069
- endpoint: formConfig?.endpoint,
1070
- method: formMethod,
1071
- submissionConfig: formConfig?.submissionConfig
1072
- },
1073
- onNewSubmission: () => {
1074
- resetUpload();
1075
- resetSubmissionState();
984
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative", children: /* @__PURE__ */ jsxRuntime.jsxs(
985
+ Card,
986
+ {
987
+ className: cn(
988
+ "grid gap-0 overflow-hidden grid-cols-1 lg:grid-cols-2 pt-0 pb-0",
989
+ cardClassName
990
+ ),
991
+ children: [
992
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("p-6 lg:p-12", formPanelClassName), children: formEngineSetup ? /* @__PURE__ */ jsxRuntime.jsx(
993
+ integration.FormEngine,
994
+ {
995
+ ...formEngineSetup,
996
+ formLayoutSettings: {
997
+ ...formEngineSetup.formLayoutSettings,
998
+ formLayout: "standard",
999
+ submitButtonSetup: {
1000
+ ...formEngineSetup.formLayoutSettings?.submitButtonSetup,
1001
+ submitLabel: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1002
+ buttonIcon,
1003
+ buttonText
1004
+ ] })
1076
1005
  },
1077
- children: [
1078
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-12 gap-6", children: formFields.map((field) => /* @__PURE__ */ jsxRuntime.jsx(
1079
- "div",
1080
- {
1081
- className: integration.getColumnSpanClass(field.columnSpan),
1082
- children: /* @__PURE__ */ jsxRuntime.jsx(
1083
- integration.DynamicFormField,
1006
+ styleRules: formStyleRules
1007
+ },
1008
+ fields: formFields
1009
+ }
1010
+ ) : null }),
1011
+ /* @__PURE__ */ jsxRuntime.jsxs(
1012
+ "div",
1013
+ {
1014
+ className: cn(
1015
+ "flex flex-col justify-between bg-primary p-6 text-primary-foreground lg:p-8",
1016
+ infoPanelClassName
1017
+ ),
1018
+ children: [
1019
+ /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsxs(
1020
+ "div",
1021
+ {
1022
+ className: cn(
1023
+ "pb-6 md:pb-8 border-b-2 border-border/50 mb-6 md:mb-8 text-left",
1024
+ headerClassName
1025
+ ),
1026
+ children: [
1027
+ heading && (typeof heading === "string" ? /* @__PURE__ */ jsxRuntime.jsx(
1028
+ "h2",
1084
1029
  {
1085
- field,
1086
- uploadProgress,
1087
- onFileUpload: uploadFiles,
1088
- onFileRemove: removeFile,
1089
- isUploading
1030
+ className: cn(
1031
+ "text-3xl font-bold tracking-tight text-pretty md:text-5xl",
1032
+ headingClassName
1033
+ ),
1034
+ children: heading
1090
1035
  }
1091
- )
1092
- },
1093
- field.name
1094
- )) }),
1095
- actionsSlot || actions && actions.length > 0 ? actionsContent : /* @__PURE__ */ jsxRuntime.jsxs(
1096
- Pressable,
1097
- {
1098
- componentType: "button",
1099
- type: "submit",
1100
- className: cn("w-full", submitClassName),
1101
- asButton: true,
1102
- disabled: form.isSubmitting,
1103
- children: [
1104
- buttonIcon,
1105
- buttonText
1106
- ]
1107
- }
1108
- )
1109
- ]
1110
- }
1111
- ) }),
1112
- /* @__PURE__ */ jsxRuntime.jsxs(
1113
- "div",
1114
- {
1115
- className: cn(
1116
- "flex flex-col justify-between bg-primary p-6 text-primary-foreground lg:p-8",
1117
- infoPanelClassName
1118
- ),
1119
- children: [
1120
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1121
- contactHeading && (typeof contactHeading === "string" ? /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "mb-3 text-xl font-semibold", children: contactHeading }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-3", children: contactHeading })),
1122
- contactDescription && (typeof contactDescription === "string" ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mb-8 text-sm text-primary-foreground/80", children: contactDescription }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-8", children: contactDescription })),
1123
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("space-y-4", contactOptionsClassName), children: contactOptionsContent })
1124
- ] }),
1036
+ ) : heading),
1037
+ description && (typeof description === "string" ? /* @__PURE__ */ jsxRuntime.jsx(
1038
+ "p",
1039
+ {
1040
+ className: cn(
1041
+ "leading-relaxed text-balance",
1042
+ descriptionClassName
1043
+ ),
1044
+ children: description
1045
+ }
1046
+ ) : description)
1047
+ ]
1048
+ }
1049
+ ) }),
1050
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-start gap-4", children: [
1051
+ contactHeading && (typeof contactHeading === "string" ? /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-xl font-semibold", children: contactHeading }) : contactHeading),
1052
+ contactDescription && (typeof contactDescription === "string" ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-primary-foreground/80", children: contactDescription }) : contactDescription),
1125
1053
  /* @__PURE__ */ jsxRuntime.jsx(
1126
1054
  "div",
1127
1055
  {
1128
1056
  className: cn(
1129
- "mt-8 flex items-center gap-4",
1130
- socialLinksClassName
1057
+ "pt-6 md:pt-8 space-y-4",
1058
+ contactOptionsClassName
1131
1059
  ),
1132
- children: socialLinksContent
1060
+ children: contactOptionsContent
1133
1061
  }
1134
1062
  )
1135
- ]
1136
- }
1137
- )
1138
- ]
1139
- }
1140
- )
1141
- ] })
1063
+ ] }),
1064
+ /* @__PURE__ */ jsxRuntime.jsx(
1065
+ "div",
1066
+ {
1067
+ className: cn(
1068
+ "mt-8 flex items-center gap-4",
1069
+ socialLinksClassName
1070
+ ),
1071
+ children: socialLinksContent
1072
+ }
1073
+ )
1074
+ ]
1075
+ }
1076
+ )
1077
+ ]
1078
+ }
1079
+ ) })
1142
1080
  }
1143
1081
  );
1144
1082
  }