1
0
mirror of https://gitlab.nic.cz/turris/reforis/foris-js.git synced 2024-12-26 00:21:36 +01:00

Fix lint.

This commit is contained in:
Bogdan Bodnar 2019-08-27 16:09:18 +02:00
parent 18e8e20206
commit c0d742b13b
No known key found for this signature in database
GPG Key ID: 49E4169AD3CA42B0
36 changed files with 620 additions and 831 deletions

View File

@ -53,9 +53,8 @@ module.exports = {
}, },
"settings": { "settings": {
"import/resolver": { "import/resolver": {
"webpack": { "node": {
"env": {"lighttpd": true}, "paths": ["src"]
"config": path.resolve(__dirname, "webpack.config.js")
} }
} }
} }

View File

@ -10,12 +10,5 @@ module.exports = {
plugins: [ plugins: [
"@babel/plugin-syntax-export-default-from", "@babel/plugin-syntax-export-default-from",
"@babel/plugin-transform-runtime", "@babel/plugin-transform-runtime",
["module-resolver", {
root: ["./src"],
alias: {
test: "./test",
underscore: "lodash",
},
}],
], ],
}; };

572
package-lock.json generated
View File

@ -1022,12 +1022,6 @@
"strip-ansi": "^5.0.0" "strip-ansi": "^5.0.0"
}, },
"dependencies": { "dependencies": {
"ansi-escapes": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz",
"integrity": "sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==",
"dev": true
},
"strip-ansi": { "strip-ansi": {
"version": "5.2.0", "version": "5.2.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
@ -1468,13 +1462,10 @@
"dev": true "dev": true
}, },
"ansi-escapes": { "ansi-escapes": {
"version": "4.2.1", "version": "3.2.0",
"resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.2.1.tgz", "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz",
"integrity": "sha512-Cg3ymMAdN10wOk/VYfLV7KCQyv7EDirJ64500sU7n9UlmioEtDuU5Gd+hj73hXSU/ex7tHJSssmyftDdkMLO8Q==", "integrity": "sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==",
"dev": true, "dev": true
"requires": {
"type-fest": "^0.5.2"
}
}, },
"ansi-html": { "ansi-html": {
"version": "0.0.7", "version": "0.0.7",
@ -1873,19 +1864,6 @@
"@types/babel__traverse": "^7.0.6" "@types/babel__traverse": "^7.0.6"
} }
}, },
"babel-plugin-module-resolver": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/babel-plugin-module-resolver/-/babel-plugin-module-resolver-3.2.0.tgz",
"integrity": "sha512-tjR0GvSndzPew/Iayf4uICWZqjBwnlMWjSx6brryfQ81F9rxBVqwDJtFCV8oOs0+vJeefK9TmdZtkIFdFe1UnA==",
"dev": true,
"requires": {
"find-babel-config": "^1.1.0",
"glob": "^7.1.2",
"pkg-up": "^2.0.0",
"reselect": "^3.0.1",
"resolve": "^1.4.0"
}
},
"babel-plugin-react-transform": { "babel-plugin-react-transform": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/babel-plugin-react-transform/-/babel-plugin-react-transform-3.0.0.tgz", "resolved": "https://registry.npmjs.org/babel-plugin-react-transform/-/babel-plugin-react-transform-3.0.0.tgz",
@ -1906,6 +1884,12 @@
"regenerator-runtime": "^0.10.5" "regenerator-runtime": "^0.10.5"
}, },
"dependencies": { "dependencies": {
"core-js": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.9.tgz",
"integrity": "sha512-HOpZf6eXmnl7la+cUdMnLvUxKNqLUzJvgIziQ0DiF3JwSImNphIqdGqzj6hIKyX04MmV0poclQ7+wjWvxQyR2A==",
"dev": true
},
"regenerator-runtime": { "regenerator-runtime": {
"version": "0.10.5", "version": "0.10.5",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz",
@ -1934,6 +1918,12 @@
"regenerator-runtime": "^0.11.0" "regenerator-runtime": "^0.11.0"
}, },
"dependencies": { "dependencies": {
"core-js": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.9.tgz",
"integrity": "sha512-HOpZf6eXmnl7la+cUdMnLvUxKNqLUzJvgIziQ0DiF3JwSImNphIqdGqzj6hIKyX04MmV0poclQ7+wjWvxQyR2A==",
"dev": true
},
"regenerator-runtime": { "regenerator-runtime": {
"version": "0.11.1", "version": "0.11.1",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz",
@ -2346,9 +2336,9 @@
"dev": true "dev": true
}, },
"chokidar": { "chokidar": {
"version": "2.1.6", "version": "2.1.8",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.6.tgz", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz",
"integrity": "sha512-V2jUo67OKkc6ySiRpJrjlpJKl9kDuG+Xb8VgsGzb+aEouhgS1D0weyPU4lEzdAcsCAvrih2J2BqyXqHWvVLw5g==", "integrity": "sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg==",
"dev": true, "dev": true,
"requires": { "requires": {
"anymatch": "^2.0.0", "anymatch": "^2.0.0",
@ -2410,12 +2400,12 @@
} }
}, },
"cli-cursor": { "cli-cursor": {
"version": "3.1.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz",
"integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=",
"dev": true, "dev": true,
"requires": { "requires": {
"restore-cursor": "^3.1.0" "restore-cursor": "^2.0.0"
} }
}, },
"cli-spinners": { "cli-spinners": {
@ -2459,18 +2449,6 @@
"wrap-ansi": "^5.1.0" "wrap-ansi": "^5.1.0"
}, },
"dependencies": { "dependencies": {
"emoji-regex": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
"integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==",
"dev": true
},
"is-fullwidth-code-point": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
"integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=",
"dev": true
},
"string-width": { "string-width": {
"version": "3.1.0", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz",
@ -2820,10 +2798,9 @@
} }
}, },
"core-js": { "core-js": {
"version": "2.6.9", "version": "1.2.7",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.9.tgz", "resolved": "https://registry.npmjs.org/core-js/-/core-js-1.2.7.tgz",
"integrity": "sha512-HOpZf6eXmnl7la+cUdMnLvUxKNqLUzJvgIziQ0DiF3JwSImNphIqdGqzj6hIKyX04MmV0poclQ7+wjWvxQyR2A==", "integrity": "sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY="
"dev": true
}, },
"core-js-compat": { "core-js-compat": {
"version": "3.2.1", "version": "3.2.1",
@ -3234,15 +3211,15 @@
"dev": true "dev": true
}, },
"electron-to-chromium": { "electron-to-chromium": {
"version": "1.3.237", "version": "1.3.241",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.237.tgz", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.241.tgz",
"integrity": "sha512-SPAFjDr/7iiVK2kgTluwxela6eaWjjFkS9rO/iYpB/KGXgccUom5YC7OIf19c8m8GGptWxLU0Em8xM64A/N7Fg==", "integrity": "sha512-Gb9E6nWZlbgjDDNe5cAvMJixtn79krNJ70EDpq/M10lkGo7PGtBUe7Y0CYVHsBScRwi6ybCS+YetXAN9ysAHDg==",
"dev": true "dev": true
}, },
"emoji-regex": { "emoji-regex": {
"version": "8.0.0", "version": "7.0.3",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==",
"dev": true "dev": true
}, },
"emojis-list": { "emojis-list": {
@ -3621,6 +3598,12 @@
"locate-path": "^2.0.0" "locate-path": "^2.0.0"
} }
}, },
"isarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=",
"dev": true
},
"load-json-file": { "load-json-file": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz",
@ -3729,14 +3712,6 @@
"emoji-regex": "^7.0.2", "emoji-regex": "^7.0.2",
"has": "^1.0.3", "has": "^1.0.3",
"jsx-ast-utils": "^2.2.1" "jsx-ast-utils": "^2.2.1"
},
"dependencies": {
"emoji-regex": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
"integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==",
"dev": true
}
} }
}, },
"eslint-plugin-react": { "eslint-plugin-react": {
@ -4010,6 +3985,12 @@
"ms": "2.0.0" "ms": "2.0.0"
} }
}, },
"path-to-regexp": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
"integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=",
"dev": true
},
"qs": { "qs": {
"version": "6.7.0", "version": "6.7.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz",
@ -4189,13 +4170,6 @@
"promise": "^7.1.1", "promise": "^7.1.1",
"setimmediate": "^1.0.5", "setimmediate": "^1.0.5",
"ua-parser-js": "^0.7.18" "ua-parser-js": "^0.7.18"
},
"dependencies": {
"core-js": {
"version": "1.2.7",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-1.2.7.tgz",
"integrity": "sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY="
}
} }
}, },
"figgy-pudding": { "figgy-pudding": {
@ -4205,9 +4179,9 @@
"dev": true "dev": true
}, },
"figures": { "figures": {
"version": "3.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/figures/-/figures-3.0.0.tgz", "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz",
"integrity": "sha512-HKri+WoWoUgr83pehn/SIgLOMZ9nAWC6dcGj26RY2R4F50u4+RTUz0RCrUlOV3nKRAICW1UGzyb+kcX2qK1S/g==", "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=",
"dev": true, "dev": true,
"requires": { "requires": {
"escape-string-regexp": "^1.0.5" "escape-string-regexp": "^1.0.5"
@ -4277,24 +4251,6 @@
} }
} }
}, },
"find-babel-config": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/find-babel-config/-/find-babel-config-1.2.0.tgz",
"integrity": "sha512-jB2CHJeqy6a820ssiqwrKMeyC6nNdmrcgkKWJWmpoxpE8RKciYJXCcXRq1h2AzCo5I5BJeN2tkGEO3hLTuePRA==",
"dev": true,
"requires": {
"json5": "^0.5.1",
"path-exists": "^3.0.0"
},
"dependencies": {
"json5": {
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz",
"integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=",
"dev": true
}
}
},
"find-cache-dir": { "find-cache-dir": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-2.1.0.tgz", "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-2.1.0.tgz",
@ -5564,22 +5520,22 @@
"dev": true "dev": true
}, },
"inquirer": { "inquirer": {
"version": "6.5.1", "version": "6.5.2",
"resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.5.1.tgz", "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.5.2.tgz",
"integrity": "sha512-uxNHBeQhRXIoHWTSNYUFhQVrHYFThIt6IVo2fFmSe8aBwdR3/w6b58hJpiL/fMukFkvGzjg+hSxFtwvVmKZmXw==", "integrity": "sha512-cntlB5ghuB0iuO65Ovoi8ogLHiWGs/5yNrtUcKjFhSSiVeAIVpD7koaSU9RM8mpXw5YDi9RdYXGQMaOURB7ycQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"ansi-escapes": "^4.2.1", "ansi-escapes": "^3.2.0",
"chalk": "^2.4.2", "chalk": "^2.4.2",
"cli-cursor": "^3.1.0", "cli-cursor": "^2.1.0",
"cli-width": "^2.0.0", "cli-width": "^2.0.0",
"external-editor": "^3.0.3", "external-editor": "^3.0.3",
"figures": "^3.0.0", "figures": "^2.0.0",
"lodash": "^4.17.15", "lodash": "^4.17.12",
"mute-stream": "0.0.8", "mute-stream": "0.0.7",
"run-async": "^2.2.0", "run-async": "^2.2.0",
"rxjs": "^6.4.0", "rxjs": "^6.4.0",
"string-width": "^4.1.0", "string-width": "^2.1.0",
"strip-ansi": "^5.1.0", "strip-ansi": "^5.1.0",
"through": "^2.3.6" "through": "^2.3.6"
}, },
@ -5802,9 +5758,9 @@
"dev": true "dev": true
}, },
"is-fullwidth-code-point": { "is-fullwidth-code-point": {
"version": "3.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=",
"dev": true "dev": true
}, },
"is-generator-fn": { "is-generator-fn": {
@ -5977,10 +5933,9 @@
"dev": true "dev": true
}, },
"isarray": { "isarray": {
"version": "1.0.0", "version": "0.0.1",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8="
"dev": true
}, },
"isexe": { "isexe": {
"version": "2.0.0", "version": "2.0.0",
@ -6531,14 +6486,6 @@
"chalk": "^2.0.1", "chalk": "^2.0.1",
"jest-util": "^24.9.0", "jest-util": "^24.9.0",
"string-length": "^2.0.0" "string-length": "^2.0.0"
},
"dependencies": {
"ansi-escapes": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz",
"integrity": "sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==",
"dev": true
}
} }
}, },
"jest-worker": { "jest-worker": {
@ -7045,6 +6992,14 @@
"map-age-cleaner": "^0.1.1", "map-age-cleaner": "^0.1.1",
"mimic-fn": "^2.0.0", "mimic-fn": "^2.0.0",
"p-is-promise": "^2.0.0" "p-is-promise": "^2.0.0"
},
"dependencies": {
"mimic-fn": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz",
"integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==",
"dev": true
}
} }
}, },
"memory-fs": { "memory-fs": {
@ -7130,9 +7085,9 @@
} }
}, },
"mimic-fn": { "mimic-fn": {
"version": "2.1.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz",
"integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==",
"dev": true "dev": true
}, },
"mini-create-react-context": { "mini-create-react-context": {
@ -7290,9 +7245,9 @@
"dev": true "dev": true
}, },
"mute-stream": { "mute-stream": {
"version": "0.0.8", "version": "0.0.7",
"resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz",
"integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=",
"dev": true "dev": true
}, },
"nan": { "nan": {
@ -7395,9 +7350,9 @@
} }
}, },
"node-releases": { "node-releases": {
"version": "1.1.27", "version": "1.1.28",
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.27.tgz", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.28.tgz",
"integrity": "sha512-9iXUqHKSGo6ph/tdXVbHFbhRVQln4ZDTIBJCzsa90HimnBYc5jw8RWYt4wBYFHehGyC3koIz5O4mb2fHrbPOuA==", "integrity": "sha512-AQw4emh6iSXnCpDiFe0phYcThiccmkNWMZnFZ+lDJjAP8J0m2fVd59duvUUyuTirQOhIAajTFkzG6FHCLBO59g==",
"dev": true, "dev": true,
"requires": { "requires": {
"semver": "^5.3.0" "semver": "^5.3.0"
@ -7603,12 +7558,12 @@
} }
}, },
"onetime": { "onetime": {
"version": "5.1.0", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.0.tgz", "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz",
"integrity": "sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q==", "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=",
"dev": true, "dev": true,
"requires": { "requires": {
"mimic-fn": "^2.1.0" "mimic-fn": "^1.0.0"
} }
}, },
"open": { "open": {
@ -7675,40 +7630,6 @@
"wcwidth": "^1.0.1" "wcwidth": "^1.0.1"
}, },
"dependencies": { "dependencies": {
"cli-cursor": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz",
"integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=",
"dev": true,
"requires": {
"restore-cursor": "^2.0.0"
}
},
"mimic-fn": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz",
"integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==",
"dev": true
},
"onetime": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz",
"integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=",
"dev": true,
"requires": {
"mimic-fn": "^1.0.0"
}
},
"restore-cursor": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz",
"integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=",
"dev": true,
"requires": {
"onetime": "^2.0.0",
"signal-exit": "^3.0.2"
}
},
"strip-ansi": { "strip-ansi": {
"version": "5.2.0", "version": "5.2.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
@ -7934,10 +7855,12 @@
"dev": true "dev": true
}, },
"path-to-regexp": { "path-to-regexp": {
"version": "0.1.7", "version": "1.7.0",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.7.0.tgz",
"integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=", "integrity": "sha1-Wf3g9DW62suhA6hOnTvGTpa5k30=",
"dev": true "requires": {
"isarray": "0.0.1"
}
}, },
"path-type": { "path-type": {
"version": "3.0.0", "version": "3.0.0",
@ -8356,27 +8279,6 @@
"text-table": "0.2.0" "text-table": "0.2.0"
}, },
"dependencies": { "dependencies": {
"ansi-escapes": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz",
"integrity": "sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==",
"dev": true
},
"ansi-regex": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz",
"integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=",
"dev": true
},
"cli-cursor": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz",
"integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=",
"dev": true,
"requires": {
"restore-cursor": "^2.0.0"
}
},
"dir-glob": { "dir-glob": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-2.0.0.tgz", "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-2.0.0.tgz",
@ -8387,15 +8289,6 @@
"path-type": "^3.0.0" "path-type": "^3.0.0"
} }
}, },
"figures": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz",
"integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=",
"dev": true,
"requires": {
"escape-string-regexp": "^1.0.5"
}
},
"globby": { "globby": {
"version": "8.0.2", "version": "8.0.2",
"resolved": "https://registry.npmjs.org/globby/-/globby-8.0.2.tgz", "resolved": "https://registry.npmjs.org/globby/-/globby-8.0.2.tgz",
@ -8438,70 +8331,12 @@
"through": "^2.3.6" "through": "^2.3.6"
} }
}, },
"is-fullwidth-code-point": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
"integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=",
"dev": true
},
"mimic-fn": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz",
"integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==",
"dev": true
},
"mute-stream": {
"version": "0.0.7",
"resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz",
"integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=",
"dev": true
},
"onetime": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz",
"integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=",
"dev": true,
"requires": {
"mimic-fn": "^1.0.0"
}
},
"restore-cursor": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz",
"integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=",
"dev": true,
"requires": {
"onetime": "^2.0.0",
"signal-exit": "^3.0.2"
}
},
"slash": { "slash": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz",
"integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=", "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=",
"dev": true "dev": true
}, },
"string-width": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz",
"integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==",
"dev": true,
"requires": {
"is-fullwidth-code-point": "^2.0.0",
"strip-ansi": "^4.0.0"
},
"dependencies": {
"strip-ansi": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz",
"integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=",
"dev": true,
"requires": {
"ansi-regex": "^3.0.0"
}
}
}
},
"strip-ansi": { "strip-ansi": {
"version": "5.2.0", "version": "5.2.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
@ -8509,14 +8344,6 @@
"dev": true, "dev": true,
"requires": { "requires": {
"ansi-regex": "^4.1.0" "ansi-regex": "^4.1.0"
},
"dependencies": {
"ansi-regex": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
"integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
"dev": true
}
} }
} }
} }
@ -8543,18 +8370,18 @@
"dev": true "dev": true
}, },
"react-docgen-displayname-handler": { "react-docgen-displayname-handler": {
"version": "2.1.1", "version": "2.1.3",
"resolved": "https://registry.npmjs.org/react-docgen-displayname-handler/-/react-docgen-displayname-handler-2.1.1.tgz", "resolved": "https://registry.npmjs.org/react-docgen-displayname-handler/-/react-docgen-displayname-handler-2.1.3.tgz",
"integrity": "sha512-Dmu+WnQt5TRDokaQ6uGvgcxrIh92c6uhuljsuueEphTcy/1nKh8/Ep6RUmpd77G1iN2rqg5+4ztGAT7LJjVdpg==", "integrity": "sha512-XfQCjDC/8hy0rDZ+VudYplQCdp/fx3z7Ffp22+6s2MSbZ2I/1yw4Tn+ntxkUgI0hrQzB6Nidg/wzLpA5Dbj+xg==",
"dev": true, "dev": true,
"requires": { "requires": {
"ast-types": "0.11.5" "ast-types": "0.13.2"
}, },
"dependencies": { "dependencies": {
"ast-types": { "ast-types": {
"version": "0.11.5", "version": "0.13.2",
"resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.11.5.tgz", "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.13.2.tgz",
"integrity": "sha512-oJjo+5e7/vEc2FBK8gUalV0pba4L3VdBIs2EKhOLHLcOd2FgQIVQN9xb0eZ9IjEWyAL7vq6fGJxOvVvdCHNyMw==", "integrity": "sha512-uWMHxJxtfj/1oZClOxDEV1sQ1HCDkA4MG8Gr69KKeBjEVH0R84WlejZ0y2DcwyBlpAEMltmVYkVgqfLFb2oyiA==",
"dev": true "dev": true
} }
} }
@ -8626,21 +8453,6 @@
"react-is": "^16.6.0", "react-is": "^16.6.0",
"tiny-invariant": "^1.0.2", "tiny-invariant": "^1.0.2",
"tiny-warning": "^1.0.0" "tiny-warning": "^1.0.0"
},
"dependencies": {
"isarray": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
"integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8="
},
"path-to-regexp": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.7.0.tgz",
"integrity": "sha1-Wf3g9DW62suhA6hOnTvGTpa5k30=",
"requires": {
"isarray": "0.0.1"
}
}
} }
}, },
"react-simple-code-editor": { "react-simple-code-editor": {
@ -8772,6 +8584,14 @@
"safe-buffer": "~5.1.1", "safe-buffer": "~5.1.1",
"string_decoder": "~1.1.1", "string_decoder": "~1.1.1",
"util-deprecate": "~1.0.1" "util-deprecate": "~1.0.1"
},
"dependencies": {
"isarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=",
"dev": true
}
} }
}, },
"readdirp": { "readdirp": {
@ -8863,9 +8683,9 @@
} }
}, },
"regexp-tree": { "regexp-tree": {
"version": "0.1.11", "version": "0.1.12",
"resolved": "https://registry.npmjs.org/regexp-tree/-/regexp-tree-0.1.11.tgz", "resolved": "https://registry.npmjs.org/regexp-tree/-/regexp-tree-0.1.12.tgz",
"integrity": "sha512-7/l/DgapVVDzZobwMCCgMlqiqyLFJ0cduo/j+3BcDJIB+yJdsYCfKuI3l/04NV+H/rfNRdPIDbXNZHM9XvQatg==", "integrity": "sha512-TsXZ8+cv2uxMEkLfgwO0E068gsNMLfuYwMMhiUxf0Kw2Vcgzq93vgl6wIlIYuPmfMqMjfQ9zAporiozqCnwLuQ==",
"dev": true "dev": true
}, },
"regexpp": { "regexpp": {
@ -9075,12 +8895,6 @@
"integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=", "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=",
"dev": true "dev": true
}, },
"reselect": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/reselect/-/reselect-3.0.1.tgz",
"integrity": "sha1-79qpjqdFEyTQkrKyFjpqHXqaIUc=",
"dev": true
},
"resolve": { "resolve": {
"version": "1.12.0", "version": "1.12.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.12.0.tgz", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.12.0.tgz",
@ -9125,12 +8939,12 @@
"dev": true "dev": true
}, },
"restore-cursor": { "restore-cursor": {
"version": "3.1.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz",
"integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=",
"dev": true, "dev": true,
"requires": { "requires": {
"onetime": "^5.1.0", "onetime": "^2.0.0",
"signal-exit": "^3.0.2" "signal-exit": "^3.0.2"
} }
}, },
@ -9255,6 +9069,17 @@
"object-assign": "^4.1.1" "object-assign": "^4.1.1"
} }
}, },
"schema-utils": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-1.0.0.tgz",
"integrity": "sha512-i27Mic4KovM/lnGsy8whRCHhc7VicJajAjTrYg11K9zfZXnYIt4k5F+kZkwjnrhKzLic/HLU4j11mjsz2G/75g==",
"dev": true,
"requires": {
"ajv": "^6.1.0",
"ajv-errors": "^1.0.0",
"ajv-keywords": "^3.1.0"
}
},
"select": { "select": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/select/-/select-1.1.2.tgz", "resolved": "https://registry.npmjs.org/select/-/select-1.1.2.tgz",
@ -9497,14 +9322,6 @@
"ansi-styles": "^3.2.0", "ansi-styles": "^3.2.0",
"astral-regex": "^1.0.0", "astral-regex": "^1.0.0",
"is-fullwidth-code-point": "^2.0.0" "is-fullwidth-code-point": "^2.0.0"
},
"dependencies": {
"is-fullwidth-code-point": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
"integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=",
"dev": true
}
} }
}, },
"snapdragon": { "snapdragon": {
@ -9982,25 +9799,13 @@
} }
}, },
"string-width": { "string-width": {
"version": "4.1.0", "version": "2.1.1",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.1.0.tgz", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz",
"integrity": "sha512-NrX+1dVVh+6Y9dnQ19pR0pP4FiEIlUvdTGn8pw6CKTNq5sgib2nIhmUNT5TAmhWmvKr3WcxBcP3E8nWezuipuQ==", "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==",
"dev": true, "dev": true,
"requires": { "requires": {
"emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^2.0.0",
"is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^4.0.0"
"strip-ansi": "^5.2.0"
},
"dependencies": {
"strip-ansi": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
"integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
"dev": true,
"requires": {
"ansi-regex": "^4.1.0"
}
}
} }
}, },
"string_decoder": { "string_decoder": {
@ -10115,18 +9920,6 @@
"string-width": "^3.0.0" "string-width": "^3.0.0"
}, },
"dependencies": { "dependencies": {
"emoji-regex": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
"integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==",
"dev": true
},
"is-fullwidth-code-point": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
"integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=",
"dev": true
},
"string-width": { "string-width": {
"version": "3.1.0", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz",
@ -10156,9 +9949,9 @@
"dev": true "dev": true
}, },
"terser": { "terser": {
"version": "4.2.0", "version": "4.2.1",
"resolved": "https://registry.npmjs.org/terser/-/terser-4.2.0.tgz", "resolved": "https://registry.npmjs.org/terser/-/terser-4.2.1.tgz",
"integrity": "sha512-6lPt7lZdZ/13icQJp8XasFOwZjFJkxFFIb/N1fhYEQNoNI3Ilo3KABZ9OocZvZoB39r6SiIk/0+v/bt8nZoSeA==", "integrity": "sha512-cGbc5utAcX4a9+2GGVX4DsenG6v0x3glnDi5hx8816X1McEAwPlPgRtXPJzSBsbpILxZ8MQMT0KvArLuE0HP5A==",
"dev": true, "dev": true,
"requires": { "requires": {
"commander": "^2.20.0", "commander": "^2.20.0",
@ -10241,17 +10034,6 @@
"through2": "^2.0.0" "through2": "^2.0.0"
} }
}, },
"schema-utils": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-1.0.0.tgz",
"integrity": "sha512-i27Mic4KovM/lnGsy8whRCHhc7VicJajAjTrYg11K9zfZXnYIt4k5F+kZkwjnrhKzLic/HLU4j11mjsz2G/75g==",
"dev": true,
"requires": {
"ajv": "^6.1.0",
"ajv-errors": "^1.0.0",
"ajv-keywords": "^3.1.0"
}
},
"source-map": { "source-map": {
"version": "0.6.1", "version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
@ -10516,12 +10298,6 @@
"integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==",
"dev": true "dev": true
}, },
"type-fest": {
"version": "0.5.2",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.5.2.tgz",
"integrity": "sha512-DWkS49EQKVX//Tbupb9TFa19c7+MK1XmzkrZUR8TAktmE/DizXoaoJV6TZ/tSIPXipqNiRI6CyAe7x69Jb6RSw==",
"dev": true
},
"type-is": { "type-is": {
"version": "1.6.18", "version": "1.6.18",
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
@ -10735,6 +10511,12 @@
"resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz",
"integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=",
"dev": true "dev": true
},
"isarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=",
"dev": true
} }
} }
}, },
@ -11048,10 +10830,13 @@
"dev": true "dev": true
}, },
"is-fullwidth-code-point": { "is-fullwidth-code-point": {
"version": "2.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz",
"integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=",
"dev": true "dev": true,
"requires": {
"number-is-nan": "^1.0.0"
}
}, },
"ms": { "ms": {
"version": "2.1.2", "version": "2.1.2",
@ -11065,50 +10850,12 @@
"integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=",
"dev": true "dev": true
}, },
"schema-utils": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-1.0.0.tgz",
"integrity": "sha512-i27Mic4KovM/lnGsy8whRCHhc7VicJajAjTrYg11K9zfZXnYIt4k5F+kZkwjnrhKzLic/HLU4j11mjsz2G/75g==",
"dev": true,
"requires": {
"ajv": "^6.1.0",
"ajv-errors": "^1.0.0",
"ajv-keywords": "^3.1.0"
}
},
"semver": { "semver": {
"version": "6.3.0", "version": "6.3.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
"dev": true "dev": true
}, },
"string-width": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz",
"integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==",
"dev": true,
"requires": {
"is-fullwidth-code-point": "^2.0.0",
"strip-ansi": "^4.0.0"
},
"dependencies": {
"ansi-regex": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz",
"integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=",
"dev": true
},
"strip-ansi": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz",
"integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=",
"dev": true,
"requires": {
"ansi-regex": "^3.0.0"
}
}
}
},
"strip-ansi": { "strip-ansi": {
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
@ -11137,15 +10884,6 @@
"strip-ansi": "^3.0.1" "strip-ansi": "^3.0.1"
}, },
"dependencies": { "dependencies": {
"is-fullwidth-code-point": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz",
"integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=",
"dev": true,
"requires": {
"number-is-nan": "^1.0.0"
}
},
"string-width": { "string-width": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
@ -11335,18 +11073,6 @@
"strip-ansi": "^5.0.0" "strip-ansi": "^5.0.0"
}, },
"dependencies": { "dependencies": {
"emoji-regex": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
"integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==",
"dev": true
},
"is-fullwidth-code-point": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
"integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=",
"dev": true
},
"string-width": { "string-width": {
"version": "3.1.0", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz",
@ -11452,18 +11178,6 @@
"yargs-parser": "^13.1.1" "yargs-parser": "^13.1.1"
}, },
"dependencies": { "dependencies": {
"emoji-regex": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
"integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==",
"dev": true
},
"is-fullwidth-code-point": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
"integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=",
"dev": true
},
"string-width": { "string-width": {
"version": "3.1.0", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz",

View File

@ -39,7 +39,6 @@
"babel-eslint": "^9.0.0", "babel-eslint": "^9.0.0",
"babel-jest": "^24.8.0", "babel-jest": "^24.8.0",
"babel-loader": "^8.0.6", "babel-loader": "^8.0.6",
"babel-plugin-module-resolver": "^3.2.0",
"babel-plugin-react-transform": "^3.0.0", "babel-plugin-react-transform": "^3.0.0",
"babel-polyfill": "^6.26.0", "babel-polyfill": "^6.26.0",
"eslint": "^5.16.0", "eslint": "^5.16.0",

View File

@ -5,27 +5,31 @@
* See /LICENSE for more information. * See /LICENSE for more information.
*/ */
import React from 'react'; import React from "react";
import PropTypes from 'prop-types'; import PropTypes from "prop-types";
Alert.propTypes = { Alert.propTypes = {
/** Type of the alert it adds as `alert-${type}` class.*/ /** Type of the alert it adds as `alert-${type}` class. */
type: PropTypes.string.isRequired, type: PropTypes.string.isRequired,
/** Alert message.*/ /** Alert message. */
message: PropTypes.string, message: PropTypes.string,
/** Alert content.*/ /** Alert content. */
children: PropTypes.oneOfType([ children: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.node), PropTypes.arrayOf(PropTypes.node),
PropTypes.node PropTypes.node,
]), ]),
/** onDismiss handler.*/ /** onDismiss handler. */
onDismiss: PropTypes.func onDismiss: PropTypes.func,
}; };
export function Alert({type, message, onDismiss, children}) { export default function Alert({
return <div className={`alert alert-dismissible alert-${type}`}> type, message, onDismiss, children,
}) {
return (
<div className={`alert alert-dismissible alert-${type}`}>
{onDismiss ? <button type="button" className="close" onClick={onDismiss}>&times;</button> : false} {onDismiss ? <button type="button" className="close" onClick={onDismiss}>&times;</button> : false}
{message} {message}
{children} {children}
</div> </div>
);
} }

