@sqrzro/ui 4.0.0-alpha.41 → 4.0.0-alpha.42
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/dist/components/index.d.ts +0 -8
- package/dist/components/index.js +0 -4
- package/dist/{components/mail → mail}/Mail/index.d.ts +4 -3
- package/dist/{components/mail → mail}/Mail/index.js +65 -72
- package/dist/mail/MailButton/index.d.ts +8 -0
- package/dist/mail/MailButton/index.js +28 -0
- package/dist/mail/index.d.ts +8 -0
- package/dist/mail/index.js +4 -0
- package/dist/{utility → mail/utility}/convert-to-datauri.js +2 -1
- package/dist/mail/utility/get-mail-config.d.ts +4 -0
- package/dist/mail/utility/get-mail-config.js +34 -0
- package/dist/mail/utility/interfaces.d.ts +23 -0
- package/package.json +7 -4
- package/dist/addon/config.d.ts +0 -5
- package/dist/addon/config.js +0 -12
- package/dist/addon/defaults.d.ts +0 -3
- package/dist/addon/defaults.js +0 -6
- package/dist/addon/index.d.ts +0 -5
- package/dist/addon/index.js +0 -8
- package/dist/addon/interfaces.d.ts +0 -8
- package/dist/components/mail/MailButton/index.d.ts +0 -7
- package/dist/components/mail/MailButton/index.js +0 -38
- /package/dist/{components/mail → mail}/MailBlock/index.d.ts +0 -0
- /package/dist/{components/mail → mail}/MailBlock/index.js +0 -0
- /package/dist/{components/mail → mail}/MailTable/index.d.ts +0 -0
- /package/dist/{components/mail → mail}/MailTable/index.js +0 -0
- /package/dist/{utility → mail/utility}/convert-to-datauri.d.ts +0 -0
- /package/dist/{addon → mail/utility}/interfaces.js +0 -0
|
@@ -31,14 +31,6 @@ export type { AppForbiddenErrorProps } from './errors/AppForbiddenError';
|
|
|
31
31
|
export { default as AppForbiddenError } from './errors/AppForbiddenError';
|
|
32
32
|
export type { AppNotFoundErrorProps } from './errors/AppNotFoundError';
|
|
33
33
|
export { default as AppNotFoundError } from './errors/AppNotFoundError';
|
|
34
|
-
export type { MailProps } from './mail/Mail';
|
|
35
|
-
export { default as Mail } from './mail/Mail';
|
|
36
|
-
export type { MailBlockProps } from './mail/MailBlock';
|
|
37
|
-
export { default as MailBlock } from './mail/MailBlock';
|
|
38
|
-
export type { MailButtonProps } from './mail/MailButton';
|
|
39
|
-
export { default as MailButton } from './mail/MailButton';
|
|
40
|
-
export type { MailTableProps } from './mail/MailTable';
|
|
41
|
-
export { default as MailTable } from './mail/MailTable';
|
|
42
34
|
export type { ModalProps } from './modals/Modal';
|
|
43
35
|
export { default as Modal } from './modals/Modal';
|
|
44
36
|
export type { ModalLauncherProps } from './modals/ModalLauncher';
|
package/dist/components/index.js
CHANGED
|
@@ -15,10 +15,6 @@ export { default as Summary } from './elements/Summary';
|
|
|
15
15
|
export { default as AppError } from './errors/AppError';
|
|
16
16
|
export { default as AppForbiddenError } from './errors/AppForbiddenError';
|
|
17
17
|
export { default as AppNotFoundError } from './errors/AppNotFoundError';
|
|
18
|
-
export { default as Mail } from './mail/Mail';
|
|
19
|
-
export { default as MailBlock } from './mail/MailBlock';
|
|
20
|
-
export { default as MailButton } from './mail/MailButton';
|
|
21
|
-
export { default as MailTable } from './mail/MailTable';
|
|
22
18
|
export { default as Modal } from './modals/Modal';
|
|
23
19
|
export { default as ModalLauncher } from './modals/ModalLauncher';
|
|
24
20
|
export { default as Container } from './utility/Container';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { DeepPartial } from '@sqrzro/utility';
|
|
2
|
+
import { MailConfigObject } from '../utility/interfaces';
|
|
3
|
+
export interface MailProps extends DeepPartial<MailConfigObject> {
|
|
3
4
|
children: React.ReactNode;
|
|
4
5
|
title: string;
|
|
5
|
-
}
|
|
6
|
+
}
|
|
6
7
|
declare function Mail({ children, logo, styles, title, }: Readonly<MailProps>): Promise<React.ReactElement>;
|
|
7
8
|
export default Mail;
|
|
@@ -1,28 +1,11 @@
|
|
|
1
|
+
'use server';
|
|
1
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/* eslint-disable max-lines-per-function, react/jsx-max-depth, react/no-danger */
|
|
3
3
|
import { Fragment } from 'react';
|
|
4
|
-
import
|
|
5
|
-
import { getConfig } from '../../../addon/config';
|
|
6
|
-
const DEFAULT_STYLES = {
|
|
7
|
-
styles: {
|
|
8
|
-
root: {
|
|
9
|
-
backgroundColor: '#f5f5f5',
|
|
10
|
-
},
|
|
11
|
-
panel: {
|
|
12
|
-
backgroundColor: '#ffffff',
|
|
13
|
-
padding: 40,
|
|
14
|
-
},
|
|
15
|
-
title: {
|
|
16
|
-
color: '#62748e',
|
|
17
|
-
fontSize: 20,
|
|
18
|
-
fontWeight: 'bold',
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
};
|
|
4
|
+
import getMailConfig from '../utility/get-mail-config';
|
|
22
5
|
const HALF = 2;
|
|
23
6
|
async function Mail({ children, logo, styles, title, }) {
|
|
24
|
-
const
|
|
25
|
-
const logoData = await (await import('
|
|
7
|
+
const mailConfig = getMailConfig({ styles });
|
|
8
|
+
const logoData = await (await import('../utility/convert-to-datauri')).default(logo ?? mailConfig.logo ?? '');
|
|
26
9
|
return (_jsxs("html", { lang: "en", children: [_jsxs("head", { children: [_jsx("meta", { charSet: "utf-8" }), _jsx("style", { dangerouslySetInnerHTML: {
|
|
27
10
|
__html: `
|
|
28
11
|
body {
|
|
@@ -48,66 +31,76 @@ async function Mail({ children, logo, styles, title, }) {
|
|
|
48
31
|
}
|
|
49
32
|
}
|
|
50
33
|
`,
|
|
51
|
-
} })] }), _jsx("body", { children: _jsx("table", { border: 0, cellPadding: 0, cellSpacing: 0, width: "100%", children: _jsxs("tbody", { children: [_jsx("tr", { children: _jsx("td", { className: "padding", colSpan: 3, height: "20", style: { backgroundColor:
|
|
52
|
-
backgroundColor:
|
|
34
|
+
} })] }), _jsx("body", { children: _jsx("table", { border: 0, cellPadding: 0, cellSpacing: 0, width: "100%", children: _jsxs("tbody", { children: [_jsx("tr", { children: _jsx("td", { className: "padding", colSpan: 3, height: "20", style: { backgroundColor: mailConfig.styles.root.backgroundColor } }) }), _jsxs("tr", { children: [_jsx("td", { className: "padding", style: { backgroundColor: mailConfig.styles.root.backgroundColor }, width: "20" }), _jsx("td", { align: "center", style: { backgroundColor: mailConfig.styles.root.backgroundColor }, children: _jsx("table", { border: 0, cellPadding: 0, cellSpacing: 0, className: "container", width: "650", children: _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("td", { className: "padding", height: "20", style: {
|
|
35
|
+
backgroundColor: mailConfig.styles.panel.backgroundColor,
|
|
53
36
|
}, width: "20", children: _jsx("div", { className: "padding", style: {
|
|
54
|
-
backgroundColor:
|
|
55
|
-
height:
|
|
56
|
-
width:
|
|
37
|
+
backgroundColor: mailConfig.styles.root.backgroundColor,
|
|
38
|
+
height: mailConfig.styles.panel.padding,
|
|
39
|
+
width: mailConfig.styles.panel.padding,
|
|
57
40
|
}, children: _jsx("div", { className: "padding", style: {
|
|
58
|
-
backgroundColor:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
41
|
+
backgroundColor: mailConfig.styles.panel
|
|
42
|
+
.backgroundColor,
|
|
43
|
+
borderTopLeftRadius: mailConfig.styles.panel.padding /
|
|
44
|
+
HALF,
|
|
45
|
+
height: mailConfig.styles.panel.padding,
|
|
46
|
+
width: mailConfig.styles.panel.padding,
|
|
62
47
|
} }) }) }), _jsx("td", { className: "container", style: {
|
|
63
|
-
backgroundColor:
|
|
64
|
-
}, width: "610" }), _jsx("td", { className: "padding", height:
|
|
65
|
-
backgroundColor:
|
|
66
|
-
}, width:
|
|
67
|
-
backgroundColor:
|
|
68
|
-
height:
|
|
69
|
-
width:
|
|
48
|
+
backgroundColor: mailConfig.styles.panel.backgroundColor,
|
|
49
|
+
}, width: "610" }), _jsx("td", { className: "padding", height: mailConfig.styles.panel.padding, style: {
|
|
50
|
+
backgroundColor: mailConfig.styles.panel.backgroundColor,
|
|
51
|
+
}, width: mailConfig.styles.panel.padding, children: _jsx("div", { className: "padding", style: {
|
|
52
|
+
backgroundColor: mailConfig.styles.root.backgroundColor,
|
|
53
|
+
height: mailConfig.styles.panel.padding,
|
|
54
|
+
width: mailConfig.styles.panel.padding,
|
|
70
55
|
}, children: _jsx("div", { className: "padding", style: {
|
|
71
|
-
backgroundColor:
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
56
|
+
backgroundColor: mailConfig.styles.panel
|
|
57
|
+
.backgroundColor,
|
|
58
|
+
borderTopRightRadius: mailConfig.styles.panel.padding /
|
|
59
|
+
HALF,
|
|
60
|
+
height: mailConfig.styles.panel.padding,
|
|
61
|
+
width: mailConfig.styles.panel.padding,
|
|
75
62
|
} }) }) })] }), _jsxs("tr", { children: [_jsx("td", { className: "padding", style: {
|
|
76
|
-
backgroundColor:
|
|
77
|
-
}, width:
|
|
78
|
-
backgroundColor:
|
|
79
|
-
}, children: _jsx("table", { border: 0, cellPadding: 0, cellSpacing: 0, width: "100%", children: _jsxs("tbody", { children: [logoData ? (_jsxs(Fragment, { children: [_jsx("tr", { children: _jsx("td", { children: _jsx("table", { border: 0, cellPadding: 0, cellSpacing: 0, width: 240, children: _jsx("tbody", { children: _jsx("tr", { children: _jsx("td", { children: _jsx("img", { alt: "Logo", src: logoData, width: 240 }) }) }) }) }) }) }), _jsx("tr", { children: _jsx("td", { height:
|
|
63
|
+
backgroundColor: mailConfig.styles.panel.backgroundColor,
|
|
64
|
+
}, width: mailConfig.styles.panel.padding }), _jsx("td", { style: {
|
|
65
|
+
backgroundColor: mailConfig.styles.panel.backgroundColor,
|
|
66
|
+
}, children: _jsx("table", { border: 0, cellPadding: 0, cellSpacing: 0, width: "100%", children: _jsxs("tbody", { children: [logoData ? (_jsxs(Fragment, { children: [_jsx("tr", { children: _jsx("td", { children: _jsx("table", { border: 0, cellPadding: 0, cellSpacing: 0, width: 240, children: _jsx("tbody", { children: _jsx("tr", { children: _jsx("td", { children: _jsx("img", { alt: "Logo", src: logoData, width: 240 }) }) }) }) }) }) }), _jsx("tr", { children: _jsx("td", { height: mailConfig.styles.panel
|
|
80
67
|
.padding }) })] })) : null, _jsx("tr", { children: _jsx("td", { style: {
|
|
81
|
-
color:
|
|
82
|
-
|
|
83
|
-
|
|
68
|
+
color: mailConfig.styles.title
|
|
69
|
+
.color,
|
|
70
|
+
fontSize: mailConfig.styles.title
|
|
71
|
+
.fontSize,
|
|
72
|
+
fontWeight: mailConfig.styles.title
|
|
84
73
|
.fontWeight,
|
|
85
|
-
}, children: title }) }), _jsx("tr", { children: _jsx("td", { height:
|
|
86
|
-
backgroundColor:
|
|
87
|
-
}, width:
|
|
88
|
-
backgroundColor:
|
|
89
|
-
}, width:
|
|
90
|
-
backgroundColor:
|
|
91
|
-
height:
|
|
92
|
-
width:
|
|
74
|
+
}, children: title }) }), _jsx("tr", { children: _jsx("td", { height: mailConfig.styles.panel.padding }) }), _jsx("tr", { children: _jsx("td", { children: children }) })] }) }) }), _jsx("td", { className: "padding", style: {
|
|
75
|
+
backgroundColor: mailConfig.styles.panel.backgroundColor,
|
|
76
|
+
}, width: mailConfig.styles.panel.padding })] }), _jsxs("tr", { children: [_jsx("td", { className: "padding", height: mailConfig.styles.panel.padding, style: {
|
|
77
|
+
backgroundColor: mailConfig.styles.panel.backgroundColor,
|
|
78
|
+
}, width: mailConfig.styles.panel.padding, children: _jsx("div", { className: "padding", style: {
|
|
79
|
+
backgroundColor: mailConfig.styles.root.backgroundColor,
|
|
80
|
+
height: mailConfig.styles.panel.padding,
|
|
81
|
+
width: mailConfig.styles.panel.padding,
|
|
93
82
|
}, children: _jsx("div", { className: "padding", style: {
|
|
94
|
-
backgroundColor:
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
83
|
+
backgroundColor: mailConfig.styles.panel
|
|
84
|
+
.backgroundColor,
|
|
85
|
+
borderBottomLeftRadius: mailConfig.styles.panel.padding /
|
|
86
|
+
HALF,
|
|
87
|
+
height: mailConfig.styles.panel.padding,
|
|
88
|
+
width: mailConfig.styles.panel.padding,
|
|
98
89
|
} }) }) }), _jsx("td", { className: "container", style: {
|
|
99
|
-
backgroundColor:
|
|
100
|
-
}, width: "610" }), _jsx("td", { className: "padding", height:
|
|
101
|
-
backgroundColor:
|
|
102
|
-
}, width:
|
|
103
|
-
backgroundColor:
|
|
104
|
-
height:
|
|
105
|
-
width:
|
|
90
|
+
backgroundColor: mailConfig.styles.panel.backgroundColor,
|
|
91
|
+
}, width: "610" }), _jsx("td", { className: "padding", height: mailConfig.styles.panel.padding, style: {
|
|
92
|
+
backgroundColor: mailConfig.styles.panel.backgroundColor,
|
|
93
|
+
}, width: mailConfig.styles.panel.padding, children: _jsx("div", { className: "padding", style: {
|
|
94
|
+
backgroundColor: mailConfig.styles.root.backgroundColor,
|
|
95
|
+
height: mailConfig.styles.panel.padding,
|
|
96
|
+
width: mailConfig.styles.panel.padding,
|
|
106
97
|
}, children: _jsx("div", { className: "padding", style: {
|
|
107
|
-
backgroundColor:
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
98
|
+
backgroundColor: mailConfig.styles.panel
|
|
99
|
+
.backgroundColor,
|
|
100
|
+
borderBottomRightRadius: mailConfig.styles.panel.padding /
|
|
101
|
+
HALF,
|
|
102
|
+
height: mailConfig.styles.panel.padding,
|
|
103
|
+
width: mailConfig.styles.panel.padding,
|
|
104
|
+
} }) }) })] })] }) }) }), _jsx("td", { className: "padding", style: { backgroundColor: mailConfig.styles.root.backgroundColor }, width: "20" })] }), _jsx("tr", { children: _jsx("td", { className: "padding", colSpan: 3, height: "20", style: { backgroundColor: mailConfig.styles.root.backgroundColor } }) })] }) }) })] }));
|
|
112
105
|
}
|
|
113
106
|
export default Mail;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DeepPartial } from '@sqrzro/utility';
|
|
2
|
+
import { MailConfigObject } from '../utility/interfaces';
|
|
3
|
+
export interface MailButtonProps extends DeepPartial<MailConfigObject> {
|
|
4
|
+
children: string;
|
|
5
|
+
href: string;
|
|
6
|
+
}
|
|
7
|
+
declare function MailButton({ children, href, styles, }: MailButtonProps): Promise<React.ReactElement>;
|
|
8
|
+
export default MailButton;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use server';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import getMailConfig from '../utility/get-mail-config';
|
|
4
|
+
function calculateWidth(text) {
|
|
5
|
+
const characterWidth = 8;
|
|
6
|
+
const padding = 50;
|
|
7
|
+
return text.length * characterWidth + padding;
|
|
8
|
+
}
|
|
9
|
+
async function MailButton({ children, href, styles, }) {
|
|
10
|
+
const mailConfig = getMailConfig({ styles });
|
|
11
|
+
const calculatedWidth = calculateWidth(children);
|
|
12
|
+
return (_jsx("div", { dangerouslySetInnerHTML: {
|
|
13
|
+
__html: `
|
|
14
|
+
<!--[if mso]>
|
|
15
|
+
<v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="${href}" style="height:${mailConfig.styles.button.height}px;v-text-anchor:middle;width:${calculatedWidth}px;" arcsize="50%" stroke="f" fillcolor="${mailConfig.styles.button.backgroundColor}">
|
|
16
|
+
<w:anchorlock/>
|
|
17
|
+
<center>
|
|
18
|
+
<![endif]-->
|
|
19
|
+
<a href="${href}"
|
|
20
|
+
style="background-color:${mailConfig.styles.button.backgroundColor};border-radius:${mailConfig.styles.button.borderRadius}px;color:${mailConfig.styles.button.color};display:inline-block;font-weight:bold;line-height:${mailConfig.styles.button.height}px;text-align:center;text-decoration:none;width:${calculatedWidth}px;-webkit-text-size-adjust:none;">${children}</a>
|
|
21
|
+
<!--[if mso]>
|
|
22
|
+
</center>
|
|
23
|
+
</v:roundrect>
|
|
24
|
+
<![endif]-->
|
|
25
|
+
`,
|
|
26
|
+
} }));
|
|
27
|
+
}
|
|
28
|
+
export default MailButton;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type { MailProps } from './Mail';
|
|
2
|
+
export { default as Mail } from './Mail';
|
|
3
|
+
export type { MailBlockProps } from './MailBlock';
|
|
4
|
+
export { default as MailBlock } from './MailBlock';
|
|
5
|
+
export type { MailButtonProps } from './MailButton';
|
|
6
|
+
export { default as MailButton } from './MailButton';
|
|
7
|
+
export type { MailTableProps } from './MailTable';
|
|
8
|
+
export { default as MailTable } from './MailTable';
|
|
@@ -3,7 +3,8 @@ import fs from 'node:fs';
|
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
async function convertToDataURI(fileName) {
|
|
5
5
|
try {
|
|
6
|
-
const filePath = path.resolve(
|
|
6
|
+
const filePath = path.resolve(fileName);
|
|
7
|
+
console.log('Converting file to Data URI:', filePath);
|
|
7
8
|
const mimeType = 'image/' + path.extname(filePath).slice(1);
|
|
8
9
|
const imageData = fs.readFileSync(filePath);
|
|
9
10
|
const base64Image = Buffer.from(imageData).toString('base64');
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { deepMerge } from '@sqrzro/utility';
|
|
2
|
+
const DEFAULT_STYLES = {
|
|
3
|
+
styles: {
|
|
4
|
+
button: {
|
|
5
|
+
backgroundColor: '#0f172b',
|
|
6
|
+
borderRadius: 4,
|
|
7
|
+
color: '#ffffff',
|
|
8
|
+
height: 40,
|
|
9
|
+
},
|
|
10
|
+
panel: {
|
|
11
|
+
backgroundColor: '#ffffff',
|
|
12
|
+
padding: 40,
|
|
13
|
+
},
|
|
14
|
+
root: {
|
|
15
|
+
backgroundColor: '#f5f5f5',
|
|
16
|
+
},
|
|
17
|
+
title: {
|
|
18
|
+
color: '#62748e',
|
|
19
|
+
fontSize: 20,
|
|
20
|
+
fontWeight: 'bold',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
function getMailConfig(overrides) {
|
|
25
|
+
const string = process.env.MAIL_CONFIG || '{}';
|
|
26
|
+
try {
|
|
27
|
+
const object = JSON.parse(string);
|
|
28
|
+
return deepMerge(DEFAULT_STYLES, object, overrides || {});
|
|
29
|
+
}
|
|
30
|
+
catch (err) {
|
|
31
|
+
return deepMerge(DEFAULT_STYLES, overrides || {});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export default getMailConfig;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface MailConfigObject {
|
|
2
|
+
logo?: string;
|
|
3
|
+
styles: {
|
|
4
|
+
root: {
|
|
5
|
+
backgroundColor: string;
|
|
6
|
+
};
|
|
7
|
+
panel: {
|
|
8
|
+
backgroundColor: string;
|
|
9
|
+
padding: number;
|
|
10
|
+
};
|
|
11
|
+
button: {
|
|
12
|
+
backgroundColor: string;
|
|
13
|
+
borderRadius: number;
|
|
14
|
+
color: string;
|
|
15
|
+
height: number;
|
|
16
|
+
};
|
|
17
|
+
title: {
|
|
18
|
+
color: string;
|
|
19
|
+
fontSize: number;
|
|
20
|
+
fontWeight: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sqrzro/ui",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.0.0-alpha.
|
|
4
|
+
"version": "4.0.0-alpha.42",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"license": "ISC",
|
|
@@ -26,6 +26,10 @@
|
|
|
26
26
|
"types": "./dist/hooks/index.d.ts",
|
|
27
27
|
"default": "./dist/hooks/index.js"
|
|
28
28
|
},
|
|
29
|
+
"./mail": {
|
|
30
|
+
"types": "./dist/mail/index.d.ts",
|
|
31
|
+
"default": "./dist/mail/index.js"
|
|
32
|
+
},
|
|
29
33
|
"./navigation": {
|
|
30
34
|
"types": "./dist/navigation/index.d.ts",
|
|
31
35
|
"default": "./dist/navigation/index.js"
|
|
@@ -53,9 +57,8 @@
|
|
|
53
57
|
"react-dom": "^19.2.4",
|
|
54
58
|
"tailwind-merge": "^3.5.0",
|
|
55
59
|
"use-deep-compare-effect": "^1.8.1",
|
|
56
|
-
"@sqrzro/addons": "^4.0.0-alpha.
|
|
57
|
-
"@sqrzro/utility": "^4.0.0-alpha.
|
|
58
|
-
"@sqrzro/config": "^4.0.0-alpha.3"
|
|
60
|
+
"@sqrzro/addons": "^4.0.0-alpha.6",
|
|
61
|
+
"@sqrzro/utility": "^4.0.0-alpha.16"
|
|
59
62
|
},
|
|
60
63
|
"devDependencies": {
|
|
61
64
|
"@storybook/addon-a11y": "^10.2.14",
|
package/dist/addon/config.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { AppConfig } from '@sqrzro/config';
|
|
2
|
-
import type { NodePgDatabase } from 'drizzle-orm/node-postgres';
|
|
3
|
-
import type { UIAddonConfigObject, BaseUIAddonConfigObject } from './interfaces';
|
|
4
|
-
export declare function setConfig(db: NodePgDatabase, appConfig: AppConfig, cfg?: Partial<BaseUIAddonConfigObject>): void;
|
|
5
|
-
export declare function getConfig(): UIAddonConfigObject;
|
package/dist/addon/config.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { MissingConfigError } from '@sqrzro/addons';
|
|
2
|
-
import applyDefaults from './defaults';
|
|
3
|
-
let config = null;
|
|
4
|
-
export function setConfig(db, appConfig, cfg) {
|
|
5
|
-
config = { ...applyDefaults(cfg), db, app: appConfig };
|
|
6
|
-
}
|
|
7
|
-
export function getConfig() {
|
|
8
|
-
if (!config) {
|
|
9
|
-
throw new MissingConfigError('ui');
|
|
10
|
-
}
|
|
11
|
-
return config;
|
|
12
|
-
}
|
package/dist/addon/defaults.d.ts
DELETED
package/dist/addon/defaults.js
DELETED
package/dist/addon/index.d.ts
DELETED
package/dist/addon/index.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { AppConfig } from '@sqrzro/config';
|
|
2
|
-
import type { NodePgDatabase } from 'drizzle-orm/node-postgres';
|
|
3
|
-
export interface BaseUIAddonConfigObject {
|
|
4
|
-
}
|
|
5
|
-
export interface UIAddonConfigObject extends BaseUIAddonConfigObject {
|
|
6
|
-
app: AppConfig;
|
|
7
|
-
db: NodePgDatabase;
|
|
8
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { AppConfig } from '@sqrzro/config';
|
|
2
|
-
export type MailButtonProps = AppConfig['mail'] & {
|
|
3
|
-
children: string;
|
|
4
|
-
href: string;
|
|
5
|
-
};
|
|
6
|
-
declare function MailButton({ children, href, styles }: Readonly<MailButtonProps>): React.ReactElement;
|
|
7
|
-
export default MailButton;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { deepMerge } from '@sqrzro/utility';
|
|
3
|
-
import { getConfig } from '../../../addon/config';
|
|
4
|
-
const DEFAULT_STYLES = {
|
|
5
|
-
styles: {
|
|
6
|
-
button: {
|
|
7
|
-
backgroundColor: '#f26c25',
|
|
8
|
-
borderRadius: 20,
|
|
9
|
-
color: '#ffffff',
|
|
10
|
-
height: 40,
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
|
-
function calculateWidth(text) {
|
|
15
|
-
const characterWidth = 8;
|
|
16
|
-
const padding = 50;
|
|
17
|
-
return text.length * characterWidth + padding;
|
|
18
|
-
}
|
|
19
|
-
function MailButton({ children, href, styles }) {
|
|
20
|
-
const styleConfig = deepMerge(DEFAULT_STYLES?.styles || {}, getConfig().app.mail?.styles || {}, styles || {});
|
|
21
|
-
const calculatedWidth = calculateWidth(children);
|
|
22
|
-
return (_jsx("div", { dangerouslySetInnerHTML: {
|
|
23
|
-
__html: `
|
|
24
|
-
<!--[if mso]>
|
|
25
|
-
<v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="${href}" style="height:${styleConfig.button.height}px;v-text-anchor:middle;width:${calculatedWidth}px;" arcsize="50%" stroke="f" fillcolor="${styleConfig.button.backgroundColor}">
|
|
26
|
-
<w:anchorlock/>
|
|
27
|
-
<center>
|
|
28
|
-
<![endif]-->
|
|
29
|
-
<a href="${href}"
|
|
30
|
-
style="background-color:${styleConfig.button.backgroundColor};border-radius:${styleConfig.button.borderRadius}px;color:${styleConfig.button.color};display:inline-block;font-weight:bold;line-height:${styleConfig.button.height}px;text-align:center;text-decoration:none;width:${calculatedWidth}px;-webkit-text-size-adjust:none;">${children}</a>
|
|
31
|
-
<!--[if mso]>
|
|
32
|
-
</center>
|
|
33
|
-
</v:roundrect>
|
|
34
|
-
<![endif]-->
|
|
35
|
-
`,
|
|
36
|
-
} }));
|
|
37
|
-
}
|
|
38
|
-
export default MailButton;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|