@bigbinary/neeto-molecules 3.13.4 → 3.13.6

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,6 +1,11 @@
1
1
  import React from 'react';
2
2
  import { HelpPopoverProps } from './HelpPopover.js';
3
- import '@bigbinary/neetoui';
3
+ import { EmailPreviewProps } from './EmailPreview.js';
4
+ import { HeaderProps } from './Header.js';
5
+ import { TooltipProps, SwitchProps } from '@bigbinary/neetoui';
6
+ import 'components/Header/constants';
7
+ import 'neetoui';
8
+ import './MoreDropdown.js';
4
9
 
5
10
  type ContentVariables = {
6
11
  label: string;
@@ -17,6 +22,36 @@ type ReplyToFieldProps = {
17
22
  type SendToFieldProps = {
18
23
  options?: FieldOptions[];
19
24
  };
25
+ type EmailFormProps = {
26
+ messageVariables?: ContentVariables[];
27
+ subjectVariables?: ContentVariables[];
28
+ handleCancel?: () => void;
29
+ isLoading?: boolean;
30
+ replyToOptions?: FieldOptions[];
31
+ sendToOptions?: FieldOptions[];
32
+ isUpdating?: boolean;
33
+ showFields?: boolean;
34
+ className?: string;
35
+ replyToFieldProps?: ReplyToFieldProps;
36
+ sendToFieldProps?: SendToFieldProps;
37
+ };
38
+ interface ExtendedEmailPreviewProps extends EmailPreviewProps {
39
+ formatBody?: () => void;
40
+ formatSubject?: () => void;
41
+ bodyVariables?: object;
42
+ subjectVariables?: object;
43
+ }
44
+ interface InitialValues {
45
+ sendTo?: string[];
46
+ sendToId?: string;
47
+ sendToCc?: string[];
48
+ sendToBcc?: string[];
49
+ replyTo?: string;
50
+ showCopyEmails?: boolean;
51
+ subject?: string;
52
+ message?: string;
53
+ isEnabled?: boolean;
54
+ }
20
55
  /**
21
56
  *
22
57
  * This is a component used to create or edit an email template. It includes fields
@@ -25,43 +60,77 @@ type SendToFieldProps = {
25
60
  *
26
61
  * It also provides options to insert variables into the message and subject field,
27
62
  *
28
- * validate input, and handle save or cancel actions."
63
+ * validate input, and handle save or cancel actions.
64
+ *
65
+ * The component works with a preview feature that shows how the email will look in
29
66
  *
30
- * ![image](https://github.com/bigbinary/neeto-molecules/assets/8749438/9d29264e-05f9-4aef-b804-03073feb524e|height=200|width=300)
67
+ * real time. As users add or change content in the template, the preview updates
68
+ *
69
+ * instantly, so they can see exactly how the email will appear before saving it.
70
+ *
71
+ * ![image](https://github.com/user-attachments/assets/c8fd8e68-ddd2-4652-b3fb-175ac098e1a0|height=200|width=300)
31
72
  *
32
73
  * @example
33
74
  *
34
- * import { EmailForm, EmailFormProvider } from "components/EmailForm";
75
+ * import EmailForm from "@bigbinary/neeto-molecules/EmailForm";
35
76
  *
36
77
  * const EmailComposer = () => {
37
78
  * return (
38
- * <EmailFormProvider>
39
- * {({ values }) => (
40
- * <div className="flex flex-col gap-2 p-6 md:flex-row">
41
- * <EmailForm
42
- * showReplyToField
43
- * showSendToField
44
- * messageVariables={messageVariables}
45
- * subjectVariables={subjectVariables}
46
- * sendToFieldProps={{options: sendToOptions}}
47
- * replyToFieldProps={{
48
- * options: replyToOptions,
49
- * popoverProps: {
50
- * helpLinkProps: {
51
- * label: "Help link",
52
- * href: "https://help.neetoform.com/articles/reply-to-field-for-emails",
53
- * },
54
- * },
55
- * }}
56
- * />
57
- * <EmailPreview
58
- * body={values.message}
59
- * subject={values.subject}
60
- * to={pluck("value", values.sendTo)}
61
- * />
62
- * </div>
63
- * )}
64
- * </EmailFormProvider>
79
+ * <EmailForm
80
+ * initialValues={{
81
+ * message: "Test Message",
82
+ * subject: "Test Subject",
83
+ * }}
84
+ * onSubmit={handleSubmit}
85
+ * showReplyToField={showReplyToField}
86
+ * showSendToField={showSendToField}
87
+ * showSendToAsRadio={showSendToAsRadio}
88
+ * formikProps={formikProps}
89
+ * validationSchema={validationSchema}
90
+ * switchProps={ name: "isEnabled", value: true }
91
+ * titleProps={ value: "Title" }
92
+ * headerProps={{
93
+ * size: "small",
94
+ * title: "Header",
95
+ * breadcrumbs: [
96
+ * { text: "First", link: "first-example" },
97
+ * { text: "Second", link: "second-example" },
98
+ * { text: "Third" },
99
+ * ],
100
+ * titleHelpPopoverProps: { title: "title help popover props" },
101
+ * }}
102
+ * mobilePreviewProps={{
103
+ * message: 'Preview Message',
104
+ * className: "neeto-ui-bg-gray-200 lg:hidden",
105
+ * }}
106
+ * emailFormProps={{
107
+ * messageVariables,
108
+ * subjectVariables,
109
+ * replyToFieldProps: {
110
+ * options: [
111
+ * {
112
+ * label: "Email Fugiat ratione nihil qui?",
113
+ * value: "no-reply@example.com",
114
+ * },
115
+ * ],
116
+ * popoverProps: {
117
+ * helpLinkProps: {
118
+ * label: "Help link",
119
+ * href: "https://help.neetoform.com/articles/reply-to-field-for-emails",
120
+ * },
121
+ * },
122
+ * },
123
+ * sendToFieldProps: { options: sendToOptions },
124
+ * sendToOptions,
125
+ * }}
126
+ * emailPreviewProps={{
127
+ * customContent: <Footer {...{ kind }} />,
128
+ * formatBody,
129
+ * formatSubject,
130
+ * bodyVariables,
131
+ * subjectVariables,
132
+ * }}
133
+ * />
65
134
  * );
66
135
  * };
67
136
  *
@@ -69,17 +138,27 @@ type SendToFieldProps = {
69
138
  * @endexample
70
139
  */
71
140
  declare const EmailForm: React.FC<{
72
- messageVariables?: ContentVariables[];
73
- subjectVariables?: ContentVariables[];
74
- handleCancel: () => void;
75
- isLoading?: boolean;
76
- replyToOptions?: FieldOptions[];
77
- sendToOptions?: FieldOptions[];
78
- isUpdating?: boolean;
141
+ onSubmit: FormikConfig<T>["onSubmit"];
142
+ initialValues: InitialValues;
143
+ formikProps?: {
144
+ [key: string]: any;
145
+ };
146
+ validationSchema?: ValidationMap;
79
147
  showFields?: boolean;
80
- className?: string;
81
- replyToFieldProps?: ReplyToFieldProps;
82
- sendToFieldProps?: SendToFieldProps;
148
+ showSendToField?: boolean;
149
+ showReplyToField?: boolean;
150
+ showSendToAsRadio?: boolean;
151
+ showCcField?: boolean;
152
+ showBccField?: boolean;
153
+ isLoading?: boolean;
154
+ maxEmails?: number;
155
+ emailFormProps?: EmailFormProps;
156
+ emailPreviewProps?: Partial<ExtendedEmailPreviewProps>;
157
+ headerProps?: HeaderProps;
158
+ tooltipProps?: Partial<TooltipProps>;
159
+ switchProps?: SwitchProps;
160
+ mobilePreviewProps?: object;
161
+ children?: React.ReactNode;
83
162
  }>;
84
163
 
85
164
  export { EmailForm as default };
@@ -15,7 +15,7 @@ type ValidationMap = {
15
15
  *
16
16
  * @example
17
17
  *
18
- * import { EmailFormProvider } from "components/EmailForm";
18
+ * import { EmailFormProvider } from "@bigbinary/neeto-molecules/EmailForm";
19
19
  *
20
20
  * const EmailComposer = () => {
21
21
  * return (
@@ -1,5 +1,15 @@
1
1
  import React from 'react';
2
2
 
3
+ interface EmailPreviewProps {
4
+ to?: string[];
5
+ subject?: string;
6
+ body?: string;
7
+ from?: string;
8
+ logo?: string;
9
+ actionButtonText?: string;
10
+ className?: string;
11
+ customContent?: React.ReactNode;
12
+ }
3
13
  /**
4
14
  *
5
15
  * A common component to preview emails.
@@ -28,15 +38,6 @@ import React from 'react';
28
38
  * export default EmailShare;
29
39
  * @endexample
30
40
  */
31
- declare const EmailPreview: React.FC<{
32
- to?: string[];
33
- subject?: string;
34
- body?: string;
35
- from?: string;
36
- logo?: string;
37
- actionButtonText?: string;
38
- className?: string;
39
- customContent?: React.ReactNode;
40
- }>;
41
+ declare const EmailPreview: React.FC<EmailPreviewProps>;
41
42
 
42
- export { EmailPreview as default };
43
+ export { type EmailPreviewProps, EmailPreview as default };
package/types/Header.d.ts CHANGED
@@ -17,7 +17,6 @@ interface HeaderProps {
17
17
  size?: keyof typeof SIZES;
18
18
  renderDropdown?: (Dropdown: MoreDropdown) => JSX.Element;
19
19
  }
20
-
21
20
  /**
22
21
  *
23
22
  * The Header component can be used to display the page title and an action block