@homebound/beam 2.190.1 → 2.191.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.
@@ -252,6 +252,8 @@ function renderDiv(style, id, columns, headerRows, totalsRows, visibleDataRows,
252
252
  ? Css_1.Css.addIn(`& > div:nth-of-type(n+${headerRows.length + totalsRows.length + 2}) > *`, style.betweenRowsCss).$
253
253
  : {}),
254
254
  ...(style.firstNonHeaderRowCss ? Css_1.Css.addIn(`& > div:nth-of-type(2) > *`, style.firstNonHeaderRowCss).$ : {}),
255
+ ...(style.lastRowCss && Css_1.Css.addIn("& > div:last-of-type", style.lastRowCss).$),
256
+ ...(style.firstRowCss && Css_1.Css.addIn("& > div:first-of-type", style.firstRowCss).$),
255
257
  ...style.rootCss,
256
258
  ...(style.minWidthPx ? Css_1.Css.mwPx(style.minWidthPx).$ : {}),
257
259
  ...xss,
@@ -260,10 +262,12 @@ function renderDiv(style, id, columns, headerRows, totalsRows, visibleDataRows,
260
262
  /** Renders as a table, primarily/solely for good print support. */
261
263
  function renderTable(style, id, columns, headerRows, totalsRows, visibleDataRows, firstRowMessage, _stickyHeader, xss, _virtuosoRef) {
262
264
  return ((0, jsx_runtime_1.jsxs)("table", Object.assign({ css: {
263
- ...Css_1.Css.w100.add("borderCollapse", "collapse").$,
264
- ...Css_1.Css.addIn("& > tbody > tr ", style.betweenRowsCss || {})
265
+ ...Css_1.Css.w100.add("borderCollapse", "separate").add("borderSpacing", "0").$,
266
+ ...Css_1.Css.addIn("& > tbody > tr > * ", style.betweenRowsCss || {})
265
267
  // removes border between header and second row
266
- .addIn("& > tbody > tr:first-of-type", style.firstNonHeaderRowCss || {}).$,
268
+ .addIn("& > tbody > tr:first-of-type > *", style.firstNonHeaderRowCss || {}).$,
269
+ ...Css_1.Css.addIn("& > tbody > tr:last-of-type", style.lastRowCss).$,
270
+ ...Css_1.Css.addIn("& > tbody > tr:first-of-type", style.firstRowCss).$,
267
271
  ...style.rootCss,
268
272
  ...(style.minWidthPx ? Css_1.Css.mwPx(style.minWidthPx).$ : {}),
269
273
  ...xss,
@@ -356,9 +360,10 @@ const VirtualRoot = (0, memoize_one_1.default)((gs, _columns, id, xss) => {
356
360
  ...Css_1.Css.addIn("& > div + div > div > *", gs.betweenRowsCss || {}).$,
357
361
  // Table list styles only
358
362
  ...(isHeader
359
- ? {}
363
+ ? Css_1.Css.addIn("& > div:first-of-type > *", gs.firstRowCss).$
360
364
  : {
361
365
  ...Css_1.Css.addIn("& > div:first-of-type > *", gs.firstNonHeaderRowCss).$,
366
+ ...Css_1.Css.addIn("& > div:last-of-type > *", gs.lastRowCss).$,
362
367
  }),
363
368
  ...gs.rootCss,
364
369
  ...(gs.minWidthPx ? Css_1.Css.mwPx(gs.minWidthPx).$ : {}),
@@ -0,0 +1,12 @@
1
+ import { ReactNode } from "react";
2
+ import { Margin, Only, Xss } from "../../Css";
3
+ declare type TableActionsXss = Xss<Margin>;
4
+ interface TableActionsProps<X> {
5
+ xss?: X;
6
+ children: ReactNode;
7
+ onlyLeft?: boolean;
8
+ onlyRight?: boolean;
9
+ }
10
+ /** Provides default spacing for Actions sitting above a table (Filters, Search, etc...) */
11
+ export declare function TableActions<X extends Only<TableActionsXss, X>>(props: TableActionsProps<X>): import("@emotion/react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TableActions = void 0;
4
+ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
5
+ const Css_1 = require("../../Css");
6
+ /** Provides default spacing for Actions sitting above a table (Filters, Search, etc...) */
7
+ function TableActions(props) {
8
+ const { xss, children, onlyLeft, onlyRight } = props;
9
+ const alignmentStyles = onlyLeft ? Css_1.Css.jcfs.$ : onlyRight ? Css_1.Css.jcfe.$ : Css_1.Css.jcsb.$;
10
+ return (0, jsx_runtime_1.jsx)("div", Object.assign({ css: { ...Css_1.Css.df.aic.pb2.gap1.$, ...xss, ...alignmentStyles } }, { children: children }), void 0);
11
+ }
12
+ exports.TableActions = TableActions;
@@ -9,6 +9,10 @@ export interface GridStyle {
9
9
  rootCss?: Properties;
10
10
  /** Applied with the owl operator between rows for rendering border lines. */
11
11
  betweenRowsCss?: Properties;
12
+ /** Applied on the last row of the table. */
13
+ lastRowCss?: Properties;
14
+ /** Applied on the first row of the table (could be the Header or Totals row). */
15
+ firstRowCss?: Properties;
12
16
  /** Applied to the first non-header row, i.e. if you want to cancel out `betweenRowsCss`. */
13
17
  firstNonHeaderRowCss?: Properties;
14
18
  /** Applied to all cell divs (via a selector off the base div). */
@@ -55,6 +59,8 @@ export interface GridStyleDef {
55
59
  rowHeight?: "fixed" | "flexible";
56
60
  /** Enables cells Highlight and hover */
57
61
  cellHighlight?: boolean;
62
+ allWhite?: boolean;
63
+ bordered?: boolean;
58
64
  }
59
65
  export declare const getTableStyles: (props?: GridStyleDef) => GridStyle;
60
66
  /** Defines row-specific styling for each given row `kind` in `R` */
@@ -7,7 +7,7 @@ const utils_1 = require("../../utils");
7
7
  function memoizedTableStyles() {
8
8
  const cache = {};
9
9
  return (props = {}) => {
10
- const { inlineEditing = false, grouped = false, rowHeight = "flexible", cellHighlight = false } = props;
10
+ const { inlineEditing = false, grouped = false, rowHeight = "flexible", cellHighlight = false, allWhite = false, bordered = false, } = props;
11
11
  const key = (0, utils_1.safeKeys)(props)
12
12
  .sort()
13
13
  .map((k) => `${k}_${props[k]}`)
@@ -15,8 +15,11 @@ function memoizedTableStyles() {
15
15
  if (!cache[key]) {
16
16
  const groupedLevels = {
17
17
  0: {
18
- cellCss: Css_1.Css.xsMd.mhPx(56).gray700.bgGray100.boxShadow(`inset 0 -1px 0 ${Css_1.Palette.Gray200}`).$,
19
- firstContentColumn: Css_1.Css.smMd.$,
18
+ cellCss: {
19
+ ...Css_1.Css.xsMd.mhPx(56).gray700.bgGray100.boxShadow(`inset 0 -1px 0 ${Css_1.Palette.Gray200}`).$,
20
+ ...(allWhite && Css_1.Css.bgWhite.$),
21
+ },
22
+ firstContentColumn: { ...Css_1.Css.smMd.$, ...(allWhite && Css_1.Css.smBd.gray900.$) },
20
23
  },
21
24
  2: { firstContentColumn: Css_1.Css.tiny.pl3.$ },
22
25
  };
@@ -24,13 +27,27 @@ function memoizedTableStyles() {
24
27
  cache[key] = {
25
28
  emptyCell: "-",
26
29
  firstRowMessageCss: Css_1.Css.tc.py3.$,
27
- headerCellCss: Css_1.Css.gray700.xsMd.bgGray200.aic.nowrap.pxPx(12).hPx(40).$,
28
- totalsCellCss: Css_1.Css.bgWhite.gray700.smMd.hPx(52).pt0.pbPx(12).boxShadow("none").$,
30
+ headerCellCss: {
31
+ ...Css_1.Css.gray700.xsMd.bgGray200.aic.nowrap.pxPx(12).hPx(40).$,
32
+ ...(allWhite && Css_1.Css.bgWhite.$),
33
+ ...(bordered && Css_1.Css.bt.bGray200.$),
34
+ },
35
+ totalsCellCss: Css_1.Css.bgWhite.gray700.smMd.hPx(52).pPx(12).boxShadow("none").$,
29
36
  cellCss: {
30
37
  ...Css_1.Css.gray900.xs.bgWhite.aic.pxPx(12).boxShadow(`inset 0 -1px 0 ${Css_1.Palette.Gray200}`).$,
31
38
  ...(rowHeight === "flexible" ? Css_1.Css.pyPx(12).$ : Css_1.Css.nowrap.hPx(inlineEditing ? 48 : 36).$),
32
39
  ...(cellHighlight ? { "&:hover": Css_1.Css.bgGray100.$ } : {}),
40
+ ...(bordered && { "&:first-of-type": Css_1.Css.bl.bGray200.$, "&:last-of-type": Css_1.Css.br.bGray200.$ }),
41
+ },
42
+ firstRowCss: {
43
+ // Only apply border-radius to the corners of the table when `allWhite` is true for now.
44
+ ...(allWhite &&
45
+ Css_1.Css.addIn("& > *:first-of-type", Css_1.Css.borderRadius("8px 0 0 0 ").$).addIn("& > *:last-of-type", Css_1.Css.borderRadius("0 8px 0 0").$).$),
46
+ ...(bordered && Css_1.Css.addIn("& > *", Css_1.Css.bt.bGray200.$).$),
33
47
  },
48
+ ...(allWhite && {
49
+ lastRowCss: Css_1.Css.addIn("& > *:first-of-type", Css_1.Css.borderRadius("0 0 0 8px").$).addIn("& > *:last-of-type", Css_1.Css.borderRadius("0 0 8px 0").$).$,
50
+ }),
34
51
  presentationSettings: { borderless: true, typeScale: "xs", wrap: rowHeight === "flexible" },
35
52
  levels: grouped ? groupedLevels : defaultLevels,
36
53
  };
@@ -58,7 +75,7 @@ exports.condensedStyle = {
58
75
  ...exports.defaultStyle,
59
76
  headerCellCss: Css_1.Css.bgGray100.tinySb.$,
60
77
  cellCss: Css_1.Css.aic.sm.py1.px2.$,
61
- rootCss: Css_1.Css.dg.gray700.xs.$,
78
+ rootCss: Css_1.Css.gray700.xs.$,
62
79
  firstRowMessageCss: Css_1.Css.tc.py2.$,
63
80
  };
64
81
  /** Renders each row as a card. */
@@ -90,7 +107,14 @@ function tableRowStyles(as, column) {
90
107
  }
91
108
  exports.tableRowStyles = tableRowStyles;
92
109
  function resolveStyles(style) {
93
- const defKeys = ["inlineEditing", "grouped", "rowHeight", "cellHighlight"];
110
+ const defKeys = [
111
+ "inlineEditing",
112
+ "grouped",
113
+ "rowHeight",
114
+ "cellHighlight",
115
+ "allWhite",
116
+ "bordered",
117
+ ];
94
118
  const keys = (0, utils_1.safeKeys)(style);
95
119
  if (keys.length === 0 || keys.some((k) => defKeys.includes(k))) {
96
120
  return (0, exports.getTableStyles)(style);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homebound/beam",
3
- "version": "2.190.1",
3
+ "version": "2.191.1",
4
4
  "author": "Homebound",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",