@trackunit/react-table 1.3.252 → 1.3.255
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.js +1 -28
- package/index.esm.js +2 -28
- package/package.json +11 -11
- package/src/index.d.ts +0 -1
- package/src/menus/RowSpacing.d.ts +0 -14
package/index.cjs.js
CHANGED
|
@@ -448,32 +448,6 @@ const ColumnFiltersDragAndDrop = ({ columns, setColumnOrder, onUserEvent, isSort
|
|
|
448
448
|
}) }));
|
|
449
449
|
};
|
|
450
450
|
|
|
451
|
-
/**
|
|
452
|
-
* RowSpacing component for managing the density of table rows.
|
|
453
|
-
*
|
|
454
|
-
* @param {RowDensityProps} props - The props object containing row density properties.
|
|
455
|
-
* @returns {ReactElement} A React JSX element representing the RowSpacing component.
|
|
456
|
-
*/
|
|
457
|
-
const RowSpacing = ({ density, setRowDensity, onUserEvent }) => {
|
|
458
|
-
const [t] = useTranslation();
|
|
459
|
-
const handleClick = (selectedDensity) => {
|
|
460
|
-
setRowDensity(selectedDensity);
|
|
461
|
-
onUserEvent?.("Row Spacing", {
|
|
462
|
-
densityChosen: selectedDensity,
|
|
463
|
-
});
|
|
464
|
-
};
|
|
465
|
-
return (jsxRuntime.jsx(reactComponents.Tooltip, { dataTestId: "row-spacing", label: t("table.spacing.toolip"), placement: "bottom", children: jsxRuntime.jsxs(reactComponents.Popover, { placement: "bottom-start", children: [jsxRuntime.jsx(reactComponents.PopoverTrigger, { children: jsxRuntime.jsx(reactComponents.Button, { prefix: jsxRuntime.jsx(reactComponents.Icon, { name: "ArrowsPointingOut", size: "small" }), size: "small", variant: "secondary", children: jsxRuntime.jsx("span", { className: "hidden md:block", children: t("table.spacing") }) }) }), jsxRuntime.jsx(reactComponents.PopoverContent, { children: jsxRuntime.jsx(reactComponents.MenuList, { children: jsxRuntime.jsxs("div", { className: "flex flex-col justify-start", children: [jsxRuntime.jsx(DensitySelection, { icon: jsxRuntime.jsx(CompactIcon, {}), isSelected: density === "compact", onClick: () => handleClick("compact"), text: t("table.rowDensity.compact") }), jsxRuntime.jsx(DensitySelection, { icon: jsxRuntime.jsx(SpaciousIcon, {}), isSelected: density === "spacious", onClick: () => handleClick("spacious"), text: t("table.rowDensity.spacious") })] }) }) })] }) }));
|
|
466
|
-
};
|
|
467
|
-
const DensitySelection = ({ text, onClick, icon, isSelected }) => {
|
|
468
|
-
return (jsxRuntime.jsxs("div", { className: "flex w-full cursor-pointer items-center p-1 hover:bg-neutral-50", onClick: onClick, children: [jsxRuntime.jsx("div", { className: "mr-1 flex", children: icon }), jsxRuntime.jsx(reactComponents.Text, { weight: "thick", children: text }), isSelected ? (jsxRuntime.jsx("div", { className: "justify-endgrow flex", children: jsxRuntime.jsx(reactComponents.Icon, { name: "Check", size: "small" }) })) : null] }));
|
|
469
|
-
};
|
|
470
|
-
const SpaciousIcon = () => {
|
|
471
|
-
return (jsxRuntime.jsx("svg", { height: 12, viewBox: "0 0 24 24", width: 12, xmlns: "http://www.w3.org/2000/svg", children: jsxRuntime.jsx("path", { d: "M2.25 18.003h19.5M2.25 12.003h19.5M2.25 6.003h19.5", fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2 }) }));
|
|
472
|
-
};
|
|
473
|
-
const CompactIcon = () => {
|
|
474
|
-
return (jsxRuntime.jsx("svg", { height: 12, viewBox: "0 0 24 24", width: 12, xmlns: "http://www.w3.org/2000/svg", children: jsxRuntime.jsx("path", { d: "M2.25 18.003h19.5M2.25 12.003h19.5M2.25 6.003h19.5", fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 4.5 }) }));
|
|
475
|
-
};
|
|
476
|
-
|
|
477
451
|
/**
|
|
478
452
|
* Sorting component for managing table column sorting.
|
|
479
453
|
*
|
|
@@ -972,7 +946,7 @@ const Table = ({ rowHeight = 50, ...props }) => {
|
|
|
972
946
|
header.column.getToggleSortingHandler()?.(event);
|
|
973
947
|
}
|
|
974
948
|
}, [props]);
|
|
975
|
-
return (jsxRuntime.jsxs(reactComponents.Card, { className: tailwindMerge.twMerge("flex flex-col overflow-hidden", props.className), dataTestId: props.dataTestId, children: [props.headerLeftActions || props.headerRightActions ? (jsxRuntime.jsxs("div", { className: "z-default flex justify-between gap-2 p-2", children: [jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: props.headerLeftActions }), jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: props.headerRightActions })] })) : null, jsxRuntime.jsx("div", { className: "h-full overflow-x-auto overflow-y-scroll border-b border-t border-neutral-200", onScroll: e => fetchMoreOnBottomReached(e.target), ref: tableContainerRef, children: jsxRuntime.jsxs(reactTableBaseComponents.TableRoot, { style: {
|
|
949
|
+
return (jsxRuntime.jsxs(reactComponents.Card, { className: tailwindMerge.twMerge("table-compact flex flex-col overflow-hidden", props.className), dataTestId: props.dataTestId, children: [props.headerLeftActions || props.headerRightActions ? (jsxRuntime.jsxs("div", { className: "z-default flex justify-between gap-2 p-2", children: [jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: props.headerLeftActions }), jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: props.headerRightActions })] })) : null, jsxRuntime.jsx("div", { className: "h-full overflow-x-auto overflow-y-scroll border-b border-t border-neutral-200", onScroll: e => fetchMoreOnBottomReached(e.target), ref: tableContainerRef, children: jsxRuntime.jsxs(reactTableBaseComponents.TableRoot, { style: {
|
|
976
950
|
height: hasResults ? "auto" : "100%",
|
|
977
951
|
width: "100%",
|
|
978
952
|
position: "relative",
|
|
@@ -1433,7 +1407,6 @@ Object.defineProperty(exports, "createColumnHelper", {
|
|
|
1433
1407
|
});
|
|
1434
1408
|
exports.ActionSheet = ActionSheet;
|
|
1435
1409
|
exports.ColumnFilter = ColumnFilter;
|
|
1436
|
-
exports.RowSpacing = RowSpacing;
|
|
1437
1410
|
exports.Sorting = Sorting;
|
|
1438
1411
|
exports.Table = Table;
|
|
1439
1412
|
exports.fromTUSortToTanStack = fromTUSortToTanStack;
|
package/index.esm.js
CHANGED
|
@@ -447,32 +447,6 @@ const ColumnFiltersDragAndDrop = ({ columns, setColumnOrder, onUserEvent, isSort
|
|
|
447
447
|
}) }));
|
|
448
448
|
};
|
|
449
449
|
|
|
450
|
-
/**
|
|
451
|
-
* RowSpacing component for managing the density of table rows.
|
|
452
|
-
*
|
|
453
|
-
* @param {RowDensityProps} props - The props object containing row density properties.
|
|
454
|
-
* @returns {ReactElement} A React JSX element representing the RowSpacing component.
|
|
455
|
-
*/
|
|
456
|
-
const RowSpacing = ({ density, setRowDensity, onUserEvent }) => {
|
|
457
|
-
const [t] = useTranslation();
|
|
458
|
-
const handleClick = (selectedDensity) => {
|
|
459
|
-
setRowDensity(selectedDensity);
|
|
460
|
-
onUserEvent?.("Row Spacing", {
|
|
461
|
-
densityChosen: selectedDensity,
|
|
462
|
-
});
|
|
463
|
-
};
|
|
464
|
-
return (jsx(Tooltip, { dataTestId: "row-spacing", label: t("table.spacing.toolip"), placement: "bottom", children: jsxs(Popover, { placement: "bottom-start", children: [jsx(PopoverTrigger, { children: jsx(Button, { prefix: jsx(Icon, { name: "ArrowsPointingOut", size: "small" }), size: "small", variant: "secondary", children: jsx("span", { className: "hidden md:block", children: t("table.spacing") }) }) }), jsx(PopoverContent, { children: jsx(MenuList, { children: jsxs("div", { className: "flex flex-col justify-start", children: [jsx(DensitySelection, { icon: jsx(CompactIcon, {}), isSelected: density === "compact", onClick: () => handleClick("compact"), text: t("table.rowDensity.compact") }), jsx(DensitySelection, { icon: jsx(SpaciousIcon, {}), isSelected: density === "spacious", onClick: () => handleClick("spacious"), text: t("table.rowDensity.spacious") })] }) }) })] }) }));
|
|
465
|
-
};
|
|
466
|
-
const DensitySelection = ({ text, onClick, icon, isSelected }) => {
|
|
467
|
-
return (jsxs("div", { className: "flex w-full cursor-pointer items-center p-1 hover:bg-neutral-50", onClick: onClick, children: [jsx("div", { className: "mr-1 flex", children: icon }), jsx(Text, { weight: "thick", children: text }), isSelected ? (jsx("div", { className: "justify-endgrow flex", children: jsx(Icon, { name: "Check", size: "small" }) })) : null] }));
|
|
468
|
-
};
|
|
469
|
-
const SpaciousIcon = () => {
|
|
470
|
-
return (jsx("svg", { height: 12, viewBox: "0 0 24 24", width: 12, xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M2.25 18.003h19.5M2.25 12.003h19.5M2.25 6.003h19.5", fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2 }) }));
|
|
471
|
-
};
|
|
472
|
-
const CompactIcon = () => {
|
|
473
|
-
return (jsx("svg", { height: 12, viewBox: "0 0 24 24", width: 12, xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M2.25 18.003h19.5M2.25 12.003h19.5M2.25 6.003h19.5", fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 4.5 }) }));
|
|
474
|
-
};
|
|
475
|
-
|
|
476
450
|
/**
|
|
477
451
|
* Sorting component for managing table column sorting.
|
|
478
452
|
*
|
|
@@ -971,7 +945,7 @@ const Table = ({ rowHeight = 50, ...props }) => {
|
|
|
971
945
|
header.column.getToggleSortingHandler()?.(event);
|
|
972
946
|
}
|
|
973
947
|
}, [props]);
|
|
974
|
-
return (jsxs(Card, { className: twMerge("flex flex-col overflow-hidden", props.className), dataTestId: props.dataTestId, children: [props.headerLeftActions || props.headerRightActions ? (jsxs("div", { className: "z-default flex justify-between gap-2 p-2", children: [jsx("div", { className: "flex items-center gap-2", children: props.headerLeftActions }), jsx("div", { className: "flex items-center gap-2", children: props.headerRightActions })] })) : null, jsx("div", { className: "h-full overflow-x-auto overflow-y-scroll border-b border-t border-neutral-200", onScroll: e => fetchMoreOnBottomReached(e.target), ref: tableContainerRef, children: jsxs(TableRoot, { style: {
|
|
948
|
+
return (jsxs(Card, { className: twMerge("table-compact flex flex-col overflow-hidden", props.className), dataTestId: props.dataTestId, children: [props.headerLeftActions || props.headerRightActions ? (jsxs("div", { className: "z-default flex justify-between gap-2 p-2", children: [jsx("div", { className: "flex items-center gap-2", children: props.headerLeftActions }), jsx("div", { className: "flex items-center gap-2", children: props.headerRightActions })] })) : null, jsx("div", { className: "h-full overflow-x-auto overflow-y-scroll border-b border-t border-neutral-200", onScroll: e => fetchMoreOnBottomReached(e.target), ref: tableContainerRef, children: jsxs(TableRoot, { style: {
|
|
975
949
|
height: hasResults ? "auto" : "100%",
|
|
976
950
|
width: "100%",
|
|
977
951
|
position: "relative",
|
|
@@ -1426,4 +1400,4 @@ const fromTanStackToTUSort = (input) => {
|
|
|
1426
1400
|
*/
|
|
1427
1401
|
setupLibraryTranslations();
|
|
1428
1402
|
|
|
1429
|
-
export { ActionSheet, ColumnFilter,
|
|
1403
|
+
export { ActionSheet, ColumnFilter, Sorting, Table, fromTUSortToTanStack, fromTanStackToTUSort, useColumnHelper, useTable, useTableSelection };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-table",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.255",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -15,16 +15,16 @@
|
|
|
15
15
|
"jest-fetch-mock": "^3.0.3",
|
|
16
16
|
"@tanstack/react-router": "1.114.29",
|
|
17
17
|
"tailwind-merge": "^2.0.0",
|
|
18
|
-
"@trackunit/react-components": "1.4.
|
|
19
|
-
"@trackunit/shared-utils": "1.5.
|
|
20
|
-
"@trackunit/css-class-variance-utilities": "1.3.
|
|
21
|
-
"@trackunit/ui-icons": "1.3.
|
|
22
|
-
"@trackunit/react-table-base-components": "1.3.
|
|
23
|
-
"@trackunit/react-table-pagination": "1.3.
|
|
24
|
-
"@trackunit/react-form-components": "1.3.
|
|
25
|
-
"@trackunit/i18n-library-translation": "1.3.
|
|
26
|
-
"@trackunit/react-core-contexts-api": "1.4.
|
|
27
|
-
"@trackunit/react-test-setup": "1.0.
|
|
18
|
+
"@trackunit/react-components": "1.4.199",
|
|
19
|
+
"@trackunit/shared-utils": "1.5.163",
|
|
20
|
+
"@trackunit/css-class-variance-utilities": "1.3.163",
|
|
21
|
+
"@trackunit/ui-icons": "1.3.164",
|
|
22
|
+
"@trackunit/react-table-base-components": "1.3.223",
|
|
23
|
+
"@trackunit/react-table-pagination": "1.3.163",
|
|
24
|
+
"@trackunit/react-form-components": "1.3.225",
|
|
25
|
+
"@trackunit/i18n-library-translation": "1.3.187",
|
|
26
|
+
"@trackunit/react-core-contexts-api": "1.4.171",
|
|
27
|
+
"@trackunit/react-test-setup": "1.0.53"
|
|
28
28
|
},
|
|
29
29
|
"module": "./index.esm.js",
|
|
30
30
|
"main": "./index.cjs.js",
|
package/src/index.d.ts
CHANGED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export type Density = "spacious" | "compact";
|
|
2
|
-
interface RowDensityProps {
|
|
3
|
-
density: Density;
|
|
4
|
-
setRowDensity: (density: Density) => void;
|
|
5
|
-
onUserEvent?: (event: "Row Spacing", payload: Record<string, unknown>) => void;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* RowSpacing component for managing the density of table rows.
|
|
9
|
-
*
|
|
10
|
-
* @param {RowDensityProps} props - The props object containing row density properties.
|
|
11
|
-
* @returns {ReactElement} A React JSX element representing the RowSpacing component.
|
|
12
|
-
*/
|
|
13
|
-
export declare const RowSpacing: ({ density, setRowDensity, onUserEvent }: RowDensityProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
export {};
|