@comet/mail-react 9.0.0-beta.5 → 9.0.0-beta.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.
Files changed (96) hide show
  1. package/README.md +12 -5
  2. package/lib/blocks.generated.d.ts +1 -0
  3. package/lib/components/button/HtmlButton.d.ts +9 -0
  4. package/lib/components/button/HtmlButton.js +58 -0
  5. package/lib/components/button/MjmlButton.d.ts +10 -0
  6. package/lib/components/button/MjmlButton.js +91 -0
  7. package/lib/components/button/buttonProps.d.ts +35 -0
  8. package/lib/components/button/defaultButtonStyles.d.ts +2 -0
  9. package/lib/components/button/defaultButtonStyles.js +9 -0
  10. package/lib/components/button/generateResponsiveButtonCss.d.ts +8 -0
  11. package/lib/components/button/generateResponsiveButtonCss.js +21 -0
  12. package/lib/components/divider/dividerProps.d.ts +16 -3
  13. package/lib/components/divider/generateResponsiveDividerCss.js +11 -51
  14. package/lib/components/inlineLink/HtmlInlineLink.d.ts +8 -1
  15. package/lib/components/mailRoot/MjmlMailRoot.d.ts +3 -2
  16. package/lib/components/section/MjmlSection.d.ts +7 -1
  17. package/lib/components/text/HtmlText.d.ts +3 -0
  18. package/lib/components/text/MjmlText.d.ts +3 -0
  19. package/lib/components/text/textStyles.js +20 -70
  20. package/lib/components/wrapper/MjmlWrapper.d.ts +9 -2
  21. package/lib/components/wrapper/MjmlWrapper.js +1 -1
  22. package/lib/index.d.ts +6 -2
  23. package/lib/index.js +3 -1
  24. package/lib/styles/generateResponsiveVariantCss.d.ts +26 -0
  25. package/lib/styles/generateResponsiveVariantCss.js +66 -0
  26. package/lib/theme/createTheme.d.ts +2 -1
  27. package/lib/theme/createTheme.js +1 -0
  28. package/lib/theme/defaultTheme.js +2 -0
  29. package/lib/theme/themeTypes.d.ts +57 -0
  30. package/package.json +13 -6
  31. package/lib/__stories__/examples/CustomBackgroundForFooter.stories.d.ts +0 -5
  32. package/lib/__stories__/examples/CustomBackgroundForFooter.stories.js +0 -32
  33. package/lib/__stories__/examples/CustomNestedFooterTheme.stories.d.ts +0 -5
  34. package/lib/__stories__/examples/CustomNestedFooterTheme.stories.js +0 -32
  35. package/lib/__stories__/examples/NotificationEmail.stories.d.ts +0 -5
  36. package/lib/__stories__/examples/NotificationEmail.stories.js +0 -25
  37. package/lib/__stories__/layout-patterns/AsymmetricTwoColumnLayout.stories.d.ts +0 -6
  38. package/lib/__stories__/layout-patterns/AsymmetricTwoColumnLayout.stories.js +0 -108
  39. package/lib/__stories__/layout-patterns/SymmetricFourColumnLayout.stories.d.ts +0 -4
  40. package/lib/__stories__/layout-patterns/SymmetricFourColumnLayout.stories.js +0 -58
  41. package/lib/__stories__/layout-patterns/SymmetricThreeColumnLayout.stories.d.ts +0 -5
  42. package/lib/__stories__/layout-patterns/SymmetricThreeColumnLayout.stories.js +0 -104
  43. package/lib/__stories__/layout-patterns/SymmetricTwoColumnLayout.stories.d.ts +0 -4
  44. package/lib/__stories__/layout-patterns/SymmetricTwoColumnLayout.stories.js +0 -47
  45. package/lib/blocks/pixelImage/__stories__/HtmlPixelImageBlock.stories.d.ts +0 -7
  46. package/lib/blocks/pixelImage/__stories__/HtmlPixelImageBlock.stories.js +0 -54
  47. package/lib/blocks/pixelImage/__stories__/MjmlPixelImageBlock.stories.d.ts +0 -7
  48. package/lib/blocks/pixelImage/__stories__/MjmlPixelImageBlock.stories.js +0 -54
  49. package/lib/blocks/pixelImage/__stories__/exampleBlockData.d.ts +0 -2
  50. package/lib/blocks/pixelImage/__stories__/exampleBlockData.js +0 -19
  51. package/lib/blocks/pixelImage/__tests__/usePixelImageBlockConfig.test.js +0 -21
  52. package/lib/blocks/pixelImage/__tests__/usePixelImageBlockData.test.d.ts +0 -1
  53. package/lib/blocks/pixelImage/__tests__/usePixelImageBlockData.test.js +0 -205
  54. package/lib/components/divider/__stories__/HtmlDivider.stories.d.ts +0 -10
  55. package/lib/components/divider/__stories__/HtmlDivider.stories.js +0 -60
  56. package/lib/components/divider/__stories__/MjmlDivider.stories.d.ts +0 -10
  57. package/lib/components/divider/__stories__/MjmlDivider.stories.js +0 -60
  58. package/lib/components/divider/__tests__/HtmlDivider.test.d.ts +0 -1
  59. package/lib/components/divider/__tests__/HtmlDivider.test.js +0 -144
  60. package/lib/components/divider/__tests__/MjmlDivider.test.d.ts +0 -1
  61. package/lib/components/divider/__tests__/MjmlDivider.test.js +0 -43
  62. package/lib/components/image/__stories__/HtmlImage.stories.d.ts +0 -7
  63. package/lib/components/image/__stories__/HtmlImage.stories.js +0 -32
  64. package/lib/components/image/__stories__/MjmlImage.stories.d.ts +0 -7
  65. package/lib/components/image/__stories__/MjmlImage.stories.js +0 -32
  66. package/lib/components/inlineLink/__stories__/HtmlInlineLink.stories.d.ts +0 -12
  67. package/lib/components/inlineLink/__stories__/HtmlInlineLink.stories.js +0 -56
  68. package/lib/components/mailRoot/__stories__/MjmlMailRoot.stories.d.ts +0 -7
  69. package/lib/components/mailRoot/__stories__/MjmlMailRoot.stories.js +0 -18
  70. package/lib/components/section/__stories__/MjmlSection.stories.d.ts +0 -9
  71. package/lib/components/section/__stories__/MjmlSection.stories.js +0 -30
  72. package/lib/components/text/__stories__/HtmlText.stories.d.ts +0 -12
  73. package/lib/components/text/__stories__/HtmlText.stories.js +0 -77
  74. package/lib/components/text/__stories__/MjmlText.stories.d.ts +0 -10
  75. package/lib/components/text/__stories__/MjmlText.stories.js +0 -71
  76. package/lib/components/text/__tests__/HtmlText.test.d.ts +0 -1
  77. package/lib/components/text/__tests__/HtmlText.test.js +0 -157
  78. package/lib/components/text/__tests__/MjmlText.test.d.ts +0 -1
  79. package/lib/components/text/__tests__/MjmlText.test.js +0 -112
  80. package/lib/components/wrapper/__stories__/MjmlWrapper.stories.d.ts +0 -10
  81. package/lib/components/wrapper/__stories__/MjmlWrapper.stories.js +0 -36
  82. package/lib/config/ConfigProvider.test.d.ts +0 -8
  83. package/lib/config/ConfigProvider.test.js +0 -30
  84. package/lib/server/renderMailHtml.test.d.ts +0 -1
  85. package/lib/server/renderMailHtml.test.js +0 -52
  86. package/lib/storybook/replaceImagesWithPublicUrl.test.d.ts +0 -1
  87. package/lib/storybook/replaceImagesWithPublicUrl.test.js +0 -55
  88. package/lib/theme/__stories__/ThemeProvider.stories.d.ts +0 -7
  89. package/lib/theme/__stories__/ThemeProvider.stories.js +0 -23
  90. package/lib/theme/createTheme.test.d.ts +0 -1
  91. package/lib/theme/createTheme.test.js +0 -52
  92. package/lib/theme/responsiveValue.test.d.ts +0 -1
  93. package/lib/theme/responsiveValue.test.js +0 -62
  94. package/lib/utils/css.test.d.ts +0 -1
  95. package/lib/utils/css.test.js +0 -26
  96. /package/lib/{blocks/pixelImage/__tests__/usePixelImageBlockConfig.test.d.ts → components/button/buttonProps.js} +0 -0
