@tamagui/form 1.61.2 → 1.62.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/dist/cjs/Form.js +10 -24
- package/dist/cjs/Form.js.map +1 -1
- package/dist/cjs/Form.native.js +63 -0
- package/dist/cjs/Form.native.js.map +6 -0
- package/dist/cjs/index.js +4 -8
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.native.js +20 -0
- package/dist/cjs/index.native.js.map +6 -0
- package/dist/esm/Form.js +5 -12
- package/dist/esm/Form.js.map +1 -1
- package/dist/jsx/Form.js +4 -11
- package/dist/jsx/Form.js.map +1 -1
- package/dist/jsx/Form.native.js +42 -0
- package/dist/jsx/Form.native.js.map +6 -0
- package/dist/jsx/index.native.js +2 -0
- package/dist/jsx/index.native.js.map +6 -0
- package/package.json +9 -9
package/dist/cjs/Form.js
CHANGED
|
@@ -1,21 +1,17 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
5
|
var __export = (target, all) => {
|
|
7
6
|
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable:
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
8
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
12
10
|
for (let key of __getOwnPropNames(from))
|
|
13
|
-
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
11
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
12
|
return to;
|
|
17
13
|
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value:
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
19
15
|
var Form_exports = {};
|
|
20
16
|
__export(Form_exports, {
|
|
21
17
|
Form: () => Form,
|
|
@@ -25,25 +21,15 @@ __export(Form_exports, {
|
|
|
25
21
|
useFormContext: () => useFormContext
|
|
26
22
|
});
|
|
27
23
|
module.exports = __toCommonJS(Form_exports);
|
|
28
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
29
|
-
|
|
30
|
-
var import_create_context = require("@tamagui/create-context");
|
|
31
|
-
var import_react = require("react");
|
|
32
|
-
const FORM_NAME = "Form";
|
|
33
|
-
const FormFrame = (0, import_core.styled)(import_core.Stack, {
|
|
24
|
+
var import_core = require("@tamagui/core"), import_create_context = require("@tamagui/create-context"), import_react = require("react"), import_jsx_runtime = require("react/jsx-runtime");
|
|
25
|
+
const FORM_NAME = "Form", FormFrame = (0, import_core.styled)(import_core.Stack, {
|
|
34
26
|
name: FORM_NAME,
|
|
35
27
|
tag: "form"
|
|
36
|
-
})
|
|
37
|
-
const [createFormContext] = (0, import_create_context.createContextScope)(FORM_NAME);
|
|
38
|
-
const [FormProvider, useFormContext] = createFormContext(FORM_NAME);
|
|
39
|
-
const TRIGGER_NAME = "FormTrigger";
|
|
40
|
-
const FormTriggerFrame = (0, import_core.styled)(import_core.Stack, {
|
|
28
|
+
}), [createFormContext] = (0, import_create_context.createContextScope)(FORM_NAME), [FormProvider, useFormContext] = createFormContext(FORM_NAME), TRIGGER_NAME = "FormTrigger", FormTriggerFrame = (0, import_core.styled)(import_core.Stack, {
|
|
41
29
|
name: TRIGGER_NAME
|
|
42
|
-
})
|
|
43
|
-
const FormTrigger = FormTriggerFrame.styleable(
|
|
30
|
+
}), FormTrigger = FormTriggerFrame.styleable(
|
|
44
31
|
(props, forwardedRef) => {
|
|
45
|
-
const { __scopeForm, children, ...triggerProps } = props;
|
|
46
|
-
const context = useFormContext(TRIGGER_NAME, __scopeForm);
|
|
32
|
+
const { __scopeForm, children, ...triggerProps } = props, context = useFormContext(TRIGGER_NAME, __scopeForm);
|
|
47
33
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
48
34
|
FormTriggerFrame,
|
|
49
35
|
{
|
package/dist/cjs/Form.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Form.tsx"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAQO,0BACP,wBAA0C,oCAC1C,eAA4D,kBA+CtD;AA7CN,MAAM,YAAY,QAEL,gBAAY,oBAAO,mBAAO;AAAA,EACrC,MAAM;AAAA,EACN,KAAK;AACP,CAAC,GAWK,CAAC,iBAAiB,QAAI,0CAAmB,SAAS,GAM3C,CAAC,cAAc,cAAc,IACxC,kBAAoC,SAAS,GAQzC,eAAe,eAEf,uBAAmB,oBAAO,mBAAO;AAAA,EACrC,MAAM;AACR,CAAC,GAIY,cAAc,iBAAiB;AAAA,EAC1C,CAAC,OAAsC,iBAAiB;AACtD,UAAM,EAAE,aAAa,UAAU,GAAG,aAAa,IAAI,OAC7C,UAAU,eAAe,cAAc,WAAW;AAExD,WACE;AAAA,MAAC;AAAA;AAAA,QACC,KAAI;AAAA,QACH,GAAG;AAAA,QACJ,UACE,aAAa,cACT,2BAAa,UAAU,EAAE,UAAU,aAAa,SAAS,CAAC,IAC1D;AAAA,QAEN,KAAK;AAAA,QACL,aAAS,kCAAqB,MAAM,SAAgB,QAAQ,QAAQ;AAAA;AAAA,IACtE;AAAA,EAEJ;AACF;AAMA,SAAS,cAAc;AAAA,EACrB;AAAA,EACA,GAAG;AACL,GAA8C;AAC5C,SACE,4CAAC,gBAAa,OAAO,MAAM,aAAa,UACtC,sDAAC,aAAW,GAAG,OAAO,UAAW,CAAC,MAAW,EAAE,eAAe,GAAW,GAC3E;AAEJ;AAEO,MAAM,WAAO,kCAAqB,UAAU,YAAY,aAAa,GAAG;AAAA,EAC7E,SAAS;AACX,CAAC;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
9
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
return to;
|
|
14
|
+
};
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
16
|
+
var Form_exports = {};
|
|
17
|
+
__export(Form_exports, {
|
|
18
|
+
Form: () => Form,
|
|
19
|
+
FormFrame: () => FormFrame,
|
|
20
|
+
FormProvider: () => FormProvider,
|
|
21
|
+
FormTrigger: () => FormTrigger,
|
|
22
|
+
useFormContext: () => useFormContext
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(Form_exports);
|
|
25
|
+
var import_core = require("@tamagui/core"), import_create_context = require("@tamagui/create-context"), import_react = require("react"), import_jsx_runtime = require("react/jsx-runtime");
|
|
26
|
+
const FORM_NAME = "Form", FormFrame = (0, import_core.styled)(import_core.Stack, {
|
|
27
|
+
name: FORM_NAME,
|
|
28
|
+
tag: "form"
|
|
29
|
+
}), [createFormContext] = (0, import_create_context.createContextScope)(FORM_NAME), [FormProvider, useFormContext] = createFormContext(FORM_NAME), TRIGGER_NAME = "FormTrigger", FormTriggerFrame = (0, import_core.styled)(import_core.Stack, {
|
|
30
|
+
name: TRIGGER_NAME
|
|
31
|
+
}), FormTrigger = FormTriggerFrame.styleable(
|
|
32
|
+
(props, forwardedRef) => {
|
|
33
|
+
const { __scopeForm, children, ...triggerProps } = props, context = useFormContext(TRIGGER_NAME, __scopeForm);
|
|
34
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
35
|
+
FormTriggerFrame,
|
|
36
|
+
{
|
|
37
|
+
tag: "button",
|
|
38
|
+
...triggerProps,
|
|
39
|
+
children: triggerProps.asChild ? (0, import_react.cloneElement)(children, { disabled: triggerProps.disabled }) : children,
|
|
40
|
+
ref: forwardedRef,
|
|
41
|
+
onPress: (0, import_core.composeEventHandlers)(props.onPress, context.onSubmit)
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
function FormComponent({
|
|
47
|
+
onSubmit,
|
|
48
|
+
...props
|
|
49
|
+
}) {
|
|
50
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormProvider, { scope: props.__scopeForm, onSubmit, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormFrame, { ...props, onSubmit: (e) => e.preventDefault() }) });
|
|
51
|
+
}
|
|
52
|
+
const Form = (0, import_core.withStaticProperties)(FormFrame.extractable(FormComponent), {
|
|
53
|
+
Trigger: FormTrigger
|
|
54
|
+
});
|
|
55
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
56
|
+
0 && (module.exports = {
|
|
57
|
+
Form,
|
|
58
|
+
FormFrame,
|
|
59
|
+
FormProvider,
|
|
60
|
+
FormTrigger,
|
|
61
|
+
useFormContext
|
|
62
|
+
});
|
|
63
|
+
//# sourceMappingURL=Form.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Form.tsx"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAQO,0BACP,wBAA0C,oCAC1C,eAA4D,kBA+CtD;AA7CN,MAAM,YAAY,QAEL,gBAAY,oBAAO,mBAAO;AAAA,EACrC,MAAM;AAAA,EACN,KAAK;AACP,CAAC,GAWK,CAAC,iBAAiB,QAAI,0CAAmB,SAAS,GAM3C,CAAC,cAAc,cAAc,IACxC,kBAAoC,SAAS,GAQzC,eAAe,eAEf,uBAAmB,oBAAO,mBAAO;AAAA,EACrC,MAAM;AACR,CAAC,GAIY,cAAc,iBAAiB;AAAA,EAC1C,CAAC,OAAsC,iBAAiB;AACtD,UAAM,EAAE,aAAa,UAAU,GAAG,aAAa,IAAI,OAC7C,UAAU,eAAe,cAAc,WAAW;AAExD,WACE;AAAA,MAAC;AAAA;AAAA,QACC,KAAI;AAAA,QACH,GAAG;AAAA,QACJ,UACE,aAAa,cACT,2BAAa,UAAU,EAAE,UAAU,aAAa,SAAS,CAAC,IAC1D;AAAA,QAEN,KAAK;AAAA,QACL,aAAS,kCAAqB,MAAM,SAAgB,QAAQ,QAAQ;AAAA;AAAA,IACtE;AAAA,EAEJ;AACF;AAMA,SAAS,cAAc;AAAA,EACrB;AAAA,EACA,GAAG;AACL,GAA8C;AAC5C,SACE,4CAAC,gBAAa,OAAO,MAAM,aAAa,UACtC,sDAAC,aAAW,GAAG,OAAO,UAAW,CAAC,MAAW,EAAE,eAAe,GAAW,GAC3E;AAEJ;AAEO,MAAM,WAAO,kCAAqB,UAAU,YAAY,aAAa,GAAG;AAAA,EAC7E,SAAS;AACX,CAAC;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
5
|
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from
|
|
6
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
8
7
|
for (let key of __getOwnPropNames(from))
|
|
9
|
-
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
8
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
9
|
return to;
|
|
13
|
-
};
|
|
14
|
-
var
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
10
|
+
}, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
11
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
16
12
|
var src_exports = {};
|
|
17
13
|
module.exports = __toCommonJS(src_exports);
|
|
18
14
|
__reExport(src_exports, require("./Form"), module.exports);
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
return to;
|
|
11
|
+
}, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
12
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
13
|
+
var src_exports = {};
|
|
14
|
+
module.exports = __toCommonJS(src_exports);
|
|
15
|
+
__reExport(src_exports, require("./Form"), module.exports);
|
|
16
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
17
|
+
0 && (module.exports = {
|
|
18
|
+
...require("./Form")
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
package/dist/esm/Form.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
1
|
import {
|
|
3
2
|
Stack,
|
|
4
3
|
composeEventHandlers,
|
|
@@ -7,21 +6,15 @@ import {
|
|
|
7
6
|
} from "@tamagui/core";
|
|
8
7
|
import { createContextScope } from "@tamagui/create-context";
|
|
9
8
|
import { cloneElement } from "react";
|
|
10
|
-
|
|
11
|
-
const FormFrame = styled(Stack, {
|
|
9
|
+
import { jsx } from "react/jsx-runtime";
|
|
10
|
+
const FORM_NAME = "Form", FormFrame = styled(Stack, {
|
|
12
11
|
name: FORM_NAME,
|
|
13
12
|
tag: "form"
|
|
14
|
-
})
|
|
15
|
-
const [createFormContext] = createContextScope(FORM_NAME);
|
|
16
|
-
const [FormProvider, useFormContext] = createFormContext(FORM_NAME);
|
|
17
|
-
const TRIGGER_NAME = "FormTrigger";
|
|
18
|
-
const FormTriggerFrame = styled(Stack, {
|
|
13
|
+
}), [createFormContext] = createContextScope(FORM_NAME), [FormProvider, useFormContext] = createFormContext(FORM_NAME), TRIGGER_NAME = "FormTrigger", FormTriggerFrame = styled(Stack, {
|
|
19
14
|
name: TRIGGER_NAME
|
|
20
|
-
})
|
|
21
|
-
const FormTrigger = FormTriggerFrame.styleable(
|
|
15
|
+
}), FormTrigger = FormTriggerFrame.styleable(
|
|
22
16
|
(props, forwardedRef) => {
|
|
23
|
-
const { __scopeForm, children, ...triggerProps } = props;
|
|
24
|
-
const context = useFormContext(TRIGGER_NAME, __scopeForm);
|
|
17
|
+
const { __scopeForm, children, ...triggerProps } = props, context = useFormContext(TRIGGER_NAME, __scopeForm);
|
|
25
18
|
return /* @__PURE__ */ jsx(
|
|
26
19
|
FormTriggerFrame,
|
|
27
20
|
{
|
package/dist/esm/Form.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Form.tsx"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": "AAAA;AAAA,EAEE;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAgB,0BAA0B;AAC1C,SAA4B,oBAAgC;AA+CtD;AA7CN,MAAM,YAAY,QAEL,YAAY,OAAO,OAAO;AAAA,EACrC,MAAM;AAAA,EACN,KAAK;AACP,CAAC,GAWK,CAAC,iBAAiB,IAAI,mBAAmB,SAAS,GAM3C,CAAC,cAAc,cAAc,IACxC,kBAAoC,SAAS,GAQzC,eAAe,eAEf,mBAAmB,OAAO,OAAO;AAAA,EACrC,MAAM;AACR,CAAC,GAIY,cAAc,iBAAiB;AAAA,EAC1C,CAAC,OAAsC,iBAAiB;AACtD,UAAM,EAAE,aAAa,UAAU,GAAG,aAAa,IAAI,OAC7C,UAAU,eAAe,cAAc,WAAW;AAExD,WACE;AAAA,MAAC;AAAA;AAAA,QACC,KAAI;AAAA,QACH,GAAG;AAAA,QACJ,UACE,aAAa,UACT,aAAa,UAAU,EAAE,UAAU,aAAa,SAAS,CAAC,IAC1D;AAAA,QAEN,KAAK;AAAA,QACL,SAAS,qBAAqB,MAAM,SAAgB,QAAQ,QAAQ;AAAA;AAAA,IACtE;AAAA,EAEJ;AACF;AAMA,SAAS,cAAc;AAAA,EACrB;AAAA,EACA,GAAG;AACL,GAA8C;AAC5C,SACE,oBAAC,gBAAa,OAAO,MAAM,aAAa,UACtC,8BAAC,aAAW,GAAG,OAAO,UAAW,CAAC,MAAW,EAAE,eAAe,GAAW,GAC3E;AAEJ;AAEO,MAAM,OAAO,qBAAqB,UAAU,YAAY,aAAa,GAAG;AAAA,EAC7E,SAAS;AACX,CAAC;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/dist/jsx/Form.js
CHANGED
|
@@ -6,21 +6,14 @@ import {
|
|
|
6
6
|
} from "@tamagui/core";
|
|
7
7
|
import { createContextScope } from "@tamagui/create-context";
|
|
8
8
|
import { cloneElement } from "react";
|
|
9
|
-
const FORM_NAME = "Form"
|
|
10
|
-
const FormFrame = styled(Stack, {
|
|
9
|
+
const FORM_NAME = "Form", FormFrame = styled(Stack, {
|
|
11
10
|
name: FORM_NAME,
|
|
12
11
|
tag: "form"
|
|
13
|
-
})
|
|
14
|
-
const [createFormContext] = createContextScope(FORM_NAME);
|
|
15
|
-
const [FormProvider, useFormContext] = createFormContext(FORM_NAME);
|
|
16
|
-
const TRIGGER_NAME = "FormTrigger";
|
|
17
|
-
const FormTriggerFrame = styled(Stack, {
|
|
12
|
+
}), [createFormContext] = createContextScope(FORM_NAME), [FormProvider, useFormContext] = createFormContext(FORM_NAME), TRIGGER_NAME = "FormTrigger", FormTriggerFrame = styled(Stack, {
|
|
18
13
|
name: TRIGGER_NAME
|
|
19
|
-
})
|
|
20
|
-
const FormTrigger = FormTriggerFrame.styleable(
|
|
14
|
+
}), FormTrigger = FormTriggerFrame.styleable(
|
|
21
15
|
(props, forwardedRef) => {
|
|
22
|
-
const { __scopeForm, children, ...triggerProps } = props;
|
|
23
|
-
const context = useFormContext(TRIGGER_NAME, __scopeForm);
|
|
16
|
+
const { __scopeForm, children, ...triggerProps } = props, context = useFormContext(TRIGGER_NAME, __scopeForm);
|
|
24
17
|
return <FormTriggerFrame
|
|
25
18
|
tag="button"
|
|
26
19
|
{...triggerProps}
|
package/dist/jsx/Form.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Form.tsx"],
|
|
4
|
-
"mappings": "AAAA;AAAA,EAEE;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAgB,0BAA0B;AAC1C,SAA4B,oBAAgC;AAE5D,MAAM,YAAY
|
|
4
|
+
"mappings": "AAAA;AAAA,EAEE;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAgB,0BAA0B;AAC1C,SAA4B,oBAAgC;AAE5D,MAAM,YAAY,QAEL,YAAY,OAAO,OAAO;AAAA,EACrC,MAAM;AAAA,EACN,KAAK;AACP,CAAC,GAWK,CAAC,iBAAiB,IAAI,mBAAmB,SAAS,GAM3C,CAAC,cAAc,cAAc,IACxC,kBAAoC,SAAS,GAQzC,eAAe,eAEf,mBAAmB,OAAO,OAAO;AAAA,EACrC,MAAM;AACR,CAAC,GAIY,cAAc,iBAAiB;AAAA,EAC1C,CAAC,OAAsC,iBAAiB;AACtD,UAAM,EAAE,aAAa,UAAU,GAAG,aAAa,IAAI,OAC7C,UAAU,eAAe,cAAc,WAAW;AAExD,WACE,CAAC;AAAA,MACC,IAAI;AAAA,UACA;AAAA,MACJ,UACE,aAAa,UACT,aAAa,UAAU,EAAE,UAAU,aAAa,SAAS,CAAC,IAC1D;AAAA,MAEN,KAAK;AAAA,MACL,SAAS,qBAAqB,MAAM,SAAgB,QAAQ,QAAQ;AAAA,IACtE;AAAA,EAEJ;AACF;AAMA,SAAS,cAAc;AAAA,EACrB;AAAA,EACA,GAAG;AACL,GAA8C;AAC5C,SACE,CAAC,aAAa,OAAO,MAAM,aAAa,UAAU,UAChD,CAAC,cAAc,OAAO,UAAW,CAAC,MAAW,EAAE,eAAe,GAAW,EAC3E,EAFC;AAIL;AAEO,MAAM,OAAO,qBAAqB,UAAU,YAAY,aAAa,GAAG;AAAA,EAC7E,SAAS;AACX,CAAC;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Stack,
|
|
3
|
+
composeEventHandlers,
|
|
4
|
+
styled,
|
|
5
|
+
withStaticProperties
|
|
6
|
+
} from "@tamagui/core";
|
|
7
|
+
import { createContextScope } from "@tamagui/create-context";
|
|
8
|
+
import { cloneElement } from "react";
|
|
9
|
+
const FORM_NAME = "Form", FormFrame = styled(Stack, {
|
|
10
|
+
name: FORM_NAME,
|
|
11
|
+
tag: "form"
|
|
12
|
+
}), [createFormContext] = createContextScope(FORM_NAME), [FormProvider, useFormContext] = createFormContext(FORM_NAME), TRIGGER_NAME = "FormTrigger", FormTriggerFrame = styled(Stack, {
|
|
13
|
+
name: TRIGGER_NAME
|
|
14
|
+
}), FormTrigger = FormTriggerFrame.styleable(
|
|
15
|
+
(props, forwardedRef) => {
|
|
16
|
+
const { __scopeForm, children, ...triggerProps } = props, context = useFormContext(TRIGGER_NAME, __scopeForm);
|
|
17
|
+
return <FormTriggerFrame
|
|
18
|
+
tag="button"
|
|
19
|
+
{...triggerProps}
|
|
20
|
+
children={triggerProps.asChild ? cloneElement(children, { disabled: triggerProps.disabled }) : children}
|
|
21
|
+
ref={forwardedRef}
|
|
22
|
+
onPress={composeEventHandlers(props.onPress, context.onSubmit)}
|
|
23
|
+
/>;
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
function FormComponent({
|
|
27
|
+
onSubmit,
|
|
28
|
+
...props
|
|
29
|
+
}) {
|
|
30
|
+
return <FormProvider scope={props.__scopeForm} onSubmit={onSubmit}><FormFrame {...props} onSubmit={(e) => e.preventDefault()} /></FormProvider>;
|
|
31
|
+
}
|
|
32
|
+
const Form = withStaticProperties(FormFrame.extractable(FormComponent), {
|
|
33
|
+
Trigger: FormTrigger
|
|
34
|
+
});
|
|
35
|
+
export {
|
|
36
|
+
Form,
|
|
37
|
+
FormFrame,
|
|
38
|
+
FormProvider,
|
|
39
|
+
FormTrigger,
|
|
40
|
+
useFormContext
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=Form.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Form.tsx"],
|
|
4
|
+
"mappings": "AAAA;AAAA,EAEE;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAgB,0BAA0B;AAC1C,SAA4B,oBAAgC;AAE5D,MAAM,YAAY,QAEL,YAAY,OAAO,OAAO;AAAA,EACrC,MAAM;AAAA,EACN,KAAK;AACP,CAAC,GAWK,CAAC,iBAAiB,IAAI,mBAAmB,SAAS,GAM3C,CAAC,cAAc,cAAc,IACxC,kBAAoC,SAAS,GAQzC,eAAe,eAEf,mBAAmB,OAAO,OAAO;AAAA,EACrC,MAAM;AACR,CAAC,GAIY,cAAc,iBAAiB;AAAA,EAC1C,CAAC,OAAsC,iBAAiB;AACtD,UAAM,EAAE,aAAa,UAAU,GAAG,aAAa,IAAI,OAC7C,UAAU,eAAe,cAAc,WAAW;AAExD,WACE,CAAC;AAAA,MACC,IAAI;AAAA,UACA;AAAA,MACJ,UACE,aAAa,UACT,aAAa,UAAU,EAAE,UAAU,aAAa,SAAS,CAAC,IAC1D;AAAA,MAEN,KAAK;AAAA,MACL,SAAS,qBAAqB,MAAM,SAAgB,QAAQ,QAAQ;AAAA,IACtE;AAAA,EAEJ;AACF;AAMA,SAAS,cAAc;AAAA,EACrB;AAAA,EACA,GAAG;AACL,GAA8C;AAC5C,SACE,CAAC,aAAa,OAAO,MAAM,aAAa,UAAU,UAChD,CAAC,cAAc,OAAO,UAAW,CAAC,MAAW,EAAE,eAAe,GAAW,EAC3E,EAFC;AAIL;AAEO,MAAM,OAAO,qBAAqB,UAAU,YAAY,aAAa,GAAG;AAAA,EAC7E,SAAS;AACX,CAAC;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/form",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.62.0",
|
|
4
4
|
"sideEffects": [
|
|
5
5
|
"*.css"
|
|
6
6
|
],
|
|
@@ -31,19 +31,19 @@
|
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@tamagui/compose-refs": "1.
|
|
35
|
-
"@tamagui/core": "1.
|
|
36
|
-
"@tamagui/create-context": "1.
|
|
37
|
-
"@tamagui/focusable": "1.
|
|
38
|
-
"@tamagui/get-button-sized": "1.
|
|
39
|
-
"@tamagui/get-font-sized": "1.
|
|
40
|
-
"@tamagui/text": "1.
|
|
34
|
+
"@tamagui/compose-refs": "1.62.0",
|
|
35
|
+
"@tamagui/core": "1.62.0",
|
|
36
|
+
"@tamagui/create-context": "1.62.0",
|
|
37
|
+
"@tamagui/focusable": "1.62.0",
|
|
38
|
+
"@tamagui/get-button-sized": "1.62.0",
|
|
39
|
+
"@tamagui/get-font-sized": "1.62.0",
|
|
40
|
+
"@tamagui/text": "1.62.0"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"react": "*"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@tamagui/build": "1.
|
|
46
|
+
"@tamagui/build": "1.62.0",
|
|
47
47
|
"react": "^18.2.0"
|
|
48
48
|
},
|
|
49
49
|
"publishConfig": {
|