@homebound/beam 2.150.0 → 2.151.2

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
  }
@@ -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;
@@ -9,6 +9,7 @@ export interface NumberFieldProps {
9
9
  value: number | undefined;
10
10
  onChange: (value: number | undefined) => void;
11
11
  compact?: boolean;
12
+ clearable?: boolean;
12
13
  /** Whether the field is disabled. If a ReactNode, it's treated as a "disabled reason" that's shown in a tooltip. */
13
14
  disabled?: boolean | ReactNode;
14
15
  required?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homebound/beam",
3
- "version": "2.150.0",
3
+ "version": "2.151.2",
4
4
  "author": "Homebound",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",