@comet/mail-react 9.0.0-beta.4 → 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.
- package/README.md +68 -9
- package/lib/blocks/pixelImage/HtmlPixelImageBlock.js +2 -11
- package/lib/blocks/pixelImage/MjmlPixelImageBlock.d.ts +2 -2
- package/lib/blocks/pixelImage/MjmlPixelImageBlock.js +1 -10
- package/lib/blocks.generated.d.ts +1 -0
- package/lib/components/button/HtmlButton.d.ts +9 -0
- package/lib/components/button/HtmlButton.js +58 -0
- package/lib/components/button/MjmlButton.d.ts +10 -0
- package/lib/components/button/MjmlButton.js +91 -0
- package/lib/components/button/buttonProps.d.ts +35 -0
- package/lib/components/button/defaultButtonStyles.d.ts +2 -0
- package/lib/components/button/defaultButtonStyles.js +9 -0
- package/lib/components/button/generateResponsiveButtonCss.d.ts +8 -0
- package/lib/components/button/generateResponsiveButtonCss.js +21 -0
- package/lib/components/divider/HtmlDivider.d.ts +9 -0
- package/lib/components/divider/HtmlDivider.js +43 -0
- package/lib/components/divider/MjmlDivider.d.ts +7 -0
- package/lib/components/divider/MjmlDivider.js +13 -0
- package/lib/components/divider/defaultDividerStyles.d.ts +2 -0
- package/lib/components/divider/defaultDividerStyles.js +4 -0
- package/lib/components/divider/dividerProps.d.ts +51 -0
- package/lib/components/divider/generateResponsiveDividerCss.d.ts +8 -0
- package/lib/components/divider/generateResponsiveDividerCss.js +15 -0
- package/lib/components/image/HtmlImage.d.ts +11 -0
- package/lib/components/image/HtmlImage.js +23 -0
- package/lib/components/image/MjmlImage.d.ts +10 -0
- package/lib/components/image/MjmlImage.js +22 -0
- package/lib/components/inlineLink/HtmlInlineLink.d.ts +8 -1
- package/lib/components/mailRoot/MjmlMailRoot.d.ts +3 -2
- package/lib/components/section/MjmlSection.d.ts +7 -1
- package/lib/components/text/HtmlText.d.ts +3 -0
- package/lib/components/text/MjmlText.d.ts +3 -0
- package/lib/components/text/textStyles.d.ts +1 -3
- package/lib/components/text/textStyles.js +20 -70
- package/lib/components/wrapper/MjmlWrapper.d.ts +9 -2
- package/lib/components/wrapper/MjmlWrapper.js +1 -1
- package/lib/index.d.ts +14 -2
- package/lib/index.js +7 -1
- package/lib/styles/generateResponsiveVariantCss.d.ts +26 -0
- package/lib/styles/generateResponsiveVariantCss.js +66 -0
- package/lib/theme/createTheme.d.ts +3 -1
- package/lib/theme/createTheme.js +2 -0
- package/lib/theme/defaultTheme.js +4 -0
- package/lib/theme/themeTypes.d.ts +98 -0
- package/package.json +14 -7
- package/lib/__stories__/examples/CustomBackgroundForFooter.stories.d.ts +0 -5
- package/lib/__stories__/examples/CustomBackgroundForFooter.stories.js +0 -32
- package/lib/__stories__/examples/CustomNestedFooterTheme.stories.d.ts +0 -5
- package/lib/__stories__/examples/CustomNestedFooterTheme.stories.js +0 -32
- package/lib/__stories__/examples/NotificationEmail.stories.d.ts +0 -5
- package/lib/__stories__/examples/NotificationEmail.stories.js +0 -25
- package/lib/__stories__/layout-patterns/AsymmetricTwoColumnLayout.stories.d.ts +0 -6
- package/lib/__stories__/layout-patterns/AsymmetricTwoColumnLayout.stories.js +0 -107
- package/lib/__stories__/layout-patterns/SymmetricFourColumnLayout.stories.d.ts +0 -4
- package/lib/__stories__/layout-patterns/SymmetricFourColumnLayout.stories.js +0 -58
- package/lib/__stories__/layout-patterns/SymmetricThreeColumnLayout.stories.d.ts +0 -5
- package/lib/__stories__/layout-patterns/SymmetricThreeColumnLayout.stories.js +0 -104
- package/lib/__stories__/layout-patterns/SymmetricTwoColumnLayout.stories.d.ts +0 -4
- package/lib/__stories__/layout-patterns/SymmetricTwoColumnLayout.stories.js +0 -47
- package/lib/blocks/pixelImage/__stories__/HtmlPixelImageBlock.stories.d.ts +0 -7
- package/lib/blocks/pixelImage/__stories__/HtmlPixelImageBlock.stories.js +0 -54
- package/lib/blocks/pixelImage/__stories__/MjmlPixelImageBlock.stories.d.ts +0 -7
- package/lib/blocks/pixelImage/__stories__/MjmlPixelImageBlock.stories.js +0 -54
- package/lib/blocks/pixelImage/__stories__/exampleBlockData.d.ts +0 -2
- package/lib/blocks/pixelImage/__stories__/exampleBlockData.js +0 -19
- package/lib/blocks/pixelImage/__tests__/usePixelImageBlockConfig.test.js +0 -21
- package/lib/blocks/pixelImage/__tests__/usePixelImageBlockData.test.js +0 -205
- package/lib/components/inlineLink/__stories__/HtmlInlineLink.stories.d.ts +0 -12
- package/lib/components/inlineLink/__stories__/HtmlInlineLink.stories.js +0 -56
- package/lib/components/mailRoot/__stories__/MjmlMailRoot.stories.d.ts +0 -7
- package/lib/components/mailRoot/__stories__/MjmlMailRoot.stories.js +0 -18
- package/lib/components/section/__stories__/MjmlSection.stories.d.ts +0 -9
- package/lib/components/section/__stories__/MjmlSection.stories.js +0 -30
- package/lib/components/text/__stories__/HtmlText.stories.d.ts +0 -12
- package/lib/components/text/__stories__/HtmlText.stories.js +0 -77
- package/lib/components/text/__stories__/MjmlText.stories.d.ts +0 -10
- package/lib/components/text/__stories__/MjmlText.stories.js +0 -71
- package/lib/components/text/__tests__/HtmlText.test.d.ts +0 -1
- package/lib/components/text/__tests__/HtmlText.test.js +0 -157
- package/lib/components/text/__tests__/MjmlText.test.d.ts +0 -1
- package/lib/components/text/__tests__/MjmlText.test.js +0 -112
- package/lib/components/wrapper/__stories__/MjmlWrapper.stories.d.ts +0 -10
- package/lib/components/wrapper/__stories__/MjmlWrapper.stories.js +0 -36
- package/lib/config/ConfigProvider.test.d.ts +0 -8
- package/lib/config/ConfigProvider.test.js +0 -30
- package/lib/server/renderMailHtml.test.d.ts +0 -1
- package/lib/server/renderMailHtml.test.js +0 -52
- package/lib/storybook/replaceImagesWithPublicUrl.test.d.ts +0 -1
- package/lib/storybook/replaceImagesWithPublicUrl.test.js +0 -55
- package/lib/theme/__stories__/ThemeProvider.stories.d.ts +0 -7
- package/lib/theme/__stories__/ThemeProvider.stories.js +0 -23
- package/lib/theme/createTheme.test.d.ts +0 -1
- package/lib/theme/createTheme.test.js +0 -52
- package/lib/theme/responsiveValue.test.d.ts +0 -1
- package/lib/theme/responsiveValue.test.js +0 -62
- package/lib/utils/css.test.d.ts +0 -1
- package/lib/utils/css.test.js +0 -26
- /package/lib/{blocks/pixelImage/__tests__/usePixelImageBlockConfig.test.d.ts → components/button/buttonProps.js} +0 -0
- /package/lib/{blocks/pixelImage/__tests__/usePixelImageBlockData.test.d.ts → components/divider/dividerProps.js} +0 -0
|
@@ -1,205 +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 { ConfigProvider } from "../../../config/ConfigProvider.js";
|
|
5
|
-
import { createTheme } from "../../../theme/createTheme.js";
|
|
6
|
-
import { ThemeProvider } from "../../../theme/ThemeProvider.js";
|
|
7
|
-
import { usePixelImageBlockData } from "../usePixelImageBlockData.js";
|
|
8
|
-
function captureUsePixelImageData({ data, defaultRenderWidth, largestPossibleRenderWidth, aspectRatio, config }) {
|
|
9
|
-
const captured = { value: undefined };
|
|
10
|
-
function Probe() {
|
|
11
|
-
captured.value = usePixelImageBlockData({ data, defaultRenderWidth, largestPossibleRenderWidth, aspectRatio });
|
|
12
|
-
return null;
|
|
13
|
-
}
|
|
14
|
-
renderToStaticMarkup(_jsx(ThemeProvider, { theme: createTheme(), children: _jsx(ConfigProvider, { config: config, children: _jsx(Probe, {}) }) }));
|
|
15
|
-
if (captured.value === undefined) {
|
|
16
|
-
throw new Error("Probe did not run");
|
|
17
|
-
}
|
|
18
|
-
return captured.value;
|
|
19
|
-
}
|
|
20
|
-
function expectNonNull(value) {
|
|
21
|
-
if (value === null) {
|
|
22
|
-
throw new Error("Expected non-null result from usePixelImageBlockData");
|
|
23
|
-
}
|
|
24
|
-
return value;
|
|
25
|
-
}
|
|
26
|
-
const validSizes = [320, 640, 1280, 2048];
|
|
27
|
-
const baseUrl = "http://localhost:3000";
|
|
28
|
-
const config = { pixelImageBlock: { validSizes, baseUrl } };
|
|
29
|
-
const smartUrlTemplate = "/dam/images/abc/resize:$resizeWidth:$resizeHeight/photo.jpg";
|
|
30
|
-
const smartImageData = {
|
|
31
|
-
damFile: {
|
|
32
|
-
id: "id-1",
|
|
33
|
-
name: "photo.jpg",
|
|
34
|
-
size: 1000,
|
|
35
|
-
mimetype: "image/jpeg",
|
|
36
|
-
contentHash: "hash",
|
|
37
|
-
archived: false,
|
|
38
|
-
fileUrl: "/dam/files/id-1.jpg",
|
|
39
|
-
image: {
|
|
40
|
-
width: 4000,
|
|
41
|
-
height: 2000,
|
|
42
|
-
cropArea: { focalPoint: "SMART" },
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
urlTemplate: smartUrlTemplate,
|
|
46
|
-
};
|
|
47
|
-
describe("usePixelImageBlockData — width selection", () => {
|
|
48
|
-
it("picks the smallest validSizes entry >= defaultRenderWidth × 2", () => {
|
|
49
|
-
const result = expectNonNull(captureUsePixelImageData({ data: smartImageData, defaultRenderWidth: 200, config }));
|
|
50
|
-
expect(result.imageUrl).toContain(":640:");
|
|
51
|
-
});
|
|
52
|
-
it("picks an exact validSizes match when present", () => {
|
|
53
|
-
const result = expectNonNull(captureUsePixelImageData({ data: smartImageData, defaultRenderWidth: 320, config }));
|
|
54
|
-
expect(result.imageUrl).toContain(":640:");
|
|
55
|
-
});
|
|
56
|
-
it("falls back to the largest validSizes entry when none qualifies", () => {
|
|
57
|
-
const result = expectNonNull(captureUsePixelImageData({ data: smartImageData, defaultRenderWidth: 2000, config }));
|
|
58
|
-
expect(result.imageUrl).toContain(":2048:");
|
|
59
|
-
});
|
|
60
|
-
it("uses largestPossibleRenderWidth × 2 when defaultRenderWidth equals largestPossibleRenderWidth", () => {
|
|
61
|
-
const result = expectNonNull(captureUsePixelImageData({
|
|
62
|
-
data: smartImageData,
|
|
63
|
-
defaultRenderWidth: 600,
|
|
64
|
-
largestPossibleRenderWidth: 600,
|
|
65
|
-
config,
|
|
66
|
-
}));
|
|
67
|
-
expect(result.imageUrl).toContain(":1200:");
|
|
68
|
-
});
|
|
69
|
-
it("defaults largestPossibleRenderWidth to theme.sizes.bodyWidth (600) and triggers DPR-2 fixed path at width 600", () => {
|
|
70
|
-
const result = expectNonNull(captureUsePixelImageData({ data: smartImageData, defaultRenderWidth: 600, config }));
|
|
71
|
-
expect(result.imageUrl).toContain(":1200:");
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
describe("usePixelImageBlockData — URL prefixing", () => {
|
|
75
|
-
it("prefixes a relative URL with config.pixelImageBlock.baseUrl", () => {
|
|
76
|
-
const result = expectNonNull(captureUsePixelImageData({ data: smartImageData, defaultRenderWidth: 200, config }));
|
|
77
|
-
expect(result.imageUrl.startsWith(`${baseUrl}/dam/images/abc/`)).toBe(true);
|
|
78
|
-
});
|
|
79
|
-
it("does not prefix an absolute URL", () => {
|
|
80
|
-
const absoluteData = {
|
|
81
|
-
...smartImageData,
|
|
82
|
-
urlTemplate: "https://cdn.example.com/$resizeWidth/$resizeHeight/photo.jpg",
|
|
83
|
-
};
|
|
84
|
-
const result = expectNonNull(captureUsePixelImageData({ data: absoluteData, defaultRenderWidth: 200, config }));
|
|
85
|
-
expect(result.imageUrl.startsWith("https://cdn.example.com/")).toBe(true);
|
|
86
|
-
expect(result.imageUrl.includes(baseUrl)).toBe(false);
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
describe("usePixelImageBlockData — aspect ratio", () => {
|
|
90
|
-
it("uses the natural image aspect ratio for SMART crop areas", () => {
|
|
91
|
-
const result = expectNonNull(captureUsePixelImageData({ data: smartImageData, defaultRenderWidth: 200, config }));
|
|
92
|
-
expect(result.desktopImageHeight).toBe(100);
|
|
93
|
-
expect(result.imageUrl).toContain(":640:320/");
|
|
94
|
-
});
|
|
95
|
-
it("derives aspect ratio from crop dimensions for non-SMART crop areas", () => {
|
|
96
|
-
const nonSmartData = {
|
|
97
|
-
damFile: {
|
|
98
|
-
id: "id-2",
|
|
99
|
-
name: "photo2.jpg",
|
|
100
|
-
size: 1000,
|
|
101
|
-
mimetype: "image/jpeg",
|
|
102
|
-
contentHash: "hash",
|
|
103
|
-
archived: false,
|
|
104
|
-
fileUrl: "/dam/files/id-2.jpg",
|
|
105
|
-
image: {
|
|
106
|
-
width: 4000,
|
|
107
|
-
height: 2000,
|
|
108
|
-
cropArea: { focalPoint: "CENTER", width: 50, height: 100, x: 25, y: 0 },
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
urlTemplate: smartUrlTemplate,
|
|
112
|
-
};
|
|
113
|
-
const result = expectNonNull(captureUsePixelImageData({ data: nonSmartData, defaultRenderWidth: 200, config }));
|
|
114
|
-
expect(result.desktopImageHeight).toBe(200);
|
|
115
|
-
expect(result.imageUrl).toContain(":640:640/");
|
|
116
|
-
});
|
|
117
|
-
it("throws when crop dimensions are missing on a non-SMART crop area", () => {
|
|
118
|
-
const malformedData = {
|
|
119
|
-
damFile: {
|
|
120
|
-
id: "id-3",
|
|
121
|
-
name: "photo3.jpg",
|
|
122
|
-
size: 1000,
|
|
123
|
-
mimetype: "image/jpeg",
|
|
124
|
-
contentHash: "hash",
|
|
125
|
-
archived: false,
|
|
126
|
-
fileUrl: "/dam/files/id-3.jpg",
|
|
127
|
-
image: {
|
|
128
|
-
width: 4000,
|
|
129
|
-
height: 2000,
|
|
130
|
-
cropArea: { focalPoint: "CENTER" },
|
|
131
|
-
},
|
|
132
|
-
},
|
|
133
|
-
urlTemplate: smartUrlTemplate,
|
|
134
|
-
};
|
|
135
|
-
expect(() => captureUsePixelImageData({ data: malformedData, defaultRenderWidth: 200, config })).toThrow(/Missing crop dimensions/);
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
describe("usePixelImageBlockData — aspectRatio override", () => {
|
|
139
|
-
it("uses a numeric aspectRatio in place of the cropArea-derived ratio", () => {
|
|
140
|
-
const result = expectNonNull(captureUsePixelImageData({ data: smartImageData, defaultRenderWidth: 200, aspectRatio: 16 / 9, config }));
|
|
141
|
-
expect(result.imageUrl).toContain(":640:360/");
|
|
142
|
-
expect(result.desktopImageHeight).toBe(113);
|
|
143
|
-
});
|
|
144
|
-
it.each([
|
|
145
|
-
["WxH", "16x9"],
|
|
146
|
-
["W:H", "16:9"],
|
|
147
|
-
["W/H", "16/9"],
|
|
148
|
-
])("parses string aspectRatio in %s form", (_label, value) => {
|
|
149
|
-
const result = expectNonNull(captureUsePixelImageData({ data: smartImageData, defaultRenderWidth: 200, aspectRatio: value, config }));
|
|
150
|
-
expect(result.imageUrl).toContain(":640:360/");
|
|
151
|
-
expect(result.desktopImageHeight).toBe(113);
|
|
152
|
-
});
|
|
153
|
-
it("treats a single-token string as `width / 1`", () => {
|
|
154
|
-
const result = expectNonNull(captureUsePixelImageData({ data: smartImageData, defaultRenderWidth: 200, aspectRatio: "2", config }));
|
|
155
|
-
expect(result.imageUrl).toContain(":640:320/");
|
|
156
|
-
expect(result.desktopImageHeight).toBe(100);
|
|
157
|
-
});
|
|
158
|
-
it("overrides a non-SMART cropArea ratio", () => {
|
|
159
|
-
const nonSmartData = {
|
|
160
|
-
damFile: {
|
|
161
|
-
id: "id-override",
|
|
162
|
-
name: "photo.jpg",
|
|
163
|
-
size: 1000,
|
|
164
|
-
mimetype: "image/jpeg",
|
|
165
|
-
contentHash: "hash",
|
|
166
|
-
archived: false,
|
|
167
|
-
fileUrl: "/dam/files/id-override.jpg",
|
|
168
|
-
image: {
|
|
169
|
-
width: 4000,
|
|
170
|
-
height: 2000,
|
|
171
|
-
cropArea: { focalPoint: "CENTER", width: 50, height: 100, x: 25, y: 0 },
|
|
172
|
-
},
|
|
173
|
-
},
|
|
174
|
-
urlTemplate: smartUrlTemplate,
|
|
175
|
-
};
|
|
176
|
-
const result = expectNonNull(captureUsePixelImageData({ data: nonSmartData, defaultRenderWidth: 200, aspectRatio: "16x9", config }));
|
|
177
|
-
expect(result.imageUrl).toContain(":640:360/");
|
|
178
|
-
expect(result.desktopImageHeight).toBe(113);
|
|
179
|
-
});
|
|
180
|
-
it("throws when the aspectRatio string is malformed", () => {
|
|
181
|
-
expect(() => captureUsePixelImageData({ data: smartImageData, defaultRenderWidth: 200, aspectRatio: "not-a-ratio", config })).toThrow(/An error occurred while parsing the aspect ratio: not-a-ratio/);
|
|
182
|
-
});
|
|
183
|
-
});
|
|
184
|
-
describe("usePixelImageBlockData — incomplete data", () => {
|
|
185
|
-
it("returns null when damFile is absent", () => {
|
|
186
|
-
const result = captureUsePixelImageData({ data: { urlTemplate: smartUrlTemplate }, defaultRenderWidth: 200, config });
|
|
187
|
-
expect(result).toBeNull();
|
|
188
|
-
});
|
|
189
|
-
it("returns null when damFile.image is absent", () => {
|
|
190
|
-
const noImageData = {
|
|
191
|
-
damFile: {
|
|
192
|
-
id: "id-4",
|
|
193
|
-
name: "no-image.jpg",
|
|
194
|
-
size: 0,
|
|
195
|
-
mimetype: "image/jpeg",
|
|
196
|
-
contentHash: "hash",
|
|
197
|
-
archived: false,
|
|
198
|
-
fileUrl: "/dam/files/id-4.jpg",
|
|
199
|
-
},
|
|
200
|
-
urlTemplate: smartUrlTemplate,
|
|
201
|
-
};
|
|
202
|
-
const result = captureUsePixelImageData({ data: noImageData, defaultRenderWidth: 200, config });
|
|
203
|
-
expect(result).toBeNull();
|
|
204
|
-
});
|
|
205
|
-
});
|
|
@@ -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
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|