@1024pix/pix-ui 32.0.0 → 33.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.
@@ -7,24 +7,61 @@ workflows:
7
7
  version: 2
8
8
  build-and-test:
9
9
  jobs:
10
- - build-and-test:
10
+ - install:
11
11
  filters:
12
12
  branches:
13
13
  ignore:
14
14
  - gh-pages
15
+ - lint-and-test:
16
+ filters:
17
+ branches:
18
+ ignore:
19
+ - gh-pages
20
+ requires:
21
+ - install
22
+ - chromatic-deployment:
23
+ filters:
24
+ branches:
25
+ ignore:
26
+ - gh-pages
27
+ requires:
28
+ - install
15
29
 
16
30
  jobs:
17
- build-and-test:
31
+ install:
32
+ docker:
33
+ - image: cimg/node:16.19.1-browsers
34
+ resource_class: medium+
35
+ steps:
36
+ - checkout
37
+ - run: npm ci
38
+ - save_cache:
39
+ name: Save node modules
40
+ key: node_modules
41
+ paths:
42
+ - node_modules
43
+ lint-and-test:
18
44
  docker:
19
45
  - image: cimg/node:16.19.1-browsers
20
46
  resource_class: medium+
21
47
  steps:
22
48
  - checkout
49
+ - restore_cache:
50
+ name: Restore node modules
51
+ key: node_modules
23
52
  - browser-tools/install-chrome
24
53
  - browser-tools/install-chromedriver
25
- - run: npm ci
26
54
  - run: npm run lint:js
27
55
  - run: npm run lint:hbs
28
56
  - run: npm run lint:scss
29
57
  - run: npm test
30
58
  - run: npx ember try:one embroider-safe
59
+ chromatic-deployment:
60
+ docker:
61
+ - image: cimg/node:16.19.1-browsers
62
+ steps:
63
+ - checkout
64
+ - restore_cache:
65
+ name: Restore node modules
66
+ key: node_modules
67
+ - run: npm run chromatic -- --exit-zero-on-changes
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Pix-UI Changelog
2
2
 
