From 5095ed73653b80661111aa326cd6896521ac4401 Mon Sep 17 00:00:00 2001
From: Vitalii Kiiko
{emptyText}
} + chooseLabel={chooseLabel} + cancelLabel={__('Cancella', 'gepafin')} + uploadLabel={__('Carica', 'gepafin')} + className={classNames({ 'p-invalid': errors[fieldName] })} + itemTemplate={itemTemplate} + customUpload + uploadHandler={customBase64Uploader}/> {infoText ? {infoText} : null} - {defaultValue ?Uploaded:
: null} - {defaultValue} >) } diff --git a/src/components/FormField/components/Switch/index.js b/src/components/FormField/components/Switch/index.js new file mode 100644 index 0000000..eb5fb8d --- /dev/null +++ b/src/components/FormField/components/Switch/index.js @@ -0,0 +1,49 @@ +import React from 'react'; +import { classNames } from 'primereact/utils'; +import { Controller } from 'react-hook-form'; +import { isNil, isEmpty } from 'ramda'; + +// components +import { InputSwitch } from 'primereact/inputswitch'; + +const Switch = ({ + fieldName, + label, + control, + errors, + defaultValue, + config = {}, + infoText = null, + onLabel = '', + offLabel = '' + }) => { + const properValue = !isNil(defaultValue) && !isEmpty(defaultValue) && defaultValue !== false; + + const input =+ Form fields here +
+