@sqrzro/ui 4.0.0-alpha.39 → 4.0.0-alpha.41
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/addon/config.d.ts +5 -0
- package/dist/addon/config.js +12 -0
- package/dist/addon/defaults.d.ts +3 -0
- package/dist/addon/defaults.js +6 -0
- package/dist/addon/index.d.ts +5 -0
- package/dist/addon/index.js +8 -0
- package/dist/addon/interfaces.d.ts +8 -0
- package/dist/addon/interfaces.js +1 -0
- package/dist/components/mail/Mail/index.js +3 -3
- package/dist/components/mail/MailButton/index.js +2 -3
- package/package.json +9 -3
|
@@ -0,0 +1,5 @@
|
|
|
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;
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
/* eslint-disable max-lines-per-function, react/jsx-max-depth, react/no-danger */
|
|
3
3
|
import { Fragment } from 'react';
|
|
4
|
-
import { getAppConfig } from '@sqrzro/config';
|
|
5
4
|
import { deepMerge } from '@sqrzro/utility';
|
|
5
|
+
import { getConfig } from '../../../addon/config';
|
|
6
6
|
const DEFAULT_STYLES = {
|
|
7
7
|
styles: {
|
|
8
8
|
root: {
|
|
@@ -21,8 +21,8 @@ const DEFAULT_STYLES = {
|
|
|
21
21
|
};
|
|
22
22
|
const HALF = 2;
|
|
23
23
|
async function Mail({ children, logo, styles, title, }) {
|
|
24
|
-
const styleConfig = deepMerge(DEFAULT_STYLES?.styles || {},
|
|
25
|
-
const logoData = await (await import('../../../utility/convert-to-datauri')).default(logo ??
|
|
24
|
+
const styleConfig = deepMerge(DEFAULT_STYLES?.styles || {}, getConfig().app.mail?.styles || {}, styles || {});
|
|
25
|
+
const logoData = await (await import('../../../utility/convert-to-datauri')).default(logo ?? getConfig().app.mail?.logo ?? '');
|
|
26
26
|
return (_jsxs("html", { lang: "en", children: [_jsxs("head", { children: [_jsx("meta", { charSet: "utf-8" }), _jsx("style", { dangerouslySetInnerHTML: {
|
|
27
27
|
__html: `
|
|
28
28
|
body {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
/* eslint-disable react/no-danger */
|
|
3
|
-
import { getAppConfig } from '@sqrzro/config';
|
|
4
2
|
import { deepMerge } from '@sqrzro/utility';
|
|
3
|
+
import { getConfig } from '../../../addon/config';
|
|
5
4
|
const DEFAULT_STYLES = {
|
|
6
5
|
styles: {
|
|
7
6
|
button: {
|
|
@@ -18,7 +17,7 @@ function calculateWidth(text) {
|
|
|
18
17
|
return text.length * characterWidth + padding;
|
|
19
18
|
}
|
|
20
19
|
function MailButton({ children, href, styles }) {
|
|
21
|
-
const styleConfig = deepMerge(DEFAULT_STYLES?.styles || {},
|
|
20
|
+
const styleConfig = deepMerge(DEFAULT_STYLES?.styles || {}, getConfig().app.mail?.styles || {}, styles || {});
|
|
22
21
|
const calculatedWidth = calculateWidth(children);
|
|
23
22
|
return (_jsx("div", { dangerouslySetInnerHTML: {
|
|
24
23
|
__html: `
|
package/package.json
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sqrzro/ui",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.0.0-alpha.
|
|
4
|
+
"version": "4.0.0-alpha.41",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"license": "ISC",
|
|
8
8
|
"exports": {
|
|
9
|
+
"./addon": {
|
|
10
|
+
"types": "./dist/addon/index.d.ts",
|
|
11
|
+
"default": "./dist/addon/index.js"
|
|
12
|
+
},
|
|
9
13
|
"./components": {
|
|
10
14
|
"types": "./dist/components/index.d.ts",
|
|
11
15
|
"default": "./dist/components/index.js"
|
|
@@ -43,13 +47,15 @@
|
|
|
43
47
|
],
|
|
44
48
|
"dependencies": {
|
|
45
49
|
"clsx": "^2.1.1",
|
|
50
|
+
"drizzle-orm": "^0.45.1",
|
|
46
51
|
"next": "^16.1.6",
|
|
47
52
|
"react": "^19.2.4",
|
|
48
53
|
"react-dom": "^19.2.4",
|
|
49
54
|
"tailwind-merge": "^3.5.0",
|
|
50
55
|
"use-deep-compare-effect": "^1.8.1",
|
|
51
|
-
"@sqrzro/
|
|
52
|
-
"@sqrzro/utility": "^4.0.0-alpha.15"
|
|
56
|
+
"@sqrzro/addons": "^4.0.0-alpha.5",
|
|
57
|
+
"@sqrzro/utility": "^4.0.0-alpha.15",
|
|
58
|
+
"@sqrzro/config": "^4.0.0-alpha.3"
|
|
53
59
|
},
|
|
54
60
|
"devDependencies": {
|
|
55
61
|
"@storybook/addon-a11y": "^10.2.14",
|