@homebound/beam 2.150.0 → 2.151.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
|
@@ -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
|
|
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[
|
|
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.
|
|
16
|
+
...Css_1.Css[compact ? "xs" : "sm"].dif.aic.br16.pl1
|
|
13
17
|
// Use a lower right-padding to get closer to the `X` circle
|
|
14
18
|
.prPx(4)
|
|
15
19
|
.pyPx(2)
|
|
16
20
|
.gray900.bgGray200.if(disabled)
|
|
17
|
-
.
|
|
21
|
+
.mhPx(compact ? 20 : 28).gray600.$,
|
|
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).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, inc: compact ? 2 : undefined }, void 0) }), void 0))] }), void 0));
|
|
22
26
|
}
|
|
23
27
|
exports.ToggleChip = ToggleChip;
|