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 CHANGED
@@ -1,220 +1,265 @@
1
1
  # huspy-icons
2
2
 
3
- A cross-platform icon package generated from raw SVGs. Ships separate builds for **web (React / Next.js)** and **native (Expo / React Native)** with a consistent API and first-class tree-shaking.
3
+ A cross-platform icon package generated from raw SVGs. Ships separate builds for **web (React / Next.js)** with **SVG icons** and **native (Expo / React Native)** with **font-based icons** for optimal performance.
4
4
 
5
5
  ---
6
6
 
7
7
  ## ✨ Features
8
8
 
9
9
  * **Single source of truth**: raw SVGs → codegen → typed components
10
- * **Two targets**: `huspy-icons/react` (web) and `huspy-icons/native` (expo)
11
- * **Tree-shakable** per-icon files for optimal bundle size
12
- * **Theming ready**: `color="currentColor"` by default; size tokens
13
- * **A11y** for web (`title`, `aria-hidden`) and native (`accessibilityLabel`)
14
- * **Scales** to hundreds of icons with auto-generated exports and types
10
+ * **Two rendering strategies**:
11
+ - **Web**: Inline SVG (tree-shakable, full styling control)
12
+ - **Native**: Font-based icons (better performance, smaller bundle)
13
+ * **Unified API**: Same `<Icon name="..." />` syntax for both platforms
14
+ * **TypeScript-first**: Auto-generated types with full autocomplete
15
+ * **Theming ready**: `color` and `size` props on all icons
16
+ * **A11y**: Proper accessibility labels for both platforms
17
+ * **Scales**: Hundreds of icons with auto-generated exports
15
18
 
16
19
  ---
17
20
 
18
- ## 📦 Install
21
+ ## 📦 Installation
19
22
 
20
- > Publish this package to your registry (npm/GitHub Packages) and install in each app.
21
-
22
- **Next.js (web):**
23
+ **Next.js / React (Web):**
23
24
 
24
25
  ```bash
25
26
  npm install huspy-icons
26
27
  ```
27
28
 
28
- **Expo (native):**
29
+ **Expo / React Native:**
29
30
 
30
31
  ```bash
31
- npx expo install react-native-svg
32
32
  npm install huspy-icons
33
33
  ```
34
34
 
35
- > `react` build has no extra peer deps. `native` build peers `react-native-svg`.
35
+ > **Note**: Native build uses custom fonts - no need for `react-native-svg`!
36
+ > See [FONT_SETUP.md](./FONT_SETUP.md) for font installation instructions.
36
37
 
37
38
  ---
38
39
 
39
40
  ## 🚀 Quick Start
40
41
 
41
- **Web (React / Next.js)**
42
+ ### Web (React / Next.js)
42
43
 
43
44
  ```tsx
44
- import { ArrowLeft } from 'huspy-icons/react';
45
+ import { Icon } from 'huspy-icons/react';
45
46
 
46
47
  export default function Example() {
47
48
  return (
48
- <div style={{ color: '#111' }}>
49
- <ArrowLeft size="md" />
49
+ <div>
50
+ <Icon name="arrow-left" size={24} color="#000" />
51
+ <Icon name="arrow-up-right" size={32} color="#6b7280" />
50
52
  </div>
51
53
  );
52
54
  }
53
55
  ```
54
56
 
55
- **Expo (React Native)**
57
+ ### Expo / React Native
58
+
59
+ **1. First, set up the font** (one-time setup):
60
+
61
+ See [FONT_SETUP.md](./FONT_SETUP.md) for detailed instructions.
62
+
63
+ **2. Use the icons:**
56
64
 
57
65
  ```tsx
58
- import { ArrowLeft } from 'huspy-icons/native';
66
+ import { Icon } from 'huspy-icons/native';
59
67
 
60
68
  export default function Example() {
61
- return <ArrowLeft size={20} color="#111" accessibilityLabel="Back" />;
69
+ return (
70
+ <>
71
+ <Icon name="arrow-left" size={24} color="#000" />
72
+ <Icon name="arrow-up-right" size={32} color="#6b7280" />
73
+ </>
74
+ );
62
75
  }
63
76
  ```
64
77
 
65
78
  ---
66
79
 
