@1024pix/pix-ui 13.4.3 → 13.5.1

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 CHANGED
@@ -1,5 +1,23 @@
1
1
  # Pix-UI Changelog
2
2
 
3
+ ## v13.5.1 (12/04/2022)
4
+
5
+
6
+ ### :bug: Correction
7
+ - [#211](https://github.com/1024pix/pix-ui/pull/211) [BUGFIX] Ne permettre qu'un label dans les composants Pix Input et Input Password (PIX-4125).
8
+
9
+ ## v13.5.0 (11/04/2022)
10
+
11
+
12
+ ### :rocket: Amélioration
13
+ - [#204](https://github.com/1024pix/pix-ui/pull/204) [FEATURE] Permettre de rendre Pix Input et Pix Input Password obligatoires (PIX-4138).
14
+
15
+ ## v13.4.4 (11/04/2022)
16
+
17
+
18
+ ### :bug: Correction
19
+ - [#209](https://github.com/1024pix/pix-ui/pull/209) [BUGFIX] Remplace la page courante si elle n'existe plus
20
+
3
21
  ## v13.4.2 (07/04/2022)
4
22
 
5
23
 
@@ -1,9 +1,16 @@
1
1
  <div class="pix-input-password">
2
2
  {{#if this.label}}
3
- <label for={{this.id}} class="pix-input__label">{{this.label}}</label>
4
- {{/if}}
5
- {{#if @information}}
6
- <label for={{this.id}} class="pix-input__information">{{@information}}</label>
3
+ <label for={{this.id}} class="pix-input__label">
4
+ {{#if @requiredLabel}}
5
+ <abbr title={{@requiredLabel}} class="mandatory-mark" aria-hidden="true">*</abbr>
6
+ {{/if}}
7
+
8
+ {{this.label}}
9
+
10
+ {{#if @information}}
11
+ <span class="pix-input__information">{{@information}}</span>
12
+ {{/if}}
13
+ </label>
7
14
  {{/if}}
8
15
  <div
9
16
  class="pix-input-password__container
@@ -20,6 +27,9 @@
20
27
  type={{if this.isPasswordVisible "text" "password"}}
21
28
  value={{@value}}
22
29
  aria-label={{this.ariaLabel}}
30
+ aria-required="{{if @requiredLabel true false}}"
31
+ required={{if @requiredLabel true false}}
32
+ aria-describedby={{if @errorMessage "text-input-password-error"}}
23
33
  ...attributes
24
34
  />
25
35
 
@@ -37,6 +47,6 @@
37
47
  </div>
38
48
 
39
49
  {{#if @errorMessage}}
40
- <label for={{this.id}} class="pix-input__error-message">{{@errorMessage}}</label>
50
+ <p id="text-input-password-error" class="pix-input__error-message">{{@errorMessage}}</p>
41
51
  {{/if}}
42
52
  </div>
@@ -1,13 +1,28 @@
1
1
  <div class="pix-input">
2
2
  {{#if @label}}
3
- <label for={{this.id}} class="pix-input__label">{{@label}}</label>
4
- {{/if}}
5
- {{#if @information}}
6
- <label for={{this.id}} class="pix-input__information">{{@information}}</label>
3
+ <label for={{this.id}} class="pix-input__label">
4
+ {{#if @requiredLabel}}
5
+ <abbr title={{@requiredLabel}} class="mandatory-mark" aria-hidden="true">*</abbr>
6
+ {{/if}}
7
+
8
+ {{@label}}
9
+
10
+ {{#if @information}}
11
+ <span class="pix-input__information">{{@information}}</span>
12
+ {{/if}}
13
+ </label>
7
14
  {{/if}}
8
15
 
9
16
  <div class="pix-input__container">
10
- <input id={{this.id}} class={{this.className}} value={{@value}} ...attributes />
17
+ <input
18
+ id={{this.id}}
19
+ class={{this.className}}
20
+ value={{@value}}
21
+ aria-required="{{if @requiredLabel true false}}"
22
+ required={{if @requiredLabel true false}}
23
+ aria-describedby={{if @errorMessage "text-input-error"}}
24
+ ...attributes
25
+ />
11
26
 
12
27
  {{#if @errorMessage}}
13
28
  <FaIcon @icon="times" class="pix-input__error-icon" />
@@ -19,6 +34,6 @@
19
34
  </div>
20
35
 
21
36
  {{#if @errorMessage}}
22
- <label for={{this.id}} class="pix-input__error-message">{{@errorMessage}}</label>
37
+ <p id="text-input-error" class="pix-input__error-message">{{@errorMessage}}</p>
23
38
  {{/if}}
24
39
  </div>
@@ -1,4 +1,4 @@
1
- <footer class={{this.isCondensed}}>
1
+ <footer class={{this.isCondensed}} {{did-update this.checkCurrentPageAgainstPageCount @pagination}}>
2
2
  <section class="pix-pagination__size">
3
3
  <span class="pagination-size__label">{{this.beforeResultsPerPage}}</span>
4
4
  <PixSelect
@@ -118,4 +118,13 @@ export default class PixPagination extends Component {
118
118
  goToPreviousPage() {
119
119
  this.router.replaceWith({ queryParams: { pageNumber: this.previousPage } });
120
120
  }
121
+
122
+ @action
123
+ checkCurrentPageAgainstPageCount() {
124
+ const pageCount = this.args.pagination.pageCount;
125
+ if (pageCount === 0) return;
126
+ if (this.currentPage > pageCount) {
127
+ this.router.replaceWith({ queryParams: { pageNumber: pageCount } });
128
+ }
129
+ }
121
130
  }
@@ -6,14 +6,19 @@
6
6
  position: relative;
7
7
 
8
8
  &__label {
9
- @include label();
9
+ font-family: $font-roboto;
10
+ font-size: 0.875rem;
11
+ color: $grey-70;
12
+ margin-bottom: 4px;
10
13
  }
11
14
 
12
15
  &__information {
13
16
  font-family: $font-roboto;
14
17
  font-size: 0.75rem;
18
+ margin-top: 4px;
15
19
  color: $blue-zodiac;
16
- margin-bottom: 4px;
20
+
21
+ display: block;
17
22
  }
18
23
 
19
24
  &__container {
@@ -54,8 +59,12 @@
54
59
 
55
60
  &__error-message {
56
61
  @include errorMessage();
57
- margin-top: 4px;
62
+ margin-bottom: 0;
58
63
  bottom: calc(-4px - 1px - 0.75rem);
64
+
65
+ &.pix-input__error-message {
66
+ margin-top:4px;
67
+ }
59
68
  }
60
69
 
61
70
  input {
@@ -5,7 +5,7 @@ export const form = (args) => {
5
5
  return {
6
6
  template: hbs`
7
7
  <form>
8
- <PixInput @id='firstName' @label='Prénom' @errorMessage={{genericErrorMessage}} />
8
+ <PixInput @id='firstName' @label='Prénom' @errorMessage={{genericErrorMessage}} @requiredLabel='champ obligatoire'/>
9
9
  <br>
10
10
  <PixInputPassword @id='password' @label='Mot de passe' @errorMessage={{genericErrorMessage}} />
11
11
  <br>
@@ -13,7 +13,7 @@ export const form = (args) => {
13
13
  <PixMultiSelect
14
14
  @title="Votre notation en étoiles..."
15
15
  @id="form__pix-mutli-select"
16
- @label="A quel point aimez vous Pix-UI ?"
16
+ @label="A quel point aimez vous Pix UI ?"
17
17
  @onSelect={{onSelect}}
18
18
  @selected={{selected}}
19
19
  @options={{options}} as |star|
@@ -1,4 +1,4 @@
1
- import { Meta, Story, Canvas, ArgsTable } from '@storybook/addon-docs/blocks';
1
+ import { Meta, Story, Canvas } from '@storybook/addon-docs/blocks';
2
2
  import centered from '@storybook/addon-centered/ember';
3
3
  import * as stories from './form.stories.js';
4
4
 
@@ -12,5 +12,5 @@ import * as stories from './form.stories.js';
12
12
  Un formulaire complet avec les composants Pix UI :
13
13
 
14
14
  <Canvas>
15
- <Story name="Form" story={stories.form} height={600} />
15
+ <Story name="Form" story={stories.form} height={700} />
16
16
  </Canvas>
@@ -10,6 +10,7 @@ export const Template = (args) => {
10
10
  @information={{information}}
11
11
  @errorMessage={{errorMessage}}
12
12
  @prefix={{prefix}}
13
+ @requiredLabel={{requiredLabel}}
13
14
  />
14
15
  `,
15
16
  context: args,
@@ -43,6 +44,13 @@ withPrefix.args = {
43
44
  prefix: 'C -',
44
45
  };
45
46
 
47
+ export const withRequiredLabel = Template.bind({});
48
+ withRequiredLabel.args = {
49
+ id: 'password',
50
+ label: 'Mot de passe',
51
+ requiredLabel: 'Champ obligatoire',
52
+ };
53
+
46
54
  export const argTypes = {
47
55
  id: {
48
56
  name: 'id',
@@ -86,4 +94,13 @@ export const argTypes = {
86
94
  type: { name: 'string', required: false },
87
95
  defaultValue: null,
88
96
  },
97
+ requiredLabel: {
98
+ name: 'requiredLabel',
99
+ description:
100
+ 'Label indiquant que le champ est requis, le paramètre @label devient obligatoire avec ce paramètre.',
101
+ type: { name: 'string', required: false },
102
+ table: {
103
+ type: { summary: 'string' },
104
+ },
105
+ },
89
106
  };
@@ -41,7 +41,7 @@ Si vous utilisez le `PixInputPassword` sans label alors il faut renseigner le pa
41
41
  ## With error message
42
42
 
43
43
  <Canvas>
44
- <Story story={stories.withErrorMessage} height={130} />
44
+ <Story story={stories.withErrorMessage} height={100} />
45
45
  </Canvas>
46
46
 
47
47
  ## With prefix
@@ -50,16 +50,23 @@ Si vous utilisez le `PixInputPassword` sans label alors il faut renseigner le pa
50
50
  <Story story={stories.withPrefix} height={100} />
51
51
  </Canvas>
52
52
 
53
+ ## With required label
54
+
55
+ <Canvas>
56
+ <Story story={stories.withRequiredLabel} height={100} />
57
+ </Canvas>
58
+
53
59
  ## Usage
54
60
 
55
61
  ```html
56
62
  <PixInputPassword
57
- @id='{{id}}'
58
- @label='{{label}}'
59
- @information='{{information}}'
60
- @value='{{value}}'
61
- @errorMessage='{{errorMessage}}'
62
- @prefix='{{prefix}}'
63
+ @id='password'
64
+ @label='Mot de passe'
65
+ @information='8 caractères dont une majuscule...'
66
+ @value='pix123'
67
+ @errorMessage='Le mot de passe est erroné'
68
+ @prefix='C-'
69
+ @requiredLabel='Champ obligatoire'
63
70
  />
64
71
  ```
65
72
 
@@ -10,7 +10,9 @@ export const Template = (args) => {
10
10
  @errorMessage={{errorMessage}}
11
11
  @icon={{icon}}
12
12
  @isIconLeft={{isIconLeft}}
13
- placeholder='Jeanne, Pierre ...' />
13
+ placeholder='Jeanne, Pierre ...'
14
+ @requiredLabel={{requiredLabel}}
15
+ />
14
16
  `,
15
17
  context: args,
16
18
  };
@@ -43,6 +45,13 @@ withIcon.args = {
43
45
  icon: 'eye',
44
46
  };
45
47
 
48
+ export const withRequiredLabel = Template.bind({});
49
+ withRequiredLabel.args = {
50
+ id: 'firstName',
51
+ label: 'Prénom',
52
+ requiredLabel: 'Champ obligatoire',
53
+ };
54
+
46
55
  export const argTypes = {
47
56
  id: {
48
57
  name: 'id',
@@ -91,4 +100,13 @@ export const argTypes = {
91
100
  defaultValue: { summary: 'false' },
92
101
  },
93
102
  },
103
+ requiredLabel: {
104
+ name: 'requiredLabel',
105
+ description:
106
+ 'Label indiquant que le champ est requis, le paramètre @label devient obligatoire avec ce paramètre.',
107
+ type: { name: 'string', required: false },
108
+ table: {
109
+ type: { summary: 'string' },
110
+ },
111
+ },
94
112
  };
@@ -39,6 +39,12 @@ Le PixInput permet de créer un champ de texte.
39
39
  <Story story={stories.withIcon} height={130} />
40
40
  </Canvas>
41
41
 
42
+ ## With required label
43
+
44
+ <Canvas>
45
+ <Story story={stories.withRequiredLabel} height={130} />
46
+ </Canvas>
47
+
42
48
  ## Usage
43
49
 
44
50
  ```html
@@ -46,9 +52,11 @@ Le PixInput permet de créer un champ de texte.
46
52
  @id='firstName'
47
53
  @label='Prénom'
48
54
  @information='Complément du label'
49
- @errorMessage="Un message d'erreur"
50
- @icon="eye"
51
- @isIconLeft={{false}} />
55
+ @errorMessage='Un message d`erreur'
56
+ @icon='eye'
57
+ @isIconLeft={{false}}
58
+ @requiredLabel='Champ obligatoire'
59
+ />
52
60
  ```
53
61
 
54
62
  ## Arguments
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1024pix/pix-ui",
3
- "version": "13.4.3",
3
+ "version": "13.5.1",
4
4
  "description": "Pix-UI is the implementation of Pix design principles and guidelines for its products.",
5
5
  "keywords": [
6
6
  "ember-addon"
@@ -52,6 +52,7 @@
52
52
  "devDependencies": {
53
53
  "@1024pix/ember-testing-library": "^0.5.0",
54
54
  "@ember/optional-features": "^2.0.0",
55
+ "@ember/render-modifiers": "^2.0.4",
55
56
  "@ember/test-helpers": "^2.6.0",
56
57
  "@formatjs/intl": "^2.1.0",
57
58
  "@fortawesome/ember-fontawesome": "^0.2.3",