@raiadrogasil/pulso-react-components
Advanced tools
Comparing version 2.29.0 to 2.29.1
import { InputSelectProps } from "./types"; | ||
declare const InputSelect: ({ label, id, name, disabled, error, onChange, onBlur, autofocus, required, dataQA, dataTestId, dataTestIdOptionMenu, fullWidth, options, messageHelperText, iconHelperText, width, }: InputSelectProps) => JSX.Element; | ||
declare const InputSelect: ({ label, id, name, disabled, error, onChange, onBlur, autofocus, required, dataQA, dataTestId, dataTestIdOptionMenu, fullWidth, options, messageHelperText, iconHelperText, width, defaultValue, }: InputSelectProps) => JSX.Element; | ||
export default InputSelect; |
@@ -47,3 +47,3 @@ "use strict"; | ||
var InputSelect = function (_a) { | ||
var label = _a.label, id = _a.id, name = _a.name, disabled = _a.disabled, error = _a.error, onChange = _a.onChange, onBlur = _a.onBlur, autofocus = _a.autofocus, required = _a.required, dataQA = _a.dataQA, dataTestId = _a.dataTestId, dataTestIdOptionMenu = _a.dataTestIdOptionMenu, _b = _a.fullWidth, fullWidth = _b === void 0 ? false : _b, options = _a.options, messageHelperText = _a.messageHelperText, iconHelperText = _a.iconHelperText, width = _a.width; | ||
var label = _a.label, id = _a.id, name = _a.name, disabled = _a.disabled, error = _a.error, onChange = _a.onChange, onBlur = _a.onBlur, autofocus = _a.autofocus, required = _a.required, dataQA = _a.dataQA, dataTestId = _a.dataTestId, dataTestIdOptionMenu = _a.dataTestIdOptionMenu, _b = _a.fullWidth, fullWidth = _b === void 0 ? false : _b, options = _a.options, messageHelperText = _a.messageHelperText, iconHelperText = _a.iconHelperText, width = _a.width, defaultValue = _a.defaultValue; | ||
var _c = (0, react_1.useState)(false), isOpen = _c[0], setIsOpen = _c[1]; | ||
@@ -114,2 +114,3 @@ var _d = (0, react_1.useState)({ label: "", value: "" }), inputValue = _d[0], setInputValue = _d[1]; | ||
var messageHelper = error && !messageHelperText ? "Error message" : messageHelperText; | ||
var isHelperText = !!messageHelper; | ||
(0, react_1.useEffect)(function () { | ||
@@ -126,2 +127,7 @@ setIsOpen(false); | ||
}, [inputValue === null || inputValue === void 0 ? void 0 : inputValue.label, onChange]); | ||
(0, react_1.useEffect)(function () { | ||
var initialValue = options === null || options === void 0 ? void 0 : options.find(function (option) { return option.value.toLowerCase() === (defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.toLowerCase()); }); | ||
if (initialValue) | ||
handleOptionClick(initialValue.value, initialValue.label); | ||
}, [defaultValue]); | ||
var iconColor = disabled ? "colorBackground300" : "colorBackground500"; | ||
@@ -151,4 +157,4 @@ var removeValues = function () { | ||
react_1.default.createElement(OptionMenu_1.default, { dataTestIdOptionMenu: dataTestIdOptionMenu, selectedIndex: selectedIndex, isOpen: isOpen, optionsList: optionsList, handleOptionClick: handleOptionClick, inputValue: inputValue }), | ||
react_1.default.createElement(HelperText_1.default, { fullWidth: fullWidth, disabled: disabled, messageHelperText: messageHelper, error: errorDisabled, icon: iconHelperText }))); | ||
isHelperText && (react_1.default.createElement(HelperText_1.default, { fullWidth: fullWidth, disabled: disabled, messageHelperText: messageHelper, error: errorDisabled, icon: iconHelperText })))); | ||
}; | ||
exports.default = InputSelect; |
@@ -77,2 +77,6 @@ export interface InputSelectProps { | ||
iconHelperText?: boolean; | ||
/** | ||
* Propriedade opcional tipo string. Usado para determinar o valor inicial do input do componente. | ||
*/ | ||
defaultValue?: string; | ||
} |
"use strict"; | ||
/* eslint-disable @typescript-eslint/ban-types */ | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -8,3 +8,3 @@ { | ||
}, | ||
"version": "2.29.0", | ||
"version": "2.29.1", | ||
"main": "./index.js", | ||
@@ -11,0 +11,0 @@ "keywords": [ |
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
1651263
17158