@homebound/beam 2.177.0 → 2.177.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.
|
@@ -10,7 +10,7 @@ function MultiSelectField(props) {
|
|
|
10
10
|
getOptionLabel = (o) => o.name, // if unset, assume O implements HasName
|
|
11
11
|
values, options, onSelect, readOnly = false, errorMsg, onFocus, onBlur, disabled, label, disabledOptions = [], helperText, } = props;
|
|
12
12
|
const tid = (0, utils_1.useTestIds)(props, (0, defaultTestId_1.defaultTestId)(label));
|
|
13
|
-
return ((0, jsx_runtime_1.jsxs)("
|
|
13
|
+
return ((0, jsx_runtime_1.jsxs)("label", Object.assign({}, tid.label, { children: [label, (0, jsx_runtime_1.jsxs)("select", Object.assign({}, tid, {
|
|
14
14
|
// We're cheating and assume the values are strings...what we should really do is either:
|
|
15
15
|
// a) use beam's valueToKey mapping to string-encode any Value, or
|
|
16
16
|
// b) instead of using `values` directly, use the index of each value's `option` in `options`
|
|
@@ -40,6 +40,6 @@ function MultiSelectField(props) {
|
|
|
40
40
|
// Read Only does not apply to `select` fields, instead we'll add in disabled for tests to verify.
|
|
41
41
|
disabled: !!(readOnly || disabled), "data-error": !!errorMsg, "data-errormsg": errorMsg, "data-readonly": readOnly }, { children: [(0, jsx_runtime_1.jsx)("option", { disabled: true, value: "" }, void 0), options.map((option, i) => {
|
|
42
42
|
return ((0, jsx_runtime_1.jsx)("option", Object.assign({ value: getOptionValue(option), disabled: disabledOptions.includes(getOptionValue(option)) }, { children: getOptionLabel(option) }), i));
|
|
43
|
-
})] }), void 0), helperText && (0, jsx_runtime_1.jsx)("div", Object.assign({}, tid.helperText, { children: helperText }), void 0)] }, void 0));
|
|
43
|
+
})] }), void 0), helperText && (0, jsx_runtime_1.jsx)("div", Object.assign({}, tid.helperText, { children: helperText }), void 0)] }), void 0));
|
|
44
44
|
}
|
|
45
45
|
exports.MultiSelectField = MultiSelectField;
|
|
@@ -18,7 +18,7 @@ function SelectField(props) {
|
|
|
18
18
|
setOptions(maybeOptions);
|
|
19
19
|
}
|
|
20
20
|
}, [maybeOptions]);
|
|
21
|
-
return ((0, jsx_runtime_1.jsxs)("
|
|
21
|
+
return ((0, jsx_runtime_1.jsxs)("label", Object.assign({}, tid.label, { children: [label, (0, jsx_runtime_1.jsxs)("select", Object.assign({}, tid, { value:
|
|
22
22
|
// @ts-ignore - allow `value` to be seen as a string
|
|
23
23
|
value !== undefined && value !== "" && currentOption ? getOptionValue(currentOption) : "", onChange: (e) => {
|
|
24
24
|
const option = options.find((o) => `${getOptionValue(o)}` === e.target.value) || options[0];
|
|
@@ -37,6 +37,6 @@ function SelectField(props) {
|
|
|
37
37
|
// Read Only does not apply to `select` fields, instead we'll add in disabled for tests to verify.
|
|
38
38
|
disabled: !!(disabled || readOnly), "data-error": !!errorMsg, "data-errormsg": errorMsg, "data-readonly": readOnly }, { children: [(0, jsx_runtime_1.jsx)("option", { disabled: true, value: "" }, void 0), options.map((option, i) => {
|
|
39
39
|
return ((0, jsx_runtime_1.jsx)("option", Object.assign({ value: `${getOptionValue(option)}`, disabled: disabledOptions.includes(getOptionValue(option)) }, { children: getOptionLabel(option) }), i));
|
|
40
|
-
})] }), void 0), helperText && (0, jsx_runtime_1.jsx)("div", Object.assign({}, tid.helperText, { children: helperText }), void 0)] }, void 0));
|
|
40
|
+
})] }), void 0), helperText && (0, jsx_runtime_1.jsx)("div", Object.assign({}, tid.helperText, { children: helperText }), void 0)] }), void 0));
|
|
41
41
|
}
|
|
42
42
|
exports.SelectField = SelectField;
|