3
+ ## v32.1.0 (27/04/2023)
4
+
5
+
6
+ ### :rocket: Amélioration
7
+ - [#389](https://github.com/1024pix/pix-ui/pull/389) [FEATURE] Ajouter l'argument requiredLabel au TextArea (PIX-7710)
8
+ - [#388](https://github.com/1024pix/pix-ui/pull/388) [FEATURE] Rectifier et uniformiser les composants Checkbox et Radio
9
+ - [#390](https://github.com/1024pix/pix-ui/pull/390) [FEATURE] Ajouter Chromatic (PIX-7872)
10
+ - [#386](https://github.com/1024pix/pix-ui/pull/386) [FEATURE] Améliorer le contraste du composant PixProgressGauge (PIX-7268)
11
+
3
12
  ## v32.0.0 (24/04/2023)
4
13
 
5
14
 
@@ -2,19 +2,17 @@
2
2
  <input
3
3
  id={{@id}}
4
4
  type="checkbox"
5
- class="pix-checkbox__input {{if @isIndeterminate ' pix-checkbox__input--indeterminate'}}"
5
+ class={{this.inputClasses}}
6
6
  checked={{@checked}}
7
7
  ...attributes
8
8
  />
9
9
 
10
10
  {{#if (has-block)}}
11
- <span
12
- class="pix-checkbox__label
13
- {{if @screenReaderOnly 'screen-reader-only'}}
14
- {{this.labelSizeClass}}"
15
- >{{yield}}</span>
11
+ <span class={{this.labelClasses}}>{{yield}}</span>
16
12
  {{else}}
17
- yield required to give a label for PixCheckBox
18
- {{@id}}.
13
+ <span>
14
+ yield required to give a label for PixCheckbox
15
+ {{@id}}.
16
+ </span>
19
17
  {{/if}}
20
18
  </label>
@@ -1,11 +1,5 @@
1
1
  import Component from '@glimmer/component';
2
2
 
3
- const labelSizeToClass = new Map([
4
- ['small', 'pix-checkbox__label--small'],
5
- ['default', 'pix-checkbox__label--default'],
6
- ['large', 'pix-checkbox__label--large'],
7
- ]);
8
-
9
3
  export default class PixCheckbox extends Component {
10
4
  constructor() {
11
5
  super(...arguments);
@@ -15,7 +9,27 @@ export default class PixCheckbox extends Component {
15
9
  }
16
10
  }
17
11
 
18
- get labelSizeClass() {
19
- return labelSizeToClass.get(this.args.labelSize);
12
+ get inputClasses() {
13
+ const classes = ['pix-checkbox__input'];
14
+
15
+ if (this.args.isIndeterminate) {
16
+ classes.push(`${classes[0]}--indeterminate`);
17
+ }
18
+
19
+ return classes.join(' ');
20
+ }
21
+
22
+ get labelClasses() {
23
+ const classes = ['pix-checkbox__label'];
24
+
25
+ if (this.args.labelSize) {
26
+ classes.push(`${classes[0]}--${this.args.labelSize}`);
27
+ }
28
+
29
+ if (this.args.screenReaderOnly) {
30
+ classes.push('screen-reader-only');
31
+ }
32
+
33
+ return classes.join(' ');
20
34
  }
21
35
  }
@@ -19,10 +19,10 @@ export default class PixProgressGauge extends Component {
19
19
  }
20
20
 
21
21
  get progressGaugeClass() {
22
- const availableColor = ['yellow', 'white'];
22
+ const availableColor = ['blue', 'white'];
23
23
 
24
24
  const color =
25
- this.args.color && availableColor.includes(this.args.color) ? this.args.color : `yellow`;
25
+ this.args.color && availableColor.includes(this.args.color) ? this.args.color : `blue`;
26
26
 
27
27
  return `progress-gauge--${color}`;
28
28
  }
@@ -1,12 +1,10 @@
1
- <div class="pix-radio-button">
2
- <label class="{{if @isDisabled ' pix-radio-button--disabled'}}">
3
- <input
4
- disabled={{@isDisabled}}
5
- aria-disabled="{{@isDisabled}}"
6
- type="radio"
7
- value={{@value}}
8
- ...attributes
9
- />
10
- {{@label}}
11
- </label>
12
- </div>
1
+ <label class="pix-radio-button">
2
+ <input
3
+ class="pix-radio-button__input"
4
+ type="radio"
5
+ value={{@value}}
6
+ disabled={{@isDisabled}}
7
+ ...attributes
8
+ />
9
+ <span class="pix-radio-button__label">{{@label}}</span>
10
+ </label>
@@ -1,16 +1,25 @@
1
1
  <div class="pix-textarea">
2
2
 
3
3
  {{#if this.label}}
4
- <label for={{@id}} class="pix-textarea__label">{{this.label}}</label>
4
+
5
+ <label for={{@id}} class="pix-textarea__label">
6
+ {{#if this.requiredLabel}}
7
+ <abbr title={{this.requiredLabel}} class="mandatory-mark" aria-hidden="true">*</abbr>
8
+ {{/if}}
9
+ {{this.label}}
10
+ </label>
5
11
  {{/if}}
6
12
 
7
13
  <Textarea
8
14
  id={{@id}}
9
15
  @value={{@value}}
10
16
  maxlength={{if @maxlength @maxlength}}
17
+ aria-required="{{if this.requiredLabel true false}}"
18
+ required={{if this.requiredLabel true false}}
11
19
  class="{{if @errorMessage 'pix-textarea--error'}}"
12
20
  ...attributes
13
21
  />
22
+
14
23
  {{#if @maxlength}}
15
24
  <p>{{this.textLengthIndicator}} / {{@maxlength}}</p>
16
25
  {{/if}}
@@ -7,11 +7,23 @@ export default class PixTextarea extends Component {
7
7
 
8
8
  get label() {
9
9
  const labelIsDefined = this.args.label?.trim();
10
- const idIsNotDefined = !this.args.id?.trim();
10
+ const idIsDefined = this.args.id?.trim();
11
11
 
12
- if (labelIsDefined && idIsNotDefined) {
12
+ if (labelIsDefined && !idIsDefined) {
13
13
  throw new Error('ERROR in PixTextarea component, @id param is necessary when giving @label');
14
14
  }
15
15
  return this.args.label || null;
16
16
  }
17
+
18
+ get requiredLabel() {
19
+ const idRequiredLabelDefined = this.args.requiredLabel?.trim();
20
+ const labelIsDefined = this.args.label?.trim();
21
+
22
+ if (idRequiredLabelDefined && !labelIsDefined) {
23
+ throw new Error(
24
+ 'ERROR in PixTextarea component, @label param is necessary when giving @requiredLabel'
25
+ );
26
+ }
27
+ return this.args.requiredLabel || null;
28
+ }
17
29
  }
@@ -1,74 +1,137 @@
1
1
  .pix-checkbox {
2
+ position: relative;
3
+ z-index: 0;
2
4
  align-items: center;
3
5
  display: flex;
4
6
  color: $pix-neutral-70;
5
7
  cursor: pointer;
6
8
 
7
- &__label {
8
- @extend %pix-body-m;
9
+ & + .pix-checkbox {
10
+ margin-top: $pix-spacing-s;
11
+ }
12
+ }
9
13
 
10
- &--small {
11
- @extend %pix-body-s;
12
- }
14
+ /* Label */
15
+ .pix-checkbox__label {
16
+ padding-left: 12px;
17
+ color: $pix-neutral-90;
18
+ font-size: 1rem;
19
+ line-height: 1.5;
20
+
21
+ &--small {
22
+ font-size: 0.875rem;
23
+ }
24
+
25
+ &--large {
26
+ font-size: 1.125rem;
27
+ }
28
+ }
29
+
30
+ /* Input */
31
+ .pix-checkbox__input {
32
+ position: relative;
33
+ width: 1rem;
34
+ height: 1rem;
35
+ background-color: $pix-neutral-0;
36
+ border: 1.5px solid $pix-neutral-70;
37
+ border-radius: 2px;
38
+ appearance: none;
39
+ cursor: pointer;
40
+
41
+ // Hover effect
42
+ &::before {
43
+ content: '';
44
+ position: absolute;
45
+ z-index: -1;
46
+ top: 50%;
47
+ left: 50%;
48
+ width: 1rem;
49
+ height: 1rem;
50
+ transform: translate(-50%, -50%) scale(1);
51
+ border-radius: 50%;
52
+ background-color: $pix-neutral-15;
53
+ visibility: hidden;
54
+ opacity: 0;
55
+ transition: all 0.3s ease;
56
+ }
57
+
58
+ &:hover,
59
+ &:focus-visible,
60
+ &:active {
61
+ border-color: $pix-neutral-90;
13
62
 
14
- &--large {
15
- @extend %pix-body-l;
63
+ &::before {
64
+ visibility: visible;
65
+ opacity: 1;
66
+ transform: translate(-50%, -50%) scale(1.75);
16
67
  }
17
68
  }
18
69
 
19
- input {
20
- cursor: pointer;
70
+ &:active {
71
+ &::before {
72
+ background-color: $pix-neutral-22;
73
+ }
21
74
  }
22
75
 
23
- &__input {
24
- appearance: none;
25
- margin: 0 10px;
26
- min-width: 18px;
27
- min-height: 18px;
28
- border: 1.2px solid $pix-neutral-90;
29
- border-radius: 2px;
30
- position: relative;
76
+ // Checked state
77
+ &:checked {
78
+ background: $pix-primary;
79
+ border-color: $pix-primary;
31
80
 
32
81
  &:hover,
33
- &:focus {
34
- box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1), 0 0 0 6px $pix-neutral-15;
82
+ &:focus-visible,
83
+ &:active {
84
+ background: $pix-primary-60;
85
+ border-color: $pix-primary-60;
35
86
  }
36
87
 
88
+ &::after {
89
+ content: '';
90
+ position: absolute;
91
+ inset: 10%;
92
+ background-repeat: no-repeat;
93
+ background-position: center;
94
+ background-size: contain;
95
+ background-image: url("data:image/svg+xml,%3Csvg width='13' height='10' viewBox='0 0 13 10' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1.5 3L0 4.5L5 9.5L13 1.5L11.5 0L5 6.5L1.5 3Z' fill='white'/%3E%3C/svg%3E%0A");
96
+ }
97
+ }
98
+
99
+ // Indeterminate state
100
+ &--indeterminate:checked {
101
+ background: $pix-neutral-70;
102
+ border-color: $pix-neutral-70;
103
+
104
+ &:hover,
105
+ &:focus-visible,
37
106
  &:active {
38
- box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1), 0 0 0 6px $pix-neutral-22;
107
+ background: $pix-neutral-90;
108
+ border-color: $pix-neutral-90;
109
+ }
110
+
111
+ &::after {
112
+ inset: 15%;
113
+ background-image: url("data:image/svg+xml,%3Csvg width='10' height='2' viewBox='0 0 10 2' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='10' height='2' fill='white'/%3E%3C/svg%3E%0A");
114
+ }
115
+ }
116
+
117
+ // Disabled state
118
+ &:disabled,
119
+ &--indeterminate:disabled {
120
+ background: $pix-neutral-10;
121
+ border-color: $pix-neutral-30;
122
+ cursor: not-allowed;
123
+
124
+ & + .pix-checkbox__label {
125
+ cursor: not-allowed;
39
126
  }
40
127
 
41
128
  &:checked {
42
- background: $pix-primary border-box;
43
- border-color: $pix-primary;
44
-
45
- &::after {
46
- content: '';
47
- background-image: url("data:image/svg+xml,%3Csvg width='13' height='10' viewBox='0 0 13 10' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1.5 3L0 4.5L5 9.5L13 1.5L11.5 0L5 6.5L1.5 3Z' fill='white'/%3E%3C/svg%3E%0A");
48
- background-repeat: no-repeat;
49
- background-position: center;
50
- width: 16px;
51
- height: 16px;
52
- position: absolute;
53
- top: 0;
54
- left: 0;
55
- }
129
+ background: $pix-neutral-30;
130
+ border-color: $pix-neutral-30;
56
131
  }
57
132
 
58
- &.pix-checkbox__input--indeterminate {
59
- &:checked {
60
- background: $pix-neutral-60 border-box;
61
- border-color: $pix-neutral-60;
62
-
63
- &::after {
64
- content: '';
65
- background-image: url("data:image/svg+xml,%3Csvg width='10' height='2' viewBox='0 0 10 2' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='10' height='2' fill='white'/%3E%3C/svg%3E%0A");
66
- background-repeat: no-repeat;
67
- background-position: center;
68
- width: 16px;
69
- height: 16px;
70
- }
71
- }
133
+ &::before {
134
+ display: none;
72
135
  }
73
136
  }
74
137
  }
@@ -6,7 +6,7 @@
6
6
 
7
7
  &__sub-title {
8
8
  font-size: 0.813rem;
9
- color: $pix-warning-40;
9
+ color: $pix-primary-60;
10
10
  margin: 6px 0;
11
11
  letter-spacing: 0.4px;
12
12
  text-transform: uppercase;
@@ -74,27 +74,26 @@
74
74
  }
75
75
  }
76
76
 
77
- &--yellow {
77
+ &--blue {
78
78
  & .progress-gauge__referrer {
79
79
  background-color: $pix-neutral-20;
80
80
  }
81
81
 
82
82
  & .progress-gauge__marker {
83
- background: $pix-secondary-app-gradient;
83
+ background-color: $pix-primary-60;
84
84
  }
85
85
 
86
86
  & .progress-gauge__tooltip {
87
- background: $pix-secondary-app-gradient;
87
+ background-color: $pix-primary-60;
88
88
  color: $pix-neutral-0;
89
89
 
90
90
  &::before {
91
- color: $pix-warning-40;
92
- border-top-color: $pix-warning-40;
91
+ border-top-color: $pix-primary-60;
93
92
  }
94
93
  }
95
94
 
96
95
  & .progress-gauge__sub-title {
97
- color: $pix-warning-40;
96
+ color: $pix-primary-60;
98
97
  }
99
98
  }
100
99
 
@@ -1,71 +1,95 @@
1
1
  .pix-radio-button {
2
+ display: flex;
3
+ align-items: center;
2
4
  cursor: pointer;
3
- font-size: 0.875rem;
4
- color: $pix-neutral-70;
5
5
 
6
- label {
7
- display: flex;
8
- align-items: center;
6
+ & + .pix-radio-button {
7
+ margin-top: $pix-spacing-s;
9
8
  }
10
9
 
11
- input {
12
- appearance: none;
10
+ &__label {
11
+ padding-left: 12px;
12
+ color: $pix-neutral-90;
13
+ font-size: 1rem;
14
+ line-height: 1.5;
15
+ }
16
+
17
+ &__input {
13
18
  position: relative;
19
+ width: 1rem;
20
+ height: 1rem;
21
+ background-color: $pix-neutral-0;
22
+ border: 1.5px solid $pix-neutral-70;
14
23
  border-radius: 50%;
15
- width: 18px;
16
- height: 18px;
17
- margin: 0 10px 0 0;
18
- border: 1px solid $pix-neutral-70;
19
- cursor: pointer;
20
- background-color: transparent;
24
+ appearance: none;
21
25
 
22
- &:hover {
26
+ // Hover effect
27
+ &::before {
28
+ content: '';
29
+ position: absolute;
30
+ z-index: -1;
31
+ top: 50%;
32
+ left: 50%;
33
+ width: 1rem;
34
+ height: 1rem;
35
+ transform: translate(-50%, -50%) scale(1);
36
+ border-radius: 50%;
23
37
  background-color: $pix-neutral-15;
24
- box-shadow: 0 0 0 8px $pix-neutral-15;
38
+ visibility: hidden;
39
+ opacity: 0;
25
40
  transition: all 0.3s ease;
26
41
  }
27
42
 
28
- &:focus-visible {
29
- box-shadow: $pix-neutral-0 0 0 0 2px, $pix-primary 0 0 0 4px;
30
- outline: none;
43
+ &:hover,
44
+ &:focus-visible,
45
+ &:active {
46
+ &::before {
47
+ visibility: visible;
48
+ opacity: 1;
49
+ transform: translate(-50%, -50%) scale(1.75);
50
+ }
31
51
  }
32
52
 
33
53
  &:active {
34
- border-color: $pix-primary;
35
- background-color: transparent;
36
- box-shadow: none;
54
+ &::before {
55
+ background-color: $pix-neutral-22;
56
+ }
37
57
  }
38
58
 
59
+ // Checked state
39
60
  &:checked {
40
61
  border-color: $pix-primary;
41
62
 
42
- &:after {
43
- background-color: $pix-primary;
44
- border-radius: 50%;
63
+ &::after {
45
64
  content: '';
46
- height: 12px;
47
- width: 12px;
48
65
  position: absolute;
49
- left: 50%;
50
66
  top: 50%;
67
+ left: 50%;
68
+ height: 62.5%;
69
+ width: 62.5%;
51
70
  transform: translate(-50%, -50%);
71
+ background-color: $pix-primary;
72
+ border-radius: 50%;
52
73
  }
53
74
  }
54
75
 
76
+ // Disabled state
55
77
  &:disabled {
56
- border: 1px solid $pix-neutral-45;
57
- background-color: transparent;
58
- box-shadow: none;
78
+ background-color: $pix-neutral-10;
79
+ border-color: $pix-neutral-30;
59
80
  cursor: not-allowed;
60
81
 
61
- &:checked:after {
62
- background-color: $pix-neutral-25;
82
+ & + .pix-radio-button__label {
83
+ cursor: not-allowed;
84
+ }
85
+
86
+ &::before {
87
+ display: none;
63
88
  }
64
- }
65
- }
66
89
 
67
- &--disabled {
68
- cursor: not-allowed;
69
- color: $pix-neutral-45;
90
+ &:checked::after {
91
+ background-color: $pix-neutral-30;
92
+ }
93
+ }
70
94
  }
71
95
  }
@@ -80,10 +80,6 @@
80
80
  padding-bottom: 12px;
81
81
  }
82
82
 
83
- .pix-radio-button {
84
- padding: $pix-spacing-xs 0 $pix-spacing-xs 0;
85
- }
86
-
87
83
  .pix-form__actions {
88
84
  display: flex;
89
85
  justify-content: center;
@@ -71,6 +71,7 @@ export const form = (args) => {
71
71
  @value=''
72
72
  @maxlength={{200}}
73
73
  @label='Un commentaire ?'
74
+ @requiredLabel='Champ obligatoire'
74
75
  @errorMessage={{this.genericErrorMessage}}
75
76
  />
76
77
  <br />
@@ -2,15 +2,18 @@ import { hbs } from 'ember-cli-htmlbars';
2
2
 
3
3
  export const Template = (args) => {
4
4
  return {
5
- template: hbs`<PixCheckbox
5
+ template: hbs`
6
+ <PixCheckbox
6
7
  @id={{this.id}}
7
8
  @screenReaderOnly={{this.screenReaderOnly}}
8
9
  @isIndeterminate={{this.isIndeterminate}}
9
10
  @labelSize={{this.labelSize}}
10
11
  @checked={{this.checked}}
12
+ disabled={{this.disabled}}
11
13
  >
12
14
  {{this.label}}
13
- </PixCheckbox>`,
15
+ </PixCheckbox>
16
+ `,
14
17
  context: args,
15
18
  };
16
19
  };
@@ -26,6 +29,7 @@ indeterminateCheckbox.args = {
26
29
  id: 'accept-newsletter-2',
27
30
  label: 'Recevoir la newsletter',
28
31
  isIndeterminate: true,
32
+ checked: true,
29
33
  };
30
34
 
31
35
  export const checkboxWithSmallLabel = Template.bind({});
@@ -42,6 +46,63 @@ checkboxWithLargeLabel.args = {
42
46
  labelSize: 'large',
43
47
  };
44
48
 
49
+ export const checkboxDisabled = Template.bind({});
50
+ checkboxDisabled.args = {
51
+ id: 'accept-newsletter-2',
52
+ label: 'Recevoir la newsletter',
53
+ disabled: true,
54
+ };
55
+
56
+ export const checkboxCheckedDisabled = Template.bind({});
57
+ checkboxCheckedDisabled.args = {
58
+ id: 'accept-newsletter-2',
59
+ label: 'Recevoir la newsletter',
60
+ disabled: true,
61
+ checked: true,
62
+ };
63
+
64
+ export const checkboxInterminateDisabled = Template.bind({});
65
+ checkboxInterminateDisabled.args = {
66
+ id: 'accept-newsletter-2',
67
+ label: 'Recevoir la newsletter',
68
+ disabled: true,
69
+ checked: true,
70
+ isIndeterminate: true,
71
+ };
72
+
73
+ export const MultipleTemplate = (args) => {
74
+ return {
75
+ template: hbs`
76
+ <PixCheckbox
77
+ @id="one"
78
+ @screenReaderOnly={{this.screenReaderOnly}}
79
+ @isIndeterminate={{this.isIndeterminate}}
80
+ @labelSize={{this.labelSize}}
81
+ @checked={{this.checked}}
82
+ disabled={{this.disabled}}
83
+ >
84
+ {{this.label}}
85
+ </PixCheckbox>
86
+ <PixCheckbox
87
+ @id="two"
88
+ @screenReaderOnly={{this.screenReaderOnly}}
89
+ @isIndeterminate={{this.isIndeterminate}}
90
+ @labelSize={{this.labelSize}}
91
+ @checked={{this.checked}}
92
+ disabled={{this.disabled}}
93
+ >
94
+ {{this.label}}
95
+ </PixCheckbox>
96
+ `,
97
+ context: args,
98
+ };
99
+ };
100
+
101
+ export const multiple = MultipleTemplate.bind({});
102
+ multiple.args = {
103
+ label: 'Recevoir la newsletter',
104
+ };
105
+
45
106
  export const argTypes = {
46
107
  id: {
47
108
  name: 'id',
@@ -96,4 +157,13 @@ export const argTypes = {
96
157
  defaultValue: { summary: false },
97
158
  },
98
159
  },
160
+ disabled: {
161
+ name: 'disabled',
162
+ description: 'Permet de désactiver la checkbox',
163
+ type: { name: 'boolean', required: false },
164
+ table: {
165
+ type: { summary: 'boolean' },
166
+ defaultValue: { summary: false },
167
+ },
168
+ },
99
169
  };
@@ -12,19 +12,44 @@ La PixCheckbox permet de créer des checkbox basiques ou des checkbox mixées (c
12
12
  <Story name="Default" story={stories.Default} height={60} />
13
13
  </Canvas>
14
14
 
15
- ## Checkbox indéterminée
15
+ ### Liste de checkboxes
16
+
17
+ Il n'est pas rare d'avoir plusieurs champs checkbox qui se suivent.<br/>
18
+ En ce sens, nous avons déjà prévu un espace vertical pour séparer 2 composants qui se suivent.
19
+
20
+ <Canvas>
21
+ <Story name="Multiple" story={stories.multiple} height={140} />
22
+ </Canvas>
23
+
24
+ ## États de la Checkbox
25
+
26
+ <br />
27
+
28
+ ### Checkbox interminée
16
29
 
17
30
  <Canvas>
18
31
  <Story name="Indeterminate" story={stories.indeterminateCheckbox} height={60} />
19
32
  </Canvas>
20
33
 
21
- ## Checkbox avec un petit label
34
+ ### Checkbox désactivée
35
+
36
+ <Canvas>
37
+ <Story name="Disabled" story={stories.checkboxDisabled} height={60} />
38
+ <Story name="CheckedDisabled" story={stories.checkboxCheckedDisabled} height={60} />
39
+ <Story name="InterminateDisabled" story={stories.checkboxInterminateDisabled} height={60} />
40
+ </Canvas>
41
+
42
+ ## Autres tailles de police du label
43
+
44
+ <br />
45
+
46
+ ### Small
22
47
 
23
48
  <Canvas>
24
49
  <Story name="SmallLabel" story={stories.checkboxWithSmallLabel} height={60} />
25
50
  </Canvas>
26
51
 
27
- ## Checkbox avec un grand label
52
+ ### Large
28
53
 
29
54
  <Canvas>
30
55
  <Story name="LargeLabel" story={stories.checkboxWithLargeLabel} height={60} />
@@ -38,6 +63,7 @@ La PixCheckbox permet de créer des checkbox basiques ou des checkbox mixées (c
38
63
  @screenReaderOnly="{{false}}"
39
64
  @isIndeterminate="{{false}}"
40
65
  @labelSize="small"
66
+ disabled
41
67
  >
42
68
  Recevoir la newsletter
43
69
  </PixCheckbox>
@@ -48,11 +48,11 @@ export const argTypes = {
48
48
  color: {
49
49
  name: 'color',
50
50
  description:
51
- 'Modifie la couleur de la barre de progression. Peut prendre les valeurs `yellow` ou `white`',
51
+ 'Modifie la couleur de la barre de progression. Peut prendre les valeurs `blue` ou `white`',
52
52
  type: { name: 'string', required: false },
53
- table: { defaultValue: { summary: 'yellow' } },
53
+ table: { defaultValue: { summary: 'blue' } },
54
54
  control: { type: 'select' },
55
- options: ['yellow', 'white'],
55
+ options: ['blue', 'white'],
56
56
  },
57
57
  isArrowLeft: {
58
58
  name: 'isArrowLeft',
@@ -1,5 +1,6 @@
1
1
  import { hbs } from 'ember-cli-htmlbars';
2
2
 
3
+ /* Default stories */
3
4
  const Template = (args) => {
4
5
  return {
5
6
  template: hbs`<PixRadioButton @label={{this.label}} @value={{this.value}} @isDisabled={{this.isDisabled}} />`,
@@ -18,6 +19,7 @@ isDisabled.args = {
18
19
  isDisabled: true,
19
20
  };
20
21
 
22
+ /* Checked stories */
21
23
  const checked = (args) => {
22
24
  return {
23
25
  template: hbs`<PixRadioButton @label={{this.label}} @isDisabled={{this.isDisabled}} checked />`,
@@ -34,6 +36,23 @@ disabledChecked.args = {
34
36
  export const defaultChecked = checked.bind({});
35
37
  defaultChecked.args = Default.args;
36
38
 
39
+ /* Multiple components story */
40
+ const multipleTemplate = (args) => {
41
+ return {
42
+ template: hbs`
43
+ <PixRadioButton @label={{this.label}} @isDisabled={{this.isDisabled}} name="radio" />
44
+ <PixRadioButton @label={{this.label}} @isDisabled={{this.isDisabled}} name="radio" />
45
+ <PixRadioButton @label={{this.label}} @isDisabled={{this.isDisabled}} name="radio" />
46
+ `,
47
+ context: args,
48
+ };
49
+ };
50
+
51
+ export const multiple = multipleTemplate.bind({});
52
+ multiple.args = {
53
+ ...Default.args,
54
+ };
55
+
37
56
  export const argTypes = {
38
57
  label: {
39
58
  name: 'label',
@@ -8,7 +8,7 @@ import * as stories from './pix-radio-button.stories.js';
8
8
 
9
9
  Un bouton radio permettant de sélectionner une seule option dans une liste.
10
10
 
11
- ⚠️ Le bouton radio ne peut pas être utilisé seul : il faut au minimum **2 options**.
11
+ ⚠️ Le bouton radio ne peut pas être utilisé seul : il faut au minimum **2 options**.<br/>
12
12
  Il est préférable de ne pas sélectionner d’option par défaut pour que le choix de l’utilisateur soit conscient (en particulier si le choix est obligatoire).
13
13
 
14
14
  ## Default
@@ -18,6 +18,15 @@ Il est préférable de ne pas sélectionner d’option par défaut pour que le c
18
18
  <Story name="Default checked" story={stories.defaultChecked} height={60} />
19
19
  </Canvas>
20
20
 
21
+ ### Liste de radios
22
+
23
+ Puisqu'on ne souhaite en aucune avoir un input radio unique, il est déjà prévu l'espacement vertical avec un input radio suivant.<br/>
24
+ Pour les considérer comme un seul groupe d'inputs, **il est nécessaire qu'ils aient chacun un attribut `name` avec une valeur commune**.
25
+
26
+ <Canvas>
27
+ <Story name="Multiple" story={stories.multiple} height={140} />
28
+ </Canvas>
29
+
21
30
  ## IsDisabled
22
31
 
23
32
  État inactif du bouton radio.
@@ -30,7 +39,12 @@ Il est préférable de ne pas sélectionner d’option par défaut pour que le c
30
39
  ## Usage
31
40
 
32
41
  ```html
33
- <PixRadioButton @label="{{label}}" @value="{{value}}" @isDisabled="{{isDisabled}}" />
42
+ <PixRadioButton
43
+ name="input-name"
44
+ @label="{{label}}"
45
+ @value="{{value}}"
46
+ @isDisabled="{{isDisabled}}"
47
+ />
34
48
  ```
35
49
 
36
50
  ## Arguments
@@ -7,6 +7,7 @@ const Template = (args) => {
7
7
  @value={{this.value}}
8
8
  @maxlength={{this.maxlength}}
9
9
  @label={{this.label}}
10
+ @requiredLabel={{this.requiredLabel}}
10
11
  @errorMessage={{this.errorMessage}}
11
12
  />`,
12
13
  context: args,
@@ -44,6 +45,13 @@ export const argTypes = {
44
45
  type: { name: 'string', required: false },
45
46
  },
46
47
 
48
+ requiredLabel: {
49
+ name: 'requiredLabel',
50
+ description:
51
+ 'Label indiquant que le champ est requis, le paramètre @label devient obligatoire avec ce paramètre.',
52
+ type: { name: 'string', required: false },
53
+ },
54
+
47
55
  errorMessage: {
48
56
  name: 'errorMessage',
49
57
  description: 'Affiche une erreur en dessous du champ.',
@@ -23,6 +23,7 @@ Optionellement, il peut afficher le nombre de caractères tapés ainsi que le no
23
23
  @value="{{value}}"
24
24
  @maxlength="{{maxlength}}"
25
25
  @errorMessage="{{errorMessage}}"
26
+ @requiredLabel="{{requiredLabel}}"
26
27
  />
27
28
  ```
28
29
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1024pix/pix-ui",
3
- "version": "32.0.0",
3
+ "version": "33.0.0",
4
4
  "description": "Pix-UI is the implementation of Pix design principles and guidelines for its products.",
5
5
  "keywords": [
6
6
  "ember-addon"
@@ -44,7 +44,8 @@
44
44
  "storybook": "npm-run-all --parallel serve-ember serve-storybook",
45
45
  "test": "ember test",
46
46
  "test:ember": "ember test",
47
- "test:ember-compatibility": "ember try:each"
47
+ "test:ember-compatibility": "ember try:each",
48
+ "chromatic": "npx chromatic --project-token=$CHROMATIC_PROJECT_TOKEN"
48
49
  },
49
50
  "dependencies": {
50
51
  "@formatjs/intl": "^2.5.1",
@@ -85,6 +86,7 @@
85
86
  "@storybook/theming": "^6.5.13",
86
87
  "@testing-library/dom": "^8.20.0",
87
88
  "@testing-library/user-event": "^14.4.3",
89
+ "chromatic": "^6.17.3",
88
90
  "core-js": "^3.26.1",
89
91
  "ember-cli": "^4.8.0",
90
92
  "ember-cli-dependency-checker": "^3.3.1",