@homebound/beam 2.268.1 → 2.270.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.
@@ -1,6 +1,7 @@
1
1
  import { ReactNode } from "react";
2
2
  import { PresentationFieldProps } from "../components/PresentationContext";
3
3
  import { TextFieldBaseProps } from "./TextFieldBase";
4
+ import { Value } from "./Value";
4
5
  interface AutocompleteProps<T> extends Pick<PresentationFieldProps, "labelStyle">, Pick<TextFieldBaseProps<any>, "label" | "clearable" | "startAdornment"> {
5
6
  onSelect: (item: T) => void;
6
7
  /** A function that returns how to render the an option in the menu. If not set, `getOptionLabel` will be used */
@@ -19,6 +20,11 @@ interface AutocompleteProps<T> extends Pick<PresentationFieldProps, "labelStyle"
19
20
  placeholder?: string;
20
21
  /** Whether the input is disabled */
21
22
  disabled?: boolean;
23
+ /** A list of options that are disabled. Can be either the option itself or an object with the option and a reason why it is disabled */
24
+ disabledOptions?: (Value | {
25
+ value: Value;
26
+ reason: string;
27
+ })[];
22
28
  }
23
29
  export declare function Autocomplete<T extends object>(props: AutocompleteProps<T>): import("@emotion/react/jsx-runtime").JSX.Element;
24
30
  export {};
@@ -7,14 +7,17 @@ const react_aria_1 = require("react-aria");
7
7
  const react_stately_1 = require("react-stately");
8
8
  const components_1 = require("../components");
9
9
  const internal_1 = require("../components/internal");
10
+ const ComboBoxBase_1 = require("./internal/ComboBoxBase");
10
11
  const ListBox_1 = require("./internal/ListBox");
11
12
  const TextFieldBase_1 = require("./TextFieldBase");
12
13
  const Value_1 = require("./Value");
13
14
  function Autocomplete(props) {
14
- var _a;
15
- const { onSelect, getOptionLabel, getOptionValue, getOptionMenuLabel, onInputChange, value, options, disabled, ...others } = props;
15
+ var _a, _b;
16
+ const { onSelect, getOptionLabel, getOptionValue, getOptionMenuLabel, onInputChange, value, options, disabled, disabledOptions, ...others } = props;
17
+ const disabledOptionsWithReasons = Object.fromEntries((_a = disabledOptions === null || disabledOptions === void 0 ? void 0 : disabledOptions.map(ComboBoxBase_1.disabledOptionToKeyedTuple)) !== null && _a !== void 0 ? _a : []);
16
18
  const comboBoxProps = {
17
19
  isDisabled: !!disabled,
20
+ disabledKeys: Object.keys(disabledOptionsWithReasons),
18
21
  onInputChange: onInputChange,
19
22
  inputValue: value,
20
23
  items: options,
@@ -54,12 +57,12 @@ function Autocomplete(props) {
54
57
  });
55
58
  positionProps.style = {
56
59
  ...positionProps.style,
57
- width: (_a = inputWrapRef === null || inputWrapRef === void 0 ? void 0 : inputWrapRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth,
60
+ width: (_b = inputWrapRef === null || inputWrapRef === void 0 ? void 0 : inputWrapRef.current) === null || _b === void 0 ? void 0 : _b.clientWidth,
58
61
  // Ensures the menu never gets too small.
59
62
  minWidth: 200,
60
63
  };
61
64
  return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(TextFieldBase_1.TextFieldBase, { inputRef: inputRef, inputWrapRef: inputWrapRef, inputProps: inputProps, labelProps: labelProps, onChange: onInputChange, clearable: true,
62
65
  // Respect if caller to passes in `startAdornment={undefined}`
63
- startAdornment: "startAdornment" in props ? props.startAdornment : (0, jsx_runtime_1.jsx)(components_1.Icon, { icon: "search" }), ...others }), state.isOpen && ((0, jsx_runtime_1.jsx)(internal_1.Popover, { triggerRef: inputRef, popoverRef: popoverRef, positionProps: positionProps, onClose: () => state.close(), isOpen: state.isOpen, minWidth: 200, children: (0, jsx_runtime_1.jsx)(ListBox_1.ListBox, { ...listBoxProps, positionProps: positionProps, state: state, listBoxRef: listBoxRef, getOptionValue: (o) => (0, Value_1.valueToKey)(getOptionValue(o)), getOptionLabel: getOptionLabel }) }))] }));
66
+ startAdornment: "startAdornment" in props ? props.startAdornment : (0, jsx_runtime_1.jsx)(components_1.Icon, { icon: "search" }), ...others }), state.isOpen && ((0, jsx_runtime_1.jsx)(internal_1.Popover, { triggerRef: inputRef, popoverRef: popoverRef, positionProps: positionProps, onClose: () => state.close(), isOpen: state.isOpen, minWidth: 200, children: (0, jsx_runtime_1.jsx)(ListBox_1.ListBox, { ...listBoxProps, positionProps: positionProps, state: state, listBoxRef: listBoxRef, getOptionValue: (o) => (0, Value_1.valueToKey)(getOptionValue(o)), getOptionLabel: getOptionLabel, disabledOptionsWithReasons: disabledOptionsWithReasons }) }))] }));
64
67
  }
