componenteshospitais 1.9.7 → 1.9.9
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/dist/cjs/index.js
CHANGED
|
@@ -1594,20 +1594,21 @@ var SelectField = function (_a) {
|
|
|
1594
1594
|
};
|
|
1595
1595
|
|
|
1596
1596
|
var Busca = function (_a) {
|
|
1597
|
-
var options = _a.options
|
|
1597
|
+
var options = _a.options; _a.value; var onChange = _a.onChange, label = _a.label, _b = _a.showIcon, showIcon = _b === void 0 ? false : _b, corLabel = _a.corLabel, corFundo = _a.corFundo;
|
|
1598
1598
|
var _c = React$2.useState(options), filteredOptions = _c[0], setFilteredOptions = _c[1];
|
|
1599
1599
|
var _d = React$2.useState(false), showOptions = _d[0], setShowOptions = _d[1];
|
|
1600
|
+
var _e = React$2.useState(''), inputValue = _e[0], setInputValue = _e[1];
|
|
1600
1601
|
var inputRef = React$2.useRef(null);
|
|
1601
1602
|
var handleInputChange = function (e) {
|
|
1602
1603
|
var inputValue = e.target.value;
|
|
1603
|
-
|
|
1604
|
+
setInputValue(inputValue);
|
|
1604
1605
|
if (inputValue === '') {
|
|
1605
1606
|
setFilteredOptions(options);
|
|
1606
1607
|
setShowOptions(true);
|
|
1607
1608
|
}
|
|
1608
1609
|
else {
|
|
1609
1610
|
var filtered = options.filter(function (option) {
|
|
1610
|
-
return option.
|
|
1611
|
+
return option.description.toLowerCase().includes(inputValue.toLowerCase());
|
|
1611
1612
|
});
|
|
1612
1613
|
setFilteredOptions(filtered);
|
|
1613
1614
|
setShowOptions(true);
|
|
@@ -1618,6 +1619,7 @@ var Busca = function (_a) {
|
|
|
1618
1619
|
setShowOptions(true);
|
|
1619
1620
|
};
|
|
1620
1621
|
var handleOptionClick = function (option) {
|
|
1622
|
+
setInputValue(option.description);
|
|
1621
1623
|
onChange(option.value);
|
|
1622
1624
|
setShowOptions(false);
|
|
1623
1625
|
};
|
|
@@ -1633,10 +1635,10 @@ var Busca = function (_a) {
|
|
|
1633
1635
|
};
|
|
1634
1636
|
}, []);
|
|
1635
1637
|
return (React$2.createElement("div", { style: { position: 'relative', width: '100%' }, ref: inputRef },
|
|
1636
|
-
label && React$2.createElement("label", { htmlFor: "codigoCbhpm" }, label),
|
|
1638
|
+
label && React$2.createElement("label", { htmlFor: "codigoCbhpm", style: { color: corLabel ? corLabel : '' } }, label),
|
|
1637
1639
|
React$2.createElement("div", { style: { position: 'relative', display: 'flex', alignItems: 'center', gap: '10px', width: '100%' } },
|
|
1638
1640
|
showIcon && React$2.createElement(FaSearch, { className: styles$5.searchIcon }),
|
|
1639
|
-
React$2.createElement("input", { type: "text", id: "codigoCbhpm", value:
|
|
1641
|
+
React$2.createElement("input", { type: "text", id: "codigoCbhpm", value: inputValue, onChange: handleInputChange, onFocus: handleFocus, placeholder: "Digite para buscar...", autoComplete: "off", className: styles$5.inputPadrao, style: { width: '100%', paddingLeft: showIcon ? '30px' : '0', backgroundColor: (corFundo ? corFundo : '') } })),
|
|
1640
1642
|
showOptions && filteredOptions.length > 0 && (React$2.createElement("ul", { style: {
|
|
1641
1643
|
position: 'absolute',
|
|
1642
1644
|
width: '100%',
|