oa-componentbook 1.0.1-stage.418 → 1.0.1-stage.419

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.
@@ -196,6 +196,11 @@ function CustomSelect(_ref) {
196
196
  array.push(element);
197
197
  }
198
198
  };
199
+ const safeUnshift = (array, element) => {
200
+ if (!array.includes(element)) {
201
+ array.unshift(element);
202
+ }
203
+ };
199
204
 
200
205
  /**
201
206
  * Given an array of options, add all non-disabled options to the newlySelectedOptions array.
@@ -287,9 +292,9 @@ function CustomSelect(_ref) {
287
292
  newlySelectedOptions.splice((_newlySelectedOptions2 = newlySelectedOptions.indexOf) === null || _newlySelectedOptions2 === void 0 ? void 0 : _newlySelectedOptions2.call(newlySelectedOptions, value), 1);
288
293
  }
289
294
 
290
- // If fixedValue has values, push them to newlySelectedOptions
295
+ // If fixedValue has values, push them to the beginning of newlySelectedOptions
291
296
  if ((fixedValue === null || fixedValue === void 0 ? void 0 : fixedValue.length) > 0) {
292
- fixedValue.forEach(val => safePush(newlySelectedOptions, val));
297
+ fixedValue.forEach(val => safeUnshift(newlySelectedOptions, val));
293
298
  }
294
299
  const optionsWithoutAllText = newlySelectedOptions.filter(option => option !== allText);
295
300
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oa-componentbook",
3
- "version": "1.0.1-stage.418",
3
+ "version": "1.0.1-stage.419",
4
4
  "private": false,
5
5
  "description": "Reusable components",
6
6
  "main": "build/index.js",