@factorialco/fcode-react-forms 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/dist/components/fcode-form/fcode-form.d.ts +76 -0
  2. package/dist/components/fcode-form/fcode-form.test.d.ts +6 -0
  3. package/dist/components/fcode-form/fcode-form.utils.d.ts +17 -0
  4. package/dist/components/fcode-form/fcode-form.utils.test.d.ts +6 -0
  5. package/dist/components/fcode-form/index.d.ts +1 -0
  6. package/dist/components/form-skeleton/form-skeleton.d.ts +13 -0
  7. package/dist/components/json-schema-form/default-theme/default-theme.test.d.ts +1 -0
  8. package/dist/components/json-schema-form/default-theme/index.d.ts +19 -0
  9. package/dist/components/json-schema-form/default-theme/templates/array-field-item-buttons-template.d.ts +8 -0
  10. package/dist/components/json-schema-form/default-theme/templates/array-field-item-template.d.ts +4 -0
  11. package/dist/components/json-schema-form/default-theme/templates/array-field-template.d.ts +4 -0
  12. package/dist/components/json-schema-form/default-theme/templates/button-templates.d.ts +10 -0
  13. package/dist/components/json-schema-form/default-theme/templates/description-field-template.d.ts +4 -0
  14. package/dist/components/json-schema-form/default-theme/templates/field-error-template.d.ts +4 -0
  15. package/dist/components/json-schema-form/default-theme/templates/field-help-template.d.ts +4 -0
  16. package/dist/components/json-schema-form/default-theme/templates/field-template.d.ts +12 -0
  17. package/dist/components/json-schema-form/default-theme/templates/index.d.ts +11 -0
  18. package/dist/components/json-schema-form/default-theme/templates/object-field-template.d.ts +4 -0
  19. package/dist/components/json-schema-form/default-theme/templates/title-field-template.d.ts +7 -0
  20. package/dist/components/json-schema-form/default-theme/templates/wrap-if-additional-template.d.ts +11 -0
  21. package/dist/components/json-schema-form/default-theme/widgets/checkbox-widget.d.ts +4 -0
  22. package/dist/components/json-schema-form/default-theme/widgets/checkboxes-widget.d.ts +4 -0
  23. package/dist/components/json-schema-form/default-theme/widgets/index.d.ts +4 -0
  24. package/dist/components/json-schema-form/default-theme/widgets/radio-widget.d.ts +4 -0
  25. package/dist/components/json-schema-form/default-theme/widgets/textarea-widget.d.ts +4 -0
  26. package/dist/components/json-schema-form/fcode-json-schema-form.d.ts +18 -0
  27. package/dist/components/json-schema-form/fields/button-field.d.ts +2 -0
  28. package/dist/components/json-schema-form/fields/index.d.ts +3 -0
  29. package/dist/components/json-schema-form/fields/json-field.d.ts +2 -0
  30. package/dist/components/json-schema-form/fields/source-code-field-editor-theme.json.d.ts +223 -0
  31. package/dist/components/json-schema-form/fields/source-code-field.d.ts +2 -0
  32. package/dist/components/json-schema-form/index.d.ts +2 -0
  33. package/dist/components/json-schema-form/markdown-content.d.ts +2 -0
  34. package/dist/components/loading-overlay/loading-overlay.d.ts +9 -0
  35. package/dist/data/embed-form-options-with-i18n.d.ts +3 -0
  36. package/dist/data/embed-form-options.d.ts +3 -0
  37. package/dist/data/fcode-form-specs-with-i18n.d.ts +3 -0
  38. package/dist/data/fcode-form-specs-with-ref-replacements.d.ts +3 -0
  39. package/dist/data/fcode-form-specs.d.ts +3 -0
  40. package/dist/data/index.d.ts +9 -0
  41. package/dist/data/schema-with-i18n.d.ts +3 -0
  42. package/dist/data/schema-with-ref-replacements.d.ts +3 -0
  43. package/dist/data/schema.d.ts +3 -0
  44. package/dist/data/ui-schema.d.ts +3 -0
  45. package/dist/fcode-form.cjs.js +132 -0
  46. package/dist/fcode-form.cjs.js.map +1 -0
  47. package/dist/fcode-form.es.js +30199 -0
  48. package/dist/fcode-form.es.js.map +1 -0
  49. package/dist/fcode-form.umd.js +132 -0
  50. package/dist/fcode-form.umd.js.map +1 -0
  51. package/dist/hooks/use-form-specs.d.ts +7 -0
  52. package/dist/hooks/use-form-specs.test.d.ts +1 -0
  53. package/dist/hooks/use-form-stylesheets.d.ts +10 -0
  54. package/dist/hooks/use-stylesheets.d.ts +6 -0
  55. package/dist/hooks/use-stylesheets.test.d.ts +1 -0
  56. package/dist/hooks/use-submit-form.d.ts +9 -0
  57. package/dist/hooks/use-submit-form.test.d.ts +1 -0
  58. package/dist/index.d.ts +6 -0
  59. package/dist/services/fcode.d.ts +3 -0
  60. package/dist/services/fcode.test.d.ts +1 -0
  61. package/dist/styles-theme-light.css +79 -0
  62. package/dist/styles.css +1519 -0
  63. package/dist/types.d.ts +75 -0
  64. package/dist/utils/build-id.d.ts +1 -0
  65. package/dist/utils/build-id.test.d.ts +1 -0
  66. package/dist/utils/build-process-url.d.ts +1 -0
  67. package/dist/utils/build-process-url.test.d.ts +1 -0
  68. package/dist/utils/index.d.ts +4 -0
  69. package/dist/utils/is-valid-url.d.ts +1 -0
  70. package/dist/utils/is-valid-url.test.d.ts +1 -0
  71. package/dist/utils/merge-deep.d.ts +1 -0
  72. package/dist/utils/process-form-specs.d.ts +2 -0
  73. package/dist/utils/process-form-specs.test.d.ts +1 -0
  74. package/dist/utils/sanitize-html.d.ts +8 -0
  75. package/dist/utils/sanitize-html.test.d.ts +1 -0
  76. package/package.json +97 -0
