@homebound/beam 2.97.1 → 2.97.5

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.
@@ -86,7 +86,7 @@ const variantStyles = {
86
86
  disabledStyles: Css_1.Css.bgRed200.$,
87
87
  },
88
88
  text: {
89
- baseStyles: Css_1.Css.lightBlue700.$,
89
+ baseStyles: Css_1.Css.lightBlue700.add("fontSize", "inherit").$,
90
90
  hoverStyles: {},
91
91
  pressedStyles: {},
92
92
  disabledStyles: Css_1.Css.lightBlue300.$,
@@ -8,8 +8,12 @@ const utils_1 = require("../utils");
8
8
  const defaultLabel_1 = require("../utils/defaultLabel");
9
9
  /** Wraps `TextField` and binds it to a form field. */
10
10
  function BoundTextField(props) {
11
- const { field, readOnly, onChange = (value) => field.set(value), label = (0, defaultLabel_1.defaultLabel)(field.key), ...others } = props;
11
+ const { field, readOnly, onChange = (value) => field.set(value), label = (0, defaultLabel_1.defaultLabel)(field.key), onEnter, ...others } = props;
12
12
  const testId = (0, utils_1.useTestIds)(props, field.key);
13
- return ((0, jsx_runtime_1.jsx)(mobx_react_1.Observer, { children: () => ((0, jsx_runtime_1.jsx)(inputs_1.TextField, Object.assign({ label: label, value: field.value || undefined, onChange: onChange, readOnly: readOnly !== null && readOnly !== void 0 ? readOnly : field.readOnly, errorMsg: field.touched ? field.errors.join(" ") : undefined, required: field.required, onBlur: () => field.blur(), onFocus: () => field.focus() }, testId, others), void 0)) }, void 0));
13
+ return ((0, jsx_runtime_1.jsx)(mobx_react_1.Observer, { children: () => ((0, jsx_runtime_1.jsx)(inputs_1.TextField, Object.assign({ label: label, value: field.value || undefined, onChange: onChange, readOnly: readOnly !== null && readOnly !== void 0 ? readOnly : field.readOnly, errorMsg: field.touched ? field.errors.join(" ") : undefined, required: field.required, onBlur: () => field.blur(), onFocus: () => field.focus(), onEnter: () => {
14
+ (0, utils_1.maybeCall)(onEnter);
15
+ // Blur the field when the user hits the enter key - as if they are "committing" the value and done with the field
16
+ field.blur();
17
+ } }, testId, others), void 0)) }, void 0));
14
18
  }
15
19
  exports.BoundTextField = BoundTextField;
@@ -14,6 +14,6 @@ function DateField(props) {
14
14
  const { value } = e.target;
15
15
  setValue(value);
16
16
  onChange((0, date_fns_1.parse)(value, "MM/dd/yy", new Date()));
17
- }, onBlur: () => (0, utils_1.maybeCall)(onBlur), onFocus: () => (0, utils_1.maybeCall)(onFocus), disabled: !!props.disabled, readOnly: props.readOnly }), void 0));
17
+ }, onBlur: () => (0, utils_1.maybeCall)(onBlur), onFocus: () => (0, utils_1.maybeCall)(onFocus), disabled: !!props.disabled, readOnly: props.readOnly, "data-disabled-days": JSON.stringify(props.disabledDays) }), void 0));
18
18
  }
19
19
  exports.DateField = DateField;
@@ -7,6 +7,7 @@ export interface TextFieldProps<X> extends BeamTextFieldProps<X> {
7
7
  inlineLabel?: boolean;
8
8
  clearable?: boolean;
9
9
  api?: MutableRefObject<TextFieldApi | undefined>;
10
+ onEnter?: Callback;
10
11
  }
11
12
  export declare function TextField<X extends Only<TextFieldXss, X>>(props: TextFieldProps<X>): import("@emotion/react/jsx-runtime").JSX.Element;
12
13
  export declare type TextFieldApi = {
@@ -5,8 +5,9 @@ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const react_aria_1 = require("react-aria");
7
7
  const TextFieldBase_1 = require("./TextFieldBase");
8
+ const utils_1 = require("../utils");
8
9
  function TextField(props) {
9
- const { disabled: isDisabled = false, readOnly = false, required, errorMsg, value = "", onBlur, onFocus, api, ...otherProps } = props;
10
+ const { disabled: isDisabled = false, readOnly = false, required, errorMsg, value = "", onBlur, onFocus, api, onEnter, ...otherProps } = props;
10
11
  const textFieldProps = {
11
12
  ...otherProps,
12
13
  isDisabled,
@@ -19,10 +20,8 @@ function TextField(props) {
19
20
  const { labelProps, inputProps } = (0, react_aria_1.useTextField)({
20
21
  ...textFieldProps,
21
22
  onKeyDown: (e) => {
22
- var _a;
23
23
  if (e.key === "Enter") {
24
- // Blur the field when the user hits the enter key - as if they are "committing" the value and done with the field
25
- (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.blur();
24
+ (0, utils_1.maybeCall)(onEnter);
26
25
  }
27
26
  },
28
27
  }, inputRef);
@@ -198,7 +198,22 @@ function SelectFieldBase(props) {
198
198
  // Only update the fieldset when options change, when options is an array.
199
199
  // Otherwise, if the options are passed in as an object, then we assume the caller is updating options via a Promise and not via updating props.
200
200
  if (Array.isArray(maybeOptions) && maybeOptions !== fieldState.allOptions) {
201
- setFieldState((prevState) => ({ ...prevState, filteredOptions: maybeOptions, allOptions: maybeOptions }));
201
+ setFieldState((prevState) => {
202
+ var _a;
203
+ const selectedOptions = maybeOptions.filter((o) => values === null || values === void 0 ? void 0 : values.includes(getOptionValue(o)));
204
+ return {
205
+ ...prevState,
206
+ selectedKeys: (_a = selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions.map((o) => (0, Value_1.valueToKey)(getOptionValue(o)))) !== null && _a !== void 0 ? _a : [],
207
+ inputValue: selectedOptions.length === 1
208
+ ? getOptionLabel(selectedOptions[0])
209
+ : multiselect && selectedOptions.length === 0
210
+ ? nothingSelectedText
211
+ : "",
212
+ selectedOptions: selectedOptions,
213
+ filteredOptions: maybeOptions,
214
+ allOptions: maybeOptions,
215
+ };
216
+ });
202
217
  }
203
218
  }, [maybeOptions]);
204
219
  // For the most part, the returned props contain `aria-*` and `id` attributes for accessibility purposes.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homebound/beam",
3
- "version": "2.97.1",
3
+ "version": "2.97.5",
4
4
  "author": "Homebound",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",