Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,6 @@ dist

# TernJS port file
.tern-port

# Storybook build output
storybook-static/
18 changes: 17 additions & 1 deletion .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,21 @@ module.exports = {

docs: {
autodocs: true
}
},

webpackFinal: async (config) => {
config.module.rules.push({
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env', '@babel/preset-react'],
},
},
});

return config;
},

}
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const YourApp = () => {

| Prop | Default | Required (if applicable) | Description |
|---------------|---------|-------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| formURL | - | Yes | URL The URL of your Jotform Form, obtainable from Jotform Form Builder's Publish page. Example: Example: https://form.jotform.com/211272589254055 |
| formURL | - | Yes | URL The URL of your Jotform Form, obtainable from Jotform Form Builder's Publish page. Example: Example: https://form.jotform.com/211272589254055.\ Or use a Prefilled URL. Example: https://form.jotform.com/211272589254055?name[first]=John&name[last]=Doe |
| autoResize | true | No | If true, the form will automatically resize as needed (e.g., for multi-page forms). Set to false to disable auto-resizing. |
| autoFocus | true | No | If true, the form will automatically scroll into view as needed. Set to false to disable this behavior. |
| heightOffset | 15 | No | The number of pixels added to the form's height to prevent browser-specific scroll issues. |
Expand All @@ -78,9 +78,23 @@ const YourApp = () => {
| onSubmit | - | No | A callback function to execute when the form submission is successful. |
| ...rest | | No | You can directly set any other prop, such as styles, to the iframe element |

### Testing With Storybook
Using Storybook, you can customize and test the Jotform React Embed component in isolation. To run the Storybook, use the following commands:

```
npx storybook build

npx run storybook
```

## Changelog

### 1.1.2

- Documentation update
- Storybook update
- Updated dependencies

### 1.1.1

- Documentation update
Expand Down
1 change: 1 addition & 0 deletions lib/JotFormReact.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const JotFormEmbed = ({
if (!content) { return; }
// Check if submission is completed.
if (typeof content.data === 'object' && content.data.action === 'submission-completed') {

onSubmit();
return;
}
Expand Down
Loading