@refineui/react-native-icons 0.3.29 → 0.3.30

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
@@ -57185,6 +57185,9 @@ var metadata = {
57185
57185
  function nameToSlug(name) {
57186
57186
  return String(name).toLowerCase().trim().replace(/\s+/g, '-');
57187
57187
  }
57188
+ function normalizeSlug(s) {
57189
+ return nameToSlug(String(s).replace(/_/g, '-'));
57190
+ }
57188
57191
  function pascalToSlug(name) {
57189
57192
  return String(name).replace(/([A-Z])/g, '-$1').toLowerCase().replace(/^-/, '');
57190
57193
  }
@@ -57196,21 +57199,44 @@ class ReactNativeIconUtils {
57196
57199
  this.metadata = metadata;
57197
57200
  this.fontFamilies = metadata.fontFamilies;
57198
57201
  }
57202
+ /** Resolve icon data by name or by slug (handles "weather-sunny" / "weather_sunny", extra spaces) */
57199
57203
  getIconData(iconName) {
57200
57204
  if (!iconName || typeof iconName !== 'string')
57201
57205
  return null;
57202
57206
  const direct = this.metadata.icons[iconName];
57203
57207
  if (direct)
57204
57208
  return direct;
57209
+ const slugForDirect = nameToSlug(iconName);
57210
+ if (this.metadata.icons[slugForDirect])
57211
+ return this.metadata.icons[slugForDirect];
57212
+ if (this.metadata.icons[iconName.replace(/-/g, '_')])
57213
+ return this.metadata.icons[iconName.replace(/-/g, '_')];
57214
+ if (this.metadata.icons[iconName.replace(/_/g, '-')])
57215
+ return this.metadata.icons[iconName.replace(/_/g, '-')];
57216
+ const keys = Object.keys(this.metadata.icons);
57217
+ const matchKey = keys.find((k) => k === iconName ||
57218
+ normalizeSlug(k) === slugForDirect ||
57219
+ k.replace(/-/g, '_') === iconName ||
57220
+ k.replace(/_/g, '-') === iconName);
57221
+ if (matchKey)
57222
+ return this.metadata.icons[matchKey];
57205
57223
  const normalized = normalizeIconName(iconName);
57206
57224
  if (normalized && this.metadata.icons[normalized])
57207
57225
  return this.metadata.icons[normalized];
57208
- const slug = nameToSlug(iconName);
57209
- const bySlug = Object.values(this.metadata.icons).find((icon) => icon.slug === slug);
57226
+ const slug = slugForDirect;
57227
+ const bySlug = Object.values(this.metadata.icons).find((icon) => icon.slug === slug ||
57228
+ icon.slug === slug.replace(/-/g, '_') ||
57229
+ icon.slug === slug.replace(/_/g, '-') ||
57230
+ normalizeSlug(icon.slug) === slug ||
57231
+ normalizeSlug(icon.name) === slug);
57210
57232
  if (bySlug)
57211
57233
  return bySlug;
57212
57234
  const slugPascal = pascalToSlug(iconName);
57213
- return Object.values(this.metadata.icons).find((icon) => icon.slug === slugPascal) || null;
57235
+ return Object.values(this.metadata.icons).find((icon) => icon.slug === slugPascal ||
57236
+ icon.slug === slugPascal.replace(/-/g, '_') ||
57237
+ icon.slug === slugPascal.replace(/_/g, '-') ||
57238
+ normalizeSlug(icon.slug) === slugPascal ||
57239
+ normalizeSlug(icon.name) === slugPascal) || null;
57214
57240
  }
57215
57241
  // === Icon Style Method ===
57216
57242
  // Dynamic icon creation method