@lumx/react 4.16.0-alpha.2 → 4.16.0-alpha.4
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.js +7 -7
- package/index.js.map +1 -1
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -7287,9 +7287,10 @@ const ComboboxButton = Object.assign(forwardRefPolymorphic((props, ref) => {
|
|
|
7287
7287
|
|
|
7288
7288
|
// If `as` is provided, use it directly; otherwise use the LumX Button (full theme/disabled behavior).
|
|
7289
7289
|
const ButtonComp = as ?? Button;
|
|
7290
|
-
|
|
7291
|
-
//
|
|
7292
|
-
const
|
|
7290
|
+
|
|
7291
|
+
// Track the button DOM element via state (instead of useRef) so it re-triggers the useEffect
|
|
7292
|
+
const [buttonElement, setButtonElement] = useState(null);
|
|
7293
|
+
const mergedRef = useMergeRefs(ref, setButtonElement, anchorRef);
|
|
7293
7294
|
|
|
7294
7295
|
// Keep onSelect in a ref to avoid re-creating the handle on every render
|
|
7295
7296
|
const onSelectRef = useRef(onSelect);
|
|
@@ -7297,9 +7298,8 @@ const ComboboxButton = Object.assign(forwardRefPolymorphic((props, ref) => {
|
|
|
7297
7298
|
|
|
7298
7299
|
// Create the combobox handle with button-mode controller on mount
|
|
7299
7300
|
useEffect(() => {
|
|
7300
|
-
|
|
7301
|
-
|
|
7302
|
-
const handle = setupComboboxButton(button, {
|
|
7301
|
+
if (!buttonElement) return undefined;
|
|
7302
|
+
const handle = setupComboboxButton(buttonElement, {
|
|
7303
7303
|
onSelect(option) {
|
|
7304
7304
|
onSelectRef.current?.(option);
|
|
7305
7305
|
}
|
|
@@ -7309,7 +7309,7 @@ const ComboboxButton = Object.assign(forwardRefPolymorphic((props, ref) => {
|
|
|
7309
7309
|
handle.destroy();
|
|
7310
7310
|
setHandle(null);
|
|
7311
7311
|
};
|
|
7312
|
-
}, [setHandle]);
|
|
7312
|
+
}, [buttonElement, setHandle]);
|
|
7313
7313
|
return ComboboxButton$1({
|
|
7314
7314
|
...buttonProps,
|
|
7315
7315
|
label,
|