@ltht-react/care-plan-summary 2.0.3 → 2.0.5
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ltht-react/care-plan-summary",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.5",
|
|
4
4
|
"description": "ltht-react clinical CarePlanSummary component.",
|
|
5
5
|
"author": "LTHT",
|
|
6
6
|
"homepage": "",
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"typings": "lib/index.d.ts",
|
|
10
10
|
"files": [
|
|
11
|
-
"lib"
|
|
11
|
+
"lib",
|
|
12
|
+
"src"
|
|
12
13
|
],
|
|
13
14
|
"directories": {
|
|
14
15
|
"lib": "lib"
|
|
@@ -23,12 +24,12 @@
|
|
|
23
24
|
"dependencies": {
|
|
24
25
|
"@emotion/react": "^11.0.0",
|
|
25
26
|
"@emotion/styled": "^11.0.0",
|
|
26
|
-
"@ltht-react/list": "^2.0.
|
|
27
|
-
"@ltht-react/styles": "^2.0.
|
|
28
|
-
"@ltht-react/type-summary": "^2.0.
|
|
29
|
-
"@ltht-react/types": "^2.0.
|
|
30
|
-
"@ltht-react/utils": "^2.0.
|
|
27
|
+
"@ltht-react/list": "^2.0.5",
|
|
28
|
+
"@ltht-react/styles": "^2.0.5",
|
|
29
|
+
"@ltht-react/type-summary": "^2.0.5",
|
|
30
|
+
"@ltht-react/types": "^2.0.5",
|
|
31
|
+
"@ltht-react/utils": "^2.0.5",
|
|
31
32
|
"react": "^18.2.0"
|
|
32
33
|
},
|
|
33
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "5d14d78829abb529afe382226925f4793a2c8257"
|
|
34
35
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { FC, HTMLAttributes } from 'react'
|
|
2
|
+
import styled from '@emotion/styled'
|
|
3
|
+
|
|
4
|
+
import { TEXT_COLOURS } from '@ltht-react/styles'
|
|
5
|
+
import { CarePlan } from '@ltht-react/types'
|
|
6
|
+
import { resourceReferenceDisplaySummary } from '@ltht-react/utils'
|
|
7
|
+
|
|
8
|
+
const StyledCarePlanDescription = styled.div`
|
|
9
|
+
color: ${TEXT_COLOURS.SECONDARY.VALUE};
|
|
10
|
+
text-align: left;
|
|
11
|
+
font-size: smaller;
|
|
12
|
+
padding-top: 0.25rem;
|
|
13
|
+
`
|
|
14
|
+
|
|
15
|
+
const CarePlanDescription: FC<Props> = ({ carePlan, ...rest }) => {
|
|
16
|
+
const values = []
|
|
17
|
+
|
|
18
|
+
const author = carePlan.author && resourceReferenceDisplaySummary(carePlan.author)
|
|
19
|
+
if (author && author.length > 0) values.push(author)
|
|
20
|
+
|
|
21
|
+
const careTeam = carePlan.careTeam && resourceReferenceDisplaySummary(carePlan.careTeam)
|
|
22
|
+
if (careTeam && careTeam.length > 0) values.push(careTeam)
|
|
23
|
+
|
|
24
|
+
return <StyledCarePlanDescription {...rest}>{values.join(' - ')}</StyledCarePlanDescription>
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
28
|
+
carePlan: CarePlan
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export default CarePlanDescription
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { FC, HTMLAttributes } from 'react'
|
|
2
|
+
import styled from '@emotion/styled'
|
|
3
|
+
|
|
4
|
+
import { TEXT_COLOURS } from '@ltht-react/styles'
|
|
5
|
+
import { CarePlan } from '@ltht-react/types'
|
|
6
|
+
import { titleCase } from '@ltht-react/utils'
|
|
7
|
+
|
|
8
|
+
const StyledCarePlanStatus = styled.div`
|
|
9
|
+
color: ${TEXT_COLOURS.SECONDARY.VALUE};
|
|
10
|
+
text-align: right;
|
|
11
|
+
font-size: smaller;
|
|
12
|
+
padding-top: 0.25rem;
|
|
13
|
+
`
|
|
14
|
+
|
|
15
|
+
const CarePlanStatus: FC<Props> = ({ carePlan, ...rest }) => {
|
|
16
|
+
const values = []
|
|
17
|
+
|
|
18
|
+
if (carePlan.intent) values.push(titleCase(carePlan.intent))
|
|
19
|
+
if (carePlan.status) values.push(titleCase(carePlan.status))
|
|
20
|
+
|
|
21
|
+
return <StyledCarePlanStatus {...rest}>{values.join(' - ')}</StyledCarePlanStatus>
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
25
|
+
carePlan: CarePlan
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default CarePlanStatus
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FC, HTMLAttributes } from 'react'
|
|
2
|
+
import styled from '@emotion/styled'
|
|
3
|
+
|
|
4
|
+
import { TEXT_COLOURS } from '@ltht-react/styles'
|
|
5
|
+
import { CarePlan } from '@ltht-react/types'
|
|
6
|
+
|
|
7
|
+
const StyledCarePlanTitle = styled.div`
|
|
8
|
+
color: ${TEXT_COLOURS.PRIMARY};
|
|
9
|
+
text-align: left;
|
|
10
|
+
`
|
|
11
|
+
|
|
12
|
+
const CarePlanTitle: FC<Props> = ({ carePlan, ...rest }) => (
|
|
13
|
+
<StyledCarePlanTitle {...rest}>{carePlan.title}</StyledCarePlanTitle>
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
17
|
+
carePlan: CarePlan
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default CarePlanTitle
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { FC } from 'react'
|
|
2
|
+
import styled from '@emotion/styled'
|
|
3
|
+
|
|
4
|
+
import { CarePlan } from '@ltht-react/types'
|
|
5
|
+
import { RedactedDescription, PeriodSummary } from '@ltht-react/type-summary'
|
|
6
|
+
|
|
7
|
+
const StyledRedactedDescription = styled.div`
|
|
8
|
+
flex-grow: 1;
|
|
9
|
+
text-align: left;
|
|
10
|
+
`
|
|
11
|
+
|
|
12
|
+
const StyledPeriodSummary = styled.div`
|
|
13
|
+
text-align: right;
|
|
14
|
+
`
|
|
15
|
+
|
|
16
|
+
const CarePlanRedacted: FC<Props> = ({ carePlan }) => (
|
|
17
|
+
<>
|
|
18
|
+
<StyledRedactedDescription>
|
|
19
|
+
<RedactedDescription />
|
|
20
|
+
</StyledRedactedDescription>
|
|
21
|
+
<StyledPeriodSummary>
|
|
22
|
+
<PeriodSummary period={carePlan.period} />
|
|
23
|
+
</StyledPeriodSummary>
|
|
24
|
+
</>
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
interface Props {
|
|
28
|
+
carePlan: CarePlan
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export default CarePlanRedacted
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { FC, HTMLAttributes } from 'react'
|
|
2
|
+
import styled from '@emotion/styled'
|
|
3
|
+
|
|
4
|
+
import { CarePlan } from '@ltht-react/types'
|
|
5
|
+
import { PeriodSummary } from '@ltht-react/type-summary'
|
|
6
|
+
|
|
7
|
+
import Description from '../atoms/care-plan-description'
|
|
8
|
+
import Status from '../atoms/care-plan-status'
|
|
9
|
+
import Title from '../atoms/care-plan-title'
|
|
10
|
+
import Redacted from '../molecules/care-plan-redacted'
|
|
11
|
+
|
|
12
|
+
const StyledSummary = styled.div`
|
|
13
|
+
display: flex;
|
|
14
|
+
justify-content: center;
|
|
15
|
+
`
|
|
16
|
+
const StyledDescription = styled.div`
|
|
17
|
+
flex-grow: 1;
|
|
18
|
+
`
|
|
19
|
+
const StyledDate = styled.div`
|
|
20
|
+
text-align: right;
|
|
21
|
+
`
|
|
22
|
+
|
|
23
|
+
const CarePlanSummary: FC<Props> = ({ carePlan, ...rest }) => {
|
|
24
|
+
if (carePlan.metadata.isRedacted) {
|
|
25
|
+
return (
|
|
26
|
+
<StyledSummary {...rest}>
|
|
27
|
+
<Redacted carePlan={carePlan} />
|
|
28
|
+
</StyledSummary>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<StyledSummary {...rest}>
|
|
34
|
+
<StyledDescription>
|
|
35
|
+
<Title carePlan={carePlan} />
|
|
36
|
+
<Description carePlan={carePlan} />
|
|
37
|
+
</StyledDescription>
|
|
38
|
+
<StyledDate>
|
|
39
|
+
<PeriodSummary period={carePlan.period} />
|
|
40
|
+
<Status carePlan={carePlan} />
|
|
41
|
+
</StyledDate>
|
|
42
|
+
</StyledSummary>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
47
|
+
carePlan: CarePlan
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export default CarePlanSummary
|