diff --git a/modules/ppcp-settings/resources/js/Components/ReusableComponents/Fields.js b/modules/ppcp-settings/resources/js/Components/ReusableComponents/Fields.js
deleted file mode 100644
index d979cffba..000000000
--- a/modules/ppcp-settings/resources/js/Components/ReusableComponents/Fields.js
+++ /dev/null
@@ -1,138 +0,0 @@
-import { CheckboxControl } from '@wordpress/components';
-import classNames from 'classnames';
-
-export const PayPalCheckbox = ( {
- currentValue,
- label,
- value,
- checked = null,
- disabled = null,
- changeCallback,
-} ) => {
- let isChecked = checked;
-
- if ( null === isChecked ) {
- if ( Array.isArray( currentValue ) ) {
- isChecked = currentValue.includes( value );
- } else {
- isChecked = currentValue;
- }
- }
-
- const className = classNames( { 'is-disabled': disabled } );
-
- const onChange = ( newState ) => {
- let newValue;
-
- if ( ! Array.isArray( currentValue ) ) {
- newValue = newState;
- } else if ( newState ) {
- newValue = [ ...currentValue, value ];
- } else {
- newValue = currentValue.filter(
- ( optionValue ) => optionValue !== value
- );
- }
-
- changeCallback( newValue );
- };
-
- return (
-
- );
-};
-
-export const CheckboxGroup = ( { options, value, onChange } ) => (
- <>
- { options.map( ( checkbox ) => (
-
- ) ) }
- >
-);
-
-export const PayPalRdb = ( {
- id,
- name,
- value,
- currentValue,
- handleRdbState,
-} ) => {
- return (
-
- { /* todo: Can we remove the wrapper div? */ }
- handleRdbState( value ) }
- />
-
-
- );
-};
-
-export const PayPalRdbWithContent = ( {
- className,
- id,
- name,
- label,
- description,
- value,
- currentValue,
- handleRdbState,
- toggleAdditionalContent,
- children,
-} ) => {
- const wrapperClasses = classNames( 'ppcp-r__radio-wrapper', className );
-
- return (
-
-
-
-
-
-
- { description && (
-
- ) }
-
-
- { toggleAdditionalContent && children && value === currentValue && (
-
- { children }
-
- ) }
-
- );
-};
diff --git a/modules/ppcp-settings/resources/js/Components/ReusableComponents/Fields/Checkbox.js b/modules/ppcp-settings/resources/js/Components/ReusableComponents/Fields/Checkbox.js
new file mode 100644
index 000000000..a39e3d101
--- /dev/null
+++ b/modules/ppcp-settings/resources/js/Components/ReusableComponents/Fields/Checkbox.js
@@ -0,0 +1,52 @@
+import { CheckboxControl } from '@wordpress/components';
+import classNames from 'classnames';
+
+const Checkbox = ( {
+ currentValue,
+ label,
+ value,
+ checked = null,
+ disabled = null,
+ changeCallback,
+} ) => {
+ let isChecked = checked;
+
+ if ( null === isChecked ) {
+ if ( Array.isArray( currentValue ) ) {
+ isChecked = currentValue.includes( value );
+ } else {
+ isChecked = currentValue;
+ }
+ }
+
+ const className = classNames( { 'is-disabled': disabled } );
+
+ const onChange = ( newState ) => {
+ let newValue;
+
+ if ( ! Array.isArray( currentValue ) ) {
+ newValue = newState;
+ } else if ( newState ) {
+ newValue = [ ...currentValue, value ];
+ } else {
+ newValue = currentValue.filter(
+ ( optionValue ) => optionValue !== value
+ );
+ }
+
+ changeCallback( newValue );
+ };
+
+ return (
+
+ );
+};
+
+export default Checkbox;
diff --git a/modules/ppcp-settings/resources/js/Components/ReusableComponents/Fields/CheckboxGroup.js b/modules/ppcp-settings/resources/js/Components/ReusableComponents/Fields/CheckboxGroup.js
new file mode 100644
index 000000000..27fc16f9e
--- /dev/null
+++ b/modules/ppcp-settings/resources/js/Components/ReusableComponents/Fields/CheckboxGroup.js
@@ -0,0 +1,21 @@
+import { PayPalCheckbox } from './index';
+
+const CheckboxGroup = ( { options, value, onChange } ) => (
+ <>
+ { options.map( ( checkbox ) => (
+
+ ) ) }
+ >
+);
+
+export default CheckboxGroup;
diff --git a/modules/ppcp-settings/resources/js/Components/ReusableComponents/Fields/RadioButton.js b/modules/ppcp-settings/resources/js/Components/ReusableComponents/Fields/RadioButton.js
new file mode 100644
index 000000000..85b019fde
--- /dev/null
+++ b/modules/ppcp-settings/resources/js/Components/ReusableComponents/Fields/RadioButton.js
@@ -0,0 +1,19 @@
+const RadioButton = ( { id, name, value, currentValue, handleRdbState } ) => {
+ return (
+
+ { /* todo: Can we remove the wrapper div? */ }
+ handleRdbState( value ) }
+ />
+
+
+ );
+};
+
+export default RadioButton;
diff --git a/modules/ppcp-settings/resources/js/Components/ReusableComponents/Fields/RadioContent.js b/modules/ppcp-settings/resources/js/Components/ReusableComponents/Fields/RadioContent.js
new file mode 100644
index 000000000..59bfc3c31
--- /dev/null
+++ b/modules/ppcp-settings/resources/js/Components/ReusableComponents/Fields/RadioContent.js
@@ -0,0 +1,50 @@
+import classNames from 'classnames';
+import { PayPalRdb } from './index';
+
+const RadioButtonWithContent = ( {
+ className,
+ id,
+ name,
+ label,
+ description,
+ value,
+ currentValue,
+ handleRdbState,
+ toggleAdditionalContent,
+ children,
+} ) => {
+ const wrapperClasses = classNames( 'ppcp-r__radio-wrapper', className );
+
+ return (
+
+
+
+
+
+
+ { description && (
+
+ ) }
+
+
+ { toggleAdditionalContent && children && value === currentValue && (
+
+ { children }
+
+ ) }
+
+ );
+};
+
+export default RadioButtonWithContent;
diff --git a/modules/ppcp-settings/resources/js/Components/ReusableComponents/Fields/index.js b/modules/ppcp-settings/resources/js/Components/ReusableComponents/Fields/index.js
new file mode 100644
index 000000000..57af7d8dd
--- /dev/null
+++ b/modules/ppcp-settings/resources/js/Components/ReusableComponents/Fields/index.js
@@ -0,0 +1,8 @@
+/**
+ * Generic input fields.
+ */
+
+export { default as PayPalCheckbox } from './Checkbox';
+export { default as CheckboxGroup } from './CheckboxGroup';
+export { default as PayPalRdb } from './RadioButton';
+export { default as PayPalRdbWithContent } from './RadioContent';