View File

@ -5,13 +5,13 @@
* See /LICENSE for more information. * See /LICENSE for more information.
*/ */
import React from 'react'; import React from "react";
import PropTypes from 'prop-types'; import PropTypes from "prop-types";
const OFFSET = 8; const OFFSET = 8;
const SIZE = 3; const SIZE = 3;
const SIZE_CLASS = ' offset-lg-' + OFFSET + ' col-lg-' + SIZE; const SIZE_CLASS = ` offset-lg-${OFFSET} col-lg-${SIZE}`;
const SIZE_CLASS_SM = ' col-sm-12'; const SIZE_CLASS_SM = " col-sm-12";
Button.propTypes = { Button.propTypes = {
/** Additional class name. */ /** Additional class name. */
@ -26,18 +26,25 @@ Button.propTypes = {
PropTypes.element, PropTypes.element,
PropTypes.node, PropTypes.node,
PropTypes.arrayOf(PropTypes.node), PropTypes.arrayOf(PropTypes.node),
]).isRequired ]).isRequired,
}; };
export function Button({className, loading, forisFormSize, children, ...props}) { export default function Button({
className = className ? 'btn ' + className : 'btn btn-primary '; className, loading, forisFormSize, children, ...props
if (forisFormSize) }) {
className += SIZE_CLASS + SIZE_CLASS_SM; className = className ? `btn ${className}` : "btn btn-primary ";
if (forisFormSize) className += SIZE_CLASS + SIZE_CLASS_SM;
const span = loading ? const span = loading
<span className='spinner-border spinner-border-sm' role='status' aria-hidden='true'/> : null; ? <span className="spinner-border spinner-border-sm" role="status" aria-hidden="true" /> : null;
return <button className={className} {...props}> return (
{span} {span ? ' ' : null} {children} <button type="button" className={className} {...props}>
</button>; {span}
{" "}
{span ? " " : null}
{" "}
{children}
</button>
);
} }

