@akinon/ui-spin 0.3.0 → 0.5.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 +3 -3
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +20 -14
- package/dist/cjs/types.d.ts +53 -0
- package/dist/esm/index.d.ts +3 -3
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +21 -15
- package/dist/esm/types.d.ts +53 -0
- package/package.json +5 -10
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { SpinProps as AntSpinProps } from 'antd';
|
|
2
1
|
import * as React from 'react';
|
|
3
|
-
|
|
4
|
-
export
|
|
2
|
+
import type { SpinProps } from './types';
|
|
3
|
+
export type { SpinProps } from './types';
|
|
4
|
+
export declare const Spin: (props: SpinProps) => React.JSX.Element;
|
|
5
5
|
//# 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,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,eAAO,MAAM,IAAI,UAAW,SAAS,sBA4BpC,CAAC"}
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,21 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
3
|
exports.Spin = void 0;
|
|
4
|
+
const ui_theme_1 = require("@akinon/ui-theme");
|
|
5
|
+
const cssinjs_1 = require("@ant-design/cssinjs");
|
|
15
6
|
const antd_1 = require("antd");
|
|
16
7
|
const React = require("react");
|
|
17
|
-
const Spin = (
|
|
18
|
-
|
|
19
|
-
|
|
8
|
+
const Spin = (props) => {
|
|
9
|
+
const { getPrefixCls, theme } = React.useContext(antd_1.ConfigProvider.ConfigContext);
|
|
10
|
+
const { token, hashId } = (0, ui_theme_1.useToken)();
|
|
11
|
+
//const spinToken = (token as GlobalToken).Spin;
|
|
12
|
+
const useStyle = (0, cssinjs_1.useStyleRegister)({
|
|
13
|
+
token: token,
|
|
14
|
+
path: ['Spin'],
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
|
+
theme: theme
|
|
17
|
+
}, () => {
|
|
18
|
+
const prefixCls = `:where(.${hashId}).${getPrefixCls()}-spin`;
|
|
19
|
+
const prefixClsWithoutHash = `.${getPrefixCls()}-spin`;
|
|
20
|
+
return {
|
|
21
|
+
[prefixCls]: {},
|
|
22
|
+
[prefixClsWithoutHash]: {}
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
return useStyle(React.createElement(antd_1.Spin, Object.assign({}, props)));
|
|
20
26
|
};
|
|
21
27
|
exports.Spin = Spin;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export type SpinProps = Omit<AntSpinProps, 'prefixCls' | 'style' | 'styles'>;
|
|
2
|
+
|
|
3
|
+
declare const SpinSizes: readonly ['small', 'default', 'large'];
|
|
4
|
+
|
|
5
|
+
export type SpinSize = (typeof SpinSizes)[number];
|
|
6
|
+
|
|
7
|
+
export type SpinIndicator = React.ReactElement<HTMLElement>;
|
|
8
|
+
|
|
9
|
+
export interface AntSpinProps {
|
|
10
|
+
prefixCls?: string;
|
|
11
|
+
/**
|
|
12
|
+
* The additional css class
|
|
13
|
+
*/
|
|
14
|
+
className?: string;
|
|
15
|
+
/**
|
|
16
|
+
* ClassName on the root element
|
|
17
|
+
*/
|
|
18
|
+
rootClassName?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Whether Spin is visible
|
|
21
|
+
*/
|
|
22
|
+
spinning?: boolean;
|
|
23
|
+
style?: React.CSSProperties;
|
|
24
|
+
/**
|
|
25
|
+
* The size of Spin
|
|
26
|
+
*/
|
|
27
|
+
size?: SpinSize;
|
|
28
|
+
/**
|
|
29
|
+
* Customize description content when Spin has children
|
|
30
|
+
*/
|
|
31
|
+
tip?: React.ReactNode;
|
|
32
|
+
/**
|
|
33
|
+
* Specifies a delay in milliseconds for loading state (prevent flush)
|
|
34
|
+
*/
|
|
35
|
+
delay?: number;
|
|
36
|
+
/**
|
|
37
|
+
* The className of wrapper when Spin has children
|
|
38
|
+
*/
|
|
39
|
+
wrapperClassName?: string;
|
|
40
|
+
/**
|
|
41
|
+
* React node of the spinning indicator
|
|
42
|
+
*/
|
|
43
|
+
indicator?: SpinIndicator;
|
|
44
|
+
children?: React.ReactNode;
|
|
45
|
+
/**
|
|
46
|
+
* Display a backdrop with the Spin component
|
|
47
|
+
*/
|
|
48
|
+
fullscreen?: boolean;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export type SpinType = React.FC<SpinProps> & {
|
|
52
|
+
setDefaultIndicator: (indicator: React.ReactNode) => void;
|
|
53
|
+
};
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { SpinProps as AntSpinProps } from 'antd';
|
|
2
1
|
import * as React from 'react';
|
|
3
|
-
|
|
4
|
-
export
|
|
2
|
+
import type { SpinProps } from './types';
|
|
3
|
+
export type { SpinProps } from './types';
|
|
4
|
+
export declare const Spin: (props: SpinProps) => React.JSX.Element;
|
|
5
5
|
//# 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,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,eAAO,MAAM,IAAI,UAAW,SAAS,sBA4BpC,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,17 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import { Spin as AntSpin } from 'antd';
|
|
1
|
+
import { useToken } from '@akinon/ui-theme';
|
|
2
|
+
import { useStyleRegister } from '@ant-design/cssinjs';
|
|
3
|
+
import { ConfigProvider, Spin as AntSpin } from 'antd';
|
|
13
4
|
import * as React from 'react';
|
|
14
|
-
export const Spin = (
|
|
15
|
-
|
|
16
|
-
|
|
5
|
+
export const Spin = (props) => {
|
|
6
|
+
const { getPrefixCls, theme } = React.useContext(ConfigProvider.ConfigContext);
|
|
7
|
+
const { token, hashId } = useToken();
|
|
8
|
+
//const spinToken = (token as GlobalToken).Spin;
|
|
9
|
+
const useStyle = useStyleRegister({
|
|
10
|
+
token: token,
|
|
11
|
+
path: ['Spin'],
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
|
+
theme: theme
|
|
14
|
+
}, () => {
|
|
15
|
+
const prefixCls = `:where(.${hashId}).${getPrefixCls()}-spin`;
|
|
16
|
+
const prefixClsWithoutHash = `.${getPrefixCls()}-spin`;
|
|
17
|
+
return {
|
|
18
|
+
[prefixCls]: {},
|
|
19
|
+
[prefixClsWithoutHash]: {}
|
|
20
|
+
};
|
|
21
|
+
});
|
|
22
|
+
return useStyle(React.createElement(AntSpin, Object.assign({}, props)));
|
|
17
23
|
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export type SpinProps = Omit<AntSpinProps, 'prefixCls' | 'style' | 'styles'>;
|
|
2
|
+
|
|
3
|
+
declare const SpinSizes: readonly ['small', 'default', 'large'];
|
|
4
|
+
|
|
5
|
+
export type SpinSize = (typeof SpinSizes)[number];
|
|
6
|
+
|
|
7
|
+
export type SpinIndicator = React.ReactElement<HTMLElement>;
|
|
8
|
+
|
|
9
|
+
export interface AntSpinProps {
|
|
10
|
+
prefixCls?: string;
|
|
11
|
+
/**
|
|
12
|
+
* The additional css class
|
|
13
|
+
*/
|
|
14
|
+
className?: string;
|
|
15
|
+
/**
|
|
16
|
+
* ClassName on the root element
|
|
17
|
+
*/
|
|
18
|
+
rootClassName?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Whether Spin is visible
|
|
21
|
+
*/
|
|
22
|
+
spinning?: boolean;
|
|
23
|
+
style?: React.CSSProperties;
|
|
24
|
+
/**
|
|
25
|
+
* The size of Spin
|
|
26
|
+
*/
|
|
27
|
+
size?: SpinSize;
|
|
28
|
+
/**
|
|
29
|
+
* Customize description content when Spin has children
|
|
30
|
+
*/
|
|
31
|
+
tip?: React.ReactNode;
|
|
32
|
+
/**
|
|
33
|
+
* Specifies a delay in milliseconds for loading state (prevent flush)
|
|
34
|
+
*/
|
|
35
|
+
delay?: number;
|
|
36
|
+
/**
|
|
37
|
+
* The className of wrapper when Spin has children
|
|
38
|
+
*/
|
|
39
|
+
wrapperClassName?: string;
|
|
40
|
+
/**
|
|
41
|
+
* React node of the spinning indicator
|
|
42
|
+
*/
|
|
43
|
+
indicator?: SpinIndicator;
|
|
44
|
+
children?: React.ReactNode;
|
|
45
|
+
/**
|
|
46
|
+
* Display a backdrop with the Spin component
|
|
47
|
+
*/
|
|
48
|
+
fullscreen?: boolean;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export type SpinType = React.FC<SpinProps> & {
|
|
52
|
+
setDefaultIndicator: (indicator: React.ReactNode) => void;
|
|
53
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akinon/ui-spin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.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.17.0"
|
|
12
|
+
"antd": "5.17.0",
|
|
13
|
+
"@akinon/ui-theme": "0.7.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.2.0"
|
|
20
|
+
"@akinon/typescript-config": "0.4.0"
|
|
22
21
|
},
|
|
23
22
|
"peerDependencies": {
|
|
24
23
|
"react": ">=18",
|
|
@@ -38,12 +37,8 @@
|
|
|
38
37
|
"build": "pnpm run build:esm && pnpm run build:commonjs && pnpm run copy:files",
|
|
39
38
|
"build:esm": "tsc --outDir dist/esm",
|
|
40
39
|
"build:commonjs": "tsc --module commonjs --outDir dist/cjs",
|
|
41
|
-
"copy:files": "copyfiles -u 1 src
|
|
40
|
+
"copy:files": "copyfiles -u 1 \"src/**/*.!(ts|tsx)\" dist/esm && copyfiles -u 1 \"src/**/*.!(ts|tsx)\" dist/cjs",
|
|
42
41
|
"clean": "rimraf dist/",
|
|
43
|
-
"lint": "eslint *.ts*",
|
|
44
|
-
"test": "vitest run",
|
|
45
|
-
"test:ui": "vitest --ui",
|
|
46
|
-
"test:watch": "vitest watch",
|
|
47
42
|
"typecheck": "tsc --noEmit"
|
|
48
43
|
}
|
|
49
44
|
}
|