@delmaredigital/payload-puck 0.6.16 → 0.6.18

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.
Files changed (95) hide show
  1. package/dist/components/email/EmailButton/EmailButton.editor.d.ts +3 -0
  2. package/dist/components/email/EmailButton/EmailButton.editor.js +81 -0
  3. package/dist/components/email/EmailButton/EmailButton.server.d.ts +3 -0
  4. package/dist/components/email/EmailButton/EmailButton.server.js +69 -0
  5. package/dist/components/email/EmailButton/EmailButton.types.d.ts +11 -0
  6. package/dist/components/email/EmailButton/EmailButton.types.js +1 -0
  7. package/dist/components/email/EmailColumns/EmailColumns.editor.d.ts +2 -0
  8. package/dist/components/email/EmailColumns/EmailColumns.editor.js +45 -0
  9. package/dist/components/email/EmailColumns/EmailColumns.server.d.ts +2 -0
  10. package/dist/components/email/EmailColumns/EmailColumns.server.js +58 -0
  11. package/dist/components/email/EmailColumns/EmailColumns.types.d.ts +8 -0
  12. package/dist/components/email/EmailColumns/EmailColumns.types.js +1 -0
  13. package/dist/components/email/EmailDivider/EmailDivider.editor.d.ts +3 -0
  14. package/dist/components/email/EmailDivider/EmailDivider.editor.js +38 -0
  15. package/dist/components/email/EmailDivider/EmailDivider.server.d.ts +3 -0
  16. package/dist/components/email/EmailDivider/EmailDivider.server.js +38 -0
  17. package/dist/components/email/EmailDivider/EmailDivider.types.d.ts +6 -0
  18. package/dist/components/email/EmailDivider/EmailDivider.types.js +1 -0
  19. package/dist/components/email/EmailFooter/EmailFooter.editor.d.ts +3 -0
  20. package/dist/components/email/EmailFooter/EmailFooter.editor.js +22 -0
  21. package/dist/components/email/EmailFooter/EmailFooter.server.d.ts +3 -0
  22. package/dist/components/email/EmailFooter/EmailFooter.server.js +59 -0
  23. package/dist/components/email/EmailFooter/EmailFooter.types.d.ts +6 -0
  24. package/dist/components/email/EmailFooter/EmailFooter.types.js +1 -0
  25. package/dist/components/email/EmailHeader/EmailHeader.editor.d.ts +3 -0
  26. package/dist/components/email/EmailHeader/EmailHeader.editor.js +28 -0
  27. package/dist/components/email/EmailHeader/EmailHeader.server.d.ts +3 -0
  28. package/dist/components/email/EmailHeader/EmailHeader.server.js +60 -0
  29. package/dist/components/email/EmailHeader/EmailHeader.types.d.ts +8 -0
  30. package/dist/components/email/EmailHeader/EmailHeader.types.js +1 -0
  31. package/dist/components/email/EmailHeading/EmailHeading.editor.d.ts +3 -0
  32. package/dist/components/email/EmailHeading/EmailHeading.editor.js +50 -0
  33. package/dist/components/email/EmailHeading/EmailHeading.server.d.ts +3 -0
  34. package/dist/components/email/EmailHeading/EmailHeading.server.js +35 -0
  35. package/dist/components/email/EmailHeading/EmailHeading.types.d.ts +7 -0
  36. package/dist/components/email/EmailHeading/EmailHeading.types.js +1 -0
  37. package/dist/components/email/EmailImage/EmailImage.editor.d.ts +3 -0
  38. package/dist/components/email/EmailImage/EmailImage.editor.js +46 -0
  39. package/dist/components/email/EmailImage/EmailImage.server.d.ts +3 -0
  40. package/dist/components/email/EmailImage/EmailImage.server.js +81 -0
  41. package/dist/components/email/EmailImage/EmailImage.types.d.ts +9 -0
  42. package/dist/components/email/EmailImage/EmailImage.types.js +1 -0
  43. package/dist/components/email/EmailSection/EmailSection.editor.d.ts +2 -0
  44. package/dist/components/email/EmailSection/EmailSection.editor.js +21 -0
  45. package/dist/components/email/EmailSection/EmailSection.server.d.ts +2 -0
  46. package/dist/components/email/EmailSection/EmailSection.server.js +49 -0
  47. package/dist/components/email/EmailSection/EmailSection.types.d.ts +7 -0
  48. package/dist/components/email/EmailSection/EmailSection.types.js +1 -0
  49. package/dist/components/email/EmailSocial/EmailSocial.editor.d.ts +3 -0
  50. package/dist/components/email/EmailSocial/EmailSocial.editor.js +70 -0
  51. package/dist/components/email/EmailSocial/EmailSocial.server.d.ts +3 -0
  52. package/dist/components/email/EmailSocial/EmailSocial.server.js +89 -0
  53. package/dist/components/email/EmailSocial/EmailSocial.types.d.ts +10 -0
  54. package/dist/components/email/EmailSocial/EmailSocial.types.js +1 -0
  55. package/dist/components/email/EmailSpacer/EmailSpacer.editor.d.ts +3 -0
  56. package/dist/components/email/EmailSpacer/EmailSpacer.editor.js +12 -0
  57. package/dist/components/email/EmailSpacer/EmailSpacer.server.d.ts +3 -0
  58. package/dist/components/email/EmailSpacer/EmailSpacer.server.js +25 -0
  59. package/dist/components/email/EmailSpacer/EmailSpacer.types.d.ts +3 -0
  60. package/dist/components/email/EmailSpacer/EmailSpacer.types.js +1 -0
  61. package/dist/components/email/EmailText/EmailText.editor.d.ts +3 -0
  62. package/dist/components/email/EmailText/EmailText.editor.js +102 -0
  63. package/dist/components/email/EmailText/EmailText.server.d.ts +3 -0
  64. package/dist/components/email/EmailText/EmailText.server.js +35 -0
  65. package/dist/components/email/EmailText/EmailText.types.d.ts +8 -0
  66. package/dist/components/email/EmailText/EmailText.types.js +1 -0
  67. package/dist/components/email/EmailWrapper/EmailWrapper.editor.d.ts +2 -0
  68. package/dist/components/email/EmailWrapper/EmailWrapper.editor.js +21 -0
  69. package/dist/components/email/EmailWrapper/EmailWrapper.server.d.ts +2 -0
  70. package/dist/components/email/EmailWrapper/EmailWrapper.server.js +61 -0
  71. package/dist/components/email/EmailWrapper/EmailWrapper.types.d.ts +7 -0
  72. package/dist/components/email/EmailWrapper/EmailWrapper.types.js +1 -0
  73. package/dist/components/email/exports.d.ts +49 -0
  74. package/dist/components/email/exports.js +50 -0
  75. package/dist/components/email/utils.d.ts +74 -0
  76. package/dist/components/email/utils.js +137 -0
  77. package/dist/config/config.email.d.ts +71 -0
  78. package/dist/config/config.email.editor.d.ts +82 -0
  79. package/dist/config/config.email.editor.js +112 -0
  80. package/dist/config/config.email.js +101 -0
  81. package/dist/email/EmailRenderer.d.ts +16 -0
  82. package/dist/email/EmailRenderer.js +20 -0
  83. package/dist/email/email-document.d.ts +29 -0
  84. package/dist/email/email-document.js +67 -0
  85. package/dist/email/index.d.ts +23 -0
  86. package/dist/email/index.js +22 -0
  87. package/dist/email/renderToEmailHtml.d.ts +23 -0
  88. package/dist/email/renderToEmailHtml.js +43 -0
  89. package/dist/fields/index.d.ts +1 -0
  90. package/dist/fields/index.js +1 -0
  91. package/dist/fields/shared.d.ts +16 -0
  92. package/dist/fields/shared.js +59 -0
  93. package/dist/version.d.ts +1 -1
  94. package/dist/version.js +1 -1
  95. package/package.json +29 -17
