@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/IconUtils.d.ts.map +1 -1
- package/dist/index.esm.js +19 -11
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +19 -11
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +19 -11
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -57187,15 +57187,23 @@
|
|
|
57187
57187
|
function pascalToSlug(name) {
|
|
57188
57188
|
return String(name).replace(/([A-Z])/g, '-$1').toLowerCase().replace(/^-/, '');
|
|
57189
57189
|
}
|
|
57190
|
+
function normalizeIconName(name) {
|
|
57191
|
+
return String(name).trim().replace(/\s+/g, ' ');
|
|
57192
|
+
}
|
|
57190
57193
|
class ReactNativeIconUtils {
|
|
57191
57194
|
constructor() {
|
|
57192
57195
|
this.metadata = metadata;
|
|
57193
57196
|
this.fontFamilies = metadata.fontFamilies;
|
|
57194
57197
|
}
|
|
57195
57198
|
getIconData(iconName) {
|
|
57199
|
+
if (!iconName || typeof iconName !== 'string')
|
|
57200
|
+
return null;
|
|
57196
57201
|
const direct = this.metadata.icons[iconName];
|
|
57197
57202
|
if (direct)
|
|
57198
57203
|
return direct;
|
|
57204
|
+
const normalized = normalizeIconName(iconName);
|
|
57205
|
+
if (normalized && this.metadata.icons[normalized])
|
|
57206
|
+
return this.metadata.icons[normalized];
|
|
57199
57207
|
const slug = nameToSlug(iconName);
|
|
57200
57208
|
const bySlug = Object.values(this.metadata.icons).find((icon) => icon.slug === slug);
|
|
57201
57209
|
if (bySlug)
|
|
@@ -57224,11 +57232,11 @@
|
|
|
57224
57232
|
// Create unsized icon (default 24px)
|
|
57225
57233
|
createUnsizedIcon(iconName, style, props = {}) {
|
|
57226
57234
|
const iconData = this.getIconData(iconName);
|
|
57227
|
-
if (!iconData)
|
|
57235
|
+
if (!iconData?.unicodeMapping)
|
|
57228
57236
|
return null;
|
|
57229
57237
|
const defaultSize = 24;
|
|
57230
|
-
const unicodeInfo = iconData.unicodeMapping[defaultSize]?.[style];
|
|
57231
|
-
if (!unicodeInfo)
|
|
57238
|
+
const unicodeInfo = iconData.unicodeMapping[String(defaultSize)]?.[style];
|
|
57239
|
+
if (!unicodeInfo || unicodeInfo.unicode == null)
|
|
57232
57240
|
return null;
|
|
57233
57241
|
const fontFamily = this.fontFamilies[style].font_family;
|
|
57234
57242
|
return React__default["default"].createElement('Text', {
|
|
@@ -57245,10 +57253,10 @@
|
|
|
57245
57253
|
// Create sized icon
|
|
57246
57254
|
createSizedIcon(iconName, size, style, props = {}) {
|
|
57247
57255
|
const iconData = this.getIconData(iconName);
|
|
57248
|
-
if (!iconData)
|
|
57256
|
+
if (!iconData?.unicodeMapping)
|
|
57249
57257
|
return null;
|
|
57250
|
-
const unicodeInfo = iconData.unicodeMapping[size]?.[style];
|
|
57251
|
-
if (!unicodeInfo)
|
|
57258
|
+
const unicodeInfo = iconData.unicodeMapping[String(size)]?.[style];
|
|
57259
|
+
if (!unicodeInfo || unicodeInfo.unicode == null)
|
|
57252
57260
|
return null;
|
|
57253
57261
|
const fontFamily = this.fontFamilies[style].font_family;
|
|
57254
57262
|
return React__default["default"].createElement('Text', {
|
|
@@ -57265,18 +57273,18 @@
|
|
|
57265
57273
|
// Utility methods
|
|
57266
57274
|
getIconChar(iconName, style = 'regular', size = 24) {
|
|
57267
57275
|
const iconData = this.getIconData(iconName);
|
|
57268
|
-
if (!iconData)
|
|
57276
|
+
if (!iconData?.unicodeMapping)
|
|
57269
57277
|
return null;
|
|
57270
|
-
const unicodeInfo = iconData.unicodeMapping[size]?.[style];
|
|
57271
|
-
if (!unicodeInfo)
|
|
57278
|
+
const unicodeInfo = iconData.unicodeMapping[String(size)]?.[style];
|
|
57279
|
+
if (!unicodeInfo || unicodeInfo.unicode == null)
|
|
57272
57280
|
return null;
|
|
57273
57281
|
return String.fromCodePoint(unicodeInfo.unicode);
|
|
57274
57282
|
}
|
|
57275
57283
|
getIconClass(iconName, style = 'regular', size = 24) {
|
|
57276
57284
|
const iconData = this.getIconData(iconName);
|
|
57277
|
-
if (!iconData)
|
|
57285
|
+
if (!iconData?.unicodeMapping)
|
|
57278
57286
|
return null;
|
|
57279
|
-
const unicodeInfo = iconData.unicodeMapping[size]?.[style];
|
|
57287
|
+
const unicodeInfo = iconData.unicodeMapping[String(size)]?.[style];
|
|
57280
57288
|
if (!unicodeInfo)
|
|
57281
57289
|
return null;
|
|
57282
57290
|
return unicodeInfo.cssClass;
|