diff --git a/packages/framework/esm-framework/docs/API.md b/packages/framework/esm-framework/docs/API.md index 4bcd88ed9..809015f34 100644 --- a/packages/framework/esm-framework/docs/API.md +++ b/packages/framework/esm-framework/docs/API.md @@ -695,7 +695,7 @@ ___ #### Defined in -[packages/framework/esm-styleguide/src/icons/icons.tsx:648](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/icons/icons.tsx#L648) +[packages/framework/esm-styleguide/src/icons/icons.tsx:664](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/icons/icons.tsx#L664) ___ @@ -1173,7 +1173,7 @@ ___ #### Defined in -[packages/framework/esm-styleguide/src/icons/icons.tsx:630](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/icons/icons.tsx#L638) +[packages/framework/esm-styleguide/src/icons/icons.tsx:638](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/icons/icons.tsx#L638) ___ @@ -1233,7 +1233,7 @@ ___ #### Defined in -[packages/framework/esm-styleguide/src/icons/icons.tsx:635](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/icons/icons.tsx#L643) +[packages/framework/esm-styleguide/src/icons/icons.tsx:643](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/icons/icons.tsx#L643) ___ @@ -1427,7 +1427,7 @@ Note this is an alias for ListCheckedIcon #### Defined in -[packages/framework/esm-styleguide/src/icons/icons.tsx:642](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/icons/icons.tsx#L650) +[packages/framework/esm-styleguide/src/icons/icons.tsx:650](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/icons/icons.tsx#L650) ___ @@ -1549,7 +1549,7 @@ This is a utility type for custom icons that use the svg-sprite-loader to bundle #### Defined in -[packages/framework/esm-styleguide/src/icons/icons.tsx:656](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/icons/icons.tsx#L656) +[packages/framework/esm-styleguide/src/icons/icons.tsx:672](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/icons/icons.tsx#L672) ___ @@ -1815,7 +1815,7 @@ ___ #### Defined in -[packages/framework/esm-styleguide/src/icons/icons.tsx:639](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/icons/icons.tsx#L655) +[packages/framework/esm-styleguide/src/icons/icons.tsx:655](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/icons/icons.tsx#L655) ___ @@ -1899,7 +1899,7 @@ Note this is an alias for ShoppingCartArrowDownIcon #### Defined in -[packages/framework/esm-styleguide/src/icons/icons.tsx:654](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/icons/icons.tsx#L662) +[packages/framework/esm-styleguide/src/icons/icons.tsx:662](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/icons/icons.tsx#L662) ___ @@ -1955,9 +1955,10 @@ ___ #### Defined in -[packages/framework/esm-styleguide/src/icons/icons.tsx:471](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/icons/icons.tsx#L627) +[packages/framework/esm-styleguide/src/icons/icons.tsx:627](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/icons/icons.tsx#L627) ___ + ### TableIcon • `Const` **TableIcon**: `MemoExoticComponent`<`ForwardRefExoticComponent`<[`IconProps`](API.md#iconprops) & `RefAttributes`<`SVGSVGElement`\>\>\> @@ -6850,7 +6851,7 @@ ___ #### Defined in -[packages/framework/esm-styleguide/src/patient-banner/patient-info/patient-banner-patient-identifiers.component.tsx:43](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/patient-banner/patient-info/patient-banner-patient-identifiers.component.tsx#L43) +[packages/framework/esm-styleguide/src/patient-banner/patient-info/patient-banner-patient-identifiers.component.tsx:41](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/patient-banner/patient-info/patient-banner-patient-identifiers.component.tsx#L41) ___ @@ -6870,7 +6871,7 @@ ___ #### Defined in -[packages/framework/esm-styleguide/src/patient-banner/patient-info/patient-banner-patient-info.component.tsx:48](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/patient-banner/patient-info/patient-banner-patient-info.component.tsx#L48) +[packages/framework/esm-styleguide/src/patient-banner/patient-info/patient-banner-patient-info.component.tsx:43](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/patient-banner/patient-info/patient-banner-patient-info.component.tsx#L43) ___ diff --git a/packages/framework/esm-styleguide/src/patient-banner/patient-info/gender-icons.component.tsx b/packages/framework/esm-styleguide/src/patient-banner/patient-info/gender-icons.component.tsx index b4fae943f..2a5441e9f 100644 --- a/packages/framework/esm-styleguide/src/patient-banner/patient-info/gender-icons.component.tsx +++ b/packages/framework/esm-styleguide/src/patient-banner/patient-info/gender-icons.component.tsx @@ -1,38 +1,30 @@ import React from 'react'; -interface IconProps { - height?: number; - width?: number; -} - -export const FemaleIcon: React.FC = ({ height = 20, width = 20 }) => ( - - +export const FemaleIcon: React.FC = () => ( + + ); -export const MaleIcon: React.FC = ({ height = 20, width = 20 }) => ( - +export const MaleIcon: React.FC = () => ( + ); -export const UnknownIcon: React.FC = ({ height = 20, width = 20 }) => ( - +export const UnknownIcon: React.FC = () => ( + - + ); -export const OtherIcon: React.FC = ({ height = 20, width = 20 }) => ( - +export const OtherIcon: React.FC = () => ( + - + ); diff --git a/packages/framework/esm-styleguide/src/patient-banner/patient-info/patient-banner-patient-identifiers.component.tsx b/packages/framework/esm-styleguide/src/patient-banner/patient-info/patient-banner-patient-identifiers.component.tsx index 8c066781b..200f5764f 100644 --- a/packages/framework/esm-styleguide/src/patient-banner/patient-info/patient-banner-patient-identifiers.component.tsx +++ b/packages/framework/esm-styleguide/src/patient-banner/patient-info/patient-banner-patient-identifiers.component.tsx @@ -1,6 +1,6 @@ /** @module @category UI */ import React from 'react'; -import { Tag } from '@carbon/react'; +import { FormLabel, Tag } from '@carbon/react'; import { useConfig, usePrimaryIdentifierCode } from '@openmrs/esm-react-utils'; import { type StyleguideConfigObject } from '../../config-schema'; import styles from './patient-banner-patient-info.module.scss'; @@ -21,7 +21,7 @@ function PrimaryIdentifier({ showIdentifierLabel, type, value }: IdentifierProps
{showIdentifierLabel && ( - {type?.text}: + {type?.text && {type.text}: } {value} )} @@ -31,12 +31,10 @@ function PrimaryIdentifier({ showIdentifierLabel, type, value }: IdentifierProps function SecondaryIdentifier({ showIdentifierLabel, type, value }: IdentifierProps) { return ( - + {value} + ); } @@ -57,15 +55,13 @@ export function PatientBannerPatientIdentifier({
{filteredIdentifiers?.length ? filteredIdentifiers.map(({ value, type }, index) => ( -
-
- {index > 0 && ·} - {type?.coding?.[0]?.code === primaryIdentifierCode ? ( - - ) : ( - - )} -
+
+ {index > 0 && ·} + {type?.coding?.[0]?.code === primaryIdentifierCode ? ( + + ) : ( + + )}
)) : ''} diff --git a/packages/framework/esm-styleguide/src/patient-banner/patient-info/patient-banner-patient-info.component.tsx b/packages/framework/esm-styleguide/src/patient-banner/patient-info/patient-banner-patient-info.component.tsx index f282cf9db..e1bb5a11b 100644 --- a/packages/framework/esm-styleguide/src/patient-banner/patient-info/patient-banner-patient-info.component.tsx +++ b/packages/framework/esm-styleguide/src/patient-banner/patient-info/patient-banner-patient-info.component.tsx @@ -1,5 +1,5 @@ /** @module @category UI */ -import React from 'react'; +import React, { useMemo } from 'react'; import classNames from 'classnames'; import { ExtensionSlot } from '@openmrs/esm-react-utils'; import { getCoreTranslation } from '@openmrs/esm-translations'; @@ -12,19 +12,21 @@ export interface PatientBannerPatientInfoProps { patient: fhir.Patient; } +type Gender = 'female' | 'male' | 'other' | 'unknown'; + interface GenderIconProps { - gender: string; + gender: keyof typeof GENDER_ICONS; } -const GenderIcon = ({ gender }: GenderIconProps) => { - const GENDER_ICONS = { - Female: FemaleIcon, - Male: MaleIcon, - Other: OtherIcon, - Unknown: UnknownIcon, - } as const; +const GENDER_ICONS = { + Female: FemaleIcon, + Male: MaleIcon, + Other: OtherIcon, + Unknown: UnknownIcon, +} as const; - const IconComponent = GENDER_ICONS[gender as keyof typeof GENDER_ICONS]; +const GenderIcon = ({ gender }: GenderIconProps) => { + const IconComponent = GENDER_ICONS[gender]; if (!IconComponent) { return null; @@ -34,21 +36,16 @@ const GenderIcon = ({ gender }: GenderIconProps) => { }; const getGender = (gender: string): string => { - const genderTranslations = { - male: 'male', - female: 'female', - other: 'other', - unknown: 'unknown', - } as const; - - const key = gender.toLowerCase() as keyof typeof genderTranslations; - return getCoreTranslation(genderTranslations[key], gender); + const key = gender.toLowerCase() as Gender; + return getCoreTranslation(key, gender); }; export function PatientBannerPatientInfo({ patient }: PatientBannerPatientInfoProps) { const name = `${patient?.name?.[0]?.given?.join(' ')} ${patient?.name?.[0]?.family}`; const gender = patient?.gender && getGender(patient.gender); + const extensionState = useMemo(() => ({ patientUuid: patient.id, patient }), [patient.id, patient]); + return (
@@ -57,16 +54,12 @@ export function PatientBannerPatientInfo({ patient }: PatientBannerPatientInfoPr {gender && (
- + {gender}
)} - +
diff --git a/packages/framework/esm-styleguide/src/patient-banner/patient-info/patient-banner-patient-info.module.scss b/packages/framework/esm-styleguide/src/patient-banner/patient-info/patient-banner-patient-info.module.scss index bf32c425c..9974b215a 100644 --- a/packages/framework/esm-styleguide/src/patient-banner/patient-info/patient-banner-patient-info.module.scss +++ b/packages/framework/esm-styleguide/src/patient-banner/patient-info/patient-banner-patient-info.module.scss @@ -1,7 +1,7 @@ @use '@carbon/colors'; @use '@carbon/layout'; @use '@carbon/type'; -@use '~@openmrs/esm-styleguide/src/vars' as *; +@use '@openmrs/esm-styleguide/src/vars' as *; .container { border-top: 1px solid $ui-03; @@ -66,6 +66,10 @@ display: flex; flex-flow: row wrap; align-items: center; +} + +.tagsSlot { + @extend .flexRow; margin: 0 layout.$spacing-03; }