@1024pix/pix-ui 20.2.3 → 21.0.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.
Files changed (53) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/addon/components/pix-dropdown.hbs +3 -4
  3. package/addon/components/pix-filterable-and-searchable-select.hbs +45 -0
  4. package/addon/components/pix-filterable-and-searchable-select.js +48 -0
  5. package/addon/components/pix-multi-select.hbs +19 -23
  6. package/addon/components/pix-multi-select.js +26 -44
  7. package/addon/components/pix-pagination.hbs +2 -1
  8. package/addon/components/pix-select.hbs +133 -44
  9. package/addon/components/pix-select.js +134 -31
  10. package/addon/components/pix-stars.hbs +1 -1
  11. package/addon/styles/_form.scss +16 -3
  12. package/addon/styles/_pix-filterable-and-searchable-select.scss +57 -0
  13. package/addon/styles/_pix-multi-select.scss +15 -14
  14. package/addon/styles/_pix-select.scss +152 -45
  15. package/addon/styles/addon.scss +3 -0
  16. package/app/components/pix-filterable-and-searchable-select.js +1 -0
  17. package/app/modifiers/on-arrow-down-up-action.js +3 -3
  18. package/app/modifiers/on-enter-action.js +2 -2
  19. package/app/modifiers/on-space-action.js +20 -0
  20. package/app/stories/form.stories.js +86 -80
  21. package/app/stories/pix-background-header.stories.js +17 -9
  22. package/app/stories/pix-banner.stories.js +9 -10
  23. package/app/stories/pix-block.stories.js +3 -5
  24. package/app/stories/pix-button-link.stories.js +23 -27
  25. package/app/stories/pix-button-upload.stories.js +10 -12
  26. package/app/stories/pix-button.stories.js +30 -31
  27. package/app/stories/pix-checkbox.stories.js +9 -10
  28. package/app/stories/pix-collapsible.stories.js +22 -37
  29. package/app/stories/pix-dropdown.stories.js +17 -19
  30. package/app/stories/pix-filter-banner.stories.js +11 -8
  31. package/app/stories/pix-filterable-and-searchable-select.stories.js +212 -0
  32. package/app/stories/pix-filterable-and-searchable-select.stories.mdx +71 -0
  33. package/app/stories/pix-icon-button.stories.js +10 -12
  34. package/app/stories/pix-input-code.stories.js +7 -9
  35. package/app/stories/pix-input-password.stories.js +9 -11
  36. package/app/stories/pix-input.stories.js +9 -11
  37. package/app/stories/pix-message.stories.js +7 -8
  38. package/app/stories/pix-modal.stories.js +27 -20
  39. package/app/stories/pix-multi-select.stories.js +105 -81
  40. package/app/stories/pix-multi-select.stories.mdx +14 -9
  41. package/app/stories/pix-pagination.stories.js +6 -8
  42. package/app/stories/pix-progress-gauge.stories.js +16 -20
  43. package/app/stories/pix-radio-button.stories.js +2 -14
  44. package/app/stories/pix-return-to.stories.js +4 -8
  45. package/app/stories/pix-select.stories.js +235 -74
  46. package/app/stories/pix-select.stories.mdx +46 -20
  47. package/app/stories/pix-selectable-tag.stories.js +7 -38
  48. package/app/stories/pix-sidebar.stories.js +26 -19
  49. package/app/stories/pix-stars.stories.js +1 -8
  50. package/app/stories/pix-tag.stories.js +6 -10
  51. package/app/stories/pix-textarea.stories.js +7 -9
  52. package/app/stories/pix-tooltip.stories.js +41 -49
  53. package/package.json +43 -44
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # Pix-UI Changelog
2
2
 
