props.onChange(e.currentTarget.value)}
cols={props.cols}
rows={props.rows}
- spellCheck={props.spellCheck}
- wrap={props.wrap}
+ spellCheck={spellCheck}
+ wrap={wrap}
required={props.required}
data-testid={props.dataTestId}
data-cy={props.dataCy}
@@ -54,11 +54,6 @@ export function MultiTextField(props) {
);
}
-MultiTextField.defaultProps = {
- spellCheck: true,
- wrap: "soft",
-};
-
MultiTextField.propTypes = {
/**
* additional css for the component
diff --git a/components/atoms/RadioButton.js b/components/atoms/RadioButton.js
index 4a89bd83ed..7e68b9f44d 100644
--- a/components/atoms/RadioButton.js
+++ b/components/atoms/RadioButton.js
@@ -3,13 +3,13 @@ import PropTypes from "prop-types";
/**
* Radio input styled as a button
**/
-export function RadioButton(props) {
+export function RadioButton({ checked = false, ...props }) {
const ifControlledProps = !props.uncontrolled
? {
- checked: props.checked,
+ checked: checked,
}
: {
- defaultChecked: props.checked || false,
+ defaultChecked: checked || false,
};
return (
@@ -48,10 +48,6 @@ export function RadioButton(props) {
);
}
-RadioButton.defaultProps = {
- checked: false,
-};
-
RadioButton.propTypes = {
/**
* the id for the input
diff --git a/components/atoms/RadioField.js b/components/atoms/RadioField.js
index 55bf87992b..90a432e24a 100644
--- a/components/atoms/RadioField.js
+++ b/components/atoms/RadioField.js
@@ -3,10 +3,10 @@ import PropTypes from "prop-types";
/**
* radio field
*/
-export function RadioField(props) {
+export function RadioField({ checked = false, value = "true", ...props }) {
const ifControlledProps = !props.uncontrolled
? {
- checked: props.checked,
+ checked: checked,
}
: {};
return (
@@ -19,13 +19,13 @@ export function RadioField(props) {
className="control-input cursor-pointer appearance-none w-40px h-40px absolute left-0 m-0 z-1 opacity-0"
id={props.id}
name={props.name}
- value={props.value}
+ value={value}
type="radio"
onChange={(e) =>
props.onChange(
- props.uncontrolled ? !e.currentTarget.checked : props.checked,
+ props.uncontrolled ? !e.currentTarget.checked : checked,
props.name,
- props.value
+ value
)
}
aria-required={props.required}
@@ -39,7 +39,7 @@ export function RadioField(props) {
props.error ? " text-error-border-red" : undefined
}`}
htmlFor={props.id}
- onClick={() => props.onChange(props.checked, props.name, props.value)}
+ onClick={() => props.onChange(checked, props.name, value)}
>
{props.label}
@@ -47,11 +47,6 @@ export function RadioField(props) {
);
}
-RadioField.defaultProps = {
- checked: false,
- value: "true",
-};
-
RadioField.propTypes = {
/**
* additional css for the component
diff --git a/components/atoms/SelectField.js b/components/atoms/SelectField.js
index fbac4ca4f0..c0b740c410 100644
--- a/components/atoms/SelectField.js
+++ b/components/atoms/SelectField.js
@@ -2,12 +2,12 @@ import PropTypes from "prop-types";
import { ErrorLabel } from "./ErrorLabel";
import { useTranslation } from "next-i18next";
-export function SelectField(props) {
+export function SelectField({ value = "", ...props }) {
const { t } = useTranslation("common");
const ifControlledProps = !props.uncontrolled
? {
- value: props.value,
+ value: value,
}
: {};
@@ -81,10 +81,6 @@ export function SelectField(props) {
);
}
-SelectField.defaultProps = {
- value: "",
-};
-
SelectField.propTypes = {
/**
* additional css for the component
diff --git a/components/atoms/TextField.js b/components/atoms/TextField.js
index 1942ee1d01..b3df59fa34 100644
--- a/components/atoms/TextField.js
+++ b/components/atoms/TextField.js
@@ -5,12 +5,12 @@ import { useTranslation } from "next-i18next";
/**
* text field component
*/
-export function TextField(props) {
+export function TextField({ value = "", type = "text", ...props }) {
const { t } = useTranslation("common");
const ifControlledProps = !props.uncontrolled
? {
- value: props.value,
+ value: value,
}
: {};
return (
@@ -52,7 +52,7 @@ export function TextField(props) {
aria-describedby={props.describedby}
name={props.name}
placeholder={props.placeholder}
- type={props.type}
+ type={type}
min={props.min}
max={props.max}
step={props.step}
@@ -67,12 +67,6 @@ export function TextField(props) {
);
}
-
-TextField.defaultProps = {
- value: "",
- type: "text",
-};
-
TextField.propTypes = {
/**
* additional css for the component
diff --git a/components/molecules/Collapse.js b/components/molecules/Collapse.js
index 63b9d60386..3fd0ae901e 100644
--- a/components/molecules/Collapse.js
+++ b/components/molecules/Collapse.js
@@ -1,7 +1,7 @@
import PropTypes from "prop-types";
-export function Collapse(props) {
- const { id, title, children } = props;
+export function Collapse({ id = "defaultAccordion", ...props }) {
+ const { title, children } = props;
return (
props.onChange(e.currentTarget.value)}
{...ifControlledProps}
data-testid={props.dataTestId}
data-cy={props.dataCy}
aria-label={props.aria_label}
/>
-
+
- {props.errors.map(({ id, text }) => {
+ {errors.map(({ id, text }) => {
return (
{
if (wasChecked) {
@@ -30,7 +30,7 @@ export function OptionalListField(props) {
});
return (
<>
- {props.controlType === "checkbox" ? (
+ {controlType === "checkbox" ? (
- {props.controlType === "checkbox" && (
+ {controlType === "checkbox" && (
)}
- {props.controlType === "radiofield" && (
+ {controlType === "radiofield" && (
{
- const mode = primary ? 'storybook-button--primary' : 'storybook-button--secondary';
+export const Button = ({
+ primary = false,
+ backgroundColor = null,
+ size = "medium",
+ onClick = undefined,
+ label,
+ ...props
+}) => {
+ const mode = primary
+ ? "storybook-button--primary"
+ : "storybook-button--secondary";
return (