@algorithm-shift/design-system 1.2.983 → 1.2.984
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 +20 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -21
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -685,28 +685,12 @@ function SplitButton({ style, textContent, className, list = [] }) {
|
|
|
685
685
|
|
|
686
686
|
// src/components/Basic/Icon/Icon.tsx
|
|
687
687
|
import { useEffect as useEffect3, useState as useState5 } from "react";
|
|
688
|
+
import * as SolidIcons from "@fortawesome/free-solid-svg-icons";
|
|
689
|
+
import * as RegularIcons from "@fortawesome/free-regular-svg-icons";
|
|
690
|
+
import * as BrandIcons from "@fortawesome/free-brands-svg-icons";
|
|
688
691
|
import { FontAwesomeIcon as FontAwesomeIcon2 } from "@fortawesome/react-fontawesome";
|
|
689
692
|
import * as LucideIcons from "lucide-react";
|
|
690
693
|
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
691
|
-
async function loadFAIcon(iconName, prefix = "fas") {
|
|
692
|
-
const pkgMap = {
|
|
693
|
-
fas: "@fortawesome/free-solid-svg-icons",
|
|
694
|
-
// Solid
|
|
695
|
-
far: "@fortawesome/free-regular-svg-icons",
|
|
696
|
-
// Regular
|
|
697
|
-
fab: "@fortawesome/free-brands-svg-icons"
|
|
698
|
-
// Brands
|
|
699
|
-
};
|
|
700
|
-
const basePackage = pkgMap[prefix] || pkgMap["fas"];
|
|
701
|
-
const modulePath = `${basePackage}`;
|
|
702
|
-
try {
|
|
703
|
-
const mod = await import(modulePath);
|
|
704
|
-
return mod[iconName] || Object.values(mod)[0];
|
|
705
|
-
} catch {
|
|
706
|
-
console.warn(`FA icon not found in ${modulePath}`);
|
|
707
|
-
return null;
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
694
|
function Icon(props) {
|
|
711
695
|
const {
|
|
712
696
|
iconSet = "fontawesome",
|
|
@@ -722,6 +706,15 @@ function Icon(props) {
|
|
|
722
706
|
...rest
|
|
723
707
|
} = props;
|
|
724
708
|
const [dynamicIcon, setDynamicIcon] = useState5(icon || null);
|
|
709
|
+
async function loadFAIcon(iconName, prefix2 = "fas") {
|
|
710
|
+
const pkgMap = {
|
|
711
|
+
fas: SolidIcons,
|
|
712
|
+
far: RegularIcons,
|
|
713
|
+
fab: BrandIcons
|
|
714
|
+
};
|
|
715
|
+
const basePackage = pkgMap[prefix2] ?? SolidIcons;
|
|
716
|
+
return basePackage[iconName] ?? null;
|
|
717
|
+
}
|
|
725
718
|
useEffect3(() => {
|
|
726
719
|
if (icon && iconSet === "fontawesome") {
|
|
727
720
|
loadFAIcon(icon, prefix).then((ico) => setDynamicIcon(ico));
|
|
@@ -738,7 +731,10 @@ function Icon(props) {
|
|
|
738
731
|
Comp,
|
|
739
732
|
{
|
|
740
733
|
size: numericSize,
|
|
741
|
-
className
|
|
734
|
+
className: cn(
|
|
735
|
+
className,
|
|
736
|
+
props.onClick ? "cursor-pointer" : ""
|
|
737
|
+
),
|
|
742
738
|
title,
|
|
743
739
|
style,
|
|
744
740
|
"aria-hidden": title ? void 0 : true,
|
|
@@ -760,7 +756,10 @@ function Icon(props) {
|
|
|
760
756
|
spin,
|
|
761
757
|
spinPulse: pulse,
|
|
762
758
|
widthAuto: fixedWidth,
|
|
763
|
-
className: cn(
|
|
759
|
+
className: cn(
|
|
760
|
+
className,
|
|
761
|
+
props.onClick ? "cursor-pointer" : ""
|
|
762
|
+
),
|
|
764
763
|
title,
|
|
765
764
|
style: {
|
|
766
765
|
...tempStyle
|