@remvst/configurable-react 1.2.3 → 1.3.0

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.
@@ -39,8 +39,11 @@ class EnumConfigurableComponent extends react_1.default.Component {
39
39
  valueKey = key;
40
40
  }
41
41
  }
42
- return (react_1.default.createElement("select", { value: valueKey, onChange: (e) => this.onChange(e) }, Array.from(configurable.categories).map((category) => {
43
- return (react_1.default.createElement("optgroup", { label: category.label || '', key: category.label }, category.items.map((item) => {
42
+ const categories = Array.from(configurable.categories)
43
+ .sort((a, b) => (a.label || '') < (b.label || '') ? -1 : 1);
44
+ return (react_1.default.createElement("select", { value: valueKey, onChange: (e) => this.onChange(e) }, categories.map((category) => {
45
+ const items = category.items.sort((a, b) => a.key < b.key ? -1 : 1);
46
+ return (react_1.default.createElement("optgroup", { label: category.label || '', key: category.label }, items.map((item) => {
44
47
  return (react_1.default.createElement("option", { key: item.key, value: item.key }, item.key));
45
48
  })));
46
49
  })));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remvst/configurable-react",
3
- "version": "1.2.3",
3
+ "version": "1.3.0",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "exports": {
@@ -13,7 +13,7 @@
13
13
  "author": "",
14
14
  "license": "ISC",
15
15
  "dependencies": {
16
- "@remvst/configurable": "^1.3.0",
16
+ "@remvst/configurable": "^1.4.0",
17
17
  "react": "^18.2.0",
18
18
  "react-dom": "^18.2.0",
19
19
  "@types/react-dom": "^18.0.6",
@@ -49,11 +49,16 @@ export default class EnumConfigurableComponent extends React.Component<Component
49
49
  }
50
50
  }
51
51
 
52
+ const categories = Array.from(configurable.categories)
53
+ .sort((a, b) => (a.label || '') < (b.label || '') ? -1 : 1)
54
+
52
55
  return (
53
56
  <select value={valueKey} onChange={(e) => this.onChange(e)}>
54
- {Array.from(configurable.categories).map((category) => {
57
+ {categories.map((category) => {
58
+ const items = category.items.sort((a, b) => a.key < b.key ? -1 : 1);
59
+
55
60
  return (<optgroup label={category.label || ''} key={category.label}>
56
- {category.items.map((item) => {
61
+ {items.map((item) => {
57
62
  return (
58
63
  <option key={item.key} value={item.key}>{item.key}</option>
59
64
  );