@1024pix/pix-ui 11.1.1 → 13.1.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 +37 -3
- package/addon/components/pix-block.hbs +1 -1
- package/addon/components/pix-collapsible.hbs +4 -4
- package/addon/components/pix-icon-button.hbs +1 -1
- package/addon/components/pix-input-password.hbs +3 -4
- package/addon/components/pix-input-password.js +0 -5
- package/addon/components/pix-input.hbs +2 -8
- 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/_pix-input.scss +1 -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/addon.scss +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/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 +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# Pix-UI Changelog
|
|
2
2
|
|
|
3
|
+
## v13.1.0 (16/02/2022)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### :building_construction: Tech
|
|
7
|
+
- [#194](https://github.com/1024pix/pix-ui/pull/194) [TECH] Mise a jour du package-lock.
|
|
8
|
+
- [#192](https://github.com/1024pix/pix-ui/pull/192) [TECH] Améliorer le blueprint pour auto-générer les nouveaux composants.
|
|
9
|
+
|
|
10
|
+
### :coffee: Various
|
|
11
|
+
- [#198](https://github.com/1024pix/pix-ui/pull/198) [FEAT] Permettre à la tooltip de ne pas s'afficher (PIX-4375)
|
|
12
|
+
- [#196](https://github.com/1024pix/pix-ui/pull/196) [FIX] Corriger les tests qui bloquent la pipeline.
|
|
13
|
+
- [#183](https://github.com/1024pix/pix-ui/pull/183) [DOC] Utiliser les champs de saisie natifs HTML plutôt que ceux d'Ember.
|
|
14
|
+
|
|
15
|
+
## v13.0.0 (27/01/2022)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### :coffee: Various
|
|
19
|
+
- [#188](https://github.com/1024pix/pix-ui/pull/188) [BREAKING_CHANGES] Input / InputPassword missing event on onChange (PIX-4243)
|
|
20
|
+
|
|
21
|
+
## v12.0.0 (24/01/2022)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### :rocket: Enhancement
|
|
25
|
+
- [#94](https://github.com/1024pix/pix-ui/pull/94) [FEATURE] Ajout du composant PixModal
|
|
26
|
+
|
|
27
|
+
### :bug: Bug fix
|
|
28
|
+
- [#186](https://github.com/1024pix/pix-ui/pull/186) [BREAKING_CHANGES] Désactiver l'autocomplete sur le composant Pix Select (PIX-4158)
|
|
29
|
+
- [#187](https://github.com/1024pix/pix-ui/pull/187) [BUGFIX] Rendre tout le tag sélectionnable (PIX-4179)
|
|
30
|
+
|
|
31
|
+
## v11.2.0 (14/01/2022)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### :coffee: Various
|
|
35
|
+
- [#185](https://github.com/1024pix/pix-ui/pull/185) [A11Y] Ajouter une nouvelle couleur dans la palette de PixTag (PIX-4109)
|
|
36
|
+
|
|
3
37
|
## v11.1.1 (17/12/2021)
|
|
4
38
|
|
|
5
39
|
|
|
@@ -10,7 +44,7 @@
|
|
|
10
44
|
|
|
11
45
|
|
|
12
46
|
### :building_construction: Tech
|
|
13
|
-
- [#175](https://github.com/1024pix/pix-ui/pull/175) [
|
|
47
|
+
- [#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)
|
|
14
48
|
|
|
15
49
|
## v11.0.1 (08/12/2021)
|
|
16
50
|
|
|
@@ -28,12 +62,12 @@
|
|
|
28
62
|
- [#177](https://github.com/1024pix/pix-ui/pull/177) [FEATURE] Création du composant Tag sélectionnable dans Pix UI (PIX-3757)
|
|
29
63
|
|
|
30
64
|
### :building_construction: Tech
|
|
31
|
-
- [#180](https://github.com/1024pix/pix-ui/pull/180) [
|
|
65
|
+
- [#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)
|
|
32
66
|
- [#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
|
|
33
67
|
- [#148](https://github.com/1024pix/pix-ui/pull/148) [TECH] Formatter les fichiers avec prettier (PIX-3469)
|
|
34
68
|
|
|
35
69
|
### :bug: Bug fix
|
|
36
|
-
- [#147](https://github.com/1024pix/pix-ui/pull/147) [
|
|
70
|
+
- [#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)
|
|
37
71
|
|
|
38
72
|
### :coffee: Various
|
|
39
73
|
- [#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>
|
|
@@ -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,12 +20,11 @@
|
|
|
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}}
|
|
@@ -7,20 +7,14 @@
|
|
|
7
7
|
{{/if}}
|
|
8
8
|
|
|
9
9
|
<div class="pix-input__container">
|
|
10
|
-
<input
|
|
11
|
-
id={{this.id}}
|
|
12
|
-
class={{this.className}}
|
|
13
|
-
value={{@value}}
|
|
14
|
-
{{on "change" this.onChange}}
|
|
15
|
-
...attributes
|
|
16
|
-
/>
|
|
10
|
+
<input id={{this.id}} class={{this.className}} value={{@value}} ...attributes />
|
|
17
11
|
|
|
18
12
|
{{#if @errorMessage}}
|
|
19
13
|
<FaIcon @icon="times" class="pix-input__error-icon" />
|
|
20
14
|
{{/if}}
|
|
21
15
|
|
|
22
16
|
{{#if @icon}}
|
|
23
|
-
<FaIcon @icon={{@icon}} class="pix-input__icon {{if @isIconLeft
|
|
17
|
+
<FaIcon @icon={{@icon}} class="pix-input__icon {{if @isIconLeft 'pix-input__icon--left'}}" />
|
|
24
18
|
{{/if}}
|
|
25
19
|
</div>
|
|
26
20
|
|
|
@@ -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
|
>
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
id={{@id}}
|
|
8
8
|
role="tooltip"
|
|
9
9
|
class="pix-tooltip__content pix-tooltip__content--{{this.position}}
|
|
10
|
-
{{if @isInline
|
|
11
|
-
{{if @isLight
|
|
12
|
-
{{if @isWide
|
|
10
|
+
{{if @isInline 'pix-tooltip__content--inline'}}
|
|
11
|
+
{{if @isLight 'pix-tooltip__content--light'}}
|
|
12
|
+
{{if @isWide 'pix-tooltip__content--wide'}}"
|
|
13
13
|
>
|
|
14
14
|
{{this.text}}
|
|
15
15
|
</span>
|
|
@@ -4,15 +4,17 @@
|
|
|
4
4
|
{{/if}}
|
|
5
5
|
|
|
6
6
|
{{#if (has-block "tooltip")}}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
{{#if this.display}}
|
|
8
|
+
<span
|
|
9
|
+
id={{@id}}
|
|
10
|
+
role="tooltip"
|
|
11
|
+
class="pix-tooltip__content pix-tooltip__content--{{this.position}}
|
|
12
|
+
{{if @isInline 'pix-tooltip__content--inline'}}
|
|
13
|
+
{{if @isLight 'pix-tooltip__content--light'}}
|
|
14
|
+
{{if @isWide 'pix-tooltip__content--wide'}}"
|
|
15
|
+
>
|
|
16
|
+
{{yield to="tooltip"}}
|
|
17
|
+
</span>
|
|
18
|
+
{{/if}}
|
|
17
19
|
{{/if}}
|
|
18
20
|
</span>
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
.pix-modal__overlay {
|
|
2
|
+
background-color: rgba(52, 69, 99, .7);
|
|
3
|
+
bottom: 0;
|
|
4
|
+
left: 0;
|
|
5
|
+
overflow-y: scroll;
|
|
6
|
+
position: fixed;
|
|
7
|
+
right: 0;
|
|
8
|
+
top: 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
$modal-padding: 24px;
|
|
12
|
+
$mobile-close-button-size: 32px;
|
|
13
|
+
$tablet-close-button-size: 40px;
|
|
14
|
+
$space-between-title-and-close-button: 8px;
|
|
15
|
+
$button-margin: 16px;
|
|
16
|
+
|
|
17
|
+
.pix-modal {
|
|
18
|
+
@import "reset-css";
|
|
19
|
+
box-shadow: 1px 1px 5px rgba(0,0,0,.1);
|
|
20
|
+
margin: 20vw auto;
|
|
21
|
+
max-width: 512px;
|
|
22
|
+
width: calc(100% - 24px);
|
|
23
|
+
|
|
24
|
+
&__header {
|
|
25
|
+
background: $white;
|
|
26
|
+
border-bottom: 1px solid $grey-20;
|
|
27
|
+
border-top-left-radius: 4px;
|
|
28
|
+
border-top-right-radius: 4px;
|
|
29
|
+
padding: $modal-padding;
|
|
30
|
+
position: relative;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&__close-button {
|
|
34
|
+
flex-shrink: 0;
|
|
35
|
+
right: $modal-padding;
|
|
36
|
+
position: absolute;
|
|
37
|
+
top: $modal-padding;
|
|
38
|
+
|
|
39
|
+
@include device-is('tablet') {
|
|
40
|
+
height: $tablet-close-button-size;
|
|
41
|
+
width: $tablet-close-button-size;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&__title {
|
|
46
|
+
margin-bottom: 0;
|
|
47
|
+
font-family: $font-open-sans;
|
|
48
|
+
color: $grey-90;
|
|
49
|
+
font-size: 1.25rem;
|
|
50
|
+
line-height: 1.875rem;
|
|
51
|
+
font-weight: $font-normal;
|
|
52
|
+
padding-right: $mobile-close-button-size + $space-between-title-and-close-button;
|
|
53
|
+
|
|
54
|
+
@include device-is('tablet') {
|
|
55
|
+
padding-right: $tablet-close-button-size + $space-between-title-and-close-button;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&__content {
|
|
60
|
+
background-color: $grey-10;
|
|
61
|
+
padding: $modal-padding;
|
|
62
|
+
font-size: 0.875rem;
|
|
63
|
+
color: $grey-90;
|
|
64
|
+
line-height: 1.375rem;
|
|
65
|
+
font-family: $font-roboto;
|
|
66
|
+
font-weight: $font-normal;
|
|
67
|
+
|
|
68
|
+
p:last-child {
|
|
69
|
+
margin-bottom: 0;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&__footer {
|
|
74
|
+
background-color: $grey-10;
|
|
75
|
+
padding: 0 $modal-padding $modal-padding - $button-margin;
|
|
76
|
+
border-bottom-left-radius: 4px;
|
|
77
|
+
border-bottom-right-radius: 4px;
|
|
78
|
+
|
|
79
|
+
@include device-is('tablet') {
|
|
80
|
+
display: flex;
|
|
81
|
+
justify-content: flex-end;
|
|
82
|
+
flex-wrap: wrap;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.pix-button {
|
|
86
|
+
margin-bottom: $button-margin;
|
|
87
|
+
width: 100%;
|
|
88
|
+
|
|
89
|
+
@include device-is('tablet') {
|
|
90
|
+
margin: 0 0 $button-margin $button-margin;
|
|
91
|
+
width: auto;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -50,6 +50,15 @@
|
|
|
50
50
|
background-color: lighten($yellow, 35%);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
&--orange {
|
|
54
|
+
background-color: $orange;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&--orange-light {
|
|
58
|
+
color: darken($orange, 25%);
|
|
59
|
+
background-color: lighten($orange, 35%);
|
|
60
|
+
}
|
|
61
|
+
|
|
53
62
|
&--grey {
|
|
54
63
|
color: $grey-15;
|
|
55
64
|
background-color: $grey-60;
|
package/addon/styles/addon.scss
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@1024pix/pix-ui/components/pix-modal-content';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@1024pix/pix-ui/components/pix-modal-footer';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@1024pix/pix-ui/components/pix-modal';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { hbs } from 'ember-cli-htmlbars';
|
|
2
|
+
|
|
3
|
+
export const modal = (args) => {
|
|
4
|
+
return {
|
|
5
|
+
template: hbs`
|
|
6
|
+
<PixModal @title={{this.title}}>
|
|
7
|
+
<:content>
|
|
8
|
+
<p>
|
|
9
|
+
Une fenêtre modale est, dans une interface graphique, une fenêtre qui prend le contrôle total du clavier et
|
|
10
|
+
de l'écran. Elle est en général associée à une question à laquelle il est impératif que l'utilisateur
|
|
11
|
+
réponde avant de poursuivre, ou de modifier quoi que ce soit. La fenêtre modale a pour propos : d'obtenir
|
|
12
|
+
des informations de l'utilisateur (ces informations sont nécessaires pour réaliser une opération) ; de
|
|
13
|
+
fournir une information à l'utilisateur (ce dernier doit en prendre connaissance avant de pouvoir continuer
|
|
14
|
+
à utiliser l'application).
|
|
15
|
+
</p>
|
|
16
|
+
</:content>
|
|
17
|
+
<:footer>
|
|
18
|
+
<PixButton @backgroundColor="transparent-light" @isBorderVisible="true">Annuler</PixButton>
|
|
19
|
+
<PixButton>Valider</PixButton>
|
|
20
|
+
</:footer>
|
|
21
|
+
</PixModal>
|
|
22
|
+
`,
|
|
23
|
+
context: args,
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const argTypes = {
|
|
28
|
+
title: {
|
|
29
|
+
name: 'title',
|
|
30
|
+
description: 'Titre de la modale',
|
|
31
|
+
type: { name: 'string', required: false },
|
|
32
|
+
defaultValue: "Qu'est-ce qu'une modale ?",
|
|
33
|
+
},
|
|
34
|
+
onCloseButtonClick: {
|
|
35
|
+
name: 'onCloseButtonClick',
|
|
36
|
+
description: 'Fonction à executer lors du clic sur le bouton de fermeture de la modale',
|
|
37
|
+
type: { name: 'function', required: true },
|
|
38
|
+
defaultValue: null,
|
|
39
|
+
},
|
|
40
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Meta, Story, Canvas, ArgsTable } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import centered from '@storybook/addon-centered/ember';
|
|
3
|
+
|
|
4
|
+
import * as stories from './pix-modal.stories.js';
|
|
5
|
+
|
|
6
|
+
<Meta
|
|
7
|
+
title='Basics/Modal'
|
|
8
|
+
component='PixModal'
|
|
9
|
+
decorators={[centered]}
|
|
10
|
+
argTypes={stories.argTypes}
|
|
11
|
+
/>
|
|
12
|
+
|
|
13
|
+
# PixModal
|
|
14
|
+
|
|
15
|
+
Une fenêtre modale responsive et scrollable avec un overlay.
|
|
16
|
+
|
|
17
|
+
Ce composant possède deux `yield` :
|
|
18
|
+
- `:content` est destiné à accueillir le contenu principal de la fenêtre modale. Il peut accueillir tout type de
|
|
19
|
+
contenu HTML (simple texte, image, formulaire, etc.)
|
|
20
|
+
- `:footer` peut également accueillir tout type de contenu HTML, mais est destiné aux boutons permettant d'interagir
|
|
21
|
+
avec la modale, ce qui permettra de les positionner correctement dans tous les cas de figure.
|
|
22
|
+
|
|
23
|
+
<Canvas>
|
|
24
|
+
<Story name='PixModal' story={stories.modal} height={500} />
|
|
25
|
+
</Canvas>
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
```html
|
|
30
|
+
<PixModal
|
|
31
|
+
@title="Qu'est-ce qu'une modale ?"
|
|
32
|
+
@onCloseButtonClick={{this.closeModal}}
|
|
33
|
+
>
|
|
34
|
+
<:content>
|
|
35
|
+
<p>
|
|
36
|
+
Une fenêtre modale est, dans une interface graphique, une fenêtre qui prend le contrôle total du clavier et
|
|
37
|
+
de l'écran. Elle est en général associée à une question à laquelle il est impératif que l'utilisateur
|
|
38
|
+
réponde avant de poursuivre, ou de modifier quoi que ce soit. La fenêtre modale a pour propos : d'obtenir
|
|
39
|
+
des informations de l'utilisateur (ces informations sont nécessaires pour réaliser une opération) ; de
|
|
40
|
+
fournir une information à l'utilisateur (ce dernier doit en prendre connaissance avant de pouvoir continuer
|
|
41
|
+
à utiliser l'application).
|
|
42
|
+
</p>
|
|
43
|
+
</:content>
|
|
44
|
+
<:footer>
|
|
45
|
+
<PixButton
|
|
46
|
+
@backgroundColor="transparent-light"
|
|
47
|
+
@isBorderVisible={{true}}
|
|
48
|
+
@triggerAction={{this.closeModal}}
|
|
49
|
+
>
|
|
50
|
+
Annuler
|
|
51
|
+
</PixButton>
|
|
52
|
+
<PixButton>Valider</PixButton>
|
|
53
|
+
</:footer>
|
|
54
|
+
</PixModal>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Arguments
|
|
58
|
+
|
|
59
|
+
<ArgsTable story="PixModal" />
|
|
@@ -36,14 +36,16 @@ export const argTypes = {
|
|
|
36
36
|
options: [
|
|
37
37
|
'blue',
|
|
38
38
|
'blue-light',
|
|
39
|
-
'purple',
|
|
40
|
-
'purple-light',
|
|
41
39
|
'green',
|
|
42
40
|
'green-light',
|
|
43
|
-
'yellow',
|
|
44
|
-
'yellow-light',
|
|
45
41
|
'grey',
|
|
46
42
|
'grey-light',
|
|
43
|
+
'purple',
|
|
44
|
+
'purple-light',
|
|
45
|
+
'orange',
|
|
46
|
+
'orange-light',
|
|
47
|
+
'yellow',
|
|
48
|
+
'yellow-light',
|
|
47
49
|
],
|
|
48
50
|
},
|
|
49
51
|
},
|
|
@@ -8,7 +8,8 @@ const Template = (args) => {
|
|
|
8
8
|
@position={{this.position}}
|
|
9
9
|
@isLight={{this.isLight}}
|
|
10
10
|
@isInline={{this.isInline}}
|
|
11
|
-
@isWide={{this.isWide}}
|
|
11
|
+
@isWide={{this.isWide}}
|
|
12
|
+
@hide={{this.hide}}>
|
|
12
13
|
<:triggerElement>
|
|
13
14
|
<PixButton aria-describedby={{this.id}}>
|
|
14
15
|
{{this.label}}
|
|
@@ -100,6 +101,13 @@ bottom.args = {
|
|
|
100
101
|
position: 'bottom',
|
|
101
102
|
};
|
|
102
103
|
|
|
104
|
+
export const hide = Template.bind({});
|
|
105
|
+
hide.args = {
|
|
106
|
+
label: 'À survoler pour voir la tooltip',
|
|
107
|
+
text: "Ne devrait pas s'afficher",
|
|
108
|
+
hide: true,
|
|
109
|
+
};
|
|
110
|
+
|
|
103
111
|
export const WithHTML = TemplateWithHTMLElement.bind({});
|
|
104
112
|
WithHTML.args = {
|
|
105
113
|
label: 'À survoler pour voir la tooltip',
|
|
@@ -154,4 +162,10 @@ export const argTypes = {
|
|
|
154
162
|
type: { name: 'boolean', required: false },
|
|
155
163
|
table: { defaultValue: { summary: false } },
|
|
156
164
|
},
|
|
165
|
+
hide: {
|
|
166
|
+
name: 'hide',
|
|
167
|
+
description: 'Masquer la tooltip',
|
|
168
|
+
type: { name: 'boolean', required: false },
|
|
169
|
+
table: { defaultValue: { summary: false } },
|
|
170
|
+
},
|
|
157
171
|
};
|
|
@@ -61,6 +61,13 @@ Les tooltips doivent prendre un `@id` et être référencées par leur élément
|
|
|
61
61
|
</PixTooltip>
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
+
## Hide
|
|
65
|
+
|
|
66
|
+
Cache la tooltip (par exemple si le contenu est vide).
|
|
67
|
+
|
|
68
|
+
<Canvas>
|
|
69
|
+
<Story name="Hide" story={stories.hide} height={200} />
|
|
70
|
+
</Canvas>
|
|
64
71
|
|
|
65
72
|
## Default
|
|
66
73
|
|
|
@@ -165,6 +172,18 @@ Infobulle contenant des éléments HTML
|
|
|
165
172
|
</:tooltip>
|
|
166
173
|
</PixTooltip>
|
|
167
174
|
|
|
175
|
+
<PixTooltip
|
|
176
|
+
@hide={{true}}
|
|
177
|
+
>
|
|
178
|
+
<:triggerElement>
|
|
179
|
+
<button>Tooltip n'apparaissant pas</button>
|
|
180
|
+
</:triggerElement>
|
|
181
|
+
|
|
182
|
+
<:tooltip>
|
|
183
|
+
Hey
|
|
184
|
+
</:tooltip>
|
|
185
|
+
</PixTooltip>
|
|
186
|
+
|
|
168
187
|
<PixTooltip
|
|
169
188
|
@isWide={{true}}
|
|
170
189
|
>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# 1. Eviter les balises HTML natives
|
|
2
|
+
|
|
3
|
+
Date : 2022-01-04
|
|
4
|
+
|
|
5
|
+
## État
|
|
6
|
+
|
|
7
|
+
Accepté
|
|
8
|
+
|
|
9
|
+
## Contexte
|
|
10
|
+
|
|
11
|
+
Le framework Ember propose des composants helpers tels que `<Input>` ou `<Textarea>`.
|
|
12
|
+
Cependant leurs comportements diffèrent pas mal des éléments HTML natifs `<input>` et `<textarea>`.
|
|
13
|
+
|
|
14
|
+
Nous aimerions choisir une seule solution pour :
|
|
15
|
+
- simplifiier l'utilisation de Pix-UI;
|
|
16
|
+
- ne plus avoir à modifier les composants (exemple sur [PixInput](https://github.com/1024pix/pix-ui/pull/147#discussion_r724312399)).
|
|
17
|
+
|
|
18
|
+
Actuellement, tous les composants Pix-UI utilisent des balises HTML natives sauf le PixTextarea qui utilise le `<Textarea>` d'Ember.
|
|
19
|
+
|
|
20
|
+
Historique des PRs qui ont mené à cette problématique :
|
|
21
|
+
- https://github.com/1024pix/pix-ui/pull/149 a changé le PixInputPassword et PixInput pour utiliser `<Input>` plutôt que `<input>` (embarqué dans la version v8.4.0 de Pix-UI).
|
|
22
|
+
- https://github.com/1024pix/pix-ui/pull/147/files a changé le PixInputPassword pour utiliser `<input>` plutôt que `<Input>` (embarqué dans la version v11.0.0 de Pix-UI).
|
|
23
|
+
- https://github.com/1024pix/pix-ui/pull/175/files a changé le PixInput pour utiliser `<input>` plutôt que `<Input>` (embarqué dans la version v11.1.0 de Pix-UI).
|
|
24
|
+
|
|
25
|
+
#### Solution 1
|
|
26
|
+
Privilégier l'utilisation des composants helpers que propose Ember (`<Input>` / `<Textarea>`).
|
|
27
|
+
|
|
28
|
+
Ce qui impliquerait :
|
|
29
|
+
- une solution plus "ember way"
|
|
30
|
+
- une obligation d'utiliser le two-way-binding (les modifications de valeurs dans un composant enfant seront automatiquement propagées au composant parent) qui va à l'encontre du principe Data Down Action Up (les données descendent vers les composants enfants et les enfants remontent les actions aux composants parents).
|
|
31
|
+
- plus de magie et moins de contrôle, lorsqu'on passe l'attribut `@value` Ember met tout à jour tout seul (le changement est répercuté partout)
|
|
32
|
+
- une obligation de copier le modèle pour ne pas le modifier
|
|
33
|
+
- une difficulté pour la validation de formulaire, avec la librairie `ember-cp-validation` les erreurs s'affichent dans le formulaire au moindre changement (ce qui n'est pas souhaitable) mais de toute manière on est pas sûrs de vouloir continuer à utiliser cette librairie.
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
#### Possibilité 2
|
|
37
|
+
Privilégier l'utilisation des éléments HTML natifs (`<input>` / `<textarea>`).
|
|
38
|
+
|
|
39
|
+
Ce qui impliquerait :
|
|
40
|
+
- de ne pas avoir le two-way-binding imposé
|
|
41
|
+
- une obligation de déclarer un `onChange` sur les champs afin d'interargir avec changements du champ
|
|
42
|
+
- une obligation de copier le modèle pour ne pas le modifier
|
|
43
|
+
- une plus grande maîtrise de la balise et ce qu'il s'y passe en coulisse
|
|
44
|
+
|
|
45
|
+
## Décision
|
|
46
|
+
|
|
47
|
+
Nous privilégierons les éléments HTML natifs et éviterons autant que possible le two-way-binding.
|
|
48
|
+
|
|
49
|
+
## Conséquences
|
|
50
|
+
|
|
51
|
+
Il faut mettre à jour le PixTextarea pour qu'il utilise une balise `<textarea>`.
|
|
52
|
+
|
|
53
|
+
⚠️ Pour ne pas casser le comportement existant. lors de la mise à jour des versions v11.0.0 / v11.1.0 de Pix-UI il faut mettre à jour tous les PixInput et PixInputPassword afin qu'il définissent un `onChange`.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Meta } from '@storybook/addon-docs/blocks';
|
|
2
|
+
|
|
3
|
+
<Meta title="Développement/Tester un composant en developpement dans une app" />
|
|
4
|
+
|
|
5
|
+
# Tester un composant en developpement dans une app
|
|
6
|
+
|
|
7
|
+
Il est possible de tester l'intégration d'un composant dans une application
|
|
8
|
+
Ember sans nécessairement créer une nouvelle release.
|
|
9
|
+
|
|
10
|
+
Pour cela, dans le repertoire de l'application Ember, installer Pix UI
|
|
11
|
+
en utilisant l'adresse du dépôt Github et le nom de la branche.
|
|
12
|
+
Par exemple :
|
|
13
|
+
|
|
14
|
+
```shell
|
|
15
|
+
npm install "git://github.com/1024pix/pix-ui#add-modal-component" --save-dev
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Une fois l'application Ember redémarrée, il sera possible d'accéder aux
|
|
19
|
+
composants Pix UI tels qu'ils sont dans la branche en cours de développement.
|