@singularsystems/neo-react 0.10.50 → 0.10.51

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.
@@ -2,10 +2,22 @@ import React from "react";
2
2
  import { IconFactory } from "./IconFactory";
3
3
  import { IconStyle } from "./IIconFactory";
4
4
  interface IconDefinition {
5
- icon: string;
5
+ iconName: string;
6
6
  }
7
+ interface FontAwesomeIconComponentProps {
8
+ icon: any;
9
+ fixedWidth?: boolean;
10
+ spin?: boolean;
11
+ }
12
+ declare type FontAwesomeComponent = (props: FontAwesomeIconComponentProps) => JSX.Element;
7
13
  /** Icon factory supporting font-awesome string, as well as the font-awesome icon definition and component. */
8
14
  export declare class FontAwesomeIconFactory extends IconFactory {
15
+ private fontAwesomeComponentType;
16
+ /**
17
+ * Creates a font awesome factory, allowing the use of IconDefinition on any neo icon prop.
18
+ * @param fontAwesomeComponentType import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
19
+ */
20
+ constructor(fontAwesomeComponentType: FontAwesomeComponent);
9
21
  protected createIconComponent(iconComponent: IconDefinition | JSX.Element, iconStyle?: IconStyle): React.ReactNode;
10
22
  }
11
23
  export {};
@@ -1,19 +1,28 @@
1
- import { __assign, __decorate, __extends } from "tslib";
1
+ import { __assign, __decorate, __extends, __metadata } from "tslib";
2
2
  import React from "react";
3
- import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
4
3
  import { injectable } from "inversify";
5
4
  import { IconFactory } from "./IconFactory";
6
5
  /** Icon factory supporting font-awesome string, as well as the font-awesome icon definition and component. */
7
6
  var FontAwesomeIconFactory = /** @class */ (function (_super) {
8
7
  __extends(FontAwesomeIconFactory, _super);
9
- function FontAwesomeIconFactory() {
10
- return _super !== null && _super.apply(this, arguments) || this;
8
+ /**
9
+ * Creates a font awesome factory, allowing the use of IconDefinition on any neo icon prop.
10
+ * @param fontAwesomeComponentType import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
11
+ */
12
+ function FontAwesomeIconFactory(fontAwesomeComponentType) {
13
+ var _this = _super.call(this) || this;
14
+ _this.fontAwesomeComponentType = fontAwesomeComponentType;
15
+ return _this;
11
16
  }
12
17
  FontAwesomeIconFactory.prototype.createIconComponent = function (iconComponent, iconStyle) {
13
18
  var _a, _b, _c, _d;
14
- if (iconComponent.icon) {
19
+ if (iconComponent.iconName) {
15
20
  // Icon was specified using a font-awesome icon descriptor, return the font-awesome icon component.
16
- return React.createElement(FontAwesomeIcon, { icon: iconComponent, fixedWidth: (_a = iconStyle) === null || _a === void 0 ? void 0 : _a.fixedWidth, spin: (_b = iconStyle) === null || _b === void 0 ? void 0 : _b.spin });
21
+ return React.createElement(this.fontAwesomeComponentType, {
22
+ icon: iconComponent,
23
+ fixedWidth: (_a = iconStyle) === null || _a === void 0 ? void 0 : _a.fixedWidth,
24
+ spin: (_b = iconStyle) === null || _b === void 0 ? void 0 : _b.spin
25
+ });
17
26
  }
18
27
  else {
19
28
  // Icon was specified as a font-awesome component. Extract the props, and override using the requested style.
@@ -28,7 +37,8 @@ var FontAwesomeIconFactory = /** @class */ (function (_super) {
28
37
  }
29
38
  };
30
39
  FontAwesomeIconFactory = __decorate([
31
- injectable()
40
+ injectable(),
41
+ __metadata("design:paramtypes", [Function])
32
42
  ], FontAwesomeIconFactory);
33
43
  return FontAwesomeIconFactory;
34
44
  }(IconFactory));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@singularsystems/neo-react",
3
- "version": "0.10.50",
3
+ "version": "0.10.51",
4
4
  "description": "React application logic and components for the Neo client library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -30,7 +30,6 @@
30
30
  "tslib": "2.3.1"
31
31
  },
32
32
  "dependencies": {
33
- "@fortawesome/react-fontawesome": "0.2.0",
34
33
  "@types/rc-slider": "^8.6.5",
35
34
  "@types/react-color": "^3.0.1",
36
35
  "@types/react-select": "3.1.0",