@ltht-react/allergy-summary 2.0.193 → 2.0.197

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 CHANGED
@@ -1,19 +1,19 @@
1
- # Allergy Summary
2
-
3
- ### Import
4
-
5
- ```js
6
- import AllergySummary from '@ltht-react/allergy-summary'
7
- ```
8
-
9
- ### Usage
10
-
11
- ```jsx
12
- <AllergySummary allergy={allergy} />
13
- ```
14
-
15
- ### Properties
16
-
17
- | Prop | Required | Default | Type | Description |
18
- | :-------- | :------- | :------ | :----------------- | :----------------- |
19
- | `allergy` | Yes | | AllergyIntolerance | Allergy to display |
1
+ # Allergy Summary
2
+
3
+ ### Import
4
+
5
+ ```js
6
+ import AllergySummary from '@ltht-react/allergy-summary'
7
+ ```
8
+
9
+ ### Usage
10
+
11
+ ```jsx
12
+ <AllergySummary allergy={allergy} />
13
+ ```
14
+
15
+ ### Properties
16
+
17
+ | Prop | Required | Default | Type | Description |
18
+ | :-------- | :------- | :------ | :----------------- | :----------------- |
19
+ | `allergy` | Yes | | AllergyIntolerance | Allergy to display |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ltht-react/allergy-summary",
3
- "version": "2.0.193",
3
+ "version": "2.0.197",
4
4
  "description": "> TODO: description",
5
5
  "author": "Jonny Smith <jonny.asmith@gmail.com>",
6
6
  "homepage": "",
@@ -25,13 +25,13 @@
25
25
  "dependencies": {
26
26
  "@emotion/react": "^11.0.0",
27
27
  "@emotion/styled": "^11.0.0",
28
- "@ltht-react/icon": "^2.0.193",
29
- "@ltht-react/list": "^2.0.193",
30
- "@ltht-react/styles": "^2.0.193",
31
- "@ltht-react/type-summary": "^2.0.193",
32
- "@ltht-react/types": "^2.0.193",
33
- "@ltht-react/utils": "^2.0.193",
28
+ "@ltht-react/icon": "^2.0.197",
29
+ "@ltht-react/list": "^2.0.197",
30
+ "@ltht-react/styles": "^2.0.197",
31
+ "@ltht-react/type-summary": "^2.0.197",
32
+ "@ltht-react/types": "^2.0.197",
33
+ "@ltht-react/utils": "^2.0.197",
34
34
  "react": "^18.2.0"
35
35
  },
36
- "gitHead": "ce3fd03cc65353e177ca647dbb2b285a021ca387"
36
+ "gitHead": "4a6b00c93b6516bf271fc09c9bcc252cc0f13ef4"
37
37
  }
