@akinon/ui-alert 0.2.0 → 0.4.0
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/cjs/index.d.ts +10 -9
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +68 -9
- package/dist/esm/index.d.ts +10 -9
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +68 -9
- package/package.json +4 -6
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import type { AlertProps as AntAlertProps } from 'antd';
|
|
2
1
|
import * as React from 'react';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
import type { AlertProps } from './types';
|
|
3
|
+
export type { AlertProps } from './types';
|
|
4
|
+
export declare enum AlertStatus {
|
|
5
|
+
Success = "success",
|
|
6
|
+
Info1 = "info-1",
|
|
7
|
+
Info2 = "info-2",
|
|
8
|
+
Info3 = "info-3",
|
|
9
|
+
Error = "error"
|
|
10
|
+
}
|
|
11
|
+
export declare const Alert: ({ status, ...restAlertProps }: AlertProps) => React.JSX.Element;
|
|
11
12
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/cjs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,oBAAY,WAAW;IACrB,OAAO,YAAY;IACnB,KAAK,WAAW;IAChB,KAAK,WAAW;IAChB,KAAK,WAAW;IAChB,KAAK,UAAU;CAChB;AAED,eAAO,MAAM,KAAK,kCAAmC,UAAU,sBAwE9D,CAAC"}
|
package/dist/cjs/index.js
CHANGED
|
@@ -11,17 +11,76 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
return t;
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.Alert = void 0;
|
|
14
|
+
exports.Alert = exports.AlertStatus = void 0;
|
|
15
|
+
const ui_theme_1 = require("@akinon/ui-theme");
|
|
16
|
+
const cssinjs_1 = require("@ant-design/cssinjs");
|
|
15
17
|
const antd_1 = require("antd");
|
|
16
18
|
const React = require("react");
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
var AlertStatus;
|
|
20
|
+
(function (AlertStatus) {
|
|
21
|
+
AlertStatus["Success"] = "success";
|
|
22
|
+
AlertStatus["Info1"] = "info-1";
|
|
23
|
+
AlertStatus["Info2"] = "info-2";
|
|
24
|
+
AlertStatus["Info3"] = "info-3";
|
|
25
|
+
AlertStatus["Error"] = "error";
|
|
26
|
+
})(AlertStatus || (exports.AlertStatus = AlertStatus = {}));
|
|
23
27
|
const Alert = (_a) => {
|
|
24
|
-
var restAlertProps = __rest(_a, []);
|
|
25
|
-
|
|
28
|
+
var { status } = _a, restAlertProps = __rest(_a, ["status"]);
|
|
29
|
+
const { getPrefixCls, theme } = React.useContext(antd_1.ConfigProvider.ConfigContext);
|
|
30
|
+
const { token, hashId } = (0, ui_theme_1.useToken)();
|
|
31
|
+
const alertToken = token.Alert;
|
|
32
|
+
const useStyle = (0, cssinjs_1.useStyleRegister)({
|
|
33
|
+
token: token,
|
|
34
|
+
path: ['Alert'],
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
36
|
+
theme: theme
|
|
37
|
+
}, () => {
|
|
38
|
+
const prefixCls = `:where(.${hashId}).${getPrefixCls()}-alert`;
|
|
39
|
+
const prefixClsWithoutHash = `.${getPrefixCls()}-alert`;
|
|
40
|
+
return {
|
|
41
|
+
[`${prefixCls}-${AlertStatus.Success}`]: {
|
|
42
|
+
color: alertToken.defaultColorSuccess,
|
|
43
|
+
borderColor: alertToken.defaultBorderColorSuccess,
|
|
44
|
+
backgroundColor: alertToken.defaultBgSuccess,
|
|
45
|
+
['.anticon.anticon-close']: {
|
|
46
|
+
color: alertToken.defaultBorderColorSuccess
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
[`${prefixCls}-${AlertStatus.Info1}`]: {
|
|
50
|
+
color: alertToken.defaultColorWaiting1,
|
|
51
|
+
borderColor: alertToken.defaultBorderColorWaiting1,
|
|
52
|
+
backgroundColor: alertToken.defaultBgWaiting1,
|
|
53
|
+
['.anticon.anticon-close']: {
|
|
54
|
+
color: alertToken.defaultBorderColorWaiting1
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
[`${prefixCls}-${AlertStatus.Info2}`]: {
|
|
58
|
+
color: alertToken.defaultColorWaiting2,
|
|
59
|
+
borderColor: alertToken.defaultBorderColorWaiting2,
|
|
60
|
+
backgroundColor: alertToken.defaultBgWaiting2,
|
|
61
|
+
['.anticon.anticon-close']: {
|
|
62
|
+
color: alertToken.defaultBorderColorWaiting2
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
[`${prefixCls}-${AlertStatus.Info3}`]: {
|
|
66
|
+
color: alertToken.defaultColorWaiting3,
|
|
67
|
+
borderColor: alertToken.defaultBorderColorWaiting3,
|
|
68
|
+
backgroundColor: alertToken.defaultBgWaiting3,
|
|
69
|
+
['.anticon.anticon-close']: {
|
|
70
|
+
color: alertToken.defaultBorderColorWaiting3
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
[`${prefixCls}-${AlertStatus.Error}`]: {
|
|
74
|
+
color: alertToken.defaultColorFailed,
|
|
75
|
+
borderColor: alertToken.defaultBorderColorFailed,
|
|
76
|
+
backgroundColor: alertToken.defaultBgFailed,
|
|
77
|
+
['.anticon.anticon-close']: {
|
|
78
|
+
color: alertToken.defaultBorderColorFailed
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
[prefixClsWithoutHash]: {}
|
|
82
|
+
};
|
|
83
|
+
});
|
|
84
|
+
return useStyle(React.createElement(antd_1.Alert, Object.assign({ className: status && `akinon-alert-${status}` }, restAlertProps)));
|
|
26
85
|
};
|
|
27
86
|
exports.Alert = Alert;
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import type { AlertProps as AntAlertProps } from 'antd';
|
|
2
1
|
import * as React from 'react';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
import type { AlertProps } from './types';
|
|
3
|
+
export type { AlertProps } from './types';
|
|
4
|
+
export declare enum AlertStatus {
|
|
5
|
+
Success = "success",
|
|
6
|
+
Info1 = "info-1",
|
|
7
|
+
Info2 = "info-2",
|
|
8
|
+
Info3 = "info-3",
|
|
9
|
+
Error = "error"
|
|
10
|
+
}
|
|
11
|
+
export declare const Alert: ({ status, ...restAlertProps }: AlertProps) => React.JSX.Element;
|
|
11
12
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,oBAAY,WAAW;IACrB,OAAO,YAAY;IACnB,KAAK,WAAW;IAChB,KAAK,WAAW;IAChB,KAAK,WAAW;IAChB,KAAK,UAAU;CAChB;AAED,eAAO,MAAM,KAAK,kCAAmC,UAAU,sBAwE9D,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -9,15 +9,74 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import {
|
|
12
|
+
import { useToken } from '@akinon/ui-theme';
|
|
13
|
+
import { useStyleRegister } from '@ant-design/cssinjs';
|
|
14
|
+
import { Alert as AntAlert, ConfigProvider } from 'antd';
|
|
13
15
|
import * as React from 'react';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
export var AlertStatus;
|
|
17
|
+
(function (AlertStatus) {
|
|
18
|
+
AlertStatus["Success"] = "success";
|
|
19
|
+
AlertStatus["Info1"] = "info-1";
|
|
20
|
+
AlertStatus["Info2"] = "info-2";
|
|
21
|
+
AlertStatus["Info3"] = "info-3";
|
|
22
|
+
AlertStatus["Error"] = "error";
|
|
23
|
+
})(AlertStatus || (AlertStatus = {}));
|
|
20
24
|
export const Alert = (_a) => {
|
|
21
|
-
var restAlertProps = __rest(_a, []);
|
|
22
|
-
|
|
25
|
+
var { status } = _a, restAlertProps = __rest(_a, ["status"]);
|
|
26
|
+
const { getPrefixCls, theme } = React.useContext(ConfigProvider.ConfigContext);
|
|
27
|
+
const { token, hashId } = useToken();
|
|
28
|
+
const alertToken = token.Alert;
|
|
29
|
+
const useStyle = useStyleRegister({
|
|
30
|
+
token: token,
|
|
31
|
+
path: ['Alert'],
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
33
|
+
theme: theme
|
|
34
|
+
}, () => {
|
|
35
|
+
const prefixCls = `:where(.${hashId}).${getPrefixCls()}-alert`;
|
|
36
|
+
const prefixClsWithoutHash = `.${getPrefixCls()}-alert`;
|
|
37
|
+
return {
|
|
38
|
+
[`${prefixCls}-${AlertStatus.Success}`]: {
|
|
39
|
+
color: alertToken.defaultColorSuccess,
|
|
40
|
+
borderColor: alertToken.defaultBorderColorSuccess,
|
|
41
|
+
backgroundColor: alertToken.defaultBgSuccess,
|
|
42
|
+
['.anticon.anticon-close']: {
|
|
43
|
+
color: alertToken.defaultBorderColorSuccess
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
[`${prefixCls}-${AlertStatus.Info1}`]: {
|
|
47
|
+
color: alertToken.defaultColorWaiting1,
|
|
48
|
+
borderColor: alertToken.defaultBorderColorWaiting1,
|
|
49
|
+
backgroundColor: alertToken.defaultBgWaiting1,
|
|
50
|
+
['.anticon.anticon-close']: {
|
|
51
|
+
color: alertToken.defaultBorderColorWaiting1
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
[`${prefixCls}-${AlertStatus.Info2}`]: {
|
|
55
|
+
color: alertToken.defaultColorWaiting2,
|
|
56
|
+
borderColor: alertToken.defaultBorderColorWaiting2,
|
|
57
|
+
backgroundColor: alertToken.defaultBgWaiting2,
|
|
58
|
+
['.anticon.anticon-close']: {
|
|
59
|
+
color: alertToken.defaultBorderColorWaiting2
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
[`${prefixCls}-${AlertStatus.Info3}`]: {
|
|
63
|
+
color: alertToken.defaultColorWaiting3,
|
|
64
|
+
borderColor: alertToken.defaultBorderColorWaiting3,
|
|
65
|
+
backgroundColor: alertToken.defaultBgWaiting3,
|
|
66
|
+
['.anticon.anticon-close']: {
|
|
67
|
+
color: alertToken.defaultBorderColorWaiting3
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
[`${prefixCls}-${AlertStatus.Error}`]: {
|
|
71
|
+
color: alertToken.defaultColorFailed,
|
|
72
|
+
borderColor: alertToken.defaultBorderColorFailed,
|
|
73
|
+
backgroundColor: alertToken.defaultBgFailed,
|
|
74
|
+
['.anticon.anticon-close']: {
|
|
75
|
+
color: alertToken.defaultBorderColorFailed
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
[prefixClsWithoutHash]: {}
|
|
79
|
+
};
|
|
80
|
+
});
|
|
81
|
+
return useStyle(React.createElement(AntAlert, Object.assign({ className: status && `akinon-alert-${status}` }, restAlertProps)));
|
|
23
82
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akinon/ui-alert",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
@@ -9,16 +9,15 @@
|
|
|
9
9
|
"dist"
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"antd": "5.
|
|
12
|
+
"antd": "5.17.0",
|
|
13
|
+
"@akinon/ui-theme": "0.6.0"
|
|
13
14
|
},
|
|
14
15
|
"devDependencies": {
|
|
15
16
|
"clean-package": "2.2.0",
|
|
16
17
|
"copyfiles": "^2.4.1",
|
|
17
18
|
"rimraf": "^5.0.5",
|
|
18
19
|
"typescript": "^5.2.2",
|
|
19
|
-
"@akinon/
|
|
20
|
-
"@akinon/eslint-config": "0.1.0",
|
|
21
|
-
"@akinon/typescript-config": "0.1.0"
|
|
20
|
+
"@akinon/typescript-config": "0.3.0"
|
|
22
21
|
},
|
|
23
22
|
"peerDependencies": {
|
|
24
23
|
"react": ">=18",
|
|
@@ -40,7 +39,6 @@
|
|
|
40
39
|
"build:commonjs": "tsc --module commonjs --outDir dist/cjs",
|
|
41
40
|
"copy:files": "copyfiles -u 1 src/**/*.css dist/esm && copyfiles -u 1 src/**/*.css dist/cjs",
|
|
42
41
|
"clean": "rimraf dist/",
|
|
43
|
-
"lint": "eslint *.ts*",
|
|
44
42
|
"typecheck": "tsc --noEmit"
|
|
45
43
|
}
|
|
46
44
|
}
|