-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feature/DES-670-file-input
- Loading branch information
Showing
26 changed files
with
409 additions
and
176 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
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,17 @@ | ||
<!-- @license CC0-1.0 --> | ||
|
||
# Field Set | ||
|
||
A component to group related form inputs. | ||
|
||
## Guidelines | ||
|
||
- Use Field Set when you need to show a relationship between multiple form inputs. For example, you may need to group a set of text inputs into a single Field Set when asking for an address. | ||
|
||
## Relevant WCAG Requirements | ||
|
||
- [WCAG 1.3.5](https://www.w3.org/WAI/WCAG22/Understanding/identify-input-purpose.html): Field Set labels the purpose of a group of inputs. | ||
|
||
## References | ||
|
||
- [Providing a description for groups of form controls using fieldset and legend elements](https://www.w3.org/WAI/WCAG22/Techniques/html/H71) |
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,48 @@ | ||
/** | ||
* @license EUPL-1.2+ | ||
* Copyright Gemeente Amsterdam | ||
*/ | ||
|
||
@import "../../common/hyphenation"; | ||
@import "../../common/text-rendering"; | ||
|
||
@mixin reset { | ||
border: 0; | ||
margin-inline: 0; | ||
padding-block: 0; | ||
padding-inline: 0; | ||
} | ||
|
||
.ams-field-set { | ||
break-inside: avoid; | ||
|
||
@include reset; | ||
} | ||
|
||
.ams-field-set--invalid { | ||
border-inline-start: var(--ams-field-set-invalid-border-inline-start); | ||
padding-inline-start: var(--ams-field-set-invalid-padding-inline-start); | ||
} | ||
|
||
@mixin reset-legend { | ||
float: left; // [1] | ||
padding-inline: 0; | ||
width: 100%; // [1] | ||
} | ||
|
||
// [1] This combination allows the fieldset border to go around the legend, instead of through it. | ||
|
||
.ams-field-set__legend { | ||
color: var(--ams-field-set-legend-color); | ||
font-family: var(--ams-field-set-legend-font-family); | ||
font-size: var(--ams-field-set-legend-font-size); | ||
font-weight: var(--ams-field-set-legend-font-weight); | ||
line-height: var(--ams-field-set-legend-line-height); | ||
margin-block-end: var( | ||
--ams-field-set-legend-margin-block-end | ||
); /* Because of a bug in Chrome we can’t use display grid or flex for this gap */ | ||
|
||
@include hyphenation; | ||
@include text-rendering; | ||
@include reset-legend; | ||
} |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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,30 @@ | ||
/** | ||
* @license EUPL-1.2+ | ||
* Copyright Gemeente Amsterdam | ||
*/ | ||
|
||
import clsx from 'clsx' | ||
import { forwardRef } from 'react' | ||
import type { ForwardedRef, HTMLAttributes, PropsWithChildren } from 'react' | ||
|
||
export type FieldSetProps = PropsWithChildren<HTMLAttributes<HTMLFieldSetElement>> & { | ||
/** Whether the field set has an input with a validation error */ | ||
invalid?: boolean | ||
/** The text for the caption. */ | ||
legend: string | ||
} | ||
|
||
export const FieldSet = forwardRef( | ||
({ children, className, invalid, legend, ...restProps }: FieldSetProps, ref: ForwardedRef<HTMLFieldSetElement>) => ( | ||
<fieldset | ||
{...restProps} | ||
ref={ref} | ||
className={clsx('ams-field-set', invalid && 'ams-field-set--invalid', className)} | ||
> | ||
<legend className="ams-field-set__legend">{legend}</legend> | ||
{children} | ||
</fieldset> | ||
), | ||
) | ||
|
||
FieldSet.displayName = 'FieldSet' |
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,5 @@ | ||
<!-- @license CC0-1.0 --> | ||
|
||
# React Field Set component | ||
|
||
[Field Set documentation](../../../css/src/components/field-set/README.md) |
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,2 @@ | ||
export { FieldSet } from './FieldSet' | ||
export type { FieldSetProps } from './FieldSet' |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.