nhsuk-tools-chart-components-react 1.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/LICENSE +21 -0
- package/README.md +23 -0
- package/dist/cjs/bundle.css +598 -0
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/esm/bundle.css +598 -0
- package/dist/esm/components/blood-pressure/bp-chart-axes.js +2 -0
- package/dist/esm/components/blood-pressure/bp-chart-axes.js.map +1 -0
- package/dist/esm/components/blood-pressure/bp-chart-cell.js +2 -0
- package/dist/esm/components/blood-pressure/bp-chart-cell.js.map +1 -0
- package/dist/esm/components/blood-pressure/bp-chart-marker-icon.js +2 -0
- package/dist/esm/components/blood-pressure/bp-chart-marker-icon.js.map +1 -0
- package/dist/esm/components/blood-pressure/bp-chart-marker.js +2 -0
- package/dist/esm/components/blood-pressure/bp-chart-marker.js.map +1 -0
- package/dist/esm/components/blood-pressure/bp-chart-regions.js +2 -0
- package/dist/esm/components/blood-pressure/bp-chart-regions.js.map +1 -0
- package/dist/esm/components/blood-pressure/bp-chart.js +2 -0
- package/dist/esm/components/blood-pressure/bp-chart.js.map +1 -0
- package/dist/esm/components/blood-pressure/bp-figure-chart.js +2 -0
- package/dist/esm/components/blood-pressure/bp-figure-chart.js.map +1 -0
- package/dist/esm/components/bmi/bmi-chart-axes.js +2 -0
- package/dist/esm/components/bmi/bmi-chart-axes.js.map +1 -0
- package/dist/esm/components/bmi/bmi-chart-marker-icon.js +2 -0
- package/dist/esm/components/bmi/bmi-chart-marker-icon.js.map +1 -0
- package/dist/esm/components/bmi/bmi-chart-marker.js +2 -0
- package/dist/esm/components/bmi/bmi-chart-marker.js.map +1 -0
- package/dist/esm/components/bmi/bmi-chart-regions.js +2 -0
- package/dist/esm/components/bmi/bmi-chart-regions.js.map +1 -0
- package/dist/esm/components/bmi/bmi-chart.js +2 -0
- package/dist/esm/components/bmi/bmi-chart.js.map +1 -0
- package/dist/esm/components/bmi/bmi-figure-chart.js +2 -0
- package/dist/esm/components/bmi/bmi-figure-chart.js.map +1 -0
- package/dist/esm/components/chart-legend.js +2 -0
- package/dist/esm/components/chart-legend.js.map +1 -0
- package/dist/esm/components/child-bmi/cbmi-chart-axes.js +2 -0
- package/dist/esm/components/child-bmi/cbmi-chart-axes.js.map +1 -0
- package/dist/esm/components/child-bmi/cbmi-chart-marker-icon.js +2 -0
- package/dist/esm/components/child-bmi/cbmi-chart-marker-icon.js.map +1 -0
- package/dist/esm/components/child-bmi/cbmi-chart-marker.js +2 -0
- package/dist/esm/components/child-bmi/cbmi-chart-marker.js.map +1 -0
- package/dist/esm/components/child-bmi/cbmi-chart-regions.js +2 -0
- package/dist/esm/components/child-bmi/cbmi-chart-regions.js.map +1 -0
- package/dist/esm/components/child-bmi/cbmi-chart.js +2 -0
- package/dist/esm/components/child-bmi/cbmi-chart.js.map +1 -0
- package/dist/esm/components/child-bmi/cbmi-figure-chart.js +2 -0
- package/dist/esm/components/child-bmi/cbmi-figure-chart.js.map +1 -0
- package/dist/esm/custom-types/blood-pressure.types.js +2 -0
- package/dist/esm/custom-types/blood-pressure.types.js.map +1 -0
- package/dist/esm/custom-types/bmi.types.js +2 -0
- package/dist/esm/custom-types/bmi.types.js.map +1 -0
- package/dist/esm/custom-types/classifications.types.js +2 -0
- package/dist/esm/custom-types/classifications.types.js.map +1 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/models/bmi-chart.model.js +2 -0
- package/dist/esm/models/bmi-chart.model.js.map +1 -0
- package/dist/esm/models/cbmi-chart.model.js +2 -0
- package/dist/esm/models/cbmi-chart.model.js.map +1 -0
- package/dist/esm/src/__tests__/__helpers__/mocks/bmi-results.d.ts +29 -0
- package/dist/esm/src/__tests__/__helpers__/mocks/bp-results.d.ts +5 -0
- package/dist/esm/src/__tests__/__helpers__/mocks/cbmi-results.d.ts +21 -0
- package/dist/esm/src/__tests__/components/blood-pressure/bp-chart-figure.test.d.ts +1 -0
- package/dist/esm/src/__tests__/components/blood-pressure/bp-chart.test.d.ts +1 -0
- package/dist/esm/src/__tests__/components/bmi/bmi-chart-figure.test.d.ts +1 -0
- package/dist/esm/src/__tests__/components/bmi/bmi-chart.test.d.ts +1 -0
- package/dist/esm/src/__tests__/components/chart-legend.test.d.ts +1 -0
- package/dist/esm/src/__tests__/components/child-bmi/cbmi-chart-figure.test.d.ts +1 -0
- package/dist/esm/src/__tests__/components/child-bmi/cbmi-chart.test.d.ts +1 -0
- package/dist/esm/src/components/blood-pressure/bp-chart-axes.d.ts +18 -0
- package/dist/esm/src/components/blood-pressure/bp-chart-cell.d.ts +3 -0
- package/dist/esm/src/components/blood-pressure/bp-chart-marker-icon.d.ts +2 -0
- package/dist/esm/src/components/blood-pressure/bp-chart-marker.d.ts +12 -0
- package/dist/esm/src/components/blood-pressure/bp-chart-regions.d.ts +11 -0
- package/dist/esm/src/components/blood-pressure/bp-chart.d.ts +27 -0
- package/dist/esm/src/components/blood-pressure/bp-figure-chart.d.ts +37 -0
- package/dist/esm/src/components/bmi/bmi-chart-axes.d.ts +8 -0
- package/dist/esm/src/components/bmi/bmi-chart-marker-icon.d.ts +2 -0
- package/dist/esm/src/components/bmi/bmi-chart-marker.d.ts +7 -0
- package/dist/esm/src/components/bmi/bmi-chart-regions.d.ts +6 -0
- package/dist/esm/src/components/bmi/bmi-chart.d.ts +24 -0
- package/dist/esm/src/components/bmi/bmi-figure-chart.d.ts +33 -0
- package/dist/esm/src/components/chart-legend.d.ts +37 -0
- package/dist/esm/src/components/child-bmi/cbmi-chart-axes.d.ts +8 -0
- package/dist/esm/src/components/child-bmi/cbmi-chart-marker-icon.d.ts +1 -0
- package/dist/esm/src/components/child-bmi/cbmi-chart-marker.d.ts +9 -0
- package/dist/esm/src/components/child-bmi/cbmi-chart-regions.d.ts +6 -0
- package/dist/esm/src/components/child-bmi/cbmi-chart.d.ts +27 -0
- package/dist/esm/src/components/child-bmi/cbmi-figure-chart.d.ts +33 -0
- package/dist/esm/src/custom-types/blood-pressure.types.d.ts +29 -0
- package/dist/esm/src/custom-types/bmi.types.d.ts +41 -0
- package/dist/esm/src/custom-types/chart.types.d.ts +8 -0
- package/dist/esm/src/custom-types/classifications.types.d.ts +19 -0
- package/dist/esm/src/custom-types/threshold.types.d.ts +13 -0
- package/dist/esm/src/index.d.ts +14 -0
- package/dist/esm/src/models/bmi-chart.model.d.ts +16 -0
- package/dist/esm/src/models/cbmi-chart.model.d.ts +26 -0
- package/dist/esm/stories/Charts/Adult Bmi/Chart.stories.d.ts +56 -0
- package/dist/esm/stories/Charts/Adult Bmi/Figure.stories.d.ts +79 -0
- package/dist/esm/stories/Charts/Blood Pressure/Chart.stories.d.ts +122 -0
- package/dist/esm/stories/Charts/Blood Pressure/Figure.stories.d.ts +143 -0
- package/dist/esm/stories/Charts/Child Bmi/Chart.stories.d.ts +53 -0
- package/dist/esm/stories/Charts/Child Bmi/Figure.stories.d.ts +71 -0
- package/dist/esm/stories/Legend/ChartLegend.stories.d.ts +51 -0
- package/dist/index.d.ts +290 -0
- package/package.json +96 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 NHS England
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# NHS.UK Tools Chart components
|
|
2
|
+
|
|
3
|
+
This repository contains the code for NHS.UK Chart components
|
|
4
|
+
|
|
5
|
+
These chart components are designed for visualizing Body Mass Index (BMI), Child Body Mass Index (CBMI), and Blood Pressure (BP) data.
|
|
6
|
+
|
|
7
|
+
Initially, these charts were integrated into separate codebases for each of the individual tools. To support consistency and reusability across NHS projects, we have migrated these chart components into a dedicated library.
|
|
8
|
+
|
|
9
|
+
A storybook instance for the components can be found in `https://tools-graph-components.nhswebsite-dev.nhs.uk/?path=/docs/welcome--docs`
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
Ensure you have Node.js 20.x.x. installed. Usage of NVM is recommended, to allow for easily switching between versions on different projects.
|
|
14
|
+
|
|
15
|
+
`npm install` will install dependencies.
|
|
16
|
+
|
|
17
|
+
## Build
|
|
18
|
+
|
|
19
|
+
`npm run build` will build the project.
|
|
20
|
+
|
|
21
|
+
## Build storybook
|
|
22
|
+
|
|
23
|
+
`npm run storybook` will build and deploy the storybook locally in `http://localhost:6006/`
|
|
@@ -0,0 +1,598 @@
|
|
|
1
|
+
.nhsuk-chart-legend-card {
|
|
2
|
+
max-width: 250px;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.nhsuk-chart-legend-key-wrapper {
|
|
6
|
+
display: flex;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.nhsuk-chart-legend-key {
|
|
10
|
+
width: 25px;
|
|
11
|
+
height: 25px;
|
|
12
|
+
margin-right: 10px;
|
|
13
|
+
border-bottom: 1px solid white;
|
|
14
|
+
box-shadow: 0px 2px 0px 0px black;
|
|
15
|
+
margin-bottom: 3px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.nhsuk-cbmi-classification-healthy, .nhsuk-cbmi-legend-key-classification-healthy {
|
|
19
|
+
background: repeating-linear-gradient(-45deg, #30b4ab, #30b4ab 4.5px, #00a499 4.5px, #00a499 9px);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.nhsuk-cbmi-classification-overweight, .nhsuk-cbmi-legend-key-classification-overweight {
|
|
23
|
+
background: #ffb81c;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.nhsuk-cbmi-classification-underweight, .nhsuk-cbmi-legend-key-classification-underweight {
|
|
27
|
+
background: #330072;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.nhsuk-cbmi-graph {
|
|
31
|
+
position: relative;
|
|
32
|
+
outline: 1px solid black;
|
|
33
|
+
margin-top: 20px;
|
|
34
|
+
display: flex;
|
|
35
|
+
height: 28px;
|
|
36
|
+
}
|
|
37
|
+
@media (min-width: 320px) and (max-width: 641px) {
|
|
38
|
+
.nhsuk-cbmi-graph {
|
|
39
|
+
height: 24px;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.nhsuk-cbmi-classification-healthy, .nhsuk-cbmi-legend-key-classification-healthy {
|
|
44
|
+
background: repeating-linear-gradient(-45deg, #30b4ab, #30b4ab 4.5px, #00a499 4.5px, #00a499 9px);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.nhsuk-cbmi-classification-overweight, .nhsuk-cbmi-legend-key-classification-overweight {
|
|
48
|
+
background: #ffb81c;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.nhsuk-cbmi-classification-underweight, .nhsuk-cbmi-legend-key-classification-underweight {
|
|
52
|
+
background: #330072;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.nhsuk-cbmi-legend-key-classification-overweight {
|
|
56
|
+
border-bottom: none;
|
|
57
|
+
box-shadow: none;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.nhsuk-cbmi-legend-key, .nhsuk-cbmi-legend-key-classification-underweight, .nhsuk-cbmi-legend-key-classification-healthy, .nhsuk-cbmi-legend-key-classification-overweight {
|
|
61
|
+
border-bottom: 2px solid white;
|
|
62
|
+
margin-bottom: 2px;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.nhsuk-cbmi-legend-marker {
|
|
66
|
+
margin-bottom: 2px;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.nhsuk-cbmi-classification-underweight-heading {
|
|
70
|
+
border-left: 8px solid #330072;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.nhsuk-cbmi-classification-healthy-heading {
|
|
74
|
+
border-left: 8px solid #30b4ab;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.nhsuk-cbmi-classification-overweight-heading {
|
|
78
|
+
border-left: 8px solid #ffb81c;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.nhsuk-cbmi-classification-healthy, .nhsuk-cbmi-legend-key-classification-healthy {
|
|
82
|
+
background: repeating-linear-gradient(-45deg, #30b4ab, #30b4ab 4.5px, #00a499 4.5px, #00a499 9px);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.nhsuk-cbmi-classification-overweight, .nhsuk-cbmi-legend-key-classification-overweight {
|
|
86
|
+
background: #ffb81c;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.nhsuk-cbmi-classification-underweight, .nhsuk-cbmi-legend-key-classification-underweight {
|
|
90
|
+
background: #330072;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.nhsuk-cbmi-axis-marker {
|
|
94
|
+
position: absolute;
|
|
95
|
+
bottom: -5px;
|
|
96
|
+
margin-left: -0.5px;
|
|
97
|
+
border: 1px solid black;
|
|
98
|
+
box-shadow: 0px 0px white inset, 1px 0px white, -1px 0px white;
|
|
99
|
+
z-index: 4;
|
|
100
|
+
height: 33px;
|
|
101
|
+
}
|
|
102
|
+
@media (min-width: 320px) and (max-width: 641px) {
|
|
103
|
+
.nhsuk-cbmi-axis-marker {
|
|
104
|
+
height: 29px;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.nhsuk-cbmi-axis-marker-label {
|
|
109
|
+
position: absolute;
|
|
110
|
+
bottom: -25px;
|
|
111
|
+
left: -10px;
|
|
112
|
+
width: 20px;
|
|
113
|
+
text-align: center;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.nhsuk-cbmi-classification-healthy, .nhsuk-cbmi-legend-key-classification-healthy {
|
|
117
|
+
background: repeating-linear-gradient(-45deg, #30b4ab, #30b4ab 4.5px, #00a499 4.5px, #00a499 9px);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.nhsuk-cbmi-classification-overweight, .nhsuk-cbmi-legend-key-classification-overweight {
|
|
121
|
+
background: #ffb81c;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.nhsuk-cbmi-classification-underweight, .nhsuk-cbmi-legend-key-classification-underweight {
|
|
125
|
+
background: #330072;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.nhsuk-cbmi-chart-arrow-marker {
|
|
129
|
+
position: absolute;
|
|
130
|
+
z-index: 4;
|
|
131
|
+
height: 16px;
|
|
132
|
+
width: 16px;
|
|
133
|
+
margin: -8px 0 -8px -8px;
|
|
134
|
+
}
|
|
135
|
+
@media (min-width: 320px) and (max-width: 641px) {
|
|
136
|
+
.nhsuk-cbmi-chart-arrow-marker {
|
|
137
|
+
height: 12px;
|
|
138
|
+
width: 12px;
|
|
139
|
+
margin: -8px 0 -6px -6px;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.nhsuk-cbmi-chart-label-align-left {
|
|
144
|
+
display: flex;
|
|
145
|
+
justify-content: left;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.nhsuk-cbmi-chart-label-align-center {
|
|
149
|
+
display: flex;
|
|
150
|
+
justify-content: center;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.nhsuk-cbmi-chart-label-align-right {
|
|
154
|
+
display: flex;
|
|
155
|
+
justify-content: right;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.nhsuk-cbmi-chart-label-marker {
|
|
159
|
+
position: relative;
|
|
160
|
+
height: 25;
|
|
161
|
+
width: auto;
|
|
162
|
+
white-space: nowrap;
|
|
163
|
+
margin-top: -30px;
|
|
164
|
+
z-index: 4;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.nhsuk-cbmi-chart-centile-marker {
|
|
168
|
+
position: relative;
|
|
169
|
+
font-weight: bold;
|
|
170
|
+
margin-left: 5px;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.nhsuk-cbmi-chart-axis-marker {
|
|
174
|
+
position: absolute;
|
|
175
|
+
margin-left: -1px;
|
|
176
|
+
border: 1.5px solid black;
|
|
177
|
+
box-shadow: 0px 0px white inset, 2px 0px white, -2px 0px white;
|
|
178
|
+
z-index: 4;
|
|
179
|
+
height: 28px;
|
|
180
|
+
}
|
|
181
|
+
@media (min-width: 320px) and (max-width: 641px) {
|
|
182
|
+
.nhsuk-cbmi-chart-axis-marker {
|
|
183
|
+
height: 24px;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.nhsuk-cbmi-classification-healthy, .nhsuk-cbmi-legend-key-classification-healthy {
|
|
188
|
+
background: repeating-linear-gradient(-45deg, #30b4ab, #30b4ab 4.5px, #00a499 4.5px, #00a499 9px);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.nhsuk-cbmi-classification-overweight, .nhsuk-cbmi-legend-key-classification-overweight {
|
|
192
|
+
background: #ffb81c;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.nhsuk-cbmi-classification-underweight, .nhsuk-cbmi-legend-key-classification-underweight {
|
|
196
|
+
background: #330072;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.nhsuk-cbmi-classification-overweight, .nhsuk-cbmi-classification-healthy, .nhsuk-cbmi-classification-underweight {
|
|
200
|
+
position: absolute;
|
|
201
|
+
bottom: 0%;
|
|
202
|
+
outline: 1px solid black;
|
|
203
|
+
height: 28px;
|
|
204
|
+
}
|
|
205
|
+
@media (min-width: 320px) and (max-width: 641px) {
|
|
206
|
+
.nhsuk-cbmi-classification-overweight, .nhsuk-cbmi-classification-healthy, .nhsuk-cbmi-classification-underweight {
|
|
207
|
+
height: 24px;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.nhsuk-cbmi-classification-underweight {
|
|
212
|
+
z-index: 3;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.nhsuk-cbmi-classification-healthy {
|
|
216
|
+
z-index: 2;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.nhsuk-cbmi-classification-overweight {
|
|
220
|
+
z-index: 1;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.nhsuk-bmi-classification-underweight, .nhsuk-bmi-legend-key-classification-underweight {
|
|
224
|
+
background: #330072;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.nhsuk-bmi-classification-healthy, .nhsuk-bmi-legend-key-classification-healthy {
|
|
228
|
+
background: repeating-linear-gradient(-45deg, #30b4ab, #30b4ab 4.5px, #00a499 4.5px, #00a499 9px);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.nhsuk-bmi-classification-overweight, .nhsuk-bmi-legend-key-classification-overweight {
|
|
232
|
+
background: #ffb81c;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.nhsuk-bmi-classification-obese, .nhsuk-bmi-legend-key-classification-obese {
|
|
236
|
+
background: repeating-linear-gradient(45deg, #da5147, #da5147 4.5px, #d5281b 4.5px, #d5281b 9px);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.nhsuk-bmi-graph {
|
|
240
|
+
position: relative;
|
|
241
|
+
outline: 1px solid black;
|
|
242
|
+
display: flex;
|
|
243
|
+
height: 28px;
|
|
244
|
+
margin-bottom: nhsuk-spacing(4);
|
|
245
|
+
}
|
|
246
|
+
@media (min-width: 320px) and (max-width: 641px) {
|
|
247
|
+
.nhsuk-bmi-graph {
|
|
248
|
+
height: 24px;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.nhsuk-bmi-classification-underweight, .nhsuk-bmi-legend-key-classification-underweight {
|
|
253
|
+
background: #330072;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.nhsuk-bmi-classification-healthy, .nhsuk-bmi-legend-key-classification-healthy {
|
|
257
|
+
background: repeating-linear-gradient(-45deg, #30b4ab, #30b4ab 4.5px, #00a499 4.5px, #00a499 9px);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.nhsuk-bmi-classification-overweight, .nhsuk-bmi-legend-key-classification-overweight {
|
|
261
|
+
background: #ffb81c;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
.nhsuk-bmi-classification-obese, .nhsuk-bmi-legend-key-classification-obese {
|
|
265
|
+
background: repeating-linear-gradient(45deg, #da5147, #da5147 4.5px, #d5281b 4.5px, #d5281b 9px);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
.nhsuk-bmi-legend-key-classification-obese {
|
|
269
|
+
border-bottom: none;
|
|
270
|
+
box-shadow: none;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.nhsuk-bmi-legend-key-marker {
|
|
274
|
+
border-bottom: none;
|
|
275
|
+
box-shadow: none;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.nhsuk-bmi-chart-marker {
|
|
279
|
+
position: absolute;
|
|
280
|
+
z-index: 4;
|
|
281
|
+
height: 24px;
|
|
282
|
+
width: 24px;
|
|
283
|
+
margin: 2px 0 -12px -12px;
|
|
284
|
+
}
|
|
285
|
+
@media (min-width: 320px) and (max-width: 641px) {
|
|
286
|
+
.nhsuk-bmi-chart-marker {
|
|
287
|
+
height: 20px;
|
|
288
|
+
width: 20px;
|
|
289
|
+
margin: 2px 0 -10px -10px;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
.nhsuk-bmi-classification-underweight, .nhsuk-bmi-legend-key-classification-underweight {
|
|
294
|
+
background: #330072;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
.nhsuk-bmi-classification-healthy, .nhsuk-bmi-legend-key-classification-healthy {
|
|
298
|
+
background: repeating-linear-gradient(-45deg, #30b4ab, #30b4ab 4.5px, #00a499 4.5px, #00a499 9px);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.nhsuk-bmi-classification-overweight, .nhsuk-bmi-legend-key-classification-overweight {
|
|
302
|
+
background: #ffb81c;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
.nhsuk-bmi-classification-obese, .nhsuk-bmi-legend-key-classification-obese {
|
|
306
|
+
background: repeating-linear-gradient(45deg, #da5147, #da5147 4.5px, #d5281b 4.5px, #d5281b 9px);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
.nhsuk-bmi-classification-obese, .nhsuk-bmi-classification-overweight, .nhsuk-bmi-classification-healthy, .nhsuk-bmi-classification-underweight {
|
|
310
|
+
position: absolute;
|
|
311
|
+
bottom: 0%;
|
|
312
|
+
outline: 1px solid black;
|
|
313
|
+
border-right: 1px solid black;
|
|
314
|
+
box-shadow: -1px 0px white inset, 2px 0px white, 0px -2px white;
|
|
315
|
+
height: 28px;
|
|
316
|
+
}
|
|
317
|
+
@media (min-width: 320px) and (max-width: 641px) {
|
|
318
|
+
.nhsuk-bmi-classification-obese, .nhsuk-bmi-classification-overweight, .nhsuk-bmi-classification-healthy, .nhsuk-bmi-classification-underweight {
|
|
319
|
+
height: 24px;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.nhsuk-bmi-classification-underweight {
|
|
324
|
+
z-index: 3;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.nhsuk-bmi-classification-healthy {
|
|
328
|
+
z-index: 2;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
.nhsuk-bmi-classification-overweight {
|
|
332
|
+
z-index: 1;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
.nhsuk-bmi-classification-obese {
|
|
336
|
+
border-right: none;
|
|
337
|
+
box-shadow: none;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.nhsuk-bmi-axis-marker {
|
|
341
|
+
position: absolute;
|
|
342
|
+
outline: 0.5px solid black;
|
|
343
|
+
height: 5px;
|
|
344
|
+
bottom: -5px;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
.nhsuk-bmi-axis-marker-label {
|
|
348
|
+
position: absolute;
|
|
349
|
+
bottom: -25px;
|
|
350
|
+
left: -10px;
|
|
351
|
+
width: 20px;
|
|
352
|
+
text-align: center;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
.nhsuk-bp-graph {
|
|
356
|
+
position: relative;
|
|
357
|
+
margin-left: 20px;
|
|
358
|
+
margin-right: 20px;
|
|
359
|
+
outline: 2px solid black;
|
|
360
|
+
display: flex;
|
|
361
|
+
flex-direction: column;
|
|
362
|
+
height: 350px;
|
|
363
|
+
}
|
|
364
|
+
@media (max-width: 320px) {
|
|
365
|
+
.nhsuk-bp-graph {
|
|
366
|
+
height: 225px;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
@media (min-width: 320px) and (max-width: 641px) {
|
|
370
|
+
.nhsuk-bp-graph {
|
|
371
|
+
height: 275px;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
.nhsuk-bp-graph-row {
|
|
376
|
+
flex-grow: 1;
|
|
377
|
+
display: flex;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
.nhsuk-bp-systolic-legend-wrapper {
|
|
381
|
+
display: flex;
|
|
382
|
+
align-items: flex-end;
|
|
383
|
+
margin-bottom: 10px;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
.nhsuk-bp-diastolic-legend-wrapper {
|
|
387
|
+
display: flex;
|
|
388
|
+
align-items: flex-start;
|
|
389
|
+
margin-top: 30px;
|
|
390
|
+
padding-left: 18px;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
.nhsuk-bp-diastolic-legend-marker, .nhsuk-bp-systolic-legend-marker {
|
|
394
|
+
height: 16px;
|
|
395
|
+
margin-right: 5px;
|
|
396
|
+
border-left: 2px solid black;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
.nhsuk-bp-systolic-legend-marker {
|
|
400
|
+
width: 40px;
|
|
401
|
+
border-top: 2px solid black;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
.nhsuk-bp-diastolic-legend-marker {
|
|
405
|
+
width: 20px;
|
|
406
|
+
border-bottom: 2px solid black;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
.nhsuk-bp-classification-0, .nhsuk-bp-legend-key-classification-low {
|
|
410
|
+
background: #330072;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
.nhsuk-bp-classification-1, .nhsuk-bp-legend-key-classification-healthy {
|
|
414
|
+
background: repeating-linear-gradient(-45deg, #59c3bc, #59c3bc 4.5px, #33b6ad 4.5px, #33b6ad 9px);
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
.nhsuk-bp-classification-2, .nhsuk-bp-legend-key-classification-slightlyraised {
|
|
418
|
+
background: #ffb81c;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
.nhsuk-bp-classification-3, .nhsuk-bp-legend-key-classification-high {
|
|
422
|
+
background: repeating-linear-gradient(45deg, #e1746b, #e1746b 4.5px, #dd5349 4.5px, #dd5349 9px);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
#nhsuk-bp-chart > figure {
|
|
426
|
+
margin: 0;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
.nhsuk-bp-legend-key-wrapper {
|
|
430
|
+
display: flex;
|
|
431
|
+
}
|
|
432
|
+
.nhsuk-bp-legend-key-wrapper:last-child {
|
|
433
|
+
margin-top: 5px;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
.nhsuk-bp-legend-display-card {
|
|
437
|
+
margin-top: 50px;
|
|
438
|
+
max-width: 300px;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
.nhsuk-bp-legend-key-classification-low {
|
|
442
|
+
border-bottom: none;
|
|
443
|
+
box-shadow: none;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
.nhsuk-bp-legend-key-marker {
|
|
447
|
+
border-bottom: none;
|
|
448
|
+
box-shadow: none;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
.nhsuk-bp-diastolic-axis-marker, .nhsuk-bp-systolic-axis-marker {
|
|
452
|
+
position: absolute;
|
|
453
|
+
outline: 0.5px solid black;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
.nhsuk-bp-diastolic-axis-label, .nhsuk-bp-systolic-axis-label {
|
|
457
|
+
position: absolute;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
.nhsuk-bp-systolic-axis-marker {
|
|
461
|
+
width: 5px;
|
|
462
|
+
left: -5px;
|
|
463
|
+
}
|
|
464
|
+
.nhsuk-bp-systolic-axis-marker:first-child {
|
|
465
|
+
bottom: -1px !important;
|
|
466
|
+
}
|
|
467
|
+
.nhsuk-bp-systolic-axis-marker:last-child {
|
|
468
|
+
bottom: calc(100% + 1px) !important;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
.nhsuk-bp-diastolic-axis-marker {
|
|
472
|
+
height: 5px;
|
|
473
|
+
bottom: -5px;
|
|
474
|
+
}
|
|
475
|
+
.nhsuk-bp-diastolic-axis-marker:first-child {
|
|
476
|
+
left: -1px !important;
|
|
477
|
+
}
|
|
478
|
+
.nhsuk-bp-diastolic-axis-marker:last-child {
|
|
479
|
+
left: calc(100% + 1px) !important;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
@media (max-width: 450px) {
|
|
483
|
+
.nhsuk-bp-diastolic-axis-marker-85 {
|
|
484
|
+
display: none;
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
.nhsuk-bp-diastolic-axis-marker-90 {
|
|
489
|
+
display: none;
|
|
490
|
+
}
|
|
491
|
+
@media (max-width: 450px) {
|
|
492
|
+
.nhsuk-bp-diastolic-axis-marker-90 {
|
|
493
|
+
display: block;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
.nhsuk-bp-systolic-axis-label {
|
|
498
|
+
left: -30px;
|
|
499
|
+
top: -10px;
|
|
500
|
+
width: 26px;
|
|
501
|
+
text-align: end;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
.nhsuk-bp-diastolic-axis-label {
|
|
505
|
+
bottom: -25px;
|
|
506
|
+
left: -10px;
|
|
507
|
+
width: 20px;
|
|
508
|
+
text-align: center;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
.nhsuk-bp-graph-marker {
|
|
512
|
+
position: absolute;
|
|
513
|
+
z-index: 6;
|
|
514
|
+
height: 24px;
|
|
515
|
+
width: 24px;
|
|
516
|
+
margin: 0 0 -12px -12px;
|
|
517
|
+
}
|
|
518
|
+
@media (max-width: 320px) {
|
|
519
|
+
.nhsuk-bp-graph-marker {
|
|
520
|
+
height: 20px;
|
|
521
|
+
width: 20px;
|
|
522
|
+
margin: 0 0 -10px -10px;
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
@media (min-width: 320px) and (max-width: 641px) {
|
|
526
|
+
.nhsuk-bp-graph-marker {
|
|
527
|
+
height: 22px;
|
|
528
|
+
width: 22px;
|
|
529
|
+
margin: 0 0 -11px -11px;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
.nhsuk-bp-classification-0, .nhsuk-bp-legend-key-classification-low {
|
|
534
|
+
background: #330072;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
.nhsuk-bp-classification-1, .nhsuk-bp-legend-key-classification-healthy {
|
|
538
|
+
background: repeating-linear-gradient(-45deg, #59c3bc, #59c3bc 4.5px, #33b6ad 4.5px, #33b6ad 9px);
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
.nhsuk-bp-classification-2, .nhsuk-bp-legend-key-classification-slightlyraised {
|
|
542
|
+
background: #ffb81c;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
.nhsuk-bp-classification-3, .nhsuk-bp-legend-key-classification-high {
|
|
546
|
+
background: repeating-linear-gradient(45deg, #e1746b, #e1746b 4.5px, #dd5349 4.5px, #dd5349 9px);
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
.nhsuk-bp-region-boundary {
|
|
550
|
+
position: absolute;
|
|
551
|
+
bottom: 0%;
|
|
552
|
+
outline: 1px solid black;
|
|
553
|
+
border-top: 1px solid black;
|
|
554
|
+
border-right: 1px solid black;
|
|
555
|
+
box-shadow: -1px 1px white inset, 2px 0px white, 0px -2px white, 2px -2px white;
|
|
556
|
+
z-index: 5;
|
|
557
|
+
background: transparent;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
.nhsuk-bp-classification-0 {
|
|
561
|
+
position: absolute;
|
|
562
|
+
bottom: 0%;
|
|
563
|
+
z-index: 3;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
.nhsuk-bp-classification-1 {
|
|
567
|
+
position: absolute;
|
|
568
|
+
bottom: 0%;
|
|
569
|
+
z-index: 2;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
.nhsuk-bp-classification-2 {
|
|
573
|
+
position: absolute;
|
|
574
|
+
bottom: 0%;
|
|
575
|
+
z-index: 1;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
.nhsuk-bp-classification-3 {
|
|
579
|
+
position: absolute;
|
|
580
|
+
bottom: 0%;
|
|
581
|
+
z-index: 0;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
.nhsuk-bp-graph-cell {
|
|
585
|
+
flex-grow: 1;
|
|
586
|
+
border-bottom: 1px solid white;
|
|
587
|
+
border-left: 1px solid white;
|
|
588
|
+
background: transparent;
|
|
589
|
+
z-index: 4;
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
.nhsuk-bp-first-in-column {
|
|
593
|
+
border-bottom: none;
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
.nhsuk-bp-first-in-row {
|
|
597
|
+
border-left: none;
|
|
598
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var e=require("react"),t=require("nhsuk-react-components"),n=require("big.js");const a={Underweight:"underweight",Healthy:"healthy",Overweight:"overweight"},r=Object.assign(Object.assign({},a),{Obese:"obese"}),s=Object.assign(Object.assign({},a),{Obese1:"obese1",Obese2:"obese2",Obese3:"obese3"});s.Underweight,s.Healthy,s.Underweight,s.Overweight,s.Healthy;const l={[s.Underweight]:null,[s.Healthy]:s.Underweight,[s.Overweight]:s.Healthy};class i{constructor(e){this.bounds={lowerBound:0,upperBounds:{[r.Underweight]:e.upper[s.Underweight].value,[r.Healthy]:e.upper[s.Healthy].value,[r.Overweight]:e.upper[s.Overweight].value}}}get chartRange(){return this.bounds.upperBounds[s.Overweight]-this.bounds.lowerBound}classificationPercentage(e){return this.offsetPercentage(this.bounds.upperBounds[e])}offsetPercentage(e){const t=this.chartRange;if(e<=2){const n=.08*t;return this.calculateOffset(e,a.Underweight,n)}if(e<=91){const n=.72*t,r=.08*t;return this.calculateOffset(e,a.Healthy,n)+r}const n=.2*t,r=.8*t;return this.calculateOffset(e,a.Overweight,n)+r}calculateOffset(e,t,n){const a=l[t]?this.bounds.upperBounds[l[t]]:0;return(e-a)/(this.bounds.upperBounds[t]-a)*n}clampedOffsetPercentage(e){const t=Math.max(1,Math.min(e,99));return this.offsetPercentage(t)}}function c({markerText:t,offsetPercent:n}){return e.createElement("div",{className:"nhsuk-cbmi-axis-marker",style:{left:`${n}%`}},e.createElement("div",{className:"nhsuk-font-size-16 nhsuk-cbmi-axis-marker-label"},t))}function o({model:t}){return e.createElement(e.Fragment,null,e.createElement(c,{markerText:t.bounds.upperBounds[a.Underweight].toString(),offsetPercent:t.classificationPercentage(a.Underweight)}),e.createElement(c,{markerText:t.bounds.upperBounds[a.Healthy].toString(),offsetPercent:t.classificationPercentage(a.Healthy)}))}function u(){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 m=e=>e<=20?"nhsuk-cbmi-chart-label-align-left":e<=80?"nhsuk-cbmi-chart-label-align-center":"nhsuk-cbmi-chart-label-align-right";function d({centile:t,markerText:n}){return e.createElement("div",{className:"nhsuk-cbmi-chart-label-marker"},e.createElement("div",{className:`nhsuk-u-font-size-19 ${m(t.value)}`},n,e.createElement("span",{className:"nhsuk-cbmi-chart-centile-marker"},t.label)))}function h({centile:t,model:n,markerText:a}){const r=n.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(d,{centile:t,markerText:a}),e.createElement(u,null)),e.createElement("div",{className:"nhsuk-cbmi-chart-axis-marker",style:{left:`${s}%`}}))}function g({classification:t,model:n}){const a=n.classificationPercentage(t);return e.createElement("div",{className:`nhsuk-cbmi-classification-${t}`,style:{width:`${a}%`}})}function p({model:t}){return e.createElement(e.Fragment,null,e.createElement(g,{classification:a.Underweight,model:t}),e.createElement(g,{classification:a.Healthy,model:t}),e.createElement(g,{classification:a.Overweight,model:t}))}function f({classificationBounds:t,centile:n,markerText:a}){const r=new i(t);return e.createElement("div",{className:"nhsuk-cbmi-graph nhsuk-u-margin-bottom-9 ","aria-hidden":"true"},e.createElement(o,{model:r}),e.createElement(h,{centile:n,markerText:a,model:r}),e.createElement(p,{model:r}))}function b({element:t,text:n,className:a,wrapperClassName:r}){return e.createElement("div",{className:`nhsuk-chart-legend-key-wrapper ${null!=r?r:""}`},e.createElement("div",{className:`nhsuk-chart-legend-key ${null!=a?a:""}`},t),n)}function y({legendKeys:n,className:a}){return e.createElement(t.Card,{className:`${a} nhsuk-u-padding-3 nhsuk-chart-legend-card`},n.map((t=>e.createElement(b,Object.assign({key:t.text},t)))))}function k({legendKeys:t,className:n}){return e.createElement("div",{className:n},t.map((t=>e.createElement(b,Object.assign({key:t.text},t)))))}function E({legendKeys:t,borderWrapper:n=!0}){const a="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"},n?e.createElement(y,{legendKeys:t,className:a}):e.createElement(k,{legendKeys:t,className:a}))}class w{constructor(e){this.bounds={lowerBound:17.5,upperBounds:{[r.Underweight]:e.upper[s.Underweight].value,[r.Healthy]:e.upper[s.Healthy].value,[r.Overweight]:e.upper[s.Overweight].value,[r.Obese]:e.upper[s.Obese2].value}}}get chartRange(){return this.bounds.upperBounds[r.Obese]-this.bounds.lowerBound}classificationPercentage(e){return this.offsetPercentage(this.bounds.upperBounds[e])}offsetPercentage(e){return(e-this.bounds.lowerBound)/this.chartRange*100}}function v(){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 L({bmi:t,model:n}){const a=n.offsetPercentage(t);let r=0;if(a>0){const e=1,t=Math.pow(10,e);r=Math.round(a*t)/t}return e.createElement("div",{className:"nhsuk-bmi-chart-marker",style:{left:`${r}%`}},e.createElement(v,null))}function x({classification:t,model:n}){const a=n.classificationPercentage(t);return e.createElement("div",{className:`nhsuk-bmi-classification-${t}`,style:{width:`${a}%`}})}function B({model:t}){return e.createElement(e.Fragment,null,e.createElement(x,{classification:r.Underweight,model:t}),e.createElement(x,{classification:r.Healthy,model:t}),e.createElement(x,{classification:r.Overweight,model:t}),e.createElement(x,{classification:r.Obese,model:t}))}function N({markerText:t,offsetPercent:n}){return e.createElement("div",{className:"nhsuk-bmi-axis-marker",style:{left:`${n}%`}},e.createElement("div",{className:"nhsuk-bmi-axis-marker-label"},t))}function O({model:t}){return e.createElement(e.Fragment,null,e.createElement(N,{markerText:t.bounds.upperBounds[r.Underweight].toString(),offsetPercent:t.classificationPercentage(r.Underweight)}),e.createElement(N,{markerText:t.bounds.upperBounds[r.Healthy].toString(),offsetPercent:t.classificationPercentage(r.Healthy)}),e.createElement(N,{markerText:t.bounds.upperBounds[r.Overweight].toString(),offsetPercent:t.classificationPercentage(r.Overweight)}))}function T({classificationBounds:t,bmi:n}){const a=new w(t);return e.createElement("div",{className:"nhsuk-bmi-graph","aria-hidden":"true"},e.createElement(O,{model:a}),e.createElement(L,{bmi:n,model:a}),e.createElement(B,{model:a}))}const P={Low:"0",Healthy:"1",SlightlyRaised:"2",High:"3",VeryHigh:"4"};var $;function H({axisType:t,labelText:n,offsetPercent:a,applyLabelSpecificStyles:r=!0}){const s=`${$[t].toLowerCase()}-axis`,l=`nhsuk-bp-${s}-marker`,i=`nhsuk-bp-${s}-marker-${n}`;return e.createElement("div",{className:r?`${l} ${i}`:`${l}`,style:t===$.Systolic?{bottom:`${a}%`}:{left:`${a}%`}},e.createElement("div",{className:`nhsuk-bp-${s}-label`},n))}function S(e,t,n){return(e-n)/(t-n)*100}function R(e,t,n){return S(t[e].value,t[P.High].value,n)}function U({axisType:t,upperBounds:n,lowerBound:a}){const r={slightlyRaisedValueToCheck:85,slightlyRaisedValueToAdd:90};return e.createElement("div",null,e.createElement(H,{labelText:a.toString(),offsetPercent:0,axisType:t}),e.createElement(H,{labelText:n[P.Low].value.toString(),offsetPercent:R(P.Low,n,a),axisType:t}),e.createElement(H,{labelText:n[P.Healthy].value.toString(),offsetPercent:R(P.Healthy,n,a),axisType:t}),e.createElement(H,{labelText:n[P.SlightlyRaised].value.toString(),offsetPercent:R(P.SlightlyRaised,n,a),axisType:t,applyLabelSpecificStyles:n[P.SlightlyRaised].value===r.slightlyRaisedValueToCheck}),t===$.Diastolic&&n[P.SlightlyRaised].value===r.slightlyRaisedValueToCheck&&e.createElement(H,{labelText:r.slightlyRaisedValueToAdd.toString(),offsetPercent:S(r.slightlyRaisedValueToAdd,n[P.High].value,a),axisType:t}),e.createElement(H,{labelText:n[P.High].value.toString(),offsetPercent:100,axisType:t}))}function C({bounds:t}){return e.createElement(e.Fragment,null,e.createElement(U,{axisType:$.Systolic,upperBounds:t.systolic.upper,lowerBound:t.systolic.lower}),e.createElement(U,{axisType:$.Diastolic,upperBounds:t.diastolic.upper,lowerBound:t.diastolic.lower}))}function j(){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 M({systolicReading:t,diastolicReading:a,systolicLowerBound:r,systolicUpperBound:s,diastolicLowerBound:l,diastolicUpperBound:i}){const c=i-l,o=new n((t-r)/(s-r)).times(100),u=new n((a-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(j,null))}function K(e,t,n){return(t[n].value-e)/(t[3].value-e)*100}function A(e){return`nhsuk-bp-classification-${e.toLowerCase()}`}function F({classification:t,bounds:n,renderAsBoundary:a=!1}){const r=K(n.diastolic.lower,n.diastolic.upper,t),s=K(n.systolic.lower,n.systolic.upper,t);return e.createElement("div",{className:a?"nhsuk-bp-region-boundary":A(t),style:{width:`${r}%`,height:`${s}%`}})}function V({bounds:t,renderAsBoundary:n=!1}){return e.createElement(e.Fragment,null,e.createElement(F,Object.assign({classification:P.Low},{bounds:t,renderAsBoundary:n})),e.createElement(F,Object.assign({classification:P.Healthy},{bounds:t,renderAsBoundary:n})),e.createElement(F,Object.assign({classification:P.SlightlyRaised},{bounds:t,renderAsBoundary:n})),!n&&e.createElement(F,Object.assign({classification:P.High},{bounds:t,renderAsBoundary:n})))}function D({firstInRow:t=!1,firstInColumn:n=!1}){let a="nhsuk-bp-graph-cell";return t&&(a+=" nhsuk-bp-first-in-row"),n&&(a+=" nhsuk-bp-first-in-column"),e.createElement("div",{className:a})}function W({bounds:t,graphLayout:n,reading:a}){const{systolic:r,diastolic:s}=a,{systolicLabel:l,diastolicLabel:i}=n;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(C,{bounds:t}),e.createElement(M,{systolicReading:r,diastolicReading:s,systolicLowerBound:t.systolic.lower,systolicUpperBound:t.systolic.upper[3].value,diastolicLowerBound:t.diastolic.lower,diastolicUpperBound:t.diastolic.upper[3].value}),e.createElement(V,{bounds:t}),n.rows.map((t=>e.createElement("div",{key:t.id,className:"nhsuk-bp-graph-row"},t.cells.map((t=>e.createElement(D,Object.assign({key:t.id},t))))))),e.createElement(V,{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"}($||($={})),n.RM=n.roundHalfEven;exports.BmiChart=T,exports.BmiChartFigure=function({classificationBounds:t,bmi:n,ariaLabel:a,legendKeys:r,legendMarkerText:s}){const l=((t,n)=>Object.entries(t).map((([e,t])=>({text:t,className:`nhsuk-bmi-legend-key-classification-${e}`}))).concat({text:n,className:"nhsuk-bmi-legend-key-marker",element:e.createElement(v,null)}))(r,s);return e.createElement("figure",{className:"nhsuk-u-margin-0"},e.createElement("figcaption",{className:"nhsuk-u-visually-hidden"},a),e.createElement(T,{classificationBounds:t,bmi:n}),e.createElement(E,{legendKeys:l,borderWrapper:!0}))},exports.BpChart=W,exports.BpChartFigure=function({bounds:t,graphLayout:n,reading:a,ariaLabel:r,legendKeys:s,legendMarkerText:l}){const i=((t,n)=>Object.entries(t).map((([e,t])=>({text:t,className:`nhsuk-bp-legend-key-classification-${e}`}))).concat({text:n,className:"nhsuk-bp-legend-key-marker",element:e.createElement(j,null)}))(s,l);return e.createElement("figure",{className:"nhsuk-u-margin-0"},e.createElement("figcaption",{className:"nhsuk-u-visually-hidden"},r),e.createElement(W,{bounds:t,reading:a,graphLayout:n}),e.createElement(E,{legendKeys:i}))},exports.ChartLegend=E,exports.ChildBmiChart=f,exports.ChildBmiChartFigure=function({classificationBounds:t,centile:n,centileMarkerText:a,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(f,{classificationBounds:t,centile:n,markerText:a}),e.createElement(E,{legendKeys:l,borderWrapper:!1}))};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|