@impulse-ui-native/icon 1.0.2 → 1.0.4

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.
package/dist/index.cjs.js CHANGED
@@ -25,26 +25,22 @@ __export(index_exports, {
25
25
  module.exports = __toCommonJS(index_exports);
26
26
 
27
27
  // src/components/icon.tsx
28
- var import_react_native_fontawesome = require("@fortawesome/react-native-fontawesome");
29
- var import_theme = require("@impulse-ui-native/theme");
30
28
  var import_react = require("react");
31
29
  var Icon = (0, import_react.memo)(function Icon2({
32
30
  size = "medium",
33
31
  icon,
34
- children,
35
- style,
36
32
  ...props
37
33
  }) {
38
- const theme = (0, import_theme.useTheme)();
34
+ const Icon3 = icon;
39
35
  const iconSize = (0, import_react.useMemo)(
40
36
  () => ({
41
37
  small: 14,
42
38
  medium: 16,
43
39
  large: 16
44
40
  })[size],
45
- [theme, size]
46
- );
47
- return /* @__PURE__ */ React.createElement(import_react_native_fontawesome.FontAwesomeIcon, { size: iconSize, icon, style, ...props });
41
+ [size]
42
+ ) ?? 16;
43
+ return /* @__PURE__ */ React.createElement(Icon3, { ...props, width: iconSize, height: iconSize, fill: props.color });
48
44
  });
49
45
  // Annotate the CommonJS export names for ESM import in node:
50
46
  0 && (module.exports = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/components/icon.tsx"],"sourcesContent":["export * from \"./components\";\r\nexport * from \"./types\";\r\n","import { FontAwesomeIcon } from \"@fortawesome/react-native-fontawesome\";\r\nimport { useTheme } from \"@impulse-ui-native/theme\";\r\nimport { memo, PropsWithChildren, useMemo } from \"react\";\r\nimport { IconProps } from \"../types\";\r\n\r\nexport const Icon = memo(function Icon({\r\n size = \"medium\",\r\n icon,\r\n children,\r\n style,\r\n ...props\r\n}: PropsWithChildren<IconProps>) {\r\n const theme = useTheme();\r\n const iconSize = useMemo(\r\n () =>\r\n ({\r\n small: 14,\r\n medium: 16,\r\n large: 16,\r\n }[size]),\r\n [theme, size]\r\n );\r\n\r\n return (\r\n <FontAwesomeIcon size={iconSize} icon={icon} style={style} {...props} />\r\n );\r\n});\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,sCAAgC;AAChC,mBAAyB;AACzB,mBAAiD;AAG1C,IAAM,WAAO,mBAAK,SAASA,MAAK;AAAA,EACrC,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAiC;AAC/B,QAAM,YAAQ,uBAAS;AACvB,QAAM,eAAW;AAAA,IACf,OACG;AAAA,MACC,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,OAAO;AAAA,IACT,GAAE,IAAI;AAAA,IACR,CAAC,OAAO,IAAI;AAAA,EACd;AAEA,SACE,oCAAC,mDAAgB,MAAM,UAAU,MAAY,OAAe,GAAG,OAAO;AAE1E,CAAC;","names":["Icon"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/components/icon.tsx"],"sourcesContent":["export * from \"./components\";\r\nexport * from \"./types\";\r\n","import { memo, useMemo } from \"react\";\r\nimport { IconProps } from \"../types\";\r\n\r\nexport const Icon = memo(function Icon({\r\n size = \"medium\",\r\n icon,\r\n ...props\r\n}: IconProps) {\r\n const Icon = icon;\r\n\r\n const iconSize =\r\n useMemo(\r\n () =>\r\n ({\r\n small: 14,\r\n medium: 16,\r\n large: 16,\r\n }[size]),\r\n [size]\r\n ) ?? 16;\r\n\r\n return (\r\n <Icon {...props} width={iconSize} height={iconSize} fill={props.color} />\r\n );\r\n});\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAA8B;AAGvB,IAAM,WAAO,mBAAK,SAASA,MAAK;AAAA,EACrC,OAAO;AAAA,EACP;AAAA,EACA,GAAG;AACL,GAAc;AACZ,QAAMA,QAAO;AAEb,QAAM,eACJ;AAAA,IACE,OACG;AAAA,MACC,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,OAAO;AAAA,IACT,GAAE,IAAI;AAAA,IACR,CAAC,IAAI;AAAA,EACP,KAAK;AAEP,SACE,oCAACA,OAAA,EAAM,GAAG,OAAO,OAAO,UAAU,QAAQ,UAAU,MAAM,MAAM,OAAO;AAE3E,CAAC;","names":["Icon"]}
package/dist/index.d.mts CHANGED
@@ -1,16 +1,16 @@
1
1
  import * as react from 'react';
2
- import { PropsWithChildren } from 'react';
3
- import { Props } from '@fortawesome/react-native-fontawesome';
2
+ import { ComponentType } from 'react';
4
3
  import { ComponentSize } from '@impulse-ui-native/theme';
5
- import { ViewStyle } from 'react-native';
4
+ import { SvgProps } from 'react-native-svg';
6
5
 
7
- interface IconStyle extends ViewStyle {
8
- color?: string;
9
- }
10
- interface IconProps extends Omit<Props, "size"> {
6
+ type IconStyle = SvgProps["style"];
7
+ interface IconProps {
11
8
  size?: ComponentSize | number;
9
+ color?: string;
10
+ icon: ComponentType<SvgProps>;
11
+ style?: IconStyle;
12
12
  }
13
13
 
14
- declare const Icon: react.NamedExoticComponent<PropsWithChildren<IconProps>>;
14
+ declare const Icon: react.NamedExoticComponent<IconProps>;
15
15
 
16
16
  export { Icon, type IconProps, type IconStyle };
package/dist/index.d.ts CHANGED
@@ -1,16 +1,16 @@
1
1
  import * as react from 'react';
2
- import { PropsWithChildren } from 'react';
3
- import { Props } from '@fortawesome/react-native-fontawesome';
2
+ import { ComponentType } from 'react';
4
3
  import { ComponentSize } from '@impulse-ui-native/theme';
5
- import { ViewStyle } from 'react-native';
4
+ import { SvgProps } from 'react-native-svg';
6
5
 
7
- interface IconStyle extends ViewStyle {
8
- color?: string;
9
- }
10
- interface IconProps extends Omit<Props, "size"> {
6
+ type IconStyle = SvgProps["style"];
7
+ interface IconProps {
11
8
  size?: ComponentSize | number;
9
+ color?: string;
10
+ icon: ComponentType<SvgProps>;
11
+ style?: IconStyle;
12
12
  }
13
13
 
14
- declare const Icon: react.NamedExoticComponent<PropsWithChildren<IconProps>>;
14
+ declare const Icon: react.NamedExoticComponent<IconProps>;
15
15
 
16
16
  export { Icon, type IconProps, type IconStyle };
package/dist/index.esm.js CHANGED
@@ -1,24 +1,20 @@
1
1
  // src/components/icon.tsx
2
- import { FontAwesomeIcon } from "@fortawesome/react-native-fontawesome";
3
- import { useTheme } from "@impulse-ui-native/theme";
4
2
  import { memo, useMemo } from "react";
5
3
  var Icon = memo(function Icon2({
6
4
  size = "medium",
7
5
  icon,
8
- children,
9
- style,
10
6
  ...props
11
7
  }) {
12
- const theme = useTheme();
8
+ const Icon3 = icon;
13
9
  const iconSize = useMemo(
14
10
  () => ({
15
11
  small: 14,
16
12
  medium: 16,
17
13
  large: 16
18
14
  })[size],
19
- [theme, size]
20
- );
21
- return /* @__PURE__ */ React.createElement(FontAwesomeIcon, { size: iconSize, icon, style, ...props });
15
+ [size]
16
+ ) ?? 16;
17
+ return /* @__PURE__ */ React.createElement(Icon3, { ...props, width: iconSize, height: iconSize, fill: props.color });
22
18
  });
23
19
  export {
24
20
  Icon
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/icon.tsx"],"sourcesContent":["import { FontAwesomeIcon } from \"@fortawesome/react-native-fontawesome\";\r\nimport { useTheme } from \"@impulse-ui-native/theme\";\r\nimport { memo, PropsWithChildren, useMemo } from \"react\";\r\nimport { IconProps } from \"../types\";\r\n\r\nexport const Icon = memo(function Icon({\r\n size = \"medium\",\r\n icon,\r\n children,\r\n style,\r\n ...props\r\n}: PropsWithChildren<IconProps>) {\r\n const theme = useTheme();\r\n const iconSize = useMemo(\r\n () =>\r\n ({\r\n small: 14,\r\n medium: 16,\r\n large: 16,\r\n }[size]),\r\n [theme, size]\r\n );\r\n\r\n return (\r\n <FontAwesomeIcon size={iconSize} icon={icon} style={style} {...props} />\r\n );\r\n});\r\n"],"mappings":";AAAA,SAAS,uBAAuB;AAChC,SAAS,gBAAgB;AACzB,SAAS,MAAyB,eAAe;AAG1C,IAAM,OAAO,KAAK,SAASA,MAAK;AAAA,EACrC,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAiC;AAC/B,QAAM,QAAQ,SAAS;AACvB,QAAM,WAAW;AAAA,IACf,OACG;AAAA,MACC,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,OAAO;AAAA,IACT,GAAE,IAAI;AAAA,IACR,CAAC,OAAO,IAAI;AAAA,EACd;AAEA,SACE,oCAAC,mBAAgB,MAAM,UAAU,MAAY,OAAe,GAAG,OAAO;AAE1E,CAAC;","names":["Icon"]}
1
+ {"version":3,"sources":["../src/components/icon.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\r\nimport { IconProps } from \"../types\";\r\n\r\nexport const Icon = memo(function Icon({\r\n size = \"medium\",\r\n icon,\r\n ...props\r\n}: IconProps) {\r\n const Icon = icon;\r\n\r\n const iconSize =\r\n useMemo(\r\n () =>\r\n ({\r\n small: 14,\r\n medium: 16,\r\n large: 16,\r\n }[size]),\r\n [size]\r\n ) ?? 16;\r\n\r\n return (\r\n <Icon {...props} width={iconSize} height={iconSize} fill={props.color} />\r\n );\r\n});\r\n"],"mappings":";AAAA,SAAS,MAAM,eAAe;AAGvB,IAAM,OAAO,KAAK,SAASA,MAAK;AAAA,EACrC,OAAO;AAAA,EACP;AAAA,EACA,GAAG;AACL,GAAc;AACZ,QAAMA,QAAO;AAEb,QAAM,WACJ;AAAA,IACE,OACG;AAAA,MACC,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,OAAO;AAAA,IACT,GAAE,IAAI;AAAA,IACR,CAAC,IAAI;AAAA,EACP,KAAK;AAEP,SACE,oCAACA,OAAA,EAAM,GAAG,OAAO,OAAO,UAAU,QAAQ,UAAU,MAAM,MAAM,OAAO;AAE3E,CAAC;","names":["Icon"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@impulse-ui-native/icon",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "source": "src/index.ts",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -21,14 +21,9 @@
21
21
  "LICENSE"
22
22
  ],
23
23
  "dependencies": {
24
- "@fortawesome/fontawesome-svg-core": "^7.1.0",
25
- "@fortawesome/free-brands-svg-icons": "^7.1.0",
26
- "@fortawesome/free-regular-svg-icons": "^7.1.0",
27
- "@fortawesome/free-solid-svg-icons": "^7.1.0",
28
- "@fortawesome/react-native-fontawesome": "^0.3.2",
29
24
  "react-native-svg": "^15.14.0",
30
- "@impulse-ui-native/theme": "1.0.2",
31
- "@impulse-ui-native/core": "1.0.2"
25
+ "@impulse-ui-native/core": "1.0.4",
26
+ "@impulse-ui-native/theme": "1.0.4"
32
27
  },
33
28
  "peerDependencies": {
34
29
  "@fortawesome/free-brands-svg-icons": "^7.1.0",
@@ -1,27 +1,25 @@
1
- import { FontAwesomeIcon } from "@fortawesome/react-native-fontawesome";
2
- import { useTheme } from "@impulse-ui-native/theme";
3
- import { memo, PropsWithChildren, useMemo } from "react";
1
+ import { memo, useMemo } from "react";
4
2
  import { IconProps } from "../types";
5
3
 
6
4
  export const Icon = memo(function Icon({
7
5
  size = "medium",
8
6
  icon,
9
- children,
10
- style,
11
7
  ...props
12
- }: PropsWithChildren<IconProps>) {
13
- const theme = useTheme();
14
- const iconSize = useMemo(
15
- () =>
16
- ({
17
- small: 14,
18
- medium: 16,
19
- large: 16,
20
- }[size]),
21
- [theme, size]
22
- );
8
+ }: IconProps) {
9
+ const Icon = icon;
10
+
11
+ const iconSize =
12
+ useMemo(
13
+ () =>
14
+ ({
15
+ small: 14,
16
+ medium: 16,
17
+ large: 16,
18
+ }[size]),
19
+ [size]
20
+ ) ?? 16;
23
21
 
24
22
  return (
25
- <FontAwesomeIcon size={iconSize} icon={icon} style={style} {...props} />
23
+ <Icon {...props} width={iconSize} height={iconSize} fill={props.color} />
26
24
  );
27
25
  });
@@ -1,11 +1,12 @@
1
- import { Props } from "@fortawesome/react-native-fontawesome";
2
1
  import { ComponentSize } from "@impulse-ui-native/theme";
3
- import { ViewStyle } from "react-native";
2
+ import { ComponentType } from "react";
3
+ import { SvgProps } from "react-native-svg";
4
4
 
5
- export interface IconStyle extends ViewStyle {
6
- color?: string;
7
- }
5
+ export type IconStyle = SvgProps["style"];
8
6
 
9
- export interface IconProps extends Omit<Props, "size"> {
7
+ export interface IconProps {
10
8
  size?: ComponentSize | number;
9
+ color?: string;
10
+ icon: ComponentType<SvgProps>;
11
+ style?: IconStyle;
11
12
  }