@homebound/beam 2.173.0 → 2.174.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.
package/dist/components/Chip.js
CHANGED
|
@@ -16,7 +16,7 @@ exports.ChipTypes = {
|
|
|
16
16
|
};
|
|
17
17
|
/** Kinda like a chip, but read-only, so no `onClick` or `hover`. */
|
|
18
18
|
function Chip({ type = exports.ChipTypes.neutral, ...props }) {
|
|
19
|
-
const { text, xss = {} } = props;
|
|
19
|
+
const { text, title = text, xss = {} } = props;
|
|
20
20
|
const { fieldProps } = (0, PresentationContext_1.usePresentationContext)();
|
|
21
21
|
const compact = fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.compact;
|
|
22
22
|
const tid = (0, useTestIds_1.useTestIds)(props, "chip");
|
|
@@ -24,7 +24,7 @@ function Chip({ type = exports.ChipTypes.neutral, ...props }) {
|
|
|
24
24
|
...Css_1.Css[compact ? "xs" : "sm"].dif.aic.br16.pl1.px1.pyPx(2).gray900.$,
|
|
25
25
|
...typeStyles[type],
|
|
26
26
|
...xss,
|
|
27
|
-
} }, tid, { title:
|
|
27
|
+
} }, tid, { title: title }, { children: (0, jsx_runtime_1.jsx)("span", Object.assign({ css: Css_1.Css.lineClamp1.breakAll.$ }, { children: text }), void 0) }), void 0));
|
|
28
28
|
}
|
|
29
29
|
exports.Chip = Chip;
|
|
30
30
|
const typeStyles = {
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { Margin, Only, Xss } from "../Css";
|
|
2
2
|
declare type ChipsXss = Xss<Margin>;
|
|
3
|
+
export interface ChipValue {
|
|
4
|
+
text: string;
|
|
5
|
+
title: string;
|
|
6
|
+
}
|
|
3
7
|
export interface ChipsProps<X> {
|
|
4
|
-
values: string[];
|
|
8
|
+
values: string[] | ChipValue[];
|
|
5
9
|
xss?: X;
|
|
6
10
|
}
|
|
7
11
|
/** Renders a list of `Chip`s, with wrapping & appropriate margin between each `Chip`. */
|
package/dist/components/Chips.js
CHANGED
|
@@ -13,6 +13,9 @@ function Chips(props) {
|
|
|
13
13
|
...Css_1.Css.df.aifs.gap1.whiteSpace("normal").$,
|
|
14
14
|
...(wrap !== false ? Css_1.Css.add({ flexWrap: "wrap" }).$ : {}),
|
|
15
15
|
...xss,
|
|
16
|
-
} }, { children: values.map((value, i) =>
|
|
16
|
+
} }, { children: values.map((value, i) => {
|
|
17
|
+
const { text, title } = (value.hasOwnProperty("text") ? value : { text: value });
|
|
18
|
+
return (0, jsx_runtime_1.jsx)(Chip_1.Chip, { text: text, title: title }, i);
|
|
19
|
+
}) }), void 0));
|
|
17
20
|
}
|
|
18
21
|
exports.Chips = Chips;
|