Skip to content

Commit 3df6c4a

Browse files
committed
refactor(react-formio): migrate to esm and vitest
1 parent 44c6ca8 commit 3df6c4a

File tree

203 files changed

+10519
-1719
lines changed

Some content is hidden

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

203 files changed

+10519
-1719
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ storybook-static
5454
.DS_Store
5555
.nyc_output
5656
/docs/.vuepress/dist/
57-
/packages/tailwind/COLORS.JSON
5857

5958
# Yarn
6059
.pnp.*

.storybook/main.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { StorybookConfig } from "@storybook/react-vite";
22

33
const config: StorybookConfig = {
4-
staticDirs: ["../packages/tailwind/build"],
4+
staticDirs: ["../packages/tailwind-formio/build"],
55

66
stories: [
77
"../stories/Getting-started.mdx",

commitlint.config.cjs

-1
This file was deleted.

commitlint.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default { extends: ["@commitlint/config-conventional"] };

package.json

+11-12
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"build": "monorepo build --verbose",
2323
"publish": "monorepo publish --dry-run",
2424
"start": "lerna run start --stream --parallel",
25-
"tailwind:build": "lerna run tailwind:build --stream --scope @tsed/tailwind",
25+
"tailwind:build": "lerna run tailwind:build --stream --scope @tsed/tailwind-formio",
2626
"release": "semantic-release",
2727
"prepare": "is-ci || husky install",
2828
"storybook:test": "yarn test-storybook",
@@ -46,10 +46,11 @@
4646
"@types/react-router-dom": "^5.3.3",
4747
"@types/react-table": "^7.7.14",
4848
"connected-react-router": "6.9.1",
49-
"formiojs": "^4.14.13",
49+
"formiojs": "4.21.6",
5050
"history": "5.3.0",
5151
"lerna": "8.1.2",
5252
"lodash": "4.17.21",
53+
"nodemon": "3.1.9",
5354
"react": "^18.2.0",
5455
"react-dom": "^18.2.0",
5556
"react-redux": "7.2.6",
@@ -76,11 +77,11 @@
7677
"@storybook/test-runner": "0.21.0",
7778
"@swc/core": "^1.2.208",
7879
"@swc/jest": "^0.2.21",
79-
"@testing-library/dom": "^8.14.0",
80-
"@testing-library/jest-dom": "^5.16.4",
81-
"@testing-library/react": "^12.1.5",
82-
"@testing-library/user-event": "^14.2.1",
83-
"@tsed/monorepo-utils": "2.1.2",
80+
"@testing-library/dom": "10.4.0",
81+
"@testing-library/jest-dom": "6.5.0",
82+
"@testing-library/react": "16.1.0",
83+
"@testing-library/user-event": "14.5.2",
84+
"@tsed/monorepo-utils": "2.3.10",
8485
"@types/ejs": "^3.0.5",
8586
"@types/jest": "27.0.2",
8687
"@types/lodash": "4.14.168",
@@ -108,19 +109,17 @@
108109
"eslint-plugin-workspaces": "0.10.1",
109110
"fs-extra": "10.1.0",
110111
"globby": "^14.0.2",
111-
"happy-dom": "^16.0.0",
112112
"husky": "^8.0.1",
113+
"jsdom": "25.0.1",
113114
"lint-staged": "13.0.3",
114-
"microbundle": "0.13.0",
115115
"playwright": "1.49.1",
116116
"postcss": "8.4.49",
117117
"postcss-nested": "7.0.2",
118118
"postcss-normalize": "13.0.1",
119119
"prettier": "3.4.2",
120120
"prop-types": "^15.8.1",
121-
"react": "^18.2.0",
122-
"react-dom": "^18.2.0",
123-
"react-svg": "10.0.23",
121+
"react": "18.3.1",
122+
"react-dom": "18.3.1",
124123
"rimraf": "^3.0.2",
125124
"rollup-preserve-directives": "^1.1.3",
126125
"semantic-release": "23.0.5",

packages/integration/index.html

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Vite + React + TS</title>
8+
</head>
9+
<body>
10+
<div id="root"></div>
11+
<script type="module" src="/src/main.tsx"></script>
12+
</body>
13+
</html>

packages/integration/package.json

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"name": "@tsed/react-formio-integration",
3+
"version": "2.3.2",
4+
"description": "",
5+
"private": true,
6+
"type": "module",
7+
"license": "MIT",
8+
"scripts": {
9+
"build": "vite build",
10+
"dev": "vite dev"
11+
},
12+
"dependencies": {
13+
"classnames": "^2.3.1",
14+
"eventemitter2": "^6.4.3",
15+
"prop-types": "15.8.1"
16+
},
17+
"peerDependencies": {
18+
"@formio/choices.js": ">=9.0.1",
19+
"formiojs": ">=4.0.0",
20+
"lodash": ">=4.17.20",
21+
"prop-types": ">=15.7.2",
22+
"react": ">=16.14.0",
23+
"react-dnd": ">=16.0.1",
24+
"react-dnd-html5-backend": ">=16.0.1",
25+
"react-dom": ">=16.14.0",
26+
"react-table": ">=7.6.3",
27+
"tooltip.js": ">=1.3.3"
28+
},
29+
"devDependencies": {
30+
"@tsed/tailwind-formio": "workspace:*",
31+
"@tsed/typescript": "workspace:*",
32+
"microbundle": "0.13.0",
33+
"vite": "5.4.11",
34+
"vitest": "2.1.8"
35+
}
36+
}
+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export default {
2+
plugins: {
3+
"postcss-normalize": {},
4+
"tailwindcss/nesting": {},
5+
tailwindcss: {},
6+
autoprefixer: {}
7+
}
8+
};

packages/integration/public/vite.svg

+1
Loading

packages/integration/src/App.tsx

+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
import { defaultDisplayChoices, FormEdit } from "@tsed/react-formio";
2+
3+
const opts: any = {
4+
typeChoices: [
5+
{ label: "Form", value: "form" },
6+
{ label: "Resources", value: "resource" }
7+
],
8+
displayChoices: defaultDisplayChoices,
9+
enableTags: true,
10+
// options: { template: "tailwind", iconset: "bx" },
11+
form: {
12+
type: "form",
13+
tags: [],
14+
owner: "5d0797a382461b6656d2c790",
15+
components: [
16+
{
17+
label: "Text Field",
18+
labelPosition: "top",
19+
placeholder: "",
20+
description: "",
21+
tooltip: "",
22+
prefix: "",
23+
suffix: "",
24+
widget: { type: "input" },
25+
inputMask: "",
26+
allowMultipleMasks: false,
27+
customClass: "",
28+
tabindex: "",
29+
autocomplete: "",
30+
hidden: false,
31+
hideLabel: false,
32+
showWordCount: false,
33+
showCharCount: false,
34+
mask: false,
35+
autofocus: false,
36+
spellcheck: true,
37+
disabled: false,
38+
tableView: true,
39+
modalEdit: false,
40+
multiple: false,
41+
persistent: true,
42+
inputFormat: "plain",
43+
protected: false,
44+
dbIndex: false,
45+
case: "",
46+
encrypted: false,
47+
redrawOn: "",
48+
clearOnHide: true,
49+
customDefaultValue: "",
50+
calculateValue: "",
51+
calculateServer: false,
52+
allowCalculateOverride: false,
53+
validateOn: "change",
54+
validate: {
55+
required: true,
56+
pattern: "",
57+
customMessage: "",
58+
custom: "",
59+
customPrivate: false,
60+
json: "",
61+
minLength: "",
62+
maxLength: "",
63+
strictDateValidation: false,
64+
multiple: false,
65+
unique: false
66+
},
67+
unique: false,
68+
errorLabel: "",
69+
key: "textField",
70+
tags: [],
71+
properties: {},
72+
conditional: { show: null, when: null, eq: "", json: "" },
73+
customConditional: "",
74+
logic: [],
75+
attributes: {},
76+
overlay: {
77+
style: "",
78+
page: "",
79+
left: "",
80+
top: "",
81+
width: "",
82+
height: ""
83+
},
84+
type: "textfield",
85+
input: true,
86+
refreshOn: "",
87+
inputType: "text",
88+
id: "eqb1o4r",
89+
defaultValue: ""
90+
}
91+
],
92+
title: "text-field",
93+
display: "form",
94+
access: [
95+
{
96+
roles: ["5d0797bc872fc747da559858", "5d0797bc872fc71d05559859", "5d0797bc872fc7da3b55985a"],
97+
type: "read_all"
98+
}
99+
],
100+
submissionAccess: [],
101+
controller: "",
102+
properties: {},
103+
settings: {},
104+
name: "textField",
105+
path: "textfield",
106+
machineName: "tcspjwhsevrzpcd:textField"
107+
}
108+
};
109+
110+
function App() {
111+
return (
112+
<div className='p-8'>
113+
<FormEdit {...opts} />
114+
</div>
115+
);
116+
}
117+
118+
export default App;
Loading

packages/integration/src/main.tsx

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import "./styles/index.css";
2+
3+
import { Formio, Templates } from "@tsed/react-formio";
4+
import tailwind from "@tsed/tailwind-formio";
5+
import { StrictMode } from "react";
6+
import { createRoot } from "react-dom/client";
7+
8+
import App from "./App";
9+
10+
// eslint-disable-next-line react-hooks/rules-of-hooks
11+
Formio.use(tailwind);
12+
Templates.framework = "tailwind";
13+
14+
createRoot(document.getElementById("root")!).render(
15+
<StrictMode>
16+
<App />
17+
</StrictMode>
18+
);

0 commit comments

Comments
 (0)