huspy-icons 0.1.0 → 0.1.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.
- package/README.md +180 -125
- package/dist/fonts/HuspyIcons.css +28 -0
- package/dist/fonts/HuspyIcons.d.ts +9 -0
- package/dist/fonts/HuspyIcons.eot +0 -0
- package/dist/fonts/HuspyIcons.json +5 -0
- package/dist/fonts/HuspyIcons.svg +21 -0
- package/dist/fonts/HuspyIcons.symbol.svg +1 -0
- package/dist/fonts/HuspyIcons.ts +16 -0
- package/dist/fonts/HuspyIcons.ttf +0 -0
- package/dist/fonts/HuspyIcons.woff +0 -0
- package/dist/fonts/HuspyIcons.woff2 +0 -0
- package/dist/native/index.d.ts +34 -28
- package/dist/native/index.js +44 -84
- package/dist/native/index.js.map +1 -1
- package/dist/react/index.d.mts +23 -1
- package/dist/react/index.d.ts +23 -1
- package/dist/react/index.js +162 -74
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +158 -61
- package/dist/react/index.mjs.map +1 -1
- package/package.json +7 -8
- package/src/native/Icon.tsx +73 -0
- package/src/native/glyphMap.ts +22 -0
- package/src/native/index.ts +17 -12
- package/src/react/Icon.tsx +87 -0
- package/src/react/index.ts +5 -1
- package/src/native/ArrowLeft.tsx +0 -27
- package/src/native/ArrowUpRight.tsx +0 -27
- package/src/native/IconSlot.tsx +0 -19
- package/src/native/index.tsx +0 -3
package/dist/native/index.js
CHANGED
|
@@ -30,101 +30,61 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/native/index.ts
|
|
31
31
|
var native_exports = {};
|
|
32
32
|
__export(native_exports, {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
IconSlot: () => IconSlot_default,
|
|
37
|
-
resolveSize: () => resolveSize
|
|
33
|
+
Icon: () => Icon_default,
|
|
34
|
+
fontFamily: () => fontFamily,
|
|
35
|
+
glyphMap: () => glyphMap
|
|
38
36
|
});
|
|
39
37
|
module.exports = __toCommonJS(native_exports);
|
|
40
38
|
|
|
41
|
-
// src/native/
|
|
39
|
+
// src/native/Icon.tsx
|
|
42
40
|
var React = __toESM(require("react"));
|
|
43
|
-
var
|
|
41
|
+
var import_react_native = require("react-native");
|
|
44
42
|
|
|
45
|
-
// src/
|
|
46
|
-
var
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
lg: 20,
|
|
51
|
-
xl: 24
|
|
43
|
+
// src/native/glyphMap.ts
|
|
44
|
+
var glyphMap = {
|
|
45
|
+
"icon-slot": 61697,
|
|
46
|
+
"arrow-up-right": 61698,
|
|
47
|
+
"arrow-left": 61699
|
|
52
48
|
};
|
|
53
|
-
|
|
54
|
-
if (typeof size === "number") {
|
|
55
|
-
return size;
|
|
56
|
-
}
|
|
57
|
-
return ICON_SIZES[size] ?? ICON_SIZES.lg;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// src/native/ArrowLeft.tsx
|
|
61
|
-
var SvgArrowLeft = ({ size = 16, ...props }) => {
|
|
62
|
-
const sizeValue = resolveSize(size);
|
|
63
|
-
return /* @__PURE__ */ React.createElement(import_react_native_svg.default, { width: sizeValue, height: sizeValue, viewBox: "0 0 24 24", fill: "none", ...props }, /* @__PURE__ */ React.createElement(
|
|
64
|
-
import_react_native_svg.Path,
|
|
65
|
-
{
|
|
66
|
-
fillRule: "evenodd",
|
|
67
|
-
clipRule: "evenodd",
|
|
68
|
-
d: "M12.7071 4.29289C13.0976 4.68342 13.0976 5.31658 12.7071 5.70711L6.41421 12L12.7071 18.2929C13.0976 18.6834 13.0976 19.3166 12.7071 19.7071C12.3166 20.0976 11.6834 20.0976 11.2929 19.7071L4.29289 12.7071C3.90237 12.3166 3.90237 11.6834 4.29289 11.2929L11.2929 4.29289C11.6834 3.90237 12.3166 3.90237 12.7071 4.29289Z",
|
|
69
|
-
fill: "currentColor"
|
|
70
|
-
}
|
|
71
|
-
), /* @__PURE__ */ React.createElement(
|
|
72
|
-
import_react_native_svg.Path,
|
|
73
|
-
{
|
|
74
|
-
fillRule: "evenodd",
|
|
75
|
-
clipRule: "evenodd",
|
|
76
|
-
d: "M4 12C4 11.4477 4.44772 11 5 11H19C19.5523 11 20 11.4477 20 12C20 12.5523 19.5523 13 19 13H5C4.44772 13 4 12.5523 4 12Z",
|
|
77
|
-
fill: "currentColor"
|
|
78
|
-
}
|
|
79
|
-
));
|
|
80
|
-
};
|
|
81
|
-
var ArrowLeft_default = SvgArrowLeft;
|
|
49
|
+
var fontFamily = "HuspyIcons";
|
|
82
50
|
|
|
83
|
-
// src/native/
|
|
84
|
-
var
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
import_react_native_svg2.Path,
|
|
90
|
-
{
|
|
91
|
-
fillRule: "evenodd",
|
|
92
|
-
clipRule: "evenodd",
|
|
93
|
-
d: "M6 7C6 6.44772 6.44772 6 7 6H17C17.5523 6 18 6.44772 18 7V17C18 17.5523 17.5523 18 17 18C16.4477 18 16 17.5523 16 17V8H7C6.44772 8 6 7.55228 6 7Z",
|
|
94
|
-
fill: "currentColor"
|
|
95
|
-
}
|
|
96
|
-
), /* @__PURE__ */ React2.createElement(
|
|
97
|
-
import_react_native_svg2.Path,
|
|
98
|
-
{
|
|
99
|
-
fillRule: "evenodd",
|
|
100
|
-
clipRule: "evenodd",
|
|
101
|
-
d: "M17.7071 6.29289C18.0976 6.68342 18.0976 7.31658 17.7071 7.70711L7.70711 17.7071C7.31658 18.0976 6.68342 18.0976 6.29289 17.7071C5.90237 17.3166 5.90237 16.6834 6.29289 16.2929L16.2929 6.29289C16.6834 5.90237 17.3166 5.90237 17.7071 6.29289Z",
|
|
102
|
-
fill: "currentColor"
|
|
51
|
+
// src/native/Icon.tsx
|
|
52
|
+
var Icon = ({ name, size = 16, color = "#000", style, ...props }) => {
|
|
53
|
+
const codepoint = glyphMap[name];
|
|
54
|
+
if (!codepoint) {
|
|
55
|
+
if (__DEV__) {
|
|
56
|
+
console.warn(`Icon "${name}" not found in HuspyIcons font`);
|
|
103
57
|
}
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
var React3 = __toESM(require("react"));
|
|
110
|
-
var import_react_native_svg3 = __toESM(require("react-native-svg"));
|
|
111
|
-
var SvgIconSlot = ({ size = 16, ...props }) => {
|
|
112
|
-
const sizeValue = resolveSize(size);
|
|
113
|
-
return /* @__PURE__ */ React3.createElement(import_react_native_svg3.default, { width: sizeValue, height: sizeValue, viewBox: "0 0 15 15", fill: "none", ...props }, /* @__PURE__ */ React3.createElement(
|
|
114
|
-
import_react_native_svg3.Path,
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
const glyph = String.fromCharCode(codepoint);
|
|
61
|
+
return /* @__PURE__ */ React.createElement(
|
|
62
|
+
import_react_native.Text,
|
|
115
63
|
{
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
64
|
+
...props,
|
|
65
|
+
style: [
|
|
66
|
+
{
|
|
67
|
+
fontFamily,
|
|
68
|
+
fontSize: size,
|
|
69
|
+
color,
|
|
70
|
+
// Ensure icon doesn't inherit text styles
|
|
71
|
+
fontWeight: "normal",
|
|
72
|
+
fontStyle: "normal"
|
|
73
|
+
},
|
|
74
|
+
style
|
|
75
|
+
],
|
|
76
|
+
accessible: true,
|
|
77
|
+
accessibilityLabel: props.accessibilityLabel || name,
|
|
78
|
+
accessibilityRole: "image"
|
|
79
|
+
},
|
|
80
|
+
glyph
|
|
81
|
+
);
|
|
120
82
|
};
|
|
121
|
-
var
|
|
83
|
+
var Icon_default = Icon;
|
|
122
84
|
// Annotate the CommonJS export names for ESM import in node:
|
|
123
85
|
0 && (module.exports = {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
IconSlot,
|
|
128
|
-
resolveSize
|
|
86
|
+
Icon,
|
|
87
|
+
fontFamily,
|
|
88
|
+
glyphMap
|
|
129
89
|
});
|
|
130
90
|
//# sourceMappingURL=index.js.map
|
package/dist/native/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/native/index.ts","../../src/native/
|
|
1
|
+
{"version":3,"sources":["../../src/native/index.ts","../../src/native/Icon.tsx","../../src/native/glyphMap.ts"],"sourcesContent":["/**\n * Huspy Icons - React Native (Font-based)\n * \n * This package provides icon components for React Native using a custom font.\n * \n * @example\n * ```tsx\n * import { Icon } from 'huspy-icons/native';\n * \n * function MyComponent() {\n * return <Icon name=\"arrow-left\" size={24} color=\"#000\" />;\n * }\n * ```\n */\n\nexport { default as Icon } from './Icon';\nexport type { IconProps, IconName } from './Icon';\nexport { glyphMap, fontFamily } from './glyphMap';\n","import * as React from 'react';\nimport { Text, TextProps, Platform } from 'react-native';\nimport { glyphMap, fontFamily, IconName } from './glyphMap';\n\n/**\n * Props for the Icon component (React Native)\n */\nexport interface IconProps extends Omit<TextProps, 'children'> {\n /**\n * Name of the icon to display\n */\n name: IconName;\n \n /**\n * Size of the icon (default: 16)\n */\n size?: number;\n \n /**\n * Color of the icon (default: inherits from parent or 'black')\n */\n color?: string;\n}\n\n/**\n * Icon component for React Native\n * \n * Renders icons using a custom font (HuspyIcons)\n * \n * @example\n * ```tsx\n * <Icon name=\"arrow-left\" size={24} color=\"#000\" />\n * ```\n */\nconst Icon = ({ name, size = 16, color = '#000', style, ...props }: IconProps) => {\n const codepoint = glyphMap[name];\n \n if (!codepoint) {\n if (__DEV__) {\n console.warn(`Icon \"${name}\" not found in HuspyIcons font`);\n }\n return null;\n }\n \n // Convert codepoint to character\n const glyph = String.fromCharCode(codepoint);\n \n return (\n <Text\n {...props}\n style={[\n {\n fontFamily: fontFamily,\n fontSize: size,\n color: color,\n // Ensure icon doesn't inherit text styles\n fontWeight: 'normal',\n fontStyle: 'normal',\n },\n style,\n ]}\n // Accessibility\n accessible\n accessibilityLabel={props.accessibilityLabel || name}\n accessibilityRole=\"image\"\n >\n {glyph}\n </Text>\n );\n};\n\nexport default Icon;\nexport type { IconName };\n","// Auto-generated by generate-font.js - do not edit manually\n// Source: icons-src/*.svg → dist/fonts/HuspyIcons.*\n\n/**\n * Available icon names in the HuspyIcons font\n */\nexport type IconName = 'icon-slot' | 'arrow-up-right' | 'arrow-left';\n\n/**\n * Mapping of icon names to unicode codepoints\n * Used by the Icon component to render the correct glyph\n */\nexport const glyphMap: Record<IconName, number> = {\n \"icon-slot\": 61697,\n \"arrow-up-right\": 61698,\n \"arrow-left\": 61699\n};\n\n/**\n * Font family name for React Native\n */\nexport const fontFamily = 'HuspyIcons';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,0BAA0C;;;ACWnC,IAAM,WAAqC;AAAA,EAChD,aAAa;AAAA,EACb,kBAAkB;AAAA,EAClB,cAAc;AAChB;AAKO,IAAM,aAAa;;;ADa1B,IAAM,OAAO,CAAC,EAAE,MAAM,OAAO,IAAI,QAAQ,QAAQ,OAAO,GAAG,MAAM,MAAiB;AAChF,QAAM,YAAY,SAAS,IAAI;AAE/B,MAAI,CAAC,WAAW;AACd,QAAI,SAAS;AACX,cAAQ,KAAK,SAAS,IAAI,gCAAgC;AAAA,IAC5D;AACA,WAAO;AAAA,EACT;AAGA,QAAM,QAAQ,OAAO,aAAa,SAAS;AAE3C,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,OAAO;AAAA,QACL;AAAA,UACE;AAAA,UACA,UAAU;AAAA,UACV;AAAA;AAAA,UAEA,YAAY;AAAA,UACZ,WAAW;AAAA,QACb;AAAA,QACA;AAAA,MACF;AAAA,MAEA,YAAU;AAAA,MACV,oBAAoB,MAAM,sBAAsB;AAAA,MAChD,mBAAkB;AAAA;AAAA,IAEjB;AAAA,EACH;AAEJ;AAEA,IAAO,eAAQ;","names":[]}
|
package/dist/react/index.d.mts
CHANGED
|
@@ -34,4 +34,26 @@ declare const SvgArrowUpRight: ({ size, ...props }: ReactIconProps) => React$1.J
|
|
|
34
34
|
|
|
35
35
|
declare const SvgIconSlot: ({ size, ...props }: ReactIconProps) => React$1.JSX.Element;
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Icon imports - using dynamic imports for tree-shaking
|
|
39
|
+
* Auto-generated - do not edit manually
|
|
40
|
+
*/
|
|
41
|
+
/**
|
|
42
|
+
* Available icon names
|
|
43
|
+
*/
|
|
44
|
+
type IconName = 'arrow-left' | 'arrow-up-right' | 'icon-slot';
|
|
45
|
+
/**
|
|
46
|
+
* Props for the unified Icon component
|
|
47
|
+
*/
|
|
48
|
+
interface IconProps extends Omit<ReactIconProps, 'size'> {
|
|
49
|
+
name: IconName;
|
|
50
|
+
size?: ReactIconProps['size'];
|
|
51
|
+
color?: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Unified Icon component that renders icons by name
|
|
55
|
+
* Uses dynamic imports for tree-shaking support
|
|
56
|
+
*/
|
|
57
|
+
declare const Icon: ({ name, size, color, ...props }: IconProps) => React$1.JSX.Element | null;
|
|
58
|
+
|
|
59
|
+
export { SvgArrowLeft as ArrowLeft, SvgArrowUpRight as ArrowUpRight, ICON_SIZES, Icon, type IconName, type IconProps, type IconSize, type IconSizeToken, SvgIconSlot as IconSlot, type ReactIconProps, resolveSize };
|
package/dist/react/index.d.ts
CHANGED
|
@@ -34,4 +34,26 @@ declare const SvgArrowUpRight: ({ size, ...props }: ReactIconProps) => React$1.J
|
|
|
34
34
|
|
|
35
35
|
declare const SvgIconSlot: ({ size, ...props }: ReactIconProps) => React$1.JSX.Element;
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Icon imports - using dynamic imports for tree-shaking
|
|
39
|
+
* Auto-generated - do not edit manually
|
|
40
|
+
*/
|
|
41
|
+
/**
|
|
42
|
+
* Available icon names
|
|
43
|
+
*/
|
|
44
|
+
type IconName = 'arrow-left' | 'arrow-up-right' | 'icon-slot';
|
|
45
|
+
/**
|
|
46
|
+
* Props for the unified Icon component
|
|
47
|
+
*/
|
|
48
|
+
interface IconProps extends Omit<ReactIconProps, 'size'> {
|
|
49
|
+
name: IconName;
|
|
50
|
+
size?: ReactIconProps['size'];
|
|
51
|
+
color?: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Unified Icon component that renders icons by name
|
|
55
|
+
* Uses dynamic imports for tree-shaking support
|
|
56
|
+
*/
|
|
57
|
+
declare const Icon: ({ name, size, color, ...props }: IconProps) => React$1.JSX.Element | null;
|
|
58
|
+
|
|
59
|
+
export { SvgArrowLeft as ArrowLeft, SvgArrowUpRight as ArrowUpRight, ICON_SIZES, Icon, type IconName, type IconProps, type IconSize, type IconSizeToken, SvgIconSlot as IconSlot, type ReactIconProps, resolveSize };
|
package/dist/react/index.js
CHANGED
|
@@ -5,6 +5,9 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __esm = (fn, res) => function __init() {
|
|
9
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
10
|
+
};
|
|
8
11
|
var __export = (target, all) => {
|
|
9
12
|
for (var name in all)
|
|
10
13
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -27,93 +30,178 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
30
|
));
|
|
28
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
32
|
|
|
33
|
+
// src/shared/types.ts
|
|
34
|
+
function resolveSize(size = "lg") {
|
|
35
|
+
if (typeof size === "number") {
|
|
36
|
+
return size;
|
|
37
|
+
}
|
|
38
|
+
return ICON_SIZES[size] ?? ICON_SIZES.lg;
|
|
39
|
+
}
|
|
40
|
+
var ICON_SIZES;
|
|
41
|
+
var init_types = __esm({
|
|
42
|
+
"src/shared/types.ts"() {
|
|
43
|
+
"use strict";
|
|
44
|
+
ICON_SIZES = {
|
|
45
|
+
xs: 8,
|
|
46
|
+
sm: 12,
|
|
47
|
+
md: 16,
|
|
48
|
+
lg: 20,
|
|
49
|
+
xl: 24
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// src/react/ArrowLeft.tsx
|
|
55
|
+
var ArrowLeft_exports = {};
|
|
56
|
+
__export(ArrowLeft_exports, {
|
|
57
|
+
default: () => ArrowLeft_default
|
|
58
|
+
});
|
|
59
|
+
var React, SvgArrowLeft, ArrowLeft_default;
|
|
60
|
+
var init_ArrowLeft = __esm({
|
|
61
|
+
"src/react/ArrowLeft.tsx"() {
|
|
62
|
+
"use strict";
|
|
63
|
+
React = __toESM(require("react"));
|
|
64
|
+
init_types();
|
|
65
|
+
SvgArrowLeft = ({ size = 16, ...props }) => {
|
|
66
|
+
const sizeValue = resolveSize(size);
|
|
67
|
+
return /* @__PURE__ */ React.createElement("svg", { width: sizeValue, height: sizeValue, viewBox: "0 0 24 24", fill: "none", ...props }, /* @__PURE__ */ React.createElement(
|
|
68
|
+
"path",
|
|
69
|
+
{
|
|
70
|
+
fillRule: "evenodd",
|
|
71
|
+
clipRule: "evenodd",
|
|
72
|
+
d: "M12.7071 4.29289C13.0976 4.68342 13.0976 5.31658 12.7071 5.70711L6.41421 12L12.7071 18.2929C13.0976 18.6834 13.0976 19.3166 12.7071 19.7071C12.3166 20.0976 11.6834 20.0976 11.2929 19.7071L4.29289 12.7071C3.90237 12.3166 3.90237 11.6834 4.29289 11.2929L11.2929 4.29289C11.6834 3.90237 12.3166 3.90237 12.7071 4.29289Z",
|
|
73
|
+
fill: "currentColor"
|
|
74
|
+
}
|
|
75
|
+
), /* @__PURE__ */ React.createElement(
|
|
76
|
+
"path",
|
|
77
|
+
{
|
|
78
|
+
fillRule: "evenodd",
|
|
79
|
+
clipRule: "evenodd",
|
|
80
|
+
d: "M4 12C4 11.4477 4.44772 11 5 11H19C19.5523 11 20 11.4477 20 12C20 12.5523 19.5523 13 19 13H5C4.44772 13 4 12.5523 4 12Z",
|
|
81
|
+
fill: "currentColor"
|
|
82
|
+
}
|
|
83
|
+
));
|
|
84
|
+
};
|
|
85
|
+
ArrowLeft_default = SvgArrowLeft;
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
// src/react/ArrowUpRight.tsx
|
|
90
|
+
var ArrowUpRight_exports = {};
|
|
91
|
+
__export(ArrowUpRight_exports, {
|
|
92
|
+
default: () => ArrowUpRight_default
|
|
93
|
+
});
|
|
94
|
+
var React2, SvgArrowUpRight, ArrowUpRight_default;
|
|
95
|
+
var init_ArrowUpRight = __esm({
|
|
96
|
+
"src/react/ArrowUpRight.tsx"() {
|
|
97
|
+
"use strict";
|
|
98
|
+
React2 = __toESM(require("react"));
|
|
99
|
+
init_types();
|
|
100
|
+
SvgArrowUpRight = ({ size = 16, ...props }) => {
|
|
101
|
+
const sizeValue = resolveSize(size);
|
|
102
|
+
return /* @__PURE__ */ React2.createElement("svg", { width: sizeValue, height: sizeValue, viewBox: "0 0 24 24", fill: "none", ...props }, /* @__PURE__ */ React2.createElement(
|
|
103
|
+
"path",
|
|
104
|
+
{
|
|
105
|
+
fillRule: "evenodd",
|
|
106
|
+
clipRule: "evenodd",
|
|
107
|
+
d: "M6 7C6 6.44772 6.44772 6 7 6H17C17.5523 6 18 6.44772 18 7V17C18 17.5523 17.5523 18 17 18C16.4477 18 16 17.5523 16 17V8H7C6.44772 8 6 7.55228 6 7Z",
|
|
108
|
+
fill: "currentColor"
|
|
109
|
+
}
|
|
110
|
+
), /* @__PURE__ */ React2.createElement(
|
|
111
|
+
"path",
|
|
112
|
+
{
|
|
113
|
+
fillRule: "evenodd",
|
|
114
|
+
clipRule: "evenodd",
|
|
115
|
+
d: "M17.7071 6.29289C18.0976 6.68342 18.0976 7.31658 17.7071 7.70711L7.70711 17.7071C7.31658 18.0976 6.68342 18.0976 6.29289 17.7071C5.90237 17.3166 5.90237 16.6834 6.29289 16.2929L16.2929 6.29289C16.6834 5.90237 17.3166 5.90237 17.7071 6.29289Z",
|
|
116
|
+
fill: "currentColor"
|
|
117
|
+
}
|
|
118
|
+
));
|
|
119
|
+
};
|
|
120
|
+
ArrowUpRight_default = SvgArrowUpRight;
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
// src/react/IconSlot.tsx
|
|
125
|
+
var IconSlot_exports = {};
|
|
126
|
+
__export(IconSlot_exports, {
|
|
127
|
+
default: () => IconSlot_default
|
|
128
|
+
});
|
|
129
|
+
var React3, SvgIconSlot, IconSlot_default;
|
|
130
|
+
var init_IconSlot = __esm({
|
|
131
|
+
"src/react/IconSlot.tsx"() {
|
|
132
|
+
"use strict";
|
|
133
|
+
React3 = __toESM(require("react"));
|
|
134
|
+
init_types();
|
|
135
|
+
SvgIconSlot = ({ size = 16, ...props }) => {
|
|
136
|
+
const sizeValue = resolveSize(size);
|
|
137
|
+
return /* @__PURE__ */ React3.createElement("svg", { width: sizeValue, height: sizeValue, viewBox: "0 0 15 15", fill: "none", ...props }, /* @__PURE__ */ React3.createElement(
|
|
138
|
+
"path",
|
|
139
|
+
{
|
|
140
|
+
d: "M13.3333 7.33333C13.3333 4.01962 10.647 1.33333 7.33333 1.33333C4.01962 1.33333 1.33333 4.01962 1.33333 7.33333C1.33333 10.647 4.01962 13.3333 7.33333 13.3333C10.647 13.3333 13.3333 10.647 13.3333 7.33333ZM14.6667 7.33333C14.6667 11.3834 11.3834 14.6667 7.33333 14.6667C3.28325 14.6667 0 11.3834 0 7.33333C0 3.28325 3.28325 0 7.33333 0C11.3834 0 14.6667 3.28325 14.6667 7.33333Z",
|
|
141
|
+
fill: "currentColor"
|
|
142
|
+
}
|
|
143
|
+
));
|
|
144
|
+
};
|
|
145
|
+
IconSlot_default = SvgIconSlot;
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
|
|
30
149
|
// src/react/index.ts
|
|
31
150
|
var react_exports = {};
|
|
32
151
|
__export(react_exports, {
|
|
33
152
|
ArrowLeft: () => ArrowLeft_default,
|
|
34
153
|
ArrowUpRight: () => ArrowUpRight_default,
|
|
35
154
|
ICON_SIZES: () => ICON_SIZES,
|
|
155
|
+
Icon: () => Icon_default,
|
|
36
156
|
IconSlot: () => IconSlot_default,
|
|
37
157
|
resolveSize: () => resolveSize
|
|
38
158
|
});
|
|
39
159
|
module.exports = __toCommonJS(react_exports);
|
|
160
|
+
init_ArrowLeft();
|
|
161
|
+
init_ArrowUpRight();
|
|
162
|
+
init_IconSlot();
|
|
40
163
|
|
|
41
|
-
// src/react/
|
|
42
|
-
var
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
if (typeof size === "number") {
|
|
54
|
-
return size;
|
|
164
|
+
// src/react/Icon.tsx
|
|
165
|
+
var React4 = __toESM(require("react"));
|
|
166
|
+
function loadIcon(name) {
|
|
167
|
+
switch (name) {
|
|
168
|
+
case "arrow-left":
|
|
169
|
+
return Promise.resolve().then(() => (init_ArrowLeft(), ArrowLeft_exports)).then((m) => m.default);
|
|
170
|
+
case "arrow-up-right":
|
|
171
|
+
return Promise.resolve().then(() => (init_ArrowUpRight(), ArrowUpRight_exports)).then((m) => m.default);
|
|
172
|
+
case "icon-slot":
|
|
173
|
+
return Promise.resolve().then(() => (init_IconSlot(), IconSlot_exports)).then((m) => m.default);
|
|
174
|
+
default:
|
|
175
|
+
return Promise.reject(new Error(`Icon "${name}" not found`));
|
|
55
176
|
}
|
|
56
|
-
return ICON_SIZES[size] ?? ICON_SIZES.lg;
|
|
57
177
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
// src/react/ArrowUpRight.tsx
|
|
83
|
-
var React2 = __toESM(require("react"));
|
|
84
|
-
var SvgArrowUpRight = ({ size = 16, ...props }) => {
|
|
85
|
-
const sizeValue = resolveSize(size);
|
|
86
|
-
return /* @__PURE__ */ React2.createElement("svg", { width: sizeValue, height: sizeValue, viewBox: "0 0 24 24", fill: "none", ...props }, /* @__PURE__ */ React2.createElement(
|
|
87
|
-
"path",
|
|
88
|
-
{
|
|
89
|
-
fillRule: "evenodd",
|
|
90
|
-
clipRule: "evenodd",
|
|
91
|
-
d: "M6 7C6 6.44772 6.44772 6 7 6H17C17.5523 6 18 6.44772 18 7V17C18 17.5523 17.5523 18 17 18C16.4477 18 16 17.5523 16 17V8H7C6.44772 8 6 7.55228 6 7Z",
|
|
92
|
-
fill: "currentColor"
|
|
93
|
-
}
|
|
94
|
-
), /* @__PURE__ */ React2.createElement(
|
|
95
|
-
"path",
|
|
96
|
-
{
|
|
97
|
-
fillRule: "evenodd",
|
|
98
|
-
clipRule: "evenodd",
|
|
99
|
-
d: "M17.7071 6.29289C18.0976 6.68342 18.0976 7.31658 17.7071 7.70711L7.70711 17.7071C7.31658 18.0976 6.68342 18.0976 6.29289 17.7071C5.90237 17.3166 5.90237 16.6834 6.29289 16.2929L16.2929 6.29289C16.6834 5.90237 17.3166 5.90237 17.7071 6.29289Z",
|
|
100
|
-
fill: "currentColor"
|
|
101
|
-
}
|
|
102
|
-
));
|
|
178
|
+
var Icon = ({ name, size = 16, color, ...props }) => {
|
|
179
|
+
const [IconComponent, setIconComponent] = React4.useState(null);
|
|
180
|
+
const [loading, setLoading] = React4.useState(true);
|
|
181
|
+
const [error, setError] = React4.useState(null);
|
|
182
|
+
React4.useEffect(() => {
|
|
183
|
+
setLoading(true);
|
|
184
|
+
setError(null);
|
|
185
|
+
loadIcon(name).then((Component) => {
|
|
186
|
+
setIconComponent(() => Component);
|
|
187
|
+
setLoading(false);
|
|
188
|
+
}).catch((err) => {
|
|
189
|
+
console.warn(err.message);
|
|
190
|
+
setError(err.message);
|
|
191
|
+
setLoading(false);
|
|
192
|
+
});
|
|
193
|
+
}, [name]);
|
|
194
|
+
if (loading) {
|
|
195
|
+
return null;
|
|
196
|
+
}
|
|
197
|
+
if (error || !IconComponent) {
|
|
198
|
+
return null;
|
|
199
|
+
}
|
|
200
|
+
const style = color ? { ...props.style, color } : props.style;
|
|
201
|
+
return /* @__PURE__ */ React4.createElement(IconComponent, { size, ...props, style });
|
|
103
202
|
};
|
|
104
|
-
var
|
|
203
|
+
var Icon_default = Icon;
|
|
105
204
|
|
|
106
|
-
// src/react/
|
|
107
|
-
|
|
108
|
-
var SvgIconSlot = ({ size = 16, ...props }) => {
|
|
109
|
-
const sizeValue = resolveSize(size);
|
|
110
|
-
return /* @__PURE__ */ React3.createElement("svg", { width: sizeValue, height: sizeValue, viewBox: "0 0 15 15", fill: "none", ...props }, /* @__PURE__ */ React3.createElement(
|
|
111
|
-
"path",
|
|
112
|
-
{
|
|
113
|
-
d: "M13.3333 7.33333C13.3333 4.01962 10.647 1.33333 7.33333 1.33333C4.01962 1.33333 1.33333 4.01962 1.33333 7.33333C1.33333 10.647 4.01962 13.3333 7.33333 13.3333C10.647 13.3333 13.3333 10.647 13.3333 7.33333ZM14.6667 7.33333C14.6667 11.3834 11.3834 14.6667 7.33333 14.6667C3.28325 14.6667 0 11.3834 0 7.33333C0 3.28325 3.28325 0 7.33333 0C11.3834 0 14.6667 3.28325 14.6667 7.33333Z",
|
|
114
|
-
fill: "currentColor"
|
|
115
|
-
}
|
|
116
|
-
));
|
|
117
|
-
};
|
|
118
|
-
var IconSlot_default = SvgIconSlot;
|
|
205
|
+
// src/react/index.ts
|
|
206
|
+
init_types();
|
|
119
207
|
//# sourceMappingURL=index.js.map
|
package/dist/react/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/
|
|
1
|
+
{"version":3,"sources":["../../src/shared/types.ts","../../src/react/ArrowLeft.tsx","../../src/react/ArrowUpRight.tsx","../../src/react/IconSlot.tsx","../../src/react/index.ts","../../src/react/Icon.tsx"],"sourcesContent":["export type IconSize = number | 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n\n/**\n * Icon size presets\n */\nexport const ICON_SIZES = {\n xs: 8,\n sm: 12,\n md: 16,\n lg: 20,\n xl: 24,\n} as const;\n\n/**\n * Icon size token type\n */\nexport type IconSizeToken = keyof typeof ICON_SIZES;\n\n/**\n * Props for React (web) icons\n */\nexport interface ReactIconProps extends React.SVGProps<SVGSVGElement> {\n size?: IconSize;\n}\n\n/**\n * Props for React Native icons\n */\nexport interface NativeIconProps {\n size?: IconSize;\n width?: number;\n height?: number;\n color?: string;\n style?: any;\n}\n\n/**\n * Resolves an icon size to a numeric value\n * @param size - Size value or token\n * @returns Numeric size in pixels\n */\nexport function resolveSize(size: IconSize = 'lg'): number {\n if (typeof size === 'number') {\n return size;\n }\n \n return ICON_SIZES[size] ?? ICON_SIZES.lg;\n}\n","import * as React from 'react';\nimport type { ReactIconProps } from '../shared/types';\nimport { resolveSize } from '../shared/types';\n\nconst SvgArrowLeft = ({ size = 16, ...props }: ReactIconProps) => {\n const sizeValue = resolveSize(size);\n \n return (\n <svg width={sizeValue} height={sizeValue} viewBox=\"0 0 24 24\" fill=\"none\" {...props}>\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M12.7071 4.29289C13.0976 4.68342 13.0976 5.31658 12.7071 5.70711L6.41421 12L12.7071 18.2929C13.0976 18.6834 13.0976 19.3166 12.7071 19.7071C12.3166 20.0976 11.6834 20.0976 11.2929 19.7071L4.29289 12.7071C3.90237 12.3166 3.90237 11.6834 4.29289 11.2929L11.2929 4.29289C11.6834 3.90237 12.3166 3.90237 12.7071 4.29289Z\"\n fill=\"currentColor\"\n />\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M4 12C4 11.4477 4.44772 11 5 11H19C19.5523 11 20 11.4477 20 12C20 12.5523 19.5523 13 19 13H5C4.44772 13 4 12.5523 4 12Z\"\n fill=\"currentColor\"\n />\n </svg>\n );\n};\n\nexport default SvgArrowLeft;\n","import * as React from 'react';\nimport type { ReactIconProps } from '../shared/types';\nimport { resolveSize } from '../shared/types';\n\nconst SvgArrowUpRight = ({ size = 16, ...props }: ReactIconProps) => {\n const sizeValue = resolveSize(size);\n \n return (\n <svg width={sizeValue} height={sizeValue} viewBox=\"0 0 24 24\" fill=\"none\" {...props}>\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M6 7C6 6.44772 6.44772 6 7 6H17C17.5523 6 18 6.44772 18 7V17C18 17.5523 17.5523 18 17 18C16.4477 18 16 17.5523 16 17V8H7C6.44772 8 6 7.55228 6 7Z\"\n fill=\"currentColor\"\n />\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M17.7071 6.29289C18.0976 6.68342 18.0976 7.31658 17.7071 7.70711L7.70711 17.7071C7.31658 18.0976 6.68342 18.0976 6.29289 17.7071C5.90237 17.3166 5.90237 16.6834 6.29289 16.2929L16.2929 6.29289C16.6834 5.90237 17.3166 5.90237 17.7071 6.29289Z\"\n fill=\"currentColor\"\n />\n </svg>\n );\n};\n\nexport default SvgArrowUpRight;\n","import * as React from 'react';\nimport type { ReactIconProps } from '../shared/types';\nimport { resolveSize } from '../shared/types';\n\nconst SvgIconSlot = ({ size = 16, ...props }: ReactIconProps) => {\n const sizeValue = resolveSize(size);\n \n return (\n <svg width={sizeValue} height={sizeValue} viewBox=\"0 0 15 15\" fill=\"none\" {...props}>\n <path\n d=\"M13.3333 7.33333C13.3333 4.01962 10.647 1.33333 7.33333 1.33333C4.01962 1.33333 1.33333 4.01962 1.33333 7.33333C1.33333 10.647 4.01962 13.3333 7.33333 13.3333C10.647 13.3333 13.3333 10.647 13.3333 7.33333ZM14.6667 7.33333C14.6667 11.3834 11.3834 14.6667 7.33333 14.6667C3.28325 14.6667 0 11.3834 0 7.33333C0 3.28325 3.28325 0 7.33333 0C11.3834 0 14.6667 3.28325 14.6667 7.33333Z\"\n fill=\"currentColor\"\n />\n </svg>\n );\n};\n\nexport default SvgIconSlot;\n","// Auto-generated exports\nexport { default as ArrowLeft } from './ArrowLeft';\nexport { default as ArrowUpRight } from './ArrowUpRight';\nexport { default as IconSlot } from './IconSlot';\n\n// Unified Icon component\nexport { default as Icon } from './Icon';\nexport type { IconName, IconProps } from './Icon';\n\n // Export types\nexport type {\n IconSize,\n IconSizeToken,\n ReactIconProps,\n} from '../shared/types';\n\nexport { ICON_SIZES, resolveSize } from '../shared/types';\n","import * as React from 'react';\nimport type { ReactIconProps } from '../shared/types';\n\n/**\n * Icon imports - using dynamic imports for tree-shaking\n * Auto-generated - do not edit manually\n */\n// Icon: arrow-left\n// Icon: arrow-up-right\n// Icon: icon-slot\n\n/**\n * Available icon names\n */\nexport type IconName = 'arrow-left' | 'arrow-up-right' | 'icon-slot';\n\n/**\n * Props for the unified Icon component\n */\nexport interface IconProps extends Omit<ReactIconProps, 'size'> {\n name: IconName;\n size?: ReactIconProps['size'];\n color?: string;\n}\n\n/**\n * Loads an icon component dynamically\n * This pattern allows bundlers to tree-shake unused icons\n * \n * Icons use default exports (export default SvgIconName),\n * so we access .default from the dynamic import result\n */\nfunction loadIcon(name: IconName): Promise<React.ComponentType<any>> {\n switch (name) {\n case 'arrow-left':\n return import('./ArrowLeft').then(m => m.default);\n case 'arrow-up-right':\n return import('./ArrowUpRight').then(m => m.default);\n case 'icon-slot':\n return import('./IconSlot').then(m => m.default);\n default:\n return Promise.reject(new Error(`Icon \"${name}\" not found`));\n }\n}\n\n/**\n * Unified Icon component that renders icons by name\n * Uses dynamic imports for tree-shaking support\n */\nconst Icon = ({ name, size = 16, color, ...props }: IconProps) => {\n const [IconComponent, setIconComponent] = React.useState<React.ComponentType<any> | null>(null);\n const [loading, setLoading] = React.useState(true);\n const [error, setError] = React.useState<string | null>(null);\n\n React.useEffect(() => {\n setLoading(true);\n setError(null);\n \n loadIcon(name)\n .then((Component) => {\n setIconComponent(() => Component);\n setLoading(false);\n })\n .catch((err) => {\n console.warn(err.message);\n setError(err.message);\n setLoading(false);\n });\n }, [name]);\n\n if (loading) {\n return null; // Consider showing a placeholder\n }\n\n if (error || !IconComponent) {\n return null;\n }\n\n // Apply color via style prop if provided (SVGs use fill=\"currentColor\")\n const style = color \n ? { ...props.style, color } \n : props.style;\n\n return <IconComponent size={size} {...props} style={style} />;\n};\n\nexport default Icon;"],"mappings":"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","names":["React","React","React"]}
|