@pautena/react-design-system 0.4.8 → 0.5.1
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/cjs/index.js +4 -4
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/alerts/expandable-alert/expandable-alert.d.ts +11 -0
- package/dist/cjs/types/components/alerts/expandable-alert/index.d.ts +1 -0
- package/dist/cjs/types/components/alerts/index.d.ts +1 -0
- package/dist/cjs/types/components/data-display/board/board.d.ts +10 -0
- package/dist/cjs/types/components/data-display/board/index.d.ts +1 -0
- package/dist/cjs/types/components/data-display/index.d.ts +2 -0
- package/dist/cjs/types/components/data-display/markdown/index.d.ts +1 -0
- package/dist/cjs/types/components/data-display/markdown/markdown.d.ts +7 -0
- package/dist/cjs/types/components/dialogs/bootstrap-dialog/bootstrap-dialog.d.ts +2 -0
- package/dist/cjs/types/components/dialogs/bootstrap-dialog/index.d.ts +1 -0
- package/dist/cjs/types/components/dialogs/confirm-dialog/confirm-dialog.d.ts +10 -0
- package/dist/cjs/types/components/dialogs/confirm-dialog/index.d.ts +1 -0
- package/dist/cjs/types/components/dialogs/dialog-hooks/index.d.ts +1 -0
- package/dist/cjs/types/components/dialogs/dialog-hooks/use-dialog.d.ts +7 -0
- package/dist/cjs/types/components/dialogs/dialog.types.d.ts +26 -0
- package/dist/cjs/types/components/dialogs/form-dialog/form-dialog.d.ts +10 -0
- package/dist/cjs/types/components/dialogs/form-dialog/index.d.ts +1 -0
- package/dist/cjs/types/components/dialogs/index.d.ts +5 -0
- package/dist/cjs/types/components/index.d.ts +2 -0
- package/dist/cjs/types/components/inputs/enhanced-autocomplete/enhanced-autocomplete.d.ts +10 -0
- package/dist/cjs/types/components/inputs/enhanced-autocomplete/index.d.ts +1 -0
- package/dist/cjs/types/components/inputs/enhanced-text-field/enhanced-text-field.d.ts +7 -0
- package/dist/cjs/types/components/inputs/enhanced-text-field/index.d.ts +1 -0
- package/dist/cjs/types/components/inputs/index.d.ts +1 -0
- package/dist/cjs/types/components/inputs/search-input/index.d.ts +1 -0
- package/dist/cjs/types/components/inputs/search-input/search-input.d.ts +19 -0
- package/dist/cjs/types/utils/forms.d.ts +2 -0
- package/dist/esm/index.js +4 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/alerts/expandable-alert/expandable-alert.d.ts +11 -0
- package/dist/esm/types/components/alerts/expandable-alert/index.d.ts +1 -0
- package/dist/esm/types/components/alerts/index.d.ts +1 -0
- package/dist/esm/types/components/data-display/board/board.d.ts +10 -0
- package/dist/esm/types/components/data-display/board/index.d.ts +1 -0
- package/dist/esm/types/components/data-display/index.d.ts +2 -0
- package/dist/esm/types/components/data-display/markdown/index.d.ts +1 -0
- package/dist/esm/types/components/data-display/markdown/markdown.d.ts +7 -0
- package/dist/esm/types/components/dialogs/bootstrap-dialog/bootstrap-dialog.d.ts +2 -0
- package/dist/esm/types/components/dialogs/bootstrap-dialog/index.d.ts +1 -0
- package/dist/esm/types/components/dialogs/confirm-dialog/confirm-dialog.d.ts +10 -0
- package/dist/esm/types/components/dialogs/confirm-dialog/index.d.ts +1 -0
- package/dist/esm/types/components/dialogs/dialog-hooks/index.d.ts +1 -0
- package/dist/esm/types/components/dialogs/dialog-hooks/use-dialog.d.ts +7 -0
- package/dist/esm/types/components/dialogs/dialog.types.d.ts +26 -0
- package/dist/esm/types/components/dialogs/form-dialog/form-dialog.d.ts +10 -0
- package/dist/esm/types/components/dialogs/form-dialog/index.d.ts +1 -0
- package/dist/esm/types/components/dialogs/index.d.ts +5 -0
- package/dist/esm/types/components/index.d.ts +2 -0
- package/dist/esm/types/components/inputs/enhanced-autocomplete/enhanced-autocomplete.d.ts +10 -0
- package/dist/esm/types/components/inputs/enhanced-autocomplete/index.d.ts +1 -0
- package/dist/esm/types/components/inputs/enhanced-text-field/enhanced-text-field.d.ts +7 -0
- package/dist/esm/types/components/inputs/enhanced-text-field/index.d.ts +1 -0
- package/dist/esm/types/components/inputs/index.d.ts +1 -0
- package/dist/esm/types/components/inputs/search-input/index.d.ts +1 -0
- package/dist/esm/types/components/inputs/search-input/search-input.d.ts +19 -0
- package/dist/esm/types/utils/forms.d.ts +2 -0
- package/dist/index.d.ts +95 -6
- package/package.json +34 -32
- package/src/components/alerts/alerts.stories.mdx +10 -0
- package/src/components/alerts/expandable-alert/expandable-alert.stories.tsx +48 -0
- package/src/components/alerts/expandable-alert/expandable-alert.test.tsx +114 -0
- package/src/components/alerts/expandable-alert/expandable-alert.tsx +71 -0
- package/src/components/alerts/expandable-alert/index.ts +1 -0
- package/src/components/alerts/index.ts +1 -0
- package/src/components/components.stories.mdx +2 -0
- package/src/components/data-display/board/board.stories.tsx +54 -0
- package/src/components/data-display/board/board.test.tsx +100 -0
- package/src/components/data-display/board/board.tsx +63 -0
- package/src/components/data-display/board/index.ts +1 -0
- package/src/components/data-display/data-display.stories.mdx +2 -0
- package/src/components/data-display/index.ts +2 -0
- package/src/components/data-display/markdown/index.ts +1 -0
- package/src/components/data-display/markdown/markdown.stories.tsx +25 -0
- package/src/components/data-display/markdown/markdown.test.tsx +64 -0
- package/src/components/data-display/markdown/markdown.tsx +38 -0
- package/src/components/dialogs/bootstrap-dialog/bootstrap-dialog.stories.tsx +81 -0
- package/src/components/dialogs/bootstrap-dialog/bootstrap-dialog.test.tsx +233 -0
- package/src/components/dialogs/bootstrap-dialog/bootstrap-dialog.tsx +95 -0
- package/src/components/dialogs/bootstrap-dialog/index.ts +1 -0
- package/src/components/dialogs/confirm-dialog/confirm-dialog.stories.tsx +43 -0
- package/src/components/dialogs/confirm-dialog/confirm-dialog.test.tsx +150 -0
- package/src/components/dialogs/confirm-dialog/confirm-dialog.tsx +51 -0
- package/src/components/dialogs/confirm-dialog/index.ts +1 -0
- package/src/components/dialogs/dialog-hooks/index.ts +1 -0
- package/src/components/dialogs/dialog-hooks/use-dialog.ts +10 -0
- package/src/components/dialogs/dialog.types.ts +27 -0
- package/src/components/dialogs/dialogs.stories.mdx +12 -0
- package/src/components/dialogs/form-dialog/form-dialog.stories.tsx +52 -0
- package/src/components/dialogs/form-dialog/form-dialog.test.tsx +164 -0
- package/src/components/dialogs/form-dialog/form-dialog.tsx +63 -0
- package/src/components/dialogs/form-dialog/index.ts +1 -0
- package/src/components/dialogs/index.ts +5 -0
- package/src/components/index.ts +2 -0
- package/src/components/inputs/enhanced-autocomplete/enhanced-autocomplete.stories.tsx +109 -0
- package/src/components/inputs/enhanced-autocomplete/enhanced-autocomplete.test.tsx +74 -0
- package/src/components/inputs/enhanced-autocomplete/enhanced-autocomplete.tsx +64 -0
- package/src/components/inputs/enhanced-autocomplete/index.ts +1 -0
- package/src/components/inputs/enhanced-text-field/enhanced-text-field.stories.tsx +120 -0
- package/src/components/inputs/enhanced-text-field/enhanced-text-field.test.tsx +63 -0
- package/src/components/inputs/enhanced-text-field/enhanced-text-field.tsx +101 -0
- package/src/components/inputs/enhanced-text-field/index.ts +1 -0
- package/src/components/inputs/index.ts +1 -0
- package/src/components/inputs/inputs.stories.mdx +3 -0
- package/src/components/inputs/search-input/index.ts +1 -0
- package/src/components/inputs/search-input/search-input.stories.tsx +57 -0
- package/src/components/inputs/search-input/search-input.test.tsx +165 -0
- package/src/components/inputs/search-input/search-input.tsx +218 -0
- package/src/components/value-displays/value-datetime/value-datetime.test.tsx +17 -8
- package/src/components/value-displays/value-datetime/value-datetime.tsx +23 -20
- package/src/components/value-displays/value-rating/value-rating.tsx +1 -1
- package/src/components/value-displays/value-text/value-text.tsx +1 -1
- package/src/generators/generators.mock.ts +3 -14
- package/src/generators/model-form/model-form.tsx +3 -6
- package/src/storybook.tsx +51 -4
- package/src/tests/actions.ts +2 -1
- package/src/tests/assertions.ts +50 -5
- package/src/tests/datatable-placeholder/datatable-placeholder.tsx +2 -4
- package/src/tests/mocks/markdown.mock.ts +25 -0
- package/src/types/index.d.ts +6 -0
- package/src/utils/forms.ts +11 -0
- package/dist/cjs/types/generators/generators.model.test.d.ts +0 -1
- package/dist/cjs/types/utils/arrays.test.d.ts +0 -1
- package/dist/esm/types/generators/generators.model.test.d.ts +0 -1
- package/dist/esm/types/utils/arrays.test.d.ts +0 -1
|
@@ -219,19 +219,8 @@ const mockFieldValue: Record<string, () => FieldType> = {
|
|
|
219
219
|
lastName: faker.name.lastName,
|
|
220
220
|
gender: faker.name.gender,
|
|
221
221
|
age: () => faker.datatype.number({ min: 20, max: 60 }),
|
|
222
|
-
birthDate: () =>
|
|
223
|
-
|
|
224
|
-
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
|
225
|
-
},
|
|
226
|
-
returnTime: () => {
|
|
227
|
-
const date = faker.date.recent();
|
|
228
|
-
const time = new Date();
|
|
229
|
-
time.setHours(date.getHours());
|
|
230
|
-
time.setMinutes(date.getMinutes());
|
|
231
|
-
time.setSeconds(0);
|
|
232
|
-
time.setMilliseconds(0);
|
|
233
|
-
return time;
|
|
234
|
-
},
|
|
222
|
+
birthDate: () => new Date(2019, 3, 2),
|
|
223
|
+
returnTime: () => new Date(2022, 10, 2, 11, 0),
|
|
235
224
|
model: faker.vehicle.model,
|
|
236
225
|
manufacturer: faker.vehicle.manufacturer,
|
|
237
226
|
color: faker.vehicle.color,
|
|
@@ -245,7 +234,7 @@ const mockFieldValue: Record<string, () => FieldType> = {
|
|
|
245
234
|
quantity: () => faker.datatype.number({ min: 1, max: 9 }),
|
|
246
235
|
available: faker.datatype.boolean,
|
|
247
236
|
currency: () => "MXN",
|
|
248
|
-
tradeDate:
|
|
237
|
+
tradeDate: () => new Date(2012, 2, 11, 8, 25),
|
|
249
238
|
};
|
|
250
239
|
|
|
251
240
|
export const createModelInstance = <T extends BasicModelInstance>(model: Model, seed = 100): T => {
|
|
@@ -191,30 +191,27 @@ export const ModelForm = <T extends BasicModelInstance>({
|
|
|
191
191
|
fieldInput = (
|
|
192
192
|
<DesktopDatePicker
|
|
193
193
|
label={name}
|
|
194
|
-
|
|
194
|
+
format={field.format}
|
|
195
195
|
value={value}
|
|
196
196
|
onChange={(value) => handleDateChange(value, key, id)}
|
|
197
|
-
renderInput={(params) => <TextField {...params} />}
|
|
198
197
|
/>
|
|
199
198
|
);
|
|
200
199
|
} else if (type === "time") {
|
|
201
200
|
fieldInput = (
|
|
202
201
|
<TimePicker
|
|
203
202
|
label={name}
|
|
204
|
-
|
|
203
|
+
format={field.format}
|
|
205
204
|
value={value}
|
|
206
205
|
onChange={(value) => handleDateChange(value, key, id)}
|
|
207
|
-
renderInput={(params) => <TextField {...params} />}
|
|
208
206
|
/>
|
|
209
207
|
);
|
|
210
208
|
} else if (type === "datetime") {
|
|
211
209
|
fieldInput = (
|
|
212
210
|
<DateTimePicker
|
|
213
211
|
label={name}
|
|
214
|
-
|
|
212
|
+
format={field.format}
|
|
215
213
|
value={value}
|
|
216
214
|
onChange={(value) => handleDateChange(value, key, id)}
|
|
217
|
-
renderInput={(params) => <TextField {...params} />}
|
|
218
215
|
/>
|
|
219
216
|
);
|
|
220
217
|
} else {
|
package/src/storybook.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/* eslint-disable react/display-name */
|
|
2
|
-
import React, { FunctionComponent } from "react";
|
|
2
|
+
import React, { FunctionComponent, PropsWithChildren, ReactElement, useState } from "react";
|
|
3
3
|
import { ComponentStory } from "@storybook/react";
|
|
4
4
|
import { JSXElementConstructor } from "react";
|
|
5
|
-
import { Box } from "@mui/material";
|
|
5
|
+
import { Box, Button, SxProps, Theme } from "@mui/material";
|
|
6
6
|
import { MemoryRouter, Router, Navigator, Route, Routes } from "react-router-dom";
|
|
7
7
|
import { NotificationCenterProvider } from "./providers";
|
|
8
8
|
import { action } from "@storybook/addon-actions";
|
|
@@ -18,6 +18,7 @@ export function createTemplate<P extends object>(
|
|
|
18
18
|
const replaceAction = action("navigator/replace");
|
|
19
19
|
const goAction = action("navigator/go");
|
|
20
20
|
const pushAction = action("navigator/push");
|
|
21
|
+
const closeDialogAction = action("dialog/close");
|
|
21
22
|
|
|
22
23
|
export const withActionRouter =
|
|
23
24
|
({ location = "/", path = "/" }: { location?: string; path?: string } = {}) =>
|
|
@@ -65,9 +66,24 @@ export const withFullHeight = (Story: FunctionComponent) => {
|
|
|
65
66
|
};
|
|
66
67
|
|
|
67
68
|
export const withContainer =
|
|
68
|
-
({
|
|
69
|
+
({
|
|
70
|
+
width,
|
|
71
|
+
height,
|
|
72
|
+
bordered,
|
|
73
|
+
backgroundColor,
|
|
74
|
+
padding,
|
|
75
|
+
}: {
|
|
76
|
+
width?: number;
|
|
77
|
+
height?: number;
|
|
78
|
+
bordered?: boolean;
|
|
79
|
+
backgroundColor?: string;
|
|
80
|
+
padding?: number;
|
|
81
|
+
}) =>
|
|
69
82
|
(Story: FunctionComponent) => {
|
|
70
|
-
let sx = {
|
|
83
|
+
let sx: SxProps<Theme> = {
|
|
84
|
+
backgroundColor,
|
|
85
|
+
padding,
|
|
86
|
+
};
|
|
71
87
|
if (bordered) {
|
|
72
88
|
sx = {
|
|
73
89
|
...sx,
|
|
@@ -98,3 +114,34 @@ export const withLocalizationProvider = (Story: FunctionComponent) => {
|
|
|
98
114
|
</LocalizationProvider>
|
|
99
115
|
);
|
|
100
116
|
};
|
|
117
|
+
|
|
118
|
+
export const StoryDialogManager = ({
|
|
119
|
+
component: C,
|
|
120
|
+
args,
|
|
121
|
+
}: {
|
|
122
|
+
component: FunctionComponent<any>;
|
|
123
|
+
args: any;
|
|
124
|
+
}) => {
|
|
125
|
+
const [open, setOpen] = useState(false);
|
|
126
|
+
const handleClose = (key: string) => {
|
|
127
|
+
setOpen(false);
|
|
128
|
+
closeDialogAction(key);
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
return (
|
|
132
|
+
<Box>
|
|
133
|
+
<Button variant="contained" onClick={() => setOpen(true)}>
|
|
134
|
+
Open
|
|
135
|
+
</Button>
|
|
136
|
+
<C
|
|
137
|
+
{...args}
|
|
138
|
+
open={open}
|
|
139
|
+
onClose={() => handleClose("close")}
|
|
140
|
+
onCancel={() => handleClose("cancel")}
|
|
141
|
+
onAccept={() => handleClose("accept")}
|
|
142
|
+
onConfirm={() => handleClose("confirm")}
|
|
143
|
+
onSubmit={() => handleClose("submit")}
|
|
144
|
+
/>
|
|
145
|
+
</Box>
|
|
146
|
+
);
|
|
147
|
+
};
|
package/src/tests/actions.ts
CHANGED
|
@@ -43,5 +43,6 @@ export const clearCheckbox = async (element: HTMLInputElement) => {
|
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
export const pickDatetime = (element: HTMLInputElement, valueArg: Date, fmt: string) => {
|
|
46
|
-
|
|
46
|
+
const value = format(valueArg, fmt);
|
|
47
|
+
fireEvent.change(element, { target: { value } });
|
|
47
48
|
};
|
package/src/tests/assertions.ts
CHANGED
|
@@ -8,6 +8,18 @@ export const expectContentPlaceholder = async () => {
|
|
|
8
8
|
expect(await screen.findByTestId(/content-placeholder-test/i)).toBeInTheDocument();
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
+
export const assertDatetimeInputValue = (
|
|
12
|
+
element: HTMLElement,
|
|
13
|
+
{ value, fmt, addSpaces = false }: { value: Date; fmt: string; addSpaces?: boolean },
|
|
14
|
+
) => {
|
|
15
|
+
let expectedDateValue = format(value, fmt).replace(/ /g, " ");
|
|
16
|
+
|
|
17
|
+
if (addSpaces) {
|
|
18
|
+
expectedDateValue = expectedDateValue.replace(/\//g, " / ").replace(/-/g, " - ");
|
|
19
|
+
}
|
|
20
|
+
expect(element).toHaveValue(expectedDateValue);
|
|
21
|
+
};
|
|
22
|
+
|
|
11
23
|
export const expectModelFieldInputExist = (fields: ModelField[]) => {
|
|
12
24
|
fields.forEach((field) => {
|
|
13
25
|
if (field.type === "group") {
|
|
@@ -41,11 +53,11 @@ export const expectModelFieldInputValue = (
|
|
|
41
53
|
screen.getByRole("checkbox", { name: field.name, checked: value as boolean }),
|
|
42
54
|
).toBeInTheDocument();
|
|
43
55
|
} else if (field.type === "date" || field.type === "time" || field.type === "datetime") {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
);
|
|
56
|
+
assertDatetimeInputValue(screen.getByRole("textbox", { name: field.name }), {
|
|
57
|
+
value: value as Date,
|
|
58
|
+
fmt: field.format,
|
|
59
|
+
addSpaces: true,
|
|
60
|
+
});
|
|
49
61
|
} else {
|
|
50
62
|
expect(screen.getByDisplayValue(value.toString())).toBeInTheDocument();
|
|
51
63
|
}
|
|
@@ -156,3 +168,36 @@ export const expectToHaveBeenCalledOnceWithMockInstance = (
|
|
|
156
168
|
),
|
|
157
169
|
});
|
|
158
170
|
};
|
|
171
|
+
|
|
172
|
+
export enum AssertCloseDateUpTo {
|
|
173
|
+
Year = 1,
|
|
174
|
+
Month = 2,
|
|
175
|
+
Day = 3,
|
|
176
|
+
Hour = 4,
|
|
177
|
+
Minute = 5,
|
|
178
|
+
Seconds = 6,
|
|
179
|
+
Milliseconds = 7,
|
|
180
|
+
}
|
|
181
|
+
export const assertCloseDate = (date: Date, expectedDate: Date, upTo: AssertCloseDateUpTo) => {
|
|
182
|
+
if (upTo >= AssertCloseDateUpTo.Year) {
|
|
183
|
+
expect(date.getFullYear()).toBe(expectedDate.getFullYear());
|
|
184
|
+
}
|
|
185
|
+
if (upTo >= AssertCloseDateUpTo.Month) {
|
|
186
|
+
expect(date.getMonth()).toBe(expectedDate.getMonth());
|
|
187
|
+
}
|
|
188
|
+
if (upTo >= AssertCloseDateUpTo.Day) {
|
|
189
|
+
expect(date.getDay()).toBe(expectedDate.getDay());
|
|
190
|
+
}
|
|
191
|
+
if (upTo >= AssertCloseDateUpTo.Hour) {
|
|
192
|
+
expect(date.getHours()).toBe(expectedDate.getHours());
|
|
193
|
+
}
|
|
194
|
+
if (upTo >= AssertCloseDateUpTo.Minute) {
|
|
195
|
+
expect(date.getMinutes()).toBe(expectedDate.getMinutes());
|
|
196
|
+
}
|
|
197
|
+
if (upTo >= AssertCloseDateUpTo.Seconds) {
|
|
198
|
+
expect(date.getSeconds()).toBe(expectedDate.getSeconds());
|
|
199
|
+
}
|
|
200
|
+
if (upTo >= AssertCloseDateUpTo.Milliseconds) {
|
|
201
|
+
expect(date.getMilliseconds()).toBe(expectedDate.getMilliseconds());
|
|
202
|
+
}
|
|
203
|
+
};
|
|
@@ -29,11 +29,9 @@ export const DatatablePlaceholder = ({
|
|
|
29
29
|
<DataGrid
|
|
30
30
|
rows={rows}
|
|
31
31
|
columns={columns as any}
|
|
32
|
-
pageSize={5}
|
|
33
|
-
rowsPerPageOptions={[5]}
|
|
34
32
|
checkboxSelection
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
autoPageSize
|
|
34
|
+
disableRowSelectionOnClick
|
|
37
35
|
/>
|
|
38
36
|
</Box>
|
|
39
37
|
);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export const mockMarkdownContent = `
|
|
2
|
+
# Diu in illa Lavini atque de quoque
|
|
3
|
+
|
|
4
|
+
## Secretaque nepos mentitis cupidine ponti dextramque nata
|
|
5
|
+
funesta opposuitque deus adloquitur reminiscitur manibus ales? Spumisque fulva, veneni, vicit dum? Ipse responsa equo!
|
|
6
|
+
|
|
7
|
+
Deos debebat, in tenuit postquam candida errorem vires undis limina ignis pectora capere dant, in curvo
|
|
8
|
+
|
|
9
|
+
## Mota dixit
|
|
10
|
+
Dum tot tum nunc, atque deae telum rustica tuebere tacti dat. Nunc quasi Tritonidos fluminis. Ulli regnat clamant luminis moenia; hoc numen accipe, indefletaeque artesque fores ales in concumbere. Boves humi regimen, vulnus ore adspicias, sit mutua nega, illud; quam fruges meritis.
|
|
11
|
+
|
|
12
|
+
## Link section
|
|
13
|
+
[toto link](http://www.maestispropositum.io/nuncprecibus.html)
|
|
14
|
+
|
|
15
|
+
## List section
|
|
16
|
+
|
|
17
|
+
1. Cum bella cantato
|
|
18
|
+
2. Sinistra maternos tamen Gorgonis sim aquis
|
|
19
|
+
3. Quo orat dabitur Dianae ira timendi templi
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
- Cum oro Lycabas ultima
|
|
23
|
+
- Haut ad dedit reducit crimina adhaeret pectore
|
|
24
|
+
- Vulnere latebramque minima
|
|
25
|
+
`;
|
package/src/types/index.d.ts
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FormEvent } from "react";
|
|
2
|
+
|
|
3
|
+
export const getFormData = <T>(e: FormEvent<HTMLFormElement>): T => {
|
|
4
|
+
const data = new FormData(e.currentTarget);
|
|
5
|
+
const rawData: Record<string, any> = {};
|
|
6
|
+
|
|
7
|
+
data.forEach((value, key) => {
|
|
8
|
+
rawData[key] = value;
|
|
9
|
+
});
|
|
10
|
+
return rawData as T;
|
|
11
|
+
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|