Comparing version 1.1.5 to 1.1.6
import React from 'react'; | ||
import { AutoSuggestionInputProps } from './commontypes'; | ||
declare const _default: React.NamedExoticComponent<AutoSuggestionInputProps>; | ||
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<AutoSuggestionInputProps & React.RefAttributes<HTMLInputElement>>>; | ||
export default _default; |
@@ -81,7 +81,7 @@ "use strict"; | ||
var tootltip_1 = __importDefault(require("./utilities/tootltip")); | ||
var AutoComplete = function (_a) { | ||
var AutoComplete = (0, react_1.forwardRef)(function (_a, ref) { | ||
var _b, _c, _d, _e, _f, _g; | ||
var label = _a.label, onChange = _a.onChange, _h = _a.getData, getData = _h === void 0 ? function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) { | ||
return [2 /*return*/, []]; | ||
}); }); } : _h, _j = _a.data, data = _j === void 0 ? [] : _j, errors = _a.errors, _k = _a.required, required = _k === void 0 ? false : _k, name = _a.name, _l = _a.fullWidth, fullWidth = _l === void 0 ? false : _l, placeholder = _a.placeholder, id = _a.id, _m = _a.type, type = _m === void 0 ? 'custom_select' : _m, _o = _a.selectedItems, propsSeelctedItems = _o === void 0 ? [] : _o, _p = _a.readOnly, readOnly = _p === void 0 ? false : _p, _q = _a.disabled, disabled = _q === void 0 ? false : _q, value = _a.value, _r = _a.isMultiple, isMultiple = _r === void 0 ? false : _r, _s = _a.desc, desc = _s === void 0 ? 'name' : _s, _t = _a.descId, descId = _t === void 0 ? 'id' : _t, singleSelect = _a.singleSelect, className = _a.className, _u = _a.async, async = _u === void 0 ? false : _u, paginationEnabled = _a.paginationEnabled, initialLoad = _a.initialLoad, actionLabel = _a.actionLabel, handleAction = _a.handleAction, nextBlock = _a.nextBlock, notDataMessage = _a.notDataMessage; | ||
}); }); } : _h, _j = _a.data, data = _j === void 0 ? [] : _j, errors = _a.errors, _k = _a.required, required = _k === void 0 ? false : _k, name = _a.name, _l = _a.fullWidth, fullWidth = _l === void 0 ? false : _l, placeholder = _a.placeholder, id = _a.id, _m = _a.type, type = _m === void 0 ? 'custom_select' : _m, _o = _a.selectedItems, propsSeelctedItems = _o === void 0 ? [] : _o, _p = _a.readOnly, readOnly = _p === void 0 ? false : _p, _q = _a.disabled, disabled = _q === void 0 ? false : _q, value = _a.value, _r = _a.isMultiple, isMultiple = _r === void 0 ? false : _r, _s = _a.desc, desc = _s === void 0 ? 'name' : _s, _t = _a.descId, descId = _t === void 0 ? 'id' : _t, singleSelect = _a.singleSelect, className = _a.className, _u = _a.async, async = _u === void 0 ? false : _u, paginationEnabled = _a.paginationEnabled, initialLoad = _a.initialLoad, actionLabel = _a.actionLabel, handleAction = _a.handleAction, nextBlock = _a.nextBlock, notDataMessage = _a.notDataMessage, onFocus = _a.onFocus; | ||
var dropdownRef = (0, react_1.useRef)(null); | ||
@@ -99,2 +99,3 @@ // State Hooks Section | ||
var dropRef = (0, react_1.useRef)(null); | ||
(0, react_1.useImperativeHandle)(ref, function () { return inputRef.current; }); | ||
var adjustDropdownPosition = function () { | ||
@@ -106,3 +107,2 @@ if (inputRef.current && dropRef.current) { | ||
var spaceBelow = viewportHeight - inputBoxRect.bottom; | ||
console.log(spaceAbove, spaceBelow); | ||
if (spaceAbove > spaceBelow) { | ||
@@ -281,9 +281,11 @@ setDropdownPosition('top'); | ||
" more")))))), | ||
react_1.default.createElement("input", { id: id, ref: inputRef, type: "text", value: type === 'auto_suggestion' ? inputValue : searchValue || inputValue, onChange: handleChange, | ||
react_1.default.createElement("input", { id: id, ref: inputRef, type: "text", value: type === 'auto_suggestion' | ||
? inputValue | ||
: searchValue || inputValue, onChange: handleChange, | ||
// onBlur={handleBlur} | ||
onClick: function () { return handleOnClick(); }, className: generateClassName(), placeholder: (selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.length) > 0 ? '' : placeholder !== null && placeholder !== void 0 ? placeholder : '', readOnly: readOnly || type === 'custom_select' || type == 'auto_suggestion', disabled: disabled, "data-testid": "custom-autocomplete" }), | ||
onFocus: onFocus, onClick: function () { return handleOnClick(); }, className: generateClassName(), placeholder: (selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.length) > 0 ? '' : placeholder !== null && placeholder !== void 0 ? placeholder : '', readOnly: readOnly || type === 'custom_select' || type == 'auto_suggestion', disabled: disabled, "data-testid": "custom-autocomplete" }), | ||
react_1.default.createElement("div", { className: "qbs-autocomplete-close-icon" }, | ||
(inputValue || searchValue) && !disabled && !readOnly && (react_1.default.createElement("button", { onClick: handleClear, className: "icon-button", "aria-label": "clear" }, | ||
react_1.default.createElement(icons_1.Close, null))), | ||
react_1.default.createElement("button", { disabled: disabled || readOnly, onClick: function () { return setDropOpen(!dropOpen); }, className: "icon-button", "aria-label": "toggle" }, | ||
react_1.default.createElement("button", { disabled: disabled || readOnly, type: "button", onClick: function () { return setDropOpen(!dropOpen); }, className: "icon-button", "aria-label": "toggle" }, | ||
react_1.default.createElement(icons_1.DropArrow, null))), | ||
@@ -312,4 +314,4 @@ dropOpen && (react_1.default.createElement("ul", { ref: dropRef, className: "qbs-autocomplete-suggestions ".concat(dropdownPosition) }, | ||
errors && (react_1.default.createElement("div", { className: "text-error text-error-label mt-[1px]", "data-testid": "autocomplete-error" }, errors.message)))); | ||
}; | ||
}); | ||
exports.default = react_1.default.memo(AutoComplete); | ||
//# sourceMappingURL=AutoComplete.js.map |
@@ -0,1 +1,2 @@ | ||
/// <reference types="react" /> | ||
type ValueProps = { | ||
@@ -32,3 +33,5 @@ [key: string]: string; | ||
selectedItems?: any[]; | ||
onFocus?: (e: React.FocusEvent<HTMLInputElement, Element>) => void; | ||
dopDownRef?: HTMLInputElement; | ||
} | ||
export {}; |
{ | ||
"name": "qbs-core", | ||
"version": "1.1.5", | ||
"version": "1.1.6", | ||
"description": "React Components", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -36,2 +36,4 @@ type ValueProps = { | ||
selectedItems?: any[]; | ||
onFocus?: (e: React.FocusEvent<HTMLInputElement, Element>) => void; | ||
dopDownRef?: HTMLInputElement; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
142322
55
3280