@homebound/beam 2.318.0 → 2.318.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.
|
@@ -67,9 +67,11 @@ function TextFieldBase(props) {
|
|
|
67
67
|
.mhPx(compactFieldHeight - maybeSmaller).$),
|
|
68
68
|
},
|
|
69
69
|
input: {
|
|
70
|
-
...Css_1.Css.w100.mw0.outline0.fg1.bgColor(bgColor)
|
|
70
|
+
...Css_1.Css.w100.mw0.outline0.fg1.bgColor(bgColor).$,
|
|
71
71
|
// Not using Truss's inline `if` statement here because `addIn` properties do not respect the if statement.
|
|
72
72
|
...(contrast && Css_1.Css.addIn("&::selection", Css_1.Css.bgGray800.$).$),
|
|
73
|
+
// For "multiline" fields we add top and bottom padding of 7px for compact, or 11px for non-compact, to properly match the height of the single line fields
|
|
74
|
+
...(multiline ? Css_1.Css.br4.h100.pyPx(compact ? 7 : 11).add("resize", "none").$ : Css_1.Css.truncate.$),
|
|
73
75
|
},
|
|
74
76
|
hover: Css_1.Css.bgColor(hoverBgColor).if(contrast).bGray600.$,
|
|
75
77
|
focus: Css_1.Css.bBlue700.if(contrast).bBlue500.$,
|
|
@@ -102,7 +104,7 @@ function TextFieldBase(props) {
|
|
|
102
104
|
...(multiline ? Css_1.Css.fdc.aifs.gap2.$ : Css_1.Css.if(wrap === false).truncate.$),
|
|
103
105
|
...xss,
|
|
104
106
|
}, "data-readonly": "true", ...tid, children: [labelStyle === "inline" && label && ((0, jsx_runtime_1.jsx)(Label_1.InlineLabel, { multiline: multiline, labelProps: labelProps, label: label, ...tid.label })), multiline
|
|
105
|
-
? (_g = inputProps.value) === null || _g === void 0 ? void 0 : _g.split("\n\n").map((p, i) => ((0, jsx_runtime_1.jsx)("p", {
|
|
107
|
+
? (_g = inputProps.value) === null || _g === void 0 ? void 0 : _g.split("\n\n").map((p, i) => ((0, jsx_runtime_1.jsx)("p", { children: p.split("\n").map((sentence, j) => ((0, jsx_runtime_1.jsxs)("span", { children: [sentence, (0, jsx_runtime_1.jsx)("br", {})] }, j))) }, i)))
|
|
106
108
|
: inputProps.value] })) : ((0, jsx_runtime_1.jsxs)("div", { css: {
|
|
107
109
|
...fieldStyles.inputWrapper,
|
|
108
110
|
...(inputProps.disabled ? fieldStyles.disabled : {}),
|
|
@@ -115,7 +117,6 @@ function TextFieldBase(props) {
|
|
|
115
117
|
...fieldStyles.input,
|
|
116
118
|
...(inputProps.disabled ? fieldStyles.disabled : {}),
|
|
117
119
|
...(showHover ? fieldStyles.hover : {}),
|
|
118
|
-
...(multiline ? Css_1.Css.h100.py1.add("resize", "none").$ : Css_1.Css.truncate.$),
|
|
119
120
|
...xss,
|
|
120
121
|
}, ...tid }), isFocused && clearable && onChange && inputProps.value && ((0, jsx_runtime_1.jsx)(components_1.IconButton, { icon: "xCircle", color: Css_1.Palette.Gray700, onClick: () => {
|
|
121
122
|
var _a;
|
package/dist/utils/rtl.js
CHANGED
|
@@ -182,7 +182,7 @@ function getSelected(select) {
|
|
|
182
182
|
if (isSelectElement(select)) {
|
|
183
183
|
throw new Error("Beam getSelected helper does not support <select> elements");
|
|
184
184
|
}
|
|
185
|
-
if (!
|
|
185
|
+
if (!isInputOrTextAreaElement(select) && select.dataset.readonly === "true") {
|
|
186
186
|
// For read-only fields that render as a 'div'
|
|
187
187
|
return (_a = select.textContent) !== null && _a !== void 0 ? _a : undefined;
|
|
188
188
|
}
|
|
@@ -215,14 +215,14 @@ function assertListBoxInput(select) {
|
|
|
215
215
|
if (isSelectElement(select)) {
|
|
216
216
|
throw new Error("Beam getOptions helper does not support <select> elements");
|
|
217
217
|
}
|
|
218
|
-
if (!
|
|
219
|
-
throw new Error(`Expected element to be INPUT, but got ${select.nodeName}. This field may be read-only. In that case we cannot get the list of options`);
|
|
218
|
+
if (!isInputOrTextAreaElement(select)) {
|
|
219
|
+
throw new Error(`Expected element to be INPUT or TEXTAREA, but got ${select.nodeName}. This field may be read-only. In that case we cannot get the list of options`);
|
|
220
220
|
}
|
|
221
221
|
return true;
|
|
222
222
|
}
|
|
223
223
|
function isSelectElement(element) {
|
|
224
224
|
return element.nodeName === "SELECT";
|
|
225
225
|
}
|
|
226
|
-
function
|
|
227
|
-
return element.nodeName === "INPUT";
|
|
226
|
+
function isInputOrTextAreaElement(element) {
|
|
227
|
+
return element.nodeName === "INPUT" || element.nodeName === "TEXTAREA";
|
|
228
228
|
}
|