@tiny-design/react 1.1.1 → 1.1.2
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/es/form/use-form.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import FormInstance from "./form-instance.js";
|
|
2
|
+
import { useRef } from "react";
|
|
2
3
|
//#region src/form/use-form.ts
|
|
3
4
|
function useForm(initialValues = {}) {
|
|
4
|
-
|
|
5
|
+
const ref = useRef(null);
|
|
6
|
+
if (!ref.current) ref.current = new FormInstance(initialValues);
|
|
7
|
+
return [ref.current];
|
|
5
8
|
}
|
|
6
9
|
//#endregion
|
|
7
10
|
export { useForm as default };
|
package/es/form/use-form.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-form.js","names":[],"sources":["../../src/form/use-form.ts"],"sourcesContent":["import FormInstance, { FormValues } from './form-instance';\n\nexport default function useForm(initialValues: FormValues = {}): [FormInstance] {\n
|
|
1
|
+
{"version":3,"file":"use-form.js","names":[],"sources":["../../src/form/use-form.ts"],"sourcesContent":["import { useRef } from 'react';\nimport FormInstance, { FormValues } from './form-instance';\n\nexport default function useForm(initialValues: FormValues = {}): [FormInstance] {\n const ref = useRef<FormInstance | null>(null);\n if (!ref.current) {\n ref.current = new FormInstance(initialValues);\n }\n return [ref.current];\n}\n"],"mappings":";;;AAGA,SAAwB,QAAQ,gBAA4B,EAAE,EAAkB;CAC9E,MAAM,MAAM,OAA4B,KAAK;AAC7C,KAAI,CAAC,IAAI,QACP,KAAI,UAAU,IAAI,aAAa,cAAc;AAE/C,QAAO,CAAC,IAAI,QAAQ"}
|
package/lib/form/use-form.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
require("../_virtual/_rolldown/runtime.js");
|
|
1
2
|
const require_form_instance = require("./form-instance.js");
|
|
3
|
+
let react = require("react");
|
|
2
4
|
//#region src/form/use-form.ts
|
|
3
5
|
function useForm(initialValues = {}) {
|
|
4
|
-
|
|
6
|
+
const ref = (0, react.useRef)(null);
|
|
7
|
+
if (!ref.current) ref.current = new require_form_instance.default(initialValues);
|
|
8
|
+
return [ref.current];
|
|
5
9
|
}
|
|
6
10
|
//#endregion
|
|
7
11
|
exports.default = useForm;
|
package/lib/form/use-form.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-form.js","names":["FormInstance"],"sources":["../../src/form/use-form.ts"],"sourcesContent":["import FormInstance, { FormValues } from './form-instance';\n\nexport default function useForm(initialValues: FormValues = {}): [FormInstance] {\n
|
|
1
|
+
{"version":3,"file":"use-form.js","names":["FormInstance"],"sources":["../../src/form/use-form.ts"],"sourcesContent":["import { useRef } from 'react';\nimport FormInstance, { FormValues } from './form-instance';\n\nexport default function useForm(initialValues: FormValues = {}): [FormInstance] {\n const ref = useRef<FormInstance | null>(null);\n if (!ref.current) {\n ref.current = new FormInstance(initialValues);\n }\n return [ref.current];\n}\n"],"mappings":";;;;AAGA,SAAwB,QAAQ,gBAA4B,EAAE,EAAkB;CAC9E,MAAM,OAAA,GAAA,MAAA,QAAkC,KAAK;AAC7C,KAAI,CAAC,IAAI,QACP,KAAI,UAAU,IAAIA,sBAAAA,QAAa,cAAc;AAE/C,QAAO,CAAC,IAAI,QAAQ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiny-design/react",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "A friendly UI component set for React",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -55,8 +55,8 @@
|
|
|
55
55
|
"classnames": "^2.3.1",
|
|
56
56
|
"react-transition-group": "^4.4.2",
|
|
57
57
|
"tslib": "^2.3.1",
|
|
58
|
-
"@tiny-design/
|
|
59
|
-
"@tiny-design/
|
|
58
|
+
"@tiny-design/icons": "1.1.2",
|
|
59
|
+
"@tiny-design/tokens": "1.1.2"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@testing-library/jest-dom": "^6.0.0",
|