Skip to content

Commit b315510

Browse files
committed
docs: update storybook
1 parent f4b9f71 commit b315510

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+9520
-12756
lines changed

.github/workflows/build.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
strategy:
1616
matrix:
17-
node-version: [16.x]
17+
node-version: [18.x]
1818

1919
steps:
2020
- uses: actions/checkout@v2
@@ -33,7 +33,7 @@ jobs:
3333
strategy:
3434
matrix:
3535
os: [ubuntu-latest]
36-
node-version: [16.x]
36+
node-version: [18.x]
3737

3838
steps:
3939
- uses: actions/checkout@v2
@@ -53,7 +53,7 @@ jobs:
5353

5454
strategy:
5555
matrix:
56-
node-version: [16.x]
56+
node-version: [18.x]
5757

5858
steps:
5959
- uses: actions/checkout@v2
@@ -84,7 +84,7 @@ jobs:
8484

8585
strategy:
8686
matrix:
87-
node-version: [14.x]
87+
node-version: [18.x]
8888

8989
steps:
9090
- uses: actions/checkout@v2

.github/workflows/website.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3+
4+
name: Website
5+
6+
on:
7+
workflow_dispatch:
8+
9+
jobs:
10+
publish-pages:
11+
runs-on: ubuntu-latest
12+
needs: deploy-packages
13+
if: ${{ github.event_name != 'pull_request' && (contains(github.ref, 'master') || contains(github.ref, 'alpha') || contains(github.ref, 'beta') || contains(github.ref, 'rc')) }}
14+
15+
strategy:
16+
matrix:
17+
node-version: [18.x]
18+
19+
steps:
20+
- uses: actions/checkout@v2
21+
- name: Use Node.js ${{ matrix.node-version }}
22+
uses: actions/setup-node@v1
23+
with:
24+
node-version: ${{ matrix.node-version }}
25+
- name: Install dependencies
26+
run: yarn install --frozen-lockfile
27+
- name: Release packages
28+
env:
29+
CI: true
30+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
31+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
32+
run: yarn publish:storybook

package.json

+12-9
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
"@testing-library/jest-dom": "^5.16.4",
6666
"@testing-library/react": "^12.1.5",
6767
"@testing-library/user-event": "^14.2.1",
68-
"@tsed/monorepo-utils": "1.17.8",
68+
"@tsed/monorepo-utils": "^1.22.6",
6969
"@types/ejs": "^3.0.5",
7070
"@types/jest": "27.0.2",
7171
"@types/lodash": "4.14.168",
@@ -104,9 +104,9 @@
104104
"prettier": "^2.6.2",
105105
"prettier-eslint": "^14.0.3",
106106
"rimraf": "^3.0.2",
107-
"semantic-release": "19.0.3",
107+
"semantic-release": "21.0.2",
108108
"semantic-release-slack-bot": "3.5.3",
109-
"typescript": "5.1.3",
109+
"typescript": "4.9.5",
110110
"webpack": "4.44.2"
111111
},
112112
"workspaces": {
@@ -118,11 +118,14 @@
118118
"productionBranch": "master",
119119
"developBranch": "master",
120120
"npmAccess": "public",
121-
"ghpages": {
122-
"dir": "./packages/tailwind-formio/.out",
123-
"url": "https://github.com/TypedProject/tsed-formio.git",
124-
"branch": "gh-pages",
125-
"cname": "formio.tsed.io"
126-
}
121+
"ghpages": [
122+
{
123+
"dir": "./packages/storybook/.out",
124+
"url": "https://github.com/tsedio/tsed-formio.git",
125+
"branch": "gh-pages",
126+
"cname": "formio.tsed.io",
127+
"if": "production"
128+
}
129+
]
127130
}
128131
}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"statements": 2.29,
33
"branches": 0.44,
4-
"functions": 3.17,
4+
"functions": 2.56,
55
"lines": 2.43
66
}

packages/react-formio/coverage.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"statements": 56.11,
3-
"branches": 46.65,
4-
"functions": 51.31,
5-
"lines": 56.1
2+
"statements": 56.02,
3+
"branches": 46.56,
4+
"functions": 48.33,
5+
"lines": 56.04
66
}

