@test-icons/react 0.0.1 → 0.0.2

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.
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @file ACane 拐杖
3
+ * @author Auto Generated by HaierIcons
4
+ */
5
+ declare const _default: import("../runtime").Icon;
6
+ export default _default;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @file ACane 拐杖
3
+ * @author Auto Generated by HaierIcons
4
+ */
5
+ /* tslint:disable: max-line-length */
6
+ /* eslint-disable max-len */
7
+ import React from 'react';
8
+ import { IconWrapper } from '../runtime';
9
+ export default IconWrapper('a-cane', true, (props) => (React.createElement("svg", { width: props.size, height: props.size, viewBox: "0 0 48 48", fill: "none" },
10
+ React.createElement("path", { d: "M19.5576 44.7684C19.5576 44.7684 32.468 20.4873 33.6417 18.28C34.8154 16.0726 37.4535 8.98102 30.3899 5.22524C23.3263 1.46947 19.1571 7.18063 17.7486 9.82948", stroke: props.colors[0], strokeWidth: props.strokeWidth, strokeLinecap: props.strokeLinecap, strokeLinejoin: props.strokeLinejoin }))));
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @file Abdominal 腹部
3
+ * @author Auto Generated by HaierIcons
4
+ */
5
+ declare const _default: import("../runtime").Icon;
6
+ export default _default;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @file Abdominal 腹部
3
+ * @author Auto Generated by HaierIcons
4
+ */
5
+ /* tslint:disable: max-line-length */
6
+ /* eslint-disable max-len */
7
+ import React from 'react';
8
+ import { IconWrapper } from '../runtime';
9
+ export default IconWrapper('abdominal', false, (props) => (React.createElement("svg", { width: props.size, height: props.size, viewBox: "0 0 48 48", fill: "none" },
10
+ React.createElement("path", { d: "M7.89926 5C10.7371 8.01931 12.156 11.9408 12.156 16.7645C12.156 24 5.9995 29.5382 4.969 33.5C4.282 36.1412 3.95884 39.3078 3.9995 43", stroke: props.colors[0], strokeWidth: props.strokeWidth, strokeLinecap: props.strokeLinecap }),
11
+ React.createElement("path", { d: "M39.256 5C36.4182 8.01931 34.9992 11.9408 34.9992 16.7645C34.9992 24 41.1558 29.5382 42.1863 33.5C42.8733 36.1412 43.1964 39.3078 43.1558 43", stroke: props.colors[0], strokeWidth: props.strokeWidth, strokeLinecap: props.strokeLinecap }),
12
+ React.createElement("path", { d: "M6.24414 30.8369C12.7693 34.9668 18.6949 37.0317 24.0211 37.0317C29.3472 37.0317 34.9799 34.9668 40.9192 30.8369", stroke: props.colors[0], strokeWidth: props.strokeWidth, strokeLinecap: props.strokeLinecap }),
13
+ React.createElement("path", { d: "M24 31C25.3807 31 26.5 29.8807 26.5 28.5C26.5 27.1193 25.3807 26 24 26C22.6193 26 21.5 27.1193 21.5 28.5C21.5 29.8807 22.6193 31 24 31Z", fill: props.colors[0] }))));
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @file index 引用出口
3
+ * @author Auto Generated by HaierIcons
4
+ */
5
+ export { default as ACane } from './icons/ACane';
6
+ export { default as Abdominal } from './icons/Abdominal';
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @file index 引用出口
3
+ * @author Auto Generated by HaierIcons
4
+ */
5
+ export { default as ACane } from './icons/ACane';
6
+ export { default as Abdominal } from './icons/Abdominal';
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @file index 样式文件
3
+ * @author Auto Generated by HaierIcons
4
+ */
5
+ .hi-icon {
6
+ display: inline-block;
7
+ color: inherit;
8
+ font-style: normal;
9
+ line-height: 0;
10
+ text-align: center;
11
+ text-transform: none;
12
+ vertical-align: -0.125em;
13
+ text-rendering: optimizeLegibility;
14
+ -webkit-font-smoothing: antialiased;
15
+ -moz-osx-font-smoothing: grayscale;
16
+ }
17
+ .hi-icon-spin svg {
18
+ animation: hi-icon-spin 1s infinite linear;
19
+ }
20
+ @keyframes hi-icon-spin {
21
+ 100% {
22
+ -webkit-transform: rotate(360deg);
23
+ transform: rotate(360deg);
24
+ }
25
+ }
26
+ @-webkit-keyframes hi-icon-spin {
27
+ 100% {
28
+ -webkit-transform: rotate(360deg);
29
+ transform: rotate(360deg);
30
+ }
31
+ }
@@ -0,0 +1,64 @@
1
+ /**
2
+ * @file runtime 运行时
3
+ * @author Auto Generated by HaierIcons
4
+ */
5
+ import React, { HTMLAttributes, ReactElement } from 'react';
6
+ export type StrokeLinejoin = 'miter' | 'round' | 'bevel';
7
+ export type StrokeLinecap = 'butt' | 'round' | 'square';
8
+ export type Theme = 'outline' | 'filled' | 'two-tone' | 'multi-color';
9
+ export interface ISvgIconProps {
10
+ id: string;
11
+ size: number | string;
12
+ strokeWidth: number;
13
+ strokeLinecap: StrokeLinecap;
14
+ strokeLinejoin: StrokeLinejoin;
15
+ colors: string[];
16
+ }
17
+ export interface IIconConfig {
18
+ size: number | string;
19
+ strokeWidth: number;
20
+ strokeLinecap: StrokeLinecap;
21
+ strokeLinejoin: StrokeLinejoin;
22
+ prefix: string;
23
+ rtl: boolean;
24
+ theme: Theme;
25
+ colors: {
26
+ outline: {
27
+ fill: string;
28
+ background: string;
29
+ };
30
+ filled: {
31
+ fill: string;
32
+ background: string;
33
+ };
34
+ twoTone: {
35
+ fill: string;
36
+ twoTone: string;
37
+ };
38
+ multiColor: {
39
+ outStrokeColor: string;
40
+ outFillColor: string;
41
+ innerStrokeColor: string;
42
+ innerFillColor: string;
43
+ };
44
+ };
45
+ }
46
+ export interface IIconBase {
47
+ size?: number | string;
48
+ strokeWidth?: number;
49
+ strokeLinecap?: StrokeLinecap;
50
+ strokeLinejoin?: StrokeLinejoin;
51
+ theme?: Theme;
52
+ fill?: string | string[];
53
+ }
54
+ export type Intersection<T, K> = T & Omit<K, keyof T>;
55
+ export interface IIcon extends IIconBase {
56
+ spin?: boolean;
57
+ }
58
+ export type IIconProps = Intersection<IIcon, HTMLAttributes<HTMLSpanElement>>;
59
+ export type IconRender = (props: ISvgIconProps) => ReactElement;
60
+ export type Icon = (props: IIconProps) => ReactElement;
61
+ export declare const DEFAULT_ICON_CONFIGS: IIconConfig;
62
+ export declare function IconConverter(id: string, icon: IIconBase, config: IIconConfig): ISvgIconProps;
63
+ export declare const IconProvider: React.Provider<IIconConfig>;
64
+ export declare function IconWrapper(name: string, rtl: boolean, render: IconRender): Icon;
@@ -2,133 +2,20 @@
2
2
  * @file runtime 运行时
