@agilant/toga-blox 1.0.44 → 1.0.46
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/components/MagnifyingIcon/MagnifyingIcon.js +1 -3
- package/dist/components/MagnifyingIcon/MagnifyingIcon.stories.js +0 -2
- package/dist/components/MagnifyingIcon/types.d.ts +1 -3
- package/dist/components/MagnifyingIcon/types.js +0 -1
- package/dist/components/PrimaryTableHeader/PrimaryTableHeader.js +1 -1
- package/dist/components/SortArrows/SortArrows.d.ts +1 -3
- package/dist/components/SortArrows/SortArrows.js +2 -1
- package/dist/components/SortArrows/types.d.ts +4 -3
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
// src/components/MagnifyingIcon.tsx
|
|
3
3
|
import { forwardRef, useEffect, useState } from "react";
|
|
4
4
|
import { getFontAwesomeIcon } from "../../utils/getFontAwesomeIcon";
|
|
5
|
-
const MagnifyingIcon = forwardRef(({ columnIndex, editingHeader, setEditingHeader, setHeaderValue, column,
|
|
5
|
+
const MagnifyingIcon = forwardRef(({ columnIndex, editingHeader, setEditingHeader, setHeaderValue, column, setActiveColumn, iconColor = "text-blue-500", iconActiveColor = "text-green-500", iconActiveBackgroundColor = "bg-red-500", isActive, additionalIconClasses, setSearchText, searchText, isSearchOpen, }, ref) => {
|
|
6
6
|
const [showActiveStyles, setShowActiveStyles] = useState(false);
|
|
7
7
|
useEffect(() => {
|
|
8
8
|
if (isActive !== undefined) {
|
|
@@ -49,8 +49,6 @@ const MagnifyingIcon = forwardRef(({ columnIndex, editingHeader, setEditingHeade
|
|
|
49
49
|
}
|
|
50
50
|
setEditingHeader(columnIndex);
|
|
51
51
|
setHeaderValue(column.Header);
|
|
52
|
-
setSearchColumn(column);
|
|
53
|
-
setActiveColumnFromSearch(column.id);
|
|
54
52
|
setActiveColumn(columnIndex);
|
|
55
53
|
};
|
|
56
54
|
return (_jsx("div", { ref: ref, "data-testid": "magnifying-icon-test-id", className: `flex items-center cursor-pointer size-[18px] rounded relative ml-1 ${iconColor} ${showActiveStyles
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ColumnInstance } from "react-table";
|
|
2
2
|
export interface MagnifyingIconProps<T extends object> {
|
|
3
3
|
columnIndex: number;
|
|
4
4
|
editingHeader: number | null;
|
|
5
5
|
setEditingHeader: (index: number | null) => void;
|
|
6
6
|
setHeaderValue: (value: string) => void;
|
|
7
7
|
column: ColumnInstance<T>;
|
|
8
|
-
setSearchColumn: (col: Column<T>) => void;
|
|
9
|
-
setActiveColumnFromSearch: (id: string) => void;
|
|
10
8
|
setActiveColumn: (index: number) => void;
|
|
11
9
|
iconColor?: string;
|
|
12
10
|
iconBackgroundColor?: string;
|
|
@@ -66,7 +66,7 @@ const PrimaryTableHeader = ({ headerGroups, editingHeader, searchText, setSearch
|
|
|
66
66
|
})()] }) }), PortalComponent] })) : (_jsx(TableHeaderContent, { column: updatedColumn })), _jsx("div", { className: "ml-1", children: _jsx(SortArrows, { slug: mappingField || "", parentIndex: parentIndex, isNested: isNested, column: {
|
|
67
67
|
...updatedColumn,
|
|
68
68
|
accessor: updatedColumn.id,
|
|
69
|
-
}, setSortColumn: setSortColumn, onSortChange: handleSortChange }) }), shouldRenderMagnifyingIcon && (_jsx(MagnifyingIcon, { ref: magnifyingIconRef, column: updatedColumn,
|
|
69
|
+
}, setSortColumn: setSortColumn, onSortChange: handleSortChange }) }), shouldRenderMagnifyingIcon && (_jsx(MagnifyingIcon, { ref: magnifyingIconRef, column: updatedColumn, editingHeader: editingHeader, columnIndex: columnIndex, setEditingHeader: setEditingHeader, setHeaderValue: setHeaderValue, isActive: activeColumn === columnIndex, setActiveColumn: setActiveColumn, setSearchText: setSearchText, searchText: searchText, isSearchOpen: editingHeader !== null }))] })));
|
|
70
70
|
})))) }));
|
|
71
71
|
};
|
|
72
72
|
export default PrimaryTableHeader;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import { SortArrowsProps } from "./types";
|
|
2
|
-
declare const SortArrows: <T extends object>({ column, setSortColumn, slug, isNested, parentIndex, onSortChange, renderPortalOverlay, onRequestClose, counterIcon, directionContainerClassNames, }: SortArrowsProps<T>
|
|
3
|
-
getFontAwesomeIconFn?: (iconName: string, iconStyle: string) => React.ReactElement | null;
|
|
4
|
-
}) => JSX.Element | null;
|
|
2
|
+
declare const SortArrows: <T extends object>({ column, setSortColumn, slug, isNested, parentIndex, onSortChange, renderPortalOverlay, onRequestClose, counterIcon, directionContainerClassNames, }: SortArrowsProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
5
3
|
export default SortArrows;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
// src/components/SortArrows/SortArrows.tsx
|
|
2
3
|
import { useRef } from "react";
|
|
3
4
|
import { motion } from "framer-motion";
|
|
4
5
|
import { useSortArrowsViewModel } from "./useSortArrowsViewModel";
|
|
@@ -26,7 +27,7 @@ const SortArrows = ({ column, setSortColumn, slug, isNested, parentIndex, onSort
|
|
|
26
27
|
setShowArrowContainer(false);
|
|
27
28
|
onRequestClose?.();
|
|
28
29
|
};
|
|
29
|
-
return (_jsxs("div", { "data-testid": `sort-arrows-${slug}`, ref: containerRef, className: arrowContainerClassNames, onClick: handleParentClick, children: [isActive && (_jsxs("div", { className: "relative", children: [_jsx("div", { className: `${counterIcon.iconClassNames} ${activeDirection === "desc" ? "rotate-180" : ""}`, children: _jsx("span", { className:
|
|
30
|
+
return (_jsxs("div", { "data-testid": `sort-arrows-${slug}`, ref: containerRef, className: arrowContainerClassNames, onClick: handleParentClick, children: [isActive && (_jsxs("div", { className: "relative", children: [_jsx("div", { className: `${counterIcon.iconClassNames} ${activeDirection === "desc" ? "rotate-180" : ""}`, children: _jsx("span", { className: counterIcon.numberSize, children: getFontAwesomeIcon(counterIcon.icon, counterIcon.weight) }) }), _jsx("span", { className: `${counterIcon.numberClassNames} ${activeDirection === "desc" && " pb-0.5"}`, children: sortOrderNumber })] })), !isActive && (_jsxs(_Fragment, { children: [_jsx(SortArrowIcon, { slug: slug, parentIndex: parentIndex, columnName: String(column.render("Header")), direction: "up", setColumn: () => { }, isActive: false }), _jsx(SortArrowIcon, { slug: slug, parentIndex: parentIndex, columnName: String(column.render("Header")), direction: "down", setColumn: () => { }, isActive: false })] })), showArrowContainer && (_jsxs(motion.div, { className: `${directionContainerClassNames} ${column.id === "col1" ? "left-[5px]" : ""}`, initial: "initial", animate: "animate", exit: "exit", children: [activeDirection !== "asc" && (_jsxs("div", { className: "flex border-b-1 p-1 hover:bg-blue-50", onClick: () => handleClick("up"), children: [_jsx("span", { className: "pl-1 text-primary", children: getFontAwesomeIcon("arrowUp", "regular") }), _jsx("span", { className: "flex-1 text-left pl-4", children: "Ascending" })] })), activeDirection !== "desc" && (_jsxs("div", { className: "flex p-1 hover:bg-blue-50 border-b-1", onClick: () => handleClick("down"), children: [_jsx("span", { className: "pl-1 text-primary", children: getFontAwesomeIcon("arrowDown", "regular") }), _jsx("span", { className: "flex-1 text-left pl-4", children: "Descending" })] })), isActive && (_jsxs("div", { className: "flex border-b-1 p-1 hover:bg-blue-50", onClick: handleResetSort, children: [_jsx("span", { className: "pl-1 text-primary", children: getFontAwesomeIcon("rotateLeft", "solid") }), _jsx("span", { className: "flex-1 text-left pl-3", children: "Reset" })] }))] })), showArrowContainer &&
|
|
30
31
|
renderPortalOverlay &&
|
|
31
32
|
renderPortalOverlay(handleClose)] }));
|
|
32
33
|
};
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { ColumnInstance } from "react-table";
|
|
2
|
+
export interface CustomColumnInstance<T extends object> extends ColumnInstance<T> {
|
|
3
|
+
/** We want to guarantee an accessor exists and can be a string or function, etc. */
|
|
4
|
+
accessor: string | number | symbol | ((row: T) => any);
|
|
5
|
+
}
|
|
2
6
|
export interface SortArrowsProps<T extends object> {
|
|
3
7
|
column: CustomColumnInstance<T>;
|
|
4
8
|
setSortColumn: any;
|
|
@@ -17,6 +21,3 @@ export interface SortArrowsProps<T extends object> {
|
|
|
17
21
|
};
|
|
18
22
|
directionContainerClassNames?: string;
|
|
19
23
|
}
|
|
20
|
-
export interface CustomColumnInstance<T extends object> extends ColumnInstance<T> {
|
|
21
|
-
accessor: string | number | symbol | ((row: T) => any);
|
|
22
|
-
}
|