packages/react-formio/package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
},
1717
"dependencies": {
1818
"eventemitter2": "^6.4.3",
19-
"prop-types": "^15.7.2"
19+
"prop-types": "^15.7.2",
20+
"classnames": "^2.3.1"
2021
},
2122
"peerDependencies": {
2223
"@formio/choices.js": ">=9.0.1",
@@ -34,4 +35,4 @@
3435
"@tsed/tailwind": "2.1.2",
3536
"@tsed/tailwind-formio": "2.1.2"
3637
}
37-
}
38+
}

packages/react-formio/readme.md

+17-195
Original file line numberDiff line numberDiff line change
@@ -31,24 +31,25 @@ platform.
3131
This module is based on the original [react-formio](https://github.com/formio/react-formio) and add extra features
3232
listed above.
3333

34-
See our [storybook](https://formio.tsed.io/) to see all available components.
34+
See our [storybook](https://formio.tsed.io/?path=/docs/getting-started--docs) to see all available components.
3535

3636
## Features
3737

38-
- Many components are provided to build your own backoffice based on Formio.js API:
39-
- [ActionsTable](https://formio.tsed.io/?path=/story/reactformio-actionstable--sandbox),
40-
- [FormAccess](https://formio.tsed.io/?path=/story/reactformio-formaccess--sandbox),
41-
- [FormAction](https://formio.tsed.io/?path=/story/reactformio-formaction--sandbox),
42-
- [Form](https://formio.tsed.io/?path=/story/reactformio-form--sandbox),
43-
- [FormBuilder](https://formio.tsed.io/?path=/story/reactformio-formbuilder--sandbox),
44-
- [FormEdit](https://formio.tsed.io/?path=/story/reactformio-formedit--sandbox),
45-
- [FormsTable](https://formio.tsed.io/?path=/story/reactformio-formstable--sandbox),
46-
- [InputTags](https://formio.tsed.io/?path=/story/reactformio-inputtags--sandbox),
47-
- [InputText](https://formio.tsed.io/?path=/story/reactformio-inputtext--sandbox),
48-
- [Pagination](https://formio.tsed.io/?path=/story/reactformio-pagination--sandbox),
49-
- [Select](https://formio.tsed.io/?path=/story/reactformio-select--sandbox),
50-
- [SubmissionsTable](https://formio.tsed.io/?path=/story/reactformio-subssionsstable--sandbox).
51-
- [Table](https://formio.tsed.io/?path=/story/reactformio-table--sandbox),
38+
Many components are provided to build your own backoffice based on Formio.js API:
39+
40+
- [ActionsTable](https://formio.tsed.io/?path=story/reactformio-actionstable--sandbox),
41+
- [FormAccess](https://formio.tsed.io/?path=story/reactformio-formaccess--sandbox),
42+
- [FormAction](https://formio.tsed.io/?path=story/reactformio-formaction--sandbox),
43+
- [Form](https://formio.tsed.io/?path=docs/documentation-form--docs),
44+
- [FormBuilder](https://formio.tsed.io/?path=docs/documentation-formbuilder--docs),
45+
- [FormEdit](https://formio.tsed.io/?path=docs/documentation-formedit--docs),
46+
- [FormsTable](https://formio.tsed.io/?path=docs/documentation-formstable--docs),
47+
- [InputTags](https://formio.tsed.io/?path=story/reactformio-inputtags--sandbox),
48+
- [InputText](https://formio.tsed.io/?path=story/reactformio-inputtext--sandbox),
49+
- [Pagination](https://formio.tsed.io/?path=story/reactformio-pagination--sandbox),
50+
- [Select](https://formio.tsed.io/?path=/story/reactformio-select--sandbox),
51+
- [SubmissionsTable](https://formio.tsed.io/?path=/docs/documentation-submissionstable--docs).
52+
- [Table](https://formio.tsed.io/?path=/story/reactformio-table--sandbox),
5253
- Predefined Reducers for Actions, Action, Form, Forms, Submission, Submissions, etc...,
5354
- TypeScript support.
5455
- Tailwind support.
@@ -90,186 +91,7 @@ function App() {
9091
export default App;
9192
```
9293

93-
## Components
94-
95-
### Form
96-
97-
The form component is the primary component of the system. It is what takes the form definition (json) and renders the
98-
form into html. There are multiple ways to send the form to the Form component. The two main ways are to pass the `src`
99-
prop with a url to the form definition, usually a form.io server. The other is to pass the `form` prop with the json
100-
definition and optionally a `url` prop with the location of the form.
101-
102-
#### Props
103-
104-
| Name | Type | Default | Description |
105-
| ------------ | ------ | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
106-
| `src` | url | | The url of the form definition. This is commonly from a form.io server. When using src, the form will automatically submit the data to that url as well. |
107-
| `url` | url | | The url of the form definition. The form will not be loaded from this url and the submission will not be saved here either. This is used for file upload, oauth and other components or actions that need to know where the server is. Use this in connection with `form` |
108-
| `form` | object | | Instead of loading a form from the `src` url, you can preload the form definition and pass it in with the `form` prop. You should also set `url` if you are using any advanced components like file upload or oauth. |
109-
| `submission` | object | | Submission data to fill the form. You can either load a previous submission or create a submission with some pre-filled data. If you do not provide a submissions the form will initialize an empty submission using default values from the form. |
110-
| `options` | object | | an options object that can pass options to the formio.js Form that is rendered. You can set options such as `readOnly`, `noAlerts` or `hide`. There are [many options to be found in the formio.js library](https://github.com/formio/formio.js/wiki/Form-Renderer#options). |
111-
112-
#### Event Props
113-
114-
You can respond to various events in the form. Simply pass in a prop with a function for one of these events.
115-
116-
| Name | Parameters | Description |
117-
| --------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
118-
| `onAsyncSubmit` | `submission`: object | When the submit button is pressed and the submission has started. Use this event if you submit data to external service. |
119-
| `onSubmit` | `submission`: object | When the submit button is pressed and the submission has started. If `src` is not provided, this will be the final submit event. |
120-
| `onSubmitDone` | `submission`: object | When the submission has successfully been made to the server. This will only fire if `src` is set. |
121-
| `onChange` | `submission`: object, `submission.changed`: object of what changed, `submission.isValid`: boolean - if the submission passes validations. | A value in the submission has changed. |
122-
| `onError` | `errors`: array or string or boolean | Called when an error occurs during submission such as a validation issue. |
123-
| `onRender` | | Triggers when the form is finished rendering. |
124-
| `onCustomEvent` | { `type`: string - event type, `component`: object - triggering component, `data`: object - data for component, `event`: string - raw event } | Event that is triggered from a button configured with "Event" type. |
125-
| `onPrevPage` | { `page`: integer - new page number, `submission`: object - submission data } | Triggered for wizards when "Previous" button is pressed |
126-
| `onNextPage` | { `page`: integer - new page number, `submission`: object - submission data } | Triggered for wizards when "Next" button is pressed |
127-
| `onFormReady` | `formInstance`: Webform/Wizard - form class instance | Called when the form gets ready state |
128-
129-
#### Example
130-
131-
##### With src/url
132-
133-
Give `Form` a `src` property and render:
134-
135-
```tsx
136-
import React from "react";
137-
import ReactDOM from "react-dom";
138-
import { Form } from "@tsed/react-formio";
139-
140-
ReactDOM.render(<Form src='https://example.form.io/example' onSubmit={console.log} />, document.getElementById("example"));
141-
```
142-
143-
##### With form
144-
145-
Give `Form` a `src` property and render:
146-
147-
```tsx
148-
import React from "react";
149-
import ReactDOM from "react-dom";
150-
import { Form } from "@tsed/react-formio";
151-
152-
interface MyFormData {
153-
title: string;
154-
}
155-
156-
const form = {
157-
display: "form",
158-
components: [
159-
{
160-
key: "title",
161-
type: "textfield"
162-
}
163-
]
164-
};
165-
166-
ReactDOM.render(
167-
<Form<MyFormData>
168-
form={form}
169-
onAsyncSubmit={(submission) => {
170-
return httpClient.post("/path/to/external/service", { data: submission }).catch((er) => {
171-
err.errors = [
172-
{
173-
message: "My custom message about this field",
174-
type: "custom",
175-
path: ["title"],
176-
level: "error"
177-
}
178-
];
179-
throw error;
180-
});
181-
}}
182-
/>,
183-
document.getElementById("example")
184-
);
185-
```
186-
187-
> See [Form with error from server](https://formio.tsed.io/?path=/story/reactformio-form--trigger-error)
188-
189-
### FormBuilder
190-
191-
The [FormBuilder](https://formio.tsed.io/?path=/story/reactformio-formbuilder--sandbox)) class can be
192-
used
193-
to embed a form builder directly in your react application.
194-
Please note that you'll need to include the CSS for the form builder from formio.js as well.
195-
196-
Please note that the [FormBuilder](<[FormsTable](https://formio.tsed.io/?path=/story/reactformio-formbuilder--sandbox)>)
197-
component
198-
does not load and save from/to a url. You must handle the form definition loading and saving yourself or use
199-
the [FormEdit](https://formio.tsed.io/?path=/story/reactformio-formedit--sandbox) component.
200-
201-
#### Props
202-
203-
| Name | Type | Default | Description |
204-
| --------- | ------ | ------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
205-
| `form` | object | | This is the form definition object. It should at least have a `display` property set to form, wizard or pdf. |
206-
| `options` | object | | an options object that can pass options to the formio.js Form that is rendered. There are many options to be found in the formio.js library. |
207-
208-
#### Event Props
209-
210-
| Name | Parameters | Description |
211-
| ------------------- | ------------------- | ---------------------------------------------------------------- |
212-
| `onChange` | `schema`: object | Triggered any time the form definition changes |
213-
| `onEditComponent` | `component`: object | Triggered when the component settings dialog is opened |
214-
| `onSaveComponent` | `component`: object | Triggered when the component settings dialog is saved and closed |
215-
| `onCancelComponent` | `component`: object | Triggered when the component settings dialog is cancelled |
216-
| `onDeleteComponent` | `component`: object | Triggered when a component is removed from the form |
217-
| `onUpdateComponent` | `component`: object | Triggered when a component is added or moved in the form |
218-
219-
#### Example
220-
221-
```tsx
222-
import React from "react";
223-
import ReactDOM from "react-dom";
224-
import { FormBuilder } from "@tsed/react-formio";
225-
226-
ReactDOM.render(<FormBuilder form={{ display: "form" }} onChange={(schema) => console.log(schema)} />, document.getElementById("builder"));
227-
```
228-
229-
### FormEdit
230-
231-
The [FormEdit](https://formio.tsed.io/?path=/story/reactformio-formedit--sandbox) component wraps
232-
the [FormBuilder](<[FormsTable](https://formio.tsed.io/?path=/story/reactformio-formbuilder--sandbox)>) component and
233-
adds the title, display, name and path fields at the top along with a save button.
234-
235-
#### Props
236-
237-
| Name | Type | Default | Description |
238-
| --------------------------------------------------------------- | ------ | ------------------- | ----------- | --------------------------------------------------------------- |
239-
| --------------------------------------------------------------- |
240-
| `form` | object | {display: 'form' \ | 'wizard'} | The form definition of the exiting form that is to be modified. |
241-
242-
|
243-
| `options` | object | {} | The options to be passed to FormBuilder |
244-
| `saveText` | string | '' | The string that will be displayed in the save-button |
245-
246-
#### Event Props
247-
248-
| Name | Parameters | Description |
249-
| ---------- | ---------- | -------------------------------------------------------------------------------------- |
250-
| `onSubmit` | form | Called when the save button is pressed. Will pass the form definition to the callback. |
251-
252-
### FormsTable
253-
254-
The [FormsTable](https://formio.tsed.io/?path=/story/reactformio-formstable--sandbox) component can be used to render a
255-
list of forms with buttons to edit, view, delete, etc on each row.
256-
257-
#### Props
258-
259-
| Name | Type | Default | Description |
260-
| ------ | -------------- | ------- | ------------------------------------------- |
261-
| `data` | array of forms | [] | A list of forms to be rendered in the grid. |
262-
263-
### SubmissionsTable
264-
265-
The submisison grid will render a list of submissions and allow clicking on one row to select it.
266-
267-
#### Props
268-
269-
| Name | Type | Default | Description |
270-
| ------ | -------------------- | ------- | -------------------------------------------------------------------------------- |
271-
| `data` | array of submissions | [] | A list of submissions to be rendered in the grid. |
272-
| `form` | object | {} | The form definition for the submissions. This is used to render the submissions. |
94+
See more on http://formio.tsed.io/?path=/docs/getting-started--docs
27395

27496
## Contributors
27597

0 commit comments

Comments
 (0)