hi-tm 0.9.6 → 0.9.8
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.
|
@@ -131,7 +131,6 @@ function CreatableSelect({ options = [], value, onChange, onClick, onValueChange
|
|
|
131
131
|
const [internalLoading, setInternalLoading] = (0, react_1.useState)(false);
|
|
132
132
|
const [hasSearched, setHasSearched] = (0, react_1.useState)(false);
|
|
133
133
|
const [selectedValues, setSelectedValues] = (0, react_1.useState)([]);
|
|
134
|
-
const [onFocus, setOnFocus] = (0, react_1.useState)(true);
|
|
135
134
|
const containerRef = (0, react_1.useRef)(null);
|
|
136
135
|
const inputRef = (0, react_1.useRef)(null);
|
|
137
136
|
// Sync external value (ids or option objects) with internal selectedValues state
|
|
@@ -208,11 +207,6 @@ function CreatableSelect({ options = [], value, onChange, onClick, onValueChange
|
|
|
208
207
|
document.removeEventListener("click", handler);
|
|
209
208
|
};
|
|
210
209
|
}, []);
|
|
211
|
-
(0, react_1.useEffect)(() => {
|
|
212
|
-
if (onFocus === true) {
|
|
213
|
-
setIsOpen(true);
|
|
214
|
-
}
|
|
215
|
-
}, [onFocus]);
|
|
216
210
|
const handleInputChange = (0, react_1.useCallback)(async (e) => {
|
|
217
211
|
const next = e.target.value;
|
|
218
212
|
setInputValue(next);
|
|
@@ -395,9 +389,7 @@ function CreatableSelect({ options = [], value, onChange, onClick, onValueChange
|
|
|
395
389
|
selectedValues.map((val) => (react_1.default.createElement("div", { key: deriveValue(val), className: "flex-shrink-0 flex items-center bg-gray-200 rounded-md px-2 py-1" },
|
|
396
390
|
react_1.default.createElement("span", { className: "truncate" }, deriveLabel(val)),
|
|
397
391
|
react_1.default.createElement("button", { type: "button", onClick: (e) => clearValue(e, val), className: styles.clearButton }, renderIcon(icons.clear, styles.icon))))),
|
|
398
|
-
react_1.default.createElement("input", { ref: inputRef, type: "text", className: `${styles.input} ${isDisabled ? "bg-gray-100" : ""} min-w-[80px] flex-shrink-0`, placeholder: selectedValues.length > 0 ? "" : placeholder, value: inputValue, onChange: handleInputChange, disabled: isDisabled, onClick: (e) => e.stopPropagation()
|
|
399
|
-
setOnFocus(true);
|
|
400
|
-
} }))),
|
|
392
|
+
react_1.default.createElement("input", { ref: inputRef, type: "text", className: `${styles.input} ${isDisabled ? "bg-gray-100" : ""} min-w-[80px] flex-shrink-0`, placeholder: selectedValues.length > 0 ? "" : placeholder, value: inputValue, onChange: handleInputChange, disabled: isDisabled, onClick: (e) => e.stopPropagation() }))),
|
|
401
393
|
react_1.default.createElement("div", { className: "flex-shrink-0 flex items-center gap-1 ml-2" },
|
|
402
394
|
iconSrc.hasAdd && (react_1.default.createElement("button", { type: "button", onClick: handleAddIconClick, className: styles.clearButton }, renderIcon(iconSrc.hasAdd, styles.icon))),
|
|
403
395
|
styles.separator && react_1.default.createElement("div", { className: styles.separator }),
|