@ministryofjustice/hmpps-arns-frontend-components-lib 0.0.6 → 0.0.7
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.
|
@@ -24,39 +24,36 @@
|
|
|
24
24
|
@param {RiskData} params.data - Risk data object from ArnsComponents.getRiskData() containing an 'assessments' array
|
|
25
25
|
@param {string} params.predictor - The name of the specific predictor to display
|
|
26
26
|
@param {boolean} [params.showScore=false] - If true, displays the percentage score
|
|
27
|
-
@param {string} [params.classes] - Optional CSS utility classes to apply to the container
|
|
28
27
|
#}
|
|
29
28
|
{% set latestAssessment = params.data.assessments | first if params.data.assessments else null %}
|
|
30
29
|
{% set showScore = params.showScore if params.showScore else false %}
|
|
31
30
|
|
|
32
|
-
{% if latestAssessment
|
|
33
|
-
|
|
34
|
-
{%
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
{%
|
|
40
|
-
|
|
41
|
-
{%
|
|
42
|
-
|
|
43
|
-
{%
|
|
44
|
-
|
|
45
|
-
{%
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
<
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
{
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
{
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
{% endfor %}
|
|
61
|
-
</div>
|
|
31
|
+
{% if latestAssessment %}
|
|
32
|
+
{% for key, predictor in latestAssessment %}
|
|
33
|
+
{% if key == params.predictor %}
|
|
34
|
+
|
|
35
|
+
{% set badgeClass = '' %}
|
|
36
|
+
{% switch predictor.band %}
|
|
37
|
+
{% case 'VERY HIGH' %}
|
|
38
|
+
{% set badgeClass = 'predictor-badge--very-high' %}
|
|
39
|
+
{% case 'HIGH' %}
|
|
40
|
+
{% set badgeClass = 'predictor-badge--high' %}
|
|
41
|
+
{% case 'MEDIUM' %}
|
|
42
|
+
{% set badgeClass = 'predictor-badge--medium' %}
|
|
43
|
+
{% case 'LOW' %}
|
|
44
|
+
{% set badgeClass = 'predictor-badge--low' %}
|
|
45
|
+
{% endswitch %}
|
|
46
|
+
<div class="{{ badgeClass }}">
|
|
47
|
+
<span class="predictor-badge__type_and_level">{{ predictor.name | upper }} <strong>{{ predictor.band }}</strong></span>
|
|
48
|
+
|
|
49
|
+
{% if showScore and predictor.score %}
|
|
50
|
+
<span class="predictor-badge__score">{{ predictor.score }}%</span>
|
|
51
|
+
{% endif %}
|
|
52
|
+
|
|
53
|
+
{% if predictor.staticOrDynamic %}
|
|
54
|
+
<span class="predictor-badge__static_or_dynamic">{{ predictor.staticOrDynamic }}</span>
|
|
55
|
+
{% endif %}
|
|
56
|
+
</div>
|
|
57
|
+
{% endif %}
|
|
58
|
+
{% endfor %}
|
|
62
59
|
{% endif %}
|
|
@@ -26,62 +26,57 @@ In template:
|
|
|
26
26
|
@param {string} params.predictor - The name of the specific predictor to display
|
|
27
27
|
@param {boolean} [params.showScore=false] - If true, displays the percentage score
|
|
28
28
|
@param {boolean} [params.fixedWidth=true] - If true or undefined, displays the expanded predictor badge in a fixed width format
|
|
29
|
-
@param {string} [params.classes] - Optional CSS utility classes to apply to the container
|
|
30
29
|
#}
|
|
31
30
|
{% set latestAssessment = params.data.assessments | first if params.data.assessments else null %}
|
|
32
31
|
{% set showScore = params.showScore if params.showScore else false %}
|
|
33
32
|
|
|
34
|
-
{% if latestAssessment
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
33
|
+
{% if latestAssessment %}
|
|
34
|
+
{% for key, predictor in latestAssessment %}
|
|
35
|
+
{% if key == params.predictor %}
|
|
36
|
+
|
|
37
|
+
{% set badgeClass = '' %}
|
|
38
|
+
{% switch predictor.band %}
|
|
39
|
+
{% case 'VERY HIGH' %}
|
|
40
|
+
{% set badgeClass = 'expanded-predictor-badge--very-high' %}
|
|
41
|
+
{% case 'HIGH' %}
|
|
42
|
+
{% set badgeClass = 'expanded-predictor-badge--high' %}
|
|
43
|
+
{% case 'MEDIUM' %}
|
|
44
|
+
{% set badgeClass = 'expanded-predictor-badge--medium' %}
|
|
45
|
+
{% case 'LOW' %}
|
|
46
|
+
{% set badgeClass = 'expanded-predictor-badge--low' %}
|
|
47
|
+
{% endswitch %}
|
|
48
|
+
|
|
49
|
+
{% set staticOrDynamicClass = 'predictor-badge__static_or_dynamic' %}
|
|
50
|
+
{% if showScore and predictor.band in ['VERY HIGH', 'MEDIUM'] and predictor.staticOrDynamic === 'DYNAMIC' %}
|
|
51
|
+
{% set staticOrDynamicClass = staticOrDynamicClass + ' predictor-badge__wrapped_static_or_dynamic' %}
|
|
52
|
+
{% endif %}
|
|
53
|
+
|
|
54
|
+
{% if params.fixedWidth or params.fixedWidth is undefined %}
|
|
55
|
+
{% set badgeWidthClass = 'expanded-predictor-badge__fixed-width' %}
|
|
56
|
+
{% else %}
|
|
57
|
+
{% set badgeWidthClass = 'expanded-predictor-badge__dynamic' %}
|
|
58
|
+
{% endif %}
|
|
59
|
+
|
|
60
|
+
<div class="{{ badgeClass }} {{ badgeWidthClass }}">
|
|
61
|
+
<span
|
|
62
|
+
class="predictor-badge__type">{{ predictor.name }}</span>
|
|
63
|
+
|
|
64
|
+
<div class="predictor-badge__stats">
|
|
65
|
+
<span class="predictor-badge__level">{{ predictor.band }}</span>
|
|
66
|
+
|
|
67
|
+
{% if showScore and predictor.score %}
|
|
68
|
+
<span class="predictor-badge__score">{{ predictor.score }}%</span>
|
|
55
69
|
{% endif %}
|
|
56
70
|
|
|
57
|
-
{% if
|
|
58
|
-
{
|
|
59
|
-
{% else %}
|
|
60
|
-
{% set badgeWidthClass = 'expanded-predictor-badge__dynamic' %}
|
|
71
|
+
{% if predictor.staticOrDynamic %}
|
|
72
|
+
<span class="{{ staticOrDynamicClass }}">{{ predictor.staticOrDynamic }}</span>
|
|
61
73
|
{% endif %}
|
|
62
74
|
|
|
63
|
-
|
|
64
|
-
<span
|
|
65
|
-
class="predictor-badge__type">{{ predictor.name }}</span>
|
|
75
|
+
</div>
|
|
66
76
|
|
|
67
|
-
|
|
68
|
-
<span class="predictor-badge__level">{{ predictor.band }}</span>
|
|
77
|
+
<span class="predictor-badge__last_updated">Last updated: {{ predictor.completedDate }}</span>
|
|
69
78
|
|
|
70
|
-
|
|
71
|
-
<span class="predictor-badge__score">{{ predictor.score }}%</span>
|
|
72
|
-
{% endif %}
|
|
73
|
-
|
|
74
|
-
{% if predictor.staticOrDynamic is defined %}
|
|
75
|
-
<span class="{{ staticOrDynamicClass }}">{{ predictor.staticOrDynamic }}</span>
|
|
76
|
-
{% endif %}
|
|
77
|
-
|
|
78
|
-
</div>
|
|
79
|
-
|
|
80
|
-
<span class="predictor-badge__last_updated">Last updated: {{ predictor.completedDate }}</span>
|
|
81
|
-
|
|
82
|
-
</div>
|
|
83
|
-
{% endif %}
|
|
84
|
-
{% endfor %}
|
|
79
|
+
</div>
|
|
85
80
|
{% endif %}
|
|
86
|
-
|
|
81
|
+
{% endfor %}
|
|
87
82
|
{% endif %}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ministryofjustice/hmpps-arns-frontend-components-lib",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "ARNS front-end library for risk score visualisations",
|
|
5
5
|
"main": "./dist/index.cjs.js",
|
|
6
6
|
"module": "./dist/index.esm.js",
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
"@ministryofjustice/hmpps-auth-clients": "^1.0.1",
|
|
115
115
|
"@ministryofjustice/hmpps-rest-client": "^1.0.0",
|
|
116
116
|
"@types/express": "^5.0.6",
|
|
117
|
-
"@types/node": "22.19.
|
|
117
|
+
"@types/node": "22.19.8",
|
|
118
118
|
"@types/nunjucks": "^3.2.6",
|
|
119
119
|
"nunjucks": "^3.2.4",
|
|
120
120
|
"superagent": "^10.3.0"
|