@opengov/form-renderer 0.0.32-beta.0 → 0.0.33

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.
@@ -1 +0,0 @@
1
- export default function CompoundExample(): import("react/jsx-runtime").JSX.Element;
@@ -2,6 +2,6 @@ import { Meta, StoryObj } from '@storybook/react';
2
2
  declare const meta: Meta;
3
3
  export default meta;
4
4
  type Story = StoryObj<typeof meta>;
5
- export declare const Basic: Story;
6
- export declare const Custom: Story;
7
5
  export declare const Compound: Story;
6
+ export declare const WithDefaultValues: Story;
7
+ export declare const UsingReactHookForms: Story;
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengov/form-renderer",
3
- "version": "0.0.32-beta.0",
3
+ "version": "0.0.33",
4
4
  "description": "OpenGov Smart Forms form renderer",
5
5
  "type": "module",
6
6
  "files": [
@@ -26,8 +26,7 @@
26
26
  "@mdi/js": "^7.4.47",
27
27
  "@mdi/react": "^1.6.1",
28
28
  "@mui/icons-material": "^6.1.1",
29
- "date-fns": "^4.1.0",
30
- "sanitize-html": "^2.14.0"
29
+ "date-fns": "^4.1.0"
31
30
  },
32
31
  "peerDependencies": {
33
32
  "@mui/material": ">= 5.0.0",
@@ -43,7 +42,6 @@
43
42
  "@mui/material": "^6.1.1",
44
43
  "@mui/x-date-pickers": "^7.22.0",
45
44
  "@opengov/capital-mui-theme": "^36.0.0-beta.9",
46
- "@types/sanitize-html": "^2.13.0",
47
45
  "react": "^18.3.1",
48
46
  "react-dom": "^18.3.1",
49
47
  "react-hook-form": "^7.53.1"
@@ -1,11 +0,0 @@
1
- import { SxProps } from '@mui/material';
2
- interface NonEditableProps {
3
- name: string;
4
- label: React.ReactNode;
5
- asHTML?: boolean;
6
- statusIcon?: React.ReactNode;
7
- fullWidth?: boolean;
8
- sx?: SxProps;
9
- }
10
- export default function NonEditable({ name, label, asHTML, statusIcon, fullWidth, sx, }: NonEditableProps): import("react/jsx-runtime").JSX.Element;
11
- export {};
@@ -1,3 +0,0 @@
1
- import { FieldRenders } from '../renderer/types';
2
- declare const defaultFields: FieldRenders;
3
- export default defaultFields;
@@ -1,5 +0,0 @@
1
- export default function Field({ fieldId, manuallyDisabled, fullWidth, }: {
2
- fieldId: string;
3
- manuallyDisabled?: boolean;
4
- fullWidth?: boolean;
5
- }): import("react/jsx-runtime").JSX.Element | null | undefined;
@@ -1,24 +0,0 @@
1
- import { default as React } from 'react';
2
- import { UseFormProps } from 'react-hook-form';
3
- import { LayoutState } from './context/LayoutContext';
4
- import { Template, FieldRenders } from './types';
5
- interface FormShellProps {
6
- children: React.ReactNode;
7
- onSubmit: (data: any) => void;
8
- layout?: LayoutState;
9
- template: Template;
10
- renderFields?: FieldRenders;
11
- formId?: string;
12
- }
13
- export declare function FormShell({ children, onSubmit, layout, template, renderFields, formId }: FormShellProps): import("react/jsx-runtime").JSX.Element;
14
- interface FormProviderProps {
15
- children: React.ReactNode;
16
- onSubmit?: (data: any) => void;
17
- layout?: LayoutState;
18
- formOptions?: UseFormProps;
19
- template: Template;
20
- renderFields?: FieldRenders;
21
- formId?: string;
22
- }
23
- declare function FormProvider({ children, onSubmit, layout, formOptions, template, renderFields, formId, }: FormProviderProps): import("react/jsx-runtime").JSX.Element;
24
- export default FormProvider;
@@ -1,18 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import { FieldRenders, Template } from '../types';
3
- export interface FormRendererContextType {
4
- template: Template;
5
- renderFields?: FieldRenders;
6
- }
7
- interface FormRendererProviderProps {
8
- children: ReactNode;
9
- template: Template;
10
- renderFields?: FieldRenders;
11
- }
12
- export declare const FormRendererProvider: React.FC<FormRendererProviderProps>;
13
- export declare const useFormRenderer: () => FormRendererContextType;
14
- export declare const useFormField: (fieldId: string) => {
15
- template: import('react-hook-form').FieldValues;
16
- render: ((field: import('react-hook-form').FieldValues, fullWidth?: boolean) => JSX.Element) | undefined;
17
- };
18
- export {};
@@ -1,7 +0,0 @@
1
- import { FormRendererProps } from './types';
2
- import { FieldValues } from 'react-hook-form';
3
- export declare function Renderer({ fieldValues, formReadOnly }: {
4
- fieldValues: FieldValues;
5
- formReadOnly?: boolean;
6
- }): import("react/jsx-runtime").JSX.Element;
7
- export default function FormRenderer({ fieldValues, template, renderFields, onSubmit, layout, readonly, formId, formOptions, }: FormRendererProps): import("react/jsx-runtime").JSX.Element;
@@ -1,59 +0,0 @@
1
- import { FieldValues, UseFormProps } from 'react-hook-form';
2
- import { LayoutState } from './context/LayoutContext';
3
- export type ConditionTemplate = {
4
- dependentEntityPrimaryKey: string;
5
- dependentEntityType: string;
6
- legacyId?: number;
7
- logicTypeId: number;
8
- comparate1?: string;
9
- comparate2?: string;
10
- };
11
- export type SectionTemplate = FieldValues & {
12
- type: 'singleEntry' | 'multiEntry';
13
- id: string;
14
- label: string;
15
- helpText?: string;
16
- internal: boolean;
17
- required?: boolean;
18
- sectionConditions: {
19
- logicalOperator?: 'ALL' | 'ANY';
20
- conditions?: ConditionTemplate[];
21
- };
22
- fields: string[];
23
- };
24
- export type FormTemplate = {
25
- fields: Record<string, FieldValues>;
26
- sections: SectionTemplate[];
27
- };
28
- export type Template = Omit<SectionTemplate, 'fields'> & {
29
- fields: Record<string, FieldValues>;
30
- };
31
- export type FieldRenders = {
32
- [key: string]: (field: FieldValues, fullWidth?: boolean) => JSX.Element;
33
- };
34
- export type FormRendererProps = {
35
- fieldValues: FieldValues;
36
- renderFields?: FieldRenders;
37
- template: Template;
38
- onSubmit?: (data: any) => void;
39
- layout?: LayoutState;
40
- readonly?: boolean;
41
- formId?: string;
42
- formOptions: {
43
- defaultValues: FieldValues;
44
- } & UseFormProps;
45
- };
46
- export declare enum LogicTypes {
47
- EQUALS = 1,
48
- BETWEEN = 2,
49
- LESS_THAN = 3,
50
- GREATER_THAN = 4,
51
- LESS_THAN_OR_EQUAL = 5,
52
- GREATER_THAN_OR_EQUAL = 6,
53
- HAS_FLAGS = 7,
54
- IS_RENEWAL = 8,
55
- IS_NOT = 9,
56
- TIME_AFTER_MORE_THAN = 10,
57
- TIME_BEFORE_MORE_THAN = 11,
58
- DATETIME_BETWEEN = 12
59
- }
@@ -1,3 +0,0 @@
1
- export default function BasicExample({ args }: {
2
- args: any;
3
- }): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +0,0 @@
1
- import { FieldValues } from 'react-hook-form';
2
- export declare const customForm: FieldValues;
3
- export default function BasicExample({ args }: {
4
- args: any;
5
- }): import("react/jsx-runtime").JSX.Element;
@@ -1,2 +0,0 @@
1
- import { FieldValues } from 'react-hook-form';
2
- export declare const basicForm: FieldValues;
@@ -1,2 +0,0 @@
1
- import { Template } from '../renderer/types';
2
- export declare const basicTemplate: Template;