@@ -0,0 +1,75 @@
1
+ import { RJSFSchema, UiSchema } from '@rjsf/utils';
2
+ import { JSONSchema7 } from 'json-schema';
3
+ export interface ProcessedFormSpecs {
4
+ schema: JSONSchema7;
5
+ uiSchema: UiSchema;
6
+ embedFormOptions: EmbedFormOptions;
7
+ }
8
+ export interface FormOptions {
9
+ hostUrl: string;
10
+ headers?: GenericObjectType;
11
+ team: string;
12
+ processId: string;
13
+ processVersion?: string;
14
+ async?: boolean;
15
+ }
16
+ export type GenericObjectType = {
17
+ [name: string]: any;
18
+ };
19
+ export type Theme = 'light' | 'none';
20
+ export type { UiSchema, JSONSchema7 };
21
+ export interface EmbedFormOptions {
22
+ theme?: Theme;
23
+ themeStylesheet?: string;
24
+ stylesheet?: string;
25
+ /**
26
+ * Base URL the default theme stylesheets and branding asset are loaded from.
27
+ * Defaults to the hosted SDK (`https://code.factorialhr.com/sdk`). Same-origin
28
+ * embedders (e.g. the web client) can pass a host-relative path like `/sdk`
29
+ * so assets resolve against the current host instead of production.
30
+ */
31
+ stylesheetBaseUrl?: string;
32
+ className?: string;
33
+ loadingOverlayDisabled?: boolean;
34
+ loadingOverlayContent?: string;
35
+ /**
36
+ * Message shown while the form schema is loading (e.g. while a
37
+ * `preRenderProcess` runs). Must be set by the embedder — unlike the other
38
+ * options it cannot come from the schema, since the schema is what is being
39
+ * loaded. Defaults to 'Loading form...'.
40
+ */
41
+ loadingContent?: string;
42
+ locale: string;
43
+ fallbackLocale?: string;
44
+ variables?: GenericObjectType;
45
+ i18nVariables?: GenericObjectType;
46
+ }
47
+ export interface FormSpecsSchema extends RJSFSchema {
48
+ ui: UiSchema;
49
+ embedFormOptions: EmbedFormOptions;
50
+ }
51
+ export interface FormSpecs extends RJSFSchema {
52
+ schema: FormSpecsSchema;
53
+ }
54
+ export type FormData = GenericObjectType;
55
+ export interface RedirectConfig {
56
+ url: string;
57
+ timeout?: number;
58
+ }
59
+ export type SubmitFormResults = GenericObjectType;
60
+ export interface FetchFormSpecsParams {
61
+ hostUrl: string;
62
+ headers?: GenericObjectType;
63
+ team: string;
64
+ processId: string;
65
+ processVersion?: string;
66
+ }
67
+ export interface SubmitFormParams {
68
+ hostUrl: string;
69
+ headers?: GenericObjectType;
70
+ team: string;
71
+ processId: string;
72
+ processVersion?: string;
73
+ async?: boolean;
74
+ formData: FormData;
75
+ }
@@ -0,0 +1 @@
1
+ export declare const buildId: () => string;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export declare const buildProcessUrl: (hostUrl: string, team: string, processId: string) => string;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ export { buildProcessUrl } from './build-process-url';
2
+ export { buildId } from './build-id';
3
+ export { isValidURL } from './is-valid-url';
4
+ export { sanitizeHtml } from './sanitize-html';
@@ -0,0 +1 @@
1
+ export declare const isValidURL: (str: string) => boolean;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export declare const mergeDeep: (target: any, ...sources: any) => any;
@@ -0,0 +1,2 @@
1
+ import { FormSpecs, ProcessedFormSpecs } from '../types';
2
+ export declare function processFormSpecs(formSpecs: FormSpecs): ProcessedFormSpecs;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Sanitizes authored HTML so it can be rendered without executing scripts.
3
+ *
4
+ * @param dirty - The HTML string as authored in the schema or returned by a
5
+ * process execution.
6
+ * @returns The same markup with every script-execution vector removed.
7
+ */
8
+ export declare function sanitizeHtml(dirty: string): string;
@@ -0,0 +1 @@
1
+ export {};
package/package.json ADDED
@@ -0,0 +1,97 @@
1
+ {
2
+ "name": "@factorialco/fcode-react-forms",
3
+ "version": "1.0.0",
4
+ "description": "Factorial Code allows start process executions from any webpage embedding process input parameters forms. This allows each form submission to start one execution with the information filled in the form, and also allows to manage the execution result into that webpage.",
5
+ "type": "module",
6
+ "homepage": "https://code.factorialhr.com/docs/forms/",
7
+ "author": "Factorial Code Developers <factorial-code@factorial.co>",
8
+ "license": "See LICENSE file",
9
+ "keywords": [
10
+ "fcode",
11
+ "form",
12
+ "react"
13
+ ],
14
+ "publishConfig": {
15
+ "access": "public"
16
+ },
17
+ "files": [
18
+ "dist",
19
+ "README.md"
20
+ ],
21
+ "main": "./dist/fcode-form.umd.js",
22
+ "module": "./dist/fcode-form.es.js",
23
+ "exports": {
24
+ "./styles.css": "./dist/styles.css",
25
+ "./styles-theme-light.css": "./dist/styles-theme-light.css",
26
+ ".": {
27
+ "types": "./dist/index.d.ts",
28
+ "import": "./dist/fcode-form.es.js",
29
+ "require": "./dist/fcode-form.umd.js"
30
+ }
31
+ },
32
+ "types": "./dist/index.d.ts",
33
+ "scripts": {
34
+ "dev": "vite",
35
+ "update-test-snaps": "vitest --update",
36
+ "build": "tsc && vitest run && vite build",
37
+ "build:lib": "tsc && vite build",
38
+ "test": "vitest run",
39
+ "watch": "vitest",
40
+ "coverage": "vitest run --coverage"
41
+ },
42
+ "browserslist": {
43
+ "production": [
44
+ ">0.2%",
45
+ "not dead",
46
+ "not op_mini all"
47
+ ],
48
+ "development": [
49
+ "last 1 chrome version",
50
+ "last 1 firefox version",
51
+ "last 1 safari version"
52
+ ]
53
+ },
54
+ "devDependencies": {
55
+ "@testing-library/dom": "^10.0.0",
56
+ "@testing-library/jest-dom": "^6.6.3",
57
+ "@testing-library/react": "^16.0.1",
58
+ "@types/json-schema": "^7.0.15",
59
+ "@types/node": "^22.0.0",
60
+ "@types/react": "^19.0.0",
61
+ "@types/react-dom": "^19.0.0",
62
+ "@types/react-transition-group": "^4.4.12",
63
+ "@vitejs/plugin-react": "^4.3.4",
64
+ "@vitest/coverage-v8": "^4.0.0",
65
+ "babel-loader": "^9.1.3",
66
+ "jest-fetch-mock": "^3.0.3",
67
+ "jsdom": "^28.0.0",
68
+ "prop-types": "^15.8.1",
69
+ "react": "^19.0.0",
70
+ "react-dom": "^19.0.0",
71
+ "typescript": "^5.4.5",
72
+ "vite": "^6",
73
+ "vite-plugin-dts": "^4.3.0",
74
+ "vitest": "^4.0.0"
75
+ },
76
+ "dependencies": {
77
+ "@babel/runtime": "^7.26.10",
78
+ "@monaco-editor/react": "^4.7.0",
79
+ "@rjsf/core": "^6.7.1",
80
+ "@rjsf/utils": "^6.7.1",
81
+ "@rjsf/validator-ajv8": "^6.7.1",
82
+ "ajv": "^8.18.0",
83
+ "ajv-i18n": "^4.2.0",
84
+ "classnames": "^2.5.1",
85
+ "dompurify": "3.4.12",
86
+ "mustache": "^4.2.0",
87
+ "react-markdown": "^10.1.0",
88
+ "react-transition-group": "^4.4.5"
89
+ },
90
+ "peerDependencies": {
91
+ "react": "^18.0.0 || ^19.0.0",
92
+ "react-dom": "^18.0.0 || ^19.0.0"
93
+ },
94
+ "optionalDependencies": {
95
+ "@rollup/rollup-linux-x64-gnu": "4.28.0"
96
+ }
97
+ }