monto-email-block-container 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # monto-email-block-container
2
+
3
+ monto-email compatible container components
@@ -0,0 +1,75 @@
1
+ import React from 'react';
2
+ import { z } from 'zod';
3
+ export declare const ContainerPropsSchema: z.ZodObject<{
4
+ style: z.ZodNullable<z.ZodOptional<z.ZodObject<{
5
+ backgroundColor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6
+ borderColor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
7
+ borderRadius: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
8
+ padding: z.ZodNullable<z.ZodOptional<z.ZodObject<{
9
+ top: z.ZodNumber;
10
+ bottom: z.ZodNumber;
11
+ right: z.ZodNumber;
12
+ left: z.ZodNumber;
13
+ }, "strip", z.ZodTypeAny, {
14
+ top: number;
15
+ bottom: number;
16
+ right: number;
17
+ left: number;
18
+ }, {
19
+ top: number;
20
+ bottom: number;
21
+ right: number;
22
+ left: number;
23
+ }>>>;
24
+ }, "strip", z.ZodTypeAny, {
25
+ backgroundColor?: string | null | undefined;
26
+ borderColor?: string | null | undefined;
27
+ borderRadius?: number | null | undefined;
28
+ padding?: {
29
+ top: number;
30
+ bottom: number;
31
+ right: number;
32
+ left: number;
33
+ } | null | undefined;
34
+ }, {
35
+ backgroundColor?: string | null | undefined;
36
+ borderColor?: string | null | undefined;
37
+ borderRadius?: number | null | undefined;
38
+ padding?: {
39
+ top: number;
40
+ bottom: number;
41
+ right: number;
42
+ left: number;
43
+ } | null | undefined;
44
+ }>>>;
45
+ }, "strip", z.ZodTypeAny, {
46
+ style?: {
47
+ backgroundColor?: string | null | undefined;
48
+ borderColor?: string | null | undefined;
49
+ borderRadius?: number | null | undefined;
50
+ padding?: {
51
+ top: number;
52
+ bottom: number;
53
+ right: number;
54
+ left: number;
55
+ } | null | undefined;
56
+ } | null | undefined;
57
+ }, {
58
+ style?: {
59
+ backgroundColor?: string | null | undefined;
60
+ borderColor?: string | null | undefined;
61
+ borderRadius?: number | null | undefined;
62
+ padding?: {
63
+ top: number;
64
+ bottom: number;
65
+ right: number;
66
+ left: number;
67
+ } | null | undefined;
68
+ } | null | undefined;
69
+ }>;
70
+ export type ContainerProps = {
71
+ style?: z.infer<typeof ContainerPropsSchema>['style'];
72
+ children?: JSX.Element | JSX.Element[] | null;
73
+ };
74
+ export declare function Container({ style, children }: ContainerProps): React.JSX.Element;
75
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAqBxB,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAU/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC,OAAO,CAAC,CAAC;IACtD,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC;CAC/C,CAAC;AASF,wBAAgB,SAAS,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,cAAc,qBAW5D"}
@@ -0,0 +1,48 @@
1
+ import React from 'react';
2
+ import { z } from 'zod';
3
+ const COLOR_SCHEMA = z
4
+ .string()
5
+ .regex(/^#[0-9a-fA-F]{6}$/)
6
+ .nullable()
7
+ .optional();
8
+ const PADDING_SCHEMA = z
9
+ .object({
10
+ top: z.number(),
11
+ bottom: z.number(),
12
+ right: z.number(),
13
+ left: z.number(),
14
+ })
15
+ .optional()
16
+ .nullable();
17
+ const getPadding = (padding) => padding ? `${padding.top}px ${padding.right}px ${padding.bottom}px ${padding.left}px` : undefined;
18
+ export const ContainerPropsSchema = z.object({
19
+ style: z
20
+ .object({
21
+ backgroundColor: COLOR_SCHEMA,
22
+ borderColor: COLOR_SCHEMA,
23
+ borderRadius: z.number().optional().nullable(),
24
+ padding: PADDING_SCHEMA,
25
+ })
26
+ .optional()
27
+ .nullable(),
28
+ });
29
+ function getBorder(style) {
30
+ if (!style || !style.borderColor) {
31
+ return undefined;
32
+ }
33
+ return `1px solid ${style.borderColor}`;
34
+ }
35
+ export function Container({ style, children }) {
36
+ var _a, _b;
37
+ const wStyle = {
38
+ backgroundColor: (_a = style === null || style === void 0 ? void 0 : style.backgroundColor) !== null && _a !== void 0 ? _a : undefined,
39
+ border: getBorder(style),
40
+ borderRadius: (_b = style === null || style === void 0 ? void 0 : style.borderRadius) !== null && _b !== void 0 ? _b : undefined,
41
+ padding: getPadding(style === null || style === void 0 ? void 0 : style.padding),
42
+ };
43
+ if (!children) {
44
+ return React.createElement("div", { style: wStyle });
45
+ }
46
+ return React.createElement("div", { style: wStyle }, children);
47
+ }
48
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,YAAY,GAAG,CAAC;KACnB,MAAM,EAAE;KACR,KAAK,CAAC,mBAAmB,CAAC;KAC1B,QAAQ,EAAE;KACV,QAAQ,EAAE,CAAC;AAEd,MAAM,cAAc,GAAG,CAAC;KACrB,MAAM,CAAC;IACN,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;CACjB,CAAC;KACD,QAAQ,EAAE;KACV,QAAQ,EAAE,CAAC;AAEd,MAAM,UAAU,GAAG,CAAC,OAAuC,EAAE,EAAE,CAC7D,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,GAAG,MAAM,OAAO,CAAC,KAAK,MAAM,OAAO,CAAC,MAAM,MAAM,OAAO,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;AAEpG,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,KAAK,EAAE,CAAC;SACL,MAAM,CAAC;QACN,eAAe,EAAE,YAAY;QAC7B,WAAW,EAAE,YAAY;QACzB,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;QAC9C,OAAO,EAAE,cAAc;KACxB,CAAC;SACD,QAAQ,EAAE;SACV,QAAQ,EAAE;CACd,CAAC,CAAC;AAOH,SAAS,SAAS,CAAC,KAA8B;IAC/C,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;QACjC,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,aAAa,KAAK,CAAC,WAAW,EAAE,CAAC;AAC1C,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAkB;;IAC3D,MAAM,MAAM,GAAkB;QAC5B,eAAe,EAAE,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,eAAe,mCAAI,SAAS;QACpD,MAAM,EAAE,SAAS,CAAC,KAAK,CAAC;QACxB,YAAY,EAAE,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,YAAY,mCAAI,SAAS;QAC9C,OAAO,EAAE,UAAU,CAAC,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,OAAO,CAAC;KACpC,CAAC;IACF,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,6BAAK,KAAK,EAAE,MAAM,GAAI,CAAC;IAChC,CAAC;IACD,OAAO,6BAAK,KAAK,EAAE,MAAM,IAAG,QAAQ,CAAO,CAAC;AAC9C,CAAC"}
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "monto-email-block-container",
3
+ "version": "0.0.1",
4
+ "description": "monto-email compatible Container component",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "require": "./dist/index.js",
11
+ "import": "./dist/index.js",
12
+ "types": "./dist/index.d.ts"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "scripts": {
19
+ "build": "npx tsc"
20
+ },
21
+ "author": "heiheihoho1213",
22
+ "license": "MIT",
23
+ "peerDependencies": {
24
+ "react": "^16 || ^17 || ^18",
25
+ "zod": "^1 || ^2 || ^3"
26
+ },
27
+ "devDependencies": {
28
+ "@types/react": "^18.3.1",
29
+ "react": "^18.3.1",
30
+ "zod": "^3.24.2",
31
+ "@testing-library/react": "^14.2.1",
32
+ "typescript": "^5.0.0"
33
+ }
34
+ }