@stella-source/stellasource-dsl 0.2.8 → 0.2.9

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,4 +1,4 @@
1
1
  import React from "react";
2
2
  import { TableProps } from "./types";
3
- declare function Table<T>({ columns, data, isLoading, serverSide, onPageChange, onSortChange, onFilterChange, onRowSelect, rowStatuses, showSelection, showRowOptions, showPagination, variant, paginationDetails, selectionMenuItems, dataAuto, dataTestId, id, className, htmlProps, resetTrigger, emptyTableState, }: TableProps<T>): React.JSX.Element;
3
+ declare function Table<T>({ columns, data, isLoading, serverSide, onPageChange, onSortChange, onFilterChange, onRowSelect, onRowClick, rowStatuses, showSelection, showRowOptions, showPagination, variant, paginationDetails, selectionMenuItems, dataAuto, dataTestId, id, className, htmlProps, resetTrigger, emptyTableState, }: TableProps<T>): React.JSX.Element;
4
4
  export default Table;
@@ -18,7 +18,9 @@ declare const StyledTable: import("styled-components/dist/types").IStyledCompone
18
18
  declare const CustomIconButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<Omit<import("../IconButton/types").IconButtonProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>, HeaderIconButtonProps>> & string & Omit<import("react").ForwardRefExoticComponent<Omit<import("../IconButton/types").IconButtonProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>, keyof import("react").Component<any, {}, any>>;
19
19
  declare const SortButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("styled-components").FastOmit<Omit<import("../IconButton/types").IconButtonProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>, keyof HeaderIconButtonProps> & HeaderIconButtonProps, HeaderIconButtonProps>> & string;
20
20
  declare const HeaderRow: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>, never>> & string;
21
- declare const CellRow: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>, never>> & string;
21
+ declare const CellRow: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>, {
22
+ $isClickable: boolean;
23
+ }>> & string;
22
24
  declare const FilterMenu: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
23
25
  declare const Checkbox: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>>, never>, never>> & string;
24
26
  declare const MenuItemGroup: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
@@ -21,6 +21,7 @@ export interface TableProps<T> {
21
21
  }[]) => void;
22
22
  onFilterChange?: (filters: ColumnFiltersState) => void;
23
23
  onRowSelect?: (rows: T[]) => void;
24
+ onRowClick?: (row: T) => void;
24
25
  showSelection?: boolean;
25
26
  showRowOptions?: boolean;
26
27
  showPagination?: boolean;
@@ -38,7 +39,7 @@ export interface TableProps<T> {
38
39
  paginationDetails?: PaginationDetails;
39
40
  rowStatuses?: Record<number | string, RowStatus>;
40
41
  resetTrigger?: number;
41
- emptyTableState: {
42
+ emptyTableState?: {
42
43
  header: string;
43
44
  subHeader?: string;
44
45
  showClearFilterButton?: boolean;
@@ -20808,6 +20808,7 @@ const HeaderRow = styled.tr `
20808
20808
  const CellRow = styled.tr `
20809
20809
  min-height: 50px;
20810
20810
  height: 50px;
20811
+ cursor: ${({ $isClickable }) => ($isClickable ? "pointer" : "default")};
20811
20812
  &:hover {
20812
20813
  & > td {
20813
20814
  background-color: ${Styles.color.blue.pale};
@@ -21253,8 +21254,7 @@ const EmptyTableState = ({ id, className, header, subHeader, showClearFilterButt
21253
21254
  a__default.createElement(ClearFilterButtonRow, null, showClearFilterButton && (a__default.createElement(StellaButton, { label: "Clear Filters", onClick: () => onClearFilters?.(), variant: "secondary" })))))));
21254
21255
  };
21255
21256
 
21256
- // DataTable.tsx
21257
- function Table({ columns, data, isLoading, serverSide = false, onPageChange, onSortChange, onFilterChange, onRowSelect, rowStatuses, showSelection = false, showRowOptions = false, showPagination = true, variant, paginationDetails = {
21257
+ function Table({ columns, data, isLoading, serverSide = false, onPageChange, onSortChange, onFilterChange, onRowSelect, onRowClick, rowStatuses, showSelection = false, showRowOptions = false, showPagination = true, variant, paginationDetails = {
21258
21258
  startingPage: 1,
21259
21259
  rowsPerPage: 10,
21260
21260
  totalRows: data.length,
@@ -21481,8 +21481,8 @@ function Table({ columns, data, isLoading, serverSide = false, onPageChange, onS
21481
21481
  } }));
21482
21482
  }))))),
21483
21483
  a__default.createElement("tbody", null,
21484
- table.getRowModel().rows.length === 0 && (a__default.createElement(EmptyTableState, { header: emptyTableState.header, subHeader: emptyTableState.subHeader, showClearFilterButton: emptyTableState.showClearFilterButton, onClearFilters: resetTable, colSpan: table.getVisibleLeafColumns().length, size: "large" })),
21485
- table.getRowModel().rows.map((row) => (a__default.createElement(CellRow, { key: row.id }, row.getVisibleCells().map((cell) => {
21484
+ table.getRowModel().rows.length === 0 && (a__default.createElement(EmptyTableState, { header: emptyTableState?.header || "No data available.", subHeader: emptyTableState?.subHeader, showClearFilterButton: emptyTableState?.showClearFilterButton, onClearFilters: resetTable, colSpan: table.getVisibleLeafColumns().length, size: "large" })),
21485
+ table.getRowModel().rows.map((row) => (a__default.createElement(CellRow, { key: row.id, onClick: () => onRowClick?.(row.original), "$isClickable": !!onRowClick }, row.getVisibleCells().map((cell) => {
21486
21486
  const value = flexRender(cell.column.columnDef.cell, {
21487
21487
  ...cell.getContext(),
21488
21488
  localValue: rowState[row.id]?.[cell.column.id],