@refineui/react-native-icons 0.3.29 → 0.3.31

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