67
- ## 🗂️ Repo Structure (package)
68
-
69
- ```
70
- packages/huspy-icons/
71
- icons-src/ # raw .svg files (single source of truth)
72
- src/
73
- react/ # generated TSX for web
74
- native/ # generated TSX for expo
75
- shared/ # helper types/utilities (createIcon, resolveSize)
76
- scripts/ # codegen utilities (svgr, registry, typedefs)
77
- svgo.config.js
78
- package.json
79
- tsconfig.json
80
- ```
81
-
82
- ---
80
+ ## 🎨 API
83
81
 
84
- ## ⚙️ Scripts
82
+ Both platforms use the same API:
85
83
 
86
- ```json
87
- {
88
- "scripts": {
89
- "svgo": "svgo -f icons-src -o icons-src --config=svgo.config.js",
90
- "gen:react": "svgr icons-src -d src/react --ext tsx --typescript --icon",
91
- "gen:native": "svgr --native icons-src -d src/native --ext tsx --typescript --icon",
92
- "gen": "npm run svgo && npm run gen:react && npm run gen:native",
93
- "build": "tsup src/**/index.ts --format esm,cjs --dts --out-dir dist --clean",
94
- "prepare": "npm run gen && npm run build"
95
- }
96
- }
84
+ ```tsx
85
+ <Icon
86
+ name="arrow-left" // Icon name (TypeScript autocomplete available)
87
+ size={24} // Size in pixels (default: 16)
88
+ color="#000" // Any valid color (default: 'currentColor' for web, '#000' for native)
89
+ />
97
90
  ```
98
91
 
99
- * **`svgo`**: normalize SVGs (remove width/height, hardcoded colors).
100
- * **`gen:*`**: generate typed components for each target using SVGR.
101
- * **`build`**: bundle per-target outputs with types.
92
+ ### Available Icons
102
93
 
103
- ---
94
+ TypeScript will autocomplete available icon names. Current icons:
95
+ - `arrow-left`
96
+ - `arrow-up-right`
97
+ - `icon-slot`
104
98
 
105
- ## 🔁 Usage Patterns
99
+ ---
106
100
 
107
- ### Named components (preferred)
101
+ ## 🏗️ Architecture
108
102
 
109
- ```tsx
110
- import { ArrowLeft, ArrowUpRight } from 'huspy-icons/react';
111
- <ArrowLeft size="lg" />
112
- <ArrowUpRight size={20} color="#6b7280" />
113
- ```
103
+ ### Web (SVG-based)
104
+ - Individual SVG components generated from source files
105
+ - Tree-shakable - only icons you use are bundled
106
+ - Full CSS styling support
107
+ - Color inherits from parent by default (`currentColor`)
114
108
 
115
- * Best **tree-shaking**, great DX, no runtime lookup.
109
+ ### Native (Font-based)
110
+ - Custom font generated from SVG files
111
+ - Single font file for all icons
112
+ - Better performance than SVG rendering
113
+ - Smaller bundle size for large icon sets
114
+ - Uses React Native `Text` component
116
115
 
117
116
  ---
118
117
 
119
- ## 🎨 Props & Theming
118
+ ## 🔧 Development
120
119
 
121
- All icons share a consistent API:
120
+ ### Adding New Icons
122
121
 
123
- * `size`: `number | 'xs' | 'sm' | 'md' | 'lg' | 'xl'` (defaults to `lg` ≈ 20)
124
- * `color`: any CSS color (web) or string color (native), defaults to `currentColor`
125
- * Web a11y: `title?`, `aria-hidden?` (decorative by default)
126
- * Native a11y: `accessibilityLabel?`
122
+ 1. Drop SVG files into `icons-src/` (24×24 viewBox recommended)
127
123
 
128
- > Because paths default to `currentColor`, icons inherit text color out of the box. Style a parent `color` (web) or pass `color` directly.
124
+ 2. Run codegen:
129
125
 
130
- ---
126
+ ```bash
127
+ npm run gen
128
+ ```
131
129
 
132
- ## ↔️ RTL & Logical Directions
130
+ This will:
131
+ - Optimize SVGs with SVGO
132
+ - Generate React components (web)
133
+ - Generate icon font + glyph map (native)
134
+ - Generate TypeScript types
133
135
 
134
- Icons are designed with logical naming. For RTL support:
136
+ 3. Build the package:
135
137
 
136
- ```tsx
137
- // web
138
- <div dir="rtl">
139
- <ArrowLeft />
140
- </div>
141
-
142
- // native
143
- <View style={{ transform: [{ scaleX: I18nManager.isRTL ? -1 : 1 }] }}>
144
- <ArrowLeft />
145
- </View>
138
+ ```bash
139
+ npm run build
146
140
  ```
