@trackunit/ui-icons 0.0.62 → 0.0.63
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/index.cjs +20 -0
- package/index.js +20 -0
- package/package.json +1 -1
- package/src/ensureIconWithFallback.d.ts +7 -0
- package/src/heroIconLookup.d.ts +7 -0
- package/src/scripts/generate-icons.d.ts +6 -0
- package/src/trackunitIconLookup.d.ts +6 -0
package/index.cjs
CHANGED
|
@@ -1030,6 +1030,13 @@ const validateIconName = (name) => {
|
|
|
1030
1030
|
}
|
|
1031
1031
|
return found;
|
|
1032
1032
|
};
|
|
1033
|
+
/**
|
|
1034
|
+
* Ensures that the icon name is valid, otherwise it returns the fallback icon name.
|
|
1035
|
+
*
|
|
1036
|
+
* @param name - The icon name to validate.
|
|
1037
|
+
* @param fallbackIconName - The fallback icon name to use if the icon name is invalid.
|
|
1038
|
+
* @returns {TrackunitIconName | HeroIconName} - Returns the icon name if it is valid, otherwise it returns the fallback icon name.
|
|
1039
|
+
*/
|
|
1033
1040
|
const ensureIconWithFallback = (name, fallbackIconName = FALLBACK_ICON_NAME) => {
|
|
1034
1041
|
if (!name) {
|
|
1035
1042
|
return fallbackIconName;
|
|
@@ -1045,6 +1052,13 @@ const ensureIconWithFallback = (name, fallbackIconName = FALLBACK_ICON_NAME) =>
|
|
|
1045
1052
|
}
|
|
1046
1053
|
};
|
|
1047
1054
|
|
|
1055
|
+
/**
|
|
1056
|
+
* Returns the icon from the library based on the name and type provided.
|
|
1057
|
+
*
|
|
1058
|
+
* @param iconName - The name of the icon you want to use.
|
|
1059
|
+
* @param type - The type of the icon you want to use.
|
|
1060
|
+
* @returns {HeroIcon} - Returns the icon from the library based on the name and type provided.
|
|
1061
|
+
*/
|
|
1048
1062
|
const heroIconLookup = (iconName, type) => {
|
|
1049
1063
|
if (!HeroIconsArray.includes(iconName)) {
|
|
1050
1064
|
// eslint-disable-next-line no-console
|
|
@@ -1054,6 +1068,12 @@ const heroIconLookup = (iconName, type) => {
|
|
|
1054
1068
|
return type === "solid" ? lookupSolid[iconName] : lookupOutline[iconName];
|
|
1055
1069
|
};
|
|
1056
1070
|
|
|
1071
|
+
/**
|
|
1072
|
+
* Returns the icon component for the given icon name.
|
|
1073
|
+
*
|
|
1074
|
+
* @param iconName - The icon name to lookup.
|
|
1075
|
+
* @param type - The icon type to lookup.
|
|
1076
|
+
*/
|
|
1057
1077
|
const trackunitIconLookup = (iconName, type) => {
|
|
1058
1078
|
if ((type === "solid" && !TrackunitSolidIconsArray.includes(iconName)) ||
|
|
1059
1079
|
(type === "outline" && !TrackunitOutlineIconsArray.includes(iconName))) {
|
package/index.js
CHANGED
|
@@ -1004,6 +1004,13 @@ const validateIconName = (name) => {
|
|
|
1004
1004
|
}
|
|
1005
1005
|
return found;
|
|
1006
1006
|
};
|
|
1007
|
+
/**
|
|
1008
|
+
* Ensures that the icon name is valid, otherwise it returns the fallback icon name.
|
|
1009
|
+
*
|
|
1010
|
+
* @param name - The icon name to validate.
|
|
1011
|
+
* @param fallbackIconName - The fallback icon name to use if the icon name is invalid.
|
|
1012
|
+
* @returns {TrackunitIconName | HeroIconName} - Returns the icon name if it is valid, otherwise it returns the fallback icon name.
|
|
1013
|
+
*/
|
|
1007
1014
|
const ensureIconWithFallback = (name, fallbackIconName = FALLBACK_ICON_NAME) => {
|
|
1008
1015
|
if (!name) {
|
|
1009
1016
|
return fallbackIconName;
|
|
@@ -1019,6 +1026,13 @@ const ensureIconWithFallback = (name, fallbackIconName = FALLBACK_ICON_NAME) =>
|
|
|
1019
1026
|
}
|
|
1020
1027
|
};
|
|
1021
1028
|
|
|
1029
|
+
/**
|
|
1030
|
+
* Returns the icon from the library based on the name and type provided.
|
|
1031
|
+
*
|
|
1032
|
+
* @param iconName - The name of the icon you want to use.
|
|
1033
|
+
* @param type - The type of the icon you want to use.
|
|
1034
|
+
* @returns {HeroIcon} - Returns the icon from the library based on the name and type provided.
|
|
1035
|
+
*/
|
|
1022
1036
|
const heroIconLookup = (iconName, type) => {
|
|
1023
1037
|
if (!HeroIconsArray.includes(iconName)) {
|
|
1024
1038
|
// eslint-disable-next-line no-console
|
|
@@ -1028,6 +1042,12 @@ const heroIconLookup = (iconName, type) => {
|
|
|
1028
1042
|
return type === "solid" ? lookupSolid[iconName] : lookupOutline[iconName];
|
|
1029
1043
|
};
|
|
1030
1044
|
|
|
1045
|
+
/**
|
|
1046
|
+
* Returns the icon component for the given icon name.
|
|
1047
|
+
*
|
|
1048
|
+
* @param iconName - The icon name to lookup.
|
|
1049
|
+
* @param type - The icon type to lookup.
|
|
1050
|
+
*/
|
|
1031
1051
|
const trackunitIconLookup = (iconName, type) => {
|
|
1032
1052
|
if ((type === "solid" && !TrackunitSolidIconsArray.includes(iconName)) ||
|
|
1033
1053
|
(type === "outline" && !TrackunitOutlineIconsArray.includes(iconName))) {
|
package/package.json
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import { HeroIconName } from "./heroiconsTypes";
|
|
2
2
|
import { TrackunitIconName } from "./TrackunitIcons.generated";
|
|
3
|
+
/**
|
|
4
|
+
* Ensures that the icon name is valid, otherwise it returns the fallback icon name.
|
|
5
|
+
*
|
|
6
|
+
* @param name - The icon name to validate.
|
|
7
|
+
* @param fallbackIconName - The fallback icon name to use if the icon name is invalid.
|
|
8
|
+
* @returns {TrackunitIconName | HeroIconName} - Returns the icon name if it is valid, otherwise it returns the fallback icon name.
|
|
9
|
+
*/
|
|
3
10
|
export declare const ensureIconWithFallback: (name: string, fallbackIconName?: TrackunitIconName | HeroIconName) => TrackunitIconName | HeroIconName;
|
package/src/heroIconLookup.d.ts
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
import { HeroIcon, HeroIconName } from "./heroiconsTypes";
|
|
2
|
+
/**
|
|
3
|
+
* Returns the icon from the library based on the name and type provided.
|
|
4
|
+
*
|
|
5
|
+
* @param iconName - The name of the icon you want to use.
|
|
6
|
+
* @param type - The type of the icon you want to use.
|
|
7
|
+
* @returns {HeroIcon} - Returns the icon from the library based on the name and type provided.
|
|
8
|
+
*/
|
|
2
9
|
export declare const heroIconLookup: (iconName: HeroIconName, type: "solid" | "outline") => HeroIcon;
|
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
import { TrackunitIcon, TrackunitIconName } from "./TrackunitIcons.generated";
|
|
2
|
+
/**
|
|
3
|
+
* Returns the icon component for the given icon name.
|
|
4
|
+
*
|
|
5
|
+
* @param iconName - The icon name to lookup.
|
|
6
|
+
* @param type - The icon type to lookup.
|
|
7
|
+
*/
|
|
2
8
|
export declare const trackunitIconLookup: (iconName: TrackunitIconName, type: "solid" | "outline") => TrackunitIcon;
|