@1024pix/pix-ui 44.3.8 → 45.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.
- package/addon/components/pix-checkbox.hbs +2 -2
- package/addon/components/pix-filterable-and-searchable-select.hbs +5 -4
- package/addon/components/pix-input-base.js +44 -0
- package/addon/components/pix-input-password.hbs +46 -39
- package/addon/components/pix-input-password.js +12 -27
- package/addon/components/pix-input.hbs +25 -23
- package/addon/components/pix-input.js +10 -16
- package/addon/components/pix-label.js +2 -4
- package/addon/components/pix-multi-select.hbs +7 -6
- package/addon/components/pix-multi-select.js +0 -3
- package/addon/components/pix-pagination.hbs +3 -2
- package/addon/components/pix-radio-button.hbs +2 -2
- package/addon/components/pix-search-input.hbs +7 -6
- package/addon/components/pix-search-input.js +6 -19
- package/addon/components/pix-select.hbs +135 -129
- package/addon/components/pix-textarea.hbs +23 -19
- package/addon/components/pix-textarea.js +6 -0
- package/addon/components/pix-toggle.hbs +3 -3
- package/addon/components/pix-toggle.js +5 -0
- package/addon/styles/_pix-input-password.scss +19 -13
- package/addon/styles/_pix-input.scss +9 -2
- package/addon/styles/_pix-label.scss +0 -1
- package/addon/styles/_pix-multi-select.scss +9 -1
- package/addon/styles/_pix-search-input.scss +8 -1
- package/addon/styles/_pix-select.scss +9 -1
- package/addon/styles/_pix-toggle.scss +8 -1
- package/app/stories/form.stories.js +31 -24
- package/app/stories/pix-checkbox.mdx +2 -2
- package/app/stories/pix-checkbox.stories.js +52 -33
- package/app/stories/pix-filter-banner.stories.js +9 -6
- package/app/stories/pix-filterable-and-searchable-select.mdx +9 -8
- package/app/stories/pix-filterable-and-searchable-select.stories.js +13 -11
- package/app/stories/pix-input-password.mdx +8 -5
- package/app/stories/pix-input-password.stories.js +50 -28
- package/app/stories/pix-input.mdx +14 -8
- package/app/stories/pix-input.stories.js +46 -21
- package/app/stories/pix-label.stories.js +3 -2
- package/app/stories/pix-multi-select.mdx +7 -5
- package/app/stories/pix-multi-select.stories.js +74 -36
- package/app/stories/pix-radio-button.mdx +3 -1
- package/app/stories/pix-radio-button.stories.js +47 -40
- package/app/stories/pix-search-input.mdx +6 -4
- package/app/stories/pix-search-input.stories.js +57 -22
- package/app/stories/pix-select.mdx +4 -3
- package/app/stories/pix-select.stories.js +64 -57
- package/app/stories/pix-textarea.mdx +6 -2
- package/app/stories/pix-textarea.stories.js +42 -20
- package/app/stories/pix-toggle.stories.js +12 -10
- package/package.json +1 -1
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
<PixLabel
|
|
12
12
|
@for={{this.id}}
|
|
13
13
|
@requiredLabel={{@requiredLabel}}
|
|
14
|
-
@
|
|
14
|
+
@size={{@size}}
|
|
15
15
|
@inlineLabel={{true}}
|
|
16
16
|
@screenReaderOnly={{@screenReaderOnly}}
|
|
17
17
|
@isDisabled={{@isDisabled}}
|
|
18
18
|
>
|
|
19
|
-
{{yield}}
|
|
19
|
+
{{yield to="label"}}
|
|
20
20
|
</PixLabel>
|
|
21
21
|
</div>
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
<div id={{this.mainId}} ...attributes>
|
|
2
2
|
<PixLabel
|
|
3
3
|
@for={{this.pixSelectId}}
|
|
4
|
-
@requiredLabel={{@
|
|
5
|
-
@
|
|
4
|
+
@requiredLabel={{@requiredLabel}}
|
|
5
|
+
@size={{@size}}
|
|
6
6
|
@subLabel={{@subLabel}}
|
|
7
7
|
@screenReaderOnly={{@screenReaderOnly}}
|
|
8
|
+
@inlineLabel={{@inlineLabel}}
|
|
8
9
|
>
|
|
9
|
-
{{
|
|
10
|
+
{{yield to="label"}}
|
|
10
11
|
</PixLabel>
|
|
11
12
|
<div
|
|
12
13
|
class="pix-filterable-and-searchable-select{{if
|
|
@@ -17,12 +18,12 @@
|
|
|
17
18
|
<PixMultiSelect
|
|
18
19
|
id={{this.pixMultiSelectId}}
|
|
19
20
|
@values={{this.selectedCategories}}
|
|
20
|
-
@label={{@categoriesLabel}}
|
|
21
21
|
@options={{this.categories}}
|
|
22
22
|
@onChange={{this.selectCategories}}
|
|
23
23
|
@screenReaderOnly={{true}}
|
|
24
24
|
@className="pix-filterable-and-searchable-select__pix-multi-select"
|
|
25
25
|
>
|
|
26
|
+
<:label>{{yield to="categoriesLabel"}}</:label>
|
|
26
27
|
<:placeholder>{{this.categoriesPlaceholder}}</:placeholder>
|
|
27
28
|
<:default as |option|>{{option.label}}</:default>
|
|
28
29
|
</PixMultiSelect>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
|
|
3
|
+
import { guidFor } from '@ember/object/internals';
|
|
4
|
+
|
|
5
|
+
export default class PixInputBase extends Component {
|
|
6
|
+
prefix;
|
|
7
|
+
inputValidationError;
|
|
8
|
+
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
|
|
12
|
+
this.prefix = 'pix-input-base';
|
|
13
|
+
this.inputValidationError = {
|
|
14
|
+
default: '',
|
|
15
|
+
error: 'pix-input-base--error',
|
|
16
|
+
success: 'pix-input-base--success',
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
get id() {
|
|
21
|
+
if (this.args.id) return this.args.id;
|
|
22
|
+
return this.prefix + '-' + guidFor(this);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
get validationStatusClassName() {
|
|
26
|
+
return this.inputValidationError[this.args.validationStatus] || '';
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
get ariaDescribedBy() {
|
|
30
|
+
return this.args.validationStatus === 'error' ? this.prefix + '-error' : null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
get hasError() {
|
|
34
|
+
return this.args.validationStatus === 'error';
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
get hasErrorMessage() {
|
|
38
|
+
return this.hasError && !!this.args.errorMessage;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
get hasSuccess() {
|
|
42
|
+
return this.args.validationStatus === 'success';
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -1,52 +1,59 @@
|
|
|
1
|
-
<div class="pix-input-password">
|
|
1
|
+
<div class="pix-input-password {{if @inlineLabel ' pix-input-password--inline'}}">
|
|
2
2
|
<PixLabel
|
|
3
3
|
@for={{this.id}}
|
|
4
4
|
@requiredLabel={{@requiredLabel}}
|
|
5
|
-
@
|
|
6
|
-
@subLabel={{@
|
|
5
|
+
@size={{@size}}
|
|
6
|
+
@subLabel={{@subLabel}}
|
|
7
7
|
@screenReaderOnly={{@screenReaderOnly}}
|
|
8
|
+
@inlineLabel={{@inlineLabel}}
|
|
8
9
|
>
|
|
9
|
-
{{
|
|
10
|
+
{{yield to="label"}}
|
|
10
11
|
</PixLabel>
|
|
11
|
-
<div
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
<div>
|
|
13
|
+
<div
|
|
14
|
+
class="pix-input-password__container
|
|
15
|
+
{{this.validationStatusClassName}}
|
|
16
|
+
{{if @prefix 'pix-input-password__with-prefix'}}"
|
|
17
|
+
>
|
|
16
18
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
{{#if @prefix}}
|
|
20
|
+
<span class="pix-input-password__prefix">{{@prefix}}</span>
|
|
21
|
+
{{/if}}
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
<input
|
|
24
|
+
id={{this.id}}
|
|
25
|
+
type={{if this.isPasswordVisible "text" "password"}}
|
|
26
|
+
value={{@value}}
|
|
27
|
+
aria-required="{{if @requiredLabel true false}}"
|
|
28
|
+
required={{if @requiredLabel true false}}
|
|
29
|
+
aria-describedby={{this.ariaDescribedBy}}
|
|
30
|
+
...attributes
|
|
31
|
+
/>
|
|
30
32
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
<PixIconButton
|
|
34
|
+
class="pix-input-password__button"
|
|
35
|
+
@icon={{if this.isPasswordVisible "eye" "eye-slash"}}
|
|
36
|
+
@ariaLabel={{if
|
|
37
|
+
this.isPasswordVisible
|
|
38
|
+
"Masquer le mot de passe"
|
|
39
|
+
"Afficher le mot de passe"
|
|
40
|
+
}}
|
|
41
|
+
@triggerAction={{this.togglePasswordVisibility}}
|
|
42
|
+
@size="small"
|
|
43
|
+
/>
|
|
38
44
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
45
|
+
{{#if this.hasError}}
|
|
46
|
+
<FaIcon @icon="xmark" class="pix-input-password__icon pix-input-password__error-icon" />
|
|
47
|
+
{{/if}}
|
|
48
|
+
{{#if this.hasSuccess}}
|
|
49
|
+
<FaIcon @icon="check" class="pix-input-password__icon pix-input-password__success-icon" />
|
|
50
|
+
{{/if}}
|
|
51
|
+
</div>
|
|
52
|
+
|
|
53
|
+
{{#if this.hasErrorMessage}}
|
|
54
|
+
<p id={{this.ariaDescribedBy}} class="pix-input-password__error-message">
|
|
55
|
+
{{@errorMessage}}
|
|
56
|
+
</p>
|
|
44
57
|
{{/if}}
|
|
45
58
|
</div>
|
|
46
|
-
|
|
47
|
-
{{#if (and (eq @validationStatus "error") @errorMessage)}}
|
|
48
|
-
<p id="text-input-password-error" class="pix-input-password__error-message">
|
|
49
|
-
{{@errorMessage}}
|
|
50
|
-
</p>
|
|
51
|
-
{{/if}}
|
|
52
59
|
</div>
|
|
@@ -1,32 +1,21 @@
|
|
|
1
|
-
import
|
|
1
|
+
import PixInputBase from './pix-input-base';
|
|
2
|
+
|
|
2
3
|
import { action } from '@ember/object';
|
|
3
4
|
import { tracked } from '@glimmer/tracking';
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const INPUT_VALIDATION_STATUS_MAP = {
|
|
9
|
-
default: '',
|
|
10
|
-
error: 'pix-input-password__error-container',
|
|
11
|
-
success: 'pix-input-password__success-container',
|
|
12
|
-
};
|
|
6
|
+
export default class PixInputPassword extends PixInputBase {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
13
9
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
return this.args.label;
|
|
10
|
+
this.prefix = 'pix-input-password';
|
|
11
|
+
this.inputValidationError = {
|
|
12
|
+
default: '',
|
|
13
|
+
error: 'pix-input-password__container--error',
|
|
14
|
+
success: 'pix-input-password__container--success',
|
|
15
|
+
};
|
|
22
16
|
}
|
|
23
17
|
|
|
24
|
-
|
|
25
|
-
if (!this.args.label && !this.args.ariaLabel) {
|
|
26
|
-
throw new Error(ERROR_MESSAGE);
|
|
27
|
-
}
|
|
28
|
-
return this.args.label ? null : this.args.ariaLabel;
|
|
29
|
-
}
|
|
18
|
+
@tracked isPasswordVisible = false;
|
|
30
19
|
|
|
31
20
|
@action
|
|
32
21
|
togglePasswordVisibility() {
|
|
@@ -36,8 +25,4 @@ export default class PixInputPassword extends PixInput {
|
|
|
36
25
|
InputElement.focus();
|
|
37
26
|
}
|
|
38
27
|
}
|
|
39
|
-
|
|
40
|
-
get validationStatusClassName() {
|
|
41
|
-
return INPUT_VALIDATION_STATUS_MAP[this.args.validationStatus] || '';
|
|
42
|
-
}
|
|
43
28
|
}
|
|
@@ -1,34 +1,36 @@
|
|
|
1
|
-
<div class="pix-input">
|
|
1
|
+
<div class="pix-input {{if @inlineLabel ' pix-input--inline'}}">
|
|
2
2
|
<PixLabel
|
|
3
3
|
@for={{this.id}}
|
|
4
4
|
@requiredLabel={{@requiredLabel}}
|
|
5
|
-
@subLabel={{@
|
|
6
|
-
@
|
|
5
|
+
@subLabel={{@subLabel}}
|
|
6
|
+
@size={{@size}}
|
|
7
7
|
@screenReaderOnly={{@screenReaderOnly}}
|
|
8
|
+
@inlineLabel={{@inlineLabel}}
|
|
8
9
|
>
|
|
9
|
-
{{
|
|
10
|
+
{{yield to="label"}}
|
|
10
11
|
</PixLabel>
|
|
12
|
+
<div>
|
|
13
|
+
<div class="pix-input__container">
|
|
14
|
+
<input
|
|
15
|
+
id={{this.id}}
|
|
16
|
+
class="pix-input__input {{this.validationStatusClassName}}"
|
|
17
|
+
value={{@value}}
|
|
18
|
+
aria-required="{{if @requiredLabel true false}}"
|
|
19
|
+
required={{if @requiredLabel true false}}
|
|
20
|
+
aria-describedby={{this.ariaDescribedBy}}
|
|
21
|
+
...attributes
|
|
22
|
+
/>
|
|
11
23
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
aria-describedby={{if (eq @validationStatus "error") "text-input-error"}}
|
|
20
|
-
...attributes
|
|
21
|
-
/>
|
|
24
|
+
{{#if this.hasError}}
|
|
25
|
+
<FaIcon @icon="xmark" class="pix-input__error-icon" />
|
|
26
|
+
{{/if}}
|
|
27
|
+
{{#if this.hasSuccess}}
|
|
28
|
+
<FaIcon @icon="check" class="pix-input__success-icon" />
|
|
29
|
+
{{/if}}
|
|
30
|
+
</div>
|
|
22
31
|
|
|
23
|
-
{{#if
|
|
24
|
-
<
|
|
25
|
-
{{/if}}
|
|
26
|
-
{{#if (eq @validationStatus "success")}}
|
|
27
|
-
<FaIcon @icon="check" class="pix-input__success-icon" />
|
|
32
|
+
{{#if this.hasErrorMessage}}
|
|
33
|
+
<p id={{this.ariaDescribedBy}} class="pix-input__error-message">{{@errorMessage}}</p>
|
|
28
34
|
{{/if}}
|
|
29
35
|
</div>
|
|
30
|
-
|
|
31
|
-
{{#if (and (eq @validationStatus "error") @errorMessage)}}
|
|
32
|
-
<p id="text-input-error" class="pix-input__error-message">{{@errorMessage}}</p>
|
|
33
|
-
{{/if}}
|
|
34
36
|
</div>
|
|
@@ -1,20 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import PixInputBase from './pix-input-base';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
success: 'pix-input__input--success',
|
|
7
|
-
};
|
|
3
|
+
export default class PixInput extends PixInputBase {
|
|
4
|
+
constructor() {
|
|
5
|
+
super(...arguments);
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
get validationStatusClassName() {
|
|
18
|
-
return INPUT_VALIDATION_STATUS_MAP[this.args.validationStatus] || '';
|
|
7
|
+
this.prefix = 'pix-input';
|
|
8
|
+
this.inputValidationError = {
|
|
9
|
+
default: '',
|
|
10
|
+
error: 'pix-input__input--error',
|
|
11
|
+
success: 'pix-input__input--success',
|
|
12
|
+
};
|
|
19
13
|
}
|
|
20
14
|
}
|
|
@@ -8,11 +8,9 @@ export default class PixLabel extends Component {
|
|
|
8
8
|
if (this.args.inlineLabel) classes.push('pix-label--inline-label');
|
|
9
9
|
if (this.args.isDisabled) classes.push('pix-label--disabled');
|
|
10
10
|
|
|
11
|
-
const
|
|
12
|
-
? this.args.labelSize
|
|
13
|
-
: 'default';
|
|
11
|
+
const size = ['small', 'large'].includes(this.args.size) ? this.args.size : 'default';
|
|
14
12
|
|
|
15
|
-
classes.push(`pix-label--${
|
|
13
|
+
classes.push(`pix-label--${size}`);
|
|
16
14
|
|
|
17
15
|
return classes.join(' ');
|
|
18
16
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<div
|
|
2
|
-
class="pix-multi-select"
|
|
2
|
+
class="pix-multi-select {{if @inlineLabel ' pix-multi-select--inline'}}"
|
|
3
3
|
...attributes
|
|
4
4
|
{{on-click-outside this.hideDropDown}}
|
|
5
5
|
{{on-arrow-down-up-action this.listId this.showDropDown this.isExpanded}}
|
|
@@ -7,12 +7,13 @@
|
|
|
7
7
|
>
|
|
8
8
|
<PixLabel
|
|
9
9
|
@for={{this.multiSelectId}}
|
|
10
|
-
@requiredLabel={{@
|
|
10
|
+
@requiredLabel={{@requiredLabel}}
|
|
11
11
|
@subLabel={{@subLabel}}
|
|
12
|
-
@
|
|
12
|
+
@size={{@size}}
|
|
13
13
|
@screenReaderOnly={{@screenReaderOnly}}
|
|
14
|
+
@inlineLabel={{@inlineLabel}}
|
|
14
15
|
>
|
|
15
|
-
{{
|
|
16
|
+
{{yield to="label"}}
|
|
16
17
|
</PixLabel>
|
|
17
18
|
|
|
18
19
|
<PopperJS @placement={{@placement}} as |reference popover|>
|
|
@@ -71,14 +72,14 @@
|
|
|
71
72
|
<PixCheckbox
|
|
72
73
|
@id={{concat this.multiSelectId "-" option.value}}
|
|
73
74
|
@checked={{option.checked}}
|
|
74
|
-
@
|
|
75
|
+
@size="small"
|
|
75
76
|
@class="pix-multi-select-list__item-label"
|
|
76
77
|
value={{option.value}}
|
|
77
78
|
{{on "change" this.onSelect}}
|
|
78
79
|
{{on-enter-action this.hideDropDown this.multiSelectId}}
|
|
79
80
|
tabindex={{if this.isExpanded "0" "-1"}}
|
|
80
81
|
>
|
|
81
|
-
{{yield option}}
|
|
82
|
+
<:label>{{yield option}}</:label>
|
|
82
83
|
</PixCheckbox>
|
|
83
84
|
</li>
|
|
84
85
|
{{/each}}
|
|
@@ -27,9 +27,6 @@ export default class PixMultiSelect extends Component {
|
|
|
27
27
|
constructor(...args) {
|
|
28
28
|
super(...args);
|
|
29
29
|
|
|
30
|
-
if (!this.args.label && !this.args.id)
|
|
31
|
-
throw new Error('ERROR in PixMultiSelect, a @label or an @id was not provided');
|
|
32
|
-
|
|
33
30
|
this.options = [...(this.args.options || [])];
|
|
34
31
|
}
|
|
35
32
|
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
<section class="pix-pagination__size">
|
|
3
3
|
<span class="pagination-size__label">{{this.beforeResultsPerPage}}</span>
|
|
4
4
|
<PixSelect
|
|
5
|
-
@label={{this.selectPageSizeLabel}}
|
|
6
5
|
@placeholder={{this.pageSize}}
|
|
7
6
|
@screenReaderOnly={{true}}
|
|
8
7
|
class="pagination-size__choice"
|
|
@@ -10,7 +9,9 @@
|
|
|
10
9
|
@hideDefaultOption={{true}}
|
|
11
10
|
@onChange={{this.changePageSize}}
|
|
12
11
|
@options={{this.pageOptions}}
|
|
13
|
-
|
|
12
|
+
>
|
|
13
|
+
<:label>{{this.selectPageSizeLabel}}</:label>
|
|
14
|
+
</PixSelect>
|
|
14
15
|
</section>
|
|
15
16
|
<section class="pix-pagination__navigation">
|
|
16
17
|
<span>
|
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
<PixLabel
|
|
10
10
|
@for={{this.id}}
|
|
11
11
|
@requiredLabel={{@requiredLabel}}
|
|
12
|
-
@
|
|
12
|
+
@size={{@size}}
|
|
13
13
|
@screenReaderOnly={{@screenReaderOnly}}
|
|
14
14
|
@isDisabled={{@isDisabled}}
|
|
15
15
|
@inlineLabel={{true}}
|
|
16
16
|
>
|
|
17
|
-
{{yield}}
|
|
17
|
+
{{yield to="label"}}
|
|
18
18
|
</PixLabel>
|
|
19
19
|
</div>
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
<div class="pix-search-input">
|
|
1
|
+
<div class="pix-search-input {{if @inlineLabel ' pix-search-input--inline'}}">
|
|
2
2
|
<PixLabel
|
|
3
|
-
@for={{this.
|
|
4
|
-
@requiredLabel={{@
|
|
3
|
+
@for={{this.id}}
|
|
4
|
+
@requiredLabel={{@requiredLabel}}
|
|
5
5
|
@subLabel={{@subLabel}}
|
|
6
|
-
@
|
|
6
|
+
@size={{@size}}
|
|
7
7
|
@screenReaderOnly={{@screenReaderOnly}}
|
|
8
|
+
@inlineLabel={{@inlineLabel}}
|
|
8
9
|
>
|
|
9
|
-
{{
|
|
10
|
+
{{yield to="label"}}
|
|
10
11
|
</PixLabel>
|
|
11
12
|
|
|
12
13
|
<div class="pix-search-input__input-container">
|
|
13
14
|
<FaIcon @icon="magnifying-glass" />
|
|
14
15
|
<input
|
|
15
|
-
id={{this.
|
|
16
|
+
id={{this.id}}
|
|
16
17
|
class="pix-search-input__input"
|
|
17
18
|
name={{@inputName}}
|
|
18
19
|
placeholder={{@placeholder}}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import PixInputBase from './pix-input-base';
|
|
2
|
+
|
|
2
3
|
import { action } from '@ember/object';
|
|
3
|
-
import { guidFor } from '@ember/object/internals';
|
|
4
4
|
import { debounceTask } from 'ember-lifeline';
|
|
5
5
|
|
|
6
|
-
export default class PixSearchInput extends
|
|
6
|
+
export default class PixSearchInput extends PixInputBase {
|
|
7
7
|
initialValue = this.args.value;
|
|
8
8
|
|
|
9
9
|
constructor() {
|
|
10
10
|
super(...arguments);
|
|
11
11
|
|
|
12
|
+
this.prefix = 'pix-search-input';
|
|
13
|
+
|
|
12
14
|
this.debounceTimeBeforeSearch = parseInt(this.args.debounceTimeInMs);
|
|
13
15
|
if (Number.isNaN(this.debounceTimeBeforeSearch)) {
|
|
14
16
|
throw new Error('ERROR in PixSearchInput component, @debounceTimeInMs param is not provided');
|
|
@@ -16,25 +18,10 @@ export default class PixSearchInput extends Component {
|
|
|
16
18
|
if (!this.args.triggerFiltering) {
|
|
17
19
|
throw new Error('ERROR in PixSearchInput component, @triggerFiltering param is not provided');
|
|
18
20
|
}
|
|
19
|
-
if (!this.args.label && !this.args.ariaLabel) {
|
|
20
|
-
throw new Error(
|
|
21
|
-
'ERROR in PixSearchInput component, you must provide @label or @ariaLabel params',
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
this.searchInputId = this.args.id || guidFor(this);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
get label() {
|
|
29
|
-
return this.args.label;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
get ariaLabel() {
|
|
33
|
-
return this.args.label ? null : this.args.ariaLabel;
|
|
34
21
|
}
|
|
35
22
|
|
|
36
23
|
debouncedTriggerFiltering(value) {
|
|
37
|
-
this.args.triggerFiltering(this.
|
|
24
|
+
this.args.triggerFiltering(this.id, value);
|
|
38
25
|
}
|
|
39
26
|
|
|
40
27
|
@action
|