147
141
 
148
- You can also add a `rtlFlip` prop or generate RTL variants if your design system requires them.
142
+ 4. Publish:
149
143
 
150
- ---
144
+ ```bash
145
+ npm version minor
146
+ npm publish
147
+ ```
151
148
 
152
- ## 🧩 Adding Icons
149
+ ### Project Structure
153
150
 
154
- 1. Drop raw SVGs into `icons-src/` (use 24×24 viewBox if possible).
151
+ ```
152
+ huspy-icons/
153
+ ├── icons-src/ # Source SVG files (single source of truth)
154
+ ├── src/
155
+ │ ├── react/ # Generated web components (SVG)
156
+ │ ├── native/ # Native Icon component (font-based)
157
+ │ └── shared/ # Shared types and utilities
158
+ ├── dist/
159
+ │ ├── fonts/ # Generated font files (TTF, WOFF, etc.)
160
+ │ ├── react/ # Built web components
161
+ │ └── native/ # Built native component
162
+ ├── scripts/
163
+ │ ├── generate-font.js # Font generation script (Fantasticon)
164
+ │ ├── generate-types.js # TypeScript type generation
165
+ │ └── add-size-prop.js # Post-processing for SVGR output
166
+ └── package.json
167
+ ```
155
168
 
156
- 2. Run codegen:
169
+ ### Available Scripts
157
170
 
158
- ```bash
159
- npm run gen
171
+ ```json
172
+ {
173
+ "svgo": "Optimize SVG files",
174
+ "gen:react": "Generate React/SVG components",
175
+ "gen:native": "Generate icon font and glyph map",
176
+ "gen:types": "Generate TypeScript types",
177
+ "gen": "Run all generation scripts",
178
+ "build": "Build TypeScript to JavaScript",
179
+ "prepare": "Full build (runs on npm install)"
180
+ }
160
181
  ```
161
182
 
162
- 3. Commit, version, and publish:
183
+ ---
184
+
185
+ ## 📦 Package Exports
163
186
 
164
- ```bash
165
- npm version minor
166
- npm publish --access public
187
+ ```json
188
+ {
189
+ "exports": {
190
+ "./react": {
191
+ "import": "./dist/react/index.mjs",
192
+ "require": "./dist/react/index.js",
193
+ "types": "./dist/react/index.d.ts"
194
+ },
195
+ "./native": {
196
+ "require": "./dist/native/index.js",
197
+ "types": "./dist/native/index.d.ts"
198
+ }
199
+ }
200
+ }
167
201
  ```
168
202
 
169
- > Filenames become component names: `arrow-left.svg` → `ArrowLeft.tsx`.
203
+ Usage:
204
+ ```tsx
205
+ // Web
206
+ import { Icon } from 'huspy-icons/react';
207
+
208
+ // Native
209
+ import { Icon } from 'huspy-icons/native';
210
+ ```
170
211
 
171
212
  ---
172
213
 
173
- ## 🧪 Testing
214
+ ## 🔒 Versioning
174
215
 
175
- * Snapshot a subset of icons to detect accidental path changes.
176
- * `tsd` tests for prop typing.
177
- * Lint rule to ensure all icons export from the barrel.
216
+ * **Patch**: Path tweaks, bug fixes, metadata changes
217
+ * **Minor**: New icons, non-breaking API additions
218
+ * **Major**: Icon removals/renames, breaking API changes
178
219
 
179
220
  ---
180
221
 
181
- ## 🧰 Troubleshooting
222
+ ## 🐛 Troubleshooting
182
223
 
183
- ### Next.js
224
+ ### Native: Font Not Loading
184
225
 
185
- * If using the **prebuilt** components (recommended), you **don't** need SVGR in the app.
186
- * Ensure the package exports are ESM/CJS as shipped by `tsup`. If you see "Cannot use import statement outside a module", align your Next.js transpilation or stick to ESM imports.
226
+ See [FONT_SETUP.md](./FONT_SETUP.md) for detailed setup instructions.
187
227
 
188
- ### Expo
228
+ Common issues:
229
+ - Font file not copied to correct location
230
+ - Font not registered in app config
231
+ - App not restarted after adding font
189
232
 
