Skip to content

Commit

Permalink
(fix) Highlight selected options for the multi-select component (#366)
Browse files Browse the repository at this point in the history
* Fix issue with highlighting selected values for multi-select

* Only highlight selected values for the compact multi-select
  • Loading branch information
samuelmale authored Aug 13, 2024
1 parent a809dbf commit 975cb53
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 29 deletions.
28 changes: 15 additions & 13 deletions src/components/inputs/multi-select/multi-select.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,19 +130,21 @@ const MultiSelect: React.FC<FormFieldInputProps> = ({ field, value, errors, warn
)}
</Layer>
</div>
<div className={styles.selectionDisplay}>
{value?.length && field.questionOptions.answers?.length > 5 ? (
<div className={styles.tagContainer}>
{formFieldAdapters[field.type]?.getDisplayValue(field, value)?.map((displayValue, index) => (
<Tag key={index} type="cool-gray">
{displayValue}
</Tag>
))}
</div>
) : (
<ValueEmpty />
)}
</div>
{!field.inlineMultiCheckbox && (
<div className={styles.selectionDisplay}>
{value?.length ? (
<div className={styles.tagContainer}>
{formFieldAdapters[field.type]?.getDisplayValue(field, value)?.map((displayValue, index) => (
<Tag key={index} type="cool-gray">
{displayValue}
</Tag>
))}
</div>
) : (
<ValueEmpty />
)}
</div>
)}
</>
)
);
Expand Down
1 change: 0 additions & 1 deletion src/provider/form-factory-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { type FormContextProps } from './form-provider';
import { processPostSubmissionActions, validateForm } from './form-factory-helper';
import { useTranslation } from 'react-i18next';
import { usePostSubmissionActions } from '../hooks/usePostSubmissionActions';
import { reportError } from '../utils/error-utils';

interface FormFactoryProviderContextProps {
patient: fhir.Patient;
Expand Down
23 changes: 8 additions & 15 deletions translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,39 @@
"add": "Add",
"addCameraImage": "Add camera image",
"addFile": "Add files",
"attachmentsSaved": "Attachment(s) saved successfully",
"cameraCapture": "Camera capture",
"cancel": "Cancel",
"chooseAnOption": "Choose an option",
"clearFile": "Clear file",
"close": "Close",
"closeCamera": "Close camera",
"closesNotification": "Closes notification",
"submittedForm": "Form submitted",
"submittedFormDescription": "Form submitted successfully",
"errorDescription": "{{errors}}",
"errorDescriptionTitle": "Error on saving form",
"errorLoadingFormSchema": "Error loading form schema",
"errorLoadingInitialValues": "Error loading initial values",
"errorRenderingField": "Error rendering field",
"errorSavingAttachments": "Error saving attachment(s)",
"errorSavingEncounter": "Error saving encounter",
"errorSavingPatientIdentifiers": "Error saving patient identifiers",
"errorSavingPatientPrograms": "Error saving patient program(s)",
"fieldErrorDescriptionTitle": "Validation Errors",
"fileUploadDescription": "",
"fileUploadDescriptionAny": "Upload any file type",
"invalidWorkspaceName": "Invalid workspace name.",
"invalidWorkspaceNameSubtitle": "Please provide a valid workspace name.",
"launchWorkspace": "",
"loading": "Loading",
"notification": "Notification",
"ordersSaved": "Order(s) saved sucessfully",
"patientIdentifiersSaved": "Patient identifier(s) saved sucessfully",
"patientProgramsSaved": "Patient program(s) saved successfully",
"nullMandatoryField": "Please fill the required fields",
"preview": "Preview",
"previousValue": "Previous value:",
"remove": "Remove",
"required": "Required",
"reuseValue": "Reuse value",
"revert": "Revert",
"save": "Save",
"search": "Search",
"submitting": "Submitting",
"time": "Time",
"unspecified": "Unspecified",
"unspecifyAll": "Unspecify All",
"updatedRecord": "Record updated",
"updatedRecordDescription": "The patient encounter was updated",
"upload": "Upload",
"uploadedPhoto": "Uploaded photo",
"uploadImage": "Upload image"
"uploadImage": "Upload image",
"valuesOutOfBound": "Some of the values are out of bounds"
}

0 comments on commit 975cb53

Please sign in to comment.