Skip to content

Commit

Permalink
fix: dependency pulled now, changed example
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-belcher committed Oct 13, 2023
1 parent d8ff96f commit 7f52017
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
15 changes: 8 additions & 7 deletions src/services/ui/src/components/RHF/RHFInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ export const RHFFormGroup = <TFieldValues extends FieldValues>(props: {
control: Control<TFieldValues>;
}) => {
return (
<DependencyWrapper {...props.form?.dependency}>
<DependencyWrapper {...props.form}>
<div className="py-4">
{props.form.description && (
<div className="mb-6">
Expand All @@ -332,12 +332,13 @@ export const RHFFormGroup = <TFieldValues extends FieldValues>(props: {
<div className={props.form.wrapperStyling}>
{props.form.slots.map((slot) => {
return (
<FormField
key={slot.name}
control={props.control}
name={slot.name}
render={RHFSlot(slot)}
/>
<DependencyWrapper key={slot.name} {...slot}>
<FormField
control={props.control}
name={slot.name}
render={RHFSlot(slot)}
/>
</DependencyWrapper>
);
})}
</div>
Expand Down
20 changes: 10 additions & 10 deletions src/services/ui/src/pages/form/proto.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,16 @@ export const ABP1: Document = {
{
description:
"Is enrollment available for all individuals in these eligibility groups?",
dependency: {
//example of a conditionally revealed field
conditions: [
{
name: "alt_benefit_plan_population_name",
type: "valueExists",
},
],
effect: { type: "show" },
},
slots: [
{
rhf: "Select",
Expand All @@ -97,16 +107,6 @@ export const ABP1: Document = {
{ label: "Yes", value: "yes" },
{ label: "No", value: "no" },
],
dependency: {
//example of a conditionally revealed field
conditions: [
{
name: "alt_benefit_plan_population_name",
type: "valueExists",
},
],
effect: { type: "show" },
},
},
],
},
Expand Down

0 comments on commit 7f52017

Please sign in to comment.