@1024pix/pix-ui 46.0.3 → 46.2.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.
@@ -1,4 +1,14 @@
1
1
  <div class="pix-checkbox {{@class}}">
2
+ <input
3
+ type="checkbox"
4
+ id={{this.id}}
5
+ class={{this.inputClasses}}
6
+ checked={{@checked}}
7
+ aria-disabled={{this.isDisabled}}
8
+ {{on "click" this.avoidCheckedStateChangeIfIsDisabled}}
9
+ ...attributes
10
+ />
11
+
2
12
  <PixLabel
3
13
  @for={{this.id}}
4
14
  @requiredLabel={{@requiredLabel}}
@@ -7,19 +17,7 @@
7
17
  @inlineLabel={{true}}
8
18
  @screenReaderOnly={{@screenReaderOnly}}
9
19
  @isDisabled={{this.isDisabled}}
10
- @wrappedElement={{true}}
11
20
  >
12
- <:inputElement>
13
- <input
14
- type="checkbox"
15
- id={{this.id}}
16
- class={{this.inputClasses}}
17
- checked={{@checked}}
18
- aria-disabled={{this.isDisabled}}
19
- {{on "click" this.avoidCheckedStateChangeIfIsDisabled}}
20
- ...attributes
21
- />
22
- </:inputElement>
23
- <:default>{{yield to="label"}}</:default>
21
+ {{yield to="label"}}
24
22
  </PixLabel>
25
23
  </div>
@@ -1,6 +1,7 @@
1
1
  import Component from '@glimmer/component';
2
2
  import { guidFor } from '@ember/object/internals';
3
3
  import { action } from '@ember/object';
4
+ import { warn } from '@ember/debug';
4
5
 
