@ltht-react/flag-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,21 +1,21 @@
1
- # Flag Summary
2
-
3
- ### Import
4
-
5
- ```js
6
- import FlagSummary from '@ltht-react/flag-summary'
7
- ```
8
-
9
- ### Usage
10
-
11
- ```jsx
12
- <FlagSummary title="Alerts" flags={flags} clickHandler={handleClick} />
13
- ```
14
-
15
- ### Properties
16
-
17
- | Prop | Required | Default | Type | Description |
18
- | :------------- | :------- | :----------- | :------- | :------------------------------------------------------- |
19
- | `title` | No | Flag Summary | string | Header text |
20
- | `flags` | Yes | | Flag[] | Array of flags to display |
21
- | `clickHandler` | No | undefined | Function | Callback click handler containing the selected flag item |
1
+ # Flag Summary
2
+
3
+ ### Import
4
+
5
+ ```js
6
+ import FlagSummary from '@ltht-react/flag-summary'
7
+ ```
8
+
9
+ ### Usage
10
+
11
+ ```jsx
12
+ <FlagSummary title="Alerts" flags={flags} clickHandler={handleClick} />
13
+ ```
14
+
15
+ ### Properties
16
+
17
+ | Prop | Required | Default | Type | Description |
18
+ | :------------- | :------- | :----------- | :------- | :------------------------------------------------------- |
19
+ | `title` | No | Flag Summary | string | Header text |
20
+ | `flags` | Yes | | Flag[] | Array of flags to display |
21
+ | `clickHandler` | No | undefined | Function | Callback click handler containing the selected flag item |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ltht-react/flag-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,30 +1,30 @@
1
- import { HTMLAttributes, FC } from 'react'
2
- import styled from '@emotion/styled'
3
- import { TEXT_COLOURS } from '@ltht-react/styles'
4
- import { Flag } from '@ltht-react/types'
5
- import { codeableConceptDisplaySummary, codeableConceptCodeSummary } from '@ltht-react/utils'
6
-
7
- const StyledFlagDescription = styled.div`
8
- color: ${TEXT_COLOURS.SECONDARY.VALUE};
9
- text-align: left;
10
- font-size: smaller;
11
- padding-top: 0.25rem;
12
- `
13
-
14
- const FlagDescription: FC<Props> = ({ flag: { code, category }, ...rest }) => {
15
- const values = []
16
-
17
- const codeSummary = codeableConceptCodeSummary(code)
18
- if (codeSummary && codeSummary.length > 0) values.push(codeSummary)
19
-
20
- const categorySummary = category && codeableConceptDisplaySummary(category)
21
- if (categorySummary && categorySummary.length > 0) values.push(categorySummary)
22
-
23
- return <StyledFlagDescription {...rest}>{values.join(' - ')}</StyledFlagDescription>
24
- }
25
-
26
- interface Props extends HTMLAttributes<HTMLDivElement> {
27
- flag: Flag
28
- }
29
-
30
- export default FlagDescription
1
+ import { HTMLAttributes, FC } from 'react'
2
+ import styled from '@emotion/styled'
3
+ import { TEXT_COLOURS } from '@ltht-react/styles'
4
+ import { Flag } from '@ltht-react/types'
5
+ import { codeableConceptDisplaySummary, codeableConceptCodeSummary } from '@ltht-react/utils'
6
+
7
+ const StyledFlagDescription = styled.div`
8
+ color: ${TEXT_COLOURS.SECONDARY.VALUE};
9
+ text-align: left;
10
+ font-size: smaller;
11
+ padding-top: 0.25rem;
12
+ `
13
+
14
+ const FlagDescription: FC<Props> = ({ flag: { code, category }, ...rest }) => {
15
+ const values = []
16
+
17
+ const codeSummary = codeableConceptCodeSummary(code)
18
+ if (codeSummary && codeSummary.length > 0) values.push(codeSummary)
19
+
20
+ const categorySummary = category && codeableConceptDisplaySummary(category)
21
+ if (categorySummary && categorySummary.length > 0) values.push(categorySummary)
22
+
23
+ return <StyledFlagDescription {...rest}>{values.join(' - ')}</StyledFlagDescription>
24
+ }
25
+
26
+ interface Props extends HTMLAttributes<HTMLDivElement> {
27
+ flag: Flag
28
+ }
29
+
30
+ export default FlagDescription
@@ -1,28 +1,28 @@
1
- import { FC, HTMLAttributes } from 'react'
2
- import styled from '@emotion/styled'
3
- import Icon from '@ltht-react/icon'
4
- import { getStringExtension } from '@ltht-react/utils'
5
- import { Flag } from '@ltht-react/types'
6
-
7
- const StyledFlagIcon = styled.div`
8
- margin-bottom: 0px;
9
- `
10
-
11
- const FlagIcon: FC<Props> = ({ flag: { extension, ...rest } }) => {
12
- const ext = getStringExtension(extension, 'https://leedsth.nhs.uk/alert/priority')
13
- if (ext === 'High') {
14
- return (
15
- <StyledFlagIcon {...rest}>
16
- <Icon type="exclamation" color="red" size="medium" />
17
- </StyledFlagIcon>
18
- )
19
- }
20
-
21
- return <></>
22
- }
23
-
24
- interface Props extends HTMLAttributes<HTMLDivElement> {
25
- flag: Flag
26
- }
27
-
28
- export default FlagIcon
1
+ import { FC, HTMLAttributes } from 'react'
2
+ import styled from '@emotion/styled'
3
+ import Icon from '@ltht-react/icon'
4
+ import { getStringExtension } from '@ltht-react/utils'
5
+ import { Flag } from '@ltht-react/types'
6
+
7
+ const StyledFlagIcon = styled.div`
8
+ margin-bottom: 0px;
9
+ `
10
+
11
+ const FlagIcon: FC<Props> = ({ flag: { extension, ...rest } }) => {
12
+ const ext = getStringExtension(extension, 'https://leedsth.nhs.uk/alert/priority')
13
+ if (ext === 'High') {
14
+ return (
15
+ <StyledFlagIcon {...rest}>
16
+ <Icon type="exclamation" color="red" size="medium" />
17
+ </StyledFlagIcon>
18
+ )
19
+ }
20
+
21
+ return <></>
22
+ }
23
+
24
+ interface Props extends HTMLAttributes<HTMLDivElement> {
25
+ flag: Flag
26
+ }
27
+
28
+ export default FlagIcon
@@ -1,20 +1,20 @@
1
- import { HTMLAttributes, FC } from 'react'
2
- import styled from '@emotion/styled'
3
- import { TEXT_COLOURS } from '@ltht-react/styles'
4
- import { Flag } from '@ltht-react/types'
5
- import { metadataSourceSummaryText } from '@ltht-react/utils'
6
-
7
- const StyledFlagSource = styled.div`
8
- color: ${TEXT_COLOURS.SECONDARY};
9
- text-align: right;
10
- `
11
-
12
- const FlagSource: FC<Props> = ({ flag: { metadata }, ...rest }) => (
13
- <StyledFlagSource {...rest}>{metadataSourceSummaryText(metadata)}</StyledFlagSource>
14
- )
15
-
16
- interface Props extends HTMLAttributes<HTMLDivElement> {
17
- flag: Flag
18
- }
19
-
20
- export default FlagSource
1
+ import { HTMLAttributes, FC } from 'react'
2
+ import styled from '@emotion/styled'
3
+ import { TEXT_COLOURS } from '@ltht-react/styles'
4
+ import { Flag } from '@ltht-react/types'
5
+ import { metadataSourceSummaryText } from '@ltht-react/utils'
6
+
7
+ const StyledFlagSource = styled.div`
8
+ color: ${TEXT_COLOURS.SECONDARY};
9
+ text-align: right;
10
+ `
11
+
12
+ const FlagSource: FC<Props> = ({ flag: { metadata }, ...rest }) => (
13
+ <StyledFlagSource {...rest}>{metadataSourceSummaryText(metadata)}</StyledFlagSource>
14
+ )
15
+
16
+ interface Props extends HTMLAttributes<HTMLDivElement> {
17
+ flag: Flag
18
+ }
19
+
20
+ export default FlagSource
@@ -1,22 +1,22 @@
1
- import { HTMLAttributes, FC } from 'react'
2
- import styled from '@emotion/styled'
3
- import { TEXT_COLOURS } from '@ltht-react/styles'
4
- import { Flag } from '@ltht-react/types'
5
- import { titleCase } from '@ltht-react/utils'
6
-
7
- const StyledFlagStatus = styled.div`
8
- color: ${TEXT_COLOURS.SECONDARY.VALUE};
9
- text-align: right;
10
- font-size: smaller;
11
- padding-top: 0.25rem;
12
- `
13
-
14
- const FlagStatus: FC<Props> = ({ flag: { status }, ...rest }) => (
15
- <StyledFlagStatus {...rest}>{titleCase(status)}</StyledFlagStatus>
16
- )
17
-
18
- interface Props extends HTMLAttributes<HTMLDivElement> {
19
- flag: Flag
20
- }
21
-
22
- export default FlagStatus
1
+ import { HTMLAttributes, FC } from 'react'
2
+ import styled from '@emotion/styled'
3
+ import { TEXT_COLOURS } from '@ltht-react/styles'
4
+ import { Flag } from '@ltht-react/types'
5
+ import { titleCase } from '@ltht-react/utils'
6
+
7
+ const StyledFlagStatus = styled.div`
8
+ color: ${TEXT_COLOURS.SECONDARY.VALUE};
9
+ text-align: right;
10
+ font-size: smaller;
11
+ padding-top: 0.25rem;
12
+ `
13
+
14
+ const FlagStatus: FC<Props> = ({ flag: { status }, ...rest }) => (
15
+ <StyledFlagStatus {...rest}>{titleCase(status)}</StyledFlagStatus>
16
+ )
17
+
18
+ interface Props extends HTMLAttributes<HTMLDivElement> {
19
+ flag: Flag
20
+ }
21
+
22
+ export default FlagStatus
@@ -1,24 +1,24 @@
1
- import { HTMLAttributes, FC } from 'react'
2
- import styled from '@emotion/styled'
3
- import { TEXT_COLOURS } from '@ltht-react/styles'
4
- import { Flag } from '@ltht-react/types'
5
- import { NarrativeSummary } from '@ltht-react/type-summary'
6
-
7
- const StyledFlagText = styled.div`
8
- color: ${TEXT_COLOURS.SECONDARY.VALUE};
9
- text-align: left;
10
- font-size: smaller;
11
- padding-top: 0.25rem;
12
- `
13
-
14
- const FlagText: FC<Props> = ({ flag: { text }, ...rest }) => (
15
- <StyledFlagText {...rest}>
16
- <NarrativeSummary narrative={text} showIfEmpty={false} truncate />
17
- </StyledFlagText>
18
- )
19
-
20
- interface Props extends HTMLAttributes<HTMLDivElement> {
21
- flag: Flag
22
- }
23
-
24
- export default FlagText
1
+ import { HTMLAttributes, FC } from 'react'
2
+ import styled from '@emotion/styled'
3
+ import { TEXT_COLOURS } from '@ltht-react/styles'
4
+ import { Flag } from '@ltht-react/types'
5
+ import { NarrativeSummary } from '@ltht-react/type-summary'
6
+
7
+ const StyledFlagText = styled.div`
8
+ color: ${TEXT_COLOURS.SECONDARY.VALUE};
9
+ text-align: left;
10
+ font-size: smaller;
11
+ padding-top: 0.25rem;
12
+ `
13
+
14
+ const FlagText: FC<Props> = ({ flag: { text }, ...rest }) => (
15
+ <StyledFlagText {...rest}>
16
+ <NarrativeSummary narrative={text} showIfEmpty={false} truncate />
17
+ </StyledFlagText>
18
+ )
19
+
20
+ interface Props extends HTMLAttributes<HTMLDivElement> {
21
+ flag: Flag
22
+ }
23
+
24
+ export default FlagText
@@ -1,31 +1,31 @@
1
- import { HTMLAttributes, FC } from 'react'
2
- import styled from '@emotion/styled'
3
- import { TEXT_COLOURS } from '@ltht-react/styles'
4
- import { Flag } from '@ltht-react/types'
5
- import { codeableConceptDisplaySummary, getStringExtension } from '@ltht-react/utils'
6
-
7
- const StyledFlagTitle = styled.div<IStyledFlagTitleProps>`
8
- color: ${TEXT_COLOURS.PRIMARY};
9
- text-align: left;
10
- ${(props) =>
11
- props.priority === 'High' &&
12
- `
13
- padding-left:2px;
14
- color: ${TEXT_COLOURS.DANGER};
15
- `}
16
- `
17
-
18
- const FlagTitle: FC<Props> = ({ flag: { code, extension } }) => {
19
- const ext = getStringExtension(extension, 'https://leedsth.nhs.uk/alert/priority') ?? ''
20
- return <StyledFlagTitle priority={ext}>{codeableConceptDisplaySummary(code)}</StyledFlagTitle>
21
- }
22
-
23
- interface Props extends HTMLAttributes<HTMLDivElement> {
24
- flag: Flag
25
- }
26
-
27
- interface IStyledFlagTitleProps {
28
- priority: string
29
- }
30
-
31
- export default FlagTitle
1
+ import { HTMLAttributes, FC } from 'react'
2
+ import styled from '@emotion/styled'
3
+ import { TEXT_COLOURS } from '@ltht-react/styles'
4
+ import { Flag } from '@ltht-react/types'
5
+ import { codeableConceptDisplaySummary, getStringExtension } from '@ltht-react/utils'
6
+
7
+ const StyledFlagTitle = styled.div<IStyledFlagTitleProps>`
8
+ color: ${TEXT_COLOURS.PRIMARY};
9
+ text-align: left;
10
+ ${(props) =>
11
+ props.priority === 'High' &&
12
+ `
13
+ padding-left:2px;
14
+ color: ${TEXT_COLOURS.DANGER};
15
+ `}
16
+ `
17
+
18
+ const FlagTitle: FC<Props> = ({ flag: { code, extension } }) => {
19
+ const ext = getStringExtension(extension, 'https://leedsth.nhs.uk/alert/priority') ?? ''
20
+ return <StyledFlagTitle priority={ext}>{codeableConceptDisplaySummary(code)}</StyledFlagTitle>
21
+ }
22
+
23
+ interface Props extends HTMLAttributes<HTMLDivElement> {
24
+ flag: Flag
25
+ }
26
+
27
+ interface IStyledFlagTitleProps {
28
+ priority: string
29
+ }
30
+
31
+ export default FlagTitle
package/src/index.tsx CHANGED
@@ -1,3 +1,3 @@
1
- import FlagSummary from './organisms/flag-summary'
2
-
3
- export default FlagSummary
1
+ import FlagSummary from './organisms/flag-summary'
2
+
3
+ export default FlagSummary
@@ -1,22 +1,22 @@
1
- import { HTMLAttributes, FC } from 'react'
2
- import styled from '@emotion/styled'
3
- import { Flag } from '@ltht-react/types'
4
- import Icon from '../atoms/flag-icon'
5
- import Title from '../atoms/flag-title'
6
-
7
- const StyledFlagIdentifier = styled.div`
8
- flex-grow: 1;
9
- display: inline-flex;
10
- `
11
-
12
- const FlagIdentifier: FC<Props> = ({ flag, ...rest }) => (
13
- <StyledFlagIdentifier {...rest}>
14
- <Icon flag={flag} />
15
- <Title flag={flag} />
16
- </StyledFlagIdentifier>
17
- )
18
-
19
- interface Props extends HTMLAttributes<HTMLDivElement> {
20
- flag: Flag
21
- }
22
- export default FlagIdentifier
1
+ import { HTMLAttributes, FC } from 'react'
2
+ import styled from '@emotion/styled'
3
+ import { Flag } from '@ltht-react/types'
4
+ import Icon from '../atoms/flag-icon'
5
+ import Title from '../atoms/flag-title'
6
+
7
+ const StyledFlagIdentifier = styled.div`
8
+ flex-grow: 1;
9
+ display: inline-flex;
10
+ `
11
+
12
+ const FlagIdentifier: FC<Props> = ({ flag, ...rest }) => (
13
+ <StyledFlagIdentifier {...rest}>
14
+ <Icon flag={flag} />
15
+ <Title flag={flag} />
16
+ </StyledFlagIdentifier>
17
+ )
18
+
19
+ interface Props extends HTMLAttributes<HTMLDivElement> {
20
+ flag: Flag
21
+ }
22
+ export default FlagIdentifier
@@ -1,30 +1,30 @@
1
- import { FC } from 'react'
2
- import styled from '@emotion/styled'
3
- import { Flag } from '@ltht-react/types'
4
- import { RedactedDescription, PeriodSummary } from '@ltht-react/type-summary'
5
-
6
- const StyledRedactedDescription = styled.div`
7
- flex-grow: 1;
8
- text-align: left;
9
- `
10
-
11
- const StyledPeriodSummary = styled.div`
12
- text-align: right;
13
- `
14
-
15
- const FlagRedacted: FC<Props> = ({ flag: { period } }) => (
16
- <>
17
- <StyledRedactedDescription>
18
- <RedactedDescription />
19
- </StyledRedactedDescription>
20
- <StyledPeriodSummary>
21
- <PeriodSummary period={period} />
22
- </StyledPeriodSummary>
23
- </>
24
- )
25
-
26
- interface Props {
27
- flag: Flag
28
- }
29
-
30
- export default FlagRedacted
1
+ import { FC } from 'react'
2
+ import styled from '@emotion/styled'
3
+ import { Flag } from '@ltht-react/types'
4
+ import { RedactedDescription, PeriodSummary } from '@ltht-react/type-summary'
5
+
6
+ const StyledRedactedDescription = styled.div`
7
+ flex-grow: 1;
8
+ text-align: left;
9
+ `
10
+
11
+ const StyledPeriodSummary = styled.div`
12
+ text-align: right;
13
+ `
14
+
15
+ const FlagRedacted: FC<Props> = ({ flag: { period } }) => (
16
+ <>
17
+ <StyledRedactedDescription>
18
+ <RedactedDescription />
19
+ </StyledRedactedDescription>
20
+ <StyledPeriodSummary>
21
+ <PeriodSummary period={period} />
22
+ </StyledPeriodSummary>
23
+ </>
24
+ )
25
+
26
+ interface Props {
27
+ flag: Flag
28
+ }
29
+
30
+ export default FlagRedacted
@@ -1,49 +1,49 @@
1
- import { HTMLAttributes, FC } from 'react'
2
- import Styled from '@emotion/styled'
3
-
4
- import { Flag } from '@ltht-react/types'
5
- import { PeriodSummary } from '@ltht-react/type-summary'
6
-
7
- import Text from '../atoms/flag-text'
8
- import Identifier from '../molecules/flag-identifier'
9
- import Redacted from '../molecules/flag-redacted'
10
-
11
- const StyledSummary = Styled.div`
12
- display: flex;
13
- flex-wrap: wrap;
14
- justify-content: center;
15
- `
16
- const StyledDate = Styled.div`
17
- text-align: right;
18
- `
19
- const StyledText = Styled.div`
20
- flex-basis: 100%;
21
- `
22
-
23
- const FlagSummary: FC<Props> = ({ flag, ...rest }) => {
24
- if (flag.metadata.isRedacted) {
25
- return (
26
- <StyledSummary {...rest}>
27
- <Redacted flag={flag} />
28
- </StyledSummary>
29
- )
30
- }
31
-
32
- return (
33
- <StyledSummary {...rest}>
34
- <Identifier flag={flag} />
35
- <StyledDate>
36
- <PeriodSummary period={flag.period} />
37
- </StyledDate>
38
- <StyledText>
39
- <Text flag={flag} />
40
- </StyledText>
41
- </StyledSummary>
42
- )
43
- }
44
-
45
- interface Props extends HTMLAttributes<HTMLDivElement> {
46
- flag: Flag
47
- }
48
-
49
- export default FlagSummary
1
+ import { HTMLAttributes, FC } from 'react'
2
+ import Styled from '@emotion/styled'
3
+
4
+ import { Flag } from '@ltht-react/types'
5
+ import { PeriodSummary } from '@ltht-react/type-summary'
6
+
7
+ import Text from '../atoms/flag-text'
8
+ import Identifier from '../molecules/flag-identifier'
9
+ import Redacted from '../molecules/flag-redacted'
10
+
11
+ const StyledSummary = Styled.div`
12
+ display: flex;
13
+ flex-wrap: wrap;
14
+ justify-content: center;
15
+ `
16
+ const StyledDate = Styled.div`
17
+ text-align: right;
18
+ `
19
+ const StyledText = Styled.div`
20
+ flex-basis: 100%;
21
+ `
22
+
23
+ const FlagSummary: FC<Props> = ({ flag, ...rest }) => {
24
+ if (flag.metadata.isRedacted) {
25
+ return (
26
+ <StyledSummary {...rest}>
27
+ <Redacted flag={flag} />
28
+ </StyledSummary>
29
+ )
30
+ }
31
+
32
+ return (
33
+ <StyledSummary {...rest}>
34
+ <Identifier flag={flag} />
35
+ <StyledDate>
36
+ <PeriodSummary period={flag.period} />
37
+ </StyledDate>
38
+ <StyledText>
39
+ <Text flag={flag} />
40
+ </StyledText>
41
+ </StyledSummary>
42
+ )
43
+ }
44
+
45
+ interface Props extends HTMLAttributes<HTMLDivElement> {
46
+ flag: Flag
47
+ }
48
+
49
+ export default FlagSummary