@homebound/beam 2.253.0 → 2.254.1
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,8 +1,10 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
+
import { PresentationFieldProps } from "../components/PresentationContext";
|
|
2
3
|
interface StaticFieldProps {
|
|
3
4
|
label: ReactNode;
|
|
4
5
|
value?: string;
|
|
5
6
|
children?: ReactNode;
|
|
7
|
+
labelStyle?: PresentationFieldProps["labelStyle"];
|
|
6
8
|
}
|
|
7
9
|
export declare function StaticField(props: StaticFieldProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
8
10
|
export {};
|
|
@@ -3,13 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.StaticField = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
5
5
|
const utils_1 = require("@react-aria/utils");
|
|
6
|
+
const PresentationContext_1 = require("../components/PresentationContext");
|
|
6
7
|
const Css_1 = require("../Css");
|
|
7
8
|
const defaultTestId_1 = require("../utils/defaultTestId");
|
|
8
9
|
const useTestIds_1 = require("../utils/useTestIds");
|
|
9
10
|
function StaticField(props) {
|
|
10
|
-
|
|
11
|
+
var _a;
|
|
12
|
+
const { fieldProps } = (0, PresentationContext_1.usePresentationContext)();
|
|
13
|
+
const { label, labelStyle = (_a = fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.labelStyle) !== null && _a !== void 0 ? _a : "above", value, children } = props;
|
|
11
14
|
const tid = (0, useTestIds_1.useTestIds)(props, typeof label === "string" ? (0, defaultTestId_1.defaultTestId)(label) : "staticField");
|
|
12
15
|
const id = (0, utils_1.useId)();
|
|
13
|
-
return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("label", { css: Css_1.Css.db.sm.gray700.mbPx(4).$, htmlFor: id, ...tid.label, children: label }), (0, jsx_runtime_1.jsx)("div", { id: id, css: Css_1.Css.smMd.gray900.
|
|
16
|
+
return ((0, jsx_runtime_1.jsxs)("div", { css: Css_1.Css.w100.maxw((0, Css_1.px)(550)).if(labelStyle === "left").df.jcsb.maxw100.$, ...tid.container, children: [(0, jsx_runtime_1.jsx)("label", { css: Css_1.Css.db.sm.gray700.mbPx(4).$, htmlFor: id, ...tid.label, children: label }), (0, jsx_runtime_1.jsx)("div", { id: id, css: Css_1.Css.smMd.gray900.if(labelStyle === "left").w50.$, ...tid, children: value || children })] }));
|
|
14
17
|
}
|
|
15
18
|
exports.StaticField = StaticField;
|