@springmicro/forms 0.6.4 → 0.7.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.
Files changed (78) hide show
  1. package/.eslintrc.cjs +22 -22
  2. package/README.md +11 -11
  3. package/dist/index.d.ts +0 -0
  4. package/dist/index.js +0 -0
  5. package/dist/index.umd.cjs +0 -0
  6. package/package.json +3 -3
  7. package/src/builder/bottom-drawer.tsx +429 -429
  8. package/src/builder/form-builder.tsx +256 -256
  9. package/src/builder/modal.tsx +39 -39
  10. package/src/builder/nodes/node-base.tsx +94 -94
  11. package/src/builder/nodes/node-child-helpers.tsx +273 -273
  12. package/src/builder/nodes/node-parent.tsx +187 -187
  13. package/src/builder/nodes/node-types/array-node.tsx +134 -134
  14. package/src/builder/nodes/node-types/date-node.tsx +60 -60
  15. package/src/builder/nodes/node-types/file-node.tsx +67 -67
  16. package/src/builder/nodes/node-types/integer-node.tsx +60 -60
  17. package/src/builder/nodes/node-types/object-node.tsx +67 -67
  18. package/src/builder/nodes/node-types/text-node.tsx +66 -66
  19. package/src/fields/ArrayField.tsx +875 -875
  20. package/src/fields/BooleanField.tsx +110 -110
  21. package/src/fields/MultiSchemaField.tsx +236 -236
  22. package/src/fields/NullField.tsx +22 -22
  23. package/src/fields/NumberField.tsx +87 -87
  24. package/src/fields/ObjectField.tsx +338 -338
  25. package/src/fields/SchemaField.tsx +402 -402
  26. package/src/fields/StringField.tsx +67 -67
  27. package/src/fields/index.ts +24 -24
  28. package/src/index.tsx +26 -26
  29. package/src/interfaces/MessagesProps.interface.ts +5 -5
  30. package/src/interfaces/Option.interface.ts +4 -4
  31. package/src/styles/select.styles.ts +28 -28
  32. package/src/templates/ArrayFieldDescriptionTemplate.tsx +42 -42
  33. package/src/templates/ArrayFieldItemTemplate.tsx +78 -78
  34. package/src/templates/ArrayFieldTemplate.tsx +90 -90
  35. package/src/templates/ArrayFieldTitleTemplate.tsx +44 -44
  36. package/src/templates/BaseInputTemplate.tsx +94 -94
  37. package/src/templates/ButtonTemplates/AddButton.tsx +29 -29
  38. package/src/templates/ButtonTemplates/IconButton.tsx +49 -49
  39. package/src/templates/ButtonTemplates/SubmitButton.tsx +29 -29
  40. package/src/templates/ButtonTemplates/index.ts +16 -16
  41. package/src/templates/DescriptionField.tsx +29 -29
  42. package/src/templates/ErrorList.tsx +25 -25
  43. package/src/templates/FieldTemplate/FieldTemplate.tsx +39 -39
  44. package/src/templates/FieldTemplate/Label.tsx +29 -29
  45. package/src/templates/FieldTemplate/WrapIfAdditional.tsx +85 -85
  46. package/src/templates/FieldTemplate/index.ts +3 -3
  47. package/src/templates/ObjectFieldTemplate.tsx +79 -79
  48. package/src/templates/TitleField.tsx +20 -20
  49. package/src/templates/UnsupportedField.tsx +29 -29
  50. package/src/templates/index.ts +32 -32
  51. package/src/types/Message.type.ts +6 -6
  52. package/src/types/RawMessage.type.ts +15 -15
  53. package/src/types/form-builder.ts +135 -135
  54. package/src/types/utils.type.ts +1 -1
  55. package/src/utils/form-builder.ts +424 -424
  56. package/src/utils/processSelectValue.ts +50 -50
  57. package/src/widgets/AltDateTimeWidget.tsx +17 -17
  58. package/src/widgets/AltDateWidget.tsx +216 -216
  59. package/src/widgets/CheckboxWidget.tsx +80 -80
  60. package/src/widgets/CheckboxesWidget.tsx +74 -74
  61. package/src/widgets/ColorWidget.tsx +26 -26
  62. package/src/widgets/DateTimeWidget.tsx +28 -28
  63. package/src/widgets/DateWidget.tsx +36 -36
  64. package/src/widgets/EmailWidget.tsx +19 -19
  65. package/src/widgets/FileWidget.tsx +144 -144
  66. package/src/widgets/HiddenWidget.tsx +22 -22
  67. package/src/widgets/PasswordWidget.tsx +20 -20
  68. package/src/widgets/RadioWidget.tsx +87 -87
  69. package/src/widgets/RangeWidget.tsx +24 -24
  70. package/src/widgets/SelectWidget.tsx +99 -99
  71. package/src/widgets/TextWidget.tsx +19 -19
  72. package/src/widgets/TextareaWidget.tsx +64 -64
  73. package/src/widgets/URLWidget.tsx +19 -19
  74. package/src/widgets/UpDownWidget.tsx +20 -20
  75. package/src/widgets/index.ts +43 -43
  76. package/tsconfig.json +24 -24
  77. package/tsconfig.node.json +10 -10
  78. package/vite.config.ts +25 -25
