@opengov/form-renderer 0.2.10-beta-2 → 0.2.11

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.
@@ -8,12 +8,14 @@ import { FieldTemplate } from '@opengov/form-utils';
8
8
  * @param id - The fieldId to render.
9
9
  * @param name - The name of the field within the form.
10
10
  * @param readonly - Whether the field is readonly.
11
+ * @param disabled - Whether the field is disabled.
11
12
  * @returns A Field component.
12
13
  */
13
- export default function Field({ id, name, readonly, wrapper, }: {
14
+ export default function Field({ id, name, readonly, disabled, wrapper, }: {
14
15
  id: string;
15
16
  name?: string;
16
17
  readonly?: boolean;
18
+ disabled?: boolean;
17
19
  wrapper?: React.ComponentType<{
18
20
  children: React.ReactNode;
19
21
  field: FieldTemplate;
@@ -1,6 +1,6 @@
1
- import { FieldTypes, FormTemplate } from '@opengov/form-utils';
2
1
  import { default as React } from 'react';
3
2
  import { LayoutState } from './context/LayoutContext';
3
+ import { FormTemplate, FieldTypes } from '@opengov/form-utils';
4
4
  interface RendererProviderProps {
5
5
  children: React.ReactNode;
6
6
  template: FormTemplate;
@@ -10,11 +10,12 @@ import { FieldTemplate, SectionTemplate } from '@opengov/form-utils';
10
10
  * @param readonly - Whether the section is readonly.
11
11
  * @returns A Section component.
12
12
  */
13
- export default function Section({ section, fields, fieldNames, readonly, fieldWrapper, }: {
13
+ export default function Section({ section, fields, fieldNames, readonly, disabled, fieldWrapper, }: {
14
14
  section: SectionTemplate;
15
15
  fields: string[];
16
16
  fieldNames?: string[];
17
17
  readonly?: boolean;
18
+ disabled?: boolean;
18
19
  fieldWrapper?: React.ComponentType<{
19
20
  children: React.ReactNode;
20
21
  field: FieldTemplate;
@@ -19,20 +19,19 @@ export declare const useFieldType: (type?: string) => {
19
19
  groups: import('@opengov/form-utils').ConfigurationGroup<import('react-hook-form').FieldValues>[];
20
20
  omitLabelConfiguration?: boolean;
21
21
  fullWidth: boolean;
22
- dateFormat: import('@opengov/form-utils').DateFormat;
23
- renderField: ((template: import('@opengov/form-utils').FieldTemplate, config: import('@opengov/form-utils').DateConfiguration, { disabled, readonly, name }: {
22
+ renderField: ((template: import('@opengov/form-utils').FieldTemplate, config: import('@opengov/form-utils').FieldConfiguration<import('react-hook-form').FieldValues>, { disabled, readonly, name }: {
24
23
  disabled?: boolean;
25
24
  readonly?: boolean;
26
25
  name?: string;
27
- }) => JSX.Element) | ((template: import('@opengov/form-utils').FieldTemplate, config: import('@opengov/form-utils').FieldConfiguration<import('react-hook-form').FieldValues>, { disabled, readonly, name }: {
26
+ }) => JSX.Element) | ((template: import('@opengov/form-utils').FieldTemplate, config: import('@opengov/form-utils').TextConfiguration, { disabled, readonly, name }: {
28
27
  disabled?: boolean;
29
28
  readonly?: boolean;
30
29
  name?: string;
31
- }) => JSX.Element) | ((template: import('@opengov/form-utils').FieldTemplate, config: import('@opengov/form-utils').TextConfiguration, { disabled, readonly, name }: {
30
+ }) => JSX.Element) | ((template: import('@opengov/form-utils').FieldTemplate, config: import('@opengov/form-utils').NumberConfiguration, { disabled, readonly, name }: {
32
31
  disabled?: boolean;
33
32
  readonly?: boolean;
34
33
  name?: string;
35
- }) => JSX.Element) | ((template: import('@opengov/form-utils').FieldTemplate, config: import('@opengov/form-utils').NumberConfiguration, { disabled, readonly, name }: {
34
+ }) => JSX.Element) | ((template: import('@opengov/form-utils').FieldTemplate, config: import('@opengov/form-utils').DateConfiguration, { disabled, readonly, name }: {
36
35
  disabled?: boolean;
37
36
  readonly?: boolean;
38
37
  name?: string;
@@ -47,19 +46,19 @@ export declare const useFieldType: (type?: string) => {
47
46
  fullWidth: boolean;
48
47
  maxLength: number;
49
48
  filter?: (value: string) => string;
50
- renderField: ((template: import('@opengov/form-utils').FieldTemplate, config: import('@opengov/form-utils').DateConfiguration, { disabled, readonly, name }: {
49
+ renderField: ((template: import('@opengov/form-utils').FieldTemplate, config: import('@opengov/form-utils').FieldConfiguration<import('react-hook-form').FieldValues>, { disabled, readonly, name }: {
51
50
  disabled?: boolean;
52
51
  readonly?: boolean;
53
52
  name?: string;
54
- }) => JSX.Element) | ((template: import('@opengov/form-utils').FieldTemplate, config: import('@opengov/form-utils').FieldConfiguration<import('react-hook-form').FieldValues>, { disabled, readonly, name }: {
53
+ }) => JSX.Element) | ((template: import('@opengov/form-utils').FieldTemplate, config: import('@opengov/form-utils').TextConfiguration, { disabled, readonly, name }: {
55
54
  disabled?: boolean;
56
55
  readonly?: boolean;
57
56
  name?: string;
58
- }) => JSX.Element) | ((template: import('@opengov/form-utils').FieldTemplate, config: import('@opengov/form-utils').TextConfiguration, { disabled, readonly, name }: {
57
+ }) => JSX.Element) | ((template: import('@opengov/form-utils').FieldTemplate, config: import('@opengov/form-utils').NumberConfiguration, { disabled, readonly, name }: {
59
58
  disabled?: boolean;
60
59
  readonly?: boolean;
61
60
  name?: string;
62
- }) => JSX.Element) | ((template: import('@opengov/form-utils').FieldTemplate, config: import('@opengov/form-utils').NumberConfiguration, { disabled, readonly, name }: {
61
+ }) => JSX.Element) | ((template: import('@opengov/form-utils').FieldTemplate, config: import('@opengov/form-utils').DateConfiguration, { disabled, readonly, name }: {
63
62
  disabled?: boolean;
64
63
  readonly?: boolean;
65
64
  name?: string;
@@ -73,19 +72,19 @@ export declare const useFieldType: (type?: string) => {
73
72
  omitLabelConfiguration?: boolean;
74
73
  fullWidth: boolean;
75
74
  decimalPlaces: number;
76
- renderField: ((template: import('@opengov/form-utils').FieldTemplate, config: import('@opengov/form-utils').DateConfiguration, { disabled, readonly, name }: {
75
+ renderField: ((template: import('@opengov/form-utils').FieldTemplate, config: import('@opengov/form-utils').FieldConfiguration<import('react-hook-form').FieldValues>, { disabled, readonly, name }: {
77
76
  disabled?: boolean;
78
77
  readonly?: boolean;
79
78
  name?: string;
80
- }) => JSX.Element) | ((template: import('@opengov/form-utils').FieldTemplate, config: import('@opengov/form-utils').FieldConfiguration<import('react-hook-form').FieldValues>, { disabled, readonly, name }: {
79
+ }) => JSX.Element) | ((template: import('@opengov/form-utils').FieldTemplate, config: import('@opengov/form-utils').TextConfiguration, { disabled, readonly, name }: {
81
80
  disabled?: boolean;
82
81
  readonly?: boolean;
83
82
  name?: string;
84
- }) => JSX.Element) | ((template: import('@opengov/form-utils').FieldTemplate, config: import('@opengov/form-utils').TextConfiguration, { disabled, readonly, name }: {
83
+ }) => JSX.Element) | ((template: import('@opengov/form-utils').FieldTemplate, config: import('@opengov/form-utils').NumberConfiguration, { disabled, readonly, name }: {
85
84
  disabled?: boolean;
86
85
  readonly?: boolean;
87
86
  name?: string;
88
- }) => JSX.Element) | ((template: import('@opengov/form-utils').FieldTemplate, config: import('@opengov/form-utils').NumberConfiguration, { disabled, readonly, name }: {
87
+ }) => JSX.Element) | ((template: import('@opengov/form-utils').FieldTemplate, config: import('@opengov/form-utils').DateConfiguration, { disabled, readonly, name }: {
89
88
  disabled?: boolean;
90
89
  readonly?: boolean;
91
90
  name?: string;
@@ -98,19 +97,20 @@ export declare const useFieldType: (type?: string) => {
98
97
  groups: import('@opengov/form-utils').ConfigurationGroup<import('react-hook-form').FieldValues>[];
99
98
  omitLabelConfiguration?: boolean;
100
99
  fullWidth: boolean;
101
- renderField: ((template: import('@opengov/form-utils').FieldTemplate, config: import('@opengov/form-utils').DateConfiguration, { disabled, readonly, name }: {
100
+ dateFormat: import('@opengov/form-utils').DateFormat;
101
+ renderField: ((template: import('@opengov/form-utils').FieldTemplate, config: import('@opengov/form-utils').FieldConfiguration<import('react-hook-form').FieldValues>, { disabled, readonly, name }: {
102
102
  disabled?: boolean;
103
103
  readonly?: boolean;
104
104
  name?: string;
105
- }) => JSX.Element) | ((template: import('@opengov/form-utils').FieldTemplate, config: import('@opengov/form-utils').FieldConfiguration<import('react-hook-form').FieldValues>, { disabled, readonly, name }: {
105
+ }) => JSX.Element) | ((template: import('@opengov/form-utils').FieldTemplate, config: import('@opengov/form-utils').TextConfiguration, { disabled, readonly, name }: {
106
106
  disabled?: boolean;
107
107
  readonly?: boolean;
108
108
  name?: string;
109
- }) => JSX.Element) | ((template: import('@opengov/form-utils').FieldTemplate, config: import('@opengov/form-utils').TextConfiguration, { disabled, readonly, name }: {
109
+ }) => JSX.Element) | ((template: import('@opengov/form-utils').FieldTemplate, config: import('@opengov/form-utils').NumberConfiguration, { disabled, readonly, name }: {
110
110
  disabled?: boolean;
111
111
  readonly?: boolean;
112
112
  name?: string;
113
- }) => JSX.Element) | ((template: import('@opengov/form-utils').FieldTemplate, config: import('@opengov/form-utils').NumberConfiguration, { disabled, readonly, name }: {
113
+ }) => JSX.Element) | ((template: import('@opengov/form-utils').FieldTemplate, config: import('@opengov/form-utils').DateConfiguration, { disabled, readonly, name }: {
114
114
  disabled?: boolean;
115
115
  readonly?: boolean;
116
116
  name?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengov/form-renderer",
3
- "version": "0.2.10-beta-2",
3
+ "version": "0.2.11",
4
4
  "description": "OpenGov Smart Forms form renderer",
5
5
  "type": "module",
6
6
  "files": [
@@ -10,9 +10,9 @@
10
10
  "module": "./dist/lib.js",
11
11
  "exports": {
12
12
  ".": {
13
- "types": "./dist/index.d.ts",
14
13
  "import": "./dist/lib.js",
15
- "require": "./dist/lib.umd.cjs"
14
+ "require": "./dist/lib.umd.cjs",
15
+ "types": "./dist/index.d.ts"
16
16
  }
17
17
  },
18
18
  "types": "dist/index.d.ts",
@@ -28,14 +28,14 @@
28
28
  "@mdi/react": "^1.6.1",
29
29
  "@mui/icons-material": "^6.1.1",
30
30
  "@opengov/form-utils": "^0.5.0",
31
- "date-fns": "^3.6.0",
31
+ "date-fns": "^4.1.0",
32
32
  "lodash": "^4.17.21",
33
33
  "mathjs": "^14.3.1",
34
34
  "sanitize-html": "^2.14.0"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "@mui/material": ">= 5.0.0",
38
- "@mui/x-date-pickers-pro": ">=7.29.0 <8.0.0",
38
+ "@mui/x-date-pickers": ">= 7.0.0",
39
39
  "@opengov/capital-mui-theme": ">= 36.0.0",
40
40
  "react": ">= 16.8.0",
41
41
  "react-dom": ">= 16.8.0",
@@ -45,7 +45,7 @@
45
45
  "@emotion/react": "^11.13.3",
46
46
  "@emotion/styled": "^11.13.0",
47
47
  "@mui/material": "^6.1.1",
48
- "@mui/x-date-pickers-pro": "^7.29.4",
48
+ "@mui/x-date-pickers": "^7.22.0",
49
49
  "@opengov/capital-mui-theme": "^36.0.0-beta.9",
50
50
  "@types/sanitize-html": "^2.13.0",
51
51
  "react": "^18.3.1",