@lumx/react 4.13.0-next.0 → 4.13.0-next.2

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/index.d.ts CHANGED
@@ -4020,6 +4020,8 @@ interface RenderOptionContext {
4020
4020
  index: number;
4021
4021
  /** Resolved option id (from `getOptionId`). Should be passed as `value` to `<Combobox.Option>`. */
4022
4022
  value: any;
4023
+ /** Resolved option name (from `getOptionName`, falling back to `getOptionId`). */
4024
+ name: string;
4023
4025
  /** Whether this option is currently selected. Should be forwarded as `isSelected`. */
4024
4026
  isSelected: boolean;
4025
4027
  /** Resolved description string (from `getOptionDescription`), if any. Should be forwarded as `description`. */
package/index.js CHANGED
@@ -6622,11 +6622,14 @@ function setupCombobox(callbacks, options, onTriggerAttach) {
6622
6622
  if (!handle.isMultiSelect && !isActionCell(activeItem)) {
6623
6623
  handle.setIsOpen(false);
6624
6624
  }
6625
- } else if (!handle.isMultiSelect) {
6626
- // No active item toggle open/close.
6627
- handle.setIsOpen(!handle.isOpen);
6625
+ flag = true;
6626
+ } else if (handle.isOpen && !handle.isMultiSelect) {
6627
+ // Open with no active item (single select) => close the popup.
6628
+ handle.setIsOpen(false);
6629
+ flag = true;
6628
6630
  }
6629
- flag = true;
6631
+ // Otherwise (closed popup, or multi-select with no active item),
6632
+ // let Enter pass through so it can submit a surrounding form
6630
6633
  break;
6631
6634
  case 'ArrowDown':
6632
6635
  if (nav?.hasNavigableItems) {
@@ -16856,7 +16859,7 @@ function renderSelectOptions(props, components) {
16856
16859
  const selectedIds = selected ? new Set((Array.isArray(selected) ? selected : [selected]).map(s => getWithSelector(getOptionId, s))) : undefined;
16857
16860
  return options?.map((item, index) => {
16858
16861
  const id = getWithSelector(getOptionId || getOptionName, item);
16859
- const name = getWithSelector(getOptionName || getOptionId, item);
16862
+ const name = getWithSelector(getOptionName || getOptionId, item) || id;
16860
16863
  const description = getOptionDescription && getWithSelector(getOptionDescription, item);
16861
16864
  const isSelected = selectedIds?.has(id) ?? false;
16862
16865
 
@@ -16867,6 +16870,7 @@ function renderSelectOptions(props, components) {
16867
16870
  return renderOption(item, {
16868
16871
  index,
16869
16872
  value: id,
16873
+ name,
16870
16874
  isSelected,
16871
16875
  description
16872
16876
  });
@@ -16999,6 +17003,7 @@ SelectButton$2.className = CLASSNAME$m;
16999
17003
  * - If `renderOption` is `undefined`, returns `undefined` (no custom rendering).
17000
17004
  * - If the consumer returns a `<Combobox.Option>`, its props/children are merged with the
17001
17005
  * core-computed `value` / `isSelected` / `description` / `key`.
17006
+ * When the consumer's `<Combobox.Option>` has no children, falls back to the option `name`.
17002
17007
  * - If the consumer returns anything else, returns `null` (skips the option).
17003
17008
  *
17004
17009
  * @param renderOption Consumer-provided render function.
@@ -17010,14 +17015,15 @@ function wrapRenderOption(renderOption) {
17010
17015
  index,
17011
17016
  value: optionValue,
17012
17017
  isSelected,
17013
- description
17018
+ description,
17019
+ name
17014
17020
  }) => {
17015
17021
  const node = renderOption(option, index);
17016
17022
  if (!isComponentType(ComboboxOption)(node)) {
17017
17023
  return null;
17018
17024
  }
17019
17025
  const {
17020
- children,
17026
+ children = name,
17021
17027
  ...customProps
17022
17028
  } = node.props;
17023
17029
  return /*#__PURE__*/jsx(ComboboxOption, {