nhsuk-tools-chart-components-react 2.0.0-nhsuk-react-beta → 2.2.0-beta.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/README.md +1 -1
- package/dist/cjs/bundle.css +219 -219
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/bundle.css +331 -331
- package/dist/esm/components/bar-slider/bar-slider-chart-axis.js +1 -1
- package/dist/esm/components/bar-slider/bar-slider-chart-axis.js.map +1 -1
- package/dist/esm/components/bar-slider/bar-slider-chart-regions.js +1 -1
- package/dist/esm/components/bar-slider/bar-slider-chart-regions.js.map +1 -1
- package/dist/esm/components/bar-slider/bar-slider-figure-chart.js +1 -1
- package/dist/esm/components/bar-slider/bar-slider-figure-chart.js.map +1 -1
- package/dist/esm/components/blood-pressure/bp-chart.js +1 -1
- package/dist/esm/components/blood-pressure/bp-chart.js.map +1 -1
- package/dist/esm/components/blood-pressure/bp-figure-chart.js +1 -1
- package/dist/esm/components/blood-pressure/bp-figure-chart.js.map +1 -1
- package/dist/esm/components/bmi/bmi-figure-chart.js +1 -1
- package/dist/esm/components/bmi/bmi-figure-chart.js.map +1 -1
- package/dist/esm/components/chart-legend.js +1 -1
- package/dist/esm/components/chart-legend.js.map +1 -1
- package/dist/esm/components/child-bmi/cbmi-chart-marker.js +1 -1
- package/dist/esm/components/child-bmi/cbmi-chart-marker.js.map +1 -1
- package/dist/esm/components/child-bmi/cbmi-figure-chart.js +1 -1
- package/dist/esm/components/child-bmi/cbmi-figure-chart.js.map +1 -1
- package/dist/esm/models/bar-slider-chart.model.js +1 -1
- package/dist/esm/models/bar-slider-chart.model.js.map +1 -1
- package/dist/esm/utils/bar-slider.utils.js +1 -1
- package/dist/esm/utils/bar-slider.utils.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/package.json +10 -7
package/README.md
CHANGED
|
@@ -56,7 +56,7 @@ A `storybook` instance for the components can be found in `https://red-water-0aa
|
|
|
56
56
|
|
|
57
57
|
## Installation
|
|
58
58
|
|
|
59
|
-
Ensure you have Node.js
|
|
59
|
+
Ensure you have Node.js 204x.x. installed. Usage of NVM is recommended, to allow for easily switching between versions on different projects.
|
|
60
60
|
|
|
61
61
|
`npm install` will install dependencies.
|
|
62
62
|
|
package/dist/cjs/bundle.css
CHANGED
|
@@ -30,36 +30,6 @@
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
|
|
33
|
-
.nhsuk-bmi-legend-key-classification-underweight, .nhsuk-bmi-classification-underweight {
|
|
34
|
-
background: #330072;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.nhsuk-bmi-legend-key-classification-healthy, .nhsuk-bmi-classification-healthy {
|
|
38
|
-
background: repeating-linear-gradient(-45deg, #30b4ab, #30b4ab 4.5px, #00a499 4.5px, #00a499 9px);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.nhsuk-bmi-legend-key-classification-overweight, .nhsuk-bmi-classification-overweight {
|
|
42
|
-
background: #ffb81c;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.nhsuk-bmi-legend-key-classification-obese, .nhsuk-bmi-classification-obese {
|
|
46
|
-
background: repeating-linear-gradient(45deg, #da5147, #da5147 4.5px, #d5281b 4.5px, #d5281b 9px);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.nhsuk-bmi-graph {
|
|
50
|
-
position: relative;
|
|
51
|
-
outline: 1px solid black;
|
|
52
|
-
display: flex;
|
|
53
|
-
height: 28px;
|
|
54
|
-
margin-bottom: nhsuk-spacing(4);
|
|
55
|
-
}
|
|
56
|
-
@media (min-width: 320px) and (max-width: 641px) {
|
|
57
|
-
.nhsuk-bmi-graph {
|
|
58
|
-
height: 24px;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
33
|
.nhsuk-bar-slider-arrow-marker {
|
|
64
34
|
position: absolute;
|
|
65
35
|
height: 16px;
|
|
@@ -104,6 +74,32 @@
|
|
|
104
74
|
margin-right: 2px;
|
|
105
75
|
}
|
|
106
76
|
|
|
77
|
+
.nhsuk-bmi-classification-underweight, .nhsuk-bmi-legend-key-classification-underweight {
|
|
78
|
+
background: #330072;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.nhsuk-bmi-classification-healthy, .nhsuk-bmi-legend-key-classification-healthy {
|
|
82
|
+
background: repeating-linear-gradient(-45deg, #30b4ab, #30b4ab 4.5px, #00a499 4.5px, #00a499 9px);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.nhsuk-bmi-classification-overweight, .nhsuk-bmi-legend-key-classification-overweight {
|
|
86
|
+
background: #ffb81c;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.nhsuk-bmi-classification-obese, .nhsuk-bmi-legend-key-classification-obese {
|
|
90
|
+
background: repeating-linear-gradient(45deg, #da5147, #da5147 4.5px, #d5281b 4.5px, #d5281b 9px);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.nhsuk-bmi-legend-key-classification-obese {
|
|
94
|
+
border-bottom: none;
|
|
95
|
+
box-shadow: none;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.nhsuk-bmi-legend-key-marker {
|
|
99
|
+
border-bottom: none;
|
|
100
|
+
box-shadow: none;
|
|
101
|
+
}
|
|
102
|
+
|
|
107
103
|
|
|
108
104
|
.nhsuk-bmi-chart-marker {
|
|
109
105
|
position: absolute;
|
|
@@ -120,20 +116,35 @@
|
|
|
120
116
|
}
|
|
121
117
|
}
|
|
122
118
|
|
|
119
|
+
.nhsuk-bmi-axis-marker {
|
|
120
|
+
position: absolute;
|
|
121
|
+
outline: 0.5px solid black;
|
|
122
|
+
height: 5px;
|
|
123
|
+
bottom: -5px;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.nhsuk-bmi-axis-marker-label {
|
|
127
|
+
position: absolute;
|
|
128
|
+
bottom: -25px;
|
|
129
|
+
left: -10px;
|
|
130
|
+
width: 20px;
|
|
131
|
+
text-align: center;
|
|
132
|
+
}
|
|
123
133
|
|
|
124
|
-
|
|
134
|
+
|
|
135
|
+
.nhsuk-bmi-classification-underweight, .nhsuk-bmi-legend-key-classification-underweight {
|
|
125
136
|
background: #330072;
|
|
126
137
|
}
|
|
127
138
|
|
|
128
|
-
.nhsuk-bmi-
|
|
139
|
+
.nhsuk-bmi-classification-healthy, .nhsuk-bmi-legend-key-classification-healthy {
|
|
129
140
|
background: repeating-linear-gradient(-45deg, #30b4ab, #30b4ab 4.5px, #00a499 4.5px, #00a499 9px);
|
|
130
141
|
}
|
|
131
142
|
|
|
132
|
-
.nhsuk-bmi-
|
|
143
|
+
.nhsuk-bmi-classification-overweight, .nhsuk-bmi-legend-key-classification-overweight {
|
|
133
144
|
background: #ffb81c;
|
|
134
145
|
}
|
|
135
146
|
|
|
136
|
-
.nhsuk-bmi-
|
|
147
|
+
.nhsuk-bmi-classification-obese, .nhsuk-bmi-legend-key-classification-obese {
|
|
137
148
|
background: repeating-linear-gradient(45deg, #da5147, #da5147 4.5px, #d5281b 4.5px, #d5281b 9px);
|
|
138
149
|
}
|
|
139
150
|
|
|
@@ -168,6 +179,7 @@
|
|
|
168
179
|
box-shadow: none;
|
|
169
180
|
}
|
|
170
181
|
|
|
182
|
+
|
|
171
183
|
.nhsuk-bmi-legend-key-classification-underweight, .nhsuk-bmi-classification-underweight {
|
|
172
184
|
background: #330072;
|
|
173
185
|
}
|
|
@@ -184,94 +196,72 @@
|
|
|
184
196
|
background: repeating-linear-gradient(45deg, #da5147, #da5147 4.5px, #d5281b 4.5px, #d5281b 9px);
|
|
185
197
|
}
|
|
186
198
|
|
|
187
|
-
.nhsuk-bmi-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
border-bottom: none;
|
|
194
|
-
box-shadow: none;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
.nhsuk-bmi-axis-marker {
|
|
198
|
-
position: absolute;
|
|
199
|
-
outline: 0.5px solid black;
|
|
200
|
-
height: 5px;
|
|
201
|
-
bottom: -5px;
|
|
199
|
+
.nhsuk-bmi-graph {
|
|
200
|
+
position: relative;
|
|
201
|
+
outline: 1px solid black;
|
|
202
|
+
display: flex;
|
|
203
|
+
height: 28px;
|
|
204
|
+
margin-bottom: nhsuk-spacing(4);
|
|
202
205
|
}
|
|
203
|
-
|
|
204
|
-
.nhsuk-bmi-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
left: -10px;
|
|
208
|
-
width: 20px;
|
|
209
|
-
text-align: center;
|
|
206
|
+
@media (min-width: 320px) and (max-width: 641px) {
|
|
207
|
+
.nhsuk-bmi-graph {
|
|
208
|
+
height: 24px;
|
|
209
|
+
}
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
-
.nhsuk-bp-classification-low, .nhsuk-bp-legend-key-classification-low {
|
|
213
|
-
background: #330072;
|
|
214
|
-
}
|
|
215
212
|
|
|
216
|
-
.nhsuk-bp-
|
|
217
|
-
|
|
213
|
+
.nhsuk-bp-graph {
|
|
214
|
+
position: relative;
|
|
215
|
+
margin-left: 20px;
|
|
216
|
+
margin-right: 20px;
|
|
217
|
+
outline: 2px solid black;
|
|
218
|
+
display: flex;
|
|
219
|
+
flex-direction: column;
|
|
220
|
+
height: 350px;
|
|
218
221
|
}
|
|
219
|
-
|
|
220
|
-
.nhsuk-bp-
|
|
221
|
-
|
|
222
|
+
@media (max-width: 320px) {
|
|
223
|
+
.nhsuk-bp-graph {
|
|
224
|
+
height: 225px;
|
|
225
|
+
}
|
|
222
226
|
}
|
|
223
|
-
|
|
224
|
-
.nhsuk-bp-
|
|
225
|
-
|
|
227
|
+
@media (min-width: 320px) and (max-width: 641px) {
|
|
228
|
+
.nhsuk-bp-graph {
|
|
229
|
+
height: 275px;
|
|
230
|
+
}
|
|
226
231
|
}
|
|
227
232
|
|
|
228
|
-
|
|
229
|
-
|
|
233
|
+
.nhsuk-bp-graph-row {
|
|
234
|
+
flex-grow: 1;
|
|
235
|
+
display: flex;
|
|
230
236
|
}
|
|
231
237
|
|
|
232
|
-
.nhsuk-bp-legend-
|
|
238
|
+
.nhsuk-bp-systolic-legend-wrapper {
|
|
233
239
|
display: flex;
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
margin-top: 5px;
|
|
240
|
+
align-items: flex-end;
|
|
241
|
+
margin-bottom: 10px;
|
|
237
242
|
}
|
|
238
243
|
|
|
239
|
-
.nhsuk-bp-legend-
|
|
240
|
-
|
|
241
|
-
|
|
244
|
+
.nhsuk-bp-diastolic-legend-wrapper {
|
|
245
|
+
display: flex;
|
|
246
|
+
align-items: flex-start;
|
|
247
|
+
margin-top: 30px;
|
|
248
|
+
padding-left: 18px;
|
|
242
249
|
}
|
|
243
250
|
|
|
244
|
-
.nhsuk-bp-legend-
|
|
245
|
-
|
|
246
|
-
|
|
251
|
+
.nhsuk-bp-diastolic-legend-marker, .nhsuk-bp-systolic-legend-marker {
|
|
252
|
+
height: 16px;
|
|
253
|
+
margin-right: 5px;
|
|
254
|
+
border-left: 2px solid black;
|
|
247
255
|
}
|
|
248
256
|
|
|
249
|
-
.nhsuk-bp-legend-
|
|
250
|
-
|
|
251
|
-
|
|
257
|
+
.nhsuk-bp-systolic-legend-marker {
|
|
258
|
+
width: 40px;
|
|
259
|
+
border-top: 2px solid black;
|
|
252
260
|
}
|
|
253
261
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
z-index: 6;
|
|
258
|
-
height: 24px;
|
|
259
|
-
width: 24px;
|
|
260
|
-
margin: 0 0 -12px -12px;
|
|
261
|
-
}
|
|
262
|
-
@media (max-width: 320px) {
|
|
263
|
-
.nhsuk-bp-graph-marker {
|
|
264
|
-
height: 20px;
|
|
265
|
-
width: 20px;
|
|
266
|
-
margin: 0 0 -10px -10px;
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
@media (min-width: 320px) and (max-width: 641px) {
|
|
270
|
-
.nhsuk-bp-graph-marker {
|
|
271
|
-
height: 22px;
|
|
272
|
-
width: 22px;
|
|
273
|
-
margin: 0 0 -11px -11px;
|
|
274
|
-
}
|
|
262
|
+
.nhsuk-bp-diastolic-legend-marker {
|
|
263
|
+
width: 20px;
|
|
264
|
+
border-bottom: 2px solid black;
|
|
275
265
|
}
|
|
276
266
|
|
|
277
267
|
|
|
@@ -335,97 +325,46 @@
|
|
|
335
325
|
text-align: center;
|
|
336
326
|
}
|
|
337
327
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
position: relative;
|
|
341
|
-
margin-left: 20px;
|
|
342
|
-
margin-right: 20px;
|
|
343
|
-
outline: 2px solid black;
|
|
344
|
-
display: flex;
|
|
345
|
-
flex-direction: column;
|
|
346
|
-
height: 350px;
|
|
347
|
-
}
|
|
348
|
-
@media (max-width: 320px) {
|
|
349
|
-
.nhsuk-bp-graph {
|
|
350
|
-
height: 225px;
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
@media (min-width: 320px) and (max-width: 641px) {
|
|
354
|
-
.nhsuk-bp-graph {
|
|
355
|
-
height: 275px;
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
.nhsuk-bp-graph-row {
|
|
360
|
-
flex-grow: 1;
|
|
361
|
-
display: flex;
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
.nhsuk-bp-systolic-legend-wrapper {
|
|
365
|
-
display: flex;
|
|
366
|
-
align-items: flex-end;
|
|
367
|
-
margin-bottom: 10px;
|
|
328
|
+
.nhsuk-bp-classification-low, .nhsuk-bp-legend-key-classification-low {
|
|
329
|
+
background: #330072;
|
|
368
330
|
}
|
|
369
331
|
|
|
370
|
-
.nhsuk-bp-
|
|
371
|
-
|
|
372
|
-
align-items: flex-start;
|
|
373
|
-
margin-top: 30px;
|
|
374
|
-
padding-left: 18px;
|
|
332
|
+
.nhsuk-bp-classification-healthy, .nhsuk-bp-legend-key-classification-healthy {
|
|
333
|
+
background: repeating-linear-gradient(-45deg, #59c3bc, #59c3bc 4.5px, #33b6ad 4.5px, #33b6ad 9px);
|
|
375
334
|
}
|
|
376
335
|
|
|
377
|
-
.nhsuk-bp-
|
|
378
|
-
|
|
379
|
-
margin-right: 5px;
|
|
380
|
-
border-left: 2px solid black;
|
|
336
|
+
.nhsuk-bp-classification-slightlyraised, .nhsuk-bp-legend-key-classification-slightlyraised {
|
|
337
|
+
background: #ffb81c;
|
|
381
338
|
}
|
|
382
339
|
|
|
383
|
-
.nhsuk-bp-
|
|
384
|
-
|
|
385
|
-
border-top: 2px solid black;
|
|
340
|
+
.nhsuk-bp-classification-high, .nhsuk-bp-legend-key-classification-high {
|
|
341
|
+
background: repeating-linear-gradient(45deg, #e1746b, #e1746b 4.5px, #dd5349 4.5px, #dd5349 9px);
|
|
386
342
|
}
|
|
387
343
|
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
border-bottom: 2px solid black;
|
|
344
|
+
#nhsuk-bp-chart > figure {
|
|
345
|
+
margin: 0;
|
|
391
346
|
}
|
|
392
347
|
|
|
393
|
-
.nhsuk-
|
|
394
|
-
|
|
348
|
+
.nhsuk-bp-legend-key-wrapper {
|
|
349
|
+
display: flex;
|
|
395
350
|
}
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
background: #ffb81c;
|
|
351
|
+
.nhsuk-bp-legend-key-wrapper:last-child {
|
|
352
|
+
margin-top: 5px;
|
|
399
353
|
}
|
|
400
354
|
|
|
401
|
-
.nhsuk-
|
|
402
|
-
|
|
355
|
+
.nhsuk-bp-legend-display-card {
|
|
356
|
+
margin-top: 50px;
|
|
357
|
+
max-width: 300px;
|
|
403
358
|
}
|
|
404
359
|
|
|
405
|
-
.nhsuk-
|
|
360
|
+
.nhsuk-bp-legend-key-classification-low {
|
|
406
361
|
border-bottom: none;
|
|
407
362
|
box-shadow: none;
|
|
408
363
|
}
|
|
409
364
|
|
|
410
|
-
.nhsuk-
|
|
411
|
-
border-bottom:
|
|
412
|
-
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
.nhsuk-cbmi-legend-marker {
|
|
416
|
-
margin-bottom: 2px;
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
.nhsuk-cbmi-classification-underweight-heading {
|
|
420
|
-
border-left: 8px solid #330072;
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
.nhsuk-cbmi-classification-healthy-heading {
|
|
424
|
-
border-left: 8px solid #30b4ab;
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
.nhsuk-cbmi-classification-overweight-heading {
|
|
428
|
-
border-left: 8px solid #ffb81c;
|
|
365
|
+
.nhsuk-bp-legend-key-marker {
|
|
366
|
+
border-bottom: none;
|
|
367
|
+
box-shadow: none;
|
|
429
368
|
}
|
|
430
369
|
|
|
431
370
|
.nhsuk-bp-classification-low, .nhsuk-bp-legend-key-classification-low {
|
|
@@ -479,32 +418,6 @@
|
|
|
479
418
|
z-index: 0;
|
|
480
419
|
}
|
|
481
420
|
|
|
482
|
-
|
|
483
|
-
.nhsuk-cbmi-classification-healthy, .nhsuk-cbmi-legend-key-classification-healthy {
|
|
484
|
-
background: repeating-linear-gradient(-45deg, #30b4ab, #30b4ab 4.5px, #00a499 4.5px, #00a499 9px);
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
.nhsuk-cbmi-classification-overweight, .nhsuk-cbmi-legend-key-classification-overweight {
|
|
488
|
-
background: #ffb81c;
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
.nhsuk-cbmi-classification-underweight, .nhsuk-cbmi-legend-key-classification-underweight {
|
|
492
|
-
background: #330072;
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
.nhsuk-cbmi-graph {
|
|
496
|
-
position: relative;
|
|
497
|
-
outline: 1px solid black;
|
|
498
|
-
margin-top: 20px;
|
|
499
|
-
display: flex;
|
|
500
|
-
height: 28px;
|
|
501
|
-
}
|
|
502
|
-
@media (min-width: 320px) and (max-width: 641px) {
|
|
503
|
-
.nhsuk-cbmi-graph {
|
|
504
|
-
height: 24px;
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
|
|
508
421
|
.nhsuk-bp-graph-cell {
|
|
509
422
|
flex-grow: 1;
|
|
510
423
|
border-bottom: 1px solid white;
|
|
@@ -534,39 +447,51 @@
|
|
|
534
447
|
background: #330072;
|
|
535
448
|
}
|
|
536
449
|
|
|
537
|
-
.nhsuk-cbmi-
|
|
538
|
-
position:
|
|
539
|
-
bottom: 0%;
|
|
450
|
+
.nhsuk-cbmi-graph {
|
|
451
|
+
position: relative;
|
|
540
452
|
outline: 1px solid black;
|
|
453
|
+
margin-top: 20px;
|
|
454
|
+
display: flex;
|
|
541
455
|
height: 28px;
|
|
542
456
|
}
|
|
543
457
|
@media (min-width: 320px) and (max-width: 641px) {
|
|
544
|
-
.nhsuk-cbmi-
|
|
458
|
+
.nhsuk-cbmi-graph {
|
|
545
459
|
height: 24px;
|
|
546
460
|
}
|
|
547
461
|
}
|
|
548
462
|
|
|
549
|
-
.nhsuk-cbmi-classification-underweight {
|
|
550
|
-
z-index: 3;
|
|
551
|
-
}
|
|
552
463
|
|
|
553
|
-
.nhsuk-
|
|
554
|
-
|
|
464
|
+
.nhsuk-bp-graph-marker {
|
|
465
|
+
position: absolute;
|
|
466
|
+
z-index: 6;
|
|
467
|
+
height: 24px;
|
|
468
|
+
width: 24px;
|
|
469
|
+
margin: 0 0 -12px -12px;
|
|
555
470
|
}
|
|
556
|
-
|
|
557
|
-
.nhsuk-
|
|
558
|
-
|
|
471
|
+
@media (max-width: 320px) {
|
|
472
|
+
.nhsuk-bp-graph-marker {
|
|
473
|
+
height: 20px;
|
|
474
|
+
width: 20px;
|
|
475
|
+
margin: 0 0 -10px -10px;
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
@media (min-width: 320px) and (max-width: 641px) {
|
|
479
|
+
.nhsuk-bp-graph-marker {
|
|
480
|
+
height: 22px;
|
|
481
|
+
width: 22px;
|
|
482
|
+
margin: 0 0 -11px -11px;
|
|
483
|
+
}
|
|
559
484
|
}
|
|
560
485
|
|
|
561
|
-
.nhsuk-cbmi-
|
|
486
|
+
.nhsuk-cbmi-classification-healthy, .nhsuk-cbmi-legend-key-classification-healthy {
|
|
562
487
|
background: repeating-linear-gradient(-45deg, #30b4ab, #30b4ab 4.5px, #00a499 4.5px, #00a499 9px);
|
|
563
488
|
}
|
|
564
489
|
|
|
565
|
-
.nhsuk-cbmi-
|
|
490
|
+
.nhsuk-cbmi-classification-overweight, .nhsuk-cbmi-legend-key-classification-overweight {
|
|
566
491
|
background: #ffb81c;
|
|
567
492
|
}
|
|
568
493
|
|
|
569
|
-
.nhsuk-cbmi-
|
|
494
|
+
.nhsuk-cbmi-classification-underweight, .nhsuk-cbmi-legend-key-classification-underweight {
|
|
570
495
|
background: #330072;
|
|
571
496
|
}
|
|
572
497
|
|
|
@@ -594,16 +519,54 @@
|
|
|
594
519
|
text-align: center;
|
|
595
520
|
}
|
|
596
521
|
|
|
522
|
+
.nhsuk-cbmi-classification-healthy, .nhsuk-cbmi-legend-key-classification-healthy {
|
|
523
|
+
background: repeating-linear-gradient(-45deg, #30b4ab, #30b4ab 4.5px, #00a499 4.5px, #00a499 9px);
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
.nhsuk-cbmi-classification-overweight, .nhsuk-cbmi-legend-key-classification-overweight {
|
|
527
|
+
background: #ffb81c;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
.nhsuk-cbmi-classification-underweight, .nhsuk-cbmi-legend-key-classification-underweight {
|
|
531
|
+
background: #330072;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
.nhsuk-cbmi-legend-key-classification-overweight {
|
|
535
|
+
border-bottom: none;
|
|
536
|
+
box-shadow: none;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
.nhsuk-cbmi-legend-key, .nhsuk-cbmi-legend-key-classification-underweight, .nhsuk-cbmi-legend-key-classification-healthy, .nhsuk-cbmi-legend-key-classification-overweight {
|
|
540
|
+
border-bottom: 2px solid white;
|
|
541
|
+
margin-bottom: 2px;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
.nhsuk-cbmi-legend-marker {
|
|
545
|
+
margin-bottom: 2px;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
.nhsuk-cbmi-classification-underweight-heading {
|
|
549
|
+
border-left: 8px solid #330072;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
.nhsuk-cbmi-classification-healthy-heading {
|
|
553
|
+
border-left: 8px solid #30b4ab;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
.nhsuk-cbmi-classification-overweight-heading {
|
|
557
|
+
border-left: 8px solid #ffb81c;
|
|
558
|
+
}
|
|
559
|
+
|
|
597
560
|
|
|
598
|
-
.nhsuk-cbmi-
|
|
561
|
+
.nhsuk-cbmi-classification-healthy, .nhsuk-cbmi-legend-key-classification-healthy {
|
|
599
562
|
background: repeating-linear-gradient(-45deg, #30b4ab, #30b4ab 4.5px, #00a499 4.5px, #00a499 9px);
|
|
600
563
|
}
|
|
601
564
|
|
|
602
|
-
.nhsuk-cbmi-
|
|
565
|
+
.nhsuk-cbmi-classification-overweight, .nhsuk-cbmi-legend-key-classification-overweight {
|
|
603
566
|
background: #ffb81c;
|
|
604
567
|
}
|
|
605
568
|
|
|
606
|
-
.nhsuk-cbmi-
|
|
569
|
+
.nhsuk-cbmi-classification-underweight, .nhsuk-cbmi-legend-key-classification-underweight {
|
|
607
570
|
background: #330072;
|
|
608
571
|
}
|
|
609
572
|
|
|
@@ -664,4 +627,41 @@
|
|
|
664
627
|
.nhsuk-cbmi-chart-axis-marker {
|
|
665
628
|
height: 24px;
|
|
666
629
|
}
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
|
|
633
|
+
.nhsuk-cbmi-classification-healthy, .nhsuk-cbmi-legend-key-classification-healthy {
|
|
634
|
+
background: repeating-linear-gradient(-45deg, #30b4ab, #30b4ab 4.5px, #00a499 4.5px, #00a499 9px);
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
.nhsuk-cbmi-classification-overweight, .nhsuk-cbmi-legend-key-classification-overweight {
|
|
638
|
+
background: #ffb81c;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
.nhsuk-cbmi-classification-underweight, .nhsuk-cbmi-legend-key-classification-underweight {
|
|
642
|
+
background: #330072;
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
.nhsuk-cbmi-classification-overweight, .nhsuk-cbmi-classification-healthy, .nhsuk-cbmi-classification-underweight {
|
|
646
|
+
position: absolute;
|
|
647
|
+
bottom: 0%;
|
|
648
|
+
outline: 1px solid black;
|
|
649
|
+
height: 28px;
|
|
650
|
+
}
|
|
651
|
+
@media (min-width: 320px) and (max-width: 641px) {
|
|
652
|
+
.nhsuk-cbmi-classification-overweight, .nhsuk-cbmi-classification-healthy, .nhsuk-cbmi-classification-underweight {
|
|
653
|
+
height: 24px;
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
.nhsuk-cbmi-classification-underweight {
|
|
658
|
+
z-index: 3;
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
.nhsuk-cbmi-classification-healthy {
|
|
662
|
+
z-index: 2;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
.nhsuk-cbmi-classification-overweight {
|
|
666
|
+
z-index: 1;
|
|
667
667
|
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("react"),t=require("nhsuk-react-components"),a=require("big.js");function n(e){const t=function(e){if(e.axis.ticks.length<=2)throw Error("invalid number of axis ticks");const t=[...e.axis.ticks].sort(((e,t)=>e.value-t.value));return e.segments.map(((e,a)=>{var n,r;const s=null!==(n=e.start)&&void 0!==n?n:t[a].value,l=null!==(r=e.end)&&void 0!==r?r:t[a+1].value;return Object.assign(Object.assign({},e),{start:s,end:l})}))}(e),a=t.reduce(((e,t)=>{var a;return e+(null!==(a=t.weight)&&void 0!==a?a:0)}),0),n=t.filter((e=>void 0===e.weight)).reduce(((e,t)=>e+(t.end-t.start)),0),r=100-a;if(r<0)throw new Error("Invalid segment weight.");return t.map((e=>{if(void 0!==e.weight)return e;const t=(e.end-e.start)/n*r;return Object.assign(Object.assign({},e),{weight:t})}))}class r{constructor(e,t){this.chartWidth=t,this.chartName=e.name,this.axis=e.axis,this.constraints=e.constraints,this.segments=n(e)}get name(){return this.chartName}getAxisTicks(){return Object.values(this.axis.ticks).map((e=>{var t;const a=null===(t=e.isVisible)||void 0===t||t;return{label:e.value.toString(),value:this.calculateRawPosition(e.value),isVisible:a}}))}getChartRegions(){return Object.values(this.axis.ticks).slice(1).map((e=>({value:this.calculateRawPosition(e.value),styleClass:this.segmentstyleSuffix(e.value)})))}segmentstyleSuffix(e){const t=this.getSegmentByTick(e);return(null==t?void 0:t.styleSuffix)?`${this.chartName}-${t.styleSuffix}`:""}getSegmentByTick(e){for(const t of this.segments)if(e>=t.start&&e<=t.end)return t;return null}calculatePosition(e){if(this.constraints){const{value:t,position:a}=this.constraints.max;if(e>=t)return a}return this.calculateRawPosition(e)}calculateRawPosition(e){let t=0;const a=this.clampValue(e),{totalSegmentsWidth:n}=this;for(const e of this.segments){if(a>=e.start&&a<=e.end){return t+(a-e.start)/(e.end-e.start)*(e.weight/n)*this.chartWidth}t+=e.weight/n*this.chartWidth}return 0}clampValue(e){return Math.min(Math.max(e,this.axis.ticks[0].value),this.axis.ticks[this.axis.ticks.length-1].value)}get totalSegmentsWidth(){return this.segments.reduce(((e,t)=>e+t.weight),0)}}const s=(e,t)=>t>0?`${e}-axis-marker-label`:`${e}-start-axis-marker-label`,l=(e,t)=>t>0?`${e}-axis-marker`:`${e}-start-axis-marker`;function i({chartName:t,markerText:a,offsetPercent:n}){return e.createElement("div",{className:`${l(t,n)}`,style:{left:`${n}%`}},e.createElement("div",{className:`nhsuk-font-size-16 nhsuk-u-secondary-text-color ${s(t,n)}`},a))}function c({model:t}){return e.createElement(e.Fragment,null,t.getAxisTicks().map((({label:a,value:n,isVisible:r})=>r&&e.createElement(i,{chartName:t.name,markerText:a,offsetPercent:n,key:a}))))}function o(){return e.createElement("svg",{viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M6 9L0.803849 -9.78799e-07L11.1962 -7.02746e-08L6 9Z",fill:"black"}))}const u=(e,t)=>t<=20?`${e}-label-align-left`:t<=80?`${e}-label-align-center`:`${e}-label-align-right`;function m({chartName:t,value:a,offset:n,markerText:r}){return e.createElement("div",{className:`${t}-label-marker`},e.createElement("div",{className:`nhsuk-font-size-16 ${u(t,n)}`},r,e.createElement("span",{className:`${t}-value-marker`},a)))}function d({value:t,model:a,markerText:n}){const r=a.calculatePosition(t),s=Math.pow(10,1),l=Math.round(r*s)/s;return e.createElement(e.Fragment,null,e.createElement("div",{className:`${a.name}-arrow-marker`,style:{left:`${l}%`}},e.createElement(m,{chartName:a.name,value:t,markerText:n,offset:l}),e.createElement(o,null)),e.createElement("div",{className:`${a.name}-value-axis-marker`,style:{left:`${l}%`}}))}function h({value:t,styleClass:a}){return e.createElement("div",{className:a,style:{width:`${t}%`}})}function g({model:t}){return e.createElement(e.Fragment,null,t.getChartRegions().map((({value:t,styleClass:a})=>e.createElement(h,{value:t,styleClass:a,key:t}))))}const f=100;function p({config:t,value:a,markerText:n}){const s=new r(t,f);return e.createElement("div",{className:`${t.name}-graph nhsuk-u-margin-bottom-9`,"aria-hidden":"true"},e.createElement(c,{model:s}),e.createElement(d,{value:a,markerText:n,model:s}),e.createElement(g,{model:s}))}function b({element:t,text:a,className:n,wrapperClassName:r}){return e.createElement("div",{className:`nhsuk-chart-legend-key-wrapper ${null!=r?r:""}`},e.createElement("div",{className:`nhsuk-chart-legend-key ${null!=n?n:""}`},t),a)}function k({legendKeys:a,className:n}){return e.createElement(t.Card,{className:`${n} nhsuk-u-padding-3 nhsuk-chart-legend-card`},a.map((t=>e.createElement(b,Object.assign({key:t.text},t)))))}function y({legendKeys:t,className:a}){return e.createElement("div",{className:a},t.map((t=>e.createElement(b,Object.assign({key:t.text},t)))))}function v({legendKeys:t,borderWrapper:a=!0}){const n="nhsuk-u-margin-top-6 nhsuk-u-margin-bottom-3 nhsuk-u-secondary-text-color nhsuk-body-s";return e.createElement("div",{"aria-hidden":"true"},a?e.createElement(k,{legendKeys:t,className:n}):e.createElement(y,{legendKeys:t,className:n}))}const E={Underweight:"underweight",Healthy:"healthy",Overweight:"overweight"},w=Object.assign(Object.assign({},E),{Obese:"obese"}),x=Object.assign(Object.assign({},E),{Obese1:"obese1",Obese2:"obese2",Obese3:"obese3"});x.Underweight,x.Healthy,x.Underweight,x.Overweight,x.Healthy;class L{constructor(e){this.bounds={lowerBound:17.5,upperBounds:{[w.Underweight]:e.upper[x.Underweight].value,[w.Healthy]:e.upper[x.Healthy].value,[w.Overweight]:e.upper[x.Overweight].value,[w.Obese]:e.upper[x.Obese2].value}}}get chartRange(){return this.bounds.upperBounds[w.Obese]-this.bounds.lowerBound}classificationPercentage(e){return this.offsetPercentage(this.bounds.upperBounds[e])}offsetPercentage(e){return(e-this.bounds.lowerBound)/this.chartRange*100}}function N(){return e.createElement("svg",{viewBox:"1 1 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("g",{clipPath:"url(#clip0_1346_102759)"},e.createElement("path",{xmlns:"http://www.w3.org/2000/svg",d:"M1.93209 4.05025L1.57854 4.40381L1.93209 4.75736L6.17473 9L1.93209 13.2426L1.57854 13.5962L1.93209 13.9497L4.05341 16.0711L4.40697 16.4246L4.76052 16.0711L9.00316 11.8284L13.2458 16.0711L13.5994 16.4246L13.9529 16.0711L16.0742 13.9497L16.4278 13.5962L16.0742 13.2426L11.8316 9L16.0742 4.75736L16.4278 4.40381L16.0742 4.05025L13.9529 1.92893L13.5994 1.57538L13.2458 1.92893L9.00316 6.17157L4.76052 1.92893L4.40697 1.57538L4.05341 1.92893L1.93209 4.05025Z",fill:"black",stroke:"white"})))}function B({bmi:t,model:a}){const n=a.offsetPercentage(t);let r=0;if(n>0){const e=1,t=Math.pow(10,e);r=Math.round(n*t)/t}return e.createElement("div",{className:"nhsuk-bmi-chart-marker",style:{left:`${r}%`}},e.createElement(N,null))}function $({classification:t,model:a}){const n=a.classificationPercentage(t);return e.createElement("div",{className:`nhsuk-bmi-classification-${t}`,style:{width:`${n}%`}})}function T({model:t}){return e.createElement(e.Fragment,null,e.createElement($,{classification:w.Underweight,model:t}),e.createElement($,{classification:w.Healthy,model:t}),e.createElement($,{classification:w.Overweight,model:t}),e.createElement($,{classification:w.Obese,model:t}))}function O({markerText:t,offsetPercent:a}){return e.createElement("div",{className:"nhsuk-bmi-axis-marker",style:{left:`${a}%`}},e.createElement("div",{className:"nhsuk-bmi-axis-marker-label"},t))}function P({model:t}){return e.createElement(e.Fragment,null,e.createElement(O,{markerText:t.bounds.upperBounds[w.Underweight].toString(),offsetPercent:t.classificationPercentage(w.Underweight)}),e.createElement(O,{markerText:t.bounds.upperBounds[w.Healthy].toString(),offsetPercent:t.classificationPercentage(w.Healthy)}),e.createElement(O,{markerText:t.bounds.upperBounds[w.Overweight].toString(),offsetPercent:t.classificationPercentage(w.Overweight)}))}function S({classificationBounds:t,bmi:a}){const n=new L(t);return e.createElement("div",{className:"nhsuk-bmi-graph","aria-hidden":"true"},e.createElement(P,{model:n}),e.createElement(B,{bmi:a,model:n}),e.createElement(T,{model:n}))}const R={Low:"low",Healthy:"healthy",SlightlyRaised:"slightlyRaised",High:"high"};var C;function H({axisType:t,labelText:a,offsetPercent:n,applyLabelSpecificStyles:r=!0}){const s=`${C[t].toLowerCase()}-axis`,l=`nhsuk-bp-${s}-marker`,i=`nhsuk-bp-${s}-marker-${a}`;return e.createElement("div",{className:r?`${l} ${i}`:`${l}`,style:t===C.Systolic?{bottom:`${n}%`}:{left:`${n}%`}},e.createElement("div",{className:`nhsuk-bp-${s}-label`},a))}function U(e,t,a){return(e-a)/(t-a)*100}function j(e,t,a){return U(t[e].value,t[R.High].value,a)}function M({axisType:t,upperBounds:a,lowerBound:n}){const r={slightlyRaisedValueToCheck:85,slightlyRaisedValueToAdd:90};return e.createElement("div",null,e.createElement(H,{labelText:n.toString(),offsetPercent:0,axisType:t}),e.createElement(H,{labelText:a[R.Low].value.toString(),offsetPercent:j(R.Low,a,n),axisType:t}),e.createElement(H,{labelText:a[R.Healthy].value.toString(),offsetPercent:j(R.Healthy,a,n),axisType:t}),e.createElement(H,{labelText:a[R.SlightlyRaised].value.toString(),offsetPercent:j(R.SlightlyRaised,a,n),axisType:t,applyLabelSpecificStyles:a[R.SlightlyRaised].value===r.slightlyRaisedValueToCheck}),t===C.Diastolic&&a[R.SlightlyRaised].value===r.slightlyRaisedValueToCheck&&e.createElement(H,{labelText:r.slightlyRaisedValueToAdd.toString(),offsetPercent:U(r.slightlyRaisedValueToAdd,a[R.High].value,n),axisType:t}),e.createElement(H,{labelText:a[R.High].value.toString(),offsetPercent:100,axisType:t}))}function F({bounds:t}){return e.createElement(e.Fragment,null,e.createElement(M,{axisType:C.Systolic,upperBounds:t.systolic.upper,lowerBound:t.systolic.lower}),e.createElement(M,{axisType:C.Diastolic,upperBounds:t.diastolic.upper,lowerBound:t.diastolic.lower}))}function A(){return e.createElement("svg",{viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("g",{clipPath:"url(#clip0_1346_102759)"},e.createElement("path",{d:"M5.18718 8.36931L4.48008 9.07641L5.18718 9.78352L11.3744 15.9707L5.18718 22.1579L4.48008 22.865L5.18718 23.5721L8.36916 26.7541L9.07627 27.4612L9.78338 26.7541L15.9706 20.5669L22.1577 26.7541L22.8649 27.4612L23.572 26.7541L26.7539 23.5721L27.461 22.865L26.7539 22.1579L20.5668 15.9707L26.7539 9.78352L27.461 9.07641L26.7539 8.36931L23.572 5.18732L22.8649 4.48022L22.1577 5.18732L15.9706 11.3745L9.78338 5.18732L9.07627 4.48022L8.36916 5.18732L5.18718 8.36931Z",fill:"black",stroke:"white",strokeWidth:"2"})))}function K({systolicReading:t,diastolicReading:n,systolicLowerBound:r,systolicUpperBound:s,diastolicLowerBound:l,diastolicUpperBound:i}){const c=i-l,o=new a((t-r)/(s-r)).times(100),u=new a((n-l)/c).times(100),m=o.round(1),d=u.round(1);return e.createElement("div",{className:"nhsuk-bp-graph-marker",style:{left:`${d}%`,bottom:`${m}%`}},e.createElement(A,null))}function V(e,t,a){return(t[a].value-e)/(t.high.value-e)*100}function W(e){return`nhsuk-bp-classification-${e.toLowerCase()}`}function z({classification:t,bounds:a,renderAsBoundary:n=!1}){const r=V(a.diastolic.lower,a.diastolic.upper,t),s=V(a.systolic.lower,a.systolic.upper,t);return e.createElement("div",{className:n?"nhsuk-bp-region-boundary":W(t),style:{width:`${r}%`,height:`${s}%`}})}function D({bounds:t,renderAsBoundary:a=!1}){return e.createElement(e.Fragment,null,e.createElement(z,{classification:R.Low,bounds:t,renderAsBoundary:a}),e.createElement(z,{classification:R.Healthy,bounds:t,renderAsBoundary:a}),e.createElement(z,{classification:R.SlightlyRaised,bounds:t,renderAsBoundary:a}),!a&&e.createElement(z,{classification:R.High,bounds:t,renderAsBoundary:a}))}function _({firstInRow:t=!1,firstInColumn:a=!1}){let n="nhsuk-bp-graph-cell";return t&&(n+=" nhsuk-bp-first-in-row"),a&&(n+=" nhsuk-bp-first-in-column"),e.createElement("div",{className:n})}function q({bounds:t,graphLayout:a,reading:n}){const{systolic:r,diastolic:s}=n,{systolicLabel:l,diastolicLabel:i}=a;return e.createElement("div",{className:"nhsuk-body-s"},e.createElement("div",{className:"nhsuk-bp-systolic-legend-wrapper","aria-hidden":"true"},e.createElement("div",{className:"nhsuk-bp-systolic-legend-marker"}),e.createElement("span",null,l)),e.createElement("div",{className:"nhsuk-bp-graph","aria-hidden":"true"},e.createElement(F,{bounds:t}),e.createElement(K,{systolicReading:r,diastolicReading:s,systolicLowerBound:t.systolic.lower,systolicUpperBound:t.systolic.upper.high.value,diastolicLowerBound:t.diastolic.lower,diastolicUpperBound:t.diastolic.upper.high.value}),e.createElement(D,{bounds:t}),a.rows.map((t=>e.createElement("div",{key:t.id,className:"nhsuk-bp-graph-row"},t.cells.map((t=>e.createElement(_,Object.assign({key:t.id},t))))))),e.createElement(D,{bounds:t,renderAsBoundary:!0})),e.createElement("div",{className:"nhsuk-bp-diastolic-legend-wrapper","aria-hidden":"true"},e.createElement("div",{className:"nhsuk-bp-diastolic-legend-marker"}),e.createElement("span",null,i)))}!function(e){e[e.Systolic=0]="Systolic",e[e.Diastolic=1]="Diastolic"}(C||(C={})),a.RM=a.roundHalfEven;const I={[x.Underweight]:null,[x.Healthy]:x.Underweight,[x.Overweight]:x.Healthy};class Z{constructor(e){this.bounds={lowerBound:0,upperBounds:{[w.Underweight]:e.upper[x.Underweight].value,[w.Healthy]:e.upper[x.Healthy].value,[w.Overweight]:e.upper[x.Overweight].value}}}get chartRange(){return this.bounds.upperBounds[x.Overweight]-this.bounds.lowerBound}classificationPercentage(e){return this.offsetPercentage(this.bounds.upperBounds[e])}offsetPercentage(e){const t=this.chartRange;if(e<=2){const a=.08*t;return this.calculateOffset(e,E.Underweight,a)}if(e<=91){const a=.72*t,n=.08*t;return this.calculateOffset(e,E.Healthy,a)+n}const a=.2*t,n=.8*t;return this.calculateOffset(e,E.Overweight,a)+n}calculateOffset(e,t,a){const n=I[t]?this.bounds.upperBounds[I[t]]:0;return(e-n)/(this.bounds.upperBounds[t]-n)*a}clampedOffsetPercentage(e){const t=Math.max(1,Math.min(e,99));return this.offsetPercentage(t)}}function G({markerText:t,offsetPercent:a}){return e.createElement("div",{className:"nhsuk-cbmi-axis-marker",style:{left:`${a}%`}},e.createElement("div",{className:"nhsuk-font-size-16 nhsuk-cbmi-axis-marker-label"},t))}function J({model:t}){return e.createElement(e.Fragment,null,e.createElement(G,{markerText:t.bounds.upperBounds[E.Underweight].toString(),offsetPercent:t.classificationPercentage(E.Underweight)}),e.createElement(G,{markerText:t.bounds.upperBounds[E.Healthy].toString(),offsetPercent:t.classificationPercentage(E.Healthy)}))}const Q=e=>e<=20?"nhsuk-cbmi-chart-label-align-left":e<=80?"nhsuk-cbmi-chart-label-align-center":"nhsuk-cbmi-chart-label-align-right";function X({centile:t,markerText:a}){return e.createElement("div",{className:"nhsuk-cbmi-chart-label-marker"},e.createElement("div",{className:`nhsuk-u-font-size-19 ${Q(t.value)}`},a,e.createElement("span",{className:"nhsuk-cbmi-chart-centile-marker"},t.label)))}function Y({centile:t,model:a,markerText:n}){const r=a.clampedOffsetPercentage(t.value);let s=0;if(r>0){const e=1,t=Math.pow(10,e);s=Math.round(r*t)/t}return e.createElement("div",null,e.createElement("div",{className:"nhsuk-cbmi-chart-arrow-marker",style:{left:`${s}%`}},e.createElement(X,{centile:t,markerText:n}),e.createElement(o,null)),e.createElement("div",{className:"nhsuk-cbmi-chart-axis-marker",style:{left:`${s}%`}}))}function ee({classification:t,model:a}){const n=a.classificationPercentage(t);return e.createElement("div",{className:`nhsuk-cbmi-classification-${t}`,style:{width:`${n}%`}})}function te({model:t}){return e.createElement(e.Fragment,null,e.createElement(ee,{classification:E.Underweight,model:t}),e.createElement(ee,{classification:E.Healthy,model:t}),e.createElement(ee,{classification:E.Overweight,model:t}))}function ae({classificationBounds:t,centile:a,markerText:n}){const r=new Z(t);return e.createElement("div",{className:"nhsuk-cbmi-graph nhsuk-u-margin-bottom-9 ","aria-hidden":"true"},e.createElement(J,{model:r}),e.createElement(Y,{centile:a,markerText:n,model:r}),e.createElement(te,{model:r}))}exports.BarSliderChart=p,exports.BarSliderChartFigure=function({config:t,value:a,ariaLabel:n,markerText:r}){const s=Object.values(t.segments).filter((e=>null!=e.legend)).map((e=>({text:e.legend,className:`${t.name}-legend-key-${e.styleSuffix}`,wrapperClassName:`${t.name}-legend-marker`})));return e.createElement("figure",{className:"nhsuk-u-margin-0"},e.createElement("figcaption",{className:"nhsuk-u-visually-hidden"},n),e.createElement(p,{config:t,value:a,markerText:r}),e.createElement(v,{legendKeys:s,borderWrapper:!1}))},exports.BmiChart=S,exports.BmiChartFigure=function({classificationBounds:t,bmi:a,ariaLabel:n,legendKeys:r,legendMarkerText:s}){const l=((t,a)=>Object.entries(t).map((([e,t])=>({text:t,className:`nhsuk-bmi-legend-key-classification-${e}`}))).concat({text:a,className:"nhsuk-bmi-legend-key-marker",element:e.createElement(N,null)}))(r,s);return e.createElement("figure",{className:"nhsuk-u-margin-0"},e.createElement("figcaption",{className:"nhsuk-u-visually-hidden"},n),e.createElement(S,{classificationBounds:t,bmi:a}),e.createElement(v,{legendKeys:l,borderWrapper:!0}))},exports.BpChart=q,exports.BpChartFigure=function({bounds:t,graphLayout:a,reading:n,ariaLabel:r,legendKeys:s,legendMarkerText:l}){const i=((t,a)=>Object.entries(t).map((([e,t])=>({text:t,className:`nhsuk-bp-legend-key-classification-${e}`}))).concat({text:a,className:"nhsuk-bp-legend-key-marker",element:e.createElement(A,null)}))(s,l);return e.createElement("figure",{className:"nhsuk-u-margin-0"},e.createElement("figcaption",{className:"nhsuk-u-visually-hidden"},r),e.createElement(q,{bounds:t,reading:n,graphLayout:a}),e.createElement(v,{legendKeys:i}))},exports.ChartLegend=v,exports.ChildBmiChart=ae,exports.ChildBmiChartFigure=function({classificationBounds:t,centile:a,centileMarkerText:n,ariaLabel:r,legendKeys:s}){const l=Object.entries(s).map((([e,t])=>({text:t,className:`nhsuk-cbmi-legend-key-classification-${e}`,wrapperClassName:"nhsuk-cbmi-legend-marker"})));return e.createElement("figure",{className:"nhsuk-u-margin-0"},e.createElement("figcaption",{className:"nhsuk-u-visually-hidden"},r),e.createElement(ae,{classificationBounds:t,centile:a,markerText:n}),e.createElement(v,{legendKeys:l,borderWrapper:!1}))};
|
|
1
|
+
"use strict";var e=require("react"),t=require("nhsuk-react-components"),a=require("big.js");function n(e){const t=function(e){if(e.axis.ticks.length<=2)throw Error("invalid number of axis ticks");const t=[...e.axis.ticks].sort((e,t)=>e.value-t.value);return e.segments.map((e,a)=>{var n,r;const s=null!==(n=e.start)&&void 0!==n?n:t[a].value,l=null!==(r=e.end)&&void 0!==r?r:t[a+1].value;return Object.assign(Object.assign({},e),{start:s,end:l})})}(e),a=t.reduce((e,t)=>{var a;return e+(null!==(a=t.weight)&&void 0!==a?a:0)},0),n=t.filter(e=>void 0===e.weight).reduce((e,t)=>e+(t.end-t.start),0),r=100-a;if(r<0)throw new Error("Invalid segment weight.");return t.map(e=>{if(void 0!==e.weight)return e;const t=(e.end-e.start)/n*r;return Object.assign(Object.assign({},e),{weight:t})})}class r{constructor(e,t){this.chartWidth=t,this.chartName=e.name,this.axis=e.axis,this.constraints=e.constraints,this.segments=n(e)}get name(){return this.chartName}getAxisTicks(){return Object.values(this.axis.ticks).map(e=>{var t;const a=null===(t=e.isVisible)||void 0===t||t;return{label:e.value.toString(),value:this.calculateRawPosition(e.value),isVisible:a}})}getChartRegions(){return Object.values(this.axis.ticks).slice(1).map(e=>({value:this.calculateRawPosition(e.value),styleClass:this.segmentstyleSuffix(e.value)}))}segmentstyleSuffix(e){const t=this.getSegmentByTick(e);return(null==t?void 0:t.styleSuffix)?`${this.chartName}-${t.styleSuffix}`:""}getSegmentByTick(e){for(const t of this.segments)if(e>=t.start&&e<=t.end)return t;return null}calculatePosition(e){if(this.constraints){const{value:t,position:a}=this.constraints.max;if(e>=t)return a}return this.calculateRawPosition(e)}calculateRawPosition(e){let t=0;const a=this.clampValue(e),{totalSegmentsWidth:n}=this;for(const e of this.segments){if(a>=e.start&&a<=e.end){return t+(a-e.start)/(e.end-e.start)*(e.weight/n)*this.chartWidth}t+=e.weight/n*this.chartWidth}return 0}clampValue(e){return Math.min(Math.max(e,this.axis.ticks[0].value),this.axis.ticks[this.axis.ticks.length-1].value)}get totalSegmentsWidth(){return this.segments.reduce((e,t)=>e+t.weight,0)}}const s=(e,t)=>t>0?`${e}-axis-marker-label`:`${e}-start-axis-marker-label`,l=(e,t)=>t>0?`${e}-axis-marker`:`${e}-start-axis-marker`;function i({chartName:t,markerText:a,offsetPercent:n}){return e.createElement("div",{className:`${l(t,n)}`,style:{left:`${n}%`}},e.createElement("div",{className:`nhsuk-font-size-16 nhsuk-u-secondary-text-color ${s(t,n)}`},a))}function c({model:t}){return e.createElement(e.Fragment,null,t.getAxisTicks().map(({label:a,value:n,isVisible:r})=>r&&e.createElement(i,{chartName:t.name,markerText:a,offsetPercent:n,key:a})))}function o(){return e.createElement("svg",{viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M6 9L0.803849 -9.78799e-07L11.1962 -7.02746e-08L6 9Z",fill:"black"}))}const u=(e,t)=>t<=20?`${e}-label-align-left`:t<=80?`${e}-label-align-center`:`${e}-label-align-right`;function m({chartName:t,value:a,offset:n,markerText:r}){return e.createElement("div",{className:`${t}-label-marker`},e.createElement("div",{className:`nhsuk-font-size-16 ${u(t,n)}`},r,e.createElement("span",{className:`${t}-value-marker`},a)))}function d({value:t,model:a,markerText:n}){const r=a.calculatePosition(t),s=Math.pow(10,1),l=Math.round(r*s)/s;return e.createElement(e.Fragment,null,e.createElement("div",{className:`${a.name}-arrow-marker`,style:{left:`${l}%`}},e.createElement(m,{chartName:a.name,value:t,markerText:n,offset:l}),e.createElement(o,null)),e.createElement("div",{className:`${a.name}-value-axis-marker`,style:{left:`${l}%`}}))}function h({value:t,styleClass:a}){return e.createElement("div",{className:a,style:{width:`${t}%`}})}function g({model:t}){return e.createElement(e.Fragment,null,t.getChartRegions().map(({value:t,styleClass:a})=>e.createElement(h,{value:t,styleClass:a,key:t})))}function f({config:t,value:a,markerText:n}){const s=new r(t,100);return e.createElement("div",{className:`${t.name}-graph nhsuk-u-margin-bottom-9`,"aria-hidden":"true"},e.createElement(c,{model:s}),e.createElement(d,{value:a,markerText:n,model:s}),e.createElement(g,{model:s}))}function p({element:t,text:a,className:n,wrapperClassName:r}){return e.createElement("div",{className:`nhsuk-chart-legend-key-wrapper ${null!=r?r:""}`},e.createElement("div",{className:`nhsuk-chart-legend-key ${null!=n?n:""}`},t),a)}function b({legendKeys:a,className:n}){return e.createElement(t.Card,{className:`${n} nhsuk-u-padding-3 nhsuk-chart-legend-card`},a.map(t=>e.createElement(p,Object.assign({key:t.text},t))))}function k({legendKeys:t,className:a}){return e.createElement("div",{className:a},t.map(t=>e.createElement(p,Object.assign({key:t.text},t))))}function v({legendKeys:t,borderWrapper:a=!0}){const n="nhsuk-u-margin-top-6 nhsuk-u-margin-bottom-3 nhsuk-u-secondary-text-color nhsuk-body-s";return e.createElement("div",{"aria-hidden":"true"},a?e.createElement(b,{legendKeys:t,className:n}):e.createElement(k,{legendKeys:t,className:n}))}const E={Underweight:"underweight",Healthy:"healthy",Overweight:"overweight"},y=Object.assign(Object.assign({},E),{Obese:"obese"}),w=Object.assign(Object.assign({},E),{Obese1:"obese1",Obese2:"obese2",Obese3:"obese3"});w.Underweight,w.Healthy,w.Underweight,w.Overweight,w.Healthy;class x{constructor(e){this.bounds={lowerBound:17.5,upperBounds:{[y.Underweight]:e.upper[w.Underweight].value,[y.Healthy]:e.upper[w.Healthy].value,[y.Overweight]:e.upper[w.Overweight].value,[y.Obese]:e.upper[w.Obese2].value}}}get chartRange(){return this.bounds.upperBounds[y.Obese]-this.bounds.lowerBound}classificationPercentage(e){return this.offsetPercentage(this.bounds.upperBounds[e])}offsetPercentage(e){return(e-this.bounds.lowerBound)/this.chartRange*100}}function L(){return e.createElement("svg",{viewBox:"1 1 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("g",{clipPath:"url(#clip0_1346_102759)"},e.createElement("path",{xmlns:"http://www.w3.org/2000/svg",d:"M1.93209 4.05025L1.57854 4.40381L1.93209 4.75736L6.17473 9L1.93209 13.2426L1.57854 13.5962L1.93209 13.9497L4.05341 16.0711L4.40697 16.4246L4.76052 16.0711L9.00316 11.8284L13.2458 16.0711L13.5994 16.4246L13.9529 16.0711L16.0742 13.9497L16.4278 13.5962L16.0742 13.2426L11.8316 9L16.0742 4.75736L16.4278 4.40381L16.0742 4.05025L13.9529 1.92893L13.5994 1.57538L13.2458 1.92893L9.00316 6.17157L4.76052 1.92893L4.40697 1.57538L4.05341 1.92893L1.93209 4.05025Z",fill:"black",stroke:"white"})))}function N({bmi:t,model:a}){const n=a.offsetPercentage(t);let r=0;if(n>0){const e=1,t=Math.pow(10,e);r=Math.round(n*t)/t}return e.createElement("div",{className:"nhsuk-bmi-chart-marker",style:{left:`${r}%`}},e.createElement(L,null))}function B({classification:t,model:a}){const n=a.classificationPercentage(t);return e.createElement("div",{className:`nhsuk-bmi-classification-${t}`,style:{width:`${n}%`}})}function $({model:t}){return e.createElement(e.Fragment,null,e.createElement(B,{classification:y.Underweight,model:t}),e.createElement(B,{classification:y.Healthy,model:t}),e.createElement(B,{classification:y.Overweight,model:t}),e.createElement(B,{classification:y.Obese,model:t}))}function T({markerText:t,offsetPercent:a}){return e.createElement("div",{className:"nhsuk-bmi-axis-marker",style:{left:`${a}%`}},e.createElement("div",{className:"nhsuk-bmi-axis-marker-label"},t))}function O({model:t}){return e.createElement(e.Fragment,null,e.createElement(T,{markerText:t.bounds.upperBounds[y.Underweight].toString(),offsetPercent:t.classificationPercentage(y.Underweight)}),e.createElement(T,{markerText:t.bounds.upperBounds[y.Healthy].toString(),offsetPercent:t.classificationPercentage(y.Healthy)}),e.createElement(T,{markerText:t.bounds.upperBounds[y.Overweight].toString(),offsetPercent:t.classificationPercentage(y.Overweight)}))}function P({classificationBounds:t,bmi:a}){const n=new x(t);return e.createElement("div",{className:"nhsuk-bmi-graph","aria-hidden":"true"},e.createElement(O,{model:n}),e.createElement(N,{bmi:a,model:n}),e.createElement($,{model:n}))}const S="low",C="healthy",R="slightlyRaised",U="high";var j;function H({axisType:t,labelText:a,offsetPercent:n,applyLabelSpecificStyles:r=!0}){const s=`${j[t].toLowerCase()}-axis`,l=`nhsuk-bp-${s}-marker`,i=`nhsuk-bp-${s}-marker-${a}`;return e.createElement("div",{className:r?`${l} ${i}`:`${l}`,style:t===j.Systolic?{bottom:`${n}%`}:{left:`${n}%`}},e.createElement("div",{className:`nhsuk-bp-${s}-label`},a))}function M(e,t,a){return(e-a)/(t-a)*100}function F(e,t,a){return M(t[e].value,t[U].value,a)}function A({axisType:t,upperBounds:a,lowerBound:n}){const r={slightlyRaisedValueToCheck:85,slightlyRaisedValueToAdd:90};return e.createElement("div",null,e.createElement(H,{labelText:n.toString(),offsetPercent:0,axisType:t}),e.createElement(H,{labelText:a[S].value.toString(),offsetPercent:F(S,a,n),axisType:t}),e.createElement(H,{labelText:a[C].value.toString(),offsetPercent:F(C,a,n),axisType:t}),e.createElement(H,{labelText:a[R].value.toString(),offsetPercent:F(R,a,n),axisType:t,applyLabelSpecificStyles:a[R].value===r.slightlyRaisedValueToCheck}),t===j.Diastolic&&a[R].value===r.slightlyRaisedValueToCheck&&e.createElement(H,{labelText:r.slightlyRaisedValueToAdd.toString(),offsetPercent:M(r.slightlyRaisedValueToAdd,a[U].value,n),axisType:t}),e.createElement(H,{labelText:a[U].value.toString(),offsetPercent:100,axisType:t}))}function K({bounds:t}){return e.createElement(e.Fragment,null,e.createElement(A,{axisType:j.Systolic,upperBounds:t.systolic.upper,lowerBound:t.systolic.lower}),e.createElement(A,{axisType:j.Diastolic,upperBounds:t.diastolic.upper,lowerBound:t.diastolic.lower}))}function V(){return e.createElement("svg",{viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("g",{clipPath:"url(#clip0_1346_102759)"},e.createElement("path",{d:"M5.18718 8.36931L4.48008 9.07641L5.18718 9.78352L11.3744 15.9707L5.18718 22.1579L4.48008 22.865L5.18718 23.5721L8.36916 26.7541L9.07627 27.4612L9.78338 26.7541L15.9706 20.5669L22.1577 26.7541L22.8649 27.4612L23.572 26.7541L26.7539 23.5721L27.461 22.865L26.7539 22.1579L20.5668 15.9707L26.7539 9.78352L27.461 9.07641L26.7539 8.36931L23.572 5.18732L22.8649 4.48022L22.1577 5.18732L15.9706 11.3745L9.78338 5.18732L9.07627 4.48022L8.36916 5.18732L5.18718 8.36931Z",fill:"black",stroke:"white",strokeWidth:"2"})))}function W({systolicReading:t,diastolicReading:n,systolicLowerBound:r,systolicUpperBound:s,diastolicLowerBound:l,diastolicUpperBound:i}){const c=i-l,o=new a((t-r)/(s-r)).times(100),u=new a((n-l)/c).times(100),m=o.round(1),d=u.round(1);return e.createElement("div",{className:"nhsuk-bp-graph-marker",style:{left:`${d}%`,bottom:`${m}%`}},e.createElement(V,null))}function z(e,t,a){return(t[a].value-e)/(t.high.value-e)*100}function D(e){return`nhsuk-bp-classification-${e.toLowerCase()}`}function _({classification:t,bounds:a,renderAsBoundary:n=!1}){const r=z(a.diastolic.lower,a.diastolic.upper,t),s=z(a.systolic.lower,a.systolic.upper,t);return e.createElement("div",{className:n?"nhsuk-bp-region-boundary":D(t),style:{width:`${r}%`,height:`${s}%`}})}function q({bounds:t,renderAsBoundary:a=!1}){return e.createElement(e.Fragment,null,e.createElement(_,{classification:S,bounds:t,renderAsBoundary:a}),e.createElement(_,{classification:C,bounds:t,renderAsBoundary:a}),e.createElement(_,{classification:R,bounds:t,renderAsBoundary:a}),!a&&e.createElement(_,{classification:U,bounds:t,renderAsBoundary:a}))}function I({firstInRow:t=!1,firstInColumn:a=!1}){let n="nhsuk-bp-graph-cell";return t&&(n+=" nhsuk-bp-first-in-row"),a&&(n+=" nhsuk-bp-first-in-column"),e.createElement("div",{className:n})}function Z({bounds:t,graphLayout:a,reading:n}){const{systolic:r,diastolic:s}=n,{systolicLabel:l,diastolicLabel:i}=a;return e.createElement("div",{className:"nhsuk-body-s"},e.createElement("div",{className:"nhsuk-bp-systolic-legend-wrapper","aria-hidden":"true"},e.createElement("div",{className:"nhsuk-bp-systolic-legend-marker"}),e.createElement("span",null,l)),e.createElement("div",{className:"nhsuk-bp-graph","aria-hidden":"true"},e.createElement(K,{bounds:t}),e.createElement(W,{systolicReading:r,diastolicReading:s,systolicLowerBound:t.systolic.lower,systolicUpperBound:t.systolic.upper.high.value,diastolicLowerBound:t.diastolic.lower,diastolicUpperBound:t.diastolic.upper.high.value}),e.createElement(q,{bounds:t}),a.rows.map(t=>e.createElement("div",{key:t.id,className:"nhsuk-bp-graph-row"},t.cells.map(t=>e.createElement(I,Object.assign({key:t.id},t))))),e.createElement(q,{bounds:t,renderAsBoundary:!0})),e.createElement("div",{className:"nhsuk-bp-diastolic-legend-wrapper","aria-hidden":"true"},e.createElement("div",{className:"nhsuk-bp-diastolic-legend-marker"}),e.createElement("span",null,i)))}!function(e){e[e.Systolic=0]="Systolic",e[e.Diastolic=1]="Diastolic"}(j||(j={})),a.RM=a.roundHalfEven;const G={[w.Underweight]:null,[w.Healthy]:w.Underweight,[w.Overweight]:w.Healthy};class J{constructor(e){this.bounds={lowerBound:0,upperBounds:{[y.Underweight]:e.upper[w.Underweight].value,[y.Healthy]:e.upper[w.Healthy].value,[y.Overweight]:e.upper[w.Overweight].value}}}get chartRange(){return this.bounds.upperBounds[w.Overweight]-this.bounds.lowerBound}classificationPercentage(e){return this.offsetPercentage(this.bounds.upperBounds[e])}offsetPercentage(e){const t=this.chartRange;if(e<=2){const a=.08*t;return this.calculateOffset(e,E.Underweight,a)}if(e<=91){const a=.72*t,n=.08*t;return this.calculateOffset(e,E.Healthy,a)+n}const a=.2*t,n=.8*t;return this.calculateOffset(e,E.Overweight,a)+n}calculateOffset(e,t,a){const n=G[t]?this.bounds.upperBounds[G[t]]:0;return(e-n)/(this.bounds.upperBounds[t]-n)*a}clampedOffsetPercentage(e){const t=Math.max(1,Math.min(e,99));return this.offsetPercentage(t)}}function Q({markerText:t,offsetPercent:a}){return e.createElement("div",{className:"nhsuk-cbmi-axis-marker",style:{left:`${a}%`}},e.createElement("div",{className:"nhsuk-font-size-16 nhsuk-cbmi-axis-marker-label"},t))}function X({model:t}){return e.createElement(e.Fragment,null,e.createElement(Q,{markerText:t.bounds.upperBounds[E.Underweight].toString(),offsetPercent:t.classificationPercentage(E.Underweight)}),e.createElement(Q,{markerText:t.bounds.upperBounds[E.Healthy].toString(),offsetPercent:t.classificationPercentage(E.Healthy)}))}function Y({centile:t,markerText:a}){return e.createElement("div",{className:"nhsuk-cbmi-chart-label-marker"},e.createElement("div",{className:"nhsuk-u-font-size-19 "+(n=t.value,n<=20?"nhsuk-cbmi-chart-label-align-left":n<=80?"nhsuk-cbmi-chart-label-align-center":"nhsuk-cbmi-chart-label-align-right")},a,e.createElement("span",{className:"nhsuk-cbmi-chart-centile-marker"},t.label)));var n}function ee({centile:t,model:a,markerText:n}){const r=a.clampedOffsetPercentage(t.value);let s=0;if(r>0){const e=1,t=Math.pow(10,e);s=Math.round(r*t)/t}return e.createElement("div",null,e.createElement("div",{className:"nhsuk-cbmi-chart-arrow-marker",style:{left:`${s}%`}},e.createElement(Y,{centile:t,markerText:n}),e.createElement(o,null)),e.createElement("div",{className:"nhsuk-cbmi-chart-axis-marker",style:{left:`${s}%`}}))}function te({classification:t,model:a}){const n=a.classificationPercentage(t);return e.createElement("div",{className:`nhsuk-cbmi-classification-${t}`,style:{width:`${n}%`}})}function ae({model:t}){return e.createElement(e.Fragment,null,e.createElement(te,{classification:E.Underweight,model:t}),e.createElement(te,{classification:E.Healthy,model:t}),e.createElement(te,{classification:E.Overweight,model:t}))}function ne({classificationBounds:t,centile:a,markerText:n}){const r=new J(t);return e.createElement("div",{className:"nhsuk-cbmi-graph nhsuk-u-margin-bottom-9 ","aria-hidden":"true"},e.createElement(X,{model:r}),e.createElement(ee,{centile:a,markerText:n,model:r}),e.createElement(ae,{model:r}))}exports.BarSliderChart=f,exports.BarSliderChartFigure=function({config:t,value:a,ariaLabel:n,markerText:r}){const s=Object.values(t.segments).filter(e=>null!=e.legend).map(e=>({text:e.legend,className:`${t.name}-legend-key-${e.styleSuffix}`,wrapperClassName:`${t.name}-legend-marker`}));return e.createElement("figure",{className:"nhsuk-u-margin-0"},e.createElement("figcaption",{className:"nhsuk-u-visually-hidden"},n),e.createElement(f,{config:t,value:a,markerText:r}),e.createElement(v,{legendKeys:s,borderWrapper:!1}))},exports.BmiChart=P,exports.BmiChartFigure=function({classificationBounds:t,bmi:a,ariaLabel:n,legendKeys:r,legendMarkerText:s}){const l=((t,a)=>Object.entries(t).map(([e,t])=>({text:t,className:`nhsuk-bmi-legend-key-classification-${e}`})).concat({text:a,className:"nhsuk-bmi-legend-key-marker",element:e.createElement(L,null)}))(r,s);return e.createElement("figure",{className:"nhsuk-u-margin-0"},e.createElement("figcaption",{className:"nhsuk-u-visually-hidden"},n),e.createElement(P,{classificationBounds:t,bmi:a}),e.createElement(v,{legendKeys:l,borderWrapper:!0}))},exports.BpChart=Z,exports.BpChartFigure=function({bounds:t,graphLayout:a,reading:n,ariaLabel:r,legendKeys:s,legendMarkerText:l}){const i=((t,a)=>Object.entries(t).map(([e,t])=>({text:t,className:`nhsuk-bp-legend-key-classification-${e}`})).concat({text:a,className:"nhsuk-bp-legend-key-marker",element:e.createElement(V,null)}))(s,l);return e.createElement("figure",{className:"nhsuk-u-margin-0"},e.createElement("figcaption",{className:"nhsuk-u-visually-hidden"},r),e.createElement(Z,{bounds:t,reading:n,graphLayout:a}),e.createElement(v,{legendKeys:i}))},exports.ChartLegend=v,exports.ChildBmiChart=ne,exports.ChildBmiChartFigure=function({classificationBounds:t,centile:a,centileMarkerText:n,ariaLabel:r,legendKeys:s}){const l=Object.entries(s).map(([e,t])=>({text:t,className:`nhsuk-cbmi-legend-key-classification-${e}`,wrapperClassName:"nhsuk-cbmi-legend-marker"}));return e.createElement("figure",{className:"nhsuk-u-margin-0"},e.createElement("figcaption",{className:"nhsuk-u-visually-hidden"},r),e.createElement(ne,{classificationBounds:t,centile:a,markerText:n}),e.createElement(v,{legendKeys:l,borderWrapper:!1}))};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|