5
6
  export default class PixCheckbox extends Component {
6
7
  constructor() {
@@ -22,7 +23,15 @@ export default class PixCheckbox extends Component {
22
23
  }
23
24
 
24
25
  get isDisabled() {
25
- return this.args.isDisabled || this.args.disabled;
26
+ warn(
27
+ 'PixCheckbox: @isDisabled attribute should be a boolean.',
28
+ [true, false, undefined, null].includes(this.args.isDisabled),
29
+ {
30
+ id: 'pix-ui.checkbox.is-disabled.not-boolean',
31
+ },
32
+ );
33
+
34
+ return this.args.isDisabled || this.args.disabled ? 'true' : null;
26
35
  }
27
36
 
28
37
  @action
@@ -1,17 +1,11 @@
1
1
  <label for={{@for}} class={{this.className}} ...attributes>
2
- {{#if (has-block "inputElement")}}
3
- {{yield to="inputElement"}}
2
+ {{#if @requiredLabel}}
3
+ <abbr title={{@requiredLabel}} class="mandatory-mark">*</abbr>
4
4
  {{/if}}
5
5
 
6
- <span class={{if @screenReaderOnly "screen-reader-only"}}>
7
- {{#if @requiredLabel}}
8
- <abbr title={{@requiredLabel}} class="mandatory-mark">*</abbr>
9
- {{/if}}
6
+ {{yield}}
10
7
 
11
- {{yield}}
12
-
13
- {{#if @subLabel}}
14
- <span class="pix-label__sub-label">{{@subLabel}}</span>
15
- {{/if}}
16
- </span>
8
+ {{#if @subLabel}}
9
+ <span class="pix-label__sub-label">{{@subLabel}}</span>
10
+ {{/if}}
17
11
  </label>
@@ -4,9 +4,8 @@ export default class PixLabel extends Component {
4
4
  get className() {
5
5
  const classes = ['pix-label'];
6
6
 
7
- if (this.args.wrappedElement) classes.push('pix-label--wrapped-element');
8
- if (this.args.inlineLabel && !this.args.screenReaderOnly)
9
- classes.push('pix-label--inline-label');
7
+ if (this.args.screenReaderOnly) classes.push('screen-reader-only');
8
+ if (this.args.inlineLabel) classes.push('pix-label--inline-label');
10
9
  if (this.args.isDisabled) classes.push('pix-label--disabled');
11
10
 
12
11
  const size = ['small', 'large'].includes(this.args.size) ? this.args.size : 'default';
@@ -1,4 +1,14 @@
1
1
  <div class="pix-radio-button {{@class}}">
2
+ <input
3
+ type="radio"
4
+ id={{this.id}}
5
+ class="pix-radio-button__input"
6
+ value={{@value}}
7
+ aria-disabled={{this.isDisabled}}
8
+ {{on "click" this.avoidCheckedStateChangeIfIsDisabled}}
9
+ ...attributes
10
+ />
11
+
2
12
  <PixLabel
3
13
  @for={{this.id}}
4
14
  @requiredLabel={{@requiredLabel}}
@@ -7,19 +17,7 @@
7
17
  @screenReaderOnly={{@screenReaderOnly}}
8
18
  @isDisabled={{this.isDisabled}}
9
19
  @inlineLabel={{true}}
10
- @wrappedElement={{true}}
11
20
  >
12
- <:inputElement>
13
- <input
14
- type="radio"
15
- id={{this.id}}
16
- class="pix-radio-button__input"
17
- value={{@value}}
18
- aria-disabled={{this.isDisabled}}
19
- {{on "click" this.avoidCheckedStateChangeIfIsDisabled}}
20
- ...attributes
21
- />
22
- </:inputElement>
23
- <:default>{{yield to="label"}}</:default>
21
+ {{yield to="label"}}
24
22
  </PixLabel>
25
23
  </div>
@@ -1,6 +1,7 @@
1
1
  import Component from '@glimmer/component';
2
2
  import { guidFor } from '@ember/object/internals';
3
3
  import { action } from '@ember/object';
4
+ import { warn } from '@ember/debug';
4
5
 
5
6
  export default class PixRadioButton extends Component {
6
7
  text = 'pix-radio-button';
@@ -10,7 +11,15 @@ export default class PixRadioButton extends Component {
10
11
  }
11
12
 
12
13
  get isDisabled() {
13
- return this.args.isDisabled || this.args.disabled;
14
+ warn(
15
+ 'PixRadioButton: @isDisabled attribute should be a boolean.',
16
+ [true, false, undefined, null].includes(this.args.isDisabled),
17
+ {
18
+ id: 'pix-ui.radio-button.is-disabled.not-boolean',
19
+ },
20
+ );
21
+
22
+ return this.args.isDisabled || this.args.disabled ? 'true' : null;
14
23
  }
15
24
 
16
25
  @action
@@ -2,14 +2,9 @@
2
2
  display: flex;
3
3
  align-items: center;
4
4
  justify-content: center;
5
- color: var(--pix-neutral-0);
6
- font-weight: var(--pix-font-bold);
7
- font-size: 0.875rem;
8
5
  white-space: nowrap;
9
6
  text-decoration: none;
10
- background-color: var(--pix-primary-500);
11
7
  border: 2px solid transparent;
12
- border-radius: 25px;
13
8
  outline: none;
14
9
  cursor: pointer;
15
10
 
@@ -37,14 +32,21 @@
37
32
  }
38
33
 
39
34
  &--size-large {
35
+ @extend %pix-cta-l;
36
+
40
37
  padding: var(--pix-spacing-3x) var(--pix-spacing-6x);
38
+ border-radius: 50px;
41
39
  }
42
40
 
43
41
  &--size-small {
42
+ @extend %pix-cta-s;
43
+
44
44
  padding: var(--pix-spacing-2x) var(--pix-spacing-6x);
45
+ border-radius: 25px;
45
46
  }
46
47
 
47
48
  &--primary {
49
+ color: var(--pix-neutral-0);
48
50
  background-color: var(--pix-primary-500);
49
51
 
50
52
  &:not([aria-disabled="true"]) {
@@ -145,6 +147,7 @@
145
147
  }
146
148
 
147
149
  &--success {
150
+ color: var(--pix-neutral-0);
148
151
  background-color: var(--pix-success-500);
149
152
 
150
153
  &:not([aria-disabled="true"]) {
@@ -1,6 +1,8 @@
1
1
  .pix-checkbox {
2
2
  position: relative;
3
3
  z-index: 0;
4
+ display: flex;
5
+ align-items: center;
4
6
 
5
7
  & + .pix-checkbox {
6
8
  margin-top: var(--pix-spacing-4x);
@@ -98,9 +100,9 @@
98
100
  }
99
101
 
100
102
  // Disabled state
101
- &[aria-disabled],
103
+ &[aria-disabled='true'],
102
104
  &:disabled,
103
- &--indeterminate[aria-disabled],
105
+ &--indeterminate[aria-disabled='true'],
104
106
  &--indeterminate:disabled {
105
107
  background: var(--pix-neutral-100);
106
108
  border-color: var(--pix-neutral-100);
@@ -3,12 +3,6 @@
3
3
  color: var(--pix-neutral-900);
4
4
  font-weight: var(--pix-font-medium);
5
5
 
6
- &--wrapped-element {
7
- display: flex;
8
- gap: var(--pix-spacing-3x);
9
- align-items: center;
10
- }
11
-
12
6
  &--disabled {
13
7
  color: var(--pix-neutral-500);
14
8
  }
@@ -27,6 +21,7 @@
27
21
 
28
22
  &--inline-label {
29
23
  margin: 0;
24
+ padding: 0 var(--pix-spacing-2x);
30
25
  font-weight: var(--pix-font-normal);
31
26
  }
32
27
 
@@ -1,6 +1,8 @@
1
1
  .pix-radio-button {
2
2
  position: relative;
3
3
  z-index: 0;
4
+ display: flex;
5
+ align-items: center;
4
6
 
5
7
  & + .pix-radio-button {
6
8
  margin-top: var(--pix-spacing-4x);
@@ -73,7 +75,7 @@
73
75
  }
74
76
 
75
77
  // Disabled state
76
- &[aria-disabled],
78
+ &[aria-disabled='true'],
77
79
  &:disabled {
78
80
  background: var(--pix-neutral-20);
79
81
  border-color: var(--pix-neutral-100);
@@ -2,7 +2,7 @@
2
2
 
3
3
  // Placeholder pour permettre l'utilisation dans une classe css si jamais le tag html a trop de classe
4
4
  %-pix-title {
5
- font-weight: 700;
5
+ font-weight: var(--pix-font-bold);
6
6
 
7
7
  // stylelint-disable-next-line custom-property-pattern
8
8
  font-family: var(--_pix-font-family-title);
@@ -79,12 +79,28 @@
79
79
  }
80
80
 
81
81
  %-pix-body {
82
- font-weight: 400;
82
+ font-weight: var(--pix-font-normal);
83
83
 
84
84
  // stylelint-disable-next-line custom-property-pattern
85
85
  font-family: var(--_pix-font-family-body);
86
86
  }
87
87
 
88
+ %pix-cta-s {
89
+ @extend %-pix-body;
90
+
91
+ font-weight: var(--pix-font-bold);
92
+ font-size: 0.875rem;
93
+ line-height: 1.429;
94
+ }
95
+
96
+ %pix-cta-l {
97
+ @extend %-pix-body;
98
+
99
+ font-weight: var(--pix-font-bold);
100
+ font-size: 1.125rem;
101
+ line-height: 1.556;
102
+ }
103
+
88
104
  %pix-body-xs,
89
105
  .pix-body-xs {
90
106
  @extend %-pix-body;
@@ -28,6 +28,8 @@ En ce sens, nous avons déjà prévu un espace vertical pour séparer 2 composan
28
28
 
29
29
  ### Checkbox désactivée
30
30
 
31
+ L'attribut `@isDisabled` permet de désactiver la checkbox en conservant la possibilité de naviguer avec le clavier ou le lecteur d'écran. Il est préféré à l'attribut natif `disabled` qui empêche ces usages.
32
+
31
33
  <Story of={ComponentStories.isDisabled} height={60} />
32
34
  <Story of={ComponentStories.checkedIsDisabled} height={60} />
33
35
  <Story of={ComponentStories.isIndeterminateIsDisabled} height={60} />
@@ -44,10 +46,10 @@ En ce sens, nous avons déjà prévu un espace vertical pour séparer 2 composan
44
46
 
45
47
  ```html
46
48
  <PixCheckbox
47
- @screenReaderOnly="{{false}}"
48
- @isIndeterminate="{{false}}"
49
+ @screenReaderOnly={{false}}
50
+ @isIndeterminate={{false}}
49
51
  @size="small"
50
- disabled
52
+ @isDisabled={{true}}
51
53
  >
52
54
  <:label>Recevoir la newsletter</:label>
53
55
  </PixCheckbox>
@@ -26,7 +26,7 @@ Pour les considérer comme un seul groupe d'inputs, **il est nécessaire qu'ils
26
26
 
27
27
  ## Disabled
28
28
 
29
- État inactif du bouton radio.
29
+ L'attribut `@isDisabled` permet de désactiver la radio en conservant la possibilité de naviguer avec le clavier ou le lecteur d'écran. Il est préféré à l'attribut natif `disabled` qui empêche ces usages.
30
30
 
31
31
  <Story of={ComponentStories.isDisabled} height={60} />
32
32
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1024pix/pix-ui",
3
- "version": "46.0.3",
3
+ "version": "46.2.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"