@1024pix/pix-ui 12.0.0 → 13.3.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/CHANGELOG.md +61 -3
- package/addon/components/pix-block.hbs +1 -1
- package/addon/components/pix-collapsible.hbs +4 -4
- package/addon/components/pix-dropdown.hbs +102 -0
- package/addon/components/pix-dropdown.js +181 -0
- package/addon/components/pix-filter-banner.hbs +1 -3
- package/addon/components/pix-icon-button.hbs +1 -1
- package/addon/components/pix-input-password.hbs +6 -5
- package/addon/components/pix-input-password.js +0 -5
- package/addon/components/pix-input.hbs +11 -13
- package/addon/components/pix-input.js +0 -8
- package/addon/components/pix-message.hbs +1 -1
- package/addon/components/pix-modal.hbs +28 -0
- package/addon/components/pix-modal.js +11 -0
- package/addon/components/pix-multi-select.hbs +5 -5
- package/addon/components/pix-progress-gauge.hbs +1 -1
- package/addon/components/pix-radio-button.hbs +1 -1
- package/addon/components/pix-select.hbs +3 -2
- package/addon/components/pix-selectable-tag.hbs +1 -1
- package/addon/components/pix-textarea.hbs +1 -1
- package/addon/components/pix-tooltip-deprecated.hbs +3 -3
- package/addon/components/pix-tooltip.hbs +12 -10
- package/addon/components/pix-tooltip.js +4 -0
- package/addon/styles/_colors.scss +1 -0
- package/addon/styles/_form.scss +7 -1
- package/addon/styles/_pix-dropdown.scss +156 -0
- package/addon/styles/_pix-filter-banner.scss +63 -33
- package/addon/styles/_pix-input-password.scss +1 -0
- package/addon/styles/_pix-input.scss +5 -3
- package/addon/styles/_pix-modal.scss +95 -0
- package/addon/styles/_pix-selectable-tag.scss +4 -0
- package/addon/styles/_pix-tag.scss +9 -0
- package/addon/styles/_reset-css.scss +0 -6
- package/addon/styles/addon.scss +2 -0
- package/app/components/pix-dropdown.js +1 -0
- package/app/components/pix-modal-content.js +1 -0
- package/app/components/pix-modal-footer.js +1 -0
- package/app/components/pix-modal.js +1 -0
- package/app/stories/form.stories.js +13 -0
- package/app/stories/pix-dropdown.stories.js +191 -0
- package/app/stories/pix-dropdown.stories.mdx +70 -0
- package/app/stories/pix-input-password.stories.mdx +0 -1
- package/app/stories/pix-input.stories.mdx +1 -2
- package/app/stories/pix-modal.stories.js +40 -0
- package/app/stories/pix-modal.stories.mdx +59 -0
- package/app/stories/pix-tag.stories.js +6 -4
- package/app/stories/pix-tooltip.stories.js +15 -1
- package/app/stories/pix-tooltip.stories.mdx +19 -0
- package/docs/adr/0001-utiliser-les-balises-html-natives.md +53 -0
- package/docs/test-component-without-release.stories.mdx +19 -0
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,64 @@
|
|
|
1
1
|
# Pix-UI Changelog
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## v13.3.0 (21/02/2022)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### :rocket: Enhancement
|
|
7
|
+
- [#199](https://github.com/1024pix/pix-ui/pull/199) [FEATURE] Permettre de rendre obligatoire le PixDropdown
|
|
8
|
+
|
|
9
|
+
## v13.2.0 (17/02/2022)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### :rocket: Enhancement
|
|
13
|
+
- [#193](https://github.com/1024pix/pix-ui/pull/193) [FEATURE] Ajouter le composant dropdown (PIX-4295).
|
|
14
|
+
|
|
15
|
+
## v13.1.0 (16/02/2022)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### :building_construction: Tech
|
|
19
|
+
- [#194](https://github.com/1024pix/pix-ui/pull/194) [TECH] Mise a jour du package-lock.
|
|
20
|
+
- [#192](https://github.com/1024pix/pix-ui/pull/192) [TECH] Améliorer le blueprint pour auto-générer les nouveaux composants.
|
|
21
|
+
|
|
22
|
+
### :coffee: Various
|
|
23
|
+
- [#198](https://github.com/1024pix/pix-ui/pull/198) [FEAT] Permettre à la tooltip de ne pas s'afficher (PIX-4375)
|
|
24
|
+
- [#196](https://github.com/1024pix/pix-ui/pull/196) [FIX] Corriger les tests qui bloquent la pipeline.
|
|
25
|
+
- [#183](https://github.com/1024pix/pix-ui/pull/183) [DOC] Utiliser les champs de saisie natifs HTML plutôt que ceux d'Ember.
|
|
26
|
+
|
|
27
|
+
## v13.0.0 (27/01/2022)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### :coffee: Various
|
|
31
|
+
- [#188](https://github.com/1024pix/pix-ui/pull/188) [BREAKING_CHANGES] Input / InputPassword missing event on onChange (PIX-4243)
|
|
32
|
+
|
|
33
|
+
## v12.0.0 (24/01/2022)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### :rocket: Enhancement
|
|
37
|
+
- [#94](https://github.com/1024pix/pix-ui/pull/94) [FEATURE] Ajout du composant PixModal
|
|
38
|
+
|
|
39
|
+
### :bug: Bug fix
|
|
40
|
+
- [#186](https://github.com/1024pix/pix-ui/pull/186) [BREAKING_CHANGES] Désactiver l'autocomplete sur le composant Pix Select (PIX-4158)
|
|
41
|
+
- [#187](https://github.com/1024pix/pix-ui/pull/187) [BUGFIX] Rendre tout le tag sélectionnable (PIX-4179)
|
|
42
|
+
|
|
43
|
+
## v11.2.0 (14/01/2022)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
### :coffee: Various
|
|
47
|
+
- [#185](https://github.com/1024pix/pix-ui/pull/185) [A11Y] Ajouter une nouvelle couleur dans la palette de PixTag (PIX-4109)
|
|
48
|
+
|
|
49
|
+
## v11.1.1 (17/12/2021)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
### :building_construction: Tech
|
|
53
|
+
- [#182](https://github.com/1024pix/pix-ui/pull/182) [TECH] Rendre responsive la PixFilterBanner
|
|
54
|
+
|
|
55
|
+
## v11.1.0 (16/12/2021)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
### :building_construction: Tech
|
|
59
|
+
- [#175](https://github.com/1024pix/pix-ui/pull/175) [BREAKING_CHANGES] Faire en sorte que le message d'erreur soit situé à l'intérieur de l'élément qui le compose (PIX-3829)
|
|
60
|
+
|
|
61
|
+
## v11.0.1 (08/12/2021)
|
|
4
62
|
|
|
5
63
|
|
|
6
64
|
### :bug: Bug fix
|
|
@@ -16,12 +74,12 @@
|
|
|
16
74
|
- [#177](https://github.com/1024pix/pix-ui/pull/177) [FEATURE] Création du composant Tag sélectionnable dans Pix UI (PIX-3757)
|
|
17
75
|
|
|
18
76
|
### :building_construction: Tech
|
|
19
|
-
- [#180](https://github.com/1024pix/pix-ui/pull/180) [
|
|
77
|
+
- [#180](https://github.com/1024pix/pix-ui/pull/180) [BREAKING_CHANGES] Ajouter la possibilité d'utiliser des composants Ember à l'intérieur de la tooltip (Pix-3925)
|
|
20
78
|
- [#179](https://github.com/1024pix/pix-ui/pull/179) [TECH] Mise à jour du template de pull request pour faire apparaître plus clairement les BREAKING_CHANGES
|
|
21
79
|
- [#148](https://github.com/1024pix/pix-ui/pull/148) [TECH] Formatter les fichiers avec prettier (PIX-3469)
|
|
22
80
|
|
|
23
81
|
### :bug: Bug fix
|
|
24
|
-
- [#147](https://github.com/1024pix/pix-ui/pull/147) [
|
|
82
|
+
- [#147](https://github.com/1024pix/pix-ui/pull/147) [BREAKING_CHANGES] Ajout de l'évènement onChange afin de supprimer le message d'erreur lorsque l'utilisateur modifie sa saisie (PIX-3476)
|
|
25
83
|
|
|
26
84
|
### :coffee: Various
|
|
27
85
|
- [#178](https://github.com/1024pix/pix-ui/pull/178) [DOC] Améliorer l'information sur les breaking changes dans Pix UI
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
<div class="pix-collapsible {{if this.isUnCollapsed
|
|
1
|
+
<div class="pix-collapsible {{if this.isUnCollapsed 'pix-collapsible--uncollapsed'}}">
|
|
2
2
|
|
|
3
3
|
<button
|
|
4
4
|
type="button"
|
|
5
5
|
{{on "click" this.toggleCollapsible}}
|
|
6
|
-
class="pix-collapsible__title {{if this.isUnCollapsed
|
|
6
|
+
class="pix-collapsible__title {{if this.isUnCollapsed 'pix-collapsible__title--uncollapsed'}}"
|
|
7
7
|
aria-controls={{this.contentId}}
|
|
8
8
|
aria-expanded={{if this.isUnCollapsed "true" "false"}}
|
|
9
9
|
...attributes
|
|
@@ -15,14 +15,14 @@
|
|
|
15
15
|
{{this.title}}
|
|
16
16
|
</span>
|
|
17
17
|
|
|
18
|
-
<FaIcon @icon="{{if this.isCollapsed
|
|
18
|
+
<FaIcon @icon="{{if this.isCollapsed 'plus' 'minus'}}" class="pix-collapsible-title__icon" />
|
|
19
19
|
</button>
|
|
20
20
|
|
|
21
21
|
<div
|
|
22
22
|
id={{this.contentId}}
|
|
23
23
|
aria-hidden={{if this.isCollapsed "true" "false"}}
|
|
24
24
|
class="pix-collapsible__content
|
|
25
|
-
{{if this.isUnCollapsed
|
|
25
|
+
{{if this.isUnCollapsed ' pix-collapsible__content--uncollapse'}}"
|
|
26
26
|
>
|
|
27
27
|
{{yield}}
|
|
28
28
|
</div>
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
<div class="pix-dropdown">
|
|
2
|
+
|
|
3
|
+
{{#if this.label}}
|
|
4
|
+
<label id={{@id}} class="pix-dropdown__label">
|
|
5
|
+
{{#if @requiredLabel}}
|
|
6
|
+
<abbr title={{@requiredLabel}} class="mandatory-mark" aria-hidden="true">*</abbr>
|
|
7
|
+
{{/if}}
|
|
8
|
+
{{this.label}}
|
|
9
|
+
</label>
|
|
10
|
+
{{/if}}
|
|
11
|
+
|
|
12
|
+
<div class="pix-dropdown__controller">
|
|
13
|
+
<button
|
|
14
|
+
type="button"
|
|
15
|
+
class="pix-dropdown__controller--placeholder{{if this.isExpanded ' expanded'}}"
|
|
16
|
+
aria-label={{if this.isExpanded @collapseLabel @expandLabel}}
|
|
17
|
+
{{on "click" this.toggleDropdown}}
|
|
18
|
+
{{on "keyup" this.navigateThroughOptions}}
|
|
19
|
+
...attributes
|
|
20
|
+
>
|
|
21
|
+
<p
|
|
22
|
+
title={{this.placeholder}}
|
|
23
|
+
class="pix-dropdown__controller--placeholder-text
|
|
24
|
+
{{unless this.hasSelectedOption ' default'}}"
|
|
25
|
+
aria-required={{if this.requiredLabel true false}}
|
|
26
|
+
>{{this.placeholder}}</p>
|
|
27
|
+
</button>
|
|
28
|
+
|
|
29
|
+
{{#if this.hasSelectedOption}}
|
|
30
|
+
<button
|
|
31
|
+
type="button"
|
|
32
|
+
class="pix-dropdown__controller--clear"
|
|
33
|
+
{{on "click" this.clearSelection}}
|
|
34
|
+
aria-label={{@clearLabel}}
|
|
35
|
+
>
|
|
36
|
+
<FaIcon @icon="times" />
|
|
37
|
+
</button>
|
|
38
|
+
{{/if}}
|
|
39
|
+
|
|
40
|
+
<button
|
|
41
|
+
tabindex="-1"
|
|
42
|
+
type="button"
|
|
43
|
+
class="pix-dropdown__controller--chevron"
|
|
44
|
+
{{on "click" this.toggleDropdown}}
|
|
45
|
+
>
|
|
46
|
+
<FaIcon @icon={{if this.isExpanded "chevron-up" "chevron-down"}} />
|
|
47
|
+
</button>
|
|
48
|
+
</div>
|
|
49
|
+
|
|
50
|
+
<div
|
|
51
|
+
role="listbox"
|
|
52
|
+
id={{this.menuId}}
|
|
53
|
+
tabindex="-1"
|
|
54
|
+
class="pix-dropdown__menu{{if this.isExpanded ' expanded'}}"
|
|
55
|
+
aria-labelledby={{if this.label @id}}
|
|
56
|
+
aria-label={{unless this.label @placeholder}}
|
|
57
|
+
aria-hidden={{if this.isExpanded "false" "true"}}
|
|
58
|
+
aria-activedescendant={{if this.selectedOption this.selectedOption.value}}
|
|
59
|
+
{{on "keyup" this.navigateThroughOptions}}
|
|
60
|
+
{{on "scroll" this.incrementPage}}
|
|
61
|
+
>
|
|
62
|
+
|
|
63
|
+
{{#if @isSearchable}}
|
|
64
|
+
<div class="pix-dropdown__menu--search">
|
|
65
|
+
<FaIcon class="pix-dropdown__menu--search-icon" @icon="search" />
|
|
66
|
+
<label
|
|
67
|
+
class="pix-dropdown__menu--search-input-label"
|
|
68
|
+
for={{this.searchInputId}}
|
|
69
|
+
>{{@searchPlaceholder}}</label>
|
|
70
|
+
<input
|
|
71
|
+
class="pix-dropdown__menu--search-input"
|
|
72
|
+
id={{this.searchInputId}}
|
|
73
|
+
autocomplete="off"
|
|
74
|
+
tabindex={{unless this.isExpanded "-1"}}
|
|
75
|
+
placeholder={{@searchPlaceholder}}
|
|
76
|
+
{{on "input" this.filterOptions}}
|
|
77
|
+
/>
|
|
78
|
+
</div>
|
|
79
|
+
{{/if}}
|
|
80
|
+
|
|
81
|
+
{{#each this.options as |opt index|}}
|
|
82
|
+
{{#if (lt index this.showLimit)}}
|
|
83
|
+
<div
|
|
84
|
+
role="option"
|
|
85
|
+
id={{opt.value}}
|
|
86
|
+
tabindex="-1"
|
|
87
|
+
class="pix-dropdown__menu--option{{if
|
|
88
|
+
(eq this.selectedOption.value opt.value)
|
|
89
|
+
' selected'
|
|
90
|
+
}}"
|
|
91
|
+
aria-selected={{if (eq this.selectedOption.value opt.value) "true"}}
|
|
92
|
+
{{on "click" (fn this.selectOption opt)}}
|
|
93
|
+
{{on "mouseover" this.resetPreviouslyFocused}}
|
|
94
|
+
{{on "keypress" (fn this.onOptionKeyPress opt)}}
|
|
95
|
+
>
|
|
96
|
+
{{opt.label}}
|
|
97
|
+
</div>
|
|
98
|
+
{{/if}}
|
|
99
|
+
{{/each}}
|
|
100
|
+
</div>
|
|
101
|
+
|
|
102
|
+
</div>
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { tracked } from '@glimmer/tracking';
|
|
3
|
+
import { action } from '@ember/object';
|
|
4
|
+
|
|
5
|
+
export default class PixDropdown extends Component {
|
|
6
|
+
defaultId = Math.floor(Math.random() * 100);
|
|
7
|
+
focusedOption = null;
|
|
8
|
+
focusedIndex = null;
|
|
9
|
+
@tracked page = 1;
|
|
10
|
+
@tracked selectedOption = null;
|
|
11
|
+
@tracked isExpanded = false;
|
|
12
|
+
@tracked options = this.args.options;
|
|
13
|
+
@tracked menuId = `menu-${this.defaultId}`;
|
|
14
|
+
@tracked searchInputId = `search-input-${this.defaultId}`;
|
|
15
|
+
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
|
|
19
|
+
if (!this.args.label && !this.args.placeholder) {
|
|
20
|
+
throw new Error(
|
|
21
|
+
'ERROR in PixDropdown component, you need to provide a label and/or a placeholder'
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (this.args.selectedOption) {
|
|
26
|
+
this.selectedOption = this.args.options.find(
|
|
27
|
+
({ value }) => value === this.args.selectedOption
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
get hasSelectedOption() {
|
|
33
|
+
return !!this.selectedOption;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
get placeholder() {
|
|
37
|
+
return this.selectedOption?.label || this.args.placeholder;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
get label() {
|
|
41
|
+
const labelIsDefined = this.args.label?.trim();
|
|
42
|
+
const idIsNotDefined = !this.args.id?.trim();
|
|
43
|
+
|
|
44
|
+
if (labelIsDefined && idIsNotDefined) {
|
|
45
|
+
throw new Error('ERROR in PixDropdown component, @id param is necessary when giving @label');
|
|
46
|
+
}
|
|
47
|
+
return this.args.label || null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
get showLimit() {
|
|
51
|
+
if (!this.args.pageSize) return this.options.length;
|
|
52
|
+
|
|
53
|
+
const numberOfOptionsAccordingToPage = this.args.pageSize * this.page;
|
|
54
|
+
return Math.min(this.options.length, numberOfOptionsAccordingToPage);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@action
|
|
58
|
+
resetPreviouslyFocused() {
|
|
59
|
+
if (!this.focusedOption) return;
|
|
60
|
+
|
|
61
|
+
const previouslyFocusedElement = document.getElementById(this.focusedOption.value);
|
|
62
|
+
previouslyFocusedElement?.blur();
|
|
63
|
+
this.focusedOption = undefined;
|
|
64
|
+
this.focusedIndex = undefined;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
_navigateToOption(option, index) {
|
|
68
|
+
if (!option) return;
|
|
69
|
+
|
|
70
|
+
this.resetPreviouslyFocused();
|
|
71
|
+
this.focusedOption = option;
|
|
72
|
+
this.focusedIndex = index;
|
|
73
|
+
const focusedElement = document.getElementById(option.value);
|
|
74
|
+
focusedElement?.scrollIntoView({ block: 'nearest' });
|
|
75
|
+
focusedElement?.focus();
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
_computeNextIndex(isArrowDown, index) {
|
|
79
|
+
const length = this.showLimit;
|
|
80
|
+
let nextIndex;
|
|
81
|
+
if (index === undefined || index === null) {
|
|
82
|
+
nextIndex = isArrowDown ? 0 : length - 1;
|
|
83
|
+
} else {
|
|
84
|
+
const delta = isArrowDown ? 1 : -1;
|
|
85
|
+
nextIndex = index + delta;
|
|
86
|
+
}
|
|
87
|
+
// navigate through array in a circle
|
|
88
|
+
// (i.e. go back to first after last or last after first)
|
|
89
|
+
return ((nextIndex % length) + length) % length;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
@action
|
|
93
|
+
navigateThroughOptions(event) {
|
|
94
|
+
const isArrowDown = event.code === 'ArrowDown';
|
|
95
|
+
if (event.code !== 'ArrowUp' && !isArrowDown) return;
|
|
96
|
+
const nextIndex = this._computeNextIndex(isArrowDown, this.focusedIndex);
|
|
97
|
+
this._navigateToOption(this.options[nextIndex], nextIndex);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
@action
|
|
101
|
+
toggleDropdown() {
|
|
102
|
+
this.isExpanded = !this.isExpanded;
|
|
103
|
+
|
|
104
|
+
if (this.isExpanded) {
|
|
105
|
+
this.resetPreviouslyFocused();
|
|
106
|
+
const searchInput = document.getElementById(this.searchInputId);
|
|
107
|
+
if (searchInput) {
|
|
108
|
+
searchInput.focus();
|
|
109
|
+
} else {
|
|
110
|
+
this._navigateToOption(this.options[0], 0);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const menu = document.getElementById(this.menuId);
|
|
115
|
+
menu.scrollTop = 0;
|
|
116
|
+
this.page = 1;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
@action
|
|
120
|
+
selectOption(option) {
|
|
121
|
+
if (this.selectedOption?.value !== option.value) {
|
|
122
|
+
this.args.onSelect?.(option.value);
|
|
123
|
+
this.selectedOption = option;
|
|
124
|
+
}
|
|
125
|
+
this.isExpanded = false;
|
|
126
|
+
|
|
127
|
+
const searchInput = document.getElementById(this.searchInputId);
|
|
128
|
+
if (searchInput) {
|
|
129
|
+
searchInput.value = '';
|
|
130
|
+
this.options = this.args.options;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
@action
|
|
135
|
+
onOptionKeyPress(option, event) {
|
|
136
|
+
if (event.code === 'Enter' || event.code === 'Space') this.selectOption(option);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
@action
|
|
140
|
+
clearSelection(event) {
|
|
141
|
+
event.stopPropagation();
|
|
142
|
+
event.preventDefault();
|
|
143
|
+
this.selectedOption = null;
|
|
144
|
+
this._navigateToOption(this.options[0], 0);
|
|
145
|
+
this.args.onSelect?.();
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
@action
|
|
149
|
+
onClearKeyPress(event) {
|
|
150
|
+
if (event.code === 'Enter' || event.code === 'Space') this.clearSelection(event);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
@action
|
|
154
|
+
filterOptions(event) {
|
|
155
|
+
this.resetPreviouslyFocused();
|
|
156
|
+
const filterValue = event.target?.value.toLowerCase();
|
|
157
|
+
this.page = 1;
|
|
158
|
+
this.options = filterValue
|
|
159
|
+
? this.args.options.filter(({ label }) => label.toLowerCase().includes(filterValue))
|
|
160
|
+
: this.args.options;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
_isLastOptionVisible(option) {
|
|
164
|
+
const lastVisibleOption = document.getElementById(option.value);
|
|
165
|
+
const menu = document.getElementById(this.menuId);
|
|
166
|
+
|
|
167
|
+
const { bottom, height, top } = lastVisibleOption.getBoundingClientRect();
|
|
168
|
+
const menuRect = menu.getBoundingClientRect();
|
|
169
|
+
|
|
170
|
+
return top <= menuRect.top ? menuRect.top - top <= height : bottom - menuRect.bottom <= height;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
@action
|
|
174
|
+
incrementPage() {
|
|
175
|
+
if (!this.args.pageSize) return;
|
|
176
|
+
|
|
177
|
+
if (this._isLastOptionVisible(this.options[this.showLimit - 1])) {
|
|
178
|
+
this.page += 1;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
aria-label={{this.ariaLabel}}
|
|
4
4
|
class="pix-icon-button pix-icon-button--{{this.size}}
|
|
5
5
|
pix-icon-button--{{this.color}}
|
|
6
|
-
{{if @withBackground
|
|
6
|
+
{{if @withBackground ' pix-icon-button--background'}}"
|
|
7
7
|
{{on "click" this.triggerAction}}
|
|
8
8
|
...attributes
|
|
9
9
|
>
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
{{/if}}
|
|
8
8
|
<div
|
|
9
9
|
class="pix-input-password__container
|
|
10
|
-
{{if @errorMessage
|
|
11
|
-
{{if @prefix
|
|
10
|
+
{{if @errorMessage 'pix-input-password__error-container'}}
|
|
11
|
+
{{if @prefix 'pix-input-password__with-prefix'}}"
|
|
12
12
|
>
|
|
13
13
|
|
|
14
14
|
{{#if @prefix}}
|
|
@@ -20,22 +20,23 @@
|
|
|
20
20
|
type={{if this.isPasswordVisible "text" "password"}}
|
|
21
21
|
value={{@value}}
|
|
22
22
|
aria-label={{this.ariaLabel}}
|
|
23
|
-
{{on "change" this.onChange}}
|
|
24
23
|
...attributes
|
|
25
24
|
/>
|
|
26
25
|
|
|
27
26
|
<PixIconButton
|
|
28
|
-
class="pix-input-password__button {{if @errorMessage
|
|
27
|
+
class="pix-input-password__button {{if @errorMessage ' pix-input-password__error-button'}}"
|
|
29
28
|
@icon={{if this.isPasswordVisible "eye" "eye-slash"}}
|
|
30
29
|
@ariaLabel={{if this.isPasswordVisible "Masquer le mot de passe" "Afficher le mot de passe"}}
|
|
31
30
|
@triggerAction={{this.togglePasswordVisibility}}
|
|
32
31
|
@size="small"
|
|
33
32
|
/>
|
|
34
33
|
|
|
34
|
+
{{#if @errorMessage}}
|
|
35
|
+
<FaIcon @icon="times" class="pix-input-password__error-icon" />
|
|
36
|
+
{{/if}}
|
|
35
37
|
</div>
|
|
36
38
|
|
|
37
39
|
{{#if @errorMessage}}
|
|
38
|
-
<FaIcon @icon="times" class="pix-input-password__error-icon" />
|
|
39
40
|
<label for={{this.id}} class="pix-input__error-message">{{@errorMessage}}</label>
|
|
40
41
|
{{/if}}
|
|
41
42
|
</div>
|
|
@@ -6,21 +6,19 @@
|
|
|
6
6
|
<label for={{this.id}} class="pix-input__information">{{@information}}</label>
|
|
7
7
|
{{/if}}
|
|
8
8
|
|
|
9
|
-
<
|
|
10
|
-
id={{this.id}}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
<div class="pix-input__container">
|
|
10
|
+
<input id={{this.id}} class={{this.className}} value={{@value}} ...attributes />
|
|
11
|
+
|
|
12
|
+
{{#if @errorMessage}}
|
|
13
|
+
<FaIcon @icon="times" class="pix-input__error-icon" />
|
|
14
|
+
{{/if}}
|
|
15
|
+
|
|
16
|
+
{{#if @icon}}
|
|
17
|
+
<FaIcon @icon={{@icon}} class="pix-input__icon {{if @isIconLeft 'pix-input__icon--left'}}" />
|
|
18
|
+
{{/if}}
|
|
19
|
+
</div>
|
|
16
20
|
|
|
17
21
|
{{#if @errorMessage}}
|
|
18
|
-
<FaIcon @icon="times" class="pix-input__error-icon" />
|
|
19
22
|
<label for={{this.id}} class="pix-input__error-message">{{@errorMessage}}</label>
|
|
20
23
|
{{/if}}
|
|
21
|
-
|
|
22
|
-
{{#if @icon}}
|
|
23
|
-
<FaIcon @icon={{@icon}} class="pix-input__icon {{if @isIconLeft "pix-input__icon--left"}}" />
|
|
24
|
-
{{/if}}
|
|
25
|
-
|
|
26
24
|
</div>
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
2
|
|
|
3
|
-
import { action } from '@ember/object';
|
|
4
3
|
export default class PixInput extends Component {
|
|
5
|
-
text = 'pix-input';
|
|
6
|
-
|
|
7
4
|
get id() {
|
|
8
5
|
if (!this.args.id || !this.args.id.toString().trim()) {
|
|
9
6
|
throw new Error('ERROR in PixInput component, @id param is not provided');
|
|
@@ -18,9 +15,4 @@ export default class PixInput extends Component {
|
|
|
18
15
|
this.args.isIconLeft && classNames.push('pix-input__input--icon-left');
|
|
19
16
|
return classNames.join(' ');
|
|
20
17
|
}
|
|
21
|
-
|
|
22
|
-
@action
|
|
23
|
-
onChange() {
|
|
24
|
-
if (typeof this.args.onChange === 'function') this.args.onChange();
|
|
25
|
-
}
|
|
26
18
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<div class="pix-modal__overlay">
|
|
2
|
+
<div
|
|
3
|
+
class="pix-modal"
|
|
4
|
+
role="dialog"
|
|
5
|
+
aria-labelledby="modal-title"
|
|
6
|
+
aria-describedby="modal-content"
|
|
7
|
+
aria-modal="true"
|
|
8
|
+
...attributes
|
|
9
|
+
>
|
|
10
|
+
<header class="pix-modal__header">
|
|
11
|
+
<h1 id="modal-title" class="pix-modal__title">{{@title}}</h1>
|
|
12
|
+
<PixIconButton
|
|
13
|
+
@icon="times"
|
|
14
|
+
@triggerAction={{@onCloseButtonClick}}
|
|
15
|
+
@ariaLabel="Fermer"
|
|
16
|
+
@size="small"
|
|
17
|
+
@withBackground={{true}}
|
|
18
|
+
class="pix-modal__close-button"
|
|
19
|
+
/>
|
|
20
|
+
</header>
|
|
21
|
+
<main id="modal-content" class="pix-modal__content">
|
|
22
|
+
{{yield to="content"}}
|
|
23
|
+
</main>
|
|
24
|
+
<footer class="pix-modal__footer">
|
|
25
|
+
{{yield to="footer"}}
|
|
26
|
+
</footer>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
|
|
3
|
+
export default class PixModal extends Component {
|
|
4
|
+
constructor(...args) {
|
|
5
|
+
super(...args);
|
|
6
|
+
|
|
7
|
+
if (!this.args.title) {
|
|
8
|
+
throw new Error('ERROR in PixModal component: @title argument is required.');
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
{{/if}}
|
|
6
6
|
|
|
7
7
|
{{#if @isSearchable}}
|
|
8
|
-
<label class="pix-multi-select-header {{if this.isBig
|
|
8
|
+
<label class="pix-multi-select-header {{if this.isBig 'pix-multi-select-header--big'}}">
|
|
9
9
|
|
|
10
10
|
<span class="pix-multi-select-header__title">{{@title}}</span>
|
|
11
11
|
<FaIcon @icon="search" class="pix-multi-select-header__search-icon" />
|
|
@@ -26,25 +26,25 @@
|
|
|
26
26
|
<button
|
|
27
27
|
id={{@id}}
|
|
28
28
|
type="button"
|
|
29
|
-
class="pix-multi-select-header {{if this.isBig
|
|
29
|
+
class="pix-multi-select-header {{if this.isBig 'pix-multi-select-header--big'}}"
|
|
30
30
|
{{on "click" this.toggleDropDown}}
|
|
31
31
|
>
|
|
32
32
|
{{@title}}
|
|
33
33
|
<FaIcon
|
|
34
34
|
class="pix-multi-select-header__dropdown-icon
|
|
35
|
-
{{if this.isExpanded
|
|
35
|
+
{{if this.isExpanded ' pix-multi-select-header__dropdown-icon--expand'}}"
|
|
36
36
|
@icon={{if this.isExpanded "chevron-up" "chevron-down"}}
|
|
37
37
|
/>
|
|
38
38
|
</button>
|
|
39
39
|
{{/if}}
|
|
40
40
|
|
|
41
|
-
<ul class="pix-multi-select-list {{unless this.isExpanded
|
|
41
|
+
<ul class="pix-multi-select-list {{unless this.isExpanded 'pix-multi-select-list--hidden'}}">
|
|
42
42
|
{{#if (gt this.results.length 0)}}
|
|
43
43
|
{{#each this.results as |option|}}
|
|
44
44
|
<li class="pix-multi-select-list__item">
|
|
45
45
|
<input
|
|
46
46
|
class="pix-multi-select-list__checkbox
|
|
47
|
-
{{if @isSearchable
|
|
47
|
+
{{if @isSearchable ' pix-multi-select-list__checkbox--searchable'}}"
|
|
48
48
|
type="checkbox"
|
|
49
49
|
checked={{option.checked}}
|
|
50
50
|
id={{concat @id "-" option.value}}
|
|
@@ -10,8 +10,9 @@
|
|
|
10
10
|
id={{@id}}
|
|
11
11
|
list="{{this.datalistId}}"
|
|
12
12
|
{{on "input" this.onChange}}
|
|
13
|
-
class="{{if this.isValid
|
|
13
|
+
class="{{if this.isValid 'pix-select--is-valid'}} {{if this.isBig 'pix-select--big'}}"
|
|
14
14
|
...attributes
|
|
15
|
+
autocomplete="off"
|
|
15
16
|
/>
|
|
16
17
|
|
|
17
18
|
<datalist id={{this.datalistId}}>
|
|
@@ -24,7 +25,7 @@
|
|
|
24
25
|
|
|
25
26
|
<select
|
|
26
27
|
id={{@id}}
|
|
27
|
-
class="{{if this.isBig
|
|
28
|
+
class="{{if this.isBig 'pix-select--big'}}"
|
|
28
29
|
{{on "change" this.onChange}}
|
|
29
30
|
...attributes
|
|
30
31
|
>
|