65
68
  exports.Autocomplete = Autocomplete;
@@ -43,7 +43,7 @@ function TreeOption(props) {
43
43
  e.stopPropagation();
44
44
  setCollapsedKeys((prevKeys) => collapsedKeys.includes(item.key) ? prevKeys.filter((k) => k !== item.key) : [...prevKeys, item.key]);
45
45
  return false;
46
- }, css: Css_1.Css.br4.hPx(16).wPx(16).bgTransparent.onHover.bgGray300.$, ...tid[`collapseToggle_${item.key}`], children: (0, jsx_runtime_1.jsx)(components_1.Icon, { icon: collapsedKeys.includes(item.key) ? "triangleRight" : "triangleDown", inc: 2 }) })) })), (0, jsx_runtime_1.jsxs)("span", { css: Css_1.Css.df.aic.gap1.h100.fg1.py1.pr2.$, ref: ref, ...optionProps, children: [(0, jsx_runtime_1.jsx)(CheckboxBase_1.StyledCheckbox, { isDisabled: isDisabled, isSelected: isSelected, isIndeterminate: isIndeterminate, ...tid[item.key.toString()] }), (0, jsx_runtime_1.jsx)("div", { css: Css_1.Css.pl1.$, children: item.rendered })] })] }));
46
+ }, css: Css_1.Css.br4.hPx(16).wPx(16).bgTransparent.onHover.bgGray300.$, ...tid[`collapseToggle_${item.key}`], children: (0, jsx_runtime_1.jsx)(components_1.Icon, { icon: collapsedKeys.includes(item.key) ? "triangleRight" : "triangleDown", inc: 2 }) })) })), (0, jsx_runtime_1.jsxs)("span", { css: Css_1.Css.df.aic.gap1.h100.fg1.py1.pr2.$, ref: ref, ...optionProps, "data-label": item.textValue, children: [(0, jsx_runtime_1.jsx)(CheckboxBase_1.StyledCheckbox, { isDisabled: isDisabled, isSelected: isSelected, isIndeterminate: isIndeterminate, ...tid[item.key.toString()] }), (0, jsx_runtime_1.jsx)("div", { css: Css_1.Css.pl1.$, children: item.rendered })] })] }));
47
47
  }
48
48
  exports.TreeOption = TreeOption;