@@ -1,99 +1,99 @@
1
- import React, {
2
- ChangeEvent,
3
- FocusEvent,
4
- FocusEventHandler,
5
- useCallback,
6
- } from "react";
7
- import type {
8
- EnumOptionsType,
9
- GenericObjectType,
10
- WidgetProps,
11
- } from "@rjsf/utils";
12
- import Select, { MultiValue, SingleValue } from "react-select";
13
- import { selectStyles } from "../styles/select.styles";
14
- import { Option } from "../interfaces/Option.interface";
15
- import processSelectValue from "../utils/processSelectValue";
16
-
17
- /** The `SelectWidget` is a widget for rendering dropdowns.
18
- * It is typically used with string properties constrained with enum options.
19
- *
20
- * @param props - The `WidgetProps` for this component
21
- */
22
- function SelectWidget<T = any, F extends GenericObjectType = any>({
23
- schema,
24
- id,
25
- options,
26
- name,
27
- value,
28
- disabled,
29
- readonly,
30
- multiple = false,
31
- autofocus = false,
32
- onBlur,
33
- onFocus,
34
- onChange,
35
- }: WidgetProps<T, F>) {
36
- const { enumOptions, enumDisabled } = options;
37
- const emptyValue = multiple ? [] : "";
38
-
39
- const handleFocus: FocusEventHandler<HTMLInputElement> = useCallback(
40
- () => onFocus(id, processSelectValue(schema, value, options)),
41
- [onFocus, id, schema, multiple, options]
42
- );
43
-
44
- const handleBlur: FocusEventHandler<HTMLInputElement> = useCallback(
45
- () => onBlur(id, processSelectValue(schema, value, options)),
46
- [onBlur, id, schema, multiple, options]
47
- );
48
-
49
- const handleChange = useCallback(
50
- (event: MultiValue<EnumOptionsType> | SingleValue<EnumOptionsType>) => {
51
- let newValue: string | string[] | undefined;
52
- if (multiple && Array.isArray(event)) {
53
- newValue = event.map((option) => option.value);
54
- } else {
55
- const singleEvent = event as SingleValue<EnumOptionsType>;
56
- newValue = singleEvent?.value;
57
- }
58
- return onChange(processSelectValue(schema, newValue, options));
59
- },
60
- [onChange, schema, multiple, options]
61
- );
62
-
63
- const getEnumObjectFromVal = (val: string) => {
64
- return (
65
- enumOptions?.find((option: Option) => option.value === val) || {
66
- label: "",
67
- value: "",
68
- }
69
- );
70
- };
71
- const getSelectValue = () => {
72
- let selectValue: Option | Option[] | undefined = undefined;
73
- if (multiple && Array.isArray(value)) {
74
- selectValue = value.map((val) => getEnumObjectFromVal(val.toString()));
75
- } else if (value) {
76
- selectValue = getEnumObjectFromVal(value.toString());
77
- }
78
- return selectValue;
79
- };
80
-
81
- return (
82
- <Select
83
- id={id}
84
- instanceId={id}
85
- isMulti={multiple}
86
- name={name}
87
- value={getSelectValue()}
88
- isDisabled={disabled || readonly}
89
- autoFocus={autofocus}
90
- options={enumOptions}
91
- onChange={handleChange}
92
- onBlur={handleBlur}
93
- onFocus={handleFocus}
94
- styles={selectStyles}
95
- />
96
- );
97
- }
98
-
99
- export default SelectWidget;
1
+ import React, {
2
+ ChangeEvent,
3
+ FocusEvent,
4
+ FocusEventHandler,
5
+ useCallback,
6
+ } from "react";
7
+ import type {
8
+ EnumOptionsType,
9
+ GenericObjectType,
10
+ WidgetProps,
11
+ } from "@rjsf/utils";
12
+ import Select, { MultiValue, SingleValue } from "react-select";
13
+ import { selectStyles } from "../styles/select.styles";
14
+ import { Option } from "../interfaces/Option.interface";
15
+ import processSelectValue from "../utils/processSelectValue";
16
+
17
+ /** The `SelectWidget` is a widget for rendering dropdowns.
18
+ * It is typically used with string properties constrained with enum options.
19
+ *
20
+ * @param props - The `WidgetProps` for this component
21
+ */
22
+ function SelectWidget<T = any, F extends GenericObjectType = any>({
23
+ schema,
24
+ id,
25
+ options,
26
+ name,
27
+ value,
28
+ disabled,
29
+ readonly,
30
+ multiple = false,
31
+ autofocus = false,
32
+ onBlur,
33
+ onFocus,
34
+ onChange,
35
+ }: WidgetProps<T, F>) {
36
+ const { enumOptions, enumDisabled } = options;
37
+ const emptyValue = multiple ? [] : "";
38
+
39
+ const handleFocus: FocusEventHandler<HTMLInputElement> = useCallback(
40
+ () => onFocus(id, processSelectValue(schema, value, options)),
41
+ [onFocus, id, schema, multiple, options]
42
+ );
43
+
44
+ const handleBlur: FocusEventHandler<HTMLInputElement> = useCallback(
45
+ () => onBlur(id, processSelectValue(schema, value, options)),
46
+ [onBlur, id, schema, multiple, options]
47
+ );
48
+
49
+ const handleChange = useCallback(
50
+ (event: MultiValue<EnumOptionsType> | SingleValue<EnumOptionsType>) => {
51
+ let newValue: string | string[] | undefined;
52
+ if (multiple && Array.isArray(event)) {
53
+ newValue = event.map((option) => option.value);
54
+ } else {
55
+ const singleEvent = event as SingleValue<EnumOptionsType>;
56
+ newValue = singleEvent?.value;
57
+ }
58
+ return onChange(processSelectValue(schema, newValue, options));
59
+ },
60
+ [onChange, schema, multiple, options]
61
+ );
62
+
63
+ const getEnumObjectFromVal = (val: string) => {
64
+ return (
65
+ enumOptions?.find((option: Option) => option.value === val) || {
66
+ label: "",
67
+ value: "",
68
+ }
69
+ );
70
+ };
71
+ const getSelectValue = () => {
72
+ let selectValue: Option | Option[] | undefined = undefined;
73
+ if (multiple && Array.isArray(value)) {
74
+ selectValue = value.map((val) => getEnumObjectFromVal(val.toString()));
75
+ } else if (value) {
76
+ selectValue = getEnumObjectFromVal(value.toString());
77
+ }
78
+ return selectValue;
79
+ };
80
+
81
+ return (
82
+ <Select
83
+ id={id}
84
+ instanceId={id}
85
+ isMulti={multiple}
86
+ name={name}
87
+ value={getSelectValue()}
88
+ isDisabled={disabled || readonly}
89
+ autoFocus={autofocus}
90
+ options={enumOptions}
91
+ onChange={handleChange}
92
+ onBlur={handleBlur}
93
+ onFocus={handleFocus}
94
+ styles={selectStyles}
95
+ />
96
+ );
97
+ }
98
+
99
+ export default SelectWidget;
@@ -1,19 +1,19 @@
1
- import React from "react";
2
- import type { GenericObjectType, WidgetProps } from "@rjsf/utils";
3
- import { getTemplate } from "@rjsf/utils";
4
-
5
- /** The `TextWidget` component uses the `BaseInputTemplate`.
6
- *
7
- * @param props - The `WidgetProps` for this component
8
- */
9
- export default function TextWidget<T = any, F extends GenericObjectType = any>(
10
- props: WidgetProps<T, F>
11
- ) {
12
- const { options, registry } = props;
13
- const BaseInputTemplate = getTemplate<"BaseInputTemplate", T, F>(
14
- "BaseInputTemplate",
15
- registry,
16
- options
17
- );
18
- return <BaseInputTemplate {...props} />;
19
- }
1
+ import React from "react";
2
+ import type { GenericObjectType, WidgetProps } from "@rjsf/utils";
3
+ import { getTemplate } from "@rjsf/utils";
4
+
5
+ /** The `TextWidget` component uses the `BaseInputTemplate`.
6
+ *
7
+ * @param props - The `WidgetProps` for this component
8
+ */
9
+ export default function TextWidget<T = any, F extends GenericObjectType = any>(
10
+ props: WidgetProps<T, F>
11
+ ) {
12
+ const { options, registry } = props;
13
+ const BaseInputTemplate = getTemplate<"BaseInputTemplate", T, F>(
14
+ "BaseInputTemplate",
15
+ registry,
16
+ options
17
+ );
18
+ return <BaseInputTemplate {...props} />;
19
+ }
@@ -1,64 +1,64 @@
1
- import React, { FocusEvent, useCallback } from "react";
2
- import type { WidgetProps, GenericObjectType } from "@rjsf/utils";
3
-
4
- /** The `TextareaWidget` is a widget for rendering input fields as textarea.
5
- *
6
- * @param props - The `WidgetProps` for this component
7
- */
8
- function TextareaWidget<T = any, F extends GenericObjectType = any>({
9
- id,
10
- name,
11
- options = {},
12
- placeholder,
13
- value,
14
- required,
15
- disabled,
16
- readonly,
17
- autofocus = false,
18
- onChange,
19
- onBlur,
20
- onFocus,
21
- }: WidgetProps<T, F>) {
22
- const handleChange = useCallback(
23
- ({ target: { value } }: React.ChangeEvent<HTMLTextAreaElement>) =>
24
- onChange(value === "" ? options.emptyValue : value),
25
- [onChange, options.emptyValue]
26
- );
27
-
28
- const handleBlur = useCallback(
29
- ({ target: { value } }: FocusEvent<HTMLTextAreaElement>) =>
30
- onBlur(id, value),
31
- [onBlur, id]
32
- );
33
-
34
- const handleFocus = useCallback(
35
- ({ target: { value } }: FocusEvent<HTMLTextAreaElement>) =>
36
- onFocus(id, value),
37
- [id, onFocus]
38
- );
39
-
40
- return (
41
- <textarea
42
- id={id}
43
- name={name}
44
- className="textarea textarea-bordered"
45
- value={value ? value : ""}
46
- placeholder={placeholder}
47
- required={required}
48
- disabled={disabled}
49
- readOnly={readonly}
50
- autoFocus={autofocus}
51
- rows={options.rows}
52
- onBlur={handleBlur}
53
- onFocus={handleFocus}
54
- onChange={handleChange}
55
- />
56
- );
57
- }
58
-
59
- TextareaWidget.defaultProps = {
60
- autofocus: false,
61
- options: {},
62
- };
63
-
64
- export default TextareaWidget;
1
+ import React, { FocusEvent, useCallback } from "react";
2
+ import type { WidgetProps, GenericObjectType } from "@rjsf/utils";
3
+
4
+ /** The `TextareaWidget` is a widget for rendering input fields as textarea.
5
+ *
6
+ * @param props - The `WidgetProps` for this component
7
+ */
8
+ function TextareaWidget<T = any, F extends GenericObjectType = any>({
9
+ id,
10
+ name,
11
+ options = {},
12
+ placeholder,
13
+ value,
14
+ required,
15
+ disabled,
16
+ readonly,
17
+ autofocus = false,
18
+ onChange,
19
+ onBlur,
20
+ onFocus,
21
+ }: WidgetProps<T, F>) {
22
+ const handleChange = useCallback(
23
+ ({ target: { value } }: React.ChangeEvent<HTMLTextAreaElement>) =>
24
+ onChange(value === "" ? options.emptyValue : value),
25
+ [onChange, options.emptyValue]
26
+ );
27
+
28
+ const handleBlur = useCallback(
29
+ ({ target: { value } }: FocusEvent<HTMLTextAreaElement>) =>
30
+ onBlur(id, value),
31
+ [onBlur, id]
32
+ );
33
+
34
+ const handleFocus = useCallback(
35
+ ({ target: { value } }: FocusEvent<HTMLTextAreaElement>) =>
36
+ onFocus(id, value),
37
+ [id, onFocus]
38
+ );
39
+
40
+ return (
41
+ <textarea
42
+ id={id}
43
+ name={name}
44
+ className="textarea textarea-bordered"
45
+ value={value ? value : ""}
46
+ placeholder={placeholder}
47
+ required={required}
48
+ disabled={disabled}
49
+ readOnly={readonly}
50
+ autoFocus={autofocus}
51
+ rows={options.rows}
52
+ onBlur={handleBlur}
53
+ onFocus={handleFocus}
54
+ onChange={handleChange}
55
+ />
56
+ );
57
+ }
58
+
59
+ TextareaWidget.defaultProps = {
60
+ autofocus: false,
61
+ options: {},
62
+ };
63
+
64
+ export default TextareaWidget;
@@ -1,19 +1,19 @@
1
- import React from "react";
2
- import type { GenericObjectType, WidgetProps } from "@rjsf/utils";
3
- import { getTemplate } from "@rjsf/utils";
4
-
5
- /** The `URLWidget` component uses the `BaseInputTemplate` changing the type to `url`.
6
- *
7
- * @param props - The `WidgetProps` for this component
8
- */
9
- export default function URLWidget<T = any, F extends GenericObjectType = any>(
10
- props: WidgetProps<T, F>
11
- ) {
12
- const { options, registry } = props;
13
- const BaseInputTemplate = getTemplate<"BaseInputTemplate", T, F>(
14
- "BaseInputTemplate",
15
- registry,
16
- options
17
- );
18
- return <BaseInputTemplate type="url" {...props} />;
19
- }
1
+ import React from "react";
2
+ import type { GenericObjectType, WidgetProps } from "@rjsf/utils";
3
+ import { getTemplate } from "@rjsf/utils";
4
+
5
+ /** The `URLWidget` component uses the `BaseInputTemplate` changing the type to `url`.
6
+ *
7
+ * @param props - The `WidgetProps` for this component
8
+ */
9
+ export default function URLWidget<T = any, F extends GenericObjectType = any>(
10
+ props: WidgetProps<T, F>
11
+ ) {
12
+ const { options, registry } = props;
13
+ const BaseInputTemplate = getTemplate<"BaseInputTemplate", T, F>(
14
+ "BaseInputTemplate",
15
+ registry,
16
+ options
17
+ );
18
+ return <BaseInputTemplate type="url" {...props} />;
19
+ }
@@ -1,20 +1,20 @@
1
- import React from "react";
2
- import type { GenericObjectType, WidgetProps } from "@rjsf/utils";
3
- import { getTemplate } from "@rjsf/utils";
4
-
5
- /** The `UpDownWidget` component uses the `BaseInputTemplate` changing the type to `number`.
6
- *
7
- * @param props - The `WidgetProps` for this component
8
- */
9
- export default function UpDownWidget<
10
- T = any,
11
- F extends GenericObjectType = any
12
- >(props: WidgetProps<T, F>) {
13
- const { options, registry } = props;
14
- const BaseInputTemplate = getTemplate<"BaseInputTemplate", T, F>(
15
- "BaseInputTemplate",
16
- registry,
17
- options
18
- );
19
- return <BaseInputTemplate type="number" {...props} />;
20
- }
1
+ import React from "react";
2
+ import type { GenericObjectType, WidgetProps } from "@rjsf/utils";
3
+ import { getTemplate } from "@rjsf/utils";
4
+
5
+ /** The `UpDownWidget` component uses the `BaseInputTemplate` changing the type to `number`.
6
+ *
7
+ * @param props - The `WidgetProps` for this component
8
+ */
9
+ export default function UpDownWidget<
10
+ T = any,
11
+ F extends GenericObjectType = any
12
+ >(props: WidgetProps<T, F>) {
13
+ const { options, registry } = props;
14
+ const BaseInputTemplate = getTemplate<"BaseInputTemplate", T, F>(
15
+ "BaseInputTemplate",
16
+ registry,
17
+ options
18
+ );
19
+ return <BaseInputTemplate type="number" {...props} />;
20
+ }
@@ -1,43 +1,43 @@
1
- import { RegistryWidgetsType } from "@rjsf/utils";
2
-
3
- import AltDateWidget from "./AltDateWidget";
4
- import AltDateTimeWidget from "./AltDateTimeWidget";
5
- import CheckboxWidget from "./CheckboxWidget";
6
- import CheckboxesWidget from "./CheckboxesWidget";
7
- import ColorWidget from "./ColorWidget";
8
- import DateWidget from "./DateWidget";
9
- import DateTimeWidget from "./DateTimeWidget";
10
- import EmailWidget from "./EmailWidget";
11
- import FileWidget from "./FileWidget";
12
- import HiddenWidget from "./HiddenWidget";
13
- import PasswordWidget from "./PasswordWidget";
14
- import RadioWidget from "./RadioWidget";
15
- import RangeWidget from "./RangeWidget";
16
- import SelectWidget from "./SelectWidget";
17
- import TextareaWidget from "./TextareaWidget";
18
- import TextWidget from "./TextWidget";
19
- import URLWidget from "./URLWidget";
20
- import UpDownWidget from "./UpDownWidget";
21
-
22
- const widgets: RegistryWidgetsType = {
23
- PasswordWidget,
24
- RadioWidget,
25
- UpDownWidget,
26
- RangeWidget,
27
- SelectWidget,
28
- TextWidget,
29
- DateWidget,
30
- DateTimeWidget,
31
- AltDateWidget,
32
- AltDateTimeWidget,
33
- EmailWidget,
34
- URLWidget,
35
- TextareaWidget,
36
- HiddenWidget,
37
- ColorWidget,
38
- FileWidget,
39
- CheckboxWidget,
40
- CheckboxesWidget,
41
- };
42
-
43
- export default widgets;
1
+ import { RegistryWidgetsType } from "@rjsf/utils";
2
+
3
+ import AltDateWidget from "./AltDateWidget";
4
+ import AltDateTimeWidget from "./AltDateTimeWidget";
5
+ import CheckboxWidget from "./CheckboxWidget";
6
+ import CheckboxesWidget from "./CheckboxesWidget";
7
+ import ColorWidget from "./ColorWidget";
8
+ import DateWidget from "./DateWidget";
9
+ import DateTimeWidget from "./DateTimeWidget";
10
+ import EmailWidget from "./EmailWidget";
11
+ import FileWidget from "./FileWidget";
12
+ import HiddenWidget from "./HiddenWidget";
13
+ import PasswordWidget from "./PasswordWidget";
14
+ import RadioWidget from "./RadioWidget";
15
+ import RangeWidget from "./RangeWidget";
16
+ import SelectWidget from "./SelectWidget";
17
+ import TextareaWidget from "./TextareaWidget";
18
+ import TextWidget from "./TextWidget";
19
+ import URLWidget from "./URLWidget";
20
+ import UpDownWidget from "./UpDownWidget";
21
+
22
+ const widgets: RegistryWidgetsType = {
23
+ PasswordWidget,
24
+ RadioWidget,
25
+ UpDownWidget,
26
+ RangeWidget,
27
+ SelectWidget,
28
+ TextWidget,
29
+ DateWidget,
30
+ DateTimeWidget,
31
+ AltDateWidget,
32
+ AltDateTimeWidget,
33
+ EmailWidget,
34
+ URLWidget,
35
+ TextareaWidget,
36
+ HiddenWidget,
37
+ ColorWidget,
38
+ FileWidget,
39
+ CheckboxWidget,
40
+ CheckboxesWidget,
41
+ };
42
+
43
+ export default widgets;
package/tsconfig.json CHANGED
@@ -1,24 +1,24 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2020",
4
- "useDefineForClassFields": true,
5
- "lib": ["ES2020", "DOM", "DOM.Iterable"],
6
- "module": "ESNext",
7
- "skipLibCheck": true,
8
-
9
- /* Bundler mode */
10
- "moduleResolution": "bundler",
11
- "allowImportingTsExtensions": true,
12
- "resolveJsonModule": true,
13
- "isolatedModules": true,
14
- "noEmit": true,
15
- "jsx": "react-jsx",
16
-
17
- /* Linting */
18
- "strict": false,
19
- "noFallthroughCasesInSwitch": true
20
- },
21
- "include": ["src"],
22
- "exclude": ["src/main.tsx"],
23
- "references": [{ "path": "./tsconfig.node.json" }]
24
- }
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "useDefineForClassFields": true,
5
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
6
+ "module": "ESNext",
7
+ "skipLibCheck": true,
8
+
9
+ /* Bundler mode */
10
+ "moduleResolution": "bundler",
11
+ "allowImportingTsExtensions": true,
12
+ "resolveJsonModule": true,
13
+ "isolatedModules": true,
14
+ "noEmit": true,
15
+ "jsx": "react-jsx",
16
+
17
+ /* Linting */
18
+ "strict": false,
19
+ "noFallthroughCasesInSwitch": true
20
+ },
21
+ "include": ["src"],
22
+ "exclude": ["src/main.tsx"],
23
+ "references": [{ "path": "./tsconfig.node.json" }]
24
+ }
@@ -1,10 +1,10 @@
1
- {
2
- "compilerOptions": {
3
- "composite": true,
4
- "skipLibCheck": true,
5
- "module": "ESNext",
6
- "moduleResolution": "bundler",
7
- "allowSyntheticDefaultImports": true
8
- },
9
- "include": ["vite.config.ts"]
10
- }
1
+ {
2
+ "compilerOptions": {
3
+ "composite": true,
4
+ "skipLibCheck": true,
5
+ "module": "ESNext",
6
+ "moduleResolution": "bundler",
7
+ "allowSyntheticDefaultImports": true
8
+ },
9
+ "include": ["vite.config.ts"]
10
+ }
package/vite.config.ts CHANGED
@@ -1,25 +1,25 @@
1
- import react from "@vitejs/plugin-react";
2
- import { resolve } from "path";
3
- import { defineConfig } from "vite";
4
- import dts from "vite-plugin-dts";
5
-
6
- export default defineConfig({
7
- plugins: [react(), dts({ rollupTypes: true })],
8
- build: {
9
- lib: {
10
- entry: resolve(__dirname, "src/index.tsx"),
11
- name: "@springmicro/forms",
12
- fileName: "index",
13
- },
14
- rollupOptions: {
15
- external: ["react", "react-dom", "nanoid"],
16
- output: {
17
- globals: {
18
- react: "React",
19
- "react-dom": "ReactDOM",
20
- nanoid: "Nanoid",
21
- },
22
- },
23
- },
24
- },
25
- });
1
+ import react from "@vitejs/plugin-react";
2
+ import { resolve } from "path";
3
+ import { defineConfig } from "vite";
4
+ import dts from "vite-plugin-dts";
5
+
6
+ export default defineConfig({
7
+ plugins: [react(), dts({ rollupTypes: true })],
8
+ build: {
9
+ lib: {
10
+ entry: resolve(__dirname, "src/index.tsx"),
11
+ name: "@springmicro/forms",
12
+ fileName: "index",
13
+ },
14
+ rollupOptions: {
15
+ external: ["react", "react-dom", "nanoid"],
16
+ output: {
17
+ globals: {
18
+ react: "React",
19
+ "react-dom": "ReactDOM",
20
+ nanoid: "Nanoid",
21
+ },
22
+ },
23
+ },
24
+ },
25
+ });