@socotra/ec-react-components 0.0.0-alpha.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.
package/README.md ADDED
@@ -0,0 +1,30 @@
1
+ # React + TypeScript + Vite
2
+
3
+ This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4
+
5
+ Currently, two official plugins are available:
6
+
7
+ - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
8
+ - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
9
+
10
+ ## Expanding the ESLint configuration
11
+
12
+ If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
13
+
14
+ - Configure the top-level `parserOptions` property like this:
15
+
16
+ ```js
17
+ export default {
18
+ // other rules...
19
+ parserOptions: {
20
+ ecmaVersion: 'latest',
21
+ sourceType: 'module',
22
+ project: ['./tsconfig.json', './tsconfig.node.json'],
23
+ tsconfigRootDir: __dirname,
24
+ },
25
+ };
26
+ ```
27
+
28
+ - Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked`
29
+ - Optionally add `plugin:@typescript-eslint/stylistic-type-checked`
30
+ - Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list
@@ -0,0 +1,143 @@
1
+ import { AccountConfigRecord } from '@socotra/ec-react-schemas';
2
+ import { AccountRequest } from '@socotra/ec-react-schemas';
3
+ import { AccountResponse } from '@socotra/ec-react-schemas';
4
+ import { DataTypeConfigRecord } from '@socotra/ec-react-schemas';
5
+ import { default as default_2 } from '@rjsf/core';
6
+ import { ElementConfig } from '@socotra/ec-react-schemas';
7
+ import { ElementResponse } from '@socotra/ec-react-schemas';
8
+ import { FormProps } from '@rjsf/core';
9
+ import { ForwardRefExoticComponent } from 'react';
10
+ import { ProductConfig } from '@socotra/ec-react-schemas';
11
+ import { QuoteRequest } from '@socotra/ec-react-schemas';
12
+ import { QuoteResponse } from '@socotra/ec-react-schemas';
13
+ import { RefAttributes } from 'react';
14
+ import { RJSFSchema } from '@rjsf/utils';
15
+ import { UiSchema } from '@rjsf/utils';
16
+
17
+ /**
18
+ * 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/
19
+ */
20
+ export declare const AccountForm: ForwardRefExoticComponent<Omit<Props, "ref"> & RefAttributes<AccountFormRef>>;
21
+
22
+ declare type AccountFormRef = default_2<TODO, RJSFSchema, TODO>;
23
+
24
+ /**
25
+ * 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.
26
+ */
27
+ export declare const ElementForm: ForwardRefExoticComponent<Omit<Props_3, "ref"> & RefAttributes<ElementFormRef>>;
28
+
29
+ declare type ElementFormRef = default_2<TODO, RJSFSchema, TODO>;
30
+
31
+ declare type Props = {
32
+ /**
33
+ * The resolved data model for accounts retrieved from the data model response
34
+ */
35
+ accountsModel: AccountConfigRecord;
36
+ /**
37
+ * The custom data types for the configuration that may be referenced by the accountsModel
38
+ */
39
+ dataTypes: DataTypeConfigRecord;
40
+ /**
41
+ * The function to call when the form is submitted. It will create an AccountCreateRequest or AccountUpdateRequest based on the form data
42
+ */
43
+ handleSubmit: (data: AccountRequest) => void;
44
+ /**
45
+ * The custom UI schema for the form. Reference: https://rjsf-team.github.io/react-jsonschema-form/docs/api-reference/uiSchema/
46
+ */
47
+ uiSchema?: UiSchema;
48
+ /**
49
+ * The account object to put the form in update mode
50
+ */
51
+ account?: AccountResponse;
52
+ /**
53
+ * Hides the submit button
54
+ */
55
+ hideSubmitButton?: boolean;
56
+ /**
57
+ * ID for the form wrapper
58
+ * */
59
+ id?: string;
60
+ } & Partial<FormProps>;
61
+
62
+ declare type Props_2 = {
63
+ /**
64
+ * The resolved data model for products retrieved from the data model response
65
+ */
66
+ productModel: ProductConfig;
67
+ /**
68
+ * The custom data types for the configuration that may be referenced by the productModel
69
+ */
70
+ dataTypes: DataTypeConfigRecord;
71
+ /**
72
+ * The function to call when the form is submitted. It will create an QuoteUpdateRequest.
73
+ */
74
+ handleSubmit: (data: QuoteRequest) => void;
75
+ /**
76
+ * The custom UI schema for the form. Reference: https://rjsf-team.github.io/react-jsonschema-form/docs/api-reference/uiSchema/
77
+ */
78
+ uiSchema?: UiSchema;
79
+ /**
80
+ * The quote object to build on
81
+ */
82
+ quote: QuoteResponse;
83
+ /**
84
+ * Hides the submit button
85
+ */
86
+ hideSubmitButton?: boolean;
87
+ /**
88
+ * Removes the default fields like Start and End time, delinquency plan name, etc.
89
+ */
90
+ hideDefaultFields?: boolean;
91
+ /**
92
+ * Removes the configured fields
93
+ */
94
+ hideConfiguredFields?: boolean;
95
+ /**
96
+ * ID for the form wrapper
97
+ * */
98
+ id?: string;
99
+ } & Partial<FormProps>;
100
+
101
+ declare type Props_3 = {
102
+ /**
103
+ * The resolved quote element to render. Find this by using the `retrieveElementFromQuoteByLocator` utility function.
104
+ */
105
+ element: ElementResponse;
106
+ /**
107
+ * The data model for the element you want to render. Find this by using the `retrieveDataModelFromElement` utility function.
108
+ */
109
+ elementModel: ElementConfig;
110
+ /**
111
+ * The custom data types for the configuration that may be referenced by the element model
112
+ */
113
+ dataTypes: DataTypeConfigRecord;
114
+ /**
115
+ * The locator for the quote element
116
+ * */
117
+ locator: string;
118
+ /**
119
+ * The function to call when the form is submitted. It will create a QuoteRequest.
120
+ */
121
+ handleSubmit: (data: QuoteRequest) => void;
122
+ /**
123
+ * The custom UI schema for the form. Reference: https://rjsf-team.github.io/react-jsonschema-form/docs/api-reference/uiSchema/
124
+ */
125
+ uiSchema?: UiSchema;
126
+ /**
127
+ * Hides the submit button
128
+ */
129
+ hideSubmitButton?: boolean;
130
+ /**
131
+ * ID for the form wrapper. Useful to submitting the form with a button outside the form.
132
+ * */
133
+ id?: string;
134
+ } & Partial<FormProps>;
135
+
136
+ /**
137
+ * QuoteForm is a form for updating a quote. It accepts a resolved data model, custom data types, and a quote object to build on.
138
+ */
139
+ export declare const QuoteForm: ForwardRefExoticComponent<Omit<Props_2, "ref"> & RefAttributes<QuoteFormRef>>;
140
+
141
+ declare type QuoteFormRef = default_2<TODO, RJSFSchema, TODO>;
142
+
143
+ export { }