@1024pix/pix-ui 55.21.0 → 55.21.2

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.
@@ -21,12 +21,25 @@ export default class PixMultiSelect extends Component {
21
21
  @tracked isExpanded = false;
22
22
  @tracked searchData;
23
23
 
24
- @tracked options = [];
24
+ get options() {
25
+ return [...(this.args.options || [])];
26
+ }
27
+
28
+ get hasValues() {
29
+ return this.args.values && Array.isArray(this.args.values);
30
+ }
31
+
32
+ get displayedOptions() {
33
+ const optionsWithCheckedStatus = this.options.map((option) => ({
34
+ ...option,
35
+ checked: this.hasValues ? this.args.values.includes(option.value) : false,
36
+ }));
25
37
 
26
- constructor(...args) {
27
- super(...args);
38
+ if (this.args.isSearchable) {
39
+ return [...optionsWithCheckedStatus.sort(sortOptionsByCheckedFirst)];
40
+ }
28
41
 
29
- this.options = [...(this.args.options || [])];
42
+ return optionsWithCheckedStatus;
30
43
  }
31
44
 
32
45
  get mainInputClassName() {
@@ -57,9 +70,9 @@ export default class PixMultiSelect extends Component {
57
70
 
58
71
  get results() {
59
72
  if (this.args.isSearchable && this.searchData) {
60
- return this.options.filter(({ label }) => this._search(label));
73
+ return this.displayedOptions.filter(({ label }) => this._search(label));
61
74
  }
62
- return this.options;
75
+ return this.displayedOptions;
63
76
  }
64
77
 
65
78
  get placeholder() {
@@ -77,19 +90,6 @@ export default class PixMultiSelect extends Component {
77
90
  return placeholder;
78
91
  }
79
92
 
80
- _setDisplayedOptions(selected, shouldSort) {
81
- const options = this.options.map((option) => ({
82
- ...option,
83
- checked: selected ? selected.includes(option.value) : false,
84
- }));
85
-
86
- if (shouldSort && this.args.isSearchable) {
87
- options.sort(sortOptionsByCheckedFirst);
88
- }
89
-
90
- this.options = options;
91
- }
92
-
93
93
  _search(label) {
94
94
  if (this.args.strictSearch) {
95
95
  return label.includes(this.searchData);
@@ -124,7 +124,6 @@ export default class PixMultiSelect extends Component {
124
124
  showDropDown() {
125
125
  if (this.isExpanded) return;
126
126
  this.isExpanded = true;
127
- this._setDisplayedOptions(this.args.values, true);
128
127
  }
129
128
 
130
129
  @action
@@ -144,9 +143,6 @@ export default class PixMultiSelect extends Component {
144
143
  ? event.target.value
145
144
  : removeCapitalizeAndDiacritics(event.target.value);
146
145
  this.isExpanded = true;
147
- if (!event.target.value) {
148
- this._setDisplayedOptions(this.args.values, true);
149
- }
150
146
  }
151
147
 
152
148
  get className() {
@@ -18,7 +18,7 @@
18
18
  &__banner {
19
19
  position: sticky;
20
20
  top: 0;
21
- z-index: 3;
21
+ z-index: 900;
22
22
  grid-area: banner;
23
23
  }
24
24
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1024pix/pix-ui",
3
- "version": "55.21.0",
3
+ "version": "55.21.2",
4
4
  "description": "Pix-UI is the implementation of Pix design principles and guidelines for its products.",
5
5
  "keywords": [
6
6
  "ember-addon"
@@ -27,7 +27,8 @@
27
27
  },
28
28
  "ember-source": {
29
29
  "@glimmer/component": "^2.0.0"
30
- }
30
+ },
31
+ "glob": "^9.0.0"
31
32
  },
32
33
  "scripts": {
33
34
  "build": "./scripts/build.sh",
@@ -67,7 +68,6 @@
67
68
  "ember-cli-babel": "^8.2.0",
68
69
  "ember-cli-htmlbars": "^6.3.0",
69
70
  "ember-cli-sass": "^11.0.1",
70
- "ember-cli-update": "^2.0.1",
71
71
  "ember-click-outside": "^6.1.1",
72
72
  "ember-lifeline": "^7.0.0",
73
73
  "ember-modifier": "^4.2.0",