@homebound/beam 2.149.0 → 2.151.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.
@@ -7,13 +7,12 @@ const Css_1 = require("../Css");
7
7
  const useTestIds_1 = require("../utils/useTestIds");
8
8
  /** Kinda like a chip, but read-only, so no `onClick` or `hover`. */
9
9
  function Chip(props) {
10
- var _a;
11
10
  const { text, xss = {} } = props;
12
11
  const { fieldProps } = (0, PresentationContext_1.usePresentationContext)();
13
- const typeScale = (_a = fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.typeScale) !== null && _a !== void 0 ? _a : "sm";
12
+ const compact = fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.compact;
14
13
  const tid = (0, useTestIds_1.useTestIds)(props, "chip");
15
14
  return ((0, jsx_runtime_1.jsx)("span", Object.assign({ css: {
16
- ...Css_1.Css[typeScale].dif.aic.br16.pl1.px1.pyPx(2).gray900.bgGray200.$,
15
+ ...Css_1.Css[compact ? "xs" : "sm"].dif.aic.br16.pl1.px1.pyPx(2).gray900.bgGray200.$,
17
16
  ...xss,
18
17
  } }, tid, { title: text }, { children: (0, jsx_runtime_1.jsx)("span", Object.assign({ css: Css_1.Css.lineClamp1.breakAll.$ }, { children: text }), void 0) }), void 0));
19
18
  }
@@ -308,10 +308,12 @@ export declare type GridCellContent = {
308
308
  indent?: 1 | 2;
309
309
  colspan?: number;
310
310
  typeScale?: Typography;
311
- /** Allows the cell to stay in place when the user scrolls horizontally */
311
+ /** Allows the cell to stay in place when the user scrolls horizontally, i.e. frozen columns. */
312
312
  sticky?: "left" | "right";
313
313
  /** If provided, content of the cell will be wrapped within a <button /> or <a /> tag depending on if the value is a function or a string. */
314
314
  onClick?: () => {} | string;
315
+ /** Custom css to apply directly to this cell, i.e. cell-specific borders. */
316
+ css?: Properties;
315
317
  };
316
318
  declare type MaybeFn<T> = T | (() => T);
317
319
  /**
@@ -588,6 +588,8 @@ function GridRow(props) {
588
588
  : {}),
589
589
  // Add any cell specific style overrides
590
590
  ...(isGridCellContent(maybeContent) && maybeContent.typeScale ? Css_1.Css[maybeContent.typeScale].$ : {}),
591
+ // And any cell specific css
592
+ ...(isGridCellContent(maybeContent) && maybeContent.css ? maybeContent.css : {}),
591
593
  // Define the width of the column on each cell. Supports col spans.
592
594
  ...{
593
595
  width: `calc(${columnSizes
@@ -3,21 +3,25 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ToggleChip = void 0;
4
4
  const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
5
5
  const Icon_1 = require("./Icon");
6
+ const PresentationContext_1 = require("./PresentationContext");
6
7
  const Css_1 = require("../Css");
7
8
  const useTestIds_1 = require("../utils/useTestIds");
8
9
  function ToggleChip(props) {
9
10
  const { text, onClick, xss = {}, disabled = false } = props;
11
+ const { fieldProps } = (0, PresentationContext_1.usePresentationContext)();
12
+ // If compact, then use a smaller type scale
13
+ const compact = fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.compact;
10
14
  const tid = (0, useTestIds_1.useTestIds)(props, "chip");
11
15
  return ((0, jsx_runtime_1.jsxs)("button", Object.assign({ type: "button", css: {
12
- ...Css_1.Css.dif.aic.br16.sm.pl1
13
- // Use a lower right-padding to get closer to the `X` circle
14
- .prPx(4)
16
+ ...Css_1.Css[compact ? "xs" : "sm"].dif.aic.br16.pl1
17
+ // Use a lower right-padding to get closer to the `X` circle when not disabled
18
+ .prPx(2)
15
19
  .pyPx(2)
16
20
  .gray900.bgGray200.if(disabled)
17
- .mh((0, Css_1.px)(28)).gray600.$,
21
+ .gray600.pr1.mhPx(compact ? 20 : 28).$,
18
22
  ":hover:not(:disabled)": Css_1.Css.bgGray300.$,
19
23
  ":disabled": Css_1.Css.cursorNotAllowed.$,
20
24
  ...xss,
21
- }, disabled: disabled, onClick: onClick }, tid, { children: [(0, jsx_runtime_1.jsx)("span", Object.assign({ css: Css_1.Css.prPx(6).tl.lineClamp1.breakAll.if(disabled).prPx(4).$, title: text }, { children: text }), void 0), !disabled && ((0, jsx_runtime_1.jsx)("span", Object.assign({ css: Css_1.Css.fs0.br16.bgGray400.$ }, { children: (0, jsx_runtime_1.jsx)(Icon_1.Icon, { icon: "x", color: Css_1.Palette.Gray700 }, void 0) }), void 0))] }), void 0));
25
+ }, disabled: disabled, onClick: onClick }, tid, { children: [(0, jsx_runtime_1.jsx)("span", Object.assign({ css: Css_1.Css.prPx(6).tl.lineClamp1.breakAll.if(disabled).pr0.$, title: text }, { children: text }), void 0), !disabled && ((0, jsx_runtime_1.jsx)("span", Object.assign({ css: Css_1.Css.fs0.br16.bgGray400.$ }, { children: (0, jsx_runtime_1.jsx)(Icon_1.Icon, { icon: "x", color: Css_1.Palette.Gray700, inc: compact ? 2 : undefined }, void 0) }), void 0))] }), void 0));
22
26
  }
23
27
  exports.ToggleChip = ToggleChip;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homebound/beam",
3
- "version": "2.149.0",
3
+ "version": "2.151.1",
4
4
  "author": "Homebound",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",