fhir-react 0.3.0 → 0.3.4

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.
Files changed (47) hide show
  1. package/.github/workflows/publish_npmjs.yml +2 -0
  2. package/README.md +88 -5
  3. package/build/bootstrap-reboot.min.css +394 -0
  4. package/build/index.js +43 -0
  5. package/build/style.css +31 -0
  6. package/package.json +3 -2
  7. package/src/assets/containers/Patient/patient.svg +6 -0
  8. package/src/components/containers/Accordion/Accordion.js +7 -3
  9. package/src/components/datatypes/HeaderIcon/HeaderIcon.js +67 -22
  10. package/src/components/resources/Appointment/Appointment.js +3 -3
  11. package/src/components/resources/Appointment/Appointment.stories.js +28 -5
  12. package/src/components/resources/Appointment/Appointment.test.js +72 -0
  13. package/src/components/resources/Condition/Condition.js +1 -2
  14. package/src/components/resources/Condition/Condition.stories.js +9 -19
  15. package/src/components/resources/Condition/Condition.test.js +71 -1
  16. package/src/components/resources/Encounter/Encounter.js +3 -4
  17. package/src/components/resources/Encounter/Encounter.stories.js +27 -5
  18. package/src/components/resources/Encounter/Encounter.test.js +72 -0
  19. package/src/components/resources/ExplanationOfBenefit/ExplanationOfBenefit.js +26 -10
  20. package/src/components/resources/ExplanationOfBenefit/ExplanationOfBenefit.stories.js +8 -0
  21. package/src/components/resources/ExplanationOfBenefit/ExplanationOfBenefit.test.js +80 -3
  22. package/src/components/resources/ExplanationOfBenefit/SupportingInfo.js +21 -6
  23. package/src/components/resources/Immunization/Immunization.js +1 -2
  24. package/src/components/resources/Immunization/Immunization.stories.js +6 -9
  25. package/src/components/resources/Immunization/Immunization.test.js +71 -1
  26. package/src/components/resources/Observation/Observation.js +3 -3
  27. package/src/components/resources/Observation/Observation.stories.js +14 -5
  28. package/src/components/resources/Observation/Observation.test.js +67 -0
  29. package/src/components/resources/Patient/Patient.js +9 -6
  30. package/src/components/resources/Patient/Patient.stories.js +12 -5
  31. package/src/components/resources/Patient/Patient.test.js +67 -0
  32. package/src/components/resources/Practitioner/Practitioner.js +3 -13
  33. package/src/components/resources/Practitioner/Practitioner.stories.js +19 -3
  34. package/src/components/resources/Practitioner/Practitioner.test.js +72 -0
  35. package/src/components/resources/Procedure/Procedure.js +1 -2
  36. package/src/components/resources/Procedure/Procedure.stories.js +11 -5
  37. package/src/components/resources/Procedure/Procedure.test.js +71 -1
  38. package/src/components/resources/ResourceCategory/ResourceCategory.js +6 -3
  39. package/src/components/resources/ResourceCategory/ResourceCategory.test.js +1 -1
  40. package/src/components/supportedFhirResourceList.js +2 -0
  41. package/src/components/ui/index.js +33 -25
  42. package/src/fixtures/example-icons.jsx +48 -10
  43. package/src/fixtures/r4/resources/explanationOfBenefit/c4bbExample.json +18 -2
  44. package/src/index.js +1 -0
  45. package/src/utils/convertCamelCaseToSentence.js +9 -0
  46. package/src/utils/convertCamelCaseToSentence.test.js +9 -0
  47. package/webpack.config.js +10 -1
@@ -13,6 +13,8 @@ jobs:
13
13
  node-version: '16.x'
14
14
  registry-url: 'https://registry.npmjs.org'
15
15
  - run: npm ci
16
+ - run: npm run build
17
+ - run: npm run test
16
18
  - run: npm publish
17
19
  env:
