Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(fix) Fix invalid prop warning for some Carbon components #2048

Merged
merged 1 commit into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ const MarkPatientDeceasedForm: React.FC<DefaultPatientWorkspaceProps> = ({ close
render={({ field: { onChange, value } }) => (
<TextInput
id="freeTextCauseOfDeath"
invalid={errors?.nonCodedCauseOfDeath}
invalidText={errors?.nonCodedCauseOfDeath && errors?.nonCodedCauseOfDeath?.message}
invalid={!!errors?.nonCodedCauseOfDeath}
invalidText={errors?.nonCodedCauseOfDeath?.message}
labelText={t('nonCodedCauseOfDeath', 'Non-coded cause of death')}
onChange={onChange}
placeholder={t('enterNonCodedCauseOfDeath', 'Enter non-coded cause of death')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const VisitDateTimeField: React.FC<VisitDateTimeFieldProps> = ({
labelText={t('date', 'Date')}
placeholder="dd/mm/yyyy"
style={{ width: '100%' }}
invalid={errors[dateFieldName]?.message}
invalid={!!errors[dateFieldName]}
invalidText={errors[dateFieldName]?.message}
/>
</DatePicker>
Expand All @@ -84,7 +84,7 @@ const VisitDateTimeField: React.FC<VisitDateTimeFieldProps> = ({
style={{ marginLeft: '0.125rem', flex: 'none' }}
value={value}
onBlur={onBlur}
invalid={errors[timeFieldName]?.message}
invalid={!!errors[timeFieldName]}
invalidText={errors[timeFieldName]?.message}
>
<Controller
Expand All @@ -96,7 +96,7 @@ const VisitDateTimeField: React.FC<VisitDateTimeFieldProps> = ({
onChange={(event) => onChange(event.target.value as amPm)}
value={value}
aria-label={t('timeFormat ', 'Time Format')}
invalid={errors[timeFormatFieldName]?.message}
invalid={!!errors[timeFormatFieldName]}
invalidText={errors[timeFormatFieldName]?.message}
>
<SelectItem value="AM" text="AM" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ export function LabOrderForm({
value={value}
onChange={onChange}
onBlur={onBlur}
invalid={errors.accessionNumber?.message}
invalid={!!errors.accessionNumber}
invalidText={errors.accessionNumber?.message}
/>
)}
Expand All @@ -216,7 +216,7 @@ export function LabOrderForm({
items={priorityOptions}
onBlur={onBlur}
onChange={({ selectedItem }) => onChange(selectedItem?.value || '')}
invalid={errors.urgency?.message}
invalid={!!errors.urgency}
invalidText={errors.urgency?.message}
/>
)}
Expand All @@ -241,7 +241,7 @@ export function LabOrderForm({
items={orderReasons}
onBlur={onBlur}
onChange={({ selectedItem }) => onChange(selectedItem?.uuid || '')}
invalid={errors.orderReason?.message}
invalid={!!errors.orderReason}
invalidText={errors.orderReason?.message}
/>
)}
Expand All @@ -266,7 +266,7 @@ export function LabOrderForm({
onChange={onChange}
onBlur={onBlur}
maxCount={500}
invalid={errors.instructions?.message}
invalid={!!errors.instructions}
invalidText={errors.instructions?.message}
/>
)}
Expand Down