@1024pix/pix-ui 13.5.1 → 14.1.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
+ ## v14.1.1 (15/04/2022)
4
+
5
+
6
+ ### :bug: Correction
7
+ - [#214](https://github.com/1024pix/pix-ui/pull/214) [BUGFIX] Ajouter params à la méthode triggerAction à PixIconButton (PIX-4790)
8
+
9
+ ## v14.1.0 (12/04/2022)
10
+
11
+
12
+ ### :rocket: Amélioration
13
+ - [#213](https://github.com/1024pix/pix-ui/pull/213) [FEATURE] Retirer l'option d'ajouter une icône dans le composant Pix Input (PIX-4766).
14
+
15
+ ## v14.0.0 (12/04/2022)
16
+
17
+
18
+ ### :coffee: Autre
19
+ - [#212](https://github.com/1024pix/pix-ui/pull/212) [BREAKING_CHANGES][BUGFIX] Ajouter un aria-label au Pix Input (PIX-4759).
20
+
3
21
  ## v13.5.1 (12/04/2022)
4
22
 
5
23
 
@@ -25,9 +25,9 @@ export default class PixIconButton extends Component {
25
25
  }
26
26
 
27
27
  @action
28
- triggerAction() {
28
+ triggerAction(params) {
29
29
  if (this.args.triggerAction) {
30
- this.args.triggerAction();
30
+ this.args.triggerAction(params);
31
31
  }
32
32
  }
33
33
  }
@@ -16,8 +16,9 @@
16
16
  <div class="pix-input__container">
17
17
  <input
18
18
  id={{this.id}}
19
- class={{this.className}}
19
+ class={{if @errorMessage "pix-input__input--error"}}
20
20
  value={{@value}}
21
+ aria-label={{this.ariaLabel}}
21
22
  aria-required="{{if @requiredLabel true false}}"
22
23
  required={{if @requiredLabel true false}}
23
24
  aria-describedby={{if @errorMessage "text-input-error"}}
@@ -27,10 +28,6 @@
27
28
  {{#if @errorMessage}}
28
29
  <FaIcon @icon="times" class="pix-input__error-icon" />
29
30
  {{/if}}
30
-
31
- {{#if @icon}}
32
- <FaIcon @icon={{@icon}} class="pix-input__icon {{if @isIconLeft 'pix-input__icon--left'}}" />
33
- {{/if}}
34
31
  </div>
35
32
 
36
33
  {{#if @errorMessage}}
@@ -1,5 +1,7 @@
1
1
  import Component from '@glimmer/component';
2
2
 
3
+ const ERROR_MESSAGE = 'ERROR in PixInput component, you must provide @label or @ariaLabel params';
4
+
3
5
  export default class PixInput extends Component {
4
6
  get id() {
5
7
  if (!this.args.id || !this.args.id.toString().trim()) {
@@ -8,11 +10,17 @@ export default class PixInput extends Component {
8
10
  return this.args.id;
9
11
  }
10
12
 
11
- get className() {
12
- const classNames = [];
13
- this.args.errorMessage && classNames.push('pix-input__input--error');
14
- this.args.icon && classNames.push('pix-input__input--icon');
15
- this.args.isIconLeft && classNames.push('pix-input__input--icon-left');
16
- return classNames.join(' ');
13
+ get label() {
14
+ if (!this.args.label && !this.args.ariaLabel) {
15
+ throw new Error(ERROR_MESSAGE);
16
+ }
17
+ return this.args.label;
18
+ }
19
+
20
+ get ariaLabel() {
21
+ if (!this.args.label && !this.args.ariaLabel) {
22
+ throw new Error(ERROR_MESSAGE);
23
+ }
24
+ return this.args.label ? null : this.args.ariaLabel;
17
25
  }
18
26
  }
@@ -25,25 +25,6 @@
25
25
  position: relative;
26
26
  }
27
27
 
28
- svg.pix-input__icon {
29
- position: absolute;
30
- bottom: 9px;
31
- right: 6px;
32
- color: $grey-25;
33
- font-size: 1.125rem;
34
- width: 18px;
35
- height: 18px;
36
-
37
- &--left {
38
- left: 6px;
39
- }
40
- }
41
-
42
- svg ~ svg.pix-input__icon {
43
- right: calc(6px + 12px + 2px);
44
- margin-right: 8px;
45
- }
46
-
47
28
  svg.pix-input__error-icon {
48
29
  position: absolute;
49
30
  bottom: 10px;
@@ -84,17 +65,5 @@
84
65
  padding-right: 32px;
85
66
  @include formElementInError();
86
67
  }
87
-
88
- &.pix-input__input--icon {
89
- padding-right: 32px;
90
- }
91
-
92
- &.pix-input__input--icon.pix-input__input--icon-left {
93
- padding-left: 32px;
94
- }
95
-
96
- &.pix-input__input--error.pix-input__input--icon:not(.pix-input__input--icon-left) {
97
- padding-right: 32px;
98
- }
99
68
  }
100
69
  }
@@ -72,7 +72,7 @@ export const argTypes = {
72
72
  },
73
73
  ariaLabel: {
74
74
  name: 'ariaLabel',
75
- description: "L'action du bouton, pour l'accessibilité. Requis si label n'est pas définit.",
75
+ description: "L'action du champ, pour l'accessibilité. Requis si label n'est pas définit.",
76
76
  type: { name: 'string', required: true },
77
77
  defaultValue: null,
78
78
  },
@@ -8,10 +8,9 @@ export const Template = (args) => {
8
8
  @label={{label}}
9
9
  @information={{information}}
10
10
  @errorMessage={{errorMessage}}
11
- @icon={{icon}}
12
- @isIconLeft={{isIconLeft}}
13
11
  placeholder='Jeanne, Pierre ...'
14
12
  @requiredLabel={{requiredLabel}}
13
+ @ariaLabel={{ariaLabel}}
15
14
  />
16
15
  `,
17
16
  context: args,
@@ -21,6 +20,7 @@ export const Template = (args) => {
21
20
  export const Default = Template.bind({});
22
21
  Default.args = {
23
22
  id: 'firstName',
23
+ ariaLabel: 'Prénom',
24
24
  };
25
25
 
26
26
  export const withLabel = Template.bind({});
@@ -38,13 +38,6 @@ withErrorMessage.args = {
38
38
  errorMessage: "un message d'erreur",
39
39
  };
40
40
 
41
- export const withIcon = Template.bind({});
42
- withIcon.args = {
43
- id: 'firstName',
44
- label: 'Prénom',
45
- icon: 'eye',
46
- };
47
-
48
41
  export const withRequiredLabel = Template.bind({});
49
42
  withRequiredLabel.args = {
50
43
  id: 'firstName',
@@ -53,6 +46,12 @@ withRequiredLabel.args = {
53
46
  };
54
47
 
55
48
  export const argTypes = {
49
+ ariaLabel: {
50
+ name: 'ariaLabel',
51
+ description: "L'action du champ, pour l'accessibilité. Requis si label n'est pas définit.",
52
+ type: { name: 'string', required: true },
53
+ defaultValue: null,
54
+ },
56
55
  id: {
57
56
  name: 'id',
58
57
  description: 'Identifiant du champ permettant de lui attacher un label',
@@ -83,23 +82,6 @@ export const argTypes = {
83
82
  type: { name: 'string', required: false },
84
83
  defaultValue: null,
85
84
  },
86
- icon: {
87
- name: 'icon',
88
- description: "Affiche l'icône choisie à la fin de l'input",
89
- type: { name: 'string', required: false },
90
- defaultValue: null,
91
- },
92
- isIconLeft: {
93
- name: 'isIconLeft',
94
- description: "Permet d'afficher l'icône choisie sur la gauche",
95
- type: { name: 'boolean', required: false },
96
- control: { type: 'boolean' },
97
- defaultValue: false,
98
- table: {
99
- type: { summary: 'boolean' },
100
- defaultValue: { summary: 'false' },
101
- },
102
- },
103
85
  requiredLabel: {
104
86
  name: 'requiredLabel',
105
87
  description:
@@ -14,6 +14,12 @@ import * as stories from './pix-input.stories.js';
14
14
 
15
15
  Le PixInput permet de créer un champ de texte.
16
16
 
17
+ ## Accessibilité
18
+
19
+ Si vous utilisez le `PixInput` sans label alors il faut renseigner le paramètre `ariaLabel`, sinon le composant renvoie une erreur.
20
+
21
+ > Si vous renseignez les paramètres label et ariaLabel ensemble, ariaLabel sera nullifié.
22
+
17
23
 
18
24
  ## Default
19
25
 
@@ -33,12 +39,6 @@ Le PixInput permet de créer un champ de texte.
33
39
  <Story story={stories.withErrorMessage} height={130} />
34
40
  </Canvas>
35
41
 
36
- ## With icon
37
-
38
- <Canvas>
39
- <Story story={stories.withIcon} height={130} />
40
- </Canvas>
41
-
42
42
  ## With required label
43
43
 
44
44
  <Canvas>
@@ -53,8 +53,6 @@ Le PixInput permet de créer un champ de texte.
53
53
  @label='Prénom'
54
54
  @information='Complément du label'
55
55
  @errorMessage='Un message d`erreur'
56
- @icon='eye'
57
- @isIconLeft={{false}}
58
56
  @requiredLabel='Champ obligatoire'
59
57
  />
60
58
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1024pix/pix-ui",
3
- "version": "13.5.1",
3
+ "version": "14.1.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"