@1024pix/pix-ui 35.0.1 → 36.0.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 +13 -0
- package/addon/components/pix-progress-gauge.hbs +10 -16
- package/addon/components/pix-progress-gauge.js +32 -13
- package/addon/styles/_pix-progress-gauge.scss +94 -82
- package/app/stories/pix-progress-gauge.stories.js +30 -26
- package/app/stories/pix-progress-gauge.stories.mdx +10 -8
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Pix-UI Changelog
|
|
2
2
|
|
|
3
|
+
## v36.0.1 (26/06/2023)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### :bug: Correction
|
|
7
|
+
- [#425](https://github.com/1024pix/pix-ui/pull/425) [BUGFIX] Réduire la largeur minimum de PixProgressGauge (PIX-8457).
|
|
8
|
+
- [#424](https://github.com/1024pix/pix-ui/pull/424) [BUGFIX] définir une largeur fixe pour le texte de pourcentage de PixProgressGauge (PIX-8439).
|
|
9
|
+
|
|
10
|
+
## v36.0.0 (13/06/2023)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### :boom: BREAKING CHANGE
|
|
14
|
+
- [#417](https://github.com/1024pix/pix-ui/pull/417) [BREAKING] Met à jour la PixProgressBar avec le nouveau design (PIX-8172).
|
|
15
|
+
|
|
3
16
|
## v35.0.1 (13/06/2023)
|
|
4
17
|
|
|
5
18
|
|
|
@@ -1,19 +1,13 @@
|
|
|
1
|
-
<div
|
|
2
|
-
class="progress-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
{{#if @
|
|
11
|
-
<div class="progress-gauge__tooltip-wrapper" style={{this.valueGaugeStyle}}>
|
|
12
|
-
<span class="progress-gauge__tooltip">{{@tooltipText}}</span>
|
|
13
|
-
</div>
|
|
14
|
-
{{/if}}
|
|
15
|
-
|
|
16
|
-
{{#if this.hasSubtitle}}
|
|
1
|
+
<div class="progress-gauge {{this.themeMode}} {{this.colorClass}}" ...attributes>
|
|
2
|
+
<div class="progress-gauge__text" role="presentation">{{this.percentageValue}}</div>
|
|
3
|
+
<label for={{this.id}} class="screen-reader-only">{{@label}}</label>
|
|
4
|
+
<progress
|
|
5
|
+
class="progress-gauge__bar"
|
|
6
|
+
id={{this.id}}
|
|
7
|
+
max="100"
|
|
8
|
+
value={{this.value}}
|
|
9
|
+
>{{this.value}}%</progress>
|
|
10
|
+
{{#if @subtitle}}
|
|
17
11
|
<p class="progress-gauge__sub-title">{{@subtitle}}</p>
|
|
18
12
|
{{/if}}
|
|
19
13
|
</div>
|
|
@@ -1,29 +1,48 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
|
-
import {
|
|
2
|
+
import { guidFor } from '@ember/object/internals';
|
|
3
3
|
|
|
4
4
|
export default class PixProgressGauge extends Component {
|
|
5
|
-
get
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
get id() {
|
|
6
|
+
return guidFor(this);
|
|
7
|
+
}
|
|
8
|
+
|
|
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 PixProgressGauge component, @value param is not provided.');
|
|
8
14
|
}
|
|
15
|
+
return Number(this.args.value);
|
|
16
|
+
}
|
|
9
17
|
|
|
10
|
-
|
|
18
|
+
get percentageValue() {
|
|
19
|
+
return Number(this.value / 100).toLocaleString(navigator.language, { style: 'percent' });
|
|
11
20
|
}
|
|
12
21
|
|
|
13
|
-
get
|
|
14
|
-
|
|
22
|
+
get label() {
|
|
23
|
+
if (!this.args.label || !this.args.label.trim()) {
|
|
24
|
+
throw new Error('ERROR in PixProgressGauge component, @label param is not provided.');
|
|
25
|
+
}
|
|
26
|
+
return this.args.label;
|
|
15
27
|
}
|
|
16
28
|
|
|
17
|
-
get
|
|
18
|
-
|
|
29
|
+
get themeMode() {
|
|
30
|
+
const availableMode = ['dark', 'light'];
|
|
31
|
+
|
|
32
|
+
const themeMode =
|
|
33
|
+
this.args.themeMode && availableMode.includes(this.args.themeMode)
|
|
34
|
+
? this.args.themeMode
|
|
35
|
+
: 'light';
|
|
36
|
+
|
|
37
|
+
return `progress-gauge--theme-${themeMode}`;
|
|
19
38
|
}
|
|
20
39
|
|
|
21
|
-
get
|
|
22
|
-
const availableColor = ['blue', '
|
|
40
|
+
get colorClass() {
|
|
41
|
+
const availableColor = ['blue', 'green', 'purple'];
|
|
23
42
|
|
|
24
43
|
const color =
|
|
25
|
-
this.args.color && availableColor.includes(this.args.color) ? this.args.color :
|
|
44
|
+
this.args.color && availableColor.includes(this.args.color) ? this.args.color : 'blue';
|
|
26
45
|
|
|
27
|
-
return `progress-gauge
|
|
46
|
+
return `progress-gauge--content-${color}`;
|
|
28
47
|
}
|
|
29
48
|
}
|
|
@@ -1,116 +1,128 @@
|
|
|
1
1
|
.progress-gauge {
|
|
2
2
|
position: relative;
|
|
3
|
-
|
|
3
|
+
display: grid;
|
|
4
|
+
grid-template-areas:
|
|
5
|
+
'text progressbar'
|
|
6
|
+
'subtitle subtitle';
|
|
7
|
+
grid-template-columns: auto 1fr;
|
|
8
|
+
align-items: center;
|
|
4
9
|
width: 100%;
|
|
10
|
+
min-width: 6rem;
|
|
5
11
|
border-radius: 5px;
|
|
6
12
|
|
|
13
|
+
&__bar {
|
|
14
|
+
grid-area: progressbar;
|
|
15
|
+
inline-size: unset;
|
|
16
|
+
flex-grow: 1;
|
|
17
|
+
height: 0.875rem;
|
|
18
|
+
border: 2px solid $pix-neutral-20;
|
|
19
|
+
border-radius: 1.625rem;
|
|
20
|
+
overflow: hidden;
|
|
21
|
+
|
|
22
|
+
&::-webkit-progress-value {
|
|
23
|
+
background-color: $pix-primary;
|
|
24
|
+
border-radius: 1.625rem;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&::-moz-progress-bar {
|
|
28
|
+
background-color: $pix-primary;
|
|
29
|
+
border-radius: 1.625rem;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&::-webkit-progress-bar {
|
|
33
|
+
background-color: $pix-neutral-20;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&__text {
|
|
38
|
+
@extend %pix-body-s;
|
|
39
|
+
|
|
40
|
+
grid-area: text;
|
|
41
|
+
min-width: 5ch;
|
|
42
|
+
margin-right: $pix-spacing-xxs;
|
|
43
|
+
white-space: nowrap;
|
|
44
|
+
font-weight: 500;
|
|
45
|
+
line-height: 1;
|
|
46
|
+
}
|
|
47
|
+
|
|
7
48
|
&__sub-title {
|
|
8
|
-
|
|
9
|
-
|
|
49
|
+
@extend %pix-body-s;
|
|
50
|
+
|
|
51
|
+
grid-area: subtitle;
|
|
52
|
+
width: 100%;
|
|
10
53
|
margin: 6px 0;
|
|
54
|
+
color: $pix-primary-60;
|
|
11
55
|
letter-spacing: 0.4px;
|
|
12
56
|
text-transform: uppercase;
|
|
57
|
+
text-overflow: ellipsis;
|
|
58
|
+
overflow: hidden;
|
|
13
59
|
}
|
|
60
|
+
}
|
|
14
61
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
border
|
|
19
|
-
text-align: right;
|
|
62
|
+
// THEME DARK
|
|
63
|
+
.progress-gauge--theme-dark {
|
|
64
|
+
.progress-gauge__bar {
|
|
65
|
+
border: 2px solid $pix-neutral-0;
|
|
20
66
|
}
|
|
21
67
|
|
|
22
|
-
|
|
23
|
-
|
|
68
|
+
.progress-gauge__bar::-webkit-progress-bar {
|
|
69
|
+
background-color: $pix-neutral-0;
|
|
24
70
|
}
|
|
25
71
|
|
|
26
|
-
|
|
27
|
-
|
|
72
|
+
.progress-gauge__text,
|
|
73
|
+
.progress-gauge__sub-title {
|
|
74
|
+
color: $pix-neutral-0;
|
|
28
75
|
}
|
|
76
|
+
}
|
|
29
77
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
transform: translate(-50%);
|
|
35
|
-
bottom: calc(100% + 10px);
|
|
36
|
-
border-radius: 5px;
|
|
37
|
-
text-align: center;
|
|
38
|
-
padding: 4px;
|
|
39
|
-
font-size: 0.8rem;
|
|
40
|
-
font-weight: $font-bold;
|
|
41
|
-
|
|
42
|
-
&::before {
|
|
43
|
-
content: '';
|
|
44
|
-
position: absolute;
|
|
45
|
-
left: calc(50% - 4px);
|
|
46
|
-
border-top: 4px solid;
|
|
47
|
-
border-right: 4px solid transparent;
|
|
48
|
-
border-left: 4px solid transparent;
|
|
49
|
-
bottom: -4px;
|
|
50
|
-
}
|
|
78
|
+
// SPECIFIC BAR COLORS
|
|
79
|
+
.progress-gauge--content-blue {
|
|
80
|
+
.progress-gauge__bar::-webkit-progress-value {
|
|
81
|
+
background-color: $pix-primary;
|
|
51
82
|
}
|
|
52
83
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
& .progress-gauge__marker {
|
|
59
|
-
background: $pix-neutral-0;
|
|
60
|
-
}
|
|
84
|
+
.progress-gauge__bar::-moz-progress-bar {
|
|
85
|
+
background-color: $pix-primary;
|
|
86
|
+
}
|
|
61
87
|
|
|
62
|
-
|
|
63
|
-
|
|
88
|
+
&:not(.progress-gauge--theme-dark) {
|
|
89
|
+
.progress-gauge__text,
|
|
90
|
+
.progress-gauge__sub-title {
|
|
64
91
|
color: $pix-primary;
|
|
65
|
-
|
|
66
|
-
&::before {
|
|
67
|
-
color: $pix-neutral-0;
|
|
68
|
-
border-top-color: $pix-neutral-0;
|
|
69
|
-
}
|
|
70
92
|
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
71
95
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
96
|
+
.progress-gauge--content-green {
|
|
97
|
+
.progress-gauge__bar::-webkit-progress-value {
|
|
98
|
+
background-color: $pix-success-60;
|
|
75
99
|
}
|
|
76
100
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
101
|
+
.progress-gauge__bar::-moz-progress-bar {
|
|
102
|
+
background-color: $pix-success-60;
|
|
103
|
+
}
|
|
81
104
|
|
|
82
|
-
|
|
83
|
-
|
|
105
|
+
&:not(.progress-gauge--theme-dark) {
|
|
106
|
+
.progress-gauge__text,
|
|
107
|
+
.progress-gauge__sub-title {
|
|
108
|
+
color: $pix-success-60;
|
|
84
109
|
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
85
112
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
&::before {
|
|
91
|
-
border-top-color: $pix-primary-60;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
113
|
+
.progress-gauge--content-purple {
|
|
114
|
+
.progress-gauge__bar::-webkit-progress-value {
|
|
115
|
+
background-color: $pix-tertiary-60;
|
|
116
|
+
}
|
|
94
117
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
118
|
+
.progress-gauge__bar::-moz-progress-bar {
|
|
119
|
+
background-color: $pix-tertiary-60;
|
|
98
120
|
}
|
|
99
121
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
transform: none;
|
|
105
|
-
left: 100%;
|
|
106
|
-
|
|
107
|
-
&::before {
|
|
108
|
-
border-top: 8px solid;
|
|
109
|
-
border-right: 8px solid transparent;
|
|
110
|
-
border-left: none;
|
|
111
|
-
left: 0;
|
|
112
|
-
bottom: -8px;
|
|
113
|
-
}
|
|
122
|
+
&:not(.progress-gauge--theme-dark) {
|
|
123
|
+
.progress-gauge__text,
|
|
124
|
+
.progress-gauge__sub-title {
|
|
125
|
+
color: $pix-tertiary-60;
|
|
114
126
|
}
|
|
115
127
|
}
|
|
116
128
|
}
|
|
@@ -5,36 +5,36 @@ export const Default = (args) => {
|
|
|
5
5
|
template: hbs`<PixProgressGauge
|
|
6
6
|
@value={{this.value}}
|
|
7
7
|
@color={{this.color}}
|
|
8
|
-
@
|
|
8
|
+
@themeMode={{this.themeMode}}
|
|
9
9
|
@subtitle={{this.subtitle}}
|
|
10
|
-
@
|
|
10
|
+
@label={{this.label}}
|
|
11
11
|
/>`,
|
|
12
12
|
context: args,
|
|
13
13
|
};
|
|
14
14
|
};
|
|
15
15
|
Default.args = {
|
|
16
|
-
|
|
16
|
+
value: '50',
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
export const
|
|
19
|
+
export const darkModeProgressGauge = (args) => {
|
|
20
20
|
return {
|
|
21
|
-
template: hbs`<section style='width: 100%; padding: 35px 35px 5px;background-color:
|
|
21
|
+
template: hbs`<section style='width: 100%; padding: 35px 35px 5px;background-color: #253858'>
|
|
22
22
|
<PixProgressGauge
|
|
23
23
|
@value={{this.value}}
|
|
24
24
|
@color={{this.color}}
|
|
25
|
-
@
|
|
25
|
+
@label={{this.label}}
|
|
26
|
+
@themeMode={{this.themeMode}}
|
|
26
27
|
@subtitle={{this.subtitle}}
|
|
27
|
-
@tooltipText={{this.tooltipText}}
|
|
28
28
|
/>
|
|
29
29
|
</section>`,
|
|
30
30
|
context: args,
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
|
-
|
|
33
|
+
darkModeProgressGauge.args = {
|
|
34
34
|
value: '50',
|
|
35
|
-
|
|
36
|
-
color: '
|
|
37
|
-
|
|
35
|
+
label: 'Chargement',
|
|
36
|
+
color: 'purple',
|
|
37
|
+
themeMode: 'dark',
|
|
38
38
|
subtitle: 'Avancement',
|
|
39
39
|
};
|
|
40
40
|
|
|
@@ -42,23 +42,33 @@ export const argTypes = {
|
|
|
42
42
|
value: {
|
|
43
43
|
name: 'value',
|
|
44
44
|
description: 'Valeur atteinte sur 100',
|
|
45
|
-
type: { name: 'number', required:
|
|
45
|
+
type: { name: 'number', required: true },
|
|
46
46
|
table: { defaultValue: { summary: null } },
|
|
47
47
|
},
|
|
48
|
+
label: {
|
|
49
|
+
name: 'label',
|
|
50
|
+
description:
|
|
51
|
+
"Afficher un label caché permettant d'expliciter le contexte de la jauge de progression",
|
|
52
|
+
type: { name: 'string', required: true },
|
|
53
|
+
table: { defaultValue: { summary: 'null' } },
|
|
54
|
+
},
|
|
55
|
+
themeMode: {
|
|
56
|
+
name: 'themeMode',
|
|
57
|
+
description:
|
|
58
|
+
"Permet d'indiquer si le thème de la barre de progression est en dark mode ou light mode. Modifie la couleur de fond de la barre de progression. Peut prendre les valeurs `light` ou `dark`",
|
|
59
|
+
type: { name: 'string', required: false },
|
|
60
|
+
table: { defaultValue: { summary: 'light' } },
|
|
61
|
+
control: { type: 'select' },
|
|
62
|
+
options: ['dark', 'light'],
|
|
63
|
+
},
|
|
48
64
|
color: {
|
|
49
65
|
name: 'color',
|
|
50
66
|
description:
|
|
51
|
-
|
|
67
|
+
"Modifie la couleur du contenu de la barre de progression. Peut prendre les valeurs `blue`, 'green' ou `purple`",
|
|
52
68
|
type: { name: 'string', required: false },
|
|
53
69
|
table: { defaultValue: { summary: 'blue' } },
|
|
54
70
|
control: { type: 'select' },
|
|
55
|
-
options: ['blue', '
|
|
56
|
-
},
|
|
57
|
-
isArrowLeft: {
|
|
58
|
-
name: 'isArrowLeft',
|
|
59
|
-
description: "Modifie la position de l'info bulle sur la gauche",
|
|
60
|
-
type: { name: 'boolean', required: false },
|
|
61
|
-
table: { defaultValue: { summary: false } },
|
|
71
|
+
options: ['blue', 'green', 'purple'],
|
|
62
72
|
},
|
|
63
73
|
subtitle: {
|
|
64
74
|
name: 'subtitle',
|
|
@@ -66,10 +76,4 @@ export const argTypes = {
|
|
|
66
76
|
type: { name: 'string', required: false },
|
|
67
77
|
table: { defaultValue: { summary: 'null' } },
|
|
68
78
|
},
|
|
69
|
-
tooltipText: {
|
|
70
|
-
name: 'tooltipText',
|
|
71
|
-
description: "Afficher un label dans l'info bulle au dessus de la barre de progression",
|
|
72
|
-
type: { name: 'string', required: false },
|
|
73
|
-
table: { defaultValue: { summary: 'null' } },
|
|
74
|
-
},
|
|
75
79
|
};
|
|
@@ -3,22 +3,24 @@ import * as stories from './pix-progress-gauge.stories.js';
|
|
|
3
3
|
|
|
4
4
|
<Meta title="Others/Progress Gauge" component="PixProgressGauge" argTypes={stories.argTypes} />
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# PixProgressGauge
|
|
7
7
|
|
|
8
8
|
## Default
|
|
9
9
|
|
|
10
|
-
Permet d'afficher un barre de progression sur un barème de 100%. Des paramètres existent pour changer
|
|
10
|
+
Permet d'afficher un barre de progression sur un barème de 100%. Des paramètres existent pour changer le mode (dark ou light) ou la couleur du composant.
|
|
11
|
+
|
|
12
|
+
> **⚠️** **Il est nécessaire d'avoir un `label` pour rendre le composant accessible !**
|
|
11
13
|
|
|
12
14
|
<Canvas>
|
|
13
15
|
<Story name="Default" story={stories.Default} height={60} />
|
|
14
16
|
</Canvas>
|
|
15
17
|
|
|
16
|
-
##
|
|
18
|
+
## Dark mode
|
|
17
19
|
|
|
18
|
-
Démonstration d'une barre de progression blanche
|
|
20
|
+
Démonstration d'une barre de progression blanche en dark mode avec un sous titre.
|
|
19
21
|
|
|
20
22
|
<Canvas>
|
|
21
|
-
<Story name="
|
|
23
|
+
<Story name="Dark" story={stories.darkModeProgressGauge} height={100} />
|
|
22
24
|
</Canvas>
|
|
23
25
|
|
|
24
26
|
## Usage
|
|
@@ -26,9 +28,9 @@ Démonstration d'une barre de progression blanche avec l'info bulle à gauche av
|
|
|
26
28
|
```html
|
|
27
29
|
<PixProgressGauge
|
|
28
30
|
@value="50"
|
|
29
|
-
@
|
|
30
|
-
@
|
|
31
|
-
@
|
|
31
|
+
@label="Chargement"
|
|
32
|
+
@color="green"
|
|
33
|
+
@themeMode="dark"
|
|
32
34
|
@subTitle="Un sous titre"
|
|
33
35
|
/>
|
|
34
36
|
```
|