190
- * Ensure `react-native-svg` is installed via `npx expo install react-native-svg`.
191
- * If tree-shaking seems off in web builds via Expo Router, prefer the `react` entry for web.
233
+ ### Web: Icons Not Showing
192
234
 
193
- ---
194
-
195
- ## 📦 Exports
235
+ - Ensure you're importing from `huspy-icons/react`
236
+ - Check that the icon name is correct (TypeScript will help)
237
+ - Verify the package is installed and built
196
238
 
197
- ```json
198
- {
199
- "exports": {
200
- "./react": "./dist/react/index.js",
201
- "./native": "./dist/native/index.js"
202
- }
203
- }
204
- ```
239
+ ### TypeScript Errors
205
240
 
206
- * Web: `import { ArrowLeft, ArrowUpRight } from 'huspy-icons/react'`
207
- * Native: `import { ArrowLeft, ArrowUpRight } from 'huspy-icons/native'`
241
+ If you see type errors after adding new icons:
242
+ 1. Run `npm run gen` to regenerate types
243
+ 2. Restart your TypeScript server
244
+ 3. Check that the built files in `dist/` are up to date
208
245
 
209
246
  ---
210
247
 
211
- ## 🔒 Versioning
248
+ ## 🎯 Why This Architecture?
212
249
 
213
- * **Patch**: path tweaks, metadata fixes
214
- * **Minor**: new icons, non-breaking props
215
- * **Major**: removals/renames, breaking prop changes
250
+ ### Web uses SVG because:
251
+ - Tree-shakable (only bundle icons you use)
252
+ - Full CSS styling support
253
+ - ✅ Can animate individual paths
254
+ - ✅ No font loading required
255
+ - ✅ Modern browsers handle SVG efficiently
216
256
 
217
- Use Changesets or Conventional Commits to automate changelog and release tags.
257
+ ### Native uses Fonts because:
258
+ - ✅ Better performance at scale
259
+ - ✅ Smaller bundle size for large icon sets
260
+ - ✅ Native text rendering (faster than SVG)
261
+ - ✅ Single font file vs. many SVG components
262
+ - ✅ Consistent with native icon patterns
218
263
 
219
264
  ---
220
265
 
@@ -224,9 +269,19 @@ MIT © Huspy
224
269
 
225
270
  ---
226
271
 
227
- ## 💡 Notes
272
+ ## 💡 Best Practices
273
+
274
+ * Keep `icons-src/` clean and consistent (same viewBox, stroke width)
275
+ * Use descriptive, kebab-case filenames (`arrow-left.svg`, not `arrow.svg`)
276
+ * Default to outline style; namespace filled variants if needed
277
+ * Test icons on both platforms before publishing
278
+ * Document any platform-specific differences
279
+ * Consider publishing a Storybook for visual reference
280
+
281
+ ---
228
282
 
229
- * Keep `icons-src/` clean and consistent (same stroke width family, grid).
230
- * Default to outlines; if you ship `filled` variants, namespace as `HomeIcon` / `HomeFilledIcon` or `HomeIcon` with a `variant="filled"` prop (generated).
231
- * Consider publishing a Storybook or gallery page in your web app to preview all icons.
283
+ ## 🔗 Related Docs
232
284
 
