@visns-studio/visns-components 4.2.5 → 4.2.6

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.
@@ -17,15 +17,38 @@ const Select = (props) => {
17
17
  ? settings.placeholder
18
18
  : 'Please select an option'}
19
19
  </option>
20
- {options.map((item, index) => (
21
- <option
22
- key={settings.id + '-' + item.id}
23
- value={item.id}
24
- {...dataOptions[index]}
25
- >
26
- {item.label}
27
- </option>
28
- ))}
20
+ {options.map((item, index) =>
21
+ item.options ? ( // Check if the item contains nested options (indicating an optgroup)
22
+ <optgroup
23
+ key={settings.id + '-' + item.id}
24
+ label={item.label}
25
+ >
26
+ {item.options.map((subItem, subIndex) => (
27
+ <option
28
+ key={
29
+ settings.id +
30
+ '-' +
31
+ item.id +
32
+ '-' +
33
+ subItem.id
34
+ }
35
+ value={subItem.id}
36
+ {...dataOptions[subIndex]}
37
+ >
38
+ {subItem.label}
39
+ </option>
40
+ ))}
41
+ </optgroup>
42
+ ) : (
43
+ <option
44
+ key={settings.id + '-' + item.id}
45
+ value={item.id}
46
+ {...dataOptions[index]}
47
+ >
48
+ {item.label}
49
+ </option>
50
+ )
51
+ )}
29
52
  </select>
30
53
  );
31
54
  };
package/package.json CHANGED
@@ -57,7 +57,7 @@
57
57
  "react-dom": "^17.0.1"
58
58
  },
59
59
  "name": "@visns-studio/visns-components",
60
- "version": "4.2.5",
60
+ "version": "4.2.6",
61
61
  "description": "Various packages to assist in the development of our Custom Applications.",
62
62
  "main": "index.js",
63
63
  "scripts": {