@refineui/react-native-icons 0.3.26 → 0.3.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -57188,15 +57188,23 @@ function nameToSlug(name) {
57188
57188
  function pascalToSlug(name) {
57189
57189
  return String(name).replace(/([A-Z])/g, '-$1').toLowerCase().replace(/^-/, '');
57190
57190
  }
57191
+ function normalizeIconName(name) {
57192
+ return String(name).trim().replace(/\s+/g, ' ');
57193
+ }
57191
57194
  class ReactNativeIconUtils {
57192
57195
  constructor() {
57193
57196
  this.metadata = metadata;
57194
57197
  this.fontFamilies = metadata.fontFamilies;
57195
57198
  }
57196
57199
  getIconData(iconName) {
57200
+ if (!iconName || typeof iconName !== 'string')
57201
+ return null;
57197
57202
  const direct = this.metadata.icons[iconName];
57198
57203
  if (direct)
57199
57204
  return direct;
57205
+ const normalized = normalizeIconName(iconName);
57206
+ if (normalized && this.metadata.icons[normalized])
57207
+ return this.metadata.icons[normalized];
57200
57208
  const slug = nameToSlug(iconName);
57201
57209
  const bySlug = Object.values(this.metadata.icons).find((icon) => icon.slug === slug);
57202
57210
  if (bySlug)
@@ -57225,11 +57233,11 @@ class ReactNativeIconUtils {
57225
57233
  // Create unsized icon (default 24px)
57226
57234
  createUnsizedIcon(iconName, style, props = {}) {
57227
57235
  const iconData = this.getIconData(iconName);
57228
- if (!iconData)
57236
+ if (!iconData?.unicodeMapping)
57229
57237
  return null;
57230
57238
  const defaultSize = 24;
57231
- const unicodeInfo = iconData.unicodeMapping[defaultSize]?.[style];
57232
- if (!unicodeInfo)
57239
+ const unicodeInfo = iconData.unicodeMapping[String(defaultSize)]?.[style];
57240
+ if (!unicodeInfo || unicodeInfo.unicode == null)
57233
57241
  return null;
57234
57242
  const fontFamily = this.fontFamilies[style].font_family;
57235
57243
  return React__default["default"].createElement('Text', {
@@ -57246,10 +57254,10 @@ class ReactNativeIconUtils {
57246
57254
  // Create sized icon
57247
57255
  createSizedIcon(iconName, size, style, props = {}) {
57248
57256
  const iconData = this.getIconData(iconName);
57249
- if (!iconData)
57257
+ if (!iconData?.unicodeMapping)
57250
57258
  return null;
57251
- const unicodeInfo = iconData.unicodeMapping[size]?.[style];
57252
- if (!unicodeInfo)
57259
+ const unicodeInfo = iconData.unicodeMapping[String(size)]?.[style];
57260
+ if (!unicodeInfo || unicodeInfo.unicode == null)
57253
57261
  return null;
57254
57262
  const fontFamily = this.fontFamilies[style].font_family;
57255
57263
  return React__default["default"].createElement('Text', {
@@ -57266,18 +57274,18 @@ class ReactNativeIconUtils {
57266
57274
  // Utility methods
57267
57275
  getIconChar(iconName, style = 'regular', size = 24) {
57268
57276
  const iconData = this.getIconData(iconName);
57269
- if (!iconData)
57277
+ if (!iconData?.unicodeMapping)
57270
57278
  return null;
57271
- const unicodeInfo = iconData.unicodeMapping[size]?.[style];
57272
- if (!unicodeInfo)
57279
+ const unicodeInfo = iconData.unicodeMapping[String(size)]?.[style];
57280
+ if (!unicodeInfo || unicodeInfo.unicode == null)
57273
57281
  return null;
57274
57282
  return String.fromCodePoint(unicodeInfo.unicode);
57275
57283
  }
57276
57284
  getIconClass(iconName, style = 'regular', size = 24) {
57277
57285
  const iconData = this.getIconData(iconName);
57278
- if (!iconData)
57286
+ if (!iconData?.unicodeMapping)
57279
57287
  return null;
57280
- const unicodeInfo = iconData.unicodeMapping[size]?.[style];
57288
+ const unicodeInfo = iconData.unicodeMapping[String(size)]?.[style];
57281
57289
  if (!unicodeInfo)
57282
57290
  return null;
57283
57291
  return unicodeInfo.cssClass;