3
3
  * @author Auto Generated by HaierIcons
4
4
  */
5
-
6
- import React, {HTMLAttributes, ReactElement, createContext, useContext, useMemo} from 'react';
7
-
8
- // 描边连接类型
9
- export type StrokeLinejoin = 'miter' | 'round' | 'bevel';
10
-
11
- // 描边端点类型
12
- export type StrokeLinecap = 'butt' | 'round' | 'square';
13
-
14
- // 主题
15
- export type Theme = 'outline' | 'filled' | 'two-tone' | 'multi-color';
16
-
17
-
18
- // 包裹前的图标属性
19
- export interface ISvgIconProps {
20
-
21
- // 当前图标的唯一Id
22
- id: string;
23
-
24
- // 图标尺寸大小,默认1em
25
- size: number | string;
26
-
27
- // 描边宽度
28
- strokeWidth: number;
29
-
30
- // 描边端点类型
31
- strokeLinecap: StrokeLinecap;
32
-
33
- // 描边连接线类型
34
- strokeLinejoin: StrokeLinejoin;
35
-
36
- // 换肤的颜色数组
37
- colors: string[];
38
- }
39
-
40
- // 图标配置属性
41
- export interface IIconConfig {
42
-
43
- // 图标尺寸大小,默认1em
44
- size: number | string;
45
-
46
- // 描边宽度
47
- strokeWidth: number;
48
-
49
- // 描边端点类型
50
- strokeLinecap: StrokeLinecap;
51
-
52
- // 描边连接线类型
53
- strokeLinejoin: StrokeLinejoin;
54
-
55
- // CSS前缀
56
- prefix: string;
57
-
58
- // RTL是否开启
59
- rtl: boolean;
60
-
61
- // 默认主题
62
- theme: Theme;
63
-
64
- // 主题默认颜色
65
- colors: {
66
-
67
- outline: {
68
- fill: string;
69
- background: string;
70
- };
71
-
72
- filled: {
73
- fill: string;
74
- background: string;
75
- };
76
-
77
- twoTone: {
78
- fill: string;
79
- twoTone: string;
80
- };
81
-
82
- multiColor: {
83
- outStrokeColor: string;
84
- outFillColor: string;
85
- innerStrokeColor: string;
86
- innerFillColor: string;
87
- };
88
- };
89
- }
90
-
91
- // 图标基础属性
92
- export interface IIconBase {
93
-
94
- // 图标尺寸大小,默认1em
95
- size?: number | string;
96
-
97
- // 描边宽度
98
- strokeWidth?: number;
99
-
100
- // 描边端点类型
101
- strokeLinecap?: StrokeLinecap;
102
-
103
- // 描边连接线类型
104
- strokeLinejoin?: StrokeLinejoin;
105
-
106
- // 默认主题
107
- theme?: Theme;
108
-
109
- // 填充色
110
- fill?: string | string[];
111
- }
112
-
113
- // 安全的类型合并
114
- export type Intersection<T, K> = T & Omit<K, keyof T>;
115
-
116
- // 包裹后的图标非扩展属性
117
- export interface IIcon extends IIconBase {
118
- spin?: boolean;
119
- }
120
-
121
- // 包裹后的图标属性
122
- export type IIconProps = Intersection<IIcon, HTMLAttributes<HTMLSpanElement>>;
123
-
124
- // 包裹前的图标
125
- export type IconRender = (props: ISvgIconProps) => ReactElement;
126
-
127
- // 包裹后的图标
128
- export type Icon = (props: IIconProps) => ReactElement;
129
-
5
+ var __rest = (this && this.__rest) || function (s, e) {
6
+ var t = {};
7
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
8
+ t[p] = s[p];
9
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
10
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
11
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
12
+ t[p[i]] = s[p[i]];
13
+ }
14
+ return t;
15
+ };
16
+ import React, { createContext, useContext, useMemo } from 'react';
130
17
  // 默认属性
