Skip to content

Commit 801000a

Browse files
committed
addresses PR feedback
1 parent 2231c63 commit 801000a

File tree

2 files changed

+6
-20
lines changed

2 files changed

+6
-20
lines changed

docs/content/FormControl.mdx

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -252,17 +252,13 @@ const ValidationExample = () => {
252252
}, [value])
253253

254254
return (
255-
<FormControl
256-
validationMap={{
257-
noSpaces: 'error',
258-
validName: 'success'
259-
}}
260-
validationResult={validationResult}
261-
>
255+
<FormControl>
262256
<FormControl.Label>GitHub handle</FormControl.Label>
263257
<TextInput block value={value} onChange={handleInputChange} />
264-
<FormControl.Validation validationKey="noSpaces">GitHub handles cannot contain spaces</FormControl.Validation>
265-
<FormControl.Validation validationKey="validName">Valid name</FormControl.Validation>
258+
{validationResult === 'noSpaces' && (
259+
<FormControl.Validation>GitHub handles cannot contain spaces</FormControl.Validation>
260+
)}
261+
{validationResult === 'validName' && <FormControl.Validation>Valid name</FormControl.Validation>}
266262
<FormControl.Caption>With or without "@". For example "monalisa" or "@monalisa"</FormControl.Caption>
267263
</FormControl>
268264
)
@@ -332,12 +328,6 @@ The container that handles the layout and passes the relevant IDs and ARIA attri
332328
defaultValue="false"
333329
description="Whether the field is ready for user input"
334330
/>
335-
<PropsTableRow
336-
name="validationMap"
337-
type="Record<string, 'error'|'sucess'>"
338-
description="A map of validation statuses and their associated validation keys. When one of the validation keys is passed to the `validationResult` prop, the associated validation message will be rendered in the correct style"
339-
/>
340-
<PropsTableRow name="validationResult" type="string" description="The key of the validation message to show " />
341331
</PropsTable>
342332

343333
### FormControl.Label
@@ -381,11 +371,6 @@ A `FormControl.Label` must be passed for the field to be accessible to assistive
381371
type="React.ReactNode"
382372
description="The content (usually just text) that is rendered to give contextual info about the validation result for the field"
383373
/>
384-
<PropsTableRow
385-
name="validationKey"
386-
type="string"
387-
description="The key of the property from `FormControl` that corresponds to this validation message. When `FormControl`'s `validationResult` prop matches `FormControl.Validation`'s `validationKey` prop, this message is shown."
388-
/>
389374
</PropsTable>
390375

391376
### FormControl.LeadingVisual

src/Select.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const StyledSelect = styled.select`
1414
border: 0;
1515
color: currentColor;
1616
outline: none;
17+
width: 100%;
1718
1819
/* colors the select input's placeholder text */
1920
&:invalid {

0 commit comments

Comments
 (0)