@ltht-react/flag-detail 2.0.190 → 2.0.192

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 (3) hide show
  1. package/README.md +15 -15
  2. package/package.json +7 -7
  3. package/src/index.tsx +137 -137
package/README.md CHANGED
@@ -1,15 +1,15 @@
1
- # FlagDetail
2
-
3
- <!-- STORY -->
4
-
5
- ### Import
6
-
7
- ```js
8
- import FlagDetail from '@ltht-react/flag-detail'
9
- ```
10
-
11
- ### Usage
12
-
13
- ```jsx
14
- <FlagDetail />
15
- ```
1
+ # FlagDetail
2
+
3
+ <!-- STORY -->
4
+
5
+ ### Import
6
+
7
+ ```js
8
+ import FlagDetail from '@ltht-react/flag-detail'
9
+ ```
10
+
11
+ ### Usage
12
+
13
+ ```jsx
14
+ <FlagDetail />
15
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ltht-react/flag-detail",
3
- "version": "2.0.190",
3
+ "version": "2.0.192",
4
4
  "description": "ltht-react clinical FlagDetail 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/button": "^2.0.190",
32
- "@ltht-react/styles": "^2.0.190",
33
- "@ltht-react/type-detail": "^2.0.190",
34
- "@ltht-react/types": "^2.0.190",
35
- "@ltht-react/utils": "^2.0.190",
31
+ "@ltht-react/button": "^2.0.192",
32
+ "@ltht-react/styles": "^2.0.192",
33
+ "@ltht-react/type-detail": "^2.0.192",
34
+ "@ltht-react/types": "^2.0.192",
35
+ "@ltht-react/utils": "^2.0.192",
36
36
  "react": "^18.2.0"
37
37
  },
38
- "gitHead": "1773d375fb0701642bad343c40dd946a7637f2e0"
38
+ "gitHead": "d97c241ba79c5e28edb4dec124e156cda6e9af66"
39
39
  }
package/src/index.tsx CHANGED
@@ -1,137 +1,137 @@
1
- import { FC } from 'react'
2
- import styled from '@emotion/styled'
3
- import { DetailViewType, Flag } from '@ltht-react/types'
4
- import { getStringExtension } from '@ltht-react/utils'
5
- import { Button, ButtonProps } from '@ltht-react/button'
6
- import {
7
- MOBILE_MAXIMUM_MEDIA_QUERY,
8
- SMALL_SCREEN_MAXIMUM_MEDIA_QUERY,
9
- TABLET_MINIMUM_MEDIA_QUERY,
10
- } from '@ltht-react/styles'
11
-
12
- import {
13
- CodeableConceptDetail,
14
- StringDetail,
15
- PeriodDetail,
16
- NarrativeDetail,
17
- ResourceReferenceDetail,
18
- CollapsibleDetailCollectionProps,
19
- CollapsibleDetailCollection,
20
- DatetimeDetail,
21
- } from '@ltht-react/type-detail'
22
-
23
- const StyledControlsContainer = styled.div`
24
- display: flex;
25
- margin: auto 10px auto 10px;
26
- flex-direction: column;
27
-
28
- ${MOBILE_MAXIMUM_MEDIA_QUERY} {
29
- margin: 10px 0 0 0;
30
- flex-flow: row wrap;
31
- }
32
-
33
- ${SMALL_SCREEN_MAXIMUM_MEDIA_QUERY} {
34
- margin: 10px 5px 0 0;
35
- flex-direction: column;
36
- }
37
- `
38
- const StyledButton = styled(Button)`
39
- margin: 2px 0 2px 0;
40
- font-size: 0.8em !important;
41
- padding: 1px 5px;
42
-
43
- ${MOBILE_MAXIMUM_MEDIA_QUERY} {
44
- margin: 2px 5px 2px 0;
45
- width: fit-content;
46
- }
47
-
48
- ${SMALL_SCREEN_MAXIMUM_MEDIA_QUERY} {
49
- margin: 2px 0 2px 0;
50
- width: 100%;
51
- max-width: 200px;
52
- }
53
- `
54
- const FullWidthSection = styled.div`
55
- padding: 0.5rem 0 !important;
56
- display: flex;
57
- width: 100%;
58
- justify-content: space-between;
59
- margin-bottom: 1rem;
60
- gap: 1rem;
61
-
62
- ${MOBILE_MAXIMUM_MEDIA_QUERY} {
63
- flex-direction: column;
64
- }
65
-
66
- & > dl {
67
- display: flex;
68
- flex-direction: column;
69
- }
70
- `
71
-
72
- const TopSection = styled(FullWidthSection)`
73
- ${TABLET_MINIMUM_MEDIA_QUERY} {
74
- & dl:last-of-type {
75
- margin-top: 0;
76
- text-align: right;
77
- }
78
- }
79
- `
80
- const AuthorSection = styled(FullWidthSection)`
81
- ${TABLET_MINIMUM_MEDIA_QUERY} {
82
- & > div:last-of-type > dl {
83
- text-align: right;
84
- }
85
- }
86
- `
87
-
88
- const FlagDetail: FC<Props> = ({ flag, controls = [], viewType = DetailViewType.Compact }) => {
89
- let buttons = <></>
90
- if (controls.length) {
91
- buttons = (
92
- <StyledControlsContainer>
93
- {controls.map((props, index) => (
94
- <StyledButton key={index} {...props} />
95
- ))}
96
- </StyledControlsContainer>
97
- )
98
- }
99
-
100
- return (
101
- <CollapsibleDetailCollection viewType={viewType}>
102
- <TopSection>
103
- <CodeableConceptDetail term="Code" concept={flag?.code} displayCode />
104
- <CodeableConceptDetail term="Name" concept={flag?.code} />
105
- </TopSection>
106
- <TopSection>
107
- <StringDetail term="Status" description={flag.status.toString()} />
108
- <CodeableConceptDetail term="Category" concept={flag?.category} />
109
- </TopSection>
110
- <PeriodDetail period={flag?.period} />
111
- <NarrativeDetail term="Description" narrative={flag?.text} />
112
- <StringDetail
113
- term="Advice"
114
- description={getStringExtension(flag?.extension, 'https://leedsth.nhs.uk/alert/advice')}
115
- parse={false}
116
- />
117
- <AuthorSection>
118
- <div>
119
- <ResourceReferenceDetail term="Author" resourceReference={flag?.author} />
120
- <DatetimeDetail term="Authored On" datetime={flag?.createdOn} />
121
- </div>
122
- <div>
123
- <ResourceReferenceDetail term="Amended By" resourceReference={flag?.amendedBy} showIfEmpty={false} />
124
- <DatetimeDetail term="Amended On" datetime={flag?.amendedOn} />
125
- </div>
126
- </AuthorSection>
127
- {buttons}
128
- </CollapsibleDetailCollection>
129
- )
130
- }
131
-
132
- interface Props extends CollapsibleDetailCollectionProps {
133
- flag: Flag
134
- controls?: ButtonProps[]
135
- }
136
-
137
- export default FlagDetail
1
+ import { FC } from 'react'
2
+ import styled from '@emotion/styled'
3
+ import { DetailViewType, Flag } from '@ltht-react/types'
4
+ import { getStringExtension } from '@ltht-react/utils'
5
+ import { Button, ButtonProps } from '@ltht-react/button'
6
+ import {
7
+ MOBILE_MAXIMUM_MEDIA_QUERY,
8
+ SMALL_SCREEN_MAXIMUM_MEDIA_QUERY,
9
+ TABLET_MINIMUM_MEDIA_QUERY,
10
+ } from '@ltht-react/styles'
11
+
12
+ import {
13
+ CodeableConceptDetail,
14
+ StringDetail,
15
+ PeriodDetail,
16
+ NarrativeDetail,
17
+ ResourceReferenceDetail,
18
+ CollapsibleDetailCollectionProps,
19
+ CollapsibleDetailCollection,
20
+ DatetimeDetail,
21
+ } from '@ltht-react/type-detail'
22
+
23
+ const StyledControlsContainer = styled.div`
24
+ display: flex;
25
+ margin: auto 10px auto 10px;
26
+ flex-direction: column;
27
+
28
+ ${MOBILE_MAXIMUM_MEDIA_QUERY} {
29
+ margin: 10px 0 0 0;
30
+ flex-flow: row wrap;
31
+ }
32
+
33
+ ${SMALL_SCREEN_MAXIMUM_MEDIA_QUERY} {
34
+ margin: 10px 5px 0 0;
35
+ flex-direction: column;
36
+ }
37
+ `
38
+ const StyledButton = styled(Button)`
39
+ margin: 2px 0 2px 0;
40
+ font-size: 0.8em !important;
41
+ padding: 1px 5px;
42
+
43
+ ${MOBILE_MAXIMUM_MEDIA_QUERY} {
44
+ margin: 2px 5px 2px 0;
45
+ width: fit-content;
46
+ }
47
+
48
+ ${SMALL_SCREEN_MAXIMUM_MEDIA_QUERY} {
49
+ margin: 2px 0 2px 0;
50
+ width: 100%;
51
+ max-width: 200px;
52
+ }
53
+ `
54
+ const FullWidthSection = styled.div`
55
+ padding: 0.5rem 0 !important;
56
+ display: flex;
57
+ width: 100%;
58
+ justify-content: space-between;
59
+ margin-bottom: 1rem;
60
+ gap: 1rem;
61
+
62
+ ${MOBILE_MAXIMUM_MEDIA_QUERY} {
63
+ flex-direction: column;
64
+ }
65
+
66
+ & > dl {
67
+ display: flex;
68
+ flex-direction: column;
69
+ }
70
+ `
71
+
72
+ const TopSection = styled(FullWidthSection)`
73
+ ${TABLET_MINIMUM_MEDIA_QUERY} {
74
+ & dl:last-of-type {
75
+ margin-top: 0;
76
+ text-align: right;
77
+ }
78
+ }
79
+ `
80
+ const AuthorSection = styled(FullWidthSection)`
81
+ ${TABLET_MINIMUM_MEDIA_QUERY} {
82
+ & > div:last-of-type > dl {
83
+ text-align: right;
84
+ }
85
+ }
86
+ `
87
+
88
+ const FlagDetail: FC<Props> = ({ flag, controls = [], viewType = DetailViewType.Compact }) => {
89
+ let buttons = <></>
90
+ if (controls.length) {
91
+ buttons = (
92
+ <StyledControlsContainer>
93
+ {controls.map((props, index) => (
94
+ <StyledButton key={index} {...props} />
95
+ ))}
96
+ </StyledControlsContainer>
97
+ )
98
+ }
99
+
100
+ return (
101
+ <CollapsibleDetailCollection viewType={viewType}>
102
+ <TopSection>
103
+ <CodeableConceptDetail term="Code" concept={flag?.code} displayCode />
104
+ <CodeableConceptDetail term="Name" concept={flag?.code} />
105
+ </TopSection>
106
+ <TopSection>
107
+ <StringDetail term="Status" description={flag.status.toString()} />
108
+ <CodeableConceptDetail term="Category" concept={flag?.category} />
109
+ </TopSection>
110
+ <PeriodDetail period={flag?.period} />
111
+ <NarrativeDetail term="Description" narrative={flag?.text} />
112
+ <StringDetail
113
+ term="Advice"
114
+ description={getStringExtension(flag?.extension, 'https://leedsth.nhs.uk/alert/advice')}
115
+ parse={false}
116
+ />
117
+ <AuthorSection>
118
+ <div>
119
+ <ResourceReferenceDetail term="Author" resourceReference={flag?.author} />
120
+ <DatetimeDetail term="Authored On" datetime={flag?.createdOn} />
121
+ </div>
122
+ <div>
123
+ <ResourceReferenceDetail term="Amended By" resourceReference={flag?.amendedBy} showIfEmpty={false} />
124
+ <DatetimeDetail term="Amended On" datetime={flag?.amendedOn} />
125
+ </div>
126
+ </AuthorSection>
127
+ {buttons}
128
+ </CollapsibleDetailCollection>
129
+ )
130
+ }
131
+
132
+ interface Props extends CollapsibleDetailCollectionProps {
133
+ flag: Flag
134
+ controls?: ButtonProps[]
135
+ }
136
+
137
+ export default FlagDetail