-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #619 from omnifed/618-feat-make-fieldset-legend-co…
…mponents 618 feat make fieldset legend components
- Loading branch information
Showing
16 changed files
with
864 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
"cerb", | ||
"Checkmark", | ||
"csstools", | ||
"Fieldset", | ||
"frontmatter", | ||
"hljs", | ||
"Killa", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
--- | ||
|
||
import { | ||
WhenToUseAdmonition | ||
} from '@/app/components/Admonition' | ||
import OverviewList from '@/app/components/OverviewList' | ||
|
||
## Use Cases | ||
|
||
<OverviewList intro="Users should be able to:" rules={[ | ||
'Navigate to and activate a input field with assistive technology', | ||
'Receive and understand supporting text and error messages', | ||
'Navigate to and select interactive icons', | ||
]} /> | ||
|
||
## Interaction & Style | ||
|
||
The containers for both filled and outlined text fields provide the same functionality. Changes to color and thickness of stroke help provide clear visual cues for interaction. | ||
|
||
## Keyboard Navigation | ||
|
||
| Keys | Actions | | ||
| -------- | --------------------------------------------------------------- | | ||
| Tab | Focus lands on (non-disabled) input | | ||
|
||
## Labeling Elements | ||
|
||
If the UI text is correctly linked, assistive tech (such as a screenreader) will read the UI text followed by the component's role. | ||
|
||
The accessibility label for a textfield is typically the same as the label for the textfield. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
import { | ||
Field, | ||
Fieldset, | ||
FieldsetLabel, | ||
Legend, | ||
Radio, | ||
} from '@cerberus-design/react' | ||
import { css } from '@cerberus-design/styled-system/css' | ||
import { hstack } from '@cerberus-design/styled-system/patterns' | ||
import { vstack } from '@cerberus/styled-system/patterns' | ||
|
||
export function OverviewRadioGroup() { | ||
return ( | ||
<Field> | ||
<Fieldset | ||
className={hstack({ | ||
gap: '4', | ||
rounded: 'xl', | ||
})} | ||
name="pet" | ||
role="radiogroup" | ||
> | ||
<Legend>What pets do you have?</Legend> | ||
<Radio id="dog" name="pet" value="dog" defaultChecked> | ||
<FieldsetLabel htmlFor="dog">🐶 Dog</FieldsetLabel> | ||
</Radio> | ||
|
||
<Radio id="cat" name="pet" value="cat"> | ||
<FieldsetLabel htmlFor="cat">😸 Cat</FieldsetLabel> | ||
</Radio> | ||
|
||
<Radio id="both" name="pet" value="both"> | ||
<FieldsetLabel htmlFor="both">🐶😸 Both</FieldsetLabel> | ||
</Radio> | ||
</Fieldset> | ||
</Field> | ||
) | ||
} | ||
|
||
export function DisabledRadioGroup() { | ||
return ( | ||
<Field disabled> | ||
<Fieldset | ||
className={hstack({ | ||
gap: '4', | ||
rounded: 'xl', | ||
})} | ||
name="pet" | ||
role="radiogroup" | ||
> | ||
<Legend>What pets do you have?</Legend> | ||
<Radio id="dog" name="pet" value="dog" defaultChecked> | ||
<FieldsetLabel htmlFor="dog">🐶 Dog</FieldsetLabel> | ||
</Radio> | ||
|
||
<Radio id="cat" name="pet" value="cat"> | ||
<FieldsetLabel htmlFor="cat">😸 Cat</FieldsetLabel> | ||
</Radio> | ||
|
||
<Radio id="both" name="pet" value="both"> | ||
<FieldsetLabel htmlFor="both">🐶😸 Both</FieldsetLabel> | ||
</Radio> | ||
</Fieldset> | ||
</Field> | ||
) | ||
} | ||
|
||
export function RequiredRadioGroup() { | ||
return ( | ||
<Field required> | ||
<Fieldset | ||
className={hstack({ | ||
gap: '4', | ||
rounded: 'xl', | ||
})} | ||
name="pet" | ||
role="radiogroup" | ||
> | ||
<Legend>What pets do you have?</Legend> | ||
<Radio id="dog" name="pet" value="dog" defaultChecked> | ||
<FieldsetLabel htmlFor="dog">🐶 Dog</FieldsetLabel> | ||
</Radio> | ||
|
||
<Radio id="cat" name="pet" value="cat"> | ||
<FieldsetLabel htmlFor="cat">😸 Cat</FieldsetLabel> | ||
</Radio> | ||
|
||
<Radio id="both" name="pet" value="both"> | ||
<FieldsetLabel htmlFor="both">🐶😸 Both</FieldsetLabel> | ||
</Radio> | ||
</Fieldset> | ||
</Field> | ||
) | ||
} | ||
|
||
export function CustomFieldset() { | ||
return ( | ||
<Field> | ||
<Fieldset | ||
className={vstack({ | ||
alignItems: 'flex-start', | ||
gap: '4', | ||
rounded: 'xl', | ||
})} | ||
name="pet" | ||
role="radiogroup" | ||
style={{ | ||
border: '2px solid', | ||
borderColor: 'yellow', | ||
padding: '16px', | ||
}} | ||
> | ||
<Legend | ||
className={css({ | ||
color: 'yellow', | ||
textStyle: 'h3', | ||
})} | ||
> | ||
What is Wu-Tang? | ||
</Legend> | ||
<Radio id="dog" name="pet" value="dog" defaultChecked> | ||
<FieldsetLabel htmlFor="dog">Forever</FieldsetLabel> | ||
</Radio> | ||
|
||
<Radio id="cat" name="pet" value="cat"> | ||
<FieldsetLabel htmlFor="cat">Forever</FieldsetLabel> | ||
</Radio> | ||
|
||
<Radio id="both" name="pet" value="both"> | ||
<FieldsetLabel htmlFor="both">Forever</FieldsetLabel> | ||
</Radio> | ||
</Fieldset> | ||
</Field> | ||
) | ||
} |
Oops, something went wrong.