@trackunit/react-form-components 1.7.24 → 1.7.26
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.cjs.js +17 -2
- package/index.esm.js +17 -2
- package/package.json +8 -8
package/index.cjs.js
CHANGED
|
@@ -2551,6 +2551,19 @@ const ReactSyncSelect = ReactSelect.default || ReactSelect;
|
|
|
2551
2551
|
const Select = (props) => {
|
|
2552
2552
|
const { id, dataTestId = "select", prefix, async, maxMenuHeight = 200, label, hasError, disabled, isMulti, menuPosition = "absolute", value, options, onChange, isLoading, classNamePrefix = "select", onMenuScrollToBottom, onInputChange, isSearchable, isClearable = false, readOnly, fieldSize = "medium", openMenuOnClick = !disabled, openMenuOnFocus = false, hideSelectedOptions = false, } = props;
|
|
2553
2553
|
const { refContainer, customStyles, menuIsOpen, customComponents, menuPlacement, openMenuHandler, closeMenuHandler } = useSelect(props);
|
|
2554
|
+
// Control the search input value so it doesn’t reset after selection
|
|
2555
|
+
const [inputValue, setInputValue] = react.useState("");
|
|
2556
|
+
const handleInputChange = react.useCallback((nextValue, meta) => {
|
|
2557
|
+
// Ignore internal actions that clear the input to preserve the typed text
|
|
2558
|
+
// and avoid resetting the parent’s search state
|
|
2559
|
+
const ignoreActions = new Set(["set-value", "input-blur", "menu-close"]);
|
|
2560
|
+
if (ignoreActions.has(meta.action)) {
|
|
2561
|
+
return inputValue;
|
|
2562
|
+
}
|
|
2563
|
+
setInputValue(nextValue);
|
|
2564
|
+
onInputChange?.(nextValue, meta);
|
|
2565
|
+
return nextValue;
|
|
2566
|
+
}, [inputValue, onInputChange]);
|
|
2554
2567
|
const reactSelectProps = react.useMemo(() => ({
|
|
2555
2568
|
value,
|
|
2556
2569
|
menuPlacement,
|
|
@@ -2579,7 +2592,8 @@ const Select = (props) => {
|
|
|
2579
2592
|
isClearable,
|
|
2580
2593
|
id,
|
|
2581
2594
|
onMenuScrollToBottom,
|
|
2582
|
-
onInputChange,
|
|
2595
|
+
onInputChange: handleInputChange,
|
|
2596
|
+
inputValue,
|
|
2583
2597
|
hideSelectedOptions,
|
|
2584
2598
|
isDisabled: Boolean(disabled),
|
|
2585
2599
|
}), [
|
|
@@ -2588,8 +2602,10 @@ const Select = (props) => {
|
|
|
2588
2602
|
customStyles,
|
|
2589
2603
|
dataTestId,
|
|
2590
2604
|
disabled,
|
|
2605
|
+
handleInputChange,
|
|
2591
2606
|
hideSelectedOptions,
|
|
2592
2607
|
id,
|
|
2608
|
+
inputValue,
|
|
2593
2609
|
isClearable,
|
|
2594
2610
|
isLoading,
|
|
2595
2611
|
isMulti,
|
|
@@ -2599,7 +2615,6 @@ const Select = (props) => {
|
|
|
2599
2615
|
menuIsOpen,
|
|
2600
2616
|
menuPlacement,
|
|
2601
2617
|
onChange,
|
|
2602
|
-
onInputChange,
|
|
2603
2618
|
onMenuScrollToBottom,
|
|
2604
2619
|
openMenuOnClick,
|
|
2605
2620
|
openMenuOnFocus,
|
package/index.esm.js
CHANGED
|
@@ -2550,6 +2550,19 @@ const ReactSyncSelect = ReactSelect.default || ReactSelect;
|
|
|
2550
2550
|
const Select = (props) => {
|
|
2551
2551
|
const { id, dataTestId = "select", prefix, async, maxMenuHeight = 200, label, hasError, disabled, isMulti, menuPosition = "absolute", value, options, onChange, isLoading, classNamePrefix = "select", onMenuScrollToBottom, onInputChange, isSearchable, isClearable = false, readOnly, fieldSize = "medium", openMenuOnClick = !disabled, openMenuOnFocus = false, hideSelectedOptions = false, } = props;
|
|
2552
2552
|
const { refContainer, customStyles, menuIsOpen, customComponents, menuPlacement, openMenuHandler, closeMenuHandler } = useSelect(props);
|
|
2553
|
+
// Control the search input value so it doesn’t reset after selection
|
|
2554
|
+
const [inputValue, setInputValue] = useState("");
|
|
2555
|
+
const handleInputChange = useCallback((nextValue, meta) => {
|
|
2556
|
+
// Ignore internal actions that clear the input to preserve the typed text
|
|
2557
|
+
// and avoid resetting the parent’s search state
|
|
2558
|
+
const ignoreActions = new Set(["set-value", "input-blur", "menu-close"]);
|
|
2559
|
+
if (ignoreActions.has(meta.action)) {
|
|
2560
|
+
return inputValue;
|
|
2561
|
+
}
|
|
2562
|
+
setInputValue(nextValue);
|
|
2563
|
+
onInputChange?.(nextValue, meta);
|
|
2564
|
+
return nextValue;
|
|
2565
|
+
}, [inputValue, onInputChange]);
|
|
2553
2566
|
const reactSelectProps = useMemo(() => ({
|
|
2554
2567
|
value,
|
|
2555
2568
|
menuPlacement,
|
|
@@ -2578,7 +2591,8 @@ const Select = (props) => {
|
|
|
2578
2591
|
isClearable,
|
|
2579
2592
|
id,
|
|
2580
2593
|
onMenuScrollToBottom,
|
|
2581
|
-
onInputChange,
|
|
2594
|
+
onInputChange: handleInputChange,
|
|
2595
|
+
inputValue,
|
|
2582
2596
|
hideSelectedOptions,
|
|
2583
2597
|
isDisabled: Boolean(disabled),
|
|
2584
2598
|
}), [
|
|
@@ -2587,8 +2601,10 @@ const Select = (props) => {
|
|
|
2587
2601
|
customStyles,
|
|
2588
2602
|
dataTestId,
|
|
2589
2603
|
disabled,
|
|
2604
|
+
handleInputChange,
|
|
2590
2605
|
hideSelectedOptions,
|
|
2591
2606
|
id,
|
|
2607
|
+
inputValue,
|
|
2592
2608
|
isClearable,
|
|
2593
2609
|
isLoading,
|
|
2594
2610
|
isMulti,
|
|
@@ -2598,7 +2614,6 @@ const Select = (props) => {
|
|
|
2598
2614
|
menuIsOpen,
|
|
2599
2615
|
menuPlacement,
|
|
2600
2616
|
onChange,
|
|
2601
|
-
onInputChange,
|
|
2602
2617
|
onMenuScrollToBottom,
|
|
2603
2618
|
openMenuOnClick,
|
|
2604
2619
|
openMenuOnFocus,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-form-components",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.26",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -16,14 +16,14 @@
|
|
|
16
16
|
"zod": "^3.23.8",
|
|
17
17
|
"react-hook-form": "7.62.0",
|
|
18
18
|
"tailwind-merge": "^2.0.0",
|
|
19
|
-
"@trackunit/css-class-variance-utilities": "1.6.
|
|
20
|
-
"@trackunit/react-components": "1.8.
|
|
21
|
-
"@trackunit/ui-icons": "1.6.
|
|
22
|
-
"@trackunit/shared-utils": "1.8.
|
|
23
|
-
"@trackunit/ui-design-tokens": "1.6.
|
|
24
|
-
"@trackunit/i18n-library-translation": "1.6.
|
|
19
|
+
"@trackunit/css-class-variance-utilities": "1.6.39",
|
|
20
|
+
"@trackunit/react-components": "1.8.11",
|
|
21
|
+
"@trackunit/ui-icons": "1.6.38",
|
|
22
|
+
"@trackunit/shared-utils": "1.8.39",
|
|
23
|
+
"@trackunit/ui-design-tokens": "1.6.41",
|
|
24
|
+
"@trackunit/i18n-library-translation": "1.6.43",
|
|
25
25
|
"string-ts": "^2.0.0",
|
|
26
|
-
"@trackunit/react-test-setup": "1.3.
|
|
26
|
+
"@trackunit/react-test-setup": "1.3.39",
|
|
27
27
|
"@js-temporal/polyfill": "^0.5.1"
|
|
28
28
|
},
|
|
29
29
|
"module": "./index.esm.js",
|