@1024pix/pix-ui 58.4.11 → 60.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.
@@ -8,9 +8,15 @@ export default class PixLabelWrapped extends Component {
8
8
 
9
9
  if (this.args.inlineLabel) classes.push('pix-label--inline-label');
10
10
  if (this.args.isDisabled) classes.push('pix-label-wrapped--disabled');
11
- if (this.args.variant === 'tile') classes.push('pix-label-wrapped--variant-tile');
12
- if (this.args.state === 'success') classes.push('pix-label-wrapped--state-success');
13
- if (this.args.state === 'error') classes.push('pix-label-wrapped--state-error');
11
+ if (this.args.variant === 'modulix') {
12
+ classes.push('pix-label-wrapped--variant-modulix');
13
+ if (this.args.state === 'success') classes.push('pix-label-wrapped--state-modulix-success');
14
+ if (this.args.state === 'error') classes.push('pix-label-wrapped--state-modulix-error');
15
+ if (this.args.state === 'neutral') classes.push('pix-label-wrapped--state-modulix-neutral');
16
+ } else {
17
+ if (this.args.state === 'success') classes.push('pix-label-wrapped--state-success');
18
+ if (this.args.state === 'error') classes.push('pix-label-wrapped--state-error');
19
+ }
14
20
 
15
21
  const size = ['small', 'large'].includes(this.args.size) ? this.args.size : 'default';
16
22
 
@@ -1,30 +1,36 @@
1
+ import { warn } from '@ember/debug';
1
2
  import { guidFor } from '@ember/object/internals';
2
3
  import Component from '@glimmer/component';
3
4
 
4
5
  export default class PixProgressBar extends Component {
5
- get id() {
6
- return guidFor(this);
7
- }
6
+ constructor(...args) {
7
+ super(...args);
8
+ warn('PixProgressBar: you need to provide a locale', this.args.locale, {
9
+ id: 'pix-progress-bar.locale.required',
10
+ });
11
+
12
+ warn(
13
+ 'PixProgressBar: you need to provide a number value between 0 and 1',
14
+ this.args.value >= 0 && this.args.value <= 1,
15
+ {
16
+ id: 'pix-progress-bar.value.type.incorrect',
17
+ },
18
+ );
8
19
 
9
- get value() {
10
- if (Number(this.args.value) <= 0) return 0;
11
- if (Number(this.args.value) > 100) return 100;
12
- if (!this.args.value) {
13
- throw new Error('ERROR in PixProgressBar component, @value param is not provided.');
14
- }
15
- return Number(this.args.value);
20
+ this.id = guidFor(this);
16
21
  }
17
22
 
18
23
  get percentageValue() {
19
- return Number(this.value / 100).toLocaleString(navigator.language, { style: 'percent' });
24
+ return Number(this.clampValue).toLocaleString(this.args.locale, { style: 'percent' });
20
25
  }
21
26
 
22
27
  get label() {
23
- const thereIsNoLabel = !this.args.label || !this.args.label.trim();
28
+ const hasLabel = this.args.label && this.args.label.trim().length > 0;
29
+
30
+ warn('PixProgressBar: you need to provide a valid label', hasLabel || this.args.isDecorative, {
31
+ id: 'pix-progress-bar.label.required',
32
+ });
24
33
 
25
- if (thereIsNoLabel && !this.args.isDecorative) {
26
- throw new Error('ERROR in PixProgressBar component, @label param is not provided.');
27
- }
28
34
  return this.args.label;
29
35
  }
30
36
 
@@ -56,6 +62,10 @@ export default class PixProgressBar extends Component {
56
62
  return `progress-bar--content-${color}`;
57
63
  }
58
64
 
65
+ get clampValue() {
66
+ return Math.max(Math.min(this.args.value, 1), 0);
67
+ }
68
+
59
69
  <template>
60
70
  <div
61
71
  class="progress-bar {{this.themeMode}} {{this.colorClass}}"
@@ -69,9 +79,10 @@ export default class PixProgressBar extends Component {
69
79
  <progress
70
80
  class="progress-bar__bar"
71
81
  id={{this.id}}
72
- max="100"
73
- value={{this.value}}
74
- >{{this.value}}%</progress>
82
+ max="1"
83
+ min="0"
84
+ value={{this.clampValue}}
85
+ >{{this.percentageValue}}</progress>
75
86
  {{#if @subtitle}}
76
87
  <p class="progress-bar__sub-title">{{@subtitle}}</p>
77
88
  {{/if}}
@@ -10,10 +10,6 @@ import PixLabelWrapped from './pix-label-wrapped';
10
10
  export default class PixRadioButton extends Component {
11
11
  text = 'pix-radio-button';
12
12
 
13
- get stateWarning() {
14
- return Boolean(this.isDisabled) && (!this.hasErrorState || !this.hasSuccessState);
15
- }
16
-
17
13
  get id() {
18
14
  return this.args.id || guidFor(this);
19
15
  }
@@ -49,6 +45,10 @@ export default class PixRadioButton extends Component {
49
45
  classes.push(`${classes[0]}--state`);
50
46
  }
51
47
 
48
+ if (this.args.variant === 'modulix') {
49
+ classes.push('pix-radio-button__input--variant-modulix');
50
+ }
51
+
52
52
  return classes.join(' ');
53
53
  }
54
54
 
@@ -4,7 +4,7 @@
4
4
  align-items: center;
5
5
  cursor: pointer;
6
6
 
7
- &--variant-tile {
7
+ &--variant-modulix {
8
8
  position: relative;
9
9
  z-index: -2;
10
10
  padding: var(--pix-spacing-3x) var(--pix-spacing-4x);
@@ -41,6 +41,20 @@
41
41
  color: var(--pix-error-700);
42
42
  }
43
43
 
44
+ &.pix-label-wrapped--state-modulix-error {
45
+ --state-border-color: var(--pix-warning-700);
46
+ --state-background-color: var(--pix-warning-50);
47
+
48
+ color: var(--pix-warning-700);
49
+ }
50
+
51
+ &.pix-label-wrapped--state-modulix-success {
52
+ --state-border-color: var(--pix-success-700);
53
+ --state-background-color: var(--pix-success-50);
54
+
55
+ color: var(--pix-success-700);
56
+ }
57
+
44
58
  & .pix-label-wrapped__state-icon {
45
59
  z-index: 1;
46
60
  width: 1rem;
@@ -92,4 +92,14 @@
92
92
  }
93
93
  }
94
94
  }
95
+
96
+ &__input--variant-modulix, svg:has(+ .pix-radio-button__input--variant-modulix) {
97
+ position: absolute;
98
+ clip-path: polygon(0 0);
99
+ }
100
+
101
+ .pix-label-wrapped--state-modulix-neutral:has(input:checked):not(.pix-label-wrapped--disabled) {
102
+ border: 1px solid var(--pix-primary-500);
103
+ outline: 2px solid var(--pix-primary-300);
104
+ }
95
105
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1024pix/pix-ui",
3
- "version": "58.4.11",
3
+ "version": "60.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"