@homebound/beam 2.415.5 → 2.416.0-alpha.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.
package/dist/index.js CHANGED
@@ -15,7 +15,7 @@ import {
15
15
  safeKeys,
16
16
  toToggleState,
17
17
  useTestIds
18
- } from "./chunk-ZQBDHF22.js";
18
+ } from "./chunk-XH44AYND.js";
19
19
 
20
20
  // src/Css.ts
21
21
  var CssBuilder = class _CssBuilder {
@@ -6726,7 +6726,7 @@ function Button(props) {
6726
6726
  const result = onPress(e);
6727
6727
  if (isPromise(result)) {
6728
6728
  setAsyncInProgress(true);
6729
- result.finally(() => setAsyncInProgress(false));
6729
+ void result.finally(() => setAsyncInProgress(false));
6730
6730
  }
6731
6731
  return result;
6732
6732
  },
@@ -8133,7 +8133,7 @@ var RowState = class {
8133
8133
  }
8134
8134
  }
8135
8135
  /** Used by node when doing `console.log(rs)`. */
8136
- [Symbol.for("nodejs.util.inspect.custom")]() {
8136
+ [/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")]() {
8137
8137
  return `RowState@${this.row.id}`;
8138
8138
  }
8139
8139
  };
@@ -8709,7 +8709,7 @@ function Menu(props) {
8709
8709
  const { items: items2, ...others } = tree;
8710
8710
  const [itemsSection, persistentSection] = items2;
8711
8711
  if (search) {
8712
- const filteredChildren = itemsSection.children.filter((item) => contains(item.value.label, search));
8712
+ const filteredChildren = (itemsSection.children ?? []).filter((item) => contains(item.value.label, search));
8713
8713
  const { items: items3, ...otherValues } = itemsSection.value;
8714
8714
  const filteredValue = items3?.filter((item) => contains(item.label, search));
8715
8715
  return {
@@ -9159,18 +9159,21 @@ function ListBoxChip({ label }) {
9159
9159
  }
9160
9160
 
9161
9161
  // src/inputs/Value.ts
9162
+ var VALUE_PREFIX = "__VALUE--";
9162
9163
  function keyToValue(key) {
9163
9164
  if (typeof key === "number") {
9164
9165
  return key;
9165
9166
  } else if (typeof key === "string") {
9166
- if (key === "__VALUE:null") {
9167
+ if (key === `${VALUE_PREFIX}null` || key === "__VALUE:null") {
9167
9168
  return null;
9168
- } else if (key === "__VALUE:undefined") {
9169
+ } else if (key === `${VALUE_PREFIX}undefined` || key === "__VALUE:undefined") {
9169
9170
  return void 0;
9170
- } else if (key.startsWith("__VALUE:boolean:")) {
9171
- return key.split(":")[2] === "true";
9172
- } else if (key.startsWith("__VALUE:number")) {
9173
- return Number(key.split(":")[2]);
9171
+ } else if (key.startsWith(`${VALUE_PREFIX}boolean--`) || key.startsWith("__VALUE:boolean:")) {
9172
+ const parts = key.includes("--boolean--") ? key.split("--") : key.split(":");
9173
+ return parts[parts.length - 1] === "true";
9174
+ } else if (key.startsWith(`${VALUE_PREFIX}number--`) || key.startsWith("__VALUE:number:")) {
9175
+ const parts = key.includes("--number--") ? key.split("--") : key.split(":");
9176
+ return Number(parts[parts.length - 1]);
9174
9177
  } else {
9175
9178
  return key;
9176
9179
  }
@@ -9182,13 +9185,13 @@ function valueToKey(value) {
9182
9185
  if (typeof value === "string") {
9183
9186
  return value;
9184
9187
  } else if (typeof value === "number") {
9185
- return `__VALUE:number:${value}`;
9188
+ return `${VALUE_PREFIX}number--${value}`;
9186
9189
  } else if (typeof value === "boolean") {
9187
- return `__VALUE:boolean:${value}`;
9190
+ return `${VALUE_PREFIX}boolean--${value}`;
9188
9191
  } else if (value === null) {
9189
- return "__VALUE:null";
9192
+ return `${VALUE_PREFIX}null`;
9190
9193
  } else if (value === void 0) {
9191
- return "__VALUE:undefined";
9194
+ return `${VALUE_PREFIX}undefined`;
9192
9195
  } else {
9193
9196
  throw new Error(`Unsupported value ${value}`);
9194
9197
  }
@@ -9759,7 +9762,8 @@ function VirtualizedOptions(props) {
9759
9762
  allowCollapsing
9760
9763
  } = props;
9761
9764
  const virtuosoRef = useRef21(null);
9762
- const focusedItem = state.collection.getItem(state.selectionManager.focusedKey);
9765
+ const focusedKey = state.selectionManager.focusedKey;
9766
+ const focusedItem = focusedKey != null ? state.collection.getItem(focusedKey) : null;
9763
9767
  const selectedItem = state.selectionManager.selectedKeys.size > 0 ? state.collection.getItem([...state.selectionManager.selectedKeys.values()][0]) : void 0;
9764
9768
  useEffect12(
9765
9769
  () => {
@@ -10229,6 +10233,7 @@ function TreeSelectFieldBase(props) {
10229
10233
  state.selectionManager.state = useMultipleSelectionState({
10230
10234
  selectionMode: "multiple",
10231
10235
  selectedKeys: fieldState.selectedKeys,
10236
+ disabledKeys: Object.keys(disabledOptionsWithReasons),
10232
10237
  onSelectionChange: (newKeys) => {
10233
10238
  if (newKeys === "all") {
10234
10239
  return;
@@ -10521,7 +10526,9 @@ function ComboBoxInput(props) {
10521
10526
  onKeyDown: (e) => {
10522
10527
  if (isMultiSelect) {
10523
10528
  if (isTree) {
10524
- const item = state.collection.getItem(state.selectionManager.focusedKey);
10529
+ const focusedKey = state.selectionManager.focusedKey;
10530
+ if (focusedKey == null) return;
10531
+ const item = state.collection.getItem(focusedKey);
10525
10532
  if (item && (e.key === "ArrowRight" || e.key === "ArrowLeft")) {
10526
10533
  if (!isLeveledNode(item)) return;
10527
10534
  const leveledOption = item.value;
@@ -10543,7 +10550,10 @@ function ComboBoxInput(props) {
10543
10550
  if (state.isOpen) {
10544
10551
  e.preventDefault();
10545
10552
  }
10546
- state.selectionManager.toggleSelection(state.selectionManager.focusedKey);
10553
+ const focusedKey = state.selectionManager.focusedKey;
10554
+ if (focusedKey != null) {
10555
+ state.selectionManager.toggleSelection(focusedKey);
10556
+ }
10547
10557
  return;
10548
10558
  }
10549
10559
  if (e.key === "Escape") {
@@ -10765,7 +10775,8 @@ function ComboBoxBase(props) {
10765
10775
  // Do not allow an empty selection if single select mode
10766
10776
  disallowEmptySelection: !multiselect,
10767
10777
  selectedKeys,
10768
- onSelectionChange
10778
+ onSelectionChange,
10779
+ disabledKeys: Object.keys(disabledOptionsWithReasons)
10769
10780
  });
10770
10781
  const [debouncedSearch] = useDebounce(searchValue, 300);
10771
10782
  useEffect15(() => {
@@ -10949,6 +10960,7 @@ function Autocomplete(props) {
10949
10960
  allowsCustomValue: true,
10950
10961
  children: (item) => /* @__PURE__ */ jsx58(Item5, { textValue: getOptionLabel(item), children: getOptionMenuLabel ? getOptionMenuLabel(item) : getOptionLabel(item) }, getOptionValue(item)),
10951
10962
  onSelectionChange: (key) => {
10963
+ if (key == null) return;
10952
10964
  const selectedItem = options.find((i) => getOptionValue(i) === key);
10953
10965
  if (selectedItem) {
10954
10966
  onInputChange(getOptionLabel(selectedItem));
@@ -11787,7 +11799,6 @@ function RadioGroupField(props) {
11787
11799
  /* @__PURE__ */ jsx70(Label, { label, ...labelProps, ...tid.label, hidden: labelStyle === "hidden" }),
11788
11800
  /* @__PURE__ */ jsxs41("div", { ...radioGroupProps, children: [
11789
11801
  options.map((option) => {
11790
- const isDisabled = state.isDisabled || !!option.disabled;
11791
11802
  return /* @__PURE__ */ jsx70(Fragment18, { children: maybeTooltip({
11792
11803
  title: resolveTooltip(option.disabled),
11793
11804
  placement: "bottom",
@@ -11796,7 +11807,8 @@ function RadioGroupField(props) {
11796
11807
  {
11797
11808
  parentId: name,
11798
11809
  option,
11799
- state: { ...state, isDisabled },
11810
+ state,
11811
+ isOptionDisabled: !!option.disabled,
11800
11812
  ...otherProps,
11801
11813
  ...tid[option.value]
11802
11814
  }
@@ -11814,13 +11826,18 @@ function Radio(props) {
11814
11826
  parentId,
11815
11827
  option: { description, label, value },
11816
11828
  state,
11829
+ isOptionDisabled,
11817
11830
  ...others
11818
11831
  } = props;
11819
- const disabled = state.isDisabled;
11820
11832
  const labelId = `${parentId}-${value}-label`;
11821
11833
  const descriptionId = `${parentId}-${value}-description`;
11822
11834
  const ref = useRef30(null);
11823
- const { inputProps } = useRadio({ value, "aria-labelledby": labelId }, state, ref);
11835
+ const { inputProps, isDisabled } = useRadio(
11836
+ { value, "aria-labelledby": labelId, isDisabled: isOptionDisabled },
11837
+ state,
11838
+ ref
11839
+ );
11840
+ const disabled = isDisabled;
11824
11841
  const { focusProps, isFocusVisible } = useFocusRing6();
11825
11842
  const { hoverProps, isHovered } = useHover12({ isDisabled: disabled });
11826
11843
  return /* @__PURE__ */ jsxs41("label", { css: Css.df.cursorPointer.mb1.if(disabled).add("cursor", "initial").$, ...hoverProps, children: [
@@ -12360,7 +12377,7 @@ function ToggleButton(props) {
12360
12377
  const result = onChange(e);
12361
12378
  if (isPromise(result)) {
12362
12379
  setAsyncInProgress(true);
12363
- result.finally(() => setAsyncInProgress(false));
12380
+ void result.finally(() => setAsyncInProgress(false));
12364
12381
  }
12365
12382
  return result;
12366
12383
  }
@@ -13996,7 +14013,7 @@ function renderVirtual(style, id, columns, visibleDataRows, keptSelectedRows, fi
13996
14013
  const result = infiniteScroll.onEndReached(index);
13997
14014
  if (isPromise(result)) {
13998
14015
  setFetchMoreInProgress(true);
13999
- result.finally(() => setFetchMoreInProgress(false));
14016
+ void result.finally(() => setFetchMoreInProgress(false));
14000
14017
  }
14001
14018
  }
14002
14019
  } : {}
@@ -17466,7 +17483,10 @@ function ButtonDatePicker(props) {
17466
17483
  const { defaultOpen, disabled, trigger, onSelect, ...datePickerProps } = props;
17467
17484
  const state = useMenuTriggerState4({ isOpen: defaultOpen });
17468
17485
  const buttonRef = useRef47(null);
17469
- const { menuTriggerProps, menuProps } = useMenuTrigger4({ isDisabled: !!disabled }, state, buttonRef);
17486
+ const {
17487
+ menuTriggerProps,
17488
+ menuProps: { autoFocus: _af, ...menuProps }
17489
+ } = useMenuTrigger4({ isDisabled: !!disabled }, state, buttonRef);
17470
17490
  const tid = useTestIds(
17471
17491
  props,
17472
17492
  isTextButton(trigger) ? defaultTestId(labelOr(trigger, "buttonDatePicker")) : isNavLinkButton(trigger) ? defaultTestId(trigger.navLabel) : isIconButton(trigger) ? trigger.icon : trigger.name