131
- export const DEFAULT_ICON_CONFIGS: IIconConfig = {
18
+ export const DEFAULT_ICON_CONFIGS = {
132
19
  size: '1em',
133
20
  strokeWidth: 4,
134
21
  strokeLinecap: 'round',
@@ -157,19 +44,14 @@ export const DEFAULT_ICON_CONFIGS: IIconConfig = {
157
44
  },
158
45
  prefix: 'hi'
159
46
  };
160
-
161
- function guid(): string {
47
+ function guid() {
162
48
  return 'icon-' + (((1 + Math.random()) * 0x100000000) | 0).toString(16).substring(1);
163
49
  }
164
-
165
50
  // 属性转换函数
166
- export function IconConverter(id: string, icon: IIconBase, config: IIconConfig): ISvgIconProps {
167
-
51
+ export function IconConverter(id, icon, config) {
168
52
  const fill = typeof icon.fill === 'string' ? [icon.fill] : icon.fill || [];
169
- const colors: string[] = [];
170
-
171
- const theme: Theme = icon.theme || config.theme;
172
-
53
+ const colors = [];
54
+ const theme = icon.theme || config.theme;
173
55
  switch (theme) {
174
56
  case 'outline':
175
57
  colors.push(typeof fill[0] === 'string' ? fill[0] : 'currentColor');
@@ -196,7 +78,6 @@ export function IconConverter(id: string, icon: IIconBase, config: IIconConfig):
196
78
  colors.push(typeof fill[3] === 'string' ? fill[3] : config.colors.multiColor.innerFillColor);
197
79
  break;
198
80
  }
199
-
200
81
  return {
201
82
  size: icon.size || config.size,
202
83
  strokeWidth: icon.strokeWidth || config.strokeWidth,
@@ -206,34 +87,16 @@ export function IconConverter(id: string, icon: IIconBase, config: IIconConfig):
206
87
  id
207
88
  };
208
89
  }
209
-
210
90
  // 图标配置Context
211
91
  const IconContext = createContext(DEFAULT_ICON_CONFIGS);
212
-
213
92
  // 图标配置Provider
214
93
  export const IconProvider = IconContext.Provider;
215
-
216
94
  // 图标Wrapper
217
- export function IconWrapper(name: string, rtl: boolean, render: IconRender): Icon {
218
-
219
- return (props: IIconProps) => {
220
-
221
- const {
222
- size,
223
- strokeWidth,
224
- strokeLinecap,
225
- strokeLinejoin,
226
- theme,
227
- fill,
228
- className,
229
- spin,
230
- ...extra
231
- } = props;
232
-
95
+ export function IconWrapper(name, rtl, render) {
96
+ return (props) => {
97
+ const { size, strokeWidth, strokeLinecap, strokeLinejoin, theme, fill, className, spin } = props, extra = __rest(props, ["size", "strokeWidth", "strokeLinecap", "strokeLinejoin", "theme", "fill", "className", "spin"]);
233
98
  const config = useContext(IconContext);
234
-
235
99
  const id = useMemo(guid, []);
236
-
237
100
  const svgProps = IconConverter(id, {
238
101
  size,
239
102
  strokeWidth,
@@ -242,27 +105,17 @@ export function IconWrapper(name: string, rtl: boolean, render: IconRender): Ico
242
105
  theme,
243
106
  fill
244
107
  }, config);
245
-
246
- const cls: string[] = ['hi-icon'];
247
-
108
+ const cls = ['hi-icon'];
248
109
  cls.push('hi-icon' + '-' + name);
249
-
250
110
  if (rtl && config.rtl) {
251
111
  cls.push('hi-icon-rtl');
252
112
  }
253
-
254
113
  if (spin) {
255
114
  cls.push('hi-icon-spin');
256
115
  }
257
-
258
116
  if (className) {
259
117
  cls.push(className);
260
118
  }
261
-
262
- return (
263
- <span {...extra} className={cls.join(' ')}>
264
- {render(svgProps)}
265
- </span>
266
- );
119
+ return (React.createElement("span", Object.assign({}, extra, { className: cls.join(' ') }), render(svgProps)));
267
120
  };
268
121
  }
package/package.json CHANGED
@@ -1,12 +1,22 @@
1
1
  {
2
2
  "name": "@test-icons/react",
3
- "version": "0.0.1",
4
- "description": "test icon library - react components",
5
- "main": "src/index.ts",
3
+ "version": "0.0.2",
4
+ "description": "Test icon library - react components",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.js",
7
+ "types": "dist/index.d.ts",
6
8
  "files": [
7
- "src"
9
+ "dist"
10
+ ],
11
+ "style": "dist/runtime/index.css",
12
+ "sideEffects": [
13
+ "*.css",
14
+ "*.less"
8
15
  ],
9
16
  "license": "MIT",
17
+ "peerDependencies": {
18
+ "react": ">=16.8.0"
19
+ },
10
20
  "publishConfig": {
11
21
  "access": "public"
12
22
  }
@@ -1,30 +0,0 @@
1
- /**
2
- * @file ACane 拐杖
3
- * @author Auto Generated by HaierIcons
4
- */
5
-
6
- /* tslint:disable: max-line-length */
7
- /* eslint-disable max-len */
8
- import React from 'react';
9
- import {ISvgIconProps, IconWrapper} from '../runtime';
10
-
11
- export default IconWrapper(
12
- 'a-cane',
13
- true,
14
- (props: ISvgIconProps) => (
15
- <svg
16
- width={props.size}
17
- height={props.size}
18
- viewBox="0 0 48 48"
19
- fill="none"
20
- >
21
- <path
22
- d="M19.5576 44.7684C19.5576 44.7684 32.468 20.4873 33.6417 18.28C34.8154 16.0726 37.4535 8.98102 30.3899 5.22524C23.3263 1.46947 19.1571 7.18063 17.7486 9.82948"
23
- stroke={props.colors[0]}
24
- strokeWidth={props.strokeWidth}
25
- strokeLinecap={props.strokeLinecap}
26
- strokeLinejoin={props.strokeLinejoin}
27
- />
28
- </svg>
29
- )
30
- );
@@ -1,45 +0,0 @@
1
- /**
2
- * @file Abdominal 腹部
3
- * @author Auto Generated by HaierIcons
4
- */
5
-
6
- /* tslint:disable: max-line-length */
7
- /* eslint-disable max-len */
8
- import React from 'react';
9
- import {ISvgIconProps, IconWrapper} from '../runtime';
10
-
11
- export default IconWrapper(
12
- 'abdominal',
13
- false,
14
- (props: ISvgIconProps) => (
15
- <svg
16
- width={props.size}
17
- height={props.size}
18
- viewBox="0 0 48 48"
19
- fill="none"
20
- >
21
- <path
22
- d="M7.89926 5C10.7371 8.01931 12.156 11.9408 12.156 16.7645C12.156 24 5.9995 29.5382 4.969 33.5C4.282 36.1412 3.95884 39.3078 3.9995 43"
23
- stroke={props.colors[0]}
24
- strokeWidth={props.strokeWidth}
25
- strokeLinecap={props.strokeLinecap}
26
- />
27
- <path
28
- d="M39.256 5C36.4182 8.01931 34.9992 11.9408 34.9992 16.7645C34.9992 24 41.1558 29.5382 42.1863 33.5C42.8733 36.1412 43.1964 39.3078 43.1558 43"
29
- stroke={props.colors[0]}
30
- strokeWidth={props.strokeWidth}
31
- strokeLinecap={props.strokeLinecap}
32
- />
33
- <path
34
- d="M6.24414 30.8369C12.7693 34.9668 18.6949 37.0317 24.0211 37.0317C29.3472 37.0317 34.9799 34.9668 40.9192 30.8369"
35
- stroke={props.colors[0]}
36
- strokeWidth={props.strokeWidth}
37
- strokeLinecap={props.strokeLinecap}
38
- />
39
- <path
40
- d="M24 31C25.3807 31 26.5 29.8807 26.5 28.5C26.5 27.1193 25.3807 26 24 26C22.6193 26 21.5 27.1193 21.5 28.5C21.5 29.8807 22.6193 31 24 31Z"
41
- fill={props.colors[0]}
42
- />
43
- </svg>
44
- )
45
- );
package/src/index.ts DELETED
@@ -1,7 +0,0 @@
1
- /**
2
- * @file index 引用出口
3
- * @author Auto Generated by HaierIcons
4
- */
5
-
6
- export {default as ACane} from './icons/ACane';
7
- export {default as Abdominal} from './icons/Abdominal';
@@ -1,36 +0,0 @@
1
- /**
2
- * @file index 样式文件
3
- * @author Auto Generated by HaierIcons
4
- */
5
-
6
- .hi-icon {
7
- display: inline-block;
8
- color: inherit;
9
- font-style: normal;
10
- line-height: 0;
11
- text-align: center;
12
- text-transform: none;
13
- vertical-align: -0.125em;
14
- text-rendering: optimizeLegibility;
15
- -webkit-font-smoothing: antialiased;
16
- -moz-osx-font-smoothing: grayscale;
17
-
18
- &-spin svg {
19
- animation: hi-icon-spin 1s infinite linear;
20
- }
21
- }
22
-
23
- @keyframes hi-icon-spin {
24
- 100% {
25
- -webkit-transform: rotate(360deg);
26
- transform: rotate(360deg)
27
- }
28
- }
29
-
30
- @-webkit-keyframes hi-icon-spin {
31
- 100% {
32
- -webkit-transform: rotate(360deg);
33
- transform: rotate(360deg)
34
- }
35
- }
36
-