@1024pix/pix-ui 55.21.2 → 55.22.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.
@@ -1,3 +1,4 @@
1
+ import { warn } from '@ember/debug';
1
2
  import { action } from '@ember/object';
2
3
  import { guidFor } from '@ember/object/internals';
3
4
  import Component from '@glimmer/component';
@@ -21,6 +22,18 @@ export default class PixMultiSelect extends Component {
21
22
  @tracked isExpanded = false;
22
23
  @tracked searchData;
23
24
 
25
+ constructor(...args) {
26
+ super(...args);
27
+
28
+ warn(
29
+ `PixMultiSelect: @strictSearch is deprecated in favour of @onSearch`,
30
+ !this.args.strictSearch,
31
+ {
32
+ id: 'pix-ui.pix-multi-select.strictSearch.deprecated',
33
+ },
34
+ );
35
+ }
36
+
24
37
  get options() {
25
38
  return [...(this.args.options || [])];
26
39
  }
@@ -139,9 +152,13 @@ export default class PixMultiSelect extends Component {
139
152
 
140
153
  @action
141
154
  updateSearch(event) {
142
- this.searchData = this.args.strictSearch
143
- ? event.target.value
144
- : removeCapitalizeAndDiacritics(event.target.value);
155
+ if (this.args.onSearch) {
156
+ this.args.onSearch(event.target.value);
157
+ } else {
158
+ this.searchData = this.args.strictSearch
159
+ ? event.target.value
160
+ : removeCapitalizeAndDiacritics(event.target.value);
161
+ }
145
162
  this.isExpanded = true;
146
163
  }
147
164
 
@@ -1,22 +1,21 @@
1
1
  import Component from '@glimmer/component';
2
2
 
3
3
  export default class PixSelectList extends Component {
4
- constructor(...args) {
5
- super(...args);
6
-
7
- const categories = [];
4
+ get categories() {
5
+ const uniqueCategories = new Set(
6
+ ...this.args.options.map((option) => option.category).filter(Boolean),
7
+ );
8
+ return Array.from(uniqueCategories.values());
9
+ }
8
10
 
9
- this.args.options.forEach((element) => {
10
- if (!categories.includes(element.category) && element.category !== undefined) {
11
- categories.push(element.category);
12
- }
13
- });
14
- this.displayCategory = categories.length > 0;
11
+ get displayCategory() {
12
+ return this.categories.length > 0;
15
13
  }
16
14
 
17
15
  get isDefaultOptionHidden() {
18
16
  return !this.args.isExpanded || this.args.hideDefaultOption;
19
17
  }
18
+
20
19
  get results() {
21
20
  const results = [];
22
21
  let options = this.args.options;
@@ -100,6 +100,10 @@ export default class PixSelect extends Component {
100
100
 
101
101
  @action
102
102
  setSearchValue(event) {
103
+ if (this.args.onSearch) {
104
+ this.args.onSearch(event.target.value);
105
+ return;
106
+ }
103
107
  this.searchValue = event.target.value.trim();
104
108
  }
105
109
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1024pix/pix-ui",
3
- "version": "55.21.2",
3
+ "version": "55.22.0",
4
4
  "description": "Pix-UI is the implementation of Pix design principles and guidelines for its products.",
5
5
  "keywords": [
6
6
  "ember-addon"