@homebound/beam 2.351.0 → 2.352.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.
@@ -1,5 +1,6 @@
1
1
  import { ReactNode } from "react";
2
2
  import { Margin, Only, Xss } from "../Css";
3
+ import { IconKey } from "./Icon";
3
4
  export type ChipType = "caution" | "warning" | "success" | "light" | "dark" | "neutral" | "darkMode" | "info";
4
5
  export declare const ChipTypes: Record<ChipType, ChipType>;
5
6
  export interface ChipProps<X> {
@@ -8,6 +9,7 @@ export interface ChipProps<X> {
8
9
  xss?: X;
9
10
  type?: ChipType;
10
11
  compact?: boolean;
12
+ icon?: IconKey;
11
13
  }
12
14
  /** Kinda like a chip, but read-only, so no `onClick` or `hover`. */
13
15
  export declare function Chip<X extends Only<Xss<Margin | "color" | "backgroundColor">, X>>({ type, ...props }: ChipProps<X>): import("@emotion/react/jsx-runtime").JSX.Element;
@@ -6,6 +6,7 @@ const PresentationContext_1 = require("./PresentationContext");
6
6
  const Tooltip_1 = require("./Tooltip");
7
7
  const Css_1 = require("../Css");
8
8
  const useTestIds_1 = require("../utils/useTestIds");
9
+ const Icon_1 = require("./Icon");
9
10
  // exporting for using in type prop as constant - this could be moved and become a global list for colors
10
11
  exports.ChipTypes = {
11
12
  caution: "caution",
@@ -20,16 +21,16 @@ exports.ChipTypes = {
20
21
  /** Kinda like a chip, but read-only, so no `onClick` or `hover`. */
21
22
  function Chip({ type = exports.ChipTypes.neutral, ...props }) {
22
23
  const { fieldProps } = (0, PresentationContext_1.usePresentationContext)();
23
- const { text, title, xss = {}, compact = fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.compact } = props;
24
+ const { text, title, xss = {}, compact = fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.compact, icon } = props;
24
25
  const tid = (0, useTestIds_1.useTestIds)(props, "chip");
25
26
  return (0, Tooltip_1.maybeTooltip)({
26
27
  title,
27
28
  placement: "bottom",
28
- children: ((0, jsx_runtime_1.jsx)("span", { css: {
29
- ...Css_1.Css[compact ? "xs" : "sm"].dif.aic.br16.pl1.px1.pyPx(2).gray900.$,
29
+ children: ((0, jsx_runtime_1.jsxs)("span", { css: {
30
+ ...Css_1.Css[compact ? "xs" : "sm"].dif.aic.gapPx(4).br16.pl1.px1.pyPx(2).gray900.$,
30
31
  ...typeStyles[type],
31
32
  ...xss,
32
- }, ...tid, children: (0, jsx_runtime_1.jsx)("span", { css: Css_1.Css.lineClamp1.breakAll.$, children: text }) })),
33
+ }, ...tid, children: [icon && (0, jsx_runtime_1.jsx)(Icon_1.Icon, { icon: icon, inc: 2, xss: Css_1.Css.fs0.$ }), (0, jsx_runtime_1.jsx)("span", { css: Css_1.Css.lineClamp1.breakAll.$, children: text })] })),
33
34
  });
34
35
  }
35
36
  exports.Chip = Chip;
@@ -9,7 +9,7 @@ export interface IconProps extends AriaAttributes, DOMProps {
9
9
  /** The size of the icon in increments, i.e. 1 == 8px, default is 3 == 24px. */
10
10
  inc?: number;
11
11
  /** Styles overrides */
12
- xss?: Xss<Margin | "visibility">;
12
+ xss?: Xss<Margin | "visibility" | "flexShrink">;
13
13
  tooltip?: ReactNode;
14
14
  }
15
15
  export declare const Icon: React.MemoExoticComponent<(props: IconProps) => import("@emotion/react/jsx-runtime").JSX.Element>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homebound/beam",
3
- "version": "2.351.0",
3
+ "version": "2.352.0",
4
4
  "author": "Homebound",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",