@akinon/ui-tooltip 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 { TooltipProps as AntTooltipProps } from 'antd';
2
1
  import * as React from 'react';
3
- export type TooltipProps = AntTooltipProps;
2
+ import type { TooltipProps } from './types';
3
+ export type { TooltipProps } from './types';
4
4
  export declare const Tooltip: ({ children, ...restTooltipProps }: TooltipProps) => 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,YAAY,IAAI,eAAe,EAAE,MAAM,MAAM,CAAC;AAE5D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,MAAM,MAAM,YAAY,GAAG,eAAe,CAAC;AAE3C,eAAO,MAAM,OAAO,sCAAuC,YAAY,sBAMtE,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,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,OAAO,sCAAuC,YAAY,sBAgCtE,CAAC"}
package/dist/cjs/index.js CHANGED
@@ -12,10 +12,28 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.Tooltip = 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
19
  const Tooltip = (_a) => {
18
20
  var { children } = _a, restTooltipProps = __rest(_a, ["children"]);
19
- return (React.createElement(antd_1.Tooltip, Object.assign({}, restTooltipProps), children));
21
+ const { getPrefixCls, theme } = React.useContext(antd_1.ConfigProvider.ConfigContext);
22
+ const { token, hashId } = (0, ui_theme_1.useToken)();
23
+ const tooltipToken = token.Tooltip;
24
+ const useStyle = (0, cssinjs_1.useStyleRegister)({
25
+ token: token,
26
+ path: ['Tooltip'],
27
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
28
+ theme: theme
29
+ }, () => {
30
+ const prefixCls = `:where(.${hashId}).${getPrefixCls()}-tooltip`;
31
+ const prefixClsWithoutHash = `.${getPrefixCls()}-tooltip`;
32
+ return {
33
+ [prefixCls]: {},
34
+ [prefixClsWithoutHash]: {}
35
+ };
36
+ });
37
+ return useStyle(React.createElement(antd_1.Tooltip, Object.assign({ color: tooltipToken.bgColor }, restTooltipProps), children));
20
38
  };
21
39
  exports.Tooltip = Tooltip;
@@ -1,5 +1,5 @@
1
- import type { TooltipProps as AntTooltipProps } from 'antd';
2
1
  import * as React from 'react';
3
- export type TooltipProps = AntTooltipProps;
2
+ import type { TooltipProps } from './types';
3
+ export type { TooltipProps } from './types';
4
4
  export declare const Tooltip: ({ children, ...restTooltipProps }: TooltipProps) => 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,YAAY,IAAI,eAAe,EAAE,MAAM,MAAM,CAAC;AAE5D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,MAAM,MAAM,YAAY,GAAG,eAAe,CAAC;AAE3C,eAAO,MAAM,OAAO,sCAAuC,YAAY,sBAMtE,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,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,OAAO,sCAAuC,YAAY,sBAgCtE,CAAC"}
package/dist/esm/index.js CHANGED
@@ -9,9 +9,27 @@ var __rest = (this && this.__rest) || function (s, e) {
9
9
  }
10
10
  return t;
11
11
  };
12
- import { Tooltip as AntTooltip } from 'antd';
12
+ import { useToken } from '@akinon/ui-theme';
13
+ import { useStyleRegister } from '@ant-design/cssinjs';
14
+ import { ConfigProvider, Tooltip as AntTooltip } from 'antd';
13
15
  import * as React from 'react';
14
16
  export const Tooltip = (_a) => {
15
17
  var { children } = _a, restTooltipProps = __rest(_a, ["children"]);
16
- return (React.createElement(AntTooltip, Object.assign({}, restTooltipProps), children));
18
+ const { getPrefixCls, theme } = React.useContext(ConfigProvider.ConfigContext);
19
+ const { token, hashId } = useToken();
20
+ const tooltipToken = token.Tooltip;
21
+ const useStyle = useStyleRegister({
22
+ token: token,
23
+ path: ['Tooltip'],
24
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
25
+ theme: theme
26
+ }, () => {
27
+ const prefixCls = `:where(.${hashId}).${getPrefixCls()}-tooltip`;
28
+ const prefixClsWithoutHash = `.${getPrefixCls()}-tooltip`;
29
+ return {
30
+ [prefixCls]: {},
31
+ [prefixClsWithoutHash]: {}
32
+ };
33
+ });
34
+ return useStyle(React.createElement(AntTooltip, Object.assign({ color: tooltipToken.bgColor }, restTooltipProps), children));
17
35
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akinon/ui-tooltip",
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",
@@ -16,9 +16,8 @@
16
16
  "copyfiles": "^2.4.1",
17
17
  "rimraf": "^5.0.5",
18
18
  "typescript": "^5.2.2",
19
- "@akinon/typescript-config": "0.2.0",
20
- "@akinon/vite-config": "0.4.0",
21
- "@akinon/eslint-config": "0.1.0"
19
+ "@akinon/typescript-config": "0.3.0",
20
+ "@akinon/ui-theme": "0.6.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
  }