@sustaina/shared-ui 1.6.4 → 1.7.1
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.d.mts +20 -2
- package/dist/index.d.ts +20 -2
- package/dist/index.js +32 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -931,17 +931,24 @@ var DataTable = ({
|
|
|
931
931
|
return /* @__PURE__ */ jsx(TableRow, { children: headerGroup.headers.map((header) => {
|
|
932
932
|
const { classes, style } = getColumnPinningStyles(header.column);
|
|
933
933
|
const useColumnSizing = header.column.columnDef?.meta?.useColumnSizing ?? columnResizing?.enabled ?? false;
|
|
934
|
+
const tableHeadCellProps = typeof components?.tableHeadCellProps === "function" ? components?.tableHeadCellProps({ header, table }) : components?.tableHeadCellProps;
|
|
934
935
|
return /* @__PURE__ */ jsxs(
|
|
935
936
|
TableHead,
|
|
936
937
|
{
|
|
937
938
|
colSpan: header.colSpan,
|
|
939
|
+
...tableHeadCellProps,
|
|
938
940
|
...header.column.columnDef?.meta?.headerProps,
|
|
939
|
-
className: cn(
|
|
941
|
+
className: cn(
|
|
942
|
+
classes,
|
|
943
|
+
tableHeadCellProps?.className,
|
|
944
|
+
header.column.columnDef?.meta?.headerProps?.className
|
|
945
|
+
),
|
|
940
946
|
style: {
|
|
941
947
|
...style,
|
|
942
948
|
width: useColumnSizing ? header.column.getSize() : void 0,
|
|
943
949
|
minWidth: useColumnSizing ? header.column.columnDef.minSize : void 0,
|
|
944
950
|
maxWidth: useColumnSizing ? header.column.columnDef.maxSize : void 0,
|
|
951
|
+
...tableHeadCellProps?.style,
|
|
945
952
|
...header.column.columnDef?.meta?.headerProps?.style
|
|
946
953
|
},
|
|
947
954
|
children: [
|
|
@@ -956,14 +963,17 @@ var DataTable = ({
|
|
|
956
963
|
isSomeColumnsFilterable && /* @__PURE__ */ jsx(TableRow, { children: filterableColumns.map((column) => {
|
|
957
964
|
const { classes, style } = getColumnPinningStyles(column);
|
|
958
965
|
const useColumnSizing = column.columnDef.meta?.useColumnSizing ?? columnResizing?.enabled ?? false;
|
|
966
|
+
const tableFilterCellProps = typeof components?.tableFilterCellProps === "function" ? components?.tableFilterCellProps({ column, table }) : components?.tableFilterCellProps;
|
|
959
967
|
return /* @__PURE__ */ jsx(
|
|
960
968
|
TableCell,
|
|
961
969
|
{
|
|
962
|
-
...
|
|
970
|
+
...tableFilterCellProps,
|
|
971
|
+
...column.columnDef?.meta?.filterCellProps,
|
|
963
972
|
className: cn(
|
|
964
973
|
"bg-white border-b",
|
|
965
974
|
classes,
|
|
966
|
-
|
|
975
|
+
tableFilterCellProps?.className,
|
|
976
|
+
column.columnDef?.meta?.filterCellProps?.className
|
|
967
977
|
),
|
|
968
978
|
style: {
|
|
969
979
|
// TODO: should we separate styles for filter or use same columns styles
|
|
@@ -971,7 +981,8 @@ var DataTable = ({
|
|
|
971
981
|
width: useColumnSizing ? column.getSize() : void 0,
|
|
972
982
|
minWidth: useColumnSizing ? column.columnDef.minSize : void 0,
|
|
973
983
|
maxWidth: useColumnSizing ? column.columnDef.maxSize : void 0,
|
|
974
|
-
...
|
|
984
|
+
...tableFilterCellProps?.style,
|
|
985
|
+
...column.columnDef?.meta?.filterCellProps?.style
|
|
975
986
|
},
|
|
976
987
|
children: column.getCanFilter() && column.columnDef.meta?.renderColumnFilter?.({
|
|
977
988
|
column,
|
|
@@ -1003,9 +1014,11 @@ var DataTable = ({
|
|
|
1003
1014
|
row.getVisibleCells().map((cell) => {
|
|
1004
1015
|
const { classes, style } = getColumnPinningStyles(cell.column);
|
|
1005
1016
|
const useColumnSizing = cell.column.columnDef.meta?.useColumnSizing ?? columnResizing?.enabled ?? false;
|
|
1017
|
+
const tableDataCellProps = typeof components?.tableDataCellProps === "function" ? components?.tableDataCellProps({ row, cell, table }) : components?.tableDataCellProps;
|
|
1006
1018
|
return /* @__PURE__ */ jsx(
|
|
1007
1019
|
TableCell,
|
|
1008
1020
|
{
|
|
1021
|
+
...tableDataCellProps,
|
|
1009
1022
|
...cell.column.columnDef?.meta?.cellProps,
|
|
1010
1023
|
className: cn(
|
|
1011
1024
|
{
|
|
@@ -1013,6 +1026,7 @@ var DataTable = ({
|
|
|
1013
1026
|
"bg-white group-hover:bg-[#eff5f1]": !row.getIsSelected()
|
|
1014
1027
|
},
|
|
1015
1028
|
classes,
|
|
1029
|
+
tableDataCellProps?.className,
|
|
1016
1030
|
cell.column.columnDef?.meta?.cellProps?.className
|
|
1017
1031
|
),
|
|
1018
1032
|
style: {
|
|
@@ -1020,6 +1034,7 @@ var DataTable = ({
|
|
|
1020
1034
|
width: useColumnSizing ? cell.column.getSize() : void 0,
|
|
1021
1035
|
minWidth: useColumnSizing ? cell.column.columnDef.minSize : void 0,
|
|
1022
1036
|
maxWidth: useColumnSizing ? cell.column.columnDef.maxSize : void 0,
|
|
1037
|
+
...tableDataCellProps?.style,
|
|
1023
1038
|
...cell.column.columnDef?.meta?.cellProps?.style
|
|
1024
1039
|
},
|
|
1025
1040
|
children: flexRender(cell.column.columnDef.cell, cell.getContext())
|
|
@@ -1536,10 +1551,13 @@ function SortableRow({
|
|
|
1536
1551
|
id: value,
|
|
1537
1552
|
disabled: name == "columns.0.id"
|
|
1538
1553
|
});
|
|
1539
|
-
const style =
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1554
|
+
const style = React4.useMemo(
|
|
1555
|
+
() => ({
|
|
1556
|
+
transform: CSS.Transform.toString(transform),
|
|
1557
|
+
transition
|
|
1558
|
+
}),
|
|
1559
|
+
[transform, transition]
|
|
1560
|
+
);
|
|
1543
1561
|
const capitalize = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
|
1544
1562
|
const currentFormColumns = useWatch({ control, name: "columns" });
|
|
1545
1563
|
return /* @__PURE__ */ jsx("div", { ref: setNodeRef, style, className: "flex items-center rounded-md bg-white", children: /* @__PURE__ */ jsx(
|
|
@@ -1548,7 +1566,7 @@ function SortableRow({
|
|
|
1548
1566
|
control,
|
|
1549
1567
|
name,
|
|
1550
1568
|
render: ({ field }) => {
|
|
1551
|
-
const options = availableColumns.filter((col) => col.id === field.value || !currentFormColumns?.some((c) => c.id === col.id)).map((col) => ({ id: col.id, label: capitalize(col.id) }));
|
|
1569
|
+
const options = availableColumns.filter((col) => col.id === field.value || !currentFormColumns?.some((c) => c.id === col.id)).map((col) => ({ id: col.id, label: col?.label ? col.label : capitalize(col.id) }));
|
|
1552
1570
|
return /* @__PURE__ */ jsxs(FormItem2, { className: "flex-1", children: [
|
|
1553
1571
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1554
1572
|
/* @__PURE__ */ jsx(
|
|
@@ -1957,7 +1975,7 @@ var Navbar = ({
|
|
|
1957
1975
|
isValidElement(title) ? title : /* @__PURE__ */ jsx("h1", { className: "text-white text-xl font-bold", children: title }),
|
|
1958
1976
|
isValidElement(subTitle) ? subTitle : /* @__PURE__ */ jsx("h1", { className: "text-white text-sm font-semibold", children: subTitle })
|
|
1959
1977
|
] }),
|
|
1960
|
-
tooltipTitle && /* @__PURE__ */ jsxs(Tooltip2, {
|
|
1978
|
+
tooltipTitle && /* @__PURE__ */ jsxs(Tooltip2, { children: [
|
|
1961
1979
|
/* @__PURE__ */ jsx(TooltipTrigger2, { asChild: true, children: /* @__PURE__ */ jsx("button", { className: "text-white hover:opacity-80", children: /* @__PURE__ */ jsx(InfoIcon_default, { className: "w-4" }) }) }),
|
|
1962
1980
|
/* @__PURE__ */ jsxs(
|
|
1963
1981
|
TooltipContent2,
|
|
@@ -5215,7 +5233,8 @@ function DialogAlert({
|
|
|
5215
5233
|
onCancel,
|
|
5216
5234
|
showCancel = true,
|
|
5217
5235
|
align = "center",
|
|
5218
|
-
outlet
|
|
5236
|
+
outlet,
|
|
5237
|
+
persistent = false
|
|
5219
5238
|
}) {
|
|
5220
5239
|
const alignClass = align === "start" ? "justify-start" : align === "end" ? "justify-end" : "justify-center";
|
|
5221
5240
|
const handleCancel = useCallback(() => {
|
|
@@ -5225,7 +5244,8 @@ function DialogAlert({
|
|
|
5225
5244
|
const handleConfirm = useCallback(() => {
|
|
5226
5245
|
onConfirm?.();
|
|
5227
5246
|
}, [onConfirm]);
|
|
5228
|
-
return /* @__PURE__ */ jsx(Dialog2, { open, onOpenChange
|
|
5247
|
+
return /* @__PURE__ */ jsx(Dialog2, { open, onOpenChange: persistent ? () => {
|
|
5248
|
+
} : onOpenChange, children: /* @__PURE__ */ jsxs(DialogContent2, { className: "max-w-md", showCloseButton: !persistent, children: [
|
|
5229
5249
|
/* @__PURE__ */ jsxs(DialogHeader2, { children: [
|
|
5230
5250
|
title && /* @__PURE__ */ jsx(DialogTitle2, { className: variantClass(variant), children: title }),
|
|
5231
5251
|
description && /* @__PURE__ */ jsx(DialogDescription2, { children: description })
|