@agilant/toga-blox 1.0.34 → 1.0.36
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.
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { SortArrowsProps } from "./types";
|
|
2
|
-
declare const SortArrows: <T extends object>({ column, setSortColumn, slug, isNested, parentIndex, onSortChange, renderPortalOverlay, onRequestClose, counterIcon, }: SortArrowsProps<T>
|
|
2
|
+
declare const SortArrows: <T extends object>({ column, setSortColumn, slug, isNested, parentIndex, onSortChange, renderPortalOverlay, onRequestClose, counterIcon, }: SortArrowsProps<T> & {
|
|
3
|
+
getFontAwesomeIconFn?: (iconName: string, iconStyle: string) => React.ReactElement | null;
|
|
4
|
+
}) => JSX.Element | null;
|
|
3
5
|
export default SortArrows;
|
|
@@ -2,10 +2,10 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import { useRef } from "react";
|
|
3
3
|
import { motion } from "framer-motion";
|
|
4
4
|
import { useSortArrowsViewModel } from "./useSortArrowsViewModel";
|
|
5
|
-
import { getFontAwesomeIcon } from "../../utils/getFontAwesomeIcon";
|
|
6
5
|
import SortArrowIcon from "../SortArrowIcon";
|
|
6
|
+
import { getFontAwesomeIcon } from "../../utils/getFontAwesomeIcon";
|
|
7
7
|
const SortArrows = ({ column, setSortColumn, slug, isNested, parentIndex, onSortChange, renderPortalOverlay, onRequestClose, counterIcon = {
|
|
8
|
-
icon: "
|
|
8
|
+
icon: "triangle",
|
|
9
9
|
weight: "solid",
|
|
10
10
|
numberClassNames: "absolute text-xs top-1.5 right-0 left-0",
|
|
11
11
|
iconClassNames: "text-lg text-blue-400 relative hover:text-red-400",
|
|
@@ -31,7 +31,7 @@ export const WithOverlayAndIndexCount = {
|
|
|
31
31
|
const [_, setSortColumn] = useState({});
|
|
32
32
|
const column = mockColumn("category", "Category");
|
|
33
33
|
return (_jsx("div", { className: "size-96", children: _jsx(SortArrows, { counterIcon: {
|
|
34
|
-
icon: "
|
|
34
|
+
icon: "triangle",
|
|
35
35
|
weight: "solid",
|
|
36
36
|
numberClassNames: "text-white text-[20px] text-red-400 rounded-full top-1.5 right-0 left-0",
|
|
37
37
|
iconClassNames: "text-blue-400 hover:text-red-400 p-4",
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
export declare const getFontAwesomeIcon: (iconName: string,
|
|
2
|
+
export declare const getFontAwesomeIcon: (iconName: string, iconStyle: "solid" | "regular" | "light" | undefined) => React.ReactElement | null;
|
|
@@ -1,16 +1,29 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
3
|
-
import * as
|
|
4
|
-
|
|
3
|
+
import * as SolidIcons from "@fortawesome/pro-solid-svg-icons";
|
|
4
|
+
import * as RegularIcons from "@fortawesome/pro-regular-svg-icons";
|
|
5
|
+
import * as LightIcons from "@fortawesome/pro-light-svg-icons";
|
|
6
|
+
export const getFontAwesomeIcon = (iconName, iconStyle) => {
|
|
5
7
|
try {
|
|
6
8
|
const iconKey = `fa${iconName.charAt(0).toUpperCase()}${iconName.slice(1)}`;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
let icon;
|
|
10
|
+
switch (iconStyle) {
|
|
11
|
+
case "solid":
|
|
12
|
+
icon = SolidIcons[iconKey];
|
|
13
|
+
break;
|
|
14
|
+
case "regular":
|
|
15
|
+
icon = RegularIcons[iconKey];
|
|
16
|
+
break;
|
|
17
|
+
case "light":
|
|
18
|
+
icon = LightIcons[iconKey];
|
|
19
|
+
break;
|
|
20
|
+
default:
|
|
21
|
+
throw new Error(`Unknown icon style: ${iconStyle}`);
|
|
10
22
|
}
|
|
11
|
-
|
|
12
|
-
throw new Error(`Icon not found
|
|
23
|
+
if (!icon) {
|
|
24
|
+
throw new Error(`Icon not found: ${iconKey}`);
|
|
13
25
|
}
|
|
26
|
+
return _jsx(FontAwesomeIcon, { icon: icon });
|
|
14
27
|
}
|
|
15
28
|
catch (error) {
|
|
16
29
|
console.error(`Error loading Font Awesome icon: ${iconName}`, error);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agilant/toga-blox",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.36",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -23,6 +23,9 @@
|
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@emotion/is-prop-valid": "^1.1.3",
|
|
26
|
+
"@fortawesome/pro-light-svg-icons": "^6.7.2",
|
|
27
|
+
"@fortawesome/pro-regular-svg-icons": "^6.7.2",
|
|
28
|
+
"@fortawesome/pro-solid-svg-icons": "^6.7.2",
|
|
26
29
|
"@storybook/addon-docs": "^7.6.6",
|
|
27
30
|
"@storybook/addon-viewport": "^7.6.10",
|
|
28
31
|
"@tanstack/react-virtual": "^3.1.3",
|