49
49
  function hasSelectedChildren(childOption, state, getOptionValue) {
@@ -25,7 +25,7 @@ function Option(props) {
25
25
  return (0, components_1.maybeTooltip)({
26
26
  title: disabledReason,
27
27
  placement: "right",
28
- children: ((0, jsx_runtime_1.jsxs)("li", { ...(0, react_aria_1.mergeProps)(optionProps, hoverProps), ref: ref, css: {
28
+ children: ((0, jsx_runtime_1.jsxs)("li", { ...(0, react_aria_1.mergeProps)(optionProps, hoverProps), "data-label": item.textValue, ref: ref, css: {
29
29
  ...Css_1.Css.df.aic.jcsb.py1.px2.mh("42px").outline0.cursorPointer.sm.$,
30
30
  // Assumes only one Persistent Item per list - will need to change to utilize Sections if that assumption is incorrect.
31
31
  ...((0, ChipSelectField_1.isPersistentKey)(item.key) ? Css_1.Css.bt.bGray200.$ : {}),
@@ -1,7 +1,7 @@
1
1
  import { newLocation as _newLocation, withRouter as _withRouter } from "@homebound/rtl-react-router-utils";
2
2
  import { blur as _blur, change as _change, click as _click, focus as _focus, getOptions as _getOptions, input as _input, RenderResult, select as _select, type as _type, typeAndWait as _typeAndWait, wait as _wait, Wrapper } from "@homebound/rtl-utils";
3
3
  import { ReactElement } from "react";
4
- export { _blur as blur, _change as change, _click as click, _focus as focus, _getOptions as getOptions, _input as input, _select as select, _type as type, _typeAndWait as typeAndWait, _wait as wait, };
4
+ export { _blur as blur, _change as change, _click as click, _focus as focus, _getOptions as rtlUtilGetOptions, _input as input, _select as rtlUtilSelect, _type as type, _typeAndWait as typeAndWait, _wait as wait, };
5
5
  export { _newLocation as newLocation, _withRouter as withRouter };
6
6
  interface RenderOpts {
7
7
  at?: {
@@ -32,3 +32,11 @@ export declare function rowAnd(r: RenderResult, rowNum: number, testId: string):
32
32
  export declare function tableSnapshot(r: RenderResult): string;
33
33
  /** RTL wrapper for Beam's SuperDrawer/Modal context. */
34
34
  export declare const withBeamRTL: Wrapper;
35
+ /** Selects an option from the Beam SelectField, MultiSelectField, and TreeSelectField components
36
+ * For select fields that support multiple selections, subsequent calls to this function will toggle the selection state of an option.
37
+ * @param value The value or label of the option.
38
+ * */
39
+ export declare function select(element: HTMLElement, value: string | string[]): void;
40
+ export declare function selectAndWait(input: HTMLElement, value: string | string[]): Promise<void>;
41
+ export declare function getSelected(element: HTMLElement): string[] | string | undefined;
42
+ export declare function getOptions(element: HTMLElement): string[];
package/dist/utils/rtl.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.withBeamRTL = exports.tableSnapshot = exports.rowAnd = exports.row = exports.cellAnd = exports.cellOf = exports.cell = exports.render = exports.withRouter = exports.newLocation = exports.wait = exports.typeAndWait = exports.type = exports.select = exports.input = exports.getOptions = exports.focus = exports.click = exports.change = exports.blur = void 0;
3
+ exports.getOptions = exports.getSelected = exports.selectAndWait = exports.select = exports.withBeamRTL = exports.tableSnapshot = exports.rowAnd = exports.row = exports.cellAnd = exports.cellOf = exports.cell = exports.render = exports.withRouter = exports.newLocation = exports.wait = exports.typeAndWait = exports.type = exports.rtlUtilSelect = exports.input = exports.rtlUtilGetOptions = exports.focus = exports.click = exports.change = exports.blur = void 0;
4
4
  const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
5
5
  const rtl_react_router_utils_1 = require("@homebound/rtl-react-router-utils");
6
6
  Object.defineProperty(exports, "newLocation", { enumerable: true, get: function () { return rtl_react_router_utils_1.newLocation; } });
@@ -10,9 +10,9 @@ Object.defineProperty(exports, "blur", { enumerable: true, get: function () { re
10
10
  Object.defineProperty(exports, "change", { enumerable: true, get: function () { return rtl_utils_1.change; } });
11
11
  Object.defineProperty(exports, "click", { enumerable: true, get: function () { return rtl_utils_1.click; } });
12
12
  Object.defineProperty(exports, "focus", { enumerable: true, get: function () { return rtl_utils_1.focus; } });
13
- Object.defineProperty(exports, "getOptions", { enumerable: true, get: function () { return rtl_utils_1.getOptions; } });
13
+ Object.defineProperty(exports, "rtlUtilGetOptions", { enumerable: true, get: function () { return rtl_utils_1.getOptions; } });
14
14
  Object.defineProperty(exports, "input", { enumerable: true, get: function () { return rtl_utils_1.input; } });
15
- Object.defineProperty(exports, "select", { enumerable: true, get: function () { return rtl_utils_1.select; } });
15
+ Object.defineProperty(exports, "rtlUtilSelect", { enumerable: true, get: function () { return rtl_utils_1.select; } });
16
16
  Object.defineProperty(exports, "type", { enumerable: true, get: function () { return rtl_utils_1.type; } });
17
17
  Object.defineProperty(exports, "typeAndWait", { enumerable: true, get: function () { return rtl_utils_1.typeAndWait; } });
18
18
  Object.defineProperty(exports, "wait", { enumerable: true, get: function () { return rtl_utils_1.wait; } });
@@ -135,3 +135,98 @@ function getTextFromTableCellNode(node) {
135
135
  exports.withBeamRTL = {
136
136
  wrap: (c) => (0, jsx_runtime_1.jsx)(components_1.BeamProvider, { children: c }),
137
137
  };
138
+ /** Selects an option from the Beam SelectField, MultiSelectField, and TreeSelectField components
139
+ * For select fields that support multiple selections, subsequent calls to this function will toggle the selection state of an option.
140
+ * @param value The value or label of the option.
141
+ * */
142
+ function select(element, value) {
143
+ const select = resolveIfNeeded(element);
144
+ if (isSelectElement(select)) {
145
+ throw new Error("Beam select helper does not support <select> elements.");
146
+ }
147
+ if (!isInputElement(select)) {
148
+ throw new Error(`Expected element to be INPUT, but got ${select.nodeName}. This field may be read-only.`);
149
+ }
150
+ function maybeOpenAndSelect(optionValue) {
151
+ const expanded = select.getAttribute("aria-expanded") === "true";
152
+ if (!expanded) {
153
+ (0, rtl_utils_1.click)(select);
154
+ }
155
+ const body = select.closest("body");
156
+ const listboxId = select.getAttribute("aria-controls");
157
+ const listbox = body.querySelector(`#${listboxId}`);
158
+ const options = listbox.querySelectorAll("[role=option]");
159
+ // Allow searching for options by their data-key (value) or textContent (label)
160
+ const optionToSelect = Array.from(options).find((o) => o.dataset.key === optionValue || o.dataset.label === optionValue);
161
+ if (!optionToSelect) {
162
+ throw new Error(`Could not find option with value or text content of ${optionValue}`);
163
+ }
164
+ (0, rtl_utils_1.click)(optionToSelect);
165
+ }
166
+ const optionValues = Array.isArray(value) ? value : [value];
167
+ optionValues.forEach((optionValue) => {
168
+ maybeOpenAndSelect(optionValue);
169
+ });
170
+ }
171
+ exports.select = select;
172
+ function selectAndWait(input, value) {
173
+ return (0, rtl_utils_1.allowAndWaitForAsyncBehavior)(() => select(input, value));
174
+ }
175
+ exports.selectAndWait = selectAndWait;
176
+ function getSelected(element) {
177
+ var _a;
178
+ const select = resolveIfNeeded(element);
179
+ if (isSelectElement(select)) {
180
+ throw new Error("Beam getSelected helper does not support <select> elements");
181
+ }
182
+ if (!isInputElement(select) && select.dataset.readonly === "true") {
183
+ // For read-only fields that render as a 'div'
184
+ return (_a = select.textContent) !== null && _a !== void 0 ? _a : undefined;
185
+ }
186
+ const expanded = select.getAttribute("aria-expanded") === "true";
187
+ if (!expanded) {
188
+ (0, rtl_utils_1.click)(select);
189
+ }
190
+ const body = select.closest("body");
191
+ const listboxId = select.getAttribute("aria-controls");
192
+ const listbox = body.querySelector(`#${listboxId}`);
193
+ const options = listbox.querySelectorAll("[role=option]");
194
+ const selections = Array.from(options)
195
+ .filter((o) => o.getAttribute("aria-selected") === "true")
196
+ .map((o) => { var _a, _b; return (_b = (_a = o.dataset.label) !== null && _a !== void 0 ? _a : o.dataset.key) !== null && _b !== void 0 ? _b : ""; })
197
+ // Filter out empty strings
198
+ .filter((o) => !!o);
199
+ return selections.length > 0 ? (selections.length > 1 ? selections : selections[0]) : undefined;
200
+ }
201
+ exports.getSelected = getSelected;
202
+ function getOptions(element) {
203
+ const select = resolveIfNeeded(element);
204
+ if (isSelectElement(select)) {
205
+ throw new Error("Beam getOptions helper does not support <select> elements");
206
+ }
207
+ if (!isInputElement(select)) {
208
+ 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`);
209
+ }
210
+ const expanded = select.getAttribute("aria-expanded") === "true";
211
+ if (!expanded) {
212
+ (0, rtl_utils_1.click)(select);
213
+ }
214
+ const body = select.closest("body");
215
+ const listboxId = select.getAttribute("aria-controls");
216
+ const listbox = body.querySelector(`#${listboxId}`);
217
+ const options = listbox.querySelectorAll("[role=option]");
218
+ return Array.from(options)
219
+ .map((o) => { var _a, _b; return (_b = (_a = o.dataset.label) !== null && _a !== void 0 ? _a : o.dataset.key) !== null && _b !== void 0 ? _b : ""; })
220
+ .filter((o) => !!o);
221
+ }
222
+ exports.getOptions = getOptions;
223
+ function resolveIfNeeded(element) {
224
+ const maybeProxy = element;
225
+ return maybeProxy instanceof Function ? maybeProxy() : element;
226
+ }
227
+ function isSelectElement(element) {
228
+ return element.nodeName === "SELECT";
229
+ }
230
+ function isInputElement(element) {
231
+ return element.nodeName === "INPUT";
232
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homebound/beam",
3
- "version": "2.268.1",
3
+ "version": "2.270.0",
4
4
  "author": "Homebound",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -1,3 +0,0 @@
1
- import { MultiSelectFieldProps, Value } from "./";
2
- /** Mocks out `MultiSelectField` as a multiple `<select>` field. */
3
- export declare function MultiSelectField<T, V extends Value>(props: MultiSelectFieldProps<T, V>): import("@emotion/react/jsx-runtime").JSX.Element;
@@ -1,45 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MultiSelectField = void 0;
4
- const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
5
- const utils_1 = require("../utils");
6
- const defaultTestId_1 = require("../utils/defaultTestId");
7
- /** Mocks out `MultiSelectField` as a multiple `<select>` field. */
8
- function MultiSelectField(props) {
9
- const { getOptionValue = (o) => o.id, // if unset, assume O implements HasId
10
- getOptionLabel = (o) => o.name, // if unset, assume O implements HasName
11
- values, options, onSelect, readOnly = false, errorMsg, onFocus, onBlur, disabled, label, disabledOptions = [], helperText, } = props;
12
- const tid = (0, utils_1.useTestIds)(props, (0, defaultTestId_1.defaultTestId)(label));
13
- return ((0, jsx_runtime_1.jsxs)("label", { ...tid.label, children: [label, (0, jsx_runtime_1.jsxs)("select", { ...tid,
14
- // We're cheating and assume the values are strings...what we should really do is either:
15
- // a) use beam's valueToKey mapping to string-encode any Value, or
16
- // b) instead of using `values` directly, use the index of each value's `option` in `options`
17
- value: values, onChange: (e) => {
18
- var _a, _b, _c;
19
- const { target } = e;
20
- const selectedValues = [...values];
21
- for (let i = 0; i < target.selectedOptions.length; i++) {
22
- if (selectedValues.includes((_a = target.selectedOptions.item(i)) === null || _a === void 0 ? void 0 : _a.value)) {
23
- // deSelect if already selected
24
- selectedValues.splice(selectedValues.indexOf((_b = target.selectedOptions.item(i)) === null || _b === void 0 ? void 0 : _b.value), 1);
25
- }
26
- else {
27
- // add value
28
- selectedValues.push((_c = target.selectedOptions.item(i)) === null || _c === void 0 ? void 0 : _c.value);
29
- }
30
- }
31
- const selectedOptions = options.filter((o) => selectedValues.includes(getOptionValue(o)));
32
- onSelect(selectedOptions.map((o) => getOptionValue(o)), selectedOptions);
33
- }, multiple: true, onFocus: () => {
34
- if (!readOnly && onFocus)
35
- onFocus();
36
- }, onBlur: () => {
37
- if (!readOnly && onBlur)
38
- onBlur();
39
- },
40
- // Read Only does not apply to `select` fields, instead we'll add in disabled for tests to verify.
41
- disabled: !!(readOnly || disabled), "data-error": !!errorMsg, "data-errormsg": errorMsg, "data-readonly": readOnly, children: [(0, jsx_runtime_1.jsx)("option", { disabled: true, value: "" }), options.map((option, i) => {
42
- return ((0, jsx_runtime_1.jsx)("option", { value: getOptionValue(option), disabled: disabledOptions.includes(getOptionValue(option)), children: getOptionLabel(option) }, i));
43
- })] }), helperText && (0, jsx_runtime_1.jsx)("div", { ...tid.helperText, children: helperText })] }));
44
- }
45
- exports.MultiSelectField = MultiSelectField;
@@ -1,4 +0,0 @@
1
- import { Key } from "react";
2
- import { SelectFieldProps } from "./";
3
- /** Mocks out `SelectField` as a `<select>` field. */
4
- export declare function SelectField<O extends object, V extends Key>(props: SelectFieldProps<O, V>): import("@emotion/react/jsx-runtime").JSX.Element;
@@ -1,44 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SelectField = void 0;
4
- const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
5
- const react_1 = require("react");
6
- const utils_1 = require("../utils");
7
- const defaultTestId_1 = require("../utils/defaultTestId");
8
- /** Mocks out `SelectField` as a `<select>` field. */
9
- function SelectField(props) {
10
- const { getOptionValue = (o) => o.id, // if unset, assume O implements HasId
11
- getOptionLabel = (o) => o.name, // if unset, assume O implements HasName
12
- value, options: maybeOptions, onSelect, readOnly = false, errorMsg, onBlur, onFocus, disabled, disabledOptions = [], label, helperText, } = props;
13
- const tid = (0, utils_1.useTestIds)(props, (0, defaultTestId_1.defaultTestId)(label));
14
- const [options, setOptions] = (0, react_1.useState)(Array.isArray(maybeOptions) ? maybeOptions : maybeOptions.initial);
15
- const currentOption = options.find((o) => getOptionValue(o) === value) || options[0];
16
- (0, react_1.useEffect)(() => {
17
- if (Array.isArray(maybeOptions) && maybeOptions !== options) {
18
- setOptions(maybeOptions);
19
- }
20
- }, [maybeOptions]);
21
- return ((0, jsx_runtime_1.jsxs)("label", { ...tid.label, children: [label, (0, jsx_runtime_1.jsxs)("select", { ...tid, value:
22
- // @ts-ignore - allow `value` to be seen as a string
23
- value !== undefined && value !== "" && currentOption ? getOptionValue(currentOption) : "", onChange: (e) => {
24
- const option = options.find((o) => `${getOptionValue(o)}` === e.target.value) || options[0];
25
- onSelect(getOptionValue(option), option);
26
- }, onFocus: async () => {
27
- if (!Array.isArray(maybeOptions)) {
28
- const result = await maybeOptions.load();
29
- setOptions(result.options);
30
- }
31
- if (!readOnly && onFocus)
32
- onFocus();
33
- }, onBlur: () => {
34
- if (!readOnly && onBlur)
35
- onBlur();
36
- },
37
- // Read Only does not apply to `select` fields, instead we'll add in disabled for tests to verify.
38
- disabled: !!(disabled || readOnly), "data-error": !!errorMsg, "data-errormsg": errorMsg, "data-readonly": readOnly, children: [(0, jsx_runtime_1.jsx)("option", { disabled: true, value: "" }), options.map((option, i) => {
39
- return ((0, jsx_runtime_1.jsx)("option", { value: `${getOptionValue(option)}`, disabled: disabledOptions.some((dOption) => typeof dOption === "object"
40
- ? dOption.value === getOptionValue(option)
41
- : dOption === getOptionValue(option)), children: getOptionLabel(option) }, i));
42
- })] }), helperText && (0, jsx_runtime_1.jsx)("div", { ...tid.helperText, children: helperText })] }));
43
- }
44
- exports.SelectField = SelectField;