haya-select 1.0.61 → 1.0.63

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "haya-select",
3
- "version": "1.0.61",
3
+ "version": "1.0.63",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -18,7 +18,11 @@ import useEventListener from "@kaspernj/api-maker/src/use-event-listener"
18
18
  const nameForComponentWithMultiple = (component) => {
19
19
  let name = nameForComponent(component)
20
20
 
21
- if (component.props.multiple && name) name += "[]"
21
+ const currentOptions = component.getCurrentOptions()
22
+
23
+ if (component.props.multiple && name && currentOptions.length > 0) {
24
+ name += "[]"
25
+ }
22
26
 
23
27
  return name
24
28
  }
@@ -118,7 +122,7 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
118
122
  useEffect(() => {
119
123
  const currentOptionIds = this.s.currentOptions?.map((currentOption) => currentOption.value)
120
124
 
121
- if (this.props.values && anythingDifferent(currentOptionIds, this.props.values)) {
125
+ if (this.props.values && anythingDifferent(currentOptionIds, this.props.values) && typeof this.props.options == "function") {
122
126
  this.setCurrentFromGivenValues()
123
127
  }
124
128
  }, [this.props.values])
@@ -9,7 +9,7 @@ export default memo(shapeComponent(class Option extends ShapeComponent {
9
9
  }
10
10
 
11
11
  static propTypes = {
12
- currentOptionValues: PropTypes.array.isRequired,
12
+ currentOptionValues: PropTypes.array,
13
13
  disabled: PropTypes.bool.isRequired,
14
14
  icon: PropTypes.string,
15
15
  onOptionClicked: PropTypes.func.isRequired,