Skip to content

Commit

Permalink
Merge branch 'main' into tooltip-alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
Art-Ndiema authored Jul 30, 2024
2 parents 8721a8f + 889b4d2 commit c63e48b
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 21 deletions.
4 changes: 2 additions & 2 deletions src/components/encounter/encounter-form.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -842,8 +842,8 @@ const EncounterForm: React.FC<EncounterFormProps> = ({
<InstantEffect effect={addScrollablePages} />
{form.pages.map((page, index) => {
const pageHasNoVisibleContent =
page.sections.every((section) => section.isHidden) ||
page.sections.every((section) => section.questions.every((question) => question.isHidden)) ||
page.sections?.every((section) => section.isHidden) ||
page.sections?.every((section) => section.questions?.every((question) => question.isHidden)) ||
isTrue(page.isHidden);

if (!page.isSubform && pageHasNoVisibleContent) {
Expand Down
14 changes: 13 additions & 1 deletion src/components/inputs/date/date.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,23 @@ const DateField: React.FC<FormFieldProps> = ({ question, onChange, handler, prev
<TimePicker
className={classNames(styles.boldedLabel, styles.timeInput)}
id={question.id}
labelText={timePickerLabel}
labelText={
question.isRequired ? (
<RequiredFieldLabel

Check failure on line 138 in src/components/inputs/date/date.component.tsx

View workflow job for this annotation

GitHub Actions / build

Cannot find name 'RequiredFieldLabel'.
label={question.datePickerFormat === 'timer' ? t(question.label) : t('time', 'Time')}
/>
) : (
<span>{question.datePickerFormat === 'timer' ? t(question.label) : t('time', 'Time')}</span>
)
}
placeholder="HH:MM"
pattern="(1[012]|[1-9]):[0-5][0-9])$"
type="time"
disabled={question.datePickerFormat === 'timer' ? question.isDisabled : !field.value ? true : false}
invalid={errors.length > 0}
invalidText={errors[0]?.message}
warning={warnings.length > 0}
warningText={warnings[0]?.message}
value={
time
? time
Expand Down
17 changes: 6 additions & 11 deletions src/components/inputs/toggle/toggle.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,10 @@
.boldedLabel label {
font-weight: 600;
color: colors.$black-100;
justify-content: flex-start;
}
:global(.cds--toggle__label-text) {
font-weight: 600;
font-size: 0.85rem;
padding-top: 1000;
align-items: center;
color: colors.$black-100;
}
.tooltipContainer {
padding-top: 20rem;

:global(.cds--toggle__label-text) {
font-weight: 600;
font-size: 0.85rem;
color: colors.$black-100;
}
}
11 changes: 4 additions & 7 deletions src/hooks/useFormJson.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -211,18 +211,15 @@ function getReferencedFormSection(formSection: FormSection, formComponent: FormS
}
}

return filterExcludedQuestions(referencedFormSection);
return filterExcludedQuestions(referencedFormSection, formSection.reference);
}

function filterExcludedQuestions(formSection: FormSection): FormSection {
if (formSection.reference.excludeQuestions) {
const excludeQuestions = formSection.reference.excludeQuestions;
function filterExcludedQuestions(formSection: FormSection, reference: any): FormSection {
if (reference?.excludeQuestions) {
const excludeQuestions = reference.excludeQuestions;
formSection.questions = formSection.questions.filter((question) => {
return !excludeQuestions.includes(question.id);
});
}
// delete reference from section
delete formSection.reference;

return formSection;
}

0 comments on commit c63e48b

Please sign in to comment.