@homebound/beam 2.212.0 → 2.212.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.
@@ -1,9 +1,10 @@
1
+ import { ReactNode } from "react";
1
2
  import { Margin, Only, Xss } from "../Css";
2
3
  declare type ChipType = "caution" | "warning" | "success" | "light" | "dark" | "neutral";
3
4
  export declare const ChipTypes: Record<ChipType, ChipType>;
4
5
  export interface ChipProps<X> {
5
6
  text: string;
6
- title?: string;
7
+ title?: ReactNode;
7
8
  xss?: X;
8
9
  type?: ChipType;
9
10
  compact?: boolean;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Chip = exports.ChipTypes = void 0;
4
4
  const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
5
5
  const PresentationContext_1 = require("./PresentationContext");
6
+ const Tooltip_1 = require("./Tooltip");
6
7
  const Css_1 = require("../Css");
7
8
  const useTestIds_1 = require("../utils/useTestIds");
8
9
  // exporting for using in type prop as constant - this could be moved and become a global list for colors
@@ -17,13 +18,17 @@ exports.ChipTypes = {
17
18
  /** Kinda like a chip, but read-only, so no `onClick` or `hover`. */
18
19
  function Chip({ type = exports.ChipTypes.neutral, ...props }) {
19
20
  const { fieldProps } = (0, PresentationContext_1.usePresentationContext)();
20
- const { text, title = text, xss = {}, compact = fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.compact } = props;
21
+ const { text, title, xss = {}, compact = fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.compact } = props;
21
22
  const tid = (0, useTestIds_1.useTestIds)(props, "chip");
22
- return ((0, jsx_runtime_1.jsx)("span", Object.assign({ css: {
23
- ...Css_1.Css[compact ? "xs" : "sm"].dif.aic.br16.pl1.px1.pyPx(2).gray900.$,
24
- ...typeStyles[type],
25
- ...xss,
26
- } }, tid, { title: title }, { children: (0, jsx_runtime_1.jsx)("span", Object.assign({ css: Css_1.Css.lineClamp1.breakAll.$ }, { children: text }), void 0) }), void 0));
23
+ return (0, Tooltip_1.maybeTooltip)({
24
+ title,
25
+ placement: "bottom",
26
+ children: ((0, jsx_runtime_1.jsx)("span", Object.assign({ css: {
27
+ ...Css_1.Css[compact ? "xs" : "sm"].dif.aic.br16.pl1.px1.pyPx(2).gray900.$,
28
+ ...typeStyles[type],
29
+ ...xss,
30
+ } }, tid, { children: (0, jsx_runtime_1.jsx)("span", Object.assign({ css: Css_1.Css.lineClamp1.breakAll.$ }, { children: text }), void 0) }), void 0)),
31
+ });
27
32
  }
28
33
  exports.Chip = Chip;
29
34
  const typeStyles = {
@@ -53,7 +53,7 @@ function Popper({ triggerRef, content, placement = "auto" }) {
53
53
  ],
54
54
  placement,
55
55
  });
56
- return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsxs)("div", Object.assign({ ref: popperRef, style: styles.popper }, attributes.popper, { css: Css_1.Css.maxw("320px").bgGray900.white.px1.py("4px").br4.xs.z999.$ }, { children: [(0, jsx_runtime_1.jsx)("div", { ref: setArrowRef, style: { ...styles.arrow }, id: "arrow" }, void 0), content] }), void 0), document.body);
56
+ return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsxs)("div", Object.assign({ ref: popperRef, style: styles.popper }, attributes.popper, { css: Css_1.Css.maxw("320px").bgGray900.white.px1.py("4px").br4.xs.add("zIndex", 999999).$ }, { children: [(0, jsx_runtime_1.jsx)("div", { ref: setArrowRef, style: { ...styles.arrow }, id: "arrow" }, void 0), content] }), void 0), document.body);
57
57
  }
58
58
  // Helper function to conditionally wrap component with Tooltip if necessary.
59
59
  // `maybeTooltip` requires that the `children` prop be a ReactElement, even though <Tooltip /> allows for ReactNode.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homebound/beam",
3
- "version": "2.212.0",
3
+ "version": "2.212.2",
4
4
  "author": "Homebound",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",