huspy-icons 0.1.3 → 0.1.5
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/fonts/HuspyIcons.css +9 -6
- package/dist/fonts/HuspyIcons.eot +0 -0
- package/dist/fonts/HuspyIcons.json +3 -2
- package/dist/fonts/HuspyIcons.ts +5 -2
- 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 +1 -1
- package/dist/native/index.js +3 -2
- package/dist/native/index.js.map +1 -1
- package/dist/react/index.d.mts +4 -2
- package/dist/react/index.d.ts +4 -2
- package/dist/react/index.js +40 -9
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +39 -8
- package/dist/react/index.mjs.map +1 -1
- package/package.json +4 -2
- package/src/native/glyphMap.ts +4 -3
- package/src/react/Check.tsx +20 -0
- package/src/react/Icon.tsx +4 -1
- package/src/react/index.ts +1 -0
- package/src/react/index.tsx +1 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
@font-face {
|
|
2
2
|
font-family: "HuspyIcons";
|
|
3
|
-
src: url(".//HuspyIcons.ttf?
|
|
4
|
-
url(".//HuspyIcons.woff?
|
|
5
|
-
url(".//HuspyIcons.woff2?
|
|
6
|
-
url(".//HuspyIcons.eot?
|
|
3
|
+
src: url(".//HuspyIcons.ttf?b363bbdca57bbac1f0078b38d06bdec1") format("truetype"),
|
|
4
|
+
url(".//HuspyIcons.woff?b363bbdca57bbac1f0078b38d06bdec1") format("woff"),
|
|
5
|
+
url(".//HuspyIcons.woff2?b363bbdca57bbac1f0078b38d06bdec1") format("woff2"),
|
|
6
|
+
url(".//HuspyIcons.eot?b363bbdca57bbac1f0078b38d06bdec1#iefix") format("embedded-opentype");
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
.icon:before {
|
|
@@ -20,9 +20,12 @@ url(".//HuspyIcons.eot?25d92884ac0b766c69d414744c2ffbc2#iefix") format("embedded
|
|
|
20
20
|
.icon.huspy-icon-icon-slot:before {
|
|
21
21
|
content: "\f101";
|
|
22
22
|
}
|
|
23
|
-
.icon.huspy-icon-
|
|
23
|
+
.icon.huspy-icon-check:before {
|
|
24
24
|
content: "\f102";
|
|
25
25
|
}
|
|
26
|
-
.icon.huspy-icon-arrow-
|
|
26
|
+
.icon.huspy-icon-arrow-up-right:before {
|
|
27
27
|
content: "\f103";
|
|
28
28
|
}
|
|
29
|
+
.icon.huspy-icon-arrow-left:before {
|
|
30
|
+
content: "\f104";
|
|
31
|
+
}
|
|
Binary file
|
package/dist/fonts/HuspyIcons.ts
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
export type HuspyIconsId =
|
|
2
2
|
| "icon-slot"
|
|
3
|
+
| "check"
|
|
3
4
|
| "arrow-up-right"
|
|
4
5
|
| "arrow-left";
|
|
5
6
|
|
|
6
7
|
export enum HuspyIcons {
|
|
7
8
|
IconSlot = "icon-slot",
|
|
9
|
+
Check = "check",
|
|
8
10
|
ArrowUpRight = "arrow-up-right",
|
|
9
11
|
ArrowLeft = "arrow-left",
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
export const HUSPY_ICONS_CODEPOINTS: { [key in HuspyIcons]: string } = {
|
|
13
15
|
[HuspyIcons.IconSlot]: "61697",
|
|
14
|
-
[HuspyIcons.
|
|
15
|
-
[HuspyIcons.
|
|
16
|
+
[HuspyIcons.Check]: "61698",
|
|
17
|
+
[HuspyIcons.ArrowUpRight]: "61699",
|
|
18
|
+
[HuspyIcons.ArrowLeft]: "61700",
|
|
16
19
|
};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/native/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { TextProps } from 'react-native';
|
|
|
4
4
|
/**
|
|
5
5
|
* Available icon names in the HuspyIcons font
|
|
6
6
|
*/
|
|
7
|
-
type IconName = 'icon-slot' | 'arrow-up-right' | 'arrow-left';
|
|
7
|
+
type IconName = 'icon-slot' | 'check' | 'arrow-up-right' | 'arrow-left';
|
|
8
8
|
/**
|
|
9
9
|
* Mapping of icon names to unicode codepoints
|
|
10
10
|
* Used by the Icon component to render the correct glyph
|
package/dist/native/index.js
CHANGED
|
@@ -43,8 +43,9 @@ var import_react_native = require("react-native");
|
|
|
43
43
|
// src/native/glyphMap.ts
|
|
44
44
|
var glyphMap = {
|
|
45
45
|
"icon-slot": 61697,
|
|
46
|
-
"
|
|
47
|
-
"arrow-
|
|
46
|
+
"check": 61698,
|
|
47
|
+
"arrow-up-right": 61699,
|
|
48
|
+
"arrow-left": 61700
|
|
48
49
|
};
|
|
49
50
|
var fontFamily = "HuspyIcons";
|
|
50
51
|
|
package/dist/native/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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\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\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\":
|
|
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\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\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' | 'check' | '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 \"check\": 61698,\n \"arrow-up-right\": 61699,\n \"arrow-left\": 61700\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,SAAS;AAAA,EACT,kBAAkB;AAAA,EAClB,cAAc;AAChB;AAKO,IAAM,aAAa;;;ADY1B,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
|
@@ -32,6 +32,8 @@ declare const SvgArrowLeft: ({ size, ...props }: ReactIconProps) => React$1.JSX.
|
|
|
32
32
|
|
|
33
33
|
declare const SvgArrowUpRight: ({ size, ...props }: ReactIconProps) => React$1.JSX.Element;
|
|
34
34
|
|
|
35
|
+
declare const SvgCheck: ({ size, ...props }: ReactIconProps) => React$1.JSX.Element;
|
|
36
|
+
|
|
35
37
|
declare const SvgIconSlot: ({ size, ...props }: ReactIconProps) => React$1.JSX.Element;
|
|
36
38
|
|
|
37
39
|
/**
|
|
@@ -41,7 +43,7 @@ declare const SvgIconSlot: ({ size, ...props }: ReactIconProps) => React$1.JSX.E
|
|
|
41
43
|
/**
|
|
42
44
|
* Available icon names
|
|
43
45
|
*/
|
|
44
|
-
type IconName = 'arrow-left' | 'arrow-up-right' | 'icon-slot';
|
|
46
|
+
type IconName = 'arrow-left' | 'arrow-up-right' | 'check' | 'icon-slot';
|
|
45
47
|
/**
|
|
46
48
|
* Props for the unified Icon component
|
|
47
49
|
*/
|
|
@@ -56,4 +58,4 @@ interface IconProps extends Omit<ReactIconProps, 'size'> {
|
|
|
56
58
|
*/
|
|
57
59
|
declare const Icon: ({ name, size, color, ...props }: IconProps) => React$1.JSX.Element | null;
|
|
58
60
|
|
|
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 };
|
|
61
|
+
export { SvgArrowLeft as ArrowLeft, SvgArrowUpRight as ArrowUpRight, SvgCheck as Check, ICON_SIZES, Icon, type IconName, type IconProps, type IconSize, type IconSizeToken, SvgIconSlot as IconSlot, type ReactIconProps, resolveSize };
|
package/dist/react/index.d.ts
CHANGED
|
@@ -32,6 +32,8 @@ declare const SvgArrowLeft: ({ size, ...props }: ReactIconProps) => React$1.JSX.
|
|
|
32
32
|
|
|
33
33
|
declare const SvgArrowUpRight: ({ size, ...props }: ReactIconProps) => React$1.JSX.Element;
|
|
34
34
|
|
|
35
|
+
declare const SvgCheck: ({ size, ...props }: ReactIconProps) => React$1.JSX.Element;
|
|
36
|
+
|
|
35
37
|
declare const SvgIconSlot: ({ size, ...props }: ReactIconProps) => React$1.JSX.Element;
|
|
36
38
|
|
|
37
39
|
/**
|
|
@@ -41,7 +43,7 @@ declare const SvgIconSlot: ({ size, ...props }: ReactIconProps) => React$1.JSX.E
|
|
|
41
43
|
/**
|
|
42
44
|
* Available icon names
|
|
43
45
|
*/
|
|
44
|
-
type IconName = 'arrow-left' | 'arrow-up-right' | 'icon-slot';
|
|
46
|
+
type IconName = 'arrow-left' | 'arrow-up-right' | 'check' | 'icon-slot';
|
|
45
47
|
/**
|
|
46
48
|
* Props for the unified Icon component
|
|
47
49
|
*/
|
|
@@ -56,4 +58,4 @@ interface IconProps extends Omit<ReactIconProps, 'size'> {
|
|
|
56
58
|
*/
|
|
57
59
|
declare const Icon: ({ name, size, color, ...props }: IconProps) => React$1.JSX.Element | null;
|
|
58
60
|
|
|
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 };
|
|
61
|
+
export { SvgArrowLeft as ArrowLeft, SvgArrowUpRight as ArrowUpRight, SvgCheck as Check, ICON_SIZES, Icon, type IconName, type IconProps, type IconSize, type IconSizeToken, SvgIconSlot as IconSlot, type ReactIconProps, resolveSize };
|
package/dist/react/index.js
CHANGED
|
@@ -121,20 +121,47 @@ var init_ArrowUpRight = __esm({
|
|
|
121
121
|
}
|
|
122
122
|
});
|
|
123
123
|
|
|
124
|
+
// src/react/Check.tsx
|
|
125
|
+
var Check_exports = {};
|
|
126
|
+
__export(Check_exports, {
|
|
127
|
+
default: () => Check_default
|
|
128
|
+
});
|
|
129
|
+
var React3, SvgCheck, Check_default;
|
|
130
|
+
var init_Check = __esm({
|
|
131
|
+
"src/react/Check.tsx"() {
|
|
132
|
+
"use strict";
|
|
133
|
+
React3 = __toESM(require("react"));
|
|
134
|
+
init_types();
|
|
135
|
+
SvgCheck = ({ size = 16, ...props }) => {
|
|
136
|
+
const sizeValue = resolveSize(size);
|
|
137
|
+
return /* @__PURE__ */ React3.createElement("svg", { width: sizeValue, height: sizeValue, viewBox: "0 0 24 24", fill: "none", ...props }, /* @__PURE__ */ React3.createElement(
|
|
138
|
+
"path",
|
|
139
|
+
{
|
|
140
|
+
fillRule: "evenodd",
|
|
141
|
+
clipRule: "evenodd",
|
|
142
|
+
d: "M20.7071 5.29289C21.0976 5.68342 21.0976 6.31658 20.7071 6.70711L9.70711 17.7071C9.31658 18.0976 8.68342 18.0976 8.29289 17.7071L3.29289 12.7071C2.90237 12.3166 2.90237 11.6834 3.29289 11.2929C3.68342 10.9024 4.31658 10.9024 4.70711 11.2929L9 15.5858L19.2929 5.29289C19.6834 4.90237 20.3166 4.90237 20.7071 5.29289Z",
|
|
143
|
+
fill: "currentColor"
|
|
144
|
+
}
|
|
145
|
+
));
|
|
146
|
+
};
|
|
147
|
+
Check_default = SvgCheck;
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
|
|
124
151
|
// src/react/IconSlot.tsx
|
|
125
152
|
var IconSlot_exports = {};
|
|
126
153
|
__export(IconSlot_exports, {
|
|
127
154
|
default: () => IconSlot_default
|
|
128
155
|
});
|
|
129
|
-
var
|
|
156
|
+
var React4, SvgIconSlot, IconSlot_default;
|
|
130
157
|
var init_IconSlot = __esm({
|
|
131
158
|
"src/react/IconSlot.tsx"() {
|
|
132
159
|
"use strict";
|
|
133
|
-
|
|
160
|
+
React4 = __toESM(require("react"));
|
|
134
161
|
init_types();
|
|
135
162
|
SvgIconSlot = ({ size = 16, ...props }) => {
|
|
136
163
|
const sizeValue = resolveSize(size);
|
|
137
|
-
return /* @__PURE__ */
|
|
164
|
+
return /* @__PURE__ */ React4.createElement("svg", { width: sizeValue, height: sizeValue, viewBox: "0 0 15 15", fill: "none", ...props }, /* @__PURE__ */ React4.createElement(
|
|
138
165
|
"path",
|
|
139
166
|
{
|
|
140
167
|
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",
|
|
@@ -151,6 +178,7 @@ var react_exports = {};
|
|
|
151
178
|
__export(react_exports, {
|
|
152
179
|
ArrowLeft: () => ArrowLeft_default,
|
|
153
180
|
ArrowUpRight: () => ArrowUpRight_default,
|
|
181
|
+
Check: () => Check_default,
|
|
154
182
|
ICON_SIZES: () => ICON_SIZES,
|
|
155
183
|
Icon: () => Icon_default,
|
|
156
184
|
IconSlot: () => IconSlot_default,
|
|
@@ -159,16 +187,19 @@ __export(react_exports, {
|
|
|
159
187
|
module.exports = __toCommonJS(react_exports);
|
|
160
188
|
init_ArrowLeft();
|
|
161
189
|
init_ArrowUpRight();
|
|
190
|
+
init_Check();
|
|
162
191
|
init_IconSlot();
|
|
163
192
|
|
|
164
193
|
// src/react/Icon.tsx
|
|
165
|
-
var
|
|
194
|
+
var React5 = __toESM(require("react"));
|
|
166
195
|
function loadIcon(name) {
|
|
167
196
|
switch (name) {
|
|
168
197
|
case "arrow-left":
|
|
169
198
|
return Promise.resolve().then(() => (init_ArrowLeft(), ArrowLeft_exports)).then((m) => m.default);
|
|
170
199
|
case "arrow-up-right":
|
|
171
200
|
return Promise.resolve().then(() => (init_ArrowUpRight(), ArrowUpRight_exports)).then((m) => m.default);
|
|
201
|
+
case "check":
|
|
202
|
+
return Promise.resolve().then(() => (init_Check(), Check_exports)).then((m) => m.default);
|
|
172
203
|
case "icon-slot":
|
|
173
204
|
return Promise.resolve().then(() => (init_IconSlot(), IconSlot_exports)).then((m) => m.default);
|
|
174
205
|
default:
|
|
@@ -176,10 +207,10 @@ function loadIcon(name) {
|
|
|
176
207
|
}
|
|
177
208
|
}
|
|
178
209
|
var Icon = ({ name, size = 16, color, ...props }) => {
|
|
179
|
-
const [IconComponent, setIconComponent] =
|
|
180
|
-
const [loading, setLoading] =
|
|
181
|
-
const [error, setError] =
|
|
182
|
-
|
|
210
|
+
const [IconComponent, setIconComponent] = React5.useState(null);
|
|
211
|
+
const [loading, setLoading] = React5.useState(true);
|
|
212
|
+
const [error, setError] = React5.useState(null);
|
|
213
|
+
React5.useEffect(() => {
|
|
183
214
|
setLoading(true);
|
|
184
215
|
setError(null);
|
|
185
216
|
loadIcon(name).then((Component) => {
|
|
@@ -198,7 +229,7 @@ var Icon = ({ name, size = 16, color, ...props }) => {
|
|
|
198
229
|
return null;
|
|
199
230
|
}
|
|
200
231
|
const style = color ? { ...props.style, color } : props.style;
|
|
201
|
-
return /* @__PURE__ */
|
|
232
|
+
return /* @__PURE__ */ React5.createElement(IconComponent, { size, ...props, style });
|
|
202
233
|
};
|
|
203
234
|
var Icon_default = Icon;
|
|
204
235
|
|
package/dist/react/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCO,SAAS,YAAY,OAAiB,MAAc;AACzD,MAAI,OAAO,SAAS,UAAU;AAC5B,WAAO;AAAA,EACT;AAEA,SAAO,WAAW,IAAI,KAAK,WAAW;AACxC;AA/CA,IAKa;AALb;AAAA;AAAA;AAKO,IAAM,aAAa;AAAA,MACxB,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,IACN;AAAA;AAAA;;;ACXA;AAAA;AAAA;AAAA;AAAA,WAIM,cAqBC;AAzBP;AAAA;AAAA;AAAA,YAAuB;AAEvB;AAEA,IAAM,eAAe,CAAC,EAAE,OAAO,IAAI,GAAG,MAAM,MAAsB;AAChE,YAAM,YAAY,YAAY,IAAI;AAElC,aACE,oCAAC,SAAI,OAAO,WAAW,QAAQ,WAAW,SAAQ,aAAY,MAAK,QAAQ,GAAG,SAC9E;AAAA,QAAC;AAAA;AAAA,UACC,UAAS;AAAA,UACT,UAAS;AAAA,UACT,GAAE;AAAA,UACF,MAAK;AAAA;AAAA,MACP,GACA;AAAA,QAAC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AAAA,IACZ,KAAK;AACH,aAAO,oEAAsB,KAAK,OAAK,EAAE,OAAO;AAAA,IAClD,KAAK;AACH,aAAO,0EAAyB,KAAK,OAAK,EAAE,OAAO;AAAA,IACrD,KAAK;AACH,aAAO,kEAAqB,KAAK,OAAK,EAAE,OAAO;AAAA,IACjD;AACE,aAAO,QAAQ,OAAO,IAAI,MAAM,SAAS,IAAI,aAAa,CAAC;AAAA,EAC/D;AACF;AAMA,IAAM,OAAO,CAAC,EAAE,MAAM,OAAO,IAAI,OAAO,GAAG,MAAM,MAAiB;AAChE,QAAM,CAAC,eAAe,gBAAgB,IAAU,gBAA0C,IAAI;AAC9F,QAAM,CAAC,SAAS,UAAU,IAAU,gBAAS,IAAI;AACjD,QAAM,CAAC,OAAO,QAAQ,IAAU,gBAAwB,IAAI;AAE5D,EAAM,iBAAU,MAAM;AACpB,eAAW,IAAI;AACf,aAAS,IAAI;AAEb,aAAS,IAAI,EACV,KAAK,CAAC,cAAc;AACnB,uBAAiB,MAAM,SAAS;AAChC,iBAAW,KAAK;AAAA,IAClB,CAAC,EACA,MAAM,CAAC,QAAQ;AACd,cAAQ,KAAK,IAAI,OAAO;AACxB,eAAS,IAAI,OAAO;AACpB,iBAAW,KAAK;AAAA,IAClB,CAAC;AAAA,EACL,GAAG,CAAC,IAAI,CAAC;AAET,MAAI,SAAS;AACX,WAAO;AAAA,EACT;AAEA,MAAI,SAAS,CAAC,eAAe;AAC3B,WAAO;AAAA,EACT;AAGA,QAAM,QAAQ,QACV,EAAE,GAAG,MAAM,OAAO,MAAM,IACxB,MAAM;AAEV,SAAO,qCAAC,iBAAc,MAAa,GAAG,OAAO,OAAc;AAC7D;AAEA,IAAO,eAAQ;;;ADtEf;","names":["React","React","React"]}
|
|
1
|
+
{"version":3,"sources":["../../src/shared/types.ts","../../src/react/ArrowLeft.tsx","../../src/react/ArrowUpRight.tsx","../../src/react/Check.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 SvgCheck = ({ 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=\"M20.7071 5.29289C21.0976 5.68342 21.0976 6.31658 20.7071 6.70711L9.70711 17.7071C9.31658 18.0976 8.68342 18.0976 8.29289 17.7071L3.29289 12.7071C2.90237 12.3166 2.90237 11.6834 3.29289 11.2929C3.68342 10.9024 4.31658 10.9024 4.70711 11.2929L9 15.5858L19.2929 5.29289C19.6834 4.90237 20.3166 4.90237 20.7071 5.29289Z\"\n fill=\"currentColor\"\n />\n </svg>\n );\n};\n\nexport default SvgCheck;\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 Check } from './Check';\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: check\n// Icon: icon-slot\n\n/**\n * Available icon names\n */\nexport type IconName = 'arrow-left' | 'arrow-up-right' | 'check' | '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 'check':\n return import('./Check').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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCO,SAAS,YAAY,OAAiB,MAAc;AACzD,MAAI,OAAO,SAAS,UAAU;AAC5B,WAAO;AAAA,EACT;AAEA,SAAO,WAAW,IAAI,KAAK,WAAW;AACxC;AA/CA,IAKa;AALb;AAAA;AAAA;AAKO,IAAM,aAAa;AAAA,MACxB,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,IACN;AAAA;AAAA;;;ACXA;AAAA;AAAA;AAAA;AAAA,WAIM,cAqBC;AAzBP;AAAA;AAAA;AAAA,YAAuB;AAEvB;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AAU,IAAU,gBAAS,IAAI;AACjD,QAAM,CAAC,OAAO,QAAQ,IAAU,gBAAwB,IAAI;AAE5D,EAAM,iBAAU,MAAM;AACpB,eAAW,IAAI;AACf,aAAS,IAAI;AAEb,aAAS,IAAI,EACV,KAAK,CAAC,cAAc;AACnB,uBAAiB,MAAM,SAAS;AAChC,iBAAW,KAAK;AAAA,IAClB,CAAC,EACA,MAAM,CAAC,QAAQ;AACd,cAAQ,KAAK,IAAI,OAAO;AACxB,eAAS,IAAI,OAAO;AACpB,iBAAW,KAAK;AAAA,IAClB,CAAC;AAAA,EACL,GAAG,CAAC,IAAI,CAAC;AAET,MAAI,SAAS;AACX,WAAO;AAAA,EACT;AAEA,MAAI,SAAS,CAAC,eAAe;AAC3B,WAAO;AAAA,EACT;AAGA,QAAM,QAAQ,QACV,EAAE,GAAG,MAAM,OAAO,MAAM,IACxB,MAAM;AAEV,SAAO,qCAAC,iBAAc,MAAa,GAAG,OAAO,OAAc;AAC7D;AAEA,IAAO,eAAQ;;;ADxEf;","names":["React","React","React","React"]}
|
package/dist/react/index.mjs
CHANGED
|
@@ -99,12 +99,39 @@ var init_ArrowUpRight = __esm({
|
|
|
99
99
|
}
|
|
100
100
|
});
|
|
101
101
|
|
|
102
|
+
// src/react/Check.tsx
|
|
103
|
+
var Check_exports = {};
|
|
104
|
+
__export(Check_exports, {
|
|
105
|
+
default: () => Check_default
|
|
106
|
+
});
|
|
107
|
+
import * as React3 from "react";
|
|
108
|
+
var SvgCheck, Check_default;
|
|
109
|
+
var init_Check = __esm({
|
|
110
|
+
"src/react/Check.tsx"() {
|
|
111
|
+
"use strict";
|
|
112
|
+
init_types();
|
|
113
|
+
SvgCheck = ({ size = 16, ...props }) => {
|
|
114
|
+
const sizeValue = resolveSize(size);
|
|
115
|
+
return /* @__PURE__ */ React3.createElement("svg", { width: sizeValue, height: sizeValue, viewBox: "0 0 24 24", fill: "none", ...props }, /* @__PURE__ */ React3.createElement(
|
|
116
|
+
"path",
|
|
117
|
+
{
|
|
118
|
+
fillRule: "evenodd",
|
|
119
|
+
clipRule: "evenodd",
|
|
120
|
+
d: "M20.7071 5.29289C21.0976 5.68342 21.0976 6.31658 20.7071 6.70711L9.70711 17.7071C9.31658 18.0976 8.68342 18.0976 8.29289 17.7071L3.29289 12.7071C2.90237 12.3166 2.90237 11.6834 3.29289 11.2929C3.68342 10.9024 4.31658 10.9024 4.70711 11.2929L9 15.5858L19.2929 5.29289C19.6834 4.90237 20.3166 4.90237 20.7071 5.29289Z",
|
|
121
|
+
fill: "currentColor"
|
|
122
|
+
}
|
|
123
|
+
));
|
|
124
|
+
};
|
|
125
|
+
Check_default = SvgCheck;
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
|
|
102
129
|
// src/react/IconSlot.tsx
|
|
103
130
|
var IconSlot_exports = {};
|
|
104
131
|
__export(IconSlot_exports, {
|
|
105
132
|
default: () => IconSlot_default
|
|
106
133
|
});
|
|
107
|
-
import * as
|
|
134
|
+
import * as React4 from "react";
|
|
108
135
|
var SvgIconSlot, IconSlot_default;
|
|
109
136
|
var init_IconSlot = __esm({
|
|
110
137
|
"src/react/IconSlot.tsx"() {
|
|
@@ -112,7 +139,7 @@ var init_IconSlot = __esm({
|
|
|
112
139
|
init_types();
|
|
113
140
|
SvgIconSlot = ({ size = 16, ...props }) => {
|
|
114
141
|
const sizeValue = resolveSize(size);
|
|
115
|
-
return /* @__PURE__ */
|
|
142
|
+
return /* @__PURE__ */ React4.createElement("svg", { width: sizeValue, height: sizeValue, viewBox: "0 0 15 15", fill: "none", ...props }, /* @__PURE__ */ React4.createElement(
|
|
116
143
|
"path",
|
|
117
144
|
{
|
|
118
145
|
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",
|
|
@@ -127,16 +154,19 @@ var init_IconSlot = __esm({
|
|
|
127
154
|
// src/react/index.ts
|
|
128
155
|
init_ArrowLeft();
|
|
129
156
|
init_ArrowUpRight();
|
|
157
|
+
init_Check();
|
|
130
158
|
init_IconSlot();
|
|
131
159
|
|
|
132
160
|
// src/react/Icon.tsx
|
|
133
|
-
import * as
|
|
161
|
+
import * as React5 from "react";
|
|
134
162
|
function loadIcon(name) {
|
|
135
163
|
switch (name) {
|
|
136
164
|
case "arrow-left":
|
|
137
165
|
return Promise.resolve().then(() => (init_ArrowLeft(), ArrowLeft_exports)).then((m) => m.default);
|
|
138
166
|
case "arrow-up-right":
|
|
139
167
|
return Promise.resolve().then(() => (init_ArrowUpRight(), ArrowUpRight_exports)).then((m) => m.default);
|
|
168
|
+
case "check":
|
|
169
|
+
return Promise.resolve().then(() => (init_Check(), Check_exports)).then((m) => m.default);
|
|
140
170
|
case "icon-slot":
|
|
141
171
|
return Promise.resolve().then(() => (init_IconSlot(), IconSlot_exports)).then((m) => m.default);
|
|
142
172
|
default:
|
|
@@ -144,10 +174,10 @@ function loadIcon(name) {
|
|
|
144
174
|
}
|
|
145
175
|
}
|
|
146
176
|
var Icon = ({ name, size = 16, color, ...props }) => {
|
|
147
|
-
const [IconComponent, setIconComponent] =
|
|
148
|
-
const [loading, setLoading] =
|
|
149
|
-
const [error, setError] =
|
|
150
|
-
|
|
177
|
+
const [IconComponent, setIconComponent] = React5.useState(null);
|
|
178
|
+
const [loading, setLoading] = React5.useState(true);
|
|
179
|
+
const [error, setError] = React5.useState(null);
|
|
180
|
+
React5.useEffect(() => {
|
|
151
181
|
setLoading(true);
|
|
152
182
|
setError(null);
|
|
153
183
|
loadIcon(name).then((Component) => {
|
|
@@ -166,7 +196,7 @@ var Icon = ({ name, size = 16, color, ...props }) => {
|
|
|
166
196
|
return null;
|
|
167
197
|
}
|
|
168
198
|
const style = color ? { ...props.style, color } : props.style;
|
|
169
|
-
return /* @__PURE__ */
|
|
199
|
+
return /* @__PURE__ */ React5.createElement(IconComponent, { size, ...props, style });
|
|
170
200
|
};
|
|
171
201
|
var Icon_default = Icon;
|
|
172
202
|
|
|
@@ -175,6 +205,7 @@ init_types();
|
|
|
175
205
|
export {
|
|
176
206
|
ArrowLeft_default as ArrowLeft,
|
|
177
207
|
ArrowUpRight_default as ArrowUpRight,
|
|
208
|
+
Check_default as Check,
|
|
178
209
|
ICON_SIZES,
|
|
179
210
|
Icon_default as Icon,
|
|
180
211
|
IconSlot_default as IconSlot,
|
package/dist/react/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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":";;;;;;;;;;;AAyCO,SAAS,YAAY,OAAiB,MAAc;AACzD,MAAI,OAAO,SAAS,UAAU;AAC5B,WAAO;AAAA,EACT;AAEA,SAAO,WAAW,IAAI,KAAK,WAAW;AACxC;AA/CA,IAKa;AALb;AAAA;AAAA;AAKO,IAAM,aAAa;AAAA,MACxB,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,IACN;AAAA;AAAA;;;ACXA;AAAA;AAAA;AAAA;AAAA,YAAY,WAAW;AAAvB,IAIM,cAqBC;AAzBP;AAAA;AAAA;AAEA;AAEA,IAAM,eAAe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AAC7D;AAEA,IAAO,eAAQ;;;ADtEf;","names":["React","React","React"]}
|
|
1
|
+
{"version":3,"sources":["../../src/shared/types.ts","../../src/react/ArrowLeft.tsx","../../src/react/ArrowUpRight.tsx","../../src/react/Check.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 SvgCheck = ({ 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=\"M20.7071 5.29289C21.0976 5.68342 21.0976 6.31658 20.7071 6.70711L9.70711 17.7071C9.31658 18.0976 8.68342 18.0976 8.29289 17.7071L3.29289 12.7071C2.90237 12.3166 2.90237 11.6834 3.29289 11.2929C3.68342 10.9024 4.31658 10.9024 4.70711 11.2929L9 15.5858L19.2929 5.29289C19.6834 4.90237 20.3166 4.90237 20.7071 5.29289Z\"\n fill=\"currentColor\"\n />\n </svg>\n );\n};\n\nexport default SvgCheck;\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 Check } from './Check';\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: check\n// Icon: icon-slot\n\n/**\n * Available icon names\n */\nexport type IconName = 'arrow-left' | 'arrow-up-right' | 'check' | '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 'check':\n return import('./Check').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":";;;;;;;;;;;AAyCO,SAAS,YAAY,OAAiB,MAAc;AACzD,MAAI,OAAO,SAAS,UAAU;AAC5B,WAAO;AAAA,EACT;AAEA,SAAO,WAAW,IAAI,KAAK,WAAW;AACxC;AA/CA,IAKa;AALb;AAAA;AAAA;AAKO,IAAM,aAAa;AAAA,MACxB,IAAI;AAA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M,MAAiB;AAChE,QAAM,CAAC,eAAe,gBAAgB,IAAU,gBAA0C,IAAI;AAC9F,QAAM,CAAC,SAAS,UAAU,IAAU,gBAAS,IAAI;AACjD,QAAM,CAAC,OAAO,QAAQ,IAAU,gBAAwB,IAAI;AAE5D,EAAM,iBAAU,MAAM;AACpB,eAAW,IAAI;AACf,aAAS,IAAI;AAEb,aAAS,IAAI,EACV,KAAK,CAAC,cAAc;AACnB,uBAAiB,MAAM,SAAS;AAChC,iBAAW,KAAK;AAAA,IAClB,CAAC,EACA,MAAM,CAAC,QAAQ;AACd,cAAQ,KAAK,IAAI,OAAO;AACxB,eAAS,IAAI,OAAO;AACpB,iBAAW,KAAK;AAAA,IAClB,CAAC;AAAA,EACL,GAAG,CAAC,IAAI,CAAC;AAET,MAAI,SAAS;AACX,WAAO;AAAA,EACT;AAEA,MAAI,SAAS,CAAC,eAAe;AAC3B,WAAO;AAAA,EACT;AAGA,QAAM,QAAQ,QACV,EAAE,GAAG,MAAM,OAAO,MAAM,IACxB,MAAM;AAEV,SAAO,qCAAC,iBAAc,MAAa,GAAG,OAAO,OAAc;AAC7D;AAEA,IAAO,eAAQ;;;ADxEf;","names":["React","React","React","React"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "huspy-icons",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Cross-platform icon package for Huspy - React and React Native compatible",
|
|
5
5
|
"author": "Huspy",
|
|
6
6
|
"license": "MIT",
|
|
@@ -28,7 +28,9 @@
|
|
|
28
28
|
"types": "./dist/native/index.d.ts",
|
|
29
29
|
"require": "./dist/native/index.js",
|
|
30
30
|
"default": "./dist/native/index.js"
|
|
31
|
-
}
|
|
31
|
+
},
|
|
32
|
+
"./dist/fonts/*": "./dist/fonts/*",
|
|
33
|
+
"./fonts/*": "./dist/fonts/*"
|
|
32
34
|
},
|
|
33
35
|
"files": [
|
|
34
36
|
"dist",
|
package/src/native/glyphMap.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* Available icon names in the HuspyIcons font
|
|
6
6
|
*/
|
|
7
|
-
export type IconName = 'icon-slot' | 'arrow-up-right' | 'arrow-left';
|
|
7
|
+
export type IconName = 'icon-slot' | 'check' | 'arrow-up-right' | 'arrow-left';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Mapping of icon names to unicode codepoints
|
|
@@ -12,8 +12,9 @@ export type IconName = 'icon-slot' | 'arrow-up-right' | 'arrow-left';
|
|
|
12
12
|
*/
|
|
13
13
|
export const glyphMap: Record<IconName, number> = {
|
|
14
14
|
"icon-slot": 61697,
|
|
15
|
-
"
|
|
16
|
-
"arrow-
|
|
15
|
+
"check": 61698,
|
|
16
|
+
"arrow-up-right": 61699,
|
|
17
|
+
"arrow-left": 61700
|
|
17
18
|
};
|
|
18
19
|
|
|
19
20
|
/**
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { ReactIconProps } from '../shared/types';
|
|
3
|
+
import { resolveSize } from '../shared/types';
|
|
4
|
+
|
|
5
|
+
const SvgCheck = ({ size = 16, ...props }: ReactIconProps) => {
|
|
6
|
+
const sizeValue = resolveSize(size);
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
<svg width={sizeValue} height={sizeValue} viewBox="0 0 24 24" fill="none" {...props}>
|
|
10
|
+
<path
|
|
11
|
+
fillRule="evenodd"
|
|
12
|
+
clipRule="evenodd"
|
|
13
|
+
d="M20.7071 5.29289C21.0976 5.68342 21.0976 6.31658 20.7071 6.70711L9.70711 17.7071C9.31658 18.0976 8.68342 18.0976 8.29289 17.7071L3.29289 12.7071C2.90237 12.3166 2.90237 11.6834 3.29289 11.2929C3.68342 10.9024 4.31658 10.9024 4.70711 11.2929L9 15.5858L19.2929 5.29289C19.6834 4.90237 20.3166 4.90237 20.7071 5.29289Z"
|
|
14
|
+
fill="currentColor"
|
|
15
|
+
/>
|
|
16
|
+
</svg>
|
|
17
|
+
);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default SvgCheck;
|
package/src/react/Icon.tsx
CHANGED
|
@@ -7,12 +7,13 @@ import type { ReactIconProps } from '../shared/types';
|
|
|
7
7
|
*/
|
|
8
8
|
// Icon: arrow-left
|
|
9
9
|
// Icon: arrow-up-right
|
|
10
|
+
// Icon: check
|
|
10
11
|
// Icon: icon-slot
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Available icon names
|
|
14
15
|
*/
|
|
15
|
-
export type IconName = 'arrow-left' | 'arrow-up-right' | 'icon-slot';
|
|
16
|
+
export type IconName = 'arrow-left' | 'arrow-up-right' | 'check' | 'icon-slot';
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* Props for the unified Icon component
|
|
@@ -36,6 +37,8 @@ function loadIcon(name: IconName): Promise<React.ComponentType<any>> {
|
|
|
36
37
|
return import('./ArrowLeft').then(m => m.default);
|
|
37
38
|
case 'arrow-up-right':
|
|
38
39
|
return import('./ArrowUpRight').then(m => m.default);
|
|
40
|
+
case 'check':
|
|
41
|
+
return import('./Check').then(m => m.default);
|
|
39
42
|
case 'icon-slot':
|
|
40
43
|
return import('./IconSlot').then(m => m.default);
|
|
41
44
|
default:
|
package/src/react/index.ts
CHANGED
package/src/react/index.tsx
CHANGED