@socotra/ec-react-components 2.2.2-beta.66 → 2.2.3-beta.65

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.
package/dist/index.d.ts CHANGED
@@ -2,39 +2,44 @@ import { AccountConfigRecord } from '@socotra/ec-react-schemas';
2
2
  import { AccountRequest } from '@socotra/ec-react-schemas';
3
3
  import { AccountResponse } from '@socotra/ec-react-schemas';
4
4
  import { DataTypeConfigRecord } from '@socotra/ec-react-schemas';
5
+ import { ElementConfig } from '@socotra/ec-react-schemas';
6
+ import { ElementResponse } from '@socotra/ec-react-schemas';
5
7
  import { JSX as JSX_2 } from 'react/jsx-runtime';
6
- import { ProductConfigRecord } from '@socotra/ec-react-schemas';
8
+ import { ProductConfig } from '@socotra/ec-react-schemas';
7
9
  import { QuoteRequest } from '@socotra/ec-react-schemas';
8
10
  import { QuoteResponse } from '@socotra/ec-react-schemas';
9
11
 
10
12
  /**
11
- * AccountForm is a form for creating or updating an account. It accepts a resolved data model, custom data types, and an optional account object to put the form in update mode. References: https://rjsf-team.github.io/react-jsonschema-form/docs/
13
+ * AccountForm is a form for creating or updating an account. It required a resolved data model, custom data types, and an optional account object to put the form in update mode.
12
14
  */
13
15
  export declare const AccountForm: {
14
- ({ accountsModel, accountType, dataTypes, disabled, handleSubmit, isSubmitting, preventFormResetOnDisabled, hideSubmitButton, account, submitButtonText, id, }: Props): JSX_2.Element;
16
+ ({ accountsModel, accountType, dataTypes, disabled, handleSubmit, isSubmitting, preventFormResetOnDisabled, hideSubmitButton, validateOnSubmit, account, submitButtonText, id, }: Props): JSX_2.Element;
15
17
  displayName: string;
16
18
  };
17
19
 
18
20
  /**
19
- * ElementForm is a form for updating a quote's element. It accepts a resolved data model, element locator, custom data types, and a quote object to build on.
21
+ * ElementForm is a form for creating or updating an element of a Quote. It required the element's data model, custom data types, and an element response object.
20
22
  */
21
- export declare const ElementForm: () => JSX_2.Element;
23
+ export declare const ElementForm: {
24
+ ({ elementModel, dataTypes, disabled, handleSubmit, isSubmitting, preventFormResetOnDisabled, hideSubmitButton, element, validateOnSubmit, submitButtonText, id, }: Props_3): JSX_2.Element;
25
+ displayName: string;
26
+ };
22
27
 
23
28
  declare type Props = {
24
29
  /**
25
- * The resolved data model for accounts retrieved from the data model response
30
+ * The resolved data model for **all** accounts retrieved from the data model response
26
31
  */
27
32
  accountsModel: AccountConfigRecord;
28
33
  /**
29
- * The account type to use for the form
34
+ * The account type to use for the form, used to pick the correct data model from the accountsModel
30
35
  */
31
36
  accountType: keyof AccountConfigRecord;
32
37
  /**
33
- * The custom data types for the configuration that may be referenced by the accountsModel
38
+ * The custom data types for the configuration that may be referenced by the account's data model
34
39
  */
35
40
  dataTypes: DataTypeConfigRecord;
36
41
  /**
37
- * The function to call when the form is submitted. It will create an AccountCreateRequest or AccountUpdateRequest based on the form data
42
+ * The function to call when the form is submitted. It will create an AccountRequest from the form data.
38
43
  */
39
44
  handleSubmit: (data: AccountRequest) => void;
40
45
  /**
@@ -62,6 +67,10 @@ declare type Props = {
62
67
  * The text to display on the submit button
63
68
  */
64
69
  submitButtonText?: string;
70
+ /**
71
+ * Whether to validate the form on submit
72
+ */
73
+ validateOnSubmit?: boolean;
65
74
  /**
66
75
  * ID for the form wrapper
67
76
  * */
@@ -74,19 +83,15 @@ declare type Props_2 = {
74
83
  */
75
84
  quote: QuoteResponse;
76
85
  /**
77
- * The resolved data model for quotes retrieved from the data model response
86
+ * The resolved data model for quote retrieved from the data model response
78
87
  */
79
- productsModel: ProductConfigRecord;
88
+ productModel: ProductConfig;
80
89
  /**
81
- * The quote type to use for the form
82
- */
83
- productType: keyof ProductConfigRecord;
84
- /**
85
- * The custom data types for the configuration that may be referenced by the DataModel
90
+ * The custom data types for the configuration that may be referenced by the elementModel
86
91
  */
87
92
  dataTypes: DataTypeConfigRecord;
88
93
  /**
89
- * The function to call when the form is submitted. It will create an QuoteUpdateRequest from the form data.
94
+ * The function to call when the form is submitted. It will create an QuoteRequest from the form data.
90
95
  */
91
96
  handleSubmit: (data: QuoteRequest) => void;
92
97
  /**
@@ -123,11 +128,60 @@ declare type Props_2 = {
123
128
  id?: string;
124
129
  };
125
130
 
131
+ declare type Props_3 = {
132
+ /**
133
+ * The resolved data model for the element retrieved from the data model response
134
+ */
135
+ elementModel: ElementConfig;
136
+ /**
137
+ * The custom data types for the configuration that may be referenced by the elementModel
138
+ */
139
+ dataTypes: DataTypeConfigRecord;
140
+ /**
141
+ * The function to call when the form is submitted. It will create an ElementUpdateRequest.
142
+ */
143
+ handleSubmit: (data: AccountRequest) => void;
144
+ /**
145
+ * Set to true when the form is submitting to set fields to readonly and disable the submit button
146
+ */
147
+ isSubmitting?: boolean;
148
+ /**
149
+ * Disables the form
150
+ */
151
+ disabled?: boolean;
152
+ /**
153
+ * Prevents the form from resetting when disabled
154
+ * default is true
155
+ */
156
+ preventFormResetOnDisabled?: boolean;
157
+ /**
158
+ * The element object from the quote
159
+ */
160
+ element: ElementResponse;
161
+ /**
162
+ * Hides the submit button
163
+ */
164
+ hideSubmitButton?: boolean;
165
+ /**
166
+ * Whether to validate the form on submit
167
+ */
168
+ validateOnSubmit?: boolean;
169
+ /**
170
+ /**
171
+ * The text to display on the submit button
172
+ */
173
+ submitButtonText?: string;
174
+ /**
175
+ * ID for the form wrapper
176
+ * */
177
+ id?: string;
178
+ };
179
+
126
180
  /**
127
- * QuoteForm is a form for creating or updating an quote. It accepts a resolved data model, custom data types, and an optional quote object to put the form in update mode. References: https://rjsf-team.github.io/react-jsonschema-form/docs/
181
+ * QuoteForm is a form for updating a quote. It required a product data model, custom data types, and quote object to render the form.
128
182
  */
129
183
  export declare const QuoteForm: {
130
- ({ quote, productType, productsModel, dataTypes, disabled, handleSubmit, isSubmitting, preventFormResetOnDisabled, validateOnSubmit, hideSubmitButton, submitButtonText, id, }: Props_2): JSX_2.Element;
184
+ ({ quote, productModel, dataTypes, disabled, handleSubmit, isSubmitting, preventFormResetOnDisabled, validateOnSubmit, hideSubmitButton, submitButtonText, id, }: Props_2): JSX_2.Element;
131
185
  displayName: string;
132
186
  };
133
187