@hugeicons/react-native 1.0.0
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 +275 -0
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/types/components/HugeiconsIcon.d.ts +15 -0
- package/dist/cjs/types/create-hugeicon-singleton.d.ts +14 -0
- package/dist/cjs/types/index.d.ts +2 -0
- package/dist/components/HugeiconsIcon.js +21 -0
- package/dist/create-hugeicon-singleton.js +41 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/types/components/HugeiconsIcon.d.ts +15 -0
- package/dist/esm/types/create-hugeicon-singleton.d.ts +14 -0
- package/dist/esm/types/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/types/components/HugeiconsIcon.d.ts +15 -0
- package/dist/types/create-hugeicon-singleton.d.ts +14 -0
- package/dist/types/index.d.ts +19 -0
- package/package.json +57 -0
package/README.md
ADDED
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
# @hugeicons/react-native
|
|
4
|
+
|
|
5
|
+
> HugeIcons Pro React Native Component Library - Beautiful and customizable icons for your React Native applications
|
|
6
|
+
|
|
7
|
+
## What is HugeIcons?
|
|
8
|
+
|
|
9
|
+
HugeIcons is a comprehensive icon library designed for modern web and mobile applications. The free package includes 4,000+ carefully crafted icons in the Stroke Rounded style, while the pro version offers over 36,000 icons across 9 unique styles.
|
|
10
|
+
|
|
11
|
+
### Key Highlights
|
|
12
|
+
- **4,000+ Free Icons**: Extensive collection of Stroke Rounded icons covering essential UI elements, actions, and concepts
|
|
13
|
+
- **Pixel Perfect**: Every icon is crafted on a 24x24 pixel grid ensuring crisp, clear display at any size
|
|
14
|
+
- **Customizable**: Easily adjust colors, sizes, and styles to match your design needs
|
|
15
|
+
- **Regular Updates**: New icons added regularly to keep up with evolving design trends
|
|
16
|
+
|
|
17
|
+
> 📚 **Looking for Pro Icons?** Check out our comprehensive documentation at [docs.hugeicons.com](https://docs.hugeicons.com) for detailed information about pro icons, styles, and advanced usage.
|
|
18
|
+
|
|
19
|
+

|
|
20
|
+
|
|
21
|
+
## Table of Contents
|
|
22
|
+
- [What is HugeIcons?](#what-is-hugeicons)
|
|
23
|
+
- [Features](#features)
|
|
24
|
+
- [Installation](#installation)
|
|
25
|
+
- [Usage](#usage)
|
|
26
|
+
- [Props](#props)
|
|
27
|
+
- [Examples](#examples)
|
|
28
|
+
- [Basic Usage](#basic-usage)
|
|
29
|
+
- [Custom Size and Color](#custom-size-and-color)
|
|
30
|
+
- [Interactive Examples](#interactive-examples)
|
|
31
|
+
- [Performance](#performance)
|
|
32
|
+
- [Troubleshooting](#troubleshooting)
|
|
33
|
+
- [Platform Support](#platform-support)
|
|
34
|
+
- [Related Packages](#related-packages)
|
|
35
|
+
- [Pro Version](#pro-version)
|
|
36
|
+
- [License](#license)
|
|
37
|
+
- [Related](#related)
|
|
38
|
+
|
|
39
|
+
## Features
|
|
40
|
+
|
|
41
|
+
- 🎨 Customizable colors and sizes
|
|
42
|
+
- 💪 TypeScript support with full type definitions
|
|
43
|
+
- 🎯 Tree-shakeable for optimal bundle size
|
|
44
|
+
- 📱 Native SVG rendering for optimal performance
|
|
45
|
+
- âš¡ Lightweight and optimized
|
|
46
|
+
- 🔄 Alternate icon support for dynamic interactions
|
|
47
|
+
|
|
48
|
+
## Installation
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# Using npm
|
|
52
|
+
npm install @hugeicons/react-native @hugeicons/core-free-icons react-native-svg
|
|
53
|
+
|
|
54
|
+
# Using yarn
|
|
55
|
+
yarn add @hugeicons/react-native @hugeicons/core-free-icons react-native-svg
|
|
56
|
+
|
|
57
|
+
# Using pnpm
|
|
58
|
+
pnpm add @hugeicons/react-native @hugeicons/core-free-icons react-native-svg
|
|
59
|
+
|
|
60
|
+
# Using bun
|
|
61
|
+
bun add @hugeicons/react-native @hugeicons/core-free-icons react-native-svg
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Note: This package requires `react-native-svg` as a peer dependency. Make sure to follow the [react-native-svg installation instructions](https://github.com/react-native-svg/react-native-svg#installation) for your platform.
|
|
65
|
+
|
|
66
|
+
## Usage
|
|
67
|
+
|
|
68
|
+
```jsx
|
|
69
|
+
import { HugeiconsIcon } from '@hugeicons/react-native';
|
|
70
|
+
import { SearchIcon } from '@hugeicons/core-free-icons';
|
|
71
|
+
|
|
72
|
+
function MyComponent() {
|
|
73
|
+
return (
|
|
74
|
+
<HugeiconsIcon
|
|
75
|
+
icon={SearchIcon}
|
|
76
|
+
size={24}
|
|
77
|
+
color="black"
|
|
78
|
+
strokeWidth={1.5}
|
|
79
|
+
/>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Props
|
|
85
|
+
|
|
86
|
+
| Prop | Type | Default | Description |
|
|
87
|
+
|------|------|---------|-------------|
|
|
88
|
+
| `icon` | `[string, Record<string, any>][]` | Required | The main icon to display (array of SVG elements and their attributes) |
|
|
89
|
+
| `size` | `number \| string` | `24` | Icon size in pixels. Must be a positive number. String values will be parsed to numbers |
|
|
90
|
+
| `strokeWidth` | `number \| undefined` | `undefined` | Width of the icon strokes (works with stroke-style icons) |
|
|
91
|
+
| `altIcon` | `[string, Record<string, any>][]` | `undefined` | Alternative icon that can be used for states, interactions, or animations |
|
|
92
|
+
| `showAlt` | `boolean` | `false` | When true, displays the altIcon instead of the main icon |
|
|
93
|
+
| `color` | `string` | `black` | Icon color (any valid React Native color value) |
|
|
94
|
+
| `style` | `StyleProp<ViewStyle>` | - | Additional styles for the icon container |
|
|
95
|
+
|
|
96
|
+
Note:
|
|
97
|
+
- The component accepts all standard React Native View props which will be passed to the container View.
|
|
98
|
+
- The `size` prop accepts both numbers and strings, but strings will be parsed to numbers and must result in a positive number.
|
|
99
|
+
- Icon arrays are tuples of `[elementName: string, attributes: Record<string, any>][]` representing SVG elements.
|
|
100
|
+
|
|
101
|
+
## Examples
|
|
102
|
+
|
|
103
|
+
### Basic Usage
|
|
104
|
+
```jsx
|
|
105
|
+
import React from 'react';
|
|
106
|
+
import { View } from 'react-native';
|
|
107
|
+
import { HugeiconsIcon } from '@hugeicons/react-native';
|
|
108
|
+
import { SearchIcon } from '@hugeicons/core-free-icons';
|
|
109
|
+
|
|
110
|
+
function BasicExample() {
|
|
111
|
+
return (
|
|
112
|
+
<View>
|
|
113
|
+
<HugeiconsIcon icon={SearchIcon} />
|
|
114
|
+
</View>
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Custom Size and Color
|
|
120
|
+
```jsx
|
|
121
|
+
import React from 'react';
|
|
122
|
+
import { View } from 'react-native';
|
|
123
|
+
import { HugeiconsIcon } from '@hugeicons/react-native';
|
|
124
|
+
import { NotificationIcon } from '@hugeicons/core-free-icons';
|
|
125
|
+
|
|
126
|
+
function CustomExample() {
|
|
127
|
+
return (
|
|
128
|
+
<View>
|
|
129
|
+
<HugeiconsIcon
|
|
130
|
+
icon={NotificationIcon}
|
|
131
|
+
size={32}
|
|
132
|
+
color="#FF5733"
|
|
133
|
+
/>
|
|
134
|
+
</View>
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Interactive Examples
|
|
140
|
+
|
|
141
|
+
#### Search Bar with Clear Button
|
|
142
|
+
```jsx
|
|
143
|
+
import React, { useState } from 'react';
|
|
144
|
+
import { View, TextInput, TouchableOpacity, StyleSheet } from 'react-native';
|
|
145
|
+
import { HugeiconsIcon } from '@hugeicons/react-native';
|
|
146
|
+
import { SearchIcon, CloseCircleIcon } from '@hugeicons/core-free-icons';
|
|
147
|
+
|
|
148
|
+
function SearchExample() {
|
|
149
|
+
const [searchValue, setSearchValue] = useState('');
|
|
150
|
+
|
|
151
|
+
return (
|
|
152
|
+
<View style={styles.container}>
|
|
153
|
+
<TextInput
|
|
154
|
+
value={searchValue}
|
|
155
|
+
onChangeText={setSearchValue}
|
|
156
|
+
placeholder="Search..."
|
|
157
|
+
style={styles.input}
|
|
158
|
+
/>
|
|
159
|
+
<TouchableOpacity
|
|
160
|
+
onPress={() => searchValue.length > 0 && setSearchValue('')}
|
|
161
|
+
>
|
|
162
|
+
<HugeiconsIcon
|
|
163
|
+
icon={SearchIcon}
|
|
164
|
+
altIcon={CloseCircleIcon}
|
|
165
|
+
showAlt={searchValue.length > 0}
|
|
166
|
+
color="#666"
|
|
167
|
+
/>
|
|
168
|
+
</TouchableOpacity>
|
|
169
|
+
</View>
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
const styles = StyleSheet.create({
|
|
174
|
+
container: {
|
|
175
|
+
flexDirection: 'row',
|
|
176
|
+
alignItems: 'center',
|
|
177
|
+
paddingHorizontal: 16,
|
|
178
|
+
},
|
|
179
|
+
input: {
|
|
180
|
+
flex: 1,
|
|
181
|
+
height: 40,
|
|
182
|
+
marginRight: 8,
|
|
183
|
+
},
|
|
184
|
+
});
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
#### Theme Toggle
|
|
188
|
+
```jsx
|
|
189
|
+
import React, { useState } from 'react';
|
|
190
|
+
import { TouchableOpacity } from 'react-native';
|
|
191
|
+
import { HugeiconsIcon } from '@hugeicons/react-native';
|
|
192
|
+
import { SunIcon, MoonIcon } from '@hugeicons/core-free-icons';
|
|
193
|
+
|
|
194
|
+
function ThemeToggle() {
|
|
195
|
+
const [isDark, setIsDark] = useState(false);
|
|
196
|
+
|
|
197
|
+
return (
|
|
198
|
+
<TouchableOpacity onPress={() => setIsDark(!isDark)}>
|
|
199
|
+
<HugeiconsIcon
|
|
200
|
+
icon={SunIcon}
|
|
201
|
+
altIcon={MoonIcon}
|
|
202
|
+
showAlt={isDark}
|
|
203
|
+
color={isDark ? '#FFF' : '#000'}
|
|
204
|
+
/>
|
|
205
|
+
</TouchableOpacity>
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## Performance
|
|
211
|
+
|
|
212
|
+
- **Tree-shaking**: The package is fully tree-shakeable, ensuring only the icons you use are included in your final bundle
|
|
213
|
+
- **Native SVG Rendering**: Uses react-native-svg for optimal performance
|
|
214
|
+
- **Optimized SVGs**: All icons are optimized for size and performance
|
|
215
|
+
- **Code Splitting**: Icons can be easily code-split when using dynamic imports
|
|
216
|
+
|
|
217
|
+
## Troubleshooting
|
|
218
|
+
|
|
219
|
+
### Common Issues
|
|
220
|
+
|
|
221
|
+
1. **Icons not showing up?**
|
|
222
|
+
- Make sure you've installed both `@hugeicons/react-native` and `@hugeicons/core-free-icons`
|
|
223
|
+
- Verify that `react-native-svg` is properly installed and linked
|
|
224
|
+
- Check that icon names are correctly imported
|
|
225
|
+
|
|
226
|
+
2. **TypeScript errors?**
|
|
227
|
+
- Ensure your `tsconfig.json` includes the necessary type definitions
|
|
228
|
+
- Check that you're using the latest version of the package
|
|
229
|
+
|
|
230
|
+
3. **Bundle size concerns?**
|
|
231
|
+
- Use named imports instead of importing the entire icon set
|
|
232
|
+
- Implement code splitting for different sections of your app
|
|
233
|
+
|
|
234
|
+
4. **Android/iOS specific issues?**
|
|
235
|
+
- Make sure you've followed platform-specific setup for react-native-svg
|
|
236
|
+
- Check platform-specific color values are valid
|
|
237
|
+
|
|
238
|
+
## Platform Support
|
|
239
|
+
|
|
240
|
+
The library supports both iOS and Android through react-native-svg.
|
|
241
|
+
|
|
242
|
+
## Related Packages
|
|
243
|
+
|
|
244
|
+
- [@hugeicons/react](https://www.npmjs.com/package/@hugeicons/react) - React component
|
|
245
|
+
- [@hugeicons/vue](https://www.npmjs.com/package/@hugeicons/vue) - Vue component
|
|
246
|
+
- [@hugeicons/svelte](https://www.npmjs.com/package/@hugeicons/svelte) - Svelte component
|
|
247
|
+
- [@hugeicons/angular](https://www.npmjs.com/package/@hugeicons/angular) - Angular component
|
|
248
|
+
|
|
249
|
+
## Pro Version
|
|
250
|
+
|
|
251
|
+
> 🌟 **Want access to 36,000+ icons and 9 unique styles?**
|
|
252
|
+
> Check out our [Pro Version](https://hugeicons.com/pricing) and visit [docs.hugeicons.com](https://docs.hugeicons.com) for comprehensive documentation.
|
|
253
|
+
|
|
254
|
+
### Available Pro Styles
|
|
255
|
+
- **Stroke Styles**
|
|
256
|
+
- Stroke Rounded (`@hugeicons-pro/core-stroke-rounded`)
|
|
257
|
+
- Stroke Sharp (`@hugeicons-pro/core-stroke-sharp`)
|
|
258
|
+
- Stroke Standard (`@hugeicons-pro/core-stroke-standard`)
|
|
259
|
+
- **Solid Styles**
|
|
260
|
+
- Solid Rounded (`@hugeicons-pro/core-solid-rounded`)
|
|
261
|
+
- Solid Sharp (`@hugeicons-pro/core-solid-sharp`)
|
|
262
|
+
- Solid Standard (`@hugeicons-pro/core-solid-standard`)
|
|
263
|
+
- **Special Styles**
|
|
264
|
+
- Bulk Rounded (`@hugeicons-pro/core-bulk-rounded`)
|
|
265
|
+
- Duotone Rounded (`@hugeicons-pro/core-duotone-rounded`)
|
|
266
|
+
- Twotone Rounded (`@hugeicons-pro/core-twotone-rounded`)
|
|
267
|
+
|
|
268
|
+
## License
|
|
269
|
+
|
|
270
|
+
This project is licensed under the [MIT License](LICENSE.md).
|
|
271
|
+
|
|
272
|
+
## Related
|
|
273
|
+
|
|
274
|
+
- [@hugeicons/core-free-icons](https://www.npmjs.com/package/@hugeicons/core-free-icons) - Free icon package
|
|
275
|
+
- [HugeIcons Website](https://hugeicons.com) - Browse all available icons
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var e=require("react"),t=require("react-native-svg");function r(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]])}return r}"function"==typeof SuppressedError&&SuppressedError;const o={width:24,height:24,viewBox:"0 0 24 24",fill:"none"},n={svg:t.Svg,path:t.Path,circle:t.Circle,rect:t.Rect,line:t.Line,g:t.G},s=e.memo((s=>{var{icon:c}=s,i=r(s,["icon"]);const l=e.useMemo((()=>{return s=c,e.forwardRef(((c,i)=>{var{color:l="#000",size:a=24,strokeWidth:u,altIcon:p,showAlt:g=!1}=c,f=r(c,["color","size","strokeWidth","altIcon","showAlt"]);const h=g&&p?p:s,O=e.useMemo((()=>h.map((([t,r],o)=>{const s=n[t.toLowerCase()];return s?e.createElement(s,Object.assign(Object.assign({},r),{color:l,strokeWidth:null!=u?u:r.strokeWidth,fillRule:r.fillRule,key:`${t}-${o}`})):null}))),[h,l,u]);return e.createElement(t.Svg,Object.assign(Object.assign(Object.assign({ref:i},o),{width:a,height:a}),f),O)}));var s}),[c]);return e.createElement(l,Object.assign({},i))}));s.displayName="HugeiconsIcon",exports.HugeiconsIcon=s;
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../node_modules/.pnpm/@rollup+plugin-typescript@11.1.6_rollup@3.29.5_tslib@2.8.1_typescript@5.7.3/node_modules/tslib/tslib.es6.js","../../src/create-hugeicon-singleton.ts","../../src/components/HugeiconsIcon.tsx"],"sourcesContent":["/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\r\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\r\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nvar ownKeys = function(o) {\r\n ownKeys = Object.getOwnPropertyNames || function (o) {\r\n var ar = [];\r\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\r\n return ar;\r\n };\r\n return ownKeys(o);\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n\r\nexport function __addDisposableResource(env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\r\n var dispose, inner;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n if (async) inner = dispose;\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n\r\n}\r\n\r\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\r\n\r\nexport function __disposeResources(env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n var r, s = 0;\r\n function next() {\r\n while (r = env.stack.pop()) {\r\n try {\r\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\r\n if (r.dispose) {\r\n var result = r.dispose.call(r.value);\r\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n else s |= 1;\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n}\r\n\r\nexport function __rewriteRelativeImportExtension(path, preserveJsx) {\r\n if (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) {\r\n return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {\r\n return tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : (d + ext + \".\" + cm.toLowerCase() + \"js\");\r\n });\r\n }\r\n return path;\r\n}\r\n\r\nexport default {\r\n __extends: __extends,\r\n __assign: __assign,\r\n __rest: __rest,\r\n __decorate: __decorate,\r\n __param: __param,\r\n __esDecorate: __esDecorate,\r\n __runInitializers: __runInitializers,\r\n __propKey: __propKey,\r\n __setFunctionName: __setFunctionName,\r\n __metadata: __metadata,\r\n __awaiter: __awaiter,\r\n __generator: __generator,\r\n __createBinding: __createBinding,\r\n __exportStar: __exportStar,\r\n __values: __values,\r\n __read: __read,\r\n __spread: __spread,\r\n __spreadArrays: __spreadArrays,\r\n __spreadArray: __spreadArray,\r\n __await: __await,\r\n __asyncGenerator: __asyncGenerator,\r\n __asyncDelegator: __asyncDelegator,\r\n __asyncValues: __asyncValues,\r\n __makeTemplateObject: __makeTemplateObject,\r\n __importStar: __importStar,\r\n __importDefault: __importDefault,\r\n __classPrivateFieldGet: __classPrivateFieldGet,\r\n __classPrivateFieldSet: __classPrivateFieldSet,\r\n __classPrivateFieldIn: __classPrivateFieldIn,\r\n __addDisposableResource: __addDisposableResource,\r\n __disposeResources: __disposeResources,\r\n __rewriteRelativeImportExtension: __rewriteRelativeImportExtension,\r\n};\r\n","import React, { createElement, forwardRef, ForwardRefExoticComponent, useMemo } from 'react';\nimport {Circle, G, Line, Path, Rect, Svg, SvgProps} from 'react-native-svg';\n\nconst defaultAttributes = {\n width: 24,\n height: 24,\n viewBox: '0 0 24 24',\n fill: 'none',\n};\n\nexport type IconSvgElement = readonly (readonly [string, { readonly [key: string]: string | number }])[];\n\nexport interface HugeiconsProps extends SvgProps {\n size?: string | number;\n strokeWidth?: number;\n altIcon?: IconSvgElement;\n showAlt?: boolean;\n}\n\nexport type HugeiconsIcon = ForwardRefExoticComponent<HugeiconsProps>;\n\nconst SVGComponents: { [key: string]: any } = {\n svg: Svg,\n path: Path,\n circle: Circle,\n rect: Rect,\n line: Line,\n g: G,\n};\n\nconst createHugeiconSingleton = (\n iconName: string,\n svgElements: IconSvgElement,\n): React.FC<HugeiconsProps> => {\n return forwardRef<any, HugeiconsProps>(\n (\n {\n color = '#000',\n size = 24,\n strokeWidth,\n altIcon,\n showAlt = false,\n ...rest\n },\n ref,\n ) => {\n const currentIcon = showAlt && altIcon ? altIcon : svgElements;\n\n const svgChildren = useMemo(() => \n currentIcon.map(([tag, attrs], index) => {\n const SvgComponent = SVGComponents[tag.toLowerCase()];\n if (!SvgComponent) return null;\n\n return createElement(SvgComponent, {\n ...attrs,\n color: color,\n strokeWidth: strokeWidth ?? attrs.strokeWidth,\n fillRule: attrs.fillRule,\n key: `${tag}-${index}`,\n });\n }),\n [currentIcon, color, strokeWidth]\n );\n\n return createElement(\n Svg,\n {\n ref,\n ...defaultAttributes,\n width: size,\n height: size,\n ...rest,\n },\n svgChildren\n );\n }\n );\n};\n\nexport default createHugeiconSingleton; ","import React from 'react';\nimport { ColorValue } from 'react-native';\nimport { SvgProps } from 'react-native-svg';\nimport createHugeiconSingleton, { IconSvgElement } from '../create-hugeicon-singleton';\n\nexport type { IconSvgElement };\n\nexport interface HugeiconsProps extends Omit<SvgProps, 'color'> {\n icon: IconSvgElement;\n size?: string | number;\n strokeWidth?: number;\n altIcon?: IconSvgElement;\n showAlt?: boolean;\n color?: ColorValue;\n}\n\nexport const HugeiconsIcon = React.memo(({ icon, ...props }: HugeiconsProps) => {\n // Create a singleton component for this specific icon\n const IconComponent = React.useMemo(\n () => createHugeiconSingleton('dynamic-icon', icon),\n [icon]\n );\n\n return <IconComponent {...props} />;\n});\n\nHugeiconsIcon.displayName = 'HugeiconsIcon';\n\nexport default HugeiconsIcon; "],"names":["__rest","s","e","t","p","Object","prototype","hasOwnProperty","call","indexOf","getOwnPropertySymbols","i","length","propertyIsEnumerable","SuppressedError","defaultAttributes","width","height","viewBox","fill","SVGComponents","svg","Svg","path","Path","circle","Circle","rect","Rect","line","Line","g","G","HugeiconsIcon","React","memo","_a","icon","props","IconComponent","useMemo","createHugeiconSingleton","svgElements","forwardRef","ref","color","size","strokeWidth","altIcon","showAlt","rest","currentIcon","svgChildren","map","tag","attrs","index","SvgComponent","toLowerCase","createElement","assign","fillRule","key","displayName"],"mappings":"kEA0CO,SAASA,EAAOC,EAAGC,GACtB,IAAIC,EAAI,CAAA,EACR,IAAK,IAAIC,KAAKH,EAAOI,OAAOC,UAAUC,eAAeC,KAAKP,EAAGG,IAAMF,EAAEO,QAAQL,GAAK,IAC9ED,EAAEC,GAAKH,EAAEG,IACb,GAAS,MAALH,GAAqD,mBAAjCI,OAAOK,sBACtB,KAAIC,EAAI,EAAb,IAAgBP,EAAIC,OAAOK,sBAAsBT,GAAIU,EAAIP,EAAEQ,OAAQD,IAC3DT,EAAEO,QAAQL,EAAEO,IAAM,GAAKN,OAAOC,UAAUO,qBAAqBL,KAAKP,EAAGG,EAAEO,MACvER,EAAEC,EAAEO,IAAMV,EAAEG,EAAEO,IAF4B,CAItD,OAAOR,CACX,CAoRkD,mBAApBW,iBAAiCA,gBCrU/D,MAAMC,EAAoB,CACxBC,MAAO,GACPC,OAAQ,GACRC,QAAS,YACTC,KAAM,QAcFC,EAAwC,CAC5CC,IAAKC,EAAGA,IACRC,KAAMC,EAAIA,KACVC,OAAQC,EAAMA,OACdC,KAAMC,EAAIA,KACVC,KAAMC,EAAIA,KACVC,EAAGC,EAACA,GCXOC,EAAgBC,EAAMC,MAAMC,IAAA,IAAAC,KAAEA,GAAgCD,EAAvBE,EAAKtC,EAAAoC,EAAhB,UAEvC,MAAMG,EAAgBL,EAAMM,SAC1B,KAAMC,ODaRC,ECbgDL,EDezCM,EAAUA,YACf,CACEP,EAQAQ,SARAC,MACEA,EAAQ,OAAMC,KACdA,EAAO,GAAEC,YACTA,EAAWC,QACXA,EAAOC,QACPA,GAAU,GAAKb,EACZc,EAAIlD,EAAAoC,EANT,oDAUA,MAAMe,EAAcF,GAAWD,EAAUA,EAAUN,EAE7CU,EAAcZ,WAAQ,IAC1BW,EAAYE,KAAI,EAAEC,EAAKC,GAAQC,KAC7B,MAAMC,EAAerC,EAAckC,EAAII,eACvC,OAAKD,EAEEE,EAAAA,cAAcF,EAChBpD,OAAAuD,OAAAvD,OAAAuD,OAAA,CAAA,EAAAL,IACHV,MAAOA,EACPE,YAAaA,QAAAA,EAAeQ,EAAMR,YAClCc,SAAUN,EAAMM,SAChBC,IAAK,GAAGR,KAAOE,OAPS,IAQxB,KAEJ,CAACL,EAAaN,EAAOE,IAGvB,OAAOY,EAAaA,cAClBrC,MAAGjB,OAAAuD,OAAAvD,OAAAuD,OAAAvD,OAAAuD,OAAA,CAEDhB,OACG7B,IACHC,MAAO8B,EACP7B,OAAQ6B,IACLI,GAELE,EACD,IA5CyB,IAE9BV,CCbqD,GACnD,CAACL,IAGH,OAAOH,EAACyB,cAAApB,EAAkBlC,OAAAuD,OAAA,CAAA,EAAAtB,GAAS,IAGrCL,EAAc8B,YAAc","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ColorValue } from 'react-native';
|
|
3
|
+
import { SvgProps } from 'react-native-svg';
|
|
4
|
+
import { IconSvgElement } from '../create-hugeicon-singleton';
|
|
5
|
+
export type { IconSvgElement };
|
|
6
|
+
export interface HugeiconsProps extends Omit<SvgProps, 'color'> {
|
|
7
|
+
icon: IconSvgElement;
|
|
8
|
+
size?: string | number;
|
|
9
|
+
strokeWidth?: number;
|
|
10
|
+
altIcon?: IconSvgElement;
|
|
11
|
+
showAlt?: boolean;
|
|
12
|
+
color?: ColorValue;
|
|
13
|
+
}
|
|
14
|
+
export declare const HugeiconsIcon: React.MemoExoticComponent<({ icon, ...props }: HugeiconsProps) => React.JSX.Element>;
|
|
15
|
+
export default HugeiconsIcon;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React, { ForwardRefExoticComponent } from 'react';
|
|
2
|
+
import { SvgProps } from 'react-native-svg';
|
|
3
|
+
export type IconSvgElement = readonly (readonly [string, {
|
|
4
|
+
readonly [key: string]: string | number;
|
|
5
|
+
}])[];
|
|
6
|
+
export interface HugeiconsProps extends SvgProps {
|
|
7
|
+
size?: string | number;
|
|
8
|
+
strokeWidth?: number;
|
|
9
|
+
altIcon?: IconSvgElement;
|
|
10
|
+
showAlt?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export type HugeiconsIcon = ForwardRefExoticComponent<HugeiconsProps>;
|
|
13
|
+
declare const createHugeiconSingleton: (iconName: string, svgElements: IconSvgElement) => React.FC<HugeiconsProps>;
|
|
14
|
+
export default createHugeiconSingleton;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import createHugeiconSingleton from '../create-hugeicon-singleton';
|
|
14
|
+
export const HugeiconsIcon = React.memo((_a) => {
|
|
15
|
+
var { icon } = _a, props = __rest(_a, ["icon"]);
|
|
16
|
+
// Create a singleton component for this specific icon
|
|
17
|
+
const IconComponent = React.useMemo(() => createHugeiconSingleton('dynamic-icon', icon), [icon]);
|
|
18
|
+
return React.createElement(IconComponent, Object.assign({}, props));
|
|
19
|
+
});
|
|
20
|
+
HugeiconsIcon.displayName = 'HugeiconsIcon';
|
|
21
|
+
export default HugeiconsIcon;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { createElement, forwardRef, useMemo } from 'react';
|
|
13
|
+
import { Circle, G, Line, Path, Rect, Svg } from 'react-native-svg';
|
|
14
|
+
const defaultAttributes = {
|
|
15
|
+
width: 24,
|
|
16
|
+
height: 24,
|
|
17
|
+
viewBox: '0 0 24 24',
|
|
18
|
+
fill: 'none',
|
|
19
|
+
};
|
|
20
|
+
const SVGComponents = {
|
|
21
|
+
svg: Svg,
|
|
22
|
+
path: Path,
|
|
23
|
+
circle: Circle,
|
|
24
|
+
rect: Rect,
|
|
25
|
+
line: Line,
|
|
26
|
+
g: G,
|
|
27
|
+
};
|
|
28
|
+
const createHugeiconSingleton = (iconName, svgElements) => {
|
|
29
|
+
return forwardRef((_a, ref) => {
|
|
30
|
+
var { color = '#000', size = 24, strokeWidth, altIcon, showAlt = false } = _a, rest = __rest(_a, ["color", "size", "strokeWidth", "altIcon", "showAlt"]);
|
|
31
|
+
const currentIcon = showAlt && altIcon ? altIcon : svgElements;
|
|
32
|
+
const svgChildren = useMemo(() => currentIcon.map(([tag, attrs], index) => {
|
|
33
|
+
const SvgComponent = SVGComponents[tag.toLowerCase()];
|
|
34
|
+
if (!SvgComponent)
|
|
35
|
+
return null;
|
|
36
|
+
return createElement(SvgComponent, Object.assign(Object.assign({}, attrs), { color: color, strokeWidth: strokeWidth !== null && strokeWidth !== void 0 ? strokeWidth : attrs.strokeWidth, fillRule: attrs.fillRule, key: `${tag}-${index}` }));
|
|
37
|
+
}), [currentIcon, color, strokeWidth]);
|
|
38
|
+
return createElement(Svg, Object.assign(Object.assign(Object.assign({ ref }, defaultAttributes), { width: size, height: size }), rest), svgChildren);
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
export default createHugeiconSingleton;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import e,{forwardRef as t,useMemo as r,createElement as o}from"react";import{Svg as n,Path as s,Circle as i,Rect as c,Line as l,G as a}from"react-native-svg";function p(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]])}return r}"function"==typeof SuppressedError&&SuppressedError;const u={width:24,height:24,viewBox:"0 0 24 24",fill:"none"},f={svg:n,path:s,circle:i,rect:c,line:l,g:a},g=e.memo((s=>{var{icon:i}=s,c=p(s,["icon"]);const l=e.useMemo((()=>{return e=i,t(((t,s)=>{var{color:i="#000",size:c=24,strokeWidth:l,altIcon:a,showAlt:g=!1}=t,h=p(t,["color","size","strokeWidth","altIcon","showAlt"]);const O=g&&a?a:e,b=r((()=>O.map((([e,t],r)=>{const n=f[e.toLowerCase()];return n?o(n,Object.assign(Object.assign({},t),{color:i,strokeWidth:null!=l?l:t.strokeWidth,fillRule:t.fillRule,key:`${e}-${r}`})):null}))),[O,i,l]);return o(n,Object.assign(Object.assign(Object.assign({ref:s},u),{width:c,height:c}),h),b)}));var e}),[i]);return e.createElement(l,Object.assign({},c))}));g.displayName="HugeiconsIcon";export{g as HugeiconsIcon};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../node_modules/.pnpm/@rollup+plugin-typescript@11.1.6_rollup@3.29.5_tslib@2.8.1_typescript@5.7.3/node_modules/tslib/tslib.es6.js","../../src/create-hugeicon-singleton.ts","../../src/components/HugeiconsIcon.tsx"],"sourcesContent":["/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\r\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\r\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nvar ownKeys = function(o) {\r\n ownKeys = Object.getOwnPropertyNames || function (o) {\r\n var ar = [];\r\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\r\n return ar;\r\n };\r\n return ownKeys(o);\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n\r\nexport function __addDisposableResource(env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\r\n var dispose, inner;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n if (async) inner = dispose;\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n\r\n}\r\n\r\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\r\n\r\nexport function __disposeResources(env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n var r, s = 0;\r\n function next() {\r\n while (r = env.stack.pop()) {\r\n try {\r\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\r\n if (r.dispose) {\r\n var result = r.dispose.call(r.value);\r\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n else s |= 1;\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n}\r\n\r\nexport function __rewriteRelativeImportExtension(path, preserveJsx) {\r\n if (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) {\r\n return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {\r\n return tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : (d + ext + \".\" + cm.toLowerCase() + \"js\");\r\n });\r\n }\r\n return path;\r\n}\r\n\r\nexport default {\r\n __extends: __extends,\r\n __assign: __assign,\r\n __rest: __rest,\r\n __decorate: __decorate,\r\n __param: __param,\r\n __esDecorate: __esDecorate,\r\n __runInitializers: __runInitializers,\r\n __propKey: __propKey,\r\n __setFunctionName: __setFunctionName,\r\n __metadata: __metadata,\r\n __awaiter: __awaiter,\r\n __generator: __generator,\r\n __createBinding: __createBinding,\r\n __exportStar: __exportStar,\r\n __values: __values,\r\n __read: __read,\r\n __spread: __spread,\r\n __spreadArrays: __spreadArrays,\r\n __spreadArray: __spreadArray,\r\n __await: __await,\r\n __asyncGenerator: __asyncGenerator,\r\n __asyncDelegator: __asyncDelegator,\r\n __asyncValues: __asyncValues,\r\n __makeTemplateObject: __makeTemplateObject,\r\n __importStar: __importStar,\r\n __importDefault: __importDefault,\r\n __classPrivateFieldGet: __classPrivateFieldGet,\r\n __classPrivateFieldSet: __classPrivateFieldSet,\r\n __classPrivateFieldIn: __classPrivateFieldIn,\r\n __addDisposableResource: __addDisposableResource,\r\n __disposeResources: __disposeResources,\r\n __rewriteRelativeImportExtension: __rewriteRelativeImportExtension,\r\n};\r\n","import React, { createElement, forwardRef, ForwardRefExoticComponent, useMemo } from 'react';\nimport {Circle, G, Line, Path, Rect, Svg, SvgProps} from 'react-native-svg';\n\nconst defaultAttributes = {\n width: 24,\n height: 24,\n viewBox: '0 0 24 24',\n fill: 'none',\n};\n\nexport type IconSvgElement = readonly (readonly [string, { readonly [key: string]: string | number }])[];\n\nexport interface HugeiconsProps extends SvgProps {\n size?: string | number;\n strokeWidth?: number;\n altIcon?: IconSvgElement;\n showAlt?: boolean;\n}\n\nexport type HugeiconsIcon = ForwardRefExoticComponent<HugeiconsProps>;\n\nconst SVGComponents: { [key: string]: any } = {\n svg: Svg,\n path: Path,\n circle: Circle,\n rect: Rect,\n line: Line,\n g: G,\n};\n\nconst createHugeiconSingleton = (\n iconName: string,\n svgElements: IconSvgElement,\n): React.FC<HugeiconsProps> => {\n return forwardRef<any, HugeiconsProps>(\n (\n {\n color = '#000',\n size = 24,\n strokeWidth,\n altIcon,\n showAlt = false,\n ...rest\n },\n ref,\n ) => {\n const currentIcon = showAlt && altIcon ? altIcon : svgElements;\n\n const svgChildren = useMemo(() => \n currentIcon.map(([tag, attrs], index) => {\n const SvgComponent = SVGComponents[tag.toLowerCase()];\n if (!SvgComponent) return null;\n\n return createElement(SvgComponent, {\n ...attrs,\n color: color,\n strokeWidth: strokeWidth ?? attrs.strokeWidth,\n fillRule: attrs.fillRule,\n key: `${tag}-${index}`,\n });\n }),\n [currentIcon, color, strokeWidth]\n );\n\n return createElement(\n Svg,\n {\n ref,\n ...defaultAttributes,\n width: size,\n height: size,\n ...rest,\n },\n svgChildren\n );\n }\n );\n};\n\nexport default createHugeiconSingleton; ","import React from 'react';\nimport { ColorValue } from 'react-native';\nimport { SvgProps } from 'react-native-svg';\nimport createHugeiconSingleton, { IconSvgElement } from '../create-hugeicon-singleton';\n\nexport type { IconSvgElement };\n\nexport interface HugeiconsProps extends Omit<SvgProps, 'color'> {\n icon: IconSvgElement;\n size?: string | number;\n strokeWidth?: number;\n altIcon?: IconSvgElement;\n showAlt?: boolean;\n color?: ColorValue;\n}\n\nexport const HugeiconsIcon = React.memo(({ icon, ...props }: HugeiconsProps) => {\n // Create a singleton component for this specific icon\n const IconComponent = React.useMemo(\n () => createHugeiconSingleton('dynamic-icon', icon),\n [icon]\n );\n\n return <IconComponent {...props} />;\n});\n\nHugeiconsIcon.displayName = 'HugeiconsIcon';\n\nexport default HugeiconsIcon; "],"names":["__rest","s","e","t","p","Object","prototype","hasOwnProperty","call","indexOf","getOwnPropertySymbols","i","length","propertyIsEnumerable","SuppressedError","defaultAttributes","width","height","viewBox","fill","SVGComponents","svg","Svg","path","Path","circle","Circle","rect","Rect","line","Line","g","G","HugeiconsIcon","React","memo","_a","icon","props","IconComponent","useMemo","createHugeiconSingleton","svgElements","forwardRef","ref","color","size","strokeWidth","altIcon","showAlt","rest","currentIcon","svgChildren","map","tag","attrs","index","SvgComponent","toLowerCase","createElement","assign","fillRule","key","displayName"],"mappings":"8JA0CO,SAASA,EAAOC,EAAGC,GACtB,IAAIC,EAAI,CAAA,EACR,IAAK,IAAIC,KAAKH,EAAOI,OAAOC,UAAUC,eAAeC,KAAKP,EAAGG,IAAMF,EAAEO,QAAQL,GAAK,IAC9ED,EAAEC,GAAKH,EAAEG,IACb,GAAS,MAALH,GAAqD,mBAAjCI,OAAOK,sBACtB,KAAIC,EAAI,EAAb,IAAgBP,EAAIC,OAAOK,sBAAsBT,GAAIU,EAAIP,EAAEQ,OAAQD,IAC3DT,EAAEO,QAAQL,EAAEO,IAAM,GAAKN,OAAOC,UAAUO,qBAAqBL,KAAKP,EAAGG,EAAEO,MACvER,EAAEC,EAAEO,IAAMV,EAAEG,EAAEO,IAF4B,CAItD,OAAOR,CACX,CAoRkD,mBAApBW,iBAAiCA,gBCrU/D,MAAMC,EAAoB,CACxBC,MAAO,GACPC,OAAQ,GACRC,QAAS,YACTC,KAAM,QAcFC,EAAwC,CAC5CC,IAAKC,EACLC,KAAMC,EACNC,OAAQC,EACRC,KAAMC,EACNC,KAAMC,EACNC,EAAGC,GCXQC,EAAgBC,EAAMC,MAAMC,IAAA,IAAAC,KAAEA,GAAgCD,EAAvBE,EAAKtC,EAAAoC,EAAhB,UAEvC,MAAMG,EAAgBL,EAAMM,SAC1B,KAAMC,ODaRC,ECbgDL,EDezCM,GACL,CACEP,EAQAQ,SARAC,MACEA,EAAQ,OAAMC,KACdA,EAAO,GAAEC,YACTA,EAAWC,QACXA,EAAOC,QACPA,GAAU,GAAKb,EACZc,EAAIlD,EAAAoC,EANT,oDAUA,MAAMe,EAAcF,GAAWD,EAAUA,EAAUN,EAE7CU,EAAcZ,GAAQ,IAC1BW,EAAYE,KAAI,EAAEC,EAAKC,GAAQC,KAC7B,MAAMC,EAAerC,EAAckC,EAAII,eACvC,OAAKD,EAEEE,EAAcF,EAChBpD,OAAAuD,OAAAvD,OAAAuD,OAAA,CAAA,EAAAL,IACHV,MAAOA,EACPE,YAAaA,QAAAA,EAAeQ,EAAMR,YAClCc,SAAUN,EAAMM,SAChBC,IAAK,GAAGR,KAAOE,OAPS,IAQxB,KAEJ,CAACL,EAAaN,EAAOE,IAGvB,OAAOY,EACLrC,EAAGjB,OAAAuD,OAAAvD,OAAAuD,OAAAvD,OAAAuD,OAAA,CAEDhB,OACG7B,IACHC,MAAO8B,EACP7B,OAAQ6B,IACLI,GAELE,EACD,IA5CyB,IAE9BV,CCbqD,GACnD,CAACL,IAGH,OAAOH,EAACyB,cAAApB,EAAkBlC,OAAAuD,OAAA,CAAA,EAAAtB,GAAS,IAGrCL,EAAc8B,YAAc","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ColorValue } from 'react-native';
|
|
3
|
+
import { SvgProps } from 'react-native-svg';
|
|
4
|
+
import { IconSvgElement } from '../create-hugeicon-singleton';
|
|
5
|
+
export type { IconSvgElement };
|
|
6
|
+
export interface HugeiconsProps extends Omit<SvgProps, 'color'> {
|
|
7
|
+
icon: IconSvgElement;
|
|
8
|
+
size?: string | number;
|
|
9
|
+
strokeWidth?: number;
|
|
10
|
+
altIcon?: IconSvgElement;
|
|
11
|
+
showAlt?: boolean;
|
|
12
|
+
color?: ColorValue;
|
|
13
|
+
}
|
|
14
|
+
export declare const HugeiconsIcon: React.MemoExoticComponent<({ icon, ...props }: HugeiconsProps) => React.JSX.Element>;
|
|
15
|
+
export default HugeiconsIcon;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React, { ForwardRefExoticComponent } from 'react';
|
|
2
|
+
import { SvgProps } from 'react-native-svg';
|
|
3
|
+
export type IconSvgElement = readonly (readonly [string, {
|
|
4
|
+
readonly [key: string]: string | number;
|
|
5
|
+
}])[];
|
|
6
|
+
export interface HugeiconsProps extends SvgProps {
|
|
7
|
+
size?: string | number;
|
|
8
|
+
strokeWidth?: number;
|
|
9
|
+
altIcon?: IconSvgElement;
|
|
10
|
+
showAlt?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export type HugeiconsIcon = ForwardRefExoticComponent<HugeiconsProps>;
|
|
13
|
+
declare const createHugeiconSingleton: (iconName: string, svgElements: IconSvgElement) => React.FC<HugeiconsProps>;
|
|
14
|
+
export default createHugeiconSingleton;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as HugeiconsIcon } from './components/HugeiconsIcon';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ColorValue } from 'react-native';
|
|
3
|
+
import { SvgProps } from 'react-native-svg';
|
|
4
|
+
import { IconSvgElement } from '../create-hugeicon-singleton';
|
|
5
|
+
export type { IconSvgElement };
|
|
6
|
+
export interface HugeiconsProps extends Omit<SvgProps, 'color'> {
|
|
7
|
+
icon: IconSvgElement;
|
|
8
|
+
size?: string | number;
|
|
9
|
+
strokeWidth?: number;
|
|
10
|
+
altIcon?: IconSvgElement;
|
|
11
|
+
showAlt?: boolean;
|
|
12
|
+
color?: ColorValue;
|
|
13
|
+
}
|
|
14
|
+
export declare const HugeiconsIcon: React.MemoExoticComponent<({ icon, ...props }: HugeiconsProps) => React.JSX.Element>;
|
|
15
|
+
export default HugeiconsIcon;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React, { ForwardRefExoticComponent } from 'react';
|
|
2
|
+
import { SvgProps } from 'react-native-svg';
|
|
3
|
+
export type IconSvgElement = readonly (readonly [string, {
|
|
4
|
+
readonly [key: string]: string | number;
|
|
5
|
+
}])[];
|
|
6
|
+
export interface HugeiconsProps extends SvgProps {
|
|
7
|
+
size?: string | number;
|
|
8
|
+
strokeWidth?: number;
|
|
9
|
+
altIcon?: IconSvgElement;
|
|
10
|
+
showAlt?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export type HugeiconsIcon = ForwardRefExoticComponent<HugeiconsProps>;
|
|
13
|
+
declare const createHugeiconSingleton: (iconName: string, svgElements: IconSvgElement) => React.FC<HugeiconsProps>;
|
|
14
|
+
export default createHugeiconSingleton;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ColorValue } from 'react-native';
|
|
3
|
+
import { SvgProps } from 'react-native-svg';
|
|
4
|
+
|
|
5
|
+
type IconSvgElement = readonly (readonly [string, {
|
|
6
|
+
readonly [key: string]: string | number;
|
|
7
|
+
}])[];
|
|
8
|
+
|
|
9
|
+
interface HugeiconsProps extends Omit<SvgProps, 'color'> {
|
|
10
|
+
icon: IconSvgElement;
|
|
11
|
+
size?: string | number;
|
|
12
|
+
strokeWidth?: number;
|
|
13
|
+
altIcon?: IconSvgElement;
|
|
14
|
+
showAlt?: boolean;
|
|
15
|
+
color?: ColorValue;
|
|
16
|
+
}
|
|
17
|
+
declare const HugeiconsIcon: React.MemoExoticComponent<({ icon, ...props }: HugeiconsProps) => React.JSX.Element>;
|
|
18
|
+
|
|
19
|
+
export { HugeiconsIcon, HugeiconsProps, IconSvgElement };
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@hugeicons/react-native",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "HugeIcons Pro React Native Component Library https://hugeicons.com",
|
|
5
|
+
"homepage": "https://hugeicons.com",
|
|
6
|
+
"amdName": "hugeicons-pro-react-native",
|
|
7
|
+
"main": "./dist/cjs/index.js",
|
|
8
|
+
"module": "./dist/esm/index.js",
|
|
9
|
+
"types": "./dist/types/index.d.ts",
|
|
10
|
+
"sideEffects": false,
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/types/index.d.ts",
|
|
17
|
+
"import": "./dist/esm/index.js",
|
|
18
|
+
"require": "./dist/cjs/index.js"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"author": "Hugeicons",
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@rollup/plugin-commonjs": "^25.0.0",
|
|
24
|
+
"@rollup/plugin-node-resolve": "^15.0.0",
|
|
25
|
+
"@rollup/plugin-terser": "^0.4.0",
|
|
26
|
+
"@rollup/plugin-typescript": "^11.0.0",
|
|
27
|
+
"@types/react": "^18.0.0",
|
|
28
|
+
"@types/react-native": "^0.72.0",
|
|
29
|
+
"rollup": "^3.0.0",
|
|
30
|
+
"rollup-plugin-dts": "^5.0.0",
|
|
31
|
+
"tslib": "^2.6.0",
|
|
32
|
+
"typescript": "^5.0.0"
|
|
33
|
+
},
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"react": ">=16.0.0",
|
|
36
|
+
"react-native": ">=0.60.0",
|
|
37
|
+
"react-native-svg": ">=12.0.0"
|
|
38
|
+
},
|
|
39
|
+
"keywords": [
|
|
40
|
+
"icons",
|
|
41
|
+
"react-native-icons",
|
|
42
|
+
"ui-components",
|
|
43
|
+
"design-system",
|
|
44
|
+
"vector-icons",
|
|
45
|
+
"react-native-component-library",
|
|
46
|
+
"mobile-icons",
|
|
47
|
+
"scalable-icons",
|
|
48
|
+
"customizable-icons",
|
|
49
|
+
"icon-library"
|
|
50
|
+
],
|
|
51
|
+
"scripts": {
|
|
52
|
+
"build": "pnpm clean && pnpm typecheck && pnpm build:bundles",
|
|
53
|
+
"build:bundles": "rollup -c ./rollup.config.mjs",
|
|
54
|
+
"typecheck": "tsc",
|
|
55
|
+
"clean": "rm -rf dist"
|
|
56
|
+
}
|
|
57
|
+
}
|