18
20
  NODE_AUTH_TOKEN: ${{ secrets.NPMJS_TOKEN }}
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  [![CircleCI](https://circleci.com/gh/1uphealth/fhir-react/tree/master.svg?style=svg)](https://circleci.com/gh/1uphealth/fhir-react/tree/master)
2
- [![Storybook](https://github.com/storybookjs/brand/raw/master/badge/badge-storybook.svg?sanitize=true)](http://storybook-fhir-react-lib.s3-website-us-east-1.amazonaws.com/)
2
+ [![Storybook](https://github.com/storybookjs/brand/raw/master/badge/badge-storybook.svg?sanitize=true)](https://fhir-react-lib-test-storybook.s3.amazonaws.com/branch/release-0-3-4/index.html)
3
3
 
4
4
  # fhir-react
5
5
 
@@ -35,7 +35,90 @@ const MyComponent = () => {
35
35
  };
36
36
  ```
37
37
 
38
- Optionally custom header icons could be passed as `fhirIcons` props. The shape of the passed object should be as in example below with resource type as the key and image url or DOM node as the value:
38
+ Optionally custom header icons could be passed as `fhirIcons` props in few different way:
39
+
40
+ 1. As a URL
41
+ ```jsx
42
+ const MyComponent = () => {
43
+ const fhirResource = JSON.parse(fhirResourceAsJsonString);
44
+ return (
45
+ <FhirResource
46
+ fhirResource={fhirResource}
47
+ fhirVersion={fhirVersions.R4}
48
+ fhirIcons="https://www.gravatar.com/avatar/?s=50&r=any&default=identicon&forcedefault=1"
49
+ withCarinBBProfile
50
+ />
51
+ );
52
+ };
53
+ ````
54
+ 2. As a ```<img>``` element
55
+ ```jsx
56
+ const MyComponent = () => {
57
+ const fhirResource = JSON.parse(fhirResourceAsJsonString);
58
+ return (
59
+ <FhirResource
60
+ fhirResource={fhirResource}
61
+ fhirVersion={fhirVersions.R4}
62
+ fhirIcons={<img
63
+ src={require('./dstu2/resources/condition/condition.svg')}
64
+ alt="header icon"
65
+ />}
66
+ withCarinBBProfile
67
+ />
68
+ );
69
+ };
70
+ ````
71
+
72
+ 3. As a React src from import
73
+ ````jsx
74
+ import EncounterIcon from '../../../assets/containers/Encounter/encounter.svg';
75
+
76
+ const MyComponent = () => {
77
+ const fhirResource = JSON.parse(fhirResourceAsJsonString);
78
+ return (
79
+ <FhirResource
80
+ fhirResource={fhirResource}
81
+ fhirVersion={fhirVersions.R4}
82
+ fhirIcons={EncounterIcon}
83
+ withCarinBBProfile
84
+ />
85
+ );
86
+ };
87
+ ````
88
+ or
89
+ ````jsx
90
+ const MyComponent = () => {
91
+ const fhirResource = JSON.parse(fhirResourceAsJsonString);
92
+ return (
93
+ <FhirResource
94
+ fhirResource={fhirResource}
95
+ fhirVersion={fhirVersions.R4}
96
+ fhirIcons={require('./dstu2/resources/condition/condition.svg')}
97
+ withCarinBBProfile
98
+ />
99
+ );
100
+ };
101
+ ````
102
+
103
+ 4. As a ``false`` value to display the placeholder
104
+ ````jsx
105
+ const MyComponent = () => {
106
+ const fhirResource = JSON.parse(fhirResourceAsJsonString);
107
+ return (
108
+ <FhirResource
109
+ fhirResource={fhirResource}
110
+ fhirVersion={fhirVersions.R4}
111
+ fhirIcons={false}
112
+ withCarinBBProfile
113
+ />
114
+ );
115
+ };
116
+ ````
117
+ 5. Without a `fhirIcons` props
118
+ The resource icon if it exists or a placeholder will be displayed.
119
+
120
+
121
+ 6. As the resources object with resource type as the key and image URL or DOM node as the value
39
122
 
40
123
  ```jsx
41
124
  import React from 'react';
@@ -116,13 +199,13 @@ export default {
116
199
  | `ReferralRequest` | ✅ | ✅ | _N/A_ |
117
200
  | `ResearchStudy` | _N/A_ | ✅ | ✅ |
118
201
 
119
- ### Styles update `v0.3.0`
202
+ ### Styles update `v0.3`
120
203
 
121
- The 0.3.0 version of the FHIR React Component library introduces the bootstrap Accordion component as the base of each available resource which provides any data. The RWD support is provided for each component.
204
+ The 0.3 version of the FHIR React Component library introduces the bootstrap Accordion component as the base of each available resource which provides any data. The RWD support is provided for each component.
122
205
 
123
206
  All of the changes can be tracked by viewing the current version of the [storybook](https://fhir-react-lib-test-storybook.s3.amazonaws.com/branch/fhir-react-next/index.html?path=/story/condition--default-visualization-dstu-2).
124
207
 
125
- ### Available resources `v0.3.0`
208
+ ### Available resources `v0.3`
126
209
 
127
210
 
128
211
  | Resource | DSTU2 | STU3 | R4 | Carin BB Profile | DaVinci PDex |
@@ -0,0 +1,394 @@
1
+ /* stylelint-disable */
2
+
3
+ /*!
4
+ * Bootstrap Reboot v4.3.1 (https://getbootstrap.com/)
5
+ * Copyright 2011-2019 The Bootstrap Authors
6
+ * Copyright 2011-2019 Twitter, Inc.
7
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
8
+ * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
9
+ */
10
+ .fhir-resource *,
11
+ .fhir-resource::after,
12
+ .fhir-resource::before {
13
+ box-sizing: border-box;
14
+ }
15
+
16
+ .fhir-resource {
17
+ font-size: 1rem;
18
+ font-weight: 400;
19
+ line-height: 1.5;
20
+ background-color: #fff;
21
+ -webkit-text-size-adjust: 100%;
22
+ -webkit-tap-highlight-color: transparent;
23
+ padding: 1rem;
24
+ }
25
+
26
+ .fhir-resource [tabindex='-1']:focus:not(:focus-visible) {
27
+ outline: 0 !important;
28
+ }
29
+
30
+ .fhir-resource hr {
31
+ margin: 1rem 0;
32
+ color: inherit;
33
+ background-color: currentColor;
34
+ border: 0;
35
+ opacity: 0.25;
36
+ }
37
+
38
+ .fhir-resource hr:not([size]) {
39
+ height: 1px;
40
+ }
41
+
42
+ .fhir-resource h1,
43
+ .fhir-resource h2,
44
+ .fhir-resource h3,
45
+ .fhir-resource h4,
46
+ .fhir-resource h5,
47
+ .fhir-resource h6 {
48
+ margin-top: 0;
49
+ margin-bottom: 0.5rem;
50
+ font-weight: 500;
51
+ line-height: 1.2;
52
+ }
53
+
54
+ .fhir-resource h1 {
55
+ font-size: 2.5rem;
56
+ }
57
+
58
+ .fhir-resource h2 {
59
+ font-size: 2rem;
60
+ }
61
+
62
+ .fhir-resource h3 {
63
+ font-size: 1.75rem;
64
+ }
65
+
66
+ .fhir-resource h4 {
67
+ font-size: 1.5rem;
68
+ }
69
+
70
+ .fhir-resource h5 {
71
+ font-size: 1.25rem;
72
+ }
73
+
74
+ .fhir-resource h6 {
75
+ font-size: 1rem;
76
+ }
77
+
78
+ .fhir-resource p {
79
+ margin-top: 0;
80
+ margin-bottom: 1rem;
81
+ }
82
+
83
+ .fhir-resource abbr[data-original-title],
84
+ .fhir-resource abbr[title] {
85
+ text-decoration: underline;
86
+ -webkit-text-decoration: underline dotted;
87
+ text-decoration: underline dotted;
88
+ cursor: help;
89
+ -webkit-text-decoration-skip-ink: none;
90
+ text-decoration-skip-ink: none;
91
+ }
92
+
93
+ .fhir-resource address {
94
+ margin-bottom: 1rem;
95
+ font-style: normal;
96
+ line-height: inherit;
97
+ }
98
+
99
+ .fhir-resource ol,
100
+ .fhir-resource ul {
101
+ padding-left: 2rem;
102
+ }
103
+
104
+ .fhir-resource dl,
105
+ .fhir-resource ol,
106
+ .fhir-resource ul {
107
+ margin-top: 0;
108
+ margin-bottom: 0;
109
+ }
110
+
111
+ .fhir-resource ol ol,
112
+ .fhir-resource ol ul,
113
+ .fhir-resource ul ol,
114
+ .fhir-resource ul ul {
115
+ margin-bottom: 0;
116
+ }
117
+
118
+ .fhir-resource dt {
119
+ font-weight: 700;
120
+ }
121
+
122
+ .fhir-resource dd {
123
+ margin-bottom: 0.5rem;
124
+ margin-left: 0;
125
+ }
126
+
127
+ .fhir-resource blockquote {
128
+ margin: 0 0 1rem;
129
+ }
130
+
131
+ .fhir-resource b,
132
+ strong {
133
+ font-weight: bolder;
134
+ }
135
+
136
+ .fhir-resource small {
137
+ font-size: 0.875em;
138
+ }
139
+
140
+ .fhir-resource sub,
141
+ sup {
142
+ position: relative;
143
+ font-size: 0.75em;
144
+ line-height: 0;
145
+ vertical-align: baseline;
146
+ }
147
+
148
+ .fhir-resource sub {
149
+ bottom: -0.25em;
150
+ }
151
+
152
+ .fhir-resource sup {
153
+ top: -0.5em;
154
+ }
155
+
156
+ .fhir-resource a {
157
+ color: #0d6efd;
158
+ text-decoration: none;
159
+ }
160
+
161
+ .fhir-resource a:hover {
162
+ color: #024dbc;
163
+ text-decoration: underline;
164
+ }
165
+
166
+ .fhir-resource a:not([href]),
167
+ .fhir-resource a:not([href]):hover {
168
+ color: inherit;
169
+ text-decoration: none;
170
+ }
171
+
172
+ .fhir-resource code,
173
+ .fhir-resource kbd,
174
+ .fhir-resource pre,
175
+ .fhir-resource samp {
176
+ font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono',
177
+ 'Courier New', monospace;
178
+ font-size: 1em;
179
+ }
180
+
181
+ .fhir-resource pre {
182
+ display: block;
183
+ margin-top: 0;
184
+ margin-bottom: 1rem;
185
+ overflow: auto;
186
+ font-size: 0.875em;
187
+ }
188
+
189
+ .fhir-resource pre code {
190
+ font-size: inherit;
191
+ color: inherit;
192
+ word-break: normal;
193
+ }
194
+
195
+ .fhir-resource code {
196
+ font-size: 0.875em;
197
+ color: #d63384;
198
+ word-wrap: break-word;
199
+ }
200
+
201
+ .fhir-resource a > code {
202
+ color: inherit;
203
+ }
204
+
205
+ .fhir-resource kbd {
206
+ padding: 0.2rem 0.4rem;
207
+ font-size: 0.875em;
208
+ color: #fff;
209
+ background-color: #212529;
210
+ border-radius: 0.2rem;
211
+ }
212
+
213
+ .fhir-resource kbd kbd {
214
+ padding: 0;
215
+ font-size: 1em;
216
+ font-weight: 700;
217
+ }
218
+
219
+ .fhir-resource figure {
220
+ margin: 0 0 1rem;
221
+ }
222
+
223
+ .fhir-resource img {
224
+ vertical-align: middle;
225
+ }
226
+
227
+ .fhir-resource svg {
228
+ overflow: hidden;
229
+ vertical-align: middle;
230
+ }
231
+
232
+ .fhir-resource table {
233
+ border-collapse: collapse;
234
+ }
235
+
236
+ .fhir-resource caption {
237
+ padding-top: 0.5rem;
238
+ padding-bottom: 0.5rem;
239
+ color: #6c757d;
240
+ text-align: left;
241
+ caption-side: bottom;
242
+ }
243
+
244
+ .fhir-resource th {
245
+ text-align: inherit;
246
+ }
247
+
248
+ .fhir-resource label {
249
+ display: inline-block;
250
+ }
251
+
252
+ .fhir-resource button {
253
+ border-radius: 0;
254
+ }
255
+
256
+ .fhir-resource button:focus {
257
+ outline: 1px dotted;
258
+ outline: 5px auto -webkit-focus-ring-color;
259
+ }
260
+
261
+ .fhir-resource button,
262
+ input,
263
+ optgroup,
264
+ select,
265
+ textarea {
266
+ margin: 0;
267
+ font-family: inherit;
268
+ font-size: inherit;
269
+ line-height: inherit;
270
+ }
271
+
272
+ .fhir-resource button,
273
+ input {
274
+ overflow: visible;
275
+ }
276
+
277
+ .fhir-resource button,
278
+ select {
279
+ text-transform: none;
280
+ }
281
+
282
+ .fhir-resource select {
283
+ word-wrap: normal;
284
+ }
285
+
286
+ .fhir-resource [list]::-webkit-calendar-picker-indicator {
287
+ display: none;
288
+ }
289
+
290
+ .fhir-resource [type='button'],
291
+ [type='reset'],
292
+ [type='submit'],
293
+ button {
294
+ -webkit-appearance: button;
295
+ }
296
+
297
+ .fhir-resource [type='button']:not(:disabled),
298
+ [type='reset']:not(:disabled),
299
+ [type='submit']:not(:disabled),
300
+ button:not(:disabled) {
301
+ cursor: pointer;
302
+ }
303
+
304
+ .fhir-resource ::-moz-focus-inner {
305
+ padding: 0;
306
+ border-style: none;
307
+ }
308
+
309
+ .fhir-resource input[type='date'],
310
+ input[type='datetime-local'],
311
+ input[type='month'],
312
+ input[type='time'] {
313
+ -webkit-appearance: textfield;
314
+ }
315
+
316
+ .fhir-resource textarea {
317
+ overflow: auto;
318
+ resize: vertical;
319
+ }
320
+
321
+ .fhir-resource fieldset {
322
+ min-width: 0;
323
+ padding: 0;
324
+ margin: 0;
325
+ border: 0;
326
+ }
327
+
328
+ .fhir-resource legend {
329
+ float: left;
330
+ width: 100%;
331
+ padding: 0;
332
+ margin-bottom: 0.5rem;
333
+ font-size: 1.5rem;
334
+ line-height: inherit;
335
+ color: inherit;
336
+ white-space: normal;
337
+ }
338
+
339
+ .fhir-resource mark {
340
+ padding: 0.2em;
341
+ background-color: #fcf8e3;
342
+ }
343
+
344
+ .fhir-resource progress {
345
+ vertical-align: baseline;
346
+ }
347
+
348
+ .fhir-resource ::-webkit-datetime-edit {
349
+ overflow: visible;
350
+ line-height: 0;
351
+ }
352
+
353
+ .fhir-resource [type='search'] {
354
+ outline-offset: -2px;
355
+ -webkit-appearance: textfield;
356
+ }
357
+
358
+ .fhir-resource ::-webkit-search-decoration {
359
+ -webkit-appearance: none;
360
+ }
361
+
362
+ .fhir-resource ::-webkit-color-swatch-wrapper {
363
+ padding: 0;
364
+ }
365
+
366
+ .fhir-resource ::-webkit-file-upload-button {
367
+ font: inherit;
368
+ -webkit-appearance: button;
369
+ }
370
+
371
+ .fhir-resource output {
372
+ display: inline-block;
373
+ }
374
+
375
+ .fhir-resource summary {
376
+ display: list-item;
377
+ cursor: pointer;
378
+ }
379
+
380
+ .fhir-resource template {
381
+ display: none;
382
+ }
383
+
384
+ .fhir-resource main {
385
+ display: block;
386
+ }
387
+
388
+ .fhir-resource [hidden] {
389
+ display: none !important;
390
+ }
391
+
392
+ .overflow-auto {
393
+ overflow: auto;
394
+ }