@arkyn/components 3.0.1-beta.83 → 3.0.1-beta.85
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/bundle.js +180 -180
- package/dist/bundle.umd.cjs +11 -11
- package/dist/components/select/index.js +5 -5
- package/package.json +1 -1
|
@@ -114,8 +114,8 @@ function Select(props) {
|
|
|
114
114
|
const iconSize = iconSizes[size];
|
|
115
115
|
const [search, setSearch] = useState("");
|
|
116
116
|
const [isFocused, setIsFocused] = useState(false);
|
|
117
|
-
const [
|
|
118
|
-
const forceSelectedOptions = value ||
|
|
117
|
+
const [selectedOption, setSelectedOption] = useState(defaultValue);
|
|
118
|
+
const forceSelectedOptions = value || selectedOption;
|
|
119
119
|
function optionHasSelected(value) {
|
|
120
120
|
return forceSelectedOptions === value;
|
|
121
121
|
}
|
|
@@ -142,12 +142,12 @@ function Select(props) {
|
|
|
142
142
|
}
|
|
143
143
|
function handleChangeValue(value) {
|
|
144
144
|
if (optionHasSelected(value)) {
|
|
145
|
-
|
|
145
|
+
setSelectedOption("");
|
|
146
146
|
if (onChange)
|
|
147
147
|
onChange("");
|
|
148
148
|
}
|
|
149
149
|
else {
|
|
150
|
-
|
|
150
|
+
setSelectedOption(value);
|
|
151
151
|
if (onChange)
|
|
152
152
|
onChange(value);
|
|
153
153
|
}
|
|
@@ -163,6 +163,6 @@ function Select(props) {
|
|
|
163
163
|
return true;
|
|
164
164
|
return false;
|
|
165
165
|
});
|
|
166
|
-
return (_jsxs(FieldWrapper, { children: [label && _jsx(FieldLabel, { showAsterisk: showAsterisk, children: label }), _jsxs(SelectContainer, { handleContainerFocus: handleContainerFocus, disabled: disabled, isError: isError, isFocused: isFocused, isLoading: isLoading, readOnly: readOnly, size: size, variant: variant, className: className, prefixExists: !!prefix, id: selectId, children: [_jsx("input", { ref: selectRef, name: name, value:
|
|
166
|
+
return (_jsxs(FieldWrapper, { children: [label && _jsx(FieldLabel, { showAsterisk: showAsterisk, children: label }), _jsxs(SelectContainer, { handleContainerFocus: handleContainerFocus, disabled: disabled, isError: isError, isFocused: isFocused, isLoading: isLoading, readOnly: readOnly, size: size, variant: variant, className: className, prefixExists: !!prefix, id: selectId, children: [_jsx("input", { ref: selectRef, name: name, value: forceSelectedOptions, type: "hidden" }), _jsx(IconRenderer, { iconSize: iconSize, icon: prefix, className: "prefix" }), LeftIcon && _jsx(LeftIcon, { size: iconSize, strokeWidth: 2.5 }), _jsxs(SelectContent, { size: size, children: [forceSelectedOptions !== "" && (_jsx("p", { children: getOptionLabel(forceSelectedOptions) })), forceSelectedOptions === "" && _jsx("p", { children: placeholder })] }), _jsxs(SelectOptionsContainer, { isFocused: isFocused, isSearchable: isSearchable, search: search, onSearch: handleSearch, children: [mappedOptions.map(({ label, value }) => (_jsx(SelectOption, { label: label, value: value, size: size, handleChangeValue: handleChangeValue, optionHasSelected: optionHasSelected }, value))), mappedOptions.length <= 0 && _jsx("p", { children: notFoundText })] }), _jsx(SelectChevron, { disabled: disabled, isFocused: isFocused, readOnly: readOnly, iconSize: iconSize, isLoading: isLoading }), _jsx(SelectSpinner, { iconSize: iconSize, isLoading: isLoading }), _jsx(SelectOverlay, { handleBlur: handleBlur, isFocused: isFocused })] }), errorMessage && _jsx(FieldError, { children: errorMessage })] }));
|
|
167
167
|
}
|
|
168
168
|
export { Select };
|