@1024pix/pix-ui 35.0.0 → 36.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.
- 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 +83 -82
- package/app/stories/pix-progress-gauge.stories.js +30 -26
- package/app/stories/pix-progress-gauge.stories.mdx +10 -8
- package/docs/breaking-changes.stories.mdx +16 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Pix-UI Changelog
|
|
2
2
|
|
|
3
|
+
## v36.0.0 (13/06/2023)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### :boom: BREAKING CHANGE
|
|
7
|
+
- [#417](https://github.com/1024pix/pix-ui/pull/417) [BREAKING] Met à jour la PixProgressBar avec le nouveau design (PIX-8172).
|
|
8
|
+
|
|
9
|
+
## v35.0.1 (13/06/2023)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### :building_construction: Tech
|
|
13
|
+
- [#420](https://github.com/1024pix/pix-ui/pull/420) [TECH] Précise comment documenter un Breaking Change.
|
|
14
|
+
- [#419](https://github.com/1024pix/pix-ui/pull/419) [TECH] Ajoute un moyen d'identifier qu'on génère un Breaking Change.
|
|
15
|
+
|
|
3
16
|
## v35.0.0 (31/05/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,117 @@
|
|
|
1
1
|
.progress-gauge {
|
|
2
2
|
position: relative;
|
|
3
|
-
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-wrap: wrap;
|
|
5
|
+
align-items: center;
|
|
4
6
|
width: 100%;
|
|
7
|
+
min-width: 200px;
|
|
5
8
|
border-radius: 5px;
|
|
6
9
|
|
|
10
|
+
&__bar {
|
|
11
|
+
flex-grow: 1;
|
|
12
|
+
height: 0.875rem;
|
|
13
|
+
border: 2px solid $pix-neutral-20;
|
|
14
|
+
border-radius: 1.625rem;
|
|
15
|
+
overflow: hidden;
|
|
16
|
+
|
|
17
|
+
&::-webkit-progress-value {
|
|
18
|
+
background-color: $pix-primary;
|
|
19
|
+
border-radius: 1.625rem;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&::-moz-progress-bar {
|
|
23
|
+
background-color: $pix-primary;
|
|
24
|
+
border-radius: 1.625rem;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&::-webkit-progress-bar {
|
|
28
|
+
background-color: $pix-neutral-20;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&__text {
|
|
33
|
+
@extend %pix-body-s;
|
|
34
|
+
|
|
35
|
+
font-weight: 500;
|
|
36
|
+
margin-right: $pix-spacing-s;
|
|
37
|
+
white-space: nowrap;
|
|
38
|
+
}
|
|
39
|
+
|
|
7
40
|
&__sub-title {
|
|
8
|
-
|
|
9
|
-
|
|
41
|
+
@extend %pix-body-s;
|
|
42
|
+
|
|
43
|
+
width: 100%;
|
|
10
44
|
margin: 6px 0;
|
|
45
|
+
color: $pix-primary-60;
|
|
11
46
|
letter-spacing: 0.4px;
|
|
12
47
|
text-transform: uppercase;
|
|
13
48
|
}
|
|
49
|
+
}
|
|
14
50
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
border
|
|
19
|
-
text-align: right;
|
|
51
|
+
// THEME DARK
|
|
52
|
+
.progress-gauge--theme-dark {
|
|
53
|
+
.progress-gauge__bar {
|
|
54
|
+
border: 2px solid $pix-neutral-0;
|
|
20
55
|
}
|
|
21
56
|
|
|
22
|
-
|
|
23
|
-
|
|
57
|
+
.progress-gauge__bar::-webkit-progress-bar {
|
|
58
|
+
background-color: $pix-neutral-0;
|
|
24
59
|
}
|
|
25
60
|
|
|
26
|
-
|
|
27
|
-
|
|
61
|
+
.progress-gauge__text,
|
|
62
|
+
.progress-gauge__sub-title {
|
|
63
|
+
color: $pix-neutral-0;
|
|
28
64
|
}
|
|
65
|
+
}
|
|
29
66
|
|
|
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
|
-
}
|
|
67
|
+
// SPECIFIC BAR COLORS
|
|
68
|
+
.progress-gauge--content-blue {
|
|
69
|
+
.progress-gauge__bar::-webkit-progress-value {
|
|
70
|
+
background-color: $pix-primary;
|
|
51
71
|
}
|
|
52
72
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
& .progress-gauge__marker {
|
|
59
|
-
background: $pix-neutral-0;
|
|
60
|
-
}
|
|
73
|
+
.progress-gauge__bar::-moz-progress-bar {
|
|
74
|
+
background-color: $pix-primary;
|
|
75
|
+
}
|
|
61
76
|
|
|
62
|
-
|
|
63
|
-
|
|
77
|
+
&:not(.progress-gauge--theme-dark) {
|
|
78
|
+
.progress-gauge__text,
|
|
79
|
+
.progress-gauge__sub-title {
|
|
64
80
|
color: $pix-primary;
|
|
65
|
-
|
|
66
|
-
&::before {
|
|
67
|
-
color: $pix-neutral-0;
|
|
68
|
-
border-top-color: $pix-neutral-0;
|
|
69
|
-
}
|
|
70
81
|
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
71
84
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
85
|
+
.progress-gauge--content-green {
|
|
86
|
+
.progress-gauge__bar::-webkit-progress-value {
|
|
87
|
+
background-color: $pix-success-60;
|
|
75
88
|
}
|
|
76
89
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
90
|
+
.progress-gauge__bar::-moz-progress-bar {
|
|
91
|
+
background-color: $pix-success-60;
|
|
92
|
+
}
|
|
81
93
|
|
|
82
|
-
|
|
83
|
-
|
|
94
|
+
&:not(.progress-gauge--theme-dark) {
|
|
95
|
+
.progress-gauge__text,
|
|
96
|
+
.progress-gauge__sub-title {
|
|
97
|
+
color: $pix-success-60;
|
|
84
98
|
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
85
101
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
&::before {
|
|
91
|
-
border-top-color: $pix-primary-60;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
102
|
+
.progress-gauge--content-purple {
|
|
103
|
+
.progress-gauge__bar::-webkit-progress-value {
|
|
104
|
+
background-color: $pix-tertiary-60;
|
|
105
|
+
}
|
|
94
106
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
107
|
+
.progress-gauge__bar::-moz-progress-bar {
|
|
108
|
+
background-color: $pix-tertiary-60;
|
|
98
109
|
}
|
|
99
110
|
|
|
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
|
-
}
|
|
111
|
+
&:not(.progress-gauge--theme-dark) {
|
|
112
|
+
.progress-gauge__text,
|
|
113
|
+
.progress-gauge__sub-title {
|
|
114
|
+
color: $pix-tertiary-60;
|
|
114
115
|
}
|
|
115
116
|
}
|
|
116
117
|
}
|
|
@@ -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
|
```
|
|
@@ -53,20 +53,30 @@ Exemples :
|
|
|
53
53
|
- Un nouveau composant est ajouté
|
|
54
54
|
- Un argument facultatif est ajouté
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
Pour repérer les potentiels breaking changes, il est possible d'[installer
|
|
57
57
|
la version en cours de développement de Pix UI dans une app Ember à partir de
|
|
58
|
-
sa branche sur Github. Si, sans faire aucune autre modification que cette mise
|
|
58
|
+
sa branche sur Github](https://ui.pix.fr/?path=/docs/d%C3%A9veloppement-tester-un-composant-en-developpement-dans-une-app--page). Si, sans faire aucune autre modification que cette mise
|
|
59
59
|
à jour, on observe des changements, alors il s'agit probablement de _breaking
|
|
60
60
|
changes_.
|
|
61
61
|
|
|
62
|
+
Pour aller plus loin, il est possible d'utiliser l'outil SourceGraph pour rechercher les usages de nos composants ou styles dans nos repos publics. Ainsi, on peut savoir exactement le nombre d'usages de nos composants ou bien les attributs utilisés. Voici quelques exemples de requêtes :
|
|
63
|
+
|
|
64
|
+
- [Trouver les usages du composant `PixButton`](https://sourcegraph.com/search?q=context:global+repo:1024pix+file:.hbs+PixButton%5Cs&patternType=regexp&sm=0&groupBy=repo)
|
|
65
|
+
- [Trouver les usages du composant `PixModal`](https://sourcegraph.com/search?q=context:global+repo:1024pix+file:.hbs+PixModal%5Cs&patternType=regexp&sm=0&groupBy=repo)
|
|
66
|
+
- [Trouver les usages du placeholder SCSS `%pix-body-m`](https://sourcegraph.com/search?q=context:global+repo:1024pix+file:.scss+%25pix-body-m&patternType=standard&sm=0&groupBy=repo)
|
|
67
|
+
|
|
62
68
|
## Comment communiquer en cas de _breaking change_ ?
|
|
63
69
|
|
|
64
70
|
C'est au développeur qui ouvre la _pull request_ qu'incombe la responsabilité
|
|
65
71
|
d'identifier les éventuels _breaking changes_ dans ses modifications et, le cas
|
|
66
|
-
échéant, de les signaler dans le titre de la PR
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
de
|
|
72
|
+
échéant, de les signaler en préfixe dans le titre de la PR :
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
[BREAKING] Changement de couleur de fond par défaut du PixButton (PIX-1234)
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Enumérer précisément les fonctionnalités impactées par le breaking change, et la modification à apporter (solution de contournement ou définitive).
|
|
79
|
+
Le développeur pourra ainsi déterminer s'il les utilise, et si c'est le cas, apporter les modifications.
|
|
70
80
|
|
|
71
81
|
Ainsi :
|
|
72
82
|
|