285
+ - [FONT_SETUP.md](./FONT_SETUP.md) - React Native font setup guide
286
+ - [USAGE.md](./USAGE.md) - Detailed usage examples
287
+ - [PROJECT_SUMMARY.md](./PROJECT_SUMMARY.md) - Technical architecture
@@ -0,0 +1,28 @@
1
+ @font-face {
2
+ font-family: "HuspyIcons";
3
+ src: url(".//HuspyIcons.ttf?25d92884ac0b766c69d414744c2ffbc2") format("truetype"),
4
+ url(".//HuspyIcons.woff?25d92884ac0b766c69d414744c2ffbc2") format("woff"),
5
+ url(".//HuspyIcons.woff2?25d92884ac0b766c69d414744c2ffbc2") format("woff2"),
6
+ url(".//HuspyIcons.eot?25d92884ac0b766c69d414744c2ffbc2#iefix") format("embedded-opentype");
7
+ }
8
+
9
+ .icon:before {
10
+ font-family: HuspyIcons !important;
11
+ font-style: normal;
12
+ font-weight: normal !important;
13
+ font-variant: normal;
14
+ text-transform: none;
15
+ line-height: 1;
16
+ -webkit-font-smoothing: antialiased;
17
+ -moz-osx-font-smoothing: grayscale;
18
+ }
19
+
20
+ .icon.huspy-icon-icon-slot:before {
21
+ content: "\f101";
22
+ }
23
+ .icon.huspy-icon-arrow-up-right:before {
24
+ content: "\f102";
25
+ }
26
+ .icon.huspy-icon-arrow-left:before {
27
+ content: "\f103";
28
+ }
@@ -0,0 +1,9 @@
1
+ export enum HuspyIcons {
2
+ ArrowLeft = "HuspyIcons-arrow-left",
3
+ ArrowUpRight = "HuspyIcons-arrow-up-right",
4
+ IconSlot = "HuspyIcons-icon-slot"
5
+ }
6
+
7
+ export type HuspyIconsClassname = "HuspyIcons-arrow-left" | "HuspyIcons-arrow-up-right" | "HuspyIcons-icon-slot"
8
+ export type HuspyIconsIcon = "arrow-left" | "arrow-up-right" | "icon-slot"
9
+ export const HuspyIconsPrefix = "HuspyIcons-"
Binary file
@@ -0,0 +1,5 @@
1
+ {
2
+ "icon-slot": 61697,
3
+ "arrow-up-right": 61698,
4
+ "arrow-left": 61699
5
+ }
@@ -0,0 +1,21 @@
1
+ <?xml version="1.0" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
3
+ <svg xmlns="http://www.w3.org/2000/svg">
4
+ <defs>
5
+ <font id="HuspyIcons" horiz-adv-x="24">
6
+ <font-face font-family="HuspyIcons"
7
+ units-per-em="24" ascent="24"
8
+ descent="0" />
9
+ <missing-glyph horiz-adv-x="0" />
10
+ <glyph glyph-name="arrow-left"
11
+ unicode="&#xE000;"
12
+ horiz-adv-x="24" d="M12.7071 19.70711C13.0976 19.31658 13.0976 18.68342 12.7071 18.29289L6.41421 12L12.7071 5.7071C13.0976 5.3166 13.0976 4.6834 12.7071 4.2929C12.3166 3.9024 11.6834 3.9024 11.2929 4.2929L4.29289 11.2929C3.90237 11.6834 3.90237 12.3166 4.29289 12.7071L11.2929 19.70711C11.6834 20.09763 12.3166 20.09763 12.7071 19.70711zM4 12C4 12.5523 4.44772 13 5 13H19C19.5523 13 20 12.5523 20 12C20 11.4477 19.5523 11 19 11H5C4.44772 11 4 11.4477 4 12z" />
13
+ <glyph glyph-name="arrow-up-right"
14
+ unicode="&#xE001;"
15
+ horiz-adv-x="24" d="M6 17C6 17.55228 6.44772 18 7 18H17C17.5523 18 18 17.55228 18 17V7C18 6.4477 17.5523 6 17 6C16.4477 6 16 6.4477 16 7V16H7C6.44772 16 6 16.44772 6 17zM17.7071 17.70711C18.0976 17.31658 18.0976 16.68342 17.7071 16.29289L7.70711 6.2929C7.31658 5.9024 6.68342 5.9024 6.29289 6.2929C5.90237 6.6834 5.90237 7.3166 6.29289 7.7071L16.2929 17.70711C16.6834 18.09763 17.3166 18.09763 17.7071 17.70711z" />
16
+ <glyph glyph-name="icon-slot"
17
+ unicode="&#xE002;"
18
+ horiz-adv-x="15" d="M13.3333 7.66667C13.3333 10.98038 10.647 13.66667 7.33333 13.66667C4.01962 13.66667 1.33333 10.98038 1.33333 7.66667C1.33333 4.353 4.01962 1.6667 7.33333 1.6667C10.647 1.6667 13.3333 4.353 13.3333 7.66667zM14.6667 7.66667C14.6667 3.6166 11.3834 0.3333 7.33333 0.3333C3.28325 0.3333 0 3.6166 0 7.66667C0 11.71675 3.28325 15 7.33333 15C11.3834 15 14.6667 11.71675 14.6667 7.66667z" />
19
+ </font>
20
+ </defs>
21
+ </svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="0" height="0" style="display:none;"><symbol viewBox="0 0 24 24" id="HuspyIcons-arrow-left"><path fill-rule="evenodd" clip-rule="evenodd" 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" fill="currentColor"></path><path fill-rule="evenodd" clip-rule="evenodd" 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" fill="currentColor"></path></symbol><symbol viewBox="0 0 24 24" id="HuspyIcons-arrow-up-right"><path fill-rule="evenodd" clip-rule="evenodd" 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" fill="currentColor"></path><path fill-rule="evenodd" clip-rule="evenodd" 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" fill="currentColor"></path></symbol><symbol viewBox="0 0 15 15" id="HuspyIcons-icon-slot"><path 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" fill="currentColor"></path></symbol></svg>
@@ -0,0 +1,16 @@
1
+ export type HuspyIconsId =
2
+ | "icon-slot"
3
+ | "arrow-up-right"
4
+ | "arrow-left";
5
+
6
+ export enum HuspyIcons {
7
+ IconSlot = "icon-slot",
8
+ ArrowUpRight = "arrow-up-right",
9
+ ArrowLeft = "arrow-left",
10
+ }
11
+
12
+ export const HUSPY_ICONS_CODEPOINTS: { [key in HuspyIcons]: string } = {
13
+ [HuspyIcons.IconSlot]: "61697",
14
+ [HuspyIcons.ArrowUpRight]: "61698",
15
+ [HuspyIcons.ArrowLeft]: "61699",
16
+ };
Binary file
Binary file
Binary file
@@ -1,41 +1,47 @@
1
1
  import * as React from 'react';
