@leanix/components 0.4.776 → 0.4.778
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.
|
@@ -2716,6 +2716,8 @@ function getSapIcon(faIcon, solid = false) {
|
|
|
2716
2716
|
return solid && icons[1] ? icons[1] : icons[0];
|
|
2717
2717
|
}
|
|
2718
2718
|
|
|
2719
|
+
/** Matches FA modifier classes like fas, far, fal, fad, fab at any position */
|
|
2720
|
+
const FA_MODIFIER_REGEX = /\s*\b(fas|far|fal|fad|fab)\b\s*/g;
|
|
2719
2721
|
/**
|
|
2720
2722
|
* This pipe can be used to transform Font Awesome icons into SAP icons.
|
|
2721
2723
|
* Useful for scenarios in which icon names need to be mapped at runtime,
|
|
@@ -2728,18 +2730,20 @@ function getSapIcon(faIcon, solid = false) {
|
|
|
2728
2730
|
class FaToSapIconPipe {
|
|
2729
2731
|
/**
|
|
2730
2732
|
* Transforms Font Awesome icons to SAP icons
|
|
2731
|
-
* @param value The Font Awesome icon name, with optional `fa-` prefix
|
|
2733
|
+
* @param value The Font Awesome icon name, with optional `fa-` prefix and modifier classes
|
|
2732
2734
|
* @param isSolid Whether the icon is solid
|
|
2733
2735
|
* @returns The SAP icon name, or provided value if no mapped icon found
|
|
2734
2736
|
*/
|
|
2735
2737
|
transform(value, isSolid = false) {
|
|
2736
|
-
const
|
|
2737
|
-
const
|
|
2738
|
+
const hasFasModifier = /\bfas\b/.test(value);
|
|
2739
|
+
const cleanedValue = value.replace(FA_MODIFIER_REGEX, '').trim();
|
|
2740
|
+
const normalizedIconName = cleanedValue.startsWith('fa-') ? cleanedValue : `fa-${cleanedValue}`;
|
|
2741
|
+
const icons = ICON_MAP[normalizedIconName];
|
|
2738
2742
|
if (!icons || !icons.length) {
|
|
2739
2743
|
console.warn(`[FaToSapIconPipe] No SAP icon found for ${value}`);
|
|
2740
2744
|
return value;
|
|
2741
2745
|
}
|
|
2742
|
-
if (isSolid) {
|
|
2746
|
+
if (isSolid || hasFasModifier) {
|
|
2743
2747
|
return icons[1] ?? icons[0];
|
|
2744
2748
|
}
|
|
2745
2749
|
return icons[0];
|