@homebound/beam 4.55.0 → 4.55.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.d.cts CHANGED
@@ -8732,6 +8732,8 @@ type MenuSelectFieldBaseProps<O, V extends Value> = {
8732
8732
  getOptionMenuLabel?: (opt: O) => ReactNode;
8733
8733
  /** Extra text the menu search matches, in addition to `getOptionLabel`. */
8734
8734
  getOptionSearchText?: (opt: O) => string | readonly string[];
8735
+ /** Sort options by `getOptionLabel`. On by default. `MenuTreeSelectField` defaults this to false. */
8736
+ autoSort?: boolean;
8735
8737
  /** Debounced menu search text. The caller replaces `options` and should keep the current selection in that list. Closing calls this with `""`. */
8736
8738
  onSearch?: (search: string) => void;
8737
8739
  disabledOptions?: (V | {
package/dist/index.d.ts CHANGED
@@ -8732,6 +8732,8 @@ type MenuSelectFieldBaseProps<O, V extends Value> = {
8732
8732
  getOptionMenuLabel?: (opt: O) => ReactNode;
8733
8733
  /** Extra text the menu search matches, in addition to `getOptionLabel`. */
8734
8734
  getOptionSearchText?: (opt: O) => string | readonly string[];
8735
+ /** Sort options by `getOptionLabel`. On by default. `MenuTreeSelectField` defaults this to false. */
8736
+ autoSort?: boolean;
8735
8737
  /** Debounced menu search text. The caller replaces `options` and should keep the current selection in that list. Closing calls this with `""`. */
8736
8738
  onSearch?: (search: string) => void;
8737
8739
  disabledOptions?: (V | {
package/dist/index.js CHANGED
@@ -19919,6 +19919,7 @@ function useMenuSelectField(props) {
19919
19919
  getOptionLabel = defaultOptionLabel,
19920
19920
  getOptionMenuLabel,
19921
19921
  getOptionSearchText,
19922
+ autoSort = true,
19922
19923
  onSearch,
19923
19924
  disabledOptions,
19924
19925
  nothingSelectedText = "",
@@ -19961,10 +19962,10 @@ function useMenuSelectField(props) {
19961
19962
  const [optionsLoading, setOptionsLoading] = useState31(false);
19962
19963
  const didRequestOptionsRef = useRef36(false);
19963
19964
  const options = useMemo28(
19964
- () => initializeOptions(optionsProp, getOptionValue, getOptionLabel, void 0, false),
19965
+ () => initializeOptions(optionsProp, getOptionValue, getOptionLabel, void 0, autoSort),
19965
19966
  // getOptionValue and getOptionLabel are typically inline lambdas
19966
19967
  // oxlint-disable-next-line react-hooks/exhaustive-deps
19967
- [optionsProp]
19968
+ [optionsProp, autoSort]
19968
19969
  );
19969
19970
  const { hoverProps, isHovered } = useHover13({});
19970
19971
  const { focusProps, isFocusVisible } = useFocusRing10();
@@ -21824,11 +21825,12 @@ import { Observer as Observer8 } from "mobx-react";
21824
21825
  // src/inputs/MenuSelectField/MenuTreeSelectField.tsx
21825
21826
  import { jsx as jsx140 } from "react/jsx-runtime";
21826
21827
  function MenuTreeSelectField(props) {
21827
- const { onSelect, selectionDisplay = "all", defaultExpanded = false, ...rest } = props;
21828
+ const { onSelect, selectionDisplay = "all", defaultExpanded = false, autoSort = false, ...rest } = props;
21828
21829
  return /* @__PURE__ */ jsx140(
21829
21830
  BaseMenuSelectField,
21830
21831
  {
21831
21832
  ...rest,
21833
+ autoSort,
21832
21834
  selectionMode: "multiple",
21833
21835
  tree: { getChildren: getNestedChildren, display: selectionDisplay, defaultExpanded },
21834
21836
  onCommit: (values, opts) => onSelect(treeSelectResponse(values, opts))
@@ -31508,14 +31510,19 @@ var SingleFilter = class extends BaseFilter {
31508
31510
  return resolveOptionSelectedFilterLabel(options, getOptionValue, getOptionLabel, value);
31509
31511
  }
31510
31512
  render(value, setValue, tid, inModal, vertical) {
31511
- const { label, defaultValue, options: maybeOptions, nothingSelectedText, ...props } = this.props;
31513
+ const { label, defaultValue, options: maybeOptions, nothingSelectedText, autoSort, ...props } = this.props;
31512
31514
  const { getOptionValue, getOptionLabel } = optionReaders2(this.props);
31513
31515
  const unsetText = nothingSelectedText ?? "All";
31514
- const options = Array.isArray(maybeOptions) ? [allOption, ...maybeOptions] : { ...maybeOptions, current: maybeOptions.current };
31516
+ const isStaticList = Array.isArray(maybeOptions);
31517
+ const options = isStaticList ? [
31518
+ allOption,
31519
+ ...initializeOptions(maybeOptions, getOptionValue, getOptionLabel, void 0, autoSort ?? true)
31520
+ ] : maybeOptions;
31515
31521
  return /* @__PURE__ */ jsx241(
31516
31522
  MenuSelectField,
31517
31523
  {
31518
31524
  ...props,
31525
+ autoSort: isStaticList ? false : autoSort,
31519
31526
  options,
31520
31527
  getOptionValue: (option) => option === allOption ? void 0 : getOptionValue(option),
31521
31528
  getOptionLabel: (option) => option === allOption ? unsetText : getOptionLabel(option),