diff --git a/.eslintrc.js b/.eslintrc.cjs
similarity index 100%
rename from .eslintrc.js
rename to .eslintrc.cjs
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 3471ccc5..d69816e2 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -52,13 +52,13 @@ jobs:
- name: Install dependencies 🚀
run: yarn install --immutable
- name: Install Playwright 🚀
- run: cd packages/storybook && yarn playwright install
+ run: yarn playwright install
- name: Build Storybook
run: yarn storybook:build --quiet
- name: Serve Storybook and run tests 🔍
run: |
npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \
- "npx http-server packages/storybook/.out --port 6006 --silent" \
+ "npx http-server storybook-static --port 6006 --silent" \
"npx wait-on tcp:6006 && yarn storybook:test:ci"
deploy-packages:
diff --git a/.github/workflows/chromatic.yml b/.github/workflows/chromatic.yml
index 643f8193..6265843f 100644
--- a/.github/workflows/chromatic.yml
+++ b/.github/workflows/chromatic.yml
@@ -20,9 +20,13 @@ jobs:
- name: Install dependencies
run: yarn install --immutable
+ - name: Build tailwind
+ run: yarn tailwind:build
+
- name: Run Chromatic
uses: chromaui/action@latest
with:
- workingDir: packages/storybook
+ storybookBaseDir: .
+ storybookConfigDir: ./.storybook
# ⚠️ Make sure to configure a `CHROMATIC_PROJECT_TOKEN` repository secret
projectToken: ${{ secrets.CHROMATIC_TOKEN }}
diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml
index 81bafe9a..f1854956 100644
--- a/.github/workflows/website.yml
+++ b/.github/workflows/website.yml
@@ -44,12 +44,12 @@ jobs:
- name: Build with Storybook
run: |
yarn storybook:build
- touch packages/storybook/.out/.nojekyll
- echo "formio.tsed.dev" > packages/storybook/.out/CNAME
+ touch ./storybook-static/.nojekyll
+ echo "formio.tsed.dev" > ./storybook-static/CNAME
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
- path: packages/storybook/.out
+ path: ./storybook-static
# Deployment job
deploy:
diff --git a/.gitignore b/.gitignore
index 2de92d88..9eabc997 100644
--- a/.gitignore
+++ b/.gitignore
@@ -43,7 +43,7 @@ test/*.js.map
lib
dist
build
-.out
+storybook-static
/docs/api
/docs/api/**/*.md
diff --git a/packages/storybook/.storybook/main.ts b/.storybook/main.ts
similarity index 69%
rename from packages/storybook/.storybook/main.ts
rename to .storybook/main.ts
index 459df2db..083bcfa9 100644
--- a/packages/storybook/.storybook/main.ts
+++ b/.storybook/main.ts
@@ -1,14 +1,14 @@
import type {StorybookConfig} from "@storybook/react-vite";
const config: StorybookConfig = {
- staticDirs: ["../../tailwind/build"],
+ staticDirs: ["../packages/tailwind/build"],
stories: [
"../stories/Getting-started.mdx",
"../stories/**/*.mdx",
- "../../{tailwind-formio,react-formio}/src/**/*.mdx",
- "../../{tailwind-formio,react-formio}/src/**/*.stories.@(js|jsx|ts|tsx)",
- "../../{tailwind-formio,react-formio}/src/**/*.story.@(js|jsx|ts|tsx)"
+ "../packages/{tailwind-formio,react-formio}/src/**/*.mdx",
+ "../packages/{tailwind-formio,react-formio}/src/**/*.stories.@(js|jsx|ts|tsx)",
+ "../packages/{tailwind-formio,react-formio}/src/**/*.story.@(js|jsx|ts|tsx)"
],
addons: [
diff --git a/packages/storybook/.storybook/preview-head.html b/.storybook/preview-head.html
similarity index 100%
rename from packages/storybook/.storybook/preview-head.html
rename to .storybook/preview-head.html
diff --git a/packages/storybook/.storybook/preview.ts b/.storybook/preview.ts
similarity index 100%
rename from packages/storybook/.storybook/preview.ts
rename to .storybook/preview.ts
diff --git a/packages/storybook/.storybook/styles/fonts/bxicons/animations.css b/.storybook/styles/fonts/bxicons/animations.css
similarity index 100%
rename from packages/storybook/.storybook/styles/fonts/bxicons/animations.css
rename to .storybook/styles/fonts/bxicons/animations.css
diff --git a/packages/storybook/.storybook/styles/fonts/bxicons/boxicons.css b/.storybook/styles/fonts/bxicons/boxicons.css
similarity index 100%
rename from packages/storybook/.storybook/styles/fonts/bxicons/boxicons.css
rename to .storybook/styles/fonts/bxicons/boxicons.css
diff --git a/packages/storybook/.storybook/styles/fonts/bxicons/boxicons.eot b/.storybook/styles/fonts/bxicons/boxicons.eot
similarity index 100%
rename from packages/storybook/.storybook/styles/fonts/bxicons/boxicons.eot
rename to .storybook/styles/fonts/bxicons/boxicons.eot
diff --git a/packages/storybook/.storybook/styles/fonts/bxicons/boxicons.svg b/.storybook/styles/fonts/bxicons/boxicons.svg
similarity index 100%
rename from packages/storybook/.storybook/styles/fonts/bxicons/boxicons.svg
rename to .storybook/styles/fonts/bxicons/boxicons.svg
diff --git a/packages/storybook/.storybook/styles/fonts/bxicons/boxicons.ttf b/.storybook/styles/fonts/bxicons/boxicons.ttf
similarity index 100%
rename from packages/storybook/.storybook/styles/fonts/bxicons/boxicons.ttf
rename to .storybook/styles/fonts/bxicons/boxicons.ttf
diff --git a/packages/storybook/.storybook/styles/fonts/bxicons/boxicons.woff b/.storybook/styles/fonts/bxicons/boxicons.woff
similarity index 100%
rename from packages/storybook/.storybook/styles/fonts/bxicons/boxicons.woff
rename to .storybook/styles/fonts/bxicons/boxicons.woff
diff --git a/packages/storybook/.storybook/styles/fonts/bxicons/boxicons.woff2 b/.storybook/styles/fonts/bxicons/boxicons.woff2
similarity index 100%
rename from packages/storybook/.storybook/styles/fonts/bxicons/boxicons.woff2
rename to .storybook/styles/fonts/bxicons/boxicons.woff2
diff --git a/packages/storybook/.storybook/styles/fonts/bxicons/index.css b/.storybook/styles/fonts/bxicons/index.css
similarity index 100%
rename from packages/storybook/.storybook/styles/fonts/bxicons/index.css
rename to .storybook/styles/fonts/bxicons/index.css
diff --git a/packages/storybook/.storybook/styles/fonts/bxicons/transformations.css b/.storybook/styles/fonts/bxicons/transformations.css
similarity index 100%
rename from packages/storybook/.storybook/styles/fonts/bxicons/transformations.css
rename to .storybook/styles/fonts/bxicons/transformations.css
diff --git a/packages/storybook/.storybook/styles/fonts/inconsolata/index.css b/.storybook/styles/fonts/inconsolata/index.css
similarity index 100%
rename from packages/storybook/.storybook/styles/fonts/inconsolata/index.css
rename to .storybook/styles/fonts/inconsolata/index.css
diff --git a/packages/storybook/.storybook/styles/fonts/index.css b/.storybook/styles/fonts/index.css
similarity index 100%
rename from packages/storybook/.storybook/styles/fonts/index.css
rename to .storybook/styles/fonts/index.css
diff --git a/packages/storybook/.storybook/styles/fonts/source-sans-pro/index.css b/.storybook/styles/fonts/source-sans-pro/index.css
similarity index 100%
rename from packages/storybook/.storybook/styles/fonts/source-sans-pro/index.css
rename to .storybook/styles/fonts/source-sans-pro/index.css
diff --git a/.storybook/styles/index.css b/.storybook/styles/index.css
new file mode 100644
index 00000000..acd912a5
--- /dev/null
+++ b/.storybook/styles/index.css
@@ -0,0 +1,6 @@
+@import "tailwind.css";
+@import "fonts/index.css";
+@import "typography.css";
+@import "../../node_modules/formiojs/dist/formio.full.css";
+@import "../../packages/tailwind-formio/styles/index.css";
+
diff --git a/packages/storybook/.storybook/styles/tailwind.css b/.storybook/styles/tailwind.css
similarity index 100%
rename from packages/storybook/.storybook/styles/tailwind.css
rename to .storybook/styles/tailwind.css
diff --git a/packages/storybook/.storybook/styles/typography.css b/.storybook/styles/typography.css
similarity index 100%
rename from packages/storybook/.storybook/styles/typography.css
rename to .storybook/styles/typography.css
diff --git a/packages/storybook/chromatic.config.json b/chromatic.config.json
similarity index 100%
rename from packages/storybook/chromatic.config.json
rename to chromatic.config.json
diff --git a/commitlint.config.js b/commitlint.config.cjs
similarity index 100%
rename from commitlint.config.js
rename to commitlint.config.cjs
diff --git a/lint-staged.config.js b/lint-staged.config.js
deleted file mode 100644
index c9a0582f..00000000
--- a/lint-staged.config.js
+++ /dev/null
@@ -1,4 +0,0 @@
-module.exports = {
- "**/*.{ts,js}": ["eslint --fix"],
- "**/*.{json,md,yml,yaml}": ["prettier --write"]
-};
diff --git a/package.json b/package.json
index 17ad1183..6340c587 100644
--- a/package.json
+++ b/package.json
@@ -4,6 +4,7 @@
"description": "",
"author": "Romain Lenzotti",
"private": true,
+ "type": "module",
"repository": {
"type": "git",
"url": "https://github.com/TypedProject/tsed-formio.git"
@@ -23,13 +24,17 @@
"build": "monorepo build --verbose",
"publish": "monorepo publish --dry-run",
"start": "lerna run start --stream --parallel",
- "storybook:start": "lerna run storybook:start --stream",
- "storybook:build": "yarn tailwind:build && lerna run storybook:build --stream",
"tailwind:build": "lerna run tailwind:build --stream --scope @tsed/tailwind",
- "storybook:test": "yarn tailwind:build && lerna run storybook:test --stream",
- "storybook:test:ci": "lerna run storybook:test:ci --stream",
"release": "semantic-release",
- "prepare": "is-ci || husky install"
+ "prepare": "is-ci || husky install",
+ "storybook:test": "yarn test-storybook",
+ "storybook:test:ci": "yarn test-storybook --maxWorkers=2",
+ "storybook:start": "storybook dev -p 6006",
+ "storybook:build": "yarn run tailwind:build && yarn run build-storybook",
+ "build-storybook": "storybook build -c .storybook",
+ "caniuse": "npx -y update-browserslist-db@latest",
+ "chromatic": "npx chromatic",
+ "watch": "nodemon --watch ./src --ext ts,js,ejs --exec \"yarn build\""
},
"dependencies": {
"@formio/choices.js": "^9.0.1",
@@ -57,8 +62,20 @@
"tooltip.js": "^1.3.3"
},
"devDependencies": {
+ "@chromatic-com/storybook": "3.2.3",
"@commitlint/cli": "^17.0.3",
"@commitlint/config-conventional": "^17.0.3",
+ "@storybook/addon-a11y": "^8.4.7",
+ "@storybook/addon-essentials": "^8.4.7",
+ "@storybook/addon-interactions": "^8.4.7",
+ "@storybook/addon-links": "^8.4.7",
+ "@storybook/addon-mdx-gfm": "^8.4.7",
+ "@storybook/addon-viewport": "^8.4.7",
+ "@storybook/blocks": "^8.4.7",
+ "@storybook/react": "^8.4.7",
+ "@storybook/react-vite": "^8.4.7",
+ "@storybook/test": "^8.4.7",
+ "@storybook/test-runner": "0.21.0",
"@swc/core": "^1.2.208",
"@swc/jest": "^0.2.21",
"@testing-library/dom": "^8.14.0",
@@ -73,9 +90,11 @@
"@types/prop-types": "^15.7.5",
"@types/react-dnd": "3.0.2",
"@types/react-dnd-html5-backend": "3.0.2",
+ "@vitejs/plugin-react": "^4.3.4",
"autoprefixer": "^10.4.7",
"babel-eslint": "^10.1.0",
"camelcase": "6.3.0",
+ "chromatic": "11.20.2",
"cross-env": "7.0.3",
"eslint": "^8.15.0",
"eslint-config-prettier": "^8.5.0",
@@ -95,6 +114,7 @@
"jest-watch-typeahead": "^1.1.0",
"lint-staged": "13.0.3",
"microbundle": "0.13.0",
+ "playwright": "1.49.1",
"postcss": "^8.4.14",
"postcss-flexbugs-fixes": "5.0.2",
"postcss-nested": "^5.0.6",
@@ -103,10 +123,18 @@
"postcss-safe-parser": "6.0.0",
"prettier": "^2.6.2",
"prettier-eslint": "^14.0.3",
+ "prop-types": "^15.8.1",
+ "react": "^18.2.0",
+ "react-dom": "^18.2.0",
+ "react-svg": "10.0.23",
"rimraf": "^3.0.2",
"semantic-release": "23.0.5",
"semantic-release-slack-bot": "4.0.2",
+ "serve": "^13.0.4",
+ "storybook": "^8.4.7",
"typescript": "4.9.5",
+ "vite": "5.1.8",
+ "vite-plugin-svgr": "^2.4.0",
"webpack": "4.44.2"
},
"workspaces": {
@@ -117,15 +145,27 @@
"monorepo": {
"productionBranch": "master",
"developBranch": "master",
- "npmAccess": "public",
- "ghpages": [
- {
- "dir": "./packages/storybook/.out",
- "url": "https://github.com/tsedio/tsed-formio.git",
- "branch": "gh-pages",
- "cname": "formio.tsed.io"
- }
+ "npmAccess": "public"
+ },
+ "packageManager": "yarn@4.1.1",
+ "browserslist": {
+ "production": [
+ ">0.2%",
+ "not dead",
+ "not op_mini all"
+ ],
+ "development": [
+ "last 1 chrome version",
+ "last 1 firefox version",
+ "last 1 safari version"
]
},
- "packageManager": "yarn@4.1.1"
+ "lint-staged": {
+ "**/*.{ts,js}": [
+ "eslint --fix"
+ ],
+ "**/*.{json,md,yml,yaml}": [
+ "prettier --write"
+ ]
+ }
}
diff --git a/packages/config/package.json b/packages/config/package.json
index 5ebe3331..fc0904dd 100644
--- a/packages/config/package.json
+++ b/packages/config/package.json
@@ -7,6 +7,7 @@
"author": "Romain Lenzotti",
"license": "MIT",
"private": true,
+ "type": "commonjs",
"scripts": {
"lint": "eslint \"**/*.{js,jsx,ts,tsx}\"",
"lint:fix": "yarn lint --fix"
@@ -17,7 +18,5 @@
"devDependencies": {
"@tsed/tailwind": "2.3.1",
"@tsed/yarn-workspaces": "1.19.3"
- },
- "dependencies": {},
- "peerDependencies": {}
+ }
}
diff --git a/packages/react-formio-container/package.json b/packages/react-formio-container/package.json
index d28befb2..db352ff5 100644
--- a/packages/react-formio-container/package.json
+++ b/packages/react-formio-container/package.json
@@ -95,6 +95,5 @@
"tooltip.js": {
"optional": false
}
- },
- "dependencies": {}
+ }
}
diff --git a/packages/react-formio-stores/package.json b/packages/react-formio-stores/package.json
index 166f2821..2dba4348 100644
--- a/packages/react-formio-stores/package.json
+++ b/packages/react-formio-stores/package.json
@@ -24,7 +24,7 @@
"@tsed/react-formio": "workspace:*",
"@tsed/redux-utils": "workspace:*",
"eventemitter2": "^6.4.3",
- "prop-types": "^15.7.2"
+ "prop-types": "15.8.1"
},
"peerDependencies": {
"@formio/choices.js": ">=9.0.1",
diff --git a/packages/react-formio/package.json b/packages/react-formio/package.json
index 5119a21a..b9500a6d 100644
--- a/packages/react-formio/package.json
+++ b/packages/react-formio/package.json
@@ -23,7 +23,7 @@
"dependencies": {
"classnames": "^2.3.1",
"eventemitter2": "^6.4.3",
- "prop-types": "^15.7.2"
+ "prop-types": "15.8.1"
},
"peerDependencies": {
"@formio/choices.js": ">=9.0.1",
diff --git a/packages/react-formio/src/components/actions-table/__fixtures__/data.json b/packages/react-formio/src/components/actions-table/__fixtures__/data.json
new file mode 100644
index 00000000..6dfa14bd
--- /dev/null
+++ b/packages/react-formio/src/components/actions-table/__fixtures__/data.json
@@ -0,0 +1,12 @@
+[
+ {
+ "_id": "602967600685b2158b24e99a",
+ "handler": ["before"],
+ "method": ["create", "update"],
+ "priority": 10,
+ "name": "save",
+ "title": "Save Submission",
+ "form": "602967600685b24dbe24e999",
+ "machineName": "tcspjwhsevrzpcd:testForm:save"
+ }
+]
diff --git a/packages/react-formio/src/components/actions-table/actionsTable.component.spec.tsx b/packages/react-formio/src/components/actions-table/actionsTable.component.spec.tsx
index 75e6cc61..2ba74e9f 100644
--- a/packages/react-formio/src/components/actions-table/actionsTable.component.spec.tsx
+++ b/packages/react-formio/src/components/actions-table/actionsTable.component.spec.tsx
@@ -2,32 +2,63 @@ import { fireEvent, render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import React from "react";
-import { Sandbox } from "./actionsTable.stories";
+import availableActions from "../__fixtures__/form-actions.json";
+import data from "./__fixtures__/data.json";
+import { ActionsTable } from "./actionsTable.component";
+
+const args: any = {
+ data: data,
+ availableActions: availableActions.map(({ name, title }) => ({
+ label: title,
+ value: name
+ })),
+ operations: [
+ {
+ title: "Edit",
+ action: "edit",
+ alias: "row",
+ path: "/resources/:resourceId/submissions/:submissionId",
+ icon: "edit",
+ permissionsResolver() {
+ return true;
+ }
+ },
+ {
+ action: "delete",
+ path: "/resources/:resourceId/submissions/:submissionId/delete",
+ icon: "trash",
+ buttonType: "danger",
+ permissionsResolver() {
+ return true;
+ }
+ }
+ ]
+};
describe("ActionsTable", () => {
it("should render the table actions", async () => {
const onAddAction = jest.fn();
- render(