@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.
@@ -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 [selectedOptions, setSelectedOptions] = useState(defaultValue);
118
- const forceSelectedOptions = value || selectedOptions;
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
- setSelectedOptions("");
145
+ setSelectedOption("");
146
146
  if (onChange)
147
147
  onChange("");
148
148
  }
149
149
  else {
150
- setSelectedOptions(value);
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: JSON.stringify(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 })] }));
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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkyn/components",
3
- "version": "3.0.1-beta.83",
3
+ "version": "3.0.1-beta.85",
4
4
  "main": "./dist/bundle.js",
5
5
  "module": "./dist/bundle.js",
6
6
  "types": "./dist/index.d.ts",