@@ -0,0 +1,3 @@
1
+ import type { ComponentConfig } from '@puckeditor/core';
2
+ import type { EmailButtonProps } from './EmailButton.types.js';
3
+ export declare const EmailButtonEditorConfig: ComponentConfig<EmailButtonProps>;
@@ -0,0 +1,81 @@
1
+ import { EmailButtonConfig } from './EmailButton.server.js';
2
+ import { createColorPickerField } from '../../../fields/ColorPickerField.js';
3
+ export const EmailButtonEditorConfig = {
4
+ ...EmailButtonConfig,
5
+ fields: {
6
+ text: {
7
+ type: 'text',
8
+ label: 'Button Text'
9
+ },
10
+ href: {
11
+ type: 'text',
12
+ label: 'Link URL'
13
+ },
14
+ backgroundColor: createColorPickerField({
15
+ label: 'Background Color'
16
+ }),
17
+ textColor: createColorPickerField({
18
+ label: 'Text Color'
19
+ }),
20
+ borderRadius: {
21
+ type: 'number',
22
+ label: 'Border Radius (px)',
23
+ min: 0,
24
+ max: 50
25
+ },
26
+ padding: {
27
+ type: 'select',
28
+ label: 'Padding',
29
+ options: [
30
+ {
31
+ label: 'Small',
32
+ value: '8px 16px'
33
+ },
34
+ {
35
+ label: 'Medium',
36
+ value: '12px 24px'
37
+ },
38
+ {
39
+ label: 'Large',
40
+ value: '16px 32px'
41
+ },
42
+ {
43
+ label: 'Extra Large',
44
+ value: '20px 40px'
45
+ }
46
+ ]
47
+ },
48
+ alignment: {
49
+ type: 'radio',
50
+ label: 'Alignment',
51
+ options: [
52
+ {
53
+ label: 'Left',
54
+ value: 'left'
55
+ },
56
+ {
57
+ label: 'Center',
58
+ value: 'center'
59
+ },
60
+ {
61
+ label: 'Right',
62
+ value: 'right'
63
+ }
64
+ ]
65
+ },
66
+ fullWidth: {
67
+ type: 'radio',
68
+ label: 'Full Width',
69
+ options: [
70
+ {
71
+ label: 'No',
72
+ value: false
73
+ },
74
+ {
75
+ label: 'Yes',
76
+ value: true
77
+ }
78
+ ]
79
+ }
80
+ }
81
+ };
@@ -0,0 +1,3 @@
1
+ import type { ComponentConfig } from '@puckeditor/core';
2
+ import type { EmailButtonProps } from './EmailButton.types.js';
3
+ export declare const EmailButtonConfig: ComponentConfig<EmailButtonProps>;
@@ -0,0 +1,69 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { TABLE_ATTRS } from '../utils.js';
3
+ import { colorValueToEmailCSS } from '../../../fields/shared.js';
4
+ const defaultProps = {
5
+ text: 'Click Here',
6
+ href: '#',
7
+ backgroundColor: {
8
+ hex: '#007bff'
9
+ },
10
+ textColor: {
11
+ hex: '#ffffff'
12
+ },
13
+ borderRadius: 4,
14
+ padding: '12px 24px',
15
+ alignment: 'center',
16
+ fullWidth: false
17
+ };
18
+ export const EmailButtonConfig = {
19
+ label: 'Button',
20
+ defaultProps,
21
+ render: ({ text, href, backgroundColor, textColor, borderRadius, padding, alignment, fullWidth })=>{
22
+ const bgColor = colorValueToEmailCSS(backgroundColor) ?? '#007bff';
23
+ const txtColor = colorValueToEmailCSS(textColor) ?? '#ffffff';
24
+ const tableStyle = fullWidth ? {
25
+ width: '100%',
26
+ borderCollapse: 'collapse'
27
+ } : {
28
+ borderCollapse: 'collapse'
29
+ };
30
+ const alignAttr = fullWidth ? undefined : alignment;
31
+ return /*#__PURE__*/ _jsx("table", {
32
+ ...TABLE_ATTRS,
33
+ style: tableStyle,
34
+ align: alignAttr,
35
+ children: /*#__PURE__*/ _jsx("tbody", {
36
+ children: /*#__PURE__*/ _jsx("tr", {
37
+ children: /*#__PURE__*/ _jsx("td", {
38
+ align: "center",
39
+ style: {
40
+ backgroundColor: bgColor,
41
+ borderRadius: `${borderRadius}px`,
42
+ padding: 0
43
+ },
44
+ children: /*#__PURE__*/ _jsx("a", {
45
+ href: href,
46
+ target: "_blank",
47
+ rel: "noopener noreferrer",
48
+ style: {
49
+ display: 'inline-block',
50
+ width: fullWidth ? '100%' : undefined,
51
+ backgroundColor: bgColor,
52
+ color: txtColor,
53
+ fontWeight: 'bold',
54
+ fontSize: '16px',
55
+ textDecoration: 'none',
56
+ textAlign: 'center',
57
+ padding,
58
+ borderRadius: `${borderRadius}px`,
59
+ border: `1px solid ${bgColor}`,
60
+ boxSizing: 'border-box'
61
+ },
62
+ children: text
63
+ })
64
+ })
65
+ })
66
+ })
67
+ });
68
+ }
69
+ };
@@ -0,0 +1,11 @@
1
+ import type { ColorValue } from '../../../fields/shared.js';
2
+ export interface EmailButtonProps {
3
+ text: string;
4
+ href: string;
5
+ backgroundColor: ColorValue | null;
6
+ textColor: ColorValue | null;
7
+ borderRadius: number;
8
+ padding: string;
9
+ alignment: 'left' | 'center' | 'right';
10
+ fullWidth: boolean;
11
+ }
@@ -0,0 +1,2 @@
1
+ import type { ComponentConfig } from '@puckeditor/core';
2
+ export declare const EmailColumnsEditorConfig: ComponentConfig;
@@ -0,0 +1,45 @@
1
+ import { EmailColumnsConfig } from './EmailColumns.server.js';
2
+ export const EmailColumnsEditorConfig = {
3
+ ...EmailColumnsConfig,
4
+ fields: {
5
+ ...EmailColumnsConfig.fields,
6
+ columnCount: {
7
+ type: 'radio',
8
+ label: 'Columns',
9
+ options: [
10
+ {
11
+ label: '2',
12
+ value: 2
13
+ },
14
+ {
15
+ label: '3',
16
+ value: 3
17
+ }
18
+ ]
19
+ },
20
+ gap: {
21
+ type: 'number',
22
+ label: 'Gap (px)',
23
+ min: 0,
24
+ max: 48
25
+ },
26
+ verticalAlign: {
27
+ type: 'radio',
28
+ label: 'Vertical Align',
29
+ options: [
30
+ {
31
+ label: 'Top',
32
+ value: 'top'
33
+ },
34
+ {
35
+ label: 'Middle',
36
+ value: 'middle'
37
+ },
38
+ {
39
+ label: 'Bottom',
40
+ value: 'bottom'
41
+ }
42
+ ]
43
+ }
44
+ }
45
+ };
@@ -0,0 +1,2 @@
1
+ import type { ComponentConfig } from '@puckeditor/core';
2
+ export declare const EmailColumnsConfig: ComponentConfig;
@@ -0,0 +1,58 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { TABLE_ATTRS, FULL_WIDTH_TABLE_STYLE } from '../utils.js';
3
+ const defaultProps = {
4
+ columnCount: 2,
5
+ column1: [],
6
+ column2: [],
7
+ column3: [],
8
+ gap: 16,
9
+ verticalAlign: 'top'
10
+ };
11
+ export const EmailColumnsConfig = {
12
+ label: 'Columns',
13
+ fields: {
14
+ column1: {
15
+ type: 'slot'
16
+ },
17
+ column2: {
18
+ type: 'slot'
19
+ },
20
+ column3: {
21
+ type: 'slot'
22
+ }
23
+ },
24
+ defaultProps,
25
+ render: ({ columnCount, column1: Col1, column2: Col2, column3: Col3, gap, verticalAlign })=>{
26
+ const ColSlot1 = Col1;
27
+ const ColSlot2 = Col2;
28
+ const ColSlot3 = Col3;
29
+ const halfGap = Math.floor(gap / 2);
30
+ const colStyle = {
31
+ verticalAlign,
32
+ paddingLeft: `${halfGap}px`,
33
+ paddingRight: `${halfGap}px`
34
+ };
35
+ return /*#__PURE__*/ _jsx("table", {
36
+ ...TABLE_ATTRS,
37
+ style: FULL_WIDTH_TABLE_STYLE,
38
+ children: /*#__PURE__*/ _jsx("tbody", {
39
+ children: /*#__PURE__*/ _jsxs("tr", {
40
+ children: [
41
+ /*#__PURE__*/ _jsx("td", {
42
+ style: colStyle,
43
+ children: /*#__PURE__*/ _jsx(ColSlot1, {})
44
+ }),
45
+ /*#__PURE__*/ _jsx("td", {
46
+ style: colStyle,
47
+ children: /*#__PURE__*/ _jsx(ColSlot2, {})
48
+ }),
49
+ columnCount === 3 && /*#__PURE__*/ _jsx("td", {
50
+ style: colStyle,
51
+ children: /*#__PURE__*/ _jsx(ColSlot3, {})
52
+ })
53
+ ]
54
+ })
55
+ })
56
+ });
57
+ }
58
+ };
@@ -0,0 +1,8 @@
1
+ export interface EmailColumnsProps {
2
+ columnCount: 2 | 3;
3
+ column1: unknown;
4
+ column2: unknown;
5
+ column3: unknown;
6
+ gap: number;
7
+ verticalAlign: 'top' | 'middle' | 'bottom';
8
+ }
@@ -0,0 +1,3 @@
1
+ import type { ComponentConfig } from '@puckeditor/core';
2
+ import type { EmailDividerProps } from './EmailDivider.types.js';
3
+ export declare const EmailDividerEditorConfig: ComponentConfig<EmailDividerProps>;
@@ -0,0 +1,38 @@
1
+ import { EmailDividerConfig } from './EmailDivider.server.js';
2
+ import { createColorPickerField } from '../../../fields/ColorPickerField.js';
3
+ export const EmailDividerEditorConfig = {
4
+ ...EmailDividerConfig,
5
+ fields: {
6
+ color: createColorPickerField({
7
+ label: 'Color'
8
+ }),
9
+ thickness: {
10
+ type: 'number',
11
+ label: 'Thickness (px)',
12
+ min: 1,
13
+ max: 10
14
+ },
15
+ width: {
16
+ type: 'select',
17
+ label: 'Width',
18
+ options: [
19
+ {
20
+ label: '100%',
21
+ value: '100%'
22
+ },
23
+ {
24
+ label: '80%',
25
+ value: '80%'
26
+ },
27
+ {
28
+ label: '60%',
29
+ value: '60%'
30
+ },
31
+ {
32
+ label: '40%',
33
+ value: '40%'
34
+ }
35
+ ]
36
+ }
37
+ }
38
+ };
@@ -0,0 +1,3 @@
1
+ import type { ComponentConfig } from '@puckeditor/core';
2
+ import type { EmailDividerProps } from './EmailDivider.types.js';
3
+ export declare const EmailDividerConfig: ComponentConfig<EmailDividerProps>;
@@ -0,0 +1,38 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { TABLE_ATTRS } from '../utils.js';
3
+ import { colorValueToEmailCSS } from '../../../fields/shared.js';
4
+ const defaultProps = {
5
+ color: {
6
+ hex: '#dddddd'
7
+ },
8
+ thickness: 1,
9
+ width: '100%'
10
+ };
11
+ export const EmailDividerConfig = {
12
+ label: 'Divider',
13
+ defaultProps,
14
+ render: ({ color, thickness, width })=>{
15
+ const borderColor = colorValueToEmailCSS(color) ?? '#dddddd';
16
+ return /*#__PURE__*/ _jsx("table", {
17
+ ...TABLE_ATTRS,
18
+ style: {
19
+ width,
20
+ margin: '0 auto',
21
+ borderCollapse: 'collapse'
22
+ },
23
+ children: /*#__PURE__*/ _jsx("tbody", {
24
+ children: /*#__PURE__*/ _jsx("tr", {
25
+ children: /*#__PURE__*/ _jsx("td", {
26
+ style: {
27
+ borderTop: `${thickness}px solid ${borderColor}`,
28
+ fontSize: '1px',
29
+ lineHeight: '1px',
30
+ height: '1px'
31
+ },
32
+ children: " "
33
+ })
34
+ })
35
+ })
36
+ });
37
+ }
38
+ };
@@ -0,0 +1,6 @@
1
+ import type { ColorValue } from '../../../fields/shared.js';
2
+ export interface EmailDividerProps {
3
+ color: ColorValue | null;
4
+ thickness: number;
5
+ width: string;
6
+ }
@@ -0,0 +1,3 @@
1
+ import type { ComponentConfig } from '@puckeditor/core';
2
+ import type { EmailFooterProps } from './EmailFooter.types.js';
3
+ export declare const EmailFooterEditorConfig: ComponentConfig<EmailFooterProps>;
@@ -0,0 +1,22 @@
1
+ import { EmailFooterConfig } from './EmailFooter.server.js';
2
+ export const EmailFooterEditorConfig = {
3
+ ...EmailFooterConfig,
4
+ fields: {
5
+ companyName: {
6
+ type: 'text',
7
+ label: 'Company Name'
8
+ },
9
+ address: {
10
+ type: 'textarea',
11
+ label: 'Address'
12
+ },
13
+ unsubscribeText: {
14
+ type: 'text',
15
+ label: 'Unsubscribe Text'
16
+ },
17
+ unsubscribeUrl: {
18
+ type: 'text',
19
+ label: 'Unsubscribe URL'
20
+ }
21
+ }
22
+ };
@@ -0,0 +1,3 @@
1
+ import type { ComponentConfig } from '@puckeditor/core';
2
+ import type { EmailFooterProps } from './EmailFooter.types.js';
3
+ export declare const EmailFooterConfig: ComponentConfig<EmailFooterProps>;
@@ -0,0 +1,59 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { TABLE_ATTRS, FULL_WIDTH_TABLE_STYLE } from '../utils.js';
3
+ const mutedStyle = {
4
+ fontSize: '12px',
5
+ lineHeight: '1.5',
6
+ color: '#999999',
7
+ margin: '0 0 4px 0'
8
+ };
9
+ const defaultProps = {
10
+ companyName: 'Company Name',
11
+ address: '123 Main St, City, State 12345',
12
+ unsubscribeText: 'Unsubscribe',
13
+ unsubscribeUrl: '#'
14
+ };
15
+ export const EmailFooterConfig = {
16
+ label: 'Footer',
17
+ defaultProps,
18
+ render: ({ companyName, address, unsubscribeText, unsubscribeUrl })=>/*#__PURE__*/ _jsx("table", {
19
+ ...TABLE_ATTRS,
20
+ style: FULL_WIDTH_TABLE_STYLE,
21
+ children: /*#__PURE__*/ _jsx("tbody", {
22
+ children: /*#__PURE__*/ _jsx("tr", {
23
+ children: /*#__PURE__*/ _jsxs("td", {
24
+ align: "center",
25
+ style: {
26
+ padding: '20px',
27
+ textAlign: 'center',
28
+ borderTop: '1px solid #eeeeee'
29
+ },
30
+ children: [
31
+ /*#__PURE__*/ _jsx("p", {
32
+ style: mutedStyle,
33
+ children: companyName
34
+ }),
35
+ /*#__PURE__*/ _jsx("p", {
36
+ style: mutedStyle,
37
+ children: address
38
+ }),
39
+ /*#__PURE__*/ _jsx("p", {
40
+ style: {
41
+ ...mutedStyle,
42
+ marginTop: '8px'
43
+ },
44
+ children: /*#__PURE__*/ _jsx("a", {
45
+ href: unsubscribeUrl,
46
+ style: {
47
+ color: '#999999',
48
+ textDecoration: 'underline',
49
+ fontSize: '12px'
50
+ },
51
+ children: unsubscribeText
52
+ })
53
+ })
54
+ ]
55
+ })
56
+ })
57
+ })
58
+ })
59
+ };
@@ -0,0 +1,6 @@
1
+ export interface EmailFooterProps {
2
+ companyName: string;
3
+ address: string;
4
+ unsubscribeText: string;
5
+ unsubscribeUrl: string;
6
+ }
@@ -0,0 +1,3 @@
1
+ import type { ComponentConfig } from '@puckeditor/core';
2
+ import type { EmailHeaderProps } from './EmailHeader.types.js';
3
+ export declare const EmailHeaderEditorConfig: ComponentConfig<EmailHeaderProps>;
@@ -0,0 +1,28 @@
1
+ import { EmailHeaderConfig } from './EmailHeader.server.js';
2
+ import { createColorPickerField } from '../../../fields/ColorPickerField.js';
3
+ export const EmailHeaderEditorConfig = {
4
+ ...EmailHeaderConfig,
5
+ fields: {
6
+ logoSrc: {
7
+ type: 'text',
8
+ label: 'Logo URL'
9
+ },
10
+ logoAlt: {
11
+ type: 'text',
12
+ label: 'Logo Alt Text'
13
+ },
14
+ logoWidth: {
15
+ type: 'number',
16
+ label: 'Logo Width (px)',
17
+ min: 30,
18
+ max: 400
19
+ },
20
+ title: {
21
+ type: 'text',
22
+ label: 'Title (optional)'
23
+ },
24
+ backgroundColor: createColorPickerField({
25
+ label: 'Background Color'
26
+ })
27
+ }
28
+ };
@@ -0,0 +1,3 @@
1
+ import type { ComponentConfig } from '@puckeditor/core';
2
+ import type { EmailHeaderProps } from './EmailHeader.types.js';
3
+ export declare const EmailHeaderConfig: ComponentConfig<EmailHeaderProps>;
@@ -0,0 +1,60 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { TABLE_ATTRS, FULL_WIDTH_TABLE_STYLE } from '../utils.js';
3
+ import { colorValueToEmailCSS } from '../../../fields/shared.js';
4
+ const defaultProps = {
5
+ logoSrc: '',
6
+ logoAlt: 'Logo',
7
+ logoWidth: 150,
8
+ title: '',
9
+ backgroundColor: {
10
+ hex: '#ffffff'
11
+ }
12
+ };
13
+ export const EmailHeaderConfig = {
14
+ label: 'Header',
15
+ defaultProps,
16
+ render: ({ logoSrc, logoAlt, logoWidth, title, backgroundColor })=>{
17
+ const bgColor = colorValueToEmailCSS(backgroundColor) ?? '#ffffff';
18
+ return /*#__PURE__*/ _jsx("table", {
19
+ ...TABLE_ATTRS,
20
+ style: FULL_WIDTH_TABLE_STYLE,
21
+ children: /*#__PURE__*/ _jsx("tbody", {
22
+ children: /*#__PURE__*/ _jsx("tr", {
23
+ children: /*#__PURE__*/ _jsxs("td", {
24
+ align: "center",
25
+ style: {
26
+ backgroundColor: bgColor,
27
+ padding: '20px',
28
+ textAlign: 'center'
29
+ },
30
+ children: [
31
+ logoSrc && /*#__PURE__*/ _jsx("img", {
32
+ src: logoSrc,
33
+ alt: logoAlt,
34
+ width: logoWidth,
35
+ style: {
36
+ display: 'block',
37
+ margin: '0 auto',
38
+ width: `${logoWidth}px`,
39
+ maxWidth: '100%',
40
+ height: 'auto',
41
+ border: 0
42
+ }
43
+ }),
44
+ title && /*#__PURE__*/ _jsx("p", {
45
+ style: {
46
+ margin: logoSrc ? '12px 0 0 0' : '0',
47
+ fontSize: '24px',
48
+ fontWeight: 'bold',
49
+ color: '#333333',
50
+ lineHeight: '1.2'
51
+ },
52
+ children: title
53
+ })
54
+ ]
55
+ })
56
+ })
57
+ })
58
+ });
59
+ }
60
+ };
@@ -0,0 +1,8 @@
1
+ import type { ColorValue } from '../../../fields/shared.js';
2
+ export interface EmailHeaderProps {
3
+ logoSrc: string;
4
+ logoAlt: string;
5
+ logoWidth: number;
6
+ title: string;
7
+ backgroundColor: ColorValue | null;
8
+ }
@@ -0,0 +1,3 @@
1
+ import type { ComponentConfig } from '@puckeditor/core';
2
+ import type { EmailHeadingProps } from './EmailHeading.types.js';
3
+ export declare const EmailHeadingEditorConfig: ComponentConfig<EmailHeadingProps>;