tntd 2.7.32 → 2.8.0-beta.1

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.
Files changed (174) hide show
  1. package/es/form/form.js +2 -2
  2. package/es/form/form.js.map +1 -1
  3. package/es/icon/IconFont.js +52 -0
  4. package/es/icon/IconFont.js.map +1 -0
  5. package/es/icon/components/Icon.js +106 -0
  6. package/es/icon/components/Icon.js.map +1 -0
  7. package/es/icon/components/index.js +1 -0
  8. package/es/icon/components/index.js.map +1 -0
  9. package/es/icon/components/utils.js +79 -0
  10. package/es/icon/components/utils.js.map +1 -0
  11. package/es/icon/index.js +114 -3
  12. package/es/icon/index.js.map +1 -1
  13. package/es/icon/twoTonePrimaryColor.js +10 -0
  14. package/es/icon/twoTonePrimaryColor.js.map +1 -0
  15. package/es/icon/utils.js +64 -0
  16. package/es/icon/utils.js.map +1 -0
  17. package/lib/form/form.js +2 -2
  18. package/lib/form/form.js.map +1 -1
  19. package/lib/icon/IconFont.d.ts +10 -0
  20. package/lib/icon/IconFont.d.ts.map +1 -0
  21. package/lib/icon/IconFont.js +62 -0
  22. package/lib/icon/IconFont.js.map +1 -0
  23. package/lib/icon/components/Icon.d.ts +31 -0
  24. package/lib/icon/components/Icon.d.ts.map +1 -0
  25. package/lib/icon/components/Icon.js +149 -0
  26. package/lib/icon/components/Icon.js.map +1 -0
  27. package/lib/icon/components/index.d.ts +2 -0
  28. package/lib/icon/components/index.d.ts.map +1 -0
  29. package/lib/icon/components/index.js +13 -0
  30. package/lib/icon/components/index.js.map +1 -0
  31. package/lib/icon/components/utils.d.ts +22 -0
  32. package/lib/icon/components/utils.d.ts.map +1 -0
  33. package/lib/icon/components/utils.js +120 -0
  34. package/lib/icon/components/utils.js.map +1 -0
  35. package/lib/icon/index.d.ts +45 -3
  36. package/lib/icon/index.d.ts.map +1 -1
  37. package/lib/icon/index.js +121 -15
  38. package/lib/icon/index.js.map +1 -1
  39. package/lib/icon/twoTonePrimaryColor.d.ts +3 -0
  40. package/lib/icon/twoTonePrimaryColor.d.ts.map +1 -0
  41. package/lib/icon/twoTonePrimaryColor.js +18 -0
  42. package/lib/icon/twoTonePrimaryColor.js.map +1 -0
  43. package/lib/icon/utils.d.ts +13 -0
  44. package/lib/icon/utils.d.ts.map +1 -0
  45. package/lib/icon/utils.js +76 -0
  46. package/lib/icon/utils.js.map +1 -0
  47. package/lib/segmented/index.d.ts +1 -1
  48. package/lib/svg-components/illustration-403.d.ts +1 -1
  49. package/lib/svg-components/illustration-404.d.ts +1 -1
  50. package/lib/svg-components/illustration-500.d.ts +1 -1
  51. package/lib/svg-components/illustration-empty.d.ts +1 -1
  52. package/lib/svg-components/illustration-failure.d.ts +1 -1
  53. package/lib/svg-components/illustration-no-access.d.ts +1 -1
  54. package/lib/svg-components/illustration-no-chart.d.ts +1 -1
  55. package/lib/svg-components/illustration-no-result.d.ts +1 -1
  56. package/lib/svg-components/illustration-offline.d.ts +1 -1
  57. package/lib/svg-components/illustration-success.d.ts +1 -1
  58. package/lib/table/assets/image-loading-background.d.ts +1 -1
  59. package/lib/table/assets/image-loading.d.ts +1 -1
  60. package/package.json +106 -105
  61. package/es/tntd-form/_util/context.js +0 -12
  62. package/es/tntd-form/_util/context.js.map +0 -1
  63. package/es/tntd-form/_util/defaultRenderEmpty.js +0 -31
  64. package/es/tntd-form/_util/defaultRenderEmpty.js.map +0 -1
  65. package/es/tntd-form/_util/hooks/useFlexGapSupport.js +0 -9
  66. package/es/tntd-form/_util/hooks/useFlexGapSupport.js.map +0 -1
  67. package/es/tntd-form/_util/hooks/useForceUpdate.js +0 -5
  68. package/es/tntd-form/_util/hooks/useForceUpdate.js.map +0 -1
  69. package/es/tntd-form/_util/motion.js +0 -47
  70. package/es/tntd-form/_util/motion.js.map +0 -1
  71. package/es/tntd-form/_util/reactNode.js +0 -16
  72. package/es/tntd-form/_util/reactNode.js.map +0 -1
  73. package/es/tntd-form/_util/responsiveObserve.js +0 -59
  74. package/es/tntd-form/_util/responsiveObserve.js.map +0 -1
  75. package/es/tntd-form/_util/scrollTo.js +0 -35
  76. package/es/tntd-form/_util/scrollTo.js.map +0 -1
  77. package/es/tntd-form/_util/styleChecker.js +0 -26
  78. package/es/tntd-form/_util/styleChecker.js.map +0 -1
  79. package/es/tntd-form/_util/type.js +0 -3
  80. package/es/tntd-form/_util/type.js.map +0 -1
  81. package/es/tntd-form/_util/warning.js +0 -5
  82. package/es/tntd-form/_util/warning.js.map +0 -1
  83. package/es/tntd-form/_util/wave.js +0 -168
  84. package/es/tntd-form/_util/wave.js.map +0 -1
  85. package/es/tntd-form/grid/RowContext.js +0 -3
  86. package/es/tntd-form/grid/RowContext.js.map +0 -1
  87. package/es/tntd-form/grid/col.js +0 -104
  88. package/es/tntd-form/grid/col.js.map +0 -1
  89. package/es/tntd-form/grid/hooks/useBreakpoint.js +0 -18
  90. package/es/tntd-form/grid/hooks/useBreakpoint.js.map +0 -1
  91. package/es/tntd-form/grid/index.js +0 -14
  92. package/es/tntd-form/grid/index.js.map +0 -1
  93. package/es/tntd-form/grid/row.js +0 -153
  94. package/es/tntd-form/grid/row.js.map +0 -1
  95. package/es/tntd-form/grid/style/index.js +0 -2
  96. package/es/tntd-form/grid/style/index.js.map +0 -1
  97. package/es/tntd-form/tntd-form.stories.js +0 -836
  98. package/es/tntd-form/tntd-form.stories.js.map +0 -1
  99. package/lib/tntd-form/_util/context.d.ts +0 -42
  100. package/lib/tntd-form/_util/context.d.ts.map +0 -1
  101. package/lib/tntd-form/_util/context.js +0 -22
  102. package/lib/tntd-form/_util/context.js.map +0 -1
  103. package/lib/tntd-form/_util/defaultRenderEmpty.d.ts +0 -5
  104. package/lib/tntd-form/_util/defaultRenderEmpty.d.ts.map +0 -1
  105. package/lib/tntd-form/_util/defaultRenderEmpty.js +0 -44
  106. package/lib/tntd-form/_util/defaultRenderEmpty.js.map +0 -1
  107. package/lib/tntd-form/_util/hooks/useFlexGapSupport.d.ts +0 -3
  108. package/lib/tntd-form/_util/hooks/useFlexGapSupport.d.ts.map +0 -1
  109. package/lib/tntd-form/_util/hooks/useFlexGapSupport.js +0 -28
  110. package/lib/tntd-form/_util/hooks/useFlexGapSupport.js.map +0 -1
  111. package/lib/tntd-form/_util/hooks/useForceUpdate.d.ts +0 -3
  112. package/lib/tntd-form/_util/hooks/useForceUpdate.d.ts.map +0 -1
  113. package/lib/tntd-form/_util/hooks/useForceUpdate.js +0 -24
  114. package/lib/tntd-form/_util/hooks/useForceUpdate.js.map +0 -1
  115. package/lib/tntd-form/_util/motion.d.ts +0 -9
  116. package/lib/tntd-form/_util/motion.d.ts.map +0 -1
  117. package/lib/tntd-form/_util/motion.js +0 -59
  118. package/lib/tntd-form/_util/motion.js.map +0 -1
  119. package/lib/tntd-form/_util/reactNode.d.ts +0 -9
  120. package/lib/tntd-form/_util/reactNode.d.ts.map +0 -1
  121. package/lib/tntd-form/_util/reactNode.js +0 -27
  122. package/lib/tntd-form/_util/reactNode.js.map +0 -1
  123. package/lib/tntd-form/_util/responsiveObserve.d.ts +0 -22
  124. package/lib/tntd-form/_util/responsiveObserve.d.ts.map +0 -1
  125. package/lib/tntd-form/_util/responsiveObserve.js +0 -73
  126. package/lib/tntd-form/_util/responsiveObserve.js.map +0 -1
  127. package/lib/tntd-form/_util/scrollTo.d.ts +0 -1
  128. package/lib/tntd-form/_util/scrollTo.d.ts.map +0 -1
  129. package/lib/tntd-form/_util/scrollTo.js +0 -35
  130. package/lib/tntd-form/_util/scrollTo.js.map +0 -1
  131. package/lib/tntd-form/_util/styleChecker.d.ts +0 -5
  132. package/lib/tntd-form/_util/styleChecker.d.ts.map +0 -1
  133. package/lib/tntd-form/_util/styleChecker.js +0 -42
  134. package/lib/tntd-form/_util/styleChecker.js.map +0 -1
  135. package/lib/tntd-form/_util/type.d.ts +0 -4
  136. package/lib/tntd-form/_util/type.d.ts.map +0 -1
  137. package/lib/tntd-form/_util/type.js +0 -21
  138. package/lib/tntd-form/_util/type.js.map +0 -1
  139. package/lib/tntd-form/_util/warning.d.ts +0 -5
  140. package/lib/tntd-form/_util/warning.d.ts.map +0 -1
  141. package/lib/tntd-form/_util/warning.js +0 -20
  142. package/lib/tntd-form/_util/warning.js.map +0 -1
  143. package/lib/tntd-form/_util/wave.d.ts +0 -1
  144. package/lib/tntd-form/_util/wave.d.ts.map +0 -1
  145. package/lib/tntd-form/_util/wave.js +0 -168
  146. package/lib/tntd-form/_util/wave.js.map +0 -1
  147. package/lib/tntd-form/grid/RowContext.d.ts +0 -9
  148. package/lib/tntd-form/grid/RowContext.d.ts.map +0 -1
  149. package/lib/tntd-form/grid/RowContext.js +0 -10
  150. package/lib/tntd-form/grid/RowContext.js.map +0 -1
  151. package/lib/tntd-form/grid/col.d.ts +0 -29
  152. package/lib/tntd-form/grid/col.d.ts.map +0 -1
  153. package/lib/tntd-form/grid/col.js +0 -105
  154. package/lib/tntd-form/grid/col.js.map +0 -1
  155. package/lib/tntd-form/grid/hooks/useBreakpoint.d.ts +0 -4
  156. package/lib/tntd-form/grid/hooks/useBreakpoint.d.ts.map +0 -1
  157. package/lib/tntd-form/grid/hooks/useBreakpoint.js +0 -29
  158. package/lib/tntd-form/grid/hooks/useBreakpoint.js.map +0 -1
  159. package/lib/tntd-form/grid/index.d.ts +0 -12
  160. package/lib/tntd-form/grid/index.d.ts.map +0 -1
  161. package/lib/tntd-form/grid/index.js +0 -31
  162. package/lib/tntd-form/grid/index.js.map +0 -1
  163. package/lib/tntd-form/grid/row.d.ts +0 -21
  164. package/lib/tntd-form/grid/row.d.ts.map +0 -1
  165. package/lib/tntd-form/grid/row.js +0 -186
  166. package/lib/tntd-form/grid/row.js.map +0 -1
  167. package/lib/tntd-form/grid/style/index.d.ts +0 -3
  168. package/lib/tntd-form/grid/style/index.d.ts.map +0 -1
  169. package/lib/tntd-form/grid/style/index.js +0 -4
  170. package/lib/tntd-form/grid/style/index.js.map +0 -1
  171. package/lib/tntd-form/tntd-form.stories.d.ts +0 -33
  172. package/lib/tntd-form/tntd-form.stories.d.ts.map +0 -1
  173. package/lib/tntd-form/tntd-form.stories.js +0 -943
  174. package/lib/tntd-form/tntd-form.stories.js.map +0 -1
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports["default"] = create;
8
+ var React = _interopRequireWildcard(require("react"));
9
+ var _index = _interopRequireDefault(require("./index"));
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
12
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
13
+ var __rest = void 0 && (void 0).__rest || function (s, e) {
14
+ var t = {};
15
+ for (var p in s) {
16
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
17
+ }
18
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ var customCache = new Set();
24
+ function create() {
25
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
26
+ var scriptUrl = options.scriptUrl,
27
+ _options$extraCommonP = options.extraCommonProps,
28
+ extraCommonProps = _options$extraCommonP === void 0 ? {} : _options$extraCommonP;
29
+ /**
30
+ * DOM API required.
31
+ * Make sure in browser environment.
32
+ * The Custom Icon will create a <script/>
33
+ * that loads SVG symbols and insert the SVG Element into the document body.
34
+ */
35
+ if (typeof document !== 'undefined' && typeof window !== 'undefined' && typeof document.createElement === 'function' && typeof scriptUrl === 'string' && scriptUrl.length && !customCache.has(scriptUrl)) {
36
+ var script = document.createElement('script');
37
+ script.setAttribute('src', scriptUrl);
38
+ script.setAttribute('data-namespace', scriptUrl);
39
+ customCache.add(scriptUrl);
40
+ document.body.appendChild(script);
41
+ }
42
+ var Iconfont = function Iconfont(props) {
43
+ var type = props.type,
44
+ children = props.children,
45
+ restProps = __rest(props
46
+ // component > children > type
47
+ , ["type", "children"]);
48
+ // component > children > type
49
+ var content = null;
50
+ if (props.type) {
51
+ content = React.createElement("use", {
52
+ xlinkHref: "#".concat(type)
53
+ });
54
+ }
55
+ if (children) {
56
+ content = children;
57
+ }
58
+ return React.createElement(_index["default"], Object.assign({}, extraCommonProps, restProps), content);
59
+ };
60
+ Iconfont.displayName = 'Iconfont';
61
+ return Iconfont;
62
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IconFont.js","sourceRoot":"","sources":["../../src/icon/IconFont.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA8B;AAC9B,oDAAyC;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,GAAG,UAAU,CAAA;IAEjC,OAAO,QAAQ,CAAA;AACjB,CAAC;AA7CD,yBA6CC","sourcesContent":["import * as React from 'react'\nimport Icon, { IconProps } from './index'\n\nconst customCache = new Set<string>()\n\nexport interface CustomIconOptions {\n scriptUrl?: string\n extraCommonProps?: { [key: string]: any }\n}\n\nexport default function create(options: CustomIconOptions = {}): React.SFC<IconProps> {\n const { scriptUrl, extraCommonProps = {} } = options\n\n /**\n * DOM API required.\n * Make sure in browser environment.\n * The Custom Icon will create a <script/>\n * that loads SVG symbols and insert the SVG Element into the document body.\n */\n if (\n typeof document !== 'undefined' &&\n typeof window !== 'undefined' &&\n typeof document.createElement === 'function' &&\n typeof scriptUrl === 'string' &&\n scriptUrl.length &&\n !customCache.has(scriptUrl)\n ) {\n const script = document.createElement('script')\n script.setAttribute('src', scriptUrl)\n script.setAttribute('data-namespace', scriptUrl)\n customCache.add(scriptUrl)\n document.body.appendChild(script)\n }\n\n const Iconfont: React.SFC<IconProps> = (props) => {\n const { type, children, ...restProps } = props\n\n // component > children > type\n let content = null\n if (props.type) {\n content = <use xlinkHref={`#${type}`} />\n }\n if (children) {\n content = children\n }\n return (\n <Icon {...extraCommonProps} {...restProps}>\n {content}\n </Icon>\n )\n }\n\n Iconfont.displayName = 'Iconfont'\n\n return Iconfont\n}\n"]}
@@ -0,0 +1,31 @@
1
+ import type { IconDefinition } from '@tntd/icons/lib/types';
2
+ import * as React from 'react';
3
+ import { MiniMap } from './utils';
4
+ export interface IconProps {
5
+ type: string | IconDefinition;
6
+ className?: string;
7
+ onClick?: React.MouseEventHandler<SVGSVGElement>;
8
+ style?: React.CSSProperties;
9
+ primaryColor?: string;
10
+ secondaryColor?: string;
11
+ focusable?: string;
12
+ }
13
+ export interface TwoToneColorPaletteSetter {
14
+ primaryColor: string;
15
+ secondaryColor?: string;
16
+ }
17
+ export interface TwoToneColorPalette extends TwoToneColorPaletteSetter {
18
+ secondaryColor: string;
19
+ }
20
+ declare class Icon extends React.Component<IconProps> {
21
+ static displayName: string;
22
+ static definitions: MiniMap<IconDefinition>;
23
+ static add(...icons: IconDefinition[]): void;
24
+ static clear(): void;
25
+ static get(key?: string, colors?: TwoToneColorPalette): IconDefinition | undefined;
26
+ static setTwoToneColors({ primaryColor, secondaryColor }: TwoToneColorPaletteSetter): void;
27
+ static getTwoToneColors(): TwoToneColorPalette;
28
+ render(): any;
29
+ }
30
+ export default Icon;
31
+ //# sourceMappingURL=Icon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../../src/icon/components/Icon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACzE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAsD,OAAO,EAAc,MAAM,SAAS,CAAA;AAEjG,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,GAAG,cAAc,CAAA;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,aAAa,CAAC,CAAA;IAChD,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,yBAAyB;IACxC,YAAY,EAAE,MAAM,CAAA;IACpB,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB;AAED,MAAM,WAAW,mBAAoB,SAAQ,yBAAyB;IACpE,cAAc,EAAE,MAAM,CAAA;CACvB;AAOD,cAAM,IAAK,SAAQ,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC;IAC3C,MAAM,CAAC,WAAW,SAAc;IAChC,MAAM,CAAC,WAAW,0BAAgC;IAClD,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,EAAE,cAAc,EAAE;IAKrC,MAAM,CAAC,KAAK;IAIZ,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,MAAM,GAAE,mBAAyC;IAa1E,MAAM,CAAC,gBAAgB,CAAC,EAAE,YAAY,EAAE,cAAc,EAAE,EAAE,yBAAyB;IAKnF,MAAM,CAAC,gBAAgB,IAAI,mBAAmB;IAM9C,MAAM;CA0CP;AAED,eAAe,IAAI,CAAA"}
@@ -0,0 +1,149 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports["default"] = void 0;
8
+ var React = _interopRequireWildcard(require("react"));
9
+ var _utils = require("./utils");
10
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
11
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
12
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
13
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
14
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
15
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
16
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
17
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
18
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
19
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
20
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
21
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
22
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
23
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
24
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
25
+ var __rest = void 0 && (void 0).__rest || function (s, e) {
26
+ var t = {};
27
+ for (var p in s) {
28
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
29
+ }
30
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
31
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
32
+ }
33
+ return t;
34
+ };
35
+ var twoToneColorPalette = {
36
+ primaryColor: '#333',
37
+ secondaryColor: '#E6E6E6'
38
+ };
39
+ var Icon = /*#__PURE__*/function (_React$Component) {
40
+ _inherits(Icon, _React$Component);
41
+ var _super = _createSuper(Icon);
42
+ function Icon() {
43
+ _classCallCheck(this, Icon);
44
+ return _super.apply(this, arguments);
45
+ }
46
+ _createClass(Icon, [{
47
+ key: "render",
48
+ value: function render() {
49
+ var _Object$assign;
50
+ var _a = this.props,
51
+ type = _a.type,
52
+ className = _a.className,
53
+ onClick = _a.onClick,
54
+ style = _a.style,
55
+ primaryColor = _a.primaryColor,
56
+ secondaryColor = _a.secondaryColor,
57
+ rest = __rest(_a, ["type", "className", "onClick", "style", "primaryColor", "secondaryColor"]);
58
+ var target;
59
+ var colors = twoToneColorPalette;
60
+ if (primaryColor) {
61
+ colors = {
62
+ primaryColor: primaryColor,
63
+ secondaryColor: secondaryColor || (0, _utils.getSecondaryColor)(primaryColor)
64
+ };
65
+ }
66
+ if ((0, _utils.isIconDefinition)(type)) {
67
+ target = type;
68
+ } else if (typeof type === 'string') {
69
+ target = Icon.get(type, colors);
70
+ if (!target) {
71
+ // log(`Could not find icon: ${type}`);
72
+ return null;
73
+ }
74
+ }
75
+ if (!target) {
76
+ (0, _utils.log)("type should be string or icon definiton, but got ".concat(type));
77
+ return null;
78
+ }
79
+ if (target && typeof target.icon === 'function') {
80
+ target = Object.assign(Object.assign({}, target), {
81
+ icon: target.icon(colors.primaryColor, colors.secondaryColor)
82
+ });
83
+ }
84
+ return (0, _utils.generate)(target.icon, "svg-".concat(target.name), Object.assign((_Object$assign = {
85
+ className: className,
86
+ onClick: onClick,
87
+ style: style
88
+ }, _defineProperty(_Object$assign, 'data-icon', target.name), _defineProperty(_Object$assign, "width", '1em'), _defineProperty(_Object$assign, "height", '1em'), _defineProperty(_Object$assign, "fill", 'currentColor'), _defineProperty(_Object$assign, 'aria-hidden', 'true'), _Object$assign), rest));
89
+ }
90
+ }], [{
91
+ key: "add",
92
+ value: function add() {
93
+ var _this = this;
94
+ for (var _len = arguments.length, icons = new Array(_len), _key = 0; _key < _len; _key++) {
95
+ icons[_key] = arguments[_key];
96
+ }
97
+ icons.forEach(function (icon) {
98
+ _this.definitions.set((0, _utils.withSuffix)(icon.name, icon.theme), icon);
99
+ });
100
+ }
101
+ }, {
102
+ key: "clear",
103
+ value: function clear() {
104
+ this.definitions.clear();
105
+ }
106
+ }, {
107
+ key: "get",
108
+ value: function get(key) {
109
+ var colors = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : twoToneColorPalette;
110
+ if (key) {
111
+ var target = this.definitions.get(key);
112
+ if (target && typeof target.icon === 'function') {
113
+ target = Object.assign(Object.assign({}, target), {
114
+ icon: target.icon(colors.primaryColor, colors.secondaryColor)
115
+ });
116
+ }
117
+ return target;
118
+ }
119
+ }
120
+ }, {
121
+ key: "setTwoToneColors",
122
+ value: function setTwoToneColors(_ref) {
123
+ var primaryColor = _ref.primaryColor,
124
+ secondaryColor = _ref.secondaryColor;
125
+ twoToneColorPalette.primaryColor = primaryColor;
126
+ twoToneColorPalette.secondaryColor = secondaryColor || (0, _utils.getSecondaryColor)(primaryColor);
127
+ }
128
+ }, {
129
+ key: "getTwoToneColors",
130
+ value: function getTwoToneColors() {
131
+ return Object.assign({}, twoToneColorPalette);
132
+ }
133
+ }]);
134
+ return Icon;
135
+ }(React.Component);
136
+ Object.defineProperty(Icon, "displayName", {
137
+ enumerable: true,
138
+ configurable: true,
139
+ writable: true,
140
+ value: 'IconReact'
141
+ });
142
+ Object.defineProperty(Icon, "definitions", {
143
+ enumerable: true,
144
+ configurable: true,
145
+ writable: true,
146
+ value: new _utils.MiniMap()
147
+ });
148
+ var _default = Icon;
149
+ exports["default"] = _default;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Icon.js","sourceRoot":"","sources":["../../../src/icon/components/Icon.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,6CAA8B;AAC9B,mCAAiG;AAqBjG,MAAM,mBAAmB,GAAwB;IAC/C,YAAY,EAAE,MAAM;IACpB,cAAc,EAAE,SAAS;CAC1B,CAAA;AAED,MAAM,IAAK,SAAQ,KAAK,CAAC,SAAoB;IAG3C,MAAM,CAAC,GAAG,CAAC,GAAG,KAAuB;QACnC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YACrB,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAA,kBAAU,EAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,EAA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1B,MAAM,GAAG,IAAI,CAAA;SACd;aAAM,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;YACnC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;YAC/B,IAAI,CAAC,MAAM,EAAE;gBACX,uCAAuC;gBACvC,OAAO,IAAI,CAAA;aACZ;SACF;QACD,IAAI,CAAC,MAAM,EAAE;YACX,IAAA,WAAG,EAAC,oDAAoD,IAAI,EAAE,CAAC,CAAA;YAC/D,OAAO,IAAI,CAAA;SACZ;QACD,IAAI,MAAM,IAAI,OAAO,MAAM,CAAC,IAAI,KAAK,UAAU,EAAE;YAC/C,MAAM,mCACD,MAAM,KACT,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,cAAc,CAAC,GAC9D,CAAA;SACF;QACD,OAAO,IAAA,gBAAQ,EAAC,MAAM,CAAC,IAAoB,EAAE,OAAO,MAAM,CAAC,IAAI,EAAE,kBAC/D,SAAS;YACT,OAAO;YACP,KAAK,EACL,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC,IAAI,EAC1B,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,KAAK,EACb,IAAI,EAAE,cAAc,EACpB,CAAC,aAAa,CAAC,EAAE,MAAM,IACpB,IAAI,EACP,CAAA;IACJ,CAAC;;AA5EM;;;;WAAc,WAAW;GAAA;AAChC;;;;WAAqB,IAAI,eAAO,EAAkB;GAAA;AA8EpD,kBAAe,IAAI,CAAA","sourcesContent":["import type { AbstractNode, IconDefinition } from '@tntd/icons/lib/types'\nimport * as React from 'react'\nimport { generate, getSecondaryColor, isIconDefinition, log, MiniMap, withSuffix } from './utils'\n\nexport interface IconProps {\n type: string | IconDefinition\n className?: string\n onClick?: React.MouseEventHandler<SVGSVGElement>\n style?: React.CSSProperties\n primaryColor?: string // only for two-tone\n secondaryColor?: string // only for two-tone\n focusable?: string\n}\n\nexport interface TwoToneColorPaletteSetter {\n primaryColor: string\n secondaryColor?: string\n}\n\nexport interface TwoToneColorPalette extends TwoToneColorPaletteSetter {\n secondaryColor: string\n}\n\nconst twoToneColorPalette: TwoToneColorPalette = {\n primaryColor: '#333',\n secondaryColor: '#E6E6E6',\n}\n\nclass Icon extends React.Component<IconProps> {\n static displayName = 'IconReact'\n static definitions = new MiniMap<IconDefinition>()\n static add(...icons: IconDefinition[]) {\n icons.forEach((icon) => {\n this.definitions.set(withSuffix(icon.name, icon.theme), icon)\n })\n }\n static clear() {\n this.definitions.clear()\n }\n\n static get(key?: string, colors: TwoToneColorPalette = twoToneColorPalette) {\n if (key) {\n let target = this.definitions.get(key)\n if (target && typeof target.icon === 'function') {\n target = {\n ...target,\n icon: target.icon(colors.primaryColor, colors.secondaryColor),\n }\n }\n return target\n }\n }\n\n static setTwoToneColors({ primaryColor, secondaryColor }: TwoToneColorPaletteSetter) {\n twoToneColorPalette.primaryColor = primaryColor\n twoToneColorPalette.secondaryColor = secondaryColor || getSecondaryColor(primaryColor)\n }\n\n static getTwoToneColors(): TwoToneColorPalette {\n return {\n ...twoToneColorPalette,\n }\n }\n\n render() {\n const { type, className, onClick, style, primaryColor, secondaryColor, ...rest } = this.props\n\n let target: IconDefinition | undefined\n let colors: TwoToneColorPalette = twoToneColorPalette\n if (primaryColor) {\n colors = {\n primaryColor,\n secondaryColor: secondaryColor || getSecondaryColor(primaryColor),\n }\n }\n if (isIconDefinition(type)) {\n target = type\n } else if (typeof type === 'string') {\n target = Icon.get(type, colors)\n if (!target) {\n // log(`Could not find icon: ${type}`);\n return null\n }\n }\n if (!target) {\n log(`type should be string or icon definiton, but got ${type}`)\n return null\n }\n if (target && typeof target.icon === 'function') {\n target = {\n ...target,\n icon: target.icon(colors.primaryColor, colors.secondaryColor),\n }\n }\n return generate(target.icon as AbstractNode, `svg-${target.name}`, {\n className,\n onClick,\n style,\n ['data-icon']: target.name,\n width: '1em',\n height: '1em',\n fill: 'currentColor',\n ['aria-hidden']: 'true',\n ...rest,\n })\n }\n}\n\nexport default Icon\n"]}
@@ -0,0 +1,2 @@
1
+ export { default, IconProps, TwoToneColorPaletteSetter, TwoToneColorPalette } from './Icon';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/icon/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAA"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "default", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _Icon["default"];
10
+ }
11
+ });
12
+ var _Icon = _interopRequireDefault(require("./Icon"));
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/icon/components/index.ts"],"names":[],"mappings":";;;;;;AAAA,+BAA2F;AAAlF,gHAAA,OAAO,OAAA","sourcesContent":["export { default, IconProps, TwoToneColorPaletteSetter, TwoToneColorPalette } from './Icon'\n"]}
@@ -0,0 +1,22 @@
1
+ import type { AbstractNode, IconDefinition } from '@tntd/icons/lib/types';
2
+ export declare function log(message: string): void;
3
+ export declare function isIconDefinition(target: any): target is IconDefinition;
4
+ export declare function normalizeAttrs(attrs?: Attrs): Attrs;
5
+ export interface Attrs {
6
+ [key: string]: string;
7
+ }
8
+ export declare class MiniMap<V> {
9
+ get size(): number;
10
+ private collection;
11
+ clear(): void;
12
+ delete(key: string): boolean;
13
+ get(key: string): V | undefined;
14
+ has(key: string): boolean;
15
+ set(key: string, value: V): this;
16
+ }
17
+ export declare function generate(node: AbstractNode, key: string, rootProps?: {
18
+ [key: string]: any;
19
+ } | false): any;
20
+ export declare function getSecondaryColor(primaryColor: string): string;
21
+ export declare function withSuffix(name: string, theme: 'fill' | 'outline' | 'twotone'): string;
22
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/icon/components/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAIzE,wBAAgB,GAAG,CAAC,OAAO,EAAE,MAAM,QAIlC;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,GAAG,GAAG,MAAM,IAAI,cAAc,CAOtE;AAED,wBAAgB,cAAc,CAAC,KAAK,GAAE,KAAU,GAAG,KAAK,CAavD;AAED,MAAM,WAAW,KAAK;IACpB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CACtB;AAED,qBAAa,OAAO,CAAC,CAAC;IACpB,IAAI,IAAI,WAEP;IACD,OAAO,CAAC,UAAU,CAA2B;IAC7C,KAAK,IAAI,IAAI;IAGb,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAG5B,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAG/B,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAGzB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI;CAIjC;AAED,wBAAgB,QAAQ,CACtB,IAAI,EAAE,YAAY,EAClB,GAAG,EAAE,MAAM,EACX,SAAS,CAAC,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,GAAG,KAAK,GACzC,GAAG,CAqBL;AAED,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAG9D;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,UAW7E"}
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.MiniMap = void 0;
7
+ exports.generate = generate;
8
+ exports.getSecondaryColor = getSecondaryColor;
9
+ exports.isIconDefinition = isIconDefinition;
10
+ exports.log = log;
11
+ exports.normalizeAttrs = normalizeAttrs;
12
+ exports.withSuffix = withSuffix;
13
+ var _colors = require("@ant-design/colors");
14
+ var React = _interopRequireWildcard(require("react"));
15
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
16
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
18
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
19
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
20
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
21
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
22
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
23
+ function log(message) {
24
+ if (!(process && process.env && process.env.NODE_ENV === 'production')) {
25
+ console.error("[@ant-design/icons-react]: ".concat(message, "."));
26
+ }
27
+ }
28
+ function isIconDefinition(target) {
29
+ return _typeof(target) === 'object' && typeof target.name === 'string' && typeof target.theme === 'string' && (_typeof(target.icon) === 'object' || typeof target.icon === 'function');
30
+ }
31
+ function normalizeAttrs() {
32
+ var attrs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
33
+ return Object.keys(attrs).reduce(function (acc, key) {
34
+ var val = attrs[key];
35
+ switch (key) {
36
+ case 'class':
37
+ acc.className = val;
38
+ delete acc["class"];
39
+ break;
40
+ default:
41
+ acc[key] = val;
42
+ }
43
+ return acc;
44
+ }, {});
45
+ }
46
+ var MiniMap = /*#__PURE__*/function () {
47
+ function MiniMap() {
48
+ _classCallCheck(this, MiniMap);
49
+ Object.defineProperty(this, "collection", {
50
+ enumerable: true,
51
+ configurable: true,
52
+ writable: true,
53
+ value: {}
54
+ });
55
+ }
56
+ _createClass(MiniMap, [{
57
+ key: "size",
58
+ get: function get() {
59
+ return Object.keys(this.collection).length;
60
+ }
61
+ }, {
62
+ key: "clear",
63
+ value: function clear() {
64
+ this.collection = {};
65
+ }
66
+ }, {
67
+ key: "delete",
68
+ value: function _delete(key) {
69
+ return delete this.collection[key];
70
+ }
71
+ }, {
72
+ key: "get",
73
+ value: function get(key) {
74
+ return this.collection[key];
75
+ }
76
+ }, {
77
+ key: "has",
78
+ value: function has(key) {
79
+ return Boolean(this.collection[key]);
80
+ }
81
+ }, {
82
+ key: "set",
83
+ value: function set(key, value) {
84
+ this.collection[key] = value;
85
+ return this;
86
+ }
87
+ }]);
88
+ return MiniMap;
89
+ }();
90
+ exports.MiniMap = MiniMap;
91
+ function generate(node, key, rootProps) {
92
+ if (!rootProps) {
93
+ return React.createElement(node.tag, Object.assign({
94
+ key: key
95
+ }, normalizeAttrs(node.attrs)), (node.children || []).map(function (child, index) {
96
+ return generate(child, "".concat(key, "-").concat(node.tag, "-").concat(index));
97
+ }));
98
+ }
99
+ return React.createElement(node.tag, Object.assign(Object.assign({
100
+ key: key
101
+ }, normalizeAttrs(node.attrs)), rootProps), (node.children || []).map(function (child, index) {
102
+ return generate(child, "".concat(key, "-").concat(node.tag, "-").concat(index));
103
+ }));
104
+ }
105
+ function getSecondaryColor(primaryColor) {
106
+ // choose the second color
107
+ return (0, _colors.generate)(primaryColor)[0];
108
+ }
109
+ function withSuffix(name, theme) {
110
+ switch (theme) {
111
+ case 'fill':
112
+ return "".concat(name, "-fill");
113
+ case 'outline':
114
+ return "".concat(name, "-o");
115
+ case 'twotone':
116
+ return "".concat(name, "-twotone");
117
+ default:
118
+ throw new TypeError("Unknown theme type: ".concat(theme, ", name: ").concat(name));
119
+ }
120
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/icon/components/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,+CAA8D;AAC9D,6CAA8B;AAE9B,SAAgB,GAAG,CAAC,OAAe;IACjC,IAAI,CAAC,CAAC,OAAO,IAAI,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,QAA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C,CAAC;AAHD,8CAGC;AAED,SAAgB,UAAU,CAAC,IAAY,EAAE,KAAqC;IAC5E,QAAQ,KAAK,EAAE;QACb,KAAK,MAAM;YACT,OAAO,GAAG,IAAI,OAAO,CAAA;QACvB,KAAK,SAAS;YACZ,OAAO,GAAG,IAAI,IAAI,CAAA;QACpB,KAAK,SAAS;YACZ,OAAO,GAAG,IAAI,UAAU,CAAA;QAC1B;YACE,MAAM,IAAI,SAAS,CAAC,uBAAuB,KAAK,WAAW,IAAI,EAAE,CAAC,CAAA;KACrE;AACH,CAAC;AAXD,gCAWC","sourcesContent":["// @ts-nocheck\nimport type { AbstractNode, IconDefinition } from '@tntd/icons/lib/types'\nimport { generate as generateColor } from '@ant-design/colors'\nimport * as React from 'react'\n\nexport function log(message: string) {\n if (!(process && process.env && process.env.NODE_ENV === 'production')) {\n console.error(`[@ant-design/icons-react]: ${message}.`)\n }\n}\n\nexport function isIconDefinition(target: any): target is IconDefinition {\n return (\n typeof target === 'object' &&\n typeof target.name === 'string' &&\n typeof target.theme === 'string' &&\n (typeof target.icon === 'object' || typeof target.icon === 'function')\n )\n}\n\nexport function normalizeAttrs(attrs: Attrs = {}): Attrs {\n return Object.keys(attrs).reduce((acc: Attrs, key) => {\n const val = attrs[key]\n switch (key) {\n case 'class':\n acc.className = val\n delete acc.class\n break\n default:\n acc[key] = val\n }\n return acc\n }, {})\n}\n\nexport interface Attrs {\n [key: string]: string\n}\n\nexport class MiniMap<V> {\n get size() {\n return Object.keys(this.collection).length\n }\n private collection: { [key: string]: V } = {}\n clear(): void {\n this.collection = {}\n }\n delete(key: string): boolean {\n return delete this.collection[key]\n }\n get(key: string): V | undefined {\n return this.collection[key]\n }\n has(key: string): boolean {\n return Boolean(this.collection[key])\n }\n set(key: string, value: V): this {\n this.collection[key] = value\n return this\n }\n}\n\nexport function generate(\n node: AbstractNode,\n key: string,\n rootProps?: { [key: string]: any } | false\n): any {\n if (!rootProps) {\n return React.createElement(\n node.tag,\n { key, ...normalizeAttrs(node.attrs) },\n (node.children || []).map((child: any, index: any) =>\n generate(child, `${key}-${node.tag}-${index}`)\n )\n )\n }\n return React.createElement(\n node.tag,\n {\n key,\n ...normalizeAttrs(node.attrs),\n ...rootProps,\n },\n (node.children || []).map((child: any, index: number) =>\n generate(child, `${key}-${node.tag}-${index}`)\n )\n )\n}\n\nexport function getSecondaryColor(primaryColor: string): string {\n // choose the second color\n return generateColor(primaryColor)[0]\n}\n\nexport function withSuffix(name: string, theme: 'fill' | 'outline' | 'twotone') {\n switch (theme) {\n case 'fill':\n return `${name}-fill`\n case 'outline':\n return `${name}-o`\n case 'twotone':\n return `${name}-twotone`\n default:\n throw new TypeError(`Unknown theme type: ${theme}, name: ${name}`)\n }\n}\n"]}
@@ -1,5 +1,47 @@
1
- import Icon from 'antd/lib/icon';
2
- import 'antd/lib/icon/style';
3
- export * from 'antd/lib/icon';
1
+ import * as React from 'react';
2
+ import createFromIconfontCN from './IconFont';
3
+ import { getTwoToneColor, setTwoToneColor } from './twoTonePrimaryColor';
4
+ declare function unstable_ChangeThemeOfIconsDangerously(theme?: ThemeType): void;
5
+ declare function unstable_ChangeDefaultThemeOfIcons(theme: ThemeType): void;
6
+ export interface TransferLocale {
7
+ icon: string;
8
+ }
9
+ export interface CustomIconComponentProps {
10
+ width: string | number;
11
+ height: string | number;
12
+ fill: string;
13
+ viewBox?: string;
14
+ className?: string;
15
+ style?: React.CSSProperties;
16
+ spin?: boolean;
17
+ rotate?: number;
18
+ ['aria-hidden']?: React.AriaAttributes['aria-hidden'];
19
+ }
20
+ export declare type ThemeType = 'filled' | 'outlined' | 'twoTone';
21
+ export interface IconProps {
22
+ tabIndex?: number;
23
+ type?: string;
24
+ className?: string;
25
+ theme?: ThemeType;
26
+ title?: string;
27
+ onKeyUp?: React.KeyboardEventHandler<HTMLElement>;
28
+ onClick?: React.MouseEventHandler<HTMLElement>;
29
+ component?: React.ComponentType<CustomIconComponentProps | React.SVGProps<SVGSVGElement>>;
30
+ twoToneColor?: string;
31
+ viewBox?: string;
32
+ spin?: boolean;
33
+ rotate?: number;
34
+ style?: React.CSSProperties;
35
+ prefixCls?: string;
36
+ role?: string;
37
+ }
38
+ export interface IconComponent<P> extends React.SFC<P> {
39
+ createFromIconfontCN: typeof createFromIconfontCN;
40
+ getTwoToneColor: typeof getTwoToneColor;
41
+ setTwoToneColor: typeof setTwoToneColor;
42
+ unstable_ChangeThemeOfIconsDangerously?: typeof unstable_ChangeThemeOfIconsDangerously;
43
+ unstable_ChangeDefaultThemeOfIcons?: typeof unstable_ChangeDefaultThemeOfIcons;
44
+ }
45
+ declare const Icon: IconComponent<IconProps>;
4
46
  export default Icon;
5
47
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/icon/index.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,cAAc,CAAA;AAE/B,OAAO,oBAAoB,CAAA;AAE3B,cAAc,cAAc,CAAA;AAE5B,eAAe,IAAI,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/icon/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,OAAO,oBAAoB,MAAM,YAAY,CAAA;AAU7C,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAQxE,iBAAS,sCAAsC,CAAC,KAAK,CAAC,EAAE,SAAS,QAQhE;AAED,iBAAS,kCAAkC,CAAC,KAAK,EAAE,SAAS,QAQ3D;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;IACtB,MAAM,EAAE,MAAM,GAAG,MAAM,CAAA;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAA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