@sustaina/shared-ui 1.6.3 → 1.7.0

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.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(classes, header.column.columnDef?.meta?.headerProps?.className),
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
- ...column.columnDef?.meta?.cellProps,
970
+ ...tableFilterCellProps,
971
+ ...column.columnDef?.meta?.filterCellProps,
963
972
  className: cn(
964
973
  "bg-white border-b",
965
974
  classes,
966
- column.columnDef?.meta?.cellProps?.className
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
- ...column.columnDef?.meta?.cellProps?.style
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())
@@ -1925,10 +1940,10 @@ var Navbar = ({
1925
1940
  subTitle,
1926
1941
  headImageURL = "",
1927
1942
  headImageURLClassName,
1928
- tooltipContentClassName = "md:w-[350px] lg:w-[420px]",
1943
+ tooltipContentClassName = "w-[450px] lg:!w-[630px]",
1929
1944
  tooltipTitle,
1930
1945
  tooltipIcon,
1931
- tooltipdescription = [],
1946
+ tooltipdescription,
1932
1947
  tooltipDescriptionWrapperClassName,
1933
1948
  mainButtonText,
1934
1949
  mainButtonClassName,
@@ -1957,19 +1972,18 @@ var Navbar = ({
1957
1972
  isValidElement(title) ? title : /* @__PURE__ */ jsx("h1", { className: "text-white text-xl font-bold", children: title }),
1958
1973
  isValidElement(subTitle) ? subTitle : /* @__PURE__ */ jsx("h1", { className: "text-white text-sm font-semibold", children: subTitle })
1959
1974
  ] }),
1960
- tooltipTitle && /* @__PURE__ */ jsxs(Tooltip2, { delayDuration: 700, children: [
1975
+ tooltipTitle && /* @__PURE__ */ jsxs(Tooltip2, { children: [
1961
1976
  /* @__PURE__ */ jsx(TooltipTrigger2, { asChild: true, children: /* @__PURE__ */ jsx("button", { className: "text-white hover:opacity-80", children: /* @__PURE__ */ jsx(InfoIcon_default, { className: "w-4" }) }) }),
1962
1977
  /* @__PURE__ */ jsxs(
1963
1978
  TooltipContent2,
1964
1979
  {
1965
1980
  forceMount: true,
1966
1981
  side: isDesktop ? "right" : "bottom",
1967
- sideOffset: 8,
1968
1982
  align: "start",
1969
1983
  avoidCollisions: false,
1970
1984
  className: cn(
1971
- "bg-background text-foreground border border-black",
1972
- "transition-all duration-150 ease-out origin-top",
1985
+ "bg-white border border-black p-6",
1986
+ "transition-all duration-150 ease-out origin-top top-1 left-4",
1973
1987
  "data-[state=closed]:opacity-0 data-[state=open]:opacity-100",
1974
1988
  "data-[state=closed]:scale-95 data-[state=open]:scale-100",
1975
1989
  { "mt-5": isDesktop },
@@ -1982,7 +1996,7 @@ var Navbar = ({
1982
1996
  role: "tooltip",
1983
1997
  "aria-label": tooltipTitle,
1984
1998
  className: cn(
1985
- "flex flex-col gap-4 max-w-sm text-sm text-gray-700",
1999
+ "flex flex-col gap-4 text-sm text-black text-pretty",
1986
2000
  tooltipDescriptionWrapperClassName
1987
2001
  ),
1988
2002
  children: [
@@ -1990,7 +2004,7 @@ var Navbar = ({
1990
2004
  isValidElement(tooltipIcon) ? tooltipIcon : /* @__PURE__ */ jsx(Icon3, { size: 32, "aria-hidden": "true" }),
1991
2005
  /* @__PURE__ */ jsx("h3", { className: "text-xl font-bold", children: tooltipTitle })
1992
2006
  ] }),
1993
- isValidElement(tooltipdescription) ? tooltipdescription : ""
2007
+ isValidElement(tooltipdescription) && tooltipdescription
1994
2008
  ]
1995
2009
  }
1996
2010
  ),
@@ -5216,7 +5230,8 @@ function DialogAlert({
5216
5230
  onCancel,
5217
5231
  showCancel = true,
5218
5232
  align = "center",
5219
- outlet
5233
+ outlet,
5234
+ persistent = false
5220
5235
  }) {
5221
5236
  const alignClass = align === "start" ? "justify-start" : align === "end" ? "justify-end" : "justify-center";
5222
5237
  const handleCancel = useCallback(() => {
@@ -5226,7 +5241,8 @@ function DialogAlert({
5226
5241
  const handleConfirm = useCallback(() => {
5227
5242
  onConfirm?.();
5228
5243
  }, [onConfirm]);
5229
- return /* @__PURE__ */ jsx(Dialog2, { open, onOpenChange, children: /* @__PURE__ */ jsxs(DialogContent2, { className: "max-w-md", children: [
5244
+ return /* @__PURE__ */ jsx(Dialog2, { open, onOpenChange: persistent ? () => {
5245
+ } : onOpenChange, children: /* @__PURE__ */ jsxs(DialogContent2, { className: "max-w-md", showCloseButton: !persistent, children: [
5230
5246
  /* @__PURE__ */ jsxs(DialogHeader2, { children: [
5231
5247
  title && /* @__PURE__ */ jsx(DialogTitle2, { className: variantClass(variant), children: title }),
5232
5248
  description && /* @__PURE__ */ jsx(DialogDescription2, { children: description })