View File

@ -7,7 +7,7 @@
import React from "react"; import React from "react";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { useUID } from "react-uid"; import { useUID } from "react-uid/dist/es5/index";
import { formFieldsSize } from "./constants"; import { formFieldsSize } from "./constants";
@ -27,7 +27,7 @@ CheckBox.defaultProps = {
disabled: false, disabled: false,
}; };
export function CheckBox({ export default function CheckBox({
label, helpText, useDefaultSize, disabled, ...props label, helpText, useDefaultSize, disabled, ...props
}) { }) {
const uid = useUID(); const uid = useUID();

View File

@ -5,47 +5,52 @@
* See /LICENSE for more information. * See /LICENSE for more information.
*/ */
import React from 'react'; import React from "react";
import PropTypes from 'prop-types'; import PropTypes from "prop-types";
import Datetime from 'react-datetime/DateTime'; import Datetime from "react-datetime/DateTime";
import moment from 'moment/moment'; import moment from "moment/moment";
import {Input} from './Input'; import Input from "./Input";
DataTimeInput.propTypes = { DataTimeInput.propTypes = {
/** Field label. */ /** Field label. */
label: PropTypes.string.isRequired, label: PropTypes.string.isRequired,
/** Error message. */ /** Error message. */
error: PropTypes.string, error: PropTypes.string,
/** DataTime or Data or Time value. Can be `moment` or string.*/ /** DataTime or Data or Time value. Can be `moment` or string. */
value: PropTypes.oneOfType([PropTypes.objectOf(moment), PropTypes.string]), value: PropTypes.oneOfType([PropTypes.objectOf(moment), PropTypes.string]),
/** Help text message. */ /** Help text message. */
helpText: PropTypes.string, helpText: PropTypes.string,
/** Content. */ /** Content. */
children: PropTypes.oneOfType([ children: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.node), PropTypes.arrayOf(PropTypes.node),
PropTypes.node PropTypes.node,
]), ]),
isValidDate: PropTypes.bool, isValidDate: PropTypes.bool,
onChange: PropTypes.func.isRequired, onChange: PropTypes.func.isRequired,
dateFormat: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), dateFormat: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
timeFormat: PropTypes.string timeFormat: PropTypes.string,
}; };
const DEFAULT_DATE_FORMAT = 'YYYY-MM-DD'; const DEFAULT_DATE_FORMAT = "YYYY-MM-DD";
const DEFAULT_TIME_FORMAT = 'HH:mm:ss'; const DEFAULT_TIME_FORMAT = "HH:mm:ss";
export function DataTimeInput({value, onChange, isValidDate, dateFormat, timeFormat, children, ...props}) { export default function DataTimeInput({
value, onChange, isValidDate, dateFormat, timeFormat, children, ...props
}) {
function renderInput(datetimeProps) { function renderInput(datetimeProps) {
return <Input return (
<Input
{...props} {...props}
{...datetimeProps} {...datetimeProps}
> >
{children} {children}
</Input> </Input>
);
} }
return <Datetime return (
<Datetime
locale={ForisTranslations.locale} locale={ForisTranslations.locale}
dateFormat={dateFormat !== undefined ? dateFormat : DEFAULT_DATE_FORMAT} dateFormat={dateFormat !== undefined ? dateFormat : DEFAULT_DATE_FORMAT}
timeFormat={timeFormat !== undefined ? timeFormat : DEFAULT_TIME_FORMAT} timeFormat={timeFormat !== undefined ? timeFormat : DEFAULT_TIME_FORMAT}
@ -53,5 +58,6 @@ export function DataTimeInput({value, onChange, isValidDate, dateFormat, timeFor
onChange={onChange} onChange={onChange}
isValidDate={isValidDate} isValidDate={isValidDate}
renderInput={renderInput} renderInput={renderInput}
/>; />
);
} }

View File

@ -5,12 +5,13 @@
* See /LICENSE for more information. * See /LICENSE for more information.
*/ */
import React from 'react'; import React from "react";
import {Input} from './Input'; import PropTypes from "prop-types";
import PropTypes from 'prop-types'; import Input from "./Input";
const EmailInput = ({ ...props }) => <Input type="email" {...props} />;
export const EmailInput = ({...props}) => <Input type="email" {...props}/>;
EmailInput.propTypes = { EmailInput.propTypes = {
/** Field label. */ /** Field label. */
@ -22,3 +23,5 @@ EmailInput.propTypes = {
/** Email value. */ /** Email value. */
value: PropTypes.string, value: PropTypes.string,
}; };
export default EmailInput;

View File

@ -5,10 +5,10 @@
* See /LICENSE for more information. * See /LICENSE for more information.
*/ */
import React from 'react'; import React from "react";
import {useUID} from 'react-uid'; import { useUID } from "react-uid/dist/es5/index";
import {formFieldsSize} from './constants'; import PropTypes from "prop-types";
import PropTypes from 'prop-types'; import { formFieldsSize } from "./constants";
Input.propTypes = { Input.propTypes = {
type: PropTypes.string.isRequired, type: PropTypes.string.isRequired,
@ -18,18 +18,21 @@ Input.propTypes = {
className: PropTypes.string, className: PropTypes.string,
children: PropTypes.oneOfType([ children: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.node), PropTypes.arrayOf(PropTypes.node),
PropTypes.node PropTypes.node,
]) ]),
} };
/** Base bootstrap input component. */ /** Base bootstrap input component. */
export function Input({type, label, helpText, error, className, children, ...props}) { export default function Input({
type, label, helpText, error, className, children, ...props
}) {
const uid = useUID(); const uid = useUID();
const inputClassName = `form-control ${className ? className : ''} ${(error ? 'is-invalid' : '')}`.trim(); const inputClassName = `form-control ${className || ""} ${(error ? "is-invalid" : "")}`.trim();
return <div className={formFieldsSize}> return (
<div className='form-group'> <div className={formFieldsSize}>
<div className="form-group">
<label htmlFor={uid}>{label}</label> <label htmlFor={uid}>{label}</label>
<div className='input-group'> <div className="input-group">
<input <input
className={inputClassName} className={inputClassName}
type={type} type={type}
@ -39,8 +42,9 @@ export function Input({type, label, helpText, error, className, children, ...pro
/> />
{children} {children}
</div> </div>
{error ? <div className='invalid-feedback'>{error}</div> : null} {error ? <div className="invalid-feedback">{error}</div> : null}
{helpText ? <small className="form-text text-muted">{helpText}</small> : null} {helpText ? <small className="form-text text-muted">{helpText}</small> : null}
</div> </div>
</div>; </div>
);
} }

View File

@ -5,10 +5,9 @@
* See /LICENSE for more information. * See /LICENSE for more information.
*/ */
import React, {useEffect, useRef} from 'react'; import React, { useEffect, useRef } from "react";
import PropTypes from 'prop-types'; import PropTypes from "prop-types";
import Portal from "utils/Portal";
import {Portal} from 'utils/Portal';
Modal.propTypes = { Modal.propTypes = {
/** Is modal shown value */ /** Is modal shown value */
@ -19,17 +18,16 @@ Modal.propTypes = {
/** Modal content use following: `ModalHeader`, `ModalBody`, `ModalFooter` */ /** Modal content use following: `ModalHeader`, `ModalBody`, `ModalFooter` */
children: PropTypes.oneOfType([ children: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.node), PropTypes.arrayOf(PropTypes.node),
PropTypes.node PropTypes.node,
]).isRequired ]).isRequired,
}; };
export function Modal({shown, setShown, children}) { export function Modal({ shown, setShown, children }) {
const dialogRef = useRef(); const dialogRef = useRef();
useEffect(() => { useEffect(() => {
function handleClickOutsideDialog(e) { function handleClickOutsideDialog(e) {
if (!dialogRef.current.contains(e.target)) if (!dialogRef.current.contains(e.target)) setShown(false);
setShown(false);
} }
document.addEventListener("mousedown", handleClickOutsideDialog); document.addEventListener("mousedown", handleClickOutsideDialog);
@ -39,8 +37,9 @@ export function Modal({shown, setShown, children}) {
}, [setShown]); }, [setShown]);
return <Portal containerId="modal_container"> return (
<div className={'modal fade ' + (shown ? 'show' : '')} role="dialog"> <Portal containerId="modal-container">
<div className={`modal fade ${shown ? "show" : ""}`} role="dialog">
<div ref={dialogRef} className="modal-dialog" role="document"> <div ref={dialogRef} className="modal-dialog" role="document">
<div className="modal-content"> <div className="modal-content">
{children} {children}
@ -48,6 +47,7 @@ export function Modal({shown, setShown, children}) {
</div> </div>
</div> </div>
</Portal> </Portal>
);
} }
ModalHeader.propTypes = { ModalHeader.propTypes = {
@ -55,35 +55,39 @@ ModalHeader.propTypes = {
title: PropTypes.string.isRequired, title: PropTypes.string.isRequired,
}; };
export function ModalHeader({setShown, title}) { export function ModalHeader({ setShown, title }) {
return <div className="modal-header"> return (
<div className="modal-header">
<h5 className="modal-title">{title}</h5> <h5 className="modal-title">{title}</h5>
<button type="button" className="close" onClick={() => setShown(false)}> <button type="button" className="close" onClick={() => setShown(false)}>
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
</div> </div>
);
} }
ModalBody.propTypes = { ModalBody.propTypes = {
children: PropTypes.oneOfType([ children: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.node), PropTypes.arrayOf(PropTypes.node),
PropTypes.node PropTypes.node,
]).isRequired ]).isRequired,
}; };
export function ModalBody({children}) { export function ModalBody({ children }) {
return <div className="modal-body">{children}</div> return <div className="modal-body">{children}</div>;
} }
ModalFooter.propTypes = { ModalFooter.propTypes = {
children: PropTypes.oneOfType([ children: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.node), PropTypes.arrayOf(PropTypes.node),
PropTypes.node PropTypes.node,
]).isRequired ]).isRequired,
}; };
export function ModalFooter({children}) { export function ModalFooter({ children }) {
return <div className="modal-footer"> return (
<div className="modal-footer">
{children} {children}
</div> </div>
);
} }

