@akinon/ui-spin 0.3.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.
@@ -1,5 +1,5 @@
1
- import type { SpinProps as AntSpinProps } from 'antd';
2
1
  import * as React from 'react';
3
- export type SpinProps = AntSpinProps;
4
- export declare const Spin: ({ ...restSpinProps }: SpinProps) => React.JSX.Element;
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
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,IAAI,YAAY,EAAE,MAAM,MAAM,CAAC;AAEtD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,MAAM,MAAM,SAAS,GAAG,YAAY,CAAC;AAErC,eAAO,MAAM,IAAI,yBAA0B,SAAS,sBAEnD,CAAC"}
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 = (_a) => {
18
- var restSpinProps = __rest(_a, []);
19
- return React.createElement(antd_1.Spin, Object.assign({}, restSpinProps));
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;
@@ -1,5 +1,5 @@
1
- import type { SpinProps as AntSpinProps } from 'antd';
2
1
  import * as React from 'react';
3
- export type SpinProps = AntSpinProps;
4
- export declare const Spin: ({ ...restSpinProps }: SpinProps) => React.JSX.Element;
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
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,IAAI,YAAY,EAAE,MAAM,MAAM,CAAC;AAEtD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,MAAM,MAAM,SAAS,GAAG,YAAY,CAAC;AAErC,eAAO,MAAM,IAAI,yBAA0B,SAAS,sBAEnD,CAAC"}
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
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
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 = (_a) => {
15
- var restSpinProps = __rest(_a, []);
16
- return React.createElement(AntSpin, Object.assign({}, restSpinProps));
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
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akinon/ui-spin",
3
- "version": "0.3.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.17.0"
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/vite-config": "0.4.0",
20
- "@akinon/eslint-config": "0.1.0",
21
- "@akinon/typescript-config": "0.2.0"
20
+ "@akinon/typescript-config": "0.3.0"
22
21
  },
23
22
  "peerDependencies": {
24
23
  "react": ">=18",
@@ -40,10 +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
- "test": "vitest run",
45
- "test:ui": "vitest --ui",
46
- "test:watch": "vitest watch",
47
42
  "typecheck": "tsc --noEmit"
48
43
  }
49
44
  }