3
+ ## v21.0.0 (05/12/2022)
4
+
5
+
6
+ ### :rocket: Amélioration
7
+ - [#289](https://github.com/1024pix/pix-ui/pull/289) [FEATURE] Ajouter le composant PixFilterableAndSearchableSelect (PIX-6026)
8
+ - [#291](https://github.com/1024pix/pix-ui/pull/291) [FEATURE] Ajoute la possibilité d'utiliser un block à la place du placeholder (PIX-6443)
9
+ - [#290](https://github.com/1024pix/pix-ui/pull/290) [FEATURE] Ajoute une propriété id sur le composant PixSelect (PIX-6440)
10
+
11
+ ### :building_construction: Tech
12
+ - [#286](https://github.com/1024pix/pix-ui/pull/286) [TECH] Mettre à jour les paquets non bloquants (PIX-6419).
13
+ - [#274](https://github.com/1024pix/pix-ui/pull/274) [TECH] Utiliser la dernière version mineure de NodeJs automatiquement
14
+
15
+ ### :bug: Correction
16
+ - [#298](https://github.com/1024pix/pix-ui/pull/298) [BUGFIX] Rétrograder la version d'ember click outside à la 4.0.0 (PIX-6482)
17
+ - [#296](https://github.com/1024pix/pix-ui/pull/296) [BUGFIX] Le select ne prend pas le focus quand on clique sur son label (PIX-6476).
18
+ - [#281](https://github.com/1024pix/pix-ui/pull/281) [BUGFIX] Autorise d'autres événements de la page à avoir lieu lors de l'ouverture/fermeture du select (PIX-6399)
19
+
20
+ ### :coffee: Autre
21
+ - [#284](https://github.com/1024pix/pix-ui/pull/284) [BREAKING CHANGES][TECH] Supprime la propriété onLoadOptions sur le composant PixMultiSelect (PIX-6418)
22
+ - [#280](https://github.com/1024pix/pix-ui/pull/280) [BUG] Empêche le composant PixSelect de capturer le focus à chaque click sur la page (PIX-6397)
23
+ - [#278](https://github.com/1024pix/pix-ui/pull/278) [BREAKING CHANGES][TECH] Améliorer le composant PixMultiSelect (Pix-6025)
24
+ - [#266](https://github.com/1024pix/pix-ui/pull/266) [BREAKING CHANGES][FEATURE] Créer un nouveau PixSelect accessible basé sur PixDropdown/PixSelect (Pix-6018)
25
+
3
26
  ## v20.2.3 (15/11/2022)
4
27
 
5
28
 
@@ -37,14 +37,14 @@
37
37
  </button>
38
38
  {{/if}}
39
39
 
40
- <div
41
- role="button"
40
+ <button
41
+ type="button"
42
42
  tabindex="-1"
43
43
  class="pix-dropdown__controller--chevron"
44
44
  {{on "click" this.toggleDropdown}}
45
45
  >
46
46
  <FaIcon @icon={{if this.isExpanded "chevron-up" "chevron-down"}} />
47
- </div>
47
+ </button>
48
48
  </div>
49
49
 
50
50
  <div
@@ -55,7 +55,6 @@
55
55
  aria-labelledby={{if this.label @id}}
56
56
  aria-label={{unless this.label @placeholder}}
57
57
  aria-hidden={{if this.isExpanded "false" "true"}}
58
- aria-activedescendant={{if this.selectedOption this.selectedOption.value}}
59
58
  {{on "keyup" this.navigateThroughOptions}}
60
59
  {{on "scroll" this.incrementPage}}
61
60
  >
@@ -0,0 +1,45 @@
1
+ <div>
2
+ <div class="{{if @screenReaderOnly 'screen-reader-only'}}">
3
+ <label class="pix-filterable-and-searchable-select__label" for={{this.id}}>
4
+ {{#if @requiredText}}
5
+ <abbr class="mandatory-mark" title="{{@requiredText}}" aria-hidden="true">*</abbr>
6
+ {{/if}}
7
+ {{@label}}
8
+ </label>
9
+ {{#if @subLabel}}
10
+ <span class="pix-select__sub-label">{{@subLabel}}</span>
11
+ {{/if}}
12
+ </div>
13
+ <div
14
+ class="pix-filterable-and-searchable-select{{if
15
+ @errorMessage
16
+ ' pix-filterable-and-searchable-select--error'
17
+ }}"
18
+ >
19
+ <PixMultiSelect
20
+ @values={{this.selectedCategories}}
21
+ @label={{@categoriesLabel}}
22
+ @options={{this.categories}}
23
+ @onChange={{this.selectCategories}}
24
+ @screenReaderOnly={{true}}
25
+ @className="pix-filterable-and-searchable-select__pix-multi-select"
26
+ >
27
+ <:placeholder>{{this.categoriesPlaceholder}}</:placeholder>
28
+ <:default as |option|>{{option.label}}</:default>
29
+ </PixMultiSelect>
30
+ <PixSelect
31
+ @id={{this.id}}
32
+ @placeholder={{@placeholder}}
33
+ @value={{@value}}
34
+ @options={{this.selectableOptions}}
35
+ @onChange={{@onChange}}
36
+ @isSearchable={{@isSearchable}}
37
+ @searchLabel={{@searchLabel}}
38
+ @screenReaderOnly={{true}}
39
+ @className="pix-filterable-and-searchable-select__pix-select"
40
+ />
41
+ </div>
42
+ {{#if @errorMessage}}
43
+ <p class="pix-filterable-and-searchable-select__error-message">{{@errorMessage}}</p>
44
+ {{/if}}
45
+ </div>
@@ -0,0 +1,48 @@
1
+ import Component from '@glimmer/component';
2
+ import { tracked } from '@glimmer/tracking';
3
+ import { action } from '@ember/object';
4
+ import { guidFor } from '@ember/object/internals';
5
+
6
+ export default class PixFilterableAndSearchableSelect extends Component {
7
+ @tracked selectedCategories = [];
8
+
9
+ id = 'pix-filterable-and-searchable-select' + guidFor(this);
10
+
11
+ @action
12
+ selectCategories(categories) {
13
+ this.selectedCategories = categories;
14
+ }
15
+
16
+ get categories() {
17
+ const categoryNames = [];
18
+ this.args.options.forEach((option) => {
19
+ if (!categoryNames.includes(option.category)) {
20
+ categoryNames.push(option.category);
21
+ }
22
+ });
23
+
24
+ return categoryNames.map((category) => {
25
+ return { label: category, value: category };
26
+ });
27
+ }
28
+
29
+ get categoriesPlaceholder() {
30
+ return `${this.args.categoriesPlaceholder} (${this.selectedCategories.length})`;
31
+ }
32
+
33
+ get selectableOptions() {
34
+ const selectableOptions = [];
35
+ const categories =
36
+ this.selectedCategories.length === 0
37
+ ? this.categories.map(({ value }) => value)
38
+ : this.selectedCategories;
39
+
40
+ this.args.options.forEach((option) => {
41
+ if (categories.includes(option.category)) {
42
+ selectableOptions.push(option);
43
+ }
44
+ });
45
+
46
+ return selectableOptions;
47
+ }
48
+ }
@@ -2,23 +2,25 @@
2
2
  class="pix-multi-select"
3
3
  {{on-click-outside this.hideDropDown}}
4
4
  {{on-arrow-down-up-action this.listId this.showDropDown this.isExpanded}}
5
- {{on-escape-action this.hideDropDown @id}}
5
+ {{on-escape-action this.hideDropDown this.multiSelectId}}
6
6
  >
7
7
 
8
- {{#if @isSearchable}}
8
+ {{#if @label}}
9
9
  <label
10
- for={{@id}}
10
+ for={{this.multiSelectId}}
11
11
  class="pix-multi-select__label{{if @screenReaderOnly ' screen-reader-only'}}"
12
12
  >{{@label}}</label>
13
- <span class="pix-multi-select-header">
13
+ {{/if}}
14
+ {{#if @isSearchable}}
15
+ <span class="pix-multi-select-header{{if @className this.className}}">
14
16
  <FaIcon @icon="magnifying-glass" class="pix-multi-select-header__search-icon" />
15
17
 
16
18
  <input
17
19
  class="pix-multi-select-header__search-input"
18
- id={{@id}}
20
+ id={{this.multiSelectId}}
19
21
  type="text"
20
- name={{@id}}
21
- placeholder={{this.innerText}}
22
+ name={{this.multiSelectId}}
23
+ placeholder={{this.placeholder}}
22
24
  autocomplete="off"
23
25
  {{on "input" this.updateSearch}}
24
26
  {{on "click" this.toggleDropDown}}
@@ -29,23 +31,21 @@
29
31
  />
30
32
  </span>
31
33
  {{else}}
32
- <span
33
- id={{this.labelId}}
34
- class="pix-multi-select__label{{if @screenReaderOnly ' screen-reader-only'}}"
35
- >{{@label}}</span>
36
-
37
34
  <button
38
- aria-labelledby={{this.labelId}}
39
- id={{@id}}
35
+ id={{this.multiSelectId}}
40
36
  type="button"
41
37
  aria-expanded={{this.isAriaExpanded}}
42
38
  aria-controls={{this.listId}}
43
39
  aria-haspopup="menu"
44
- class="pix-multi-select-header"
40
+ class="pix-multi-select-header{{if @className this.className}}"
45
41
  {{on "click" this.toggleDropDown}}
46
42
  ...attributes
47
43
  >
48
- {{this.innerText}}
44
+ {{#if (has-block "placeholder")}}
45
+ {{yield to="placeholder"}}
46
+ {{else if @placeholder}}
47
+ {{this.placeholder}}
48
+ {{/if}}
49
49
  <FaIcon
50
50
  class="pix-multi-select-header__dropdown-icon
51
51
  {{if this.isExpanded ' pix-multi-select-header__dropdown-icon--expand'}}"
@@ -57,28 +57,24 @@
57
57
  <ul
58
58
  class="pix-multi-select-list {{unless this.isExpanded 'pix-multi-select-list--hidden'}}"
59
59
  id={{this.listId}}
60
- aria-multiselectable="true"
61
60
  role="menu"
62
61
  >
63
62
  {{#if (gt this.results.length 0)}}
64
63
  {{#each this.results as |option|}}
65
64
  <li class="pix-multi-select-list__item" role="menuitem">
66
65
  <PixCheckbox
67
- @id={{concat @id "-" option.value}}
66
+ @id={{concat this.multiSelectId "-" option.value}}
68
67
  @checked={{option.checked}}
68
+ @labelSize="small"
69
69
  value={{option.value}}
70
70
  {{on "change" this.onSelect}}
71
- {{on-enter-action this.hideDropDown @id}}
71
+ {{on-enter-action this.hideDropDown this.multiSelectId}}
72
72
  tabindex={{if this.isExpanded "0" "-1"}}
73
73
  >
74
74
  {{yield option}}
75
75
  </PixCheckbox>
76
76
  </li>
77
77
  {{/each}}
78
- {{else if this.isLoadingOptions}}
79
- <li
80
- class="pix-multi-select-list__item pix-multi-select-list__item--no-result"
81
- >{{@loadingMessage}}</li>
82
78
  {{else}}
83
79
  <li
84
80
  class="pix-multi-select-list__item pix-multi-select-list__item--no-result"
@@ -2,6 +2,7 @@ import Component from '@glimmer/component';
2
2
 
3
3
  import { action } from '@ember/object';
4
4
  import { tracked } from '@glimmer/tracking';
5
+ import { guidFor } from '@ember/object/internals';
5
6
 
6
7
  function sortOptionsByCheckedFirst(a, b) {
7
8
  if (a.checked && b.checked) return 0;
@@ -22,47 +23,23 @@ export default class PixMultiSelect extends Component {
22
23
  @tracked searchData;
23
24
 
24
25
  @tracked options = [];
25
- @tracked isLoadingOptions = false;
26
26
 
27
27
  constructor(...args) {
28
28
  super(...args);
29
- const { onLoadOptions, id, label, innerText } = this.args;
30
29
 
31
- const idIsNotDefined = !id || !id.trim();
32
- const labelIsNotDefined = !label || !label.trim();
33
- const innerTextIsNotDefined = !innerText || !innerText.trim();
30
+ if (!this.args.label && !this.args.id)
31
+ throw new Error('ERROR in PixMultiSelect, a @label or an @id was not provided');
34
32
 
35
- if (idIsNotDefined || labelIsNotDefined || innerTextIsNotDefined) {
36
- const missingParams = [];
37
-
38
- if (idIsNotDefined) missingParams.push('@id');
39
- if (labelIsNotDefined) missingParams.push('@label');
40
- if (innerTextIsNotDefined) missingParams.push('@innerText');
41
-
42
- throw new Error(
43
- `ERROR in PixMultiSelect component, ${missingParams.join(', ')} ${
44
- missingParams.length > 1 ? 'params are' : 'param is'
45
- } necessary`
46
- );
47
- }
48
-
49
- if (onLoadOptions) {
50
- this.isLoadingOptions = true;
51
- onLoadOptions().then((options = []) => {
52
- this.options = options;
53
- this.isLoadingOptions = false;
54
- });
55
- } else {
56
- this.options = [...(this.args.options || [])];
57
- }
33
+ this.options = [...(this.args.options || [])];
58
34
  }
59
35
 
60
- get listId() {
61
- return `list-${this.args.id}`;
36
+ get multiSelectId() {
37
+ if (this.args.id) return this.args.id;
38
+ return 'select-' + guidFor(this);
62
39
  }
63
40
 
64
- get labelId() {
65
- return `label-${this.args.id}`;
41
+ get listId() {
42
+ return `list-${this.multiSelectId}`;
66
43
  }
67
44
 
68
45
  get isAriaExpanded() {
@@ -76,19 +53,19 @@ export default class PixMultiSelect extends Component {
76
53
  return this.options;
77
54
  }
78
55
 
79
- get innerText() {
80
- const { selected, innerText } = this.args;
81
- if (selected?.length > 0) {
56
+ get placeholder() {
57
+ const { values, placeholder } = this.args;
58
+ if (values?.length > 0) {
82
59
  const selectedOptionLabels = this.options
83
- .filter(({ value, label }) => {
84
- const hasOption = selected.includes(value);
85
- return hasOption && Boolean(label);
60
+ .filter((option) => {
61
+ const hasOption = values.includes(option.value);
62
+ return hasOption && Boolean(option.label);
86
63
  })
87
64
  .map(({ label }) => label)
88
65
  .join(', ');
89
66
  return selectedOptionLabels;
90
67
  }
91
- return innerText;
68
+ return placeholder;
92
69
  }
93
70
 
94
71
  _setDisplayedOptions(selected, shouldSort) {
@@ -113,15 +90,15 @@ export default class PixMultiSelect extends Component {
113
90
 
114
91
  @action
115
92
  onSelect(event) {
116
- let selected = [...(this.args.selected || [])];
93
+ let selected = [...(this.args.values || [])];
117
94
  if (event.target.checked) {
118
95
  selected.push(event.target.value);
119
96
  } else {
120
97
  selected = selected.filter((value) => value !== event.target.value);
121
98
  }
122
99
 
123
- if (this.args.onSelect) {
124
- this.args.onSelect(selected);
100
+ if (this.args.onChange) {
101
+ this.args.onChange(selected);
125
102
  }
126
103
  }
127
104
 
@@ -138,7 +115,7 @@ export default class PixMultiSelect extends Component {
138
115
  showDropDown() {
139
116
  if (this.isExpanded) return;
140
117
  this.isExpanded = true;
141
- this._setDisplayedOptions(this.args.selected, true);
118
+ this._setDisplayedOptions(this.args.values, true);
142
119
  }
143
120
 
144
121
  @action
@@ -159,7 +136,12 @@ export default class PixMultiSelect extends Component {
159
136
  : removeCapitalizeAndDiacritics(event.target.value);
160
137
  this.isExpanded = true;
161
138
  if (!event.target.value) {
162
- this._setDisplayedOptions(this.args.selected, true);
139
+ this._setDisplayedOptions(this.args.values, true);
163
140
  }
164
141
  }
142
+
143
+ get className() {
144
+ const { className } = this.args;
145
+ return ' ' + className;
146
+ }
165
147
  }
@@ -2,7 +2,8 @@
2
2
  <section class="pix-pagination__size">
3
3
  <span class="pagination-size__label">{{this.beforeResultsPerPage}}</span>
4
4
  <PixSelect
5
- aria-label={{this.selectPageSizeLabel}}
5
+ @label={{this.selectPageSizeLabel}}
6
+ @screenReaderOnly={{true}}
6
7
  class="pagination-size__choice"
7
8
  @selectedOption={{this.pageSize}}
8
9
  @onChange={{this.changePageSize}}
@@ -1,56 +1,145 @@
1
- <div class="pix-select">
1
+ {{! template-lint-disable no-down-event-binding require-context-role require-presentational-children }}
2
+ <div
3
+ class="pix-select"
4
+ id="container-{{this.selectId}}"
5
+ {{on-click-outside this.hideDropdown}}
6
+ {{on-arrow-down-up-action this.listId this.showDropdown this.isExpanded}}
7
+ {{on-escape-action this.hideDropdown this.selectId}}
8
+ {{did-insert this.setSelectWidth}}
9
+ {{on "keydown" this.lockTab}}
10
+ >
11
+ {{#if @label}}
12
+ <div class="{{if @screenReaderOnly 'screen-reader-only'}}">
13
+ <label for={{this.selectId}} class="pix-select__label">
14
+ {{#if @requiredText}}
15
+ <abbr class="mandatory-mark" title="{{@requiredText}}" aria-hidden="true">*</abbr>
16
+ {{/if}}
17
+ {{@label}}
18
+ </label>
2
19
 
3
- {{#if this.label}}
4
- <label for={{@id}} class="pix-select__label">{{this.label}}</label>
20
+ {{#if @subLabel}}
21
+ <span class="pix-select__sub-label">{{@subLabel}}</span>
22
+ {{/if}}
23
+ </div>
5
24
  {{/if}}
6
25
 
7
- {{#if @isSearchable}}
26
+ <button
27
+ type="button"
28
+ id={{this.selectId}}
29
+ class={{this.className}}
30
+ {{on "click" this.toggleDropdown}}
31
+ aria-expanded={{this.isAriaExpanded}}
32
+ aria-controls={{this.listId}}
33
+ >
34
+ {{this.placeholder}}
8
35
 
9
- <input
10
- id={{@id}}
11
- list="{{this.datalistId}}"
12
- {{on "input" this.onChange}}
13
- class="{{if this.isValid 'pix-select--is-valid'}} {{if this.isBig 'pix-select--big'}}"
14
- ...attributes
15
- autocomplete="off"
36
+ <FaIcon
37
+ class="pix-select-button__dropdown-icon"
38
+ @icon={{if this.isExpanded "chevron-up" "chevron-down"}}
16
39
  />
40
+ </button>
41
+ <div
42
+ class="pix-select__dropdown{{unless this.isExpanded ' pix-select__dropdown--closed'}}"
43
+ id={{this.dropDownId}}
44
+ {{on "transitionend" this.focus}}
45
+ >
46
+ {{#if @isSearchable}}
47
+ <div class="pix-select__search">
48
+ <FaIcon class="pix-select-search__icon" @icon="magnifying-glass" />
49
+ <label class="screen-reader-only" for={{this.searchId}}>{{@searchLabel}}</label>
50
+ <input
51
+ class="pix-select-search__input"
52
+ id={{this.searchId}}
53
+ autocomplete="off"
54
+ tabindex={{if this.isExpanded "0" "-1"}}
55
+ placeholder={{@searchPlaceholder}}
56
+ {{on "input" this.setSearchValue}}
57
+ />
58
+ </div>
59
+ {{/if}}
60
+ <div role="listbox" id={{this.listId}} class="pix-select__options">
61
+ {{#if this.displayDefaultOption}}
62
+ <li
63
+ class="pix-select-options-category__option{{unless
64
+ @value
65
+ ' pix-select-options-category__option--selected'
66
+ }}"
67
+ role="option"
68
+ tabindex={{if this.isExpanded "0" "-1"}}
69
+ aria-selected={{if @value "false" "true"}}
70
+ {{on "click" (fn this.onChange this.defaultOption)}}
71
+ {{on-enter-action (fn this.onChange this.defaultOption)}}
72
+ {{on-space-action (fn this.onChange this.defaultOption)}}
73
+ >
74
+ {{@placeholder}}
75
+ </li>
76
+ {{/if}}
77
+ {{#if this.results}}
78
+ {{#if this.displayCategory}}
79
+ {{#each this.results as |element index|}}
80
+ <ul
81
+ class="pix-select-options__category"
82
+ role="group"
83
+ aria-labelledby={{if this.displayCategory (concat "cat-" this.selectId "-" index)}}
84
+ >
85
+ {{#if this.displayCategory}}
86
+ {{! template-lint-disable no-invalid-role }}
87
+ {{!https://www.w3.org/WAI/ARIA/apg/example-index/listbox/listbox-grouped.html}}
88
+ <li
89
+ class="pix-select-options-category__name"
90
+ role="presentation"
91
+ id={{concat "cat-" this.selectId "-" index}}
92
+ >
93
+ {{element.category}}
94
+ </li>
95
+ {{/if}}
17
96
 
18
- <datalist id={{this.datalistId}}>
19
- {{#each @options as |opt|}}
20
- <option label={{opt.label}}>{{opt.label}}</option>
21
- {{/each}}
22
- </datalist>
23
-
24
- {{else}}
97
+ {{#each element.options as |option|}}
98
+ <li
99
+ class="pix-select-options-category__option{{if
100
+ (eq option.value @value)
101
+ ' pix-select-options-category__option--selected'
102
+ }}"
103
+ role="option"
104
+ tabindex={{if this.isExpanded "0" "-1"}}
105
+ aria-selected={{if (eq option.value @value) "true" "false"}}
106
+ {{on "click" (fn this.onChange option)}}
107
+ {{on-enter-action (fn this.onChange option)}}
108
+ {{on-space-action (fn this.onChange option)}}
109
+ >
110
+ {{option.label}}
25
111
 
26
- <select
27
- id={{@id}}
28
- class="{{if this.isBig 'pix-select--big'}}"
29
- {{on "change" this.onChange}}
30
- ...attributes
31
- >
32
- {{#if (not-eq @emptyOptionLabel undefined)}}
33
- {{#if @emptyOptionNotSelectable}}
34
- <option value="" hidden>{{@emptyOptionLabel}}</option>
112
+ <FaIcon @icon="check" />
113
+ </li>
114
+ {{/each}}
115
+ </ul>
116
+ {{/each}}
35
117
  {{else}}
36
- <option value="">{{@emptyOptionLabel}}</option>
118
+ {{#each this.results as |option|}}
119
+ <li
120
+ class="pix-select-options-category__option{{if
121
+ (eq option.value @value)
122
+ ' pix-select-options-category__option--selected'
123
+ }}"
124
+ role="option"
125
+ tabindex={{if this.isExpanded "0" "-1"}}
126
+ aria-selected={{if (eq option.value @value) "true" "false"}}
127
+ {{on "click" (fn this.onChange option)}}
128
+ {{on-enter-action (fn this.onChange option)}}
129
+ {{on-space-action (fn this.onChange this.defaultOption)}}
130
+ >
131
+ {{option.label}}
132
+
133
+ <FaIcon @icon="check" />
134
+ </li>
135
+ {{/each}}
37
136
  {{/if}}
137
+ {{else}}
138
+ <p class="pix-select__empty-search-message">{{@emptySearchMessage}}</p>
38
139
  {{/if}}
39
- {{#each @options as |opt|}}
40
- {{#if (eq @selectedOption opt.value)}}
41
- {{! https://github.com/emberjs/ember.js/issues/15484
42
- ember-prop-modifier let us fix a bug about selected attribute in FireFox }}
43
- <option value={{opt.value}} {{prop selected="true"}}>
44
- {{opt.label}}
45
- </option>
46
- {{else}}
47
- <option value={{opt.value}}>
48
- {{opt.label}}
49
- </option>
50
- {{/if}}
51
- {{/each}}
52
- </select>
53
- <FaIcon class="pix-select__icon" @icon="chevron-down" />
54
-
140
+ </div>
141
+ </div>
142
+ {{#if @errorMessage}}
143
+ <p class="pix-select__error-message">{{@errorMessage}}</p>
55
144
  {{/if}}
56
145
  </div>