View File

@ -5,12 +5,12 @@
* See /LICENSE for more information. * See /LICENSE for more information.
*/ */
import React from 'react'; import React from "react";
import {Input} from './Input'; import PropTypes from "prop-types";
import PropTypes from 'prop-types'; import Input from "./Input";
export const NumberInput = ({...props}) => <Input type="number" {...props}/>; const NumberInput = ({ ...props }) => <Input type="number" {...props} />;
NumberInput.propTypes = { NumberInput.propTypes = {
/** Field label. */ /** Field label. */
@ -25,3 +25,5 @@ NumberInput.propTypes = {
PropTypes.number, PropTypes.number,
]), ]),
}; };
export default NumberInput;

View File

@ -5,10 +5,10 @@
* See /LICENSE for more information. * See /LICENSE for more information.
*/ */
import React, {useState} from 'react'; import React, { useState } from "react";
import PropTypes from 'prop-types'; import PropTypes from "prop-types";
import {Input} from './Input'; import Input from "./Input";
PasswordInput.propTypes = { PasswordInput.propTypes = {
/** Field label. */ /** Field label. */
@ -23,22 +23,30 @@ PasswordInput.propTypes = {
withEye: PropTypes.bool, withEye: PropTypes.bool,
}; };
export function PasswordInput({withEye, ...props}) { export default function PasswordInput({ withEye, ...props }) {
const [isHidden, setHidden] = useState(true); const [isHidden, setHidden] = useState(true);
return <Input return (
type={withEye ? isHidden ? 'password' : 'text' : 'password'} <Input
autoComplete={isHidden ? 'new-password' : null} type={withEye && !isHidden ? "text" : "password"}
autoComplete={isHidden ? "new-password" : null}
{...props} {...props}
> >
{withEye ? {withEye
? (
<div className="input-group-append"> <div className="input-group-append">
<button className="input-group-text" onClick={e => { <button
type="button"
className="input-group-text"
onClick={(e) => {
e.preventDefault(); e.preventDefault();
setHidden(isHidden => !isHidden); setHidden((shouldBeHidden) => !shouldBeHidden);
}}> }}
<i className={'fa ' + (isHidden ? 'fa-eye' : 'fa-eye-slash')}/> >
<i className={`fa ${isHidden ? "fa-eye" : "fa-eye-slash"}`} />
</button> </button>
</div> </div>
)
: null} : null}
</Input> </Input>
);
} }

View File

@ -5,37 +5,41 @@
* See /LICENSE for more information. * See /LICENSE for more information.
*/ */
import React from 'react'; import React from "react";
import PropTypes from 'prop-types'; import PropTypes from "prop-types";
import {useUID} from 'react-uid'; import { useUID } from "react-uid/dist/es5/index";
import {formFieldsSize} from './constants'; import { formFieldsSize } from "./constants";
RadioSet.propTypes = { RadioSet.propTypes = {
/** Name attribute of the input HTML tag.*/ /** Name attribute of the input HTML tag. */
name: PropTypes.string.isRequired, name: PropTypes.string.isRequired,
/** RadioSet label .*/ /** RadioSet label . */
label: PropTypes.string, label: PropTypes.string,
/** Choices .*/ /** Choices . */
choices: PropTypes.arrayOf(PropTypes.shape({ choices: PropTypes.arrayOf(PropTypes.shape({
/** Choice lable .*/ /** Choice lable . */
label: PropTypes.string.isRequired, label: PropTypes.string.isRequired,
/** Choice value .*/ /** Choice value . */
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired, value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
})).isRequired, })).isRequired,
/** Initial value .*/ /** Initial value . */
value: PropTypes.string, value: PropTypes.string,
/** Help text message .*/ /** Help text message . */
helpText: PropTypes.string, helpText: PropTypes.string,
}; };
export function RadioSet({name, label, choices, value, helpText, ...props}) { export default function RadioSet({
name, label, choices, value, helpText, ...props
}) {
const uid = useUID(); const uid = useUID();
const radios = choices.map((choice, key) => const radios = choices.map((choice, key) => {
const id = `${name}-${key}`;
return (
<Radio <Radio
id={`${name}-${key}`} id={id}
key={key} key={id}
name={name} name={name}
label={choice.label} label={choice.label}
value={choice.value} value={choice.value}
@ -45,36 +49,45 @@ export function RadioSet({name, label, choices, value, helpText, ...props}) {
{...props} {...props}
/> />
); );
});
return <div className={`form-group ${formFieldsSize}`} style={{marginBottom: '1rem'}}> return (
{label ? <div className={`form-group ${formFieldsSize}`} style={{ marginBottom: "1rem" }}>
<label className='col-12' htmlFor={uid} style={{paddingLeft: '0'}}> {label
? (
<label className="col-12" htmlFor={uid} style={{ paddingLeft: "0" }}>
{label} {label}
</label> </label>
)
: null} : null}
{radios} {radios}
{helpText ? <small className="form-text text-muted">{helpText}</small> : null} {helpText ? <small className="form-text text-muted">{helpText}</small> : null}
</div>; </div>
);
} }
Radio.propTypes = { Radio.propTypes = {
label: PropTypes.string.isRequired, label: PropTypes.string.isRequired,
id: PropTypes.string.isRequired, id: PropTypes.string.isRequired,
helpText: PropTypes.string helpText: PropTypes.string,
}; };
function Radio({label, id, helpText, ...props}) { function Radio({
return <> label, id, helpText, ...props
<div className='custom-control custom-radio custom-control-inline'> }) {
return (
<>
<div className="custom-control custom-radio custom-control-inline">
<input <input
id={id} id={id}
className='custom-control-input' className="custom-control-input"
type='radio' type="radio"
{...props} {...props}
/> />
<label className='custom-control-label' htmlFor={id}>{label}</label> <label className="custom-control-label" htmlFor={id}>{label}</label>
</div> </div>
{helpText ? <small className="form-text text-muted">{helpText}</small> : null} {helpText ? <small className="form-text text-muted">{helpText}</small> : null}
</> </>
);
} }

View File

@ -5,15 +5,15 @@
* See /LICENSE for more information. * See /LICENSE for more information.
*/ */
import React from 'react'; import React from "react";
import PropTypes from 'prop-types'; import PropTypes from "prop-types";
import {useUID} from 'react-uid'; import { useUID } from "react-uid/dist/es5/index";
Select.propTypes = { Select.propTypes = {
/** Select field Label. */ /** Select field Label. */
label: PropTypes.string.isRequired, label: PropTypes.string.isRequired,
/** Choices if form of {value : "Label",...}.*/ /** Choices if form of {value : "Label",...}. */
choices: PropTypes.object.isRequired, choices: PropTypes.object.isRequired,
/** Current value. */ /** Current value. */
value: PropTypes.oneOfType([ value: PropTypes.oneOfType([
@ -24,22 +24,26 @@ Select.propTypes = {
helpText: PropTypes.string, helpText: PropTypes.string,
}; };
export function Select({label, choices, helpText, ...props}) { export default function Select({
label, choices, helpText, ...props
}) {
const uid = useUID(); const uid = useUID();
const options = Object.keys(choices).map( const options = Object.keys(choices).map(
key => <option key={key} value={key}>{choices[key]}</option> (key) => <option key={key} value={key}>{choices[key]}</option>,
); );
return <div className='form-group col-sm-12 offset-lg-1 col-lg-10'> return (
<div className="form-group col-sm-12 offset-lg-1 col-lg-10">
<label htmlFor={uid}>{label}</label> <label htmlFor={uid}>{label}</label>
<select <select
className='custom-select' className="custom-select"
id={uid} id={uid}
{...props} {...props}
> >
{options} {options}
</select> </select>
{helpText ? <small className="form-text text-muted">{helpText}</small> : null} {helpText ? <small className="form-text text-muted">{helpText}</small> : null}
</div>; </div>
);
} }

View File

@ -5,13 +5,13 @@
* See /LICENSE for more information. * See /LICENSE for more information.
*/ */
import React from 'react'; import React from "react";
import PropTypes from 'prop-types'; import PropTypes from "prop-types";
import {Input} from './Input'; import Input from "./Input";
export const TextInput = ({...props}) => <Input type="text" {...props}/>; const TextInput = ({ ...props }) => <Input type="text" {...props} />;
TextInput.propTypes = { TextInput.propTypes = {
@ -22,3 +22,5 @@ TextInput.propTypes = {
/** Help text message. */ /** Help text message. */
helpText: PropTypes.string, helpText: PropTypes.string,
}; };
export default TextInput;

View File

@ -9,7 +9,7 @@ import React from 'react';
import {render} from 'customTestRender'; import {render} from 'customTestRender';
import {Button} from '../Button' import Button from '../Button'
describe('<Button />', () => { describe('<Button />', () => {
it('Render button correctly', () => { it('Render button correctly', () => {

View File

@ -9,7 +9,7 @@ import React from 'react';
import {render} from 'customTestRender'; import {render} from 'customTestRender';
import {CheckBox} from '../Checkbox' import CheckBox from '../Checkbox'
describe('<Checkbox/>', () => { describe('<Checkbox/>', () => {
it('Render checkbox', () => { it('Render checkbox', () => {

View File

@ -9,7 +9,7 @@ import React from 'react';
import {render} from 'customTestRender'; import {render} from 'customTestRender';
import {NumberInput} from '../NumberInput'; import NumberInput from '../NumberInput';
describe('<NumberInput/>', () => { describe('<NumberInput/>', () => {

View File

@ -9,7 +9,7 @@ import React from 'react';
import {render} from 'customTestRender'; import {render} from 'customTestRender';
import {PasswordInput} from '../PasswordInput'; import PasswordInput from '../PasswordInput';
describe('<PasswordInput/>', () => { describe('<PasswordInput/>', () => {
it('Render password input', () => { it('Render password input', () => {

View File

@ -9,7 +9,7 @@ import React from 'react';
import {render} from 'customTestRender'; import {render} from 'customTestRender';
import {RadioSet} from '../RadioSet'; import RadioSet from '../RadioSet';
const TEST_CHOICES = [ const TEST_CHOICES = [
{label: 'label', value: 'value'}, {label: 'label', value: 'value'},

View File

@ -9,7 +9,7 @@ import React from 'react';
import {fireEvent, getByDisplayValue, getByText, render} from 'customTestRender'; import {fireEvent, getByDisplayValue, getByText, render} from 'customTestRender';
import {Select} from '../Select'; import Select from '../Select';
const TEST_CHOICES = { const TEST_CHOICES = {
'1': 'one', '1': 'one',

View File

@ -9,7 +9,7 @@ import React from 'react';
import {render} from 'customTestRender'; import {render} from 'customTestRender';
import {TextInput} from '../TextInput'; import TextInput from '../TextInput';
describe('<TextInput/>', () => { describe('<TextInput/>', () => {
it('Render text input', () => { it('Render text input', () => {

View File

@ -3,6 +3,7 @@
exports[`<Button /> Render button correctly 1`] = ` exports[`<Button /> Render button correctly 1`] = `
<button <button
class="btn btn-primary " class="btn btn-primary "
type="button"
> >
@ -13,6 +14,7 @@ exports[`<Button /> Render button correctly 1`] = `
exports[`<Button /> Render button with custom classes 1`] = ` exports[`<Button /> Render button with custom classes 1`] = `
<button <button
class="btn one two three" class="btn one two three"
type="button"
> >
@ -23,6 +25,7 @@ exports[`<Button /> Render button with custom classes 1`] = `
exports[`<Button /> Render button with spinner 1`] = ` exports[`<Button /> Render button with spinner 1`] = `
<button <button
class="btn btn-primary " class="btn btn-primary "
type="button"
> >
<span <span
aria-hidden="true" aria-hidden="true"

View File

@ -6,4 +6,5 @@
*/ */
/** Bootstrap column size for form fields */ /** Bootstrap column size for form fields */
export const formFieldsSize = 'col-sm-12 offset-lg-1 col-lg-10'; // eslint-disable-next-line import/prefer-default-export
export const formFieldsSize = "col-sm-12 offset-lg-1 col-lg-10";

View File

@ -5,22 +5,25 @@
* See /LICENSE for more information. * See /LICENSE for more information.
*/ */
import React from 'react'; import React from "react";
import {render} from 'customTestRender'; import { render } from "customTestRender";
import {STATES, SubmitButton} from '../components/SubmitButton'; import SubmitButton, { STATES } from "../components/SubmitButton";
describe('<SubmitButton/>', () => { describe("<SubmitButton/>", () => {
it('Render ready', () => { it("Render ready", () => {
const {container} = render(<SubmitButton state={STATES.READY}/>); const { container } = render(<SubmitButton state={STATES.READY}/>);
expect(container).toMatchSnapshot(); expect(container)
.toMatchSnapshot();
}); });
it('Render saving', () => { it("Render saving", () => {
const {container} = render(<SubmitButton state={STATES.SAVING}/>); const { container } = render(<SubmitButton state={STATES.SAVING}/>);
expect(container).toMatchSnapshot(); expect(container)
.toMatchSnapshot();
}); });
it('Render load', () => { it("Render load", () => {
const {container} = render(<SubmitButton state={STATES.LOAD}/>); const { container } = render(<SubmitButton state={STATES.LOAD}/>);
expect(container).toMatchSnapshot(); expect(container)
.toMatchSnapshot();
}); });
}); });

View File

@ -5,6 +5,7 @@ exports[`<SubmitButton/> Render load 1`] = `
<button <button
class="btn btn-primary offset-lg-8 col-lg-3 col-sm-12" class="btn btn-primary offset-lg-8 col-lg-3 col-sm-12"
disabled="" disabled=""
type="button"
> >
<span <span
aria-hidden="true" aria-hidden="true"
@ -23,6 +24,7 @@ exports[`<SubmitButton/> Render ready 1`] = `
<div> <div>
<button <button
class="btn btn-primary offset-lg-8 col-lg-3 col-sm-12" class="btn btn-primary offset-lg-8 col-lg-3 col-sm-12"
type="button"
> >
@ -36,6 +38,7 @@ exports[`<SubmitButton/> Render saving 1`] = `
<button <button
class="btn btn-primary offset-lg-8 col-lg-3 col-sm-12" class="btn btn-primary offset-lg-8 col-lg-3 col-sm-12"
disabled="" disabled=""
type="button"
> >
<span <span
aria-hidden="true" aria-hidden="true"

View File

@ -9,8 +9,8 @@ import React from 'react';
import {act, fireEvent, render, waitForElement} from 'customTestRender'; import {act, fireEvent, render, waitForElement} from 'customTestRender';
import mockAxios from 'jest-mock-axios'; import mockAxios from 'jest-mock-axios';
import ForisForm from "../components/ForisForm";
import {ForisForm} from '../components/ForisForm';
// It's possible to unittest each hooks via react-hooks-testing-library. // It's possible to unittest each hooks via react-hooks-testing-library.
// But it's better and easier to test it by test components which uses this hooks. // But it's better and easier to test it by test components which uses this hooks.
@ -76,39 +76,39 @@ describe('useForm hook.', () => {
expect(Child.mock.calls[1][0].formErrors).toMatchObject({field: 'Error'}); expect(Child.mock.calls[1][0].formErrors).toMatchObject({field: 'Error'});
}); });
// it('Update text value.', () => { it('Update text value.', () => {
// fireEvent.change(input, {target: {value: 'newValue', type: 'text'}}) fireEvent.change(input, {target: {value: 'newValue', type: 'text'}})
// expect(input.value).toBe('newValue'); expect(input.value).toBe('newValue');
// }); });
//
// it('Update text value.', () => { it('Update text value.', () => {
// fireEvent.change(input, {target: {value: 123, type: 'number'}}) fireEvent.change(input, {target: {value: 123, type: 'number'}})
// expect(input.value).toBe('123'); expect(input.value).toBe('123');
// }); });
//
// it('Update checkbox value.', () => { it('Update checkbox value.', () => {
// fireEvent.change(input, {target: {checked: true, type: 'checkbox'}}) fireEvent.change(input, {target: {checked: true, type: 'checkbox'}})
// expect(input.checked).toBe(true); expect(input.checked).toBe(true);
// }); });
//
// it('Fetch data.', () => { it('Fetch data.', () => {
// expect(mockAxios.get).toHaveBeenCalledWith('/api/wan', expect.anything()); expect(mockAxios.get).toHaveBeenCalledWith('testEndpoint', expect.anything());
// expect(mockPrepData).toHaveBeenCalledTimes(1); expect(mockPrepData).toHaveBeenCalledTimes(1);
// expect(Child.mock.calls[0][0].formData).toMatchObject({field: 'preparedData'}); expect(Child.mock.calls[0][0].formData).toMatchObject({field: 'preparedData'});
// }); });
//
// it('Submit.', () => { it('Submit.', () => {
// expect(mockAxios.get).toHaveBeenCalledTimes(1); expect(mockAxios.get).toHaveBeenCalledTimes(1);
// expect(mockPrepDataToSubmit).toHaveBeenCalledTimes(0); expect(mockPrepDataToSubmit).toHaveBeenCalledTimes(0);
//
// fireEvent.submit(form); fireEvent.submit(form);
//
// expect(mockPrepDataToSubmit).toHaveBeenCalledTimes(1); expect(mockPrepDataToSubmit).toHaveBeenCalledTimes(1);
// expect(mockAxios.post).toHaveBeenCalledTimes(1); expect(mockAxios.post).toHaveBeenCalledTimes(1);
// expect(mockAxios.post).toHaveBeenCalledWith( expect(mockAxios.post).toHaveBeenCalledWith(
// '/api/wan', 'testEndpoint',
// {'field': 'preparedDataToSubmit'}, {'field': 'preparedDataToSubmit'},
// expect.anything(), expect.anything(),
// ); );
// }); });
}); });

View File

@ -5,16 +5,16 @@
* See /LICENSE for more information. * See /LICENSE for more information.
*/ */
import React, {useEffect, useState} from 'react'; import React, { useEffect, useState } from "react";
import PropTypes from 'prop-types'; import PropTypes from "prop-types";
import {Prompt} from 'react-router';
import {Spinner} from 'bootstrap/Spinner'; import { Spinner } from "bootstrap/Spinner";
import {useAPIPost} from 'api/hooks'; import { useAPIPost } from "api/hooks";
import {useForisModule, useForm} from '../hooks'; import { Prompt } from "react-router";
import {STATES as SUBMIT_BUTTON_STATES, SubmitButton} from './SubmitButton'; import { useForisModule, useForm } from "../hooks";
import {FailAlert, SuccessAlert} from './alerts'; import { STATES as SUBMIT_BUTTON_STATES, SubmitButton } from "./SubmitButton";
import { FailAlert, SuccessAlert } from "./alerts";
ForisForm.propTypes = { ForisForm.propTypes = {
/** WebSocket object see `scr/common/WebSockets.js`. */ /** WebSocket object see `scr/common/WebSockets.js`. */
@ -27,7 +27,7 @@ ForisForm.propTypes = {
* If it's not passed then WebSockets aren't used * If it's not passed then WebSockets aren't used
* */ * */
wsModule: PropTypes.string, wsModule: PropTypes.string,
/**`foris-controller` action name to be used via WebSockets. /** `foris-controller` action name to be used via WebSockets.
* If it's not passed then `update_settings` is used. see `src/common/WebSocketHooks.js` * If it's not passed then `update_settings` is used. see `src/common/WebSocketHooks.js`
* */ * */
wsAction: PropTypes.string, wsAction: PropTypes.string,
@ -45,19 +45,19 @@ ForisForm.propTypes = {
/** reForis form components. */ /** reForis form components. */
children: PropTypes.node.isRequired, children: PropTypes.node.isRequired,
/** Optional override of form submit callback */ /** Optional override of form submit callback */
onSubmitOverridden: PropTypes.func onSubmitOverridden: PropTypes.func,
}; };
ForisForm.defaultProps = { ForisForm.defaultProps = {
prepData: data => data, prepData: (data) => data,
prepDataToSubmit: data => data, prepDataToSubmit: (data) => data,
postCallback: () => undefined, postCallback: () => undefined,
validator: () => undefined, validator: () => undefined,
disabled: false disabled: false,
}; };
/** Serves as HOC for all foris forms components. */ /** Serves as HOC for all foris forms components. */
export function ForisForm({ export default function ForisForm({
ws, ws,
forisConfig, forisConfig,
prepData, prepData,
@ -66,21 +66,20 @@ export function ForisForm({
validator, validator,
disabled, disabled,
onSubmitOverridden, onSubmitOverridden,
children children,
}) { }) {
const [formState, onFormChangeHandler, resetFormData] = useForm(validator, prepData); const [formState, onFormChangeHandler, resetFormData] = useForm(validator, prepData);
const [forisModuleState] = useForisModule(ws, forisConfig); const [forisModuleState] = useForisModule(ws, forisConfig);
useEffect(() => { useEffect(() => {
if (forisModuleState.data) { if (forisModuleState.data) {
resetFormData(forisModuleState.data) resetFormData(forisModuleState.data);
} }
}, [forisModuleState.data, resetFormData, prepData]); }, [forisModuleState.data, resetFormData, prepData]);
const [postState, post] = useAPIPost(forisConfig.endpoint); const [postState, post] = useAPIPost(forisConfig.endpoint);
useEffect(() => { useEffect(() => {
if (postState.isSuccess) if (postState.isSuccess) postCallback();
postCallback();
}, [postCallback, postState.isSuccess]); }, [postCallback, postState.isSuccess]);
@ -93,50 +92,50 @@ export function ForisForm({
} }
function getSubmitButtonState() { function getSubmitButtonState() {
if (postState.isSending) if (postState.isSending) return SUBMIT_BUTTON_STATES.SAVING;
return SUBMIT_BUTTON_STATES.SAVING; if (forisModuleState.isLoading) return SUBMIT_BUTTON_STATES.LOAD;
else if (forisModuleState.isLoading)
return SUBMIT_BUTTON_STATES.LOAD;
return SUBMIT_BUTTON_STATES.READY; return SUBMIT_BUTTON_STATES.READY;
} }
const [alertIsDismissed, setAlertIsDismissed] = useState(false); const [alertIsDismissed, setAlertIsDismissed] = useState(false);
if (!formState.data) if (!formState.data) return <Spinner className="row justify-content-center"/>;
return <Spinner className='row justify-content-center'/>;
const formIsDisabled = disabled || forisModuleState.isLoading || postState.isSending; const formIsDisabled = disabled || forisModuleState.isLoading || postState.isSending;
const submitButtonIsDisabled = disabled || !!formState.errors; const submitButtonIsDisabled = disabled || !!formState.errors;
const childrenWithFormProps = const childrenWithFormProps = React.Children.map(
React.Children.map(children, child => children,
React.cloneElement(child, { (child) => React.cloneElement(child, {
formData: formState.data, formData: formState.data,
formErrors: formState.errors, formErrors: formState.errors,
setFormValue: onFormChangeHandler, setFormValue: onFormChangeHandler,
disabled: formIsDisabled, disabled: formIsDisabled,
}) }),
); );
const onSubmit = onSubmitOverridden ? const onSubmit = onSubmitOverridden
onSubmitOverridden(formState.data, onFormChangeHandler, onSubmitHandler) : onSubmitHandler; ? onSubmitOverridden(formState.data, onFormChangeHandler, onSubmitHandler)
: onSubmitHandler;
function getMessageOnLeavingPage() { function getMessageOnLeavingPage() {
if (JSON.stringify(formState.data) === JSON.stringify(formState.initialData)) if (JSON.stringify(formState.data) === JSON.stringify(formState.initialData)) return true;
return true; return _("Changes you made may not be saved. Are you sure you want to leave?");
return _('Changes you made may not be saved. Are you sure you want to leave?')
} }
return <> let alert = null;
<Prompt message={getMessageOnLeavingPage}/> if (!alertIsDismissed) {
{!alertIsDismissed ? if (postState.isSuccess) {
postState.isSuccess ? alert = <SuccessAlert onDismiss={() => setAlertIsDismissed(true)}/>;
<SuccessAlert onDismiss={() => setAlertIsDismissed(true)}/> } else if (postState.isError) {
: postState.isError ? alert = <FailAlert onDismiss={() => setAlertIsDismissed(true)}/>;
<FailAlert onDismiss={() => setAlertIsDismissed(true)}/>
: null
: null
} }
}
return (
<>
<Prompt message={getMessageOnLeavingPage}/>
{alert}
<form onSubmit={onSubmit}> <form onSubmit={onSubmit}>
{childrenWithFormProps} {childrenWithFormProps}
<SubmitButton <SubmitButton
@ -145,4 +144,5 @@ export function ForisForm({
/> />
</form> </form>
</> </>
);
} }

View File

@ -8,7 +8,7 @@
import React from "react"; import React from "react";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { Button } from "bootstrap/Button"; import Button from "bootstrap/Button";
export const STATES = { export const STATES = {
READY: 1, READY: 1,

View File

@ -5,38 +5,42 @@
* See /LICENSE for more information. * See /LICENSE for more information.
*/ */
import React from 'react'; import React from "react";
import PropTypes from 'prop-types'; import PropTypes from "prop-types";
import {Alert} from 'bootstrap/Alert'; import Alert from "bootstrap/Alert";
import {Portal} from 'utils/Portal'; import Portal from "utils/Portal";
SuccessAlert.propTypes = { SuccessAlert.propTypes = {
onDismiss: PropTypes.func.isRequired, onDismiss: PropTypes.func.isRequired,
}; };
const ALERT_CONTAINER_ID = 'alert_container'; const ALERT_CONTAINER_ID = "alert-container";
export function SuccessAlert({onDismiss}) { export function SuccessAlert({ onDismiss }) {
return <Portal containerId={ALERT_CONTAINER_ID}> return (
<Portal containerId={ALERT_CONTAINER_ID}>
<Alert <Alert
type='success' type="success"
message={_('Settings were successfully saved.')} message={_("Settings were successfully saved.")}
onDismiss={onDismiss} onDismiss={onDismiss}
/> />
</Portal>; </Portal>
);
} }
FailAlert.propTypes = { FailAlert.propTypes = {
onDismiss: PropTypes.func.isRequired, onDismiss: PropTypes.func.isRequired,
}; };
export function FailAlert({onDismiss}) { export function FailAlert({ onDismiss }) {
return <Portal containerId={ALERT_CONTAINER_ID}> return (
<Portal containerId={ALERT_CONTAINER_ID}>
<Alert <Alert
type='danger' type="danger"
message={_('Settings update was failed.')} message={_("Settings update was failed.")}
onDismiss={onDismiss} onDismiss={onDismiss}
/> />
</Portal> </Portal>
);
} }

View File

@ -9,7 +9,7 @@ import { useCallback, useEffect, useReducer } from "react";
import update from "immutability-helper"; import update from "immutability-helper";
import { useAPIGet } from "api/hooks"; import { useAPIGet } from "api/hooks";
import { useWSForisModule } from "webSockets/hooks"; import useWSForisModule from "webSockets/hooks";
const FORM_ACTIONS = { const FORM_ACTIONS = {
@ -18,7 +18,6 @@ const FORM_ACTIONS = {
}; };
export function useForm(validator, prepData) { export function useForm(validator, prepData) {
const [state, dispatch] = useReducer(formReducer, { const [state, dispatch] = useReducer(formReducer, {
data: null, data: null,
initialData: null, initialData: null,
@ -82,7 +81,7 @@ function getChangedValue(target) {
value = target.checked; value = target.checked;
} else if (target.type === "number") { } else if (target.type === "number") {
const parsedValue = parseInt(value); const parsedValue = parseInt(value);
value = isNaN(parsedValue) ? value : parsedValue; value = Number.isNaN(parsedValue) ? value : parsedValue;
} }
return value; return value;
} }

View File

@ -1,41 +1,53 @@
//API // API
export {useAPIGet, useAPIPost} from "./api/hooks"; export { useAPIGet, useAPIPost } from "./api/hooks";
// Bootstrap // Bootstrap
export {Alert} from "bootstrap/Alert"; export * as Alert from "bootstrap/Alert";
export {Button} from "bootstrap/Button"; export * as Button from "bootstrap/Button";
export {CheckBox} from "bootstrap/Checkbox"; export * as CheckBox from "bootstrap/Checkbox";
export {formFieldsSize} from "bootstrap/constants"; export * as formFieldsSize from "bootstrap/constants";
export {DataTimeInput} from "bootstrap/DataTimeInput"; export * as DataTimeInput from "bootstrap/DataTimeInput";
export {EmailInput} from "bootstrap/EmailInput"; export * as EmailInput from "bootstrap/EmailInput";
export {Input} from "bootstrap/Input"; export * as Input from "bootstrap/Input";
export {Modal, ModalBody, ModalFooter, ModalHeader} from "bootstrap/Modal"; export * as NumberInput from "bootstrap/NumberInput";
export {NumberInput} from "bootstrap/NumberInput"; export * as PasswordInput from "bootstrap/PasswordInput";
export {PasswordInput} from "bootstrap/PasswordInput"; export * as RadioSet from "bootstrap/RadioSet";
export {RadioSet} from "bootstrap/RadioSet"; export * as Select from "bootstrap/Select";
export {Select} from "bootstrap/Select"; export * as TextInput from "bootstrap/TextInput";
export {Spinner, SpinnerElement} from "bootstrap/Spinner"; export {
export {TextInput} from "bootstrap/TextInput"; Spinner,
SpinnerElement,
} from "bootstrap/Spinner";
export {
Modal,
ModalBody,
ModalFooter,
ModalHeader,
} from "bootstrap/Modal";
// Form // Form
export {ForisForm} from "form/components/ForisForm"; export ForisForm from "form/components/ForisForm";
export {SubmitButton, STATES as SUBMIT_BUTTON_STATES} from "form/components/SubmitButton"; export { SubmitButton, STATES as SUBMIT_BUTTON_STATES } from "form/components/SubmitButton";
export {useForisModule, useForm} from "form/hooks"; export { useForisModule, useForm } from "form/hooks";
// Test Utils // Test Utils
export {mockedWS} from "testUtils/mockWS"; export { mockedWS } from "testUtils/mockWS";
// WebSockets // WebSockets
export {useWSForisModule} from "webSockets/hooks"; export * as useWSForisModule from "webSockets/hooks";
export {WebSockets} from "webSockets/WebSockets"; export * as WebSockets from "webSockets/WebSockets";
// Utils // Utils
export {Portal} from "utils/Portal"; export * as Portal from "utils/Portal";
// Foris URL // Foris URL
export {ForisURLs, REFORIS_URL_PREFIX} from "./forisUrls" export { ForisURLs, REFORIS_URL_PREFIX } from "./forisUrls";
// Validation // Validation
export { export {
@ -46,4 +58,4 @@ export {
validateDUID, validateDUID,
validateMAC, validateMAC,
validateMultipleEmails, validateMultipleEmails,
} from "validations" } from "validations";

View File

@ -5,11 +5,10 @@
* See /LICENSE for more information. * See /LICENSE for more information.
*/ */
import ReactDOM from 'react-dom'; import ReactDOM from "react-dom";
export function Portal({containerId, children}) { export default function Portal({ containerId, children }) {
const container = document.getElementById(containerId); const container = document.getElementById(containerId);
if (container) if (container) return ReactDOM.createPortal(children, container);
return ReactDOM.createPortal(children, container);
return null; return null;
} }

View File

@ -5,7 +5,9 @@
* See /LICENSE for more information. * See /LICENSE for more information.
*/ */
import { ForisUrls } from "forisUrls"; /* eslint no-console: "off" */
import { ForisURLs } from "forisUrls";
const PROTOCOL = window.location.protocol === "http:" ? "ws" : "wss"; const PROTOCOL = window.location.protocol === "http:" ? "ws" : "wss";
@ -15,13 +17,13 @@ const URL = process.env.LIGHTTPD
const WAITING_FOR_CONNECTION_TIMEOUT = 500; const WAITING_FOR_CONNECTION_TIMEOUT = 500;
export class WebSockets { export default class WebSockets {
constructor() { constructor() {
this.ws = new WebSocket(URL); this.ws = new WebSocket(URL);
this.ws.onerror = (e) => { this.ws.onerror = (e) => {
if (window.location.pathname !== ForisUrls.login) { if (window.location.pathname !== ForisURLs.login) {
console.error("WS: Error observed, you aren't logged probably."); console.error("WS: Error observed, you aren't logged probably.");
window.location.replace(ForisUrls.login); window.location.replace(ForisURLs.login);
} }
console.log(`WS: Error: ${e}`); console.log(`WS: Error: ${e}`);
}; };

View File

@ -7,12 +7,13 @@
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
export function useWSForisModule(ws, module, action = "update_settings") { export default function useWSForisModule(ws, module, action = "update_settings") {
const [data, setData] = useState(null); const [data, setData] = useState(null);
useEffect(() => { useEffect(() => {
if (ws && module) { if (ws && module) {
ws.subscribe(module).bind(module, action, (msg) => { ws.subscribe(module)
.bind(module, action, (msg) => {
setData(msg.data); setData(msg.data);
}); });
} }