Skip to content

Commit

Permalink
should display error underneath fields when nested inside Field.Selec…
Browse files Browse the repository at this point in the history
…tion or Field.ArraySelection
  • Loading branch information
tujoworker committed Nov 6, 2024
1 parent f2bef7a commit a241d05
Show file tree
Hide file tree
Showing 22 changed files with 317 additions and 221 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,21 @@ export const CheckboxWithHelp = () => (
)

export const CheckboxNestingWithLogic = () => (
<ComponentBox data-visual-test="array-selection-checkbox-nesting-logic">
<Form.Handler>
<ComponentBox
hideCode
data-visual-test="array-selection-checkbox-nesting-logic"
>
<Form.Handler onSubmit={console.log}>
<Card stack>
<Field.ArraySelection label="Make a selection" path="/mySelection">
<Field.ArraySelection
label="Make a selection"
path="/mySelection"
required
>
<Field.Option value="nothing" title="Nothing" />

<Field.Option value="showInput" title="Show an input" />
<Form.Visibility
animate
visibleWhen={{
path: '/mySelection',
hasValue: (value) => {
Expand All @@ -187,10 +193,11 @@ export const CheckboxNestingWithLogic = () => (
: false
},
}}
compensateForGap="auto"
animate
compensateForGap="auto" // makes animation smooth
>
<Section variant="info" innerSpace>
<Field.String placeholder="Enter some value" />
<Field.String placeholder="Enter some value" required />
</Section>
</Form.Visibility>

Expand All @@ -199,7 +206,6 @@ export const CheckboxNestingWithLogic = () => (
title="Show additional option"
/>
<Form.Visibility
animate
visibleWhen={{
path: '/mySelection',
hasValue: (value) => {
Expand All @@ -208,7 +214,8 @@ export const CheckboxNestingWithLogic = () => (
: false
},
}}
compensateForGap="auto"
animate
compensateForGap="auto" // makes animation smooth
>
<Field.Option
value="showMeMore"
Expand All @@ -227,12 +234,14 @@ export const CheckboxNestingWithLogic = () => (
}}
>
<Section variant="info" innerSpace>
<Field.String placeholder="Enter more info" />
<Field.String placeholder="Enter more info" required />
</Section>
</Form.Visibility>
</Form.Visibility>
</Field.ArraySelection>
</Card>

<Form.SubmitButton />
</Form.Handler>
</ComponentBox>
)
Expand Down Expand Up @@ -496,7 +505,6 @@ export const ButtonNestingWithLogic = () => (

<Field.Option value="showInput" title="Show an input" />
<Form.Visibility
animate
visibleWhen={{
path: '/mySelection',
hasValue: (value) => {
Expand All @@ -505,7 +513,8 @@ export const ButtonNestingWithLogic = () => (
: false
},
}}
compensateForGap="auto"
animate
compensateForGap="auto" // makes animation smooth
>
<Section variant="info" innerSpace>
<Field.String placeholder="Enter some value" />
Expand All @@ -517,7 +526,6 @@ export const ButtonNestingWithLogic = () => (
title="Show additional option"
/>
<Form.Visibility
animate
visibleWhen={{
path: '/mySelection',
hasValue: (value) => {
Expand All @@ -526,7 +534,8 @@ export const ButtonNestingWithLogic = () => (
: false
},
}}
compensateForGap="auto"
animate
compensateForGap="auto" // makes animation smooth
>
<Field.Option
value="showMeMore"
Expand Down
Loading

0 comments on commit a241d05

Please sign in to comment.