@ltht-react/allergy-detail 2.0.176 → 2.0.177
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 +15 -15
- package/package.json +7 -7
- package/src/atoms/allergy-onset-detail.tsx +34 -34
- package/src/index.tsx +62 -62
package/README.md
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
# AllergyDetail
|
|
2
|
-
|
|
3
|
-
<!-- STORY -->
|
|
4
|
-
|
|
5
|
-
### Import
|
|
6
|
-
|
|
7
|
-
```js
|
|
8
|
-
import AllergyDetail from '@ltht-react/allergy-detail'
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
### Usage
|
|
12
|
-
|
|
13
|
-
```jsx
|
|
14
|
-
<AllergyDetail />
|
|
15
|
-
```
|
|
1
|
+
# AllergyDetail
|
|
2
|
+
|
|
3
|
+
<!-- STORY -->
|
|
4
|
+
|
|
5
|
+
### Import
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
import AllergyDetail from '@ltht-react/allergy-detail'
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
### Usage
|
|
12
|
+
|
|
13
|
+
```jsx
|
|
14
|
+
<AllergyDetail />
|
|
15
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ltht-react/allergy-detail",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.177",
|
|
4
4
|
"description": "ltht-react clinical AllergyDetail component.",
|
|
5
5
|
"author": "LTHT",
|
|
6
6
|
"homepage": "",
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@emotion/react": "^11.0.0",
|
|
30
30
|
"@emotion/styled": "^11.0.0",
|
|
31
|
-
"@ltht-react/description-list": "^2.0.
|
|
32
|
-
"@ltht-react/styles": "^2.0.
|
|
33
|
-
"@ltht-react/type-detail": "^2.0.
|
|
34
|
-
"@ltht-react/types": "^2.0.
|
|
35
|
-
"@ltht-react/utils": "^2.0.
|
|
31
|
+
"@ltht-react/description-list": "^2.0.177",
|
|
32
|
+
"@ltht-react/styles": "^2.0.177",
|
|
33
|
+
"@ltht-react/type-detail": "^2.0.177",
|
|
34
|
+
"@ltht-react/types": "^2.0.177",
|
|
35
|
+
"@ltht-react/utils": "^2.0.177",
|
|
36
36
|
"react": "^18.2.0"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "767ea98cfcefe4d93d604a52c8819e282373f90e"
|
|
39
39
|
}
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { AllergyIntoleranceOnSet, Maybe } from '@ltht-react/types'
|
|
2
|
-
import DescriptionList from '@ltht-react/description-list'
|
|
3
|
-
import { partialDateTimeText, periodSummaryText, quantityText, rangeText } from '@ltht-react/utils'
|
|
4
|
-
import { DetailViewComponent, IDetailViewProps, NestedListDetail } from '@ltht-react/type-detail'
|
|
5
|
-
|
|
6
|
-
const AllergyOnsetDetail: DetailViewComponent<IProps> = ({ term, onset, showIfEmpty = true }) => {
|
|
7
|
-
if (!onset && showIfEmpty === false) {
|
|
8
|
-
return <></>
|
|
9
|
-
}
|
|
10
|
-
return (
|
|
11
|
-
<NestedListDetail term={term} wrapDescription={false}>
|
|
12
|
-
{onset && (
|
|
13
|
-
<>
|
|
14
|
-
{onset.onSetAge && <DescriptionList.Description>{quantityText(onset.onSetAge)}</DescriptionList.Description>}
|
|
15
|
-
{onset.onSetDateTime && (
|
|
16
|
-
<DescriptionList.Description>{partialDateTimeText(onset.onSetDateTime)}</DescriptionList.Description>
|
|
17
|
-
)}
|
|
18
|
-
{onset.onSetPeriod && (
|
|
19
|
-
<DescriptionList.Description>{periodSummaryText(onset.onSetPeriod)}</DescriptionList.Description>
|
|
20
|
-
)}
|
|
21
|
-
{onset.onSetRange && <DescriptionList.Description>{rangeText(onset.onSetRange)}</DescriptionList.Description>}
|
|
22
|
-
{onset.onSetString && <DescriptionList.Description>{onset.onSetString}</DescriptionList.Description>}
|
|
23
|
-
</>
|
|
24
|
-
)}
|
|
25
|
-
</NestedListDetail>
|
|
26
|
-
)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
interface IProps extends IDetailViewProps {
|
|
30
|
-
term: string
|
|
31
|
-
onset?: Maybe<AllergyIntoleranceOnSet>
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export default AllergyOnsetDetail
|
|
1
|
+
import { AllergyIntoleranceOnSet, Maybe } from '@ltht-react/types'
|
|
2
|
+
import DescriptionList from '@ltht-react/description-list'
|
|
3
|
+
import { partialDateTimeText, periodSummaryText, quantityText, rangeText } from '@ltht-react/utils'
|
|
4
|
+
import { DetailViewComponent, IDetailViewProps, NestedListDetail } from '@ltht-react/type-detail'
|
|
5
|
+
|
|
6
|
+
const AllergyOnsetDetail: DetailViewComponent<IProps> = ({ term, onset, showIfEmpty = true }) => {
|
|
7
|
+
if (!onset && showIfEmpty === false) {
|
|
8
|
+
return <></>
|
|
9
|
+
}
|
|
10
|
+
return (
|
|
11
|
+
<NestedListDetail term={term} wrapDescription={false}>
|
|
12
|
+
{onset && (
|
|
13
|
+
<>
|
|
14
|
+
{onset.onSetAge && <DescriptionList.Description>{quantityText(onset.onSetAge)}</DescriptionList.Description>}
|
|
15
|
+
{onset.onSetDateTime && (
|
|
16
|
+
<DescriptionList.Description>{partialDateTimeText(onset.onSetDateTime)}</DescriptionList.Description>
|
|
17
|
+
)}
|
|
18
|
+
{onset.onSetPeriod && (
|
|
19
|
+
<DescriptionList.Description>{periodSummaryText(onset.onSetPeriod)}</DescriptionList.Description>
|
|
20
|
+
)}
|
|
21
|
+
{onset.onSetRange && <DescriptionList.Description>{rangeText(onset.onSetRange)}</DescriptionList.Description>}
|
|
22
|
+
{onset.onSetString && <DescriptionList.Description>{onset.onSetString}</DescriptionList.Description>}
|
|
23
|
+
</>
|
|
24
|
+
)}
|
|
25
|
+
</NestedListDetail>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface IProps extends IDetailViewProps {
|
|
30
|
+
term: string
|
|
31
|
+
onset?: Maybe<AllergyIntoleranceOnSet>
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export default AllergyOnsetDetail
|
package/src/index.tsx
CHANGED
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
import { FC } from 'react'
|
|
2
|
-
import styled from '@emotion/styled'
|
|
3
|
-
import { AllergyIntolerance, DetailViewType } from '@ltht-react/types'
|
|
4
|
-
import {
|
|
5
|
-
AnnotationListDetail,
|
|
6
|
-
CodeableConceptDetail,
|
|
7
|
-
CodingListDetail,
|
|
8
|
-
CollapsibleDetailCollection,
|
|
9
|
-
CollapsibleDetailCollectionProps,
|
|
10
|
-
DatetimeDetail,
|
|
11
|
-
ResourceReferenceDetail,
|
|
12
|
-
StringDetail,
|
|
13
|
-
} from '@ltht-react/type-detail'
|
|
14
|
-
import AllergyOnset from './atoms/allergy-onset-detail'
|
|
15
|
-
|
|
16
|
-
const TopSection = styled.div`
|
|
17
|
-
display: flex;
|
|
18
|
-
justify-content: space-between;
|
|
19
|
-
align-items: flex-start;
|
|
20
|
-
margin-bottom: 1rem;
|
|
21
|
-
|
|
22
|
-
& dl:last-of-type {
|
|
23
|
-
margin-top: 0;
|
|
24
|
-
text-align: right;
|
|
25
|
-
}
|
|
26
|
-
`
|
|
27
|
-
|
|
28
|
-
const Separator = styled.div`
|
|
29
|
-
height: 1px;
|
|
30
|
-
background: rgba(0, 0, 0, 0.125);
|
|
31
|
-
margin: 0.75rem -0.75rem 0 -0.75rem;
|
|
32
|
-
`
|
|
33
|
-
|
|
34
|
-
const AllergyDetail: FC<Props> = ({ allergy, showDates = true, viewType = DetailViewType.Compact }) => (
|
|
35
|
-
<>
|
|
36
|
-
<TopSection>
|
|
37
|
-
<StringDetail term="Type" description={allergy.type?.toString()} />
|
|
38
|
-
<CodingListDetail term="Data Source(s)" codings={allergy.metadata.dataSources} />
|
|
39
|
-
</TopSection>
|
|
40
|
-
<Separator />
|
|
41
|
-
<CollapsibleDetailCollection viewType={viewType}>
|
|
42
|
-
<StringDetail term="Category" description={allergy?.category?.toString()} />
|
|
43
|
-
<CodeableConceptDetail term="Allergy" concept={allergy.code} />
|
|
44
|
-
<StringDetail term="Verification Status" description={allergy.verificationStatus?.toString()} />
|
|
45
|
-
<StringDetail term="Clinical Status" description={allergy.clinicalStatus?.toString()} />
|
|
46
|
-
{showDates ? <AllergyOnset term="Onset" onset={allergy.onSet} /> : <></>}
|
|
47
|
-
<ResourceReferenceDetail term="Asserter" resourceReference={allergy?.asserter} />
|
|
48
|
-
{showDates ? <DatetimeDetail term="Asserted Date" datetime={allergy?.assertedDate} /> : <></>}
|
|
49
|
-
<AnnotationListDetail term="Note(s)" notes={allergy.note} />
|
|
50
|
-
<DatetimeDetail term="Last Occurence" datetime={allergy?.lastOccurrence} />
|
|
51
|
-
<StringDetail term="Criticality" description={allergy.criticality?.toString()} />
|
|
52
|
-
<ResourceReferenceDetail term="Recorder" resourceReference={allergy?.recorder} />
|
|
53
|
-
</CollapsibleDetailCollection>
|
|
54
|
-
</>
|
|
55
|
-
)
|
|
56
|
-
|
|
57
|
-
interface Props extends CollapsibleDetailCollectionProps {
|
|
58
|
-
allergy: AllergyIntolerance
|
|
59
|
-
showDates?: boolean
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export default AllergyDetail
|
|
1
|
+
import { FC } from 'react'
|
|
2
|
+
import styled from '@emotion/styled'
|
|
3
|
+
import { AllergyIntolerance, DetailViewType } from '@ltht-react/types'
|
|
4
|
+
import {
|
|
5
|
+
AnnotationListDetail,
|
|
6
|
+
CodeableConceptDetail,
|
|
7
|
+
CodingListDetail,
|
|
8
|
+
CollapsibleDetailCollection,
|
|
9
|
+
CollapsibleDetailCollectionProps,
|
|
10
|
+
DatetimeDetail,
|
|
11
|
+
ResourceReferenceDetail,
|
|
12
|
+
StringDetail,
|
|
13
|
+
} from '@ltht-react/type-detail'
|
|
14
|
+
import AllergyOnset from './atoms/allergy-onset-detail'
|
|
15
|
+
|
|
16
|
+
const TopSection = styled.div`
|
|
17
|
+
display: flex;
|
|
18
|
+
justify-content: space-between;
|
|
19
|
+
align-items: flex-start;
|
|
20
|
+
margin-bottom: 1rem;
|
|
21
|
+
|
|
22
|
+
& dl:last-of-type {
|
|
23
|
+
margin-top: 0;
|
|
24
|
+
text-align: right;
|
|
25
|
+
}
|
|
26
|
+
`
|
|
27
|
+
|
|
28
|
+
const Separator = styled.div`
|
|
29
|
+
height: 1px;
|
|
30
|
+
background: rgba(0, 0, 0, 0.125);
|
|
31
|
+
margin: 0.75rem -0.75rem 0 -0.75rem;
|
|
32
|
+
`
|
|
33
|
+
|
|
34
|
+
const AllergyDetail: FC<Props> = ({ allergy, showDates = true, viewType = DetailViewType.Compact }) => (
|
|
35
|
+
<>
|
|
36
|
+
<TopSection>
|
|
37
|
+
<StringDetail term="Type" description={allergy.type?.toString()} />
|
|
38
|
+
<CodingListDetail term="Data Source(s)" codings={allergy.metadata.dataSources} />
|
|
39
|
+
</TopSection>
|
|
40
|
+
<Separator />
|
|
41
|
+
<CollapsibleDetailCollection viewType={viewType}>
|
|
42
|
+
<StringDetail term="Category" description={allergy?.category?.toString()} />
|
|
43
|
+
<CodeableConceptDetail term="Allergy" concept={allergy.code} />
|
|
44
|
+
<StringDetail term="Verification Status" description={allergy.verificationStatus?.toString()} />
|
|
45
|
+
<StringDetail term="Clinical Status" description={allergy.clinicalStatus?.toString()} />
|
|
46
|
+
{showDates ? <AllergyOnset term="Onset" onset={allergy.onSet} /> : <></>}
|
|
47
|
+
<ResourceReferenceDetail term="Asserter" resourceReference={allergy?.asserter} />
|
|
48
|
+
{showDates ? <DatetimeDetail term="Asserted Date" datetime={allergy?.assertedDate} /> : <></>}
|
|
49
|
+
<AnnotationListDetail term="Note(s)" notes={allergy.note} />
|
|
50
|
+
<DatetimeDetail term="Last Occurence" datetime={allergy?.lastOccurrence} />
|
|
51
|
+
<StringDetail term="Criticality" description={allergy.criticality?.toString()} />
|
|
52
|
+
<ResourceReferenceDetail term="Recorder" resourceReference={allergy?.recorder} />
|
|
53
|
+
</CollapsibleDetailCollection>
|
|
54
|
+
</>
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
interface Props extends CollapsibleDetailCollectionProps {
|
|
58
|
+
allergy: AllergyIntolerance
|
|
59
|
+
showDates?: boolean
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export default AllergyDetail
|