0.0.88 • Published 1 year ago

@bigbinary/neeto-form-engine-frontend v0.0.88

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@bigbinary/neeto-form-engine-frontend

neetoFormEngine-frontend is the library that manages forms across neeto products.

Installation

yarn add @bigbinary/neeto-form-engine-frontend

neetoFormEngine-frontend has a few peer dependencies that are required for the proper functioning of the package. Install all the peer dependencies using the below command:

yarn add @bigbinary/neetoui @bigbinary/neeto-icons ramda@^0.28.0 classnames@^2.3.1 formik@2.2.9

Import stylesheet from the following location:

@import "@bigbinary/neeto-form-engine-frontend/dist/main.css";

Add NeetoFormProvider to the root of your application:

import React from "react";

import { NeetoFormProvider } from "@bigbinary/neeto-form-engine-frontend";

const App = () => {
  return (
    <>
      <NeetoFormProvider>{/* Other children */}</NeetoFormProvider>
    </>
  );
};

Components

BuildForm component is used to render a form builder.

import { BuildForm } from "@bigbinary/neeto-form-engine-frontend";
proptypedescription
isEmbeddedbooleanTo apply styles for embedding
idstringForm id
onUpdatefunctionCallback for form update
buildRequestArgsobjectArguments for build request
showAddQuestionDividerbooleanTo show add question divider
nonRemovableFieldsstring[]Field kinds that cant be deleted from a form. Accepts array of kinds: name, email, phone, rating, checkbox, dropdown
submitButtonPropsobjectProps for submit button
cancelButtonPropsobjectProps for cancel button
requiredFieldsstring[]Fields that are required. Provided fields will be treated as required by default in the External form, the checkbox for toggling required will be hidden for the fields. Accepts array of kinds: name, email, phone, rating, checkbox, dropdown

ExternalForm component is used to render a form.

import { ExternalForm } from "@bigbinary/neeto-form-engine-frontend";
proptypedescription
formIdstringForm id
customSubmitHandlerfunctionCustom submit handler to be called instead of internal submit handlers
onBeforeSubmitfunctionCallback for before form submit
onCreateSuccessfunctionCallback for form creation success
showTitlebooleanTo show form title
submitRequestArgsobjectArguments for form submit request payload
footerReact.ComponentTo render a Footer Component
submitButtonPropsobjectProps for submit button
cancelButtonPropsobjectProps for cancel button
resetButtonPropsobjectProps for reset button
showPrefixIconsbooleanTo show prefix icons in input fields
displayThankYoubooleanTo show thank you message after form submit
classNamestringTo apply custom class to the form wrapper
submissionIdstringTo set submission id for updating the form
previewbooleanTo show form in preview mode
preserveValuesbooleanTo preserve form values in localStorage
formTitlestringTo set form title
titlePropsobjectTo set props for form title
clearValuesOnSubmitbooleanTo clear local storage values on submit
clearValuesOnResetbooleanTo clear local storage values on reset
formDomPropsobjectTo set props for form element

Submission component is used to render a form result.

import { Submission } from "@bigbinary/neeto-form-engine-frontend";
proptypedescription
formIdstringForm id
submissionIdstringSubmission id
classNamestringTo apply custom class component wrapper
questionLabelPropsobjectTo override props for question label
answerPropsobjectTo override props for answer text

Hooks

useBuildFormState hook is used to get the form state.

import {
  useBuildFormState,
  BuildForm,
} from "@bigbinary/neeto-form-engine-frontend";

const FormBuilder = () => {
  const {
    values,
    dirty,
    isSubmitting,
    isValid,
    submitForm,
    resetForm,
    errors,
  } = useBuildFormState();

  return <BuildForm />;
};

useFormSubmission hook is used to fetch the form submission data.

import { useFormSubmission } from "@bigbinary/neeto-form-engine-frontend";

const Component = () => {
  const { submission, isLoading } = useFormSubmission({
    formId: "form-id",
    submissionId: "submission-id",
  });

  return <></>;
};

Development

Install all the dependencies by executing the following command

yarn install

Building

The neetoFormEngine-frontend package gets auto-published to npm for every new merge to the main branch. You can checkout the publish workflow in git actions to get a live update.

Used in

0.0.87

1 year ago

0.0.88

1 year ago

0.0.84

1 year ago

0.0.85

1 year ago

0.0.86

1 year ago

0.0.80

2 years ago

0.0.81

2 years ago

0.0.82

2 years ago

0.0.83

1 year ago

0.0.78

2 years ago

0.0.79

2 years ago

0.0.76

2 years ago

0.0.77

2 years ago

0.0.73

2 years ago

0.0.74

2 years ago

0.0.75

2 years ago

0.0.40

2 years ago

0.0.41

2 years ago

0.0.42

2 years ago

0.0.43

2 years ago

0.0.44

2 years ago

0.0.45

2 years ago

0.0.46

2 years ago

0.0.47

2 years ago

0.0.37

2 years ago

0.0.38

2 years ago

0.0.39

2 years ago

0.0.36

2 years ago

0.0.70

2 years ago

0.0.71

2 years ago

0.0.72

2 years ago

0.0.62

2 years ago

0.0.63

2 years ago

0.0.64

2 years ago

0.0.65

2 years ago

0.0.66

2 years ago

0.0.67

2 years ago

0.0.68

2 years ago

0.0.69

2 years ago

0.0.60

2 years ago

0.0.61

2 years ago

0.0.59

2 years ago

0.0.51

2 years ago

0.0.52

2 years ago

0.0.53

2 years ago

0.0.54

2 years ago

0.0.55

2 years ago

0.0.56

2 years ago

0.0.57

2 years ago

0.0.58

2 years ago

0.0.50

2 years ago

0.0.48

2 years ago

0.0.49

2 years ago

0.0.35

2 years ago

0.0.34

2 years ago

0.0.33

2 years ago

0.0.32

2 years ago

0.0.31

2 years ago

0.0.30

2 years ago

0.0.29

2 years ago

0.0.28

2 years ago

0.0.27

2 years ago

0.0.26

2 years ago

0.0.25

2 years ago

0.0.24

2 years ago

0.0.23

2 years ago

0.0.22

2 years ago

0.0.21

2 years ago

0.0.20

2 years ago

0.0.19

2 years ago

0.0.18

2 years ago

0.0.17

2 years ago

0.0.16

2 years ago

0.0.15

2 years ago

0.0.14

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.10

2 years ago

0.0.0

2 years ago