rn-iconify 1.0.0 → 2.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 +47 -235
- package/babel.js +14 -0
- package/lib/commonjs/IconRenderer.js +91 -4
- package/lib/commonjs/IconRenderer.js.map +1 -1
- package/lib/commonjs/accessibility/AccessibilityProvider.js +189 -0
- package/lib/commonjs/accessibility/AccessibilityProvider.js.map +1 -0
- package/lib/commonjs/accessibility/index.js +87 -0
- package/lib/commonjs/accessibility/index.js.map +1 -0
- package/lib/commonjs/accessibility/types.js +6 -0
- package/lib/commonjs/accessibility/types.js.map +1 -0
- package/lib/commonjs/accessibility/useAccessibleIcon.js +119 -0
- package/lib/commonjs/accessibility/useAccessibleIcon.js.map +1 -0
- package/lib/commonjs/accessibility/utils.js +231 -0
- package/lib/commonjs/accessibility/utils.js.map +1 -0
- package/lib/commonjs/alias/Icon.js +113 -0
- package/lib/commonjs/alias/Icon.js.map +1 -0
- package/lib/commonjs/alias/IconAliasContext.js +177 -0
- package/lib/commonjs/alias/IconAliasContext.js.map +1 -0
- package/lib/commonjs/alias/createIconAliases.js +222 -0
- package/lib/commonjs/alias/createIconAliases.js.map +1 -0
- package/lib/commonjs/alias/index.js +57 -0
- package/lib/commonjs/alias/index.js.map +1 -0
- package/lib/commonjs/alias/types.js +6 -0
- package/lib/commonjs/alias/types.js.map +1 -0
- package/lib/commonjs/animated/AnimatedIcon.js +116 -0
- package/lib/commonjs/animated/AnimatedIcon.js.map +1 -0
- package/lib/commonjs/animated/index.js +76 -0
- package/lib/commonjs/animated/index.js.map +1 -0
- package/lib/commonjs/animated/presets.js +220 -0
- package/lib/commonjs/animated/presets.js.map +1 -0
- package/lib/commonjs/animated/types.js +71 -0
- package/lib/commonjs/animated/types.js.map +1 -0
- package/lib/commonjs/animated/useIconAnimation.js +313 -0
- package/lib/commonjs/animated/useIconAnimation.js.map +1 -0
- package/lib/commonjs/babel/ast-utils.js +214 -0
- package/lib/commonjs/babel/ast-utils.js.map +1 -0
- package/lib/commonjs/babel/cache-writer.js +281 -0
- package/lib/commonjs/babel/cache-writer.js.map +1 -0
- package/lib/commonjs/babel/collector.js +219 -0
- package/lib/commonjs/babel/collector.js.map +1 -0
- package/lib/commonjs/babel/index.js +104 -0
- package/lib/commonjs/babel/index.js.map +1 -0
- package/lib/commonjs/babel/plugin.js +226 -0
- package/lib/commonjs/babel/plugin.js.map +1 -0
- package/lib/commonjs/babel/types.js +485 -0
- package/lib/commonjs/babel/types.js.map +1 -0
- package/lib/commonjs/bundle/index.js +213 -0
- package/lib/commonjs/bundle/index.js.map +1 -0
- package/lib/commonjs/cache/CacheManager.js +105 -6
- package/lib/commonjs/cache/CacheManager.js.map +1 -1
- package/lib/commonjs/cli/commands/analyze.js +171 -0
- package/lib/commonjs/cli/commands/analyze.js.map +1 -0
- package/lib/commonjs/cli/commands/bundle.js +214 -0
- package/lib/commonjs/cli/commands/bundle.js.map +1 -0
- package/lib/commonjs/cli/index.js +142 -0
- package/lib/commonjs/cli/index.js.map +1 -0
- package/lib/commonjs/cli/parser.js +260 -0
- package/lib/commonjs/cli/parser.js.map +1 -0
- package/lib/commonjs/cli/types.js +42 -0
- package/lib/commonjs/cli/types.js.map +1 -0
- package/lib/commonjs/config/ConfigManager.js +182 -0
- package/lib/commonjs/config/ConfigManager.js.map +1 -0
- package/lib/commonjs/config/index.js +44 -0
- package/lib/commonjs/config/index.js.map +1 -0
- package/lib/commonjs/config/types.js +55 -0
- package/lib/commonjs/config/types.js.map +1 -0
- package/lib/commonjs/createIconSet.js +49 -11
- package/lib/commonjs/createIconSet.js.map +1 -1
- package/lib/commonjs/explorer/IconExplorer.js +827 -0
- package/lib/commonjs/explorer/IconExplorer.js.map +1 -0
- package/lib/commonjs/explorer/iconSets.js +303 -0
- package/lib/commonjs/explorer/iconSets.js.map +1 -0
- package/lib/commonjs/explorer/index.js +93 -0
- package/lib/commonjs/explorer/index.js.map +1 -0
- package/lib/commonjs/explorer/types.js +6 -0
- package/lib/commonjs/explorer/types.js.map +1 -0
- package/lib/commonjs/explorer/useExplorer.js +359 -0
- package/lib/commonjs/explorer/useExplorer.js.map +1 -0
- package/lib/commonjs/index.js +618 -12
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/navigation/createDrawerIcon.js +129 -0
- package/lib/commonjs/navigation/createDrawerIcon.js.map +1 -0
- package/lib/commonjs/navigation/createHeaderIcon.js +185 -0
- package/lib/commonjs/navigation/createHeaderIcon.js.map +1 -0
- package/lib/commonjs/navigation/createTabBarIcon.js +178 -0
- package/lib/commonjs/navigation/createTabBarIcon.js.map +1 -0
- package/lib/commonjs/navigation/index.js +83 -0
- package/lib/commonjs/navigation/index.js.map +1 -0
- package/lib/commonjs/navigation/types.js +94 -0
- package/lib/commonjs/navigation/types.js.map +1 -0
- package/lib/commonjs/navigation/useNavigationIcon.js +128 -0
- package/lib/commonjs/navigation/useNavigationIcon.js.map +1 -0
- package/lib/commonjs/network/IconifyAPI.js +154 -14
- package/lib/commonjs/network/IconifyAPI.js.map +1 -1
- package/lib/commonjs/network/index.js +18 -0
- package/lib/commonjs/network/index.js.map +1 -1
- package/lib/commonjs/performance/PerformanceMonitor.js +327 -0
- package/lib/commonjs/performance/PerformanceMonitor.js.map +1 -0
- package/lib/commonjs/performance/index.js +43 -0
- package/lib/commonjs/performance/index.js.map +1 -0
- package/lib/commonjs/performance/types.js +2 -0
- package/lib/commonjs/performance/types.js.map +1 -0
- package/lib/commonjs/placeholder/PlaceholderFactory.js +111 -0
- package/lib/commonjs/placeholder/PlaceholderFactory.js.map +1 -0
- package/lib/commonjs/placeholder/Pulse.js +77 -0
- package/lib/commonjs/placeholder/Pulse.js.map +1 -0
- package/lib/commonjs/placeholder/Shimmer.js +95 -0
- package/lib/commonjs/placeholder/Shimmer.js.map +1 -0
- package/lib/commonjs/placeholder/Skeleton.js +52 -0
- package/lib/commonjs/placeholder/Skeleton.js.map +1 -0
- package/lib/commonjs/placeholder/index.js +41 -0
- package/lib/commonjs/placeholder/index.js.map +1 -0
- package/lib/commonjs/placeholder/types.js +40 -0
- package/lib/commonjs/placeholder/types.js.map +1 -0
- package/lib/commonjs/theme/IconThemeProvider.js +96 -0
- package/lib/commonjs/theme/IconThemeProvider.js.map +1 -0
- package/lib/commonjs/theme/context.js +53 -0
- package/lib/commonjs/theme/context.js.map +1 -0
- package/lib/commonjs/theme/index.js +52 -0
- package/lib/commonjs/theme/index.js.map +1 -0
- package/lib/commonjs/theme/types.js +39 -0
- package/lib/commonjs/theme/types.js.map +1 -0
- package/lib/commonjs/theme/useIconTheme.js +121 -0
- package/lib/commonjs/theme/useIconTheme.js.map +1 -0
- package/lib/module/IconRenderer.js +92 -5
- package/lib/module/IconRenderer.js.map +1 -1
- package/lib/module/accessibility/AccessibilityProvider.js +179 -0
- package/lib/module/accessibility/AccessibilityProvider.js.map +1 -0
- package/lib/module/accessibility/index.js +42 -0
- package/lib/module/accessibility/index.js.map +1 -0
- package/lib/module/accessibility/types.js +2 -0
- package/lib/module/accessibility/types.js.map +1 -0
- package/lib/module/accessibility/useAccessibleIcon.js +112 -0
- package/lib/module/accessibility/useAccessibleIcon.js.map +1 -0
- package/lib/module/accessibility/utils.js +221 -0
- package/lib/module/accessibility/utils.js.map +1 -0
- package/lib/module/alias/Icon.js +105 -0
- package/lib/module/alias/Icon.js.map +1 -0
- package/lib/module/alias/IconAliasContext.js +166 -0
- package/lib/module/alias/IconAliasContext.js.map +1 -0
- package/lib/module/alias/createIconAliases.js +213 -0
- package/lib/module/alias/createIconAliases.js.map +1 -0
- package/lib/module/alias/index.js +45 -0
- package/lib/module/alias/index.js.map +1 -0
- package/lib/module/alias/types.js +2 -0
- package/lib/module/alias/types.js.map +1 -0
- package/lib/module/animated/AnimatedIcon.js +109 -0
- package/lib/module/animated/AnimatedIcon.js.map +1 -0
- package/lib/module/animated/index.js +80 -0
- package/lib/module/animated/index.js.map +1 -0
- package/lib/module/animated/presets.js +209 -0
- package/lib/module/animated/presets.js.map +1 -0
- package/lib/module/animated/types.js +65 -0
- package/lib/module/animated/types.js.map +1 -0
- package/lib/module/animated/useIconAnimation.js +306 -0
- package/lib/module/animated/useIconAnimation.js.map +1 -0
- package/lib/module/babel/ast-utils.js +201 -0
- package/lib/module/babel/ast-utils.js.map +1 -0
- package/lib/module/babel/cache-writer.js +269 -0
- package/lib/module/babel/cache-writer.js.map +1 -0
- package/lib/module/babel/collector.js +214 -0
- package/lib/module/babel/collector.js.map +1 -0
- package/lib/module/babel/index.js +51 -0
- package/lib/module/babel/index.js.map +1 -0
- package/lib/module/babel/plugin.js +220 -0
- package/lib/module/babel/plugin.js.map +1 -0
- package/lib/module/babel/types.js +476 -0
- package/lib/module/babel/types.js.map +1 -0
- package/lib/module/bundle/index.js +205 -0
- package/lib/module/bundle/index.js.map +1 -0
- package/lib/module/cache/CacheManager.js +106 -6
- package/lib/module/cache/CacheManager.js.map +1 -1
- package/lib/module/cli/commands/analyze.js +166 -0
- package/lib/module/cli/commands/analyze.js.map +1 -0
- package/lib/module/cli/commands/bundle.js +208 -0
- package/lib/module/cli/commands/bundle.js.map +1 -0
- package/lib/module/cli/index.js +140 -0
- package/lib/module/cli/index.js.map +1 -0
- package/lib/module/cli/parser.js +251 -0
- package/lib/module/cli/parser.js.map +1 -0
- package/lib/module/cli/types.js +36 -0
- package/lib/module/cli/types.js.map +1 -0
- package/lib/module/components/index.js +27 -1
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/config/ConfigManager.js +173 -0
- package/lib/module/config/ConfigManager.js.map +1 -0
- package/lib/module/config/index.js +28 -0
- package/lib/module/config/index.js.map +1 -0
- package/lib/module/config/types.js +49 -0
- package/lib/module/config/types.js.map +1 -0
- package/lib/module/createIconSet.js +49 -11
- package/lib/module/createIconSet.js.map +1 -1
- package/lib/module/explorer/IconExplorer.js +817 -0
- package/lib/module/explorer/IconExplorer.js.map +1 -0
- package/lib/module/explorer/iconSets.js +291 -0
- package/lib/module/explorer/iconSets.js.map +1 -0
- package/lib/module/explorer/index.js +42 -0
- package/lib/module/explorer/index.js.map +1 -0
- package/lib/module/explorer/types.js +2 -0
- package/lib/module/explorer/types.js.map +1 -0
- package/lib/module/explorer/useExplorer.js +353 -0
- package/lib/module/explorer/useExplorer.js.map +1 -0
- package/lib/module/index.js +26 -11
- package/lib/module/index.js.map +1 -1
- package/lib/module/navigation/createDrawerIcon.js +121 -0
- package/lib/module/navigation/createDrawerIcon.js.map +1 -0
- package/lib/module/navigation/createHeaderIcon.js +175 -0
- package/lib/module/navigation/createHeaderIcon.js.map +1 -0
- package/lib/module/navigation/createTabBarIcon.js +168 -0
- package/lib/module/navigation/createTabBarIcon.js.map +1 -0
- package/lib/module/navigation/index.js +59 -0
- package/lib/module/navigation/index.js.map +1 -0
- package/lib/module/navigation/types.js +88 -0
- package/lib/module/navigation/types.js.map +1 -0
- package/lib/module/navigation/useNavigationIcon.js +121 -0
- package/lib/module/navigation/useNavigationIcon.js.map +1 -0
- package/lib/module/network/IconifyAPI.js +152 -14
- package/lib/module/network/IconifyAPI.js.map +1 -1
- package/lib/module/network/index.js +1 -1
- package/lib/module/network/index.js.map +1 -1
- package/lib/module/performance/PerformanceMonitor.js +317 -0
- package/lib/module/performance/PerformanceMonitor.js.map +1 -0
- package/lib/module/performance/index.js +26 -0
- package/lib/module/performance/index.js.map +1 -0
- package/lib/module/performance/types.js +2 -0
- package/lib/module/performance/types.js.map +1 -0
- package/lib/module/placeholder/PlaceholderFactory.js +105 -0
- package/lib/module/placeholder/PlaceholderFactory.js.map +1 -0
- package/lib/module/placeholder/Pulse.js +70 -0
- package/lib/module/placeholder/Pulse.js.map +1 -0
- package/lib/module/placeholder/Shimmer.js +88 -0
- package/lib/module/placeholder/Shimmer.js.map +1 -0
- package/lib/module/placeholder/Skeleton.js +45 -0
- package/lib/module/placeholder/Skeleton.js.map +1 -0
- package/lib/module/placeholder/index.js +15 -0
- package/lib/module/placeholder/index.js.map +1 -0
- package/lib/module/placeholder/types.js +34 -0
- package/lib/module/placeholder/types.js.map +1 -0
- package/lib/module/theme/IconThemeProvider.js +89 -0
- package/lib/module/theme/IconThemeProvider.js.map +1 -0
- package/lib/module/theme/context.js +47 -0
- package/lib/module/theme/context.js.map +1 -0
- package/lib/module/theme/index.js +19 -0
- package/lib/module/theme/index.js.map +1 -0
- package/lib/module/theme/types.js +33 -0
- package/lib/module/theme/types.js.map +1 -0
- package/lib/module/theme/useIconTheme.js +114 -0
- package/lib/module/theme/useIconTheme.js.map +1 -0
- package/lib/typescript/IconRenderer.d.ts +1 -1
- package/lib/typescript/IconRenderer.d.ts.map +1 -1
- package/lib/typescript/accessibility/AccessibilityProvider.d.ts +57 -0
- package/lib/typescript/accessibility/AccessibilityProvider.d.ts.map +1 -0
- package/lib/typescript/accessibility/index.d.ts +37 -0
- package/lib/typescript/accessibility/index.d.ts.map +1 -0
- package/lib/typescript/accessibility/types.d.ts +130 -0
- package/lib/typescript/accessibility/types.d.ts.map +1 -0
- package/lib/typescript/accessibility/useAccessibleIcon.d.ts +111 -0
- package/lib/typescript/accessibility/useAccessibleIcon.d.ts.map +1 -0
- package/lib/typescript/accessibility/utils.d.ts +29 -0
- package/lib/typescript/accessibility/utils.d.ts.map +1 -0
- package/lib/typescript/alias/Icon.d.ts +38 -0
- package/lib/typescript/alias/Icon.d.ts.map +1 -0
- package/lib/typescript/alias/IconAliasContext.d.ts +52 -0
- package/lib/typescript/alias/IconAliasContext.d.ts.map +1 -0
- package/lib/typescript/alias/createIconAliases.d.ts +77 -0
- package/lib/typescript/alias/createIconAliases.d.ts.map +1 -0
- package/lib/typescript/alias/index.d.ts +36 -0
- package/lib/typescript/alias/index.d.ts.map +1 -0
- package/lib/typescript/alias/types.d.ts +115 -0
- package/lib/typescript/alias/types.d.ts.map +1 -0
- package/lib/typescript/animated/AnimatedIcon.d.ts +45 -0
- package/lib/typescript/animated/AnimatedIcon.d.ts.map +1 -0
- package/lib/typescript/animated/index.d.ts +70 -0
- package/lib/typescript/animated/index.d.ts.map +1 -0
- package/lib/typescript/animated/presets.d.ts +35 -0
- package/lib/typescript/animated/presets.d.ts.map +1 -0
- package/lib/typescript/animated/types.d.ts +196 -0
- package/lib/typescript/animated/types.d.ts.map +1 -0
- package/lib/typescript/animated/useIconAnimation.d.ts +64 -0
- package/lib/typescript/animated/useIconAnimation.d.ts.map +1 -0
- package/lib/typescript/babel/ast-utils.d.ts +52 -0
- package/lib/typescript/babel/ast-utils.d.ts.map +1 -0
- package/lib/typescript/babel/cache-writer.d.ts +56 -0
- package/lib/typescript/babel/cache-writer.d.ts.map +1 -0
- package/lib/typescript/babel/collector.d.ts +107 -0
- package/lib/typescript/babel/collector.d.ts.map +1 -0
- package/lib/typescript/babel/index.d.ts +47 -0
- package/lib/typescript/babel/index.d.ts.map +1 -0
- package/lib/typescript/babel/plugin.d.ts +17 -0
- package/lib/typescript/babel/plugin.d.ts.map +1 -0
- package/lib/typescript/babel/types.d.ts +129 -0
- package/lib/typescript/babel/types.d.ts.map +1 -0
- package/lib/typescript/bundle/index.d.ts +161 -0
- package/lib/typescript/bundle/index.d.ts.map +1 -0
- package/lib/typescript/cache/CacheManager.d.ts +52 -4
- package/lib/typescript/cache/CacheManager.d.ts.map +1 -1
- package/lib/typescript/cli/commands/analyze.d.ts +10 -0
- package/lib/typescript/cli/commands/analyze.d.ts.map +1 -0
- package/lib/typescript/cli/commands/bundle.d.ts +10 -0
- package/lib/typescript/cli/commands/bundle.d.ts.map +1 -0
- package/lib/typescript/cli/index.d.ts +7 -0
- package/lib/typescript/cli/index.d.ts.map +1 -0
- package/lib/typescript/cli/parser.d.ts +18 -0
- package/lib/typescript/cli/parser.d.ts.map +1 -0
- package/lib/typescript/cli/types.d.ts +157 -0
- package/lib/typescript/cli/types.d.ts.map +1 -0
- package/lib/typescript/components/Academicons.d.ts +1 -1
- package/lib/typescript/components/AkarIcons.d.ts +1 -1
- package/lib/typescript/components/AntDesign.d.ts +1 -1
- package/lib/typescript/components/Arcticons.d.ts +1 -1
- package/lib/typescript/components/Basil.d.ts +1 -1
- package/lib/typescript/components/Bi.d.ts +1 -1
- package/lib/typescript/components/BitcoinIcons.d.ts +1 -1
- package/lib/typescript/components/Bpmn.d.ts +1 -1
- package/lib/typescript/components/Brandico.d.ts +1 -1
- package/lib/typescript/components/Bx.d.ts +1 -1
- package/lib/typescript/components/Bxl.d.ts +1 -1
- package/lib/typescript/components/Bxs.d.ts +1 -1
- package/lib/typescript/components/Bytesize.d.ts +1 -1
- package/lib/typescript/components/Carbon.d.ts +1 -1
- package/lib/typescript/components/Catppuccin.d.ts +1 -1
- package/lib/typescript/components/Cbi.d.ts +1 -1
- package/lib/typescript/components/Charm.d.ts +1 -1
- package/lib/typescript/components/Ci.d.ts +1 -1
- package/lib/typescript/components/Cib.d.ts +1 -1
- package/lib/typescript/components/Cif.d.ts +1 -1
- package/lib/typescript/components/Cil.d.ts +1 -1
- package/lib/typescript/components/CircleFlags.d.ts +1 -1
- package/lib/typescript/components/Circum.d.ts +1 -1
- package/lib/typescript/components/Clarity.d.ts +1 -1
- package/lib/typescript/components/Codex.d.ts +1 -1
- package/lib/typescript/components/Codicon.d.ts +1 -1
- package/lib/typescript/components/Covid.d.ts +1 -1
- package/lib/typescript/components/Cryptocurrency.d.ts +1 -1
- package/lib/typescript/components/CryptocurrencyColor.d.ts +1 -1
- package/lib/typescript/components/Cuida.d.ts +1 -1
- package/lib/typescript/components/Dashicons.d.ts +1 -1
- package/lib/typescript/components/Devicon.d.ts +1 -1
- package/lib/typescript/components/DeviconPlain.d.ts +1 -1
- package/lib/typescript/components/DinkieIcons.d.ts +1 -1
- package/lib/typescript/components/DuoIcons.d.ts +1 -1
- package/lib/typescript/components/Ei.d.ts +1 -1
- package/lib/typescript/components/El.d.ts +1 -1
- package/lib/typescript/components/EmojioneMonotone.d.ts +1 -1
- package/lib/typescript/components/Entypo.d.ts +1 -1
- package/lib/typescript/components/EntypoSocial.d.ts +1 -1
- package/lib/typescript/components/EosIcons.d.ts +1 -1
- package/lib/typescript/components/Ep.d.ts +1 -1
- package/lib/typescript/components/Et.d.ts +1 -1
- package/lib/typescript/components/Eva.d.ts +1 -1
- package/lib/typescript/components/F7.d.ts +1 -1
- package/lib/typescript/components/Fa.d.ts +1 -1
- package/lib/typescript/components/Fa6Brands.d.ts +1 -1
- package/lib/typescript/components/Fa6Regular.d.ts +1 -1
- package/lib/typescript/components/Fa6Solid.d.ts +1 -1
- package/lib/typescript/components/Fa7Brands.d.ts +1 -1
- package/lib/typescript/components/Fa7Regular.d.ts +1 -1
- package/lib/typescript/components/Fa7Solid.d.ts +1 -1
- package/lib/typescript/components/FaBrands.d.ts +1 -1
- package/lib/typescript/components/FaRegular.d.ts +1 -1
- package/lib/typescript/components/FaSolid.d.ts +1 -1
- package/lib/typescript/components/Fad.d.ts +1 -1
- package/lib/typescript/components/Famicons.d.ts +1 -1
- package/lib/typescript/components/Fe.d.ts +1 -1
- package/lib/typescript/components/Feather.d.ts +1 -1
- package/lib/typescript/components/FileIcons.d.ts +1 -1
- package/lib/typescript/components/Flag.d.ts +1 -1
- package/lib/typescript/components/Flagpack.d.ts +1 -1
- package/lib/typescript/components/FlatUi.d.ts +1 -1
- package/lib/typescript/components/Flowbite.d.ts +1 -1
- package/lib/typescript/components/Fluent.d.ts +1 -1
- package/lib/typescript/components/FluentColor.d.ts +1 -1
- package/lib/typescript/components/FluentEmoji.d.ts +1 -1
- package/lib/typescript/components/FluentEmojiFlat.d.ts +1 -1
- package/lib/typescript/components/FluentEmojiHighContrast.d.ts +1 -1
- package/lib/typescript/components/FluentMdl2.d.ts +1 -1
- package/lib/typescript/components/Fontelico.d.ts +1 -1
- package/lib/typescript/components/Fontisto.d.ts +1 -1
- package/lib/typescript/components/Formkit.d.ts +1 -1
- package/lib/typescript/components/Foundation.d.ts +1 -1
- package/lib/typescript/components/Gala.d.ts +1 -1
- package/lib/typescript/components/GameIcons.d.ts +1 -1
- package/lib/typescript/components/Garden.d.ts +1 -1
- package/lib/typescript/components/Geo.d.ts +1 -1
- package/lib/typescript/components/Gg.d.ts +1 -1
- package/lib/typescript/components/Gis.d.ts +1 -1
- package/lib/typescript/components/GravityUi.d.ts +1 -1
- package/lib/typescript/components/Gridicons.d.ts +1 -1
- package/lib/typescript/components/GrommetIcons.d.ts +1 -1
- package/lib/typescript/components/Guidance.d.ts +1 -1
- package/lib/typescript/components/Healthicons.d.ts +1 -1
- package/lib/typescript/components/Heroicons.d.ts +1 -1
- package/lib/typescript/components/HeroiconsOutline.d.ts +1 -1
- package/lib/typescript/components/HeroiconsSolid.d.ts +1 -1
- package/lib/typescript/components/Hugeicons.d.ts +1 -1
- package/lib/typescript/components/Humbleicons.d.ts +1 -1
- package/lib/typescript/components/Ic.d.ts +1 -1
- package/lib/typescript/components/IcomoonFree.d.ts +1 -1
- package/lib/typescript/components/IconPark.d.ts +1 -1
- package/lib/typescript/components/IconParkOutline.d.ts +1 -1
- package/lib/typescript/components/IconParkSolid.d.ts +1 -1
- package/lib/typescript/components/IconParkTwotone.d.ts +1 -1
- package/lib/typescript/components/Iconamoon.d.ts +1 -1
- package/lib/typescript/components/Iconoir.d.ts +1 -1
- package/lib/typescript/components/Icons8.d.ts +1 -1
- package/lib/typescript/components/Il.d.ts +1 -1
- package/lib/typescript/components/Ion.d.ts +1 -1
- package/lib/typescript/components/Iwwa.d.ts +1 -1
- package/lib/typescript/components/Ix.d.ts +1 -1
- package/lib/typescript/components/Jam.d.ts +1 -1
- package/lib/typescript/components/La.d.ts +1 -1
- package/lib/typescript/components/LetsIcons.d.ts +1 -1
- package/lib/typescript/components/LineMd.d.ts +1 -1
- package/lib/typescript/components/Lineicons.d.ts +1 -1
- package/lib/typescript/components/Logos.d.ts +1 -1
- package/lib/typescript/components/Ls.d.ts +1 -1
- package/lib/typescript/components/Lsicon.d.ts +1 -1
- package/lib/typescript/components/Lucide.d.ts +1 -1
- package/lib/typescript/components/LucideLab.d.ts +1 -1
- package/lib/typescript/components/Mage.d.ts +1 -1
- package/lib/typescript/components/Majesticons.d.ts +1 -1
- package/lib/typescript/components/Maki.d.ts +1 -1
- package/lib/typescript/components/Map.d.ts +1 -1
- package/lib/typescript/components/Marketeq.d.ts +1 -1
- package/lib/typescript/components/MaterialIconTheme.d.ts +1 -1
- package/lib/typescript/components/MaterialSymbols.d.ts +1 -1
- package/lib/typescript/components/MaterialSymbolsLight.d.ts +1 -1
- package/lib/typescript/components/Mdi.d.ts +1 -1
- package/lib/typescript/components/MdiLight.d.ts +1 -1
- package/lib/typescript/components/MedicalIcon.d.ts +1 -1
- package/lib/typescript/components/Memory.d.ts +1 -1
- package/lib/typescript/components/Meteocons.d.ts +1 -1
- package/lib/typescript/components/MeteorIcons.d.ts +1 -1
- package/lib/typescript/components/Mi.d.ts +1 -1
- package/lib/typescript/components/Mingcute.d.ts +1 -1
- package/lib/typescript/components/MonoIcons.d.ts +1 -1
- package/lib/typescript/components/Mynaui.d.ts +1 -1
- package/lib/typescript/components/Nimbus.d.ts +1 -1
- package/lib/typescript/components/Nonicons.d.ts +1 -1
- package/lib/typescript/components/Nrk.d.ts +1 -1
- package/lib/typescript/components/Octicon.d.ts +1 -1
- package/lib/typescript/components/Oi.d.ts +1 -1
- package/lib/typescript/components/Ooui.d.ts +1 -1
- package/lib/typescript/components/Oui.d.ts +1 -1
- package/lib/typescript/components/Pajamas.d.ts +1 -1
- package/lib/typescript/components/Pepicons.d.ts +1 -1
- package/lib/typescript/components/PepiconsPencil.d.ts +1 -1
- package/lib/typescript/components/PepiconsPop.d.ts +1 -1
- package/lib/typescript/components/PepiconsPrint.d.ts +1 -1
- package/lib/typescript/components/Ph.d.ts +1 -1
- package/lib/typescript/components/Picon.d.ts +1 -1
- package/lib/typescript/components/Pixel.d.ts +1 -1
- package/lib/typescript/components/Pixelarticons.d.ts +1 -1
- package/lib/typescript/components/Prime.d.ts +1 -1
- package/lib/typescript/components/Proicons.d.ts +1 -1
- package/lib/typescript/components/Ps.d.ts +1 -1
- package/lib/typescript/components/QlementineIcons.d.ts +1 -1
- package/lib/typescript/components/Quill.d.ts +1 -1
- package/lib/typescript/components/RadixIcons.d.ts +1 -1
- package/lib/typescript/components/Raphael.d.ts +1 -1
- package/lib/typescript/components/Ri.d.ts +1 -1
- package/lib/typescript/components/RivetIcons.d.ts +1 -1
- package/lib/typescript/components/Roentgen.d.ts +1 -1
- package/lib/typescript/components/Si.d.ts +1 -1
- package/lib/typescript/components/SiGlyph.d.ts +1 -1
- package/lib/typescript/components/Sidekickicons.d.ts +1 -1
- package/lib/typescript/components/SimpleIcons.d.ts +1 -1
- package/lib/typescript/components/SimpleLineIcons.d.ts +1 -1
- package/lib/typescript/components/SkillIcons.d.ts +1 -1
- package/lib/typescript/components/Solar.d.ts +1 -1
- package/lib/typescript/components/Stash.d.ts +1 -1
- package/lib/typescript/components/Streamline.d.ts +1 -1
- package/lib/typescript/components/StreamlineBlock.d.ts +1 -1
- package/lib/typescript/components/StreamlineColor.d.ts +1 -1
- package/lib/typescript/components/StreamlineCyber.d.ts +1 -1
- package/lib/typescript/components/StreamlineCyberColor.d.ts +1 -1
- package/lib/typescript/components/StreamlineEmojis.d.ts +1 -1
- package/lib/typescript/components/StreamlineFlex.d.ts +1 -1
- package/lib/typescript/components/StreamlineFlexColor.d.ts +1 -1
- package/lib/typescript/components/StreamlineFreehand.d.ts +1 -1
- package/lib/typescript/components/StreamlineFreehandColor.d.ts +1 -1
- package/lib/typescript/components/StreamlineKameleonColor.d.ts +1 -1
- package/lib/typescript/components/StreamlineLogos.d.ts +1 -1
- package/lib/typescript/components/StreamlinePixel.d.ts +1 -1
- package/lib/typescript/components/StreamlinePlump.d.ts +1 -1
- package/lib/typescript/components/StreamlinePlumpColor.d.ts +1 -1
- package/lib/typescript/components/StreamlineSharp.d.ts +1 -1
- package/lib/typescript/components/StreamlineSharpColor.d.ts +1 -1
- package/lib/typescript/components/StreamlineStickiesColor.d.ts +1 -1
- package/lib/typescript/components/StreamlineUltimate.d.ts +1 -1
- package/lib/typescript/components/StreamlineUltimateColor.d.ts +1 -1
- package/lib/typescript/components/Subway.d.ts +1 -1
- package/lib/typescript/components/SvgSpinners.d.ts +1 -1
- package/lib/typescript/components/SystemUicons.d.ts +1 -1
- package/lib/typescript/components/Tabler.d.ts +1 -1
- package/lib/typescript/components/Tdesign.d.ts +1 -1
- package/lib/typescript/components/Teenyicons.d.ts +1 -1
- package/lib/typescript/components/Temaki.d.ts +1 -1
- package/lib/typescript/components/Token.d.ts +1 -1
- package/lib/typescript/components/TokenBranded.d.ts +1 -1
- package/lib/typescript/components/Topcoat.d.ts +1 -1
- package/lib/typescript/components/Typcn.d.ts +1 -1
- package/lib/typescript/components/Uil.d.ts +1 -1
- package/lib/typescript/components/Uim.d.ts +1 -1
- package/lib/typescript/components/Uis.d.ts +1 -1
- package/lib/typescript/components/Uit.d.ts +1 -1
- package/lib/typescript/components/Uiw.d.ts +1 -1
- package/lib/typescript/components/Unjs.d.ts +1 -1
- package/lib/typescript/components/Vaadin.d.ts +1 -1
- package/lib/typescript/components/Vs.d.ts +1 -1
- package/lib/typescript/components/VscodeIcons.d.ts +1 -1
- package/lib/typescript/components/Websymbol.d.ts +1 -1
- package/lib/typescript/components/Weui.d.ts +1 -1
- package/lib/typescript/components/Whh.d.ts +1 -1
- package/lib/typescript/components/Wi.d.ts +1 -1
- package/lib/typescript/components/Wpf.d.ts +1 -1
- package/lib/typescript/components/Zmdi.d.ts +1 -1
- package/lib/typescript/components/Zondicons.d.ts +1 -1
- package/lib/typescript/components/index.d.ts +38 -1
- package/lib/typescript/components/index.d.ts.map +1 -1
- package/lib/typescript/config/ConfigManager.d.ts +102 -0
- package/lib/typescript/config/ConfigManager.d.ts.map +1 -0
- package/lib/typescript/config/index.d.ts +22 -0
- package/lib/typescript/config/index.d.ts.map +1 -0
- package/lib/typescript/config/types.d.ts +112 -0
- package/lib/typescript/config/types.d.ts.map +1 -0
- package/lib/typescript/createIconSet.d.ts +1 -1
- package/lib/typescript/createIconSet.d.ts.map +1 -1
- package/lib/typescript/explorer/IconExplorer.d.ts +54 -0
- package/lib/typescript/explorer/IconExplorer.d.ts.map +1 -0
- package/lib/typescript/explorer/iconSets.d.ts +35 -0
- package/lib/typescript/explorer/iconSets.d.ts.map +1 -0
- package/lib/typescript/explorer/index.d.ts +33 -0
- package/lib/typescript/explorer/index.d.ts.map +1 -0
- package/lib/typescript/explorer/types.d.ts +329 -0
- package/lib/typescript/explorer/types.d.ts.map +1 -0
- package/lib/typescript/explorer/useExplorer.d.ts +18 -0
- package/lib/typescript/explorer/useExplorer.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +25 -4
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/navigation/createDrawerIcon.d.ts +74 -0
- package/lib/typescript/navigation/createDrawerIcon.d.ts.map +1 -0
- package/lib/typescript/navigation/createHeaderIcon.d.ts +145 -0
- package/lib/typescript/navigation/createHeaderIcon.d.ts.map +1 -0
- package/lib/typescript/navigation/createTabBarIcon.d.ts +99 -0
- package/lib/typescript/navigation/createTabBarIcon.d.ts.map +1 -0
- package/lib/typescript/navigation/index.d.ts +51 -0
- package/lib/typescript/navigation/index.d.ts.map +1 -0
- package/lib/typescript/navigation/types.d.ts +149 -0
- package/lib/typescript/navigation/types.d.ts.map +1 -0
- package/lib/typescript/navigation/useNavigationIcon.d.ts +91 -0
- package/lib/typescript/navigation/useNavigationIcon.d.ts.map +1 -0
- package/lib/typescript/network/IconifyAPI.d.ts +32 -0
- package/lib/typescript/network/IconifyAPI.d.ts.map +1 -1
- package/lib/typescript/network/index.d.ts +2 -1
- package/lib/typescript/network/index.d.ts.map +1 -1
- package/lib/typescript/performance/PerformanceMonitor.d.ts +76 -0
- package/lib/typescript/performance/PerformanceMonitor.d.ts.map +1 -0
- package/lib/typescript/performance/index.d.ts +21 -0
- package/lib/typescript/performance/index.d.ts.map +1 -0
- package/lib/typescript/performance/types.d.ts +156 -0
- package/lib/typescript/performance/types.d.ts.map +1 -0
- package/lib/typescript/placeholder/PlaceholderFactory.d.ts +44 -0
- package/lib/typescript/placeholder/PlaceholderFactory.d.ts.map +1 -0
- package/lib/typescript/placeholder/Pulse.d.ts +18 -0
- package/lib/typescript/placeholder/Pulse.d.ts.map +1 -0
- package/lib/typescript/placeholder/Shimmer.d.ts +19 -0
- package/lib/typescript/placeholder/Shimmer.d.ts.map +1 -0
- package/lib/typescript/placeholder/Skeleton.d.ts +18 -0
- package/lib/typescript/placeholder/Skeleton.d.ts.map +1 -0
- package/lib/typescript/placeholder/index.d.ts +12 -0
- package/lib/typescript/placeholder/index.d.ts.map +1 -0
- package/lib/typescript/placeholder/types.d.ts +63 -0
- package/lib/typescript/placeholder/types.d.ts.map +1 -0
- package/lib/typescript/theme/IconThemeProvider.d.ts +64 -0
- package/lib/typescript/theme/IconThemeProvider.d.ts.map +1 -0
- package/lib/typescript/theme/context.d.ts +24 -0
- package/lib/typescript/theme/context.d.ts.map +1 -0
- package/lib/typescript/theme/index.d.ts +10 -0
- package/lib/typescript/theme/index.d.ts.map +1 -0
- package/lib/typescript/theme/types.d.ts +85 -0
- package/lib/typescript/theme/types.d.ts.map +1 -0
- package/lib/typescript/theme/useIconTheme.d.ts +78 -0
- package/lib/typescript/theme/useIconTheme.d.ts.map +1 -0
- package/lib/typescript/types/index.d.ts +58 -1
- package/lib/typescript/types/index.d.ts.map +1 -1
- package/package.json +41 -3
- package/src/IconRenderer.tsx +91 -4
- package/src/accessibility/AccessibilityProvider.tsx +220 -0
- package/src/accessibility/index.ts +63 -0
- package/src/accessibility/types.ts +152 -0
- package/src/accessibility/useAccessibleIcon.ts +220 -0
- package/src/accessibility/utils.ts +180 -0
- package/src/alias/Icon.tsx +113 -0
- package/src/alias/IconAliasContext.tsx +180 -0
- package/src/alias/createIconAliases.tsx +233 -0
- package/src/alias/index.ts +59 -0
- package/src/alias/types.ts +132 -0
- package/src/animated/AnimatedIcon.tsx +116 -0
- package/src/animated/index.ts +97 -0
- package/src/animated/presets.ts +211 -0
- package/src/animated/types.ts +239 -0
- package/src/animated/useIconAnimation.ts +383 -0
- package/src/babel/ast-utils.ts +219 -0
- package/src/babel/cache-writer.ts +323 -0
- package/src/babel/collector.ts +224 -0
- package/src/babel/index.ts +60 -0
- package/src/babel/plugin.ts +254 -0
- package/src/babel/types.ts +717 -0
- package/src/bundle/index.ts +313 -0
- package/src/cache/CacheManager.ts +123 -6
- package/src/cli/commands/analyze.ts +195 -0
- package/src/cli/commands/bundle.ts +231 -0
- package/src/cli/index.ts +153 -0
- package/src/cli/parser.ts +275 -0
- package/src/cli/types.ts +187 -0
- package/src/components/index.ts +52 -1
- package/src/config/ConfigManager.ts +196 -0
- package/src/config/index.ts +34 -0
- package/src/config/types.ts +149 -0
- package/src/createIconSet.tsx +48 -9
- package/src/explorer/IconExplorer.tsx +844 -0
- package/src/explorer/iconSets.ts +334 -0
- package/src/explorer/index.ts +64 -0
- package/src/explorer/types.ts +392 -0
- package/src/explorer/useExplorer.ts +390 -0
- package/src/index.ts +218 -9
- package/src/navigation/createDrawerIcon.tsx +113 -0
- package/src/navigation/createHeaderIcon.tsx +213 -0
- package/src/navigation/createTabBarIcon.tsx +180 -0
- package/src/navigation/index.ts +80 -0
- package/src/navigation/types.ts +155 -0
- package/src/navigation/useNavigationIcon.tsx +156 -0
- package/src/network/IconifyAPI.ts +182 -14
- package/src/network/index.ts +11 -1
- package/src/performance/PerformanceMonitor.ts +367 -0
- package/src/performance/index.ts +39 -0
- package/src/performance/types.ts +185 -0
- package/src/placeholder/PlaceholderFactory.tsx +133 -0
- package/src/placeholder/Pulse.tsx +86 -0
- package/src/placeholder/Shimmer.tsx +104 -0
- package/src/placeholder/Skeleton.tsx +52 -0
- package/src/placeholder/index.ts +21 -0
- package/src/placeholder/types.ts +78 -0
- package/src/theme/IconThemeProvider.tsx +94 -0
- package/src/theme/context.ts +51 -0
- package/src/theme/index.ts +19 -0
- package/src/theme/types.ts +108 -0
- package/src/theme/useIconTheme.ts +119 -0
- package/src/types/index.ts +78 -1
- package/lib/commonjs/components/Phosphor.js +0 -493
- package/lib/commonjs/components/Phosphor.js.map +0 -1
- package/lib/module/components/Phosphor.js +0 -488
- package/lib/module/components/Phosphor.js.map +0 -1
- package/lib/typescript/components/Phosphor.d.ts +0 -472
- package/lib/typescript/components/Phosphor.d.ts.map +0 -1
- package/src/components/Phosphor.tsx +0 -506
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { ViewStyle, StyleProp } from 'react-native';
|
|
3
|
+
import type { PlaceholderType } from '../placeholder/types';
|
|
4
|
+
import type { AnimationType, AnimationEasing } from '../animated/types';
|
|
3
5
|
/**
|
|
4
6
|
* Icon transformation rotation values
|
|
5
7
|
*/
|
|
@@ -50,13 +52,31 @@ export interface IconProps<T extends string = string> {
|
|
|
50
52
|
flip?: IconFlip;
|
|
51
53
|
/**
|
|
52
54
|
* Fallback component shown while the icon is loading
|
|
55
|
+
* @deprecated Use `placeholder` instead for built-in animated placeholders
|
|
53
56
|
*/
|
|
54
57
|
fallback?: ReactNode;
|
|
55
58
|
/**
|
|
56
|
-
* Delay in milliseconds before showing the fallback
|
|
59
|
+
* Delay in milliseconds before showing the fallback/placeholder
|
|
57
60
|
* @default 0
|
|
58
61
|
*/
|
|
59
62
|
fallbackDelay?: number;
|
|
63
|
+
/**
|
|
64
|
+
* Placeholder shown while the icon is loading
|
|
65
|
+
* Can be a preset ('skeleton', 'pulse', 'shimmer') or a custom ReactNode
|
|
66
|
+
* @example 'shimmer'
|
|
67
|
+
* @example <ActivityIndicator size="small" />
|
|
68
|
+
*/
|
|
69
|
+
placeholder?: PlaceholderType;
|
|
70
|
+
/**
|
|
71
|
+
* Placeholder background color
|
|
72
|
+
* @default '#E1E1E1'
|
|
73
|
+
*/
|
|
74
|
+
placeholderColor?: string;
|
|
75
|
+
/**
|
|
76
|
+
* Placeholder animation duration in milliseconds
|
|
77
|
+
* @default 1000
|
|
78
|
+
*/
|
|
79
|
+
placeholderDuration?: number;
|
|
60
80
|
/**
|
|
61
81
|
* Called when the icon loads successfully
|
|
62
82
|
*/
|
|
@@ -73,6 +93,41 @@ export interface IconProps<T extends string = string> {
|
|
|
73
93
|
* Test ID for testing purposes
|
|
74
94
|
*/
|
|
75
95
|
testID?: string;
|
|
96
|
+
/**
|
|
97
|
+
* Animation to apply to the icon
|
|
98
|
+
* Can be a preset ('spin', 'pulse', 'bounce', 'shake', 'ping', 'wiggle')
|
|
99
|
+
* or a custom animation configuration
|
|
100
|
+
* @example 'spin'
|
|
101
|
+
* @example { type: 'rotate', duration: 2000, easing: 'linear' }
|
|
102
|
+
*/
|
|
103
|
+
animate?: AnimationType;
|
|
104
|
+
/**
|
|
105
|
+
* Animation duration in milliseconds (overrides preset default)
|
|
106
|
+
*/
|
|
107
|
+
animationDuration?: number;
|
|
108
|
+
/**
|
|
109
|
+
* Whether the animation should loop
|
|
110
|
+
* @default true for most presets
|
|
111
|
+
*/
|
|
112
|
+
animationLoop?: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Animation easing function
|
|
115
|
+
*/
|
|
116
|
+
animationEasing?: AnimationEasing;
|
|
117
|
+
/**
|
|
118
|
+
* Delay before animation starts (ms)
|
|
119
|
+
* @default 0
|
|
120
|
+
*/
|
|
121
|
+
animationDelay?: number;
|
|
122
|
+
/**
|
|
123
|
+
* Whether to start animation automatically
|
|
124
|
+
* @default true
|
|
125
|
+
*/
|
|
126
|
+
autoPlay?: boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Callback when animation completes (for non-looping animations)
|
|
129
|
+
*/
|
|
130
|
+
onAnimationComplete?: () => void;
|
|
76
131
|
}
|
|
77
132
|
/**
|
|
78
133
|
* Internal icon data structure from Iconify API
|
|
@@ -128,4 +183,6 @@ export interface IconRendererProps extends Omit<IconProps<string>, 'name'> {
|
|
|
128
183
|
*/
|
|
129
184
|
iconName: string;
|
|
130
185
|
}
|
|
186
|
+
export type { PlaceholderType, PlaceholderConfig, PlaceholderPreset } from '../placeholder/types';
|
|
187
|
+
export type { AnimationType, AnimationPreset, AnimationConfig, AnimationEasing, AnimationControls, } from '../animated/types';
|
|
131
188
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,15 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rn-iconify",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "268,000+ Iconify icons for React Native with native MMKV caching and full TypeScript autocomplete",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
7
7
|
"types": "lib/typescript/index.d.ts",
|
|
8
8
|
"react-native": "src/index.ts",
|
|
9
9
|
"source": "src/index.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./lib/typescript/index.d.ts",
|
|
13
|
+
"import": "./lib/module/index.js",
|
|
14
|
+
"require": "./lib/commonjs/index.js"
|
|
15
|
+
},
|
|
16
|
+
"./babel": {
|
|
17
|
+
"types": "./lib/typescript/babel/index.d.ts",
|
|
18
|
+
"import": "./lib/module/babel/index.js",
|
|
19
|
+
"require": "./lib/commonjs/babel/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./navigation": {
|
|
22
|
+
"types": "./lib/typescript/navigation/index.d.ts",
|
|
23
|
+
"import": "./lib/module/navigation/index.js",
|
|
24
|
+
"require": "./lib/commonjs/navigation/index.js"
|
|
25
|
+
},
|
|
26
|
+
"./animated": {
|
|
27
|
+
"types": "./lib/typescript/animated/index.d.ts",
|
|
28
|
+
"import": "./lib/module/animated/index.js",
|
|
29
|
+
"require": "./lib/commonjs/animated/index.js"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"bin": {
|
|
33
|
+
"rn-iconify": "./lib/commonjs/cli/index.js"
|
|
34
|
+
},
|
|
10
35
|
"files": [
|
|
11
36
|
"src",
|
|
12
37
|
"lib",
|
|
38
|
+
"bin",
|
|
39
|
+
"babel.js",
|
|
13
40
|
"!**/__tests__",
|
|
14
41
|
"!**/__fixtures__",
|
|
15
42
|
"!**/__mocks__"
|
|
@@ -32,13 +59,23 @@
|
|
|
32
59
|
},
|
|
33
60
|
"keywords": [
|
|
34
61
|
"react-native",
|
|
62
|
+
"react-native-icons",
|
|
35
63
|
"icons",
|
|
36
64
|
"iconify",
|
|
37
65
|
"svg",
|
|
66
|
+
"svg-icons",
|
|
67
|
+
"icon-library",
|
|
68
|
+
"icon-component",
|
|
69
|
+
"typescript",
|
|
70
|
+
"mmkv",
|
|
71
|
+
"cache",
|
|
38
72
|
"material-design",
|
|
39
73
|
"heroicons",
|
|
40
74
|
"lucide",
|
|
41
75
|
"phosphor",
|
|
76
|
+
"tabler",
|
|
77
|
+
"fontawesome",
|
|
78
|
+
"fluent-icons",
|
|
42
79
|
"feather",
|
|
43
80
|
"vector-icons"
|
|
44
81
|
],
|
|
@@ -51,7 +88,7 @@
|
|
|
51
88
|
"bugs": {
|
|
52
89
|
"url": "https://github.com/mogretici/rn-iconify/issues"
|
|
53
90
|
},
|
|
54
|
-
"homepage": "https://
|
|
91
|
+
"homepage": "https://rn-iconify.vercel.app",
|
|
55
92
|
"publishConfig": {
|
|
56
93
|
"registry": "https://registry.npmjs.org/"
|
|
57
94
|
},
|
|
@@ -67,6 +104,8 @@
|
|
|
67
104
|
}
|
|
68
105
|
},
|
|
69
106
|
"devDependencies": {
|
|
107
|
+
"@babel/core": "^7.24.0",
|
|
108
|
+
"@babel/types": "^7.24.0",
|
|
70
109
|
"@commitlint/cli": "^19.0.0",
|
|
71
110
|
"@commitlint/config-conventional": "^19.0.0",
|
|
72
111
|
"@react-native/babel-preset": "^0.82.1",
|
|
@@ -88,7 +127,6 @@
|
|
|
88
127
|
"react-native-mmkv": "^3.0.0",
|
|
89
128
|
"react-native-svg": "^15.0.0",
|
|
90
129
|
"react-test-renderer": "^18.2.0",
|
|
91
|
-
"ts-node": "^10.9.0",
|
|
92
130
|
"tsx": "^4.20.6",
|
|
93
131
|
"typescript": "^5.4.0"
|
|
94
132
|
},
|
package/src/IconRenderer.tsx
CHANGED
|
@@ -4,10 +4,12 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import React, { useState, useEffect, useCallback, useRef, useMemo } from 'react';
|
|
7
|
-
import { View, StyleSheet } from 'react-native';
|
|
7
|
+
import { View, StyleSheet, Animated } from 'react-native';
|
|
8
8
|
import { SvgXml } from 'react-native-svg';
|
|
9
9
|
import { CacheManager } from './cache/CacheManager';
|
|
10
10
|
import { fetchIcon } from './network/IconifyAPI';
|
|
11
|
+
import { PlaceholderFactory } from './placeholder';
|
|
12
|
+
import { useIconAnimation } from './animated/useIconAnimation';
|
|
11
13
|
import type { IconRendererProps, IconLoadingState } from './types';
|
|
12
14
|
|
|
13
15
|
/**
|
|
@@ -34,10 +36,21 @@ export function IconRenderer({
|
|
|
34
36
|
flip,
|
|
35
37
|
fallback,
|
|
36
38
|
fallbackDelay = 0,
|
|
39
|
+
placeholder,
|
|
40
|
+
placeholderColor,
|
|
41
|
+
placeholderDuration,
|
|
37
42
|
onLoad,
|
|
38
43
|
onError,
|
|
39
44
|
accessibilityLabel,
|
|
40
45
|
testID,
|
|
46
|
+
// Animation props
|
|
47
|
+
animate,
|
|
48
|
+
animationDuration,
|
|
49
|
+
animationLoop,
|
|
50
|
+
animationEasing,
|
|
51
|
+
animationDelay,
|
|
52
|
+
autoPlay = true,
|
|
53
|
+
onAnimationComplete,
|
|
41
54
|
}: IconRendererProps) {
|
|
42
55
|
const [svg, setSvg] = useState<string | null>(null);
|
|
43
56
|
const [state, setState] = useState<IconLoadingState>('idle');
|
|
@@ -51,6 +64,17 @@ export function IconRenderer({
|
|
|
51
64
|
const iconWidth = propWidth ?? size;
|
|
52
65
|
const iconHeight = propHeight ?? size;
|
|
53
66
|
|
|
67
|
+
// Animation hook
|
|
68
|
+
const { animatedStyle, hasAnimation } = useIconAnimation({
|
|
69
|
+
animation: animate,
|
|
70
|
+
duration: animationDuration,
|
|
71
|
+
loop: animationLoop,
|
|
72
|
+
easing: animationEasing,
|
|
73
|
+
delay: animationDelay,
|
|
74
|
+
autoPlay,
|
|
75
|
+
onComplete: onAnimationComplete,
|
|
76
|
+
});
|
|
77
|
+
|
|
54
78
|
// Load icon
|
|
55
79
|
const loadIcon = useCallback(async () => {
|
|
56
80
|
if (!iconName) return;
|
|
@@ -159,8 +183,31 @@ export function IconRenderer({
|
|
|
159
183
|
return svg.replace(/currentColor/g, safeColor).replace(/<svg/, `<svg fill="${safeColor}"`);
|
|
160
184
|
}, [svg, color]);
|
|
161
185
|
|
|
162
|
-
//
|
|
163
|
-
|
|
186
|
+
// Determine if we should show placeholder/fallback
|
|
187
|
+
const shouldShowPlaceholder = (state === 'loading' && showFallback) || state === 'error';
|
|
188
|
+
|
|
189
|
+
// Render placeholder or fallback during loading/error
|
|
190
|
+
if (shouldShowPlaceholder) {
|
|
191
|
+
// Priority: placeholder > fallback
|
|
192
|
+
if (placeholder !== undefined) {
|
|
193
|
+
return (
|
|
194
|
+
<View
|
|
195
|
+
style={[{ width: iconWidth, height: iconHeight }, style]}
|
|
196
|
+
accessibilityLabel={accessibilityLabel}
|
|
197
|
+
testID={testID}
|
|
198
|
+
>
|
|
199
|
+
<PlaceholderFactory
|
|
200
|
+
type={placeholder}
|
|
201
|
+
width={iconWidth}
|
|
202
|
+
height={iconHeight}
|
|
203
|
+
color={placeholderColor}
|
|
204
|
+
duration={placeholderDuration}
|
|
205
|
+
/>
|
|
206
|
+
</View>
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// Fallback for backwards compatibility (deprecated)
|
|
164
211
|
if (fallback) {
|
|
165
212
|
return (
|
|
166
213
|
<View
|
|
@@ -172,7 +219,8 @@ export function IconRenderer({
|
|
|
172
219
|
</View>
|
|
173
220
|
);
|
|
174
221
|
}
|
|
175
|
-
|
|
222
|
+
|
|
223
|
+
// Return empty view if no placeholder/fallback
|
|
176
224
|
return (
|
|
177
225
|
<View
|
|
178
226
|
style={[{ width: iconWidth, height: iconHeight }, style]}
|
|
@@ -184,6 +232,26 @@ export function IconRenderer({
|
|
|
184
232
|
|
|
185
233
|
// Render icon
|
|
186
234
|
if (colorizedSvg) {
|
|
235
|
+
// Render with animation wrapper if animation is enabled
|
|
236
|
+
if (hasAnimation) {
|
|
237
|
+
return (
|
|
238
|
+
<Animated.View
|
|
239
|
+
style={[
|
|
240
|
+
styles.container,
|
|
241
|
+
{ width: iconWidth, height: iconHeight, transform: transformStyle },
|
|
242
|
+
style,
|
|
243
|
+
animatedStyle,
|
|
244
|
+
]}
|
|
245
|
+
accessibilityLabel={accessibilityLabel}
|
|
246
|
+
accessibilityRole="image"
|
|
247
|
+
testID={testID}
|
|
248
|
+
>
|
|
249
|
+
<SvgXml xml={colorizedSvg} width={iconWidth} height={iconHeight} />
|
|
250
|
+
</Animated.View>
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// Render without animation
|
|
187
255
|
return (
|
|
188
256
|
<View
|
|
189
257
|
style={[
|
|
@@ -200,6 +268,25 @@ export function IconRenderer({
|
|
|
200
268
|
);
|
|
201
269
|
}
|
|
202
270
|
|
|
271
|
+
// Show placeholder immediately if set (no delay), otherwise empty view
|
|
272
|
+
if (placeholder !== undefined && state === 'loading') {
|
|
273
|
+
return (
|
|
274
|
+
<View
|
|
275
|
+
style={[{ width: iconWidth, height: iconHeight }, style]}
|
|
276
|
+
accessibilityLabel={accessibilityLabel}
|
|
277
|
+
testID={testID}
|
|
278
|
+
>
|
|
279
|
+
<PlaceholderFactory
|
|
280
|
+
type={placeholder}
|
|
281
|
+
width={iconWidth}
|
|
282
|
+
height={iconHeight}
|
|
283
|
+
color={placeholderColor}
|
|
284
|
+
duration={placeholderDuration}
|
|
285
|
+
/>
|
|
286
|
+
</View>
|
|
287
|
+
);
|
|
288
|
+
}
|
|
289
|
+
|
|
203
290
|
// Return empty view while loading (before fallback delay)
|
|
204
291
|
return (
|
|
205
292
|
<View
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Accessibility Provider for rn-iconify
|
|
3
|
+
* Provides accessibility context to all icon components
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import React, { createContext, useContext, useState, useMemo, useCallback, useEffect } from 'react';
|
|
7
|
+
import { AccessibilityInfo } from 'react-native';
|
|
8
|
+
import type { AccessibilityRole } from 'react-native';
|
|
9
|
+
import type {
|
|
10
|
+
AccessibilityConfig,
|
|
11
|
+
ResolvedAccessibilityConfig,
|
|
12
|
+
AccessibilityContextValue,
|
|
13
|
+
} from './types';
|
|
14
|
+
import { defaultLabelGenerator, adjustForHighContrast } from './utils';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Default accessibility configuration
|
|
18
|
+
*/
|
|
19
|
+
export const DEFAULT_ACCESSIBILITY_CONFIG: ResolvedAccessibilityConfig = {
|
|
20
|
+
autoLabels: true,
|
|
21
|
+
labelGenerator: defaultLabelGenerator,
|
|
22
|
+
highContrast: false,
|
|
23
|
+
respectReducedMotion: true,
|
|
24
|
+
defaultRole: 'image' as AccessibilityRole,
|
|
25
|
+
showFocusIndicators: true,
|
|
26
|
+
minTouchTargetSize: 44,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Accessibility context
|
|
31
|
+
*/
|
|
32
|
+
export const AccessibilityContext = createContext<AccessibilityContextValue | null>(null);
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Props for AccessibilityProvider
|
|
36
|
+
*/
|
|
37
|
+
export interface AccessibilityProviderProps {
|
|
38
|
+
/**
|
|
39
|
+
* Initial accessibility configuration
|
|
40
|
+
*/
|
|
41
|
+
config?: AccessibilityConfig;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Children components
|
|
45
|
+
*/
|
|
46
|
+
children: React.ReactNode;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Accessibility Provider Component
|
|
51
|
+
* Wraps your app to provide accessibility features to all icons
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```tsx
|
|
55
|
+
* import { AccessibilityProvider } from 'rn-iconify';
|
|
56
|
+
*
|
|
57
|
+
* function App() {
|
|
58
|
+
* return (
|
|
59
|
+
* <AccessibilityProvider config={{ autoLabels: true }}>
|
|
60
|
+
* <MyApp />
|
|
61
|
+
* </AccessibilityProvider>
|
|
62
|
+
* );
|
|
63
|
+
* }
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
export function AccessibilityProvider({
|
|
67
|
+
config: initialConfig,
|
|
68
|
+
children,
|
|
69
|
+
}: AccessibilityProviderProps): React.ReactElement {
|
|
70
|
+
// Resolved configuration state
|
|
71
|
+
const [config, setConfigState] = useState<ResolvedAccessibilityConfig>(() => ({
|
|
72
|
+
...DEFAULT_ACCESSIBILITY_CONFIG,
|
|
73
|
+
...initialConfig,
|
|
74
|
+
labelGenerator: initialConfig?.labelGenerator ?? DEFAULT_ACCESSIBILITY_CONFIG.labelGenerator,
|
|
75
|
+
}));
|
|
76
|
+
|
|
77
|
+
// System preferences
|
|
78
|
+
const [prefersReducedMotion, setPrefersReducedMotion] = useState(false);
|
|
79
|
+
const [isHighContrast, setIsHighContrast] = useState(false);
|
|
80
|
+
|
|
81
|
+
// Listen for reduced motion preference
|
|
82
|
+
useEffect(() => {
|
|
83
|
+
const checkReducedMotion = async () => {
|
|
84
|
+
try {
|
|
85
|
+
const isReducedMotion = await AccessibilityInfo.isReduceMotionEnabled();
|
|
86
|
+
setPrefersReducedMotion(isReducedMotion);
|
|
87
|
+
} catch {
|
|
88
|
+
// Ignore errors on unsupported platforms
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
checkReducedMotion();
|
|
93
|
+
|
|
94
|
+
const subscription = AccessibilityInfo.addEventListener(
|
|
95
|
+
'reduceMotionChanged',
|
|
96
|
+
setPrefersReducedMotion
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
return () => {
|
|
100
|
+
subscription?.remove();
|
|
101
|
+
};
|
|
102
|
+
}, []);
|
|
103
|
+
|
|
104
|
+
// Listen for high contrast preference (iOS only, via bold text as proxy)
|
|
105
|
+
useEffect(() => {
|
|
106
|
+
const checkHighContrast = async () => {
|
|
107
|
+
try {
|
|
108
|
+
// Use bold text as a proxy for high contrast preference
|
|
109
|
+
const isBoldText = await AccessibilityInfo.isBoldTextEnabled();
|
|
110
|
+
setIsHighContrast(isBoldText);
|
|
111
|
+
} catch {
|
|
112
|
+
// Ignore errors on unsupported platforms
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
checkHighContrast();
|
|
117
|
+
|
|
118
|
+
const subscription = AccessibilityInfo.addEventListener('boldTextChanged', setIsHighContrast);
|
|
119
|
+
|
|
120
|
+
return () => {
|
|
121
|
+
subscription?.remove();
|
|
122
|
+
};
|
|
123
|
+
}, []);
|
|
124
|
+
|
|
125
|
+
// Update config handler
|
|
126
|
+
const setConfig = useCallback((newConfig: Partial<AccessibilityConfig>) => {
|
|
127
|
+
setConfigState((prev) => ({
|
|
128
|
+
...prev,
|
|
129
|
+
...newConfig,
|
|
130
|
+
labelGenerator: newConfig.labelGenerator ?? prev.labelGenerator,
|
|
131
|
+
}));
|
|
132
|
+
}, []);
|
|
133
|
+
|
|
134
|
+
// Destructure config for stable dependencies
|
|
135
|
+
const { autoLabels, labelGenerator, highContrast, respectReducedMotion } = config;
|
|
136
|
+
|
|
137
|
+
// Get label for icon
|
|
138
|
+
const getLabel = useCallback(
|
|
139
|
+
(iconName: string, customLabel?: string): string | undefined => {
|
|
140
|
+
// Custom label takes precedence
|
|
141
|
+
if (customLabel) return customLabel;
|
|
142
|
+
|
|
143
|
+
// Return undefined if auto-labels are disabled
|
|
144
|
+
if (!autoLabels) return undefined;
|
|
145
|
+
|
|
146
|
+
// Generate label using configured generator
|
|
147
|
+
return labelGenerator(iconName);
|
|
148
|
+
},
|
|
149
|
+
[autoLabels, labelGenerator]
|
|
150
|
+
);
|
|
151
|
+
|
|
152
|
+
// Get contrast-adjusted color
|
|
153
|
+
const getContrastColor = useCallback(
|
|
154
|
+
(color: string): string => {
|
|
155
|
+
// Check if high contrast should be applied
|
|
156
|
+
const shouldApplyHighContrast = highContrast || isHighContrast;
|
|
157
|
+
|
|
158
|
+
if (shouldApplyHighContrast) {
|
|
159
|
+
return adjustForHighContrast(color);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return color;
|
|
163
|
+
},
|
|
164
|
+
[highContrast, isHighContrast]
|
|
165
|
+
);
|
|
166
|
+
|
|
167
|
+
// Check if animations should be disabled
|
|
168
|
+
const shouldDisableAnimations = useCallback((): boolean => {
|
|
169
|
+
if (!respectReducedMotion) return false;
|
|
170
|
+
return prefersReducedMotion;
|
|
171
|
+
}, [respectReducedMotion, prefersReducedMotion]);
|
|
172
|
+
|
|
173
|
+
// Context value
|
|
174
|
+
const contextValue = useMemo<AccessibilityContextValue>(
|
|
175
|
+
() => ({
|
|
176
|
+
config,
|
|
177
|
+
prefersReducedMotion,
|
|
178
|
+
isHighContrast,
|
|
179
|
+
setConfig,
|
|
180
|
+
getLabel,
|
|
181
|
+
getContrastColor,
|
|
182
|
+
shouldDisableAnimations,
|
|
183
|
+
}),
|
|
184
|
+
[
|
|
185
|
+
config,
|
|
186
|
+
prefersReducedMotion,
|
|
187
|
+
isHighContrast,
|
|
188
|
+
setConfig,
|
|
189
|
+
getLabel,
|
|
190
|
+
getContrastColor,
|
|
191
|
+
shouldDisableAnimations,
|
|
192
|
+
]
|
|
193
|
+
);
|
|
194
|
+
|
|
195
|
+
return (
|
|
196
|
+
<AccessibilityContext.Provider value={contextValue}>{children}</AccessibilityContext.Provider>
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Hook to access accessibility context
|
|
202
|
+
* Throws if used outside AccessibilityProvider
|
|
203
|
+
*/
|
|
204
|
+
export function useAccessibilityContext(): AccessibilityContextValue {
|
|
205
|
+
const context = useContext(AccessibilityContext);
|
|
206
|
+
if (!context) {
|
|
207
|
+
throw new Error('useAccessibilityContext must be used within an AccessibilityProvider');
|
|
208
|
+
}
|
|
209
|
+
return context;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Hook to safely access accessibility context
|
|
214
|
+
* Returns null if used outside AccessibilityProvider
|
|
215
|
+
*/
|
|
216
|
+
export function useAccessibility(): AccessibilityContextValue | null {
|
|
217
|
+
return useContext(AccessibilityContext);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
export default AccessibilityProvider;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Accessibility Module for rn-iconify
|
|
3
|
+
* Provides accessibility features for icon components
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```tsx
|
|
7
|
+
* import { AccessibilityProvider, useAccessibleIcon } from 'rn-iconify';
|
|
8
|
+
*
|
|
9
|
+
* // Wrap your app with AccessibilityProvider
|
|
10
|
+
* function App() {
|
|
11
|
+
* return (
|
|
12
|
+
* <AccessibilityProvider config={{ autoLabels: true, highContrast: false }}>
|
|
13
|
+
* <MyApp />
|
|
14
|
+
* </AccessibilityProvider>
|
|
15
|
+
* );
|
|
16
|
+
* }
|
|
17
|
+
*
|
|
18
|
+
* // Use the hook in your components
|
|
19
|
+
* function MyIcon({ name, size, color }) {
|
|
20
|
+
* const { accessibilityProps, adjustedColor } = useAccessibleIcon({
|
|
21
|
+
* iconName: name,
|
|
22
|
+
* size,
|
|
23
|
+
* color,
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* return <Icon name={name} size={size} color={adjustedColor} {...accessibilityProps} />;
|
|
27
|
+
* }
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
// Types
|
|
32
|
+
export type {
|
|
33
|
+
AccessibilityConfig,
|
|
34
|
+
ResolvedAccessibilityConfig,
|
|
35
|
+
AccessibilityContextValue,
|
|
36
|
+
AccessibleIconProps,
|
|
37
|
+
} from './types';
|
|
38
|
+
|
|
39
|
+
// Provider
|
|
40
|
+
export {
|
|
41
|
+
AccessibilityProvider,
|
|
42
|
+
AccessibilityContext,
|
|
43
|
+
useAccessibilityContext,
|
|
44
|
+
useAccessibility,
|
|
45
|
+
DEFAULT_ACCESSIBILITY_CONFIG,
|
|
46
|
+
} from './AccessibilityProvider';
|
|
47
|
+
export type { AccessibilityProviderProps } from './AccessibilityProvider';
|
|
48
|
+
|
|
49
|
+
// Hook
|
|
50
|
+
export { useAccessibleIcon, withAccessibility } from './useAccessibleIcon';
|
|
51
|
+
export type { UseAccessibleIconInput, UseAccessibleIconOutput } from './useAccessibleIcon';
|
|
52
|
+
|
|
53
|
+
// Utilities
|
|
54
|
+
export {
|
|
55
|
+
defaultLabelGenerator,
|
|
56
|
+
adjustForHighContrast,
|
|
57
|
+
meetsContrastRequirement,
|
|
58
|
+
getHighContrastAlternative,
|
|
59
|
+
calculateTouchTargetPadding,
|
|
60
|
+
} from './utils';
|
|
61
|
+
|
|
62
|
+
// Default export
|
|
63
|
+
export { AccessibilityProvider as default } from './AccessibilityProvider';
|