@@ -1,60 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { MjmlColumn, MjmlSpacer } from "@faire/mjml-react";
3
- import { createTheme } from "../../../theme/createTheme.js";
4
- import { MjmlSection } from "../../section/MjmlSection.js";
5
- import { MjmlDivider } from "../MjmlDivider.js";
6
- const config = {
7
- title: "Components/MjmlDivider",
8
- component: MjmlDivider,
9
- tags: ["autodocs"],
10
- argTypes: {
11
- variant: { control: "text" },
12
- height: { control: "number" },
13
- backgroundColor: { control: "text" },
14
- backgroundImage: { control: "text" },
15
- className: { control: "text" },
16
- style: { control: false },
17
- },
18
- render: (args) => (_jsx(MjmlSection, { indent: true, children: _jsxs(MjmlColumn, { children: [_jsx(MjmlSpacer, { height: "16px" }), _jsx(MjmlDivider, { ...args }), _jsx(MjmlSpacer, { height: "16px" })] }) })),
19
- };
20
- export default config;
21
- export const Default = {};
22
- export const CustomHeightAndColor = {
23
- args: {
24
- height: 8,
25
- backgroundColor: "#FF6B6B",
26
- },
27
- };
28
- export const WithTheme = {
29
- parameters: {
30
- theme: createTheme({
31
- divider: {
32
- height: 2,
33
- backgroundColor: "#5B4FC7",
34
- },
35
- }),
36
- },
37
- };
38
- export const WithVariants = {
39
- parameters: {
40
- theme: createTheme({
41
- divider: {
42
- defaultVariant: "thin",
43
- variants: {
44
- thin: { height: 1, backgroundColor: "#999999" },
45
- thick: { height: { default: 12, mobile: 8 }, backgroundColor: "#222222" },
46
- },
47
- },
48
- }),
49
- },
50
- render: (args) => (_jsx(MjmlSection, { indent: true, children: _jsxs(MjmlColumn, { children: [_jsx(MjmlSpacer, { height: "16px" }), _jsx(MjmlDivider, { ...args }), _jsx(MjmlSpacer, { height: "16px" }), _jsx(MjmlDivider, { ...args, variant: "thick" }), _jsx(MjmlSpacer, { height: "16px" })] }) })),
51
- };
52
- export const GradientWithFallback = {
53
- // `backgroundColor` is the solid fallback for clients that
54
- // don't render `background-image` (notably older Outlook).
55
- args: {
56
- height: 6,
57
- backgroundColor: "#5B4FC7",
58
- backgroundImage: "linear-gradient(to right, #5B4FC7, #FF6B6B, #FFD166)",
59
- },
60
- };
@@ -1,144 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { renderToStaticMarkup } from "react-dom/server";
3
- import { describe, expect, it } from "vitest";
4
- import { createTheme } from "../../../theme/createTheme.js";
5
- import { ThemeProvider } from "../../../theme/ThemeProvider.js";
6
- import { generateHtmlDividerStyles, HtmlDivider } from "../HtmlDivider.js";
7
- function renderHtmlDivider(element) {
8
- return renderToStaticMarkup(element);
9
- }
10
- describe("HtmlDivider", () => {
11
- it("renders default theme styles across modern, Outlook, and legacy clients", () => {
12
- const theme = createTheme();
13
- const html = renderHtmlDivider(_jsx(ThemeProvider, { theme: theme, children: _jsx(HtmlDivider, {}) }));
14
- // Modern clients: inline height and background color.
15
- expect(html).toContain("height:4px");
16
- expect(html).toContain("background-color:#000000");
17
- // Outlook: mso-line-height-rule with matching line-height; font-size:0 keeps the spacer character from adding height.
18
- expect(html).toContain("mso-line-height-rule:exactly");
19
- expect(html).toContain("line-height:4px");
20
- expect(html).toContain("font-size:0");
21
- // Legacy Outlook: attribute fallbacks for clients that ignore inline CSS.
22
- expect(html).toContain('bgcolor="#000000"');
23
- expect(html).toContain('height="4"');
24
- });
25
- it("applies variant styles over base theme styles", () => {
26
- const theme = createTheme({
27
- divider: {
28
- variants: {
29
- thick: { height: 10, backgroundColor: "#222222" },
30
- },
31
- },
32
- });
33
- const html = renderHtmlDivider(_jsx(ThemeProvider, { theme: theme, children: _jsx(HtmlDivider, { variant: "thick" }) }));
34
- expect(html).toContain("height:10px");
35
- expect(html).toContain("background-color:#222222");
36
- expect(html).toContain("htmlDivider--thick");
37
- });
38
- it("inherits base divider styles not overridden by variant", () => {
39
- const theme = createTheme({
40
- divider: {
41
- backgroundColor: "#222222",
42
- variants: {
43
- thick: { height: 10 },
44
- },
45
- },
46
- });
47
- const html = renderHtmlDivider(_jsx(ThemeProvider, { theme: theme, children: _jsx(HtmlDivider, { variant: "thick" }) }));
48
- expect(html).toContain("height:10px");
49
- expect(html).toContain("background-color:#222222");
50
- });
51
- it("applies defaultVariant when no variant prop is specified", () => {
52
- const theme = createTheme({
53
- divider: {
54
- defaultVariant: "thin",
55
- variants: {
56
- thin: { height: 1 },
57
- },
58
- },
59
- });
60
- const html = renderHtmlDivider(_jsx(ThemeProvider, { theme: theme, children: _jsx(HtmlDivider, {}) }));
61
- expect(html).toContain("height:1px");
62
- expect(html).toContain("htmlDivider--thin");
63
- });
64
- it("per-instance height prop overrides theme and variant", () => {
65
- const theme = createTheme({
66
- divider: {
67
- height: 4,
68
- variants: { thin: { height: 1 } },
69
- },
70
- });
71
- const html = renderHtmlDivider(_jsx(ThemeProvider, { theme: theme, children: _jsx(HtmlDivider, { variant: "thin", height: 12 }) }));
72
- expect(html).toContain("height:12px");
73
- });
74
- it("applies variant backgroundImage with the variant backgroundColor as fallback", () => {
75
- const theme = createTheme({
76
- divider: {
77
- variants: {
78
- gradient: {
79
- backgroundColor: "#5B4FC7",
80
- backgroundImage: "linear-gradient(to right, red, blue)",
81
- },
82
- },
83
- },
84
- });
85
- const html = renderHtmlDivider(_jsx(ThemeProvider, { theme: theme, children: _jsx(HtmlDivider, { variant: "gradient" }) }));
86
- expect(html).toContain("background-color:#5B4FC7");
87
- expect(html).toContain("background-image:linear-gradient(to right, red, blue)");
88
- });
89
- it("lets consumer style prop layer over theme styles", () => {
90
- const theme = createTheme();
91
- const html = renderHtmlDivider(_jsx(ThemeProvider, { theme: theme, children: _jsx(HtmlDivider, { style: { backgroundImage: "linear-gradient(to right, red, blue)" } }) }));
92
- // Solid color fallback stays for clients that don't render gradients.
93
- expect(html).toContain("background-color:#000000");
94
- expect(html).toContain("background-image:linear-gradient(to right, red, blue)");
95
- });
96
- it("falls back to default styles when used without a ThemeProvider", () => {
97
- const html = renderHtmlDivider(_jsx(HtmlDivider, {}));
98
- expect(html).toContain("height:4px");
99
- expect(html).toContain("background-color:#000000");
100
- });
101
- it("throws when variant is set without a ThemeProvider", () => {
102
- expect(() => renderHtmlDivider(_jsx(HtmlDivider, { variant: "thin" }))).toThrow();
103
- });
104
- });
105
- describe("generateHtmlDividerStyles", () => {
106
- it("returns empty CSS when no variants are defined", () => {
107
- const theme = createTheme();
108
- expect(generateHtmlDividerStyles(theme)).toBe("");
109
- });
110
- it("emits height and line-height together for responsive variants", () => {
111
- const theme = createTheme({
112
- divider: {
113
- variants: {
114
- thin: { height: { default: 4, mobile: 2 } },
115
- },
116
- },
117
- });
118
- const result = generateHtmlDividerStyles(theme);
119
- expect(result).toContain(".htmlDivider--thin td");
120
- expect(result).toContain("height: 2px !important");
121
- expect(result).toContain("line-height: 2px !important");
122
- });
123
- it("emits background-color overrides for responsive variants", () => {
124
- const theme = createTheme({
125
- divider: {
126
- variants: {
127
- accent: { backgroundColor: { default: "#5B4FC7", mobile: "#FF6B6B" } },
128
- },
129
- },
130
- });
131
- const result = generateHtmlDividerStyles(theme);
132
- expect(result).toContain("background-color: #FF6B6B !important");
133
- });
134
- it("emits no media queries for a non-responsive variant", () => {
135
- const theme = createTheme({
136
- divider: {
137
- variants: {
138
- thick: { height: 8 },
139
- },
140
- },
141
- });
142
- expect(generateHtmlDividerStyles(theme)).not.toContain("@media");
143
- });
144
- });
@@ -1,43 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { MjmlColumn } from "@faire/mjml-react";
3
- import { renderToStaticMarkup } from "react-dom/server";
4
- import { describe, expect, it } from "vitest";
5
- import { renderMailHtml } from "../../../server/renderMailHtml.js";
6
- import { createTheme } from "../../../theme/createTheme.js";
7
- import { MjmlMailRoot } from "../../mailRoot/MjmlMailRoot.js";
8
- import { MjmlSection } from "../../section/MjmlSection.js";
9
- import { MjmlDivider } from "../MjmlDivider.js";
10
- describe("MjmlDivider integration", () => {
11
- it("produces no MJML warnings inside an MjmlMailRoot", () => {
12
- const theme = createTheme({
13
- divider: {
14
- variants: {
15
- thin: { height: 1, backgroundColor: "#999999" },
16
- thick: { height: 8, backgroundColor: "#222222" },
17
- },
18
- },
19
- });
20
- const { mjmlWarnings } = renderMailHtml(_jsx(MjmlMailRoot, { theme: theme, children: _jsx(MjmlSection, { children: _jsxs(MjmlColumn, { children: [_jsx(MjmlDivider, {}), _jsx(MjmlDivider, { variant: "thin" }), _jsx(MjmlDivider, { variant: "thick" })] }) }) }));
21
- expect(mjmlWarnings).toEqual([]);
22
- });
23
- it("applies a variant modifier class to both mjmlDivider and htmlDivider blocks", () => {
24
- const theme = createTheme({
25
- divider: {
26
- variants: {
27
- thick: { height: 8 },
28
- },
29
- },
30
- });
31
- const { html } = renderMailHtml(_jsx(MjmlMailRoot, { theme: theme, children: _jsx(MjmlSection, { children: _jsx(MjmlColumn, { children: _jsx(MjmlDivider, { variant: "thick" }) }) }) }));
32
- expect(html).toContain("mjmlDivider--thick");
33
- expect(html).toContain("htmlDivider--thick");
34
- });
35
- it("falls back to default theme values when used without a ThemeProvider", () => {
36
- const html = renderToStaticMarkup(_jsx(MjmlDivider, {}));
37
- expect(html).toContain("height:4px");
38
- expect(html).toContain("background-color:#000000");
39
- });
40
- it("throws when variant is set without a ThemeProvider", () => {
41
- expect(() => renderToStaticMarkup(_jsx(MjmlDivider, { variant: "thin" }))).toThrow();
42
- });
43
- });
@@ -1,7 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/react-vite";
2
- import { HtmlImage } from "../HtmlImage.js";
3
- type Story = StoryObj<typeof HtmlImage>;
4
- declare const config: Meta<typeof HtmlImage>;
5
- export default config;
6
- export declare const Default: Story;
7
- export declare const FullWidth: Story;
@@ -1,32 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { MjmlColumn, MjmlRaw } from "@faire/mjml-react";
3
- import { defaultTheme } from "../../../theme/defaultTheme.js";
4
- import { getDefaultFromResponsiveValue } from "../../../theme/responsiveValue.js";
5
- import { MjmlSection } from "../../section/MjmlSection.js";
6
- import { HtmlImage } from "../HtmlImage.js";
7
- const sectionIndent = getDefaultFromResponsiveValue(defaultTheme.sizes.contentIndentation);
8
- const sectionInnerWidth = defaultTheme.sizes.bodyWidth - 2 * sectionIndent;
9
- const config = {
10
- title: "Components/HtmlImage",
11
- component: HtmlImage,
12
- tags: ["autodocs"],
13
- args: {
14
- width: sectionInnerWidth,
15
- height: 268,
16
- alt: "Placeholder image",
17
- },
18
- argTypes: {
19
- src: { control: false },
20
- },
21
- };
22
- export default config;
23
- export const Default = {
24
- render: (args) => (_jsx(MjmlSection, { indent: true, children: _jsx(MjmlColumn, { children: _jsx(MjmlRaw, { children: _jsx(HtmlImage, { ...args, src: `https://picsum.photos/seed/html-image/${args.width}/${args.height}` }) }) }) })),
25
- };
26
- export const FullWidth = {
27
- args: {
28
- width: defaultTheme.sizes.bodyWidth,
29
- height: 300,
30
- },
31
- render: (args) => (_jsx(MjmlSection, { children: _jsx(MjmlColumn, { children: _jsx(MjmlRaw, { children: _jsx(HtmlImage, { ...args, src: `https://picsum.photos/seed/html-image-full-width/${args.width}/${args.height}` }) }) }) })),
32
- };
@@ -1,7 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/react-vite";
2
- import { MjmlImage } from "../MjmlImage.js";
3
- type Story = StoryObj<typeof MjmlImage>;
4
- declare const config: Meta<typeof MjmlImage>;
5
- export default config;
6
- export declare const Default: Story;
7
- export declare const FullWidth: Story;
@@ -1,32 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { MjmlColumn } from "@faire/mjml-react";
3
- import { defaultTheme } from "../../../theme/defaultTheme.js";
4
- import { getDefaultFromResponsiveValue } from "../../../theme/responsiveValue.js";
5
- import { MjmlSection } from "../../section/MjmlSection.js";
6
- import { MjmlImage } from "../MjmlImage.js";
7
- const sectionIndent = getDefaultFromResponsiveValue(defaultTheme.sizes.contentIndentation);
8
- const sectionInnerWidth = defaultTheme.sizes.bodyWidth - 2 * sectionIndent;
9
- const config = {
10
- title: "Components/MjmlImage",
11
- component: MjmlImage,
12
- tags: ["autodocs"],
13
- args: {
14
- width: sectionInnerWidth,
15
- height: 268,
16
- alt: "Placeholder image",
17
- },
18
- argTypes: {
19
- src: { control: false },
20
- },
21
- };
22
- export default config;
23
- export const Default = {
24
- render: (args) => (_jsx(MjmlSection, { indent: true, children: _jsx(MjmlColumn, { children: _jsx(MjmlImage, { ...args, src: `https://picsum.photos/seed/mjml-image/${args.width}/${args.height}` }) }) })),
25
- };
26
- export const FullWidth = {
27
- args: {
28
- width: defaultTheme.sizes.bodyWidth,
29
- height: 300,
30
- },
31
- render: (args) => (_jsx(MjmlSection, { children: _jsx(MjmlColumn, { children: _jsx(MjmlImage, { ...args, src: `https://picsum.photos/seed/mjml-image-full-width/${args.width}/${args.height}` }) }) })),
32
- };
@@ -1,12 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/react-vite";
2
- import { HtmlInlineLink } from "../HtmlInlineLink.js";
3
- type Story = StoryObj<typeof HtmlInlineLink>;
4
- declare const config: Meta<typeof HtmlInlineLink>;
5
- export default config;
6
- export declare const InText: Story;
7
- /**
8
- * Using `!important` overrides the component's responsive `inherit !important`
9
- * reset, ensuring the custom color persists on both desktop and mobile.
10
- */
11
- export declare const CustomColorOverride: Story;
12
- export declare const WithTextVariants: Story;
@@ -1,56 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { MjmlColumn } from "@faire/mjml-react";
3
- import { createTheme } from "../../../theme/createTheme.js";
4
- import { MjmlSection } from "../../section/MjmlSection.js";
5
- import { MjmlText } from "../../text/MjmlText.js";
6
- import { HtmlInlineLink } from "../HtmlInlineLink.js";
7
- const config = {
8
- title: "Components/HtmlInlineLink",
9
- component: HtmlInlineLink,
10
- tags: ["autodocs"],
11
- };
12
- export default config;
13
- export const InText = {
14
- parameters: {
15
- theme: createTheme({
16
- text: {
17
- fontFamily: "Arial, sans-serif",
18
- fontSize: "16px",
19
- lineHeight: "24px",
20
- color: "#333333",
21
- },
22
- }),
23
- },
24
- render: () => (_jsx(MjmlSection, { children: _jsx(MjmlColumn, { children: _jsxs(MjmlText, { children: ["Visit our ", _jsx(HtmlInlineLink, { href: "https://example.com", children: "website" }), " for more information."] }) }) })),
25
- };
26
- /**
27
- * Using `!important` overrides the component's responsive `inherit !important`
28
- * reset, ensuring the custom color persists on both desktop and mobile.
29
- */
30
- export const CustomColorOverride = {
31
- parameters: {
32
- theme: createTheme({
33
- text: {
34
- fontFamily: "Arial, sans-serif",
35
- fontSize: "16px",
36
- color: "#333333",
37
- },
38
- }),
39
- },
40
- render: () => (_jsx(MjmlSection, { children: _jsx(MjmlColumn, { children: _jsxs(MjmlText, { children: ["Click", " ", _jsx(HtmlInlineLink, { href: "https://example.com", style: { color: "#0066cc !important" }, children: "here" }), " ", "to continue."] }) }) })),
41
- };
42
- export const WithTextVariants = {
43
- parameters: {
44
- theme: createTheme({
45
- text: {
46
- fontFamily: "Arial, sans-serif",
47
- color: "#333333",
48
- variants: {
49
- heading: { fontSize: "32px", fontWeight: 700, lineHeight: "40px" },
50
- body: { fontSize: "16px", lineHeight: "24px" },
51
- },
52
- },
53
- }),
54
- },
55
- render: () => (_jsx(MjmlSection, { children: _jsxs(MjmlColumn, { children: [_jsxs(MjmlText, { variant: "heading", bottomSpacing: true, children: ["Welcome to ", _jsx(HtmlInlineLink, { href: "https://example.com", children: "our platform" })] }), _jsxs(MjmlText, { variant: "body", children: ["Explore our ", _jsx(HtmlInlineLink, { href: "https://example.com/features", children: "features" }), " and start building today."] })] }) })),
56
- };
@@ -1,7 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/react-vite";
2
- import { MjmlMailRoot } from "../MjmlMailRoot.js";
3
- type Story = StoryObj<typeof MjmlMailRoot>;
4
- declare const config: Meta<typeof MjmlMailRoot>;
5
- export default config;
6
- export declare const Basic: Story;
7
- export declare const CustomBodyBackground: Story;
@@ -1,18 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { MjmlColumn, MjmlText } from "@faire/mjml-react";
3
- import { createTheme } from "../../../theme/createTheme.js";
4
- import { MjmlSection } from "../../section/MjmlSection.js";
5
- import { MjmlMailRoot } from "../MjmlMailRoot.js";
6
- const config = {
7
- title: "Components/MjmlMailRoot",
8
- component: MjmlMailRoot,
9
- tags: ["autodocs"],
10
- parameters: { mailRoot: false },
11
- };
12
- export default config;
13
- export const Basic = {
14
- render: () => (_jsx(MjmlMailRoot, { children: _jsx(MjmlSection, { indent: true, children: _jsx(MjmlColumn, { children: _jsx(MjmlText, { children: "Hello from MjmlMailRoot" }) }) }) })),
15
- };
16
- export const CustomBodyBackground = {
17
- render: () => (_jsx(MjmlMailRoot, { theme: createTheme({ colors: { background: { body: "#EAEAEA" } } }), children: _jsx(MjmlSection, { indent: true, children: _jsx(MjmlColumn, { children: _jsx(MjmlText, { children: "Custom body background color" }) }) }) })),
18
- };
@@ -1,9 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/react-vite";
2
- import { MjmlSection } from "../MjmlSection.js";
3
- type Story = StoryObj<typeof MjmlSection>;
4
- declare const config: Meta<typeof MjmlSection>;
5
- export default config;
6
- export declare const Primary: Story;
7
- export declare const Indented: Story;
8
- export declare const ExplicitBackgroundColor: Story;
9
- export declare const DisabledResponsiveBehavior: Story;
@@ -1,30 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { MjmlColumn, MjmlText } from "@faire/mjml-react";
3
- import { MjmlSection } from "../MjmlSection.js";
4
- const config = {
5
- title: "Components/MjmlSection",
6
- component: MjmlSection,
7
- tags: ["autodocs"],
8
- };
9
- export default config;
10
- export const Primary = {
11
- render: (args) => (_jsx(MjmlSection, { ...args, children: _jsx(MjmlColumn, { children: _jsx(MjmlText, { children: "Section content" }) }) })),
12
- };
13
- export const Indented = {
14
- args: {
15
- indent: true,
16
- },
17
- render: (args) => (_jsx(MjmlSection, { ...args, children: _jsx(MjmlColumn, { children: _jsx(MjmlText, { children: "Indented section content" }) }) })),
18
- };
19
- export const ExplicitBackgroundColor = {
20
- args: {
21
- backgroundColor: "#FF0000",
22
- },
23
- render: (args) => (_jsx(MjmlSection, { ...args, children: _jsx(MjmlColumn, { children: _jsx(MjmlText, { children: "Explicit backgroundColor overrides theme default" }) }) })),
24
- };
25
- export const DisabledResponsiveBehavior = {
26
- args: {
27
- disableResponsiveBehavior: true,
28
- },
29
- render: (args) => (_jsxs(MjmlSection, { ...args, children: [_jsx(MjmlColumn, { children: _jsx(MjmlText, { children: "First column" }) }), _jsx(MjmlColumn, { children: _jsx(MjmlText, { children: "Second column" }) })] })),
30
- };
@@ -1,12 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/react-vite";
2
- import { HtmlText } from "../HtmlText.js";
3
- type Story = StoryObj<typeof HtmlText>;
4
- declare const config: Meta<typeof HtmlText>;
5
- export default config;
6
- export declare const Default: Story;
7
- export declare const WithVariants: Story;
8
- export declare const ResponsiveVariants: Story;
9
- export declare const BottomSpacing: Story;
10
- export declare const DefaultVariant: Story;
11
- export declare const ElementPropAsDiv: Story;
12
- export declare const ElementPropAsAnchor: Story;
@@ -1,77 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { MjmlColumn, MjmlRaw } from "@faire/mjml-react";
3
- import { createTheme } from "../../../theme/createTheme.js";
4
- import { MjmlSection } from "../../section/MjmlSection.js";
5
- import { HtmlText } from "../HtmlText.js";
6
- const config = {
7
- title: "Components/HtmlText",
8
- component: HtmlText,
9
- tags: ["autodocs"],
10
- };
11
- export default config;
12
- export const Default = {
13
- render: () => (_jsx(MjmlSection, { children: _jsx(MjmlColumn, { children: _jsx(MjmlRaw, { children: _jsx("table", { children: _jsx("tr", { children: _jsx(HtmlText, { children: "Default text with base theme styles" }) }) }) }) }) })),
14
- };
15
- export const WithVariants = {
16
- parameters: {
17
- theme: createTheme({
18
- text: {
19
- variants: {
20
- heading: { fontSize: "32px", fontWeight: 700, lineHeight: "40px" },
21
- body: { fontSize: "16px", lineHeight: "24px" },
22
- caption: { fontSize: "12px", lineHeight: "16px", color: "#666666" },
23
- },
24
- },
25
- }),
26
- },
27
- render: () => (_jsx(MjmlSection, { children: _jsx(MjmlColumn, { children: _jsx(MjmlRaw, { children: _jsxs("table", { children: [_jsx("tr", { children: _jsx(HtmlText, { variant: "heading", children: "Heading variant" }) }), _jsx("tr", { children: _jsx(HtmlText, { variant: "body", children: "Body variant" }) }), _jsx("tr", { children: _jsx(HtmlText, { variant: "caption", children: "Caption variant" }) })] }) }) }) })),
28
- };
29
- export const ResponsiveVariants = {
30
- parameters: {
31
- theme: createTheme({
32
- text: {
33
- variants: {
34
- heading: {
35
- fontSize: { default: "32px", mobile: "24px" },
36
- lineHeight: { default: "40px", mobile: "30px" },
37
- fontWeight: 700,
38
- },
39
- },
40
- },
41
- }),
42
- },
43
- render: () => (_jsx(MjmlSection, { children: _jsx(MjmlColumn, { children: _jsx(MjmlRaw, { children: _jsx("table", { children: _jsx("tr", { children: _jsx(HtmlText, { variant: "heading", children: "Responsive heading \u2014 shrinks on mobile" }) }) }) }) }) })),
44
- };
45
- export const BottomSpacing = {
46
- parameters: {
47
- theme: createTheme({
48
- text: {
49
- bottomSpacing: "20px",
50
- variants: {
51
- heading: { fontSize: "32px", fontWeight: 700, bottomSpacing: { default: "24px", mobile: "16px" } },
52
- },
53
- },
54
- }),
55
- },
56
- render: () => (_jsx(MjmlSection, { children: _jsx(MjmlColumn, { children: _jsx(MjmlRaw, { children: _jsxs("table", { children: [_jsx("tr", { children: _jsx(HtmlText, { variant: "heading", bottomSpacing: true, children: "Heading with bottom spacing" }) }), _jsx("tr", { children: _jsx(HtmlText, { bottomSpacing: true, children: "Base text with bottom spacing" }) }), _jsx("tr", { children: _jsx(HtmlText, { children: "Text without bottom spacing" }) })] }) }) }) })),
57
- };
58
- export const DefaultVariant = {
59
- parameters: {
60
- theme: createTheme({
61
- text: {
62
- defaultVariant: "body",
63
- variants: {
64
- body: { fontSize: "14px", lineHeight: "22px" },
65
- heading: { fontSize: "28px", fontWeight: 700 },
66
- },
67
- },
68
- }),
69
- },
70
- render: () => (_jsx(MjmlSection, { children: _jsx(MjmlColumn, { children: _jsx(MjmlRaw, { children: _jsxs("table", { children: [_jsx("tr", { children: _jsx(HtmlText, { children: "Uses the default \"body\" variant automatically" }) }), _jsx("tr", { children: _jsx(HtmlText, { variant: "heading", children: "Explicit heading variant" }) })] }) }) }) })),
71
- };
72
- export const ElementPropAsDiv = {
73
- render: () => (_jsx(MjmlSection, { children: _jsx(MjmlColumn, { children: _jsx(MjmlRaw, { children: _jsx(HtmlText, { element: "div", children: "Rendered as a div with theme styles" }) }) }) })),
74
- };
75
- export const ElementPropAsAnchor = {
76
- render: () => (_jsx(MjmlSection, { children: _jsx(MjmlColumn, { children: _jsx(MjmlRaw, { children: _jsx(HtmlText, { element: "a", href: "https://example.com", style: { textDecoration: "underline" }, children: "Rendered as an anchor with href" }) }) }) })),
77
- };
@@ -1,10 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/react-vite";
2
- import { MjmlText } from "../MjmlText.js";
3
- type Story = StoryObj<typeof MjmlText>;
4
- declare const config: Meta<typeof MjmlText>;
5
- export default config;
6
- export declare const Default: Story;
7
- export declare const WithVariants: Story;
8
- export declare const ResponsiveVariants: Story;
9
- export declare const BottomSpacing: Story;
10
- export declare const DefaultVariant: Story;
@@ -1,71 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { MjmlColumn } from "@faire/mjml-react";
3
- import { createTheme } from "../../../theme/createTheme.js";
4
- import { MjmlSection } from "../../section/MjmlSection.js";
5
- import { MjmlText } from "../MjmlText.js";
6
- const config = {
7
- title: "Components/MjmlText",
8
- component: MjmlText,
9
- tags: ["autodocs"],
10
- };
11
- export default config;
12
- export const Default = {
13
- render: () => (_jsx(MjmlSection, { indent: true, children: _jsx(MjmlColumn, { children: _jsx(MjmlText, { children: "Default text with base theme styles" }) }) })),
14
- };
15
- export const WithVariants = {
16
- parameters: {
17
- theme: createTheme({
18
- text: {
19
- variants: {
20
- heading: { fontSize: "32px", fontWeight: 700, lineHeight: "40px" },
21
- body: { fontSize: "16px", lineHeight: "24px" },
22
- caption: { fontSize: "12px", lineHeight: "16px", color: "#666666" },
23
- },
24
- },
25
- }),
26
- },
27
- render: () => (_jsx(MjmlSection, { indent: true, children: _jsxs(MjmlColumn, { children: [_jsx(MjmlText, { variant: "heading", children: "Heading variant" }), _jsx(MjmlText, { variant: "body", children: "Body variant" }), _jsx(MjmlText, { variant: "caption", children: "Caption variant" })] }) })),
28
- };
29
- export const ResponsiveVariants = {
30
- parameters: {
31
- theme: createTheme({
32
- text: {
33
- variants: {
34
- heading: {
35
- fontSize: { default: "32px", mobile: "24px" },
36
- lineHeight: { default: "40px", mobile: "30px" },
37
- fontWeight: 700,
38
- },
39
- },
40
- },
41
- }),
42
- },
43
- render: () => (_jsx(MjmlSection, { indent: true, children: _jsx(MjmlColumn, { children: _jsx(MjmlText, { variant: "heading", children: "Responsive heading \u2014 shrinks on mobile" }) }) })),
44
- };
45
- export const BottomSpacing = {
46
- parameters: {
47
- theme: createTheme({
48
- text: {
49
- bottomSpacing: "20px",
50
- variants: {
51
- heading: { fontSize: "32px", fontWeight: 700, bottomSpacing: { default: "24px", mobile: "16px" } },
52
- },
53
- },
54
- }),
55
- },
56
- render: () => (_jsx(MjmlSection, { indent: true, children: _jsxs(MjmlColumn, { children: [_jsx(MjmlText, { variant: "heading", bottomSpacing: true, children: "Heading with bottom spacing" }), _jsx(MjmlText, { bottomSpacing: true, children: "Base text with bottom spacing" }), _jsx(MjmlText, { children: "Text without bottom spacing" })] }) })),
57
- };
58
- export const DefaultVariant = {
59
- parameters: {
60
- theme: createTheme({
61
- text: {
62
- defaultVariant: "body",
63
- variants: {
64
- body: { fontSize: "14px", lineHeight: "22px" },
65
- heading: { fontSize: "28px", fontWeight: 700 },
66
- },
67
- },
68
- }),
69
- },
70
- render: () => (_jsx(MjmlSection, { indent: true, children: _jsxs(MjmlColumn, { children: [_jsx(MjmlText, { children: "Uses the default \"body\" variant automatically" }), _jsx(MjmlText, { variant: "heading", children: "Explicit heading variant" })] }) })),
71
- };