@@ -1,33 +1,33 @@
1
- import { FC, HTMLAttributes } from 'react'
2
- import styled from '@emotion/styled'
3
-
4
- import { TEXT_COLOURS } from '@ltht-react/styles'
5
- import { AllergyIntolerance } from '@ltht-react/types'
6
- import { codeableConceptCodeSummary, allergyIntoleranceCategoryCodeDisplaySummary, titleCase } from '@ltht-react/utils'
7
-
8
- const StyledAllergyDescription = 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 AllergyDescription: FC<Props> = ({ allergy, ...rest }) => {
16
- const values = []
17
-
18
- const codeSummary = codeableConceptCodeSummary(allergy.code)
19
- if (codeSummary && codeSummary.length > 0) values.push(codeSummary)
20
-
21
- const categorySummary = allergy.category && allergyIntoleranceCategoryCodeDisplaySummary(allergy.category)
22
- if (categorySummary && categorySummary.length > 0) values.push(categorySummary)
23
-
24
- if (allergy.type) values.push(titleCase(allergy.type))
25
-
26
- return <StyledAllergyDescription {...rest}>{values.join(' - ')}</StyledAllergyDescription>
27
- }
28
-
29
- interface Props extends HTMLAttributes<HTMLDivElement> {
30
- allergy: AllergyIntolerance
31
- }
32
-
33
- export default AllergyDescription
1
+ import { FC, HTMLAttributes } from 'react'
2
+ import styled from '@emotion/styled'
3
+
4
+ import { TEXT_COLOURS } from '@ltht-react/styles'
5
+ import { AllergyIntolerance } from '@ltht-react/types'
6
+ import { codeableConceptCodeSummary, allergyIntoleranceCategoryCodeDisplaySummary, titleCase } from '@ltht-react/utils'
7
+
8
+ const StyledAllergyDescription = 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 AllergyDescription: FC<Props> = ({ allergy, ...rest }) => {
16
+ const values = []
17
+
18
+ const codeSummary = codeableConceptCodeSummary(allergy.code)
19
+ if (codeSummary && codeSummary.length > 0) values.push(codeSummary)
20
+
21
+ const categorySummary = allergy.category && allergyIntoleranceCategoryCodeDisplaySummary(allergy.category)
22
+ if (categorySummary && categorySummary.length > 0) values.push(categorySummary)
23
+
24
+ if (allergy.type) values.push(titleCase(allergy.type))
25
+
26
+ return <StyledAllergyDescription {...rest}>{values.join(' - ')}</StyledAllergyDescription>
27
+ }
28
+
29
+ interface Props extends HTMLAttributes<HTMLDivElement> {
30
+ allergy: AllergyIntolerance
31
+ }
32
+
33
+ export default AllergyDescription
@@ -1,26 +1,26 @@
1
- import { FC } from 'react'
2
- import styled from '@emotion/styled'
3
- import Icon from '@ltht-react/icon'
4
- import { AllergyIntoleranceCriticalityCode, Maybe } from '@ltht-react/types'
5
-
6
- const StyledExclamationIcon = styled(Icon)`
7
- padding-right: 10px;
8
- `
9
-
10
- const AllergyIcon: FC<Props> = ({ criticalityCode }) => {
11
- if (criticalityCode === AllergyIntoleranceCriticalityCode.High) {
12
- return <StyledExclamationIcon type="exclamation" color="red" size="medium" />
13
- }
14
-
15
- if (criticalityCode && criticalityCode === AllergyIntoleranceCriticalityCode.Low) {
16
- return <StyledExclamationIcon type="exclamation" color="amber" size="medium" />
17
- }
18
-
19
- return null
20
- }
21
-
22
- interface Props {
23
- criticalityCode?: Maybe<AllergyIntoleranceCriticalityCode>
24
- }
25
-
26
- export default AllergyIcon
1
+ import { FC } from 'react'
2
+ import styled from '@emotion/styled'
3
+ import Icon from '@ltht-react/icon'
4
+ import { AllergyIntoleranceCriticalityCode, Maybe } from '@ltht-react/types'
5
+
6
+ const StyledExclamationIcon = styled(Icon)`
7
+ padding-right: 10px;
8
+ `
9
+
10
+ const AllergyIcon: FC<Props> = ({ criticalityCode }) => {
11
+ if (criticalityCode === AllergyIntoleranceCriticalityCode.High) {
12
+ return <StyledExclamationIcon type="exclamation" color="red" size="medium" />
13
+ }
14
+
15
+ if (criticalityCode && criticalityCode === AllergyIntoleranceCriticalityCode.Low) {
16
+ return <StyledExclamationIcon type="exclamation" color="amber" size="medium" />
17
+ }
18
+
19
+ return null
20
+ }
21
+
22
+ interface Props {
23
+ criticalityCode?: Maybe<AllergyIntoleranceCriticalityCode>
24
+ }
25
+
26
+ export default AllergyIcon
@@ -1,28 +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 { AllergyIntolerance } from '@ltht-react/types'
6
- import { titleCase } from '@ltht-react/utils'
7
-
8
- const StyledAllergyStatus = 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 AllergyStatus: FC<Props> = ({ allergy, ...rest }) => {
16
- const values = []
17
-
18
- if (allergy.clinicalStatus) values.push(titleCase(allergy.clinicalStatus))
19
- if (allergy.verificationStatus) values.push(titleCase(allergy.verificationStatus))
20
-
21
- return <StyledAllergyStatus {...rest}>{values.join(' - ')}</StyledAllergyStatus>
22
- }
23
-
24
- interface Props extends HTMLAttributes<HTMLDivElement> {
25
- allergy: AllergyIntolerance
26
- }
27
-
28
- export default AllergyStatus
1
+ import { FC, HTMLAttributes } from 'react'
2
+ import styled from '@emotion/styled'
3
+
4
+ import { TEXT_COLOURS } from '@ltht-react/styles'
5
+ import { AllergyIntolerance } from '@ltht-react/types'
6
+ import { titleCase } from '@ltht-react/utils'
7
+
8
+ const StyledAllergyStatus = 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 AllergyStatus: FC<Props> = ({ allergy, ...rest }) => {
16
+ const values = []
17
+
18
+ if (allergy.clinicalStatus) values.push(titleCase(allergy.clinicalStatus))
19
+ if (allergy.verificationStatus) values.push(titleCase(allergy.verificationStatus))
20
+
21
+ return <StyledAllergyStatus {...rest}>{values.join(' - ')}</StyledAllergyStatus>
22
+ }
23
+
24
+ interface Props extends HTMLAttributes<HTMLDivElement> {
25
+ allergy: AllergyIntolerance
26
+ }
27
+
28
+ export default AllergyStatus
@@ -1,21 +1,21 @@
1
- import { FC, HTMLAttributes } from 'react'
2
- import styled from '@emotion/styled'
3
-
4
- import { TEXT_COLOURS } from '@ltht-react/styles'
5
- import { AllergyIntolerance } from '@ltht-react/types'
6
- import { codeableConceptDisplaySummary } from '@ltht-react/utils'
7
-
8
- const StyledAllergyTitle = styled.div`
9
- color: ${TEXT_COLOURS.PRIMARY};
10
- text-align: left;
11
- `
12
-
13
- const AllergyTitle: FC<Props> = ({ allergy, ...rest }) => (
14
- <StyledAllergyTitle {...rest}>{codeableConceptDisplaySummary(allergy.code)}</StyledAllergyTitle>
15
- )
16
-
17
- interface Props extends HTMLAttributes<HTMLDivElement> {
18
- allergy: AllergyIntolerance
19
- }
20
-
21
- export default AllergyTitle
1
+ import { FC, HTMLAttributes } from 'react'
2
+ import styled from '@emotion/styled'
3
+
4
+ import { TEXT_COLOURS } from '@ltht-react/styles'
5
+ import { AllergyIntolerance } from '@ltht-react/types'
6
+ import { codeableConceptDisplaySummary } from '@ltht-react/utils'
7
+
8
+ const StyledAllergyTitle = styled.div`
9
+ color: ${TEXT_COLOURS.PRIMARY};
10
+ text-align: left;
11
+ `
12
+
13
+ const AllergyTitle: FC<Props> = ({ allergy, ...rest }) => (
14
+ <StyledAllergyTitle {...rest}>{codeableConceptDisplaySummary(allergy.code)}</StyledAllergyTitle>
15
+ )
16
+
17
+ interface Props extends HTMLAttributes<HTMLDivElement> {
18
+ allergy: AllergyIntolerance
19
+ }
20
+
21
+ export default AllergyTitle
package/src/index.tsx CHANGED
@@ -1,3 +1,3 @@
1
- import AllergySummary from './organisms/allergy-summary'
2
-
3
- export default AllergySummary
1
+ import AllergySummary from './organisms/allergy-summary'
2
+
3
+ export default AllergySummary
@@ -1,30 +1,30 @@
1
- import { FC } from 'react'
2
- import styled from '@emotion/styled'
3
-
4
- import { AllergyIntolerance } from '@ltht-react/types'
5
- import { DateSummary, RedactedDescription } from '@ltht-react/type-summary'
6
-
7
- const StyledRedactedDescription = styled.div`
8
- flex-grow: 1;
9
- text-align: left;
10
- `
11
-
12
- const StyledDateSummary = styled.div`
13
- text-align: right;
14
- `
15
-
16
- const AllergyRedacted: FC<Props> = ({ allergy, showDates }) => (
17
- <>
18
- <StyledRedactedDescription>
19
- <RedactedDescription />
20
- </StyledRedactedDescription>
21
- <StyledDateSummary>{showDates && <DateSummary datetime={allergy?.assertedDate} />}</StyledDateSummary>
22
- </>
23
- )
24
-
25
- interface Props {
26
- allergy?: AllergyIntolerance | null
27
- showDates?: boolean
28
- }
29
-
30
- export default AllergyRedacted
1
+ import { FC } from 'react'
2
+ import styled from '@emotion/styled'
3
+
4
+ import { AllergyIntolerance } from '@ltht-react/types'
5
+ import { DateSummary, RedactedDescription } from '@ltht-react/type-summary'
6
+
7
+ const StyledRedactedDescription = styled.div`
8
+ flex-grow: 1;
9
+ text-align: left;
10
+ `
11
+
12
+ const StyledDateSummary = styled.div`
13
+ text-align: right;
14
+ `
15
+
16
+ const AllergyRedacted: FC<Props> = ({ allergy, showDates }) => (
17
+ <>
18
+ <StyledRedactedDescription>
19
+ <RedactedDescription />
20
+ </StyledRedactedDescription>
21
+ <StyledDateSummary>{showDates && <DateSummary datetime={allergy?.assertedDate} />}</StyledDateSummary>
22
+ </>
23
+ )
24
+
25
+ interface Props {
26
+ allergy?: AllergyIntolerance | null
27
+ showDates?: boolean
28
+ }
29
+
30
+ export default AllergyRedacted
@@ -1,68 +1,68 @@
1
- import { FC, HTMLAttributes } from 'react'
2
- import Styled from '@emotion/styled'
3
-
4
- import { AllergyIntolerance, AllergyIntoleranceCriticalityCode } from '@ltht-react/types'
5
- import { DateSummary } from '@ltht-react/type-summary'
6
-
7
- import Title from '../atoms/allergy-title'
8
- import Description from '../atoms/allergy-description'
9
- import Status from '../atoms/allergy-status'
10
- import Icon from '../atoms/allergy-icon'
11
- import Redacted from '../molecules/allergy-redacted'
12
-
13
- const StyledSummary = Styled.div`
14
- display: flex;
15
- justify-content: center;
16
- `
17
-
18
- const StyledIcon = Styled.div`
19
- min-width: 1rem;
20
- `
21
-
22
- const StyledDescription = Styled.div`
23
- flex-grow: 1;
24
- `
25
-
26
- const StyledDate = Styled.div`
27
- text-align: right;
28
- `
29
-
30
- const AllergySummary: FC<Props> = ({ allergy, showDates = true, ...rest }) => {
31
- const showIcon =
32
- allergy.criticality === AllergyIntoleranceCriticalityCode.High ||
33
- allergy.criticality === AllergyIntoleranceCriticalityCode.Low
34
-
35
- if (allergy.metadata.isRedacted) {
36
- return (
37
- <StyledSummary {...rest}>
38
- <Redacted allergy={allergy} showDates={showDates} />
39
- </StyledSummary>
40
- )
41
- }
42
-
43
- return (
44
- <StyledSummary {...rest}>
45
- {showIcon && (
46
- <StyledIcon>
47
- <Icon criticalityCode={allergy.criticality} />
48
- </StyledIcon>
49
- )}
50
- <StyledDescription>
51
- <Title allergy={allergy} />
52
- <Description allergy={allergy} />
53
- </StyledDescription>
54
- <StyledDate>
55
- {showDates && <DateSummary datetime={allergy.assertedDate} />}
56
- <Status allergy={allergy} />
57
- </StyledDate>
58
- </StyledSummary>
59
- )
60
- }
61
-
62
- interface Props extends HTMLAttributes<HTMLDivElement> {
63
- allergy: AllergyIntolerance
64
- showDates?: boolean
65
- enteredInError?: boolean | undefined
66
- }
67
-
68
- export default AllergySummary
1
+ import { FC, HTMLAttributes } from 'react'
2
+ import Styled from '@emotion/styled'
3
+
4
+ import { AllergyIntolerance, AllergyIntoleranceCriticalityCode } from '@ltht-react/types'
5
+ import { DateSummary } from '@ltht-react/type-summary'
6
+
7
+ import Title from '../atoms/allergy-title'
8
+ import Description from '../atoms/allergy-description'
9
+ import Status from '../atoms/allergy-status'
10
+ import Icon from '../atoms/allergy-icon'
11
+ import Redacted from '../molecules/allergy-redacted'
12
+
13
+ const StyledSummary = Styled.div`
14
+ display: flex;
15
+ justify-content: center;
16
+ `
17
+
18
+ const StyledIcon = Styled.div`
19
+ min-width: 1rem;
20
+ `
21
+
22
+ const StyledDescription = Styled.div`
23
+ flex-grow: 1;
24
+ `
25
+
26
+ const StyledDate = Styled.div`
27
+ text-align: right;
28
+ `
29
+
30
+ const AllergySummary: FC<Props> = ({ allergy, showDates = true, ...rest }) => {
31
+ const showIcon =
32
+ allergy.criticality === AllergyIntoleranceCriticalityCode.High ||
33
+ allergy.criticality === AllergyIntoleranceCriticalityCode.Low
34
+
35
+ if (allergy.metadata.isRedacted) {
36
+ return (
37
+ <StyledSummary {...rest}>
38
+ <Redacted allergy={allergy} showDates={showDates} />
39
+ </StyledSummary>
40
+ )
41
+ }
42
+
43
+ return (
44
+ <StyledSummary {...rest}>
45
+ {showIcon && (
46
+ <StyledIcon>
47
+ <Icon criticalityCode={allergy.criticality} />
48
+ </StyledIcon>
49
+ )}
50
+ <StyledDescription>
51
+ <Title allergy={allergy} />
52
+ <Description allergy={allergy} />
53
+ </StyledDescription>
54
+ <StyledDate>
55
+ {showDates && <DateSummary datetime={allergy.assertedDate} />}
56
+ <Status allergy={allergy} />
57
+ </StyledDate>
58
+ </StyledSummary>
59
+ )
60
+ }
61
+
62
+ interface Props extends HTMLAttributes<HTMLDivElement> {
63
+ allergy: AllergyIntolerance
64
+ showDates?: boolean
65
+ enteredInError?: boolean | undefined
66
+ }
67
+
68
+ export default AllergySummary