2
+ import { TextProps } from 'react-native';
2
3
 
3
- type IconSize = number | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
4
4
  /**
5
- * Icon size presets
5
+ * Available icon names in the HuspyIcons font
6
6
  */
7
- declare const ICON_SIZES: {
8
- readonly xs: 8;
9
- readonly sm: 12;
10
- readonly md: 16;
11
- readonly lg: 20;
12
- readonly xl: 24;
13
- };
7
+ type IconName = 'icon-slot' | 'arrow-up-right' | 'arrow-left';
14
8
  /**
15
- * Icon size token type
9
+ * Mapping of icon names to unicode codepoints
10
+ * Used by the Icon component to render the correct glyph
16
11
  */
17
- type IconSizeToken = keyof typeof ICON_SIZES;
12
+ declare const glyphMap: Record<IconName, number>;
18
13
  /**
19
- * Props for React Native icons
14
+ * Font family name for React Native
20
15
  */
21
- interface NativeIconProps {
22
- size?: IconSize;
23
- width?: number;
24
- height?: number;
16
+ declare const fontFamily = "HuspyIcons";
17
+
18
+ /**
19
+ * Props for the Icon component (React Native)
20
+ */
21
+ interface IconProps extends Omit<TextProps, 'children'> {
22
+ /**
23
+ * Name of the icon to display
24
+ */
25
+ name: IconName;
26
+ /**
27
+ * Size of the icon (default: 16)
28
+ */
29
+ size?: number;
30
+ /**
31
+ * Color of the icon (default: inherits from parent or 'black')
32
+ */
25
33
  color?: string;
26
- style?: any;
27
34
  }
28
35
  /**
29
- * Resolves an icon size to a numeric value
30
- * @param size - Size value or token
31
- * @returns Numeric size in pixels
36
+ * Icon component for React Native
37
+ *
38
+ * Renders icons using a custom font (HuspyIcons)
39
+ *
40
+ * @example
41
+ * ```tsx
42
+ * <Icon name="arrow-left" size={24} color="#000" />
43
+ * ```
32
44
  */
33
- declare function resolveSize(size?: IconSize): number;
34
-
35
- declare const SvgArrowLeft: ({ size, ...props }: NativeIconProps) => React.JSX.Element;
36
-
37
- declare const SvgArrowUpRight: ({ size, ...props }: NativeIconProps) => React.JSX.Element;
38
-
39
- declare const SvgIconSlot: ({ size, ...props }: NativeIconProps) => React.JSX.Element;
45
+ declare const Icon: ({ name, size, color, style, ...props }: IconProps) => React.JSX.Element | null;
40
46
 
41
- export { SvgArrowLeft as ArrowLeft, SvgArrowUpRight as ArrowUpRight, ICON_SIZES, type IconSize, type IconSizeToken, SvgIconSlot as IconSlot, type NativeIconProps, resolveSize };
47
+ export { Icon, type IconName, type IconProps, fontFamily, glyphMap };