@1024pix/pix-ui 45.4.4 → 45.5.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.
@@ -5,7 +5,7 @@
5
5
  @size={{@size}}
6
6
  @inlineLabel={{true}}
7
7
  @screenReaderOnly={{@screenReaderOnly}}
8
- @isDisabled={{@isDisabled}}
8
+ @isDisabled={{this.isDisabled}}
9
9
  @wrappedElement={{true}}
10
10
  >
11
11
  <input
@@ -13,7 +13,8 @@
13
13
  id={{this.id}}
14
14
  class={{this.inputClasses}}
15
15
  checked={{@checked}}
16
- aria-disabled={{@isDisabled}}
16
+ aria-disabled={{this.isDisabled}}
17
+ {{on "click" this.avoidCheckedStateChangeIfIsDisabled}}
17
18
  ...attributes
18
19
  />
19
20
 
@@ -1,5 +1,6 @@
1
1
  import Component from '@glimmer/component';
2
2
  import { guidFor } from '@ember/object/internals';
3
+ import { action } from '@ember/object';
3
4
 
4
5
  export default class PixCheckbox extends Component {
5
6
  constructor() {
@@ -19,4 +20,15 @@ export default class PixCheckbox extends Component {
19
20
 
20
21
  return classes.join(' ');
21
22
  }
23
+
24
+ get isDisabled() {
25
+ return this.args.isDisabled || this.args.disabled;
26
+ }
27
+
28
+ @action
29
+ avoidCheckedStateChangeIfIsDisabled(event) {
30
+ if (this.args.isDisabled) {
31
+ event.preventDefault();
32
+ }
33
+ }
22
34
  }
@@ -4,7 +4,7 @@
4
4
  @requiredLabel={{@requiredLabel}}
5
5
  @size={{@size}}
6
6
  @screenReaderOnly={{@screenReaderOnly}}
7
- @isDisabled={{@isDisabled}}
7
+ @isDisabled={{this.isDisabled}}
8
8
  @inlineLabel={{true}}
9
9
  @wrappedElement={{true}}
10
10
  >
@@ -13,6 +13,8 @@
13
13
  id={{this.id}}
14
14
  class="pix-radio-button__input"
15
15
  value={{@value}}
16
+ aria-disabled={{this.isDisabled}}
17
+ {{on "click" this.avoidCheckedStateChangeIfIsDisabled}}
16
18
  ...attributes
17
19
  />
18
20
  {{yield to="label"}}
@@ -1,5 +1,6 @@
1
1
  import Component from '@glimmer/component';
2
2
  import { guidFor } from '@ember/object/internals';
3
+ import { action } from '@ember/object';
3
4
 
4
5
  export default class PixRadioButton extends Component {
5
6
  text = 'pix-radio-button';
@@ -7,4 +8,15 @@ export default class PixRadioButton extends Component {
7
8
  get id() {
8
9
  return this.args.id || guidFor(this);
9
10
  }
11
+
12
+ get isDisabled() {
13
+ return this.args.isDisabled || this.args.disabled;
14
+ }
15
+
16
+ @action
17
+ avoidCheckedStateChangeIfIsDisabled(event) {
18
+ if (this.args.isDisabled) {
19
+ event.preventDefault();
20
+ }
21
+ }
10
22
  }
@@ -98,17 +98,14 @@
98
98
  }
99
99
 
100
100
  // Disabled state
101
+ &[aria-disabled],
101
102
  &:disabled,
103
+ &--indeterminate[aria-disabled],
102
104
  &--indeterminate:disabled {
103
105
  background: var(--pix-neutral-100);
104
106
  border-color: var(--pix-neutral-100);
105
107
  cursor: not-allowed;
106
108
 
107
- & + .pix-checkbox__label {
108
- color: var(--pix-neutral-500);
109
- cursor: not-allowed;
110
- }
111
-
112
109
  &:checked {
113
110
  background: var(--pix-neutral-100);
114
111
  border-color: var(--pix-neutral-100);
@@ -25,10 +25,9 @@
25
25
  @extend %pix-body-l;
26
26
  }
27
27
 
28
-
29
28
  &--inline-label {
30
29
  margin: 0;
31
- font-weight: var(--pix-font-normal)
30
+ font-weight: var(--pix-font-normal);
32
31
  }
33
32
 
34
33
  &__sub-label {
@@ -70,15 +70,12 @@
70
70
  }
71
71
 
72
72
  // Disabled state
73
+ &[aria-disabled],
73
74
  &:disabled {
74
75
  background: var(--pix-neutral-20);
75
76
  border-color: var(--pix-neutral-100);
76
77
  cursor: not-allowed;
77
78
 
78
- & + .pix-radio-button__label {
79
- cursor: not-allowed;
80
- }
81
-
82
79
  &::before {
83
80
  display: none;
84
81
  }
@@ -42,9 +42,9 @@
42
42
  outline: 2px solid var(--pix-primary-300);
43
43
  }
44
44
 
45
- &[aria-disabled="true"],
46
- &[disabled="true"],
47
- &[readonly="true"] {
45
+ &[aria-disabled],
46
+ &[disabled],
47
+ &[readonly] {
48
48
  color: var(--pix-neutral-500);
49
49
  background-color: var(--pix-neutral-20);
50
50
  border-color: var(--pix-neutral-100);
@@ -56,7 +56,7 @@
56
56
  }
57
57
  }
58
58
 
59
- &[readonly="true"] {
59
+ &[readonly] {
60
60
  cursor: default;
61
61
  }
62
62
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1024pix/pix-ui",
3
- "version": "45.4.4",
3
+ "version": "45.5.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"