@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,7 @@
1
+ import { FormOptions, FormSpecs } from '../types';
2
+ declare const useFormSpecs: ({ hostUrl, headers, team, processId, processVersion, }: FormOptions) => {
3
+ loading: boolean;
4
+ formSpecs: FormSpecs | undefined;
5
+ error: unknown;
6
+ };
7
+ export default useFormSpecs;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ import { EmbedFormOptions } from '../types';
2
+ /**
3
+ * Injects the stylesheets a form needs, resolved from its embed options.
4
+ *
5
+ * Called both before the schema is fetched (so the loading placeholder is
6
+ * styled) and by the rendered schema form (which knows the schema-authored
7
+ * `stylesheet` / `themeStylesheet` / `theme`). `useStylesheets` skips files
8
+ * already present in the document, so the two calls don't duplicate them.
9
+ */
10
+ export declare function useFormStylesheets(embedFormOptions: EmbedFormOptions): void;
@@ -0,0 +1,6 @@
1
+ export interface UseStylesheetsOptions {
2
+ stylesheets: string[];
3
+ }
4
+ export declare function useStylesheets({ stylesheets, }: {
5
+ stylesheets: string[];
6
+ }): void;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ import { FormOptions, SubmitFormResults, FormData } from '../types';
2
+ declare const useSubmitForm: ({ hostUrl, headers, team, processId, processVersion, async, }: FormOptions) => [(data: FormData) => Promise<any>, {
3
+ loading: boolean;
4
+ results: SubmitFormResults | undefined;
5
+ error: string | undefined;
6
+ formData: FormData | undefined;
7
+ reset: () => void;
8
+ }];
9
+ export default useSubmitForm;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ import { FcodeForm } from './components/fcode-form';
2
+ import { default as FcodeJsonSchemaForm } from './components/json-schema-form/fcode-json-schema-form';
3
+ import { processFormSpecs } from './utils/process-form-specs';
4
+ import { buildId } from './utils';
5
+ export { FcodeForm, FcodeJsonSchemaForm, processFormSpecs, buildId };
6
+ export default FcodeForm;
@@ -0,0 +1,3 @@
1
+ import { SubmitFormParams, SubmitFormResults, FetchFormSpecsParams } from '../types';
2
+ export declare const fetchFormSpecs: ({ hostUrl, headers, team, processId, processVersion, }: FetchFormSpecsParams) => Promise<any>;
3
+ export declare const submitForm: ({ hostUrl, headers, team, processId, processVersion, async, formData, }: SubmitFormParams) => Promise<SubmitFormResults>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,79 @@
1
+ /*
2
+ * Default (light) theme — aligned to Factorial's f0 design system.
3
+ * Accent / primary = radical (pink-red), focus & selection = viridian (teal),
4
+ * danger = red, neutrals = f0 alpha-on-ink greys. Values mirror
5
+ * @factorialco/f0-core (light mode); see the f0-look-and-feel skill.
6
+ */
7
+ :root {
8
+ --ycf-accent-color: hsl(348 80% 50%); /* radical.50 */
9
+ --ycf-accent-color-darker: hsl(348 80% 42%); /* radical.60 */
10
+
11
+ --ycf-selected-color: hsl(184 92% 35%); /* viridian.50 — focus / selection */
12
+ --ycf-selected-color-darker: hsl(184 92% 28%); /* viridian.60 */
13
+
14
+ --ycf-base-text-color: hsl(218 48% 10%); /* neutral-100 */
15
+ --ycf-light-text-color: hsl(217 96% 11% / 0.61); /* neutral-50 */
16
+ --ycf-danger-color: hsl(5 100% 65%); /* red.50 / critical */
17
+ --ycf-danger-color-lighten: hsl(5 100% 65% / 0.1);
18
+ --ycf-danger-color-darker: hsl(4 61% 49%); /* red.60 */
19
+ --ycf-base-border-color: hsl(213 87% 15% / 0.2); /* neutral-30 */
20
+ --ycf-skeleton-color: hsl(214 70% 20% / 0.1); /* neutral-20 */
21
+ --ycf-base-x-spacing: 16px;
22
+
23
+ --ycf-form-font-family: "Inter", ui-sans-serif, system-ui, -apple-system,
24
+ BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
25
+ --ycf-form-font-family-monospace: "Consolas", monospace;
26
+
27
+ --ycf-form-max-width: 720px;
28
+ --ycf-form-background-color: hsl(0 0% 100%); /* f0 background */
29
+ --ycf-form-border-width: 1px;
30
+ --ycf-form-border-color: var(--ycf-base-border-color);
31
+ --ycf-form-border-radius: 1rem; /* f0 xl (16px) */
32
+ --ycf-form-title-size: 1.375rem; /* f0 2xl */
33
+ --ycf-form-group-title-size: 1.125rem; /* f0 xl */
34
+ --ycf-form-title-margin-bottom: 1.5rem;
35
+ --ycf-form-group-title-border-color: var(--ycf-base-border-color);
36
+
37
+ --ycf-link-color: var(--ycf-base-text-color);
38
+
39
+ --ycf-field-text-color: var(--ycf-base-text-color);
40
+ --ycf-field-placeholder-color: var(--ycf-light-text-color);
41
+ --ycf-field-helper-text-color: var(--ycf-light-text-color);
42
+ --ycf-field-background-color: hsl(0 0% 100%);
43
+ --ycf-field-border-color: var(--ycf-base-border-color);
44
+ --ycf-field-border-color-focus: var(--ycf-selected-color); /* viridian ring */
45
+ --ycf-field-border-width: 1px;
46
+ --ycf-field-border-radius: 0.625rem; /* f0 DEFAULT (10px) */
47
+ --ycf-boolean-field-border-color: var(--ycf-field-border-color);
48
+ --ycf-boolean-field-background-color: var(--ycf-field-background-color);
49
+ --ycf-boolean-field-background-color-checked: var(--ycf-selected-color); /* viridian */
50
+ --ycf-boolean-field-border-radius: 0.25rem; /* f0 2xs (4px) */
51
+
52
+ --ycf-button-border-radius: 0.5rem; /* f0 sm (8px) */
53
+
54
+ --ycf-button-primary-text-color: hsl(0 0% 100%);
55
+ --ycf-button-primary-background-color: var(--ycf-accent-color);
56
+ --ycf-button-primary-background-color-hover: var(--ycf-accent-color-darker);
57
+ --ycf-button-primary-background-color-disabled: var(--ycf-accent-color-darker);
58
+ --ycf-button-primary-border-color: var(--ycf-accent-color);
59
+ --ycf-button-primary-border-color-hover: var(--ycf-accent-color-darker);
60
+ --ycf-button-primary-border-color-disabled: var(--ycf-accent-color-darker);
61
+ --ycf-button-primary-focus-visible-color: var(--ycf-accent-color-darker);
62
+
63
+ --ycf-button-danger-text-color: hsl(0 0% 100%);
64
+ --ycf-button-danger-background-color: var(--ycf-danger-color);
65
+ --ycf-button-danger-background-color-hover: var(--ycf-danger-color-darker);
66
+ --ycf-button-danger-background-color-disabled: var(--ycf-danger-color);
67
+ --ycf-button-danger-border-color: var(--ycf-danger-color);
68
+ --ycf-button-danger-border-color-hover: var(--ycf-danger-color-darker);
69
+ --ycf-button-danger-border-color-disabled: var(--ycf-danger-color);
70
+ --ycf-button-danger-focus-visible-color: var(--ycf-danger-color-darker);
71
+
72
+ --ycf-button-light-text-color: hsl(218 48% 10%); /* neutral-100 */
73
+ --ycf-button-light-background-color: hsl(216 89% 18% / 0.06); /* neutral-10 */
74
+ --ycf-button-light-background-color-hover: hsl(214 70% 20% / 0.1); /* neutral-20 */
75
+ --ycf-button-light-background-color-disabled: hsl(220 88% 17% / 0.04); /* neutral-5 */
76
+ --ycf-button-light-border-color: hsl(216 89% 18% / 0.06);
77
+ --ycf-button-light-border-color-hover: hsl(214 70% 20% / 0.1);
78
+ --ycf-button-light-border-color-disabled: hsl(220 88% 17% / 0.04);
79
+ }