@star-insure/sdk 3.2.2 → 3.2.4
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/lib/quoteRequestForm.d.ts +1 -0
- package/dist/sdk.cjs.development.js +12 -3
- package/dist/sdk.cjs.development.js.map +1 -1
- package/dist/sdk.cjs.production.min.js +1 -1
- package/dist/sdk.cjs.production.min.js.map +1 -1
- package/dist/sdk.esm.js +12 -3
- package/dist/sdk.esm.js.map +1 -1
- package/dist/types/misc/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/lib/quoteRequestForm.tsx +8 -3
- package/src/types/misc/index.ts +1 -1
|
@@ -9,7 +9,7 @@ export interface FilterOption {
|
|
|
9
9
|
label: string;
|
|
10
10
|
name: string;
|
|
11
11
|
options?: FilterValue[];
|
|
12
|
-
type?: 'options' | 'date' | 'greaterThan' | 'scope' | 'select';
|
|
12
|
+
type?: 'options' | 'date' | 'greaterThan' | 'scope' | 'select' | 'datalist';
|
|
13
13
|
}
|
|
14
14
|
export interface FilterValue {
|
|
15
15
|
label: string;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@star-insure/sdk",
|
|
3
3
|
"description": "The SDK for Star Insure client apps with shared helper functions and TypeScript definitions.",
|
|
4
4
|
"author": "alexclark_nz",
|
|
5
|
-
"version": "3.2.
|
|
5
|
+
"version": "3.2.4",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
@@ -8,6 +8,7 @@ type QuoteRequestForm = QuoteRequest & Record<string, any>;
|
|
|
8
8
|
interface QuoteRequestFormContextInterface {
|
|
9
9
|
form?: InertiaFormProps<QuoteRequestForm>;
|
|
10
10
|
handleChange?: (e: React.ChangeEvent<HTMLInputElement|HTMLTextAreaElement|HTMLSelectElement>) => void;
|
|
11
|
+
clear: () => void;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
export const initialData: QuoteRequestForm = {
|
|
@@ -77,10 +78,10 @@ export const initialData: QuoteRequestForm = {
|
|
|
77
78
|
is_follow_up_required: true,
|
|
78
79
|
}
|
|
79
80
|
|
|
80
|
-
export const QuoteRequestFormContext = React.createContext<QuoteRequestFormContextInterface>({});
|
|
81
|
+
export const QuoteRequestFormContext = React.createContext<QuoteRequestFormContextInterface>({ clear: () => null });
|
|
81
82
|
|
|
82
83
|
export function QuoteRequestFormProvider({ children }: { children: React.ReactNode }) {
|
|
83
|
-
const form = useForm(initialData);
|
|
84
|
+
const form = useForm({ ...initialData });
|
|
84
85
|
|
|
85
86
|
/**
|
|
86
87
|
* Handle the change event for all form inputs
|
|
@@ -118,8 +119,12 @@ export function QuoteRequestFormProvider({ children }: { children: React.ReactNo
|
|
|
118
119
|
}));
|
|
119
120
|
}
|
|
120
121
|
|
|
122
|
+
function clear() {
|
|
123
|
+
form.setData({ ...initialData });
|
|
124
|
+
}
|
|
125
|
+
|
|
121
126
|
return (
|
|
122
|
-
<QuoteRequestFormContext.Provider value={{ form, handleChange }}>
|
|
127
|
+
<QuoteRequestFormContext.Provider value={{ form, handleChange, clear }}>
|
|
123
128
|
{children}
|
|
124
129
|
</QuoteRequestFormContext.Provider>
|
|
125
130
|
);
|
package/src/types/misc/index.ts
CHANGED
|
@@ -11,7 +11,7 @@ export interface FilterOption {
|
|
|
11
11
|
label: string;
|
|
12
12
|
name: string;
|
|
13
13
|
options?: FilterValue[];
|
|
14
|
-
type?: 'options' | 'date' | 'greaterThan' | 'scope' | 'select';
|
|
14
|
+
type?: 'options' | 'date' | 'greaterThan' | 'scope' | 'select' | 'datalist';
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export interface FilterValue {
|