Body, Mind & Soul — API Reference
    Preparing search index...

    Function attachComboboxPicker

    • Generic combobox controller used by the action attribute pickers.

      Expected markup inside the picker wrapper (selectors configurable via inputSelector/dropdownSelector): <input class="resource-picker-input" ... />

        ...

      The wrapper element's data-selected-key is set to the chosen value. Callers (e.g. _onAddCost) read this attribute instead of relying on a <select>.

      This is the canonical shared combobox factory for BMS — both the flat variant (e.g. the rune-cost picker) and the grouped variant (e.g. the modification-field pickers, keyed off an entry's optional group field) are built from this single implementation. See .claude/workflows/combobox-pattern.md for usage guidance.

      Parameters

      • picker: HTMLElement

        The combobox wrapper element.

      • opts: {
            createLabel?: string;
            displayValue?: (
                entry: { group?: string; key: string; label: string },
            ) => string;
            dropdownSelector?: string;
            entries: () => { group?: string; key: string; label: string }[];
            filterFn?: (
                entry: { group?: string; key: string; label: string },
                lowercasedQuery: string,
            ) => boolean;
            hiddenInputName?: string;
            hideOnEmpty?: boolean;
            inputSelector?: string;
            onCreate?: (filter: string) => Promise<{ key: any; label: any } | null>;
            onSelect?: (entry: { group?: string; key: string; label: string }) => void;
            placeholder?: string | (() => string);
        } = {}
        • OptionalcreateLabel?: string

          When set, appends a "+ Create…" footer entry.

        • OptionaldisplayValue?: (entry: { group?: string; key: string; label: string }) => string

          Optional formatter for what gets written into input.value on selection. Defaults to entry.label.

        • OptionaldropdownSelector?: string

          Override for the dropdown <ul> selector.

        • entries: () => { group?: string; key: string; label: string }[]

          Live option source. An entry's optional group field renders a non-interactive group-header <li> whenever the group changes between consecutive (post-filter) entries.

        • OptionalfilterFn?: (
              entry: { group?: string; key: string; label: string },
              lowercasedQuery: string,
          ) => boolean

          Optional override for the filter predicate. Default matches entry.label (case-insensitive) only.

        • OptionalhiddenInputName?: string

          Name of a sibling hidden input to keep in sync with the selected key.

        • OptionalhideOnEmpty?: boolean

          When true, hide the popover if the filtered entry list is empty (and no create footer is configured).

        • OptionalinputSelector?: string

          Override for the text-input selector.

        • OptionalonCreate?: (filter: string) => Promise<{ key: any; label: any } | null>

          Invoked when Create is clicked.

        • OptionalonSelect?: (entry: { group?: string; key: string; label: string }) => void

          Optional callback invoked with the full selected entry (in addition to the built-in picker.dataset.selectedKey/hidden-input sync), so callers can run their own document-update or filter-select side effects.

        • Optionalplaceholder?: string | (() => string)

          Optional placeholder text (or a callback returning it), set on attach.

      Returns void