@lumx/react 4.17.1-alpha.0 → 4.17.1-alpha.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
@@ -1890,6 +1890,19 @@ interface ComboboxInputOptions {
1890
1890
  * @default false (true when filter is 'off')
1891
1891
  */
1892
1892
  openOnFocus?: boolean;
1893
+ /**
1894
+ * Controls what happens to the input value when an option is selected.
1895
+ *
1896
+ * - `'fill'` (default) — The input is updated with the selected option value via `onChange`.
1897
+ * - `'keep'` — The input value is left unchanged; `onChange` is not called.
1898
+ * Useful when the component manages the displayed value independently (e.g. showing
1899
+ * an option display name rather than the raw option ID). The filter still resets.
1900
+ * - `'clear'` — The input is cleared (empty string) via `onChange` after selection.
1901
+ * Useful for multi-select patterns where typing starts fresh after each pick.
1902
+ *
1903
+ * @default 'fill'
1904
+ */
1905
+ selectionMode?: 'fill' | 'keep' | 'clear';
1893
1906
  }
1894
1907
 
1895
1908
  /**
package/index.js CHANGED
@@ -7404,15 +7404,14 @@ function setupComboboxInput(input, options) {
7404
7404
  let userHasTyped = false;
7405
7405
 
7406
7406
  /**
7407
- * Wraps the consumer's onSelect to perform input-mode side effects after selection:
7408
- * resets the filter and typing state.
7407
+ * Wraps the consumer's onSelect to perform input-mode side effects after selection.
7408
+ * Filter and typing state are always reset on selection — selectionMode only controls
7409
+ * whether onChange is called by the framework wrapper, not the internal filter.
7409
7410
  */
7410
7411
  const onSelect = option => {
7411
7412
  optionOnSelect?.(option);
7412
7413
  userHasTyped = false;
7413
- if (autoFilter) {
7414
- handle.setFilter('');
7415
- }
7414
+ if (autoFilter) handle.setFilter('');
7416
7415
  };
7417
7416
  handle = setupCombobox({
7418
7417
  onSelect
@@ -8159,6 +8158,7 @@ const ComboboxInput = forwardRef((props, ref) => {
8159
8158
  onSelect,
8160
8159
  filter,
8161
8160
  openOnFocus,
8161
+ selectionMode,
8162
8162
  ...otherProps
8163
8163
  } = props;
8164
8164
  const internalInputRef = useRef(null);
@@ -8176,9 +8176,14 @@ const ComboboxInput = forwardRef((props, ref) => {
8176
8176
  if (!input) return undefined;
8177
8177
  const handle = setupComboboxInput(input, {
8178
8178
  onSelect(option) {
8179
- // Update controlled value through React's normal onChange flow.
8180
- onChangeRef.current?.(option.value);
8181
8179
  onSelectRef.current?.(option);
8180
+ // Drive onChange according to selectionMode.
8181
+ if (selectionMode === 'keep') ; else if (selectionMode === 'clear') {
8182
+ onChangeRef.current?.('');
8183
+ } else {
8184
+ // 'fill' (default): echo the selected value.
8185
+ onChangeRef.current?.(option.value);
8186
+ }
8182
8187
  },
8183
8188
  onInput(value) {
8184
8189
  // Keep controlled value in sync.
@@ -8192,7 +8197,7 @@ const ComboboxInput = forwardRef((props, ref) => {
8192
8197
  handle.destroy();
8193
8198
  setHandle(null);
8194
8199
  };
8195
- }, [filter, openOnFocus, setHandle]);
8200
+ }, [filter, openOnFocus, selectionMode, setHandle]);
8196
8201
  const handleToggle = useCallback(() => {
8197
8202
  setIsOpen(!isOpen);
8198
8203
  internalInputRef.current?.focus();
@@ -18258,6 +18263,7 @@ const SelectTextField$2 = (props, {
18258
18263
  children: [/*#__PURE__*/jsx(Combobox.Input, {
18259
18264
  label: label,
18260
18265
  ...inputProps,
18266
+ selectionMode: "keep",
18261
18267
  chips: chips
18262
18268
  }), /*#__PURE__*/jsxs(Combobox.Popover, {
18263
18269
  fitToAnchorWidth: "minWidth",