@luscii-healthtech/web-ui 30.4.0 → 30.5.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.
@@ -9,5 +9,15 @@ export interface TableBody<Item> {
9
9
  showEmptyView: boolean;
10
10
  onRowClick?: (item: Item) => void;
11
11
  className?: string;
12
+ /**
13
+ * Property to use when the table does not have a footer,
14
+ * and we want to preserve the rounded layout.
15
+ */
16
+ lastRowRounded: boolean;
17
+ /**
18
+ * Property to use when the table does not have a header,
19
+ * and we want to preserve the rounded layout.
20
+ */
21
+ topRowRounded: boolean;
12
22
  }
13
23
  export declare function TableBody<Item>(props: TableBody<Item>): JSX.Element;
@@ -3681,13 +3681,13 @@ Line.propTypes = {
3681
3681
  function TableHeader(props) {
3682
3682
  return React__namespace.default.createElement(
3683
3683
  "thead",
3684
- { className: props.className },
3685
- React__namespace.default.createElement("tr", null, props.fieldConfigurations.map((fieldConfig) => {
3684
+ null,
3685
+ React__namespace.default.createElement("tr", { className: "ui-rounded-2xl " }, props.fieldConfigurations.map((fieldConfig) => {
3686
3686
  var _a;
3687
3687
  return React__namespace.default.createElement(
3688
3688
  "th",
3689
- { className: "ui-px-2 first:ui-pl-6 last:ui-pr-6", key: fieldConfig.key },
3690
- React__namespace.default.createElement(Text, { text: (_a = fieldConfig.headerText) !== null && _a !== void 0 ? _a : "", type: "strong", className: "ui-truncate ui-py-4 ui-text-left ui-uppercase ui-leading-5" })
3689
+ { className: classNames__default.default("ui-px-xxs", "ui-border-neutral-interactive", "ui-border-y", "first:ui-rounded-tl-2xl first:ui-border-l first:ui-pl-l", "last:ui-rounded-tr-2xl last:ui-border-r last:ui-pr-l"), key: fieldConfig.key },
3690
+ React__namespace.default.createElement(Text, { variant: "strong", className: "ui-truncate ui-py-m ui-text-left ui-capitalize ui-leading-5" }, (_a = fieldConfig.headerText) !== null && _a !== void 0 ? _a : "")
3691
3691
  );
3692
3692
  }))
3693
3693
  );
@@ -3764,8 +3764,32 @@ function TableBody(props) {
3764
3764
  var _a;
3765
3765
  return React__namespace.default.createElement(
3766
3766
  "tbody",
3767
- { className: props.className },
3768
- !props.isLoading && ((_a = props.items) === null || _a === void 0 ? void 0 : _a.map((item) => React__namespace.default.createElement(TableBodyRow, { className: classNames__default.default("ui-border-b ui-border-slate-100 last:ui-border-none"), key: JSON.stringify(item), item, fieldConfigurations: props.fieldConfigurations, emptyFieldContentText: props.emptyFieldContentText, onClick: props.onRowClick }))),
3767
+ { className: classNames__default.default(
3768
+ props.className,
3769
+ // setting border color across all cells
3770
+ "[&>tr>td]:ui-border-neutral-interactive",
3771
+ // left border for first cell and right border for last cell
3772
+ "[&>tr>td:first-child]:ui-border-l [&>tr>td:last-child]:ui-border-r",
3773
+ "[&>tr>td]:ui-border-b",
3774
+ /**
3775
+ * Configuration for the top row to have rounded edges, in case
3776
+ * there is no header.
3777
+ */
3778
+ {
3779
+ "[&>tr:first-child>td]:ui-border-t": props.topRowRounded,
3780
+ "[&>tr:first-child>td:first-child]:ui-rounded-tl-2xl": props.topRowRounded,
3781
+ "[&>tr:first-child>td:last-child]:ui-rounded-tr-2xl": props.topRowRounded
3782
+ },
3783
+ /**
3784
+ * Configuration for the last row to have rounded edges, in case
3785
+ * there is no footer.
3786
+ */
3787
+ {
3788
+ "[&>tr:last-child>td:first-child]:ui-rounded-bl-2xl": props.lastRowRounded,
3789
+ "[&>tr:last-child>td:last-child]:ui-rounded-br-2xl": props.lastRowRounded
3790
+ }
3791
+ ) },
3792
+ !props.isLoading && ((_a = props.items) === null || _a === void 0 ? void 0 : _a.map((item) => React__namespace.default.createElement(TableBodyRow, { key: JSON.stringify(item), item, fieldConfigurations: props.fieldConfigurations, emptyFieldContentText: props.emptyFieldContentText, onClick: props.onRowClick }))),
3769
3793
  props.isLoading && React__namespace.default.createElement(
3770
3794
  "tr",
3771
3795
  null,
@@ -3997,7 +4021,7 @@ const TableFooter = (props) => {
3997
4021
  null,
3998
4022
  React__namespace.default.createElement(
3999
4023
  "td",
4000
- { colSpan: props.colSpan },
4024
+ { className: "ui-rounded-b-2xl ui-border-x ui-border-b ui-border-neutral-interactive", colSpan: props.colSpan },
4001
4025
  React__namespace.default.createElement(PaginationMenu, Object.assign({ className: "ui-p-6" }, props.paginationMenuProps))
4002
4026
  )
4003
4027
  )
@@ -4011,14 +4035,30 @@ function Table(_a) {
4011
4035
  setIsPristine(false);
4012
4036
  }, [items, isLoading]);
4013
4037
  const showEmptyView = !isPristine && !isLoading && !(items && items.length > 0);
4038
+ const showFooter = !isLoading && !showEmptyView && paginationMenuProps && paginationMenuProps.currentPageNumber > 0 && paginationMenuProps.pageCount > 0;
4014
4039
  return React__namespace.default.createElement(
4015
4040
  "table",
4016
- Object.assign({ className: classNames__default.default("ui-w-full ui-table-auto ui-border-collapse ui-rounded-lg ui-bg-white", className), "data-test-id": dataTestId }, otherAttributes),
4017
- showHeader ? React__namespace.default.createElement(TableHeader, { className: "ui-border-b ui-border-slate-100", fieldConfigurations }) : null,
4018
- React__namespace.default.createElement(TableBody, { className: classNames__default.default({
4019
- "ui-border-b ui-border-slate-100": !isLoading && !showEmptyView && paginationMenuProps && paginationMenuProps.currentPageNumber > 0 && paginationMenuProps.pageCount > 0
4020
- }), items, fieldConfigurations, emptyItemsText: emptyRowsText, emptyFieldContentText, isLoading, showEmptyView, onRowClick }),
4021
- !isLoading && !showEmptyView && paginationMenuProps && paginationMenuProps.currentPageNumber > 0 && paginationMenuProps.pageCount > 0 ? React__namespace.default.createElement(TableFooter, { colSpan: fieldConfigurations.length, paginationMenuProps }) : null
4041
+ Object.assign({ className: classNames__default.default("ui-w-full ui-table-auto ui-bg-white", "ui-border-separate ui-border-spacing-0 ui-rounded-2xl", className), "data-test-id": dataTestId }, otherAttributes),
4042
+ showHeader ? React__namespace.default.createElement(TableHeader, { fieldConfigurations }) : null,
4043
+ React__namespace.default.createElement(
4044
+ TableBody,
4045
+ {
4046
+ // TODO: early return to remove all the boolean juggling.
4047
+ className: classNames__default.default({
4048
+ "ui-border-b ui-border-neutral-interactive": showFooter
4049
+ }),
4050
+ items,
4051
+ fieldConfigurations,
4052
+ emptyItemsText: emptyRowsText,
4053
+ emptyFieldContentText,
4054
+ isLoading,
4055
+ showEmptyView,
4056
+ onRowClick,
4057
+ lastRowRounded: !showFooter,
4058
+ topRowRounded: !showHeader
4059
+ }
4060
+ ),
4061
+ showFooter ? React__namespace.default.createElement(TableFooter, { colSpan: fieldConfigurations.length, paginationMenuProps }) : null
4022
4062
  );
4023
4063
  }
4024
4064