@lumx/react 4.18.0-next.2 → 4.18.0-next.3
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 +18 -5
- package/index.js +23 -13
- package/index.js.map +1 -1
- package/package.json +3 -3
package/index.d.ts
CHANGED
|
@@ -815,7 +815,7 @@ interface ButtonProps extends GenericProps$1, ReactToJSX<ButtonProps$1> {
|
|
|
815
815
|
* @param ref Component ref.
|
|
816
816
|
* @return React element.
|
|
817
817
|
*/
|
|
818
|
-
declare const Button: Comp<ButtonProps,
|
|
818
|
+
declare const Button: Comp<ButtonProps, HTMLAnchorElement | HTMLButtonElement>;
|
|
819
819
|
|
|
820
820
|
interface IconButtonProps$1 extends BaseButtonProps {
|
|
821
821
|
/**
|
|
@@ -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
|
/**
|
|
@@ -2197,7 +2210,7 @@ declare const Combobox: {
|
|
|
2197
2210
|
/** Provides shared combobox context (handle, listbox ID, anchor ref) to all sub-components. */
|
|
2198
2211
|
Provider: typeof ComboboxProvider;
|
|
2199
2212
|
/** Button trigger for select-only combobox mode with keyboard navigation and typeahead. */
|
|
2200
|
-
Button: (<E extends React$1.ElementType = Comp<ButtonProps,
|
|
2213
|
+
Button: (<E extends React$1.ElementType = Comp<ButtonProps, HTMLAnchorElement | HTMLButtonElement>>(props: Omit<HasPolymorphicAs$1<E>, "children" | "role" | "aria-activedescendant" | "aria-controls" | "aria-expanded" | "aria-haspopup"> & _lumx_core_js_types.HasRequiredLinkHref<E> & ReactToJSX<ComboboxButtonProps$1> & React$1.ComponentProps<E> & {
|
|
2201
2214
|
ref?: ComponentRef<E> | undefined;
|
|
2202
2215
|
}) => React.JSX.Element) & {
|
|
2203
2216
|
displayName: string;
|
|
@@ -2723,7 +2736,7 @@ declare const GenericBlockGapSize: Pick<{
|
|
|
2723
2736
|
readonly medium: "medium";
|
|
2724
2737
|
readonly big: "big";
|
|
2725
2738
|
readonly huge: "huge";
|
|
2726
|
-
}, "big" | "
|
|
2739
|
+
}, "big" | "tiny" | "medium" | "regular" | "huge">;
|
|
2727
2740
|
type GenericBlockGapSize = ValueOf<typeof GenericBlockGapSize>;
|
|
2728
2741
|
|
|
2729
2742
|
interface GenericBlockProps$1 extends FlexBoxProps$1 {
|
|
@@ -2953,7 +2966,7 @@ interface GridColumnProps extends GenericProps$1, ReactToJSX<GridColumnProps$1>
|
|
|
2953
2966
|
*/
|
|
2954
2967
|
declare const GridColumn: Comp<GridColumnProps, HTMLElement>;
|
|
2955
2968
|
|
|
2956
|
-
declare const ICON_SIZES: ("
|
|
2969
|
+
declare const ICON_SIZES: ("s" | "m" | "xxs" | "xs" | "l" | "xl" | "xxl")[];
|
|
2957
2970
|
|
|
2958
2971
|
type IconSizes = (typeof ICON_SIZES)[number];
|
|
2959
2972
|
/**
|
|
@@ -3454,7 +3467,7 @@ interface LinkProps extends GenericProps$1, ReactToJSX<LinkProps$1> {
|
|
|
3454
3467
|
* @param ref Component ref.
|
|
3455
3468
|
* @return React element.
|
|
3456
3469
|
*/
|
|
3457
|
-
declare const Link: Comp<LinkProps,
|
|
3470
|
+
declare const Link: Comp<LinkProps, HTMLAnchorElement | HTMLButtonElement>;
|
|
3458
3471
|
|
|
3459
3472
|
/**
|
|
3460
3473
|
* Defines the props of the component.
|
package/index.js
CHANGED
|
@@ -7387,8 +7387,10 @@ function setupComboboxInput(input, options) {
|
|
|
7387
7387
|
let handle;
|
|
7388
7388
|
const {
|
|
7389
7389
|
filter = 'auto',
|
|
7390
|
+
selectionMode = 'fill',
|
|
7390
7391
|
onSelect: optionOnSelect,
|
|
7391
|
-
onInput: onInputCallback
|
|
7392
|
+
onInput: onInputCallback,
|
|
7393
|
+
onChange: onChangeCallback
|
|
7392
7394
|
} = options;
|
|
7393
7395
|
const openOnFocus = options.openOnFocus ?? filter === 'off';
|
|
7394
7396
|
const autoFilter = filter === 'auto';
|
|
@@ -7404,15 +7406,20 @@ function setupComboboxInput(input, options) {
|
|
|
7404
7406
|
let userHasTyped = false;
|
|
7405
7407
|
|
|
7406
7408
|
/**
|
|
7407
|
-
* Wraps the consumer's onSelect to perform input-mode side effects after selection
|
|
7408
|
-
*
|
|
7409
|
+
* Wraps the consumer's onSelect to perform input-mode side effects after selection,
|
|
7410
|
+
* and drive `onChange` according to `selectionMode`.
|
|
7411
|
+
* Filter and typing state are always reset on selection.
|
|
7409
7412
|
*/
|
|
7410
7413
|
const onSelect = option => {
|
|
7411
7414
|
optionOnSelect?.(option);
|
|
7412
7415
|
userHasTyped = false;
|
|
7413
|
-
if (autoFilter)
|
|
7414
|
-
|
|
7416
|
+
if (autoFilter) handle.setFilter('');
|
|
7417
|
+
if (selectionMode === 'fill') {
|
|
7418
|
+
onChangeCallback?.(option.value);
|
|
7419
|
+
} else if (selectionMode === 'clear') {
|
|
7420
|
+
onChangeCallback?.('');
|
|
7415
7421
|
}
|
|
7422
|
+
// 'keep': onChange is not called — input value stays as-is.
|
|
7416
7423
|
};
|
|
7417
7424
|
handle = setupCombobox({
|
|
7418
7425
|
onSelect
|
|
@@ -8149,18 +8156,19 @@ const ComboboxInput = forwardRef((props, ref) => {
|
|
|
8149
8156
|
setHandle
|
|
8150
8157
|
} = useComboboxContext();
|
|
8151
8158
|
const [isOpen, setIsOpen] = useComboboxOpen();
|
|
8152
|
-
const state = useComboboxEvent('optionsChange', {
|
|
8153
|
-
optionsLength: 0
|
|
8154
|
-
});
|
|
8155
|
-
const isLoading = useComboboxEvent('loadingChange', false);
|
|
8156
8159
|
const {
|
|
8157
8160
|
inputRef: externalInputRef,
|
|
8158
8161
|
toggleButtonProps,
|
|
8159
8162
|
onSelect,
|
|
8160
8163
|
filter,
|
|
8161
8164
|
openOnFocus,
|
|
8165
|
+
selectionMode,
|
|
8162
8166
|
...otherProps
|
|
8163
8167
|
} = props;
|
|
8168
|
+
const state = useComboboxEvent('optionsChange', {
|
|
8169
|
+
optionsLength: 0
|
|
8170
|
+
});
|
|
8171
|
+
const isLoading = useComboboxEvent('loadingChange', false);
|
|
8164
8172
|
const internalInputRef = useRef(null);
|
|
8165
8173
|
const mergedInputRef = useMergeRefs(externalInputRef, internalInputRef);
|
|
8166
8174
|
|
|
@@ -8176,14 +8184,15 @@ const ComboboxInput = forwardRef((props, ref) => {
|
|
|
8176
8184
|
if (!input) return undefined;
|
|
8177
8185
|
const handle = setupComboboxInput(input, {
|
|
8178
8186
|
onSelect(option) {
|
|
8179
|
-
// Update controlled value through React's normal onChange flow.
|
|
8180
|
-
onChangeRef.current?.(option.value);
|
|
8181
8187
|
onSelectRef.current?.(option);
|
|
8182
8188
|
},
|
|
8189
|
+
onChange(value) {
|
|
8190
|
+
onChangeRef.current?.(value);
|
|
8191
|
+
},
|
|
8183
8192
|
onInput(value) {
|
|
8184
|
-
// Keep controlled value in sync.
|
|
8185
8193
|
onChangeRef.current?.(value);
|
|
8186
8194
|
},
|
|
8195
|
+
selectionMode,
|
|
8187
8196
|
filter,
|
|
8188
8197
|
openOnFocus
|
|
8189
8198
|
});
|
|
@@ -8192,7 +8201,7 @@ const ComboboxInput = forwardRef((props, ref) => {
|
|
|
8192
8201
|
handle.destroy();
|
|
8193
8202
|
setHandle(null);
|
|
8194
8203
|
};
|
|
8195
|
-
}, [filter, openOnFocus, setHandle]);
|
|
8204
|
+
}, [filter, openOnFocus, selectionMode, setHandle]);
|
|
8196
8205
|
const handleToggle = useCallback(() => {
|
|
8197
8206
|
setIsOpen(!isOpen);
|
|
8198
8207
|
internalInputRef.current?.focus();
|
|
@@ -18258,6 +18267,7 @@ const SelectTextField$2 = (props, {
|
|
|
18258
18267
|
children: [/*#__PURE__*/jsx(Combobox.Input, {
|
|
18259
18268
|
label: label,
|
|
18260
18269
|
...inputProps,
|
|
18270
|
+
selectionMode: "keep",
|
|
18261
18271
|
chips: chips
|
|
18262
18272
|
}), /*#__PURE__*/jsxs(Combobox.Popover, {
|
|
18263
18273
|
fitToAnchorWidth: "minWidth",
|